diff --git a/demo/components/DemoPlayer.vue b/demo/components/DemoPlayer.vue index be77cba8..d13ae441 100644 --- a/demo/components/DemoPlayer.vue +++ b/demo/components/DemoPlayer.vue @@ -208,7 +208,6 @@ export default { isResize: false, useWCS: this.useWCS, useMSE: this.useMSE, - wcsUseVideoRender: this.useWCS, text: "", // background: "bg.jpg", loadingText: "疯狂加载中...", diff --git a/demo/document.md b/demo/document.md index 964aa09e..122cf127 100644 --- a/demo/document.md +++ b/demo/document.md @@ -260,9 +260,7 @@ wasmBinaryFile = 'https://cdn.com/decoder.wasm'; #### webcodecs 硬解码 -默认是通过 `canvas` 进行渲染的 - -> jessibuca pro 支持 `video` 标签渲染 +默认是通过 `canvas` 进行渲染的,也支持video渲染 > Pro 支持 `canvas webgl2` 进行渲染的 diff --git a/demo/pro.md b/demo/pro.md index 4b4326ba..bb259f95 100644 --- a/demo/pro.md +++ b/demo/pro.md @@ -118,7 +118,7 @@ jessibuca pro 是在开源版本的基础上额外支持的深入业务解决方 | 语音通讯(设置采样位数32位或16位或8位) | 不支持 | 支持 | | 语音通讯(设置声道单声道或双声道) | 不支持 | 支持 | | 语音通讯(设置rtp包封装) | 不支持 | 支持 | -| 语音通讯(设置jtt包解封装) | 不支持 | 支持 | +| 语音通讯(设置jtt包解封装)[jtt介绍](https://jessibuca.com/document.html#%E5%85%B3%E4%BA%8E%E5%9B%BD%E6%A0%87-jtt-%E9%81%93%E8%B7%AF%E8%BF%90%E8%BE%93%E8%BD%A6%E8%BE%86%E5%8D%AB%E6%98%9F%E5%AE%9A%E4%BD%8D%E7%B3%BB%E7%BB%9F%E9%9F%B3%E8%A7%86%E9%A2%91%E9%80%9A%E8%AE%AF%E5%8D%8F%E8%AE%AE) | 不支持 | 支持 | | GB28181 TF卡(录像流)流播放 [介绍](https://jessibuca.com/pro-playback.html) | 不支持 | 支持 | | GB28181 TF卡(录像流)流播放,(2/4/8/16/32/64)倍率播放 | 不支持 | 支持 | | GB28181 TF卡(录像流)流播放,关键帧解码播放 | 不支持 | 支持 | @@ -636,10 +636,12 @@ Apple M1, M1 Pro, M1 Max, M1 Ultra 及以上 ## 语音通讯 -支持在web页面采集麦克风数据,支持编码格式pcm、pcma(g711a)、pcmu(g711u),支持封装成rtp包、jtt包。 +支持在web页面采集麦克风数据,支持编码格式pcm、pcma(g711a)、pcmu(g711u),支持封装成rtp协议包、jtt协议包。 > 目前仅支持单向语音通讯,不支持双向语音通讯。(仅支持通过ws传输到服务器,不支持通过ws接收音频数据进行播放),根据国标情况,播放端是跟着音视频一起播放的,可以使用音视频播放器进行播放器音频和视频数据。 +> 关于 jtt协议包的封装格式,可以参考:[jtt协议包](https://jessibuca.com/document.html#%E5%85%B3%E4%BA%8E%E5%9B%BD%E6%A0%87-jtt-%E9%81%93%E8%B7%AF%E8%BF%90%E8%BE%93%E8%BD%A6%E8%BE%86%E5%8D%AB%E6%98%9F%E5%AE%9A%E4%BD%8D%E7%B3%BB%E7%BB%9F%E9%9F%B3%E8%A7%86%E9%A2%91%E9%80%9A%E8%AE%AF%E5%8D%8F%E8%AE%AE) + ## PRO AI ### 人脸识别 diff --git a/demo/public/decoder.js b/demo/public/decoder.js index a1a9f2c8..8cebdc71 100644 --- a/demo/public/decoder.js +++ b/demo/public/decoder.js @@ -7523,7 +7523,7 @@ // demux type useWCS: false, // - wcsUseVideoRender: true, + wcsUseVideoRender: false, // 默认设置为true useMSE: false, // @@ -7538,7 +7538,9 @@ wasmDecodeAudioSyncVideo: false, // wasm 解码之后音视频同步 recordType: FILE_SUFFIX.webm, - useWebFullScreen: false // use web full screen + useWebFullScreen: false, + // use web full screen + initDecoderWorkerTimeout: 10 // }; const WORKER_CMD_TYPE = { diff --git a/demo/public/decoder.js.map b/demo/public/decoder.js.map index 598a454a..42ca053a 100644 --- a/demo/public/decoder.js.map +++ b/demo/public/decoder.js.map @@ -1 +1 @@ -{"version":3,"file":"decoder.js","sources":["../../src/decoder/decoder.js","../../src/utils/webgl.js","../../src/constant/index.js","../../node_modules/screenfull/dist/screenfull.js","../../src/utils/index.js","../../src/worker.js"],"sourcesContent":["var Module=typeof Module!=\"undefined\"?Module:{};var Module={};Module.print=function(text){console.log(\"Jessibuca: [worker]:\",text)};Module.printErr=function(text){console.warn(\"Jessibuca: [worker]:\",text);postMessage({cmd:\"wasmError\",message:text})};var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram=\"./this.program\";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window==\"object\";var ENVIRONMENT_IS_WORKER=typeof importScripts==\"function\";var ENVIRONMENT_IS_NODE=typeof process==\"object\"&&typeof process.versions==\"object\"&&typeof process.versions.node==\"string\";var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(Module[\"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 scriptDirectory=\"\";function locateFile(path){if(Module[\"locateFile\"]){return Module[\"locateFile\"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;if(e&&typeof e==\"object\"&&e.stack){toLog=[e,e.stack]}err(\"exiting due to exception: \"+toLog)}var fs;var nodePath;var requireNodeFS;if(ENVIRONMENT_IS_NODE){if(!(typeof process==\"object\"&&typeof require==\"function\"))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?)\");if(ENVIRONMENT_IS_WORKER){scriptDirectory=require(\"path\").dirname(scriptDirectory)+\"/\"}else{scriptDirectory=__dirname+\"/\"}requireNodeFS=(()=>{if(!nodePath){fs=require(\"fs\");nodePath=require(\"path\")}});read_=function shell_read(filename,binary){requireNodeFS();filename=nodePath[\"normalize\"](filename);return fs.readFileSync(filename,binary?undefined:\"utf8\")};readBinary=(filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret});readAsync=((filename,onload,onerror)=>{requireNodeFS();filename=nodePath[\"normalize\"](filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})});if(process[\"argv\"].length>1){thisProgram=process[\"argv\"][1].replace(/\\\\/g,\"/\")}arguments_=process[\"argv\"].slice(2);if(typeof module!=\"undefined\"){module[\"exports\"]=Module}process[\"on\"](\"uncaughtException\",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process[\"on\"](\"unhandledRejection\",function(reason){throw reason});quit_=((status,toThrow)=>{if(keepRuntimeAlive()){process[\"exitCode\"]=status;throw toThrow}logExceptionOnExit(toThrow);process[\"exit\"](status)});Module[\"inspect\"]=function(){return\"[Emscripten Module object]\"}}else if(ENVIRONMENT_IS_SHELL){if(typeof process==\"object\"&&typeof require===\"function\"||typeof window==\"object\"||typeof importScripts==\"function\")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?)\");if(typeof read!=\"undefined\"){read_=function shell_read(f){return read(f)}}readBinary=function readBinary(f){let data;if(typeof readbuffer==\"function\"){return new Uint8Array(readbuffer(f))}data=read(f,\"binary\");assert(typeof data==\"object\");return data};readAsync=function readAsync(f,onload,onerror){setTimeout(()=>onload(readBinary(f)),0)};if(typeof scriptArgs!=\"undefined\"){arguments_=scriptArgs}else if(typeof arguments!=\"undefined\"){arguments_=arguments}if(typeof quit==\"function\"){quit_=((status,toThrow)=>{logExceptionOnExit(toThrow);quit(status)})}if(typeof print!=\"undefined\"){if(typeof console==\"undefined\")console={};console.log=print;console.warn=console.error=typeof printErr!=\"undefined\"?printErr:print}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!=\"undefined\"&&document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.indexOf(\"blob:\")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,\"\").lastIndexOf(\"/\")+1)}else{scriptDirectory=\"\"}if(!(typeof window==\"object\"||typeof importScripts==\"function\"))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?)\");{read_=(url=>{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.send(null);return xhr.responseText});if(ENVIRONMENT_IS_WORKER){readBinary=(url=>{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.responseType=\"arraybuffer\";xhr.send(null);return new Uint8Array(xhr.response)})}readAsync=((url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,true);xhr.responseType=\"arraybuffer\";xhr.onload=(()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()});xhr.onerror=onerror;xhr.send(null)})}setWindowTitle=(title=>document.title=title)}else{throw new Error(\"environment detection error\")}var out=Module[\"print\"]||console.log.bind(console);var err=Module[\"printErr\"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;checkIncomingModuleAPI();if(Module[\"arguments\"])arguments_=Module[\"arguments\"];legacyModuleProp(\"arguments\",\"arguments_\");if(Module[\"thisProgram\"])thisProgram=Module[\"thisProgram\"];legacyModuleProp(\"thisProgram\",\"thisProgram\");if(Module[\"quit\"])quit_=Module[\"quit\"];legacyModuleProp(\"quit\",\"quit_\");assert(typeof Module[\"memoryInitializerPrefixURL\"]==\"undefined\",\"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"pthreadMainPrefixURL\"]==\"undefined\",\"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"cdInitializerPrefixURL\"]==\"undefined\",\"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"filePackagePrefixURL\"]==\"undefined\",\"Module.filePackagePrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"read\"]==\"undefined\",\"Module.read option was removed (modify read_ in JS)\");assert(typeof Module[\"readAsync\"]==\"undefined\",\"Module.readAsync option was removed (modify readAsync in JS)\");assert(typeof Module[\"readBinary\"]==\"undefined\",\"Module.readBinary option was removed (modify readBinary in JS)\");assert(typeof Module[\"setWindowTitle\"]==\"undefined\",\"Module.setWindowTitle option was removed (modify setWindowTitle in JS)\");assert(typeof Module[\"TOTAL_MEMORY\"]==\"undefined\",\"Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY\");legacyModuleProp(\"read\",\"read_\");legacyModuleProp(\"readAsync\",\"readAsync\");legacyModuleProp(\"readBinary\",\"readBinary\");legacyModuleProp(\"setWindowTitle\",\"setWindowTitle\");assert(!ENVIRONMENT_IS_SHELL,\"shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable.\");var POINTER_SIZE=4;function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;err(text)}}function uleb128Encode(n){assert(n<16384);if(n<128){return[n]}return[n%128|128,n>>7]}function convertJsFunctionToWasm(func,sig){if(typeof WebAssembly.Function==\"function\"){var typeNames={\"i\":\"i32\",\"j\":\"i64\",\"f\":\"f32\",\"d\":\"f64\"};var type={parameters:[],results:sig[0]==\"v\"?[]:[typeNames[sig[0]]]};for(var i=1;iabort(unexportedMessage(sym,isFSSybol)))}}var tempRet0=0;var setTempRet0=value=>{tempRet0=value};var wasmBinary;if(Module[\"wasmBinary\"])wasmBinary=Module[\"wasmBinary\"];legacyModuleProp(\"wasmBinary\",\"wasmBinary\");var noExitRuntime=Module[\"noExitRuntime\"]||true;legacyModuleProp(\"noExitRuntime\",\"noExitRuntime\");if(typeof WebAssembly!=\"object\"){abort(\"no native wasm support detected\")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(\"Assertion failed\"+(text?\": \"+text:\"\"))}}function getCFunc(ident){var func=Module[\"_\"+ident];assert(func,\"Cannot call unknown function \"+ident+\", make sure it is exported\");return func}function ccall(ident,returnType,argTypes,args,opts){var toC={\"string\":function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},\"array\":function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType===\"string\")return UTF8ToString(ret);if(returnType===\"boolean\")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;assert(returnType!==\"array\",'Return type should not be \"array\".');if(args){for(var i=0;i=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}else{var str=\"\";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):\"\"}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;if(u>1114111)warnOnce(\"Invalid Unicode code point 0x\"+u.toString(16)+\" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).\");heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){assert(typeof maxBytesToWrite==\"number\",\"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!\");return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}var UTF16Decoder=typeof TextDecoder!=\"undefined\"?new TextDecoder(\"utf-16le\"):undefined;function UTF16ToString(ptr,maxBytesToRead){assert(ptr%2==0,\"Pointer passed to UTF16ToString must be aligned to two bytes!\");var endPtr=ptr;var idx=endPtr>>1;var maxIdx=idx+maxBytesToRead/2;while(!(idx>=maxIdx)&&HEAPU16[idx])++idx;endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder){return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr))}else{var str=\"\";for(var i=0;!(i>=maxBytesToRead/2);++i){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit)}return str}}function stringToUTF16(str,outPtr,maxBytesToWrite){assert(outPtr%2==0,\"Pointer passed to stringToUTF16 must be aligned to two bytes!\");assert(typeof maxBytesToWrite==\"number\",\"stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!\");if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr}function lengthBytesUTF16(str){return str.length*2}function UTF32ToString(ptr,maxBytesToRead){assert(ptr%4==0,\"Pointer passed to UTF32ToString must be aligned to four bytes!\");var i=0;var str=\"\";while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)break;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}else{str+=String.fromCharCode(utf32)}}return str}function stringToUTF32(str,outPtr,maxBytesToWrite){assert(outPtr%4==0,\"Pointer passed to stringToUTF32 must be aligned to four bytes!\");assert(typeof maxBytesToWrite==\"number\",\"stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!\");if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr}function lengthBytesUTF32(str){var len=0;for(var i=0;i=55296&&codeUnit<=57343)++i;len+=4}return len}function allocateUTF8(str){var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8Array(str,HEAP8,ret,size);return ret}function writeArrayToMemory(array,buffer){assert(array.length>=0,\"writeArrayToMemory array must have a length (should be an array or typed array)\");HEAP8.set(array,buffer)}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module[\"HEAP8\"]=HEAP8=new Int8Array(buf);Module[\"HEAP16\"]=HEAP16=new Int16Array(buf);Module[\"HEAP32\"]=HEAP32=new Int32Array(buf);Module[\"HEAPU8\"]=HEAPU8=new Uint8Array(buf);Module[\"HEAPU16\"]=HEAPU16=new Uint16Array(buf);Module[\"HEAPU32\"]=HEAPU32=new Uint32Array(buf);Module[\"HEAPF32\"]=HEAPF32=new Float32Array(buf);Module[\"HEAPF64\"]=HEAPF64=new Float64Array(buf)}var TOTAL_STACK=5242880;if(Module[\"TOTAL_STACK\"])assert(TOTAL_STACK===Module[\"TOTAL_STACK\"],\"the stack size can no longer be determined at runtime\");var INITIAL_MEMORY=Module[\"INITIAL_MEMORY\"]||67108864;legacyModuleProp(\"INITIAL_MEMORY\",\"INITIAL_MEMORY\");assert(INITIAL_MEMORY>=TOTAL_STACK,\"INITIAL_MEMORY should be larger than TOTAL_STACK, was \"+INITIAL_MEMORY+\"! (TOTAL_STACK=\"+TOTAL_STACK+\")\");assert(typeof Int32Array!=\"undefined\"&&typeof Float64Array!==\"undefined\"&&Int32Array.prototype.subarray!=undefined&&Int32Array.prototype.set!=undefined,\"JS engine does not provide full typed array support\");assert(!Module[\"wasmMemory\"],\"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally\");assert(INITIAL_MEMORY==67108864,\"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically\");var wasmTable;function writeStackCookie(){var max=_emscripten_stack_get_end();assert((max&3)==0);HEAP32[max>>2]=34821223;HEAP32[max+4>>2]=2310721022;HEAP32[0]=1668509029}function checkStackCookie(){if(ABORT)return;var max=_emscripten_stack_get_end();var cookie1=HEAPU32[max>>2];var cookie2=HEAPU32[max+4>>2];if(cookie1!=34821223||cookie2!=2310721022){abort(\"Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x\"+cookie2.toString(16)+\" 0x\"+cookie1.toString(16))}if(HEAP32[0]!==1668509029)abort(\"Runtime error: The application has corrupted its heap memory area (address zero)!\")}(function(){var h16=new Int16Array(1);var h8=new Int8Array(h16.buffer);h16[0]=25459;if(h8[0]!==115||h8[1]!==99)throw\"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)\"})();var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}function preRun(){if(Module[\"preRun\"]){if(typeof Module[\"preRun\"]==\"function\")Module[\"preRun\"]=[Module[\"preRun\"]];while(Module[\"preRun\"].length){addOnPreRun(Module[\"preRun\"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){checkStackCookie();assert(!runtimeInitialized);runtimeInitialized=true;if(!Module[\"noFSInit\"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();callRuntimeCallbacks(__ATINIT__)}function postRun(){checkStackCookie();if(Module[\"postRun\"]){if(typeof Module[\"postRun\"]==\"function\")Module[\"postRun\"]=[Module[\"postRun\"]];while(Module[\"postRun\"].length){addOnPostRun(Module[\"postRun\"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}assert(Math.imul,\"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill\");assert(Math.fround,\"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill\");assert(Math.clz32,\"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill\");assert(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 runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;var runDependencyTracking={};function getUniqueRunDependency(id){var orig=id;while(1){if(!runDependencyTracking[id])return id;id=orig+Math.random()}}function addRunDependency(id){runDependencies++;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}if(id){assert(!runDependencyTracking[id]);runDependencyTracking[id]=1;if(runDependencyWatcher===null&&typeof setInterval!=\"undefined\"){runDependencyWatcher=setInterval(function(){if(ABORT){clearInterval(runDependencyWatcher);runDependencyWatcher=null;return}var shown=false;for(var dep in runDependencyTracking){if(!shown){shown=true;err(\"still waiting on run dependencies:\")}err(\"dependency: \"+dep)}if(shown){err(\"(end of list)\")}},1e4)}}else{err(\"warning: run dependency added without ID\")}}function removeRunDependency(id){runDependencies--;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}if(id){assert(runDependencyTracking[id]);delete runDependencyTracking[id]}else{err(\"warning: run dependency removed without ID\")}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){{if(Module[\"onAbort\"]){Module[\"onAbort\"](what)}}what=\"Aborted(\"+what+\")\";err(what);ABORT=true;EXITSTATUS=1;var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix=\"data:application/octet-stream;base64,\";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith(\"file://\")}function createExportWrapper(name,fixedasm){return function(){var displayName=name;var asm=fixedasm;if(!fixedasm){asm=Module[\"asm\"]}assert(runtimeInitialized,\"native function `\"+displayName+\"` called before runtime initialization\");if(!asm[name]){assert(asm[name],\"exported native function `\"+displayName+\"` not found\")}return asm[name].apply(null,arguments)}}var wasmBinaryFile;wasmBinaryFile=\"decoder.wasm\";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}else{throw\"both async and sync fetching of the wasm failed\"}}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch==\"function\"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){if(!response[\"ok\"]){throw\"failed to load wasm binary file at '\"+wasmBinaryFile+\"'\"}return response[\"arrayBuffer\"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={\"env\":asmLibraryArg,\"wasi_snapshot_preview1\":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module[\"asm\"]=exports;wasmMemory=Module[\"asm\"][\"memory\"];assert(wasmMemory,\"memory not found in wasm exports\");updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module[\"asm\"][\"__indirect_function_table\"];assert(wasmTable,\"table not found in wasm exports\");addOnInit(Module[\"asm\"][\"__wasm_call_ctors\"]);removeRunDependency(\"wasm-instantiate\")}addRunDependency(\"wasm-instantiate\");var trueModule=Module;function receiveInstantiationResult(result){assert(Module===trueModule,\"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?\");trueModule=null;receiveInstance(result[\"instance\"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err(\"failed to asynchronously prepare wasm: \"+reason);if(isFileURI(wasmBinaryFile)){err(\"warning: Loading from a file URI (\"+wasmBinaryFile+\") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing\")}abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming==\"function\"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch==\"function\"){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err(\"wasm streaming compile failed: \"+reason);err(\"falling back to ArrayBuffer instantiation\");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module[\"instantiateWasm\"]){try{var exports=Module[\"instantiateWasm\"](info,receiveInstance);return exports}catch(e){err(\"Module.instantiateWasm callback failed with error: \"+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback==\"function\"){callback(Module);continue}var func=callback.func;if(typeof func==\"number\"){if(callback.arg===undefined){getWasmTableEntry(func)()}else{getWasmTableEntry(func)(callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}function demangle(func){warnOnce(\"warning: build with -sDEMANGLE_SUPPORT to link in libcxxabi demangling\");return func}function demangleAll(text){var regex=/\\b_Z[\\w\\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+\" [\"+x+\"]\"})}function getWasmTableEntry(funcPtr){return wasmTable.get(funcPtr)}function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return\"(no stack trace available)\"}}return error.stack.toString()}function setWasmTableEntry(idx,func){wasmTable.set(idx,func)}function setErrNo(value){HEAP32[___errno_location()>>2]=value;return value}var PATH={isAbs:path=>path.charAt(0)===\"/\",splitPath:filename=>{var splitPathRe=/^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last===\".\"){parts.splice(i,1)}else if(last===\"..\"){parts.splice(i,1);up++}else if(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)===\"/\";path=PATH.normalizeArray(path.split(\"/\").filter(p=>!!p),!isAbsolute).join(\"/\");if(!path&&!isAbsolute){path=\".\"}if(path&&trailingSlash){path+=\"/\"}return(isAbsolute?\"/\":\"\")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return\".\"}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:path=>{if(path===\"/\")return\"/\";path=PATH.normalize(path);path=path.replace(/\\/$/,\"\");var lastSlash=path.lastIndexOf(\"/\");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},join:function(){var paths=Array.prototype.slice.call(arguments,0);return PATH.normalize(paths.join(\"/\"))},join2:(l,r)=>{return PATH.normalize(l+\"/\"+r)}};function getRandomDevice(){if(typeof crypto==\"object\"&&typeof crypto[\"getRandomValues\"]==\"function\"){var randomBuffer=new Uint8Array(1);return function(){crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require(\"crypto\");return function(){return crypto_module[\"randomBytes\"](1)[0]}}catch(e){}}return function(){abort(\"no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };\")}}var PATH_FS={resolve:function(){var resolvedPath=\"\",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!=\"string\"){throw new TypeError(\"Arguments to path.resolve must be strings\")}else if(!path){return\"\"}resolvedPath=path+\"/\"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split(\"/\").filter(p=>!!p),!resolvedAbsolute).join(\"/\");return(resolvedAbsolute?\"/\":\"\")+resolvedPath||\".\"},relative:(from,to)=>{from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!==\"\")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split(\"/\"));var toParts=trim(to.split(\"/\"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i0){result=buf.slice(0,bytesRead).toString(\"utf-8\")}else{result=null}}else if(typeof window!=\"undefined\"&&typeof window.prompt==\"function\"){result=window.prompt(\"Input: \");if(result!==null){result+=\"\\n\"}}else if(typeof readline==\"function\"){result=readline();if(result!==null){result+=\"\\n\"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()},put_char:function(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function zeroMemory(address,size){HEAPU8.fill(0,address,address+size)}function alignMemory(size,alignment){assert(alignment,\"alignment argument is required\");return Math.ceil(size/alignment)*alignment}function mmapAlloc(size){size=alignMemory(size,65536);var ptr=_emscripten_builtin_memalign(65536,size);if(!ptr)return 0;zeroMemory(ptr,size);return ptr}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,\"/\",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage:function(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage:function(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr:function(node){var attr={};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;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{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);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(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:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[\".\",\"..\"];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(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);assert(size>=0);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{path=PATH_FS.resolve(FS.cwd(),path);if(!path)return{path:\"\",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=PATH.normalizeArray(path.split(\"/\").filter(p=>!!p),false);var current=FS.root;var current_path=\"/\";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!==\"/\"?mount+\"/\"+path:mount+path}path=path?node.name+\"/\"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>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{var current=FS.nameTable[hash];while(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)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];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)=>{assert(typeof parent==\"object\");var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode:node=>{FS.hashRemoveNode(node)},isRoot:node=>{return node===node.parent},isMountpoint:node=>{return!!node.mounted},isFile:mode=>{return(mode&61440)===32768},isDir:mode=>{return(mode&61440)===16384},isLink:mode=>{return(mode&61440)===40960},isChrdev:mode=>{return(mode&61440)===8192},isBlkdev:mode=>{return(mode&61440)===24576},isFIFO:mode=>{return(mode&61440)===4096},isSocket:mode=>{return(mode&49152)===49152},flagModes:{\"r\":0,\"r+\":2,\"w\":577,\"w+\":578,\"a\":1089,\"a+\":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags==\"undefined\"){throw new Error(\"Unknown file open mode: \"+str)}return flags},flagsToPermissionString:flag=>{var perms=[\"r\",\"w\",\"rw\"][flag&3];if(flag&512){perms+=\"w\"}return perms},nodePermissions:(node,perms)=>{if(FS.ignorePermissions){return 0}if(perms.includes(\"r\")&&!(node.mode&292)){return 2}else if(perms.includes(\"w\")&&!(node.mode&146)){return 2}else if(perms.includes(\"x\")&&!(node.mode&73)){return 2}return 0},mayLookup:dir=>{var errCode=FS.nodePermissions(dir,\"x\");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=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}var errCode=FS.nodePermissions(dir,\"wx\");if(errCode){return errCode}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)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!==\"r\"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get function(){return this.shared.position},set:function(val){this.shared.position=val}}}}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return 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;if(stream.stream_ops.open){stream.stream_ops.open(stream)}},llseek:()=>{throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice:(dev,ops)=>{FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts:mount=>{var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate==\"function\"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err(\"warning: \"+FS.syncFSRequests+\" FS.syncfs operations in flight at once, probably just doing extra work\")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){assert(FS.syncFSRequests>0);FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++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)=>{if(typeof type==\"string\"){throw type}var root=mountpoint===\"/\";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount:mountpoint=>{var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(hash=>{var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);assert(idx!==-1);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name===\".\"||name===\"..\"){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree:(path,mode)=>{var dirs=path.split(\"/\");var d=\"\";for(var i=0;i{if(typeof dev==\"undefined\"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink:(oldpath,newpath)=>{if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},rename:(old_path,new_path)=>{var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!==\".\"){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!==\".\"){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.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!==old_dir){errCode=FS.nodePermissions(old_dir,\"w\");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name)}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);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,name);FS.destroyNode(node)},readdir:path=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node.node_ops.readdir){throw new FS.ErrnoError(54)}return node.node_ops.readdir(node)},unlink:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);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,name);FS.destroyNode(node)},readlink:path=>{var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path==\"string\"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chmod(stream.node,mode)},chown:(path,uid,gid,dontFollow)=>{var node;if(typeof path==\"string\"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{timestamp:Date.now()})},lchown:(path,uid,gid)=>{FS.chown(path,uid,gid,true)},fchown:(fd,uid,gid)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chown(stream.node,uid,gid)},truncate:(path,len)=>{if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path==\"string\"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,\"w\");if(errCode){throw new FS.ErrnoError(errCode)}node.node_ops.setattr(node,{size:len,timestamp:Date.now()})},ftruncate:(fd,len)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode,fd_start,fd_end)=>{if(path===\"\"){throw new FS.ErrnoError(44)}flags=typeof flags==\"string\"?FS.modeStringToFlags(flags):flags;mode=typeof mode==\"undefined\"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path==\"object\"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else{node=FS.mknod(path,mode,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node:node,path:FS.getPath(node),flags:flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false},fd_start,fd_end);if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(Module[\"logReadFiles\"]&&!(flags&1)){if(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},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(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return 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((stream.flags&2097155)===1){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=typeof position!=\"undefined\";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},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((stream.flags&2097155)===0){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)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!=\"undefined\";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate:(stream,offset,length)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(offset<0||length<=0){throw new FS.ErrnoError(28)}if((stream.flags&2097155)===0){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,address,length,position,prot,flags)=>{if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}return stream.stream_ops.mmap(stream,address,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream||!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||\"binary\";if(opts.encoding!==\"utf8\"&&opts.encoding!==\"binary\"){throw new Error('Invalid encoding type \"'+opts.encoding+'\"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding===\"utf8\"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding===\"binary\"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data==\"string\"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error(\"Unsupported data type\")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,\"x\");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.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 random_device=getRandomDevice();FS.createDevice(\"/dev\",\"random\",random_device);FS.createDevice(\"/dev\",\"urandom\",random_device);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\",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:\"fake\"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},\"/proc/self/fd\")},createStandardStreams:()=>{if(Module[\"stdin\"]){FS.createDevice(\"/dev\",\"stdin\",Module[\"stdin\"])}else{FS.symlink(\"/dev/tty\",\"/dev/stdin\")}if(Module[\"stdout\"]){FS.createDevice(\"/dev\",\"stdout\",null,Module[\"stdout\"])}else{FS.symlink(\"/dev/tty\",\"/dev/stdout\")}if(Module[\"stderr\"]){FS.createDevice(\"/dev\",\"stderr\",null,Module[\"stderr\"])}else{FS.symlink(\"/dev/tty1\",\"/dev/stderr\")}var stdin=FS.open(\"/dev/stdin\",0);var stdout=FS.open(\"/dev/stdout\",1);var stderr=FS.open(\"/dev/stderr\",1);assert(stdin.fd===0,\"invalid handle for stdin (\"+stdin.fd+\")\");assert(stdout.fd===1,\"invalid handle for stdout (\"+stdout.fd+\")\");assert(stderr.fd===2,\"invalid handle for stderr (\"+stderr.fd+\")\")},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno;for(var key in ERRNO_CODES){if(ERRNO_CODES[key]===errno){this.code=key;break}}};this.setErrno(errno);this.message=ERRNO_MESSAGES[errno];if(this.stack){Object.defineProperty(this,\"stack\",{value:(new Error).stack,writable:true});this.stack=demangleAll(this.stack)}};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=\"\"})},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)=>{assert(!FS.init.initialized,\"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)\");FS.init.initialized=true;FS.ensureErrnoError();Module[\"stdin\"]=input||Module[\"stdin\"];Module[\"stdout\"]=output||Module[\"stdout\"];Module[\"stderr\"]=error||Module[\"stderr\"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;___stdio_exit();for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},findObject:(path,dontResolveLastLink)=>{var ret=FS.analyzePath(path,dontResolveLastLink);if(ret.exists){return ret.object}else{return null}},analyzePath:(path,dontResolveLastLink)=>{try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;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=typeof parent==\"string\"?parent:FS.getPath(parent);var parts=path.split(\"/\").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){}parent=current}return current},createFile:(parent,name,properties,canRead,canWrite)=>{var path=PATH.join2(typeof parent==\"string\"?parent:FS.getPath(parent),name);var mode=FS.getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile:(parent,name,data,canRead,canWrite,canOwn)=>{var path=name;if(parent){parent=typeof parent==\"string\"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS.getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data==\"string\"){var arr=new Array(data.length);for(var i=0,len=data.length;i{var path=PATH.join2(typeof parent==\"string\"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!=\"undefined\"){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.\")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error(\"Cannot load without read() or XMLHttpRequest.\")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open(\"HEAD\",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error(\"Couldn't load \"+url+\". Status: \"+xhr.status);var datalength=Number(xhr.getResponseHeader(\"Content-length\"));var header;var hasByteServing=(header=xhr.getResponseHeader(\"Accept-Ranges\"))&&header===\"bytes\";var usesGzip=(header=xhr.getResponseHeader(\"Content-Encoding\"))&&header===\"gzip\";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)throw new Error(\"invalid range (\"+from+\", \"+to+\") or no bytes requested!\");if(to>datalength-1)throw new Error(\"only \"+datalength+\" bytes available! programmer error!\");var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);if(datalength!==chunkSize)xhr.setRequestHeader(\"Range\",\"bytes=\"+from+\"-\"+to);xhr.responseType=\"arraybuffer\";if(xhr.overrideMimeType){xhr.overrideMimeType(\"text/plain; charset=x-user-defined\")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error(\"Couldn't load \"+url+\". Status: \"+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}else{return intArrayFromString(xhr.responseText||\"\",true)}};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]==\"undefined\"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]==\"undefined\")throw new Error(\"doXHR failed!\");return lazyArray.chunks[chunkNum]});if(usesGzip||!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=true};if(typeof XMLHttpRequest!=\"undefined\"){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;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});stream_ops.read=((stream,buffer,offset,length,position)=>{FS.forceLoadFile(node);var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);assert(size>=0);if(contents.slice){for(var i=0;i{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency(\"cp \"+fullname);function processData(byteArray){function finish(byteArray){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url==\"string\"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return\"EM_FS_\"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:\"FILE_DATA\",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=(()=>{out(\"creating db\");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)});openRequest.onsuccess=(()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],\"readwrite\");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=(()=>{ok++;if(ok+fail==total)finish()});putRequest.onerror=(()=>{fail++;if(ok+fail==total)finish()})});transaction.onerror=onerror});openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=(()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],\"readonly\")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=(()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()});getRequest.onerror=(()=>{fail++;if(ok+fail==total)finish()})});transaction.onerror=onerror});openRequest.onerror=onerror},absolutePath:()=>{abort(\"FS.absolutePath has been removed; use PATH_FS.resolve instead\")},createFolder:()=>{abort(\"FS.createFolder has been removed; use FS.mkdir instead\")},createLink:()=>{abort(\"FS.createLink has been removed; use FS.symlink instead\")},joinPath:()=>{abort(\"FS.joinPath has been removed; use PATH.join instead\")},mmapAlloc:()=>{abort(\"FS.mmapAlloc has been replaced by the top level function mmapAlloc\")},standardizePath:()=>{abort(\"FS.standardizePath has been removed; use PATH.normalize instead\")}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=FS.getStream(dirfd);if(!dirstream)throw new FS.ErrnoError(8);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return PATH.join2(dir,path)},doStat:function(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]=0;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAP32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;HEAP32[buf+32>>2]=0;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;HEAP32[buf+56>>2]=stat.atime.getTime()/1e3|0;HEAP32[buf+60>>2]=0;HEAP32[buf+64>>2]=stat.mtime.getTime()/1e3|0;HEAP32[buf+68>>2]=0;HEAP32[buf+72>>2]=stat.ctime.getTime()/1e3|0;HEAP32[buf+76>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+80>>2]=tempI64[0],HEAP32[buf+84>>2]=tempI64[1];return 0},doMsync:function(addr,stream,len,flags,offset){var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},doMknod:function(path,mode,dev){switch(mode&61440){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-28}FS.mknod(path,mode,dev);return 0},doReadlink:function(path,buf,bufsize){if(bufsize<=0)return-28;var ret=FS.readlink(path);var len=Math.min(bufsize,lengthBytesUTF8(ret));var endChar=HEAP8[buf+len];stringToUTF8(ret,buf,bufsize+1);HEAP8[buf+len]=endChar;return len},doAccess:function(path,amode){if(amode&~7){return-28}var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node){return-44}var perms=\"\";if(amode&4)perms+=\"r\";if(amode&2)perms+=\"w\";if(amode&1)perms+=\"x\";if(perms&&FS.nodePermissions(node,perms)){return-2}return 0},doReadv:function(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAP32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2];var len=HEAP32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr}return ret},varargs:undefined,get:function(){assert(SYSCALLS.varargs!=undefined);SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-28}var newStream;newStream=FS.createStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 5:{var arg=SYSCALLS.get();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS==\"undefined\"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_openat(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(typeof FS==\"undefined\"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function __embind_register_bigint(primitiveType,name,size,minRange,maxRange){}function getShiftFromSize(size){switch(size){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError(\"Unknown type size: \"+size)}}function embind_init_charCodes(){var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i)}embind_charCodes=codes}var embind_charCodes=undefined;function readLatin1String(ptr){var ret=\"\";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]]}return ret}var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var char_0=48;var char_9=57;function makeLegalFunctionName(name){if(undefined===name){return\"_unknown\"}name=name.replace(/[^a-zA-Z0-9_]/g,\"$\");var f=name.charCodeAt(0);if(f>=char_0&&f<=char_9){return\"_\"+name}return name}function createNamedFunction(name,body){name=makeLegalFunctionName(name);return new Function(\"body\",\"return function \"+name+\"() {\\n\"+' \"use strict\";'+\" return body.apply(this, arguments);\\n\"+\"};\\n\")(body)}function extendError(baseErrorType,errorName){var errorClass=createNamedFunction(errorName,function(message){this.name=errorName;this.message=message;var stack=new Error(message).stack;if(stack!==undefined){this.stack=this.toString()+\"\\n\"+stack.replace(/^Error(:[^\\n]*)?\\n/,\"\")}});errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=function(){if(this.message===undefined){return this.name}else{return this.name+\": \"+this.message}};return errorClass}var BindingError=undefined;function throwBindingError(message){throw new BindingError(message)}var InternalError=undefined;function throwInternalError(message){throw new InternalError(message)}function whenDependentTypesAreResolved(myTypes,dependentTypes,getTypeConverters){myTypes.forEach(function(type){typeDependencies[type]=dependentTypes});function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError(\"Mismatched type converter count\")}for(var i=0;i{if(registeredTypes.hasOwnProperty(dt)){typeConverters[i]=registeredTypes[dt]}else{unregisteredTypes.push(dt);if(!awaitingDependencies.hasOwnProperty(dt)){awaitingDependencies[dt]=[]}awaitingDependencies[dt].push(()=>{typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters)}})}});if(0===unregisteredTypes.length){onComplete(typeConverters)}}function registerType(rawType,registeredInstance,options={}){if(!(\"argPackAdvance\"in registeredInstance)){throw new TypeError(\"registerType registeredInstance requires argPackAdvance\")}var name=registeredInstance.name;if(!rawType){throwBindingError('type \"'+name+'\" must have a positive integer typeid pointer')}if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return}else{throwBindingError(\"Cannot register type '\"+name+\"' twice\")}}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach(cb=>cb())}}function __embind_register_bool(rawType,name,size,trueValue,falseValue){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,\"fromWireType\":function(wt){return!!wt},\"toWireType\":function(destructors,o){return o?trueValue:falseValue},\"argPackAdvance\":8,\"readValueFromPointer\":function(pointer){var heap;if(size===1){heap=HEAP8}else if(size===2){heap=HEAP16}else if(size===4){heap=HEAP32}else{throw new TypeError(\"Unknown boolean type size: \"+name)}return this[\"fromWireType\"](heap[pointer>>shift])},destructorFunction:null})}function ClassHandle_isAliasOf(other){if(!(this instanceof ClassHandle)){return false}if(!(other instanceof ClassHandle)){return false}var leftClass=this.$$.ptrType.registeredClass;var left=this.$$.ptr;var rightClass=other.$$.ptrType.registeredClass;var right=other.$$.ptr;while(leftClass.baseClass){left=leftClass.upcast(left);leftClass=leftClass.baseClass}while(rightClass.baseClass){right=rightClass.upcast(right);rightClass=rightClass.baseClass}return leftClass===rightClass&&left===right}function shallowCopyInternalPointer(o){return{count:o.count,deleteScheduled:o.deleteScheduled,preservePointerOnDelete:o.preservePointerOnDelete,ptr:o.ptr,ptrType:o.ptrType,smartPtr:o.smartPtr,smartPtrType:o.smartPtrType}}function throwInstanceAlreadyDeleted(obj){function getInstanceTypeName(handle){return handle.$$.ptrType.registeredClass.name}throwBindingError(getInstanceTypeName(obj)+\" instance already deleted\")}var finalizationRegistry=false;function detachFinalizer(handle){}function runDestructor($$){if($$.smartPtr){$$.smartPtrType.rawDestructor($$.smartPtr)}else{$$.ptrType.registeredClass.rawDestructor($$.ptr)}}function releaseClassHandle($$){$$.count.value-=1;var toDelete=0===$$.count.value;if(toDelete){runDestructor($$)}}function downcastPointer(ptr,ptrClass,desiredClass){if(ptrClass===desiredClass){return ptr}if(undefined===desiredClass.baseClass){return null}var rv=downcastPointer(ptr,ptrClass,desiredClass.baseClass);if(rv===null){return null}return desiredClass.downcast(rv)}var registeredPointers={};function getInheritedInstanceCount(){return Object.keys(registeredInstances).length}function getLiveInheritedInstances(){var rv=[];for(var k in registeredInstances){if(registeredInstances.hasOwnProperty(k)){rv.push(registeredInstances[k])}}return rv}var deletionQueue=[];function flushPendingDeletes(){while(deletionQueue.length){var obj=deletionQueue.pop();obj.$$.deleteScheduled=false;obj[\"delete\"]()}}var delayFunction=undefined;function setDelayFunction(fn){delayFunction=fn;if(deletionQueue.length&&delayFunction){delayFunction(flushPendingDeletes)}}function init_embind(){Module[\"getInheritedInstanceCount\"]=getInheritedInstanceCount;Module[\"getLiveInheritedInstances\"]=getLiveInheritedInstances;Module[\"flushPendingDeletes\"]=flushPendingDeletes;Module[\"setDelayFunction\"]=setDelayFunction}var registeredInstances={};function getBasestPointer(class_,ptr){if(ptr===undefined){throwBindingError(\"ptr should not be undefined\")}while(class_.baseClass){ptr=class_.upcast(ptr);class_=class_.baseClass}return ptr}function getInheritedInstance(class_,ptr){ptr=getBasestPointer(class_,ptr);return registeredInstances[ptr]}function makeClassHandle(prototype,record){if(!record.ptrType||!record.ptr){throwInternalError(\"makeClassHandle requires ptr and ptrType\")}var hasSmartPtrType=!!record.smartPtrType;var hasSmartPtr=!!record.smartPtr;if(hasSmartPtrType!==hasSmartPtr){throwInternalError(\"Both smartPtrType and smartPtr must be specified\")}record.count={value:1};return attachFinalizer(Object.create(prototype,{$$:{value:record}}))}function RegisteredPointer_fromWireType(ptr){var rawPointer=this.getPointee(ptr);if(!rawPointer){this.destructor(ptr);return null}var registeredInstance=getInheritedInstance(this.registeredClass,rawPointer);if(undefined!==registeredInstance){if(0===registeredInstance.$$.count.value){registeredInstance.$$.ptr=rawPointer;registeredInstance.$$.smartPtr=ptr;return registeredInstance[\"clone\"]()}else{var rv=registeredInstance[\"clone\"]();this.destructor(ptr);return rv}}function makeDefaultHandle(){if(this.isSmartPointer){return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:rawPointer,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this,ptr:ptr})}}var actualType=this.registeredClass.getActualType(rawPointer);var registeredPointerRecord=registeredPointers[actualType];if(!registeredPointerRecord){return makeDefaultHandle.call(this)}var toType;if(this.isConst){toType=registeredPointerRecord.constPointerType}else{toType=registeredPointerRecord.pointerType}var dp=downcastPointer(rawPointer,this.registeredClass,toType.registeredClass);if(dp===null){return makeDefaultHandle.call(this)}if(this.isSmartPointer){return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp})}}function attachFinalizer(handle){if(\"undefined\"===typeof FinalizationRegistry){attachFinalizer=(handle=>handle);return handle}finalizationRegistry=new FinalizationRegistry(info=>{console.warn(info.leakWarning.stack.replace(/^Error: /,\"\"));releaseClassHandle(info.$$)});attachFinalizer=(handle=>{var $$=handle.$$;var hasSmartPtr=!!$$.smartPtr;if(hasSmartPtr){var info={$$:$$};var cls=$$.ptrType.registeredClass;info.leakWarning=new Error(\"Embind found a leaked C++ instance \"+cls.name+\" <0x\"+$$.ptr.toString(16)+\">.\\n\"+\"We'll free it automatically in this case, but this functionality is not reliable across various environments.\\n\"+\"Make sure to invoke .delete() manually once you're done with the instance instead.\\n\"+\"Originally allocated\");if(\"captureStackTrace\"in Error){Error.captureStackTrace(info.leakWarning,RegisteredPointer_fromWireType)}finalizationRegistry.register(handle,info,handle)}return handle});detachFinalizer=(handle=>finalizationRegistry.unregister(handle));return attachFinalizer(handle)}function ClassHandle_clone(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.preservePointerOnDelete){this.$$.count.value+=1;return this}else{var clone=attachFinalizer(Object.create(Object.getPrototypeOf(this),{$$:{value:shallowCopyInternalPointer(this.$$)}}));clone.$$.count.value+=1;clone.$$.deleteScheduled=false;return clone}}function ClassHandle_delete(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError(\"Object already scheduled for deletion\")}detachFinalizer(this);releaseClassHandle(this.$$);if(!this.$$.preservePointerOnDelete){this.$$.smartPtr=undefined;this.$$.ptr=undefined}}function ClassHandle_isDeleted(){return!this.$$.ptr}function ClassHandle_deleteLater(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError(\"Object already scheduled for deletion\")}deletionQueue.push(this);if(deletionQueue.length===1&&delayFunction){delayFunction(flushPendingDeletes)}this.$$.deleteScheduled=true;return this}function init_ClassHandle(){ClassHandle.prototype[\"isAliasOf\"]=ClassHandle_isAliasOf;ClassHandle.prototype[\"clone\"]=ClassHandle_clone;ClassHandle.prototype[\"delete\"]=ClassHandle_delete;ClassHandle.prototype[\"isDeleted\"]=ClassHandle_isDeleted;ClassHandle.prototype[\"deleteLater\"]=ClassHandle_deleteLater}function ClassHandle(){}function ensureOverloadTable(proto,methodName,humanName){if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(){if(!proto[methodName].overloadTable.hasOwnProperty(arguments.length)){throwBindingError(\"Function '\"+humanName+\"' called with an invalid number of arguments (\"+arguments.length+\") - expects one of (\"+proto[methodName].overloadTable+\")!\")}return proto[methodName].overloadTable[arguments.length].apply(this,arguments)};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc}}function exposePublicSymbol(name,value,numArguments){if(Module.hasOwnProperty(name)){if(undefined===numArguments||undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments]){throwBindingError(\"Cannot register public name '\"+name+\"' twice\")}ensureOverloadTable(Module,name,name);if(Module.hasOwnProperty(numArguments)){throwBindingError(\"Cannot register multiple overloads of a function with the same number of arguments (\"+numArguments+\")!\")}Module[name].overloadTable[numArguments]=value}else{Module[name]=value;if(undefined!==numArguments){Module[name].numArguments=numArguments}}}function RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast){this.name=name;this.constructor=constructor;this.instancePrototype=instancePrototype;this.rawDestructor=rawDestructor;this.baseClass=baseClass;this.getActualType=getActualType;this.upcast=upcast;this.downcast=downcast;this.pureVirtualFunctions=[]}function upcastPointer(ptr,ptrClass,desiredClass){while(ptrClass!==desiredClass){if(!ptrClass.upcast){throwBindingError(\"Expected null or instance of \"+desiredClass.name+\", got an instance of \"+ptrClass.name)}ptr=ptrClass.upcast(ptr);ptrClass=ptrClass.baseClass}return ptr}function constNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError(\"null is not a valid \"+this.name)}return 0}if(!handle.$$){throwBindingError('Cannot pass \"'+_embind_repr(handle)+'\" as a '+this.name)}if(!handle.$$.ptr){throwBindingError(\"Cannot pass deleted object as a pointer of type \"+this.name)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function genericPointerToWireType(destructors,handle){var ptr;if(handle===null){if(this.isReference){throwBindingError(\"null is not a valid \"+this.name)}if(this.isSmartPointer){ptr=this.rawConstructor();if(destructors!==null){destructors.push(this.rawDestructor,ptr)}return ptr}else{return 0}}if(!handle.$$){throwBindingError('Cannot pass \"'+_embind_repr(handle)+'\" as a '+this.name)}if(!handle.$$.ptr){throwBindingError(\"Cannot pass deleted object as a pointer of type \"+this.name)}if(!this.isConst&&handle.$$.ptrType.isConst){throwBindingError(\"Cannot convert argument of type \"+(handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name)+\" to parameter type \"+this.name)}var handleClass=handle.$$.ptrType.registeredClass;ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);if(this.isSmartPointer){if(undefined===handle.$$.smartPtr){throwBindingError(\"Passing raw pointer to smart pointer is illegal\")}switch(this.sharingPolicy){case 0:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{throwBindingError(\"Cannot convert argument of type \"+(handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name)+\" to parameter type \"+this.name)}break;case 1:ptr=handle.$$.smartPtr;break;case 2:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{var clonedHandle=handle[\"clone\"]();ptr=this.rawShare(ptr,Emval.toHandle(function(){clonedHandle[\"delete\"]()}));if(destructors!==null){destructors.push(this.rawDestructor,ptr)}}break;default:throwBindingError(\"Unsupporting sharing policy\")}}return ptr}function nonConstNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError(\"null is not a valid \"+this.name)}return 0}if(!handle.$$){throwBindingError('Cannot pass \"'+_embind_repr(handle)+'\" as a '+this.name)}if(!handle.$$.ptr){throwBindingError(\"Cannot pass deleted object as a pointer of type \"+this.name)}if(handle.$$.ptrType.isConst){throwBindingError(\"Cannot convert argument of type \"+handle.$$.ptrType.name+\" to parameter type \"+this.name)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function simpleReadValueFromPointer(pointer){return this[\"fromWireType\"](HEAPU32[pointer>>2])}function RegisteredPointer_getPointee(ptr){if(this.rawGetPointee){ptr=this.rawGetPointee(ptr)}return ptr}function RegisteredPointer_destructor(ptr){if(this.rawDestructor){this.rawDestructor(ptr)}}function RegisteredPointer_deleteObject(handle){if(handle!==null){handle[\"delete\"]()}}function init_RegisteredPointer(){RegisteredPointer.prototype.getPointee=RegisteredPointer_getPointee;RegisteredPointer.prototype.destructor=RegisteredPointer_destructor;RegisteredPointer.prototype[\"argPackAdvance\"]=8;RegisteredPointer.prototype[\"readValueFromPointer\"]=simpleReadValueFromPointer;RegisteredPointer.prototype[\"deleteObject\"]=RegisteredPointer_deleteObject;RegisteredPointer.prototype[\"fromWireType\"]=RegisteredPointer_fromWireType}function RegisteredPointer(name,registeredClass,isReference,isConst,isSmartPointer,pointeeType,sharingPolicy,rawGetPointee,rawConstructor,rawShare,rawDestructor){this.name=name;this.registeredClass=registeredClass;this.isReference=isReference;this.isConst=isConst;this.isSmartPointer=isSmartPointer;this.pointeeType=pointeeType;this.sharingPolicy=sharingPolicy;this.rawGetPointee=rawGetPointee;this.rawConstructor=rawConstructor;this.rawShare=rawShare;this.rawDestructor=rawDestructor;if(!isSmartPointer&®isteredClass.baseClass===undefined){if(isConst){this[\"toWireType\"]=constNoSmartPtrRawPointerToWireType;this.destructorFunction=null}else{this[\"toWireType\"]=nonConstNoSmartPtrRawPointerToWireType;this.destructorFunction=null}}else{this[\"toWireType\"]=genericPointerToWireType}}function replacePublicSymbol(name,value,numArguments){if(!Module.hasOwnProperty(name)){throwInternalError(\"Replacing nonexistant public symbol\")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}}function dynCallLegacy(sig,ptr,args){assert(\"dynCall_\"+sig in Module,\"bad function pointer type - no table for sig '\"+sig+\"'\");if(args&&args.length){assert(args.length===sig.substring(1).replace(/j/g,\"--\").length)}else{assert(sig.length==1)}var f=Module[\"dynCall_\"+sig];return args&&args.length?f.apply(null,[ptr].concat(args)):f.call(null,ptr)}function dynCall(sig,ptr,args){if(sig.includes(\"j\")){return dynCallLegacy(sig,ptr,args)}assert(getWasmTableEntry(ptr),\"missing table entry in dynCall: \"+ptr);return getWasmTableEntry(ptr).apply(null,args)}function getDynCaller(sig,ptr){assert(sig.includes(\"j\"),\"getDynCaller should only be called with i64 sigs\");var argCache=[];return function(){argCache.length=0;Object.assign(argCache,arguments);return dynCall(sig,ptr,argCache)}}function embind__requireFunction(signature,rawFunction){signature=readLatin1String(signature);function makeDynCaller(){if(signature.includes(\"j\")){return getDynCaller(signature,rawFunction)}return getWasmTableEntry(rawFunction)}var fp=makeDynCaller();if(typeof fp!=\"function\"){throwBindingError(\"unknown function pointer with signature \"+signature+\": \"+rawFunction)}return fp}var UnboundTypeError=undefined;function getTypeName(type){var ptr=___getTypeName(type);var rv=readLatin1String(ptr);_free(ptr);return rv}function throwUnboundTypeError(message,types){var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return}if(registeredTypes[type]){return}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return}unboundTypes.push(type);seen[type]=true}types.forEach(visit);throw new UnboundTypeError(message+\": \"+unboundTypes.map(getTypeName).join([\", \"]))}function __embind_register_class(rawType,rawPointerType,rawConstPointerType,baseClassRawType,getActualTypeSignature,getActualType,upcastSignature,upcast,downcastSignature,downcast,name,destructorSignature,rawDestructor){name=readLatin1String(name);getActualType=embind__requireFunction(getActualTypeSignature,getActualType);if(upcast){upcast=embind__requireFunction(upcastSignature,upcast)}if(downcast){downcast=embind__requireFunction(downcastSignature,downcast)}rawDestructor=embind__requireFunction(destructorSignature,rawDestructor);var legalFunctionName=makeLegalFunctionName(name);exposePublicSymbol(legalFunctionName,function(){throwUnboundTypeError(\"Cannot construct \"+name+\" due to unbound types\",[baseClassRawType])});whenDependentTypesAreResolved([rawType,rawPointerType,rawConstPointerType],baseClassRawType?[baseClassRawType]:[],function(base){base=base[0];var baseClass;var basePrototype;if(baseClassRawType){baseClass=base.registeredClass;basePrototype=baseClass.instancePrototype}else{basePrototype=ClassHandle.prototype}var constructor=createNamedFunction(legalFunctionName,function(){if(Object.getPrototypeOf(this)!==instancePrototype){throw new BindingError(\"Use 'new' to construct \"+name)}if(undefined===registeredClass.constructor_body){throw new BindingError(name+\" has no accessible constructor\")}var body=registeredClass.constructor_body[arguments.length];if(undefined===body){throw new BindingError(\"Tried to invoke ctor of \"+name+\" with invalid number of parameters (\"+arguments.length+\") - expected (\"+Object.keys(registeredClass.constructor_body).toString()+\") parameters instead!\")}return body.apply(this,arguments)});var instancePrototype=Object.create(basePrototype,{constructor:{value:constructor}});constructor.prototype=instancePrototype;var registeredClass=new RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast);var referenceConverter=new RegisteredPointer(name,registeredClass,true,false,false);var pointerConverter=new RegisteredPointer(name+\"*\",registeredClass,false,false,false);var constPointerConverter=new RegisteredPointer(name+\" const*\",registeredClass,false,true,false);registeredPointers[rawType]={pointerType:pointerConverter,constPointerType:constPointerConverter};replacePublicSymbol(legalFunctionName,constructor);return[referenceConverter,pointerConverter,constPointerConverter]})}function heap32VectorToArray(count,firstElement){var array=[];for(var i=0;i>2)+i])}return array}function runDestructors(destructors){while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}}function __embind_register_class_constructor(rawClassType,argCount,rawArgTypesAddr,invokerSignature,invoker,rawConstructor){assert(argCount>0);var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);invoker=embind__requireFunction(invokerSignature,invoker);whenDependentTypesAreResolved([],[rawClassType],function(classType){classType=classType[0];var humanName=\"constructor \"+classType.name;if(undefined===classType.registeredClass.constructor_body){classType.registeredClass.constructor_body=[]}if(undefined!==classType.registeredClass.constructor_body[argCount-1]){throw new BindingError(\"Cannot register multiple constructors with identical number of parameters (\"+(argCount-1)+\") for class '\"+classType.name+\"'! Overload resolution is currently only performed using the parameter count, not actual type info!\")}classType.registeredClass.constructor_body[argCount-1]=(()=>{throwUnboundTypeError(\"Cannot construct \"+classType.name+\" due to unbound types\",rawArgTypes)});whenDependentTypesAreResolved([],rawArgTypes,function(argTypes){argTypes.splice(1,0,null);classType.registeredClass.constructor_body[argCount-1]=craftInvokerFunction(humanName,argTypes,null,invoker,rawConstructor);return[]});return[]})}function new_(constructor,argumentList){if(!(constructor instanceof Function)){throw new TypeError(\"new_ called with constructor type \"+typeof constructor+\" which is not a function\")}var dummy=createNamedFunction(constructor.name||\"unknownFunctionName\",function(){});dummy.prototype=constructor.prototype;var obj=new dummy;var r=constructor.apply(obj,argumentList);return r instanceof Object?r:obj}function craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc){var argCount=argTypes.length;if(argCount<2){throwBindingError(\"argTypes array size mismatch! Must at least get return value and 'this' types!\")}var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var needsDestructorStack=false;for(var i=1;i0?\", \":\"\")+argsListWired}invokerFnBody+=(returns?\"var rv = \":\"\")+\"invoker(fn\"+(argsListWired.length>0?\", \":\"\")+argsListWired+\");\\n\";if(needsDestructorStack){invokerFnBody+=\"runDestructors(destructors);\\n\"}else{for(var i=isClassMethodFunc?1:2;i{throwUnboundTypeError(\"Cannot access \"+humanName+\" due to unbound types\",[getterReturnType,setterArgumentType])})}else{desc.set=(v=>{throwBindingError(humanName+\" is a read-only property\")})}Object.defineProperty(classType.registeredClass.instancePrototype,fieldName,desc);whenDependentTypesAreResolved([],setter?[getterReturnType,setterArgumentType]:[getterReturnType],function(types){var getterReturnType=types[0];var desc={get:function(){var ptr=validateThis(this,classType,humanName+\" getter\");return getterReturnType[\"fromWireType\"](getter(getterContext,ptr))},enumerable:true};if(setter){setter=embind__requireFunction(setterSignature,setter);var setterArgumentType=types[1];desc.set=function(v){var ptr=validateThis(this,classType,humanName+\" setter\");var destructors=[];setter(setterContext,ptr,setterArgumentType[\"toWireType\"](destructors,v));runDestructors(destructors)}}Object.defineProperty(classType.registeredClass.instancePrototype,fieldName,desc);return[]});return[]})}var emval_free_list=[];var emval_handle_array=[{},{value:undefined},{value:null},{value:true},{value:false}];function __emval_decref(handle){if(handle>4&&0===--emval_handle_array[handle].refcount){emval_handle_array[handle]=undefined;emval_free_list.push(handle)}}function count_emval_handles(){var count=0;for(var i=5;i{if(!handle){throwBindingError(\"Cannot use deleted val. handle = \"+handle)}return emval_handle_array[handle].value},toHandle:value=>{switch(value){case undefined:return 1;case null:return 2;case true:return 3;case false:return 4;default:{var handle=emval_free_list.length?emval_free_list.pop():emval_handle_array.length;emval_handle_array[handle]={refcount:1,value:value};return handle}}}};function __embind_register_emval(rawType,name){name=readLatin1String(name);registerType(rawType,{name:name,\"fromWireType\":function(handle){var rv=Emval.toValue(handle);__emval_decref(handle);return rv},\"toWireType\":function(destructors,value){return Emval.toHandle(value)},\"argPackAdvance\":8,\"readValueFromPointer\":simpleReadValueFromPointer,destructorFunction:null})}function _embind_repr(v){if(v===null){return\"null\"}var t=typeof v;if(t===\"object\"||t===\"array\"||t===\"function\"){return v.toString()}else{return\"\"+v}}function floatReadValueFromPointer(name,shift){switch(shift){case 2:return function(pointer){return this[\"fromWireType\"](HEAPF32[pointer>>2])};case 3:return function(pointer){return this[\"fromWireType\"](HEAPF64[pointer>>3])};default:throw new TypeError(\"Unknown float type: \"+name)}}function __embind_register_float(rawType,name,size){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,\"fromWireType\":function(value){return value},\"toWireType\":function(destructors,value){if(typeof value!=\"number\"&&typeof value!=\"boolean\"){throw new TypeError('Cannot convert \"'+_embind_repr(value)+'\" to '+this.name)}return value},\"argPackAdvance\":8,\"readValueFromPointer\":floatReadValueFromPointer(name,shift),destructorFunction:null})}function integerReadValueFromPointer(name,shift,signed){switch(shift){case 0:return signed?function readS8FromPointer(pointer){return HEAP8[pointer]}:function readU8FromPointer(pointer){return HEAPU8[pointer]};case 1:return signed?function readS16FromPointer(pointer){return HEAP16[pointer>>1]}:function readU16FromPointer(pointer){return HEAPU16[pointer>>1]};case 2:return signed?function readS32FromPointer(pointer){return HEAP32[pointer>>2]}:function readU32FromPointer(pointer){return HEAPU32[pointer>>2]};default:throw new TypeError(\"Unknown integer type: \"+name)}}function __embind_register_integer(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295}var shift=getShiftFromSize(size);var fromWireType=value=>value;if(minRange===0){var bitshift=32-8*size;fromWireType=(value=>value<>>bitshift)}var isUnsignedType=name.includes(\"unsigned\");var checkAssertions=(value,toTypeName)=>{if(typeof value!=\"number\"&&typeof value!=\"boolean\"){throw new TypeError('Cannot convert \"'+_embind_repr(value)+'\" to '+toTypeName)}if(valuemaxRange){throw new TypeError('Passing a number \"'+_embind_repr(value)+'\" from JS side to C/C++ side to an argument of type \"'+name+'\", which is outside the valid range ['+minRange+\", \"+maxRange+\"]!\")}};var toWireType;if(isUnsignedType){toWireType=function(destructors,value){checkAssertions(value,this.name);return value>>>0}}else{toWireType=function(destructors,value){checkAssertions(value,this.name);return value}}registerType(primitiveType,{name:name,\"fromWireType\":fromWireType,\"toWireType\":toWireType,\"argPackAdvance\":8,\"readValueFromPointer\":integerReadValueFromPointer(name,shift,minRange!==0),destructorFunction:null})}function __embind_register_memory_view(rawType,dataTypeIndex,name){var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){handle=handle>>2;var heap=HEAPU32;var size=heap[handle];var data=heap[handle+1];return new TA(buffer,data,size)}name=readLatin1String(name);registerType(rawType,{name:name,\"fromWireType\":decodeMemoryView,\"argPackAdvance\":8,\"readValueFromPointer\":decodeMemoryView},{ignoreDuplicateRegistrations:true})}function __embind_register_std_string(rawType,name){name=readLatin1String(name);var stdStringIsUTF8=name===\"std::string\";registerType(rawType,{name:name,\"fromWireType\":function(value){var length=HEAPU32[value>>2];var str;if(stdStringIsUTF8){var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i;if(i==length||HEAPU8[currentBytePtr]==0){var maxRead=currentBytePtr-decodeStartPtr;var stringSegment=UTF8ToString(decodeStartPtr,maxRead);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+1}}}else{var a=new Array(length);for(var i=0;ilengthBytesUTF8(value))}else{getLength=(()=>value.length)}var length=getLength();var ptr=_malloc(4+length+1);HEAPU32[ptr>>2]=length;if(stdStringIsUTF8&&valueIsOfTypeString){stringToUTF8(value,ptr+4,length+1)}else{if(valueIsOfTypeString){for(var i=0;i255){_free(ptr);throwBindingError(\"String has UTF-16 code units that do not fit in 8 bits\")}HEAPU8[ptr+4+i]=charCode}}else{for(var i=0;iHEAPU16);shift=1}else if(charSize===4){decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32;getHeap=(()=>HEAPU32);shift=2}registerType(rawType,{name:name,\"fromWireType\":function(value){var length=HEAPU32[value>>2];var HEAP=getHeap();var str;var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i*charSize;if(i==length||HEAP[currentBytePtr>>shift]==0){var maxReadBytes=currentBytePtr-decodeStartPtr;var stringSegment=decodeString(decodeStartPtr,maxReadBytes);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+charSize}}_free(value);return str},\"toWireType\":function(destructors,value){if(!(typeof value==\"string\")){throwBindingError(\"Cannot pass non-string to C++ string type \"+name)}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length>>shift;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr)}return ptr},\"argPackAdvance\":8,\"readValueFromPointer\":simpleReadValueFromPointer,destructorFunction:function(ptr){_free(ptr)}})}function __embind_register_void(rawType,name){name=readLatin1String(name);registerType(rawType,{isVoid:true,name:name,\"argPackAdvance\":0,\"fromWireType\":function(){return undefined},\"toWireType\":function(destructors,o){return undefined}})}function __emscripten_date_now(){return Date.now()}function requireRegisteredType(rawType,humanName){var impl=registeredTypes[rawType];if(undefined===impl){throwBindingError(humanName+\" has unknown type \"+getTypeName(rawType))}return impl}function __emval_as(handle,returnType,destructorsRef){handle=Emval.toValue(handle);returnType=requireRegisteredType(returnType,\"emval::as\");var destructors=[];var rd=Emval.toHandle(destructors);HEAP32[destructorsRef>>2]=rd;return returnType[\"toWireType\"](destructors,handle)}var emval_symbols={};function getStringOrSymbol(address){var symbol=emval_symbols[address];if(symbol===undefined){return readLatin1String(address)}return symbol}var emval_methodCallers=[];function __emval_call_void_method(caller,handle,methodName,args){caller=emval_methodCallers[caller];handle=Emval.toValue(handle);methodName=getStringOrSymbol(methodName);caller(handle,methodName,null,args)}function __emval_addMethodCaller(caller){var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id}function __emval_lookupTypes(argCount,argTypes){var a=new Array(argCount);for(var i=0;i>2)+i],\"parameter \"+i)}return a}var emval_registeredMethods=[];function __emval_get_method_caller(argCount,argTypes){var types=__emval_lookupTypes(argCount,argTypes);var retType=types[0];var signatureName=retType.name+\"_$\"+types.slice(1).map(function(t){return t.name}).join(\"_\")+\"$\";var returnId=emval_registeredMethods[signatureName];if(returnId!==undefined){return returnId}var params=[\"retType\"];var args=[retType];var argsList=\"\";for(var i=0;i4){emval_handle_array[handle].refcount+=1}}function __emval_run_destructors(handle){var destructors=Emval.toValue(handle);runDestructors(destructors);__emval_decref(handle)}function __emval_take_value(type,argv){type=requireRegisteredType(type,\"_emval_take_value\");var v=type[\"readValueFromPointer\"](argv);return Emval.toHandle(v)}function __gmtime_js(time,tmPtr){var date=new Date(HEAP32[time>>2]*1e3);HEAP32[tmPtr>>2]=date.getUTCSeconds();HEAP32[tmPtr+4>>2]=date.getUTCMinutes();HEAP32[tmPtr+8>>2]=date.getUTCHours();HEAP32[tmPtr+12>>2]=date.getUTCDate();HEAP32[tmPtr+16>>2]=date.getUTCMonth();HEAP32[tmPtr+20>>2]=date.getUTCFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday}function __localtime_js(time,tmPtr){var date=new Date(HEAP32[time>>2]*1e3);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.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var start=new Date(date.getFullYear(),0,1);var yday=(date.getTime()-start.getTime())/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst}function __mktime_js(tmPtr){var 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);var dst=HEAP32[tmPtr+32>>2];var guessedOffset=date.getTimezoneOffset();var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dstOffset=Math.min(winterOffset,summerOffset);if(dst<0){HEAP32[tmPtr+32>>2]=Number(summerOffset!=winterOffset&&dstOffset==guessedOffset)}else if(dst>0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}HEAP32[tmPtr+24>>2]=date.getDay();var yday=(date.getTime()-start.getTime())/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday;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();return date.getTime()/1e3|0}function _tzset_impl(timezone,daylight,tzname){var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAP32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);function extractZone(date){var match=date.toTimeString().match(/\\(([A-Za-z ]+)\\)$/);return match?match[1]:\"GMT\"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocateUTF8(winterName);var summerNamePtr=allocateUTF8(summerName);if(summerOffset>2]=winterNamePtr;HEAP32[tzname+4>>2]=summerNamePtr}else{HEAP32[tzname>>2]=summerNamePtr;HEAP32[tzname+4>>2]=winterNamePtr}}function __tzset_js(timezone,daylight,tzname){if(__tzset_js.called)return;__tzset_js.called=true;_tzset_impl(timezone,daylight,tzname)}function _abort(){abort(\"native code called abort()\")}function reallyNegative(x){return x<0||x===0&&1/x===-Infinity}function convertI32PairToI53(lo,hi){assert(hi===(hi|0));return(lo>>>0)+hi*4294967296}function convertU32PairToI53(lo,hi){return(lo>>>0)+(hi>>>0)*4294967296}function reSign(value,bits){if(value<=0){return value}var half=bits<=32?Math.abs(1<=half&&(bits<=32||value>half)){value=-2*half+value}return value}function unSign(value,bits){if(value>=0){return value}return bits<=32?2*Math.abs(1<>3]);argIndex+=8}else if(type==\"i64\"){ret=[HEAP32[argIndex>>2],HEAP32[argIndex+4>>2]];argIndex+=8}else{assert((argIndex&3)===0);type=\"i32\";ret=HEAP32[argIndex>>2];argIndex+=4}return ret}var ret=[];var curr,next,currArg;while(1){var startTextIndex=textIndex;curr=HEAP8[textIndex>>0];if(curr===0)break;next=HEAP8[textIndex+1>>0];if(curr==37){var flagAlwaysSigned=false;var flagLeftAlign=false;var flagAlternative=false;var flagZeroPad=false;var flagPadSign=false;flagsLoop:while(1){switch(next){case 43:flagAlwaysSigned=true;break;case 45:flagLeftAlign=true;break;case 35:flagAlternative=true;break;case 48:if(flagZeroPad){break flagsLoop}else{flagZeroPad=true;break}case 32:flagPadSign=true;break;default:break flagsLoop}textIndex++;next=HEAP8[textIndex+1>>0]}var width=0;if(next==42){width=getNextArg(\"i32\");textIndex++;next=HEAP8[textIndex+1>>0]}else{while(next>=48&&next<=57){width=width*10+(next-48);textIndex++;next=HEAP8[textIndex+1>>0]}}var precisionSet=false,precision=-1;if(next==46){precision=0;precisionSet=true;textIndex++;next=HEAP8[textIndex+1>>0];if(next==42){precision=getNextArg(\"i32\");textIndex++}else{while(1){var precisionChr=HEAP8[textIndex+1>>0];if(precisionChr<48||precisionChr>57)break;precision=precision*10+(precisionChr-48);textIndex++}}next=HEAP8[textIndex+1>>0]}if(precision<0){precision=6;precisionSet=false}var argSize;switch(String.fromCharCode(next)){case\"h\":var nextNext=HEAP8[textIndex+2>>0];if(nextNext==104){textIndex++;argSize=1}else{argSize=2}break;case\"l\":var nextNext=HEAP8[textIndex+2>>0];if(nextNext==108){textIndex++;argSize=8}else{argSize=4}break;case\"L\":case\"q\":case\"j\":argSize=8;break;case\"z\":case\"t\":case\"I\":argSize=4;break;default:argSize=null}if(argSize)textIndex++;next=HEAP8[textIndex+1>>0];switch(String.fromCharCode(next)){case\"d\":case\"i\":case\"u\":case\"o\":case\"x\":case\"X\":case\"p\":{var signed=next==100||next==105;argSize=argSize||4;currArg=getNextArg(\"i\"+argSize*8);var argText;if(argSize==8){currArg=next==117?convertU32PairToI53(currArg[0],currArg[1]):convertI32PairToI53(currArg[0],currArg[1])}if(argSize<=4){var limit=Math.pow(256,argSize)-1;currArg=(signed?reSign:unSign)(currArg&limit,argSize*8)}var currAbsArg=Math.abs(currArg);var prefix=\"\";if(next==100||next==105){argText=reSign(currArg,8*argSize).toString(10)}else if(next==117){argText=unSign(currArg,8*argSize).toString(10);currArg=Math.abs(currArg)}else if(next==111){argText=(flagAlternative?\"0\":\"\")+currAbsArg.toString(8)}else if(next==120||next==88){prefix=flagAlternative&&currArg!=0?\"0x\":\"\";if(currArg<0){currArg=-currArg;argText=(currAbsArg-1).toString(16);var buffer=[];for(var i=0;i=0){if(flagAlwaysSigned){prefix=\"+\"+prefix}else if(flagPadSign){prefix=\" \"+prefix}}if(argText.charAt(0)==\"-\"){prefix=\"-\"+prefix;argText=argText.substr(1)}while(prefix.length+argText.lengthexponent&&exponent>=-4){next=(next==103?\"f\":\"F\").charCodeAt(0);precision-=exponent+1}else{next=(next==103?\"e\":\"E\").charCodeAt(0);precision--}effectivePrecision=Math.min(precision,20)}if(next==101||next==69){argText=currArg.toExponential(effectivePrecision);if(/[eE][-+]\\d$/.test(argText)){argText=argText.slice(0,-1)+\"0\"+argText.slice(-1)}}else if(next==102||next==70){argText=currArg.toFixed(effectivePrecision);if(currArg===0&&reallyNegative(currArg)){argText=\"-\"+argText}}var parts=argText.split(\"e\");if(isGeneral&&!flagAlternative){while(parts[0].length>1&&parts[0].includes(\".\")&&(parts[0].slice(-1)==\"0\"||parts[0].slice(-1)==\".\")){parts[0]=parts[0].slice(0,-1)}}else{if(flagAlternative&&argText.indexOf(\".\")==-1)parts[0]+=\".\";while(precision>effectivePrecision++)parts[0]+=\"0\"}argText=parts[0]+(parts.length>1?\"e\"+parts[1]:\"\");if(next==69)argText=argText.toUpperCase();if(currArg>=0){if(flagAlwaysSigned){argText=\"+\"+argText}else if(flagPadSign){argText=\" \"+argText}}}while(argText.length>0])}}else{ret=ret.concat(intArrayFromString(\"(null)\".substr(0,argLength),true))}if(flagLeftAlign){while(argLength0){ret.push(32)}if(!flagLeftAlign)ret.push(getNextArg(\"i8\"));break}case\"n\":{var ptr=getNextArg(\"i32*\");HEAP32[ptr>>2]=ret.length;break}case\"%\":{ret.push(curr);break}default:{for(var i=startTextIndex;i>0])}}}textIndex+=2}else{ret.push(curr);textIndex+=1}}return ret}function traverseStack(args){if(!args||!args.callee||!args.callee.name){return[null,\"\",\"\"]}var funstr=args.callee.toString();var funcname=args.callee.name;var str=\"(\";var first=true;for(var i in args){var a=args[i];if(!first){str+=\", \"}first=false;if(typeof a==\"number\"||typeof a==\"string\"){str+=a}else{str+=\"(\"+typeof a+\")\"}}str+=\")\";var caller=args.callee.caller;args=caller?caller.arguments:[];if(first)str=\"\";return[args,funcname,str]}function _emscripten_get_callstack_js(flags){var callstack=jsStackTrace();var iThisFunc=callstack.lastIndexOf(\"_emscripten_log\");var iThisFunc2=callstack.lastIndexOf(\"_emscripten_get_callstack\");var iNextLine=callstack.indexOf(\"\\n\",Math.max(iThisFunc,iThisFunc2))+1;callstack=callstack.slice(iNextLine);if(flags&32){warnOnce(\"EM_LOG_DEMANGLE is deprecated; ignoring\")}if(flags&8&&typeof emscripten_source_map==\"undefined\"){warnOnce('Source map information is not available, emscripten_log with EM_LOG_C_STACK will be ignored. Build with \"--pre-js $EMSCRIPTEN/src/emscripten-source-map.min.js\" linker flag to add source map loading to code.');flags^=8;flags|=16}var stack_args=null;if(flags&128){stack_args=traverseStack(arguments);while(stack_args[1].includes(\"_emscripten_\"))stack_args=traverseStack(stack_args[0])}var lines=callstack.split(\"\\n\");callstack=\"\";var newFirefoxRe=new RegExp(\"\\\\s*(.*?)@(.*?):([0-9]+):([0-9]+)\");var firefoxRe=new RegExp(\"\\\\s*(.*?)@(.*):(.*)(:(.*))?\");var chromeRe=new RegExp(\"\\\\s*at (.*?) \\\\((.*):(.*):(.*)\\\\)\");for(var l in lines){var line=lines[l];var symbolName=\"\";var file=\"\";var lineno=0;var column=0;var parts=chromeRe.exec(line);if(parts&&parts.length==5){symbolName=parts[1];file=parts[2];lineno=parts[3];column=parts[4]}else{parts=newFirefoxRe.exec(line);if(!parts)parts=firefoxRe.exec(line);if(parts&&parts.length>=4){symbolName=parts[1];file=parts[2];lineno=parts[3];column=parts[4]|0}else{callstack+=line+\"\\n\";continue}}var haveSourceMap=false;if(flags&8){var orig=emscripten_source_map.originalPositionFor({line:lineno,column:column});haveSourceMap=orig&&orig.source;if(haveSourceMap){if(flags&64){orig.source=orig.source.substring(orig.source.replace(/\\\\/g,\"/\").lastIndexOf(\"/\")+1)}callstack+=\" at \"+symbolName+\" (\"+orig.source+\":\"+orig.line+\":\"+orig.column+\")\\n\"}}if(flags&16||!haveSourceMap){if(flags&64){file=file.substring(file.replace(/\\\\/g,\"/\").lastIndexOf(\"/\")+1)}callstack+=(haveSourceMap?\" = \"+symbolName:\" at \"+symbolName)+\" (\"+file+\":\"+lineno+\":\"+column+\")\\n\"}if(flags&128&&stack_args[0]){if(stack_args[1]==symbolName&&stack_args[2].length>0){callstack=callstack.replace(/\\s+$/,\"\");callstack+=\" with values: \"+stack_args[1]+stack_args[2]+\"\\n\"}stack_args=traverseStack(stack_args[0])}}callstack=callstack.replace(/\\s+$/,\"\");return callstack}function _emscripten_log_js(flags,str){if(flags&24){str=str.replace(/\\s+$/,\"\");str+=(str.length>0?\"\\n\":\"\")+_emscripten_get_callstack_js(flags)}if(flags&1){if(flags&4){console.error(str)}else if(flags&2){console.warn(str)}else if(flags&512){console.info(str)}else if(flags&256){console.debug(str)}else{console.log(str)}}else if(flags&6){err(str)}else{out(str)}}function _emscripten_log(flags,format,varargs){var result=formatString(format,varargs);var str=UTF8ArrayToString(result,0);_emscripten_log_js(flags,str)}function _emscripten_get_heap_max(){return 2147483648}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){err(\"emscripten_realloc_buffer: Attempted to grow heap from \"+buffer.byteLength+\" bytes to \"+size+\" bytes, but got error: \"+e)}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;assert(requestedSize>oldSize);var maxHeapSize=_emscripten_get_heap_max();if(requestedSize>maxHeapSize){err(\"Cannot enlarge memory, asked to go up to \"+requestedSize+\" bytes, but the limit is \"+maxHeapSize+\" bytes!\");return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}err(\"Failed to grow the heap from \"+oldSize+\" bytes to \"+newSize+\" bytes, not enough memory!\");return false}var ENV={};function getExecutableName(){return thisProgram||\"./this.program\"}function getEnvStrings(){if(!getEnvStrings.strings){var lang=(typeof navigator==\"object\"&&navigator.languages&&navigator.languages[0]||\"C\").replace(\"-\",\"_\")+\".UTF-8\";var env={\"USER\":\"web_user\",\"LOGNAME\":\"web_user\",\"PATH\":\"/\",\"PWD\":\"/\",\"HOME\":\"/home/web_user\",\"LANG\":lang,\"_\":getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(x+\"=\"+env[x])}getEnvStrings.strings=strings}return getEnvStrings.strings}function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAP32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAP32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAP32[penviron_buf_size>>2]=bufSize;return 0}function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS==\"undefined\"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function _fd_fdstat_get(fd,pbuf){try{var stream=SYSCALLS.getStreamFromFD(fd);var type=stream.tty?2:FS.isDir(stream.mode)?3:FS.isLink(stream.mode)?7:4;HEAP8[pbuf>>0]=type;return 0}catch(e){if(typeof FS==\"undefined\"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function _fd_read(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=SYSCALLS.doReadv(stream,iov,iovcnt);HEAP32[pnum>>2]=num;return 0}catch(e){if(typeof FS==\"undefined\"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var stream=SYSCALLS.getStreamFromFD(fd);var HIGH_OFFSET=4294967296;var offset=offset_high*HIGH_OFFSET+(offset_low>>>0);var DOUBLE_LIMIT=9007199254740992;if(offset<=-DOUBLE_LIMIT||offset>=DOUBLE_LIMIT){return-61}FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[newOffset>>2]=tempI64[0],HEAP32[newOffset+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS==\"undefined\"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=SYSCALLS.doWritev(stream,iov,iovcnt);HEAP32[pnum>>2]=num;return 0}catch(e){if(typeof FS==\"undefined\"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function _setTempRet0(val){setTempRet0(val)}var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;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 readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();ERRNO_CODES={\"EPERM\":63,\"ENOENT\":44,\"ESRCH\":71,\"EINTR\":27,\"EIO\":29,\"ENXIO\":60,\"E2BIG\":1,\"ENOEXEC\":45,\"EBADF\":8,\"ECHILD\":12,\"EAGAIN\":6,\"EWOULDBLOCK\":6,\"ENOMEM\":48,\"EACCES\":2,\"EFAULT\":21,\"ENOTBLK\":105,\"EBUSY\":10,\"EEXIST\":20,\"EXDEV\":75,\"ENODEV\":43,\"ENOTDIR\":54,\"EISDIR\":31,\"EINVAL\":28,\"ENFILE\":41,\"EMFILE\":33,\"ENOTTY\":59,\"ETXTBSY\":74,\"EFBIG\":22,\"ENOSPC\":51,\"ESPIPE\":70,\"EROFS\":69,\"EMLINK\":34,\"EPIPE\":64,\"EDOM\":18,\"ERANGE\":68,\"ENOMSG\":49,\"EIDRM\":24,\"ECHRNG\":106,\"EL2NSYNC\":156,\"EL3HLT\":107,\"EL3RST\":108,\"ELNRNG\":109,\"EUNATCH\":110,\"ENOCSI\":111,\"EL2HLT\":112,\"EDEADLK\":16,\"ENOLCK\":46,\"EBADE\":113,\"EBADR\":114,\"EXFULL\":115,\"ENOANO\":104,\"EBADRQC\":103,\"EBADSLT\":102,\"EDEADLOCK\":16,\"EBFONT\":101,\"ENOSTR\":100,\"ENODATA\":116,\"ETIME\":117,\"ENOSR\":118,\"ENONET\":119,\"ENOPKG\":120,\"EREMOTE\":121,\"ENOLINK\":47,\"EADV\":122,\"ESRMNT\":123,\"ECOMM\":124,\"EPROTO\":65,\"EMULTIHOP\":36,\"EDOTDOT\":125,\"EBADMSG\":9,\"ENOTUNIQ\":126,\"EBADFD\":127,\"EREMCHG\":128,\"ELIBACC\":129,\"ELIBBAD\":130,\"ELIBSCN\":131,\"ELIBMAX\":132,\"ELIBEXEC\":133,\"ENOSYS\":52,\"ENOTEMPTY\":55,\"ENAMETOOLONG\":37,\"ELOOP\":32,\"EOPNOTSUPP\":138,\"EPFNOSUPPORT\":139,\"ECONNRESET\":15,\"ENOBUFS\":42,\"EAFNOSUPPORT\":5,\"EPROTOTYPE\":67,\"ENOTSOCK\":57,\"ENOPROTOOPT\":50,\"ESHUTDOWN\":140,\"ECONNREFUSED\":14,\"EADDRINUSE\":3,\"ECONNABORTED\":13,\"ENETUNREACH\":40,\"ENETDOWN\":38,\"ETIMEDOUT\":73,\"EHOSTDOWN\":142,\"EHOSTUNREACH\":23,\"EINPROGRESS\":26,\"EALREADY\":7,\"EDESTADDRREQ\":17,\"EMSGSIZE\":35,\"EPROTONOSUPPORT\":66,\"ESOCKTNOSUPPORT\":137,\"EADDRNOTAVAIL\":4,\"ENETRESET\":39,\"EISCONN\":30,\"ENOTCONN\":53,\"ETOOMANYREFS\":141,\"EUSERS\":136,\"EDQUOT\":19,\"ESTALE\":72,\"ENOTSUP\":138,\"ENOMEDIUM\":148,\"EILSEQ\":25,\"EOVERFLOW\":61,\"ECANCELED\":11,\"ENOTRECOVERABLE\":56,\"EOWNERDEAD\":62,\"ESTRPIPE\":135};embind_init_charCodes();BindingError=Module[\"BindingError\"]=extendError(Error,\"BindingError\");InternalError=Module[\"InternalError\"]=extendError(Error,\"InternalError\");init_ClassHandle();init_embind();init_RegisteredPointer();UnboundTypeError=Module[\"UnboundTypeError\"]=extendError(Error,\"UnboundTypeError\");init_emval();var ASSERTIONS=true;function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}function checkIncomingModuleAPI(){ignoredModuleProp(\"fetchSettings\")}var asmLibraryArg={\"__syscall_fcntl64\":___syscall_fcntl64,\"__syscall_openat\":___syscall_openat,\"_embind_register_bigint\":__embind_register_bigint,\"_embind_register_bool\":__embind_register_bool,\"_embind_register_class\":__embind_register_class,\"_embind_register_class_constructor\":__embind_register_class_constructor,\"_embind_register_class_function\":__embind_register_class_function,\"_embind_register_class_property\":__embind_register_class_property,\"_embind_register_emval\":__embind_register_emval,\"_embind_register_float\":__embind_register_float,\"_embind_register_integer\":__embind_register_integer,\"_embind_register_memory_view\":__embind_register_memory_view,\"_embind_register_std_string\":__embind_register_std_string,\"_embind_register_std_wstring\":__embind_register_std_wstring,\"_embind_register_void\":__embind_register_void,\"_emscripten_date_now\":__emscripten_date_now,\"_emval_as\":__emval_as,\"_emval_call_void_method\":__emval_call_void_method,\"_emval_decref\":__emval_decref,\"_emval_get_method_caller\":__emval_get_method_caller,\"_emval_incref\":__emval_incref,\"_emval_run_destructors\":__emval_run_destructors,\"_emval_take_value\":__emval_take_value,\"_gmtime_js\":__gmtime_js,\"_localtime_js\":__localtime_js,\"_mktime_js\":__mktime_js,\"_tzset_js\":__tzset_js,\"abort\":_abort,\"emscripten_log\":_emscripten_log,\"emscripten_resize_heap\":_emscripten_resize_heap,\"environ_get\":_environ_get,\"environ_sizes_get\":_environ_sizes_get,\"fd_close\":_fd_close,\"fd_fdstat_get\":_fd_fdstat_get,\"fd_read\":_fd_read,\"fd_seek\":_fd_seek,\"fd_write\":_fd_write,\"setTempRet0\":_setTempRet0};var asm=createWasm();var ___wasm_call_ctors=Module[\"___wasm_call_ctors\"]=createExportWrapper(\"__wasm_call_ctors\");var _free=Module[\"_free\"]=createExportWrapper(\"free\");var _malloc=Module[\"_malloc\"]=createExportWrapper(\"malloc\");var _strlen=Module[\"_strlen\"]=createExportWrapper(\"strlen\");var ___errno_location=Module[\"___errno_location\"]=createExportWrapper(\"__errno_location\");var ___getTypeName=Module[\"___getTypeName\"]=createExportWrapper(\"__getTypeName\");var ___embind_register_native_and_builtin_types=Module[\"___embind_register_native_and_builtin_types\"]=createExportWrapper(\"__embind_register_native_and_builtin_types\");var ___stdio_exit=Module[\"___stdio_exit\"]=createExportWrapper(\"__stdio_exit\");var _emscripten_builtin_memalign=Module[\"_emscripten_builtin_memalign\"]=createExportWrapper(\"emscripten_builtin_memalign\");var _emscripten_stack_init=Module[\"_emscripten_stack_init\"]=function(){return(_emscripten_stack_init=Module[\"_emscripten_stack_init\"]=Module[\"asm\"][\"emscripten_stack_init\"]).apply(null,arguments)};var _emscripten_stack_get_free=Module[\"_emscripten_stack_get_free\"]=function(){return(_emscripten_stack_get_free=Module[\"_emscripten_stack_get_free\"]=Module[\"asm\"][\"emscripten_stack_get_free\"]).apply(null,arguments)};var _emscripten_stack_get_base=Module[\"_emscripten_stack_get_base\"]=function(){return(_emscripten_stack_get_base=Module[\"_emscripten_stack_get_base\"]=Module[\"asm\"][\"emscripten_stack_get_base\"]).apply(null,arguments)};var _emscripten_stack_get_end=Module[\"_emscripten_stack_get_end\"]=function(){return(_emscripten_stack_get_end=Module[\"_emscripten_stack_get_end\"]=Module[\"asm\"][\"emscripten_stack_get_end\"]).apply(null,arguments)};var stackSave=Module[\"stackSave\"]=createExportWrapper(\"stackSave\");var stackRestore=Module[\"stackRestore\"]=createExportWrapper(\"stackRestore\");var stackAlloc=Module[\"stackAlloc\"]=createExportWrapper(\"stackAlloc\");var dynCall_ijiii=Module[\"dynCall_ijiii\"]=createExportWrapper(\"dynCall_ijiii\");var dynCall_viiijj=Module[\"dynCall_viiijj\"]=createExportWrapper(\"dynCall_viiijj\");var dynCall_jij=Module[\"dynCall_jij\"]=createExportWrapper(\"dynCall_jij\");var dynCall_jii=Module[\"dynCall_jii\"]=createExportWrapper(\"dynCall_jii\");var dynCall_jiji=Module[\"dynCall_jiji\"]=createExportWrapper(\"dynCall_jiji\");var _ff_h264_cabac_tables=Module[\"_ff_h264_cabac_tables\"]=112940;unexportedRuntimeFunction(\"intArrayFromString\",false);unexportedRuntimeFunction(\"intArrayToString\",false);unexportedRuntimeFunction(\"ccall\",false);unexportedRuntimeFunction(\"cwrap\",false);unexportedRuntimeFunction(\"setValue\",false);unexportedRuntimeFunction(\"getValue\",false);unexportedRuntimeFunction(\"allocate\",false);unexportedRuntimeFunction(\"UTF8ArrayToString\",false);unexportedRuntimeFunction(\"UTF8ToString\",false);unexportedRuntimeFunction(\"stringToUTF8Array\",false);unexportedRuntimeFunction(\"stringToUTF8\",false);unexportedRuntimeFunction(\"lengthBytesUTF8\",false);unexportedRuntimeFunction(\"stackTrace\",false);unexportedRuntimeFunction(\"addOnPreRun\",false);unexportedRuntimeFunction(\"addOnInit\",false);unexportedRuntimeFunction(\"addOnPreMain\",false);unexportedRuntimeFunction(\"addOnExit\",false);unexportedRuntimeFunction(\"addOnPostRun\",false);unexportedRuntimeFunction(\"writeStringToMemory\",false);unexportedRuntimeFunction(\"writeArrayToMemory\",false);unexportedRuntimeFunction(\"writeAsciiToMemory\",false);unexportedRuntimeFunction(\"addRunDependency\",true);unexportedRuntimeFunction(\"removeRunDependency\",true);unexportedRuntimeFunction(\"FS_createFolder\",false);unexportedRuntimeFunction(\"FS_createPath\",true);unexportedRuntimeFunction(\"FS_createDataFile\",true);unexportedRuntimeFunction(\"FS_createPreloadedFile\",true);unexportedRuntimeFunction(\"FS_createLazyFile\",true);unexportedRuntimeFunction(\"FS_createLink\",false);unexportedRuntimeFunction(\"FS_createDevice\",true);unexportedRuntimeFunction(\"FS_unlink\",true);unexportedRuntimeFunction(\"getLEB\",false);unexportedRuntimeFunction(\"getFunctionTables\",false);unexportedRuntimeFunction(\"alignFunctionTables\",false);unexportedRuntimeFunction(\"registerFunctions\",false);unexportedRuntimeFunction(\"addFunction\",false);unexportedRuntimeFunction(\"removeFunction\",false);unexportedRuntimeFunction(\"prettyPrint\",false);unexportedRuntimeFunction(\"dynCall\",false);unexportedRuntimeFunction(\"getCompilerSetting\",false);unexportedRuntimeFunction(\"print\",false);unexportedRuntimeFunction(\"printErr\",false);unexportedRuntimeFunction(\"getTempRet0\",false);unexportedRuntimeFunction(\"setTempRet0\",false);unexportedRuntimeFunction(\"callMain\",false);unexportedRuntimeFunction(\"abort\",false);unexportedRuntimeFunction(\"keepRuntimeAlive\",false);unexportedRuntimeFunction(\"ptrToString\",false);unexportedRuntimeFunction(\"zeroMemory\",false);unexportedRuntimeFunction(\"stringToNewUTF8\",false);unexportedRuntimeFunction(\"emscripten_realloc_buffer\",false);unexportedRuntimeFunction(\"ENV\",false);unexportedRuntimeFunction(\"ERRNO_CODES\",false);unexportedRuntimeFunction(\"ERRNO_MESSAGES\",false);unexportedRuntimeFunction(\"setErrNo\",false);unexportedRuntimeFunction(\"inetPton4\",false);unexportedRuntimeFunction(\"inetNtop4\",false);unexportedRuntimeFunction(\"inetPton6\",false);unexportedRuntimeFunction(\"inetNtop6\",false);unexportedRuntimeFunction(\"readSockaddr\",false);unexportedRuntimeFunction(\"writeSockaddr\",false);unexportedRuntimeFunction(\"DNS\",false);unexportedRuntimeFunction(\"getHostByName\",false);unexportedRuntimeFunction(\"Protocols\",false);unexportedRuntimeFunction(\"Sockets\",false);unexportedRuntimeFunction(\"getRandomDevice\",false);unexportedRuntimeFunction(\"traverseStack\",false);unexportedRuntimeFunction(\"UNWIND_CACHE\",false);unexportedRuntimeFunction(\"convertPCtoSourceLocation\",false);unexportedRuntimeFunction(\"readAsmConstArgsArray\",false);unexportedRuntimeFunction(\"readAsmConstArgs\",false);unexportedRuntimeFunction(\"mainThreadEM_ASM\",false);unexportedRuntimeFunction(\"jstoi_q\",false);unexportedRuntimeFunction(\"jstoi_s\",false);unexportedRuntimeFunction(\"getExecutableName\",false);unexportedRuntimeFunction(\"listenOnce\",false);unexportedRuntimeFunction(\"autoResumeAudioContext\",false);unexportedRuntimeFunction(\"dynCallLegacy\",false);unexportedRuntimeFunction(\"getDynCaller\",false);unexportedRuntimeFunction(\"dynCall\",false);unexportedRuntimeFunction(\"setWasmTableEntry\",false);unexportedRuntimeFunction(\"getWasmTableEntry\",false);unexportedRuntimeFunction(\"handleException\",false);unexportedRuntimeFunction(\"runtimeKeepalivePush\",false);unexportedRuntimeFunction(\"runtimeKeepalivePop\",false);unexportedRuntimeFunction(\"callUserCallback\",false);unexportedRuntimeFunction(\"maybeExit\",false);unexportedRuntimeFunction(\"safeSetTimeout\",false);unexportedRuntimeFunction(\"asmjsMangle\",false);unexportedRuntimeFunction(\"asyncLoad\",false);unexportedRuntimeFunction(\"alignMemory\",false);unexportedRuntimeFunction(\"mmapAlloc\",false);unexportedRuntimeFunction(\"reallyNegative\",false);unexportedRuntimeFunction(\"unSign\",false);unexportedRuntimeFunction(\"reSign\",false);unexportedRuntimeFunction(\"formatString\",false);unexportedRuntimeFunction(\"PATH\",false);unexportedRuntimeFunction(\"PATH_FS\",false);unexportedRuntimeFunction(\"SYSCALLS\",false);unexportedRuntimeFunction(\"getSocketFromFD\",false);unexportedRuntimeFunction(\"getSocketAddress\",false);unexportedRuntimeFunction(\"JSEvents\",false);unexportedRuntimeFunction(\"registerKeyEventCallback\",false);unexportedRuntimeFunction(\"specialHTMLTargets\",false);unexportedRuntimeFunction(\"maybeCStringToJsString\",false);unexportedRuntimeFunction(\"findEventTarget\",false);unexportedRuntimeFunction(\"findCanvasEventTarget\",false);unexportedRuntimeFunction(\"getBoundingClientRect\",false);unexportedRuntimeFunction(\"fillMouseEventData\",false);unexportedRuntimeFunction(\"registerMouseEventCallback\",false);unexportedRuntimeFunction(\"registerWheelEventCallback\",false);unexportedRuntimeFunction(\"registerUiEventCallback\",false);unexportedRuntimeFunction(\"registerFocusEventCallback\",false);unexportedRuntimeFunction(\"fillDeviceOrientationEventData\",false);unexportedRuntimeFunction(\"registerDeviceOrientationEventCallback\",false);unexportedRuntimeFunction(\"fillDeviceMotionEventData\",false);unexportedRuntimeFunction(\"registerDeviceMotionEventCallback\",false);unexportedRuntimeFunction(\"screenOrientation\",false);unexportedRuntimeFunction(\"fillOrientationChangeEventData\",false);unexportedRuntimeFunction(\"registerOrientationChangeEventCallback\",false);unexportedRuntimeFunction(\"fillFullscreenChangeEventData\",false);unexportedRuntimeFunction(\"registerFullscreenChangeEventCallback\",false);unexportedRuntimeFunction(\"registerRestoreOldStyle\",false);unexportedRuntimeFunction(\"hideEverythingExceptGivenElement\",false);unexportedRuntimeFunction(\"restoreHiddenElements\",false);unexportedRuntimeFunction(\"setLetterbox\",false);unexportedRuntimeFunction(\"currentFullscreenStrategy\",false);unexportedRuntimeFunction(\"restoreOldWindowedStyle\",false);unexportedRuntimeFunction(\"softFullscreenResizeWebGLRenderTarget\",false);unexportedRuntimeFunction(\"doRequestFullscreen\",false);unexportedRuntimeFunction(\"fillPointerlockChangeEventData\",false);unexportedRuntimeFunction(\"registerPointerlockChangeEventCallback\",false);unexportedRuntimeFunction(\"registerPointerlockErrorEventCallback\",false);unexportedRuntimeFunction(\"requestPointerLock\",false);unexportedRuntimeFunction(\"fillVisibilityChangeEventData\",false);unexportedRuntimeFunction(\"registerVisibilityChangeEventCallback\",false);unexportedRuntimeFunction(\"registerTouchEventCallback\",false);unexportedRuntimeFunction(\"fillGamepadEventData\",false);unexportedRuntimeFunction(\"registerGamepadEventCallback\",false);unexportedRuntimeFunction(\"registerBeforeUnloadEventCallback\",false);unexportedRuntimeFunction(\"fillBatteryEventData\",false);unexportedRuntimeFunction(\"battery\",false);unexportedRuntimeFunction(\"registerBatteryEventCallback\",false);unexportedRuntimeFunction(\"setCanvasElementSize\",false);unexportedRuntimeFunction(\"getCanvasElementSize\",false);unexportedRuntimeFunction(\"demangle\",false);unexportedRuntimeFunction(\"demangleAll\",false);unexportedRuntimeFunction(\"jsStackTrace\",false);unexportedRuntimeFunction(\"stackTrace\",false);unexportedRuntimeFunction(\"getEnvStrings\",false);unexportedRuntimeFunction(\"checkWasiClock\",false);unexportedRuntimeFunction(\"writeI53ToI64\",false);unexportedRuntimeFunction(\"writeI53ToI64Clamped\",false);unexportedRuntimeFunction(\"writeI53ToI64Signaling\",false);unexportedRuntimeFunction(\"writeI53ToU64Clamped\",false);unexportedRuntimeFunction(\"writeI53ToU64Signaling\",false);unexportedRuntimeFunction(\"readI53FromI64\",false);unexportedRuntimeFunction(\"readI53FromU64\",false);unexportedRuntimeFunction(\"convertI32PairToI53\",false);unexportedRuntimeFunction(\"convertU32PairToI53\",false);unexportedRuntimeFunction(\"dlopenMissingError\",false);unexportedRuntimeFunction(\"setImmediateWrapped\",false);unexportedRuntimeFunction(\"clearImmediateWrapped\",false);unexportedRuntimeFunction(\"polyfillSetImmediate\",false);unexportedRuntimeFunction(\"uncaughtExceptionCount\",false);unexportedRuntimeFunction(\"exceptionLast\",false);unexportedRuntimeFunction(\"exceptionCaught\",false);unexportedRuntimeFunction(\"ExceptionInfo\",false);unexportedRuntimeFunction(\"exception_addRef\",false);unexportedRuntimeFunction(\"exception_decRef\",false);unexportedRuntimeFunction(\"Browser\",false);unexportedRuntimeFunction(\"setMainLoop\",false);unexportedRuntimeFunction(\"wget\",false);unexportedRuntimeFunction(\"FS\",false);unexportedRuntimeFunction(\"MEMFS\",false);unexportedRuntimeFunction(\"TTY\",false);unexportedRuntimeFunction(\"PIPEFS\",false);unexportedRuntimeFunction(\"SOCKFS\",false);unexportedRuntimeFunction(\"_setNetworkCallback\",false);unexportedRuntimeFunction(\"tempFixedLengthArray\",false);unexportedRuntimeFunction(\"miniTempWebGLFloatBuffers\",false);unexportedRuntimeFunction(\"heapObjectForWebGLType\",false);unexportedRuntimeFunction(\"heapAccessShiftForWebGLHeap\",false);unexportedRuntimeFunction(\"GL\",false);unexportedRuntimeFunction(\"emscriptenWebGLGet\",false);unexportedRuntimeFunction(\"computeUnpackAlignedImageSize\",false);unexportedRuntimeFunction(\"emscriptenWebGLGetTexPixelData\",false);unexportedRuntimeFunction(\"emscriptenWebGLGetUniform\",false);unexportedRuntimeFunction(\"webglGetUniformLocation\",false);unexportedRuntimeFunction(\"webglPrepareUniformLocationsBeforeFirstUse\",false);unexportedRuntimeFunction(\"webglGetLeftBracePos\",false);unexportedRuntimeFunction(\"emscriptenWebGLGetVertexAttrib\",false);unexportedRuntimeFunction(\"writeGLArray\",false);unexportedRuntimeFunction(\"AL\",false);unexportedRuntimeFunction(\"SDL_unicode\",false);unexportedRuntimeFunction(\"SDL_ttfContext\",false);unexportedRuntimeFunction(\"SDL_audio\",false);unexportedRuntimeFunction(\"SDL\",false);unexportedRuntimeFunction(\"SDL_gfx\",false);unexportedRuntimeFunction(\"GLUT\",false);unexportedRuntimeFunction(\"EGL\",false);unexportedRuntimeFunction(\"GLFW_Window\",false);unexportedRuntimeFunction(\"GLFW\",false);unexportedRuntimeFunction(\"GLEW\",false);unexportedRuntimeFunction(\"IDBStore\",false);unexportedRuntimeFunction(\"runAndAbortIfError\",false);unexportedRuntimeFunction(\"InternalError\",false);unexportedRuntimeFunction(\"BindingError\",false);unexportedRuntimeFunction(\"UnboundTypeError\",false);unexportedRuntimeFunction(\"PureVirtualError\",false);unexportedRuntimeFunction(\"init_embind\",false);unexportedRuntimeFunction(\"throwInternalError\",false);unexportedRuntimeFunction(\"throwBindingError\",false);unexportedRuntimeFunction(\"throwUnboundTypeError\",false);unexportedRuntimeFunction(\"ensureOverloadTable\",false);unexportedRuntimeFunction(\"exposePublicSymbol\",false);unexportedRuntimeFunction(\"replacePublicSymbol\",false);unexportedRuntimeFunction(\"extendError\",false);unexportedRuntimeFunction(\"createNamedFunction\",false);unexportedRuntimeFunction(\"registeredInstances\",false);unexportedRuntimeFunction(\"getBasestPointer\",false);unexportedRuntimeFunction(\"registerInheritedInstance\",false);unexportedRuntimeFunction(\"unregisterInheritedInstance\",false);unexportedRuntimeFunction(\"getInheritedInstance\",false);unexportedRuntimeFunction(\"getInheritedInstanceCount\",false);unexportedRuntimeFunction(\"getLiveInheritedInstances\",false);unexportedRuntimeFunction(\"registeredTypes\",false);unexportedRuntimeFunction(\"awaitingDependencies\",false);unexportedRuntimeFunction(\"typeDependencies\",false);unexportedRuntimeFunction(\"registeredPointers\",false);unexportedRuntimeFunction(\"registerType\",false);unexportedRuntimeFunction(\"whenDependentTypesAreResolved\",false);unexportedRuntimeFunction(\"embind_charCodes\",false);unexportedRuntimeFunction(\"embind_init_charCodes\",false);unexportedRuntimeFunction(\"readLatin1String\",false);unexportedRuntimeFunction(\"getTypeName\",false);unexportedRuntimeFunction(\"heap32VectorToArray\",false);unexportedRuntimeFunction(\"requireRegisteredType\",false);unexportedRuntimeFunction(\"getShiftFromSize\",false);unexportedRuntimeFunction(\"integerReadValueFromPointer\",false);unexportedRuntimeFunction(\"enumReadValueFromPointer\",false);unexportedRuntimeFunction(\"floatReadValueFromPointer\",false);unexportedRuntimeFunction(\"simpleReadValueFromPointer\",false);unexportedRuntimeFunction(\"runDestructors\",false);unexportedRuntimeFunction(\"new_\",false);unexportedRuntimeFunction(\"craftInvokerFunction\",false);unexportedRuntimeFunction(\"embind__requireFunction\",false);unexportedRuntimeFunction(\"tupleRegistrations\",false);unexportedRuntimeFunction(\"structRegistrations\",false);unexportedRuntimeFunction(\"genericPointerToWireType\",false);unexportedRuntimeFunction(\"constNoSmartPtrRawPointerToWireType\",false);unexportedRuntimeFunction(\"nonConstNoSmartPtrRawPointerToWireType\",false);unexportedRuntimeFunction(\"init_RegisteredPointer\",false);unexportedRuntimeFunction(\"RegisteredPointer\",false);unexportedRuntimeFunction(\"RegisteredPointer_getPointee\",false);unexportedRuntimeFunction(\"RegisteredPointer_destructor\",false);unexportedRuntimeFunction(\"RegisteredPointer_deleteObject\",false);unexportedRuntimeFunction(\"RegisteredPointer_fromWireType\",false);unexportedRuntimeFunction(\"runDestructor\",false);unexportedRuntimeFunction(\"releaseClassHandle\",false);unexportedRuntimeFunction(\"finalizationRegistry\",false);unexportedRuntimeFunction(\"detachFinalizer_deps\",false);unexportedRuntimeFunction(\"detachFinalizer\",false);unexportedRuntimeFunction(\"attachFinalizer\",false);unexportedRuntimeFunction(\"makeClassHandle\",false);unexportedRuntimeFunction(\"init_ClassHandle\",false);unexportedRuntimeFunction(\"ClassHandle\",false);unexportedRuntimeFunction(\"ClassHandle_isAliasOf\",false);unexportedRuntimeFunction(\"throwInstanceAlreadyDeleted\",false);unexportedRuntimeFunction(\"ClassHandle_clone\",false);unexportedRuntimeFunction(\"ClassHandle_delete\",false);unexportedRuntimeFunction(\"deletionQueue\",false);unexportedRuntimeFunction(\"ClassHandle_isDeleted\",false);unexportedRuntimeFunction(\"ClassHandle_deleteLater\",false);unexportedRuntimeFunction(\"flushPendingDeletes\",false);unexportedRuntimeFunction(\"delayFunction\",false);unexportedRuntimeFunction(\"setDelayFunction\",false);unexportedRuntimeFunction(\"RegisteredClass\",false);unexportedRuntimeFunction(\"shallowCopyInternalPointer\",false);unexportedRuntimeFunction(\"downcastPointer\",false);unexportedRuntimeFunction(\"upcastPointer\",false);unexportedRuntimeFunction(\"validateThis\",false);unexportedRuntimeFunction(\"char_0\",false);unexportedRuntimeFunction(\"char_9\",false);unexportedRuntimeFunction(\"makeLegalFunctionName\",false);unexportedRuntimeFunction(\"emval_handle_array\",false);unexportedRuntimeFunction(\"emval_free_list\",false);unexportedRuntimeFunction(\"emval_symbols\",false);unexportedRuntimeFunction(\"init_emval\",false);unexportedRuntimeFunction(\"count_emval_handles\",false);unexportedRuntimeFunction(\"get_first_emval\",false);unexportedRuntimeFunction(\"getStringOrSymbol\",false);unexportedRuntimeFunction(\"Emval\",false);unexportedRuntimeFunction(\"emval_newers\",false);unexportedRuntimeFunction(\"craftEmvalAllocator\",false);unexportedRuntimeFunction(\"emval_get_global\",false);unexportedRuntimeFunction(\"emval_methodCallers\",false);unexportedRuntimeFunction(\"emval_registeredMethods\",false);unexportedRuntimeFunction(\"warnOnce\",false);unexportedRuntimeFunction(\"stackSave\",false);unexportedRuntimeFunction(\"stackRestore\",false);unexportedRuntimeFunction(\"stackAlloc\",false);unexportedRuntimeFunction(\"AsciiToString\",false);unexportedRuntimeFunction(\"stringToAscii\",false);unexportedRuntimeFunction(\"UTF16ToString\",false);unexportedRuntimeFunction(\"stringToUTF16\",false);unexportedRuntimeFunction(\"lengthBytesUTF16\",false);unexportedRuntimeFunction(\"UTF32ToString\",false);unexportedRuntimeFunction(\"stringToUTF32\",false);unexportedRuntimeFunction(\"lengthBytesUTF32\",false);unexportedRuntimeFunction(\"allocateUTF8\",false);unexportedRuntimeFunction(\"allocateUTF8OnStack\",false);Module[\"writeStackCookie\"]=writeStackCookie;Module[\"checkStackCookie\"]=checkStackCookie;unexportedRuntimeSymbol(\"ALLOC_NORMAL\",false);unexportedRuntimeSymbol(\"ALLOC_STACK\",false);var calledRun;function ExitStatus(status){this.name=\"ExitStatus\";this.message=\"Program terminated with exit(\"+status+\")\";this.status=status}dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function stackCheckInit(){_emscripten_stack_init();writeStackCookie()}function run(args){args=args||arguments_;if(runDependencies>0){return}stackCheckInit();preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module[\"calledRun\"]=true;if(ABORT)return;initRuntime();if(Module[\"onRuntimeInitialized\"])Module[\"onRuntimeInitialized\"]();assert(!Module[\"_main\"],'compiled without a main, but one is present. if you added it from JS, use Module[\"onRuntimeInitialized\"]');postRun()}if(Module[\"setStatus\"]){Module[\"setStatus\"](\"Running...\");setTimeout(function(){setTimeout(function(){Module[\"setStatus\"](\"\")},1);doRun()},1)}else{doRun()}checkStackCookie()}Module[\"run\"]=run;function checkUnflushedContent(){var oldOut=out;var oldErr=err;var has=false;out=err=(x=>{has=true});try{___stdio_exit();[\"stdout\",\"stderr\"].forEach(function(name){var info=FS.analyzePath(\"/dev/\"+name);if(!info)return;var stream=info.object;var rdev=stream.rdev;var tty=TTY.ttys[rdev];if(tty&&tty.output&&tty.output.length){has=true}})}catch(e){}out=oldOut;err=oldErr;if(has){warnOnce(\"stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the FAQ), or make sure to emit a newline when you printf etc.\")}}function procExit(code){EXITSTATUS=code;if(!keepRuntimeAlive()){if(Module[\"onExit\"])Module[\"onExit\"](code);ABORT=true}quit_(code,new ExitStatus(code))}if(Module[\"preInit\"]){if(typeof Module[\"preInit\"]==\"function\")Module[\"preInit\"]=[Module[\"preInit\"]];while(Module[\"preInit\"].length>0){Module[\"preInit\"].pop()()}}run();module.exports=Module;\n","export default (gl, openWebglAlignment) => {\n var vertexShaderScript = [\n 'attribute vec4 vertexPos;',\n 'attribute vec4 texturePos;',\n 'varying vec2 textureCoord;',\n\n 'void main()',\n '{',\n 'gl_Position = vertexPos;',\n 'textureCoord = texturePos.xy;',\n '}'\n ].join('\\n');\n\n var fragmentShaderScript = [\n 'precision highp float;',\n 'varying highp vec2 textureCoord;',\n 'uniform sampler2D ySampler;',\n 'uniform sampler2D uSampler;',\n 'uniform sampler2D vSampler;',\n 'const mat4 YUV2RGB = mat4',\n '(',\n '1.1643828125, 0, 1.59602734375, -.87078515625,',\n '1.1643828125, -.39176171875, -.81296875, .52959375,',\n '1.1643828125, 2.017234375, 0, -1.081390625,',\n '0, 0, 0, 1',\n ');',\n\n 'void main(void) {',\n 'highp float y = texture2D(ySampler, textureCoord).r;',\n 'highp float u = texture2D(uSampler, textureCoord).r;',\n 'highp float v = texture2D(vSampler, textureCoord).r;',\n 'gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;',\n '}'\n ].join('\\n');\n\n if (openWebglAlignment) {\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);\n }\n var vertexShader = gl.createShader(gl.VERTEX_SHADER);\n gl.shaderSource(vertexShader, vertexShaderScript);\n gl.compileShader(vertexShader);\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {\n console.log('Vertex shader failed to compile: ' + gl.getShaderInfoLog(vertexShader));\n }\n\n var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\n gl.shaderSource(fragmentShader, fragmentShaderScript);\n gl.compileShader(fragmentShader);\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {\n console.log('Fragment shader failed to compile: ' + gl.getShaderInfoLog(fragmentShader));\n }\n\n var program = gl.createProgram();\n gl.attachShader(program, vertexShader);\n gl.attachShader(program, fragmentShader);\n gl.linkProgram(program);\n if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n console.log('Program failed to compile: ' + gl.getProgramInfoLog(program));\n }\n\n gl.useProgram(program);\n\n // initBuffers\n var vertexPosBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, vertexPosBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW);\n\n var vertexPosRef = gl.getAttribLocation(program, 'vertexPos');\n gl.enableVertexAttribArray(vertexPosRef);\n gl.vertexAttribPointer(vertexPosRef, 2, gl.FLOAT, false, 0, 0);\n\n var texturePosBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, texturePosBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 0, 0, 0, 1, 1, 0, 1]), gl.STATIC_DRAW);\n\n var texturePosRef = gl.getAttribLocation(program, 'texturePos');\n gl.enableVertexAttribArray(texturePosRef);\n gl.vertexAttribPointer(texturePosRef, 2, gl.FLOAT, false, 0, 0);\n\n function _initTexture(name, index) {\n var textureRef = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, textureRef);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.uniform1i(gl.getUniformLocation(program, name), index);\n return textureRef;\n }\n\n var yTextureRef = _initTexture('ySampler', 0);\n var uTextureRef = _initTexture('uSampler', 1);\n var vTextureRef = _initTexture('vSampler', 2);\n\n return {\n render: function (w, h, y, u, v) {\n gl.viewport(0, 0, w, h);\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, yTextureRef);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, w, h, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, y);\n gl.activeTexture(gl.TEXTURE1);\n gl.bindTexture(gl.TEXTURE_2D, uTextureRef);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, w / 2, h / 2, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, u);\n gl.activeTexture(gl.TEXTURE2);\n gl.bindTexture(gl.TEXTURE_2D, vTextureRef);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, w / 2, h / 2, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, v);\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);\n },\n destroy: function () {\n try {\n gl.deleteProgram(program);\n\n gl.deleteBuffer(vertexPosBuffer)\n gl.deleteBuffer(texturePosBuffer);\n\n gl.deleteTexture(yTextureRef);\n gl.deleteTexture(uTextureRef);\n gl.deleteTexture(vTextureRef);\n } catch (e) {\n // console.error(e);\n }\n\n }\n }\n};\n","// 播放协议\nexport const PLAYER_PLAY_PROTOCOL = {\n websocket: 0,\n fetch: 1,\n webrtc: 2,\n}\n\nexport const DEMUX_TYPE = {\n flv: 'flv',\n m7s: 'm7s'\n}\n\nexport const FILE_SUFFIX = {\n mp4: 'mp4',\n webm: 'webm'\n};\n\nexport const MEDIA_SOURCE_UPDATE_END_TIMEOUT = 10 * 1000\n\nexport const CONTAINER_DATA_SET_KEY = 'jessibuca'\n\nexport const VERSION = '__VERSION__'\n\n\n// default player options\nexport const DEFAULT_PLAYER_OPTIONS = {\n videoBuffer: 1000, //1000ms 1 second\n videoBufferDelay: 1000,// 1000ms\n isResize: true,\n isFullResize: false, //\n isFlv: false,\n debug: false,\n hotKey: false, // 快捷键\n loadingTimeout: 10, // loading timeout\n heartTimeout: 5, // heart timeout\n timeout: 10, // second\n loadingTimeoutReplay: true, // loading timeout replay. default is true\n heartTimeoutReplay: true,// heart timeout replay.\n loadingTimeoutReplayTimes: 3, // loading timeout replay fail times\n heartTimeoutReplayTimes: 3, // heart timeout replay fail times\n supportDblclickFullscreen: false, // support double click toggle fullscreen\n showBandwidth: false, // show band width\n keepScreenOn: false, //\n isNotMute: false, //\n hasAudio: true, // has audio\n hasVideo: true, // has video\n operateBtns: {\n fullscreen: false,\n screenshot: false,\n play: false,\n audio: false,\n record: false,\n },\n controlAutoHide: false, // control auto hide\n hasControl: false,\n loadingText: '', // loading Text\n background: '',\n decoder: 'decoder.js',\n url: '',// play url\n rotate: 0, //\n // text: '',\n forceNoOffscreen: true, // 默认是不采用\n hiddenAutoPause: false, //\n protocol: PLAYER_PLAY_PROTOCOL.fetch,\n demuxType: DEMUX_TYPE.flv, // demux type\n useWCS: false, //\n wcsUseVideoRender: true,// 默认设置为true\n useMSE: false, //\n useOffscreen: false, //\n autoWasm: true, // 自动降级到 wasm 模式\n wasmDecodeErrorReplay: true, // 解码失败重新播放。\n openWebglAlignment: false,// https://github.com/langhuihui/jessibuca/issues/152\n wasmDecodeAudioSyncVideo: false,// wasm 解码之后音视频同步\n recordType: FILE_SUFFIX.webm,\n useWebFullScreen: false, // use web full screen\n}\n\n\nexport const WORKER_CMD_TYPE = {\n init: 'init',\n initVideo: 'initVideo',\n render: 'render',\n playAudio: 'playAudio',\n initAudio: 'initAudio',\n kBps: 'kBps',\n decode: 'decode',\n audioCode: 'audioCode',\n videoCode: 'videoCode',\n wasmError: 'wasmError'\n}\n\nexport const WASM_ERROR = {\n invalidNalUnitSize: 'Invalid NAL unit size',\n // errorSplittingTheInputIntoNALUnits: 'Error splitting the input into NAL units'\n}\n\nexport const MEDIA_TYPE = {\n audio: 1,\n video: 2\n}\n\nexport const FLV_MEDIA_TYPE = {\n audio: 8,\n video: 9\n}\n\nexport const WORKER_SEND_TYPE = {\n init: 'init',\n decode: 'decode',\n audioDecode: 'audioDecode',\n videoDecode: 'videoDecode',\n close: 'close',\n updateConfig: 'updateConfig'\n}\n\n\n//\nexport const EVENTS = {\n fullscreen: 'fullscreen$2',\n webFullscreen: 'webFullscreen',\n decoderWorkerInit: 'decoderWorkerInit',\n play: 'play',\n playing: 'playing',\n pause: 'pause',\n mute: 'mute',\n load: 'load',\n loading: 'loading',\n videoInfo: 'videoInfo',\n timeUpdate: 'timeUpdate',\n audioInfo: \"audioInfo\",\n log: 'log',\n error: \"error\",\n kBps: 'kBps',\n timeout: 'timeout',\n delayTimeout: 'delayTimeout',\n loadingTimeout: 'loadingTimeout',\n stats: 'stats',\n performance: \"performance\",\n record: 'record',\n recording: 'recording',\n recordingTimestamp: 'recordingTimestamp',\n recordStart: 'recordStart',\n recordEnd: 'recordEnd',\n recordCreateError: 'recordCreateError',\n buffer: 'buffer',\n videoFrame: 'videoFrame',\n start: 'start',\n metadata: 'metadata',\n resize: 'resize',\n streamEnd: 'streamEnd',\n streamSuccess: 'streamSuccess',\n streamMessage: 'streamMessage',\n streamError: 'streamError',\n volumechange: 'volumechange',\n volume: 'volume',\n destroy: 'destroy',\n mseSourceOpen: 'mseSourceOpen',\n mseSourceClose: 'mseSourceClose',\n mseSourceBufferError: 'mseSourceBufferError',\n mseSourceBufferBusy: 'mseSourceBufferBusy',\n mseSourceBufferFull: 'mseSourceBufferFull',\n videoWaiting: 'videoWaiting',\n videoTimeUpdate: 'videoTimeUpdate',\n videoSyncAudio: 'videoSyncAudio',\n playToRenderTimes: 'playToRenderTimes'\n}\n\n\nexport const JESSIBUCA_EVENTS = {\n load: EVENTS.load,\n timeUpdate: EVENTS.timeUpdate,\n videoInfo: EVENTS.videoInfo,\n audioInfo: EVENTS.audioInfo,\n error: EVENTS.error,\n kBps: EVENTS.kBps,\n log: EVENTS.log,\n start: EVENTS.start,\n timeout: EVENTS.timeout,\n loadingTimeout: EVENTS.loadingTimeout,\n delayTimeout: EVENTS.delayTimeout,\n fullscreen: 'fullscreen',\n webFullscreen: EVENTS.webFullscreen,\n play: EVENTS.play,\n pause: EVENTS.pause,\n mute: EVENTS.mute,\n stats: EVENTS.stats,\n volumechange: EVENTS.volumechange,\n performance: EVENTS.performance,\n recordingTimestamp: EVENTS.recordingTimestamp,\n recordStart: EVENTS.recordStart,\n recordEnd: EVENTS.recordEnd,\n playToRenderTimes: EVENTS.playToRenderTimes,\n volume: EVENTS.volume\n}\n\nexport const EVENTS_ERROR = {\n playError: 'playIsNotPauseOrUrlIsNull',\n fetchError: \"fetchError\",\n websocketError: 'websocketError',\n webcodecsH265NotSupport: 'webcodecsH265NotSupport',\n webcodecsConfigureError:'webcodecsConfigureError',\n webcodecsDecodeError: 'webcodecsDecodeError',\n webcodecsWidthOrHeightChange: 'webcodecsWidthOrHeightChange',\n mediaSourceH265NotSupport: 'mediaSourceH265NotSupport',\n mediaSourceFull: EVENTS.mseSourceBufferFull,\n mseSourceBufferError: EVENTS.mseSourceBufferError,\n mediaSourceAppendBufferError: 'mediaSourceAppendBufferError',\n mediaSourceBufferListLarge: 'mediaSourceBufferListLarge',\n mediaSourceAppendBufferEndTimeout: 'mediaSourceAppendBufferEndTimeout',\n wasmDecodeError: 'wasmDecodeError',\n webglAlignmentError: 'webglAlignmentError'\n}\n\n\nexport const WEBSOCKET_STATUS = {\n notConnect: 'notConnect',\n open: 'open',\n close: 'close',\n error: 'error'\n}\n\nexport const BUFFER_STATUS = {\n empty: 'empty',\n buffering: 'buffering',\n full: 'full'\n}\n\n\nexport const SCREENSHOT_TYPE = {\n download: 'download',\n base64: 'base64',\n blob: 'blob'\n}\n\n\nexport const VIDEO_ENC_TYPE = {\n 7: 'H264(AVC)', //\n 12: 'H265(HEVC)' //\n}\n\nexport const VIDEO_ENC_CODE = {\n h264: 7,\n h265: 12\n}\n\n\nexport const AUDIO_ENC_TYPE = {\n 10: 'AAC',\n 7: 'ALAW',\n 8: 'MULAW'\n}\n\nexport const H265_NAL_TYPE = {\n vps: 32,\n sps: 33,\n pps: 34\n}\n\nexport const CONTROL_HEIGHT = 38\n\nexport const SCALE_MODE_TYPE = {\n full: 0, // 视频画面完全填充canvas区域,画面会被拉伸\n auto: 1, // 视频画面做等比缩放后,高或宽对齐canvas区域,画面不被拉伸,但有黑边\n fullAuto: 2 // 视频画面做等比缩放后,完全填充canvas区域,画面不被拉伸,没有黑边,但画面显示不全\n}\n\n\nexport const CANVAS_RENDER_TYPE = {\n webcodecs: 'webcodecs',\n webgl: 'webgl',\n offscreen: 'offscreen'\n}\n\nexport const ENCODED_VIDEO_TYPE = {\n key: 'key',\n delta: 'delta'\n}\n\n\nexport const MP4_CODECS = {\n avc: 'video/mp4; codecs=\"avc1.64002A\"',\n hev: 'video/mp4; codecs=\"hev1.1.6.L123.b0\"',\n}\n\n\nexport const MEDIA_SOURCE_STATE = {\n ended: 'ended',\n open: 'open',\n closed: 'closed'\n}\n\n\n// frag duration\nexport const FRAG_DURATION = Math.ceil(1000 / 25)\n\n\nexport const AUDIO_SYNC_VIDEO_DIFF = 1000;\n\n\nexport const HOT_KEY = {\n esc: 27, //\n arrowUp: 38, //\n arrowDown: 40, //\n}\nexport const WCS_ERROR = {\n keyframeIsRequiredError: 'A key frame is required after configure() or flush()',\n canNotDecodeClosedCodec: \"Cannot call 'decode' on a closed codec\"\n}\n\n\nexport const FETCH_ERROR = {\n abortError1: 'The user aborted a request',\n abortError2: 'AbortError',\n abort: 'AbortError'\n}\n\nexport const FRAME_HEADER_EX = 0x80\n\n\nexport const PACKET_TYPE_EX = {\n PACKET_TYPE_SEQ_START: 0,\n PACKET_TYPE_FRAMES: 1,\n PACKET_TYPE_FRAMESX: 3,\n};\n\n\nexport const FRAME_TYPE_EX = {\n FT_KEY: 0x10,\n FT_INTER: 0x20\n};\n\n\n\n","/*!\n* screenfull\n* v5.1.0 - 2020-12-24\n* (c) Sindre Sorhus; MIT License\n*/\n(function () {\n\t'use strict';\n\n\tvar document = typeof window !== 'undefined' && typeof window.document !== 'undefined' ? window.document : {};\n\tvar isCommonjs = typeof module !== 'undefined' && module.exports;\n\n\tvar fn = (function () {\n\t\tvar val;\n\n\t\tvar fnMap = [\n\t\t\t[\n\t\t\t\t'requestFullscreen',\n\t\t\t\t'exitFullscreen',\n\t\t\t\t'fullscreenElement',\n\t\t\t\t'fullscreenEnabled',\n\t\t\t\t'fullscreenchange',\n\t\t\t\t'fullscreenerror'\n\t\t\t],\n\t\t\t// New WebKit\n\t\t\t[\n\t\t\t\t'webkitRequestFullscreen',\n\t\t\t\t'webkitExitFullscreen',\n\t\t\t\t'webkitFullscreenElement',\n\t\t\t\t'webkitFullscreenEnabled',\n\t\t\t\t'webkitfullscreenchange',\n\t\t\t\t'webkitfullscreenerror'\n\n\t\t\t],\n\t\t\t// Old WebKit\n\t\t\t[\n\t\t\t\t'webkitRequestFullScreen',\n\t\t\t\t'webkitCancelFullScreen',\n\t\t\t\t'webkitCurrentFullScreenElement',\n\t\t\t\t'webkitCancelFullScreen',\n\t\t\t\t'webkitfullscreenchange',\n\t\t\t\t'webkitfullscreenerror'\n\n\t\t\t],\n\t\t\t[\n\t\t\t\t'mozRequestFullScreen',\n\t\t\t\t'mozCancelFullScreen',\n\t\t\t\t'mozFullScreenElement',\n\t\t\t\t'mozFullScreenEnabled',\n\t\t\t\t'mozfullscreenchange',\n\t\t\t\t'mozfullscreenerror'\n\t\t\t],\n\t\t\t[\n\t\t\t\t'msRequestFullscreen',\n\t\t\t\t'msExitFullscreen',\n\t\t\t\t'msFullscreenElement',\n\t\t\t\t'msFullscreenEnabled',\n\t\t\t\t'MSFullscreenChange',\n\t\t\t\t'MSFullscreenError'\n\t\t\t]\n\t\t];\n\n\t\tvar i = 0;\n\t\tvar l = fnMap.length;\n\t\tvar ret = {};\n\n\t\tfor (; i < l; i++) {\n\t\t\tval = fnMap[i];\n\t\t\tif (val && val[1] in document) {\n\t\t\t\tfor (i = 0; i < val.length; i++) {\n\t\t\t\t\tret[fnMap[0][i]] = val[i];\n\t\t\t\t}\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t})();\n\n\tvar eventNameMap = {\n\t\tchange: fn.fullscreenchange,\n\t\terror: fn.fullscreenerror\n\t};\n\n\tvar screenfull = {\n\t\trequest: function (element, options) {\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\tvar onFullScreenEntered = function () {\n\t\t\t\t\tthis.off('change', onFullScreenEntered);\n\t\t\t\t\tresolve();\n\t\t\t\t}.bind(this);\n\n\t\t\t\tthis.on('change', onFullScreenEntered);\n\n\t\t\t\telement = element || document.documentElement;\n\n\t\t\t\tvar returnPromise = element[fn.requestFullscreen](options);\n\n\t\t\t\tif (returnPromise instanceof Promise) {\n\t\t\t\t\treturnPromise.then(onFullScreenEntered).catch(reject);\n\t\t\t\t}\n\t\t\t}.bind(this));\n\t\t},\n\t\texit: function () {\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\tif (!this.isFullscreen) {\n\t\t\t\t\tresolve();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar onFullScreenExit = function () {\n\t\t\t\t\tthis.off('change', onFullScreenExit);\n\t\t\t\t\tresolve();\n\t\t\t\t}.bind(this);\n\n\t\t\t\tthis.on('change', onFullScreenExit);\n\n\t\t\t\tvar returnPromise = document[fn.exitFullscreen]();\n\n\t\t\t\tif (returnPromise instanceof Promise) {\n\t\t\t\t\treturnPromise.then(onFullScreenExit).catch(reject);\n\t\t\t\t}\n\t\t\t}.bind(this));\n\t\t},\n\t\ttoggle: function (element, options) {\n\t\t\treturn this.isFullscreen ? this.exit() : this.request(element, options);\n\t\t},\n\t\tonchange: function (callback) {\n\t\t\tthis.on('change', callback);\n\t\t},\n\t\tonerror: function (callback) {\n\t\t\tthis.on('error', callback);\n\t\t},\n\t\ton: function (event, callback) {\n\t\t\tvar eventName = eventNameMap[event];\n\t\t\tif (eventName) {\n\t\t\t\tdocument.addEventListener(eventName, callback, false);\n\t\t\t}\n\t\t},\n\t\toff: function (event, callback) {\n\t\t\tvar eventName = eventNameMap[event];\n\t\t\tif (eventName) {\n\t\t\t\tdocument.removeEventListener(eventName, callback, false);\n\t\t\t}\n\t\t},\n\t\traw: fn\n\t};\n\n\tif (!fn) {\n\t\tif (isCommonjs) {\n\t\t\tmodule.exports = {isEnabled: false};\n\t\t} else {\n\t\t\twindow.screenfull = {isEnabled: false};\n\t\t}\n\n\t\treturn;\n\t}\n\n\tObject.defineProperties(screenfull, {\n\t\tisFullscreen: {\n\t\t\tget: function () {\n\t\t\t\treturn Boolean(document[fn.fullscreenElement]);\n\t\t\t}\n\t\t},\n\t\telement: {\n\t\t\tenumerable: true,\n\t\t\tget: function () {\n\t\t\t\treturn document[fn.fullscreenElement];\n\t\t\t}\n\t\t},\n\t\tisEnabled: {\n\t\t\tenumerable: true,\n\t\t\tget: function () {\n\t\t\t\t// Coerce to boolean in case of old WebKit\n\t\t\t\treturn Boolean(document[fn.fullscreenEnabled]);\n\t\t\t}\n\t\t}\n\t});\n\n\tif (isCommonjs) {\n\t\tmodule.exports = screenfull;\n\t} else {\n\t\twindow.screenfull = screenfull;\n\t}\n})();\n","import {MP4_CODECS, FILE_SUFFIX} from \"../constant\";\nimport screenfull from \"screenfull\";\n\nexport function noop() {\n}\n\n\nexport function supportOffscreen($canvas) {\n return typeof $canvas.transferControlToOffscreen === 'function';\n}\n\n\nexport function supportOffscreenV2() {\n return typeof OffscreenCanvas !== \"undefined\";\n}\n\n\nexport function createContextGL($canvas) {\n let gl = null;\n\n const validContextNames = [\"webgl\", \"experimental-webgl\", \"moz-webgl\", \"webkit-3d\"];\n let nameIndex = 0;\n\n while (!gl && nameIndex < validContextNames.length) {\n const contextName = validContextNames[nameIndex];\n\n try {\n let contextOptions = {preserveDrawingBuffer: true};\n gl = $canvas.getContext(contextName, contextOptions);\n } catch (e) {\n gl = null;\n }\n\n if (!gl || typeof gl.getParameter !== \"function\") {\n gl = null;\n }\n\n ++nameIndex;\n }\n\n\n return gl;\n}\n\n\nexport function audioContextUnlock(context) {\n context.resume();\n const source = context.createBufferSource();\n source.buffer = context.createBuffer(1, 1, 22050);\n source.connect(context.destination);\n if (source.noteOn) {\n source.noteOn(0);\n } else {\n source.start(0);\n }\n}\n\nexport function dataURLToFile(dataURL = '') {\n const arr = dataURL.split(\",\");\n const bstr = atob(arr[1]);\n const type = arr[0].replace(\"data:\", \"\").replace(\";base64\", \"\")\n let n = bstr.length, u8arr = new Uint8Array(n);\n while (n--) {\n u8arr[n] = bstr.charCodeAt(n);\n }\n return new File([u8arr], 'file', {type});\n}\n\nexport function downloadFile(file, fileName) {\n if (file instanceof Blob || file instanceof File) {\n file = new Blob([file]);\n }\n const aLink = document.createElement(\"a\");\n aLink.download = fileName;\n aLink.href = file;\n aLink.click();\n}\n\n\nexport function downloadImg(content, fileName) {\n const aLink = document.createElement(\"a\");\n aLink.download = fileName;\n const href = URL.createObjectURL(content);\n aLink.href = href;\n aLink.click();\n setTimeout(() => {\n URL.revokeObjectURL(href);\n }, isIOS() ? 1000 : 0)\n}\n\nexport function checkFull() {\n let isFull = document.fullscreenElement || window.webkitFullscreenElement || document.msFullscreenElement;\n if (isFull === undefined) isFull = false;\n return !!isFull;\n}\n\nexport function now() {\n return new Date().getTime();\n}\n\nexport const supportedWasm = (() => {\n try {\n if (typeof WebAssembly === \"object\"\n && typeof WebAssembly.instantiate === \"function\") {\n const module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));\n if (module instanceof WebAssembly.Module)\n return new WebAssembly.Instance(module) instanceof WebAssembly.Instance;\n }\n } catch (e) {\n }\n return false;\n})();\n\nexport function clamp(num, a, b) {\n return Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b));\n}\n\nexport function setStyle(element, key, value) {\n if (!element) {\n return\n }\n if (typeof key === 'object') {\n Object.keys(key).forEach(item => {\n setStyle(element, item, key[item]);\n });\n }\n element.style[key] = value;\n return element;\n}\n\n\nexport function getStyle(element, key, numberType = true) {\n if (!element) {\n return 0\n }\n\n const value = getComputedStyle(element, null).getPropertyValue(key);\n return numberType ? parseFloat(value) : value;\n}\n\nexport function getNowTime() {\n if (performance && typeof performance.now === 'function') {\n return performance.now();\n }\n return Date.now();\n}\n\nexport function calculationRate(callback) {\n let totalSize = 0;\n let lastTime = getNowTime();\n return size => {\n totalSize += size;\n const thisTime = getNowTime();\n const diffTime = thisTime - lastTime;\n if (diffTime >= 1000) {\n callback((totalSize / diffTime) * 1000);\n lastTime = thisTime;\n totalSize = 0;\n }\n };\n}\n\nexport function downloadRecord(blob, name, suffix) {\n const url = window.URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = (name || now()) + '.' + (suffix || FILE_SUFFIX.webm);\n a.click();\n setTimeout(() => {\n window.URL.revokeObjectURL(url);\n }, isIOS() ? 1000 : 0)\n}\n\nexport const env = '__ENV__';\n\nexport function isMobile() {\n return (/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase()));\n}\n\nexport function isPad(){\n return (/ipad|android(?!.*mobile)|tablet|kindle|silk/i.test(window.navigator.userAgent.toLowerCase()));\n}\n\nexport function isAndroid() {\n const UA = window.navigator.userAgent.toLowerCase();\n return (/android/i.test(UA));\n}\n\nexport function isIOS() {\n const UA = window.navigator.userAgent.toLowerCase();\n return UA && /iphone|ipad|ipod|ios/.test(UA);\n}\n\n\nexport function parseTime(time, cFormat) {\n if (arguments.length === 0) {\n return null\n }\n var format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'\n var date;\n if (typeof time === 'object') {\n date = time\n } else {\n if (('' + time).length === 10) time = parseInt(time) * 1000;\n time = +time; // 转成int 型\n date = new Date(time)\n }\n var formatObj = {\n y: date.getFullYear(),\n m: date.getMonth() + 1,\n d: date.getDate(),\n h: date.getHours(),\n i: date.getMinutes(),\n s: date.getSeconds(),\n a: date.getDay()\n };\n var time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {\n var value = formatObj[key]\n if (key === 'a') return ['一', '二', '三', '四', '五', '六', '日'][value - 1]\n if (result.length > 0 && value < 10) {\n value = '0' + value\n }\n return value || 0\n });\n return time_str\n}\n\n// 是否支持 webcodecs\nexport function supportWCS() {\n return \"VideoEncoder\" in window;\n}\n\nexport function toNumber(value) {\n if (typeof value !== 'string') {\n return value;\n } else {\n // 转换成 number 类型\n var parsed = Number(value);\n return isNaN(parsed) ? value : parsed;\n }\n}\n\nexport function uuid16() {\n return 'xxxxxxxxxxxx4xxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8)\n return v.toString(16)\n })\n}\n\nexport function throttle(callback, delay) {\n let isThrottled = false;\n let args;\n let context;\n\n function fn(...args2) {\n if (isThrottled) {\n args = args2;\n context = this;\n return;\n }\n\n isThrottled = true;\n callback.apply(this, args2);\n setTimeout(() => {\n isThrottled = false;\n if (args) {\n fn.apply(context, args);\n args = null;\n context = null;\n }\n }, delay);\n }\n\n return fn;\n}\n\n\nexport function isDef(v) {\n return v !== undefined && v !== null;\n}\n\nexport function formatVideoDecoderConfigure(avcC) {\n let codecArray = avcC.subarray(1, 4);\n let codecString = \"avc1.\";\n for (let j = 0; j < 3; j++) {\n let h = codecArray[j].toString(16);\n if (h.length < 2) {\n h = \"0\" + h\n }\n codecString += h\n }\n\n return {\n codec: codecString,\n description: avcC\n }\n}\n\nexport function isFullScreen() {\n return screenfull.isFullscreen\n}\n\nexport function bpsSize(value) {\n if (null == value || value === '' || parseInt(value) === 0 || isNaN(parseInt(value))) {\n return \"0KB/s\";\n }\n let size = parseFloat(value);\n size = size.toFixed(2);\n return size + 'KB/s';\n}\n\n\nexport function fpsStatus(fps) {\n let result = 0;\n if (fps >= 24) {\n result = 2;\n } else if (fps >= 15) {\n result = 1;\n }\n\n return result;\n}\n\nexport function createEmptyImageBitmap(width, height) {\n const $canvasElement = document.createElement(\"canvas\");\n $canvasElement.width = width;\n $canvasElement.height = height;\n return window.createImageBitmap($canvasElement, 0, 0, width, height);\n}\n\n\nexport function supportMSE() {\n return window.MediaSource && window.MediaSource.isTypeSupported(MP4_CODECS.avc);\n}\n\nexport function supportMediaStreamTrack() {\n return window.MediaStreamTrackGenerator && typeof window.MediaStreamTrackGenerator === 'function'\n}\n\n\nexport function formatMp4VideoCodec(codec) {\n return `video/mp4; codecs=\"${codec}\"`\n}\n\n\nexport function saveBlobToFile(fileName, blob) {\n let url = window.URL.createObjectURL(blob);\n let aLink = window.document.createElement('a');\n aLink.download = fileName;\n aLink.href = url;\n //创建内置事件并触发\n let evt = window.document.createEvent('MouseEvents');\n evt.initEvent(\"click\", true, true); //initEvent 不加后两个参数在FF下会报错 事件类型,是否冒泡,是否阻止浏览器的默认行为\n aLink.dispatchEvent(evt);\n setTimeout(() => {\n window.URL.revokeObjectURL(url);\n }, isIOS() ? 1000 : 0)\n}\n\nexport function isEmpty(value) {\n return value === null || value === undefined\n}\n\nexport function isBoolean(value) {\n return value === true || value === false;\n}\n\nexport function isNotEmpty(value) {\n return !isEmpty(value)\n}\n\nexport function initPlayTimes() {\n return {\n playInitStart: '', //1\n playStart: '', // 2\n streamStart: '', //3\n streamResponse: '', // 4\n demuxStart: '', // 5\n decodeStart: '', // 6\n videoStart: '', // 7\n playTimestamp: '',// playStart- playInitStart\n streamTimestamp: '',// streamStart - playStart\n streamResponseTimestamp: '',// streamResponse - streamStart\n demuxTimestamp: '', // demuxStart - streamResponse\n decodeTimestamp: '', // decodeStart - demuxStart\n videoTimestamp: '',// videoStart - decodeStart\n allTimestamp: '' // videoStart - playInitStart\n }\n}\n\n// create watermark\nexport function createWatermark(options) {\n let defaultConfig = {\n container: '',\n left: '',\n right: '',\n top: '',\n bottom: '',\n image: {\n src: '',\n width: '100',\n height: '60',\n },\n text: {\n content: '',\n fontSize: '14',\n color: '#000'\n },\n }\n defaultConfig = Object.assign(defaultConfig, options)\n\n const $container = defaultConfig.container;\n\n if ($container) {\n return\n }\n\n let shadowRoot = null;\n const otDiv = document.createElement('div');\n otDiv.setAttribute('style', 'pointer-events: none !important; display: block !important');\n\n if (typeof otDiv.attachShadow === \"function\") {\n shadowRoot = otDiv.attachShadow({mode: 'open'});\n } else if (otDiv.shadowRoot) {\n shadowRoot = otDiv.shadowRoot;\n } else {\n shadowRoot = otDiv;\n }\n\n const nodeList = $container.children;\n const index = Math.floor(Math.random() * (nodeList.length - 1));\n\n if (nodeList[index]) {\n $container.insertBefore(otDiv, nodeList[index]);\n } else {\n $container.appendChild(otDiv);\n }\n\n\n const maskDiv = document.createElement('div');\n let innerDom = null;\n if (defaultConfig.text && defaultConfig.text.content) {\n innerDom = document.createTextNode(defaultConfig.text);\n } else if (defaultConfig.image && defaultConfig.image.src) {\n innerDom = document.createElement('img')\n innerDom.style.height = '100%'\n innerDom.style.width = '100%'\n innerDom.src = defaultConfig.image.src;\n }\n\n if (!innerDom) {\n return;\n }\n\n maskDiv.appendChild(innerDom);\n\n maskDiv.style.visibility = '';\n maskDiv.style.position = \"absolute\";\n maskDiv.style.display = 'block'\n maskDiv.style['-ms-user-select'] = \"none\";\n maskDiv.style.left = defaultConfig.left;\n maskDiv.style.right = defaultConfig.right;\n maskDiv.style.top = defaultConfig.top;\n maskDiv.style.bottom = defaultConfig.bottom;\n maskDiv.style.overflow = 'hidden';\n maskDiv.style.zIndex = \"9999999\";\n if (defaultConfig.text && defaultConfig.text.content) {\n maskDiv.style.fontSize = defaultConfig.text.fontSize;\n maskDiv.style.color = defaultConfig.text.color;\n } else if (defaultConfig.image && defaultConfig.image.src) {\n maskDiv.style.width = defaultConfig.image.width + 'px';\n maskDiv.style.height = defaultConfig.image.height + 'px';\n }\n\n shadowRoot.appendChild(maskDiv)\n\n // remove function\n return () => {\n $container.removeChild(otDiv);\n }\n}\n\nexport function formatTimeTips(time) {\n var result;\n\n //\n if (time > -1) {\n var hour = Math.floor(time / 3600);\n var min = Math.floor(time / 60) % 60;\n var sec = time % 60;\n\n sec = Math.round(sec);\n\n if (hour < 10) {\n result = '0' + hour + \":\";\n } else {\n result = hour + \":\";\n }\n\n if (min < 10) {\n result += \"0\";\n }\n result += min + \":\";\n if (sec < 10) {\n result += \"0\";\n }\n result += sec.toFixed(0);\n }\n\n return result;\n}\n\nexport function getTarget(e) {\n const event = e || window.event;\n const target = event.target || event.srcElement;\n return target;\n}\n\nexport function isWebglRenderSupport(width) {\n return (width / 2) % 4 === 0\n}\n\nexport function isGreenYUV(arrayBuffer) {\n let zeroNum = 0;\n for (let i = 0; i < 10; i++) {\n let temp = arrayBuffer[i];\n if (temp === 0) {\n zeroNum += 1\n }\n }\n return zeroNum === 10;\n}\n\nexport function getBrowser() {\n const UserAgent = navigator.userAgent.toLowerCase();\n const browserInfo = {};\n const browserArray = {\n IE: window.ActiveXObject || \"ActiveXObject\" in window, // IE\n Chrome: UserAgent.indexOf('chrome') > -1 && UserAgent.indexOf('safari') > -1, // Chrome浏览器\n Firefox: UserAgent.indexOf('firefox') > -1, // 火狐浏览器\n Opera: UserAgent.indexOf('opera') > -1, // Opera浏览器\n Safari: UserAgent.indexOf('safari') > -1 && UserAgent.indexOf('chrome') == -1, // safari浏览器\n Edge: UserAgent.indexOf('edge') > -1, // Edge浏览器\n QQBrowser: /qqbrowser/.test(UserAgent), // qq浏览器\n WeixinBrowser: /MicroMessenger/i.test(UserAgent) // 微信浏览器\n };\n // console.log(browserArray)\n for (let i in browserArray) {\n if (browserArray[i]) {\n let versions = '';\n if (i === 'IE') {\n versions = UserAgent.match(/(msie\\s|trident.*rv:)([\\w.]+)/)[2];\n } else if (i === 'Chrome') {\n for (let mt in navigator.mimeTypes) {\n //检测是否是360浏览器(测试只有pc端的360才起作用)\n if (navigator.mimeTypes[mt]['type'] === 'application/360softmgrplugin') {\n i = '360';\n }\n }\n versions = UserAgent.match(/chrome\\/([\\d.]+)/)[1];\n } else if (i === 'Firefox') {\n versions = UserAgent.match(/firefox\\/([\\d.]+)/)[1];\n } else if (i === 'Opera') {\n versions = UserAgent.match(/opera\\/([\\d.]+)/)[1];\n } else if (i === 'Safari') {\n versions = UserAgent.match(/version\\/([\\d.]+)/)[1];\n } else if (i === 'Edge') {\n versions = UserAgent.match(/edge\\/([\\d.]+)/)[1];\n } else if (i === 'QQBrowser') {\n versions = UserAgent.match(/qqbrowser\\/([\\d.]+)/)[1];\n }\n browserInfo.type = i;\n browserInfo.version = parseInt(versions);\n }\n }\n return browserInfo;\n}\n\n\nexport function closeVideoFrame(videoFrame) {\n if (videoFrame.close) {\n videoFrame.close()\n } else if (videoFrame.destroy) {\n videoFrame.destroy()\n }\n}\n\n\nexport function removeElement(element) {\n let result = false;\n if (element) {\n if (element.parentNode) {\n element.parentNode.removeChild(element);\n result = true;\n }\n }\n return result;\n}\n\nexport function hevcEncoderNalePacketNotLength(oneNALBuffer, isIframe) {\n const idrBit = 0x10 | 12;\n const nIdrBit = 0x20 | 12;\n let tmp = [];\n if (isIframe) {\n tmp[0] = idrBit;\n } else {\n tmp[0] = nIdrBit;\n }\n tmp[1] = 1;\n //\n tmp[2] = 0;\n tmp[3] = 0;\n tmp[4] = 0;\n\n const arrayBuffer = new Uint8Array(tmp.length + oneNALBuffer.byteLength);\n arrayBuffer.set(tmp, 0);\n arrayBuffer.set(oneNALBuffer, tmp.length);\n return arrayBuffer;\n}\n\n\nexport function isTrue(value) {\n return value === true || value === 'true';\n}\n\nexport function isFalse(value) {\n return value !== true && value !== 'true';\n}\n\nexport function getElementDataset(element, key) {\n if (!element) {\n return '';\n }\n\n if (element.dataset) {\n return element.dataset[key];\n }\n return element.getAttribute('data-' + key);\n}\n\nexport function setElementDataset(element, key, value) {\n if (!element) {\n return;\n }\n\n if (element.dataset) {\n element.dataset[key] = value;\n } else {\n element.setAttribute('data-' + key, value);\n }\n}\n\nexport function removeElementDataset(element, key) {\n if (!element) {\n return;\n }\n\n if (element.dataset) {\n delete element.dataset[key];\n } else {\n element.removeAttribute('data-' + key);\n }\n}\n","import Module from './decoder/decoder';\nimport createWebGL from './utils/webgl';\nimport {WORKER_CMD_TYPE, MEDIA_TYPE, WORKER_SEND_TYPE, ENCODED_VIDEO_TYPE, DEFAULT_PLAYER_OPTIONS} from \"./constant\";\nimport {formatVideoDecoderConfigure, isGreenYUV} from \"./utils\";\n\nif (!Date.now) Date.now = function () {\n return new Date().getTime();\n};\n\nModule.postRun = function () {\n var buffer = [];\n var tempAudioBuffer = [];\n var wcsVideoDecoder = {};\n if (\"VideoEncoder\" in self) {\n wcsVideoDecoder = {\n hasInit: false,\n isEmitInfo: false,\n offscreenCanvas: null,\n offscreenCanvasCtx: null,\n decoder: new VideoDecoder({\n output: function (videoFrame) {\n if (!wcsVideoDecoder.isEmitInfo) {\n decoder.opt.debug && console.log('Jb: [worker] Webcodecs Video Decoder initSize');\n postMessage({\n cmd: WORKER_CMD_TYPE.initVideo,\n w: videoFrame.codedWidth,\n h: videoFrame.codedHeight\n });\n wcsVideoDecoder.isEmitInfo = true;\n wcsVideoDecoder.offscreenCanvas = new OffscreenCanvas(videoFrame.codedWidth, videoFrame.codedHeight);\n wcsVideoDecoder.offscreenCanvasCtx = wcsVideoDecoder.offscreenCanvas.getContext(\"2d\");\n }\n\n wcsVideoDecoder.offscreenCanvasCtx.drawImage(videoFrame, 0, 0, videoFrame.codedWidth, videoFrame.codedHeight);\n let image_bitmap = wcsVideoDecoder.offscreenCanvas.transferToImageBitmap();\n postMessage({\n cmd: WORKER_CMD_TYPE.render,\n buffer: image_bitmap,\n delay: decoder.delay,\n ts: 0\n }, [image_bitmap]);\n\n setTimeout(function () {\n if (videoFrame.close) {\n videoFrame.close();\n } else {\n videoFrame.destroy();\n }\n }, 100);\n\n },\n error: function (error) {\n console.error(error);\n }\n }),\n decode: function (payload, ts) {\n const isIFrame = payload[0] >> 4 === 1;\n if (!wcsVideoDecoder.hasInit) {\n if (isIFrame && payload[1] === 0) {\n const videoCodec = (payload[0] & 0x0F);\n decoder.setVideoCodec(videoCodec);\n const config = formatVideoDecoderConfigure(payload.slice(5));\n wcsVideoDecoder.decoder.configure(config);\n wcsVideoDecoder.hasInit = true;\n }\n } else {\n const chunk = new EncodedVideoChunk({\n data: payload.slice(5),\n timestamp: ts,\n type: isIFrame ? ENCODED_VIDEO_TYPE.key : ENCODED_VIDEO_TYPE.delta\n });\n wcsVideoDecoder.decoder.decode(chunk);\n }\n },\n reset() {\n wcsVideoDecoder.hasInit = false;\n wcsVideoDecoder.isEmitInfo = false;\n wcsVideoDecoder.offscreenCanvas = null;\n wcsVideoDecoder.offscreenCanvasCtx = null;\n }\n };\n }\n\n var decoder = {\n opt: {\n debug: DEFAULT_PLAYER_OPTIONS.debug,\n useOffscreen: DEFAULT_PLAYER_OPTIONS.useOffscreen,\n useWCS: DEFAULT_PLAYER_OPTIONS.useWCS,\n videoBuffer: DEFAULT_PLAYER_OPTIONS.videoBuffer,\n openWebglAlignment: DEFAULT_PLAYER_OPTIONS.openWebglAlignment,\n videoBufferDelay: DEFAULT_PLAYER_OPTIONS.videoBufferDelay\n },\n useOffscreen: function () {\n return decoder.opt.useOffscreen && typeof OffscreenCanvas != 'undefined';\n },\n initAudioPlanar: function (channels, samplerate) {\n postMessage({cmd: WORKER_CMD_TYPE.initAudio, sampleRate: samplerate, channels: channels});\n var outputArray = [];\n var remain = 0;\n this.playAudioPlanar = function (data, len, ts) {\n var frameCount = len;\n var origin = [];\n var start = 0;\n for (var channel = 0; channel < 2; channel++) {\n var fp = Module.HEAPU32[(data >> 2) + channel] >> 2;\n origin[channel] = Module.HEAPF32.subarray(fp, fp + frameCount);\n }\n if (remain) {\n len = 1024 - remain;\n if (frameCount >= len) {\n outputArray[0] = Float32Array.of(...tempAudioBuffer[0], ...origin[0].subarray(0, len));\n if (channels == 2) {\n outputArray[1] = Float32Array.of(...tempAudioBuffer[1], ...origin[1].subarray(0, len));\n }\n postMessage({\n cmd: WORKER_CMD_TYPE.playAudio,\n buffer: outputArray,\n ts\n }, outputArray.map(x => x.buffer));\n start = len;\n frameCount -= len;\n } else {\n remain += frameCount;\n tempAudioBuffer[0] = Float32Array.of(...tempAudioBuffer[0], ...origin[0]);\n if (channels == 2) {\n tempAudioBuffer[1] = Float32Array.of(...tempAudioBuffer[1], ...origin[1]);\n }\n return;\n }\n }\n for (remain = frameCount; remain >= 1024; remain -= 1024) {\n outputArray[0] = origin[0].slice(start, start += 1024);\n if (channels == 2) {\n outputArray[1] = origin[1].slice(start - 1024, start);\n }\n postMessage({\n cmd: WORKER_CMD_TYPE.playAudio,\n buffer: outputArray,\n ts\n }, outputArray.map(x => x.buffer));\n }\n if (remain) {\n tempAudioBuffer[0] = origin[0].slice(start);\n if (channels == 2) {\n tempAudioBuffer[1] = origin[1].slice(start);\n }\n }\n };\n },\n setVideoCodec: function (code) {\n postMessage({cmd: WORKER_CMD_TYPE.videoCode, code});\n },\n setAudioCodec: function (code) {\n postMessage({cmd: WORKER_CMD_TYPE.audioCode, code});\n },\n setVideoSize: function (w, h) {\n postMessage({cmd: WORKER_CMD_TYPE.initVideo, w: w, h: h});\n var size = w * h;\n var qsize = size >> 2;\n if (decoder.useOffscreen()) {\n this.offscreenCanvas = new OffscreenCanvas(w, h);\n this.offscreenCanvasGL = this.offscreenCanvas.getContext(\"webgl\");\n this.webglObj = createWebGL(this.offscreenCanvasGL, decoder.opt.openWebglAlignment);\n this.draw = function (ts, y, u, v) {\n const yData = Module.HEAPU8.subarray(y, y + size);\n const uData = Module.HEAPU8.subarray(u, u + qsize);\n const vData = Module.HEAPU8.subarray(v, v + (qsize));\n // if (isGreenYUV(Uint8Array.from(yData))) {\n // decoder.opt.debug && console.log('Jb: [worker]: draw offscreenCanvas is green yuv');\n // return\n // }\n\n this.webglObj.render(w, h, yData, uData, vData);\n let image_bitmap = this.offscreenCanvas.transferToImageBitmap();\n postMessage({\n cmd: WORKER_CMD_TYPE.render,\n buffer: image_bitmap,\n delay: this.delay,\n ts\n }, [image_bitmap]);\n };\n } else {\n this.draw = function (ts, y, u, v) {\n const yData = Uint8Array.from(Module.HEAPU8.subarray(y, y + size));\n const uData = Uint8Array.from(Module.HEAPU8.subarray(u, u + qsize));\n const vData = Uint8Array.from(Module.HEAPU8.subarray(v, v + (qsize)));\n // if (isGreenYUV(yData)) {\n // decoder.opt.debug && console.log('Jb: [worker]: draw is green yuv');\n // return\n // }\n const outputArray = [yData, uData, vData];\n postMessage({\n cmd: WORKER_CMD_TYPE.render,\n output: outputArray,\n delay: this.delay,\n ts\n }, outputArray.map(x => x.buffer));\n };\n }\n },\n getDelay: function (timestamp) {\n if (!timestamp) {\n return -1;\n }\n if (!this.firstTimestamp) {\n this.firstTimestamp = timestamp;\n this.startTimestamp = Date.now();\n this.delay = -1;\n } else {\n\n if (timestamp) {\n const localTimestamp = (Date.now() - this.startTimestamp);\n const timeTimestamp = (timestamp - this.firstTimestamp);\n if (localTimestamp >= timeTimestamp) {\n this.delay = localTimestamp - timeTimestamp;\n } else {\n this.delay = timeTimestamp - localTimestamp;\n }\n }\n }\n return this.delay;\n },\n resetDelay: function () {\n this.firstTimestamp = null;\n this.startTimestamp = null;\n this.delay = -1;\n },\n\n init: function () {\n decoder.opt.debug && console.log('Jb: [worker] init');\n const _doDecode = (data) => {\n // decoder.opt.debug && console.log('Jb: [worker]: _doDecode');\n if (decoder.opt.useWCS && decoder.useOffscreen() && data.type === MEDIA_TYPE.video && wcsVideoDecoder.decode) {\n wcsVideoDecoder.decode(data.payload, data.ts);\n } else {\n // decoder.opt.debug && console.log('Jb: [worker]: _doDecode wasm');\n data.decoder.decode(data.payload, data.ts);\n }\n };\n const loop = () => {\n if (buffer.length) {\n if (this.dropping) {\n // // dropping\n data = buffer.shift();\n //\n if (data.type === MEDIA_TYPE.audio && data.payload[1] === 0) {\n _doDecode(data);\n }\n while (!data.isIFrame && buffer.length) {\n // dropping\n data = buffer.shift();\n //\n if (data.type === MEDIA_TYPE.audio && data.payload[1] === 0) {\n _doDecode(data);\n }\n }\n if (data.isIFrame) {\n this.dropping = false;\n _doDecode(data);\n }\n } else {\n var data = buffer[0];\n if (this.getDelay(data.ts) === -1) {\n // decoder.opt.debug && console.log('Jb: [worker]: common dumex delay is -1');\n buffer.shift();\n _doDecode(data);\n } else if (this.delay > decoder.opt.videoBuffer + decoder.opt.videoBufferDelay) {\n // decoder.opt.debug && console.log('Jb: [worker]:', `delay is ${this.delay}, set dropping is true`);\n this.resetDelay();\n this.dropping = true;\n } else {\n while (buffer.length) {\n data = buffer[0];\n if (this.getDelay(data.ts) > decoder.opt.videoBuffer) {\n // decoder.opt.debug && console.log('Jb: [worker]:', `delay is ${this.delay}, decode`);\n buffer.shift();\n _doDecode(data);\n } else {\n // decoder.opt.debug && console.log('Jb: [worker]:', `delay is ${this.delay},opt.videoBuffer is ${decoder.opt.videoBuffer}`);\n break;\n }\n }\n }\n }\n }\n else {\n }\n };\n this.stopId = setInterval(loop, 10);\n },\n close: function () {\n decoder.opt.debug && console.log('Jb: [worker]: close');\n clearInterval(this.stopId);\n this.stopId = null;\n audioDecoder.clear && audioDecoder.clear();\n videoDecoder.clear && videoDecoder.clear();\n wcsVideoDecoder.reset && wcsVideoDecoder.reset();\n this.firstTimestamp = null;\n this.startTimestamp = null;\n this.delay = -1;\n this.dropping = false;\n\n if (this.webglObj) {\n this.webglObj.destroy();\n this.offscreenCanvas = null;\n this.offscreenCanvasGL = null;\n this.offscreenCanvasCtx = null;\n }\n buffer = [];\n tempAudioBuffer = [];\n delete this.playAudioPlanar;\n delete this.draw;\n },\n pushBuffer: function (bufferData, options) {\n // 音频\n if (options.type === MEDIA_TYPE.audio) {\n buffer.push({\n ts: options.ts,\n payload: bufferData,\n decoder: audioDecoder,\n type: MEDIA_TYPE.audio,\n });\n } else if (options.type === MEDIA_TYPE.video) {\n buffer.push({\n ts: options.ts,\n payload: bufferData,\n decoder: videoDecoder,\n type: MEDIA_TYPE.video,\n isIFrame: options.isIFrame\n });\n }\n }\n };\n var audioDecoder = new Module.AudioDecoder(decoder);\n var videoDecoder = new Module.VideoDecoder(decoder);\n postMessage({cmd: WORKER_SEND_TYPE.init});\n self.onmessage = function (event) {\n var msg = event.data;\n switch (msg.cmd) {\n case WORKER_SEND_TYPE.init:\n try {\n decoder.opt = Object.assign(decoder.opt, JSON.parse(msg.opt));\n } catch (e) {\n\n }\n audioDecoder.sample_rate = msg.sampleRate;\n decoder.init();\n break;\n case WORKER_SEND_TYPE.decode:\n decoder.pushBuffer(msg.buffer, msg.options);\n break;\n case WORKER_SEND_TYPE.audioDecode:\n audioDecoder.decode(msg.buffer, msg.ts);\n break;\n case WORKER_SEND_TYPE.videoDecode:\n videoDecoder.decode(msg.buffer, msg.ts);\n break;\n case WORKER_SEND_TYPE.close:\n decoder.close();\n break;\n case WORKER_SEND_TYPE.updateConfig:\n decoder.opt[msg.key] = msg.value;\n break;\n }\n };\n};\n"],"names":["Module","print","text","console","log","printErr","warn","postMessage","cmd","message","moduleOverrides","Object","assign","thisProgram","ENVIRONMENT_IS_WEB","window","ENVIRONMENT_IS_WORKER","importScripts","ENVIRONMENT_IS_NODE","process","versions","node","ENVIRONMENT_IS_SHELL","Error","scriptDirectory","locateFile","path","read_","readAsync","readBinary","fs","nodePath","requireNodeFS","require","require$$0","dirname","__dirname","require$$1","shell_read","filename","binary","readFileSync","undefined","ret","buffer","Uint8Array","assert","onload","onerror","readFile","err","data","length","replace","arguments_","slice","module","ex","ExitStatus","reason","read","f","readbuffer","setTimeout","scriptArgs","error","self","location","href","document","currentScript","src","indexOf","substr","lastIndexOf","url","xhr","XMLHttpRequest","open","send","responseText","responseType","response","status","out","bind","checkIncomingModuleAPI","legacyModuleProp","quit_","warnOnce","shown","prop","newName","getOwnPropertyDescriptor","defineProperty","configurable","get","abort","ignoredModuleProp","unexportedMessage","sym","isFSSybol","msg","unexportedRuntimeSymbol","unexportedRuntimeFunction","wasmBinary","WebAssembly","wasmMemory","ABORT","condition","UTF8Decoder","TextDecoder","UTF8ArrayToString","heapOrArray","idx","maxBytesToRead","endIdx","endPtr","decode","subarray","str","u0","String","fromCharCode","u1","u2","toString","ch","UTF8ToString","ptr","HEAPU8","stringToUTF8Array","heap","outIdx","maxBytesToWrite","startIdx","i","u","charCodeAt","stringToUTF8","outPtr","lengthBytesUTF8","len","UTF16Decoder","UTF16ToString","maxIdx","HEAPU16","codeUnit","HEAP16","stringToUTF16","startPtr","numCharsToWrite","lengthBytesUTF16","UTF32ToString","utf32","HEAP32","stringToUTF32","trailSurrogate","lengthBytesUTF32","allocateUTF8","size","_malloc","HEAP8","writeAsciiToMemory","dontAddNull","HEAPU32","HEAPF32","HEAPF64","updateGlobalBufferAndViews","buf","Int8Array","Int16Array","Int32Array","Uint16Array","Uint32Array","Float32Array","Float64Array","TOTAL_STACK","INITIAL_MEMORY","prototype","set","wasmTable","writeStackCookie","max","_emscripten_stack_get_end","checkStackCookie","cookie1","cookie2","h16","h8","__ATPRERUN__","__ATINIT__","__ATPOSTRUN__","runtimeInitialized","preRun","addOnPreRun","shift","callRuntimeCallbacks","initRuntime","FS","init","initialized","ignorePermissions","postRun","addOnPostRun","cb","unshift","addOnInit","Math","imul","fround","clz32","trunc","runDependencies","runDependencyWatcher","dependenciesFulfilled","runDependencyTracking","getUniqueRunDependency","id","orig","random","addRunDependency","setInterval","clearInterval","dep","removeRunDependency","callback","what","e","RuntimeError","dataURIPrefix","isDataURI","startsWith","isFileURI","createExportWrapper","name","fixedasm","displayName","asm","apply","arguments","wasmBinaryFile","getBinary","file","getBinaryPromise","fetch","credentials","then","catch","Promise","resolve","reject","createWasm","info","asmLibraryArg","receiveInstance","instance","exports","trueModule","receiveInstantiationResult","result","instantiateArrayBuffer","receiver","instantiate","instantiateAsync","instantiateStreaming","tempDouble","tempI64","callbacks","func","arg","getWasmTableEntry","demangle","demangleAll","regex","x","y","funcPtr","jsStackTrace","stack","setErrNo","value","___errno_location","PATH","isAbs","charAt","splitPath","splitPathRe","exec","normalizeArray","parts","allowAboveRoot","up","last","splice","normalize","isAbsolute","trailingSlash","split","filter","p","join","root","dir","basename","lastSlash","paths","Array","call","join2","l","r","getRandomDevice","crypto","randomBuffer","getRandomValues","crypto_module","require$$2","PATH_FS","resolvedPath","resolvedAbsolute","cwd","TypeError","relative","from","to","trim","arr","start","end","fromParts","toParts","min","samePartsLength","outputParts","push","concat","TTY","ttys","shutdown","register","dev","ops","input","output","registerDevice","stream_ops","stream","tty","rdev","ErrnoError","seekable","close","flush","offset","pos","get_char","bytesRead","timestamp","Date","now","write","put_char","default_tty_ops","BUFSIZE","Buffer","alloc","readSync","stdin","fd","includes","prompt","readline","intArrayFromString","val","default_tty1_ops","zeroMemory","address","fill","alignMemory","alignment","ceil","mmapAlloc","_emscripten_builtin_memalign","MEMFS","ops_table","mount","createNode","parent","mode","isBlkdev","isFIFO","getattr","node_ops","setattr","lookup","mknod","rename","unlink","rmdir","readdir","symlink","llseek","allocate","mmap","msync","link","readlink","chrdev","chrdev_stream_ops","isDir","contents","isFile","usedBytes","isLink","isChrdev","getFileDataAsTypedArray","expandFileStorage","newCapacity","prevCapacity","CAPACITY_DOUBLING_MAX","oldContents","resizeFileStorage","newSize","attr","ino","nlink","uid","gid","atime","mtime","ctime","blksize","blocks","genericErrors","old_node","new_dir","new_name","new_node","lookupNode","entries","key","hasOwnProperty","newname","oldpath","position","canOwn","ArrayBuffer","whence","prot","flags","allocated","byteOffset","mmapFlags","asyncLoad","noRunDep","arrayBuffer","event","ERRNO_MESSAGES","ERRNO_CODES","mounts","devices","streams","nextInode","nameTable","currentPath","filesystems","syncFSRequests","lookupPath","opts","defaults","follow_mount","recurse_count","current","current_path","islast","isMountpoint","mounted","follow","count","getPath","isRoot","mountpoint","hashName","parentid","hash","hashAddNode","name_next","hashRemoveNode","errCode","mayLookup","nodeName","FSNode","destroyNode","isSocket","flagModes","modeStringToFlags","flagsToPermissionString","flag","perms","nodePermissions","mayCreate","mayDelete","isdir","errno","mayOpen","MAX_OPEN_FDS","nextfd","fd_start","fd_end","getStream","createStream","FSStream","shared","object","isRead","isWrite","isAppend","function","closeStream","device","getDevice","major","minor","makedev","ma","mi","getMounts","check","m","pop","syncfs","populate","completed","doCallback","done","errored","forEach","type","pseudo","mountRoot","unmount","keys","next","create","mkdir","mkdirTree","dirs","d","mkdev","newpath","old_path","new_path","old_dirname","new_dirname","old_name","old_dir","stat","dontFollow","lstat","chmod","lchmod","fchmod","chown","lchown","fchown","truncate","ftruncate","utime","created","ungotten","readFiles","isClosed","getdents","seeking","bytesWritten","munmap","ioctl","encoding","writeFile","actualNumBytes","isView","byteLength","chdir","createDefaultDirectories","createDefaultDevices","random_device","createDevice","createSpecialDirectories","proc_self","createStandardStreams","stdout","stderr","ensureErrnoError","setErrno","code","writable","constructor","staticInit","quit","___stdio_exit","getMode","canRead","canWrite","findObject","dontResolveLastLink","analyzePath","exists","parentExists","parentPath","parentObject","createPath","reverse","part","createFile","properties","createDataFile","forceLoadFile","obj","isDevice","isFolder","createLazyFile","LazyUint8Array","lengthKnown","chunks","LazyUint8Array_get","chunkOffset","chunkSize","chunkNum","getter","setDataGetter","LazyUint8Array_setDataGetter","cacheLength","LazyUint8Array_cacheLength","datalength","Number","getResponseHeader","header","hasByteServing","usesGzip","doXHR","setRequestHeader","overrideMimeType","lazyArray","_length","_chunkSize","defineProperties","fn","forceLoadLazyFile","createPreloadedFile","dontCreateFile","preFinish","fullname","processData","byteArray","finish","Browser","handledByPreloadPlugin","indexedDB","mozIndexedDB","webkitIndexedDB","msIndexedDB","DB_NAME","pathname","DB_VERSION","DB_STORE_NAME","saveFilesToDB","openRequest","onupgradeneeded","db","createObjectStore","onsuccess","transaction","files","objectStore","ok","fail","total","putRequest","put","loadFilesFromDB","getRequest","absolutePath","createFolder","createLink","joinPath","standardizePath","SYSCALLS","DEFAULT_POLLMASK","calculateAt","dirfd","allowEmpty","dirstream","doStat","abs","floor","getTime","doMsync","addr","doMknod","doReadlink","bufsize","endChar","doAccess","amode","doReadv","iov","iovcnt","curr","doWritev","varargs","getStr","getStreamFromFD","___syscall_fcntl64","newStream","___syscall_openat","__embind_register_bigint","primitiveType","minRange","maxRange","getShiftFromSize","embind_init_charCodes","codes","embind_charCodes","readLatin1String","c","awaitingDependencies","registeredTypes","typeDependencies","char_0","char_9","makeLegalFunctionName","createNamedFunction","body","Function","extendError","baseErrorType","errorName","errorClass","BindingError","throwBindingError","InternalError","throwInternalError","whenDependentTypesAreResolved","myTypes","dependentTypes","getTypeConverters","onComplete","typeConverters","myTypeConverters","registerType","unregisteredTypes","registered","dt","rawType","registeredInstance","options","ignoreDuplicateRegistrations","__embind_register_bool","trueValue","falseValue","wt","destructors","o","pointer","destructorFunction","ClassHandle_isAliasOf","other","ClassHandle","leftClass","$$","ptrType","registeredClass","left","rightClass","right","baseClass","upcast","shallowCopyInternalPointer","deleteScheduled","preservePointerOnDelete","smartPtr","smartPtrType","throwInstanceAlreadyDeleted","getInstanceTypeName","handle","finalizationRegistry","detachFinalizer","runDestructor","rawDestructor","releaseClassHandle","toDelete","downcastPointer","ptrClass","desiredClass","rv","downcast","registeredPointers","getInheritedInstanceCount","registeredInstances","getLiveInheritedInstances","k","deletionQueue","flushPendingDeletes","delayFunction","setDelayFunction","init_embind","getBasestPointer","class_","getInheritedInstance","makeClassHandle","record","hasSmartPtrType","hasSmartPtr","attachFinalizer","RegisteredPointer_fromWireType","rawPointer","getPointee","destructor","makeDefaultHandle","isSmartPointer","instancePrototype","pointeeType","actualType","getActualType","registeredPointerRecord","toType","isConst","constPointerType","pointerType","dp","FinalizationRegistry","leakWarning","cls","captureStackTrace","unregister","ClassHandle_clone","clone","getPrototypeOf","ClassHandle_delete","ClassHandle_isDeleted","ClassHandle_deleteLater","init_ClassHandle","ensureOverloadTable","proto","methodName","humanName","overloadTable","prevFunc","argCount","exposePublicSymbol","numArguments","RegisteredClass","pureVirtualFunctions","upcastPointer","constNoSmartPtrRawPointerToWireType","isReference","_embind_repr","handleClass","genericPointerToWireType","rawConstructor","sharingPolicy","clonedHandle","rawShare","Emval","toHandle","nonConstNoSmartPtrRawPointerToWireType","simpleReadValueFromPointer","RegisteredPointer_getPointee","rawGetPointee","RegisteredPointer_destructor","RegisteredPointer_deleteObject","init_RegisteredPointer","RegisteredPointer","replacePublicSymbol","dynCallLegacy","sig","args","substring","dynCall","getDynCaller","argCache","embind__requireFunction","signature","rawFunction","makeDynCaller","fp","UnboundTypeError","getTypeName","___getTypeName","_free","throwUnboundTypeError","types","unboundTypes","seen","visit","map","__embind_register_class","rawPointerType","rawConstPointerType","baseClassRawType","getActualTypeSignature","upcastSignature","downcastSignature","destructorSignature","legalFunctionName","base","basePrototype","constructor_body","referenceConverter","pointerConverter","constPointerConverter","heap32VectorToArray","firstElement","array","runDestructors","del","__embind_register_class_constructor","rawClassType","rawArgTypesAddr","invokerSignature","invoker","rawArgTypes","classType","argTypes","craftInvokerFunction","new_","argumentList","dummy","cppInvokerFunc","cppTargetFunc","isClassMethodFunc","needsDestructorStack","returns","argsList","argsListWired","invokerFnBody","dtorStack","args1","args2","paramName","invokerFunction","__embind_register_class_function","rawInvoker","context","isPureVirtual","Symbol","unboundTypesHandler","method","className","memberFunction","validateThis","this_","__embind_register_class_property","fieldName","getterReturnType","getterSignature","getterContext","setterArgumentType","setterSignature","setter","setterContext","desc","enumerable","v","emval_free_list","emval_handle_array","__emval_decref","refcount","count_emval_handles","get_first_emval","init_emval","toValue","__embind_register_emval","t","floatReadValueFromPointer","__embind_register_float","integerReadValueFromPointer","signed","readS8FromPointer","readU8FromPointer","readS16FromPointer","readU16FromPointer","readS32FromPointer","readU32FromPointer","__embind_register_integer","fromWireType","bitshift","isUnsignedType","checkAssertions","toTypeName","toWireType","__embind_register_memory_view","dataTypeIndex","typeMapping","TA","decodeMemoryView","__embind_register_std_string","stdStringIsUTF8","decodeStartPtr","currentBytePtr","maxRead","stringSegment","a","getLength","valueIsOfTypeString","Uint8ClampedArray","charCode","__embind_register_std_wstring","charSize","decodeString","encodeString","getHeap","lengthBytesUTF","HEAP","maxReadBytes","__embind_register_void","isVoid","__emscripten_date_now","requireRegisteredType","impl","__emval_as","returnType","destructorsRef","rd","emval_symbols","getStringOrSymbol","symbol","emval_methodCallers","__emval_call_void_method","caller","__emval_addMethodCaller","__emval_lookupTypes","emval_registeredMethods","__emval_get_method_caller","retType","signatureName","returnId","params","functionName","functionBody","__emval_incref","__emval_run_destructors","__emval_take_value","argv","__gmtime_js","time","tmPtr","date","getUTCSeconds","getUTCMinutes","getUTCHours","getUTCDate","getUTCMonth","getUTCFullYear","getUTCDay","UTC","yday","__localtime_js","getSeconds","getMinutes","getHours","getDate","getMonth","getFullYear","getDay","getTimezoneOffset","summerOffset","winterOffset","dst","__mktime_js","guessedOffset","dstOffset","nonDstOffset","trueOffset","setTime","_tzset_impl","timezone","daylight","tzname","currentYear","winter","summer","stdTimezoneOffset","extractZone","match","toTimeString","winterName","summerName","winterNamePtr","summerNamePtr","__tzset_js","called","_abort","reallyNegative","Infinity","convertI32PairToI53","lo","hi","convertU32PairToI53","reSign","bits","half","pow","unSign","formatString","format","textIndex","argIndex","prepVararg","getNextArg","currArg","startTextIndex","flagAlwaysSigned","flagLeftAlign","flagAlternative","flagZeroPad","flagPadSign","flagsLoop","width","precisionSet","precision","precisionChr","argSize","nextNext","argText","limit","currAbsArg","prefix","parseInt","toUpperCase","chr","isNaN","isFinite","isGeneral","effectivePrecision","exponent","toExponential","test","toFixed","argLength","_strlen","traverseStack","callee","funcname","first","_emscripten_get_callstack_js","callstack","iThisFunc","iThisFunc2","iNextLine","emscripten_source_map","stack_args","lines","newFirefoxRe","RegExp","firefoxRe","chromeRe","line","symbolName","lineno","column","haveSourceMap","originalPositionFor","source","_emscripten_log_js","debug","_emscripten_log","_emscripten_get_heap_max","emscripten_realloc_buffer","grow","_emscripten_resize_heap","requestedSize","oldSize","maxHeapSize","alignUp","multiple","cutDown","overGrownHeapSize","replacement","ENV","getExecutableName","getEnvStrings","strings","lang","navigator","languages","env","_environ_get","__environ","environ_buf","bufSize","string","_environ_sizes_get","penviron_count","penviron_buf_size","_fd_close","_fd_fdstat_get","pbuf","_fd_read","pnum","num","_fd_seek","offset_low","offset_high","newOffset","HIGH_OFFSET","DOUBLE_LIMIT","_fd_write","_setTempRet0","readMode","writeMode","stringy","u8array","numBytesWritten","_emscripten_stack_init","calledRun","runCaller","run","stackCheckInit","doRun","gl","openWebglAlignment","vertexShaderScript","fragmentShaderScript","pixelStorei","UNPACK_ALIGNMENT","vertexShader","createShader","VERTEX_SHADER","shaderSource","compileShader","getShaderParameter","COMPILE_STATUS","getShaderInfoLog","fragmentShader","FRAGMENT_SHADER","program","createProgram","attachShader","linkProgram","getProgramParameter","LINK_STATUS","getProgramInfoLog","useProgram","vertexPosBuffer","createBuffer","bindBuffer","ARRAY_BUFFER","bufferData","STATIC_DRAW","vertexPosRef","getAttribLocation","enableVertexAttribArray","vertexAttribPointer","FLOAT","texturePosBuffer","texturePosRef","_initTexture","index","textureRef","createTexture","bindTexture","TEXTURE_2D","texParameteri","TEXTURE_MAG_FILTER","LINEAR","TEXTURE_MIN_FILTER","TEXTURE_WRAP_S","CLAMP_TO_EDGE","TEXTURE_WRAP_T","uniform1i","getUniformLocation","yTextureRef","uTextureRef","vTextureRef","render","w","h","viewport","activeTexture","TEXTURE0","texImage2D","LUMINANCE","UNSIGNED_BYTE","TEXTURE1","TEXTURE2","drawArrays","TRIANGLE_STRIP","destroy","deleteProgram","deleteBuffer","deleteTexture","PLAYER_PLAY_PROTOCOL","websocket","webrtc","DEMUX_TYPE","flv","m7s","FILE_SUFFIX","mp4","webm","DEFAULT_PLAYER_OPTIONS","videoBuffer","videoBufferDelay","isResize","isFullResize","isFlv","hotKey","loadingTimeout","heartTimeout","timeout","loadingTimeoutReplay","heartTimeoutReplay","loadingTimeoutReplayTimes","heartTimeoutReplayTimes","supportDblclickFullscreen","showBandwidth","keepScreenOn","isNotMute","hasAudio","hasVideo","operateBtns","fullscreen","screenshot","play","audio","controlAutoHide","hasControl","loadingText","background","decoder","rotate","forceNoOffscreen","hiddenAutoPause","protocol","demuxType","useWCS","wcsUseVideoRender","useMSE","useOffscreen","autoWasm","wasmDecodeErrorReplay","wasmDecodeAudioSyncVideo","recordType","useWebFullScreen","WORKER_CMD_TYPE","initVideo","playAudio","initAudio","kBps","audioCode","videoCode","wasmError","MEDIA_TYPE","video","WORKER_SEND_TYPE","audioDecode","videoDecode","updateConfig","ENCODED_VIDEO_TYPE","delta","of","Instance","formatVideoDecoderConfigure","avcC","codecArray","codecString","j","codec","description","tempAudioBuffer","wcsVideoDecoder","hasInit","isEmitInfo","offscreenCanvas","offscreenCanvasCtx","VideoDecoder","videoFrame","opt","codedWidth","codedHeight","OffscreenCanvas","getContext","drawImage","image_bitmap","transferToImageBitmap","delay","ts","payload","isIFrame","videoCodec","setVideoCodec","config","configure","chunk","EncodedVideoChunk","reset","initAudioPlanar","channels","samplerate","sampleRate","outputArray","remain","playAudioPlanar","frameCount","origin","channel","setAudioCodec","setVideoSize","qsize","offscreenCanvasGL","webglObj","createWebGL","draw","yData","uData","vData","getDelay","firstTimestamp","startTimestamp","localTimestamp","timeTimestamp","resetDelay","_doDecode","loop","dropping","stopId","audioDecoder","clear","videoDecoder","pushBuffer","AudioDecoder","onmessage","JSON","parse","sample_rate"],"mappings":";;;;;;;;;;;;;;;;;;;;;CAAA,MAAIA,MAAM,GAAC,OAAOA,MAAP,IAAe,WAAf,GAA2BA,MAA3B,GAAkC,EAA7C;CAAgD,MAAIA,MAAM,GAAC,EAAX;;CAAcA,EAAAA,MAAM,CAACC,KAAP,GAAa,UAASC,IAAT,EAAc;CAACC,IAAAA,OAAO,CAACC,GAAR,CAAY,sBAAZ,EAAmCF,IAAnC;CAAyC,GAArE;;CAAsEF,EAAAA,MAAM,CAACK,QAAP,GAAgB,UAASH,IAAT,EAAc;CAACC,IAAAA,OAAO,CAACG,IAAR,CAAa,sBAAb,EAAoCJ,IAApC;CAA0CK,IAAAA,WAAW,CAAC;CAACC,MAAAA,GAAG,EAAC,WAAL;CAAiBC,MAAAA,OAAO,EAACP;CAAzB,KAAD,CAAX;CAA4C,GAArH;;CAAsH,MAAIQ,eAAe,GAACC,MAAM,CAACC,MAAP,CAAc,EAAd,EAAiBZ,MAAjB,CAApB;CAA+D,MAAIa,WAAW,GAAC,gBAAhB;;CAA6E,MAAIC,kBAAkB,GAAC,OAAOC,MAAP,IAAe,QAAtC;CAA+C,MAAIC,qBAAqB,GAAC,OAAOC,aAAP,IAAsB,UAAhD;CAA2D,MAAIC,mBAAmB,GAAC,OAAOC,OAAP,IAAgB,QAAhB,IAA0B,OAAOA,OAAO,CAACC,QAAf,IAAyB,QAAnD,IAA6D,OAAOD,OAAO,CAACC,QAAR,CAAiBC,IAAxB,IAA8B,QAAnH;CAA4H,MAAIC,oBAAoB,GAAC,CAACR,kBAAD,IAAqB,CAACI,mBAAtB,IAA2C,CAACF,qBAArE;;CAA2F,MAAGhB,MAAM,CAAC,aAAD,CAAT,EAAyB;CAAC,UAAM,IAAIuB,KAAJ,CAAU,kKAAV,CAAN;CAAoL;;CAAA,MAAIC,eAAe,GAAC,EAApB;;CA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,gBAAgB,CAAC5+B,KAAtB;CACIm9B,QAAAA,SAAO,CAACn9B,KAAR;CACA;;CACJ,WAAK4+B,gBAAgB,CAACG,YAAtB;CACI5B,QAAAA,SAAO,CAACgD,GAAR,CAAY7vC,GAAG,CAACmV,GAAhB,IAAuBnV,GAAG,CAACmL,KAA3B;CACA;CAxBR;CA0BH,GA5BD;CA6BH,CApWD;;;;;;"} \ No newline at end of file +{"version":3,"file":"decoder.js","sources":["../../src/decoder/decoder.js","../../src/utils/webgl.js","../../src/constant/index.js","../../node_modules/screenfull/dist/screenfull.js","../../src/utils/index.js","../../src/worker.js"],"sourcesContent":["var Module=typeof Module!=\"undefined\"?Module:{};var Module={};Module.print=function(text){console.log(\"Jessibuca: [worker]:\",text)};Module.printErr=function(text){console.warn(\"Jessibuca: [worker]:\",text);postMessage({cmd:\"wasmError\",message:text})};var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram=\"./this.program\";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window==\"object\";var ENVIRONMENT_IS_WORKER=typeof importScripts==\"function\";var ENVIRONMENT_IS_NODE=typeof process==\"object\"&&typeof process.versions==\"object\"&&typeof process.versions.node==\"string\";var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(Module[\"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 scriptDirectory=\"\";function locateFile(path){if(Module[\"locateFile\"]){return Module[\"locateFile\"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;if(e&&typeof e==\"object\"&&e.stack){toLog=[e,e.stack]}err(\"exiting due to exception: \"+toLog)}var fs;var nodePath;var requireNodeFS;if(ENVIRONMENT_IS_NODE){if(!(typeof process==\"object\"&&typeof require==\"function\"))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?)\");if(ENVIRONMENT_IS_WORKER){scriptDirectory=require(\"path\").dirname(scriptDirectory)+\"/\"}else{scriptDirectory=__dirname+\"/\"}requireNodeFS=(()=>{if(!nodePath){fs=require(\"fs\");nodePath=require(\"path\")}});read_=function shell_read(filename,binary){requireNodeFS();filename=nodePath[\"normalize\"](filename);return fs.readFileSync(filename,binary?undefined:\"utf8\")};readBinary=(filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret});readAsync=((filename,onload,onerror)=>{requireNodeFS();filename=nodePath[\"normalize\"](filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})});if(process[\"argv\"].length>1){thisProgram=process[\"argv\"][1].replace(/\\\\/g,\"/\")}arguments_=process[\"argv\"].slice(2);if(typeof module!=\"undefined\"){module[\"exports\"]=Module}process[\"on\"](\"uncaughtException\",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process[\"on\"](\"unhandledRejection\",function(reason){throw reason});quit_=((status,toThrow)=>{if(keepRuntimeAlive()){process[\"exitCode\"]=status;throw toThrow}logExceptionOnExit(toThrow);process[\"exit\"](status)});Module[\"inspect\"]=function(){return\"[Emscripten Module object]\"}}else if(ENVIRONMENT_IS_SHELL){if(typeof process==\"object\"&&typeof require===\"function\"||typeof window==\"object\"||typeof importScripts==\"function\")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?)\");if(typeof read!=\"undefined\"){read_=function shell_read(f){return read(f)}}readBinary=function readBinary(f){let data;if(typeof readbuffer==\"function\"){return new Uint8Array(readbuffer(f))}data=read(f,\"binary\");assert(typeof data==\"object\");return data};readAsync=function readAsync(f,onload,onerror){setTimeout(()=>onload(readBinary(f)),0)};if(typeof scriptArgs!=\"undefined\"){arguments_=scriptArgs}else if(typeof arguments!=\"undefined\"){arguments_=arguments}if(typeof quit==\"function\"){quit_=((status,toThrow)=>{logExceptionOnExit(toThrow);quit(status)})}if(typeof print!=\"undefined\"){if(typeof console==\"undefined\")console={};console.log=print;console.warn=console.error=typeof printErr!=\"undefined\"?printErr:print}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!=\"undefined\"&&document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.indexOf(\"blob:\")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,\"\").lastIndexOf(\"/\")+1)}else{scriptDirectory=\"\"}if(!(typeof window==\"object\"||typeof importScripts==\"function\"))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?)\");{read_=(url=>{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.send(null);return xhr.responseText});if(ENVIRONMENT_IS_WORKER){readBinary=(url=>{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);xhr.responseType=\"arraybuffer\";xhr.send(null);return new Uint8Array(xhr.response)})}readAsync=((url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,true);xhr.responseType=\"arraybuffer\";xhr.onload=(()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()});xhr.onerror=onerror;xhr.send(null)})}setWindowTitle=(title=>document.title=title)}else{throw new Error(\"environment detection error\")}var out=Module[\"print\"]||console.log.bind(console);var err=Module[\"printErr\"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;checkIncomingModuleAPI();if(Module[\"arguments\"])arguments_=Module[\"arguments\"];legacyModuleProp(\"arguments\",\"arguments_\");if(Module[\"thisProgram\"])thisProgram=Module[\"thisProgram\"];legacyModuleProp(\"thisProgram\",\"thisProgram\");if(Module[\"quit\"])quit_=Module[\"quit\"];legacyModuleProp(\"quit\",\"quit_\");assert(typeof Module[\"memoryInitializerPrefixURL\"]==\"undefined\",\"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"pthreadMainPrefixURL\"]==\"undefined\",\"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"cdInitializerPrefixURL\"]==\"undefined\",\"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"filePackagePrefixURL\"]==\"undefined\",\"Module.filePackagePrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"read\"]==\"undefined\",\"Module.read option was removed (modify read_ in JS)\");assert(typeof Module[\"readAsync\"]==\"undefined\",\"Module.readAsync option was removed (modify readAsync in JS)\");assert(typeof Module[\"readBinary\"]==\"undefined\",\"Module.readBinary option was removed (modify readBinary in JS)\");assert(typeof Module[\"setWindowTitle\"]==\"undefined\",\"Module.setWindowTitle option was removed (modify setWindowTitle in JS)\");assert(typeof Module[\"TOTAL_MEMORY\"]==\"undefined\",\"Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY\");legacyModuleProp(\"read\",\"read_\");legacyModuleProp(\"readAsync\",\"readAsync\");legacyModuleProp(\"readBinary\",\"readBinary\");legacyModuleProp(\"setWindowTitle\",\"setWindowTitle\");assert(!ENVIRONMENT_IS_SHELL,\"shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable.\");var POINTER_SIZE=4;function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;err(text)}}function uleb128Encode(n){assert(n<16384);if(n<128){return[n]}return[n%128|128,n>>7]}function convertJsFunctionToWasm(func,sig){if(typeof WebAssembly.Function==\"function\"){var typeNames={\"i\":\"i32\",\"j\":\"i64\",\"f\":\"f32\",\"d\":\"f64\"};var type={parameters:[],results:sig[0]==\"v\"?[]:[typeNames[sig[0]]]};for(var i=1;iabort(unexportedMessage(sym,isFSSybol)))}}var tempRet0=0;var setTempRet0=value=>{tempRet0=value};var wasmBinary;if(Module[\"wasmBinary\"])wasmBinary=Module[\"wasmBinary\"];legacyModuleProp(\"wasmBinary\",\"wasmBinary\");var noExitRuntime=Module[\"noExitRuntime\"]||true;legacyModuleProp(\"noExitRuntime\",\"noExitRuntime\");if(typeof WebAssembly!=\"object\"){abort(\"no native wasm support detected\")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(\"Assertion failed\"+(text?\": \"+text:\"\"))}}function getCFunc(ident){var func=Module[\"_\"+ident];assert(func,\"Cannot call unknown function \"+ident+\", make sure it is exported\");return func}function ccall(ident,returnType,argTypes,args,opts){var toC={\"string\":function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},\"array\":function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType===\"string\")return UTF8ToString(ret);if(returnType===\"boolean\")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;assert(returnType!==\"array\",'Return type should not be \"array\".');if(args){for(var i=0;i=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}else{var str=\"\";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):\"\"}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;if(u>1114111)warnOnce(\"Invalid Unicode code point 0x\"+u.toString(16)+\" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).\");heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){assert(typeof maxBytesToWrite==\"number\",\"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!\");return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}var UTF16Decoder=typeof TextDecoder!=\"undefined\"?new TextDecoder(\"utf-16le\"):undefined;function UTF16ToString(ptr,maxBytesToRead){assert(ptr%2==0,\"Pointer passed to UTF16ToString must be aligned to two bytes!\");var endPtr=ptr;var idx=endPtr>>1;var maxIdx=idx+maxBytesToRead/2;while(!(idx>=maxIdx)&&HEAPU16[idx])++idx;endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder){return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr))}else{var str=\"\";for(var i=0;!(i>=maxBytesToRead/2);++i){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit)}return str}}function stringToUTF16(str,outPtr,maxBytesToWrite){assert(outPtr%2==0,\"Pointer passed to stringToUTF16 must be aligned to two bytes!\");assert(typeof maxBytesToWrite==\"number\",\"stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!\");if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr}function lengthBytesUTF16(str){return str.length*2}function UTF32ToString(ptr,maxBytesToRead){assert(ptr%4==0,\"Pointer passed to UTF32ToString must be aligned to four bytes!\");var i=0;var str=\"\";while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)break;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}else{str+=String.fromCharCode(utf32)}}return str}function stringToUTF32(str,outPtr,maxBytesToWrite){assert(outPtr%4==0,\"Pointer passed to stringToUTF32 must be aligned to four bytes!\");assert(typeof maxBytesToWrite==\"number\",\"stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!\");if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr}function lengthBytesUTF32(str){var len=0;for(var i=0;i=55296&&codeUnit<=57343)++i;len+=4}return len}function allocateUTF8(str){var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8Array(str,HEAP8,ret,size);return ret}function writeArrayToMemory(array,buffer){assert(array.length>=0,\"writeArrayToMemory array must have a length (should be an array or typed array)\");HEAP8.set(array,buffer)}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module[\"HEAP8\"]=HEAP8=new Int8Array(buf);Module[\"HEAP16\"]=HEAP16=new Int16Array(buf);Module[\"HEAP32\"]=HEAP32=new Int32Array(buf);Module[\"HEAPU8\"]=HEAPU8=new Uint8Array(buf);Module[\"HEAPU16\"]=HEAPU16=new Uint16Array(buf);Module[\"HEAPU32\"]=HEAPU32=new Uint32Array(buf);Module[\"HEAPF32\"]=HEAPF32=new Float32Array(buf);Module[\"HEAPF64\"]=HEAPF64=new Float64Array(buf)}var TOTAL_STACK=5242880;if(Module[\"TOTAL_STACK\"])assert(TOTAL_STACK===Module[\"TOTAL_STACK\"],\"the stack size can no longer be determined at runtime\");var INITIAL_MEMORY=Module[\"INITIAL_MEMORY\"]||67108864;legacyModuleProp(\"INITIAL_MEMORY\",\"INITIAL_MEMORY\");assert(INITIAL_MEMORY>=TOTAL_STACK,\"INITIAL_MEMORY should be larger than TOTAL_STACK, was \"+INITIAL_MEMORY+\"! (TOTAL_STACK=\"+TOTAL_STACK+\")\");assert(typeof Int32Array!=\"undefined\"&&typeof Float64Array!==\"undefined\"&&Int32Array.prototype.subarray!=undefined&&Int32Array.prototype.set!=undefined,\"JS engine does not provide full typed array support\");assert(!Module[\"wasmMemory\"],\"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally\");assert(INITIAL_MEMORY==67108864,\"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically\");var wasmTable;function writeStackCookie(){var max=_emscripten_stack_get_end();assert((max&3)==0);HEAP32[max>>2]=34821223;HEAP32[max+4>>2]=2310721022;HEAP32[0]=1668509029}function checkStackCookie(){if(ABORT)return;var max=_emscripten_stack_get_end();var cookie1=HEAPU32[max>>2];var cookie2=HEAPU32[max+4>>2];if(cookie1!=34821223||cookie2!=2310721022){abort(\"Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x\"+cookie2.toString(16)+\" 0x\"+cookie1.toString(16))}if(HEAP32[0]!==1668509029)abort(\"Runtime error: The application has corrupted its heap memory area (address zero)!\")}(function(){var h16=new Int16Array(1);var h8=new Int8Array(h16.buffer);h16[0]=25459;if(h8[0]!==115||h8[1]!==99)throw\"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)\"})();var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}function preRun(){if(Module[\"preRun\"]){if(typeof Module[\"preRun\"]==\"function\")Module[\"preRun\"]=[Module[\"preRun\"]];while(Module[\"preRun\"].length){addOnPreRun(Module[\"preRun\"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){checkStackCookie();assert(!runtimeInitialized);runtimeInitialized=true;if(!Module[\"noFSInit\"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();callRuntimeCallbacks(__ATINIT__)}function postRun(){checkStackCookie();if(Module[\"postRun\"]){if(typeof Module[\"postRun\"]==\"function\")Module[\"postRun\"]=[Module[\"postRun\"]];while(Module[\"postRun\"].length){addOnPostRun(Module[\"postRun\"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}assert(Math.imul,\"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill\");assert(Math.fround,\"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill\");assert(Math.clz32,\"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill\");assert(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 runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;var runDependencyTracking={};function getUniqueRunDependency(id){var orig=id;while(1){if(!runDependencyTracking[id])return id;id=orig+Math.random()}}function addRunDependency(id){runDependencies++;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}if(id){assert(!runDependencyTracking[id]);runDependencyTracking[id]=1;if(runDependencyWatcher===null&&typeof setInterval!=\"undefined\"){runDependencyWatcher=setInterval(function(){if(ABORT){clearInterval(runDependencyWatcher);runDependencyWatcher=null;return}var shown=false;for(var dep in runDependencyTracking){if(!shown){shown=true;err(\"still waiting on run dependencies:\")}err(\"dependency: \"+dep)}if(shown){err(\"(end of list)\")}},1e4)}}else{err(\"warning: run dependency added without ID\")}}function removeRunDependency(id){runDependencies--;if(Module[\"monitorRunDependencies\"]){Module[\"monitorRunDependencies\"](runDependencies)}if(id){assert(runDependencyTracking[id]);delete runDependencyTracking[id]}else{err(\"warning: run dependency removed without ID\")}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){{if(Module[\"onAbort\"]){Module[\"onAbort\"](what)}}what=\"Aborted(\"+what+\")\";err(what);ABORT=true;EXITSTATUS=1;var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix=\"data:application/octet-stream;base64,\";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith(\"file://\")}function createExportWrapper(name,fixedasm){return function(){var displayName=name;var asm=fixedasm;if(!fixedasm){asm=Module[\"asm\"]}assert(runtimeInitialized,\"native function `\"+displayName+\"` called before runtime initialization\");if(!asm[name]){assert(asm[name],\"exported native function `\"+displayName+\"` not found\")}return asm[name].apply(null,arguments)}}var wasmBinaryFile;wasmBinaryFile=\"decoder.wasm\";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}else{throw\"both async and sync fetching of the wasm failed\"}}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch==\"function\"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){if(!response[\"ok\"]){throw\"failed to load wasm binary file at '\"+wasmBinaryFile+\"'\"}return response[\"arrayBuffer\"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={\"env\":asmLibraryArg,\"wasi_snapshot_preview1\":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module[\"asm\"]=exports;wasmMemory=Module[\"asm\"][\"memory\"];assert(wasmMemory,\"memory not found in wasm exports\");updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module[\"asm\"][\"__indirect_function_table\"];assert(wasmTable,\"table not found in wasm exports\");addOnInit(Module[\"asm\"][\"__wasm_call_ctors\"]);removeRunDependency(\"wasm-instantiate\")}addRunDependency(\"wasm-instantiate\");var trueModule=Module;function receiveInstantiationResult(result){assert(Module===trueModule,\"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?\");trueModule=null;receiveInstance(result[\"instance\"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err(\"failed to asynchronously prepare wasm: \"+reason);if(isFileURI(wasmBinaryFile)){err(\"warning: Loading from a file URI (\"+wasmBinaryFile+\") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing\")}abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming==\"function\"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch==\"function\"){return fetch(wasmBinaryFile,{credentials:\"same-origin\"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err(\"wasm streaming compile failed: \"+reason);err(\"falling back to ArrayBuffer instantiation\");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module[\"instantiateWasm\"]){try{var exports=Module[\"instantiateWasm\"](info,receiveInstance);return exports}catch(e){err(\"Module.instantiateWasm callback failed with error: \"+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback==\"function\"){callback(Module);continue}var func=callback.func;if(typeof func==\"number\"){if(callback.arg===undefined){getWasmTableEntry(func)()}else{getWasmTableEntry(func)(callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}function demangle(func){warnOnce(\"warning: build with -sDEMANGLE_SUPPORT to link in libcxxabi demangling\");return func}function demangleAll(text){var regex=/\\b_Z[\\w\\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+\" [\"+x+\"]\"})}function getWasmTableEntry(funcPtr){return wasmTable.get(funcPtr)}function jsStackTrace(){var error=new Error;if(!error.stack){try{throw new Error}catch(e){error=e}if(!error.stack){return\"(no stack trace available)\"}}return error.stack.toString()}function setWasmTableEntry(idx,func){wasmTable.set(idx,func)}function setErrNo(value){HEAP32[___errno_location()>>2]=value;return value}var PATH={isAbs:path=>path.charAt(0)===\"/\",splitPath:filename=>{var splitPathRe=/^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last===\".\"){parts.splice(i,1)}else if(last===\"..\"){parts.splice(i,1);up++}else if(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)===\"/\";path=PATH.normalizeArray(path.split(\"/\").filter(p=>!!p),!isAbsolute).join(\"/\");if(!path&&!isAbsolute){path=\".\"}if(path&&trailingSlash){path+=\"/\"}return(isAbsolute?\"/\":\"\")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return\".\"}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:path=>{if(path===\"/\")return\"/\";path=PATH.normalize(path);path=path.replace(/\\/$/,\"\");var lastSlash=path.lastIndexOf(\"/\");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},join:function(){var paths=Array.prototype.slice.call(arguments,0);return PATH.normalize(paths.join(\"/\"))},join2:(l,r)=>{return PATH.normalize(l+\"/\"+r)}};function getRandomDevice(){if(typeof crypto==\"object\"&&typeof crypto[\"getRandomValues\"]==\"function\"){var randomBuffer=new Uint8Array(1);return function(){crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require(\"crypto\");return function(){return crypto_module[\"randomBytes\"](1)[0]}}catch(e){}}return function(){abort(\"no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };\")}}var PATH_FS={resolve:function(){var resolvedPath=\"\",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!=\"string\"){throw new TypeError(\"Arguments to path.resolve must be strings\")}else if(!path){return\"\"}resolvedPath=path+\"/\"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split(\"/\").filter(p=>!!p),!resolvedAbsolute).join(\"/\");return(resolvedAbsolute?\"/\":\"\")+resolvedPath||\".\"},relative:(from,to)=>{from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!==\"\")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split(\"/\"));var toParts=trim(to.split(\"/\"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i0){result=buf.slice(0,bytesRead).toString(\"utf-8\")}else{result=null}}else if(typeof window!=\"undefined\"&&typeof window.prompt==\"function\"){result=window.prompt(\"Input: \");if(result!==null){result+=\"\\n\"}}else if(typeof readline==\"function\"){result=readline();if(result!==null){result+=\"\\n\"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()},put_char:function(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function zeroMemory(address,size){HEAPU8.fill(0,address,address+size)}function alignMemory(size,alignment){assert(alignment,\"alignment argument is required\");return Math.ceil(size/alignment)*alignment}function mmapAlloc(size){size=alignMemory(size,65536);var ptr=_emscripten_builtin_memalign(65536,size);if(!ptr)return 0;zeroMemory(ptr,size);return ptr}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,\"/\",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage:function(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage:function(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr:function(node){var attr={};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;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{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);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(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:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[\".\",\"..\"];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(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);assert(size>=0);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{path=PATH_FS.resolve(FS.cwd(),path);if(!path)return{path:\"\",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=PATH.normalizeArray(path.split(\"/\").filter(p=>!!p),false);var current=FS.root;var current_path=\"/\";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!==\"/\"?mount+\"/\"+path:mount+path}path=path?node.name+\"/\"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>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{var current=FS.nameTable[hash];while(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)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];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)=>{assert(typeof parent==\"object\");var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode:node=>{FS.hashRemoveNode(node)},isRoot:node=>{return node===node.parent},isMountpoint:node=>{return!!node.mounted},isFile:mode=>{return(mode&61440)===32768},isDir:mode=>{return(mode&61440)===16384},isLink:mode=>{return(mode&61440)===40960},isChrdev:mode=>{return(mode&61440)===8192},isBlkdev:mode=>{return(mode&61440)===24576},isFIFO:mode=>{return(mode&61440)===4096},isSocket:mode=>{return(mode&49152)===49152},flagModes:{\"r\":0,\"r+\":2,\"w\":577,\"w+\":578,\"a\":1089,\"a+\":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags==\"undefined\"){throw new Error(\"Unknown file open mode: \"+str)}return flags},flagsToPermissionString:flag=>{var perms=[\"r\",\"w\",\"rw\"][flag&3];if(flag&512){perms+=\"w\"}return perms},nodePermissions:(node,perms)=>{if(FS.ignorePermissions){return 0}if(perms.includes(\"r\")&&!(node.mode&292)){return 2}else if(perms.includes(\"w\")&&!(node.mode&146)){return 2}else if(perms.includes(\"x\")&&!(node.mode&73)){return 2}return 0},mayLookup:dir=>{var errCode=FS.nodePermissions(dir,\"x\");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=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}var errCode=FS.nodePermissions(dir,\"wx\");if(errCode){return errCode}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)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!==\"r\"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get function(){return this.shared.position},set:function(val){this.shared.position=val}}}}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return 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;if(stream.stream_ops.open){stream.stream_ops.open(stream)}},llseek:()=>{throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice:(dev,ops)=>{FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts:mount=>{var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate==\"function\"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err(\"warning: \"+FS.syncFSRequests+\" FS.syncfs operations in flight at once, probably just doing extra work\")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){assert(FS.syncFSRequests>0);FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++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)=>{if(typeof type==\"string\"){throw type}var root=mountpoint===\"/\";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount:mountpoint=>{var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(hash=>{var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);assert(idx!==-1);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name===\".\"||name===\"..\"){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree:(path,mode)=>{var dirs=path.split(\"/\");var d=\"\";for(var i=0;i{if(typeof dev==\"undefined\"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink:(oldpath,newpath)=>{if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},rename:(old_path,new_path)=>{var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!==\".\"){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!==\".\"){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.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!==old_dir){errCode=FS.nodePermissions(old_dir,\"w\");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name)}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);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,name);FS.destroyNode(node)},readdir:path=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node.node_ops.readdir){throw new FS.ErrnoError(54)}return node.node_ops.readdir(node)},unlink:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);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,name);FS.destroyNode(node)},readlink:path=>{var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path==\"string\"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chmod(stream.node,mode)},chown:(path,uid,gid,dontFollow)=>{var node;if(typeof path==\"string\"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{timestamp:Date.now()})},lchown:(path,uid,gid)=>{FS.chown(path,uid,gid,true)},fchown:(fd,uid,gid)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chown(stream.node,uid,gid)},truncate:(path,len)=>{if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path==\"string\"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,\"w\");if(errCode){throw new FS.ErrnoError(errCode)}node.node_ops.setattr(node,{size:len,timestamp:Date.now()})},ftruncate:(fd,len)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode,fd_start,fd_end)=>{if(path===\"\"){throw new FS.ErrnoError(44)}flags=typeof flags==\"string\"?FS.modeStringToFlags(flags):flags;mode=typeof mode==\"undefined\"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path==\"object\"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else{node=FS.mknod(path,mode,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node:node,path:FS.getPath(node),flags:flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false},fd_start,fd_end);if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(Module[\"logReadFiles\"]&&!(flags&1)){if(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},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(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return 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((stream.flags&2097155)===1){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=typeof position!=\"undefined\";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},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((stream.flags&2097155)===0){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)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!=\"undefined\";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate:(stream,offset,length)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(offset<0||length<=0){throw new FS.ErrnoError(28)}if((stream.flags&2097155)===0){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,address,length,position,prot,flags)=>{if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}return stream.stream_ops.mmap(stream,address,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream||!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||\"binary\";if(opts.encoding!==\"utf8\"&&opts.encoding!==\"binary\"){throw new Error('Invalid encoding type \"'+opts.encoding+'\"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding===\"utf8\"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding===\"binary\"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data==\"string\"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error(\"Unsupported data type\")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,\"x\");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.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 random_device=getRandomDevice();FS.createDevice(\"/dev\",\"random\",random_device);FS.createDevice(\"/dev\",\"urandom\",random_device);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\",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:\"fake\"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},\"/proc/self/fd\")},createStandardStreams:()=>{if(Module[\"stdin\"]){FS.createDevice(\"/dev\",\"stdin\",Module[\"stdin\"])}else{FS.symlink(\"/dev/tty\",\"/dev/stdin\")}if(Module[\"stdout\"]){FS.createDevice(\"/dev\",\"stdout\",null,Module[\"stdout\"])}else{FS.symlink(\"/dev/tty\",\"/dev/stdout\")}if(Module[\"stderr\"]){FS.createDevice(\"/dev\",\"stderr\",null,Module[\"stderr\"])}else{FS.symlink(\"/dev/tty1\",\"/dev/stderr\")}var stdin=FS.open(\"/dev/stdin\",0);var stdout=FS.open(\"/dev/stdout\",1);var stderr=FS.open(\"/dev/stderr\",1);assert(stdin.fd===0,\"invalid handle for stdin (\"+stdin.fd+\")\");assert(stdout.fd===1,\"invalid handle for stdout (\"+stdout.fd+\")\");assert(stderr.fd===2,\"invalid handle for stderr (\"+stderr.fd+\")\")},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno;for(var key in ERRNO_CODES){if(ERRNO_CODES[key]===errno){this.code=key;break}}};this.setErrno(errno);this.message=ERRNO_MESSAGES[errno];if(this.stack){Object.defineProperty(this,\"stack\",{value:(new Error).stack,writable:true});this.stack=demangleAll(this.stack)}};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=\"\"})},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)=>{assert(!FS.init.initialized,\"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)\");FS.init.initialized=true;FS.ensureErrnoError();Module[\"stdin\"]=input||Module[\"stdin\"];Module[\"stdout\"]=output||Module[\"stdout\"];Module[\"stderr\"]=error||Module[\"stderr\"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;___stdio_exit();for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},findObject:(path,dontResolveLastLink)=>{var ret=FS.analyzePath(path,dontResolveLastLink);if(ret.exists){return ret.object}else{return null}},analyzePath:(path,dontResolveLastLink)=>{try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;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=typeof parent==\"string\"?parent:FS.getPath(parent);var parts=path.split(\"/\").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){}parent=current}return current},createFile:(parent,name,properties,canRead,canWrite)=>{var path=PATH.join2(typeof parent==\"string\"?parent:FS.getPath(parent),name);var mode=FS.getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile:(parent,name,data,canRead,canWrite,canOwn)=>{var path=name;if(parent){parent=typeof parent==\"string\"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS.getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data==\"string\"){var arr=new Array(data.length);for(var i=0,len=data.length;i{var path=PATH.join2(typeof parent==\"string\"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!=\"undefined\"){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.\")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error(\"Cannot load without read() or XMLHttpRequest.\")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open(\"HEAD\",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error(\"Couldn't load \"+url+\". Status: \"+xhr.status);var datalength=Number(xhr.getResponseHeader(\"Content-length\"));var header;var hasByteServing=(header=xhr.getResponseHeader(\"Accept-Ranges\"))&&header===\"bytes\";var usesGzip=(header=xhr.getResponseHeader(\"Content-Encoding\"))&&header===\"gzip\";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)throw new Error(\"invalid range (\"+from+\", \"+to+\") or no bytes requested!\");if(to>datalength-1)throw new Error(\"only \"+datalength+\" bytes available! programmer error!\");var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);if(datalength!==chunkSize)xhr.setRequestHeader(\"Range\",\"bytes=\"+from+\"-\"+to);xhr.responseType=\"arraybuffer\";if(xhr.overrideMimeType){xhr.overrideMimeType(\"text/plain; charset=x-user-defined\")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error(\"Couldn't load \"+url+\". Status: \"+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}else{return intArrayFromString(xhr.responseText||\"\",true)}};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]==\"undefined\"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]==\"undefined\")throw new Error(\"doXHR failed!\");return lazyArray.chunks[chunkNum]});if(usesGzip||!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=true};if(typeof XMLHttpRequest!=\"undefined\"){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;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});stream_ops.read=((stream,buffer,offset,length,position)=>{FS.forceLoadFile(node);var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);assert(size>=0);if(contents.slice){for(var i=0;i{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency(\"cp \"+fullname);function processData(byteArray){function finish(byteArray){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url==\"string\"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return\"EM_FS_\"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:\"FILE_DATA\",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=(()=>{out(\"creating db\");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)});openRequest.onsuccess=(()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],\"readwrite\");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=(()=>{ok++;if(ok+fail==total)finish()});putRequest.onerror=(()=>{fail++;if(ok+fail==total)finish()})});transaction.onerror=onerror});openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=(()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],\"readonly\")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=(()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()});getRequest.onerror=(()=>{fail++;if(ok+fail==total)finish()})});transaction.onerror=onerror});openRequest.onerror=onerror},absolutePath:()=>{abort(\"FS.absolutePath has been removed; use PATH_FS.resolve instead\")},createFolder:()=>{abort(\"FS.createFolder has been removed; use FS.mkdir instead\")},createLink:()=>{abort(\"FS.createLink has been removed; use FS.symlink instead\")},joinPath:()=>{abort(\"FS.joinPath has been removed; use PATH.join instead\")},mmapAlloc:()=>{abort(\"FS.mmapAlloc has been replaced by the top level function mmapAlloc\")},standardizePath:()=>{abort(\"FS.standardizePath has been removed; use PATH.normalize instead\")}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=FS.getStream(dirfd);if(!dirstream)throw new FS.ErrnoError(8);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return PATH.join2(dir,path)},doStat:function(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]=0;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAP32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;HEAP32[buf+32>>2]=0;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;HEAP32[buf+56>>2]=stat.atime.getTime()/1e3|0;HEAP32[buf+60>>2]=0;HEAP32[buf+64>>2]=stat.mtime.getTime()/1e3|0;HEAP32[buf+68>>2]=0;HEAP32[buf+72>>2]=stat.ctime.getTime()/1e3|0;HEAP32[buf+76>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+80>>2]=tempI64[0],HEAP32[buf+84>>2]=tempI64[1];return 0},doMsync:function(addr,stream,len,flags,offset){var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},doMknod:function(path,mode,dev){switch(mode&61440){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-28}FS.mknod(path,mode,dev);return 0},doReadlink:function(path,buf,bufsize){if(bufsize<=0)return-28;var ret=FS.readlink(path);var len=Math.min(bufsize,lengthBytesUTF8(ret));var endChar=HEAP8[buf+len];stringToUTF8(ret,buf,bufsize+1);HEAP8[buf+len]=endChar;return len},doAccess:function(path,amode){if(amode&~7){return-28}var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node){return-44}var perms=\"\";if(amode&4)perms+=\"r\";if(amode&2)perms+=\"w\";if(amode&1)perms+=\"x\";if(perms&&FS.nodePermissions(node,perms)){return-2}return 0},doReadv:function(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAP32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2];var len=HEAP32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr}return ret},varargs:undefined,get:function(){assert(SYSCALLS.varargs!=undefined);SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-28}var newStream;newStream=FS.createStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 5:{var arg=SYSCALLS.get();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS==\"undefined\"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_openat(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(typeof FS==\"undefined\"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function __embind_register_bigint(primitiveType,name,size,minRange,maxRange){}function getShiftFromSize(size){switch(size){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError(\"Unknown type size: \"+size)}}function embind_init_charCodes(){var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i)}embind_charCodes=codes}var embind_charCodes=undefined;function readLatin1String(ptr){var ret=\"\";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]]}return ret}var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var char_0=48;var char_9=57;function makeLegalFunctionName(name){if(undefined===name){return\"_unknown\"}name=name.replace(/[^a-zA-Z0-9_]/g,\"$\");var f=name.charCodeAt(0);if(f>=char_0&&f<=char_9){return\"_\"+name}return name}function createNamedFunction(name,body){name=makeLegalFunctionName(name);return new Function(\"body\",\"return function \"+name+\"() {\\n\"+' \"use strict\";'+\" return body.apply(this, arguments);\\n\"+\"};\\n\")(body)}function extendError(baseErrorType,errorName){var errorClass=createNamedFunction(errorName,function(message){this.name=errorName;this.message=message;var stack=new Error(message).stack;if(stack!==undefined){this.stack=this.toString()+\"\\n\"+stack.replace(/^Error(:[^\\n]*)?\\n/,\"\")}});errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=function(){if(this.message===undefined){return this.name}else{return this.name+\": \"+this.message}};return errorClass}var BindingError=undefined;function throwBindingError(message){throw new BindingError(message)}var InternalError=undefined;function throwInternalError(message){throw new InternalError(message)}function whenDependentTypesAreResolved(myTypes,dependentTypes,getTypeConverters){myTypes.forEach(function(type){typeDependencies[type]=dependentTypes});function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError(\"Mismatched type converter count\")}for(var i=0;i{if(registeredTypes.hasOwnProperty(dt)){typeConverters[i]=registeredTypes[dt]}else{unregisteredTypes.push(dt);if(!awaitingDependencies.hasOwnProperty(dt)){awaitingDependencies[dt]=[]}awaitingDependencies[dt].push(()=>{typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters)}})}});if(0===unregisteredTypes.length){onComplete(typeConverters)}}function registerType(rawType,registeredInstance,options={}){if(!(\"argPackAdvance\"in registeredInstance)){throw new TypeError(\"registerType registeredInstance requires argPackAdvance\")}var name=registeredInstance.name;if(!rawType){throwBindingError('type \"'+name+'\" must have a positive integer typeid pointer')}if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return}else{throwBindingError(\"Cannot register type '\"+name+\"' twice\")}}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach(cb=>cb())}}function __embind_register_bool(rawType,name,size,trueValue,falseValue){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,\"fromWireType\":function(wt){return!!wt},\"toWireType\":function(destructors,o){return o?trueValue:falseValue},\"argPackAdvance\":8,\"readValueFromPointer\":function(pointer){var heap;if(size===1){heap=HEAP8}else if(size===2){heap=HEAP16}else if(size===4){heap=HEAP32}else{throw new TypeError(\"Unknown boolean type size: \"+name)}return this[\"fromWireType\"](heap[pointer>>shift])},destructorFunction:null})}function ClassHandle_isAliasOf(other){if(!(this instanceof ClassHandle)){return false}if(!(other instanceof ClassHandle)){return false}var leftClass=this.$$.ptrType.registeredClass;var left=this.$$.ptr;var rightClass=other.$$.ptrType.registeredClass;var right=other.$$.ptr;while(leftClass.baseClass){left=leftClass.upcast(left);leftClass=leftClass.baseClass}while(rightClass.baseClass){right=rightClass.upcast(right);rightClass=rightClass.baseClass}return leftClass===rightClass&&left===right}function shallowCopyInternalPointer(o){return{count:o.count,deleteScheduled:o.deleteScheduled,preservePointerOnDelete:o.preservePointerOnDelete,ptr:o.ptr,ptrType:o.ptrType,smartPtr:o.smartPtr,smartPtrType:o.smartPtrType}}function throwInstanceAlreadyDeleted(obj){function getInstanceTypeName(handle){return handle.$$.ptrType.registeredClass.name}throwBindingError(getInstanceTypeName(obj)+\" instance already deleted\")}var finalizationRegistry=false;function detachFinalizer(handle){}function runDestructor($$){if($$.smartPtr){$$.smartPtrType.rawDestructor($$.smartPtr)}else{$$.ptrType.registeredClass.rawDestructor($$.ptr)}}function releaseClassHandle($$){$$.count.value-=1;var toDelete=0===$$.count.value;if(toDelete){runDestructor($$)}}function downcastPointer(ptr,ptrClass,desiredClass){if(ptrClass===desiredClass){return ptr}if(undefined===desiredClass.baseClass){return null}var rv=downcastPointer(ptr,ptrClass,desiredClass.baseClass);if(rv===null){return null}return desiredClass.downcast(rv)}var registeredPointers={};function getInheritedInstanceCount(){return Object.keys(registeredInstances).length}function getLiveInheritedInstances(){var rv=[];for(var k in registeredInstances){if(registeredInstances.hasOwnProperty(k)){rv.push(registeredInstances[k])}}return rv}var deletionQueue=[];function flushPendingDeletes(){while(deletionQueue.length){var obj=deletionQueue.pop();obj.$$.deleteScheduled=false;obj[\"delete\"]()}}var delayFunction=undefined;function setDelayFunction(fn){delayFunction=fn;if(deletionQueue.length&&delayFunction){delayFunction(flushPendingDeletes)}}function init_embind(){Module[\"getInheritedInstanceCount\"]=getInheritedInstanceCount;Module[\"getLiveInheritedInstances\"]=getLiveInheritedInstances;Module[\"flushPendingDeletes\"]=flushPendingDeletes;Module[\"setDelayFunction\"]=setDelayFunction}var registeredInstances={};function getBasestPointer(class_,ptr){if(ptr===undefined){throwBindingError(\"ptr should not be undefined\")}while(class_.baseClass){ptr=class_.upcast(ptr);class_=class_.baseClass}return ptr}function getInheritedInstance(class_,ptr){ptr=getBasestPointer(class_,ptr);return registeredInstances[ptr]}function makeClassHandle(prototype,record){if(!record.ptrType||!record.ptr){throwInternalError(\"makeClassHandle requires ptr and ptrType\")}var hasSmartPtrType=!!record.smartPtrType;var hasSmartPtr=!!record.smartPtr;if(hasSmartPtrType!==hasSmartPtr){throwInternalError(\"Both smartPtrType and smartPtr must be specified\")}record.count={value:1};return attachFinalizer(Object.create(prototype,{$$:{value:record}}))}function RegisteredPointer_fromWireType(ptr){var rawPointer=this.getPointee(ptr);if(!rawPointer){this.destructor(ptr);return null}var registeredInstance=getInheritedInstance(this.registeredClass,rawPointer);if(undefined!==registeredInstance){if(0===registeredInstance.$$.count.value){registeredInstance.$$.ptr=rawPointer;registeredInstance.$$.smartPtr=ptr;return registeredInstance[\"clone\"]()}else{var rv=registeredInstance[\"clone\"]();this.destructor(ptr);return rv}}function makeDefaultHandle(){if(this.isSmartPointer){return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:rawPointer,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this,ptr:ptr})}}var actualType=this.registeredClass.getActualType(rawPointer);var registeredPointerRecord=registeredPointers[actualType];if(!registeredPointerRecord){return makeDefaultHandle.call(this)}var toType;if(this.isConst){toType=registeredPointerRecord.constPointerType}else{toType=registeredPointerRecord.pointerType}var dp=downcastPointer(rawPointer,this.registeredClass,toType.registeredClass);if(dp===null){return makeDefaultHandle.call(this)}if(this.isSmartPointer){return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp})}}function attachFinalizer(handle){if(\"undefined\"===typeof FinalizationRegistry){attachFinalizer=(handle=>handle);return handle}finalizationRegistry=new FinalizationRegistry(info=>{console.warn(info.leakWarning.stack.replace(/^Error: /,\"\"));releaseClassHandle(info.$$)});attachFinalizer=(handle=>{var $$=handle.$$;var hasSmartPtr=!!$$.smartPtr;if(hasSmartPtr){var info={$$:$$};var cls=$$.ptrType.registeredClass;info.leakWarning=new Error(\"Embind found a leaked C++ instance \"+cls.name+\" <0x\"+$$.ptr.toString(16)+\">.\\n\"+\"We'll free it automatically in this case, but this functionality is not reliable across various environments.\\n\"+\"Make sure to invoke .delete() manually once you're done with the instance instead.\\n\"+\"Originally allocated\");if(\"captureStackTrace\"in Error){Error.captureStackTrace(info.leakWarning,RegisteredPointer_fromWireType)}finalizationRegistry.register(handle,info,handle)}return handle});detachFinalizer=(handle=>finalizationRegistry.unregister(handle));return attachFinalizer(handle)}function ClassHandle_clone(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.preservePointerOnDelete){this.$$.count.value+=1;return this}else{var clone=attachFinalizer(Object.create(Object.getPrototypeOf(this),{$$:{value:shallowCopyInternalPointer(this.$$)}}));clone.$$.count.value+=1;clone.$$.deleteScheduled=false;return clone}}function ClassHandle_delete(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError(\"Object already scheduled for deletion\")}detachFinalizer(this);releaseClassHandle(this.$$);if(!this.$$.preservePointerOnDelete){this.$$.smartPtr=undefined;this.$$.ptr=undefined}}function ClassHandle_isDeleted(){return!this.$$.ptr}function ClassHandle_deleteLater(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError(\"Object already scheduled for deletion\")}deletionQueue.push(this);if(deletionQueue.length===1&&delayFunction){delayFunction(flushPendingDeletes)}this.$$.deleteScheduled=true;return this}function init_ClassHandle(){ClassHandle.prototype[\"isAliasOf\"]=ClassHandle_isAliasOf;ClassHandle.prototype[\"clone\"]=ClassHandle_clone;ClassHandle.prototype[\"delete\"]=ClassHandle_delete;ClassHandle.prototype[\"isDeleted\"]=ClassHandle_isDeleted;ClassHandle.prototype[\"deleteLater\"]=ClassHandle_deleteLater}function ClassHandle(){}function ensureOverloadTable(proto,methodName,humanName){if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(){if(!proto[methodName].overloadTable.hasOwnProperty(arguments.length)){throwBindingError(\"Function '\"+humanName+\"' called with an invalid number of arguments (\"+arguments.length+\") - expects one of (\"+proto[methodName].overloadTable+\")!\")}return proto[methodName].overloadTable[arguments.length].apply(this,arguments)};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc}}function exposePublicSymbol(name,value,numArguments){if(Module.hasOwnProperty(name)){if(undefined===numArguments||undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments]){throwBindingError(\"Cannot register public name '\"+name+\"' twice\")}ensureOverloadTable(Module,name,name);if(Module.hasOwnProperty(numArguments)){throwBindingError(\"Cannot register multiple overloads of a function with the same number of arguments (\"+numArguments+\")!\")}Module[name].overloadTable[numArguments]=value}else{Module[name]=value;if(undefined!==numArguments){Module[name].numArguments=numArguments}}}function RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast){this.name=name;this.constructor=constructor;this.instancePrototype=instancePrototype;this.rawDestructor=rawDestructor;this.baseClass=baseClass;this.getActualType=getActualType;this.upcast=upcast;this.downcast=downcast;this.pureVirtualFunctions=[]}function upcastPointer(ptr,ptrClass,desiredClass){while(ptrClass!==desiredClass){if(!ptrClass.upcast){throwBindingError(\"Expected null or instance of \"+desiredClass.name+\", got an instance of \"+ptrClass.name)}ptr=ptrClass.upcast(ptr);ptrClass=ptrClass.baseClass}return ptr}function constNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError(\"null is not a valid \"+this.name)}return 0}if(!handle.$$){throwBindingError('Cannot pass \"'+_embind_repr(handle)+'\" as a '+this.name)}if(!handle.$$.ptr){throwBindingError(\"Cannot pass deleted object as a pointer of type \"+this.name)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function genericPointerToWireType(destructors,handle){var ptr;if(handle===null){if(this.isReference){throwBindingError(\"null is not a valid \"+this.name)}if(this.isSmartPointer){ptr=this.rawConstructor();if(destructors!==null){destructors.push(this.rawDestructor,ptr)}return ptr}else{return 0}}if(!handle.$$){throwBindingError('Cannot pass \"'+_embind_repr(handle)+'\" as a '+this.name)}if(!handle.$$.ptr){throwBindingError(\"Cannot pass deleted object as a pointer of type \"+this.name)}if(!this.isConst&&handle.$$.ptrType.isConst){throwBindingError(\"Cannot convert argument of type \"+(handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name)+\" to parameter type \"+this.name)}var handleClass=handle.$$.ptrType.registeredClass;ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);if(this.isSmartPointer){if(undefined===handle.$$.smartPtr){throwBindingError(\"Passing raw pointer to smart pointer is illegal\")}switch(this.sharingPolicy){case 0:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{throwBindingError(\"Cannot convert argument of type \"+(handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name)+\" to parameter type \"+this.name)}break;case 1:ptr=handle.$$.smartPtr;break;case 2:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{var clonedHandle=handle[\"clone\"]();ptr=this.rawShare(ptr,Emval.toHandle(function(){clonedHandle[\"delete\"]()}));if(destructors!==null){destructors.push(this.rawDestructor,ptr)}}break;default:throwBindingError(\"Unsupporting sharing policy\")}}return ptr}function nonConstNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError(\"null is not a valid \"+this.name)}return 0}if(!handle.$$){throwBindingError('Cannot pass \"'+_embind_repr(handle)+'\" as a '+this.name)}if(!handle.$$.ptr){throwBindingError(\"Cannot pass deleted object as a pointer of type \"+this.name)}if(handle.$$.ptrType.isConst){throwBindingError(\"Cannot convert argument of type \"+handle.$$.ptrType.name+\" to parameter type \"+this.name)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function simpleReadValueFromPointer(pointer){return this[\"fromWireType\"](HEAPU32[pointer>>2])}function RegisteredPointer_getPointee(ptr){if(this.rawGetPointee){ptr=this.rawGetPointee(ptr)}return ptr}function RegisteredPointer_destructor(ptr){if(this.rawDestructor){this.rawDestructor(ptr)}}function RegisteredPointer_deleteObject(handle){if(handle!==null){handle[\"delete\"]()}}function init_RegisteredPointer(){RegisteredPointer.prototype.getPointee=RegisteredPointer_getPointee;RegisteredPointer.prototype.destructor=RegisteredPointer_destructor;RegisteredPointer.prototype[\"argPackAdvance\"]=8;RegisteredPointer.prototype[\"readValueFromPointer\"]=simpleReadValueFromPointer;RegisteredPointer.prototype[\"deleteObject\"]=RegisteredPointer_deleteObject;RegisteredPointer.prototype[\"fromWireType\"]=RegisteredPointer_fromWireType}function RegisteredPointer(name,registeredClass,isReference,isConst,isSmartPointer,pointeeType,sharingPolicy,rawGetPointee,rawConstructor,rawShare,rawDestructor){this.name=name;this.registeredClass=registeredClass;this.isReference=isReference;this.isConst=isConst;this.isSmartPointer=isSmartPointer;this.pointeeType=pointeeType;this.sharingPolicy=sharingPolicy;this.rawGetPointee=rawGetPointee;this.rawConstructor=rawConstructor;this.rawShare=rawShare;this.rawDestructor=rawDestructor;if(!isSmartPointer&®isteredClass.baseClass===undefined){if(isConst){this[\"toWireType\"]=constNoSmartPtrRawPointerToWireType;this.destructorFunction=null}else{this[\"toWireType\"]=nonConstNoSmartPtrRawPointerToWireType;this.destructorFunction=null}}else{this[\"toWireType\"]=genericPointerToWireType}}function replacePublicSymbol(name,value,numArguments){if(!Module.hasOwnProperty(name)){throwInternalError(\"Replacing nonexistant public symbol\")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}}function dynCallLegacy(sig,ptr,args){assert(\"dynCall_\"+sig in Module,\"bad function pointer type - no table for sig '\"+sig+\"'\");if(args&&args.length){assert(args.length===sig.substring(1).replace(/j/g,\"--\").length)}else{assert(sig.length==1)}var f=Module[\"dynCall_\"+sig];return args&&args.length?f.apply(null,[ptr].concat(args)):f.call(null,ptr)}function dynCall(sig,ptr,args){if(sig.includes(\"j\")){return dynCallLegacy(sig,ptr,args)}assert(getWasmTableEntry(ptr),\"missing table entry in dynCall: \"+ptr);return getWasmTableEntry(ptr).apply(null,args)}function getDynCaller(sig,ptr){assert(sig.includes(\"j\"),\"getDynCaller should only be called with i64 sigs\");var argCache=[];return function(){argCache.length=0;Object.assign(argCache,arguments);return dynCall(sig,ptr,argCache)}}function embind__requireFunction(signature,rawFunction){signature=readLatin1String(signature);function makeDynCaller(){if(signature.includes(\"j\")){return getDynCaller(signature,rawFunction)}return getWasmTableEntry(rawFunction)}var fp=makeDynCaller();if(typeof fp!=\"function\"){throwBindingError(\"unknown function pointer with signature \"+signature+\": \"+rawFunction)}return fp}var UnboundTypeError=undefined;function getTypeName(type){var ptr=___getTypeName(type);var rv=readLatin1String(ptr);_free(ptr);return rv}function throwUnboundTypeError(message,types){var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return}if(registeredTypes[type]){return}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return}unboundTypes.push(type);seen[type]=true}types.forEach(visit);throw new UnboundTypeError(message+\": \"+unboundTypes.map(getTypeName).join([\", \"]))}function __embind_register_class(rawType,rawPointerType,rawConstPointerType,baseClassRawType,getActualTypeSignature,getActualType,upcastSignature,upcast,downcastSignature,downcast,name,destructorSignature,rawDestructor){name=readLatin1String(name);getActualType=embind__requireFunction(getActualTypeSignature,getActualType);if(upcast){upcast=embind__requireFunction(upcastSignature,upcast)}if(downcast){downcast=embind__requireFunction(downcastSignature,downcast)}rawDestructor=embind__requireFunction(destructorSignature,rawDestructor);var legalFunctionName=makeLegalFunctionName(name);exposePublicSymbol(legalFunctionName,function(){throwUnboundTypeError(\"Cannot construct \"+name+\" due to unbound types\",[baseClassRawType])});whenDependentTypesAreResolved([rawType,rawPointerType,rawConstPointerType],baseClassRawType?[baseClassRawType]:[],function(base){base=base[0];var baseClass;var basePrototype;if(baseClassRawType){baseClass=base.registeredClass;basePrototype=baseClass.instancePrototype}else{basePrototype=ClassHandle.prototype}var constructor=createNamedFunction(legalFunctionName,function(){if(Object.getPrototypeOf(this)!==instancePrototype){throw new BindingError(\"Use 'new' to construct \"+name)}if(undefined===registeredClass.constructor_body){throw new BindingError(name+\" has no accessible constructor\")}var body=registeredClass.constructor_body[arguments.length];if(undefined===body){throw new BindingError(\"Tried to invoke ctor of \"+name+\" with invalid number of parameters (\"+arguments.length+\") - expected (\"+Object.keys(registeredClass.constructor_body).toString()+\") parameters instead!\")}return body.apply(this,arguments)});var instancePrototype=Object.create(basePrototype,{constructor:{value:constructor}});constructor.prototype=instancePrototype;var registeredClass=new RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast);var referenceConverter=new RegisteredPointer(name,registeredClass,true,false,false);var pointerConverter=new RegisteredPointer(name+\"*\",registeredClass,false,false,false);var constPointerConverter=new RegisteredPointer(name+\" const*\",registeredClass,false,true,false);registeredPointers[rawType]={pointerType:pointerConverter,constPointerType:constPointerConverter};replacePublicSymbol(legalFunctionName,constructor);return[referenceConverter,pointerConverter,constPointerConverter]})}function heap32VectorToArray(count,firstElement){var array=[];for(var i=0;i>2)+i])}return array}function runDestructors(destructors){while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}}function __embind_register_class_constructor(rawClassType,argCount,rawArgTypesAddr,invokerSignature,invoker,rawConstructor){assert(argCount>0);var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);invoker=embind__requireFunction(invokerSignature,invoker);whenDependentTypesAreResolved([],[rawClassType],function(classType){classType=classType[0];var humanName=\"constructor \"+classType.name;if(undefined===classType.registeredClass.constructor_body){classType.registeredClass.constructor_body=[]}if(undefined!==classType.registeredClass.constructor_body[argCount-1]){throw new BindingError(\"Cannot register multiple constructors with identical number of parameters (\"+(argCount-1)+\") for class '\"+classType.name+\"'! Overload resolution is currently only performed using the parameter count, not actual type info!\")}classType.registeredClass.constructor_body[argCount-1]=(()=>{throwUnboundTypeError(\"Cannot construct \"+classType.name+\" due to unbound types\",rawArgTypes)});whenDependentTypesAreResolved([],rawArgTypes,function(argTypes){argTypes.splice(1,0,null);classType.registeredClass.constructor_body[argCount-1]=craftInvokerFunction(humanName,argTypes,null,invoker,rawConstructor);return[]});return[]})}function new_(constructor,argumentList){if(!(constructor instanceof Function)){throw new TypeError(\"new_ called with constructor type \"+typeof constructor+\" which is not a function\")}var dummy=createNamedFunction(constructor.name||\"unknownFunctionName\",function(){});dummy.prototype=constructor.prototype;var obj=new dummy;var r=constructor.apply(obj,argumentList);return r instanceof Object?r:obj}function craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc){var argCount=argTypes.length;if(argCount<2){throwBindingError(\"argTypes array size mismatch! Must at least get return value and 'this' types!\")}var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var needsDestructorStack=false;for(var i=1;i0?\", \":\"\")+argsListWired}invokerFnBody+=(returns?\"var rv = \":\"\")+\"invoker(fn\"+(argsListWired.length>0?\", \":\"\")+argsListWired+\");\\n\";if(needsDestructorStack){invokerFnBody+=\"runDestructors(destructors);\\n\"}else{for(var i=isClassMethodFunc?1:2;i{throwUnboundTypeError(\"Cannot access \"+humanName+\" due to unbound types\",[getterReturnType,setterArgumentType])})}else{desc.set=(v=>{throwBindingError(humanName+\" is a read-only property\")})}Object.defineProperty(classType.registeredClass.instancePrototype,fieldName,desc);whenDependentTypesAreResolved([],setter?[getterReturnType,setterArgumentType]:[getterReturnType],function(types){var getterReturnType=types[0];var desc={get:function(){var ptr=validateThis(this,classType,humanName+\" getter\");return getterReturnType[\"fromWireType\"](getter(getterContext,ptr))},enumerable:true};if(setter){setter=embind__requireFunction(setterSignature,setter);var setterArgumentType=types[1];desc.set=function(v){var ptr=validateThis(this,classType,humanName+\" setter\");var destructors=[];setter(setterContext,ptr,setterArgumentType[\"toWireType\"](destructors,v));runDestructors(destructors)}}Object.defineProperty(classType.registeredClass.instancePrototype,fieldName,desc);return[]});return[]})}var emval_free_list=[];var emval_handle_array=[{},{value:undefined},{value:null},{value:true},{value:false}];function __emval_decref(handle){if(handle>4&&0===--emval_handle_array[handle].refcount){emval_handle_array[handle]=undefined;emval_free_list.push(handle)}}function count_emval_handles(){var count=0;for(var i=5;i{if(!handle){throwBindingError(\"Cannot use deleted val. handle = \"+handle)}return emval_handle_array[handle].value},toHandle:value=>{switch(value){case undefined:return 1;case null:return 2;case true:return 3;case false:return 4;default:{var handle=emval_free_list.length?emval_free_list.pop():emval_handle_array.length;emval_handle_array[handle]={refcount:1,value:value};return handle}}}};function __embind_register_emval(rawType,name){name=readLatin1String(name);registerType(rawType,{name:name,\"fromWireType\":function(handle){var rv=Emval.toValue(handle);__emval_decref(handle);return rv},\"toWireType\":function(destructors,value){return Emval.toHandle(value)},\"argPackAdvance\":8,\"readValueFromPointer\":simpleReadValueFromPointer,destructorFunction:null})}function _embind_repr(v){if(v===null){return\"null\"}var t=typeof v;if(t===\"object\"||t===\"array\"||t===\"function\"){return v.toString()}else{return\"\"+v}}function floatReadValueFromPointer(name,shift){switch(shift){case 2:return function(pointer){return this[\"fromWireType\"](HEAPF32[pointer>>2])};case 3:return function(pointer){return this[\"fromWireType\"](HEAPF64[pointer>>3])};default:throw new TypeError(\"Unknown float type: \"+name)}}function __embind_register_float(rawType,name,size){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,\"fromWireType\":function(value){return value},\"toWireType\":function(destructors,value){if(typeof value!=\"number\"&&typeof value!=\"boolean\"){throw new TypeError('Cannot convert \"'+_embind_repr(value)+'\" to '+this.name)}return value},\"argPackAdvance\":8,\"readValueFromPointer\":floatReadValueFromPointer(name,shift),destructorFunction:null})}function integerReadValueFromPointer(name,shift,signed){switch(shift){case 0:return signed?function readS8FromPointer(pointer){return HEAP8[pointer]}:function readU8FromPointer(pointer){return HEAPU8[pointer]};case 1:return signed?function readS16FromPointer(pointer){return HEAP16[pointer>>1]}:function readU16FromPointer(pointer){return HEAPU16[pointer>>1]};case 2:return signed?function readS32FromPointer(pointer){return HEAP32[pointer>>2]}:function readU32FromPointer(pointer){return HEAPU32[pointer>>2]};default:throw new TypeError(\"Unknown integer type: \"+name)}}function __embind_register_integer(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295}var shift=getShiftFromSize(size);var fromWireType=value=>value;if(minRange===0){var bitshift=32-8*size;fromWireType=(value=>value<>>bitshift)}var isUnsignedType=name.includes(\"unsigned\");var checkAssertions=(value,toTypeName)=>{if(typeof value!=\"number\"&&typeof value!=\"boolean\"){throw new TypeError('Cannot convert \"'+_embind_repr(value)+'\" to '+toTypeName)}if(valuemaxRange){throw new TypeError('Passing a number \"'+_embind_repr(value)+'\" from JS side to C/C++ side to an argument of type \"'+name+'\", which is outside the valid range ['+minRange+\", \"+maxRange+\"]!\")}};var toWireType;if(isUnsignedType){toWireType=function(destructors,value){checkAssertions(value,this.name);return value>>>0}}else{toWireType=function(destructors,value){checkAssertions(value,this.name);return value}}registerType(primitiveType,{name:name,\"fromWireType\":fromWireType,\"toWireType\":toWireType,\"argPackAdvance\":8,\"readValueFromPointer\":integerReadValueFromPointer(name,shift,minRange!==0),destructorFunction:null})}function __embind_register_memory_view(rawType,dataTypeIndex,name){var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){handle=handle>>2;var heap=HEAPU32;var size=heap[handle];var data=heap[handle+1];return new TA(buffer,data,size)}name=readLatin1String(name);registerType(rawType,{name:name,\"fromWireType\":decodeMemoryView,\"argPackAdvance\":8,\"readValueFromPointer\":decodeMemoryView},{ignoreDuplicateRegistrations:true})}function __embind_register_std_string(rawType,name){name=readLatin1String(name);var stdStringIsUTF8=name===\"std::string\";registerType(rawType,{name:name,\"fromWireType\":function(value){var length=HEAPU32[value>>2];var str;if(stdStringIsUTF8){var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i;if(i==length||HEAPU8[currentBytePtr]==0){var maxRead=currentBytePtr-decodeStartPtr;var stringSegment=UTF8ToString(decodeStartPtr,maxRead);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+1}}}else{var a=new Array(length);for(var i=0;ilengthBytesUTF8(value))}else{getLength=(()=>value.length)}var length=getLength();var ptr=_malloc(4+length+1);HEAPU32[ptr>>2]=length;if(stdStringIsUTF8&&valueIsOfTypeString){stringToUTF8(value,ptr+4,length+1)}else{if(valueIsOfTypeString){for(var i=0;i255){_free(ptr);throwBindingError(\"String has UTF-16 code units that do not fit in 8 bits\")}HEAPU8[ptr+4+i]=charCode}}else{for(var i=0;iHEAPU16);shift=1}else if(charSize===4){decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32;getHeap=(()=>HEAPU32);shift=2}registerType(rawType,{name:name,\"fromWireType\":function(value){var length=HEAPU32[value>>2];var HEAP=getHeap();var str;var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i*charSize;if(i==length||HEAP[currentBytePtr>>shift]==0){var maxReadBytes=currentBytePtr-decodeStartPtr;var stringSegment=decodeString(decodeStartPtr,maxReadBytes);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+charSize}}_free(value);return str},\"toWireType\":function(destructors,value){if(!(typeof value==\"string\")){throwBindingError(\"Cannot pass non-string to C++ string type \"+name)}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length>>shift;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr)}return ptr},\"argPackAdvance\":8,\"readValueFromPointer\":simpleReadValueFromPointer,destructorFunction:function(ptr){_free(ptr)}})}function __embind_register_void(rawType,name){name=readLatin1String(name);registerType(rawType,{isVoid:true,name:name,\"argPackAdvance\":0,\"fromWireType\":function(){return undefined},\"toWireType\":function(destructors,o){return undefined}})}function __emscripten_date_now(){return Date.now()}function requireRegisteredType(rawType,humanName){var impl=registeredTypes[rawType];if(undefined===impl){throwBindingError(humanName+\" has unknown type \"+getTypeName(rawType))}return impl}function __emval_as(handle,returnType,destructorsRef){handle=Emval.toValue(handle);returnType=requireRegisteredType(returnType,\"emval::as\");var destructors=[];var rd=Emval.toHandle(destructors);HEAP32[destructorsRef>>2]=rd;return returnType[\"toWireType\"](destructors,handle)}var emval_symbols={};function getStringOrSymbol(address){var symbol=emval_symbols[address];if(symbol===undefined){return readLatin1String(address)}return symbol}var emval_methodCallers=[];function __emval_call_void_method(caller,handle,methodName,args){caller=emval_methodCallers[caller];handle=Emval.toValue(handle);methodName=getStringOrSymbol(methodName);caller(handle,methodName,null,args)}function __emval_addMethodCaller(caller){var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id}function __emval_lookupTypes(argCount,argTypes){var a=new Array(argCount);for(var i=0;i>2)+i],\"parameter \"+i)}return a}var emval_registeredMethods=[];function __emval_get_method_caller(argCount,argTypes){var types=__emval_lookupTypes(argCount,argTypes);var retType=types[0];var signatureName=retType.name+\"_$\"+types.slice(1).map(function(t){return t.name}).join(\"_\")+\"$\";var returnId=emval_registeredMethods[signatureName];if(returnId!==undefined){return returnId}var params=[\"retType\"];var args=[retType];var argsList=\"\";for(var i=0;i4){emval_handle_array[handle].refcount+=1}}function __emval_run_destructors(handle){var destructors=Emval.toValue(handle);runDestructors(destructors);__emval_decref(handle)}function __emval_take_value(type,argv){type=requireRegisteredType(type,\"_emval_take_value\");var v=type[\"readValueFromPointer\"](argv);return Emval.toHandle(v)}function __gmtime_js(time,tmPtr){var date=new Date(HEAP32[time>>2]*1e3);HEAP32[tmPtr>>2]=date.getUTCSeconds();HEAP32[tmPtr+4>>2]=date.getUTCMinutes();HEAP32[tmPtr+8>>2]=date.getUTCHours();HEAP32[tmPtr+12>>2]=date.getUTCDate();HEAP32[tmPtr+16>>2]=date.getUTCMonth();HEAP32[tmPtr+20>>2]=date.getUTCFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday}function __localtime_js(time,tmPtr){var date=new Date(HEAP32[time>>2]*1e3);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.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var start=new Date(date.getFullYear(),0,1);var yday=(date.getTime()-start.getTime())/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst}function __mktime_js(tmPtr){var 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);var dst=HEAP32[tmPtr+32>>2];var guessedOffset=date.getTimezoneOffset();var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dstOffset=Math.min(winterOffset,summerOffset);if(dst<0){HEAP32[tmPtr+32>>2]=Number(summerOffset!=winterOffset&&dstOffset==guessedOffset)}else if(dst>0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}HEAP32[tmPtr+24>>2]=date.getDay();var yday=(date.getTime()-start.getTime())/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday;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();return date.getTime()/1e3|0}function _tzset_impl(timezone,daylight,tzname){var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAP32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);function extractZone(date){var match=date.toTimeString().match(/\\(([A-Za-z ]+)\\)$/);return match?match[1]:\"GMT\"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocateUTF8(winterName);var summerNamePtr=allocateUTF8(summerName);if(summerOffset>2]=winterNamePtr;HEAP32[tzname+4>>2]=summerNamePtr}else{HEAP32[tzname>>2]=summerNamePtr;HEAP32[tzname+4>>2]=winterNamePtr}}function __tzset_js(timezone,daylight,tzname){if(__tzset_js.called)return;__tzset_js.called=true;_tzset_impl(timezone,daylight,tzname)}function _abort(){abort(\"native code called abort()\")}function reallyNegative(x){return x<0||x===0&&1/x===-Infinity}function convertI32PairToI53(lo,hi){assert(hi===(hi|0));return(lo>>>0)+hi*4294967296}function convertU32PairToI53(lo,hi){return(lo>>>0)+(hi>>>0)*4294967296}function reSign(value,bits){if(value<=0){return value}var half=bits<=32?Math.abs(1<=half&&(bits<=32||value>half)){value=-2*half+value}return value}function unSign(value,bits){if(value>=0){return value}return bits<=32?2*Math.abs(1<>3]);argIndex+=8}else if(type==\"i64\"){ret=[HEAP32[argIndex>>2],HEAP32[argIndex+4>>2]];argIndex+=8}else{assert((argIndex&3)===0);type=\"i32\";ret=HEAP32[argIndex>>2];argIndex+=4}return ret}var ret=[];var curr,next,currArg;while(1){var startTextIndex=textIndex;curr=HEAP8[textIndex>>0];if(curr===0)break;next=HEAP8[textIndex+1>>0];if(curr==37){var flagAlwaysSigned=false;var flagLeftAlign=false;var flagAlternative=false;var flagZeroPad=false;var flagPadSign=false;flagsLoop:while(1){switch(next){case 43:flagAlwaysSigned=true;break;case 45:flagLeftAlign=true;break;case 35:flagAlternative=true;break;case 48:if(flagZeroPad){break flagsLoop}else{flagZeroPad=true;break}case 32:flagPadSign=true;break;default:break flagsLoop}textIndex++;next=HEAP8[textIndex+1>>0]}var width=0;if(next==42){width=getNextArg(\"i32\");textIndex++;next=HEAP8[textIndex+1>>0]}else{while(next>=48&&next<=57){width=width*10+(next-48);textIndex++;next=HEAP8[textIndex+1>>0]}}var precisionSet=false,precision=-1;if(next==46){precision=0;precisionSet=true;textIndex++;next=HEAP8[textIndex+1>>0];if(next==42){precision=getNextArg(\"i32\");textIndex++}else{while(1){var precisionChr=HEAP8[textIndex+1>>0];if(precisionChr<48||precisionChr>57)break;precision=precision*10+(precisionChr-48);textIndex++}}next=HEAP8[textIndex+1>>0]}if(precision<0){precision=6;precisionSet=false}var argSize;switch(String.fromCharCode(next)){case\"h\":var nextNext=HEAP8[textIndex+2>>0];if(nextNext==104){textIndex++;argSize=1}else{argSize=2}break;case\"l\":var nextNext=HEAP8[textIndex+2>>0];if(nextNext==108){textIndex++;argSize=8}else{argSize=4}break;case\"L\":case\"q\":case\"j\":argSize=8;break;case\"z\":case\"t\":case\"I\":argSize=4;break;default:argSize=null}if(argSize)textIndex++;next=HEAP8[textIndex+1>>0];switch(String.fromCharCode(next)){case\"d\":case\"i\":case\"u\":case\"o\":case\"x\":case\"X\":case\"p\":{var signed=next==100||next==105;argSize=argSize||4;currArg=getNextArg(\"i\"+argSize*8);var argText;if(argSize==8){currArg=next==117?convertU32PairToI53(currArg[0],currArg[1]):convertI32PairToI53(currArg[0],currArg[1])}if(argSize<=4){var limit=Math.pow(256,argSize)-1;currArg=(signed?reSign:unSign)(currArg&limit,argSize*8)}var currAbsArg=Math.abs(currArg);var prefix=\"\";if(next==100||next==105){argText=reSign(currArg,8*argSize).toString(10)}else if(next==117){argText=unSign(currArg,8*argSize).toString(10);currArg=Math.abs(currArg)}else if(next==111){argText=(flagAlternative?\"0\":\"\")+currAbsArg.toString(8)}else if(next==120||next==88){prefix=flagAlternative&&currArg!=0?\"0x\":\"\";if(currArg<0){currArg=-currArg;argText=(currAbsArg-1).toString(16);var buffer=[];for(var i=0;i=0){if(flagAlwaysSigned){prefix=\"+\"+prefix}else if(flagPadSign){prefix=\" \"+prefix}}if(argText.charAt(0)==\"-\"){prefix=\"-\"+prefix;argText=argText.substr(1)}while(prefix.length+argText.lengthexponent&&exponent>=-4){next=(next==103?\"f\":\"F\").charCodeAt(0);precision-=exponent+1}else{next=(next==103?\"e\":\"E\").charCodeAt(0);precision--}effectivePrecision=Math.min(precision,20)}if(next==101||next==69){argText=currArg.toExponential(effectivePrecision);if(/[eE][-+]\\d$/.test(argText)){argText=argText.slice(0,-1)+\"0\"+argText.slice(-1)}}else if(next==102||next==70){argText=currArg.toFixed(effectivePrecision);if(currArg===0&&reallyNegative(currArg)){argText=\"-\"+argText}}var parts=argText.split(\"e\");if(isGeneral&&!flagAlternative){while(parts[0].length>1&&parts[0].includes(\".\")&&(parts[0].slice(-1)==\"0\"||parts[0].slice(-1)==\".\")){parts[0]=parts[0].slice(0,-1)}}else{if(flagAlternative&&argText.indexOf(\".\")==-1)parts[0]+=\".\";while(precision>effectivePrecision++)parts[0]+=\"0\"}argText=parts[0]+(parts.length>1?\"e\"+parts[1]:\"\");if(next==69)argText=argText.toUpperCase();if(currArg>=0){if(flagAlwaysSigned){argText=\"+\"+argText}else if(flagPadSign){argText=\" \"+argText}}}while(argText.length>0])}}else{ret=ret.concat(intArrayFromString(\"(null)\".substr(0,argLength),true))}if(flagLeftAlign){while(argLength0){ret.push(32)}if(!flagLeftAlign)ret.push(getNextArg(\"i8\"));break}case\"n\":{var ptr=getNextArg(\"i32*\");HEAP32[ptr>>2]=ret.length;break}case\"%\":{ret.push(curr);break}default:{for(var i=startTextIndex;i>0])}}}textIndex+=2}else{ret.push(curr);textIndex+=1}}return ret}function traverseStack(args){if(!args||!args.callee||!args.callee.name){return[null,\"\",\"\"]}var funstr=args.callee.toString();var funcname=args.callee.name;var str=\"(\";var first=true;for(var i in args){var a=args[i];if(!first){str+=\", \"}first=false;if(typeof a==\"number\"||typeof a==\"string\"){str+=a}else{str+=\"(\"+typeof a+\")\"}}str+=\")\";var caller=args.callee.caller;args=caller?caller.arguments:[];if(first)str=\"\";return[args,funcname,str]}function _emscripten_get_callstack_js(flags){var callstack=jsStackTrace();var iThisFunc=callstack.lastIndexOf(\"_emscripten_log\");var iThisFunc2=callstack.lastIndexOf(\"_emscripten_get_callstack\");var iNextLine=callstack.indexOf(\"\\n\",Math.max(iThisFunc,iThisFunc2))+1;callstack=callstack.slice(iNextLine);if(flags&32){warnOnce(\"EM_LOG_DEMANGLE is deprecated; ignoring\")}if(flags&8&&typeof emscripten_source_map==\"undefined\"){warnOnce('Source map information is not available, emscripten_log with EM_LOG_C_STACK will be ignored. Build with \"--pre-js $EMSCRIPTEN/src/emscripten-source-map.min.js\" linker flag to add source map loading to code.');flags^=8;flags|=16}var stack_args=null;if(flags&128){stack_args=traverseStack(arguments);while(stack_args[1].includes(\"_emscripten_\"))stack_args=traverseStack(stack_args[0])}var lines=callstack.split(\"\\n\");callstack=\"\";var newFirefoxRe=new RegExp(\"\\\\s*(.*?)@(.*?):([0-9]+):([0-9]+)\");var firefoxRe=new RegExp(\"\\\\s*(.*?)@(.*):(.*)(:(.*))?\");var chromeRe=new RegExp(\"\\\\s*at (.*?) \\\\((.*):(.*):(.*)\\\\)\");for(var l in lines){var line=lines[l];var symbolName=\"\";var file=\"\";var lineno=0;var column=0;var parts=chromeRe.exec(line);if(parts&&parts.length==5){symbolName=parts[1];file=parts[2];lineno=parts[3];column=parts[4]}else{parts=newFirefoxRe.exec(line);if(!parts)parts=firefoxRe.exec(line);if(parts&&parts.length>=4){symbolName=parts[1];file=parts[2];lineno=parts[3];column=parts[4]|0}else{callstack+=line+\"\\n\";continue}}var haveSourceMap=false;if(flags&8){var orig=emscripten_source_map.originalPositionFor({line:lineno,column:column});haveSourceMap=orig&&orig.source;if(haveSourceMap){if(flags&64){orig.source=orig.source.substring(orig.source.replace(/\\\\/g,\"/\").lastIndexOf(\"/\")+1)}callstack+=\" at \"+symbolName+\" (\"+orig.source+\":\"+orig.line+\":\"+orig.column+\")\\n\"}}if(flags&16||!haveSourceMap){if(flags&64){file=file.substring(file.replace(/\\\\/g,\"/\").lastIndexOf(\"/\")+1)}callstack+=(haveSourceMap?\" = \"+symbolName:\" at \"+symbolName)+\" (\"+file+\":\"+lineno+\":\"+column+\")\\n\"}if(flags&128&&stack_args[0]){if(stack_args[1]==symbolName&&stack_args[2].length>0){callstack=callstack.replace(/\\s+$/,\"\");callstack+=\" with values: \"+stack_args[1]+stack_args[2]+\"\\n\"}stack_args=traverseStack(stack_args[0])}}callstack=callstack.replace(/\\s+$/,\"\");return callstack}function _emscripten_log_js(flags,str){if(flags&24){str=str.replace(/\\s+$/,\"\");str+=(str.length>0?\"\\n\":\"\")+_emscripten_get_callstack_js(flags)}if(flags&1){if(flags&4){console.error(str)}else if(flags&2){console.warn(str)}else if(flags&512){console.info(str)}else if(flags&256){console.debug(str)}else{console.log(str)}}else if(flags&6){err(str)}else{out(str)}}function _emscripten_log(flags,format,varargs){var result=formatString(format,varargs);var str=UTF8ArrayToString(result,0);_emscripten_log_js(flags,str)}function _emscripten_get_heap_max(){return 2147483648}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){err(\"emscripten_realloc_buffer: Attempted to grow heap from \"+buffer.byteLength+\" bytes to \"+size+\" bytes, but got error: \"+e)}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;assert(requestedSize>oldSize);var maxHeapSize=_emscripten_get_heap_max();if(requestedSize>maxHeapSize){err(\"Cannot enlarge memory, asked to go up to \"+requestedSize+\" bytes, but the limit is \"+maxHeapSize+\" bytes!\");return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}err(\"Failed to grow the heap from \"+oldSize+\" bytes to \"+newSize+\" bytes, not enough memory!\");return false}var ENV={};function getExecutableName(){return thisProgram||\"./this.program\"}function getEnvStrings(){if(!getEnvStrings.strings){var lang=(typeof navigator==\"object\"&&navigator.languages&&navigator.languages[0]||\"C\").replace(\"-\",\"_\")+\".UTF-8\";var env={\"USER\":\"web_user\",\"LOGNAME\":\"web_user\",\"PATH\":\"/\",\"PWD\":\"/\",\"HOME\":\"/home/web_user\",\"LANG\":lang,\"_\":getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(x+\"=\"+env[x])}getEnvStrings.strings=strings}return getEnvStrings.strings}function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAP32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAP32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAP32[penviron_buf_size>>2]=bufSize;return 0}function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS==\"undefined\"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function _fd_fdstat_get(fd,pbuf){try{var stream=SYSCALLS.getStreamFromFD(fd);var type=stream.tty?2:FS.isDir(stream.mode)?3:FS.isLink(stream.mode)?7:4;HEAP8[pbuf>>0]=type;return 0}catch(e){if(typeof FS==\"undefined\"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function _fd_read(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=SYSCALLS.doReadv(stream,iov,iovcnt);HEAP32[pnum>>2]=num;return 0}catch(e){if(typeof FS==\"undefined\"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var stream=SYSCALLS.getStreamFromFD(fd);var HIGH_OFFSET=4294967296;var offset=offset_high*HIGH_OFFSET+(offset_low>>>0);var DOUBLE_LIMIT=9007199254740992;if(offset<=-DOUBLE_LIMIT||offset>=DOUBLE_LIMIT){return-61}FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[newOffset>>2]=tempI64[0],HEAP32[newOffset+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS==\"undefined\"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=SYSCALLS.doWritev(stream,iov,iovcnt);HEAP32[pnum>>2]=num;return 0}catch(e){if(typeof FS==\"undefined\"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function _setTempRet0(val){setTempRet0(val)}var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;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 readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();ERRNO_CODES={\"EPERM\":63,\"ENOENT\":44,\"ESRCH\":71,\"EINTR\":27,\"EIO\":29,\"ENXIO\":60,\"E2BIG\":1,\"ENOEXEC\":45,\"EBADF\":8,\"ECHILD\":12,\"EAGAIN\":6,\"EWOULDBLOCK\":6,\"ENOMEM\":48,\"EACCES\":2,\"EFAULT\":21,\"ENOTBLK\":105,\"EBUSY\":10,\"EEXIST\":20,\"EXDEV\":75,\"ENODEV\":43,\"ENOTDIR\":54,\"EISDIR\":31,\"EINVAL\":28,\"ENFILE\":41,\"EMFILE\":33,\"ENOTTY\":59,\"ETXTBSY\":74,\"EFBIG\":22,\"ENOSPC\":51,\"ESPIPE\":70,\"EROFS\":69,\"EMLINK\":34,\"EPIPE\":64,\"EDOM\":18,\"ERANGE\":68,\"ENOMSG\":49,\"EIDRM\":24,\"ECHRNG\":106,\"EL2NSYNC\":156,\"EL3HLT\":107,\"EL3RST\":108,\"ELNRNG\":109,\"EUNATCH\":110,\"ENOCSI\":111,\"EL2HLT\":112,\"EDEADLK\":16,\"ENOLCK\":46,\"EBADE\":113,\"EBADR\":114,\"EXFULL\":115,\"ENOANO\":104,\"EBADRQC\":103,\"EBADSLT\":102,\"EDEADLOCK\":16,\"EBFONT\":101,\"ENOSTR\":100,\"ENODATA\":116,\"ETIME\":117,\"ENOSR\":118,\"ENONET\":119,\"ENOPKG\":120,\"EREMOTE\":121,\"ENOLINK\":47,\"EADV\":122,\"ESRMNT\":123,\"ECOMM\":124,\"EPROTO\":65,\"EMULTIHOP\":36,\"EDOTDOT\":125,\"EBADMSG\":9,\"ENOTUNIQ\":126,\"EBADFD\":127,\"EREMCHG\":128,\"ELIBACC\":129,\"ELIBBAD\":130,\"ELIBSCN\":131,\"ELIBMAX\":132,\"ELIBEXEC\":133,\"ENOSYS\":52,\"ENOTEMPTY\":55,\"ENAMETOOLONG\":37,\"ELOOP\":32,\"EOPNOTSUPP\":138,\"EPFNOSUPPORT\":139,\"ECONNRESET\":15,\"ENOBUFS\":42,\"EAFNOSUPPORT\":5,\"EPROTOTYPE\":67,\"ENOTSOCK\":57,\"ENOPROTOOPT\":50,\"ESHUTDOWN\":140,\"ECONNREFUSED\":14,\"EADDRINUSE\":3,\"ECONNABORTED\":13,\"ENETUNREACH\":40,\"ENETDOWN\":38,\"ETIMEDOUT\":73,\"EHOSTDOWN\":142,\"EHOSTUNREACH\":23,\"EINPROGRESS\":26,\"EALREADY\":7,\"EDESTADDRREQ\":17,\"EMSGSIZE\":35,\"EPROTONOSUPPORT\":66,\"ESOCKTNOSUPPORT\":137,\"EADDRNOTAVAIL\":4,\"ENETRESET\":39,\"EISCONN\":30,\"ENOTCONN\":53,\"ETOOMANYREFS\":141,\"EUSERS\":136,\"EDQUOT\":19,\"ESTALE\":72,\"ENOTSUP\":138,\"ENOMEDIUM\":148,\"EILSEQ\":25,\"EOVERFLOW\":61,\"ECANCELED\":11,\"ENOTRECOVERABLE\":56,\"EOWNERDEAD\":62,\"ESTRPIPE\":135};embind_init_charCodes();BindingError=Module[\"BindingError\"]=extendError(Error,\"BindingError\");InternalError=Module[\"InternalError\"]=extendError(Error,\"InternalError\");init_ClassHandle();init_embind();init_RegisteredPointer();UnboundTypeError=Module[\"UnboundTypeError\"]=extendError(Error,\"UnboundTypeError\");init_emval();var ASSERTIONS=true;function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}function checkIncomingModuleAPI(){ignoredModuleProp(\"fetchSettings\")}var asmLibraryArg={\"__syscall_fcntl64\":___syscall_fcntl64,\"__syscall_openat\":___syscall_openat,\"_embind_register_bigint\":__embind_register_bigint,\"_embind_register_bool\":__embind_register_bool,\"_embind_register_class\":__embind_register_class,\"_embind_register_class_constructor\":__embind_register_class_constructor,\"_embind_register_class_function\":__embind_register_class_function,\"_embind_register_class_property\":__embind_register_class_property,\"_embind_register_emval\":__embind_register_emval,\"_embind_register_float\":__embind_register_float,\"_embind_register_integer\":__embind_register_integer,\"_embind_register_memory_view\":__embind_register_memory_view,\"_embind_register_std_string\":__embind_register_std_string,\"_embind_register_std_wstring\":__embind_register_std_wstring,\"_embind_register_void\":__embind_register_void,\"_emscripten_date_now\":__emscripten_date_now,\"_emval_as\":__emval_as,\"_emval_call_void_method\":__emval_call_void_method,\"_emval_decref\":__emval_decref,\"_emval_get_method_caller\":__emval_get_method_caller,\"_emval_incref\":__emval_incref,\"_emval_run_destructors\":__emval_run_destructors,\"_emval_take_value\":__emval_take_value,\"_gmtime_js\":__gmtime_js,\"_localtime_js\":__localtime_js,\"_mktime_js\":__mktime_js,\"_tzset_js\":__tzset_js,\"abort\":_abort,\"emscripten_log\":_emscripten_log,\"emscripten_resize_heap\":_emscripten_resize_heap,\"environ_get\":_environ_get,\"environ_sizes_get\":_environ_sizes_get,\"fd_close\":_fd_close,\"fd_fdstat_get\":_fd_fdstat_get,\"fd_read\":_fd_read,\"fd_seek\":_fd_seek,\"fd_write\":_fd_write,\"setTempRet0\":_setTempRet0};var asm=createWasm();var ___wasm_call_ctors=Module[\"___wasm_call_ctors\"]=createExportWrapper(\"__wasm_call_ctors\");var _free=Module[\"_free\"]=createExportWrapper(\"free\");var _malloc=Module[\"_malloc\"]=createExportWrapper(\"malloc\");var _strlen=Module[\"_strlen\"]=createExportWrapper(\"strlen\");var ___errno_location=Module[\"___errno_location\"]=createExportWrapper(\"__errno_location\");var ___getTypeName=Module[\"___getTypeName\"]=createExportWrapper(\"__getTypeName\");var ___embind_register_native_and_builtin_types=Module[\"___embind_register_native_and_builtin_types\"]=createExportWrapper(\"__embind_register_native_and_builtin_types\");var ___stdio_exit=Module[\"___stdio_exit\"]=createExportWrapper(\"__stdio_exit\");var _emscripten_builtin_memalign=Module[\"_emscripten_builtin_memalign\"]=createExportWrapper(\"emscripten_builtin_memalign\");var _emscripten_stack_init=Module[\"_emscripten_stack_init\"]=function(){return(_emscripten_stack_init=Module[\"_emscripten_stack_init\"]=Module[\"asm\"][\"emscripten_stack_init\"]).apply(null,arguments)};var _emscripten_stack_get_free=Module[\"_emscripten_stack_get_free\"]=function(){return(_emscripten_stack_get_free=Module[\"_emscripten_stack_get_free\"]=Module[\"asm\"][\"emscripten_stack_get_free\"]).apply(null,arguments)};var _emscripten_stack_get_base=Module[\"_emscripten_stack_get_base\"]=function(){return(_emscripten_stack_get_base=Module[\"_emscripten_stack_get_base\"]=Module[\"asm\"][\"emscripten_stack_get_base\"]).apply(null,arguments)};var _emscripten_stack_get_end=Module[\"_emscripten_stack_get_end\"]=function(){return(_emscripten_stack_get_end=Module[\"_emscripten_stack_get_end\"]=Module[\"asm\"][\"emscripten_stack_get_end\"]).apply(null,arguments)};var stackSave=Module[\"stackSave\"]=createExportWrapper(\"stackSave\");var stackRestore=Module[\"stackRestore\"]=createExportWrapper(\"stackRestore\");var stackAlloc=Module[\"stackAlloc\"]=createExportWrapper(\"stackAlloc\");var dynCall_ijiii=Module[\"dynCall_ijiii\"]=createExportWrapper(\"dynCall_ijiii\");var dynCall_viiijj=Module[\"dynCall_viiijj\"]=createExportWrapper(\"dynCall_viiijj\");var dynCall_jij=Module[\"dynCall_jij\"]=createExportWrapper(\"dynCall_jij\");var dynCall_jii=Module[\"dynCall_jii\"]=createExportWrapper(\"dynCall_jii\");var dynCall_jiji=Module[\"dynCall_jiji\"]=createExportWrapper(\"dynCall_jiji\");var _ff_h264_cabac_tables=Module[\"_ff_h264_cabac_tables\"]=112940;unexportedRuntimeFunction(\"intArrayFromString\",false);unexportedRuntimeFunction(\"intArrayToString\",false);unexportedRuntimeFunction(\"ccall\",false);unexportedRuntimeFunction(\"cwrap\",false);unexportedRuntimeFunction(\"setValue\",false);unexportedRuntimeFunction(\"getValue\",false);unexportedRuntimeFunction(\"allocate\",false);unexportedRuntimeFunction(\"UTF8ArrayToString\",false);unexportedRuntimeFunction(\"UTF8ToString\",false);unexportedRuntimeFunction(\"stringToUTF8Array\",false);unexportedRuntimeFunction(\"stringToUTF8\",false);unexportedRuntimeFunction(\"lengthBytesUTF8\",false);unexportedRuntimeFunction(\"stackTrace\",false);unexportedRuntimeFunction(\"addOnPreRun\",false);unexportedRuntimeFunction(\"addOnInit\",false);unexportedRuntimeFunction(\"addOnPreMain\",false);unexportedRuntimeFunction(\"addOnExit\",false);unexportedRuntimeFunction(\"addOnPostRun\",false);unexportedRuntimeFunction(\"writeStringToMemory\",false);unexportedRuntimeFunction(\"writeArrayToMemory\",false);unexportedRuntimeFunction(\"writeAsciiToMemory\",false);unexportedRuntimeFunction(\"addRunDependency\",true);unexportedRuntimeFunction(\"removeRunDependency\",true);unexportedRuntimeFunction(\"FS_createFolder\",false);unexportedRuntimeFunction(\"FS_createPath\",true);unexportedRuntimeFunction(\"FS_createDataFile\",true);unexportedRuntimeFunction(\"FS_createPreloadedFile\",true);unexportedRuntimeFunction(\"FS_createLazyFile\",true);unexportedRuntimeFunction(\"FS_createLink\",false);unexportedRuntimeFunction(\"FS_createDevice\",true);unexportedRuntimeFunction(\"FS_unlink\",true);unexportedRuntimeFunction(\"getLEB\",false);unexportedRuntimeFunction(\"getFunctionTables\",false);unexportedRuntimeFunction(\"alignFunctionTables\",false);unexportedRuntimeFunction(\"registerFunctions\",false);unexportedRuntimeFunction(\"addFunction\",false);unexportedRuntimeFunction(\"removeFunction\",false);unexportedRuntimeFunction(\"prettyPrint\",false);unexportedRuntimeFunction(\"dynCall\",false);unexportedRuntimeFunction(\"getCompilerSetting\",false);unexportedRuntimeFunction(\"print\",false);unexportedRuntimeFunction(\"printErr\",false);unexportedRuntimeFunction(\"getTempRet0\",false);unexportedRuntimeFunction(\"setTempRet0\",false);unexportedRuntimeFunction(\"callMain\",false);unexportedRuntimeFunction(\"abort\",false);unexportedRuntimeFunction(\"keepRuntimeAlive\",false);unexportedRuntimeFunction(\"ptrToString\",false);unexportedRuntimeFunction(\"zeroMemory\",false);unexportedRuntimeFunction(\"stringToNewUTF8\",false);unexportedRuntimeFunction(\"emscripten_realloc_buffer\",false);unexportedRuntimeFunction(\"ENV\",false);unexportedRuntimeFunction(\"ERRNO_CODES\",false);unexportedRuntimeFunction(\"ERRNO_MESSAGES\",false);unexportedRuntimeFunction(\"setErrNo\",false);unexportedRuntimeFunction(\"inetPton4\",false);unexportedRuntimeFunction(\"inetNtop4\",false);unexportedRuntimeFunction(\"inetPton6\",false);unexportedRuntimeFunction(\"inetNtop6\",false);unexportedRuntimeFunction(\"readSockaddr\",false);unexportedRuntimeFunction(\"writeSockaddr\",false);unexportedRuntimeFunction(\"DNS\",false);unexportedRuntimeFunction(\"getHostByName\",false);unexportedRuntimeFunction(\"Protocols\",false);unexportedRuntimeFunction(\"Sockets\",false);unexportedRuntimeFunction(\"getRandomDevice\",false);unexportedRuntimeFunction(\"traverseStack\",false);unexportedRuntimeFunction(\"UNWIND_CACHE\",false);unexportedRuntimeFunction(\"convertPCtoSourceLocation\",false);unexportedRuntimeFunction(\"readAsmConstArgsArray\",false);unexportedRuntimeFunction(\"readAsmConstArgs\",false);unexportedRuntimeFunction(\"mainThreadEM_ASM\",false);unexportedRuntimeFunction(\"jstoi_q\",false);unexportedRuntimeFunction(\"jstoi_s\",false);unexportedRuntimeFunction(\"getExecutableName\",false);unexportedRuntimeFunction(\"listenOnce\",false);unexportedRuntimeFunction(\"autoResumeAudioContext\",false);unexportedRuntimeFunction(\"dynCallLegacy\",false);unexportedRuntimeFunction(\"getDynCaller\",false);unexportedRuntimeFunction(\"dynCall\",false);unexportedRuntimeFunction(\"setWasmTableEntry\",false);unexportedRuntimeFunction(\"getWasmTableEntry\",false);unexportedRuntimeFunction(\"handleException\",false);unexportedRuntimeFunction(\"runtimeKeepalivePush\",false);unexportedRuntimeFunction(\"runtimeKeepalivePop\",false);unexportedRuntimeFunction(\"callUserCallback\",false);unexportedRuntimeFunction(\"maybeExit\",false);unexportedRuntimeFunction(\"safeSetTimeout\",false);unexportedRuntimeFunction(\"asmjsMangle\",false);unexportedRuntimeFunction(\"asyncLoad\",false);unexportedRuntimeFunction(\"alignMemory\",false);unexportedRuntimeFunction(\"mmapAlloc\",false);unexportedRuntimeFunction(\"reallyNegative\",false);unexportedRuntimeFunction(\"unSign\",false);unexportedRuntimeFunction(\"reSign\",false);unexportedRuntimeFunction(\"formatString\",false);unexportedRuntimeFunction(\"PATH\",false);unexportedRuntimeFunction(\"PATH_FS\",false);unexportedRuntimeFunction(\"SYSCALLS\",false);unexportedRuntimeFunction(\"getSocketFromFD\",false);unexportedRuntimeFunction(\"getSocketAddress\",false);unexportedRuntimeFunction(\"JSEvents\",false);unexportedRuntimeFunction(\"registerKeyEventCallback\",false);unexportedRuntimeFunction(\"specialHTMLTargets\",false);unexportedRuntimeFunction(\"maybeCStringToJsString\",false);unexportedRuntimeFunction(\"findEventTarget\",false);unexportedRuntimeFunction(\"findCanvasEventTarget\",false);unexportedRuntimeFunction(\"getBoundingClientRect\",false);unexportedRuntimeFunction(\"fillMouseEventData\",false);unexportedRuntimeFunction(\"registerMouseEventCallback\",false);unexportedRuntimeFunction(\"registerWheelEventCallback\",false);unexportedRuntimeFunction(\"registerUiEventCallback\",false);unexportedRuntimeFunction(\"registerFocusEventCallback\",false);unexportedRuntimeFunction(\"fillDeviceOrientationEventData\",false);unexportedRuntimeFunction(\"registerDeviceOrientationEventCallback\",false);unexportedRuntimeFunction(\"fillDeviceMotionEventData\",false);unexportedRuntimeFunction(\"registerDeviceMotionEventCallback\",false);unexportedRuntimeFunction(\"screenOrientation\",false);unexportedRuntimeFunction(\"fillOrientationChangeEventData\",false);unexportedRuntimeFunction(\"registerOrientationChangeEventCallback\",false);unexportedRuntimeFunction(\"fillFullscreenChangeEventData\",false);unexportedRuntimeFunction(\"registerFullscreenChangeEventCallback\",false);unexportedRuntimeFunction(\"registerRestoreOldStyle\",false);unexportedRuntimeFunction(\"hideEverythingExceptGivenElement\",false);unexportedRuntimeFunction(\"restoreHiddenElements\",false);unexportedRuntimeFunction(\"setLetterbox\",false);unexportedRuntimeFunction(\"currentFullscreenStrategy\",false);unexportedRuntimeFunction(\"restoreOldWindowedStyle\",false);unexportedRuntimeFunction(\"softFullscreenResizeWebGLRenderTarget\",false);unexportedRuntimeFunction(\"doRequestFullscreen\",false);unexportedRuntimeFunction(\"fillPointerlockChangeEventData\",false);unexportedRuntimeFunction(\"registerPointerlockChangeEventCallback\",false);unexportedRuntimeFunction(\"registerPointerlockErrorEventCallback\",false);unexportedRuntimeFunction(\"requestPointerLock\",false);unexportedRuntimeFunction(\"fillVisibilityChangeEventData\",false);unexportedRuntimeFunction(\"registerVisibilityChangeEventCallback\",false);unexportedRuntimeFunction(\"registerTouchEventCallback\",false);unexportedRuntimeFunction(\"fillGamepadEventData\",false);unexportedRuntimeFunction(\"registerGamepadEventCallback\",false);unexportedRuntimeFunction(\"registerBeforeUnloadEventCallback\",false);unexportedRuntimeFunction(\"fillBatteryEventData\",false);unexportedRuntimeFunction(\"battery\",false);unexportedRuntimeFunction(\"registerBatteryEventCallback\",false);unexportedRuntimeFunction(\"setCanvasElementSize\",false);unexportedRuntimeFunction(\"getCanvasElementSize\",false);unexportedRuntimeFunction(\"demangle\",false);unexportedRuntimeFunction(\"demangleAll\",false);unexportedRuntimeFunction(\"jsStackTrace\",false);unexportedRuntimeFunction(\"stackTrace\",false);unexportedRuntimeFunction(\"getEnvStrings\",false);unexportedRuntimeFunction(\"checkWasiClock\",false);unexportedRuntimeFunction(\"writeI53ToI64\",false);unexportedRuntimeFunction(\"writeI53ToI64Clamped\",false);unexportedRuntimeFunction(\"writeI53ToI64Signaling\",false);unexportedRuntimeFunction(\"writeI53ToU64Clamped\",false);unexportedRuntimeFunction(\"writeI53ToU64Signaling\",false);unexportedRuntimeFunction(\"readI53FromI64\",false);unexportedRuntimeFunction(\"readI53FromU64\",false);unexportedRuntimeFunction(\"convertI32PairToI53\",false);unexportedRuntimeFunction(\"convertU32PairToI53\",false);unexportedRuntimeFunction(\"dlopenMissingError\",false);unexportedRuntimeFunction(\"setImmediateWrapped\",false);unexportedRuntimeFunction(\"clearImmediateWrapped\",false);unexportedRuntimeFunction(\"polyfillSetImmediate\",false);unexportedRuntimeFunction(\"uncaughtExceptionCount\",false);unexportedRuntimeFunction(\"exceptionLast\",false);unexportedRuntimeFunction(\"exceptionCaught\",false);unexportedRuntimeFunction(\"ExceptionInfo\",false);unexportedRuntimeFunction(\"exception_addRef\",false);unexportedRuntimeFunction(\"exception_decRef\",false);unexportedRuntimeFunction(\"Browser\",false);unexportedRuntimeFunction(\"setMainLoop\",false);unexportedRuntimeFunction(\"wget\",false);unexportedRuntimeFunction(\"FS\",false);unexportedRuntimeFunction(\"MEMFS\",false);unexportedRuntimeFunction(\"TTY\",false);unexportedRuntimeFunction(\"PIPEFS\",false);unexportedRuntimeFunction(\"SOCKFS\",false);unexportedRuntimeFunction(\"_setNetworkCallback\",false);unexportedRuntimeFunction(\"tempFixedLengthArray\",false);unexportedRuntimeFunction(\"miniTempWebGLFloatBuffers\",false);unexportedRuntimeFunction(\"heapObjectForWebGLType\",false);unexportedRuntimeFunction(\"heapAccessShiftForWebGLHeap\",false);unexportedRuntimeFunction(\"GL\",false);unexportedRuntimeFunction(\"emscriptenWebGLGet\",false);unexportedRuntimeFunction(\"computeUnpackAlignedImageSize\",false);unexportedRuntimeFunction(\"emscriptenWebGLGetTexPixelData\",false);unexportedRuntimeFunction(\"emscriptenWebGLGetUniform\",false);unexportedRuntimeFunction(\"webglGetUniformLocation\",false);unexportedRuntimeFunction(\"webglPrepareUniformLocationsBeforeFirstUse\",false);unexportedRuntimeFunction(\"webglGetLeftBracePos\",false);unexportedRuntimeFunction(\"emscriptenWebGLGetVertexAttrib\",false);unexportedRuntimeFunction(\"writeGLArray\",false);unexportedRuntimeFunction(\"AL\",false);unexportedRuntimeFunction(\"SDL_unicode\",false);unexportedRuntimeFunction(\"SDL_ttfContext\",false);unexportedRuntimeFunction(\"SDL_audio\",false);unexportedRuntimeFunction(\"SDL\",false);unexportedRuntimeFunction(\"SDL_gfx\",false);unexportedRuntimeFunction(\"GLUT\",false);unexportedRuntimeFunction(\"EGL\",false);unexportedRuntimeFunction(\"GLFW_Window\",false);unexportedRuntimeFunction(\"GLFW\",false);unexportedRuntimeFunction(\"GLEW\",false);unexportedRuntimeFunction(\"IDBStore\",false);unexportedRuntimeFunction(\"runAndAbortIfError\",false);unexportedRuntimeFunction(\"InternalError\",false);unexportedRuntimeFunction(\"BindingError\",false);unexportedRuntimeFunction(\"UnboundTypeError\",false);unexportedRuntimeFunction(\"PureVirtualError\",false);unexportedRuntimeFunction(\"init_embind\",false);unexportedRuntimeFunction(\"throwInternalError\",false);unexportedRuntimeFunction(\"throwBindingError\",false);unexportedRuntimeFunction(\"throwUnboundTypeError\",false);unexportedRuntimeFunction(\"ensureOverloadTable\",false);unexportedRuntimeFunction(\"exposePublicSymbol\",false);unexportedRuntimeFunction(\"replacePublicSymbol\",false);unexportedRuntimeFunction(\"extendError\",false);unexportedRuntimeFunction(\"createNamedFunction\",false);unexportedRuntimeFunction(\"registeredInstances\",false);unexportedRuntimeFunction(\"getBasestPointer\",false);unexportedRuntimeFunction(\"registerInheritedInstance\",false);unexportedRuntimeFunction(\"unregisterInheritedInstance\",false);unexportedRuntimeFunction(\"getInheritedInstance\",false);unexportedRuntimeFunction(\"getInheritedInstanceCount\",false);unexportedRuntimeFunction(\"getLiveInheritedInstances\",false);unexportedRuntimeFunction(\"registeredTypes\",false);unexportedRuntimeFunction(\"awaitingDependencies\",false);unexportedRuntimeFunction(\"typeDependencies\",false);unexportedRuntimeFunction(\"registeredPointers\",false);unexportedRuntimeFunction(\"registerType\",false);unexportedRuntimeFunction(\"whenDependentTypesAreResolved\",false);unexportedRuntimeFunction(\"embind_charCodes\",false);unexportedRuntimeFunction(\"embind_init_charCodes\",false);unexportedRuntimeFunction(\"readLatin1String\",false);unexportedRuntimeFunction(\"getTypeName\",false);unexportedRuntimeFunction(\"heap32VectorToArray\",false);unexportedRuntimeFunction(\"requireRegisteredType\",false);unexportedRuntimeFunction(\"getShiftFromSize\",false);unexportedRuntimeFunction(\"integerReadValueFromPointer\",false);unexportedRuntimeFunction(\"enumReadValueFromPointer\",false);unexportedRuntimeFunction(\"floatReadValueFromPointer\",false);unexportedRuntimeFunction(\"simpleReadValueFromPointer\",false);unexportedRuntimeFunction(\"runDestructors\",false);unexportedRuntimeFunction(\"new_\",false);unexportedRuntimeFunction(\"craftInvokerFunction\",false);unexportedRuntimeFunction(\"embind__requireFunction\",false);unexportedRuntimeFunction(\"tupleRegistrations\",false);unexportedRuntimeFunction(\"structRegistrations\",false);unexportedRuntimeFunction(\"genericPointerToWireType\",false);unexportedRuntimeFunction(\"constNoSmartPtrRawPointerToWireType\",false);unexportedRuntimeFunction(\"nonConstNoSmartPtrRawPointerToWireType\",false);unexportedRuntimeFunction(\"init_RegisteredPointer\",false);unexportedRuntimeFunction(\"RegisteredPointer\",false);unexportedRuntimeFunction(\"RegisteredPointer_getPointee\",false);unexportedRuntimeFunction(\"RegisteredPointer_destructor\",false);unexportedRuntimeFunction(\"RegisteredPointer_deleteObject\",false);unexportedRuntimeFunction(\"RegisteredPointer_fromWireType\",false);unexportedRuntimeFunction(\"runDestructor\",false);unexportedRuntimeFunction(\"releaseClassHandle\",false);unexportedRuntimeFunction(\"finalizationRegistry\",false);unexportedRuntimeFunction(\"detachFinalizer_deps\",false);unexportedRuntimeFunction(\"detachFinalizer\",false);unexportedRuntimeFunction(\"attachFinalizer\",false);unexportedRuntimeFunction(\"makeClassHandle\",false);unexportedRuntimeFunction(\"init_ClassHandle\",false);unexportedRuntimeFunction(\"ClassHandle\",false);unexportedRuntimeFunction(\"ClassHandle_isAliasOf\",false);unexportedRuntimeFunction(\"throwInstanceAlreadyDeleted\",false);unexportedRuntimeFunction(\"ClassHandle_clone\",false);unexportedRuntimeFunction(\"ClassHandle_delete\",false);unexportedRuntimeFunction(\"deletionQueue\",false);unexportedRuntimeFunction(\"ClassHandle_isDeleted\",false);unexportedRuntimeFunction(\"ClassHandle_deleteLater\",false);unexportedRuntimeFunction(\"flushPendingDeletes\",false);unexportedRuntimeFunction(\"delayFunction\",false);unexportedRuntimeFunction(\"setDelayFunction\",false);unexportedRuntimeFunction(\"RegisteredClass\",false);unexportedRuntimeFunction(\"shallowCopyInternalPointer\",false);unexportedRuntimeFunction(\"downcastPointer\",false);unexportedRuntimeFunction(\"upcastPointer\",false);unexportedRuntimeFunction(\"validateThis\",false);unexportedRuntimeFunction(\"char_0\",false);unexportedRuntimeFunction(\"char_9\",false);unexportedRuntimeFunction(\"makeLegalFunctionName\",false);unexportedRuntimeFunction(\"emval_handle_array\",false);unexportedRuntimeFunction(\"emval_free_list\",false);unexportedRuntimeFunction(\"emval_symbols\",false);unexportedRuntimeFunction(\"init_emval\",false);unexportedRuntimeFunction(\"count_emval_handles\",false);unexportedRuntimeFunction(\"get_first_emval\",false);unexportedRuntimeFunction(\"getStringOrSymbol\",false);unexportedRuntimeFunction(\"Emval\",false);unexportedRuntimeFunction(\"emval_newers\",false);unexportedRuntimeFunction(\"craftEmvalAllocator\",false);unexportedRuntimeFunction(\"emval_get_global\",false);unexportedRuntimeFunction(\"emval_methodCallers\",false);unexportedRuntimeFunction(\"emval_registeredMethods\",false);unexportedRuntimeFunction(\"warnOnce\",false);unexportedRuntimeFunction(\"stackSave\",false);unexportedRuntimeFunction(\"stackRestore\",false);unexportedRuntimeFunction(\"stackAlloc\",false);unexportedRuntimeFunction(\"AsciiToString\",false);unexportedRuntimeFunction(\"stringToAscii\",false);unexportedRuntimeFunction(\"UTF16ToString\",false);unexportedRuntimeFunction(\"stringToUTF16\",false);unexportedRuntimeFunction(\"lengthBytesUTF16\",false);unexportedRuntimeFunction(\"UTF32ToString\",false);unexportedRuntimeFunction(\"stringToUTF32\",false);unexportedRuntimeFunction(\"lengthBytesUTF32\",false);unexportedRuntimeFunction(\"allocateUTF8\",false);unexportedRuntimeFunction(\"allocateUTF8OnStack\",false);Module[\"writeStackCookie\"]=writeStackCookie;Module[\"checkStackCookie\"]=checkStackCookie;unexportedRuntimeSymbol(\"ALLOC_NORMAL\",false);unexportedRuntimeSymbol(\"ALLOC_STACK\",false);var calledRun;function ExitStatus(status){this.name=\"ExitStatus\";this.message=\"Program terminated with exit(\"+status+\")\";this.status=status}dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function stackCheckInit(){_emscripten_stack_init();writeStackCookie()}function run(args){args=args||arguments_;if(runDependencies>0){return}stackCheckInit();preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module[\"calledRun\"]=true;if(ABORT)return;initRuntime();if(Module[\"onRuntimeInitialized\"])Module[\"onRuntimeInitialized\"]();assert(!Module[\"_main\"],'compiled without a main, but one is present. if you added it from JS, use Module[\"onRuntimeInitialized\"]');postRun()}if(Module[\"setStatus\"]){Module[\"setStatus\"](\"Running...\");setTimeout(function(){setTimeout(function(){Module[\"setStatus\"](\"\")},1);doRun()},1)}else{doRun()}checkStackCookie()}Module[\"run\"]=run;function checkUnflushedContent(){var oldOut=out;var oldErr=err;var has=false;out=err=(x=>{has=true});try{___stdio_exit();[\"stdout\",\"stderr\"].forEach(function(name){var info=FS.analyzePath(\"/dev/\"+name);if(!info)return;var stream=info.object;var rdev=stream.rdev;var tty=TTY.ttys[rdev];if(tty&&tty.output&&tty.output.length){has=true}})}catch(e){}out=oldOut;err=oldErr;if(has){warnOnce(\"stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the FAQ), or make sure to emit a newline when you printf etc.\")}}function procExit(code){EXITSTATUS=code;if(!keepRuntimeAlive()){if(Module[\"onExit\"])Module[\"onExit\"](code);ABORT=true}quit_(code,new ExitStatus(code))}if(Module[\"preInit\"]){if(typeof Module[\"preInit\"]==\"function\")Module[\"preInit\"]=[Module[\"preInit\"]];while(Module[\"preInit\"].length>0){Module[\"preInit\"].pop()()}}run();module.exports=Module;\n","export default (gl, openWebglAlignment) => {\n var vertexShaderScript = [\n 'attribute vec4 vertexPos;',\n 'attribute vec4 texturePos;',\n 'varying vec2 textureCoord;',\n\n 'void main()',\n '{',\n 'gl_Position = vertexPos;',\n 'textureCoord = texturePos.xy;',\n '}'\n ].join('\\n');\n\n var fragmentShaderScript = [\n 'precision highp float;',\n 'varying highp vec2 textureCoord;',\n 'uniform sampler2D ySampler;',\n 'uniform sampler2D uSampler;',\n 'uniform sampler2D vSampler;',\n 'const mat4 YUV2RGB = mat4',\n '(',\n '1.1643828125, 0, 1.59602734375, -.87078515625,',\n '1.1643828125, -.39176171875, -.81296875, .52959375,',\n '1.1643828125, 2.017234375, 0, -1.081390625,',\n '0, 0, 0, 1',\n ');',\n\n 'void main(void) {',\n 'highp float y = texture2D(ySampler, textureCoord).r;',\n 'highp float u = texture2D(uSampler, textureCoord).r;',\n 'highp float v = texture2D(vSampler, textureCoord).r;',\n 'gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;',\n '}'\n ].join('\\n');\n\n if (openWebglAlignment) {\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);\n }\n var vertexShader = gl.createShader(gl.VERTEX_SHADER);\n gl.shaderSource(vertexShader, vertexShaderScript);\n gl.compileShader(vertexShader);\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {\n console.log('Vertex shader failed to compile: ' + gl.getShaderInfoLog(vertexShader));\n }\n\n var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\n gl.shaderSource(fragmentShader, fragmentShaderScript);\n gl.compileShader(fragmentShader);\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {\n console.log('Fragment shader failed to compile: ' + gl.getShaderInfoLog(fragmentShader));\n }\n\n var program = gl.createProgram();\n gl.attachShader(program, vertexShader);\n gl.attachShader(program, fragmentShader);\n gl.linkProgram(program);\n if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n console.log('Program failed to compile: ' + gl.getProgramInfoLog(program));\n }\n\n gl.useProgram(program);\n\n // initBuffers\n var vertexPosBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, vertexPosBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW);\n\n var vertexPosRef = gl.getAttribLocation(program, 'vertexPos');\n gl.enableVertexAttribArray(vertexPosRef);\n gl.vertexAttribPointer(vertexPosRef, 2, gl.FLOAT, false, 0, 0);\n\n var texturePosBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, texturePosBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 0, 0, 0, 1, 1, 0, 1]), gl.STATIC_DRAW);\n\n var texturePosRef = gl.getAttribLocation(program, 'texturePos');\n gl.enableVertexAttribArray(texturePosRef);\n gl.vertexAttribPointer(texturePosRef, 2, gl.FLOAT, false, 0, 0);\n\n function _initTexture(name, index) {\n var textureRef = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, textureRef);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.uniform1i(gl.getUniformLocation(program, name), index);\n return textureRef;\n }\n\n var yTextureRef = _initTexture('ySampler', 0);\n var uTextureRef = _initTexture('uSampler', 1);\n var vTextureRef = _initTexture('vSampler', 2);\n\n return {\n render: function (w, h, y, u, v) {\n gl.viewport(0, 0, w, h);\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, yTextureRef);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, w, h, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, y);\n gl.activeTexture(gl.TEXTURE1);\n gl.bindTexture(gl.TEXTURE_2D, uTextureRef);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, w / 2, h / 2, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, u);\n gl.activeTexture(gl.TEXTURE2);\n gl.bindTexture(gl.TEXTURE_2D, vTextureRef);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, w / 2, h / 2, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, v);\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);\n },\n destroy: function () {\n try {\n gl.deleteProgram(program);\n\n gl.deleteBuffer(vertexPosBuffer)\n gl.deleteBuffer(texturePosBuffer);\n\n gl.deleteTexture(yTextureRef);\n gl.deleteTexture(uTextureRef);\n gl.deleteTexture(vTextureRef);\n } catch (e) {\n // console.error(e);\n }\n\n }\n }\n};\n","// 播放协议\nexport const PLAYER_PLAY_PROTOCOL = {\n websocket: 0,\n fetch: 1,\n webrtc: 2,\n}\n\nexport const DEMUX_TYPE = {\n flv: 'flv',\n m7s: 'm7s'\n}\n\nexport const FILE_SUFFIX = {\n mp4: 'mp4',\n webm: 'webm'\n};\n\nexport const MEDIA_SOURCE_UPDATE_END_TIMEOUT = 10 * 1000\n\nexport const CONTAINER_DATA_SET_KEY = 'jessibuca'\n\nexport const VERSION = '__VERSION__'\n\n\n// default player options\nexport const DEFAULT_PLAYER_OPTIONS = {\n videoBuffer: 1000, //1000ms 1 second\n videoBufferDelay: 1000,// 1000ms\n isResize: true,\n isFullResize: false, //\n isFlv: false,\n debug: false,\n hotKey: false, // 快捷键\n loadingTimeout: 10, // loading timeout\n heartTimeout: 5, // heart timeout\n timeout: 10, // second\n loadingTimeoutReplay: true, // loading timeout replay. default is true\n heartTimeoutReplay: true,// heart timeout replay.\n loadingTimeoutReplayTimes: 3, // loading timeout replay fail times\n heartTimeoutReplayTimes: 3, // heart timeout replay fail times\n supportDblclickFullscreen: false, // support double click toggle fullscreen\n showBandwidth: false, // show band width\n keepScreenOn: false, //\n isNotMute: false, //\n hasAudio: true, // has audio\n hasVideo: true, // has video\n operateBtns: {\n fullscreen: false,\n screenshot: false,\n play: false,\n audio: false,\n record: false,\n },\n controlAutoHide: false, // control auto hide\n hasControl: false,\n loadingText: '', // loading Text\n background: '',\n decoder: 'decoder.js',\n url: '',// play url\n rotate: 0, //\n // text: '',\n forceNoOffscreen: true, // 默认是不采用\n hiddenAutoPause: false, //\n protocol: PLAYER_PLAY_PROTOCOL.fetch,\n demuxType: DEMUX_TYPE.flv, // demux type\n useWCS: false, //\n wcsUseVideoRender: false,// 默认设置为true\n useMSE: false, //\n useOffscreen: false, //\n autoWasm: true, // 自动降级到 wasm 模式\n wasmDecodeErrorReplay: true, // 解码失败重新播放。\n openWebglAlignment: false,// https://github.com/langhuihui/jessibuca/issues/152\n wasmDecodeAudioSyncVideo: false,// wasm 解码之后音视频同步\n recordType: FILE_SUFFIX.webm,\n useWebFullScreen: false, // use web full screen\n initDecoderWorkerTimeout: 10 //\n}\n\n\nexport const WORKER_CMD_TYPE = {\n init: 'init',\n initVideo: 'initVideo',\n render: 'render',\n playAudio: 'playAudio',\n initAudio: 'initAudio',\n kBps: 'kBps',\n decode: 'decode',\n audioCode: 'audioCode',\n videoCode: 'videoCode',\n wasmError: 'wasmError'\n}\n\nexport const WASM_ERROR = {\n invalidNalUnitSize: 'Invalid NAL unit size',\n // errorSplittingTheInputIntoNALUnits: 'Error splitting the input into NAL units'\n}\n\nexport const MEDIA_TYPE = {\n audio: 1,\n video: 2\n}\n\nexport const FLV_MEDIA_TYPE = {\n audio: 8,\n video: 9\n}\n\nexport const WORKER_SEND_TYPE = {\n init: 'init',\n decode: 'decode',\n audioDecode: 'audioDecode',\n videoDecode: 'videoDecode',\n close: 'close',\n updateConfig: 'updateConfig'\n}\n\n\n//\nexport const EVENTS = {\n fullscreen: 'fullscreen$2',\n webFullscreen: 'webFullscreen',\n decoderWorkerInit: 'decoderWorkerInit',\n play: 'play',\n playing: 'playing',\n pause: 'pause',\n mute: 'mute',\n load: 'load',\n loading: 'loading',\n videoInfo: 'videoInfo',\n timeUpdate: 'timeUpdate',\n audioInfo: \"audioInfo\",\n log: 'log',\n error: \"error\",\n kBps: 'kBps',\n timeout: 'timeout',\n delayTimeout: 'delayTimeout',\n loadingTimeout: 'loadingTimeout',\n stats: 'stats',\n performance: \"performance\",\n record: 'record',\n recording: 'recording',\n recordingTimestamp: 'recordingTimestamp',\n recordStart: 'recordStart',\n recordEnd: 'recordEnd',\n recordCreateError: 'recordCreateError',\n buffer: 'buffer',\n videoFrame: 'videoFrame',\n start: 'start',\n metadata: 'metadata',\n resize: 'resize',\n streamEnd: 'streamEnd',\n streamSuccess: 'streamSuccess',\n streamMessage: 'streamMessage',\n streamError: 'streamError',\n volumechange: 'volumechange',\n volume: 'volume',\n destroy: 'destroy',\n mseSourceOpen: 'mseSourceOpen',\n mseSourceClose: 'mseSourceClose',\n mseSourceBufferError: 'mseSourceBufferError',\n mseSourceBufferBusy: 'mseSourceBufferBusy',\n mseSourceBufferFull: 'mseSourceBufferFull',\n videoWaiting: 'videoWaiting',\n videoTimeUpdate: 'videoTimeUpdate',\n videoSyncAudio: 'videoSyncAudio',\n playToRenderTimes: 'playToRenderTimes'\n}\n\n\nexport const JESSIBUCA_EVENTS = {\n load: EVENTS.load,\n timeUpdate: EVENTS.timeUpdate,\n videoInfo: EVENTS.videoInfo,\n audioInfo: EVENTS.audioInfo,\n error: EVENTS.error,\n kBps: EVENTS.kBps,\n log: EVENTS.log,\n start: EVENTS.start,\n timeout: EVENTS.timeout,\n loadingTimeout: EVENTS.loadingTimeout,\n delayTimeout: EVENTS.delayTimeout,\n fullscreen: 'fullscreen',\n webFullscreen: EVENTS.webFullscreen,\n play: EVENTS.play,\n pause: EVENTS.pause,\n mute: EVENTS.mute,\n stats: EVENTS.stats,\n volumechange: EVENTS.volumechange,\n performance: EVENTS.performance,\n recordingTimestamp: EVENTS.recordingTimestamp,\n recordStart: EVENTS.recordStart,\n recordEnd: EVENTS.recordEnd,\n playToRenderTimes: EVENTS.playToRenderTimes,\n volume: EVENTS.volume\n}\n\nexport const EVENTS_ERROR = {\n playError: 'playIsNotPauseOrUrlIsNull',\n fetchError: \"fetchError\",\n websocketError: 'websocketError',\n webcodecsH265NotSupport: 'webcodecsH265NotSupport',\n webcodecsConfigureError: 'webcodecsConfigureError',\n webcodecsDecodeError: 'webcodecsDecodeError',\n webcodecsWidthOrHeightChange: 'webcodecsWidthOrHeightChange',\n mediaSourceH265NotSupport: 'mediaSourceH265NotSupport',\n mediaSourceFull: EVENTS.mseSourceBufferFull,\n mseSourceBufferError: EVENTS.mseSourceBufferError,\n mediaSourceAppendBufferError: 'mediaSourceAppendBufferError',\n mediaSourceBufferListLarge: 'mediaSourceBufferListLarge',\n mediaSourceAppendBufferEndTimeout: 'mediaSourceAppendBufferEndTimeout',\n wasmDecodeError: 'wasmDecodeError',\n webglAlignmentError: 'webglAlignmentError'\n}\n\n\nexport const WEBSOCKET_STATUS = {\n notConnect: 'notConnect',\n open: 'open',\n close: 'close',\n error: 'error'\n}\n\nexport const BUFFER_STATUS = {\n empty: 'empty',\n buffering: 'buffering',\n full: 'full'\n}\n\n\nexport const SCREENSHOT_TYPE = {\n download: 'download',\n base64: 'base64',\n blob: 'blob'\n}\n\n\nexport const VIDEO_ENC_TYPE = {\n 7: 'H264(AVC)', //\n 12: 'H265(HEVC)' //\n}\n\nexport const VIDEO_ENC_CODE = {\n h264: 7,\n h265: 12\n}\n\n\nexport const AUDIO_ENC_TYPE = {\n 10: 'AAC',\n 7: 'ALAW',\n 8: 'MULAW'\n}\n\nexport const H265_NAL_TYPE = {\n vps: 32,\n sps: 33,\n pps: 34\n}\n\nexport const CONTROL_HEIGHT = 38\n\nexport const SCALE_MODE_TYPE = {\n full: 0, // 视频画面完全填充canvas区域,画面会被拉伸\n auto: 1, // 视频画面做等比缩放后,高或宽对齐canvas区域,画面不被拉伸,但有黑边\n fullAuto: 2 // 视频画面做等比缩放后,完全填充canvas区域,画面不被拉伸,没有黑边,但画面显示不全\n}\n\n\nexport const CANVAS_RENDER_TYPE = {\n webcodecs: 'webcodecs',\n webgl: 'webgl',\n offscreen: 'offscreen'\n}\n\nexport const ENCODED_VIDEO_TYPE = {\n key: 'key',\n delta: 'delta'\n}\n\n\nexport const MP4_CODECS = {\n avc: 'video/mp4; codecs=\"avc1.64002A\"',\n hev: 'video/mp4; codecs=\"hev1.1.6.L123.b0\"',\n}\n\n\nexport const MEDIA_SOURCE_STATE = {\n ended: 'ended',\n open: 'open',\n closed: 'closed'\n}\n\n\n// frag duration\nexport const FRAG_DURATION = Math.ceil(1000 / 25)\n\n\nexport const AUDIO_SYNC_VIDEO_DIFF = 1000;\n\n\nexport const HOT_KEY = {\n esc: 27, //\n arrowUp: 38, //\n arrowDown: 40, //\n}\nexport const WCS_ERROR = {\n keyframeIsRequiredError: 'A key frame is required after configure() or flush()',\n canNotDecodeClosedCodec: \"Cannot call 'decode' on a closed codec\"\n}\n\n\nexport const FETCH_ERROR = {\n abortError1: 'The user aborted a request',\n abortError2: 'AbortError',\n abort: 'AbortError'\n}\n\nexport const FRAME_HEADER_EX = 0x80\n\n\nexport const PACKET_TYPE_EX = {\n PACKET_TYPE_SEQ_START: 0,\n PACKET_TYPE_FRAMES: 1,\n PACKET_TYPE_FRAMESX: 3,\n};\n\n\nexport const FRAME_TYPE_EX = {\n FT_KEY: 0x10,\n FT_INTER: 0x20\n};\n\n\n\n","/*!\n* screenfull\n* v5.1.0 - 2020-12-24\n* (c) Sindre Sorhus; MIT License\n*/\n(function () {\n\t'use strict';\n\n\tvar document = typeof window !== 'undefined' && typeof window.document !== 'undefined' ? window.document : {};\n\tvar isCommonjs = typeof module !== 'undefined' && module.exports;\n\n\tvar fn = (function () {\n\t\tvar val;\n\n\t\tvar fnMap = [\n\t\t\t[\n\t\t\t\t'requestFullscreen',\n\t\t\t\t'exitFullscreen',\n\t\t\t\t'fullscreenElement',\n\t\t\t\t'fullscreenEnabled',\n\t\t\t\t'fullscreenchange',\n\t\t\t\t'fullscreenerror'\n\t\t\t],\n\t\t\t// New WebKit\n\t\t\t[\n\t\t\t\t'webkitRequestFullscreen',\n\t\t\t\t'webkitExitFullscreen',\n\t\t\t\t'webkitFullscreenElement',\n\t\t\t\t'webkitFullscreenEnabled',\n\t\t\t\t'webkitfullscreenchange',\n\t\t\t\t'webkitfullscreenerror'\n\n\t\t\t],\n\t\t\t// Old WebKit\n\t\t\t[\n\t\t\t\t'webkitRequestFullScreen',\n\t\t\t\t'webkitCancelFullScreen',\n\t\t\t\t'webkitCurrentFullScreenElement',\n\t\t\t\t'webkitCancelFullScreen',\n\t\t\t\t'webkitfullscreenchange',\n\t\t\t\t'webkitfullscreenerror'\n\n\t\t\t],\n\t\t\t[\n\t\t\t\t'mozRequestFullScreen',\n\t\t\t\t'mozCancelFullScreen',\n\t\t\t\t'mozFullScreenElement',\n\t\t\t\t'mozFullScreenEnabled',\n\t\t\t\t'mozfullscreenchange',\n\t\t\t\t'mozfullscreenerror'\n\t\t\t],\n\t\t\t[\n\t\t\t\t'msRequestFullscreen',\n\t\t\t\t'msExitFullscreen',\n\t\t\t\t'msFullscreenElement',\n\t\t\t\t'msFullscreenEnabled',\n\t\t\t\t'MSFullscreenChange',\n\t\t\t\t'MSFullscreenError'\n\t\t\t]\n\t\t];\n\n\t\tvar i = 0;\n\t\tvar l = fnMap.length;\n\t\tvar ret = {};\n\n\t\tfor (; i < l; i++) {\n\t\t\tval = fnMap[i];\n\t\t\tif (val && val[1] in document) {\n\t\t\t\tfor (i = 0; i < val.length; i++) {\n\t\t\t\t\tret[fnMap[0][i]] = val[i];\n\t\t\t\t}\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t})();\n\n\tvar eventNameMap = {\n\t\tchange: fn.fullscreenchange,\n\t\terror: fn.fullscreenerror\n\t};\n\n\tvar screenfull = {\n\t\trequest: function (element, options) {\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\tvar onFullScreenEntered = function () {\n\t\t\t\t\tthis.off('change', onFullScreenEntered);\n\t\t\t\t\tresolve();\n\t\t\t\t}.bind(this);\n\n\t\t\t\tthis.on('change', onFullScreenEntered);\n\n\t\t\t\telement = element || document.documentElement;\n\n\t\t\t\tvar returnPromise = element[fn.requestFullscreen](options);\n\n\t\t\t\tif (returnPromise instanceof Promise) {\n\t\t\t\t\treturnPromise.then(onFullScreenEntered).catch(reject);\n\t\t\t\t}\n\t\t\t}.bind(this));\n\t\t},\n\t\texit: function () {\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\tif (!this.isFullscreen) {\n\t\t\t\t\tresolve();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar onFullScreenExit = function () {\n\t\t\t\t\tthis.off('change', onFullScreenExit);\n\t\t\t\t\tresolve();\n\t\t\t\t}.bind(this);\n\n\t\t\t\tthis.on('change', onFullScreenExit);\n\n\t\t\t\tvar returnPromise = document[fn.exitFullscreen]();\n\n\t\t\t\tif (returnPromise instanceof Promise) {\n\t\t\t\t\treturnPromise.then(onFullScreenExit).catch(reject);\n\t\t\t\t}\n\t\t\t}.bind(this));\n\t\t},\n\t\ttoggle: function (element, options) {\n\t\t\treturn this.isFullscreen ? this.exit() : this.request(element, options);\n\t\t},\n\t\tonchange: function (callback) {\n\t\t\tthis.on('change', callback);\n\t\t},\n\t\tonerror: function (callback) {\n\t\t\tthis.on('error', callback);\n\t\t},\n\t\ton: function (event, callback) {\n\t\t\tvar eventName = eventNameMap[event];\n\t\t\tif (eventName) {\n\t\t\t\tdocument.addEventListener(eventName, callback, false);\n\t\t\t}\n\t\t},\n\t\toff: function (event, callback) {\n\t\t\tvar eventName = eventNameMap[event];\n\t\t\tif (eventName) {\n\t\t\t\tdocument.removeEventListener(eventName, callback, false);\n\t\t\t}\n\t\t},\n\t\traw: fn\n\t};\n\n\tif (!fn) {\n\t\tif (isCommonjs) {\n\t\t\tmodule.exports = {isEnabled: false};\n\t\t} else {\n\t\t\twindow.screenfull = {isEnabled: false};\n\t\t}\n\n\t\treturn;\n\t}\n\n\tObject.defineProperties(screenfull, {\n\t\tisFullscreen: {\n\t\t\tget: function () {\n\t\t\t\treturn Boolean(document[fn.fullscreenElement]);\n\t\t\t}\n\t\t},\n\t\telement: {\n\t\t\tenumerable: true,\n\t\t\tget: function () {\n\t\t\t\treturn document[fn.fullscreenElement];\n\t\t\t}\n\t\t},\n\t\tisEnabled: {\n\t\t\tenumerable: true,\n\t\t\tget: function () {\n\t\t\t\t// Coerce to boolean in case of old WebKit\n\t\t\t\treturn Boolean(document[fn.fullscreenEnabled]);\n\t\t\t}\n\t\t}\n\t});\n\n\tif (isCommonjs) {\n\t\tmodule.exports = screenfull;\n\t} else {\n\t\twindow.screenfull = screenfull;\n\t}\n})();\n","import {MP4_CODECS, FILE_SUFFIX} from \"../constant\";\nimport screenfull from \"screenfull\";\n\nexport function noop() {\n}\n\n\nexport function supportOffscreen($canvas) {\n return typeof $canvas.transferControlToOffscreen === 'function';\n}\n\n\nexport function supportOffscreenV2() {\n return typeof OffscreenCanvas !== \"undefined\";\n}\n\n\nexport function createContextGL($canvas) {\n let gl = null;\n\n const validContextNames = [\"webgl\", \"experimental-webgl\", \"moz-webgl\", \"webkit-3d\"];\n let nameIndex = 0;\n\n while (!gl && nameIndex < validContextNames.length) {\n const contextName = validContextNames[nameIndex];\n\n try {\n let contextOptions = {preserveDrawingBuffer: true};\n gl = $canvas.getContext(contextName, contextOptions);\n } catch (e) {\n gl = null;\n }\n\n if (!gl || typeof gl.getParameter !== \"function\") {\n gl = null;\n }\n\n ++nameIndex;\n }\n\n\n return gl;\n}\n\n\nexport function audioContextUnlock(context) {\n context.resume();\n const source = context.createBufferSource();\n source.buffer = context.createBuffer(1, 1, 22050);\n source.connect(context.destination);\n if (source.noteOn) {\n source.noteOn(0);\n } else {\n source.start(0);\n }\n}\n\nexport function dataURLToFile(dataURL = '') {\n const arr = dataURL.split(\",\");\n const bstr = atob(arr[1]);\n const type = arr[0].replace(\"data:\", \"\").replace(\";base64\", \"\")\n let n = bstr.length, u8arr = new Uint8Array(n);\n while (n--) {\n u8arr[n] = bstr.charCodeAt(n);\n }\n return new File([u8arr], 'file', {type});\n}\n\nexport function downloadFile(file, fileName) {\n if (file instanceof Blob || file instanceof File) {\n file = new Blob([file]);\n }\n const aLink = document.createElement(\"a\");\n aLink.download = fileName;\n aLink.href = file;\n aLink.click();\n}\n\n\nexport function downloadImg(content, fileName) {\n const aLink = document.createElement(\"a\");\n aLink.download = fileName;\n const href = URL.createObjectURL(content);\n aLink.href = href;\n aLink.click();\n setTimeout(() => {\n URL.revokeObjectURL(href);\n }, isIOS() ? 1000 : 0)\n}\n\nexport function checkFull() {\n let isFull = document.fullscreenElement || window.webkitFullscreenElement || document.msFullscreenElement;\n if (isFull === undefined) isFull = false;\n return !!isFull;\n}\n\nexport function now() {\n return new Date().getTime();\n}\n\nexport const supportedWasm = (() => {\n try {\n if (typeof WebAssembly === \"object\"\n && typeof WebAssembly.instantiate === \"function\") {\n const module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));\n if (module instanceof WebAssembly.Module)\n return new WebAssembly.Instance(module) instanceof WebAssembly.Instance;\n }\n } catch (e) {\n }\n return false;\n})();\n\nexport function clamp(num, a, b) {\n return Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b));\n}\n\nexport function setStyle(element, key, value) {\n if (!element) {\n return\n }\n if (typeof key === 'object') {\n Object.keys(key).forEach(item => {\n setStyle(element, item, key[item]);\n });\n }\n element.style[key] = value;\n return element;\n}\n\n\nexport function getStyle(element, key, numberType = true) {\n if (!element) {\n return 0\n }\n\n const value = getComputedStyle(element, null).getPropertyValue(key);\n return numberType ? parseFloat(value) : value;\n}\n\nexport function getNowTime() {\n if (performance && typeof performance.now === 'function') {\n return performance.now();\n }\n return Date.now();\n}\n\nexport function calculationRate(callback) {\n let totalSize = 0;\n let lastTime = getNowTime();\n return size => {\n totalSize += size;\n const thisTime = getNowTime();\n const diffTime = thisTime - lastTime;\n if (diffTime >= 1000) {\n callback((totalSize / diffTime) * 1000);\n lastTime = thisTime;\n totalSize = 0;\n }\n };\n}\n\nexport function downloadRecord(blob, name, suffix) {\n const url = window.URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = (name || now()) + '.' + (suffix || FILE_SUFFIX.webm);\n a.click();\n setTimeout(() => {\n window.URL.revokeObjectURL(url);\n }, isIOS() ? 1000 : 0)\n}\n\nexport const env = '__ENV__';\n\nexport function isMobile() {\n return (/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase()));\n}\n\nexport function isPad(){\n return (/ipad|android(?!.*mobile)|tablet|kindle|silk/i.test(window.navigator.userAgent.toLowerCase()));\n}\n\nexport function isAndroid() {\n const UA = window.navigator.userAgent.toLowerCase();\n return (/android/i.test(UA));\n}\n\nexport function isIOS() {\n const UA = window.navigator.userAgent.toLowerCase();\n return UA && /iphone|ipad|ipod|ios/.test(UA);\n}\n\n\nexport function parseTime(time, cFormat) {\n if (arguments.length === 0) {\n return null\n }\n var format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'\n var date;\n if (typeof time === 'object') {\n date = time\n } else {\n if (('' + time).length === 10) time = parseInt(time) * 1000;\n time = +time; // 转成int 型\n date = new Date(time)\n }\n var formatObj = {\n y: date.getFullYear(),\n m: date.getMonth() + 1,\n d: date.getDate(),\n h: date.getHours(),\n i: date.getMinutes(),\n s: date.getSeconds(),\n a: date.getDay()\n };\n var time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {\n var value = formatObj[key]\n if (key === 'a') return ['一', '二', '三', '四', '五', '六', '日'][value - 1]\n if (result.length > 0 && value < 10) {\n value = '0' + value\n }\n return value || 0\n });\n return time_str\n}\n\n// 是否支持 webcodecs\nexport function supportWCS() {\n return \"VideoEncoder\" in window;\n}\n\nexport function toNumber(value) {\n if (typeof value !== 'string') {\n return value;\n } else {\n // 转换成 number 类型\n var parsed = Number(value);\n return isNaN(parsed) ? value : parsed;\n }\n}\n\nexport function uuid16() {\n return 'xxxxxxxxxxxx4xxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8)\n return v.toString(16)\n })\n}\n\nexport function throttle(callback, delay) {\n let isThrottled = false;\n let args;\n let context;\n\n function fn(...args2) {\n if (isThrottled) {\n args = args2;\n context = this;\n return;\n }\n\n isThrottled = true;\n callback.apply(this, args2);\n setTimeout(() => {\n isThrottled = false;\n if (args) {\n fn.apply(context, args);\n args = null;\n context = null;\n }\n }, delay);\n }\n\n return fn;\n}\n\n\nexport function isDef(v) {\n return v !== undefined && v !== null;\n}\n\nexport function formatVideoDecoderConfigure(avcC) {\n let codecArray = avcC.subarray(1, 4);\n let codecString = \"avc1.\";\n for (let j = 0; j < 3; j++) {\n let h = codecArray[j].toString(16);\n if (h.length < 2) {\n h = \"0\" + h\n }\n codecString += h\n }\n\n return {\n codec: codecString,\n description: avcC\n }\n}\n\nexport function isFullScreen() {\n return screenfull.isFullscreen\n}\n\nexport function bpsSize(value) {\n if (null == value || value === '' || parseInt(value) === 0 || isNaN(parseInt(value))) {\n return \"0KB/s\";\n }\n let size = parseFloat(value);\n size = size.toFixed(2);\n return size + 'KB/s';\n}\n\n\nexport function fpsStatus(fps) {\n let result = 0;\n if (fps >= 24) {\n result = 2;\n } else if (fps >= 15) {\n result = 1;\n }\n\n return result;\n}\n\nexport function createEmptyImageBitmap(width, height) {\n const $canvasElement = document.createElement(\"canvas\");\n $canvasElement.width = width;\n $canvasElement.height = height;\n return window.createImageBitmap($canvasElement, 0, 0, width, height);\n}\n\n\nexport function supportMSE() {\n return window.MediaSource && window.MediaSource.isTypeSupported(MP4_CODECS.avc);\n}\n\nexport function supportMediaStreamTrack() {\n return window.MediaStreamTrackGenerator && typeof window.MediaStreamTrackGenerator === 'function'\n}\n\n\nexport function formatMp4VideoCodec(codec) {\n return `video/mp4; codecs=\"${codec}\"`\n}\n\n\nexport function saveBlobToFile(fileName, blob) {\n let url = window.URL.createObjectURL(blob);\n let aLink = window.document.createElement('a');\n aLink.download = fileName;\n aLink.href = url;\n //创建内置事件并触发\n let evt = window.document.createEvent('MouseEvents');\n evt.initEvent(\"click\", true, true); //initEvent 不加后两个参数在FF下会报错 事件类型,是否冒泡,是否阻止浏览器的默认行为\n aLink.dispatchEvent(evt);\n setTimeout(() => {\n window.URL.revokeObjectURL(url);\n }, isIOS() ? 1000 : 0)\n}\n\nexport function isEmpty(value) {\n return value === null || value === undefined\n}\n\nexport function isBoolean(value) {\n return value === true || value === false;\n}\n\nexport function isNotEmpty(value) {\n return !isEmpty(value)\n}\n\nexport function initPlayTimes() {\n return {\n playInitStart: '', //1\n playStart: '', // 2\n streamStart: '', //3\n streamResponse: '', // 4\n demuxStart: '', // 5\n decodeStart: '', // 6\n videoStart: '', // 7\n playTimestamp: '',// playStart- playInitStart\n streamTimestamp: '',// streamStart - playStart\n streamResponseTimestamp: '',// streamResponse - streamStart\n demuxTimestamp: '', // demuxStart - streamResponse\n decodeTimestamp: '', // decodeStart - demuxStart\n videoTimestamp: '',// videoStart - decodeStart\n allTimestamp: '' // videoStart - playInitStart\n }\n}\n\n// create watermark\nexport function createWatermark(options) {\n let defaultConfig = {\n container: '',\n left: '',\n right: '',\n top: '',\n bottom: '',\n image: {\n src: '',\n width: '100',\n height: '60',\n },\n text: {\n content: '',\n fontSize: '14',\n color: '#000'\n },\n }\n defaultConfig = Object.assign(defaultConfig, options)\n\n const $container = defaultConfig.container;\n\n if ($container) {\n return\n }\n\n let shadowRoot = null;\n const otDiv = document.createElement('div');\n otDiv.setAttribute('style', 'pointer-events: none !important; display: block !important');\n\n if (typeof otDiv.attachShadow === \"function\") {\n shadowRoot = otDiv.attachShadow({mode: 'open'});\n } else if (otDiv.shadowRoot) {\n shadowRoot = otDiv.shadowRoot;\n } else {\n shadowRoot = otDiv;\n }\n\n const nodeList = $container.children;\n const index = Math.floor(Math.random() * (nodeList.length - 1));\n\n if (nodeList[index]) {\n $container.insertBefore(otDiv, nodeList[index]);\n } else {\n $container.appendChild(otDiv);\n }\n\n\n const maskDiv = document.createElement('div');\n let innerDom = null;\n if (defaultConfig.text && defaultConfig.text.content) {\n innerDom = document.createTextNode(defaultConfig.text);\n } else if (defaultConfig.image && defaultConfig.image.src) {\n innerDom = document.createElement('img')\n innerDom.style.height = '100%'\n innerDom.style.width = '100%'\n innerDom.src = defaultConfig.image.src;\n }\n\n if (!innerDom) {\n return;\n }\n\n maskDiv.appendChild(innerDom);\n\n maskDiv.style.visibility = '';\n maskDiv.style.position = \"absolute\";\n maskDiv.style.display = 'block'\n maskDiv.style['-ms-user-select'] = \"none\";\n maskDiv.style.left = defaultConfig.left;\n maskDiv.style.right = defaultConfig.right;\n maskDiv.style.top = defaultConfig.top;\n maskDiv.style.bottom = defaultConfig.bottom;\n maskDiv.style.overflow = 'hidden';\n maskDiv.style.zIndex = \"9999999\";\n if (defaultConfig.text && defaultConfig.text.content) {\n maskDiv.style.fontSize = defaultConfig.text.fontSize;\n maskDiv.style.color = defaultConfig.text.color;\n } else if (defaultConfig.image && defaultConfig.image.src) {\n maskDiv.style.width = defaultConfig.image.width + 'px';\n maskDiv.style.height = defaultConfig.image.height + 'px';\n }\n\n shadowRoot.appendChild(maskDiv)\n\n // remove function\n return () => {\n $container.removeChild(otDiv);\n }\n}\n\nexport function formatTimeTips(time) {\n var result;\n\n //\n if (time > -1) {\n var hour = Math.floor(time / 3600);\n var min = Math.floor(time / 60) % 60;\n var sec = time % 60;\n\n sec = Math.round(sec);\n\n if (hour < 10) {\n result = '0' + hour + \":\";\n } else {\n result = hour + \":\";\n }\n\n if (min < 10) {\n result += \"0\";\n }\n result += min + \":\";\n if (sec < 10) {\n result += \"0\";\n }\n result += sec.toFixed(0);\n }\n\n return result;\n}\n\nexport function getTarget(e) {\n const event = e || window.event;\n const target = event.target || event.srcElement;\n return target;\n}\n\nexport function isWebglRenderSupport(width) {\n return (width / 2) % 4 === 0\n}\n\nexport function isGreenYUV(arrayBuffer) {\n let zeroNum = 0;\n for (let i = 0; i < 10; i++) {\n let temp = arrayBuffer[i];\n if (temp === 0) {\n zeroNum += 1\n }\n }\n return zeroNum === 10;\n}\n\nexport function getBrowser() {\n const UserAgent = navigator.userAgent.toLowerCase();\n const browserInfo = {};\n const browserArray = {\n IE: window.ActiveXObject || \"ActiveXObject\" in window, // IE\n Chrome: UserAgent.indexOf('chrome') > -1 && UserAgent.indexOf('safari') > -1, // Chrome浏览器\n Firefox: UserAgent.indexOf('firefox') > -1, // 火狐浏览器\n Opera: UserAgent.indexOf('opera') > -1, // Opera浏览器\n Safari: UserAgent.indexOf('safari') > -1 && UserAgent.indexOf('chrome') == -1, // safari浏览器\n Edge: UserAgent.indexOf('edge') > -1, // Edge浏览器\n QQBrowser: /qqbrowser/.test(UserAgent), // qq浏览器\n WeixinBrowser: /MicroMessenger/i.test(UserAgent) // 微信浏览器\n };\n // console.log(browserArray)\n for (let i in browserArray) {\n if (browserArray[i]) {\n let versions = '';\n if (i === 'IE') {\n versions = UserAgent.match(/(msie\\s|trident.*rv:)([\\w.]+)/)[2];\n } else if (i === 'Chrome') {\n for (let mt in navigator.mimeTypes) {\n //检测是否是360浏览器(测试只有pc端的360才起作用)\n if (navigator.mimeTypes[mt]['type'] === 'application/360softmgrplugin') {\n i = '360';\n }\n }\n versions = UserAgent.match(/chrome\\/([\\d.]+)/)[1];\n } else if (i === 'Firefox') {\n versions = UserAgent.match(/firefox\\/([\\d.]+)/)[1];\n } else if (i === 'Opera') {\n versions = UserAgent.match(/opera\\/([\\d.]+)/)[1];\n } else if (i === 'Safari') {\n versions = UserAgent.match(/version\\/([\\d.]+)/)[1];\n } else if (i === 'Edge') {\n versions = UserAgent.match(/edge\\/([\\d.]+)/)[1];\n } else if (i === 'QQBrowser') {\n versions = UserAgent.match(/qqbrowser\\/([\\d.]+)/)[1];\n }\n browserInfo.type = i;\n browserInfo.version = parseInt(versions);\n }\n }\n return browserInfo;\n}\n\n\nexport function closeVideoFrame(videoFrame) {\n if (videoFrame.close) {\n videoFrame.close()\n } else if (videoFrame.destroy) {\n videoFrame.destroy()\n }\n}\n\n\nexport function removeElement(element) {\n let result = false;\n if (element) {\n if (element.parentNode) {\n element.parentNode.removeChild(element);\n result = true;\n }\n }\n return result;\n}\n\nexport function hevcEncoderNalePacketNotLength(oneNALBuffer, isIframe) {\n const idrBit = 0x10 | 12;\n const nIdrBit = 0x20 | 12;\n let tmp = [];\n if (isIframe) {\n tmp[0] = idrBit;\n } else {\n tmp[0] = nIdrBit;\n }\n tmp[1] = 1;\n //\n tmp[2] = 0;\n tmp[3] = 0;\n tmp[4] = 0;\n\n const arrayBuffer = new Uint8Array(tmp.length + oneNALBuffer.byteLength);\n arrayBuffer.set(tmp, 0);\n arrayBuffer.set(oneNALBuffer, tmp.length);\n return arrayBuffer;\n}\n\n\nexport function isTrue(value) {\n return value === true || value === 'true';\n}\n\nexport function isFalse(value) {\n return value !== true && value !== 'true';\n}\n\nexport function getElementDataset(element, key) {\n if (!element) {\n return '';\n }\n\n if (element.dataset) {\n return element.dataset[key];\n }\n return element.getAttribute('data-' + key);\n}\n\nexport function setElementDataset(element, key, value) {\n if (!element) {\n return;\n }\n\n if (element.dataset) {\n element.dataset[key] = value;\n } else {\n element.setAttribute('data-' + key, value);\n }\n}\n\nexport function removeElementDataset(element, key) {\n if (!element) {\n return;\n }\n\n if (element.dataset) {\n delete element.dataset[key];\n } else {\n element.removeAttribute('data-' + key);\n }\n}\n","import Module from './decoder/decoder';\nimport createWebGL from './utils/webgl';\nimport {WORKER_CMD_TYPE, MEDIA_TYPE, WORKER_SEND_TYPE, ENCODED_VIDEO_TYPE, DEFAULT_PLAYER_OPTIONS} from \"./constant\";\nimport {formatVideoDecoderConfigure, isGreenYUV} from \"./utils\";\n\nif (!Date.now) Date.now = function () {\n return new Date().getTime();\n};\n\nModule.postRun = function () {\n var buffer = [];\n var tempAudioBuffer = [];\n var wcsVideoDecoder = {};\n if (\"VideoEncoder\" in self) {\n wcsVideoDecoder = {\n hasInit: false,\n isEmitInfo: false,\n offscreenCanvas: null,\n offscreenCanvasCtx: null,\n decoder: new VideoDecoder({\n output: function (videoFrame) {\n if (!wcsVideoDecoder.isEmitInfo) {\n decoder.opt.debug && console.log('Jb: [worker] Webcodecs Video Decoder initSize');\n postMessage({\n cmd: WORKER_CMD_TYPE.initVideo,\n w: videoFrame.codedWidth,\n h: videoFrame.codedHeight\n });\n wcsVideoDecoder.isEmitInfo = true;\n wcsVideoDecoder.offscreenCanvas = new OffscreenCanvas(videoFrame.codedWidth, videoFrame.codedHeight);\n wcsVideoDecoder.offscreenCanvasCtx = wcsVideoDecoder.offscreenCanvas.getContext(\"2d\");\n }\n\n wcsVideoDecoder.offscreenCanvasCtx.drawImage(videoFrame, 0, 0, videoFrame.codedWidth, videoFrame.codedHeight);\n let image_bitmap = wcsVideoDecoder.offscreenCanvas.transferToImageBitmap();\n postMessage({\n cmd: WORKER_CMD_TYPE.render,\n buffer: image_bitmap,\n delay: decoder.delay,\n ts: 0\n }, [image_bitmap]);\n\n setTimeout(function () {\n if (videoFrame.close) {\n videoFrame.close();\n } else {\n videoFrame.destroy();\n }\n }, 100);\n\n },\n error: function (error) {\n console.error(error);\n }\n }),\n decode: function (payload, ts) {\n const isIFrame = payload[0] >> 4 === 1;\n if (!wcsVideoDecoder.hasInit) {\n if (isIFrame && payload[1] === 0) {\n const videoCodec = (payload[0] & 0x0F);\n decoder.setVideoCodec(videoCodec);\n const config = formatVideoDecoderConfigure(payload.slice(5));\n wcsVideoDecoder.decoder.configure(config);\n wcsVideoDecoder.hasInit = true;\n }\n } else {\n const chunk = new EncodedVideoChunk({\n data: payload.slice(5),\n timestamp: ts,\n type: isIFrame ? ENCODED_VIDEO_TYPE.key : ENCODED_VIDEO_TYPE.delta\n });\n wcsVideoDecoder.decoder.decode(chunk);\n }\n },\n reset() {\n wcsVideoDecoder.hasInit = false;\n wcsVideoDecoder.isEmitInfo = false;\n wcsVideoDecoder.offscreenCanvas = null;\n wcsVideoDecoder.offscreenCanvasCtx = null;\n }\n };\n }\n\n var decoder = {\n opt: {\n debug: DEFAULT_PLAYER_OPTIONS.debug,\n useOffscreen: DEFAULT_PLAYER_OPTIONS.useOffscreen,\n useWCS: DEFAULT_PLAYER_OPTIONS.useWCS,\n videoBuffer: DEFAULT_PLAYER_OPTIONS.videoBuffer,\n openWebglAlignment: DEFAULT_PLAYER_OPTIONS.openWebglAlignment,\n videoBufferDelay: DEFAULT_PLAYER_OPTIONS.videoBufferDelay\n },\n useOffscreen: function () {\n return decoder.opt.useOffscreen && typeof OffscreenCanvas != 'undefined';\n },\n initAudioPlanar: function (channels, samplerate) {\n postMessage({cmd: WORKER_CMD_TYPE.initAudio, sampleRate: samplerate, channels: channels});\n var outputArray = [];\n var remain = 0;\n this.playAudioPlanar = function (data, len, ts) {\n var frameCount = len;\n var origin = [];\n var start = 0;\n for (var channel = 0; channel < 2; channel++) {\n var fp = Module.HEAPU32[(data >> 2) + channel] >> 2;\n origin[channel] = Module.HEAPF32.subarray(fp, fp + frameCount);\n }\n if (remain) {\n len = 1024 - remain;\n if (frameCount >= len) {\n outputArray[0] = Float32Array.of(...tempAudioBuffer[0], ...origin[0].subarray(0, len));\n if (channels == 2) {\n outputArray[1] = Float32Array.of(...tempAudioBuffer[1], ...origin[1].subarray(0, len));\n }\n postMessage({\n cmd: WORKER_CMD_TYPE.playAudio,\n buffer: outputArray,\n ts\n }, outputArray.map(x => x.buffer));\n start = len;\n frameCount -= len;\n } else {\n remain += frameCount;\n tempAudioBuffer[0] = Float32Array.of(...tempAudioBuffer[0], ...origin[0]);\n if (channels == 2) {\n tempAudioBuffer[1] = Float32Array.of(...tempAudioBuffer[1], ...origin[1]);\n }\n return;\n }\n }\n for (remain = frameCount; remain >= 1024; remain -= 1024) {\n outputArray[0] = origin[0].slice(start, start += 1024);\n if (channels == 2) {\n outputArray[1] = origin[1].slice(start - 1024, start);\n }\n postMessage({\n cmd: WORKER_CMD_TYPE.playAudio,\n buffer: outputArray,\n ts\n }, outputArray.map(x => x.buffer));\n }\n if (remain) {\n tempAudioBuffer[0] = origin[0].slice(start);\n if (channels == 2) {\n tempAudioBuffer[1] = origin[1].slice(start);\n }\n }\n };\n },\n setVideoCodec: function (code) {\n postMessage({cmd: WORKER_CMD_TYPE.videoCode, code});\n },\n setAudioCodec: function (code) {\n postMessage({cmd: WORKER_CMD_TYPE.audioCode, code});\n },\n setVideoSize: function (w, h) {\n postMessage({cmd: WORKER_CMD_TYPE.initVideo, w: w, h: h});\n var size = w * h;\n var qsize = size >> 2;\n if (decoder.useOffscreen()) {\n this.offscreenCanvas = new OffscreenCanvas(w, h);\n this.offscreenCanvasGL = this.offscreenCanvas.getContext(\"webgl\");\n this.webglObj = createWebGL(this.offscreenCanvasGL, decoder.opt.openWebglAlignment);\n this.draw = function (ts, y, u, v) {\n const yData = Module.HEAPU8.subarray(y, y + size);\n const uData = Module.HEAPU8.subarray(u, u + qsize);\n const vData = Module.HEAPU8.subarray(v, v + (qsize));\n // if (isGreenYUV(Uint8Array.from(yData))) {\n // decoder.opt.debug && console.log('Jb: [worker]: draw offscreenCanvas is green yuv');\n // return\n // }\n\n this.webglObj.render(w, h, yData, uData, vData);\n let image_bitmap = this.offscreenCanvas.transferToImageBitmap();\n postMessage({\n cmd: WORKER_CMD_TYPE.render,\n buffer: image_bitmap,\n delay: this.delay,\n ts\n }, [image_bitmap]);\n };\n } else {\n this.draw = function (ts, y, u, v) {\n const yData = Uint8Array.from(Module.HEAPU8.subarray(y, y + size));\n const uData = Uint8Array.from(Module.HEAPU8.subarray(u, u + qsize));\n const vData = Uint8Array.from(Module.HEAPU8.subarray(v, v + (qsize)));\n // if (isGreenYUV(yData)) {\n // decoder.opt.debug && console.log('Jb: [worker]: draw is green yuv');\n // return\n // }\n const outputArray = [yData, uData, vData];\n postMessage({\n cmd: WORKER_CMD_TYPE.render,\n output: outputArray,\n delay: this.delay,\n ts\n }, outputArray.map(x => x.buffer));\n };\n }\n },\n getDelay: function (timestamp) {\n if (!timestamp) {\n return -1;\n }\n if (!this.firstTimestamp) {\n this.firstTimestamp = timestamp;\n this.startTimestamp = Date.now();\n this.delay = -1;\n } else {\n\n if (timestamp) {\n const localTimestamp = (Date.now() - this.startTimestamp);\n const timeTimestamp = (timestamp - this.firstTimestamp);\n if (localTimestamp >= timeTimestamp) {\n this.delay = localTimestamp - timeTimestamp;\n } else {\n this.delay = timeTimestamp - localTimestamp;\n }\n }\n }\n return this.delay;\n },\n resetDelay: function () {\n this.firstTimestamp = null;\n this.startTimestamp = null;\n this.delay = -1;\n },\n\n init: function () {\n decoder.opt.debug && console.log('Jb: [worker] init');\n const _doDecode = (data) => {\n // decoder.opt.debug && console.log('Jb: [worker]: _doDecode');\n if (decoder.opt.useWCS && decoder.useOffscreen() && data.type === MEDIA_TYPE.video && wcsVideoDecoder.decode) {\n wcsVideoDecoder.decode(data.payload, data.ts);\n } else {\n // decoder.opt.debug && console.log('Jb: [worker]: _doDecode wasm');\n data.decoder.decode(data.payload, data.ts);\n }\n };\n const loop = () => {\n if (buffer.length) {\n if (this.dropping) {\n // // dropping\n data = buffer.shift();\n //\n if (data.type === MEDIA_TYPE.audio && data.payload[1] === 0) {\n _doDecode(data);\n }\n while (!data.isIFrame && buffer.length) {\n // dropping\n data = buffer.shift();\n //\n if (data.type === MEDIA_TYPE.audio && data.payload[1] === 0) {\n _doDecode(data);\n }\n }\n if (data.isIFrame) {\n this.dropping = false;\n _doDecode(data);\n }\n } else {\n var data = buffer[0];\n if (this.getDelay(data.ts) === -1) {\n // decoder.opt.debug && console.log('Jb: [worker]: common dumex delay is -1');\n buffer.shift();\n _doDecode(data);\n } else if (this.delay > decoder.opt.videoBuffer + decoder.opt.videoBufferDelay) {\n // decoder.opt.debug && console.log('Jb: [worker]:', `delay is ${this.delay}, set dropping is true`);\n this.resetDelay();\n this.dropping = true;\n } else {\n while (buffer.length) {\n data = buffer[0];\n if (this.getDelay(data.ts) > decoder.opt.videoBuffer) {\n // decoder.opt.debug && console.log('Jb: [worker]:', `delay is ${this.delay}, decode`);\n buffer.shift();\n _doDecode(data);\n } else {\n // decoder.opt.debug && console.log('Jb: [worker]:', `delay is ${this.delay},opt.videoBuffer is ${decoder.opt.videoBuffer}`);\n break;\n }\n }\n }\n }\n }\n else {\n }\n };\n this.stopId = setInterval(loop, 10);\n },\n close: function () {\n decoder.opt.debug && console.log('Jb: [worker]: close');\n clearInterval(this.stopId);\n this.stopId = null;\n audioDecoder.clear && audioDecoder.clear();\n videoDecoder.clear && videoDecoder.clear();\n wcsVideoDecoder.reset && wcsVideoDecoder.reset();\n this.firstTimestamp = null;\n this.startTimestamp = null;\n this.delay = -1;\n this.dropping = false;\n\n if (this.webglObj) {\n this.webglObj.destroy();\n this.offscreenCanvas = null;\n this.offscreenCanvasGL = null;\n this.offscreenCanvasCtx = null;\n }\n buffer = [];\n tempAudioBuffer = [];\n delete this.playAudioPlanar;\n delete this.draw;\n },\n pushBuffer: function (bufferData, options) {\n // 音频\n if (options.type === MEDIA_TYPE.audio) {\n buffer.push({\n ts: options.ts,\n payload: bufferData,\n decoder: audioDecoder,\n type: MEDIA_TYPE.audio,\n });\n } else if (options.type === MEDIA_TYPE.video) {\n buffer.push({\n ts: options.ts,\n payload: bufferData,\n decoder: videoDecoder,\n type: MEDIA_TYPE.video,\n isIFrame: options.isIFrame\n });\n }\n }\n };\n var audioDecoder = new Module.AudioDecoder(decoder);\n var videoDecoder = new Module.VideoDecoder(decoder);\n postMessage({cmd: WORKER_SEND_TYPE.init});\n self.onmessage = function (event) {\n var msg = event.data;\n switch (msg.cmd) {\n case WORKER_SEND_TYPE.init:\n try {\n decoder.opt = Object.assign(decoder.opt, JSON.parse(msg.opt));\n } catch (e) {\n\n }\n audioDecoder.sample_rate = msg.sampleRate;\n decoder.init();\n break;\n case WORKER_SEND_TYPE.decode:\n decoder.pushBuffer(msg.buffer, msg.options);\n break;\n case WORKER_SEND_TYPE.audioDecode:\n audioDecoder.decode(msg.buffer, msg.ts);\n break;\n case WORKER_SEND_TYPE.videoDecode:\n videoDecoder.decode(msg.buffer, msg.ts);\n break;\n case WORKER_SEND_TYPE.close:\n decoder.close();\n break;\n case WORKER_SEND_TYPE.updateConfig:\n decoder.opt[msg.key] = msg.value;\n break;\n }\n };\n};\n"],"names":["Module","print","text","console","log","printErr","warn","postMessage","cmd","message","moduleOverrides","Object","assign","thisProgram","ENVIRONMENT_IS_WEB","window","ENVIRONMENT_IS_WORKER","importScripts","ENVIRONMENT_IS_NODE","process","versions","node","ENVIRONMENT_IS_SHELL","Error","scriptDirectory","locateFile","path","read_","readAsync","readBinary","fs","nodePath","requireNodeFS","require","require$$0","dirname","__dirname","require$$1","shell_read","filename","binary","readFileSync","undefined","ret","buffer","Uint8Array","assert","onload","onerror","readFile","err","data","length","replace","arguments_","slice","module","ex","ExitStatus","reason","read","f","readbuffer","setTimeout","scriptArgs","error","self","location","href","document","currentScript","src","indexOf","substr","lastIndexOf","url","xhr","XMLHttpRequest","open","send","responseText","responseType","response","status","out","bind","checkIncomingModuleAPI","legacyModuleProp","quit_","warnOnce","shown","prop","newName","getOwnPropertyDescriptor","defineProperty","configurable","get","abort","ignoredModuleProp","unexportedMessage","sym","isFSSybol","msg","unexportedRuntimeSymbol","unexportedRuntimeFunction","wasmBinary","WebAssembly","wasmMemory","ABORT","condition","UTF8Decoder","TextDecoder","UTF8ArrayToString","heapOrArray","idx","maxBytesToRead","endIdx","endPtr","decode","subarray","str","u0","String","fromCharCode","u1","u2","toString","ch","UTF8ToString","ptr","HEAPU8","stringToUTF8Array","heap","outIdx","maxBytesToWrite","startIdx","i","u","charCodeAt","stringToUTF8","outPtr","lengthBytesUTF8","len","UTF16Decoder","UTF16ToString","maxIdx","HEAPU16","codeUnit","HEAP16","stringToUTF16","startPtr","numCharsToWrite","lengthBytesUTF16","UTF32ToString","utf32","HEAP32","stringToUTF32","trailSurrogate","lengthBytesUTF32","allocateUTF8","size","_malloc","HEAP8","writeAsciiToMemory","dontAddNull","HEAPU32","HEAPF32","HEAPF64","updateGlobalBufferAndViews","buf","Int8Array","Int16Array","Int32Array","Uint16Array","Uint32Array","Float32Array","Float64Array","TOTAL_STACK","INITIAL_MEMORY","prototype","set","wasmTable","writeStackCookie","max","_emscripten_stack_get_end","checkStackCookie","cookie1","cookie2","h16","h8","__ATPRERUN__","__ATINIT__","__ATPOSTRUN__","runtimeInitialized","preRun","addOnPreRun","shift","callRuntimeCallbacks","initRuntime","FS","init","initialized","ignorePermissions","postRun","addOnPostRun","cb","unshift","addOnInit","Math","imul","fround","clz32","trunc","runDependencies","runDependencyWatcher","dependenciesFulfilled","runDependencyTracking","getUniqueRunDependency","id","orig","random","addRunDependency","setInterval","clearInterval","dep","removeRunDependency","callback","what","e","RuntimeError","dataURIPrefix","isDataURI","startsWith","isFileURI","createExportWrapper","name","fixedasm","displayName","asm","apply","arguments","wasmBinaryFile","getBinary","file","getBinaryPromise","fetch","credentials","then","catch","Promise","resolve","reject","createWasm","info","asmLibraryArg","receiveInstance","instance","exports","trueModule","receiveInstantiationResult","result","instantiateArrayBuffer","receiver","instantiate","instantiateAsync","instantiateStreaming","tempDouble","tempI64","callbacks","func","arg","getWasmTableEntry","demangle","demangleAll","regex","x","y","funcPtr","jsStackTrace","stack","setErrNo","value","___errno_location","PATH","isAbs","charAt","splitPath","splitPathRe","exec","normalizeArray","parts","allowAboveRoot","up","last","splice","normalize","isAbsolute","trailingSlash","split","filter","p","join","root","dir","basename","lastSlash","paths","Array","call","join2","l","r","getRandomDevice","crypto","randomBuffer","getRandomValues","crypto_module","require$$2","PATH_FS","resolvedPath","resolvedAbsolute","cwd","TypeError","relative","from","to","trim","arr","start","end","fromParts","toParts","min","samePartsLength","outputParts","push","concat","TTY","ttys","shutdown","register","dev","ops","input","output","registerDevice","stream_ops","stream","tty","rdev","ErrnoError","seekable","close","flush","offset","pos","get_char","bytesRead","timestamp","Date","now","write","put_char","default_tty_ops","BUFSIZE","Buffer","alloc","readSync","stdin","fd","includes","prompt","readline","intArrayFromString","val","default_tty1_ops","zeroMemory","address","fill","alignMemory","alignment","ceil","mmapAlloc","_emscripten_builtin_memalign","MEMFS","ops_table","mount","createNode","parent","mode","isBlkdev","isFIFO","getattr","node_ops","setattr","lookup","mknod","rename","unlink","rmdir","readdir","symlink","llseek","allocate","mmap","msync","link","readlink","chrdev","chrdev_stream_ops","isDir","contents","isFile","usedBytes","isLink","isChrdev","getFileDataAsTypedArray","expandFileStorage","newCapacity","prevCapacity","CAPACITY_DOUBLING_MAX","oldContents","resizeFileStorage","newSize","attr","ino","nlink","uid","gid","atime","mtime","ctime","blksize","blocks","genericErrors","old_node","new_dir","new_name","new_node","lookupNode","entries","key","hasOwnProperty","newname","oldpath","position","canOwn","ArrayBuffer","whence","prot","flags","allocated","byteOffset","mmapFlags","asyncLoad","noRunDep","arrayBuffer","event","ERRNO_MESSAGES","ERRNO_CODES","mounts","devices","streams","nextInode","nameTable","currentPath","filesystems","syncFSRequests","lookupPath","opts","defaults","follow_mount","recurse_count","current","current_path","islast","isMountpoint","mounted","follow","count","getPath","isRoot","mountpoint","hashName","parentid","hash","hashAddNode","name_next","hashRemoveNode","errCode","mayLookup","nodeName","FSNode","destroyNode","isSocket","flagModes","modeStringToFlags","flagsToPermissionString","flag","perms","nodePermissions","mayCreate","mayDelete","isdir","errno","mayOpen","MAX_OPEN_FDS","nextfd","fd_start","fd_end","getStream","createStream","FSStream","shared","object","isRead","isWrite","isAppend","function","closeStream","device","getDevice","major","minor","makedev","ma","mi","getMounts","check","m","pop","syncfs","populate","completed","doCallback","done","errored","forEach","type","pseudo","mountRoot","unmount","keys","next","create","mkdir","mkdirTree","dirs","d","mkdev","newpath","old_path","new_path","old_dirname","new_dirname","old_name","old_dir","stat","dontFollow","lstat","chmod","lchmod","fchmod","chown","lchown","fchown","truncate","ftruncate","utime","created","ungotten","readFiles","isClosed","getdents","seeking","bytesWritten","munmap","ioctl","encoding","writeFile","actualNumBytes","isView","byteLength","chdir","createDefaultDirectories","createDefaultDevices","random_device","createDevice","createSpecialDirectories","proc_self","createStandardStreams","stdout","stderr","ensureErrnoError","setErrno","code","writable","constructor","staticInit","quit","___stdio_exit","getMode","canRead","canWrite","findObject","dontResolveLastLink","analyzePath","exists","parentExists","parentPath","parentObject","createPath","reverse","part","createFile","properties","createDataFile","forceLoadFile","obj","isDevice","isFolder","createLazyFile","LazyUint8Array","lengthKnown","chunks","LazyUint8Array_get","chunkOffset","chunkSize","chunkNum","getter","setDataGetter","LazyUint8Array_setDataGetter","cacheLength","LazyUint8Array_cacheLength","datalength","Number","getResponseHeader","header","hasByteServing","usesGzip","doXHR","setRequestHeader","overrideMimeType","lazyArray","_length","_chunkSize","defineProperties","fn","forceLoadLazyFile","createPreloadedFile","dontCreateFile","preFinish","fullname","processData","byteArray","finish","Browser","handledByPreloadPlugin","indexedDB","mozIndexedDB","webkitIndexedDB","msIndexedDB","DB_NAME","pathname","DB_VERSION","DB_STORE_NAME","saveFilesToDB","openRequest","onupgradeneeded","db","createObjectStore","onsuccess","transaction","files","objectStore","ok","fail","total","putRequest","put","loadFilesFromDB","getRequest","absolutePath","createFolder","createLink","joinPath","standardizePath","SYSCALLS","DEFAULT_POLLMASK","calculateAt","dirfd","allowEmpty","dirstream","doStat","abs","floor","getTime","doMsync","addr","doMknod","doReadlink","bufsize","endChar","doAccess","amode","doReadv","iov","iovcnt","curr","doWritev","varargs","getStr","getStreamFromFD","___syscall_fcntl64","newStream","___syscall_openat","__embind_register_bigint","primitiveType","minRange","maxRange","getShiftFromSize","embind_init_charCodes","codes","embind_charCodes","readLatin1String","c","awaitingDependencies","registeredTypes","typeDependencies","char_0","char_9","makeLegalFunctionName","createNamedFunction","body","Function","extendError","baseErrorType","errorName","errorClass","BindingError","throwBindingError","InternalError","throwInternalError","whenDependentTypesAreResolved","myTypes","dependentTypes","getTypeConverters","onComplete","typeConverters","myTypeConverters","registerType","unregisteredTypes","registered","dt","rawType","registeredInstance","options","ignoreDuplicateRegistrations","__embind_register_bool","trueValue","falseValue","wt","destructors","o","pointer","destructorFunction","ClassHandle_isAliasOf","other","ClassHandle","leftClass","$$","ptrType","registeredClass","left","rightClass","right","baseClass","upcast","shallowCopyInternalPointer","deleteScheduled","preservePointerOnDelete","smartPtr","smartPtrType","throwInstanceAlreadyDeleted","getInstanceTypeName","handle","finalizationRegistry","detachFinalizer","runDestructor","rawDestructor","releaseClassHandle","toDelete","downcastPointer","ptrClass","desiredClass","rv","downcast","registeredPointers","getInheritedInstanceCount","registeredInstances","getLiveInheritedInstances","k","deletionQueue","flushPendingDeletes","delayFunction","setDelayFunction","init_embind","getBasestPointer","class_","getInheritedInstance","makeClassHandle","record","hasSmartPtrType","hasSmartPtr","attachFinalizer","RegisteredPointer_fromWireType","rawPointer","getPointee","destructor","makeDefaultHandle","isSmartPointer","instancePrototype","pointeeType","actualType","getActualType","registeredPointerRecord","toType","isConst","constPointerType","pointerType","dp","FinalizationRegistry","leakWarning","cls","captureStackTrace","unregister","ClassHandle_clone","clone","getPrototypeOf","ClassHandle_delete","ClassHandle_isDeleted","ClassHandle_deleteLater","init_ClassHandle","ensureOverloadTable","proto","methodName","humanName","overloadTable","prevFunc","argCount","exposePublicSymbol","numArguments","RegisteredClass","pureVirtualFunctions","upcastPointer","constNoSmartPtrRawPointerToWireType","isReference","_embind_repr","handleClass","genericPointerToWireType","rawConstructor","sharingPolicy","clonedHandle","rawShare","Emval","toHandle","nonConstNoSmartPtrRawPointerToWireType","simpleReadValueFromPointer","RegisteredPointer_getPointee","rawGetPointee","RegisteredPointer_destructor","RegisteredPointer_deleteObject","init_RegisteredPointer","RegisteredPointer","replacePublicSymbol","dynCallLegacy","sig","args","substring","dynCall","getDynCaller","argCache","embind__requireFunction","signature","rawFunction","makeDynCaller","fp","UnboundTypeError","getTypeName","___getTypeName","_free","throwUnboundTypeError","types","unboundTypes","seen","visit","map","__embind_register_class","rawPointerType","rawConstPointerType","baseClassRawType","getActualTypeSignature","upcastSignature","downcastSignature","destructorSignature","legalFunctionName","base","basePrototype","constructor_body","referenceConverter","pointerConverter","constPointerConverter","heap32VectorToArray","firstElement","array","runDestructors","del","__embind_register_class_constructor","rawClassType","rawArgTypesAddr","invokerSignature","invoker","rawArgTypes","classType","argTypes","craftInvokerFunction","new_","argumentList","dummy","cppInvokerFunc","cppTargetFunc","isClassMethodFunc","needsDestructorStack","returns","argsList","argsListWired","invokerFnBody","dtorStack","args1","args2","paramName","invokerFunction","__embind_register_class_function","rawInvoker","context","isPureVirtual","Symbol","unboundTypesHandler","method","className","memberFunction","validateThis","this_","__embind_register_class_property","fieldName","getterReturnType","getterSignature","getterContext","setterArgumentType","setterSignature","setter","setterContext","desc","enumerable","v","emval_free_list","emval_handle_array","__emval_decref","refcount","count_emval_handles","get_first_emval","init_emval","toValue","__embind_register_emval","t","floatReadValueFromPointer","__embind_register_float","integerReadValueFromPointer","signed","readS8FromPointer","readU8FromPointer","readS16FromPointer","readU16FromPointer","readS32FromPointer","readU32FromPointer","__embind_register_integer","fromWireType","bitshift","isUnsignedType","checkAssertions","toTypeName","toWireType","__embind_register_memory_view","dataTypeIndex","typeMapping","TA","decodeMemoryView","__embind_register_std_string","stdStringIsUTF8","decodeStartPtr","currentBytePtr","maxRead","stringSegment","a","getLength","valueIsOfTypeString","Uint8ClampedArray","charCode","__embind_register_std_wstring","charSize","decodeString","encodeString","getHeap","lengthBytesUTF","HEAP","maxReadBytes","__embind_register_void","isVoid","__emscripten_date_now","requireRegisteredType","impl","__emval_as","returnType","destructorsRef","rd","emval_symbols","getStringOrSymbol","symbol","emval_methodCallers","__emval_call_void_method","caller","__emval_addMethodCaller","__emval_lookupTypes","emval_registeredMethods","__emval_get_method_caller","retType","signatureName","returnId","params","functionName","functionBody","__emval_incref","__emval_run_destructors","__emval_take_value","argv","__gmtime_js","time","tmPtr","date","getUTCSeconds","getUTCMinutes","getUTCHours","getUTCDate","getUTCMonth","getUTCFullYear","getUTCDay","UTC","yday","__localtime_js","getSeconds","getMinutes","getHours","getDate","getMonth","getFullYear","getDay","getTimezoneOffset","summerOffset","winterOffset","dst","__mktime_js","guessedOffset","dstOffset","nonDstOffset","trueOffset","setTime","_tzset_impl","timezone","daylight","tzname","currentYear","winter","summer","stdTimezoneOffset","extractZone","match","toTimeString","winterName","summerName","winterNamePtr","summerNamePtr","__tzset_js","called","_abort","reallyNegative","Infinity","convertI32PairToI53","lo","hi","convertU32PairToI53","reSign","bits","half","pow","unSign","formatString","format","textIndex","argIndex","prepVararg","getNextArg","currArg","startTextIndex","flagAlwaysSigned","flagLeftAlign","flagAlternative","flagZeroPad","flagPadSign","flagsLoop","width","precisionSet","precision","precisionChr","argSize","nextNext","argText","limit","currAbsArg","prefix","parseInt","toUpperCase","chr","isNaN","isFinite","isGeneral","effectivePrecision","exponent","toExponential","test","toFixed","argLength","_strlen","traverseStack","callee","funcname","first","_emscripten_get_callstack_js","callstack","iThisFunc","iThisFunc2","iNextLine","emscripten_source_map","stack_args","lines","newFirefoxRe","RegExp","firefoxRe","chromeRe","line","symbolName","lineno","column","haveSourceMap","originalPositionFor","source","_emscripten_log_js","debug","_emscripten_log","_emscripten_get_heap_max","emscripten_realloc_buffer","grow","_emscripten_resize_heap","requestedSize","oldSize","maxHeapSize","alignUp","multiple","cutDown","overGrownHeapSize","replacement","ENV","getExecutableName","getEnvStrings","strings","lang","navigator","languages","env","_environ_get","__environ","environ_buf","bufSize","string","_environ_sizes_get","penviron_count","penviron_buf_size","_fd_close","_fd_fdstat_get","pbuf","_fd_read","pnum","num","_fd_seek","offset_low","offset_high","newOffset","HIGH_OFFSET","DOUBLE_LIMIT","_fd_write","_setTempRet0","readMode","writeMode","stringy","u8array","numBytesWritten","_emscripten_stack_init","calledRun","runCaller","run","stackCheckInit","doRun","gl","openWebglAlignment","vertexShaderScript","fragmentShaderScript","pixelStorei","UNPACK_ALIGNMENT","vertexShader","createShader","VERTEX_SHADER","shaderSource","compileShader","getShaderParameter","COMPILE_STATUS","getShaderInfoLog","fragmentShader","FRAGMENT_SHADER","program","createProgram","attachShader","linkProgram","getProgramParameter","LINK_STATUS","getProgramInfoLog","useProgram","vertexPosBuffer","createBuffer","bindBuffer","ARRAY_BUFFER","bufferData","STATIC_DRAW","vertexPosRef","getAttribLocation","enableVertexAttribArray","vertexAttribPointer","FLOAT","texturePosBuffer","texturePosRef","_initTexture","index","textureRef","createTexture","bindTexture","TEXTURE_2D","texParameteri","TEXTURE_MAG_FILTER","LINEAR","TEXTURE_MIN_FILTER","TEXTURE_WRAP_S","CLAMP_TO_EDGE","TEXTURE_WRAP_T","uniform1i","getUniformLocation","yTextureRef","uTextureRef","vTextureRef","render","w","h","viewport","activeTexture","TEXTURE0","texImage2D","LUMINANCE","UNSIGNED_BYTE","TEXTURE1","TEXTURE2","drawArrays","TRIANGLE_STRIP","destroy","deleteProgram","deleteBuffer","deleteTexture","PLAYER_PLAY_PROTOCOL","websocket","webrtc","DEMUX_TYPE","flv","m7s","FILE_SUFFIX","mp4","webm","DEFAULT_PLAYER_OPTIONS","videoBuffer","videoBufferDelay","isResize","isFullResize","isFlv","hotKey","loadingTimeout","heartTimeout","timeout","loadingTimeoutReplay","heartTimeoutReplay","loadingTimeoutReplayTimes","heartTimeoutReplayTimes","supportDblclickFullscreen","showBandwidth","keepScreenOn","isNotMute","hasAudio","hasVideo","operateBtns","fullscreen","screenshot","play","audio","controlAutoHide","hasControl","loadingText","background","decoder","rotate","forceNoOffscreen","hiddenAutoPause","protocol","demuxType","useWCS","wcsUseVideoRender","useMSE","useOffscreen","autoWasm","wasmDecodeErrorReplay","wasmDecodeAudioSyncVideo","recordType","useWebFullScreen","initDecoderWorkerTimeout","WORKER_CMD_TYPE","initVideo","playAudio","initAudio","kBps","audioCode","videoCode","wasmError","MEDIA_TYPE","video","WORKER_SEND_TYPE","audioDecode","videoDecode","updateConfig","ENCODED_VIDEO_TYPE","delta","of","Instance","formatVideoDecoderConfigure","avcC","codecArray","codecString","j","codec","description","tempAudioBuffer","wcsVideoDecoder","hasInit","isEmitInfo","offscreenCanvas","offscreenCanvasCtx","VideoDecoder","videoFrame","opt","codedWidth","codedHeight","OffscreenCanvas","getContext","drawImage","image_bitmap","transferToImageBitmap","delay","ts","payload","isIFrame","videoCodec","setVideoCodec","config","configure","chunk","EncodedVideoChunk","reset","initAudioPlanar","channels","samplerate","sampleRate","outputArray","remain","playAudioPlanar","frameCount","origin","channel","setAudioCodec","setVideoSize","qsize","offscreenCanvasGL","webglObj","createWebGL","draw","yData","uData","vData","getDelay","firstTimestamp","startTimestamp","localTimestamp","timeTimestamp","resetDelay","_doDecode","loop","dropping","stopId","audioDecoder","clear","videoDecoder","pushBuffer","AudioDecoder","onmessage","JSON","parse","sample_rate"],"mappings":";;;;;;;;;;;;;;;;;;;;;CAAA,MAAIA,MAAM,GAAC,OAAOA,MAAP,IAAe,WAAf,GAA2BA,MAA3B,GAAkC,EAA7C;CAAgD,MAAIA,MAAM,GAAC,EAAX;;CAAcA,EAAAA,MAAM,CAACC,KAAP,GAAa,UAASC,IAAT,EAAc;CAACC,IAAAA,OAAO,CAACC,GAAR,CAAY,sBAAZ,EAAmCF,IAAnC;CAAyC,GAArE;;CAAsEF,EAAAA,MAAM,CAACK,QAAP,GAAgB,UAASH,IAAT,EAAc;CAACC,IAAAA,OAAO,CAACG,IAAR,CAAa,sBAAb,EAAoCJ,IAApC;CAA0CK,IAAAA,WAAW,CAAC;CAACC,MAAAA,GAAG,EAAC,WAAL;CAAiBC,MAAAA,OAAO,EAACP;CAAzB,KAAD,CAAX;CAA4C,GAArH;;CAAsH,MAAIQ,eAAe,GAACC,MAAM,CAACC,MAAP,CAAc,EAAd,EAAiBZ,MAAjB,CAApB;CAA+D,MAAIa,WAAW,GAAC,gBAAhB;;CAA6E,MAAIC,kBAAkB,GAAC,OAAOC,MAAP,IAAe,QAAtC;CAA+C,MAAIC,qBAAqB,GAAC,OAAOC,aAAP,IAAsB,UAAhD;CAA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oC,gBAAgB,CAACvtC,MAAtB;CACI6rC,QAAAA,SAAO,CAACqG,UAAR,CAAmBlzC,GAAG,CAAC1D,MAAvB,EAA+B0D,GAAG,CAAC8oB,OAAnC;CACA;;CACJ,WAAKylB,gBAAgB,CAACC,WAAtB;CACIuE,QAAAA,YAAY,CAAC/xC,MAAb,CAAoBhB,GAAG,CAAC1D,MAAxB,EAAgC0D,GAAG,CAACuwC,EAApC;CACA;;CACJ,WAAKhC,gBAAgB,CAACE,WAAtB;CACIwE,QAAAA,YAAY,CAACjyC,MAAb,CAAoBhB,GAAG,CAAC1D,MAAxB,EAAgC0D,GAAG,CAACuwC,EAApC;CACA;;CACJ,WAAKhC,gBAAgB,CAAC7+B,KAAtB;CACIm9B,QAAAA,SAAO,CAACn9B,KAAR;CACA;;CACJ,WAAK6+B,gBAAgB,CAACG,YAAtB;CACI7B,QAAAA,SAAO,CAACiD,GAAR,CAAY9vC,GAAG,CAACmV,GAAhB,IAAuBnV,GAAG,CAACmL,KAA3B;CACA;CAxBR;CA0BH,GA5BD;CA6BH,CApWD;;;;;;"} \ No newline at end of file diff --git a/demo/public/dist.zip b/demo/public/dist.zip index faf6fca8..773dfb62 100644 Binary files a/demo/public/dist.zip and b/demo/public/dist.zip differ diff --git a/demo/public/jessibuca.js b/demo/public/jessibuca.js index 972e67b7..3c5fea93 100644 --- a/demo/public/jessibuca.js +++ b/demo/public/jessibuca.js @@ -118,7 +118,7 @@ // demux type useWCS: false, // - wcsUseVideoRender: true, + wcsUseVideoRender: false, // 默认设置为true useMSE: false, // @@ -133,7 +133,9 @@ wasmDecodeAudioSyncVideo: false, // wasm 解码之后音视频同步 recordType: FILE_SUFFIX.webm, - useWebFullScreen: false // use web full screen + useWebFullScreen: false, + // use web full screen + initDecoderWorkerTimeout: 10 // }; const WORKER_CMD_TYPE = { @@ -1955,7 +1957,9 @@ render(msg) { if (this.vwriter) { - this.vwriter.write(msg.videoFrame); + this.vwriter.write(msg.videoFrame); // release memory + + msg.videoFrame.close(); } } @@ -12834,6 +12838,7 @@ this.$container = $container; this._loadingTimeoutReplayTimes = 0; this._heartTimeoutReplayTimes = 0; + this.initDecoderWorkerTimeout = null; this._destroyed = false; this.events = new Events(this); this.debug = new Debug(this); @@ -12849,17 +12854,20 @@ async destroy() { this._destroyed = true; + this.off(); - if (this.events) { - this.events.destroy(); - this.events = null; - } + this._clearInitDecoderWorkerTimeout(); if (this.player) { await this.player.destroy(); this.player = null; } + if (this.events) { + this.events.destroy(); + this.events = null; + } + if (this.$container) { this.$container.classList.remove('jessibuca-container'); this.$container.classList.remove('jessibuca-fullscreen-web'); @@ -12867,10 +12875,9 @@ this.$container = null; } - this._opt = null; + this._opt = {}; this._loadingTimeoutReplayTimes = 0; this._heartTimeoutReplayTimes = 0; - this.off(); } _initPlayer($container, options) { @@ -13049,6 +13056,11 @@ play(url) { let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return new Promise((resolve, reject) => { + if (this.isDestroyed()) { + reject('Jessibuca is destroyed'); + return; + } + if (!url && !this._opt.url) { this.emit(EVENTS.error, EVENTS_ERROR.playError); reject('play url is empty'); @@ -13432,7 +13444,18 @@ }); }); } else { + this.debug.log('Jessibuca', '_play ant waiting decoderWorkerInit'); + + this._checkInitDecoderWorkerTimeout(); + this.player.once(EVENTS.decoderWorkerInit, () => { + this._clearInitDecoderWorkerTimeout(); + + if (this.isDestroyed()) { + return; + } + + this.debug.log('Jessibuca', '_play decoderWorkerInit success and play'); this.player.play(url, options).then(() => { resolve(); }).catch(e => { @@ -13625,6 +13648,29 @@ return result; } + _clearInitDecoderWorkerTimeout() { + if (this.initDecoderWorkerTimeout) { + clearTimeout(this.initDecoderWorkerTimeout); + this.initDecoderWorkerTimeout = null; + } + } + + _checkInitDecoderWorkerTimeout() { + this._clearInitDecoderWorkerTimeout(); + + this.initDecoderWorkerTimeout = setTimeout(() => { + this._handleInitDecoderWorkerTimeout(); + }, this._opt.initDecoderWorkerTimeout * 1000); + } + + _handleInitDecoderWorkerTimeout() { + this.pause().then(() => { + this.debug.log('Jessibuca', 'init decoder worker timeout and pause play'); + }).catch(e => { + this.debug.warn('Jessibuca', 'init decoder worker timeout and pause play error', e); + }); + } + } _defineProperty(Jessibuca, "ERROR", EVENTS_ERROR); diff --git a/demo/public/jessibuca.js.map b/demo/public/jessibuca.js.map index 31a5cd06..091dd626 100644 --- a/demo/public/jessibuca.js.map +++ b/demo/public/jessibuca.js.map @@ -1 +1 @@ -{"version":3,"file":"jessibuca.js","sources":["../../node_modules/@babel/runtime/helpers/defineProperty.js","../../src/constant/index.js","../../src/utils/debug.js","../../src/utils/events.js","../../src/player/property.js","../../node_modules/screenfull/dist/screenfull.js","../../src/utils/index.js","../../src/player/events.js","../../src/utils/emitter.js","../../src/utils/webgl.js","../../src/video/commonLoader.js","../../src/utils/file-save.js","../../src/video/canvasLoader.js","../../src/video/videoLoader.js","../../src/video/index.js","../../src/audio/audioContextLoader.js","../../src/audio/index.js","../../src/stream/fetchLoader.js","../../src/stream/websocketLoader.js","../../src/stream/index.js","../../node_modules/recordrtc/RecordRTC.js","../../src/recorder/recordRTCLoader.js","../../src/recorder/index.js","../../src/worker/index.js","../../src/demux/commonLoader.js","../../src/demux/flvLoader.js","../../src/demux/m7sLoader.js","../../src/demux/index.js","../../src/utils/exp-golomb.js","../../src/utils/h264-sps-parser.js","../../src/utils/h264.js","../../src/decoder/webcodecs.js","../../src/control/icons.js","../../src/control/template.js","../../src/control/observer.js","../../src/control/property.js","../../src/control/events.js","../../node_modules/style-inject/dist/style-inject.es.js","../../src/control/hotkey.js","../../src/control/index.js","../../src/player/observer.js","../../src/remux/fmp4-generator.js","../../src/decoder/mediaSource.js","../../src/utils/noSleep.js","../../src/player/index.js","../../src/jessibuca.js"],"sourcesContent":["function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","// 播放协议\nexport const PLAYER_PLAY_PROTOCOL = {\n websocket: 0,\n fetch: 1,\n webrtc: 2,\n}\n\nexport const DEMUX_TYPE = {\n flv: 'flv',\n m7s: 'm7s'\n}\n\nexport const FILE_SUFFIX = {\n mp4: 'mp4',\n webm: 'webm'\n};\n\nexport const MEDIA_SOURCE_UPDATE_END_TIMEOUT = 10 * 1000\n\nexport const CONTAINER_DATA_SET_KEY = 'jessibuca'\n\nexport const VERSION = '__VERSION__'\n\n\n// default player options\nexport const DEFAULT_PLAYER_OPTIONS = {\n videoBuffer: 1000, //1000ms 1 second\n videoBufferDelay: 1000,// 1000ms\n isResize: true,\n isFullResize: false, //\n isFlv: false,\n debug: false,\n hotKey: false, // 快捷键\n loadingTimeout: 10, // loading timeout\n heartTimeout: 5, // heart timeout\n timeout: 10, // second\n loadingTimeoutReplay: true, // loading timeout replay. default is true\n heartTimeoutReplay: true,// heart timeout replay.\n loadingTimeoutReplayTimes: 3, // loading timeout replay fail times\n heartTimeoutReplayTimes: 3, // heart timeout replay fail times\n supportDblclickFullscreen: false, // support double click toggle fullscreen\n showBandwidth: false, // show band width\n keepScreenOn: false, //\n isNotMute: false, //\n hasAudio: true, // has audio\n hasVideo: true, // has video\n operateBtns: {\n fullscreen: false,\n screenshot: false,\n play: false,\n audio: false,\n record: false,\n },\n controlAutoHide: false, // control auto hide\n hasControl: false,\n loadingText: '', // loading Text\n background: '',\n decoder: 'decoder.js',\n url: '',// play url\n rotate: 0, //\n // text: '',\n forceNoOffscreen: true, // 默认是不采用\n hiddenAutoPause: false, //\n protocol: PLAYER_PLAY_PROTOCOL.fetch,\n demuxType: DEMUX_TYPE.flv, // demux type\n useWCS: false, //\n wcsUseVideoRender: true,// 默认设置为true\n useMSE: false, //\n useOffscreen: false, //\n autoWasm: true, // 自动降级到 wasm 模式\n wasmDecodeErrorReplay: true, // 解码失败重新播放。\n openWebglAlignment: false,// https://github.com/langhuihui/jessibuca/issues/152\n wasmDecodeAudioSyncVideo: false,// wasm 解码之后音视频同步\n recordType: FILE_SUFFIX.webm,\n useWebFullScreen: false, // use web full screen\n}\n\n\nexport const WORKER_CMD_TYPE = {\n init: 'init',\n initVideo: 'initVideo',\n render: 'render',\n playAudio: 'playAudio',\n initAudio: 'initAudio',\n kBps: 'kBps',\n decode: 'decode',\n audioCode: 'audioCode',\n videoCode: 'videoCode',\n wasmError: 'wasmError'\n}\n\nexport const WASM_ERROR = {\n invalidNalUnitSize: 'Invalid NAL unit size',\n // errorSplittingTheInputIntoNALUnits: 'Error splitting the input into NAL units'\n}\n\nexport const MEDIA_TYPE = {\n audio: 1,\n video: 2\n}\n\nexport const FLV_MEDIA_TYPE = {\n audio: 8,\n video: 9\n}\n\nexport const WORKER_SEND_TYPE = {\n init: 'init',\n decode: 'decode',\n audioDecode: 'audioDecode',\n videoDecode: 'videoDecode',\n close: 'close',\n updateConfig: 'updateConfig'\n}\n\n\n//\nexport const EVENTS = {\n fullscreen: 'fullscreen$2',\n webFullscreen: 'webFullscreen',\n decoderWorkerInit: 'decoderWorkerInit',\n play: 'play',\n playing: 'playing',\n pause: 'pause',\n mute: 'mute',\n load: 'load',\n loading: 'loading',\n videoInfo: 'videoInfo',\n timeUpdate: 'timeUpdate',\n audioInfo: \"audioInfo\",\n log: 'log',\n error: \"error\",\n kBps: 'kBps',\n timeout: 'timeout',\n delayTimeout: 'delayTimeout',\n loadingTimeout: 'loadingTimeout',\n stats: 'stats',\n performance: \"performance\",\n record: 'record',\n recording: 'recording',\n recordingTimestamp: 'recordingTimestamp',\n recordStart: 'recordStart',\n recordEnd: 'recordEnd',\n recordCreateError: 'recordCreateError',\n buffer: 'buffer',\n videoFrame: 'videoFrame',\n start: 'start',\n metadata: 'metadata',\n resize: 'resize',\n streamEnd: 'streamEnd',\n streamSuccess: 'streamSuccess',\n streamMessage: 'streamMessage',\n streamError: 'streamError',\n volumechange: 'volumechange',\n volume: 'volume',\n destroy: 'destroy',\n mseSourceOpen: 'mseSourceOpen',\n mseSourceClose: 'mseSourceClose',\n mseSourceBufferError: 'mseSourceBufferError',\n mseSourceBufferBusy: 'mseSourceBufferBusy',\n mseSourceBufferFull: 'mseSourceBufferFull',\n videoWaiting: 'videoWaiting',\n videoTimeUpdate: 'videoTimeUpdate',\n videoSyncAudio: 'videoSyncAudio',\n playToRenderTimes: 'playToRenderTimes'\n}\n\n\nexport const JESSIBUCA_EVENTS = {\n load: EVENTS.load,\n timeUpdate: EVENTS.timeUpdate,\n videoInfo: EVENTS.videoInfo,\n audioInfo: EVENTS.audioInfo,\n error: EVENTS.error,\n kBps: EVENTS.kBps,\n log: EVENTS.log,\n start: EVENTS.start,\n timeout: EVENTS.timeout,\n loadingTimeout: EVENTS.loadingTimeout,\n delayTimeout: EVENTS.delayTimeout,\n fullscreen: 'fullscreen',\n webFullscreen: EVENTS.webFullscreen,\n play: EVENTS.play,\n pause: EVENTS.pause,\n mute: EVENTS.mute,\n stats: EVENTS.stats,\n volumechange: EVENTS.volumechange,\n performance: EVENTS.performance,\n recordingTimestamp: EVENTS.recordingTimestamp,\n recordStart: EVENTS.recordStart,\n recordEnd: EVENTS.recordEnd,\n playToRenderTimes: EVENTS.playToRenderTimes,\n volume: EVENTS.volume\n}\n\nexport const EVENTS_ERROR = {\n playError: 'playIsNotPauseOrUrlIsNull',\n fetchError: \"fetchError\",\n websocketError: 'websocketError',\n webcodecsH265NotSupport: 'webcodecsH265NotSupport',\n webcodecsConfigureError:'webcodecsConfigureError',\n webcodecsDecodeError: 'webcodecsDecodeError',\n webcodecsWidthOrHeightChange: 'webcodecsWidthOrHeightChange',\n mediaSourceH265NotSupport: 'mediaSourceH265NotSupport',\n mediaSourceFull: EVENTS.mseSourceBufferFull,\n mseSourceBufferError: EVENTS.mseSourceBufferError,\n mediaSourceAppendBufferError: 'mediaSourceAppendBufferError',\n mediaSourceBufferListLarge: 'mediaSourceBufferListLarge',\n mediaSourceAppendBufferEndTimeout: 'mediaSourceAppendBufferEndTimeout',\n wasmDecodeError: 'wasmDecodeError',\n webglAlignmentError: 'webglAlignmentError'\n}\n\n\nexport const WEBSOCKET_STATUS = {\n notConnect: 'notConnect',\n open: 'open',\n close: 'close',\n error: 'error'\n}\n\nexport const BUFFER_STATUS = {\n empty: 'empty',\n buffering: 'buffering',\n full: 'full'\n}\n\n\nexport const SCREENSHOT_TYPE = {\n download: 'download',\n base64: 'base64',\n blob: 'blob'\n}\n\n\nexport const VIDEO_ENC_TYPE = {\n 7: 'H264(AVC)', //\n 12: 'H265(HEVC)' //\n}\n\nexport const VIDEO_ENC_CODE = {\n h264: 7,\n h265: 12\n}\n\n\nexport const AUDIO_ENC_TYPE = {\n 10: 'AAC',\n 7: 'ALAW',\n 8: 'MULAW'\n}\n\nexport const H265_NAL_TYPE = {\n vps: 32,\n sps: 33,\n pps: 34\n}\n\nexport const CONTROL_HEIGHT = 38\n\nexport const SCALE_MODE_TYPE = {\n full: 0, // 视频画面完全填充canvas区域,画面会被拉伸\n auto: 1, // 视频画面做等比缩放后,高或宽对齐canvas区域,画面不被拉伸,但有黑边\n fullAuto: 2 // 视频画面做等比缩放后,完全填充canvas区域,画面不被拉伸,没有黑边,但画面显示不全\n}\n\n\nexport const CANVAS_RENDER_TYPE = {\n webcodecs: 'webcodecs',\n webgl: 'webgl',\n offscreen: 'offscreen'\n}\n\nexport const ENCODED_VIDEO_TYPE = {\n key: 'key',\n delta: 'delta'\n}\n\n\nexport const MP4_CODECS = {\n avc: 'video/mp4; codecs=\"avc1.64002A\"',\n hev: 'video/mp4; codecs=\"hev1.1.6.L123.b0\"',\n}\n\n\nexport const MEDIA_SOURCE_STATE = {\n ended: 'ended',\n open: 'open',\n closed: 'closed'\n}\n\n\n// frag duration\nexport const FRAG_DURATION = Math.ceil(1000 / 25)\n\n\nexport const AUDIO_SYNC_VIDEO_DIFF = 1000;\n\n\nexport const HOT_KEY = {\n esc: 27, //\n arrowUp: 38, //\n arrowDown: 40, //\n}\nexport const WCS_ERROR = {\n keyframeIsRequiredError: 'A key frame is required after configure() or flush()',\n canNotDecodeClosedCodec: \"Cannot call 'decode' on a closed codec\"\n}\n\n\nexport const FETCH_ERROR = {\n abortError1: 'The user aborted a request',\n abortError2: 'AbortError',\n abort: 'AbortError'\n}\n\nexport const FRAME_HEADER_EX = 0x80\n\n\nexport const PACKET_TYPE_EX = {\n PACKET_TYPE_SEQ_START: 0,\n PACKET_TYPE_FRAMES: 1,\n PACKET_TYPE_FRAMESX: 3,\n};\n\n\nexport const FRAME_TYPE_EX = {\n FT_KEY: 0x10,\n FT_INTER: 0x20\n};\n\n\n\n","export default class Debug {\n constructor(master) {\n this.log = (name, ...args) => {\n if (master._opt && master._opt.debug) {\n console.log(`Jb: [${name}]`, ...args);\n }\n };\n\n this.warn = (name, ...args) => {\n if (master._opt && master._opt.debug) {\n console.warn(`Jb: [${name}]`, ...args);\n }\n };\n\n this.error = (name, ...args) => {\n console.error(`Jb: [${name}]`, ...args);\n };\n }\n}\n","export default class Events {\n constructor(master) {\n this.destroys = [];\n this.proxy = this.proxy.bind(this);\n this.master = master;\n }\n\n proxy(target, name, callback, option = {}) {\n if (!target) {\n return;\n }\n if (Array.isArray(name)) {\n return name.map(item => this.proxy(target, item, callback, option));\n }\n target.addEventListener(name, callback, option);\n const destroy = () => target.removeEventListener(name, callback, option);\n this.destroys.push(destroy);\n return destroy;\n }\n\n destroy() {\n this.master.debug && this.master.debug.log(`Events`, 'destroy');\n this.destroys.forEach(event => event());\n }\n}\n","export default (player) => {\n Object.defineProperty(player, 'rect', {\n get: () => {\n const clientRect = player.$container.getBoundingClientRect()\n clientRect.width = Math.max(clientRect.width, player.$container.clientWidth);\n clientRect.height = Math.max(clientRect.height, player.$container.clientHeight);\n return clientRect;\n },\n });\n\n ['bottom', 'height', 'left', 'right', 'top', 'width'].forEach(key => {\n Object.defineProperty(player, key, {\n get: () => {\n return player.rect[key];\n },\n });\n });\n}\n","/*!\n* screenfull\n* v5.1.0 - 2020-12-24\n* (c) Sindre Sorhus; MIT License\n*/\n(function () {\n\t'use strict';\n\n\tvar document = typeof window !== 'undefined' && typeof window.document !== 'undefined' ? window.document : {};\n\tvar isCommonjs = typeof module !== 'undefined' && module.exports;\n\n\tvar fn = (function () {\n\t\tvar val;\n\n\t\tvar fnMap = [\n\t\t\t[\n\t\t\t\t'requestFullscreen',\n\t\t\t\t'exitFullscreen',\n\t\t\t\t'fullscreenElement',\n\t\t\t\t'fullscreenEnabled',\n\t\t\t\t'fullscreenchange',\n\t\t\t\t'fullscreenerror'\n\t\t\t],\n\t\t\t// New WebKit\n\t\t\t[\n\t\t\t\t'webkitRequestFullscreen',\n\t\t\t\t'webkitExitFullscreen',\n\t\t\t\t'webkitFullscreenElement',\n\t\t\t\t'webkitFullscreenEnabled',\n\t\t\t\t'webkitfullscreenchange',\n\t\t\t\t'webkitfullscreenerror'\n\n\t\t\t],\n\t\t\t// Old WebKit\n\t\t\t[\n\t\t\t\t'webkitRequestFullScreen',\n\t\t\t\t'webkitCancelFullScreen',\n\t\t\t\t'webkitCurrentFullScreenElement',\n\t\t\t\t'webkitCancelFullScreen',\n\t\t\t\t'webkitfullscreenchange',\n\t\t\t\t'webkitfullscreenerror'\n\n\t\t\t],\n\t\t\t[\n\t\t\t\t'mozRequestFullScreen',\n\t\t\t\t'mozCancelFullScreen',\n\t\t\t\t'mozFullScreenElement',\n\t\t\t\t'mozFullScreenEnabled',\n\t\t\t\t'mozfullscreenchange',\n\t\t\t\t'mozfullscreenerror'\n\t\t\t],\n\t\t\t[\n\t\t\t\t'msRequestFullscreen',\n\t\t\t\t'msExitFullscreen',\n\t\t\t\t'msFullscreenElement',\n\t\t\t\t'msFullscreenEnabled',\n\t\t\t\t'MSFullscreenChange',\n\t\t\t\t'MSFullscreenError'\n\t\t\t]\n\t\t];\n\n\t\tvar i = 0;\n\t\tvar l = fnMap.length;\n\t\tvar ret = {};\n\n\t\tfor (; i < l; i++) {\n\t\t\tval = fnMap[i];\n\t\t\tif (val && val[1] in document) {\n\t\t\t\tfor (i = 0; i < val.length; i++) {\n\t\t\t\t\tret[fnMap[0][i]] = val[i];\n\t\t\t\t}\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t})();\n\n\tvar eventNameMap = {\n\t\tchange: fn.fullscreenchange,\n\t\terror: fn.fullscreenerror\n\t};\n\n\tvar screenfull = {\n\t\trequest: function (element, options) {\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\tvar onFullScreenEntered = function () {\n\t\t\t\t\tthis.off('change', onFullScreenEntered);\n\t\t\t\t\tresolve();\n\t\t\t\t}.bind(this);\n\n\t\t\t\tthis.on('change', onFullScreenEntered);\n\n\t\t\t\telement = element || document.documentElement;\n\n\t\t\t\tvar returnPromise = element[fn.requestFullscreen](options);\n\n\t\t\t\tif (returnPromise instanceof Promise) {\n\t\t\t\t\treturnPromise.then(onFullScreenEntered).catch(reject);\n\t\t\t\t}\n\t\t\t}.bind(this));\n\t\t},\n\t\texit: function () {\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\tif (!this.isFullscreen) {\n\t\t\t\t\tresolve();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar onFullScreenExit = function () {\n\t\t\t\t\tthis.off('change', onFullScreenExit);\n\t\t\t\t\tresolve();\n\t\t\t\t}.bind(this);\n\n\t\t\t\tthis.on('change', onFullScreenExit);\n\n\t\t\t\tvar returnPromise = document[fn.exitFullscreen]();\n\n\t\t\t\tif (returnPromise instanceof Promise) {\n\t\t\t\t\treturnPromise.then(onFullScreenExit).catch(reject);\n\t\t\t\t}\n\t\t\t}.bind(this));\n\t\t},\n\t\ttoggle: function (element, options) {\n\t\t\treturn this.isFullscreen ? this.exit() : this.request(element, options);\n\t\t},\n\t\tonchange: function (callback) {\n\t\t\tthis.on('change', callback);\n\t\t},\n\t\tonerror: function (callback) {\n\t\t\tthis.on('error', callback);\n\t\t},\n\t\ton: function (event, callback) {\n\t\t\tvar eventName = eventNameMap[event];\n\t\t\tif (eventName) {\n\t\t\t\tdocument.addEventListener(eventName, callback, false);\n\t\t\t}\n\t\t},\n\t\toff: function (event, callback) {\n\t\t\tvar eventName = eventNameMap[event];\n\t\t\tif (eventName) {\n\t\t\t\tdocument.removeEventListener(eventName, callback, false);\n\t\t\t}\n\t\t},\n\t\traw: fn\n\t};\n\n\tif (!fn) {\n\t\tif (isCommonjs) {\n\t\t\tmodule.exports = {isEnabled: false};\n\t\t} else {\n\t\t\twindow.screenfull = {isEnabled: false};\n\t\t}\n\n\t\treturn;\n\t}\n\n\tObject.defineProperties(screenfull, {\n\t\tisFullscreen: {\n\t\t\tget: function () {\n\t\t\t\treturn Boolean(document[fn.fullscreenElement]);\n\t\t\t}\n\t\t},\n\t\telement: {\n\t\t\tenumerable: true,\n\t\t\tget: function () {\n\t\t\t\treturn document[fn.fullscreenElement];\n\t\t\t}\n\t\t},\n\t\tisEnabled: {\n\t\t\tenumerable: true,\n\t\t\tget: function () {\n\t\t\t\t// Coerce to boolean in case of old WebKit\n\t\t\t\treturn Boolean(document[fn.fullscreenEnabled]);\n\t\t\t}\n\t\t}\n\t});\n\n\tif (isCommonjs) {\n\t\tmodule.exports = screenfull;\n\t} else {\n\t\twindow.screenfull = screenfull;\n\t}\n})();\n","import {MP4_CODECS, FILE_SUFFIX} from \"../constant\";\nimport screenfull from \"screenfull\";\n\nexport function noop() {\n}\n\n\nexport function supportOffscreen($canvas) {\n return typeof $canvas.transferControlToOffscreen === 'function';\n}\n\n\nexport function supportOffscreenV2() {\n return typeof OffscreenCanvas !== \"undefined\";\n}\n\n\nexport function createContextGL($canvas) {\n let gl = null;\n\n const validContextNames = [\"webgl\", \"experimental-webgl\", \"moz-webgl\", \"webkit-3d\"];\n let nameIndex = 0;\n\n while (!gl && nameIndex < validContextNames.length) {\n const contextName = validContextNames[nameIndex];\n\n try {\n let contextOptions = {preserveDrawingBuffer: true};\n gl = $canvas.getContext(contextName, contextOptions);\n } catch (e) {\n gl = null;\n }\n\n if (!gl || typeof gl.getParameter !== \"function\") {\n gl = null;\n }\n\n ++nameIndex;\n }\n\n\n return gl;\n}\n\n\nexport function audioContextUnlock(context) {\n context.resume();\n const source = context.createBufferSource();\n source.buffer = context.createBuffer(1, 1, 22050);\n source.connect(context.destination);\n if (source.noteOn) {\n source.noteOn(0);\n } else {\n source.start(0);\n }\n}\n\nexport function dataURLToFile(dataURL = '') {\n const arr = dataURL.split(\",\");\n const bstr = atob(arr[1]);\n const type = arr[0].replace(\"data:\", \"\").replace(\";base64\", \"\")\n let n = bstr.length, u8arr = new Uint8Array(n);\n while (n--) {\n u8arr[n] = bstr.charCodeAt(n);\n }\n return new File([u8arr], 'file', {type});\n}\n\nexport function downloadFile(file, fileName) {\n if (file instanceof Blob || file instanceof File) {\n file = new Blob([file]);\n }\n const aLink = document.createElement(\"a\");\n aLink.download = fileName;\n aLink.href = file;\n aLink.click();\n}\n\n\nexport function downloadImg(content, fileName) {\n const aLink = document.createElement(\"a\");\n aLink.download = fileName;\n const href = URL.createObjectURL(content);\n aLink.href = href;\n aLink.click();\n setTimeout(() => {\n URL.revokeObjectURL(href);\n }, isIOS() ? 1000 : 0)\n}\n\nexport function checkFull() {\n let isFull = document.fullscreenElement || window.webkitFullscreenElement || document.msFullscreenElement;\n if (isFull === undefined) isFull = false;\n return !!isFull;\n}\n\nexport function now() {\n return new Date().getTime();\n}\n\nexport const supportedWasm = (() => {\n try {\n if (typeof WebAssembly === \"object\"\n && typeof WebAssembly.instantiate === \"function\") {\n const module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));\n if (module instanceof WebAssembly.Module)\n return new WebAssembly.Instance(module) instanceof WebAssembly.Instance;\n }\n } catch (e) {\n }\n return false;\n})();\n\nexport function clamp(num, a, b) {\n return Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b));\n}\n\nexport function setStyle(element, key, value) {\n if (!element) {\n return\n }\n if (typeof key === 'object') {\n Object.keys(key).forEach(item => {\n setStyle(element, item, key[item]);\n });\n }\n element.style[key] = value;\n return element;\n}\n\n\nexport function getStyle(element, key, numberType = true) {\n if (!element) {\n return 0\n }\n\n const value = getComputedStyle(element, null).getPropertyValue(key);\n return numberType ? parseFloat(value) : value;\n}\n\nexport function getNowTime() {\n if (performance && typeof performance.now === 'function') {\n return performance.now();\n }\n return Date.now();\n}\n\nexport function calculationRate(callback) {\n let totalSize = 0;\n let lastTime = getNowTime();\n return size => {\n totalSize += size;\n const thisTime = getNowTime();\n const diffTime = thisTime - lastTime;\n if (diffTime >= 1000) {\n callback((totalSize / diffTime) * 1000);\n lastTime = thisTime;\n totalSize = 0;\n }\n };\n}\n\nexport function downloadRecord(blob, name, suffix) {\n const url = window.URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = (name || now()) + '.' + (suffix || FILE_SUFFIX.webm);\n a.click();\n setTimeout(() => {\n window.URL.revokeObjectURL(url);\n }, isIOS() ? 1000 : 0)\n}\n\nexport const env = '__ENV__';\n\nexport function isMobile() {\n return (/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase()));\n}\n\nexport function isPad(){\n return (/ipad|android(?!.*mobile)|tablet|kindle|silk/i.test(window.navigator.userAgent.toLowerCase()));\n}\n\nexport function isAndroid() {\n const UA = window.navigator.userAgent.toLowerCase();\n return (/android/i.test(UA));\n}\n\nexport function isIOS() {\n const UA = window.navigator.userAgent.toLowerCase();\n return UA && /iphone|ipad|ipod|ios/.test(UA);\n}\n\n\nexport function parseTime(time, cFormat) {\n if (arguments.length === 0) {\n return null\n }\n var format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'\n var date;\n if (typeof time === 'object') {\n date = time\n } else {\n if (('' + time).length === 10) time = parseInt(time) * 1000;\n time = +time; // 转成int 型\n date = new Date(time)\n }\n var formatObj = {\n y: date.getFullYear(),\n m: date.getMonth() + 1,\n d: date.getDate(),\n h: date.getHours(),\n i: date.getMinutes(),\n s: date.getSeconds(),\n a: date.getDay()\n };\n var time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {\n var value = formatObj[key]\n if (key === 'a') return ['一', '二', '三', '四', '五', '六', '日'][value - 1]\n if (result.length > 0 && value < 10) {\n value = '0' + value\n }\n return value || 0\n });\n return time_str\n}\n\n// 是否支持 webcodecs\nexport function supportWCS() {\n return \"VideoEncoder\" in window;\n}\n\nexport function toNumber(value) {\n if (typeof value !== 'string') {\n return value;\n } else {\n // 转换成 number 类型\n var parsed = Number(value);\n return isNaN(parsed) ? value : parsed;\n }\n}\n\nexport function uuid16() {\n return 'xxxxxxxxxxxx4xxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8)\n return v.toString(16)\n })\n}\n\nexport function throttle(callback, delay) {\n let isThrottled = false;\n let args;\n let context;\n\n function fn(...args2) {\n if (isThrottled) {\n args = args2;\n context = this;\n return;\n }\n\n isThrottled = true;\n callback.apply(this, args2);\n setTimeout(() => {\n isThrottled = false;\n if (args) {\n fn.apply(context, args);\n args = null;\n context = null;\n }\n }, delay);\n }\n\n return fn;\n}\n\n\nexport function isDef(v) {\n return v !== undefined && v !== null;\n}\n\nexport function formatVideoDecoderConfigure(avcC) {\n let codecArray = avcC.subarray(1, 4);\n let codecString = \"avc1.\";\n for (let j = 0; j < 3; j++) {\n let h = codecArray[j].toString(16);\n if (h.length < 2) {\n h = \"0\" + h\n }\n codecString += h\n }\n\n return {\n codec: codecString,\n description: avcC\n }\n}\n\nexport function isFullScreen() {\n return screenfull.isFullscreen\n}\n\nexport function bpsSize(value) {\n if (null == value || value === '' || parseInt(value) === 0 || isNaN(parseInt(value))) {\n return \"0KB/s\";\n }\n let size = parseFloat(value);\n size = size.toFixed(2);\n return size + 'KB/s';\n}\n\n\nexport function fpsStatus(fps) {\n let result = 0;\n if (fps >= 24) {\n result = 2;\n } else if (fps >= 15) {\n result = 1;\n }\n\n return result;\n}\n\nexport function createEmptyImageBitmap(width, height) {\n const $canvasElement = document.createElement(\"canvas\");\n $canvasElement.width = width;\n $canvasElement.height = height;\n return window.createImageBitmap($canvasElement, 0, 0, width, height);\n}\n\n\nexport function supportMSE() {\n return window.MediaSource && window.MediaSource.isTypeSupported(MP4_CODECS.avc);\n}\n\nexport function supportMediaStreamTrack() {\n return window.MediaStreamTrackGenerator && typeof window.MediaStreamTrackGenerator === 'function'\n}\n\n\nexport function formatMp4VideoCodec(codec) {\n return `video/mp4; codecs=\"${codec}\"`\n}\n\n\nexport function saveBlobToFile(fileName, blob) {\n let url = window.URL.createObjectURL(blob);\n let aLink = window.document.createElement('a');\n aLink.download = fileName;\n aLink.href = url;\n //创建内置事件并触发\n let evt = window.document.createEvent('MouseEvents');\n evt.initEvent(\"click\", true, true); //initEvent 不加后两个参数在FF下会报错 事件类型,是否冒泡,是否阻止浏览器的默认行为\n aLink.dispatchEvent(evt);\n setTimeout(() => {\n window.URL.revokeObjectURL(url);\n }, isIOS() ? 1000 : 0)\n}\n\nexport function isEmpty(value) {\n return value === null || value === undefined\n}\n\nexport function isBoolean(value) {\n return value === true || value === false;\n}\n\nexport function isNotEmpty(value) {\n return !isEmpty(value)\n}\n\nexport function initPlayTimes() {\n return {\n playInitStart: '', //1\n playStart: '', // 2\n streamStart: '', //3\n streamResponse: '', // 4\n demuxStart: '', // 5\n decodeStart: '', // 6\n videoStart: '', // 7\n playTimestamp: '',// playStart- playInitStart\n streamTimestamp: '',// streamStart - playStart\n streamResponseTimestamp: '',// streamResponse - streamStart\n demuxTimestamp: '', // demuxStart - streamResponse\n decodeTimestamp: '', // decodeStart - demuxStart\n videoTimestamp: '',// videoStart - decodeStart\n allTimestamp: '' // videoStart - playInitStart\n }\n}\n\n// create watermark\nexport function createWatermark(options) {\n let defaultConfig = {\n container: '',\n left: '',\n right: '',\n top: '',\n bottom: '',\n image: {\n src: '',\n width: '100',\n height: '60',\n },\n text: {\n content: '',\n fontSize: '14',\n color: '#000'\n },\n }\n defaultConfig = Object.assign(defaultConfig, options)\n\n const $container = defaultConfig.container;\n\n if ($container) {\n return\n }\n\n let shadowRoot = null;\n const otDiv = document.createElement('div');\n otDiv.setAttribute('style', 'pointer-events: none !important; display: block !important');\n\n if (typeof otDiv.attachShadow === \"function\") {\n shadowRoot = otDiv.attachShadow({mode: 'open'});\n } else if (otDiv.shadowRoot) {\n shadowRoot = otDiv.shadowRoot;\n } else {\n shadowRoot = otDiv;\n }\n\n const nodeList = $container.children;\n const index = Math.floor(Math.random() * (nodeList.length - 1));\n\n if (nodeList[index]) {\n $container.insertBefore(otDiv, nodeList[index]);\n } else {\n $container.appendChild(otDiv);\n }\n\n\n const maskDiv = document.createElement('div');\n let innerDom = null;\n if (defaultConfig.text && defaultConfig.text.content) {\n innerDom = document.createTextNode(defaultConfig.text);\n } else if (defaultConfig.image && defaultConfig.image.src) {\n innerDom = document.createElement('img')\n innerDom.style.height = '100%'\n innerDom.style.width = '100%'\n innerDom.src = defaultConfig.image.src;\n }\n\n if (!innerDom) {\n return;\n }\n\n maskDiv.appendChild(innerDom);\n\n maskDiv.style.visibility = '';\n maskDiv.style.position = \"absolute\";\n maskDiv.style.display = 'block'\n maskDiv.style['-ms-user-select'] = \"none\";\n maskDiv.style.left = defaultConfig.left;\n maskDiv.style.right = defaultConfig.right;\n maskDiv.style.top = defaultConfig.top;\n maskDiv.style.bottom = defaultConfig.bottom;\n maskDiv.style.overflow = 'hidden';\n maskDiv.style.zIndex = \"9999999\";\n if (defaultConfig.text && defaultConfig.text.content) {\n maskDiv.style.fontSize = defaultConfig.text.fontSize;\n maskDiv.style.color = defaultConfig.text.color;\n } else if (defaultConfig.image && defaultConfig.image.src) {\n maskDiv.style.width = defaultConfig.image.width + 'px';\n maskDiv.style.height = defaultConfig.image.height + 'px';\n }\n\n shadowRoot.appendChild(maskDiv)\n\n // remove function\n return () => {\n $container.removeChild(otDiv);\n }\n}\n\nexport function formatTimeTips(time) {\n var result;\n\n //\n if (time > -1) {\n var hour = Math.floor(time / 3600);\n var min = Math.floor(time / 60) % 60;\n var sec = time % 60;\n\n sec = Math.round(sec);\n\n if (hour < 10) {\n result = '0' + hour + \":\";\n } else {\n result = hour + \":\";\n }\n\n if (min < 10) {\n result += \"0\";\n }\n result += min + \":\";\n if (sec < 10) {\n result += \"0\";\n }\n result += sec.toFixed(0);\n }\n\n return result;\n}\n\nexport function getTarget(e) {\n const event = e || window.event;\n const target = event.target || event.srcElement;\n return target;\n}\n\nexport function isWebglRenderSupport(width) {\n return (width / 2) % 4 === 0\n}\n\nexport function isGreenYUV(arrayBuffer) {\n let zeroNum = 0;\n for (let i = 0; i < 10; i++) {\n let temp = arrayBuffer[i];\n if (temp === 0) {\n zeroNum += 1\n }\n }\n return zeroNum === 10;\n}\n\nexport function getBrowser() {\n const UserAgent = navigator.userAgent.toLowerCase();\n const browserInfo = {};\n const browserArray = {\n IE: window.ActiveXObject || \"ActiveXObject\" in window, // IE\n Chrome: UserAgent.indexOf('chrome') > -1 && UserAgent.indexOf('safari') > -1, // Chrome浏览器\n Firefox: UserAgent.indexOf('firefox') > -1, // 火狐浏览器\n Opera: UserAgent.indexOf('opera') > -1, // Opera浏览器\n Safari: UserAgent.indexOf('safari') > -1 && UserAgent.indexOf('chrome') == -1, // safari浏览器\n Edge: UserAgent.indexOf('edge') > -1, // Edge浏览器\n QQBrowser: /qqbrowser/.test(UserAgent), // qq浏览器\n WeixinBrowser: /MicroMessenger/i.test(UserAgent) // 微信浏览器\n };\n // console.log(browserArray)\n for (let i in browserArray) {\n if (browserArray[i]) {\n let versions = '';\n if (i === 'IE') {\n versions = UserAgent.match(/(msie\\s|trident.*rv:)([\\w.]+)/)[2];\n } else if (i === 'Chrome') {\n for (let mt in navigator.mimeTypes) {\n //检测是否是360浏览器(测试只有pc端的360才起作用)\n if (navigator.mimeTypes[mt]['type'] === 'application/360softmgrplugin') {\n i = '360';\n }\n }\n versions = UserAgent.match(/chrome\\/([\\d.]+)/)[1];\n } else if (i === 'Firefox') {\n versions = UserAgent.match(/firefox\\/([\\d.]+)/)[1];\n } else if (i === 'Opera') {\n versions = UserAgent.match(/opera\\/([\\d.]+)/)[1];\n } else if (i === 'Safari') {\n versions = UserAgent.match(/version\\/([\\d.]+)/)[1];\n } else if (i === 'Edge') {\n versions = UserAgent.match(/edge\\/([\\d.]+)/)[1];\n } else if (i === 'QQBrowser') {\n versions = UserAgent.match(/qqbrowser\\/([\\d.]+)/)[1];\n }\n browserInfo.type = i;\n browserInfo.version = parseInt(versions);\n }\n }\n return browserInfo;\n}\n\n\nexport function closeVideoFrame(videoFrame) {\n if (videoFrame.close) {\n videoFrame.close()\n } else if (videoFrame.destroy) {\n videoFrame.destroy()\n }\n}\n\n\nexport function removeElement(element) {\n let result = false;\n if (element) {\n if (element.parentNode) {\n element.parentNode.removeChild(element);\n result = true;\n }\n }\n return result;\n}\n\nexport function hevcEncoderNalePacketNotLength(oneNALBuffer, isIframe) {\n const idrBit = 0x10 | 12;\n const nIdrBit = 0x20 | 12;\n let tmp = [];\n if (isIframe) {\n tmp[0] = idrBit;\n } else {\n tmp[0] = nIdrBit;\n }\n tmp[1] = 1;\n //\n tmp[2] = 0;\n tmp[3] = 0;\n tmp[4] = 0;\n\n const arrayBuffer = new Uint8Array(tmp.length + oneNALBuffer.byteLength);\n arrayBuffer.set(tmp, 0);\n arrayBuffer.set(oneNALBuffer, tmp.length);\n return arrayBuffer;\n}\n\n\nexport function isTrue(value) {\n return value === true || value === 'true';\n}\n\nexport function isFalse(value) {\n return value !== true && value !== 'true';\n}\n\nexport function getElementDataset(element, key) {\n if (!element) {\n return '';\n }\n\n if (element.dataset) {\n return element.dataset[key];\n }\n return element.getAttribute('data-' + key);\n}\n\nexport function setElementDataset(element, key, value) {\n if (!element) {\n return;\n }\n\n if (element.dataset) {\n element.dataset[key] = value;\n } else {\n element.setAttribute('data-' + key, value);\n }\n}\n\nexport function removeElementDataset(element, key) {\n if (!element) {\n return;\n }\n\n if (element.dataset) {\n delete element.dataset[key];\n } else {\n element.removeAttribute('data-' + key);\n }\n}\n","import {EVENTS, EVENTS_ERROR, JESSIBUCA_EVENTS} from \"../constant\";\nimport screenfull from \"screenfull\";\nimport {getTarget, isMobile, setStyle} from \"../utils\";\n\nexport default (player) => {\n\n\n try {\n const screenfullChange = (e) => {\n if (getTarget(e) === player.$container) {\n player.emit(JESSIBUCA_EVENTS.fullscreen, player.fullscreen)\n\n // 如果不是fullscreen,则触发下 resize 方法\n if (!player.fullscreen) {\n player.resize();\n } else {\n if (player._opt.useMSE) {\n player.resize();\n }\n }\n }\n };\n screenfull.on('change', screenfullChange);\n player.events.destroys.push(() => {\n screenfull.off('change', screenfullChange);\n });\n } catch (error) {\n //\n }\n //\n player.on(EVENTS.decoderWorkerInit, () => {\n player.debug.log('player', 'has loaded');\n player.loaded = true;\n })\n\n //\n player.on(EVENTS.play, () => {\n player.loading = false;\n })\n\n //\n player.on(EVENTS.fullscreen, (value) => {\n if (value) {\n try {\n screenfull.request(player.$container).then(() => {\n\n }).catch((e) => {\n if (isMobile() && player._opt.useWebFullScreen) {\n player.webFullscreen = true;\n }\n });\n\n } catch (e) {\n if (isMobile() && player._opt.useWebFullScreen) {\n player.webFullscreen = true;\n }\n }\n } else {\n try {\n screenfull.exit().then(() => {\n if (player.webFullscreen) {\n player.webFullscreen = false;\n }\n }).catch(() => {\n player.webFullscreen = false;\n\n });\n } catch (e) {\n player.webFullscreen = false;\n }\n }\n })\n\n if (isMobile()) {\n player.on(EVENTS.webFullscreen, (value) => {\n if (value) {\n player.$container.classList.add('jessibuca-fullscreen-web')\n } else {\n player.$container.classList.remove('jessibuca-fullscreen-web')\n }\n //\n player.emit(JESSIBUCA_EVENTS.fullscreen, player.fullscreen)\n })\n }\n\n\n //\n player.on(EVENTS.resize, () => {\n player.video && player.video.resize();\n })\n\n\n if (player._opt.debug) {\n const ignoreList = [EVENTS.timeUpdate];\n const stringList = [\n EVENTS.stats,\n EVENTS.playToRenderTimes,\n EVENTS.audioInfo,\n EVENTS.videoInfo\n ]\n Object.keys(EVENTS).forEach((key) => {\n player.on(EVENTS[key], (value) => {\n if (ignoreList.includes(key)) {\n return;\n }\n\n if (stringList.includes(key)) {\n value = JSON.stringify(value)\n }\n\n player.debug.log('player events', EVENTS[key], value);\n })\n })\n\n Object.keys(EVENTS_ERROR).forEach((key) => {\n player.on(EVENTS_ERROR[key], (value) => {\n player.debug.log('player event error', EVENTS_ERROR[key], value);\n })\n })\n }\n}\n","export default class Emitter {\n on(name, fn, ctx) {\n const e = this.e || (this.e = {});\n (e[name] || (e[name] = [])).push({fn, ctx});\n return this;\n }\n\n once(name, fn, ctx) {\n const self = this;\n\n function listener(...args) {\n self.off(name, listener);\n fn.apply(ctx, args);\n }\n\n listener._ = fn;\n return this.on(name, listener, ctx);\n }\n\n emit(name, ...data) {\n const evtArr = ((this.e || (this.e = {}))[name] || []).slice();\n for (let i = 0; i < evtArr.length; i += 1) {\n evtArr[i].fn.apply(evtArr[i].ctx, data);\n }\n return this;\n }\n\n off(name, callback) {\n const e = this.e || (this.e = {});\n\n if (!name) {\n Object.keys(e).forEach((key) => {\n delete e[key];\n })\n delete this.e\n return;\n }\n\n const evts = e[name];\n const liveEvents = [];\n if (evts && callback) {\n for (let i = 0, len = evts.length; i < len; i += 1) {\n if (evts[i].fn !== callback && evts[i].fn._ !== callback) liveEvents.push(evts[i]);\n }\n }\n if (liveEvents.length) {\n e[name] = liveEvents;\n } else {\n delete e[name];\n }\n return this;\n }\n}\n","export default (gl, openWebglAlignment) => {\n var vertexShaderScript = [\n 'attribute vec4 vertexPos;',\n 'attribute vec4 texturePos;',\n 'varying vec2 textureCoord;',\n\n 'void main()',\n '{',\n 'gl_Position = vertexPos;',\n 'textureCoord = texturePos.xy;',\n '}'\n ].join('\\n');\n\n var fragmentShaderScript = [\n 'precision highp float;',\n 'varying highp vec2 textureCoord;',\n 'uniform sampler2D ySampler;',\n 'uniform sampler2D uSampler;',\n 'uniform sampler2D vSampler;',\n 'const mat4 YUV2RGB = mat4',\n '(',\n '1.1643828125, 0, 1.59602734375, -.87078515625,',\n '1.1643828125, -.39176171875, -.81296875, .52959375,',\n '1.1643828125, 2.017234375, 0, -1.081390625,',\n '0, 0, 0, 1',\n ');',\n\n 'void main(void) {',\n 'highp float y = texture2D(ySampler, textureCoord).r;',\n 'highp float u = texture2D(uSampler, textureCoord).r;',\n 'highp float v = texture2D(vSampler, textureCoord).r;',\n 'gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;',\n '}'\n ].join('\\n');\n\n if (openWebglAlignment) {\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);\n }\n var vertexShader = gl.createShader(gl.VERTEX_SHADER);\n gl.shaderSource(vertexShader, vertexShaderScript);\n gl.compileShader(vertexShader);\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {\n console.log('Vertex shader failed to compile: ' + gl.getShaderInfoLog(vertexShader));\n }\n\n var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\n gl.shaderSource(fragmentShader, fragmentShaderScript);\n gl.compileShader(fragmentShader);\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {\n console.log('Fragment shader failed to compile: ' + gl.getShaderInfoLog(fragmentShader));\n }\n\n var program = gl.createProgram();\n gl.attachShader(program, vertexShader);\n gl.attachShader(program, fragmentShader);\n gl.linkProgram(program);\n if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n console.log('Program failed to compile: ' + gl.getProgramInfoLog(program));\n }\n\n gl.useProgram(program);\n\n // initBuffers\n var vertexPosBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, vertexPosBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW);\n\n var vertexPosRef = gl.getAttribLocation(program, 'vertexPos');\n gl.enableVertexAttribArray(vertexPosRef);\n gl.vertexAttribPointer(vertexPosRef, 2, gl.FLOAT, false, 0, 0);\n\n var texturePosBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, texturePosBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 0, 0, 0, 1, 1, 0, 1]), gl.STATIC_DRAW);\n\n var texturePosRef = gl.getAttribLocation(program, 'texturePos');\n gl.enableVertexAttribArray(texturePosRef);\n gl.vertexAttribPointer(texturePosRef, 2, gl.FLOAT, false, 0, 0);\n\n function _initTexture(name, index) {\n var textureRef = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, textureRef);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.uniform1i(gl.getUniformLocation(program, name), index);\n return textureRef;\n }\n\n var yTextureRef = _initTexture('ySampler', 0);\n var uTextureRef = _initTexture('uSampler', 1);\n var vTextureRef = _initTexture('vSampler', 2);\n\n return {\n render: function (w, h, y, u, v) {\n gl.viewport(0, 0, w, h);\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, yTextureRef);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, w, h, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, y);\n gl.activeTexture(gl.TEXTURE1);\n gl.bindTexture(gl.TEXTURE_2D, uTextureRef);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, w / 2, h / 2, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, u);\n gl.activeTexture(gl.TEXTURE2);\n gl.bindTexture(gl.TEXTURE_2D, vTextureRef);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, w / 2, h / 2, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, v);\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);\n },\n destroy: function () {\n try {\n gl.deleteProgram(program);\n\n gl.deleteBuffer(vertexPosBuffer)\n gl.deleteBuffer(texturePosBuffer);\n\n gl.deleteTexture(yTextureRef);\n gl.deleteTexture(uTextureRef);\n gl.deleteTexture(vTextureRef);\n } catch (e) {\n // console.error(e);\n }\n\n }\n }\n};\n","import Emitter from \"../utils/emitter\";\nimport {CONTROL_HEIGHT, EVENTS, VIDEO_ENC_TYPE} from \"../constant\";\n\nexport default class CommonLoader extends Emitter {\n constructor() {\n super();\n this.init = false;\n }\n\n resetInit() {\n this.init = false;\n this.videoInfo = {\n width: '',\n height: '',\n encType: '',\n encTypeCode: ''\n }\n }\n destroy() {\n this.resetInit();\n this.player.$container.removeChild(this.$videoElement);\n this.off();\n }\n\n //\n updateVideoInfo(data) {\n if (data.encTypeCode) {\n this.videoInfo.encType = VIDEO_ENC_TYPE[data.encTypeCode];\n this.videoInfo.encTypeCode = data.encTypeCode;\n }\n\n if (data.width) {\n this.videoInfo.width = data.width;\n }\n\n if (data.height) {\n this.videoInfo.height = data.height;\n }\n\n // video 基本信息\n if (this.videoInfo.encType && this.videoInfo.height && this.videoInfo.width && !this.init) {\n this.player.emit(EVENTS.videoInfo, this.videoInfo);\n this.init = true;\n }\n }\n\n play() {\n\n }\n\n pause() {\n\n }\n\n clearView() {\n\n }\n}\n","/*\n* FileSaver.js\n* A saveAs() FileSaver implementation.\n*\n* By Eli Grey, http://eligrey.com\n*\n* License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT)\n* source : http://purl.eligrey.com/github/FileSaver.js\n*/\n\n// The one and only way of getting global scope in all environments\n// https://stackoverflow.com/q/3277182/1008999\nvar _global = typeof window === 'object' && window.window === window\n ? window : typeof self === 'object' && self.self === self\n ? self : typeof global === 'object' && global.global === global\n ? global\n : this\n\nfunction bom(blob, opts) {\n if (typeof opts === 'undefined') opts = {autoBom: false}\n else if (typeof opts !== 'object') {\n console.warn('Deprecated: Expected third argument to be a object')\n opts = {autoBom: !opts}\n }\n\n // prepend BOM for UTF-8 XML and text/* types (including HTML)\n // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF\n if (opts.autoBom && /^\\s*(?:text\\/\\S*|application\\/xml|\\S*\\/\\S*\\+xml)\\s*;.*charset\\s*=\\s*utf-8/i.test(blob.type)) {\n return new Blob([String.fromCharCode(0xFEFF), blob], {type: blob.type})\n }\n return blob\n}\n\nfunction download(url, name, opts) {\n var xhr = new XMLHttpRequest()\n xhr.open('GET', url)\n xhr.responseType = 'blob'\n xhr.onload = function () {\n saveAs(xhr.response, name, opts)\n }\n xhr.onerror = function () {\n console.error('could not download file')\n }\n xhr.send()\n}\n\nfunction corsEnabled(url) {\n var xhr = new XMLHttpRequest()\n // use sync to avoid popup blocker\n xhr.open('HEAD', url, false)\n try {\n xhr.send()\n } catch (e) {\n }\n return xhr.status >= 200 && xhr.status <= 299\n}\n\n// `a.click()` doesn't work for all browsers (#465)\nfunction click(node) {\n try {\n node.dispatchEvent(new MouseEvent('click'))\n } catch (e) {\n var evt = document.createEvent('MouseEvents')\n evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80,\n 20, false, false, false, false, 0, null)\n node.dispatchEvent(evt)\n }\n}\n\n// Detect WebView inside a native macOS app by ruling out all browsers\n// We just need to check for 'Safari' because all other browsers (besides Firefox) include that too\n// https://www.whatismybrowser.com/guides/the-latest-user-agent/macos\nvar isMacOSWebView = _global.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent)\n\nvar saveAs = (\n // probably in some web worker\n (typeof window !== 'object' || window !== _global)\n ? function saveAs() { /* noop */\n }\n\n // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView\n : ('download' in HTMLAnchorElement.prototype && !isMacOSWebView)\n ? function saveAs(blob, name, opts) {\n var URL = _global.URL || _global.webkitURL\n // Namespace is used to prevent conflict w/ Chrome Poper Blocker extension (Issue #561)\n var a = document.createElementNS('http://www.w3.org/1999/xhtml', 'a')\n name = name || blob.name || 'download'\n\n a.download = name\n a.rel = 'noopener' // tabnabbing\n\n // TODO: detect chrome extensions & packaged apps\n // a.target = '_blank'\n\n if (typeof blob === 'string') {\n // Support regular links\n a.href = blob\n if (a.origin !== location.origin) {\n corsEnabled(a.href)\n ? download(blob, name, opts)\n : click(a, a.target = '_blank')\n } else {\n click(a)\n }\n } else {\n // Support blobs\n a.href = URL.createObjectURL(blob)\n setTimeout(function () {\n URL.revokeObjectURL(a.href)\n }, 4E4) // 40s\n setTimeout(function () {\n click(a)\n }, 0)\n }\n }\n\n // Use msSaveOrOpenBlob as a second approach\n : 'msSaveOrOpenBlob' in navigator\n ? function saveAs(blob, name, opts) {\n name = name || blob.name || 'download'\n\n if (typeof blob === 'string') {\n if (corsEnabled(blob)) {\n download(blob, name, opts)\n } else {\n var a = document.createElement('a')\n a.href = blob\n a.target = '_blank'\n setTimeout(function () {\n click(a)\n })\n }\n } else {\n navigator.msSaveOrOpenBlob(bom(blob, opts), name)\n }\n }\n\n // Fallback to using FileReader and a popup\n : function saveAs(blob, name, opts, popup) {\n // Open a popup immediately do go around popup blocker\n // Mostly only available on user interaction and the fileReader is async so...\n popup = popup || open('', '_blank')\n if (popup) {\n popup.document.title =\n popup.document.body.innerText = 'downloading...'\n }\n\n if (typeof blob === 'string') return download(blob, name, opts)\n\n var force = blob.type === 'application/octet-stream'\n var isSafari = /constructor/i.test(_global.HTMLElement) || _global.safari\n var isChromeIOS = /CriOS\\/[\\d]+/.test(navigator.userAgent)\n\n if ((isChromeIOS || (force && isSafari) || isMacOSWebView) && typeof FileReader !== 'undefined') {\n // Safari doesn't allow downloading of blob URLs\n var reader = new FileReader()\n reader.onloadend = function () {\n var url = reader.result\n url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, 'data:attachment/file;')\n if (popup) popup.location.href = url\n else location = url\n popup = null // reverse-tabnabbing #460\n }\n reader.readAsDataURL(blob)\n } else {\n var URL = _global.URL || _global.webkitURL\n var url = URL.createObjectURL(blob)\n if (popup) popup.location = url\n else location.href = url\n popup = null // reverse-tabnabbing #460\n setTimeout(function () {\n URL.revokeObjectURL(url)\n }, 4E4) // 40s\n }\n }\n)\n\n\nexport default saveAs\n","import Emitter from \"../utils/emitter\";\nimport {\n closeVideoFrame,\n createContextGL,\n createEmptyImageBitmap,\n dataURLToFile,\n downloadImg,\n isMobile,\n now,\n supportOffscreen\n} from \"../utils\";\nimport createWebGL from \"../utils/webgl\";\nimport {CANVAS_RENDER_TYPE, CONTROL_HEIGHT, EVENTS, SCREENSHOT_TYPE, VIDEO_ENC_TYPE} from \"../constant\";\nimport CommonLoader from \"./commonLoader\";\nimport saveAs from \"../utils/file-save\";\n\nexport default class CanvasVideoLoader extends CommonLoader {\n\n constructor(player) {\n super()\n this.player = player;\n const $canvasElement = document.createElement(\"canvas\");\n $canvasElement.style.position = \"absolute\";\n $canvasElement.style.top = 0;\n $canvasElement.style.left = 0;\n this.$videoElement = $canvasElement;\n player.$container.appendChild(this.$videoElement);\n\n this.context2D = null;\n this.contextGl = null;\n this.contextGlRender = null;\n this.contextGlDestroy = null;\n this.bitmaprenderer = null;\n this.renderType = null;\n this.videoInfo = {\n width: '',\n height: '',\n encType: '',\n }\n //\n this._initCanvasRender();\n this.player.debug.log('CanvasVideo', 'init');\n }\n\n async destroy() {\n super.destroy();\n if (this.contextGl) {\n this.contextGl = null;\n }\n if (this.context2D) {\n this.context2D = null;\n }\n if (this.contextGlRender) {\n this.contextGlDestroy && this.contextGlDestroy();\n this.contextGlDestroy = null;\n this.contextGlRender = null;\n }\n if (this.bitmaprenderer) {\n this.bitmaprenderer = null;\n }\n\n this.renderType = null;\n\n this.player.debug.log(`CanvasVideoLoader`, 'destroy');\n }\n\n\n _initContextGl() {\n this.contextGl = createContextGL(this.$videoElement);\n if(this.contextGl){\n const webgl = createWebGL(this.contextGl, this.player._opt.openWebglAlignment);\n this.contextGlRender = webgl.render;\n this.contextGlDestroy = webgl.destroy\n }\n else {\n this.player.debug.error(`CanvasVideoLoader`, 'init webgl fail');\n }\n }\n\n _initContext2D() {\n this.context2D = this.$videoElement.getContext('2d');\n }\n\n\n // 渲染类型\n _initCanvasRender() {\n if (this.player._opt.useWCS && !this._supportOffscreen()) {\n this.renderType = CANVAS_RENDER_TYPE.webcodecs;\n this._initContext2D();\n } else if (this._supportOffscreen()) {\n this.renderType = CANVAS_RENDER_TYPE.offscreen;\n this._bindOffscreen();\n } else {\n this.renderType = CANVAS_RENDER_TYPE.webgl;\n this._initContextGl();\n }\n }\n\n _supportOffscreen() {\n return supportOffscreen(this.$videoElement) && this.player._opt.useOffscreen;\n }\n\n //\n _bindOffscreen() {\n this.bitmaprenderer = this.$videoElement.getContext('bitmaprenderer');\n }\n\n initCanvasViewSize() {\n this.$videoElement.width = this.videoInfo.width;\n this.$videoElement.height = this.videoInfo.height;\n this.resize();\n }\n\n //\n render(msg) {\n this.player.videoTimestamp = msg.ts;\n switch (this.renderType) {\n case CANVAS_RENDER_TYPE.offscreen:\n this.bitmaprenderer.transferFromImageBitmap(msg.buffer);\n break;\n case CANVAS_RENDER_TYPE.webgl:\n this.contextGlRender(this.$videoElement.width, this.$videoElement.height, msg.output[0], msg.output[1], msg.output[2]);\n break;\n case CANVAS_RENDER_TYPE.webcodecs:\n // can use createImageBitmap in wexin\n this.context2D.drawImage(msg.videoFrame, 0, 0, this.$videoElement.width, this.$videoElement.height);\n closeVideoFrame(msg.videoFrame);\n break;\n }\n }\n\n screenshot(filename, format, quality, type) {\n filename = filename || now();\n type = type || SCREENSHOT_TYPE.download;\n const formatType = {\n png: 'image/png',\n jpeg: 'image/jpeg',\n webp: 'image/webp'\n };\n let encoderOptions = 0.92;\n if (!formatType[format] && SCREENSHOT_TYPE[format]) {\n type = format;\n format = 'png';\n quality = undefined\n }\n\n if (typeof quality === \"string\") {\n type = quality;\n quality = undefined;\n }\n\n if (typeof quality !== 'undefined') {\n encoderOptions = Number(quality);\n }\n const dataURL = this.$videoElement.toDataURL(formatType[format] || formatType.png, encoderOptions);\n\n if (type === SCREENSHOT_TYPE.base64) {\n return dataURL;\n } else {\n const file = dataURLToFile(dataURL)\n if (type === SCREENSHOT_TYPE.blob) {\n return file;\n } else if (type === SCREENSHOT_TYPE.download) {\n // downloadImg(file, filename);\n saveAs(file, filename);\n }\n }\n\n }\n\n //\n clearView() {\n switch (this.renderType) {\n case CANVAS_RENDER_TYPE.offscreen:\n createEmptyImageBitmap(this.$videoElement.width, this.$videoElement.height).then((imageBitMap) => {\n this.bitmaprenderer.transferFromImageBitmap(imageBitMap);\n })\n break;\n case CANVAS_RENDER_TYPE.webgl:\n this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);\n break;\n case CANVAS_RENDER_TYPE.webcodecs:\n this.context2D.clearRect(0, 0, this.$videoElement.width, this.$videoElement.height)\n break;\n }\n }\n\n resize() {\n this.player.debug.log('canvasVideo', 'resize');\n const option = this.player._opt;\n let width = this.player.width;\n let height = this.player.height;\n if (this.player.isControlBarShow()) {\n if (isMobile() && this.player.fullscreen && option.useWebFullScreen) {\n width -= CONTROL_HEIGHT;\n } else {\n height -= CONTROL_HEIGHT;\n }\n }\n let resizeWidth = this.$videoElement.width;\n let resizeHeight = this.$videoElement.height;\n const rotate = option.rotate;\n let left = ((width - resizeWidth) / 2)\n let top = ((height - resizeHeight) / 2)\n if (rotate === 270 || rotate === 90) {\n resizeWidth = this.$videoElement.height;\n resizeHeight = this.$videoElement.width;\n }\n\n const wScale = width / resizeWidth;\n const hScale = height / resizeHeight;\n\n let scale = wScale > hScale ? hScale : wScale;\n //\n if (!option.isResize) {\n if (wScale !== hScale) {\n scale = wScale + ',' + hScale;\n }\n }\n //\n if (option.isFullResize) {\n scale = wScale > hScale ? wScale : hScale;\n }\n let transform = \"scale(\" + scale + \")\";\n\n if (rotate) {\n transform += ' rotate(' + rotate + 'deg)'\n }\n\n this.$videoElement.style.transform = transform;\n this.$videoElement.style.left = left + \"px\"\n this.$videoElement.style.top = top + \"px\"\n }\n\n\n}\n","import Emitter from \"../utils/emitter\";\nimport {CONTROL_HEIGHT, EVENTS, SCREENSHOT_TYPE, VIDEO_ENC_TYPE} from \"../constant\";\nimport {dataURLToFile, downloadImg, getBrowser, isAndroid, isMobile, now} from \"../utils\";\nimport CommonLoader from \"./commonLoader\";\nimport saveAs from \"../utils/file-save\";\n\nexport default class VideoLoader extends CommonLoader {\n constructor(player) {\n super();\n this.player = player;\n const $videoElement = document.createElement('video');\n const $canvasElement = document.createElement('canvas');\n $videoElement.muted = true;\n $videoElement.disablePictureInPicture = true;\n if (isAndroid()) {\n // default no poster\n $videoElement.poster = 'noposter';\n }\n $videoElement.style.position = \"absolute\";\n $videoElement.style.top = 0;\n $videoElement.style.left = 0;\n this._delayPlay = false;\n player.$container.appendChild($videoElement);\n this.videoInfo = {\n width: '',\n height: '',\n encType: '',\n }\n const _opt = this.player._opt;\n if (_opt.useWCS && _opt.wcsUseVideoRender) {\n this.trackGenerator = new MediaStreamTrackGenerator({kind: 'video'});\n $videoElement.srcObject = new MediaStream([this.trackGenerator]);\n this.vwriter = this.trackGenerator.writable.getWriter();\n }\n this.$videoElement = $videoElement;\n this.$canvasElement = $canvasElement;\n this.canvasContext = $canvasElement.getContext('2d');\n this.fixChromeVideoFlashBug();\n this.resize();\n\n const {proxy} = this.player.events;\n\n proxy(this.$videoElement, 'canplay', () => {\n this.player.debug.log('Video', `canplay`);\n if (this._delayPlay) {\n this.player.debug.log('Video', `canplay and _delayPlay is true and next play()`);\n this._play();\n }\n })\n\n proxy(this.$videoElement, 'waiting', () => {\n // this.player.emit(EVENTS.videoWaiting);\n this.player.debug.log('Video', 'waiting');\n })\n\n proxy(this.$videoElement, 'timeupdate', (event) => {\n // this.player.emit(EVENTS.videoTimeUpdate, event.timeStamp);\n const timeStamp = parseInt(event.timeStamp, 10);\n this.player.emit(EVENTS.timeUpdate, timeStamp)\n // check is pause;\n if (!this.isPlaying() && this.init) {\n this.player.debug.log('Video', `timeupdate and this.isPlaying is false and retry play`);\n this.$videoElement.play();\n }\n })\n\n this.player.debug.log('Video', 'init');\n }\n\n async destroy() {\n super.destroy();\n this.$canvasElement = null;\n this.canvasContext = null;\n if (this.$videoElement) {\n this.$videoElement.pause();\n this.$videoElement.currentTime = 0;\n this.$videoElement.src = ''\n this.$videoElement.removeAttribute('src');\n this.$videoElement = null;\n }\n if (this.trackGenerator) {\n this.trackGenerator.stop();\n this.trackGenerator = null;\n }\n if (this.vwriter) {\n await this.vwriter.close();\n this.vwriter = null;\n }\n this.player.debug.log('Video', 'destroy');\n }\n\n fixChromeVideoFlashBug() {\n const browser = getBrowser();\n const type = browser.type.toLowerCase();\n if (type === 'chrome' || type === 'edge') {\n const $container = this.player.$container;\n $container.style.backdropFilter = 'blur(0px)';\n $container.style.translateZ = '0';\n }\n }\n\n play() {\n if (this.$videoElement) {\n const readyState = this._getVideoReadyState();\n this.player.debug.log('Video', `play and readyState: ${readyState}`);\n if (readyState === 0) {\n this.player.debug.warn('Video', 'readyState is 0 and set _delayPlay to true');\n this._delayPlay = true;\n return;\n }\n this._play();\n }\n }\n\n _getVideoReadyState() {\n let result = 0;\n if (this.$videoElement) {\n result = this.$videoElement.readyState;\n }\n return result;\n }\n\n _play() {\n this.$videoElement && this.$videoElement.play().then(() => {\n this._delayPlay = false;\n this.player.debug.log('Video', '_play success');\n setTimeout(() => {\n if (!this.isPlaying()) {\n this.player.debug.warn('Video', `play failed and retry play`)\n this._play();\n }\n }, 100)\n\n }).catch((e) => {\n this.player.debug.error('Video', '_play error', e);\n })\n }\n\n pause(isNow) {\n // 预防\n // https://developer.chrome.com/blog/play-request-was-interrupted/\n // http://alonesuperman.com/?p=23\n if (isNow) {\n this.$videoElement && this.$videoElement.pause();\n } else {\n setTimeout(() => {\n this.$videoElement && this.$videoElement.pause();\n }, 100)\n }\n }\n\n clearView() {\n\n }\n\n screenshot(filename, format, quality, type) {\n filename = filename || now();\n type = type || SCREENSHOT_TYPE.download;\n const formatType = {\n png: 'image/png',\n jpeg: 'image/jpeg',\n webp: 'image/webp'\n };\n let encoderOptions = 0.92;\n if (!formatType[format] && SCREENSHOT_TYPE[format]) {\n type = format;\n format = 'png';\n quality = undefined\n }\n if (typeof quality === \"string\") {\n type = quality;\n quality = undefined;\n }\n\n if (typeof quality !== 'undefined') {\n encoderOptions = Number(quality);\n }\n const $video = this.$videoElement;\n let canvas = this.$canvasElement;\n canvas.width = $video.videoWidth;\n canvas.height = $video.videoHeight;\n this.canvasContext.drawImage($video, 0, 0, canvas.width, canvas.height);\n const dataURL = canvas.toDataURL(formatType[format] || formatType.png, encoderOptions);\n // release memory\n this.canvasContext.clearRect(0, 0, canvas.width, canvas.height);\n canvas.width = 0;\n canvas.height = 0;\n if (type === SCREENSHOT_TYPE.base64) {\n return dataURL;\n } else {\n const file = dataURLToFile(dataURL);\n if (type === SCREENSHOT_TYPE.blob) {\n return file;\n } else if (type === SCREENSHOT_TYPE.download) {\n // downloadImg(file, filename);\n saveAs(file, filename)\n }\n }\n\n }\n\n initCanvasViewSize() {\n this.resize();\n }\n\n //\n render(msg) {\n if (this.vwriter) {\n this.vwriter.write(msg.videoFrame);\n }\n }\n\n resize() {\n let width = this.player.width;\n let height = this.player.height;\n const option = this.player._opt;\n const rotate = option.rotate;\n if (this.player.isControlBarShow()) {\n if (isMobile() && this.player.fullscreen && option.useWebFullScreen) {\n width -= CONTROL_HEIGHT;\n } else {\n height -= CONTROL_HEIGHT;\n }\n }\n\n this.$videoElement.width = width;\n this.$videoElement.height = height;\n\n if (rotate === 270 || rotate === 90) {\n this.$videoElement.width = height;\n this.$videoElement.height = width;\n }\n let resizeWidth = this.$videoElement.width;\n let resizeHeight = this.$videoElement.height;\n let left = ((width - resizeWidth) / 2)\n let top = ((height - resizeHeight) / 2)\n let objectFill = 'contain';\n\n // 默认是true\n // 视频画面做等比缩放后,高或宽对齐canvas区域,画面不被拉伸,但有黑边\n\n // 视频画面完全填充canvas区域,画面会被拉伸\n if (!option.isResize) {\n objectFill = 'fill';\n }\n\n // 视频画面做等比缩放后,完全填充canvas区域,画面不被拉伸,没有黑边,但画面显示不全\n if (option.isFullResize) {\n objectFill = 'none';\n }\n this.$videoElement.style.objectFit = objectFill;\n this.$videoElement.style.transform = 'rotate(' + rotate + 'deg)';\n this.$videoElement.style.left = left + \"px\"\n this.$videoElement.style.top = top + \"px\"\n }\n\n isPlaying() {\n return this.$videoElement && !this.$videoElement.paused;\n }\n}\n","import CanvasVideoLoader from './canvasLoader';\nimport VideoLoader from \"./videoLoader\";\n\nexport default class Video {\n constructor(player) {\n const Loader = Video.getLoaderFactory(player._opt);\n return new Loader(player);\n }\n\n static getLoaderFactory(opt) {\n if (opt.useMSE || (opt.useWCS && !opt.useOffscreen && opt.wcsUseVideoRender)) {\n return VideoLoader;\n } else {\n return CanvasVideoLoader;\n }\n }\n}\n","import Emitter from \"../utils/emitter\";\nimport {AUDIO_ENC_TYPE, AUDIO_SYNC_VIDEO_DIFF, EVENTS, VIDEO_ENC_TYPE} from \"../constant\";\nimport {clamp, noop} from \"../utils\";\n\nexport default class AudioContextLoader extends Emitter {\n constructor(player) {\n super();\n this.bufferList = [];\n this.player = player;\n this.scriptNode = null;\n this.hasInitScriptNode = false;\n this.audioContextChannel = null;\n\n this.audioContext = new (window.AudioContext || window.webkitAudioContext)();\n //\n this.gainNode = this.audioContext.createGain();\n // Get an AudioBufferSourceNode.\n // This is the AudioNode to use when we want to play an AudioBuffer\n const source = this.audioContext.createBufferSource();\n // set the buffer in the AudioBufferSourceNode\n source.buffer = this.audioContext.createBuffer(1, 1, 22050);\n // connect the AudioBufferSourceNode to the\n // destination so we can hear the sound\n source.connect(this.audioContext.destination);\n // noteOn as start\n // start the source playing\n if (source.noteOn) {\n source.noteOn(0);\n } else {\n source.start(0);\n }\n this.audioBufferSourceNode = source;\n //\n this.mediaStreamAudioDestinationNode = this.audioContext.createMediaStreamDestination();\n //\n this.audioEnabled(true);\n // default setting 0\n this.gainNode.gain.value = 0;\n this._prevVolume = null;\n\n this.playing = false;\n //\n this.audioSyncVideoOption = {\n diff: null\n };\n\n\n this.audioInfo = {\n encType: '',\n channels: '',\n sampleRate: ''\n }\n this.init = false;\n this.hasAudio = false;\n\n // update\n this.on(EVENTS.videoSyncAudio, (options) => {\n // this.player.debug.log('AudioContext', `videoSyncAudio , audioTimestamp: ${options.audioTimestamp},videoTimestamp: ${options.videoTimestamp},diff:${options.diff}`)\n this.audioSyncVideoOption = options;\n })\n\n this.player.debug.log('AudioContext', 'init');\n }\n\n resetInit() {\n this.init = false;\n this.audioInfo = {\n encType: '',\n channels: '',\n sampleRate: ''\n }\n }\n\n\n async destroy() {\n this.closeAudio();\n this.resetInit();\n if(this.audioContext){\n await this.audioContext.close();\n this.audioContext = null;\n }\n\n this.gainNode = null;\n this.hasAudio = false;\n this.playing = false;\n if (this.scriptNode) {\n this.scriptNode.onaudioprocess = noop;\n this.scriptNode = null;\n }\n this.audioBufferSourceNode = null;\n this.mediaStreamAudioDestinationNode = null;\n this.hasInitScriptNode = false;\n this.audioSyncVideoOption = {\n diff: null\n };\n this._prevVolume = null;\n this.off();\n this.player.debug.log('AudioContext', 'destroy');\n }\n\n updateAudioInfo(data) {\n if (data.encTypeCode) {\n this.audioInfo.encType = AUDIO_ENC_TYPE[data.encTypeCode];\n this.audioInfo.encTypeCode = data.encTypeCode;\n }\n\n if (data.channels) {\n this.audioInfo.channels = data.channels;\n }\n\n if (data.sampleRate) {\n this.audioInfo.sampleRate = data.sampleRate;\n }\n\n // audio 基本信息\n if (this.audioInfo.sampleRate && this.audioInfo.channels && this.audioInfo.encType && !this.init) {\n this.player.emit(EVENTS.audioInfo, this.audioInfo);\n this.init = true;\n }\n }\n\n //\n get isPlaying() {\n return this.playing;\n }\n\n get isMute() {\n return this.gainNode.gain.value === 0;\n }\n\n get volume() {\n return this.gainNode.gain.value;\n }\n\n get bufferSize() {\n return this.bufferList.length;\n }\n\n\n initScriptNode() {\n this.playing = true;\n\n if (this.hasInitScriptNode) {\n return;\n }\n const channels = this.audioInfo.channels;\n\n const scriptNode = this.audioContext.createScriptProcessor(1024, 0, channels);\n // tips: if audio isStateSuspended onaudioprocess method not working\n scriptNode.onaudioprocess = (audioProcessingEvent) => {\n const outputBuffer = audioProcessingEvent.outputBuffer;\n\n if (this.bufferList.length && this.playing) {\n // just for wasm\n if (!this.player._opt.useWCS && !this.player._opt.useMSE && this.player._opt.wasmDecodeAudioSyncVideo) {\n // audio > video\n // wait\n if (this.audioSyncVideoOption.diff > AUDIO_SYNC_VIDEO_DIFF) {\n this.player.debug.warn('AudioContext', `audioSyncVideoOption more than diff :${this.audioSyncVideoOption.diff}, waiting`)\n // wait\n return;\n }\n // audio < video\n // throw away then chase video\n else if (this.audioSyncVideoOption.diff < -AUDIO_SYNC_VIDEO_DIFF) {\n this.player.debug.warn('AudioContext', `audioSyncVideoOption less than diff :${this.audioSyncVideoOption.diff}, dropping`)\n\n //\n let bufferItem = this.bufferList.shift();\n //\n while ((bufferItem.ts - this.player.videoTimestamp < -AUDIO_SYNC_VIDEO_DIFF) && this.bufferList.length > 0) {\n // this.player.debug.warn('AudioContext', `audioSyncVideoOption less than inner ts is:${bufferItem.ts}, videoTimestamp is ${this.player.videoTimestamp},diff:${bufferItem.ts - this.player.videoTimestamp}`)\n bufferItem = this.bufferList.shift();\n }\n\n if (this.bufferList.length === 0) {\n return;\n }\n }\n }\n\n if (this.bufferList.length === 0) {\n return;\n }\n\n const bufferItem = this.bufferList.shift();\n\n // update audio time stamp\n if (bufferItem && bufferItem.ts) {\n this.player.audioTimestamp = bufferItem.ts;\n }\n\n for (let channel = 0; channel < channels; channel++) {\n const b = bufferItem.buffer[channel]\n const nowBuffering = outputBuffer.getChannelData(channel);\n for (let i = 0; i < 1024; i++) {\n nowBuffering[i] = b[i] || 0\n }\n }\n }\n }\n\n scriptNode.connect(this.gainNode);\n this.scriptNode = scriptNode;\n this.gainNode.connect(this.audioContext.destination);\n this.gainNode.connect(this.mediaStreamAudioDestinationNode);\n this.hasInitScriptNode = true;\n }\n\n mute(flag) {\n if (flag) {\n // if (!this.isMute) {\n // this.player.emit(EVENTS.mute, flag);\n // }\n this.setVolume(0);\n this.clear();\n } else {\n // if (this.isMute) {\n // this.player.emit(EVENTS.mute, flag);\n // }\n this.setVolume(0.5);\n }\n }\n\n setVolume(volume) {\n volume = parseFloat(volume).toFixed(2);\n if (isNaN(volume)) {\n return;\n }\n this.audioEnabled(true);\n volume = clamp(volume, 0, 1);\n if (this._prevVolume === null) {\n this.player.emit(EVENTS.mute, volume === 0);\n } else {\n if (this._prevVolume === 0 && volume > 0) {\n this.player.emit(EVENTS.mute, false);\n } else if (this._prevVolume > 0 && volume === 0) {\n this.player.emit(EVENTS.mute, true);\n }\n }\n this.gainNode.gain.value = volume;\n this.gainNode.gain.setValueAtTime(volume, this.audioContext.currentTime);\n this.player.emit(EVENTS.volumechange, this.player.volume);\n this.player.emit(EVENTS.volume, this.player.volume); // outer\n // save last volume\n this._prevVolume = volume;\n }\n\n closeAudio() {\n if (this.hasInitScriptNode) {\n this.scriptNode && this.scriptNode.disconnect(this.gainNode);\n this.gainNode && this.gainNode.disconnect(this.audioContext.destination);\n this.gainNode && this.gainNode.disconnect(this.mediaStreamAudioDestinationNode);\n }\n this.clear();\n }\n\n // 是否播放。。。\n audioEnabled(flag) {\n if (flag) {\n if (this.audioContext.state === 'suspended') {\n // resume\n this.audioContext.resume();\n }\n } else {\n if (this.audioContext.state === 'running') {\n // suspend\n this.audioContext.suspend();\n }\n }\n }\n\n isStateRunning() {\n return this.audioContext.state === 'running';\n }\n\n isStateSuspended() {\n return this.audioContext.state === 'suspended';\n }\n\n clear() {\n this.bufferList = [];\n }\n\n play(buffer, ts) {\n // if is mute\n if (this.isMute) {\n return;\n }\n\n this.hasAudio = true;\n\n this.bufferList.push({\n buffer,\n ts\n });\n\n if (this.bufferList.length > 20) {\n this.player.debug.warn('AudioContext', `bufferList is large: ${this.bufferList.length}`)\n\n // out of memory\n if (this.bufferList.length > 50) {\n this.bufferList.shift();\n }\n }\n // this.player.debug.log('AudioContext', `bufferList is ${this.bufferList.length}`)\n }\n\n pause() {\n this.audioSyncVideoOption = {\n diff: null\n };\n this.playing = false;\n this.clear();\n }\n\n resume() {\n this.playing = true;\n }\n\n\n}\n","import AudioContextLoader from \"./audioContextLoader\";\n\nexport default class Audio {\n constructor(player) {\n const Loader = Audio.getLoaderFactory();\n return new Loader(player);\n }\n\n static getLoaderFactory() {\n return AudioContextLoader;\n }\n}\n","import Emitter from \"../utils/emitter\";\nimport {EVENTS, EVENTS_ERROR, FETCH_ERROR, JESSIBUCA_EVENTS} from \"../constant\";\nimport {calculationRate, now} from \"../utils\";\n\nexport default class FetchLoader extends Emitter {\n constructor(player) {\n super();\n this.player = player;\n this.playing = false;\n\n this.abortController = new AbortController();\n //\n this.streamRate = calculationRate(rate => {\n player.emit(EVENTS.kBps, (rate / 1024).toFixed(2));\n });\n player.debug.log('FetchStream', 'init');\n }\n\n async destroy() {\n this.abort()\n this.off();\n this.streamRate = null;\n this.player.debug.log('FetchStream', 'destroy');\n }\n\n /**\n *\n * @param url\n * @param options\n */\n fetchStream(url, options = {}) {\n const {demux} = this.player;\n this.player.debug.log('FetchStream', 'fetchStream', url, JSON.stringify(options));\n this.player._times.streamStart = now();\n const fetchOptions = Object.assign({\n signal: this.abortController.signal,\n }, {\n headers: options.headers || {}\n });\n fetch(url, fetchOptions).then((res) => {\n const reader = res.body.getReader();\n this.emit(EVENTS.streamSuccess);\n const fetchNext = () => {\n reader.read().then(({done, value}) => {\n if (done) {\n demux.close();\n } else {\n this.streamRate && this.streamRate(value.byteLength);\n demux.dispatch(value);\n fetchNext();\n }\n }\n ).catch((e) => {\n demux.close();\n const errorString = e.toString();\n // aborted a request 。\n if (errorString.indexOf(FETCH_ERROR.abortError1) !== -1) {\n return\n }\n\n if (errorString.indexOf(FETCH_ERROR.abortError2) !== -1) {\n return;\n }\n\n if (e.name === FETCH_ERROR.abort) {\n return;\n }\n\n\n this.abort();\n\n this.emit(EVENTS_ERROR.fetchError, e);\n this.player.emit(EVENTS.error, EVENTS_ERROR.fetchError);\n })\n }\n fetchNext();\n }).catch((e) => {\n if (e.name === 'AbortError') {\n return;\n }\n demux.close();\n this.abort();\n this.emit(EVENTS_ERROR.fetchError, e)\n this.player.emit(EVENTS.error, EVENTS_ERROR.fetchError);\n })\n }\n\n abort() {\n if (this.abortController) {\n this.abortController.abort();\n this.abortController = null\n }\n }\n\n\n}\n","import Emitter from \"../utils/emitter\";\nimport {EVENTS, EVENTS_ERROR, WEBSOCKET_STATUS} from \"../constant\";\nimport {calculationRate, now} from \"../utils\";\n\nexport default class WebsocketLoader extends Emitter {\n constructor(player) {\n super();\n this.player = player;\n this.socket = null;\n this.socketStatus = WEBSOCKET_STATUS.notConnect;\n this.wsUrl = null;\n //\n this.streamRate = calculationRate(rate => {\n player.emit(EVENTS.kBps, (rate / 1024).toFixed(2));\n });\n\n player.debug.log('WebsocketLoader', 'init');\n }\n\n async destroy() {\n if (this.socket) {\n this.socket.close(1000, 'Client disconnecting');\n this.socket = null;\n }\n this.socketStatus = WEBSOCKET_STATUS.notConnect;\n this.streamRate = null;\n this.wsUrl = null;\n this.off();\n this.player.debug.log('websocketLoader', 'destroy');\n }\n\n _createWebSocket() {\n const player = this.player;\n const {\n debug,\n events: {proxy},\n demux,\n } = player;\n\n this.socket = new WebSocket(this.wsUrl);\n this.socket.binaryType = 'arraybuffer';\n proxy(this.socket, 'open', () => {\n this.emit(EVENTS.streamSuccess);\n debug.log('websocketLoader', 'socket open');\n this.socketStatus = WEBSOCKET_STATUS.open;\n });\n\n proxy(this.socket, 'message', event => {\n this.streamRate && this.streamRate(event.data.byteLength);\n this._handleMessage(event.data);\n });\n\n\n proxy(this.socket, 'close', () => {\n debug.log('websocketLoader', 'socket close');\n this.emit(EVENTS.streamEnd);\n this.socketStatus = WEBSOCKET_STATUS.close;\n });\n\n proxy(this.socket, 'error', error => {\n debug.log('websocketLoader', 'socket error');\n this.emit(EVENTS_ERROR.websocketError, error);\n this.player.emit(EVENTS.error, EVENTS_ERROR.websocketError);\n this.socketStatus = WEBSOCKET_STATUS.error;\n demux.close();\n debug.log('websocketLoader', `socket error:`, error);\n });\n }\n\n //\n _handleMessage(message) {\n const {demux} = this.player;\n if (!demux) {\n this.player.debug.warn('websocketLoader', 'websocket handle message demux is null');\n return;\n }\n demux.dispatch(message);\n }\n\n\n /**\n *\n * @param url\n * @param options\n */\n fetchStream(url, options) {\n this.player._times.streamStart = now();\n this.wsUrl = url;\n this._createWebSocket();\n }\n\n\n}\n","import FetchLoader from \"./fetchLoader\";\nimport WebsocketLoader from \"./websocketLoader\";\nimport {PLAYER_PLAY_PROTOCOL} from \"../constant\";\n\nexport default class Stream {\n constructor(player) {\n const Loader = Stream.getLoaderFactory(player._opt.protocol);\n return new Loader(player);\n }\n\n static getLoaderFactory(protocol) {\n if (protocol === PLAYER_PLAY_PROTOCOL.fetch) {\n return FetchLoader;\n } else if (protocol === PLAYER_PLAY_PROTOCOL.websocket) {\n return WebsocketLoader;\n }\n }\n}\n","'use strict';\r\n\r\n// Last time updated: 2021-03-09 3:20:22 AM UTC\r\n\r\n// ________________\r\n// RecordRTC v5.6.2\r\n\r\n// Open-Sourced: https://github.com/muaz-khan/RecordRTC\r\n\r\n// --------------------------------------------------\r\n// Muaz Khan - www.MuazKhan.com\r\n// MIT License - www.WebRTC-Experiment.com/licence\r\n// --------------------------------------------------\r\n\r\n// ____________\r\n// RecordRTC.js\r\n\r\n/**\r\n * {@link https://github.com/muaz-khan/RecordRTC|RecordRTC} is a WebRTC JavaScript library for audio/video as well as screen activity recording. It supports Chrome, Firefox, Opera, Android, and Microsoft Edge. Platforms: Linux, Mac and Windows. \r\n * @summary Record audio, video or screen inside the browser.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef RecordRTC\r\n * @class\r\n * @example\r\n * var recorder = RecordRTC(mediaStream or [arrayOfMediaStream], {\r\n * type: 'video', // audio or video or gif or canvas\r\n * recorderType: MediaStreamRecorder || CanvasRecorder || StereoAudioRecorder || Etc\r\n * });\r\n * recorder.startRecording();\r\n * @see For further information:\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - Single media-stream object, array of media-streams, html-canvas-element, etc.\r\n * @param {object} config - {type:\"video\", recorderType: MediaStreamRecorder, disableLogs: true, numberOfAudioChannels: 1, bufferSize: 0, sampleRate: 0, desiredSampRate: 16000, video: HTMLVideoElement, etc.}\r\n */\r\n\r\nfunction RecordRTC(mediaStream, config) {\r\n if (!mediaStream) {\r\n throw 'First parameter is required.';\r\n }\r\n\r\n config = config || {\r\n type: 'video'\r\n };\r\n\r\n config = new RecordRTCConfiguration(mediaStream, config);\r\n\r\n // a reference to user's recordRTC object\r\n var self = this;\r\n\r\n function startRecording(config2) {\r\n if (!config.disableLogs) {\r\n console.log('RecordRTC version: ', self.version);\r\n }\r\n\r\n if (!!config2) {\r\n // allow users to set options using startRecording method\r\n // config2 is similar to main \"config\" object (second parameter over RecordRTC constructor)\r\n config = new RecordRTCConfiguration(mediaStream, config2);\r\n }\r\n\r\n if (!config.disableLogs) {\r\n console.log('started recording ' + config.type + ' stream.');\r\n }\r\n\r\n if (mediaRecorder) {\r\n mediaRecorder.clearRecordedData();\r\n mediaRecorder.record();\r\n\r\n setState('recording');\r\n\r\n if (self.recordingDuration) {\r\n handleRecordingDuration();\r\n }\r\n return self;\r\n }\r\n\r\n initRecorder(function() {\r\n if (self.recordingDuration) {\r\n handleRecordingDuration();\r\n }\r\n });\r\n\r\n return self;\r\n }\r\n\r\n function initRecorder(initCallback) {\r\n if (initCallback) {\r\n config.initCallback = function() {\r\n initCallback();\r\n initCallback = config.initCallback = null; // recorder.initRecorder should be call-backed once.\r\n };\r\n }\r\n\r\n var Recorder = new GetRecorderType(mediaStream, config);\r\n\r\n mediaRecorder = new Recorder(mediaStream, config);\r\n mediaRecorder.record();\r\n\r\n setState('recording');\r\n\r\n if (!config.disableLogs) {\r\n console.log('Initialized recorderType:', mediaRecorder.constructor.name, 'for output-type:', config.type);\r\n }\r\n }\r\n\r\n function stopRecording(callback) {\r\n callback = callback || function() {};\r\n\r\n if (!mediaRecorder) {\r\n warningLog();\r\n return;\r\n }\r\n\r\n if (self.state === 'paused') {\r\n self.resumeRecording();\r\n\r\n setTimeout(function() {\r\n stopRecording(callback);\r\n }, 1);\r\n return;\r\n }\r\n\r\n if (self.state !== 'recording' && !config.disableLogs) {\r\n console.warn('Recording state should be: \"recording\", however current state is: ', self.state);\r\n }\r\n\r\n if (!config.disableLogs) {\r\n console.log('Stopped recording ' + config.type + ' stream.');\r\n }\r\n\r\n if (config.type !== 'gif') {\r\n mediaRecorder.stop(_callback);\r\n } else {\r\n mediaRecorder.stop();\r\n _callback();\r\n }\r\n\r\n setState('stopped');\r\n\r\n function _callback(__blob) {\r\n if (!mediaRecorder) {\r\n if (typeof callback.call === 'function') {\r\n callback.call(self, '');\r\n } else {\r\n callback('');\r\n }\r\n return;\r\n }\r\n\r\n Object.keys(mediaRecorder).forEach(function(key) {\r\n if (typeof mediaRecorder[key] === 'function') {\r\n return;\r\n }\r\n\r\n self[key] = mediaRecorder[key];\r\n });\r\n\r\n var blob = mediaRecorder.blob;\r\n\r\n if (!blob) {\r\n if (__blob) {\r\n mediaRecorder.blob = blob = __blob;\r\n } else {\r\n throw 'Recording failed.';\r\n }\r\n }\r\n\r\n if (blob && !config.disableLogs) {\r\n console.log(blob.type, '->', bytesToSize(blob.size));\r\n }\r\n\r\n if (callback) {\r\n var url;\r\n\r\n try {\r\n url = URL.createObjectURL(blob);\r\n } catch (e) {}\r\n\r\n if (typeof callback.call === 'function') {\r\n callback.call(self, url);\r\n } else {\r\n callback(url);\r\n }\r\n }\r\n\r\n if (!config.autoWriteToDisk) {\r\n return;\r\n }\r\n\r\n getDataURL(function(dataURL) {\r\n var parameter = {};\r\n parameter[config.type + 'Blob'] = dataURL;\r\n DiskStorage.Store(parameter);\r\n });\r\n }\r\n }\r\n\r\n function pauseRecording() {\r\n if (!mediaRecorder) {\r\n warningLog();\r\n return;\r\n }\r\n\r\n if (self.state !== 'recording') {\r\n if (!config.disableLogs) {\r\n console.warn('Unable to pause the recording. Recording state: ', self.state);\r\n }\r\n return;\r\n }\r\n\r\n setState('paused');\r\n\r\n mediaRecorder.pause();\r\n\r\n if (!config.disableLogs) {\r\n console.log('Paused recording.');\r\n }\r\n }\r\n\r\n function resumeRecording() {\r\n if (!mediaRecorder) {\r\n warningLog();\r\n return;\r\n }\r\n\r\n if (self.state !== 'paused') {\r\n if (!config.disableLogs) {\r\n console.warn('Unable to resume the recording. Recording state: ', self.state);\r\n }\r\n return;\r\n }\r\n\r\n setState('recording');\r\n\r\n // not all libs have this method yet\r\n mediaRecorder.resume();\r\n\r\n if (!config.disableLogs) {\r\n console.log('Resumed recording.');\r\n }\r\n }\r\n\r\n function readFile(_blob) {\r\n postMessage(new FileReaderSync().readAsDataURL(_blob));\r\n }\r\n\r\n function getDataURL(callback, _mediaRecorder) {\r\n if (!callback) {\r\n throw 'Pass a callback function over getDataURL.';\r\n }\r\n\r\n var blob = _mediaRecorder ? _mediaRecorder.blob : (mediaRecorder || {}).blob;\r\n\r\n if (!blob) {\r\n if (!config.disableLogs) {\r\n console.warn('Blob encoder did not finish its job yet.');\r\n }\r\n\r\n setTimeout(function() {\r\n getDataURL(callback, _mediaRecorder);\r\n }, 1000);\r\n return;\r\n }\r\n\r\n if (typeof Worker !== 'undefined' && !navigator.mozGetUserMedia) {\r\n var webWorker = processInWebWorker(readFile);\r\n\r\n webWorker.onmessage = function(event) {\r\n callback(event.data);\r\n };\r\n\r\n webWorker.postMessage(blob);\r\n } else {\r\n var reader = new FileReader();\r\n reader.readAsDataURL(blob);\r\n reader.onload = function(event) {\r\n callback(event.target.result);\r\n };\r\n }\r\n\r\n function processInWebWorker(_function) {\r\n try {\r\n var blob = URL.createObjectURL(new Blob([_function.toString(),\r\n 'this.onmessage = function (eee) {' + _function.name + '(eee.data);}'\r\n ], {\r\n type: 'application/javascript'\r\n }));\r\n\r\n var worker = new Worker(blob);\r\n URL.revokeObjectURL(blob);\r\n return worker;\r\n } catch (e) {}\r\n }\r\n }\r\n\r\n function handleRecordingDuration(counter) {\r\n counter = counter || 0;\r\n\r\n if (self.state === 'paused') {\r\n setTimeout(function() {\r\n handleRecordingDuration(counter);\r\n }, 1000);\r\n return;\r\n }\r\n\r\n if (self.state === 'stopped') {\r\n return;\r\n }\r\n\r\n if (counter >= self.recordingDuration) {\r\n stopRecording(self.onRecordingStopped);\r\n return;\r\n }\r\n\r\n counter += 1000; // 1-second\r\n\r\n setTimeout(function() {\r\n handleRecordingDuration(counter);\r\n }, 1000);\r\n }\r\n\r\n function setState(state) {\r\n if (!self) {\r\n return;\r\n }\r\n\r\n self.state = state;\r\n\r\n if (typeof self.onStateChanged.call === 'function') {\r\n self.onStateChanged.call(self, state);\r\n } else {\r\n self.onStateChanged(state);\r\n }\r\n }\r\n\r\n var WARNING = 'It seems that recorder is destroyed or \"startRecording\" is not invoked for ' + config.type + ' recorder.';\r\n\r\n function warningLog() {\r\n if (config.disableLogs === true) {\r\n return;\r\n }\r\n\r\n console.warn(WARNING);\r\n }\r\n\r\n var mediaRecorder;\r\n\r\n var returnObject = {\r\n /**\r\n * This method starts the recording.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * var recorder = RecordRTC(mediaStream, {\r\n * type: 'video'\r\n * });\r\n * recorder.startRecording();\r\n */\r\n startRecording: startRecording,\r\n\r\n /**\r\n * This method stops the recording. It is strongly recommended to get \"blob\" or \"URI\" inside the callback to make sure all recorders finished their job.\r\n * @param {function} callback - Callback to get the recorded blob.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * recorder.stopRecording(function() {\r\n * // use either \"this\" or \"recorder\" object; both are identical\r\n * video.src = this.toURL();\r\n * var blob = this.getBlob();\r\n * });\r\n */\r\n stopRecording: stopRecording,\r\n\r\n /**\r\n * This method pauses the recording. You can resume recording using \"resumeRecording\" method.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @todo Firefox is unable to pause the recording. Fix it.\r\n * @example\r\n * recorder.pauseRecording(); // pause the recording\r\n * recorder.resumeRecording(); // resume again\r\n */\r\n pauseRecording: pauseRecording,\r\n\r\n /**\r\n * This method resumes the recording.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * recorder.pauseRecording(); // first of all, pause the recording\r\n * recorder.resumeRecording(); // now resume it\r\n */\r\n resumeRecording: resumeRecording,\r\n\r\n /**\r\n * This method initializes the recording.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @todo This method should be deprecated.\r\n * @example\r\n * recorder.initRecorder();\r\n */\r\n initRecorder: initRecorder,\r\n\r\n /**\r\n * Ask RecordRTC to auto-stop the recording after 5 minutes.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * var fiveMinutes = 5 * 1000 * 60;\r\n * recorder.setRecordingDuration(fiveMinutes, function() {\r\n * var blob = this.getBlob();\r\n * video.src = this.toURL();\r\n * });\r\n * \r\n * // or otherwise\r\n * recorder.setRecordingDuration(fiveMinutes).onRecordingStopped(function() {\r\n * var blob = this.getBlob();\r\n * video.src = this.toURL();\r\n * });\r\n */\r\n setRecordingDuration: function(recordingDuration, callback) {\r\n if (typeof recordingDuration === 'undefined') {\r\n throw 'recordingDuration is required.';\r\n }\r\n\r\n if (typeof recordingDuration !== 'number') {\r\n throw 'recordingDuration must be a number.';\r\n }\r\n\r\n self.recordingDuration = recordingDuration;\r\n self.onRecordingStopped = callback || function() {};\r\n\r\n return {\r\n onRecordingStopped: function(callback) {\r\n self.onRecordingStopped = callback;\r\n }\r\n };\r\n },\r\n\r\n /**\r\n * This method can be used to clear/reset all the recorded data.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @todo Figure out the difference between \"reset\" and \"clearRecordedData\" methods.\r\n * @example\r\n * recorder.clearRecordedData();\r\n */\r\n clearRecordedData: function() {\r\n if (!mediaRecorder) {\r\n warningLog();\r\n return;\r\n }\r\n\r\n mediaRecorder.clearRecordedData();\r\n\r\n if (!config.disableLogs) {\r\n console.log('Cleared old recorded data.');\r\n }\r\n },\r\n\r\n /**\r\n * Get the recorded blob. Use this method inside the \"stopRecording\" callback.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * recorder.stopRecording(function() {\r\n * var blob = this.getBlob();\r\n *\r\n * var file = new File([blob], 'filename.webm', {\r\n * type: 'video/webm'\r\n * });\r\n *\r\n * var formData = new FormData();\r\n * formData.append('file', file); // upload \"File\" object rather than a \"Blob\"\r\n * uploadToServer(formData);\r\n * });\r\n * @returns {Blob} Returns recorded data as \"Blob\" object.\r\n */\r\n getBlob: function() {\r\n if (!mediaRecorder) {\r\n warningLog();\r\n return;\r\n }\r\n\r\n return mediaRecorder.blob;\r\n },\r\n\r\n /**\r\n * Get data-URI instead of Blob.\r\n * @param {function} callback - Callback to get the Data-URI.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * recorder.stopRecording(function() {\r\n * recorder.getDataURL(function(dataURI) {\r\n * video.src = dataURI;\r\n * });\r\n * });\r\n */\r\n getDataURL: getDataURL,\r\n\r\n /**\r\n * Get virtual/temporary URL. Usage of this URL is limited to current tab.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * recorder.stopRecording(function() {\r\n * video.src = this.toURL();\r\n * });\r\n * @returns {String} Returns a virtual/temporary URL for the recorded \"Blob\".\r\n */\r\n toURL: function() {\r\n if (!mediaRecorder) {\r\n warningLog();\r\n return;\r\n }\r\n\r\n return URL.createObjectURL(mediaRecorder.blob);\r\n },\r\n\r\n /**\r\n * Get internal recording object (i.e. internal module) e.g. MutliStreamRecorder, MediaStreamRecorder, StereoAudioRecorder or WhammyRecorder etc.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * var internalRecorder = recorder.getInternalRecorder();\r\n * if(internalRecorder instanceof MultiStreamRecorder) {\r\n * internalRecorder.addStreams([newAudioStream]);\r\n * internalRecorder.resetVideoStreams([screenStream]);\r\n * }\r\n * @returns {Object} Returns internal recording object.\r\n */\r\n getInternalRecorder: function() {\r\n return mediaRecorder;\r\n },\r\n\r\n /**\r\n * Invoke save-as dialog to save the recorded blob into your disk.\r\n * @param {string} fileName - Set your own file name.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * recorder.stopRecording(function() {\r\n * this.save('file-name');\r\n *\r\n * // or manually:\r\n * invokeSaveAsDialog(this.getBlob(), 'filename.webm');\r\n * });\r\n */\r\n save: function(fileName) {\r\n if (!mediaRecorder) {\r\n warningLog();\r\n return;\r\n }\r\n\r\n invokeSaveAsDialog(mediaRecorder.blob, fileName);\r\n },\r\n\r\n /**\r\n * This method gets a blob from indexed-DB storage.\r\n * @param {function} callback - Callback to get the recorded blob.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * recorder.getFromDisk(function(dataURL) {\r\n * video.src = dataURL;\r\n * });\r\n */\r\n getFromDisk: function(callback) {\r\n if (!mediaRecorder) {\r\n warningLog();\r\n return;\r\n }\r\n\r\n RecordRTC.getFromDisk(config.type, callback);\r\n },\r\n\r\n /**\r\n * This method appends an array of webp images to the recorded video-blob. It takes an \"array\" object.\r\n * @type {Array.}\r\n * @param {Array} arrayOfWebPImages - Array of webp images.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @todo This method should be deprecated.\r\n * @example\r\n * var arrayOfWebPImages = [];\r\n * arrayOfWebPImages.push({\r\n * duration: index,\r\n * image: 'data:image/webp;base64,...'\r\n * });\r\n * recorder.setAdvertisementArray(arrayOfWebPImages);\r\n */\r\n setAdvertisementArray: function(arrayOfWebPImages) {\r\n config.advertisement = [];\r\n\r\n var length = arrayOfWebPImages.length;\r\n for (var i = 0; i < length; i++) {\r\n config.advertisement.push({\r\n duration: i,\r\n image: arrayOfWebPImages[i]\r\n });\r\n }\r\n },\r\n\r\n /**\r\n * It is equivalent to \"recorder.getBlob()\" method. Usage of \"getBlob\" is recommended, though.\r\n * @property {Blob} blob - Recorded Blob can be accessed using this property.\r\n * @memberof RecordRTC\r\n * @instance\r\n * @readonly\r\n * @example\r\n * recorder.stopRecording(function() {\r\n * var blob = this.blob;\r\n *\r\n * // below one is recommended\r\n * var blob = this.getBlob();\r\n * });\r\n */\r\n blob: null,\r\n\r\n /**\r\n * This works only with {recorderType:StereoAudioRecorder}. Use this property on \"stopRecording\" to verify the encoder's sample-rates.\r\n * @property {number} bufferSize - Buffer-size used to encode the WAV container\r\n * @memberof RecordRTC\r\n * @instance\r\n * @readonly\r\n * @example\r\n * recorder.stopRecording(function() {\r\n * alert('Recorder used this buffer-size: ' + this.bufferSize);\r\n * });\r\n */\r\n bufferSize: 0,\r\n\r\n /**\r\n * This works only with {recorderType:StereoAudioRecorder}. Use this property on \"stopRecording\" to verify the encoder's sample-rates.\r\n * @property {number} sampleRate - Sample-rates used to encode the WAV container\r\n * @memberof RecordRTC\r\n * @instance\r\n * @readonly\r\n * @example\r\n * recorder.stopRecording(function() {\r\n * alert('Recorder used these sample-rates: ' + this.sampleRate);\r\n * });\r\n */\r\n sampleRate: 0,\r\n\r\n /**\r\n * {recorderType:StereoAudioRecorder} returns ArrayBuffer object.\r\n * @property {ArrayBuffer} buffer - Audio ArrayBuffer, supported only in Chrome.\r\n * @memberof RecordRTC\r\n * @instance\r\n * @readonly\r\n * @example\r\n * recorder.stopRecording(function() {\r\n * var arrayBuffer = this.buffer;\r\n * alert(arrayBuffer.byteLength);\r\n * });\r\n */\r\n buffer: null,\r\n\r\n /**\r\n * This method resets the recorder. So that you can reuse single recorder instance many times.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * recorder.reset();\r\n * recorder.startRecording();\r\n */\r\n reset: function() {\r\n if (self.state === 'recording' && !config.disableLogs) {\r\n console.warn('Stop an active recorder.');\r\n }\r\n\r\n if (mediaRecorder && typeof mediaRecorder.clearRecordedData === 'function') {\r\n mediaRecorder.clearRecordedData();\r\n }\r\n mediaRecorder = null;\r\n setState('inactive');\r\n self.blob = null;\r\n },\r\n\r\n /**\r\n * This method is called whenever recorder's state changes. Use this as an \"event\".\r\n * @property {String} state - A recorder's state can be: recording, paused, stopped or inactive.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * recorder.onStateChanged = function(state) {\r\n * console.log('Recorder state: ', state);\r\n * };\r\n */\r\n onStateChanged: function(state) {\r\n if (!config.disableLogs) {\r\n console.log('Recorder state changed:', state);\r\n }\r\n },\r\n\r\n /**\r\n * A recorder can have inactive, recording, paused or stopped states.\r\n * @property {String} state - A recorder's state can be: recording, paused, stopped or inactive.\r\n * @memberof RecordRTC\r\n * @static\r\n * @readonly\r\n * @example\r\n * // this looper function will keep you updated about the recorder's states.\r\n * (function looper() {\r\n * document.querySelector('h1').innerHTML = 'Recorder\\'s state is: ' + recorder.state;\r\n * if(recorder.state === 'stopped') return; // ignore+stop\r\n * setTimeout(looper, 1000); // update after every 3-seconds\r\n * })();\r\n * recorder.startRecording();\r\n */\r\n state: 'inactive',\r\n\r\n /**\r\n * Get recorder's readonly state.\r\n * @method\r\n * @memberof RecordRTC\r\n * @example\r\n * var state = recorder.getState();\r\n * @returns {String} Returns recording state.\r\n */\r\n getState: function() {\r\n return self.state;\r\n },\r\n\r\n /**\r\n * Destroy RecordRTC instance. Clear all recorders and objects.\r\n * @method\r\n * @memberof RecordRTC\r\n * @example\r\n * recorder.destroy();\r\n */\r\n destroy: function() {\r\n var disableLogsCache = config.disableLogs;\r\n\r\n config = {\r\n disableLogs: true\r\n };\r\n self.reset();\r\n setState('destroyed');\r\n returnObject = self = null;\r\n\r\n if (Storage.AudioContextConstructor) {\r\n Storage.AudioContextConstructor.close();\r\n Storage.AudioContextConstructor = null;\r\n }\r\n\r\n config.disableLogs = disableLogsCache;\r\n\r\n if (!config.disableLogs) {\r\n console.log('RecordRTC is destroyed.');\r\n }\r\n },\r\n\r\n /**\r\n * RecordRTC version number\r\n * @property {String} version - Release version number.\r\n * @memberof RecordRTC\r\n * @static\r\n * @readonly\r\n * @example\r\n * alert(recorder.version);\r\n */\r\n version: '5.6.2'\r\n };\r\n\r\n if (!this) {\r\n self = returnObject;\r\n return returnObject;\r\n }\r\n\r\n // if someone wants to use RecordRTC with the \"new\" keyword.\r\n for (var prop in returnObject) {\r\n this[prop] = returnObject[prop];\r\n }\r\n\r\n self = this;\r\n\r\n return returnObject;\r\n}\r\n\r\nRecordRTC.version = '5.6.2';\r\n\r\nif (typeof module !== 'undefined' /* && !!module.exports*/ ) {\r\n module.exports = RecordRTC;\r\n}\r\n\r\nif (typeof define === 'function' && define.amd) {\r\n define('RecordRTC', [], function() {\r\n return RecordRTC;\r\n });\r\n}\n\r\nRecordRTC.getFromDisk = function(type, callback) {\r\n if (!callback) {\r\n throw 'callback is mandatory.';\r\n }\r\n\r\n console.log('Getting recorded ' + (type === 'all' ? 'blobs' : type + ' blob ') + ' from disk!');\r\n DiskStorage.Fetch(function(dataURL, _type) {\r\n if (type !== 'all' && _type === type + 'Blob' && callback) {\r\n callback(dataURL);\r\n }\r\n\r\n if (type === 'all' && callback) {\r\n callback(dataURL, _type.replace('Blob', ''));\r\n }\r\n });\r\n};\r\n\r\n/**\r\n * This method can be used to store recorded blobs into IndexedDB storage.\r\n * @param {object} options - {audio: Blob, video: Blob, gif: Blob}\r\n * @method\r\n * @memberof RecordRTC\r\n * @example\r\n * RecordRTC.writeToDisk({\r\n * audio: audioBlob,\r\n * video: videoBlob,\r\n * gif : gifBlob\r\n * });\r\n */\r\nRecordRTC.writeToDisk = function(options) {\r\n console.log('Writing recorded blob(s) to disk!');\r\n options = options || {};\r\n if (options.audio && options.video && options.gif) {\r\n options.audio.getDataURL(function(audioDataURL) {\r\n options.video.getDataURL(function(videoDataURL) {\r\n options.gif.getDataURL(function(gifDataURL) {\r\n DiskStorage.Store({\r\n audioBlob: audioDataURL,\r\n videoBlob: videoDataURL,\r\n gifBlob: gifDataURL\r\n });\r\n });\r\n });\r\n });\r\n } else if (options.audio && options.video) {\r\n options.audio.getDataURL(function(audioDataURL) {\r\n options.video.getDataURL(function(videoDataURL) {\r\n DiskStorage.Store({\r\n audioBlob: audioDataURL,\r\n videoBlob: videoDataURL\r\n });\r\n });\r\n });\r\n } else if (options.audio && options.gif) {\r\n options.audio.getDataURL(function(audioDataURL) {\r\n options.gif.getDataURL(function(gifDataURL) {\r\n DiskStorage.Store({\r\n audioBlob: audioDataURL,\r\n gifBlob: gifDataURL\r\n });\r\n });\r\n });\r\n } else if (options.video && options.gif) {\r\n options.video.getDataURL(function(videoDataURL) {\r\n options.gif.getDataURL(function(gifDataURL) {\r\n DiskStorage.Store({\r\n videoBlob: videoDataURL,\r\n gifBlob: gifDataURL\r\n });\r\n });\r\n });\r\n } else if (options.audio) {\r\n options.audio.getDataURL(function(audioDataURL) {\r\n DiskStorage.Store({\r\n audioBlob: audioDataURL\r\n });\r\n });\r\n } else if (options.video) {\r\n options.video.getDataURL(function(videoDataURL) {\r\n DiskStorage.Store({\r\n videoBlob: videoDataURL\r\n });\r\n });\r\n } else if (options.gif) {\r\n options.gif.getDataURL(function(gifDataURL) {\r\n DiskStorage.Store({\r\n gifBlob: gifDataURL\r\n });\r\n });\r\n }\r\n};\n\r\n// __________________________\r\n// RecordRTC-Configuration.js\r\n\r\n/**\r\n * {@link RecordRTCConfiguration} is an inner/private helper for {@link RecordRTC}.\r\n * @summary It configures the 2nd parameter passed over {@link RecordRTC} and returns a valid \"config\" object.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef RecordRTCConfiguration\r\n * @class\r\n * @example\r\n * var options = RecordRTCConfiguration(mediaStream, options);\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.\r\n * @param {object} config - {type:\"video\", disableLogs: true, numberOfAudioChannels: 1, bufferSize: 0, sampleRate: 0, video: HTMLVideoElement, getNativeBlob:true, etc.}\r\n */\r\n\r\nfunction RecordRTCConfiguration(mediaStream, config) {\r\n if (!config.recorderType && !config.type) {\r\n if (!!config.audio && !!config.video) {\r\n config.type = 'video';\r\n } else if (!!config.audio && !config.video) {\r\n config.type = 'audio';\r\n }\r\n }\r\n\r\n if (config.recorderType && !config.type) {\r\n if (config.recorderType === WhammyRecorder || config.recorderType === CanvasRecorder || (typeof WebAssemblyRecorder !== 'undefined' && config.recorderType === WebAssemblyRecorder)) {\r\n config.type = 'video';\r\n } else if (config.recorderType === GifRecorder) {\r\n config.type = 'gif';\r\n } else if (config.recorderType === StereoAudioRecorder) {\r\n config.type = 'audio';\r\n } else if (config.recorderType === MediaStreamRecorder) {\r\n if (getTracks(mediaStream, 'audio').length && getTracks(mediaStream, 'video').length) {\r\n config.type = 'video';\r\n } else if (!getTracks(mediaStream, 'audio').length && getTracks(mediaStream, 'video').length) {\r\n config.type = 'video';\r\n } else if (getTracks(mediaStream, 'audio').length && !getTracks(mediaStream, 'video').length) {\r\n config.type = 'audio';\r\n } else {\r\n // config.type = 'UnKnown';\r\n }\r\n }\r\n }\r\n\r\n if (typeof MediaStreamRecorder !== 'undefined' && typeof MediaRecorder !== 'undefined' && 'requestData' in MediaRecorder.prototype) {\r\n if (!config.mimeType) {\r\n config.mimeType = 'video/webm';\r\n }\r\n\r\n if (!config.type) {\r\n config.type = config.mimeType.split('/')[0];\r\n }\r\n\r\n if (!config.bitsPerSecond) {\r\n // config.bitsPerSecond = 128000;\r\n }\r\n }\r\n\r\n // consider default type=audio\r\n if (!config.type) {\r\n if (config.mimeType) {\r\n config.type = config.mimeType.split('/')[0];\r\n }\r\n if (!config.type) {\r\n config.type = 'audio';\r\n }\r\n }\r\n\r\n return config;\r\n}\n\r\n// __________________\r\n// GetRecorderType.js\r\n\r\n/**\r\n * {@link GetRecorderType} is an inner/private helper for {@link RecordRTC}.\r\n * @summary It returns best recorder-type available for your browser.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef GetRecorderType\r\n * @class\r\n * @example\r\n * var RecorderType = GetRecorderType(options);\r\n * var recorder = new RecorderType(options);\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.\r\n * @param {object} config - {type:\"video\", disableLogs: true, numberOfAudioChannels: 1, bufferSize: 0, sampleRate: 0, video: HTMLVideoElement, etc.}\r\n */\r\n\r\nfunction GetRecorderType(mediaStream, config) {\r\n var recorder;\r\n\r\n // StereoAudioRecorder can work with all three: Edge, Firefox and Chrome\r\n // todo: detect if it is Edge, then auto use: StereoAudioRecorder\r\n if (isChrome || isEdge || isOpera) {\r\n // Media Stream Recording API has not been implemented in chrome yet;\r\n // That's why using WebAudio API to record stereo audio in WAV format\r\n recorder = StereoAudioRecorder;\r\n }\r\n\r\n if (typeof MediaRecorder !== 'undefined' && 'requestData' in MediaRecorder.prototype && !isChrome) {\r\n recorder = MediaStreamRecorder;\r\n }\r\n\r\n // video recorder (in WebM format)\r\n if (config.type === 'video' && (isChrome || isOpera)) {\r\n recorder = WhammyRecorder;\r\n\r\n if (typeof WebAssemblyRecorder !== 'undefined' && typeof ReadableStream !== 'undefined') {\r\n recorder = WebAssemblyRecorder;\r\n }\r\n }\r\n\r\n // video recorder (in Gif format)\r\n if (config.type === 'gif') {\r\n recorder = GifRecorder;\r\n }\r\n\r\n // html2canvas recording!\r\n if (config.type === 'canvas') {\r\n recorder = CanvasRecorder;\r\n }\r\n\r\n if (isMediaRecorderCompatible() && recorder !== CanvasRecorder && recorder !== GifRecorder && typeof MediaRecorder !== 'undefined' && 'requestData' in MediaRecorder.prototype) {\r\n if (getTracks(mediaStream, 'video').length || getTracks(mediaStream, 'audio').length) {\r\n // audio-only recording\r\n if (config.type === 'audio') {\r\n if (typeof MediaRecorder.isTypeSupported === 'function' && MediaRecorder.isTypeSupported('audio/webm')) {\r\n recorder = MediaStreamRecorder;\r\n }\r\n // else recorder = StereoAudioRecorder;\r\n } else {\r\n // video or screen tracks\r\n if (typeof MediaRecorder.isTypeSupported === 'function' && MediaRecorder.isTypeSupported('video/webm')) {\r\n recorder = MediaStreamRecorder;\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (mediaStream instanceof Array && mediaStream.length) {\r\n recorder = MultiStreamRecorder;\r\n }\r\n\r\n if (config.recorderType) {\r\n recorder = config.recorderType;\r\n }\r\n\r\n if (!config.disableLogs && !!recorder && !!recorder.name) {\r\n console.log('Using recorderType:', recorder.name || recorder.constructor.name);\r\n }\r\n\r\n if (!recorder && isSafari) {\r\n recorder = MediaStreamRecorder;\r\n }\r\n\r\n return recorder;\r\n}\n\r\n// _____________\r\n// MRecordRTC.js\r\n\r\n/**\r\n * MRecordRTC runs on top of {@link RecordRTC} to bring multiple recordings in a single place, by providing simple API.\r\n * @summary MRecordRTC stands for \"Multiple-RecordRTC\".\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef MRecordRTC\r\n * @class\r\n * @example\r\n * var recorder = new MRecordRTC();\r\n * recorder.addStream(MediaStream);\r\n * recorder.mediaType = {\r\n * audio: true, // or StereoAudioRecorder or MediaStreamRecorder\r\n * video: true, // or WhammyRecorder or MediaStreamRecorder or WebAssemblyRecorder or CanvasRecorder\r\n * gif: true // or GifRecorder\r\n * };\r\n * // mimeType is optional and should be set only in advance cases.\r\n * recorder.mimeType = {\r\n * audio: 'audio/wav',\r\n * video: 'video/webm',\r\n * gif: 'image/gif'\r\n * };\r\n * recorder.startRecording();\r\n * @see For further information:\r\n * @see {@link https://github.com/muaz-khan/RecordRTC/tree/master/MRecordRTC|MRecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.\r\n * @requires {@link RecordRTC}\r\n */\r\n\r\nfunction MRecordRTC(mediaStream) {\r\n\r\n /**\r\n * This method attaches MediaStream object to {@link MRecordRTC}.\r\n * @param {MediaStream} mediaStream - A MediaStream object, either fetched using getUserMedia API, or generated using captureStreamUntilEnded or WebAudio API.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.addStream(MediaStream);\r\n */\r\n this.addStream = function(_mediaStream) {\r\n if (_mediaStream) {\r\n mediaStream = _mediaStream;\r\n }\r\n };\r\n\r\n /**\r\n * This property can be used to set the recording type e.g. audio, or video, or gif, or canvas.\r\n * @property {object} mediaType - {audio: true, video: true, gif: true}\r\n * @memberof MRecordRTC\r\n * @example\r\n * var recorder = new MRecordRTC();\r\n * recorder.mediaType = {\r\n * audio: true, // TRUE or StereoAudioRecorder or MediaStreamRecorder\r\n * video: true, // TRUE or WhammyRecorder or MediaStreamRecorder or WebAssemblyRecorder or CanvasRecorder\r\n * gif : true // TRUE or GifRecorder\r\n * };\r\n */\r\n this.mediaType = {\r\n audio: true,\r\n video: true\r\n };\r\n\r\n /**\r\n * This method starts recording.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.startRecording();\r\n */\r\n this.startRecording = function() {\r\n var mediaType = this.mediaType;\r\n var recorderType;\r\n var mimeType = this.mimeType || {\r\n audio: null,\r\n video: null,\r\n gif: null\r\n };\r\n\r\n if (typeof mediaType.audio !== 'function' && isMediaRecorderCompatible() && !getTracks(mediaStream, 'audio').length) {\r\n mediaType.audio = false;\r\n }\r\n\r\n if (typeof mediaType.video !== 'function' && isMediaRecorderCompatible() && !getTracks(mediaStream, 'video').length) {\r\n mediaType.video = false;\r\n }\r\n\r\n if (typeof mediaType.gif !== 'function' && isMediaRecorderCompatible() && !getTracks(mediaStream, 'video').length) {\r\n mediaType.gif = false;\r\n }\r\n\r\n if (!mediaType.audio && !mediaType.video && !mediaType.gif) {\r\n throw 'MediaStream must have either audio or video tracks.';\r\n }\r\n\r\n if (!!mediaType.audio) {\r\n recorderType = null;\r\n if (typeof mediaType.audio === 'function') {\r\n recorderType = mediaType.audio;\r\n }\r\n\r\n this.audioRecorder = new RecordRTC(mediaStream, {\r\n type: 'audio',\r\n bufferSize: this.bufferSize,\r\n sampleRate: this.sampleRate,\r\n numberOfAudioChannels: this.numberOfAudioChannels || 2,\r\n disableLogs: this.disableLogs,\r\n recorderType: recorderType,\r\n mimeType: mimeType.audio,\r\n timeSlice: this.timeSlice,\r\n onTimeStamp: this.onTimeStamp\r\n });\r\n\r\n if (!mediaType.video) {\r\n this.audioRecorder.startRecording();\r\n }\r\n }\r\n\r\n if (!!mediaType.video) {\r\n recorderType = null;\r\n if (typeof mediaType.video === 'function') {\r\n recorderType = mediaType.video;\r\n }\r\n\r\n var newStream = mediaStream;\r\n\r\n if (isMediaRecorderCompatible() && !!mediaType.audio && typeof mediaType.audio === 'function') {\r\n var videoTrack = getTracks(mediaStream, 'video')[0];\r\n\r\n if (isFirefox) {\r\n newStream = new MediaStream();\r\n newStream.addTrack(videoTrack);\r\n\r\n if (recorderType && recorderType === WhammyRecorder) {\r\n // Firefox does NOT supports webp-encoding yet\r\n // But Firefox do supports WebAssemblyRecorder\r\n recorderType = MediaStreamRecorder;\r\n }\r\n } else {\r\n newStream = new MediaStream();\r\n newStream.addTrack(videoTrack);\r\n }\r\n }\r\n\r\n this.videoRecorder = new RecordRTC(newStream, {\r\n type: 'video',\r\n video: this.video,\r\n canvas: this.canvas,\r\n frameInterval: this.frameInterval || 10,\r\n disableLogs: this.disableLogs,\r\n recorderType: recorderType,\r\n mimeType: mimeType.video,\r\n timeSlice: this.timeSlice,\r\n onTimeStamp: this.onTimeStamp,\r\n workerPath: this.workerPath,\r\n webAssemblyPath: this.webAssemblyPath,\r\n frameRate: this.frameRate, // used by WebAssemblyRecorder; values: usually 30; accepts any.\r\n bitrate: this.bitrate // used by WebAssemblyRecorder; values: 0 to 1000+\r\n });\r\n\r\n if (!mediaType.audio) {\r\n this.videoRecorder.startRecording();\r\n }\r\n }\r\n\r\n if (!!mediaType.audio && !!mediaType.video) {\r\n var self = this;\r\n\r\n var isSingleRecorder = isMediaRecorderCompatible() === true;\r\n\r\n if (mediaType.audio instanceof StereoAudioRecorder && !!mediaType.video) {\r\n isSingleRecorder = false;\r\n } else if (mediaType.audio !== true && mediaType.video !== true && mediaType.audio !== mediaType.video) {\r\n isSingleRecorder = false;\r\n }\r\n\r\n if (isSingleRecorder === true) {\r\n self.audioRecorder = null;\r\n self.videoRecorder.startRecording();\r\n } else {\r\n self.videoRecorder.initRecorder(function() {\r\n self.audioRecorder.initRecorder(function() {\r\n // Both recorders are ready to record things accurately\r\n self.videoRecorder.startRecording();\r\n self.audioRecorder.startRecording();\r\n });\r\n });\r\n }\r\n }\r\n\r\n if (!!mediaType.gif) {\r\n recorderType = null;\r\n if (typeof mediaType.gif === 'function') {\r\n recorderType = mediaType.gif;\r\n }\r\n this.gifRecorder = new RecordRTC(mediaStream, {\r\n type: 'gif',\r\n frameRate: this.frameRate || 200,\r\n quality: this.quality || 10,\r\n disableLogs: this.disableLogs,\r\n recorderType: recorderType,\r\n mimeType: mimeType.gif\r\n });\r\n this.gifRecorder.startRecording();\r\n }\r\n };\r\n\r\n /**\r\n * This method stops recording.\r\n * @param {function} callback - Callback function is invoked when all encoders finished their jobs.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.stopRecording(function(recording){\r\n * var audioBlob = recording.audio;\r\n * var videoBlob = recording.video;\r\n * var gifBlob = recording.gif;\r\n * });\r\n */\r\n this.stopRecording = function(callback) {\r\n callback = callback || function() {};\r\n\r\n if (this.audioRecorder) {\r\n this.audioRecorder.stopRecording(function(blobURL) {\r\n callback(blobURL, 'audio');\r\n });\r\n }\r\n\r\n if (this.videoRecorder) {\r\n this.videoRecorder.stopRecording(function(blobURL) {\r\n callback(blobURL, 'video');\r\n });\r\n }\r\n\r\n if (this.gifRecorder) {\r\n this.gifRecorder.stopRecording(function(blobURL) {\r\n callback(blobURL, 'gif');\r\n });\r\n }\r\n };\r\n\r\n /**\r\n * This method pauses recording.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.pauseRecording();\r\n */\r\n this.pauseRecording = function() {\r\n if (this.audioRecorder) {\r\n this.audioRecorder.pauseRecording();\r\n }\r\n\r\n if (this.videoRecorder) {\r\n this.videoRecorder.pauseRecording();\r\n }\r\n\r\n if (this.gifRecorder) {\r\n this.gifRecorder.pauseRecording();\r\n }\r\n };\r\n\r\n /**\r\n * This method resumes recording.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.resumeRecording();\r\n */\r\n this.resumeRecording = function() {\r\n if (this.audioRecorder) {\r\n this.audioRecorder.resumeRecording();\r\n }\r\n\r\n if (this.videoRecorder) {\r\n this.videoRecorder.resumeRecording();\r\n }\r\n\r\n if (this.gifRecorder) {\r\n this.gifRecorder.resumeRecording();\r\n }\r\n };\r\n\r\n /**\r\n * This method can be used to manually get all recorded blobs.\r\n * @param {function} callback - All recorded blobs are passed back to the \"callback\" function.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.getBlob(function(recording){\r\n * var audioBlob = recording.audio;\r\n * var videoBlob = recording.video;\r\n * var gifBlob = recording.gif;\r\n * });\r\n * // or\r\n * var audioBlob = recorder.getBlob().audio;\r\n * var videoBlob = recorder.getBlob().video;\r\n */\r\n this.getBlob = function(callback) {\r\n var output = {};\r\n\r\n if (this.audioRecorder) {\r\n output.audio = this.audioRecorder.getBlob();\r\n }\r\n\r\n if (this.videoRecorder) {\r\n output.video = this.videoRecorder.getBlob();\r\n }\r\n\r\n if (this.gifRecorder) {\r\n output.gif = this.gifRecorder.getBlob();\r\n }\r\n\r\n if (callback) {\r\n callback(output);\r\n }\r\n\r\n return output;\r\n };\r\n\r\n /**\r\n * Destroy all recorder instances.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.destroy();\r\n */\r\n this.destroy = function() {\r\n if (this.audioRecorder) {\r\n this.audioRecorder.destroy();\r\n this.audioRecorder = null;\r\n }\r\n\r\n if (this.videoRecorder) {\r\n this.videoRecorder.destroy();\r\n this.videoRecorder = null;\r\n }\r\n\r\n if (this.gifRecorder) {\r\n this.gifRecorder.destroy();\r\n this.gifRecorder = null;\r\n }\r\n };\r\n\r\n /**\r\n * This method can be used to manually get all recorded blobs' DataURLs.\r\n * @param {function} callback - All recorded blobs' DataURLs are passed back to the \"callback\" function.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.getDataURL(function(recording){\r\n * var audioDataURL = recording.audio;\r\n * var videoDataURL = recording.video;\r\n * var gifDataURL = recording.gif;\r\n * });\r\n */\r\n this.getDataURL = function(callback) {\r\n this.getBlob(function(blob) {\r\n if (blob.audio && blob.video) {\r\n getDataURL(blob.audio, function(_audioDataURL) {\r\n getDataURL(blob.video, function(_videoDataURL) {\r\n callback({\r\n audio: _audioDataURL,\r\n video: _videoDataURL\r\n });\r\n });\r\n });\r\n } else if (blob.audio) {\r\n getDataURL(blob.audio, function(_audioDataURL) {\r\n callback({\r\n audio: _audioDataURL\r\n });\r\n });\r\n } else if (blob.video) {\r\n getDataURL(blob.video, function(_videoDataURL) {\r\n callback({\r\n video: _videoDataURL\r\n });\r\n });\r\n }\r\n });\r\n\r\n function getDataURL(blob, callback00) {\r\n if (typeof Worker !== 'undefined') {\r\n var webWorker = processInWebWorker(function readFile(_blob) {\r\n postMessage(new FileReaderSync().readAsDataURL(_blob));\r\n });\r\n\r\n webWorker.onmessage = function(event) {\r\n callback00(event.data);\r\n };\r\n\r\n webWorker.postMessage(blob);\r\n } else {\r\n var reader = new FileReader();\r\n reader.readAsDataURL(blob);\r\n reader.onload = function(event) {\r\n callback00(event.target.result);\r\n };\r\n }\r\n }\r\n\r\n function processInWebWorker(_function) {\r\n var blob = URL.createObjectURL(new Blob([_function.toString(),\r\n 'this.onmessage = function (eee) {' + _function.name + '(eee.data);}'\r\n ], {\r\n type: 'application/javascript'\r\n }));\r\n\r\n var worker = new Worker(blob);\r\n var url;\r\n if (typeof URL !== 'undefined') {\r\n url = URL;\r\n } else if (typeof webkitURL !== 'undefined') {\r\n url = webkitURL;\r\n } else {\r\n throw 'Neither URL nor webkitURL detected.';\r\n }\r\n url.revokeObjectURL(blob);\r\n return worker;\r\n }\r\n };\r\n\r\n /**\r\n * This method can be used to ask {@link MRecordRTC} to write all recorded blobs into IndexedDB storage.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.writeToDisk();\r\n */\r\n this.writeToDisk = function() {\r\n RecordRTC.writeToDisk({\r\n audio: this.audioRecorder,\r\n video: this.videoRecorder,\r\n gif: this.gifRecorder\r\n });\r\n };\r\n\r\n /**\r\n * This method can be used to invoke a save-as dialog for all recorded blobs.\r\n * @param {object} args - {audio: 'audio-name', video: 'video-name', gif: 'gif-name'}\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.save({\r\n * audio: 'audio-file-name',\r\n * video: 'video-file-name',\r\n * gif : 'gif-file-name'\r\n * });\r\n */\r\n this.save = function(args) {\r\n args = args || {\r\n audio: true,\r\n video: true,\r\n gif: true\r\n };\r\n\r\n if (!!args.audio && this.audioRecorder) {\r\n this.audioRecorder.save(typeof args.audio === 'string' ? args.audio : '');\r\n }\r\n\r\n if (!!args.video && this.videoRecorder) {\r\n this.videoRecorder.save(typeof args.video === 'string' ? args.video : '');\r\n }\r\n if (!!args.gif && this.gifRecorder) {\r\n this.gifRecorder.save(typeof args.gif === 'string' ? args.gif : '');\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * This method can be used to get all recorded blobs from IndexedDB storage.\r\n * @param {string} type - 'all' or 'audio' or 'video' or 'gif'\r\n * @param {function} callback - Callback function to get all stored blobs.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * MRecordRTC.getFromDisk('all', function(dataURL, type){\r\n * if(type === 'audio') { }\r\n * if(type === 'video') { }\r\n * if(type === 'gif') { }\r\n * });\r\n */\r\nMRecordRTC.getFromDisk = RecordRTC.getFromDisk;\r\n\r\n/**\r\n * This method can be used to store recorded blobs into IndexedDB storage.\r\n * @param {object} options - {audio: Blob, video: Blob, gif: Blob}\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * MRecordRTC.writeToDisk({\r\n * audio: audioBlob,\r\n * video: videoBlob,\r\n * gif : gifBlob\r\n * });\r\n */\r\nMRecordRTC.writeToDisk = RecordRTC.writeToDisk;\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.MRecordRTC = MRecordRTC;\r\n}\n\r\nvar browserFakeUserAgent = 'Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45';\r\n\r\n(function(that) {\r\n if (!that) {\r\n return;\r\n }\r\n\r\n if (typeof window !== 'undefined') {\r\n return;\r\n }\r\n\r\n if (typeof global === 'undefined') {\r\n return;\r\n }\r\n\r\n global.navigator = {\r\n userAgent: browserFakeUserAgent,\r\n getUserMedia: function() {}\r\n };\r\n\r\n if (!global.console) {\r\n global.console = {};\r\n }\r\n\r\n if (typeof global.console.log === 'undefined' || typeof global.console.error === 'undefined') {\r\n global.console.error = global.console.log = global.console.log || function() {\r\n console.log(arguments);\r\n };\r\n }\r\n\r\n if (typeof document === 'undefined') {\r\n /*global document:true */\r\n that.document = {\r\n documentElement: {\r\n appendChild: function() {\r\n return '';\r\n }\r\n }\r\n };\r\n\r\n document.createElement = document.captureStream = document.mozCaptureStream = function() {\r\n var obj = {\r\n getContext: function() {\r\n return obj;\r\n },\r\n play: function() {},\r\n pause: function() {},\r\n drawImage: function() {},\r\n toDataURL: function() {\r\n return '';\r\n },\r\n style: {}\r\n };\r\n return obj;\r\n };\r\n\r\n that.HTMLVideoElement = function() {};\r\n }\r\n\r\n if (typeof location === 'undefined') {\r\n /*global location:true */\r\n that.location = {\r\n protocol: 'file:',\r\n href: '',\r\n hash: ''\r\n };\r\n }\r\n\r\n if (typeof screen === 'undefined') {\r\n /*global screen:true */\r\n that.screen = {\r\n width: 0,\r\n height: 0\r\n };\r\n }\r\n\r\n if (typeof URL === 'undefined') {\r\n /*global screen:true */\r\n that.URL = {\r\n createObjectURL: function() {\r\n return '';\r\n },\r\n revokeObjectURL: function() {\r\n return '';\r\n }\r\n };\r\n }\r\n\r\n /*global window:true */\r\n that.window = global;\r\n})(typeof global !== 'undefined' ? global : null);\n\r\n// _____________________________\r\n// Cross-Browser-Declarations.js\r\n\r\n// animation-frame used in WebM recording\r\n\r\n/*jshint -W079 */\r\nvar requestAnimationFrame = window.requestAnimationFrame;\r\nif (typeof requestAnimationFrame === 'undefined') {\r\n if (typeof webkitRequestAnimationFrame !== 'undefined') {\r\n /*global requestAnimationFrame:true */\r\n requestAnimationFrame = webkitRequestAnimationFrame;\r\n } else if (typeof mozRequestAnimationFrame !== 'undefined') {\r\n /*global requestAnimationFrame:true */\r\n requestAnimationFrame = mozRequestAnimationFrame;\r\n } else if (typeof msRequestAnimationFrame !== 'undefined') {\r\n /*global requestAnimationFrame:true */\r\n requestAnimationFrame = msRequestAnimationFrame;\r\n } else if (typeof requestAnimationFrame === 'undefined') {\r\n // via: https://gist.github.com/paulirish/1579671\r\n var lastTime = 0;\r\n\r\n /*global requestAnimationFrame:true */\r\n requestAnimationFrame = function(callback, element) {\r\n var currTime = new Date().getTime();\r\n var timeToCall = Math.max(0, 16 - (currTime - lastTime));\r\n var id = setTimeout(function() {\r\n callback(currTime + timeToCall);\r\n }, timeToCall);\r\n lastTime = currTime + timeToCall;\r\n return id;\r\n };\r\n }\r\n}\r\n\r\n/*jshint -W079 */\r\nvar cancelAnimationFrame = window.cancelAnimationFrame;\r\nif (typeof cancelAnimationFrame === 'undefined') {\r\n if (typeof webkitCancelAnimationFrame !== 'undefined') {\r\n /*global cancelAnimationFrame:true */\r\n cancelAnimationFrame = webkitCancelAnimationFrame;\r\n } else if (typeof mozCancelAnimationFrame !== 'undefined') {\r\n /*global cancelAnimationFrame:true */\r\n cancelAnimationFrame = mozCancelAnimationFrame;\r\n } else if (typeof msCancelAnimationFrame !== 'undefined') {\r\n /*global cancelAnimationFrame:true */\r\n cancelAnimationFrame = msCancelAnimationFrame;\r\n } else if (typeof cancelAnimationFrame === 'undefined') {\r\n /*global cancelAnimationFrame:true */\r\n cancelAnimationFrame = function(id) {\r\n clearTimeout(id);\r\n };\r\n }\r\n}\r\n\r\n// WebAudio API representer\r\nvar AudioContext = window.AudioContext;\r\n\r\nif (typeof AudioContext === 'undefined') {\r\n if (typeof webkitAudioContext !== 'undefined') {\r\n /*global AudioContext:true */\r\n AudioContext = webkitAudioContext;\r\n }\r\n\r\n if (typeof mozAudioContext !== 'undefined') {\r\n /*global AudioContext:true */\r\n AudioContext = mozAudioContext;\r\n }\r\n}\r\n\r\n/*jshint -W079 */\r\nvar URL = window.URL;\r\n\r\nif (typeof URL === 'undefined' && typeof webkitURL !== 'undefined') {\r\n /*global URL:true */\r\n URL = webkitURL;\r\n}\r\n\r\nif (typeof navigator !== 'undefined' && typeof navigator.getUserMedia === 'undefined') { // maybe window.navigator?\r\n if (typeof navigator.webkitGetUserMedia !== 'undefined') {\r\n navigator.getUserMedia = navigator.webkitGetUserMedia;\r\n }\r\n\r\n if (typeof navigator.mozGetUserMedia !== 'undefined') {\r\n navigator.getUserMedia = navigator.mozGetUserMedia;\r\n }\r\n}\r\n\r\nvar isEdge = navigator.userAgent.indexOf('Edge') !== -1 && (!!navigator.msSaveBlob || !!navigator.msSaveOrOpenBlob);\r\nvar isOpera = !!window.opera || navigator.userAgent.indexOf('OPR/') !== -1;\r\nvar isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && ('netscape' in window) && / rv:/.test(navigator.userAgent);\r\nvar isChrome = (!isOpera && !isEdge && !!navigator.webkitGetUserMedia) || isElectron() || navigator.userAgent.toLowerCase().indexOf('chrome/') !== -1;\r\n\r\nvar isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\r\n\r\nif (isSafari && !isChrome && navigator.userAgent.indexOf('CriOS') !== -1) {\r\n isSafari = false;\r\n isChrome = true;\r\n}\r\n\r\nvar MediaStream = window.MediaStream;\r\n\r\nif (typeof MediaStream === 'undefined' && typeof webkitMediaStream !== 'undefined') {\r\n MediaStream = webkitMediaStream;\r\n}\r\n\r\n/*global MediaStream:true */\r\nif (typeof MediaStream !== 'undefined') {\r\n // override \"stop\" method for all browsers\r\n if (typeof MediaStream.prototype.stop === 'undefined') {\r\n MediaStream.prototype.stop = function() {\r\n this.getTracks().forEach(function(track) {\r\n track.stop();\r\n });\r\n };\r\n }\r\n}\r\n\r\n// below function via: http://goo.gl/B3ae8c\r\n/**\r\n * Return human-readable file size.\r\n * @param {number} bytes - Pass bytes and get formatted string.\r\n * @returns {string} - formatted string\r\n * @example\r\n * bytesToSize(1024*1024*5) === '5 GB'\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n */\r\nfunction bytesToSize(bytes) {\r\n var k = 1000;\r\n var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];\r\n if (bytes === 0) {\r\n return '0 Bytes';\r\n }\r\n var i = parseInt(Math.floor(Math.log(bytes) / Math.log(k)), 10);\r\n return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];\r\n}\r\n\r\n/**\r\n * @param {Blob} file - File or Blob object. This parameter is required.\r\n * @param {string} fileName - Optional file name e.g. \"Recorded-Video.webm\"\r\n * @example\r\n * invokeSaveAsDialog(blob or file, [optional] fileName);\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n */\r\nfunction invokeSaveAsDialog(file, fileName) {\r\n if (!file) {\r\n throw 'Blob object is required.';\r\n }\r\n\r\n if (!file.type) {\r\n try {\r\n file.type = 'video/webm';\r\n } catch (e) {}\r\n }\r\n\r\n var fileExtension = (file.type || 'video/webm').split('/')[1];\r\n if (fileExtension.indexOf(';') !== -1) {\r\n // extended mimetype, e.g. 'video/webm;codecs=vp8,opus'\r\n fileExtension = fileExtension.split(';')[0];\r\n }\r\n if (fileName && fileName.indexOf('.') !== -1) {\r\n var splitted = fileName.split('.');\r\n fileName = splitted[0];\r\n fileExtension = splitted[1];\r\n }\r\n\r\n var fileFullName = (fileName || (Math.round(Math.random() * 9999999999) + 888888888)) + '.' + fileExtension;\r\n\r\n if (typeof navigator.msSaveOrOpenBlob !== 'undefined') {\r\n return navigator.msSaveOrOpenBlob(file, fileFullName);\r\n } else if (typeof navigator.msSaveBlob !== 'undefined') {\r\n return navigator.msSaveBlob(file, fileFullName);\r\n }\r\n\r\n var hyperlink = document.createElement('a');\r\n hyperlink.href = URL.createObjectURL(file);\r\n hyperlink.download = fileFullName;\r\n\r\n hyperlink.style = 'display:none;opacity:0;color:transparent;';\r\n (document.body || document.documentElement).appendChild(hyperlink);\r\n\r\n if (typeof hyperlink.click === 'function') {\r\n hyperlink.click();\r\n } else {\r\n hyperlink.target = '_blank';\r\n hyperlink.dispatchEvent(new MouseEvent('click', {\r\n view: window,\r\n bubbles: true,\r\n cancelable: true\r\n }));\r\n }\r\n\r\n URL.revokeObjectURL(hyperlink.href);\r\n}\r\n\r\n/**\r\n * from: https://github.com/cheton/is-electron/blob/master/index.js\r\n **/\r\nfunction isElectron() {\r\n // Renderer process\r\n if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') {\r\n return true;\r\n }\r\n\r\n // Main process\r\n if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electron) {\r\n return true;\r\n }\r\n\r\n // Detect the user agent when the `nodeIntegration` option is set to true\r\n if (typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) {\r\n return true;\r\n }\r\n\r\n return false;\r\n}\r\n\r\nfunction getTracks(stream, kind) {\r\n if (!stream || !stream.getTracks) {\r\n return [];\r\n }\r\n\r\n return stream.getTracks().filter(function(t) {\r\n return t.kind === (kind || 'audio');\r\n });\r\n}\r\n\r\nfunction setSrcObject(stream, element) {\r\n if ('srcObject' in element) {\r\n element.srcObject = stream;\r\n } else if ('mozSrcObject' in element) {\r\n element.mozSrcObject = stream;\r\n } else {\r\n element.srcObject = stream;\r\n }\r\n}\r\n\r\n/**\r\n * @param {Blob} file - File or Blob object.\r\n * @param {function} callback - Callback function.\r\n * @example\r\n * getSeekableBlob(blob or file, callback);\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n */\r\nfunction getSeekableBlob(inputBlob, callback) {\r\n // EBML.js copyrights goes to: https://github.com/legokichi/ts-ebml\r\n if (typeof EBML === 'undefined') {\r\n throw new Error('Please link: https://www.webrtc-experiment.com/EBML.js');\r\n }\r\n\r\n var reader = new EBML.Reader();\r\n var decoder = new EBML.Decoder();\r\n var tools = EBML.tools;\r\n\r\n var fileReader = new FileReader();\r\n fileReader.onload = function(e) {\r\n var ebmlElms = decoder.decode(this.result);\r\n ebmlElms.forEach(function(element) {\r\n reader.read(element);\r\n });\r\n reader.stop();\r\n var refinedMetadataBuf = tools.makeMetadataSeekable(reader.metadatas, reader.duration, reader.cues);\r\n var body = this.result.slice(reader.metadataSize);\r\n var newBlob = new Blob([refinedMetadataBuf, body], {\r\n type: 'video/webm'\r\n });\r\n\r\n callback(newBlob);\r\n };\r\n fileReader.readAsArrayBuffer(inputBlob);\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.invokeSaveAsDialog = invokeSaveAsDialog;\r\n RecordRTC.getTracks = getTracks;\r\n RecordRTC.getSeekableBlob = getSeekableBlob;\r\n RecordRTC.bytesToSize = bytesToSize;\r\n RecordRTC.isElectron = isElectron;\r\n}\r\n\r\n// __________ (used to handle stuff like http://goo.gl/xmE5eg) issue #129\r\n// Storage.js\r\n\r\n/**\r\n * Storage is a standalone object used by {@link RecordRTC} to store reusable objects e.g. \"new AudioContext\".\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @example\r\n * Storage.AudioContext === webkitAudioContext\r\n * @property {webkitAudioContext} AudioContext - Keeps a reference to AudioContext object.\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n */\r\n\r\nvar Storage = {};\r\n\r\nif (typeof AudioContext !== 'undefined') {\r\n Storage.AudioContext = AudioContext;\r\n} else if (typeof webkitAudioContext !== 'undefined') {\r\n Storage.AudioContext = webkitAudioContext;\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.Storage = Storage;\r\n}\n\r\nfunction isMediaRecorderCompatible() {\r\n if (isFirefox || isSafari || isEdge) {\r\n return true;\r\n }\r\n\r\n var nVer = navigator.appVersion;\r\n var nAgt = navigator.userAgent;\r\n var fullVersion = '' + parseFloat(navigator.appVersion);\r\n var majorVersion = parseInt(navigator.appVersion, 10);\r\n var nameOffset, verOffset, ix;\r\n\r\n if (isChrome || isOpera) {\r\n verOffset = nAgt.indexOf('Chrome');\r\n fullVersion = nAgt.substring(verOffset + 7);\r\n }\r\n\r\n // trim the fullVersion string at semicolon/space if present\r\n if ((ix = fullVersion.indexOf(';')) !== -1) {\r\n fullVersion = fullVersion.substring(0, ix);\r\n }\r\n\r\n if ((ix = fullVersion.indexOf(' ')) !== -1) {\r\n fullVersion = fullVersion.substring(0, ix);\r\n }\r\n\r\n majorVersion = parseInt('' + fullVersion, 10);\r\n\r\n if (isNaN(majorVersion)) {\r\n fullVersion = '' + parseFloat(navigator.appVersion);\r\n majorVersion = parseInt(navigator.appVersion, 10);\r\n }\r\n\r\n return majorVersion >= 49;\r\n}\n\r\n// ______________________\r\n// MediaStreamRecorder.js\r\n\r\n/**\r\n * MediaStreamRecorder is an abstraction layer for {@link https://w3c.github.io/mediacapture-record/MediaRecorder.html|MediaRecorder API}. It is used by {@link RecordRTC} to record MediaStream(s) in both Chrome and Firefox.\r\n * @summary Runs top over {@link https://w3c.github.io/mediacapture-record/MediaRecorder.html|MediaRecorder API}.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://github.com/muaz-khan|Muaz Khan}\r\n * @typedef MediaStreamRecorder\r\n * @class\r\n * @example\r\n * var config = {\r\n * mimeType: 'video/webm', // vp8, vp9, h264, mkv, opus/vorbis\r\n * audioBitsPerSecond : 256 * 8 * 1024,\r\n * videoBitsPerSecond : 256 * 8 * 1024,\r\n * bitsPerSecond: 256 * 8 * 1024, // if this is provided, skip above two\r\n * checkForInactiveTracks: true,\r\n * timeSlice: 1000, // concatenate intervals based blobs\r\n * ondataavailable: function() {} // get intervals based blobs\r\n * }\r\n * var recorder = new MediaStreamRecorder(mediaStream, config);\r\n * recorder.record();\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n *\r\n * // or\r\n * var blob = recorder.blob;\r\n * });\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.\r\n * @param {object} config - {disableLogs:true, initCallback: function, mimeType: \"video/webm\", timeSlice: 1000}\r\n * @throws Will throw an error if first argument \"MediaStream\" is missing. Also throws error if \"MediaRecorder API\" are not supported by the browser.\r\n */\r\n\r\nfunction MediaStreamRecorder(mediaStream, config) {\r\n var self = this;\r\n\r\n if (typeof mediaStream === 'undefined') {\r\n throw 'First argument \"MediaStream\" is required.';\r\n }\r\n\r\n if (typeof MediaRecorder === 'undefined') {\r\n throw 'Your browser does not support the Media Recorder API. Please try other modules e.g. WhammyRecorder or StereoAudioRecorder.';\r\n }\r\n\r\n config = config || {\r\n // bitsPerSecond: 256 * 8 * 1024,\r\n mimeType: 'video/webm'\r\n };\r\n\r\n if (config.type === 'audio') {\r\n if (getTracks(mediaStream, 'video').length && getTracks(mediaStream, 'audio').length) {\r\n var stream;\r\n if (!!navigator.mozGetUserMedia) {\r\n stream = new MediaStream();\r\n stream.addTrack(getTracks(mediaStream, 'audio')[0]);\r\n } else {\r\n // webkitMediaStream\r\n stream = new MediaStream(getTracks(mediaStream, 'audio'));\r\n }\r\n mediaStream = stream;\r\n }\r\n\r\n if (!config.mimeType || config.mimeType.toString().toLowerCase().indexOf('audio') === -1) {\r\n config.mimeType = isChrome ? 'audio/webm' : 'audio/ogg';\r\n }\r\n\r\n if (config.mimeType && config.mimeType.toString().toLowerCase() !== 'audio/ogg' && !!navigator.mozGetUserMedia) {\r\n // forcing better codecs on Firefox (via #166)\r\n config.mimeType = 'audio/ogg';\r\n }\r\n }\r\n\r\n var arrayOfBlobs = [];\r\n\r\n /**\r\n * This method returns array of blobs. Use only with \"timeSlice\". Its useful to preview recording anytime, without using the \"stop\" method.\r\n * @method\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * var arrayOfBlobs = recorder.getArrayOfBlobs();\r\n * @returns {Array} Returns array of recorded blobs.\r\n */\r\n this.getArrayOfBlobs = function() {\r\n return arrayOfBlobs;\r\n };\r\n\r\n /**\r\n * This method records MediaStream.\r\n * @method\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * recorder.record();\r\n */\r\n this.record = function() {\r\n // set defaults\r\n self.blob = null;\r\n self.clearRecordedData();\r\n self.timestamps = [];\r\n allStates = [];\r\n arrayOfBlobs = [];\r\n\r\n var recorderHints = config;\r\n\r\n if (!config.disableLogs) {\r\n console.log('Passing following config over MediaRecorder API.', recorderHints);\r\n }\r\n\r\n if (mediaRecorder) {\r\n // mandatory to make sure Firefox doesn't fails to record streams 3-4 times without reloading the page.\r\n mediaRecorder = null;\r\n }\r\n\r\n if (isChrome && !isMediaRecorderCompatible()) {\r\n // to support video-only recording on stable\r\n recorderHints = 'video/vp8';\r\n }\r\n\r\n if (typeof MediaRecorder.isTypeSupported === 'function' && recorderHints.mimeType) {\r\n if (!MediaRecorder.isTypeSupported(recorderHints.mimeType)) {\r\n if (!config.disableLogs) {\r\n console.warn('MediaRecorder API seems unable to record mimeType:', recorderHints.mimeType);\r\n }\r\n\r\n recorderHints.mimeType = config.type === 'audio' ? 'audio/webm' : 'video/webm';\r\n }\r\n }\r\n\r\n // using MediaRecorder API here\r\n try {\r\n mediaRecorder = new MediaRecorder(mediaStream, recorderHints);\r\n\r\n // reset\r\n config.mimeType = recorderHints.mimeType;\r\n } catch (e) {\r\n // chrome-based fallback\r\n mediaRecorder = new MediaRecorder(mediaStream);\r\n }\r\n\r\n // old hack?\r\n if (recorderHints.mimeType && !MediaRecorder.isTypeSupported && 'canRecordMimeType' in mediaRecorder && mediaRecorder.canRecordMimeType(recorderHints.mimeType) === false) {\r\n if (!config.disableLogs) {\r\n console.warn('MediaRecorder API seems unable to record mimeType:', recorderHints.mimeType);\r\n }\r\n }\r\n\r\n // Dispatching OnDataAvailable Handler\r\n mediaRecorder.ondataavailable = function(e) {\r\n if (e.data) {\r\n allStates.push('ondataavailable: ' + bytesToSize(e.data.size));\r\n }\r\n\r\n if (typeof config.timeSlice === 'number') {\r\n if (e.data && e.data.size) {\r\n arrayOfBlobs.push(e.data);\r\n updateTimeStamp();\r\n\r\n if (typeof config.ondataavailable === 'function') {\r\n // intervals based blobs\r\n var blob = config.getNativeBlob ? e.data : new Blob([e.data], {\r\n type: getMimeType(recorderHints)\r\n });\r\n config.ondataavailable(blob);\r\n }\r\n }\r\n return;\r\n }\r\n\r\n if (!e.data || !e.data.size || e.data.size < 100 || self.blob) {\r\n // make sure that stopRecording always getting fired\r\n // even if there is invalid data\r\n if (self.recordingCallback) {\r\n self.recordingCallback(new Blob([], {\r\n type: getMimeType(recorderHints)\r\n }));\r\n self.recordingCallback = null;\r\n }\r\n return;\r\n }\r\n\r\n self.blob = config.getNativeBlob ? e.data : new Blob([e.data], {\r\n type: getMimeType(recorderHints)\r\n });\r\n\r\n if (self.recordingCallback) {\r\n self.recordingCallback(self.blob);\r\n self.recordingCallback = null;\r\n }\r\n };\r\n\r\n mediaRecorder.onstart = function() {\r\n allStates.push('started');\r\n };\r\n\r\n mediaRecorder.onpause = function() {\r\n allStates.push('paused');\r\n };\r\n\r\n mediaRecorder.onresume = function() {\r\n allStates.push('resumed');\r\n };\r\n\r\n mediaRecorder.onstop = function() {\r\n allStates.push('stopped');\r\n };\r\n\r\n mediaRecorder.onerror = function(error) {\r\n if (!error) {\r\n return;\r\n }\r\n\r\n if (!error.name) {\r\n error.name = 'UnknownError';\r\n }\r\n\r\n allStates.push('error: ' + error);\r\n\r\n if (!config.disableLogs) {\r\n // via: https://w3c.github.io/mediacapture-record/MediaRecorder.html#exception-summary\r\n if (error.name.toString().toLowerCase().indexOf('invalidstate') !== -1) {\r\n console.error('The MediaRecorder is not in a state in which the proposed operation is allowed to be executed.', error);\r\n } else if (error.name.toString().toLowerCase().indexOf('notsupported') !== -1) {\r\n console.error('MIME type (', recorderHints.mimeType, ') is not supported.', error);\r\n } else if (error.name.toString().toLowerCase().indexOf('security') !== -1) {\r\n console.error('MediaRecorder security error', error);\r\n }\r\n\r\n // older code below\r\n else if (error.name === 'OutOfMemory') {\r\n console.error('The UA has exhaused the available memory. User agents SHOULD provide as much additional information as possible in the message attribute.', error);\r\n } else if (error.name === 'IllegalStreamModification') {\r\n console.error('A modification to the stream has occurred that makes it impossible to continue recording. An example would be the addition of a Track while recording is occurring. User agents SHOULD provide as much additional information as possible in the message attribute.', error);\r\n } else if (error.name === 'OtherRecordingError') {\r\n console.error('Used for an fatal error other than those listed above. User agents SHOULD provide as much additional information as possible in the message attribute.', error);\r\n } else if (error.name === 'GenericError') {\r\n console.error('The UA cannot provide the codec or recording option that has been requested.', error);\r\n } else {\r\n console.error('MediaRecorder Error', error);\r\n }\r\n }\r\n\r\n (function(looper) {\r\n if (!self.manuallyStopped && mediaRecorder && mediaRecorder.state === 'inactive') {\r\n delete config.timeslice;\r\n\r\n // 10 minutes, enough?\r\n mediaRecorder.start(10 * 60 * 1000);\r\n return;\r\n }\r\n\r\n setTimeout(looper, 1000);\r\n })();\r\n\r\n if (mediaRecorder.state !== 'inactive' && mediaRecorder.state !== 'stopped') {\r\n mediaRecorder.stop();\r\n }\r\n };\r\n\r\n if (typeof config.timeSlice === 'number') {\r\n updateTimeStamp();\r\n mediaRecorder.start(config.timeSlice);\r\n } else {\r\n // default is 60 minutes; enough?\r\n // use config => {timeSlice: 1000} otherwise\r\n\r\n mediaRecorder.start(3.6e+6);\r\n }\r\n\r\n if (config.initCallback) {\r\n config.initCallback(); // old code\r\n }\r\n };\r\n\r\n /**\r\n * @property {Array} timestamps - Array of time stamps\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * console.log(recorder.timestamps);\r\n */\r\n this.timestamps = [];\r\n\r\n function updateTimeStamp() {\r\n self.timestamps.push(new Date().getTime());\r\n\r\n if (typeof config.onTimeStamp === 'function') {\r\n config.onTimeStamp(self.timestamps[self.timestamps.length - 1], self.timestamps);\r\n }\r\n }\r\n\r\n function getMimeType(secondObject) {\r\n if (mediaRecorder && mediaRecorder.mimeType) {\r\n return mediaRecorder.mimeType;\r\n }\r\n\r\n return secondObject.mimeType || 'video/webm';\r\n }\r\n\r\n /**\r\n * This method stops recording MediaStream.\r\n * @param {function} callback - Callback function, that is used to pass recorded blob back to the callee.\r\n * @method\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n */\r\n this.stop = function(callback) {\r\n callback = callback || function() {};\r\n\r\n self.manuallyStopped = true; // used inside the mediaRecorder.onerror\r\n\r\n if (!mediaRecorder) {\r\n return;\r\n }\r\n\r\n this.recordingCallback = callback;\r\n\r\n if (mediaRecorder.state === 'recording') {\r\n mediaRecorder.stop();\r\n }\r\n\r\n if (typeof config.timeSlice === 'number') {\r\n setTimeout(function() {\r\n self.blob = new Blob(arrayOfBlobs, {\r\n type: getMimeType(config)\r\n });\r\n\r\n self.recordingCallback(self.blob);\r\n }, 100);\r\n }\r\n };\r\n\r\n /**\r\n * This method pauses the recording process.\r\n * @method\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * recorder.pause();\r\n */\r\n this.pause = function() {\r\n if (!mediaRecorder) {\r\n return;\r\n }\r\n\r\n if (mediaRecorder.state === 'recording') {\r\n mediaRecorder.pause();\r\n }\r\n };\r\n\r\n /**\r\n * This method resumes the recording process.\r\n * @method\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * recorder.resume();\r\n */\r\n this.resume = function() {\r\n if (!mediaRecorder) {\r\n return;\r\n }\r\n\r\n if (mediaRecorder.state === 'paused') {\r\n mediaRecorder.resume();\r\n }\r\n };\r\n\r\n /**\r\n * This method resets currently recorded data.\r\n * @method\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * recorder.clearRecordedData();\r\n */\r\n this.clearRecordedData = function() {\r\n if (mediaRecorder && mediaRecorder.state === 'recording') {\r\n self.stop(clearRecordedDataCB);\r\n }\r\n\r\n clearRecordedDataCB();\r\n };\r\n\r\n function clearRecordedDataCB() {\r\n arrayOfBlobs = [];\r\n mediaRecorder = null;\r\n self.timestamps = [];\r\n }\r\n\r\n // Reference to \"MediaRecorder\" object\r\n var mediaRecorder;\r\n\r\n /**\r\n * Access to native MediaRecorder API\r\n * @method\r\n * @memberof MediaStreamRecorder\r\n * @instance\r\n * @example\r\n * var internal = recorder.getInternalRecorder();\r\n * internal.ondataavailable = function() {}; // override\r\n * internal.stream, internal.onpause, internal.onstop, etc.\r\n * @returns {Object} Returns internal recording object.\r\n */\r\n this.getInternalRecorder = function() {\r\n return mediaRecorder;\r\n };\r\n\r\n function isMediaStreamActive() {\r\n if ('active' in mediaStream) {\r\n if (!mediaStream.active) {\r\n return false;\r\n }\r\n } else if ('ended' in mediaStream) { // old hack\r\n if (mediaStream.ended) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * @property {Blob} blob - Recorded data as \"Blob\" object.\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * recorder.stop(function() {\r\n * var blob = recorder.blob;\r\n * });\r\n */\r\n this.blob = null;\r\n\r\n\r\n /**\r\n * Get MediaRecorder readonly state.\r\n * @method\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * var state = recorder.getState();\r\n * @returns {String} Returns recording state.\r\n */\r\n this.getState = function() {\r\n if (!mediaRecorder) {\r\n return 'inactive';\r\n }\r\n\r\n return mediaRecorder.state || 'inactive';\r\n };\r\n\r\n // list of all recording states\r\n var allStates = [];\r\n\r\n /**\r\n * Get MediaRecorder all recording states.\r\n * @method\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * var state = recorder.getAllStates();\r\n * @returns {Array} Returns all recording states\r\n */\r\n this.getAllStates = function() {\r\n return allStates;\r\n };\r\n\r\n // if any Track within the MediaStream is muted or not enabled at any time, \r\n // the browser will only record black frames \r\n // or silence since that is the content produced by the Track\r\n // so we need to stopRecording as soon as any single track ends.\r\n if (typeof config.checkForInactiveTracks === 'undefined') {\r\n config.checkForInactiveTracks = false; // disable to minimize CPU usage\r\n }\r\n\r\n var self = this;\r\n\r\n // this method checks if media stream is stopped\r\n // or if any track is ended.\r\n (function looper() {\r\n if (!mediaRecorder || config.checkForInactiveTracks === false) {\r\n return;\r\n }\r\n\r\n if (isMediaStreamActive() === false) {\r\n if (!config.disableLogs) {\r\n console.log('MediaStream seems stopped.');\r\n }\r\n self.stop();\r\n return;\r\n }\r\n\r\n setTimeout(looper, 1000); // check every second\r\n })();\r\n\r\n // for debugging\r\n this.name = 'MediaStreamRecorder';\r\n this.toString = function() {\r\n return this.name;\r\n };\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.MediaStreamRecorder = MediaStreamRecorder;\r\n}\r\n\r\n// source code from: http://typedarray.org/wp-content/projects/WebAudioRecorder/script.js\r\n// https://github.com/mattdiamond/Recorderjs#license-mit\r\n// ______________________\r\n// StereoAudioRecorder.js\r\n\r\n/**\r\n * StereoAudioRecorder is a standalone class used by {@link RecordRTC} to bring \"stereo\" audio-recording in chrome.\r\n * @summary JavaScript standalone object for stereo audio recording.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef StereoAudioRecorder\r\n * @class\r\n * @example\r\n * var recorder = new StereoAudioRecorder(MediaStream, {\r\n * sampleRate: 44100,\r\n * bufferSize: 4096\r\n * });\r\n * recorder.record();\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.\r\n * @param {object} config - {sampleRate: 44100, bufferSize: 4096, numberOfAudioChannels: 1, etc.}\r\n */\r\n\r\nfunction StereoAudioRecorder(mediaStream, config) {\r\n if (!getTracks(mediaStream, 'audio').length) {\r\n throw 'Your stream has no audio tracks.';\r\n }\r\n\r\n config = config || {};\r\n\r\n var self = this;\r\n\r\n // variables\r\n var leftchannel = [];\r\n var rightchannel = [];\r\n var recording = false;\r\n var recordingLength = 0;\r\n var jsAudioNode;\r\n\r\n var numberOfAudioChannels = 2;\r\n\r\n /**\r\n * Set sample rates such as 8K or 16K. Reference: http://stackoverflow.com/a/28977136/552182\r\n * @property {number} desiredSampRate - Desired Bits per sample * 1000\r\n * @memberof StereoAudioRecorder\r\n * @instance\r\n * @example\r\n * var recorder = StereoAudioRecorder(mediaStream, {\r\n * desiredSampRate: 16 * 1000 // bits-per-sample * 1000\r\n * });\r\n */\r\n var desiredSampRate = config.desiredSampRate;\r\n\r\n // backward compatibility\r\n if (config.leftChannel === true) {\r\n numberOfAudioChannels = 1;\r\n }\r\n\r\n if (config.numberOfAudioChannels === 1) {\r\n numberOfAudioChannels = 1;\r\n }\r\n\r\n if (!numberOfAudioChannels || numberOfAudioChannels < 1) {\r\n numberOfAudioChannels = 2;\r\n }\r\n\r\n if (!config.disableLogs) {\r\n console.log('StereoAudioRecorder is set to record number of channels: ' + numberOfAudioChannels);\r\n }\r\n\r\n // if any Track within the MediaStream is muted or not enabled at any time, \r\n // the browser will only record black frames \r\n // or silence since that is the content produced by the Track\r\n // so we need to stopRecording as soon as any single track ends.\r\n if (typeof config.checkForInactiveTracks === 'undefined') {\r\n config.checkForInactiveTracks = true;\r\n }\r\n\r\n function isMediaStreamActive() {\r\n if (config.checkForInactiveTracks === false) {\r\n // always return \"true\"\r\n return true;\r\n }\r\n\r\n if ('active' in mediaStream) {\r\n if (!mediaStream.active) {\r\n return false;\r\n }\r\n } else if ('ended' in mediaStream) { // old hack\r\n if (mediaStream.ended) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * This method records MediaStream.\r\n * @method\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder.record();\r\n */\r\n this.record = function() {\r\n if (isMediaStreamActive() === false) {\r\n throw 'Please make sure MediaStream is active.';\r\n }\r\n\r\n resetVariables();\r\n\r\n isAudioProcessStarted = isPaused = false;\r\n recording = true;\r\n\r\n if (typeof config.timeSlice !== 'undefined') {\r\n looper();\r\n }\r\n };\r\n\r\n function mergeLeftRightBuffers(config, callback) {\r\n function mergeAudioBuffers(config, cb) {\r\n var numberOfAudioChannels = config.numberOfAudioChannels;\r\n\r\n // todo: \"slice(0)\" --- is it causes loop? Should be removed?\r\n var leftBuffers = config.leftBuffers.slice(0);\r\n var rightBuffers = config.rightBuffers.slice(0);\r\n var sampleRate = config.sampleRate;\r\n var internalInterleavedLength = config.internalInterleavedLength;\r\n var desiredSampRate = config.desiredSampRate;\r\n\r\n if (numberOfAudioChannels === 2) {\r\n leftBuffers = mergeBuffers(leftBuffers, internalInterleavedLength);\r\n rightBuffers = mergeBuffers(rightBuffers, internalInterleavedLength);\r\n\r\n if (desiredSampRate) {\r\n leftBuffers = interpolateArray(leftBuffers, desiredSampRate, sampleRate);\r\n rightBuffers = interpolateArray(rightBuffers, desiredSampRate, sampleRate);\r\n }\r\n }\r\n\r\n if (numberOfAudioChannels === 1) {\r\n leftBuffers = mergeBuffers(leftBuffers, internalInterleavedLength);\r\n\r\n if (desiredSampRate) {\r\n leftBuffers = interpolateArray(leftBuffers, desiredSampRate, sampleRate);\r\n }\r\n }\r\n\r\n // set sample rate as desired sample rate\r\n if (desiredSampRate) {\r\n sampleRate = desiredSampRate;\r\n }\r\n\r\n // for changing the sampling rate, reference:\r\n // http://stackoverflow.com/a/28977136/552182\r\n function interpolateArray(data, newSampleRate, oldSampleRate) {\r\n var fitCount = Math.round(data.length * (newSampleRate / oldSampleRate));\r\n var newData = [];\r\n var springFactor = Number((data.length - 1) / (fitCount - 1));\r\n newData[0] = data[0];\r\n for (var i = 1; i < fitCount - 1; i++) {\r\n var tmp = i * springFactor;\r\n var before = Number(Math.floor(tmp)).toFixed();\r\n var after = Number(Math.ceil(tmp)).toFixed();\r\n var atPoint = tmp - before;\r\n newData[i] = linearInterpolate(data[before], data[after], atPoint);\r\n }\r\n newData[fitCount - 1] = data[data.length - 1];\r\n return newData;\r\n }\r\n\r\n function linearInterpolate(before, after, atPoint) {\r\n return before + (after - before) * atPoint;\r\n }\r\n\r\n function mergeBuffers(channelBuffer, rLength) {\r\n var result = new Float64Array(rLength);\r\n var offset = 0;\r\n var lng = channelBuffer.length;\r\n\r\n for (var i = 0; i < lng; i++) {\r\n var buffer = channelBuffer[i];\r\n result.set(buffer, offset);\r\n offset += buffer.length;\r\n }\r\n\r\n return result;\r\n }\r\n\r\n function interleave(leftChannel, rightChannel) {\r\n var length = leftChannel.length + rightChannel.length;\r\n\r\n var result = new Float64Array(length);\r\n\r\n var inputIndex = 0;\r\n\r\n for (var index = 0; index < length;) {\r\n result[index++] = leftChannel[inputIndex];\r\n result[index++] = rightChannel[inputIndex];\r\n inputIndex++;\r\n }\r\n return result;\r\n }\r\n\r\n function writeUTFBytes(view, offset, string) {\r\n var lng = string.length;\r\n for (var i = 0; i < lng; i++) {\r\n view.setUint8(offset + i, string.charCodeAt(i));\r\n }\r\n }\r\n\r\n // interleave both channels together\r\n var interleaved;\r\n\r\n if (numberOfAudioChannels === 2) {\r\n interleaved = interleave(leftBuffers, rightBuffers);\r\n }\r\n\r\n if (numberOfAudioChannels === 1) {\r\n interleaved = leftBuffers;\r\n }\r\n\r\n var interleavedLength = interleaved.length;\r\n\r\n // create wav file\r\n var resultingBufferLength = 44 + interleavedLength * 2;\r\n\r\n var buffer = new ArrayBuffer(resultingBufferLength);\r\n\r\n var view = new DataView(buffer);\r\n\r\n // RIFF chunk descriptor/identifier \r\n writeUTFBytes(view, 0, 'RIFF');\r\n\r\n // RIFF chunk length\r\n // changed \"44\" to \"36\" via #401\r\n view.setUint32(4, 36 + interleavedLength * 2, true);\r\n\r\n // RIFF type \r\n writeUTFBytes(view, 8, 'WAVE');\r\n\r\n // format chunk identifier \r\n // FMT sub-chunk\r\n writeUTFBytes(view, 12, 'fmt ');\r\n\r\n // format chunk length \r\n view.setUint32(16, 16, true);\r\n\r\n // sample format (raw)\r\n view.setUint16(20, 1, true);\r\n\r\n // stereo (2 channels)\r\n view.setUint16(22, numberOfAudioChannels, true);\r\n\r\n // sample rate \r\n view.setUint32(24, sampleRate, true);\r\n\r\n // byte rate (sample rate * block align)\r\n view.setUint32(28, sampleRate * numberOfAudioChannels * 2, true);\r\n\r\n // block align (channel count * bytes per sample) \r\n view.setUint16(32, numberOfAudioChannels * 2, true);\r\n\r\n // bits per sample \r\n view.setUint16(34, 16, true);\r\n\r\n // data sub-chunk\r\n // data chunk identifier \r\n writeUTFBytes(view, 36, 'data');\r\n\r\n // data chunk length \r\n view.setUint32(40, interleavedLength * 2, true);\r\n\r\n // write the PCM samples\r\n var lng = interleavedLength;\r\n var index = 44;\r\n var volume = 1;\r\n for (var i = 0; i < lng; i++) {\r\n view.setInt16(index, interleaved[i] * (0x7FFF * volume), true);\r\n index += 2;\r\n }\r\n\r\n if (cb) {\r\n return cb({\r\n buffer: buffer,\r\n view: view\r\n });\r\n }\r\n\r\n postMessage({\r\n buffer: buffer,\r\n view: view\r\n });\r\n }\r\n\r\n if (config.noWorker) {\r\n mergeAudioBuffers(config, function(data) {\r\n callback(data.buffer, data.view);\r\n });\r\n return;\r\n }\r\n\r\n\r\n var webWorker = processInWebWorker(mergeAudioBuffers);\r\n\r\n webWorker.onmessage = function(event) {\r\n callback(event.data.buffer, event.data.view);\r\n\r\n // release memory\r\n URL.revokeObjectURL(webWorker.workerURL);\r\n\r\n // kill webworker (or Chrome will kill your page after ~25 calls)\r\n webWorker.terminate();\r\n };\r\n\r\n webWorker.postMessage(config);\r\n }\r\n\r\n function processInWebWorker(_function) {\r\n var workerURL = URL.createObjectURL(new Blob([_function.toString(),\r\n ';this.onmessage = function (eee) {' + _function.name + '(eee.data);}'\r\n ], {\r\n type: 'application/javascript'\r\n }));\r\n\r\n var worker = new Worker(workerURL);\r\n worker.workerURL = workerURL;\r\n return worker;\r\n }\r\n\r\n /**\r\n * This method stops recording MediaStream.\r\n * @param {function} callback - Callback function, that is used to pass recorded blob back to the callee.\r\n * @method\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n */\r\n this.stop = function(callback) {\r\n callback = callback || function() {};\r\n\r\n // stop recording\r\n recording = false;\r\n\r\n mergeLeftRightBuffers({\r\n desiredSampRate: desiredSampRate,\r\n sampleRate: sampleRate,\r\n numberOfAudioChannels: numberOfAudioChannels,\r\n internalInterleavedLength: recordingLength,\r\n leftBuffers: leftchannel,\r\n rightBuffers: numberOfAudioChannels === 1 ? [] : rightchannel,\r\n noWorker: config.noWorker\r\n }, function(buffer, view) {\r\n /**\r\n * @property {Blob} blob - The recorded blob object.\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder.stop(function(){\r\n * var blob = recorder.blob;\r\n * });\r\n */\r\n self.blob = new Blob([view], {\r\n type: 'audio/wav'\r\n });\r\n\r\n /**\r\n * @property {ArrayBuffer} buffer - The recorded buffer object.\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder.stop(function(){\r\n * var buffer = recorder.buffer;\r\n * });\r\n */\r\n self.buffer = new ArrayBuffer(view.buffer.byteLength);\r\n\r\n /**\r\n * @property {DataView} view - The recorded data-view object.\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder.stop(function(){\r\n * var view = recorder.view;\r\n * });\r\n */\r\n self.view = view;\r\n\r\n self.sampleRate = desiredSampRate || sampleRate;\r\n self.bufferSize = bufferSize;\r\n\r\n // recorded audio length\r\n self.length = recordingLength;\r\n\r\n isAudioProcessStarted = false;\r\n\r\n if (callback) {\r\n callback(self.blob);\r\n }\r\n });\r\n };\r\n\r\n if (typeof RecordRTC.Storage === 'undefined') {\r\n RecordRTC.Storage = {\r\n AudioContextConstructor: null,\r\n AudioContext: window.AudioContext || window.webkitAudioContext\r\n };\r\n }\r\n\r\n if (!RecordRTC.Storage.AudioContextConstructor || RecordRTC.Storage.AudioContextConstructor.state === 'closed') {\r\n RecordRTC.Storage.AudioContextConstructor = new RecordRTC.Storage.AudioContext();\r\n }\r\n\r\n var context = RecordRTC.Storage.AudioContextConstructor;\r\n\r\n // creates an audio node from the microphone incoming stream\r\n var audioInput = context.createMediaStreamSource(mediaStream);\r\n\r\n var legalBufferValues = [0, 256, 512, 1024, 2048, 4096, 8192, 16384];\r\n\r\n /**\r\n * From the spec: This value controls how frequently the audioprocess event is\r\n * dispatched and how many sample-frames need to be processed each call.\r\n * Lower values for buffer size will result in a lower (better) latency.\r\n * Higher values will be necessary to avoid audio breakup and glitches\r\n * The size of the buffer (in sample-frames) which needs to\r\n * be processed each time onprocessaudio is called.\r\n * Legal values are (256, 512, 1024, 2048, 4096, 8192, 16384).\r\n * @property {number} bufferSize - Buffer-size for how frequently the audioprocess event is dispatched.\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder = new StereoAudioRecorder(mediaStream, {\r\n * bufferSize: 4096\r\n * });\r\n */\r\n\r\n // \"0\" means, let chrome decide the most accurate buffer-size for current platform.\r\n var bufferSize = typeof config.bufferSize === 'undefined' ? 4096 : config.bufferSize;\r\n\r\n if (legalBufferValues.indexOf(bufferSize) === -1) {\r\n if (!config.disableLogs) {\r\n console.log('Legal values for buffer-size are ' + JSON.stringify(legalBufferValues, null, '\\t'));\r\n }\r\n }\r\n\r\n if (context.createJavaScriptNode) {\r\n jsAudioNode = context.createJavaScriptNode(bufferSize, numberOfAudioChannels, numberOfAudioChannels);\r\n } else if (context.createScriptProcessor) {\r\n jsAudioNode = context.createScriptProcessor(bufferSize, numberOfAudioChannels, numberOfAudioChannels);\r\n } else {\r\n throw 'WebAudio API has no support on this browser.';\r\n }\r\n\r\n // connect the stream to the script processor\r\n audioInput.connect(jsAudioNode);\r\n\r\n if (!config.bufferSize) {\r\n bufferSize = jsAudioNode.bufferSize; // device buffer-size\r\n }\r\n\r\n /**\r\n * The sample rate (in sample-frames per second) at which the\r\n * AudioContext handles audio. It is assumed that all AudioNodes\r\n * in the context run at this rate. In making this assumption,\r\n * sample-rate converters or \"varispeed\" processors are not supported\r\n * in real-time processing.\r\n * The sampleRate parameter describes the sample-rate of the\r\n * linear PCM audio data in the buffer in sample-frames per second.\r\n * An implementation must support sample-rates in at least\r\n * the range 22050 to 96000.\r\n * @property {number} sampleRate - Buffer-size for how frequently the audioprocess event is dispatched.\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder = new StereoAudioRecorder(mediaStream, {\r\n * sampleRate: 44100\r\n * });\r\n */\r\n var sampleRate = typeof config.sampleRate !== 'undefined' ? config.sampleRate : context.sampleRate || 44100;\r\n\r\n if (sampleRate < 22050 || sampleRate > 96000) {\r\n // Ref: http://stackoverflow.com/a/26303918/552182\r\n if (!config.disableLogs) {\r\n console.log('sample-rate must be under range 22050 and 96000.');\r\n }\r\n }\r\n\r\n if (!config.disableLogs) {\r\n if (config.desiredSampRate) {\r\n console.log('Desired sample-rate: ' + config.desiredSampRate);\r\n }\r\n }\r\n\r\n var isPaused = false;\r\n /**\r\n * This method pauses the recording process.\r\n * @method\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder.pause();\r\n */\r\n this.pause = function() {\r\n isPaused = true;\r\n };\r\n\r\n /**\r\n * This method resumes the recording process.\r\n * @method\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder.resume();\r\n */\r\n this.resume = function() {\r\n if (isMediaStreamActive() === false) {\r\n throw 'Please make sure MediaStream is active.';\r\n }\r\n\r\n if (!recording) {\r\n if (!config.disableLogs) {\r\n console.log('Seems recording has been restarted.');\r\n }\r\n this.record();\r\n return;\r\n }\r\n\r\n isPaused = false;\r\n };\r\n\r\n /**\r\n * This method resets currently recorded data.\r\n * @method\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder.clearRecordedData();\r\n */\r\n this.clearRecordedData = function() {\r\n config.checkForInactiveTracks = false;\r\n\r\n if (recording) {\r\n this.stop(clearRecordedDataCB);\r\n }\r\n\r\n clearRecordedDataCB();\r\n };\r\n\r\n function resetVariables() {\r\n leftchannel = [];\r\n rightchannel = [];\r\n recordingLength = 0;\r\n isAudioProcessStarted = false;\r\n recording = false;\r\n isPaused = false;\r\n context = null;\r\n\r\n self.leftchannel = leftchannel;\r\n self.rightchannel = rightchannel;\r\n self.numberOfAudioChannels = numberOfAudioChannels;\r\n self.desiredSampRate = desiredSampRate;\r\n self.sampleRate = sampleRate;\r\n self.recordingLength = recordingLength;\r\n\r\n intervalsBasedBuffers = {\r\n left: [],\r\n right: [],\r\n recordingLength: 0\r\n };\r\n }\r\n\r\n function clearRecordedDataCB() {\r\n if (jsAudioNode) {\r\n jsAudioNode.onaudioprocess = null;\r\n jsAudioNode.disconnect();\r\n jsAudioNode = null;\r\n }\r\n\r\n if (audioInput) {\r\n audioInput.disconnect();\r\n audioInput = null;\r\n }\r\n\r\n resetVariables();\r\n }\r\n\r\n // for debugging\r\n this.name = 'StereoAudioRecorder';\r\n this.toString = function() {\r\n return this.name;\r\n };\r\n\r\n var isAudioProcessStarted = false;\r\n\r\n function onAudioProcessDataAvailable(e) {\r\n if (isPaused) {\r\n return;\r\n }\r\n\r\n if (isMediaStreamActive() === false) {\r\n if (!config.disableLogs) {\r\n console.log('MediaStream seems stopped.');\r\n }\r\n jsAudioNode.disconnect();\r\n recording = false;\r\n }\r\n\r\n if (!recording) {\r\n if (audioInput) {\r\n audioInput.disconnect();\r\n audioInput = null;\r\n }\r\n return;\r\n }\r\n\r\n /**\r\n * This method is called on \"onaudioprocess\" event's first invocation.\r\n * @method {function} onAudioProcessStarted\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder.onAudioProcessStarted: function() { };\r\n */\r\n if (!isAudioProcessStarted) {\r\n isAudioProcessStarted = true;\r\n if (config.onAudioProcessStarted) {\r\n config.onAudioProcessStarted();\r\n }\r\n\r\n if (config.initCallback) {\r\n config.initCallback();\r\n }\r\n }\r\n\r\n var left = e.inputBuffer.getChannelData(0);\r\n\r\n // we clone the samples\r\n var chLeft = new Float32Array(left);\r\n leftchannel.push(chLeft);\r\n\r\n if (numberOfAudioChannels === 2) {\r\n var right = e.inputBuffer.getChannelData(1);\r\n var chRight = new Float32Array(right);\r\n rightchannel.push(chRight);\r\n }\r\n\r\n recordingLength += bufferSize;\r\n\r\n // export raw PCM\r\n self.recordingLength = recordingLength;\r\n\r\n if (typeof config.timeSlice !== 'undefined') {\r\n intervalsBasedBuffers.recordingLength += bufferSize;\r\n intervalsBasedBuffers.left.push(chLeft);\r\n\r\n if (numberOfAudioChannels === 2) {\r\n intervalsBasedBuffers.right.push(chRight);\r\n }\r\n }\r\n }\r\n\r\n jsAudioNode.onaudioprocess = onAudioProcessDataAvailable;\r\n\r\n // to prevent self audio to be connected with speakers\r\n if (context.createMediaStreamDestination) {\r\n jsAudioNode.connect(context.createMediaStreamDestination());\r\n } else {\r\n jsAudioNode.connect(context.destination);\r\n }\r\n\r\n // export raw PCM\r\n this.leftchannel = leftchannel;\r\n this.rightchannel = rightchannel;\r\n this.numberOfAudioChannels = numberOfAudioChannels;\r\n this.desiredSampRate = desiredSampRate;\r\n this.sampleRate = sampleRate;\r\n self.recordingLength = recordingLength;\r\n\r\n // helper for intervals based blobs\r\n var intervalsBasedBuffers = {\r\n left: [],\r\n right: [],\r\n recordingLength: 0\r\n };\r\n\r\n // this looper is used to support intervals based blobs (via timeSlice+ondataavailable)\r\n function looper() {\r\n if (!recording || typeof config.ondataavailable !== 'function' || typeof config.timeSlice === 'undefined') {\r\n return;\r\n }\r\n\r\n if (intervalsBasedBuffers.left.length) {\r\n mergeLeftRightBuffers({\r\n desiredSampRate: desiredSampRate,\r\n sampleRate: sampleRate,\r\n numberOfAudioChannels: numberOfAudioChannels,\r\n internalInterleavedLength: intervalsBasedBuffers.recordingLength,\r\n leftBuffers: intervalsBasedBuffers.left,\r\n rightBuffers: numberOfAudioChannels === 1 ? [] : intervalsBasedBuffers.right\r\n }, function(buffer, view) {\r\n var blob = new Blob([view], {\r\n type: 'audio/wav'\r\n });\r\n config.ondataavailable(blob);\r\n\r\n setTimeout(looper, config.timeSlice);\r\n });\r\n\r\n intervalsBasedBuffers = {\r\n left: [],\r\n right: [],\r\n recordingLength: 0\r\n };\r\n } else {\r\n setTimeout(looper, config.timeSlice);\r\n }\r\n }\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.StereoAudioRecorder = StereoAudioRecorder;\r\n}\r\n\r\n// _________________\r\n// CanvasRecorder.js\r\n\r\n/**\r\n * CanvasRecorder is a standalone class used by {@link RecordRTC} to bring HTML5-Canvas recording into video WebM. It uses HTML2Canvas library and runs top over {@link Whammy}.\r\n * @summary HTML2Canvas recording into video WebM.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef CanvasRecorder\r\n * @class\r\n * @example\r\n * var recorder = new CanvasRecorder(htmlElement, { disableLogs: true, useWhammyRecorder: true });\r\n * recorder.record();\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {HTMLElement} htmlElement - querySelector/getElementById/getElementsByTagName[0]/etc.\r\n * @param {object} config - {disableLogs:true, initCallback: function}\r\n */\r\n\r\nfunction CanvasRecorder(htmlElement, config) {\r\n if (typeof html2canvas === 'undefined') {\r\n throw 'Please link: https://www.webrtc-experiment.com/screenshot.js';\r\n }\r\n\r\n config = config || {};\r\n if (!config.frameInterval) {\r\n config.frameInterval = 10;\r\n }\r\n\r\n // via DetectRTC.js\r\n var isCanvasSupportsStreamCapturing = false;\r\n ['captureStream', 'mozCaptureStream', 'webkitCaptureStream'].forEach(function(item) {\r\n if (item in document.createElement('canvas')) {\r\n isCanvasSupportsStreamCapturing = true;\r\n }\r\n });\r\n\r\n var _isChrome = (!!window.webkitRTCPeerConnection || !!window.webkitGetUserMedia) && !!window.chrome;\r\n\r\n var chromeVersion = 50;\r\n var matchArray = navigator.userAgent.match(/Chrom(e|ium)\\/([0-9]+)\\./);\r\n if (_isChrome && matchArray && matchArray[2]) {\r\n chromeVersion = parseInt(matchArray[2], 10);\r\n }\r\n\r\n if (_isChrome && chromeVersion < 52) {\r\n isCanvasSupportsStreamCapturing = false;\r\n }\r\n\r\n if (config.useWhammyRecorder) {\r\n isCanvasSupportsStreamCapturing = false;\r\n }\r\n\r\n var globalCanvas, mediaStreamRecorder;\r\n\r\n if (isCanvasSupportsStreamCapturing) {\r\n if (!config.disableLogs) {\r\n console.log('Your browser supports both MediRecorder API and canvas.captureStream!');\r\n }\r\n\r\n if (htmlElement instanceof HTMLCanvasElement) {\r\n globalCanvas = htmlElement;\r\n } else if (htmlElement instanceof CanvasRenderingContext2D) {\r\n globalCanvas = htmlElement.canvas;\r\n } else {\r\n throw 'Please pass either HTMLCanvasElement or CanvasRenderingContext2D.';\r\n }\r\n } else if (!!navigator.mozGetUserMedia) {\r\n if (!config.disableLogs) {\r\n console.error('Canvas recording is NOT supported in Firefox.');\r\n }\r\n }\r\n\r\n var isRecording;\r\n\r\n /**\r\n * This method records Canvas.\r\n * @method\r\n * @memberof CanvasRecorder\r\n * @example\r\n * recorder.record();\r\n */\r\n this.record = function() {\r\n isRecording = true;\r\n\r\n if (isCanvasSupportsStreamCapturing && !config.useWhammyRecorder) {\r\n // CanvasCaptureMediaStream\r\n var canvasMediaStream;\r\n if ('captureStream' in globalCanvas) {\r\n canvasMediaStream = globalCanvas.captureStream(25); // 25 FPS\r\n } else if ('mozCaptureStream' in globalCanvas) {\r\n canvasMediaStream = globalCanvas.mozCaptureStream(25);\r\n } else if ('webkitCaptureStream' in globalCanvas) {\r\n canvasMediaStream = globalCanvas.webkitCaptureStream(25);\r\n }\r\n\r\n try {\r\n var mdStream = new MediaStream();\r\n mdStream.addTrack(getTracks(canvasMediaStream, 'video')[0]);\r\n canvasMediaStream = mdStream;\r\n } catch (e) {}\r\n\r\n if (!canvasMediaStream) {\r\n throw 'captureStream API are NOT available.';\r\n }\r\n\r\n // Note: Jan 18, 2016 status is that, \r\n // Firefox MediaRecorder API can't record CanvasCaptureMediaStream object.\r\n mediaStreamRecorder = new MediaStreamRecorder(canvasMediaStream, {\r\n mimeType: config.mimeType || 'video/webm'\r\n });\r\n mediaStreamRecorder.record();\r\n } else {\r\n whammy.frames = [];\r\n lastTime = new Date().getTime();\r\n drawCanvasFrame();\r\n }\r\n\r\n if (config.initCallback) {\r\n config.initCallback();\r\n }\r\n };\r\n\r\n this.getWebPImages = function(callback) {\r\n if (htmlElement.nodeName.toLowerCase() !== 'canvas') {\r\n callback();\r\n return;\r\n }\r\n\r\n var framesLength = whammy.frames.length;\r\n whammy.frames.forEach(function(frame, idx) {\r\n var framesRemaining = framesLength - idx;\r\n if (!config.disableLogs) {\r\n console.log(framesRemaining + '/' + framesLength + ' frames remaining');\r\n }\r\n\r\n if (config.onEncodingCallback) {\r\n config.onEncodingCallback(framesRemaining, framesLength);\r\n }\r\n\r\n var webp = frame.image.toDataURL('image/webp', 1);\r\n whammy.frames[idx].image = webp;\r\n });\r\n\r\n if (!config.disableLogs) {\r\n console.log('Generating WebM');\r\n }\r\n\r\n callback();\r\n };\r\n\r\n /**\r\n * This method stops recording Canvas.\r\n * @param {function} callback - Callback function, that is used to pass recorded blob back to the callee.\r\n * @method\r\n * @memberof CanvasRecorder\r\n * @example\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n */\r\n this.stop = function(callback) {\r\n isRecording = false;\r\n\r\n var that = this;\r\n\r\n if (isCanvasSupportsStreamCapturing && mediaStreamRecorder) {\r\n mediaStreamRecorder.stop(callback);\r\n return;\r\n }\r\n\r\n this.getWebPImages(function() {\r\n /**\r\n * @property {Blob} blob - Recorded frames in video/webm blob.\r\n * @memberof CanvasRecorder\r\n * @example\r\n * recorder.stop(function() {\r\n * var blob = recorder.blob;\r\n * });\r\n */\r\n whammy.compile(function(blob) {\r\n if (!config.disableLogs) {\r\n console.log('Recording finished!');\r\n }\r\n\r\n that.blob = blob;\r\n\r\n if (that.blob.forEach) {\r\n that.blob = new Blob([], {\r\n type: 'video/webm'\r\n });\r\n }\r\n\r\n if (callback) {\r\n callback(that.blob);\r\n }\r\n\r\n whammy.frames = [];\r\n });\r\n });\r\n };\r\n\r\n var isPausedRecording = false;\r\n\r\n /**\r\n * This method pauses the recording process.\r\n * @method\r\n * @memberof CanvasRecorder\r\n * @example\r\n * recorder.pause();\r\n */\r\n this.pause = function() {\r\n isPausedRecording = true;\r\n\r\n if (mediaStreamRecorder instanceof MediaStreamRecorder) {\r\n mediaStreamRecorder.pause();\r\n return;\r\n }\r\n };\r\n\r\n /**\r\n * This method resumes the recording process.\r\n * @method\r\n * @memberof CanvasRecorder\r\n * @example\r\n * recorder.resume();\r\n */\r\n this.resume = function() {\r\n isPausedRecording = false;\r\n\r\n if (mediaStreamRecorder instanceof MediaStreamRecorder) {\r\n mediaStreamRecorder.resume();\r\n return;\r\n }\r\n\r\n if (!isRecording) {\r\n this.record();\r\n }\r\n };\r\n\r\n /**\r\n * This method resets currently recorded data.\r\n * @method\r\n * @memberof CanvasRecorder\r\n * @example\r\n * recorder.clearRecordedData();\r\n */\r\n this.clearRecordedData = function() {\r\n if (isRecording) {\r\n this.stop(clearRecordedDataCB);\r\n }\r\n clearRecordedDataCB();\r\n };\r\n\r\n function clearRecordedDataCB() {\r\n whammy.frames = [];\r\n isRecording = false;\r\n isPausedRecording = false;\r\n }\r\n\r\n // for debugging\r\n this.name = 'CanvasRecorder';\r\n this.toString = function() {\r\n return this.name;\r\n };\r\n\r\n function cloneCanvas() {\r\n //create a new canvas\r\n var newCanvas = document.createElement('canvas');\r\n var context = newCanvas.getContext('2d');\r\n\r\n //set dimensions\r\n newCanvas.width = htmlElement.width;\r\n newCanvas.height = htmlElement.height;\r\n\r\n //apply the old canvas to the new one\r\n context.drawImage(htmlElement, 0, 0);\r\n\r\n //return the new canvas\r\n return newCanvas;\r\n }\r\n\r\n function drawCanvasFrame() {\r\n if (isPausedRecording) {\r\n lastTime = new Date().getTime();\r\n return setTimeout(drawCanvasFrame, 500);\r\n }\r\n\r\n if (htmlElement.nodeName.toLowerCase() === 'canvas') {\r\n var duration = new Date().getTime() - lastTime;\r\n // via #206, by Jack i.e. @Seymourr\r\n lastTime = new Date().getTime();\r\n\r\n whammy.frames.push({\r\n image: cloneCanvas(),\r\n duration: duration\r\n });\r\n\r\n if (isRecording) {\r\n setTimeout(drawCanvasFrame, config.frameInterval);\r\n }\r\n return;\r\n }\r\n\r\n html2canvas(htmlElement, {\r\n grabMouse: typeof config.showMousePointer === 'undefined' || config.showMousePointer,\r\n onrendered: function(canvas) {\r\n var duration = new Date().getTime() - lastTime;\r\n if (!duration) {\r\n return setTimeout(drawCanvasFrame, config.frameInterval);\r\n }\r\n\r\n // via #206, by Jack i.e. @Seymourr\r\n lastTime = new Date().getTime();\r\n\r\n whammy.frames.push({\r\n image: canvas.toDataURL('image/webp', 1),\r\n duration: duration\r\n });\r\n\r\n if (isRecording) {\r\n setTimeout(drawCanvasFrame, config.frameInterval);\r\n }\r\n }\r\n });\r\n }\r\n\r\n var lastTime = new Date().getTime();\r\n\r\n var whammy = new Whammy.Video(100);\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.CanvasRecorder = CanvasRecorder;\r\n}\n\r\n// _________________\r\n// WhammyRecorder.js\r\n\r\n/**\r\n * WhammyRecorder is a standalone class used by {@link RecordRTC} to bring video recording in Chrome. It runs top over {@link Whammy}.\r\n * @summary Video recording feature in Chrome.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef WhammyRecorder\r\n * @class\r\n * @example\r\n * var recorder = new WhammyRecorder(mediaStream);\r\n * recorder.record();\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.\r\n * @param {object} config - {disableLogs: true, initCallback: function, video: HTMLVideoElement, etc.}\r\n */\r\n\r\nfunction WhammyRecorder(mediaStream, config) {\r\n\r\n config = config || {};\r\n\r\n if (!config.frameInterval) {\r\n config.frameInterval = 10;\r\n }\r\n\r\n if (!config.disableLogs) {\r\n console.log('Using frames-interval:', config.frameInterval);\r\n }\r\n\r\n /**\r\n * This method records video.\r\n * @method\r\n * @memberof WhammyRecorder\r\n * @example\r\n * recorder.record();\r\n */\r\n this.record = function() {\r\n if (!config.width) {\r\n config.width = 320;\r\n }\r\n\r\n if (!config.height) {\r\n config.height = 240;\r\n }\r\n\r\n if (!config.video) {\r\n config.video = {\r\n width: config.width,\r\n height: config.height\r\n };\r\n }\r\n\r\n if (!config.canvas) {\r\n config.canvas = {\r\n width: config.width,\r\n height: config.height\r\n };\r\n }\r\n\r\n canvas.width = config.canvas.width || 320;\r\n canvas.height = config.canvas.height || 240;\r\n\r\n context = canvas.getContext('2d');\r\n\r\n // setting defaults\r\n if (config.video && config.video instanceof HTMLVideoElement) {\r\n video = config.video.cloneNode();\r\n\r\n if (config.initCallback) {\r\n config.initCallback();\r\n }\r\n } else {\r\n video = document.createElement('video');\r\n\r\n setSrcObject(mediaStream, video);\r\n\r\n video.onloadedmetadata = function() { // \"onloadedmetadata\" may NOT work in FF?\r\n if (config.initCallback) {\r\n config.initCallback();\r\n }\r\n };\r\n\r\n video.width = config.video.width;\r\n video.height = config.video.height;\r\n }\r\n\r\n video.muted = true;\r\n video.play();\r\n\r\n lastTime = new Date().getTime();\r\n whammy = new Whammy.Video();\r\n\r\n if (!config.disableLogs) {\r\n console.log('canvas resolutions', canvas.width, '*', canvas.height);\r\n console.log('video width/height', video.width || canvas.width, '*', video.height || canvas.height);\r\n }\r\n\r\n drawFrames(config.frameInterval);\r\n };\r\n\r\n /**\r\n * Draw and push frames to Whammy\r\n * @param {integer} frameInterval - set minimum interval (in milliseconds) between each time we push a frame to Whammy\r\n */\r\n function drawFrames(frameInterval) {\r\n frameInterval = typeof frameInterval !== 'undefined' ? frameInterval : 10;\r\n\r\n var duration = new Date().getTime() - lastTime;\r\n if (!duration) {\r\n return setTimeout(drawFrames, frameInterval, frameInterval);\r\n }\r\n\r\n if (isPausedRecording) {\r\n lastTime = new Date().getTime();\r\n return setTimeout(drawFrames, 100);\r\n }\r\n\r\n // via #206, by Jack i.e. @Seymourr\r\n lastTime = new Date().getTime();\r\n\r\n if (video.paused) {\r\n // via: https://github.com/muaz-khan/WebRTC-Experiment/pull/316\r\n // Tweak for Android Chrome\r\n video.play();\r\n }\r\n\r\n context.drawImage(video, 0, 0, canvas.width, canvas.height);\r\n whammy.frames.push({\r\n duration: duration,\r\n image: canvas.toDataURL('image/webp')\r\n });\r\n\r\n if (!isStopDrawing) {\r\n setTimeout(drawFrames, frameInterval, frameInterval);\r\n }\r\n }\r\n\r\n function asyncLoop(o) {\r\n var i = -1,\r\n length = o.length;\r\n\r\n (function loop() {\r\n i++;\r\n if (i === length) {\r\n o.callback();\r\n return;\r\n }\r\n\r\n // \"setTimeout\" added by Jim McLeod\r\n setTimeout(function() {\r\n o.functionToLoop(loop, i);\r\n }, 1);\r\n })();\r\n }\r\n\r\n\r\n /**\r\n * remove black frames from the beginning to the specified frame\r\n * @param {Array} _frames - array of frames to be checked\r\n * @param {number} _framesToCheck - number of frame until check will be executed (-1 - will drop all frames until frame not matched will be found)\r\n * @param {number} _pixTolerance - 0 - very strict (only black pixel color) ; 1 - all\r\n * @param {number} _frameTolerance - 0 - very strict (only black frame color) ; 1 - all\r\n * @returns {Array} - array of frames\r\n */\r\n // pull#293 by @volodalexey\r\n function dropBlackFrames(_frames, _framesToCheck, _pixTolerance, _frameTolerance, callback) {\r\n var localCanvas = document.createElement('canvas');\r\n localCanvas.width = canvas.width;\r\n localCanvas.height = canvas.height;\r\n var context2d = localCanvas.getContext('2d');\r\n var resultFrames = [];\r\n\r\n var checkUntilNotBlack = _framesToCheck === -1;\r\n var endCheckFrame = (_framesToCheck && _framesToCheck > 0 && _framesToCheck <= _frames.length) ?\r\n _framesToCheck : _frames.length;\r\n var sampleColor = {\r\n r: 0,\r\n g: 0,\r\n b: 0\r\n };\r\n var maxColorDifference = Math.sqrt(\r\n Math.pow(255, 2) +\r\n Math.pow(255, 2) +\r\n Math.pow(255, 2)\r\n );\r\n var pixTolerance = _pixTolerance && _pixTolerance >= 0 && _pixTolerance <= 1 ? _pixTolerance : 0;\r\n var frameTolerance = _frameTolerance && _frameTolerance >= 0 && _frameTolerance <= 1 ? _frameTolerance : 0;\r\n var doNotCheckNext = false;\r\n\r\n asyncLoop({\r\n length: endCheckFrame,\r\n functionToLoop: function(loop, f) {\r\n var matchPixCount, endPixCheck, maxPixCount;\r\n\r\n var finishImage = function() {\r\n if (!doNotCheckNext && maxPixCount - matchPixCount <= maxPixCount * frameTolerance) {\r\n // console.log('removed black frame : ' + f + ' ; frame duration ' + _frames[f].duration);\r\n } else {\r\n // console.log('frame is passed : ' + f);\r\n if (checkUntilNotBlack) {\r\n doNotCheckNext = true;\r\n }\r\n resultFrames.push(_frames[f]);\r\n }\r\n loop();\r\n };\r\n\r\n if (!doNotCheckNext) {\r\n var image = new Image();\r\n image.onload = function() {\r\n context2d.drawImage(image, 0, 0, canvas.width, canvas.height);\r\n var imageData = context2d.getImageData(0, 0, canvas.width, canvas.height);\r\n matchPixCount = 0;\r\n endPixCheck = imageData.data.length;\r\n maxPixCount = imageData.data.length / 4;\r\n\r\n for (var pix = 0; pix < endPixCheck; pix += 4) {\r\n var currentColor = {\r\n r: imageData.data[pix],\r\n g: imageData.data[pix + 1],\r\n b: imageData.data[pix + 2]\r\n };\r\n var colorDifference = Math.sqrt(\r\n Math.pow(currentColor.r - sampleColor.r, 2) +\r\n Math.pow(currentColor.g - sampleColor.g, 2) +\r\n Math.pow(currentColor.b - sampleColor.b, 2)\r\n );\r\n // difference in color it is difference in color vectors (r1,g1,b1) <=> (r2,g2,b2)\r\n if (colorDifference <= maxColorDifference * pixTolerance) {\r\n matchPixCount++;\r\n }\r\n }\r\n finishImage();\r\n };\r\n image.src = _frames[f].image;\r\n } else {\r\n finishImage();\r\n }\r\n },\r\n callback: function() {\r\n resultFrames = resultFrames.concat(_frames.slice(endCheckFrame));\r\n\r\n if (resultFrames.length <= 0) {\r\n // at least one last frame should be available for next manipulation\r\n // if total duration of all frames will be < 1000 than ffmpeg doesn't work well...\r\n resultFrames.push(_frames[_frames.length - 1]);\r\n }\r\n callback(resultFrames);\r\n }\r\n });\r\n }\r\n\r\n var isStopDrawing = false;\r\n\r\n /**\r\n * This method stops recording video.\r\n * @param {function} callback - Callback function, that is used to pass recorded blob back to the callee.\r\n * @method\r\n * @memberof WhammyRecorder\r\n * @example\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n */\r\n this.stop = function(callback) {\r\n callback = callback || function() {};\r\n\r\n isStopDrawing = true;\r\n\r\n var _this = this;\r\n // analyse of all frames takes some time!\r\n setTimeout(function() {\r\n // e.g. dropBlackFrames(frames, 10, 1, 1) - will cut all 10 frames\r\n // e.g. dropBlackFrames(frames, 10, 0.5, 0.5) - will analyse 10 frames\r\n // e.g. dropBlackFrames(frames, 10) === dropBlackFrames(frames, 10, 0, 0) - will analyse 10 frames with strict black color\r\n dropBlackFrames(whammy.frames, -1, null, null, function(frames) {\r\n whammy.frames = frames;\r\n\r\n // to display advertisement images!\r\n if (config.advertisement && config.advertisement.length) {\r\n whammy.frames = config.advertisement.concat(whammy.frames);\r\n }\r\n\r\n /**\r\n * @property {Blob} blob - Recorded frames in video/webm blob.\r\n * @memberof WhammyRecorder\r\n * @example\r\n * recorder.stop(function() {\r\n * var blob = recorder.blob;\r\n * });\r\n */\r\n whammy.compile(function(blob) {\r\n _this.blob = blob;\r\n\r\n if (_this.blob.forEach) {\r\n _this.blob = new Blob([], {\r\n type: 'video/webm'\r\n });\r\n }\r\n\r\n if (callback) {\r\n callback(_this.blob);\r\n }\r\n });\r\n });\r\n }, 10);\r\n };\r\n\r\n var isPausedRecording = false;\r\n\r\n /**\r\n * This method pauses the recording process.\r\n * @method\r\n * @memberof WhammyRecorder\r\n * @example\r\n * recorder.pause();\r\n */\r\n this.pause = function() {\r\n isPausedRecording = true;\r\n };\r\n\r\n /**\r\n * This method resumes the recording process.\r\n * @method\r\n * @memberof WhammyRecorder\r\n * @example\r\n * recorder.resume();\r\n */\r\n this.resume = function() {\r\n isPausedRecording = false;\r\n\r\n if (isStopDrawing) {\r\n this.record();\r\n }\r\n };\r\n\r\n /**\r\n * This method resets currently recorded data.\r\n * @method\r\n * @memberof WhammyRecorder\r\n * @example\r\n * recorder.clearRecordedData();\r\n */\r\n this.clearRecordedData = function() {\r\n if (!isStopDrawing) {\r\n this.stop(clearRecordedDataCB);\r\n }\r\n clearRecordedDataCB();\r\n };\r\n\r\n function clearRecordedDataCB() {\r\n whammy.frames = [];\r\n isStopDrawing = true;\r\n isPausedRecording = false;\r\n }\r\n\r\n // for debugging\r\n this.name = 'WhammyRecorder';\r\n this.toString = function() {\r\n return this.name;\r\n };\r\n\r\n var canvas = document.createElement('canvas');\r\n var context = canvas.getContext('2d');\r\n\r\n var video;\r\n var lastTime;\r\n var whammy;\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.WhammyRecorder = WhammyRecorder;\r\n}\n\r\n// https://github.com/antimatter15/whammy/blob/master/LICENSE\r\n// _________\r\n// Whammy.js\r\n\r\n// todo: Firefox now supports webp for webm containers!\r\n// their MediaRecorder implementation works well!\r\n// should we provide an option to record via Whammy.js or MediaRecorder API is a better solution?\r\n\r\n/**\r\n * Whammy is a standalone class used by {@link RecordRTC} to bring video recording in Chrome. It is written by {@link https://github.com/antimatter15|antimatter15}\r\n * @summary A real time javascript webm encoder based on a canvas hack.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef Whammy\r\n * @class\r\n * @example\r\n * var recorder = new Whammy().Video(15);\r\n * recorder.add(context || canvas || dataURL);\r\n * var output = recorder.compile();\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n */\r\n\r\nvar Whammy = (function() {\r\n // a more abstract-ish API\r\n\r\n function WhammyVideo(duration) {\r\n this.frames = [];\r\n this.duration = duration || 1;\r\n this.quality = 0.8;\r\n }\r\n\r\n /**\r\n * Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.\r\n * @method\r\n * @memberof Whammy\r\n * @example\r\n * recorder = new Whammy().Video(0.8, 100);\r\n * recorder.add(canvas || context || 'image/webp');\r\n * @param {string} frame - Canvas || Context || image/webp\r\n * @param {number} duration - Stick a duration (in milliseconds)\r\n */\r\n WhammyVideo.prototype.add = function(frame, duration) {\r\n if ('canvas' in frame) { //CanvasRenderingContext2D\r\n frame = frame.canvas;\r\n }\r\n\r\n if ('toDataURL' in frame) {\r\n frame = frame.toDataURL('image/webp', this.quality);\r\n }\r\n\r\n if (!(/^data:image\\/webp;base64,/ig).test(frame)) {\r\n throw 'Input must be formatted properly as a base64 encoded DataURI of type image/webp';\r\n }\r\n this.frames.push({\r\n image: frame,\r\n duration: duration || this.duration\r\n });\r\n };\r\n\r\n function processInWebWorker(_function) {\r\n var blob = URL.createObjectURL(new Blob([_function.toString(),\r\n 'this.onmessage = function (eee) {' + _function.name + '(eee.data);}'\r\n ], {\r\n type: 'application/javascript'\r\n }));\r\n\r\n var worker = new Worker(blob);\r\n URL.revokeObjectURL(blob);\r\n return worker;\r\n }\r\n\r\n function whammyInWebWorker(frames) {\r\n function ArrayToWebM(frames) {\r\n var info = checkFrames(frames);\r\n if (!info) {\r\n return [];\r\n }\r\n\r\n var clusterMaxDuration = 30000;\r\n\r\n var EBML = [{\r\n 'id': 0x1a45dfa3, // EBML\r\n 'data': [{\r\n 'data': 1,\r\n 'id': 0x4286 // EBMLVersion\r\n }, {\r\n 'data': 1,\r\n 'id': 0x42f7 // EBMLReadVersion\r\n }, {\r\n 'data': 4,\r\n 'id': 0x42f2 // EBMLMaxIDLength\r\n }, {\r\n 'data': 8,\r\n 'id': 0x42f3 // EBMLMaxSizeLength\r\n }, {\r\n 'data': 'webm',\r\n 'id': 0x4282 // DocType\r\n }, {\r\n 'data': 2,\r\n 'id': 0x4287 // DocTypeVersion\r\n }, {\r\n 'data': 2,\r\n 'id': 0x4285 // DocTypeReadVersion\r\n }]\r\n }, {\r\n 'id': 0x18538067, // Segment\r\n 'data': [{\r\n 'id': 0x1549a966, // Info\r\n 'data': [{\r\n 'data': 1e6, //do things in millisecs (num of nanosecs for duration scale)\r\n 'id': 0x2ad7b1 // TimecodeScale\r\n }, {\r\n 'data': 'whammy',\r\n 'id': 0x4d80 // MuxingApp\r\n }, {\r\n 'data': 'whammy',\r\n 'id': 0x5741 // WritingApp\r\n }, {\r\n 'data': doubleToString(info.duration),\r\n 'id': 0x4489 // Duration\r\n }]\r\n }, {\r\n 'id': 0x1654ae6b, // Tracks\r\n 'data': [{\r\n 'id': 0xae, // TrackEntry\r\n 'data': [{\r\n 'data': 1,\r\n 'id': 0xd7 // TrackNumber\r\n }, {\r\n 'data': 1,\r\n 'id': 0x73c5 // TrackUID\r\n }, {\r\n 'data': 0,\r\n 'id': 0x9c // FlagLacing\r\n }, {\r\n 'data': 'und',\r\n 'id': 0x22b59c // Language\r\n }, {\r\n 'data': 'V_VP8',\r\n 'id': 0x86 // CodecID\r\n }, {\r\n 'data': 'VP8',\r\n 'id': 0x258688 // CodecName\r\n }, {\r\n 'data': 1,\r\n 'id': 0x83 // TrackType\r\n }, {\r\n 'id': 0xe0, // Video\r\n 'data': [{\r\n 'data': info.width,\r\n 'id': 0xb0 // PixelWidth\r\n }, {\r\n 'data': info.height,\r\n 'id': 0xba // PixelHeight\r\n }]\r\n }]\r\n }]\r\n }]\r\n }];\r\n\r\n //Generate clusters (max duration)\r\n var frameNumber = 0;\r\n var clusterTimecode = 0;\r\n while (frameNumber < frames.length) {\r\n\r\n var clusterFrames = [];\r\n var clusterDuration = 0;\r\n do {\r\n clusterFrames.push(frames[frameNumber]);\r\n clusterDuration += frames[frameNumber].duration;\r\n frameNumber++;\r\n } while (frameNumber < frames.length && clusterDuration < clusterMaxDuration);\r\n\r\n var clusterCounter = 0;\r\n var cluster = {\r\n 'id': 0x1f43b675, // Cluster\r\n 'data': getClusterData(clusterTimecode, clusterCounter, clusterFrames)\r\n }; //Add cluster to segment\r\n EBML[1].data.push(cluster);\r\n clusterTimecode += clusterDuration;\r\n }\r\n\r\n return generateEBML(EBML);\r\n }\r\n\r\n function getClusterData(clusterTimecode, clusterCounter, clusterFrames) {\r\n return [{\r\n 'data': clusterTimecode,\r\n 'id': 0xe7 // Timecode\r\n }].concat(clusterFrames.map(function(webp) {\r\n var block = makeSimpleBlock({\r\n discardable: 0,\r\n frame: webp.data.slice(4),\r\n invisible: 0,\r\n keyframe: 1,\r\n lacing: 0,\r\n trackNum: 1,\r\n timecode: Math.round(clusterCounter)\r\n });\r\n clusterCounter += webp.duration;\r\n return {\r\n data: block,\r\n id: 0xa3\r\n };\r\n }));\r\n }\r\n\r\n // sums the lengths of all the frames and gets the duration\r\n\r\n function checkFrames(frames) {\r\n if (!frames[0]) {\r\n postMessage({\r\n error: 'Something went wrong. Maybe WebP format is not supported in the current browser.'\r\n });\r\n return;\r\n }\r\n\r\n var width = frames[0].width,\r\n height = frames[0].height,\r\n duration = frames[0].duration;\r\n\r\n for (var i = 1; i < frames.length; i++) {\r\n duration += frames[i].duration;\r\n }\r\n return {\r\n duration: duration,\r\n width: width,\r\n height: height\r\n };\r\n }\r\n\r\n function numToBuffer(num) {\r\n var parts = [];\r\n while (num > 0) {\r\n parts.push(num & 0xff);\r\n num = num >> 8;\r\n }\r\n return new Uint8Array(parts.reverse());\r\n }\r\n\r\n function strToBuffer(str) {\r\n return new Uint8Array(str.split('').map(function(e) {\r\n return e.charCodeAt(0);\r\n }));\r\n }\r\n\r\n function bitsToBuffer(bits) {\r\n var data = [];\r\n var pad = (bits.length % 8) ? (new Array(1 + 8 - (bits.length % 8))).join('0') : '';\r\n bits = pad + bits;\r\n for (var i = 0; i < bits.length; i += 8) {\r\n data.push(parseInt(bits.substr(i, 8), 2));\r\n }\r\n return new Uint8Array(data);\r\n }\r\n\r\n function generateEBML(json) {\r\n var ebml = [];\r\n for (var i = 0; i < json.length; i++) {\r\n var data = json[i].data;\r\n\r\n if (typeof data === 'object') {\r\n data = generateEBML(data);\r\n }\r\n\r\n if (typeof data === 'number') {\r\n data = bitsToBuffer(data.toString(2));\r\n }\r\n\r\n if (typeof data === 'string') {\r\n data = strToBuffer(data);\r\n }\r\n\r\n var len = data.size || data.byteLength || data.length;\r\n var zeroes = Math.ceil(Math.ceil(Math.log(len) / Math.log(2)) / 8);\r\n var sizeToString = len.toString(2);\r\n var padded = (new Array((zeroes * 7 + 7 + 1) - sizeToString.length)).join('0') + sizeToString;\r\n var size = (new Array(zeroes)).join('0') + '1' + padded;\r\n\r\n ebml.push(numToBuffer(json[i].id));\r\n ebml.push(bitsToBuffer(size));\r\n ebml.push(data);\r\n }\r\n\r\n return new Blob(ebml, {\r\n type: 'video/webm'\r\n });\r\n }\r\n\r\n function toBinStrOld(bits) {\r\n var data = '';\r\n var pad = (bits.length % 8) ? (new Array(1 + 8 - (bits.length % 8))).join('0') : '';\r\n bits = pad + bits;\r\n for (var i = 0; i < bits.length; i += 8) {\r\n data += String.fromCharCode(parseInt(bits.substr(i, 8), 2));\r\n }\r\n return data;\r\n }\r\n\r\n function makeSimpleBlock(data) {\r\n var flags = 0;\r\n\r\n if (data.keyframe) {\r\n flags |= 128;\r\n }\r\n\r\n if (data.invisible) {\r\n flags |= 8;\r\n }\r\n\r\n if (data.lacing) {\r\n flags |= (data.lacing << 1);\r\n }\r\n\r\n if (data.discardable) {\r\n flags |= 1;\r\n }\r\n\r\n if (data.trackNum > 127) {\r\n throw 'TrackNumber > 127 not supported';\r\n }\r\n\r\n var out = [data.trackNum | 0x80, data.timecode >> 8, data.timecode & 0xff, flags].map(function(e) {\r\n return String.fromCharCode(e);\r\n }).join('') + data.frame;\r\n\r\n return out;\r\n }\r\n\r\n function parseWebP(riff) {\r\n var VP8 = riff.RIFF[0].WEBP[0];\r\n\r\n var frameStart = VP8.indexOf('\\x9d\\x01\\x2a'); // A VP8 keyframe starts with the 0x9d012a header\r\n for (var i = 0, c = []; i < 4; i++) {\r\n c[i] = VP8.charCodeAt(frameStart + 3 + i);\r\n }\r\n\r\n var width, height, tmp;\r\n\r\n //the code below is literally copied verbatim from the bitstream spec\r\n tmp = (c[1] << 8) | c[0];\r\n width = tmp & 0x3FFF;\r\n tmp = (c[3] << 8) | c[2];\r\n height = tmp & 0x3FFF;\r\n return {\r\n width: width,\r\n height: height,\r\n data: VP8,\r\n riff: riff\r\n };\r\n }\r\n\r\n function getStrLength(string, offset) {\r\n return parseInt(string.substr(offset + 4, 4).split('').map(function(i) {\r\n var unpadded = i.charCodeAt(0).toString(2);\r\n return (new Array(8 - unpadded.length + 1)).join('0') + unpadded;\r\n }).join(''), 2);\r\n }\r\n\r\n function parseRIFF(string) {\r\n var offset = 0;\r\n var chunks = {};\r\n\r\n while (offset < string.length) {\r\n var id = string.substr(offset, 4);\r\n var len = getStrLength(string, offset);\r\n var data = string.substr(offset + 4 + 4, len);\r\n offset += 4 + 4 + len;\r\n chunks[id] = chunks[id] || [];\r\n\r\n if (id === 'RIFF' || id === 'LIST') {\r\n chunks[id].push(parseRIFF(data));\r\n } else {\r\n chunks[id].push(data);\r\n }\r\n }\r\n return chunks;\r\n }\r\n\r\n function doubleToString(num) {\r\n return [].slice.call(\r\n new Uint8Array((new Float64Array([num])).buffer), 0).map(function(e) {\r\n return String.fromCharCode(e);\r\n }).reverse().join('');\r\n }\r\n\r\n var webm = new ArrayToWebM(frames.map(function(frame) {\r\n var webp = parseWebP(parseRIFF(atob(frame.image.slice(23))));\r\n webp.duration = frame.duration;\r\n return webp;\r\n }));\r\n\r\n postMessage(webm);\r\n }\r\n\r\n /**\r\n * Encodes frames in WebM container. It uses WebWorkinvoke to invoke 'ArrayToWebM' method.\r\n * @param {function} callback - Callback function, that is used to pass recorded blob back to the callee.\r\n * @method\r\n * @memberof Whammy\r\n * @example\r\n * recorder = new Whammy().Video(0.8, 100);\r\n * recorder.compile(function(blob) {\r\n * // blob.size - blob.type\r\n * });\r\n */\r\n WhammyVideo.prototype.compile = function(callback) {\r\n var webWorker = processInWebWorker(whammyInWebWorker);\r\n\r\n webWorker.onmessage = function(event) {\r\n if (event.data.error) {\r\n console.error(event.data.error);\r\n return;\r\n }\r\n callback(event.data);\r\n };\r\n\r\n webWorker.postMessage(this.frames);\r\n };\r\n\r\n return {\r\n /**\r\n * A more abstract-ish API.\r\n * @method\r\n * @memberof Whammy\r\n * @example\r\n * recorder = new Whammy().Video(0.8, 100);\r\n * @param {?number} speed - 0.8\r\n * @param {?number} quality - 100\r\n */\r\n Video: WhammyVideo\r\n };\r\n})();\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.Whammy = Whammy;\r\n}\n\r\n// ______________ (indexed-db)\r\n// DiskStorage.js\r\n\r\n/**\r\n * DiskStorage is a standalone object used by {@link RecordRTC} to store recorded blobs in IndexedDB storage.\r\n * @summary Writing blobs into IndexedDB.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @example\r\n * DiskStorage.Store({\r\n * audioBlob: yourAudioBlob,\r\n * videoBlob: yourVideoBlob,\r\n * gifBlob : yourGifBlob\r\n * });\r\n * DiskStorage.Fetch(function(dataURL, type) {\r\n * if(type === 'audioBlob') { }\r\n * if(type === 'videoBlob') { }\r\n * if(type === 'gifBlob') { }\r\n * });\r\n * // DiskStorage.dataStoreName = 'recordRTC';\r\n * // DiskStorage.onError = function(error) { };\r\n * @property {function} init - This method must be called once to initialize IndexedDB ObjectStore. Though, it is auto-used internally.\r\n * @property {function} Fetch - This method fetches stored blobs from IndexedDB.\r\n * @property {function} Store - This method stores blobs in IndexedDB.\r\n * @property {function} onError - This function is invoked for any known/unknown error.\r\n * @property {string} dataStoreName - Name of the ObjectStore created in IndexedDB storage.\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n */\r\n\r\n\r\nvar DiskStorage = {\r\n /**\r\n * This method must be called once to initialize IndexedDB ObjectStore. Though, it is auto-used internally.\r\n * @method\r\n * @memberof DiskStorage\r\n * @internal\r\n * @example\r\n * DiskStorage.init();\r\n */\r\n init: function() {\r\n var self = this;\r\n\r\n if (typeof indexedDB === 'undefined' || typeof indexedDB.open === 'undefined') {\r\n console.error('IndexedDB API are not available in this browser.');\r\n return;\r\n }\r\n\r\n var dbVersion = 1;\r\n var dbName = this.dbName || location.href.replace(/\\/|:|#|%|\\.|\\[|\\]/g, ''),\r\n db;\r\n var request = indexedDB.open(dbName, dbVersion);\r\n\r\n function createObjectStore(dataBase) {\r\n dataBase.createObjectStore(self.dataStoreName);\r\n }\r\n\r\n function putInDB() {\r\n var transaction = db.transaction([self.dataStoreName], 'readwrite');\r\n\r\n if (self.videoBlob) {\r\n transaction.objectStore(self.dataStoreName).put(self.videoBlob, 'videoBlob');\r\n }\r\n\r\n if (self.gifBlob) {\r\n transaction.objectStore(self.dataStoreName).put(self.gifBlob, 'gifBlob');\r\n }\r\n\r\n if (self.audioBlob) {\r\n transaction.objectStore(self.dataStoreName).put(self.audioBlob, 'audioBlob');\r\n }\r\n\r\n function getFromStore(portionName) {\r\n transaction.objectStore(self.dataStoreName).get(portionName).onsuccess = function(event) {\r\n if (self.callback) {\r\n self.callback(event.target.result, portionName);\r\n }\r\n };\r\n }\r\n\r\n getFromStore('audioBlob');\r\n getFromStore('videoBlob');\r\n getFromStore('gifBlob');\r\n }\r\n\r\n request.onerror = self.onError;\r\n\r\n request.onsuccess = function() {\r\n db = request.result;\r\n db.onerror = self.onError;\r\n\r\n if (db.setVersion) {\r\n if (db.version !== dbVersion) {\r\n var setVersion = db.setVersion(dbVersion);\r\n setVersion.onsuccess = function() {\r\n createObjectStore(db);\r\n putInDB();\r\n };\r\n } else {\r\n putInDB();\r\n }\r\n } else {\r\n putInDB();\r\n }\r\n };\r\n request.onupgradeneeded = function(event) {\r\n createObjectStore(event.target.result);\r\n };\r\n },\r\n /**\r\n * This method fetches stored blobs from IndexedDB.\r\n * @method\r\n * @memberof DiskStorage\r\n * @internal\r\n * @example\r\n * DiskStorage.Fetch(function(dataURL, type) {\r\n * if(type === 'audioBlob') { }\r\n * if(type === 'videoBlob') { }\r\n * if(type === 'gifBlob') { }\r\n * });\r\n */\r\n Fetch: function(callback) {\r\n this.callback = callback;\r\n this.init();\r\n\r\n return this;\r\n },\r\n /**\r\n * This method stores blobs in IndexedDB.\r\n * @method\r\n * @memberof DiskStorage\r\n * @internal\r\n * @example\r\n * DiskStorage.Store({\r\n * audioBlob: yourAudioBlob,\r\n * videoBlob: yourVideoBlob,\r\n * gifBlob : yourGifBlob\r\n * });\r\n */\r\n Store: function(config) {\r\n this.audioBlob = config.audioBlob;\r\n this.videoBlob = config.videoBlob;\r\n this.gifBlob = config.gifBlob;\r\n\r\n this.init();\r\n\r\n return this;\r\n },\r\n /**\r\n * This function is invoked for any known/unknown error.\r\n * @method\r\n * @memberof DiskStorage\r\n * @internal\r\n * @example\r\n * DiskStorage.onError = function(error){\r\n * alerot( JSON.stringify(error) );\r\n * };\r\n */\r\n onError: function(error) {\r\n console.error(JSON.stringify(error, null, '\\t'));\r\n },\r\n\r\n /**\r\n * @property {string} dataStoreName - Name of the ObjectStore created in IndexedDB storage.\r\n * @memberof DiskStorage\r\n * @internal\r\n * @example\r\n * DiskStorage.dataStoreName = 'recordRTC';\r\n */\r\n dataStoreName: 'recordRTC',\r\n dbName: null\r\n};\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.DiskStorage = DiskStorage;\r\n}\n\r\n// ______________\r\n// GifRecorder.js\r\n\r\n/**\r\n * GifRecorder is standalone calss used by {@link RecordRTC} to record video or canvas into animated gif.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef GifRecorder\r\n * @class\r\n * @example\r\n * var recorder = new GifRecorder(mediaStream || canvas || context, { onGifPreview: function, onGifRecordingStarted: function, width: 1280, height: 720, frameRate: 200, quality: 10 });\r\n * recorder.record();\r\n * recorder.stop(function(blob) {\r\n * img.src = URL.createObjectURL(blob);\r\n * });\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - MediaStream object or HTMLCanvasElement or CanvasRenderingContext2D.\r\n * @param {object} config - {disableLogs:true, initCallback: function, width: 320, height: 240, frameRate: 200, quality: 10}\r\n */\r\n\r\nfunction GifRecorder(mediaStream, config) {\r\n if (typeof GIFEncoder === 'undefined') {\r\n var script = document.createElement('script');\r\n script.src = 'https://www.webrtc-experiment.com/gif-recorder.js';\r\n (document.body || document.documentElement).appendChild(script);\r\n }\r\n\r\n config = config || {};\r\n\r\n var isHTMLObject = mediaStream instanceof CanvasRenderingContext2D || mediaStream instanceof HTMLCanvasElement;\r\n\r\n /**\r\n * This method records MediaStream.\r\n * @method\r\n * @memberof GifRecorder\r\n * @example\r\n * recorder.record();\r\n */\r\n this.record = function() {\r\n if (typeof GIFEncoder === 'undefined') {\r\n setTimeout(self.record, 1000);\r\n return;\r\n }\r\n\r\n if (!isLoadedMetaData) {\r\n setTimeout(self.record, 1000);\r\n return;\r\n }\r\n\r\n if (!isHTMLObject) {\r\n if (!config.width) {\r\n config.width = video.offsetWidth || 320;\r\n }\r\n\r\n if (!config.height) {\r\n config.height = video.offsetHeight || 240;\r\n }\r\n\r\n if (!config.video) {\r\n config.video = {\r\n width: config.width,\r\n height: config.height\r\n };\r\n }\r\n\r\n if (!config.canvas) {\r\n config.canvas = {\r\n width: config.width,\r\n height: config.height\r\n };\r\n }\r\n\r\n canvas.width = config.canvas.width || 320;\r\n canvas.height = config.canvas.height || 240;\r\n\r\n video.width = config.video.width || 320;\r\n video.height = config.video.height || 240;\r\n }\r\n\r\n // external library to record as GIF images\r\n gifEncoder = new GIFEncoder();\r\n\r\n // void setRepeat(int iter) \r\n // Sets the number of times the set of GIF frames should be played. \r\n // Default is 1; 0 means play indefinitely.\r\n gifEncoder.setRepeat(0);\r\n\r\n // void setFrameRate(Number fps) \r\n // Sets frame rate in frames per second. \r\n // Equivalent to setDelay(1000/fps).\r\n // Using \"setDelay\" instead of \"setFrameRate\"\r\n gifEncoder.setDelay(config.frameRate || 200);\r\n\r\n // void setQuality(int quality) \r\n // Sets quality of color quantization (conversion of images to the \r\n // maximum 256 colors allowed by the GIF specification). \r\n // Lower values (minimum = 1) produce better colors, \r\n // but slow processing significantly. 10 is the default, \r\n // and produces good color mapping at reasonable speeds. \r\n // Values greater than 20 do not yield significant improvements in speed.\r\n gifEncoder.setQuality(config.quality || 10);\r\n\r\n // Boolean start() \r\n // This writes the GIF Header and returns false if it fails.\r\n gifEncoder.start();\r\n\r\n if (typeof config.onGifRecordingStarted === 'function') {\r\n config.onGifRecordingStarted();\r\n }\r\n\r\n startTime = Date.now();\r\n\r\n function drawVideoFrame(time) {\r\n if (self.clearedRecordedData === true) {\r\n return;\r\n }\r\n\r\n if (isPausedRecording) {\r\n return setTimeout(function() {\r\n drawVideoFrame(time);\r\n }, 100);\r\n }\r\n\r\n lastAnimationFrame = requestAnimationFrame(drawVideoFrame);\r\n\r\n if (typeof lastFrameTime === undefined) {\r\n lastFrameTime = time;\r\n }\r\n\r\n // ~10 fps\r\n if (time - lastFrameTime < 90) {\r\n return;\r\n }\r\n\r\n if (!isHTMLObject && video.paused) {\r\n // via: https://github.com/muaz-khan/WebRTC-Experiment/pull/316\r\n // Tweak for Android Chrome\r\n video.play();\r\n }\r\n\r\n if (!isHTMLObject) {\r\n context.drawImage(video, 0, 0, canvas.width, canvas.height);\r\n }\r\n\r\n if (config.onGifPreview) {\r\n config.onGifPreview(canvas.toDataURL('image/png'));\r\n }\r\n\r\n gifEncoder.addFrame(context);\r\n lastFrameTime = time;\r\n }\r\n\r\n lastAnimationFrame = requestAnimationFrame(drawVideoFrame);\r\n\r\n if (config.initCallback) {\r\n config.initCallback();\r\n }\r\n };\r\n\r\n /**\r\n * This method stops recording MediaStream.\r\n * @param {function} callback - Callback function, that is used to pass recorded blob back to the callee.\r\n * @method\r\n * @memberof GifRecorder\r\n * @example\r\n * recorder.stop(function(blob) {\r\n * img.src = URL.createObjectURL(blob);\r\n * });\r\n */\r\n this.stop = function(callback) {\r\n callback = callback || function() {};\r\n\r\n if (lastAnimationFrame) {\r\n cancelAnimationFrame(lastAnimationFrame);\r\n }\r\n\r\n endTime = Date.now();\r\n\r\n /**\r\n * @property {Blob} blob - The recorded blob object.\r\n * @memberof GifRecorder\r\n * @example\r\n * recorder.stop(function(){\r\n * var blob = recorder.blob;\r\n * });\r\n */\r\n this.blob = new Blob([new Uint8Array(gifEncoder.stream().bin)], {\r\n type: 'image/gif'\r\n });\r\n\r\n callback(this.blob);\r\n\r\n // bug: find a way to clear old recorded blobs\r\n gifEncoder.stream().bin = [];\r\n };\r\n\r\n var isPausedRecording = false;\r\n\r\n /**\r\n * This method pauses the recording process.\r\n * @method\r\n * @memberof GifRecorder\r\n * @example\r\n * recorder.pause();\r\n */\r\n this.pause = function() {\r\n isPausedRecording = true;\r\n };\r\n\r\n /**\r\n * This method resumes the recording process.\r\n * @method\r\n * @memberof GifRecorder\r\n * @example\r\n * recorder.resume();\r\n */\r\n this.resume = function() {\r\n isPausedRecording = false;\r\n };\r\n\r\n /**\r\n * This method resets currently recorded data.\r\n * @method\r\n * @memberof GifRecorder\r\n * @example\r\n * recorder.clearRecordedData();\r\n */\r\n this.clearRecordedData = function() {\r\n self.clearedRecordedData = true;\r\n clearRecordedDataCB();\r\n };\r\n\r\n function clearRecordedDataCB() {\r\n if (gifEncoder) {\r\n gifEncoder.stream().bin = [];\r\n }\r\n }\r\n\r\n // for debugging\r\n this.name = 'GifRecorder';\r\n this.toString = function() {\r\n return this.name;\r\n };\r\n\r\n var canvas = document.createElement('canvas');\r\n var context = canvas.getContext('2d');\r\n\r\n if (isHTMLObject) {\r\n if (mediaStream instanceof CanvasRenderingContext2D) {\r\n context = mediaStream;\r\n canvas = context.canvas;\r\n } else if (mediaStream instanceof HTMLCanvasElement) {\r\n context = mediaStream.getContext('2d');\r\n canvas = mediaStream;\r\n }\r\n }\r\n\r\n var isLoadedMetaData = true;\r\n\r\n if (!isHTMLObject) {\r\n var video = document.createElement('video');\r\n video.muted = true;\r\n video.autoplay = true;\r\n video.playsInline = true;\r\n\r\n isLoadedMetaData = false;\r\n video.onloadedmetadata = function() {\r\n isLoadedMetaData = true;\r\n };\r\n\r\n setSrcObject(mediaStream, video);\r\n\r\n video.play();\r\n }\r\n\r\n var lastAnimationFrame = null;\r\n var startTime, endTime, lastFrameTime;\r\n\r\n var gifEncoder;\r\n\r\n var self = this;\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.GifRecorder = GifRecorder;\r\n}\n\r\n// Last time updated: 2019-06-21 4:09:42 AM UTC\r\n\r\n// ________________________\r\n// MultiStreamsMixer v1.2.2\r\n\r\n// Open-Sourced: https://github.com/muaz-khan/MultiStreamsMixer\r\n\r\n// --------------------------------------------------\r\n// Muaz Khan - www.MuazKhan.com\r\n// MIT License - www.WebRTC-Experiment.com/licence\r\n// --------------------------------------------------\r\n\r\nfunction MultiStreamsMixer(arrayOfMediaStreams, elementClass) {\r\n\r\n var browserFakeUserAgent = 'Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45';\r\n\r\n (function(that) {\r\n if (typeof RecordRTC !== 'undefined') {\r\n return;\r\n }\r\n\r\n if (!that) {\r\n return;\r\n }\r\n\r\n if (typeof window !== 'undefined') {\r\n return;\r\n }\r\n\r\n if (typeof global === 'undefined') {\r\n return;\r\n }\r\n\r\n global.navigator = {\r\n userAgent: browserFakeUserAgent,\r\n getUserMedia: function() {}\r\n };\r\n\r\n if (!global.console) {\r\n global.console = {};\r\n }\r\n\r\n if (typeof global.console.log === 'undefined' || typeof global.console.error === 'undefined') {\r\n global.console.error = global.console.log = global.console.log || function() {\r\n console.log(arguments);\r\n };\r\n }\r\n\r\n if (typeof document === 'undefined') {\r\n /*global document:true */\r\n that.document = {\r\n documentElement: {\r\n appendChild: function() {\r\n return '';\r\n }\r\n }\r\n };\r\n\r\n document.createElement = document.captureStream = document.mozCaptureStream = function() {\r\n var obj = {\r\n getContext: function() {\r\n return obj;\r\n },\r\n play: function() {},\r\n pause: function() {},\r\n drawImage: function() {},\r\n toDataURL: function() {\r\n return '';\r\n },\r\n style: {}\r\n };\r\n return obj;\r\n };\r\n\r\n that.HTMLVideoElement = function() {};\r\n }\r\n\r\n if (typeof location === 'undefined') {\r\n /*global location:true */\r\n that.location = {\r\n protocol: 'file:',\r\n href: '',\r\n hash: ''\r\n };\r\n }\r\n\r\n if (typeof screen === 'undefined') {\r\n /*global screen:true */\r\n that.screen = {\r\n width: 0,\r\n height: 0\r\n };\r\n }\r\n\r\n if (typeof URL === 'undefined') {\r\n /*global screen:true */\r\n that.URL = {\r\n createObjectURL: function() {\r\n return '';\r\n },\r\n revokeObjectURL: function() {\r\n return '';\r\n }\r\n };\r\n }\r\n\r\n /*global window:true */\r\n that.window = global;\r\n })(typeof global !== 'undefined' ? global : null);\r\n\r\n // requires: chrome://flags/#enable-experimental-web-platform-features\r\n\r\n elementClass = elementClass || 'multi-streams-mixer';\r\n\r\n var videos = [];\r\n var isStopDrawingFrames = false;\r\n\r\n var canvas = document.createElement('canvas');\r\n var context = canvas.getContext('2d');\r\n canvas.style.opacity = 0;\r\n canvas.style.position = 'absolute';\r\n canvas.style.zIndex = -1;\r\n canvas.style.top = '-1000em';\r\n canvas.style.left = '-1000em';\r\n canvas.className = elementClass;\r\n (document.body || document.documentElement).appendChild(canvas);\r\n\r\n this.disableLogs = false;\r\n this.frameInterval = 10;\r\n\r\n this.width = 360;\r\n this.height = 240;\r\n\r\n // use gain node to prevent echo\r\n this.useGainNode = true;\r\n\r\n var self = this;\r\n\r\n // _____________________________\r\n // Cross-Browser-Declarations.js\r\n\r\n // WebAudio API representer\r\n var AudioContext = window.AudioContext;\r\n\r\n if (typeof AudioContext === 'undefined') {\r\n if (typeof webkitAudioContext !== 'undefined') {\r\n /*global AudioContext:true */\r\n AudioContext = webkitAudioContext;\r\n }\r\n\r\n if (typeof mozAudioContext !== 'undefined') {\r\n /*global AudioContext:true */\r\n AudioContext = mozAudioContext;\r\n }\r\n }\r\n\r\n /*jshint -W079 */\r\n var URL = window.URL;\r\n\r\n if (typeof URL === 'undefined' && typeof webkitURL !== 'undefined') {\r\n /*global URL:true */\r\n URL = webkitURL;\r\n }\r\n\r\n if (typeof navigator !== 'undefined' && typeof navigator.getUserMedia === 'undefined') { // maybe window.navigator?\r\n if (typeof navigator.webkitGetUserMedia !== 'undefined') {\r\n navigator.getUserMedia = navigator.webkitGetUserMedia;\r\n }\r\n\r\n if (typeof navigator.mozGetUserMedia !== 'undefined') {\r\n navigator.getUserMedia = navigator.mozGetUserMedia;\r\n }\r\n }\r\n\r\n var MediaStream = window.MediaStream;\r\n\r\n if (typeof MediaStream === 'undefined' && typeof webkitMediaStream !== 'undefined') {\r\n MediaStream = webkitMediaStream;\r\n }\r\n\r\n /*global MediaStream:true */\r\n if (typeof MediaStream !== 'undefined') {\r\n // override \"stop\" method for all browsers\r\n if (typeof MediaStream.prototype.stop === 'undefined') {\r\n MediaStream.prototype.stop = function() {\r\n this.getTracks().forEach(function(track) {\r\n track.stop();\r\n });\r\n };\r\n }\r\n }\r\n\r\n var Storage = {};\r\n\r\n if (typeof AudioContext !== 'undefined') {\r\n Storage.AudioContext = AudioContext;\r\n } else if (typeof webkitAudioContext !== 'undefined') {\r\n Storage.AudioContext = webkitAudioContext;\r\n }\r\n\r\n function setSrcObject(stream, element) {\r\n if ('srcObject' in element) {\r\n element.srcObject = stream;\r\n } else if ('mozSrcObject' in element) {\r\n element.mozSrcObject = stream;\r\n } else {\r\n element.srcObject = stream;\r\n }\r\n }\r\n\r\n this.startDrawingFrames = function() {\r\n drawVideosToCanvas();\r\n };\r\n\r\n function drawVideosToCanvas() {\r\n if (isStopDrawingFrames) {\r\n return;\r\n }\r\n\r\n var videosLength = videos.length;\r\n\r\n var fullcanvas = false;\r\n var remaining = [];\r\n videos.forEach(function(video) {\r\n if (!video.stream) {\r\n video.stream = {};\r\n }\r\n\r\n if (video.stream.fullcanvas) {\r\n fullcanvas = video;\r\n } else {\r\n // todo: video.stream.active or video.stream.live to fix blank frames issues?\r\n remaining.push(video);\r\n }\r\n });\r\n\r\n if (fullcanvas) {\r\n canvas.width = fullcanvas.stream.width;\r\n canvas.height = fullcanvas.stream.height;\r\n } else if (remaining.length) {\r\n canvas.width = videosLength > 1 ? remaining[0].width * 2 : remaining[0].width;\r\n\r\n var height = 1;\r\n if (videosLength === 3 || videosLength === 4) {\r\n height = 2;\r\n }\r\n if (videosLength === 5 || videosLength === 6) {\r\n height = 3;\r\n }\r\n if (videosLength === 7 || videosLength === 8) {\r\n height = 4;\r\n }\r\n if (videosLength === 9 || videosLength === 10) {\r\n height = 5;\r\n }\r\n canvas.height = remaining[0].height * height;\r\n } else {\r\n canvas.width = self.width || 360;\r\n canvas.height = self.height || 240;\r\n }\r\n\r\n if (fullcanvas && fullcanvas instanceof HTMLVideoElement) {\r\n drawImage(fullcanvas);\r\n }\r\n\r\n remaining.forEach(function(video, idx) {\r\n drawImage(video, idx);\r\n });\r\n\r\n setTimeout(drawVideosToCanvas, self.frameInterval);\r\n }\r\n\r\n function drawImage(video, idx) {\r\n if (isStopDrawingFrames) {\r\n return;\r\n }\r\n\r\n var x = 0;\r\n var y = 0;\r\n var width = video.width;\r\n var height = video.height;\r\n\r\n if (idx === 1) {\r\n x = video.width;\r\n }\r\n\r\n if (idx === 2) {\r\n y = video.height;\r\n }\r\n\r\n if (idx === 3) {\r\n x = video.width;\r\n y = video.height;\r\n }\r\n\r\n if (idx === 4) {\r\n y = video.height * 2;\r\n }\r\n\r\n if (idx === 5) {\r\n x = video.width;\r\n y = video.height * 2;\r\n }\r\n\r\n if (idx === 6) {\r\n y = video.height * 3;\r\n }\r\n\r\n if (idx === 7) {\r\n x = video.width;\r\n y = video.height * 3;\r\n }\r\n\r\n if (typeof video.stream.left !== 'undefined') {\r\n x = video.stream.left;\r\n }\r\n\r\n if (typeof video.stream.top !== 'undefined') {\r\n y = video.stream.top;\r\n }\r\n\r\n if (typeof video.stream.width !== 'undefined') {\r\n width = video.stream.width;\r\n }\r\n\r\n if (typeof video.stream.height !== 'undefined') {\r\n height = video.stream.height;\r\n }\r\n\r\n context.drawImage(video, x, y, width, height);\r\n\r\n if (typeof video.stream.onRender === 'function') {\r\n video.stream.onRender(context, x, y, width, height, idx);\r\n }\r\n }\r\n\r\n function getMixedStream() {\r\n isStopDrawingFrames = false;\r\n var mixedVideoStream = getMixedVideoStream();\r\n\r\n var mixedAudioStream = getMixedAudioStream();\r\n if (mixedAudioStream) {\r\n mixedAudioStream.getTracks().filter(function(t) {\r\n return t.kind === 'audio';\r\n }).forEach(function(track) {\r\n mixedVideoStream.addTrack(track);\r\n });\r\n }\r\n\r\n var fullcanvas;\r\n arrayOfMediaStreams.forEach(function(stream) {\r\n if (stream.fullcanvas) {\r\n fullcanvas = true;\r\n }\r\n });\r\n\r\n // mixedVideoStream.prototype.appendStreams = appendStreams;\r\n // mixedVideoStream.prototype.resetVideoStreams = resetVideoStreams;\r\n // mixedVideoStream.prototype.clearRecordedData = clearRecordedData;\r\n\r\n return mixedVideoStream;\r\n }\r\n\r\n function getMixedVideoStream() {\r\n resetVideoStreams();\r\n\r\n var capturedStream;\r\n\r\n if ('captureStream' in canvas) {\r\n capturedStream = canvas.captureStream();\r\n } else if ('mozCaptureStream' in canvas) {\r\n capturedStream = canvas.mozCaptureStream();\r\n } else if (!self.disableLogs) {\r\n console.error('Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features');\r\n }\r\n\r\n var videoStream = new MediaStream();\r\n\r\n capturedStream.getTracks().filter(function(t) {\r\n return t.kind === 'video';\r\n }).forEach(function(track) {\r\n videoStream.addTrack(track);\r\n });\r\n\r\n canvas.stream = videoStream;\r\n\r\n return videoStream;\r\n }\r\n\r\n function getMixedAudioStream() {\r\n // via: @pehrsons\r\n if (!Storage.AudioContextConstructor) {\r\n Storage.AudioContextConstructor = new Storage.AudioContext();\r\n }\r\n\r\n self.audioContext = Storage.AudioContextConstructor;\r\n\r\n self.audioSources = [];\r\n\r\n if (self.useGainNode === true) {\r\n self.gainNode = self.audioContext.createGain();\r\n self.gainNode.connect(self.audioContext.destination);\r\n self.gainNode.gain.value = 0; // don't hear self\r\n }\r\n\r\n var audioTracksLength = 0;\r\n arrayOfMediaStreams.forEach(function(stream) {\r\n if (!stream.getTracks().filter(function(t) {\r\n return t.kind === 'audio';\r\n }).length) {\r\n return;\r\n }\r\n\r\n audioTracksLength++;\r\n\r\n var audioSource = self.audioContext.createMediaStreamSource(stream);\r\n\r\n if (self.useGainNode === true) {\r\n audioSource.connect(self.gainNode);\r\n }\r\n\r\n self.audioSources.push(audioSource);\r\n });\r\n\r\n if (!audioTracksLength) {\r\n // because \"self.audioContext\" is not initialized\r\n // that's why we've to ignore rest of the code\r\n return;\r\n }\r\n\r\n self.audioDestination = self.audioContext.createMediaStreamDestination();\r\n self.audioSources.forEach(function(audioSource) {\r\n audioSource.connect(self.audioDestination);\r\n });\r\n return self.audioDestination.stream;\r\n }\r\n\r\n function getVideo(stream) {\r\n var video = document.createElement('video');\r\n\r\n setSrcObject(stream, video);\r\n\r\n video.className = elementClass;\r\n\r\n video.muted = true;\r\n video.volume = 0;\r\n\r\n video.width = stream.width || self.width || 360;\r\n video.height = stream.height || self.height || 240;\r\n\r\n video.play();\r\n\r\n return video;\r\n }\r\n\r\n this.appendStreams = function(streams) {\r\n if (!streams) {\r\n throw 'First parameter is required.';\r\n }\r\n\r\n if (!(streams instanceof Array)) {\r\n streams = [streams];\r\n }\r\n\r\n streams.forEach(function(stream) {\r\n var newStream = new MediaStream();\r\n\r\n if (stream.getTracks().filter(function(t) {\r\n return t.kind === 'video';\r\n }).length) {\r\n var video = getVideo(stream);\r\n video.stream = stream;\r\n videos.push(video);\r\n\r\n newStream.addTrack(stream.getTracks().filter(function(t) {\r\n return t.kind === 'video';\r\n })[0]);\r\n }\r\n\r\n if (stream.getTracks().filter(function(t) {\r\n return t.kind === 'audio';\r\n }).length) {\r\n var audioSource = self.audioContext.createMediaStreamSource(stream);\r\n self.audioDestination = self.audioContext.createMediaStreamDestination();\r\n audioSource.connect(self.audioDestination);\r\n\r\n newStream.addTrack(self.audioDestination.stream.getTracks().filter(function(t) {\r\n return t.kind === 'audio';\r\n })[0]);\r\n }\r\n\r\n arrayOfMediaStreams.push(newStream);\r\n });\r\n };\r\n\r\n this.releaseStreams = function() {\r\n videos = [];\r\n isStopDrawingFrames = true;\r\n\r\n if (self.gainNode) {\r\n self.gainNode.disconnect();\r\n self.gainNode = null;\r\n }\r\n\r\n if (self.audioSources.length) {\r\n self.audioSources.forEach(function(source) {\r\n source.disconnect();\r\n });\r\n self.audioSources = [];\r\n }\r\n\r\n if (self.audioDestination) {\r\n self.audioDestination.disconnect();\r\n self.audioDestination = null;\r\n }\r\n\r\n if (self.audioContext) {\r\n self.audioContext.close();\r\n }\r\n\r\n self.audioContext = null;\r\n\r\n context.clearRect(0, 0, canvas.width, canvas.height);\r\n\r\n if (canvas.stream) {\r\n canvas.stream.stop();\r\n canvas.stream = null;\r\n }\r\n };\r\n\r\n this.resetVideoStreams = function(streams) {\r\n if (streams && !(streams instanceof Array)) {\r\n streams = [streams];\r\n }\r\n\r\n resetVideoStreams(streams);\r\n };\r\n\r\n function resetVideoStreams(streams) {\r\n videos = [];\r\n streams = streams || arrayOfMediaStreams;\r\n\r\n // via: @adrian-ber\r\n streams.forEach(function(stream) {\r\n if (!stream.getTracks().filter(function(t) {\r\n return t.kind === 'video';\r\n }).length) {\r\n return;\r\n }\r\n\r\n var video = getVideo(stream);\r\n video.stream = stream;\r\n videos.push(video);\r\n });\r\n }\r\n\r\n // for debugging\r\n this.name = 'MultiStreamsMixer';\r\n this.toString = function() {\r\n return this.name;\r\n };\r\n\r\n this.getMixedStream = getMixedStream;\r\n\r\n}\r\n\r\nif (typeof RecordRTC === 'undefined') {\r\n if (typeof module !== 'undefined' /* && !!module.exports*/ ) {\r\n module.exports = MultiStreamsMixer;\r\n }\r\n\r\n if (typeof define === 'function' && define.amd) {\r\n define('MultiStreamsMixer', [], function() {\r\n return MultiStreamsMixer;\r\n });\r\n }\r\n}\n\r\n// ______________________\r\n// MultiStreamRecorder.js\r\n\r\n/*\r\n * Video conference recording, using captureStream API along with WebAudio and Canvas2D API.\r\n */\r\n\r\n/**\r\n * MultiStreamRecorder can record multiple videos in single container.\r\n * @summary Multi-videos recorder.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef MultiStreamRecorder\r\n * @class\r\n * @example\r\n * var options = {\r\n * mimeType: 'video/webm'\r\n * }\r\n * var recorder = new MultiStreamRecorder(ArrayOfMediaStreams, options);\r\n * recorder.record();\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n *\r\n * // or\r\n * var blob = recorder.blob;\r\n * });\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStreams} mediaStreams - Array of MediaStreams.\r\n * @param {object} config - {disableLogs:true, frameInterval: 1, mimeType: \"video/webm\"}\r\n */\r\n\r\nfunction MultiStreamRecorder(arrayOfMediaStreams, options) {\r\n arrayOfMediaStreams = arrayOfMediaStreams || [];\r\n var self = this;\r\n\r\n var mixer;\r\n var mediaRecorder;\r\n\r\n options = options || {\r\n elementClass: 'multi-streams-mixer',\r\n mimeType: 'video/webm',\r\n video: {\r\n width: 360,\r\n height: 240\r\n }\r\n };\r\n\r\n if (!options.frameInterval) {\r\n options.frameInterval = 10;\r\n }\r\n\r\n if (!options.video) {\r\n options.video = {};\r\n }\r\n\r\n if (!options.video.width) {\r\n options.video.width = 360;\r\n }\r\n\r\n if (!options.video.height) {\r\n options.video.height = 240;\r\n }\r\n\r\n /**\r\n * This method records all MediaStreams.\r\n * @method\r\n * @memberof MultiStreamRecorder\r\n * @example\r\n * recorder.record();\r\n */\r\n this.record = function() {\r\n // github/muaz-khan/MultiStreamsMixer\r\n mixer = new MultiStreamsMixer(arrayOfMediaStreams, options.elementClass || 'multi-streams-mixer');\r\n\r\n if (getAllVideoTracks().length) {\r\n mixer.frameInterval = options.frameInterval || 10;\r\n mixer.width = options.video.width || 360;\r\n mixer.height = options.video.height || 240;\r\n mixer.startDrawingFrames();\r\n }\r\n\r\n if (options.previewStream && typeof options.previewStream === 'function') {\r\n options.previewStream(mixer.getMixedStream());\r\n }\r\n\r\n // record using MediaRecorder API\r\n mediaRecorder = new MediaStreamRecorder(mixer.getMixedStream(), options);\r\n mediaRecorder.record();\r\n };\r\n\r\n function getAllVideoTracks() {\r\n var tracks = [];\r\n arrayOfMediaStreams.forEach(function(stream) {\r\n getTracks(stream, 'video').forEach(function(track) {\r\n tracks.push(track);\r\n });\r\n });\r\n return tracks;\r\n }\r\n\r\n /**\r\n * This method stops recording MediaStream.\r\n * @param {function} callback - Callback function, that is used to pass recorded blob back to the callee.\r\n * @method\r\n * @memberof MultiStreamRecorder\r\n * @example\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n */\r\n this.stop = function(callback) {\r\n if (!mediaRecorder) {\r\n return;\r\n }\r\n\r\n mediaRecorder.stop(function(blob) {\r\n self.blob = blob;\r\n\r\n callback(blob);\r\n\r\n self.clearRecordedData();\r\n });\r\n };\r\n\r\n /**\r\n * This method pauses the recording process.\r\n * @method\r\n * @memberof MultiStreamRecorder\r\n * @example\r\n * recorder.pause();\r\n */\r\n this.pause = function() {\r\n if (mediaRecorder) {\r\n mediaRecorder.pause();\r\n }\r\n };\r\n\r\n /**\r\n * This method resumes the recording process.\r\n * @method\r\n * @memberof MultiStreamRecorder\r\n * @example\r\n * recorder.resume();\r\n */\r\n this.resume = function() {\r\n if (mediaRecorder) {\r\n mediaRecorder.resume();\r\n }\r\n };\r\n\r\n /**\r\n * This method resets currently recorded data.\r\n * @method\r\n * @memberof MultiStreamRecorder\r\n * @example\r\n * recorder.clearRecordedData();\r\n */\r\n this.clearRecordedData = function() {\r\n if (mediaRecorder) {\r\n mediaRecorder.clearRecordedData();\r\n mediaRecorder = null;\r\n }\r\n\r\n if (mixer) {\r\n mixer.releaseStreams();\r\n mixer = null;\r\n }\r\n };\r\n\r\n /**\r\n * Add extra media-streams to existing recordings.\r\n * @method\r\n * @memberof MultiStreamRecorder\r\n * @param {MediaStreams} mediaStreams - Array of MediaStreams\r\n * @example\r\n * recorder.addStreams([newAudioStream, newVideoStream]);\r\n */\r\n this.addStreams = function(streams) {\r\n if (!streams) {\r\n throw 'First parameter is required.';\r\n }\r\n\r\n if (!(streams instanceof Array)) {\r\n streams = [streams];\r\n }\r\n\r\n arrayOfMediaStreams.concat(streams);\r\n\r\n if (!mediaRecorder || !mixer) {\r\n return;\r\n }\r\n\r\n mixer.appendStreams(streams);\r\n\r\n if (options.previewStream && typeof options.previewStream === 'function') {\r\n options.previewStream(mixer.getMixedStream());\r\n }\r\n };\r\n\r\n /**\r\n * Reset videos during live recording. Replace old videos e.g. replace cameras with full-screen.\r\n * @method\r\n * @memberof MultiStreamRecorder\r\n * @param {MediaStreams} mediaStreams - Array of MediaStreams\r\n * @example\r\n * recorder.resetVideoStreams([newVideo1, newVideo2]);\r\n */\r\n this.resetVideoStreams = function(streams) {\r\n if (!mixer) {\r\n return;\r\n }\r\n\r\n if (streams && !(streams instanceof Array)) {\r\n streams = [streams];\r\n }\r\n\r\n mixer.resetVideoStreams(streams);\r\n };\r\n\r\n /**\r\n * Returns MultiStreamsMixer\r\n * @method\r\n * @memberof MultiStreamRecorder\r\n * @example\r\n * let mixer = recorder.getMixer();\r\n * mixer.appendStreams([newStream]);\r\n */\r\n this.getMixer = function() {\r\n return mixer;\r\n };\r\n\r\n // for debugging\r\n this.name = 'MultiStreamRecorder';\r\n this.toString = function() {\r\n return this.name;\r\n };\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.MultiStreamRecorder = MultiStreamRecorder;\r\n}\n\r\n// _____________________\r\n// RecordRTC.promises.js\r\n\r\n/**\r\n * RecordRTCPromisesHandler adds promises support in {@link RecordRTC}. Try a {@link https://github.com/muaz-khan/RecordRTC/blob/master/simple-demos/RecordRTCPromisesHandler.html|demo here}\r\n * @summary Promises for {@link RecordRTC}\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef RecordRTCPromisesHandler\r\n * @class\r\n * @example\r\n * var recorder = new RecordRTCPromisesHandler(mediaStream, options);\r\n * recorder.startRecording()\r\n * .then(successCB)\r\n * .catch(errorCB);\r\n * // Note: You can access all RecordRTC API using \"recorder.recordRTC\" e.g. \r\n * recorder.recordRTC.onStateChanged = function(state) {};\r\n * recorder.recordRTC.setRecordingDuration(5000);\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - Single media-stream object, array of media-streams, html-canvas-element, etc.\r\n * @param {object} config - {type:\"video\", recorderType: MediaStreamRecorder, disableLogs: true, numberOfAudioChannels: 1, bufferSize: 0, sampleRate: 0, video: HTMLVideoElement, etc.}\r\n * @throws Will throw an error if \"new\" keyword is not used to initiate \"RecordRTCPromisesHandler\". Also throws error if first argument \"MediaStream\" is missing.\r\n * @requires {@link RecordRTC}\r\n */\r\n\r\nfunction RecordRTCPromisesHandler(mediaStream, options) {\r\n if (!this) {\r\n throw 'Use \"new RecordRTCPromisesHandler()\"';\r\n }\r\n\r\n if (typeof mediaStream === 'undefined') {\r\n throw 'First argument \"MediaStream\" is required.';\r\n }\r\n\r\n var self = this;\r\n\r\n /**\r\n * @property {Blob} blob - Access/reach the native {@link RecordRTC} object.\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * let internal = recorder.recordRTC.getInternalRecorder();\r\n * alert(internal instanceof MediaStreamRecorder);\r\n * recorder.recordRTC.onStateChanged = function(state) {};\r\n */\r\n self.recordRTC = new RecordRTC(mediaStream, options);\r\n\r\n /**\r\n * This method records MediaStream.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * recorder.startRecording()\r\n * .then(successCB)\r\n * .catch(errorCB);\r\n */\r\n this.startRecording = function() {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n self.recordRTC.startRecording();\r\n resolve();\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * This method stops the recording.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * recorder.stopRecording().then(function() {\r\n * var blob = recorder.getBlob();\r\n * }).catch(errorCB);\r\n */\r\n this.stopRecording = function() {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n self.recordRTC.stopRecording(function(url) {\r\n self.blob = self.recordRTC.getBlob();\r\n\r\n if (!self.blob || !self.blob.size) {\r\n reject('Empty blob.', self.blob);\r\n return;\r\n }\r\n\r\n resolve(url);\r\n });\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * This method pauses the recording. You can resume recording using \"resumeRecording\" method.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * recorder.pauseRecording()\r\n * .then(successCB)\r\n * .catch(errorCB);\r\n */\r\n this.pauseRecording = function() {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n self.recordRTC.pauseRecording();\r\n resolve();\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * This method resumes the recording.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * recorder.resumeRecording()\r\n * .then(successCB)\r\n * .catch(errorCB);\r\n */\r\n this.resumeRecording = function() {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n self.recordRTC.resumeRecording();\r\n resolve();\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * This method returns data-url for the recorded blob.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * recorder.stopRecording().then(function() {\r\n * recorder.getDataURL().then(function(dataURL) {\r\n * window.open(dataURL);\r\n * }).catch(errorCB);;\r\n * }).catch(errorCB);\r\n */\r\n this.getDataURL = function(callback) {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n self.recordRTC.getDataURL(function(dataURL) {\r\n resolve(dataURL);\r\n });\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * This method returns the recorded blob.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * recorder.stopRecording().then(function() {\r\n * recorder.getBlob().then(function(blob) {})\r\n * }).catch(errorCB);\r\n */\r\n this.getBlob = function() {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n resolve(self.recordRTC.getBlob());\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * This method returns the internal recording object.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * let internalRecorder = await recorder.getInternalRecorder();\r\n * if(internalRecorder instanceof MultiStreamRecorder) {\r\n * internalRecorder.addStreams([newAudioStream]);\r\n * internalRecorder.resetVideoStreams([screenStream]);\r\n * }\r\n * @returns {Object} \r\n */\r\n this.getInternalRecorder = function() {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n resolve(self.recordRTC.getInternalRecorder());\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * This method resets the recorder. So that you can reuse single recorder instance many times.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * await recorder.reset();\r\n * recorder.startRecording(); // record again\r\n */\r\n this.reset = function() {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n resolve(self.recordRTC.reset());\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * Destroy RecordRTC instance. Clear all recorders and objects.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * recorder.destroy().then(successCB).catch(errorCB);\r\n */\r\n this.destroy = function() {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n resolve(self.recordRTC.destroy());\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * Get recorder's readonly state.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * let state = await recorder.getState();\r\n * // or\r\n * recorder.getState().then(state => { console.log(state); })\r\n * @returns {String} Returns recording state.\r\n */\r\n this.getState = function() {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n resolve(self.recordRTC.getState());\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * @property {Blob} blob - Recorded data as \"Blob\" object.\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * await recorder.stopRecording();\r\n * let blob = recorder.getBlob(); // or \"recorder.recordRTC.blob\"\r\n * invokeSaveAsDialog(blob);\r\n */\r\n this.blob = null;\r\n\r\n /**\r\n * RecordRTC version number\r\n * @property {String} version - Release version number.\r\n * @memberof RecordRTCPromisesHandler\r\n * @static\r\n * @readonly\r\n * @example\r\n * alert(recorder.version);\r\n */\r\n this.version = '5.6.2';\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.RecordRTCPromisesHandler = RecordRTCPromisesHandler;\r\n}\n\r\n// ______________________\r\n// WebAssemblyRecorder.js\r\n\r\n/**\r\n * WebAssemblyRecorder lets you create webm videos in JavaScript via WebAssembly. The library consumes raw RGBA32 buffers (4 bytes per pixel) and turns them into a webm video with the given framerate and quality. This makes it compatible out-of-the-box with ImageData from a CANVAS. With realtime mode you can also use webm-wasm for streaming webm videos.\r\n * @summary Video recording feature in Chrome, Firefox and maybe Edge.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef WebAssemblyRecorder\r\n * @class\r\n * @example\r\n * var recorder = new WebAssemblyRecorder(mediaStream);\r\n * recorder.record();\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.\r\n * @param {object} config - {webAssemblyPath:'webm-wasm.wasm',workerPath: 'webm-worker.js', frameRate: 30, width: 1920, height: 1080, bitrate: 1024, realtime: true}\r\n */\r\nfunction WebAssemblyRecorder(stream, config) {\r\n // based on: github.com/GoogleChromeLabs/webm-wasm\r\n\r\n if (typeof ReadableStream === 'undefined' || typeof WritableStream === 'undefined') {\r\n // because it fixes readable/writable streams issues\r\n console.error('Following polyfill is strongly recommended: https://unpkg.com/@mattiasbuelens/web-streams-polyfill/dist/polyfill.min.js');\r\n }\r\n\r\n config = config || {};\r\n\r\n config.width = config.width || 640;\r\n config.height = config.height || 480;\r\n config.frameRate = config.frameRate || 30;\r\n config.bitrate = config.bitrate || 1200;\r\n config.realtime = config.realtime || true;\r\n\r\n function createBufferURL(buffer, type) {\r\n return URL.createObjectURL(new Blob([buffer], {\r\n type: type || ''\r\n }));\r\n }\r\n\r\n var finished;\r\n\r\n function cameraStream() {\r\n return new ReadableStream({\r\n start: function(controller) {\r\n var cvs = document.createElement('canvas');\r\n var video = document.createElement('video');\r\n var first = true;\r\n video.srcObject = stream;\r\n video.muted = true;\r\n video.height = config.height;\r\n video.width = config.width;\r\n video.volume = 0;\r\n video.onplaying = function() {\r\n cvs.width = config.width;\r\n cvs.height = config.height;\r\n var ctx = cvs.getContext('2d');\r\n var frameTimeout = 1000 / config.frameRate;\r\n var cameraTimer = setInterval(function f() {\r\n if (finished) {\r\n clearInterval(cameraTimer);\r\n controller.close();\r\n }\r\n\r\n if (first) {\r\n first = false;\r\n if (config.onVideoProcessStarted) {\r\n config.onVideoProcessStarted();\r\n }\r\n }\r\n\r\n ctx.drawImage(video, 0, 0);\r\n if (controller._controlledReadableStream.state !== 'closed') {\r\n try {\r\n controller.enqueue(\r\n ctx.getImageData(0, 0, config.width, config.height)\r\n );\r\n } catch (e) {}\r\n }\r\n }, frameTimeout);\r\n };\r\n video.play();\r\n }\r\n });\r\n }\r\n\r\n var worker;\r\n\r\n function startRecording(stream, buffer) {\r\n if (!config.workerPath && !buffer) {\r\n finished = false;\r\n\r\n // is it safe to use @latest ?\r\n\r\n fetch(\r\n 'https://unpkg.com/webm-wasm@latest/dist/webm-worker.js'\r\n ).then(function(r) {\r\n r.arrayBuffer().then(function(buffer) {\r\n startRecording(stream, buffer);\r\n });\r\n });\r\n return;\r\n }\r\n\r\n if (!config.workerPath && buffer instanceof ArrayBuffer) {\r\n var blob = new Blob([buffer], {\r\n type: 'text/javascript'\r\n });\r\n config.workerPath = URL.createObjectURL(blob);\r\n }\r\n\r\n if (!config.workerPath) {\r\n console.error('workerPath parameter is missing.');\r\n }\r\n\r\n worker = new Worker(config.workerPath);\r\n\r\n worker.postMessage(config.webAssemblyPath || 'https://unpkg.com/webm-wasm@latest/dist/webm-wasm.wasm');\r\n worker.addEventListener('message', function(event) {\r\n if (event.data === 'READY') {\r\n worker.postMessage({\r\n width: config.width,\r\n height: config.height,\r\n bitrate: config.bitrate || 1200,\r\n timebaseDen: config.frameRate || 30,\r\n realtime: config.realtime\r\n });\r\n\r\n cameraStream().pipeTo(new WritableStream({\r\n write: function(image) {\r\n if (finished) {\r\n console.error('Got image, but recorder is finished!');\r\n return;\r\n }\r\n\r\n worker.postMessage(image.data.buffer, [image.data.buffer]);\r\n }\r\n }));\r\n } else if (!!event.data) {\r\n if (!isPaused) {\r\n arrayOfBuffers.push(event.data);\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * This method records video.\r\n * @method\r\n * @memberof WebAssemblyRecorder\r\n * @example\r\n * recorder.record();\r\n */\r\n this.record = function() {\r\n arrayOfBuffers = [];\r\n isPaused = false;\r\n this.blob = null;\r\n startRecording(stream);\r\n\r\n if (typeof config.initCallback === 'function') {\r\n config.initCallback();\r\n }\r\n };\r\n\r\n var isPaused;\r\n\r\n /**\r\n * This method pauses the recording process.\r\n * @method\r\n * @memberof WebAssemblyRecorder\r\n * @example\r\n * recorder.pause();\r\n */\r\n this.pause = function() {\r\n isPaused = true;\r\n };\r\n\r\n /**\r\n * This method resumes the recording process.\r\n * @method\r\n * @memberof WebAssemblyRecorder\r\n * @example\r\n * recorder.resume();\r\n */\r\n this.resume = function() {\r\n isPaused = false;\r\n };\r\n\r\n function terminate(callback) {\r\n if (!worker) {\r\n if (callback) {\r\n callback();\r\n }\r\n\r\n return;\r\n }\r\n\r\n // Wait for null event data to indicate that the encoding is complete\r\n worker.addEventListener('message', function(event) {\r\n if (event.data === null) {\r\n worker.terminate();\r\n worker = null;\r\n\r\n if (callback) {\r\n callback();\r\n }\r\n }\r\n });\r\n\r\n worker.postMessage(null);\r\n }\r\n\r\n var arrayOfBuffers = [];\r\n\r\n /**\r\n * This method stops recording video.\r\n * @param {function} callback - Callback function, that is used to pass recorded blob back to the callee.\r\n * @method\r\n * @memberof WebAssemblyRecorder\r\n * @example\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n */\r\n this.stop = function(callback) {\r\n finished = true;\r\n\r\n var recorder = this;\r\n\r\n terminate(function() {\r\n recorder.blob = new Blob(arrayOfBuffers, {\r\n type: 'video/webm'\r\n });\r\n\r\n callback(recorder.blob);\r\n });\r\n };\r\n\r\n // for debugging\r\n this.name = 'WebAssemblyRecorder';\r\n this.toString = function() {\r\n return this.name;\r\n };\r\n\r\n /**\r\n * This method resets currently recorded data.\r\n * @method\r\n * @memberof WebAssemblyRecorder\r\n * @example\r\n * recorder.clearRecordedData();\r\n */\r\n this.clearRecordedData = function() {\r\n arrayOfBuffers = [];\r\n isPaused = false;\r\n this.blob = null;\r\n\r\n // todo: if recording-ON then STOP it first\r\n };\r\n\r\n /**\r\n * @property {Blob} blob - The recorded blob object.\r\n * @memberof WebAssemblyRecorder\r\n * @example\r\n * recorder.stop(function(){\r\n * var blob = recorder.blob;\r\n * });\r\n */\r\n this.blob = null;\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.WebAssemblyRecorder = WebAssemblyRecorder;\r\n}\n","import {downloadRecord, now} from \"../utils\";\nimport saveAs from \"../utils/file-save\";\nimport RecordRTC from 'recordrtc';\nimport {EVENTS, FILE_SUFFIX} from \"../constant\";\nimport Emitter from \"../utils/emitter\";\n\nexport default class RecordRTCLoader extends Emitter {\n constructor(player) {\n super();\n this.player = player;\n this.fileName = '';\n this.fileType = player._opt.recordType || FILE_SUFFIX.webm;\n this.isRecording = false;\n this.recordingTimestamp = 0;\n this.recordingInterval = null;\n player.debug.log('Recorder', 'init');\n }\n\n destroy() {\n this._reset();\n this.player.debug.log('Recorder', 'destroy');\n }\n\n setFileName(fileName, fileType) {\n this.fileName = fileName;\n\n if (FILE_SUFFIX.mp4 === fileType || FILE_SUFFIX.webm === fileType) {\n this.fileType = fileType;\n }\n }\n\n get recording() {\n return this.isRecording;\n }\n\n get recordTime() {\n return this.recordingTimestamp;\n }\n\n startRecord() {\n const debug = this.player.debug;\n const options = {\n type: 'video',\n mimeType: 'video/webm;codecs=h264',\n onTimeStamp: (timestamp) => {\n debug.log('Recorder', 'record timestamp :' + timestamp);\n },\n disableLogs: !this.player._opt.debug\n }\n\n try {\n const stream = this.player.video.$videoElement.captureStream(25);\n if (this.player.audio && this.player.audio.mediaStreamAudioDestinationNode &&\n this.player.audio.mediaStreamAudioDestinationNode.stream &&\n !this.player.audio.isStateSuspended() &&\n this.player.audio.hasAudio && this.player._opt.hasAudio) {\n const audioStream = this.player.audio.mediaStreamAudioDestinationNode.stream;\n if (audioStream.getAudioTracks().length > 0) {\n const audioTrack = audioStream.getAudioTracks()[0];\n if (audioTrack && audioTrack.enabled) {\n stream.addTrack(audioTrack);\n }\n }\n }\n this.recorder = RecordRTC(stream, options);\n } catch (e) {\n debug.error('Recorder', 'startRecord error', e);\n this.emit(EVENTS.recordCreateError);\n }\n if (this.recorder) {\n this.isRecording = true;\n this.player.emit(EVENTS.recording, true);\n this.recorder.startRecording();\n debug.log('Recorder', 'start recording');\n this.player.emit(EVENTS.recordStart);\n this.recordingInterval = window.setInterval(() => {\n this.recordingTimestamp += 1;\n this.player.emit(EVENTS.recordingTimestamp, this.recordingTimestamp);\n }, 1000);\n }\n }\n\n stopRecordAndSave() {\n if (!this.recorder || !this.isRecording) {\n return;\n }\n this.recorder.stopRecording(() => {\n this.player.debug.log('Recorder', 'stop recording');\n this.player.emit(EVENTS.recordEnd)\n const fileName = (this.fileName || now()) + '.' + (this.fileType || FILE_SUFFIX.webm)\n saveAs(this.recorder.getBlob(), fileName)\n this._reset();\n this.player.emit(EVENTS.recording, false);\n })\n }\n\n _reset() {\n this.isRecording = false;\n this.recordingTimestamp = 0;\n\n if (this.recorder) {\n this.recorder.destroy();\n this.recorder = null;\n }\n this.fileName = null;\n if (this.recordingInterval) {\n clearInterval(this.recordingInterval);\n }\n this.recordingInterval = null;\n }\n\n\n}\n","import RecordRTCLoader from \"./recordRTCLoader\";\n\nexport default class Recorder {\n constructor(player) {\n const Loader = Recorder.getLoaderFactory();\n return new Loader(player);\n }\n\n static getLoaderFactory() {\n return RecordRTCLoader;\n }\n}\n","import {EVENTS, EVENTS_ERROR, MEDIA_TYPE, WASM_ERROR, WORKER_CMD_TYPE, WORKER_SEND_TYPE} from \"../constant\";\nimport {isWebglRenderSupport, now} from \"../utils\";\n\nexport default class DecoderWorker {\n constructor(player) {\n this.player = player;\n this.decoderWorker = new Worker(player._opt.decoder)\n this._initDecoderWorker();\n player.debug.log('decoderWorker', 'init')\n }\n\n async destroy() {\n this.decoderWorker.postMessage({cmd: WORKER_SEND_TYPE.close})\n this.decoderWorker.terminate();\n this.decoderWorker = null;\n this.player.debug.log(`decoderWorker`, 'destroy');\n }\n\n _initDecoderWorker() {\n const {\n debug,\n events: {proxy},\n } = this.player;\n\n this.decoderWorker.onmessage = (event) => {\n const msg = event.data;\n switch (msg.cmd) {\n case WORKER_CMD_TYPE.init:\n debug.log(`decoderWorker`, 'onmessage:', WORKER_CMD_TYPE.init);\n if (!this.player.loaded) {\n this.player.emit(EVENTS.load);\n }\n this.player.emit(EVENTS.decoderWorkerInit);\n this._initWork();\n break;\n case WORKER_CMD_TYPE.videoCode:\n debug.log(`decoderWorker`, 'onmessage:', WORKER_CMD_TYPE.videoCode, msg.code);\n if (!this.player._times.decodeStart) {\n this.player._times.decodeStart = now();\n }\n this.player.video.updateVideoInfo({\n encTypeCode: msg.code\n })\n break;\n case WORKER_CMD_TYPE.audioCode:\n debug.log(`decoderWorker`, 'onmessage:', WORKER_CMD_TYPE.audioCode, msg.code);\n this.player.audio && this.player.audio.updateAudioInfo({\n encTypeCode: msg.code\n })\n break;\n case WORKER_CMD_TYPE.initVideo:\n debug.log(`decoderWorker`, 'onmessage:', WORKER_CMD_TYPE.initVideo, `width:${msg.w},height:${msg.h}`);\n this.player.video.updateVideoInfo({\n width: msg.w,\n height: msg.h\n })\n if (!this.player._opt.openWebglAlignment && !isWebglRenderSupport(msg.w)) {\n this.player.emit(EVENTS_ERROR.webglAlignmentError);\n return;\n }\n\n this.player.video.initCanvasViewSize();\n break;\n case WORKER_CMD_TYPE.initAudio:\n debug.log(`decoderWorker`, 'onmessage:', WORKER_CMD_TYPE.initAudio, `channels:${msg.channels},sampleRate:${msg.sampleRate}`);\n if (this.player.audio) {\n this.player.audio.updateAudioInfo(msg);\n this.player.audio.initScriptNode(msg);\n }\n break;\n case WORKER_CMD_TYPE.render:\n // debug.log(`decoderWorker`, 'onmessage:', WORKER_CMD_TYPE.render, `msg ts:${msg.ts}`);\n this.player.handleRender();\n this.player.video.render(msg);\n this.player.emit(EVENTS.timeUpdate, msg.ts)\n this.player.updateStats({fps: true, ts: msg.ts, buf: msg.delay})\n if (!this.player._times.videoStart) {\n this.player._times.videoStart = now();\n this.player.handlePlayToRenderTimes();\n }\n break;\n case WORKER_CMD_TYPE.playAudio:\n // debug.log(`decoderWorker`, 'onmessage:', WORKER_CMD_TYPE.playAudio, `msg ts:${msg.ts}`);\n // 只有在 playing 的时候。\n if (this.player.playing && this.player.audio) {\n this.player.audio.play(msg.buffer, msg.ts);\n }\n break;\n case WORKER_CMD_TYPE.wasmError:\n if (msg.message) {\n if (msg.message.indexOf(WASM_ERROR.invalidNalUnitSize) !== -1) {\n this.player.emitError(EVENTS_ERROR.wasmDecodeError);\n }\n }\n break;\n default:\n this.player[msg.cmd] && this.player[msg.cmd](msg);\n }\n }\n }\n\n _initWork() {\n const opt = {\n debug: this.player._opt.debug,\n useOffscreen: this.player._opt.useOffscreen,\n useWCS: this.player._opt.useWCS,\n videoBuffer: this.player._opt.videoBuffer,\n videoBufferDelay: this.player._opt.videoBufferDelay,\n openWebglAlignment: this.player._opt.openWebglAlignment\n }\n this.decoderWorker.postMessage({\n cmd: WORKER_SEND_TYPE.init,\n opt: JSON.stringify(opt),\n sampleRate: (this.player.audio && this.player.audio.audioContext.sampleRate) || 0\n })\n }\n\n decodeVideo(arrayBuffer, ts, isIFrame) {\n\n const options = {\n type: MEDIA_TYPE.video,\n ts: Math.max(ts, 0),\n isIFrame\n }\n // this.player.debug.log('decoderWorker', 'decodeVideo', options);\n this.decoderWorker.postMessage({\n cmd: WORKER_SEND_TYPE.decode,\n buffer: arrayBuffer,\n options\n }, [arrayBuffer.buffer])\n }\n\n decodeAudio(arrayBuffer, ts) {\n if (this.player._opt.useWCS) {\n this._decodeAudioNoDelay(arrayBuffer, ts);\n } else if (this.player._opt.useMSE) {\n this._decodeAudioNoDelay(arrayBuffer, ts);\n } else {\n this._decodeAudio(arrayBuffer, ts);\n }\n }\n\n //\n _decodeAudio(arrayBuffer, ts) {\n const options = {\n type: MEDIA_TYPE.audio,\n ts: Math.max(ts, 0)\n }\n // this.player.debug.log('decoderWorker', 'decodeAudio',options);\n this.decoderWorker.postMessage({\n cmd: WORKER_SEND_TYPE.decode,\n buffer: arrayBuffer,\n options\n }, [arrayBuffer.buffer])\n }\n\n\n _decodeAudioNoDelay(arrayBuffer, ts) {\n // console.log('_decodeAudioNoDelay', arrayBuffer);\n this.decoderWorker.postMessage({\n cmd: WORKER_SEND_TYPE.audioDecode,\n buffer: arrayBuffer,\n ts: Math.max(ts, 0)\n }, [arrayBuffer.buffer])\n }\n\n\n updateWorkConfig(config) {\n this.decoderWorker.postMessage({\n cmd: WORKER_SEND_TYPE.updateConfig,\n key: config.key,\n value: config.value\n })\n }\n\n}\n","import Emitter from \"../utils/emitter\";\nimport {FRAME_HEADER_EX, FRAME_TYPE_EX, MEDIA_TYPE, PACKET_TYPE_EX} from \"../constant\";\nimport {hevcEncoderNalePacketNotLength} from \"../utils\";\n\nexport default class CommonLoader extends Emitter {\n constructor(player) {\n super();\n this.player = player;\n\n this.stopId = null;\n this.firstTimestamp = null;\n this.startTimestamp = null;\n this.delay = -1;\n this.bufferList = [];\n this.dropping = false;\n this.initInterval();\n }\n\n destroy() {\n if (this.stopId) {\n clearInterval(this.stopId);\n this.stopId = null;\n }\n this.firstTimestamp = null;\n this.startTimestamp = null;\n this.delay = -1;\n this.bufferList = [];\n this.dropping = false;\n this.off();\n this.player.debug.log('CommonDemux', 'destroy');\n }\n\n getDelay(timestamp) {\n if (!timestamp) {\n return -1\n }\n if (!this.firstTimestamp) {\n this.firstTimestamp = timestamp\n this.startTimestamp = Date.now()\n this.delay = -1;\n } else {\n if (timestamp) {\n const localTimestamp = (Date.now() - this.startTimestamp);\n const timeTimestamp = (timestamp - this.firstTimestamp);\n if (localTimestamp >= timeTimestamp) {\n this.delay = localTimestamp - timeTimestamp;\n } else {\n this.delay = timeTimestamp - localTimestamp;\n }\n }\n }\n return this.delay\n }\n\n resetDelay() {\n this.firstTimestamp = null;\n this.startTimestamp = null;\n this.delay = -1;\n this.dropping = false;\n }\n\n //\n initInterval() {\n this.player.debug.log('common dumex', `init Interval`);\n let _loop = () => {\n let data;\n const videoBuffer = this.player._opt.videoBuffer;\n const videoBufferDelay = this.player._opt.videoBufferDelay;\n\n if (this.player._opt.useMSE &&\n this.player.mseDecoder &&\n this.player.mseDecoder.getSourceBufferUpdating()) {\n this.player.debug.warn('CommonDemux', `_loop getSourceBufferUpdating is true and bufferList length is ${this.bufferList.length}`);\n return;\n }\n\n if (this.bufferList.length) {\n if (this.dropping) {\n // this.player.debug.log('common dumex', `is dropping`);\n data = this.bufferList.shift();\n if (data.type === MEDIA_TYPE.audio && data.payload[1] === 0) {\n this._doDecoderDecode(data);\n }\n while (!data.isIFrame && this.bufferList.length) {\n data = this.bufferList.shift();\n if (data.type === MEDIA_TYPE.audio && data.payload[1] === 0) {\n this._doDecoderDecode(data);\n }\n }\n // i frame\n if (data.isIFrame && this.getDelay(data.ts) <= Math.min(videoBuffer, 200)) {\n this.dropping = false;\n this._doDecoderDecode(data);\n }\n } else {\n data = this.bufferList[0];\n if (this.getDelay(data.ts) === -1) {\n // this.player.debug.log('common dumex', `delay is -1`);\n this.bufferList.shift()\n this._doDecoderDecode(data);\n } else if (this.delay > (videoBuffer + videoBufferDelay)) {\n // this.player.debug.log('common dumex', `delay is ${this.delay}, set dropping is true`);\n this.resetDelay();\n this.dropping = true\n } else {\n data = this.bufferList[0]\n if (this.getDelay(data.ts) > videoBuffer) {\n // drop frame\n this.bufferList.shift()\n this._doDecoderDecode(data);\n } else {\n // this.player.debug.log('common dumex', `delay is ${this.delay}`);\n }\n }\n }\n }\n }\n _loop();\n this.stopId = setInterval(_loop, 10)\n }\n\n _doDecode(payload, type, ts, isIFrame, cts) {\n const player = this.player;\n let options = {\n ts: ts,\n cts: cts,\n type: type,\n isIFrame: false\n }\n // use offscreen\n if (player._opt.useWCS && !player._opt.useOffscreen) {\n if (type === MEDIA_TYPE.video) {\n options.isIFrame = isIFrame;\n }\n this.pushBuffer(payload, options)\n } else if (player._opt.useMSE) {\n // use mse\n if (type === MEDIA_TYPE.video) {\n options.isIFrame = isIFrame;\n }\n this.pushBuffer(payload, options)\n } else {\n //\n if (type === MEDIA_TYPE.video) {\n player.decoderWorker && player.decoderWorker.decodeVideo(payload, ts, isIFrame);\n } else if (type === MEDIA_TYPE.audio) {\n if (player._opt.hasAudio) {\n player.decoderWorker && player.decoderWorker.decodeAudio(payload, ts);\n }\n }\n }\n }\n\n _doDecoderDecode(data) {\n const player = this.player;\n const {webcodecsDecoder, mseDecoder} = player;\n\n if (data.type === MEDIA_TYPE.audio) {\n if (player._opt.hasAudio) {\n player.decoderWorker && player.decoderWorker.decodeAudio(data.payload, data.ts)\n }\n } else if (data.type === MEDIA_TYPE.video) {\n if (player._opt.useWCS && !player._opt.useOffscreen) {\n webcodecsDecoder.decodeVideo(data.payload, data.ts, data.isIFrame);\n } else if (player._opt.useMSE) {\n mseDecoder.decodeVideo(data.payload, data.ts, data.isIFrame, data.cts);\n }\n }\n }\n\n pushBuffer(payload, options) {\n // 音频\n if (options.type === MEDIA_TYPE.audio) {\n this.bufferList.push({\n ts: options.ts,\n payload: payload,\n type: MEDIA_TYPE.audio,\n })\n } else if (options.type === MEDIA_TYPE.video) {\n this.bufferList.push({\n ts: options.ts,\n cts: options.cts,\n payload: payload,\n type: MEDIA_TYPE.video,\n isIFrame: options.isIFrame\n })\n }\n }\n\n close() {\n\n }\n\n _decodeEnhancedH265Video(payload, ts) {\n const flags = payload[0];\n const frameTypeEx = flags & 0x30;\n const packetEx = flags & 0x0F;\n const codecId = payload.slice(1, 5);\n const tmp = new ArrayBuffer(4);\n const tmp32 = new Uint32Array(tmp);\n const isAV1 = String.fromCharCode(codecId[0]) == 'a';\n if (packetEx === PACKET_TYPE_EX.PACKET_TYPE_SEQ_START) {\n if (frameTypeEx === FRAME_TYPE_EX.FT_KEY) {\n // header video info\n const extraData = payload.slice(5);\n if (!isAV1) {\n const payloadBuffer = new Uint8Array(5 + extraData.length);\n payloadBuffer.set([0x1c, 0x00, 0x00, 0x00, 0x00], 0);\n payloadBuffer.set(extraData, 5);\n this._doDecode(payloadBuffer, MEDIA_TYPE.video, 0, true, 0);\n }\n }\n } else if (packetEx === PACKET_TYPE_EX.PACKET_TYPE_FRAMES) {\n let payloadBuffer = payload;\n let cts = 0;\n const isIFrame = frameTypeEx === FRAME_TYPE_EX.FT_KEY;\n\n if (!isAV1) {\n // h265\n tmp32[0] = payload[4]\n tmp32[1] = payload[3]\n tmp32[2] = payload[2]\n tmp32[3] = 0\n cts = tmp32[0];\n const data = payload.slice(8);\n payloadBuffer = hevcEncoderNalePacketNotLength(data, isIFrame);\n this._doDecode(payloadBuffer, MEDIA_TYPE.video, ts, isIFrame, cts);\n }\n\n } else if (packetEx === PACKET_TYPE_EX.PACKET_TYPE_FRAMESX) {\n const isIFrame = frameTypeEx === FRAME_TYPE_EX.FT_KEY;\n const data = payload.slice(5);\n let payloadBuffer = hevcEncoderNalePacketNotLength(data, isIFrame);\n this._doDecode(payloadBuffer, MEDIA_TYPE.video, ts, isIFrame, 0);\n }\n }\n\n\n _isEnhancedH265Header(flags) {\n return (flags & FRAME_HEADER_EX) === FRAME_HEADER_EX;\n }\n}\n","import {FLV_MEDIA_TYPE, MEDIA_TYPE} from \"../constant\";\nimport CommonLoader from \"./commonLoader\";\nimport {now} from \"../utils\";\n\nexport default class FlvLoader extends CommonLoader {\n constructor(player) {\n super(player);\n this.input = this._inputFlv();\n this.flvDemux = this.dispatchFlvData(this.input);\n player.debug.log('FlvDemux', 'init')\n }\n\n destroy() {\n super.destroy();\n this.input = null;\n this.flvDemux = null;\n this.player.debug.log('FlvDemux', 'destroy')\n }\n\n dispatch(data) {\n this.flvDemux(data);\n }\n\n * _inputFlv() {\n yield 9;\n const tmp = new ArrayBuffer(4)\n const tmp8 = new Uint8Array(tmp)\n const tmp32 = new Uint32Array(tmp)\n const player = this.player;\n\n while (true) {\n tmp8[3] = 0\n const t = yield 15\n const type = t[4]\n tmp8[0] = t[7]\n tmp8[1] = t[6]\n tmp8[2] = t[5]\n const length = tmp32[0]\n tmp8[0] = t[10]\n tmp8[1] = t[9]\n tmp8[2] = t[8]\n let ts = tmp32[0]\n if (ts === 0xFFFFFF) {\n tmp8[3] = t[11]\n ts = tmp32[0]\n }\n const payload = yield length\n switch (type) {\n case FLV_MEDIA_TYPE.audio:\n if (player._opt.hasAudio) {\n player.updateStats({\n abps: payload.byteLength\n })\n if (payload.byteLength > 0) {\n this._doDecode(payload, MEDIA_TYPE.audio, ts)\n }\n }\n break\n case FLV_MEDIA_TYPE.video:\n if (!player._times.demuxStart) {\n player._times.demuxStart = now();\n }\n if (player._opt.hasVideo) {\n player.updateStats({\n vbps: payload.byteLength\n })\n const flags = payload[0];\n if (this._isEnhancedH265Header(flags)) {\n this._decodeEnhancedH265Video(payload, ts);\n } else {\n const isIFrame = payload[0] >> 4 === 1;\n if (payload.byteLength > 0) {\n tmp32[0] = payload[4]\n tmp32[1] = payload[3]\n tmp32[2] = payload[2]\n tmp32[3] = 0\n let cts = tmp32[0]\n this._doDecode(payload, MEDIA_TYPE.video, ts, isIFrame, cts);\n }\n }\n }\n break\n }\n }\n }\n\n dispatchFlvData(input) {\n let need = input.next()\n let buffer = null\n return (value) => {\n let data = new Uint8Array(value)\n if (buffer) {\n let combine = new Uint8Array(buffer.length + data.length)\n combine.set(buffer)\n combine.set(data, buffer.length)\n data = combine\n buffer = null\n }\n while (data.length >= need.value) {\n let remain = data.slice(need.value)\n need = input.next(data.slice(0, need.value))\n data = remain\n }\n if (data.length > 0) {\n buffer = data\n }\n }\n }\n\n close() {\n this.input && this.input.return(null)\n }\n\n\n}\n","import {FLV_MEDIA_TYPE, MEDIA_TYPE} from \"../constant\";\nimport CommonLoader from \"./commonLoader\";\nimport {now} from \"../utils\";\n\nexport default class M7sLoader extends CommonLoader {\n constructor(player) {\n super(player);\n player.debug.log('M7sDemux', 'init')\n }\n\n destroy() {\n super.destroy();\n this.player.debug.log('M7sDemux', 'destroy')\n this.player = null;\n }\n\n dispatch(data) {\n const player = this.player;\n const dv = new DataView(data)\n const type = dv.getUint8(0);\n const ts = dv.getUint32(1, false);\n const tmp = new ArrayBuffer(4);\n const tmp32 = new Uint32Array(tmp);\n switch (type) {\n case MEDIA_TYPE.audio:\n if (player._opt.hasAudio) {\n const payload = new Uint8Array(data, 5)\n player.updateStats({\n abps: payload.byteLength\n })\n if (payload.byteLength > 0) {\n this._doDecode(payload, type, ts)\n }\n }\n break;\n case MEDIA_TYPE.video:\n if (player._opt.hasVideo) {\n if (!player._times.demuxStart) {\n player._times.demuxStart = now();\n }\n if (dv.byteLength > 5) {\n const payload = new Uint8Array(data, 5);\n\n const flags = payload[0];\n if (this._isEnhancedH265Header(flags)) {\n this._decodeEnhancedH265Video(payload, ts);\n } else {\n const isIframe = dv.getUint8(5) >> 4 === 1;\n player.updateStats({\n vbps: payload.byteLength\n })\n\n tmp32[0] = payload[4]\n tmp32[1] = payload[3]\n tmp32[2] = payload[2]\n tmp32[3] = 0\n let cts = tmp32[0]\n this._doDecode(payload, type, ts, isIframe, cts);\n }\n } else {\n this.player.debug.warn('M7sDemux', 'dispatch', 'dv byteLength is', dv.byteLength)\n }\n }\n break;\n }\n }\n\n\n}\n","import FlvLoader from \"./flvLoader\";\nimport M7sLoader from \"./m7sLoader\";\nimport {DEMUX_TYPE} from \"../constant\";\n\nexport default class Demux {\n constructor(player) {\n const Loader = Demux.getLoaderFactory(player._opt.demuxType);\n return new Loader(player);\n }\n\n static getLoaderFactory(type) {\n if (type === DEMUX_TYPE.m7s) {\n return M7sLoader;\n } else if (type === DEMUX_TYPE.flv) {\n return FlvLoader;\n }\n }\n}\n","/*\n * Copyright (C) 2016 Bilibili. All Rights Reserved.\n *\n * @author zheng qian \n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n// Exponential-Golomb buffer decoder\nclass ExpGolomb {\n\n constructor(uint8array) {\n this.TAG = 'ExpGolomb';\n\n this._buffer = uint8array;\n this._buffer_index = 0;\n this._total_bytes = uint8array.byteLength;\n this._total_bits = uint8array.byteLength * 8;\n this._current_word = 0;\n this._current_word_bits_left = 0;\n }\n\n destroy() {\n this._buffer = null;\n }\n\n _fillCurrentWord() {\n let buffer_bytes_left = this._total_bytes - this._buffer_index;\n if (buffer_bytes_left <= 0) {\n // throw new IllegalStateException('ExpGolomb: _fillCurrentWord() but no bytes available');\n }\n\n let bytes_read = Math.min(4, buffer_bytes_left);\n let word = new Uint8Array(4);\n word.set(this._buffer.subarray(this._buffer_index, this._buffer_index + bytes_read));\n this._current_word = new DataView(word.buffer).getUint32(0, false);\n\n this._buffer_index += bytes_read;\n this._current_word_bits_left = bytes_read * 8;\n }\n\n readBits(bits) {\n if (bits > 32) {\n // throw new InvalidArgumentException('ExpGolomb: readBits() bits exceeded max 32bits!');\n }\n\n if (bits <= this._current_word_bits_left) {\n let result = this._current_word >>> (32 - bits);\n this._current_word <<= bits;\n this._current_word_bits_left -= bits;\n return result;\n }\n\n let result = this._current_word_bits_left ? this._current_word : 0;\n result = result >>> (32 - this._current_word_bits_left);\n let bits_need_left = bits - this._current_word_bits_left;\n\n this._fillCurrentWord();\n let bits_read_next = Math.min(bits_need_left, this._current_word_bits_left);\n\n let result2 = this._current_word >>> (32 - bits_read_next);\n this._current_word <<= bits_read_next;\n this._current_word_bits_left -= bits_read_next;\n\n result = (result << bits_read_next) | result2;\n return result;\n }\n\n readBool() {\n return this.readBits(1) === 1;\n }\n\n readByte() {\n return this.readBits(8);\n }\n\n _skipLeadingZero() {\n let zero_count;\n for (zero_count = 0; zero_count < this._current_word_bits_left; zero_count++) {\n if (0 !== (this._current_word & (0x80000000 >>> zero_count))) {\n this._current_word <<= zero_count;\n this._current_word_bits_left -= zero_count;\n return zero_count;\n }\n }\n this._fillCurrentWord();\n return zero_count + this._skipLeadingZero();\n }\n\n readUEG() { // unsigned exponential golomb\n let leading_zeros = this._skipLeadingZero();\n return this.readBits(leading_zeros + 1) - 1;\n }\n\n readSEG() { // signed exponential golomb\n let value = this.readUEG();\n if (value & 0x01) {\n return (value + 1) >>> 1;\n } else {\n return -1 * (value >>> 1);\n }\n }\n\n}\n\nexport default ExpGolomb;\n","/*\n * Copyright (C) 2016 Bilibili. All Rights Reserved.\n *\n * @author zheng qian \n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport ExpGolomb from './exp-golomb.js';\n\nclass SPSParser {\n\n static _ebsp2rbsp(uint8array) {\n let src = uint8array;\n let src_length = src.byteLength;\n let dst = new Uint8Array(src_length);\n let dst_idx = 0;\n\n for (let i = 0; i < src_length; i++) {\n if (i >= 2) {\n // Unescape: Skip 0x03 after 00 00\n if (src[i] === 0x03 && src[i - 1] === 0x00 && src[i - 2] === 0x00) {\n continue;\n }\n }\n dst[dst_idx] = src[i];\n dst_idx++;\n }\n\n return new Uint8Array(dst.buffer, 0, dst_idx);\n }\n\n // 解析 SPS\n // https://zhuanlan.zhihu.com/p/27896239\n static parseSPS(uint8array) {\n let rbsp = SPSParser._ebsp2rbsp(uint8array);\n let gb = new ExpGolomb(rbsp);\n\n gb.readByte();\n // 标识当前H.264码流的profile。\n // 我们知道,H.264中定义了三种常用的档次profile: 基准档次:baseline profile;主要档次:main profile; 扩展档次:extended profile;\n\n let profile_idc = gb.readByte(); // profile_idc\n gb.readByte(); // constraint_set_flags[5] + reserved_zero[3]\n // 标识当前码流的Level。编码的Level定义了某种条件下的最大视频分辨率、最大视频帧率等参数,码流所遵从的level由level_idc指定。\n let level_idc = gb.readByte(); // level_idc\n // 表示当前的序列参数集的id。通过该id值,图像参数集pps可以引用其代表的sps中的参数。\n gb.readUEG(); // seq_parameter_set_id\n\n let profile_string = SPSParser.getProfileString(profile_idc);\n\n let level_string = SPSParser.getLevelString(level_idc);\n\n let chroma_format_idc = 1;\n let chroma_format = 420;\n let chroma_format_table = [0, 420, 422, 444];\n let bit_depth = 8;\n\n //\n if (profile_idc === 100 || profile_idc === 110 || profile_idc === 122 ||\n profile_idc === 244 || profile_idc === 44 || profile_idc === 83 ||\n profile_idc === 86 || profile_idc === 118 || profile_idc === 128 ||\n profile_idc === 138 || profile_idc === 144) {\n //\n chroma_format_idc = gb.readUEG();\n\n if (chroma_format_idc === 3) {\n gb.readBits(1); // separate_colour_plane_flag\n }\n if (chroma_format_idc <= 3) {\n chroma_format = chroma_format_table[chroma_format_idc];\n }\n\n bit_depth = gb.readUEG() + 8; // bit_depth_luma_minus8\n gb.readUEG(); // bit_depth_chroma_minus8\n gb.readBits(1); // qpprime_y_zero_transform_bypass_flag\n if (gb.readBool()) { // seq_scaling_matrix_present_flag\n let scaling_list_count = (chroma_format_idc !== 3) ? 8 : 12;\n for (let i = 0; i < scaling_list_count; i++) {\n if (gb.readBool()) { // seq_scaling_list_present_flag\n if (i < 6) {\n SPSParser._skipScalingList(gb, 16);\n } else {\n SPSParser._skipScalingList(gb, 64);\n }\n }\n }\n }\n }\n // 用于计算MaxFrameNum的值。计算公式为MaxFrameNum = 2^(log2_max_frame_num_minus4 +\n gb.readUEG(); // log2_max_frame_num_minus4\n // 表示解码picture order count(POC)的方法。POC是另一种计量图像序号的方式,与frame_num有着不同的计算方法。该语法元素的取值为0、1或2。\n let pic_order_cnt_type = gb.readUEG();\n if (pic_order_cnt_type === 0) {\n gb.readUEG(); // log2_max_pic_order_cnt_lsb_minus_4\n } else if (pic_order_cnt_type === 1) {\n gb.readBits(1); // delta_pic_order_always_zero_flag\n gb.readSEG(); // offset_for_non_ref_pic\n gb.readSEG(); // offset_for_top_to_bottom_field\n let num_ref_frames_in_pic_order_cnt_cycle = gb.readUEG();\n for (let i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) {\n gb.readSEG(); // offset_for_ref_frame\n }\n }\n // 用于表示参考帧的最大数目。\n let ref_frames = gb.readUEG(); // max_num_ref_frames\n // 标识位,说明frame_num中是否允许不连续的值。\n gb.readBits(1); // gaps_in_frame_num_value_allowed_flag\n // 用于计算图像的宽度。单位为宏块个数,因此图像的实际宽度为:\n let pic_width_in_mbs_minus1 = gb.readUEG();\n // 使用PicHeightInMapUnits来度量视频中一帧图像的高度。\n // PicHeightInMapUnits并非图像明确的以像素或宏块为单位的高度,而需要考虑该宏块是帧编码或场编码。PicHeightInMapUnits的计算方式为:\n let pic_height_in_map_units_minus1 = gb.readUEG();\n // 标识位,说明宏块的编码方式。当该标识位为0时,宏块可能为帧编码或场编码;\n // 该标识位为1时,所有宏块都采用帧编码。根据该标识位取值不同,PicHeightInMapUnits的含义也不同,\n // 为0时表示一场数据按宏块计算的高度,为1时表示一帧数据按宏块计算的高度。\n let frame_mbs_only_flag = gb.readBits(1);\n if (frame_mbs_only_flag === 0) {\n // 标识位,说明是否采用了宏块级的帧场自适应编码。当该标识位为0时,不存在帧编码和场编码之间的切换;当标识位为1时,宏块可能在帧编码和场编码模式之间进行选择。\n gb.readBits(1); // mb_adaptive_frame_field_flag\n }\n // 标识位,用于B_Skip、B_Direct模式运动矢量的推导计算。\n gb.readBits(1); // direct_8x8_inference_flag\n\n let frame_crop_left_offset = 0;\n let frame_crop_right_offset = 0;\n let frame_crop_top_offset = 0;\n let frame_crop_bottom_offset = 0;\n\n let frame_cropping_flag = gb.readBool();\n if (frame_cropping_flag) {\n frame_crop_left_offset = gb.readUEG();\n frame_crop_right_offset = gb.readUEG();\n frame_crop_top_offset = gb.readUEG();\n frame_crop_bottom_offset = gb.readUEG();\n }\n\n let sar_width = 1, sar_height = 1;\n let fps = 0, fps_fixed = true, fps_num = 0, fps_den = 0;\n // 标识位,说明SPS中是否存在VUI信息。\n let vui_parameters_present_flag = gb.readBool();\n if (vui_parameters_present_flag) {\n if (gb.readBool()) { // aspect_ratio_info_present_flag\n let aspect_ratio_idc = gb.readByte();\n let sar_w_table = [1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160, 4, 3, 2];\n let sar_h_table = [1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99, 3, 2, 1];\n\n if (aspect_ratio_idc > 0 && aspect_ratio_idc < 16) {\n sar_width = sar_w_table[aspect_ratio_idc - 1];\n sar_height = sar_h_table[aspect_ratio_idc - 1];\n } else if (aspect_ratio_idc === 255) {\n sar_width = gb.readByte() << 8 | gb.readByte();\n sar_height = gb.readByte() << 8 | gb.readByte();\n }\n }\n\n if (gb.readBool()) { // overscan_info_present_flag\n gb.readBool(); // overscan_appropriate_flag\n }\n if (gb.readBool()) { // video_signal_type_present_flag\n gb.readBits(4); // video_format & video_full_range_flag\n if (gb.readBool()) { // colour_description_present_flag\n gb.readBits(24); // colour_primaries & transfer_characteristics & matrix_coefficients\n }\n }\n if (gb.readBool()) { // chroma_loc_info_present_flag\n gb.readUEG(); // chroma_sample_loc_type_top_field\n gb.readUEG(); // chroma_sample_loc_type_bottom_field\n }\n if (gb.readBool()) { // timing_info_present_flag\n let num_units_in_tick = gb.readBits(32);\n let time_scale = gb.readBits(32);\n fps_fixed = gb.readBool(); // fixed_frame_rate_flag\n\n fps_num = time_scale;\n fps_den = num_units_in_tick * 2;\n fps = fps_num / fps_den;\n }\n }\n\n let sarScale = 1;\n if (sar_width !== 1 || sar_height !== 1) {\n sarScale = sar_width / sar_height;\n }\n\n let crop_unit_x = 0, crop_unit_y = 0;\n if (chroma_format_idc === 0) {\n crop_unit_x = 1;\n crop_unit_y = 2 - frame_mbs_only_flag;\n } else {\n let sub_wc = (chroma_format_idc === 3) ? 1 : 2;\n let sub_hc = (chroma_format_idc === 1) ? 2 : 1;\n crop_unit_x = sub_wc;\n crop_unit_y = sub_hc * (2 - frame_mbs_only_flag);\n }\n\n let codec_width = (pic_width_in_mbs_minus1 + 1) * 16;\n let codec_height = (2 - frame_mbs_only_flag) * ((pic_height_in_map_units_minus1 + 1) * 16);\n\n codec_width -= (frame_crop_left_offset + frame_crop_right_offset) * crop_unit_x;\n codec_height -= (frame_crop_top_offset + frame_crop_bottom_offset) * crop_unit_y;\n\n let present_width = Math.ceil(codec_width * sarScale);\n\n gb.destroy();\n gb = null;\n\n\n // 解析出来的SPS 内容。\n return {\n profile_string: profile_string, // baseline, high, high10, ...\n level_string: level_string, // 3, 3.1, 4, 4.1, 5, 5.1, ...\n bit_depth: bit_depth, // 8bit, 10bit, ...\n ref_frames: ref_frames,\n chroma_format: chroma_format, // 4:2:0, 4:2:2, ...\n chroma_format_string: SPSParser.getChromaFormatString(chroma_format),\n\n frame_rate: {\n fixed: fps_fixed,\n fps: fps,\n fps_den: fps_den,\n fps_num: fps_num\n },\n\n sar_ratio: {\n width: sar_width,\n height: sar_height\n },\n\n codec_size: {\n width: codec_width,\n height: codec_height\n },\n\n present_size: {\n width: present_width,\n height: codec_height\n }\n };\n }\n\n static _skipScalingList(gb, count) {\n let last_scale = 8, next_scale = 8;\n let delta_scale = 0;\n for (let i = 0; i < count; i++) {\n if (next_scale !== 0) {\n delta_scale = gb.readSEG();\n next_scale = (last_scale + delta_scale + 256) % 256;\n }\n last_scale = (next_scale === 0) ? last_scale : next_scale;\n }\n }\n\n // profile_idc = 66 → baseline profile;\n // profile_idc = 77 → main profile;\n // profile_idc = 88 → extended profile;\n // 在新版的标准中,还包括了High、High 10、High 4:2:2、High 4:4:4、High 10 Intra、High\n // 4:2:2 Intra、High 4:4:4 Intra、CAVLC 4:4:4 Intra\n static getProfileString(profile_idc) {\n switch (profile_idc) {\n case 66:\n return 'Baseline';\n case 77:\n return 'Main';\n case 88:\n return 'Extended';\n case 100:\n return 'High';\n case 110:\n return 'High10';\n case 122:\n return 'High422';\n case 244:\n return 'High444';\n default:\n return 'Unknown';\n }\n }\n\n static getLevelString(level_idc) {\n return (level_idc / 10).toFixed(1);\n }\n\n static getChromaFormatString(chroma) {\n switch (chroma) {\n case 420:\n return '4:2:0';\n case 422:\n return '4:2:2';\n case 444:\n return '4:4:4';\n default:\n return 'Unknown';\n }\n }\n\n}\n\nexport default SPSParser;","import SPSParser from './h264-sps-parser.js';\n\n//\nexport function parseAVCDecoderConfigurationRecord(arrayBuffer) {\n const meta = {}\n const v = new DataView(arrayBuffer.buffer);\n let version = v.getUint8(0); // configurationVersion\n let avcProfile = v.getUint8(1); // avcProfileIndication\n let profileCompatibility = v.getUint8(2); // profile_compatibil\n let avcLevel = v.getUint8(3); // AVCLevelIndication\n\n if (version !== 1 || avcProfile === 0) {\n // this._onError(DemuxErrors.FORMAT_ERROR, 'Flv: Invalid AVCDecoderConfigurationRecord');\n\n return meta;\n }\n\n const _naluLengthSize = (v.getUint8(4) & 3) + 1; // lengthSizeMinusOne\n\n if (_naluLengthSize !== 3 && _naluLengthSize !== 4) { // holy shit!!!\n // this._onError(DemuxErrors.FORMAT_ERROR, `Flv: Strange NaluLengthSizeMinusOne: ${_naluLengthSize - 1}`);\n return meta;\n }\n let spsCount = v.getUint8(5) & 31; // numOfSequenceParameterSets\n\n if (spsCount === 0) {\n // this._onError(DemuxErrors.FORMAT_ERROR, 'Flv: Invalid AVCDecoderConfigurationRecord: No SPS');\n return;\n } else if (spsCount > 1) {\n // Log.w(this.TAG, `Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ${spsCount}`);\n }\n\n let offset = 6;\n for (let i = 0; i < spsCount; i++) {\n let len = v.getUint16(offset, false); // sequenceParameterSetLength\n offset += 2;\n\n if (len === 0) {\n continue;\n }\n\n // Notice: Nalu without startcode header (00 00 00 01)\n let sps = new Uint8Array(arrayBuffer.buffer, offset, len);\n offset += len;\n // flv.js作者选择了自己来解析这个数据结构,也是迫不得已,因为JS环境下没有ffmpeg,解析这个结构主要是为了提取 sps和pps。虽然理论上sps允许有多个,但其实一般就一个。\n // packetTtype 为 1 表示 NALU,NALU= network abstract layer unit,这是H.264的概念,网络抽象层数据单元,其实简单理解就是一帧视频数据。\n // pps的信息没什么用,所以作者只实现了sps的分析器,说明作者下了很大功夫去学习264的标准,其中的Golomb解码还是挺复杂的,能解对不容易,我在PC和手机平台都是用ffmpeg去解析的。\n // SPS里面包括了视频分辨率,帧率,profile level等视频重要信息。\n let config = SPSParser.parseSPS(sps);\n if (i !== 0) {\n // ignore other sps's config\n continue;\n }\n\n meta.codecWidth = config.codec_size.width;\n meta.codecHeight = config.codec_size.height;\n meta.presentWidth = config.present_size.width;\n meta.presentHeight = config.present_size.height;\n\n meta.profile = config.profile_string;\n meta.level = config.level_string;\n meta.bitDepth = config.bit_depth;\n meta.chromaFormat = config.chroma_format;\n meta.sarRatio = config.sar_ratio;\n meta.frameRate = config.frame_rate;\n\n if (config.frame_rate.fixed === false ||\n config.frame_rate.fps_num === 0 ||\n config.frame_rate.fps_den === 0) {\n meta.frameRate = {};\n }\n\n let fps_den = meta.frameRate.fps_den;\n let fps_num = meta.frameRate.fps_num;\n\n meta.refSampleDuration = meta.timescale * (fps_den / fps_num);\n\n let codecArray = sps.subarray(1, 4);\n\n let codecString = 'avc1.';\n for (let j = 0; j < 3; j++) {\n let h = codecArray[j].toString(16);\n if (h.length < 2) {\n h = '0' + h;\n }\n codecString += h;\n }\n // codec\n meta.codec = codecString;\n }\n\n let ppsCount = v.getUint8(offset); // numOfPictureParameterSets\n if (ppsCount === 0) {\n // this._onError(DemuxErrors.FORMAT_ERROR, 'Flv: Invalid AVCDecoderConfigurationRecord: No PPS');\n return meta;\n } else if (ppsCount > 1) {\n // Log.w(this.TAG, `Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ${ppsCount}`);\n }\n\n offset++;\n for (let i = 0; i < ppsCount; i++) {\n let len = v.getUint16(offset, false); // pictureParameterSetLength\n offset += 2;\n\n if (len === 0) {\n continue;\n }\n let pps = new Uint8Array(arrayBuffer.buffer, offset, len);\n\n // pps is useless for extracting video information\n offset += len;\n }\n\n meta.videoType = 'avc';\n\n // meta.avcc = arrayBuffer;\n return meta;\n}\n","import {formatVideoDecoderConfigure, noop, now} from \"../utils\";\nimport Emitter from \"../utils/emitter\";\nimport {ENCODED_VIDEO_TYPE, EVENTS, EVENTS_ERROR, VIDEO_ENC_CODE, WCS_ERROR} from \"../constant\";\nimport {parseAVCDecoderConfigurationRecord} from \"../utils/h264\";\n\n\nexport default class WebcodecsDecoder extends Emitter {\n constructor(player) {\n super();\n this.player = player;\n this.hasInit = false;\n this.isDecodeFirstIIframe = false;\n this.isInitInfo = false;\n this.decoder = null;\n this.initDecoder();\n player.debug.log('Webcodecs', 'init')\n }\n\n destroy() {\n if (this.decoder) {\n if (this.decoder.state !== 'closed') {\n this.decoder.close();\n }\n this.decoder = null;\n }\n\n this.hasInit = false;\n this.isInitInfo = false;\n this.isDecodeFirstIIframe = false;\n this.off();\n this.player.debug.log('Webcodecs', 'destroy')\n }\n\n initDecoder() {\n const _this = this;\n this.decoder = new VideoDecoder({\n output(videoFrame) {\n _this.handleDecode(videoFrame)\n },\n error(error) {\n _this.handleError(error)\n }\n })\n }\n\n handleDecode(videoFrame) {\n if (!this.isInitInfo) {\n this.player.video.updateVideoInfo({\n width: videoFrame.codedWidth,\n height: videoFrame.codedHeight\n })\n this.player.video.initCanvasViewSize();\n this.isInitInfo = true;\n }\n\n if (!this.player._times.videoStart) {\n this.player._times.videoStart = now();\n this.player.handlePlayToRenderTimes();\n }\n\n this.player.handleRender();\n this.player.video.render({\n videoFrame\n })\n\n this.player.updateStats({fps: true, ts: 0, buf: this.player.demux.delay})\n }\n\n handleError(error) {\n this.player.debug.error('Webcodecs', 'VideoDecoder handleError', error)\n }\n\n decodeVideo(payload, ts, isIframe) {\n // this.player.debug.log('Webcodecs decoder', 'decodeVideo', ts, isIframe);\n if (!this.hasInit) {\n if (isIframe && payload[1] === 0) {\n const videoCodec = (payload[0] & 0x0F);\n this.player.video.updateVideoInfo({\n encTypeCode: videoCodec\n })\n\n // 如果解码出来的是\n if (videoCodec === VIDEO_ENC_CODE.h265) {\n this.emit(EVENTS_ERROR.webcodecsH265NotSupport)\n return;\n }\n if (!this.player._times.decodeStart) {\n this.player._times.decodeStart = now();\n }\n\n const config = formatVideoDecoderConfigure(payload.slice(5));\n this.player.debug.log('Webcodecs', 'VideoDecoder configure', config)\n try {\n this.decoder.configure(config);\n }\n catch (e){\n this.player.debug.error('Webcodecs', 'VideoDecoder configure', e);\n this.player.emit(EVENTS_ERROR.webcodecsConfigureError);\n return;\n }\n this.hasInit = true;\n }\n } else {\n\n // check width or height change\n if (isIframe && payload[1] === 0) {\n let data = payload.slice(5);\n const config = parseAVCDecoderConfigurationRecord(data)\n const videoInfo = this.player.video.videoInfo;\n if (config.codecWidth !== videoInfo.width || config.codecHeight !== videoInfo.height) {\n this.player.debug.log('Webcodecs', `width or height is update, width ${videoInfo.width}-> ${config.codecWidth}, height ${videoInfo.height}-> ${config.codecHeight}`)\n this.player.emit(EVENTS_ERROR.webcodecsWidthOrHeightChange)\n return;\n }\n }\n\n\n // fix : Uncaught DOMException: Failed to execute 'decode' on 'VideoDecoder': A key frame is required after configure() or flush().\n if (!this.isDecodeFirstIIframe && isIframe) {\n this.isDecodeFirstIIframe = true;\n }\n\n if (this.isDecodeFirstIIframe) {\n const chunk = new EncodedVideoChunk({\n data: payload.slice(5),\n timestamp: ts,\n type: isIframe ? ENCODED_VIDEO_TYPE.key : ENCODED_VIDEO_TYPE.delta\n })\n this.player.emit(EVENTS.timeUpdate, ts);\n try {\n if (this.isDecodeStateClosed()) {\n this.player.debug.warn('Webcodecs', 'VideoDecoder isDecodeStateClosed true');\n return;\n }\n this.decoder.decode(chunk);\n } catch (e) {\n this.player.debug.error('Webcodecs', 'VideoDecoder', e)\n if (e.toString().indexOf(WCS_ERROR.keyframeIsRequiredError) !== -1) {\n this.player.emitError(EVENTS_ERROR.webcodecsDecodeError);\n }\n else if (e.toString().indexOf(WCS_ERROR.canNotDecodeClosedCodec) !== -1) {\n this.player.emitError(EVENTS_ERROR.webcodecsDecodeError);\n }\n }\n } else {\n this.player.debug.warn('Webcodecs', 'VideoDecoder isDecodeFirstIIframe false')\n }\n }\n }\n\n isDecodeStateClosed() {\n return this.decoder.state === 'closed';\n }\n}\n","const iconsMap = {\n play: '播放',\n pause: '暂停',\n audio: '',\n mute: '',\n screenshot: '截图',\n loading: '加载',\n fullscreen: '全屏',\n fullscreenExit: '退出全屏',\n record: '录制',\n recordStop: '停止录制',\n}\n\nexport default Object.keys(iconsMap).reduce((icons, key) => {\n icons[key] = `\n \n ${iconsMap[key] ? `${iconsMap[key]}` : ''}\n`;\n return icons;\n}, {});\n","import icons from './icons';\n\nexport default (player, control) => {\n\n if (player._opt.hasControl && player._opt.controlAutoHide) {\n player.$container.classList.add('jessibuca-controls-show-auto-hide');\n }\n else {\n player.$container.classList.add('jessibuca-controls-show');\n }\n const options = player._opt;\n const operateBtns = options.operateBtns;\n\n\n player.$container.insertAdjacentHTML(\n 'beforeend',\n `\n ${options.background ? `
` : ''}\n
\n ${icons.loading}\n ${options.loadingText ? `
${options.loadingText}
` : ''}\n
\n ${options.hasControl && operateBtns.play ? `
` : ''}\n ${options.hasControl ? `\n
\n
\n
00:00:01
\n
${icons.recordStop}
\n
\n `:''}\n ${options.hasControl ? `\n
\n
\n
\n ${options.showBandwidth ? `
` : ''}\n
\n
\n ${operateBtns.audio ? `\n
\n ${icons.audio}\n ${icons.mute}\n
\n
\n
\n
\n
\n
\n
\n ` : ''}\n ${operateBtns.play ? `
${icons.play}
${icons.pause}
` : ''}\n ${operateBtns.screenshot ? `
${icons.screenshot}
` : ''}\n ${operateBtns.record ? `
${icons.record}
${icons.recordStop}
` : ''}\n ${operateBtns.fullscreen ? `
${icons.fullscreen}
${icons.fullscreenExit}
` : ''}\n
\n
\n
\n ` : ''}\n\n `\n )\n\n Object.defineProperty(control, '$poster', {\n value: player.$container.querySelector('.jessibuca-poster'),\n });\n\n Object.defineProperty(control, '$loading', {\n value: player.$container.querySelector('.jessibuca-loading'),\n });\n\n Object.defineProperty(control, '$play', {\n value: player.$container.querySelector('.jessibuca-play'),\n });\n\n Object.defineProperty(control, '$playBig', {\n value: player.$container.querySelector('.jessibuca-play-big'),\n });\n\n Object.defineProperty(control, '$recording', {\n value: player.$container.querySelector('.jessibuca-recording'),\n });\n Object.defineProperty(control, '$recordingTime', {\n value: player.$container.querySelector('.jessibuca-recording-time'),\n });\n\n Object.defineProperty(control, '$recordingStop', {\n value: player.$container.querySelector('.jessibuca-recording-stop'),\n });\n\n Object.defineProperty(control, '$pause', {\n value: player.$container.querySelector('.jessibuca-pause'),\n });\n\n Object.defineProperty(control, '$controls', {\n value: player.$container.querySelector('.jessibuca-controls'),\n });\n\n Object.defineProperty(control, '$fullscreen', {\n value: player.$container.querySelector('.jessibuca-fullscreen'),\n });\n\n Object.defineProperty(control, '$fullscreen', {\n value: player.$container.querySelector('.jessibuca-fullscreen'),\n });\n\n\n Object.defineProperty(control, '$volume', {\n value: player.$container.querySelector('.jessibuca-volume'),\n });\n\n Object.defineProperty(control, '$volumePanelWrap', {\n value: player.$container.querySelector('.jessibuca-volume-panel-wrap'),\n });\n\n Object.defineProperty(control, '$volumePanelText', {\n value: player.$container.querySelector('.jessibuca-volume-panel-text'),\n });\n\n Object.defineProperty(control, '$volumePanel', {\n value: player.$container.querySelector('.jessibuca-volume-panel'),\n });\n\n Object.defineProperty(control, '$volumeHandle', {\n value: player.$container.querySelector('.jessibuca-volume-panel-handle'),\n });\n\n Object.defineProperty(control, '$volumeOn', {\n value: player.$container.querySelector('.jessibuca-icon-audio'),\n });\n\n Object.defineProperty(control, '$volumeOff', {\n value: player.$container.querySelector('.jessibuca-icon-mute'),\n });\n\n\n Object.defineProperty(control, '$fullscreen', {\n value: player.$container.querySelector('.jessibuca-fullscreen'),\n });\n\n Object.defineProperty(control, '$fullscreenExit', {\n value: player.$container.querySelector('.jessibuca-fullscreen-exit'),\n });\n\n Object.defineProperty(control, '$record', {\n value: player.$container.querySelector('.jessibuca-record'),\n });\n Object.defineProperty(control, '$recordStop', {\n value: player.$container.querySelector('.jessibuca-record-stop'),\n });\n\n Object.defineProperty(control, '$screenshot', {\n value: player.$container.querySelector('.jessibuca-screenshot'),\n });\n\n Object.defineProperty(control, '$speed', {\n value: player.$container.querySelector('.jessibuca-speed'),\n });\n}\n","import {CONTROL_HEIGHT, EVENTS} from \"../constant\";\nimport {bpsSize, formatTimeTips, getStyle, isBoolean, isMobile, setStyle} from \"../utils\";\nimport screenfull from \"screenfull\";\n\nexport default (player, control) => {\n const {\n events: {proxy},\n } = player;\n\n const object = document.createElement('object');\n object.setAttribute('aria-hidden', 'true');\n object.setAttribute('tabindex', -1);\n object.type = 'text/html';\n object.data = 'about:blank';\n\n setStyle(object, {\n display: 'block',\n position: 'absolute',\n top: '0',\n left: '0',\n height: '100%',\n width: '100%',\n overflow: 'hidden',\n pointerEvents: 'none',\n zIndex: '-1',\n });\n\n let playerWidth = player.width;\n let playerHeight = player.height;\n\n proxy(object, 'load', () => {\n proxy(object.contentDocument.defaultView, 'resize', () => {\n if (player.width !== playerWidth || player.height !== playerHeight) {\n playerWidth = player.width;\n playerHeight = player.height;\n player.emit(EVENTS.resize);\n screenfullH5Control();\n }\n });\n });\n player.$container.appendChild(object);\n\n player.on(EVENTS.destroy, () => {\n player.$container.removeChild(object);\n })\n\n function setVolumeHandle(percentage) {\n if (percentage === 0) {\n setStyle(control.$volumeOn, 'display', 'none');\n setStyle(control.$volumeOff, 'display', 'flex');\n setStyle(control.$volumeHandle, 'top', `${48}px`);\n } else {\n if (control.$volumeHandle && control.$volumePanel) {\n const panelHeight = getStyle(control.$volumePanel, 'height') || 60;\n const handleHeight = getStyle(control.$volumeHandle, 'height');\n const top = panelHeight - (panelHeight - handleHeight) * percentage - handleHeight;\n setStyle(control.$volumeHandle, 'top', `${top}px`);\n setStyle(control.$volumeOn, 'display', 'flex');\n setStyle(control.$volumeOff, 'display', 'none');\n }\n }\n control.$volumePanelText && (control.$volumePanelText.innerHTML = parseInt(percentage * 100))\n }\n\n player.on(EVENTS.volumechange, () => {\n setVolumeHandle(player.volume);\n });\n\n player.on(EVENTS.loading, (flag) => {\n setStyle(control.$loading, 'display', flag ? 'flex' : 'none');\n setStyle(control.$poster, 'display', 'none')\n\n if (flag) {\n setStyle(control.$playBig, 'display', 'none');\n }\n })\n\n const screenfullChange = (fullscreen) => {\n let isFullScreen = isBoolean(fullscreen) ? fullscreen : player.fullscreen\n setStyle(control.$fullscreenExit, 'display', isFullScreen ? 'flex' : 'none');\n setStyle(control.$fullscreen, 'display', isFullScreen ? 'none' : 'flex');\n // control.autoSize();\n };\n const screenfullH5Control = () => {\n if (isMobile() && control.$controls && player._opt.useWebFullScreen) {\n setTimeout(() => {\n if (player.fullscreen) {\n // console.log(player.width, player.height);\n let translateX = player.height / 2 - player.width + CONTROL_HEIGHT / 2;\n let translateY = player.height / 2 - CONTROL_HEIGHT / 2;\n\n control.$controls.style.transform = `translateX(${-translateX}px) translateY(-${translateY}px) rotate(-90deg)`\n } else {\n control.$controls.style.transform = `translateX(0) translateY(0) rotate(0)`\n }\n\n }, 10)\n }\n }\n\n try {\n\n screenfull.on('change', screenfullChange);\n player.events.destroys.push(() => {\n screenfull.off('change', screenfullChange);\n });\n } catch (error) {\n //\n }\n\n //\n player.on(EVENTS.webFullscreen, (value) => {\n screenfullChange(value);\n screenfullH5Control();\n\n })\n\n\n player.on(EVENTS.recording, () => {\n setStyle(control.$record, 'display', player.recording ? 'none' : 'flex');\n setStyle(control.$recordStop, 'display', player.recording ? 'flex' : 'none');\n setStyle(control.$recording, 'display', player.recording ? 'flex' : 'none')\n if(!player.recording && control.$recordingTime){\n control.$recordingTime.innerHTML = formatTimeTips(0);\n }\n })\n\n //\n player.on(EVENTS.recordingTimestamp, (timestamp) => {\n // console.log(timestamp);\n control.$recordingTime && (control.$recordingTime.innerHTML = formatTimeTips(timestamp))\n })\n\n player.on(EVENTS.playing, (flag) => {\n setStyle(control.$play, 'display', flag ? 'none' : 'flex');\n setStyle(control.$playBig, 'display', flag ? 'none' : 'block');\n setStyle(control.$pause, 'display', flag ? 'flex' : 'none');\n setStyle(control.$screenshot, 'display', flag ? 'flex' : 'none');\n setStyle(control.$record, 'display', flag ? 'flex' : 'none');\n setStyle(control.$qualityMenu, 'display', flag ? 'flex' : 'none');\n setStyle(control.$volume, 'display', flag ? 'flex' : 'none');\n // setStyle(control.$fullscreen, 'display', flag ? 'flex' : 'none');\n screenfullChange();\n // 不在播放\n if (!flag) {\n control.$speed && (control.$speed.innerHTML = bpsSize(''));\n }\n })\n\n\n player.on(EVENTS.kBps, (rate) => {\n const bps = bpsSize(rate);\n control.$speed && (control.$speed.innerHTML = bps);\n })\n}\n","export default (player, control) => {\n\n Object.defineProperty(control, 'controlsRect', {\n get: () => {\n return control.$controls.getBoundingClientRect();\n },\n });\n\n}\n","import {clamp, isMobile, setStyle} from \"../utils\";\n\nexport default (player, control) => {\n const {\n events: {proxy},\n debug\n } = player;\n\n function volumeChangeFromEvent(event) {\n const {bottom: panelBottom, height: panelHeight} = control.$volumePanel.getBoundingClientRect();\n const {height: handleHeight} = control.$volumeHandle.getBoundingClientRect();\n\n let moveLen = event.y;\n\n // if (isMobile() && player.fullscreen) {\n // moveLen = event.x;\n // }\n\n const percentage =\n clamp(panelBottom - moveLen - handleHeight / 2, 0, panelHeight - handleHeight / 2) / (panelHeight - handleHeight);\n return percentage;\n }\n\n //\n proxy(window, ['click', 'contextmenu'], event => {\n if (event.composedPath().indexOf(player.$container) > -1) {\n control.isFocus = true;\n } else {\n control.isFocus = false;\n }\n });\n\n //\n proxy(window, 'orientationchange', () => {\n setTimeout(() => {\n player.resize();\n }, 300);\n });\n\n\n proxy(control.$controls, 'click', (e) => {\n e.stopPropagation();\n })\n\n proxy(control.$pause, 'click', (e) => {\n player.pause();\n })\n // 监听 play 方法\n proxy(control.$play, 'click', (e) => {\n player.play();\n player.resumeAudioAfterPause()\n })\n\n // 监听 play 方法\n proxy(control.$playBig, 'click', (e) => {\n player.play();\n player.resumeAudioAfterPause()\n })\n\n proxy(control.$volume, 'mouseover', () => {\n control.$volumePanelWrap.classList.add('jessibuca-volume-panel-wrap-show');\n })\n\n proxy(control.$volume, 'mouseout', () => {\n control.$volumePanelWrap.classList.remove('jessibuca-volume-panel-wrap-show');\n })\n\n proxy(control.$volumeOn, 'click', (e) => {\n e.stopPropagation();\n setStyle(control.$volumeOn, 'display', 'none');\n setStyle(control.$volumeOff, 'display', 'block');\n const lastVolume = player.volume;\n player.volume = 0;\n player._lastVolume = lastVolume;\n })\n\n proxy(control.$volumeOff, 'click', (e) => {\n e.stopPropagation();\n setStyle(control.$volumeOn, 'display', 'block');\n setStyle(control.$volumeOff, 'display', 'none');\n player.volume = player.lastVolume || 0.5;\n })\n\n proxy(control.$screenshot, 'click', (e) => {\n e.stopPropagation();\n player.video.screenshot();\n })\n\n proxy(control.$volumePanel, 'click', event => {\n event.stopPropagation();\n player.volume = volumeChangeFromEvent(event);\n });\n\n proxy(control.$volumeHandle, 'mousedown', () => {\n control.isVolumeDroging = true;\n });\n\n proxy(control.$volumeHandle, 'mousemove', event => {\n if (control.isVolumeDroging) {\n player.volume = volumeChangeFromEvent(event);\n }\n });\n\n proxy(document, 'mouseup', () => {\n if (control.isVolumeDroging) {\n control.isVolumeDroging = false;\n }\n });\n\n proxy(control.$record, 'click', (e) => {\n e.stopPropagation();\n player.recording = true;\n })\n\n proxy(control.$recordStop, 'click', (e) => {\n e.stopPropagation();\n player.recording = false;\n })\n\n proxy(control.$recordingStop, 'click', (e) => {\n e.stopPropagation();\n player.recording = false;\n })\n\n proxy(control.$fullscreen, 'click', (e) => {\n e.stopPropagation();\n player.fullscreen = true;\n })\n\n proxy(control.$fullscreenExit, 'click', (e) => {\n e.stopPropagation();\n player.fullscreen = false;\n })\n\n if (player._opt.hasControl && player._opt.controlAutoHide) {\n //\n proxy(player.$container, 'mouseover', () => {\n if (!player.fullscreen) {\n setStyle(control.$controls, 'display', 'block');\n startDelayControlHidden();\n }\n })\n\n proxy(player.$container, 'mousemove', () => {\n if (player.$container && control.$controls) {\n if (!player.fullscreen) {\n if (control.$controls.style.display === 'none') {\n setStyle(control.$controls, 'display', 'block');\n startDelayControlHidden();\n }\n } else {\n if (control.$controls.style.display === 'none') {\n setStyle(control.$controls, 'display', 'block');\n startDelayControlHidden();\n }\n }\n }\n })\n\n proxy(player.$container, 'mouseout', () => {\n stopDelayControlHidden();\n setStyle(control.$controls, 'display', 'none');\n })\n let delayHiddenTimeout = null;\n const startDelayControlHidden = () => {\n stopDelayControlHidden();\n delayHiddenTimeout = setTimeout(() => {\n setStyle(control.$controls, 'display', 'none');\n }, 5 * 1000)\n }\n\n const stopDelayControlHidden = () => {\n if (delayHiddenTimeout) {\n clearTimeout(delayHiddenTimeout);\n delayHiddenTimeout = null;\n }\n }\n }\n}\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","// todo: 待定\nimport {HOT_KEY} from \"../constant\";\n\nexport default (player, control) => {\n const {\n events: {proxy}\n } = player;\n\n const keys = {};\n\n function addHotkey(key, event) {\n if (keys[key]) {\n keys[key].push(event);\n } else {\n keys[key] = [event];\n }\n }\n\n //\n addHotkey(HOT_KEY.esc, () => {\n if (player.fullscreen) {\n player.fullscreen = false;\n }\n })\n\n //\n addHotkey(HOT_KEY.arrowUp, () => {\n player.volume += 0.05;\n })\n\n //\n addHotkey(HOT_KEY.arrowDown, () => {\n player.volume -= 0.05;\n })\n\n proxy(window, 'keydown', event => {\n if (control.isFocus) {\n const tag = document.activeElement.tagName.toUpperCase();\n const editable = document.activeElement.getAttribute('contenteditable');\n if (tag !== 'INPUT' && tag !== 'TEXTAREA' && editable !== '' && editable !== 'true') {\n const events = keys[event.keyCode];\n if (events) {\n event.preventDefault();\n events.forEach(fn => fn());\n }\n }\n }\n });\n}\n","import template from \"./template\";\nimport observer from './observer';\nimport property from './property';\nimport events from './events';\nimport './style.scss'\nimport hotkey from \"./hotkey\";\nimport {getStyle, isBoolean, removeElement, setStyle} from \"../utils\";\n\nexport default class Control {\n constructor(player) {\n this.player = player;\n template(player, this);\n property(player, this);\n observer(player, this);\n events(player, this);\n if (player._opt.hotKey) {\n hotkey(player, this);\n }\n this.player.debug.log('Control', 'init');\n }\n\n destroy() {\n if (this.$poster) {\n const result = removeElement(this.$poster);\n if(!result){\n const $poster = this.player.$container.querySelector('.jessibuca-poster');\n if ($poster && this.player.$container) {\n this.player.$container.removeChild($poster);\n }\n }\n }\n if (this.$loading) {\n const result = removeElement(this.$loading)\n if (!result) {\n const $loading = this.player.$container.querySelector('.jessibuca-loading');\n if ($loading && this.player.$container) {\n this.player.$container.removeChild($loading);\n }\n }\n }\n if (this.$controls) {\n const result = removeElement(this.$controls)\n if (!result) {\n const $controls = this.player.$container.querySelector('.jessibuca-controls');\n if ($controls && this.player.$container) {\n this.player.$container.removeChild($controls);\n }\n }\n }\n\n if (this.$recording) {\n const result = removeElement(this.$recording)\n if (!result) {\n const $recording = this.player.$container.querySelector('.jessibuca-recording');\n if ($recording && this.player.$container) {\n this.player.$container.removeChild($recording);\n }\n }\n }\n\n if (this.$playBig) {\n const result = removeElement(this.$playBig)\n if (!result) {\n const $playBig = this.player.$container.querySelector('.jessibuca-play-big');\n if ($playBig && this.player.$container) {\n this.player.$container.removeChild($playBig);\n }\n }\n }\n\n if(this.player.$container){\n this.player.$container.classList.remove('jessibuca-controls-show-auto-hide');\n this.player.$container.classList.remove('jessibuca-controls-show');\n }\n\n this.player.debug.log('control', 'destroy');\n }\n\n autoSize() {\n const player = this.player;\n player.$container.style.padding = '0 0';\n const playerWidth = player.width;\n const playerHeight = player.height;\n const playerRatio = playerWidth / playerHeight;\n const canvasWidth = player.video.$videoElement.width;\n const canvasHeight = player.video.$videoElement.height;\n const canvasRatio = canvasWidth / canvasHeight;\n if (playerRatio > canvasRatio) {\n const padding = (playerWidth - playerHeight * canvasRatio) / 2;\n player.$container.style.padding = `0 ${padding}px`;\n } else {\n const padding = (playerHeight - playerWidth / canvasRatio) / 2;\n player.$container.style.padding = `${padding}px 0`;\n }\n }\n\n toggleBar(flag) {\n if (this.$controls) {\n if (!isBoolean(flag)) {\n // flag = this.$controls.style.display === 'none';\n flag = getStyle(this.$controls, 'display', false) === 'none';\n }\n\n if (flag) {\n setStyle(this.$controls, 'display', 'flex');\n } else {\n setStyle(this.$controls, 'display', 'none');\n }\n }\n }\n\n getBarIsShow() {\n let result = false;\n if (this.$controls) {\n result = getStyle(this.$controls, 'display', false) !== 'none';\n }\n return result;\n }\n}\n","import {getTarget} from \"../utils\";\n\nexport default (player) => {\n\n const {\n _opt,\n debug,\n events: {proxy},\n } = player;\n\n\n if (_opt.supportDblclickFullscreen) {\n proxy(player.$container, 'dblclick', (e) => {\n const target = getTarget(e);\n const nodeName = target.nodeName.toLowerCase();\n if (nodeName === 'canvas' || nodeName === 'video') {\n player.fullscreen = !player.fullscreen;\n }\n })\n }\n\n\n //\n proxy(document, 'visibilitychange', () => {\n if (_opt.hiddenAutoPause) {\n debug.log('visibilitychange', document.visibilityState, player._isPlayingBeforePageHidden)\n\n if (\"visible\" === document.visibilityState) {\n if (player._isPlayingBeforePageHidden) {\n player.play();\n }\n } else {\n player._isPlayingBeforePageHidden = player.playing;\n // hidden\n if (player.playing) {\n player.pause();\n }\n }\n }\n })\n\n proxy(window, 'fullscreenchange', () => {\n //\n if (player.keepScreenOn !== null && \"visible\" === document.visibilityState) {\n player.enableWakeLock();\n }\n })\n}\n","class MP4 {\n\n static init() {\n MP4.types = {\n avc1: [],\n avcC: [],\n hvc1: [],\n hvcC: [],\n btrt: [],\n dinf: [],\n dref: [],\n esds: [],\n ftyp: [],\n hdlr: [],\n mdat: [],\n mdhd: [],\n mdia: [],\n mfhd: [],\n minf: [],\n moof: [],\n moov: [],\n mp4a: [],\n mvex: [],\n mvhd: [],\n sdtp: [],\n stbl: [],\n stco: [],\n stsc: [],\n stsd: [],\n stsz: [],\n stts: [],\n tfdt: [],\n tfhd: [],\n traf: [],\n trak: [],\n trun: [],\n trex: [],\n tkhd: [],\n vmhd: [],\n smhd: []\n };\n\n for (let name in MP4.types) {\n if (MP4.types.hasOwnProperty(name)) {\n MP4.types[name] = [\n name.charCodeAt(0),\n name.charCodeAt(1),\n name.charCodeAt(2),\n name.charCodeAt(3)\n ];\n }\n }\n\n let constants = MP4.constants = {};\n\n constants.FTYP = new Uint8Array([\n 0x69, 0x73, 0x6F, 0x6D, // major_brand: isom\n 0x0, 0x0, 0x0, 0x1, // minor_version: 0x01\n 0x69, 0x73, 0x6F, 0x6D, // isom\n 0x61, 0x76, 0x63, 0x31 // avc1\n ]);\n\n constants.STSD_PREFIX = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n 0x00, 0x00, 0x00, 0x01 // entry_count\n ]);\n\n constants.STTS = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n 0x00, 0x00, 0x00, 0x00 // entry_count\n ]);\n\n constants.STSC = constants.STCO = constants.STTS;\n\n constants.STSZ = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n 0x00, 0x00, 0x00, 0x00, // sample_size\n 0x00, 0x00, 0x00, 0x00 // sample_count\n ]);\n\n constants.HDLR_VIDEO = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide'\n 0x00, 0x00, 0x00, 0x00, // reserved: 3 * 4 bytes\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x56, 0x69, 0x64, 0x65,\n 0x6F, 0x48, 0x61, 0x6E,\n 0x64, 0x6C, 0x65, 0x72, 0x00 // name: VideoHandler\n ]);\n\n constants.HDLR_AUDIO = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0x73, 0x6F, 0x75, 0x6E, // handler_type: 'soun'\n 0x00, 0x00, 0x00, 0x00, // reserved: 3 * 4 bytes\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x53, 0x6F, 0x75, 0x6E,\n 0x64, 0x48, 0x61, 0x6E,\n 0x64, 0x6C, 0x65, 0x72, 0x00 // name: SoundHandler\n ]);\n\n constants.DREF = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n 0x00, 0x00, 0x00, 0x01, // entry_count\n 0x00, 0x00, 0x00, 0x0C, // entry_size\n 0x75, 0x72, 0x6C, 0x20, // type 'url '\n 0x00, 0x00, 0x00, 0x01 // version(0) + flags\n ]);\n\n // Sound media header\n constants.SMHD = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n 0x00, 0x00, 0x00, 0x00 // balance(2) + reserved(2)\n ]);\n\n // video media header\n constants.VMHD = new Uint8Array([\n 0x00, 0x00, 0x00, 0x01, // version(0) + flags\n 0x00, 0x00, // graphicsmode: 2 bytes\n 0x00, 0x00, 0x00, 0x00, // opcolor: 3 * 2 bytes\n 0x00, 0x00\n ]);\n }\n\n // Generate a box\n static box(type) {\n let size = 8;\n let result = null;\n let datas = Array.prototype.slice.call(arguments, 1);\n let arrayCount = datas.length;\n\n for (let i = 0; i < arrayCount; i++) {\n size += datas[i].byteLength;\n }\n\n result = new Uint8Array(size);\n result[0] = (size >>> 24) & 0xFF; // size\n result[1] = (size >>> 16) & 0xFF;\n result[2] = (size >>> 8) & 0xFF;\n result[3] = (size) & 0xFF;\n\n result.set(type, 4); // type\n\n let offset = 8;\n for (let i = 0; i < arrayCount; i++) { // data body\n result.set(datas[i], offset);\n offset += datas[i].byteLength;\n }\n\n return result;\n }\n\n // emit ftyp & moov\n static generateInitSegment(meta) {\n let ftyp = MP4.box(MP4.types.ftyp, MP4.constants.FTYP);\n let moov = MP4.moov(meta);\n\n let result = new Uint8Array(ftyp.byteLength + moov.byteLength);\n result.set(ftyp, 0);\n result.set(moov, ftyp.byteLength);\n return result;\n }\n\n // Movie metadata box\n static moov(meta) {\n let mvhd = MP4.mvhd(meta.timescale, meta.duration);\n let trak = MP4.trak(meta);\n let mvex = MP4.mvex(meta);\n return MP4.box(MP4.types.moov, mvhd, trak, mvex);\n }\n\n // Movie header box\n static mvhd(timescale, duration) {\n return MP4.box(MP4.types.mvhd, new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n 0x00, 0x00, 0x00, 0x00, // creation_time\n 0x00, 0x00, 0x00, 0x00, // modification_time\n (timescale >>> 24) & 0xFF, // timescale: 4 bytes\n (timescale >>> 16) & 0xFF,\n (timescale >>> 8) & 0xFF,\n (timescale) & 0xFF,\n (duration >>> 24) & 0xFF, // duration: 4 bytes\n (duration >>> 16) & 0xFF,\n (duration >>> 8) & 0xFF,\n (duration) & 0xFF,\n 0x00, 0x01, 0x00, 0x00, // Preferred rate: 1.0\n 0x01, 0x00, 0x00, 0x00, // PreferredVolume(1.0, 2bytes) + reserved(2bytes)\n 0x00, 0x00, 0x00, 0x00, // reserved: 4 + 4 bytes\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x01, 0x00, 0x00, // ----begin composition matrix----\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x40, 0x00, 0x00, 0x00, // ----end composition matrix----\n 0x00, 0x00, 0x00, 0x00, // ----begin pre_defined 6 * 4 bytes----\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, // ----end pre_defined 6 * 4 bytes----\n 0xFF, 0xFF, 0xFF, 0xFF // next_track_ID\n ]));\n }\n\n // Track box\n static trak(meta) {\n return MP4.box(MP4.types.trak, MP4.tkhd(meta), MP4.mdia(meta));\n }\n\n // Track header box\n static tkhd(meta) {\n let trackId = meta.id, duration = meta.duration;\n let width = meta.presentWidth, height = meta.presentHeight;\n\n return MP4.box(MP4.types.tkhd, new Uint8Array([\n 0x00, 0x00, 0x00, 0x07, // version(0) + flags\n 0x00, 0x00, 0x00, 0x00, // creation_time\n 0x00, 0x00, 0x00, 0x00, // modification_time\n (trackId >>> 24) & 0xFF, // track_ID: 4 bytes\n (trackId >>> 16) & 0xFF,\n (trackId >>> 8) & 0xFF,\n (trackId) & 0xFF,\n 0x00, 0x00, 0x00, 0x00, // reserved: 4 bytes\n (duration >>> 24) & 0xFF, // duration: 4 bytes\n (duration >>> 16) & 0xFF,\n (duration >>> 8) & 0xFF,\n (duration) & 0xFF,\n 0x00, 0x00, 0x00, 0x00, // reserved: 2 * 4 bytes\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, // layer(2bytes) + alternate_group(2bytes)\n 0x00, 0x00, 0x00, 0x00, // volume(2bytes) + reserved(2bytes)\n 0x00, 0x01, 0x00, 0x00, // ----begin composition matrix----\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x40, 0x00, 0x00, 0x00, // ----end composition matrix----\n (width >>> 8) & 0xFF, // width and height\n (width) & 0xFF,\n 0x00, 0x00,\n (height >>> 8) & 0xFF,\n (height) & 0xFF,\n 0x00, 0x00\n ]));\n }\n\n static mdia(meta) {\n return MP4.box(MP4.types.mdia, MP4.mdhd(meta), MP4.hdlr(meta), MP4.minf(meta))\n }\n\n // Media header box\n static mdhd(meta) {\n let timescale = meta.timescale;\n let duration = meta.duration;\n return MP4.box(MP4.types.mdhd, new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n 0x00, 0x00, 0x00, 0x00, // creation_time\n 0x00, 0x00, 0x00, 0x00, // modification_time\n (timescale >>> 24) & 0xFF, // timescale: 4 bytes\n (timescale >>> 16) & 0xFF,\n (timescale >>> 8) & 0xFF,\n (timescale) & 0xFF,\n (duration >>> 24) & 0xFF, // duration: 4 bytes\n (duration >>> 16) & 0xFF,\n (duration >>> 8) & 0xFF,\n (duration) & 0xFF,\n 0x55, 0xC4, // language: und (undetermined)\n 0x00, 0x00 // pre_defined = 0\n ]));\n }\n\n // Media handler reference box\n static hdlr(meta) {\n let data = null;\n if (meta.type === 'audio') {\n data = MP4.constants.HDLR_AUDIO;\n } else {\n data = MP4.constants.HDLR_VIDEO;\n }\n return MP4.box(MP4.types.hdlr, data);\n }\n\n // Media infomation box\n static minf(meta) {\n let xmhd = null;\n if (meta.type === 'audio') {\n xmhd = MP4.box(MP4.types.smhd, MP4.constants.SMHD);\n } else {\n xmhd = MP4.box(MP4.types.vmhd, MP4.constants.VMHD);\n }\n return MP4.box(MP4.types.minf, xmhd, MP4.dinf(), MP4.stbl(meta));\n }\n\n // Data infomation box\n static dinf() {\n let result = MP4.box(MP4.types.dinf,\n MP4.box(MP4.types.dref, MP4.constants.DREF)\n );\n return result;\n }\n\n // Sample table box\n static stbl(meta) {\n let result = MP4.box(MP4.types.stbl, // type: stbl\n MP4.stsd(meta), // Sample Description Table\n MP4.box(MP4.types.stts, MP4.constants.STTS), // Time-To-Sample\n MP4.box(MP4.types.stsc, MP4.constants.STSC), // Sample-To-Chunk\n MP4.box(MP4.types.stsz, MP4.constants.STSZ), // Sample size\n MP4.box(MP4.types.stco, MP4.constants.STCO) // Chunk offset\n );\n return result;\n }\n\n // Sample description box\n static stsd(meta) {\n if (meta.type === 'audio') {\n // else: aac -> mp4a\n return MP4.box(MP4.types.stsd, MP4.constants.STSD_PREFIX, MP4.mp4a(meta));\n } else {\n if (meta.videoType === 'avc') {\n //\n return MP4.box(MP4.types.stsd, MP4.constants.STSD_PREFIX, MP4.avc1(meta));\n } else {\n //\n return MP4.box(MP4.types.stsd, MP4.constants.STSD_PREFIX, MP4.hvc1(meta))\n }\n }\n }\n\n static mp4a(meta) {\n let channelCount = meta.channelCount;\n let sampleRate = meta.audioSampleRate;\n\n let data = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // reserved(4)\n 0x00, 0x00, 0x00, 0x01, // reserved(2) + data_reference_index(2)\n 0x00, 0x00, 0x00, 0x00, // reserved: 2 * 4 bytes\n 0x00, 0x00, 0x00, 0x00,\n 0x00, channelCount, // channelCount(2)\n 0x00, 0x10, // sampleSize(2)\n 0x00, 0x00, 0x00, 0x00, // reserved(4)\n (sampleRate >>> 8) & 0xFF, // Audio sample rate\n (sampleRate) & 0xFF,\n 0x00, 0x00\n ]);\n\n return MP4.box(MP4.types.mp4a, data, MP4.esds(meta));\n }\n\n static esds(meta) {\n let config = meta.config || [];\n let configSize = config.length;\n let data = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version 0 + flags\n\n 0x03, // descriptor_type\n 0x17 + configSize, // length3\n 0x00, 0x01, // es_id\n 0x00, // stream_priority\n\n 0x04, // descriptor_type\n 0x0F + configSize, // length\n 0x40, // codec: mpeg4_audio\n 0x15, // stream_type: Audio\n 0x00, 0x00, 0x00, // buffer_size\n 0x00, 0x00, 0x00, 0x00, // maxBitrate\n 0x00, 0x00, 0x00, 0x00, // avgBitrate\n\n 0x05 // descriptor_type\n ].concat([\n configSize\n ]).concat(\n config\n ).concat([\n 0x06, 0x01, 0x02 // GASpecificConfig\n ]));\n return MP4.box(MP4.types.esds, data);\n }\n\n // avc\n static avc1(meta) {\n let avcc = meta.avcc;\n const width = meta.codecWidth;\n const height = meta.codecHeight;\n let data = new Uint8Array([\n 0, 0, 0, 0,\n 0, 0, 0, 1,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n width >>> 8 & 255,\n width & 255,\n height >>> 8 & 255,\n height & 255,\n 0, 72, 0, 0,\n 0, 72, 0, 0,\n 0, 0, 0, 0,\n 0, 1,\n 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0,\n 0, 24,\n 255, 255]\n );\n return MP4.box(MP4.types.avc1, data, MP4.box(MP4.types.avcC, avcc))\n }\n\n // hvc\n static hvc1(meta) {\n let avcc = meta.avcc;\n const width = meta.codecWidth;\n const height = meta.codecHeight;\n let data = new Uint8Array([\n 0, 0, 0, 0,\n 0, 0, 0, 1,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n width >>> 8 & 255,\n width & 255,\n height >>> 8 & 255,\n height & 255,\n 0, 72, 0, 0,\n 0, 72, 0, 0,\n 0, 0, 0, 0,\n 0, 1,\n 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0,\n 0, 24,\n 255, 255\n ]);\n return MP4.box(MP4.types.hvc1, data, MP4.box(MP4.types.hvcC, avcc))\n }\n\n // Movie Extends box\n static mvex(meta) {\n return MP4.box(MP4.types.mvex, MP4.trex(meta))\n }\n\n // Track Extends box\n static trex(meta) {\n let trackId = meta.id;\n let data = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n (trackId >>> 24) & 0xFF, // track_ID\n (trackId >>> 16) & 0xFF,\n (trackId >>> 8) & 0xFF,\n (trackId) & 0xFF,\n 0x00, 0x00, 0x00, 0x01, // default_sample_description_index\n 0x00, 0x00, 0x00, 0x00, // default_sample_duration\n 0x00, 0x00, 0x00, 0x00, // default_sample_size\n 0x00, 0x01, 0x00, 0x01 // default_sample_flags\n ]);\n return MP4.box(MP4.types.trex, data);\n }\n\n // Movie fragment box\n static moof(track, baseMediaDecodeTime) {\n return MP4.box(MP4.types.moof, MP4.mfhd(track.sequenceNumber), MP4.traf(track, baseMediaDecodeTime))\n }\n //\n static mfhd(sequenceNumber) {\n let data = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00,\n (sequenceNumber >>> 24) & 0xFF, // sequence_number: int32\n (sequenceNumber >>> 16) & 0xFF,\n (sequenceNumber >>> 8) & 0xFF,\n (sequenceNumber) & 0xFF\n ]);\n return MP4.box(MP4.types.mfhd, data);\n }\n\n // Track fragment box\n static traf(track, baseMediaDecodeTime) {\n let trackId = track.id;\n\n // Track fragment header box\n let tfhd = MP4.box(MP4.types.tfhd, new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) & flags\n (trackId >>> 24) & 0xFF, // track_ID\n (trackId >>> 16) & 0xFF,\n (trackId >>> 8) & 0xFF,\n (trackId) & 0xFF\n ]));\n // Track Fragment Decode Time\n let tfdt = MP4.box(MP4.types.tfdt, new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) & flags\n (baseMediaDecodeTime >>> 24) & 0xFF, // baseMediaDecodeTime: int32\n (baseMediaDecodeTime >>> 16) & 0xFF,\n (baseMediaDecodeTime >>> 8) & 0xFF,\n (baseMediaDecodeTime) & 0xFF\n ]));\n let sdtp = MP4.sdtp(track);\n let trun = MP4.trun(track, sdtp.byteLength + 16 + 16 + 8 + 16 + 8 + 8);\n\n return MP4.box(MP4.types.traf, tfhd, tfdt, trun, sdtp);\n }\n\n // Sample Dependency Type box\n static sdtp(track) {\n let data = new Uint8Array(4 + 1);\n let flags = track.flags;\n data[4] = flags.isLeading << 6\n | flags.dependsOn << 4\n | flags.isDependedOn << 2\n | flags.hasRedundancy;\n return MP4.box(MP4.types.sdtp, data);\n }\n // trun\n static trun(track, offset) {\n let dataSize = 12 + 16;\n let data = new Uint8Array(dataSize);\n offset += 8 + dataSize;\n\n data.set([\n 0x00, 0x00, 0x0F, 0x01, // version(0) & flags\n 0x00, 0x00, 0x00, 0x01, // sample_count\n (offset >>> 24) & 0xFF, // data_offset\n (offset >>> 16) & 0xFF,\n (offset >>> 8) & 0xFF,\n (offset) & 0xFF\n ], 0);\n\n let duration = track.duration;\n let size = track.size;\n let flags = track.flags;\n let cts = track.cts;\n\n data.set([\n (duration >>> 24) & 0xFF, // sample_duration\n (duration >>> 16) & 0xFF,\n (duration >>> 8) & 0xFF,\n (duration) & 0xFF,\n (size >>> 24) & 0xFF, // sample_size\n (size >>> 16) & 0xFF,\n (size >>> 8) & 0xFF,\n (size) & 0xFF,\n (flags.isLeading << 2) | flags.dependsOn, // sample_flags\n (flags.isDependedOn << 6) | (flags.hasRedundancy << 4) | flags.isNonSync,\n 0x00, 0x00, // sample_degradation_priority\n (cts >>> 24) & 0xFF, // sample_composition_time_offset\n (cts >>> 16) & 0xFF,\n (cts >>> 8) & 0xFF,\n (cts) & 0xFF\n ], 12);\n\n return MP4.box(MP4.types.trun, data);\n }\n // mdat\n static mdat(data) {\n return MP4.box(MP4.types.mdat, data)\n }\n}\n\nMP4.init();\n\nexport default MP4;\n","import Emitter from \"../utils/emitter\";\nimport {EVENTS, EVENTS_ERROR, FRAG_DURATION, MEDIA_SOURCE_STATE, MP4_CODECS, VIDEO_ENC_CODE} from \"../constant\";\nimport MP4 from \"../remux/fmp4-generator\";\nimport {parseAVCDecoderConfigurationRecord,} from \"../utils/h264\";\nimport {now} from \"../utils\";\n\nexport default class MseDecoder extends Emitter {\n constructor(player) {\n super();\n this.player = player;\n this.isAvc = true;\n this.mediaSource = new window.MediaSource();\n this.sourceBuffer = null;\n this.hasInit = false;\n this.isInitInfo = false;\n this.cacheTrack = {};\n this.timeInit = false;\n this.sequenceNumber = 0;\n this.mediaSourceOpen = false;\n this.dropping = false;\n this.firstRenderTime = null;\n this.mediaSourceAppendBufferError = false;\n this.mediaSourceAppendBufferFull = false;\n this.isDecodeFirstIIframe = false;\n this.player.video.$videoElement.src = window.URL.createObjectURL(this.mediaSource);\n const {\n debug,\n events: {proxy},\n } = player;\n\n\n proxy(this.mediaSource, 'sourceopen', () => {\n this.mediaSourceOpen = true;\n this.player.emit(EVENTS.mseSourceOpen)\n })\n\n proxy(this.mediaSource, 'sourceclose', () => {\n this.player.emit(EVENTS.mseSourceClose);\n })\n\n player.debug.log('MediaSource', 'init')\n }\n\n destroy() {\n this.stop();\n this.mediaSource = null;\n this.mediaSourceOpen = false;\n this.sourceBuffer = null;\n this.hasInit = false;\n this.isInitInfo = false;\n this.sequenceNumber = 0;\n this.cacheTrack = null;\n this.timeInit = false;\n this.mediaSourceAppendBufferError = false;\n this.mediaSourceAppendBufferFull = false;\n this.isDecodeFirstIIframe = false;\n this.off();\n this.player.debug.log('MediaSource', 'destroy')\n }\n\n get state() {\n return this.mediaSource && this.mediaSource.readyState\n }\n\n get isStateOpen() {\n return this.state === MEDIA_SOURCE_STATE.open;\n }\n\n get isStateClosed() {\n return this.state === MEDIA_SOURCE_STATE.closed;\n }\n\n get isStateEnded() {\n return this.state === MEDIA_SOURCE_STATE.ended;\n }\n\n get duration() {\n return this.mediaSource && this.mediaSource.duration\n }\n\n set duration(duration) {\n this.mediaSource.duration = duration\n }\n\n decodeVideo(payload, ts, isIframe, cts) {\n const player = this.player;\n\n if (!player) {\n return;\n }\n\n if (!this.hasInit) {\n if (isIframe && payload[1] === 0) {\n const videoCodec = (payload[0] & 0x0F);\n player.video.updateVideoInfo({\n encTypeCode: videoCodec\n })\n\n // 如果解码出来的是\n if (videoCodec === VIDEO_ENC_CODE.h265) {\n this.emit(EVENTS_ERROR.mediaSourceH265NotSupport)\n return;\n }\n if (!player._times.decodeStart) {\n player._times.decodeStart = now();\n }\n\n this._decodeConfigurationRecord(payload, ts, isIframe, videoCodec)\n this.hasInit = true;\n }\n } else {\n if (isIframe && payload[1] === 0) {\n let config = parseAVCDecoderConfigurationRecord(payload.slice(5))\n const videoInfo = this.player.video.videoInfo;\n if ((videoInfo && videoInfo.width && videoInfo.height) && (config && config.codecWidth && config.codecHeight) && (config.codecWidth !== videoInfo.width || config.codecHeight !== videoInfo.height)) {\n this.player.debug.warn('MediaSource', `width or height is update, width ${videoInfo.width}-> ${config.codecWidth}, height ${videoInfo.height}-> ${config.codecHeight}`)\n this.isInitInfo = false;\n this.player.video.init = false;\n }\n }\n\n if (!this.isDecodeFirstIIframe && isIframe) {\n this.isDecodeFirstIIframe = true;\n }\n if (this.isDecodeFirstIIframe) {\n if (this.firstRenderTime === null) {\n this.firstRenderTime = ts;\n }\n const dts = ts - this.firstRenderTime;\n\n this._decodeVideo(payload, dts, isIframe, cts);\n } else {\n this.player.debug.warn('MediaSource', 'decodeVideo isDecodeFirstIIframe false')\n }\n }\n }\n\n\n _decodeConfigurationRecord(payload, ts, isIframe, videoCodec) {\n let data = payload.slice(5);\n let config = {};\n\n config = parseAVCDecoderConfigurationRecord(data)\n\n const metaData = {\n id: 1, // video tag data\n type: 'video',\n timescale: 1000,\n duration: 0,\n avcc: data,\n codecWidth: config.codecWidth,\n codecHeight: config.codecHeight,\n videoType: config.videoType\n }\n // ftyp\n const metaBox = MP4.generateInitSegment(metaData);\n this.isAvc = true;\n this.appendBuffer(metaBox.buffer);\n this.sequenceNumber = 0;\n this.cacheTrack = null;\n this.timeInit = false;\n }\n\n //\n _decodeVideo(payload, dts, isIframe, cts) {\n const player = this.player;\n let arrayBuffer = payload.slice(5);\n let bytes = arrayBuffer.byteLength;\n // player.debug.log('MediaSource', '_decodeVideo', ts);\n const $video = player.video.$videoElement;\n const videoBufferDelay = player._opt.videoBufferDelay;\n if ($video.buffered.length > 1) {\n this.removeBuffer($video.buffered.start(0), $video.buffered.end(0));\n this.timeInit = false;\n }\n if (this.dropping && dts - this.cacheTrack.dts > videoBufferDelay) {\n this.dropping = false;\n this.cacheTrack = {};\n } else if (this.cacheTrack && dts >= this.cacheTrack.dts) {\n // 需要额外加8个size\n let mdatBytes = 8 + this.cacheTrack.size;\n let mdatbox = new Uint8Array(mdatBytes);\n mdatbox[0] = mdatBytes >>> 24 & 255;\n mdatbox[1] = mdatBytes >>> 16 & 255;\n mdatbox[2] = mdatBytes >>> 8 & 255;\n mdatbox[3] = mdatBytes & 255;\n mdatbox.set(MP4.types.mdat, 4);\n mdatbox.set(this.cacheTrack.data, 8);\n\n this.cacheTrack.duration = dts - this.cacheTrack.dts;\n // moof\n let moofbox = MP4.moof(this.cacheTrack, this.cacheTrack.dts);\n let result = new Uint8Array(moofbox.byteLength + mdatbox.byteLength);\n result.set(moofbox, 0);\n result.set(mdatbox, moofbox.byteLength);\n // appendBuffer\n this.appendBuffer(result.buffer)\n player.handleRender();\n player.updateStats({fps: true, ts: dts, buf: (player.demux && player.demux.delay) || 0})\n if (!player._times.videoStart) {\n player._times.videoStart = now();\n player.handlePlayToRenderTimes()\n }\n } else {\n player.debug.log('MediaSource', 'timeInit set false , cacheTrack = {}');\n this.timeInit = false;\n this.cacheTrack = {};\n }\n if (!this.cacheTrack) {\n this.cacheTrack = {};\n }\n this.cacheTrack.id = 1;\n this.cacheTrack.sequenceNumber = ++this.sequenceNumber;\n this.cacheTrack.size = bytes;\n this.cacheTrack.dts = dts;\n this.cacheTrack.cts = cts;\n this.cacheTrack.isKeyframe = isIframe;\n this.cacheTrack.data = arrayBuffer;\n //\n this.cacheTrack.flags = {\n isLeading: 0,\n dependsOn: isIframe ? 2 : 1,\n isDependedOn: isIframe ? 1 : 0,\n hasRedundancy: 0,\n isNonSync: isIframe ? 0 : 1\n }\n\n //\n if (!this.timeInit && $video.buffered.length === 1) {\n player.debug.log('MediaSource', 'timeInit set true');\n this.timeInit = true;\n $video.currentTime = $video.buffered.end(0);\n }\n\n if (!this.isInitInfo && $video.videoWidth > 0 && $video.videoHeight > 0) {\n player.debug.log('MediaSource', `updateVideoInfo: ${$video.videoWidth},${$video.videoHeight}`);\n player.video.updateVideoInfo({\n width: $video.videoWidth,\n height: $video.videoHeight\n })\n player.video.initCanvasViewSize();\n this.isInitInfo = true;\n }\n }\n\n appendBuffer(buffer) {\n const {\n debug,\n events: {proxy},\n } = this.player;\n\n if (this.sourceBuffer === null) {\n this.sourceBuffer = this.mediaSource.addSourceBuffer(MP4_CODECS.avc);\n proxy(this.sourceBuffer, 'error', (error) => {\n debug.error('MediaSource', 'sourceBuffer error', error);\n this.player.emit(EVENTS.mseSourceBufferError, error);\n // this.dropSourceBuffer(false)\n })\n }\n\n if (this.mediaSourceAppendBufferError) {\n debug.error('MediaSource', `this.mediaSourceAppendBufferError is true`);\n return;\n }\n\n if (this.mediaSourceAppendBufferFull) {\n debug.error('MediaSource', `this.mediaSourceAppendBufferFull is true`);\n return;\n }\n\n\n if (this.sourceBuffer.updating === false && this.isStateOpen) {\n try {\n this.sourceBuffer.appendBuffer(buffer);\n } catch (e) {\n debug.warn('MediaSource', 'this.sourceBuffer.appendBuffer()', e.code, e);\n if (e.code === 22) {\n // QuotaExceededError\n // The SourceBuffer is full, and cannot free space to append additional buffers\n this.stop();\n this.mediaSourceAppendBufferFull = true;\n this.emit(EVENTS_ERROR.mediaSourceFull)\n } else if (e.code === 11) {\n // Failed to execute 'appendBuffer' on 'SourceBuffer': The HTMLMediaElement.error attribute is not null.\n this.stop();\n this.mediaSourceAppendBufferError = true;\n this.emit(EVENTS_ERROR.mediaSourceAppendBufferError);\n } else {\n debug.error('MediaSource', 'appendBuffer error', e)\n this.player.emit(EVENTS.mseSourceBufferError, e);\n }\n }\n return;\n }\n\n if (this.isStateClosed) {\n this.player.emitError(EVENTS_ERROR.mseSourceBufferError, 'mediaSource is not attached to video or mediaSource is closed')\n } else if (this.isStateEnded) {\n this.player.emitError(EVENTS_ERROR.mseSourceBufferError, 'mediaSource is closed')\n } else {\n if (this.sourceBuffer.updating === true) {\n this.player.emit(EVENTS.mseSourceBufferBusy);\n // this.dropSourceBuffer(true);\n }\n }\n }\n\n stop() {\n this.abortSourceBuffer();\n this.removeSourceBuffer();\n this.endOfStream();\n }\n\n dropSourceBuffer(isDropping) {\n const $video = this.player.video.$videoElement;\n this.dropping = isDropping;\n if ($video.buffered.length > 0) {\n if ($video.buffered.end(0) - $video.currentTime > 1) {\n this.player.debug.warn('MediaSource', 'dropSourceBuffer', `$video.buffered.end(0) is ${$video.buffered.end(0)} - $video.currentTime ${$video.currentTime}`);\n $video.currentTime = $video.buffered.end(0);\n }\n }\n }\n\n\n removeBuffer(start, end) {\n\n if (this.isStateOpen && this.sourceBuffer.updating === false) {\n try {\n this.sourceBuffer.remove(start, end)\n } catch (e) {\n this.player.debug.warn('MediaSource', 'removeBuffer() error', e);\n }\n } else {\n this.player.debug.warn('MediaSource', 'removeBuffer() this.isStateOpen is', this.isStateOpen, 'this.sourceBuffer.updating', this.sourceBuffer.updating);\n }\n }\n\n endOfStream() {\n // fix: MediaSource endOfStream before demuxer initialization completes (before HAVE_METADATA) is treated as an error\n const $videoElement = this.player.video && this.player.video.$videoElement;\n if (this.isStateOpen && $videoElement && $videoElement.readyState >= 1) {\n try {\n this.mediaSource.endOfStream();\n } catch (e) {\n this.player.debug.warn('MediaSource', 'endOfStream() error', e);\n }\n }\n }\n\n abortSourceBuffer() {\n if (this.isStateOpen) {\n if (this.sourceBuffer) {\n this.sourceBuffer.abort();\n this.sourceBuffer = null;\n }\n }\n }\n\n removeSourceBuffer() {\n if (!this.isStateClosed) {\n if (this.mediaSource && this.sourceBuffer) {\n try {\n this.mediaSource.removeSourceBuffer(this.sourceBuffer);\n } catch (e) {\n this.player.debug.warn('MediaSource', 'removeSourceBuffer() error', e);\n }\n }\n }\n }\n\n getSourceBufferUpdating() {\n return this.sourceBuffer && this.sourceBuffer.updating;\n }\n\n}\n","// tks: https://github.com/richtr/NoSleep.js\n\nconst WEBM = \"data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC7AAAAAAAAgLUBAAAAAAC4AQN2b3JiaXMtAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAxMDExMDEgKFNjaGF1ZmVudWdnZXQpAQAAABUAAABlbmNvZGVyPUxhdmM1NS41Mi4xMDIBBXZvcmJpcyVCQ1YBAEAAACRzGCpGpXMWhBAaQlAZ4xxCzmvsGUJMEYIcMkxbyyVzkCGkoEKIWyiB0JBVAABAAACHQXgUhIpBCCGEJT1YkoMnPQghhIg5eB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meacLzPM80IYqiaJoQRVE0TZimaaoqME1VFQAAUOAAABBgg6bE4gCFhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE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AAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw\";\n\n\n// Detect iOS browsers < version 10\nconst\n oldIOS = () =>\n typeof navigator !== \"undefined\" &&\n parseFloat(\n (\n \"\" +\n (/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(\n navigator.userAgent\n ) || [0, \"\"])[1]\n )\n .replace(\"undefined\", \"3_2\")\n .replace(\"_\", \".\")\n .replace(\"_\", \"\")\n ) < 10 &&\n !window.MSStream;\n\n// Detect native Wake Lock API support\nconst nativeWakeLock = () => \"wakeLock\" in navigator;\n\nexport default class NoSleep {\n constructor(player) {\n this.player = player;\n this.enabled = false;\n if (nativeWakeLock()) {\n this._wakeLock = null;\n const handleVisibilityChange = () => {\n if (this._wakeLock !== null && document.visibilityState === \"visible\") {\n this.enable();\n }\n };\n document.addEventListener(\"visibilitychange\", handleVisibilityChange);\n document.addEventListener(\"fullscreenchange\", handleVisibilityChange);\n } else if (oldIOS()) {\n this.noSleepTimer = null;\n } else {\n // Set up no sleep video element\n this.noSleepVideo = document.createElement(\"video\");\n\n this.noSleepVideo.setAttribute(\"title\", \"No Sleep\");\n this.noSleepVideo.setAttribute(\"playsinline\", \"\");\n\n this._addSourceToVideo(this.noSleepVideo, \"webm\", WEBM);\n this._addSourceToVideo(this.noSleepVideo, \"mp4\", MP4);\n\n this.noSleepVideo.addEventListener(\"loadedmetadata\", () => {\n if (this.noSleepVideo.duration <= 1) {\n // webm source\n this.noSleepVideo.setAttribute(\"loop\", \"\");\n } else {\n // mp4 source\n this.noSleepVideo.addEventListener(\"timeupdate\", () => {\n if (this.noSleepVideo.currentTime > 0.5) {\n this.noSleepVideo.currentTime = Math.random();\n }\n });\n }\n });\n }\n }\n\n _addSourceToVideo(element, type, dataURI) {\n var source = document.createElement(\"source\");\n source.src = dataURI;\n source.type = `video/${type}`;\n element.appendChild(source);\n }\n\n get isEnabled() {\n return this.enabled;\n }\n\n enable() {\n const debug = this.player.debug;\n if (nativeWakeLock()) {\n return navigator.wakeLock\n .request(\"screen\")\n .then((wakeLock) => {\n this._wakeLock = wakeLock;\n this.enabled = true;\n debug.log('wakeLock', 'Wake Lock active.')\n this._wakeLock.addEventListener(\"release\", () => {\n // ToDo: Potentially emit an event for the page to observe since\n // Wake Lock releases happen when page visibility changes.\n // (https://web.dev/wakelock/#wake-lock-lifecycle)\n debug.log('wakeLock', 'Wake Lock released.')\n });\n })\n .catch((err) => {\n this.enabled = false;\n debug.error('wakeLock', `${err.name}, ${err.message}`)\n throw err;\n });\n } else if (oldIOS()) {\n this.disable();\n this.noSleepTimer = window.setInterval(() => {\n if (!document.hidden) {\n window.location.href = window.location.href.split(\"#\")[0];\n window.setTimeout(window.stop, 0);\n }\n }, 15000);\n this.enabled = true;\n return Promise.resolve();\n } else {\n let playPromise = this.noSleepVideo.play();\n return playPromise\n .then((res) => {\n this.enabled = true;\n return res;\n })\n .catch((err) => {\n this.enabled = false;\n throw err;\n });\n }\n }\n\n disable() {\n const debug = this.player.debug;\n if (nativeWakeLock()) {\n if (this._wakeLock) {\n this._wakeLock.release();\n }\n this._wakeLock = null;\n } else if (oldIOS()) {\n if (this.noSleepTimer) {\n debug.warn('wakeLock', 'NoSleep now disabled for older iOS devices.')\n\n window.clearInterval(this.noSleepTimer);\n this.noSleepTimer = null;\n }\n } else {\n this.noSleepVideo.pause();\n }\n this.enabled = false;\n }\n}\n","import {DEFAULT_PLAYER_OPTIONS, EVENTS, EVENTS_ERROR, JESSIBUCA_EVENTS,VERSION} from \"../constant\";\nimport Debug from \"../utils/debug\";\nimport Events from \"../utils/events\";\nimport property from './property';\nimport events from './events';\nimport {\n fpsStatus,\n initPlayTimes,\n isEmpty, isFalse,\n isFullScreen, isMobile,isPad,\n isNotEmpty,\n now, supportMediaStreamTrack,\n supportMSE,\n supportOffscreenV2,\n supportWCS\n} from \"../utils\";\nimport Video from \"../video\";\nimport Audio from \"../audio\";\nimport Stream from \"../stream\";\nimport Recorder from \"../recorder\";\nimport DecoderWorker from \"../worker/index\";\nimport Emitter from \"../utils/emitter\";\nimport Demux from \"../demux\";\nimport WebcodecsDecoder from \"../decoder/webcodecs\";\nimport Control from \"../control\";\nimport './style.scss'\nimport observer from \"./observer\";\nimport MseDecoder from \"../decoder/mediaSource\";\nimport NoSleep from \"../utils/noSleep\";\nimport screenfull from \"screenfull\";\n\nexport default class Player extends Emitter {\n constructor(container, options) {\n super()\n this.$container = container;\n this._opt = Object.assign({}, DEFAULT_PLAYER_OPTIONS, options)\n this.debug = new Debug(this);\n this.debug.log('Player', 'init');\n\n // disable offscreen\n this._opt.forceNoOffscreen = true;\n\n if (isMobile() || isPad()) {\n this.debug.log('Player', 'isMobile and set _opt.controlAutoHide false');\n this._opt.controlAutoHide = false;\n }\n\n if (screenfull.isEnabled &&\n this._opt.useWebFullScreen) {\n this.debug.log('Player', 'screenfull.isEnabled is true and _opt.useWebFullScreen is true , set _opt.useWebFullScreen false');\n this._opt.useWebFullScreen = false;\n }\n\n if (isFalse(screenfull.isEnabled) &&\n isFalse(this._opt.useWebFullScreen)) {\n this.debug.log('Player', 'screenfull.isEnabled is false and _opt.useWebFullScreen is false , set _opt.useWebFullScreen true');\n this._opt.useWebFullScreen = true;\n }\n\n\n //\n if (this._opt.useWCS) {\n this._opt.useWCS = supportWCS();\n }\n\n //\n if (this._opt.useMSE) {\n this._opt.useMSE = supportMSE();\n }\n\n //\n if (this._opt.wcsUseVideoRender) {\n this._opt.wcsUseVideoRender = supportMediaStreamTrack()\n }\n\n // 如果使用mse则强制不允许 webcodecs\n if (this._opt.useMSE) {\n if (this._opt.useWCS) {\n this.debug.log('Player', 'useWCS set true->false')\n }\n\n if (!this._opt.forceNoOffscreen) {\n this.debug.log('Player', 'forceNoOffscreen set false->true')\n }\n\n this._opt.useWCS = false;\n this._opt.forceNoOffscreen = true;\n }\n\n if (!this._opt.forceNoOffscreen) {\n if (!supportOffscreenV2()) {\n this._opt.forceNoOffscreen = true;\n this._opt.useOffscreen = false;\n } else {\n this._opt.useOffscreen = true;\n }\n }\n\n if (!this._opt.hasAudio) {\n this._opt.operateBtns.audio = false\n }\n\n this._opt.hasControl = this._hasControl();\n //\n this._loading = false;\n this._playing = false;\n this._hasLoaded = false;\n\n //\n this._checkHeartTimeout = null;\n this._checkLoadingTimeout = null;\n this._checkStatsInterval = null;\n\n //\n this._startBpsTime = null;\n this._isPlayingBeforePageHidden = false;\n this._stats = {\n buf: 0, // 当前缓冲区时长,单位毫秒,\n fps: 0, // 当前视频帧率\n abps: 0, // 当前音频码率,单位bit\n vbps: 0, // 当前视频码率,单位bit\n ts: 0 // 当前视频帧pts,单位毫秒\n }\n\n // 各个步骤的时间统计\n this._times = initPlayTimes();\n\n //\n this._videoTimestamp = 0;\n this._audioTimestamp = 0;\n\n property(this);\n\n this.events = new Events(this);\n this.video = new Video(this);\n\n if (this._opt.hasAudio) {\n this.audio = new Audio(this);\n }\n this.recorder = new Recorder(this);\n\n if (!this._onlyMseOrWcsVideo()) {\n this.decoderWorker = new DecoderWorker(this);\n } else {\n this.loaded = true;\n }\n\n this.stream = null;\n this.demux = null;\n this._lastVolume = null;\n\n if (this._opt.useWCS) {\n this.webcodecsDecoder = new WebcodecsDecoder(this)\n this.loaded = true\n }\n\n if (this._opt.useMSE) {\n this.mseDecoder = new MseDecoder(this);\n this.loaded = true\n }\n\n //\n this.control = new Control(this);\n\n if (isMobile()) {\n this.keepScreenOn = new NoSleep(this);\n }\n\n events(this);\n observer(this);\n this.debug.log('Player', 'init and version is',VERSION);\n\n if (this._opt.useWCS) {\n this.debug.log('Player', 'use WCS')\n }\n\n if (this._opt.useMSE) {\n this.debug.log('Player', 'use MSE')\n }\n\n if (this._opt.useOffscreen) {\n this.debug.log('Player', 'use offscreen')\n }\n\n try {\n this.debug.log('Player options', JSON.stringify(this._opt));\n } catch (e) {\n // ignore\n }\n }\n\n\n async destroy() {\n this._loading = false;\n this._playing = false;\n this._hasLoaded = false;\n this._lastVolume = null;\n this._times = initPlayTimes();\n\n if (this.decoderWorker) {\n await this.decoderWorker.destroy();\n this.decoderWorker = null;\n }\n if (this.video) {\n this.video.destroy();\n this.video = null;\n }\n\n if (this.audio) {\n this.audio.destroy();\n this.audio = null;\n }\n\n if (this.stream) {\n await this.stream.destroy();\n this.stream = null;\n }\n\n if (this.recorder) {\n this.recorder.destroy();\n this.recorder = null;\n }\n\n if (this.control) {\n this.control.destroy();\n this.control = null;\n }\n\n if (this.webcodecsDecoder) {\n this.webcodecsDecoder.destroy();\n this.webcodecsDecoder = null;\n }\n\n if (this.mseDecoder) {\n this.mseDecoder.destroy();\n this.mseDecoder = null;\n }\n\n if (this.demux) {\n this.demux.destroy();\n this.demux = null;\n }\n\n\n if (this.events) {\n this.events.destroy();\n this.events = null;\n }\n\n this.clearCheckHeartTimeout();\n this.clearCheckLoadingTimeout();\n this.clearStatsInterval();\n //\n this.releaseWakeLock();\n this.keepScreenOn = null;\n // reset stats\n this.resetStats();\n this._audioTimestamp = 0;\n this._videoTimestamp = 0;\n\n // 其他没法解耦的,通过 destroy 方式\n this.emit('destroy');\n // 接触所有绑定事件\n this.off();\n\n this.debug.log('play', 'destroy end');\n }\n\n set fullscreen(value) {\n if (isMobile() && this._opt.useWebFullScreen) {\n this.emit(EVENTS.webFullscreen, value);\n setTimeout(() => {\n this.updateOption({\n rotate: value ? 270 : 0,\n })\n this.resize();\n }, 10)\n } else {\n this.emit(EVENTS.fullscreen, value);\n }\n }\n\n get fullscreen() {\n return isFullScreen() || this.webFullscreen;\n }\n\n set webFullscreen(value) {\n this.emit(EVENTS.webFullscreen, value);\n }\n\n get webFullscreen() {\n return this.$container.classList.contains('jessibuca-fullscreen-web')\n }\n\n set loaded(value) {\n this._hasLoaded = value;\n }\n\n get loaded() {\n return this._hasLoaded;\n }\n\n //\n set playing(value) {\n\n if (value) {\n // 将loading 设置为 false\n this.loading = false;\n }\n\n if (this.playing !== value) {\n this._playing = value;\n this.emit(EVENTS.playing, value);\n this.emit(EVENTS.volumechange, this.volume);\n\n if (value) {\n this.emit(EVENTS.play);\n } else {\n this.emit(EVENTS.pause);\n }\n }\n }\n\n get playing() {\n return this._playing;\n }\n\n get volume() {\n return (this.audio && this.audio.volume) || 0;\n }\n\n set volume(value) {\n if (value !== this.volume) {\n this.audio && this.audio.setVolume(value);\n this._lastVolume = value;\n }\n }\n\n get lastVolume() {\n return this._lastVolume\n }\n\n set loading(value) {\n if (this.loading !== value) {\n this._loading = value;\n this.emit(EVENTS.loading, this._loading);\n }\n }\n\n get loading() {\n return this._loading;\n }\n\n set recording(value) {\n if (value) {\n if (this.playing) {\n this.recorder && this.recorder.startRecord();\n }\n } else {\n this.recorder && this.recorder.stopRecordAndSave();\n }\n }\n\n get recording() {\n return this.recorder ? this.recorder.recording : false;\n }\n\n set audioTimestamp(value) {\n if (value === null) {\n return;\n }\n this._audioTimestamp = value;\n }\n\n //\n get audioTimestamp() {\n return this._audioTimestamp;\n }\n\n //\n set videoTimestamp(value) {\n if (value === null) {\n return;\n }\n this._videoTimestamp = value;\n // just for wasm\n if (!this._opt.useWCS && !this._opt.useMSE) {\n if (this.audioTimestamp && this.videoTimestamp) {\n this.audio && this.audio.emit(EVENTS.videoSyncAudio, {\n audioTimestamp: this.audioTimestamp,\n videoTimestamp: this.videoTimestamp,\n diff: this.audioTimestamp - this.videoTimestamp\n })\n }\n }\n }\n\n //\n get videoTimestamp() {\n return this._videoTimestamp;\n }\n\n get isDebug() {\n return this._opt.debug === true;\n }\n\n\n /**\n *\n * @param options\n */\n updateOption(options) {\n this._opt = Object.assign({}, this._opt, options)\n }\n\n /**\n *\n * @returns {Promise}\n */\n init() {\n return new Promise((resolve, reject) => {\n if (!this.stream) {\n this.stream = new Stream(this);\n }\n\n if (!this.audio) {\n if (this._opt.hasAudio) {\n this.audio = new Audio(this);\n }\n }\n if (!this.demux) {\n this.demux = new Demux(this);\n }\n\n if (this._opt.useWCS) {\n if (!this.webcodecsDecoder) {\n this.webcodecsDecoder = new WebcodecsDecoder(this)\n }\n }\n\n if (this._opt.useMSE) {\n if (!this.mseDecoder) {\n this.mseDecoder = new MseDecoder(this);\n }\n }\n\n if (!this.decoderWorker && !this._onlyMseOrWcsVideo()) {\n this.decoderWorker = new DecoderWorker(this);\n this.debug.log('Player', 'waiting decoderWorker init');\n this.once(EVENTS.decoderWorkerInit, () => {\n this.debug.log('Player', 'decoderWorker init success');\n resolve()\n })\n } else {\n resolve()\n }\n\n })\n }\n\n\n /**\n *\n * @param url\n * @returns {Promise}\n */\n play(url, options) {\n return new Promise((resolve, reject) => {\n if (!url && !this._opt.url) {\n return reject();\n }\n\n this.loading = true;\n this.playing = false;\n this._times.playInitStart = now();\n if (!url) {\n url = this._opt.url;\n }\n this._opt.url = url;\n\n this.clearCheckHeartTimeout();\n\n this.init().then(() => {\n this._times.playStart = now();\n //\n if (this._opt.isNotMute) {\n this.mute(false);\n }\n\n\n if (this.webcodecsDecoder) {\n this.webcodecsDecoder.once(EVENTS_ERROR.webcodecsH265NotSupport, () => {\n this.emit(EVENTS_ERROR.webcodecsH265NotSupport)\n if (!this._opt.autoWasm) {\n this.emit(EVENTS.error, EVENTS_ERROR.webcodecsH265NotSupport);\n }\n })\n }\n\n if (this.mseDecoder) {\n this.mseDecoder.once(EVENTS_ERROR.mediaSourceH265NotSupport, () => {\n this.emit(EVENTS_ERROR.mediaSourceH265NotSupport)\n if (!this._opt.autoWasm) {\n this.emit(EVENTS.error, EVENTS_ERROR.mediaSourceH265NotSupport);\n }\n })\n\n this.mseDecoder.once(EVENTS_ERROR.mediaSourceFull, () => {\n this.emitError(EVENTS_ERROR.mediaSourceFull)\n })\n\n this.mseDecoder.once(EVENTS_ERROR.mediaSourceAppendBufferError, () => {\n this.emitError(EVENTS_ERROR.mediaSourceAppendBufferError)\n })\n\n this.mseDecoder.once(EVENTS_ERROR.mediaSourceBufferListLarge, () => {\n this.emitError(EVENTS_ERROR.mediaSourceBufferListLarge);\n })\n\n this.mseDecoder.once(EVENTS_ERROR.mediaSourceAppendBufferEndTimeout, () => {\n this.emitError(EVENTS_ERROR.mediaSourceAppendBufferEndTimeout);\n })\n }\n\n this.enableWakeLock();\n\n this.stream.fetchStream(url, options);\n\n //\n this.checkLoadingTimeout();\n // fetch error\n this.stream.once(EVENTS_ERROR.fetchError, (error) => {\n // reject(error)\n this.emitError(EVENTS_ERROR.fetchError, error);\n })\n\n // ws\n this.stream.once(EVENTS_ERROR.websocketError, (error) => {\n // reject(error)\n this.emitError(EVENTS_ERROR.websocketError, error);\n })\n\n // stream end\n this.stream.once(EVENTS.streamEnd, (msg) => {\n // reject();\n this.emitError(EVENTS.streamEnd, msg);\n })\n\n // success\n this.stream.once(EVENTS.streamSuccess, () => {\n resolve();\n this._times.streamResponse = now();\n //\n this.video.play();\n this.checkStatsInterval();\n })\n\n }).catch((e) => {\n reject(e)\n })\n })\n }\n\n /**\n *\n */\n close() {\n return new Promise((resolve, reject) => {\n this._close().then(() => {\n this.video && this.video.clearView();\n resolve()\n })\n })\n }\n\n resumeAudioAfterPause() {\n if (this.lastVolume) {\n this.volume = this.lastVolume;\n }\n }\n\n _close() {\n return new Promise((resolve, reject) => {\n //\n if (this.stream) {\n this.stream.destroy();\n this.stream = null;\n }\n\n if (this.demux) {\n this.demux.destroy();\n this.demux = null;\n }\n\n //\n if (this.decoderWorker) {\n this.decoderWorker.destroy();\n this.decoderWorker = null;\n }\n\n if (this.webcodecsDecoder) {\n this.webcodecsDecoder.destroy();\n this.webcodecsDecoder = null;\n }\n\n if (this.mseDecoder) {\n this.mseDecoder.destroy();\n this.mseDecoder = null;\n }\n\n if (this.audio) {\n this.audio.destroy();\n this.audio = null;\n }\n this.clearCheckHeartTimeout();\n this.clearCheckLoadingTimeout();\n this.clearStatsInterval();\n this.playing = false;\n this.loading = false;\n this.recording = false;\n\n if (this.video) {\n this.video.resetInit();\n this.video.pause(true);\n }\n // release lock\n this.releaseWakeLock();\n // reset stats\n this.resetStats();\n //\n this._audioTimestamp = 0;\n this._videoTimestamp = 0;\n //\n this._times = initPlayTimes();\n //\n setTimeout(() => {\n resolve()\n }, 0)\n })\n }\n\n /**\n *\n * @param flag {boolean} 是否清除画面\n * @returns {Promise}\n */\n pause(flag = false) {\n if (flag) {\n return this.close();\n } else {\n return this._close();\n }\n }\n\n /**\n *\n * @param flag\n */\n mute(flag) {\n this.audio && this.audio.mute(flag)\n }\n\n /**\n *\n */\n resize() {\n this.video.resize();\n }\n\n /**\n *\n * @param fileName\n * @param fileType\n */\n startRecord(fileName, fileType) {\n if (this.recording) {\n return;\n }\n\n this.recorder.setFileName(fileName, fileType);\n this.recording = true;\n }\n\n /**\n *\n */\n stopRecordAndSave() {\n if (this.recording) {\n this.recording = false;\n }\n }\n\n _hasControl() {\n let result = false;\n\n let hasBtnShow = false;\n Object.keys(this._opt.operateBtns).forEach((key) => {\n if (this._opt.operateBtns[key]) {\n hasBtnShow = true;\n }\n });\n\n if (this._opt.showBandwidth || this._opt.text || hasBtnShow) {\n result = true;\n }\n\n return result;\n }\n\n _onlyMseOrWcsVideo() {\n return this._opt.hasAudio === false && (this._opt.useMSE || (this._opt.useWCS && !this._opt.useOffscreen))\n }\n\n checkHeart() {\n this.clearCheckHeartTimeout();\n this.checkHeartTimeout();\n }\n\n // 心跳检查,如果渲染间隔暂停了多少时间之后,就会抛出异常\n checkHeartTimeout() {\n this._checkHeartTimeout = setTimeout(() => {\n if (this.playing) {\n // check again\n if (this._stats.fps !== 0) {\n return;\n }\n this.pause().then(() => {\n this.emit(EVENTS.timeout, EVENTS.delayTimeout);\n this.emit(EVENTS.delayTimeout);\n });\n }\n\n }, this._opt.heartTimeout * 1000)\n }\n\n checkStatsInterval() {\n this._checkStatsInterval = setInterval(() => {\n this.updateStats();\n }, 1000)\n }\n\n //\n clearCheckHeartTimeout() {\n if (this._checkHeartTimeout) {\n clearTimeout(this._checkHeartTimeout);\n this._checkHeartTimeout = null;\n }\n }\n\n // loading 等待时间\n checkLoadingTimeout() {\n this._checkLoadingTimeout = setTimeout(() => {\n // check again\n if (this.playing) {\n return;\n }\n this.pause().then(() => {\n this.emit(EVENTS.timeout, EVENTS.loadingTimeout);\n this.emit(EVENTS.loadingTimeout);\n });\n }, this._opt.loadingTimeout * 1000)\n }\n\n clearCheckLoadingTimeout() {\n if (this._checkLoadingTimeout) {\n clearTimeout(this._checkLoadingTimeout);\n this._checkLoadingTimeout = null;\n }\n }\n\n clearStatsInterval() {\n if (this._checkStatsInterval) {\n clearInterval(this._checkStatsInterval);\n this._checkStatsInterval = null;\n }\n }\n\n handleRender() {\n if (this.loading) {\n this.emit(EVENTS.start);\n this.loading = false;\n this.clearCheckLoadingTimeout();\n }\n if (!this.playing) {\n this.playing = true;\n }\n this.checkHeart();\n }\n\n\n //\n updateStats(options) {\n options = options || {};\n\n if (!this._startBpsTime) {\n this._startBpsTime = now();\n }\n\n if (isNotEmpty(options.ts)) {\n this._stats.ts = options.ts;\n }\n\n if (isNotEmpty(options.buf)) {\n this._stats.buf = options.buf;\n }\n\n if (options.fps) {\n this._stats.fps += 1;\n }\n if (options.abps) {\n this._stats.abps += options.abps;\n }\n if (options.vbps) {\n this._stats.vbps += options.vbps;\n }\n\n const _nowTime = now();\n const timestamp = _nowTime - this._startBpsTime;\n\n if (timestamp < 1 * 1000) {\n return;\n }\n\n this.emit(EVENTS.stats, this._stats);\n this.emit(EVENTS.performance, fpsStatus(this._stats.fps));\n this._stats.fps = 0;\n this._stats.abps = 0;\n this._stats.vbps = 0;\n this._startBpsTime = _nowTime;\n }\n\n resetStats() {\n this._startBpsTime = null;\n this._stats = {\n buf: 0, //ms\n fps: 0,\n abps: 0,\n vbps: 0,\n ts: 0\n }\n }\n\n enableWakeLock() {\n if (this._opt.keepScreenOn) {\n this.keepScreenOn && this.keepScreenOn.enable();\n }\n }\n\n releaseWakeLock() {\n if (this._opt.keepScreenOn) {\n this.keepScreenOn && this.keepScreenOn.disable();\n }\n }\n\n handlePlayToRenderTimes() {\n const _times = this._times;\n _times.playTimestamp = _times.playStart - _times.playInitStart;\n _times.streamTimestamp = _times.streamStart - _times.playStart;\n _times.streamResponseTimestamp = _times.streamResponse - _times.streamStart;\n _times.demuxTimestamp = _times.demuxStart - _times.streamResponse;\n _times.decodeTimestamp = _times.decodeStart - _times.demuxStart;\n _times.videoTimestamp = _times.videoStart - _times.decodeStart;\n _times.allTimestamp = _times.videoStart - _times.playInitStart;\n this.emit(EVENTS.playToRenderTimes, _times);\n }\n\n getOption() {\n return this._opt;\n }\n\n emitError(errorType, message = '') {\n this.emit(EVENTS.error, errorType, message);\n this.emit(errorType, message);\n }\n\n isControlBarShow() {\n const hasControl = this._opt.hasControl;\n const controlAutoHide = this._opt.controlAutoHide;\n\n let result = hasControl && !controlAutoHide;\n\n if (result) {\n if (this.control) {\n result = this.control.getBarIsShow();\n }\n }\n\n return result;\n }\n\n getControlBarShow(){\n let result = false;\n if (this.control) {\n result = this.control.getBarIsShow();\n }\n return result;\n }\n\n toggleControlBar(isShow) {\n if (this.control) {\n this.control.toggleBar(isShow);\n this.resize();\n }\n }\n}\n","import Player from './player';\nimport Events from \"./utils/events\";\nimport {\n CONTAINER_DATA_SET_KEY,\n DEMUX_TYPE,\n EVENTS,\n EVENTS_ERROR,\n JESSIBUCA_EVENTS,\n PLAYER_PLAY_PROTOCOL,\n SCALE_MODE_TYPE,\n VERSION\n} from \"./constant\";\nimport {\n getElementDataset,\n isEmpty,\n isMobile,\n isNotEmpty,\n removeElementDataset,\n setElementDataset,\n supportWCS,\n uuid16\n} from \"./utils\";\nimport Emitter from \"./utils/emitter\";\nimport Debug from \"./utils/debug\";\n\n\nclass Jessibuca extends Emitter {\n static ERROR = EVENTS_ERROR\n\n static TIMEOUT = {\n loadingTimeout: EVENTS.loadingTimeout,\n delayTimeout: EVENTS.delayTimeout,\n }\n\n constructor(options) {\n super()\n let _opt = options;\n let $container = options.container;\n if (typeof options.container === 'string') {\n $container = document.querySelector(options.container);\n }\n if (!$container) {\n throw new Error('Jessibuca need container option');\n return;\n }\n // check container node name\n if ($container.nodeName === 'CANVAS' || $container.nodeName === 'VIDEO') {\n throw new Error(`Jessibuca container type can not be ${$container.nodeName} type`);\n return;\n }\n\n if (_opt.videoBuffer >= _opt.heartTimeout) {\n throw new Error(`Jessibuca videoBuffer ${_opt.videoBuffer}s must be less than heartTimeout ${_opt.heartTimeout}s`);\n return;\n }\n\n\n if (this._checkHasCreated($container)) {\n throw new Error(`Jessibuca container has been created and can not be created again`, $container);\n return;\n }\n\n // videoBuffer set too long\n if (_opt.videoBuffer > 10) {\n console.warn('Jessibuca', `videoBuffer ${_opt.videoBuffer}s is too long, will black screen for ${_opt.videoBuffer}s , it is recommended to set it to less than 10s`);\n }\n\n if (!$container.classList) {\n throw new Error('Jessibuca container option must be DOM Element');\n return;\n }\n\n $container.classList.add('jessibuca-container');\n setElementDataset($container, CONTAINER_DATA_SET_KEY, uuid16());\n\n delete _opt.container;\n\n // 禁用离屏渲染\n _opt.forceNoOffscreen = true;\n\n // 移动端不支持自动关闭控制栏\n if (isMobile()) {\n _opt.controlAutoHide = false;\n }\n\n // s -> ms\n if (isNotEmpty(_opt.videoBuffer)) {\n _opt.videoBuffer = Number(_opt.videoBuffer) * 1000\n }\n\n // setting\n if (isNotEmpty(_opt.timeout)) {\n if (isEmpty(_opt.loadingTimeout)) {\n _opt.loadingTimeout = _opt.timeout;\n }\n\n if (isEmpty(_opt.heartTimeout)) {\n _opt.heartTimeout = _opt.timeout\n }\n }\n\n this._opt = _opt;\n this.$container = $container;\n this._loadingTimeoutReplayTimes = 0;\n this._heartTimeoutReplayTimes = 0;\n this._destroyed = false;\n this.events = new Events(this);\n this.debug = new Debug(this);\n this._initPlayer($container, _opt);\n console.log(`Jessibuca version: ${VERSION}`);\n }\n\n /**\n *\n */\n async destroy() {\n this._destroyed = true;\n if (this.events) {\n this.events.destroy();\n this.events = null;\n }\n\n if (this.player) {\n await this.player.destroy();\n this.player = null;\n }\n if (this.$container) {\n this.$container.classList.remove('jessibuca-container');\n this.$container.classList.remove('jessibuca-fullscreen-web');\n removeElementDataset(this.$container, CONTAINER_DATA_SET_KEY);\n this.$container = null;\n }\n\n this._opt = null;\n this._loadingTimeoutReplayTimes = 0;\n this._heartTimeoutReplayTimes = 0;\n this.off();\n }\n\n _initPlayer($container, options) {\n this.player = new Player($container, options);\n try {\n this.debug.log('jessibuca', '_initPlayer', JSON.stringify(this.player.getOption()))\n } catch (e) {\n // ignore\n }\n this._bindEvents();\n }\n\n _resetPlayer(options = {}) {\n this.player.destroy();\n this.player = null;\n this._opt = Object.assign(this._opt, options);\n this._opt.url = '';// reset url\n this._initPlayer(this.$container, this._opt);\n }\n\n _bindEvents() {\n // 对外的事件\n Object.keys(JESSIBUCA_EVENTS).forEach((key) => {\n this.player.on(JESSIBUCA_EVENTS[key], (value) => {\n this.emit(key, value)\n })\n })\n }\n\n /**\n * 是否销毁\n * @returns {boolean}\n */\n isDestroyed() {\n return this._destroyed;\n }\n\n /**\n * 是否开启控制台调试打印\n * @param value {Boolean}\n */\n setDebug(value) {\n this.player.updateOption({\n debug: !!value\n })\n }\n\n /**\n *\n */\n mute() {\n this.player.mute(true);\n }\n\n /**\n *\n */\n cancelMute() {\n this.player.mute(false);\n }\n\n /**\n *\n * @param value {number}\n */\n setVolume(value) {\n this.player.volume = value;\n }\n\n /**\n *\n */\n audioResume() {\n this.player.audio && this.player.audio.audioEnabled(true);\n }\n\n /**\n * 设置超时时长, 单位秒 在连接成功之前和播放中途,如果超过设定时长无数据返回,则回调timeout事件\n * @param value {number}\n */\n setTimeout(time) {\n time = Number(time);\n this.player.updateOption({\n timeout: time,\n loadingTimeout: time,\n heartTimeout: time\n })\n }\n\n /**\n *\n * @param type {number}: 0,1,2\n */\n setScaleMode(type) {\n type = Number(type);\n let options = {\n isFullResize: false,\n isResize: false\n }\n switch (type) {\n case SCALE_MODE_TYPE.full:\n options.isFullResize = false;\n options.isResize = false;\n break;\n case SCALE_MODE_TYPE.auto:\n options.isFullResize = false;\n options.isResize = true;\n break;\n case SCALE_MODE_TYPE.fullAuto:\n options.isFullResize = true;\n options.isResize = true;\n break;\n }\n\n this.player.updateOption(options);\n this.resize();\n }\n\n /**\n *\n * @returns {Promise}\n */\n pause() {\n return new Promise((resolve, reject) => {\n if (this.player) {\n this.player.pause().then(() => {\n resolve();\n }).catch((e) => {\n reject(e)\n });\n } else {\n reject('player is null')\n }\n })\n }\n\n /**\n *\n */\n async close() {\n await this.destroy();\n return true;\n }\n\n\n /**\n *\n */\n clearView() {\n this.player.video.clearView()\n }\n\n /**\n *\n * @param url {string}\n * @param options {object}\n * @returns {Promise}\n */\n play(url, options = {}) {\n return new Promise((resolve, reject) => {\n if (!url && !this._opt.url) {\n this.emit(EVENTS.error, EVENTS_ERROR.playError)\n reject('play url is empty')\n return;\n }\n\n if (url) {\n // url 相等的时候。\n if (this._opt.url) {\n // 存在相同的 url\n if (url === this._opt.url) {\n // 正在播放\n if (this.player.playing) {\n resolve();\n } else {\n // pause -> play\n this.clearView();\n this.player.play(this._opt.url, this._opt.playOptions).then(() => {\n resolve();\n // 恢复下之前的音量\n this.player.resumeAudioAfterPause();\n }).catch((e) => {\n this.debug.warn('jessibuca', 'pause -> play and play error', e)\n this.player.pause().then(() => {\n reject(e);\n })\n })\n }\n } else {\n // url 发生改变了\n this.player.pause().then(() => {\n // 清除 画面\n this.clearView();\n this._play(url, options).then(() => {\n resolve()\n }).catch((e) => {\n this.debug.warn('jessibuca', 'this._play error', e)\n reject(e)\n });\n }).catch((e) => {\n this.debug.warn('jessibuca', 'this._opt.url is null and pause error', e)\n reject(e);\n })\n }\n } else {\n this._play(url, options).then(() => {\n resolve()\n }).catch((e) => {\n this.debug.warn('jessibuca', 'this._play error', e)\n reject(e)\n });\n }\n } else {\n // url 不存在的时候\n // 就是从 play -> pause -> play\n this.player.play(this._opt.url, this._opt.playOptions).then(() => {\n resolve();\n // 恢复下之前的音量\n this.player.resumeAudioAfterPause();\n }).catch((e) => {\n this.debug.warn('jessibuca', 'url is null and play error', e)\n this.player.pause().then(() => {\n reject(e);\n })\n })\n }\n })\n }\n\n /**\n *\n * @param url {string}\n * @param options {object}\n * @returns {Promise}\n * @private\n */\n _play(url, options = {}) {\n return new Promise((resolve, reject) => {\n this._opt.url = url;\n this._opt.playOptions = options;\n // 新的url\n const isHttp = url.indexOf(\"http\") === 0;\n //\n const protocol = isHttp ? PLAYER_PLAY_PROTOCOL.fetch : PLAYER_PLAY_PROTOCOL.websocket\n //\n const demuxType = (isHttp || url.indexOf(\".flv\") !== -1 || this._opt.isFlv) ? DEMUX_TYPE.flv : DEMUX_TYPE.m7s;\n\n this.player.updateOption({\n protocol,\n demuxType\n })\n\n this.player.once(EVENTS_ERROR.webglAlignmentError, () => {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'webglAlignmentError')\n this._resetPlayer({openWebglAlignment: true})\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'webglAlignmentError and play success')\n }).catch(() => {\n // reject();\n this.debug.log('Jessibuca', 'webglAlignmentError and play error')\n });\n });\n })\n\n\n this.player.once(EVENTS_ERROR.mediaSourceH265NotSupport, () => {\n this.pause().then(() => {\n if (this.player._opt.autoWasm) {\n this.debug.log('Jessibuca', 'auto wasm [mse-> wasm] reset player and play')\n this._resetPlayer({useMSE: false})\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'auto wasm [mse-> wasm] reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.log('Jessibuca', 'auto wasm [mse-> wasm] reset player and play error')\n });\n } else {\n this.debug.log('Jessibuca', 'media source h265 not support and paused');\n }\n });\n })\n\n // media source full error\n this.player.once(EVENTS_ERROR.mediaSourceFull, () => {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'media source full');\n this._resetPlayer()\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'media source full and reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.warn('Jessibuca', 'media source full and reset player and play error')\n });\n })\n })\n // media source append buffer error\n this.player.once(EVENTS_ERROR.mediaSourceAppendBufferError, () => {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'media source append buffer error');\n this._resetPlayer()\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'media source append buffer error and reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.warn('Jessibuca', 'media source append buffer error and reset player and play error')\n });\n })\n })\n\n this.player.once(EVENTS_ERROR.mediaSourceBufferListLarge, () => {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'media source buffer list large');\n this._resetPlayer()\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'media source buffer list large and reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.warn('Jessibuca', 'media source buffer list large and reset player and play error')\n });\n })\n })\n\n this.player.once(EVENTS_ERROR.mediaSourceAppendBufferEndTimeout, () => {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'media source append buffer end timeout');\n this._resetPlayer()\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'media source append buffer end timeout and reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.warn('Jessibuca', 'media source append buffer end timeout and reset player and play error')\n });\n })\n })\n\n this.player.once(EVENTS_ERROR.mseSourceBufferError, () => {\n this.pause().then(() => {\n if (this.player._opt.autoWasm) {\n this.debug.log('Jessibuca', 'auto wasm [mse-> wasm] reset player and play')\n this._resetPlayer({useMSE: false})\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'auto wasm [mse-> wasm] reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.warn('Jessibuca', 'auto wasm [mse-> wasm] reset player and play error')\n });\n } else {\n this.debug.log('Jessibuca', 'mse source buffer error and paused');\n }\n })\n })\n //\n this.player.once(EVENTS_ERROR.webcodecsH265NotSupport, () => {\n this.pause().then(() => {\n if (this.player._opt.autoWasm) {\n this.debug.log('Jessibuca', 'auto wasm [wcs-> wasm] reset player and play')\n this._resetPlayer({useWCS: false})\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'auto wasm [wcs-> wasm] reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.warn('Jessibuca', 'auto wasm [wcs-> wasm] reset player and play error')\n });\n } else {\n this.debug.log('Jessibuca', 'webcodecs h265 not support and paused');\n }\n });\n })\n // webcodecs\n this.player.once(EVENTS_ERROR.webcodecsWidthOrHeightChange, () => {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'webcodecs Width Or Height Change reset player and play')\n this._resetPlayer({useWCS: true})\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'webcodecs Width Or Height Change reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.warn('Jessibuca', 'webcodecs Width Or Height Change reset player and play error')\n });\n });\n })\n // webcodecs\n this.player.once(EVENTS_ERROR.webcodecsDecodeError, () => {\n this.pause().then(() => {\n if (this.player._opt.autoWasm) {\n this.debug.log('Jessibuca', 'webcodecs decode error reset player and play')\n this._resetPlayer({useWCS: false})\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'webcodecs decode error reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.warn('Jessibuca', 'webcodecs decode error reset player and play error')\n });\n } else {\n this.debug.log('Jessibuca', 'webcodecs decode error and paused');\n }\n });\n })\n // webcodecs\n this.player.once(EVENTS_ERROR.webcodecsConfigureError, () => {\n this.pause().then(() => {\n if (this.player._opt.autoWasm) {\n this.debug.log('Jessibuca', 'webcodecs Configure error reset player and play')\n this._resetPlayer({useWCS: false})\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'webcodecs Configure error reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.warn('Jessibuca', 'webcodecs Configure error reset player and play error')\n });\n } else {\n this.debug.log('Jessibuca', 'webcodecs Configure error and paused');\n }\n });\n })\n // wasm。\n this.player.once(EVENTS_ERROR.wasmDecodeError, () => {\n if (this.player._opt.wasmDecodeErrorReplay) {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'wasm decode error and reset player and play')\n this._resetPlayer({useWCS: false})\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'wasm decode error and reset player and play success')\n }).catch((e) => {\n // reject();\n this.debug.warn('Jessibuca', 'wasm decode error and reset player and play error')\n });\n })\n } else {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'wasm decode error and paused');\n }).catch((e) => {\n this.debug.warn('Jessibuca', 'wasm decode error and paused error', e)\n })\n }\n })\n // fetch error\n this.player.once(EVENTS_ERROR.fetchError, () => {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'fetch error and pause play')\n }).catch((e) => {\n this.debug.warn('Jessibuca', 'fetch error and pause play error', e)\n })\n })\n\n //\n this.player.once(EVENTS_ERROR.websocketError, () => {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'websocket Error and pause play')\n }).catch((e) => {\n this.debug.warn('Jessibuca', 'websocket Error and pause play error', e)\n })\n })\n\n //\n this.player.once(EVENTS.streamEnd, () => {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'stream End and pause play')\n }).catch((e) => {\n this.debug.warn('Jessibuca', 'stream End and pause play error', e)\n })\n })\n\n // 监听 delay timeout\n this.player.on(EVENTS.delayTimeout, () => {\n if (this.player._opt.heartTimeoutReplay &&\n (this._heartTimeoutReplayTimes < this.player._opt.heartTimeoutReplayTimes || this.player._opt.heartTimeoutReplayTimes === -1)) {\n this.debug.log('Jessibuca', `delay timeout replay time is ${this._heartTimeoutReplayTimes}`)\n this._heartTimeoutReplayTimes += 1;\n this.play(url, options).then(() => {\n // resolve();\n this._heartTimeoutReplayTimes = 0;\n }).catch(() => {\n // reject();\n });\n }\n })\n\n // 监听 loading timeout\n this.player.on(EVENTS.loadingTimeout, () => {\n if (this.player._opt.loadingTimeoutReplay &&\n (this._loadingTimeoutReplayTimes < this.player._opt.loadingTimeoutReplayTimes || this.player._opt.loadingTimeoutReplayTimes === -1)) {\n this.debug.log('Jessibuca', `loading timeout replay time is ${this._loadingTimeoutReplayTimes}`)\n this._loadingTimeoutReplayTimes += 1;\n this.play(url, options).then(() => {\n // resolve();\n this._loadingTimeoutReplayTimes = 0;\n }).catch(() => {\n // reject();\n });\n }\n })\n\n\n if (this.hasLoaded()) {\n this.player.play(url, options).then(() => {\n resolve();\n }).catch((e) => {\n this.debug.warn('Jessibuca', 'hasLoaded and play error', e)\n this.player && this.player.pause().then(() => {\n reject(e);\n })\n })\n } else {\n this.player.once(EVENTS.decoderWorkerInit, () => {\n this.player.play(url, options).then(() => {\n resolve();\n }).catch((e) => {\n this.debug.warn('Jessibuca', 'decoderWorkerInit and play error', e)\n this.player && this.player.pause().then(() => {\n reject(e);\n })\n })\n })\n }\n })\n }\n\n\n /**\n *\n */\n resize() {\n this.player.resize();\n }\n\n /**\n *\n * @param time {number} s\n */\n setBufferTime(time) {\n time = Number(time)\n // s -> ms\n this.player.updateOption({\n videoBuffer: time * 1000\n })\n // update worker config\n this.player.decoderWorker && this.player.decoderWorker.updateWorkConfig({\n key: 'videoBuffer',\n value: time * 1000\n })\n }\n\n /**\n *\n * @param deg {number}\n */\n setRotate(deg) {\n deg = parseInt(deg, 10)\n const list = [0, 90, 180, 270];\n if (this._opt.rotate === deg || list.indexOf(deg) === -1) {\n return;\n }\n this.player.updateOption({\n rotate: deg\n })\n this.resize();\n }\n\n /**\n *\n * @returns {boolean}\n */\n hasLoaded() {\n return this.player.loaded;\n }\n\n /**\n *\n */\n setKeepScreenOn() {\n this.player.updateOption({\n keepScreenOn: true\n })\n }\n\n /**\n *\n * @param flag {Boolean}\n */\n setFullscreen(flag) {\n const fullscreen = !!flag;\n if (this.player.fullscreen !== fullscreen) {\n this.player.fullscreen = fullscreen;\n }\n }\n\n /**\n *\n * @param filename {string}\n * @param format {string}\n * @param quality {number}\n * @param type {string} download,base64,blob\n */\n screenshot(filename, format, quality, type) {\n\n if (!this.player.video) {\n return ''\n }\n\n return this.player.video.screenshot(filename, format, quality, type)\n }\n\n /**\n *\n * @param fileName {string}\n * @param fileType {string}\n * @returns {Promise}\n */\n startRecord(fileName, fileType) {\n return new Promise((resolve, reject) => {\n if (this.player.playing) {\n this.player.startRecord(fileName, fileType)\n resolve();\n } else {\n reject();\n }\n })\n }\n\n stopRecordAndSave() {\n if (this.player.recording) {\n this.player.stopRecordAndSave();\n }\n }\n\n /**\n *\n * @returns {Boolean}\n */\n isPlaying() {\n return this.player ? this.player.playing : false;\n }\n\n /**\n * 是否静音状态\n * @returns {Boolean}\n */\n isMute() {\n return this.player.audio ? this.player.audio.isMute : true;\n }\n\n /**\n * 是否在录制视频\n * @returns {*}\n */\n isRecording() {\n return this.player.recorder.recording;\n }\n\n _checkHasCreated(element) {\n if (!element) return false;\n const gbProV = getElementDataset(element, CONTAINER_DATA_SET_KEY);\n if (gbProV) {\n return true;\n }\n return false;\n }\n\n\n toggleControlBar(isShow) {\n if (this.isDestroyed()) {\n return;\n }\n\n if (this.player) {\n this.player.toggleControlBar(isShow);\n }\n }\n\n getControlBarShow() {\n if (this.isDestroyed()) {\n return false;\n }\n let result = false;\n if (this.player) {\n result = this.player.getControlBarShow();\n }\n return result;\n }\n\n}\n\n\nwindow.Jessibuca = Jessibuca;\n\nexport default Jessibuca;\n\n"],"names":["PLAYER_PLAY_PROTOCOL","websocket","fetch","webrtc","DEMUX_TYPE","flv","m7s","FILE_SUFFIX","mp4","webm","CONTAINER_DATA_SET_KEY","VERSION","DEFAULT_PLAYER_OPTIONS","videoBuffer","videoBufferDelay","isResize","isFullResize","isFlv","debug","hotKey","loadingTimeout","heartTimeout","timeout","loadingTimeoutReplay","heartTimeoutReplay","loadingTimeoutReplayTimes","heartTimeoutReplayTimes","supportDblclickFullscreen","showBandwidth","keepScreenOn","isNotMute","hasAudio","hasVideo","operateBtns","fullscreen","screenshot","play","audio","record","controlAutoHide","hasControl","loadingText","background","decoder","url","rotate","forceNoOffscreen","hiddenAutoPause","protocol","demuxType","useWCS","wcsUseVideoRender","useMSE","useOffscreen","autoWasm","wasmDecodeErrorReplay","openWebglAlignment","wasmDecodeAudioSyncVideo","recordType","useWebFullScreen","WORKER_CMD_TYPE","init","initVideo","render","playAudio","initAudio","kBps","decode","audioCode","videoCode","wasmError","WASM_ERROR","invalidNalUnitSize","MEDIA_TYPE","video","FLV_MEDIA_TYPE","WORKER_SEND_TYPE","audioDecode","videoDecode","close","updateConfig","EVENTS","webFullscreen","decoderWorkerInit","playing","pause","mute","load","loading","videoInfo","timeUpdate","audioInfo","log","error","delayTimeout","stats","performance","recording","recordingTimestamp","recordStart","recordEnd","recordCreateError","buffer","videoFrame","start","metadata","resize","streamEnd","streamSuccess","streamMessage","streamError","volumechange","volume","destroy","mseSourceOpen","mseSourceClose","mseSourceBufferError","mseSourceBufferBusy","mseSourceBufferFull","videoWaiting","videoTimeUpdate","videoSyncAudio","playToRenderTimes","JESSIBUCA_EVENTS","EVENTS_ERROR","playError","fetchError","websocketError","webcodecsH265NotSupport","webcodecsConfigureError","webcodecsDecodeError","webcodecsWidthOrHeightChange","mediaSourceH265NotSupport","mediaSourceFull","mediaSourceAppendBufferError","mediaSourceBufferListLarge","mediaSourceAppendBufferEndTimeout","wasmDecodeError","webglAlignmentError","WEBSOCKET_STATUS","notConnect","open","SCREENSHOT_TYPE","download","base64","blob","VIDEO_ENC_TYPE","VIDEO_ENC_CODE","h264","h265","AUDIO_ENC_TYPE","CONTROL_HEIGHT","SCALE_MODE_TYPE","full","auto","fullAuto","CANVAS_RENDER_TYPE","webcodecs","webgl","offscreen","ENCODED_VIDEO_TYPE","key","delta","MP4_CODECS","avc","hev","MEDIA_SOURCE_STATE","ended","closed","AUDIO_SYNC_VIDEO_DIFF","HOT_KEY","esc","arrowUp","arrowDown","WCS_ERROR","keyframeIsRequiredError","canNotDecodeClosedCodec","FETCH_ERROR","abortError1","abortError2","abort","FRAME_HEADER_EX","PACKET_TYPE_EX","PACKET_TYPE_SEQ_START","PACKET_TYPE_FRAMES","PACKET_TYPE_FRAMESX","FRAME_TYPE_EX","FT_KEY","FT_INTER","Debug","constructor","master","name","_opt","args","console","warn","Events","destroys","proxy","bind","target","callback","option","Array","isArray","map","item","addEventListener","removeEventListener","push","forEach","event","player","Object","defineProperty","get","clientRect","$container","getBoundingClientRect","width","Math","max","clientWidth","height","clientHeight","rect","noop","supportOffscreen","$canvas","transferControlToOffscreen","supportOffscreenV2","OffscreenCanvas","createContextGL","gl","validContextNames","nameIndex","length","contextName","contextOptions","preserveDrawingBuffer","getContext","e","getParameter","dataURLToFile","dataURL","arr","split","bstr","atob","type","replace","n","u8arr","Uint8Array","charCodeAt","File","now","Date","getTime","WebAssembly","instantiate","module","Module","of","Instance","clamp","num","a","b","min","setStyle","element","value","keys","style","getStyle","numberType","getComputedStyle","getPropertyValue","parseFloat","getNowTime","calculationRate","totalSize","lastTime","size","thisTime","diffTime","isMobile","test","window","navigator","userAgent","toLowerCase","isPad","isAndroid","UA","supportWCS","uuid16","c","r","random","v","toString","formatVideoDecoderConfigure","avcC","codecArray","subarray","codecString","j","h","codec","description","isFullScreen","screenfull","isFullscreen","bpsSize","parseInt","isNaN","toFixed","fpsStatus","fps","result","createEmptyImageBitmap","$canvasElement","document","createElement","createImageBitmap","supportMSE","MediaSource","isTypeSupported","supportMediaStreamTrack","MediaStreamTrackGenerator","isEmpty","undefined","isBoolean","isNotEmpty","initPlayTimes","playInitStart","playStart","streamStart","streamResponse","demuxStart","decodeStart","videoStart","playTimestamp","streamTimestamp","streamResponseTimestamp","demuxTimestamp","decodeTimestamp","videoTimestamp","allTimestamp","formatTimeTips","time","hour","floor","sec","round","getTarget","srcElement","isWebglRenderSupport","getBrowser","UserAgent","browserInfo","browserArray","IE","ActiveXObject","Chrome","indexOf","Firefox","Opera","Safari","Edge","QQBrowser","WeixinBrowser","i","versions","match","mt","mimeTypes","version","closeVideoFrame","removeElement","parentNode","removeChild","hevcEncoderNalePacketNotLength","oneNALBuffer","isIframe","idrBit","nIdrBit","tmp","arrayBuffer","byteLength","set","isFalse","getElementDataset","dataset","getAttribute","setElementDataset","setAttribute","removeElementDataset","removeAttribute","screenfullChange","emit","on","events","off","loaded","request","then","catch","exit","classList","add","remove","ignoreList","stringList","includes","JSON","stringify","Emitter","fn","ctx","once","self","listener","apply","_","evtArr","slice","data","evts","liveEvents","len","vertexShaderScript","join","fragmentShaderScript","pixelStorei","UNPACK_ALIGNMENT","vertexShader","createShader","VERTEX_SHADER","shaderSource","compileShader","getShaderParameter","COMPILE_STATUS","getShaderInfoLog","fragmentShader","FRAGMENT_SHADER","program","createProgram","attachShader","linkProgram","getProgramParameter","LINK_STATUS","getProgramInfoLog","useProgram","vertexPosBuffer","createBuffer","bindBuffer","ARRAY_BUFFER","bufferData","Float32Array","STATIC_DRAW","vertexPosRef","getAttribLocation","enableVertexAttribArray","vertexAttribPointer","FLOAT","texturePosBuffer","texturePosRef","_initTexture","index","textureRef","createTexture","bindTexture","TEXTURE_2D","texParameteri","TEXTURE_MAG_FILTER","LINEAR","TEXTURE_MIN_FILTER","TEXTURE_WRAP_S","CLAMP_TO_EDGE","TEXTURE_WRAP_T","uniform1i","getUniformLocation","yTextureRef","uTextureRef","vTextureRef","w","y","u","viewport","activeTexture","TEXTURE0","texImage2D","LUMINANCE","UNSIGNED_BYTE","TEXTURE1","TEXTURE2","drawArrays","TRIANGLE_STRIP","deleteProgram","deleteBuffer","deleteTexture","CommonLoader","resetInit","encType","encTypeCode","$videoElement","updateVideoInfo","clearView","_global","global","this","bom","opts","autoBom","Blob","String","fromCharCode","xhr","XMLHttpRequest","responseType","onload","saveAs","response","onerror","send","corsEnabled","status","click","node","dispatchEvent","MouseEvent","evt","createEvent","initMouseEvent","isMacOSWebView","HTMLAnchorElement","prototype","URL","webkitURL","createElementNS","rel","href","origin","location","createObjectURL","setTimeout","revokeObjectURL","msSaveOrOpenBlob","popup","title","body","innerText","force","isSafari","HTMLElement","safari","isChromeIOS","FileReader","reader","onloadend","readAsDataURL","CanvasVideoLoader","position","top","left","appendChild","context2D","contextGl","contextGlRender","contextGlDestroy","bitmaprenderer","renderType","_initCanvasRender","_initContextGl","createWebGL","_initContext2D","_supportOffscreen","_bindOffscreen","initCanvasViewSize","msg","ts","transferFromImageBitmap","output","drawImage","filename","format","quality","formatType","png","jpeg","webp","encoderOptions","Number","toDataURL","file","imageBitMap","clear","COLOR_BUFFER_BIT","clearRect","isControlBarShow","resizeWidth","resizeHeight","wScale","hScale","scale","transform","VideoLoader","muted","disablePictureInPicture","poster","_delayPlay","trackGenerator","kind","srcObject","MediaStream","vwriter","writable","getWriter","canvasContext","fixChromeVideoFlashBug","_play","timeStamp","isPlaying","currentTime","src","stop","browser","backdropFilter","translateZ","readyState","_getVideoReadyState","isNow","$video","canvas","videoWidth","videoHeight","write","objectFill","objectFit","paused","Video","Loader","getLoaderFactory","opt","AudioContextLoader","bufferList","scriptNode","hasInitScriptNode","audioContextChannel","audioContext","AudioContext","webkitAudioContext","gainNode","createGain","source","createBufferSource","connect","destination","noteOn","audioBufferSourceNode","mediaStreamAudioDestinationNode","createMediaStreamDestination","audioEnabled","gain","_prevVolume","audioSyncVideoOption","diff","channels","sampleRate","options","closeAudio","onaudioprocess","updateAudioInfo","isMute","bufferSize","initScriptNode","createScriptProcessor","audioProcessingEvent","outputBuffer","bufferItem","shift","audioTimestamp","channel","nowBuffering","getChannelData","flag","setVolume","setValueAtTime","disconnect","state","resume","suspend","isStateRunning","isStateSuspended","Audio","FetchLoader","abortController","AbortController","streamRate","rate","fetchStream","demux","_times","fetchOptions","assign","signal","headers","res","getReader","fetchNext","read","done","dispatch","errorString","WebsocketLoader","socket","socketStatus","wsUrl","_createWebSocket","WebSocket","binaryType","_handleMessage","message","Stream","RecordRTCLoader","fileName","fileType","isRecording","recordingInterval","_reset","setFileName","recordTime","startRecord","mimeType","onTimeStamp","timestamp","disableLogs","stream","captureStream","audioStream","getAudioTracks","audioTrack","enabled","addTrack","recorder","RecordRTC","startRecording","setInterval","stopRecordAndSave","stopRecording","getBlob","clearInterval","Recorder","DecoderWorker","decoderWorker","Worker","_initDecoderWorker","postMessage","cmd","terminate","onmessage","_initWork","code","handleRender","updateStats","buf","delay","handlePlayToRenderTimes","emitError","decodeVideo","isIFrame","decodeAudio","_decodeAudioNoDelay","_decodeAudio","updateWorkConfig","config","stopId","firstTimestamp","startTimestamp","dropping","initInterval","getDelay","localTimestamp","timeTimestamp","resetDelay","_loop","mseDecoder","getSourceBufferUpdating","payload","_doDecoderDecode","_doDecode","cts","pushBuffer","webcodecsDecoder","_decodeEnhancedH265Video","flags","frameTypeEx","packetEx","codecId","ArrayBuffer","tmp32","Uint32Array","isAV1","extraData","payloadBuffer","_isEnhancedH265Header","FlvLoader","input","_inputFlv","flvDemux","dispatchFlvData","tmp8","t","abps","vbps","need","next","combine","remain","return","M7sLoader","dv","DataView","getUint8","getUint32","Demux","ExpGolomb","uint8array","TAG","_buffer","_buffer_index","_total_bytes","_total_bits","_current_word","_current_word_bits_left","_fillCurrentWord","buffer_bytes_left","bytes_read","word","readBits","bits","bits_need_left","bits_read_next","result2","readBool","readByte","_skipLeadingZero","zero_count","readUEG","leading_zeros","readSEG","SPSParser","_ebsp2rbsp","src_length","dst","dst_idx","parseSPS","rbsp","gb","profile_idc","level_idc","profile_string","getProfileString","level_string","getLevelString","chroma_format_idc","chroma_format","chroma_format_table","bit_depth","scaling_list_count","_skipScalingList","pic_order_cnt_type","num_ref_frames_in_pic_order_cnt_cycle","ref_frames","pic_width_in_mbs_minus1","pic_height_in_map_units_minus1","frame_mbs_only_flag","frame_crop_left_offset","frame_crop_right_offset","frame_crop_top_offset","frame_crop_bottom_offset","frame_cropping_flag","sar_width","sar_height","fps_fixed","fps_num","fps_den","vui_parameters_present_flag","aspect_ratio_idc","sar_w_table","sar_h_table","num_units_in_tick","time_scale","sarScale","crop_unit_x","crop_unit_y","sub_wc","sub_hc","codec_width","codec_height","present_width","ceil","chroma_format_string","getChromaFormatString","frame_rate","fixed","sar_ratio","codec_size","present_size","count","last_scale","next_scale","delta_scale","chroma","parseAVCDecoderConfigurationRecord","meta","avcProfile","_naluLengthSize","spsCount","offset","getUint16","sps","codecWidth","codecHeight","presentWidth","presentHeight","profile","level","bitDepth","chromaFormat","sarRatio","frameRate","refSampleDuration","timescale","ppsCount","videoType","WebcodecsDecoder","hasInit","isDecodeFirstIIframe","isInitInfo","initDecoder","_this","VideoDecoder","handleDecode","handleError","codedWidth","codedHeight","videoCodec","configure","chunk","EncodedVideoChunk","isDecodeStateClosed","iconsMap","fullscreenExit","recordStop","reduce","icons","control","insertAdjacentHTML","querySelector","object","display","overflow","pointerEvents","zIndex","playerWidth","playerHeight","contentDocument","defaultView","screenfullH5Control","setVolumeHandle","percentage","$volumeOn","$volumeOff","$volumeHandle","$volumePanel","panelHeight","handleHeight","$volumePanelText","innerHTML","$loading","$poster","$playBig","$fullscreenExit","$fullscreen","$controls","translateX","translateY","$record","$recordStop","$recording","$recordingTime","$play","$pause","$screenshot","$qualityMenu","$volume","$speed","bps","volumeChangeFromEvent","bottom","panelBottom","moveLen","composedPath","isFocus","stopPropagation","resumeAudioAfterPause","$volumePanelWrap","lastVolume","_lastVolume","isVolumeDroging","$recordingStop","startDelayControlHidden","stopDelayControlHidden","delayHiddenTimeout","clearTimeout","addHotkey","tag","activeElement","tagName","toUpperCase","editable","keyCode","preventDefault","Control","template","property","observer","hotkey","autoSize","padding","playerRatio","canvasWidth","canvasHeight","canvasRatio","toggleBar","getBarIsShow","nodeName","visibilityState","_isPlayingBeforePageHidden","enableWakeLock","MP4","types","avc1","hvc1","hvcC","btrt","dinf","dref","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a","mvex","mvhd","sdtp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trun","trex","tkhd","vmhd","smhd","hasOwnProperty","constants","FTYP","STSD_PREFIX","STTS","STSC","STCO","STSZ","HDLR_VIDEO","HDLR_AUDIO","DREF","SMHD","VMHD","box","datas","call","arguments","arrayCount","generateInitSegment","duration","trackId","id","xmhd","channelCount","audioSampleRate","configSize","concat","avcc","track","baseMediaDecodeTime","sequenceNumber","isLeading","dependsOn","isDependedOn","hasRedundancy","dataSize","isNonSync","MseDecoder","isAvc","mediaSource","sourceBuffer","cacheTrack","timeInit","mediaSourceOpen","firstRenderTime","mediaSourceAppendBufferFull","isStateOpen","isStateClosed","isStateEnded","_decodeConfigurationRecord","dts","_decodeVideo","metaData","metaBox","appendBuffer","bytes","buffered","removeBuffer","end","mdatBytes","mdatbox","moofbox","isKeyframe","addSourceBuffer","updating","abortSourceBuffer","removeSourceBuffer","endOfStream","dropSourceBuffer","isDropping","WEBM","oldIOS","exec","MSStream","nativeWakeLock","NoSleep","_wakeLock","handleVisibilityChange","enable","noSleepTimer","noSleepVideo","_addSourceToVideo","dataURI","isEnabled","wakeLock","err","disable","hidden","Promise","resolve","playPromise","release","Player","container","_hasControl","_loading","_playing","_hasLoaded","_checkHeartTimeout","_checkLoadingTimeout","_checkStatsInterval","_startBpsTime","_stats","_videoTimestamp","_audioTimestamp","_onlyMseOrWcsVideo","clearCheckHeartTimeout","clearCheckLoadingTimeout","clearStatsInterval","releaseWakeLock","resetStats","updateOption","contains","isDebug","reject","checkLoadingTimeout","checkStatsInterval","_close","hasBtnShow","text","checkHeart","checkHeartTimeout","_nowTime","getOption","errorType","getControlBarShow","toggleControlBar","isShow","Jessibuca","Error","_checkHasCreated","_loadingTimeoutReplayTimes","_heartTimeoutReplayTimes","_destroyed","_initPlayer","_bindEvents","_resetPlayer","isDestroyed","setDebug","cancelMute","audioResume","setScaleMode","playOptions","isHttp","hasLoaded","setBufferTime","setRotate","deg","list","setKeepScreenOn","setFullscreen","gbProV"],"mappings":";;;;;;;;;;;;;;;;;CAAA,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE;CAC1C,EAAE,IAAI,GAAG,IAAI,GAAG,EAAE;CAClB,IAAI,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE;CACpC,MAAM,KAAK,EAAE,KAAK;CAClB,MAAM,UAAU,EAAE,IAAI;CACtB,MAAM,YAAY,EAAE,IAAI;CACxB,MAAM,QAAQ,EAAE,IAAI;CACpB,KAAK,CAAC,CAAC;CACP,GAAG,MAAM;CACT,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;CACrB,GAAG;AACH;CACA,EAAE,OAAO,GAAG,CAAC;CACb,CAAC;AACD;CACA,cAAc,GAAG,eAAe,EAAE,yBAAyB,GAAG,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,OAAO;;;;;CCf9G;CACO,MAAMA,oBAAoB,GAAG;CAChCC,EAAAA,SAAS,EAAE,CADqB;CAEhCC,EAAAA,KAAK,EAAE,CAFyB;CAGhCC,EAAAA,MAAM,EAAE;CAHwB,CAA7B;CAMA,MAAMC,UAAU,GAAG;CACtBC,EAAAA,GAAG,EAAE,KAD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,MAAJ,EAAY;CACR,aAAO,IAAP;CACH;;CACD,WAAO,KAAP;CACH;;CAGDzB,EAAAA,gBAAgB,CAACC,MAAD,EAAS;CACrB,QAAI,KAAKU,WAAL,EAAJ,EAAwB;CACpB;CACH;;CAED,QAAI,KAAK9+B,MAAT,EAAiB;CACb,WAAKA,MAAL,CAAYm+B,gBAAZ,CAA6BC,MAA7B;CACH;CACJ;;CAEDF,EAAAA,iBAAiB,GAAG;CAChB,QAAI,KAAKY,WAAL,EAAJ,EAAwB;CACpB,aAAO,KAAP;CACH;;CACD,QAAIj4B,MAAM,GAAG,KAAb;;CACA,QAAI,KAAK7G,MAAT,EAAiB;CACb6G,MAAAA,MAAM,GAAG,KAAK7G,MAAL,CAAYk+B,iBAAZ,EAAT;CACH;;CACD,WAAOr3B,MAAP;CACH;;CAnyB2B;;iBAA1Bw3B,oBACa9jC;;iBADb8jC,sBAGe;CACbtqC,EAAAA,cAAc,EAAE6D,MAAM,CAAC7D,cADV;CAEb0E,EAAAA,YAAY,EAAEb,MAAM,CAACa;CAFR;;CAqyBrBoM,MAAM,CAACw5B,SAAP,GAAmBA,SAAnB;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"jessibuca.js","sources":["../../node_modules/@babel/runtime/helpers/defineProperty.js","../../src/constant/index.js","../../src/utils/debug.js","../../src/utils/events.js","../../src/player/property.js","../../node_modules/screenfull/dist/screenfull.js","../../src/utils/index.js","../../src/player/events.js","../../src/utils/emitter.js","../../src/utils/webgl.js","../../src/video/commonLoader.js","../../src/utils/file-save.js","../../src/video/canvasLoader.js","../../src/video/videoLoader.js","../../src/video/index.js","../../src/audio/audioContextLoader.js","../../src/audio/index.js","../../src/stream/fetchLoader.js","../../src/stream/websocketLoader.js","../../src/stream/index.js","../../node_modules/recordrtc/RecordRTC.js","../../src/recorder/recordRTCLoader.js","../../src/recorder/index.js","../../src/worker/index.js","../../src/demux/commonLoader.js","../../src/demux/flvLoader.js","../../src/demux/m7sLoader.js","../../src/demux/index.js","../../src/utils/exp-golomb.js","../../src/utils/h264-sps-parser.js","../../src/utils/h264.js","../../src/decoder/webcodecs.js","../../src/control/icons.js","../../src/control/template.js","../../src/control/observer.js","../../src/control/property.js","../../src/control/events.js","../../node_modules/style-inject/dist/style-inject.es.js","../../src/control/hotkey.js","../../src/control/index.js","../../src/player/observer.js","../../src/remux/fmp4-generator.js","../../src/decoder/mediaSource.js","../../src/utils/noSleep.js","../../src/player/index.js","../../src/jessibuca.js"],"sourcesContent":["function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","// 播放协议\nexport const PLAYER_PLAY_PROTOCOL = {\n websocket: 0,\n fetch: 1,\n webrtc: 2,\n}\n\nexport const DEMUX_TYPE = {\n flv: 'flv',\n m7s: 'm7s'\n}\n\nexport const FILE_SUFFIX = {\n mp4: 'mp4',\n webm: 'webm'\n};\n\nexport const MEDIA_SOURCE_UPDATE_END_TIMEOUT = 10 * 1000\n\nexport const CONTAINER_DATA_SET_KEY = 'jessibuca'\n\nexport const VERSION = '__VERSION__'\n\n\n// default player options\nexport const DEFAULT_PLAYER_OPTIONS = {\n videoBuffer: 1000, //1000ms 1 second\n videoBufferDelay: 1000,// 1000ms\n isResize: true,\n isFullResize: false, //\n isFlv: false,\n debug: false,\n hotKey: false, // 快捷键\n loadingTimeout: 10, // loading timeout\n heartTimeout: 5, // heart timeout\n timeout: 10, // second\n loadingTimeoutReplay: true, // loading timeout replay. default is true\n heartTimeoutReplay: true,// heart timeout replay.\n loadingTimeoutReplayTimes: 3, // loading timeout replay fail times\n heartTimeoutReplayTimes: 3, // heart timeout replay fail times\n supportDblclickFullscreen: false, // support double click toggle fullscreen\n showBandwidth: false, // show band width\n keepScreenOn: false, //\n isNotMute: false, //\n hasAudio: true, // has audio\n hasVideo: true, // has video\n operateBtns: {\n fullscreen: false,\n screenshot: false,\n play: false,\n audio: false,\n record: false,\n },\n controlAutoHide: false, // control auto hide\n hasControl: false,\n loadingText: '', // loading Text\n background: '',\n decoder: 'decoder.js',\n url: '',// play url\n rotate: 0, //\n // text: '',\n forceNoOffscreen: true, // 默认是不采用\n hiddenAutoPause: false, //\n protocol: PLAYER_PLAY_PROTOCOL.fetch,\n demuxType: DEMUX_TYPE.flv, // demux type\n useWCS: false, //\n wcsUseVideoRender: false,// 默认设置为true\n useMSE: false, //\n useOffscreen: false, //\n autoWasm: true, // 自动降级到 wasm 模式\n wasmDecodeErrorReplay: true, // 解码失败重新播放。\n openWebglAlignment: false,// https://github.com/langhuihui/jessibuca/issues/152\n wasmDecodeAudioSyncVideo: false,// wasm 解码之后音视频同步\n recordType: FILE_SUFFIX.webm,\n useWebFullScreen: false, // use web full screen\n initDecoderWorkerTimeout: 10 //\n}\n\n\nexport const WORKER_CMD_TYPE = {\n init: 'init',\n initVideo: 'initVideo',\n render: 'render',\n playAudio: 'playAudio',\n initAudio: 'initAudio',\n kBps: 'kBps',\n decode: 'decode',\n audioCode: 'audioCode',\n videoCode: 'videoCode',\n wasmError: 'wasmError'\n}\n\nexport const WASM_ERROR = {\n invalidNalUnitSize: 'Invalid NAL unit size',\n // errorSplittingTheInputIntoNALUnits: 'Error splitting the input into NAL units'\n}\n\nexport const MEDIA_TYPE = {\n audio: 1,\n video: 2\n}\n\nexport const FLV_MEDIA_TYPE = {\n audio: 8,\n video: 9\n}\n\nexport const WORKER_SEND_TYPE = {\n init: 'init',\n decode: 'decode',\n audioDecode: 'audioDecode',\n videoDecode: 'videoDecode',\n close: 'close',\n updateConfig: 'updateConfig'\n}\n\n\n//\nexport const EVENTS = {\n fullscreen: 'fullscreen$2',\n webFullscreen: 'webFullscreen',\n decoderWorkerInit: 'decoderWorkerInit',\n play: 'play',\n playing: 'playing',\n pause: 'pause',\n mute: 'mute',\n load: 'load',\n loading: 'loading',\n videoInfo: 'videoInfo',\n timeUpdate: 'timeUpdate',\n audioInfo: \"audioInfo\",\n log: 'log',\n error: \"error\",\n kBps: 'kBps',\n timeout: 'timeout',\n delayTimeout: 'delayTimeout',\n loadingTimeout: 'loadingTimeout',\n stats: 'stats',\n performance: \"performance\",\n record: 'record',\n recording: 'recording',\n recordingTimestamp: 'recordingTimestamp',\n recordStart: 'recordStart',\n recordEnd: 'recordEnd',\n recordCreateError: 'recordCreateError',\n buffer: 'buffer',\n videoFrame: 'videoFrame',\n start: 'start',\n metadata: 'metadata',\n resize: 'resize',\n streamEnd: 'streamEnd',\n streamSuccess: 'streamSuccess',\n streamMessage: 'streamMessage',\n streamError: 'streamError',\n volumechange: 'volumechange',\n volume: 'volume',\n destroy: 'destroy',\n mseSourceOpen: 'mseSourceOpen',\n mseSourceClose: 'mseSourceClose',\n mseSourceBufferError: 'mseSourceBufferError',\n mseSourceBufferBusy: 'mseSourceBufferBusy',\n mseSourceBufferFull: 'mseSourceBufferFull',\n videoWaiting: 'videoWaiting',\n videoTimeUpdate: 'videoTimeUpdate',\n videoSyncAudio: 'videoSyncAudio',\n playToRenderTimes: 'playToRenderTimes'\n}\n\n\nexport const JESSIBUCA_EVENTS = {\n load: EVENTS.load,\n timeUpdate: EVENTS.timeUpdate,\n videoInfo: EVENTS.videoInfo,\n audioInfo: EVENTS.audioInfo,\n error: EVENTS.error,\n kBps: EVENTS.kBps,\n log: EVENTS.log,\n start: EVENTS.start,\n timeout: EVENTS.timeout,\n loadingTimeout: EVENTS.loadingTimeout,\n delayTimeout: EVENTS.delayTimeout,\n fullscreen: 'fullscreen',\n webFullscreen: EVENTS.webFullscreen,\n play: EVENTS.play,\n pause: EVENTS.pause,\n mute: EVENTS.mute,\n stats: EVENTS.stats,\n volumechange: EVENTS.volumechange,\n performance: EVENTS.performance,\n recordingTimestamp: EVENTS.recordingTimestamp,\n recordStart: EVENTS.recordStart,\n recordEnd: EVENTS.recordEnd,\n playToRenderTimes: EVENTS.playToRenderTimes,\n volume: EVENTS.volume\n}\n\nexport const EVENTS_ERROR = {\n playError: 'playIsNotPauseOrUrlIsNull',\n fetchError: \"fetchError\",\n websocketError: 'websocketError',\n webcodecsH265NotSupport: 'webcodecsH265NotSupport',\n webcodecsConfigureError: 'webcodecsConfigureError',\n webcodecsDecodeError: 'webcodecsDecodeError',\n webcodecsWidthOrHeightChange: 'webcodecsWidthOrHeightChange',\n mediaSourceH265NotSupport: 'mediaSourceH265NotSupport',\n mediaSourceFull: EVENTS.mseSourceBufferFull,\n mseSourceBufferError: EVENTS.mseSourceBufferError,\n mediaSourceAppendBufferError: 'mediaSourceAppendBufferError',\n mediaSourceBufferListLarge: 'mediaSourceBufferListLarge',\n mediaSourceAppendBufferEndTimeout: 'mediaSourceAppendBufferEndTimeout',\n wasmDecodeError: 'wasmDecodeError',\n webglAlignmentError: 'webglAlignmentError'\n}\n\n\nexport const WEBSOCKET_STATUS = {\n notConnect: 'notConnect',\n open: 'open',\n close: 'close',\n error: 'error'\n}\n\nexport const BUFFER_STATUS = {\n empty: 'empty',\n buffering: 'buffering',\n full: 'full'\n}\n\n\nexport const SCREENSHOT_TYPE = {\n download: 'download',\n base64: 'base64',\n blob: 'blob'\n}\n\n\nexport const VIDEO_ENC_TYPE = {\n 7: 'H264(AVC)', //\n 12: 'H265(HEVC)' //\n}\n\nexport const VIDEO_ENC_CODE = {\n h264: 7,\n h265: 12\n}\n\n\nexport const AUDIO_ENC_TYPE = {\n 10: 'AAC',\n 7: 'ALAW',\n 8: 'MULAW'\n}\n\nexport const H265_NAL_TYPE = {\n vps: 32,\n sps: 33,\n pps: 34\n}\n\nexport const CONTROL_HEIGHT = 38\n\nexport const SCALE_MODE_TYPE = {\n full: 0, // 视频画面完全填充canvas区域,画面会被拉伸\n auto: 1, // 视频画面做等比缩放后,高或宽对齐canvas区域,画面不被拉伸,但有黑边\n fullAuto: 2 // 视频画面做等比缩放后,完全填充canvas区域,画面不被拉伸,没有黑边,但画面显示不全\n}\n\n\nexport const CANVAS_RENDER_TYPE = {\n webcodecs: 'webcodecs',\n webgl: 'webgl',\n offscreen: 'offscreen'\n}\n\nexport const ENCODED_VIDEO_TYPE = {\n key: 'key',\n delta: 'delta'\n}\n\n\nexport const MP4_CODECS = {\n avc: 'video/mp4; codecs=\"avc1.64002A\"',\n hev: 'video/mp4; codecs=\"hev1.1.6.L123.b0\"',\n}\n\n\nexport const MEDIA_SOURCE_STATE = {\n ended: 'ended',\n open: 'open',\n closed: 'closed'\n}\n\n\n// frag duration\nexport const FRAG_DURATION = Math.ceil(1000 / 25)\n\n\nexport const AUDIO_SYNC_VIDEO_DIFF = 1000;\n\n\nexport const HOT_KEY = {\n esc: 27, //\n arrowUp: 38, //\n arrowDown: 40, //\n}\nexport const WCS_ERROR = {\n keyframeIsRequiredError: 'A key frame is required after configure() or flush()',\n canNotDecodeClosedCodec: \"Cannot call 'decode' on a closed codec\"\n}\n\n\nexport const FETCH_ERROR = {\n abortError1: 'The user aborted a request',\n abortError2: 'AbortError',\n abort: 'AbortError'\n}\n\nexport const FRAME_HEADER_EX = 0x80\n\n\nexport const PACKET_TYPE_EX = {\n PACKET_TYPE_SEQ_START: 0,\n PACKET_TYPE_FRAMES: 1,\n PACKET_TYPE_FRAMESX: 3,\n};\n\n\nexport const FRAME_TYPE_EX = {\n FT_KEY: 0x10,\n FT_INTER: 0x20\n};\n\n\n\n","export default class Debug {\n constructor(master) {\n this.log = (name, ...args) => {\n if (master._opt && master._opt.debug) {\n console.log(`Jb: [${name}]`, ...args);\n }\n };\n\n this.warn = (name, ...args) => {\n if (master._opt && master._opt.debug) {\n console.warn(`Jb: [${name}]`, ...args);\n }\n };\n\n this.error = (name, ...args) => {\n console.error(`Jb: [${name}]`, ...args);\n };\n }\n}\n","export default class Events {\n constructor(master) {\n this.destroys = [];\n this.proxy = this.proxy.bind(this);\n this.master = master;\n }\n\n proxy(target, name, callback, option = {}) {\n if (!target) {\n return;\n }\n if (Array.isArray(name)) {\n return name.map(item => this.proxy(target, item, callback, option));\n }\n target.addEventListener(name, callback, option);\n const destroy = () => target.removeEventListener(name, callback, option);\n this.destroys.push(destroy);\n return destroy;\n }\n\n destroy() {\n this.master.debug && this.master.debug.log(`Events`, 'destroy');\n this.destroys.forEach(event => event());\n }\n}\n","export default (player) => {\n Object.defineProperty(player, 'rect', {\n get: () => {\n const clientRect = player.$container.getBoundingClientRect()\n clientRect.width = Math.max(clientRect.width, player.$container.clientWidth);\n clientRect.height = Math.max(clientRect.height, player.$container.clientHeight);\n return clientRect;\n },\n });\n\n ['bottom', 'height', 'left', 'right', 'top', 'width'].forEach(key => {\n Object.defineProperty(player, key, {\n get: () => {\n return player.rect[key];\n },\n });\n });\n}\n","/*!\n* screenfull\n* v5.1.0 - 2020-12-24\n* (c) Sindre Sorhus; MIT License\n*/\n(function () {\n\t'use strict';\n\n\tvar document = typeof window !== 'undefined' && typeof window.document !== 'undefined' ? window.document : {};\n\tvar isCommonjs = typeof module !== 'undefined' && module.exports;\n\n\tvar fn = (function () {\n\t\tvar val;\n\n\t\tvar fnMap = [\n\t\t\t[\n\t\t\t\t'requestFullscreen',\n\t\t\t\t'exitFullscreen',\n\t\t\t\t'fullscreenElement',\n\t\t\t\t'fullscreenEnabled',\n\t\t\t\t'fullscreenchange',\n\t\t\t\t'fullscreenerror'\n\t\t\t],\n\t\t\t// New WebKit\n\t\t\t[\n\t\t\t\t'webkitRequestFullscreen',\n\t\t\t\t'webkitExitFullscreen',\n\t\t\t\t'webkitFullscreenElement',\n\t\t\t\t'webkitFullscreenEnabled',\n\t\t\t\t'webkitfullscreenchange',\n\t\t\t\t'webkitfullscreenerror'\n\n\t\t\t],\n\t\t\t// Old WebKit\n\t\t\t[\n\t\t\t\t'webkitRequestFullScreen',\n\t\t\t\t'webkitCancelFullScreen',\n\t\t\t\t'webkitCurrentFullScreenElement',\n\t\t\t\t'webkitCancelFullScreen',\n\t\t\t\t'webkitfullscreenchange',\n\t\t\t\t'webkitfullscreenerror'\n\n\t\t\t],\n\t\t\t[\n\t\t\t\t'mozRequestFullScreen',\n\t\t\t\t'mozCancelFullScreen',\n\t\t\t\t'mozFullScreenElement',\n\t\t\t\t'mozFullScreenEnabled',\n\t\t\t\t'mozfullscreenchange',\n\t\t\t\t'mozfullscreenerror'\n\t\t\t],\n\t\t\t[\n\t\t\t\t'msRequestFullscreen',\n\t\t\t\t'msExitFullscreen',\n\t\t\t\t'msFullscreenElement',\n\t\t\t\t'msFullscreenEnabled',\n\t\t\t\t'MSFullscreenChange',\n\t\t\t\t'MSFullscreenError'\n\t\t\t]\n\t\t];\n\n\t\tvar i = 0;\n\t\tvar l = fnMap.length;\n\t\tvar ret = {};\n\n\t\tfor (; i < l; i++) {\n\t\t\tval = fnMap[i];\n\t\t\tif (val && val[1] in document) {\n\t\t\t\tfor (i = 0; i < val.length; i++) {\n\t\t\t\t\tret[fnMap[0][i]] = val[i];\n\t\t\t\t}\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t})();\n\n\tvar eventNameMap = {\n\t\tchange: fn.fullscreenchange,\n\t\terror: fn.fullscreenerror\n\t};\n\n\tvar screenfull = {\n\t\trequest: function (element, options) {\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\tvar onFullScreenEntered = function () {\n\t\t\t\t\tthis.off('change', onFullScreenEntered);\n\t\t\t\t\tresolve();\n\t\t\t\t}.bind(this);\n\n\t\t\t\tthis.on('change', onFullScreenEntered);\n\n\t\t\t\telement = element || document.documentElement;\n\n\t\t\t\tvar returnPromise = element[fn.requestFullscreen](options);\n\n\t\t\t\tif (returnPromise instanceof Promise) {\n\t\t\t\t\treturnPromise.then(onFullScreenEntered).catch(reject);\n\t\t\t\t}\n\t\t\t}.bind(this));\n\t\t},\n\t\texit: function () {\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\tif (!this.isFullscreen) {\n\t\t\t\t\tresolve();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar onFullScreenExit = function () {\n\t\t\t\t\tthis.off('change', onFullScreenExit);\n\t\t\t\t\tresolve();\n\t\t\t\t}.bind(this);\n\n\t\t\t\tthis.on('change', onFullScreenExit);\n\n\t\t\t\tvar returnPromise = document[fn.exitFullscreen]();\n\n\t\t\t\tif (returnPromise instanceof Promise) {\n\t\t\t\t\treturnPromise.then(onFullScreenExit).catch(reject);\n\t\t\t\t}\n\t\t\t}.bind(this));\n\t\t},\n\t\ttoggle: function (element, options) {\n\t\t\treturn this.isFullscreen ? this.exit() : this.request(element, options);\n\t\t},\n\t\tonchange: function (callback) {\n\t\t\tthis.on('change', callback);\n\t\t},\n\t\tonerror: function (callback) {\n\t\t\tthis.on('error', callback);\n\t\t},\n\t\ton: function (event, callback) {\n\t\t\tvar eventName = eventNameMap[event];\n\t\t\tif (eventName) {\n\t\t\t\tdocument.addEventListener(eventName, callback, false);\n\t\t\t}\n\t\t},\n\t\toff: function (event, callback) {\n\t\t\tvar eventName = eventNameMap[event];\n\t\t\tif (eventName) {\n\t\t\t\tdocument.removeEventListener(eventName, callback, false);\n\t\t\t}\n\t\t},\n\t\traw: fn\n\t};\n\n\tif (!fn) {\n\t\tif (isCommonjs) {\n\t\t\tmodule.exports = {isEnabled: false};\n\t\t} else {\n\t\t\twindow.screenfull = {isEnabled: false};\n\t\t}\n\n\t\treturn;\n\t}\n\n\tObject.defineProperties(screenfull, {\n\t\tisFullscreen: {\n\t\t\tget: function () {\n\t\t\t\treturn Boolean(document[fn.fullscreenElement]);\n\t\t\t}\n\t\t},\n\t\telement: {\n\t\t\tenumerable: true,\n\t\t\tget: function () {\n\t\t\t\treturn document[fn.fullscreenElement];\n\t\t\t}\n\t\t},\n\t\tisEnabled: {\n\t\t\tenumerable: true,\n\t\t\tget: function () {\n\t\t\t\t// Coerce to boolean in case of old WebKit\n\t\t\t\treturn Boolean(document[fn.fullscreenEnabled]);\n\t\t\t}\n\t\t}\n\t});\n\n\tif (isCommonjs) {\n\t\tmodule.exports = screenfull;\n\t} else {\n\t\twindow.screenfull = screenfull;\n\t}\n})();\n","import {MP4_CODECS, FILE_SUFFIX} from \"../constant\";\nimport screenfull from \"screenfull\";\n\nexport function noop() {\n}\n\n\nexport function supportOffscreen($canvas) {\n return typeof $canvas.transferControlToOffscreen === 'function';\n}\n\n\nexport function supportOffscreenV2() {\n return typeof OffscreenCanvas !== \"undefined\";\n}\n\n\nexport function createContextGL($canvas) {\n let gl = null;\n\n const validContextNames = [\"webgl\", \"experimental-webgl\", \"moz-webgl\", \"webkit-3d\"];\n let nameIndex = 0;\n\n while (!gl && nameIndex < validContextNames.length) {\n const contextName = validContextNames[nameIndex];\n\n try {\n let contextOptions = {preserveDrawingBuffer: true};\n gl = $canvas.getContext(contextName, contextOptions);\n } catch (e) {\n gl = null;\n }\n\n if (!gl || typeof gl.getParameter !== \"function\") {\n gl = null;\n }\n\n ++nameIndex;\n }\n\n\n return gl;\n}\n\n\nexport function audioContextUnlock(context) {\n context.resume();\n const source = context.createBufferSource();\n source.buffer = context.createBuffer(1, 1, 22050);\n source.connect(context.destination);\n if (source.noteOn) {\n source.noteOn(0);\n } else {\n source.start(0);\n }\n}\n\nexport function dataURLToFile(dataURL = '') {\n const arr = dataURL.split(\",\");\n const bstr = atob(arr[1]);\n const type = arr[0].replace(\"data:\", \"\").replace(\";base64\", \"\")\n let n = bstr.length, u8arr = new Uint8Array(n);\n while (n--) {\n u8arr[n] = bstr.charCodeAt(n);\n }\n return new File([u8arr], 'file', {type});\n}\n\nexport function downloadFile(file, fileName) {\n if (file instanceof Blob || file instanceof File) {\n file = new Blob([file]);\n }\n const aLink = document.createElement(\"a\");\n aLink.download = fileName;\n aLink.href = file;\n aLink.click();\n}\n\n\nexport function downloadImg(content, fileName) {\n const aLink = document.createElement(\"a\");\n aLink.download = fileName;\n const href = URL.createObjectURL(content);\n aLink.href = href;\n aLink.click();\n setTimeout(() => {\n URL.revokeObjectURL(href);\n }, isIOS() ? 1000 : 0)\n}\n\nexport function checkFull() {\n let isFull = document.fullscreenElement || window.webkitFullscreenElement || document.msFullscreenElement;\n if (isFull === undefined) isFull = false;\n return !!isFull;\n}\n\nexport function now() {\n return new Date().getTime();\n}\n\nexport const supportedWasm = (() => {\n try {\n if (typeof WebAssembly === \"object\"\n && typeof WebAssembly.instantiate === \"function\") {\n const module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));\n if (module instanceof WebAssembly.Module)\n return new WebAssembly.Instance(module) instanceof WebAssembly.Instance;\n }\n } catch (e) {\n }\n return false;\n})();\n\nexport function clamp(num, a, b) {\n return Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b));\n}\n\nexport function setStyle(element, key, value) {\n if (!element) {\n return\n }\n if (typeof key === 'object') {\n Object.keys(key).forEach(item => {\n setStyle(element, item, key[item]);\n });\n }\n element.style[key] = value;\n return element;\n}\n\n\nexport function getStyle(element, key, numberType = true) {\n if (!element) {\n return 0\n }\n\n const value = getComputedStyle(element, null).getPropertyValue(key);\n return numberType ? parseFloat(value) : value;\n}\n\nexport function getNowTime() {\n if (performance && typeof performance.now === 'function') {\n return performance.now();\n }\n return Date.now();\n}\n\nexport function calculationRate(callback) {\n let totalSize = 0;\n let lastTime = getNowTime();\n return size => {\n totalSize += size;\n const thisTime = getNowTime();\n const diffTime = thisTime - lastTime;\n if (diffTime >= 1000) {\n callback((totalSize / diffTime) * 1000);\n lastTime = thisTime;\n totalSize = 0;\n }\n };\n}\n\nexport function downloadRecord(blob, name, suffix) {\n const url = window.URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = (name || now()) + '.' + (suffix || FILE_SUFFIX.webm);\n a.click();\n setTimeout(() => {\n window.URL.revokeObjectURL(url);\n }, isIOS() ? 1000 : 0)\n}\n\nexport const env = '__ENV__';\n\nexport function isMobile() {\n return (/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase()));\n}\n\nexport function isPad(){\n return (/ipad|android(?!.*mobile)|tablet|kindle|silk/i.test(window.navigator.userAgent.toLowerCase()));\n}\n\nexport function isAndroid() {\n const UA = window.navigator.userAgent.toLowerCase();\n return (/android/i.test(UA));\n}\n\nexport function isIOS() {\n const UA = window.navigator.userAgent.toLowerCase();\n return UA && /iphone|ipad|ipod|ios/.test(UA);\n}\n\n\nexport function parseTime(time, cFormat) {\n if (arguments.length === 0) {\n return null\n }\n var format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'\n var date;\n if (typeof time === 'object') {\n date = time\n } else {\n if (('' + time).length === 10) time = parseInt(time) * 1000;\n time = +time; // 转成int 型\n date = new Date(time)\n }\n var formatObj = {\n y: date.getFullYear(),\n m: date.getMonth() + 1,\n d: date.getDate(),\n h: date.getHours(),\n i: date.getMinutes(),\n s: date.getSeconds(),\n a: date.getDay()\n };\n var time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {\n var value = formatObj[key]\n if (key === 'a') return ['一', '二', '三', '四', '五', '六', '日'][value - 1]\n if (result.length > 0 && value < 10) {\n value = '0' + value\n }\n return value || 0\n });\n return time_str\n}\n\n// 是否支持 webcodecs\nexport function supportWCS() {\n return \"VideoEncoder\" in window;\n}\n\nexport function toNumber(value) {\n if (typeof value !== 'string') {\n return value;\n } else {\n // 转换成 number 类型\n var parsed = Number(value);\n return isNaN(parsed) ? value : parsed;\n }\n}\n\nexport function uuid16() {\n return 'xxxxxxxxxxxx4xxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8)\n return v.toString(16)\n })\n}\n\nexport function throttle(callback, delay) {\n let isThrottled = false;\n let args;\n let context;\n\n function fn(...args2) {\n if (isThrottled) {\n args = args2;\n context = this;\n return;\n }\n\n isThrottled = true;\n callback.apply(this, args2);\n setTimeout(() => {\n isThrottled = false;\n if (args) {\n fn.apply(context, args);\n args = null;\n context = null;\n }\n }, delay);\n }\n\n return fn;\n}\n\n\nexport function isDef(v) {\n return v !== undefined && v !== null;\n}\n\nexport function formatVideoDecoderConfigure(avcC) {\n let codecArray = avcC.subarray(1, 4);\n let codecString = \"avc1.\";\n for (let j = 0; j < 3; j++) {\n let h = codecArray[j].toString(16);\n if (h.length < 2) {\n h = \"0\" + h\n }\n codecString += h\n }\n\n return {\n codec: codecString,\n description: avcC\n }\n}\n\nexport function isFullScreen() {\n return screenfull.isFullscreen\n}\n\nexport function bpsSize(value) {\n if (null == value || value === '' || parseInt(value) === 0 || isNaN(parseInt(value))) {\n return \"0KB/s\";\n }\n let size = parseFloat(value);\n size = size.toFixed(2);\n return size + 'KB/s';\n}\n\n\nexport function fpsStatus(fps) {\n let result = 0;\n if (fps >= 24) {\n result = 2;\n } else if (fps >= 15) {\n result = 1;\n }\n\n return result;\n}\n\nexport function createEmptyImageBitmap(width, height) {\n const $canvasElement = document.createElement(\"canvas\");\n $canvasElement.width = width;\n $canvasElement.height = height;\n return window.createImageBitmap($canvasElement, 0, 0, width, height);\n}\n\n\nexport function supportMSE() {\n return window.MediaSource && window.MediaSource.isTypeSupported(MP4_CODECS.avc);\n}\n\nexport function supportMediaStreamTrack() {\n return window.MediaStreamTrackGenerator && typeof window.MediaStreamTrackGenerator === 'function'\n}\n\n\nexport function formatMp4VideoCodec(codec) {\n return `video/mp4; codecs=\"${codec}\"`\n}\n\n\nexport function saveBlobToFile(fileName, blob) {\n let url = window.URL.createObjectURL(blob);\n let aLink = window.document.createElement('a');\n aLink.download = fileName;\n aLink.href = url;\n //创建内置事件并触发\n let evt = window.document.createEvent('MouseEvents');\n evt.initEvent(\"click\", true, true); //initEvent 不加后两个参数在FF下会报错 事件类型,是否冒泡,是否阻止浏览器的默认行为\n aLink.dispatchEvent(evt);\n setTimeout(() => {\n window.URL.revokeObjectURL(url);\n }, isIOS() ? 1000 : 0)\n}\n\nexport function isEmpty(value) {\n return value === null || value === undefined\n}\n\nexport function isBoolean(value) {\n return value === true || value === false;\n}\n\nexport function isNotEmpty(value) {\n return !isEmpty(value)\n}\n\nexport function initPlayTimes() {\n return {\n playInitStart: '', //1\n playStart: '', // 2\n streamStart: '', //3\n streamResponse: '', // 4\n demuxStart: '', // 5\n decodeStart: '', // 6\n videoStart: '', // 7\n playTimestamp: '',// playStart- playInitStart\n streamTimestamp: '',// streamStart - playStart\n streamResponseTimestamp: '',// streamResponse - streamStart\n demuxTimestamp: '', // demuxStart - streamResponse\n decodeTimestamp: '', // decodeStart - demuxStart\n videoTimestamp: '',// videoStart - decodeStart\n allTimestamp: '' // videoStart - playInitStart\n }\n}\n\n// create watermark\nexport function createWatermark(options) {\n let defaultConfig = {\n container: '',\n left: '',\n right: '',\n top: '',\n bottom: '',\n image: {\n src: '',\n width: '100',\n height: '60',\n },\n text: {\n content: '',\n fontSize: '14',\n color: '#000'\n },\n }\n defaultConfig = Object.assign(defaultConfig, options)\n\n const $container = defaultConfig.container;\n\n if ($container) {\n return\n }\n\n let shadowRoot = null;\n const otDiv = document.createElement('div');\n otDiv.setAttribute('style', 'pointer-events: none !important; display: block !important');\n\n if (typeof otDiv.attachShadow === \"function\") {\n shadowRoot = otDiv.attachShadow({mode: 'open'});\n } else if (otDiv.shadowRoot) {\n shadowRoot = otDiv.shadowRoot;\n } else {\n shadowRoot = otDiv;\n }\n\n const nodeList = $container.children;\n const index = Math.floor(Math.random() * (nodeList.length - 1));\n\n if (nodeList[index]) {\n $container.insertBefore(otDiv, nodeList[index]);\n } else {\n $container.appendChild(otDiv);\n }\n\n\n const maskDiv = document.createElement('div');\n let innerDom = null;\n if (defaultConfig.text && defaultConfig.text.content) {\n innerDom = document.createTextNode(defaultConfig.text);\n } else if (defaultConfig.image && defaultConfig.image.src) {\n innerDom = document.createElement('img')\n innerDom.style.height = '100%'\n innerDom.style.width = '100%'\n innerDom.src = defaultConfig.image.src;\n }\n\n if (!innerDom) {\n return;\n }\n\n maskDiv.appendChild(innerDom);\n\n maskDiv.style.visibility = '';\n maskDiv.style.position = \"absolute\";\n maskDiv.style.display = 'block'\n maskDiv.style['-ms-user-select'] = \"none\";\n maskDiv.style.left = defaultConfig.left;\n maskDiv.style.right = defaultConfig.right;\n maskDiv.style.top = defaultConfig.top;\n maskDiv.style.bottom = defaultConfig.bottom;\n maskDiv.style.overflow = 'hidden';\n maskDiv.style.zIndex = \"9999999\";\n if (defaultConfig.text && defaultConfig.text.content) {\n maskDiv.style.fontSize = defaultConfig.text.fontSize;\n maskDiv.style.color = defaultConfig.text.color;\n } else if (defaultConfig.image && defaultConfig.image.src) {\n maskDiv.style.width = defaultConfig.image.width + 'px';\n maskDiv.style.height = defaultConfig.image.height + 'px';\n }\n\n shadowRoot.appendChild(maskDiv)\n\n // remove function\n return () => {\n $container.removeChild(otDiv);\n }\n}\n\nexport function formatTimeTips(time) {\n var result;\n\n //\n if (time > -1) {\n var hour = Math.floor(time / 3600);\n var min = Math.floor(time / 60) % 60;\n var sec = time % 60;\n\n sec = Math.round(sec);\n\n if (hour < 10) {\n result = '0' + hour + \":\";\n } else {\n result = hour + \":\";\n }\n\n if (min < 10) {\n result += \"0\";\n }\n result += min + \":\";\n if (sec < 10) {\n result += \"0\";\n }\n result += sec.toFixed(0);\n }\n\n return result;\n}\n\nexport function getTarget(e) {\n const event = e || window.event;\n const target = event.target || event.srcElement;\n return target;\n}\n\nexport function isWebglRenderSupport(width) {\n return (width / 2) % 4 === 0\n}\n\nexport function isGreenYUV(arrayBuffer) {\n let zeroNum = 0;\n for (let i = 0; i < 10; i++) {\n let temp = arrayBuffer[i];\n if (temp === 0) {\n zeroNum += 1\n }\n }\n return zeroNum === 10;\n}\n\nexport function getBrowser() {\n const UserAgent = navigator.userAgent.toLowerCase();\n const browserInfo = {};\n const browserArray = {\n IE: window.ActiveXObject || \"ActiveXObject\" in window, // IE\n Chrome: UserAgent.indexOf('chrome') > -1 && UserAgent.indexOf('safari') > -1, // Chrome浏览器\n Firefox: UserAgent.indexOf('firefox') > -1, // 火狐浏览器\n Opera: UserAgent.indexOf('opera') > -1, // Opera浏览器\n Safari: UserAgent.indexOf('safari') > -1 && UserAgent.indexOf('chrome') == -1, // safari浏览器\n Edge: UserAgent.indexOf('edge') > -1, // Edge浏览器\n QQBrowser: /qqbrowser/.test(UserAgent), // qq浏览器\n WeixinBrowser: /MicroMessenger/i.test(UserAgent) // 微信浏览器\n };\n // console.log(browserArray)\n for (let i in browserArray) {\n if (browserArray[i]) {\n let versions = '';\n if (i === 'IE') {\n versions = UserAgent.match(/(msie\\s|trident.*rv:)([\\w.]+)/)[2];\n } else if (i === 'Chrome') {\n for (let mt in navigator.mimeTypes) {\n //检测是否是360浏览器(测试只有pc端的360才起作用)\n if (navigator.mimeTypes[mt]['type'] === 'application/360softmgrplugin') {\n i = '360';\n }\n }\n versions = UserAgent.match(/chrome\\/([\\d.]+)/)[1];\n } else if (i === 'Firefox') {\n versions = UserAgent.match(/firefox\\/([\\d.]+)/)[1];\n } else if (i === 'Opera') {\n versions = UserAgent.match(/opera\\/([\\d.]+)/)[1];\n } else if (i === 'Safari') {\n versions = UserAgent.match(/version\\/([\\d.]+)/)[1];\n } else if (i === 'Edge') {\n versions = UserAgent.match(/edge\\/([\\d.]+)/)[1];\n } else if (i === 'QQBrowser') {\n versions = UserAgent.match(/qqbrowser\\/([\\d.]+)/)[1];\n }\n browserInfo.type = i;\n browserInfo.version = parseInt(versions);\n }\n }\n return browserInfo;\n}\n\n\nexport function closeVideoFrame(videoFrame) {\n if (videoFrame.close) {\n videoFrame.close()\n } else if (videoFrame.destroy) {\n videoFrame.destroy()\n }\n}\n\n\nexport function removeElement(element) {\n let result = false;\n if (element) {\n if (element.parentNode) {\n element.parentNode.removeChild(element);\n result = true;\n }\n }\n return result;\n}\n\nexport function hevcEncoderNalePacketNotLength(oneNALBuffer, isIframe) {\n const idrBit = 0x10 | 12;\n const nIdrBit = 0x20 | 12;\n let tmp = [];\n if (isIframe) {\n tmp[0] = idrBit;\n } else {\n tmp[0] = nIdrBit;\n }\n tmp[1] = 1;\n //\n tmp[2] = 0;\n tmp[3] = 0;\n tmp[4] = 0;\n\n const arrayBuffer = new Uint8Array(tmp.length + oneNALBuffer.byteLength);\n arrayBuffer.set(tmp, 0);\n arrayBuffer.set(oneNALBuffer, tmp.length);\n return arrayBuffer;\n}\n\n\nexport function isTrue(value) {\n return value === true || value === 'true';\n}\n\nexport function isFalse(value) {\n return value !== true && value !== 'true';\n}\n\nexport function getElementDataset(element, key) {\n if (!element) {\n return '';\n }\n\n if (element.dataset) {\n return element.dataset[key];\n }\n return element.getAttribute('data-' + key);\n}\n\nexport function setElementDataset(element, key, value) {\n if (!element) {\n return;\n }\n\n if (element.dataset) {\n element.dataset[key] = value;\n } else {\n element.setAttribute('data-' + key, value);\n }\n}\n\nexport function removeElementDataset(element, key) {\n if (!element) {\n return;\n }\n\n if (element.dataset) {\n delete element.dataset[key];\n } else {\n element.removeAttribute('data-' + key);\n }\n}\n","import {EVENTS, EVENTS_ERROR, JESSIBUCA_EVENTS} from \"../constant\";\nimport screenfull from \"screenfull\";\nimport {getTarget, isMobile, setStyle} from \"../utils\";\n\nexport default (player) => {\n\n\n try {\n const screenfullChange = (e) => {\n if (getTarget(e) === player.$container) {\n player.emit(JESSIBUCA_EVENTS.fullscreen, player.fullscreen)\n\n // 如果不是fullscreen,则触发下 resize 方法\n if (!player.fullscreen) {\n player.resize();\n } else {\n if (player._opt.useMSE) {\n player.resize();\n }\n }\n }\n };\n screenfull.on('change', screenfullChange);\n player.events.destroys.push(() => {\n screenfull.off('change', screenfullChange);\n });\n } catch (error) {\n //\n }\n //\n player.on(EVENTS.decoderWorkerInit, () => {\n player.debug.log('player', 'has loaded');\n player.loaded = true;\n })\n\n //\n player.on(EVENTS.play, () => {\n player.loading = false;\n })\n\n //\n player.on(EVENTS.fullscreen, (value) => {\n if (value) {\n try {\n screenfull.request(player.$container).then(() => {\n\n }).catch((e) => {\n if (isMobile() && player._opt.useWebFullScreen) {\n player.webFullscreen = true;\n }\n });\n\n } catch (e) {\n if (isMobile() && player._opt.useWebFullScreen) {\n player.webFullscreen = true;\n }\n }\n } else {\n try {\n screenfull.exit().then(() => {\n if (player.webFullscreen) {\n player.webFullscreen = false;\n }\n }).catch(() => {\n player.webFullscreen = false;\n\n });\n } catch (e) {\n player.webFullscreen = false;\n }\n }\n })\n\n if (isMobile()) {\n player.on(EVENTS.webFullscreen, (value) => {\n if (value) {\n player.$container.classList.add('jessibuca-fullscreen-web')\n } else {\n player.$container.classList.remove('jessibuca-fullscreen-web')\n }\n //\n player.emit(JESSIBUCA_EVENTS.fullscreen, player.fullscreen)\n })\n }\n\n\n //\n player.on(EVENTS.resize, () => {\n player.video && player.video.resize();\n })\n\n\n if (player._opt.debug) {\n const ignoreList = [EVENTS.timeUpdate];\n const stringList = [\n EVENTS.stats,\n EVENTS.playToRenderTimes,\n EVENTS.audioInfo,\n EVENTS.videoInfo\n ]\n Object.keys(EVENTS).forEach((key) => {\n player.on(EVENTS[key], (value) => {\n if (ignoreList.includes(key)) {\n return;\n }\n\n if (stringList.includes(key)) {\n value = JSON.stringify(value)\n }\n\n player.debug.log('player events', EVENTS[key], value);\n })\n })\n\n Object.keys(EVENTS_ERROR).forEach((key) => {\n player.on(EVENTS_ERROR[key], (value) => {\n player.debug.log('player event error', EVENTS_ERROR[key], value);\n })\n })\n }\n}\n","export default class Emitter {\n on(name, fn, ctx) {\n const e = this.e || (this.e = {});\n (e[name] || (e[name] = [])).push({fn, ctx});\n return this;\n }\n\n once(name, fn, ctx) {\n const self = this;\n\n function listener(...args) {\n self.off(name, listener);\n fn.apply(ctx, args);\n }\n\n listener._ = fn;\n return this.on(name, listener, ctx);\n }\n\n emit(name, ...data) {\n const evtArr = ((this.e || (this.e = {}))[name] || []).slice();\n for (let i = 0; i < evtArr.length; i += 1) {\n evtArr[i].fn.apply(evtArr[i].ctx, data);\n }\n return this;\n }\n\n off(name, callback) {\n const e = this.e || (this.e = {});\n\n if (!name) {\n Object.keys(e).forEach((key) => {\n delete e[key];\n })\n delete this.e\n return;\n }\n\n const evts = e[name];\n const liveEvents = [];\n if (evts && callback) {\n for (let i = 0, len = evts.length; i < len; i += 1) {\n if (evts[i].fn !== callback && evts[i].fn._ !== callback) liveEvents.push(evts[i]);\n }\n }\n if (liveEvents.length) {\n e[name] = liveEvents;\n } else {\n delete e[name];\n }\n return this;\n }\n}\n","export default (gl, openWebglAlignment) => {\n var vertexShaderScript = [\n 'attribute vec4 vertexPos;',\n 'attribute vec4 texturePos;',\n 'varying vec2 textureCoord;',\n\n 'void main()',\n '{',\n 'gl_Position = vertexPos;',\n 'textureCoord = texturePos.xy;',\n '}'\n ].join('\\n');\n\n var fragmentShaderScript = [\n 'precision highp float;',\n 'varying highp vec2 textureCoord;',\n 'uniform sampler2D ySampler;',\n 'uniform sampler2D uSampler;',\n 'uniform sampler2D vSampler;',\n 'const mat4 YUV2RGB = mat4',\n '(',\n '1.1643828125, 0, 1.59602734375, -.87078515625,',\n '1.1643828125, -.39176171875, -.81296875, .52959375,',\n '1.1643828125, 2.017234375, 0, -1.081390625,',\n '0, 0, 0, 1',\n ');',\n\n 'void main(void) {',\n 'highp float y = texture2D(ySampler, textureCoord).r;',\n 'highp float u = texture2D(uSampler, textureCoord).r;',\n 'highp float v = texture2D(vSampler, textureCoord).r;',\n 'gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;',\n '}'\n ].join('\\n');\n\n if (openWebglAlignment) {\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);\n }\n var vertexShader = gl.createShader(gl.VERTEX_SHADER);\n gl.shaderSource(vertexShader, vertexShaderScript);\n gl.compileShader(vertexShader);\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {\n console.log('Vertex shader failed to compile: ' + gl.getShaderInfoLog(vertexShader));\n }\n\n var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\n gl.shaderSource(fragmentShader, fragmentShaderScript);\n gl.compileShader(fragmentShader);\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {\n console.log('Fragment shader failed to compile: ' + gl.getShaderInfoLog(fragmentShader));\n }\n\n var program = gl.createProgram();\n gl.attachShader(program, vertexShader);\n gl.attachShader(program, fragmentShader);\n gl.linkProgram(program);\n if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n console.log('Program failed to compile: ' + gl.getProgramInfoLog(program));\n }\n\n gl.useProgram(program);\n\n // initBuffers\n var vertexPosBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, vertexPosBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW);\n\n var vertexPosRef = gl.getAttribLocation(program, 'vertexPos');\n gl.enableVertexAttribArray(vertexPosRef);\n gl.vertexAttribPointer(vertexPosRef, 2, gl.FLOAT, false, 0, 0);\n\n var texturePosBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, texturePosBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 0, 0, 0, 1, 1, 0, 1]), gl.STATIC_DRAW);\n\n var texturePosRef = gl.getAttribLocation(program, 'texturePos');\n gl.enableVertexAttribArray(texturePosRef);\n gl.vertexAttribPointer(texturePosRef, 2, gl.FLOAT, false, 0, 0);\n\n function _initTexture(name, index) {\n var textureRef = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, textureRef);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.uniform1i(gl.getUniformLocation(program, name), index);\n return textureRef;\n }\n\n var yTextureRef = _initTexture('ySampler', 0);\n var uTextureRef = _initTexture('uSampler', 1);\n var vTextureRef = _initTexture('vSampler', 2);\n\n return {\n render: function (w, h, y, u, v) {\n gl.viewport(0, 0, w, h);\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, yTextureRef);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, w, h, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, y);\n gl.activeTexture(gl.TEXTURE1);\n gl.bindTexture(gl.TEXTURE_2D, uTextureRef);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, w / 2, h / 2, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, u);\n gl.activeTexture(gl.TEXTURE2);\n gl.bindTexture(gl.TEXTURE_2D, vTextureRef);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, w / 2, h / 2, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, v);\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);\n },\n destroy: function () {\n try {\n gl.deleteProgram(program);\n\n gl.deleteBuffer(vertexPosBuffer)\n gl.deleteBuffer(texturePosBuffer);\n\n gl.deleteTexture(yTextureRef);\n gl.deleteTexture(uTextureRef);\n gl.deleteTexture(vTextureRef);\n } catch (e) {\n // console.error(e);\n }\n\n }\n }\n};\n","import Emitter from \"../utils/emitter\";\nimport {CONTROL_HEIGHT, EVENTS, VIDEO_ENC_TYPE} from \"../constant\";\n\nexport default class CommonLoader extends Emitter {\n constructor() {\n super();\n this.init = false;\n }\n\n resetInit() {\n this.init = false;\n this.videoInfo = {\n width: '',\n height: '',\n encType: '',\n encTypeCode: ''\n }\n }\n destroy() {\n this.resetInit();\n this.player.$container.removeChild(this.$videoElement);\n this.off();\n }\n\n //\n updateVideoInfo(data) {\n if (data.encTypeCode) {\n this.videoInfo.encType = VIDEO_ENC_TYPE[data.encTypeCode];\n this.videoInfo.encTypeCode = data.encTypeCode;\n }\n\n if (data.width) {\n this.videoInfo.width = data.width;\n }\n\n if (data.height) {\n this.videoInfo.height = data.height;\n }\n\n // video 基本信息\n if (this.videoInfo.encType && this.videoInfo.height && this.videoInfo.width && !this.init) {\n this.player.emit(EVENTS.videoInfo, this.videoInfo);\n this.init = true;\n }\n }\n\n play() {\n\n }\n\n pause() {\n\n }\n\n clearView() {\n\n }\n}\n","/*\n* FileSaver.js\n* A saveAs() FileSaver implementation.\n*\n* By Eli Grey, http://eligrey.com\n*\n* License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT)\n* source : http://purl.eligrey.com/github/FileSaver.js\n*/\n\n// The one and only way of getting global scope in all environments\n// https://stackoverflow.com/q/3277182/1008999\nvar _global = typeof window === 'object' && window.window === window\n ? window : typeof self === 'object' && self.self === self\n ? self : typeof global === 'object' && global.global === global\n ? global\n : this\n\nfunction bom(blob, opts) {\n if (typeof opts === 'undefined') opts = {autoBom: false}\n else if (typeof opts !== 'object') {\n console.warn('Deprecated: Expected third argument to be a object')\n opts = {autoBom: !opts}\n }\n\n // prepend BOM for UTF-8 XML and text/* types (including HTML)\n // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF\n if (opts.autoBom && /^\\s*(?:text\\/\\S*|application\\/xml|\\S*\\/\\S*\\+xml)\\s*;.*charset\\s*=\\s*utf-8/i.test(blob.type)) {\n return new Blob([String.fromCharCode(0xFEFF), blob], {type: blob.type})\n }\n return blob\n}\n\nfunction download(url, name, opts) {\n var xhr = new XMLHttpRequest()\n xhr.open('GET', url)\n xhr.responseType = 'blob'\n xhr.onload = function () {\n saveAs(xhr.response, name, opts)\n }\n xhr.onerror = function () {\n console.error('could not download file')\n }\n xhr.send()\n}\n\nfunction corsEnabled(url) {\n var xhr = new XMLHttpRequest()\n // use sync to avoid popup blocker\n xhr.open('HEAD', url, false)\n try {\n xhr.send()\n } catch (e) {\n }\n return xhr.status >= 200 && xhr.status <= 299\n}\n\n// `a.click()` doesn't work for all browsers (#465)\nfunction click(node) {\n try {\n node.dispatchEvent(new MouseEvent('click'))\n } catch (e) {\n var evt = document.createEvent('MouseEvents')\n evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80,\n 20, false, false, false, false, 0, null)\n node.dispatchEvent(evt)\n }\n}\n\n// Detect WebView inside a native macOS app by ruling out all browsers\n// We just need to check for 'Safari' because all other browsers (besides Firefox) include that too\n// https://www.whatismybrowser.com/guides/the-latest-user-agent/macos\nvar isMacOSWebView = _global.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent)\n\nvar saveAs = (\n // probably in some web worker\n (typeof window !== 'object' || window !== _global)\n ? function saveAs() { /* noop */\n }\n\n // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView\n : ('download' in HTMLAnchorElement.prototype && !isMacOSWebView)\n ? function saveAs(blob, name, opts) {\n var URL = _global.URL || _global.webkitURL\n // Namespace is used to prevent conflict w/ Chrome Poper Blocker extension (Issue #561)\n var a = document.createElementNS('http://www.w3.org/1999/xhtml', 'a')\n name = name || blob.name || 'download'\n\n a.download = name\n a.rel = 'noopener' // tabnabbing\n\n // TODO: detect chrome extensions & packaged apps\n // a.target = '_blank'\n\n if (typeof blob === 'string') {\n // Support regular links\n a.href = blob\n if (a.origin !== location.origin) {\n corsEnabled(a.href)\n ? download(blob, name, opts)\n : click(a, a.target = '_blank')\n } else {\n click(a)\n }\n } else {\n // Support blobs\n a.href = URL.createObjectURL(blob)\n setTimeout(function () {\n URL.revokeObjectURL(a.href)\n }, 4E4) // 40s\n setTimeout(function () {\n click(a)\n }, 0)\n }\n }\n\n // Use msSaveOrOpenBlob as a second approach\n : 'msSaveOrOpenBlob' in navigator\n ? function saveAs(blob, name, opts) {\n name = name || blob.name || 'download'\n\n if (typeof blob === 'string') {\n if (corsEnabled(blob)) {\n download(blob, name, opts)\n } else {\n var a = document.createElement('a')\n a.href = blob\n a.target = '_blank'\n setTimeout(function () {\n click(a)\n })\n }\n } else {\n navigator.msSaveOrOpenBlob(bom(blob, opts), name)\n }\n }\n\n // Fallback to using FileReader and a popup\n : function saveAs(blob, name, opts, popup) {\n // Open a popup immediately do go around popup blocker\n // Mostly only available on user interaction and the fileReader is async so...\n popup = popup || open('', '_blank')\n if (popup) {\n popup.document.title =\n popup.document.body.innerText = 'downloading...'\n }\n\n if (typeof blob === 'string') return download(blob, name, opts)\n\n var force = blob.type === 'application/octet-stream'\n var isSafari = /constructor/i.test(_global.HTMLElement) || _global.safari\n var isChromeIOS = /CriOS\\/[\\d]+/.test(navigator.userAgent)\n\n if ((isChromeIOS || (force && isSafari) || isMacOSWebView) && typeof FileReader !== 'undefined') {\n // Safari doesn't allow downloading of blob URLs\n var reader = new FileReader()\n reader.onloadend = function () {\n var url = reader.result\n url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, 'data:attachment/file;')\n if (popup) popup.location.href = url\n else location = url\n popup = null // reverse-tabnabbing #460\n }\n reader.readAsDataURL(blob)\n } else {\n var URL = _global.URL || _global.webkitURL\n var url = URL.createObjectURL(blob)\n if (popup) popup.location = url\n else location.href = url\n popup = null // reverse-tabnabbing #460\n setTimeout(function () {\n URL.revokeObjectURL(url)\n }, 4E4) // 40s\n }\n }\n)\n\n\nexport default saveAs\n","import Emitter from \"../utils/emitter\";\nimport {\n closeVideoFrame,\n createContextGL,\n createEmptyImageBitmap,\n dataURLToFile,\n downloadImg,\n isMobile,\n now,\n supportOffscreen\n} from \"../utils\";\nimport createWebGL from \"../utils/webgl\";\nimport {CANVAS_RENDER_TYPE, CONTROL_HEIGHT, EVENTS, SCREENSHOT_TYPE, VIDEO_ENC_TYPE} from \"../constant\";\nimport CommonLoader from \"./commonLoader\";\nimport saveAs from \"../utils/file-save\";\n\nexport default class CanvasVideoLoader extends CommonLoader {\n\n constructor(player) {\n super()\n this.player = player;\n const $canvasElement = document.createElement(\"canvas\");\n $canvasElement.style.position = \"absolute\";\n $canvasElement.style.top = 0;\n $canvasElement.style.left = 0;\n this.$videoElement = $canvasElement;\n player.$container.appendChild(this.$videoElement);\n\n this.context2D = null;\n this.contextGl = null;\n this.contextGlRender = null;\n this.contextGlDestroy = null;\n this.bitmaprenderer = null;\n this.renderType = null;\n this.videoInfo = {\n width: '',\n height: '',\n encType: '',\n }\n //\n this._initCanvasRender();\n this.player.debug.log('CanvasVideo', 'init');\n }\n\n async destroy() {\n super.destroy();\n if (this.contextGl) {\n this.contextGl = null;\n }\n if (this.context2D) {\n this.context2D = null;\n }\n if (this.contextGlRender) {\n this.contextGlDestroy && this.contextGlDestroy();\n this.contextGlDestroy = null;\n this.contextGlRender = null;\n }\n if (this.bitmaprenderer) {\n this.bitmaprenderer = null;\n }\n\n this.renderType = null;\n\n this.player.debug.log(`CanvasVideoLoader`, 'destroy');\n }\n\n\n _initContextGl() {\n this.contextGl = createContextGL(this.$videoElement);\n if(this.contextGl){\n const webgl = createWebGL(this.contextGl, this.player._opt.openWebglAlignment);\n this.contextGlRender = webgl.render;\n this.contextGlDestroy = webgl.destroy\n }\n else {\n this.player.debug.error(`CanvasVideoLoader`, 'init webgl fail');\n }\n }\n\n _initContext2D() {\n this.context2D = this.$videoElement.getContext('2d');\n }\n\n\n // 渲染类型\n _initCanvasRender() {\n if (this.player._opt.useWCS && !this._supportOffscreen()) {\n this.renderType = CANVAS_RENDER_TYPE.webcodecs;\n this._initContext2D();\n } else if (this._supportOffscreen()) {\n this.renderType = CANVAS_RENDER_TYPE.offscreen;\n this._bindOffscreen();\n } else {\n this.renderType = CANVAS_RENDER_TYPE.webgl;\n this._initContextGl();\n }\n }\n\n _supportOffscreen() {\n return supportOffscreen(this.$videoElement) && this.player._opt.useOffscreen;\n }\n\n //\n _bindOffscreen() {\n this.bitmaprenderer = this.$videoElement.getContext('bitmaprenderer');\n }\n\n initCanvasViewSize() {\n this.$videoElement.width = this.videoInfo.width;\n this.$videoElement.height = this.videoInfo.height;\n this.resize();\n }\n\n //\n render(msg) {\n this.player.videoTimestamp = msg.ts;\n switch (this.renderType) {\n case CANVAS_RENDER_TYPE.offscreen:\n this.bitmaprenderer.transferFromImageBitmap(msg.buffer);\n break;\n case CANVAS_RENDER_TYPE.webgl:\n this.contextGlRender(this.$videoElement.width, this.$videoElement.height, msg.output[0], msg.output[1], msg.output[2]);\n break;\n case CANVAS_RENDER_TYPE.webcodecs:\n // can use createImageBitmap in wexin\n this.context2D.drawImage(msg.videoFrame, 0, 0, this.$videoElement.width, this.$videoElement.height);\n closeVideoFrame(msg.videoFrame);\n break;\n }\n }\n\n screenshot(filename, format, quality, type) {\n filename = filename || now();\n type = type || SCREENSHOT_TYPE.download;\n const formatType = {\n png: 'image/png',\n jpeg: 'image/jpeg',\n webp: 'image/webp'\n };\n let encoderOptions = 0.92;\n if (!formatType[format] && SCREENSHOT_TYPE[format]) {\n type = format;\n format = 'png';\n quality = undefined\n }\n\n if (typeof quality === \"string\") {\n type = quality;\n quality = undefined;\n }\n\n if (typeof quality !== 'undefined') {\n encoderOptions = Number(quality);\n }\n const dataURL = this.$videoElement.toDataURL(formatType[format] || formatType.png, encoderOptions);\n\n if (type === SCREENSHOT_TYPE.base64) {\n return dataURL;\n } else {\n const file = dataURLToFile(dataURL)\n if (type === SCREENSHOT_TYPE.blob) {\n return file;\n } else if (type === SCREENSHOT_TYPE.download) {\n // downloadImg(file, filename);\n saveAs(file, filename);\n }\n }\n\n }\n\n //\n clearView() {\n switch (this.renderType) {\n case CANVAS_RENDER_TYPE.offscreen:\n createEmptyImageBitmap(this.$videoElement.width, this.$videoElement.height).then((imageBitMap) => {\n this.bitmaprenderer.transferFromImageBitmap(imageBitMap);\n })\n break;\n case CANVAS_RENDER_TYPE.webgl:\n this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);\n break;\n case CANVAS_RENDER_TYPE.webcodecs:\n this.context2D.clearRect(0, 0, this.$videoElement.width, this.$videoElement.height)\n break;\n }\n }\n\n resize() {\n this.player.debug.log('canvasVideo', 'resize');\n const option = this.player._opt;\n let width = this.player.width;\n let height = this.player.height;\n if (this.player.isControlBarShow()) {\n if (isMobile() && this.player.fullscreen && option.useWebFullScreen) {\n width -= CONTROL_HEIGHT;\n } else {\n height -= CONTROL_HEIGHT;\n }\n }\n let resizeWidth = this.$videoElement.width;\n let resizeHeight = this.$videoElement.height;\n const rotate = option.rotate;\n let left = ((width - resizeWidth) / 2)\n let top = ((height - resizeHeight) / 2)\n if (rotate === 270 || rotate === 90) {\n resizeWidth = this.$videoElement.height;\n resizeHeight = this.$videoElement.width;\n }\n\n const wScale = width / resizeWidth;\n const hScale = height / resizeHeight;\n\n let scale = wScale > hScale ? hScale : wScale;\n //\n if (!option.isResize) {\n if (wScale !== hScale) {\n scale = wScale + ',' + hScale;\n }\n }\n //\n if (option.isFullResize) {\n scale = wScale > hScale ? wScale : hScale;\n }\n let transform = \"scale(\" + scale + \")\";\n\n if (rotate) {\n transform += ' rotate(' + rotate + 'deg)'\n }\n\n this.$videoElement.style.transform = transform;\n this.$videoElement.style.left = left + \"px\"\n this.$videoElement.style.top = top + \"px\"\n }\n\n\n}\n","import Emitter from \"../utils/emitter\";\nimport {CONTROL_HEIGHT, EVENTS, SCREENSHOT_TYPE, VIDEO_ENC_TYPE} from \"../constant\";\nimport {dataURLToFile, downloadImg, getBrowser, isAndroid, isMobile, now} from \"../utils\";\nimport CommonLoader from \"./commonLoader\";\nimport saveAs from \"../utils/file-save\";\n\nexport default class VideoLoader extends CommonLoader {\n constructor(player) {\n super();\n this.player = player;\n const $videoElement = document.createElement('video');\n const $canvasElement = document.createElement('canvas');\n $videoElement.muted = true;\n $videoElement.disablePictureInPicture = true;\n if (isAndroid()) {\n // default no poster\n $videoElement.poster = 'noposter';\n }\n $videoElement.style.position = \"absolute\";\n $videoElement.style.top = 0;\n $videoElement.style.left = 0;\n this._delayPlay = false;\n player.$container.appendChild($videoElement);\n this.videoInfo = {\n width: '',\n height: '',\n encType: '',\n }\n const _opt = this.player._opt;\n if (_opt.useWCS && _opt.wcsUseVideoRender) {\n this.trackGenerator = new MediaStreamTrackGenerator({kind: 'video'});\n $videoElement.srcObject = new MediaStream([this.trackGenerator]);\n this.vwriter = this.trackGenerator.writable.getWriter();\n }\n this.$videoElement = $videoElement;\n this.$canvasElement = $canvasElement;\n this.canvasContext = $canvasElement.getContext('2d');\n this.fixChromeVideoFlashBug();\n this.resize();\n\n const {proxy} = this.player.events;\n\n proxy(this.$videoElement, 'canplay', () => {\n this.player.debug.log('Video', `canplay`);\n if (this._delayPlay) {\n this.player.debug.log('Video', `canplay and _delayPlay is true and next play()`);\n this._play();\n }\n })\n\n proxy(this.$videoElement, 'waiting', () => {\n // this.player.emit(EVENTS.videoWaiting);\n this.player.debug.log('Video', 'waiting');\n })\n\n proxy(this.$videoElement, 'timeupdate', (event) => {\n // this.player.emit(EVENTS.videoTimeUpdate, event.timeStamp);\n const timeStamp = parseInt(event.timeStamp, 10);\n this.player.emit(EVENTS.timeUpdate, timeStamp)\n // check is pause;\n if (!this.isPlaying() && this.init) {\n this.player.debug.log('Video', `timeupdate and this.isPlaying is false and retry play`);\n this.$videoElement.play();\n }\n })\n\n this.player.debug.log('Video', 'init');\n }\n\n async destroy() {\n super.destroy();\n this.$canvasElement = null;\n this.canvasContext = null;\n if (this.$videoElement) {\n this.$videoElement.pause();\n this.$videoElement.currentTime = 0;\n this.$videoElement.src = ''\n this.$videoElement.removeAttribute('src');\n this.$videoElement = null;\n }\n if (this.trackGenerator) {\n this.trackGenerator.stop();\n this.trackGenerator = null;\n }\n if (this.vwriter) {\n await this.vwriter.close();\n this.vwriter = null;\n }\n this.player.debug.log('Video', 'destroy');\n }\n\n fixChromeVideoFlashBug() {\n const browser = getBrowser();\n const type = browser.type.toLowerCase();\n if (type === 'chrome' || type === 'edge') {\n const $container = this.player.$container;\n $container.style.backdropFilter = 'blur(0px)';\n $container.style.translateZ = '0';\n }\n }\n\n play() {\n if (this.$videoElement) {\n const readyState = this._getVideoReadyState();\n this.player.debug.log('Video', `play and readyState: ${readyState}`);\n if (readyState === 0) {\n this.player.debug.warn('Video', 'readyState is 0 and set _delayPlay to true');\n this._delayPlay = true;\n return;\n }\n this._play();\n }\n }\n\n _getVideoReadyState() {\n let result = 0;\n if (this.$videoElement) {\n result = this.$videoElement.readyState;\n }\n return result;\n }\n\n _play() {\n this.$videoElement && this.$videoElement.play().then(() => {\n this._delayPlay = false;\n this.player.debug.log('Video', '_play success');\n setTimeout(() => {\n if (!this.isPlaying()) {\n this.player.debug.warn('Video', `play failed and retry play`)\n this._play();\n }\n }, 100)\n\n }).catch((e) => {\n this.player.debug.error('Video', '_play error', e);\n })\n }\n\n pause(isNow) {\n // 预防\n // https://developer.chrome.com/blog/play-request-was-interrupted/\n // http://alonesuperman.com/?p=23\n if (isNow) {\n this.$videoElement && this.$videoElement.pause();\n } else {\n setTimeout(() => {\n this.$videoElement && this.$videoElement.pause();\n }, 100)\n }\n }\n\n clearView() {\n\n }\n\n screenshot(filename, format, quality, type) {\n filename = filename || now();\n type = type || SCREENSHOT_TYPE.download;\n const formatType = {\n png: 'image/png',\n jpeg: 'image/jpeg',\n webp: 'image/webp'\n };\n let encoderOptions = 0.92;\n if (!formatType[format] && SCREENSHOT_TYPE[format]) {\n type = format;\n format = 'png';\n quality = undefined\n }\n if (typeof quality === \"string\") {\n type = quality;\n quality = undefined;\n }\n\n if (typeof quality !== 'undefined') {\n encoderOptions = Number(quality);\n }\n const $video = this.$videoElement;\n let canvas = this.$canvasElement;\n canvas.width = $video.videoWidth;\n canvas.height = $video.videoHeight;\n this.canvasContext.drawImage($video, 0, 0, canvas.width, canvas.height);\n const dataURL = canvas.toDataURL(formatType[format] || formatType.png, encoderOptions);\n // release memory\n this.canvasContext.clearRect(0, 0, canvas.width, canvas.height);\n canvas.width = 0;\n canvas.height = 0;\n if (type === SCREENSHOT_TYPE.base64) {\n return dataURL;\n } else {\n const file = dataURLToFile(dataURL);\n if (type === SCREENSHOT_TYPE.blob) {\n return file;\n } else if (type === SCREENSHOT_TYPE.download) {\n // downloadImg(file, filename);\n saveAs(file, filename)\n }\n }\n\n }\n\n initCanvasViewSize() {\n this.resize();\n }\n\n //\n render(msg) {\n if (this.vwriter) {\n this.vwriter.write(msg.videoFrame);\n // release memory\n msg.videoFrame.close();\n }\n }\n\n resize() {\n let width = this.player.width;\n let height = this.player.height;\n const option = this.player._opt;\n const rotate = option.rotate;\n if (this.player.isControlBarShow()) {\n if (isMobile() && this.player.fullscreen && option.useWebFullScreen) {\n width -= CONTROL_HEIGHT;\n } else {\n height -= CONTROL_HEIGHT;\n }\n }\n\n this.$videoElement.width = width;\n this.$videoElement.height = height;\n\n if (rotate === 270 || rotate === 90) {\n this.$videoElement.width = height;\n this.$videoElement.height = width;\n }\n let resizeWidth = this.$videoElement.width;\n let resizeHeight = this.$videoElement.height;\n let left = ((width - resizeWidth) / 2)\n let top = ((height - resizeHeight) / 2)\n let objectFill = 'contain';\n\n // 默认是true\n // 视频画面做等比缩放后,高或宽对齐canvas区域,画面不被拉伸,但有黑边\n\n // 视频画面完全填充canvas区域,画面会被拉伸\n if (!option.isResize) {\n objectFill = 'fill';\n }\n\n // 视频画面做等比缩放后,完全填充canvas区域,画面不被拉伸,没有黑边,但画面显示不全\n if (option.isFullResize) {\n objectFill = 'none';\n }\n this.$videoElement.style.objectFit = objectFill;\n this.$videoElement.style.transform = 'rotate(' + rotate + 'deg)';\n this.$videoElement.style.left = left + \"px\"\n this.$videoElement.style.top = top + \"px\"\n }\n\n isPlaying() {\n return this.$videoElement && !this.$videoElement.paused;\n }\n}\n","import CanvasVideoLoader from './canvasLoader';\nimport VideoLoader from \"./videoLoader\";\n\nexport default class Video {\n constructor(player) {\n const Loader = Video.getLoaderFactory(player._opt);\n return new Loader(player);\n }\n\n static getLoaderFactory(opt) {\n if (opt.useMSE ||\n (opt.useWCS && !opt.useOffscreen && opt.wcsUseVideoRender)) {\n return VideoLoader;\n } else {\n return CanvasVideoLoader;\n }\n }\n}\n","import Emitter from \"../utils/emitter\";\nimport {AUDIO_ENC_TYPE, AUDIO_SYNC_VIDEO_DIFF, EVENTS, VIDEO_ENC_TYPE} from \"../constant\";\nimport {clamp, noop} from \"../utils\";\n\nexport default class AudioContextLoader extends Emitter {\n constructor(player) {\n super();\n this.bufferList = [];\n this.player = player;\n this.scriptNode = null;\n this.hasInitScriptNode = false;\n this.audioContextChannel = null;\n\n this.audioContext = new (window.AudioContext || window.webkitAudioContext)();\n //\n this.gainNode = this.audioContext.createGain();\n // Get an AudioBufferSourceNode.\n // This is the AudioNode to use when we want to play an AudioBuffer\n const source = this.audioContext.createBufferSource();\n // set the buffer in the AudioBufferSourceNode\n source.buffer = this.audioContext.createBuffer(1, 1, 22050);\n // connect the AudioBufferSourceNode to the\n // destination so we can hear the sound\n source.connect(this.audioContext.destination);\n // noteOn as start\n // start the source playing\n if (source.noteOn) {\n source.noteOn(0);\n } else {\n source.start(0);\n }\n this.audioBufferSourceNode = source;\n //\n this.mediaStreamAudioDestinationNode = this.audioContext.createMediaStreamDestination();\n //\n this.audioEnabled(true);\n // default setting 0\n this.gainNode.gain.value = 0;\n this._prevVolume = null;\n\n this.playing = false;\n //\n this.audioSyncVideoOption = {\n diff: null\n };\n\n\n this.audioInfo = {\n encType: '',\n channels: '',\n sampleRate: ''\n }\n this.init = false;\n this.hasAudio = false;\n\n // update\n this.on(EVENTS.videoSyncAudio, (options) => {\n // this.player.debug.log('AudioContext', `videoSyncAudio , audioTimestamp: ${options.audioTimestamp},videoTimestamp: ${options.videoTimestamp},diff:${options.diff}`)\n this.audioSyncVideoOption = options;\n })\n\n this.player.debug.log('AudioContext', 'init');\n }\n\n resetInit() {\n this.init = false;\n this.audioInfo = {\n encType: '',\n channels: '',\n sampleRate: ''\n }\n }\n\n\n async destroy() {\n this.closeAudio();\n this.resetInit();\n if(this.audioContext){\n await this.audioContext.close();\n this.audioContext = null;\n }\n\n this.gainNode = null;\n this.hasAudio = false;\n this.playing = false;\n if (this.scriptNode) {\n this.scriptNode.onaudioprocess = noop;\n this.scriptNode = null;\n }\n this.audioBufferSourceNode = null;\n this.mediaStreamAudioDestinationNode = null;\n this.hasInitScriptNode = false;\n this.audioSyncVideoOption = {\n diff: null\n };\n this._prevVolume = null;\n this.off();\n this.player.debug.log('AudioContext', 'destroy');\n }\n\n updateAudioInfo(data) {\n if (data.encTypeCode) {\n this.audioInfo.encType = AUDIO_ENC_TYPE[data.encTypeCode];\n this.audioInfo.encTypeCode = data.encTypeCode;\n }\n\n if (data.channels) {\n this.audioInfo.channels = data.channels;\n }\n\n if (data.sampleRate) {\n this.audioInfo.sampleRate = data.sampleRate;\n }\n\n // audio 基本信息\n if (this.audioInfo.sampleRate && this.audioInfo.channels && this.audioInfo.encType && !this.init) {\n this.player.emit(EVENTS.audioInfo, this.audioInfo);\n this.init = true;\n }\n }\n\n //\n get isPlaying() {\n return this.playing;\n }\n\n get isMute() {\n return this.gainNode.gain.value === 0;\n }\n\n get volume() {\n return this.gainNode.gain.value;\n }\n\n get bufferSize() {\n return this.bufferList.length;\n }\n\n\n initScriptNode() {\n this.playing = true;\n\n if (this.hasInitScriptNode) {\n return;\n }\n const channels = this.audioInfo.channels;\n\n const scriptNode = this.audioContext.createScriptProcessor(1024, 0, channels);\n // tips: if audio isStateSuspended onaudioprocess method not working\n scriptNode.onaudioprocess = (audioProcessingEvent) => {\n const outputBuffer = audioProcessingEvent.outputBuffer;\n\n if (this.bufferList.length && this.playing) {\n // just for wasm\n if (!this.player._opt.useWCS && !this.player._opt.useMSE && this.player._opt.wasmDecodeAudioSyncVideo) {\n // audio > video\n // wait\n if (this.audioSyncVideoOption.diff > AUDIO_SYNC_VIDEO_DIFF) {\n this.player.debug.warn('AudioContext', `audioSyncVideoOption more than diff :${this.audioSyncVideoOption.diff}, waiting`)\n // wait\n return;\n }\n // audio < video\n // throw away then chase video\n else if (this.audioSyncVideoOption.diff < -AUDIO_SYNC_VIDEO_DIFF) {\n this.player.debug.warn('AudioContext', `audioSyncVideoOption less than diff :${this.audioSyncVideoOption.diff}, dropping`)\n\n //\n let bufferItem = this.bufferList.shift();\n //\n while ((bufferItem.ts - this.player.videoTimestamp < -AUDIO_SYNC_VIDEO_DIFF) && this.bufferList.length > 0) {\n // this.player.debug.warn('AudioContext', `audioSyncVideoOption less than inner ts is:${bufferItem.ts}, videoTimestamp is ${this.player.videoTimestamp},diff:${bufferItem.ts - this.player.videoTimestamp}`)\n bufferItem = this.bufferList.shift();\n }\n\n if (this.bufferList.length === 0) {\n return;\n }\n }\n }\n\n if (this.bufferList.length === 0) {\n return;\n }\n\n const bufferItem = this.bufferList.shift();\n\n // update audio time stamp\n if (bufferItem && bufferItem.ts) {\n this.player.audioTimestamp = bufferItem.ts;\n }\n\n for (let channel = 0; channel < channels; channel++) {\n const b = bufferItem.buffer[channel]\n const nowBuffering = outputBuffer.getChannelData(channel);\n for (let i = 0; i < 1024; i++) {\n nowBuffering[i] = b[i] || 0\n }\n }\n }\n }\n\n scriptNode.connect(this.gainNode);\n this.scriptNode = scriptNode;\n this.gainNode.connect(this.audioContext.destination);\n this.gainNode.connect(this.mediaStreamAudioDestinationNode);\n this.hasInitScriptNode = true;\n }\n\n mute(flag) {\n if (flag) {\n // if (!this.isMute) {\n // this.player.emit(EVENTS.mute, flag);\n // }\n this.setVolume(0);\n this.clear();\n } else {\n // if (this.isMute) {\n // this.player.emit(EVENTS.mute, flag);\n // }\n this.setVolume(0.5);\n }\n }\n\n setVolume(volume) {\n volume = parseFloat(volume).toFixed(2);\n if (isNaN(volume)) {\n return;\n }\n this.audioEnabled(true);\n volume = clamp(volume, 0, 1);\n if (this._prevVolume === null) {\n this.player.emit(EVENTS.mute, volume === 0);\n } else {\n if (this._prevVolume === 0 && volume > 0) {\n this.player.emit(EVENTS.mute, false);\n } else if (this._prevVolume > 0 && volume === 0) {\n this.player.emit(EVENTS.mute, true);\n }\n }\n this.gainNode.gain.value = volume;\n this.gainNode.gain.setValueAtTime(volume, this.audioContext.currentTime);\n this.player.emit(EVENTS.volumechange, this.player.volume);\n this.player.emit(EVENTS.volume, this.player.volume); // outer\n // save last volume\n this._prevVolume = volume;\n }\n\n closeAudio() {\n if (this.hasInitScriptNode) {\n this.scriptNode && this.scriptNode.disconnect(this.gainNode);\n this.gainNode && this.gainNode.disconnect(this.audioContext.destination);\n this.gainNode && this.gainNode.disconnect(this.mediaStreamAudioDestinationNode);\n }\n this.clear();\n }\n\n // 是否播放。。。\n audioEnabled(flag) {\n if (flag) {\n if (this.audioContext.state === 'suspended') {\n // resume\n this.audioContext.resume();\n }\n } else {\n if (this.audioContext.state === 'running') {\n // suspend\n this.audioContext.suspend();\n }\n }\n }\n\n isStateRunning() {\n return this.audioContext.state === 'running';\n }\n\n isStateSuspended() {\n return this.audioContext.state === 'suspended';\n }\n\n clear() {\n this.bufferList = [];\n }\n\n play(buffer, ts) {\n // if is mute\n if (this.isMute) {\n return;\n }\n\n this.hasAudio = true;\n\n this.bufferList.push({\n buffer,\n ts\n });\n\n if (this.bufferList.length > 20) {\n this.player.debug.warn('AudioContext', `bufferList is large: ${this.bufferList.length}`)\n\n // out of memory\n if (this.bufferList.length > 50) {\n this.bufferList.shift();\n }\n }\n // this.player.debug.log('AudioContext', `bufferList is ${this.bufferList.length}`)\n }\n\n pause() {\n this.audioSyncVideoOption = {\n diff: null\n };\n this.playing = false;\n this.clear();\n }\n\n resume() {\n this.playing = true;\n }\n\n\n}\n","import AudioContextLoader from \"./audioContextLoader\";\n\nexport default class Audio {\n constructor(player) {\n const Loader = Audio.getLoaderFactory();\n return new Loader(player);\n }\n\n static getLoaderFactory() {\n return AudioContextLoader;\n }\n}\n","import Emitter from \"../utils/emitter\";\nimport {EVENTS, EVENTS_ERROR, FETCH_ERROR, JESSIBUCA_EVENTS} from \"../constant\";\nimport {calculationRate, now} from \"../utils\";\n\nexport default class FetchLoader extends Emitter {\n constructor(player) {\n super();\n this.player = player;\n this.playing = false;\n\n this.abortController = new AbortController();\n //\n this.streamRate = calculationRate(rate => {\n player.emit(EVENTS.kBps, (rate / 1024).toFixed(2));\n });\n player.debug.log('FetchStream', 'init');\n }\n\n async destroy() {\n this.abort()\n this.off();\n this.streamRate = null;\n this.player.debug.log('FetchStream', 'destroy');\n }\n\n /**\n *\n * @param url\n * @param options\n */\n fetchStream(url, options = {}) {\n const {demux} = this.player;\n this.player.debug.log('FetchStream', 'fetchStream', url, JSON.stringify(options));\n this.player._times.streamStart = now();\n const fetchOptions = Object.assign({\n signal: this.abortController.signal,\n }, {\n headers: options.headers || {}\n });\n fetch(url, fetchOptions).then((res) => {\n const reader = res.body.getReader();\n this.emit(EVENTS.streamSuccess);\n const fetchNext = () => {\n reader.read().then(({done, value}) => {\n if (done) {\n demux.close();\n } else {\n this.streamRate && this.streamRate(value.byteLength);\n demux.dispatch(value);\n fetchNext();\n }\n }\n ).catch((e) => {\n demux.close();\n const errorString = e.toString();\n // aborted a request 。\n if (errorString.indexOf(FETCH_ERROR.abortError1) !== -1) {\n return\n }\n\n if (errorString.indexOf(FETCH_ERROR.abortError2) !== -1) {\n return;\n }\n\n if (e.name === FETCH_ERROR.abort) {\n return;\n }\n\n\n this.abort();\n\n this.emit(EVENTS_ERROR.fetchError, e);\n this.player.emit(EVENTS.error, EVENTS_ERROR.fetchError);\n })\n }\n fetchNext();\n }).catch((e) => {\n if (e.name === 'AbortError') {\n return;\n }\n demux.close();\n this.abort();\n this.emit(EVENTS_ERROR.fetchError, e)\n this.player.emit(EVENTS.error, EVENTS_ERROR.fetchError);\n })\n }\n\n abort() {\n if (this.abortController) {\n this.abortController.abort();\n this.abortController = null\n }\n }\n\n\n}\n","import Emitter from \"../utils/emitter\";\nimport {EVENTS, EVENTS_ERROR, WEBSOCKET_STATUS} from \"../constant\";\nimport {calculationRate, now} from \"../utils\";\n\nexport default class WebsocketLoader extends Emitter {\n constructor(player) {\n super();\n this.player = player;\n this.socket = null;\n this.socketStatus = WEBSOCKET_STATUS.notConnect;\n this.wsUrl = null;\n //\n this.streamRate = calculationRate(rate => {\n player.emit(EVENTS.kBps, (rate / 1024).toFixed(2));\n });\n\n player.debug.log('WebsocketLoader', 'init');\n }\n\n async destroy() {\n if (this.socket) {\n this.socket.close(1000, 'Client disconnecting');\n this.socket = null;\n }\n this.socketStatus = WEBSOCKET_STATUS.notConnect;\n this.streamRate = null;\n this.wsUrl = null;\n this.off();\n this.player.debug.log('websocketLoader', 'destroy');\n }\n\n _createWebSocket() {\n const player = this.player;\n const {\n debug,\n events: {proxy},\n demux,\n } = player;\n\n this.socket = new WebSocket(this.wsUrl);\n this.socket.binaryType = 'arraybuffer';\n proxy(this.socket, 'open', () => {\n this.emit(EVENTS.streamSuccess);\n debug.log('websocketLoader', 'socket open');\n this.socketStatus = WEBSOCKET_STATUS.open;\n });\n\n proxy(this.socket, 'message', event => {\n this.streamRate && this.streamRate(event.data.byteLength);\n this._handleMessage(event.data);\n });\n\n\n proxy(this.socket, 'close', () => {\n debug.log('websocketLoader', 'socket close');\n this.emit(EVENTS.streamEnd);\n this.socketStatus = WEBSOCKET_STATUS.close;\n });\n\n proxy(this.socket, 'error', error => {\n debug.log('websocketLoader', 'socket error');\n this.emit(EVENTS_ERROR.websocketError, error);\n this.player.emit(EVENTS.error, EVENTS_ERROR.websocketError);\n this.socketStatus = WEBSOCKET_STATUS.error;\n demux.close();\n debug.log('websocketLoader', `socket error:`, error);\n });\n }\n\n //\n _handleMessage(message) {\n const {demux} = this.player;\n if (!demux) {\n this.player.debug.warn('websocketLoader', 'websocket handle message demux is null');\n return;\n }\n demux.dispatch(message);\n }\n\n\n /**\n *\n * @param url\n * @param options\n */\n fetchStream(url, options) {\n this.player._times.streamStart = now();\n this.wsUrl = url;\n this._createWebSocket();\n }\n\n\n}\n","import FetchLoader from \"./fetchLoader\";\nimport WebsocketLoader from \"./websocketLoader\";\nimport {PLAYER_PLAY_PROTOCOL} from \"../constant\";\n\nexport default class Stream {\n constructor(player) {\n const Loader = Stream.getLoaderFactory(player._opt.protocol);\n return new Loader(player);\n }\n\n static getLoaderFactory(protocol) {\n if (protocol === PLAYER_PLAY_PROTOCOL.fetch) {\n return FetchLoader;\n } else if (protocol === PLAYER_PLAY_PROTOCOL.websocket) {\n return WebsocketLoader;\n }\n }\n}\n","'use strict';\r\n\r\n// Last time updated: 2021-03-09 3:20:22 AM UTC\r\n\r\n// ________________\r\n// RecordRTC v5.6.2\r\n\r\n// Open-Sourced: https://github.com/muaz-khan/RecordRTC\r\n\r\n// --------------------------------------------------\r\n// Muaz Khan - www.MuazKhan.com\r\n// MIT License - www.WebRTC-Experiment.com/licence\r\n// --------------------------------------------------\r\n\r\n// ____________\r\n// RecordRTC.js\r\n\r\n/**\r\n * {@link https://github.com/muaz-khan/RecordRTC|RecordRTC} is a WebRTC JavaScript library for audio/video as well as screen activity recording. It supports Chrome, Firefox, Opera, Android, and Microsoft Edge. Platforms: Linux, Mac and Windows. \r\n * @summary Record audio, video or screen inside the browser.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef RecordRTC\r\n * @class\r\n * @example\r\n * var recorder = RecordRTC(mediaStream or [arrayOfMediaStream], {\r\n * type: 'video', // audio or video or gif or canvas\r\n * recorderType: MediaStreamRecorder || CanvasRecorder || StereoAudioRecorder || Etc\r\n * });\r\n * recorder.startRecording();\r\n * @see For further information:\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - Single media-stream object, array of media-streams, html-canvas-element, etc.\r\n * @param {object} config - {type:\"video\", recorderType: MediaStreamRecorder, disableLogs: true, numberOfAudioChannels: 1, bufferSize: 0, sampleRate: 0, desiredSampRate: 16000, video: HTMLVideoElement, etc.}\r\n */\r\n\r\nfunction RecordRTC(mediaStream, config) {\r\n if (!mediaStream) {\r\n throw 'First parameter is required.';\r\n }\r\n\r\n config = config || {\r\n type: 'video'\r\n };\r\n\r\n config = new RecordRTCConfiguration(mediaStream, config);\r\n\r\n // a reference to user's recordRTC object\r\n var self = this;\r\n\r\n function startRecording(config2) {\r\n if (!config.disableLogs) {\r\n console.log('RecordRTC version: ', self.version);\r\n }\r\n\r\n if (!!config2) {\r\n // allow users to set options using startRecording method\r\n // config2 is similar to main \"config\" object (second parameter over RecordRTC constructor)\r\n config = new RecordRTCConfiguration(mediaStream, config2);\r\n }\r\n\r\n if (!config.disableLogs) {\r\n console.log('started recording ' + config.type + ' stream.');\r\n }\r\n\r\n if (mediaRecorder) {\r\n mediaRecorder.clearRecordedData();\r\n mediaRecorder.record();\r\n\r\n setState('recording');\r\n\r\n if (self.recordingDuration) {\r\n handleRecordingDuration();\r\n }\r\n return self;\r\n }\r\n\r\n initRecorder(function() {\r\n if (self.recordingDuration) {\r\n handleRecordingDuration();\r\n }\r\n });\r\n\r\n return self;\r\n }\r\n\r\n function initRecorder(initCallback) {\r\n if (initCallback) {\r\n config.initCallback = function() {\r\n initCallback();\r\n initCallback = config.initCallback = null; // recorder.initRecorder should be call-backed once.\r\n };\r\n }\r\n\r\n var Recorder = new GetRecorderType(mediaStream, config);\r\n\r\n mediaRecorder = new Recorder(mediaStream, config);\r\n mediaRecorder.record();\r\n\r\n setState('recording');\r\n\r\n if (!config.disableLogs) {\r\n console.log('Initialized recorderType:', mediaRecorder.constructor.name, 'for output-type:', config.type);\r\n }\r\n }\r\n\r\n function stopRecording(callback) {\r\n callback = callback || function() {};\r\n\r\n if (!mediaRecorder) {\r\n warningLog();\r\n return;\r\n }\r\n\r\n if (self.state === 'paused') {\r\n self.resumeRecording();\r\n\r\n setTimeout(function() {\r\n stopRecording(callback);\r\n }, 1);\r\n return;\r\n }\r\n\r\n if (self.state !== 'recording' && !config.disableLogs) {\r\n console.warn('Recording state should be: \"recording\", however current state is: ', self.state);\r\n }\r\n\r\n if (!config.disableLogs) {\r\n console.log('Stopped recording ' + config.type + ' stream.');\r\n }\r\n\r\n if (config.type !== 'gif') {\r\n mediaRecorder.stop(_callback);\r\n } else {\r\n mediaRecorder.stop();\r\n _callback();\r\n }\r\n\r\n setState('stopped');\r\n\r\n function _callback(__blob) {\r\n if (!mediaRecorder) {\r\n if (typeof callback.call === 'function') {\r\n callback.call(self, '');\r\n } else {\r\n callback('');\r\n }\r\n return;\r\n }\r\n\r\n Object.keys(mediaRecorder).forEach(function(key) {\r\n if (typeof mediaRecorder[key] === 'function') {\r\n return;\r\n }\r\n\r\n self[key] = mediaRecorder[key];\r\n });\r\n\r\n var blob = mediaRecorder.blob;\r\n\r\n if (!blob) {\r\n if (__blob) {\r\n mediaRecorder.blob = blob = __blob;\r\n } else {\r\n throw 'Recording failed.';\r\n }\r\n }\r\n\r\n if (blob && !config.disableLogs) {\r\n console.log(blob.type, '->', bytesToSize(blob.size));\r\n }\r\n\r\n if (callback) {\r\n var url;\r\n\r\n try {\r\n url = URL.createObjectURL(blob);\r\n } catch (e) {}\r\n\r\n if (typeof callback.call === 'function') {\r\n callback.call(self, url);\r\n } else {\r\n callback(url);\r\n }\r\n }\r\n\r\n if (!config.autoWriteToDisk) {\r\n return;\r\n }\r\n\r\n getDataURL(function(dataURL) {\r\n var parameter = {};\r\n parameter[config.type + 'Blob'] = dataURL;\r\n DiskStorage.Store(parameter);\r\n });\r\n }\r\n }\r\n\r\n function pauseRecording() {\r\n if (!mediaRecorder) {\r\n warningLog();\r\n return;\r\n }\r\n\r\n if (self.state !== 'recording') {\r\n if (!config.disableLogs) {\r\n console.warn('Unable to pause the recording. Recording state: ', self.state);\r\n }\r\n return;\r\n }\r\n\r\n setState('paused');\r\n\r\n mediaRecorder.pause();\r\n\r\n if (!config.disableLogs) {\r\n console.log('Paused recording.');\r\n }\r\n }\r\n\r\n function resumeRecording() {\r\n if (!mediaRecorder) {\r\n warningLog();\r\n return;\r\n }\r\n\r\n if (self.state !== 'paused') {\r\n if (!config.disableLogs) {\r\n console.warn('Unable to resume the recording. Recording state: ', self.state);\r\n }\r\n return;\r\n }\r\n\r\n setState('recording');\r\n\r\n // not all libs have this method yet\r\n mediaRecorder.resume();\r\n\r\n if (!config.disableLogs) {\r\n console.log('Resumed recording.');\r\n }\r\n }\r\n\r\n function readFile(_blob) {\r\n postMessage(new FileReaderSync().readAsDataURL(_blob));\r\n }\r\n\r\n function getDataURL(callback, _mediaRecorder) {\r\n if (!callback) {\r\n throw 'Pass a callback function over getDataURL.';\r\n }\r\n\r\n var blob = _mediaRecorder ? _mediaRecorder.blob : (mediaRecorder || {}).blob;\r\n\r\n if (!blob) {\r\n if (!config.disableLogs) {\r\n console.warn('Blob encoder did not finish its job yet.');\r\n }\r\n\r\n setTimeout(function() {\r\n getDataURL(callback, _mediaRecorder);\r\n }, 1000);\r\n return;\r\n }\r\n\r\n if (typeof Worker !== 'undefined' && !navigator.mozGetUserMedia) {\r\n var webWorker = processInWebWorker(readFile);\r\n\r\n webWorker.onmessage = function(event) {\r\n callback(event.data);\r\n };\r\n\r\n webWorker.postMessage(blob);\r\n } else {\r\n var reader = new FileReader();\r\n reader.readAsDataURL(blob);\r\n reader.onload = function(event) {\r\n callback(event.target.result);\r\n };\r\n }\r\n\r\n function processInWebWorker(_function) {\r\n try {\r\n var blob = URL.createObjectURL(new Blob([_function.toString(),\r\n 'this.onmessage = function (eee) {' + _function.name + '(eee.data);}'\r\n ], {\r\n type: 'application/javascript'\r\n }));\r\n\r\n var worker = new Worker(blob);\r\n URL.revokeObjectURL(blob);\r\n return worker;\r\n } catch (e) {}\r\n }\r\n }\r\n\r\n function handleRecordingDuration(counter) {\r\n counter = counter || 0;\r\n\r\n if (self.state === 'paused') {\r\n setTimeout(function() {\r\n handleRecordingDuration(counter);\r\n }, 1000);\r\n return;\r\n }\r\n\r\n if (self.state === 'stopped') {\r\n return;\r\n }\r\n\r\n if (counter >= self.recordingDuration) {\r\n stopRecording(self.onRecordingStopped);\r\n return;\r\n }\r\n\r\n counter += 1000; // 1-second\r\n\r\n setTimeout(function() {\r\n handleRecordingDuration(counter);\r\n }, 1000);\r\n }\r\n\r\n function setState(state) {\r\n if (!self) {\r\n return;\r\n }\r\n\r\n self.state = state;\r\n\r\n if (typeof self.onStateChanged.call === 'function') {\r\n self.onStateChanged.call(self, state);\r\n } else {\r\n self.onStateChanged(state);\r\n }\r\n }\r\n\r\n var WARNING = 'It seems that recorder is destroyed or \"startRecording\" is not invoked for ' + config.type + ' recorder.';\r\n\r\n function warningLog() {\r\n if (config.disableLogs === true) {\r\n return;\r\n }\r\n\r\n console.warn(WARNING);\r\n }\r\n\r\n var mediaRecorder;\r\n\r\n var returnObject = {\r\n /**\r\n * This method starts the recording.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * var recorder = RecordRTC(mediaStream, {\r\n * type: 'video'\r\n * });\r\n * recorder.startRecording();\r\n */\r\n startRecording: startRecording,\r\n\r\n /**\r\n * This method stops the recording. It is strongly recommended to get \"blob\" or \"URI\" inside the callback to make sure all recorders finished their job.\r\n * @param {function} callback - Callback to get the recorded blob.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * recorder.stopRecording(function() {\r\n * // use either \"this\" or \"recorder\" object; both are identical\r\n * video.src = this.toURL();\r\n * var blob = this.getBlob();\r\n * });\r\n */\r\n stopRecording: stopRecording,\r\n\r\n /**\r\n * This method pauses the recording. You can resume recording using \"resumeRecording\" method.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @todo Firefox is unable to pause the recording. Fix it.\r\n * @example\r\n * recorder.pauseRecording(); // pause the recording\r\n * recorder.resumeRecording(); // resume again\r\n */\r\n pauseRecording: pauseRecording,\r\n\r\n /**\r\n * This method resumes the recording.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * recorder.pauseRecording(); // first of all, pause the recording\r\n * recorder.resumeRecording(); // now resume it\r\n */\r\n resumeRecording: resumeRecording,\r\n\r\n /**\r\n * This method initializes the recording.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @todo This method should be deprecated.\r\n * @example\r\n * recorder.initRecorder();\r\n */\r\n initRecorder: initRecorder,\r\n\r\n /**\r\n * Ask RecordRTC to auto-stop the recording after 5 minutes.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * var fiveMinutes = 5 * 1000 * 60;\r\n * recorder.setRecordingDuration(fiveMinutes, function() {\r\n * var blob = this.getBlob();\r\n * video.src = this.toURL();\r\n * });\r\n * \r\n * // or otherwise\r\n * recorder.setRecordingDuration(fiveMinutes).onRecordingStopped(function() {\r\n * var blob = this.getBlob();\r\n * video.src = this.toURL();\r\n * });\r\n */\r\n setRecordingDuration: function(recordingDuration, callback) {\r\n if (typeof recordingDuration === 'undefined') {\r\n throw 'recordingDuration is required.';\r\n }\r\n\r\n if (typeof recordingDuration !== 'number') {\r\n throw 'recordingDuration must be a number.';\r\n }\r\n\r\n self.recordingDuration = recordingDuration;\r\n self.onRecordingStopped = callback || function() {};\r\n\r\n return {\r\n onRecordingStopped: function(callback) {\r\n self.onRecordingStopped = callback;\r\n }\r\n };\r\n },\r\n\r\n /**\r\n * This method can be used to clear/reset all the recorded data.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @todo Figure out the difference between \"reset\" and \"clearRecordedData\" methods.\r\n * @example\r\n * recorder.clearRecordedData();\r\n */\r\n clearRecordedData: function() {\r\n if (!mediaRecorder) {\r\n warningLog();\r\n return;\r\n }\r\n\r\n mediaRecorder.clearRecordedData();\r\n\r\n if (!config.disableLogs) {\r\n console.log('Cleared old recorded data.');\r\n }\r\n },\r\n\r\n /**\r\n * Get the recorded blob. Use this method inside the \"stopRecording\" callback.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * recorder.stopRecording(function() {\r\n * var blob = this.getBlob();\r\n *\r\n * var file = new File([blob], 'filename.webm', {\r\n * type: 'video/webm'\r\n * });\r\n *\r\n * var formData = new FormData();\r\n * formData.append('file', file); // upload \"File\" object rather than a \"Blob\"\r\n * uploadToServer(formData);\r\n * });\r\n * @returns {Blob} Returns recorded data as \"Blob\" object.\r\n */\r\n getBlob: function() {\r\n if (!mediaRecorder) {\r\n warningLog();\r\n return;\r\n }\r\n\r\n return mediaRecorder.blob;\r\n },\r\n\r\n /**\r\n * Get data-URI instead of Blob.\r\n * @param {function} callback - Callback to get the Data-URI.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * recorder.stopRecording(function() {\r\n * recorder.getDataURL(function(dataURI) {\r\n * video.src = dataURI;\r\n * });\r\n * });\r\n */\r\n getDataURL: getDataURL,\r\n\r\n /**\r\n * Get virtual/temporary URL. Usage of this URL is limited to current tab.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * recorder.stopRecording(function() {\r\n * video.src = this.toURL();\r\n * });\r\n * @returns {String} Returns a virtual/temporary URL for the recorded \"Blob\".\r\n */\r\n toURL: function() {\r\n if (!mediaRecorder) {\r\n warningLog();\r\n return;\r\n }\r\n\r\n return URL.createObjectURL(mediaRecorder.blob);\r\n },\r\n\r\n /**\r\n * Get internal recording object (i.e. internal module) e.g. MutliStreamRecorder, MediaStreamRecorder, StereoAudioRecorder or WhammyRecorder etc.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * var internalRecorder = recorder.getInternalRecorder();\r\n * if(internalRecorder instanceof MultiStreamRecorder) {\r\n * internalRecorder.addStreams([newAudioStream]);\r\n * internalRecorder.resetVideoStreams([screenStream]);\r\n * }\r\n * @returns {Object} Returns internal recording object.\r\n */\r\n getInternalRecorder: function() {\r\n return mediaRecorder;\r\n },\r\n\r\n /**\r\n * Invoke save-as dialog to save the recorded blob into your disk.\r\n * @param {string} fileName - Set your own file name.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * recorder.stopRecording(function() {\r\n * this.save('file-name');\r\n *\r\n * // or manually:\r\n * invokeSaveAsDialog(this.getBlob(), 'filename.webm');\r\n * });\r\n */\r\n save: function(fileName) {\r\n if (!mediaRecorder) {\r\n warningLog();\r\n return;\r\n }\r\n\r\n invokeSaveAsDialog(mediaRecorder.blob, fileName);\r\n },\r\n\r\n /**\r\n * This method gets a blob from indexed-DB storage.\r\n * @param {function} callback - Callback to get the recorded blob.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * recorder.getFromDisk(function(dataURL) {\r\n * video.src = dataURL;\r\n * });\r\n */\r\n getFromDisk: function(callback) {\r\n if (!mediaRecorder) {\r\n warningLog();\r\n return;\r\n }\r\n\r\n RecordRTC.getFromDisk(config.type, callback);\r\n },\r\n\r\n /**\r\n * This method appends an array of webp images to the recorded video-blob. It takes an \"array\" object.\r\n * @type {Array.}\r\n * @param {Array} arrayOfWebPImages - Array of webp images.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @todo This method should be deprecated.\r\n * @example\r\n * var arrayOfWebPImages = [];\r\n * arrayOfWebPImages.push({\r\n * duration: index,\r\n * image: 'data:image/webp;base64,...'\r\n * });\r\n * recorder.setAdvertisementArray(arrayOfWebPImages);\r\n */\r\n setAdvertisementArray: function(arrayOfWebPImages) {\r\n config.advertisement = [];\r\n\r\n var length = arrayOfWebPImages.length;\r\n for (var i = 0; i < length; i++) {\r\n config.advertisement.push({\r\n duration: i,\r\n image: arrayOfWebPImages[i]\r\n });\r\n }\r\n },\r\n\r\n /**\r\n * It is equivalent to \"recorder.getBlob()\" method. Usage of \"getBlob\" is recommended, though.\r\n * @property {Blob} blob - Recorded Blob can be accessed using this property.\r\n * @memberof RecordRTC\r\n * @instance\r\n * @readonly\r\n * @example\r\n * recorder.stopRecording(function() {\r\n * var blob = this.blob;\r\n *\r\n * // below one is recommended\r\n * var blob = this.getBlob();\r\n * });\r\n */\r\n blob: null,\r\n\r\n /**\r\n * This works only with {recorderType:StereoAudioRecorder}. Use this property on \"stopRecording\" to verify the encoder's sample-rates.\r\n * @property {number} bufferSize - Buffer-size used to encode the WAV container\r\n * @memberof RecordRTC\r\n * @instance\r\n * @readonly\r\n * @example\r\n * recorder.stopRecording(function() {\r\n * alert('Recorder used this buffer-size: ' + this.bufferSize);\r\n * });\r\n */\r\n bufferSize: 0,\r\n\r\n /**\r\n * This works only with {recorderType:StereoAudioRecorder}. Use this property on \"stopRecording\" to verify the encoder's sample-rates.\r\n * @property {number} sampleRate - Sample-rates used to encode the WAV container\r\n * @memberof RecordRTC\r\n * @instance\r\n * @readonly\r\n * @example\r\n * recorder.stopRecording(function() {\r\n * alert('Recorder used these sample-rates: ' + this.sampleRate);\r\n * });\r\n */\r\n sampleRate: 0,\r\n\r\n /**\r\n * {recorderType:StereoAudioRecorder} returns ArrayBuffer object.\r\n * @property {ArrayBuffer} buffer - Audio ArrayBuffer, supported only in Chrome.\r\n * @memberof RecordRTC\r\n * @instance\r\n * @readonly\r\n * @example\r\n * recorder.stopRecording(function() {\r\n * var arrayBuffer = this.buffer;\r\n * alert(arrayBuffer.byteLength);\r\n * });\r\n */\r\n buffer: null,\r\n\r\n /**\r\n * This method resets the recorder. So that you can reuse single recorder instance many times.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * recorder.reset();\r\n * recorder.startRecording();\r\n */\r\n reset: function() {\r\n if (self.state === 'recording' && !config.disableLogs) {\r\n console.warn('Stop an active recorder.');\r\n }\r\n\r\n if (mediaRecorder && typeof mediaRecorder.clearRecordedData === 'function') {\r\n mediaRecorder.clearRecordedData();\r\n }\r\n mediaRecorder = null;\r\n setState('inactive');\r\n self.blob = null;\r\n },\r\n\r\n /**\r\n * This method is called whenever recorder's state changes. Use this as an \"event\".\r\n * @property {String} state - A recorder's state can be: recording, paused, stopped or inactive.\r\n * @method\r\n * @memberof RecordRTC\r\n * @instance\r\n * @example\r\n * recorder.onStateChanged = function(state) {\r\n * console.log('Recorder state: ', state);\r\n * };\r\n */\r\n onStateChanged: function(state) {\r\n if (!config.disableLogs) {\r\n console.log('Recorder state changed:', state);\r\n }\r\n },\r\n\r\n /**\r\n * A recorder can have inactive, recording, paused or stopped states.\r\n * @property {String} state - A recorder's state can be: recording, paused, stopped or inactive.\r\n * @memberof RecordRTC\r\n * @static\r\n * @readonly\r\n * @example\r\n * // this looper function will keep you updated about the recorder's states.\r\n * (function looper() {\r\n * document.querySelector('h1').innerHTML = 'Recorder\\'s state is: ' + recorder.state;\r\n * if(recorder.state === 'stopped') return; // ignore+stop\r\n * setTimeout(looper, 1000); // update after every 3-seconds\r\n * })();\r\n * recorder.startRecording();\r\n */\r\n state: 'inactive',\r\n\r\n /**\r\n * Get recorder's readonly state.\r\n * @method\r\n * @memberof RecordRTC\r\n * @example\r\n * var state = recorder.getState();\r\n * @returns {String} Returns recording state.\r\n */\r\n getState: function() {\r\n return self.state;\r\n },\r\n\r\n /**\r\n * Destroy RecordRTC instance. Clear all recorders and objects.\r\n * @method\r\n * @memberof RecordRTC\r\n * @example\r\n * recorder.destroy();\r\n */\r\n destroy: function() {\r\n var disableLogsCache = config.disableLogs;\r\n\r\n config = {\r\n disableLogs: true\r\n };\r\n self.reset();\r\n setState('destroyed');\r\n returnObject = self = null;\r\n\r\n if (Storage.AudioContextConstructor) {\r\n Storage.AudioContextConstructor.close();\r\n Storage.AudioContextConstructor = null;\r\n }\r\n\r\n config.disableLogs = disableLogsCache;\r\n\r\n if (!config.disableLogs) {\r\n console.log('RecordRTC is destroyed.');\r\n }\r\n },\r\n\r\n /**\r\n * RecordRTC version number\r\n * @property {String} version - Release version number.\r\n * @memberof RecordRTC\r\n * @static\r\n * @readonly\r\n * @example\r\n * alert(recorder.version);\r\n */\r\n version: '5.6.2'\r\n };\r\n\r\n if (!this) {\r\n self = returnObject;\r\n return returnObject;\r\n }\r\n\r\n // if someone wants to use RecordRTC with the \"new\" keyword.\r\n for (var prop in returnObject) {\r\n this[prop] = returnObject[prop];\r\n }\r\n\r\n self = this;\r\n\r\n return returnObject;\r\n}\r\n\r\nRecordRTC.version = '5.6.2';\r\n\r\nif (typeof module !== 'undefined' /* && !!module.exports*/ ) {\r\n module.exports = RecordRTC;\r\n}\r\n\r\nif (typeof define === 'function' && define.amd) {\r\n define('RecordRTC', [], function() {\r\n return RecordRTC;\r\n });\r\n}\n\r\nRecordRTC.getFromDisk = function(type, callback) {\r\n if (!callback) {\r\n throw 'callback is mandatory.';\r\n }\r\n\r\n console.log('Getting recorded ' + (type === 'all' ? 'blobs' : type + ' blob ') + ' from disk!');\r\n DiskStorage.Fetch(function(dataURL, _type) {\r\n if (type !== 'all' && _type === type + 'Blob' && callback) {\r\n callback(dataURL);\r\n }\r\n\r\n if (type === 'all' && callback) {\r\n callback(dataURL, _type.replace('Blob', ''));\r\n }\r\n });\r\n};\r\n\r\n/**\r\n * This method can be used to store recorded blobs into IndexedDB storage.\r\n * @param {object} options - {audio: Blob, video: Blob, gif: Blob}\r\n * @method\r\n * @memberof RecordRTC\r\n * @example\r\n * RecordRTC.writeToDisk({\r\n * audio: audioBlob,\r\n * video: videoBlob,\r\n * gif : gifBlob\r\n * });\r\n */\r\nRecordRTC.writeToDisk = function(options) {\r\n console.log('Writing recorded blob(s) to disk!');\r\n options = options || {};\r\n if (options.audio && options.video && options.gif) {\r\n options.audio.getDataURL(function(audioDataURL) {\r\n options.video.getDataURL(function(videoDataURL) {\r\n options.gif.getDataURL(function(gifDataURL) {\r\n DiskStorage.Store({\r\n audioBlob: audioDataURL,\r\n videoBlob: videoDataURL,\r\n gifBlob: gifDataURL\r\n });\r\n });\r\n });\r\n });\r\n } else if (options.audio && options.video) {\r\n options.audio.getDataURL(function(audioDataURL) {\r\n options.video.getDataURL(function(videoDataURL) {\r\n DiskStorage.Store({\r\n audioBlob: audioDataURL,\r\n videoBlob: videoDataURL\r\n });\r\n });\r\n });\r\n } else if (options.audio && options.gif) {\r\n options.audio.getDataURL(function(audioDataURL) {\r\n options.gif.getDataURL(function(gifDataURL) {\r\n DiskStorage.Store({\r\n audioBlob: audioDataURL,\r\n gifBlob: gifDataURL\r\n });\r\n });\r\n });\r\n } else if (options.video && options.gif) {\r\n options.video.getDataURL(function(videoDataURL) {\r\n options.gif.getDataURL(function(gifDataURL) {\r\n DiskStorage.Store({\r\n videoBlob: videoDataURL,\r\n gifBlob: gifDataURL\r\n });\r\n });\r\n });\r\n } else if (options.audio) {\r\n options.audio.getDataURL(function(audioDataURL) {\r\n DiskStorage.Store({\r\n audioBlob: audioDataURL\r\n });\r\n });\r\n } else if (options.video) {\r\n options.video.getDataURL(function(videoDataURL) {\r\n DiskStorage.Store({\r\n videoBlob: videoDataURL\r\n });\r\n });\r\n } else if (options.gif) {\r\n options.gif.getDataURL(function(gifDataURL) {\r\n DiskStorage.Store({\r\n gifBlob: gifDataURL\r\n });\r\n });\r\n }\r\n};\n\r\n// __________________________\r\n// RecordRTC-Configuration.js\r\n\r\n/**\r\n * {@link RecordRTCConfiguration} is an inner/private helper for {@link RecordRTC}.\r\n * @summary It configures the 2nd parameter passed over {@link RecordRTC} and returns a valid \"config\" object.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef RecordRTCConfiguration\r\n * @class\r\n * @example\r\n * var options = RecordRTCConfiguration(mediaStream, options);\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.\r\n * @param {object} config - {type:\"video\", disableLogs: true, numberOfAudioChannels: 1, bufferSize: 0, sampleRate: 0, video: HTMLVideoElement, getNativeBlob:true, etc.}\r\n */\r\n\r\nfunction RecordRTCConfiguration(mediaStream, config) {\r\n if (!config.recorderType && !config.type) {\r\n if (!!config.audio && !!config.video) {\r\n config.type = 'video';\r\n } else if (!!config.audio && !config.video) {\r\n config.type = 'audio';\r\n }\r\n }\r\n\r\n if (config.recorderType && !config.type) {\r\n if (config.recorderType === WhammyRecorder || config.recorderType === CanvasRecorder || (typeof WebAssemblyRecorder !== 'undefined' && config.recorderType === WebAssemblyRecorder)) {\r\n config.type = 'video';\r\n } else if (config.recorderType === GifRecorder) {\r\n config.type = 'gif';\r\n } else if (config.recorderType === StereoAudioRecorder) {\r\n config.type = 'audio';\r\n } else if (config.recorderType === MediaStreamRecorder) {\r\n if (getTracks(mediaStream, 'audio').length && getTracks(mediaStream, 'video').length) {\r\n config.type = 'video';\r\n } else if (!getTracks(mediaStream, 'audio').length && getTracks(mediaStream, 'video').length) {\r\n config.type = 'video';\r\n } else if (getTracks(mediaStream, 'audio').length && !getTracks(mediaStream, 'video').length) {\r\n config.type = 'audio';\r\n } else {\r\n // config.type = 'UnKnown';\r\n }\r\n }\r\n }\r\n\r\n if (typeof MediaStreamRecorder !== 'undefined' && typeof MediaRecorder !== 'undefined' && 'requestData' in MediaRecorder.prototype) {\r\n if (!config.mimeType) {\r\n config.mimeType = 'video/webm';\r\n }\r\n\r\n if (!config.type) {\r\n config.type = config.mimeType.split('/')[0];\r\n }\r\n\r\n if (!config.bitsPerSecond) {\r\n // config.bitsPerSecond = 128000;\r\n }\r\n }\r\n\r\n // consider default type=audio\r\n if (!config.type) {\r\n if (config.mimeType) {\r\n config.type = config.mimeType.split('/')[0];\r\n }\r\n if (!config.type) {\r\n config.type = 'audio';\r\n }\r\n }\r\n\r\n return config;\r\n}\n\r\n// __________________\r\n// GetRecorderType.js\r\n\r\n/**\r\n * {@link GetRecorderType} is an inner/private helper for {@link RecordRTC}.\r\n * @summary It returns best recorder-type available for your browser.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef GetRecorderType\r\n * @class\r\n * @example\r\n * var RecorderType = GetRecorderType(options);\r\n * var recorder = new RecorderType(options);\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.\r\n * @param {object} config - {type:\"video\", disableLogs: true, numberOfAudioChannels: 1, bufferSize: 0, sampleRate: 0, video: HTMLVideoElement, etc.}\r\n */\r\n\r\nfunction GetRecorderType(mediaStream, config) {\r\n var recorder;\r\n\r\n // StereoAudioRecorder can work with all three: Edge, Firefox and Chrome\r\n // todo: detect if it is Edge, then auto use: StereoAudioRecorder\r\n if (isChrome || isEdge || isOpera) {\r\n // Media Stream Recording API has not been implemented in chrome yet;\r\n // That's why using WebAudio API to record stereo audio in WAV format\r\n recorder = StereoAudioRecorder;\r\n }\r\n\r\n if (typeof MediaRecorder !== 'undefined' && 'requestData' in MediaRecorder.prototype && !isChrome) {\r\n recorder = MediaStreamRecorder;\r\n }\r\n\r\n // video recorder (in WebM format)\r\n if (config.type === 'video' && (isChrome || isOpera)) {\r\n recorder = WhammyRecorder;\r\n\r\n if (typeof WebAssemblyRecorder !== 'undefined' && typeof ReadableStream !== 'undefined') {\r\n recorder = WebAssemblyRecorder;\r\n }\r\n }\r\n\r\n // video recorder (in Gif format)\r\n if (config.type === 'gif') {\r\n recorder = GifRecorder;\r\n }\r\n\r\n // html2canvas recording!\r\n if (config.type === 'canvas') {\r\n recorder = CanvasRecorder;\r\n }\r\n\r\n if (isMediaRecorderCompatible() && recorder !== CanvasRecorder && recorder !== GifRecorder && typeof MediaRecorder !== 'undefined' && 'requestData' in MediaRecorder.prototype) {\r\n if (getTracks(mediaStream, 'video').length || getTracks(mediaStream, 'audio').length) {\r\n // audio-only recording\r\n if (config.type === 'audio') {\r\n if (typeof MediaRecorder.isTypeSupported === 'function' && MediaRecorder.isTypeSupported('audio/webm')) {\r\n recorder = MediaStreamRecorder;\r\n }\r\n // else recorder = StereoAudioRecorder;\r\n } else {\r\n // video or screen tracks\r\n if (typeof MediaRecorder.isTypeSupported === 'function' && MediaRecorder.isTypeSupported('video/webm')) {\r\n recorder = MediaStreamRecorder;\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (mediaStream instanceof Array && mediaStream.length) {\r\n recorder = MultiStreamRecorder;\r\n }\r\n\r\n if (config.recorderType) {\r\n recorder = config.recorderType;\r\n }\r\n\r\n if (!config.disableLogs && !!recorder && !!recorder.name) {\r\n console.log('Using recorderType:', recorder.name || recorder.constructor.name);\r\n }\r\n\r\n if (!recorder && isSafari) {\r\n recorder = MediaStreamRecorder;\r\n }\r\n\r\n return recorder;\r\n}\n\r\n// _____________\r\n// MRecordRTC.js\r\n\r\n/**\r\n * MRecordRTC runs on top of {@link RecordRTC} to bring multiple recordings in a single place, by providing simple API.\r\n * @summary MRecordRTC stands for \"Multiple-RecordRTC\".\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef MRecordRTC\r\n * @class\r\n * @example\r\n * var recorder = new MRecordRTC();\r\n * recorder.addStream(MediaStream);\r\n * recorder.mediaType = {\r\n * audio: true, // or StereoAudioRecorder or MediaStreamRecorder\r\n * video: true, // or WhammyRecorder or MediaStreamRecorder or WebAssemblyRecorder or CanvasRecorder\r\n * gif: true // or GifRecorder\r\n * };\r\n * // mimeType is optional and should be set only in advance cases.\r\n * recorder.mimeType = {\r\n * audio: 'audio/wav',\r\n * video: 'video/webm',\r\n * gif: 'image/gif'\r\n * };\r\n * recorder.startRecording();\r\n * @see For further information:\r\n * @see {@link https://github.com/muaz-khan/RecordRTC/tree/master/MRecordRTC|MRecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.\r\n * @requires {@link RecordRTC}\r\n */\r\n\r\nfunction MRecordRTC(mediaStream) {\r\n\r\n /**\r\n * This method attaches MediaStream object to {@link MRecordRTC}.\r\n * @param {MediaStream} mediaStream - A MediaStream object, either fetched using getUserMedia API, or generated using captureStreamUntilEnded or WebAudio API.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.addStream(MediaStream);\r\n */\r\n this.addStream = function(_mediaStream) {\r\n if (_mediaStream) {\r\n mediaStream = _mediaStream;\r\n }\r\n };\r\n\r\n /**\r\n * This property can be used to set the recording type e.g. audio, or video, or gif, or canvas.\r\n * @property {object} mediaType - {audio: true, video: true, gif: true}\r\n * @memberof MRecordRTC\r\n * @example\r\n * var recorder = new MRecordRTC();\r\n * recorder.mediaType = {\r\n * audio: true, // TRUE or StereoAudioRecorder or MediaStreamRecorder\r\n * video: true, // TRUE or WhammyRecorder or MediaStreamRecorder or WebAssemblyRecorder or CanvasRecorder\r\n * gif : true // TRUE or GifRecorder\r\n * };\r\n */\r\n this.mediaType = {\r\n audio: true,\r\n video: true\r\n };\r\n\r\n /**\r\n * This method starts recording.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.startRecording();\r\n */\r\n this.startRecording = function() {\r\n var mediaType = this.mediaType;\r\n var recorderType;\r\n var mimeType = this.mimeType || {\r\n audio: null,\r\n video: null,\r\n gif: null\r\n };\r\n\r\n if (typeof mediaType.audio !== 'function' && isMediaRecorderCompatible() && !getTracks(mediaStream, 'audio').length) {\r\n mediaType.audio = false;\r\n }\r\n\r\n if (typeof mediaType.video !== 'function' && isMediaRecorderCompatible() && !getTracks(mediaStream, 'video').length) {\r\n mediaType.video = false;\r\n }\r\n\r\n if (typeof mediaType.gif !== 'function' && isMediaRecorderCompatible() && !getTracks(mediaStream, 'video').length) {\r\n mediaType.gif = false;\r\n }\r\n\r\n if (!mediaType.audio && !mediaType.video && !mediaType.gif) {\r\n throw 'MediaStream must have either audio or video tracks.';\r\n }\r\n\r\n if (!!mediaType.audio) {\r\n recorderType = null;\r\n if (typeof mediaType.audio === 'function') {\r\n recorderType = mediaType.audio;\r\n }\r\n\r\n this.audioRecorder = new RecordRTC(mediaStream, {\r\n type: 'audio',\r\n bufferSize: this.bufferSize,\r\n sampleRate: this.sampleRate,\r\n numberOfAudioChannels: this.numberOfAudioChannels || 2,\r\n disableLogs: this.disableLogs,\r\n recorderType: recorderType,\r\n mimeType: mimeType.audio,\r\n timeSlice: this.timeSlice,\r\n onTimeStamp: this.onTimeStamp\r\n });\r\n\r\n if (!mediaType.video) {\r\n this.audioRecorder.startRecording();\r\n }\r\n }\r\n\r\n if (!!mediaType.video) {\r\n recorderType = null;\r\n if (typeof mediaType.video === 'function') {\r\n recorderType = mediaType.video;\r\n }\r\n\r\n var newStream = mediaStream;\r\n\r\n if (isMediaRecorderCompatible() && !!mediaType.audio && typeof mediaType.audio === 'function') {\r\n var videoTrack = getTracks(mediaStream, 'video')[0];\r\n\r\n if (isFirefox) {\r\n newStream = new MediaStream();\r\n newStream.addTrack(videoTrack);\r\n\r\n if (recorderType && recorderType === WhammyRecorder) {\r\n // Firefox does NOT supports webp-encoding yet\r\n // But Firefox do supports WebAssemblyRecorder\r\n recorderType = MediaStreamRecorder;\r\n }\r\n } else {\r\n newStream = new MediaStream();\r\n newStream.addTrack(videoTrack);\r\n }\r\n }\r\n\r\n this.videoRecorder = new RecordRTC(newStream, {\r\n type: 'video',\r\n video: this.video,\r\n canvas: this.canvas,\r\n frameInterval: this.frameInterval || 10,\r\n disableLogs: this.disableLogs,\r\n recorderType: recorderType,\r\n mimeType: mimeType.video,\r\n timeSlice: this.timeSlice,\r\n onTimeStamp: this.onTimeStamp,\r\n workerPath: this.workerPath,\r\n webAssemblyPath: this.webAssemblyPath,\r\n frameRate: this.frameRate, // used by WebAssemblyRecorder; values: usually 30; accepts any.\r\n bitrate: this.bitrate // used by WebAssemblyRecorder; values: 0 to 1000+\r\n });\r\n\r\n if (!mediaType.audio) {\r\n this.videoRecorder.startRecording();\r\n }\r\n }\r\n\r\n if (!!mediaType.audio && !!mediaType.video) {\r\n var self = this;\r\n\r\n var isSingleRecorder = isMediaRecorderCompatible() === true;\r\n\r\n if (mediaType.audio instanceof StereoAudioRecorder && !!mediaType.video) {\r\n isSingleRecorder = false;\r\n } else if (mediaType.audio !== true && mediaType.video !== true && mediaType.audio !== mediaType.video) {\r\n isSingleRecorder = false;\r\n }\r\n\r\n if (isSingleRecorder === true) {\r\n self.audioRecorder = null;\r\n self.videoRecorder.startRecording();\r\n } else {\r\n self.videoRecorder.initRecorder(function() {\r\n self.audioRecorder.initRecorder(function() {\r\n // Both recorders are ready to record things accurately\r\n self.videoRecorder.startRecording();\r\n self.audioRecorder.startRecording();\r\n });\r\n });\r\n }\r\n }\r\n\r\n if (!!mediaType.gif) {\r\n recorderType = null;\r\n if (typeof mediaType.gif === 'function') {\r\n recorderType = mediaType.gif;\r\n }\r\n this.gifRecorder = new RecordRTC(mediaStream, {\r\n type: 'gif',\r\n frameRate: this.frameRate || 200,\r\n quality: this.quality || 10,\r\n disableLogs: this.disableLogs,\r\n recorderType: recorderType,\r\n mimeType: mimeType.gif\r\n });\r\n this.gifRecorder.startRecording();\r\n }\r\n };\r\n\r\n /**\r\n * This method stops recording.\r\n * @param {function} callback - Callback function is invoked when all encoders finished their jobs.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.stopRecording(function(recording){\r\n * var audioBlob = recording.audio;\r\n * var videoBlob = recording.video;\r\n * var gifBlob = recording.gif;\r\n * });\r\n */\r\n this.stopRecording = function(callback) {\r\n callback = callback || function() {};\r\n\r\n if (this.audioRecorder) {\r\n this.audioRecorder.stopRecording(function(blobURL) {\r\n callback(blobURL, 'audio');\r\n });\r\n }\r\n\r\n if (this.videoRecorder) {\r\n this.videoRecorder.stopRecording(function(blobURL) {\r\n callback(blobURL, 'video');\r\n });\r\n }\r\n\r\n if (this.gifRecorder) {\r\n this.gifRecorder.stopRecording(function(blobURL) {\r\n callback(blobURL, 'gif');\r\n });\r\n }\r\n };\r\n\r\n /**\r\n * This method pauses recording.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.pauseRecording();\r\n */\r\n this.pauseRecording = function() {\r\n if (this.audioRecorder) {\r\n this.audioRecorder.pauseRecording();\r\n }\r\n\r\n if (this.videoRecorder) {\r\n this.videoRecorder.pauseRecording();\r\n }\r\n\r\n if (this.gifRecorder) {\r\n this.gifRecorder.pauseRecording();\r\n }\r\n };\r\n\r\n /**\r\n * This method resumes recording.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.resumeRecording();\r\n */\r\n this.resumeRecording = function() {\r\n if (this.audioRecorder) {\r\n this.audioRecorder.resumeRecording();\r\n }\r\n\r\n if (this.videoRecorder) {\r\n this.videoRecorder.resumeRecording();\r\n }\r\n\r\n if (this.gifRecorder) {\r\n this.gifRecorder.resumeRecording();\r\n }\r\n };\r\n\r\n /**\r\n * This method can be used to manually get all recorded blobs.\r\n * @param {function} callback - All recorded blobs are passed back to the \"callback\" function.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.getBlob(function(recording){\r\n * var audioBlob = recording.audio;\r\n * var videoBlob = recording.video;\r\n * var gifBlob = recording.gif;\r\n * });\r\n * // or\r\n * var audioBlob = recorder.getBlob().audio;\r\n * var videoBlob = recorder.getBlob().video;\r\n */\r\n this.getBlob = function(callback) {\r\n var output = {};\r\n\r\n if (this.audioRecorder) {\r\n output.audio = this.audioRecorder.getBlob();\r\n }\r\n\r\n if (this.videoRecorder) {\r\n output.video = this.videoRecorder.getBlob();\r\n }\r\n\r\n if (this.gifRecorder) {\r\n output.gif = this.gifRecorder.getBlob();\r\n }\r\n\r\n if (callback) {\r\n callback(output);\r\n }\r\n\r\n return output;\r\n };\r\n\r\n /**\r\n * Destroy all recorder instances.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.destroy();\r\n */\r\n this.destroy = function() {\r\n if (this.audioRecorder) {\r\n this.audioRecorder.destroy();\r\n this.audioRecorder = null;\r\n }\r\n\r\n if (this.videoRecorder) {\r\n this.videoRecorder.destroy();\r\n this.videoRecorder = null;\r\n }\r\n\r\n if (this.gifRecorder) {\r\n this.gifRecorder.destroy();\r\n this.gifRecorder = null;\r\n }\r\n };\r\n\r\n /**\r\n * This method can be used to manually get all recorded blobs' DataURLs.\r\n * @param {function} callback - All recorded blobs' DataURLs are passed back to the \"callback\" function.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.getDataURL(function(recording){\r\n * var audioDataURL = recording.audio;\r\n * var videoDataURL = recording.video;\r\n * var gifDataURL = recording.gif;\r\n * });\r\n */\r\n this.getDataURL = function(callback) {\r\n this.getBlob(function(blob) {\r\n if (blob.audio && blob.video) {\r\n getDataURL(blob.audio, function(_audioDataURL) {\r\n getDataURL(blob.video, function(_videoDataURL) {\r\n callback({\r\n audio: _audioDataURL,\r\n video: _videoDataURL\r\n });\r\n });\r\n });\r\n } else if (blob.audio) {\r\n getDataURL(blob.audio, function(_audioDataURL) {\r\n callback({\r\n audio: _audioDataURL\r\n });\r\n });\r\n } else if (blob.video) {\r\n getDataURL(blob.video, function(_videoDataURL) {\r\n callback({\r\n video: _videoDataURL\r\n });\r\n });\r\n }\r\n });\r\n\r\n function getDataURL(blob, callback00) {\r\n if (typeof Worker !== 'undefined') {\r\n var webWorker = processInWebWorker(function readFile(_blob) {\r\n postMessage(new FileReaderSync().readAsDataURL(_blob));\r\n });\r\n\r\n webWorker.onmessage = function(event) {\r\n callback00(event.data);\r\n };\r\n\r\n webWorker.postMessage(blob);\r\n } else {\r\n var reader = new FileReader();\r\n reader.readAsDataURL(blob);\r\n reader.onload = function(event) {\r\n callback00(event.target.result);\r\n };\r\n }\r\n }\r\n\r\n function processInWebWorker(_function) {\r\n var blob = URL.createObjectURL(new Blob([_function.toString(),\r\n 'this.onmessage = function (eee) {' + _function.name + '(eee.data);}'\r\n ], {\r\n type: 'application/javascript'\r\n }));\r\n\r\n var worker = new Worker(blob);\r\n var url;\r\n if (typeof URL !== 'undefined') {\r\n url = URL;\r\n } else if (typeof webkitURL !== 'undefined') {\r\n url = webkitURL;\r\n } else {\r\n throw 'Neither URL nor webkitURL detected.';\r\n }\r\n url.revokeObjectURL(blob);\r\n return worker;\r\n }\r\n };\r\n\r\n /**\r\n * This method can be used to ask {@link MRecordRTC} to write all recorded blobs into IndexedDB storage.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.writeToDisk();\r\n */\r\n this.writeToDisk = function() {\r\n RecordRTC.writeToDisk({\r\n audio: this.audioRecorder,\r\n video: this.videoRecorder,\r\n gif: this.gifRecorder\r\n });\r\n };\r\n\r\n /**\r\n * This method can be used to invoke a save-as dialog for all recorded blobs.\r\n * @param {object} args - {audio: 'audio-name', video: 'video-name', gif: 'gif-name'}\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * recorder.save({\r\n * audio: 'audio-file-name',\r\n * video: 'video-file-name',\r\n * gif : 'gif-file-name'\r\n * });\r\n */\r\n this.save = function(args) {\r\n args = args || {\r\n audio: true,\r\n video: true,\r\n gif: true\r\n };\r\n\r\n if (!!args.audio && this.audioRecorder) {\r\n this.audioRecorder.save(typeof args.audio === 'string' ? args.audio : '');\r\n }\r\n\r\n if (!!args.video && this.videoRecorder) {\r\n this.videoRecorder.save(typeof args.video === 'string' ? args.video : '');\r\n }\r\n if (!!args.gif && this.gifRecorder) {\r\n this.gifRecorder.save(typeof args.gif === 'string' ? args.gif : '');\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * This method can be used to get all recorded blobs from IndexedDB storage.\r\n * @param {string} type - 'all' or 'audio' or 'video' or 'gif'\r\n * @param {function} callback - Callback function to get all stored blobs.\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * MRecordRTC.getFromDisk('all', function(dataURL, type){\r\n * if(type === 'audio') { }\r\n * if(type === 'video') { }\r\n * if(type === 'gif') { }\r\n * });\r\n */\r\nMRecordRTC.getFromDisk = RecordRTC.getFromDisk;\r\n\r\n/**\r\n * This method can be used to store recorded blobs into IndexedDB storage.\r\n * @param {object} options - {audio: Blob, video: Blob, gif: Blob}\r\n * @method\r\n * @memberof MRecordRTC\r\n * @example\r\n * MRecordRTC.writeToDisk({\r\n * audio: audioBlob,\r\n * video: videoBlob,\r\n * gif : gifBlob\r\n * });\r\n */\r\nMRecordRTC.writeToDisk = RecordRTC.writeToDisk;\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.MRecordRTC = MRecordRTC;\r\n}\n\r\nvar browserFakeUserAgent = 'Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45';\r\n\r\n(function(that) {\r\n if (!that) {\r\n return;\r\n }\r\n\r\n if (typeof window !== 'undefined') {\r\n return;\r\n }\r\n\r\n if (typeof global === 'undefined') {\r\n return;\r\n }\r\n\r\n global.navigator = {\r\n userAgent: browserFakeUserAgent,\r\n getUserMedia: function() {}\r\n };\r\n\r\n if (!global.console) {\r\n global.console = {};\r\n }\r\n\r\n if (typeof global.console.log === 'undefined' || typeof global.console.error === 'undefined') {\r\n global.console.error = global.console.log = global.console.log || function() {\r\n console.log(arguments);\r\n };\r\n }\r\n\r\n if (typeof document === 'undefined') {\r\n /*global document:true */\r\n that.document = {\r\n documentElement: {\r\n appendChild: function() {\r\n return '';\r\n }\r\n }\r\n };\r\n\r\n document.createElement = document.captureStream = document.mozCaptureStream = function() {\r\n var obj = {\r\n getContext: function() {\r\n return obj;\r\n },\r\n play: function() {},\r\n pause: function() {},\r\n drawImage: function() {},\r\n toDataURL: function() {\r\n return '';\r\n },\r\n style: {}\r\n };\r\n return obj;\r\n };\r\n\r\n that.HTMLVideoElement = function() {};\r\n }\r\n\r\n if (typeof location === 'undefined') {\r\n /*global location:true */\r\n that.location = {\r\n protocol: 'file:',\r\n href: '',\r\n hash: ''\r\n };\r\n }\r\n\r\n if (typeof screen === 'undefined') {\r\n /*global screen:true */\r\n that.screen = {\r\n width: 0,\r\n height: 0\r\n };\r\n }\r\n\r\n if (typeof URL === 'undefined') {\r\n /*global screen:true */\r\n that.URL = {\r\n createObjectURL: function() {\r\n return '';\r\n },\r\n revokeObjectURL: function() {\r\n return '';\r\n }\r\n };\r\n }\r\n\r\n /*global window:true */\r\n that.window = global;\r\n})(typeof global !== 'undefined' ? global : null);\n\r\n// _____________________________\r\n// Cross-Browser-Declarations.js\r\n\r\n// animation-frame used in WebM recording\r\n\r\n/*jshint -W079 */\r\nvar requestAnimationFrame = window.requestAnimationFrame;\r\nif (typeof requestAnimationFrame === 'undefined') {\r\n if (typeof webkitRequestAnimationFrame !== 'undefined') {\r\n /*global requestAnimationFrame:true */\r\n requestAnimationFrame = webkitRequestAnimationFrame;\r\n } else if (typeof mozRequestAnimationFrame !== 'undefined') {\r\n /*global requestAnimationFrame:true */\r\n requestAnimationFrame = mozRequestAnimationFrame;\r\n } else if (typeof msRequestAnimationFrame !== 'undefined') {\r\n /*global requestAnimationFrame:true */\r\n requestAnimationFrame = msRequestAnimationFrame;\r\n } else if (typeof requestAnimationFrame === 'undefined') {\r\n // via: https://gist.github.com/paulirish/1579671\r\n var lastTime = 0;\r\n\r\n /*global requestAnimationFrame:true */\r\n requestAnimationFrame = function(callback, element) {\r\n var currTime = new Date().getTime();\r\n var timeToCall = Math.max(0, 16 - (currTime - lastTime));\r\n var id = setTimeout(function() {\r\n callback(currTime + timeToCall);\r\n }, timeToCall);\r\n lastTime = currTime + timeToCall;\r\n return id;\r\n };\r\n }\r\n}\r\n\r\n/*jshint -W079 */\r\nvar cancelAnimationFrame = window.cancelAnimationFrame;\r\nif (typeof cancelAnimationFrame === 'undefined') {\r\n if (typeof webkitCancelAnimationFrame !== 'undefined') {\r\n /*global cancelAnimationFrame:true */\r\n cancelAnimationFrame = webkitCancelAnimationFrame;\r\n } else if (typeof mozCancelAnimationFrame !== 'undefined') {\r\n /*global cancelAnimationFrame:true */\r\n cancelAnimationFrame = mozCancelAnimationFrame;\r\n } else if (typeof msCancelAnimationFrame !== 'undefined') {\r\n /*global cancelAnimationFrame:true */\r\n cancelAnimationFrame = msCancelAnimationFrame;\r\n } else if (typeof cancelAnimationFrame === 'undefined') {\r\n /*global cancelAnimationFrame:true */\r\n cancelAnimationFrame = function(id) {\r\n clearTimeout(id);\r\n };\r\n }\r\n}\r\n\r\n// WebAudio API representer\r\nvar AudioContext = window.AudioContext;\r\n\r\nif (typeof AudioContext === 'undefined') {\r\n if (typeof webkitAudioContext !== 'undefined') {\r\n /*global AudioContext:true */\r\n AudioContext = webkitAudioContext;\r\n }\r\n\r\n if (typeof mozAudioContext !== 'undefined') {\r\n /*global AudioContext:true */\r\n AudioContext = mozAudioContext;\r\n }\r\n}\r\n\r\n/*jshint -W079 */\r\nvar URL = window.URL;\r\n\r\nif (typeof URL === 'undefined' && typeof webkitURL !== 'undefined') {\r\n /*global URL:true */\r\n URL = webkitURL;\r\n}\r\n\r\nif (typeof navigator !== 'undefined' && typeof navigator.getUserMedia === 'undefined') { // maybe window.navigator?\r\n if (typeof navigator.webkitGetUserMedia !== 'undefined') {\r\n navigator.getUserMedia = navigator.webkitGetUserMedia;\r\n }\r\n\r\n if (typeof navigator.mozGetUserMedia !== 'undefined') {\r\n navigator.getUserMedia = navigator.mozGetUserMedia;\r\n }\r\n}\r\n\r\nvar isEdge = navigator.userAgent.indexOf('Edge') !== -1 && (!!navigator.msSaveBlob || !!navigator.msSaveOrOpenBlob);\r\nvar isOpera = !!window.opera || navigator.userAgent.indexOf('OPR/') !== -1;\r\nvar isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && ('netscape' in window) && / rv:/.test(navigator.userAgent);\r\nvar isChrome = (!isOpera && !isEdge && !!navigator.webkitGetUserMedia) || isElectron() || navigator.userAgent.toLowerCase().indexOf('chrome/') !== -1;\r\n\r\nvar isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\r\n\r\nif (isSafari && !isChrome && navigator.userAgent.indexOf('CriOS') !== -1) {\r\n isSafari = false;\r\n isChrome = true;\r\n}\r\n\r\nvar MediaStream = window.MediaStream;\r\n\r\nif (typeof MediaStream === 'undefined' && typeof webkitMediaStream !== 'undefined') {\r\n MediaStream = webkitMediaStream;\r\n}\r\n\r\n/*global MediaStream:true */\r\nif (typeof MediaStream !== 'undefined') {\r\n // override \"stop\" method for all browsers\r\n if (typeof MediaStream.prototype.stop === 'undefined') {\r\n MediaStream.prototype.stop = function() {\r\n this.getTracks().forEach(function(track) {\r\n track.stop();\r\n });\r\n };\r\n }\r\n}\r\n\r\n// below function via: http://goo.gl/B3ae8c\r\n/**\r\n * Return human-readable file size.\r\n * @param {number} bytes - Pass bytes and get formatted string.\r\n * @returns {string} - formatted string\r\n * @example\r\n * bytesToSize(1024*1024*5) === '5 GB'\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n */\r\nfunction bytesToSize(bytes) {\r\n var k = 1000;\r\n var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];\r\n if (bytes === 0) {\r\n return '0 Bytes';\r\n }\r\n var i = parseInt(Math.floor(Math.log(bytes) / Math.log(k)), 10);\r\n return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];\r\n}\r\n\r\n/**\r\n * @param {Blob} file - File or Blob object. This parameter is required.\r\n * @param {string} fileName - Optional file name e.g. \"Recorded-Video.webm\"\r\n * @example\r\n * invokeSaveAsDialog(blob or file, [optional] fileName);\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n */\r\nfunction invokeSaveAsDialog(file, fileName) {\r\n if (!file) {\r\n throw 'Blob object is required.';\r\n }\r\n\r\n if (!file.type) {\r\n try {\r\n file.type = 'video/webm';\r\n } catch (e) {}\r\n }\r\n\r\n var fileExtension = (file.type || 'video/webm').split('/')[1];\r\n if (fileExtension.indexOf(';') !== -1) {\r\n // extended mimetype, e.g. 'video/webm;codecs=vp8,opus'\r\n fileExtension = fileExtension.split(';')[0];\r\n }\r\n if (fileName && fileName.indexOf('.') !== -1) {\r\n var splitted = fileName.split('.');\r\n fileName = splitted[0];\r\n fileExtension = splitted[1];\r\n }\r\n\r\n var fileFullName = (fileName || (Math.round(Math.random() * 9999999999) + 888888888)) + '.' + fileExtension;\r\n\r\n if (typeof navigator.msSaveOrOpenBlob !== 'undefined') {\r\n return navigator.msSaveOrOpenBlob(file, fileFullName);\r\n } else if (typeof navigator.msSaveBlob !== 'undefined') {\r\n return navigator.msSaveBlob(file, fileFullName);\r\n }\r\n\r\n var hyperlink = document.createElement('a');\r\n hyperlink.href = URL.createObjectURL(file);\r\n hyperlink.download = fileFullName;\r\n\r\n hyperlink.style = 'display:none;opacity:0;color:transparent;';\r\n (document.body || document.documentElement).appendChild(hyperlink);\r\n\r\n if (typeof hyperlink.click === 'function') {\r\n hyperlink.click();\r\n } else {\r\n hyperlink.target = '_blank';\r\n hyperlink.dispatchEvent(new MouseEvent('click', {\r\n view: window,\r\n bubbles: true,\r\n cancelable: true\r\n }));\r\n }\r\n\r\n URL.revokeObjectURL(hyperlink.href);\r\n}\r\n\r\n/**\r\n * from: https://github.com/cheton/is-electron/blob/master/index.js\r\n **/\r\nfunction isElectron() {\r\n // Renderer process\r\n if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') {\r\n return true;\r\n }\r\n\r\n // Main process\r\n if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electron) {\r\n return true;\r\n }\r\n\r\n // Detect the user agent when the `nodeIntegration` option is set to true\r\n if (typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) {\r\n return true;\r\n }\r\n\r\n return false;\r\n}\r\n\r\nfunction getTracks(stream, kind) {\r\n if (!stream || !stream.getTracks) {\r\n return [];\r\n }\r\n\r\n return stream.getTracks().filter(function(t) {\r\n return t.kind === (kind || 'audio');\r\n });\r\n}\r\n\r\nfunction setSrcObject(stream, element) {\r\n if ('srcObject' in element) {\r\n element.srcObject = stream;\r\n } else if ('mozSrcObject' in element) {\r\n element.mozSrcObject = stream;\r\n } else {\r\n element.srcObject = stream;\r\n }\r\n}\r\n\r\n/**\r\n * @param {Blob} file - File or Blob object.\r\n * @param {function} callback - Callback function.\r\n * @example\r\n * getSeekableBlob(blob or file, callback);\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n */\r\nfunction getSeekableBlob(inputBlob, callback) {\r\n // EBML.js copyrights goes to: https://github.com/legokichi/ts-ebml\r\n if (typeof EBML === 'undefined') {\r\n throw new Error('Please link: https://www.webrtc-experiment.com/EBML.js');\r\n }\r\n\r\n var reader = new EBML.Reader();\r\n var decoder = new EBML.Decoder();\r\n var tools = EBML.tools;\r\n\r\n var fileReader = new FileReader();\r\n fileReader.onload = function(e) {\r\n var ebmlElms = decoder.decode(this.result);\r\n ebmlElms.forEach(function(element) {\r\n reader.read(element);\r\n });\r\n reader.stop();\r\n var refinedMetadataBuf = tools.makeMetadataSeekable(reader.metadatas, reader.duration, reader.cues);\r\n var body = this.result.slice(reader.metadataSize);\r\n var newBlob = new Blob([refinedMetadataBuf, body], {\r\n type: 'video/webm'\r\n });\r\n\r\n callback(newBlob);\r\n };\r\n fileReader.readAsArrayBuffer(inputBlob);\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.invokeSaveAsDialog = invokeSaveAsDialog;\r\n RecordRTC.getTracks = getTracks;\r\n RecordRTC.getSeekableBlob = getSeekableBlob;\r\n RecordRTC.bytesToSize = bytesToSize;\r\n RecordRTC.isElectron = isElectron;\r\n}\r\n\r\n// __________ (used to handle stuff like http://goo.gl/xmE5eg) issue #129\r\n// Storage.js\r\n\r\n/**\r\n * Storage is a standalone object used by {@link RecordRTC} to store reusable objects e.g. \"new AudioContext\".\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @example\r\n * Storage.AudioContext === webkitAudioContext\r\n * @property {webkitAudioContext} AudioContext - Keeps a reference to AudioContext object.\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n */\r\n\r\nvar Storage = {};\r\n\r\nif (typeof AudioContext !== 'undefined') {\r\n Storage.AudioContext = AudioContext;\r\n} else if (typeof webkitAudioContext !== 'undefined') {\r\n Storage.AudioContext = webkitAudioContext;\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.Storage = Storage;\r\n}\n\r\nfunction isMediaRecorderCompatible() {\r\n if (isFirefox || isSafari || isEdge) {\r\n return true;\r\n }\r\n\r\n var nVer = navigator.appVersion;\r\n var nAgt = navigator.userAgent;\r\n var fullVersion = '' + parseFloat(navigator.appVersion);\r\n var majorVersion = parseInt(navigator.appVersion, 10);\r\n var nameOffset, verOffset, ix;\r\n\r\n if (isChrome || isOpera) {\r\n verOffset = nAgt.indexOf('Chrome');\r\n fullVersion = nAgt.substring(verOffset + 7);\r\n }\r\n\r\n // trim the fullVersion string at semicolon/space if present\r\n if ((ix = fullVersion.indexOf(';')) !== -1) {\r\n fullVersion = fullVersion.substring(0, ix);\r\n }\r\n\r\n if ((ix = fullVersion.indexOf(' ')) !== -1) {\r\n fullVersion = fullVersion.substring(0, ix);\r\n }\r\n\r\n majorVersion = parseInt('' + fullVersion, 10);\r\n\r\n if (isNaN(majorVersion)) {\r\n fullVersion = '' + parseFloat(navigator.appVersion);\r\n majorVersion = parseInt(navigator.appVersion, 10);\r\n }\r\n\r\n return majorVersion >= 49;\r\n}\n\r\n// ______________________\r\n// MediaStreamRecorder.js\r\n\r\n/**\r\n * MediaStreamRecorder is an abstraction layer for {@link https://w3c.github.io/mediacapture-record/MediaRecorder.html|MediaRecorder API}. It is used by {@link RecordRTC} to record MediaStream(s) in both Chrome and Firefox.\r\n * @summary Runs top over {@link https://w3c.github.io/mediacapture-record/MediaRecorder.html|MediaRecorder API}.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://github.com/muaz-khan|Muaz Khan}\r\n * @typedef MediaStreamRecorder\r\n * @class\r\n * @example\r\n * var config = {\r\n * mimeType: 'video/webm', // vp8, vp9, h264, mkv, opus/vorbis\r\n * audioBitsPerSecond : 256 * 8 * 1024,\r\n * videoBitsPerSecond : 256 * 8 * 1024,\r\n * bitsPerSecond: 256 * 8 * 1024, // if this is provided, skip above two\r\n * checkForInactiveTracks: true,\r\n * timeSlice: 1000, // concatenate intervals based blobs\r\n * ondataavailable: function() {} // get intervals based blobs\r\n * }\r\n * var recorder = new MediaStreamRecorder(mediaStream, config);\r\n * recorder.record();\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n *\r\n * // or\r\n * var blob = recorder.blob;\r\n * });\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.\r\n * @param {object} config - {disableLogs:true, initCallback: function, mimeType: \"video/webm\", timeSlice: 1000}\r\n * @throws Will throw an error if first argument \"MediaStream\" is missing. Also throws error if \"MediaRecorder API\" are not supported by the browser.\r\n */\r\n\r\nfunction MediaStreamRecorder(mediaStream, config) {\r\n var self = this;\r\n\r\n if (typeof mediaStream === 'undefined') {\r\n throw 'First argument \"MediaStream\" is required.';\r\n }\r\n\r\n if (typeof MediaRecorder === 'undefined') {\r\n throw 'Your browser does not support the Media Recorder API. Please try other modules e.g. WhammyRecorder or StereoAudioRecorder.';\r\n }\r\n\r\n config = config || {\r\n // bitsPerSecond: 256 * 8 * 1024,\r\n mimeType: 'video/webm'\r\n };\r\n\r\n if (config.type === 'audio') {\r\n if (getTracks(mediaStream, 'video').length && getTracks(mediaStream, 'audio').length) {\r\n var stream;\r\n if (!!navigator.mozGetUserMedia) {\r\n stream = new MediaStream();\r\n stream.addTrack(getTracks(mediaStream, 'audio')[0]);\r\n } else {\r\n // webkitMediaStream\r\n stream = new MediaStream(getTracks(mediaStream, 'audio'));\r\n }\r\n mediaStream = stream;\r\n }\r\n\r\n if (!config.mimeType || config.mimeType.toString().toLowerCase().indexOf('audio') === -1) {\r\n config.mimeType = isChrome ? 'audio/webm' : 'audio/ogg';\r\n }\r\n\r\n if (config.mimeType && config.mimeType.toString().toLowerCase() !== 'audio/ogg' && !!navigator.mozGetUserMedia) {\r\n // forcing better codecs on Firefox (via #166)\r\n config.mimeType = 'audio/ogg';\r\n }\r\n }\r\n\r\n var arrayOfBlobs = [];\r\n\r\n /**\r\n * This method returns array of blobs. Use only with \"timeSlice\". Its useful to preview recording anytime, without using the \"stop\" method.\r\n * @method\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * var arrayOfBlobs = recorder.getArrayOfBlobs();\r\n * @returns {Array} Returns array of recorded blobs.\r\n */\r\n this.getArrayOfBlobs = function() {\r\n return arrayOfBlobs;\r\n };\r\n\r\n /**\r\n * This method records MediaStream.\r\n * @method\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * recorder.record();\r\n */\r\n this.record = function() {\r\n // set defaults\r\n self.blob = null;\r\n self.clearRecordedData();\r\n self.timestamps = [];\r\n allStates = [];\r\n arrayOfBlobs = [];\r\n\r\n var recorderHints = config;\r\n\r\n if (!config.disableLogs) {\r\n console.log('Passing following config over MediaRecorder API.', recorderHints);\r\n }\r\n\r\n if (mediaRecorder) {\r\n // mandatory to make sure Firefox doesn't fails to record streams 3-4 times without reloading the page.\r\n mediaRecorder = null;\r\n }\r\n\r\n if (isChrome && !isMediaRecorderCompatible()) {\r\n // to support video-only recording on stable\r\n recorderHints = 'video/vp8';\r\n }\r\n\r\n if (typeof MediaRecorder.isTypeSupported === 'function' && recorderHints.mimeType) {\r\n if (!MediaRecorder.isTypeSupported(recorderHints.mimeType)) {\r\n if (!config.disableLogs) {\r\n console.warn('MediaRecorder API seems unable to record mimeType:', recorderHints.mimeType);\r\n }\r\n\r\n recorderHints.mimeType = config.type === 'audio' ? 'audio/webm' : 'video/webm';\r\n }\r\n }\r\n\r\n // using MediaRecorder API here\r\n try {\r\n mediaRecorder = new MediaRecorder(mediaStream, recorderHints);\r\n\r\n // reset\r\n config.mimeType = recorderHints.mimeType;\r\n } catch (e) {\r\n // chrome-based fallback\r\n mediaRecorder = new MediaRecorder(mediaStream);\r\n }\r\n\r\n // old hack?\r\n if (recorderHints.mimeType && !MediaRecorder.isTypeSupported && 'canRecordMimeType' in mediaRecorder && mediaRecorder.canRecordMimeType(recorderHints.mimeType) === false) {\r\n if (!config.disableLogs) {\r\n console.warn('MediaRecorder API seems unable to record mimeType:', recorderHints.mimeType);\r\n }\r\n }\r\n\r\n // Dispatching OnDataAvailable Handler\r\n mediaRecorder.ondataavailable = function(e) {\r\n if (e.data) {\r\n allStates.push('ondataavailable: ' + bytesToSize(e.data.size));\r\n }\r\n\r\n if (typeof config.timeSlice === 'number') {\r\n if (e.data && e.data.size) {\r\n arrayOfBlobs.push(e.data);\r\n updateTimeStamp();\r\n\r\n if (typeof config.ondataavailable === 'function') {\r\n // intervals based blobs\r\n var blob = config.getNativeBlob ? e.data : new Blob([e.data], {\r\n type: getMimeType(recorderHints)\r\n });\r\n config.ondataavailable(blob);\r\n }\r\n }\r\n return;\r\n }\r\n\r\n if (!e.data || !e.data.size || e.data.size < 100 || self.blob) {\r\n // make sure that stopRecording always getting fired\r\n // even if there is invalid data\r\n if (self.recordingCallback) {\r\n self.recordingCallback(new Blob([], {\r\n type: getMimeType(recorderHints)\r\n }));\r\n self.recordingCallback = null;\r\n }\r\n return;\r\n }\r\n\r\n self.blob = config.getNativeBlob ? e.data : new Blob([e.data], {\r\n type: getMimeType(recorderHints)\r\n });\r\n\r\n if (self.recordingCallback) {\r\n self.recordingCallback(self.blob);\r\n self.recordingCallback = null;\r\n }\r\n };\r\n\r\n mediaRecorder.onstart = function() {\r\n allStates.push('started');\r\n };\r\n\r\n mediaRecorder.onpause = function() {\r\n allStates.push('paused');\r\n };\r\n\r\n mediaRecorder.onresume = function() {\r\n allStates.push('resumed');\r\n };\r\n\r\n mediaRecorder.onstop = function() {\r\n allStates.push('stopped');\r\n };\r\n\r\n mediaRecorder.onerror = function(error) {\r\n if (!error) {\r\n return;\r\n }\r\n\r\n if (!error.name) {\r\n error.name = 'UnknownError';\r\n }\r\n\r\n allStates.push('error: ' + error);\r\n\r\n if (!config.disableLogs) {\r\n // via: https://w3c.github.io/mediacapture-record/MediaRecorder.html#exception-summary\r\n if (error.name.toString().toLowerCase().indexOf('invalidstate') !== -1) {\r\n console.error('The MediaRecorder is not in a state in which the proposed operation is allowed to be executed.', error);\r\n } else if (error.name.toString().toLowerCase().indexOf('notsupported') !== -1) {\r\n console.error('MIME type (', recorderHints.mimeType, ') is not supported.', error);\r\n } else if (error.name.toString().toLowerCase().indexOf('security') !== -1) {\r\n console.error('MediaRecorder security error', error);\r\n }\r\n\r\n // older code below\r\n else if (error.name === 'OutOfMemory') {\r\n console.error('The UA has exhaused the available memory. User agents SHOULD provide as much additional information as possible in the message attribute.', error);\r\n } else if (error.name === 'IllegalStreamModification') {\r\n console.error('A modification to the stream has occurred that makes it impossible to continue recording. An example would be the addition of a Track while recording is occurring. User agents SHOULD provide as much additional information as possible in the message attribute.', error);\r\n } else if (error.name === 'OtherRecordingError') {\r\n console.error('Used for an fatal error other than those listed above. User agents SHOULD provide as much additional information as possible in the message attribute.', error);\r\n } else if (error.name === 'GenericError') {\r\n console.error('The UA cannot provide the codec or recording option that has been requested.', error);\r\n } else {\r\n console.error('MediaRecorder Error', error);\r\n }\r\n }\r\n\r\n (function(looper) {\r\n if (!self.manuallyStopped && mediaRecorder && mediaRecorder.state === 'inactive') {\r\n delete config.timeslice;\r\n\r\n // 10 minutes, enough?\r\n mediaRecorder.start(10 * 60 * 1000);\r\n return;\r\n }\r\n\r\n setTimeout(looper, 1000);\r\n })();\r\n\r\n if (mediaRecorder.state !== 'inactive' && mediaRecorder.state !== 'stopped') {\r\n mediaRecorder.stop();\r\n }\r\n };\r\n\r\n if (typeof config.timeSlice === 'number') {\r\n updateTimeStamp();\r\n mediaRecorder.start(config.timeSlice);\r\n } else {\r\n // default is 60 minutes; enough?\r\n // use config => {timeSlice: 1000} otherwise\r\n\r\n mediaRecorder.start(3.6e+6);\r\n }\r\n\r\n if (config.initCallback) {\r\n config.initCallback(); // old code\r\n }\r\n };\r\n\r\n /**\r\n * @property {Array} timestamps - Array of time stamps\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * console.log(recorder.timestamps);\r\n */\r\n this.timestamps = [];\r\n\r\n function updateTimeStamp() {\r\n self.timestamps.push(new Date().getTime());\r\n\r\n if (typeof config.onTimeStamp === 'function') {\r\n config.onTimeStamp(self.timestamps[self.timestamps.length - 1], self.timestamps);\r\n }\r\n }\r\n\r\n function getMimeType(secondObject) {\r\n if (mediaRecorder && mediaRecorder.mimeType) {\r\n return mediaRecorder.mimeType;\r\n }\r\n\r\n return secondObject.mimeType || 'video/webm';\r\n }\r\n\r\n /**\r\n * This method stops recording MediaStream.\r\n * @param {function} callback - Callback function, that is used to pass recorded blob back to the callee.\r\n * @method\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n */\r\n this.stop = function(callback) {\r\n callback = callback || function() {};\r\n\r\n self.manuallyStopped = true; // used inside the mediaRecorder.onerror\r\n\r\n if (!mediaRecorder) {\r\n return;\r\n }\r\n\r\n this.recordingCallback = callback;\r\n\r\n if (mediaRecorder.state === 'recording') {\r\n mediaRecorder.stop();\r\n }\r\n\r\n if (typeof config.timeSlice === 'number') {\r\n setTimeout(function() {\r\n self.blob = new Blob(arrayOfBlobs, {\r\n type: getMimeType(config)\r\n });\r\n\r\n self.recordingCallback(self.blob);\r\n }, 100);\r\n }\r\n };\r\n\r\n /**\r\n * This method pauses the recording process.\r\n * @method\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * recorder.pause();\r\n */\r\n this.pause = function() {\r\n if (!mediaRecorder) {\r\n return;\r\n }\r\n\r\n if (mediaRecorder.state === 'recording') {\r\n mediaRecorder.pause();\r\n }\r\n };\r\n\r\n /**\r\n * This method resumes the recording process.\r\n * @method\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * recorder.resume();\r\n */\r\n this.resume = function() {\r\n if (!mediaRecorder) {\r\n return;\r\n }\r\n\r\n if (mediaRecorder.state === 'paused') {\r\n mediaRecorder.resume();\r\n }\r\n };\r\n\r\n /**\r\n * This method resets currently recorded data.\r\n * @method\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * recorder.clearRecordedData();\r\n */\r\n this.clearRecordedData = function() {\r\n if (mediaRecorder && mediaRecorder.state === 'recording') {\r\n self.stop(clearRecordedDataCB);\r\n }\r\n\r\n clearRecordedDataCB();\r\n };\r\n\r\n function clearRecordedDataCB() {\r\n arrayOfBlobs = [];\r\n mediaRecorder = null;\r\n self.timestamps = [];\r\n }\r\n\r\n // Reference to \"MediaRecorder\" object\r\n var mediaRecorder;\r\n\r\n /**\r\n * Access to native MediaRecorder API\r\n * @method\r\n * @memberof MediaStreamRecorder\r\n * @instance\r\n * @example\r\n * var internal = recorder.getInternalRecorder();\r\n * internal.ondataavailable = function() {}; // override\r\n * internal.stream, internal.onpause, internal.onstop, etc.\r\n * @returns {Object} Returns internal recording object.\r\n */\r\n this.getInternalRecorder = function() {\r\n return mediaRecorder;\r\n };\r\n\r\n function isMediaStreamActive() {\r\n if ('active' in mediaStream) {\r\n if (!mediaStream.active) {\r\n return false;\r\n }\r\n } else if ('ended' in mediaStream) { // old hack\r\n if (mediaStream.ended) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * @property {Blob} blob - Recorded data as \"Blob\" object.\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * recorder.stop(function() {\r\n * var blob = recorder.blob;\r\n * });\r\n */\r\n this.blob = null;\r\n\r\n\r\n /**\r\n * Get MediaRecorder readonly state.\r\n * @method\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * var state = recorder.getState();\r\n * @returns {String} Returns recording state.\r\n */\r\n this.getState = function() {\r\n if (!mediaRecorder) {\r\n return 'inactive';\r\n }\r\n\r\n return mediaRecorder.state || 'inactive';\r\n };\r\n\r\n // list of all recording states\r\n var allStates = [];\r\n\r\n /**\r\n * Get MediaRecorder all recording states.\r\n * @method\r\n * @memberof MediaStreamRecorder\r\n * @example\r\n * var state = recorder.getAllStates();\r\n * @returns {Array} Returns all recording states\r\n */\r\n this.getAllStates = function() {\r\n return allStates;\r\n };\r\n\r\n // if any Track within the MediaStream is muted or not enabled at any time, \r\n // the browser will only record black frames \r\n // or silence since that is the content produced by the Track\r\n // so we need to stopRecording as soon as any single track ends.\r\n if (typeof config.checkForInactiveTracks === 'undefined') {\r\n config.checkForInactiveTracks = false; // disable to minimize CPU usage\r\n }\r\n\r\n var self = this;\r\n\r\n // this method checks if media stream is stopped\r\n // or if any track is ended.\r\n (function looper() {\r\n if (!mediaRecorder || config.checkForInactiveTracks === false) {\r\n return;\r\n }\r\n\r\n if (isMediaStreamActive() === false) {\r\n if (!config.disableLogs) {\r\n console.log('MediaStream seems stopped.');\r\n }\r\n self.stop();\r\n return;\r\n }\r\n\r\n setTimeout(looper, 1000); // check every second\r\n })();\r\n\r\n // for debugging\r\n this.name = 'MediaStreamRecorder';\r\n this.toString = function() {\r\n return this.name;\r\n };\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.MediaStreamRecorder = MediaStreamRecorder;\r\n}\r\n\r\n// source code from: http://typedarray.org/wp-content/projects/WebAudioRecorder/script.js\r\n// https://github.com/mattdiamond/Recorderjs#license-mit\r\n// ______________________\r\n// StereoAudioRecorder.js\r\n\r\n/**\r\n * StereoAudioRecorder is a standalone class used by {@link RecordRTC} to bring \"stereo\" audio-recording in chrome.\r\n * @summary JavaScript standalone object for stereo audio recording.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef StereoAudioRecorder\r\n * @class\r\n * @example\r\n * var recorder = new StereoAudioRecorder(MediaStream, {\r\n * sampleRate: 44100,\r\n * bufferSize: 4096\r\n * });\r\n * recorder.record();\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.\r\n * @param {object} config - {sampleRate: 44100, bufferSize: 4096, numberOfAudioChannels: 1, etc.}\r\n */\r\n\r\nfunction StereoAudioRecorder(mediaStream, config) {\r\n if (!getTracks(mediaStream, 'audio').length) {\r\n throw 'Your stream has no audio tracks.';\r\n }\r\n\r\n config = config || {};\r\n\r\n var self = this;\r\n\r\n // variables\r\n var leftchannel = [];\r\n var rightchannel = [];\r\n var recording = false;\r\n var recordingLength = 0;\r\n var jsAudioNode;\r\n\r\n var numberOfAudioChannels = 2;\r\n\r\n /**\r\n * Set sample rates such as 8K or 16K. Reference: http://stackoverflow.com/a/28977136/552182\r\n * @property {number} desiredSampRate - Desired Bits per sample * 1000\r\n * @memberof StereoAudioRecorder\r\n * @instance\r\n * @example\r\n * var recorder = StereoAudioRecorder(mediaStream, {\r\n * desiredSampRate: 16 * 1000 // bits-per-sample * 1000\r\n * });\r\n */\r\n var desiredSampRate = config.desiredSampRate;\r\n\r\n // backward compatibility\r\n if (config.leftChannel === true) {\r\n numberOfAudioChannels = 1;\r\n }\r\n\r\n if (config.numberOfAudioChannels === 1) {\r\n numberOfAudioChannels = 1;\r\n }\r\n\r\n if (!numberOfAudioChannels || numberOfAudioChannels < 1) {\r\n numberOfAudioChannels = 2;\r\n }\r\n\r\n if (!config.disableLogs) {\r\n console.log('StereoAudioRecorder is set to record number of channels: ' + numberOfAudioChannels);\r\n }\r\n\r\n // if any Track within the MediaStream is muted or not enabled at any time, \r\n // the browser will only record black frames \r\n // or silence since that is the content produced by the Track\r\n // so we need to stopRecording as soon as any single track ends.\r\n if (typeof config.checkForInactiveTracks === 'undefined') {\r\n config.checkForInactiveTracks = true;\r\n }\r\n\r\n function isMediaStreamActive() {\r\n if (config.checkForInactiveTracks === false) {\r\n // always return \"true\"\r\n return true;\r\n }\r\n\r\n if ('active' in mediaStream) {\r\n if (!mediaStream.active) {\r\n return false;\r\n }\r\n } else if ('ended' in mediaStream) { // old hack\r\n if (mediaStream.ended) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * This method records MediaStream.\r\n * @method\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder.record();\r\n */\r\n this.record = function() {\r\n if (isMediaStreamActive() === false) {\r\n throw 'Please make sure MediaStream is active.';\r\n }\r\n\r\n resetVariables();\r\n\r\n isAudioProcessStarted = isPaused = false;\r\n recording = true;\r\n\r\n if (typeof config.timeSlice !== 'undefined') {\r\n looper();\r\n }\r\n };\r\n\r\n function mergeLeftRightBuffers(config, callback) {\r\n function mergeAudioBuffers(config, cb) {\r\n var numberOfAudioChannels = config.numberOfAudioChannels;\r\n\r\n // todo: \"slice(0)\" --- is it causes loop? Should be removed?\r\n var leftBuffers = config.leftBuffers.slice(0);\r\n var rightBuffers = config.rightBuffers.slice(0);\r\n var sampleRate = config.sampleRate;\r\n var internalInterleavedLength = config.internalInterleavedLength;\r\n var desiredSampRate = config.desiredSampRate;\r\n\r\n if (numberOfAudioChannels === 2) {\r\n leftBuffers = mergeBuffers(leftBuffers, internalInterleavedLength);\r\n rightBuffers = mergeBuffers(rightBuffers, internalInterleavedLength);\r\n\r\n if (desiredSampRate) {\r\n leftBuffers = interpolateArray(leftBuffers, desiredSampRate, sampleRate);\r\n rightBuffers = interpolateArray(rightBuffers, desiredSampRate, sampleRate);\r\n }\r\n }\r\n\r\n if (numberOfAudioChannels === 1) {\r\n leftBuffers = mergeBuffers(leftBuffers, internalInterleavedLength);\r\n\r\n if (desiredSampRate) {\r\n leftBuffers = interpolateArray(leftBuffers, desiredSampRate, sampleRate);\r\n }\r\n }\r\n\r\n // set sample rate as desired sample rate\r\n if (desiredSampRate) {\r\n sampleRate = desiredSampRate;\r\n }\r\n\r\n // for changing the sampling rate, reference:\r\n // http://stackoverflow.com/a/28977136/552182\r\n function interpolateArray(data, newSampleRate, oldSampleRate) {\r\n var fitCount = Math.round(data.length * (newSampleRate / oldSampleRate));\r\n var newData = [];\r\n var springFactor = Number((data.length - 1) / (fitCount - 1));\r\n newData[0] = data[0];\r\n for (var i = 1; i < fitCount - 1; i++) {\r\n var tmp = i * springFactor;\r\n var before = Number(Math.floor(tmp)).toFixed();\r\n var after = Number(Math.ceil(tmp)).toFixed();\r\n var atPoint = tmp - before;\r\n newData[i] = linearInterpolate(data[before], data[after], atPoint);\r\n }\r\n newData[fitCount - 1] = data[data.length - 1];\r\n return newData;\r\n }\r\n\r\n function linearInterpolate(before, after, atPoint) {\r\n return before + (after - before) * atPoint;\r\n }\r\n\r\n function mergeBuffers(channelBuffer, rLength) {\r\n var result = new Float64Array(rLength);\r\n var offset = 0;\r\n var lng = channelBuffer.length;\r\n\r\n for (var i = 0; i < lng; i++) {\r\n var buffer = channelBuffer[i];\r\n result.set(buffer, offset);\r\n offset += buffer.length;\r\n }\r\n\r\n return result;\r\n }\r\n\r\n function interleave(leftChannel, rightChannel) {\r\n var length = leftChannel.length + rightChannel.length;\r\n\r\n var result = new Float64Array(length);\r\n\r\n var inputIndex = 0;\r\n\r\n for (var index = 0; index < length;) {\r\n result[index++] = leftChannel[inputIndex];\r\n result[index++] = rightChannel[inputIndex];\r\n inputIndex++;\r\n }\r\n return result;\r\n }\r\n\r\n function writeUTFBytes(view, offset, string) {\r\n var lng = string.length;\r\n for (var i = 0; i < lng; i++) {\r\n view.setUint8(offset + i, string.charCodeAt(i));\r\n }\r\n }\r\n\r\n // interleave both channels together\r\n var interleaved;\r\n\r\n if (numberOfAudioChannels === 2) {\r\n interleaved = interleave(leftBuffers, rightBuffers);\r\n }\r\n\r\n if (numberOfAudioChannels === 1) {\r\n interleaved = leftBuffers;\r\n }\r\n\r\n var interleavedLength = interleaved.length;\r\n\r\n // create wav file\r\n var resultingBufferLength = 44 + interleavedLength * 2;\r\n\r\n var buffer = new ArrayBuffer(resultingBufferLength);\r\n\r\n var view = new DataView(buffer);\r\n\r\n // RIFF chunk descriptor/identifier \r\n writeUTFBytes(view, 0, 'RIFF');\r\n\r\n // RIFF chunk length\r\n // changed \"44\" to \"36\" via #401\r\n view.setUint32(4, 36 + interleavedLength * 2, true);\r\n\r\n // RIFF type \r\n writeUTFBytes(view, 8, 'WAVE');\r\n\r\n // format chunk identifier \r\n // FMT sub-chunk\r\n writeUTFBytes(view, 12, 'fmt ');\r\n\r\n // format chunk length \r\n view.setUint32(16, 16, true);\r\n\r\n // sample format (raw)\r\n view.setUint16(20, 1, true);\r\n\r\n // stereo (2 channels)\r\n view.setUint16(22, numberOfAudioChannels, true);\r\n\r\n // sample rate \r\n view.setUint32(24, sampleRate, true);\r\n\r\n // byte rate (sample rate * block align)\r\n view.setUint32(28, sampleRate * numberOfAudioChannels * 2, true);\r\n\r\n // block align (channel count * bytes per sample) \r\n view.setUint16(32, numberOfAudioChannels * 2, true);\r\n\r\n // bits per sample \r\n view.setUint16(34, 16, true);\r\n\r\n // data sub-chunk\r\n // data chunk identifier \r\n writeUTFBytes(view, 36, 'data');\r\n\r\n // data chunk length \r\n view.setUint32(40, interleavedLength * 2, true);\r\n\r\n // write the PCM samples\r\n var lng = interleavedLength;\r\n var index = 44;\r\n var volume = 1;\r\n for (var i = 0; i < lng; i++) {\r\n view.setInt16(index, interleaved[i] * (0x7FFF * volume), true);\r\n index += 2;\r\n }\r\n\r\n if (cb) {\r\n return cb({\r\n buffer: buffer,\r\n view: view\r\n });\r\n }\r\n\r\n postMessage({\r\n buffer: buffer,\r\n view: view\r\n });\r\n }\r\n\r\n if (config.noWorker) {\r\n mergeAudioBuffers(config, function(data) {\r\n callback(data.buffer, data.view);\r\n });\r\n return;\r\n }\r\n\r\n\r\n var webWorker = processInWebWorker(mergeAudioBuffers);\r\n\r\n webWorker.onmessage = function(event) {\r\n callback(event.data.buffer, event.data.view);\r\n\r\n // release memory\r\n URL.revokeObjectURL(webWorker.workerURL);\r\n\r\n // kill webworker (or Chrome will kill your page after ~25 calls)\r\n webWorker.terminate();\r\n };\r\n\r\n webWorker.postMessage(config);\r\n }\r\n\r\n function processInWebWorker(_function) {\r\n var workerURL = URL.createObjectURL(new Blob([_function.toString(),\r\n ';this.onmessage = function (eee) {' + _function.name + '(eee.data);}'\r\n ], {\r\n type: 'application/javascript'\r\n }));\r\n\r\n var worker = new Worker(workerURL);\r\n worker.workerURL = workerURL;\r\n return worker;\r\n }\r\n\r\n /**\r\n * This method stops recording MediaStream.\r\n * @param {function} callback - Callback function, that is used to pass recorded blob back to the callee.\r\n * @method\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n */\r\n this.stop = function(callback) {\r\n callback = callback || function() {};\r\n\r\n // stop recording\r\n recording = false;\r\n\r\n mergeLeftRightBuffers({\r\n desiredSampRate: desiredSampRate,\r\n sampleRate: sampleRate,\r\n numberOfAudioChannels: numberOfAudioChannels,\r\n internalInterleavedLength: recordingLength,\r\n leftBuffers: leftchannel,\r\n rightBuffers: numberOfAudioChannels === 1 ? [] : rightchannel,\r\n noWorker: config.noWorker\r\n }, function(buffer, view) {\r\n /**\r\n * @property {Blob} blob - The recorded blob object.\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder.stop(function(){\r\n * var blob = recorder.blob;\r\n * });\r\n */\r\n self.blob = new Blob([view], {\r\n type: 'audio/wav'\r\n });\r\n\r\n /**\r\n * @property {ArrayBuffer} buffer - The recorded buffer object.\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder.stop(function(){\r\n * var buffer = recorder.buffer;\r\n * });\r\n */\r\n self.buffer = new ArrayBuffer(view.buffer.byteLength);\r\n\r\n /**\r\n * @property {DataView} view - The recorded data-view object.\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder.stop(function(){\r\n * var view = recorder.view;\r\n * });\r\n */\r\n self.view = view;\r\n\r\n self.sampleRate = desiredSampRate || sampleRate;\r\n self.bufferSize = bufferSize;\r\n\r\n // recorded audio length\r\n self.length = recordingLength;\r\n\r\n isAudioProcessStarted = false;\r\n\r\n if (callback) {\r\n callback(self.blob);\r\n }\r\n });\r\n };\r\n\r\n if (typeof RecordRTC.Storage === 'undefined') {\r\n RecordRTC.Storage = {\r\n AudioContextConstructor: null,\r\n AudioContext: window.AudioContext || window.webkitAudioContext\r\n };\r\n }\r\n\r\n if (!RecordRTC.Storage.AudioContextConstructor || RecordRTC.Storage.AudioContextConstructor.state === 'closed') {\r\n RecordRTC.Storage.AudioContextConstructor = new RecordRTC.Storage.AudioContext();\r\n }\r\n\r\n var context = RecordRTC.Storage.AudioContextConstructor;\r\n\r\n // creates an audio node from the microphone incoming stream\r\n var audioInput = context.createMediaStreamSource(mediaStream);\r\n\r\n var legalBufferValues = [0, 256, 512, 1024, 2048, 4096, 8192, 16384];\r\n\r\n /**\r\n * From the spec: This value controls how frequently the audioprocess event is\r\n * dispatched and how many sample-frames need to be processed each call.\r\n * Lower values for buffer size will result in a lower (better) latency.\r\n * Higher values will be necessary to avoid audio breakup and glitches\r\n * The size of the buffer (in sample-frames) which needs to\r\n * be processed each time onprocessaudio is called.\r\n * Legal values are (256, 512, 1024, 2048, 4096, 8192, 16384).\r\n * @property {number} bufferSize - Buffer-size for how frequently the audioprocess event is dispatched.\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder = new StereoAudioRecorder(mediaStream, {\r\n * bufferSize: 4096\r\n * });\r\n */\r\n\r\n // \"0\" means, let chrome decide the most accurate buffer-size for current platform.\r\n var bufferSize = typeof config.bufferSize === 'undefined' ? 4096 : config.bufferSize;\r\n\r\n if (legalBufferValues.indexOf(bufferSize) === -1) {\r\n if (!config.disableLogs) {\r\n console.log('Legal values for buffer-size are ' + JSON.stringify(legalBufferValues, null, '\\t'));\r\n }\r\n }\r\n\r\n if (context.createJavaScriptNode) {\r\n jsAudioNode = context.createJavaScriptNode(bufferSize, numberOfAudioChannels, numberOfAudioChannels);\r\n } else if (context.createScriptProcessor) {\r\n jsAudioNode = context.createScriptProcessor(bufferSize, numberOfAudioChannels, numberOfAudioChannels);\r\n } else {\r\n throw 'WebAudio API has no support on this browser.';\r\n }\r\n\r\n // connect the stream to the script processor\r\n audioInput.connect(jsAudioNode);\r\n\r\n if (!config.bufferSize) {\r\n bufferSize = jsAudioNode.bufferSize; // device buffer-size\r\n }\r\n\r\n /**\r\n * The sample rate (in sample-frames per second) at which the\r\n * AudioContext handles audio. It is assumed that all AudioNodes\r\n * in the context run at this rate. In making this assumption,\r\n * sample-rate converters or \"varispeed\" processors are not supported\r\n * in real-time processing.\r\n * The sampleRate parameter describes the sample-rate of the\r\n * linear PCM audio data in the buffer in sample-frames per second.\r\n * An implementation must support sample-rates in at least\r\n * the range 22050 to 96000.\r\n * @property {number} sampleRate - Buffer-size for how frequently the audioprocess event is dispatched.\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder = new StereoAudioRecorder(mediaStream, {\r\n * sampleRate: 44100\r\n * });\r\n */\r\n var sampleRate = typeof config.sampleRate !== 'undefined' ? config.sampleRate : context.sampleRate || 44100;\r\n\r\n if (sampleRate < 22050 || sampleRate > 96000) {\r\n // Ref: http://stackoverflow.com/a/26303918/552182\r\n if (!config.disableLogs) {\r\n console.log('sample-rate must be under range 22050 and 96000.');\r\n }\r\n }\r\n\r\n if (!config.disableLogs) {\r\n if (config.desiredSampRate) {\r\n console.log('Desired sample-rate: ' + config.desiredSampRate);\r\n }\r\n }\r\n\r\n var isPaused = false;\r\n /**\r\n * This method pauses the recording process.\r\n * @method\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder.pause();\r\n */\r\n this.pause = function() {\r\n isPaused = true;\r\n };\r\n\r\n /**\r\n * This method resumes the recording process.\r\n * @method\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder.resume();\r\n */\r\n this.resume = function() {\r\n if (isMediaStreamActive() === false) {\r\n throw 'Please make sure MediaStream is active.';\r\n }\r\n\r\n if (!recording) {\r\n if (!config.disableLogs) {\r\n console.log('Seems recording has been restarted.');\r\n }\r\n this.record();\r\n return;\r\n }\r\n\r\n isPaused = false;\r\n };\r\n\r\n /**\r\n * This method resets currently recorded data.\r\n * @method\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder.clearRecordedData();\r\n */\r\n this.clearRecordedData = function() {\r\n config.checkForInactiveTracks = false;\r\n\r\n if (recording) {\r\n this.stop(clearRecordedDataCB);\r\n }\r\n\r\n clearRecordedDataCB();\r\n };\r\n\r\n function resetVariables() {\r\n leftchannel = [];\r\n rightchannel = [];\r\n recordingLength = 0;\r\n isAudioProcessStarted = false;\r\n recording = false;\r\n isPaused = false;\r\n context = null;\r\n\r\n self.leftchannel = leftchannel;\r\n self.rightchannel = rightchannel;\r\n self.numberOfAudioChannels = numberOfAudioChannels;\r\n self.desiredSampRate = desiredSampRate;\r\n self.sampleRate = sampleRate;\r\n self.recordingLength = recordingLength;\r\n\r\n intervalsBasedBuffers = {\r\n left: [],\r\n right: [],\r\n recordingLength: 0\r\n };\r\n }\r\n\r\n function clearRecordedDataCB() {\r\n if (jsAudioNode) {\r\n jsAudioNode.onaudioprocess = null;\r\n jsAudioNode.disconnect();\r\n jsAudioNode = null;\r\n }\r\n\r\n if (audioInput) {\r\n audioInput.disconnect();\r\n audioInput = null;\r\n }\r\n\r\n resetVariables();\r\n }\r\n\r\n // for debugging\r\n this.name = 'StereoAudioRecorder';\r\n this.toString = function() {\r\n return this.name;\r\n };\r\n\r\n var isAudioProcessStarted = false;\r\n\r\n function onAudioProcessDataAvailable(e) {\r\n if (isPaused) {\r\n return;\r\n }\r\n\r\n if (isMediaStreamActive() === false) {\r\n if (!config.disableLogs) {\r\n console.log('MediaStream seems stopped.');\r\n }\r\n jsAudioNode.disconnect();\r\n recording = false;\r\n }\r\n\r\n if (!recording) {\r\n if (audioInput) {\r\n audioInput.disconnect();\r\n audioInput = null;\r\n }\r\n return;\r\n }\r\n\r\n /**\r\n * This method is called on \"onaudioprocess\" event's first invocation.\r\n * @method {function} onAudioProcessStarted\r\n * @memberof StereoAudioRecorder\r\n * @example\r\n * recorder.onAudioProcessStarted: function() { };\r\n */\r\n if (!isAudioProcessStarted) {\r\n isAudioProcessStarted = true;\r\n if (config.onAudioProcessStarted) {\r\n config.onAudioProcessStarted();\r\n }\r\n\r\n if (config.initCallback) {\r\n config.initCallback();\r\n }\r\n }\r\n\r\n var left = e.inputBuffer.getChannelData(0);\r\n\r\n // we clone the samples\r\n var chLeft = new Float32Array(left);\r\n leftchannel.push(chLeft);\r\n\r\n if (numberOfAudioChannels === 2) {\r\n var right = e.inputBuffer.getChannelData(1);\r\n var chRight = new Float32Array(right);\r\n rightchannel.push(chRight);\r\n }\r\n\r\n recordingLength += bufferSize;\r\n\r\n // export raw PCM\r\n self.recordingLength = recordingLength;\r\n\r\n if (typeof config.timeSlice !== 'undefined') {\r\n intervalsBasedBuffers.recordingLength += bufferSize;\r\n intervalsBasedBuffers.left.push(chLeft);\r\n\r\n if (numberOfAudioChannels === 2) {\r\n intervalsBasedBuffers.right.push(chRight);\r\n }\r\n }\r\n }\r\n\r\n jsAudioNode.onaudioprocess = onAudioProcessDataAvailable;\r\n\r\n // to prevent self audio to be connected with speakers\r\n if (context.createMediaStreamDestination) {\r\n jsAudioNode.connect(context.createMediaStreamDestination());\r\n } else {\r\n jsAudioNode.connect(context.destination);\r\n }\r\n\r\n // export raw PCM\r\n this.leftchannel = leftchannel;\r\n this.rightchannel = rightchannel;\r\n this.numberOfAudioChannels = numberOfAudioChannels;\r\n this.desiredSampRate = desiredSampRate;\r\n this.sampleRate = sampleRate;\r\n self.recordingLength = recordingLength;\r\n\r\n // helper for intervals based blobs\r\n var intervalsBasedBuffers = {\r\n left: [],\r\n right: [],\r\n recordingLength: 0\r\n };\r\n\r\n // this looper is used to support intervals based blobs (via timeSlice+ondataavailable)\r\n function looper() {\r\n if (!recording || typeof config.ondataavailable !== 'function' || typeof config.timeSlice === 'undefined') {\r\n return;\r\n }\r\n\r\n if (intervalsBasedBuffers.left.length) {\r\n mergeLeftRightBuffers({\r\n desiredSampRate: desiredSampRate,\r\n sampleRate: sampleRate,\r\n numberOfAudioChannels: numberOfAudioChannels,\r\n internalInterleavedLength: intervalsBasedBuffers.recordingLength,\r\n leftBuffers: intervalsBasedBuffers.left,\r\n rightBuffers: numberOfAudioChannels === 1 ? [] : intervalsBasedBuffers.right\r\n }, function(buffer, view) {\r\n var blob = new Blob([view], {\r\n type: 'audio/wav'\r\n });\r\n config.ondataavailable(blob);\r\n\r\n setTimeout(looper, config.timeSlice);\r\n });\r\n\r\n intervalsBasedBuffers = {\r\n left: [],\r\n right: [],\r\n recordingLength: 0\r\n };\r\n } else {\r\n setTimeout(looper, config.timeSlice);\r\n }\r\n }\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.StereoAudioRecorder = StereoAudioRecorder;\r\n}\r\n\r\n// _________________\r\n// CanvasRecorder.js\r\n\r\n/**\r\n * CanvasRecorder is a standalone class used by {@link RecordRTC} to bring HTML5-Canvas recording into video WebM. It uses HTML2Canvas library and runs top over {@link Whammy}.\r\n * @summary HTML2Canvas recording into video WebM.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef CanvasRecorder\r\n * @class\r\n * @example\r\n * var recorder = new CanvasRecorder(htmlElement, { disableLogs: true, useWhammyRecorder: true });\r\n * recorder.record();\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {HTMLElement} htmlElement - querySelector/getElementById/getElementsByTagName[0]/etc.\r\n * @param {object} config - {disableLogs:true, initCallback: function}\r\n */\r\n\r\nfunction CanvasRecorder(htmlElement, config) {\r\n if (typeof html2canvas === 'undefined') {\r\n throw 'Please link: https://www.webrtc-experiment.com/screenshot.js';\r\n }\r\n\r\n config = config || {};\r\n if (!config.frameInterval) {\r\n config.frameInterval = 10;\r\n }\r\n\r\n // via DetectRTC.js\r\n var isCanvasSupportsStreamCapturing = false;\r\n ['captureStream', 'mozCaptureStream', 'webkitCaptureStream'].forEach(function(item) {\r\n if (item in document.createElement('canvas')) {\r\n isCanvasSupportsStreamCapturing = true;\r\n }\r\n });\r\n\r\n var _isChrome = (!!window.webkitRTCPeerConnection || !!window.webkitGetUserMedia) && !!window.chrome;\r\n\r\n var chromeVersion = 50;\r\n var matchArray = navigator.userAgent.match(/Chrom(e|ium)\\/([0-9]+)\\./);\r\n if (_isChrome && matchArray && matchArray[2]) {\r\n chromeVersion = parseInt(matchArray[2], 10);\r\n }\r\n\r\n if (_isChrome && chromeVersion < 52) {\r\n isCanvasSupportsStreamCapturing = false;\r\n }\r\n\r\n if (config.useWhammyRecorder) {\r\n isCanvasSupportsStreamCapturing = false;\r\n }\r\n\r\n var globalCanvas, mediaStreamRecorder;\r\n\r\n if (isCanvasSupportsStreamCapturing) {\r\n if (!config.disableLogs) {\r\n console.log('Your browser supports both MediRecorder API and canvas.captureStream!');\r\n }\r\n\r\n if (htmlElement instanceof HTMLCanvasElement) {\r\n globalCanvas = htmlElement;\r\n } else if (htmlElement instanceof CanvasRenderingContext2D) {\r\n globalCanvas = htmlElement.canvas;\r\n } else {\r\n throw 'Please pass either HTMLCanvasElement or CanvasRenderingContext2D.';\r\n }\r\n } else if (!!navigator.mozGetUserMedia) {\r\n if (!config.disableLogs) {\r\n console.error('Canvas recording is NOT supported in Firefox.');\r\n }\r\n }\r\n\r\n var isRecording;\r\n\r\n /**\r\n * This method records Canvas.\r\n * @method\r\n * @memberof CanvasRecorder\r\n * @example\r\n * recorder.record();\r\n */\r\n this.record = function() {\r\n isRecording = true;\r\n\r\n if (isCanvasSupportsStreamCapturing && !config.useWhammyRecorder) {\r\n // CanvasCaptureMediaStream\r\n var canvasMediaStream;\r\n if ('captureStream' in globalCanvas) {\r\n canvasMediaStream = globalCanvas.captureStream(25); // 25 FPS\r\n } else if ('mozCaptureStream' in globalCanvas) {\r\n canvasMediaStream = globalCanvas.mozCaptureStream(25);\r\n } else if ('webkitCaptureStream' in globalCanvas) {\r\n canvasMediaStream = globalCanvas.webkitCaptureStream(25);\r\n }\r\n\r\n try {\r\n var mdStream = new MediaStream();\r\n mdStream.addTrack(getTracks(canvasMediaStream, 'video')[0]);\r\n canvasMediaStream = mdStream;\r\n } catch (e) {}\r\n\r\n if (!canvasMediaStream) {\r\n throw 'captureStream API are NOT available.';\r\n }\r\n\r\n // Note: Jan 18, 2016 status is that, \r\n // Firefox MediaRecorder API can't record CanvasCaptureMediaStream object.\r\n mediaStreamRecorder = new MediaStreamRecorder(canvasMediaStream, {\r\n mimeType: config.mimeType || 'video/webm'\r\n });\r\n mediaStreamRecorder.record();\r\n } else {\r\n whammy.frames = [];\r\n lastTime = new Date().getTime();\r\n drawCanvasFrame();\r\n }\r\n\r\n if (config.initCallback) {\r\n config.initCallback();\r\n }\r\n };\r\n\r\n this.getWebPImages = function(callback) {\r\n if (htmlElement.nodeName.toLowerCase() !== 'canvas') {\r\n callback();\r\n return;\r\n }\r\n\r\n var framesLength = whammy.frames.length;\r\n whammy.frames.forEach(function(frame, idx) {\r\n var framesRemaining = framesLength - idx;\r\n if (!config.disableLogs) {\r\n console.log(framesRemaining + '/' + framesLength + ' frames remaining');\r\n }\r\n\r\n if (config.onEncodingCallback) {\r\n config.onEncodingCallback(framesRemaining, framesLength);\r\n }\r\n\r\n var webp = frame.image.toDataURL('image/webp', 1);\r\n whammy.frames[idx].image = webp;\r\n });\r\n\r\n if (!config.disableLogs) {\r\n console.log('Generating WebM');\r\n }\r\n\r\n callback();\r\n };\r\n\r\n /**\r\n * This method stops recording Canvas.\r\n * @param {function} callback - Callback function, that is used to pass recorded blob back to the callee.\r\n * @method\r\n * @memberof CanvasRecorder\r\n * @example\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n */\r\n this.stop = function(callback) {\r\n isRecording = false;\r\n\r\n var that = this;\r\n\r\n if (isCanvasSupportsStreamCapturing && mediaStreamRecorder) {\r\n mediaStreamRecorder.stop(callback);\r\n return;\r\n }\r\n\r\n this.getWebPImages(function() {\r\n /**\r\n * @property {Blob} blob - Recorded frames in video/webm blob.\r\n * @memberof CanvasRecorder\r\n * @example\r\n * recorder.stop(function() {\r\n * var blob = recorder.blob;\r\n * });\r\n */\r\n whammy.compile(function(blob) {\r\n if (!config.disableLogs) {\r\n console.log('Recording finished!');\r\n }\r\n\r\n that.blob = blob;\r\n\r\n if (that.blob.forEach) {\r\n that.blob = new Blob([], {\r\n type: 'video/webm'\r\n });\r\n }\r\n\r\n if (callback) {\r\n callback(that.blob);\r\n }\r\n\r\n whammy.frames = [];\r\n });\r\n });\r\n };\r\n\r\n var isPausedRecording = false;\r\n\r\n /**\r\n * This method pauses the recording process.\r\n * @method\r\n * @memberof CanvasRecorder\r\n * @example\r\n * recorder.pause();\r\n */\r\n this.pause = function() {\r\n isPausedRecording = true;\r\n\r\n if (mediaStreamRecorder instanceof MediaStreamRecorder) {\r\n mediaStreamRecorder.pause();\r\n return;\r\n }\r\n };\r\n\r\n /**\r\n * This method resumes the recording process.\r\n * @method\r\n * @memberof CanvasRecorder\r\n * @example\r\n * recorder.resume();\r\n */\r\n this.resume = function() {\r\n isPausedRecording = false;\r\n\r\n if (mediaStreamRecorder instanceof MediaStreamRecorder) {\r\n mediaStreamRecorder.resume();\r\n return;\r\n }\r\n\r\n if (!isRecording) {\r\n this.record();\r\n }\r\n };\r\n\r\n /**\r\n * This method resets currently recorded data.\r\n * @method\r\n * @memberof CanvasRecorder\r\n * @example\r\n * recorder.clearRecordedData();\r\n */\r\n this.clearRecordedData = function() {\r\n if (isRecording) {\r\n this.stop(clearRecordedDataCB);\r\n }\r\n clearRecordedDataCB();\r\n };\r\n\r\n function clearRecordedDataCB() {\r\n whammy.frames = [];\r\n isRecording = false;\r\n isPausedRecording = false;\r\n }\r\n\r\n // for debugging\r\n this.name = 'CanvasRecorder';\r\n this.toString = function() {\r\n return this.name;\r\n };\r\n\r\n function cloneCanvas() {\r\n //create a new canvas\r\n var newCanvas = document.createElement('canvas');\r\n var context = newCanvas.getContext('2d');\r\n\r\n //set dimensions\r\n newCanvas.width = htmlElement.width;\r\n newCanvas.height = htmlElement.height;\r\n\r\n //apply the old canvas to the new one\r\n context.drawImage(htmlElement, 0, 0);\r\n\r\n //return the new canvas\r\n return newCanvas;\r\n }\r\n\r\n function drawCanvasFrame() {\r\n if (isPausedRecording) {\r\n lastTime = new Date().getTime();\r\n return setTimeout(drawCanvasFrame, 500);\r\n }\r\n\r\n if (htmlElement.nodeName.toLowerCase() === 'canvas') {\r\n var duration = new Date().getTime() - lastTime;\r\n // via #206, by Jack i.e. @Seymourr\r\n lastTime = new Date().getTime();\r\n\r\n whammy.frames.push({\r\n image: cloneCanvas(),\r\n duration: duration\r\n });\r\n\r\n if (isRecording) {\r\n setTimeout(drawCanvasFrame, config.frameInterval);\r\n }\r\n return;\r\n }\r\n\r\n html2canvas(htmlElement, {\r\n grabMouse: typeof config.showMousePointer === 'undefined' || config.showMousePointer,\r\n onrendered: function(canvas) {\r\n var duration = new Date().getTime() - lastTime;\r\n if (!duration) {\r\n return setTimeout(drawCanvasFrame, config.frameInterval);\r\n }\r\n\r\n // via #206, by Jack i.e. @Seymourr\r\n lastTime = new Date().getTime();\r\n\r\n whammy.frames.push({\r\n image: canvas.toDataURL('image/webp', 1),\r\n duration: duration\r\n });\r\n\r\n if (isRecording) {\r\n setTimeout(drawCanvasFrame, config.frameInterval);\r\n }\r\n }\r\n });\r\n }\r\n\r\n var lastTime = new Date().getTime();\r\n\r\n var whammy = new Whammy.Video(100);\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.CanvasRecorder = CanvasRecorder;\r\n}\n\r\n// _________________\r\n// WhammyRecorder.js\r\n\r\n/**\r\n * WhammyRecorder is a standalone class used by {@link RecordRTC} to bring video recording in Chrome. It runs top over {@link Whammy}.\r\n * @summary Video recording feature in Chrome.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef WhammyRecorder\r\n * @class\r\n * @example\r\n * var recorder = new WhammyRecorder(mediaStream);\r\n * recorder.record();\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.\r\n * @param {object} config - {disableLogs: true, initCallback: function, video: HTMLVideoElement, etc.}\r\n */\r\n\r\nfunction WhammyRecorder(mediaStream, config) {\r\n\r\n config = config || {};\r\n\r\n if (!config.frameInterval) {\r\n config.frameInterval = 10;\r\n }\r\n\r\n if (!config.disableLogs) {\r\n console.log('Using frames-interval:', config.frameInterval);\r\n }\r\n\r\n /**\r\n * This method records video.\r\n * @method\r\n * @memberof WhammyRecorder\r\n * @example\r\n * recorder.record();\r\n */\r\n this.record = function() {\r\n if (!config.width) {\r\n config.width = 320;\r\n }\r\n\r\n if (!config.height) {\r\n config.height = 240;\r\n }\r\n\r\n if (!config.video) {\r\n config.video = {\r\n width: config.width,\r\n height: config.height\r\n };\r\n }\r\n\r\n if (!config.canvas) {\r\n config.canvas = {\r\n width: config.width,\r\n height: config.height\r\n };\r\n }\r\n\r\n canvas.width = config.canvas.width || 320;\r\n canvas.height = config.canvas.height || 240;\r\n\r\n context = canvas.getContext('2d');\r\n\r\n // setting defaults\r\n if (config.video && config.video instanceof HTMLVideoElement) {\r\n video = config.video.cloneNode();\r\n\r\n if (config.initCallback) {\r\n config.initCallback();\r\n }\r\n } else {\r\n video = document.createElement('video');\r\n\r\n setSrcObject(mediaStream, video);\r\n\r\n video.onloadedmetadata = function() { // \"onloadedmetadata\" may NOT work in FF?\r\n if (config.initCallback) {\r\n config.initCallback();\r\n }\r\n };\r\n\r\n video.width = config.video.width;\r\n video.height = config.video.height;\r\n }\r\n\r\n video.muted = true;\r\n video.play();\r\n\r\n lastTime = new Date().getTime();\r\n whammy = new Whammy.Video();\r\n\r\n if (!config.disableLogs) {\r\n console.log('canvas resolutions', canvas.width, '*', canvas.height);\r\n console.log('video width/height', video.width || canvas.width, '*', video.height || canvas.height);\r\n }\r\n\r\n drawFrames(config.frameInterval);\r\n };\r\n\r\n /**\r\n * Draw and push frames to Whammy\r\n * @param {integer} frameInterval - set minimum interval (in milliseconds) between each time we push a frame to Whammy\r\n */\r\n function drawFrames(frameInterval) {\r\n frameInterval = typeof frameInterval !== 'undefined' ? frameInterval : 10;\r\n\r\n var duration = new Date().getTime() - lastTime;\r\n if (!duration) {\r\n return setTimeout(drawFrames, frameInterval, frameInterval);\r\n }\r\n\r\n if (isPausedRecording) {\r\n lastTime = new Date().getTime();\r\n return setTimeout(drawFrames, 100);\r\n }\r\n\r\n // via #206, by Jack i.e. @Seymourr\r\n lastTime = new Date().getTime();\r\n\r\n if (video.paused) {\r\n // via: https://github.com/muaz-khan/WebRTC-Experiment/pull/316\r\n // Tweak for Android Chrome\r\n video.play();\r\n }\r\n\r\n context.drawImage(video, 0, 0, canvas.width, canvas.height);\r\n whammy.frames.push({\r\n duration: duration,\r\n image: canvas.toDataURL('image/webp')\r\n });\r\n\r\n if (!isStopDrawing) {\r\n setTimeout(drawFrames, frameInterval, frameInterval);\r\n }\r\n }\r\n\r\n function asyncLoop(o) {\r\n var i = -1,\r\n length = o.length;\r\n\r\n (function loop() {\r\n i++;\r\n if (i === length) {\r\n o.callback();\r\n return;\r\n }\r\n\r\n // \"setTimeout\" added by Jim McLeod\r\n setTimeout(function() {\r\n o.functionToLoop(loop, i);\r\n }, 1);\r\n })();\r\n }\r\n\r\n\r\n /**\r\n * remove black frames from the beginning to the specified frame\r\n * @param {Array} _frames - array of frames to be checked\r\n * @param {number} _framesToCheck - number of frame until check will be executed (-1 - will drop all frames until frame not matched will be found)\r\n * @param {number} _pixTolerance - 0 - very strict (only black pixel color) ; 1 - all\r\n * @param {number} _frameTolerance - 0 - very strict (only black frame color) ; 1 - all\r\n * @returns {Array} - array of frames\r\n */\r\n // pull#293 by @volodalexey\r\n function dropBlackFrames(_frames, _framesToCheck, _pixTolerance, _frameTolerance, callback) {\r\n var localCanvas = document.createElement('canvas');\r\n localCanvas.width = canvas.width;\r\n localCanvas.height = canvas.height;\r\n var context2d = localCanvas.getContext('2d');\r\n var resultFrames = [];\r\n\r\n var checkUntilNotBlack = _framesToCheck === -1;\r\n var endCheckFrame = (_framesToCheck && _framesToCheck > 0 && _framesToCheck <= _frames.length) ?\r\n _framesToCheck : _frames.length;\r\n var sampleColor = {\r\n r: 0,\r\n g: 0,\r\n b: 0\r\n };\r\n var maxColorDifference = Math.sqrt(\r\n Math.pow(255, 2) +\r\n Math.pow(255, 2) +\r\n Math.pow(255, 2)\r\n );\r\n var pixTolerance = _pixTolerance && _pixTolerance >= 0 && _pixTolerance <= 1 ? _pixTolerance : 0;\r\n var frameTolerance = _frameTolerance && _frameTolerance >= 0 && _frameTolerance <= 1 ? _frameTolerance : 0;\r\n var doNotCheckNext = false;\r\n\r\n asyncLoop({\r\n length: endCheckFrame,\r\n functionToLoop: function(loop, f) {\r\n var matchPixCount, endPixCheck, maxPixCount;\r\n\r\n var finishImage = function() {\r\n if (!doNotCheckNext && maxPixCount - matchPixCount <= maxPixCount * frameTolerance) {\r\n // console.log('removed black frame : ' + f + ' ; frame duration ' + _frames[f].duration);\r\n } else {\r\n // console.log('frame is passed : ' + f);\r\n if (checkUntilNotBlack) {\r\n doNotCheckNext = true;\r\n }\r\n resultFrames.push(_frames[f]);\r\n }\r\n loop();\r\n };\r\n\r\n if (!doNotCheckNext) {\r\n var image = new Image();\r\n image.onload = function() {\r\n context2d.drawImage(image, 0, 0, canvas.width, canvas.height);\r\n var imageData = context2d.getImageData(0, 0, canvas.width, canvas.height);\r\n matchPixCount = 0;\r\n endPixCheck = imageData.data.length;\r\n maxPixCount = imageData.data.length / 4;\r\n\r\n for (var pix = 0; pix < endPixCheck; pix += 4) {\r\n var currentColor = {\r\n r: imageData.data[pix],\r\n g: imageData.data[pix + 1],\r\n b: imageData.data[pix + 2]\r\n };\r\n var colorDifference = Math.sqrt(\r\n Math.pow(currentColor.r - sampleColor.r, 2) +\r\n Math.pow(currentColor.g - sampleColor.g, 2) +\r\n Math.pow(currentColor.b - sampleColor.b, 2)\r\n );\r\n // difference in color it is difference in color vectors (r1,g1,b1) <=> (r2,g2,b2)\r\n if (colorDifference <= maxColorDifference * pixTolerance) {\r\n matchPixCount++;\r\n }\r\n }\r\n finishImage();\r\n };\r\n image.src = _frames[f].image;\r\n } else {\r\n finishImage();\r\n }\r\n },\r\n callback: function() {\r\n resultFrames = resultFrames.concat(_frames.slice(endCheckFrame));\r\n\r\n if (resultFrames.length <= 0) {\r\n // at least one last frame should be available for next manipulation\r\n // if total duration of all frames will be < 1000 than ffmpeg doesn't work well...\r\n resultFrames.push(_frames[_frames.length - 1]);\r\n }\r\n callback(resultFrames);\r\n }\r\n });\r\n }\r\n\r\n var isStopDrawing = false;\r\n\r\n /**\r\n * This method stops recording video.\r\n * @param {function} callback - Callback function, that is used to pass recorded blob back to the callee.\r\n * @method\r\n * @memberof WhammyRecorder\r\n * @example\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n */\r\n this.stop = function(callback) {\r\n callback = callback || function() {};\r\n\r\n isStopDrawing = true;\r\n\r\n var _this = this;\r\n // analyse of all frames takes some time!\r\n setTimeout(function() {\r\n // e.g. dropBlackFrames(frames, 10, 1, 1) - will cut all 10 frames\r\n // e.g. dropBlackFrames(frames, 10, 0.5, 0.5) - will analyse 10 frames\r\n // e.g. dropBlackFrames(frames, 10) === dropBlackFrames(frames, 10, 0, 0) - will analyse 10 frames with strict black color\r\n dropBlackFrames(whammy.frames, -1, null, null, function(frames) {\r\n whammy.frames = frames;\r\n\r\n // to display advertisement images!\r\n if (config.advertisement && config.advertisement.length) {\r\n whammy.frames = config.advertisement.concat(whammy.frames);\r\n }\r\n\r\n /**\r\n * @property {Blob} blob - Recorded frames in video/webm blob.\r\n * @memberof WhammyRecorder\r\n * @example\r\n * recorder.stop(function() {\r\n * var blob = recorder.blob;\r\n * });\r\n */\r\n whammy.compile(function(blob) {\r\n _this.blob = blob;\r\n\r\n if (_this.blob.forEach) {\r\n _this.blob = new Blob([], {\r\n type: 'video/webm'\r\n });\r\n }\r\n\r\n if (callback) {\r\n callback(_this.blob);\r\n }\r\n });\r\n });\r\n }, 10);\r\n };\r\n\r\n var isPausedRecording = false;\r\n\r\n /**\r\n * This method pauses the recording process.\r\n * @method\r\n * @memberof WhammyRecorder\r\n * @example\r\n * recorder.pause();\r\n */\r\n this.pause = function() {\r\n isPausedRecording = true;\r\n };\r\n\r\n /**\r\n * This method resumes the recording process.\r\n * @method\r\n * @memberof WhammyRecorder\r\n * @example\r\n * recorder.resume();\r\n */\r\n this.resume = function() {\r\n isPausedRecording = false;\r\n\r\n if (isStopDrawing) {\r\n this.record();\r\n }\r\n };\r\n\r\n /**\r\n * This method resets currently recorded data.\r\n * @method\r\n * @memberof WhammyRecorder\r\n * @example\r\n * recorder.clearRecordedData();\r\n */\r\n this.clearRecordedData = function() {\r\n if (!isStopDrawing) {\r\n this.stop(clearRecordedDataCB);\r\n }\r\n clearRecordedDataCB();\r\n };\r\n\r\n function clearRecordedDataCB() {\r\n whammy.frames = [];\r\n isStopDrawing = true;\r\n isPausedRecording = false;\r\n }\r\n\r\n // for debugging\r\n this.name = 'WhammyRecorder';\r\n this.toString = function() {\r\n return this.name;\r\n };\r\n\r\n var canvas = document.createElement('canvas');\r\n var context = canvas.getContext('2d');\r\n\r\n var video;\r\n var lastTime;\r\n var whammy;\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.WhammyRecorder = WhammyRecorder;\r\n}\n\r\n// https://github.com/antimatter15/whammy/blob/master/LICENSE\r\n// _________\r\n// Whammy.js\r\n\r\n// todo: Firefox now supports webp for webm containers!\r\n// their MediaRecorder implementation works well!\r\n// should we provide an option to record via Whammy.js or MediaRecorder API is a better solution?\r\n\r\n/**\r\n * Whammy is a standalone class used by {@link RecordRTC} to bring video recording in Chrome. It is written by {@link https://github.com/antimatter15|antimatter15}\r\n * @summary A real time javascript webm encoder based on a canvas hack.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef Whammy\r\n * @class\r\n * @example\r\n * var recorder = new Whammy().Video(15);\r\n * recorder.add(context || canvas || dataURL);\r\n * var output = recorder.compile();\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n */\r\n\r\nvar Whammy = (function() {\r\n // a more abstract-ish API\r\n\r\n function WhammyVideo(duration) {\r\n this.frames = [];\r\n this.duration = duration || 1;\r\n this.quality = 0.8;\r\n }\r\n\r\n /**\r\n * Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder.\r\n * @method\r\n * @memberof Whammy\r\n * @example\r\n * recorder = new Whammy().Video(0.8, 100);\r\n * recorder.add(canvas || context || 'image/webp');\r\n * @param {string} frame - Canvas || Context || image/webp\r\n * @param {number} duration - Stick a duration (in milliseconds)\r\n */\r\n WhammyVideo.prototype.add = function(frame, duration) {\r\n if ('canvas' in frame) { //CanvasRenderingContext2D\r\n frame = frame.canvas;\r\n }\r\n\r\n if ('toDataURL' in frame) {\r\n frame = frame.toDataURL('image/webp', this.quality);\r\n }\r\n\r\n if (!(/^data:image\\/webp;base64,/ig).test(frame)) {\r\n throw 'Input must be formatted properly as a base64 encoded DataURI of type image/webp';\r\n }\r\n this.frames.push({\r\n image: frame,\r\n duration: duration || this.duration\r\n });\r\n };\r\n\r\n function processInWebWorker(_function) {\r\n var blob = URL.createObjectURL(new Blob([_function.toString(),\r\n 'this.onmessage = function (eee) {' + _function.name + '(eee.data);}'\r\n ], {\r\n type: 'application/javascript'\r\n }));\r\n\r\n var worker = new Worker(blob);\r\n URL.revokeObjectURL(blob);\r\n return worker;\r\n }\r\n\r\n function whammyInWebWorker(frames) {\r\n function ArrayToWebM(frames) {\r\n var info = checkFrames(frames);\r\n if (!info) {\r\n return [];\r\n }\r\n\r\n var clusterMaxDuration = 30000;\r\n\r\n var EBML = [{\r\n 'id': 0x1a45dfa3, // EBML\r\n 'data': [{\r\n 'data': 1,\r\n 'id': 0x4286 // EBMLVersion\r\n }, {\r\n 'data': 1,\r\n 'id': 0x42f7 // EBMLReadVersion\r\n }, {\r\n 'data': 4,\r\n 'id': 0x42f2 // EBMLMaxIDLength\r\n }, {\r\n 'data': 8,\r\n 'id': 0x42f3 // EBMLMaxSizeLength\r\n }, {\r\n 'data': 'webm',\r\n 'id': 0x4282 // DocType\r\n }, {\r\n 'data': 2,\r\n 'id': 0x4287 // DocTypeVersion\r\n }, {\r\n 'data': 2,\r\n 'id': 0x4285 // DocTypeReadVersion\r\n }]\r\n }, {\r\n 'id': 0x18538067, // Segment\r\n 'data': [{\r\n 'id': 0x1549a966, // Info\r\n 'data': [{\r\n 'data': 1e6, //do things in millisecs (num of nanosecs for duration scale)\r\n 'id': 0x2ad7b1 // TimecodeScale\r\n }, {\r\n 'data': 'whammy',\r\n 'id': 0x4d80 // MuxingApp\r\n }, {\r\n 'data': 'whammy',\r\n 'id': 0x5741 // WritingApp\r\n }, {\r\n 'data': doubleToString(info.duration),\r\n 'id': 0x4489 // Duration\r\n }]\r\n }, {\r\n 'id': 0x1654ae6b, // Tracks\r\n 'data': [{\r\n 'id': 0xae, // TrackEntry\r\n 'data': [{\r\n 'data': 1,\r\n 'id': 0xd7 // TrackNumber\r\n }, {\r\n 'data': 1,\r\n 'id': 0x73c5 // TrackUID\r\n }, {\r\n 'data': 0,\r\n 'id': 0x9c // FlagLacing\r\n }, {\r\n 'data': 'und',\r\n 'id': 0x22b59c // Language\r\n }, {\r\n 'data': 'V_VP8',\r\n 'id': 0x86 // CodecID\r\n }, {\r\n 'data': 'VP8',\r\n 'id': 0x258688 // CodecName\r\n }, {\r\n 'data': 1,\r\n 'id': 0x83 // TrackType\r\n }, {\r\n 'id': 0xe0, // Video\r\n 'data': [{\r\n 'data': info.width,\r\n 'id': 0xb0 // PixelWidth\r\n }, {\r\n 'data': info.height,\r\n 'id': 0xba // PixelHeight\r\n }]\r\n }]\r\n }]\r\n }]\r\n }];\r\n\r\n //Generate clusters (max duration)\r\n var frameNumber = 0;\r\n var clusterTimecode = 0;\r\n while (frameNumber < frames.length) {\r\n\r\n var clusterFrames = [];\r\n var clusterDuration = 0;\r\n do {\r\n clusterFrames.push(frames[frameNumber]);\r\n clusterDuration += frames[frameNumber].duration;\r\n frameNumber++;\r\n } while (frameNumber < frames.length && clusterDuration < clusterMaxDuration);\r\n\r\n var clusterCounter = 0;\r\n var cluster = {\r\n 'id': 0x1f43b675, // Cluster\r\n 'data': getClusterData(clusterTimecode, clusterCounter, clusterFrames)\r\n }; //Add cluster to segment\r\n EBML[1].data.push(cluster);\r\n clusterTimecode += clusterDuration;\r\n }\r\n\r\n return generateEBML(EBML);\r\n }\r\n\r\n function getClusterData(clusterTimecode, clusterCounter, clusterFrames) {\r\n return [{\r\n 'data': clusterTimecode,\r\n 'id': 0xe7 // Timecode\r\n }].concat(clusterFrames.map(function(webp) {\r\n var block = makeSimpleBlock({\r\n discardable: 0,\r\n frame: webp.data.slice(4),\r\n invisible: 0,\r\n keyframe: 1,\r\n lacing: 0,\r\n trackNum: 1,\r\n timecode: Math.round(clusterCounter)\r\n });\r\n clusterCounter += webp.duration;\r\n return {\r\n data: block,\r\n id: 0xa3\r\n };\r\n }));\r\n }\r\n\r\n // sums the lengths of all the frames and gets the duration\r\n\r\n function checkFrames(frames) {\r\n if (!frames[0]) {\r\n postMessage({\r\n error: 'Something went wrong. Maybe WebP format is not supported in the current browser.'\r\n });\r\n return;\r\n }\r\n\r\n var width = frames[0].width,\r\n height = frames[0].height,\r\n duration = frames[0].duration;\r\n\r\n for (var i = 1; i < frames.length; i++) {\r\n duration += frames[i].duration;\r\n }\r\n return {\r\n duration: duration,\r\n width: width,\r\n height: height\r\n };\r\n }\r\n\r\n function numToBuffer(num) {\r\n var parts = [];\r\n while (num > 0) {\r\n parts.push(num & 0xff);\r\n num = num >> 8;\r\n }\r\n return new Uint8Array(parts.reverse());\r\n }\r\n\r\n function strToBuffer(str) {\r\n return new Uint8Array(str.split('').map(function(e) {\r\n return e.charCodeAt(0);\r\n }));\r\n }\r\n\r\n function bitsToBuffer(bits) {\r\n var data = [];\r\n var pad = (bits.length % 8) ? (new Array(1 + 8 - (bits.length % 8))).join('0') : '';\r\n bits = pad + bits;\r\n for (var i = 0; i < bits.length; i += 8) {\r\n data.push(parseInt(bits.substr(i, 8), 2));\r\n }\r\n return new Uint8Array(data);\r\n }\r\n\r\n function generateEBML(json) {\r\n var ebml = [];\r\n for (var i = 0; i < json.length; i++) {\r\n var data = json[i].data;\r\n\r\n if (typeof data === 'object') {\r\n data = generateEBML(data);\r\n }\r\n\r\n if (typeof data === 'number') {\r\n data = bitsToBuffer(data.toString(2));\r\n }\r\n\r\n if (typeof data === 'string') {\r\n data = strToBuffer(data);\r\n }\r\n\r\n var len = data.size || data.byteLength || data.length;\r\n var zeroes = Math.ceil(Math.ceil(Math.log(len) / Math.log(2)) / 8);\r\n var sizeToString = len.toString(2);\r\n var padded = (new Array((zeroes * 7 + 7 + 1) - sizeToString.length)).join('0') + sizeToString;\r\n var size = (new Array(zeroes)).join('0') + '1' + padded;\r\n\r\n ebml.push(numToBuffer(json[i].id));\r\n ebml.push(bitsToBuffer(size));\r\n ebml.push(data);\r\n }\r\n\r\n return new Blob(ebml, {\r\n type: 'video/webm'\r\n });\r\n }\r\n\r\n function toBinStrOld(bits) {\r\n var data = '';\r\n var pad = (bits.length % 8) ? (new Array(1 + 8 - (bits.length % 8))).join('0') : '';\r\n bits = pad + bits;\r\n for (var i = 0; i < bits.length; i += 8) {\r\n data += String.fromCharCode(parseInt(bits.substr(i, 8), 2));\r\n }\r\n return data;\r\n }\r\n\r\n function makeSimpleBlock(data) {\r\n var flags = 0;\r\n\r\n if (data.keyframe) {\r\n flags |= 128;\r\n }\r\n\r\n if (data.invisible) {\r\n flags |= 8;\r\n }\r\n\r\n if (data.lacing) {\r\n flags |= (data.lacing << 1);\r\n }\r\n\r\n if (data.discardable) {\r\n flags |= 1;\r\n }\r\n\r\n if (data.trackNum > 127) {\r\n throw 'TrackNumber > 127 not supported';\r\n }\r\n\r\n var out = [data.trackNum | 0x80, data.timecode >> 8, data.timecode & 0xff, flags].map(function(e) {\r\n return String.fromCharCode(e);\r\n }).join('') + data.frame;\r\n\r\n return out;\r\n }\r\n\r\n function parseWebP(riff) {\r\n var VP8 = riff.RIFF[0].WEBP[0];\r\n\r\n var frameStart = VP8.indexOf('\\x9d\\x01\\x2a'); // A VP8 keyframe starts with the 0x9d012a header\r\n for (var i = 0, c = []; i < 4; i++) {\r\n c[i] = VP8.charCodeAt(frameStart + 3 + i);\r\n }\r\n\r\n var width, height, tmp;\r\n\r\n //the code below is literally copied verbatim from the bitstream spec\r\n tmp = (c[1] << 8) | c[0];\r\n width = tmp & 0x3FFF;\r\n tmp = (c[3] << 8) | c[2];\r\n height = tmp & 0x3FFF;\r\n return {\r\n width: width,\r\n height: height,\r\n data: VP8,\r\n riff: riff\r\n };\r\n }\r\n\r\n function getStrLength(string, offset) {\r\n return parseInt(string.substr(offset + 4, 4).split('').map(function(i) {\r\n var unpadded = i.charCodeAt(0).toString(2);\r\n return (new Array(8 - unpadded.length + 1)).join('0') + unpadded;\r\n }).join(''), 2);\r\n }\r\n\r\n function parseRIFF(string) {\r\n var offset = 0;\r\n var chunks = {};\r\n\r\n while (offset < string.length) {\r\n var id = string.substr(offset, 4);\r\n var len = getStrLength(string, offset);\r\n var data = string.substr(offset + 4 + 4, len);\r\n offset += 4 + 4 + len;\r\n chunks[id] = chunks[id] || [];\r\n\r\n if (id === 'RIFF' || id === 'LIST') {\r\n chunks[id].push(parseRIFF(data));\r\n } else {\r\n chunks[id].push(data);\r\n }\r\n }\r\n return chunks;\r\n }\r\n\r\n function doubleToString(num) {\r\n return [].slice.call(\r\n new Uint8Array((new Float64Array([num])).buffer), 0).map(function(e) {\r\n return String.fromCharCode(e);\r\n }).reverse().join('');\r\n }\r\n\r\n var webm = new ArrayToWebM(frames.map(function(frame) {\r\n var webp = parseWebP(parseRIFF(atob(frame.image.slice(23))));\r\n webp.duration = frame.duration;\r\n return webp;\r\n }));\r\n\r\n postMessage(webm);\r\n }\r\n\r\n /**\r\n * Encodes frames in WebM container. It uses WebWorkinvoke to invoke 'ArrayToWebM' method.\r\n * @param {function} callback - Callback function, that is used to pass recorded blob back to the callee.\r\n * @method\r\n * @memberof Whammy\r\n * @example\r\n * recorder = new Whammy().Video(0.8, 100);\r\n * recorder.compile(function(blob) {\r\n * // blob.size - blob.type\r\n * });\r\n */\r\n WhammyVideo.prototype.compile = function(callback) {\r\n var webWorker = processInWebWorker(whammyInWebWorker);\r\n\r\n webWorker.onmessage = function(event) {\r\n if (event.data.error) {\r\n console.error(event.data.error);\r\n return;\r\n }\r\n callback(event.data);\r\n };\r\n\r\n webWorker.postMessage(this.frames);\r\n };\r\n\r\n return {\r\n /**\r\n * A more abstract-ish API.\r\n * @method\r\n * @memberof Whammy\r\n * @example\r\n * recorder = new Whammy().Video(0.8, 100);\r\n * @param {?number} speed - 0.8\r\n * @param {?number} quality - 100\r\n */\r\n Video: WhammyVideo\r\n };\r\n})();\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.Whammy = Whammy;\r\n}\n\r\n// ______________ (indexed-db)\r\n// DiskStorage.js\r\n\r\n/**\r\n * DiskStorage is a standalone object used by {@link RecordRTC} to store recorded blobs in IndexedDB storage.\r\n * @summary Writing blobs into IndexedDB.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @example\r\n * DiskStorage.Store({\r\n * audioBlob: yourAudioBlob,\r\n * videoBlob: yourVideoBlob,\r\n * gifBlob : yourGifBlob\r\n * });\r\n * DiskStorage.Fetch(function(dataURL, type) {\r\n * if(type === 'audioBlob') { }\r\n * if(type === 'videoBlob') { }\r\n * if(type === 'gifBlob') { }\r\n * });\r\n * // DiskStorage.dataStoreName = 'recordRTC';\r\n * // DiskStorage.onError = function(error) { };\r\n * @property {function} init - This method must be called once to initialize IndexedDB ObjectStore. Though, it is auto-used internally.\r\n * @property {function} Fetch - This method fetches stored blobs from IndexedDB.\r\n * @property {function} Store - This method stores blobs in IndexedDB.\r\n * @property {function} onError - This function is invoked for any known/unknown error.\r\n * @property {string} dataStoreName - Name of the ObjectStore created in IndexedDB storage.\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n */\r\n\r\n\r\nvar DiskStorage = {\r\n /**\r\n * This method must be called once to initialize IndexedDB ObjectStore. Though, it is auto-used internally.\r\n * @method\r\n * @memberof DiskStorage\r\n * @internal\r\n * @example\r\n * DiskStorage.init();\r\n */\r\n init: function() {\r\n var self = this;\r\n\r\n if (typeof indexedDB === 'undefined' || typeof indexedDB.open === 'undefined') {\r\n console.error('IndexedDB API are not available in this browser.');\r\n return;\r\n }\r\n\r\n var dbVersion = 1;\r\n var dbName = this.dbName || location.href.replace(/\\/|:|#|%|\\.|\\[|\\]/g, ''),\r\n db;\r\n var request = indexedDB.open(dbName, dbVersion);\r\n\r\n function createObjectStore(dataBase) {\r\n dataBase.createObjectStore(self.dataStoreName);\r\n }\r\n\r\n function putInDB() {\r\n var transaction = db.transaction([self.dataStoreName], 'readwrite');\r\n\r\n if (self.videoBlob) {\r\n transaction.objectStore(self.dataStoreName).put(self.videoBlob, 'videoBlob');\r\n }\r\n\r\n if (self.gifBlob) {\r\n transaction.objectStore(self.dataStoreName).put(self.gifBlob, 'gifBlob');\r\n }\r\n\r\n if (self.audioBlob) {\r\n transaction.objectStore(self.dataStoreName).put(self.audioBlob, 'audioBlob');\r\n }\r\n\r\n function getFromStore(portionName) {\r\n transaction.objectStore(self.dataStoreName).get(portionName).onsuccess = function(event) {\r\n if (self.callback) {\r\n self.callback(event.target.result, portionName);\r\n }\r\n };\r\n }\r\n\r\n getFromStore('audioBlob');\r\n getFromStore('videoBlob');\r\n getFromStore('gifBlob');\r\n }\r\n\r\n request.onerror = self.onError;\r\n\r\n request.onsuccess = function() {\r\n db = request.result;\r\n db.onerror = self.onError;\r\n\r\n if (db.setVersion) {\r\n if (db.version !== dbVersion) {\r\n var setVersion = db.setVersion(dbVersion);\r\n setVersion.onsuccess = function() {\r\n createObjectStore(db);\r\n putInDB();\r\n };\r\n } else {\r\n putInDB();\r\n }\r\n } else {\r\n putInDB();\r\n }\r\n };\r\n request.onupgradeneeded = function(event) {\r\n createObjectStore(event.target.result);\r\n };\r\n },\r\n /**\r\n * This method fetches stored blobs from IndexedDB.\r\n * @method\r\n * @memberof DiskStorage\r\n * @internal\r\n * @example\r\n * DiskStorage.Fetch(function(dataURL, type) {\r\n * if(type === 'audioBlob') { }\r\n * if(type === 'videoBlob') { }\r\n * if(type === 'gifBlob') { }\r\n * });\r\n */\r\n Fetch: function(callback) {\r\n this.callback = callback;\r\n this.init();\r\n\r\n return this;\r\n },\r\n /**\r\n * This method stores blobs in IndexedDB.\r\n * @method\r\n * @memberof DiskStorage\r\n * @internal\r\n * @example\r\n * DiskStorage.Store({\r\n * audioBlob: yourAudioBlob,\r\n * videoBlob: yourVideoBlob,\r\n * gifBlob : yourGifBlob\r\n * });\r\n */\r\n Store: function(config) {\r\n this.audioBlob = config.audioBlob;\r\n this.videoBlob = config.videoBlob;\r\n this.gifBlob = config.gifBlob;\r\n\r\n this.init();\r\n\r\n return this;\r\n },\r\n /**\r\n * This function is invoked for any known/unknown error.\r\n * @method\r\n * @memberof DiskStorage\r\n * @internal\r\n * @example\r\n * DiskStorage.onError = function(error){\r\n * alerot( JSON.stringify(error) );\r\n * };\r\n */\r\n onError: function(error) {\r\n console.error(JSON.stringify(error, null, '\\t'));\r\n },\r\n\r\n /**\r\n * @property {string} dataStoreName - Name of the ObjectStore created in IndexedDB storage.\r\n * @memberof DiskStorage\r\n * @internal\r\n * @example\r\n * DiskStorage.dataStoreName = 'recordRTC';\r\n */\r\n dataStoreName: 'recordRTC',\r\n dbName: null\r\n};\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.DiskStorage = DiskStorage;\r\n}\n\r\n// ______________\r\n// GifRecorder.js\r\n\r\n/**\r\n * GifRecorder is standalone calss used by {@link RecordRTC} to record video or canvas into animated gif.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef GifRecorder\r\n * @class\r\n * @example\r\n * var recorder = new GifRecorder(mediaStream || canvas || context, { onGifPreview: function, onGifRecordingStarted: function, width: 1280, height: 720, frameRate: 200, quality: 10 });\r\n * recorder.record();\r\n * recorder.stop(function(blob) {\r\n * img.src = URL.createObjectURL(blob);\r\n * });\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - MediaStream object or HTMLCanvasElement or CanvasRenderingContext2D.\r\n * @param {object} config - {disableLogs:true, initCallback: function, width: 320, height: 240, frameRate: 200, quality: 10}\r\n */\r\n\r\nfunction GifRecorder(mediaStream, config) {\r\n if (typeof GIFEncoder === 'undefined') {\r\n var script = document.createElement('script');\r\n script.src = 'https://www.webrtc-experiment.com/gif-recorder.js';\r\n (document.body || document.documentElement).appendChild(script);\r\n }\r\n\r\n config = config || {};\r\n\r\n var isHTMLObject = mediaStream instanceof CanvasRenderingContext2D || mediaStream instanceof HTMLCanvasElement;\r\n\r\n /**\r\n * This method records MediaStream.\r\n * @method\r\n * @memberof GifRecorder\r\n * @example\r\n * recorder.record();\r\n */\r\n this.record = function() {\r\n if (typeof GIFEncoder === 'undefined') {\r\n setTimeout(self.record, 1000);\r\n return;\r\n }\r\n\r\n if (!isLoadedMetaData) {\r\n setTimeout(self.record, 1000);\r\n return;\r\n }\r\n\r\n if (!isHTMLObject) {\r\n if (!config.width) {\r\n config.width = video.offsetWidth || 320;\r\n }\r\n\r\n if (!config.height) {\r\n config.height = video.offsetHeight || 240;\r\n }\r\n\r\n if (!config.video) {\r\n config.video = {\r\n width: config.width,\r\n height: config.height\r\n };\r\n }\r\n\r\n if (!config.canvas) {\r\n config.canvas = {\r\n width: config.width,\r\n height: config.height\r\n };\r\n }\r\n\r\n canvas.width = config.canvas.width || 320;\r\n canvas.height = config.canvas.height || 240;\r\n\r\n video.width = config.video.width || 320;\r\n video.height = config.video.height || 240;\r\n }\r\n\r\n // external library to record as GIF images\r\n gifEncoder = new GIFEncoder();\r\n\r\n // void setRepeat(int iter) \r\n // Sets the number of times the set of GIF frames should be played. \r\n // Default is 1; 0 means play indefinitely.\r\n gifEncoder.setRepeat(0);\r\n\r\n // void setFrameRate(Number fps) \r\n // Sets frame rate in frames per second. \r\n // Equivalent to setDelay(1000/fps).\r\n // Using \"setDelay\" instead of \"setFrameRate\"\r\n gifEncoder.setDelay(config.frameRate || 200);\r\n\r\n // void setQuality(int quality) \r\n // Sets quality of color quantization (conversion of images to the \r\n // maximum 256 colors allowed by the GIF specification). \r\n // Lower values (minimum = 1) produce better colors, \r\n // but slow processing significantly. 10 is the default, \r\n // and produces good color mapping at reasonable speeds. \r\n // Values greater than 20 do not yield significant improvements in speed.\r\n gifEncoder.setQuality(config.quality || 10);\r\n\r\n // Boolean start() \r\n // This writes the GIF Header and returns false if it fails.\r\n gifEncoder.start();\r\n\r\n if (typeof config.onGifRecordingStarted === 'function') {\r\n config.onGifRecordingStarted();\r\n }\r\n\r\n startTime = Date.now();\r\n\r\n function drawVideoFrame(time) {\r\n if (self.clearedRecordedData === true) {\r\n return;\r\n }\r\n\r\n if (isPausedRecording) {\r\n return setTimeout(function() {\r\n drawVideoFrame(time);\r\n }, 100);\r\n }\r\n\r\n lastAnimationFrame = requestAnimationFrame(drawVideoFrame);\r\n\r\n if (typeof lastFrameTime === undefined) {\r\n lastFrameTime = time;\r\n }\r\n\r\n // ~10 fps\r\n if (time - lastFrameTime < 90) {\r\n return;\r\n }\r\n\r\n if (!isHTMLObject && video.paused) {\r\n // via: https://github.com/muaz-khan/WebRTC-Experiment/pull/316\r\n // Tweak for Android Chrome\r\n video.play();\r\n }\r\n\r\n if (!isHTMLObject) {\r\n context.drawImage(video, 0, 0, canvas.width, canvas.height);\r\n }\r\n\r\n if (config.onGifPreview) {\r\n config.onGifPreview(canvas.toDataURL('image/png'));\r\n }\r\n\r\n gifEncoder.addFrame(context);\r\n lastFrameTime = time;\r\n }\r\n\r\n lastAnimationFrame = requestAnimationFrame(drawVideoFrame);\r\n\r\n if (config.initCallback) {\r\n config.initCallback();\r\n }\r\n };\r\n\r\n /**\r\n * This method stops recording MediaStream.\r\n * @param {function} callback - Callback function, that is used to pass recorded blob back to the callee.\r\n * @method\r\n * @memberof GifRecorder\r\n * @example\r\n * recorder.stop(function(blob) {\r\n * img.src = URL.createObjectURL(blob);\r\n * });\r\n */\r\n this.stop = function(callback) {\r\n callback = callback || function() {};\r\n\r\n if (lastAnimationFrame) {\r\n cancelAnimationFrame(lastAnimationFrame);\r\n }\r\n\r\n endTime = Date.now();\r\n\r\n /**\r\n * @property {Blob} blob - The recorded blob object.\r\n * @memberof GifRecorder\r\n * @example\r\n * recorder.stop(function(){\r\n * var blob = recorder.blob;\r\n * });\r\n */\r\n this.blob = new Blob([new Uint8Array(gifEncoder.stream().bin)], {\r\n type: 'image/gif'\r\n });\r\n\r\n callback(this.blob);\r\n\r\n // bug: find a way to clear old recorded blobs\r\n gifEncoder.stream().bin = [];\r\n };\r\n\r\n var isPausedRecording = false;\r\n\r\n /**\r\n * This method pauses the recording process.\r\n * @method\r\n * @memberof GifRecorder\r\n * @example\r\n * recorder.pause();\r\n */\r\n this.pause = function() {\r\n isPausedRecording = true;\r\n };\r\n\r\n /**\r\n * This method resumes the recording process.\r\n * @method\r\n * @memberof GifRecorder\r\n * @example\r\n * recorder.resume();\r\n */\r\n this.resume = function() {\r\n isPausedRecording = false;\r\n };\r\n\r\n /**\r\n * This method resets currently recorded data.\r\n * @method\r\n * @memberof GifRecorder\r\n * @example\r\n * recorder.clearRecordedData();\r\n */\r\n this.clearRecordedData = function() {\r\n self.clearedRecordedData = true;\r\n clearRecordedDataCB();\r\n };\r\n\r\n function clearRecordedDataCB() {\r\n if (gifEncoder) {\r\n gifEncoder.stream().bin = [];\r\n }\r\n }\r\n\r\n // for debugging\r\n this.name = 'GifRecorder';\r\n this.toString = function() {\r\n return this.name;\r\n };\r\n\r\n var canvas = document.createElement('canvas');\r\n var context = canvas.getContext('2d');\r\n\r\n if (isHTMLObject) {\r\n if (mediaStream instanceof CanvasRenderingContext2D) {\r\n context = mediaStream;\r\n canvas = context.canvas;\r\n } else if (mediaStream instanceof HTMLCanvasElement) {\r\n context = mediaStream.getContext('2d');\r\n canvas = mediaStream;\r\n }\r\n }\r\n\r\n var isLoadedMetaData = true;\r\n\r\n if (!isHTMLObject) {\r\n var video = document.createElement('video');\r\n video.muted = true;\r\n video.autoplay = true;\r\n video.playsInline = true;\r\n\r\n isLoadedMetaData = false;\r\n video.onloadedmetadata = function() {\r\n isLoadedMetaData = true;\r\n };\r\n\r\n setSrcObject(mediaStream, video);\r\n\r\n video.play();\r\n }\r\n\r\n var lastAnimationFrame = null;\r\n var startTime, endTime, lastFrameTime;\r\n\r\n var gifEncoder;\r\n\r\n var self = this;\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.GifRecorder = GifRecorder;\r\n}\n\r\n// Last time updated: 2019-06-21 4:09:42 AM UTC\r\n\r\n// ________________________\r\n// MultiStreamsMixer v1.2.2\r\n\r\n// Open-Sourced: https://github.com/muaz-khan/MultiStreamsMixer\r\n\r\n// --------------------------------------------------\r\n// Muaz Khan - www.MuazKhan.com\r\n// MIT License - www.WebRTC-Experiment.com/licence\r\n// --------------------------------------------------\r\n\r\nfunction MultiStreamsMixer(arrayOfMediaStreams, elementClass) {\r\n\r\n var browserFakeUserAgent = 'Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45';\r\n\r\n (function(that) {\r\n if (typeof RecordRTC !== 'undefined') {\r\n return;\r\n }\r\n\r\n if (!that) {\r\n return;\r\n }\r\n\r\n if (typeof window !== 'undefined') {\r\n return;\r\n }\r\n\r\n if (typeof global === 'undefined') {\r\n return;\r\n }\r\n\r\n global.navigator = {\r\n userAgent: browserFakeUserAgent,\r\n getUserMedia: function() {}\r\n };\r\n\r\n if (!global.console) {\r\n global.console = {};\r\n }\r\n\r\n if (typeof global.console.log === 'undefined' || typeof global.console.error === 'undefined') {\r\n global.console.error = global.console.log = global.console.log || function() {\r\n console.log(arguments);\r\n };\r\n }\r\n\r\n if (typeof document === 'undefined') {\r\n /*global document:true */\r\n that.document = {\r\n documentElement: {\r\n appendChild: function() {\r\n return '';\r\n }\r\n }\r\n };\r\n\r\n document.createElement = document.captureStream = document.mozCaptureStream = function() {\r\n var obj = {\r\n getContext: function() {\r\n return obj;\r\n },\r\n play: function() {},\r\n pause: function() {},\r\n drawImage: function() {},\r\n toDataURL: function() {\r\n return '';\r\n },\r\n style: {}\r\n };\r\n return obj;\r\n };\r\n\r\n that.HTMLVideoElement = function() {};\r\n }\r\n\r\n if (typeof location === 'undefined') {\r\n /*global location:true */\r\n that.location = {\r\n protocol: 'file:',\r\n href: '',\r\n hash: ''\r\n };\r\n }\r\n\r\n if (typeof screen === 'undefined') {\r\n /*global screen:true */\r\n that.screen = {\r\n width: 0,\r\n height: 0\r\n };\r\n }\r\n\r\n if (typeof URL === 'undefined') {\r\n /*global screen:true */\r\n that.URL = {\r\n createObjectURL: function() {\r\n return '';\r\n },\r\n revokeObjectURL: function() {\r\n return '';\r\n }\r\n };\r\n }\r\n\r\n /*global window:true */\r\n that.window = global;\r\n })(typeof global !== 'undefined' ? global : null);\r\n\r\n // requires: chrome://flags/#enable-experimental-web-platform-features\r\n\r\n elementClass = elementClass || 'multi-streams-mixer';\r\n\r\n var videos = [];\r\n var isStopDrawingFrames = false;\r\n\r\n var canvas = document.createElement('canvas');\r\n var context = canvas.getContext('2d');\r\n canvas.style.opacity = 0;\r\n canvas.style.position = 'absolute';\r\n canvas.style.zIndex = -1;\r\n canvas.style.top = '-1000em';\r\n canvas.style.left = '-1000em';\r\n canvas.className = elementClass;\r\n (document.body || document.documentElement).appendChild(canvas);\r\n\r\n this.disableLogs = false;\r\n this.frameInterval = 10;\r\n\r\n this.width = 360;\r\n this.height = 240;\r\n\r\n // use gain node to prevent echo\r\n this.useGainNode = true;\r\n\r\n var self = this;\r\n\r\n // _____________________________\r\n // Cross-Browser-Declarations.js\r\n\r\n // WebAudio API representer\r\n var AudioContext = window.AudioContext;\r\n\r\n if (typeof AudioContext === 'undefined') {\r\n if (typeof webkitAudioContext !== 'undefined') {\r\n /*global AudioContext:true */\r\n AudioContext = webkitAudioContext;\r\n }\r\n\r\n if (typeof mozAudioContext !== 'undefined') {\r\n /*global AudioContext:true */\r\n AudioContext = mozAudioContext;\r\n }\r\n }\r\n\r\n /*jshint -W079 */\r\n var URL = window.URL;\r\n\r\n if (typeof URL === 'undefined' && typeof webkitURL !== 'undefined') {\r\n /*global URL:true */\r\n URL = webkitURL;\r\n }\r\n\r\n if (typeof navigator !== 'undefined' && typeof navigator.getUserMedia === 'undefined') { // maybe window.navigator?\r\n if (typeof navigator.webkitGetUserMedia !== 'undefined') {\r\n navigator.getUserMedia = navigator.webkitGetUserMedia;\r\n }\r\n\r\n if (typeof navigator.mozGetUserMedia !== 'undefined') {\r\n navigator.getUserMedia = navigator.mozGetUserMedia;\r\n }\r\n }\r\n\r\n var MediaStream = window.MediaStream;\r\n\r\n if (typeof MediaStream === 'undefined' && typeof webkitMediaStream !== 'undefined') {\r\n MediaStream = webkitMediaStream;\r\n }\r\n\r\n /*global MediaStream:true */\r\n if (typeof MediaStream !== 'undefined') {\r\n // override \"stop\" method for all browsers\r\n if (typeof MediaStream.prototype.stop === 'undefined') {\r\n MediaStream.prototype.stop = function() {\r\n this.getTracks().forEach(function(track) {\r\n track.stop();\r\n });\r\n };\r\n }\r\n }\r\n\r\n var Storage = {};\r\n\r\n if (typeof AudioContext !== 'undefined') {\r\n Storage.AudioContext = AudioContext;\r\n } else if (typeof webkitAudioContext !== 'undefined') {\r\n Storage.AudioContext = webkitAudioContext;\r\n }\r\n\r\n function setSrcObject(stream, element) {\r\n if ('srcObject' in element) {\r\n element.srcObject = stream;\r\n } else if ('mozSrcObject' in element) {\r\n element.mozSrcObject = stream;\r\n } else {\r\n element.srcObject = stream;\r\n }\r\n }\r\n\r\n this.startDrawingFrames = function() {\r\n drawVideosToCanvas();\r\n };\r\n\r\n function drawVideosToCanvas() {\r\n if (isStopDrawingFrames) {\r\n return;\r\n }\r\n\r\n var videosLength = videos.length;\r\n\r\n var fullcanvas = false;\r\n var remaining = [];\r\n videos.forEach(function(video) {\r\n if (!video.stream) {\r\n video.stream = {};\r\n }\r\n\r\n if (video.stream.fullcanvas) {\r\n fullcanvas = video;\r\n } else {\r\n // todo: video.stream.active or video.stream.live to fix blank frames issues?\r\n remaining.push(video);\r\n }\r\n });\r\n\r\n if (fullcanvas) {\r\n canvas.width = fullcanvas.stream.width;\r\n canvas.height = fullcanvas.stream.height;\r\n } else if (remaining.length) {\r\n canvas.width = videosLength > 1 ? remaining[0].width * 2 : remaining[0].width;\r\n\r\n var height = 1;\r\n if (videosLength === 3 || videosLength === 4) {\r\n height = 2;\r\n }\r\n if (videosLength === 5 || videosLength === 6) {\r\n height = 3;\r\n }\r\n if (videosLength === 7 || videosLength === 8) {\r\n height = 4;\r\n }\r\n if (videosLength === 9 || videosLength === 10) {\r\n height = 5;\r\n }\r\n canvas.height = remaining[0].height * height;\r\n } else {\r\n canvas.width = self.width || 360;\r\n canvas.height = self.height || 240;\r\n }\r\n\r\n if (fullcanvas && fullcanvas instanceof HTMLVideoElement) {\r\n drawImage(fullcanvas);\r\n }\r\n\r\n remaining.forEach(function(video, idx) {\r\n drawImage(video, idx);\r\n });\r\n\r\n setTimeout(drawVideosToCanvas, self.frameInterval);\r\n }\r\n\r\n function drawImage(video, idx) {\r\n if (isStopDrawingFrames) {\r\n return;\r\n }\r\n\r\n var x = 0;\r\n var y = 0;\r\n var width = video.width;\r\n var height = video.height;\r\n\r\n if (idx === 1) {\r\n x = video.width;\r\n }\r\n\r\n if (idx === 2) {\r\n y = video.height;\r\n }\r\n\r\n if (idx === 3) {\r\n x = video.width;\r\n y = video.height;\r\n }\r\n\r\n if (idx === 4) {\r\n y = video.height * 2;\r\n }\r\n\r\n if (idx === 5) {\r\n x = video.width;\r\n y = video.height * 2;\r\n }\r\n\r\n if (idx === 6) {\r\n y = video.height * 3;\r\n }\r\n\r\n if (idx === 7) {\r\n x = video.width;\r\n y = video.height * 3;\r\n }\r\n\r\n if (typeof video.stream.left !== 'undefined') {\r\n x = video.stream.left;\r\n }\r\n\r\n if (typeof video.stream.top !== 'undefined') {\r\n y = video.stream.top;\r\n }\r\n\r\n if (typeof video.stream.width !== 'undefined') {\r\n width = video.stream.width;\r\n }\r\n\r\n if (typeof video.stream.height !== 'undefined') {\r\n height = video.stream.height;\r\n }\r\n\r\n context.drawImage(video, x, y, width, height);\r\n\r\n if (typeof video.stream.onRender === 'function') {\r\n video.stream.onRender(context, x, y, width, height, idx);\r\n }\r\n }\r\n\r\n function getMixedStream() {\r\n isStopDrawingFrames = false;\r\n var mixedVideoStream = getMixedVideoStream();\r\n\r\n var mixedAudioStream = getMixedAudioStream();\r\n if (mixedAudioStream) {\r\n mixedAudioStream.getTracks().filter(function(t) {\r\n return t.kind === 'audio';\r\n }).forEach(function(track) {\r\n mixedVideoStream.addTrack(track);\r\n });\r\n }\r\n\r\n var fullcanvas;\r\n arrayOfMediaStreams.forEach(function(stream) {\r\n if (stream.fullcanvas) {\r\n fullcanvas = true;\r\n }\r\n });\r\n\r\n // mixedVideoStream.prototype.appendStreams = appendStreams;\r\n // mixedVideoStream.prototype.resetVideoStreams = resetVideoStreams;\r\n // mixedVideoStream.prototype.clearRecordedData = clearRecordedData;\r\n\r\n return mixedVideoStream;\r\n }\r\n\r\n function getMixedVideoStream() {\r\n resetVideoStreams();\r\n\r\n var capturedStream;\r\n\r\n if ('captureStream' in canvas) {\r\n capturedStream = canvas.captureStream();\r\n } else if ('mozCaptureStream' in canvas) {\r\n capturedStream = canvas.mozCaptureStream();\r\n } else if (!self.disableLogs) {\r\n console.error('Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features');\r\n }\r\n\r\n var videoStream = new MediaStream();\r\n\r\n capturedStream.getTracks().filter(function(t) {\r\n return t.kind === 'video';\r\n }).forEach(function(track) {\r\n videoStream.addTrack(track);\r\n });\r\n\r\n canvas.stream = videoStream;\r\n\r\n return videoStream;\r\n }\r\n\r\n function getMixedAudioStream() {\r\n // via: @pehrsons\r\n if (!Storage.AudioContextConstructor) {\r\n Storage.AudioContextConstructor = new Storage.AudioContext();\r\n }\r\n\r\n self.audioContext = Storage.AudioContextConstructor;\r\n\r\n self.audioSources = [];\r\n\r\n if (self.useGainNode === true) {\r\n self.gainNode = self.audioContext.createGain();\r\n self.gainNode.connect(self.audioContext.destination);\r\n self.gainNode.gain.value = 0; // don't hear self\r\n }\r\n\r\n var audioTracksLength = 0;\r\n arrayOfMediaStreams.forEach(function(stream) {\r\n if (!stream.getTracks().filter(function(t) {\r\n return t.kind === 'audio';\r\n }).length) {\r\n return;\r\n }\r\n\r\n audioTracksLength++;\r\n\r\n var audioSource = self.audioContext.createMediaStreamSource(stream);\r\n\r\n if (self.useGainNode === true) {\r\n audioSource.connect(self.gainNode);\r\n }\r\n\r\n self.audioSources.push(audioSource);\r\n });\r\n\r\n if (!audioTracksLength) {\r\n // because \"self.audioContext\" is not initialized\r\n // that's why we've to ignore rest of the code\r\n return;\r\n }\r\n\r\n self.audioDestination = self.audioContext.createMediaStreamDestination();\r\n self.audioSources.forEach(function(audioSource) {\r\n audioSource.connect(self.audioDestination);\r\n });\r\n return self.audioDestination.stream;\r\n }\r\n\r\n function getVideo(stream) {\r\n var video = document.createElement('video');\r\n\r\n setSrcObject(stream, video);\r\n\r\n video.className = elementClass;\r\n\r\n video.muted = true;\r\n video.volume = 0;\r\n\r\n video.width = stream.width || self.width || 360;\r\n video.height = stream.height || self.height || 240;\r\n\r\n video.play();\r\n\r\n return video;\r\n }\r\n\r\n this.appendStreams = function(streams) {\r\n if (!streams) {\r\n throw 'First parameter is required.';\r\n }\r\n\r\n if (!(streams instanceof Array)) {\r\n streams = [streams];\r\n }\r\n\r\n streams.forEach(function(stream) {\r\n var newStream = new MediaStream();\r\n\r\n if (stream.getTracks().filter(function(t) {\r\n return t.kind === 'video';\r\n }).length) {\r\n var video = getVideo(stream);\r\n video.stream = stream;\r\n videos.push(video);\r\n\r\n newStream.addTrack(stream.getTracks().filter(function(t) {\r\n return t.kind === 'video';\r\n })[0]);\r\n }\r\n\r\n if (stream.getTracks().filter(function(t) {\r\n return t.kind === 'audio';\r\n }).length) {\r\n var audioSource = self.audioContext.createMediaStreamSource(stream);\r\n self.audioDestination = self.audioContext.createMediaStreamDestination();\r\n audioSource.connect(self.audioDestination);\r\n\r\n newStream.addTrack(self.audioDestination.stream.getTracks().filter(function(t) {\r\n return t.kind === 'audio';\r\n })[0]);\r\n }\r\n\r\n arrayOfMediaStreams.push(newStream);\r\n });\r\n };\r\n\r\n this.releaseStreams = function() {\r\n videos = [];\r\n isStopDrawingFrames = true;\r\n\r\n if (self.gainNode) {\r\n self.gainNode.disconnect();\r\n self.gainNode = null;\r\n }\r\n\r\n if (self.audioSources.length) {\r\n self.audioSources.forEach(function(source) {\r\n source.disconnect();\r\n });\r\n self.audioSources = [];\r\n }\r\n\r\n if (self.audioDestination) {\r\n self.audioDestination.disconnect();\r\n self.audioDestination = null;\r\n }\r\n\r\n if (self.audioContext) {\r\n self.audioContext.close();\r\n }\r\n\r\n self.audioContext = null;\r\n\r\n context.clearRect(0, 0, canvas.width, canvas.height);\r\n\r\n if (canvas.stream) {\r\n canvas.stream.stop();\r\n canvas.stream = null;\r\n }\r\n };\r\n\r\n this.resetVideoStreams = function(streams) {\r\n if (streams && !(streams instanceof Array)) {\r\n streams = [streams];\r\n }\r\n\r\n resetVideoStreams(streams);\r\n };\r\n\r\n function resetVideoStreams(streams) {\r\n videos = [];\r\n streams = streams || arrayOfMediaStreams;\r\n\r\n // via: @adrian-ber\r\n streams.forEach(function(stream) {\r\n if (!stream.getTracks().filter(function(t) {\r\n return t.kind === 'video';\r\n }).length) {\r\n return;\r\n }\r\n\r\n var video = getVideo(stream);\r\n video.stream = stream;\r\n videos.push(video);\r\n });\r\n }\r\n\r\n // for debugging\r\n this.name = 'MultiStreamsMixer';\r\n this.toString = function() {\r\n return this.name;\r\n };\r\n\r\n this.getMixedStream = getMixedStream;\r\n\r\n}\r\n\r\nif (typeof RecordRTC === 'undefined') {\r\n if (typeof module !== 'undefined' /* && !!module.exports*/ ) {\r\n module.exports = MultiStreamsMixer;\r\n }\r\n\r\n if (typeof define === 'function' && define.amd) {\r\n define('MultiStreamsMixer', [], function() {\r\n return MultiStreamsMixer;\r\n });\r\n }\r\n}\n\r\n// ______________________\r\n// MultiStreamRecorder.js\r\n\r\n/*\r\n * Video conference recording, using captureStream API along with WebAudio and Canvas2D API.\r\n */\r\n\r\n/**\r\n * MultiStreamRecorder can record multiple videos in single container.\r\n * @summary Multi-videos recorder.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef MultiStreamRecorder\r\n * @class\r\n * @example\r\n * var options = {\r\n * mimeType: 'video/webm'\r\n * }\r\n * var recorder = new MultiStreamRecorder(ArrayOfMediaStreams, options);\r\n * recorder.record();\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n *\r\n * // or\r\n * var blob = recorder.blob;\r\n * });\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStreams} mediaStreams - Array of MediaStreams.\r\n * @param {object} config - {disableLogs:true, frameInterval: 1, mimeType: \"video/webm\"}\r\n */\r\n\r\nfunction MultiStreamRecorder(arrayOfMediaStreams, options) {\r\n arrayOfMediaStreams = arrayOfMediaStreams || [];\r\n var self = this;\r\n\r\n var mixer;\r\n var mediaRecorder;\r\n\r\n options = options || {\r\n elementClass: 'multi-streams-mixer',\r\n mimeType: 'video/webm',\r\n video: {\r\n width: 360,\r\n height: 240\r\n }\r\n };\r\n\r\n if (!options.frameInterval) {\r\n options.frameInterval = 10;\r\n }\r\n\r\n if (!options.video) {\r\n options.video = {};\r\n }\r\n\r\n if (!options.video.width) {\r\n options.video.width = 360;\r\n }\r\n\r\n if (!options.video.height) {\r\n options.video.height = 240;\r\n }\r\n\r\n /**\r\n * This method records all MediaStreams.\r\n * @method\r\n * @memberof MultiStreamRecorder\r\n * @example\r\n * recorder.record();\r\n */\r\n this.record = function() {\r\n // github/muaz-khan/MultiStreamsMixer\r\n mixer = new MultiStreamsMixer(arrayOfMediaStreams, options.elementClass || 'multi-streams-mixer');\r\n\r\n if (getAllVideoTracks().length) {\r\n mixer.frameInterval = options.frameInterval || 10;\r\n mixer.width = options.video.width || 360;\r\n mixer.height = options.video.height || 240;\r\n mixer.startDrawingFrames();\r\n }\r\n\r\n if (options.previewStream && typeof options.previewStream === 'function') {\r\n options.previewStream(mixer.getMixedStream());\r\n }\r\n\r\n // record using MediaRecorder API\r\n mediaRecorder = new MediaStreamRecorder(mixer.getMixedStream(), options);\r\n mediaRecorder.record();\r\n };\r\n\r\n function getAllVideoTracks() {\r\n var tracks = [];\r\n arrayOfMediaStreams.forEach(function(stream) {\r\n getTracks(stream, 'video').forEach(function(track) {\r\n tracks.push(track);\r\n });\r\n });\r\n return tracks;\r\n }\r\n\r\n /**\r\n * This method stops recording MediaStream.\r\n * @param {function} callback - Callback function, that is used to pass recorded blob back to the callee.\r\n * @method\r\n * @memberof MultiStreamRecorder\r\n * @example\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n */\r\n this.stop = function(callback) {\r\n if (!mediaRecorder) {\r\n return;\r\n }\r\n\r\n mediaRecorder.stop(function(blob) {\r\n self.blob = blob;\r\n\r\n callback(blob);\r\n\r\n self.clearRecordedData();\r\n });\r\n };\r\n\r\n /**\r\n * This method pauses the recording process.\r\n * @method\r\n * @memberof MultiStreamRecorder\r\n * @example\r\n * recorder.pause();\r\n */\r\n this.pause = function() {\r\n if (mediaRecorder) {\r\n mediaRecorder.pause();\r\n }\r\n };\r\n\r\n /**\r\n * This method resumes the recording process.\r\n * @method\r\n * @memberof MultiStreamRecorder\r\n * @example\r\n * recorder.resume();\r\n */\r\n this.resume = function() {\r\n if (mediaRecorder) {\r\n mediaRecorder.resume();\r\n }\r\n };\r\n\r\n /**\r\n * This method resets currently recorded data.\r\n * @method\r\n * @memberof MultiStreamRecorder\r\n * @example\r\n * recorder.clearRecordedData();\r\n */\r\n this.clearRecordedData = function() {\r\n if (mediaRecorder) {\r\n mediaRecorder.clearRecordedData();\r\n mediaRecorder = null;\r\n }\r\n\r\n if (mixer) {\r\n mixer.releaseStreams();\r\n mixer = null;\r\n }\r\n };\r\n\r\n /**\r\n * Add extra media-streams to existing recordings.\r\n * @method\r\n * @memberof MultiStreamRecorder\r\n * @param {MediaStreams} mediaStreams - Array of MediaStreams\r\n * @example\r\n * recorder.addStreams([newAudioStream, newVideoStream]);\r\n */\r\n this.addStreams = function(streams) {\r\n if (!streams) {\r\n throw 'First parameter is required.';\r\n }\r\n\r\n if (!(streams instanceof Array)) {\r\n streams = [streams];\r\n }\r\n\r\n arrayOfMediaStreams.concat(streams);\r\n\r\n if (!mediaRecorder || !mixer) {\r\n return;\r\n }\r\n\r\n mixer.appendStreams(streams);\r\n\r\n if (options.previewStream && typeof options.previewStream === 'function') {\r\n options.previewStream(mixer.getMixedStream());\r\n }\r\n };\r\n\r\n /**\r\n * Reset videos during live recording. Replace old videos e.g. replace cameras with full-screen.\r\n * @method\r\n * @memberof MultiStreamRecorder\r\n * @param {MediaStreams} mediaStreams - Array of MediaStreams\r\n * @example\r\n * recorder.resetVideoStreams([newVideo1, newVideo2]);\r\n */\r\n this.resetVideoStreams = function(streams) {\r\n if (!mixer) {\r\n return;\r\n }\r\n\r\n if (streams && !(streams instanceof Array)) {\r\n streams = [streams];\r\n }\r\n\r\n mixer.resetVideoStreams(streams);\r\n };\r\n\r\n /**\r\n * Returns MultiStreamsMixer\r\n * @method\r\n * @memberof MultiStreamRecorder\r\n * @example\r\n * let mixer = recorder.getMixer();\r\n * mixer.appendStreams([newStream]);\r\n */\r\n this.getMixer = function() {\r\n return mixer;\r\n };\r\n\r\n // for debugging\r\n this.name = 'MultiStreamRecorder';\r\n this.toString = function() {\r\n return this.name;\r\n };\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.MultiStreamRecorder = MultiStreamRecorder;\r\n}\n\r\n// _____________________\r\n// RecordRTC.promises.js\r\n\r\n/**\r\n * RecordRTCPromisesHandler adds promises support in {@link RecordRTC}. Try a {@link https://github.com/muaz-khan/RecordRTC/blob/master/simple-demos/RecordRTCPromisesHandler.html|demo here}\r\n * @summary Promises for {@link RecordRTC}\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef RecordRTCPromisesHandler\r\n * @class\r\n * @example\r\n * var recorder = new RecordRTCPromisesHandler(mediaStream, options);\r\n * recorder.startRecording()\r\n * .then(successCB)\r\n * .catch(errorCB);\r\n * // Note: You can access all RecordRTC API using \"recorder.recordRTC\" e.g. \r\n * recorder.recordRTC.onStateChanged = function(state) {};\r\n * recorder.recordRTC.setRecordingDuration(5000);\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - Single media-stream object, array of media-streams, html-canvas-element, etc.\r\n * @param {object} config - {type:\"video\", recorderType: MediaStreamRecorder, disableLogs: true, numberOfAudioChannels: 1, bufferSize: 0, sampleRate: 0, video: HTMLVideoElement, etc.}\r\n * @throws Will throw an error if \"new\" keyword is not used to initiate \"RecordRTCPromisesHandler\". Also throws error if first argument \"MediaStream\" is missing.\r\n * @requires {@link RecordRTC}\r\n */\r\n\r\nfunction RecordRTCPromisesHandler(mediaStream, options) {\r\n if (!this) {\r\n throw 'Use \"new RecordRTCPromisesHandler()\"';\r\n }\r\n\r\n if (typeof mediaStream === 'undefined') {\r\n throw 'First argument \"MediaStream\" is required.';\r\n }\r\n\r\n var self = this;\r\n\r\n /**\r\n * @property {Blob} blob - Access/reach the native {@link RecordRTC} object.\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * let internal = recorder.recordRTC.getInternalRecorder();\r\n * alert(internal instanceof MediaStreamRecorder);\r\n * recorder.recordRTC.onStateChanged = function(state) {};\r\n */\r\n self.recordRTC = new RecordRTC(mediaStream, options);\r\n\r\n /**\r\n * This method records MediaStream.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * recorder.startRecording()\r\n * .then(successCB)\r\n * .catch(errorCB);\r\n */\r\n this.startRecording = function() {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n self.recordRTC.startRecording();\r\n resolve();\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * This method stops the recording.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * recorder.stopRecording().then(function() {\r\n * var blob = recorder.getBlob();\r\n * }).catch(errorCB);\r\n */\r\n this.stopRecording = function() {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n self.recordRTC.stopRecording(function(url) {\r\n self.blob = self.recordRTC.getBlob();\r\n\r\n if (!self.blob || !self.blob.size) {\r\n reject('Empty blob.', self.blob);\r\n return;\r\n }\r\n\r\n resolve(url);\r\n });\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * This method pauses the recording. You can resume recording using \"resumeRecording\" method.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * recorder.pauseRecording()\r\n * .then(successCB)\r\n * .catch(errorCB);\r\n */\r\n this.pauseRecording = function() {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n self.recordRTC.pauseRecording();\r\n resolve();\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * This method resumes the recording.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * recorder.resumeRecording()\r\n * .then(successCB)\r\n * .catch(errorCB);\r\n */\r\n this.resumeRecording = function() {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n self.recordRTC.resumeRecording();\r\n resolve();\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * This method returns data-url for the recorded blob.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * recorder.stopRecording().then(function() {\r\n * recorder.getDataURL().then(function(dataURL) {\r\n * window.open(dataURL);\r\n * }).catch(errorCB);;\r\n * }).catch(errorCB);\r\n */\r\n this.getDataURL = function(callback) {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n self.recordRTC.getDataURL(function(dataURL) {\r\n resolve(dataURL);\r\n });\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * This method returns the recorded blob.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * recorder.stopRecording().then(function() {\r\n * recorder.getBlob().then(function(blob) {})\r\n * }).catch(errorCB);\r\n */\r\n this.getBlob = function() {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n resolve(self.recordRTC.getBlob());\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * This method returns the internal recording object.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * let internalRecorder = await recorder.getInternalRecorder();\r\n * if(internalRecorder instanceof MultiStreamRecorder) {\r\n * internalRecorder.addStreams([newAudioStream]);\r\n * internalRecorder.resetVideoStreams([screenStream]);\r\n * }\r\n * @returns {Object} \r\n */\r\n this.getInternalRecorder = function() {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n resolve(self.recordRTC.getInternalRecorder());\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * This method resets the recorder. So that you can reuse single recorder instance many times.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * await recorder.reset();\r\n * recorder.startRecording(); // record again\r\n */\r\n this.reset = function() {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n resolve(self.recordRTC.reset());\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * Destroy RecordRTC instance. Clear all recorders and objects.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * recorder.destroy().then(successCB).catch(errorCB);\r\n */\r\n this.destroy = function() {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n resolve(self.recordRTC.destroy());\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * Get recorder's readonly state.\r\n * @method\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * let state = await recorder.getState();\r\n * // or\r\n * recorder.getState().then(state => { console.log(state); })\r\n * @returns {String} Returns recording state.\r\n */\r\n this.getState = function() {\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n resolve(self.recordRTC.getState());\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * @property {Blob} blob - Recorded data as \"Blob\" object.\r\n * @memberof RecordRTCPromisesHandler\r\n * @example\r\n * await recorder.stopRecording();\r\n * let blob = recorder.getBlob(); // or \"recorder.recordRTC.blob\"\r\n * invokeSaveAsDialog(blob);\r\n */\r\n this.blob = null;\r\n\r\n /**\r\n * RecordRTC version number\r\n * @property {String} version - Release version number.\r\n * @memberof RecordRTCPromisesHandler\r\n * @static\r\n * @readonly\r\n * @example\r\n * alert(recorder.version);\r\n */\r\n this.version = '5.6.2';\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.RecordRTCPromisesHandler = RecordRTCPromisesHandler;\r\n}\n\r\n// ______________________\r\n// WebAssemblyRecorder.js\r\n\r\n/**\r\n * WebAssemblyRecorder lets you create webm videos in JavaScript via WebAssembly. The library consumes raw RGBA32 buffers (4 bytes per pixel) and turns them into a webm video with the given framerate and quality. This makes it compatible out-of-the-box with ImageData from a CANVAS. With realtime mode you can also use webm-wasm for streaming webm videos.\r\n * @summary Video recording feature in Chrome, Firefox and maybe Edge.\r\n * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT}\r\n * @author {@link https://MuazKhan.com|Muaz Khan}\r\n * @typedef WebAssemblyRecorder\r\n * @class\r\n * @example\r\n * var recorder = new WebAssemblyRecorder(mediaStream);\r\n * recorder.record();\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code}\r\n * @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.\r\n * @param {object} config - {webAssemblyPath:'webm-wasm.wasm',workerPath: 'webm-worker.js', frameRate: 30, width: 1920, height: 1080, bitrate: 1024, realtime: true}\r\n */\r\nfunction WebAssemblyRecorder(stream, config) {\r\n // based on: github.com/GoogleChromeLabs/webm-wasm\r\n\r\n if (typeof ReadableStream === 'undefined' || typeof WritableStream === 'undefined') {\r\n // because it fixes readable/writable streams issues\r\n console.error('Following polyfill is strongly recommended: https://unpkg.com/@mattiasbuelens/web-streams-polyfill/dist/polyfill.min.js');\r\n }\r\n\r\n config = config || {};\r\n\r\n config.width = config.width || 640;\r\n config.height = config.height || 480;\r\n config.frameRate = config.frameRate || 30;\r\n config.bitrate = config.bitrate || 1200;\r\n config.realtime = config.realtime || true;\r\n\r\n function createBufferURL(buffer, type) {\r\n return URL.createObjectURL(new Blob([buffer], {\r\n type: type || ''\r\n }));\r\n }\r\n\r\n var finished;\r\n\r\n function cameraStream() {\r\n return new ReadableStream({\r\n start: function(controller) {\r\n var cvs = document.createElement('canvas');\r\n var video = document.createElement('video');\r\n var first = true;\r\n video.srcObject = stream;\r\n video.muted = true;\r\n video.height = config.height;\r\n video.width = config.width;\r\n video.volume = 0;\r\n video.onplaying = function() {\r\n cvs.width = config.width;\r\n cvs.height = config.height;\r\n var ctx = cvs.getContext('2d');\r\n var frameTimeout = 1000 / config.frameRate;\r\n var cameraTimer = setInterval(function f() {\r\n if (finished) {\r\n clearInterval(cameraTimer);\r\n controller.close();\r\n }\r\n\r\n if (first) {\r\n first = false;\r\n if (config.onVideoProcessStarted) {\r\n config.onVideoProcessStarted();\r\n }\r\n }\r\n\r\n ctx.drawImage(video, 0, 0);\r\n if (controller._controlledReadableStream.state !== 'closed') {\r\n try {\r\n controller.enqueue(\r\n ctx.getImageData(0, 0, config.width, config.height)\r\n );\r\n } catch (e) {}\r\n }\r\n }, frameTimeout);\r\n };\r\n video.play();\r\n }\r\n });\r\n }\r\n\r\n var worker;\r\n\r\n function startRecording(stream, buffer) {\r\n if (!config.workerPath && !buffer) {\r\n finished = false;\r\n\r\n // is it safe to use @latest ?\r\n\r\n fetch(\r\n 'https://unpkg.com/webm-wasm@latest/dist/webm-worker.js'\r\n ).then(function(r) {\r\n r.arrayBuffer().then(function(buffer) {\r\n startRecording(stream, buffer);\r\n });\r\n });\r\n return;\r\n }\r\n\r\n if (!config.workerPath && buffer instanceof ArrayBuffer) {\r\n var blob = new Blob([buffer], {\r\n type: 'text/javascript'\r\n });\r\n config.workerPath = URL.createObjectURL(blob);\r\n }\r\n\r\n if (!config.workerPath) {\r\n console.error('workerPath parameter is missing.');\r\n }\r\n\r\n worker = new Worker(config.workerPath);\r\n\r\n worker.postMessage(config.webAssemblyPath || 'https://unpkg.com/webm-wasm@latest/dist/webm-wasm.wasm');\r\n worker.addEventListener('message', function(event) {\r\n if (event.data === 'READY') {\r\n worker.postMessage({\r\n width: config.width,\r\n height: config.height,\r\n bitrate: config.bitrate || 1200,\r\n timebaseDen: config.frameRate || 30,\r\n realtime: config.realtime\r\n });\r\n\r\n cameraStream().pipeTo(new WritableStream({\r\n write: function(image) {\r\n if (finished) {\r\n console.error('Got image, but recorder is finished!');\r\n return;\r\n }\r\n\r\n worker.postMessage(image.data.buffer, [image.data.buffer]);\r\n }\r\n }));\r\n } else if (!!event.data) {\r\n if (!isPaused) {\r\n arrayOfBuffers.push(event.data);\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * This method records video.\r\n * @method\r\n * @memberof WebAssemblyRecorder\r\n * @example\r\n * recorder.record();\r\n */\r\n this.record = function() {\r\n arrayOfBuffers = [];\r\n isPaused = false;\r\n this.blob = null;\r\n startRecording(stream);\r\n\r\n if (typeof config.initCallback === 'function') {\r\n config.initCallback();\r\n }\r\n };\r\n\r\n var isPaused;\r\n\r\n /**\r\n * This method pauses the recording process.\r\n * @method\r\n * @memberof WebAssemblyRecorder\r\n * @example\r\n * recorder.pause();\r\n */\r\n this.pause = function() {\r\n isPaused = true;\r\n };\r\n\r\n /**\r\n * This method resumes the recording process.\r\n * @method\r\n * @memberof WebAssemblyRecorder\r\n * @example\r\n * recorder.resume();\r\n */\r\n this.resume = function() {\r\n isPaused = false;\r\n };\r\n\r\n function terminate(callback) {\r\n if (!worker) {\r\n if (callback) {\r\n callback();\r\n }\r\n\r\n return;\r\n }\r\n\r\n // Wait for null event data to indicate that the encoding is complete\r\n worker.addEventListener('message', function(event) {\r\n if (event.data === null) {\r\n worker.terminate();\r\n worker = null;\r\n\r\n if (callback) {\r\n callback();\r\n }\r\n }\r\n });\r\n\r\n worker.postMessage(null);\r\n }\r\n\r\n var arrayOfBuffers = [];\r\n\r\n /**\r\n * This method stops recording video.\r\n * @param {function} callback - Callback function, that is used to pass recorded blob back to the callee.\r\n * @method\r\n * @memberof WebAssemblyRecorder\r\n * @example\r\n * recorder.stop(function(blob) {\r\n * video.src = URL.createObjectURL(blob);\r\n * });\r\n */\r\n this.stop = function(callback) {\r\n finished = true;\r\n\r\n var recorder = this;\r\n\r\n terminate(function() {\r\n recorder.blob = new Blob(arrayOfBuffers, {\r\n type: 'video/webm'\r\n });\r\n\r\n callback(recorder.blob);\r\n });\r\n };\r\n\r\n // for debugging\r\n this.name = 'WebAssemblyRecorder';\r\n this.toString = function() {\r\n return this.name;\r\n };\r\n\r\n /**\r\n * This method resets currently recorded data.\r\n * @method\r\n * @memberof WebAssemblyRecorder\r\n * @example\r\n * recorder.clearRecordedData();\r\n */\r\n this.clearRecordedData = function() {\r\n arrayOfBuffers = [];\r\n isPaused = false;\r\n this.blob = null;\r\n\r\n // todo: if recording-ON then STOP it first\r\n };\r\n\r\n /**\r\n * @property {Blob} blob - The recorded blob object.\r\n * @memberof WebAssemblyRecorder\r\n * @example\r\n * recorder.stop(function(){\r\n * var blob = recorder.blob;\r\n * });\r\n */\r\n this.blob = null;\r\n}\r\n\r\nif (typeof RecordRTC !== 'undefined') {\r\n RecordRTC.WebAssemblyRecorder = WebAssemblyRecorder;\r\n}\n","import {downloadRecord, now} from \"../utils\";\nimport saveAs from \"../utils/file-save\";\nimport RecordRTC from 'recordrtc';\nimport {EVENTS, FILE_SUFFIX} from \"../constant\";\nimport Emitter from \"../utils/emitter\";\n\nexport default class RecordRTCLoader extends Emitter {\n constructor(player) {\n super();\n this.player = player;\n this.fileName = '';\n this.fileType = player._opt.recordType || FILE_SUFFIX.webm;\n this.isRecording = false;\n this.recordingTimestamp = 0;\n this.recordingInterval = null;\n player.debug.log('Recorder', 'init');\n }\n\n destroy() {\n this._reset();\n this.player.debug.log('Recorder', 'destroy');\n }\n\n setFileName(fileName, fileType) {\n this.fileName = fileName;\n\n if (FILE_SUFFIX.mp4 === fileType || FILE_SUFFIX.webm === fileType) {\n this.fileType = fileType;\n }\n }\n\n get recording() {\n return this.isRecording;\n }\n\n get recordTime() {\n return this.recordingTimestamp;\n }\n\n startRecord() {\n const debug = this.player.debug;\n const options = {\n type: 'video',\n mimeType: 'video/webm;codecs=h264',\n onTimeStamp: (timestamp) => {\n debug.log('Recorder', 'record timestamp :' + timestamp);\n },\n disableLogs: !this.player._opt.debug\n }\n\n try {\n const stream = this.player.video.$videoElement.captureStream(25);\n if (this.player.audio && this.player.audio.mediaStreamAudioDestinationNode &&\n this.player.audio.mediaStreamAudioDestinationNode.stream &&\n !this.player.audio.isStateSuspended() &&\n this.player.audio.hasAudio && this.player._opt.hasAudio) {\n const audioStream = this.player.audio.mediaStreamAudioDestinationNode.stream;\n if (audioStream.getAudioTracks().length > 0) {\n const audioTrack = audioStream.getAudioTracks()[0];\n if (audioTrack && audioTrack.enabled) {\n stream.addTrack(audioTrack);\n }\n }\n }\n this.recorder = RecordRTC(stream, options);\n } catch (e) {\n debug.error('Recorder', 'startRecord error', e);\n this.emit(EVENTS.recordCreateError);\n }\n if (this.recorder) {\n this.isRecording = true;\n this.player.emit(EVENTS.recording, true);\n this.recorder.startRecording();\n debug.log('Recorder', 'start recording');\n this.player.emit(EVENTS.recordStart);\n this.recordingInterval = window.setInterval(() => {\n this.recordingTimestamp += 1;\n this.player.emit(EVENTS.recordingTimestamp, this.recordingTimestamp);\n }, 1000);\n }\n }\n\n stopRecordAndSave() {\n if (!this.recorder || !this.isRecording) {\n return;\n }\n this.recorder.stopRecording(() => {\n this.player.debug.log('Recorder', 'stop recording');\n this.player.emit(EVENTS.recordEnd)\n const fileName = (this.fileName || now()) + '.' + (this.fileType || FILE_SUFFIX.webm)\n saveAs(this.recorder.getBlob(), fileName)\n this._reset();\n this.player.emit(EVENTS.recording, false);\n })\n }\n\n _reset() {\n this.isRecording = false;\n this.recordingTimestamp = 0;\n\n if (this.recorder) {\n this.recorder.destroy();\n this.recorder = null;\n }\n this.fileName = null;\n if (this.recordingInterval) {\n clearInterval(this.recordingInterval);\n }\n this.recordingInterval = null;\n }\n\n\n}\n","import RecordRTCLoader from \"./recordRTCLoader\";\n\nexport default class Recorder {\n constructor(player) {\n const Loader = Recorder.getLoaderFactory();\n return new Loader(player);\n }\n\n static getLoaderFactory() {\n return RecordRTCLoader;\n }\n}\n","import {EVENTS, EVENTS_ERROR, MEDIA_TYPE, WASM_ERROR, WORKER_CMD_TYPE, WORKER_SEND_TYPE} from \"../constant\";\nimport {isWebglRenderSupport, now} from \"../utils\";\n\nexport default class DecoderWorker {\n constructor(player) {\n this.player = player;\n this.decoderWorker = new Worker(player._opt.decoder)\n this._initDecoderWorker();\n player.debug.log('decoderWorker', 'init')\n }\n\n async destroy() {\n this.decoderWorker.postMessage({cmd: WORKER_SEND_TYPE.close})\n this.decoderWorker.terminate();\n this.decoderWorker = null;\n this.player.debug.log(`decoderWorker`, 'destroy');\n }\n\n _initDecoderWorker() {\n const {\n debug,\n events: {proxy},\n } = this.player;\n\n this.decoderWorker.onmessage = (event) => {\n const msg = event.data;\n switch (msg.cmd) {\n case WORKER_CMD_TYPE.init:\n debug.log(`decoderWorker`, 'onmessage:', WORKER_CMD_TYPE.init);\n if (!this.player.loaded) {\n this.player.emit(EVENTS.load);\n }\n this.player.emit(EVENTS.decoderWorkerInit);\n this._initWork();\n break;\n case WORKER_CMD_TYPE.videoCode:\n debug.log(`decoderWorker`, 'onmessage:', WORKER_CMD_TYPE.videoCode, msg.code);\n if (!this.player._times.decodeStart) {\n this.player._times.decodeStart = now();\n }\n this.player.video.updateVideoInfo({\n encTypeCode: msg.code\n })\n break;\n case WORKER_CMD_TYPE.audioCode:\n debug.log(`decoderWorker`, 'onmessage:', WORKER_CMD_TYPE.audioCode, msg.code);\n this.player.audio && this.player.audio.updateAudioInfo({\n encTypeCode: msg.code\n })\n break;\n case WORKER_CMD_TYPE.initVideo:\n debug.log(`decoderWorker`, 'onmessage:', WORKER_CMD_TYPE.initVideo, `width:${msg.w},height:${msg.h}`);\n this.player.video.updateVideoInfo({\n width: msg.w,\n height: msg.h\n })\n if (!this.player._opt.openWebglAlignment && !isWebglRenderSupport(msg.w)) {\n this.player.emit(EVENTS_ERROR.webglAlignmentError);\n return;\n }\n\n this.player.video.initCanvasViewSize();\n break;\n case WORKER_CMD_TYPE.initAudio:\n debug.log(`decoderWorker`, 'onmessage:', WORKER_CMD_TYPE.initAudio, `channels:${msg.channels},sampleRate:${msg.sampleRate}`);\n if (this.player.audio) {\n this.player.audio.updateAudioInfo(msg);\n this.player.audio.initScriptNode(msg);\n }\n break;\n case WORKER_CMD_TYPE.render:\n // debug.log(`decoderWorker`, 'onmessage:', WORKER_CMD_TYPE.render, `msg ts:${msg.ts}`);\n this.player.handleRender();\n this.player.video.render(msg);\n this.player.emit(EVENTS.timeUpdate, msg.ts)\n this.player.updateStats({fps: true, ts: msg.ts, buf: msg.delay})\n if (!this.player._times.videoStart) {\n this.player._times.videoStart = now();\n this.player.handlePlayToRenderTimes();\n }\n break;\n case WORKER_CMD_TYPE.playAudio:\n // debug.log(`decoderWorker`, 'onmessage:', WORKER_CMD_TYPE.playAudio, `msg ts:${msg.ts}`);\n // 只有在 playing 的时候。\n if (this.player.playing && this.player.audio) {\n this.player.audio.play(msg.buffer, msg.ts);\n }\n break;\n case WORKER_CMD_TYPE.wasmError:\n if (msg.message) {\n if (msg.message.indexOf(WASM_ERROR.invalidNalUnitSize) !== -1) {\n this.player.emitError(EVENTS_ERROR.wasmDecodeError);\n }\n }\n break;\n default:\n this.player[msg.cmd] && this.player[msg.cmd](msg);\n }\n }\n }\n\n _initWork() {\n const opt = {\n debug: this.player._opt.debug,\n useOffscreen: this.player._opt.useOffscreen,\n useWCS: this.player._opt.useWCS,\n videoBuffer: this.player._opt.videoBuffer,\n videoBufferDelay: this.player._opt.videoBufferDelay,\n openWebglAlignment: this.player._opt.openWebglAlignment\n }\n this.decoderWorker.postMessage({\n cmd: WORKER_SEND_TYPE.init,\n opt: JSON.stringify(opt),\n sampleRate: (this.player.audio && this.player.audio.audioContext.sampleRate) || 0\n })\n }\n\n decodeVideo(arrayBuffer, ts, isIFrame) {\n\n const options = {\n type: MEDIA_TYPE.video,\n ts: Math.max(ts, 0),\n isIFrame\n }\n // this.player.debug.log('decoderWorker', 'decodeVideo', options);\n this.decoderWorker.postMessage({\n cmd: WORKER_SEND_TYPE.decode,\n buffer: arrayBuffer,\n options\n }, [arrayBuffer.buffer])\n }\n\n decodeAudio(arrayBuffer, ts) {\n if (this.player._opt.useWCS) {\n this._decodeAudioNoDelay(arrayBuffer, ts);\n } else if (this.player._opt.useMSE) {\n this._decodeAudioNoDelay(arrayBuffer, ts);\n } else {\n this._decodeAudio(arrayBuffer, ts);\n }\n }\n\n //\n _decodeAudio(arrayBuffer, ts) {\n const options = {\n type: MEDIA_TYPE.audio,\n ts: Math.max(ts, 0)\n }\n // this.player.debug.log('decoderWorker', 'decodeAudio',options);\n this.decoderWorker.postMessage({\n cmd: WORKER_SEND_TYPE.decode,\n buffer: arrayBuffer,\n options\n }, [arrayBuffer.buffer])\n }\n\n\n _decodeAudioNoDelay(arrayBuffer, ts) {\n // console.log('_decodeAudioNoDelay', arrayBuffer);\n this.decoderWorker.postMessage({\n cmd: WORKER_SEND_TYPE.audioDecode,\n buffer: arrayBuffer,\n ts: Math.max(ts, 0)\n }, [arrayBuffer.buffer])\n }\n\n\n updateWorkConfig(config) {\n this.decoderWorker.postMessage({\n cmd: WORKER_SEND_TYPE.updateConfig,\n key: config.key,\n value: config.value\n })\n }\n\n}\n","import Emitter from \"../utils/emitter\";\nimport {FRAME_HEADER_EX, FRAME_TYPE_EX, MEDIA_TYPE, PACKET_TYPE_EX} from \"../constant\";\nimport {hevcEncoderNalePacketNotLength} from \"../utils\";\n\nexport default class CommonLoader extends Emitter {\n constructor(player) {\n super();\n this.player = player;\n\n this.stopId = null;\n this.firstTimestamp = null;\n this.startTimestamp = null;\n this.delay = -1;\n this.bufferList = [];\n this.dropping = false;\n this.initInterval();\n }\n\n destroy() {\n if (this.stopId) {\n clearInterval(this.stopId);\n this.stopId = null;\n }\n this.firstTimestamp = null;\n this.startTimestamp = null;\n this.delay = -1;\n this.bufferList = [];\n this.dropping = false;\n this.off();\n this.player.debug.log('CommonDemux', 'destroy');\n }\n\n getDelay(timestamp) {\n if (!timestamp) {\n return -1\n }\n if (!this.firstTimestamp) {\n this.firstTimestamp = timestamp\n this.startTimestamp = Date.now()\n this.delay = -1;\n } else {\n if (timestamp) {\n const localTimestamp = (Date.now() - this.startTimestamp);\n const timeTimestamp = (timestamp - this.firstTimestamp);\n if (localTimestamp >= timeTimestamp) {\n this.delay = localTimestamp - timeTimestamp;\n } else {\n this.delay = timeTimestamp - localTimestamp;\n }\n }\n }\n return this.delay\n }\n\n resetDelay() {\n this.firstTimestamp = null;\n this.startTimestamp = null;\n this.delay = -1;\n this.dropping = false;\n }\n\n //\n initInterval() {\n this.player.debug.log('common dumex', `init Interval`);\n let _loop = () => {\n let data;\n const videoBuffer = this.player._opt.videoBuffer;\n const videoBufferDelay = this.player._opt.videoBufferDelay;\n\n if (this.player._opt.useMSE &&\n this.player.mseDecoder &&\n this.player.mseDecoder.getSourceBufferUpdating()) {\n this.player.debug.warn('CommonDemux', `_loop getSourceBufferUpdating is true and bufferList length is ${this.bufferList.length}`);\n return;\n }\n\n if (this.bufferList.length) {\n if (this.dropping) {\n // this.player.debug.log('common dumex', `is dropping`);\n data = this.bufferList.shift();\n if (data.type === MEDIA_TYPE.audio && data.payload[1] === 0) {\n this._doDecoderDecode(data);\n }\n while (!data.isIFrame && this.bufferList.length) {\n data = this.bufferList.shift();\n if (data.type === MEDIA_TYPE.audio && data.payload[1] === 0) {\n this._doDecoderDecode(data);\n }\n }\n // i frame\n if (data.isIFrame && this.getDelay(data.ts) <= Math.min(videoBuffer, 200)) {\n this.dropping = false;\n this._doDecoderDecode(data);\n }\n } else {\n data = this.bufferList[0];\n if (this.getDelay(data.ts) === -1) {\n // this.player.debug.log('common dumex', `delay is -1`);\n this.bufferList.shift()\n this._doDecoderDecode(data);\n } else if (this.delay > (videoBuffer + videoBufferDelay)) {\n // this.player.debug.log('common dumex', `delay is ${this.delay}, set dropping is true`);\n this.resetDelay();\n this.dropping = true\n } else {\n data = this.bufferList[0]\n if (this.getDelay(data.ts) > videoBuffer) {\n // drop frame\n this.bufferList.shift()\n this._doDecoderDecode(data);\n } else {\n // this.player.debug.log('common dumex', `delay is ${this.delay}`);\n }\n }\n }\n }\n }\n _loop();\n this.stopId = setInterval(_loop, 10)\n }\n\n _doDecode(payload, type, ts, isIFrame, cts) {\n const player = this.player;\n let options = {\n ts: ts,\n cts: cts,\n type: type,\n isIFrame: false\n }\n // use offscreen\n if (player._opt.useWCS && !player._opt.useOffscreen) {\n if (type === MEDIA_TYPE.video) {\n options.isIFrame = isIFrame;\n }\n this.pushBuffer(payload, options)\n } else if (player._opt.useMSE) {\n // use mse\n if (type === MEDIA_TYPE.video) {\n options.isIFrame = isIFrame;\n }\n this.pushBuffer(payload, options)\n } else {\n //\n if (type === MEDIA_TYPE.video) {\n player.decoderWorker && player.decoderWorker.decodeVideo(payload, ts, isIFrame);\n } else if (type === MEDIA_TYPE.audio) {\n if (player._opt.hasAudio) {\n player.decoderWorker && player.decoderWorker.decodeAudio(payload, ts);\n }\n }\n }\n }\n\n _doDecoderDecode(data) {\n const player = this.player;\n const {webcodecsDecoder, mseDecoder} = player;\n\n if (data.type === MEDIA_TYPE.audio) {\n if (player._opt.hasAudio) {\n player.decoderWorker && player.decoderWorker.decodeAudio(data.payload, data.ts)\n }\n } else if (data.type === MEDIA_TYPE.video) {\n if (player._opt.useWCS && !player._opt.useOffscreen) {\n webcodecsDecoder.decodeVideo(data.payload, data.ts, data.isIFrame);\n } else if (player._opt.useMSE) {\n mseDecoder.decodeVideo(data.payload, data.ts, data.isIFrame, data.cts);\n }\n }\n }\n\n pushBuffer(payload, options) {\n // 音频\n if (options.type === MEDIA_TYPE.audio) {\n this.bufferList.push({\n ts: options.ts,\n payload: payload,\n type: MEDIA_TYPE.audio,\n })\n } else if (options.type === MEDIA_TYPE.video) {\n this.bufferList.push({\n ts: options.ts,\n cts: options.cts,\n payload: payload,\n type: MEDIA_TYPE.video,\n isIFrame: options.isIFrame\n })\n }\n }\n\n close() {\n\n }\n\n _decodeEnhancedH265Video(payload, ts) {\n const flags = payload[0];\n const frameTypeEx = flags & 0x30;\n const packetEx = flags & 0x0F;\n const codecId = payload.slice(1, 5);\n const tmp = new ArrayBuffer(4);\n const tmp32 = new Uint32Array(tmp);\n const isAV1 = String.fromCharCode(codecId[0]) == 'a';\n if (packetEx === PACKET_TYPE_EX.PACKET_TYPE_SEQ_START) {\n if (frameTypeEx === FRAME_TYPE_EX.FT_KEY) {\n // header video info\n const extraData = payload.slice(5);\n if (!isAV1) {\n const payloadBuffer = new Uint8Array(5 + extraData.length);\n payloadBuffer.set([0x1c, 0x00, 0x00, 0x00, 0x00], 0);\n payloadBuffer.set(extraData, 5);\n this._doDecode(payloadBuffer, MEDIA_TYPE.video, 0, true, 0);\n }\n }\n } else if (packetEx === PACKET_TYPE_EX.PACKET_TYPE_FRAMES) {\n let payloadBuffer = payload;\n let cts = 0;\n const isIFrame = frameTypeEx === FRAME_TYPE_EX.FT_KEY;\n\n if (!isAV1) {\n // h265\n tmp32[0] = payload[4]\n tmp32[1] = payload[3]\n tmp32[2] = payload[2]\n tmp32[3] = 0\n cts = tmp32[0];\n const data = payload.slice(8);\n payloadBuffer = hevcEncoderNalePacketNotLength(data, isIFrame);\n this._doDecode(payloadBuffer, MEDIA_TYPE.video, ts, isIFrame, cts);\n }\n\n } else if (packetEx === PACKET_TYPE_EX.PACKET_TYPE_FRAMESX) {\n const isIFrame = frameTypeEx === FRAME_TYPE_EX.FT_KEY;\n const data = payload.slice(5);\n let payloadBuffer = hevcEncoderNalePacketNotLength(data, isIFrame);\n this._doDecode(payloadBuffer, MEDIA_TYPE.video, ts, isIFrame, 0);\n }\n }\n\n\n _isEnhancedH265Header(flags) {\n return (flags & FRAME_HEADER_EX) === FRAME_HEADER_EX;\n }\n}\n","import {FLV_MEDIA_TYPE, MEDIA_TYPE} from \"../constant\";\nimport CommonLoader from \"./commonLoader\";\nimport {now} from \"../utils\";\n\nexport default class FlvLoader extends CommonLoader {\n constructor(player) {\n super(player);\n this.input = this._inputFlv();\n this.flvDemux = this.dispatchFlvData(this.input);\n player.debug.log('FlvDemux', 'init')\n }\n\n destroy() {\n super.destroy();\n this.input = null;\n this.flvDemux = null;\n this.player.debug.log('FlvDemux', 'destroy')\n }\n\n dispatch(data) {\n this.flvDemux(data);\n }\n\n * _inputFlv() {\n yield 9;\n const tmp = new ArrayBuffer(4)\n const tmp8 = new Uint8Array(tmp)\n const tmp32 = new Uint32Array(tmp)\n const player = this.player;\n\n while (true) {\n tmp8[3] = 0\n const t = yield 15\n const type = t[4]\n tmp8[0] = t[7]\n tmp8[1] = t[6]\n tmp8[2] = t[5]\n const length = tmp32[0]\n tmp8[0] = t[10]\n tmp8[1] = t[9]\n tmp8[2] = t[8]\n let ts = tmp32[0]\n if (ts === 0xFFFFFF) {\n tmp8[3] = t[11]\n ts = tmp32[0]\n }\n const payload = yield length\n switch (type) {\n case FLV_MEDIA_TYPE.audio:\n if (player._opt.hasAudio) {\n player.updateStats({\n abps: payload.byteLength\n })\n if (payload.byteLength > 0) {\n this._doDecode(payload, MEDIA_TYPE.audio, ts)\n }\n }\n break\n case FLV_MEDIA_TYPE.video:\n if (!player._times.demuxStart) {\n player._times.demuxStart = now();\n }\n if (player._opt.hasVideo) {\n player.updateStats({\n vbps: payload.byteLength\n })\n const flags = payload[0];\n if (this._isEnhancedH265Header(flags)) {\n this._decodeEnhancedH265Video(payload, ts);\n } else {\n const isIFrame = payload[0] >> 4 === 1;\n if (payload.byteLength > 0) {\n tmp32[0] = payload[4]\n tmp32[1] = payload[3]\n tmp32[2] = payload[2]\n tmp32[3] = 0\n let cts = tmp32[0]\n this._doDecode(payload, MEDIA_TYPE.video, ts, isIFrame, cts);\n }\n }\n }\n break\n }\n }\n }\n\n dispatchFlvData(input) {\n let need = input.next()\n let buffer = null\n return (value) => {\n let data = new Uint8Array(value)\n if (buffer) {\n let combine = new Uint8Array(buffer.length + data.length)\n combine.set(buffer)\n combine.set(data, buffer.length)\n data = combine\n buffer = null\n }\n while (data.length >= need.value) {\n let remain = data.slice(need.value)\n need = input.next(data.slice(0, need.value))\n data = remain\n }\n if (data.length > 0) {\n buffer = data\n }\n }\n }\n\n close() {\n this.input && this.input.return(null)\n }\n\n\n}\n","import {FLV_MEDIA_TYPE, MEDIA_TYPE} from \"../constant\";\nimport CommonLoader from \"./commonLoader\";\nimport {now} from \"../utils\";\n\nexport default class M7sLoader extends CommonLoader {\n constructor(player) {\n super(player);\n player.debug.log('M7sDemux', 'init')\n }\n\n destroy() {\n super.destroy();\n this.player.debug.log('M7sDemux', 'destroy')\n this.player = null;\n }\n\n dispatch(data) {\n const player = this.player;\n const dv = new DataView(data)\n const type = dv.getUint8(0);\n const ts = dv.getUint32(1, false);\n const tmp = new ArrayBuffer(4);\n const tmp32 = new Uint32Array(tmp);\n switch (type) {\n case MEDIA_TYPE.audio:\n if (player._opt.hasAudio) {\n const payload = new Uint8Array(data, 5)\n player.updateStats({\n abps: payload.byteLength\n })\n if (payload.byteLength > 0) {\n this._doDecode(payload, type, ts)\n }\n }\n break;\n case MEDIA_TYPE.video:\n if (player._opt.hasVideo) {\n if (!player._times.demuxStart) {\n player._times.demuxStart = now();\n }\n if (dv.byteLength > 5) {\n const payload = new Uint8Array(data, 5);\n\n const flags = payload[0];\n if (this._isEnhancedH265Header(flags)) {\n this._decodeEnhancedH265Video(payload, ts);\n } else {\n const isIframe = dv.getUint8(5) >> 4 === 1;\n player.updateStats({\n vbps: payload.byteLength\n })\n\n tmp32[0] = payload[4]\n tmp32[1] = payload[3]\n tmp32[2] = payload[2]\n tmp32[3] = 0\n let cts = tmp32[0]\n this._doDecode(payload, type, ts, isIframe, cts);\n }\n } else {\n this.player.debug.warn('M7sDemux', 'dispatch', 'dv byteLength is', dv.byteLength)\n }\n }\n break;\n }\n }\n\n\n}\n","import FlvLoader from \"./flvLoader\";\nimport M7sLoader from \"./m7sLoader\";\nimport {DEMUX_TYPE} from \"../constant\";\n\nexport default class Demux {\n constructor(player) {\n const Loader = Demux.getLoaderFactory(player._opt.demuxType);\n return new Loader(player);\n }\n\n static getLoaderFactory(type) {\n if (type === DEMUX_TYPE.m7s) {\n return M7sLoader;\n } else if (type === DEMUX_TYPE.flv) {\n return FlvLoader;\n }\n }\n}\n","/*\n * Copyright (C) 2016 Bilibili. All Rights Reserved.\n *\n * @author zheng qian \n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n// Exponential-Golomb buffer decoder\nclass ExpGolomb {\n\n constructor(uint8array) {\n this.TAG = 'ExpGolomb';\n\n this._buffer = uint8array;\n this._buffer_index = 0;\n this._total_bytes = uint8array.byteLength;\n this._total_bits = uint8array.byteLength * 8;\n this._current_word = 0;\n this._current_word_bits_left = 0;\n }\n\n destroy() {\n this._buffer = null;\n }\n\n _fillCurrentWord() {\n let buffer_bytes_left = this._total_bytes - this._buffer_index;\n if (buffer_bytes_left <= 0) {\n // throw new IllegalStateException('ExpGolomb: _fillCurrentWord() but no bytes available');\n }\n\n let bytes_read = Math.min(4, buffer_bytes_left);\n let word = new Uint8Array(4);\n word.set(this._buffer.subarray(this._buffer_index, this._buffer_index + bytes_read));\n this._current_word = new DataView(word.buffer).getUint32(0, false);\n\n this._buffer_index += bytes_read;\n this._current_word_bits_left = bytes_read * 8;\n }\n\n readBits(bits) {\n if (bits > 32) {\n // throw new InvalidArgumentException('ExpGolomb: readBits() bits exceeded max 32bits!');\n }\n\n if (bits <= this._current_word_bits_left) {\n let result = this._current_word >>> (32 - bits);\n this._current_word <<= bits;\n this._current_word_bits_left -= bits;\n return result;\n }\n\n let result = this._current_word_bits_left ? this._current_word : 0;\n result = result >>> (32 - this._current_word_bits_left);\n let bits_need_left = bits - this._current_word_bits_left;\n\n this._fillCurrentWord();\n let bits_read_next = Math.min(bits_need_left, this._current_word_bits_left);\n\n let result2 = this._current_word >>> (32 - bits_read_next);\n this._current_word <<= bits_read_next;\n this._current_word_bits_left -= bits_read_next;\n\n result = (result << bits_read_next) | result2;\n return result;\n }\n\n readBool() {\n return this.readBits(1) === 1;\n }\n\n readByte() {\n return this.readBits(8);\n }\n\n _skipLeadingZero() {\n let zero_count;\n for (zero_count = 0; zero_count < this._current_word_bits_left; zero_count++) {\n if (0 !== (this._current_word & (0x80000000 >>> zero_count))) {\n this._current_word <<= zero_count;\n this._current_word_bits_left -= zero_count;\n return zero_count;\n }\n }\n this._fillCurrentWord();\n return zero_count + this._skipLeadingZero();\n }\n\n readUEG() { // unsigned exponential golomb\n let leading_zeros = this._skipLeadingZero();\n return this.readBits(leading_zeros + 1) - 1;\n }\n\n readSEG() { // signed exponential golomb\n let value = this.readUEG();\n if (value & 0x01) {\n return (value + 1) >>> 1;\n } else {\n return -1 * (value >>> 1);\n }\n }\n\n}\n\nexport default ExpGolomb;\n","/*\n * Copyright (C) 2016 Bilibili. All Rights Reserved.\n *\n * @author zheng qian \n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport ExpGolomb from './exp-golomb.js';\n\nclass SPSParser {\n\n static _ebsp2rbsp(uint8array) {\n let src = uint8array;\n let src_length = src.byteLength;\n let dst = new Uint8Array(src_length);\n let dst_idx = 0;\n\n for (let i = 0; i < src_length; i++) {\n if (i >= 2) {\n // Unescape: Skip 0x03 after 00 00\n if (src[i] === 0x03 && src[i - 1] === 0x00 && src[i - 2] === 0x00) {\n continue;\n }\n }\n dst[dst_idx] = src[i];\n dst_idx++;\n }\n\n return new Uint8Array(dst.buffer, 0, dst_idx);\n }\n\n // 解析 SPS\n // https://zhuanlan.zhihu.com/p/27896239\n static parseSPS(uint8array) {\n let rbsp = SPSParser._ebsp2rbsp(uint8array);\n let gb = new ExpGolomb(rbsp);\n\n gb.readByte();\n // 标识当前H.264码流的profile。\n // 我们知道,H.264中定义了三种常用的档次profile: 基准档次:baseline profile;主要档次:main profile; 扩展档次:extended profile;\n\n let profile_idc = gb.readByte(); // profile_idc\n gb.readByte(); // constraint_set_flags[5] + reserved_zero[3]\n // 标识当前码流的Level。编码的Level定义了某种条件下的最大视频分辨率、最大视频帧率等参数,码流所遵从的level由level_idc指定。\n let level_idc = gb.readByte(); // level_idc\n // 表示当前的序列参数集的id。通过该id值,图像参数集pps可以引用其代表的sps中的参数。\n gb.readUEG(); // seq_parameter_set_id\n\n let profile_string = SPSParser.getProfileString(profile_idc);\n\n let level_string = SPSParser.getLevelString(level_idc);\n\n let chroma_format_idc = 1;\n let chroma_format = 420;\n let chroma_format_table = [0, 420, 422, 444];\n let bit_depth = 8;\n\n //\n if (profile_idc === 100 || profile_idc === 110 || profile_idc === 122 ||\n profile_idc === 244 || profile_idc === 44 || profile_idc === 83 ||\n profile_idc === 86 || profile_idc === 118 || profile_idc === 128 ||\n profile_idc === 138 || profile_idc === 144) {\n //\n chroma_format_idc = gb.readUEG();\n\n if (chroma_format_idc === 3) {\n gb.readBits(1); // separate_colour_plane_flag\n }\n if (chroma_format_idc <= 3) {\n chroma_format = chroma_format_table[chroma_format_idc];\n }\n\n bit_depth = gb.readUEG() + 8; // bit_depth_luma_minus8\n gb.readUEG(); // bit_depth_chroma_minus8\n gb.readBits(1); // qpprime_y_zero_transform_bypass_flag\n if (gb.readBool()) { // seq_scaling_matrix_present_flag\n let scaling_list_count = (chroma_format_idc !== 3) ? 8 : 12;\n for (let i = 0; i < scaling_list_count; i++) {\n if (gb.readBool()) { // seq_scaling_list_present_flag\n if (i < 6) {\n SPSParser._skipScalingList(gb, 16);\n } else {\n SPSParser._skipScalingList(gb, 64);\n }\n }\n }\n }\n }\n // 用于计算MaxFrameNum的值。计算公式为MaxFrameNum = 2^(log2_max_frame_num_minus4 +\n gb.readUEG(); // log2_max_frame_num_minus4\n // 表示解码picture order count(POC)的方法。POC是另一种计量图像序号的方式,与frame_num有着不同的计算方法。该语法元素的取值为0、1或2。\n let pic_order_cnt_type = gb.readUEG();\n if (pic_order_cnt_type === 0) {\n gb.readUEG(); // log2_max_pic_order_cnt_lsb_minus_4\n } else if (pic_order_cnt_type === 1) {\n gb.readBits(1); // delta_pic_order_always_zero_flag\n gb.readSEG(); // offset_for_non_ref_pic\n gb.readSEG(); // offset_for_top_to_bottom_field\n let num_ref_frames_in_pic_order_cnt_cycle = gb.readUEG();\n for (let i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) {\n gb.readSEG(); // offset_for_ref_frame\n }\n }\n // 用于表示参考帧的最大数目。\n let ref_frames = gb.readUEG(); // max_num_ref_frames\n // 标识位,说明frame_num中是否允许不连续的值。\n gb.readBits(1); // gaps_in_frame_num_value_allowed_flag\n // 用于计算图像的宽度。单位为宏块个数,因此图像的实际宽度为:\n let pic_width_in_mbs_minus1 = gb.readUEG();\n // 使用PicHeightInMapUnits来度量视频中一帧图像的高度。\n // PicHeightInMapUnits并非图像明确的以像素或宏块为单位的高度,而需要考虑该宏块是帧编码或场编码。PicHeightInMapUnits的计算方式为:\n let pic_height_in_map_units_minus1 = gb.readUEG();\n // 标识位,说明宏块的编码方式。当该标识位为0时,宏块可能为帧编码或场编码;\n // 该标识位为1时,所有宏块都采用帧编码。根据该标识位取值不同,PicHeightInMapUnits的含义也不同,\n // 为0时表示一场数据按宏块计算的高度,为1时表示一帧数据按宏块计算的高度。\n let frame_mbs_only_flag = gb.readBits(1);\n if (frame_mbs_only_flag === 0) {\n // 标识位,说明是否采用了宏块级的帧场自适应编码。当该标识位为0时,不存在帧编码和场编码之间的切换;当标识位为1时,宏块可能在帧编码和场编码模式之间进行选择。\n gb.readBits(1); // mb_adaptive_frame_field_flag\n }\n // 标识位,用于B_Skip、B_Direct模式运动矢量的推导计算。\n gb.readBits(1); // direct_8x8_inference_flag\n\n let frame_crop_left_offset = 0;\n let frame_crop_right_offset = 0;\n let frame_crop_top_offset = 0;\n let frame_crop_bottom_offset = 0;\n\n let frame_cropping_flag = gb.readBool();\n if (frame_cropping_flag) {\n frame_crop_left_offset = gb.readUEG();\n frame_crop_right_offset = gb.readUEG();\n frame_crop_top_offset = gb.readUEG();\n frame_crop_bottom_offset = gb.readUEG();\n }\n\n let sar_width = 1, sar_height = 1;\n let fps = 0, fps_fixed = true, fps_num = 0, fps_den = 0;\n // 标识位,说明SPS中是否存在VUI信息。\n let vui_parameters_present_flag = gb.readBool();\n if (vui_parameters_present_flag) {\n if (gb.readBool()) { // aspect_ratio_info_present_flag\n let aspect_ratio_idc = gb.readByte();\n let sar_w_table = [1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160, 4, 3, 2];\n let sar_h_table = [1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99, 3, 2, 1];\n\n if (aspect_ratio_idc > 0 && aspect_ratio_idc < 16) {\n sar_width = sar_w_table[aspect_ratio_idc - 1];\n sar_height = sar_h_table[aspect_ratio_idc - 1];\n } else if (aspect_ratio_idc === 255) {\n sar_width = gb.readByte() << 8 | gb.readByte();\n sar_height = gb.readByte() << 8 | gb.readByte();\n }\n }\n\n if (gb.readBool()) { // overscan_info_present_flag\n gb.readBool(); // overscan_appropriate_flag\n }\n if (gb.readBool()) { // video_signal_type_present_flag\n gb.readBits(4); // video_format & video_full_range_flag\n if (gb.readBool()) { // colour_description_present_flag\n gb.readBits(24); // colour_primaries & transfer_characteristics & matrix_coefficients\n }\n }\n if (gb.readBool()) { // chroma_loc_info_present_flag\n gb.readUEG(); // chroma_sample_loc_type_top_field\n gb.readUEG(); // chroma_sample_loc_type_bottom_field\n }\n if (gb.readBool()) { // timing_info_present_flag\n let num_units_in_tick = gb.readBits(32);\n let time_scale = gb.readBits(32);\n fps_fixed = gb.readBool(); // fixed_frame_rate_flag\n\n fps_num = time_scale;\n fps_den = num_units_in_tick * 2;\n fps = fps_num / fps_den;\n }\n }\n\n let sarScale = 1;\n if (sar_width !== 1 || sar_height !== 1) {\n sarScale = sar_width / sar_height;\n }\n\n let crop_unit_x = 0, crop_unit_y = 0;\n if (chroma_format_idc === 0) {\n crop_unit_x = 1;\n crop_unit_y = 2 - frame_mbs_only_flag;\n } else {\n let sub_wc = (chroma_format_idc === 3) ? 1 : 2;\n let sub_hc = (chroma_format_idc === 1) ? 2 : 1;\n crop_unit_x = sub_wc;\n crop_unit_y = sub_hc * (2 - frame_mbs_only_flag);\n }\n\n let codec_width = (pic_width_in_mbs_minus1 + 1) * 16;\n let codec_height = (2 - frame_mbs_only_flag) * ((pic_height_in_map_units_minus1 + 1) * 16);\n\n codec_width -= (frame_crop_left_offset + frame_crop_right_offset) * crop_unit_x;\n codec_height -= (frame_crop_top_offset + frame_crop_bottom_offset) * crop_unit_y;\n\n let present_width = Math.ceil(codec_width * sarScale);\n\n gb.destroy();\n gb = null;\n\n\n // 解析出来的SPS 内容。\n return {\n profile_string: profile_string, // baseline, high, high10, ...\n level_string: level_string, // 3, 3.1, 4, 4.1, 5, 5.1, ...\n bit_depth: bit_depth, // 8bit, 10bit, ...\n ref_frames: ref_frames,\n chroma_format: chroma_format, // 4:2:0, 4:2:2, ...\n chroma_format_string: SPSParser.getChromaFormatString(chroma_format),\n\n frame_rate: {\n fixed: fps_fixed,\n fps: fps,\n fps_den: fps_den,\n fps_num: fps_num\n },\n\n sar_ratio: {\n width: sar_width,\n height: sar_height\n },\n\n codec_size: {\n width: codec_width,\n height: codec_height\n },\n\n present_size: {\n width: present_width,\n height: codec_height\n }\n };\n }\n\n static _skipScalingList(gb, count) {\n let last_scale = 8, next_scale = 8;\n let delta_scale = 0;\n for (let i = 0; i < count; i++) {\n if (next_scale !== 0) {\n delta_scale = gb.readSEG();\n next_scale = (last_scale + delta_scale + 256) % 256;\n }\n last_scale = (next_scale === 0) ? last_scale : next_scale;\n }\n }\n\n // profile_idc = 66 → baseline profile;\n // profile_idc = 77 → main profile;\n // profile_idc = 88 → extended profile;\n // 在新版的标准中,还包括了High、High 10、High 4:2:2、High 4:4:4、High 10 Intra、High\n // 4:2:2 Intra、High 4:4:4 Intra、CAVLC 4:4:4 Intra\n static getProfileString(profile_idc) {\n switch (profile_idc) {\n case 66:\n return 'Baseline';\n case 77:\n return 'Main';\n case 88:\n return 'Extended';\n case 100:\n return 'High';\n case 110:\n return 'High10';\n case 122:\n return 'High422';\n case 244:\n return 'High444';\n default:\n return 'Unknown';\n }\n }\n\n static getLevelString(level_idc) {\n return (level_idc / 10).toFixed(1);\n }\n\n static getChromaFormatString(chroma) {\n switch (chroma) {\n case 420:\n return '4:2:0';\n case 422:\n return '4:2:2';\n case 444:\n return '4:4:4';\n default:\n return 'Unknown';\n }\n }\n\n}\n\nexport default SPSParser;","import SPSParser from './h264-sps-parser.js';\n\n//\nexport function parseAVCDecoderConfigurationRecord(arrayBuffer) {\n const meta = {}\n const v = new DataView(arrayBuffer.buffer);\n let version = v.getUint8(0); // configurationVersion\n let avcProfile = v.getUint8(1); // avcProfileIndication\n let profileCompatibility = v.getUint8(2); // profile_compatibil\n let avcLevel = v.getUint8(3); // AVCLevelIndication\n\n if (version !== 1 || avcProfile === 0) {\n // this._onError(DemuxErrors.FORMAT_ERROR, 'Flv: Invalid AVCDecoderConfigurationRecord');\n\n return meta;\n }\n\n const _naluLengthSize = (v.getUint8(4) & 3) + 1; // lengthSizeMinusOne\n\n if (_naluLengthSize !== 3 && _naluLengthSize !== 4) { // holy shit!!!\n // this._onError(DemuxErrors.FORMAT_ERROR, `Flv: Strange NaluLengthSizeMinusOne: ${_naluLengthSize - 1}`);\n return meta;\n }\n let spsCount = v.getUint8(5) & 31; // numOfSequenceParameterSets\n\n if (spsCount === 0) {\n // this._onError(DemuxErrors.FORMAT_ERROR, 'Flv: Invalid AVCDecoderConfigurationRecord: No SPS');\n return;\n } else if (spsCount > 1) {\n // Log.w(this.TAG, `Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ${spsCount}`);\n }\n\n let offset = 6;\n for (let i = 0; i < spsCount; i++) {\n let len = v.getUint16(offset, false); // sequenceParameterSetLength\n offset += 2;\n\n if (len === 0) {\n continue;\n }\n\n // Notice: Nalu without startcode header (00 00 00 01)\n let sps = new Uint8Array(arrayBuffer.buffer, offset, len);\n offset += len;\n // flv.js作者选择了自己来解析这个数据结构,也是迫不得已,因为JS环境下没有ffmpeg,解析这个结构主要是为了提取 sps和pps。虽然理论上sps允许有多个,但其实一般就一个。\n // packetTtype 为 1 表示 NALU,NALU= network abstract layer unit,这是H.264的概念,网络抽象层数据单元,其实简单理解就是一帧视频数据。\n // pps的信息没什么用,所以作者只实现了sps的分析器,说明作者下了很大功夫去学习264的标准,其中的Golomb解码还是挺复杂的,能解对不容易,我在PC和手机平台都是用ffmpeg去解析的。\n // SPS里面包括了视频分辨率,帧率,profile level等视频重要信息。\n let config = SPSParser.parseSPS(sps);\n if (i !== 0) {\n // ignore other sps's config\n continue;\n }\n\n meta.codecWidth = config.codec_size.width;\n meta.codecHeight = config.codec_size.height;\n meta.presentWidth = config.present_size.width;\n meta.presentHeight = config.present_size.height;\n\n meta.profile = config.profile_string;\n meta.level = config.level_string;\n meta.bitDepth = config.bit_depth;\n meta.chromaFormat = config.chroma_format;\n meta.sarRatio = config.sar_ratio;\n meta.frameRate = config.frame_rate;\n\n if (config.frame_rate.fixed === false ||\n config.frame_rate.fps_num === 0 ||\n config.frame_rate.fps_den === 0) {\n meta.frameRate = {};\n }\n\n let fps_den = meta.frameRate.fps_den;\n let fps_num = meta.frameRate.fps_num;\n\n meta.refSampleDuration = meta.timescale * (fps_den / fps_num);\n\n let codecArray = sps.subarray(1, 4);\n\n let codecString = 'avc1.';\n for (let j = 0; j < 3; j++) {\n let h = codecArray[j].toString(16);\n if (h.length < 2) {\n h = '0' + h;\n }\n codecString += h;\n }\n // codec\n meta.codec = codecString;\n }\n\n let ppsCount = v.getUint8(offset); // numOfPictureParameterSets\n if (ppsCount === 0) {\n // this._onError(DemuxErrors.FORMAT_ERROR, 'Flv: Invalid AVCDecoderConfigurationRecord: No PPS');\n return meta;\n } else if (ppsCount > 1) {\n // Log.w(this.TAG, `Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ${ppsCount}`);\n }\n\n offset++;\n for (let i = 0; i < ppsCount; i++) {\n let len = v.getUint16(offset, false); // pictureParameterSetLength\n offset += 2;\n\n if (len === 0) {\n continue;\n }\n let pps = new Uint8Array(arrayBuffer.buffer, offset, len);\n\n // pps is useless for extracting video information\n offset += len;\n }\n\n meta.videoType = 'avc';\n\n // meta.avcc = arrayBuffer;\n return meta;\n}\n","import {formatVideoDecoderConfigure, noop, now} from \"../utils\";\nimport Emitter from \"../utils/emitter\";\nimport {ENCODED_VIDEO_TYPE, EVENTS, EVENTS_ERROR, VIDEO_ENC_CODE, WCS_ERROR} from \"../constant\";\nimport {parseAVCDecoderConfigurationRecord} from \"../utils/h264\";\n\n\nexport default class WebcodecsDecoder extends Emitter {\n constructor(player) {\n super();\n this.player = player;\n this.hasInit = false;\n this.isDecodeFirstIIframe = false;\n this.isInitInfo = false;\n this.decoder = null;\n this.initDecoder();\n player.debug.log('Webcodecs', 'init')\n }\n\n destroy() {\n if (this.decoder) {\n if (this.decoder.state !== 'closed') {\n this.decoder.close();\n }\n this.decoder = null;\n }\n\n this.hasInit = false;\n this.isInitInfo = false;\n this.isDecodeFirstIIframe = false;\n this.off();\n this.player.debug.log('Webcodecs', 'destroy')\n }\n\n initDecoder() {\n const _this = this;\n this.decoder = new VideoDecoder({\n output(videoFrame) {\n _this.handleDecode(videoFrame)\n },\n error(error) {\n _this.handleError(error)\n }\n })\n }\n\n handleDecode(videoFrame) {\n if (!this.isInitInfo) {\n this.player.video.updateVideoInfo({\n width: videoFrame.codedWidth,\n height: videoFrame.codedHeight\n })\n this.player.video.initCanvasViewSize();\n this.isInitInfo = true;\n }\n\n if (!this.player._times.videoStart) {\n this.player._times.videoStart = now();\n this.player.handlePlayToRenderTimes();\n }\n\n this.player.handleRender();\n this.player.video.render({\n videoFrame\n })\n\n this.player.updateStats({fps: true, ts: 0, buf: this.player.demux.delay})\n }\n\n handleError(error) {\n this.player.debug.error('Webcodecs', 'VideoDecoder handleError', error)\n }\n\n decodeVideo(payload, ts, isIframe) {\n // this.player.debug.log('Webcodecs decoder', 'decodeVideo', ts, isIframe);\n if (!this.hasInit) {\n if (isIframe && payload[1] === 0) {\n const videoCodec = (payload[0] & 0x0F);\n this.player.video.updateVideoInfo({\n encTypeCode: videoCodec\n })\n\n // 如果解码出来的是\n if (videoCodec === VIDEO_ENC_CODE.h265) {\n this.emit(EVENTS_ERROR.webcodecsH265NotSupport)\n return;\n }\n if (!this.player._times.decodeStart) {\n this.player._times.decodeStart = now();\n }\n\n const config = formatVideoDecoderConfigure(payload.slice(5));\n this.player.debug.log('Webcodecs', 'VideoDecoder configure', config)\n try {\n this.decoder.configure(config);\n }\n catch (e){\n this.player.debug.error('Webcodecs', 'VideoDecoder configure', e);\n this.player.emit(EVENTS_ERROR.webcodecsConfigureError);\n return;\n }\n this.hasInit = true;\n }\n } else {\n\n // check width or height change\n if (isIframe && payload[1] === 0) {\n let data = payload.slice(5);\n const config = parseAVCDecoderConfigurationRecord(data)\n const videoInfo = this.player.video.videoInfo;\n if (config.codecWidth !== videoInfo.width || config.codecHeight !== videoInfo.height) {\n this.player.debug.log('Webcodecs', `width or height is update, width ${videoInfo.width}-> ${config.codecWidth}, height ${videoInfo.height}-> ${config.codecHeight}`)\n this.player.emit(EVENTS_ERROR.webcodecsWidthOrHeightChange)\n return;\n }\n }\n\n\n // fix : Uncaught DOMException: Failed to execute 'decode' on 'VideoDecoder': A key frame is required after configure() or flush().\n if (!this.isDecodeFirstIIframe && isIframe) {\n this.isDecodeFirstIIframe = true;\n }\n\n if (this.isDecodeFirstIIframe) {\n const chunk = new EncodedVideoChunk({\n data: payload.slice(5),\n timestamp: ts,\n type: isIframe ? ENCODED_VIDEO_TYPE.key : ENCODED_VIDEO_TYPE.delta\n })\n this.player.emit(EVENTS.timeUpdate, ts);\n try {\n if (this.isDecodeStateClosed()) {\n this.player.debug.warn('Webcodecs', 'VideoDecoder isDecodeStateClosed true');\n return;\n }\n this.decoder.decode(chunk);\n } catch (e) {\n this.player.debug.error('Webcodecs', 'VideoDecoder', e)\n if (e.toString().indexOf(WCS_ERROR.keyframeIsRequiredError) !== -1) {\n this.player.emitError(EVENTS_ERROR.webcodecsDecodeError);\n }\n else if (e.toString().indexOf(WCS_ERROR.canNotDecodeClosedCodec) !== -1) {\n this.player.emitError(EVENTS_ERROR.webcodecsDecodeError);\n }\n }\n } else {\n this.player.debug.warn('Webcodecs', 'VideoDecoder isDecodeFirstIIframe false')\n }\n }\n }\n\n isDecodeStateClosed() {\n return this.decoder.state === 'closed';\n }\n}\n","const iconsMap = {\n play: '播放',\n pause: '暂停',\n audio: '',\n mute: '',\n screenshot: '截图',\n loading: '加载',\n fullscreen: '全屏',\n fullscreenExit: '退出全屏',\n record: '录制',\n recordStop: '停止录制',\n}\n\nexport default Object.keys(iconsMap).reduce((icons, key) => {\n icons[key] = `\n \n ${iconsMap[key] ? `${iconsMap[key]}` : ''}\n`;\n return icons;\n}, {});\n","import icons from './icons';\n\nexport default (player, control) => {\n\n if (player._opt.hasControl && player._opt.controlAutoHide) {\n player.$container.classList.add('jessibuca-controls-show-auto-hide');\n }\n else {\n player.$container.classList.add('jessibuca-controls-show');\n }\n const options = player._opt;\n const operateBtns = options.operateBtns;\n\n\n player.$container.insertAdjacentHTML(\n 'beforeend',\n `\n ${options.background ? `
` : ''}\n
\n ${icons.loading}\n ${options.loadingText ? `
${options.loadingText}
` : ''}\n
\n ${options.hasControl && operateBtns.play ? `
` : ''}\n ${options.hasControl ? `\n
\n
\n
00:00:01
\n
${icons.recordStop}
\n
\n `:''}\n ${options.hasControl ? `\n
\n
\n
\n ${options.showBandwidth ? `
` : ''}\n
\n
\n ${operateBtns.audio ? `\n
\n ${icons.audio}\n ${icons.mute}\n
\n
\n
\n
\n
\n
\n
\n ` : ''}\n ${operateBtns.play ? `
${icons.play}
${icons.pause}
` : ''}\n ${operateBtns.screenshot ? `
${icons.screenshot}
` : ''}\n ${operateBtns.record ? `
${icons.record}
${icons.recordStop}
` : ''}\n ${operateBtns.fullscreen ? `
${icons.fullscreen}
${icons.fullscreenExit}
` : ''}\n
\n
\n
\n ` : ''}\n\n `\n )\n\n Object.defineProperty(control, '$poster', {\n value: player.$container.querySelector('.jessibuca-poster'),\n });\n\n Object.defineProperty(control, '$loading', {\n value: player.$container.querySelector('.jessibuca-loading'),\n });\n\n Object.defineProperty(control, '$play', {\n value: player.$container.querySelector('.jessibuca-play'),\n });\n\n Object.defineProperty(control, '$playBig', {\n value: player.$container.querySelector('.jessibuca-play-big'),\n });\n\n Object.defineProperty(control, '$recording', {\n value: player.$container.querySelector('.jessibuca-recording'),\n });\n Object.defineProperty(control, '$recordingTime', {\n value: player.$container.querySelector('.jessibuca-recording-time'),\n });\n\n Object.defineProperty(control, '$recordingStop', {\n value: player.$container.querySelector('.jessibuca-recording-stop'),\n });\n\n Object.defineProperty(control, '$pause', {\n value: player.$container.querySelector('.jessibuca-pause'),\n });\n\n Object.defineProperty(control, '$controls', {\n value: player.$container.querySelector('.jessibuca-controls'),\n });\n\n Object.defineProperty(control, '$fullscreen', {\n value: player.$container.querySelector('.jessibuca-fullscreen'),\n });\n\n Object.defineProperty(control, '$fullscreen', {\n value: player.$container.querySelector('.jessibuca-fullscreen'),\n });\n\n\n Object.defineProperty(control, '$volume', {\n value: player.$container.querySelector('.jessibuca-volume'),\n });\n\n Object.defineProperty(control, '$volumePanelWrap', {\n value: player.$container.querySelector('.jessibuca-volume-panel-wrap'),\n });\n\n Object.defineProperty(control, '$volumePanelText', {\n value: player.$container.querySelector('.jessibuca-volume-panel-text'),\n });\n\n Object.defineProperty(control, '$volumePanel', {\n value: player.$container.querySelector('.jessibuca-volume-panel'),\n });\n\n Object.defineProperty(control, '$volumeHandle', {\n value: player.$container.querySelector('.jessibuca-volume-panel-handle'),\n });\n\n Object.defineProperty(control, '$volumeOn', {\n value: player.$container.querySelector('.jessibuca-icon-audio'),\n });\n\n Object.defineProperty(control, '$volumeOff', {\n value: player.$container.querySelector('.jessibuca-icon-mute'),\n });\n\n\n Object.defineProperty(control, '$fullscreen', {\n value: player.$container.querySelector('.jessibuca-fullscreen'),\n });\n\n Object.defineProperty(control, '$fullscreenExit', {\n value: player.$container.querySelector('.jessibuca-fullscreen-exit'),\n });\n\n Object.defineProperty(control, '$record', {\n value: player.$container.querySelector('.jessibuca-record'),\n });\n Object.defineProperty(control, '$recordStop', {\n value: player.$container.querySelector('.jessibuca-record-stop'),\n });\n\n Object.defineProperty(control, '$screenshot', {\n value: player.$container.querySelector('.jessibuca-screenshot'),\n });\n\n Object.defineProperty(control, '$speed', {\n value: player.$container.querySelector('.jessibuca-speed'),\n });\n}\n","import {CONTROL_HEIGHT, EVENTS} from \"../constant\";\nimport {bpsSize, formatTimeTips, getStyle, isBoolean, isMobile, setStyle} from \"../utils\";\nimport screenfull from \"screenfull\";\n\nexport default (player, control) => {\n const {\n events: {proxy},\n } = player;\n\n const object = document.createElement('object');\n object.setAttribute('aria-hidden', 'true');\n object.setAttribute('tabindex', -1);\n object.type = 'text/html';\n object.data = 'about:blank';\n\n setStyle(object, {\n display: 'block',\n position: 'absolute',\n top: '0',\n left: '0',\n height: '100%',\n width: '100%',\n overflow: 'hidden',\n pointerEvents: 'none',\n zIndex: '-1',\n });\n\n let playerWidth = player.width;\n let playerHeight = player.height;\n\n proxy(object, 'load', () => {\n proxy(object.contentDocument.defaultView, 'resize', () => {\n if (player.width !== playerWidth || player.height !== playerHeight) {\n playerWidth = player.width;\n playerHeight = player.height;\n player.emit(EVENTS.resize);\n screenfullH5Control();\n }\n });\n });\n player.$container.appendChild(object);\n\n player.on(EVENTS.destroy, () => {\n player.$container.removeChild(object);\n })\n\n function setVolumeHandle(percentage) {\n if (percentage === 0) {\n setStyle(control.$volumeOn, 'display', 'none');\n setStyle(control.$volumeOff, 'display', 'flex');\n setStyle(control.$volumeHandle, 'top', `${48}px`);\n } else {\n if (control.$volumeHandle && control.$volumePanel) {\n const panelHeight = getStyle(control.$volumePanel, 'height') || 60;\n const handleHeight = getStyle(control.$volumeHandle, 'height');\n const top = panelHeight - (panelHeight - handleHeight) * percentage - handleHeight;\n setStyle(control.$volumeHandle, 'top', `${top}px`);\n setStyle(control.$volumeOn, 'display', 'flex');\n setStyle(control.$volumeOff, 'display', 'none');\n }\n }\n control.$volumePanelText && (control.$volumePanelText.innerHTML = parseInt(percentage * 100))\n }\n\n player.on(EVENTS.volumechange, () => {\n setVolumeHandle(player.volume);\n });\n\n player.on(EVENTS.loading, (flag) => {\n setStyle(control.$loading, 'display', flag ? 'flex' : 'none');\n setStyle(control.$poster, 'display', 'none')\n\n if (flag) {\n setStyle(control.$playBig, 'display', 'none');\n }\n })\n\n const screenfullChange = (fullscreen) => {\n let isFullScreen = isBoolean(fullscreen) ? fullscreen : player.fullscreen\n setStyle(control.$fullscreenExit, 'display', isFullScreen ? 'flex' : 'none');\n setStyle(control.$fullscreen, 'display', isFullScreen ? 'none' : 'flex');\n // control.autoSize();\n };\n const screenfullH5Control = () => {\n if (isMobile() && control.$controls && player._opt.useWebFullScreen) {\n setTimeout(() => {\n if (player.fullscreen) {\n // console.log(player.width, player.height);\n let translateX = player.height / 2 - player.width + CONTROL_HEIGHT / 2;\n let translateY = player.height / 2 - CONTROL_HEIGHT / 2;\n\n control.$controls.style.transform = `translateX(${-translateX}px) translateY(-${translateY}px) rotate(-90deg)`\n } else {\n control.$controls.style.transform = `translateX(0) translateY(0) rotate(0)`\n }\n\n }, 10)\n }\n }\n\n try {\n\n screenfull.on('change', screenfullChange);\n player.events.destroys.push(() => {\n screenfull.off('change', screenfullChange);\n });\n } catch (error) {\n //\n }\n\n //\n player.on(EVENTS.webFullscreen, (value) => {\n screenfullChange(value);\n screenfullH5Control();\n\n })\n\n\n player.on(EVENTS.recording, () => {\n setStyle(control.$record, 'display', player.recording ? 'none' : 'flex');\n setStyle(control.$recordStop, 'display', player.recording ? 'flex' : 'none');\n setStyle(control.$recording, 'display', player.recording ? 'flex' : 'none')\n if(!player.recording && control.$recordingTime){\n control.$recordingTime.innerHTML = formatTimeTips(0);\n }\n })\n\n //\n player.on(EVENTS.recordingTimestamp, (timestamp) => {\n // console.log(timestamp);\n control.$recordingTime && (control.$recordingTime.innerHTML = formatTimeTips(timestamp))\n })\n\n player.on(EVENTS.playing, (flag) => {\n setStyle(control.$play, 'display', flag ? 'none' : 'flex');\n setStyle(control.$playBig, 'display', flag ? 'none' : 'block');\n setStyle(control.$pause, 'display', flag ? 'flex' : 'none');\n setStyle(control.$screenshot, 'display', flag ? 'flex' : 'none');\n setStyle(control.$record, 'display', flag ? 'flex' : 'none');\n setStyle(control.$qualityMenu, 'display', flag ? 'flex' : 'none');\n setStyle(control.$volume, 'display', flag ? 'flex' : 'none');\n // setStyle(control.$fullscreen, 'display', flag ? 'flex' : 'none');\n screenfullChange();\n // 不在播放\n if (!flag) {\n control.$speed && (control.$speed.innerHTML = bpsSize(''));\n }\n })\n\n\n player.on(EVENTS.kBps, (rate) => {\n const bps = bpsSize(rate);\n control.$speed && (control.$speed.innerHTML = bps);\n })\n}\n","export default (player, control) => {\n\n Object.defineProperty(control, 'controlsRect', {\n get: () => {\n return control.$controls.getBoundingClientRect();\n },\n });\n\n}\n","import {clamp, isMobile, setStyle} from \"../utils\";\n\nexport default (player, control) => {\n const {\n events: {proxy},\n debug\n } = player;\n\n function volumeChangeFromEvent(event) {\n const {bottom: panelBottom, height: panelHeight} = control.$volumePanel.getBoundingClientRect();\n const {height: handleHeight} = control.$volumeHandle.getBoundingClientRect();\n\n let moveLen = event.y;\n\n // if (isMobile() && player.fullscreen) {\n // moveLen = event.x;\n // }\n\n const percentage =\n clamp(panelBottom - moveLen - handleHeight / 2, 0, panelHeight - handleHeight / 2) / (panelHeight - handleHeight);\n return percentage;\n }\n\n //\n proxy(window, ['click', 'contextmenu'], event => {\n if (event.composedPath().indexOf(player.$container) > -1) {\n control.isFocus = true;\n } else {\n control.isFocus = false;\n }\n });\n\n //\n proxy(window, 'orientationchange', () => {\n setTimeout(() => {\n player.resize();\n }, 300);\n });\n\n\n proxy(control.$controls, 'click', (e) => {\n e.stopPropagation();\n })\n\n proxy(control.$pause, 'click', (e) => {\n player.pause();\n })\n // 监听 play 方法\n proxy(control.$play, 'click', (e) => {\n player.play();\n player.resumeAudioAfterPause()\n })\n\n // 监听 play 方法\n proxy(control.$playBig, 'click', (e) => {\n player.play();\n player.resumeAudioAfterPause()\n })\n\n proxy(control.$volume, 'mouseover', () => {\n control.$volumePanelWrap.classList.add('jessibuca-volume-panel-wrap-show');\n })\n\n proxy(control.$volume, 'mouseout', () => {\n control.$volumePanelWrap.classList.remove('jessibuca-volume-panel-wrap-show');\n })\n\n proxy(control.$volumeOn, 'click', (e) => {\n e.stopPropagation();\n setStyle(control.$volumeOn, 'display', 'none');\n setStyle(control.$volumeOff, 'display', 'block');\n const lastVolume = player.volume;\n player.volume = 0;\n player._lastVolume = lastVolume;\n })\n\n proxy(control.$volumeOff, 'click', (e) => {\n e.stopPropagation();\n setStyle(control.$volumeOn, 'display', 'block');\n setStyle(control.$volumeOff, 'display', 'none');\n player.volume = player.lastVolume || 0.5;\n })\n\n proxy(control.$screenshot, 'click', (e) => {\n e.stopPropagation();\n player.video.screenshot();\n })\n\n proxy(control.$volumePanel, 'click', event => {\n event.stopPropagation();\n player.volume = volumeChangeFromEvent(event);\n });\n\n proxy(control.$volumeHandle, 'mousedown', () => {\n control.isVolumeDroging = true;\n });\n\n proxy(control.$volumeHandle, 'mousemove', event => {\n if (control.isVolumeDroging) {\n player.volume = volumeChangeFromEvent(event);\n }\n });\n\n proxy(document, 'mouseup', () => {\n if (control.isVolumeDroging) {\n control.isVolumeDroging = false;\n }\n });\n\n proxy(control.$record, 'click', (e) => {\n e.stopPropagation();\n player.recording = true;\n })\n\n proxy(control.$recordStop, 'click', (e) => {\n e.stopPropagation();\n player.recording = false;\n })\n\n proxy(control.$recordingStop, 'click', (e) => {\n e.stopPropagation();\n player.recording = false;\n })\n\n proxy(control.$fullscreen, 'click', (e) => {\n e.stopPropagation();\n player.fullscreen = true;\n })\n\n proxy(control.$fullscreenExit, 'click', (e) => {\n e.stopPropagation();\n player.fullscreen = false;\n })\n\n if (player._opt.hasControl && player._opt.controlAutoHide) {\n //\n proxy(player.$container, 'mouseover', () => {\n if (!player.fullscreen) {\n setStyle(control.$controls, 'display', 'block');\n startDelayControlHidden();\n }\n })\n\n proxy(player.$container, 'mousemove', () => {\n if (player.$container && control.$controls) {\n if (!player.fullscreen) {\n if (control.$controls.style.display === 'none') {\n setStyle(control.$controls, 'display', 'block');\n startDelayControlHidden();\n }\n } else {\n if (control.$controls.style.display === 'none') {\n setStyle(control.$controls, 'display', 'block');\n startDelayControlHidden();\n }\n }\n }\n })\n\n proxy(player.$container, 'mouseout', () => {\n stopDelayControlHidden();\n setStyle(control.$controls, 'display', 'none');\n })\n let delayHiddenTimeout = null;\n const startDelayControlHidden = () => {\n stopDelayControlHidden();\n delayHiddenTimeout = setTimeout(() => {\n setStyle(control.$controls, 'display', 'none');\n }, 5 * 1000)\n }\n\n const stopDelayControlHidden = () => {\n if (delayHiddenTimeout) {\n clearTimeout(delayHiddenTimeout);\n delayHiddenTimeout = null;\n }\n }\n }\n}\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","// todo: 待定\nimport {HOT_KEY} from \"../constant\";\n\nexport default (player, control) => {\n const {\n events: {proxy}\n } = player;\n\n const keys = {};\n\n function addHotkey(key, event) {\n if (keys[key]) {\n keys[key].push(event);\n } else {\n keys[key] = [event];\n }\n }\n\n //\n addHotkey(HOT_KEY.esc, () => {\n if (player.fullscreen) {\n player.fullscreen = false;\n }\n })\n\n //\n addHotkey(HOT_KEY.arrowUp, () => {\n player.volume += 0.05;\n })\n\n //\n addHotkey(HOT_KEY.arrowDown, () => {\n player.volume -= 0.05;\n })\n\n proxy(window, 'keydown', event => {\n if (control.isFocus) {\n const tag = document.activeElement.tagName.toUpperCase();\n const editable = document.activeElement.getAttribute('contenteditable');\n if (tag !== 'INPUT' && tag !== 'TEXTAREA' && editable !== '' && editable !== 'true') {\n const events = keys[event.keyCode];\n if (events) {\n event.preventDefault();\n events.forEach(fn => fn());\n }\n }\n }\n });\n}\n","import template from \"./template\";\nimport observer from './observer';\nimport property from './property';\nimport events from './events';\nimport './style.scss'\nimport hotkey from \"./hotkey\";\nimport {getStyle, isBoolean, removeElement, setStyle} from \"../utils\";\n\nexport default class Control {\n constructor(player) {\n this.player = player;\n template(player, this);\n property(player, this);\n observer(player, this);\n events(player, this);\n if (player._opt.hotKey) {\n hotkey(player, this);\n }\n this.player.debug.log('Control', 'init');\n }\n\n destroy() {\n if (this.$poster) {\n const result = removeElement(this.$poster);\n if(!result){\n const $poster = this.player.$container.querySelector('.jessibuca-poster');\n if ($poster && this.player.$container) {\n this.player.$container.removeChild($poster);\n }\n }\n }\n if (this.$loading) {\n const result = removeElement(this.$loading)\n if (!result) {\n const $loading = this.player.$container.querySelector('.jessibuca-loading');\n if ($loading && this.player.$container) {\n this.player.$container.removeChild($loading);\n }\n }\n }\n if (this.$controls) {\n const result = removeElement(this.$controls)\n if (!result) {\n const $controls = this.player.$container.querySelector('.jessibuca-controls');\n if ($controls && this.player.$container) {\n this.player.$container.removeChild($controls);\n }\n }\n }\n\n if (this.$recording) {\n const result = removeElement(this.$recording)\n if (!result) {\n const $recording = this.player.$container.querySelector('.jessibuca-recording');\n if ($recording && this.player.$container) {\n this.player.$container.removeChild($recording);\n }\n }\n }\n\n if (this.$playBig) {\n const result = removeElement(this.$playBig)\n if (!result) {\n const $playBig = this.player.$container.querySelector('.jessibuca-play-big');\n if ($playBig && this.player.$container) {\n this.player.$container.removeChild($playBig);\n }\n }\n }\n\n if(this.player.$container){\n this.player.$container.classList.remove('jessibuca-controls-show-auto-hide');\n this.player.$container.classList.remove('jessibuca-controls-show');\n }\n\n this.player.debug.log('control', 'destroy');\n }\n\n autoSize() {\n const player = this.player;\n player.$container.style.padding = '0 0';\n const playerWidth = player.width;\n const playerHeight = player.height;\n const playerRatio = playerWidth / playerHeight;\n const canvasWidth = player.video.$videoElement.width;\n const canvasHeight = player.video.$videoElement.height;\n const canvasRatio = canvasWidth / canvasHeight;\n if (playerRatio > canvasRatio) {\n const padding = (playerWidth - playerHeight * canvasRatio) / 2;\n player.$container.style.padding = `0 ${padding}px`;\n } else {\n const padding = (playerHeight - playerWidth / canvasRatio) / 2;\n player.$container.style.padding = `${padding}px 0`;\n }\n }\n\n toggleBar(flag) {\n if (this.$controls) {\n if (!isBoolean(flag)) {\n // flag = this.$controls.style.display === 'none';\n flag = getStyle(this.$controls, 'display', false) === 'none';\n }\n\n if (flag) {\n setStyle(this.$controls, 'display', 'flex');\n } else {\n setStyle(this.$controls, 'display', 'none');\n }\n }\n }\n\n getBarIsShow() {\n let result = false;\n if (this.$controls) {\n result = getStyle(this.$controls, 'display', false) !== 'none';\n }\n return result;\n }\n}\n","import {getTarget} from \"../utils\";\n\nexport default (player) => {\n\n const {\n _opt,\n debug,\n events: {proxy},\n } = player;\n\n\n if (_opt.supportDblclickFullscreen) {\n proxy(player.$container, 'dblclick', (e) => {\n const target = getTarget(e);\n const nodeName = target.nodeName.toLowerCase();\n if (nodeName === 'canvas' || nodeName === 'video') {\n player.fullscreen = !player.fullscreen;\n }\n })\n }\n\n\n //\n proxy(document, 'visibilitychange', () => {\n if (_opt.hiddenAutoPause) {\n debug.log('visibilitychange', document.visibilityState, player._isPlayingBeforePageHidden)\n\n if (\"visible\" === document.visibilityState) {\n if (player._isPlayingBeforePageHidden) {\n player.play();\n }\n } else {\n player._isPlayingBeforePageHidden = player.playing;\n // hidden\n if (player.playing) {\n player.pause();\n }\n }\n }\n })\n\n proxy(window, 'fullscreenchange', () => {\n //\n if (player.keepScreenOn !== null && \"visible\" === document.visibilityState) {\n player.enableWakeLock();\n }\n })\n}\n","class MP4 {\n\n static init() {\n MP4.types = {\n avc1: [],\n avcC: [],\n hvc1: [],\n hvcC: [],\n btrt: [],\n dinf: [],\n dref: [],\n esds: [],\n ftyp: [],\n hdlr: [],\n mdat: [],\n mdhd: [],\n mdia: [],\n mfhd: [],\n minf: [],\n moof: [],\n moov: [],\n mp4a: [],\n mvex: [],\n mvhd: [],\n sdtp: [],\n stbl: [],\n stco: [],\n stsc: [],\n stsd: [],\n stsz: [],\n stts: [],\n tfdt: [],\n tfhd: [],\n traf: [],\n trak: [],\n trun: [],\n trex: [],\n tkhd: [],\n vmhd: [],\n smhd: []\n };\n\n for (let name in MP4.types) {\n if (MP4.types.hasOwnProperty(name)) {\n MP4.types[name] = [\n name.charCodeAt(0),\n name.charCodeAt(1),\n name.charCodeAt(2),\n name.charCodeAt(3)\n ];\n }\n }\n\n let constants = MP4.constants = {};\n\n constants.FTYP = new Uint8Array([\n 0x69, 0x73, 0x6F, 0x6D, // major_brand: isom\n 0x0, 0x0, 0x0, 0x1, // minor_version: 0x01\n 0x69, 0x73, 0x6F, 0x6D, // isom\n 0x61, 0x76, 0x63, 0x31 // avc1\n ]);\n\n constants.STSD_PREFIX = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n 0x00, 0x00, 0x00, 0x01 // entry_count\n ]);\n\n constants.STTS = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n 0x00, 0x00, 0x00, 0x00 // entry_count\n ]);\n\n constants.STSC = constants.STCO = constants.STTS;\n\n constants.STSZ = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n 0x00, 0x00, 0x00, 0x00, // sample_size\n 0x00, 0x00, 0x00, 0x00 // sample_count\n ]);\n\n constants.HDLR_VIDEO = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide'\n 0x00, 0x00, 0x00, 0x00, // reserved: 3 * 4 bytes\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x56, 0x69, 0x64, 0x65,\n 0x6F, 0x48, 0x61, 0x6E,\n 0x64, 0x6C, 0x65, 0x72, 0x00 // name: VideoHandler\n ]);\n\n constants.HDLR_AUDIO = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0x73, 0x6F, 0x75, 0x6E, // handler_type: 'soun'\n 0x00, 0x00, 0x00, 0x00, // reserved: 3 * 4 bytes\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x53, 0x6F, 0x75, 0x6E,\n 0x64, 0x48, 0x61, 0x6E,\n 0x64, 0x6C, 0x65, 0x72, 0x00 // name: SoundHandler\n ]);\n\n constants.DREF = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n 0x00, 0x00, 0x00, 0x01, // entry_count\n 0x00, 0x00, 0x00, 0x0C, // entry_size\n 0x75, 0x72, 0x6C, 0x20, // type 'url '\n 0x00, 0x00, 0x00, 0x01 // version(0) + flags\n ]);\n\n // Sound media header\n constants.SMHD = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n 0x00, 0x00, 0x00, 0x00 // balance(2) + reserved(2)\n ]);\n\n // video media header\n constants.VMHD = new Uint8Array([\n 0x00, 0x00, 0x00, 0x01, // version(0) + flags\n 0x00, 0x00, // graphicsmode: 2 bytes\n 0x00, 0x00, 0x00, 0x00, // opcolor: 3 * 2 bytes\n 0x00, 0x00\n ]);\n }\n\n // Generate a box\n static box(type) {\n let size = 8;\n let result = null;\n let datas = Array.prototype.slice.call(arguments, 1);\n let arrayCount = datas.length;\n\n for (let i = 0; i < arrayCount; i++) {\n size += datas[i].byteLength;\n }\n\n result = new Uint8Array(size);\n result[0] = (size >>> 24) & 0xFF; // size\n result[1] = (size >>> 16) & 0xFF;\n result[2] = (size >>> 8) & 0xFF;\n result[3] = (size) & 0xFF;\n\n result.set(type, 4); // type\n\n let offset = 8;\n for (let i = 0; i < arrayCount; i++) { // data body\n result.set(datas[i], offset);\n offset += datas[i].byteLength;\n }\n\n return result;\n }\n\n // emit ftyp & moov\n static generateInitSegment(meta) {\n let ftyp = MP4.box(MP4.types.ftyp, MP4.constants.FTYP);\n let moov = MP4.moov(meta);\n\n let result = new Uint8Array(ftyp.byteLength + moov.byteLength);\n result.set(ftyp, 0);\n result.set(moov, ftyp.byteLength);\n return result;\n }\n\n // Movie metadata box\n static moov(meta) {\n let mvhd = MP4.mvhd(meta.timescale, meta.duration);\n let trak = MP4.trak(meta);\n let mvex = MP4.mvex(meta);\n return MP4.box(MP4.types.moov, mvhd, trak, mvex);\n }\n\n // Movie header box\n static mvhd(timescale, duration) {\n return MP4.box(MP4.types.mvhd, new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n 0x00, 0x00, 0x00, 0x00, // creation_time\n 0x00, 0x00, 0x00, 0x00, // modification_time\n (timescale >>> 24) & 0xFF, // timescale: 4 bytes\n (timescale >>> 16) & 0xFF,\n (timescale >>> 8) & 0xFF,\n (timescale) & 0xFF,\n (duration >>> 24) & 0xFF, // duration: 4 bytes\n (duration >>> 16) & 0xFF,\n (duration >>> 8) & 0xFF,\n (duration) & 0xFF,\n 0x00, 0x01, 0x00, 0x00, // Preferred rate: 1.0\n 0x01, 0x00, 0x00, 0x00, // PreferredVolume(1.0, 2bytes) + reserved(2bytes)\n 0x00, 0x00, 0x00, 0x00, // reserved: 4 + 4 bytes\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x01, 0x00, 0x00, // ----begin composition matrix----\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x40, 0x00, 0x00, 0x00, // ----end composition matrix----\n 0x00, 0x00, 0x00, 0x00, // ----begin pre_defined 6 * 4 bytes----\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, // ----end pre_defined 6 * 4 bytes----\n 0xFF, 0xFF, 0xFF, 0xFF // next_track_ID\n ]));\n }\n\n // Track box\n static trak(meta) {\n return MP4.box(MP4.types.trak, MP4.tkhd(meta), MP4.mdia(meta));\n }\n\n // Track header box\n static tkhd(meta) {\n let trackId = meta.id, duration = meta.duration;\n let width = meta.presentWidth, height = meta.presentHeight;\n\n return MP4.box(MP4.types.tkhd, new Uint8Array([\n 0x00, 0x00, 0x00, 0x07, // version(0) + flags\n 0x00, 0x00, 0x00, 0x00, // creation_time\n 0x00, 0x00, 0x00, 0x00, // modification_time\n (trackId >>> 24) & 0xFF, // track_ID: 4 bytes\n (trackId >>> 16) & 0xFF,\n (trackId >>> 8) & 0xFF,\n (trackId) & 0xFF,\n 0x00, 0x00, 0x00, 0x00, // reserved: 4 bytes\n (duration >>> 24) & 0xFF, // duration: 4 bytes\n (duration >>> 16) & 0xFF,\n (duration >>> 8) & 0xFF,\n (duration) & 0xFF,\n 0x00, 0x00, 0x00, 0x00, // reserved: 2 * 4 bytes\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, // layer(2bytes) + alternate_group(2bytes)\n 0x00, 0x00, 0x00, 0x00, // volume(2bytes) + reserved(2bytes)\n 0x00, 0x01, 0x00, 0x00, // ----begin composition matrix----\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x40, 0x00, 0x00, 0x00, // ----end composition matrix----\n (width >>> 8) & 0xFF, // width and height\n (width) & 0xFF,\n 0x00, 0x00,\n (height >>> 8) & 0xFF,\n (height) & 0xFF,\n 0x00, 0x00\n ]));\n }\n\n static mdia(meta) {\n return MP4.box(MP4.types.mdia, MP4.mdhd(meta), MP4.hdlr(meta), MP4.minf(meta))\n }\n\n // Media header box\n static mdhd(meta) {\n let timescale = meta.timescale;\n let duration = meta.duration;\n return MP4.box(MP4.types.mdhd, new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n 0x00, 0x00, 0x00, 0x00, // creation_time\n 0x00, 0x00, 0x00, 0x00, // modification_time\n (timescale >>> 24) & 0xFF, // timescale: 4 bytes\n (timescale >>> 16) & 0xFF,\n (timescale >>> 8) & 0xFF,\n (timescale) & 0xFF,\n (duration >>> 24) & 0xFF, // duration: 4 bytes\n (duration >>> 16) & 0xFF,\n (duration >>> 8) & 0xFF,\n (duration) & 0xFF,\n 0x55, 0xC4, // language: und (undetermined)\n 0x00, 0x00 // pre_defined = 0\n ]));\n }\n\n // Media handler reference box\n static hdlr(meta) {\n let data = null;\n if (meta.type === 'audio') {\n data = MP4.constants.HDLR_AUDIO;\n } else {\n data = MP4.constants.HDLR_VIDEO;\n }\n return MP4.box(MP4.types.hdlr, data);\n }\n\n // Media infomation box\n static minf(meta) {\n let xmhd = null;\n if (meta.type === 'audio') {\n xmhd = MP4.box(MP4.types.smhd, MP4.constants.SMHD);\n } else {\n xmhd = MP4.box(MP4.types.vmhd, MP4.constants.VMHD);\n }\n return MP4.box(MP4.types.minf, xmhd, MP4.dinf(), MP4.stbl(meta));\n }\n\n // Data infomation box\n static dinf() {\n let result = MP4.box(MP4.types.dinf,\n MP4.box(MP4.types.dref, MP4.constants.DREF)\n );\n return result;\n }\n\n // Sample table box\n static stbl(meta) {\n let result = MP4.box(MP4.types.stbl, // type: stbl\n MP4.stsd(meta), // Sample Description Table\n MP4.box(MP4.types.stts, MP4.constants.STTS), // Time-To-Sample\n MP4.box(MP4.types.stsc, MP4.constants.STSC), // Sample-To-Chunk\n MP4.box(MP4.types.stsz, MP4.constants.STSZ), // Sample size\n MP4.box(MP4.types.stco, MP4.constants.STCO) // Chunk offset\n );\n return result;\n }\n\n // Sample description box\n static stsd(meta) {\n if (meta.type === 'audio') {\n // else: aac -> mp4a\n return MP4.box(MP4.types.stsd, MP4.constants.STSD_PREFIX, MP4.mp4a(meta));\n } else {\n if (meta.videoType === 'avc') {\n //\n return MP4.box(MP4.types.stsd, MP4.constants.STSD_PREFIX, MP4.avc1(meta));\n } else {\n //\n return MP4.box(MP4.types.stsd, MP4.constants.STSD_PREFIX, MP4.hvc1(meta))\n }\n }\n }\n\n static mp4a(meta) {\n let channelCount = meta.channelCount;\n let sampleRate = meta.audioSampleRate;\n\n let data = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // reserved(4)\n 0x00, 0x00, 0x00, 0x01, // reserved(2) + data_reference_index(2)\n 0x00, 0x00, 0x00, 0x00, // reserved: 2 * 4 bytes\n 0x00, 0x00, 0x00, 0x00,\n 0x00, channelCount, // channelCount(2)\n 0x00, 0x10, // sampleSize(2)\n 0x00, 0x00, 0x00, 0x00, // reserved(4)\n (sampleRate >>> 8) & 0xFF, // Audio sample rate\n (sampleRate) & 0xFF,\n 0x00, 0x00\n ]);\n\n return MP4.box(MP4.types.mp4a, data, MP4.esds(meta));\n }\n\n static esds(meta) {\n let config = meta.config || [];\n let configSize = config.length;\n let data = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version 0 + flags\n\n 0x03, // descriptor_type\n 0x17 + configSize, // length3\n 0x00, 0x01, // es_id\n 0x00, // stream_priority\n\n 0x04, // descriptor_type\n 0x0F + configSize, // length\n 0x40, // codec: mpeg4_audio\n 0x15, // stream_type: Audio\n 0x00, 0x00, 0x00, // buffer_size\n 0x00, 0x00, 0x00, 0x00, // maxBitrate\n 0x00, 0x00, 0x00, 0x00, // avgBitrate\n\n 0x05 // descriptor_type\n ].concat([\n configSize\n ]).concat(\n config\n ).concat([\n 0x06, 0x01, 0x02 // GASpecificConfig\n ]));\n return MP4.box(MP4.types.esds, data);\n }\n\n // avc\n static avc1(meta) {\n let avcc = meta.avcc;\n const width = meta.codecWidth;\n const height = meta.codecHeight;\n let data = new Uint8Array([\n 0, 0, 0, 0,\n 0, 0, 0, 1,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n width >>> 8 & 255,\n width & 255,\n height >>> 8 & 255,\n height & 255,\n 0, 72, 0, 0,\n 0, 72, 0, 0,\n 0, 0, 0, 0,\n 0, 1,\n 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0,\n 0, 24,\n 255, 255]\n );\n return MP4.box(MP4.types.avc1, data, MP4.box(MP4.types.avcC, avcc))\n }\n\n // hvc\n static hvc1(meta) {\n let avcc = meta.avcc;\n const width = meta.codecWidth;\n const height = meta.codecHeight;\n let data = new Uint8Array([\n 0, 0, 0, 0,\n 0, 0, 0, 1,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n width >>> 8 & 255,\n width & 255,\n height >>> 8 & 255,\n height & 255,\n 0, 72, 0, 0,\n 0, 72, 0, 0,\n 0, 0, 0, 0,\n 0, 1,\n 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0,\n 0, 24,\n 255, 255\n ]);\n return MP4.box(MP4.types.hvc1, data, MP4.box(MP4.types.hvcC, avcc))\n }\n\n // Movie Extends box\n static mvex(meta) {\n return MP4.box(MP4.types.mvex, MP4.trex(meta))\n }\n\n // Track Extends box\n static trex(meta) {\n let trackId = meta.id;\n let data = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) + flags\n (trackId >>> 24) & 0xFF, // track_ID\n (trackId >>> 16) & 0xFF,\n (trackId >>> 8) & 0xFF,\n (trackId) & 0xFF,\n 0x00, 0x00, 0x00, 0x01, // default_sample_description_index\n 0x00, 0x00, 0x00, 0x00, // default_sample_duration\n 0x00, 0x00, 0x00, 0x00, // default_sample_size\n 0x00, 0x01, 0x00, 0x01 // default_sample_flags\n ]);\n return MP4.box(MP4.types.trex, data);\n }\n\n // Movie fragment box\n static moof(track, baseMediaDecodeTime) {\n return MP4.box(MP4.types.moof, MP4.mfhd(track.sequenceNumber), MP4.traf(track, baseMediaDecodeTime))\n }\n //\n static mfhd(sequenceNumber) {\n let data = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00,\n (sequenceNumber >>> 24) & 0xFF, // sequence_number: int32\n (sequenceNumber >>> 16) & 0xFF,\n (sequenceNumber >>> 8) & 0xFF,\n (sequenceNumber) & 0xFF\n ]);\n return MP4.box(MP4.types.mfhd, data);\n }\n\n // Track fragment box\n static traf(track, baseMediaDecodeTime) {\n let trackId = track.id;\n\n // Track fragment header box\n let tfhd = MP4.box(MP4.types.tfhd, new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) & flags\n (trackId >>> 24) & 0xFF, // track_ID\n (trackId >>> 16) & 0xFF,\n (trackId >>> 8) & 0xFF,\n (trackId) & 0xFF\n ]));\n // Track Fragment Decode Time\n let tfdt = MP4.box(MP4.types.tfdt, new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, // version(0) & flags\n (baseMediaDecodeTime >>> 24) & 0xFF, // baseMediaDecodeTime: int32\n (baseMediaDecodeTime >>> 16) & 0xFF,\n (baseMediaDecodeTime >>> 8) & 0xFF,\n (baseMediaDecodeTime) & 0xFF\n ]));\n let sdtp = MP4.sdtp(track);\n let trun = MP4.trun(track, sdtp.byteLength + 16 + 16 + 8 + 16 + 8 + 8);\n\n return MP4.box(MP4.types.traf, tfhd, tfdt, trun, sdtp);\n }\n\n // Sample Dependency Type box\n static sdtp(track) {\n let data = new Uint8Array(4 + 1);\n let flags = track.flags;\n data[4] = flags.isLeading << 6\n | flags.dependsOn << 4\n | flags.isDependedOn << 2\n | flags.hasRedundancy;\n return MP4.box(MP4.types.sdtp, data);\n }\n // trun\n static trun(track, offset) {\n let dataSize = 12 + 16;\n let data = new Uint8Array(dataSize);\n offset += 8 + dataSize;\n\n data.set([\n 0x00, 0x00, 0x0F, 0x01, // version(0) & flags\n 0x00, 0x00, 0x00, 0x01, // sample_count\n (offset >>> 24) & 0xFF, // data_offset\n (offset >>> 16) & 0xFF,\n (offset >>> 8) & 0xFF,\n (offset) & 0xFF\n ], 0);\n\n let duration = track.duration;\n let size = track.size;\n let flags = track.flags;\n let cts = track.cts;\n\n data.set([\n (duration >>> 24) & 0xFF, // sample_duration\n (duration >>> 16) & 0xFF,\n (duration >>> 8) & 0xFF,\n (duration) & 0xFF,\n (size >>> 24) & 0xFF, // sample_size\n (size >>> 16) & 0xFF,\n (size >>> 8) & 0xFF,\n (size) & 0xFF,\n (flags.isLeading << 2) | flags.dependsOn, // sample_flags\n (flags.isDependedOn << 6) | (flags.hasRedundancy << 4) | flags.isNonSync,\n 0x00, 0x00, // sample_degradation_priority\n (cts >>> 24) & 0xFF, // sample_composition_time_offset\n (cts >>> 16) & 0xFF,\n (cts >>> 8) & 0xFF,\n (cts) & 0xFF\n ], 12);\n\n return MP4.box(MP4.types.trun, data);\n }\n // mdat\n static mdat(data) {\n return MP4.box(MP4.types.mdat, data)\n }\n}\n\nMP4.init();\n\nexport default MP4;\n","import Emitter from \"../utils/emitter\";\nimport {EVENTS, EVENTS_ERROR, FRAG_DURATION, MEDIA_SOURCE_STATE, MP4_CODECS, VIDEO_ENC_CODE} from \"../constant\";\nimport MP4 from \"../remux/fmp4-generator\";\nimport {parseAVCDecoderConfigurationRecord,} from \"../utils/h264\";\nimport {now} from \"../utils\";\n\nexport default class MseDecoder extends Emitter {\n constructor(player) {\n super();\n this.player = player;\n this.isAvc = true;\n this.mediaSource = new window.MediaSource();\n this.sourceBuffer = null;\n this.hasInit = false;\n this.isInitInfo = false;\n this.cacheTrack = {};\n this.timeInit = false;\n this.sequenceNumber = 0;\n this.mediaSourceOpen = false;\n this.dropping = false;\n this.firstRenderTime = null;\n this.mediaSourceAppendBufferError = false;\n this.mediaSourceAppendBufferFull = false;\n this.isDecodeFirstIIframe = false;\n this.player.video.$videoElement.src = window.URL.createObjectURL(this.mediaSource);\n const {\n debug,\n events: {proxy},\n } = player;\n\n\n proxy(this.mediaSource, 'sourceopen', () => {\n this.mediaSourceOpen = true;\n this.player.emit(EVENTS.mseSourceOpen)\n })\n\n proxy(this.mediaSource, 'sourceclose', () => {\n this.player.emit(EVENTS.mseSourceClose);\n })\n\n player.debug.log('MediaSource', 'init')\n }\n\n destroy() {\n this.stop();\n this.mediaSource = null;\n this.mediaSourceOpen = false;\n this.sourceBuffer = null;\n this.hasInit = false;\n this.isInitInfo = false;\n this.sequenceNumber = 0;\n this.cacheTrack = null;\n this.timeInit = false;\n this.mediaSourceAppendBufferError = false;\n this.mediaSourceAppendBufferFull = false;\n this.isDecodeFirstIIframe = false;\n this.off();\n this.player.debug.log('MediaSource', 'destroy')\n }\n\n get state() {\n return this.mediaSource && this.mediaSource.readyState\n }\n\n get isStateOpen() {\n return this.state === MEDIA_SOURCE_STATE.open;\n }\n\n get isStateClosed() {\n return this.state === MEDIA_SOURCE_STATE.closed;\n }\n\n get isStateEnded() {\n return this.state === MEDIA_SOURCE_STATE.ended;\n }\n\n get duration() {\n return this.mediaSource && this.mediaSource.duration\n }\n\n set duration(duration) {\n this.mediaSource.duration = duration\n }\n\n decodeVideo(payload, ts, isIframe, cts) {\n const player = this.player;\n\n if (!player) {\n return;\n }\n\n if (!this.hasInit) {\n if (isIframe && payload[1] === 0) {\n const videoCodec = (payload[0] & 0x0F);\n player.video.updateVideoInfo({\n encTypeCode: videoCodec\n })\n\n // 如果解码出来的是\n if (videoCodec === VIDEO_ENC_CODE.h265) {\n this.emit(EVENTS_ERROR.mediaSourceH265NotSupport)\n return;\n }\n if (!player._times.decodeStart) {\n player._times.decodeStart = now();\n }\n\n this._decodeConfigurationRecord(payload, ts, isIframe, videoCodec)\n this.hasInit = true;\n }\n } else {\n if (isIframe && payload[1] === 0) {\n let config = parseAVCDecoderConfigurationRecord(payload.slice(5))\n const videoInfo = this.player.video.videoInfo;\n if ((videoInfo && videoInfo.width && videoInfo.height) && (config && config.codecWidth && config.codecHeight) && (config.codecWidth !== videoInfo.width || config.codecHeight !== videoInfo.height)) {\n this.player.debug.warn('MediaSource', `width or height is update, width ${videoInfo.width}-> ${config.codecWidth}, height ${videoInfo.height}-> ${config.codecHeight}`)\n this.isInitInfo = false;\n this.player.video.init = false;\n }\n }\n\n if (!this.isDecodeFirstIIframe && isIframe) {\n this.isDecodeFirstIIframe = true;\n }\n if (this.isDecodeFirstIIframe) {\n if (this.firstRenderTime === null) {\n this.firstRenderTime = ts;\n }\n const dts = ts - this.firstRenderTime;\n\n this._decodeVideo(payload, dts, isIframe, cts);\n } else {\n this.player.debug.warn('MediaSource', 'decodeVideo isDecodeFirstIIframe false')\n }\n }\n }\n\n\n _decodeConfigurationRecord(payload, ts, isIframe, videoCodec) {\n let data = payload.slice(5);\n let config = {};\n\n config = parseAVCDecoderConfigurationRecord(data)\n\n const metaData = {\n id: 1, // video tag data\n type: 'video',\n timescale: 1000,\n duration: 0,\n avcc: data,\n codecWidth: config.codecWidth,\n codecHeight: config.codecHeight,\n videoType: config.videoType\n }\n // ftyp\n const metaBox = MP4.generateInitSegment(metaData);\n this.isAvc = true;\n this.appendBuffer(metaBox.buffer);\n this.sequenceNumber = 0;\n this.cacheTrack = null;\n this.timeInit = false;\n }\n\n //\n _decodeVideo(payload, dts, isIframe, cts) {\n const player = this.player;\n let arrayBuffer = payload.slice(5);\n let bytes = arrayBuffer.byteLength;\n // player.debug.log('MediaSource', '_decodeVideo', ts);\n const $video = player.video.$videoElement;\n const videoBufferDelay = player._opt.videoBufferDelay;\n if ($video.buffered.length > 1) {\n this.removeBuffer($video.buffered.start(0), $video.buffered.end(0));\n this.timeInit = false;\n }\n if (this.dropping && dts - this.cacheTrack.dts > videoBufferDelay) {\n this.dropping = false;\n this.cacheTrack = {};\n } else if (this.cacheTrack && dts >= this.cacheTrack.dts) {\n // 需要额外加8个size\n let mdatBytes = 8 + this.cacheTrack.size;\n let mdatbox = new Uint8Array(mdatBytes);\n mdatbox[0] = mdatBytes >>> 24 & 255;\n mdatbox[1] = mdatBytes >>> 16 & 255;\n mdatbox[2] = mdatBytes >>> 8 & 255;\n mdatbox[3] = mdatBytes & 255;\n mdatbox.set(MP4.types.mdat, 4);\n mdatbox.set(this.cacheTrack.data, 8);\n\n this.cacheTrack.duration = dts - this.cacheTrack.dts;\n // moof\n let moofbox = MP4.moof(this.cacheTrack, this.cacheTrack.dts);\n let result = new Uint8Array(moofbox.byteLength + mdatbox.byteLength);\n result.set(moofbox, 0);\n result.set(mdatbox, moofbox.byteLength);\n // appendBuffer\n this.appendBuffer(result.buffer)\n player.handleRender();\n player.updateStats({fps: true, ts: dts, buf: (player.demux && player.demux.delay) || 0})\n if (!player._times.videoStart) {\n player._times.videoStart = now();\n player.handlePlayToRenderTimes()\n }\n } else {\n player.debug.log('MediaSource', 'timeInit set false , cacheTrack = {}');\n this.timeInit = false;\n this.cacheTrack = {};\n }\n if (!this.cacheTrack) {\n this.cacheTrack = {};\n }\n this.cacheTrack.id = 1;\n this.cacheTrack.sequenceNumber = ++this.sequenceNumber;\n this.cacheTrack.size = bytes;\n this.cacheTrack.dts = dts;\n this.cacheTrack.cts = cts;\n this.cacheTrack.isKeyframe = isIframe;\n this.cacheTrack.data = arrayBuffer;\n //\n this.cacheTrack.flags = {\n isLeading: 0,\n dependsOn: isIframe ? 2 : 1,\n isDependedOn: isIframe ? 1 : 0,\n hasRedundancy: 0,\n isNonSync: isIframe ? 0 : 1\n }\n\n //\n if (!this.timeInit && $video.buffered.length === 1) {\n player.debug.log('MediaSource', 'timeInit set true');\n this.timeInit = true;\n $video.currentTime = $video.buffered.end(0);\n }\n\n if (!this.isInitInfo && $video.videoWidth > 0 && $video.videoHeight > 0) {\n player.debug.log('MediaSource', `updateVideoInfo: ${$video.videoWidth},${$video.videoHeight}`);\n player.video.updateVideoInfo({\n width: $video.videoWidth,\n height: $video.videoHeight\n })\n player.video.initCanvasViewSize();\n this.isInitInfo = true;\n }\n }\n\n appendBuffer(buffer) {\n const {\n debug,\n events: {proxy},\n } = this.player;\n\n if (this.sourceBuffer === null) {\n this.sourceBuffer = this.mediaSource.addSourceBuffer(MP4_CODECS.avc);\n proxy(this.sourceBuffer, 'error', (error) => {\n debug.error('MediaSource', 'sourceBuffer error', error);\n this.player.emit(EVENTS.mseSourceBufferError, error);\n // this.dropSourceBuffer(false)\n })\n }\n\n if (this.mediaSourceAppendBufferError) {\n debug.error('MediaSource', `this.mediaSourceAppendBufferError is true`);\n return;\n }\n\n if (this.mediaSourceAppendBufferFull) {\n debug.error('MediaSource', `this.mediaSourceAppendBufferFull is true`);\n return;\n }\n\n\n if (this.sourceBuffer.updating === false && this.isStateOpen) {\n try {\n this.sourceBuffer.appendBuffer(buffer);\n } catch (e) {\n debug.warn('MediaSource', 'this.sourceBuffer.appendBuffer()', e.code, e);\n if (e.code === 22) {\n // QuotaExceededError\n // The SourceBuffer is full, and cannot free space to append additional buffers\n this.stop();\n this.mediaSourceAppendBufferFull = true;\n this.emit(EVENTS_ERROR.mediaSourceFull)\n } else if (e.code === 11) {\n // Failed to execute 'appendBuffer' on 'SourceBuffer': The HTMLMediaElement.error attribute is not null.\n this.stop();\n this.mediaSourceAppendBufferError = true;\n this.emit(EVENTS_ERROR.mediaSourceAppendBufferError);\n } else {\n debug.error('MediaSource', 'appendBuffer error', e)\n this.player.emit(EVENTS.mseSourceBufferError, e);\n }\n }\n return;\n }\n\n if (this.isStateClosed) {\n this.player.emitError(EVENTS_ERROR.mseSourceBufferError, 'mediaSource is not attached to video or mediaSource is closed')\n } else if (this.isStateEnded) {\n this.player.emitError(EVENTS_ERROR.mseSourceBufferError, 'mediaSource is closed')\n } else {\n if (this.sourceBuffer.updating === true) {\n this.player.emit(EVENTS.mseSourceBufferBusy);\n // this.dropSourceBuffer(true);\n }\n }\n }\n\n stop() {\n this.abortSourceBuffer();\n this.removeSourceBuffer();\n this.endOfStream();\n }\n\n dropSourceBuffer(isDropping) {\n const $video = this.player.video.$videoElement;\n this.dropping = isDropping;\n if ($video.buffered.length > 0) {\n if ($video.buffered.end(0) - $video.currentTime > 1) {\n this.player.debug.warn('MediaSource', 'dropSourceBuffer', `$video.buffered.end(0) is ${$video.buffered.end(0)} - $video.currentTime ${$video.currentTime}`);\n $video.currentTime = $video.buffered.end(0);\n }\n }\n }\n\n\n removeBuffer(start, end) {\n\n if (this.isStateOpen && this.sourceBuffer.updating === false) {\n try {\n this.sourceBuffer.remove(start, end)\n } catch (e) {\n this.player.debug.warn('MediaSource', 'removeBuffer() error', e);\n }\n } else {\n this.player.debug.warn('MediaSource', 'removeBuffer() this.isStateOpen is', this.isStateOpen, 'this.sourceBuffer.updating', this.sourceBuffer.updating);\n }\n }\n\n endOfStream() {\n // fix: MediaSource endOfStream before demuxer initialization completes (before HAVE_METADATA) is treated as an error\n const $videoElement = this.player.video && this.player.video.$videoElement;\n if (this.isStateOpen && $videoElement && $videoElement.readyState >= 1) {\n try {\n this.mediaSource.endOfStream();\n } catch (e) {\n this.player.debug.warn('MediaSource', 'endOfStream() error', e);\n }\n }\n }\n\n abortSourceBuffer() {\n if (this.isStateOpen) {\n if (this.sourceBuffer) {\n this.sourceBuffer.abort();\n this.sourceBuffer = null;\n }\n }\n }\n\n removeSourceBuffer() {\n if (!this.isStateClosed) {\n if (this.mediaSource && this.sourceBuffer) {\n try {\n this.mediaSource.removeSourceBuffer(this.sourceBuffer);\n } catch (e) {\n this.player.debug.warn('MediaSource', 'removeSourceBuffer() error', e);\n }\n }\n }\n }\n\n getSourceBufferUpdating() {\n return this.sourceBuffer && this.sourceBuffer.updating;\n }\n\n}\n","// tks: https://github.com/richtr/NoSleep.js\n\nconst WEBM = \"data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIr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ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABByccMMTb3jCDU7QKSp1IAAAAAAADADwAACQXAAREdHMYWRobHB0eHyAhIiMkAgAAAAAABcAfAAAJCVAREQ0cxgZGhscHR4fICEiIyQBAIAAAgAAAAAggAAEBAQAAAAAAAIAAAAEBB9DtnUBAAAAAAAEPueBAKOFggAAgAC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OS browsers < version 10\nconst\n oldIOS = () =>\n typeof navigator !== \"undefined\" &&\n parseFloat(\n (\n \"\" +\n (/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(\n navigator.userAgent\n ) || [0, \"\"])[1]\n )\n .replace(\"undefined\", \"3_2\")\n .replace(\"_\", \".\")\n .replace(\"_\", \"\")\n ) < 10 &&\n !window.MSStream;\n\n// Detect native Wake Lock API support\nconst nativeWakeLock = () => \"wakeLock\" in navigator;\n\nexport default class NoSleep {\n constructor(player) {\n this.player = player;\n this.enabled = false;\n if (nativeWakeLock()) {\n this._wakeLock = null;\n const handleVisibilityChange = () => {\n if (this._wakeLock !== null && document.visibilityState === \"visible\") {\n this.enable();\n }\n };\n document.addEventListener(\"visibilitychange\", handleVisibilityChange);\n document.addEventListener(\"fullscreenchange\", handleVisibilityChange);\n } else if (oldIOS()) {\n this.noSleepTimer = null;\n } else {\n // Set up no sleep video element\n this.noSleepVideo = document.createElement(\"video\");\n\n this.noSleepVideo.setAttribute(\"title\", \"No Sleep\");\n this.noSleepVideo.setAttribute(\"playsinline\", \"\");\n\n this._addSourceToVideo(this.noSleepVideo, \"webm\", WEBM);\n this._addSourceToVideo(this.noSleepVideo, \"mp4\", MP4);\n\n this.noSleepVideo.addEventListener(\"loadedmetadata\", () => {\n if (this.noSleepVideo.duration <= 1) {\n // webm source\n this.noSleepVideo.setAttribute(\"loop\", \"\");\n } else {\n // mp4 source\n this.noSleepVideo.addEventListener(\"timeupdate\", () => {\n if (this.noSleepVideo.currentTime > 0.5) {\n this.noSleepVideo.currentTime = Math.random();\n }\n });\n }\n });\n }\n }\n\n _addSourceToVideo(element, type, dataURI) {\n var source = document.createElement(\"source\");\n source.src = dataURI;\n source.type = `video/${type}`;\n element.appendChild(source);\n }\n\n get isEnabled() {\n return this.enabled;\n }\n\n enable() {\n const debug = this.player.debug;\n if (nativeWakeLock()) {\n return navigator.wakeLock\n .request(\"screen\")\n .then((wakeLock) => {\n this._wakeLock = wakeLock;\n this.enabled = true;\n debug.log('wakeLock', 'Wake Lock active.')\n this._wakeLock.addEventListener(\"release\", () => {\n // ToDo: Potentially emit an event for the page to observe since\n // Wake Lock releases happen when page visibility changes.\n // (https://web.dev/wakelock/#wake-lock-lifecycle)\n debug.log('wakeLock', 'Wake Lock released.')\n });\n })\n .catch((err) => {\n this.enabled = false;\n debug.error('wakeLock', `${err.name}, ${err.message}`)\n throw err;\n });\n } else if (oldIOS()) {\n this.disable();\n this.noSleepTimer = window.setInterval(() => {\n if (!document.hidden) {\n window.location.href = window.location.href.split(\"#\")[0];\n window.setTimeout(window.stop, 0);\n }\n }, 15000);\n this.enabled = true;\n return Promise.resolve();\n } else {\n let playPromise = this.noSleepVideo.play();\n return playPromise\n .then((res) => {\n this.enabled = true;\n return res;\n })\n .catch((err) => {\n this.enabled = false;\n throw err;\n });\n }\n }\n\n disable() {\n const debug = this.player.debug;\n if (nativeWakeLock()) {\n if (this._wakeLock) {\n this._wakeLock.release();\n }\n this._wakeLock = null;\n } else if (oldIOS()) {\n if (this.noSleepTimer) {\n debug.warn('wakeLock', 'NoSleep now disabled for older iOS devices.')\n\n window.clearInterval(this.noSleepTimer);\n this.noSleepTimer = null;\n }\n } else {\n this.noSleepVideo.pause();\n }\n this.enabled = false;\n }\n}\n","import {DEFAULT_PLAYER_OPTIONS, EVENTS, EVENTS_ERROR, JESSIBUCA_EVENTS,VERSION} from \"../constant\";\nimport Debug from \"../utils/debug\";\nimport Events from \"../utils/events\";\nimport property from './property';\nimport events from './events';\nimport {\n fpsStatus,\n initPlayTimes,\n isEmpty, isFalse,\n isFullScreen, isMobile,isPad,\n isNotEmpty,\n now, supportMediaStreamTrack,\n supportMSE,\n supportOffscreenV2,\n supportWCS\n} from \"../utils\";\nimport Video from \"../video\";\nimport Audio from \"../audio\";\nimport Stream from \"../stream\";\nimport Recorder from \"../recorder\";\nimport DecoderWorker from \"../worker/index\";\nimport Emitter from \"../utils/emitter\";\nimport Demux from \"../demux\";\nimport WebcodecsDecoder from \"../decoder/webcodecs\";\nimport Control from \"../control\";\nimport './style.scss'\nimport observer from \"./observer\";\nimport MseDecoder from \"../decoder/mediaSource\";\nimport NoSleep from \"../utils/noSleep\";\nimport screenfull from \"screenfull\";\n\nexport default class Player extends Emitter {\n constructor(container, options) {\n super()\n this.$container = container;\n this._opt = Object.assign({}, DEFAULT_PLAYER_OPTIONS, options)\n this.debug = new Debug(this);\n this.debug.log('Player', 'init');\n\n // disable offscreen\n this._opt.forceNoOffscreen = true;\n\n if (isMobile() || isPad()) {\n this.debug.log('Player', 'isMobile and set _opt.controlAutoHide false');\n this._opt.controlAutoHide = false;\n }\n\n if (screenfull.isEnabled &&\n this._opt.useWebFullScreen) {\n this.debug.log('Player', 'screenfull.isEnabled is true and _opt.useWebFullScreen is true , set _opt.useWebFullScreen false');\n this._opt.useWebFullScreen = false;\n }\n\n if (isFalse(screenfull.isEnabled) &&\n isFalse(this._opt.useWebFullScreen)) {\n this.debug.log('Player', 'screenfull.isEnabled is false and _opt.useWebFullScreen is false , set _opt.useWebFullScreen true');\n this._opt.useWebFullScreen = true;\n }\n\n\n //\n if (this._opt.useWCS) {\n this._opt.useWCS = supportWCS();\n }\n\n //\n if (this._opt.useMSE) {\n this._opt.useMSE = supportMSE();\n }\n\n //\n if (this._opt.wcsUseVideoRender) {\n this._opt.wcsUseVideoRender = supportMediaStreamTrack()\n }\n\n // 如果使用mse则强制不允许 webcodecs\n if (this._opt.useMSE) {\n if (this._opt.useWCS) {\n this.debug.log('Player', 'useWCS set true->false')\n }\n\n if (!this._opt.forceNoOffscreen) {\n this.debug.log('Player', 'forceNoOffscreen set false->true')\n }\n\n this._opt.useWCS = false;\n this._opt.forceNoOffscreen = true;\n }\n\n if (!this._opt.forceNoOffscreen) {\n if (!supportOffscreenV2()) {\n this._opt.forceNoOffscreen = true;\n this._opt.useOffscreen = false;\n } else {\n this._opt.useOffscreen = true;\n }\n }\n\n if (!this._opt.hasAudio) {\n this._opt.operateBtns.audio = false\n }\n\n this._opt.hasControl = this._hasControl();\n //\n this._loading = false;\n this._playing = false;\n this._hasLoaded = false;\n\n //\n this._checkHeartTimeout = null;\n this._checkLoadingTimeout = null;\n this._checkStatsInterval = null;\n\n //\n this._startBpsTime = null;\n this._isPlayingBeforePageHidden = false;\n this._stats = {\n buf: 0, // 当前缓冲区时长,单位毫秒,\n fps: 0, // 当前视频帧率\n abps: 0, // 当前音频码率,单位bit\n vbps: 0, // 当前视频码率,单位bit\n ts: 0 // 当前视频帧pts,单位毫秒\n }\n\n // 各个步骤的时间统计\n this._times = initPlayTimes();\n\n //\n this._videoTimestamp = 0;\n this._audioTimestamp = 0;\n\n property(this);\n\n this.events = new Events(this);\n this.video = new Video(this);\n\n if (this._opt.hasAudio) {\n this.audio = new Audio(this);\n }\n this.recorder = new Recorder(this);\n\n if (!this._onlyMseOrWcsVideo()) {\n this.decoderWorker = new DecoderWorker(this);\n } else {\n this.loaded = true;\n }\n\n this.stream = null;\n this.demux = null;\n this._lastVolume = null;\n\n if (this._opt.useWCS) {\n this.webcodecsDecoder = new WebcodecsDecoder(this)\n this.loaded = true\n }\n\n if (this._opt.useMSE) {\n this.mseDecoder = new MseDecoder(this);\n this.loaded = true\n }\n\n //\n this.control = new Control(this);\n\n if (isMobile()) {\n this.keepScreenOn = new NoSleep(this);\n }\n\n events(this);\n observer(this);\n this.debug.log('Player', 'init and version is',VERSION);\n\n if (this._opt.useWCS) {\n this.debug.log('Player', 'use WCS')\n }\n\n if (this._opt.useMSE) {\n this.debug.log('Player', 'use MSE')\n }\n\n if (this._opt.useOffscreen) {\n this.debug.log('Player', 'use offscreen')\n }\n\n try {\n this.debug.log('Player options', JSON.stringify(this._opt));\n } catch (e) {\n // ignore\n }\n }\n\n\n async destroy() {\n this._loading = false;\n this._playing = false;\n this._hasLoaded = false;\n this._lastVolume = null;\n this._times = initPlayTimes();\n\n if (this.decoderWorker) {\n await this.decoderWorker.destroy();\n this.decoderWorker = null;\n }\n if (this.video) {\n this.video.destroy();\n this.video = null;\n }\n\n if (this.audio) {\n this.audio.destroy();\n this.audio = null;\n }\n\n if (this.stream) {\n await this.stream.destroy();\n this.stream = null;\n }\n\n if (this.recorder) {\n this.recorder.destroy();\n this.recorder = null;\n }\n\n if (this.control) {\n this.control.destroy();\n this.control = null;\n }\n\n if (this.webcodecsDecoder) {\n this.webcodecsDecoder.destroy();\n this.webcodecsDecoder = null;\n }\n\n if (this.mseDecoder) {\n this.mseDecoder.destroy();\n this.mseDecoder = null;\n }\n\n if (this.demux) {\n this.demux.destroy();\n this.demux = null;\n }\n\n\n if (this.events) {\n this.events.destroy();\n this.events = null;\n }\n\n this.clearCheckHeartTimeout();\n this.clearCheckLoadingTimeout();\n this.clearStatsInterval();\n //\n this.releaseWakeLock();\n this.keepScreenOn = null;\n // reset stats\n this.resetStats();\n this._audioTimestamp = 0;\n this._videoTimestamp = 0;\n\n // 其他没法解耦的,通过 destroy 方式\n this.emit('destroy');\n // 接触所有绑定事件\n this.off();\n\n this.debug.log('play', 'destroy end');\n }\n\n set fullscreen(value) {\n if (isMobile() && this._opt.useWebFullScreen) {\n this.emit(EVENTS.webFullscreen, value);\n setTimeout(() => {\n this.updateOption({\n rotate: value ? 270 : 0,\n })\n this.resize();\n }, 10)\n } else {\n this.emit(EVENTS.fullscreen, value);\n }\n }\n\n get fullscreen() {\n return isFullScreen() || this.webFullscreen;\n }\n\n set webFullscreen(value) {\n this.emit(EVENTS.webFullscreen, value);\n }\n\n get webFullscreen() {\n return this.$container.classList.contains('jessibuca-fullscreen-web')\n }\n\n set loaded(value) {\n this._hasLoaded = value;\n }\n\n get loaded() {\n return this._hasLoaded;\n }\n\n //\n set playing(value) {\n\n if (value) {\n // 将loading 设置为 false\n this.loading = false;\n }\n\n if (this.playing !== value) {\n this._playing = value;\n this.emit(EVENTS.playing, value);\n this.emit(EVENTS.volumechange, this.volume);\n\n if (value) {\n this.emit(EVENTS.play);\n } else {\n this.emit(EVENTS.pause);\n }\n }\n }\n\n get playing() {\n return this._playing;\n }\n\n get volume() {\n return (this.audio && this.audio.volume) || 0;\n }\n\n set volume(value) {\n if (value !== this.volume) {\n this.audio && this.audio.setVolume(value);\n this._lastVolume = value;\n }\n }\n\n get lastVolume() {\n return this._lastVolume\n }\n\n set loading(value) {\n if (this.loading !== value) {\n this._loading = value;\n this.emit(EVENTS.loading, this._loading);\n }\n }\n\n get loading() {\n return this._loading;\n }\n\n set recording(value) {\n if (value) {\n if (this.playing) {\n this.recorder && this.recorder.startRecord();\n }\n } else {\n this.recorder && this.recorder.stopRecordAndSave();\n }\n }\n\n get recording() {\n return this.recorder ? this.recorder.recording : false;\n }\n\n set audioTimestamp(value) {\n if (value === null) {\n return;\n }\n this._audioTimestamp = value;\n }\n\n //\n get audioTimestamp() {\n return this._audioTimestamp;\n }\n\n //\n set videoTimestamp(value) {\n if (value === null) {\n return;\n }\n this._videoTimestamp = value;\n // just for wasm\n if (!this._opt.useWCS && !this._opt.useMSE) {\n if (this.audioTimestamp && this.videoTimestamp) {\n this.audio && this.audio.emit(EVENTS.videoSyncAudio, {\n audioTimestamp: this.audioTimestamp,\n videoTimestamp: this.videoTimestamp,\n diff: this.audioTimestamp - this.videoTimestamp\n })\n }\n }\n }\n\n //\n get videoTimestamp() {\n return this._videoTimestamp;\n }\n\n get isDebug() {\n return this._opt.debug === true;\n }\n\n\n /**\n *\n * @param options\n */\n updateOption(options) {\n this._opt = Object.assign({}, this._opt, options)\n }\n\n /**\n *\n * @returns {Promise}\n */\n init() {\n return new Promise((resolve, reject) => {\n if (!this.stream) {\n this.stream = new Stream(this);\n }\n\n if (!this.audio) {\n if (this._opt.hasAudio) {\n this.audio = new Audio(this);\n }\n }\n if (!this.demux) {\n this.demux = new Demux(this);\n }\n\n if (this._opt.useWCS) {\n if (!this.webcodecsDecoder) {\n this.webcodecsDecoder = new WebcodecsDecoder(this)\n }\n }\n\n if (this._opt.useMSE) {\n if (!this.mseDecoder) {\n this.mseDecoder = new MseDecoder(this);\n }\n }\n\n if (!this.decoderWorker && !this._onlyMseOrWcsVideo()) {\n this.decoderWorker = new DecoderWorker(this);\n this.debug.log('Player', 'waiting decoderWorker init');\n this.once(EVENTS.decoderWorkerInit, () => {\n this.debug.log('Player', 'decoderWorker init success');\n resolve()\n })\n } else {\n resolve()\n }\n\n })\n }\n\n\n /**\n *\n * @param url\n * @returns {Promise}\n */\n play(url, options) {\n return new Promise((resolve, reject) => {\n if (!url && !this._opt.url) {\n return reject();\n }\n\n this.loading = true;\n this.playing = false;\n this._times.playInitStart = now();\n if (!url) {\n url = this._opt.url;\n }\n this._opt.url = url;\n\n this.clearCheckHeartTimeout();\n\n this.init().then(() => {\n this._times.playStart = now();\n //\n if (this._opt.isNotMute) {\n this.mute(false);\n }\n\n\n if (this.webcodecsDecoder) {\n this.webcodecsDecoder.once(EVENTS_ERROR.webcodecsH265NotSupport, () => {\n this.emit(EVENTS_ERROR.webcodecsH265NotSupport)\n if (!this._opt.autoWasm) {\n this.emit(EVENTS.error, EVENTS_ERROR.webcodecsH265NotSupport);\n }\n })\n }\n\n if (this.mseDecoder) {\n this.mseDecoder.once(EVENTS_ERROR.mediaSourceH265NotSupport, () => {\n this.emit(EVENTS_ERROR.mediaSourceH265NotSupport)\n if (!this._opt.autoWasm) {\n this.emit(EVENTS.error, EVENTS_ERROR.mediaSourceH265NotSupport);\n }\n })\n\n this.mseDecoder.once(EVENTS_ERROR.mediaSourceFull, () => {\n this.emitError(EVENTS_ERROR.mediaSourceFull)\n })\n\n this.mseDecoder.once(EVENTS_ERROR.mediaSourceAppendBufferError, () => {\n this.emitError(EVENTS_ERROR.mediaSourceAppendBufferError)\n })\n\n this.mseDecoder.once(EVENTS_ERROR.mediaSourceBufferListLarge, () => {\n this.emitError(EVENTS_ERROR.mediaSourceBufferListLarge);\n })\n\n this.mseDecoder.once(EVENTS_ERROR.mediaSourceAppendBufferEndTimeout, () => {\n this.emitError(EVENTS_ERROR.mediaSourceAppendBufferEndTimeout);\n })\n }\n\n this.enableWakeLock();\n\n this.stream.fetchStream(url, options);\n\n //\n this.checkLoadingTimeout();\n // fetch error\n this.stream.once(EVENTS_ERROR.fetchError, (error) => {\n // reject(error)\n this.emitError(EVENTS_ERROR.fetchError, error);\n })\n\n // ws\n this.stream.once(EVENTS_ERROR.websocketError, (error) => {\n // reject(error)\n this.emitError(EVENTS_ERROR.websocketError, error);\n })\n\n // stream end\n this.stream.once(EVENTS.streamEnd, (msg) => {\n // reject();\n this.emitError(EVENTS.streamEnd, msg);\n })\n\n // success\n this.stream.once(EVENTS.streamSuccess, () => {\n resolve();\n this._times.streamResponse = now();\n //\n this.video.play();\n this.checkStatsInterval();\n })\n\n }).catch((e) => {\n reject(e)\n })\n })\n }\n\n /**\n *\n */\n close() {\n return new Promise((resolve, reject) => {\n this._close().then(() => {\n this.video && this.video.clearView();\n resolve()\n })\n })\n }\n\n resumeAudioAfterPause() {\n if (this.lastVolume) {\n this.volume = this.lastVolume;\n }\n }\n\n _close() {\n return new Promise((resolve, reject) => {\n //\n if (this.stream) {\n this.stream.destroy();\n this.stream = null;\n }\n\n if (this.demux) {\n this.demux.destroy();\n this.demux = null;\n }\n\n //\n if (this.decoderWorker) {\n this.decoderWorker.destroy();\n this.decoderWorker = null;\n }\n\n if (this.webcodecsDecoder) {\n this.webcodecsDecoder.destroy();\n this.webcodecsDecoder = null;\n }\n\n if (this.mseDecoder) {\n this.mseDecoder.destroy();\n this.mseDecoder = null;\n }\n\n if (this.audio) {\n this.audio.destroy();\n this.audio = null;\n }\n this.clearCheckHeartTimeout();\n this.clearCheckLoadingTimeout();\n this.clearStatsInterval();\n this.playing = false;\n this.loading = false;\n this.recording = false;\n\n if (this.video) {\n this.video.resetInit();\n this.video.pause(true);\n }\n // release lock\n this.releaseWakeLock();\n // reset stats\n this.resetStats();\n //\n this._audioTimestamp = 0;\n this._videoTimestamp = 0;\n //\n this._times = initPlayTimes();\n //\n setTimeout(() => {\n resolve()\n }, 0)\n })\n }\n\n /**\n *\n * @param flag {boolean} 是否清除画面\n * @returns {Promise}\n */\n pause(flag = false) {\n if (flag) {\n return this.close();\n } else {\n return this._close();\n }\n }\n\n /**\n *\n * @param flag\n */\n mute(flag) {\n this.audio && this.audio.mute(flag)\n }\n\n /**\n *\n */\n resize() {\n this.video.resize();\n }\n\n /**\n *\n * @param fileName\n * @param fileType\n */\n startRecord(fileName, fileType) {\n if (this.recording) {\n return;\n }\n\n this.recorder.setFileName(fileName, fileType);\n this.recording = true;\n }\n\n /**\n *\n */\n stopRecordAndSave() {\n if (this.recording) {\n this.recording = false;\n }\n }\n\n _hasControl() {\n let result = false;\n\n let hasBtnShow = false;\n Object.keys(this._opt.operateBtns).forEach((key) => {\n if (this._opt.operateBtns[key]) {\n hasBtnShow = true;\n }\n });\n\n if (this._opt.showBandwidth || this._opt.text || hasBtnShow) {\n result = true;\n }\n\n return result;\n }\n\n _onlyMseOrWcsVideo() {\n return this._opt.hasAudio === false && (this._opt.useMSE || (this._opt.useWCS && !this._opt.useOffscreen))\n }\n\n checkHeart() {\n this.clearCheckHeartTimeout();\n this.checkHeartTimeout();\n }\n\n // 心跳检查,如果渲染间隔暂停了多少时间之后,就会抛出异常\n checkHeartTimeout() {\n this._checkHeartTimeout = setTimeout(() => {\n if (this.playing) {\n // check again\n if (this._stats.fps !== 0) {\n return;\n }\n this.pause().then(() => {\n this.emit(EVENTS.timeout, EVENTS.delayTimeout);\n this.emit(EVENTS.delayTimeout);\n });\n }\n\n }, this._opt.heartTimeout * 1000)\n }\n\n checkStatsInterval() {\n this._checkStatsInterval = setInterval(() => {\n this.updateStats();\n }, 1000)\n }\n\n //\n clearCheckHeartTimeout() {\n if (this._checkHeartTimeout) {\n clearTimeout(this._checkHeartTimeout);\n this._checkHeartTimeout = null;\n }\n }\n\n // loading 等待时间\n checkLoadingTimeout() {\n this._checkLoadingTimeout = setTimeout(() => {\n // check again\n if (this.playing) {\n return;\n }\n this.pause().then(() => {\n this.emit(EVENTS.timeout, EVENTS.loadingTimeout);\n this.emit(EVENTS.loadingTimeout);\n });\n }, this._opt.loadingTimeout * 1000)\n }\n\n clearCheckLoadingTimeout() {\n if (this._checkLoadingTimeout) {\n clearTimeout(this._checkLoadingTimeout);\n this._checkLoadingTimeout = null;\n }\n }\n\n clearStatsInterval() {\n if (this._checkStatsInterval) {\n clearInterval(this._checkStatsInterval);\n this._checkStatsInterval = null;\n }\n }\n\n handleRender() {\n if (this.loading) {\n this.emit(EVENTS.start);\n this.loading = false;\n this.clearCheckLoadingTimeout();\n }\n if (!this.playing) {\n this.playing = true;\n }\n this.checkHeart();\n }\n\n\n //\n updateStats(options) {\n options = options || {};\n\n if (!this._startBpsTime) {\n this._startBpsTime = now();\n }\n\n if (isNotEmpty(options.ts)) {\n this._stats.ts = options.ts;\n }\n\n if (isNotEmpty(options.buf)) {\n this._stats.buf = options.buf;\n }\n\n if (options.fps) {\n this._stats.fps += 1;\n }\n if (options.abps) {\n this._stats.abps += options.abps;\n }\n if (options.vbps) {\n this._stats.vbps += options.vbps;\n }\n\n const _nowTime = now();\n const timestamp = _nowTime - this._startBpsTime;\n\n if (timestamp < 1 * 1000) {\n return;\n }\n\n this.emit(EVENTS.stats, this._stats);\n this.emit(EVENTS.performance, fpsStatus(this._stats.fps));\n this._stats.fps = 0;\n this._stats.abps = 0;\n this._stats.vbps = 0;\n this._startBpsTime = _nowTime;\n }\n\n resetStats() {\n this._startBpsTime = null;\n this._stats = {\n buf: 0, //ms\n fps: 0,\n abps: 0,\n vbps: 0,\n ts: 0\n }\n }\n\n enableWakeLock() {\n if (this._opt.keepScreenOn) {\n this.keepScreenOn && this.keepScreenOn.enable();\n }\n }\n\n releaseWakeLock() {\n if (this._opt.keepScreenOn) {\n this.keepScreenOn && this.keepScreenOn.disable();\n }\n }\n\n handlePlayToRenderTimes() {\n const _times = this._times;\n _times.playTimestamp = _times.playStart - _times.playInitStart;\n _times.streamTimestamp = _times.streamStart - _times.playStart;\n _times.streamResponseTimestamp = _times.streamResponse - _times.streamStart;\n _times.demuxTimestamp = _times.demuxStart - _times.streamResponse;\n _times.decodeTimestamp = _times.decodeStart - _times.demuxStart;\n _times.videoTimestamp = _times.videoStart - _times.decodeStart;\n _times.allTimestamp = _times.videoStart - _times.playInitStart;\n this.emit(EVENTS.playToRenderTimes, _times);\n }\n\n getOption() {\n return this._opt;\n }\n\n emitError(errorType, message = '') {\n this.emit(EVENTS.error, errorType, message);\n this.emit(errorType, message);\n }\n\n isControlBarShow() {\n const hasControl = this._opt.hasControl;\n const controlAutoHide = this._opt.controlAutoHide;\n\n let result = hasControl && !controlAutoHide;\n\n if (result) {\n if (this.control) {\n result = this.control.getBarIsShow();\n }\n }\n\n return result;\n }\n\n getControlBarShow(){\n let result = false;\n if (this.control) {\n result = this.control.getBarIsShow();\n }\n return result;\n }\n\n toggleControlBar(isShow) {\n if (this.control) {\n this.control.toggleBar(isShow);\n this.resize();\n }\n }\n}\n","import Player from './player';\nimport Events from \"./utils/events\";\nimport {\n CONTAINER_DATA_SET_KEY,\n DEMUX_TYPE,\n EVENTS,\n EVENTS_ERROR,\n JESSIBUCA_EVENTS,\n PLAYER_PLAY_PROTOCOL,\n SCALE_MODE_TYPE,\n VERSION\n} from \"./constant\";\nimport {\n getElementDataset,\n isEmpty,\n isMobile,\n isNotEmpty,\n removeElementDataset,\n setElementDataset,\n supportWCS,\n uuid16\n} from \"./utils\";\nimport Emitter from \"./utils/emitter\";\nimport Debug from \"./utils/debug\";\n\n\nclass Jessibuca extends Emitter {\n static ERROR = EVENTS_ERROR\n\n static TIMEOUT = {\n loadingTimeout: EVENTS.loadingTimeout,\n delayTimeout: EVENTS.delayTimeout,\n }\n\n constructor(options) {\n super()\n let _opt = options;\n let $container = options.container;\n if (typeof options.container === 'string') {\n $container = document.querySelector(options.container);\n }\n if (!$container) {\n throw new Error('Jessibuca need container option');\n return;\n }\n // check container node name\n if ($container.nodeName === 'CANVAS' || $container.nodeName === 'VIDEO') {\n throw new Error(`Jessibuca container type can not be ${$container.nodeName} type`);\n return;\n }\n\n if (_opt.videoBuffer >= _opt.heartTimeout) {\n throw new Error(`Jessibuca videoBuffer ${_opt.videoBuffer}s must be less than heartTimeout ${_opt.heartTimeout}s`);\n return;\n }\n\n\n if (this._checkHasCreated($container)) {\n throw new Error(`Jessibuca container has been created and can not be created again`, $container);\n return;\n }\n\n // videoBuffer set too long\n if (_opt.videoBuffer > 10) {\n console.warn('Jessibuca', `videoBuffer ${_opt.videoBuffer}s is too long, will black screen for ${_opt.videoBuffer}s , it is recommended to set it to less than 10s`);\n }\n\n if (!$container.classList) {\n throw new Error('Jessibuca container option must be DOM Element');\n return;\n }\n\n $container.classList.add('jessibuca-container');\n setElementDataset($container, CONTAINER_DATA_SET_KEY, uuid16());\n\n delete _opt.container;\n\n // 禁用离屏渲染\n _opt.forceNoOffscreen = true;\n\n // 移动端不支持自动关闭控制栏\n if (isMobile()) {\n _opt.controlAutoHide = false;\n }\n\n // s -> ms\n if (isNotEmpty(_opt.videoBuffer)) {\n _opt.videoBuffer = Number(_opt.videoBuffer) * 1000\n }\n\n // setting\n if (isNotEmpty(_opt.timeout)) {\n if (isEmpty(_opt.loadingTimeout)) {\n _opt.loadingTimeout = _opt.timeout;\n }\n\n if (isEmpty(_opt.heartTimeout)) {\n _opt.heartTimeout = _opt.timeout\n }\n }\n\n this._opt = _opt;\n this.$container = $container;\n this._loadingTimeoutReplayTimes = 0;\n this._heartTimeoutReplayTimes = 0;\n this.initDecoderWorkerTimeout = null;\n this._destroyed = false;\n this.events = new Events(this);\n this.debug = new Debug(this);\n this._initPlayer($container, _opt);\n console.log(`Jessibuca version: ${VERSION}`);\n }\n\n /**\n *\n */\n async destroy() {\n this._destroyed = true;\n this.off();\n this._clearInitDecoderWorkerTimeout();\n if (this.player) {\n await this.player.destroy();\n this.player = null;\n }\n\n if (this.events) {\n this.events.destroy();\n this.events = null;\n }\n\n if (this.$container) {\n this.$container.classList.remove('jessibuca-container');\n this.$container.classList.remove('jessibuca-fullscreen-web');\n removeElementDataset(this.$container, CONTAINER_DATA_SET_KEY);\n this.$container = null;\n }\n this._opt = {};\n this._loadingTimeoutReplayTimes = 0;\n this._heartTimeoutReplayTimes = 0;\n }\n\n _initPlayer($container, options) {\n this.player = new Player($container, options);\n try {\n this.debug.log('jessibuca', '_initPlayer', JSON.stringify(this.player.getOption()))\n } catch (e) {\n // ignore\n }\n this._bindEvents();\n }\n\n _resetPlayer(options = {}) {\n this.player.destroy();\n this.player = null;\n this._opt = Object.assign(this._opt, options);\n this._opt.url = '';// reset url\n this._initPlayer(this.$container, this._opt);\n }\n\n _bindEvents() {\n // 对外的事件\n Object.keys(JESSIBUCA_EVENTS).forEach((key) => {\n this.player.on(JESSIBUCA_EVENTS[key], (value) => {\n this.emit(key, value)\n })\n })\n }\n\n /**\n * 是否销毁\n * @returns {boolean}\n */\n isDestroyed() {\n return this._destroyed;\n }\n\n /**\n * 是否开启控制台调试打印\n * @param value {Boolean}\n */\n setDebug(value) {\n this.player.updateOption({\n debug: !!value\n })\n }\n\n /**\n *\n */\n mute() {\n this.player.mute(true);\n }\n\n /**\n *\n */\n cancelMute() {\n this.player.mute(false);\n }\n\n /**\n *\n * @param value {number}\n */\n setVolume(value) {\n this.player.volume = value;\n }\n\n /**\n *\n */\n audioResume() {\n this.player.audio && this.player.audio.audioEnabled(true);\n }\n\n /**\n * 设置超时时长, 单位秒 在连接成功之前和播放中途,如果超过设定时长无数据返回,则回调timeout事件\n * @param value {number}\n */\n setTimeout(time) {\n time = Number(time);\n this.player.updateOption({\n timeout: time,\n loadingTimeout: time,\n heartTimeout: time\n })\n }\n\n /**\n *\n * @param type {number}: 0,1,2\n */\n setScaleMode(type) {\n type = Number(type);\n let options = {\n isFullResize: false,\n isResize: false\n }\n switch (type) {\n case SCALE_MODE_TYPE.full:\n options.isFullResize = false;\n options.isResize = false;\n break;\n case SCALE_MODE_TYPE.auto:\n options.isFullResize = false;\n options.isResize = true;\n break;\n case SCALE_MODE_TYPE.fullAuto:\n options.isFullResize = true;\n options.isResize = true;\n break;\n }\n\n this.player.updateOption(options);\n this.resize();\n }\n\n /**\n *\n * @returns {Promise}\n */\n pause() {\n return new Promise((resolve, reject) => {\n if (this.player) {\n this.player.pause().then(() => {\n resolve();\n }).catch((e) => {\n reject(e)\n });\n } else {\n reject('player is null')\n }\n })\n }\n\n /**\n *\n */\n async close() {\n await this.destroy();\n return true;\n }\n\n\n /**\n *\n */\n clearView() {\n this.player.video.clearView()\n }\n\n /**\n *\n * @param url {string}\n * @param options {object}\n * @returns {Promise}\n */\n play(url, options = {}) {\n return new Promise((resolve, reject) => {\n if (this.isDestroyed()) {\n reject('Jessibuca is destroyed')\n return;\n }\n\n if (!url && !this._opt.url) {\n this.emit(EVENTS.error, EVENTS_ERROR.playError)\n reject('play url is empty')\n return;\n }\n\n if (url) {\n // url 相等的时候。\n if (this._opt.url) {\n // 存在相同的 url\n if (url === this._opt.url) {\n // 正在播放\n if (this.player.playing) {\n resolve();\n } else {\n // pause -> play\n this.clearView();\n this.player.play(this._opt.url, this._opt.playOptions).then(() => {\n resolve();\n // 恢复下之前的音量\n this.player.resumeAudioAfterPause();\n }).catch((e) => {\n this.debug.warn('jessibuca', 'pause -> play and play error', e)\n this.player.pause().then(() => {\n reject(e);\n })\n })\n }\n } else {\n // url 发生改变了\n this.player.pause().then(() => {\n // 清除 画面\n this.clearView();\n this._play(url, options).then(() => {\n resolve()\n }).catch((e) => {\n this.debug.warn('jessibuca', 'this._play error', e)\n reject(e)\n });\n }).catch((e) => {\n this.debug.warn('jessibuca', 'this._opt.url is null and pause error', e)\n reject(e);\n })\n }\n } else {\n this._play(url, options).then(() => {\n resolve()\n }).catch((e) => {\n this.debug.warn('jessibuca', 'this._play error', e)\n reject(e)\n });\n }\n } else {\n // url 不存在的时候\n // 就是从 play -> pause -> play\n this.player.play(this._opt.url, this._opt.playOptions).then(() => {\n resolve();\n // 恢复下之前的音量\n this.player.resumeAudioAfterPause();\n }).catch((e) => {\n this.debug.warn('jessibuca', 'url is null and play error', e)\n this.player.pause().then(() => {\n reject(e);\n })\n })\n }\n })\n }\n\n /**\n *\n * @param url {string}\n * @param options {object}\n * @returns {Promise}\n * @private\n */\n _play(url, options = {}) {\n return new Promise((resolve, reject) => {\n this._opt.url = url;\n this._opt.playOptions = options;\n // 新的url\n const isHttp = url.indexOf(\"http\") === 0;\n //\n const protocol = isHttp ? PLAYER_PLAY_PROTOCOL.fetch : PLAYER_PLAY_PROTOCOL.websocket\n //\n const demuxType = (isHttp || url.indexOf(\".flv\") !== -1 || this._opt.isFlv) ? DEMUX_TYPE.flv : DEMUX_TYPE.m7s;\n\n this.player.updateOption({\n protocol,\n demuxType\n })\n\n this.player.once(EVENTS_ERROR.webglAlignmentError, () => {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'webglAlignmentError')\n this._resetPlayer({openWebglAlignment: true})\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'webglAlignmentError and play success')\n }).catch(() => {\n // reject();\n this.debug.log('Jessibuca', 'webglAlignmentError and play error')\n });\n });\n })\n\n\n this.player.once(EVENTS_ERROR.mediaSourceH265NotSupport, () => {\n this.pause().then(() => {\n if (this.player._opt.autoWasm) {\n this.debug.log('Jessibuca', 'auto wasm [mse-> wasm] reset player and play')\n this._resetPlayer({useMSE: false})\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'auto wasm [mse-> wasm] reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.log('Jessibuca', 'auto wasm [mse-> wasm] reset player and play error')\n });\n } else {\n this.debug.log('Jessibuca', 'media source h265 not support and paused');\n }\n });\n })\n\n // media source full error\n this.player.once(EVENTS_ERROR.mediaSourceFull, () => {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'media source full');\n this._resetPlayer()\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'media source full and reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.warn('Jessibuca', 'media source full and reset player and play error')\n });\n })\n })\n // media source append buffer error\n this.player.once(EVENTS_ERROR.mediaSourceAppendBufferError, () => {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'media source append buffer error');\n this._resetPlayer()\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'media source append buffer error and reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.warn('Jessibuca', 'media source append buffer error and reset player and play error')\n });\n })\n })\n\n this.player.once(EVENTS_ERROR.mediaSourceBufferListLarge, () => {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'media source buffer list large');\n this._resetPlayer()\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'media source buffer list large and reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.warn('Jessibuca', 'media source buffer list large and reset player and play error')\n });\n })\n })\n\n this.player.once(EVENTS_ERROR.mediaSourceAppendBufferEndTimeout, () => {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'media source append buffer end timeout');\n this._resetPlayer()\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'media source append buffer end timeout and reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.warn('Jessibuca', 'media source append buffer end timeout and reset player and play error')\n });\n })\n })\n\n this.player.once(EVENTS_ERROR.mseSourceBufferError, () => {\n this.pause().then(() => {\n if (this.player._opt.autoWasm) {\n this.debug.log('Jessibuca', 'auto wasm [mse-> wasm] reset player and play')\n this._resetPlayer({useMSE: false})\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'auto wasm [mse-> wasm] reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.warn('Jessibuca', 'auto wasm [mse-> wasm] reset player and play error')\n });\n } else {\n this.debug.log('Jessibuca', 'mse source buffer error and paused');\n }\n })\n })\n //\n this.player.once(EVENTS_ERROR.webcodecsH265NotSupport, () => {\n this.pause().then(() => {\n if (this.player._opt.autoWasm) {\n this.debug.log('Jessibuca', 'auto wasm [wcs-> wasm] reset player and play')\n this._resetPlayer({useWCS: false})\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'auto wasm [wcs-> wasm] reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.warn('Jessibuca', 'auto wasm [wcs-> wasm] reset player and play error')\n });\n } else {\n this.debug.log('Jessibuca', 'webcodecs h265 not support and paused');\n }\n });\n })\n // webcodecs\n this.player.once(EVENTS_ERROR.webcodecsWidthOrHeightChange, () => {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'webcodecs Width Or Height Change reset player and play')\n this._resetPlayer({useWCS: true})\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'webcodecs Width Or Height Change reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.warn('Jessibuca', 'webcodecs Width Or Height Change reset player and play error')\n });\n });\n })\n // webcodecs\n this.player.once(EVENTS_ERROR.webcodecsDecodeError, () => {\n this.pause().then(() => {\n if (this.player._opt.autoWasm) {\n this.debug.log('Jessibuca', 'webcodecs decode error reset player and play')\n this._resetPlayer({useWCS: false})\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'webcodecs decode error reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.warn('Jessibuca', 'webcodecs decode error reset player and play error')\n });\n } else {\n this.debug.log('Jessibuca', 'webcodecs decode error and paused');\n }\n });\n })\n // webcodecs\n this.player.once(EVENTS_ERROR.webcodecsConfigureError, () => {\n this.pause().then(() => {\n if (this.player._opt.autoWasm) {\n this.debug.log('Jessibuca', 'webcodecs Configure error reset player and play')\n this._resetPlayer({useWCS: false})\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'webcodecs Configure error reset player and play success')\n }).catch(() => {\n // reject();\n this.debug.warn('Jessibuca', 'webcodecs Configure error reset player and play error')\n });\n } else {\n this.debug.log('Jessibuca', 'webcodecs Configure error and paused');\n }\n });\n })\n // wasm。\n this.player.once(EVENTS_ERROR.wasmDecodeError, () => {\n if (this.player._opt.wasmDecodeErrorReplay) {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'wasm decode error and reset player and play')\n this._resetPlayer({useWCS: false})\n this.play(url, options).then(() => {\n // resolve();\n this.debug.log('Jessibuca', 'wasm decode error and reset player and play success')\n }).catch((e) => {\n // reject();\n this.debug.warn('Jessibuca', 'wasm decode error and reset player and play error')\n });\n })\n } else {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'wasm decode error and paused');\n }).catch((e) => {\n this.debug.warn('Jessibuca', 'wasm decode error and paused error', e)\n })\n }\n })\n // fetch error\n this.player.once(EVENTS_ERROR.fetchError, () => {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'fetch error and pause play')\n }).catch((e) => {\n this.debug.warn('Jessibuca', 'fetch error and pause play error', e)\n })\n })\n\n //\n this.player.once(EVENTS_ERROR.websocketError, () => {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'websocket Error and pause play')\n }).catch((e) => {\n this.debug.warn('Jessibuca', 'websocket Error and pause play error', e)\n })\n })\n\n //\n this.player.once(EVENTS.streamEnd, () => {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'stream End and pause play')\n }).catch((e) => {\n this.debug.warn('Jessibuca', 'stream End and pause play error', e)\n })\n })\n\n // 监听 delay timeout\n this.player.on(EVENTS.delayTimeout, () => {\n if (this.player._opt.heartTimeoutReplay &&\n (this._heartTimeoutReplayTimes < this.player._opt.heartTimeoutReplayTimes || this.player._opt.heartTimeoutReplayTimes === -1)) {\n this.debug.log('Jessibuca', `delay timeout replay time is ${this._heartTimeoutReplayTimes}`)\n this._heartTimeoutReplayTimes += 1;\n this.play(url, options).then(() => {\n // resolve();\n this._heartTimeoutReplayTimes = 0;\n }).catch(() => {\n // reject();\n });\n }\n })\n\n // 监听 loading timeout\n this.player.on(EVENTS.loadingTimeout, () => {\n if (this.player._opt.loadingTimeoutReplay &&\n (this._loadingTimeoutReplayTimes < this.player._opt.loadingTimeoutReplayTimes || this.player._opt.loadingTimeoutReplayTimes === -1)) {\n this.debug.log('Jessibuca', `loading timeout replay time is ${this._loadingTimeoutReplayTimes}`)\n this._loadingTimeoutReplayTimes += 1;\n this.play(url, options).then(() => {\n // resolve();\n this._loadingTimeoutReplayTimes = 0;\n }).catch(() => {\n // reject();\n });\n }\n })\n\n\n if (this.hasLoaded()) {\n this.player.play(url, options).then(() => {\n resolve();\n }).catch((e) => {\n this.debug.warn('Jessibuca', 'hasLoaded and play error', e)\n this.player && this.player.pause().then(() => {\n reject(e);\n })\n })\n } else {\n this.debug.log('Jessibuca', '_play ant waiting decoderWorkerInit');\n this._checkInitDecoderWorkerTimeout();\n this.player.once(EVENTS.decoderWorkerInit, () => {\n this._clearInitDecoderWorkerTimeout();\n if (this.isDestroyed()) {\n return;\n }\n this.debug.log('Jessibuca', '_play decoderWorkerInit success and play');\n this.player.play(url, options).then(() => {\n resolve();\n }).catch((e) => {\n this.debug.warn('Jessibuca', 'decoderWorkerInit and play error', e)\n this.player && this.player.pause().then(() => {\n reject(e);\n })\n })\n })\n }\n })\n }\n\n\n /**\n *\n */\n resize() {\n this.player.resize();\n }\n\n /**\n *\n * @param time {number} s\n */\n setBufferTime(time) {\n time = Number(time)\n // s -> ms\n this.player.updateOption({\n videoBuffer: time * 1000\n })\n // update worker config\n this.player.decoderWorker && this.player.decoderWorker.updateWorkConfig({\n key: 'videoBuffer',\n value: time * 1000\n })\n }\n\n /**\n *\n * @param deg {number}\n */\n setRotate(deg) {\n deg = parseInt(deg, 10)\n const list = [0, 90, 180, 270];\n if (this._opt.rotate === deg || list.indexOf(deg) === -1) {\n return;\n }\n this.player.updateOption({\n rotate: deg\n })\n this.resize();\n }\n\n /**\n *\n * @returns {boolean}\n */\n hasLoaded() {\n return this.player.loaded;\n }\n\n /**\n *\n */\n setKeepScreenOn() {\n this.player.updateOption({\n keepScreenOn: true\n })\n }\n\n /**\n *\n * @param flag {Boolean}\n */\n setFullscreen(flag) {\n const fullscreen = !!flag;\n if (this.player.fullscreen !== fullscreen) {\n this.player.fullscreen = fullscreen;\n }\n }\n\n /**\n *\n * @param filename {string}\n * @param format {string}\n * @param quality {number}\n * @param type {string} download,base64,blob\n */\n screenshot(filename, format, quality, type) {\n\n if (!this.player.video) {\n return ''\n }\n\n return this.player.video.screenshot(filename, format, quality, type)\n }\n\n /**\n *\n * @param fileName {string}\n * @param fileType {string}\n * @returns {Promise}\n */\n startRecord(fileName, fileType) {\n return new Promise((resolve, reject) => {\n if (this.player.playing) {\n this.player.startRecord(fileName, fileType)\n resolve();\n } else {\n reject();\n }\n })\n }\n\n stopRecordAndSave() {\n if (this.player.recording) {\n this.player.stopRecordAndSave();\n }\n }\n\n /**\n *\n * @returns {Boolean}\n */\n isPlaying() {\n return this.player ? this.player.playing : false;\n }\n\n /**\n * 是否静音状态\n * @returns {Boolean}\n */\n isMute() {\n return this.player.audio ? this.player.audio.isMute : true;\n }\n\n /**\n * 是否在录制视频\n * @returns {*}\n */\n isRecording() {\n return this.player.recorder.recording;\n }\n\n _checkHasCreated(element) {\n if (!element) return false;\n const gbProV = getElementDataset(element, CONTAINER_DATA_SET_KEY);\n if (gbProV) {\n return true;\n }\n return false;\n }\n\n\n toggleControlBar(isShow) {\n if (this.isDestroyed()) {\n return;\n }\n\n if (this.player) {\n this.player.toggleControlBar(isShow);\n }\n }\n\n getControlBarShow() {\n if (this.isDestroyed()) {\n return false;\n }\n let result = false;\n if (this.player) {\n result = this.player.getControlBarShow();\n }\n return result;\n }\n\n _clearInitDecoderWorkerTimeout() {\n if (this.initDecoderWorkerTimeout) {\n clearTimeout(this.initDecoderWorkerTimeout);\n this.initDecoderWorkerTimeout = null;\n }\n }\n\n _checkInitDecoderWorkerTimeout() {\n this._clearInitDecoderWorkerTimeout();\n this.initDecoderWorkerTimeout = setTimeout(() => {\n this._handleInitDecoderWorkerTimeout();\n }, this._opt.initDecoderWorkerTimeout * 1000);\n }\n\n\n _handleInitDecoderWorkerTimeout() {\n this.pause().then(() => {\n this.debug.log('Jessibuca', 'init decoder worker timeout and pause play')\n }).catch((e) => {\n this.debug.warn('Jessibuca', 'init decoder worker timeout and pause play error', e)\n })\n }\n}\n\n\nwindow.Jessibuca = Jessibuca;\n\nexport default Jessibuca;\n\n"],"names":["PLAYER_PLAY_PROTOCOL","websocket","fetch","webrtc","DEMUX_TYPE","flv","m7s","FILE_SUFFIX","mp4","webm","CONTAINER_DATA_SET_KEY","VERSION","DEFAULT_PLAYER_OPTIONS","videoBuffer","videoBufferDelay","isResize","isFullResize","isFlv","debug","hotKey","loadingTimeout","heartTimeout","timeout","loadingTimeoutReplay","heartTimeoutReplay","loadingTimeoutReplayTimes","heartTimeoutReplayTimes","supportDblclickFullscreen","showBandwidth","keepScreenOn","isNotMute","hasAudio","hasVideo","operateBtns","fullscreen","screenshot","play","audio","record","controlAutoHide","hasControl","loadingText","background","decoder","url","rotate","forceNoOffscreen","hiddenAutoPause","protocol","demuxType","useWCS","wcsUseVideoRender","useMSE","useOffscreen","autoWasm","wasmDecodeErrorReplay","openWebglAlignment","wasmDecodeAudioSyncVideo","recordType","useWebFullScreen","initDecoderWorkerTimeout","WORKER_CMD_TYPE","init","initVideo","render","playAudio","initAudio","kBps","decode","audioCode","videoCode","wasmError","WASM_ERROR","invalidNalUnitSize","MEDIA_TYPE","video","FLV_MEDIA_TYPE","WORKER_SEND_TYPE","audioDecode","videoDecode","close","updateConfig","EVENTS","webFullscreen","decoderWorkerInit","playing","pause","mute","load","loading","videoInfo","timeUpdate","audioInfo","log","error","delayTimeout","stats","performance","recording","recordingTimestamp","recordStart","recordEnd","recordCreateError","buffer","videoFrame","start","metadata","resize","streamEnd","streamSuccess","streamMessage","streamError","volumechange","volume","destroy","mseSourceOpen","mseSourceClose","mseSourceBufferError","mseSourceBufferBusy","mseSourceBufferFull","videoWaiting","videoTimeUpdate","videoSyncAudio","playToRenderTimes","JESSIBUCA_EVENTS","EVENTS_ERROR","playError","fetchError","websocketError","webcodecsH265NotSupport","webcodecsConfigureError","webcodecsDecodeError","webcodecsWidthOrHeightChange","mediaSourceH265NotSupport","mediaSourceFull","mediaSourceAppendBufferError","mediaSourceBufferListLarge","mediaSourceAppendBufferEndTimeout","wasmDecodeError","webglAlignmentError","WEBSOCKET_STATUS","notConnect","open","SCREENSHOT_TYPE","download","base64","blob","VIDEO_ENC_TYPE","VIDEO_ENC_CODE","h264","h265","AUDIO_ENC_TYPE","CONTROL_HEIGHT","SCALE_MODE_TYPE","full","auto","fullAuto","CANVAS_RENDER_TYPE","webcodecs","webgl","offscreen","ENCODED_VIDEO_TYPE","key","delta","MP4_CODECS","avc","hev","MEDIA_SOURCE_STATE","ended","closed","AUDIO_SYNC_VIDEO_DIFF","HOT_KEY","esc","arrowUp","arrowDown","WCS_ERROR","keyframeIsRequiredError","canNotDecodeClosedCodec","FETCH_ERROR","abortError1","abortError2","abort","FRAME_HEADER_EX","PACKET_TYPE_EX","PACKET_TYPE_SEQ_START","PACKET_TYPE_FRAMES","PACKET_TYPE_FRAMESX","FRAME_TYPE_EX","FT_KEY","FT_INTER","Debug","constructor","master","name","_opt","args","console","warn","Events","destroys","proxy","bind","target","callback","option","Array","isArray","map","item","addEventListener","removeEventListener","push","forEach","event","player","Object","defineProperty","get","clientRect","$container","getBoundingClientRect","width","Math","max","clientWidth","height","clientHeight","rect","noop","supportOffscreen","$canvas","transferControlToOffscreen","supportOffscreenV2","OffscreenCanvas","createContextGL","gl","validContextNames","nameIndex","length","contextName","contextOptions","preserveDrawingBuffer","getContext","e","getParameter","dataURLToFile","dataURL","arr","split","bstr","atob","type","replace","n","u8arr","Uint8Array","charCodeAt","File","now","Date","getTime","WebAssembly","instantiate","module","Module","of","Instance","clamp","num","a","b","min","setStyle","element","value","keys","style","getStyle","numberType","getComputedStyle","getPropertyValue","parseFloat","getNowTime","calculationRate","totalSize","lastTime","size","thisTime","diffTime","isMobile","test","window","navigator","userAgent","toLowerCase","isPad","isAndroid","UA","supportWCS","uuid16","c","r","random","v","toString","formatVideoDecoderConfigure","avcC","codecArray","subarray","codecString","j","h","codec","description","isFullScreen","screenfull","isFullscreen","bpsSize","parseInt","isNaN","toFixed","fpsStatus","fps","result","createEmptyImageBitmap","$canvasElement","document","createElement","createImageBitmap","supportMSE","MediaSource","isTypeSupported","supportMediaStreamTrack","MediaStreamTrackGenerator","isEmpty","undefined","isBoolean","isNotEmpty","initPlayTimes","playInitStart","playStart","streamStart","streamResponse","demuxStart","decodeStart","videoStart","playTimestamp","streamTimestamp","streamResponseTimestamp","demuxTimestamp","decodeTimestamp","videoTimestamp","allTimestamp","formatTimeTips","time","hour","floor","sec","round","getTarget","srcElement","isWebglRenderSupport","getBrowser","UserAgent","browserInfo","browserArray","IE","ActiveXObject","Chrome","indexOf","Firefox","Opera","Safari","Edge","QQBrowser","WeixinBrowser","i","versions","match","mt","mimeTypes","version","closeVideoFrame","removeElement","parentNode","removeChild","hevcEncoderNalePacketNotLength","oneNALBuffer","isIframe","idrBit","nIdrBit","tmp","arrayBuffer","byteLength","set","isFalse","getElementDataset","dataset","getAttribute","setElementDataset","setAttribute","removeElementDataset","removeAttribute","screenfullChange","emit","on","events","off","loaded","request","then","catch","exit","classList","add","remove","ignoreList","stringList","includes","JSON","stringify","Emitter","fn","ctx","once","self","listener","apply","_","evtArr","slice","data","evts","liveEvents","len","vertexShaderScript","join","fragmentShaderScript","pixelStorei","UNPACK_ALIGNMENT","vertexShader","createShader","VERTEX_SHADER","shaderSource","compileShader","getShaderParameter","COMPILE_STATUS","getShaderInfoLog","fragmentShader","FRAGMENT_SHADER","program","createProgram","attachShader","linkProgram","getProgramParameter","LINK_STATUS","getProgramInfoLog","useProgram","vertexPosBuffer","createBuffer","bindBuffer","ARRAY_BUFFER","bufferData","Float32Array","STATIC_DRAW","vertexPosRef","getAttribLocation","enableVertexAttribArray","vertexAttribPointer","FLOAT","texturePosBuffer","texturePosRef","_initTexture","index","textureRef","createTexture","bindTexture","TEXTURE_2D","texParameteri","TEXTURE_MAG_FILTER","LINEAR","TEXTURE_MIN_FILTER","TEXTURE_WRAP_S","CLAMP_TO_EDGE","TEXTURE_WRAP_T","uniform1i","getUniformLocation","yTextureRef","uTextureRef","vTextureRef","w","y","u","viewport","activeTexture","TEXTURE0","texImage2D","LUMINANCE","UNSIGNED_BYTE","TEXTURE1","TEXTURE2","drawArrays","TRIANGLE_STRIP","deleteProgram","deleteBuffer","deleteTexture","CommonLoader","resetInit","encType","encTypeCode","$videoElement","updateVideoInfo","clearView","_global","global","this","bom","opts","autoBom","Blob","String","fromCharCode","xhr","XMLHttpRequest","responseType","onload","saveAs","response","onerror","send","corsEnabled","status","click","node","dispatchEvent","MouseEvent","evt","createEvent","initMouseEvent","isMacOSWebView","HTMLAnchorElement","prototype","URL","webkitURL","createElementNS","rel","href","origin","location","createObjectURL","setTimeout","revokeObjectURL","msSaveOrOpenBlob","popup","title","body","innerText","force","isSafari","HTMLElement","safari","isChromeIOS","FileReader","reader","onloadend","readAsDataURL","CanvasVideoLoader","position","top","left","appendChild","context2D","contextGl","contextGlRender","contextGlDestroy","bitmaprenderer","renderType","_initCanvasRender","_initContextGl","createWebGL","_initContext2D","_supportOffscreen","_bindOffscreen","initCanvasViewSize","msg","ts","transferFromImageBitmap","output","drawImage","filename","format","quality","formatType","png","jpeg","webp","encoderOptions","Number","toDataURL","file","imageBitMap","clear","COLOR_BUFFER_BIT","clearRect","isControlBarShow","resizeWidth","resizeHeight","wScale","hScale","scale","transform","VideoLoader","muted","disablePictureInPicture","poster","_delayPlay","trackGenerator","kind","srcObject","MediaStream","vwriter","writable","getWriter","canvasContext","fixChromeVideoFlashBug","_play","timeStamp","isPlaying","currentTime","src","stop","browser","backdropFilter","translateZ","readyState","_getVideoReadyState","isNow","$video","canvas","videoWidth","videoHeight","write","objectFill","objectFit","paused","Video","Loader","getLoaderFactory","opt","AudioContextLoader","bufferList","scriptNode","hasInitScriptNode","audioContextChannel","audioContext","AudioContext","webkitAudioContext","gainNode","createGain","source","createBufferSource","connect","destination","noteOn","audioBufferSourceNode","mediaStreamAudioDestinationNode","createMediaStreamDestination","audioEnabled","gain","_prevVolume","audioSyncVideoOption","diff","channels","sampleRate","options","closeAudio","onaudioprocess","updateAudioInfo","isMute","bufferSize","initScriptNode","createScriptProcessor","audioProcessingEvent","outputBuffer","bufferItem","shift","audioTimestamp","channel","nowBuffering","getChannelData","flag","setVolume","setValueAtTime","disconnect","state","resume","suspend","isStateRunning","isStateSuspended","Audio","FetchLoader","abortController","AbortController","streamRate","rate","fetchStream","demux","_times","fetchOptions","assign","signal","headers","res","getReader","fetchNext","read","done","dispatch","errorString","WebsocketLoader","socket","socketStatus","wsUrl","_createWebSocket","WebSocket","binaryType","_handleMessage","message","Stream","RecordRTCLoader","fileName","fileType","isRecording","recordingInterval","_reset","setFileName","recordTime","startRecord","mimeType","onTimeStamp","timestamp","disableLogs","stream","captureStream","audioStream","getAudioTracks","audioTrack","enabled","addTrack","recorder","RecordRTC","startRecording","setInterval","stopRecordAndSave","stopRecording","getBlob","clearInterval","Recorder","DecoderWorker","decoderWorker","Worker","_initDecoderWorker","postMessage","cmd","terminate","onmessage","_initWork","code","handleRender","updateStats","buf","delay","handlePlayToRenderTimes","emitError","decodeVideo","isIFrame","decodeAudio","_decodeAudioNoDelay","_decodeAudio","updateWorkConfig","config","stopId","firstTimestamp","startTimestamp","dropping","initInterval","getDelay","localTimestamp","timeTimestamp","resetDelay","_loop","mseDecoder","getSourceBufferUpdating","payload","_doDecoderDecode","_doDecode","cts","pushBuffer","webcodecsDecoder","_decodeEnhancedH265Video","flags","frameTypeEx","packetEx","codecId","ArrayBuffer","tmp32","Uint32Array","isAV1","extraData","payloadBuffer","_isEnhancedH265Header","FlvLoader","input","_inputFlv","flvDemux","dispatchFlvData","tmp8","t","abps","vbps","need","next","combine","remain","return","M7sLoader","dv","DataView","getUint8","getUint32","Demux","ExpGolomb","uint8array","TAG","_buffer","_buffer_index","_total_bytes","_total_bits","_current_word","_current_word_bits_left","_fillCurrentWord","buffer_bytes_left","bytes_read","word","readBits","bits","bits_need_left","bits_read_next","result2","readBool","readByte","_skipLeadingZero","zero_count","readUEG","leading_zeros","readSEG","SPSParser","_ebsp2rbsp","src_length","dst","dst_idx","parseSPS","rbsp","gb","profile_idc","level_idc","profile_string","getProfileString","level_string","getLevelString","chroma_format_idc","chroma_format","chroma_format_table","bit_depth","scaling_list_count","_skipScalingList","pic_order_cnt_type","num_ref_frames_in_pic_order_cnt_cycle","ref_frames","pic_width_in_mbs_minus1","pic_height_in_map_units_minus1","frame_mbs_only_flag","frame_crop_left_offset","frame_crop_right_offset","frame_crop_top_offset","frame_crop_bottom_offset","frame_cropping_flag","sar_width","sar_height","fps_fixed","fps_num","fps_den","vui_parameters_present_flag","aspect_ratio_idc","sar_w_table","sar_h_table","num_units_in_tick","time_scale","sarScale","crop_unit_x","crop_unit_y","sub_wc","sub_hc","codec_width","codec_height","present_width","ceil","chroma_format_string","getChromaFormatString","frame_rate","fixed","sar_ratio","codec_size","present_size","count","last_scale","next_scale","delta_scale","chroma","parseAVCDecoderConfigurationRecord","meta","avcProfile","_naluLengthSize","spsCount","offset","getUint16","sps","codecWidth","codecHeight","presentWidth","presentHeight","profile","level","bitDepth","chromaFormat","sarRatio","frameRate","refSampleDuration","timescale","ppsCount","videoType","WebcodecsDecoder","hasInit","isDecodeFirstIIframe","isInitInfo","initDecoder","_this","VideoDecoder","handleDecode","handleError","codedWidth","codedHeight","videoCodec","configure","chunk","EncodedVideoChunk","isDecodeStateClosed","iconsMap","fullscreenExit","recordStop","reduce","icons","control","insertAdjacentHTML","querySelector","object","display","overflow","pointerEvents","zIndex","playerWidth","playerHeight","contentDocument","defaultView","screenfullH5Control","setVolumeHandle","percentage","$volumeOn","$volumeOff","$volumeHandle","$volumePanel","panelHeight","handleHeight","$volumePanelText","innerHTML","$loading","$poster","$playBig","$fullscreenExit","$fullscreen","$controls","translateX","translateY","$record","$recordStop","$recording","$recordingTime","$play","$pause","$screenshot","$qualityMenu","$volume","$speed","bps","volumeChangeFromEvent","bottom","panelBottom","moveLen","composedPath","isFocus","stopPropagation","resumeAudioAfterPause","$volumePanelWrap","lastVolume","_lastVolume","isVolumeDroging","$recordingStop","startDelayControlHidden","stopDelayControlHidden","delayHiddenTimeout","clearTimeout","addHotkey","tag","activeElement","tagName","toUpperCase","editable","keyCode","preventDefault","Control","template","property","observer","hotkey","autoSize","padding","playerRatio","canvasWidth","canvasHeight","canvasRatio","toggleBar","getBarIsShow","nodeName","visibilityState","_isPlayingBeforePageHidden","enableWakeLock","MP4","types","avc1","hvc1","hvcC","btrt","dinf","dref","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a","mvex","mvhd","sdtp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trun","trex","tkhd","vmhd","smhd","hasOwnProperty","constants","FTYP","STSD_PREFIX","STTS","STSC","STCO","STSZ","HDLR_VIDEO","HDLR_AUDIO","DREF","SMHD","VMHD","box","datas","call","arguments","arrayCount","generateInitSegment","duration","trackId","id","xmhd","channelCount","audioSampleRate","configSize","concat","avcc","track","baseMediaDecodeTime","sequenceNumber","isLeading","dependsOn","isDependedOn","hasRedundancy","dataSize","isNonSync","MseDecoder","isAvc","mediaSource","sourceBuffer","cacheTrack","timeInit","mediaSourceOpen","firstRenderTime","mediaSourceAppendBufferFull","isStateOpen","isStateClosed","isStateEnded","_decodeConfigurationRecord","dts","_decodeVideo","metaData","metaBox","appendBuffer","bytes","buffered","removeBuffer","end","mdatBytes","mdatbox","moofbox","isKeyframe","addSourceBuffer","updating","abortSourceBuffer","removeSourceBuffer","endOfStream","dropSourceBuffer","isDropping","WEBM","oldIOS","exec","MSStream","nativeWakeLock","NoSleep","_wakeLock","handleVisibilityChange","enable","noSleepTimer","noSleepVideo","_addSourceToVideo","dataURI","isEnabled","wakeLock","err","disable","hidden","Promise","resolve","playPromise","release","Player","container","_hasControl","_loading","_playing","_hasLoaded","_checkHeartTimeout","_checkLoadingTimeout","_checkStatsInterval","_startBpsTime","_stats","_videoTimestamp","_audioTimestamp","_onlyMseOrWcsVideo","clearCheckHeartTimeout","clearCheckLoadingTimeout","clearStatsInterval","releaseWakeLock","resetStats","updateOption","contains","isDebug","reject","checkLoadingTimeout","checkStatsInterval","_close","hasBtnShow","text","checkHeart","checkHeartTimeout","_nowTime","getOption","errorType","getControlBarShow","toggleControlBar","isShow","Jessibuca","Error","_checkHasCreated","_loadingTimeoutReplayTimes","_heartTimeoutReplayTimes","_destroyed","_initPlayer","_clearInitDecoderWorkerTimeout","_bindEvents","_resetPlayer","isDestroyed","setDebug","cancelMute","audioResume","setScaleMode","playOptions","isHttp","hasLoaded","_checkInitDecoderWorkerTimeout","setBufferTime","setRotate","deg","list","setKeepScreenOn","setFullscreen","gbProV","_handleInitDecoderWorkerTimeout"],"mappings":";;;;;;;;;;;;;;;;;CAAA,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE;CAC1C,EAAE,IAAI,GAAG,IAAI,GAAG,EAAE;CAClB,IAAI,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE;CACpC,MAAM,KAAK,EAAE,KAAK;CAClB,MAAM,UAAU,EAAE,IAAI;CACtB,MAAM,YAAY,EAAE,IAAI;CACxB,MAAM,QAAQ,EAAE,IAAI;CACpB,KAAK,CAAC,CAAC;CACP,GAAG,MAAM;CACT,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;CACrB,GAAG;AACH;CACA,EAAE,OAAO,GAAG,CAAC;CACb,CAAC;AACD;CACA,cAAc,GAAG,eAAe,EAAE,yBAAyB,GAAG,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,OAAO;;;;;CCf9G;CACO,MAAMA,oBAAoB,GAAG;CAChCC,EAAAA,SAAS,EAAE,CADqB;CAEhCC,EAAAA,KAAK,EAAE,CAFyB;CAGhCC,EAAAA,MAAM,EAAE;CAHwB,CAA7B;CAMA,MAAMC,UAAU,GAAG;CACtBC,EAAAA,GAAG,EAAE,K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UAAU,CAAC,MAAM;CAC7C,WAAK+qB,+BAAL;CACH,KAFyC,EAEvC,KAAKnhC,IAAL,CAAUtI,wBAAV,GAAqC,IAFE,CAA1C;CAGH;;CAGDypC,EAAAA,+BAA+B,GAAG;CAC9B,SAAK/nC,KAAL,GAAaoU,IAAb,CAAkB,MAAM;CACpB,WAAKxY,KAAL,CAAW2E,GAAX,CAAe,WAAf,EAA4B,4CAA5B;CACH,KAFD,EAEG8T,KAFH,CAEUxK,CAAD,IAAO;CACZ,WAAKjO,KAAL,CAAWmL,IAAX,CAAgB,WAAhB,EAA6B,kDAA7B,EAAiF8C,CAAjF;CACH,KAJD;CAKH;;CAx0B2B;;iBAA1Bw8B,oBACa9jC;;iBADb8jC,sBAGe;CACbvqC,EAAAA,cAAc,EAAE8D,MAAM,CAAC9D,cADV;CAEb2E,EAAAA,YAAY,EAAEb,MAAM,CAACa;CAFR;;CAy0BrBoM,MAAM,CAACw5B,SAAP,GAAmBA,SAAnB;;;;;;;;"} \ No newline at end of file diff --git a/demo/public/pro.zip b/demo/public/pro.zip index ab29419a..3ceaed68 100644 Binary files a/demo/public/pro.zip and b/demo/public/pro.zip differ diff --git a/demo/public/pro/js/decoder-pro-audio.js b/demo/public/pro/js/decoder-pro-audio.js index 0e5ee6d3..4f3b2f27 100644 --- a/demo/public/pro/js/decoder-pro-audio.js +++ b/demo/public/pro/js/decoder-pro-audio.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("crypto")):"function"==typeof define&&define.amd?define(["crypto"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).crypto$1)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r,s=t(e),n=(r="undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-audio.js",document.baseURI).href,async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t,i,s;(s=e).ready=new Promise(((e,r)=>{t=e,i=r})),(s=void 0!==s?s:{}).locateFile=function(e){return"decoder-pro-audio.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_AUDIO_WASM_URL&&""!=JESSIBUCA_PRO_AUDIO_WASM_URL?JESSIBUCA_PRO_AUDIO_WASM_URL:e};var n,a,o,d=Object.assign({},s),l="./this.program",c="object"==typeof window,u="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";function p(e){return s.locateFile?s.locateFile(e,f):f+e}if(h){const{createRequire:e}=await import("module");var m=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-audio.js",document.baseURI).href),_=m("fs"),g=m("path");f=u?g.dirname(f)+"/":m("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-audio.js",document.baseURI).href)),n=(e,t)=>(e=J(e)?new URL(e):g.normalize(e),_.readFileSync(e,t?void 0:"utf8")),o=e=>{var t=n(e,!0);return t.buffer||(t=new Uint8Array(t)),t},a=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=J(e)?new URL(e):g.normalize(e),_.readFile(e,i?void 0:"utf8",((e,s)=>{e?r(e):t(i?s.buffer:s)}))},!s.thisProgram&&process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),s.inspect=()=>"[Emscripten Module object]"}else(c||u)&&(u?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),r&&(f=r),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",n=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},u&&(o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),a=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var y,v,b=s.print||console.log.bind(console),w=s.printErr||console.error.bind(console);Object.assign(s,d),d=null,s.arguments&&s.arguments,s.thisProgram&&(l=s.thisProgram),s.quit&&s.quit,s.wasmBinary&&(y=s.wasmBinary),"object"!=typeof WebAssembly&&j("no native wasm support detected");var S,E,A,B,U,x,k,T,C=!1;function D(e,t){e||j(t)}function L(){var e=v.buffer;s.HEAP8=S=new Int8Array(e),s.HEAP16=A=new Int16Array(e),s.HEAPU8=E=new Uint8Array(e),s.HEAPU16=B=new Uint16Array(e),s.HEAP32=U=new Int32Array(e),s.HEAPU32=x=new Uint32Array(e),s.HEAPF32=k=new Float32Array(e),s.HEAPF64=T=new Float64Array(e)}var I=[],F=[],P=[];function M(){if(s.preRun)for("function"==typeof s.preRun&&(s.preRun=[s.preRun]);s.preRun.length;)N(s.preRun.shift());se(I)}function R(){s.noFSInit||Te.init.initialized||Te.init(),Te.ignorePermissions=!1,se(F)}function z(){if(s.postRun)for("function"==typeof s.postRun&&(s.postRun=[s.postRun]);s.postRun.length;)G(s.postRun.shift());se(P)}function N(e){I.unshift(e)}function O(e){F.unshift(e)}function G(e){P.unshift(e)}var $=0,H=null;function V(e){$++,s.monitorRunDependencies&&s.monitorRunDependencies($)}function W(e){if($--,s.monitorRunDependencies&&s.monitorRunDependencies($),0==$&&H){var t=H;H=null,t()}}function j(e){s.onAbort&&s.onAbort(e),w(e="Aborted("+e+")"),C=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}var q,Y,K,X="data:application/octet-stream;base64,",Z=e=>e.startsWith(X),J=e=>e.startsWith("file://");function Q(e){if(e==q&&y)return new Uint8Array(y);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}function ee(e){if(!y&&(c||u)){if("function"==typeof fetch&&!J(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>Q(e)));if(a)return new Promise(((t,r)=>{a(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>Q(e)))}function te(e,t,r){return ee(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{w(`failed to asynchronously prepare wasm: ${e}`),j(e)}))}function re(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||Z(t)||J(t)||h||"function"!=typeof fetch?te(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return w(`wasm streaming compile failed: ${e}`),w("falling back to ArrayBuffer instantiation"),te(t,r,i)}))))}function ie(){var e={a:si};function t(e,t){return ni=e.exports,v=ni.E,L(),It=ni.H,O(ni.F),W(),ni}if(V(),s.instantiateWasm)try{return s.instantiateWasm(e,t)}catch(e){w(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return re(y,q,e,(function(e){t(e.instance)})).catch(i),{}}s.locateFile?Z(q="decoder-pro-audio.wasm")||(q=p(q)):q=new URL("decoder-pro-audio.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-audio.js",document.baseURI).href).href;var se=e=>{for(;e.length>0;)e.shift()(s)};function ne(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){x[this.ptr+4>>2]=e},this.get_type=function(){return x[this.ptr+4>>2]},this.set_destructor=function(e){x[this.ptr+8>>2]=e},this.get_destructor=function(){return x[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,S[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=S[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,S[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=S[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){x[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return x[this.ptr+16>>2]},this.get_exception_ptr=function(){if(ci(this.get_type()))return x[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}s.noExitRuntime;var ae=(e,t,r)=>{throw new ne(e).init(t,r),e},oe=e=>(U[oi()>>2]=e,e),de={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var s=e[i];"."===s?e.splice(i,1):".."===s?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=de.isAbs(e),r="/"===e.substr(-1);return(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=de.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=de.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return de.normalize(e.join("/"))},join2:(e,t)=>de.normalize(e+"/"+t)},le=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}j("initRandomDevice")},ce=e=>(ce=le())(e),ue={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:Te.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=de.isAbs(i)}return(t?"/":"")+(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=ue.resolve(e).substr(1),t=ue.resolve(t).substr(1);for(var i=r(e.split("/")),s=r(t.split("/")),n=Math.min(i.length,s.length),a=n,o=0;o{for(var i=t+r,s=t;e[s]&&!(s>=i);)++s;if(s-t>16&&e.buffer&&he)return he.decode(e.subarray(t,s));for(var n="";t>10,56320|1023&l)}}else n+=String.fromCharCode((31&a)<<6|o)}else n+=String.fromCharCode(a)}return n},pe=[],me=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},_e=(e,t,r,i)=>{if(!(i>0))return 0;for(var s=r,n=r+i-1,a=0;a=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a)),o<=127){if(r>=n)break;t[r++]=o}else if(o<=2047){if(r+1>=n)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=n)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=n)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o}}return t[r]=0,r-s};function ge(e,t,r){var i=r>0?r:me(e)+1,s=new Array(i),n=_e(e,s,0,s.length);return t&&(s.length=n),s}var ye=()=>{if(!pe.length){var e=null;if(h){var t=Buffer.alloc(256),r=0,i=process.stdin.fd;try{r=_.readSync(i,t)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}e=r>0?t.slice(0,r).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;pe=ge(e,!0)}return pe.shift()},ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},Te.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new Te.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,i,s){if(!e.tty||!e.tty.ops.get_char)throw new Te.ErrnoError(60);for(var n=0,a=0;aye(),put_char(e,t){null===t||10===t?(b(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(b(fe(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(w(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(w(fe(e.output,0)),e.output=[])}}},be=e=>{j()},we={ops_table:null,mount:e=>we.createNode(null,"/",16895,0),createNode(e,t,r,i){if(Te.isBlkdev(r)||Te.isFIFO(r))throw new Te.ErrnoError(63);we.ops_table||(we.ops_table={dir:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,lookup:we.node_ops.lookup,mknod:we.node_ops.mknod,rename:we.node_ops.rename,unlink:we.node_ops.unlink,rmdir:we.node_ops.rmdir,readdir:we.node_ops.readdir,symlink:we.node_ops.symlink},stream:{llseek:we.stream_ops.llseek}},file:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:{llseek:we.stream_ops.llseek,read:we.stream_ops.read,write:we.stream_ops.write,allocate:we.stream_ops.allocate,mmap:we.stream_ops.mmap,msync:we.stream_ops.msync}},link:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,readlink:we.node_ops.readlink},stream:{}},chrdev:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:Te.chrdev_stream_ops}});var s=Te.createNode(e,t,r,i);return Te.isDir(s.mode)?(s.node_ops=we.ops_table.dir.node,s.stream_ops=we.ops_table.dir.stream,s.contents={}):Te.isFile(s.mode)?(s.node_ops=we.ops_table.file.node,s.stream_ops=we.ops_table.file.stream,s.usedBytes=0,s.contents=null):Te.isLink(s.mode)?(s.node_ops=we.ops_table.link.node,s.stream_ops=we.ops_table.link.stream):Te.isChrdev(s.mode)&&(s.node_ops=we.ops_table.chrdev.node,s.stream_ops=we.ops_table.chrdev.stream),s.timestamp=Date.now(),e&&(e.contents[t]=s,e.timestamp=s.timestamp),s},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Te.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,Te.isDir(e.mode)?t.size=4096:Te.isFile(e.mode)?t.size=e.usedBytes:Te.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&we.resizeFileStorage(e,t.size)},lookup(e,t){throw Te.genericErrors[44]},mknod:(e,t,r,i)=>we.createNode(e,t,r,i),rename(e,t,r){if(Te.isDir(e.mode)){var i;try{i=Te.lookupNode(t,r)}catch(e){}if(i)for(var s in i.contents)throw new Te.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=Te.lookupNode(e,t);for(var i in r.contents)throw new Te.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink(e,t,r){var i=we.createNode(e,t,41471,0);return i.link=r,i},readlink(e){if(!Te.isLink(e.mode))throw new Te.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,i,s){var n=e.node.contents;if(s>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-s,i);if(a>8&&n.subarray)t.set(n.subarray(s,s+a),r);else for(var o=0;o0||r+t(we.stream_ops.write(e,t,0,i,r,!1),0)}},Se=(e,t,r,i)=>{var s=i?"":`al ${e}`;a(e,(r=>{D(r,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(r)),s&&W()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),s&&V()},Ee=(e,t,r,i,s,n)=>{Te.createDataFile(e,t,r,i,s,n)},Ae=s.preloadPlugins||[],Be=(e,t,r,i)=>{"undefined"!=typeof Browser&&Browser.init();var s=!1;return Ae.forEach((n=>{s||n.canHandle(t)&&(n.handle(e,t,r,i),s=!0)})),s},Ue=(e,t,r,i,s,n,a,o,d,l)=>{var c=t?ue.resolve(de.join2(e,t)):e;function u(r){function u(r){l&&l(),o||Ee(e,t,r,i,s,d),n&&n(),W()}Be(r,c,u,(()=>{a&&a(),W()}))||u(r)}V(),"string"==typeof r?Se(r,(e=>u(e)),a):u(r)},xe=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t},ke=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Te={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=ue.resolve(e)))return{path:"",node:null};if(t=Object.assign({follow_mount:!0,recurse_count:0},t),t.recurse_count>8)throw new Te.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),i=Te.root,s="/",n=0;n40)throw new Te.ErrnoError(32)}}return{path:s,node:i}},getPath(e){for(var t;;){if(Te.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,i=0;i>>0)%Te.nameTable.length},hashAddNode(e){var t=Te.hashName(e.parent.id,e.name);e.name_next=Te.nameTable[t],Te.nameTable[t]=e},hashRemoveNode(e){var t=Te.hashName(e.parent.id,e.name);if(Te.nameTable[t]===e)Te.nameTable[t]=e.name_next;else for(var r=Te.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=Te.mayLookup(e);if(r)throw new Te.ErrnoError(r,e);for(var i=Te.hashName(e.id,t),s=Te.nameTable[i];s;s=s.name_next){var n=s.name;if(s.parent.id===e.id&&n===t)return s}return Te.lookup(e,t)},createNode(e,t,r,i){var s=new Te.FSNode(e,t,r,i);return Te.hashAddNode(s),s},destroyNode(e){Te.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>Te.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){var t=Te.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{return Te.lookupNode(e,t),20}catch(e){}return Te.nodePermissions(e,"wx")},mayDelete(e,t,r){var i;try{i=Te.lookupNode(e,t)}catch(e){return e.errno}var s=Te.nodePermissions(e,"wx");if(s)return s;if(r){if(!Te.isDir(i.mode))return 54;if(Te.isRoot(i)||Te.getPath(i)===Te.cwd())return 10}else if(Te.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?Te.isLink(e.mode)?32:Te.isDir(e.mode)&&("r"!==Te.flagsToPermissionString(t)||512&t)?31:Te.nodePermissions(e,Te.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Te.MAX_OPEN_FDS;e++)if(!Te.streams[e])return e;throw new Te.ErrnoError(33)},getStreamChecked(e){var t=Te.getStream(e);if(!t)throw new Te.ErrnoError(8);return t},getStream:e=>Te.streams[e],createStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return Te.FSStream||(Te.FSStream=function(){this.shared={}},Te.FSStream.prototype={},Object.defineProperties(Te.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},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(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new Te.FSStream,e),-1==t&&(t=Te.nextfd()),e.fd=t,Te.streams[t]=e,e},closeStream(e){Te.streams[e]=null},chrdev_stream_ops:{open(e){var t=Te.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek(){throw new Te.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Te.devices[e]={stream_ops:t}},getDevice:e=>Te.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),Te.syncFSRequests++,Te.syncFSRequests>1&&w(`warning: ${Te.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Te.getMounts(Te.root.mount),i=0;function s(e){return Te.syncFSRequests--,t(e)}function n(e){if(e)return n.errored?void 0:(n.errored=!0,s(e));++i>=r.length&&s(null)}r.forEach((t=>{if(!t.type.syncfs)return n(null);t.type.syncfs(t,e,n)}))},mount(e,t,r){var i,s="/"===r,n=!r;if(s&&Te.root)throw new Te.ErrnoError(10);if(!s&&!n){var a=Te.lookupPath(r,{follow_mount:!1});if(r=a.path,i=a.node,Te.isMountpoint(i))throw new Te.ErrnoError(10);if(!Te.isDir(i.mode))throw new Te.ErrnoError(54)}var o={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(o);return d.mount=o,o.root=d,s?Te.root=d:i&&(i.mounted=o,i.mount&&i.mount.mounts.push(o)),d},unmount(e){var t=Te.lookupPath(e,{follow_mount:!1});if(!Te.isMountpoint(t.node))throw new Te.ErrnoError(28);var r=t.node,i=r.mounted,s=Te.getMounts(i);Object.keys(Te.nameTable).forEach((e=>{for(var t=Te.nameTable[e];t;){var r=t.name_next;s.includes(t.mount)&&Te.destroyNode(t),t=r}})),r.mounted=null;var n=r.mount.mounts.indexOf(i);r.mount.mounts.splice(n,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var i=Te.lookupPath(e,{parent:!0}).node,s=de.basename(e);if(!s||"."===s||".."===s)throw new Te.ErrnoError(28);var n=Te.mayCreate(i,s);if(n)throw new Te.ErrnoError(n);if(!i.node_ops.mknod)throw new Te.ErrnoError(63);return i.node_ops.mknod(i,s,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,Te.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,Te.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),i="",s=0;s(void 0===r&&(r=t,t=438),t|=8192,Te.mknod(e,t,r)),symlink(e,t){if(!ue.resolve(e))throw new Te.ErrnoError(44);var r=Te.lookupPath(t,{parent:!0}).node;if(!r)throw new Te.ErrnoError(44);var i=de.basename(t),s=Te.mayCreate(r,i);if(s)throw new Te.ErrnoError(s);if(!r.node_ops.symlink)throw new Te.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename(e,t){var r,i,s=de.dirname(e),n=de.dirname(t),a=de.basename(e),o=de.basename(t);if(r=Te.lookupPath(e,{parent:!0}).node,i=Te.lookupPath(t,{parent:!0}).node,!r||!i)throw new Te.ErrnoError(44);if(r.mount!==i.mount)throw new Te.ErrnoError(75);var d,l=Te.lookupNode(r,a),c=ue.relative(e,n);if("."!==c.charAt(0))throw new Te.ErrnoError(28);if("."!==(c=ue.relative(t,s)).charAt(0))throw new Te.ErrnoError(55);try{d=Te.lookupNode(i,o)}catch(e){}if(l!==d){var u=Te.isDir(l.mode),h=Te.mayDelete(r,a,u);if(h)throw new Te.ErrnoError(h);if(h=d?Te.mayDelete(i,o,u):Te.mayCreate(i,o))throw new Te.ErrnoError(h);if(!r.node_ops.rename)throw new Te.ErrnoError(63);if(Te.isMountpoint(l)||d&&Te.isMountpoint(d))throw new Te.ErrnoError(10);if(i!==r&&(h=Te.nodePermissions(r,"w")))throw new Te.ErrnoError(h);Te.hashRemoveNode(l);try{r.node_ops.rename(l,i,o)}catch(e){throw e}finally{Te.hashAddNode(l)}}},rmdir(e){var t=Te.lookupPath(e,{parent:!0}).node,r=de.basename(e),i=Te.lookupNode(t,r),s=Te.mayDelete(t,r,!0);if(s)throw new Te.ErrnoError(s);if(!t.node_ops.rmdir)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.rmdir(t,r),Te.destroyNode(i)},readdir(e){var t=Te.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new Te.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=Te.lookupPath(e,{parent:!0}).node;if(!t)throw new Te.ErrnoError(44);var r=de.basename(e),i=Te.lookupNode(t,r),s=Te.mayDelete(t,r,!1);if(s)throw new Te.ErrnoError(s);if(!t.node_ops.unlink)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.unlink(t,r),Te.destroyNode(i)},readlink(e){var t=Te.lookupPath(e).node;if(!t)throw new Te.ErrnoError(44);if(!t.node_ops.readlink)throw new Te.ErrnoError(28);return ue.resolve(Te.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=Te.lookupPath(e,{follow:!t}).node;if(!r)throw new Te.ErrnoError(44);if(!r.node_ops.getattr)throw new Te.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>Te.stat(e,!0),chmod(e,t,r){var i;if(!(i="string"==typeof e?Te.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new Te.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod(e,t){Te.chmod(e,t,!0)},fchmod(e,t){var r=Te.getStreamChecked(e);Te.chmod(r.node,t)},chown(e,t,r,i){var s;if(!(s="string"==typeof e?Te.lookupPath(e,{follow:!i}).node:e).node_ops.setattr)throw new Te.ErrnoError(63);s.node_ops.setattr(s,{timestamp:Date.now()})},lchown(e,t,r){Te.chown(e,t,r,!0)},fchown(e,t,r){var i=Te.getStreamChecked(e);Te.chown(i.node,t,r)},truncate(e,t){if(t<0)throw new Te.ErrnoError(28);var r;if(!(r="string"==typeof e?Te.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new Te.ErrnoError(63);if(Te.isDir(r.mode))throw new Te.ErrnoError(31);if(!Te.isFile(r.mode))throw new Te.ErrnoError(28);var i=Te.nodePermissions(r,"w");if(i)throw new Te.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=Te.getStreamChecked(e);if(0==(2097155&r.flags))throw new Te.ErrnoError(28);Te.truncate(r.node,t)},utime(e,t,r){var i=Te.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new Te.ErrnoError(44);var i;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?xe(t):t)?4095&r|32768:0,"object"==typeof e)i=e;else{e=de.normalize(e);try{i=Te.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var n=!1;if(64&t)if(i){if(128&t)throw new Te.ErrnoError(20)}else i=Te.mknod(e,r,0),n=!0;if(!i)throw new Te.ErrnoError(44);if(Te.isChrdev(i.mode)&&(t&=-513),65536&t&&!Te.isDir(i.mode))throw new Te.ErrnoError(54);if(!n){var a=Te.mayOpen(i,t);if(a)throw new Te.ErrnoError(a)}512&t&&!n&&Te.truncate(i,0),t&=-131713;var o=Te.createStream({node:i,path:Te.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return o.stream_ops.open&&o.stream_ops.open(o),!s.logReadFiles||1&t||(Te.readFiles||(Te.readFiles={}),e in Te.readFiles||(Te.readFiles[e]=1)),o},close(e){if(Te.isClosed(e))throw new Te.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Te.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Te.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Te.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,i,s){if(i<0||s<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(1==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.read)throw new Te.ErrnoError(28);var n=void 0!==s;if(n){if(!e.seekable)throw new Te.ErrnoError(70)}else s=e.position;var a=e.stream_ops.read(e,t,r,i,s);return n||(e.position+=a),a},write(e,t,r,i,s,n){if(i<0||s<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.write)throw new Te.ErrnoError(28);e.seekable&&1024&e.flags&&Te.llseek(e,0,2);var a=void 0!==s;if(a){if(!e.seekable)throw new Te.ErrnoError(70)}else s=e.position;var o=e.stream_ops.write(e,t,r,i,s,n);return a||(e.position+=o),o},allocate(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(t<0||r<=0)throw new Te.ErrnoError(28);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(!Te.isFile(e.node.mode)&&!Te.isDir(e.node.mode))throw new Te.ErrnoError(43);if(!e.stream_ops.allocate)throw new Te.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,i,s){if(0!=(2&i)&&0==(2&s)&&2!=(2097155&e.flags))throw new Te.ErrnoError(2);if(1==(2097155&e.flags))throw new Te.ErrnoError(2);if(!e.stream_ops.mmap)throw new Te.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,s)},msync:(e,t,r,i,s)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,s):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new Te.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,i=Te.open(e,t.flags),s=Te.stat(e).size,n=new Uint8Array(s);return Te.read(i,n,0,s,0),"utf8"===t.encoding?r=fe(n,0):"binary"===t.encoding&&(r=n),Te.close(i),r},writeFile(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=Te.open(e,r.flags,r.mode);if("string"==typeof t){var s=new Uint8Array(me(t)+1),n=_e(t,s,0,s.length);Te.write(i,s,0,n,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");Te.write(i,t,0,t.byteLength,void 0,r.canOwn)}Te.close(i)},cwd:()=>Te.currentPath,chdir(e){var t=Te.lookupPath(e,{follow:!0});if(null===t.node)throw new Te.ErrnoError(44);if(!Te.isDir(t.node.mode))throw new Te.ErrnoError(54);var r=Te.nodePermissions(t.node,"x");if(r)throw new Te.ErrnoError(r);Te.currentPath=t.path},createDefaultDirectories(){Te.mkdir("/tmp"),Te.mkdir("/home"),Te.mkdir("/home/web_user")},createDefaultDevices(){Te.mkdir("/dev"),Te.registerDevice(Te.makedev(1,3),{read:()=>0,write:(e,t,r,i,s)=>i}),Te.mkdev("/dev/null",Te.makedev(1,3)),ve.register(Te.makedev(5,0),ve.default_tty_ops),ve.register(Te.makedev(6,0),ve.default_tty1_ops),Te.mkdev("/dev/tty",Te.makedev(5,0)),Te.mkdev("/dev/tty1",Te.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=ce(e).byteLength),e[--t]);Te.createDevice("/dev","random",r),Te.createDevice("/dev","urandom",r),Te.mkdir("/dev/shm"),Te.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Te.mkdir("/proc");var e=Te.mkdir("/proc/self");Te.mkdir("/proc/self/fd"),Te.mount({mount(){var t=Te.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,i=Te.getStreamChecked(r),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return s.parent=s,s}},t}},{},"/proc/self/fd")},createStandardStreams(){s.stdin?Te.createDevice("/dev","stdin",s.stdin):Te.symlink("/dev/tty","/dev/stdin"),s.stdout?Te.createDevice("/dev","stdout",null,s.stdout):Te.symlink("/dev/tty","/dev/stdout"),s.stderr?Te.createDevice("/dev","stderr",null,s.stderr):Te.symlink("/dev/tty1","/dev/stderr"),Te.open("/dev/stdin",0),Te.open("/dev/stdout",1),Te.open("/dev/stderr",1)},ensureErrnoError(){Te.ErrnoError||(Te.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},Te.ErrnoError.prototype=new Error,Te.ErrnoError.prototype.constructor=Te.ErrnoError,[44].forEach((e=>{Te.genericErrors[e]=new Te.ErrnoError(e),Te.genericErrors[e].stack=""})))},staticInit(){Te.ensureErrnoError(),Te.nameTable=new Array(4096),Te.mount(we,{},"/"),Te.createDefaultDirectories(),Te.createDefaultDevices(),Te.createSpecialDirectories(),Te.filesystems={MEMFS:we}},init(e,t,r){Te.init.initialized=!0,Te.ensureErrnoError(),s.stdin=e||s.stdin,s.stdout=t||s.stdout,s.stderr=r||s.stderr,Te.createStandardStreams()},quit(){Te.init.initialized=!1;for(var e=0;ethis.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},n.prototype.setDataGetter=function(e){this.getter=e},n.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),s=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,n=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,a=1048576;s||(a=i);var o=this;o.setDataGetter((e=>{var t=e*a,s=(e+1)*a-1;if(s=Math.min(s,i-1),void 0===o.chunks[e]&&(o.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var s=new XMLHttpRequest;if(s.open("GET",r,!1),i!==a&&s.setRequestHeader("Range","bytes="+e+"-"+t),s.responseType="arraybuffer",s.overrideMimeType&&s.overrideMimeType("text/plain; charset=x-user-defined"),s.send(null),!(s.status>=200&&s.status<300||304===s.status))throw new Error("Couldn't load "+r+". Status: "+s.status);return void 0!==s.response?new Uint8Array(s.response||[]):ge(s.responseText||"",!0)})(t,s)),void 0===o.chunks[e])throw new Error("doXHR failed!");return o.chunks[e]})),!n&&i||(a=i=1,i=this.getter(0).length,a=i,b("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!u)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new n;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var o={isDevice:!1,contents:a}}else o={isDevice:!1,url:r};var d=Te.createFile(e,t,o,i,s);o.contents?d.contents=o.contents:o.url&&(d.contents=null,d.url=o.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,t,r,i,s){var n=e.node.contents;if(s>=n.length)return 0;var a=Math.min(n.length-s,i);if(n.slice)for(var o=0;o{var t=d.stream_ops[e];l[e]=function(){return Te.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,s)=>(Te.forceLoadFile(d),c(e,t,r,i,s)),l.mmap=(e,t,r,i,s)=>{Te.forceLoadFile(d);var n=be();if(!n)throw new Te.ErrnoError(48);return c(e,S,n,t,r),{ptr:n,allocated:!0}},d.stream_ops=l,d}},Ce=(e,t)=>e?fe(E,e,t):"",De={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(de.isAbs(t))return t;var i;if(i=-100===e?Te.cwd():De.getStreamFromFD(e).path,0==t.length){if(!r)throw new Te.ErrnoError(44);return i}return de.join2(i,t)},doStat(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&de.normalize(t)!==de.normalize(Te.getPath(e.node)))return-54;throw e}U[r>>2]=i.dev,U[r+4>>2]=i.mode,x[r+8>>2]=i.nlink,U[r+12>>2]=i.uid,U[r+16>>2]=i.gid,U[r+20>>2]=i.rdev,K=[i.size>>>0,(Y=i.size,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+24>>2]=K[0],U[r+28>>2]=K[1],U[r+32>>2]=4096,U[r+36>>2]=i.blocks;var s=i.atime.getTime(),n=i.mtime.getTime(),a=i.ctime.getTime();return K=[Math.floor(s/1e3)>>>0,(Y=Math.floor(s/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+40>>2]=K[0],U[r+44>>2]=K[1],x[r+48>>2]=s%1e3*1e3,K=[Math.floor(n/1e3)>>>0,(Y=Math.floor(n/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+56>>2]=K[0],U[r+60>>2]=K[1],x[r+64>>2]=n%1e3*1e3,K=[Math.floor(a/1e3)>>>0,(Y=Math.floor(a/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+72>>2]=K[0],U[r+76>>2]=K[1],x[r+80>>2]=a%1e3*1e3,K=[i.ino>>>0,(Y=i.ino,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+88>>2]=K[0],U[r+92>>2]=K[1],0},doMsync(e,t,r,i,s){if(!Te.isFile(t.node.mode))throw new Te.ErrnoError(43);if(2&i)return 0;var n=E.slice(e,e+r);Te.msync(t,n,s,r,i)},varargs:void 0,get(){var e=U[+De.varargs>>2];return De.varargs+=4,e},getp:()=>De.get(),getStr:e=>Ce(e),getStreamFromFD:e=>Te.getStreamChecked(e)};function Le(e,t,r){De.varargs=r;try{var i=De.getStreamFromFD(e);switch(t){case 0:if((s=De.get())<0)return-28;for(;Te.streams[s];)s++;return Te.createStream(i,s).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var s=De.get();return i.flags|=s,0;case 5:return s=De.getp(),A[s+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return oe(28),-1}}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}function Ie(e,t,r,i){De.varargs=i;try{t=De.getStr(t),t=De.calculateAt(e,t);var s=i?De.get():0;return Te.open(t,r,s).fd}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}var Fe,Pe,Me,Re=(e,t,r,i,s)=>{},ze=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Fe=e},Ne=e=>{for(var t="",r=e;E[r];)t+=Fe[E[r++]];return t},Oe={},Ge={},$e={},He=e=>{throw new Pe(e)},Ve=e=>{throw new Me(e)},We=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&Ve("Mismatched type converter count");for(var s=0;s{Ge.hasOwnProperty(e)?s[t]=Ge[e]:(n.push(e),Oe.hasOwnProperty(e)||(Oe[e]=[]),Oe[e].push((()=>{s[t]=Ge[e],++a===n.length&&i(s)})))})),0===n.length&&i(s)};function je(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||He(`type "${i}" must have a positive integer typeid pointer`),Ge.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;He(`Cannot register type '${i}' twice`)}if(Ge[e]=t,delete $e[e],Oe.hasOwnProperty(e)){var s=Oe[e];delete Oe[e],s.forEach((e=>e()))}}function qe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return je(e,t,r)}var Ye,Ke=8,Xe=(e,t,r,i)=>{qe(e,{name:t=Ne(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:Ke,readValueFromPointer:function(e){return this.fromWireType(E[e])},destructorFunction:null})},Ze=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Je=e=>{He(e.$$.ptrType.registeredClass.name+" instance already deleted")},Qe=!1,et=e=>{},tt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},rt=e=>{e.count.value-=1,0===e.count.value&&tt(e)},it=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=it(e,t,r.baseClass);return null===i?null:r.downcast(i)},st={},nt=()=>Object.keys(ut).length,at=()=>{var e=[];for(var t in ut)ut.hasOwnProperty(t)&&e.push(ut[t]);return e},ot=[],dt=()=>{for(;ot.length;){var e=ot.pop();e.$$.deleteScheduled=!1,e.delete()}},lt=e=>{Ye=e,ot.length&&Ye&&Ye(dt)},ct=()=>{s.getInheritedInstanceCount=nt,s.getLiveInheritedInstances=at,s.flushPendingDeletes=dt,s.setDelayFunction=lt},ut={},ht=(e,t)=>{for(void 0===t&&He("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},ft=(e,t)=>(t=ht(e,t),ut[t]),pt=(e,t)=>(t.ptrType&&t.ptr||Ve("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&Ve("Both smartPtrType and smartPtr must be specified"),t.count={value:1},_t(Object.create(e,{$$:{value:t}})));function mt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ft(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function s(){return this.isSmartPointer?pt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):pt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var n,a=this.registeredClass.getActualType(t),o=st[a];if(!o)return s.call(this);n=this.isConst?o.constPointerType:o.pointerType;var d=it(t,this.registeredClass,n.registeredClass);return null===d?s.call(this):this.isSmartPointer?pt(n.registeredClass.instancePrototype,{ptrType:n,ptr:d,smartPtrType:this,smartPtr:e}):pt(n.registeredClass.instancePrototype,{ptrType:n,ptr:d})}var _t=e=>"undefined"==typeof FinalizationRegistry?(_t=e=>e,e):(Qe=new FinalizationRegistry((e=>{rt(e.$$)})),_t=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};Qe.register(e,r,e)}return e},et=e=>Qe.unregister(e),_t(e)),gt=()=>{Object.assign(yt.prototype,{isAliasOf(e){if(!(this instanceof yt))return!1;if(!(e instanceof yt))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,s=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)s=i.upcast(s),i=i.baseClass;return t===i&&r===s},clone(){if(this.$$.ptr||Je(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=_t(Object.create(Object.getPrototypeOf(this),{$$:{value:Ze(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),et(this),rt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),ot.push(this),1===ot.length&&Ye&&Ye(dt),this.$$.deleteScheduled=!0,this}})};function yt(){}var vt=(e,t)=>Object.defineProperty(t,"name",{value:e}),bt=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||He(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},wt=(e,t,r)=>{s.hasOwnProperty(e)?((void 0===r||void 0!==s[e].overloadTable&&void 0!==s[e].overloadTable[r])&&He(`Cannot register public name '${e}' twice`),bt(s,e,e),s.hasOwnProperty(r)&&He(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),s[e].overloadTable[r]=t):(s[e]=t,void 0!==r&&(s[e].numArguments=r))},St=48,Et=57,At=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=St&&t<=Et?`_${e}`:e};function Bt(e,t,r,i,s,n,a,o){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=s,this.getActualType=n,this.upcast=a,this.downcast=o,this.pureVirtualFunctions=[]}var Ut=(e,t,r)=>{for(;t!==r;)t.upcast||He(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function xt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ut(t.$$.ptr,r,this.registeredClass)}function kt(e,t){var r;if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=Ut(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&He("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var s=t.clone();r=this.rawShare(r,nr.toHandle((()=>s.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:He("Unsupporting sharing policy")}return r}function Tt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ut(t.$$.ptr,r,this.registeredClass)}function Ct(e){return this.fromWireType(x[e>>2])}var Dt=()=>{Object.assign(Lt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:Ke,readValueFromPointer:Ct,deleteObject(e){null!==e&&e.delete()},fromWireType:mt})};function Lt(e,t,r,i,s,n,a,o,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=s,this.pointeeType=n,this.sharingPolicy=a,this.rawGetPointee=o,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,s||void 0!==t.baseClass?this.toWireType=kt:i?(this.toWireType=xt,this.destructorFunction=null):(this.toWireType=Tt,this.destructorFunction=null)}var It,Ft,Pt=(e,t,r)=>{s.hasOwnProperty(e)||Ve("Replacing nonexistant public symbol"),void 0!==s[e].overloadTable&&void 0!==r?s[e].overloadTable[r]=t:(s[e]=t,s[e].argCount=r)},Mt=(e,t,r)=>{var i=s["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},Rt=[],zt=e=>{var t=Rt[e];return t||(e>=Rt.length&&(Rt.length=e+1),Rt[e]=t=It.get(e)),t},Nt=(e,t,r)=>e.includes("j")?Mt(e,t,r):zt(t).apply(null,r),Ot=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),Nt(e,t,r)}},Gt=(e,t)=>{var r=(e=Ne(e)).includes("j")?Ot(e,t):zt(t);return"function"!=typeof r&&He(`unknown function pointer with signature ${e}: ${t}`),r},$t=(e,t)=>{var r=vt(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},Ht=e=>{var t=di(e),r=Ne(t);return ai(t),r},Vt=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Ge[t]||($e[t]?$e[t].forEach(e):(r.push(t),i[t]=!0))})),new Ft(`${e}: `+r.map(Ht).join([", "]))},Wt=(e,t,r,i,s,n,a,o,d,l,c,u,h)=>{c=Ne(c),n=Gt(s,n),o&&(o=Gt(a,o)),l&&(l=Gt(d,l)),h=Gt(u,h);var f=At(c);wt(f,(function(){Vt(`Cannot construct ${c} due to unbound types`,[i])})),We([e,t,r],i?[i]:[],(function(t){var r,s;t=t[0],s=i?(r=t.registeredClass).instancePrototype:yt.prototype;var a=vt(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new Pe("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new Pe(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new Pe(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(s,{constructor:{value:a}});a.prototype=d;var u=new Bt(c,a,d,h,r,n,o,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new Lt(c,u,!0,!1,!1),m=new Lt(c+"*",u,!1,!1,!1),_=new Lt(c+" const*",u,!1,!0,!1);return st[e]={pointerType:m,constPointerType:_},Pt(f,a),[p,m,_]}))},jt=(e,t)=>{for(var r=[],i=0;i>2]);return r},qt=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Yt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=vt(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,s=e.apply(i,t);return s instanceof Object?s:i}function Kt(e,t,r,i,s,n){var a=t.length;a<2&&He("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||n?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=o?1:2;l{var a=jt(t,r);s=Gt(i,s),We([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Pe(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Vt(`Cannot construct ${e.name} due to unbound types`,a)},We([],a,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Kt(r,i,null,s,n),[]))),[]}))},Zt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Jt=(e,t,r,i,s,n,a,o,d)=>{var l=jt(r,i);t=Ne(t),t=Zt(t),n=Gt(s,n),We([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function s(){Vt(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(s.argCount=r-2,s.className=e.name,c[t]=s):(bt(c,t,i),c[t].overloadTable[r-2]=s),We([],l,(function(s){var o=Kt(i,s,e,n,a,d);return void 0===c[t].overloadTable?(o.argCount=r-2,c[t]=o):c[t].overloadTable[r-2]=o,[]})),[]}))};function Qt(){Object.assign(er.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function er(){this.allocated=[void 0],this.freelist=[]}var tr=new er,rr=e=>{e>=tr.reserved&&0==--tr.get(e).refcount&&tr.free(e)},ir=()=>{for(var e=0,t=tr.reserved;t{tr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),tr.reserved=tr.allocated.length,s.count_emval_handles=ir},nr={toValue:e=>(e||He("Cannot use deleted val. handle = "+e),tr.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return tr.allocate({refcount:1,value:e})}}};function ar(e){return this.fromWireType(U[e>>2])}var or=(e,t)=>{qe(e,{name:t=Ne(t),fromWireType:e=>{var t=nr.toValue(e);return rr(e),t},toWireType:(e,t)=>nr.toHandle(t),argPackAdvance:Ke,readValueFromPointer:ar,destructorFunction:null})},dr=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},lr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(k[e>>2])};case 8:return function(e){return this.fromWireType(T[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},cr=(e,t,r)=>{qe(e,{name:t=Ne(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Ke,readValueFromPointer:lr(t,r),destructorFunction:null})},ur=(e,t,r)=>{switch(t){case 1:return r?e=>S[e>>0]:e=>E[e>>0];case 2:return r?e=>A[e>>1]:e=>B[e>>1];case 4:return r?e=>U[e>>2]:e=>x[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},hr=(e,t,r,i,s)=>{t=Ne(t);var n=e=>e;if(0===i){var a=32-8*r;n=e=>e<>>a}var o=t.includes("unsigned");qe(e,{name:t,fromWireType:n,toWireType:o?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:Ke,readValueFromPointer:ur(t,r,0!==i),destructorFunction:null})},fr=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function s(e){var t=x[e>>2],r=x[e+4>>2];return new i(S.buffer,r,t)}qe(e,{name:r=Ne(r),fromWireType:s,argPackAdvance:Ke,readValueFromPointer:s},{ignoreDuplicateRegistrations:!0})},pr=(e,t,r)=>_e(e,E,t,r),mr=(e,t)=>{var r="std::string"===(t=Ne(t));qe(e,{name:t,fromWireType(e){var t,i=x[e>>2],s=e+4;if(r)for(var n=s,a=0;a<=i;++a){var o=s+a;if(a==i||0==E[o]){var d=Ce(n,o-n);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),n=o+1}}else{var l=new Array(i);for(a=0;a>2]=i,r&&s)pr(t,a,i+1);else if(s)for(var o=0;o255&&(ai(a),He("String has UTF-16 code units that do not fit in 8 bits")),E[a+o]=d}else for(o=0;o{for(var r=e,i=r>>1,s=i+t/2;!(i>=s)&&B[i];)++i;if((r=i<<1)-e>32&&_r)return _r.decode(E.subarray(e,r));for(var n="",a=0;!(a>=t/2);++a){var o=A[e+2*a>>1];if(0==o)break;n+=String.fromCharCode(o)}return n},yr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,s=(r-=2)<2*e.length?r/2:e.length,n=0;n>1]=a,t+=2}return A[t>>1]=0,t-i},vr=e=>2*e.length,br=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var s=U[e+4*r>>2];if(0==s)break;if(++r,s>=65536){var n=s-65536;i+=String.fromCharCode(55296|n>>10,56320|1023&n)}else i+=String.fromCharCode(s)}return i},wr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,s=i+r-4,n=0;n=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++n)),U[t>>2]=a,(t+=4)+4>s)break}return U[t>>2]=0,t-i},Sr=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},Er=(e,t,r)=>{var i,s,n,a,o;r=Ne(r),2===t?(i=gr,s=yr,a=vr,n=()=>B,o=1):4===t&&(i=br,s=wr,a=Sr,n=()=>x,o=2),qe(e,{name:r,fromWireType:e=>{for(var r,s=x[e>>2],a=n(),d=e+4,l=0;l<=s;++l){var c=e+4+l*t;if(l==s||0==a[c>>o]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return ai(e),r},toWireType:(e,i)=>{"string"!=typeof i&&He(`Cannot pass non-string to C++ string type ${r}`);var n=a(i),d=li(4+n+t);return x[d>>2]=n>>o,s(i,d+4,n+t),null!==e&&e.push(ai,d),d},argPackAdvance:Ke,readValueFromPointer:ar,destructorFunction(e){ai(e)}})},Ar=(e,t)=>{qe(e,{isVoid:!0,name:t=Ne(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},Br={},Ur=e=>{var t=Br[e];return void 0===t?Ne(e):t},xr=[],kr=(e,t,r,i,s)=>(e=xr[e])(t=nr.toValue(t),t[r=Ur(r)],i,s),Tr=e=>{var t=xr.length;return xr.push(e),t},Cr=(e,t)=>{var r=Ge[e];return void 0===r&&He(t+" has unknown type "+Ht(e)),r},Dr=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},Lr=(e,t,r)=>{var i=[],s=e.toWireType(i,r);return i.length&&(x[t>>2]=nr.toHandle(i)),s},Ir=(e,t,r)=>{var i=Dr(e,t),s=i.shift();e--;var n="return function (obj, func, destructorsRef, args) {\n",a=0,o=[];0===r&&o.push("obj");for(var d=["retType"],l=[s],c=0;ce.name)).join(", ")}) => ${s.name}>`;return Tr(vt(h,u))},Fr=e=>{var t=nr.toValue(e);qt(t),rr(e)},Pr=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,Mr=()=>{j("")},Rr=()=>Date.now(),zr=(e,t,r)=>E.copyWithin(e,t,t+r),Nr=e=>{j("OOM")},Or=e=>{E.length,Nr()},Gr={},$r=()=>l||"./this.program",Hr=()=>{if(!Hr.strings){var e={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",_:$r()};for(var t in Gr)void 0===Gr[t]?delete e[t]:e[t]=Gr[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Hr.strings=r}return Hr.strings},Vr=(e,t)=>{for(var r=0;r>0]=e.charCodeAt(r);S[t>>0]=0},Wr=(e,t)=>{var r=0;return Hr().forEach(((i,s)=>{var n=t+r;x[e+4*s>>2]=n,Vr(i,n),r+=i.length+1})),0},jr=(e,t)=>{var r=Hr();x[e>>2]=r.length;var i=0;return r.forEach((e=>i+=e.length+1)),x[t>>2]=i,0};function qr(e){try{var t=De.getStreamFromFD(e);return Te.close(t),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Yr(e,t){try{var r=De.getStreamFromFD(e),i=r.tty?2:Te.isDir(r.mode)?3:Te.isLink(r.mode)?7:4;return S[t>>0]=i,A[t+2>>1]=0,K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[t+8>>2]=K[0],U[t+12>>2]=K[1],K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[t+16>>2]=K[0],U[t+20>>2]=K[1],0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Kr=(e,t,r,i)=>{for(var s=0,n=0;n>2],o=x[t+4>>2];t+=8;var d=Te.read(e,S,a,o,i);if(d<0)return-1;if(s+=d,d>2]=n,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Zr(e,t,r,i,s){var n=Pr(t,r);try{if(isNaN(n))return 61;var a=De.getStreamFromFD(e);return Te.llseek(a,n,i),K=[a.position>>>0,(Y=a.position,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[s>>2]=K[0],U[s+4>>2]=K[1],a.getdents&&0===n&&0===i&&(a.getdents=null),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Jr=(e,t,r,i)=>{for(var s=0,n=0;n>2],o=x[t+4>>2];t+=8;var d=Te.write(e,S,a,o,i);if(d<0)return-1;s+=d,void 0!==i&&(i+=d)}return s};function Qr(e,t,r,i){try{var s=De.getStreamFromFD(e),n=Jr(s,t,r);return x[i>>2]=n,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var ei=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=Te.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},ti=365,ri=146;Object.defineProperties(ei.prototype,{read:{get:function(){return(this.mode&ti)===ti},set:function(e){e?this.mode|=ti:this.mode&=~ti}},write:{get:function(){return(this.mode&ri)===ri},set:function(e){e?this.mode|=ri:this.mode&=~ri}},isFolder:{get:function(){return Te.isDir(this.mode)}},isDevice:{get:function(){return Te.isChrdev(this.mode)}}}),Te.FSNode=ei,Te.createPreloadedFile=Ue,Te.staticInit(),ze(),Pe=s.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Me=s.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},gt(),ct(),Dt(),Ft=s.UnboundTypeError=$t(Error,"UnboundTypeError"),Qt(),sr();var ii,si={o:ae,A:Le,s:Ie,q:Re,C:Xe,D:Wt,y:Xt,h:Jt,B:or,l:cr,c:hr,b:fr,m:mr,j:Er,n:Ar,f:kr,g:rr,e:Ir,d:Fr,a:Mr,i:Rr,w:zr,r:Or,u:Wr,v:jr,k:qr,t:Yr,z:Xr,p:Zr,x:Qr},ni=ie(),ai=e=>(ai=ni.G)(e),oi=()=>(oi=ni.I)(),di=e=>(di=ni.J)(e),li=e=>(li=ni.K)(e),ci=e=>(ci=ni.M)(e);function ui(){function e(){ii||(ii=!0,s.calledRun=!0,C||(R(),t(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),z()))}$>0||(M(),$>0||(s.setStatus?(s.setStatus("Running..."),setTimeout((function(){setTimeout((function(){s.setStatus("")}),1),e()}),1)):e()))}if(s.dynCall_viiijj=(e,t,r,i,n,a,o,d)=>(s.dynCall_viiijj=ni.N)(e,t,r,i,n,a,o,d),s.dynCall_jij=(e,t,r,i)=>(s.dynCall_jij=ni.O)(e,t,r,i),s.dynCall_jii=(e,t,r)=>(s.dynCall_jii=ni.P)(e,t,r),s.dynCall_jiji=(e,t,r,i,n)=>(s.dynCall_jiji=ni.Q)(e,t,r,i,n),H=function e(){ii||ui(),ii||(H=e)},s.preInit)for("function"==typeof s.preInit&&(s.preInit=[s.preInit]);s.preInit.length>0;)s.preInit.pop()();return ui(),e.ready}),a=1e-6,o="undefined"!=typeof Float32Array?Float32Array:Array;function d(){var e=new o(16);return o!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function l(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var c,u=function(e,t,r,i,s,n,a){var o=1/(t-r),d=1/(i-s),l=1/(n-a);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*d,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*o,e[13]=(s+i)*d,e[14]=(a+n)*l,e[15]=1,e};function h(e,t,r){var i=new o(3);return i[0]=e,i[1]=t,i[2]=r,i}c=new o(3),o!=Float32Array&&(c[0]=0,c[1]=0,c[2]=0);var f=(e,t)=>{t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);const r=function(){const t=m(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),r=m(e.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))return console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(i)),null;return i}();let i={program:r,attribLocations:{vertexPosition:e.getAttribLocation(r,"aVertexPosition"),texturePosition:e.getAttribLocation(r,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(r,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(r,"uModelMatrix"),viewMatrix:e.getUniformLocation(r,"uViewMatrix"),rgbatexture:e.getUniformLocation(r,"rgbaTexture"),ytexture:e.getUniformLocation(r,"yTexture"),utexture:e.getUniformLocation(r,"uTexture"),vtexture:e.getUniformLocation(r,"vTexture"),isyuv:e.getUniformLocation(r,"isyuv")}},s=function(){const t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),e.STATIC_DRAW);var r=[];r=r.concat([0,1],[1,1],[1,0],[0,0]);const i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW);const s=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,s);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,texPosition:i,indices:s}}(),n=p(),o=p(),c=p(),f=p();function p(){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function m(t,r){const i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(console.log("An error occurred compiling the shaders: "+e.getShaderInfoLog(i)),e.deleteShader(i),null)}function _(t,r){e.viewport(0,0,t,r),e.clearColor(0,0,0,0),e.clearDepth(1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);const n=d();u(n,-1,1,-1,1,.1,100);const p=d();l(p);const m=d();!function(e,t,r,i){var s,n,o,d,c,u,h,f,p,m,_=t[0],g=t[1],y=t[2],v=i[0],b=i[1],w=i[2],S=r[0],E=r[1],A=r[2];Math.abs(_-S)32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let r=e-this._current_word_bits_left;this._fillCurrentWord();let i=Math.min(r,this._current_word_bits_left),s=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const $t=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Ht=$t,Vt=$t;function Wt(e){let{profile:t,sampleRate:r,channel:i}=e;return new Uint8Array([175,0,t<<3|(14&r)>>1,(1&r)<<7|i<<3])}function jt(e){return qt(e)&&e[1]===Ut}function qt(e){return e[0]>>4===Ne}const Yt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Kt(e){let t=new Uint8Array(e),r=null,i=0,s=0,n=0,a=null;if(i=s=t[0]>>>3,n=(7&t[0])<<1|t[1]>>>7,n<0||n>=Yt.length)return void console.error("Flv: AAC invalid sampling frequency index!");let o=Yt[n],d=(120&t[1])>>>3;if(d<0||d>=8)return void console.log("Flv: AAC invalid channel configuration");5===i&&(a=(7&t[1])<<1|t[2]>>>7,t[2]);let l=self.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?n>=6?(i=5,r=new Array(4),a=n-3):(i=2,r=new Array(2),a=n):-1!==l.indexOf("android")?(i=2,r=new Array(2),a=n):(i=5,a=n,r=new Array(4),n>=6?a=n-3:1===d&&(i=2,r=new Array(2),a=n)),r[0]=i<<3,r[0]|=(15&n)>>>1,r[1]=(15&n)<<7,r[1]|=(15&d)<<3,5===i&&(r[1]|=(15&a)>>>1,r[2]=(1&a)<<7,r[2]|=8,r[3]=0),{audioType:"aac",config:r,sampleRate:o,channelCount:d,objectType:i,codec:"mp4a.40."+i,originalCodec:"mp4a.40."+s}}class Xt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+7>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(4095===(r[t+0]<<8|r[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let r=this.current_syncword_offset_,i=(8&e[r+1])>>>3,s=(6&e[r+1])>>>1,n=1&e[r+1],a=(192&e[r+2])>>>6,o=(60&e[r+2])>>>2,d=(1&e[r+2])<<2|(192&e[r+3])>>>6,l=(3&e[r+3])<<11|e[r+4]<<3|(224&e[r+5])>>>5;if(e[r+6],r+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let c=1===n?7:9,u=l-c;r+=c;let h=this.findNextSyncwordOffset(r+u);if(this.current_syncword_offset_=h,0!==i&&1!==i||0!==s)continue;let f=e.subarray(r,r+u);t={},t.audio_object_type=a+1,t.sampling_freq_index=o,t.sampling_frequency=Ht[o],t.channel_config=d,t.data=f}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Zt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+1>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(695===(r[t+0]<<3|r[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),r=0;for(let i=0;i<=t;i++)r<<=8,r|=e.readByte();return r}readNextAACFrame(e){let t=this.data_,r=null;for(;null==r&&!this.eof_flag_;){let i=this.current_syncword_offset_,s=(31&t[i+1])<<8|t[i+2];if(i+3+s>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let n=new Gt(t.subarray(i+3,i+3+s)),a=null;if(n.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(i+3+s),n.destroy();continue}a=e}else{let e=n.readBool();if(e&&n.readBool()){console.error("audioMuxVersionA is Not Supported"),n.destroy();break}if(e&&this.getLATMValue(n),!n.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),n.destroy();break}if(0!==n.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),n.destroy();break}if(0!==n.readBits(4)){console.error("more than 2 numProgram Not Supported"),n.destroy();break}if(0!==n.readBits(3)){console.error("more than 2 numLayer Not Supported"),n.destroy();break}let t=e?this.getLATMValue(n):0,r=n.readBits(5);t-=5;let i=n.readBits(4);t-=4;let s=n.readBits(4);t-=4,n.readBits(3),t-=3,t>0&&n.readBits(t);let o=n.readBits(3);if(0!==o){console.error(`frameLengthType = ${o}. Only frameLengthType = 0 Supported`),n.destroy();break}n.readByte();let d=n.readBool();if(d)if(e)this.getLATMValue(n);else{let e=0;for(;;){e<<=8;let t=n.readBool();if(e+=n.readByte(),!t)break}console.log(e)}n.readBool()&&n.readByte(),a={},a.audio_object_type=r,a.sampling_freq_index=i,a.sampling_frequency=Ht[a.sampling_freq_index],a.channel_config=s,a.other_data_present=d}let o=0;for(;;){let e=n.readByte();if(o+=e,255!==e)break}let d=new Uint8Array(o);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function Qt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return;const r=e.length,i=[];let s,n=0;for(;n+t>>=8),n+=t,s){if(n+s>r)break;i.push(e.subarray(n,n+s)),n+=s}return i}function er(e){const t=e.byteLength,r=new Uint8Array(4);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t;const i=new Uint8Array(t+4);return i.set(r,0),i.set(e,4),i}function tr(e,t){let r=null;return t?e.length>=28&&(r=1+(3&e[26])):e.length>=12&&(r=1+(3&e[9])),r}function rr(){return(new Date).getTime()}function ir(e,t,r){return Math.max(Math.min(e,Math.max(t,r)),Math.min(t,r))}function sr(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function nr(e){let t=0,r=sr();return i=>{if(s=i,"[object Number]"!==Object.prototype.toString.call(s))return;var s;t+=i;const n=sr(),a=n-r;a>=1e3&&(e(t/a*1e3),r=n,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();function ar(e){return null==e}function or(e){return!ar(e)}function dr(e){return"function"==typeof e}function lr(e){let t=null,r=31&e[0];return r!==He&&r!==Ve||(t=Re),t||(r=(126&e[0])>>1,r!==st&&r!==at&&r!==dt||(t=ze)),t}function cr(){return"undefined"!=typeof WritableStream}function ur(e){e.close()}function hr(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let r=e[0],i=null,s=1;if(e.length>0){let t=e[1];t&&t.ts-r.ts>1e5&&(r=t,s=2)}if(r)for(let n=s;n=1e3){e[n-1].ts-r.ts<1e3&&(i=n+1)}}}return i}function fr(e){return e.ok&&e.status>=200&&e.status<=299}function pr(){return function(e){let t="";if("object"==typeof e)try{t=JSON.stringify(e),t=JSON.parse(t)}catch(r){t=e}else t=e;return t}(U)}function mr(e){return e[0]>>4===xt&&e[1]===Ut}function _r(e){return!0===e||"true"===e}function gr(e){return!0!==e&&"true"!==e}function yr(){return!!(self.Worker&&self.MediaSource&&"canConstructInDedicatedWorker"in self.MediaSource&&!0===self.MediaSource.canConstructInDedicatedWorker)}function vr(e,t){const r=Qt(e.slice(5));let i=!1;return r.forEach((e=>{const r=t?e[0]>>>1&63:31&e[0];(t&&(r===Je||r===et||r===rt)||gr(t)&&r===We)&&(i=!0)})),i}var br=function(e,t,r,i){return new(r||(r=Promise))((function(s,n){function a(e){try{d(i.next(e))}catch(e){n(e)}}function o(e){try{d(i.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}d((i=i.apply(e,t||[])).next())}))};const wr=Symbol(32),Sr=Symbol(16),Er=Symbol(8);class Ar{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return br(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,r)=>{var i;this.reject=r,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(i=this.pull)||void 0===i||i.call(this,e)}))}))}readU32(){return this.read(wr)}readU16(){return this.read(Sr)}readU8(){return this.read(Er)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let r=0;const i=e=>t.length<(r=e);if("number"==typeof this.need){if(i(this.need))return;e=t.subarray(0,r)}else if(this.need===wr){if(i(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Sr){if(i(2))return;e=t[0]<<8|t[1]}else if(this.need===Er){if(i(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(i(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,r)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(i(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,r)),e=this.need}return this.consumed+=r,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,r=t+e;if(r<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,r);else{const e=new Uint8Array(r);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,r)}return this.buffer=new Uint8Array(e),this.buffer}}Ar.U32=wr,Ar.U16=Sr,Ar.U8=Er;class Br{constructor(e){this.log=function(t){if(e._opt.debugLevel==w){const n=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s1?r-1:0),s=1;s1?i-1:0),n=1;n=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[s]=t[e],s++);return new Uint8Array(i.buffer,0,s)}static parseSPS(e){let t=Ur._ebsp2rbsp(e),r=new Gt(t);r.readByte();let i=r.readByte();r.readByte();let s=r.readByte();r.readUEG();let n=Ur.getProfileString(i),a=Ur.getLevelString(s),o=1,d=420,l=[0,420,422,444],c=8;if((100===i||110===i||122===i||244===i||44===i||83===i||86===i||118===i||128===i||138===i||144===i)&&(o=r.readUEG(),3===o&&r.readBits(1),o<=3&&(d=l[o]),c=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool())){let e=3!==o?8:12;for(let t=0;t0&&e<16?(b=t[e-1],w=i[e-1]):255===e&&(b=r.readByte()<<8|r.readByte(),w=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);E=r.readBool(),A=t,B=2*e,S=A/B}}let U=1;1===b&&1===w||(U=b/w);let x=0,k=0;if(0===o)x=1,k=2-m;else{x=3===o?1:2,k=(1===o?2:1)*(2-m)}let T=16*(f+1),C=16*(p+1)*(2-m);T-=(_+g)*x,C-=(y+v)*k;let D=Math.ceil(T*U);return r.destroy(),r=null,{profile_string:n,level_string:a,bit_depth:c,ref_frames:h,chroma_format:d,chroma_format_string:Ur.getChromaFormatString(d),frame_rate:{fixed:E,fps:S,fps_den:B,fps_num:A},sar_ratio:{width:b,height:w},codec_size:{width:T,height:C},present_size:{width:D,height:C}}}static parseSPS$2(e){let t=e.subarray(1,4),r="avc1.";for(let e=0;e<3;e++){let i=t[e].toString(16);i.length<2&&(i="0"+i),r+=i}let i=Ur._ebsp2rbsp(e),s=new Gt(i);s.readByte();let n=s.readByte();s.readByte();let a=s.readByte();s.readUEG();let o=Ur.getProfileString(n),d=Ur.getLevelString(a),l=1,c=420,u=[0,420,422,444],h=8,f=8;if((100===n||110===n||122===n||244===n||44===n||83===n||86===n||118===n||128===n||138===n||144===n)&&(l=s.readUEG(),3===l&&s.readBits(1),l<=3&&(c=u[l]),h=s.readUEG()+8,f=s.readUEG()+8,s.readBits(1),s.readBool())){let e=3!==l?8:12;for(let t=0;t0&&e<16?(E=t[e-1],A=r[e-1]):255===e&&(E=s.readByte()<<8|s.readByte(),A=s.readByte()<<8|s.readByte())}if(s.readBool()&&s.readBool(),s.readBool()&&(s.readBits(4),s.readBool()&&s.readBits(24)),s.readBool()&&(s.readUEG(),s.readUEG()),s.readBool()){let e=s.readBits(32),t=s.readBits(32);U=s.readBool(),x=t,k=2*e,B=x/k}}let T=1;1===E&&1===A||(T=E/A);let C=0,D=0;if(0===l)C=1,D=2-y;else{C=3===l?1:2,D=(1===l?2:1)*(2-y)}let L=16*(_+1),I=16*(g+1)*(2-y);L-=(v+b)*C,I-=(w+S)*D;let F=Math.ceil(L*T);return s.destroy(),s=null,{codec_mimetype:r,profile_idc:n,level_idc:a,profile_string:o,level_string:d,chroma_format_idc:l,bit_depth:h,bit_depth_luma:h,bit_depth_chroma:f,ref_frames:m,chroma_format:c,chroma_format_string:Ur.getChromaFormatString(c),frame_rate:{fixed:U,fps:B,fps_den:k,fps_num:x},sar_ratio:{width:E,height:A},codec_size:{width:L,height:I},present_size:{width:F,height:I}}}static _skipScalingList(e,t){let r=8,i=8,s=0;for(let n=0;n=this.buflen)return this.iserro=!0,0;this.iserro=!1,r=this.bufoff+e>8?8-this.bufoff:e,t<<=r,t+=this.buffer[this.bufpos]>>8-this.bufoff-r&255>>8-r,this.bufoff+=r,e-=r,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,r=this.bufoff,i=this.read(e);return this.bufpos=t,this.bufoff=r,i}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.sps,4),t.sps=i}if(t.pps){const e=t.pps.byteLength,r=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.pps,4),t.pps=i}return t}function Tr(e){let{sps:t,pps:r}=e;const i=[23,0,0,0,0,1,66,0,30,255];i[0]=23,i[6]=t[1],i[7]=t[2],i[8]=t[3],i[10]=225,i[11]=t.byteLength>>8&255,i[12]=255&t.byteLength,i.push(...t,1,r.byteLength>>8&255,255&r.byteLength,...r);return new Uint8Array(i)}function Cr(e){let{sps:t,pps:r}=e,i=8+t.byteLength+1+2+r.byteLength,s=!1;const n=Ur.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(s=!0,i+=4);let a=new Uint8Array(i);a[0]=1,a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=255,a[5]=225;let o=t.byteLength;a[6]=o>>>8,a[7]=255&o;let d=8;a.set(t,8),d+=o,a[d]=1;let l=r.byteLength;a[d+1]=l>>>8,a[d+2]=255&l,a.set(r,d+3),d+=3+l,s&&(a[d]=252|n.chroma_format_idc,a[d+1]=248|n.bit_depth_luma-8,a[d+2]=248|n.bit_depth_chroma-8,a[d+3]=0,d+=4);const c=[23,0,0,0,0],u=new Uint8Array(c.length+a.byteLength);return u.set(c,0),u.set(a,c.length),u}function Dr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Lr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Ir(e){return 31&e[0]}function Fr(e){return e===Ye}function Pr(e){return!function(e){return e===He||e===Ve}(e)&&!Fr(e)}function Mr(e){return e===We}function Rr(e){if(0===e.length)return!1;const t=Ir(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=31&e[r],s=(128&e[r])>>>7,n=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=n,i>=Ze||0===s&&(t={type:i,data:e.subarray(r,n)})}return t}}class Nr{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Or=e=>{let t=e,r=t.byteLength,i=new Uint8Array(r),s=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[s]=t[e],s++);return new Uint8Array(i.buffer,0,s)},Gr=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class $r{static _ebsp2rbsp(e){let t=e,r=t.byteLength,i=new Uint8Array(r),s=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[s]=t[e],s++);return new Uint8Array(i.buffer,0,s)}static parseVPS(e){let t=$r._ebsp2rbsp(e),r=new Gt(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}}static parseSPS(e){let t=$r._ebsp2rbsp(e),r=new Gt(t);r.readByte(),r.readByte();let i=0,s=0,n=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<=16?(F=t[e-1],P=i[e-1]):255===e&&(F=r.readBits(16),P=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()){r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())}if(r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),L=r.readBool(),L&&(r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG()),r.readBool()){if(R=r.readBits(32),z=r.readBits(32),r.readBool()&&r.readUEG(),r.readBool()){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let s=0;s<=o;s++){let s=r.readBool();M=s;let n=!0,a=1;s||(n=r.readBool());let o=!1;if(n?r.readUEG():o=r.readBool(),o||(a=r.readUEG()+1),e){for(let e=0;e>6&3,r.general_tier_flag=e[1]>>5&1,r.general_profile_idc=31&e[1],r.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],r.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],r.general_constraint_indicator_flags=r.general_constraint_indicator_flags<<16|e[10]<<8|e[11],r.general_level_idc=e[12],r.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],r.parallelismType=3&e[15],r.chromaFormat=3&e[16],r.bitDepthLumaMinus8=7&e[17],r.bitDepthChromaMinus8=7&e[18],r.avgFrameRate=e[19]<<8|e[20],r.constantFrameRate=e[21]>>6&3,r.numTemporalLayers=e[21]>>3&7,r.temporalIdNested=e[21]>>2&1,r.lengthSizeMinusOne=3&e[21];let i=e[22],s=e.slice(23);for(let e=0;e0)for(let t=r;t<8;t++)e.read(2);i.sub_layer_profile_space=[],i.sub_layer_tier_flag=[],i.sub_layer_profile_idc=[],i.sub_layer_profile_compatibility_flag=[],i.sub_layer_progressive_source_flag=[],i.sub_layer_interlaced_source_flag=[],i.sub_layer_non_packed_constraint_flag=[],i.sub_layer_frame_only_constraint_flag=[],i.sub_layer_level_idc=[];for(let t=0;t{let t=Or(e),r=new Gt(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}})(t),a=(e=>{let t=Or(e),r=new Gt(t);r.readByte(),r.readByte();let i=0,s=0,n=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<16?(F=t[e-1],P=i[e-1]):255===e&&(F=r.readBits(16),P=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),L=r.readBool(),L&&(i+=r.readUEG(),s+=r.readUEG(),n+=r.readUEG(),a+=r.readUEG()),r.readBool()&&(R=r.readBits(32),z=r.readBits(32),r.readBool()&&(r.readUEG(),r.readBool()))){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let s=0;s<=o;s++){let s=r.readBool();M=s;let n=!1,a=1;s||(n=r.readBool());let o=!1;if(n?r.readSEG():o=r.readBool(),o||(cpbcnt=r.readUEG()+1),e)for(let e=0;e{let t=Or(e),r=new Gt(t);r.readByte(),r.readByte(),r.readUEG(),r.readUEG(),r.readBool(),r.readBool(),r.readBits(3),r.readBool(),r.readBool(),r.readUEG(),r.readUEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool()&&r.readUEG(),r.readSEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool(),r.readBool();let i=r.readBool(),s=r.readBool(),n=1;return s&&i?n=0:s?n=3:i&&(n=2),{parallelismType:n}})(r);s=Object.assign(s,n,a,o);let d=23+(5+t.byteLength)+(5+i.byteLength)+(5+r.byteLength),l=new Uint8Array(d);l[0]=1,l[1]=(3&s.general_profile_space)<<6|(s.general_tier_flag?1:0)<<5|31&s.general_profile_idc,l[2]=s.general_profile_compatibility_flags_1||0,l[3]=s.general_profile_compatibility_flags_2||0,l[4]=s.general_profile_compatibility_flags_3||0,l[5]=s.general_profile_compatibility_flags_4||0,l[6]=s.general_constraint_indicator_flags_1||0,l[7]=s.general_constraint_indicator_flags_2||0,l[8]=s.general_constraint_indicator_flags_3||0,l[9]=s.general_constraint_indicator_flags_4||0,l[10]=s.general_constraint_indicator_flags_5||0,l[11]=s.general_constraint_indicator_flags_6||0,l[12]=60,l[13]=240|(3840&s.min_spatial_segmentation_idc)>>8,l[14]=255&s.min_spatial_segmentation_idc,l[15]=252|3&s.parallelismType,l[16]=252|3&s.chroma_format_idc,l[17]=248|7&s.bit_depth_luma_minus8,l[18]=248|7&s.bit_depth_chroma_minus8,l[19]=0,l[20]=0,l[21]=(3&s.constant_frame_rate)<<6|(7&s.num_temporal_layers)<<3|(s.temporal_id_nested?1:0)<<2|3,l[22]=3,l[23]=128|st,l[24]=0,l[25]=1,l[26]=(65280&t.byteLength)>>8,l[27]=(255&t.byteLength)>>0,l.set(t,28),l[23+(5+t.byteLength)+0]=128|at,l[23+(5+t.byteLength)+1]=0,l[23+(5+t.byteLength)+2]=1,l[23+(5+t.byteLength)+3]=(65280&i.byteLength)>>8,l[23+(5+t.byteLength)+4]=(255&i.byteLength)>>0,l.set(i,23+(5+t.byteLength)+5),l[23+(5+t.byteLength+5+i.byteLength)+0]=128|dt,l[23+(5+t.byteLength+5+i.byteLength)+1]=0,l[23+(5+t.byteLength+5+i.byteLength)+2]=1,l[23+(5+t.byteLength+5+i.byteLength)+3]=(65280&r.byteLength)>>8,l[23+(5+t.byteLength+5+i.byteLength)+4]=(255&r.byteLength)>>0,l.set(r,23+(5+t.byteLength+5+i.byteLength)+5);const c=[28,0,0,0,0],u=new Uint8Array(c.length+l.byteLength);return u.set(c,0),u.set(l,c.length),u}function qr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Yr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Kr(e){return(126&e[0])>>1}function Xr(e){return e===ct}function Zr(e){return!function(e){return e>=32&&e<=40}(e)}function Jr(e){return e>=16&&e<=21}function Qr(e){if(0===e.length)return!1;const t=Kr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=e[r]>>1&63,s=(128&e[r])>>>7,n=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=n,0===s&&(t={type:i,data:e.subarray(r,n)})}return t}}class ti{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}function ri(e){return parseInt(e)===e}function ii(e){if(!ri(e.length))return!1;for(var t=0;t255)return!1;return!0}function si(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!ii(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(ri(e.length)&&ii(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function ni(e){return new Uint8Array(e)}function ai(e,t,r,i,s){null==i&&null==s||(e=e.slice?e.slice(i,s):Array.prototype.slice.call(e,i,s)),t.set(e,r)}var oi,di={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},li=(oi="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r>4]+oi[15&i])}return t.join("")}}),ci={16:10,24:12,32:14},ui=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],hi=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],fi=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],pi=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],mi=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],_i=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],gi=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],yi=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],vi=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],bi=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],wi=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Si=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Ei=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Ai=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Bi=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Ui(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=n[t],this._Kd[e-r][t%4]=n[t];for(var a,o=0,d=s;d>16&255]<<24^hi[a>>8&255]<<16^hi[255&a]<<8^hi[a>>24&255]^ui[o]<<24,o+=1,8!=s)for(t=1;t>8&255]<<8^hi[a>>16&255]<<16^hi[a>>24&255]<<24;for(t=s/2+1;t>2,c=d%4,this._Ke[l][c]=n[t],this._Kd[e-l][c]=n[t++],d++}for(var l=1;l>24&255]^Ei[a>>16&255]^Ai[a>>8&255]^Bi[255&a]},xi.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=Ui(e),s=0;s<4;s++)i[s]^=this._Ke[0][s];for(var n=1;n>24&255]^mi[i[(s+1)%4]>>16&255]^_i[i[(s+2)%4]>>8&255]^gi[255&i[(s+3)%4]]^this._Ke[n][s];i=r.slice()}var a,o=ni(16);for(s=0;s<4;s++)a=this._Ke[t][s],o[4*s]=255&(hi[i[s]>>24&255]^a>>24),o[4*s+1]=255&(hi[i[(s+1)%4]>>16&255]^a>>16),o[4*s+2]=255&(hi[i[(s+2)%4]>>8&255]^a>>8),o[4*s+3]=255&(hi[255&i[(s+3)%4]]^a);return o},xi.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=Ui(e),s=0;s<4;s++)i[s]^=this._Kd[0][s];for(var n=1;n>24&255]^vi[i[(s+3)%4]>>16&255]^bi[i[(s+2)%4]>>8&255]^wi[255&i[(s+1)%4]]^this._Kd[n][s];i=r.slice()}var a,o=ni(16);for(s=0;s<4;s++)a=this._Kd[t][s],o[4*s]=255&(fi[i[s]>>24&255]^a>>24),o[4*s+1]=255&(fi[i[(s+3)%4]>>16&255]^a>>16),o[4*s+2]=255&(fi[i[(s+2)%4]>>8&255]^a>>8),o[4*s+3]=255&(fi[255&i[(s+1)%4]]^a);return o};var ki=function(e){if(!(this instanceof ki))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new xi(e)};ki.prototype.encrypt=function(e){if((e=si(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=ni(e.length),r=ni(16),i=0;iNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},Li.prototype.setBytes=function(e){if(16!=(e=si(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Li.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var Ii=function(e,t){if(!(this instanceof Ii))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Li||(t=new Li(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new xi(e)};Ii.prototype.encrypt=function(e){for(var t=si(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,i=0;i>>2]>>>24-n%4*8&255;t[i+n>>>2]|=a<<24-(i+n)%4*8}else for(var o=0;o>>2]=r[o>>>2];return this.sigBytes+=s,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-s%4*8&255;i.push((n>>>4).toString(16)),i.push((15&n).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new l.init(r,t/2)}},h=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s>>2]>>>24-s%4*8&255;i.push(String.fromCharCode(n))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new l.init(r,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,s=i.words,n=i.sigBytes,a=this.blockSize,o=n/(4*a),d=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*a,c=e.min(4*d,n);if(d){for(var u=0;u>>2]|=e[s]<<24-s%4*8;t.call(this,i,r)}else t.apply(this,arguments)};i.prototype=e}}(),r.lib.WordArray)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(){var e=r,t=e.lib.WordArray,i=e.enc;function s(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s>>2]>>>16-s%4*8&65535;i.push(String.fromCharCode(n))}return i.join("")},parse:function(e){for(var r=e.length,i=[],s=0;s>>1]|=e.charCodeAt(s)<<16-s%2*16;return t.create(i,2*r)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535);i.push(String.fromCharCode(a))}return i.join("")},parse:function(e){for(var r=e.length,i=[],n=0;n>>1]|=s(e.charCodeAt(n)<<16-n%2*16);return t.create(i,2*r)}}}(),r.enc.Utf16)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(){var e=r,t=e.lib.WordArray;function i(e,r,i){for(var s=[],n=0,a=0;a>>6-a%4*2;s[n>>>2]|=o<<24-n%4*8,n++}return t.create(s,n)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var s=[],n=0;n>>2]>>>24-n%4*8&255)<<16|(t[n+1>>>2]>>>24-(n+1)%4*8&255)<<8|t[n+2>>>2]>>>24-(n+2)%4*8&255,o=0;o<4&&n+.75*o>>6*(3-o)&63));var d=i.charAt(64);if(d)for(;s.length%4;)s.push(d);return s.join("")},parse:function(e){var t=e.length,r=this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var n=0;n>>6-a%4*2;s[n>>>2]|=o<<24-n%4*8,n++}return t.create(s,n)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,s=t?this._safe_map:this._map;e.clamp();for(var n=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,d=0;d<4&&a+.75*d>>6*(3-d)&63));var l=s.charAt(64);if(l)for(;n.length%4;)n.push(l);return n.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,s=t?this._safe_map:this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var a=0;a>>24)|4278255360&(s<<24|s>>>8)}var n=this._hash.words,a=e[t+0],d=e[t+1],f=e[t+2],p=e[t+3],m=e[t+4],_=e[t+5],g=e[t+6],y=e[t+7],v=e[t+8],b=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],A=e[t+13],B=e[t+14],U=e[t+15],x=n[0],k=n[1],T=n[2],C=n[3];x=l(x,k,T,C,a,7,o[0]),C=l(C,x,k,T,d,12,o[1]),T=l(T,C,x,k,f,17,o[2]),k=l(k,T,C,x,p,22,o[3]),x=l(x,k,T,C,m,7,o[4]),C=l(C,x,k,T,_,12,o[5]),T=l(T,C,x,k,g,17,o[6]),k=l(k,T,C,x,y,22,o[7]),x=l(x,k,T,C,v,7,o[8]),C=l(C,x,k,T,b,12,o[9]),T=l(T,C,x,k,w,17,o[10]),k=l(k,T,C,x,S,22,o[11]),x=l(x,k,T,C,E,7,o[12]),C=l(C,x,k,T,A,12,o[13]),T=l(T,C,x,k,B,17,o[14]),x=c(x,k=l(k,T,C,x,U,22,o[15]),T,C,d,5,o[16]),C=c(C,x,k,T,g,9,o[17]),T=c(T,C,x,k,S,14,o[18]),k=c(k,T,C,x,a,20,o[19]),x=c(x,k,T,C,_,5,o[20]),C=c(C,x,k,T,w,9,o[21]),T=c(T,C,x,k,U,14,o[22]),k=c(k,T,C,x,m,20,o[23]),x=c(x,k,T,C,b,5,o[24]),C=c(C,x,k,T,B,9,o[25]),T=c(T,C,x,k,p,14,o[26]),k=c(k,T,C,x,v,20,o[27]),x=c(x,k,T,C,A,5,o[28]),C=c(C,x,k,T,f,9,o[29]),T=c(T,C,x,k,y,14,o[30]),x=u(x,k=c(k,T,C,x,E,20,o[31]),T,C,_,4,o[32]),C=u(C,x,k,T,v,11,o[33]),T=u(T,C,x,k,S,16,o[34]),k=u(k,T,C,x,B,23,o[35]),x=u(x,k,T,C,d,4,o[36]),C=u(C,x,k,T,m,11,o[37]),T=u(T,C,x,k,y,16,o[38]),k=u(k,T,C,x,w,23,o[39]),x=u(x,k,T,C,A,4,o[40]),C=u(C,x,k,T,a,11,o[41]),T=u(T,C,x,k,p,16,o[42]),k=u(k,T,C,x,g,23,o[43]),x=u(x,k,T,C,b,4,o[44]),C=u(C,x,k,T,E,11,o[45]),T=u(T,C,x,k,U,16,o[46]),x=h(x,k=u(k,T,C,x,f,23,o[47]),T,C,a,6,o[48]),C=h(C,x,k,T,y,10,o[49]),T=h(T,C,x,k,B,15,o[50]),k=h(k,T,C,x,_,21,o[51]),x=h(x,k,T,C,E,6,o[52]),C=h(C,x,k,T,p,10,o[53]),T=h(T,C,x,k,w,15,o[54]),k=h(k,T,C,x,d,21,o[55]),x=h(x,k,T,C,v,6,o[56]),C=h(C,x,k,T,U,10,o[57]),T=h(T,C,x,k,g,15,o[58]),k=h(k,T,C,x,A,21,o[59]),x=h(x,k,T,C,m,6,o[60]),C=h(C,x,k,T,S,10,o[61]),T=h(T,C,x,k,f,15,o[62]),k=h(k,T,C,x,b,21,o[63]),n[0]=n[0]+x|0,n[1]=n[1]+k|0,n[2]=n[2]+T|0,n[3]=n[3]+C|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,s=8*t.sigBytes;r[s>>>5]|=128<<24-s%32;var n=e.floor(i/4294967296),a=i;r[15+(s+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),r[14+(s+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var o=this._hash,d=o.words,l=0;l<4;l++){var c=d[l];d[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return o},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,i,s,n,a){var o=e+(t&r|~t&i)+s+a;return(o<>>32-n)+t}function c(e,t,r,i,s,n,a){var o=e+(t&i|r&~i)+s+a;return(o<>>32-n)+t}function u(e,t,r,i,s,n,a){var o=e+(t^r^i)+s+a;return(o<>>32-n)+t}function h(e,t,r,i,s,n,a){var o=e+(r^(t|~i))+s+a;return(o<>>32-n)+t}t.MD5=n._createHelper(d),t.HmacMD5=n._createHmacHelper(d)}(Math),r.MD5)})),Ot((function(e,t){var r,i,s,n,a,o,d,l;e.exports=(i=(r=l=Pi).lib,s=i.WordArray,n=i.Hasher,a=r.algo,o=[],d=a.SHA1=n.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],s=r[1],n=r[2],a=r[3],d=r[4],l=0;l<80;l++){if(l<16)o[l]=0|e[t+l];else{var c=o[l-3]^o[l-8]^o[l-14]^o[l-16];o[l]=c<<1|c>>>31}var u=(i<<5|i>>>27)+d+o[l];u+=l<20?1518500249+(s&n|~s&a):l<40?1859775393+(s^n^a):l<60?(s&n|s&a|n&a)-1894007588:(s^n^a)-899497514,d=a,a=n,n=s<<30|s>>>2,s=i,i=u}r[0]=r[0]+i|0,r[1]=r[1]+s|0,r[2]=r[2]+n|0,r[3]=r[3]+a|0,r[4]=r[4]+d|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=n._createHelper(d),r.HmacSHA1=n._createHmacHelper(d),l.SHA1)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(e){var t=r,i=t.lib,s=i.WordArray,n=i.Hasher,a=t.algo,o=[],d=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,s=0;s<64;)t(i)&&(s<8&&(o[s]=r(e.pow(i,.5))),d[s]=r(e.pow(i,1/3)),s++),i++}();var l=[],c=a.SHA256=n.extend({_doReset:function(){this._hash=new s.init(o.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],s=r[1],n=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,_=l[f-2],g=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;l[f]=m+l[f-7]+g+l[f-16]}var y=i&s^i&n^s&n,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=h+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&c^~o&u)+d[f]+l[f];h=u,u=c,c=o,o=a+b|0,a=n,n=s,s=i,i=b+(v+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+s|0,r[2]=r[2]+n|0,r[3]=r[3]+a|0,r[4]=r[4]+o|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,s=8*t.sigBytes;return r[s>>>5]|=128<<24-s%32,r[14+(s+64>>>9<<4)]=e.floor(i/4294967296),r[15+(s+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=n._createHelper(c),t.HmacSHA256=n._createHmacHelper(c)}(Math),r.SHA256)})),Ot((function(e,t){var r,i,s,n,a,o;e.exports=(i=(r=o=Pi).lib.WordArray,s=r.algo,n=s.SHA256,a=s.SHA224=n.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=n._createHelper(a),r.HmacSHA224=n._createHmacHelper(a),o.SHA224)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(){var e=r,t=e.lib.Hasher,i=e.x64,s=i.Word,n=i.WordArray,a=e.algo;function o(){return s.create.apply(s,arguments)}var d=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=o()}();var c=a.SHA512=t.extend({_doReset:function(){this._hash=new n.init([new s.init(1779033703,4089235720),new s.init(3144134277,2227873595),new s.init(1013904242,4271175723),new s.init(2773480762,1595750129),new s.init(1359893119,2917565137),new s.init(2600822924,725511199),new s.init(528734635,4215389547),new s.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],s=r[1],n=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=i.high,p=i.low,m=s.high,_=s.low,g=n.high,y=n.low,v=a.high,b=a.low,w=o.high,S=o.low,E=c.high,A=c.low,B=u.high,U=u.low,x=h.high,k=h.low,T=f,C=p,D=m,L=_,I=g,F=y,P=v,M=b,R=w,z=S,N=E,O=A,G=B,$=U,H=x,V=k,W=0;W<80;W++){var j,q,Y=l[W];if(W<16)q=Y.high=0|e[t+2*W],j=Y.low=0|e[t+2*W+1];else{var K=l[W-15],X=K.high,Z=K.low,J=(X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7,Q=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),ee=l[W-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,se=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),ne=l[W-7],ae=ne.high,oe=ne.low,de=l[W-16],le=de.high,ce=de.low;q=(q=(q=J+ae+((j=Q+oe)>>>0>>0?1:0))+ie+((j+=se)>>>0>>0?1:0))+le+((j+=ce)>>>0>>0?1:0),Y.high=q,Y.low=j}var ue,he=R&N^~R&G,fe=z&O^~z&$,pe=T&D^T&I^D&I,me=C&L^C&F^L&F,_e=(T>>>28|C<<4)^(T<<30|C>>>2)^(T<<25|C>>>7),ge=(C>>>28|T<<4)^(C<<30|T>>>2)^(C<<25|T>>>7),ye=(R>>>14|z<<18)^(R>>>18|z<<14)^(R<<23|z>>>9),ve=(z>>>14|R<<18)^(z>>>18|R<<14)^(z<<23|R>>>9),be=d[W],we=be.high,Se=be.low,Ee=H+ye+((ue=V+ve)>>>0>>0?1:0),Ae=ge+me;H=G,V=$,G=N,$=O,N=R,O=z,R=P+(Ee=(Ee=(Ee=Ee+he+((ue+=fe)>>>0>>0?1:0))+we+((ue+=Se)>>>0>>0?1:0))+q+((ue+=j)>>>0>>0?1:0))+((z=M+ue|0)>>>0>>0?1:0)|0,P=I,M=F,I=D,F=L,D=T,L=C,T=Ee+(_e+pe+(Ae>>>0>>0?1:0))+((C=ue+Ae|0)>>>0>>0?1:0)|0}p=i.low=p+C,i.high=f+T+(p>>>0>>0?1:0),_=s.low=_+L,s.high=m+D+(_>>>0>>0?1:0),y=n.low=y+F,n.high=g+I+(y>>>0>>0?1:0),b=a.low=b+M,a.high=v+P+(b>>>0>>0?1:0),S=o.low=S+z,o.high=w+R+(S>>>0>>0?1:0),A=c.low=A+O,c.high=E+N+(A>>>0>>0?1:0),U=u.low=U+$,u.high=B+G+(U>>>0<$>>>0?1:0),k=h.low=k+V,h.high=x+H+(k>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(c),e.HmacSHA512=t._createHmacHelper(c)}(),r.SHA512)})),Ot((function(e,t){var r,i,s,n,a,o,d,l;e.exports=(i=(r=l=Pi).x64,s=i.Word,n=i.WordArray,a=r.algo,o=a.SHA512,d=a.SHA384=o.extend({_doReset:function(){this._hash=new n.init([new s.init(3418070365,3238371032),new s.init(1654270250,914150663),new s.init(2438529370,812702999),new s.init(355462360,4144912697),new s.init(1731405415,4290775857),new s.init(2394180231,1750603025),new s.init(3675008525,1694076839),new s.init(1203062813,3204075428)])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=o._createHelper(d),r.HmacSHA384=o._createHmacHelper(d),l.SHA384)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(e){var t=r,i=t.lib,s=i.WordArray,n=i.Hasher,a=t.x64.Word,o=t.algo,d=[],l=[],c=[];!function(){for(var e=1,t=0,r=0;r<24;r++){d[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var s=1,n=0;n<24;n++){for(var o=0,u=0,h=0;h<7;h++){if(1&s){var f=(1<>>24)|4278255360&(n<<24|n>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(k=r[s]).high^=a,k.low^=n}for(var o=0;o<24;o++){for(var h=0;h<5;h++){for(var f=0,p=0,m=0;m<5;m++)f^=(k=r[h+5*m]).high,p^=k.low;var _=u[h];_.high=f,_.low=p}for(h=0;h<5;h++){var g=u[(h+4)%5],y=u[(h+1)%5],v=y.high,b=y.low;for(f=g.high^(v<<1|b>>>31),p=g.low^(b<<1|v>>>31),m=0;m<5;m++)(k=r[h+5*m]).high^=f,k.low^=p}for(var w=1;w<25;w++){var S=(k=r[w]).high,E=k.low,A=d[w];A<32?(f=S<>>32-A,p=E<>>32-A):(f=E<>>64-A,p=S<>>64-A);var B=u[l[w]];B.high=f,B.low=p}var U=u[0],x=r[0];for(U.high=x.high,U.low=x.low,h=0;h<5;h++)for(m=0;m<5;m++){var k=r[w=h+5*m],T=u[w],C=u[(h+1)%5+5*m],D=u[(h+2)%5+5*m];k.high=T.high^~C.high&D.high,k.low=T.low^~C.low&D.low}k=r[0];var L=c[o];k.high^=L.high,k.low^=L.low}},_doFinalize:function(){var t=this._data,r=t.words;this._nDataBytes;var i=8*t.sigBytes,n=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/n)*n>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,o=this.cfg.outputLength/8,d=o/8,l=[],c=0;c>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(h)}return new s.init(l,o)},clone:function(){for(var e=n.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=n._createHelper(h),t.HmacSHA3=n._createHmacHelper(h)}(Math),r.SHA3)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(e){var t=r,i=t.lib,s=i.WordArray,n=i.Hasher,a=t.algo,o=s.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=s.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=s.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=s.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=s.create([0,1518500249,1859775393,2400959708,2840853838]),h=s.create([1352829926,1548603684,1836072691,2053994217,0]),f=a.RIPEMD160=n.extend({_doReset:function(){this._hash=s.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,s=e[i];e[i]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}var n,a,f,b,w,S,E,A,B,U,x,k=this._hash.words,T=u.words,C=h.words,D=o.words,L=d.words,I=l.words,F=c.words;for(S=n=k[0],E=a=k[1],A=f=k[2],B=b=k[3],U=w=k[4],r=0;r<80;r+=1)x=n+e[t+D[r]]|0,x+=r<16?p(a,f,b)+T[0]:r<32?m(a,f,b)+T[1]:r<48?_(a,f,b)+T[2]:r<64?g(a,f,b)+T[3]:y(a,f,b)+T[4],x=(x=v(x|=0,I[r]))+w|0,n=w,w=b,b=v(f,10),f=a,a=x,x=S+e[t+L[r]]|0,x+=r<16?y(E,A,B)+C[0]:r<32?g(E,A,B)+C[1]:r<48?_(E,A,B)+C[2]:r<64?m(E,A,B)+C[3]:p(E,A,B)+C[4],x=(x=v(x|=0,F[r]))+U|0,S=U,U=B,B=v(A,10),A=E,E=x;x=k[1]+f+B|0,k[1]=k[2]+b+U|0,k[2]=k[3]+w+S|0,k[3]=k[4]+n+E|0,k[4]=k[0]+a+A|0,k[0]=x},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var s=this._hash,n=s.words,a=0;a<5;a++){var o=n[a];n[a]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return s},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function m(e,t,r){return e&t|~e&r}function _(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function v(e,t){return e<>>32-t}t.RIPEMD160=n._createHelper(f),t.HmacRIPEMD160=n._createHmacHelper(f)}(),r.RIPEMD160)})),Ot((function(e,t){var r,i,s;e.exports=(i=(r=Pi).lib.Base,s=r.enc.Utf8,void(r.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var n=this._oKey=t.clone(),a=this._iKey=t.clone(),o=n.words,d=a.words,l=0;l>>2];e.sigBytes-=t}};i.BlockCipher=c.extend({cfg:c.cfg.extend({mode:f,padding:p}),reset:function(){var e;c.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=i.CipherParams=s.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?n.create([1398893684,1701076831]).concat(r).concat(t):t).toString(d)},parse:function(e){var t,r=d.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=n.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),m.create({ciphertext:r,salt:t})}},g=i.SerializableCipher=s.extend({cfg:s.extend({format:_}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var s=e.createEncryptor(r,i),n=s.finalize(t),a=s.cfg;return m.create({ciphertext:n,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,i,s){if(i||(i=n.random(8)),s)a=l.create({keySize:t+r,hasher:s}).compute(e,i);else var a=l.create({keySize:t+r}).compute(e,i);var o=n.create(a.words.slice(t),4*r);return a.sigBytes=4*t,m.create({key:a,iv:o,salt:i})}},v=i.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var s=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=s.iv;var n=g.encrypt.call(this,e,t,s.key,i);return n.mixIn(s),n},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var s=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=s.iv,g.decrypt.call(this,e,t,s.key,i)}})}())})),Ot((function(e,t){var r;e.exports=((r=Pi).mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,i){var s,n=this._iv;n?(s=n.slice(0),this._iv=void 0):s=this._prevBlock,i.encryptBlock(s,0);for(var a=0;a>24&255)){var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}else e+=1<<24;return e}function i(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var s=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,s=r.blockSize,n=this._iv,a=this._counter;n&&(a=this._counter=n.slice(0),this._iv=void 0),i(a);var o=a.slice(0);r.encryptBlock(o,0);for(var d=0;d>>2]|=s<<24-n%4*8,e.sigBytes+=s},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),Ot((function(e,t){var r;e.exports=((r=Pi).pad.Iso10126={pad:function(e,t){var i=4*t,s=i-e.sigBytes%i;e.concat(r.lib.WordArray.random(s-1)).concat(r.lib.WordArray.create([s<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),Ot((function(e,t){var r;e.exports=((r=Pi).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),Ot((function(e,t){var r;e.exports=((r=Pi).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)})),Ot((function(e,t){var r;e.exports=((r=Pi).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(e){var t=r,i=t.lib.CipherParams,s=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(s)},parse:function(e){var t=s.parse(e);return i.create({ciphertext:t})}}}(),r.format.Hex)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(){var e=r,t=e.lib.BlockCipher,i=e.algo,s=[],n=[],a=[],o=[],d=[],l=[],c=[],u=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,s[r]=p,n[p]=r;var m=e[r],_=e[m],g=e[_],y=257*e[p]^16843008*p;a[r]=y<<24|y>>>8,o[r]=y<<16|y>>>16,d[r]=y<<8|y>>>24,l[r]=y,y=16843009*g^65537*_^257*m^16843008*r,c[p]=y<<24|y>>>8,u[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,r?(r=m^e[e[e[g^m]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=i.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),n=this._keySchedule=[],a=0;a6&&a%r==4&&(l=s[l>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[255&l]):(l=s[(l=l<<8|l>>>24)>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[255&l],l^=p[a/r|0]<<24),n[a]=n[a-r]^l);for(var o=this._invKeySchedule=[],d=0;d>>24]]^u[s[l>>>16&255]]^h[s[l>>>8&255]]^f[s[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,o,d,l,s)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,c,u,h,f,n),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,s,n,a,o){for(var d=this._nRounds,l=e[t]^r[0],c=e[t+1]^r[1],u=e[t+2]^r[2],h=e[t+3]^r[3],f=4,p=1;p>>24]^s[c>>>16&255]^n[u>>>8&255]^a[255&h]^r[f++],_=i[c>>>24]^s[u>>>16&255]^n[h>>>8&255]^a[255&l]^r[f++],g=i[u>>>24]^s[h>>>16&255]^n[l>>>8&255]^a[255&c]^r[f++],y=i[h>>>24]^s[l>>>16&255]^n[c>>>8&255]^a[255&u]^r[f++];l=m,c=_,u=g,h=y}m=(o[l>>>24]<<24|o[c>>>16&255]<<16|o[u>>>8&255]<<8|o[255&h])^r[f++],_=(o[c>>>24]<<24|o[u>>>16&255]<<16|o[h>>>8&255]<<8|o[255&l])^r[f++],g=(o[u>>>24]<<24|o[h>>>16&255]<<16|o[l>>>8&255]<<8|o[255&c])^r[f++],y=(o[h>>>24]<<24|o[l>>>16&255]<<16|o[c>>>8&255]<<8|o[255&u])^r[f++],e[t]=m,e[t+1]=_,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(m)}(),r.AES)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(){var e=r,t=e.lib,i=t.WordArray,s=t.BlockCipher,n=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=n.DES=s.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=a[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var s=this._subKeys=[],n=0;n<16;n++){var l=s[n]=[],c=d[n];for(r=0;r<24;r++)l[r/6|0]|=t[(o[r]-1+c)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(o[r+24]-1+c)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var u=this._invSubKeys=[];for(r=0;r<16;r++)u[r]=s[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var s=r[i],n=this._lBlock,a=this._rBlock,o=0,d=0;d<8;d++)o|=l[d][((a^s[d])&c[d])>>>0];this._lBlock=a,this._rBlock=n^o}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),s=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(i.create(t)),this._des2=u.createEncryptor(i.create(r)),this._des3=u.createEncryptor(i.create(s))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=s._createHelper(p)}(),r.TripleDES)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,s=i.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],s=0;s<256;s++)i[s]=s;s=0;for(var n=0;s<256;s++){var a=s%r,o=t[a>>>2]>>>24-a%4*8&255;n=(n+i[s]+o)%256;var d=i[s];i[s]=i[n],i[n]=d}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=n.call(this)},keySize:8,ivSize:0});function n(){for(var e=this._S,t=this._i,r=this._j,i=0,s=0;s<4;s++){r=(r+e[t=(t+1)%256])%256;var n=e[t];e[t]=e[r],e[r]=n,i|=e[(e[t]+e[r])%256]<<24-8*s}return this._i=t,this._j=r,i}e.RC4=t._createHelper(s);var a=i.RC4Drop=s.extend({cfg:s.cfg.extend({drop:192}),_doReset:function(){s._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)n.call(this)}});e.RC4Drop=t._createHelper(a)}(),r.RC4)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,s=[],n=[],a=[],o=i.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],s=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)d.call(this);for(r=0;r<8;r++)s[r]^=i[r+4&7];if(t){var n=t.words,a=n[0],o=n[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(s[0]^=l,s[1]^=u,s[2]^=c,s[3]^=h,s[4]^=l,s[5]^=u,s[6]^=c,s[7]^=h,r=0;r<4;r++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),s[0]=r[0]^r[5]>>>16^r[3]<<16,s[1]=r[2]^r[7]>>>16^r[5]<<16,s[2]=r[4]^r[1]>>>16^r[7]<<16,s[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)s[i]=16711935&(s[i]<<8|s[i]>>>24)|4278255360&(s[i]<<24|s[i]>>>8),e[t+i]^=s[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)n[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],s=65535&i,o=i>>>16,d=((s*s>>>17)+s*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=t._createHelper(o)}(),r.Rabbit)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,s=[],n=[],a=[],o=i.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var s=0;s<4;s++)d.call(this);for(s=0;s<8;s++)i[s]^=r[s+4&7];if(t){var n=t.words,a=n[0],o=n[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(i[0]^=l,i[1]^=u,i[2]^=c,i[3]^=h,i[4]^=l,i[5]^=u,i[6]^=c,i[7]^=h,s=0;s<4;s++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),s[0]=r[0]^r[5]>>>16^r[3]<<16,s[1]=r[2]^r[7]>>>16^r[5]<<16,s[2]=r[4]^r[1]>>>16^r[7]<<16,s[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)s[i]=16711935&(s[i]<<8|s[i]>>>24)|4278255360&(s[i]<<24|s[i]>>>8),e[t+i]^=s[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)n[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],s=65535&i,o=i>>>16,d=((s*s>>>17)+s*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=t._createHelper(o)}(),r.RabbitLegacy)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(){var e=r,t=e.lib.BlockCipher,i=e.algo;const s=16,n=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function d(e,t){let r=t>>24&255,i=t>>16&255,s=t>>8&255,n=255&t,a=e.sbox[0][r]+e.sbox[1][i];return a^=e.sbox[2][s],a+=e.sbox[3][n],a}function l(e,t,r){let i,n=t,a=r;for(let t=0;t1;--t)n^=e.pbox[t],a=d(e,n)^a,i=n,n=a,a=i;return i=n,n=a,a=i,a^=e.pbox[1],n^=e.pbox[0],{left:n,right:a}}function u(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=a[t][r]}let i=0;for(let a=0;a=r&&(i=0);let o=0,d=0,c=0;for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),r=new Uint8Array(r);const s=e.byteLength;let n=5;for(;ns)break;let o=e[n+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=e.slice(n+4+2,n+4+a);let s=new Fi.ModeOfOperation.ctr(t,new Fi.Counter(r));const o=s.decrypt(i);s=null,e.set(o,n+4+2)}n=n+4+a}return e}function zi(e,t,r){if(e.byteLength<=30)return e;const i=e.slice(32);let s=new Fi.ModeOfOperation.ctr(t,new Fi.Counter(r));const n=s.decrypt(i);return s=null,e.set(n,32),e}Ot((function(e,t){e.exports=Pi}));var Ni=Ot((function(e,t){var r,s,n,a=(r=new Date,s=4,n={setLogLevel:function(e){s=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=s&&console.debug("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=s&&console.info("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=s&&console.warn("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=s&&console.error("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}},n);a.getDurationString=function(e,t){var r;function i(e,t){for(var r=(""+e).split(".");r[0].length0){for(var r="",i=0;i0&&(r+=","),r+="["+a.getDurationString(e.start(i))+","+a.getDurationString(e.end(i))+"]";return r}return"(empty)"},t.Log=a;var o=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};o.prototype.getPosition=function(){return this.position},o.prototype.getEndPosition=function(){return this.buffer.byteLength},o.prototype.getLength=function(){return this.buffer.byteLength},o.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},o.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},o.prototype.readAnyInt=function(e,t){var r=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:r=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:r=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";r=this.dataview.getUint8(this.position)<<16,r|=this.dataview.getUint8(this.position+1)<<8,r|=this.dataview.getUint8(this.position+2);break;case 4:r=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";r=this.dataview.getUint32(this.position)<<32,r|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,r}throw"Not enough bytes in buffer"},o.prototype.readUint8=function(){return this.readAnyInt(1,!1)},o.prototype.readUint16=function(){return this.readAnyInt(2,!1)},o.prototype.readUint24=function(){return this.readAnyInt(3,!1)},o.prototype.readUint32=function(){return this.readAnyInt(4,!1)},o.prototype.readUint64=function(){return this.readAnyInt(8,!1)},o.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",r=0;rthis._byteLength&&(this._byteLength=t);else{for(r<1&&(r=1);t>r;)r*=2;var i=new ArrayBuffer(r),s=new Uint8Array(this._buffer);new Uint8Array(i,0,s.length).set(s),this.buffer=i,this._byteLength=t}}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),r=new Uint8Array(this._buffer,0,t.length);t.set(r),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Int32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Int16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Uint32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Uint16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var r=new Float64Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Float32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,r,i,s){var n=new Uint8Array(e,t,s),a=new Uint8Array(r,i,s);n.set(a)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=0;rs;i--,s++){var n=t[s];t[s]=t[i],t[i]=n}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],r=0;r>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},d.prototype.adjustUint32=function(e,t){var r=this.position;this.seek(e),this.writeUint32(t),this.seek(r)},d.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var r=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var r=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var r=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var r=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var r=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=8*e,r},d.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var r=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r};var c=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(c.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,a.debug("MultiBufferStream","Stream ready for parsing"),!0):(a.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(a.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){a.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r.buffer},c.prototype.reduceBuffer=function(e,t,r){var i;return(i=new Uint8Array(r)).set(new Uint8Array(e,t,r)),i.buffer.fileStart=e.fileStart+t,i.buffer.usedBytes=0,i.buffer},c.prototype.insertBuffer=function(e){for(var t=!0,r=0;ri.byteLength){this.buffers.splice(r,1),r--;continue}a.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=i.fileStart||(e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)),a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(r,0,e),0===r&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,s,n)}}t&&(a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===r&&(this.buffer=e))},c.prototype.logBufferLevel=function(e){var t,r,i,s,n,o=[],d="";for(i=0,s=0,t=0;t0&&(d+=n.end-1+"]");var l=e?a.info:a.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+i+"/"+s+" bytes), continuous ranges: "+d)},c.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},c.prototype.findPosition=function(e,t,r){var i,s=null,n=-1;for(i=!0===e?0:this.bufferIndex;i=t?(a.debug("MultiBufferStream","Found position in existing buffer #"+n),n):-1},c.prototype.findEndContiguousBuf=function(e){var t,r,i,s=void 0!==e?e:this.bufferIndex;if(r=this.buffers[s],this.buffers.length>s+1)for(t=s+1;t>3;return 31===i&&r.data.length>=2&&(i=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),i}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};t.MPEG4DescriptorParser=u;var h={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){h.FullBox.prototype=new h.Box,h.ContainerBox.prototype=new h.Box,h.SampleEntry.prototype=new h.Box,h.TrackGroupTypeBox.prototype=new h.FullBox,h.BASIC_BOXES.forEach((function(e){h.createBoxCtor(e)})),h.FULL_BOXES.forEach((function(e){h.createFullBoxCtor(e)})),h.CONTAINER_BOXES.forEach((function(e){h.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,r){this.type=e,this.size=t,this.uuid=r},FullBox:function(e,t,r){h.Box.call(this,e,t,r),this.flags=0,this.version=0},ContainerBox:function(e,t,r){h.Box.call(this,e,t,r),this.boxes=[]},SampleEntry:function(e,t,r,i){h.ContainerBox.call(this,e,t),this.hdr_size=r,this.start=i},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){h.FullBox.call(this,e,t)},createBoxCtor:function(e,t){h.boxCodes.push(e),h[e+"Box"]=function(t){h.Box.call(this,e,t)},h[e+"Box"].prototype=new h.Box,t&&(h[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){h[e+"Box"]=function(t){h.FullBox.call(this,e,t)},h[e+"Box"].prototype=new h.FullBox,h[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,r=0;rr?(a.error("BoxParser","Box of type '"+c+"' has a size "+l+" greater than its container size "+r),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):0!==l&&o+l>e.getEndPosition()?(e.seek(o),a.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):t?{code:h.OK,type:c,size:l,hdr_size:d,start:o}:(h[c+"Box"]?i=new h[c+"Box"](l):"uuid"!==c?(a.warn("BoxParser","Unknown box type: '"+c+"'"),(i=new h.Box(c,l)).has_unparsed_data=!0):h.UUIDBoxes[n]?i=new h.UUIDBoxes[n](l):(a.warn("BoxParser","Unknown uuid type: '"+n+"'"),(i=new h.Box(c,l)).uuid=n,i.has_unparsed_data=!0),i.hdr_size=d,i.start=o,i.write===h.Box.prototype.write&&"mdat"!==i.type&&(a.info("BoxParser","'"+u+"' box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),(s=e.getPosition()-(i.start+i.size))<0?(a.warn("BoxParser","Parsing of box '"+u+"' did not read the entire indicated box data size (missing "+-s+" bytes), seeking forward"),e.seek(i.start+i.size)):s>0&&(a.error("BoxParser","Parsing of box '"+u+"' read "+s+" more bytes than the indicated box data size, seeking backwards"),0!==i.size&&e.seek(i.start+i.size)),{code:h.OK,box:i,size:i.size})},h.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},h.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},h.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.ContainerBox.prototype.parse=function(e){for(var t,r;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},h.SAMPLE_ENTRY_TYPE_VISUAL="Visual",h.SAMPLE_ENTRY_TYPE_AUDIO="Audio",h.SAMPLE_ENTRY_TYPE_HINT="Hint",h.SAMPLE_ENTRY_TYPE_METADATA="Metadata",h.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",h.SAMPLE_ENTRY_TYPE_SYSTEM="System",h.SAMPLE_ENTRY_TYPE_TEXT="Text",h.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},h.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},h.SampleEntry.prototype.parseFooter=function(e){h.ContainerBox.prototype.parse.call(this,e)},h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_HINT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT,"enct"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA,"encm"),h.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var r=0;r<3;r++)this.layer_size[r]=16==t?e.readUint16():e.readUint32()})),h.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),h.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),h.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)a.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void a.error("av1C reserved_2 parsing problem");var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)}else a.error("av1C reserved_1 parsing problem");else a.error("av1C version "+this.version+" not supported")})),h.createBoxCtor("avcC",(function(e){var t,r;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),r=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(r))})),h.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),h.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),h.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),h.createFullBoxCtor("co64",(function(e){var t,r;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(r=0;r>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),h.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),h.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),h.createFullBoxCtor("ctts",(function(e){var t,r;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(r=0;r>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|r>>6&3,this.acmod=r>>3&7,this.lfeon=r>>2&1,this.bit_rate_code=3&r|i>>5&7})),h.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var r=0;r>6,i.bsid=s>>1&31,i.bsmod=(1&s)<<4|n>>4&15,i.acmod=n>>1&7,i.lfeon=1&n,i.num_dep_sub=a>>1&15,i.num_dep_sub>0&&(i.chan_loc=(1&a)<<8|e.readUint8())}})),h.createFullBoxCtor("dfLa",(function(e){var t=[],r=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var i=e.readUint8(),s=Math.min(127&i,r.length-1);if(s?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(r[s]),128&i)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),h.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[r]=e.readString(4),t-=4,r++})),h.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),h.createBoxCtor("hvcC",(function(e){var t,r,i,s;this.configurationVersion=e.readUint8(),s=e.readUint8(),this.general_profile_space=s>>6,this.general_tier_flag=(32&s)>>5,this.general_profile_idc=31&s,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),s=e.readUint8(),this.constantFrameRate=s>>6,this.numTemporalLayers=(13&s)>>3,this.temporalIdNested=(4&s)>>2,this.lengthSizeMinusOne=3&s,this.nalu_arrays=[];var n=e.readUint8();for(t=0;t>7,a.nalu_type=63&s;var o=e.readUint16();for(r=0;r>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var r=0;if(this.version<2)r=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";r=e.readUint32()}for(var i=0;i>7,this.axis=1&t})),h.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),a.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),h.createFullBoxCtor("ipma",(function(e){var t,r;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?a.property_index=(127&n)<<8|e.readUint8():a.property_index=127&n}}})),h.createFullBoxCtor("iref",(function(e){var t,r;for(this.references=[];e.getPosition()>7,i.assignment_type=127&s,i.assignment_type){case 0:i.grouping_type=e.readString(4);break;case 1:i.grouping_type=e.readString(4),i.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:i.sub_track_id=e.readUint32();break;default:a.warn("BoxParser","Unknown leva assignement type")}}})),h.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),h.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),f.prototype.toString=function(){return"("+this.x+","+this.y+")"},h.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new f(e.readUint16(),e.readUint16()),this.display_primaries[1]=new f(e.readUint16(),e.readUint16()),this.display_primaries[2]=new f(e.readUint16(),e.readUint16()),this.white_point=new f(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),h.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),h.createFullBoxCtor("mehd",(function(e){1&this.flags&&(a.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),h.createFullBoxCtor("meta",(function(e){this.boxes=[],h.ContainerBox.prototype.parse.call(this,e)})),h.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),h.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),h.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),h.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),h.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),h.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),h.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var r=0;r0){var t=e.readUint32();this.kid=[];for(var r=0;r0&&(this.data=e.readUint8Array(i))})),h.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),h.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),h.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var r=0;r>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var r=e.readUint8(),i=0;i>7,this.num_leading_samples=127&t})),h.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)a.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=h.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),h.createSampleGroupCtor("stsa",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),h.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),h.createSampleGroupCtor("tsas",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("tscl",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("vipr",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),r=0;r>6,this.sample_depends_on[i]=t>>4&3,this.sample_is_depended_on[i]=t>>2&3,this.sample_has_redundancy[i]=3&t})),h.createFullBoxCtor("senc"),h.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),a.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),r=0;r>31&1,i.referenced_size=2147483647&s,i.subsegment_duration=e.readUint32(),s=e.readUint32(),i.starts_with_SAP=s>>31&1,i.SAP_type=s>>28&7,i.SAP_delta_time=268435455&s}})),h.SingleItemTypeReferenceBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.SingleItemTypeReferenceBox.prototype=new h.Box,h.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var r=0;r>4&15,this.sample_sizes[t+1]=15&i}else if(8===this.field_size)for(t=0;t0)for(r=0;r>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=h.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),h.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),h.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),h.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var r=e.readUint32(),i=0;i>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),h.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),h.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),h.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},h.createTrackGroupCtor("msrc"),h.TrackReferenceTypeBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.TrackReferenceTypeBox.prototype=new h.Box,h.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},h.trefBox.prototype.parse=function(e){for(var t,r;e.getPosition()t&&this.flags&h.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var r=0;r>7&1,this.block_pad_lsb=r>>6&1,this.block_little_endian=r>>5&1,this.block_reversed=r>>4&1,this.pad_unknown=r>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),h.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),h.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),h.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),h.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=h.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),h.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),h.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=h.parseHex16(e)})),h.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),h.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),h.createFullBoxCtor("vvcC",(function(e){var t,r,i={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(i.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,r=this.num_sublayers-2;r>=0;--r){var a=i.extract_bits(1);this.ptl_sublayer_present_mask|=a<1;++r)i.extract_bits(1);for(this.sublayer_level_idc=[],r=this.num_sublayers-2;r>=0;--r)this.ptl_sublayer_present_mask&1<>=1;t+=h.decimalToHex(i,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var s=!1,n="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||s)&&(n="."+h.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+n,s=!0);t+=n}return t},h.vvc1SampleEntry.prototype.getCodec=h.vvi1SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var r="";if(this.vvcC.general_constraint_info){var i,s=[],n=0;for(n|=this.vvcC.ptl_frame_only_constraint<<7,n|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,s.push(n),n&&(i=e),n=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===i)r=".CA";else{r=".C";var a="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",o=0,d=0;for(e=0;e<=i;++e)for(o=o<<8|s[e],d+=8;d>=5;){r+=a[o>>d-5&31],o&=(1<<(d-=5))-1}d&&(r+=a[31&(o<<=5-d)])}}t+=r}return t},h.mp4aSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),r=this.esds.esd.getAudioConfig();return e+"."+h.decimalToHex(t)+(r?"."+r:"")}return e},h.stxtSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},h.vp08SampleEntry.prototype.getCodec=h.vp09SampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var r=this.vpcC.bitDepth;return 8==r&&(r="08"),e+".0"+this.vpcC.profile+"."+t+"."+r},h.av01SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this),r=this.av1C.seq_level_idx_0;return r<10&&(r="0"+r),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+r+(this.av1C.seq_tier_0?"H":"M")+"."+e},h.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),a.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>l?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>l&&e.writeUint64(this.size)},h.FullBox.prototype.writeHeader=function(e){this.size+=4,h.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},h.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},h.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},h.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},h.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},h.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},h.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&h.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&h.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&h.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&h.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[r]instanceof h.Box||t[r]instanceof h.Box||void 0===e[r]||void 0===t[r]||"function"==typeof e[r]||"function"==typeof t[r]||e.subBoxNames&&e.subBoxNames.indexOf(r.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(r.slice(0,4))>-1||"data"===r||"start"===r||"size"===r||"creation_time"===r||"modification_time"===r||h.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(r)>-1||e[r]===t[r]))return!1;return!0},h.boxEqual=function(e,t){if(!h.boxEqualFields(e,t))return!1;for(var r=0;r1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},g.prototype.setExtractionOptions=function(e,t,r){var i=this.getTrackById(e);if(i){var s={};this.extractedTracks.push(s),s.id=e,s.user=t,s.trak=i,i.nextSample=0,s.nb_samples=1e3,s.samples=[],r&&r.nbSamples&&(s.nb_samples=r.nbSamples)}},g.prototype.unsetExtractionOptions=function(e){for(var t=-1,r=0;r-1&&this.extractedTracks.splice(t,1)},g.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=h.parseOneBox(this.stream,false)).code===h.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var r;switch(r="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),r){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[r]&&a.warn("ISOFile","Duplicate Box of type: "+r+", overriding previous occurrence"),this[r]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},g.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(a.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(a.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(a.warn("ISOFile","Not ready to start parsing"),!1))},g.prototype.appendBuffer=function(e,t){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(a.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),r},g.prototype.getInfo=function(){var e,t,r,i,s,n,a={},o=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(a.hasMoov=!0,a.duration=this.moov.mvhd.duration,a.timescale=this.moov.mvhd.timescale,a.isFragmented=null!=this.moov.mvex,a.isFragmented&&this.moov.mvex.mehd&&(a.fragment_duration=this.moov.mvex.mehd.fragment_duration),a.isProgressive=this.isProgressive,a.hasIOD=null!=this.moov.iods,a.brands=[],a.brands.push(this.ftyp.major_brand),a.brands=a.brands.concat(this.ftyp.compatible_brands),a.created=new Date(o+1e3*this.moov.mvhd.creation_time),a.modified=new Date(o+1e3*this.moov.mvhd.modification_time),a.tracks=[],a.audioTracks=[],a.videoTracks=[],a.subtitleTracks=[],a.metadataTracks=[],a.hintTracks=[],a.otherTracks=[],e=0;e0?a.mime+='video/mp4; codecs="':a.audioTracks&&a.audioTracks.length>0?a.mime+='audio/mp4; codecs="':a.mime+='application/mp4; codecs="',e=0;e=r.samples.length)&&(a.info("ISOFile","Sending fragmented data on track #"+i.id+" for samples ["+Math.max(0,r.nextSample-i.nb_samples)+","+(r.nextSample-1)+"]"),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(i.id,i.user,i.segmentStream.buffer,r.nextSample,e||r.nextSample>=r.samples.length),i.segmentStream=null,i!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=r.samples.length)&&(a.debug("ISOFile","Sending samples on track #"+n.id+" for sample "+r.nextSample),this.onSamples&&this.onSamples(n.id,n.user,n.samples),n.samples=[],n!==this.extractedTracks[t]))break}}}},g.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},g.prototype.getBoxes=function(e,t){var r=[];return g._sweep.call(this,e,r,t),r},g._sweep=function(e,t,r){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&r)return;g._sweep.call(this.boxes[i],e,t,r)}},g.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},g.prototype.getTrackSample=function(e,t){var r=this.getTrackById(e);return this.getSample(r,t)},g.prototype.releaseUsedSamples=function(e,t,r){var i=0,s=this.getTrackById(e);s.lastValidSample||(s.lastValidSample=0);for(var n=s.lastValidSample;ne*s.timescale){l=i-1;break}t&&s.is_sync&&(d=i)}for(t&&(l=d),e=r.samples[l].cts,r.nextSample=l;r.samples[l].alreadyRead===r.samples[l].size&&r.samples[l+1];)l++;return n=r.samples[l].offset+r.samples[l].alreadyRead,a.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+a.getDurationString(e,o)+" and offset: "+n),{offset:n,time:e/o}},g.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},g.prototype.seek=function(e,t){var r,i,s,n=this.moov,o={offset:1/0,time:1/0};if(this.moov){for(s=0;sthis.getTrackDuration(r)||((i=this.seekTrack(e,t,r)).offset-1){a=d;break}switch(a){case"Visual":if(s.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),n.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var u=new h.avcCBox;u.parse(new o(t.avcDecoderConfigRecord)),n.addBox(u)}else if(t.hevcDecoderConfigRecord){var f=new h.hvcCBox;f.parse(new o(t.hevcDecoderConfigRecord)),n.addBox(f)}break;case"Audio":s.add("smhd").set("balance",t.balance||0),n.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":s.add("hmhd");break;case"Subtitle":if(s.add("sthd"),"stpp"===t.type)n.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:s.add("nmhd")}t.description&&n.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){n.addBox(e)})),s.add("dinf").add("dref").addEntry((new h["url Box"]).set("flags",1));var p=s.add("stbl");return p.add("stsd").addEntry(n),p.add("stts").set("sample_counts",[]).set("sample_deltas",[]),p.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),p.add("stco").set("chunk_offsets",[]),p.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(r),t.id}},h.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},g.prototype.addSample=function(e,t,r){var i=r||{},s={},n=this.getTrackById(e);if(null!==n){s.number=n.samples.length,s.track_id=n.tkhd.track_id,s.timescale=n.mdia.mdhd.timescale,s.description_index=i.sample_description_index?i.sample_description_index-1:0,s.description=n.mdia.minf.stbl.stsd.entries[s.description_index],s.data=t,s.size=t.byteLength,s.alreadyRead=s.size,s.duration=i.duration||1,s.cts=i.cts||0,s.dts=i.dts||0,s.is_sync=i.is_sync||!1,s.is_leading=i.is_leading||0,s.depends_on=i.depends_on||0,s.is_depended_on=i.is_depended_on||0,s.has_redundancy=i.has_redundancy||0,s.degradation_priority=i.degradation_priority||0,s.offset=0,s.subsamples=i.subsamples,n.samples.push(s),n.samples_size+=s.size,n.samples_duration+=s.duration,void 0===n.first_dts&&(n.first_dts=i.dts),this.processSamples();var a=this.createSingleSampleMoof(s);return this.addBox(a),a.computeSize(),a.trafs[0].truns[0].data_offset=a.size+8,this.add("mdat").data=new Uint8Array(t),s}},g.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var r=new h.moofBox;r.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var i=r.add("traf"),s=this.getTrackById(e.track_id);return i.add("tfhd").set("track_id",e.track_id).set("flags",h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),i.add("tfdt").set("baseMediaDecodeTime",e.dts-(s.first_dts||0)),i.add("trun").set("flags",h.TRUN_FLAGS_DATA_OFFSET|h.TRUN_FLAGS_DURATION|h.TRUN_FLAGS_SIZE|h.TRUN_FLAGS_FLAGS|h.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),r},g.prototype.lastMoofIndex=0,g.prototype.samplesDataSize=0,g.prototype.resetTables=function(){var e,t,r,i,s,n;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(d=s[a].grouping_type+"/0",(o=new l(s[a].grouping_type,0)).is_fragment=!0,t.sample_groups_info[d]||(t.sample_groups_info[d]=o))}else for(a=0;a=2&&(d=i[a].grouping_type+"/0",o=new l(i[a].grouping_type,0),e.sample_groups_info[d]||(e.sample_groups_info[d]=o))},g.setSampleGroupProperties=function(e,t,r,i){var s,n;for(s in t.sample_groups=[],i){var a;if(t.sample_groups[s]={},t.sample_groups[s].grouping_type=i[s].grouping_type,t.sample_groups[s].grouping_type_parameter=i[s].grouping_type_parameter,r>=i[s].last_sample_in_run&&(i[s].last_sample_in_run<0&&(i[s].last_sample_in_run=0),i[s].entry_index++,i[s].entry_index<=i[s].sbgp.entries.length-1&&(i[s].last_sample_in_run+=i[s].sbgp.entries[i[s].entry_index].sample_count)),i[s].entry_index<=i[s].sbgp.entries.length-1?t.sample_groups[s].group_description_index=i[s].sbgp.entries[i[s].entry_index].group_description_index:t.sample_groups[s].group_description_index=-1,0!==t.sample_groups[s].group_description_index)a=i[s].fragment_description?i[s].fragment_description:i[s].description,t.sample_groups[s].group_description_index>0?(n=t.sample_groups[s].group_description_index>65535?(t.sample_groups[s].group_description_index>>16)-1:t.sample_groups[s].group_description_index-1,a&&n>=0&&(t.sample_groups[s].description=a.entries[n])):a&&a.version>=2&&a.default_group_description_index>0&&(t.sample_groups[s].description=a.entries[a.default_group_description_index-1])}},g.process_sdtp=function(e,t,r){t&&(e?(t.is_leading=e.is_leading[r],t.depends_on=e.sample_depends_on[r],t.is_depended_on=e.sample_is_depended_on[r],t.has_redundancy=e.sample_has_redundancy[r]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},g.prototype.buildSampleLists=function(){var e,t;for(e=0;ev&&(b++,v<0&&(v=0),v+=n.sample_counts[b]),t>0?(e.samples[t-1].duration=n.sample_deltas[b],e.samples_duration+=e.samples[t-1].duration,U.dts=e.samples[t-1].dts+e.samples[t-1].duration):U.dts=0,a?(t>=w&&(S++,w<0&&(w=0),w+=a.sample_counts[S]),U.cts=e.samples[t].dts+a.sample_offsets[S]):U.cts=U.dts,o?(t==o.sample_numbers[E]-1?(U.is_sync=!0,E++):(U.is_sync=!1,U.degradation_priority=0),l&&l.entries[A].sample_delta+B==t+1&&(U.subsamples=l.entries[A].subsamples,B+=l.entries[A].sample_delta,A++)):U.is_sync=!0,g.process_sdtp(e.mdia.minf.stbl.sdtp,U,U.number),U.degradation_priority=h?h.priority[t]:0,l&&l.entries[A].sample_delta+B==t&&(U.subsamples=l.entries[A].subsamples,B+=l.entries[A].sample_delta),(c.length>0||u.length>0)&&g.setSampleGroupProperties(e,U,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},g.prototype.updateSampleLists=function(){var e,t,r,i,s,n,a,o,d,l,c,u,f,p,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&g.initSampleGroups(u,c,c.sbgps,u.mdia.minf.stbl.sgpds,c.sgpds),t=0;t0?p.dts=u.samples[u.samples.length-2].dts+u.samples[u.samples.length-2].duration:(c.tfdt?p.dts=c.tfdt.baseMediaDecodeTime:p.dts=0,u.first_traf_merged=!0),p.cts=p.dts,_.flags&h.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+_.sample_composition_time_offset[r]),m=a,_.flags&h.TRUN_FLAGS_FLAGS?m=_.sample_flags[r]:0===r&&_.flags&h.TRUN_FLAGS_FIRST_FLAG&&(m=_.first_sample_flags),p.is_sync=!(m>>16&1),p.is_leading=m>>26&3,p.depends_on=m>>24&3,p.is_depended_on=m>>22&3,p.has_redundancy=m>>20&3,p.degradation_priority=65535&m;var y=!!(c.tfhd.flags&h.TFHD_FLAG_BASE_DATA_OFFSET),v=!!(c.tfhd.flags&h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),b=!!(_.flags&h.TRUN_FLAGS_DATA_OFFSET),w=0;w=y?c.tfhd.base_data_offset:v||0===t?l.start:o,p.offset=0===t&&0===r?b?w+_.data_offset:w:o,o=p.offset+p.size,(c.sbgps.length>0||c.sgpds.length>0||u.mdia.minf.stbl.sbgps.length>0||u.mdia.minf.stbl.sgpds.length>0)&&g.setSampleGroupProperties(u,p,p.number_in_traf,c.sample_groups_info)}}if(c.subs){u.has_fragment_subsamples=!0;var S=c.first_sample_index;for(t=0;t-1))return null;var n=(r=this.stream.buffers[s]).byteLength-(i.offset+i.alreadyRead-r.fileStart);if(i.size-i.alreadyRead<=n)return a.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+(i.size-i.alreadyRead)+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,i.size-i.alreadyRead),r.usedBytes+=i.size-i.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead=i.size,i;if(0===n)return null;a.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+n+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,n),i.alreadyRead+=n,r.usedBytes+=n,this.stream.logBufferLevel()}},g.prototype.releaseSample=function(e,t){var r=e.samples[t];return r.data?(this.samplesDataSize-=r.size,r.data=null,r.description=null,delete r.degradation_priority,delete r.depends_on,delete r.description_index,delete r.has_redundancy,delete r.is_depended_on,delete r.is_leading,delete r.is_sync,delete r.moof_number,delete r.number_in_traf,delete r.timescale,delete r.cts,delete r.dts,delete r.offset,delete r.size,delete r.track_id,delete r.duration,r.alreadyRead=0,r.size):0},g.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},g.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},g.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(r.protection=n.ipro.protections[n.iinf.item_infos[e].protection_index-1]),n.iinf.item_infos[e].item_type?r.type=n.iinf.item_infos[e].item_type:r.type="mime",r.content_type=n.iinf.item_infos[e].content_type,r.content_encoding=n.iinf.item_infos[e].content_encoding;if(n.grpl)for(e=0;e0&&h.property_index-1-1))return null;var o=(t=this.stream.buffers[n]).byteLength-(s.offset+s.alreadyRead-t.fileStart);if(!(s.length-s.alreadyRead<=o))return a.debug("ISOFile","Getting item #"+e+" extent #"+i+" partial data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-t.fileStart)+" read size: "+o+" full extent size: "+s.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,s.offset+s.alreadyRead-t.fileStart,o),s.alreadyRead+=o,r.alreadyRead+=o,t.usedBytes+=o,this.stream.logBufferLevel(),null;a.debug("ISOFile","Getting item #"+e+" extent #"+i+" data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-t.fileStart)+" read size: "+(s.length-s.alreadyRead)+" full extent size: "+s.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,s.offset+s.alreadyRead-t.fileStart,s.length-s.alreadyRead),t.usedBytes+=s.length-s.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead+=s.length-s.alreadyRead,s.alreadyRead=s.length}}return r.alreadyRead===r.size?r:null},g.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var r=0;r0?this.moov.traks[e].samples[0].duration:0),t.push(i)}return t},g.prototype.getPerformanceInfo=function(){var e={};return e.moov=this.moov,this.moov&&this.moov.traks&&this.moov.traks.length>1&&(e.moovAudioNum=this.moov.traks[0].samples.length,e.moovVideoNum=this.moov.traks[1].samples.length),e},h.Box.prototype.printHeader=function(e){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},h.FullBox.prototype.printHeader=function(e){this.size+=4,h.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},h.Box.prototype.print=function(e){this.printHeader(e)},h.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},h.tkhdBox.prototype.print=function(e){h.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var y={createFile:function(e,t){var r=void 0===e||e,i=new g(t);return i.discardMdatData=!r,i}};t.createFile=y.createFile}));function Oi(e){return e.reduce(((e,t)=>256*e+t))}function Gi(e){const t=[101,103,119,99],r=e.length-28,i=e.slice(r,r+t.length);return t.every(((e,t)=>e===i[t]))}Ni.Log,Ni.MP4BoxStream,Ni.DataStream,Ni.MultiBufferStream,Ni.MPEG4DescriptorParser,Ni.BoxParser,Ni.XMLSubtitlein4Parser,Ni.Textin4Parser,Ni.ISOFile,Ni.createFile;class $i{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(r+32,r+32+t))]}return null}(t,this.t);if(!r)return e;const i=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(i instanceof Error)return console.error(i.message),this.d=!0,e;this.A=!0,this.u=r[1],Gi(t)&&this.c++,WebAssembly.instantiate(r[2],i).then((e=>{if("function"!=typeof(t=e.instance.exports).parse||"object"!=typeof t.memory)return this.d=!0,void console.error("video_error_3");var t;this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}function Hi(){for(var e=arguments.length,t=new Array(e),r=0;r{const r=new i((0|e.byteLength)+(0|t.byteLength));return r.set(e,0),r.set(t,0|e.byteLength),r}),new i)}const Vi=16,Wi=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],ji=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function qi(e){const t=[];for(let r=0,i=e.length;r1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Ki(e){const t=[];for(let r=0,i=e.length;r>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}function Xi(e){const t=[];for(let r=0,i=e.length;r=240&&e[r]<=247?(t.push(String.fromCodePoint(((7&e[r])<<18)+((63&e[r+1])<<12)+((63&e[r+2])<<6)+(63&e[r+3]))),r+=3):e[r]>=224&&e[r]<=239?(t.push(String.fromCodePoint(((15&e[r])<<12)+((63&e[r+1])<<6)+(63&e[r+2]))),r+=2):e[r]>=192&&e[r]<=223?(t.push(String.fromCodePoint(((31&e[r])<<6)+(63&e[r+1]))),r++):t.push(String.fromCodePoint(e[r]));return t.join("")}function Zi(e,t){const r=31&t;return e<>>32-r}function Ji(e){return(255&Wi[e>>>24&255])<<24|(255&Wi[e>>>16&255])<<16|(255&Wi[e>>>8&255])<<8|255&Wi[255&e]}function Qi(e){return e^Zi(e,2)^Zi(e,10)^Zi(e,18)^Zi(e,24)}function es(e){return e^Zi(e,13)^Zi(e,23)}function ts(e,t,r){const i=new Array(4),s=new Array(4);for(let t=0;t<4;t++)s[0]=255&e[4*t],s[1]=255&e[4*t+1],s[2]=255&e[4*t+2],s[3]=255&e[4*t+3],i[t]=s[0]<<24|s[1]<<16|s[2]<<8|s[3];for(let e,t=0;t<32;t+=4)e=i[1]^i[2]^i[3]^r[t+0],i[0]^=Qi(Ji(e)),e=i[2]^i[3]^i[0]^r[t+1],i[1]^=Qi(Ji(e)),e=i[3]^i[0]^i[1]^r[t+2],i[2]^=Qi(Ji(e)),e=i[0]^i[1]^i[2]^r[t+3],i[3]^=Qi(Ji(e));for(let e=0;e<16;e+=4)t[e]=i[3-e/4]>>>24&255,t[e+1]=i[3-e/4]>>>16&255,t[e+2]=i[3-e/4]>>>8&255,t[e+3]=255&i[3-e/4]}function rs(e,t,r){const i=new Array(4),s=new Array(4);for(let t=0;t<4;t++)s[0]=255&e[0+4*t],s[1]=255&e[1+4*t],s[2]=255&e[2+4*t],s[3]=255&e[3+4*t],i[t]=s[0]<<24|s[1]<<16|s[2]<<8|s[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let e,r=0;r<32;r+=4)e=i[1]^i[2]^i[3]^ji[r+0],t[r+0]=i[0]^=es(Ji(e)),e=i[2]^i[3]^i[0]^ji[r+1],t[r+1]=i[1]^=es(Ji(e)),e=i[3]^i[0]^i[1]^ji[r+2],t[r+2]=i[2]^=es(Ji(e)),e=i[0]^i[1]^i[2]^ji[r+3],t[r+3]=i[3]^=es(Ji(e));if(0===r)for(let e,r=0;r<16;r++)e=t[r],t[r]=t[31-r],t[31-r]=e}function is(e,t,r){let{padding:i="pkcs#7",mode:s,iv:n=[],output:a="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===s&&("string"==typeof n&&(n=qi(n)),16!==n.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=qi(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==r?Ki(e):qi(e):[...e],("pkcs#5"===i||"pkcs#7"===i)&&0!==r){const t=Vi-e.length%Vi;for(let r=0;r=Vi;){const t=e.slice(u,u+16),i=new Array(16);if("cbc"===s)for(let e=0;e2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=e.byteLength;let n=new Uint8Array(e.slice(0,5)),a=5;for(;as){const t=new Uint8Array(n.length+e.length-a);t.set(n,0),t.set(e.slice(a),n.length),n=t;break}let l=e[a+4],c=!1,u=2;if(r?(i&&(u=3),l=l>>>1&63,c=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(l)):(l&=31,c=1===l||5===l),c){const r=is(e.slice(a+4+u,a+4+d),t,0,{padding:"none",output:"array"});let i=r[r.length-1];if(i>0&&i<16){let e=!0;for(let t=1;t<=i;t++)if(r[r.length-t]!==i){e=!1;break}e&&r.splice(r.length-i,i)}const s=new Uint8Array(u);s.set(e.slice(a+4,a+4+u),0);const o=er(Hi(s,new Uint8Array(r))),l=new Uint8Array(n.length+o.length);l.set(n,0),l.set(o,n.length),n=l}else{const t=e.slice(a+4,a+4+d),r=new Uint8Array(n.length+4+t.length);r.set(n,0),r.set(o,n.length),r.set(t,n.length+4),n=r}a=a+4+d}return n}const as={init:0,findFirstStartCode:1,findSecondStartCode:2};class os extends class{on(e,t,r){const i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:r}),this}once(e,t,r){const i=this;function s(){i.off(e,s);for(var n=arguments.length,a=new Array(n),o=0;o1?r-1:0),s=1;s{delete r[e]})),void delete this.e;const i=r[e],s=[];if(i&&t)for(let e=0,r=i.length;e=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=as.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==as.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=as.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==as.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=as.findFirstStartCode}}}}function ds(e,t,r){for(let i=2;i3&&void 0!==arguments[3]&&arguments[3];const s=e.byteLength;let n=5;for(;ns)break;let o=e[n+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=ds(e.slice(n+4,n+4+a),t,r);e.set(i,n+4)}n=n+4+a}return e}function us(){for(var e=arguments.length,t=new Array(e),r=0;re+t.byteLength),0));let s=0;return t.forEach((e=>{i.set(e,s),s+=e.byteLength})),i}class hs{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,r,i)));e.addEventListener(t,r,i);const s=()=>{dr(e.removeEventListener)&&e.removeEventListener(t,r,i)};return this.destroys.push(s),s}destroy(){this.master.debugLog("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class fs{static init(){fs.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in fs.types)fs.types.hasOwnProperty(e)&&(fs.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=fs.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,r=null,i=Array.prototype.slice.call(arguments,1),s=i.length;for(let e=0;e>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r.set(e,4);let n=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return fs.box(fs.types.trak,fs.tkhd(e),fs.mdia(e))}static tkhd(e){let t=e.id,r=e.duration,i=e.presentWidth,s=e.presentHeight;return fs.box(fs.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>>8&255,255&i,0,0,s>>>8&255,255&s,0,0]))}static mdia(e){return fs.box(fs.types.mdia,fs.mdhd(e),fs.hdlr(e),fs.minf(e))}static mdhd(e){let t=e.timescale,r=e.duration;return fs.box(fs.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?fs.constants.HDLR_AUDIO:fs.constants.HDLR_VIDEO,fs.box(fs.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?fs.box(fs.types.smhd,fs.constants.SMHD):fs.box(fs.types.vmhd,fs.constants.VMHD),fs.box(fs.types.minf,t,fs.dinf(),fs.stbl(e))}static dinf(){return fs.box(fs.types.dinf,fs.box(fs.types.dref,fs.constants.DREF))}static stbl(e){return fs.box(fs.types.stbl,fs.stsd(e),fs.box(fs.types.stts,fs.constants.STTS),fs.box(fs.types.stsc,fs.constants.STSC),fs.box(fs.types.stsz,fs.constants.STSZ),fs.box(fs.types.stco,fs.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?fs.box(fs.types.stsd,fs.constants.STSD_PREFIX,fs.mp3(e)):fs.box(fs.types.stsd,fs.constants.STSD_PREFIX,fs.mp4a(e)):"avc"===e.videoType?fs.box(fs.types.stsd,fs.constants.STSD_PREFIX,fs.avc1(e)):fs.box(fs.types.stsd,fs.constants.STSD_PREFIX,fs.hvc1(e))}static mp3(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return fs.box(fs.types[".mp3"],i)}static mp4a(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return fs.box(fs.types.mp4a,i,fs.esds(e))}static esds(e){let t=e.config||[],r=t.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(t).concat([6,1,2]));return fs.box(fs.types.esds,i)}static avc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return fs.box(fs.types.avc1,s,fs.box(fs.types.avcC,t))}static hvc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return fs.box(fs.types.hvc1,s,fs.box(fs.types.hvcC,t))}static mvex(e){return fs.box(fs.types.mvex,fs.trex(e))}static trex(e){let t=e.id,r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return fs.box(fs.types.trex,r)}static moof(e,t){return fs.box(fs.types.moof,fs.mfhd(e.sequenceNumber),fs.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return fs.box(fs.types.mfhd,t)}static traf(e,t){let r=e.id,i=fs.box(fs.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),s=fs.box(fs.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),n=fs.sdtp(e),a=fs.trun(e,n.byteLength+16+16+8+16+8+8);return fs.box(fs.types.traf,i,s,a,n)}static sdtp(e){let t=new Uint8Array(5),r=e.flags;return t[4]=r.isLeading<<6|r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy,fs.box(fs.types.sdtp,t)}static trun(e,t){let r=new Uint8Array(28);t+=36,r.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let i=e.duration,s=e.size,n=e.flags,a=e.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,s>>>24&255,s>>>16&255,s>>>8&255,255&s,n.isLeading<<2|n.dependsOn,n.isDependedOn<<6|n.hasRedundancy<<4|n.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12),fs.box(fs.types.trun,r)}static mdat(e){return fs.box(fs.types.mdat,e)}}fs.init();var ps,ms=Ot((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}));(ps=ms)&&ps.__esModule&&Object.prototype.hasOwnProperty.call(ps,"default")&&ps.default;const _s=[44100,48e3,32e3,0],gs=[22050,24e3,16e3,0],ys=[11025,12e3,8e3,0],vs=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],bs=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],ws=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];function Ss(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),r=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let i=t[1]>>>3&3,s=(6&t[1])>>1,n=(240&t[2])>>>4,a=(12&t[2])>>>2,o=3!==(t[3]>>>6&3)?2:1,d=0,l=0;switch(i){case 0:d=ys[a];break;case 2:d=gs[a];break;case 3:d=_s[a]}switch(s){case 1:n=e[s]&&t=6?(i=5,t=new Array(4),a=s-3):(i=2,t=new Array(2),a=s):-1!==o.indexOf("android")?(i=2,t=new Array(2),a=s):(i=5,a=s,t=new Array(4),s>=6?a=s-3:1===n&&(i=2,t=new Array(2),a=s)),t[0]=i<<3,t[0]|=(15&s)>>>1,t[1]=(15&s)<<7,t[1]|=(15&n)<<3,5===i&&(t[1]|=(15&a)>>>1,t[2]=(1&a)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=Rs[s],this.sampling_index=s,this.channel_count=n,this.object_type=i,this.original_object_type=r,this.codec_mimetype="mp4a.40."+i,this.original_codec_mimetype="mp4a.40."+r}}class Os{constructor(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}get bitsAvailable(){return this.bitLength-this.index}skipBits(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}getBits(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>i,n=8-i;if(n>=e)return r&&(this.index+=e),s>>n-e;{r&&(this.index+=n);const i=e-n;return s<>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}function Gs(e){return e[3]|e[2]<<8|e[1]<<16|e[0]<<24}const $s=new Array(214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72),Hs=new Array(2746333894,1453994832,1736282519,2993693404),Vs=new Array(462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257);function Ws(e,t,r,i,s){var n=s;n=t+s>e.length&&i+s<=r.length?e.length-t:i+s>r.length&&t+s<=e.length?r.length-i:t+s<=e.length&&i+s<=r.length?s:r.length>24&255,e>>16&255,e>>8&255,255&e)}function qs(e,t){return t+3>>19)^(i<<23|i>>>9)}function Xs(e,t){var r=new Array(36);r[0]=qs(t,0),r[1]=qs(t,4),r[2]=qs(t,8),r[3]=qs(t,12);for(var i=0;i<32;i++)r[i+4]=r[i]^Zs(r[i+1]^r[i+2]^r[i+3]^e[i]);var s=new Array(4);for(i=35;i>=32;i--)s[35-i]=r[i];var n=function(e){for(var t=new Array(4*e.length),r=0;r>>30)^(i<<10|i>>>22)^(i<<18|i>>>14)^(i<<24|i>>>8)}function Js(e,t,r){if(null==e||null==e||e.length%16!=0)return console.log("sm4 key is error!"),null;if(null==r||null==r||r.length<=0)return console.log("cipher is error!"),null;if(null==t||null==t||t.length%16!=0)return console.log("iv is error!"),null;for(var i=Ys(e),s=Math.ceil(r.length/16),n=new Array(r.length),a=t.slice(),o=0;o3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t=new Uint8Array(t),r=new Uint8Array(r);const n=e.byteLength;let a=5;for(;an)break;let d=e[a+4],l=!1,c=2;if(i?(s&&(c=3),d=d>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(d)):(d&=31,l=1===d||5===d),l){const i=Js(t,r,e.slice(a+4+c,a+4+o));e.set(i,a+4+c)}a=a+4+o}return e}Date.now||(Date.now=function(){return(new Date).getTime()}),n({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support")&&-1===e.indexOf("illegal icc")&&!e.indexOf("If you want to help, upload a sample of this file to")&&!e.indexOf("Reserved SBR extensions is not implemented"))})(e)||console.warn("JbPro[❌❌❌][worker]:",e)}}).then((e=>{!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[],s=[],n=null,a=null,o=null,d=null,l=null,c=null,u=!1,h=null,w=null,S=!1,U=!1,we=!!_r(r),Se=0,We=0,Ze=!1,Je=null,et=null,rt=null,ct=[],Et=null,At=null,xt=0,Nt=0,Ot=null,Gt=null,$t=0,Ht=0,Yt=!1,Jt=!1,sr=!1,br=null,wr=null,Sr=!1,Er=!0,xr=()=>{const e=pr();return{debug:e.debug,debugLevel:e.debugLevel,debugUuid:e.debugUuid,useOffscreen:e.useOffscreen,useWCS:e.useWCS,useMSE:e.useMSE,videoBuffer:e.videoBuffer,videoBufferDelay:e.videoBufferDelay,openWebglAlignment:e.openWebglAlignment,playType:e.playType,hasAudio:e.hasAudio,hasVideo:e.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:e.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:e.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:0,networkDelay:e.networkDelay,visibility:!0,useSIMD:e.useSIMD,isRecording:!1,recordType:e.recordType,isNakedFlow:e.isNakedFlow,checkFirstIFrame:e.checkFirstIFrame,audioBufferSize:1024,isM7sCrypto:e.isM7sCrypto,m7sCryptoAudio:e.m7sCryptoAudio,cryptoKey:e.cryptoKey,cryptoIV:e.cryptoIV,isSm4Crypto:e.isSm4Crypto,isSm4CryptoH265V2:e.isSm4CryptoH265V2,sm4CryptoKey:e.sm4CryptoKey,isXorCrypto:e.isXorCrypto,isHls265:!1,isFlv:e.isFlv,isFmp4:e.isFmp4,isMpeg4:e.isMpeg4,isTs:e.isTs,isFmp4Private:e.isFmp4Private,isEmitSEI:e.isEmitSEI,isRecordTypeFlv:!1,isWasmMp4:!1,isChrome:!1,isFirefox:!1,isDropSameTimestampGop:e.isDropSameTimestampGop,mseDecodeAudio:e.mseDecodeAudio,wcsDecodeAudio:e.wcsDecodeAudio,nakedFlowH265DemuxUseNew:e.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:e.mseDecoderUseWorker,mseAutoCleanupSourceBuffer:e.mseAutoCleanupSourceBuffer,mseAutoCleanupMaxBackwardDuration:e.mseAutoCleanupMaxBackwardDuration,mseAutoCleanupMinBackwardDuration:e.mseAutoCleanupMinBackwardDuration,mseCorrectTimeDuration:e.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:e.mseCorrectAudioTimeDuration,nakedFlowDemuxUseNew:e.nakedFlowDemuxUseNew,nakedFlowFps:e.nakedFlowFps,supportMSEDecodeHevc:!1}};"VideoEncoder"in self&&(n={hasInit:!1,isEmitInfo:!1,offscreenCanvas:null,offscreenCanvasCtx:null,decoder:null,init(){n.decoder=new VideoDecoder({output:function(e){if(dr(e.createImageBitmap))e.createImageBitmap().then((t=>{n.offscreenCanvasCtx.drawImage(t,0,0,e.codedWidth,e.codedHeight);let r=n.offscreenCanvas.transferToImageBitmap();postMessage({cmd:T,buffer:r,delay:ni.delay,ts:0},[r]),ur(e)}));else{n.offscreenCanvasCtx.drawImage(e,0,0,e.codedWidth,e.codedHeight);let t=n.offscreenCanvas.transferToImageBitmap();postMessage({cmd:T,buffer:t,delay:ni.delay,ts:0},[t]),ur(e)}},error:function(e){ni.debugError("worker","VideoDecoder error: ",e,e.toString())}})},destroy(){n.reset(),n.decoder&&"closed"!==n.decoder.state&&(n.decoder.close(),n.decoder=null)},decode:function(e,t,r){const i=e[0]>>4==1;if(n.hasInit){const r=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:i?ft:pt});n.decoder.decode(r)}else if(i&&0===e[1]){const t=15&e[0];postMessage({cmd:P,code:t});const r=new Uint8Array(e);postMessage({cmd:M,buffer:r,codecId:t},[r.buffer]);let i=null,s=null;const a=e.slice(5);t===Fe?(s=kr(a),i={codec:s.codec,description:a}):t===Pe&&(s=Vr(a),i={codec:s.codec,description:a}),s&&s.codecWidth&&s.codecHeight&&(i.codedHeight=s.codecHeight,i.codedWidth=s.codecWidth),n.isEmitInfo||(ni.debugLog("worker","Webcodecs Video Decoder initSize"),postMessage({cmd:k,w:s.codecWidth,h:s.codecHeight}),n.isEmitInfo=!0,n.offscreenCanvas=new OffscreenCanvas(s.codecWidth,s.codecHeight),n.offscreenCanvasCtx=n.offscreenCanvas.getContext("2d"));try{n.decoder.configure(i),n.hasInit=!0}catch(e){ni.debugError("worker","VideoDecoder configure error",e.code,e,e.toString()),e.toString()}}else ni.debugWarn("worker",`VideoDecoder configure has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)},reset(){n.hasInit=!1,n.isEmitInfo=!1,n.offscreenCanvas=null,n.offscreenCanvasCtx=null}});let Or=function(){if(Sr=!0,a)try{a.abort(),a=null,ni.debugLog("worker","abort success")}catch(e){a=null,ni.debugLog("worker","abort catch",e)}},Gr={init(){Gr.lastBuf=null,Gr.vps=null,Gr.sps=null,Gr.pps=null,Gr.streamType=null,Gr.localDts=0,Gr.pendingUnits={},Gr.isSendSeqHeader=!1},destroy(){Gr.lastBuf=null,Gr.vps=null,Gr.sps=null,Gr.pps=null,Gr.streamType=null,Gr.localDts=0,Gr.pendingUnits={},Gr.isSendSeqHeader=!1},dispatch(e){const t=new Uint8Array(e);if(ni._opt.nakedFlowDemuxUseNew){const e=Gr.extractNALu$3(t);if(0===e.length)return void ni.debugLog("worker","dispatch naluArray length is 0");Gr.handleVideoFrames(e)}else Gr.extractNALu$2(t)},getNaluDts(){const e=ni._opt.nakedFlowFps;let t=Gr.localDts;return Gr.localDts=Gr.localDts+parseInt(1e3/e,10),t},getNaluAudioDts(){const e=ni._opt.sampleRate,t=ni._opt.audioBufferSize;return Gr.localDts+parseInt(t/e*1e3)},extractNALu(e){let t,r,i=0,s=e.byteLength,n=0,a=[];for(;i1)for(let e=0;e{const t=Ir(e);t===Ve||t===He?Gr.handleVideoH264Nalu(e):Pr(t)&&i.push(e)})),1===i.length)Gr.handleVideoH264Nalu(i[0]);else if(Rr(i)){const e=Ir(i[0]),t=Mr(e);Gr.handleVideoH264NaluList(i,t,e)}else i.forEach((e=>{Gr.handleVideoH264Nalu(e)}))}else if(Gr.streamType===ze)if(ni._opt.nakedFlowH265DemuxUseNew){const t=Gr.handleAddNaluStartCode(e),r=Gr.extractNALu(t);if(0===r.length)return void ni.debugWarn("worker","handleVideoNalu","h265 naluList.length === 0");const i=[];if(r.forEach((e=>{const t=Kr(e);t===dt||t===at||t===st?Gr.handleVideoH265Nalu(e):Zr(t)&&i.push(e)})),1===i.length)Gr.handleVideoH265Nalu(i[0]);else if(Qr(i)){const e=Kr(i[0]),t=Jr(e);Gr.handleVideoH265NaluList(i,t,e)}else i.forEach((e=>{Gr.handleVideoH265Nalu(e)}))}else Kr(e)===dt?Gr.extractH265PPS(e):Gr.handleVideoH265Nalu(e)},extractH264PPS(e){const t=Gr.handleAddNaluStartCode(e);Gr.extractNALu(t).forEach((e=>{Fr(Ir(e))?Gr.extractH264SEI(e):Gr.handleVideoH264Nalu(e)}))},extractH265PPS(e){const t=Gr.handleAddNaluStartCode(e);Gr.extractNALu(t).forEach((e=>{Xr(Kr(e))?Gr.extractH265SEI(e):Gr.handleVideoH265Nalu(e)}))},extractH264SEI(e){const t=Gr.handleAddNaluStartCode(e);Gr.extractNALu(t).forEach((e=>{Gr.handleVideoH264Nalu(e)}))},extractH265SEI(e){const t=Gr.handleAddNaluStartCode(e);Gr.extractNALu(t).forEach((e=>{Gr.handleVideoH265Nalu(e)}))},handleAddNaluStartCode(e){const t=[0,0,0,1],r=new Uint8Array(e.length+t.length);return r.set(t),r.set(e,t.length),r},handleVideoH264Nalu(e){const t=Ir(e);switch(t){case He:Gr.sps=e;break;case Ve:Gr.pps=e}if(Gr.isSendSeqHeader){if(Gr.sps&&Gr.pps){const e=Tr({sps:Gr.sps,pps:Gr.pps}),t=Gr.localDts;ni.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null}if(Pr(t)){const r=Mr(t),i=Gr.getNaluDts(),s=Dr(e,r);Gr.doDecode(s,{type:ae,ts:i,isIFrame:r,cts:0})}}else if(Gr.sps&&Gr.pps){Gr.isSendSeqHeader=!0;const e=Tr({sps:Gr.sps,pps:Gr.pps});ni.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null}},handleVideoH264NaluList(e,t,r){if(Gr.isSendSeqHeader){const i=Gr.getNaluDts(),s=Lr(e.reduce(((e,t)=>{const r=er(e),i=er(t),s=new Uint8Array(r.byteLength+i.byteLength);return s.set(r,0),s.set(i,r.byteLength),s})),t);Gr.doDecode(s,{type:ae,ts:i,isIFrame:t,cts:0}),ni.debugLog("worker",`handleVideoH264NaluList list size is ${e.length} package length is ${s.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},handleVideoH265Nalu(e){const t=Kr(e);switch(t){case st:Gr.vps=e;break;case at:Gr.sps=e;break;case dt:Gr.pps=e}if(Gr.isSendSeqHeader){if(Gr.vps&&Gr.sps&&Gr.pps){const e=jr({vps:Gr.vps,sps:Gr.sps,pps:Gr.pps}),t=Gr.localDts;ni.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Gr.vps=null,Gr.sps=null,Gr.pps=null}if(Zr(t)){const r=Jr(t),i=Gr.getNaluDts(),s=qr(e,r);Gr.doDecode(s,{type:ae,ts:i,isIFrame:r,cts:0})}}else if(Gr.vps&&Gr.sps&&Gr.pps){Gr.isSendSeqHeader=!0;const e=jr({vps:Gr.vps,sps:Gr.sps,pps:Gr.pps});ni.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Gr.vps=null,Gr.sps=null,Gr.pps=null}},handleVideoH265NaluList(e,t,r){if(Gr.isSendSeqHeader){const i=Gr.getNaluDts(),s=Yr(e.reduce(((e,t)=>{const r=er(e),i=er(t),s=new Uint8Array(r.byteLength+i.byteLength);return s.set(r,0),s.set(i,r.byteLength),s})),t);Gr.doDecode(s,{type:ae,ts:i,isIFrame:t,cts:0}),ni.debugLog("worker",`handleVideoH265NaluList list size is ${e.length} package length is ${s.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},doDecode(e,t){ni.calcNetworkDelay(t.ts),t.isIFrame&&ni.calcIframeIntervalTimestamp(t.ts),ni.decode(e,t)},handleVideoFrames(e){if(!Gr.streamVideoType)for(let t of e)if(Gr.streamVideoType=lr(t),Gr.streamVideoType)break;Gr.streamVideoType?Gr.streamVideoType===Re?Gr.handleVideoH264Frames(e):this.streamVideoType===ze&&Gr.handleVideoH265Frames(e):ni.debugWarn("worker","handleVideoFrames","streamVideoType is null")},handleVideoH264Frames(e){let t=[],r=[],i=!1,s=!1;Gr.pendingUnits.units&&(t=Gr.pendingUnits.units,s=Gr.pendingUnits.vcl,i=Gr.pendingUnits.iFrame,Gr.pendingUnits={});let n={};for(let a of e){if(a.byteLength<4)continue;const e=Ir(a);let o=!1,d=e===qe;e!==je&&e!==qe||(n=Gr.parseVideo264Header(a),o=!0),t.length&&s&&(n.isfms||!o)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,s=!1),t.push(a),i=i||d,s=s||o}t.length&&(Gr.pendingUnits={units:t,vcl:s,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,s=null;if(t.forEach((e=>{const t=31&e[0];switch(t){case Ve:Gr.pps=e;break;case He:Gr.sps=e;break;case Ye:s=e}if(Pr(t)){const t=er(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Gr.isSendSeqHeader&&Gr.sps&&Gr.pps){Gr.isSendSeqHeader=!0;const e=Cr({sps:Gr.sps,pps:Gr.pps});ni.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null}if(Gr.isSendSeqHeader){if(Gr.sps&&Gr.pps){const e=Cr({sps:Gr.sps,pps:Gr.pps}),t=Gr.localDts;ni.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null}if(i){const e=Gr.getNaluDts(),t=Lr(i,r);ni._opt.isEmitSEI&&s&&postMessage({cmd:X,buffer:s,ts:e},[s.buffer]),Gr.doDecode(t,{type:ae,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames(e){let t=[],r=[],i=!1,s=!1;Gr.pendingUnits.units&&(t=Gr.pendingUnits.units,s=Gr.pendingUnits.vcl,i=Gr.pendingUnits.iFrame,Gr.pendingUnits={});let n={};for(let a of e){if(a.byteLength<4)continue;const e=Kr(a);let o=!1,d=Jr(e);Zr(e)&&(n=this.parseVideo265Header(a),o=!0),t.length&&s&&(n.isfms||!o)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,s=!1),t.push(a),i=i||d,s=s||o}t.length&&(Gr.pendingUnits={units:t,vcl:s,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,s=null;if(t.forEach((e=>{const t=e[0]>>>1&63;switch(t){case dt:Gr.pps=e;break;case at:Gr.sps=e;break;case st:Gr.vps=e;break;case ht:case ut:s=e}if(Zr(t)){const t=er(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Gr.isSendSeqHeader&&Gr.sps&&Gr.pps&&Gr.vps){Gr.isSendSeqHeader=!0;const e=jr({sps:Gr.sps,pps:Gr.pps,vps:Gr.vps});ni.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null,Gr.vps=null}if(Gr.isSendSeqHeader){if(Gr.sps&&Gr.pps&&Gr.vps){const e=jr({sps:Gr.sps,pps:Gr.pps,vps:Gr.vps}),t=Gr.localDts;ni.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null,Gr.vps=null}if(i){const e=Gr.getNaluDts(),t=Yr(i,r);ni._opt.isEmitSEI&&s&&postMessage({cmd:X,buffer:s,ts:e},[s.buffer]),Gr.doDecode(t,{type:ae,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames_1(e){e.forEach((e=>{Gr.handleVideoNalu(e)}))},parseVideo264Header(e){const t=new Os(e);return t.readUByte(),{isfms:0===t.readUEG(),sType:t.readUEG()}},parseVideo265Header(e){const t=new Os(e);return t.readUByte(),{nalType:t.readBits(6),isfms:0===t.readBits(1),sType:t.readBits(3)}}},Wr={LOG_NAME:"worker fmp4Demuxer",mp4Box:null,offset:0,videoTrackId:null,audioTrackId:null,isHevc:!1,listenMp4Box(){Wr.mp4Box=Ni.createFile(),Wr.mp4Box.onReady=Wr.onReady,Wr.mp4Box.onError=Wr.onError,Wr.mp4Box.onSamples=Wr.onSamples},initTransportDescarmber(){Wr.transportDescarmber=new $i},_getSeqHeader(e){const t=Wr.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new Ni.DataStream(void 0,0,Ni.DataStream.BIG_ENDIAN);let r=[];e.avcC?(e.avcC.write(t),r=[23,0,0,0,0]):(Wr.isHevc=!0,ni.isHevc=!0,e.hvcC.write(t),r=[28,0,0,0,0]);const i=new Uint8Array(t.buffer,8),s=new Uint8Array(r.length+i.length);return s.set(r,0),s.set(i,r.length),s}return null},onReady(e){ni.debugLog(Wr.LOG_NAME,"onReady()");const t=e.videoTracks[0],r=e.audioTracks[0];if(t){Wr.videoTrackId=t.id;const e=Wr._getSeqHeader(t);e&&(ni.debugLog(Wr.LOG_NAME,"seqHeader"),ni.decodeVideo(e,0,!0,0)),Wr.mp4Box.setExtractionOptions(t.id)}if(r&&ni._opt.hasAudio){Wr.audioTrackId=r.id;const e=r.audio||{},t=Vt.indexOf(e.sample_rate),i=r.codec.replace("mp4a.40.","");Wr.mp4Box.setExtractionOptions(r.id);const s=Wt({profile:parseInt(i,10),sampleRate:t,channel:e.channel_count});ni.debugLog(Wr.LOG_NAME,"aacADTSHeader"),ni.decodeAudio(s,0)}Wr.mp4Box.start()},onError(e){ni.debugError(Wr.LOG_NAME,"mp4Box onError",e)},onSamples(e,t,r){if(e===Wr.videoTrackId){for(const e of r){const t=e.data,r=e.is_sync,i=1e3*e.cts/e.timescale;e.duration,e.timescale,r&&ni.calcIframeIntervalTimestamp(i);let s=null;s=Wr.isHevc?Yr(t,r):Lr(t,r),ni.decode(s,{type:ae,ts:i,isIFrame:r,cts:0})}Wr.mp4Box.removeUsedSamples(e)}else if(e===Wr.audioTrackId){if(ni._opt.hasAudio){for(const e of r){const t=e.data,r=1e3*e.cts/e.timescale;e.duration,e.timescale;const i=new Uint8Array(t.byteLength+2);i.set([175,1],0),i.set(t,2),ni.decode(i,{type:ne,ts:r,isIFrame:!1,cts:0})}Wr.mp4Box.removeUsedSamples(e)}}else ni.debugWarn(Wr.LOG_NAME,"onSamples() trackId error",e)},dispatch(e){let t=new Uint8Array(e);Wr.transportDescarmber&&(t=Wr.transportDescarmber.transport(t)),t.buffer.fileStart=Wr.offset,Wr.offset+=t.byteLength,Wr.mp4Box.appendBuffer(t.buffer)},destroy(){Wr.mp4Box&&(Wr.mp4Box.stop(),Wr.mp4Box.flush(),Wr.mp4Box.destroy(),Wr.mp4Box=null),Wr.transportDescarmber&&(Wr.transportDescarmber.destroy(),Wr.transportDescarmber=null),Wr.offset=0,Wr.videoTrackId=null,Wr.audioTrackId=null,Wr.isHevc=!1}},ri={LOG_NAME:"worker mpeg4Demuxer",lastBuffer:new Uint8Array(0),parsedOffset:0,firstStartCodeOffset:0,secondStartCodeOffset:0,state:"init",hasInitVideoCodec:!1,localDts:0,dispatch(e){const t=new Uint8Array(e);ri.extractNALu(t)},destroy(){ri.lastBuffer=new Uint8Array(0),ri.parsedOffset=0,ri.firstStartCodeOffset=0,ri.secondStartCodeOffset=0,ri.state="init",ri.hasInitVideoCodec=!1,ri.localDts=0},extractNALu(e){if(!e||e.byteLength<1)return void ni.debugWarn(ri.LOG_NAME,"extractNALu() buffer error",e);const t=new Uint8Array(ri.lastBuffer.length+e.length);for(t.set(ri.lastBuffer,0),t.set(new Uint8Array(e),ri.lastBuffer.length),ri.lastBuffer=t;;){if("init"===ri.state){let e=!1;for(;ri.lastBuffer.length-ri.parsedOffset>=4;)if(0===ri.lastBuffer[ri.parsedOffset])if(0===ri.lastBuffer[ri.parsedOffset+1])if(1===ri.lastBuffer[ri.parsedOffset+2]){if(182===ri.lastBuffer[ri.parsedOffset+3]){ri.state="findFirstStartCode",ri.firstStartCodeOffset=ri.parsedOffset,ri.parsedOffset+=4,e=!0;break}ri.parsedOffset++}else ri.parsedOffset++;else ri.parsedOffset++;else ri.parsedOffset++;if(e)continue;break}if("findFirstStartCode"===ri.state){let e=!1;for(;ri.lastBuffer.length-ri.parsedOffset>=4;)if(0===ri.lastBuffer[ri.parsedOffset])if(0===ri.lastBuffer[ri.parsedOffset+1])if(1===ri.lastBuffer[ri.parsedOffset+2]){if(182===ri.lastBuffer[ri.parsedOffset+3]){ri.state="findSecondStartCode",ri.secondStartCodeOffset=ri.parsedOffset,ri.parsedOffset+=4,e=!0;break}ri.parsedOffset++}else ri.parsedOffset++;else ri.parsedOffset++;else ri.parsedOffset++;if(e)continue;break}if("findSecondStartCode"===ri.state){if(!(ri.lastBuffer.length-ri.parsedOffset>0))break;{let e,t,r=192&ri.lastBuffer[ri.parsedOffset];e=0==r?ri.secondStartCodeOffset-14:ri.secondStartCodeOffset;let i=0==(192&ri.lastBuffer[ri.firstStartCodeOffset+4]);if(i){if(ri.firstStartCodeOffset-14<0)return void ni.debugWarn(ri.LOG_NAME,"firstStartCodeOffset -14 is",ri.firstStartCodeOffset-14);ri.hasInitVideoCodec||(ri.hasInitVideoCodec=!0,ni.debugLog(ri.LOG_NAME,"setCodec"),oi.setCodec(Me,"")),t=ri.lastBuffer.subarray(ri.firstStartCodeOffset-14,e)}else t=ri.lastBuffer.subarray(ri.firstStartCodeOffset,e);let s=ri.getNaluDts();ri.hasInitVideoCodec?(postMessage({cmd:O,type:Ue,value:t.byteLength}),postMessage({cmd:O,type:xe,value:s}),Se=s,oi.decode(t,i?1:0,s)):ni.debugWarn(ri.LOG_NAME,"has not init video codec"),ri.lastBuffer=ri.lastBuffer.subarray(e),ri.firstStartCodeOffset=0==r?14:0,ri.parsedOffset=ri.firstStartCodeOffset+4,ri.state="findFirstStartCode"}}}},getNaluDts(){let e=ri.localDts;return ri.localDts=ri.localDts+40,e}},ii={TAG_NAME:"worker TsLoaderV2",first_parse_:!0,tsPacketSize:0,syncOffset:0,pmt_:null,config_:null,media_info_:new zs,timescale_:90,duration_:0,pat_:{version_number:0,network_pid:0,program_map_pid:{}},current_program_:null,current_pmt_pid_:-1,program_pmt_map_:{},pes_slice_queues_:{},section_slice_queues_:{},video_metadata_:{vps:null,sps:null,pps:null,details:null},audio_metadata_:{codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},last_pcr_:null,audio_last_sample_pts_:void 0,aac_last_incomplete_data_:null,has_video_:!1,has_audio_:!1,video_init_segment_dispatched_:!1,audio_init_segment_dispatched_:!1,video_metadata_changed_:!1,audio_metadata_changed_:!1,loas_previous_frame:null,video_track_:{type:"video",id:1,sequenceNumber:0,samples:[],length:0},audio_track_:{type:"audio",id:2,sequenceNumber:0,samples:[],length:0},_remainingPacketData:null,init(){},destroy(){ii.media_info_=null,ii.pes_slice_queues_=null,ii.section_slice_queues_=null,ii.video_metadata_=null,ii.audio_metadata_=null,ii.aac_last_incomplete_data_=null,ii.video_track_=null,ii.audio_track_=null,ii._remainingPacketData=null},probe(e){let t=new Uint8Array(e),r=-1,i=188;if(t.byteLength<=3*i)return{needMoreData:!0};for(;-1===r;){let e=Math.min(1e3,t.byteLength-3*i);for(let s=0;s=4&&(r-=4),{match:!0,consumed:0,ts_packet_size:i,sync_offset:r})},_initPmt:()=>({program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}),dispatch(e){ii._remainingPacketData&&(e=us(ii._remainingPacketData,e),ii._remainingPacketData=null);let t=e.buffer;const r=ii.parseChunks(t);r?ii._remainingPacketData=e.subarray(r):e.length>>6;r[1];let n=(31&r[1])<<8|r[2],a=(48&r[3])>>>4,o=15&r[3],d=!(!ii.pmt_||ii.pmt_.pcr_pid!==n),l={},c=4;if(2==a||3==a){let e=r[4];if(e>0&&(d||3==a)&&(l.discontinuity_indicator=(128&r[5])>>>7,l.random_access_indicator=(64&r[5])>>>6,l.elementary_stream_priority_indicator=(32&r[5])>>>5,(16&r[5])>>>4)){let e=300*(r[6]<<25|r[7]<<17|r[8]<<9|r[9]<<1|r[10]>>>7)+((1&r[10])<<8|r[11]);ii.last_pcr_=e}if(2==a||5+e===188){t+=188,204===ii.tsPacketSize&&(t+=16);continue}c=5+e}if(1==a||3==a)if(0===n||n===ii.current_pmt_pid_||null!=ii.pmt_&&ii.pmt_.pid_stream_type[n]===Ds){let r=188-c;ii.handleSectionSlice(e,t+c,r,{pid:n,payload_unit_start_indicator:s,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}else if(null!=ii.pmt_&&null!=ii.pmt_.pid_stream_type[n]){let r=188-c,i=ii.pmt_.pid_stream_type[n];n!==ii.pmt_.common_pids.h264&&n!==ii.pmt_.common_pids.h265&&n!==ii.pmt_.common_pids.adts_aac&&n!==ii.pmt_.common_pids.loas_aac&&n!==ii.pmt_.common_pids.ac3&&n!==ii.pmt_.common_pids.eac3&&n!==ii.pmt_.common_pids.opus&&n!==ii.pmt_.common_pids.mp3&&!0!==ii.pmt_.pes_private_data_pids[n]&&!0!==ii.pmt_.timed_id3_pids[n]&&!0!==ii.pmt_.synchronous_klv_pids[n]&&!0!==ii.pmt_.asynchronous_klv_pids[n]||ii.handlePESSlice(e,t+c,r,{pid:n,stream_type:i,payload_unit_start_indicator:s,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}t+=188,204===ii.tsPacketSize&&(t+=16)}return ii.dispatchAudioVideoMediaSegment(),t},handleSectionSlice(e,t,r,i){let s=new Uint8Array(e,t,r),n=ii.section_slice_queues_[i.pid];if(i.payload_unit_start_indicator){let a=s[0];if(null!=n&&0!==n.total_length){let s=new Uint8Array(e,t+1,Math.min(r,a));n.slices.push(s),n.total_length+=s.byteLength,n.total_length===n.expected_length?ii.emitSectionSlices(n,i):ii.clearSlices(n,i)}for(let o=1+a;o=n.expected_length&&ii.clearSlices(n,i),o+=d.byteLength}}else if(null!=n&&0!==n.total_length){let s=new Uint8Array(e,t,Math.min(r,n.expected_length-n.total_length));n.slices.push(s),n.total_length+=s.byteLength,n.total_length===n.expected_length?ii.emitSectionSlices(n,i):n.total_length>=n.expected_length&&ii.clearSlices(n,i)}},handlePESSlice(e,t,r,i){let s=new Uint8Array(e,t,r),n=s[0]<<16|s[1]<<8|s[2];s[3];let a=s[4]<<8|s[5];if(i.payload_unit_start_indicator){if(1!==n)return void ni.debugWarn(ii.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${n}`);let e=ii.pes_slice_queues_[i.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?ii.emitPESSlices(e,i):ii.clearSlices(e,i)),ii.pes_slice_queues_[i.pid]=new Fs,ii.pes_slice_queues_[i.pid].random_access_indicator=i.random_access_indicator}if(null==ii.pes_slice_queues_[i.pid])return;let o=ii.pes_slice_queues_[i.pid];o.slices.push(s),i.payload_unit_start_indicator&&(o.expected_length=0===a?0:a+6),o.total_length+=s.byteLength,o.expected_length>0&&o.expected_length===o.total_length?ii.emitPESSlices(o,i):o.expected_length>0&&o.expected_length>>6,o=t[8];2!==a&&3!==a||(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,n=3===a?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:r);let d,l=9+o;if(0!==s){if(s<3+o)return void ni.debugWarn(ii.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");d=s-3-o}else d=t.byteLength-l;let c=t.subarray(l,l+d);switch(e.stream_type){case Es:case As:ii.parseMP3Payload(c,r);break;case Bs:ii.pmt_.common_pids.opus===e.pid||ii.pmt_.common_pids.ac3===e.pid||ii.pmt_.common_pids.eac3===e.pid||(ii.pmt_.asynchronous_klv_pids[e.pid]?ii.parseAsynchronousKLVMetadataPayload(c,e.pid,i):ii.pmt_.smpte2038_pids[e.pid]?ii.parseSMPTE2038MetadataPayload(c,r,n,e.pid,i):ii.parsePESPrivateDataPayload(c,r,n,e.pid,i));break;case Us:ii.parseADTSAACPayload(c,r);break;case xs:ii.parseLOASAACPayload(c,r);break;case ks:case Ts:break;case Cs:ii.pmt_.timed_id3_pids[e.pid]?ii.parseTimedID3MetadataPayload(c,r,n,e.pid,i):ii.pmt_.synchronous_klv_pids[e.pid]&&ii.parseSynchronousKLVMetadataPayload(c,r,n,e.pid,i);break;case Ls:ii.parseH264Payload(c,r,n,e.random_access_indicator);break;case Is:ii.parseH265Payload(c,r,n,e.random_access_indicator)}}else if((188===i||191===i||240===i||241===i||255===i||242===i||248===i)&&e.stream_type===Bs){let r,n=6;r=0!==s?s:t.byteLength-n;let a=t.subarray(n,n+r);ii.parsePESPrivateDataPayload(a,void 0,void 0,e.pid,i)}}else ni.debugError(ii.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${r}`)},parsePAT(e){let t=e[0];if(0!==t)return void Log.e(ii.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let r=(15&e[1])<<8|e[2];e[3],e[4];let i=(62&e[5])>>>1,s=1&e[5],n=e[6];e[7];let a=null;if(1===s&&0===n)a={version_number:0,network_pid:0,program_pmt_pid:{}},a.version_number=i;else if(a=ii.pat_,null==a)return;let o=r-5-4,d=-1,l=-1;for(let t=8;t<8+o;t+=4){let r=e[t]<<8|e[t+1],i=(31&e[t+2])<<8|e[t+3];0===r?a.network_pid=i:(a.program_pmt_pid[r]=i,-1===d&&(d=r),-1===l&&(l=i))}1===s&&0===n&&(null==ii.pat_&&ni.debugLog(ii.TAG_NAME,`Parsed first PAT: ${JSON.stringify(a)}`),ii.pat_=a,ii.current_program_=d,ii.current_pmt_pid_=l)},parsePMT(e){let t=e[0];if(2!==t)return void ni.debugError(ii.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let r,i=(15&e[1])<<8|e[2],s=e[3]<<8|e[4],n=(62&e[5])>>>1,a=1&e[5],o=e[6];if(e[7],1===a&&0===o)r=ii._initPmt(),r.program_number=s,r.version_number=n,ii.program_pmt_map_[s]=r;else if(r=ii.program_pmt_map_[s],null==r)return;r.pcr_pid=(31&e[8])<<8|e[9];let d=(15&e[10])<<8|e[11],l=12+d,c=i-9-d-4;for(let t=l;t0){for(let i=t+5;i0)for(let i=t+5;iii.has_video_&&ii.has_audio_?ii.video_init_segment_dispatched_&&ii.audio_init_segment_dispatched_:ii.has_video_&&!ii.has_audio_?ii.video_init_segment_dispatched_:!(ii.has_video_||!ii.has_audio_)&&ii.audio_init_segment_dispatched_,dispatchVideoInitSegment(){let e=ii.video_metadata_.details,t={type:"video"};t.id=ii.video_track_.id,t.timescale=1e3,t.duration=ii.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;let r=t.frameRate.fps_den,i=t.frameRate.fps_num;if(t.refSampleDuration=r/i*1e3,t.codec=e.codec_mimetype,ii.video_metadata_.vps){ni.isHevc=!0;let e=ii.video_metadata_.vps.data.subarray(4),r=ii.video_metadata_.sps.data.subarray(4),i=ii.video_metadata_.pps.data.subarray(4);t.hvcc=jr({vps:e,sps:r,pps:i}),0==ii.video_init_segment_dispatched_&&ni.debugLog(ii.TAG_NAME,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.hvcc&&ni.decodeVideo(t.hvcc,0,!0,0)}else{let e=ii.video_metadata_.sps.data.subarray(4),r=ii.video_metadata_.pps.data.subarray(4);t.avcc=Cr({sps:e,pps:r}),0==ii.video_init_segment_dispatched_&&ni.debugLog(ii.TAG_NAME,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.avcc&&ni.decodeVideo(t.avcc,0,!0,0)}ii.video_init_segment_dispatched_=!0,ii.video_metadata_changed_=!1;let s=ii.media_info_;s.hasVideo=!0,s.width=t.codecWidth,s.height=t.codecHeight,s.fps=t.frameRate.fps,s.profile=t.profile,s.level=t.level,s.refFrames=e.ref_frames,s.chromaFormat=e.chroma_format_string,s.sarNum=t.sarRatio.width,s.sarDen=t.sarRatio.height,s.videoCodec=t.codec,s.hasAudio&&s.audioCodec?s.mimeType=`video/mp2t; codecs="${s.videoCodec},${s.audioCodec}"`:s.mimeType=`video/mp2t; codecs="${s.videoCodec}"`},dispatchVideoMediaSegment(){ii.isInitSegmentDispatched()&&ii.video_track_.length&&ii._preDoDecode()},dispatchAudioMediaSegment(){ii.isInitSegmentDispatched()&&ii.audio_track_.length&&ii._preDoDecode()},dispatchAudioVideoMediaSegment(){ii.isInitSegmentDispatched()&&(ii.audio_track_.length||ii.video_track_.length)&&ii._preDoDecode()},parseADTSAACPayload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;if(ii.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+ii.aac_last_incomplete_data_.byteLength);t.set(ii.aac_last_incomplete_data_,0),t.set(e,ii.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/ii.timescale_),"aac"===ii.audio_metadata_.codec){if(null==t&&null!=ii.audio_last_sample_pts_)r=1024/ii.audio_metadata_.sampling_frequency*1e3,i=ii.audio_last_sample_pts_+r;else if(null==t)return void ni.debugWarn(ii.TAG_NAME,"AAC: Unknown pts");if(ii.aac_last_incomplete_data_&&ii.audio_last_sample_pts_){r=1024/ii.audio_metadata_.sampling_frequency*1e3;let e=ii.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(ni.debugWarn(ii.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let s,n=new Xt(e),a=null,o=i;for(;null!=(a=n.readNextAACFrame());){r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},ii.dispatchAudioInitSegment(e)):ii.detectAudioMetadataChange(e)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(e)),s=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let n={payload:i,length:i.byteLength,pts:t,dts:t,type:ne};ii.audio_track_.samples.push(n),ii.audio_track_.length+=i.byteLength,o+=r}n.hasIncompleteData()&&(ii.aac_last_incomplete_data_=n.getIncompleteData()),s&&(ii.audio_last_sample_pts_=s)},parseLOASAACPayload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;if(ii.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+ii.aac_last_incomplete_data_.byteLength);t.set(ii.aac_last_incomplete_data_,0),t.set(e,ii.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/ii.timescale_),"aac"===ii.audio_metadata_.codec){if(null==t&&null!=ii.audio_last_sample_pts_)r=1024/ii.audio_metadata_.sampling_frequency*1e3,i=ii.audio_last_sample_pts_+r;else if(null==t)return void ni.debugWarn(ii.TAG_NAME,"AAC: Unknown pts");if(ii.aac_last_incomplete_data_&&ii.audio_last_sample_pts_){r=1024/ii.audio_metadata_.sampling_frequency*1e3;let e=ii.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(ni.debugWarn(ii.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let s,n=new Zt(e),a=null,o=i;for(;null!=(a=n.readNextAACFrame(ar(this.loas_previous_frame)?void 0:this.loas_previous_frame));){ii.loas_previous_frame=a,r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},ii.dispatchAudioInitSegment(e)):ii.detectAudioMetadataChange(e)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(e)),s=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let n={payload:i,length:i.byteLength,pts:t,dts:t,type:ne};ii.audio_track_.samples.push(n),ii.audio_track_.length+=i.byteLength,o+=r}n.hasIncompleteData()&&(ii.aac_last_incomplete_data_=n.getIncompleteData()),s&&(ii.audio_last_sample_pts_=s)},parseAC3Payload(e,t){},parseEAC3Payload(e,t){},parseOpusPayload(e,t){},parseMP3Payload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;let r=[44100,48e3,32e3,0],i=[22050,24e3,16e3,0],s=[11025,12e3,8e3,0],n=e[1]>>>3&3,a=(6&e[1])>>1;e[2];let o=(12&e[2])>>>2,d=3!=(e[3]>>>6&3)?2:1,l=0,c=34;switch(n){case 0:l=s[o];break;case 2:l=i[o];break;case 3:l=r[o]}switch(a){case 1:c=34;break;case 2:c=33;break;case 3:c=32}const u={};u.object_type=c,u.sample_rate=l,u.channel_count=d,u.data=e;const h={codec:"mp3",data:u};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"mp3",object_type:c,sample_rate:l,channel_count:d},ii.dispatchAudioInitSegment(h)):ii.detectAudioMetadataChange(h)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(h));let f={payload:e,length:e.byteLength,pts:t/ii.timescale_,dts:t/ii.timescale_,type:ne};ii.audio_track_.samples.push(f),ii.audio_track_.length+=e.byteLength},detectAudioMetadataChange(e){if(e.codec!==ii.audio_metadata_.codec)return ni.debugLog(ii.TAG_NAME,`Audio: Audio Codecs changed from ${ii.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===ii.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==ii.audio_metadata_.audio_object_type)return ni.debugLog(ii.TAG_NAME,`AAC: AudioObjectType changed from ${ii.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==ii.audio_metadata_.sampling_freq_index)return ni.debugLog(ii.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==ii.audio_metadata_.channel_config)return ni.debugLog(ii.TAG_NAME,`AAC: Channel configuration changed from ${ii.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===ii.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==ii.audio_metadata_.sampling_frequency)return ni.debugLog(ii.TAG_NAME,`AC3: Sampling Frequency changed from ${ii.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==ii.audio_metadata_.bit_stream_identification)return ni.debugLog(ii.TAG_NAME,`AC3: Bit Stream Identification changed from ${ii.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==ii.audio_metadata_.bit_stream_mode)return ni.debugLog(ii.TAG_NAME,`AC3: BitStream Mode changed from ${ii.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==ii.audio_metadata_.channel_mode)return ni.debugLog(ii.TAG_NAME,`AC3: Channel Mode changed from ${ii.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==ii.audio_metadata_.low_frequency_effects_channel_on)return ni.debugLog(ii.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${ii.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===ii.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==ii.audio_metadata_.sample_rate)return ni.debugLog(ii.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==ii.audio_metadata_.channel_count)return ni.debugLog(ii.TAG_NAME,`Opus: Channel count changed from ${ii.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===ii.audio_metadata_.codec){const t=e.data;if(t.object_type!==ii.audio_metadata_.object_type)return ni.debugLog(ii.TAG_NAME,`MP3: AudioObjectType changed from ${ii.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==ii.audio_metadata_.sample_rate)return ni.debugLog(ii.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==ii.audio_metadata_.channel_count)return ni.debugLog(ii.TAG_NAME,`MP3: Channel count changed from ${ii.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1},dispatchAudioInitSegment(e){let t={type:"audio"};if(t.id=ii.audio_track_.id,t.timescale=1e3,t.duration=ii.duration_,"aac"===ii.audio_metadata_.codec){let r="aac"===e.codec?e.data:null,i=new Ns(r);t.audioSampleRate=i.sampling_rate,t.audioSampleRateIndex=i.sampling_index,t.channelCount=i.channel_count,t.codec=i.codec_mimetype,t.originalCodec=i.original_codec_mimetype,t.config=i.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale;const s=Wt({profile:ni._opt.mseDecodeAudio?i.object_type:i.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});ni.decodeAudio(s,0)}else"ac-3"===ii.audio_metadata_.codec||"ec-3"===ii.audio_metadata_.codec||"opus"===ii.audio_metadata_.codec||"mp3"===ii.audio_metadata_.codec&&(t.audioSampleRate=ii.audio_metadata_.sample_rate,t.channelCount=ii.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==ii.audio_init_segment_dispatched_&&ni.debugLog(ii.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),ii.audio_init_segment_dispatched_=!0,ii.video_metadata_changed_=!1;let r=ii.media_info_;r.hasAudio=!0,r.audioCodec=t.originalCodec,r.audioSampleRate=t.audioSampleRate,r.audioChannelCount=t.channelCount,r.hasVideo&&r.videoCodec?r.mimeType=`video/mp2t; codecs="${r.videoCodec},${r.audioCodec}"`:r.mimeType=`video/mp2t; codecs="${r.audioCodec}"`},dispatchPESPrivateDataDescriptor(e,t,r){},parsePESPrivateDataPayload(e,t,r,i,s){let n=new Ms;if(n.pid=i,n.stream_id=s,n.len=e.byteLength,n.data=e,null!=t){let e=Math.floor(t/ii.timescale_);n.pts=e}else n.nearest_pts=ii.getNearestTimestampMilliseconds();if(null!=r){let e=Math.floor(r/ii.timescale_);n.dts=e}},parseTimedID3MetadataPayload(e,t,r,i,s){ni.debugLog(ii.TAG_NAME,`Timed ID3 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${s}`)},parseSynchronousKLVMetadataPayload(e,t,r,i,s){ni.debugLog(ii.TAG_NAME,`Synchronous KLV Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${s}`)},parseAsynchronousKLVMetadataPayload(e,t,r){ni.debugLog(ii.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${r}`)},parseSMPTE2038MetadataPayload(e,t,r,i,s){ni.debugLog(ii.TAG_NAME,`SMPTE 2038 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${s}`)},getNearestTimestampMilliseconds:()=>null!=ii.audio_last_sample_pts_?Math.floor(ii.audio_last_sample_pts_):null!=ii.last_pcr_?Math.floor(ii.last_pcr_/300/ii.timescale_):void 0,_preDoDecode(){const e=ii.video_track_,t=ii.audio_track_;let r=e.samples;t.samples.length>0&&(r=e.samples.concat(t.samples),r=r.sort(((e,t)=>e.dts-t.dts))),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===ae?ii._doDecodeVideo({...e,payload:t}):e.type===ne&&ii._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0},_doDecodeVideo(e){const t=new Uint8Array(e.payload);let r=null;r=e.isHevc?Yr(t,e.isIFrame):Lr(t,e.isIFrame),e.isIFrame&&ni.calcIframeIntervalTimestamp(e.dts);let i=ni.cryptoPayload(r,e.isIFrame);ni.decode(i,{type:ae,ts:e.dts,isIFrame:e.isIFrame,cts:e.cts})},_doDecodeAudio(e){const t=new Uint8Array(e.payload);let r=t;_r(ni._opt.m7sCryptoAudio)&&(r=ni.cryptoPayloadAudio(t)),ni.decode(r,{type:ne,ts:e.dts,isIFrame:!1,cts:0})}},si=null;yr()&&(si={TAG_NAME:"worker MediaSource",_resetInIt(){si.isAvc=null,si.isAAC=null,si.videoInfo={},si.videoMeta={},si.audioMeta={},si.sourceBuffer=null,si.audioSourceBuffer=null,si.hasInit=!1,si.hasAudioInit=!1,si.isAudioInitInfo=!1,si.videoMimeType="",si.audioMimeType="",si.cacheTrack={},si.cacheAudioTrack={},si.timeInit=!1,si.sequenceNumber=0,si.audioSequenceNumber=0,si.firstRenderTime=null,si.firstAudioTime=null,si.mediaSourceAppendBufferFull=!1,si.mediaSourceAppendBufferError=!1,si.mediaSourceAddSourceBufferError=!1,si.mediaSourceBufferError=!1,si.mediaSourceError=!1,si.prevTimestamp=null,si.decodeDiffTimestamp=null,si.prevDts=null,si.prevAudioDts=null,si.prevPayloadBufferSize=0,si.isWidthOrHeightChanged=!1,si.prevTs=null,si.prevAudioTs=null,si.eventListenList=[],si.pendingRemoveRanges=[],si.pendingSegments=[],si.pendingAudioRemoveRanges=[],si.pendingAudioSegments=[],si.supportVideoFrameCallbackHandle=null,si.audioSourceBufferCheckTimeout=null,si.audioSourceNoDataCheckTimeout=null,si.hasPendingEos=!1,si.$video={currentTime:0,readyState:0}},init(){si.events=new hs,si._resetInIt(),si.mediaSource=new self.MediaSource,si.isDecodeFirstIIframe=!!gr(ni._opt.checkFirstIFrame),si._bindMediaSourceEvents()},destroy(){si.stop(),si._clearAudioSourceBufferCheckTimeout(),si.eventListenList&&si.eventListenList.length&&(si.eventListenList.forEach((e=>e())),si.eventListenList=[]),si._resetInIt(),si.mediaSource=null},getState:()=>si.mediaSource&&si.mediaSource.readyState,isStateOpen:()=>si.getState()===yt,isStateClosed:()=>si.getState()===vt,isStateEnded:()=>si.getState()===gt,_bindMediaSourceEvents(){const{proxy:e}=si.events,t=e(si.mediaSource,wt,(()=>{ni.debugLog(si.TAG_NAME,"sourceOpen"),si._onMediaSourceSourceOpen()})),r=e(si.mediaSource,bt,(()=>{ni.debugLog(si.TAG_NAME,"sourceClose")})),i=e(si.mediaSource,St,(()=>{ni.debugLog(si.TAG_NAME,"sourceended")}));si.eventListenList.push(t,r,i)},_onMediaSourceSourceOpen(){si.sourceBuffer||(ni.debugLog(si.TAG_NAME,"onMediaSourceSourceOpen() sourceBuffer is null and next init"),si._initSourceBuffer()),si.audioSourceBuffer||(ni.debugLog(si.TAG_NAME,"onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),si._initAudioSourceBuffer()),si._hasPendingSegments()&&si._doAppendSegments()},decodeVideo(e,t,r,i){if(ni.isDestroyed)ni.debugWarn(si.TAG_NAME,"decodeVideo() and decoder is destroyed");else if(gr(si.hasInit))if(r&&e[1]===Ut){const i=15&e[0];if(i===Pe&&gr(ni._opt.supportMSEDecodeHevc))return void si.emitError(Le.mediaSourceH265NotSupport);si.videoInfo.codec=i,postMessage({cmd:P,code:i});const s=new Uint8Array(e);postMessage({cmd:M,buffer:s,codecId:i},[s.buffer]),si.hasInit=si._decodeConfigurationRecord(e,t,r,i)}else ni.debugWarn(si.TAG_NAME,`decodeVideo has not init , isIframe is ${r} , payload is ${e[1]} so drop this frame`);else if(!si.isDecodeFirstIIframe&&r&&(si.isDecodeFirstIIframe=!0),si.isDecodeFirstIIframe){if(r&&0===e[1]){const t=15&e[0];let r={};t===Fe?r=kr(e.slice(5)):t===Pe&&(r=Hr(e));const i=si.videoInfo;i&&i.codecWidth&&i.codecWidth&&r&&r.codecWidth&&r.codecHeight&&(r.codecWidth!==i.codecWidth||r.codecHeight!==i.codecWidth)&&(ni.debugWarn(si.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${i.codecWidth}, old height is ${i.codecHeight},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),si.isWidthOrHeightChanged=!0,si.emitError(Le.mseWidthOrHeightChange,`width: ${i.codecWidth}->${r.codecWidth}, height: ${i.codecWidth}->${r.codecHeight}`))}if(si.isWidthOrHeightChanged)return void ni.debugWarn(si.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(mr(e))return void ni.debugLog(si.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLengthsi.prevTs>0&&eE,_decodeConfigurationRecord(e,t,r,i){let s=e.slice(5),n={};if(i===Fe?n=kr(s):i===Pe&&(n=Vr(s)),si.videoInfo.width=n.codecWidth,si.videoInfo.height=n.codecHeight,0===n.codecWidth&&0===n.codecHeight)return ni.debugWarn(si.TAG_NAME,"_decodeConfigurationRecord error",JSON.stringify(n)),si.emitError(Le.mediaSourceDecoderConfigurationError,`width is ${0===n.codecWidth} and height is ${n.codecHeight}`),!1;const a={id:Lt,type:"video",timescale:1e3,duration:0,avcc:s,codecWidth:n.codecWidth,codecHeight:n.codecHeight,videoType:n.videoType},o=fs.generateInitSegment(a);si.isAvc=i===Fe;let d=n.codec;return si.videoMimeType=d?`video/mp4; codecs="${n.codec}"`:si.isAvc?mt:_t,postMessage({cmd:k,w:n.codecWidth,h:n.codecHeight}),si._initSourceBuffer(),si.appendBuffer(o.buffer),si.sequenceNumber=0,si.cacheTrack={},si.timeInit=!1,!0},_decodeAudioConfigurationRecord(e,t){const r=e[0]>>4,i=e[0]>>1&1,s=r===$e,n=r===Ne;if(gr(n||s))return ni.debugWarn(si.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${r} ant auto wasm decode`),si.emitError(Le.mediaSourceAudioG711NotSupport),!1;const a={id:It,type:"audio",timescale:1e3};let o={};if(jt(e)){if(o=Kt(e.slice(2)),!o)return!1;a.audioSampleRate=o.sampleRate,a.channelCount=o.channelCount,a.config=o.config,a.refSampleDuration=1024/a.audioSampleRate*a.timescale}else{if(!s)return!1;if(o=Ss(e),!o)return!1;a.audioSampleRate=o.samplingRate,a.channelCount=o.channelCount,a.refSampleDuration=1152/a.audioSampleRate*a.timescale}a.codec=o.codec,a.duration=0;let d="mp4",l=o.codec,c=null;s&&gr(ni._opt.isFirefox)?(d="mpeg",l="",c=new Uint8Array):c=fs.generateInitSegment(a);let u=`${a.type}/${d}`;return l&&l.length>0&&(u+=`;codecs=${l}`),gr(si.isAudioInitInfo)&&(wr=r===Ne?i?16:8:0===i?8:16,postMessage({cmd:L,code:r}),postMessage({cmd:D,sampleRate:a.audioSampleRate,channels:a.channelCount,depth:wr}),si.isAudioInitInfo=!0),si.audioMimeType=u,si.isAAC=n,si._initAudioSourceBuffer(),si.appendAudioBuffer(c.buffer),!0},_initSourceBuffer(){const{proxy:e}=si.events;if(null===si.sourceBuffer&&null!==si.mediaSource&&si.isStateOpen()&&si.videoMimeType){try{ni.debugLog(si.TAG_NAME,"_initSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",si.videoMimeType),si.sourceBuffer=si.mediaSource.addSourceBuffer(si.videoMimeType)}catch(e){return ni.debugError(si.TAG_NAME,"_initSourceBuffer() appendBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),si.emitError(Le.mseWorkerAddSourceBufferError,e.code),void(si.mediaSourceAddSourceBufferError=!0)}if(si.sourceBuffer){const t=e(si.sourceBuffer,"error",(e=>{si.mediaSourceBufferError=!0,ni.debugError(si.TAG_NAME,"mseSourceBufferError mseDecoder.sourceBuffer",e,e.toString()),si.emitError(Le.mseSourceBufferError,e.code)})),r=e(si.sourceBuffer,"updateend",(()=>{si._hasPendingRemoveRanges()?si._doRemoveRanges():si._hasPendingSegments()?si._doAppendSegments():si.hasPendingEos&&(ni.debugLog(si.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),si.endOfStream())}));si.eventListenList.push(t,r)}}else ni.debugLog(si.TAG_NAME,`_initSourceBuffer and mseDecoder.isStateOpen is ${si.isStateOpen()} and mseDecoder.isAvc === null is ${null===si.isAvc}`)},_initAudioSourceBuffer(){const{proxy:e}=si.events;if(null===si.audioSourceBuffer&&null!==si.mediaSource&&si.isStateOpen()&&si.audioMimeType){try{ni.debugLog(si.TAG_NAME,"_initAudioSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",si.audioMimeType),si._clearAudioSourceBufferCheckTimeout(),si.audioSourceBuffer=si.mediaSource.addSourceBuffer(si.audioMimeType)}catch(e){return ni.debugError(si.TAG_NAME,"_initAudioSourceBuffer() addSourceBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),si.emitError(Le.mseWorkerAddSourceBufferError,e.code),void(si.mediaSourceAddSourceBufferError=!0)}if(si.audioSourceBuffer){const t=e(si.audioSourceBuffer,"error",(e=>{si.mediaSourceBufferError=!0,ni.debugError(si.TAG_NAME,"mseSourceBufferError mseDecoder.audioSourceBuffer",e.code,e.toString(),e),si.emitError(Le.mseSourceBufferError,e.code)})),r=e(si.audioSourceBuffer,"updateend",(()=>{si._hasPendingRemoveRanges()?si._doRemoveRanges():si._hasPendingSegments()?si._doAppendSegments():si.hasPendingEos&&(ni.debugLog(si.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),si.endOfStream())}));si.eventListenList.push(t,r),null===si.audioSourceNoDataCheckTimeout&&(si.audioSourceNoDataCheckTimeout=setTimeout((()=>{si._clearAudioNoDataCheckTimeout(),si.emitError(Le.mediaSourceAudioNoDataTimeout)}),1e3))}}else ni.debugLog(si.TAG_NAME,`_initAudioSourceBuffer and mseDecoder.isStateOpen is ${si.isStateOpen()} and mseDecoder.audioMimeType is ${si.audioMimeType}`)},_decodeVideo(e,t,r,i,s){let n=e.slice(5),a=n.byteLength;if(0===a)return void ni.debugWarn(si.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let o=(new Date).getTime(),d=!1;si.prevTimestamp||(si.prevTimestamp=o,d=!0);const l=o-si.prevTimestamp;if(si.decodeDiffTimestamp=l,l>1e3&&!d&&ni.isPlayer&&ni.debugLog(si.TAG_NAME,`_decodeVideo now time is ${o} and prev time is ${si.prevTimestamp}, diff time is ${l} ms`),si.cacheTrack.id&&t>=si.cacheTrack.dts){let e=8+si.cacheTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(fs.types.mdat,4),r.set(si.cacheTrack.data,8),si.cacheTrack.duration=t-si.cacheTrack.dts;let i=fs.moof(si.cacheTrack,si.cacheTrack.dts);si.cacheTrack={};let s=new Uint8Array(i.byteLength+r.byteLength);s.set(i,0),s.set(r,i.byteLength),si.appendBuffer(s.buffer)}else ni.debugLog(si.TAG_NAME,`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${s} cacheTrack dts is ${si.cacheTrack&&si.cacheTrack.dts}`),si.timeInit=!1,si.cacheTrack={};si.cacheTrack||(si.cacheTrack={}),si.cacheTrack.id=Lt,si.cacheTrack.sequenceNumber=++si.sequenceNumber,si.cacheTrack.size=a,si.cacheTrack.dts=t,si.cacheTrack.cts=i,si.cacheTrack.isKeyframe=r,si.cacheTrack.data=n,si.cacheTrack.flags={isLeading:0,dependsOn:r?2:1,isDependedOn:r?1:0,hasRedundancy:0,isNonSync:r?0:1},si.prevTimestamp=(new Date).getTime()},_decodeAudio(e,t,r){let i=si.isAAC?e.slice(2):e.slice(1),s=i.byteLength;if(si.cacheAudioTrack.id&&t>=si.cacheAudioTrack.dts){let e=8+si.cacheAudioTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(fs.types.mdat,4),r.set(si.cacheAudioTrack.data,8),si.cacheAudioTrack.duration=t-si.cacheAudioTrack.dts;let i=fs.moof(si.cacheAudioTrack,si.cacheAudioTrack.dts);si.cacheAudioTrack={};let s=new Uint8Array(i.byteLength+r.byteLength);s.set(i,0),s.set(r,i.byteLength),si.appendAudioBuffer(s.buffer)}else si.cacheAudioTrack={};si.cacheAudioTrack||(si.cacheAudioTrack={}),si.cacheAudioTrack.id=It,si.cacheAudioTrack.sequenceNumber=++si.audioSequenceNumber,si.cacheAudioTrack.size=s,si.cacheAudioTrack.dts=t,si.cacheAudioTrack.cts=0,si.cacheAudioTrack.data=i,si.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}},appendBuffer(e){ni.isDestroyed?ni.debugWarn(si.TAG_NAME,"appendBuffer() player is destroyed"):si.mediaSourceAddSourceBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):si.mediaSourceAppendBufferFull?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):si.mediaSourceAppendBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):si.mediaSourceBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(si.pendingSegments.push(e),si.sourceBuffer&&(ni._opt.mseAutoCleanupSourceBuffer&&si._needCleanupSourceBuffer()&&si._doCleanUpSourceBuffer(),gr(si.getSourceBufferUpdating())&&si.isStateOpen()&&gr(si._hasPendingRemoveRanges()))?si._doAppendSegments():si.isStateClosed()?(si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):si.isStateEnded()&&(si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,"mediaSource is end")))},appendAudioBuffer(e){ni.isDestroyed?ni.debugWarn(si.TAG_NAME,"appendAudioBuffer() player is destroyed"):si.mediaSourceAddSourceBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):si.mediaSourceAppendBufferFull?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):si.mediaSourceAppendBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):si.mediaSourceBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(si.pendingAudioSegments.push(e),si.audioSourceBuffer&&(ni._opt.mseAutoCleanupSourceBuffer&&si._needCleanupSourceBuffer()&&si._doCleanUpSourceBuffer(),gr(si.getAudioSourceBufferUpdating())&&si.isStateOpen()&&gr(si._hasPendingRemoveRanges()))?si._doAppendSegments():si.isStateClosed()?(si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):si.isStateEnded()&&(si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,"mediaSource is end")))},getSourceBufferUpdating:()=>si.sourceBuffer&&si.sourceBuffer.updating,getAudioSourceBufferUpdating:()=>si.audioSourceBuffer&&si.audioSourceBuffer.updating,stop(){si.abortSourceBuffer(),si.removeSourceBuffer(),si.endOfStream()},clearUpAllSourceBuffer(){if(si.sourceBuffer){const e=si.sourceBuffer.buffered;for(let t=0;tsi.pendingSegments.length>0||si.pendingAudioSegments.length>0,getPendingSegmentsLength:()=>si.pendingSegments.length,_handleUpdatePlaybackRate(){},_doAppendSegments(){if(si.isStateClosed()||si.isStateEnded())ni.debugLog(si.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==si.sourceBuffer){if(si.needInitAudio()&&null===si.audioSourceBuffer)return ni.debugLog(si.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===si.audioSourceBufferCheckTimeout&&(si.audioSourceBufferCheckTimeout=setTimeout((()=>{si._clearAudioSourceBufferCheckTimeout(),si.emitError(Le.mediaSourceAudioInitTimeout)}),1e3)));if(gr(si.getSourceBufferUpdating())&&si.pendingSegments.length>0){const e=si.pendingSegments.shift();try{si.sourceBuffer.appendBuffer(e)}catch(e){ni.debugError(si.TAG_NAME,"mseDecoder.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(si.stop(),si.mediaSourceAppendBufferFull=!0,si.emitError(Le.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(si.stop(),si.mediaSourceAppendBufferError=!0,si.emitError(Le.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(si.stop(),si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,`code is ${e.code} , message is ${e.message}`))}}if(gr(si.getAudioSourceBufferUpdating())&&si.pendingAudioSegments.length>0){const e=si.pendingAudioSegments.shift();try{si.audioSourceBuffer.appendBuffer(e)}catch(e){ni.debugError(si.TAG_NAME,"mseDecoder.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(si.stop(),si.mediaSourceAppendBufferFull=!0,si.emitError(Le.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(si.stop(),si.mediaSourceAppendBufferError=!0,si.emitError(Le.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(si.stop(),si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,e.code,`code is ${e.code} , message is ${e.message}`))}}}else ni.debugLog(si.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")},_doCleanUpSourceBuffer(){const e=si.$video.currentTime;if(si.sourceBuffer){const t=si.sourceBuffer.buffered;let r=!1;for(let i=0;i=ni._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-ni._opt.mseAutoCleanupMinBackwardDuration;si.pendingRemoveRanges.push({start:s,end:t})}}else n=ni._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-ni._opt.mseAutoCleanupMinBackwardDuration;si.pendingAudioRemoveRanges.push({start:s,end:t})}}else nsi.pendingRemoveRanges.length>0||si.pendingAudioRemoveRanges.length>0,needInitAudio:()=>ni._opt.hasAudio&&ni._opt.mseDecodeAudio,_doRemoveRanges(){if(si.sourceBuffer&&gr(si.getSourceBufferUpdating())){let e=si.pendingRemoveRanges;for(;e.length&&gr(si.getSourceBufferUpdating());){let t=e.shift();try{si.sourceBuffer.remove(t.start,t.end)}catch(e){ni.debugWarn(si.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e,e.toString())}}}if(si.audioSourceBuffer&&gr(si.getAudioSourceBufferUpdating())){let e=si.pendingAudioRemoveRanges;for(;e.length&&gr(si.getAudioSourceBufferUpdating());){let t=e.shift();try{si.audioSourceBuffer.remove(t.start,t.end)}catch(e){ni.debugWarn(si.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e,e.toString())}}}},_getPlaybackRate(){},_needCleanupSourceBuffer(){if(gr(ni._opt.mseAutoCleanupSourceBuffer))return!1;const e=si.$video.currentTime;if(si.sourceBuffer){let t=si.sourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=ni._opt.mseAutoCleanupMaxBackwardDuration)return!0}if(si.audioSourceBuffer){let t=si.audioSourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=ni._opt.mseAutoCleanupMaxBackwardDuration)return!0}return!1},_clearAudioSourceBufferCheckTimeout(){si.audioSourceBufferCheckTimeout&&(clearTimeout(si.audioSourceBufferCheckTimeout),si.audioSourceBufferCheckTimeout=null)},_clearAudioNoDataCheckTimeout(){si.audioSourceNoDataCheckTimeout&&(clearTimeout(si.audioSourceNoDataCheckTimeout),si.audioSourceNoDataCheckTimeout=null)},getHandle:()=>si.mediaSource.handle,emitError(e){postMessage({cmd:se,value:e,msg:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""})}});let ni={isPlayer:!0,isHevc:null,isPlayback:!1,dropping:!1,isPushDropping:!1,isWorkerFetch:!1,isDestroyed:!1,fetchStatus:Tt,_opt:xr(),mp3Demuxer:null,delay:-1,pushLatestDelay:-1,firstTimestamp:null,startTimestamp:null,preDelayTimestamp:null,stopId:null,streamFps:null,streamAudioFps:null,streamVideoFps:null,writableStream:null,networkDelay:0,webglObj:null,startStreamRateAndStatsInterval:function(){ni.stopStreamRateAndStatsInterval(),l=setInterval((()=>{d&&d(0);const e=JSON.stringify({demuxBufferDelay:ni.getVideoBufferLength(),audioDemuxBufferDelay:ni.getAudioBufferLength(),streamBufferByteLength:ni.getStreamBufferLength(),netBuf:ni.networkDelay||0,pushLatestDelay:ni.pushLatestDelay||0,latestDelay:ni.delay,isStreamTsMoreThanLocal:Ze,wasmDecodeDelay:Se-We});postMessage({cmd:O,type:Te,value:e})}),1e3)},stopStreamRateAndStatsInterval:function(){l&&(clearInterval(l),l=null)},useOffscreen:function(){return ni._opt.useOffscreen&&"undefined"!=typeof OffscreenCanvas},getDelay:function(e,t){if(!e||ni._opt.hasVideo&&!we)return-1;if(t===ne)return ni.delay;if(ni.preDelayTimestamp&&ni.preDelayTimestamp>e)return ni.preDelayTimestamp-e>1e3&&ni.debugWarn("worker",`getDelay() and preDelayTimestamp is ${ni.preDelayTimestamp} > timestamp is ${e} more than ${ni.preDelayTimestamp-e}ms and return ${ni.delay}`),ni.preDelayTimestamp=e,ni.delay;if(ni.firstTimestamp){if(e){const t=Date.now()-ni.startTimestamp,r=e-ni.firstTimestamp;t>=r?(Ze=!1,ni.delay=t-r):(Ze=!0,ni.delay=r-t)}}else ni.firstTimestamp=e,ni.startTimestamp=Date.now(),ni.delay=-1;return ni.preDelayTimestamp=e,ni.delay},getDelayNotUpdateDelay:function(e,t){if(!e||ni._opt.hasVideo&&!we)return-1;if(t===ne)return ni.pushLatestDelay;if(ni.preDelayTimestamp&&ni.preDelayTimestamp-e>1e3)return ni.debugWarn("worker",`getDelayNotUpdateDelay() and preDelayTimestamp is ${ni.preDelayTimestamp} > timestamp is ${e} more than ${ni.preDelayTimestamp-e}ms and return -1`),-1;if(ni.firstTimestamp){let t=-1;if(e){const r=Date.now()-ni.startTimestamp,i=e-ni.firstTimestamp;r>=i?(Ze=!1,t=r-i):(Ze=!0,t=i-r)}return t}return-1},resetDelay:function(){ni.firstTimestamp=null,ni.startTimestamp=null,ni.delay=-1,ni.dropping=!1},resetAllDelay:function(){ni.resetDelay(),ni.preDelayTimestamp=null},doDecode:function(e){ni._opt.isEmitSEI&&e.type===ae&&ni.isWorkerFetch&&ni.findSei(e.payload,e.ts),ni.isPlayUseMSEAndDecoderInWorker()?e.type===ne?ni._opt.mseDecodeAudio?si.decodeAudio(e.payload,e.ts):e.decoder.decode(e.payload,e.ts):e.type===ae&&si.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):ni._opt.useWCS&&ni.useOffscreen()&&e.type===ae&&n.decode?n.decode(e.payload,e.ts,e.cts):e.decoder.decode(e.payload,e.ts,e.isIFrame,e.cts)},decodeNext(e){if(0===i.length)return;const t=e.ts,s=i[0],n=e.type===ae&&mr(e.payload);if(gr(r))n&&(ni.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${s.type} ts is ${s.ts}\n isVideoSqeHeader is ${n}`),i.shift(),ni.doDecode(s));else{const r=s.ts-t,a=s.type===ne&&e.type===ae;(r<=20||a||n)&&(ni.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${s.type} ts is ${s.ts}\n diff is ${r} and isVideoAndNextAudio is ${a} and isVideoSqeHeader is ${n}`),i.shift(),ni.doDecode(s))}},init:function(){ni.debugLog("worker","init and opt is",JSON.stringify(ni._opt));const e=ni._opt.playType===y,t=ni._opt.playType===v;if(Gr.init(),ni.isPlayer=e,ni.isPlayback=t,ni.isPlayUseMSEAndDecoderInWorker()&&si&&si.init(),n&&ni._opt.useWCS&&ni.useOffscreen()&&n.init(),gr(ni.isPlaybackCacheBeforeDecodeForFpsRender())){ni.debugLog("worker","setInterval()");const t=()=>{const t=ni._opt.videoBuffer+ni._opt.videoBufferDelay;let r=null;if(i.length){if(ni.isPushDropping)return void ni.debugWarn("worker",`loop() isPushDropping is true and bufferList length is ${i.length}`);if(ni.dropping){for(r=i.shift(),ni.debugWarn("worker",`loop() dropBuffer is dropping and isIFrame ${r.isIFrame} and delay is ${ni.delay} and bufferlist is ${i.length}`);!r.isIFrame&&i.length;)r=i.shift();const e=ni.getDelayNotUpdateDelay(r.ts,r.type);r.isIFrame&&e<=ni.getNotDroppingDelayTs()&&(ni.debugLog("worker","loop() is dropping = false, is iFrame"),ni.dropping=!1,ni.doDecode(r),ni.decodeNext(r))}else if(ni.isPlayback||ni.isPlayUseMSE()||0===ni._opt.videoBuffer)for(;i.length;)r=i.shift(),ni.doDecode(r);else if(r=i[0],-1===ni.getDelay(r.ts,r.type))ni.debugLog("worker","loop() common dumex delay is -1 ,data.ts is",r.ts),i.shift(),ni.doDecode(r),ni.decodeNext(r);else if(ni.delay>t&&e)ni.hasIframeInBufferList()?(ni.debugLog("worker",`delay is ${ni.delay} > maxDelay ${t}, set dropping is true`),ni.resetAllDelay(),ni.dropping=!0,postMessage({cmd:$})):(i.shift(),ni.doDecode(r),ni.decodeNext(r));else for(;i.length;){if(r=i[0],!(ni.getDelay(r.ts,r.type)>ni._opt.videoBuffer)){ni.delay<0&&ni.debugWarn("worker",`loop() do not decode and delay is ${ni.delay}, bufferList is ${i.length}`);break}i.shift(),ni.doDecode(r)}}else-1!==ni.delay&&ni.debugLog("worker","loop() bufferList is empty and reset delay"),ni.resetAllDelay()};ni.stopId=setInterval((()=>{let e=(new Date).getTime();Je||(Je=e);const r=e-Je;r>100&&ni.debugWarn("worker",`loop demux diff time is ${r}`),t(),Je=(new Date).getTime()}),20)}else ni.debugLog("worker","playback and playbackIsCacheBeforeDecodeForFpsRender is true");if(gr(ni._opt.checkFirstIFrame)&&(we=!0),ni.isPlayUseMSEAndDecoderInWorker()&&si){const e=si.getHandle();e&&postMessage({cmd:re,mseHandle:e},[e])}},playbackCacheLoop:function(){ni.clearPlaybackCacheLoop();const e=()=>{let e=null;i.length&&(e=i.shift(),ni.doDecode(e))};e();const t=Math.ceil(1e3/(ni.streamFps*ni._opt.playbackRate));ni.debugLog("worker",`playbackCacheLoop fragDuration is ${t}, streamFps is ${ni.streamFps}, streamAudioFps is ${ni.streamAudioFps} ,streamVideoFps is ${ni.streamVideoFps} playbackRate is ${ni._opt.playbackRate}`),ni.stopId=setInterval(e,t)},clearPlaybackCacheLoop:function(){ni.stopId&&(clearInterval(ni.stopId),ni.stopId=null)},startPlaybackCacheLoop:function(){ni.playbackCacheLoop()},close:function(){if(ni.debugLog("worker","close"),ni.isDestroyed=!0,Or(),!o||1!==o.readyState&&2!==o.readyState?o&&ni.debugLog("worker",`close() and socket.readyState is ${o.readyState}`):(Sr=!0,o.close(1e3,"Client disconnecting")),o=null,ni.stopStreamRateAndStatsInterval(),ni.stopId&&(clearInterval(ni.stopId),ni.stopId=null),ni.mp3Demuxer&&(ni.mp3Demuxer.destroy(),ni.mp3Demuxer=null),ni.writableStream&&gr(ni.writableStream.locked)&&ni.writableStream.close().catch((e=>{ni.debugLog("worker","close() and writableStream.close() error",e.toString(),e)})),ni.writableStream=null,ai)try{ai.clear&&ai.clear(),ai=null}catch(e){ni.debugLog("worker","close() and audioDecoder.clear error",e.toString(),e)}if(oi)try{oi.clear&&oi.clear(),oi=null}catch(e){ni.debugLog("worker","close() and videoDecoder.clear error",e.toString())}d=null,Je=null,Ze=!1,Se=0,We=0,n&&(n.destroy&&n.destroy(),n=null),si&&(si.destroy(),si=null),ni.firstTimestamp=null,ni.startTimestamp=null,ni.networkDelay=0,ni.streamFps=null,ni.streamAudioFps=null,ni.streamVideoFps=null,ni.delay=-1,ni.pushLatestDelay=-1,ni.preDelayTimestamp=null,ni.dropping=!1,ni.isPushDropping=!1,ni.isPlayer=!0,ni.isPlayback=!1,ni.isWorkerFetch=!1,ni.isHevc=null,ni._opt=xr(),ni.webglObj&&(ni.webglObj.destroy(),ni.offscreenCanvas.removeEventListener("webglcontextlost",ni.onOffscreenCanvasWebglContextLost),ni.offscreenCanvas.removeEventListener("webglcontextrestored",ni.onOffscreenCanvasWebglContextRestored),ni.offscreenCanvas=null,ni.offscreenCanvasGL=null,ni.offscreenCanvasCtx=null),i=[],s=[],c&&(c.close(),c=null),h=null,w=null,S=!1,U=!1,we=!1,Yt=!1,Jt=!1,sr=!1,br=null,ct=[],xt=0,Nt=0,et=null,rt=null,Ot=null,Gt=null,wr=null,$t=0,Ht=0,Et=null,At=null,ni.fetchStatus=Tt,Er=!0,Gr.destroy(),Wr.destroy(),ri.destroy(),ii.destroy(),ni.debug=null,ni._opt={},postMessage({cmd:Y})},pushBuffer:function(e,t){if(t.type===ne&&jt(e)){if(ni.debugLog("worker",`pushBuffer audio ts is ${t.ts}, isAacCodecPacket is true`),ni._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:J,buffer:t},[t.buffer])}ni.decodeAudio(e,t.ts)}else if(t.type===ae&&t.isIFrame&&mr(e)){if(ni.debugLog("worker",`pushBuffer video ts is ${t.ts}, isVideoSequenceHeader is true`),ni._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:Q,buffer:t},[t.buffer])}ni.decodeVideo(e,t.ts,t.isIFrame,t.cts)}else{if(ni._opt.isRecording)if(ni._opt.isRecordTypeFlv){const r=new Uint8Array(e);postMessage({cmd:ee,type:t.type,buffer:r,ts:t.ts},[r.buffer])}else if(ni._opt.recordType===b)if(t.type===ae){const r=new Uint8Array(e).slice(5);postMessage({cmd:R,buffer:r,isIFrame:t.isIFrame,ts:t.ts,cts:t.cts},[r.buffer])}else if(t.type===ne&&ni._opt.isWasmMp4){const r=new Uint8Array(e),i=qt(r)?r.slice(2):r.slice(1);postMessage({cmd:I,buffer:i,ts:t.ts},[i.buffer])}if(ni.isPlayer){if(t.type===ae){if($t>0){const e=t.ts-Gt,r=$t+$t/2;e>r&&ni.debugLog("worker",`pushBuffer video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts}, preTs is ${Gt},\n diff is ${e} and preTsDuration is ${$t} and maxDiff is ${r}\n maybe trigger black screen or flower screen\n `)}if(null!==Gt&&Gt>=t.ts&&(ni.debugWarn("worker",`pushBuffer() and isIFrame is ${t.isIFrame} and,\n options.ts is ${t.ts} less than (or equal) preTs is ${Gt} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${Ht}`),Gt-t.ts>E&&(ni.debugWarn("worker",`pushBuffer,\n preTimestamp is ${Gt}, options.ts is ${t.ts},\n diff is ${Gt-t.ts} more than 3600000,\n and resetAllDelay`),ni.resetAllDelay(),Gt=null,$t=0),ni._opt.isDropSameTimestampGop&&gr(t.isIFrame)&&we)){const e=ni.hasIframeInBufferList(),t=gr(ni.isPushDropping);return ni.debugLog("worker",`pushBuffer, isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next dropBuffer`),void(e&&t?ni.dropBuffer$2():(ni.clearBuffer(!0),_r(ni._opt.checkFirstIFrame)&&_r(r)&&(ni.isPlayUseMSEAndDecoderInWorker()?si.isDecodeFirstIIframe=!1:postMessage({cmd:te}))))}Gt>0&&($t=t.ts-Gt),Ht=e.byteLength,Gt=t.ts}if(we){const e=ni._opt.videoBuffer+ni._opt.videoBufferDelay,r=ni.getDelayNotUpdateDelay(t.ts,t.type);ni.pushLatestDelay=r,ni.delay>0&&r>e&&ni.delay({type:e.type,ts:e.ts})));ni.debugLog("worker",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${i.length}, and ts list is ${JSON.stringify(r)}`)}const r=ni.getAudioBufferLength()>0,s=r?60:40;i.length>=s&&(ni.debugWarn("worker",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${i.length} more than ${s}, and hasAudio is ${r} an set streamFps is 25`),ni.streamVideoFps=25,postMessage({cmd:V,value:ni.streamVideoFps}),r?(ni.streamAudioFps=25,ni.streamFps=ni.streamVideoFps+ni.streamAudioFps):ni.streamFps=ni.streamVideoFps,ni.playbackCacheLoop())}}},getVideoBufferLength(){let e=0;return i.forEach((t=>{t.type===ae&&(e+=1)})),e},hasIframeInBufferList:()=>i.some((e=>e.type===ae&&e.isIFrame)),isAllIframeInBufferList(){const e=ni.getVideoBufferLength();let t=0;return i.forEach((e=>{e.type===ae&&e.isIFrame&&(t+=1)})),e===t},getNotDroppingDelayTs:()=>ni._opt.videoBuffer+ni._opt.videoBufferDelay/2,getAudioBufferLength(){let e=0;return i.forEach((t=>{t.type===ne&&(e+=1)})),e},getStreamBufferLength(){let e=0;return c&&c.buffer&&(e=c.buffer.byteLength),ni._opt.isNakedFlow?Gr.lastBuf&&(e=Gr.lastBuf.byteLength):ni._opt.isTs?ii._remainingPacketData&&(e=ii._remainingPacketData.byteLength):ni._opt.isFmp4&&Wr.mp4Box&&(e=Wr.mp4Box.getAllocatedSampleDataSize()),e},fetchStream:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(ni.debugLog("worker","fetchStream, url is "+e,"options:",JSON.stringify(t)),ni.isWorkerFetch=!0,t.isFlv?ni._opt.isFlv=!0:t.isFmp4?ni._opt.isFmp4=!0:t.isMpeg4?ni._opt.isMpeg4=!0:t.isNakedFlow?ni._opt.isNakedFlow=!0:t.isTs&&(ni._opt.isTs=!0),d=nr((e=>{postMessage({cmd:O,type:Ae,value:e})})),ni.startStreamRateAndStatsInterval(),t.isFmp4&&(Wr.listenMp4Box(),ni._opt.isFmp4Private&&Wr.initTransportDescarmber()),t.protocol===m){t.isFlv&&(c=new Ar(ni.demuxFlv())),a=new AbortController;const r=Object.assign({signal:a.signal},{headers:t.options&&t.options.headers||{}});fetch(e,r).then((e=>{if(_r(Sr))return ni.debugLog("worker","request abort and run res.body.cancel()"),ni.fetchStatus=Tt,void e.body.cancel();if(!fr(e))return ni.debugWarn("worker",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),Or(),void postMessage({cmd:O,type:Le.fetchError,value:`fetch response status is ${e.status} and ok is ${e.ok}`});if(postMessage({cmd:O,type:ke}),cr())ni.writableStream=new WritableStream({write:e=>a&&a.signal&&a.signal.aborted?(ni.debugLog("worker","writableStream write() and abortController.signal.aborted is true so return"),void(ni.fetchStatus=Dt)):_r(Sr)?(ni.debugLog("worker","writableStream write() and requestAbort is true so return"),ni.fetchStatus=Dt,void Or()):void("string"!=typeof e?(ni.fetchStatus=Ct,d(e.byteLength),t.isFlv?c.write(e):t.isFmp4?ni.demuxFmp4(e):t.isMpeg4?ni.demuxMpeg4(e):t.isTs?ni.demuxTs(e):t.isNakedFlow&&ni.demuxNakedFlow(e)):ni.debugWarn("worker",`writableStream write() and value is "${e}" string so return`)),close:()=>{ni.debugLog("worker","writableStream close()"),ni.fetchStatus=Dt,c&&(c.close(),c=null),Or(),postMessage({cmd:O,type:Ee,value:_,msg:"fetch done"})},abort:e=>{if(a&&a.signal&&a.signal.aborted)return ni.debugLog("worker","writableStream abort() and abortController.signal.aborted is true so return"),void(ni.fetchStatus=Dt);c&&(c.close(),c=null),e.name!==Bt?(ni.debugLog("worker",`writableStream abort() and e is ${e.toString()}`),Or(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()})):ni.debugLog("worker","writableStream abort() and e.name is AbortError so return")}}),e.body.pipeTo(ni.writableStream).catch((e=>{"AbortError"!==e.name&&ni.debugLog("worker","writableStream pipeTo() and e is",e.name,e.toString())}));else{const r=e.body.getReader(),i=()=>{r.read().then((e=>{let{done:r,value:s}=e;return r?(ni.debugLog("worker","fetchNext().then() and done is true"),ni.fetchStatus=Dt,c&&(c.close(),c=null),Or(),void postMessage({cmd:O,type:Ee,value:_,msg:"fetch done"})):a&&a.signal&&a.signal.aborted?(ni.debugLog("worker","fetchNext().then() and abortController.signal.aborted is true so return"),void(ni.fetchStatus=Dt)):_r(Sr)?(ni.debugLog("worker","fetchNext().then() and requestAbort is true so return"),ni.fetchStatus=Dt,void Or()):void("string"!=typeof s?(ni.fetchStatus=Ct,d(s.byteLength),t.isFlv?c.write(s):t.isFmp4?ni.demuxFmp4(s):t.isMpeg4?ni.demuxMpeg4(s):t.isTs?ni.demuxTs(s):t.isNakedFlow&&ni.demuxNakedFlow(s),i()):ni.debugWarn("worker",`fetchNext().then() and value "${s}" is string so return`))})).catch((e=>{if(a&&a.signal&&a.signal.aborted)return ni.debugLog("worker","fetchNext().catch() and abortController.signal.aborted is true so return"),void(ni.fetchStatus=Dt);c&&(c.close(),c=null),e.name!==Bt?(ni.debugLog("worker",`fetchNext().catch() and e is ${e.toString()}`),Or(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()})):ni.debugLog("worker","fetchNext().catch() and e.name is AbortError so return")}))};i()}})).catch((e=>{a&&a.signal&&a.signal.aborted?ni.debugLog("worker","fetch().catch() and abortController.signal.aborted is true so return"):e.name!==Bt?(ni.debugLog("worker",`fetch().catch() and e is ${e.toString()}`),Or(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()}),c&&(c.close(),c=null)):ni.debugLog("worker","fetch().catch() and e.name is AbortError so return")}))}else t.protocol===p&&(t.isFlv&&(c=new Ar(ni.demuxFlv())),o=new WebSocket(e,r),o.binaryType="arraybuffer",o.onopen=()=>{ni.debugLog("worker","fetchStream, WebsocketStream socket open"),postMessage({cmd:O,type:ke}),postMessage({cmd:O,type:De})},o.onclose=e=>{ni.isDestroyed?ni.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} and isDestroyed is true, so return`):u?ni.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} but isSocketError is true , so return`):(ni.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code}`),1006===e.code&&ni.debugError("worker",`fetchStream, WebsocketStream socket close abnormally and code is ${e.code}`),_r(Sr)?ni.debugLog("worker","fetchStream, WebsocketStream socket close and requestAbort is true so return"):(c&&(c.close(),c=null),postMessage({cmd:O,type:Ee,value:g,msg:e.code})))},o.onerror=e=>{ni.debugError("worker","fetchStream, WebsocketStream socket error",e,e.toString()),u=!0,c&&(c.close(),c=null),ni.isDestroyed?ni.debugLog("worker","fetchStream, WebsocketStream on error and isDestroyed is true, so return"):postMessage({cmd:O,type:Le.websocketError,value:e.isTrusted?"websocket user aborted":"websocket error"})},o.onmessage=e=>{"string"!=typeof e.data?(d(e.data.byteLength),t.isFlv?c.write(e.data):t.isFmp4?ni.demuxFmp4(e.data):t.isMpeg4?ni.demuxMpeg4(e.data):ni._opt.isNakedFlow?ni.demuxNakedFlow(e.data):ni.demuxM7s(e.data)):ni.debugWarn("worker",`socket on message is string "${e.data}" and return`)})},demuxFlv:function*(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),r=new Uint32Array(e);for(;;){t[3]=0;const e=yield 15,i=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const s=r[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let n=r[0];const a=(yield s).slice();switch(i){case oe:if(a.byteLength>0){let e=a;_r(ni._opt.m7sCryptoAudio)&&(e=ni.cryptoPayloadAudio(a)),ni.decode(e,{type:ne,ts:n})}else ni.debugWarn("worker",`demuxFlv() type is audio and payload.byteLength is ${a.byteLength} and return`);break;case de:if(a.byteLength>=6){const e=a[0];if(ni._isEnhancedH265Header(e))ni._decodeEnhancedH265Video(a,n);else{const e=15&a[0];let t=a[0]>>4===kt;const i=e===Pe;if(gr(t)&&_r(vr(a,i))&&(ni.debugLog("worker","demux() isIFrame is false and unit type is IDR and update to true"),t=!0),t&&mr(a)&&null===ni.isHevc){const e=15&a[0];ni.isHevc=e===Pe,br=tr(a,ni.isHevc),ni.debugLog("worker",`demuxFlv() isVideoSequenceHeader is true and isHevc is ${ni.isHevc} and nalUnitSize is ${br}`)}t&&ni.calcIframeIntervalTimestamp(n),ni.isPlayer&&ni.calcNetworkDelay(n),r[0]=a[4],r[1]=a[3],r[2]=a[2],r[3]=0;let s=r[0],o=ni.cryptoPayload(a,t);ni.decode(o,{type:ae,ts:n,isIFrame:t,cts:s})}}else ni.debugWarn("worker",`demuxFlv() type is video and payload.byteLength is ${a.byteLength} and return`);break;case le:postMessage({cmd:Z,buffer:a},[a.buffer]);break;default:ni.debugLog("worker",`demuxFlv() type is ${i}`)}}},decode:function(e,t){t.type===ne?ni._opt.hasAudio&&(postMessage({cmd:O,type:Be,value:e.byteLength}),ni.isPlayer?ni.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts}):ni.isPlayback&&(ni.isPlaybackOnlyDecodeIFrame()||(ni.isPlaybackCacheBeforeDecodeForFpsRender(),ni.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts})))):t.type===ae&&ni._opt.hasVideo&&(postMessage({cmd:O,type:Ue,value:e.byteLength}),postMessage({cmd:O,type:xe,value:t.ts}),ni.isPlayer?ni.pushBuffer(e,{type:t.type,ts:t.ts,isIFrame:t.isIFrame,cts:t.cts}):ni.isPlayback&&(ni.isPlaybackOnlyDecodeIFrame()?t.isIFrame&&ni.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}):(ni.isPlaybackCacheBeforeDecodeForFpsRender(),ni.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}))))},cryptoPayload:function(e,t){let r=e;return ni._opt.isM7sCrypto?ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength>0&&ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength>0?r=Ri(e,ni._opt.cryptoKey,ni._opt.cryptoIV,ni.isHevc):ni.debugError("worker",`isM7sCrypto cryptoKey.length is ${ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength} or cryptoIV.length is ${ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength} null`):ni._opt.isSm4Crypto?ni._opt.sm4CryptoKey?r=ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength>0&&ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength>0?Qs(e,ni._opt.cryptoKey,ni._opt.cryptoIV,ni.isHevc,ni._opt.isSm4CryptoH265V2):ns(e,ni._opt.sm4CryptoKey,ni.isHevc,ni._opt.isSm4CryptoH265V2):ni._opt.sm4CryptoKey||ni.debugError("worker","isSm4Crypto opt.sm4CryptoKey is null"):ni._opt.isXorCrypto&&(ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength>0&&ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength>0?r=cs(e,ni._opt.cryptoKey,ni._opt.cryptoIV,ni.isHevc):ni.debugError("worker",`isXorCrypto cryptoKey.length is ${ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength} or cryptoIV.length is ${ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength} null`)),r},cryptoPayloadAudio:function(e){let t=e;return ni._opt.isM7sCrypto&&(ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength>0&&ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength>0?e[0]>>4===Ne&&(t=zi(e,ni._opt.cryptoKey,ni._opt.cryptoIV)):ni.debugError("worker",`isM7sCrypto cryptoKey.length is ${ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength} or cryptoIV.length is ${ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength} null`)),t},setCodecAudio:function(e,t){const r=e[0]>>4,i=e[0]>>1&1;if(wr=r===Ne?i?16:8:0===i?8:16,ai&&ai.setCodec)if(jt(e)||r===Oe||r===Ge||r===$e){ni.debugLog("worker",`setCodecAudio: init audio codec, codeId is ${r} _opt.sampleRate is ${ni._opt.sampleRate}`);const i=r===Ne?e.slice(2):new Uint8Array(0);ai.setCodec(r,ni._opt.sampleRate,i),r===Ne&&postMessage({cmd:F,buffer:i},[i.buffer]),U=!0,r!==Ne&&(r===$e?(ni.mp3Demuxer||(ni.mp3Demuxer=new os(ni),ni.mp3Demuxer.on("data",((e,t)=>{ai.decode(e,t)}))),ni.mp3Demuxer.dispatch(e.slice(1),t)):ai.decode(e.slice(1),t));{const e=Number("1")||1;setTimeout((()=>{ni.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),ni.close(),postMessage({cmd:H})}),60*e*60*1e3)}}else ni.debugWarn("worker","setCodecAudio: hasInitAudioCodec is false, codecId is ",r);else ni.debugError("worker","setCodecAudio: audioDecoder or audioDecoder.setCodec is null")},decodeAudio:function(e,t){if(ni.isDestroyed)ni.debugLog("worker","decodeAudio, decoder is destroyed and return");else if(ni.isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio())si.decodeAudio(e,t);else if(_r(r)&&_r(ni._opt.mseDecodeAudio))postMessage({cmd:N,payload:e,ts:t,cts:t},[e.buffer]);else{const r=e[0]>>4;if(U){if(jt(e))return void ni.debugLog("worker","decodeAudio and has already initialized and payload is aac codec packet so drop this frame");r===$e?ni.mp3Demuxer.dispatch(e.slice(1),t):ai.decode(r===Ne?e.slice(2):e.slice(1),t)}else ni.setCodecAudio(e,t)}},setCodecVideo:function(e,t){const r=15&e[0];if(oi&&oi.setCodec)if(mr(e))if(r===Fe||r===Pe){ni.debugLog("worker",`setCodecVideo: init video codec , codecId is ${r}`);const t=e.slice(5);if(r===Fe&&ni._opt.useSIMD){const e=kr(t);if(e.codecWidth>A||e.codecHeight>A)return postMessage({cmd:q,value:`width: ${e.codecWidth} > 4080, height: ${e.codecHeight} > 4080`}),void ni.debugWarn("worker",`setCodecVideo: SIMD H264 decode video width is too large, width is ${e.codecWidth}, height is ${e.codecHeight}`)}const i=new Uint8Array(e);S=!0,oi.setCodec(r,t),postMessage({cmd:P,code:r}),postMessage({cmd:M,buffer:i,codecId:r},[i.buffer])}else ni.debugWarn("worker",`setCodecVideo: hasInitVideoCodec is false, codecId is ${r} is not H264 or H265`);else ni.debugWarn("worker",`decodeVideo: hasInitVideoCodec is false, codecId is ${r} and isIFrame is ${t} and packetType is ${e[1]}`);else ni.debugError("worker","setCodecVideo: videoDecoder or videoDecoder.setCodec is null")},decodeVideo:function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(ni.isDestroyed)ni.debugLog("worker","decodeVideo, decoder is destroyed and return");else if(ni.isPlayUseMSEAndDecoderInWorker())si.decodeVideo(e,t,i,s);else if(_r(r))postMessage({cmd:z,payload:e,isIFrame:i,ts:t,cts:s,delay:ni.delay},[e.buffer]);else if(S)if(!we&&i&&(we=!0),we){if(i&&mr(e)){const t=15&e[0];let r={};t===Fe?r=kr(e.slice(5)):t===Pe&&(r=Hr(e)),r.codecWidth&&r.codecHeight&&h&&w&&(r.codecWidth!==h||r.codecHeight!==w)&&(ni.debugWarn("worker",`\n decodeVideo: video width or height is changed,\n old width is ${h}, old height is ${w},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),Jt=!0,postMessage({cmd:W,value:`width: ${h}->${r.codecWidth}, height: ${w}->${r.codecHeight}`}))}if(Jt)return void ni.debugWarn("worker","decodeVideo: video width or height is changed, and return");if(sr)return void ni.debugWarn("worker","decodeVideo: simd decode error, and return");if(mr(e))return void ni.debugLog("worker","decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength0&&void 0!==arguments[0]&&arguments[0];ni.debugLog("worker",`clearBuffer,bufferList length is ${i.length}, need clear is ${e}`),e&&(i=[]),ni.isPlayer&&(ni.resetAllDelay(),_r(ni._opt.checkFirstIFrame)&&(ni.dropping=!0,postMessage({cmd:$}))),_r(ni._opt.checkFirstIFrame)&&gr(r)&&(we=!1)},dropBuffer$2:function(){if(i.length>0){let e=i.findIndex((e=>_r(e.isIFrame)&&e.type===ae));if(ni.isAllIframeInBufferList())for(let t=0;t=ni.getNotDroppingDelayTs()){ni.debugLog("worker",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${s} and notDroppingDelayTs is ${ni.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){ni.isPushDropping=!0,postMessage({cmd:$});const t=i.length;i=i.slice(e);const r=i.shift();ni.resetAllDelay(),ni.getDelay(r.ts,r.type),ni.doDecode(r),ni.isPushDropping=!1,ni.debugLog("worker",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,new bufferList is ${i.length} and new delay is ${ni.delay} `)}else ni.isPushDropping=!1}0===i.length&&(ni.isPushDropping=!1)},demuxM7s:function(e){const t=new DataView(e),r=t.getUint32(1,!1),i=t.getUint8(0),s=new ArrayBuffer(4),n=new Uint32Array(s);switch(i){case ne:ni.decode(new Uint8Array(e,5),{type:ne,ts:r});break;case ae:if(t.byteLength>=11){const i=new Uint8Array(e,5),s=i[0];if(ni._isEnhancedH265Header(s))ni._decodeEnhancedH265Video(i,r);else{const e=t.getUint8(5)>>4==1;if(e&&(ni.calcIframeIntervalTimestamp(r),mr(i)&&null===ni.isHevc)){const e=15&i[0];ni.isHevc=e===Pe}ni.isPlayer&&ni.calcNetworkDelay(r),n[0]=i[4],n[1]=i[3],n[2]=i[2],n[3]=0;let s=n[0],a=ni.cryptoPayload(i,e);ni.decode(a,{type:ae,ts:r,isIFrame:e,cts:s})}}else ni.debugWarn("worker",`demuxM7s() type is video and arrayBuffer length is ${e.byteLength} and return`)}},demuxNakedFlow:function(e){Gr.dispatch(e)},demuxFmp4:function(e){Wr.dispatch(e)},demuxMpeg4:function(e){ri.dispatch(e)},demuxTs:function(e){ii.dispatch(e)},_decodeEnhancedH265Video:function(e,t){const r=e[0],i=48&r,s=15&r,n=e.slice(1,5),a=new ArrayBuffer(4),o=new Uint32Array(a),d="a"==String.fromCharCode(n[0]);if(ni.isHevc=gr(d),s===Pt){if(i===zt){const r=e.slice(5);if(d);else{const i=new Uint8Array(5+r.length);i.set([28,0,0,0,0],0),i.set(r,5),br=tr(e,ni.isHevc),ni.debugLog("worker",`demuxFlv() isVideoSequenceHeader(enhancedH265) is true and isHevc is ${ni.isHevc} and nalUnitSize is ${br}`),ni.decode(i,{type:ae,ts:t,isIFrame:!0,cts:0})}}}else if(s===Mt){let r=e,s=0;const n=i===zt;n&&ni.calcIframeIntervalTimestamp(t),d||(o[0]=e[4],o[1]=e[3],o[2]=e[2],o[3]=0,s=o[0],r=Yr(e.slice(8),n),r=ni.cryptoPayload(r,n),ni.decode(r,{type:ae,ts:t,isIFrame:n,cts:s}))}else if(s===Rt){const r=i===zt;r&&ni.calcIframeIntervalTimestamp(t);let s=Yr(e.slice(5),r);s=ni.cryptoPayload(s,r),ni.decode(s,{type:ae,ts:t,isIFrame:r,cts:0})}},_isEnhancedH265Header:function(e){return(e&Ft)===Ft},findSei:function(e,t){let r=4;or(br)&&(r=br),Qt(e.slice(5),r).forEach((e=>{const r=ni.isHevc?e[0]>>>1&63:31&e[0];(ni.isHevc&&(r===ht||r===ut)||gr(ni.isHevc)&&r===Ye)&&postMessage({cmd:X,buffer:e,ts:t},[e.buffer])}))},calcNetworkDelay:function(e){if(!(we&&e>0))return;null===et?(et=e,rt=rr()):et?r-t:0;ni.networkDelay=i,i>ni._opt.networkDelay&&ni._opt.playType===y&&(ni.debugWarn("worker",`calcNetworkDelay now dts:${e}, start dts is ${et} vs start is ${t},local diff is ${r} ,delay is ${i}`),postMessage({cmd:O,type:Ce,value:i}))},calcIframeIntervalTimestamp:function(e){null===Ot?Ot=e:Ot=ni._opt.playbackForwardMaxRateDecodeIFrame&&!(ni._opt.useMSE&&ni._opt.mseDecodeAudio)},isPlayUseMSE:function(){return ni.isPlayer&&ni._opt.useMSE&&_r(r)},isPlayUseMSEAndDecoderInWorker:function(){return ni.isPlayUseMSE()&&ni._opt.mseDecoderUseWorker},isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio:function(){return ni.isPlayUseMSEAndDecoderInWorker()&&ni._opt.mseDecodeAudio},playbackUpdatePlaybackRate:function(){gr(ni.isPlaybackCacheBeforeDecodeForFpsRender())&&ni.clearBuffer(!0)},onOffscreenCanvasWebglContextLost:function(e){ni.debugError("worker","handleOffscreenCanvasWebglContextLost and next try to create webgl"),e.preventDefault(),Yt=!0,ni.webglObj.destroy(),ni.webglObj=null,ni.offscreenCanvasGL=null,setTimeout((()=>{ni.offscreenCanvasGL=ni.offscreenCanvas.getContext("webgl"),ni.offscreenCanvasGL&&ni.offscreenCanvasGL.getContextAttributes().stencil?(ni.webglObj=f(ni.offscreenCanvasGL,ni._opt.openWebglAlignment),Yt=!1):ni.debugError("worker","handleOffscreenCanvasWebglContextLost, stencil is false")}),500)},onOffscreenCanvasWebglContextRestored:function(e){ni.debugLog("worker","handleOffscreenCanvasWebglContextRestored"),e.preventDefault()},videoInfo:function(e,t,r){postMessage({cmd:P,code:e}),postMessage({cmd:k,w:t,h:r}),h=t,w=r,ni.useOffscreen()&&(ni.offscreenCanvas=new OffscreenCanvas(t,r),ni.offscreenCanvasGL=ni.offscreenCanvas.getContext("webgl"),ni.webglObj=f(ni.offscreenCanvasGL,ni._opt.openWebglAlignment),ni.offscreenCanvas.addEventListener("webglcontextlost",ni.onOffscreenCanvasWebglContextLost,!1),ni.offscreenCanvas.addEventListener("webglcontextrestored",ni.onOffscreenCanvasWebglContextRestored,!1))},audioInfo:function(e,t,r){postMessage({cmd:L,code:e}),postMessage({cmd:D,sampleRate:t,channels:r,depth:wr}),Nt=r},yuvData:function(t,r){if(ni.isDestroyed)return void ni.debugLog("worker","yuvData, decoder is destroyed and return");const i=h*w*3/2;let s=e.HEAPU8.subarray(t,t+i),n=new Uint8Array(s);if(Et=null,We=r,ni.useOffscreen())try{if(Yt)return;ni.webglObj.renderYUV(h,w,n);let e=ni.offscreenCanvas.transferToImageBitmap();postMessage({cmd:T,buffer:e,delay:ni.delay,ts:r},[e])}catch(e){ni.debugError("worker","yuvData, transferToImageBitmap error is",e,e.toString())}else postMessage({cmd:T,output:n,delay:ni.delay,ts:r},[n.buffer])},pcmData:function(e,r,i){if(ni.isDestroyed)return void ni.debugLog("worker","pcmData, decoder is destroyed and return");let n=r,a=[],o=0,d=ni._opt.audioBufferSize;for(let r=0;r<2;r++){let i=t.HEAPU32[(e>>2)+r]>>2;a[r]=t.HEAPF32.subarray(i,i+n)}if(xt){if(!(n>=(r=d-xt)))return xt+=n,s[0]=Float32Array.of(...s[0],...a[0]),void(2==Nt&&(s[1]=Float32Array.of(...s[1],...a[1])));ct[0]=Float32Array.of(...s[0],...a[0].subarray(0,r)),2==Nt&&(ct[1]=Float32Array.of(...s[1],...a[1].subarray(0,r))),postMessage({cmd:C,buffer:ct,ts:i},ct.map((e=>e.buffer))),o=r,n-=r}for(xt=n;xt>=d;xt-=d)ct[0]=a[0].slice(o,o+=d),2==Nt&&(ct[1]=a[1].slice(o-d,o)),postMessage({cmd:C,buffer:ct,ts:i},ct.map((e=>e.buffer)));xt&&(s[0]=a[0].slice(o),2==Nt&&(s[1]=a[1].slice(o))),a=[]},errorInfo:function(e){null===Et&&(Et=rr());const t=rr(),r=ir(At>0?2*At:5e3,1e3,5e3),i=t-Et;i>r&&(ni.debugWarn("worker",`errorInfo() emit simdDecodeError and\n iframeIntervalTimestamp is ${At} and diff is ${i} and maxDiff is ${r}\n and replay`),sr=!0,postMessage({cmd:j}))},sendWebsocketMessage:function(e){o?o.readyState===Ie?o.send(e):ni.debugError("worker","socket is not open"):ni.debugError("worker","socket is null")},timeEnd:function(){ni.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),ni.close(),postMessage({cmd:H})},postStreamToMain(e,t){postMessage({cmd:K,type:t,buffer:e},[e.buffer])},updatePlaybackIsPause(e){ni.debugLog("worker",`updatePlaybackIsPause, isPause is ${e}`),_r(e)?ni.clearPlaybackCacheLoop():ni.startPlaybackCacheLoop()},debugLog(e){if(ni._opt.debug&&ni.debug){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:{};var t,i,s;(s=e).ready=new Promise(((e,r)=>{t=e,i=r})),(s=void 0!==s?s:{}).locateFile=function(e){return"decoder-pro-audio.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_AUDIO_WASM_URL&&""!=JESSIBUCA_PRO_AUDIO_WASM_URL?JESSIBUCA_PRO_AUDIO_WASM_URL:e};var n,a,o,d=Object.assign({},s),l="./this.program",c="object"==typeof window,u="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";function p(e){return s.locateFile?s.locateFile(e,f):f+e}if(h){const{createRequire:e}=await import("module");var m=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-audio.js",document.baseURI).href),_=m("fs"),g=m("path");f=u?g.dirname(f)+"/":m("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-audio.js",document.baseURI).href)),n=(e,t)=>(e=J(e)?new URL(e):g.normalize(e),_.readFileSync(e,t?void 0:"utf8")),o=e=>{var t=n(e,!0);return t.buffer||(t=new Uint8Array(t)),t},a=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=J(e)?new URL(e):g.normalize(e),_.readFile(e,i?void 0:"utf8",((e,s)=>{e?r(e):t(i?s.buffer:s)}))},!s.thisProgram&&process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),s.inspect=()=>"[Emscripten Module object]"}else(c||u)&&(u?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),r&&(f=r),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",n=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},u&&(o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),a=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var y,v,b=s.print||console.log.bind(console),w=s.printErr||console.error.bind(console);Object.assign(s,d),d=null,s.arguments&&s.arguments,s.thisProgram&&(l=s.thisProgram),s.quit&&s.quit,s.wasmBinary&&(y=s.wasmBinary),"object"!=typeof WebAssembly&&j("no native wasm support detected");var S,E,A,B,U,x,k,T,C=!1;function D(e,t){e||j(t)}function L(){var e=v.buffer;s.HEAP8=S=new Int8Array(e),s.HEAP16=A=new Int16Array(e),s.HEAPU8=E=new Uint8Array(e),s.HEAPU16=B=new Uint16Array(e),s.HEAP32=U=new Int32Array(e),s.HEAPU32=x=new Uint32Array(e),s.HEAPF32=k=new Float32Array(e),s.HEAPF64=T=new Float64Array(e)}var I=[],F=[],P=[];function M(){if(s.preRun)for("function"==typeof s.preRun&&(s.preRun=[s.preRun]);s.preRun.length;)N(s.preRun.shift());se(I)}function R(){s.noFSInit||Te.init.initialized||Te.init(),Te.ignorePermissions=!1,se(F)}function z(){if(s.postRun)for("function"==typeof s.postRun&&(s.postRun=[s.postRun]);s.postRun.length;)G(s.postRun.shift());se(P)}function N(e){I.unshift(e)}function O(e){F.unshift(e)}function G(e){P.unshift(e)}var $=0,H=null;function V(e){$++,s.monitorRunDependencies&&s.monitorRunDependencies($)}function W(e){if($--,s.monitorRunDependencies&&s.monitorRunDependencies($),0==$&&H){var t=H;H=null,t()}}function j(e){s.onAbort&&s.onAbort(e),w(e="Aborted("+e+")"),C=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}var q,Y,K,X="data:application/octet-stream;base64,",Z=e=>e.startsWith(X),J=e=>e.startsWith("file://");function Q(e){if(e==q&&y)return new Uint8Array(y);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}function ee(e){if(!y&&(c||u)){if("function"==typeof fetch&&!J(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>Q(e)));if(a)return new Promise(((t,r)=>{a(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>Q(e)))}function te(e,t,r){return ee(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{w(`failed to asynchronously prepare wasm: ${e}`),j(e)}))}function re(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||Z(t)||J(t)||h||"function"!=typeof fetch?te(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return w(`wasm streaming compile failed: ${e}`),w("falling back to ArrayBuffer instantiation"),te(t,r,i)}))))}function ie(){var e={a:si};function t(e,t){return ni=e.exports,v=ni.E,L(),It=ni.H,O(ni.F),W(),ni}if(V(),s.instantiateWasm)try{return s.instantiateWasm(e,t)}catch(e){w(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return re(y,q,e,(function(e){t(e.instance)})).catch(i),{}}s.locateFile?Z(q="decoder-pro-audio.wasm")||(q=p(q)):q=new URL("decoder-pro-audio.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-audio.js",document.baseURI).href).href;var se=e=>{for(;e.length>0;)e.shift()(s)};function ne(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){x[this.ptr+4>>2]=e},this.get_type=function(){return x[this.ptr+4>>2]},this.set_destructor=function(e){x[this.ptr+8>>2]=e},this.get_destructor=function(){return x[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,S[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=S[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,S[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=S[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){x[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return x[this.ptr+16>>2]},this.get_exception_ptr=function(){if(ci(this.get_type()))return x[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}s.noExitRuntime;var ae=(e,t,r)=>{throw new ne(e).init(t,r),e},oe=e=>(U[oi()>>2]=e,e),de={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var s=e[i];"."===s?e.splice(i,1):".."===s?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=de.isAbs(e),r="/"===e.substr(-1);return(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=de.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=de.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return de.normalize(e.join("/"))},join2:(e,t)=>de.normalize(e+"/"+t)},le=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}j("initRandomDevice")},ce=e=>(ce=le())(e),ue={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:Te.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=de.isAbs(i)}return(t?"/":"")+(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=ue.resolve(e).substr(1),t=ue.resolve(t).substr(1);for(var i=r(e.split("/")),s=r(t.split("/")),n=Math.min(i.length,s.length),a=n,o=0;o{for(var i=t+r,s=t;e[s]&&!(s>=i);)++s;if(s-t>16&&e.buffer&&he)return he.decode(e.subarray(t,s));for(var n="";t>10,56320|1023&l)}}else n+=String.fromCharCode((31&a)<<6|o)}else n+=String.fromCharCode(a)}return n},pe=[],me=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},_e=(e,t,r,i)=>{if(!(i>0))return 0;for(var s=r,n=r+i-1,a=0;a=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a)),o<=127){if(r>=n)break;t[r++]=o}else if(o<=2047){if(r+1>=n)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=n)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=n)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o}}return t[r]=0,r-s};function ge(e,t,r){var i=r>0?r:me(e)+1,s=new Array(i),n=_e(e,s,0,s.length);return t&&(s.length=n),s}var ye=()=>{if(!pe.length){var e=null;if(h){var t=Buffer.alloc(256),r=0,i=process.stdin.fd;try{r=_.readSync(i,t)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}e=r>0?t.slice(0,r).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;pe=ge(e,!0)}return pe.shift()},ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},Te.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new Te.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,i,s){if(!e.tty||!e.tty.ops.get_char)throw new Te.ErrnoError(60);for(var n=0,a=0;aye(),put_char(e,t){null===t||10===t?(b(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(b(fe(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(w(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(w(fe(e.output,0)),e.output=[])}}},be=e=>{j()},we={ops_table:null,mount:e=>we.createNode(null,"/",16895,0),createNode(e,t,r,i){if(Te.isBlkdev(r)||Te.isFIFO(r))throw new Te.ErrnoError(63);we.ops_table||(we.ops_table={dir:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,lookup:we.node_ops.lookup,mknod:we.node_ops.mknod,rename:we.node_ops.rename,unlink:we.node_ops.unlink,rmdir:we.node_ops.rmdir,readdir:we.node_ops.readdir,symlink:we.node_ops.symlink},stream:{llseek:we.stream_ops.llseek}},file:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:{llseek:we.stream_ops.llseek,read:we.stream_ops.read,write:we.stream_ops.write,allocate:we.stream_ops.allocate,mmap:we.stream_ops.mmap,msync:we.stream_ops.msync}},link:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,readlink:we.node_ops.readlink},stream:{}},chrdev:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:Te.chrdev_stream_ops}});var s=Te.createNode(e,t,r,i);return Te.isDir(s.mode)?(s.node_ops=we.ops_table.dir.node,s.stream_ops=we.ops_table.dir.stream,s.contents={}):Te.isFile(s.mode)?(s.node_ops=we.ops_table.file.node,s.stream_ops=we.ops_table.file.stream,s.usedBytes=0,s.contents=null):Te.isLink(s.mode)?(s.node_ops=we.ops_table.link.node,s.stream_ops=we.ops_table.link.stream):Te.isChrdev(s.mode)&&(s.node_ops=we.ops_table.chrdev.node,s.stream_ops=we.ops_table.chrdev.stream),s.timestamp=Date.now(),e&&(e.contents[t]=s,e.timestamp=s.timestamp),s},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Te.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,Te.isDir(e.mode)?t.size=4096:Te.isFile(e.mode)?t.size=e.usedBytes:Te.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&we.resizeFileStorage(e,t.size)},lookup(e,t){throw Te.genericErrors[44]},mknod:(e,t,r,i)=>we.createNode(e,t,r,i),rename(e,t,r){if(Te.isDir(e.mode)){var i;try{i=Te.lookupNode(t,r)}catch(e){}if(i)for(var s in i.contents)throw new Te.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=Te.lookupNode(e,t);for(var i in r.contents)throw new Te.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink(e,t,r){var i=we.createNode(e,t,41471,0);return i.link=r,i},readlink(e){if(!Te.isLink(e.mode))throw new Te.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,i,s){var n=e.node.contents;if(s>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-s,i);if(a>8&&n.subarray)t.set(n.subarray(s,s+a),r);else for(var o=0;o0||r+t(we.stream_ops.write(e,t,0,i,r,!1),0)}},Se=(e,t,r,i)=>{var s=i?"":`al ${e}`;a(e,(r=>{D(r,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(r)),s&&W()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),s&&V()},Ee=(e,t,r,i,s,n)=>{Te.createDataFile(e,t,r,i,s,n)},Ae=s.preloadPlugins||[],Be=(e,t,r,i)=>{"undefined"!=typeof Browser&&Browser.init();var s=!1;return Ae.forEach((n=>{s||n.canHandle(t)&&(n.handle(e,t,r,i),s=!0)})),s},Ue=(e,t,r,i,s,n,a,o,d,l)=>{var c=t?ue.resolve(de.join2(e,t)):e;function u(r){function u(r){l&&l(),o||Ee(e,t,r,i,s,d),n&&n(),W()}Be(r,c,u,(()=>{a&&a(),W()}))||u(r)}V(),"string"==typeof r?Se(r,(e=>u(e)),a):u(r)},xe=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t},ke=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Te={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=ue.resolve(e)))return{path:"",node:null};if(t=Object.assign({follow_mount:!0,recurse_count:0},t),t.recurse_count>8)throw new Te.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),i=Te.root,s="/",n=0;n40)throw new Te.ErrnoError(32)}}return{path:s,node:i}},getPath(e){for(var t;;){if(Te.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,i=0;i>>0)%Te.nameTable.length},hashAddNode(e){var t=Te.hashName(e.parent.id,e.name);e.name_next=Te.nameTable[t],Te.nameTable[t]=e},hashRemoveNode(e){var t=Te.hashName(e.parent.id,e.name);if(Te.nameTable[t]===e)Te.nameTable[t]=e.name_next;else for(var r=Te.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=Te.mayLookup(e);if(r)throw new Te.ErrnoError(r,e);for(var i=Te.hashName(e.id,t),s=Te.nameTable[i];s;s=s.name_next){var n=s.name;if(s.parent.id===e.id&&n===t)return s}return Te.lookup(e,t)},createNode(e,t,r,i){var s=new Te.FSNode(e,t,r,i);return Te.hashAddNode(s),s},destroyNode(e){Te.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>Te.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){var t=Te.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{return Te.lookupNode(e,t),20}catch(e){}return Te.nodePermissions(e,"wx")},mayDelete(e,t,r){var i;try{i=Te.lookupNode(e,t)}catch(e){return e.errno}var s=Te.nodePermissions(e,"wx");if(s)return s;if(r){if(!Te.isDir(i.mode))return 54;if(Te.isRoot(i)||Te.getPath(i)===Te.cwd())return 10}else if(Te.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?Te.isLink(e.mode)?32:Te.isDir(e.mode)&&("r"!==Te.flagsToPermissionString(t)||512&t)?31:Te.nodePermissions(e,Te.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Te.MAX_OPEN_FDS;e++)if(!Te.streams[e])return e;throw new Te.ErrnoError(33)},getStreamChecked(e){var t=Te.getStream(e);if(!t)throw new Te.ErrnoError(8);return t},getStream:e=>Te.streams[e],createStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return Te.FSStream||(Te.FSStream=function(){this.shared={}},Te.FSStream.prototype={},Object.defineProperties(Te.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},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(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new Te.FSStream,e),-1==t&&(t=Te.nextfd()),e.fd=t,Te.streams[t]=e,e},closeStream(e){Te.streams[e]=null},chrdev_stream_ops:{open(e){var t=Te.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek(){throw new Te.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Te.devices[e]={stream_ops:t}},getDevice:e=>Te.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),Te.syncFSRequests++,Te.syncFSRequests>1&&w(`warning: ${Te.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Te.getMounts(Te.root.mount),i=0;function s(e){return Te.syncFSRequests--,t(e)}function n(e){if(e)return n.errored?void 0:(n.errored=!0,s(e));++i>=r.length&&s(null)}r.forEach((t=>{if(!t.type.syncfs)return n(null);t.type.syncfs(t,e,n)}))},mount(e,t,r){var i,s="/"===r,n=!r;if(s&&Te.root)throw new Te.ErrnoError(10);if(!s&&!n){var a=Te.lookupPath(r,{follow_mount:!1});if(r=a.path,i=a.node,Te.isMountpoint(i))throw new Te.ErrnoError(10);if(!Te.isDir(i.mode))throw new Te.ErrnoError(54)}var o={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(o);return d.mount=o,o.root=d,s?Te.root=d:i&&(i.mounted=o,i.mount&&i.mount.mounts.push(o)),d},unmount(e){var t=Te.lookupPath(e,{follow_mount:!1});if(!Te.isMountpoint(t.node))throw new Te.ErrnoError(28);var r=t.node,i=r.mounted,s=Te.getMounts(i);Object.keys(Te.nameTable).forEach((e=>{for(var t=Te.nameTable[e];t;){var r=t.name_next;s.includes(t.mount)&&Te.destroyNode(t),t=r}})),r.mounted=null;var n=r.mount.mounts.indexOf(i);r.mount.mounts.splice(n,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var i=Te.lookupPath(e,{parent:!0}).node,s=de.basename(e);if(!s||"."===s||".."===s)throw new Te.ErrnoError(28);var n=Te.mayCreate(i,s);if(n)throw new Te.ErrnoError(n);if(!i.node_ops.mknod)throw new Te.ErrnoError(63);return i.node_ops.mknod(i,s,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,Te.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,Te.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),i="",s=0;s(void 0===r&&(r=t,t=438),t|=8192,Te.mknod(e,t,r)),symlink(e,t){if(!ue.resolve(e))throw new Te.ErrnoError(44);var r=Te.lookupPath(t,{parent:!0}).node;if(!r)throw new Te.ErrnoError(44);var i=de.basename(t),s=Te.mayCreate(r,i);if(s)throw new Te.ErrnoError(s);if(!r.node_ops.symlink)throw new Te.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename(e,t){var r,i,s=de.dirname(e),n=de.dirname(t),a=de.basename(e),o=de.basename(t);if(r=Te.lookupPath(e,{parent:!0}).node,i=Te.lookupPath(t,{parent:!0}).node,!r||!i)throw new Te.ErrnoError(44);if(r.mount!==i.mount)throw new Te.ErrnoError(75);var d,l=Te.lookupNode(r,a),c=ue.relative(e,n);if("."!==c.charAt(0))throw new Te.ErrnoError(28);if("."!==(c=ue.relative(t,s)).charAt(0))throw new Te.ErrnoError(55);try{d=Te.lookupNode(i,o)}catch(e){}if(l!==d){var u=Te.isDir(l.mode),h=Te.mayDelete(r,a,u);if(h)throw new Te.ErrnoError(h);if(h=d?Te.mayDelete(i,o,u):Te.mayCreate(i,o))throw new Te.ErrnoError(h);if(!r.node_ops.rename)throw new Te.ErrnoError(63);if(Te.isMountpoint(l)||d&&Te.isMountpoint(d))throw new Te.ErrnoError(10);if(i!==r&&(h=Te.nodePermissions(r,"w")))throw new Te.ErrnoError(h);Te.hashRemoveNode(l);try{r.node_ops.rename(l,i,o)}catch(e){throw e}finally{Te.hashAddNode(l)}}},rmdir(e){var t=Te.lookupPath(e,{parent:!0}).node,r=de.basename(e),i=Te.lookupNode(t,r),s=Te.mayDelete(t,r,!0);if(s)throw new Te.ErrnoError(s);if(!t.node_ops.rmdir)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.rmdir(t,r),Te.destroyNode(i)},readdir(e){var t=Te.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new Te.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=Te.lookupPath(e,{parent:!0}).node;if(!t)throw new Te.ErrnoError(44);var r=de.basename(e),i=Te.lookupNode(t,r),s=Te.mayDelete(t,r,!1);if(s)throw new Te.ErrnoError(s);if(!t.node_ops.unlink)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.unlink(t,r),Te.destroyNode(i)},readlink(e){var t=Te.lookupPath(e).node;if(!t)throw new Te.ErrnoError(44);if(!t.node_ops.readlink)throw new Te.ErrnoError(28);return ue.resolve(Te.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=Te.lookupPath(e,{follow:!t}).node;if(!r)throw new Te.ErrnoError(44);if(!r.node_ops.getattr)throw new Te.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>Te.stat(e,!0),chmod(e,t,r){var i;if(!(i="string"==typeof e?Te.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new Te.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod(e,t){Te.chmod(e,t,!0)},fchmod(e,t){var r=Te.getStreamChecked(e);Te.chmod(r.node,t)},chown(e,t,r,i){var s;if(!(s="string"==typeof e?Te.lookupPath(e,{follow:!i}).node:e).node_ops.setattr)throw new Te.ErrnoError(63);s.node_ops.setattr(s,{timestamp:Date.now()})},lchown(e,t,r){Te.chown(e,t,r,!0)},fchown(e,t,r){var i=Te.getStreamChecked(e);Te.chown(i.node,t,r)},truncate(e,t){if(t<0)throw new Te.ErrnoError(28);var r;if(!(r="string"==typeof e?Te.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new Te.ErrnoError(63);if(Te.isDir(r.mode))throw new Te.ErrnoError(31);if(!Te.isFile(r.mode))throw new Te.ErrnoError(28);var i=Te.nodePermissions(r,"w");if(i)throw new Te.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=Te.getStreamChecked(e);if(0==(2097155&r.flags))throw new Te.ErrnoError(28);Te.truncate(r.node,t)},utime(e,t,r){var i=Te.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new Te.ErrnoError(44);var i;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?xe(t):t)?4095&r|32768:0,"object"==typeof e)i=e;else{e=de.normalize(e);try{i=Te.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var n=!1;if(64&t)if(i){if(128&t)throw new Te.ErrnoError(20)}else i=Te.mknod(e,r,0),n=!0;if(!i)throw new Te.ErrnoError(44);if(Te.isChrdev(i.mode)&&(t&=-513),65536&t&&!Te.isDir(i.mode))throw new Te.ErrnoError(54);if(!n){var a=Te.mayOpen(i,t);if(a)throw new Te.ErrnoError(a)}512&t&&!n&&Te.truncate(i,0),t&=-131713;var o=Te.createStream({node:i,path:Te.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return o.stream_ops.open&&o.stream_ops.open(o),!s.logReadFiles||1&t||(Te.readFiles||(Te.readFiles={}),e in Te.readFiles||(Te.readFiles[e]=1)),o},close(e){if(Te.isClosed(e))throw new Te.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Te.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Te.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Te.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,i,s){if(i<0||s<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(1==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.read)throw new Te.ErrnoError(28);var n=void 0!==s;if(n){if(!e.seekable)throw new Te.ErrnoError(70)}else s=e.position;var a=e.stream_ops.read(e,t,r,i,s);return n||(e.position+=a),a},write(e,t,r,i,s,n){if(i<0||s<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.write)throw new Te.ErrnoError(28);e.seekable&&1024&e.flags&&Te.llseek(e,0,2);var a=void 0!==s;if(a){if(!e.seekable)throw new Te.ErrnoError(70)}else s=e.position;var o=e.stream_ops.write(e,t,r,i,s,n);return a||(e.position+=o),o},allocate(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(t<0||r<=0)throw new Te.ErrnoError(28);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(!Te.isFile(e.node.mode)&&!Te.isDir(e.node.mode))throw new Te.ErrnoError(43);if(!e.stream_ops.allocate)throw new Te.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,i,s){if(0!=(2&i)&&0==(2&s)&&2!=(2097155&e.flags))throw new Te.ErrnoError(2);if(1==(2097155&e.flags))throw new Te.ErrnoError(2);if(!e.stream_ops.mmap)throw new Te.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,s)},msync:(e,t,r,i,s)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,s):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new Te.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,i=Te.open(e,t.flags),s=Te.stat(e).size,n=new Uint8Array(s);return Te.read(i,n,0,s,0),"utf8"===t.encoding?r=fe(n,0):"binary"===t.encoding&&(r=n),Te.close(i),r},writeFile(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=Te.open(e,r.flags,r.mode);if("string"==typeof t){var s=new Uint8Array(me(t)+1),n=_e(t,s,0,s.length);Te.write(i,s,0,n,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");Te.write(i,t,0,t.byteLength,void 0,r.canOwn)}Te.close(i)},cwd:()=>Te.currentPath,chdir(e){var t=Te.lookupPath(e,{follow:!0});if(null===t.node)throw new Te.ErrnoError(44);if(!Te.isDir(t.node.mode))throw new Te.ErrnoError(54);var r=Te.nodePermissions(t.node,"x");if(r)throw new Te.ErrnoError(r);Te.currentPath=t.path},createDefaultDirectories(){Te.mkdir("/tmp"),Te.mkdir("/home"),Te.mkdir("/home/web_user")},createDefaultDevices(){Te.mkdir("/dev"),Te.registerDevice(Te.makedev(1,3),{read:()=>0,write:(e,t,r,i,s)=>i}),Te.mkdev("/dev/null",Te.makedev(1,3)),ve.register(Te.makedev(5,0),ve.default_tty_ops),ve.register(Te.makedev(6,0),ve.default_tty1_ops),Te.mkdev("/dev/tty",Te.makedev(5,0)),Te.mkdev("/dev/tty1",Te.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=ce(e).byteLength),e[--t]);Te.createDevice("/dev","random",r),Te.createDevice("/dev","urandom",r),Te.mkdir("/dev/shm"),Te.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Te.mkdir("/proc");var e=Te.mkdir("/proc/self");Te.mkdir("/proc/self/fd"),Te.mount({mount(){var t=Te.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,i=Te.getStreamChecked(r),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return s.parent=s,s}},t}},{},"/proc/self/fd")},createStandardStreams(){s.stdin?Te.createDevice("/dev","stdin",s.stdin):Te.symlink("/dev/tty","/dev/stdin"),s.stdout?Te.createDevice("/dev","stdout",null,s.stdout):Te.symlink("/dev/tty","/dev/stdout"),s.stderr?Te.createDevice("/dev","stderr",null,s.stderr):Te.symlink("/dev/tty1","/dev/stderr"),Te.open("/dev/stdin",0),Te.open("/dev/stdout",1),Te.open("/dev/stderr",1)},ensureErrnoError(){Te.ErrnoError||(Te.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},Te.ErrnoError.prototype=new Error,Te.ErrnoError.prototype.constructor=Te.ErrnoError,[44].forEach((e=>{Te.genericErrors[e]=new Te.ErrnoError(e),Te.genericErrors[e].stack=""})))},staticInit(){Te.ensureErrnoError(),Te.nameTable=new Array(4096),Te.mount(we,{},"/"),Te.createDefaultDirectories(),Te.createDefaultDevices(),Te.createSpecialDirectories(),Te.filesystems={MEMFS:we}},init(e,t,r){Te.init.initialized=!0,Te.ensureErrnoError(),s.stdin=e||s.stdin,s.stdout=t||s.stdout,s.stderr=r||s.stderr,Te.createStandardStreams()},quit(){Te.init.initialized=!1;for(var e=0;ethis.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},n.prototype.setDataGetter=function(e){this.getter=e},n.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),s=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,n=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,a=1048576;s||(a=i);var o=this;o.setDataGetter((e=>{var t=e*a,s=(e+1)*a-1;if(s=Math.min(s,i-1),void 0===o.chunks[e]&&(o.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var s=new XMLHttpRequest;if(s.open("GET",r,!1),i!==a&&s.setRequestHeader("Range","bytes="+e+"-"+t),s.responseType="arraybuffer",s.overrideMimeType&&s.overrideMimeType("text/plain; charset=x-user-defined"),s.send(null),!(s.status>=200&&s.status<300||304===s.status))throw new Error("Couldn't load "+r+". Status: "+s.status);return void 0!==s.response?new Uint8Array(s.response||[]):ge(s.responseText||"",!0)})(t,s)),void 0===o.chunks[e])throw new Error("doXHR failed!");return o.chunks[e]})),!n&&i||(a=i=1,i=this.getter(0).length,a=i,b("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!u)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new n;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var o={isDevice:!1,contents:a}}else o={isDevice:!1,url:r};var d=Te.createFile(e,t,o,i,s);o.contents?d.contents=o.contents:o.url&&(d.contents=null,d.url=o.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,t,r,i,s){var n=e.node.contents;if(s>=n.length)return 0;var a=Math.min(n.length-s,i);if(n.slice)for(var o=0;o{var t=d.stream_ops[e];l[e]=function(){return Te.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,s)=>(Te.forceLoadFile(d),c(e,t,r,i,s)),l.mmap=(e,t,r,i,s)=>{Te.forceLoadFile(d);var n=be();if(!n)throw new Te.ErrnoError(48);return c(e,S,n,t,r),{ptr:n,allocated:!0}},d.stream_ops=l,d}},Ce=(e,t)=>e?fe(E,e,t):"",De={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(de.isAbs(t))return t;var i;if(i=-100===e?Te.cwd():De.getStreamFromFD(e).path,0==t.length){if(!r)throw new Te.ErrnoError(44);return i}return de.join2(i,t)},doStat(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&de.normalize(t)!==de.normalize(Te.getPath(e.node)))return-54;throw e}U[r>>2]=i.dev,U[r+4>>2]=i.mode,x[r+8>>2]=i.nlink,U[r+12>>2]=i.uid,U[r+16>>2]=i.gid,U[r+20>>2]=i.rdev,K=[i.size>>>0,(Y=i.size,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+24>>2]=K[0],U[r+28>>2]=K[1],U[r+32>>2]=4096,U[r+36>>2]=i.blocks;var s=i.atime.getTime(),n=i.mtime.getTime(),a=i.ctime.getTime();return K=[Math.floor(s/1e3)>>>0,(Y=Math.floor(s/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+40>>2]=K[0],U[r+44>>2]=K[1],x[r+48>>2]=s%1e3*1e3,K=[Math.floor(n/1e3)>>>0,(Y=Math.floor(n/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+56>>2]=K[0],U[r+60>>2]=K[1],x[r+64>>2]=n%1e3*1e3,K=[Math.floor(a/1e3)>>>0,(Y=Math.floor(a/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+72>>2]=K[0],U[r+76>>2]=K[1],x[r+80>>2]=a%1e3*1e3,K=[i.ino>>>0,(Y=i.ino,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+88>>2]=K[0],U[r+92>>2]=K[1],0},doMsync(e,t,r,i,s){if(!Te.isFile(t.node.mode))throw new Te.ErrnoError(43);if(2&i)return 0;var n=E.slice(e,e+r);Te.msync(t,n,s,r,i)},varargs:void 0,get(){var e=U[+De.varargs>>2];return De.varargs+=4,e},getp:()=>De.get(),getStr:e=>Ce(e),getStreamFromFD:e=>Te.getStreamChecked(e)};function Le(e,t,r){De.varargs=r;try{var i=De.getStreamFromFD(e);switch(t){case 0:if((s=De.get())<0)return-28;for(;Te.streams[s];)s++;return Te.createStream(i,s).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var s=De.get();return i.flags|=s,0;case 5:return s=De.getp(),A[s+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return oe(28),-1}}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}function Ie(e,t,r,i){De.varargs=i;try{t=De.getStr(t),t=De.calculateAt(e,t);var s=i?De.get():0;return Te.open(t,r,s).fd}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}var Fe,Pe,Me,Re=(e,t,r,i,s)=>{},ze=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Fe=e},Ne=e=>{for(var t="",r=e;E[r];)t+=Fe[E[r++]];return t},Oe={},Ge={},$e={},He=e=>{throw new Pe(e)},Ve=e=>{throw new Me(e)},We=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&Ve("Mismatched type converter count");for(var s=0;s{Ge.hasOwnProperty(e)?s[t]=Ge[e]:(n.push(e),Oe.hasOwnProperty(e)||(Oe[e]=[]),Oe[e].push((()=>{s[t]=Ge[e],++a===n.length&&i(s)})))})),0===n.length&&i(s)};function je(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||He(`type "${i}" must have a positive integer typeid pointer`),Ge.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;He(`Cannot register type '${i}' twice`)}if(Ge[e]=t,delete $e[e],Oe.hasOwnProperty(e)){var s=Oe[e];delete Oe[e],s.forEach((e=>e()))}}function qe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return je(e,t,r)}var Ye,Ke=8,Xe=(e,t,r,i)=>{qe(e,{name:t=Ne(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:Ke,readValueFromPointer:function(e){return this.fromWireType(E[e])},destructorFunction:null})},Ze=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Je=e=>{He(e.$$.ptrType.registeredClass.name+" instance already deleted")},Qe=!1,et=e=>{},tt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},rt=e=>{e.count.value-=1,0===e.count.value&&tt(e)},it=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=it(e,t,r.baseClass);return null===i?null:r.downcast(i)},st={},nt=()=>Object.keys(ut).length,at=()=>{var e=[];for(var t in ut)ut.hasOwnProperty(t)&&e.push(ut[t]);return e},ot=[],dt=()=>{for(;ot.length;){var e=ot.pop();e.$$.deleteScheduled=!1,e.delete()}},lt=e=>{Ye=e,ot.length&&Ye&&Ye(dt)},ct=()=>{s.getInheritedInstanceCount=nt,s.getLiveInheritedInstances=at,s.flushPendingDeletes=dt,s.setDelayFunction=lt},ut={},ht=(e,t)=>{for(void 0===t&&He("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},ft=(e,t)=>(t=ht(e,t),ut[t]),pt=(e,t)=>(t.ptrType&&t.ptr||Ve("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&Ve("Both smartPtrType and smartPtr must be specified"),t.count={value:1},_t(Object.create(e,{$$:{value:t}})));function mt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ft(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function s(){return this.isSmartPointer?pt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):pt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var n,a=this.registeredClass.getActualType(t),o=st[a];if(!o)return s.call(this);n=this.isConst?o.constPointerType:o.pointerType;var d=it(t,this.registeredClass,n.registeredClass);return null===d?s.call(this):this.isSmartPointer?pt(n.registeredClass.instancePrototype,{ptrType:n,ptr:d,smartPtrType:this,smartPtr:e}):pt(n.registeredClass.instancePrototype,{ptrType:n,ptr:d})}var _t=e=>"undefined"==typeof FinalizationRegistry?(_t=e=>e,e):(Qe=new FinalizationRegistry((e=>{rt(e.$$)})),_t=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};Qe.register(e,r,e)}return e},et=e=>Qe.unregister(e),_t(e)),gt=()=>{Object.assign(yt.prototype,{isAliasOf(e){if(!(this instanceof yt))return!1;if(!(e instanceof yt))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,s=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)s=i.upcast(s),i=i.baseClass;return t===i&&r===s},clone(){if(this.$$.ptr||Je(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=_t(Object.create(Object.getPrototypeOf(this),{$$:{value:Ze(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),et(this),rt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),ot.push(this),1===ot.length&&Ye&&Ye(dt),this.$$.deleteScheduled=!0,this}})};function yt(){}var vt=(e,t)=>Object.defineProperty(t,"name",{value:e}),bt=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||He(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},wt=(e,t,r)=>{s.hasOwnProperty(e)?((void 0===r||void 0!==s[e].overloadTable&&void 0!==s[e].overloadTable[r])&&He(`Cannot register public name '${e}' twice`),bt(s,e,e),s.hasOwnProperty(r)&&He(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),s[e].overloadTable[r]=t):(s[e]=t,void 0!==r&&(s[e].numArguments=r))},St=48,Et=57,At=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=St&&t<=Et?`_${e}`:e};function Bt(e,t,r,i,s,n,a,o){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=s,this.getActualType=n,this.upcast=a,this.downcast=o,this.pureVirtualFunctions=[]}var Ut=(e,t,r)=>{for(;t!==r;)t.upcast||He(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function xt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ut(t.$$.ptr,r,this.registeredClass)}function kt(e,t){var r;if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=Ut(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&He("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var s=t.clone();r=this.rawShare(r,nr.toHandle((()=>s.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:He("Unsupporting sharing policy")}return r}function Tt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ut(t.$$.ptr,r,this.registeredClass)}function Ct(e){return this.fromWireType(x[e>>2])}var Dt=()=>{Object.assign(Lt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:Ke,readValueFromPointer:Ct,deleteObject(e){null!==e&&e.delete()},fromWireType:mt})};function Lt(e,t,r,i,s,n,a,o,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=s,this.pointeeType=n,this.sharingPolicy=a,this.rawGetPointee=o,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,s||void 0!==t.baseClass?this.toWireType=kt:i?(this.toWireType=xt,this.destructorFunction=null):(this.toWireType=Tt,this.destructorFunction=null)}var It,Ft,Pt=(e,t,r)=>{s.hasOwnProperty(e)||Ve("Replacing nonexistant public symbol"),void 0!==s[e].overloadTable&&void 0!==r?s[e].overloadTable[r]=t:(s[e]=t,s[e].argCount=r)},Mt=(e,t,r)=>{var i=s["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},Rt=[],zt=e=>{var t=Rt[e];return t||(e>=Rt.length&&(Rt.length=e+1),Rt[e]=t=It.get(e)),t},Nt=(e,t,r)=>e.includes("j")?Mt(e,t,r):zt(t).apply(null,r),Ot=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),Nt(e,t,r)}},Gt=(e,t)=>{var r=(e=Ne(e)).includes("j")?Ot(e,t):zt(t);return"function"!=typeof r&&He(`unknown function pointer with signature ${e}: ${t}`),r},$t=(e,t)=>{var r=vt(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},Ht=e=>{var t=di(e),r=Ne(t);return ai(t),r},Vt=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Ge[t]||($e[t]?$e[t].forEach(e):(r.push(t),i[t]=!0))})),new Ft(`${e}: `+r.map(Ht).join([", "]))},Wt=(e,t,r,i,s,n,a,o,d,l,c,u,h)=>{c=Ne(c),n=Gt(s,n),o&&(o=Gt(a,o)),l&&(l=Gt(d,l)),h=Gt(u,h);var f=At(c);wt(f,(function(){Vt(`Cannot construct ${c} due to unbound types`,[i])})),We([e,t,r],i?[i]:[],(function(t){var r,s;t=t[0],s=i?(r=t.registeredClass).instancePrototype:yt.prototype;var a=vt(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new Pe("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new Pe(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new Pe(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(s,{constructor:{value:a}});a.prototype=d;var u=new Bt(c,a,d,h,r,n,o,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new Lt(c,u,!0,!1,!1),m=new Lt(c+"*",u,!1,!1,!1),_=new Lt(c+" const*",u,!1,!0,!1);return st[e]={pointerType:m,constPointerType:_},Pt(f,a),[p,m,_]}))},jt=(e,t)=>{for(var r=[],i=0;i>2]);return r},qt=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Yt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=vt(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,s=e.apply(i,t);return s instanceof Object?s:i}function Kt(e,t,r,i,s,n){var a=t.length;a<2&&He("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||n?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=o?1:2;l{var a=jt(t,r);s=Gt(i,s),We([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Pe(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Vt(`Cannot construct ${e.name} due to unbound types`,a)},We([],a,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Kt(r,i,null,s,n),[]))),[]}))},Zt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Jt=(e,t,r,i,s,n,a,o,d)=>{var l=jt(r,i);t=Ne(t),t=Zt(t),n=Gt(s,n),We([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function s(){Vt(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(s.argCount=r-2,s.className=e.name,c[t]=s):(bt(c,t,i),c[t].overloadTable[r-2]=s),We([],l,(function(s){var o=Kt(i,s,e,n,a,d);return void 0===c[t].overloadTable?(o.argCount=r-2,c[t]=o):c[t].overloadTable[r-2]=o,[]})),[]}))};function Qt(){Object.assign(er.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function er(){this.allocated=[void 0],this.freelist=[]}var tr=new er,rr=e=>{e>=tr.reserved&&0==--tr.get(e).refcount&&tr.free(e)},ir=()=>{for(var e=0,t=tr.reserved;t{tr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),tr.reserved=tr.allocated.length,s.count_emval_handles=ir},nr={toValue:e=>(e||He("Cannot use deleted val. handle = "+e),tr.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return tr.allocate({refcount:1,value:e})}}};function ar(e){return this.fromWireType(U[e>>2])}var or=(e,t)=>{qe(e,{name:t=Ne(t),fromWireType:e=>{var t=nr.toValue(e);return rr(e),t},toWireType:(e,t)=>nr.toHandle(t),argPackAdvance:Ke,readValueFromPointer:ar,destructorFunction:null})},dr=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},lr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(k[e>>2])};case 8:return function(e){return this.fromWireType(T[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},cr=(e,t,r)=>{qe(e,{name:t=Ne(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Ke,readValueFromPointer:lr(t,r),destructorFunction:null})},ur=(e,t,r)=>{switch(t){case 1:return r?e=>S[e>>0]:e=>E[e>>0];case 2:return r?e=>A[e>>1]:e=>B[e>>1];case 4:return r?e=>U[e>>2]:e=>x[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},hr=(e,t,r,i,s)=>{t=Ne(t);var n=e=>e;if(0===i){var a=32-8*r;n=e=>e<>>a}var o=t.includes("unsigned");qe(e,{name:t,fromWireType:n,toWireType:o?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:Ke,readValueFromPointer:ur(t,r,0!==i),destructorFunction:null})},fr=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function s(e){var t=x[e>>2],r=x[e+4>>2];return new i(S.buffer,r,t)}qe(e,{name:r=Ne(r),fromWireType:s,argPackAdvance:Ke,readValueFromPointer:s},{ignoreDuplicateRegistrations:!0})},pr=(e,t,r)=>_e(e,E,t,r),mr=(e,t)=>{var r="std::string"===(t=Ne(t));qe(e,{name:t,fromWireType(e){var t,i=x[e>>2],s=e+4;if(r)for(var n=s,a=0;a<=i;++a){var o=s+a;if(a==i||0==E[o]){var d=Ce(n,o-n);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),n=o+1}}else{var l=new Array(i);for(a=0;a>2]=i,r&&s)pr(t,a,i+1);else if(s)for(var o=0;o255&&(ai(a),He("String has UTF-16 code units that do not fit in 8 bits")),E[a+o]=d}else for(o=0;o{for(var r=e,i=r>>1,s=i+t/2;!(i>=s)&&B[i];)++i;if((r=i<<1)-e>32&&_r)return _r.decode(E.subarray(e,r));for(var n="",a=0;!(a>=t/2);++a){var o=A[e+2*a>>1];if(0==o)break;n+=String.fromCharCode(o)}return n},yr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,s=(r-=2)<2*e.length?r/2:e.length,n=0;n>1]=a,t+=2}return A[t>>1]=0,t-i},vr=e=>2*e.length,br=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var s=U[e+4*r>>2];if(0==s)break;if(++r,s>=65536){var n=s-65536;i+=String.fromCharCode(55296|n>>10,56320|1023&n)}else i+=String.fromCharCode(s)}return i},wr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,s=i+r-4,n=0;n=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++n)),U[t>>2]=a,(t+=4)+4>s)break}return U[t>>2]=0,t-i},Sr=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},Er=(e,t,r)=>{var i,s,n,a,o;r=Ne(r),2===t?(i=gr,s=yr,a=vr,n=()=>B,o=1):4===t&&(i=br,s=wr,a=Sr,n=()=>x,o=2),qe(e,{name:r,fromWireType:e=>{for(var r,s=x[e>>2],a=n(),d=e+4,l=0;l<=s;++l){var c=e+4+l*t;if(l==s||0==a[c>>o]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return ai(e),r},toWireType:(e,i)=>{"string"!=typeof i&&He(`Cannot pass non-string to C++ string type ${r}`);var n=a(i),d=li(4+n+t);return x[d>>2]=n>>o,s(i,d+4,n+t),null!==e&&e.push(ai,d),d},argPackAdvance:Ke,readValueFromPointer:ar,destructorFunction(e){ai(e)}})},Ar=(e,t)=>{qe(e,{isVoid:!0,name:t=Ne(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},Br={},Ur=e=>{var t=Br[e];return void 0===t?Ne(e):t},xr=[],kr=(e,t,r,i,s)=>(e=xr[e])(t=nr.toValue(t),t[r=Ur(r)],i,s),Tr=e=>{var t=xr.length;return xr.push(e),t},Cr=(e,t)=>{var r=Ge[e];return void 0===r&&He(t+" has unknown type "+Ht(e)),r},Dr=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},Lr=(e,t,r)=>{var i=[],s=e.toWireType(i,r);return i.length&&(x[t>>2]=nr.toHandle(i)),s},Ir=(e,t,r)=>{var i=Dr(e,t),s=i.shift();e--;var n="return function (obj, func, destructorsRef, args) {\n",a=0,o=[];0===r&&o.push("obj");for(var d=["retType"],l=[s],c=0;ce.name)).join(", ")}) => ${s.name}>`;return Tr(vt(h,u))},Fr=e=>{var t=nr.toValue(e);qt(t),rr(e)},Pr=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,Mr=()=>{j("")},Rr=()=>Date.now(),zr=(e,t,r)=>E.copyWithin(e,t,t+r),Nr=e=>{j("OOM")},Or=e=>{E.length,Nr()},Gr={},$r=()=>l||"./this.program",Hr=()=>{if(!Hr.strings){var e={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",_:$r()};for(var t in Gr)void 0===Gr[t]?delete e[t]:e[t]=Gr[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Hr.strings=r}return Hr.strings},Vr=(e,t)=>{for(var r=0;r>0]=e.charCodeAt(r);S[t>>0]=0},Wr=(e,t)=>{var r=0;return Hr().forEach(((i,s)=>{var n=t+r;x[e+4*s>>2]=n,Vr(i,n),r+=i.length+1})),0},jr=(e,t)=>{var r=Hr();x[e>>2]=r.length;var i=0;return r.forEach((e=>i+=e.length+1)),x[t>>2]=i,0};function qr(e){try{var t=De.getStreamFromFD(e);return Te.close(t),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Yr(e,t){try{var r=De.getStreamFromFD(e),i=r.tty?2:Te.isDir(r.mode)?3:Te.isLink(r.mode)?7:4;return S[t>>0]=i,A[t+2>>1]=0,K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[t+8>>2]=K[0],U[t+12>>2]=K[1],K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[t+16>>2]=K[0],U[t+20>>2]=K[1],0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Kr=(e,t,r,i)=>{for(var s=0,n=0;n>2],o=x[t+4>>2];t+=8;var d=Te.read(e,S,a,o,i);if(d<0)return-1;if(s+=d,d>2]=n,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Zr(e,t,r,i,s){var n=Pr(t,r);try{if(isNaN(n))return 61;var a=De.getStreamFromFD(e);return Te.llseek(a,n,i),K=[a.position>>>0,(Y=a.position,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[s>>2]=K[0],U[s+4>>2]=K[1],a.getdents&&0===n&&0===i&&(a.getdents=null),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Jr=(e,t,r,i)=>{for(var s=0,n=0;n>2],o=x[t+4>>2];t+=8;var d=Te.write(e,S,a,o,i);if(d<0)return-1;s+=d,void 0!==i&&(i+=d)}return s};function Qr(e,t,r,i){try{var s=De.getStreamFromFD(e),n=Jr(s,t,r);return x[i>>2]=n,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var ei=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=Te.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},ti=365,ri=146;Object.defineProperties(ei.prototype,{read:{get:function(){return(this.mode&ti)===ti},set:function(e){e?this.mode|=ti:this.mode&=~ti}},write:{get:function(){return(this.mode&ri)===ri},set:function(e){e?this.mode|=ri:this.mode&=~ri}},isFolder:{get:function(){return Te.isDir(this.mode)}},isDevice:{get:function(){return Te.isChrdev(this.mode)}}}),Te.FSNode=ei,Te.createPreloadedFile=Ue,Te.staticInit(),ze(),Pe=s.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Me=s.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},gt(),ct(),Dt(),Ft=s.UnboundTypeError=$t(Error,"UnboundTypeError"),Qt(),sr();var ii,si={o:ae,A:Le,s:Ie,q:Re,C:Xe,D:Wt,y:Xt,h:Jt,B:or,l:cr,c:hr,b:fr,m:mr,j:Er,n:Ar,f:kr,g:rr,e:Ir,d:Fr,a:Mr,i:Rr,w:zr,r:Or,u:Wr,v:jr,k:qr,t:Yr,z:Xr,p:Zr,x:Qr},ni=ie(),ai=e=>(ai=ni.G)(e),oi=()=>(oi=ni.I)(),di=e=>(di=ni.J)(e),li=e=>(li=ni.K)(e),ci=e=>(ci=ni.M)(e);function ui(){function e(){ii||(ii=!0,s.calledRun=!0,C||(R(),t(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),z()))}$>0||(M(),$>0||(s.setStatus?(s.setStatus("Running..."),setTimeout((function(){setTimeout((function(){s.setStatus("")}),1),e()}),1)):e()))}if(s.dynCall_viiijj=(e,t,r,i,n,a,o,d)=>(s.dynCall_viiijj=ni.N)(e,t,r,i,n,a,o,d),s.dynCall_jij=(e,t,r,i)=>(s.dynCall_jij=ni.O)(e,t,r,i),s.dynCall_jii=(e,t,r)=>(s.dynCall_jii=ni.P)(e,t,r),s.dynCall_jiji=(e,t,r,i,n)=>(s.dynCall_jiji=ni.Q)(e,t,r,i,n),H=function e(){ii||ui(),ii||(H=e)},s.preInit)for("function"==typeof s.preInit&&(s.preInit=[s.preInit]);s.preInit.length>0;)s.preInit.pop()();return ui(),e.ready}),a=1e-6,o="undefined"!=typeof Float32Array?Float32Array:Array;function d(){var e=new o(16);return o!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function l(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var c,u=function(e,t,r,i,s,n,a){var o=1/(t-r),d=1/(i-s),l=1/(n-a);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*d,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*o,e[13]=(s+i)*d,e[14]=(a+n)*l,e[15]=1,e};function h(e,t,r){var i=new o(3);return i[0]=e,i[1]=t,i[2]=r,i}c=new o(3),o!=Float32Array&&(c[0]=0,c[1]=0,c[2]=0);var f=(e,t)=>{t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);const r=function(){const t=m(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),r=m(e.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))return console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(i)),null;return i}();let i={program:r,attribLocations:{vertexPosition:e.getAttribLocation(r,"aVertexPosition"),texturePosition:e.getAttribLocation(r,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(r,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(r,"uModelMatrix"),viewMatrix:e.getUniformLocation(r,"uViewMatrix"),rgbatexture:e.getUniformLocation(r,"rgbaTexture"),ytexture:e.getUniformLocation(r,"yTexture"),utexture:e.getUniformLocation(r,"uTexture"),vtexture:e.getUniformLocation(r,"vTexture"),isyuv:e.getUniformLocation(r,"isyuv")}},s=function(){const t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),e.STATIC_DRAW);var r=[];r=r.concat([0,1],[1,1],[1,0],[0,0]);const i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW);const s=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,s);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,texPosition:i,indices:s}}(),n=p(),o=p(),c=p(),f=p();function p(){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function m(t,r){const i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(console.log("An error occurred compiling the shaders: "+e.getShaderInfoLog(i)),e.deleteShader(i),null)}function _(t,r){e.viewport(0,0,t,r),e.clearColor(0,0,0,0),e.clearDepth(1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);const n=d();u(n,-1,1,-1,1,.1,100);const p=d();l(p);const m=d();!function(e,t,r,i){var s,n,o,d,c,u,h,f,p,m,_=t[0],g=t[1],y=t[2],v=i[0],b=i[1],w=i[2],S=r[0],E=r[1],A=r[2];Math.abs(_-S)32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let r=e-this._current_word_bits_left;this._fillCurrentWord();let i=Math.min(r,this._current_word_bits_left),s=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Ht=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Vt=Ht,Wt=Ht;function jt(e){let{profile:t,sampleRate:r,channel:i}=e;return new Uint8Array([175,0,t<<3|(14&r)>>1,(1&r)<<7|i<<3])}function qt(e){return Yt(e)&&e[1]===Ut}function Yt(e){return e[0]>>4===Ne}const Kt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Xt(e){let t=new Uint8Array(e),r=null,i=0,s=0,n=0,a=null;if(i=s=t[0]>>>3,n=(7&t[0])<<1|t[1]>>>7,n<0||n>=Kt.length)return void console.error("Flv: AAC invalid sampling frequency index!");let o=Kt[n],d=(120&t[1])>>>3;if(d<0||d>=8)return void console.log("Flv: AAC invalid channel configuration");5===i&&(a=(7&t[1])<<1|t[2]>>>7,t[2]);let l=Nt.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?n>=6?(i=5,r=new Array(4),a=n-3):(i=2,r=new Array(2),a=n):-1!==l.indexOf("android")?(i=2,r=new Array(2),a=n):(i=5,a=n,r=new Array(4),n>=6?a=n-3:1===d&&(i=2,r=new Array(2),a=n)),r[0]=i<<3,r[0]|=(15&n)>>>1,r[1]=(15&n)<<7,r[1]|=(15&d)<<3,5===i&&(r[1]|=(15&a)>>>1,r[2]=(1&a)<<7,r[2]|=8,r[3]=0),{audioType:"aac",config:r,sampleRate:o,channelCount:d,objectType:i,codec:"mp4a.40."+i,originalCodec:"mp4a.40."+s}}class Zt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+7>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(4095===(r[t+0]<<8|r[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let r=this.current_syncword_offset_,i=(8&e[r+1])>>>3,s=(6&e[r+1])>>>1,n=1&e[r+1],a=(192&e[r+2])>>>6,o=(60&e[r+2])>>>2,d=(1&e[r+2])<<2|(192&e[r+3])>>>6,l=(3&e[r+3])<<11|e[r+4]<<3|(224&e[r+5])>>>5;if(e[r+6],r+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let c=1===n?7:9,u=l-c;r+=c;let h=this.findNextSyncwordOffset(r+u);if(this.current_syncword_offset_=h,0!==i&&1!==i||0!==s)continue;let f=e.subarray(r,r+u);t={},t.audio_object_type=a+1,t.sampling_freq_index=o,t.sampling_frequency=Vt[o],t.channel_config=d,t.data=f}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Jt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+1>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(695===(r[t+0]<<3|r[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),r=0;for(let i=0;i<=t;i++)r<<=8,r|=e.readByte();return r}readNextAACFrame(e){let t=this.data_,r=null;for(;null==r&&!this.eof_flag_;){let i=this.current_syncword_offset_,s=(31&t[i+1])<<8|t[i+2];if(i+3+s>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let n=new $t(t.subarray(i+3,i+3+s)),a=null;if(n.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(i+3+s),n.destroy();continue}a=e}else{let e=n.readBool();if(e&&n.readBool()){console.error("audioMuxVersionA is Not Supported"),n.destroy();break}if(e&&this.getLATMValue(n),!n.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),n.destroy();break}if(0!==n.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),n.destroy();break}if(0!==n.readBits(4)){console.error("more than 2 numProgram Not Supported"),n.destroy();break}if(0!==n.readBits(3)){console.error("more than 2 numLayer Not Supported"),n.destroy();break}let t=e?this.getLATMValue(n):0,r=n.readBits(5);t-=5;let i=n.readBits(4);t-=4;let s=n.readBits(4);t-=4,n.readBits(3),t-=3,t>0&&n.readBits(t);let o=n.readBits(3);if(0!==o){console.error(`frameLengthType = ${o}. Only frameLengthType = 0 Supported`),n.destroy();break}n.readByte();let d=n.readBool();if(d)if(e)this.getLATMValue(n);else{let e=0;for(;;){e<<=8;let t=n.readBool();if(e+=n.readByte(),!t)break}console.log(e)}n.readBool()&&n.readByte(),a={},a.audio_object_type=r,a.sampling_freq_index=i,a.sampling_frequency=Vt[a.sampling_freq_index],a.channel_config=s,a.other_data_present=d}let o=0;for(;;){let e=n.readByte();if(o+=e,255!==e)break}let d=new Uint8Array(o);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function er(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return[];const r=e.length,i=[];let s,n=0;for(;n+t>>=8),n+=t,s){if(n+s>r)break;i.push(e.subarray(n,n+s)),n+=s}return i}function tr(e){const t=e.byteLength,r=new Uint8Array(4);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t;const i=new Uint8Array(t+4);return i.set(r,0),i.set(e,4),i}function rr(e,t){let r=null;return t?e.length>=28&&(r=1+(3&e[26])):e.length>=12&&(r=1+(3&e[9])),r}function ir(){return(new Date).getTime()}function sr(e,t,r){return Math.max(Math.min(e,Math.max(t,r)),Math.min(t,r))}function nr(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function ar(e){let t=0,r=nr();return i=>{if(s=i,"[object Number]"!==Object.prototype.toString.call(s))return;var s;t+=i;const n=nr(),a=n-r;a>=1e3&&(e(t/a*1e3),r=n,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();function or(e){return null==e}function dr(e){return!or(e)}function lr(e){return"function"==typeof e}function cr(e){let t=null,r=31&e[0];return r!==He&&r!==Ve||(t=Re),t||(r=(126&e[0])>>1,r!==st&&r!==at&&r!==dt||(t=ze)),t}function ur(){return"undefined"!=typeof WritableStream}function hr(e){e.close()}function fr(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let r=e[0],i=null,s=1;if(e.length>0){let t=e[1];t&&t.ts-r.ts>1e5&&(r=t,s=2)}if(r)for(let n=s;n=1e3){e[n-1].ts-r.ts<1e3&&(i=n+1)}}}return i}function pr(e){return e.ok&&e.status>=200&&e.status<=299}function mr(){return function(e){let t="";if("object"==typeof e)try{t=JSON.stringify(e),t=JSON.parse(t)}catch(r){t=e}else t=e;return t}(U)}function _r(e){return e[0]>>4===xt&&e[1]===Ut}function gr(e){return!0===e||"true"===e}function yr(e){return!0!==e&&"true"!==e}function vr(){return!!(Nt.Worker&&Nt.MediaSource&&"canConstructInDedicatedWorker"in Nt.MediaSource&&!0===Nt.MediaSource.canConstructInDedicatedWorker)}function br(e,t){const r=er(e.slice(5));let i=!1;return r.forEach((e=>{const r=t?e[0]>>>1&63:31&e[0];(t&&(r===Je||r===et||r===rt)||yr(t)&&r===We)&&(i=!0)})),i}var wr=function(e,t,r,i){return new(r||(r=Promise))((function(s,n){function a(e){try{d(i.next(e))}catch(e){n(e)}}function o(e){try{d(i.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}d((i=i.apply(e,t||[])).next())}))};const Sr=Symbol(32),Er=Symbol(16),Ar=Symbol(8);class Br{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return wr(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,r)=>{var i;this.reject=r,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(i=this.pull)||void 0===i||i.call(this,e)}))}))}readU32(){return this.read(Sr)}readU16(){return this.read(Er)}readU8(){return this.read(Ar)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let r=0;const i=e=>t.length<(r=e);if("number"==typeof this.need){if(i(this.need))return;e=t.subarray(0,r)}else if(this.need===Sr){if(i(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Er){if(i(2))return;e=t[0]<<8|t[1]}else if(this.need===Ar){if(i(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(i(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,r)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(i(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,r)),e=this.need}return this.consumed+=r,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,r=t+e;if(r<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,r);else{const e=new Uint8Array(r);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,r)}return this.buffer=new Uint8Array(e),this.buffer}}Br.U32=Sr,Br.U16=Er,Br.U8=Ar;class Ur{constructor(e){this.log=function(t){if(e._opt.debugLevel==w){const n=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s1?r-1:0),s=1;s1?i-1:0),n=1;n=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[s]=t[e],s++);return new Uint8Array(i.buffer,0,s)}static parseSPS(e){let t=xr._ebsp2rbsp(e),r=new $t(t);r.readByte();let i=r.readByte();r.readByte();let s=r.readByte();r.readUEG();let n=xr.getProfileString(i),a=xr.getLevelString(s),o=1,d=420,l=[0,420,422,444],c=8;if((100===i||110===i||122===i||244===i||44===i||83===i||86===i||118===i||128===i||138===i||144===i)&&(o=r.readUEG(),3===o&&r.readBits(1),o<=3&&(d=l[o]),c=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool())){let e=3!==o?8:12;for(let t=0;t0&&e<16?(b=t[e-1],w=i[e-1]):255===e&&(b=r.readByte()<<8|r.readByte(),w=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);E=r.readBool(),A=t,B=2*e,S=A/B}}let U=1;1===b&&1===w||(U=b/w);let x=0,k=0;if(0===o)x=1,k=2-m;else{x=3===o?1:2,k=(1===o?2:1)*(2-m)}let T=16*(f+1),C=16*(p+1)*(2-m);T-=(_+g)*x,C-=(y+v)*k;let D=Math.ceil(T*U);return r.destroy(),r=null,{profile_string:n,level_string:a,bit_depth:c,ref_frames:h,chroma_format:d,chroma_format_string:xr.getChromaFormatString(d),frame_rate:{fixed:E,fps:S,fps_den:B,fps_num:A},sar_ratio:{width:b,height:w},codec_size:{width:T,height:C},present_size:{width:D,height:C}}}static parseSPS$2(e){let t=e.subarray(1,4),r="avc1.";for(let e=0;e<3;e++){let i=t[e].toString(16);i.length<2&&(i="0"+i),r+=i}let i=xr._ebsp2rbsp(e),s=new $t(i);s.readByte();let n=s.readByte();s.readByte();let a=s.readByte();s.readUEG();let o=xr.getProfileString(n),d=xr.getLevelString(a),l=1,c=420,u=[0,420,422,444],h=8,f=8;if((100===n||110===n||122===n||244===n||44===n||83===n||86===n||118===n||128===n||138===n||144===n)&&(l=s.readUEG(),3===l&&s.readBits(1),l<=3&&(c=u[l]),h=s.readUEG()+8,f=s.readUEG()+8,s.readBits(1),s.readBool())){let e=3!==l?8:12;for(let t=0;t0&&e<16?(E=t[e-1],A=r[e-1]):255===e&&(E=s.readByte()<<8|s.readByte(),A=s.readByte()<<8|s.readByte())}if(s.readBool()&&s.readBool(),s.readBool()&&(s.readBits(4),s.readBool()&&s.readBits(24)),s.readBool()&&(s.readUEG(),s.readUEG()),s.readBool()){let e=s.readBits(32),t=s.readBits(32);U=s.readBool(),x=t,k=2*e,B=x/k}}let T=1;1===E&&1===A||(T=E/A);let C=0,D=0;if(0===l)C=1,D=2-y;else{C=3===l?1:2,D=(1===l?2:1)*(2-y)}let L=16*(_+1),I=16*(g+1)*(2-y);L-=(v+b)*C,I-=(w+S)*D;let F=Math.ceil(L*T);return s.destroy(),s=null,{codec_mimetype:r,profile_idc:n,level_idc:a,profile_string:o,level_string:d,chroma_format_idc:l,bit_depth:h,bit_depth_luma:h,bit_depth_chroma:f,ref_frames:m,chroma_format:c,chroma_format_string:xr.getChromaFormatString(c),frame_rate:{fixed:U,fps:B,fps_den:k,fps_num:x},sar_ratio:{width:E,height:A},codec_size:{width:L,height:I},present_size:{width:F,height:I}}}static _skipScalingList(e,t){let r=8,i=8,s=0;for(let n=0;n=this.buflen)return this.iserro=!0,0;this.iserro=!1,r=this.bufoff+e>8?8-this.bufoff:e,t<<=r,t+=this.buffer[this.bufpos]>>8-this.bufoff-r&255>>8-r,this.bufoff+=r,e-=r,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,r=this.bufoff,i=this.read(e);return this.bufpos=t,this.bufoff=r,i}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.sps,4),t.sps=i}if(t.pps){const e=t.pps.byteLength,r=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.pps,4),t.pps=i}return t}function Cr(e){let{sps:t,pps:r}=e;const i=[23,0,0,0,0,1,66,0,30,255];i[0]=23,i[6]=t[1],i[7]=t[2],i[8]=t[3],i[10]=225,i[11]=t.byteLength>>8&255,i[12]=255&t.byteLength,i.push(...t,1,r.byteLength>>8&255,255&r.byteLength,...r);return new Uint8Array(i)}function Dr(e){let{sps:t,pps:r}=e,i=8+t.byteLength+1+2+r.byteLength,s=!1;const n=xr.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(s=!0,i+=4);let a=new Uint8Array(i);a[0]=1,a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=255,a[5]=225;let o=t.byteLength;a[6]=o>>>8,a[7]=255&o;let d=8;a.set(t,8),d+=o,a[d]=1;let l=r.byteLength;a[d+1]=l>>>8,a[d+2]=255&l,a.set(r,d+3),d+=3+l,s&&(a[d]=252|n.chroma_format_idc,a[d+1]=248|n.bit_depth_luma-8,a[d+2]=248|n.bit_depth_chroma-8,a[d+3]=0,d+=4);const c=[23,0,0,0,0],u=new Uint8Array(c.length+a.byteLength);return u.set(c,0),u.set(a,c.length),u}function Lr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Ir(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Fr(e){return 31&e[0]}function Pr(e){return e===Ye}function Mr(e){return!function(e){return e===He||e===Ve}(e)&&!Pr(e)}function Rr(e){return e===We}function zr(e){if(0===e.length)return!1;const t=Fr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=31&e[r],s=(128&e[r])>>>7,n=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=n,i>=Ze||0===s&&(t={type:i,data:e.subarray(r,n)})}return t}}class Or{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Gr=e=>{let t=e,r=t.byteLength,i=new Uint8Array(r),s=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[s]=t[e],s++);return new Uint8Array(i.buffer,0,s)},$r=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Hr{static _ebsp2rbsp(e){let t=e,r=t.byteLength,i=new Uint8Array(r),s=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[s]=t[e],s++);return new Uint8Array(i.buffer,0,s)}static parseVPS(e){let t=Hr._ebsp2rbsp(e),r=new $t(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}}static parseSPS(e){let t=Hr._ebsp2rbsp(e),r=new $t(t);r.readByte(),r.readByte();let i=0,s=0,n=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<=16?(F=t[e-1],P=i[e-1]):255===e&&(F=r.readBits(16),P=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()){r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())}if(r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),L=r.readBool(),L&&(r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG()),r.readBool()){if(R=r.readBits(32),z=r.readBits(32),r.readBool()&&r.readUEG(),r.readBool()){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let s=0;s<=o;s++){let s=r.readBool();M=s;let n=!0,a=1;s||(n=r.readBool());let o=!1;if(n?r.readUEG():o=r.readBool(),o||(a=r.readUEG()+1),e){for(let e=0;e>6&3,r.general_tier_flag=e[1]>>5&1,r.general_profile_idc=31&e[1],r.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],r.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],r.general_constraint_indicator_flags=r.general_constraint_indicator_flags<<16|e[10]<<8|e[11],r.general_level_idc=e[12],r.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],r.parallelismType=3&e[15],r.chromaFormat=3&e[16],r.bitDepthLumaMinus8=7&e[17],r.bitDepthChromaMinus8=7&e[18],r.avgFrameRate=e[19]<<8|e[20],r.constantFrameRate=e[21]>>6&3,r.numTemporalLayers=e[21]>>3&7,r.temporalIdNested=e[21]>>2&1,r.lengthSizeMinusOne=3&e[21];let i=e[22],s=e.slice(23);for(let e=0;e0)for(let t=r;t<8;t++)e.read(2);i.sub_layer_profile_space=[],i.sub_layer_tier_flag=[],i.sub_layer_profile_idc=[],i.sub_layer_profile_compatibility_flag=[],i.sub_layer_progressive_source_flag=[],i.sub_layer_interlaced_source_flag=[],i.sub_layer_non_packed_constraint_flag=[],i.sub_layer_frame_only_constraint_flag=[],i.sub_layer_level_idc=[];for(let t=0;t{let t=Gr(e),r=new $t(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}})(t),a=(e=>{let t=Gr(e),r=new $t(t);r.readByte(),r.readByte();let i=0,s=0,n=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<16?(F=t[e-1],P=i[e-1]):255===e&&(F=r.readBits(16),P=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),L=r.readBool(),L&&(i+=r.readUEG(),s+=r.readUEG(),n+=r.readUEG(),a+=r.readUEG()),r.readBool()&&(R=r.readBits(32),z=r.readBits(32),r.readBool()&&(r.readUEG(),r.readBool()))){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let s=0;s<=o;s++){let s=r.readBool();M=s;let n=!1,a=1;s||(n=r.readBool());let o=!1;if(n?r.readSEG():o=r.readBool(),o||(cpbcnt=r.readUEG()+1),e)for(let e=0;e{let t=Gr(e),r=new $t(t);r.readByte(),r.readByte(),r.readUEG(),r.readUEG(),r.readBool(),r.readBool(),r.readBits(3),r.readBool(),r.readBool(),r.readUEG(),r.readUEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool()&&r.readUEG(),r.readSEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool(),r.readBool();let i=r.readBool(),s=r.readBool(),n=1;return s&&i?n=0:s?n=3:i&&(n=2),{parallelismType:n}})(r);s=Object.assign(s,n,a,o);let d=23+(5+t.byteLength)+(5+i.byteLength)+(5+r.byteLength),l=new Uint8Array(d);l[0]=1,l[1]=(3&s.general_profile_space)<<6|(s.general_tier_flag?1:0)<<5|31&s.general_profile_idc,l[2]=s.general_profile_compatibility_flags_1||0,l[3]=s.general_profile_compatibility_flags_2||0,l[4]=s.general_profile_compatibility_flags_3||0,l[5]=s.general_profile_compatibility_flags_4||0,l[6]=s.general_constraint_indicator_flags_1||0,l[7]=s.general_constraint_indicator_flags_2||0,l[8]=s.general_constraint_indicator_flags_3||0,l[9]=s.general_constraint_indicator_flags_4||0,l[10]=s.general_constraint_indicator_flags_5||0,l[11]=s.general_constraint_indicator_flags_6||0,l[12]=60,l[13]=240|(3840&s.min_spatial_segmentation_idc)>>8,l[14]=255&s.min_spatial_segmentation_idc,l[15]=252|3&s.parallelismType,l[16]=252|3&s.chroma_format_idc,l[17]=248|7&s.bit_depth_luma_minus8,l[18]=248|7&s.bit_depth_chroma_minus8,l[19]=0,l[20]=0,l[21]=(3&s.constant_frame_rate)<<6|(7&s.num_temporal_layers)<<3|(s.temporal_id_nested?1:0)<<2|3,l[22]=3,l[23]=128|st,l[24]=0,l[25]=1,l[26]=(65280&t.byteLength)>>8,l[27]=(255&t.byteLength)>>0,l.set(t,28),l[23+(5+t.byteLength)+0]=128|at,l[23+(5+t.byteLength)+1]=0,l[23+(5+t.byteLength)+2]=1,l[23+(5+t.byteLength)+3]=(65280&i.byteLength)>>8,l[23+(5+t.byteLength)+4]=(255&i.byteLength)>>0,l.set(i,23+(5+t.byteLength)+5),l[23+(5+t.byteLength+5+i.byteLength)+0]=128|dt,l[23+(5+t.byteLength+5+i.byteLength)+1]=0,l[23+(5+t.byteLength+5+i.byteLength)+2]=1,l[23+(5+t.byteLength+5+i.byteLength)+3]=(65280&r.byteLength)>>8,l[23+(5+t.byteLength+5+i.byteLength)+4]=(255&r.byteLength)>>0,l.set(r,23+(5+t.byteLength+5+i.byteLength)+5);const c=[28,0,0,0,0],u=new Uint8Array(c.length+l.byteLength);return u.set(c,0),u.set(l,c.length),u}function Yr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Kr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Xr(e){return(126&e[0])>>1}function Zr(e){return e===ct}function Jr(e){return!function(e){return e>=32&&e<=40}(e)}function Qr(e){return e>=16&&e<=21}function ei(e){if(0===e.length)return!1;const t=Xr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=e[r]>>1&63,s=(128&e[r])>>>7,n=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=n,0===s&&(t={type:i,data:e.subarray(r,n)})}return t}}class ri{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}function ii(e){return parseInt(e)===e}function si(e){if(!ii(e.length))return!1;for(var t=0;t255)return!1;return!0}function ni(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!si(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(ii(e.length)&&si(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function ai(e){return new Uint8Array(e)}function oi(e,t,r,i,s){null==i&&null==s||(e=e.slice?e.slice(i,s):Array.prototype.slice.call(e,i,s)),t.set(e,r)}var di,li={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},ci=(di="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r>4]+di[15&i])}return t.join("")}}),ui={16:10,24:12,32:14},hi=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],fi=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],pi=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],mi=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],_i=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],gi=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],yi=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],vi=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],bi=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],wi=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Si=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Ei=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Ai=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Bi=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Ui=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function xi(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=n[t],this._Kd[e-r][t%4]=n[t];for(var a,o=0,d=s;d>16&255]<<24^fi[a>>8&255]<<16^fi[255&a]<<8^fi[a>>24&255]^hi[o]<<24,o+=1,8!=s)for(t=1;t>8&255]<<8^fi[a>>16&255]<<16^fi[a>>24&255]<<24;for(t=s/2+1;t>2,c=d%4,this._Ke[l][c]=n[t],this._Kd[e-l][c]=n[t++],d++}for(var l=1;l>24&255]^Ai[a>>16&255]^Bi[a>>8&255]^Ui[255&a]},ki.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=xi(e),s=0;s<4;s++)i[s]^=this._Ke[0][s];for(var n=1;n>24&255]^_i[i[(s+1)%4]>>16&255]^gi[i[(s+2)%4]>>8&255]^yi[255&i[(s+3)%4]]^this._Ke[n][s];i=r.slice()}var a,o=ai(16);for(s=0;s<4;s++)a=this._Ke[t][s],o[4*s]=255&(fi[i[s]>>24&255]^a>>24),o[4*s+1]=255&(fi[i[(s+1)%4]>>16&255]^a>>16),o[4*s+2]=255&(fi[i[(s+2)%4]>>8&255]^a>>8),o[4*s+3]=255&(fi[255&i[(s+3)%4]]^a);return o},ki.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=xi(e),s=0;s<4;s++)i[s]^=this._Kd[0][s];for(var n=1;n>24&255]^bi[i[(s+3)%4]>>16&255]^wi[i[(s+2)%4]>>8&255]^Si[255&i[(s+1)%4]]^this._Kd[n][s];i=r.slice()}var a,o=ai(16);for(s=0;s<4;s++)a=this._Kd[t][s],o[4*s]=255&(pi[i[s]>>24&255]^a>>24),o[4*s+1]=255&(pi[i[(s+3)%4]>>16&255]^a>>16),o[4*s+2]=255&(pi[i[(s+2)%4]>>8&255]^a>>8),o[4*s+3]=255&(pi[255&i[(s+1)%4]]^a);return o};var Ti=function(e){if(!(this instanceof Ti))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new ki(e)};Ti.prototype.encrypt=function(e){if((e=ni(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=ai(e.length),r=ai(16),i=0;iNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},Ii.prototype.setBytes=function(e){if(16!=(e=ni(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Ii.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var Fi=function(e,t){if(!(this instanceof Fi))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Ii||(t=new Ii(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new ki(e)};Fi.prototype.encrypt=function(e){for(var t=ni(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,i=0;i>>2]>>>24-n%4*8&255;t[i+n>>>2]|=a<<24-(i+n)%4*8}else for(var o=0;o>>2]=r[o>>>2];return this.sigBytes+=s,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-s%4*8&255;i.push((n>>>4).toString(16)),i.push((15&n).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new l.init(r,t/2)}},h=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s>>2]>>>24-s%4*8&255;i.push(String.fromCharCode(n))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new l.init(r,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,s=i.words,n=i.sigBytes,a=this.blockSize,o=n/(4*a),d=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*a,c=e.min(4*d,n);if(d){for(var u=0;u>>2]|=e[s]<<24-s%4*8;t.call(this,i,r)}else t.apply(this,arguments)};i.prototype=e}}(),r.lib.WordArray)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.WordArray,i=e.enc;function s(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s>>2]>>>16-s%4*8&65535;i.push(String.fromCharCode(n))}return i.join("")},parse:function(e){for(var r=e.length,i=[],s=0;s>>1]|=e.charCodeAt(s)<<16-s%2*16;return t.create(i,2*r)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535);i.push(String.fromCharCode(a))}return i.join("")},parse:function(e){for(var r=e.length,i=[],n=0;n>>1]|=s(e.charCodeAt(n)<<16-n%2*16);return t.create(i,2*r)}}}(),r.enc.Utf16)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.WordArray;function i(e,r,i){for(var s=[],n=0,a=0;a>>6-a%4*2;s[n>>>2]|=o<<24-n%4*8,n++}return t.create(s,n)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var s=[],n=0;n>>2]>>>24-n%4*8&255)<<16|(t[n+1>>>2]>>>24-(n+1)%4*8&255)<<8|t[n+2>>>2]>>>24-(n+2)%4*8&255,o=0;o<4&&n+.75*o>>6*(3-o)&63));var d=i.charAt(64);if(d)for(;s.length%4;)s.push(d);return s.join("")},parse:function(e){var t=e.length,r=this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var n=0;n>>6-a%4*2;s[n>>>2]|=o<<24-n%4*8,n++}return t.create(s,n)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,s=t?this._safe_map:this._map;e.clamp();for(var n=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,d=0;d<4&&a+.75*d>>6*(3-d)&63));var l=s.charAt(64);if(l)for(;n.length%4;)n.push(l);return n.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,s=t?this._safe_map:this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var a=0;a>>24)|4278255360&(s<<24|s>>>8)}var n=this._hash.words,a=e[t+0],d=e[t+1],f=e[t+2],p=e[t+3],m=e[t+4],_=e[t+5],g=e[t+6],y=e[t+7],v=e[t+8],b=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],A=e[t+13],B=e[t+14],U=e[t+15],x=n[0],k=n[1],T=n[2],C=n[3];x=l(x,k,T,C,a,7,o[0]),C=l(C,x,k,T,d,12,o[1]),T=l(T,C,x,k,f,17,o[2]),k=l(k,T,C,x,p,22,o[3]),x=l(x,k,T,C,m,7,o[4]),C=l(C,x,k,T,_,12,o[5]),T=l(T,C,x,k,g,17,o[6]),k=l(k,T,C,x,y,22,o[7]),x=l(x,k,T,C,v,7,o[8]),C=l(C,x,k,T,b,12,o[9]),T=l(T,C,x,k,w,17,o[10]),k=l(k,T,C,x,S,22,o[11]),x=l(x,k,T,C,E,7,o[12]),C=l(C,x,k,T,A,12,o[13]),T=l(T,C,x,k,B,17,o[14]),x=c(x,k=l(k,T,C,x,U,22,o[15]),T,C,d,5,o[16]),C=c(C,x,k,T,g,9,o[17]),T=c(T,C,x,k,S,14,o[18]),k=c(k,T,C,x,a,20,o[19]),x=c(x,k,T,C,_,5,o[20]),C=c(C,x,k,T,w,9,o[21]),T=c(T,C,x,k,U,14,o[22]),k=c(k,T,C,x,m,20,o[23]),x=c(x,k,T,C,b,5,o[24]),C=c(C,x,k,T,B,9,o[25]),T=c(T,C,x,k,p,14,o[26]),k=c(k,T,C,x,v,20,o[27]),x=c(x,k,T,C,A,5,o[28]),C=c(C,x,k,T,f,9,o[29]),T=c(T,C,x,k,y,14,o[30]),x=u(x,k=c(k,T,C,x,E,20,o[31]),T,C,_,4,o[32]),C=u(C,x,k,T,v,11,o[33]),T=u(T,C,x,k,S,16,o[34]),k=u(k,T,C,x,B,23,o[35]),x=u(x,k,T,C,d,4,o[36]),C=u(C,x,k,T,m,11,o[37]),T=u(T,C,x,k,y,16,o[38]),k=u(k,T,C,x,w,23,o[39]),x=u(x,k,T,C,A,4,o[40]),C=u(C,x,k,T,a,11,o[41]),T=u(T,C,x,k,p,16,o[42]),k=u(k,T,C,x,g,23,o[43]),x=u(x,k,T,C,b,4,o[44]),C=u(C,x,k,T,E,11,o[45]),T=u(T,C,x,k,U,16,o[46]),x=h(x,k=u(k,T,C,x,f,23,o[47]),T,C,a,6,o[48]),C=h(C,x,k,T,y,10,o[49]),T=h(T,C,x,k,B,15,o[50]),k=h(k,T,C,x,_,21,o[51]),x=h(x,k,T,C,E,6,o[52]),C=h(C,x,k,T,p,10,o[53]),T=h(T,C,x,k,w,15,o[54]),k=h(k,T,C,x,d,21,o[55]),x=h(x,k,T,C,v,6,o[56]),C=h(C,x,k,T,U,10,o[57]),T=h(T,C,x,k,g,15,o[58]),k=h(k,T,C,x,A,21,o[59]),x=h(x,k,T,C,m,6,o[60]),C=h(C,x,k,T,S,10,o[61]),T=h(T,C,x,k,f,15,o[62]),k=h(k,T,C,x,b,21,o[63]),n[0]=n[0]+x|0,n[1]=n[1]+k|0,n[2]=n[2]+T|0,n[3]=n[3]+C|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,s=8*t.sigBytes;r[s>>>5]|=128<<24-s%32;var n=e.floor(i/4294967296),a=i;r[15+(s+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),r[14+(s+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var o=this._hash,d=o.words,l=0;l<4;l++){var c=d[l];d[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return o},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,i,s,n,a){var o=e+(t&r|~t&i)+s+a;return(o<>>32-n)+t}function c(e,t,r,i,s,n,a){var o=e+(t&i|r&~i)+s+a;return(o<>>32-n)+t}function u(e,t,r,i,s,n,a){var o=e+(t^r^i)+s+a;return(o<>>32-n)+t}function h(e,t,r,i,s,n,a){var o=e+(r^(t|~i))+s+a;return(o<>>32-n)+t}t.MD5=n._createHelper(d),t.HmacMD5=n._createHmacHelper(d)}(Math),r.MD5)})),Gt((function(e,t){var r,i,s,n,a,o,d,l;e.exports=(i=(r=l=Mi).lib,s=i.WordArray,n=i.Hasher,a=r.algo,o=[],d=a.SHA1=n.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],s=r[1],n=r[2],a=r[3],d=r[4],l=0;l<80;l++){if(l<16)o[l]=0|e[t+l];else{var c=o[l-3]^o[l-8]^o[l-14]^o[l-16];o[l]=c<<1|c>>>31}var u=(i<<5|i>>>27)+d+o[l];u+=l<20?1518500249+(s&n|~s&a):l<40?1859775393+(s^n^a):l<60?(s&n|s&a|n&a)-1894007588:(s^n^a)-899497514,d=a,a=n,n=s<<30|s>>>2,s=i,i=u}r[0]=r[0]+i|0,r[1]=r[1]+s|0,r[2]=r[2]+n|0,r[3]=r[3]+a|0,r[4]=r[4]+d|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=n._createHelper(d),r.HmacSHA1=n._createHmacHelper(d),l.SHA1)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,s=i.WordArray,n=i.Hasher,a=t.algo,o=[],d=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,s=0;s<64;)t(i)&&(s<8&&(o[s]=r(e.pow(i,.5))),d[s]=r(e.pow(i,1/3)),s++),i++}();var l=[],c=a.SHA256=n.extend({_doReset:function(){this._hash=new s.init(o.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],s=r[1],n=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,_=l[f-2],g=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;l[f]=m+l[f-7]+g+l[f-16]}var y=i&s^i&n^s&n,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=h+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&c^~o&u)+d[f]+l[f];h=u,u=c,c=o,o=a+b|0,a=n,n=s,s=i,i=b+(v+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+s|0,r[2]=r[2]+n|0,r[3]=r[3]+a|0,r[4]=r[4]+o|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,s=8*t.sigBytes;return r[s>>>5]|=128<<24-s%32,r[14+(s+64>>>9<<4)]=e.floor(i/4294967296),r[15+(s+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=n._createHelper(c),t.HmacSHA256=n._createHmacHelper(c)}(Math),r.SHA256)})),Gt((function(e,t){var r,i,s,n,a,o;e.exports=(i=(r=o=Mi).lib.WordArray,s=r.algo,n=s.SHA256,a=s.SHA224=n.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=n._createHelper(a),r.HmacSHA224=n._createHmacHelper(a),o.SHA224)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.Hasher,i=e.x64,s=i.Word,n=i.WordArray,a=e.algo;function o(){return s.create.apply(s,arguments)}var d=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=o()}();var c=a.SHA512=t.extend({_doReset:function(){this._hash=new n.init([new s.init(1779033703,4089235720),new s.init(3144134277,2227873595),new s.init(1013904242,4271175723),new s.init(2773480762,1595750129),new s.init(1359893119,2917565137),new s.init(2600822924,725511199),new s.init(528734635,4215389547),new s.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],s=r[1],n=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=i.high,p=i.low,m=s.high,_=s.low,g=n.high,y=n.low,v=a.high,b=a.low,w=o.high,S=o.low,E=c.high,A=c.low,B=u.high,U=u.low,x=h.high,k=h.low,T=f,C=p,D=m,L=_,I=g,F=y,P=v,M=b,R=w,z=S,N=E,O=A,G=B,$=U,H=x,V=k,W=0;W<80;W++){var j,q,Y=l[W];if(W<16)q=Y.high=0|e[t+2*W],j=Y.low=0|e[t+2*W+1];else{var K=l[W-15],X=K.high,Z=K.low,J=(X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7,Q=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),ee=l[W-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,se=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),ne=l[W-7],ae=ne.high,oe=ne.low,de=l[W-16],le=de.high,ce=de.low;q=(q=(q=J+ae+((j=Q+oe)>>>0>>0?1:0))+ie+((j+=se)>>>0>>0?1:0))+le+((j+=ce)>>>0>>0?1:0),Y.high=q,Y.low=j}var ue,he=R&N^~R&G,fe=z&O^~z&$,pe=T&D^T&I^D&I,me=C&L^C&F^L&F,_e=(T>>>28|C<<4)^(T<<30|C>>>2)^(T<<25|C>>>7),ge=(C>>>28|T<<4)^(C<<30|T>>>2)^(C<<25|T>>>7),ye=(R>>>14|z<<18)^(R>>>18|z<<14)^(R<<23|z>>>9),ve=(z>>>14|R<<18)^(z>>>18|R<<14)^(z<<23|R>>>9),be=d[W],we=be.high,Se=be.low,Ee=H+ye+((ue=V+ve)>>>0>>0?1:0),Ae=ge+me;H=G,V=$,G=N,$=O,N=R,O=z,R=P+(Ee=(Ee=(Ee=Ee+he+((ue+=fe)>>>0>>0?1:0))+we+((ue+=Se)>>>0>>0?1:0))+q+((ue+=j)>>>0>>0?1:0))+((z=M+ue|0)>>>0>>0?1:0)|0,P=I,M=F,I=D,F=L,D=T,L=C,T=Ee+(_e+pe+(Ae>>>0>>0?1:0))+((C=ue+Ae|0)>>>0>>0?1:0)|0}p=i.low=p+C,i.high=f+T+(p>>>0>>0?1:0),_=s.low=_+L,s.high=m+D+(_>>>0>>0?1:0),y=n.low=y+F,n.high=g+I+(y>>>0>>0?1:0),b=a.low=b+M,a.high=v+P+(b>>>0>>0?1:0),S=o.low=S+z,o.high=w+R+(S>>>0>>0?1:0),A=c.low=A+O,c.high=E+N+(A>>>0>>0?1:0),U=u.low=U+$,u.high=B+G+(U>>>0<$>>>0?1:0),k=h.low=k+V,h.high=x+H+(k>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(c),e.HmacSHA512=t._createHmacHelper(c)}(),r.SHA512)})),Gt((function(e,t){var r,i,s,n,a,o,d,l;e.exports=(i=(r=l=Mi).x64,s=i.Word,n=i.WordArray,a=r.algo,o=a.SHA512,d=a.SHA384=o.extend({_doReset:function(){this._hash=new n.init([new s.init(3418070365,3238371032),new s.init(1654270250,914150663),new s.init(2438529370,812702999),new s.init(355462360,4144912697),new s.init(1731405415,4290775857),new s.init(2394180231,1750603025),new s.init(3675008525,1694076839),new s.init(1203062813,3204075428)])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=o._createHelper(d),r.HmacSHA384=o._createHmacHelper(d),l.SHA384)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,s=i.WordArray,n=i.Hasher,a=t.x64.Word,o=t.algo,d=[],l=[],c=[];!function(){for(var e=1,t=0,r=0;r<24;r++){d[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var s=1,n=0;n<24;n++){for(var o=0,u=0,h=0;h<7;h++){if(1&s){var f=(1<>>24)|4278255360&(n<<24|n>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(k=r[s]).high^=a,k.low^=n}for(var o=0;o<24;o++){for(var h=0;h<5;h++){for(var f=0,p=0,m=0;m<5;m++)f^=(k=r[h+5*m]).high,p^=k.low;var _=u[h];_.high=f,_.low=p}for(h=0;h<5;h++){var g=u[(h+4)%5],y=u[(h+1)%5],v=y.high,b=y.low;for(f=g.high^(v<<1|b>>>31),p=g.low^(b<<1|v>>>31),m=0;m<5;m++)(k=r[h+5*m]).high^=f,k.low^=p}for(var w=1;w<25;w++){var S=(k=r[w]).high,E=k.low,A=d[w];A<32?(f=S<>>32-A,p=E<>>32-A):(f=E<>>64-A,p=S<>>64-A);var B=u[l[w]];B.high=f,B.low=p}var U=u[0],x=r[0];for(U.high=x.high,U.low=x.low,h=0;h<5;h++)for(m=0;m<5;m++){var k=r[w=h+5*m],T=u[w],C=u[(h+1)%5+5*m],D=u[(h+2)%5+5*m];k.high=T.high^~C.high&D.high,k.low=T.low^~C.low&D.low}k=r[0];var L=c[o];k.high^=L.high,k.low^=L.low}},_doFinalize:function(){var t=this._data,r=t.words;this._nDataBytes;var i=8*t.sigBytes,n=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/n)*n>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,o=this.cfg.outputLength/8,d=o/8,l=[],c=0;c>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(h)}return new s.init(l,o)},clone:function(){for(var e=n.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=n._createHelper(h),t.HmacSHA3=n._createHmacHelper(h)}(Math),r.SHA3)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,s=i.WordArray,n=i.Hasher,a=t.algo,o=s.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=s.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=s.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=s.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=s.create([0,1518500249,1859775393,2400959708,2840853838]),h=s.create([1352829926,1548603684,1836072691,2053994217,0]),f=a.RIPEMD160=n.extend({_doReset:function(){this._hash=s.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,s=e[i];e[i]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}var n,a,f,b,w,S,E,A,B,U,x,k=this._hash.words,T=u.words,C=h.words,D=o.words,L=d.words,I=l.words,F=c.words;for(S=n=k[0],E=a=k[1],A=f=k[2],B=b=k[3],U=w=k[4],r=0;r<80;r+=1)x=n+e[t+D[r]]|0,x+=r<16?p(a,f,b)+T[0]:r<32?m(a,f,b)+T[1]:r<48?_(a,f,b)+T[2]:r<64?g(a,f,b)+T[3]:y(a,f,b)+T[4],x=(x=v(x|=0,I[r]))+w|0,n=w,w=b,b=v(f,10),f=a,a=x,x=S+e[t+L[r]]|0,x+=r<16?y(E,A,B)+C[0]:r<32?g(E,A,B)+C[1]:r<48?_(E,A,B)+C[2]:r<64?m(E,A,B)+C[3]:p(E,A,B)+C[4],x=(x=v(x|=0,F[r]))+U|0,S=U,U=B,B=v(A,10),A=E,E=x;x=k[1]+f+B|0,k[1]=k[2]+b+U|0,k[2]=k[3]+w+S|0,k[3]=k[4]+n+E|0,k[4]=k[0]+a+A|0,k[0]=x},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var s=this._hash,n=s.words,a=0;a<5;a++){var o=n[a];n[a]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return s},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function m(e,t,r){return e&t|~e&r}function _(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function v(e,t){return e<>>32-t}t.RIPEMD160=n._createHelper(f),t.HmacRIPEMD160=n._createHmacHelper(f)}(),r.RIPEMD160)})),Gt((function(e,t){var r,i,s;e.exports=(i=(r=Mi).lib.Base,s=r.enc.Utf8,void(r.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var n=this._oKey=t.clone(),a=this._iKey=t.clone(),o=n.words,d=a.words,l=0;l>>2];e.sigBytes-=t}};i.BlockCipher=c.extend({cfg:c.cfg.extend({mode:f,padding:p}),reset:function(){var e;c.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=i.CipherParams=s.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?n.create([1398893684,1701076831]).concat(r).concat(t):t).toString(d)},parse:function(e){var t,r=d.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=n.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),m.create({ciphertext:r,salt:t})}},g=i.SerializableCipher=s.extend({cfg:s.extend({format:_}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var s=e.createEncryptor(r,i),n=s.finalize(t),a=s.cfg;return m.create({ciphertext:n,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,i,s){if(i||(i=n.random(8)),s)a=l.create({keySize:t+r,hasher:s}).compute(e,i);else var a=l.create({keySize:t+r}).compute(e,i);var o=n.create(a.words.slice(t),4*r);return a.sigBytes=4*t,m.create({key:a,iv:o,salt:i})}},v=i.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var s=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=s.iv;var n=g.encrypt.call(this,e,t,s.key,i);return n.mixIn(s),n},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var s=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=s.iv,g.decrypt.call(this,e,t,s.key,i)}})}())})),Gt((function(e,t){var r;e.exports=((r=Mi).mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,i){var s,n=this._iv;n?(s=n.slice(0),this._iv=void 0):s=this._prevBlock,i.encryptBlock(s,0);for(var a=0;a>24&255)){var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}else e+=1<<24;return e}function i(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var s=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,s=r.blockSize,n=this._iv,a=this._counter;n&&(a=this._counter=n.slice(0),this._iv=void 0),i(a);var o=a.slice(0);r.encryptBlock(o,0);for(var d=0;d>>2]|=s<<24-n%4*8,e.sigBytes+=s},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),Gt((function(e,t){var r;e.exports=((r=Mi).pad.Iso10126={pad:function(e,t){var i=4*t,s=i-e.sigBytes%i;e.concat(r.lib.WordArray.random(s-1)).concat(r.lib.WordArray.create([s<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),Gt((function(e,t){var r;e.exports=((r=Mi).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),Gt((function(e,t){var r;e.exports=((r=Mi).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)})),Gt((function(e,t){var r;e.exports=((r=Mi).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib.CipherParams,s=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(s)},parse:function(e){var t=s.parse(e);return i.create({ciphertext:t})}}}(),r.format.Hex)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.BlockCipher,i=e.algo,s=[],n=[],a=[],o=[],d=[],l=[],c=[],u=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,s[r]=p,n[p]=r;var m=e[r],_=e[m],g=e[_],y=257*e[p]^16843008*p;a[r]=y<<24|y>>>8,o[r]=y<<16|y>>>16,d[r]=y<<8|y>>>24,l[r]=y,y=16843009*g^65537*_^257*m^16843008*r,c[p]=y<<24|y>>>8,u[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,r?(r=m^e[e[e[g^m]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=i.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),n=this._keySchedule=[],a=0;a6&&a%r==4&&(l=s[l>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[255&l]):(l=s[(l=l<<8|l>>>24)>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[255&l],l^=p[a/r|0]<<24),n[a]=n[a-r]^l);for(var o=this._invKeySchedule=[],d=0;d>>24]]^u[s[l>>>16&255]]^h[s[l>>>8&255]]^f[s[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,o,d,l,s)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,c,u,h,f,n),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,s,n,a,o){for(var d=this._nRounds,l=e[t]^r[0],c=e[t+1]^r[1],u=e[t+2]^r[2],h=e[t+3]^r[3],f=4,p=1;p>>24]^s[c>>>16&255]^n[u>>>8&255]^a[255&h]^r[f++],_=i[c>>>24]^s[u>>>16&255]^n[h>>>8&255]^a[255&l]^r[f++],g=i[u>>>24]^s[h>>>16&255]^n[l>>>8&255]^a[255&c]^r[f++],y=i[h>>>24]^s[l>>>16&255]^n[c>>>8&255]^a[255&u]^r[f++];l=m,c=_,u=g,h=y}m=(o[l>>>24]<<24|o[c>>>16&255]<<16|o[u>>>8&255]<<8|o[255&h])^r[f++],_=(o[c>>>24]<<24|o[u>>>16&255]<<16|o[h>>>8&255]<<8|o[255&l])^r[f++],g=(o[u>>>24]<<24|o[h>>>16&255]<<16|o[l>>>8&255]<<8|o[255&c])^r[f++],y=(o[h>>>24]<<24|o[l>>>16&255]<<16|o[c>>>8&255]<<8|o[255&u])^r[f++],e[t]=m,e[t+1]=_,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(m)}(),r.AES)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib,i=t.WordArray,s=t.BlockCipher,n=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=n.DES=s.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=a[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var s=this._subKeys=[],n=0;n<16;n++){var l=s[n]=[],c=d[n];for(r=0;r<24;r++)l[r/6|0]|=t[(o[r]-1+c)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(o[r+24]-1+c)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var u=this._invSubKeys=[];for(r=0;r<16;r++)u[r]=s[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var s=r[i],n=this._lBlock,a=this._rBlock,o=0,d=0;d<8;d++)o|=l[d][((a^s[d])&c[d])>>>0];this._lBlock=a,this._rBlock=n^o}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),s=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(i.create(t)),this._des2=u.createEncryptor(i.create(r)),this._des3=u.createEncryptor(i.create(s))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=s._createHelper(p)}(),r.TripleDES)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,s=i.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],s=0;s<256;s++)i[s]=s;s=0;for(var n=0;s<256;s++){var a=s%r,o=t[a>>>2]>>>24-a%4*8&255;n=(n+i[s]+o)%256;var d=i[s];i[s]=i[n],i[n]=d}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=n.call(this)},keySize:8,ivSize:0});function n(){for(var e=this._S,t=this._i,r=this._j,i=0,s=0;s<4;s++){r=(r+e[t=(t+1)%256])%256;var n=e[t];e[t]=e[r],e[r]=n,i|=e[(e[t]+e[r])%256]<<24-8*s}return this._i=t,this._j=r,i}e.RC4=t._createHelper(s);var a=i.RC4Drop=s.extend({cfg:s.cfg.extend({drop:192}),_doReset:function(){s._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)n.call(this)}});e.RC4Drop=t._createHelper(a)}(),r.RC4)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,s=[],n=[],a=[],o=i.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],s=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)d.call(this);for(r=0;r<8;r++)s[r]^=i[r+4&7];if(t){var n=t.words,a=n[0],o=n[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(s[0]^=l,s[1]^=u,s[2]^=c,s[3]^=h,s[4]^=l,s[5]^=u,s[6]^=c,s[7]^=h,r=0;r<4;r++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),s[0]=r[0]^r[5]>>>16^r[3]<<16,s[1]=r[2]^r[7]>>>16^r[5]<<16,s[2]=r[4]^r[1]>>>16^r[7]<<16,s[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)s[i]=16711935&(s[i]<<8|s[i]>>>24)|4278255360&(s[i]<<24|s[i]>>>8),e[t+i]^=s[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)n[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],s=65535&i,o=i>>>16,d=((s*s>>>17)+s*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=t._createHelper(o)}(),r.Rabbit)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,s=[],n=[],a=[],o=i.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var s=0;s<4;s++)d.call(this);for(s=0;s<8;s++)i[s]^=r[s+4&7];if(t){var n=t.words,a=n[0],o=n[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(i[0]^=l,i[1]^=u,i[2]^=c,i[3]^=h,i[4]^=l,i[5]^=u,i[6]^=c,i[7]^=h,s=0;s<4;s++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),s[0]=r[0]^r[5]>>>16^r[3]<<16,s[1]=r[2]^r[7]>>>16^r[5]<<16,s[2]=r[4]^r[1]>>>16^r[7]<<16,s[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)s[i]=16711935&(s[i]<<8|s[i]>>>24)|4278255360&(s[i]<<24|s[i]>>>8),e[t+i]^=s[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)n[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],s=65535&i,o=i>>>16,d=((s*s>>>17)+s*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=t._createHelper(o)}(),r.RabbitLegacy)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.BlockCipher,i=e.algo;const s=16,n=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function d(e,t){let r=t>>24&255,i=t>>16&255,s=t>>8&255,n=255&t,a=e.sbox[0][r]+e.sbox[1][i];return a^=e.sbox[2][s],a+=e.sbox[3][n],a}function l(e,t,r){let i,n=t,a=r;for(let t=0;t1;--t)n^=e.pbox[t],a=d(e,n)^a,i=n,n=a,a=i;return i=n,n=a,a=i,a^=e.pbox[1],n^=e.pbox[0],{left:n,right:a}}function u(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=a[t][r]}let i=0;for(let a=0;a=r&&(i=0);let o=0,d=0,c=0;for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),r=new Uint8Array(r);const s=e.byteLength;let n=5;for(;ns)break;let o=e[n+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=e.slice(n+4+2,n+4+a);let s=new Pi.ModeOfOperation.ctr(t,new Pi.Counter(r));const o=s.decrypt(i);s=null,e.set(o,n+4+2)}n=n+4+a}return e}function Ni(e,t,r){if(e.byteLength<=30)return e;const i=e.slice(32);let s=new Pi.ModeOfOperation.ctr(t,new Pi.Counter(r));const n=s.decrypt(i);return s=null,e.set(n,32),e}Gt((function(e,t){e.exports=Mi}));var Oi=Gt((function(e,t){var r,s,n,a=(r=new Date,s=4,n={setLogLevel:function(e){s=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=s&&console.debug("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=s&&console.info("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=s&&console.warn("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=s&&console.error("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}},n);a.getDurationString=function(e,t){var r;function i(e,t){for(var r=(""+e).split(".");r[0].length0){for(var r="",i=0;i0&&(r+=","),r+="["+a.getDurationString(e.start(i))+","+a.getDurationString(e.end(i))+"]";return r}return"(empty)"},t.Log=a;var o=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};o.prototype.getPosition=function(){return this.position},o.prototype.getEndPosition=function(){return this.buffer.byteLength},o.prototype.getLength=function(){return this.buffer.byteLength},o.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},o.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},o.prototype.readAnyInt=function(e,t){var r=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:r=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:r=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";r=this.dataview.getUint8(this.position)<<16,r|=this.dataview.getUint8(this.position+1)<<8,r|=this.dataview.getUint8(this.position+2);break;case 4:r=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";r=this.dataview.getUint32(this.position)<<32,r|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,r}throw"Not enough bytes in buffer"},o.prototype.readUint8=function(){return this.readAnyInt(1,!1)},o.prototype.readUint16=function(){return this.readAnyInt(2,!1)},o.prototype.readUint24=function(){return this.readAnyInt(3,!1)},o.prototype.readUint32=function(){return this.readAnyInt(4,!1)},o.prototype.readUint64=function(){return this.readAnyInt(8,!1)},o.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",r=0;rthis._byteLength&&(this._byteLength=t);else{for(r<1&&(r=1);t>r;)r*=2;var i=new ArrayBuffer(r),s=new Uint8Array(this._buffer);new Uint8Array(i,0,s.length).set(s),this.buffer=i,this._byteLength=t}}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),r=new Uint8Array(this._buffer,0,t.length);t.set(r),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Int32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Int16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Uint32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Uint16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var r=new Float64Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Float32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,r,i,s){var n=new Uint8Array(e,t,s),a=new Uint8Array(r,i,s);n.set(a)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=0;rs;i--,s++){var n=t[s];t[s]=t[i],t[i]=n}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],r=0;r>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},d.prototype.adjustUint32=function(e,t){var r=this.position;this.seek(e),this.writeUint32(t),this.seek(r)},d.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var r=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var r=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var r=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var r=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var r=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=8*e,r},d.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var r=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r};var c=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(c.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,a.debug("MultiBufferStream","Stream ready for parsing"),!0):(a.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(a.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){a.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r.buffer},c.prototype.reduceBuffer=function(e,t,r){var i;return(i=new Uint8Array(r)).set(new Uint8Array(e,t,r)),i.buffer.fileStart=e.fileStart+t,i.buffer.usedBytes=0,i.buffer},c.prototype.insertBuffer=function(e){for(var t=!0,r=0;ri.byteLength){this.buffers.splice(r,1),r--;continue}a.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=i.fileStart||(e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)),a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(r,0,e),0===r&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,s,n)}}t&&(a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===r&&(this.buffer=e))},c.prototype.logBufferLevel=function(e){var t,r,i,s,n,o=[],d="";for(i=0,s=0,t=0;t0&&(d+=n.end-1+"]");var l=e?a.info:a.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+i+"/"+s+" bytes), continuous ranges: "+d)},c.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},c.prototype.findPosition=function(e,t,r){var i,s=null,n=-1;for(i=!0===e?0:this.bufferIndex;i=t?(a.debug("MultiBufferStream","Found position in existing buffer #"+n),n):-1},c.prototype.findEndContiguousBuf=function(e){var t,r,i,s=void 0!==e?e:this.bufferIndex;if(r=this.buffers[s],this.buffers.length>s+1)for(t=s+1;t>3;return 31===i&&r.data.length>=2&&(i=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),i}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};t.MPEG4DescriptorParser=u;var h={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){h.FullBox.prototype=new h.Box,h.ContainerBox.prototype=new h.Box,h.SampleEntry.prototype=new h.Box,h.TrackGroupTypeBox.prototype=new h.FullBox,h.BASIC_BOXES.forEach((function(e){h.createBoxCtor(e)})),h.FULL_BOXES.forEach((function(e){h.createFullBoxCtor(e)})),h.CONTAINER_BOXES.forEach((function(e){h.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,r){this.type=e,this.size=t,this.uuid=r},FullBox:function(e,t,r){h.Box.call(this,e,t,r),this.flags=0,this.version=0},ContainerBox:function(e,t,r){h.Box.call(this,e,t,r),this.boxes=[]},SampleEntry:function(e,t,r,i){h.ContainerBox.call(this,e,t),this.hdr_size=r,this.start=i},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){h.FullBox.call(this,e,t)},createBoxCtor:function(e,t){h.boxCodes.push(e),h[e+"Box"]=function(t){h.Box.call(this,e,t)},h[e+"Box"].prototype=new h.Box,t&&(h[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){h[e+"Box"]=function(t){h.FullBox.call(this,e,t)},h[e+"Box"].prototype=new h.FullBox,h[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,r=0;rr?(a.error("BoxParser","Box of type '"+c+"' has a size "+l+" greater than its container size "+r),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):0!==l&&o+l>e.getEndPosition()?(e.seek(o),a.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):t?{code:h.OK,type:c,size:l,hdr_size:d,start:o}:(h[c+"Box"]?i=new h[c+"Box"](l):"uuid"!==c?(a.warn("BoxParser","Unknown box type: '"+c+"'"),(i=new h.Box(c,l)).has_unparsed_data=!0):h.UUIDBoxes[n]?i=new h.UUIDBoxes[n](l):(a.warn("BoxParser","Unknown uuid type: '"+n+"'"),(i=new h.Box(c,l)).uuid=n,i.has_unparsed_data=!0),i.hdr_size=d,i.start=o,i.write===h.Box.prototype.write&&"mdat"!==i.type&&(a.info("BoxParser","'"+u+"' box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),(s=e.getPosition()-(i.start+i.size))<0?(a.warn("BoxParser","Parsing of box '"+u+"' did not read the entire indicated box data size (missing "+-s+" bytes), seeking forward"),e.seek(i.start+i.size)):s>0&&(a.error("BoxParser","Parsing of box '"+u+"' read "+s+" more bytes than the indicated box data size, seeking backwards"),0!==i.size&&e.seek(i.start+i.size)),{code:h.OK,box:i,size:i.size})},h.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},h.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},h.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.ContainerBox.prototype.parse=function(e){for(var t,r;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},h.SAMPLE_ENTRY_TYPE_VISUAL="Visual",h.SAMPLE_ENTRY_TYPE_AUDIO="Audio",h.SAMPLE_ENTRY_TYPE_HINT="Hint",h.SAMPLE_ENTRY_TYPE_METADATA="Metadata",h.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",h.SAMPLE_ENTRY_TYPE_SYSTEM="System",h.SAMPLE_ENTRY_TYPE_TEXT="Text",h.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},h.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},h.SampleEntry.prototype.parseFooter=function(e){h.ContainerBox.prototype.parse.call(this,e)},h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_HINT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT,"enct"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA,"encm"),h.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var r=0;r<3;r++)this.layer_size[r]=16==t?e.readUint16():e.readUint32()})),h.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),h.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),h.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)a.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void a.error("av1C reserved_2 parsing problem");var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)}else a.error("av1C reserved_1 parsing problem");else a.error("av1C version "+this.version+" not supported")})),h.createBoxCtor("avcC",(function(e){var t,r;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),r=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(r))})),h.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),h.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),h.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),h.createFullBoxCtor("co64",(function(e){var t,r;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(r=0;r>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),h.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),h.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),h.createFullBoxCtor("ctts",(function(e){var t,r;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(r=0;r>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|r>>6&3,this.acmod=r>>3&7,this.lfeon=r>>2&1,this.bit_rate_code=3&r|i>>5&7})),h.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var r=0;r>6,i.bsid=s>>1&31,i.bsmod=(1&s)<<4|n>>4&15,i.acmod=n>>1&7,i.lfeon=1&n,i.num_dep_sub=a>>1&15,i.num_dep_sub>0&&(i.chan_loc=(1&a)<<8|e.readUint8())}})),h.createFullBoxCtor("dfLa",(function(e){var t=[],r=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var i=e.readUint8(),s=Math.min(127&i,r.length-1);if(s?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(r[s]),128&i)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),h.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[r]=e.readString(4),t-=4,r++})),h.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),h.createBoxCtor("hvcC",(function(e){var t,r,i,s;this.configurationVersion=e.readUint8(),s=e.readUint8(),this.general_profile_space=s>>6,this.general_tier_flag=(32&s)>>5,this.general_profile_idc=31&s,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),s=e.readUint8(),this.constantFrameRate=s>>6,this.numTemporalLayers=(13&s)>>3,this.temporalIdNested=(4&s)>>2,this.lengthSizeMinusOne=3&s,this.nalu_arrays=[];var n=e.readUint8();for(t=0;t>7,a.nalu_type=63&s;var o=e.readUint16();for(r=0;r>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var r=0;if(this.version<2)r=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";r=e.readUint32()}for(var i=0;i>7,this.axis=1&t})),h.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),a.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),h.createFullBoxCtor("ipma",(function(e){var t,r;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?a.property_index=(127&n)<<8|e.readUint8():a.property_index=127&n}}})),h.createFullBoxCtor("iref",(function(e){var t,r;for(this.references=[];e.getPosition()>7,i.assignment_type=127&s,i.assignment_type){case 0:i.grouping_type=e.readString(4);break;case 1:i.grouping_type=e.readString(4),i.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:i.sub_track_id=e.readUint32();break;default:a.warn("BoxParser","Unknown leva assignement type")}}})),h.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),h.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),f.prototype.toString=function(){return"("+this.x+","+this.y+")"},h.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new f(e.readUint16(),e.readUint16()),this.display_primaries[1]=new f(e.readUint16(),e.readUint16()),this.display_primaries[2]=new f(e.readUint16(),e.readUint16()),this.white_point=new f(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),h.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),h.createFullBoxCtor("mehd",(function(e){1&this.flags&&(a.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),h.createFullBoxCtor("meta",(function(e){this.boxes=[],h.ContainerBox.prototype.parse.call(this,e)})),h.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),h.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),h.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),h.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),h.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),h.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),h.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var r=0;r0){var t=e.readUint32();this.kid=[];for(var r=0;r0&&(this.data=e.readUint8Array(i))})),h.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),h.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),h.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var r=0;r>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var r=e.readUint8(),i=0;i>7,this.num_leading_samples=127&t})),h.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)a.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=h.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),h.createSampleGroupCtor("stsa",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),h.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),h.createSampleGroupCtor("tsas",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("tscl",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("vipr",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),r=0;r>6,this.sample_depends_on[i]=t>>4&3,this.sample_is_depended_on[i]=t>>2&3,this.sample_has_redundancy[i]=3&t})),h.createFullBoxCtor("senc"),h.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),a.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),r=0;r>31&1,i.referenced_size=2147483647&s,i.subsegment_duration=e.readUint32(),s=e.readUint32(),i.starts_with_SAP=s>>31&1,i.SAP_type=s>>28&7,i.SAP_delta_time=268435455&s}})),h.SingleItemTypeReferenceBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.SingleItemTypeReferenceBox.prototype=new h.Box,h.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var r=0;r>4&15,this.sample_sizes[t+1]=15&i}else if(8===this.field_size)for(t=0;t0)for(r=0;r>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=h.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),h.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),h.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),h.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var r=e.readUint32(),i=0;i>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),h.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),h.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),h.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},h.createTrackGroupCtor("msrc"),h.TrackReferenceTypeBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.TrackReferenceTypeBox.prototype=new h.Box,h.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},h.trefBox.prototype.parse=function(e){for(var t,r;e.getPosition()t&&this.flags&h.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var r=0;r>7&1,this.block_pad_lsb=r>>6&1,this.block_little_endian=r>>5&1,this.block_reversed=r>>4&1,this.pad_unknown=r>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),h.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),h.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),h.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),h.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=h.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),h.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),h.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=h.parseHex16(e)})),h.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),h.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),h.createFullBoxCtor("vvcC",(function(e){var t,r,i={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(i.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,r=this.num_sublayers-2;r>=0;--r){var a=i.extract_bits(1);this.ptl_sublayer_present_mask|=a<1;++r)i.extract_bits(1);for(this.sublayer_level_idc=[],r=this.num_sublayers-2;r>=0;--r)this.ptl_sublayer_present_mask&1<>=1;t+=h.decimalToHex(i,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var s=!1,n="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||s)&&(n="."+h.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+n,s=!0);t+=n}return t},h.vvc1SampleEntry.prototype.getCodec=h.vvi1SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var r="";if(this.vvcC.general_constraint_info){var i,s=[],n=0;for(n|=this.vvcC.ptl_frame_only_constraint<<7,n|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,s.push(n),n&&(i=e),n=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===i)r=".CA";else{r=".C";var a="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",o=0,d=0;for(e=0;e<=i;++e)for(o=o<<8|s[e],d+=8;d>=5;){r+=a[o>>d-5&31],o&=(1<<(d-=5))-1}d&&(r+=a[31&(o<<=5-d)])}}t+=r}return t},h.mp4aSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),r=this.esds.esd.getAudioConfig();return e+"."+h.decimalToHex(t)+(r?"."+r:"")}return e},h.stxtSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},h.vp08SampleEntry.prototype.getCodec=h.vp09SampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var r=this.vpcC.bitDepth;return 8==r&&(r="08"),e+".0"+this.vpcC.profile+"."+t+"."+r},h.av01SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this),r=this.av1C.seq_level_idx_0;return r<10&&(r="0"+r),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+r+(this.av1C.seq_tier_0?"H":"M")+"."+e},h.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),a.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>l?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>l&&e.writeUint64(this.size)},h.FullBox.prototype.writeHeader=function(e){this.size+=4,h.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},h.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},h.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},h.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},h.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},h.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},h.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&h.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&h.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&h.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&h.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[r]instanceof h.Box||t[r]instanceof h.Box||void 0===e[r]||void 0===t[r]||"function"==typeof e[r]||"function"==typeof t[r]||e.subBoxNames&&e.subBoxNames.indexOf(r.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(r.slice(0,4))>-1||"data"===r||"start"===r||"size"===r||"creation_time"===r||"modification_time"===r||h.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(r)>-1||e[r]===t[r]))return!1;return!0},h.boxEqual=function(e,t){if(!h.boxEqualFields(e,t))return!1;for(var r=0;r1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},g.prototype.setExtractionOptions=function(e,t,r){var i=this.getTrackById(e);if(i){var s={};this.extractedTracks.push(s),s.id=e,s.user=t,s.trak=i,i.nextSample=0,s.nb_samples=1e3,s.samples=[],r&&r.nbSamples&&(s.nb_samples=r.nbSamples)}},g.prototype.unsetExtractionOptions=function(e){for(var t=-1,r=0;r-1&&this.extractedTracks.splice(t,1)},g.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=h.parseOneBox(this.stream,false)).code===h.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var r;switch(r="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),r){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[r]&&a.warn("ISOFile","Duplicate Box of type: "+r+", overriding previous occurrence"),this[r]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},g.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(a.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(a.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(a.warn("ISOFile","Not ready to start parsing"),!1))},g.prototype.appendBuffer=function(e,t){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(a.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),r},g.prototype.getInfo=function(){var e,t,r,i,s,n,a={},o=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(a.hasMoov=!0,a.duration=this.moov.mvhd.duration,a.timescale=this.moov.mvhd.timescale,a.isFragmented=null!=this.moov.mvex,a.isFragmented&&this.moov.mvex.mehd&&(a.fragment_duration=this.moov.mvex.mehd.fragment_duration),a.isProgressive=this.isProgressive,a.hasIOD=null!=this.moov.iods,a.brands=[],a.brands.push(this.ftyp.major_brand),a.brands=a.brands.concat(this.ftyp.compatible_brands),a.created=new Date(o+1e3*this.moov.mvhd.creation_time),a.modified=new Date(o+1e3*this.moov.mvhd.modification_time),a.tracks=[],a.audioTracks=[],a.videoTracks=[],a.subtitleTracks=[],a.metadataTracks=[],a.hintTracks=[],a.otherTracks=[],e=0;e0?a.mime+='video/mp4; codecs="':a.audioTracks&&a.audioTracks.length>0?a.mime+='audio/mp4; codecs="':a.mime+='application/mp4; codecs="',e=0;e=r.samples.length)&&(a.info("ISOFile","Sending fragmented data on track #"+i.id+" for samples ["+Math.max(0,r.nextSample-i.nb_samples)+","+(r.nextSample-1)+"]"),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(i.id,i.user,i.segmentStream.buffer,r.nextSample,e||r.nextSample>=r.samples.length),i.segmentStream=null,i!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=r.samples.length)&&(a.debug("ISOFile","Sending samples on track #"+n.id+" for sample "+r.nextSample),this.onSamples&&this.onSamples(n.id,n.user,n.samples),n.samples=[],n!==this.extractedTracks[t]))break}}}},g.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},g.prototype.getBoxes=function(e,t){var r=[];return g._sweep.call(this,e,r,t),r},g._sweep=function(e,t,r){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&r)return;g._sweep.call(this.boxes[i],e,t,r)}},g.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},g.prototype.getTrackSample=function(e,t){var r=this.getTrackById(e);return this.getSample(r,t)},g.prototype.releaseUsedSamples=function(e,t,r){var i=0,s=this.getTrackById(e);s.lastValidSample||(s.lastValidSample=0);for(var n=s.lastValidSample;ne*s.timescale){l=i-1;break}t&&s.is_sync&&(d=i)}for(t&&(l=d),e=r.samples[l].cts,r.nextSample=l;r.samples[l].alreadyRead===r.samples[l].size&&r.samples[l+1];)l++;return n=r.samples[l].offset+r.samples[l].alreadyRead,a.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+a.getDurationString(e,o)+" and offset: "+n),{offset:n,time:e/o}},g.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},g.prototype.seek=function(e,t){var r,i,s,n=this.moov,o={offset:1/0,time:1/0};if(this.moov){for(s=0;sthis.getTrackDuration(r)||((i=this.seekTrack(e,t,r)).offset-1){a=d;break}switch(a){case"Visual":if(s.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),n.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var u=new h.avcCBox;u.parse(new o(t.avcDecoderConfigRecord)),n.addBox(u)}else if(t.hevcDecoderConfigRecord){var f=new h.hvcCBox;f.parse(new o(t.hevcDecoderConfigRecord)),n.addBox(f)}break;case"Audio":s.add("smhd").set("balance",t.balance||0),n.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":s.add("hmhd");break;case"Subtitle":if(s.add("sthd"),"stpp"===t.type)n.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:s.add("nmhd")}t.description&&n.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){n.addBox(e)})),s.add("dinf").add("dref").addEntry((new h["url Box"]).set("flags",1));var p=s.add("stbl");return p.add("stsd").addEntry(n),p.add("stts").set("sample_counts",[]).set("sample_deltas",[]),p.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),p.add("stco").set("chunk_offsets",[]),p.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(r),t.id}},h.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},g.prototype.addSample=function(e,t,r){var i=r||{},s={},n=this.getTrackById(e);if(null!==n){s.number=n.samples.length,s.track_id=n.tkhd.track_id,s.timescale=n.mdia.mdhd.timescale,s.description_index=i.sample_description_index?i.sample_description_index-1:0,s.description=n.mdia.minf.stbl.stsd.entries[s.description_index],s.data=t,s.size=t.byteLength,s.alreadyRead=s.size,s.duration=i.duration||1,s.cts=i.cts||0,s.dts=i.dts||0,s.is_sync=i.is_sync||!1,s.is_leading=i.is_leading||0,s.depends_on=i.depends_on||0,s.is_depended_on=i.is_depended_on||0,s.has_redundancy=i.has_redundancy||0,s.degradation_priority=i.degradation_priority||0,s.offset=0,s.subsamples=i.subsamples,n.samples.push(s),n.samples_size+=s.size,n.samples_duration+=s.duration,void 0===n.first_dts&&(n.first_dts=i.dts),this.processSamples();var a=this.createSingleSampleMoof(s);return this.addBox(a),a.computeSize(),a.trafs[0].truns[0].data_offset=a.size+8,this.add("mdat").data=new Uint8Array(t),s}},g.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var r=new h.moofBox;r.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var i=r.add("traf"),s=this.getTrackById(e.track_id);return i.add("tfhd").set("track_id",e.track_id).set("flags",h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),i.add("tfdt").set("baseMediaDecodeTime",e.dts-(s.first_dts||0)),i.add("trun").set("flags",h.TRUN_FLAGS_DATA_OFFSET|h.TRUN_FLAGS_DURATION|h.TRUN_FLAGS_SIZE|h.TRUN_FLAGS_FLAGS|h.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),r},g.prototype.lastMoofIndex=0,g.prototype.samplesDataSize=0,g.prototype.resetTables=function(){var e,t,r,i,s,n;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(d=s[a].grouping_type+"/0",(o=new l(s[a].grouping_type,0)).is_fragment=!0,t.sample_groups_info[d]||(t.sample_groups_info[d]=o))}else for(a=0;a=2&&(d=i[a].grouping_type+"/0",o=new l(i[a].grouping_type,0),e.sample_groups_info[d]||(e.sample_groups_info[d]=o))},g.setSampleGroupProperties=function(e,t,r,i){var s,n;for(s in t.sample_groups=[],i){var a;if(t.sample_groups[s]={},t.sample_groups[s].grouping_type=i[s].grouping_type,t.sample_groups[s].grouping_type_parameter=i[s].grouping_type_parameter,r>=i[s].last_sample_in_run&&(i[s].last_sample_in_run<0&&(i[s].last_sample_in_run=0),i[s].entry_index++,i[s].entry_index<=i[s].sbgp.entries.length-1&&(i[s].last_sample_in_run+=i[s].sbgp.entries[i[s].entry_index].sample_count)),i[s].entry_index<=i[s].sbgp.entries.length-1?t.sample_groups[s].group_description_index=i[s].sbgp.entries[i[s].entry_index].group_description_index:t.sample_groups[s].group_description_index=-1,0!==t.sample_groups[s].group_description_index)a=i[s].fragment_description?i[s].fragment_description:i[s].description,t.sample_groups[s].group_description_index>0?(n=t.sample_groups[s].group_description_index>65535?(t.sample_groups[s].group_description_index>>16)-1:t.sample_groups[s].group_description_index-1,a&&n>=0&&(t.sample_groups[s].description=a.entries[n])):a&&a.version>=2&&a.default_group_description_index>0&&(t.sample_groups[s].description=a.entries[a.default_group_description_index-1])}},g.process_sdtp=function(e,t,r){t&&(e?(t.is_leading=e.is_leading[r],t.depends_on=e.sample_depends_on[r],t.is_depended_on=e.sample_is_depended_on[r],t.has_redundancy=e.sample_has_redundancy[r]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},g.prototype.buildSampleLists=function(){var e,t;for(e=0;ev&&(b++,v<0&&(v=0),v+=n.sample_counts[b]),t>0?(e.samples[t-1].duration=n.sample_deltas[b],e.samples_duration+=e.samples[t-1].duration,U.dts=e.samples[t-1].dts+e.samples[t-1].duration):U.dts=0,a?(t>=w&&(S++,w<0&&(w=0),w+=a.sample_counts[S]),U.cts=e.samples[t].dts+a.sample_offsets[S]):U.cts=U.dts,o?(t==o.sample_numbers[E]-1?(U.is_sync=!0,E++):(U.is_sync=!1,U.degradation_priority=0),l&&l.entries[A].sample_delta+B==t+1&&(U.subsamples=l.entries[A].subsamples,B+=l.entries[A].sample_delta,A++)):U.is_sync=!0,g.process_sdtp(e.mdia.minf.stbl.sdtp,U,U.number),U.degradation_priority=h?h.priority[t]:0,l&&l.entries[A].sample_delta+B==t&&(U.subsamples=l.entries[A].subsamples,B+=l.entries[A].sample_delta),(c.length>0||u.length>0)&&g.setSampleGroupProperties(e,U,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},g.prototype.updateSampleLists=function(){var e,t,r,i,s,n,a,o,d,l,c,u,f,p,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&g.initSampleGroups(u,c,c.sbgps,u.mdia.minf.stbl.sgpds,c.sgpds),t=0;t0?p.dts=u.samples[u.samples.length-2].dts+u.samples[u.samples.length-2].duration:(c.tfdt?p.dts=c.tfdt.baseMediaDecodeTime:p.dts=0,u.first_traf_merged=!0),p.cts=p.dts,_.flags&h.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+_.sample_composition_time_offset[r]),m=a,_.flags&h.TRUN_FLAGS_FLAGS?m=_.sample_flags[r]:0===r&&_.flags&h.TRUN_FLAGS_FIRST_FLAG&&(m=_.first_sample_flags),p.is_sync=!(m>>16&1),p.is_leading=m>>26&3,p.depends_on=m>>24&3,p.is_depended_on=m>>22&3,p.has_redundancy=m>>20&3,p.degradation_priority=65535&m;var y=!!(c.tfhd.flags&h.TFHD_FLAG_BASE_DATA_OFFSET),v=!!(c.tfhd.flags&h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),b=!!(_.flags&h.TRUN_FLAGS_DATA_OFFSET),w=0;w=y?c.tfhd.base_data_offset:v||0===t?l.start:o,p.offset=0===t&&0===r?b?w+_.data_offset:w:o,o=p.offset+p.size,(c.sbgps.length>0||c.sgpds.length>0||u.mdia.minf.stbl.sbgps.length>0||u.mdia.minf.stbl.sgpds.length>0)&&g.setSampleGroupProperties(u,p,p.number_in_traf,c.sample_groups_info)}}if(c.subs){u.has_fragment_subsamples=!0;var S=c.first_sample_index;for(t=0;t-1))return null;var n=(r=this.stream.buffers[s]).byteLength-(i.offset+i.alreadyRead-r.fileStart);if(i.size-i.alreadyRead<=n)return a.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+(i.size-i.alreadyRead)+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,i.size-i.alreadyRead),r.usedBytes+=i.size-i.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead=i.size,i;if(0===n)return null;a.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+n+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,n),i.alreadyRead+=n,r.usedBytes+=n,this.stream.logBufferLevel()}},g.prototype.releaseSample=function(e,t){var r=e.samples[t];return r.data?(this.samplesDataSize-=r.size,r.data=null,r.description=null,delete r.degradation_priority,delete r.depends_on,delete r.description_index,delete r.has_redundancy,delete r.is_depended_on,delete r.is_leading,delete r.is_sync,delete r.moof_number,delete r.number_in_traf,delete r.timescale,delete r.cts,delete r.dts,delete r.offset,delete r.size,delete r.track_id,delete r.duration,r.alreadyRead=0,r.size):0},g.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},g.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},g.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(r.protection=n.ipro.protections[n.iinf.item_infos[e].protection_index-1]),n.iinf.item_infos[e].item_type?r.type=n.iinf.item_infos[e].item_type:r.type="mime",r.content_type=n.iinf.item_infos[e].content_type,r.content_encoding=n.iinf.item_infos[e].content_encoding;if(n.grpl)for(e=0;e0&&h.property_index-1-1))return null;var o=(t=this.stream.buffers[n]).byteLength-(s.offset+s.alreadyRead-t.fileStart);if(!(s.length-s.alreadyRead<=o))return a.debug("ISOFile","Getting item #"+e+" extent #"+i+" partial data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-t.fileStart)+" read size: "+o+" full extent size: "+s.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,s.offset+s.alreadyRead-t.fileStart,o),s.alreadyRead+=o,r.alreadyRead+=o,t.usedBytes+=o,this.stream.logBufferLevel(),null;a.debug("ISOFile","Getting item #"+e+" extent #"+i+" data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-t.fileStart)+" read size: "+(s.length-s.alreadyRead)+" full extent size: "+s.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,s.offset+s.alreadyRead-t.fileStart,s.length-s.alreadyRead),t.usedBytes+=s.length-s.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead+=s.length-s.alreadyRead,s.alreadyRead=s.length}}return r.alreadyRead===r.size?r:null},g.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var r=0;r0?this.moov.traks[e].samples[0].duration:0),t.push(i)}return t},g.prototype.getPerformanceInfo=function(){var e={};return e.moov=this.moov,this.moov&&this.moov.traks&&this.moov.traks.length>1&&(e.moovAudioNum=this.moov.traks[0].samples.length,e.moovVideoNum=this.moov.traks[1].samples.length),e},h.Box.prototype.printHeader=function(e){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},h.FullBox.prototype.printHeader=function(e){this.size+=4,h.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},h.Box.prototype.print=function(e){this.printHeader(e)},h.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},h.tkhdBox.prototype.print=function(e){h.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var y={createFile:function(e,t){var r=void 0===e||e,i=new g(t);return i.discardMdatData=!r,i}};t.createFile=y.createFile}));function Gi(e){return e.reduce(((e,t)=>256*e+t))}function $i(e){const t=[101,103,119,99],r=e.length-28,i=e.slice(r,r+t.length);return t.every(((e,t)=>e===i[t]))}Oi.Log,Oi.MP4BoxStream,Oi.DataStream,Oi.MultiBufferStream,Oi.MPEG4DescriptorParser,Oi.BoxParser,Oi.XMLSubtitlein4Parser,Oi.Textin4Parser,Oi.ISOFile,Oi.createFile;class Hi{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(r+32,r+32+t))]}return null}(t,this.t);if(!r)return e;const i=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(i instanceof Error)return console.error(i.message),this.d=!0,e;this.A=!0,this.u=r[1],$i(t)&&this.c++,WebAssembly.instantiate(r[2],i).then((e=>{if("function"!=typeof(t=e.instance.exports).parse||"object"!=typeof t.memory)return this.d=!0,void console.error("video_error_3");var t;this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}function Vi(){for(var e=arguments.length,t=new Array(e),r=0;r{const r=new i((0|e.byteLength)+(0|t.byteLength));return r.set(e,0),r.set(t,0|e.byteLength),r}),new i)}const Wi=16,ji=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],qi=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Yi(e){const t=[];for(let r=0,i=e.length;r1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Xi(e){const t=[];for(let r=0,i=e.length;r>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}function Zi(e){const t=[];for(let r=0,i=e.length;r=240&&e[r]<=247?(t.push(String.fromCodePoint(((7&e[r])<<18)+((63&e[r+1])<<12)+((63&e[r+2])<<6)+(63&e[r+3]))),r+=3):e[r]>=224&&e[r]<=239?(t.push(String.fromCodePoint(((15&e[r])<<12)+((63&e[r+1])<<6)+(63&e[r+2]))),r+=2):e[r]>=192&&e[r]<=223?(t.push(String.fromCodePoint(((31&e[r])<<6)+(63&e[r+1]))),r++):t.push(String.fromCodePoint(e[r]));return t.join("")}function Ji(e,t){const r=31&t;return e<>>32-r}function Qi(e){return(255&ji[e>>>24&255])<<24|(255&ji[e>>>16&255])<<16|(255&ji[e>>>8&255])<<8|255&ji[255&e]}function es(e){return e^Ji(e,2)^Ji(e,10)^Ji(e,18)^Ji(e,24)}function ts(e){return e^Ji(e,13)^Ji(e,23)}function rs(e,t,r){const i=new Array(4),s=new Array(4);for(let t=0;t<4;t++)s[0]=255&e[4*t],s[1]=255&e[4*t+1],s[2]=255&e[4*t+2],s[3]=255&e[4*t+3],i[t]=s[0]<<24|s[1]<<16|s[2]<<8|s[3];for(let e,t=0;t<32;t+=4)e=i[1]^i[2]^i[3]^r[t+0],i[0]^=es(Qi(e)),e=i[2]^i[3]^i[0]^r[t+1],i[1]^=es(Qi(e)),e=i[3]^i[0]^i[1]^r[t+2],i[2]^=es(Qi(e)),e=i[0]^i[1]^i[2]^r[t+3],i[3]^=es(Qi(e));for(let e=0;e<16;e+=4)t[e]=i[3-e/4]>>>24&255,t[e+1]=i[3-e/4]>>>16&255,t[e+2]=i[3-e/4]>>>8&255,t[e+3]=255&i[3-e/4]}function is(e,t,r){const i=new Array(4),s=new Array(4);for(let t=0;t<4;t++)s[0]=255&e[0+4*t],s[1]=255&e[1+4*t],s[2]=255&e[2+4*t],s[3]=255&e[3+4*t],i[t]=s[0]<<24|s[1]<<16|s[2]<<8|s[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let e,r=0;r<32;r+=4)e=i[1]^i[2]^i[3]^qi[r+0],t[r+0]=i[0]^=ts(Qi(e)),e=i[2]^i[3]^i[0]^qi[r+1],t[r+1]=i[1]^=ts(Qi(e)),e=i[3]^i[0]^i[1]^qi[r+2],t[r+2]=i[2]^=ts(Qi(e)),e=i[0]^i[1]^i[2]^qi[r+3],t[r+3]=i[3]^=ts(Qi(e));if(0===r)for(let e,r=0;r<16;r++)e=t[r],t[r]=t[31-r],t[31-r]=e}function ss(e,t,r){let{padding:i="pkcs#7",mode:s,iv:n=[],output:a="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===s&&("string"==typeof n&&(n=Yi(n)),16!==n.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=Yi(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==r?Xi(e):Yi(e):[...e],("pkcs#5"===i||"pkcs#7"===i)&&0!==r){const t=Wi-e.length%Wi;for(let r=0;r=Wi;){const t=e.slice(u,u+16),i=new Array(16);if("cbc"===s)for(let e=0;e2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=e.byteLength;let n=new Uint8Array(e.slice(0,5)),a=5;for(;as){const t=new Uint8Array(n.length+e.length-a);t.set(n,0),t.set(e.slice(a),n.length),n=t;break}let l=e[a+4],c=!1,u=2;if(r?(i&&(u=3),l=l>>>1&63,c=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(l)):(l&=31,c=1===l||5===l),c){const r=ss(e.slice(a+4+u,a+4+d),t,0,{padding:"none",output:"array"});let i=r[r.length-1];if(i>0&&i<16){let e=!0;for(let t=1;t<=i;t++)if(r[r.length-t]!==i){e=!1;break}e&&r.splice(r.length-i,i)}const s=new Uint8Array(u);s.set(e.slice(a+4,a+4+u),0);const o=tr(Vi(s,new Uint8Array(r))),l=new Uint8Array(n.length+o.length);l.set(n,0),l.set(o,n.length),n=l}else{const t=e.slice(a+4,a+4+d),r=new Uint8Array(n.length+4+t.length);r.set(n,0),r.set(o,n.length),r.set(t,n.length+4),n=r}a=a+4+d}return n}const os={init:0,findFirstStartCode:1,findSecondStartCode:2};class ds extends class{on(e,t,r){const i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:r}),this}once(e,t,r){const i=this;function s(){i.off(e,s);for(var n=arguments.length,a=new Array(n),o=0;o1?r-1:0),s=1;s{delete r[e]})),void delete this.e;const i=r[e],s=[];if(i&&t)for(let e=0,r=i.length;e=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=os.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==os.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=os.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==os.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=os.findFirstStartCode}}}}function ls(e,t,r){for(let i=2;i3&&void 0!==arguments[3]&&arguments[3];const s=e.byteLength;let n=5;for(;ns)break;let o=e[n+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=ls(e.slice(n+4,n+4+a),t,r);e.set(i,n+4)}n=n+4+a}return e}function hs(){for(var e=arguments.length,t=new Array(e),r=0;re+t.byteLength),0));let s=0;return t.forEach((e=>{i.set(e,s),s+=e.byteLength})),i}class fs{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,r,i)));e.addEventListener(t,r,i);const s=()=>{lr(e.removeEventListener)&&e.removeEventListener(t,r,i)};return this.destroys.push(s),s}destroy(){this.master.debugLog("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class ps{static init(){ps.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in ps.types)ps.types.hasOwnProperty(e)&&(ps.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=ps.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,r=null,i=Array.prototype.slice.call(arguments,1),s=i.length;for(let e=0;e>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r.set(e,4);let n=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return ps.box(ps.types.trak,ps.tkhd(e),ps.mdia(e))}static tkhd(e){let t=e.id,r=e.duration,i=e.presentWidth,s=e.presentHeight;return ps.box(ps.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>>8&255,255&i,0,0,s>>>8&255,255&s,0,0]))}static mdia(e){return ps.box(ps.types.mdia,ps.mdhd(e),ps.hdlr(e),ps.minf(e))}static mdhd(e){let t=e.timescale,r=e.duration;return ps.box(ps.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?ps.constants.HDLR_AUDIO:ps.constants.HDLR_VIDEO,ps.box(ps.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?ps.box(ps.types.smhd,ps.constants.SMHD):ps.box(ps.types.vmhd,ps.constants.VMHD),ps.box(ps.types.minf,t,ps.dinf(),ps.stbl(e))}static dinf(){return ps.box(ps.types.dinf,ps.box(ps.types.dref,ps.constants.DREF))}static stbl(e){return ps.box(ps.types.stbl,ps.stsd(e),ps.box(ps.types.stts,ps.constants.STTS),ps.box(ps.types.stsc,ps.constants.STSC),ps.box(ps.types.stsz,ps.constants.STSZ),ps.box(ps.types.stco,ps.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?ps.box(ps.types.stsd,ps.constants.STSD_PREFIX,ps.mp3(e)):ps.box(ps.types.stsd,ps.constants.STSD_PREFIX,ps.mp4a(e)):"avc"===e.videoType?ps.box(ps.types.stsd,ps.constants.STSD_PREFIX,ps.avc1(e)):ps.box(ps.types.stsd,ps.constants.STSD_PREFIX,ps.hvc1(e))}static mp3(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return ps.box(ps.types[".mp3"],i)}static mp4a(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return ps.box(ps.types.mp4a,i,ps.esds(e))}static esds(e){let t=e.config||[],r=t.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(t).concat([6,1,2]));return ps.box(ps.types.esds,i)}static avc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return ps.box(ps.types.avc1,s,ps.box(ps.types.avcC,t))}static hvc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return ps.box(ps.types.hvc1,s,ps.box(ps.types.hvcC,t))}static mvex(e){return ps.box(ps.types.mvex,ps.trex(e))}static trex(e){let t=e.id,r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return ps.box(ps.types.trex,r)}static moof(e,t){return ps.box(ps.types.moof,ps.mfhd(e.sequenceNumber),ps.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return ps.box(ps.types.mfhd,t)}static traf(e,t){let r=e.id,i=ps.box(ps.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),s=ps.box(ps.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),n=ps.sdtp(e),a=ps.trun(e,n.byteLength+16+16+8+16+8+8);return ps.box(ps.types.traf,i,s,a,n)}static sdtp(e){let t=new Uint8Array(5),r=e.flags;return t[4]=r.isLeading<<6|r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy,ps.box(ps.types.sdtp,t)}static trun(e,t){let r=new Uint8Array(28);t+=36,r.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let i=e.duration,s=e.size,n=e.flags,a=e.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,s>>>24&255,s>>>16&255,s>>>8&255,255&s,n.isLeading<<2|n.dependsOn,n.isDependedOn<<6|n.hasRedundancy<<4|n.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12),ps.box(ps.types.trun,r)}static mdat(e){return ps.box(ps.types.mdat,e)}}ps.init();var ms,_s=Gt((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}));(ms=_s)&&ms.__esModule&&Object.prototype.hasOwnProperty.call(ms,"default")&&ms.default;const gs=[44100,48e3,32e3,0],ys=[22050,24e3,16e3,0],vs=[11025,12e3,8e3,0],bs=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],ws=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],Ss=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];function Es(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),r=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let i=t[1]>>>3&3,s=(6&t[1])>>1,n=(240&t[2])>>>4,a=(12&t[2])>>>2,o=3!==(t[3]>>>6&3)?2:1,d=0,l=0;switch(i){case 0:d=vs[a];break;case 2:d=ys[a];break;case 3:d=gs[a]}switch(s){case 1:n=e[s]&&t=6?(i=5,t=new Array(4),a=s-3):(i=2,t=new Array(2),a=s):-1!==o.indexOf("android")?(i=2,t=new Array(2),a=s):(i=5,a=s,t=new Array(4),s>=6?a=s-3:1===n&&(i=2,t=new Array(2),a=s)),t[0]=i<<3,t[0]|=(15&s)>>>1,t[1]=(15&s)<<7,t[1]|=(15&n)<<3,5===i&&(t[1]|=(15&a)>>>1,t[2]=(1&a)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=zs[s],this.sampling_index=s,this.channel_count=n,this.object_type=i,this.original_object_type=r,this.codec_mimetype="mp4a.40."+i,this.original_codec_mimetype="mp4a.40."+r}}class Gs{constructor(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}get bitsAvailable(){return this.bitLength-this.index}skipBits(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}getBits(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>i,n=8-i;if(n>=e)return r&&(this.index+=e),s>>n-e;{r&&(this.index+=n);const i=e-n;return s<>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}function $s(e){return e[3]|e[2]<<8|e[1]<<16|e[0]<<24}const Hs=new Array(214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72),Vs=new Array(2746333894,1453994832,1736282519,2993693404),Ws=new Array(462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257);function js(e,t,r,i,s){var n=s;n=t+s>e.length&&i+s<=r.length?e.length-t:i+s>r.length&&t+s<=e.length?r.length-i:t+s<=e.length&&i+s<=r.length?s:r.length>24&255,e>>16&255,e>>8&255,255&e)}function Ys(e,t){return t+3>>19)^(i<<23|i>>>9)}function Zs(e,t){var r=new Array(36);r[0]=Ys(t,0),r[1]=Ys(t,4),r[2]=Ys(t,8),r[3]=Ys(t,12);for(var i=0;i<32;i++)r[i+4]=r[i]^Js(r[i+1]^r[i+2]^r[i+3]^e[i]);var s=new Array(4);for(i=35;i>=32;i--)s[35-i]=r[i];var n=function(e){for(var t=new Array(4*e.length),r=0;r>>30)^(i<<10|i>>>22)^(i<<18|i>>>14)^(i<<24|i>>>8)}function Qs(e,t,r){if(null==e||null==e||e.length%16!=0)return console.log("sm4 key is error!"),null;if(null==r||null==r||r.length<=0)return console.log("cipher is error!"),null;if(null==t||null==t||t.length%16!=0)return console.log("iv is error!"),null;for(var i=Ks(e),s=Math.ceil(r.length/16),n=new Array(r.length),a=t.slice(),o=0;o3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t=new Uint8Array(t),r=new Uint8Array(r);const n=e.byteLength;let a=5;for(;an)break;let d=e[a+4],l=!1,c=2;if(i?(s&&(c=3),d=d>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(d)):(d&=31,l=1===d||5===d),l){const i=Qs(t,r,e.slice(a+4+c,a+4+o));e.set(i,a+4+c)}a=a+4+o}return e}Date.now||(Date.now=function(){return(new Date).getTime()}),n({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support")&&-1===e.indexOf("illegal icc")&&!e.indexOf("If you want to help, upload a sample of this file to")&&!e.indexOf("Reserved SBR extensions is not implemented"))})(e)||console.warn("JbPro[❌❌❌][worker]:",e)}}).then((e=>{!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[],s=[],n=null,a=null,o=null,d=null,l=null,c=null,u=!1,h=null,w=null,S=!1,U=!1,we=!!gr(r),Se=0,We=0,Ze=!1,Je=null,et=null,rt=null,ct=[],Et=null,At=null,xt=0,Nt=0,Ot=null,Gt=null,$t=0,Ht=0,Vt=!1,Kt=!1,Qt=!1,nr=null,wr=null,Sr=!1,Er=!0,Ar=()=>{const e=mr();return{debug:e.debug,debugLevel:e.debugLevel,debugUuid:e.debugUuid,useOffscreen:e.useOffscreen,useWCS:e.useWCS,useMSE:e.useMSE,videoBuffer:e.videoBuffer,videoBufferDelay:e.videoBufferDelay,openWebglAlignment:e.openWebglAlignment,playType:e.playType,hasAudio:e.hasAudio,hasVideo:e.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:e.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:e.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:0,networkDelay:e.networkDelay,visibility:!0,useSIMD:e.useSIMD,isRecording:!1,recordType:e.recordType,isNakedFlow:e.isNakedFlow,checkFirstIFrame:e.checkFirstIFrame,audioBufferSize:1024,isM7sCrypto:e.isM7sCrypto,m7sCryptoAudio:e.m7sCryptoAudio,cryptoKey:e.cryptoKey,cryptoIV:e.cryptoIV,isSm4Crypto:e.isSm4Crypto,isSm4CryptoH265V2:e.isSm4CryptoH265V2,sm4CryptoKey:e.sm4CryptoKey,isXorCrypto:e.isXorCrypto,isHls265:!1,isFlv:e.isFlv,isFmp4:e.isFmp4,isMpeg4:e.isMpeg4,isTs:e.isTs,isFmp4Private:e.isFmp4Private,isEmitSEI:e.isEmitSEI,isRecordTypeFlv:!1,isWasmMp4:!1,isChrome:!1,isFirefox:!1,isDropSameTimestampGop:e.isDropSameTimestampGop,mseDecodeAudio:e.mseDecodeAudio,wcsDecodeAudio:e.wcsDecodeAudio,nakedFlowH265DemuxUseNew:e.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:e.mseDecoderUseWorker,mseAutoCleanupSourceBuffer:e.mseAutoCleanupSourceBuffer,mseAutoCleanupMaxBackwardDuration:e.mseAutoCleanupMaxBackwardDuration,mseAutoCleanupMinBackwardDuration:e.mseAutoCleanupMinBackwardDuration,mseCorrectTimeDuration:e.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:e.mseCorrectAudioTimeDuration,nakedFlowDemuxUseNew:e.nakedFlowDemuxUseNew,nakedFlowFps:e.nakedFlowFps,supportMSEDecodeHevc:!1}};"VideoEncoder"in self&&(n={hasInit:!1,isEmitInfo:!1,offscreenCanvas:null,offscreenCanvasCtx:null,decoder:null,init(){n.decoder=new VideoDecoder({output:function(e){if(lr(e.createImageBitmap))e.createImageBitmap().then((t=>{n.offscreenCanvasCtx.drawImage(t,0,0,e.codedWidth,e.codedHeight);let r=n.offscreenCanvas.transferToImageBitmap();postMessage({cmd:T,buffer:r,delay:ni.delay,ts:0},[r]),hr(e)}));else{n.offscreenCanvasCtx.drawImage(e,0,0,e.codedWidth,e.codedHeight);let t=n.offscreenCanvas.transferToImageBitmap();postMessage({cmd:T,buffer:t,delay:ni.delay,ts:0},[t]),hr(e)}},error:function(e){ni.debugError("worker","VideoDecoder error: ",e,e.toString())}})},destroy(){n.reset(),n.decoder&&"closed"!==n.decoder.state&&(n.decoder.close(),n.decoder=null)},decode:function(e,t,r){const i=e[0]>>4==1;if(n.hasInit){const r=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:i?ft:pt});n.decoder.decode(r)}else if(i&&0===e[1]){const t=15&e[0];postMessage({cmd:P,code:t});const r=new Uint8Array(e);postMessage({cmd:M,buffer:r,codecId:t},[r.buffer]);let i=null,s=null;const a=e.slice(5);t===Fe?(s=Tr(a),i={codec:s.codec,description:a}):t===Pe&&(s=Wr(a),i={codec:s.codec,description:a}),s&&s.codecWidth&&s.codecHeight&&(i.codedHeight=s.codecHeight,i.codedWidth=s.codecWidth),n.isEmitInfo||(ni.debugLog("worker","Webcodecs Video Decoder initSize"),postMessage({cmd:k,w:s.codecWidth,h:s.codecHeight}),n.isEmitInfo=!0,n.offscreenCanvas=new OffscreenCanvas(s.codecWidth,s.codecHeight),n.offscreenCanvasCtx=n.offscreenCanvas.getContext("2d"));try{n.decoder.configure(i),n.hasInit=!0}catch(e){ni.debugError("worker","VideoDecoder configure error",e.code,e,e.toString()),e.toString()}}else ni.debugWarn("worker",`VideoDecoder configure has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)},reset(){n.hasInit=!1,n.isEmitInfo=!1,n.offscreenCanvas=null,n.offscreenCanvasCtx=null}});let kr=function(){if(Sr=!0,a)try{a.abort(),a=null,ni.debugLog("worker","abort success")}catch(e){a=null,ni.debugLog("worker","abort catch",e)}},Gr={init(){Gr.lastBuf=null,Gr.vps=null,Gr.sps=null,Gr.pps=null,Gr.streamType=null,Gr.localDts=0,Gr.pendingUnits={},Gr.isSendSeqHeader=!1},destroy(){Gr.lastBuf=null,Gr.vps=null,Gr.sps=null,Gr.pps=null,Gr.streamType=null,Gr.localDts=0,Gr.pendingUnits={},Gr.isSendSeqHeader=!1},dispatch(e){const t=new Uint8Array(e);if(ni._opt.nakedFlowDemuxUseNew){const e=Gr.extractNALu$3(t);if(0===e.length)return void ni.debugLog("worker","dispatch naluArray length is 0");Gr.handleVideoFrames(e)}else Gr.extractNALu$2(t)},getNaluDts(){const e=ni._opt.nakedFlowFps;let t=Gr.localDts;return Gr.localDts=Gr.localDts+parseInt(1e3/e,10),t},getNaluAudioDts(){const e=ni._opt.sampleRate,t=ni._opt.audioBufferSize;return Gr.localDts+parseInt(t/e*1e3)},extractNALu(e){let t,r,i=0,s=e.byteLength,n=0,a=[];for(;i1)for(let e=0;e{const t=Fr(e);t===Ve||t===He?Gr.handleVideoH264Nalu(e):Mr(t)&&i.push(e)})),1===i.length)Gr.handleVideoH264Nalu(i[0]);else if(zr(i)){const e=Fr(i[0]),t=Rr(e);Gr.handleVideoH264NaluList(i,t,e)}else i.forEach((e=>{Gr.handleVideoH264Nalu(e)}))}else if(Gr.streamType===ze)if(ni._opt.nakedFlowH265DemuxUseNew){const t=Gr.handleAddNaluStartCode(e),r=Gr.extractNALu(t);if(0===r.length)return void ni.debugWarn("worker","handleVideoNalu","h265 naluList.length === 0");const i=[];if(r.forEach((e=>{const t=Xr(e);t===dt||t===at||t===st?Gr.handleVideoH265Nalu(e):Jr(t)&&i.push(e)})),1===i.length)Gr.handleVideoH265Nalu(i[0]);else if(ei(i)){const e=Xr(i[0]),t=Qr(e);Gr.handleVideoH265NaluList(i,t,e)}else i.forEach((e=>{Gr.handleVideoH265Nalu(e)}))}else Xr(e)===dt?Gr.extractH265PPS(e):Gr.handleVideoH265Nalu(e)},extractH264PPS(e){const t=Gr.handleAddNaluStartCode(e);Gr.extractNALu(t).forEach((e=>{Pr(Fr(e))?Gr.extractH264SEI(e):Gr.handleVideoH264Nalu(e)}))},extractH265PPS(e){const t=Gr.handleAddNaluStartCode(e);Gr.extractNALu(t).forEach((e=>{Zr(Xr(e))?Gr.extractH265SEI(e):Gr.handleVideoH265Nalu(e)}))},extractH264SEI(e){const t=Gr.handleAddNaluStartCode(e);Gr.extractNALu(t).forEach((e=>{Gr.handleVideoH264Nalu(e)}))},extractH265SEI(e){const t=Gr.handleAddNaluStartCode(e);Gr.extractNALu(t).forEach((e=>{Gr.handleVideoH265Nalu(e)}))},handleAddNaluStartCode(e){const t=[0,0,0,1],r=new Uint8Array(e.length+t.length);return r.set(t),r.set(e,t.length),r},handleVideoH264Nalu(e){const t=Fr(e);switch(t){case He:Gr.sps=e;break;case Ve:Gr.pps=e}if(Gr.isSendSeqHeader){if(Gr.sps&&Gr.pps){const e=Cr({sps:Gr.sps,pps:Gr.pps}),t=Gr.localDts;ni.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null}if(Mr(t)){const r=Rr(t),i=Gr.getNaluDts(),s=Lr(e,r);Gr.doDecode(s,{type:ae,ts:i,isIFrame:r,cts:0})}}else if(Gr.sps&&Gr.pps){Gr.isSendSeqHeader=!0;const e=Cr({sps:Gr.sps,pps:Gr.pps});ni.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null}},handleVideoH264NaluList(e,t,r){if(Gr.isSendSeqHeader){const i=Gr.getNaluDts(),s=Ir(e.reduce(((e,t)=>{const r=tr(e),i=tr(t),s=new Uint8Array(r.byteLength+i.byteLength);return s.set(r,0),s.set(i,r.byteLength),s})),t);Gr.doDecode(s,{type:ae,ts:i,isIFrame:t,cts:0}),ni.debugLog("worker",`handleVideoH264NaluList list size is ${e.length} package length is ${s.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},handleVideoH265Nalu(e){const t=Xr(e);switch(t){case st:Gr.vps=e;break;case at:Gr.sps=e;break;case dt:Gr.pps=e}if(Gr.isSendSeqHeader){if(Gr.vps&&Gr.sps&&Gr.pps){const e=qr({vps:Gr.vps,sps:Gr.sps,pps:Gr.pps}),t=Gr.localDts;ni.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Gr.vps=null,Gr.sps=null,Gr.pps=null}if(Jr(t)){const r=Qr(t),i=Gr.getNaluDts(),s=Yr(e,r);Gr.doDecode(s,{type:ae,ts:i,isIFrame:r,cts:0})}}else if(Gr.vps&&Gr.sps&&Gr.pps){Gr.isSendSeqHeader=!0;const e=qr({vps:Gr.vps,sps:Gr.sps,pps:Gr.pps});ni.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Gr.vps=null,Gr.sps=null,Gr.pps=null}},handleVideoH265NaluList(e,t,r){if(Gr.isSendSeqHeader){const i=Gr.getNaluDts(),s=Kr(e.reduce(((e,t)=>{const r=tr(e),i=tr(t),s=new Uint8Array(r.byteLength+i.byteLength);return s.set(r,0),s.set(i,r.byteLength),s})),t);Gr.doDecode(s,{type:ae,ts:i,isIFrame:t,cts:0}),ni.debugLog("worker",`handleVideoH265NaluList list size is ${e.length} package length is ${s.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},doDecode(e,t){ni.calcNetworkDelay(t.ts),t.isIFrame&&ni.calcIframeIntervalTimestamp(t.ts),ni.decode(e,t)},handleVideoFrames(e){if(!Gr.streamVideoType)for(let t of e)if(Gr.streamVideoType=cr(t),Gr.streamVideoType)break;Gr.streamVideoType?Gr.streamVideoType===Re?Gr.handleVideoH264Frames(e):this.streamVideoType===ze&&Gr.handleVideoH265Frames(e):ni.debugWarn("worker","handleVideoFrames","streamVideoType is null")},handleVideoH264Frames(e){let t=[],r=[],i=!1,s=!1;Gr.pendingUnits.units&&(t=Gr.pendingUnits.units,s=Gr.pendingUnits.vcl,i=Gr.pendingUnits.iFrame,Gr.pendingUnits={});let n={};for(let a of e){if(a.byteLength<4)continue;const e=Fr(a);let o=!1,d=e===qe;e!==je&&e!==qe||(n=Gr.parseVideo264Header(a),o=!0),t.length&&s&&(n.isfms||!o)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,s=!1),t.push(a),i=i||d,s=s||o}t.length&&(Gr.pendingUnits={units:t,vcl:s,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,s=null;if(t.forEach((e=>{const t=31&e[0];switch(t){case Ve:Gr.pps=e;break;case He:Gr.sps=e;break;case Ye:s=e}if(Mr(t)){const t=tr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Gr.isSendSeqHeader&&Gr.sps&&Gr.pps){Gr.isSendSeqHeader=!0;const e=Dr({sps:Gr.sps,pps:Gr.pps});ni.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null}if(Gr.isSendSeqHeader){if(Gr.sps&&Gr.pps){const e=Dr({sps:Gr.sps,pps:Gr.pps}),t=Gr.localDts;ni.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null}if(i){const e=Gr.getNaluDts(),t=Ir(i,r);ni._opt.isEmitSEI&&s&&postMessage({cmd:X,buffer:s,ts:e},[s.buffer]),Gr.doDecode(t,{type:ae,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames(e){let t=[],r=[],i=!1,s=!1;Gr.pendingUnits.units&&(t=Gr.pendingUnits.units,s=Gr.pendingUnits.vcl,i=Gr.pendingUnits.iFrame,Gr.pendingUnits={});let n={};for(let a of e){if(a.byteLength<4)continue;const e=Xr(a);let o=!1,d=Qr(e);Jr(e)&&(n=this.parseVideo265Header(a),o=!0),t.length&&s&&(n.isfms||!o)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,s=!1),t.push(a),i=i||d,s=s||o}t.length&&(Gr.pendingUnits={units:t,vcl:s,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,s=null;if(t.forEach((e=>{const t=e[0]>>>1&63;switch(t){case dt:Gr.pps=e;break;case at:Gr.sps=e;break;case st:Gr.vps=e;break;case ht:case ut:s=e}if(Jr(t)){const t=tr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Gr.isSendSeqHeader&&Gr.sps&&Gr.pps&&Gr.vps){Gr.isSendSeqHeader=!0;const e=qr({sps:Gr.sps,pps:Gr.pps,vps:Gr.vps});ni.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null,Gr.vps=null}if(Gr.isSendSeqHeader){if(Gr.sps&&Gr.pps&&Gr.vps){const e=qr({sps:Gr.sps,pps:Gr.pps,vps:Gr.vps}),t=Gr.localDts;ni.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null,Gr.vps=null}if(i){const e=Gr.getNaluDts(),t=Kr(i,r);ni._opt.isEmitSEI&&s&&postMessage({cmd:X,buffer:s,ts:e},[s.buffer]),Gr.doDecode(t,{type:ae,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames_1(e){e.forEach((e=>{Gr.handleVideoNalu(e)}))},parseVideo264Header(e){const t=new Gs(e);return t.readUByte(),{isfms:0===t.readUEG(),sType:t.readUEG()}},parseVideo265Header(e){const t=new Gs(e);return t.readUByte(),{nalType:t.readBits(6),isfms:0===t.readBits(1),sType:t.readBits(3)}}},$r={LOG_NAME:"worker fmp4Demuxer",mp4Box:null,offset:0,videoTrackId:null,audioTrackId:null,isHevc:!1,listenMp4Box(){$r.mp4Box=Oi.createFile(),$r.mp4Box.onReady=$r.onReady,$r.mp4Box.onError=$r.onError,$r.mp4Box.onSamples=$r.onSamples},initTransportDescarmber(){$r.transportDescarmber=new Hi},_getSeqHeader(e){const t=$r.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new Oi.DataStream(void 0,0,Oi.DataStream.BIG_ENDIAN);let r=[];e.avcC?(e.avcC.write(t),r=[23,0,0,0,0]):($r.isHevc=!0,ni.isHevc=!0,e.hvcC.write(t),r=[28,0,0,0,0]);const i=new Uint8Array(t.buffer,8),s=new Uint8Array(r.length+i.length);return s.set(r,0),s.set(i,r.length),s}return null},onReady(e){ni.debugLog($r.LOG_NAME,"onReady()");const t=e.videoTracks[0],r=e.audioTracks[0];if(t){$r.videoTrackId=t.id;const e=$r._getSeqHeader(t);e&&(ni.debugLog($r.LOG_NAME,"seqHeader"),ni.decodeVideo(e,0,!0,0)),$r.mp4Box.setExtractionOptions(t.id)}if(r&&ni._opt.hasAudio){$r.audioTrackId=r.id;const e=r.audio||{},t=Wt.indexOf(e.sample_rate),i=r.codec.replace("mp4a.40.","");$r.mp4Box.setExtractionOptions(r.id);const s=jt({profile:parseInt(i,10),sampleRate:t,channel:e.channel_count});ni.debugLog($r.LOG_NAME,"aacADTSHeader"),ni.decodeAudio(s,0)}$r.mp4Box.start()},onError(e){ni.debugError($r.LOG_NAME,"mp4Box onError",e)},onSamples(e,t,r){if(e===$r.videoTrackId){for(const e of r){const t=e.data,r=e.is_sync,i=1e3*e.cts/e.timescale;e.duration,e.timescale,r&&ni.calcIframeIntervalTimestamp(i);let s=null;s=$r.isHevc?Kr(t,r):Ir(t,r),ni.decode(s,{type:ae,ts:i,isIFrame:r,cts:0})}$r.mp4Box.removeUsedSamples(e)}else if(e===$r.audioTrackId){if(ni._opt.hasAudio){for(const e of r){const t=e.data,r=1e3*e.cts/e.timescale;e.duration,e.timescale;const i=new Uint8Array(t.byteLength+2);i.set([175,1],0),i.set(t,2),ni.decode(i,{type:ne,ts:r,isIFrame:!1,cts:0})}$r.mp4Box.removeUsedSamples(e)}}else ni.debugWarn($r.LOG_NAME,"onSamples() trackId error",e)},dispatch(e){let t=new Uint8Array(e);$r.transportDescarmber&&(t=$r.transportDescarmber.transport(t)),t.buffer.fileStart=$r.offset,$r.offset+=t.byteLength,$r.mp4Box.appendBuffer(t.buffer)},destroy(){$r.mp4Box&&($r.mp4Box.stop(),$r.mp4Box.flush(),$r.mp4Box.destroy(),$r.mp4Box=null),$r.transportDescarmber&&($r.transportDescarmber.destroy(),$r.transportDescarmber=null),$r.offset=0,$r.videoTrackId=null,$r.audioTrackId=null,$r.isHevc=!1}},jr={LOG_NAME:"worker mpeg4Demuxer",lastBuffer:new Uint8Array(0),parsedOffset:0,firstStartCodeOffset:0,secondStartCodeOffset:0,state:"init",hasInitVideoCodec:!1,localDts:0,dispatch(e){const t=new Uint8Array(e);jr.extractNALu(t)},destroy(){jr.lastBuffer=new Uint8Array(0),jr.parsedOffset=0,jr.firstStartCodeOffset=0,jr.secondStartCodeOffset=0,jr.state="init",jr.hasInitVideoCodec=!1,jr.localDts=0},extractNALu(e){if(!e||e.byteLength<1)return void ni.debugWarn(jr.LOG_NAME,"extractNALu() buffer error",e);const t=new Uint8Array(jr.lastBuffer.length+e.length);for(t.set(jr.lastBuffer,0),t.set(new Uint8Array(e),jr.lastBuffer.length),jr.lastBuffer=t;;){if("init"===jr.state){let e=!1;for(;jr.lastBuffer.length-jr.parsedOffset>=4;)if(0===jr.lastBuffer[jr.parsedOffset])if(0===jr.lastBuffer[jr.parsedOffset+1])if(1===jr.lastBuffer[jr.parsedOffset+2]){if(182===jr.lastBuffer[jr.parsedOffset+3]){jr.state="findFirstStartCode",jr.firstStartCodeOffset=jr.parsedOffset,jr.parsedOffset+=4,e=!0;break}jr.parsedOffset++}else jr.parsedOffset++;else jr.parsedOffset++;else jr.parsedOffset++;if(e)continue;break}if("findFirstStartCode"===jr.state){let e=!1;for(;jr.lastBuffer.length-jr.parsedOffset>=4;)if(0===jr.lastBuffer[jr.parsedOffset])if(0===jr.lastBuffer[jr.parsedOffset+1])if(1===jr.lastBuffer[jr.parsedOffset+2]){if(182===jr.lastBuffer[jr.parsedOffset+3]){jr.state="findSecondStartCode",jr.secondStartCodeOffset=jr.parsedOffset,jr.parsedOffset+=4,e=!0;break}jr.parsedOffset++}else jr.parsedOffset++;else jr.parsedOffset++;else jr.parsedOffset++;if(e)continue;break}if("findSecondStartCode"===jr.state){if(!(jr.lastBuffer.length-jr.parsedOffset>0))break;{let e,t,r=192&jr.lastBuffer[jr.parsedOffset];e=0==r?jr.secondStartCodeOffset-14:jr.secondStartCodeOffset;let i=0==(192&jr.lastBuffer[jr.firstStartCodeOffset+4]);if(i){if(jr.firstStartCodeOffset-14<0)return void ni.debugWarn(jr.LOG_NAME,"firstStartCodeOffset -14 is",jr.firstStartCodeOffset-14);jr.hasInitVideoCodec||(jr.hasInitVideoCodec=!0,ni.debugLog(jr.LOG_NAME,"setCodec"),oi.setCodec(Me,"")),t=jr.lastBuffer.subarray(jr.firstStartCodeOffset-14,e)}else t=jr.lastBuffer.subarray(jr.firstStartCodeOffset,e);let s=jr.getNaluDts();jr.hasInitVideoCodec?(postMessage({cmd:O,type:Ue,value:t.byteLength}),postMessage({cmd:O,type:xe,value:s}),Se=s,oi.decode(t,i?1:0,s)):ni.debugWarn(jr.LOG_NAME,"has not init video codec"),jr.lastBuffer=jr.lastBuffer.subarray(e),jr.firstStartCodeOffset=0==r?14:0,jr.parsedOffset=jr.firstStartCodeOffset+4,jr.state="findFirstStartCode"}}}},getNaluDts(){let e=jr.localDts;return jr.localDts=jr.localDts+40,e}},ii={TAG_NAME:"worker TsLoaderV2",first_parse_:!0,tsPacketSize:0,syncOffset:0,pmt_:null,config_:null,media_info_:new Ns,timescale_:90,duration_:0,pat_:{version_number:0,network_pid:0,program_map_pid:{}},current_program_:null,current_pmt_pid_:-1,program_pmt_map_:{},pes_slice_queues_:{},section_slice_queues_:{},video_metadata_:{vps:null,sps:null,pps:null,details:null},audio_metadata_:{codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},last_pcr_:null,audio_last_sample_pts_:void 0,aac_last_incomplete_data_:null,has_video_:!1,has_audio_:!1,video_init_segment_dispatched_:!1,audio_init_segment_dispatched_:!1,video_metadata_changed_:!1,audio_metadata_changed_:!1,loas_previous_frame:null,video_track_:{type:"video",id:1,sequenceNumber:0,samples:[],length:0},audio_track_:{type:"audio",id:2,sequenceNumber:0,samples:[],length:0},_remainingPacketData:null,init(){},destroy(){ii.media_info_=null,ii.pes_slice_queues_=null,ii.section_slice_queues_=null,ii.video_metadata_=null,ii.audio_metadata_=null,ii.aac_last_incomplete_data_=null,ii.video_track_=null,ii.audio_track_=null,ii._remainingPacketData=null},probe(e){let t=new Uint8Array(e),r=-1,i=188;if(t.byteLength<=3*i)return{needMoreData:!0};for(;-1===r;){let e=Math.min(1e3,t.byteLength-3*i);for(let s=0;s=4&&(r-=4),{match:!0,consumed:0,ts_packet_size:i,sync_offset:r})},_initPmt:()=>({program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}),dispatch(e){ii._remainingPacketData&&(e=hs(ii._remainingPacketData,e),ii._remainingPacketData=null);let t=e.buffer;const r=ii.parseChunks(t);r?ii._remainingPacketData=e.subarray(r):e.length>>6;r[1];let n=(31&r[1])<<8|r[2],a=(48&r[3])>>>4,o=15&r[3],d=!(!ii.pmt_||ii.pmt_.pcr_pid!==n),l={},c=4;if(2==a||3==a){let e=r[4];if(e>0&&(d||3==a)&&(l.discontinuity_indicator=(128&r[5])>>>7,l.random_access_indicator=(64&r[5])>>>6,l.elementary_stream_priority_indicator=(32&r[5])>>>5,(16&r[5])>>>4)){let e=300*(r[6]<<25|r[7]<<17|r[8]<<9|r[9]<<1|r[10]>>>7)+((1&r[10])<<8|r[11]);ii.last_pcr_=e}if(2==a||5+e===188){t+=188,204===ii.tsPacketSize&&(t+=16);continue}c=5+e}if(1==a||3==a)if(0===n||n===ii.current_pmt_pid_||null!=ii.pmt_&&ii.pmt_.pid_stream_type[n]===Ls){let r=188-c;ii.handleSectionSlice(e,t+c,r,{pid:n,payload_unit_start_indicator:s,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}else if(null!=ii.pmt_&&null!=ii.pmt_.pid_stream_type[n]){let r=188-c,i=ii.pmt_.pid_stream_type[n];n!==ii.pmt_.common_pids.h264&&n!==ii.pmt_.common_pids.h265&&n!==ii.pmt_.common_pids.adts_aac&&n!==ii.pmt_.common_pids.loas_aac&&n!==ii.pmt_.common_pids.ac3&&n!==ii.pmt_.common_pids.eac3&&n!==ii.pmt_.common_pids.opus&&n!==ii.pmt_.common_pids.mp3&&!0!==ii.pmt_.pes_private_data_pids[n]&&!0!==ii.pmt_.timed_id3_pids[n]&&!0!==ii.pmt_.synchronous_klv_pids[n]&&!0!==ii.pmt_.asynchronous_klv_pids[n]||ii.handlePESSlice(e,t+c,r,{pid:n,stream_type:i,payload_unit_start_indicator:s,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}t+=188,204===ii.tsPacketSize&&(t+=16)}return ii.dispatchAudioVideoMediaSegment(),t},handleSectionSlice(e,t,r,i){let s=new Uint8Array(e,t,r),n=ii.section_slice_queues_[i.pid];if(i.payload_unit_start_indicator){let a=s[0];if(null!=n&&0!==n.total_length){let s=new Uint8Array(e,t+1,Math.min(r,a));n.slices.push(s),n.total_length+=s.byteLength,n.total_length===n.expected_length?ii.emitSectionSlices(n,i):ii.clearSlices(n,i)}for(let o=1+a;o=n.expected_length&&ii.clearSlices(n,i),o+=d.byteLength}}else if(null!=n&&0!==n.total_length){let s=new Uint8Array(e,t,Math.min(r,n.expected_length-n.total_length));n.slices.push(s),n.total_length+=s.byteLength,n.total_length===n.expected_length?ii.emitSectionSlices(n,i):n.total_length>=n.expected_length&&ii.clearSlices(n,i)}},handlePESSlice(e,t,r,i){let s=new Uint8Array(e,t,r),n=s[0]<<16|s[1]<<8|s[2];s[3];let a=s[4]<<8|s[5];if(i.payload_unit_start_indicator){if(1!==n)return void ni.debugWarn(ii.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${n}`);let e=ii.pes_slice_queues_[i.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?ii.emitPESSlices(e,i):ii.clearSlices(e,i)),ii.pes_slice_queues_[i.pid]=new Ps,ii.pes_slice_queues_[i.pid].random_access_indicator=i.random_access_indicator}if(null==ii.pes_slice_queues_[i.pid])return;let o=ii.pes_slice_queues_[i.pid];o.slices.push(s),i.payload_unit_start_indicator&&(o.expected_length=0===a?0:a+6),o.total_length+=s.byteLength,o.expected_length>0&&o.expected_length===o.total_length?ii.emitPESSlices(o,i):o.expected_length>0&&o.expected_length>>6,o=t[8];2!==a&&3!==a||(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,n=3===a?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:r);let d,l=9+o;if(0!==s){if(s<3+o)return void ni.debugWarn(ii.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");d=s-3-o}else d=t.byteLength-l;let c=t.subarray(l,l+d);switch(e.stream_type){case As:case Bs:ii.parseMP3Payload(c,r);break;case Us:ii.pmt_.common_pids.opus===e.pid||ii.pmt_.common_pids.ac3===e.pid||ii.pmt_.common_pids.eac3===e.pid||(ii.pmt_.asynchronous_klv_pids[e.pid]?ii.parseAsynchronousKLVMetadataPayload(c,e.pid,i):ii.pmt_.smpte2038_pids[e.pid]?ii.parseSMPTE2038MetadataPayload(c,r,n,e.pid,i):ii.parsePESPrivateDataPayload(c,r,n,e.pid,i));break;case xs:ii.parseADTSAACPayload(c,r);break;case ks:ii.parseLOASAACPayload(c,r);break;case Ts:case Cs:break;case Ds:ii.pmt_.timed_id3_pids[e.pid]?ii.parseTimedID3MetadataPayload(c,r,n,e.pid,i):ii.pmt_.synchronous_klv_pids[e.pid]&&ii.parseSynchronousKLVMetadataPayload(c,r,n,e.pid,i);break;case Is:ii.parseH264Payload(c,r,n,e.random_access_indicator);break;case Fs:ii.parseH265Payload(c,r,n,e.random_access_indicator)}}else if((188===i||191===i||240===i||241===i||255===i||242===i||248===i)&&e.stream_type===Us){let r,n=6;r=0!==s?s:t.byteLength-n;let a=t.subarray(n,n+r);ii.parsePESPrivateDataPayload(a,void 0,void 0,e.pid,i)}}else ni.debugError(ii.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${r}`)},parsePAT(e){let t=e[0];if(0!==t)return void Log.e(ii.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let r=(15&e[1])<<8|e[2];e[3],e[4];let i=(62&e[5])>>>1,s=1&e[5],n=e[6];e[7];let a=null;if(1===s&&0===n)a={version_number:0,network_pid:0,program_pmt_pid:{}},a.version_number=i;else if(a=ii.pat_,null==a)return;let o=r-5-4,d=-1,l=-1;for(let t=8;t<8+o;t+=4){let r=e[t]<<8|e[t+1],i=(31&e[t+2])<<8|e[t+3];0===r?a.network_pid=i:(a.program_pmt_pid[r]=i,-1===d&&(d=r),-1===l&&(l=i))}1===s&&0===n&&(null==ii.pat_&&ni.debugLog(ii.TAG_NAME,`Parsed first PAT: ${JSON.stringify(a)}`),ii.pat_=a,ii.current_program_=d,ii.current_pmt_pid_=l)},parsePMT(e){let t=e[0];if(2!==t)return void ni.debugError(ii.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let r,i=(15&e[1])<<8|e[2],s=e[3]<<8|e[4],n=(62&e[5])>>>1,a=1&e[5],o=e[6];if(e[7],1===a&&0===o)r=ii._initPmt(),r.program_number=s,r.version_number=n,ii.program_pmt_map_[s]=r;else if(r=ii.program_pmt_map_[s],null==r)return;r.pcr_pid=(31&e[8])<<8|e[9];let d=(15&e[10])<<8|e[11],l=12+d,c=i-9-d-4;for(let t=l;t0){for(let i=t+5;i0)for(let i=t+5;iii.has_video_&&ii.has_audio_?ii.video_init_segment_dispatched_&&ii.audio_init_segment_dispatched_:ii.has_video_&&!ii.has_audio_?ii.video_init_segment_dispatched_:!(ii.has_video_||!ii.has_audio_)&&ii.audio_init_segment_dispatched_,dispatchVideoInitSegment(){let e=ii.video_metadata_.details,t={type:"video"};t.id=ii.video_track_.id,t.timescale=1e3,t.duration=ii.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;let r=t.frameRate.fps_den,i=t.frameRate.fps_num;if(t.refSampleDuration=r/i*1e3,t.codec=e.codec_mimetype,ii.video_metadata_.vps){ni.isHevc=!0;let e=ii.video_metadata_.vps.data.subarray(4),r=ii.video_metadata_.sps.data.subarray(4),i=ii.video_metadata_.pps.data.subarray(4);t.hvcc=qr({vps:e,sps:r,pps:i}),0==ii.video_init_segment_dispatched_&&ni.debugLog(ii.TAG_NAME,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.hvcc&&ni.decodeVideo(t.hvcc,0,!0,0)}else{let e=ii.video_metadata_.sps.data.subarray(4),r=ii.video_metadata_.pps.data.subarray(4);t.avcc=Dr({sps:e,pps:r}),0==ii.video_init_segment_dispatched_&&ni.debugLog(ii.TAG_NAME,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.avcc&&ni.decodeVideo(t.avcc,0,!0,0)}ii.video_init_segment_dispatched_=!0,ii.video_metadata_changed_=!1;let s=ii.media_info_;s.hasVideo=!0,s.width=t.codecWidth,s.height=t.codecHeight,s.fps=t.frameRate.fps,s.profile=t.profile,s.level=t.level,s.refFrames=e.ref_frames,s.chromaFormat=e.chroma_format_string,s.sarNum=t.sarRatio.width,s.sarDen=t.sarRatio.height,s.videoCodec=t.codec,s.hasAudio&&s.audioCodec?s.mimeType=`video/mp2t; codecs="${s.videoCodec},${s.audioCodec}"`:s.mimeType=`video/mp2t; codecs="${s.videoCodec}"`},dispatchVideoMediaSegment(){ii.isInitSegmentDispatched()&&ii.video_track_.length&&ii._preDoDecode()},dispatchAudioMediaSegment(){ii.isInitSegmentDispatched()&&ii.audio_track_.length&&ii._preDoDecode()},dispatchAudioVideoMediaSegment(){ii.isInitSegmentDispatched()&&(ii.audio_track_.length||ii.video_track_.length)&&ii._preDoDecode()},parseADTSAACPayload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;if(ii.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+ii.aac_last_incomplete_data_.byteLength);t.set(ii.aac_last_incomplete_data_,0),t.set(e,ii.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/ii.timescale_),"aac"===ii.audio_metadata_.codec){if(null==t&&null!=ii.audio_last_sample_pts_)r=1024/ii.audio_metadata_.sampling_frequency*1e3,i=ii.audio_last_sample_pts_+r;else if(null==t)return void ni.debugWarn(ii.TAG_NAME,"AAC: Unknown pts");if(ii.aac_last_incomplete_data_&&ii.audio_last_sample_pts_){r=1024/ii.audio_metadata_.sampling_frequency*1e3;let e=ii.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(ni.debugWarn(ii.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let s,n=new Zt(e),a=null,o=i;for(;null!=(a=n.readNextAACFrame());){r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},ii.dispatchAudioInitSegment(e)):ii.detectAudioMetadataChange(e)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(e)),s=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let n={payload:i,length:i.byteLength,pts:t,dts:t,type:ne};ii.audio_track_.samples.push(n),ii.audio_track_.length+=i.byteLength,o+=r}n.hasIncompleteData()&&(ii.aac_last_incomplete_data_=n.getIncompleteData()),s&&(ii.audio_last_sample_pts_=s)},parseLOASAACPayload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;if(ii.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+ii.aac_last_incomplete_data_.byteLength);t.set(ii.aac_last_incomplete_data_,0),t.set(e,ii.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/ii.timescale_),"aac"===ii.audio_metadata_.codec){if(null==t&&null!=ii.audio_last_sample_pts_)r=1024/ii.audio_metadata_.sampling_frequency*1e3,i=ii.audio_last_sample_pts_+r;else if(null==t)return void ni.debugWarn(ii.TAG_NAME,"AAC: Unknown pts");if(ii.aac_last_incomplete_data_&&ii.audio_last_sample_pts_){r=1024/ii.audio_metadata_.sampling_frequency*1e3;let e=ii.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(ni.debugWarn(ii.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let s,n=new Jt(e),a=null,o=i;for(;null!=(a=n.readNextAACFrame(or(this.loas_previous_frame)?void 0:this.loas_previous_frame));){ii.loas_previous_frame=a,r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},ii.dispatchAudioInitSegment(e)):ii.detectAudioMetadataChange(e)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(e)),s=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let n={payload:i,length:i.byteLength,pts:t,dts:t,type:ne};ii.audio_track_.samples.push(n),ii.audio_track_.length+=i.byteLength,o+=r}n.hasIncompleteData()&&(ii.aac_last_incomplete_data_=n.getIncompleteData()),s&&(ii.audio_last_sample_pts_=s)},parseAC3Payload(e,t){},parseEAC3Payload(e,t){},parseOpusPayload(e,t){},parseMP3Payload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;let r=[44100,48e3,32e3,0],i=[22050,24e3,16e3,0],s=[11025,12e3,8e3,0],n=e[1]>>>3&3,a=(6&e[1])>>1;e[2];let o=(12&e[2])>>>2,d=3!=(e[3]>>>6&3)?2:1,l=0,c=34;switch(n){case 0:l=s[o];break;case 2:l=i[o];break;case 3:l=r[o]}switch(a){case 1:c=34;break;case 2:c=33;break;case 3:c=32}const u={};u.object_type=c,u.sample_rate=l,u.channel_count=d,u.data=e;const h={codec:"mp3",data:u};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"mp3",object_type:c,sample_rate:l,channel_count:d},ii.dispatchAudioInitSegment(h)):ii.detectAudioMetadataChange(h)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(h));let f={payload:e,length:e.byteLength,pts:t/ii.timescale_,dts:t/ii.timescale_,type:ne};ii.audio_track_.samples.push(f),ii.audio_track_.length+=e.byteLength},detectAudioMetadataChange(e){if(e.codec!==ii.audio_metadata_.codec)return ni.debugLog(ii.TAG_NAME,`Audio: Audio Codecs changed from ${ii.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===ii.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==ii.audio_metadata_.audio_object_type)return ni.debugLog(ii.TAG_NAME,`AAC: AudioObjectType changed from ${ii.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==ii.audio_metadata_.sampling_freq_index)return ni.debugLog(ii.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==ii.audio_metadata_.channel_config)return ni.debugLog(ii.TAG_NAME,`AAC: Channel configuration changed from ${ii.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===ii.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==ii.audio_metadata_.sampling_frequency)return ni.debugLog(ii.TAG_NAME,`AC3: Sampling Frequency changed from ${ii.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==ii.audio_metadata_.bit_stream_identification)return ni.debugLog(ii.TAG_NAME,`AC3: Bit Stream Identification changed from ${ii.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==ii.audio_metadata_.bit_stream_mode)return ni.debugLog(ii.TAG_NAME,`AC3: BitStream Mode changed from ${ii.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==ii.audio_metadata_.channel_mode)return ni.debugLog(ii.TAG_NAME,`AC3: Channel Mode changed from ${ii.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==ii.audio_metadata_.low_frequency_effects_channel_on)return ni.debugLog(ii.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${ii.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===ii.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==ii.audio_metadata_.sample_rate)return ni.debugLog(ii.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==ii.audio_metadata_.channel_count)return ni.debugLog(ii.TAG_NAME,`Opus: Channel count changed from ${ii.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===ii.audio_metadata_.codec){const t=e.data;if(t.object_type!==ii.audio_metadata_.object_type)return ni.debugLog(ii.TAG_NAME,`MP3: AudioObjectType changed from ${ii.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==ii.audio_metadata_.sample_rate)return ni.debugLog(ii.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==ii.audio_metadata_.channel_count)return ni.debugLog(ii.TAG_NAME,`MP3: Channel count changed from ${ii.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1},dispatchAudioInitSegment(e){let t={type:"audio"};if(t.id=ii.audio_track_.id,t.timescale=1e3,t.duration=ii.duration_,"aac"===ii.audio_metadata_.codec){let r="aac"===e.codec?e.data:null,i=new Os(r);t.audioSampleRate=i.sampling_rate,t.audioSampleRateIndex=i.sampling_index,t.channelCount=i.channel_count,t.codec=i.codec_mimetype,t.originalCodec=i.original_codec_mimetype,t.config=i.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale;const s=jt({profile:ni._opt.mseDecodeAudio?i.object_type:i.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});ni.decodeAudio(s,0)}else"ac-3"===ii.audio_metadata_.codec||"ec-3"===ii.audio_metadata_.codec||"opus"===ii.audio_metadata_.codec||"mp3"===ii.audio_metadata_.codec&&(t.audioSampleRate=ii.audio_metadata_.sample_rate,t.channelCount=ii.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==ii.audio_init_segment_dispatched_&&ni.debugLog(ii.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),ii.audio_init_segment_dispatched_=!0,ii.video_metadata_changed_=!1;let r=ii.media_info_;r.hasAudio=!0,r.audioCodec=t.originalCodec,r.audioSampleRate=t.audioSampleRate,r.audioChannelCount=t.channelCount,r.hasVideo&&r.videoCodec?r.mimeType=`video/mp2t; codecs="${r.videoCodec},${r.audioCodec}"`:r.mimeType=`video/mp2t; codecs="${r.audioCodec}"`},dispatchPESPrivateDataDescriptor(e,t,r){},parsePESPrivateDataPayload(e,t,r,i,s){let n=new Rs;if(n.pid=i,n.stream_id=s,n.len=e.byteLength,n.data=e,null!=t){let e=Math.floor(t/ii.timescale_);n.pts=e}else n.nearest_pts=ii.getNearestTimestampMilliseconds();if(null!=r){let e=Math.floor(r/ii.timescale_);n.dts=e}},parseTimedID3MetadataPayload(e,t,r,i,s){ni.debugLog(ii.TAG_NAME,`Timed ID3 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${s}`)},parseSynchronousKLVMetadataPayload(e,t,r,i,s){ni.debugLog(ii.TAG_NAME,`Synchronous KLV Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${s}`)},parseAsynchronousKLVMetadataPayload(e,t,r){ni.debugLog(ii.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${r}`)},parseSMPTE2038MetadataPayload(e,t,r,i,s){ni.debugLog(ii.TAG_NAME,`SMPTE 2038 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${s}`)},getNearestTimestampMilliseconds:()=>null!=ii.audio_last_sample_pts_?Math.floor(ii.audio_last_sample_pts_):null!=ii.last_pcr_?Math.floor(ii.last_pcr_/300/ii.timescale_):void 0,_preDoDecode(){const e=ii.video_track_,t=ii.audio_track_;let r=e.samples;t.samples.length>0&&(r=e.samples.concat(t.samples),r=r.sort(((e,t)=>e.dts-t.dts))),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===ae?ii._doDecodeVideo({...e,payload:t}):e.type===ne&&ii._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0},_doDecodeVideo(e){const t=new Uint8Array(e.payload);let r=null;r=e.isHevc?Kr(t,e.isIFrame):Ir(t,e.isIFrame),e.isIFrame&&ni.calcIframeIntervalTimestamp(e.dts);let i=ni.cryptoPayload(r,e.isIFrame);ni.decode(i,{type:ae,ts:e.dts,isIFrame:e.isIFrame,cts:e.cts})},_doDecodeAudio(e){const t=new Uint8Array(e.payload);let r=t;gr(ni._opt.m7sCryptoAudio)&&(r=ni.cryptoPayloadAudio(t)),ni.decode(r,{type:ne,ts:e.dts,isIFrame:!1,cts:0})}},si=null;vr()&&(si={TAG_NAME:"worker MediaSource",_resetInIt(){si.isAvc=null,si.isAAC=null,si.videoInfo={},si.videoMeta={},si.audioMeta={},si.sourceBuffer=null,si.audioSourceBuffer=null,si.hasInit=!1,si.hasAudioInit=!1,si.isAudioInitInfo=!1,si.videoMimeType="",si.audioMimeType="",si.cacheTrack={},si.cacheAudioTrack={},si.timeInit=!1,si.sequenceNumber=0,si.audioSequenceNumber=0,si.firstRenderTime=null,si.firstAudioTime=null,si.mediaSourceAppendBufferFull=!1,si.mediaSourceAppendBufferError=!1,si.mediaSourceAddSourceBufferError=!1,si.mediaSourceBufferError=!1,si.mediaSourceError=!1,si.prevTimestamp=null,si.decodeDiffTimestamp=null,si.prevDts=null,si.prevAudioDts=null,si.prevPayloadBufferSize=0,si.isWidthOrHeightChanged=!1,si.prevTs=null,si.prevAudioTs=null,si.eventListenList=[],si.pendingRemoveRanges=[],si.pendingSegments=[],si.pendingAudioRemoveRanges=[],si.pendingAudioSegments=[],si.supportVideoFrameCallbackHandle=null,si.audioSourceBufferCheckTimeout=null,si.audioSourceNoDataCheckTimeout=null,si.hasPendingEos=!1,si.$video={currentTime:0,readyState:0}},init(){si.events=new fs,si._resetInIt(),si.mediaSource=new self.MediaSource,si.isDecodeFirstIIframe=!!yr(ni._opt.checkFirstIFrame),si._bindMediaSourceEvents()},destroy(){si.stop(),si._clearAudioSourceBufferCheckTimeout(),si.eventListenList&&si.eventListenList.length&&(si.eventListenList.forEach((e=>e())),si.eventListenList=[]),si._resetInIt(),si.mediaSource=null},getState:()=>si.mediaSource&&si.mediaSource.readyState,isStateOpen:()=>si.getState()===yt,isStateClosed:()=>si.getState()===vt,isStateEnded:()=>si.getState()===gt,_bindMediaSourceEvents(){const{proxy:e}=si.events,t=e(si.mediaSource,wt,(()=>{ni.debugLog(si.TAG_NAME,"sourceOpen"),si._onMediaSourceSourceOpen()})),r=e(si.mediaSource,bt,(()=>{ni.debugLog(si.TAG_NAME,"sourceClose")})),i=e(si.mediaSource,St,(()=>{ni.debugLog(si.TAG_NAME,"sourceended")}));si.eventListenList.push(t,r,i)},_onMediaSourceSourceOpen(){si.sourceBuffer||(ni.debugLog(si.TAG_NAME,"onMediaSourceSourceOpen() sourceBuffer is null and next init"),si._initSourceBuffer()),si.audioSourceBuffer||(ni.debugLog(si.TAG_NAME,"onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),si._initAudioSourceBuffer()),si._hasPendingSegments()&&si._doAppendSegments()},decodeVideo(e,t,r,i){if(ni.isDestroyed)ni.debugWarn(si.TAG_NAME,"decodeVideo() and decoder is destroyed");else if(yr(si.hasInit))if(r&&e[1]===Ut){const i=15&e[0];if(i===Pe&&yr(ni._opt.supportMSEDecodeHevc))return void si.emitError(Le.mediaSourceH265NotSupport);si.videoInfo.codec=i,postMessage({cmd:P,code:i});const s=new Uint8Array(e);postMessage({cmd:M,buffer:s,codecId:i},[s.buffer]),si.hasInit=si._decodeConfigurationRecord(e,t,r,i)}else ni.debugWarn(si.TAG_NAME,`decodeVideo has not init , isIframe is ${r} , payload is ${e[1]} so drop this frame`);else if(!si.isDecodeFirstIIframe&&r&&(si.isDecodeFirstIIframe=!0),si.isDecodeFirstIIframe){if(r&&0===e[1]){const t=15&e[0];let r={};t===Fe?r=Tr(e.slice(5)):t===Pe&&(r=Vr(e));const i=si.videoInfo;i&&i.codecWidth&&i.codecWidth&&r&&r.codecWidth&&r.codecHeight&&(r.codecWidth!==i.codecWidth||r.codecHeight!==i.codecWidth)&&(ni.debugWarn(si.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${i.codecWidth}, old height is ${i.codecHeight},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),si.isWidthOrHeightChanged=!0,si.emitError(Le.mseWidthOrHeightChange,`width: ${i.codecWidth}->${r.codecWidth}, height: ${i.codecWidth}->${r.codecHeight}`))}if(si.isWidthOrHeightChanged)return void ni.debugWarn(si.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(_r(e))return void ni.debugLog(si.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLengthsi.prevTs>0&&eE,_decodeConfigurationRecord(e,t,r,i){let s=e.slice(5),n={};if(i===Fe?n=Tr(s):i===Pe&&(n=Wr(s)),si.videoInfo.width=n.codecWidth,si.videoInfo.height=n.codecHeight,0===n.codecWidth&&0===n.codecHeight)return ni.debugWarn(si.TAG_NAME,"_decodeConfigurationRecord error",JSON.stringify(n)),si.emitError(Le.mediaSourceDecoderConfigurationError,`width is ${0===n.codecWidth} and height is ${n.codecHeight}`),!1;const a={id:Lt,type:"video",timescale:1e3,duration:0,avcc:s,codecWidth:n.codecWidth,codecHeight:n.codecHeight,videoType:n.videoType},o=ps.generateInitSegment(a);si.isAvc=i===Fe;let d=n.codec;return si.videoMimeType=d?`video/mp4; codecs="${n.codec}"`:si.isAvc?mt:_t,postMessage({cmd:k,w:n.codecWidth,h:n.codecHeight}),si._initSourceBuffer(),si.appendBuffer(o.buffer),si.sequenceNumber=0,si.cacheTrack={},si.timeInit=!1,!0},_decodeAudioConfigurationRecord(e,t){const r=e[0]>>4,i=e[0]>>1&1,s=r===$e,n=r===Ne;if(yr(n||s))return ni.debugWarn(si.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${r} ant auto wasm decode`),si.emitError(Le.mediaSourceAudioG711NotSupport),!1;const a={id:It,type:"audio",timescale:1e3};let o={};if(qt(e)){if(o=Xt(e.slice(2)),!o)return!1;a.audioSampleRate=o.sampleRate,a.channelCount=o.channelCount,a.config=o.config,a.refSampleDuration=1024/a.audioSampleRate*a.timescale}else{if(!s)return!1;if(o=Es(e),!o)return!1;a.audioSampleRate=o.samplingRate,a.channelCount=o.channelCount,a.refSampleDuration=1152/a.audioSampleRate*a.timescale}a.codec=o.codec,a.duration=0;let d="mp4",l=o.codec,c=null;s&&yr(ni._opt.isFirefox)?(d="mpeg",l="",c=new Uint8Array):c=ps.generateInitSegment(a);let u=`${a.type}/${d}`;return l&&l.length>0&&(u+=`;codecs=${l}`),yr(si.isAudioInitInfo)&&(wr=r===Ne?i?16:8:0===i?8:16,postMessage({cmd:L,code:r}),postMessage({cmd:D,sampleRate:a.audioSampleRate,channels:a.channelCount,depth:wr}),si.isAudioInitInfo=!0),si.audioMimeType=u,si.isAAC=n,si._initAudioSourceBuffer(),si.appendAudioBuffer(c.buffer),!0},_initSourceBuffer(){const{proxy:e}=si.events;if(null===si.sourceBuffer&&null!==si.mediaSource&&si.isStateOpen()&&si.videoMimeType){try{ni.debugLog(si.TAG_NAME,"_initSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",si.videoMimeType),si.sourceBuffer=si.mediaSource.addSourceBuffer(si.videoMimeType)}catch(e){return ni.debugError(si.TAG_NAME,"_initSourceBuffer() appendBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),si.emitError(Le.mseWorkerAddSourceBufferError,e.code),void(si.mediaSourceAddSourceBufferError=!0)}if(si.sourceBuffer){const t=e(si.sourceBuffer,"error",(e=>{si.mediaSourceBufferError=!0,ni.debugError(si.TAG_NAME,"mseSourceBufferError mseDecoder.sourceBuffer",e,e.toString()),si.emitError(Le.mseSourceBufferError,e.code)})),r=e(si.sourceBuffer,"updateend",(()=>{si._hasPendingRemoveRanges()?si._doRemoveRanges():si._hasPendingSegments()?si._doAppendSegments():si.hasPendingEos&&(ni.debugLog(si.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),si.endOfStream())}));si.eventListenList.push(t,r)}}else ni.debugLog(si.TAG_NAME,`_initSourceBuffer and mseDecoder.isStateOpen is ${si.isStateOpen()} and mseDecoder.isAvc === null is ${null===si.isAvc}`)},_initAudioSourceBuffer(){const{proxy:e}=si.events;if(null===si.audioSourceBuffer&&null!==si.mediaSource&&si.isStateOpen()&&si.audioMimeType){try{ni.debugLog(si.TAG_NAME,"_initAudioSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",si.audioMimeType),si._clearAudioSourceBufferCheckTimeout(),si.audioSourceBuffer=si.mediaSource.addSourceBuffer(si.audioMimeType)}catch(e){return ni.debugError(si.TAG_NAME,"_initAudioSourceBuffer() addSourceBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),si.emitError(Le.mseWorkerAddSourceBufferError,e.code),void(si.mediaSourceAddSourceBufferError=!0)}if(si.audioSourceBuffer){const t=e(si.audioSourceBuffer,"error",(e=>{si.mediaSourceBufferError=!0,ni.debugError(si.TAG_NAME,"mseSourceBufferError mseDecoder.audioSourceBuffer",e.code,e.toString(),e),si.emitError(Le.mseSourceBufferError,e.code)})),r=e(si.audioSourceBuffer,"updateend",(()=>{si._hasPendingRemoveRanges()?si._doRemoveRanges():si._hasPendingSegments()?si._doAppendSegments():si.hasPendingEos&&(ni.debugLog(si.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),si.endOfStream())}));si.eventListenList.push(t,r),null===si.audioSourceNoDataCheckTimeout&&(si.audioSourceNoDataCheckTimeout=setTimeout((()=>{si._clearAudioNoDataCheckTimeout(),si.emitError(Le.mediaSourceAudioNoDataTimeout)}),1e3))}}else ni.debugLog(si.TAG_NAME,`_initAudioSourceBuffer and mseDecoder.isStateOpen is ${si.isStateOpen()} and mseDecoder.audioMimeType is ${si.audioMimeType}`)},_decodeVideo(e,t,r,i,s){let n=e.slice(5),a=n.byteLength;if(0===a)return void ni.debugWarn(si.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let o=(new Date).getTime(),d=!1;si.prevTimestamp||(si.prevTimestamp=o,d=!0);const l=o-si.prevTimestamp;if(si.decodeDiffTimestamp=l,l>1e3&&!d&&ni.isPlayer&&ni.debugLog(si.TAG_NAME,`_decodeVideo now time is ${o} and prev time is ${si.prevTimestamp}, diff time is ${l} ms`),si.cacheTrack.id&&t>=si.cacheTrack.dts){let e=8+si.cacheTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(ps.types.mdat,4),r.set(si.cacheTrack.data,8),si.cacheTrack.duration=t-si.cacheTrack.dts;let i=ps.moof(si.cacheTrack,si.cacheTrack.dts);si.cacheTrack={};let s=new Uint8Array(i.byteLength+r.byteLength);s.set(i,0),s.set(r,i.byteLength),si.appendBuffer(s.buffer)}else ni.debugLog(si.TAG_NAME,`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${s} cacheTrack dts is ${si.cacheTrack&&si.cacheTrack.dts}`),si.timeInit=!1,si.cacheTrack={};si.cacheTrack||(si.cacheTrack={}),si.cacheTrack.id=Lt,si.cacheTrack.sequenceNumber=++si.sequenceNumber,si.cacheTrack.size=a,si.cacheTrack.dts=t,si.cacheTrack.cts=i,si.cacheTrack.isKeyframe=r,si.cacheTrack.data=n,si.cacheTrack.flags={isLeading:0,dependsOn:r?2:1,isDependedOn:r?1:0,hasRedundancy:0,isNonSync:r?0:1},si.prevTimestamp=(new Date).getTime()},_decodeAudio(e,t,r){let i=si.isAAC?e.slice(2):e.slice(1),s=i.byteLength;if(si.cacheAudioTrack.id&&t>=si.cacheAudioTrack.dts){let e=8+si.cacheAudioTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(ps.types.mdat,4),r.set(si.cacheAudioTrack.data,8),si.cacheAudioTrack.duration=t-si.cacheAudioTrack.dts;let i=ps.moof(si.cacheAudioTrack,si.cacheAudioTrack.dts);si.cacheAudioTrack={};let s=new Uint8Array(i.byteLength+r.byteLength);s.set(i,0),s.set(r,i.byteLength),si.appendAudioBuffer(s.buffer)}else si.cacheAudioTrack={};si.cacheAudioTrack||(si.cacheAudioTrack={}),si.cacheAudioTrack.id=It,si.cacheAudioTrack.sequenceNumber=++si.audioSequenceNumber,si.cacheAudioTrack.size=s,si.cacheAudioTrack.dts=t,si.cacheAudioTrack.cts=0,si.cacheAudioTrack.data=i,si.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}},appendBuffer(e){ni.isDestroyed?ni.debugWarn(si.TAG_NAME,"appendBuffer() player is destroyed"):si.mediaSourceAddSourceBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):si.mediaSourceAppendBufferFull?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):si.mediaSourceAppendBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):si.mediaSourceBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(si.pendingSegments.push(e),si.sourceBuffer&&(ni._opt.mseAutoCleanupSourceBuffer&&si._needCleanupSourceBuffer()&&si._doCleanUpSourceBuffer(),yr(si.getSourceBufferUpdating())&&si.isStateOpen()&&yr(si._hasPendingRemoveRanges()))?si._doAppendSegments():si.isStateClosed()?(si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):si.isStateEnded()&&(si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,"mediaSource is end")))},appendAudioBuffer(e){ni.isDestroyed?ni.debugWarn(si.TAG_NAME,"appendAudioBuffer() player is destroyed"):si.mediaSourceAddSourceBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):si.mediaSourceAppendBufferFull?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):si.mediaSourceAppendBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):si.mediaSourceBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(si.pendingAudioSegments.push(e),si.audioSourceBuffer&&(ni._opt.mseAutoCleanupSourceBuffer&&si._needCleanupSourceBuffer()&&si._doCleanUpSourceBuffer(),yr(si.getAudioSourceBufferUpdating())&&si.isStateOpen()&&yr(si._hasPendingRemoveRanges()))?si._doAppendSegments():si.isStateClosed()?(si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):si.isStateEnded()&&(si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,"mediaSource is end")))},getSourceBufferUpdating:()=>si.sourceBuffer&&si.sourceBuffer.updating,getAudioSourceBufferUpdating:()=>si.audioSourceBuffer&&si.audioSourceBuffer.updating,stop(){si.abortSourceBuffer(),si.removeSourceBuffer(),si.endOfStream()},clearUpAllSourceBuffer(){if(si.sourceBuffer){const e=si.sourceBuffer.buffered;for(let t=0;tsi.pendingSegments.length>0||si.pendingAudioSegments.length>0,getPendingSegmentsLength:()=>si.pendingSegments.length,_handleUpdatePlaybackRate(){},_doAppendSegments(){if(si.isStateClosed()||si.isStateEnded())ni.debugLog(si.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==si.sourceBuffer){if(si.needInitAudio()&&null===si.audioSourceBuffer)return ni.debugLog(si.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===si.audioSourceBufferCheckTimeout&&(si.audioSourceBufferCheckTimeout=setTimeout((()=>{si._clearAudioSourceBufferCheckTimeout(),si.emitError(Le.mediaSourceAudioInitTimeout)}),1e3)));if(yr(si.getSourceBufferUpdating())&&si.pendingSegments.length>0){const e=si.pendingSegments.shift();try{si.sourceBuffer.appendBuffer(e)}catch(e){ni.debugError(si.TAG_NAME,"mseDecoder.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(si.stop(),si.mediaSourceAppendBufferFull=!0,si.emitError(Le.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(si.stop(),si.mediaSourceAppendBufferError=!0,si.emitError(Le.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(si.stop(),si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,`code is ${e.code} , message is ${e.message}`))}}if(yr(si.getAudioSourceBufferUpdating())&&si.pendingAudioSegments.length>0){const e=si.pendingAudioSegments.shift();try{si.audioSourceBuffer.appendBuffer(e)}catch(e){ni.debugError(si.TAG_NAME,"mseDecoder.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(si.stop(),si.mediaSourceAppendBufferFull=!0,si.emitError(Le.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(si.stop(),si.mediaSourceAppendBufferError=!0,si.emitError(Le.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(si.stop(),si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,e.code,`code is ${e.code} , message is ${e.message}`))}}}else ni.debugLog(si.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")},_doCleanUpSourceBuffer(){const e=si.$video.currentTime;if(si.sourceBuffer){const t=si.sourceBuffer.buffered;let r=!1;for(let i=0;i=ni._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-ni._opt.mseAutoCleanupMinBackwardDuration;si.pendingRemoveRanges.push({start:s,end:t})}}else n=ni._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-ni._opt.mseAutoCleanupMinBackwardDuration;si.pendingAudioRemoveRanges.push({start:s,end:t})}}else nsi.pendingRemoveRanges.length>0||si.pendingAudioRemoveRanges.length>0,needInitAudio:()=>ni._opt.hasAudio&&ni._opt.mseDecodeAudio,_doRemoveRanges(){if(si.sourceBuffer&&yr(si.getSourceBufferUpdating())){let e=si.pendingRemoveRanges;for(;e.length&&yr(si.getSourceBufferUpdating());){let t=e.shift();try{si.sourceBuffer.remove(t.start,t.end)}catch(e){ni.debugWarn(si.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e,e.toString())}}}if(si.audioSourceBuffer&&yr(si.getAudioSourceBufferUpdating())){let e=si.pendingAudioRemoveRanges;for(;e.length&&yr(si.getAudioSourceBufferUpdating());){let t=e.shift();try{si.audioSourceBuffer.remove(t.start,t.end)}catch(e){ni.debugWarn(si.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e,e.toString())}}}},_getPlaybackRate(){},_needCleanupSourceBuffer(){if(yr(ni._opt.mseAutoCleanupSourceBuffer))return!1;const e=si.$video.currentTime;if(si.sourceBuffer){let t=si.sourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=ni._opt.mseAutoCleanupMaxBackwardDuration)return!0}if(si.audioSourceBuffer){let t=si.audioSourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=ni._opt.mseAutoCleanupMaxBackwardDuration)return!0}return!1},_clearAudioSourceBufferCheckTimeout(){si.audioSourceBufferCheckTimeout&&(clearTimeout(si.audioSourceBufferCheckTimeout),si.audioSourceBufferCheckTimeout=null)},_clearAudioNoDataCheckTimeout(){si.audioSourceNoDataCheckTimeout&&(clearTimeout(si.audioSourceNoDataCheckTimeout),si.audioSourceNoDataCheckTimeout=null)},getHandle:()=>si.mediaSource.handle,emitError(e){postMessage({cmd:se,value:e,msg:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""})}});let ni={isPlayer:!0,isHevc:null,isPlayback:!1,dropping:!1,isPushDropping:!1,isWorkerFetch:!1,isDestroyed:!1,fetchStatus:Tt,_opt:Ar(),mp3Demuxer:null,delay:-1,pushLatestDelay:-1,firstTimestamp:null,startTimestamp:null,preDelayTimestamp:null,stopId:null,streamFps:null,streamAudioFps:null,streamVideoFps:null,writableStream:null,networkDelay:0,webglObj:null,startStreamRateAndStatsInterval:function(){ni.stopStreamRateAndStatsInterval(),l=setInterval((()=>{d&&d(0);const e=JSON.stringify({demuxBufferDelay:ni.getVideoBufferLength(),audioDemuxBufferDelay:ni.getAudioBufferLength(),streamBufferByteLength:ni.getStreamBufferLength(),netBuf:ni.networkDelay||0,pushLatestDelay:ni.pushLatestDelay||0,latestDelay:ni.delay,isStreamTsMoreThanLocal:Ze,wasmDecodeDelay:Se-We});postMessage({cmd:O,type:Te,value:e})}),1e3)},stopStreamRateAndStatsInterval:function(){l&&(clearInterval(l),l=null)},useOffscreen:function(){return ni._opt.useOffscreen&&"undefined"!=typeof OffscreenCanvas},getDelay:function(e,t){if(!e||ni._opt.hasVideo&&!we)return-1;if(t===ne)return ni.delay;if(ni.preDelayTimestamp&&ni.preDelayTimestamp>e)return ni.preDelayTimestamp-e>1e3&&ni.debugWarn("worker",`getDelay() and preDelayTimestamp is ${ni.preDelayTimestamp} > timestamp is ${e} more than ${ni.preDelayTimestamp-e}ms and return ${ni.delay}`),ni.preDelayTimestamp=e,ni.delay;if(ni.firstTimestamp){if(e){const t=Date.now()-ni.startTimestamp,r=e-ni.firstTimestamp;t>=r?(Ze=!1,ni.delay=t-r):(Ze=!0,ni.delay=r-t)}}else ni.firstTimestamp=e,ni.startTimestamp=Date.now(),ni.delay=-1;return ni.preDelayTimestamp=e,ni.delay},getDelayNotUpdateDelay:function(e,t){if(!e||ni._opt.hasVideo&&!we)return-1;if(t===ne)return ni.pushLatestDelay;if(ni.preDelayTimestamp&&ni.preDelayTimestamp-e>1e3)return ni.debugWarn("worker",`getDelayNotUpdateDelay() and preDelayTimestamp is ${ni.preDelayTimestamp} > timestamp is ${e} more than ${ni.preDelayTimestamp-e}ms and return -1`),-1;if(ni.firstTimestamp){let t=-1;if(e){const r=Date.now()-ni.startTimestamp,i=e-ni.firstTimestamp;r>=i?(Ze=!1,t=r-i):(Ze=!0,t=i-r)}return t}return-1},resetDelay:function(){ni.firstTimestamp=null,ni.startTimestamp=null,ni.delay=-1,ni.dropping=!1},resetAllDelay:function(){ni.resetDelay(),ni.preDelayTimestamp=null},doDecode:function(e){ni._opt.isEmitSEI&&e.type===ae&&ni.isWorkerFetch&&ni.findSei(e.payload,e.ts),ni.isPlayUseMSEAndDecoderInWorker()?e.type===ne?ni._opt.mseDecodeAudio?si.decodeAudio(e.payload,e.ts):e.decoder.decode(e.payload,e.ts):e.type===ae&&si.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):ni._opt.useWCS&&ni.useOffscreen()&&e.type===ae&&n.decode?n.decode(e.payload,e.ts,e.cts):e.decoder.decode(e.payload,e.ts,e.isIFrame,e.cts)},decodeNext(e){if(0===i.length)return;const t=e.ts,s=i[0],n=e.type===ae&&_r(e.payload);if(yr(r))n&&(ni.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${s.type} ts is ${s.ts}\n isVideoSqeHeader is ${n}`),i.shift(),ni.doDecode(s));else{const r=s.ts-t,a=s.type===ne&&e.type===ae;(r<=20||a||n)&&(ni.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${s.type} ts is ${s.ts}\n diff is ${r} and isVideoAndNextAudio is ${a} and isVideoSqeHeader is ${n}`),i.shift(),ni.doDecode(s))}},init:function(){ni.debugLog("worker","init and opt is",JSON.stringify(ni._opt));const e=ni._opt.playType===y,t=ni._opt.playType===v;if(Gr.init(),ni.isPlayer=e,ni.isPlayback=t,ni.isPlayUseMSEAndDecoderInWorker()&&si&&si.init(),n&&ni._opt.useWCS&&ni.useOffscreen()&&n.init(),yr(ni.isPlaybackCacheBeforeDecodeForFpsRender())){ni.debugLog("worker","setInterval()");const t=()=>{const t=ni._opt.videoBuffer+ni._opt.videoBufferDelay;let r=null;if(i.length){if(ni.isPushDropping)return void ni.debugWarn("worker",`loop() isPushDropping is true and bufferList length is ${i.length}`);if(ni.dropping){for(r=i.shift(),ni.debugWarn("worker",`loop() dropBuffer is dropping and isIFrame ${r.isIFrame} and delay is ${ni.delay} and bufferlist is ${i.length}`);!r.isIFrame&&i.length;)r=i.shift();const e=ni.getDelayNotUpdateDelay(r.ts,r.type);r.isIFrame&&e<=ni.getNotDroppingDelayTs()&&(ni.debugLog("worker","loop() is dropping = false, is iFrame"),ni.dropping=!1,ni.doDecode(r),ni.decodeNext(r))}else if(ni.isPlayback||ni.isPlayUseMSE()||0===ni._opt.videoBuffer)for(;i.length;)r=i.shift(),ni.doDecode(r);else if(r=i[0],-1===ni.getDelay(r.ts,r.type))ni.debugLog("worker","loop() common dumex delay is -1 ,data.ts is",r.ts),i.shift(),ni.doDecode(r),ni.decodeNext(r);else if(ni.delay>t&&e)ni.hasIframeInBufferList()?(ni.debugLog("worker",`delay is ${ni.delay} > maxDelay ${t}, set dropping is true`),ni.resetAllDelay(),ni.dropping=!0,postMessage({cmd:$})):(i.shift(),ni.doDecode(r),ni.decodeNext(r));else for(;i.length;){if(r=i[0],!(ni.getDelay(r.ts,r.type)>ni._opt.videoBuffer)){ni.delay<0&&ni.debugWarn("worker",`loop() do not decode and delay is ${ni.delay}, bufferList is ${i.length}`);break}i.shift(),ni.doDecode(r)}}else-1!==ni.delay&&ni.debugLog("worker","loop() bufferList is empty and reset delay"),ni.resetAllDelay()};ni.stopId=setInterval((()=>{let e=(new Date).getTime();Je||(Je=e);const r=e-Je;r>100&&ni.debugWarn("worker",`loop demux diff time is ${r}`),t(),Je=(new Date).getTime()}),20)}else ni.debugLog("worker","playback and playbackIsCacheBeforeDecodeForFpsRender is true");if(yr(ni._opt.checkFirstIFrame)&&(we=!0),ni.isPlayUseMSEAndDecoderInWorker()&&si){const e=si.getHandle();e&&postMessage({cmd:re,mseHandle:e},[e])}},playbackCacheLoop:function(){ni.clearPlaybackCacheLoop();const e=()=>{let e=null;i.length&&(e=i.shift(),ni.doDecode(e))};e();const t=Math.ceil(1e3/(ni.streamFps*ni._opt.playbackRate));ni.debugLog("worker",`playbackCacheLoop fragDuration is ${t}, streamFps is ${ni.streamFps}, streamAudioFps is ${ni.streamAudioFps} ,streamVideoFps is ${ni.streamVideoFps} playbackRate is ${ni._opt.playbackRate}`),ni.stopId=setInterval(e,t)},clearPlaybackCacheLoop:function(){ni.stopId&&(clearInterval(ni.stopId),ni.stopId=null)},startPlaybackCacheLoop:function(){ni.playbackCacheLoop()},close:function(){if(ni.debugLog("worker","close"),ni.isDestroyed=!0,kr(),!o||1!==o.readyState&&2!==o.readyState?o&&ni.debugLog("worker",`close() and socket.readyState is ${o.readyState}`):(Sr=!0,o.close(1e3,"Client disconnecting")),o=null,ni.stopStreamRateAndStatsInterval(),ni.stopId&&(clearInterval(ni.stopId),ni.stopId=null),ni.mp3Demuxer&&(ni.mp3Demuxer.destroy(),ni.mp3Demuxer=null),ni.writableStream&&yr(ni.writableStream.locked)&&ni.writableStream.close().catch((e=>{ni.debugLog("worker","close() and writableStream.close() error",e.toString(),e)})),ni.writableStream=null,ai)try{ai.clear&&ai.clear(),ai=null}catch(e){ni.debugLog("worker","close() and audioDecoder.clear error",e.toString(),e)}if(oi)try{oi.clear&&oi.clear(),oi=null}catch(e){ni.debugLog("worker","close() and videoDecoder.clear error",e.toString())}d=null,Je=null,Ze=!1,Se=0,We=0,n&&(n.destroy&&n.destroy(),n=null),si&&(si.destroy(),si=null),ni.firstTimestamp=null,ni.startTimestamp=null,ni.networkDelay=0,ni.streamFps=null,ni.streamAudioFps=null,ni.streamVideoFps=null,ni.delay=-1,ni.pushLatestDelay=-1,ni.preDelayTimestamp=null,ni.dropping=!1,ni.isPushDropping=!1,ni.isPlayer=!0,ni.isPlayback=!1,ni.isWorkerFetch=!1,ni.isHevc=null,ni._opt=Ar(),ni.webglObj&&(ni.webglObj.destroy(),ni.offscreenCanvas.removeEventListener("webglcontextlost",ni.onOffscreenCanvasWebglContextLost),ni.offscreenCanvas.removeEventListener("webglcontextrestored",ni.onOffscreenCanvasWebglContextRestored),ni.offscreenCanvas=null,ni.offscreenCanvasGL=null,ni.offscreenCanvasCtx=null),i=[],s=[],c&&(c.close(),c=null),h=null,w=null,S=!1,U=!1,we=!1,Vt=!1,Kt=!1,Qt=!1,nr=null,ct=[],xt=0,Nt=0,et=null,rt=null,Ot=null,Gt=null,wr=null,$t=0,Ht=0,Et=null,At=null,ni.fetchStatus=Tt,Er=!0,Gr.destroy(),$r.destroy(),jr.destroy(),ii.destroy(),ni.debug=null,ni._opt={},postMessage({cmd:Y})},pushBuffer:function(e,t){if(t.type===ne&&qt(e)){if(ni.debugLog("worker",`pushBuffer audio ts is ${t.ts}, isAacCodecPacket is true`),ni._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:J,buffer:t},[t.buffer])}ni.decodeAudio(e,t.ts)}else if(t.type===ae&&t.isIFrame&&_r(e)){if(ni.debugLog("worker",`pushBuffer video ts is ${t.ts}, isVideoSequenceHeader is true`),ni._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:Q,buffer:t},[t.buffer])}ni.decodeVideo(e,t.ts,t.isIFrame,t.cts)}else{if(ni._opt.isRecording)if(ni._opt.isRecordTypeFlv){const r=new Uint8Array(e);postMessage({cmd:ee,type:t.type,buffer:r,ts:t.ts},[r.buffer])}else if(ni._opt.recordType===b)if(t.type===ae){const r=new Uint8Array(e).slice(5);postMessage({cmd:R,buffer:r,isIFrame:t.isIFrame,ts:t.ts,cts:t.cts},[r.buffer])}else if(t.type===ne&&ni._opt.isWasmMp4){const r=new Uint8Array(e),i=Yt(r)?r.slice(2):r.slice(1);postMessage({cmd:I,buffer:i,ts:t.ts},[i.buffer])}if(ni.isPlayer){if(t.type===ae){if($t>0){const e=t.ts-Gt,r=$t+$t/2;e>r&&ni.debugLog("worker",`pushBuffer video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts}, preTs is ${Gt},\n diff is ${e} and preTsDuration is ${$t} and maxDiff is ${r}\n maybe trigger black screen or flower screen\n `)}if(null!==Gt&&Gt>=t.ts&&(ni.debugWarn("worker",`pushBuffer() and isIFrame is ${t.isIFrame} and,\n options.ts is ${t.ts} less than (or equal) preTs is ${Gt} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${Ht}`),Gt-t.ts>E&&(ni.debugWarn("worker",`pushBuffer,\n preTimestamp is ${Gt}, options.ts is ${t.ts},\n diff is ${Gt-t.ts} more than 3600000,\n and resetAllDelay`),ni.resetAllDelay(),Gt=null,$t=0),ni._opt.isDropSameTimestampGop&&yr(t.isIFrame)&&we)){const e=ni.hasIframeInBufferList(),t=yr(ni.isPushDropping);return ni.debugLog("worker",`pushBuffer, isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next dropBuffer`),void(e&&t?ni.dropBuffer$2():(ni.clearBuffer(!0),gr(ni._opt.checkFirstIFrame)&&gr(r)&&(ni.isPlayUseMSEAndDecoderInWorker()?si.isDecodeFirstIIframe=!1:postMessage({cmd:te}))))}Gt>0&&($t=t.ts-Gt),Ht=e.byteLength,Gt=t.ts}if(we){const e=ni._opt.videoBuffer+ni._opt.videoBufferDelay,r=ni.getDelayNotUpdateDelay(t.ts,t.type);ni.pushLatestDelay=r,ni.delay>0&&r>e&&ni.delay({type:e.type,ts:e.ts})));ni.debugLog("worker",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${i.length}, and ts list is ${JSON.stringify(r)}`)}const r=ni.getAudioBufferLength()>0,s=r?60:40;i.length>=s&&(ni.debugWarn("worker",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${i.length} more than ${s}, and hasAudio is ${r} an set streamFps is 25`),ni.streamVideoFps=25,postMessage({cmd:V,value:ni.streamVideoFps}),r?(ni.streamAudioFps=25,ni.streamFps=ni.streamVideoFps+ni.streamAudioFps):ni.streamFps=ni.streamVideoFps,ni.playbackCacheLoop())}}},getVideoBufferLength(){let e=0;return i.forEach((t=>{t.type===ae&&(e+=1)})),e},hasIframeInBufferList:()=>i.some((e=>e.type===ae&&e.isIFrame)),isAllIframeInBufferList(){const e=ni.getVideoBufferLength();let t=0;return i.forEach((e=>{e.type===ae&&e.isIFrame&&(t+=1)})),e===t},getNotDroppingDelayTs:()=>ni._opt.videoBuffer+ni._opt.videoBufferDelay/2,getAudioBufferLength(){let e=0;return i.forEach((t=>{t.type===ne&&(e+=1)})),e},getStreamBufferLength(){let e=0;return c&&c.buffer&&(e=c.buffer.byteLength),ni._opt.isNakedFlow?Gr.lastBuf&&(e=Gr.lastBuf.byteLength):ni._opt.isTs?ii._remainingPacketData&&(e=ii._remainingPacketData.byteLength):ni._opt.isFmp4&&$r.mp4Box&&(e=$r.mp4Box.getAllocatedSampleDataSize()),e},fetchStream:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(ni.debugLog("worker","fetchStream, url is "+e,"options:",JSON.stringify(t)),ni.isWorkerFetch=!0,t.isFlv?ni._opt.isFlv=!0:t.isFmp4?ni._opt.isFmp4=!0:t.isMpeg4?ni._opt.isMpeg4=!0:t.isNakedFlow?ni._opt.isNakedFlow=!0:t.isTs&&(ni._opt.isTs=!0),d=ar((e=>{postMessage({cmd:O,type:Ae,value:e})})),ni.startStreamRateAndStatsInterval(),t.isFmp4&&($r.listenMp4Box(),ni._opt.isFmp4Private&&$r.initTransportDescarmber()),t.protocol===m){t.isFlv&&(c=new Br(ni.demuxFlv())),a=new AbortController;const r=Object.assign({signal:a.signal},{headers:t.options&&t.options.headers||{}});fetch(e,r).then((e=>{if(gr(Sr))return ni.debugLog("worker","request abort and run res.body.cancel()"),ni.fetchStatus=Tt,void e.body.cancel();if(!pr(e))return ni.debugWarn("worker",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),kr(),void postMessage({cmd:O,type:Le.fetchError,value:`fetch response status is ${e.status} and ok is ${e.ok}`});if(postMessage({cmd:O,type:ke}),ur())ni.writableStream=new WritableStream({write:e=>a&&a.signal&&a.signal.aborted?(ni.debugLog("worker","writableStream write() and abortController.signal.aborted is true so return"),void(ni.fetchStatus=Dt)):gr(Sr)?(ni.debugLog("worker","writableStream write() and requestAbort is true so return"),ni.fetchStatus=Dt,void kr()):void("string"!=typeof e?(ni.fetchStatus=Ct,d(e.byteLength),t.isFlv?c.write(e):t.isFmp4?ni.demuxFmp4(e):t.isMpeg4?ni.demuxMpeg4(e):t.isTs?ni.demuxTs(e):t.isNakedFlow&&ni.demuxNakedFlow(e)):ni.debugWarn("worker",`writableStream write() and value is "${e}" string so return`)),close:()=>{ni.debugLog("worker","writableStream close()"),ni.fetchStatus=Dt,c&&(c.close(),c=null),kr(),postMessage({cmd:O,type:Ee,value:_,msg:"fetch done"})},abort:e=>{if(a&&a.signal&&a.signal.aborted)return ni.debugLog("worker","writableStream abort() and abortController.signal.aborted is true so return"),void(ni.fetchStatus=Dt);c&&(c.close(),c=null),e.name!==Bt?(ni.debugLog("worker",`writableStream abort() and e is ${e.toString()}`),kr(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()})):ni.debugLog("worker","writableStream abort() and e.name is AbortError so return")}}),e.body.pipeTo(ni.writableStream).catch((e=>{"AbortError"!==e.name&&ni.debugLog("worker","writableStream pipeTo() and e is",e.name,e.toString())}));else{const r=e.body.getReader(),i=()=>{r.read().then((e=>{let{done:r,value:s}=e;return r?(ni.debugLog("worker","fetchNext().then() and done is true"),ni.fetchStatus=Dt,c&&(c.close(),c=null),kr(),void postMessage({cmd:O,type:Ee,value:_,msg:"fetch done"})):a&&a.signal&&a.signal.aborted?(ni.debugLog("worker","fetchNext().then() and abortController.signal.aborted is true so return"),void(ni.fetchStatus=Dt)):gr(Sr)?(ni.debugLog("worker","fetchNext().then() and requestAbort is true so return"),ni.fetchStatus=Dt,void kr()):void("string"!=typeof s?(ni.fetchStatus=Ct,d(s.byteLength),t.isFlv?c.write(s):t.isFmp4?ni.demuxFmp4(s):t.isMpeg4?ni.demuxMpeg4(s):t.isTs?ni.demuxTs(s):t.isNakedFlow&&ni.demuxNakedFlow(s),i()):ni.debugWarn("worker",`fetchNext().then() and value "${s}" is string so return`))})).catch((e=>{if(a&&a.signal&&a.signal.aborted)return ni.debugLog("worker","fetchNext().catch() and abortController.signal.aborted is true so return"),void(ni.fetchStatus=Dt);c&&(c.close(),c=null),e.name!==Bt?(ni.debugLog("worker",`fetchNext().catch() and e is ${e.toString()}`),kr(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()})):ni.debugLog("worker","fetchNext().catch() and e.name is AbortError so return")}))};i()}})).catch((e=>{a&&a.signal&&a.signal.aborted?ni.debugLog("worker","fetch().catch() and abortController.signal.aborted is true so return"):e.name!==Bt?(ni.debugLog("worker",`fetch().catch() and e is ${e.toString()}`),kr(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()}),c&&(c.close(),c=null)):ni.debugLog("worker","fetch().catch() and e.name is AbortError so return")}))}else t.protocol===p&&(t.isFlv&&(c=new Br(ni.demuxFlv())),o=new WebSocket(e,r),o.binaryType="arraybuffer",o.onopen=()=>{ni.debugLog("worker","fetchStream, WebsocketStream socket open"),postMessage({cmd:O,type:ke}),postMessage({cmd:O,type:De})},o.onclose=e=>{ni.isDestroyed?ni.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} and isDestroyed is true, so return`):u?ni.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} but isSocketError is true , so return`):(ni.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code}`),1006===e.code&&ni.debugError("worker",`fetchStream, WebsocketStream socket close abnormally and code is ${e.code}`),gr(Sr)?ni.debugLog("worker","fetchStream, WebsocketStream socket close and requestAbort is true so return"):(c&&(c.close(),c=null),postMessage({cmd:O,type:Ee,value:g,msg:e.code})))},o.onerror=e=>{ni.debugError("worker","fetchStream, WebsocketStream socket error",e,e.toString()),u=!0,c&&(c.close(),c=null),ni.isDestroyed?ni.debugLog("worker","fetchStream, WebsocketStream on error and isDestroyed is true, so return"):postMessage({cmd:O,type:Le.websocketError,value:e.isTrusted?"websocket user aborted":"websocket error"})},o.onmessage=e=>{"string"!=typeof e.data?(d(e.data.byteLength),t.isFlv?c.write(e.data):t.isFmp4?ni.demuxFmp4(e.data):t.isMpeg4?ni.demuxMpeg4(e.data):ni._opt.isNakedFlow?ni.demuxNakedFlow(e.data):ni.demuxM7s(e.data)):ni.debugWarn("worker",`socket on message is string "${e.data}" and return`)})},demuxFlv:function*(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),r=new Uint32Array(e);for(;;){t[3]=0;const e=yield 15,i=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const s=r[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let n=r[0];const a=(yield s).slice();switch(i){case oe:if(a.byteLength>0){let e=a;gr(ni._opt.m7sCryptoAudio)&&(e=ni.cryptoPayloadAudio(a)),ni.decode(e,{type:ne,ts:n})}else ni.debugWarn("worker",`demuxFlv() type is audio and payload.byteLength is ${a.byteLength} and return`);break;case de:if(a.byteLength>=6){const e=a[0];if(ni._isEnhancedH265Header(e))ni._decodeEnhancedH265Video(a,n);else{const e=15&a[0];let t=a[0]>>4===kt;const i=e===Pe;if(yr(t)&&gr(br(a,i))&&(ni.debugLog("worker","demux() isIFrame is false and unit type is IDR and update to true"),t=!0),t&&_r(a)&&null===ni.isHevc){const e=15&a[0];ni.isHevc=e===Pe,nr=rr(a,ni.isHevc),ni.debugLog("worker",`demuxFlv() isVideoSequenceHeader is true and isHevc is ${ni.isHevc} and nalUnitSize is ${nr}`)}t&&ni.calcIframeIntervalTimestamp(n),ni.isPlayer&&ni.calcNetworkDelay(n),r[0]=a[4],r[1]=a[3],r[2]=a[2],r[3]=0;let s=r[0],o=ni.cryptoPayload(a,t);ni.decode(o,{type:ae,ts:n,isIFrame:t,cts:s})}}else ni.debugWarn("worker",`demuxFlv() type is video and payload.byteLength is ${a.byteLength} and return`);break;case le:postMessage({cmd:Z,buffer:a},[a.buffer]);break;default:ni.debugLog("worker",`demuxFlv() type is ${i}`)}}},decode:function(e,t){t.type===ne?ni._opt.hasAudio&&(postMessage({cmd:O,type:Be,value:e.byteLength}),ni.isPlayer?ni.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts}):ni.isPlayback&&(ni.isPlaybackOnlyDecodeIFrame()||(ni.isPlaybackCacheBeforeDecodeForFpsRender(),ni.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts})))):t.type===ae&&ni._opt.hasVideo&&(postMessage({cmd:O,type:Ue,value:e.byteLength}),postMessage({cmd:O,type:xe,value:t.ts}),ni.isPlayer?ni.pushBuffer(e,{type:t.type,ts:t.ts,isIFrame:t.isIFrame,cts:t.cts}):ni.isPlayback&&(ni.isPlaybackOnlyDecodeIFrame()?t.isIFrame&&ni.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}):(ni.isPlaybackCacheBeforeDecodeForFpsRender(),ni.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}))))},cryptoPayload:function(e,t){let r=e;return ni._opt.isM7sCrypto?ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength>0&&ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength>0?r=zi(e,ni._opt.cryptoKey,ni._opt.cryptoIV,ni.isHevc):ni.debugError("worker",`isM7sCrypto cryptoKey.length is ${ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength} or cryptoIV.length is ${ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength} null`):ni._opt.isSm4Crypto?ni._opt.sm4CryptoKey?r=ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength>0&&ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength>0?en(e,ni._opt.cryptoKey,ni._opt.cryptoIV,ni.isHevc,ni._opt.isSm4CryptoH265V2):as(e,ni._opt.sm4CryptoKey,ni.isHevc,ni._opt.isSm4CryptoH265V2):ni._opt.sm4CryptoKey||ni.debugError("worker","isSm4Crypto opt.sm4CryptoKey is null"):ni._opt.isXorCrypto&&(ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength>0&&ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength>0?r=us(e,ni._opt.cryptoKey,ni._opt.cryptoIV,ni.isHevc):ni.debugError("worker",`isXorCrypto cryptoKey.length is ${ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength} or cryptoIV.length is ${ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength} null`)),r},cryptoPayloadAudio:function(e){let t=e;return ni._opt.isM7sCrypto&&(ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength>0&&ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength>0?e[0]>>4===Ne&&(t=Ni(e,ni._opt.cryptoKey,ni._opt.cryptoIV)):ni.debugError("worker",`isM7sCrypto cryptoKey.length is ${ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength} or cryptoIV.length is ${ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength} null`)),t},setCodecAudio:function(e,t){const r=e[0]>>4,i=e[0]>>1&1;if(wr=r===Ne?i?16:8:0===i?8:16,ai&&ai.setCodec)if(qt(e)||r===Oe||r===Ge||r===$e){ni.debugLog("worker",`setCodecAudio: init audio codec, codeId is ${r} _opt.sampleRate is ${ni._opt.sampleRate}`);const i=r===Ne?e.slice(2):new Uint8Array(0);ai.setCodec(r,ni._opt.sampleRate,i),r===Ne&&postMessage({cmd:F,buffer:i},[i.buffer]),U=!0,r!==Ne&&(r===$e?(ni.mp3Demuxer||(ni.mp3Demuxer=new ds(ni),ni.mp3Demuxer.on("data",((e,t)=>{ai.decode(e,t)}))),ni.mp3Demuxer.dispatch(e.slice(1),t)):ai.decode(e.slice(1),t));{const e=Number("1")||1;setTimeout((()=>{ni.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),ni.close(),postMessage({cmd:H})}),60*e*60*1e3)}}else ni.debugWarn("worker","setCodecAudio: hasInitAudioCodec is false, codecId is ",r);else ni.debugError("worker","setCodecAudio: audioDecoder or audioDecoder.setCodec is null")},decodeAudio:function(e,t){if(ni.isDestroyed)ni.debugLog("worker","decodeAudio, decoder is destroyed and return");else if(ni.isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio())si.decodeAudio(e,t);else if(gr(r)&&gr(ni._opt.mseDecodeAudio))postMessage({cmd:N,payload:e,ts:t,cts:t},[e.buffer]);else{const r=e[0]>>4;if(U){if(qt(e))return void ni.debugLog("worker","decodeAudio and has already initialized and payload is aac codec packet so drop this frame");r===$e?ni.mp3Demuxer.dispatch(e.slice(1),t):ai.decode(r===Ne?e.slice(2):e.slice(1),t)}else ni.setCodecAudio(e,t)}},setCodecVideo:function(e,t){const r=15&e[0];if(oi&&oi.setCodec)if(_r(e))if(r===Fe||r===Pe){ni.debugLog("worker",`setCodecVideo: init video codec , codecId is ${r}`);const t=e.slice(5);if(r===Fe&&ni._opt.useSIMD){const e=Tr(t);if(e.codecWidth>A||e.codecHeight>A)return postMessage({cmd:q,value:`width: ${e.codecWidth} > 4080, height: ${e.codecHeight} > 4080`}),void ni.debugWarn("worker",`setCodecVideo: SIMD H264 decode video width is too large, width is ${e.codecWidth}, height is ${e.codecHeight}`)}const i=new Uint8Array(e);S=!0,oi.setCodec(r,t),postMessage({cmd:P,code:r}),postMessage({cmd:M,buffer:i,codecId:r},[i.buffer])}else ni.debugWarn("worker",`setCodecVideo: hasInitVideoCodec is false, codecId is ${r} is not H264 or H265`);else ni.debugWarn("worker",`decodeVideo: hasInitVideoCodec is false, codecId is ${r} and isIFrame is ${t} and packetType is ${e[1]}`);else ni.debugError("worker","setCodecVideo: videoDecoder or videoDecoder.setCodec is null")},decodeVideo:function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(ni.isDestroyed)ni.debugLog("worker","decodeVideo, decoder is destroyed and return");else if(ni.isPlayUseMSEAndDecoderInWorker())si.decodeVideo(e,t,i,s);else if(gr(r))postMessage({cmd:z,payload:e,isIFrame:i,ts:t,cts:s,delay:ni.delay},[e.buffer]);else if(S)if(!we&&i&&(we=!0),we){if(i&&_r(e)){const t=15&e[0];let r={};t===Fe?r=Tr(e.slice(5)):t===Pe&&(r=Vr(e)),r.codecWidth&&r.codecHeight&&h&&w&&(r.codecWidth!==h||r.codecHeight!==w)&&(ni.debugWarn("worker",`\n decodeVideo: video width or height is changed,\n old width is ${h}, old height is ${w},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),Kt=!0,postMessage({cmd:W,value:`width: ${h}->${r.codecWidth}, height: ${w}->${r.codecHeight}`}))}if(Kt)return void ni.debugWarn("worker","decodeVideo: video width or height is changed, and return");if(Qt)return void ni.debugWarn("worker","decodeVideo: simd decode error, and return");if(_r(e))return void ni.debugLog("worker","decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength0&&void 0!==arguments[0]&&arguments[0];ni.debugLog("worker",`clearBuffer,bufferList length is ${i.length}, need clear is ${e}`),e&&(i=[]),ni.isPlayer&&(ni.resetAllDelay(),gr(ni._opt.checkFirstIFrame)&&(ni.dropping=!0,postMessage({cmd:$}))),gr(ni._opt.checkFirstIFrame)&&yr(r)&&(we=!1)},dropBuffer$2:function(){if(i.length>0){let e=i.findIndex((e=>gr(e.isIFrame)&&e.type===ae));if(ni.isAllIframeInBufferList())for(let t=0;t=ni.getNotDroppingDelayTs()){ni.debugLog("worker",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${s} and notDroppingDelayTs is ${ni.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){ni.isPushDropping=!0,postMessage({cmd:$});const t=i.length;i=i.slice(e);const r=i.shift();ni.resetAllDelay(),ni.getDelay(r.ts,r.type),ni.doDecode(r),ni.isPushDropping=!1,ni.debugLog("worker",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,new bufferList is ${i.length} and new delay is ${ni.delay} `)}else ni.isPushDropping=!1}0===i.length&&(ni.isPushDropping=!1)},demuxM7s:function(e){const t=new DataView(e),r=t.getUint32(1,!1),i=t.getUint8(0),s=new ArrayBuffer(4),n=new Uint32Array(s);switch(i){case ne:ni.decode(new Uint8Array(e,5),{type:ne,ts:r});break;case ae:if(t.byteLength>=11){const i=new Uint8Array(e,5),s=i[0];if(ni._isEnhancedH265Header(s))ni._decodeEnhancedH265Video(i,r);else{const e=t.getUint8(5)>>4==1;if(e&&(ni.calcIframeIntervalTimestamp(r),_r(i)&&null===ni.isHevc)){const e=15&i[0];ni.isHevc=e===Pe}ni.isPlayer&&ni.calcNetworkDelay(r),n[0]=i[4],n[1]=i[3],n[2]=i[2],n[3]=0;let s=n[0],a=ni.cryptoPayload(i,e);ni.decode(a,{type:ae,ts:r,isIFrame:e,cts:s})}}else ni.debugWarn("worker",`demuxM7s() type is video and arrayBuffer length is ${e.byteLength} and return`)}},demuxNakedFlow:function(e){Gr.dispatch(e)},demuxFmp4:function(e){$r.dispatch(e)},demuxMpeg4:function(e){jr.dispatch(e)},demuxTs:function(e){ii.dispatch(e)},_decodeEnhancedH265Video:function(e,t){const r=e[0],i=48&r,s=15&r,n=e.slice(1,5),a=new ArrayBuffer(4),o=new Uint32Array(a),d="a"==String.fromCharCode(n[0]);if(ni.isHevc=yr(d),s===Pt){if(i===zt){const r=e.slice(5);if(d);else{const i=new Uint8Array(5+r.length);i.set([28,0,0,0,0],0),i.set(r,5),nr=rr(e,ni.isHevc),ni.debugLog("worker",`demuxFlv() isVideoSequenceHeader(enhancedH265) is true and isHevc is ${ni.isHevc} and nalUnitSize is ${nr}`),ni.decode(i,{type:ae,ts:t,isIFrame:!0,cts:0})}}}else if(s===Mt){let r=e,s=0;const n=i===zt;n&&ni.calcIframeIntervalTimestamp(t),d||(o[0]=e[4],o[1]=e[3],o[2]=e[2],o[3]=0,s=o[0],r=Kr(e.slice(8),n),r=ni.cryptoPayload(r,n),ni.decode(r,{type:ae,ts:t,isIFrame:n,cts:s}))}else if(s===Rt){const r=i===zt;r&&ni.calcIframeIntervalTimestamp(t);let s=Kr(e.slice(5),r);s=ni.cryptoPayload(s,r),ni.decode(s,{type:ae,ts:t,isIFrame:r,cts:0})}},_isEnhancedH265Header:function(e){return(e&Ft)===Ft},findSei:function(e,t){let r=4;dr(nr)&&(r=nr),er(e.slice(5),r).forEach((e=>{const r=ni.isHevc?e[0]>>>1&63:31&e[0],i=ni.isHevc&&(r===ht||r===ut),s=yr(ni.isHevc)&&r===Ye;(i||s)&&postMessage({cmd:X,buffer:e,ts:t},[e.buffer])}))},calcNetworkDelay:function(e){if(!(we&&e>0))return;null===et?(et=e,rt=ir()):et?r-t:0;ni.networkDelay=i,i>ni._opt.networkDelay&&ni._opt.playType===y&&(ni.debugWarn("worker",`calcNetworkDelay now dts:${e}, start dts is ${et} vs start is ${t},local diff is ${r} ,delay is ${i}`),postMessage({cmd:O,type:Ce,value:i}))},calcIframeIntervalTimestamp:function(e){null===Ot?Ot=e:Ot=ni._opt.playbackForwardMaxRateDecodeIFrame&&!(ni._opt.useMSE&&ni._opt.mseDecodeAudio)},isPlayUseMSE:function(){return ni.isPlayer&&ni._opt.useMSE&&gr(r)},isPlayUseMSEAndDecoderInWorker:function(){return ni.isPlayUseMSE()&&ni._opt.mseDecoderUseWorker},isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio:function(){return ni.isPlayUseMSEAndDecoderInWorker()&&ni._opt.mseDecodeAudio},playbackUpdatePlaybackRate:function(){yr(ni.isPlaybackCacheBeforeDecodeForFpsRender())&&ni.clearBuffer(!0)},onOffscreenCanvasWebglContextLost:function(e){ni.debugError("worker","handleOffscreenCanvasWebglContextLost and next try to create webgl"),e.preventDefault(),Vt=!0,ni.webglObj.destroy(),ni.webglObj=null,ni.offscreenCanvasGL=null,setTimeout((()=>{ni.offscreenCanvasGL=ni.offscreenCanvas.getContext("webgl"),ni.offscreenCanvasGL&&ni.offscreenCanvasGL.getContextAttributes().stencil?(ni.webglObj=f(ni.offscreenCanvasGL,ni._opt.openWebglAlignment),Vt=!1):ni.debugError("worker","handleOffscreenCanvasWebglContextLost, stencil is false")}),500)},onOffscreenCanvasWebglContextRestored:function(e){ni.debugLog("worker","handleOffscreenCanvasWebglContextRestored"),e.preventDefault()},videoInfo:function(e,t,r){postMessage({cmd:P,code:e}),postMessage({cmd:k,w:t,h:r}),h=t,w=r,ni.useOffscreen()&&(ni.offscreenCanvas=new OffscreenCanvas(t,r),ni.offscreenCanvasGL=ni.offscreenCanvas.getContext("webgl"),ni.webglObj=f(ni.offscreenCanvasGL,ni._opt.openWebglAlignment),ni.offscreenCanvas.addEventListener("webglcontextlost",ni.onOffscreenCanvasWebglContextLost,!1),ni.offscreenCanvas.addEventListener("webglcontextrestored",ni.onOffscreenCanvasWebglContextRestored,!1))},audioInfo:function(e,t,r){postMessage({cmd:L,code:e}),postMessage({cmd:D,sampleRate:t,channels:r,depth:wr}),Nt=r},yuvData:function(t,r){if(ni.isDestroyed)return void ni.debugLog("worker","yuvData, decoder is destroyed and return");const i=h*w*3/2;let s=e.HEAPU8.subarray(t,t+i),n=new Uint8Array(s);if(Et=null,We=r,ni.useOffscreen())try{if(Vt)return;ni.webglObj.renderYUV(h,w,n);let e=ni.offscreenCanvas.transferToImageBitmap();postMessage({cmd:T,buffer:e,delay:ni.delay,ts:r},[e])}catch(e){ni.debugError("worker","yuvData, transferToImageBitmap error is",e,e.toString())}else postMessage({cmd:T,output:n,delay:ni.delay,ts:r},[n.buffer])},pcmData:function(e,r,i){if(ni.isDestroyed)return void ni.debugLog("worker","pcmData, decoder is destroyed and return");let n=r,a=[],o=0,d=ni._opt.audioBufferSize;for(let r=0;r<2;r++){let i=t.HEAPU32[(e>>2)+r]>>2;a[r]=t.HEAPF32.subarray(i,i+n)}if(xt){if(!(n>=(r=d-xt)))return xt+=n,s[0]=Float32Array.of(...s[0],...a[0]),void(2==Nt&&(s[1]=Float32Array.of(...s[1],...a[1])));ct[0]=Float32Array.of(...s[0],...a[0].subarray(0,r)),2==Nt&&(ct[1]=Float32Array.of(...s[1],...a[1].subarray(0,r))),postMessage({cmd:C,buffer:ct,ts:i},ct.map((e=>e.buffer))),o=r,n-=r}for(xt=n;xt>=d;xt-=d)ct[0]=a[0].slice(o,o+=d),2==Nt&&(ct[1]=a[1].slice(o-d,o)),postMessage({cmd:C,buffer:ct,ts:i},ct.map((e=>e.buffer)));xt&&(s[0]=a[0].slice(o),2==Nt&&(s[1]=a[1].slice(o))),a=[]},errorInfo:function(e){null===Et&&(Et=ir());const t=ir(),r=sr(At>0?2*At:5e3,1e3,5e3),i=t-Et;i>r&&(ni.debugWarn("worker",`errorInfo() emit simdDecodeError and\n iframeIntervalTimestamp is ${At} and diff is ${i} and maxDiff is ${r}\n and replay`),Qt=!0,postMessage({cmd:j}))},sendWebsocketMessage:function(e){o?o.readyState===Ie?o.send(e):ni.debugError("worker","socket is not open"):ni.debugError("worker","socket is null")},timeEnd:function(){ni.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),ni.close(),postMessage({cmd:H})},postStreamToMain(e,t){postMessage({cmd:K,type:t,buffer:e},[e.buffer])},updatePlaybackIsPause(e){ni.debugLog("worker",`updatePlaybackIsPause, isPause is ${e}`),gr(e)?ni.clearPlaybackCacheLoop():ni.startPlaybackCacheLoop()},debugLog(e){if(ni._opt.debug&&ni.debug){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i{t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);const i=function(){const t=_(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),i=_(e.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),r=e.createProgram();if(e.attachShader(r,t),e.attachShader(r,i),e.linkProgram(r),!e.getProgramParameter(r,e.LINK_STATUS))return console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(r)),null;return r}();let r={program:i,attribLocations:{vertexPosition:e.getAttribLocation(i,"aVertexPosition"),texturePosition:e.getAttribLocation(i,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(i,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(i,"uModelMatrix"),viewMatrix:e.getUniformLocation(i,"uViewMatrix"),rgbatexture:e.getUniformLocation(i,"rgbaTexture"),ytexture:e.getUniformLocation(i,"yTexture"),utexture:e.getUniformLocation(i,"uTexture"),vtexture:e.getUniformLocation(i,"vTexture"),isyuv:e.getUniformLocation(i,"isyuv")}},a=function(){const t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),e.STATIC_DRAW);var i=[];i=i.concat([0,1],[1,1],[1,0],[0,0]);const r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array(i),e.STATIC_DRAW);const s=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,s);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,texPosition:r,indices:s}}(),d=p(),u=p(),h=p(),f=p();function p(){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function _(t,i){const r=e.createShader(t);return e.shaderSource(r,i),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(console.log("An error occurred compiling the shaders: "+e.getShaderInfoLog(r)),e.deleteShader(r),null)}function m(t,i){e.viewport(0,0,t,i),e.clearColor(0,0,0,0),e.clearDepth(1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);const d=n();l(d,-1,1,-1,1,.1,100);const p=n();o(p);const _=n();!function(e,t,i,r){var a,n,d,l,c,u,h,f,p,_,m=t[0],g=t[1],y=t[2],b=r[0],v=r[1],S=r[2],w=i[0],A=i[1],B=i[2];Math.abs(m-w)32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let i=e-this._current_word_bits_left;this._fillCurrentWord();let r=Math.min(i,this._current_word_bits_left),s=this._current_word>>>32-r;return this._current_word<<=r,this._current_word_bits_left-=r,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Gt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Ot=Gt,Ht=Gt;function Vt(e){let{profile:t,sampleRate:i,channel:r}=e;return new Uint8Array([175,0,t<<3|(14&i)>>1,(1&i)<<7|r<<3])}function $t(e){return Wt(e)&&e[1]===Bt}function Wt(e){return e[0]>>4===ze}const Yt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function qt(e){let t=new Uint8Array(e),i=null,r=0,s=0,a=0,n=null;if(r=s=t[0]>>>3,a=(7&t[0])<<1|t[1]>>>7,a<0||a>=Yt.length)return void console.error("Flv: AAC invalid sampling frequency index!");let o=Yt[a],d=(120&t[1])>>>3;if(d<0||d>=8)return void console.log("Flv: AAC invalid channel configuration");5===r&&(n=(7&t[1])<<1|t[2]>>>7,t[2]);let l=self.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?a>=6?(r=5,i=new Array(4),n=a-3):(r=2,i=new Array(2),n=a):-1!==l.indexOf("android")?(r=2,i=new Array(2),n=a):(r=5,n=a,i=new Array(4),a>=6?n=a-3:1===d&&(r=2,i=new Array(2),n=a)),i[0]=r<<3,i[0]|=(15&a)>>>1,i[1]=(15&a)<<7,i[1]|=(15&d)<<3,5===r&&(i[1]|=(15&n)>>>1,i[2]=(1&n)<<7,i[2]|=8,i[3]=0),{audioType:"aac",config:i,sampleRate:o,channelCount:d,objectType:r,codec:"mp4a.40."+r,originalCodec:"mp4a.40."+s}}class jt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,i=this.data_;for(;;){if(t+7>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(4095===(i[t+0]<<8|i[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let i=this.current_syncword_offset_,r=(8&e[i+1])>>>3,s=(6&e[i+1])>>>1,a=1&e[i+1],n=(192&e[i+2])>>>6,o=(60&e[i+2])>>>2,d=(1&e[i+2])<<2|(192&e[i+3])>>>6,l=(3&e[i+3])<<11|e[i+4]<<3|(224&e[i+5])>>>5;if(e[i+6],i+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let c=1===a?7:9,u=l-c;i+=c;let h=this.findNextSyncwordOffset(i+u);if(this.current_syncword_offset_=h,0!==r&&1!==r||0!==s)continue;let f=e.subarray(i,i+u);t={},t.audio_object_type=n+1,t.sampling_freq_index=o,t.sampling_frequency=Ot[o],t.channel_config=d,t.data=f}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Kt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,i=this.data_;for(;;){if(t+1>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(695===(i[t+0]<<3|i[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),i=0;for(let r=0;r<=t;r++)i<<=8,i|=e.readByte();return i}readNextAACFrame(e){let t=this.data_,i=null;for(;null==i&&!this.eof_flag_;){let r=this.current_syncword_offset_,s=(31&t[r+1])<<8|t[r+2];if(r+3+s>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let a=new Nt(t.subarray(r+3,r+3+s)),n=null;if(a.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(r+3+s),a.destroy();continue}n=e}else{let e=a.readBool();if(e&&a.readBool()){console.error("audioMuxVersionA is Not Supported"),a.destroy();break}if(e&&this.getLATMValue(a),!a.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),a.destroy();break}if(0!==a.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),a.destroy();break}if(0!==a.readBits(4)){console.error("more than 2 numProgram Not Supported"),a.destroy();break}if(0!==a.readBits(3)){console.error("more than 2 numLayer Not Supported"),a.destroy();break}let t=e?this.getLATMValue(a):0,i=a.readBits(5);t-=5;let r=a.readBits(4);t-=4;let s=a.readBits(4);t-=4,a.readBits(3),t-=3,t>0&&a.readBits(t);let o=a.readBits(3);if(0!==o){console.error(`frameLengthType = ${o}. Only frameLengthType = 0 Supported`),a.destroy();break}a.readByte();let d=a.readBool();if(d)if(e)this.getLATMValue(a);else{let e=0;for(;;){e<<=8;let t=a.readBool();if(e+=a.readByte(),!t)break}console.log(e)}a.readBool()&&a.readByte(),n={},n.audio_object_type=i,n.sampling_freq_index=r,n.sampling_frequency=Ot[n.sampling_freq_index],n.channel_config=s,n.other_data_present=d}let o=0;for(;;){let e=a.readByte();if(o+=e,255!==e)break}let d=new Uint8Array(o);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function Zt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return;const i=e.length,r=[];let s,a=0;for(;a+t>>=8),a+=t,s){if(a+s>i)break;r.push(e.subarray(a,a+s)),a+=s}return r}function Jt(e){const t=e.byteLength,i=new Uint8Array(4);i[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t;const r=new Uint8Array(t+4);return r.set(i,0),r.set(e,4),r}function Qt(e,t){let i=null;return t?e.length>=28&&(i=1+(3&e[26])):e.length>=12&&(i=1+(3&e[9])),i}function ei(){return(new Date).getTime()}function ti(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}function ii(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function ri(e){let t=0,i=ii();return r=>{if(s=r,"[object Number]"!==Object.prototype.toString.call(s))return;var s;t+=r;const a=ii(),n=a-i;n>=1e3&&(e(t/n*1e3),i=a,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();function si(e){return null==e}function ai(e){return!si(e)}function ni(e){return"function"==typeof e}function oi(e){let t=null,i=31&e[0];return i!==Oe&&i!==He||(t=Pe),t||(i=(126&e[0])>>1,i!==it&&i!==st&&i!==nt||(t=Me)),t}function di(){return"undefined"!=typeof WritableStream}function li(e){e.close()}function ci(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let i=e[0],r=null,s=1;if(e.length>0){let t=e[1];t&&t.ts-i.ts>1e5&&(i=t,s=2)}if(i)for(let a=s;a=1e3){e[a-1].ts-i.ts<1e3&&(r=a+1)}}}return r}function ui(e){return e.ok&&e.status>=200&&e.status<=299}function hi(){return function(e){let t="";if("object"==typeof e)try{t=JSON.stringify(e),t=JSON.parse(t)}catch(i){t=e}else t=e;return t}(B)}function fi(e){return e[0]>>4===Ut&&e[1]===Bt}function pi(e){return!0===e||"true"===e}function _i(e){return!0!==e&&"true"!==e}function mi(){return!!(self.Worker&&self.MediaSource&&"canConstructInDedicatedWorker"in self.MediaSource&&!0===self.MediaSource.canConstructInDedicatedWorker)}function gi(e,t){const i=Zt(e.slice(5));let r=!1;return i.forEach((e=>{const i=t?e[0]>>>1&63:31&e[0];(t&&(i===Xe||i===Je||i===et)||_i(t)&&i===Ve)&&(r=!0)})),r}var yi=function(e,t,i,r){return new(i||(i=Promise))((function(s,a){function n(e){try{d(r.next(e))}catch(e){a(e)}}function o(e){try{d(r.throw(e))}catch(e){a(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(n,o)}d((r=r.apply(e,t||[])).next())}))};const bi=Symbol(32),vi=Symbol(16),Si=Symbol(8);class wi{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return yi(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,i)=>{var r;this.reject=i,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(r=this.pull)||void 0===r||r.call(this,e)}))}))}readU32(){return this.read(bi)}readU16(){return this.read(vi)}readU8(){return this.read(Si)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let i=0;const r=e=>t.length<(i=e);if("number"==typeof this.need){if(r(this.need))return;e=t.subarray(0,i)}else if(this.need===bi){if(r(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===vi){if(r(2))return;e=t[0]<<8|t[1]}else if(this.need===Si){if(r(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(r(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,i)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(r(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,i)),e=this.need}return this.consumed+=i,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,i=t+e;if(i<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,i);else{const e=new Uint8Array(i);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,i)}return this.buffer=new Uint8Array(e),this.buffer}}wi.U32=bi,wi.U16=vi,wi.U8=Si;class Ai{constructor(e){this.log=function(t){if(e._opt.debugLevel==b){const a=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;s1?i-1:0),s=1;s1?r-1:0),a=1;a=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(r[s]=t[e],s++);return new Uint8Array(r.buffer,0,s)}static parseSPS(e){let t=Bi._ebsp2rbsp(e),i=new Nt(t);i.readByte();let r=i.readByte();i.readByte();let s=i.readByte();i.readUEG();let a=Bi.getProfileString(r),n=Bi.getLevelString(s),o=1,d=420,l=[0,420,422,444],c=8;if((100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r||138===r||144===r)&&(o=i.readUEG(),3===o&&i.readBits(1),o<=3&&(d=l[o]),c=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool())){let e=3!==o?8:12;for(let t=0;t0&&e<16?(v=t[e-1],S=r[e-1]):255===e&&(v=i.readByte()<<8|i.readByte(),S=i.readByte()<<8|i.readByte())}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool()&&i.readBits(24)),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool()){let e=i.readBits(32),t=i.readBits(32);A=i.readBool(),B=t,U=2*e,w=B/U}}let x=1;1===v&&1===S||(x=v/S);let E=0,T=0;if(0===o)E=1,T=2-_;else{E=3===o?1:2,T=(1===o?2:1)*(2-_)}let k=16*(f+1),C=16*(p+1)*(2-_);k-=(m+g)*E,C-=(y+b)*T;let L=Math.ceil(k*x);return i.destroy(),i=null,{profile_string:a,level_string:n,bit_depth:c,ref_frames:h,chroma_format:d,chroma_format_string:Bi.getChromaFormatString(d),frame_rate:{fixed:A,fps:w,fps_den:U,fps_num:B},sar_ratio:{width:v,height:S},codec_size:{width:k,height:C},present_size:{width:L,height:C}}}static parseSPS$2(e){let t=e.subarray(1,4),i="avc1.";for(let e=0;e<3;e++){let r=t[e].toString(16);r.length<2&&(r="0"+r),i+=r}let r=Bi._ebsp2rbsp(e),s=new Nt(r);s.readByte();let a=s.readByte();s.readByte();let n=s.readByte();s.readUEG();let o=Bi.getProfileString(a),d=Bi.getLevelString(n),l=1,c=420,u=[0,420,422,444],h=8,f=8;if((100===a||110===a||122===a||244===a||44===a||83===a||86===a||118===a||128===a||138===a||144===a)&&(l=s.readUEG(),3===l&&s.readBits(1),l<=3&&(c=u[l]),h=s.readUEG()+8,f=s.readUEG()+8,s.readBits(1),s.readBool())){let e=3!==l?8:12;for(let t=0;t0&&e<16?(A=t[e-1],B=i[e-1]):255===e&&(A=s.readByte()<<8|s.readByte(),B=s.readByte()<<8|s.readByte())}if(s.readBool()&&s.readBool(),s.readBool()&&(s.readBits(4),s.readBool()&&s.readBits(24)),s.readBool()&&(s.readUEG(),s.readUEG()),s.readBool()){let e=s.readBits(32),t=s.readBits(32);x=s.readBool(),E=t,T=2*e,U=E/T}}let k=1;1===A&&1===B||(k=A/B);let C=0,L=0;if(0===l)C=1,L=2-y;else{C=3===l?1:2,L=(1===l?2:1)*(2-y)}let D=16*(m+1),I=16*(g+1)*(2-y);D-=(b+v)*C,I-=(S+w)*L;let F=Math.ceil(D*k);return s.destroy(),s=null,{codec_mimetype:i,profile_idc:a,level_idc:n,profile_string:o,level_string:d,chroma_format_idc:l,bit_depth:h,bit_depth_luma:h,bit_depth_chroma:f,ref_frames:_,chroma_format:c,chroma_format_string:Bi.getChromaFormatString(c),frame_rate:{fixed:x,fps:U,fps_den:T,fps_num:E},sar_ratio:{width:A,height:B},codec_size:{width:D,height:I},present_size:{width:F,height:I}}}static _skipScalingList(e,t){let i=8,r=8,s=0;for(let a=0;a=this.buflen)return this.iserro=!0,0;this.iserro=!1,i=this.bufoff+e>8?8-this.bufoff:e,t<<=i,t+=this.buffer[this.bufpos]>>8-this.bufoff-i&255>>8-i,this.bufoff+=i,e-=i,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,i=this.bufoff,r=this.read(e);return this.bufpos=t,this.bufoff=i,r}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),r=new Uint8Array(e+4);r.set(i,0),r.set(t.sps,4),t.sps=r}if(t.pps){const e=t.pps.byteLength,i=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),r=new Uint8Array(e+4);r.set(i,0),r.set(t.pps,4),t.pps=r}return t}function Ei(e){let{sps:t,pps:i}=e;const r=[23,0,0,0,0,1,66,0,30,255];r[0]=23,r[6]=t[1],r[7]=t[2],r[8]=t[3],r[10]=225,r[11]=t.byteLength>>8&255,r[12]=255&t.byteLength,r.push(...t,1,i.byteLength>>8&255,255&i.byteLength,...i);return new Uint8Array(r)}function Ti(e){let{sps:t,pps:i}=e,r=8+t.byteLength+1+2+i.byteLength,s=!1;const a=Bi.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(s=!0,r+=4);let n=new Uint8Array(r);n[0]=1,n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=255,n[5]=225;let o=t.byteLength;n[6]=o>>>8,n[7]=255&o;let d=8;n.set(t,8),d+=o,n[d]=1;let l=i.byteLength;n[d+1]=l>>>8,n[d+2]=255&l,n.set(i,d+3),d+=3+l,s&&(n[d]=252|a.chroma_format_idc,n[d+1]=248|a.bit_depth_luma-8,n[d+2]=248|a.bit_depth_chroma-8,n[d+3]=0,d+=4);const c=[23,0,0,0,0],u=new Uint8Array(c.length+n.byteLength);return u.set(c,0),u.set(n,c.length),u}function ki(e,t){let i=[];i[0]=t?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=e.byteLength>>24&255,i[6]=e.byteLength>>16&255,i[7]=e.byteLength>>8&255,i[8]=255&e.byteLength;const r=new Uint8Array(i.length+e.byteLength);return r.set(i,0),r.set(e,i.length),r}function Ci(e,t){let i=[];i[0]=t?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0;const r=new Uint8Array(i.length+e.byteLength);return r.set(i,0),r.set(e,i.length),r}function Li(e){return 31&e[0]}function Di(e){return e===Ye}function Ii(e){return!function(e){return e===Oe||e===He}(e)&&!Di(e)}function Fi(e){return e===Ve}function Pi(e){if(0===e.length)return!1;const t=Li(e[0]);for(let i=1;i=i.byteLength)return this.eofFlag=!0,i.byteLength;let e=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],r=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===e||1===r)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let i=this.currentStartcodeOffset;i+=1===(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3;let r=31&e[i],s=(128&e[i])>>>7,a=this.findNextStartCodeOffset(i);this.currentStartcodeOffset=a,r>=Ke||0===s&&(t={type:r,data:e.subarray(i,a)})}return t}}class zi{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Ri=e=>{let t=e,i=t.byteLength,r=new Uint8Array(i),s=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(r[s]=t[e],s++);return new Uint8Array(r.buffer,0,s)},Ni=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Gi{static _ebsp2rbsp(e){let t=e,i=t.byteLength,r=new Uint8Array(i),s=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(r[s]=t[e],s++);return new Uint8Array(r.buffer,0,s)}static parseVPS(e){let t=Gi._ebsp2rbsp(e),i=new Nt(t);return i.readByte(),i.readByte(),i.readBits(4),i.readBits(2),i.readBits(6),{num_temporal_layers:i.readBits(3)+1,temporal_id_nested:i.readBool()}}static parseSPS(e){let t=Gi._ebsp2rbsp(e),i=new Nt(t);i.readByte(),i.readByte();let r=0,s=0,a=0,n=0;i.readBits(4);let o=i.readBits(3);i.readBool();let d=i.readBits(2),l=i.readBool(),c=i.readBits(5),u=i.readByte(),h=i.readByte(),f=i.readByte(),p=i.readByte(),_=i.readByte(),m=i.readByte(),g=i.readByte(),y=i.readByte(),b=i.readByte(),v=i.readByte(),S=i.readByte(),w=[],A=[];for(let e=0;e0)for(let e=o;e<8;e++)i.readBits(2);for(let e=0;e1&&i.readSEG();for(let e=0;e0&&e<=16?(F=t[e-1],P=r[e-1]):255===e&&(F=i.readBits(16),P=i.readBits(16))}if(i.readBool()&&i.readBool(),i.readBool()){i.readBits(3),i.readBool(),i.readBool()&&(i.readByte(),i.readByte(),i.readByte())}if(i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool(),i.readBool(),i.readBool(),D=i.readBool(),D&&(i.readUEG(),i.readUEG(),i.readUEG(),i.readUEG()),i.readBool()){if(z=i.readBits(32),R=i.readBits(32),i.readBool()&&i.readUEG(),i.readBool()){let e=!1,t=!1,r=!1;e=i.readBool(),t=i.readBool(),(e||t)&&(r=i.readBool(),r&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),r&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(let s=0;s<=o;s++){let s=i.readBool();M=s;let a=!0,n=1;s||(a=i.readBool());let o=!1;if(a?i.readUEG():o=i.readBool(),o||(n=i.readUEG()+1),e){for(let e=0;e>6&3,i.general_tier_flag=e[1]>>5&1,i.general_profile_idc=31&e[1],i.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],i.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],i.general_constraint_indicator_flags=i.general_constraint_indicator_flags<<16|e[10]<<8|e[11],i.general_level_idc=e[12],i.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],i.parallelismType=3&e[15],i.chromaFormat=3&e[16],i.bitDepthLumaMinus8=7&e[17],i.bitDepthChromaMinus8=7&e[18],i.avgFrameRate=e[19]<<8|e[20],i.constantFrameRate=e[21]>>6&3,i.numTemporalLayers=e[21]>>3&7,i.temporalIdNested=e[21]>>2&1,i.lengthSizeMinusOne=3&e[21];let r=e[22],s=e.slice(23);for(let e=0;e0)for(let t=i;t<8;t++)e.read(2);r.sub_layer_profile_space=[],r.sub_layer_tier_flag=[],r.sub_layer_profile_idc=[],r.sub_layer_profile_compatibility_flag=[],r.sub_layer_progressive_source_flag=[],r.sub_layer_interlaced_source_flag=[],r.sub_layer_non_packed_constraint_flag=[],r.sub_layer_frame_only_constraint_flag=[],r.sub_layer_level_idc=[];for(let t=0;t{let t=Ri(e),i=new Nt(t);return i.readByte(),i.readByte(),i.readBits(4),i.readBits(2),i.readBits(6),{num_temporal_layers:i.readBits(3)+1,temporal_id_nested:i.readBool()}})(t),n=(e=>{let t=Ri(e),i=new Nt(t);i.readByte(),i.readByte();let r=0,s=0,a=0,n=0;i.readBits(4);let o=i.readBits(3);i.readBool();let d=i.readBits(2),l=i.readBool(),c=i.readBits(5),u=i.readByte(),h=i.readByte(),f=i.readByte(),p=i.readByte(),_=i.readByte(),m=i.readByte(),g=i.readByte(),y=i.readByte(),b=i.readByte(),v=i.readByte(),S=i.readByte(),w=[],A=[];for(let e=0;e0)for(let e=o;e<8;e++)i.readBits(2);for(let e=0;e1&&i.readSEG();for(let e=0;e0&&e<16?(F=t[e-1],P=r[e-1]):255===e&&(F=i.readBits(16),P=i.readBits(16))}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(3),i.readBool(),i.readBool()&&(i.readByte(),i.readByte(),i.readByte())),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool(),i.readBool(),i.readBool(),D=i.readBool(),D&&(r+=i.readUEG(),s+=i.readUEG(),a+=i.readUEG(),n+=i.readUEG()),i.readBool()&&(z=i.readBits(32),R=i.readBits(32),i.readBool()&&(i.readUEG(),i.readBool()))){let e=!1,t=!1,r=!1;e=i.readBool(),t=i.readBool(),(e||t)&&(r=i.readBool(),r&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),r&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(let s=0;s<=o;s++){let s=i.readBool();M=s;let a=!1,n=1;s||(a=i.readBool());let o=!1;if(a?i.readSEG():o=i.readBool(),o||(cpbcnt=i.readUEG()+1),e)for(let e=0;e{let t=Ri(e),i=new Nt(t);i.readByte(),i.readByte(),i.readUEG(),i.readUEG(),i.readBool(),i.readBool(),i.readBits(3),i.readBool(),i.readBool(),i.readUEG(),i.readUEG(),i.readSEG(),i.readBool(),i.readBool(),i.readBool()&&i.readUEG(),i.readSEG(),i.readSEG(),i.readBool(),i.readBool(),i.readBool(),i.readBool();let r=i.readBool(),s=i.readBool(),a=1;return s&&r?a=0:s?a=3:r&&(a=2),{parallelismType:a}})(i);s=Object.assign(s,a,n,o);let d=23+(5+t.byteLength)+(5+r.byteLength)+(5+i.byteLength),l=new Uint8Array(d);l[0]=1,l[1]=(3&s.general_profile_space)<<6|(s.general_tier_flag?1:0)<<5|31&s.general_profile_idc,l[2]=s.general_profile_compatibility_flags_1||0,l[3]=s.general_profile_compatibility_flags_2||0,l[4]=s.general_profile_compatibility_flags_3||0,l[5]=s.general_profile_compatibility_flags_4||0,l[6]=s.general_constraint_indicator_flags_1||0,l[7]=s.general_constraint_indicator_flags_2||0,l[8]=s.general_constraint_indicator_flags_3||0,l[9]=s.general_constraint_indicator_flags_4||0,l[10]=s.general_constraint_indicator_flags_5||0,l[11]=s.general_constraint_indicator_flags_6||0,l[12]=60,l[13]=240|(3840&s.min_spatial_segmentation_idc)>>8,l[14]=255&s.min_spatial_segmentation_idc,l[15]=252|3&s.parallelismType,l[16]=252|3&s.chroma_format_idc,l[17]=248|7&s.bit_depth_luma_minus8,l[18]=248|7&s.bit_depth_chroma_minus8,l[19]=0,l[20]=0,l[21]=(3&s.constant_frame_rate)<<6|(7&s.num_temporal_layers)<<3|(s.temporal_id_nested?1:0)<<2|3,l[22]=3,l[23]=128|it,l[24]=0,l[25]=1,l[26]=(65280&t.byteLength)>>8,l[27]=(255&t.byteLength)>>0,l.set(t,28),l[23+(5+t.byteLength)+0]=128|st,l[23+(5+t.byteLength)+1]=0,l[23+(5+t.byteLength)+2]=1,l[23+(5+t.byteLength)+3]=(65280&r.byteLength)>>8,l[23+(5+t.byteLength)+4]=(255&r.byteLength)>>0,l.set(r,23+(5+t.byteLength)+5),l[23+(5+t.byteLength+5+r.byteLength)+0]=128|nt,l[23+(5+t.byteLength+5+r.byteLength)+1]=0,l[23+(5+t.byteLength+5+r.byteLength)+2]=1,l[23+(5+t.byteLength+5+r.byteLength)+3]=(65280&i.byteLength)>>8,l[23+(5+t.byteLength+5+r.byteLength)+4]=(255&i.byteLength)>>0,l.set(i,23+(5+t.byteLength+5+r.byteLength)+5);const c=[28,0,0,0,0],u=new Uint8Array(c.length+l.byteLength);return u.set(c,0),u.set(l,c.length),u}function Wi(e,t){let i=[];i[0]=t?28:44,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=e.byteLength>>24&255,i[6]=e.byteLength>>16&255,i[7]=e.byteLength>>8&255,i[8]=255&e.byteLength;const r=new Uint8Array(i.length+e.byteLength);return r.set(i,0),r.set(e,i.length),r}function Yi(e,t){let i=[];i[0]=t?28:44,i[1]=1,i[2]=0,i[3]=0,i[4]=0;const r=new Uint8Array(i.length+e.byteLength);return r.set(i,0),r.set(e,i.length),r}function qi(e){return(126&e[0])>>1}function ji(e){return e===dt}function Ki(e){return!function(e){return e>=32&&e<=40}(e)}function Xi(e){return e>=16&&e<=21}function Zi(e){if(0===e.length)return!1;const t=qi(e[0]);for(let i=1;i=i.byteLength)return this.eofFlag=!0,i.byteLength;let e=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],r=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===e||1===r)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let i=this.currentStartcodeOffset;i+=1===(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3;let r=e[i]>>1&63,s=(128&e[i])>>>7,a=this.findNextStartCodeOffset(i);this.currentStartcodeOffset=a,0===s&&(t={type:r,data:e.subarray(i,a)})}return t}}class Qi{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}function er(e){return parseInt(e)===e}function tr(e){if(!er(e.length))return!1;for(var t=0;t255)return!1;return!0}function ir(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!tr(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(er(e.length)&&tr(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function rr(e){return new Uint8Array(e)}function sr(e,t,i,r,s){null==r&&null==s||(e=e.slice?e.slice(r,s):Array.prototype.slice.call(e,r,s)),t.set(e,i)}var ar,nr={toBytes:function(e){var t=[],i=0;for(e=encodeURI(e);i191&&r<224?(t.push(String.fromCharCode((31&r)<<6|63&e[i+1])),i+=2):(t.push(String.fromCharCode((15&r)<<12|(63&e[i+1])<<6|63&e[i+2])),i+=3)}return t.join("")}},or=(ar="0123456789abcdef",{toBytes:function(e){for(var t=[],i=0;i>4]+ar[15&r])}return t.join("")}}),dr={16:10,24:12,32:14},lr=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],cr=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],ur=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],hr=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],fr=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],pr=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],_r=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],mr=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],gr=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],yr=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],br=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],vr=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Sr=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],wr=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Ar=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Br(e){for(var t=[],i=0;i>2,this._Ke[i][t%4]=a[t],this._Kd[e-i][t%4]=a[t];for(var n,o=0,d=s;d>16&255]<<24^cr[n>>8&255]<<16^cr[255&n]<<8^cr[n>>24&255]^lr[o]<<24,o+=1,8!=s)for(t=1;t>8&255]<<8^cr[n>>16&255]<<16^cr[n>>24&255]<<24;for(t=s/2+1;t>2,c=d%4,this._Ke[l][c]=a[t],this._Kd[e-l][c]=a[t++],d++}for(var l=1;l>24&255]^Sr[n>>16&255]^wr[n>>8&255]^Ar[255&n]},Ur.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,i=[0,0,0,0],r=Br(e),s=0;s<4;s++)r[s]^=this._Ke[0][s];for(var a=1;a>24&255]^fr[r[(s+1)%4]>>16&255]^pr[r[(s+2)%4]>>8&255]^_r[255&r[(s+3)%4]]^this._Ke[a][s];r=i.slice()}var n,o=rr(16);for(s=0;s<4;s++)n=this._Ke[t][s],o[4*s]=255&(cr[r[s]>>24&255]^n>>24),o[4*s+1]=255&(cr[r[(s+1)%4]>>16&255]^n>>16),o[4*s+2]=255&(cr[r[(s+2)%4]>>8&255]^n>>8),o[4*s+3]=255&(cr[255&r[(s+3)%4]]^n);return o},Ur.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,i=[0,0,0,0],r=Br(e),s=0;s<4;s++)r[s]^=this._Kd[0][s];for(var a=1;a>24&255]^gr[r[(s+3)%4]>>16&255]^yr[r[(s+2)%4]>>8&255]^br[255&r[(s+1)%4]]^this._Kd[a][s];r=i.slice()}var n,o=rr(16);for(s=0;s<4;s++)n=this._Kd[t][s],o[4*s]=255&(ur[r[s]>>24&255]^n>>24),o[4*s+1]=255&(ur[r[(s+3)%4]>>16&255]^n>>16),o[4*s+2]=255&(ur[r[(s+2)%4]>>8&255]^n>>8),o[4*s+3]=255&(ur[255&r[(s+1)%4]]^n);return o};var xr=function(e){if(!(this instanceof xr))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new Ur(e)};xr.prototype.encrypt=function(e){if((e=ir(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=rr(e.length),i=rr(16),r=0;rNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},Cr.prototype.setBytes=function(e){if(16!=(e=ir(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Cr.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var Lr=function(e,t){if(!(this instanceof Lr))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Cr||(t=new Cr(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new Ur(e)};Lr.prototype.encrypt=function(e){for(var t=ir(e,!0),i=0;i16)throw new Error("PKCS#7 padding byte out of range");for(var i=e.length-t,r=0;r>>2]>>>24-a%4*8&255;t[r+a>>>2]|=n<<24-(r+a)%4*8}else for(var o=0;o>>2]=i[o>>>2];return this.sigBytes+=s,this},clamp:function(){var t=this.words,i=this.sigBytes;t[i>>>2]&=4294967295<<32-i%4*8,t.length=e.ceil(i/4)},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],i=0;i>>2]>>>24-s%4*8&255;r.push((a>>>4).toString(16)),r.push((15&a).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,i=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new l.init(i,t/2)}},h=c.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],s=0;s>>2]>>>24-s%4*8&255;r.push(String.fromCharCode(a))}return r.join("")},parse:function(e){for(var t=e.length,i=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new l.init(i,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var i,r=this._data,s=r.words,a=r.sigBytes,n=this.blockSize,o=a/(4*n),d=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*n,c=e.min(4*d,a);if(d){for(var u=0;u>>2]|=e[s]<<24-s%4*8;t.call(this,r,i)}else t.apply(this,arguments)};r.prototype=e}}(),i.lib.WordArray)})),Rt((function(e,t){var i;e.exports=(i=Ir,function(){var e=i,t=e.lib.WordArray,r=e.enc;function s(e){return e<<8&4278255360|e>>>8&16711935}r.Utf16=r.Utf16BE={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],s=0;s>>2]>>>16-s%4*8&65535;r.push(String.fromCharCode(a))}return r.join("")},parse:function(e){for(var i=e.length,r=[],s=0;s>>1]|=e.charCodeAt(s)<<16-s%2*16;return t.create(r,2*i)}},r.Utf16LE={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],a=0;a>>2]>>>16-a%4*8&65535);r.push(String.fromCharCode(n))}return r.join("")},parse:function(e){for(var i=e.length,r=[],a=0;a>>1]|=s(e.charCodeAt(a)<<16-a%2*16);return t.create(r,2*i)}}}(),i.enc.Utf16)})),Rt((function(e,t){var i;e.exports=(i=Ir,function(){var e=i,t=e.lib.WordArray;function r(e,i,r){for(var s=[],a=0,n=0;n>>6-n%4*2;s[a>>>2]|=o<<24-a%4*8,a++}return t.create(s,a)}e.enc.Base64={stringify:function(e){var t=e.words,i=e.sigBytes,r=this._map;e.clamp();for(var s=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,o=0;o<4&&a+.75*o>>6*(3-o)&63));var d=r.charAt(64);if(d)for(;s.length%4;)s.push(d);return s.join("")},parse:function(e){var t=e.length,i=this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var a=0;a>>6-n%4*2;s[a>>>2]|=o<<24-a%4*8,a++}return t.create(s,a)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var i=e.words,r=e.sigBytes,s=t?this._safe_map:this._map;e.clamp();for(var a=[],n=0;n>>2]>>>24-n%4*8&255)<<16|(i[n+1>>>2]>>>24-(n+1)%4*8&255)<<8|i[n+2>>>2]>>>24-(n+2)%4*8&255,d=0;d<4&&n+.75*d>>6*(3-d)&63));var l=s.charAt(64);if(l)for(;a.length%4;)a.push(l);return a.join("")},parse:function(e,t){void 0===t&&(t=!0);var i=e.length,s=t?this._safe_map:this._map,a=this._reverseMap;if(!a){a=this._reverseMap=[];for(var n=0;n>>24)|4278255360&(s<<24|s>>>8)}var a=this._hash.words,n=e[t+0],d=e[t+1],f=e[t+2],p=e[t+3],_=e[t+4],m=e[t+5],g=e[t+6],y=e[t+7],b=e[t+8],v=e[t+9],S=e[t+10],w=e[t+11],A=e[t+12],B=e[t+13],U=e[t+14],x=e[t+15],E=a[0],T=a[1],k=a[2],C=a[3];E=l(E,T,k,C,n,7,o[0]),C=l(C,E,T,k,d,12,o[1]),k=l(k,C,E,T,f,17,o[2]),T=l(T,k,C,E,p,22,o[3]),E=l(E,T,k,C,_,7,o[4]),C=l(C,E,T,k,m,12,o[5]),k=l(k,C,E,T,g,17,o[6]),T=l(T,k,C,E,y,22,o[7]),E=l(E,T,k,C,b,7,o[8]),C=l(C,E,T,k,v,12,o[9]),k=l(k,C,E,T,S,17,o[10]),T=l(T,k,C,E,w,22,o[11]),E=l(E,T,k,C,A,7,o[12]),C=l(C,E,T,k,B,12,o[13]),k=l(k,C,E,T,U,17,o[14]),E=c(E,T=l(T,k,C,E,x,22,o[15]),k,C,d,5,o[16]),C=c(C,E,T,k,g,9,o[17]),k=c(k,C,E,T,w,14,o[18]),T=c(T,k,C,E,n,20,o[19]),E=c(E,T,k,C,m,5,o[20]),C=c(C,E,T,k,S,9,o[21]),k=c(k,C,E,T,x,14,o[22]),T=c(T,k,C,E,_,20,o[23]),E=c(E,T,k,C,v,5,o[24]),C=c(C,E,T,k,U,9,o[25]),k=c(k,C,E,T,p,14,o[26]),T=c(T,k,C,E,b,20,o[27]),E=c(E,T,k,C,B,5,o[28]),C=c(C,E,T,k,f,9,o[29]),k=c(k,C,E,T,y,14,o[30]),E=u(E,T=c(T,k,C,E,A,20,o[31]),k,C,m,4,o[32]),C=u(C,E,T,k,b,11,o[33]),k=u(k,C,E,T,w,16,o[34]),T=u(T,k,C,E,U,23,o[35]),E=u(E,T,k,C,d,4,o[36]),C=u(C,E,T,k,_,11,o[37]),k=u(k,C,E,T,y,16,o[38]),T=u(T,k,C,E,S,23,o[39]),E=u(E,T,k,C,B,4,o[40]),C=u(C,E,T,k,n,11,o[41]),k=u(k,C,E,T,p,16,o[42]),T=u(T,k,C,E,g,23,o[43]),E=u(E,T,k,C,v,4,o[44]),C=u(C,E,T,k,A,11,o[45]),k=u(k,C,E,T,x,16,o[46]),E=h(E,T=u(T,k,C,E,f,23,o[47]),k,C,n,6,o[48]),C=h(C,E,T,k,y,10,o[49]),k=h(k,C,E,T,U,15,o[50]),T=h(T,k,C,E,m,21,o[51]),E=h(E,T,k,C,A,6,o[52]),C=h(C,E,T,k,p,10,o[53]),k=h(k,C,E,T,S,15,o[54]),T=h(T,k,C,E,d,21,o[55]),E=h(E,T,k,C,b,6,o[56]),C=h(C,E,T,k,x,10,o[57]),k=h(k,C,E,T,g,15,o[58]),T=h(T,k,C,E,B,21,o[59]),E=h(E,T,k,C,_,6,o[60]),C=h(C,E,T,k,w,10,o[61]),k=h(k,C,E,T,f,15,o[62]),T=h(T,k,C,E,v,21,o[63]),a[0]=a[0]+E|0,a[1]=a[1]+T|0,a[2]=a[2]+k|0,a[3]=a[3]+C|0},_doFinalize:function(){var t=this._data,i=t.words,r=8*this._nDataBytes,s=8*t.sigBytes;i[s>>>5]|=128<<24-s%32;var a=e.floor(r/4294967296),n=r;i[15+(s+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),i[14+(s+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t.sigBytes=4*(i.length+1),this._process();for(var o=this._hash,d=o.words,l=0;l<4;l++){var c=d[l];d[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return o},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,i,r,s,a,n){var o=e+(t&i|~t&r)+s+n;return(o<>>32-a)+t}function c(e,t,i,r,s,a,n){var o=e+(t&r|i&~r)+s+n;return(o<>>32-a)+t}function u(e,t,i,r,s,a,n){var o=e+(t^i^r)+s+n;return(o<>>32-a)+t}function h(e,t,i,r,s,a,n){var o=e+(i^(t|~r))+s+n;return(o<>>32-a)+t}t.MD5=a._createHelper(d),t.HmacMD5=a._createHmacHelper(d)}(Math),i.MD5)})),Rt((function(e,t){var i,r,s,a,n,o,d,l;e.exports=(r=(i=l=Ir).lib,s=r.WordArray,a=r.Hasher,n=i.algo,o=[],d=n.SHA1=a.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=this._hash.words,r=i[0],s=i[1],a=i[2],n=i[3],d=i[4],l=0;l<80;l++){if(l<16)o[l]=0|e[t+l];else{var c=o[l-3]^o[l-8]^o[l-14]^o[l-16];o[l]=c<<1|c>>>31}var u=(r<<5|r>>>27)+d+o[l];u+=l<20?1518500249+(s&a|~s&n):l<40?1859775393+(s^a^n):l<60?(s&a|s&n|a&n)-1894007588:(s^a^n)-899497514,d=n,n=a,a=s<<30|s>>>2,s=r,r=u}i[0]=i[0]+r|0,i[1]=i[1]+s|0,i[2]=i[2]+a|0,i[3]=i[3]+n|0,i[4]=i[4]+d|0},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(i/4294967296),t[15+(r+64>>>9<<4)]=i,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}}),i.SHA1=a._createHelper(d),i.HmacSHA1=a._createHmacHelper(d),l.SHA1)})),Rt((function(e,t){var i;e.exports=(i=Ir,function(e){var t=i,r=t.lib,s=r.WordArray,a=r.Hasher,n=t.algo,o=[],d=[];!function(){function t(t){for(var i=e.sqrt(t),r=2;r<=i;r++)if(!(t%r))return!1;return!0}function i(e){return 4294967296*(e-(0|e))|0}for(var r=2,s=0;s<64;)t(r)&&(s<8&&(o[s]=i(e.pow(r,.5))),d[s]=i(e.pow(r,1/3)),s++),r++}();var l=[],c=n.SHA256=a.extend({_doReset:function(){this._hash=new s.init(o.slice(0))},_doProcessBlock:function(e,t){for(var i=this._hash.words,r=i[0],s=i[1],a=i[2],n=i[3],o=i[4],c=i[5],u=i[6],h=i[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],_=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,m=l[f-2],g=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;l[f]=_+l[f-7]+g+l[f-16]}var y=r&s^r&a^s&a,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),v=h+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&c^~o&u)+d[f]+l[f];h=u,u=c,c=o,o=n+v|0,n=a,a=s,s=r,r=v+(b+y)|0}i[0]=i[0]+r|0,i[1]=i[1]+s|0,i[2]=i[2]+a|0,i[3]=i[3]+n|0,i[4]=i[4]+o|0,i[5]=i[5]+c|0,i[6]=i[6]+u|0,i[7]=i[7]+h|0},_doFinalize:function(){var t=this._data,i=t.words,r=8*this._nDataBytes,s=8*t.sigBytes;return i[s>>>5]|=128<<24-s%32,i[14+(s+64>>>9<<4)]=e.floor(r/4294967296),i[15+(s+64>>>9<<4)]=r,t.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=a._createHelper(c),t.HmacSHA256=a._createHmacHelper(c)}(Math),i.SHA256)})),Rt((function(e,t){var i,r,s,a,n,o;e.exports=(r=(i=o=Ir).lib.WordArray,s=i.algo,a=s.SHA256,n=s.SHA224=a.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=4,e}}),i.SHA224=a._createHelper(n),i.HmacSHA224=a._createHmacHelper(n),o.SHA224)})),Rt((function(e,t){var i;e.exports=(i=Ir,function(){var e=i,t=e.lib.Hasher,r=e.x64,s=r.Word,a=r.WordArray,n=e.algo;function o(){return s.create.apply(s,arguments)}var d=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=o()}();var c=n.SHA512=t.extend({_doReset:function(){this._hash=new a.init([new s.init(1779033703,4089235720),new s.init(3144134277,2227873595),new s.init(1013904242,4271175723),new s.init(2773480762,1595750129),new s.init(1359893119,2917565137),new s.init(2600822924,725511199),new s.init(528734635,4215389547),new s.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var i=this._hash.words,r=i[0],s=i[1],a=i[2],n=i[3],o=i[4],c=i[5],u=i[6],h=i[7],f=r.high,p=r.low,_=s.high,m=s.low,g=a.high,y=a.low,b=n.high,v=n.low,S=o.high,w=o.low,A=c.high,B=c.low,U=u.high,x=u.low,E=h.high,T=h.low,k=f,C=p,L=_,D=m,I=g,F=y,P=b,M=v,z=S,R=w,N=A,G=B,O=U,H=x,V=E,$=T,W=0;W<80;W++){var Y,q,j=l[W];if(W<16)q=j.high=0|e[t+2*W],Y=j.low=0|e[t+2*W+1];else{var K=l[W-15],X=K.high,Z=K.low,J=(X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7,Q=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),ee=l[W-2],te=ee.high,ie=ee.low,re=(te>>>19|ie<<13)^(te<<3|ie>>>29)^te>>>6,se=(ie>>>19|te<<13)^(ie<<3|te>>>29)^(ie>>>6|te<<26),ae=l[W-7],ne=ae.high,oe=ae.low,de=l[W-16],le=de.high,ce=de.low;q=(q=(q=J+ne+((Y=Q+oe)>>>0>>0?1:0))+re+((Y+=se)>>>0>>0?1:0))+le+((Y+=ce)>>>0>>0?1:0),j.high=q,j.low=Y}var ue,he=z&N^~z&O,fe=R&G^~R&H,pe=k&L^k&I^L&I,_e=C&D^C&F^D&F,me=(k>>>28|C<<4)^(k<<30|C>>>2)^(k<<25|C>>>7),ge=(C>>>28|k<<4)^(C<<30|k>>>2)^(C<<25|k>>>7),ye=(z>>>14|R<<18)^(z>>>18|R<<14)^(z<<23|R>>>9),be=(R>>>14|z<<18)^(R>>>18|z<<14)^(R<<23|z>>>9),ve=d[W],Se=ve.high,we=ve.low,Ae=V+ye+((ue=$+be)>>>0<$>>>0?1:0),Be=ge+_e;V=O,$=H,O=N,H=G,N=z,G=R,z=P+(Ae=(Ae=(Ae=Ae+he+((ue+=fe)>>>0>>0?1:0))+Se+((ue+=we)>>>0>>0?1:0))+q+((ue+=Y)>>>0>>0?1:0))+((R=M+ue|0)>>>0>>0?1:0)|0,P=I,M=F,I=L,F=D,L=k,D=C,k=Ae+(me+pe+(Be>>>0>>0?1:0))+((C=ue+Be|0)>>>0>>0?1:0)|0}p=r.low=p+C,r.high=f+k+(p>>>0>>0?1:0),m=s.low=m+D,s.high=_+L+(m>>>0>>0?1:0),y=a.low=y+F,a.high=g+I+(y>>>0>>0?1:0),v=n.low=v+M,n.high=b+P+(v>>>0>>0?1:0),w=o.low=w+R,o.high=S+z+(w>>>0>>0?1:0),B=c.low=B+G,c.high=A+N+(B>>>0>>0?1:0),x=u.low=x+H,u.high=U+O+(x>>>0>>0?1:0),T=h.low=T+$,h.high=E+V+(T>>>0<$>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[30+(r+128>>>10<<5)]=Math.floor(i/4294967296),t[31+(r+128>>>10<<5)]=i,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(c),e.HmacSHA512=t._createHmacHelper(c)}(),i.SHA512)})),Rt((function(e,t){var i,r,s,a,n,o,d,l;e.exports=(r=(i=l=Ir).x64,s=r.Word,a=r.WordArray,n=i.algo,o=n.SHA512,d=n.SHA384=o.extend({_doReset:function(){this._hash=new a.init([new s.init(3418070365,3238371032),new s.init(1654270250,914150663),new s.init(2438529370,812702999),new s.init(355462360,4144912697),new s.init(1731405415,4290775857),new s.init(2394180231,1750603025),new s.init(3675008525,1694076839),new s.init(1203062813,3204075428)])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=16,e}}),i.SHA384=o._createHelper(d),i.HmacSHA384=o._createHmacHelper(d),l.SHA384)})),Rt((function(e,t){var i;e.exports=(i=Ir,function(e){var t=i,r=t.lib,s=r.WordArray,a=r.Hasher,n=t.x64.Word,o=t.algo,d=[],l=[],c=[];!function(){for(var e=1,t=0,i=0;i<24;i++){d[e+5*t]=(i+1)*(i+2)/2%64;var r=(2*e+3*t)%5;e=t%5,t=r}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var s=1,a=0;a<24;a++){for(var o=0,u=0,h=0;h<7;h++){if(1&s){var f=(1<>>24)|4278255360&(a<<24|a>>>8),n=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),(T=i[s]).high^=n,T.low^=a}for(var o=0;o<24;o++){for(var h=0;h<5;h++){for(var f=0,p=0,_=0;_<5;_++)f^=(T=i[h+5*_]).high,p^=T.low;var m=u[h];m.high=f,m.low=p}for(h=0;h<5;h++){var g=u[(h+4)%5],y=u[(h+1)%5],b=y.high,v=y.low;for(f=g.high^(b<<1|v>>>31),p=g.low^(v<<1|b>>>31),_=0;_<5;_++)(T=i[h+5*_]).high^=f,T.low^=p}for(var S=1;S<25;S++){var w=(T=i[S]).high,A=T.low,B=d[S];B<32?(f=w<>>32-B,p=A<>>32-B):(f=A<>>64-B,p=w<>>64-B);var U=u[l[S]];U.high=f,U.low=p}var x=u[0],E=i[0];for(x.high=E.high,x.low=E.low,h=0;h<5;h++)for(_=0;_<5;_++){var T=i[S=h+5*_],k=u[S],C=u[(h+1)%5+5*_],L=u[(h+2)%5+5*_];T.high=k.high^~C.high&L.high,T.low=k.low^~C.low&L.low}T=i[0];var D=c[o];T.high^=D.high,T.low^=D.low}},_doFinalize:function(){var t=this._data,i=t.words;this._nDataBytes;var r=8*t.sigBytes,a=32*this.blockSize;i[r>>>5]|=1<<24-r%32,i[(e.ceil((r+1)/a)*a>>>5)-1]|=128,t.sigBytes=4*i.length,this._process();for(var n=this._state,o=this.cfg.outputLength/8,d=o/8,l=[],c=0;c>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(h)}return new s.init(l,o)},clone:function(){for(var e=a.clone.call(this),t=e._state=this._state.slice(0),i=0;i<25;i++)t[i]=t[i].clone();return e}});t.SHA3=a._createHelper(h),t.HmacSHA3=a._createHmacHelper(h)}(Math),i.SHA3)})),Rt((function(e,t){var i;e.exports=(i=Ir,function(e){var t=i,r=t.lib,s=r.WordArray,a=r.Hasher,n=t.algo,o=s.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=s.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=s.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=s.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=s.create([0,1518500249,1859775393,2400959708,2840853838]),h=s.create([1352829926,1548603684,1836072691,2053994217,0]),f=n.RIPEMD160=a.extend({_doReset:function(){this._hash=s.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=0;i<16;i++){var r=t+i,s=e[r];e[r]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}var a,n,f,v,S,w,A,B,U,x,E,T=this._hash.words,k=u.words,C=h.words,L=o.words,D=d.words,I=l.words,F=c.words;for(w=a=T[0],A=n=T[1],B=f=T[2],U=v=T[3],x=S=T[4],i=0;i<80;i+=1)E=a+e[t+L[i]]|0,E+=i<16?p(n,f,v)+k[0]:i<32?_(n,f,v)+k[1]:i<48?m(n,f,v)+k[2]:i<64?g(n,f,v)+k[3]:y(n,f,v)+k[4],E=(E=b(E|=0,I[i]))+S|0,a=S,S=v,v=b(f,10),f=n,n=E,E=w+e[t+D[i]]|0,E+=i<16?y(A,B,U)+C[0]:i<32?g(A,B,U)+C[1]:i<48?m(A,B,U)+C[2]:i<64?_(A,B,U)+C[3]:p(A,B,U)+C[4],E=(E=b(E|=0,F[i]))+x|0,w=x,x=U,U=b(B,10),B=A,A=E;E=T[1]+f+U|0,T[1]=T[2]+v+x|0,T[2]=T[3]+S+w|0,T[3]=T[4]+a+A|0,T[4]=T[0]+n+B|0,T[0]=E},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),e.sigBytes=4*(t.length+1),this._process();for(var s=this._hash,a=s.words,n=0;n<5;n++){var o=a[n];a[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return s},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,i){return e^t^i}function _(e,t,i){return e&t|~e&i}function m(e,t,i){return(e|~t)^i}function g(e,t,i){return e&i|t&~i}function y(e,t,i){return e^(t|~i)}function b(e,t){return e<>>32-t}t.RIPEMD160=a._createHelper(f),t.HmacRIPEMD160=a._createHmacHelper(f)}(),i.RIPEMD160)})),Rt((function(e,t){var i,r,s;e.exports=(r=(i=Ir).lib.Base,s=i.enc.Utf8,void(i.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var i=e.blockSize,r=4*i;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),n=this._iKey=t.clone(),o=a.words,d=n.words,l=0;l>>2];e.sigBytes-=t}};r.BlockCipher=c.extend({cfg:c.cfg.extend({mode:f,padding:p}),reset:function(){var e;c.reset.call(this);var t=this.cfg,i=t.iv,r=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=r.createEncryptor:(e=r.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,i&&i.words):(this._mode=e.call(r,this,i&&i.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var _=r.CipherParams=s.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),m=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,i=e.salt;return(i?a.create([1398893684,1701076831]).concat(i).concat(t):t).toString(d)},parse:function(e){var t,i=d.parse(e),r=i.words;return 1398893684==r[0]&&1701076831==r[1]&&(t=a.create(r.slice(2,4)),r.splice(0,4),i.sigBytes-=16),_.create({ciphertext:i,salt:t})}},g=r.SerializableCipher=s.extend({cfg:s.extend({format:m}),encrypt:function(e,t,i,r){r=this.cfg.extend(r);var s=e.createEncryptor(i,r),a=s.finalize(t),n=s.cfg;return _.create({ciphertext:a,key:i,iv:n.iv,algorithm:e,mode:n.mode,padding:n.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,i,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(i,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,i,r,s){if(r||(r=a.random(8)),s)n=l.create({keySize:t+i,hasher:s}).compute(e,r);else var n=l.create({keySize:t+i}).compute(e,r);var o=a.create(n.words.slice(t),4*i);return n.sigBytes=4*t,_.create({key:n,iv:o,salt:r})}},b=r.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,i,r){var s=(r=this.cfg.extend(r)).kdf.execute(i,e.keySize,e.ivSize,r.salt,r.hasher);r.iv=s.iv;var a=g.encrypt.call(this,e,t,s.key,r);return a.mixIn(s),a},decrypt:function(e,t,i,r){r=this.cfg.extend(r),t=this._parse(t,r.format);var s=r.kdf.execute(i,e.keySize,e.ivSize,t.salt,r.hasher);return r.iv=s.iv,g.decrypt.call(this,e,t,s.key,r)}})}())})),Rt((function(e,t){var i;e.exports=((i=Ir).mode.CFB=function(){var e=i.lib.BlockCipherMode.extend();function t(e,t,i,r){var s,a=this._iv;a?(s=a.slice(0),this._iv=void 0):s=this._prevBlock,r.encryptBlock(s,0);for(var n=0;n>24&255)){var t=e>>16&255,i=e>>8&255,r=255&e;255===t?(t=0,255===i?(i=0,255===r?r=0:++r):++i):++t,e=0,e+=t<<16,e+=i<<8,e+=r}else e+=1<<24;return e}function r(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var s=e.Encryptor=e.extend({processBlock:function(e,t){var i=this._cipher,s=i.blockSize,a=this._iv,n=this._counter;a&&(n=this._counter=a.slice(0),this._iv=void 0),r(n);var o=n.slice(0);i.encryptBlock(o,0);for(var d=0;d>>2]|=s<<24-a%4*8,e.sigBytes+=s},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Ansix923)})),Rt((function(e,t){var i;e.exports=((i=Ir).pad.Iso10126={pad:function(e,t){var r=4*t,s=r-e.sigBytes%r;e.concat(i.lib.WordArray.random(s-1)).concat(i.lib.WordArray.create([s<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Iso10126)})),Rt((function(e,t){var i;e.exports=((i=Ir).pad.Iso97971={pad:function(e,t){e.concat(i.lib.WordArray.create([2147483648],1)),i.pad.ZeroPadding.pad(e,t)},unpad:function(e){i.pad.ZeroPadding.unpad(e),e.sigBytes--}},i.pad.Iso97971)})),Rt((function(e,t){var i;e.exports=((i=Ir).pad.ZeroPadding={pad:function(e,t){var i=4*t;e.clamp(),e.sigBytes+=i-(e.sigBytes%i||i)},unpad:function(e){var t=e.words,i=e.sigBytes-1;for(i=e.sigBytes-1;i>=0;i--)if(t[i>>>2]>>>24-i%4*8&255){e.sigBytes=i+1;break}}},i.pad.ZeroPadding)})),Rt((function(e,t){var i;e.exports=((i=Ir).pad.NoPadding={pad:function(){},unpad:function(){}},i.pad.NoPadding)})),Rt((function(e,t){var i;e.exports=(i=Ir,function(e){var t=i,r=t.lib.CipherParams,s=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(s)},parse:function(e){var t=s.parse(e);return r.create({ciphertext:t})}}}(),i.format.Hex)})),Rt((function(e,t){var i;e.exports=(i=Ir,function(){var e=i,t=e.lib.BlockCipher,r=e.algo,s=[],a=[],n=[],o=[],d=[],l=[],c=[],u=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var i=0,r=0;for(t=0;t<256;t++){var p=r^r<<1^r<<2^r<<3^r<<4;p=p>>>8^255&p^99,s[i]=p,a[p]=i;var _=e[i],m=e[_],g=e[m],y=257*e[p]^16843008*p;n[i]=y<<24|y>>>8,o[i]=y<<16|y>>>16,d[i]=y<<8|y>>>24,l[i]=y,y=16843009*g^65537*m^257*_^16843008*i,c[p]=y<<24|y>>>8,u[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,i?(i=_^e[e[e[g^_]]],r^=e[e[r]]):i=r=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],_=r.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,i=e.sigBytes/4,r=4*((this._nRounds=i+6)+1),a=this._keySchedule=[],n=0;n6&&n%i==4&&(l=s[l>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[255&l]):(l=s[(l=l<<8|l>>>24)>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[255&l],l^=p[n/i|0]<<24),a[n]=a[n-i]^l);for(var o=this._invKeySchedule=[],d=0;d>>24]]^u[s[l>>>16&255]]^h[s[l>>>8&255]]^f[s[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,n,o,d,l,s)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,c,u,h,f,a),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,r,s,a,n,o){for(var d=this._nRounds,l=e[t]^i[0],c=e[t+1]^i[1],u=e[t+2]^i[2],h=e[t+3]^i[3],f=4,p=1;p>>24]^s[c>>>16&255]^a[u>>>8&255]^n[255&h]^i[f++],m=r[c>>>24]^s[u>>>16&255]^a[h>>>8&255]^n[255&l]^i[f++],g=r[u>>>24]^s[h>>>16&255]^a[l>>>8&255]^n[255&c]^i[f++],y=r[h>>>24]^s[l>>>16&255]^a[c>>>8&255]^n[255&u]^i[f++];l=_,c=m,u=g,h=y}_=(o[l>>>24]<<24|o[c>>>16&255]<<16|o[u>>>8&255]<<8|o[255&h])^i[f++],m=(o[c>>>24]<<24|o[u>>>16&255]<<16|o[h>>>8&255]<<8|o[255&l])^i[f++],g=(o[u>>>24]<<24|o[h>>>16&255]<<16|o[l>>>8&255]<<8|o[255&c])^i[f++],y=(o[h>>>24]<<24|o[l>>>16&255]<<16|o[c>>>8&255]<<8|o[255&u])^i[f++],e[t]=_,e[t+1]=m,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(_)}(),i.AES)})),Rt((function(e,t){var i;e.exports=(i=Ir,function(){var e=i,t=e.lib,r=t.WordArray,s=t.BlockCipher,a=e.algo,n=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=a.DES=s.extend({_doReset:function(){for(var e=this._key.words,t=[],i=0;i<56;i++){var r=n[i]-1;t[i]=e[r>>>5]>>>31-r%32&1}for(var s=this._subKeys=[],a=0;a<16;a++){var l=s[a]=[],c=d[a];for(i=0;i<24;i++)l[i/6|0]|=t[(o[i]-1+c)%28]<<31-i%6,l[4+(i/6|0)]|=t[28+(o[i+24]-1+c)%28]<<31-i%6;for(l[0]=l[0]<<1|l[0]>>>31,i=1;i<7;i++)l[i]=l[i]>>>4*(i-1)+3;l[7]=l[7]<<5|l[7]>>>27}var u=this._invSubKeys=[];for(i=0;i<16;i++)u[i]=s[15-i]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,i){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var r=0;r<16;r++){for(var s=i[r],a=this._lBlock,n=this._rBlock,o=0,d=0;d<8;d++)o|=l[d][((n^s[d])&c[d])>>>0];this._lBlock=n,this._rBlock=a^o}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var i=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=i,this._lBlock^=i<>>e^this._lBlock)&t;this._lBlock^=i,this._rBlock^=i<192.");var t=e.slice(0,2),i=e.length<4?e.slice(0,2):e.slice(2,4),s=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(r.create(t)),this._des2=u.createEncryptor(r.create(i)),this._des3=u.createEncryptor(r.create(s))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=s._createHelper(p)}(),i.TripleDES)})),Rt((function(e,t){var i;e.exports=(i=Ir,function(){var e=i,t=e.lib.StreamCipher,r=e.algo,s=r.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,i=e.sigBytes,r=this._S=[],s=0;s<256;s++)r[s]=s;s=0;for(var a=0;s<256;s++){var n=s%i,o=t[n>>>2]>>>24-n%4*8&255;a=(a+r[s]+o)%256;var d=r[s];r[s]=r[a],r[a]=d}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=a.call(this)},keySize:8,ivSize:0});function a(){for(var e=this._S,t=this._i,i=this._j,r=0,s=0;s<4;s++){i=(i+e[t=(t+1)%256])%256;var a=e[t];e[t]=e[i],e[i]=a,r|=e[(e[t]+e[i])%256]<<24-8*s}return this._i=t,this._j=i,r}e.RC4=t._createHelper(s);var n=r.RC4Drop=s.extend({cfg:s.cfg.extend({drop:192}),_doReset:function(){s._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)a.call(this)}});e.RC4Drop=t._createHelper(n)}(),i.RC4)})),Rt((function(e,t){var i;e.exports=(i=Ir,function(){var e=i,t=e.lib.StreamCipher,r=e.algo,s=[],a=[],n=[],o=r.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,i=0;i<4;i++)e[i]=16711935&(e[i]<<8|e[i]>>>24)|4278255360&(e[i]<<24|e[i]>>>8);var r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],s=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,i=0;i<4;i++)d.call(this);for(i=0;i<8;i++)s[i]^=r[i+4&7];if(t){var a=t.words,n=a[0],o=a[1],l=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(s[0]^=l,s[1]^=u,s[2]^=c,s[3]^=h,s[4]^=l,s[5]^=u,s[6]^=c,s[7]^=h,i=0;i<4;i++)d.call(this)}},_doProcessBlock:function(e,t){var i=this._X;d.call(this),s[0]=i[0]^i[5]>>>16^i[3]<<16,s[1]=i[2]^i[7]>>>16^i[5]<<16,s[2]=i[4]^i[1]>>>16^i[7]<<16,s[3]=i[6]^i[3]>>>16^i[1]<<16;for(var r=0;r<4;r++)s[r]=16711935&(s[r]<<8|s[r]>>>24)|4278255360&(s[r]<<24|s[r]>>>8),e[t+r]^=s[r]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,i=0;i<8;i++)a[i]=t[i];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,i=0;i<8;i++){var r=e[i]+t[i],s=65535&r,o=r>>>16,d=((s*s>>>17)+s*o>>>15)+o*o,l=((4294901760&r)*r|0)+((65535&r)*r|0);n[i]=d^l}e[0]=n[0]+(n[7]<<16|n[7]>>>16)+(n[6]<<16|n[6]>>>16)|0,e[1]=n[1]+(n[0]<<8|n[0]>>>24)+n[7]|0,e[2]=n[2]+(n[1]<<16|n[1]>>>16)+(n[0]<<16|n[0]>>>16)|0,e[3]=n[3]+(n[2]<<8|n[2]>>>24)+n[1]|0,e[4]=n[4]+(n[3]<<16|n[3]>>>16)+(n[2]<<16|n[2]>>>16)|0,e[5]=n[5]+(n[4]<<8|n[4]>>>24)+n[3]|0,e[6]=n[6]+(n[5]<<16|n[5]>>>16)+(n[4]<<16|n[4]>>>16)|0,e[7]=n[7]+(n[6]<<8|n[6]>>>24)+n[5]|0}e.Rabbit=t._createHelper(o)}(),i.Rabbit)})),Rt((function(e,t){var i;e.exports=(i=Ir,function(){var e=i,t=e.lib.StreamCipher,r=e.algo,s=[],a=[],n=[],o=r.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],r=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var s=0;s<4;s++)d.call(this);for(s=0;s<8;s++)r[s]^=i[s+4&7];if(t){var a=t.words,n=a[0],o=a[1],l=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(r[0]^=l,r[1]^=u,r[2]^=c,r[3]^=h,r[4]^=l,r[5]^=u,r[6]^=c,r[7]^=h,s=0;s<4;s++)d.call(this)}},_doProcessBlock:function(e,t){var i=this._X;d.call(this),s[0]=i[0]^i[5]>>>16^i[3]<<16,s[1]=i[2]^i[7]>>>16^i[5]<<16,s[2]=i[4]^i[1]>>>16^i[7]<<16,s[3]=i[6]^i[3]>>>16^i[1]<<16;for(var r=0;r<4;r++)s[r]=16711935&(s[r]<<8|s[r]>>>24)|4278255360&(s[r]<<24|s[r]>>>8),e[t+r]^=s[r]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,i=0;i<8;i++)a[i]=t[i];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,i=0;i<8;i++){var r=e[i]+t[i],s=65535&r,o=r>>>16,d=((s*s>>>17)+s*o>>>15)+o*o,l=((4294901760&r)*r|0)+((65535&r)*r|0);n[i]=d^l}e[0]=n[0]+(n[7]<<16|n[7]>>>16)+(n[6]<<16|n[6]>>>16)|0,e[1]=n[1]+(n[0]<<8|n[0]>>>24)+n[7]|0,e[2]=n[2]+(n[1]<<16|n[1]>>>16)+(n[0]<<16|n[0]>>>16)|0,e[3]=n[3]+(n[2]<<8|n[2]>>>24)+n[1]|0,e[4]=n[4]+(n[3]<<16|n[3]>>>16)+(n[2]<<16|n[2]>>>16)|0,e[5]=n[5]+(n[4]<<8|n[4]>>>24)+n[3]|0,e[6]=n[6]+(n[5]<<16|n[5]>>>16)+(n[4]<<16|n[4]>>>16)|0,e[7]=n[7]+(n[6]<<8|n[6]>>>24)+n[5]|0}e.RabbitLegacy=t._createHelper(o)}(),i.RabbitLegacy)})),Rt((function(e,t){var i;e.exports=(i=Ir,function(){var e=i,t=e.lib.BlockCipher,r=e.algo;const s=16,a=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],n=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function d(e,t){let i=t>>24&255,r=t>>16&255,s=t>>8&255,a=255&t,n=e.sbox[0][i]+e.sbox[1][r];return n^=e.sbox[2][s],n+=e.sbox[3][a],n}function l(e,t,i){let r,a=t,n=i;for(let t=0;t1;--t)a^=e.pbox[t],n=d(e,a)^n,r=a,a=n,n=r;return r=a,a=n,n=r,n^=e.pbox[1],a^=e.pbox[0],{left:a,right:n}}function u(e,t,i){for(let t=0;t<4;t++){e.sbox[t]=[];for(let i=0;i<256;i++)e.sbox[t][i]=n[t][i]}let r=0;for(let n=0;n=i&&(r=0);let o=0,d=0,c=0;for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),i=new Uint8Array(i);const s=e.byteLength;let a=5;for(;as)break;let o=e[a+4],d=!1;if(r?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const r=e.slice(a+4+2,a+4+n);let s=new Dr.ModeOfOperation.ctr(t,new Dr.Counter(i));const o=s.decrypt(r);s=null,e.set(o,a+4+2)}a=a+4+n}return e}function Mr(e,t,i){if(e.byteLength<=30)return e;const r=e.slice(32);let s=new Dr.ModeOfOperation.ctr(t,new Dr.Counter(i));const a=s.decrypt(r);return s=null,e.set(a,32),e}Rt((function(e,t){e.exports=Ir}));var zr=Rt((function(e,t){var r,s,a,n=(r=new Date,s=4,a={setLogLevel:function(e){s=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=s&&console.debug("["+n.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=s&&console.info("["+n.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=s&&console.warn("["+n.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=s&&console.error("["+n.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}},a);n.getDurationString=function(e,t){var i;function r(e,t){for(var i=(""+e).split(".");i[0].length0){for(var i="",r=0;r0&&(i+=","),i+="["+n.getDurationString(e.start(r))+","+n.getDurationString(e.end(r))+"]";return i}return"(empty)"},t.Log=n;var o=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};o.prototype.getPosition=function(){return this.position},o.prototype.getEndPosition=function(){return this.buffer.byteLength},o.prototype.getLength=function(){return this.buffer.byteLength},o.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},o.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},o.prototype.readAnyInt=function(e,t){var i=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:i=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:i=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";i=this.dataview.getUint8(this.position)<<16,i|=this.dataview.getUint8(this.position+1)<<8,i|=this.dataview.getUint8(this.position+2);break;case 4:i=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";i=this.dataview.getUint32(this.position)<<32,i|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,i}throw"Not enough bytes in buffer"},o.prototype.readUint8=function(){return this.readAnyInt(1,!1)},o.prototype.readUint16=function(){return this.readAnyInt(2,!1)},o.prototype.readUint24=function(){return this.readAnyInt(3,!1)},o.prototype.readUint32=function(){return this.readAnyInt(4,!1)},o.prototype.readUint64=function(){return this.readAnyInt(8,!1)},o.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",i=0;ithis._byteLength&&(this._byteLength=t);else{for(i<1&&(i=1);t>i;)i*=2;var r=new ArrayBuffer(i),s=new Uint8Array(this._buffer);new Uint8Array(r,0,s.length).set(s),this.buffer=r,this._byteLength=t}}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),i=new Uint8Array(this._buffer,0,t.length);t.set(i),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Int32Array(e);return d.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),d.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},d.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Int16Array(e);return d.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),d.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},d.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Uint32Array(e);return d.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),d.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},d.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Uint16Array(e);return d.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),d.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},d.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var i=new Float64Array(e);return d.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),d.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},d.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Float32Array(e);return d.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),d.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,i,r,s){var a=new Uint8Array(e,t,s),n=new Uint8Array(i,r,s);a.set(n)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i=0;is;r--,s++){var a=t[s];t[s]=t[r],t[r]=a}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],i=0;i>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},d.prototype.adjustUint32=function(e,t){var i=this.position;this.seek(e),this.writeUint32(t),this.seek(i)},d.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var i=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},d.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var i=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},d.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var i=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},d.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var i=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},d.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var i=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(i,null==t?this.endianness:t),this.position+=8*e,i},d.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var i=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i};var c=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(c.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,n.debug("MultiBufferStream","Stream ready for parsing"),!0):(n.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(n.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){n.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(new Uint8Array(e),0),i.set(new Uint8Array(t),e.byteLength),i.buffer},c.prototype.reduceBuffer=function(e,t,i){var r;return(r=new Uint8Array(i)).set(new Uint8Array(e,t,i)),r.buffer.fileStart=e.fileStart+t,r.buffer.usedBytes=0,r.buffer},c.prototype.insertBuffer=function(e){for(var t=!0,i=0;ir.byteLength){this.buffers.splice(i,1),i--;continue}n.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=r.fileStart||(e=this.reduceBuffer(e,0,r.fileStart-e.fileStart)),n.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(i,0,e),0===i&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,s,a)}}t&&(n.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===i&&(this.buffer=e))},c.prototype.logBufferLevel=function(e){var t,i,r,s,a,o=[],d="";for(r=0,s=0,t=0;t0&&(d+=a.end-1+"]");var l=e?n.info:n.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+r+"/"+s+" bytes), continuous ranges: "+d)},c.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},c.prototype.findPosition=function(e,t,i){var r,s=null,a=-1;for(r=!0===e?0:this.bufferIndex;r=t?(n.debug("MultiBufferStream","Found position in existing buffer #"+a),a):-1},c.prototype.findEndContiguousBuf=function(e){var t,i,r,s=void 0!==e?e:this.bufferIndex;if(i=this.buffers[s],this.buffers.length>s+1)for(t=s+1;t>3;return 31===r&&i.data.length>=2&&(r=32+((7&i.data[0])<<3)+((224&i.data[1])>>5)),r}return null},i.DecoderConfigDescriptor=function(e){i.Descriptor.call(this,4,e)},i.DecoderConfigDescriptor.prototype=new i.Descriptor,i.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},i.DecoderSpecificInfo=function(e){i.Descriptor.call(this,5,e)},i.DecoderSpecificInfo.prototype=new i.Descriptor,i.SLConfigDescriptor=function(e){i.Descriptor.call(this,6,e)},i.SLConfigDescriptor.prototype=new i.Descriptor,this};t.MPEG4DescriptorParser=u;var h={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){h.FullBox.prototype=new h.Box,h.ContainerBox.prototype=new h.Box,h.SampleEntry.prototype=new h.Box,h.TrackGroupTypeBox.prototype=new h.FullBox,h.BASIC_BOXES.forEach((function(e){h.createBoxCtor(e)})),h.FULL_BOXES.forEach((function(e){h.createFullBoxCtor(e)})),h.CONTAINER_BOXES.forEach((function(e){h.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,i){this.type=e,this.size=t,this.uuid=i},FullBox:function(e,t,i){h.Box.call(this,e,t,i),this.flags=0,this.version=0},ContainerBox:function(e,t,i){h.Box.call(this,e,t,i),this.boxes=[]},SampleEntry:function(e,t,i,r){h.ContainerBox.call(this,e,t),this.hdr_size=i,this.start=r},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){h.FullBox.call(this,e,t)},createBoxCtor:function(e,t){h.boxCodes.push(e),h[e+"Box"]=function(t){h.Box.call(this,e,t)},h[e+"Box"].prototype=new h.Box,t&&(h[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){h[e+"Box"]=function(t){h.FullBox.call(this,e,t)},h[e+"Box"].prototype=new h.FullBox,h[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,i=0;ii?(n.error("BoxParser","Box of type '"+c+"' has a size "+l+" greater than its container size "+i),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):0!==l&&o+l>e.getEndPosition()?(e.seek(o),n.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):t?{code:h.OK,type:c,size:l,hdr_size:d,start:o}:(h[c+"Box"]?r=new h[c+"Box"](l):"uuid"!==c?(n.warn("BoxParser","Unknown box type: '"+c+"'"),(r=new h.Box(c,l)).has_unparsed_data=!0):h.UUIDBoxes[a]?r=new h.UUIDBoxes[a](l):(n.warn("BoxParser","Unknown uuid type: '"+a+"'"),(r=new h.Box(c,l)).uuid=a,r.has_unparsed_data=!0),r.hdr_size=d,r.start=o,r.write===h.Box.prototype.write&&"mdat"!==r.type&&(n.info("BoxParser","'"+u+"' box writing not yet implemented, keeping unparsed data in memory for later write"),r.parseDataAndRewind(e)),r.parse(e),(s=e.getPosition()-(r.start+r.size))<0?(n.warn("BoxParser","Parsing of box '"+u+"' did not read the entire indicated box data size (missing "+-s+" bytes), seeking forward"),e.seek(r.start+r.size)):s>0&&(n.error("BoxParser","Parsing of box '"+u+"' read "+s+" more bytes than the indicated box data size, seeking backwards"),0!==r.size&&e.seek(r.start+r.size)),{code:h.OK,box:r,size:r.size})},h.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},h.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},h.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.ContainerBox.prototype.parse=function(e){for(var t,i;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},h.SAMPLE_ENTRY_TYPE_VISUAL="Visual",h.SAMPLE_ENTRY_TYPE_AUDIO="Audio",h.SAMPLE_ENTRY_TYPE_HINT="Hint",h.SAMPLE_ENTRY_TYPE_METADATA="Metadata",h.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",h.SAMPLE_ENTRY_TYPE_SYSTEM="System",h.SAMPLE_ENTRY_TYPE_TEXT="Text",h.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},h.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},h.SampleEntry.prototype.parseFooter=function(e){h.ContainerBox.prototype.parse.call(this,e)},h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_HINT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT,"enct"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA,"encm"),h.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var i=0;i<3;i++)this.layer_size[i]=16==t?e.readUint16():e.readUint32()})),h.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),h.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),h.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)n.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void n.error("av1C reserved_2 parsing problem");var i=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(i)}else n.error("av1C reserved_1 parsing problem");else n.error("av1C version "+this.version+" not supported")})),h.createBoxCtor("avcC",(function(e){var t,i;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),i=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(i))})),h.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),h.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),h.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),h.createFullBoxCtor("co64",(function(e){var t,i;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(i=0;i>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),h.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),h.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),h.createFullBoxCtor("ctts",(function(e){var t,i;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(i=0;i>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|i>>6&3,this.acmod=i>>3&7,this.lfeon=i>>2&1,this.bit_rate_code=3&i|r>>5&7})),h.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var i=0;i>6,r.bsid=s>>1&31,r.bsmod=(1&s)<<4|a>>4&15,r.acmod=a>>1&7,r.lfeon=1&a,r.num_dep_sub=n>>1&15,r.num_dep_sub>0&&(r.chan_loc=(1&n)<<8|e.readUint8())}})),h.createFullBoxCtor("dfLa",(function(e){var t=[],i=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var r=e.readUint8(),s=Math.min(127&r,i.length-1);if(s?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(i[s]),128&r)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),h.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[i]=e.readString(4),t-=4,i++})),h.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),h.createBoxCtor("hvcC",(function(e){var t,i,r,s;this.configurationVersion=e.readUint8(),s=e.readUint8(),this.general_profile_space=s>>6,this.general_tier_flag=(32&s)>>5,this.general_profile_idc=31&s,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),s=e.readUint8(),this.constantFrameRate=s>>6,this.numTemporalLayers=(13&s)>>3,this.temporalIdNested=(4&s)>>2,this.lengthSizeMinusOne=3&s,this.nalu_arrays=[];var a=e.readUint8();for(t=0;t>7,n.nalu_type=63&s;var o=e.readUint16();for(i=0;i>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var i=0;if(this.version<2)i=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";i=e.readUint32()}for(var r=0;r>7,this.axis=1&t})),h.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),n.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),h.createFullBoxCtor("ipma",(function(e){var t,i;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?n.property_index=(127&a)<<8|e.readUint8():n.property_index=127&a}}})),h.createFullBoxCtor("iref",(function(e){var t,i;for(this.references=[];e.getPosition()>7,r.assignment_type=127&s,r.assignment_type){case 0:r.grouping_type=e.readString(4);break;case 1:r.grouping_type=e.readString(4),r.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:r.sub_track_id=e.readUint32();break;default:n.warn("BoxParser","Unknown leva assignement type")}}})),h.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),h.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),f.prototype.toString=function(){return"("+this.x+","+this.y+")"},h.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new f(e.readUint16(),e.readUint16()),this.display_primaries[1]=new f(e.readUint16(),e.readUint16()),this.display_primaries[2]=new f(e.readUint16(),e.readUint16()),this.white_point=new f(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),h.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),h.createFullBoxCtor("mehd",(function(e){1&this.flags&&(n.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),h.createFullBoxCtor("meta",(function(e){this.boxes=[],h.ContainerBox.prototype.parse.call(this,e)})),h.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),h.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),h.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),h.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),h.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),h.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),h.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var i=0;i0){var t=e.readUint32();this.kid=[];for(var i=0;i0&&(this.data=e.readUint8Array(r))})),h.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),h.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),h.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var i=0;i>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var i=e.readUint8(),r=0;r>7,this.num_leading_samples=127&t})),h.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)n.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=h.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),h.createSampleGroupCtor("stsa",(function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),h.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),h.createSampleGroupCtor("tsas",(function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("tscl",(function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("vipr",(function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),i=0;i>6,this.sample_depends_on[r]=t>>4&3,this.sample_is_depended_on[r]=t>>2&3,this.sample_has_redundancy[r]=3&t})),h.createFullBoxCtor("senc"),h.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),n.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),i=0;i>31&1,r.referenced_size=2147483647&s,r.subsegment_duration=e.readUint32(),s=e.readUint32(),r.starts_with_SAP=s>>31&1,r.SAP_type=s>>28&7,r.SAP_delta_time=268435455&s}})),h.SingleItemTypeReferenceBox=function(e,t,i,r){h.Box.call(this,e,t),this.hdr_size=i,this.start=r},h.SingleItemTypeReferenceBox.prototype=new h.Box,h.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var i=0;i>4&15,this.sample_sizes[t+1]=15&r}else if(8===this.field_size)for(t=0;t0)for(i=0;i>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=h.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),h.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),h.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),h.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var i=e.readUint32(),r=0;r>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),h.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),h.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),h.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},h.createTrackGroupCtor("msrc"),h.TrackReferenceTypeBox=function(e,t,i,r){h.Box.call(this,e,t),this.hdr_size=i,this.start=r},h.TrackReferenceTypeBox.prototype=new h.Box,h.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},h.trefBox.prototype.parse=function(e){for(var t,i;e.getPosition()t&&this.flags&h.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var i=0;i>7&1,this.block_pad_lsb=i>>6&1,this.block_little_endian=i>>5&1,this.block_reversed=i>>4&1,this.pad_unknown=i>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),h.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),h.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),h.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),h.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=h.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),h.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),h.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=h.parseHex16(e)})),h.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),h.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),h.createFullBoxCtor("vvcC",(function(e){var t,i,r={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(r.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,i=this.num_sublayers-2;i>=0;--i){var n=r.extract_bits(1);this.ptl_sublayer_present_mask|=n<1;++i)r.extract_bits(1);for(this.sublayer_level_idc=[],i=this.num_sublayers-2;i>=0;--i)this.ptl_sublayer_present_mask&1<>=1;t+=h.decimalToHex(r,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var s=!1,a="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||s)&&(a="."+h.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+a,s=!0);t+=a}return t},h.vvc1SampleEntry.prototype.getCodec=h.vvi1SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var i="";if(this.vvcC.general_constraint_info){var r,s=[],a=0;for(a|=this.vvcC.ptl_frame_only_constraint<<7,a|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,s.push(a),a&&(r=e),a=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===r)i=".CA";else{i=".C";var n="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",o=0,d=0;for(e=0;e<=r;++e)for(o=o<<8|s[e],d+=8;d>=5;){i+=n[o>>d-5&31],o&=(1<<(d-=5))-1}d&&(i+=n[31&(o<<=5-d)])}}t+=i}return t},h.mp4aSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),i=this.esds.esd.getAudioConfig();return e+"."+h.decimalToHex(t)+(i?"."+i:"")}return e},h.stxtSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},h.vp08SampleEntry.prototype.getCodec=h.vp09SampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var i=this.vpcC.bitDepth;return 8==i&&(i="08"),e+".0"+this.vpcC.profile+"."+t+"."+i},h.av01SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this),i=this.av1C.seq_level_idx_0;return i<10&&(i="0"+i),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+i+(this.av1C.seq_tier_0?"H":"M")+"."+e},h.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),n.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>l?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>l&&e.writeUint64(this.size)},h.FullBox.prototype.writeHeader=function(e){this.size+=4,h.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},h.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},h.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},h.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},h.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},h.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},h.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&h.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&h.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&h.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&h.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[i]instanceof h.Box||t[i]instanceof h.Box||void 0===e[i]||void 0===t[i]||"function"==typeof e[i]||"function"==typeof t[i]||e.subBoxNames&&e.subBoxNames.indexOf(i.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(i.slice(0,4))>-1||"data"===i||"start"===i||"size"===i||"creation_time"===i||"modification_time"===i||h.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(i)>-1||e[i]===t[i]))return!1;return!0},h.boxEqual=function(e,t){if(!h.boxEqualFields(e,t))return!1;for(var i=0;i1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},g.prototype.setExtractionOptions=function(e,t,i){var r=this.getTrackById(e);if(r){var s={};this.extractedTracks.push(s),s.id=e,s.user=t,s.trak=r,r.nextSample=0,s.nb_samples=1e3,s.samples=[],i&&i.nbSamples&&(s.nb_samples=i.nbSamples)}},g.prototype.unsetExtractionOptions=function(e){for(var t=-1,i=0;i-1&&this.extractedTracks.splice(t,1)},g.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=h.parseOneBox(this.stream,false)).code===h.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var i;switch(i="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),i){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[i]&&n.warn("ISOFile","Duplicate Box of type: "+i+", overriding previous occurrence"),this[i]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},g.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(n.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(n.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(n.warn("ISOFile","Not ready to start parsing"),!1))},g.prototype.appendBuffer=function(e,t){var i;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(i=this.nextSeekPosition,this.nextSeekPosition=void 0):i=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(i=this.stream.getEndFilePositionAfter(i))):i=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(n.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+i),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),n.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),i},g.prototype.getInfo=function(){var e,t,i,r,s,a,n={},o=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(n.hasMoov=!0,n.duration=this.moov.mvhd.duration,n.timescale=this.moov.mvhd.timescale,n.isFragmented=null!=this.moov.mvex,n.isFragmented&&this.moov.mvex.mehd&&(n.fragment_duration=this.moov.mvex.mehd.fragment_duration),n.isProgressive=this.isProgressive,n.hasIOD=null!=this.moov.iods,n.brands=[],n.brands.push(this.ftyp.major_brand),n.brands=n.brands.concat(this.ftyp.compatible_brands),n.created=new Date(o+1e3*this.moov.mvhd.creation_time),n.modified=new Date(o+1e3*this.moov.mvhd.modification_time),n.tracks=[],n.audioTracks=[],n.videoTracks=[],n.subtitleTracks=[],n.metadataTracks=[],n.hintTracks=[],n.otherTracks=[],e=0;e0?n.mime+='video/mp4; codecs="':n.audioTracks&&n.audioTracks.length>0?n.mime+='audio/mp4; codecs="':n.mime+='application/mp4; codecs="',e=0;e=i.samples.length)&&(n.info("ISOFile","Sending fragmented data on track #"+r.id+" for samples ["+Math.max(0,i.nextSample-r.nb_samples)+","+(i.nextSample-1)+"]"),n.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(r.id,r.user,r.segmentStream.buffer,i.nextSample,e||i.nextSample>=i.samples.length),r.segmentStream=null,r!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=i.samples.length)&&(n.debug("ISOFile","Sending samples on track #"+a.id+" for sample "+i.nextSample),this.onSamples&&this.onSamples(a.id,a.user,a.samples),a.samples=[],a!==this.extractedTracks[t]))break}}}},g.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},g.prototype.getBoxes=function(e,t){var i=[];return g._sweep.call(this,e,i,t),i},g._sweep=function(e,t,i){for(var r in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&i)return;g._sweep.call(this.boxes[r],e,t,i)}},g.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},g.prototype.getTrackSample=function(e,t){var i=this.getTrackById(e);return this.getSample(i,t)},g.prototype.releaseUsedSamples=function(e,t,i){var r=0,s=this.getTrackById(e);s.lastValidSample||(s.lastValidSample=0);for(var a=s.lastValidSample;ae*s.timescale){l=r-1;break}t&&s.is_sync&&(d=r)}for(t&&(l=d),e=i.samples[l].cts,i.nextSample=l;i.samples[l].alreadyRead===i.samples[l].size&&i.samples[l+1];)l++;return a=i.samples[l].offset+i.samples[l].alreadyRead,n.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+i.nextSample+" on track "+i.tkhd.track_id+", time "+n.getDurationString(e,o)+" and offset: "+a),{offset:a,time:e/o}},g.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},g.prototype.seek=function(e,t){var i,r,s,a=this.moov,o={offset:1/0,time:1/0};if(this.moov){for(s=0;sthis.getTrackDuration(i)||((r=this.seekTrack(e,t,i)).offset-1){n=d;break}switch(n){case"Visual":if(s.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),a.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var u=new h.avcCBox;u.parse(new o(t.avcDecoderConfigRecord)),a.addBox(u)}else if(t.hevcDecoderConfigRecord){var f=new h.hvcCBox;f.parse(new o(t.hevcDecoderConfigRecord)),a.addBox(f)}break;case"Audio":s.add("smhd").set("balance",t.balance||0),a.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":s.add("hmhd");break;case"Subtitle":if(s.add("sthd"),"stpp"===t.type)a.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:s.add("nmhd")}t.description&&a.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){a.addBox(e)})),s.add("dinf").add("dref").addEntry((new h["url Box"]).set("flags",1));var p=s.add("stbl");return p.add("stsd").addEntry(a),p.add("stts").set("sample_counts",[]).set("sample_deltas",[]),p.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),p.add("stco").set("chunk_offsets",[]),p.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(i),t.id}},h.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},g.prototype.addSample=function(e,t,i){var r=i||{},s={},a=this.getTrackById(e);if(null!==a){s.number=a.samples.length,s.track_id=a.tkhd.track_id,s.timescale=a.mdia.mdhd.timescale,s.description_index=r.sample_description_index?r.sample_description_index-1:0,s.description=a.mdia.minf.stbl.stsd.entries[s.description_index],s.data=t,s.size=t.byteLength,s.alreadyRead=s.size,s.duration=r.duration||1,s.cts=r.cts||0,s.dts=r.dts||0,s.is_sync=r.is_sync||!1,s.is_leading=r.is_leading||0,s.depends_on=r.depends_on||0,s.is_depended_on=r.is_depended_on||0,s.has_redundancy=r.has_redundancy||0,s.degradation_priority=r.degradation_priority||0,s.offset=0,s.subsamples=r.subsamples,a.samples.push(s),a.samples_size+=s.size,a.samples_duration+=s.duration,void 0===a.first_dts&&(a.first_dts=r.dts),this.processSamples();var n=this.createSingleSampleMoof(s);return this.addBox(n),n.computeSize(),n.trafs[0].truns[0].data_offset=n.size+8,this.add("mdat").data=new Uint8Array(t),s}},g.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var i=new h.moofBox;i.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var r=i.add("traf"),s=this.getTrackById(e.track_id);return r.add("tfhd").set("track_id",e.track_id).set("flags",h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),r.add("tfdt").set("baseMediaDecodeTime",e.dts-(s.first_dts||0)),r.add("trun").set("flags",h.TRUN_FLAGS_DATA_OFFSET|h.TRUN_FLAGS_DURATION|h.TRUN_FLAGS_SIZE|h.TRUN_FLAGS_FLAGS|h.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),i},g.prototype.lastMoofIndex=0,g.prototype.samplesDataSize=0,g.prototype.resetTables=function(){var e,t,i,r,s,a;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(d=s[n].grouping_type+"/0",(o=new l(s[n].grouping_type,0)).is_fragment=!0,t.sample_groups_info[d]||(t.sample_groups_info[d]=o))}else for(n=0;n=2&&(d=r[n].grouping_type+"/0",o=new l(r[n].grouping_type,0),e.sample_groups_info[d]||(e.sample_groups_info[d]=o))},g.setSampleGroupProperties=function(e,t,i,r){var s,a;for(s in t.sample_groups=[],r){var n;if(t.sample_groups[s]={},t.sample_groups[s].grouping_type=r[s].grouping_type,t.sample_groups[s].grouping_type_parameter=r[s].grouping_type_parameter,i>=r[s].last_sample_in_run&&(r[s].last_sample_in_run<0&&(r[s].last_sample_in_run=0),r[s].entry_index++,r[s].entry_index<=r[s].sbgp.entries.length-1&&(r[s].last_sample_in_run+=r[s].sbgp.entries[r[s].entry_index].sample_count)),r[s].entry_index<=r[s].sbgp.entries.length-1?t.sample_groups[s].group_description_index=r[s].sbgp.entries[r[s].entry_index].group_description_index:t.sample_groups[s].group_description_index=-1,0!==t.sample_groups[s].group_description_index)n=r[s].fragment_description?r[s].fragment_description:r[s].description,t.sample_groups[s].group_description_index>0?(a=t.sample_groups[s].group_description_index>65535?(t.sample_groups[s].group_description_index>>16)-1:t.sample_groups[s].group_description_index-1,n&&a>=0&&(t.sample_groups[s].description=n.entries[a])):n&&n.version>=2&&n.default_group_description_index>0&&(t.sample_groups[s].description=n.entries[n.default_group_description_index-1])}},g.process_sdtp=function(e,t,i){t&&(e?(t.is_leading=e.is_leading[i],t.depends_on=e.sample_depends_on[i],t.is_depended_on=e.sample_is_depended_on[i],t.has_redundancy=e.sample_has_redundancy[i]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},g.prototype.buildSampleLists=function(){var e,t;for(e=0;eb&&(v++,b<0&&(b=0),b+=a.sample_counts[v]),t>0?(e.samples[t-1].duration=a.sample_deltas[v],e.samples_duration+=e.samples[t-1].duration,x.dts=e.samples[t-1].dts+e.samples[t-1].duration):x.dts=0,n?(t>=S&&(w++,S<0&&(S=0),S+=n.sample_counts[w]),x.cts=e.samples[t].dts+n.sample_offsets[w]):x.cts=x.dts,o?(t==o.sample_numbers[A]-1?(x.is_sync=!0,A++):(x.is_sync=!1,x.degradation_priority=0),l&&l.entries[B].sample_delta+U==t+1&&(x.subsamples=l.entries[B].subsamples,U+=l.entries[B].sample_delta,B++)):x.is_sync=!0,g.process_sdtp(e.mdia.minf.stbl.sdtp,x,x.number),x.degradation_priority=h?h.priority[t]:0,l&&l.entries[B].sample_delta+U==t&&(x.subsamples=l.entries[B].subsamples,U+=l.entries[B].sample_delta),(c.length>0||u.length>0)&&g.setSampleGroupProperties(e,x,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},g.prototype.updateSampleLists=function(){var e,t,i,r,s,a,n,o,d,l,c,u,f,p,_;if(void 0!==this.moov)for(;this.lastMoofIndex0&&g.initSampleGroups(u,c,c.sbgps,u.mdia.minf.stbl.sgpds,c.sgpds),t=0;t0?p.dts=u.samples[u.samples.length-2].dts+u.samples[u.samples.length-2].duration:(c.tfdt?p.dts=c.tfdt.baseMediaDecodeTime:p.dts=0,u.first_traf_merged=!0),p.cts=p.dts,m.flags&h.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+m.sample_composition_time_offset[i]),_=n,m.flags&h.TRUN_FLAGS_FLAGS?_=m.sample_flags[i]:0===i&&m.flags&h.TRUN_FLAGS_FIRST_FLAG&&(_=m.first_sample_flags),p.is_sync=!(_>>16&1),p.is_leading=_>>26&3,p.depends_on=_>>24&3,p.is_depended_on=_>>22&3,p.has_redundancy=_>>20&3,p.degradation_priority=65535&_;var y=!!(c.tfhd.flags&h.TFHD_FLAG_BASE_DATA_OFFSET),b=!!(c.tfhd.flags&h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),v=!!(m.flags&h.TRUN_FLAGS_DATA_OFFSET),S=0;S=y?c.tfhd.base_data_offset:b||0===t?l.start:o,p.offset=0===t&&0===i?v?S+m.data_offset:S:o,o=p.offset+p.size,(c.sbgps.length>0||c.sgpds.length>0||u.mdia.minf.stbl.sbgps.length>0||u.mdia.minf.stbl.sgpds.length>0)&&g.setSampleGroupProperties(u,p,p.number_in_traf,c.sample_groups_info)}}if(c.subs){u.has_fragment_subsamples=!0;var w=c.first_sample_index;for(t=0;t-1))return null;var a=(i=this.stream.buffers[s]).byteLength-(r.offset+r.alreadyRead-i.fileStart);if(r.size-r.alreadyRead<=a)return n.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-i.fileStart)+" read size: "+(r.size-r.alreadyRead)+" full size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,i,r.offset+r.alreadyRead-i.fileStart,r.size-r.alreadyRead),i.usedBytes+=r.size-r.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead=r.size,r;if(0===a)return null;n.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-i.fileStart)+" read size: "+a+" full size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,i,r.offset+r.alreadyRead-i.fileStart,a),r.alreadyRead+=a,i.usedBytes+=a,this.stream.logBufferLevel()}},g.prototype.releaseSample=function(e,t){var i=e.samples[t];return i.data?(this.samplesDataSize-=i.size,i.data=null,i.description=null,delete i.degradation_priority,delete i.depends_on,delete i.description_index,delete i.has_redundancy,delete i.is_depended_on,delete i.is_leading,delete i.is_sync,delete i.moof_number,delete i.number_in_traf,delete i.timescale,delete i.cts,delete i.dts,delete i.offset,delete i.size,delete i.track_id,delete i.duration,i.alreadyRead=0,i.size):0},g.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},g.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},g.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(i.protection=a.ipro.protections[a.iinf.item_infos[e].protection_index-1]),a.iinf.item_infos[e].item_type?i.type=a.iinf.item_infos[e].item_type:i.type="mime",i.content_type=a.iinf.item_infos[e].content_type,i.content_encoding=a.iinf.item_infos[e].content_encoding;if(a.grpl)for(e=0;e0&&h.property_index-1-1))return null;var o=(t=this.stream.buffers[a]).byteLength-(s.offset+s.alreadyRead-t.fileStart);if(!(s.length-s.alreadyRead<=o))return n.debug("ISOFile","Getting item #"+e+" extent #"+r+" partial data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-t.fileStart)+" read size: "+o+" full extent size: "+s.length+" full item size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,t,s.offset+s.alreadyRead-t.fileStart,o),s.alreadyRead+=o,i.alreadyRead+=o,t.usedBytes+=o,this.stream.logBufferLevel(),null;n.debug("ISOFile","Getting item #"+e+" extent #"+r+" data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-t.fileStart)+" read size: "+(s.length-s.alreadyRead)+" full extent size: "+s.length+" full item size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,t,s.offset+s.alreadyRead-t.fileStart,s.length-s.alreadyRead),t.usedBytes+=s.length-s.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead+=s.length-s.alreadyRead,s.alreadyRead=s.length}}return i.alreadyRead===i.size?i:null},g.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var i=0;i0?this.moov.traks[e].samples[0].duration:0),t.push(r)}return t},g.prototype.getPerformanceInfo=function(){var e={};return e.moov=this.moov,this.moov&&this.moov.traks&&this.moov.traks.length>1&&(e.moovAudioNum=this.moov.traks[0].samples.length,e.moovVideoNum=this.moov.traks[1].samples.length),e},h.Box.prototype.printHeader=function(e){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},h.FullBox.prototype.printHeader=function(e){this.size+=4,h.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},h.Box.prototype.print=function(e){this.printHeader(e)},h.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},h.tkhdBox.prototype.print=function(e){h.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var y={createFile:function(e,t){var i=void 0===e||e,r=new g(t);return r.discardMdatData=!i,r}};t.createFile=y.createFile}));function Rr(e){return e.reduce(((e,t)=>256*e+t))}function Nr(e){const t=[101,103,119,99],i=e.length-28,r=e.slice(i,i+t.length);return t.every(((e,t)=>e===r[t]))}zr.Log,zr.MP4BoxStream,zr.DataStream,zr.MultiBufferStream,zr.MPEG4DescriptorParser,zr.BoxParser,zr.XMLSubtitlein4Parser,zr.Textin4Parser,zr.ISOFile,zr.createFile;class Gr{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(i+32,i+32+t))]}return null}(t,this.t);if(!i)return e;const r=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(r instanceof Error)return console.error(r.message),this.d=!0,e;this.A=!0,this.u=i[1],Nr(t)&&this.c++,WebAssembly.instantiate(i[2],r).then((e=>{if("function"!=typeof(t=e.instance.exports).parse||"object"!=typeof t.memory)return this.d=!0,void console.error("video_error_3");var t;this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}function Or(){for(var e=arguments.length,t=new Array(e),i=0;i{const i=new r((0|e.byteLength)+(0|t.byteLength));return i.set(e,0),i.set(t,0|e.byteLength),i}),new r)}const Hr=16,Vr=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],$r=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Wr(e){const t=[];for(let i=0,r=e.length;i1===(e=e.toString(16)).length?"0"+e:e)).join("")}function qr(e){const t=[];for(let i=0,r=e.length;i>>6),t.push(128|63&r);else if(r<=55295||r>=57344&&r<=65535)t.push(224|r>>>12),t.push(128|r>>>6&63),t.push(128|63&r);else{if(!(r>=65536&&r<=1114111))throw t.push(r),new Error("input is not supported");i++,t.push(240|r>>>18&28),t.push(128|r>>>12&63),t.push(128|r>>>6&63),t.push(128|63&r)}}return t}function jr(e){const t=[];for(let i=0,r=e.length;i=240&&e[i]<=247?(t.push(String.fromCodePoint(((7&e[i])<<18)+((63&e[i+1])<<12)+((63&e[i+2])<<6)+(63&e[i+3]))),i+=3):e[i]>=224&&e[i]<=239?(t.push(String.fromCodePoint(((15&e[i])<<12)+((63&e[i+1])<<6)+(63&e[i+2]))),i+=2):e[i]>=192&&e[i]<=223?(t.push(String.fromCodePoint(((31&e[i])<<6)+(63&e[i+1]))),i++):t.push(String.fromCodePoint(e[i]));return t.join("")}function Kr(e,t){const i=31&t;return e<>>32-i}function Xr(e){return(255&Vr[e>>>24&255])<<24|(255&Vr[e>>>16&255])<<16|(255&Vr[e>>>8&255])<<8|255&Vr[255&e]}function Zr(e){return e^Kr(e,2)^Kr(e,10)^Kr(e,18)^Kr(e,24)}function Jr(e){return e^Kr(e,13)^Kr(e,23)}function Qr(e,t,i){const r=new Array(4),s=new Array(4);for(let t=0;t<4;t++)s[0]=255&e[4*t],s[1]=255&e[4*t+1],s[2]=255&e[4*t+2],s[3]=255&e[4*t+3],r[t]=s[0]<<24|s[1]<<16|s[2]<<8|s[3];for(let e,t=0;t<32;t+=4)e=r[1]^r[2]^r[3]^i[t+0],r[0]^=Zr(Xr(e)),e=r[2]^r[3]^r[0]^i[t+1],r[1]^=Zr(Xr(e)),e=r[3]^r[0]^r[1]^i[t+2],r[2]^=Zr(Xr(e)),e=r[0]^r[1]^r[2]^i[t+3],r[3]^=Zr(Xr(e));for(let e=0;e<16;e+=4)t[e]=r[3-e/4]>>>24&255,t[e+1]=r[3-e/4]>>>16&255,t[e+2]=r[3-e/4]>>>8&255,t[e+3]=255&r[3-e/4]}function es(e,t,i){const r=new Array(4),s=new Array(4);for(let t=0;t<4;t++)s[0]=255&e[0+4*t],s[1]=255&e[1+4*t],s[2]=255&e[2+4*t],s[3]=255&e[3+4*t],r[t]=s[0]<<24|s[1]<<16|s[2]<<8|s[3];r[0]^=2746333894,r[1]^=1453994832,r[2]^=1736282519,r[3]^=2993693404;for(let e,i=0;i<32;i+=4)e=r[1]^r[2]^r[3]^$r[i+0],t[i+0]=r[0]^=Jr(Xr(e)),e=r[2]^r[3]^r[0]^$r[i+1],t[i+1]=r[1]^=Jr(Xr(e)),e=r[3]^r[0]^r[1]^$r[i+2],t[i+2]=r[2]^=Jr(Xr(e)),e=r[0]^r[1]^r[2]^$r[i+3],t[i+3]=r[3]^=Jr(Xr(e));if(0===i)for(let e,i=0;i<16;i++)e=t[i],t[i]=t[31-i],t[31-i]=e}function ts(e,t,i){let{padding:r="pkcs#7",mode:s,iv:a=[],output:n="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===s&&("string"==typeof a&&(a=Wr(a)),16!==a.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=Wr(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==i?qr(e):Wr(e):[...e],("pkcs#5"===r||"pkcs#7"===r)&&0!==i){const t=Hr-e.length%Hr;for(let i=0;i=Hr;){const t=e.slice(u,u+16),r=new Array(16);if("cbc"===s)for(let e=0;e2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=e.byteLength;let a=new Uint8Array(e.slice(0,5)),n=5;for(;ns){const t=new Uint8Array(a.length+e.length-n);t.set(a,0),t.set(e.slice(n),a.length),a=t;break}let l=e[n+4],c=!1,u=2;if(i?(r&&(u=3),l=l>>>1&63,c=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(l)):(l&=31,c=1===l||5===l),c){const i=ts(e.slice(n+4+u,n+4+d),t,0,{padding:"none",output:"array"});let r=i[i.length-1];if(r>0&&r<16){let e=!0;for(let t=1;t<=r;t++)if(i[i.length-t]!==r){e=!1;break}e&&i.splice(i.length-r,r)}const s=new Uint8Array(u);s.set(e.slice(n+4,n+4+u),0);const o=Jt(Or(s,new Uint8Array(i))),l=new Uint8Array(a.length+o.length);l.set(a,0),l.set(o,a.length),a=l}else{const t=e.slice(n+4,n+4+d),i=new Uint8Array(a.length+4+t.length);i.set(a,0),i.set(o,a.length),i.set(t,a.length+4),a=i}n=n+4+d}return a}const ss={init:0,findFirstStartCode:1,findSecondStartCode:2};class as extends class{on(e,t,i){const r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:i}),this}once(e,t,i){const r=this;function s(){r.off(e,s);for(var a=arguments.length,n=new Array(a),o=0;o1?i-1:0),s=1;s{delete i[e]})),void delete this.e;const r=i[e],s=[];if(r&&t)for(let e=0,i=r.length;e=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=ss.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==ss.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=ss.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==ss.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=ss.findFirstStartCode}}}}function ns(e,t,i){for(let r=2;r3&&void 0!==arguments[3]&&arguments[3];const s=e.byteLength;let a=5;for(;as)break;let o=e[a+4],d=!1;if(r?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const r=ns(e.slice(a+4,a+4+n),t,i);e.set(r,a+4)}a=a+4+n}return e}function ls(){for(var e=arguments.length,t=new Array(e),i=0;ie+t.byteLength),0));let s=0;return t.forEach((e=>{r.set(e,s),s+=e.byteLength})),r}class cs{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,i,r)));e.addEventListener(t,i,r);const s=()=>{ni(e.removeEventListener)&&e.removeEventListener(t,i,r)};return this.destroys.push(s),s}destroy(){this.master.debugLog("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class us{static init(){us.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in us.types)us.types.hasOwnProperty(e)&&(us.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=us.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,r=Array.prototype.slice.call(arguments,1),s=r.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let a=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return us.box(us.types.trak,us.tkhd(e),us.mdia(e))}static tkhd(e){let t=e.id,i=e.duration,r=e.presentWidth,s=e.presentHeight;return us.box(us.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>>8&255,255&r,0,0,s>>>8&255,255&s,0,0]))}static mdia(e){return us.box(us.types.mdia,us.mdhd(e),us.hdlr(e),us.minf(e))}static mdhd(e){let t=e.timescale,i=e.duration;return us.box(us.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?us.constants.HDLR_AUDIO:us.constants.HDLR_VIDEO,us.box(us.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?us.box(us.types.smhd,us.constants.SMHD):us.box(us.types.vmhd,us.constants.VMHD),us.box(us.types.minf,t,us.dinf(),us.stbl(e))}static dinf(){return us.box(us.types.dinf,us.box(us.types.dref,us.constants.DREF))}static stbl(e){return us.box(us.types.stbl,us.stsd(e),us.box(us.types.stts,us.constants.STTS),us.box(us.types.stsc,us.constants.STSC),us.box(us.types.stsz,us.constants.STSZ),us.box(us.types.stco,us.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?us.box(us.types.stsd,us.constants.STSD_PREFIX,us.mp3(e)):us.box(us.types.stsd,us.constants.STSD_PREFIX,us.mp4a(e)):"avc"===e.videoType?us.box(us.types.stsd,us.constants.STSD_PREFIX,us.avc1(e)):us.box(us.types.stsd,us.constants.STSD_PREFIX,us.hvc1(e))}static mp3(e){let t=e.channelCount,i=e.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return us.box(us.types[".mp3"],r)}static mp4a(e){let t=e.channelCount,i=e.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return us.box(us.types.mp4a,r,us.esds(e))}static esds(e){let t=e.config||[],i=t.length,r=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return us.box(us.types.esds,r)}static avc1(e){let t=e.avcc;const i=e.codecWidth,r=e.codecHeight;let s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,r>>>8&255,255&r,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return us.box(us.types.avc1,s,us.box(us.types.avcC,t))}static hvc1(e){let t=e.avcc;const i=e.codecWidth,r=e.codecHeight;let s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,r>>>8&255,255&r,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return us.box(us.types.hvc1,s,us.box(us.types.hvcC,t))}static mvex(e){return us.box(us.types.mvex,us.trex(e))}static trex(e){let t=e.id,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return us.box(us.types.trex,i)}static moof(e,t){return us.box(us.types.moof,us.mfhd(e.sequenceNumber),us.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return us.box(us.types.mfhd,t)}static traf(e,t){let i=e.id,r=us.box(us.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),s=us.box(us.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),a=us.sdtp(e),n=us.trun(e,a.byteLength+16+16+8+16+8+8);return us.box(us.types.traf,r,s,n,a)}static sdtp(e){let t=new Uint8Array(5),i=e.flags;return t[4]=i.isLeading<<6|i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy,us.box(us.types.sdtp,t)}static trun(e,t){let i=new Uint8Array(28);t+=36,i.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let r=e.duration,s=e.size,a=e.flags,n=e.cts;return i.set([r>>>24&255,r>>>16&255,r>>>8&255,255&r,s>>>24&255,s>>>16&255,s>>>8&255,255&s,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.isNonSync,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n],12),us.box(us.types.trun,i)}static mdat(e){return us.box(us.types.mdat,e)}}us.init();var hs,fs=Rt((function(e){e.exports=function(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e},e.exports.__esModule=!0,e.exports.default=e.exports}));(hs=fs)&&hs.__esModule&&Object.prototype.hasOwnProperty.call(hs,"default")&&hs.default;const ps=[44100,48e3,32e3,0],_s=[22050,24e3,16e3,0],ms=[11025,12e3,8e3,0],gs=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],ys=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],bs=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];function vs(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),i=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let r=t[1]>>>3&3,s=(6&t[1])>>1,a=(240&t[2])>>>4,n=(12&t[2])>>>2,o=3!==(t[3]>>>6&3)?2:1,d=0,l=0;switch(r){case 0:d=ms[n];break;case 2:d=_s[n];break;case 3:d=ps[n]}switch(s){case 1:a=e[s]&&t=6?(r=5,t=new Array(4),n=s-3):(r=2,t=new Array(2),n=s):-1!==o.indexOf("android")?(r=2,t=new Array(2),n=s):(r=5,n=s,t=new Array(4),s>=6?n=s-3:1===a&&(r=2,t=new Array(2),n=s)),t[0]=r<<3,t[0]|=(15&s)>>>1,t[1]=(15&s)<<7,t[1]|=(15&a)<<3,5===r&&(t[1]|=(15&n)>>>1,t[2]=(1&n)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=Ps[s],this.sampling_index=s,this.channel_count=a,this.object_type=r,this.original_object_type=i,this.codec_mimetype="mp4a.40."+r,this.original_codec_mimetype="mp4a.40."+i}}class Rs{constructor(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}get bitsAvailable(){return this.bitLength-this.index}skipBits(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}getBits(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>r,a=8-r;if(a>=e)return i&&(this.index+=e),s>>a-e;{i&&(this.index+=a);const r=e-a;return s<>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}function Ns(e){return e[3]|e[2]<<8|e[1]<<16|e[0]<<24}const Gs=new Array(214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72),Os=new Array(2746333894,1453994832,1736282519,2993693404),Hs=new Array(462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257);function Vs(e,t,i,r,s){var a=s;a=t+s>e.length&&r+s<=i.length?e.length-t:r+s>i.length&&t+s<=e.length?i.length-r:t+s<=e.length&&r+s<=i.length?s:i.length>24&255,e>>16&255,e>>8&255,255&e)}function Ws(e,t){return t+3>>19)^(r<<23|r>>>9)}function js(e,t){var i=new Array(36);i[0]=Ws(t,0),i[1]=Ws(t,4),i[2]=Ws(t,8),i[3]=Ws(t,12);for(var r=0;r<32;r++)i[r+4]=i[r]^Ks(i[r+1]^i[r+2]^i[r+3]^e[r]);var s=new Array(4);for(r=35;r>=32;r--)s[35-r]=i[r];var a=function(e){for(var t=new Array(4*e.length),i=0;i>>30)^(r<<10|r>>>22)^(r<<18|r>>>14)^(r<<24|r>>>8)}function Xs(e,t,i){if(null==e||null==e||e.length%16!=0)return console.log("sm4 key is error!"),null;if(null==i||null==i||i.length<=0)return console.log("cipher is error!"),null;if(null==t||null==t||t.length%16!=0)return console.log("iv is error!"),null;for(var r=Ys(e),s=Math.ceil(i.length/16),a=new Array(i.length),n=t.slice(),o=0;o3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t=new Uint8Array(t),i=new Uint8Array(i);const a=e.byteLength;let n=5;for(;na)break;let d=e[n+4],l=!1,c=2;if(r?(s&&(c=3),d=d>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(d)):(d&=31,l=1===d||5===d),l){const r=Xs(t,i,e.slice(n+4+c,n+4+o));e.set(r,n+4+c)}n=n+4+o}return e}Date.now||(Date.now=function(){return(new Date).getTime()}),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=[],s=[],a=null,n=null,o=null,d=null,l=null,c=null,b=!1,v=null,B=null,be=!1,ve=!1,Ve=!!pi(i),Ke=0,Xe=0,Je=!1,et=null,dt=null,St=null,wt=[],Ut=null,zt=null,Rt=0,Nt=0,Gt=null,Ot=null,Yt=0,Xt=0,ii=!1,yi=!1,bi=!1,vi=null,Si=null,Ui=!1,Ri=!0,Ni=()=>{const e=hi();return{debug:e.debug,debugLevel:e.debugLevel,debugUuid:e.debugUuid,useOffscreen:e.useOffscreen,useWCS:e.useWCS,useMSE:e.useMSE,videoBuffer:e.videoBuffer,videoBufferDelay:e.videoBufferDelay,openWebglAlignment:e.openWebglAlignment,playType:e.playType,hasAudio:e.hasAudio,hasVideo:e.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:e.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:e.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:0,networkDelay:e.networkDelay,visibility:!0,useSIMD:e.useSIMD,isRecording:!1,recordType:e.recordType,isNakedFlow:e.isNakedFlow,checkFirstIFrame:e.checkFirstIFrame,audioBufferSize:1024,isM7sCrypto:e.isM7sCrypto,m7sCryptoAudio:e.m7sCryptoAudio,cryptoKey:e.cryptoKey,cryptoIV:e.cryptoIV,isSm4Crypto:e.isSm4Crypto,isSm4CryptoH265V2:e.isSm4CryptoH265V2,sm4CryptoKey:e.sm4CryptoKey,isXorCrypto:e.isXorCrypto,isHls265:!1,isFlv:e.isFlv,isFmp4:e.isFmp4,isMpeg4:e.isMpeg4,isTs:e.isTs,isFmp4Private:e.isFmp4Private,isEmitSEI:e.isEmitSEI,isRecordTypeFlv:!1,isWasmMp4:!1,isChrome:!1,isFirefox:!1,isDropSameTimestampGop:e.isDropSameTimestampGop,mseDecodeAudio:e.mseDecodeAudio,wcsDecodeAudio:e.wcsDecodeAudio,nakedFlowH265DemuxUseNew:e.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:e.mseDecoderUseWorker,mseAutoCleanupSourceBuffer:e.mseAutoCleanupSourceBuffer,mseAutoCleanupMaxBackwardDuration:e.mseAutoCleanupMaxBackwardDuration,mseAutoCleanupMinBackwardDuration:e.mseAutoCleanupMinBackwardDuration,mseCorrectTimeDuration:e.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:e.mseCorrectAudioTimeDuration,nakedFlowDemuxUseNew:e.nakedFlowDemuxUseNew,nakedFlowFps:e.nakedFlowFps,supportMSEDecodeHevc:!1}};"VideoEncoder"in self&&(a={hasInit:!1,isEmitInfo:!1,offscreenCanvas:null,offscreenCanvasCtx:null,decoder:null,init(){a.decoder=new VideoDecoder({output:function(e){if(ni(e.createImageBitmap))e.createImageBitmap().then((t=>{a.offscreenCanvasCtx.drawImage(t,0,0,e.codedWidth,e.codedHeight);let i=a.offscreenCanvas.transferToImageBitmap();postMessage({cmd:E,buffer:i,delay:ar.delay,ts:0},[i]),li(e)}));else{a.offscreenCanvasCtx.drawImage(e,0,0,e.codedWidth,e.codedHeight);let t=a.offscreenCanvas.transferToImageBitmap();postMessage({cmd:E,buffer:t,delay:ar.delay,ts:0},[t]),li(e)}},error:function(e){ar.debugError("worker","VideoDecoder error: ",e,e.toString())}})},destroy(){a.reset(),a.decoder&&"closed"!==a.decoder.state&&(a.decoder.close(),a.decoder=null)},decode:function(e,t,i){const r=e[0]>>4==1;if(a.hasInit){const i=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:r?ut:ht});a.decoder.decode(i)}else if(r&&0===e[1]){const t=15&e[0];postMessage({cmd:I,code:t});const i=new Uint8Array(e);postMessage({cmd:F,buffer:i,codecId:t},[i.buffer]);let r=null,s=null;const n=e.slice(5);t===De?(s=xi(n),r={codec:s.codec,description:n}):t===Ie&&(s=Hi(n),r={codec:s.codec,description:n}),s&&s.codecWidth&&s.codecHeight&&(r.codedHeight=s.codecHeight,r.codedWidth=s.codecWidth),a.isEmitInfo||(ar.debugLog("worker","Webcodecs Video Decoder initSize"),postMessage({cmd:x,w:s.codecWidth,h:s.codecHeight}),a.isEmitInfo=!0,a.offscreenCanvas=new OffscreenCanvas(s.codecWidth,s.codecHeight),a.offscreenCanvasCtx=a.offscreenCanvas.getContext("2d"));try{a.decoder.configure(r),a.hasInit=!0}catch(e){ar.debugError("worker","VideoDecoder configure error",e.code,e,e.toString()),e.toString()}}else ar.debugWarn("worker",`VideoDecoder configure has not init , isIframe is ${r} , payload is ${e[1]} so drop this frame`)},reset(){a.hasInit=!1,a.isEmitInfo=!1,a.offscreenCanvas=null,a.offscreenCanvasCtx=null}});let Vi=function(){if(Ui=!0,n)try{n.abort(),n=null,ar.debugLog("worker","abort success")}catch(e){n=null,ar.debugLog("worker","abort catch",e)}},er={init(){er.lastBuf=null,er.vps=null,er.sps=null,er.pps=null,er.streamType=null,er.localDts=0,er.pendingUnits={},er.isSendSeqHeader=!1},destroy(){er.lastBuf=null,er.vps=null,er.sps=null,er.pps=null,er.streamType=null,er.localDts=0,er.pendingUnits={},er.isSendSeqHeader=!1},dispatch(e){const t=new Uint8Array(e);if(ar._opt.nakedFlowDemuxUseNew){const e=er.extractNALu$3(t);if(0===e.length)return void ar.debugLog("worker","dispatch naluArray length is 0");er.handleVideoFrames(e)}else er.extractNALu$2(t)},getNaluDts(){const e=ar._opt.nakedFlowFps;let t=er.localDts;return er.localDts=er.localDts+parseInt(1e3/e,10),t},getNaluAudioDts(){const e=ar._opt.sampleRate,t=ar._opt.audioBufferSize;return er.localDts+parseInt(t/e*1e3)},extractNALu(e){let t,i,r=0,s=e.byteLength,a=0,n=[];for(;r1)for(let e=0;e{const t=Li(e);t===He||t===Oe?er.handleVideoH264Nalu(e):Ii(t)&&r.push(e)})),1===r.length)er.handleVideoH264Nalu(r[0]);else{if(Pi(r)){const e=Li(r[0]),t=Fi(e);er.handleVideoH264NaluList(r,t,e)}else r.forEach((e=>{er.handleVideoH264Nalu(e)}))}}else if(er.streamType===Me)if(ar._opt.nakedFlowH265DemuxUseNew){const t=er.handleAddNaluStartCode(e),i=er.extractNALu(t);if(0===i.length)return void ar.debugWarn("worker","handleVideoNalu","h265 naluList.length === 0");const r=[];if(i.forEach((e=>{const t=qi(e);t===nt||t===st||t===it?er.handleVideoH265Nalu(e):Ki(t)&&r.push(e)})),1===r.length)er.handleVideoH265Nalu(r[0]);else{if(Zi(r)){const e=qi(r[0]),t=Xi(e);er.handleVideoH265NaluList(r,t,e)}else r.forEach((e=>{er.handleVideoH265Nalu(e)}))}}else{qi(e)===nt?er.extractH265PPS(e):er.handleVideoH265Nalu(e)}},extractH264PPS(e){const t=er.handleAddNaluStartCode(e);er.extractNALu(t).forEach((e=>{Di(Li(e))?er.extractH264SEI(e):er.handleVideoH264Nalu(e)}))},extractH265PPS(e){const t=er.handleAddNaluStartCode(e);er.extractNALu(t).forEach((e=>{ji(qi(e))?er.extractH265SEI(e):er.handleVideoH265Nalu(e)}))},extractH264SEI(e){const t=er.handleAddNaluStartCode(e);er.extractNALu(t).forEach((e=>{er.handleVideoH264Nalu(e)}))},extractH265SEI(e){const t=er.handleAddNaluStartCode(e);er.extractNALu(t).forEach((e=>{er.handleVideoH265Nalu(e)}))},handleAddNaluStartCode(e){const t=[0,0,0,1],i=new Uint8Array(e.length+t.length);return i.set(t),i.set(e,t.length),i},handleVideoH264Nalu(e){const t=Li(e);switch(t){case Oe:er.sps=e;break;case He:er.pps=e}if(er.isSendSeqHeader){if(er.sps&&er.pps){const e=Ei({sps:er.sps,pps:er.pps}),t=er.localDts;ar.decode(e,{type:se,ts:t,isIFrame:!0,cts:0}),er.sps=null,er.pps=null}if(Ii(t)){const i=Fi(t),r=er.getNaluDts(),s=ki(e,i);er.doDecode(s,{type:se,ts:r,isIFrame:i,cts:0})}}else if(er.sps&&er.pps){er.isSendSeqHeader=!0;const e=Ei({sps:er.sps,pps:er.pps});ar.decode(e,{type:se,ts:0,isIFrame:!0,cts:0}),er.sps=null,er.pps=null}},handleVideoH264NaluList(e,t,i){if(er.isSendSeqHeader){const r=er.getNaluDts(),s=Ci(e.reduce(((e,t)=>{const i=Jt(e),r=Jt(t),s=new Uint8Array(i.byteLength+r.byteLength);return s.set(i,0),s.set(r,i.byteLength),s})),t);er.doDecode(s,{type:se,ts:r,isIFrame:t,cts:0}),ar.debugLog("worker",`handleVideoH264NaluList list size is ${e.length} package length is ${s.byteLength} isIFrame is ${t},nalu type is ${i}, dts is ${r}`)}},handleVideoH265Nalu(e){const t=qi(e);switch(t){case it:er.vps=e;break;case st:er.sps=e;break;case nt:er.pps=e}if(er.isSendSeqHeader){if(er.vps&&er.sps&&er.pps){const e=$i({vps:er.vps,sps:er.sps,pps:er.pps}),t=er.localDts;ar.decode(e,{type:se,ts:t,isIFrame:!0,cts:0}),er.vps=null,er.sps=null,er.pps=null}if(Ki(t)){const i=Xi(t),r=er.getNaluDts(),s=Wi(e,i);er.doDecode(s,{type:se,ts:r,isIFrame:i,cts:0})}}else if(er.vps&&er.sps&&er.pps){er.isSendSeqHeader=!0;const e=$i({vps:er.vps,sps:er.sps,pps:er.pps});ar.decode(e,{type:se,ts:0,isIFrame:!0,cts:0}),er.vps=null,er.sps=null,er.pps=null}},handleVideoH265NaluList(e,t,i){if(er.isSendSeqHeader){const r=er.getNaluDts(),s=Yi(e.reduce(((e,t)=>{const i=Jt(e),r=Jt(t),s=new Uint8Array(i.byteLength+r.byteLength);return s.set(i,0),s.set(r,i.byteLength),s})),t);er.doDecode(s,{type:se,ts:r,isIFrame:t,cts:0}),ar.debugLog("worker",`handleVideoH265NaluList list size is ${e.length} package length is ${s.byteLength} isIFrame is ${t},nalu type is ${i}, dts is ${r}`)}},doDecode(e,t){ar.calcNetworkDelay(t.ts),t.isIFrame&&ar.calcIframeIntervalTimestamp(t.ts),ar.decode(e,t)},handleVideoFrames(e){if(!er.streamVideoType)for(let t of e)if(er.streamVideoType=oi(t),er.streamVideoType)break;er.streamVideoType?er.streamVideoType===Pe?er.handleVideoH264Frames(e):this.streamVideoType===Me&&er.handleVideoH265Frames(e):ar.debugWarn("worker","handleVideoFrames","streamVideoType is null")},handleVideoH264Frames(e){let t=[],i=[],r=!1,s=!1;er.pendingUnits.units&&(t=er.pendingUnits.units,s=er.pendingUnits.vcl,r=er.pendingUnits.iFrame,er.pendingUnits={});let a={};for(let n of e){if(n.byteLength<4)continue;const e=Li(n);let o=!1,d=e===We;e!==$e&&e!==We||(a=er.parseVideo264Header(n),o=!0),t.length&&s&&(a.isfms||!o)&&(i.push({units:t,isIFrame:r}),t=[],r=!1,s=!1),t.push(n),r=r||d,s=s||o}t.length&&(er.pendingUnits={units:t,vcl:s,iFrame:r}),i.forEach((e=>{const t=e.units,i=e.isIFrame;let r=null,s=null;if(t.forEach((e=>{const t=31&e[0];switch(t){case He:er.pps=e;break;case Oe:er.sps=e;break;case Ye:s=e}if(Ii(t)){const t=Jt(e);if(r){const e=new Uint8Array(r.byteLength+t.byteLength);e.set(r,0),e.set(t,r.byteLength),r=e}else r=t}})),!er.isSendSeqHeader&&er.sps&&er.pps){er.isSendSeqHeader=!0;const e=Ti({sps:er.sps,pps:er.pps});ar.decode(e,{type:se,ts:0,isIFrame:!0,cts:0}),er.sps=null,er.pps=null}if(er.isSendSeqHeader){if(er.sps&&er.pps){const e=Ti({sps:er.sps,pps:er.pps}),t=er.localDts;ar.decode(e,{type:se,ts:t,isIFrame:!0,cts:0}),er.sps=null,er.pps=null}if(r){const e=er.getNaluDts(),t=Ci(r,i);ar._opt.isEmitSEI&&s&&postMessage({cmd:j,buffer:s,ts:e},[s.buffer]),er.doDecode(t,{type:se,ts:e,isIFrame:i,cts:0})}}}))},handleVideoH265Frames(e){let t=[],i=[],r=!1,s=!1;er.pendingUnits.units&&(t=er.pendingUnits.units,s=er.pendingUnits.vcl,r=er.pendingUnits.iFrame,er.pendingUnits={});let a={};for(let n of e){if(n.byteLength<4)continue;const e=qi(n);let o=!1,d=Xi(e);Ki(e)&&(a=this.parseVideo265Header(n),o=!0),t.length&&s&&(a.isfms||!o)&&(i.push({units:t,isIFrame:r}),t=[],r=!1,s=!1),t.push(n),r=r||d,s=s||o}t.length&&(er.pendingUnits={units:t,vcl:s,iFrame:r}),i.forEach((e=>{const t=e.units,i=e.isIFrame;let r=null,s=null;if(t.forEach((e=>{const t=e[0]>>>1&63;switch(t){case nt:er.pps=e;break;case st:er.sps=e;break;case it:er.vps=e;break;case ct:case lt:s=e}if(Ki(t)){const t=Jt(e);if(r){const e=new Uint8Array(r.byteLength+t.byteLength);e.set(r,0),e.set(t,r.byteLength),r=e}else r=t}})),!er.isSendSeqHeader&&er.sps&&er.pps&&er.vps){er.isSendSeqHeader=!0;const e=$i({sps:er.sps,pps:er.pps,vps:er.vps});ar.decode(e,{type:se,ts:0,isIFrame:!0,cts:0}),er.sps=null,er.pps=null,er.vps=null}if(er.isSendSeqHeader){if(er.sps&&er.pps&&er.vps){const e=$i({sps:er.sps,pps:er.pps,vps:er.vps}),t=er.localDts;ar.decode(e,{type:se,ts:t,isIFrame:!0,cts:0}),er.sps=null,er.pps=null,er.vps=null}if(r){const e=er.getNaluDts(),t=Yi(r,i);ar._opt.isEmitSEI&&s&&postMessage({cmd:j,buffer:s,ts:e},[s.buffer]),er.doDecode(t,{type:se,ts:e,isIFrame:i,cts:0})}}}))},handleVideoH265Frames_1(e){e.forEach((e=>{er.handleVideoNalu(e)}))},parseVideo264Header(e){const t=new Rs(e);t.readUByte();return{isfms:0===t.readUEG(),sType:t.readUEG()}},parseVideo265Header(e){const t=new Rs(e);return t.readUByte(),{nalType:t.readBits(6),isfms:0===t.readBits(1),sType:t.readBits(3)}}},tr={LOG_NAME:"worker fmp4Demuxer",mp4Box:null,offset:0,videoTrackId:null,audioTrackId:null,isHevc:!1,listenMp4Box(){tr.mp4Box=zr.createFile(),tr.mp4Box.onReady=tr.onReady,tr.mp4Box.onError=tr.onError,tr.mp4Box.onSamples=tr.onSamples},initTransportDescarmber(){tr.transportDescarmber=new Gr},_getSeqHeader(e){const t=tr.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new zr.DataStream(void 0,0,zr.DataStream.BIG_ENDIAN);let i=[];e.avcC?(e.avcC.write(t),i=[23,0,0,0,0]):(tr.isHevc=!0,ar.isHevc=!0,e.hvcC.write(t),i=[28,0,0,0,0]);const r=new Uint8Array(t.buffer,8),s=new Uint8Array(i.length+r.length);return s.set(i,0),s.set(r,i.length),s}return null},onReady(e){ar.debugLog(tr.LOG_NAME,"onReady()");const t=e.videoTracks[0],i=e.audioTracks[0];if(t){tr.videoTrackId=t.id;const e=tr._getSeqHeader(t);e&&(ar.debugLog(tr.LOG_NAME,"seqHeader"),ar.decodeVideo(e,0,!0,0)),tr.mp4Box.setExtractionOptions(t.id)}if(i&&ar._opt.hasAudio){tr.audioTrackId=i.id;const e=i.audio||{},t=Ht.indexOf(e.sample_rate),r=i.codec.replace("mp4a.40.","");tr.mp4Box.setExtractionOptions(i.id);const s=Vt({profile:parseInt(r,10),sampleRate:t,channel:e.channel_count});ar.debugLog(tr.LOG_NAME,"aacADTSHeader"),ar.decodeAudio(s,0)}tr.mp4Box.start()},onError(e){ar.debugError(tr.LOG_NAME,"mp4Box onError",e)},onSamples(e,t,i){if(e===tr.videoTrackId){for(const e of i){const t=e.data,i=e.is_sync,r=1e3*e.cts/e.timescale;e.duration,e.timescale,i&&ar.calcIframeIntervalTimestamp(r);let s=null;s=tr.isHevc?Yi(t,i):Ci(t,i),ar.decode(s,{type:se,ts:r,isIFrame:i,cts:0})}tr.mp4Box.removeUsedSamples(e)}else if(e===tr.audioTrackId){if(ar._opt.hasAudio){for(const e of i){const t=e.data,i=1e3*e.cts/e.timescale;e.duration,e.timescale;const r=new Uint8Array(t.byteLength+2);r.set([175,1],0),r.set(t,2),ar.decode(r,{type:re,ts:i,isIFrame:!1,cts:0})}tr.mp4Box.removeUsedSamples(e)}}else ar.debugWarn(tr.LOG_NAME,"onSamples() trackId error",e)},dispatch(e){let t=new Uint8Array(e);tr.transportDescarmber&&(t=tr.transportDescarmber.transport(t)),t.buffer.fileStart=tr.offset,tr.offset+=t.byteLength,tr.mp4Box.appendBuffer(t.buffer)},destroy(){tr.mp4Box&&(tr.mp4Box.stop(),tr.mp4Box.flush(),tr.mp4Box.destroy(),tr.mp4Box=null),tr.transportDescarmber&&(tr.transportDescarmber.destroy(),tr.transportDescarmber=null),tr.offset=0,tr.videoTrackId=null,tr.audioTrackId=null,tr.isHevc=!1}},ir={LOG_NAME:"worker mpeg4Demuxer",lastBuffer:new Uint8Array(0),parsedOffset:0,firstStartCodeOffset:0,secondStartCodeOffset:0,state:"init",hasInitVideoCodec:!1,localDts:0,dispatch(e){const t=new Uint8Array(e);ir.extractNALu(t)},destroy(){ir.lastBuffer=new Uint8Array(0),ir.parsedOffset=0,ir.firstStartCodeOffset=0,ir.secondStartCodeOffset=0,ir.state="init",ir.hasInitVideoCodec=!1,ir.localDts=0},extractNALu(e){if(!e||e.byteLength<1)return void ar.debugWarn(ir.LOG_NAME,"extractNALu() buffer error",e);const t=new Uint8Array(ir.lastBuffer.length+e.length);for(t.set(ir.lastBuffer,0),t.set(new Uint8Array(e),ir.lastBuffer.length),ir.lastBuffer=t;;){if("init"===ir.state){let e=!1;for(;ir.lastBuffer.length-ir.parsedOffset>=4;)if(0===ir.lastBuffer[ir.parsedOffset])if(0===ir.lastBuffer[ir.parsedOffset+1])if(1===ir.lastBuffer[ir.parsedOffset+2]){if(182===ir.lastBuffer[ir.parsedOffset+3]){ir.state="findFirstStartCode",ir.firstStartCodeOffset=ir.parsedOffset,ir.parsedOffset+=4,e=!0;break}ir.parsedOffset++}else ir.parsedOffset++;else ir.parsedOffset++;else ir.parsedOffset++;if(e)continue;break}if("findFirstStartCode"===ir.state){let e=!1;for(;ir.lastBuffer.length-ir.parsedOffset>=4;)if(0===ir.lastBuffer[ir.parsedOffset])if(0===ir.lastBuffer[ir.parsedOffset+1])if(1===ir.lastBuffer[ir.parsedOffset+2]){if(182===ir.lastBuffer[ir.parsedOffset+3]){ir.state="findSecondStartCode",ir.secondStartCodeOffset=ir.parsedOffset,ir.parsedOffset+=4,e=!0;break}ir.parsedOffset++}else ir.parsedOffset++;else ir.parsedOffset++;else ir.parsedOffset++;if(e)continue;break}if("findSecondStartCode"===ir.state){if(!(ir.lastBuffer.length-ir.parsedOffset>0))break;{let e,t,i=192&ir.lastBuffer[ir.parsedOffset];e=0==i?ir.secondStartCodeOffset-14:ir.secondStartCodeOffset;let r=0==(192&ir.lastBuffer[ir.firstStartCodeOffset+4]);if(r){if(ir.firstStartCodeOffset-14<0)return void ar.debugWarn(ir.LOG_NAME,"firstStartCodeOffset -14 is",ir.firstStartCodeOffset-14);ir.hasInitVideoCodec||(ir.hasInitVideoCodec=!0,ar.debugLog(ir.LOG_NAME,"setCodec"),or.setCodec(Fe,"")),t=ir.lastBuffer.subarray(ir.firstStartCodeOffset-14,e)}else t=ir.lastBuffer.subarray(ir.firstStartCodeOffset,e);let s=ir.getNaluDts();ir.hasInitVideoCodec?(postMessage({cmd:R,type:Be,value:t.byteLength}),postMessage({cmd:R,type:Ue,value:s}),Ke=s,or.decode(t,r?1:0,s)):ar.debugWarn(ir.LOG_NAME,"has not init video codec"),ir.lastBuffer=ir.lastBuffer.subarray(e),ir.firstStartCodeOffset=0==i?14:0,ir.parsedOffset=ir.firstStartCodeOffset+4,ir.state="findFirstStartCode"}}}},getNaluDts(){let e=ir.localDts;return ir.localDts=ir.localDts+40,e}},rr={TAG_NAME:"worker TsLoaderV2",first_parse_:!0,tsPacketSize:0,syncOffset:0,pmt_:null,config_:null,media_info_:new Ms,timescale_:90,duration_:0,pat_:{version_number:0,network_pid:0,program_map_pid:{}},current_program_:null,current_pmt_pid_:-1,program_pmt_map_:{},pes_slice_queues_:{},section_slice_queues_:{},video_metadata_:{vps:null,sps:null,pps:null,details:null},audio_metadata_:{codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},last_pcr_:null,audio_last_sample_pts_:void 0,aac_last_incomplete_data_:null,has_video_:!1,has_audio_:!1,video_init_segment_dispatched_:!1,audio_init_segment_dispatched_:!1,video_metadata_changed_:!1,audio_metadata_changed_:!1,loas_previous_frame:null,video_track_:{type:"video",id:1,sequenceNumber:0,samples:[],length:0},audio_track_:{type:"audio",id:2,sequenceNumber:0,samples:[],length:0},_remainingPacketData:null,init(){},destroy(){rr.media_info_=null,rr.pes_slice_queues_=null,rr.section_slice_queues_=null,rr.video_metadata_=null,rr.audio_metadata_=null,rr.aac_last_incomplete_data_=null,rr.video_track_=null,rr.audio_track_=null,rr._remainingPacketData=null},probe(e){let t=new Uint8Array(e),i=-1,r=188;if(t.byteLength<=3*r)return{needMoreData:!0};for(;-1===i;){let e=Math.min(1e3,t.byteLength-3*r);for(let s=0;s=4&&(i-=4),{match:!0,consumed:0,ts_packet_size:r,sync_offset:i})},_initPmt:()=>({program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}),dispatch(e){rr._remainingPacketData&&(e=ls(rr._remainingPacketData,e),rr._remainingPacketData=null);let t=e.buffer;const i=rr.parseChunks(t);i?rr._remainingPacketData=e.subarray(i):e.length>>6;i[1];let a=(31&i[1])<<8|i[2],n=(48&i[3])>>>4,o=15&i[3],d=!(!rr.pmt_||rr.pmt_.pcr_pid!==a),l={},c=4;if(2==n||3==n){let e=i[4];if(e>0&&(d||3==n)){if(l.discontinuity_indicator=(128&i[5])>>>7,l.random_access_indicator=(64&i[5])>>>6,l.elementary_stream_priority_indicator=(32&i[5])>>>5,(16&i[5])>>>4){let e=300*(i[6]<<25|i[7]<<17|i[8]<<9|i[9]<<1|i[10]>>>7)+((1&i[10])<<8|i[11]);rr.last_pcr_=e}}if(2==n||5+e===188){t+=188,204===rr.tsPacketSize&&(t+=16);continue}c=5+e}if(1==n||3==n)if(0===a||a===rr.current_pmt_pid_||null!=rr.pmt_&&rr.pmt_.pid_stream_type[a]===ks){let i=188-c;rr.handleSectionSlice(e,t+c,i,{pid:a,payload_unit_start_indicator:s,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}else if(null!=rr.pmt_&&null!=rr.pmt_.pid_stream_type[a]){let i=188-c,r=rr.pmt_.pid_stream_type[a];a!==rr.pmt_.common_pids.h264&&a!==rr.pmt_.common_pids.h265&&a!==rr.pmt_.common_pids.adts_aac&&a!==rr.pmt_.common_pids.loas_aac&&a!==rr.pmt_.common_pids.ac3&&a!==rr.pmt_.common_pids.eac3&&a!==rr.pmt_.common_pids.opus&&a!==rr.pmt_.common_pids.mp3&&!0!==rr.pmt_.pes_private_data_pids[a]&&!0!==rr.pmt_.timed_id3_pids[a]&&!0!==rr.pmt_.synchronous_klv_pids[a]&&!0!==rr.pmt_.asynchronous_klv_pids[a]||rr.handlePESSlice(e,t+c,i,{pid:a,stream_type:r,payload_unit_start_indicator:s,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}t+=188,204===rr.tsPacketSize&&(t+=16)}return rr.dispatchAudioVideoMediaSegment(),t},handleSectionSlice(e,t,i,r){let s=new Uint8Array(e,t,i),a=rr.section_slice_queues_[r.pid];if(r.payload_unit_start_indicator){let n=s[0];if(null!=a&&0!==a.total_length){let s=new Uint8Array(e,t+1,Math.min(i,n));a.slices.push(s),a.total_length+=s.byteLength,a.total_length===a.expected_length?rr.emitSectionSlices(a,r):rr.clearSlices(a,r)}for(let o=1+n;o=a.expected_length&&rr.clearSlices(a,r),o+=d.byteLength}}else if(null!=a&&0!==a.total_length){let s=new Uint8Array(e,t,Math.min(i,a.expected_length-a.total_length));a.slices.push(s),a.total_length+=s.byteLength,a.total_length===a.expected_length?rr.emitSectionSlices(a,r):a.total_length>=a.expected_length&&rr.clearSlices(a,r)}},handlePESSlice(e,t,i,r){let s=new Uint8Array(e,t,i),a=s[0]<<16|s[1]<<8|s[2];s[3];let n=s[4]<<8|s[5];if(r.payload_unit_start_indicator){if(1!==a)return void ar.debugWarn(rr.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${a}`);let e=rr.pes_slice_queues_[r.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?rr.emitPESSlices(e,r):rr.clearSlices(e,r)),rr.pes_slice_queues_[r.pid]=new Ds,rr.pes_slice_queues_[r.pid].random_access_indicator=r.random_access_indicator}if(null==rr.pes_slice_queues_[r.pid])return;let o=rr.pes_slice_queues_[r.pid];o.slices.push(s),r.payload_unit_start_indicator&&(o.expected_length=0===n?0:n+6),o.total_length+=s.byteLength,o.expected_length>0&&o.expected_length===o.total_length?rr.emitPESSlices(o,r):o.expected_length>0&&o.expected_length>>6,o=t[8];2!==n&&3!==n||(i=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,a=3===n?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:i);let d,l=9+o;if(0!==s){if(s<3+o)return void ar.debugWarn(rr.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");d=s-3-o}else d=t.byteLength-l;let c=t.subarray(l,l+d);switch(e.stream_type){case Ss:case ws:rr.parseMP3Payload(c,i);break;case As:rr.pmt_.common_pids.opus===e.pid||rr.pmt_.common_pids.ac3===e.pid||rr.pmt_.common_pids.eac3===e.pid||(rr.pmt_.asynchronous_klv_pids[e.pid]?rr.parseAsynchronousKLVMetadataPayload(c,e.pid,r):rr.pmt_.smpte2038_pids[e.pid]?rr.parseSMPTE2038MetadataPayload(c,i,a,e.pid,r):rr.parsePESPrivateDataPayload(c,i,a,e.pid,r));break;case Bs:rr.parseADTSAACPayload(c,i);break;case Us:rr.parseLOASAACPayload(c,i);break;case xs:case Es:break;case Ts:rr.pmt_.timed_id3_pids[e.pid]?rr.parseTimedID3MetadataPayload(c,i,a,e.pid,r):rr.pmt_.synchronous_klv_pids[e.pid]&&rr.parseSynchronousKLVMetadataPayload(c,i,a,e.pid,r);break;case Cs:rr.parseH264Payload(c,i,a,e.random_access_indicator);break;case Ls:rr.parseH265Payload(c,i,a,e.random_access_indicator)}}else if((188===r||191===r||240===r||241===r||255===r||242===r||248===r)&&e.stream_type===As){let i,a=6;i=0!==s?s:t.byteLength-a;let n=t.subarray(a,a+i);rr.parsePESPrivateDataPayload(n,void 0,void 0,e.pid,r)}}else ar.debugError(rr.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${i}`)},parsePAT(e){let t=e[0];if(0!==t)return void Log.e(rr.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let i=(15&e[1])<<8|e[2];e[3],e[4];let r=(62&e[5])>>>1,s=1&e[5],a=e[6];e[7];let n=null;if(1===s&&0===a)n={version_number:0,network_pid:0,program_pmt_pid:{}},n.version_number=r;else if(n=rr.pat_,null==n)return;let o=i-5-4,d=-1,l=-1;for(let t=8;t<8+o;t+=4){let i=e[t]<<8|e[t+1],r=(31&e[t+2])<<8|e[t+3];0===i?n.network_pid=r:(n.program_pmt_pid[i]=r,-1===d&&(d=i),-1===l&&(l=r))}1===s&&0===a&&(null==rr.pat_&&ar.debugLog(rr.TAG_NAME,`Parsed first PAT: ${JSON.stringify(n)}`),rr.pat_=n,rr.current_program_=d,rr.current_pmt_pid_=l)},parsePMT(e){let t=e[0];if(2!==t)return void ar.debugError(rr.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let i,r=(15&e[1])<<8|e[2],s=e[3]<<8|e[4],a=(62&e[5])>>>1,n=1&e[5],o=e[6];if(e[7],1===n&&0===o)i=rr._initPmt(),i.program_number=s,i.version_number=a,rr.program_pmt_map_[s]=i;else if(i=rr.program_pmt_map_[s],null==i)return;i.pcr_pid=(31&e[8])<<8|e[9];let d=(15&e[10])<<8|e[11],l=12+d,c=r-9-d-4;for(let t=l;t0){for(let r=t+5;r0)for(let r=t+5;rrr.has_video_&&rr.has_audio_?rr.video_init_segment_dispatched_&&rr.audio_init_segment_dispatched_:rr.has_video_&&!rr.has_audio_?rr.video_init_segment_dispatched_:!(rr.has_video_||!rr.has_audio_)&&rr.audio_init_segment_dispatched_,dispatchVideoInitSegment(){let e=rr.video_metadata_.details,t={type:"video"};t.id=rr.video_track_.id,t.timescale=1e3,t.duration=rr.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;let i=t.frameRate.fps_den,r=t.frameRate.fps_num;if(t.refSampleDuration=i/r*1e3,t.codec=e.codec_mimetype,rr.video_metadata_.vps){ar.isHevc=!0;let e=rr.video_metadata_.vps.data.subarray(4),i=rr.video_metadata_.sps.data.subarray(4),r=rr.video_metadata_.pps.data.subarray(4);t.hvcc=$i({vps:e,sps:i,pps:r}),0==rr.video_init_segment_dispatched_&&ar.debugLog(rr.TAG_NAME,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.hvcc&&ar.decodeVideo(t.hvcc,0,!0,0)}else{let e=rr.video_metadata_.sps.data.subarray(4),i=rr.video_metadata_.pps.data.subarray(4);t.avcc=Ti({sps:e,pps:i}),0==rr.video_init_segment_dispatched_&&ar.debugLog(rr.TAG_NAME,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.avcc&&ar.decodeVideo(t.avcc,0,!0,0)}rr.video_init_segment_dispatched_=!0,rr.video_metadata_changed_=!1;let s=rr.media_info_;s.hasVideo=!0,s.width=t.codecWidth,s.height=t.codecHeight,s.fps=t.frameRate.fps,s.profile=t.profile,s.level=t.level,s.refFrames=e.ref_frames,s.chromaFormat=e.chroma_format_string,s.sarNum=t.sarRatio.width,s.sarDen=t.sarRatio.height,s.videoCodec=t.codec,s.hasAudio&&s.audioCodec?s.mimeType=`video/mp2t; codecs="${s.videoCodec},${s.audioCodec}"`:s.mimeType=`video/mp2t; codecs="${s.videoCodec}"`},dispatchVideoMediaSegment(){rr.isInitSegmentDispatched()&&rr.video_track_.length&&rr._preDoDecode()},dispatchAudioMediaSegment(){rr.isInitSegmentDispatched()&&rr.audio_track_.length&&rr._preDoDecode()},dispatchAudioVideoMediaSegment(){rr.isInitSegmentDispatched()&&(rr.audio_track_.length||rr.video_track_.length)&&rr._preDoDecode()},parseADTSAACPayload(e,t){if(rr.has_video_&&!rr.video_init_segment_dispatched_)return;if(rr.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+rr.aac_last_incomplete_data_.byteLength);t.set(rr.aac_last_incomplete_data_,0),t.set(e,rr.aac_last_incomplete_data_.byteLength),e=t}let i,r;if(null!=t&&(r=t/rr.timescale_),"aac"===rr.audio_metadata_.codec){if(null==t&&null!=rr.audio_last_sample_pts_)i=1024/rr.audio_metadata_.sampling_frequency*1e3,r=rr.audio_last_sample_pts_+i;else if(null==t)return void ar.debugWarn(rr.TAG_NAME,"AAC: Unknown pts");if(rr.aac_last_incomplete_data_&&rr.audio_last_sample_pts_){i=1024/rr.audio_metadata_.sampling_frequency*1e3;let e=rr.audio_last_sample_pts_+i;Math.abs(e-r)>1&&(ar.debugWarn(rr.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${r}ms`),r=e)}}let s,a=new jt(e),n=null,o=r;for(;null!=(n=a.readNextAACFrame());){i=1024/n.sampling_frequency*1e3;const e={codec:"aac",data:n};0==rr.audio_init_segment_dispatched_?(rr.audio_metadata_={codec:"aac",audio_object_type:n.audio_object_type,sampling_freq_index:n.sampling_freq_index,sampling_frequency:n.sampling_frequency,channel_config:n.channel_config},rr.dispatchAudioInitSegment(e)):rr.detectAudioMetadataChange(e)&&(rr.dispatchAudioMediaSegment(),rr.dispatchAudioInitSegment(e)),s=o;let t=Math.floor(o);const r=new Uint8Array(n.data.length+2);r.set([175,1],0),r.set(n.data,2);let a={payload:r,length:r.byteLength,pts:t,dts:t,type:re};rr.audio_track_.samples.push(a),rr.audio_track_.length+=r.byteLength,o+=i}a.hasIncompleteData()&&(rr.aac_last_incomplete_data_=a.getIncompleteData()),s&&(rr.audio_last_sample_pts_=s)},parseLOASAACPayload(e,t){if(rr.has_video_&&!rr.video_init_segment_dispatched_)return;if(rr.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+rr.aac_last_incomplete_data_.byteLength);t.set(rr.aac_last_incomplete_data_,0),t.set(e,rr.aac_last_incomplete_data_.byteLength),e=t}let i,r;if(null!=t&&(r=t/rr.timescale_),"aac"===rr.audio_metadata_.codec){if(null==t&&null!=rr.audio_last_sample_pts_)i=1024/rr.audio_metadata_.sampling_frequency*1e3,r=rr.audio_last_sample_pts_+i;else if(null==t)return void ar.debugWarn(rr.TAG_NAME,"AAC: Unknown pts");if(rr.aac_last_incomplete_data_&&rr.audio_last_sample_pts_){i=1024/rr.audio_metadata_.sampling_frequency*1e3;let e=rr.audio_last_sample_pts_+i;Math.abs(e-r)>1&&(ar.debugWarn(rr.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${r}ms`),r=e)}}let s,a=new Kt(e),n=null,o=r;for(;null!=(n=a.readNextAACFrame(si(this.loas_previous_frame)?void 0:this.loas_previous_frame));){rr.loas_previous_frame=n,i=1024/n.sampling_frequency*1e3;const e={codec:"aac",data:n};0==rr.audio_init_segment_dispatched_?(rr.audio_metadata_={codec:"aac",audio_object_type:n.audio_object_type,sampling_freq_index:n.sampling_freq_index,sampling_frequency:n.sampling_frequency,channel_config:n.channel_config},rr.dispatchAudioInitSegment(e)):rr.detectAudioMetadataChange(e)&&(rr.dispatchAudioMediaSegment(),rr.dispatchAudioInitSegment(e)),s=o;let t=Math.floor(o);const r=new Uint8Array(n.data.length+2);r.set([175,1],0),r.set(n.data,2);let a={payload:r,length:r.byteLength,pts:t,dts:t,type:re};rr.audio_track_.samples.push(a),rr.audio_track_.length+=r.byteLength,o+=i}a.hasIncompleteData()&&(rr.aac_last_incomplete_data_=a.getIncompleteData()),s&&(rr.audio_last_sample_pts_=s)},parseAC3Payload(e,t){},parseEAC3Payload(e,t){},parseOpusPayload(e,t){},parseMP3Payload(e,t){if(rr.has_video_&&!rr.video_init_segment_dispatched_)return;let i=[44100,48e3,32e3,0],r=[22050,24e3,16e3,0],s=[11025,12e3,8e3,0],a=e[1]>>>3&3,n=(6&e[1])>>1;e[2];let o=(12&e[2])>>>2,d=3!==(e[3]>>>6&3)?2:1,l=0,c=34;switch(a){case 0:l=s[o];break;case 2:l=r[o];break;case 3:l=i[o]}switch(n){case 1:c=34;break;case 2:c=33;break;case 3:c=32}const u={};u.object_type=c,u.sample_rate=l,u.channel_count=d,u.data=e;const h={codec:"mp3",data:u};0==rr.audio_init_segment_dispatched_?(rr.audio_metadata_={codec:"mp3",object_type:c,sample_rate:l,channel_count:d},rr.dispatchAudioInitSegment(h)):rr.detectAudioMetadataChange(h)&&(rr.dispatchAudioMediaSegment(),rr.dispatchAudioInitSegment(h));let f={payload:e,length:e.byteLength,pts:t/rr.timescale_,dts:t/rr.timescale_,type:re};rr.audio_track_.samples.push(f),rr.audio_track_.length+=e.byteLength},detectAudioMetadataChange(e){if(e.codec!==rr.audio_metadata_.codec)return ar.debugLog(rr.TAG_NAME,`Audio: Audio Codecs changed from ${rr.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===rr.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==rr.audio_metadata_.audio_object_type)return ar.debugLog(rr.TAG_NAME,`AAC: AudioObjectType changed from ${rr.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==rr.audio_metadata_.sampling_freq_index)return ar.debugLog(rr.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${rr.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==rr.audio_metadata_.channel_config)return ar.debugLog(rr.TAG_NAME,`AAC: Channel configuration changed from ${rr.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===rr.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==rr.audio_metadata_.sampling_frequency)return ar.debugLog(rr.TAG_NAME,`AC3: Sampling Frequency changed from ${rr.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==rr.audio_metadata_.bit_stream_identification)return ar.debugLog(rr.TAG_NAME,`AC3: Bit Stream Identification changed from ${rr.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==rr.audio_metadata_.bit_stream_mode)return ar.debugLog(rr.TAG_NAME,`AC3: BitStream Mode changed from ${rr.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==rr.audio_metadata_.channel_mode)return ar.debugLog(rr.TAG_NAME,`AC3: Channel Mode changed from ${rr.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==rr.audio_metadata_.low_frequency_effects_channel_on)return ar.debugLog(rr.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${rr.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===rr.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==rr.audio_metadata_.sample_rate)return ar.debugLog(rr.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${rr.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==rr.audio_metadata_.channel_count)return ar.debugLog(rr.TAG_NAME,`Opus: Channel count changed from ${rr.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===rr.audio_metadata_.codec){const t=e.data;if(t.object_type!==rr.audio_metadata_.object_type)return ar.debugLog(rr.TAG_NAME,`MP3: AudioObjectType changed from ${rr.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==rr.audio_metadata_.sample_rate)return ar.debugLog(rr.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${rr.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==rr.audio_metadata_.channel_count)return ar.debugLog(rr.TAG_NAME,`MP3: Channel count changed from ${rr.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1},dispatchAudioInitSegment(e){let t={type:"audio"};if(t.id=rr.audio_track_.id,t.timescale=1e3,t.duration=rr.duration_,"aac"===rr.audio_metadata_.codec){let i="aac"===e.codec?e.data:null,r=new zs(i);t.audioSampleRate=r.sampling_rate,t.audioSampleRateIndex=r.sampling_index,t.channelCount=r.channel_count,t.codec=r.codec_mimetype,t.originalCodec=r.original_codec_mimetype,t.config=r.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale;const s=Vt({profile:ar._opt.mseDecodeAudio?r.object_type:r.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});ar.decodeAudio(s,0)}else"ac-3"===rr.audio_metadata_.codec||"ec-3"===rr.audio_metadata_.codec||"opus"===rr.audio_metadata_.codec||"mp3"===rr.audio_metadata_.codec&&(t.audioSampleRate=rr.audio_metadata_.sample_rate,t.channelCount=rr.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==rr.audio_init_segment_dispatched_&&ar.debugLog(rr.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),rr.audio_init_segment_dispatched_=!0,rr.video_metadata_changed_=!1;let i=rr.media_info_;i.hasAudio=!0,i.audioCodec=t.originalCodec,i.audioSampleRate=t.audioSampleRate,i.audioChannelCount=t.channelCount,i.hasVideo&&i.videoCodec?i.mimeType=`video/mp2t; codecs="${i.videoCodec},${i.audioCodec}"`:i.mimeType=`video/mp2t; codecs="${i.audioCodec}"`},dispatchPESPrivateDataDescriptor(e,t,i){},parsePESPrivateDataPayload(e,t,i,r,s){let a=new Fs;if(a.pid=r,a.stream_id=s,a.len=e.byteLength,a.data=e,null!=t){let e=Math.floor(t/rr.timescale_);a.pts=e}else a.nearest_pts=rr.getNearestTimestampMilliseconds();if(null!=i){let e=Math.floor(i/rr.timescale_);a.dts=e}},parseTimedID3MetadataPayload(e,t,i,r,s){ar.debugLog(rr.TAG_NAME,`Timed ID3 Metadata: pid=${r}, pts=${t}, dts=${i}, stream_id=${s}`)},parseSynchronousKLVMetadataPayload(e,t,i,r,s){ar.debugLog(rr.TAG_NAME,`Synchronous KLV Metadata: pid=${r}, pts=${t}, dts=${i}, stream_id=${s}`)},parseAsynchronousKLVMetadataPayload(e,t,i){ar.debugLog(rr.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${i}`)},parseSMPTE2038MetadataPayload(e,t,i,r,s){ar.debugLog(rr.TAG_NAME,`SMPTE 2038 Metadata: pid=${r}, pts=${t}, dts=${i}, stream_id=${s}`)},getNearestTimestampMilliseconds(){if(null!=rr.audio_last_sample_pts_)return Math.floor(rr.audio_last_sample_pts_);if(null!=rr.last_pcr_){return Math.floor(rr.last_pcr_/300/rr.timescale_)}},_preDoDecode(){const e=rr.video_track_,t=rr.audio_track_;let i=e.samples;t.samples.length>0&&(i=e.samples.concat(t.samples),i=i.sort(((e,t)=>e.dts-t.dts))),i.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===se?rr._doDecodeVideo({...e,payload:t}):e.type===re&&rr._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0},_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?Yi(t,e.isIFrame):Ci(t,e.isIFrame),e.isIFrame&&ar.calcIframeIntervalTimestamp(e.dts);let r=ar.cryptoPayload(i,e.isIFrame);ar.decode(r,{type:se,ts:e.dts,isIFrame:e.isIFrame,cts:e.cts})},_doDecodeAudio(e){const t=new Uint8Array(e.payload);let i=t;pi(ar._opt.m7sCryptoAudio)&&(i=ar.cryptoPayloadAudio(t)),ar.decode(i,{type:re,ts:e.dts,isIFrame:!1,cts:0})}},sr=null;mi()&&(sr={TAG_NAME:"worker MediaSource",_resetInIt(){sr.isAvc=null,sr.isAAC=null,sr.videoInfo={},sr.videoMeta={},sr.audioMeta={},sr.sourceBuffer=null,sr.audioSourceBuffer=null,sr.hasInit=!1,sr.hasAudioInit=!1,sr.isAudioInitInfo=!1,sr.videoMimeType="",sr.audioMimeType="",sr.cacheTrack={},sr.cacheAudioTrack={},sr.timeInit=!1,sr.sequenceNumber=0,sr.audioSequenceNumber=0,sr.firstRenderTime=null,sr.firstAudioTime=null,sr.mediaSourceAppendBufferFull=!1,sr.mediaSourceAppendBufferError=!1,sr.mediaSourceAddSourceBufferError=!1,sr.mediaSourceBufferError=!1,sr.mediaSourceError=!1,sr.prevTimestamp=null,sr.decodeDiffTimestamp=null,sr.prevDts=null,sr.prevAudioDts=null,sr.prevPayloadBufferSize=0,sr.isWidthOrHeightChanged=!1,sr.prevTs=null,sr.prevAudioTs=null,sr.eventListenList=[],sr.pendingRemoveRanges=[],sr.pendingSegments=[],sr.pendingAudioRemoveRanges=[],sr.pendingAudioSegments=[],sr.supportVideoFrameCallbackHandle=null,sr.audioSourceBufferCheckTimeout=null,sr.audioSourceNoDataCheckTimeout=null,sr.hasPendingEos=!1,sr.$video={currentTime:0,readyState:0}},init(){sr.events=new cs,sr._resetInIt(),sr.mediaSource=new self.MediaSource,sr.isDecodeFirstIIframe=!!_i(ar._opt.checkFirstIFrame),sr._bindMediaSourceEvents()},destroy(){sr.stop(),sr._clearAudioSourceBufferCheckTimeout(),sr.eventListenList&&sr.eventListenList.length&&(sr.eventListenList.forEach((e=>e())),sr.eventListenList=[]),sr._resetInIt(),sr.mediaSource=null},getState:()=>sr.mediaSource&&sr.mediaSource.readyState,isStateOpen:()=>sr.getState()===mt,isStateClosed:()=>sr.getState()===gt,isStateEnded:()=>sr.getState()===_t,_bindMediaSourceEvents(){const{proxy:e}=sr.events,t=e(sr.mediaSource,bt,(()=>{ar.debugLog(sr.TAG_NAME,"sourceOpen"),sr._onMediaSourceSourceOpen()})),i=e(sr.mediaSource,yt,(()=>{ar.debugLog(sr.TAG_NAME,"sourceClose")})),r=e(sr.mediaSource,vt,(()=>{ar.debugLog(sr.TAG_NAME,"sourceended")}));sr.eventListenList.push(t,i,r)},_onMediaSourceSourceOpen(){sr.sourceBuffer||(ar.debugLog(sr.TAG_NAME,"onMediaSourceSourceOpen() sourceBuffer is null and next init"),sr._initSourceBuffer()),sr.audioSourceBuffer||(ar.debugLog(sr.TAG_NAME,"onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),sr._initAudioSourceBuffer()),sr._hasPendingSegments()&&sr._doAppendSegments()},decodeVideo(e,t,i,r){if(ar.isDestroyed)ar.debugWarn(sr.TAG_NAME,"decodeVideo() and decoder is destroyed");else if(_i(sr.hasInit))if(i&&e[1]===Bt){const r=15&e[0];if(r===Ie&&_i(ar._opt.supportMSEDecodeHevc))return void sr.emitError(Ce.mediaSourceH265NotSupport);sr.videoInfo.codec=r,postMessage({cmd:I,code:r});const s=new Uint8Array(e);postMessage({cmd:F,buffer:s,codecId:r},[s.buffer]),sr.hasInit=sr._decodeConfigurationRecord(e,t,i,r)}else ar.debugWarn(sr.TAG_NAME,`decodeVideo has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`);else if(!sr.isDecodeFirstIIframe&&i&&(sr.isDecodeFirstIIframe=!0),sr.isDecodeFirstIIframe){if(i&&0===e[1]){const t=15&e[0];let i={};if(t===De){i=xi(e.slice(5))}else t===Ie&&(i=Oi(e));const r=sr.videoInfo;r&&r.codecWidth&&r.codecWidth&&i&&i.codecWidth&&i.codecHeight&&(i.codecWidth!==r.codecWidth||i.codecHeight!==r.codecWidth)&&(ar.debugWarn(sr.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${r.codecWidth}, old height is ${r.codecHeight},\n new width is ${i.codecWidth}, new height is ${i.codecHeight},\n and emit change event`),sr.isWidthOrHeightChanged=!0,sr.emitError(Ce.mseWidthOrHeightChange,`width: ${r.codecWidth}->${i.codecWidth}, height: ${r.codecWidth}->${i.codecHeight}`))}if(sr.isWidthOrHeightChanged)return void ar.debugWarn(sr.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(fi(e))return void ar.debugLog(sr.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLengthsr.prevTs>0&&eS,_decodeConfigurationRecord(e,t,i,r){let s=e.slice(5),a={};if(r===De?a=xi(s):r===Ie&&(a=Hi(s)),sr.videoInfo.width=a.codecWidth,sr.videoInfo.height=a.codecHeight,0===a.codecWidth&&0===a.codecHeight)return ar.debugWarn(sr.TAG_NAME,"_decodeConfigurationRecord error",JSON.stringify(a)),sr.emitError(Ce.mediaSourceDecoderConfigurationError,`width is ${0===a.codecWidth} and height is ${a.codecHeight}`),!1;const n={id:Ct,type:"video",timescale:1e3,duration:0,avcc:s,codecWidth:a.codecWidth,codecHeight:a.codecHeight,videoType:a.videoType},o=us.generateInitSegment(n);sr.isAvc=r===De;let d=a.codec;return sr.videoMimeType=d?`video/mp4; codecs="${a.codec}"`:sr.isAvc?ft:pt,postMessage({cmd:x,w:a.codecWidth,h:a.codecHeight}),sr._initSourceBuffer(),sr.appendBuffer(o.buffer),sr.sequenceNumber=0,sr.cacheTrack={},sr.timeInit=!1,!0},_decodeAudioConfigurationRecord(e,t){const i=e[0]>>4,r=e[0]>>1&1,s=i===Ge,a=i===ze;if(_i(a||s))return ar.debugWarn(sr.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${i} ant auto wasm decode`),sr.emitError(Ce.mediaSourceAudioG711NotSupport),!1;const n={id:Lt,type:"audio",timescale:1e3};let o={};if($t(e)){if(o=qt(e.slice(2)),!o)return!1;n.audioSampleRate=o.sampleRate,n.channelCount=o.channelCount,n.config=o.config,n.refSampleDuration=1024/n.audioSampleRate*n.timescale}else{if(!s)return!1;if(o=vs(e),!o)return!1;n.audioSampleRate=o.samplingRate,n.channelCount=o.channelCount,n.refSampleDuration=1152/n.audioSampleRate*n.timescale}n.codec=o.codec,n.duration=0;let d="mp4",l=o.codec,c=null;s&&_i(ar._opt.isFirefox)?(d="mpeg",l="",c=new Uint8Array):c=us.generateInitSegment(n);let u=`${n.type}/${d}`;return l&&l.length>0&&(u+=`;codecs=${l}`),_i(sr.isAudioInitInfo)&&(Si=i===ze?r?16:8:0===r?8:16,postMessage({cmd:C,code:i}),postMessage({cmd:k,sampleRate:n.audioSampleRate,channels:n.channelCount,depth:Si}),sr.isAudioInitInfo=!0),sr.audioMimeType=u,sr.isAAC=a,sr._initAudioSourceBuffer(),sr.appendAudioBuffer(c.buffer),!0},_initSourceBuffer(){const{proxy:e}=sr.events;if(null===sr.sourceBuffer&&null!==sr.mediaSource&&sr.isStateOpen()&&sr.videoMimeType){try{ar.debugLog(sr.TAG_NAME,"_initSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",sr.videoMimeType),sr.sourceBuffer=sr.mediaSource.addSourceBuffer(sr.videoMimeType)}catch(e){return ar.debugError(sr.TAG_NAME,"_initSourceBuffer() appendBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),sr.emitError(Ce.mseWorkerAddSourceBufferError,e.code),void(sr.mediaSourceAddSourceBufferError=!0)}if(sr.sourceBuffer){const t=e(sr.sourceBuffer,"error",(e=>{sr.mediaSourceBufferError=!0,ar.debugError(sr.TAG_NAME,"mseSourceBufferError mseDecoder.sourceBuffer",e,e.toString()),sr.emitError(Ce.mseSourceBufferError,e.code)})),i=e(sr.sourceBuffer,"updateend",(()=>{sr._hasPendingRemoveRanges()?sr._doRemoveRanges():sr._hasPendingSegments()?sr._doAppendSegments():sr.hasPendingEos&&(ar.debugLog(sr.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),sr.endOfStream())}));sr.eventListenList.push(t,i)}}else ar.debugLog(sr.TAG_NAME,`_initSourceBuffer and mseDecoder.isStateOpen is ${sr.isStateOpen()} and mseDecoder.isAvc === null is ${null===sr.isAvc}`)},_initAudioSourceBuffer(){const{proxy:e}=sr.events;if(null===sr.audioSourceBuffer&&null!==sr.mediaSource&&sr.isStateOpen()&&sr.audioMimeType){try{ar.debugLog(sr.TAG_NAME,"_initAudioSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",sr.audioMimeType),sr._clearAudioSourceBufferCheckTimeout(),sr.audioSourceBuffer=sr.mediaSource.addSourceBuffer(sr.audioMimeType)}catch(e){return ar.debugError(sr.TAG_NAME,"_initAudioSourceBuffer() addSourceBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),sr.emitError(Ce.mseWorkerAddSourceBufferError,e.code),void(sr.mediaSourceAddSourceBufferError=!0)}if(sr.audioSourceBuffer){const t=e(sr.audioSourceBuffer,"error",(e=>{sr.mediaSourceBufferError=!0,ar.debugError(sr.TAG_NAME,"mseSourceBufferError mseDecoder.audioSourceBuffer",e.code,e.toString(),e),sr.emitError(Ce.mseSourceBufferError,e.code)})),i=e(sr.audioSourceBuffer,"updateend",(()=>{sr._hasPendingRemoveRanges()?sr._doRemoveRanges():sr._hasPendingSegments()?sr._doAppendSegments():sr.hasPendingEos&&(ar.debugLog(sr.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),sr.endOfStream())}));sr.eventListenList.push(t,i),null===sr.audioSourceNoDataCheckTimeout&&(sr.audioSourceNoDataCheckTimeout=setTimeout((()=>{sr._clearAudioNoDataCheckTimeout(),sr.emitError(Ce.mediaSourceAudioNoDataTimeout)}),1e3))}}else ar.debugLog(sr.TAG_NAME,`_initAudioSourceBuffer and mseDecoder.isStateOpen is ${sr.isStateOpen()} and mseDecoder.audioMimeType is ${sr.audioMimeType}`)},_decodeVideo(e,t,i,r,s){let a=e.slice(5),n=a.byteLength;if(0===n)return void ar.debugWarn(sr.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let o=(new Date).getTime(),d=!1;sr.prevTimestamp||(sr.prevTimestamp=o,d=!0);const l=o-sr.prevTimestamp;if(sr.decodeDiffTimestamp=l,l>1e3&&!d&&ar.isPlayer&&ar.debugLog(sr.TAG_NAME,`_decodeVideo now time is ${o} and prev time is ${sr.prevTimestamp}, diff time is ${l} ms`),sr.cacheTrack.id&&t>=sr.cacheTrack.dts){let e=8+sr.cacheTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(us.types.mdat,4),i.set(sr.cacheTrack.data,8),sr.cacheTrack.duration=t-sr.cacheTrack.dts;let r=us.moof(sr.cacheTrack,sr.cacheTrack.dts);sr.cacheTrack={};let s=new Uint8Array(r.byteLength+i.byteLength);s.set(r,0),s.set(i,r.byteLength),sr.appendBuffer(s.buffer)}else ar.debugLog(sr.TAG_NAME,`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${s} cacheTrack dts is ${sr.cacheTrack&&sr.cacheTrack.dts}`),sr.timeInit=!1,sr.cacheTrack={};sr.cacheTrack||(sr.cacheTrack={}),sr.cacheTrack.id=Ct,sr.cacheTrack.sequenceNumber=++sr.sequenceNumber,sr.cacheTrack.size=n,sr.cacheTrack.dts=t,sr.cacheTrack.cts=r,sr.cacheTrack.isKeyframe=i,sr.cacheTrack.data=a,sr.cacheTrack.flags={isLeading:0,dependsOn:i?2:1,isDependedOn:i?1:0,hasRedundancy:0,isNonSync:i?0:1},sr.prevTimestamp=(new Date).getTime()},_decodeAudio(e,t,i){let r=sr.isAAC?e.slice(2):e.slice(1),s=r.byteLength;if(sr.cacheAudioTrack.id&&t>=sr.cacheAudioTrack.dts){let e=8+sr.cacheAudioTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(us.types.mdat,4),i.set(sr.cacheAudioTrack.data,8),sr.cacheAudioTrack.duration=t-sr.cacheAudioTrack.dts;let r=us.moof(sr.cacheAudioTrack,sr.cacheAudioTrack.dts);sr.cacheAudioTrack={};let s=new Uint8Array(r.byteLength+i.byteLength);s.set(r,0),s.set(i,r.byteLength),sr.appendAudioBuffer(s.buffer)}else sr.cacheAudioTrack={};sr.cacheAudioTrack||(sr.cacheAudioTrack={}),sr.cacheAudioTrack.id=Lt,sr.cacheAudioTrack.sequenceNumber=++sr.audioSequenceNumber,sr.cacheAudioTrack.size=s,sr.cacheAudioTrack.dts=t,sr.cacheAudioTrack.cts=0,sr.cacheAudioTrack.data=r,sr.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}},appendBuffer(e){ar.isDestroyed?ar.debugWarn(sr.TAG_NAME,"appendBuffer() player is destroyed"):sr.mediaSourceAddSourceBufferError?ar.debugWarn(sr.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):sr.mediaSourceAppendBufferFull?ar.debugWarn(sr.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):sr.mediaSourceAppendBufferError?ar.debugWarn(sr.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):sr.mediaSourceBufferError?ar.debugWarn(sr.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(sr.pendingSegments.push(e),sr.sourceBuffer&&(ar._opt.mseAutoCleanupSourceBuffer&&sr._needCleanupSourceBuffer()&&sr._doCleanUpSourceBuffer(),_i(sr.getSourceBufferUpdating())&&sr.isStateOpen()&&_i(sr._hasPendingRemoveRanges()))?sr._doAppendSegments():sr.isStateClosed()?(sr.mediaSourceBufferError=!0,sr.emitError(Ce.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):sr.isStateEnded()&&(sr.mediaSourceBufferError=!0,sr.emitError(Ce.mseSourceBufferError,"mediaSource is end")))},appendAudioBuffer(e){ar.isDestroyed?ar.debugWarn(sr.TAG_NAME,"appendAudioBuffer() player is destroyed"):sr.mediaSourceAddSourceBufferError?ar.debugWarn(sr.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):sr.mediaSourceAppendBufferFull?ar.debugWarn(sr.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):sr.mediaSourceAppendBufferError?ar.debugWarn(sr.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):sr.mediaSourceBufferError?ar.debugWarn(sr.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(sr.pendingAudioSegments.push(e),sr.audioSourceBuffer&&(ar._opt.mseAutoCleanupSourceBuffer&&sr._needCleanupSourceBuffer()&&sr._doCleanUpSourceBuffer(),_i(sr.getAudioSourceBufferUpdating())&&sr.isStateOpen()&&_i(sr._hasPendingRemoveRanges()))?sr._doAppendSegments():sr.isStateClosed()?(sr.mediaSourceBufferError=!0,sr.emitError(Ce.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):sr.isStateEnded()&&(sr.mediaSourceBufferError=!0,sr.emitError(Ce.mseSourceBufferError,"mediaSource is end")))},getSourceBufferUpdating:()=>sr.sourceBuffer&&sr.sourceBuffer.updating,getAudioSourceBufferUpdating:()=>sr.audioSourceBuffer&&sr.audioSourceBuffer.updating,stop(){sr.abortSourceBuffer(),sr.removeSourceBuffer(),sr.endOfStream()},clearUpAllSourceBuffer(){if(sr.sourceBuffer){const e=sr.sourceBuffer.buffered;for(let t=0;tsr.pendingSegments.length>0||sr.pendingAudioSegments.length>0,getPendingSegmentsLength:()=>sr.pendingSegments.length,_handleUpdatePlaybackRate(){},_doAppendSegments(){if(sr.isStateClosed()||sr.isStateEnded())ar.debugLog(sr.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==sr.sourceBuffer){if(sr.needInitAudio()&&null===sr.audioSourceBuffer)return ar.debugLog(sr.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===sr.audioSourceBufferCheckTimeout&&(sr.audioSourceBufferCheckTimeout=setTimeout((()=>{sr._clearAudioSourceBufferCheckTimeout(),sr.emitError(Ce.mediaSourceAudioInitTimeout)}),1e3)));if(_i(sr.getSourceBufferUpdating())&&sr.pendingSegments.length>0){const e=sr.pendingSegments.shift();try{sr.sourceBuffer.appendBuffer(e)}catch(e){ar.debugError(sr.TAG_NAME,"mseDecoder.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(sr.stop(),sr.mediaSourceAppendBufferFull=!0,sr.emitError(Ce.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(sr.stop(),sr.mediaSourceAppendBufferError=!0,sr.emitError(Ce.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(sr.stop(),sr.mediaSourceBufferError=!0,sr.emitError(Ce.mseSourceBufferError,`code is ${e.code} , message is ${e.message}`))}}if(_i(sr.getAudioSourceBufferUpdating())&&sr.pendingAudioSegments.length>0){const e=sr.pendingAudioSegments.shift();try{sr.audioSourceBuffer.appendBuffer(e)}catch(e){ar.debugError(sr.TAG_NAME,"mseDecoder.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(sr.stop(),sr.mediaSourceAppendBufferFull=!0,sr.emitError(Ce.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(sr.stop(),sr.mediaSourceAppendBufferError=!0,sr.emitError(Ce.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(sr.stop(),sr.mediaSourceBufferError=!0,sr.emitError(Ce.mseSourceBufferError,e.code,`code is ${e.code} , message is ${e.message}`))}}}else ar.debugLog(sr.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")},_doCleanUpSourceBuffer(){const e=sr.$video.currentTime;if(sr.sourceBuffer){const t=sr.sourceBuffer.buffered;let i=!1;for(let r=0;r=ar._opt.mseAutoCleanupMaxBackwardDuration){i=!0;let t=e-ar._opt.mseAutoCleanupMinBackwardDuration;sr.pendingRemoveRanges.push({start:s,end:t})}}else a=ar._opt.mseAutoCleanupMaxBackwardDuration){i=!0;let t=e-ar._opt.mseAutoCleanupMinBackwardDuration;sr.pendingAudioRemoveRanges.push({start:s,end:t})}}else asr.pendingRemoveRanges.length>0||sr.pendingAudioRemoveRanges.length>0,needInitAudio:()=>ar._opt.hasAudio&&ar._opt.mseDecodeAudio,_doRemoveRanges(){if(sr.sourceBuffer&&_i(sr.getSourceBufferUpdating())){let e=sr.pendingRemoveRanges;for(;e.length&&_i(sr.getSourceBufferUpdating());){let t=e.shift();try{sr.sourceBuffer.remove(t.start,t.end)}catch(e){ar.debugWarn(sr.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e,e.toString())}}}if(sr.audioSourceBuffer&&_i(sr.getAudioSourceBufferUpdating())){let e=sr.pendingAudioRemoveRanges;for(;e.length&&_i(sr.getAudioSourceBufferUpdating());){let t=e.shift();try{sr.audioSourceBuffer.remove(t.start,t.end)}catch(e){ar.debugWarn(sr.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e,e.toString())}}}},_getPlaybackRate(){},_needCleanupSourceBuffer(){if(_i(ar._opt.mseAutoCleanupSourceBuffer))return!1;const e=sr.$video.currentTime;if(sr.sourceBuffer){let t=sr.sourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=ar._opt.mseAutoCleanupMaxBackwardDuration)return!0}if(sr.audioSourceBuffer){let t=sr.audioSourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=ar._opt.mseAutoCleanupMaxBackwardDuration)return!0}return!1},_clearAudioSourceBufferCheckTimeout(){sr.audioSourceBufferCheckTimeout&&(clearTimeout(sr.audioSourceBufferCheckTimeout),sr.audioSourceBufferCheckTimeout=null)},_clearAudioNoDataCheckTimeout(){sr.audioSourceNoDataCheckTimeout&&(clearTimeout(sr.audioSourceNoDataCheckTimeout),sr.audioSourceNoDataCheckTimeout=null)},getHandle:()=>sr.mediaSource.handle,emitError(e){postMessage({cmd:ie,value:e,msg:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""})}});let ar={isPlayer:!0,isHevc:null,isPlayback:!1,dropping:!1,isPushDropping:!1,isWorkerFetch:!1,isDestroyed:!1,fetchStatus:Et,_opt:Ni(),mp3Demuxer:null,delay:-1,pushLatestDelay:-1,firstTimestamp:null,startTimestamp:null,preDelayTimestamp:null,stopId:null,streamFps:null,streamAudioFps:null,streamVideoFps:null,writableStream:null,networkDelay:0,webglObj:null,startStreamRateAndStatsInterval:function(){ar.stopStreamRateAndStatsInterval(),l=setInterval((()=>{d&&d(0);const e=JSON.stringify({demuxBufferDelay:ar.getVideoBufferLength(),audioDemuxBufferDelay:ar.getAudioBufferLength(),streamBufferByteLength:ar.getStreamBufferLength(),netBuf:ar.networkDelay||0,pushLatestDelay:ar.pushLatestDelay||0,latestDelay:ar.delay,isStreamTsMoreThanLocal:Je,wasmDecodeDelay:Ke-Xe});postMessage({cmd:R,type:Ee,value:e})}),1e3)},stopStreamRateAndStatsInterval:function(){l&&(clearInterval(l),l=null)},useOffscreen:function(){return ar._opt.useOffscreen&&"undefined"!=typeof OffscreenCanvas},getDelay:function(e,t){if(!e||ar._opt.hasVideo&&!Ve)return-1;if(t===re)return ar.delay;if(ar.preDelayTimestamp&&ar.preDelayTimestamp>e)return ar.preDelayTimestamp-e>1e3&&ar.debugWarn("worker",`getDelay() and preDelayTimestamp is ${ar.preDelayTimestamp} > timestamp is ${e} more than ${ar.preDelayTimestamp-e}ms and return ${ar.delay}`),ar.preDelayTimestamp=e,ar.delay;if(ar.firstTimestamp){if(e){const t=Date.now()-ar.startTimestamp,i=e-ar.firstTimestamp;t>=i?(Je=!1,ar.delay=t-i):(Je=!0,ar.delay=i-t)}}else ar.firstTimestamp=e,ar.startTimestamp=Date.now(),ar.delay=-1;return ar.preDelayTimestamp=e,ar.delay},getDelayNotUpdateDelay:function(e,t){if(!e||ar._opt.hasVideo&&!Ve)return-1;if(t===re)return ar.pushLatestDelay;if(ar.preDelayTimestamp&&ar.preDelayTimestamp-e>1e3)return ar.debugWarn("worker",`getDelayNotUpdateDelay() and preDelayTimestamp is ${ar.preDelayTimestamp} > timestamp is ${e} more than ${ar.preDelayTimestamp-e}ms and return -1`),-1;if(ar.firstTimestamp){let t=-1;if(e){const i=Date.now()-ar.startTimestamp,r=e-ar.firstTimestamp;i>=r?(Je=!1,t=i-r):(Je=!0,t=r-i)}return t}return-1},resetDelay:function(){ar.firstTimestamp=null,ar.startTimestamp=null,ar.delay=-1,ar.dropping=!1},resetAllDelay:function(){ar.resetDelay(),ar.preDelayTimestamp=null},doDecode:function(e){ar._opt.isEmitSEI&&e.type===se&&ar.isWorkerFetch&&ar.findSei(e.payload,e.ts),ar.isPlayUseMSEAndDecoderInWorker()?e.type===re?ar._opt.mseDecodeAudio?sr.decodeAudio(e.payload,e.ts):e.decoder.decode(e.payload,e.ts):e.type===se&&sr.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):ar._opt.useWCS&&ar.useOffscreen()&&e.type===se&&a.decode?a.decode(e.payload,e.ts,e.cts):e.decoder.decode(e.payload,e.ts,e.isIFrame,e.cts)},decodeNext(e){if(0===r.length)return;const t=e.ts,s=r[0],a=e.type===se&&fi(e.payload);if(_i(i))a&&(ar.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${s.type} ts is ${s.ts}\n isVideoSqeHeader is ${a}`),r.shift(),ar.doDecode(s));else{const i=s.ts-t,n=s.type===re&&e.type===se;(i<=20||n||a)&&(ar.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${s.type} ts is ${s.ts}\n diff is ${i} and isVideoAndNextAudio is ${n} and isVideoSqeHeader is ${a}`),r.shift(),ar.doDecode(s))}},init:function(){ar.debugLog("worker","init and opt is",JSON.stringify(ar._opt));const e=ar._opt.playType===m,t=ar._opt.playType===g;if(er.init(),ar.isPlayer=e,ar.isPlayback=t,ar.isPlayUseMSEAndDecoderInWorker()&&sr&&sr.init(),a&&ar._opt.useWCS&&ar.useOffscreen()&&a.init(),_i(ar.isPlaybackCacheBeforeDecodeForFpsRender())){ar.debugLog("worker","setInterval()");const t=()=>{const t=ar._opt.videoBuffer+ar._opt.videoBufferDelay;let i=null;if(r.length){if(ar.isPushDropping)return void ar.debugWarn("worker",`loop() isPushDropping is true and bufferList length is ${r.length}`);if(ar.dropping){for(i=r.shift(),ar.debugWarn("worker",`loop() dropBuffer is dropping and isIFrame ${i.isIFrame} and delay is ${ar.delay} and bufferlist is ${r.length}`);!i.isIFrame&&r.length;)i=r.shift();const e=ar.getDelayNotUpdateDelay(i.ts,i.type);i.isIFrame&&e<=ar.getNotDroppingDelayTs()&&(ar.debugLog("worker","loop() is dropping = false, is iFrame"),ar.dropping=!1,ar.doDecode(i),ar.decodeNext(i))}else if(ar.isPlayback||ar.isPlayUseMSE()||0===ar._opt.videoBuffer)for(;r.length;)i=r.shift(),ar.doDecode(i);else if(i=r[0],-1===ar.getDelay(i.ts,i.type))ar.debugLog("worker","loop() common dumex delay is -1 ,data.ts is",i.ts),r.shift(),ar.doDecode(i),ar.decodeNext(i);else if(ar.delay>t&&e)ar.hasIframeInBufferList()?(ar.debugLog("worker",`delay is ${ar.delay} > maxDelay ${t}, set dropping is true`),ar.resetAllDelay(),ar.dropping=!0,postMessage({cmd:G})):(r.shift(),ar.doDecode(i),ar.decodeNext(i));else for(;r.length;){if(i=r[0],!(ar.getDelay(i.ts,i.type)>ar._opt.videoBuffer)){ar.delay<0&&ar.debugWarn("worker",`loop() do not decode and delay is ${ar.delay}, bufferList is ${r.length}`);break}r.shift(),ar.doDecode(i)}}else-1!==ar.delay&&ar.debugLog("worker","loop() bufferList is empty and reset delay"),ar.resetAllDelay()};ar.stopId=setInterval((()=>{let e=(new Date).getTime();et||(et=e);const i=e-et;i>100&&ar.debugWarn("worker",`loop demux diff time is ${i}`),t(),et=(new Date).getTime()}),20)}else ar.debugLog("worker","playback and playbackIsCacheBeforeDecodeForFpsRender is true");if(_i(ar._opt.checkFirstIFrame)&&(Ve=!0),ar.isPlayUseMSEAndDecoderInWorker()&&sr){const e=sr.getHandle();e&&postMessage({cmd:ee,mseHandle:e},[e])}},playbackCacheLoop:function(){ar.clearPlaybackCacheLoop();const e=()=>{let e=null;r.length&&(e=r.shift(),ar.doDecode(e))};e();const t=Math.ceil(1e3/(ar.streamFps*ar._opt.playbackRate));ar.debugLog("worker",`playbackCacheLoop fragDuration is ${t}, streamFps is ${ar.streamFps}, streamAudioFps is ${ar.streamAudioFps} ,streamVideoFps is ${ar.streamVideoFps} playbackRate is ${ar._opt.playbackRate}`),ar.stopId=setInterval(e,t)},clearPlaybackCacheLoop:function(){ar.stopId&&(clearInterval(ar.stopId),ar.stopId=null)},startPlaybackCacheLoop:function(){ar.playbackCacheLoop()},close:function(){if(ar.debugLog("worker","close"),ar.isDestroyed=!0,Vi(),!o||1!==o.readyState&&2!==o.readyState?o&&ar.debugLog("worker",`close() and socket.readyState is ${o.readyState}`):(Ui=!0,o.close(1e3,"Client disconnecting")),o=null,ar.stopStreamRateAndStatsInterval(),ar.stopId&&(clearInterval(ar.stopId),ar.stopId=null),ar.mp3Demuxer&&(ar.mp3Demuxer.destroy(),ar.mp3Demuxer=null),ar.writableStream&&_i(ar.writableStream.locked)&&ar.writableStream.close().catch((e=>{ar.debugLog("worker","close() and writableStream.close() error",e.toString(),e)})),ar.writableStream=null,nr)try{nr.clear&&nr.clear(),nr=null}catch(e){ar.debugLog("worker","close() and audioDecoder.clear error",e.toString(),e)}if(or)try{or.clear&&or.clear(),or=null}catch(e){ar.debugLog("worker","close() and videoDecoder.clear error",e.toString())}d=null,et=null,Je=!1,Ke=0,Xe=0,a&&(a.destroy&&a.destroy(),a=null),sr&&(sr.destroy(),sr=null),ar.firstTimestamp=null,ar.startTimestamp=null,ar.networkDelay=0,ar.streamFps=null,ar.streamAudioFps=null,ar.streamVideoFps=null,ar.delay=-1,ar.pushLatestDelay=-1,ar.preDelayTimestamp=null,ar.dropping=!1,ar.isPushDropping=!1,ar.isPlayer=!0,ar.isPlayback=!1,ar.isWorkerFetch=!1,ar.isHevc=null,ar._opt=Ni(),ar.webglObj&&(ar.webglObj.destroy(),ar.offscreenCanvas.removeEventListener("webglcontextlost",ar.onOffscreenCanvasWebglContextLost),ar.offscreenCanvas.removeEventListener("webglcontextrestored",ar.onOffscreenCanvasWebglContextRestored),ar.offscreenCanvas=null,ar.offscreenCanvasGL=null,ar.offscreenCanvasCtx=null),r=[],s=[],c&&(c.close(),c=null),v=null,B=null,be=!1,ve=!1,Ve=!1,ii=!1,yi=!1,bi=!1,vi=null,wt=[],Rt=0,Nt=0,dt=null,St=null,Gt=null,Ot=null,Si=null,Yt=0,Xt=0,Ut=null,zt=null,ar.fetchStatus=Et,Ri=!0,er.destroy(),tr.destroy(),ir.destroy(),rr.destroy(),ar.debug=null,ar._opt={},postMessage({cmd:Y})},pushBuffer:function(e,t){if(t.type===re&&$t(e)){if(ar.debugLog("worker",`pushBuffer audio ts is ${t.ts}, isAacCodecPacket is true`),ar._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:X,buffer:t},[t.buffer])}ar.decodeAudio(e,t.ts)}else if(t.type===se&&t.isIFrame&&fi(e)){if(ar.debugLog("worker",`pushBuffer video ts is ${t.ts}, isVideoSequenceHeader is true`),ar._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:Z,buffer:t},[t.buffer])}ar.decodeVideo(e,t.ts,t.isIFrame,t.cts)}else{if(ar._opt.isRecording)if(ar._opt.isRecordTypeFlv){const i=new Uint8Array(e);postMessage({cmd:J,type:t.type,buffer:i,ts:t.ts},[i.buffer])}else if(ar._opt.recordType===y)if(t.type===se){const i=new Uint8Array(e).slice(5);postMessage({cmd:P,buffer:i,isIFrame:t.isIFrame,ts:t.ts,cts:t.cts},[i.buffer])}else if(t.type===re&&ar._opt.isWasmMp4){const i=new Uint8Array(e),r=Wt(i)?i.slice(2):i.slice(1);postMessage({cmd:L,buffer:r,ts:t.ts},[r.buffer])}if(ar.isPlayer){if(t.type===se){if(Yt>0){const e=t.ts-Ot,i=Yt+Yt/2;e>i&&ar.debugLog("worker",`pushBuffer video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts}, preTs is ${Ot},\n diff is ${e} and preTsDuration is ${Yt} and maxDiff is ${i}\n maybe trigger black screen or flower screen\n `)}if(null!==Ot&&Ot>=t.ts&&(ar.debugWarn("worker",`pushBuffer() and isIFrame is ${t.isIFrame} and,\n options.ts is ${t.ts} less than (or equal) preTs is ${Ot} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${Xt}`),Ot-t.ts>S&&(ar.debugWarn("worker",`pushBuffer,\n preTimestamp is ${Ot}, options.ts is ${t.ts},\n diff is ${Ot-t.ts} more than 3600000,\n and resetAllDelay`),ar.resetAllDelay(),Ot=null,Yt=0),ar._opt.isDropSameTimestampGop&&_i(t.isIFrame)&&Ve)){const e=ar.hasIframeInBufferList(),t=_i(ar.isPushDropping);return ar.debugLog("worker",`pushBuffer, isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next dropBuffer`),void(e&&t?ar.dropBuffer$2():(ar.clearBuffer(!0),pi(ar._opt.checkFirstIFrame)&&pi(i)&&(ar.isPlayUseMSEAndDecoderInWorker()?sr.isDecodeFirstIIframe=!1:postMessage({cmd:Q}))))}Ot>0&&(Yt=t.ts-Ot),Xt=e.byteLength,Ot=t.ts}if(Ve){const e=ar._opt.videoBuffer+ar._opt.videoBufferDelay,i=ar.getDelayNotUpdateDelay(t.ts,t.type);ar.pushLatestDelay=i,ar.delay>0&&i>e&&ar.delay({type:e.type,ts:e.ts})));ar.debugLog("worker",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${r.length}, and ts list is ${JSON.stringify(i)}`)}const i=ar.getAudioBufferLength()>0,s=i?60:40;r.length>=s&&(ar.debugWarn("worker",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${r.length} more than ${s}, and hasAudio is ${i} an set streamFps is 25`),ar.streamVideoFps=25,postMessage({cmd:H,value:ar.streamVideoFps}),i?(ar.streamAudioFps=25,ar.streamFps=ar.streamVideoFps+ar.streamAudioFps):ar.streamFps=ar.streamVideoFps,ar.playbackCacheLoop())}}},getVideoBufferLength(){let e=0;return r.forEach((t=>{t.type===se&&(e+=1)})),e},hasIframeInBufferList:()=>r.some((e=>e.type===se&&e.isIFrame)),isAllIframeInBufferList(){const e=ar.getVideoBufferLength();let t=0;return r.forEach((e=>{e.type===se&&e.isIFrame&&(t+=1)})),e===t},getNotDroppingDelayTs:()=>ar._opt.videoBuffer+ar._opt.videoBufferDelay/2,getAudioBufferLength(){let e=0;return r.forEach((t=>{t.type===re&&(e+=1)})),e},getStreamBufferLength(){let e=0;return c&&c.buffer&&(e=c.buffer.byteLength),ar._opt.isNakedFlow?er.lastBuf&&(e=er.lastBuf.byteLength):ar._opt.isTs?rr._remainingPacketData&&(e=rr._remainingPacketData.byteLength):ar._opt.isFmp4&&tr.mp4Box&&(e=tr.mp4Box.getAllocatedSampleDataSize()),e},fetchStream:function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(ar.debugLog("worker","fetchStream, url is "+e,"options:",JSON.stringify(t)),ar.isWorkerFetch=!0,t.isFlv?ar._opt.isFlv=!0:t.isFmp4?ar._opt.isFmp4=!0:t.isMpeg4?ar._opt.isMpeg4=!0:t.isNakedFlow?ar._opt.isNakedFlow=!0:t.isTs&&(ar._opt.isTs=!0),d=ri((e=>{postMessage({cmd:R,type:we,value:e})})),ar.startStreamRateAndStatsInterval(),t.isFmp4&&(tr.listenMp4Box(),ar._opt.isFmp4Private&&tr.initTransportDescarmber()),t.protocol===f){t.isFlv&&(c=new wi(ar.demuxFlv())),n=new AbortController;const i=Object.assign({signal:n.signal},{headers:t.options&&t.options.headers||{}});fetch(e,i).then((e=>{if(pi(Ui))return ar.debugLog("worker","request abort and run res.body.cancel()"),ar.fetchStatus=Et,void e.body.cancel();if(!ui(e))return ar.debugWarn("worker",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),Vi(),void postMessage({cmd:R,type:Ce.fetchError,value:`fetch response status is ${e.status} and ok is ${e.ok}`});if(postMessage({cmd:R,type:xe}),di())ar.writableStream=new WritableStream({write:e=>n&&n.signal&&n.signal.aborted?(ar.debugLog("worker","writableStream write() and abortController.signal.aborted is true so return"),void(ar.fetchStatus=kt)):pi(Ui)?(ar.debugLog("worker","writableStream write() and requestAbort is true so return"),ar.fetchStatus=kt,void Vi()):void("string"!=typeof e?(ar.fetchStatus=Tt,d(e.byteLength),t.isFlv?c.write(e):t.isFmp4?ar.demuxFmp4(e):t.isMpeg4?ar.demuxMpeg4(e):t.isTs?ar.demuxTs(e):t.isNakedFlow&&ar.demuxNakedFlow(e)):ar.debugWarn("worker",`writableStream write() and value is "${e}" string so return`)),close:()=>{ar.debugLog("worker","writableStream close()"),ar.fetchStatus=kt,c&&(c.close(),c=null),Vi(),postMessage({cmd:R,type:Se,value:p,msg:"fetch done"})},abort:e=>{if(n&&n.signal&&n.signal.aborted)return ar.debugLog("worker","writableStream abort() and abortController.signal.aborted is true so return"),void(ar.fetchStatus=kt);c&&(c.close(),c=null),e.name!==At?(ar.debugLog("worker",`writableStream abort() and e is ${e.toString()}`),Vi(),postMessage({cmd:R,type:Ce.fetchError,value:e.toString()})):ar.debugLog("worker","writableStream abort() and e.name is AbortError so return")}}),e.body.pipeTo(ar.writableStream).catch((e=>{"AbortError"!==e.name&&ar.debugLog("worker","writableStream pipeTo() and e is",e.name,e.toString())}));else{const i=e.body.getReader(),r=()=>{i.read().then((e=>{let{done:i,value:s}=e;return i?(ar.debugLog("worker","fetchNext().then() and done is true"),ar.fetchStatus=kt,c&&(c.close(),c=null),Vi(),void postMessage({cmd:R,type:Se,value:p,msg:"fetch done"})):n&&n.signal&&n.signal.aborted?(ar.debugLog("worker","fetchNext().then() and abortController.signal.aborted is true so return"),void(ar.fetchStatus=kt)):pi(Ui)?(ar.debugLog("worker","fetchNext().then() and requestAbort is true so return"),ar.fetchStatus=kt,void Vi()):void("string"!=typeof s?(ar.fetchStatus=Tt,d(s.byteLength),t.isFlv?c.write(s):t.isFmp4?ar.demuxFmp4(s):t.isMpeg4?ar.demuxMpeg4(s):t.isTs?ar.demuxTs(s):t.isNakedFlow&&ar.demuxNakedFlow(s),r()):ar.debugWarn("worker",`fetchNext().then() and value "${s}" is string so return`))})).catch((e=>{if(n&&n.signal&&n.signal.aborted)return ar.debugLog("worker","fetchNext().catch() and abortController.signal.aborted is true so return"),void(ar.fetchStatus=kt);c&&(c.close(),c=null),e.name!==At?(ar.debugLog("worker",`fetchNext().catch() and e is ${e.toString()}`),Vi(),postMessage({cmd:R,type:Ce.fetchError,value:e.toString()})):ar.debugLog("worker","fetchNext().catch() and e.name is AbortError so return")}))};r()}})).catch((e=>{n&&n.signal&&n.signal.aborted?ar.debugLog("worker","fetch().catch() and abortController.signal.aborted is true so return"):e.name!==At?(ar.debugLog("worker",`fetch().catch() and e is ${e.toString()}`),Vi(),postMessage({cmd:R,type:Ce.fetchError,value:e.toString()}),c&&(c.close(),c=null)):ar.debugLog("worker","fetch().catch() and e.name is AbortError so return")}))}else t.protocol===h&&(t.isFlv&&(c=new wi(ar.demuxFlv())),o=new WebSocket(e,i),o.binaryType="arraybuffer",o.onopen=()=>{ar.debugLog("worker","fetchStream, WebsocketStream socket open"),postMessage({cmd:R,type:xe}),postMessage({cmd:R,type:ke})},o.onclose=e=>{ar.isDestroyed?ar.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} and isDestroyed is true, so return`):b?ar.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} but isSocketError is true , so return`):(ar.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code}`),1006===e.code&&ar.debugError("worker",`fetchStream, WebsocketStream socket close abnormally and code is ${e.code}`),pi(Ui)?ar.debugLog("worker","fetchStream, WebsocketStream socket close and requestAbort is true so return"):(c&&(c.close(),c=null),postMessage({cmd:R,type:Se,value:_,msg:e.code})))},o.onerror=e=>{ar.debugError("worker","fetchStream, WebsocketStream socket error",e,e.toString()),b=!0,c&&(c.close(),c=null),ar.isDestroyed?ar.debugLog("worker","fetchStream, WebsocketStream on error and isDestroyed is true, so return"):postMessage({cmd:R,type:Ce.websocketError,value:e.isTrusted?"websocket user aborted":"websocket error"})},o.onmessage=e=>{"string"!=typeof e.data?(d(e.data.byteLength),t.isFlv?c.write(e.data):t.isFmp4?ar.demuxFmp4(e.data):t.isMpeg4?ar.demuxMpeg4(e.data):ar._opt.isNakedFlow?ar.demuxNakedFlow(e.data):ar.demuxM7s(e.data)):ar.debugWarn("worker",`socket on message is string "${e.data}" and return`)})},demuxFlv:function*(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),i=new Uint32Array(e);for(;;){t[3]=0;const e=yield 15,r=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const s=i[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let a=i[0];const n=(yield s).slice();switch(r){case ae:if(n.byteLength>0){let e=n;pi(ar._opt.m7sCryptoAudio)&&(e=ar.cryptoPayloadAudio(n)),ar.decode(e,{type:re,ts:a})}else ar.debugWarn("worker",`demuxFlv() type is audio and payload.byteLength is ${n.byteLength} and return`);break;case ne:if(n.byteLength>=6){const e=n[0];if(ar._isEnhancedH265Header(e))ar._decodeEnhancedH265Video(n,a);else{const e=15&n[0];let t=n[0]>>4===xt;const r=e===Ie;if(_i(t)&&pi(gi(n,r))&&(ar.debugLog("worker","demux() isIFrame is false and unit type is IDR and update to true"),t=!0),t&&fi(n)&&null===ar.isHevc){const e=15&n[0];ar.isHevc=e===Ie,vi=Qt(n,ar.isHevc),ar.debugLog("worker",`demuxFlv() isVideoSequenceHeader is true and isHevc is ${ar.isHevc} and nalUnitSize is ${vi}`)}t&&ar.calcIframeIntervalTimestamp(a),ar.isPlayer&&ar.calcNetworkDelay(a),i[0]=n[4],i[1]=n[3],i[2]=n[2],i[3]=0;let s=i[0],o=ar.cryptoPayload(n,t);ar.decode(o,{type:se,ts:a,isIFrame:t,cts:s})}}else ar.debugWarn("worker",`demuxFlv() type is video and payload.byteLength is ${n.byteLength} and return`);break;case oe:postMessage({cmd:K,buffer:n},[n.buffer]);break;default:ar.debugLog("worker",`demuxFlv() type is ${r}`)}}},decode:function(e,t){t.type===re?ar._opt.hasAudio&&(postMessage({cmd:R,type:Ae,value:e.byteLength}),ar.isPlayer?ar.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts}):ar.isPlayback&&(ar.isPlaybackOnlyDecodeIFrame()||(ar.isPlaybackCacheBeforeDecodeForFpsRender(),ar.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts})))):t.type===se&&ar._opt.hasVideo&&(postMessage({cmd:R,type:Be,value:e.byteLength}),postMessage({cmd:R,type:Ue,value:t.ts}),ar.isPlayer?ar.pushBuffer(e,{type:t.type,ts:t.ts,isIFrame:t.isIFrame,cts:t.cts}):ar.isPlayback&&(ar.isPlaybackOnlyDecodeIFrame()?t.isIFrame&&ar.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}):(ar.isPlaybackCacheBeforeDecodeForFpsRender(),ar.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}))))},cryptoPayload:function(e,t){let i=e;return ar._opt.isM7sCrypto?ar._opt.cryptoIV&&ar._opt.cryptoIV.byteLength>0&&ar._opt.cryptoKey&&ar._opt.cryptoKey.byteLength>0?i=Pr(e,ar._opt.cryptoKey,ar._opt.cryptoIV,ar.isHevc):ar.debugError("worker",`isM7sCrypto cryptoKey.length is ${ar._opt.cryptoKey&&ar._opt.cryptoKey.byteLength} or cryptoIV.length is ${ar._opt.cryptoIV&&ar._opt.cryptoIV.byteLength} null`):ar._opt.isSm4Crypto?ar._opt.sm4CryptoKey?i=ar._opt.cryptoIV&&ar._opt.cryptoIV.byteLength>0&&ar._opt.cryptoKey&&ar._opt.cryptoKey.byteLength>0?Zs(e,ar._opt.cryptoKey,ar._opt.cryptoIV,ar.isHevc,ar._opt.isSm4CryptoH265V2):rs(e,ar._opt.sm4CryptoKey,ar.isHevc,ar._opt.isSm4CryptoH265V2):ar._opt.sm4CryptoKey||ar.debugError("worker","isSm4Crypto opt.sm4CryptoKey is null"):ar._opt.isXorCrypto&&(ar._opt.cryptoIV&&ar._opt.cryptoIV.byteLength>0&&ar._opt.cryptoKey&&ar._opt.cryptoKey.byteLength>0?i=ds(e,ar._opt.cryptoKey,ar._opt.cryptoIV,ar.isHevc):ar.debugError("worker",`isXorCrypto cryptoKey.length is ${ar._opt.cryptoKey&&ar._opt.cryptoKey.byteLength} or cryptoIV.length is ${ar._opt.cryptoIV&&ar._opt.cryptoIV.byteLength} null`)),i},cryptoPayloadAudio:function(e){let t=e;if(ar._opt.isM7sCrypto)if(ar._opt.cryptoIV&&ar._opt.cryptoIV.byteLength>0&&ar._opt.cryptoKey&&ar._opt.cryptoKey.byteLength>0){e[0]>>4===ze&&(t=Mr(e,ar._opt.cryptoKey,ar._opt.cryptoIV))}else ar.debugError("worker",`isM7sCrypto cryptoKey.length is ${ar._opt.cryptoKey&&ar._opt.cryptoKey.byteLength} or cryptoIV.length is ${ar._opt.cryptoIV&&ar._opt.cryptoIV.byteLength} null`);return t},setCodecAudio:function(e,t){const i=e[0]>>4,r=e[0]>>1&1;if(Si=i===ze?r?16:8:0===r?8:16,nr&&nr.setCodec)if($t(e)||i===Re||i===Ne||i===Ge){ar.debugLog("worker",`setCodecAudio: init audio codec, codeId is ${i} _opt.sampleRate is ${ar._opt.sampleRate}`);const r=i===ze?e.slice(2):new Uint8Array(0);nr.setCodec(i,ar._opt.sampleRate,r),i===ze&&postMessage({cmd:D,buffer:r},[r.buffer]),ve=!0,i!==ze&&(i===Ge?(ar.mp3Demuxer||(ar.mp3Demuxer=new as(ar),ar.mp3Demuxer.on("data",((e,t)=>{nr.decode(e,t)}))),ar.mp3Demuxer.dispatch(e.slice(1),t)):nr.decode(e.slice(1),t));{const e=Number("1")||1;setTimeout((()=>{ar.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),ar.close(),postMessage({cmd:O})}),60*e*60*1e3)}}else ar.debugWarn("worker","setCodecAudio: hasInitAudioCodec is false, codecId is ",i);else ar.debugError("worker","setCodecAudio: audioDecoder or audioDecoder.setCodec is null")},decodeAudio:function(e,t){if(ar.isDestroyed)ar.debugLog("worker","decodeAudio, decoder is destroyed and return");else if(ar.isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio())sr.decodeAudio(e,t);else if(pi(i)&&pi(ar._opt.mseDecodeAudio))postMessage({cmd:z,payload:e,ts:t,cts:t},[e.buffer]);else{const i=e[0]>>4;if(ve){if($t(e))return void ar.debugLog("worker","decodeAudio and has already initialized and payload is aac codec packet so drop this frame");i===Ge?ar.mp3Demuxer.dispatch(e.slice(1),t):nr.decode(i===ze?e.slice(2):e.slice(1),t)}else ar.setCodecAudio(e,t)}},setCodecVideo:function(e,t){const i=15&e[0];if(or&&or.setCodec)if(fi(e))if(i===De||i===Ie){ar.debugLog("worker",`setCodecVideo: init video codec , codecId is ${i}`);const t=e.slice(5);if(i===De&&ar._opt.useSIMD){const e=xi(t);if(e.codecWidth>w||e.codecHeight>w)return postMessage({cmd:W,value:`width: ${e.codecWidth} > 4080, height: ${e.codecHeight} > 4080`}),void ar.debugWarn("worker",`setCodecVideo: SIMD H264 decode video width is too large, width is ${e.codecWidth}, height is ${e.codecHeight}`)}const r=new Uint8Array(e);be=!0,or.setCodec(i,t),postMessage({cmd:I,code:i}),postMessage({cmd:F,buffer:r,codecId:i},[r.buffer])}else ar.debugWarn("worker",`setCodecVideo: hasInitVideoCodec is false, codecId is ${i} is not H264 or H265`);else ar.debugWarn("worker",`decodeVideo: hasInitVideoCodec is false, codecId is ${i} and isIFrame is ${t} and packetType is ${e[1]}`);else ar.debugError("worker","setCodecVideo: videoDecoder or videoDecoder.setCodec is null")},decodeVideo:function(e,t,r){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(ar.isDestroyed)ar.debugLog("worker","decodeVideo, decoder is destroyed and return");else if(ar.isPlayUseMSEAndDecoderInWorker())sr.decodeVideo(e,t,r,s);else if(pi(i))postMessage({cmd:M,payload:e,isIFrame:r,ts:t,cts:s,delay:ar.delay},[e.buffer]);else if(be)if(!Ve&&r&&(Ve=!0),Ve){if(r&&fi(e)){const t=15&e[0];let i={};if(t===De){i=xi(e.slice(5))}else t===Ie&&(i=Oi(e));i.codecWidth&&i.codecHeight&&v&&B&&(i.codecWidth!==v||i.codecHeight!==B)&&(ar.debugWarn("worker",`\n decodeVideo: video width or height is changed,\n old width is ${v}, old height is ${B},\n new width is ${i.codecWidth}, new height is ${i.codecHeight},\n and emit change event`),yi=!0,postMessage({cmd:V,value:`width: ${v}->${i.codecWidth}, height: ${B}->${i.codecHeight}`}))}if(yi)return void ar.debugWarn("worker","decodeVideo: video width or height is changed, and return");if(bi)return void ar.debugWarn("worker","decodeVideo: simd decode error, and return");if(fi(e))return void ar.debugLog("worker","decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength0&&void 0!==arguments[0]&&arguments[0];ar.debugLog("worker",`clearBuffer,bufferList length is ${r.length}, need clear is ${e}`),e&&(r=[]),ar.isPlayer&&(ar.resetAllDelay(),pi(ar._opt.checkFirstIFrame)&&(ar.dropping=!0,postMessage({cmd:G}))),pi(ar._opt.checkFirstIFrame)&&_i(i)&&(Ve=!1)},dropBuffer$2:function(){if(r.length>0){let e=r.findIndex((e=>pi(e.isIFrame)&&e.type===se));if(ar.isAllIframeInBufferList())for(let t=0;t=ar.getNotDroppingDelayTs()){ar.debugLog("worker",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${s} and notDroppingDelayTs is ${ar.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){ar.isPushDropping=!0,postMessage({cmd:G});const t=r.length;r=r.slice(e);const i=r.shift();ar.resetAllDelay(),ar.getDelay(i.ts,i.type),ar.doDecode(i),ar.isPushDropping=!1,ar.debugLog("worker",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,new bufferList is ${r.length} and new delay is ${ar.delay} `)}else ar.isPushDropping=!1}0===r.length&&(ar.isPushDropping=!1)},demuxM7s:function(e){const t=new DataView(e),i=t.getUint32(1,!1),r=t.getUint8(0),s=new ArrayBuffer(4),a=new Uint32Array(s);switch(r){case re:ar.decode(new Uint8Array(e,5),{type:re,ts:i});break;case se:if(t.byteLength>=11){const r=new Uint8Array(e,5),s=r[0];if(ar._isEnhancedH265Header(s))ar._decodeEnhancedH265Video(r,i);else{const e=t.getUint8(5)>>4==1;if(e&&(ar.calcIframeIntervalTimestamp(i),fi(r)&&null===ar.isHevc)){const e=15&r[0];ar.isHevc=e===Ie}ar.isPlayer&&ar.calcNetworkDelay(i),a[0]=r[4],a[1]=r[3],a[2]=r[2],a[3]=0;let s=a[0],n=ar.cryptoPayload(r,e);ar.decode(n,{type:se,ts:i,isIFrame:e,cts:s})}}else ar.debugWarn("worker",`demuxM7s() type is video and arrayBuffer length is ${e.byteLength} and return`)}},demuxNakedFlow:function(e){er.dispatch(e)},demuxFmp4:function(e){tr.dispatch(e)},demuxMpeg4:function(e){ir.dispatch(e)},demuxTs:function(e){rr.dispatch(e)},_decodeEnhancedH265Video:function(e,t){const i=e[0],r=48&i,s=15&i,a=e.slice(1,5),n=new ArrayBuffer(4),o=new Uint32Array(n),d="a"==String.fromCharCode(a[0]);if(ar.isHevc=_i(d),s===It){if(r===Mt){const i=e.slice(5);if(d);else{const r=new Uint8Array(5+i.length);r.set([28,0,0,0,0],0),r.set(i,5),vi=Qt(e,ar.isHevc),ar.debugLog("worker",`demuxFlv() isVideoSequenceHeader(enhancedH265) is true and isHevc is ${ar.isHevc} and nalUnitSize is ${vi}`),ar.decode(r,{type:se,ts:t,isIFrame:!0,cts:0})}}}else if(s===Ft){let i=e,s=0;const a=r===Mt;if(a&&ar.calcIframeIntervalTimestamp(t),d);else{o[0]=e[4],o[1]=e[3],o[2]=e[2],o[3]=0,s=o[0];i=Yi(e.slice(8),a),i=ar.cryptoPayload(i,a),ar.decode(i,{type:se,ts:t,isIFrame:a,cts:s})}}else if(s===Pt){const i=r===Mt;i&&ar.calcIframeIntervalTimestamp(t);let s=Yi(e.slice(5),i);s=ar.cryptoPayload(s,i),ar.decode(s,{type:se,ts:t,isIFrame:i,cts:0})}},_isEnhancedH265Header:function(e){return(e&Dt)===Dt},findSei:function(e,t){let i=4;ai(vi)&&(i=vi);Zt(e.slice(5),i).forEach((e=>{const i=ar.isHevc?e[0]>>>1&63:31&e[0];(ar.isHevc&&(i===ct||i===lt)||_i(ar.isHevc)&&i===Ye)&&postMessage({cmd:j,buffer:e,ts:t},[e.buffer])}))},calcNetworkDelay:function(e){if(!(Ve&&e>0))return;null===dt?(dt=e,St=ei()):et?i-t:0;ar.networkDelay=r,r>ar._opt.networkDelay&&ar._opt.playType===m&&(ar.debugWarn("worker",`calcNetworkDelay now dts:${e}, start dts is ${dt} vs start is ${t},local diff is ${i} ,delay is ${r}`),postMessage({cmd:R,type:Te,value:r}))},calcIframeIntervalTimestamp:function(e){null===Gt?Gt=e:Gt=ar._opt.playbackForwardMaxRateDecodeIFrame&&!(ar._opt.useMSE&&ar._opt.mseDecodeAudio)},isPlayUseMSE:function(){return ar.isPlayer&&ar._opt.useMSE&&pi(i)},isPlayUseMSEAndDecoderInWorker:function(){return ar.isPlayUseMSE()&&ar._opt.mseDecoderUseWorker},isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio:function(){return ar.isPlayUseMSEAndDecoderInWorker()&&ar._opt.mseDecodeAudio},playbackUpdatePlaybackRate:function(){_i(ar.isPlaybackCacheBeforeDecodeForFpsRender())&&ar.clearBuffer(!0)},onOffscreenCanvasWebglContextLost:function(e){ar.debugError("worker","handleOffscreenCanvasWebglContextLost and next try to create webgl"),e.preventDefault(),ii=!0,ar.webglObj.destroy(),ar.webglObj=null,ar.offscreenCanvasGL=null,setTimeout((()=>{ar.offscreenCanvasGL=ar.offscreenCanvas.getContext("webgl"),ar.offscreenCanvasGL&&ar.offscreenCanvasGL.getContextAttributes().stencil?(ar.webglObj=u(ar.offscreenCanvasGL,ar._opt.openWebglAlignment),ii=!1):ar.debugError("worker","handleOffscreenCanvasWebglContextLost, stencil is false")}),500)},onOffscreenCanvasWebglContextRestored:function(e){ar.debugLog("worker","handleOffscreenCanvasWebglContextRestored"),e.preventDefault()},videoInfo:function(e,t,i){postMessage({cmd:I,code:e}),postMessage({cmd:x,w:t,h:i}),v=t,B=i,ar.useOffscreen()&&(ar.offscreenCanvas=new OffscreenCanvas(t,i),ar.offscreenCanvasGL=ar.offscreenCanvas.getContext("webgl"),ar.webglObj=u(ar.offscreenCanvasGL,ar._opt.openWebglAlignment),ar.offscreenCanvas.addEventListener("webglcontextlost",ar.onOffscreenCanvasWebglContextLost,!1),ar.offscreenCanvas.addEventListener("webglcontextrestored",ar.onOffscreenCanvasWebglContextRestored,!1))},audioInfo:function(e,t,i){postMessage({cmd:C,code:e}),postMessage({cmd:k,sampleRate:t,channels:i,depth:Si}),Nt=i},yuvData:function(t,i){if(ar.isDestroyed)return void ar.debugLog("worker","yuvData, decoder is destroyed and return");const r=v*B*3/2;let s=e.HEAPU8.subarray(t,t+r),a=new Uint8Array(s);if(Ut=null,Xe=i,ar.useOffscreen())try{if(ii)return;ar.webglObj.renderYUV(v,B,a);let e=ar.offscreenCanvas.transferToImageBitmap();postMessage({cmd:E,buffer:e,delay:ar.delay,ts:i},[e])}catch(e){ar.debugError("worker","yuvData, transferToImageBitmap error is",e,e.toString())}else postMessage({cmd:E,output:a,delay:ar.delay,ts:i},[a.buffer])},pcmData:function(e,i,r){if(ar.isDestroyed)return void ar.debugLog("worker","pcmData, decoder is destroyed and return");let a=i,n=[],o=0,d=ar._opt.audioBufferSize;for(let i=0;i<2;i++){let r=t.HEAPU32[(e>>2)+i]>>2;n[i]=t.HEAPF32.subarray(r,r+a)}if(Rt){if(!(a>=(i=d-Rt)))return Rt+=a,s[0]=Float32Array.of(...s[0],...n[0]),void(2==Nt&&(s[1]=Float32Array.of(...s[1],...n[1])));wt[0]=Float32Array.of(...s[0],...n[0].subarray(0,i)),2==Nt&&(wt[1]=Float32Array.of(...s[1],...n[1].subarray(0,i))),postMessage({cmd:T,buffer:wt,ts:r},wt.map((e=>e.buffer))),o=i,a-=i}for(Rt=a;Rt>=d;Rt-=d)wt[0]=n[0].slice(o,o+=d),2==Nt&&(wt[1]=n[1].slice(o-d,o)),postMessage({cmd:T,buffer:wt,ts:r},wt.map((e=>e.buffer)));Rt&&(s[0]=n[0].slice(o),2==Nt&&(s[1]=n[1].slice(o))),n=[]},errorInfo:function(e){null===Ut&&(Ut=ei());const t=ei(),i=ti(zt>0?2*zt:5e3,1e3,5e3),r=t-Ut;r>i&&(ar.debugWarn("worker",`errorInfo() emit simdDecodeError and\n iframeIntervalTimestamp is ${zt} and diff is ${r} and maxDiff is ${i}\n and replay`),bi=!0,postMessage({cmd:$}))},sendWebsocketMessage:function(e){o?o.readyState===Le?o.send(e):ar.debugError("worker","socket is not open"):ar.debugError("worker","socket is null")},timeEnd:function(){ar.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),ar.close(),postMessage({cmd:O})},postStreamToMain(e,t){postMessage({cmd:q,type:t,buffer:e},[e.buffer])},updatePlaybackIsPause(e){ar.debugLog("worker",`updatePlaybackIsPause, isPause is ${e}`),pi(e)?ar.clearPlaybackCacheLoop():ar.startPlaybackCacheLoop()},debugLog(e){if(ar._opt.debug&&ar.debug){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r{t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);const i=function(){const t=_(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),i=_(e.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),r=e.createProgram();if(e.attachShader(r,t),e.attachShader(r,i),e.linkProgram(r),!e.getProgramParameter(r,e.LINK_STATUS))return console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(r)),null;return r}();let r={program:i,attribLocations:{vertexPosition:e.getAttribLocation(i,"aVertexPosition"),texturePosition:e.getAttribLocation(i,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(i,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(i,"uModelMatrix"),viewMatrix:e.getUniformLocation(i,"uViewMatrix"),rgbatexture:e.getUniformLocation(i,"rgbaTexture"),ytexture:e.getUniformLocation(i,"yTexture"),utexture:e.getUniformLocation(i,"uTexture"),vtexture:e.getUniformLocation(i,"vTexture"),isyuv:e.getUniformLocation(i,"isyuv")}},a=function(){const t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),e.STATIC_DRAW);var i=[];i=i.concat([0,1],[1,1],[1,0],[0,0]);const r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array(i),e.STATIC_DRAW);const s=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,s);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,texPosition:r,indices:s}}(),d=p(),u=p(),h=p(),f=p();function p(){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function _(t,i){const r=e.createShader(t);return e.shaderSource(r,i),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(console.log("An error occurred compiling the shaders: "+e.getShaderInfoLog(r)),e.deleteShader(r),null)}function m(t,i){e.viewport(0,0,t,i),e.clearColor(0,0,0,0),e.clearDepth(1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);const d=n();l(d,-1,1,-1,1,.1,100);const p=n();o(p);const _=n();!function(e,t,i,r){var a,n,d,l,c,u,h,f,p,_,m=t[0],g=t[1],y=t[2],b=r[0],v=r[1],S=r[2],w=i[0],A=i[1],B=i[2];Math.abs(m-w)32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let i=e-this._current_word_bits_left;this._fillCurrentWord();let r=Math.min(i,this._current_word_bits_left),s=this._current_word>>>32-r;return this._current_word<<=r,this._current_word_bits_left-=r,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Ot=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Ht=Ot,Vt=Ot;function $t(e){let{profile:t,sampleRate:i,channel:r}=e;return new Uint8Array([175,0,t<<3|(14&i)>>1,(1&i)<<7|r<<3])}function Wt(e){return Yt(e)&&e[1]===Bt}function Yt(e){return e[0]>>4===ze}const qt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function jt(e){let t=new Uint8Array(e),i=null,r=0,s=0,a=0,n=null;if(r=s=t[0]>>>3,a=(7&t[0])<<1|t[1]>>>7,a<0||a>=qt.length)return void console.error("Flv: AAC invalid sampling frequency index!");let o=qt[a],d=(120&t[1])>>>3;if(d<0||d>=8)return void console.log("Flv: AAC invalid channel configuration");5===r&&(n=(7&t[1])<<1|t[2]>>>7,t[2]);let l=zt.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?a>=6?(r=5,i=new Array(4),n=a-3):(r=2,i=new Array(2),n=a):-1!==l.indexOf("android")?(r=2,i=new Array(2),n=a):(r=5,n=a,i=new Array(4),a>=6?n=a-3:1===d&&(r=2,i=new Array(2),n=a)),i[0]=r<<3,i[0]|=(15&a)>>>1,i[1]=(15&a)<<7,i[1]|=(15&d)<<3,5===r&&(i[1]|=(15&n)>>>1,i[2]=(1&n)<<7,i[2]|=8,i[3]=0),{audioType:"aac",config:i,sampleRate:o,channelCount:d,objectType:r,codec:"mp4a.40."+r,originalCodec:"mp4a.40."+s}}class Kt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,i=this.data_;for(;;){if(t+7>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(4095===(i[t+0]<<8|i[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let i=this.current_syncword_offset_,r=(8&e[i+1])>>>3,s=(6&e[i+1])>>>1,a=1&e[i+1],n=(192&e[i+2])>>>6,o=(60&e[i+2])>>>2,d=(1&e[i+2])<<2|(192&e[i+3])>>>6,l=(3&e[i+3])<<11|e[i+4]<<3|(224&e[i+5])>>>5;if(e[i+6],i+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let c=1===a?7:9,u=l-c;i+=c;let h=this.findNextSyncwordOffset(i+u);if(this.current_syncword_offset_=h,0!==r&&1!==r||0!==s)continue;let f=e.subarray(i,i+u);t={},t.audio_object_type=n+1,t.sampling_freq_index=o,t.sampling_frequency=Ht[o],t.channel_config=d,t.data=f}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Xt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,i=this.data_;for(;;){if(t+1>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(695===(i[t+0]<<3|i[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),i=0;for(let r=0;r<=t;r++)i<<=8,i|=e.readByte();return i}readNextAACFrame(e){let t=this.data_,i=null;for(;null==i&&!this.eof_flag_;){let r=this.current_syncword_offset_,s=(31&t[r+1])<<8|t[r+2];if(r+3+s>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let a=new Gt(t.subarray(r+3,r+3+s)),n=null;if(a.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(r+3+s),a.destroy();continue}n=e}else{let e=a.readBool();if(e&&a.readBool()){console.error("audioMuxVersionA is Not Supported"),a.destroy();break}if(e&&this.getLATMValue(a),!a.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),a.destroy();break}if(0!==a.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),a.destroy();break}if(0!==a.readBits(4)){console.error("more than 2 numProgram Not Supported"),a.destroy();break}if(0!==a.readBits(3)){console.error("more than 2 numLayer Not Supported"),a.destroy();break}let t=e?this.getLATMValue(a):0,i=a.readBits(5);t-=5;let r=a.readBits(4);t-=4;let s=a.readBits(4);t-=4,a.readBits(3),t-=3,t>0&&a.readBits(t);let o=a.readBits(3);if(0!==o){console.error(`frameLengthType = ${o}. Only frameLengthType = 0 Supported`),a.destroy();break}a.readByte();let d=a.readBool();if(d)if(e)this.getLATMValue(a);else{let e=0;for(;;){e<<=8;let t=a.readBool();if(e+=a.readByte(),!t)break}console.log(e)}a.readBool()&&a.readByte(),n={},n.audio_object_type=i,n.sampling_freq_index=r,n.sampling_frequency=Ht[n.sampling_freq_index],n.channel_config=s,n.other_data_present=d}let o=0;for(;;){let e=a.readByte();if(o+=e,255!==e)break}let d=new Uint8Array(o);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function Jt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return[];const i=e.length,r=[];let s,a=0;for(;a+t>>=8),a+=t,s){if(a+s>i)break;r.push(e.subarray(a,a+s)),a+=s}return r}function Qt(e){const t=e.byteLength,i=new Uint8Array(4);i[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t;const r=new Uint8Array(t+4);return r.set(i,0),r.set(e,4),r}function ei(e,t){let i=null;return t?e.length>=28&&(i=1+(3&e[26])):e.length>=12&&(i=1+(3&e[9])),i}function ti(){return(new Date).getTime()}function ii(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}function ri(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function si(e){let t=0,i=ri();return r=>{if(s=r,"[object Number]"!==Object.prototype.toString.call(s))return;var s;t+=r;const a=ri(),n=a-i;n>=1e3&&(e(t/n*1e3),i=a,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();function ai(e){return null==e}function ni(e){return!ai(e)}function oi(e){return"function"==typeof e}function di(e){let t=null,i=31&e[0];return i!==Oe&&i!==He||(t=Pe),t||(i=(126&e[0])>>1,i!==it&&i!==st&&i!==nt||(t=Me)),t}function li(){return"undefined"!=typeof WritableStream}function ci(e){e.close()}function ui(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let i=e[0],r=null,s=1;if(e.length>0){let t=e[1];t&&t.ts-i.ts>1e5&&(i=t,s=2)}if(i)for(let a=s;a=1e3){e[a-1].ts-i.ts<1e3&&(r=a+1)}}}return r}function hi(e){return e.ok&&e.status>=200&&e.status<=299}function fi(){return function(e){let t="";if("object"==typeof e)try{t=JSON.stringify(e),t=JSON.parse(t)}catch(i){t=e}else t=e;return t}(B)}function pi(e){return e[0]>>4===Ut&&e[1]===Bt}function _i(e){return!0===e||"true"===e}function mi(e){return!0!==e&&"true"!==e}function gi(){return!!(zt.Worker&&zt.MediaSource&&"canConstructInDedicatedWorker"in zt.MediaSource&&!0===zt.MediaSource.canConstructInDedicatedWorker)}function yi(e,t){const i=Jt(e.slice(5));let r=!1;return i.forEach((e=>{const i=t?e[0]>>>1&63:31&e[0];(t&&(i===Xe||i===Je||i===et)||mi(t)&&i===Ve)&&(r=!0)})),r}var bi=function(e,t,i,r){return new(i||(i=Promise))((function(s,a){function n(e){try{d(r.next(e))}catch(e){a(e)}}function o(e){try{d(r.throw(e))}catch(e){a(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(n,o)}d((r=r.apply(e,t||[])).next())}))};const vi=Symbol(32),Si=Symbol(16),wi=Symbol(8);class Ai{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return bi(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,i)=>{var r;this.reject=i,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(r=this.pull)||void 0===r||r.call(this,e)}))}))}readU32(){return this.read(vi)}readU16(){return this.read(Si)}readU8(){return this.read(wi)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let i=0;const r=e=>t.length<(i=e);if("number"==typeof this.need){if(r(this.need))return;e=t.subarray(0,i)}else if(this.need===vi){if(r(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Si){if(r(2))return;e=t[0]<<8|t[1]}else if(this.need===wi){if(r(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(r(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,i)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(r(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,i)),e=this.need}return this.consumed+=i,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,i=t+e;if(i<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,i);else{const e=new Uint8Array(i);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,i)}return this.buffer=new Uint8Array(e),this.buffer}}Ai.U32=vi,Ai.U16=Si,Ai.U8=wi;class Bi{constructor(e){this.log=function(t){if(e._opt.debugLevel==b){const a=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;s1?i-1:0),s=1;s1?r-1:0),a=1;a=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(r[s]=t[e],s++);return new Uint8Array(r.buffer,0,s)}static parseSPS(e){let t=Ui._ebsp2rbsp(e),i=new Gt(t);i.readByte();let r=i.readByte();i.readByte();let s=i.readByte();i.readUEG();let a=Ui.getProfileString(r),n=Ui.getLevelString(s),o=1,d=420,l=[0,420,422,444],c=8;if((100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r||138===r||144===r)&&(o=i.readUEG(),3===o&&i.readBits(1),o<=3&&(d=l[o]),c=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool())){let e=3!==o?8:12;for(let t=0;t0&&e<16?(v=t[e-1],S=r[e-1]):255===e&&(v=i.readByte()<<8|i.readByte(),S=i.readByte()<<8|i.readByte())}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool()&&i.readBits(24)),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool()){let e=i.readBits(32),t=i.readBits(32);A=i.readBool(),B=t,U=2*e,w=B/U}}let x=1;1===v&&1===S||(x=v/S);let E=0,T=0;if(0===o)E=1,T=2-_;else{E=3===o?1:2,T=(1===o?2:1)*(2-_)}let k=16*(f+1),C=16*(p+1)*(2-_);k-=(m+g)*E,C-=(y+b)*T;let L=Math.ceil(k*x);return i.destroy(),i=null,{profile_string:a,level_string:n,bit_depth:c,ref_frames:h,chroma_format:d,chroma_format_string:Ui.getChromaFormatString(d),frame_rate:{fixed:A,fps:w,fps_den:U,fps_num:B},sar_ratio:{width:v,height:S},codec_size:{width:k,height:C},present_size:{width:L,height:C}}}static parseSPS$2(e){let t=e.subarray(1,4),i="avc1.";for(let e=0;e<3;e++){let r=t[e].toString(16);r.length<2&&(r="0"+r),i+=r}let r=Ui._ebsp2rbsp(e),s=new Gt(r);s.readByte();let a=s.readByte();s.readByte();let n=s.readByte();s.readUEG();let o=Ui.getProfileString(a),d=Ui.getLevelString(n),l=1,c=420,u=[0,420,422,444],h=8,f=8;if((100===a||110===a||122===a||244===a||44===a||83===a||86===a||118===a||128===a||138===a||144===a)&&(l=s.readUEG(),3===l&&s.readBits(1),l<=3&&(c=u[l]),h=s.readUEG()+8,f=s.readUEG()+8,s.readBits(1),s.readBool())){let e=3!==l?8:12;for(let t=0;t0&&e<16?(A=t[e-1],B=i[e-1]):255===e&&(A=s.readByte()<<8|s.readByte(),B=s.readByte()<<8|s.readByte())}if(s.readBool()&&s.readBool(),s.readBool()&&(s.readBits(4),s.readBool()&&s.readBits(24)),s.readBool()&&(s.readUEG(),s.readUEG()),s.readBool()){let e=s.readBits(32),t=s.readBits(32);x=s.readBool(),E=t,T=2*e,U=E/T}}let k=1;1===A&&1===B||(k=A/B);let C=0,L=0;if(0===l)C=1,L=2-y;else{C=3===l?1:2,L=(1===l?2:1)*(2-y)}let D=16*(m+1),I=16*(g+1)*(2-y);D-=(b+v)*C,I-=(S+w)*L;let F=Math.ceil(D*k);return s.destroy(),s=null,{codec_mimetype:i,profile_idc:a,level_idc:n,profile_string:o,level_string:d,chroma_format_idc:l,bit_depth:h,bit_depth_luma:h,bit_depth_chroma:f,ref_frames:_,chroma_format:c,chroma_format_string:Ui.getChromaFormatString(c),frame_rate:{fixed:x,fps:U,fps_den:T,fps_num:E},sar_ratio:{width:A,height:B},codec_size:{width:D,height:I},present_size:{width:F,height:I}}}static _skipScalingList(e,t){let i=8,r=8,s=0;for(let a=0;a=this.buflen)return this.iserro=!0,0;this.iserro=!1,i=this.bufoff+e>8?8-this.bufoff:e,t<<=i,t+=this.buffer[this.bufpos]>>8-this.bufoff-i&255>>8-i,this.bufoff+=i,e-=i,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,i=this.bufoff,r=this.read(e);return this.bufpos=t,this.bufoff=i,r}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),r=new Uint8Array(e+4);r.set(i,0),r.set(t.sps,4),t.sps=r}if(t.pps){const e=t.pps.byteLength,i=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),r=new Uint8Array(e+4);r.set(i,0),r.set(t.pps,4),t.pps=r}return t}function Ti(e){let{sps:t,pps:i}=e;const r=[23,0,0,0,0,1,66,0,30,255];r[0]=23,r[6]=t[1],r[7]=t[2],r[8]=t[3],r[10]=225,r[11]=t.byteLength>>8&255,r[12]=255&t.byteLength,r.push(...t,1,i.byteLength>>8&255,255&i.byteLength,...i);return new Uint8Array(r)}function ki(e){let{sps:t,pps:i}=e,r=8+t.byteLength+1+2+i.byteLength,s=!1;const a=Ui.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(s=!0,r+=4);let n=new Uint8Array(r);n[0]=1,n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=255,n[5]=225;let o=t.byteLength;n[6]=o>>>8,n[7]=255&o;let d=8;n.set(t,8),d+=o,n[d]=1;let l=i.byteLength;n[d+1]=l>>>8,n[d+2]=255&l,n.set(i,d+3),d+=3+l,s&&(n[d]=252|a.chroma_format_idc,n[d+1]=248|a.bit_depth_luma-8,n[d+2]=248|a.bit_depth_chroma-8,n[d+3]=0,d+=4);const c=[23,0,0,0,0],u=new Uint8Array(c.length+n.byteLength);return u.set(c,0),u.set(n,c.length),u}function Ci(e,t){let i=[];i[0]=t?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=e.byteLength>>24&255,i[6]=e.byteLength>>16&255,i[7]=e.byteLength>>8&255,i[8]=255&e.byteLength;const r=new Uint8Array(i.length+e.byteLength);return r.set(i,0),r.set(e,i.length),r}function Li(e,t){let i=[];i[0]=t?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0;const r=new Uint8Array(i.length+e.byteLength);return r.set(i,0),r.set(e,i.length),r}function Di(e){return 31&e[0]}function Ii(e){return e===Ye}function Fi(e){return!function(e){return e===Oe||e===He}(e)&&!Ii(e)}function Pi(e){return e===Ve}function Mi(e){if(0===e.length)return!1;const t=Di(e[0]);for(let i=1;i=i.byteLength)return this.eofFlag=!0,i.byteLength;let e=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],r=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===e||1===r)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let i=this.currentStartcodeOffset;i+=1===(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3;let r=31&e[i],s=(128&e[i])>>>7,a=this.findNextStartCodeOffset(i);this.currentStartcodeOffset=a,r>=Ke||0===s&&(t={type:r,data:e.subarray(i,a)})}return t}}class Ri{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Ni=e=>{let t=e,i=t.byteLength,r=new Uint8Array(i),s=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(r[s]=t[e],s++);return new Uint8Array(r.buffer,0,s)},Gi=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Oi{static _ebsp2rbsp(e){let t=e,i=t.byteLength,r=new Uint8Array(i),s=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(r[s]=t[e],s++);return new Uint8Array(r.buffer,0,s)}static parseVPS(e){let t=Oi._ebsp2rbsp(e),i=new Gt(t);return i.readByte(),i.readByte(),i.readBits(4),i.readBits(2),i.readBits(6),{num_temporal_layers:i.readBits(3)+1,temporal_id_nested:i.readBool()}}static parseSPS(e){let t=Oi._ebsp2rbsp(e),i=new Gt(t);i.readByte(),i.readByte();let r=0,s=0,a=0,n=0;i.readBits(4);let o=i.readBits(3);i.readBool();let d=i.readBits(2),l=i.readBool(),c=i.readBits(5),u=i.readByte(),h=i.readByte(),f=i.readByte(),p=i.readByte(),_=i.readByte(),m=i.readByte(),g=i.readByte(),y=i.readByte(),b=i.readByte(),v=i.readByte(),S=i.readByte(),w=[],A=[];for(let e=0;e0)for(let e=o;e<8;e++)i.readBits(2);for(let e=0;e1&&i.readSEG();for(let e=0;e0&&e<=16?(F=t[e-1],P=r[e-1]):255===e&&(F=i.readBits(16),P=i.readBits(16))}if(i.readBool()&&i.readBool(),i.readBool()){i.readBits(3),i.readBool(),i.readBool()&&(i.readByte(),i.readByte(),i.readByte())}if(i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool(),i.readBool(),i.readBool(),D=i.readBool(),D&&(i.readUEG(),i.readUEG(),i.readUEG(),i.readUEG()),i.readBool()){if(z=i.readBits(32),R=i.readBits(32),i.readBool()&&i.readUEG(),i.readBool()){let e=!1,t=!1,r=!1;e=i.readBool(),t=i.readBool(),(e||t)&&(r=i.readBool(),r&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),r&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(let s=0;s<=o;s++){let s=i.readBool();M=s;let a=!0,n=1;s||(a=i.readBool());let o=!1;if(a?i.readUEG():o=i.readBool(),o||(n=i.readUEG()+1),e){for(let e=0;e>6&3,i.general_tier_flag=e[1]>>5&1,i.general_profile_idc=31&e[1],i.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],i.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],i.general_constraint_indicator_flags=i.general_constraint_indicator_flags<<16|e[10]<<8|e[11],i.general_level_idc=e[12],i.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],i.parallelismType=3&e[15],i.chromaFormat=3&e[16],i.bitDepthLumaMinus8=7&e[17],i.bitDepthChromaMinus8=7&e[18],i.avgFrameRate=e[19]<<8|e[20],i.constantFrameRate=e[21]>>6&3,i.numTemporalLayers=e[21]>>3&7,i.temporalIdNested=e[21]>>2&1,i.lengthSizeMinusOne=3&e[21];let r=e[22],s=e.slice(23);for(let e=0;e0)for(let t=i;t<8;t++)e.read(2);r.sub_layer_profile_space=[],r.sub_layer_tier_flag=[],r.sub_layer_profile_idc=[],r.sub_layer_profile_compatibility_flag=[],r.sub_layer_progressive_source_flag=[],r.sub_layer_interlaced_source_flag=[],r.sub_layer_non_packed_constraint_flag=[],r.sub_layer_frame_only_constraint_flag=[],r.sub_layer_level_idc=[];for(let t=0;t{let t=Ni(e),i=new Gt(t);return i.readByte(),i.readByte(),i.readBits(4),i.readBits(2),i.readBits(6),{num_temporal_layers:i.readBits(3)+1,temporal_id_nested:i.readBool()}})(t),n=(e=>{let t=Ni(e),i=new Gt(t);i.readByte(),i.readByte();let r=0,s=0,a=0,n=0;i.readBits(4);let o=i.readBits(3);i.readBool();let d=i.readBits(2),l=i.readBool(),c=i.readBits(5),u=i.readByte(),h=i.readByte(),f=i.readByte(),p=i.readByte(),_=i.readByte(),m=i.readByte(),g=i.readByte(),y=i.readByte(),b=i.readByte(),v=i.readByte(),S=i.readByte(),w=[],A=[];for(let e=0;e0)for(let e=o;e<8;e++)i.readBits(2);for(let e=0;e1&&i.readSEG();for(let e=0;e0&&e<16?(F=t[e-1],P=r[e-1]):255===e&&(F=i.readBits(16),P=i.readBits(16))}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(3),i.readBool(),i.readBool()&&(i.readByte(),i.readByte(),i.readByte())),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool(),i.readBool(),i.readBool(),D=i.readBool(),D&&(r+=i.readUEG(),s+=i.readUEG(),a+=i.readUEG(),n+=i.readUEG()),i.readBool()&&(z=i.readBits(32),R=i.readBits(32),i.readBool()&&(i.readUEG(),i.readBool()))){let e=!1,t=!1,r=!1;e=i.readBool(),t=i.readBool(),(e||t)&&(r=i.readBool(),r&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),r&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(let s=0;s<=o;s++){let s=i.readBool();M=s;let a=!1,n=1;s||(a=i.readBool());let o=!1;if(a?i.readSEG():o=i.readBool(),o||(cpbcnt=i.readUEG()+1),e)for(let e=0;e{let t=Ni(e),i=new Gt(t);i.readByte(),i.readByte(),i.readUEG(),i.readUEG(),i.readBool(),i.readBool(),i.readBits(3),i.readBool(),i.readBool(),i.readUEG(),i.readUEG(),i.readSEG(),i.readBool(),i.readBool(),i.readBool()&&i.readUEG(),i.readSEG(),i.readSEG(),i.readBool(),i.readBool(),i.readBool(),i.readBool();let r=i.readBool(),s=i.readBool(),a=1;return s&&r?a=0:s?a=3:r&&(a=2),{parallelismType:a}})(i);s=Object.assign(s,a,n,o);let d=23+(5+t.byteLength)+(5+r.byteLength)+(5+i.byteLength),l=new Uint8Array(d);l[0]=1,l[1]=(3&s.general_profile_space)<<6|(s.general_tier_flag?1:0)<<5|31&s.general_profile_idc,l[2]=s.general_profile_compatibility_flags_1||0,l[3]=s.general_profile_compatibility_flags_2||0,l[4]=s.general_profile_compatibility_flags_3||0,l[5]=s.general_profile_compatibility_flags_4||0,l[6]=s.general_constraint_indicator_flags_1||0,l[7]=s.general_constraint_indicator_flags_2||0,l[8]=s.general_constraint_indicator_flags_3||0,l[9]=s.general_constraint_indicator_flags_4||0,l[10]=s.general_constraint_indicator_flags_5||0,l[11]=s.general_constraint_indicator_flags_6||0,l[12]=60,l[13]=240|(3840&s.min_spatial_segmentation_idc)>>8,l[14]=255&s.min_spatial_segmentation_idc,l[15]=252|3&s.parallelismType,l[16]=252|3&s.chroma_format_idc,l[17]=248|7&s.bit_depth_luma_minus8,l[18]=248|7&s.bit_depth_chroma_minus8,l[19]=0,l[20]=0,l[21]=(3&s.constant_frame_rate)<<6|(7&s.num_temporal_layers)<<3|(s.temporal_id_nested?1:0)<<2|3,l[22]=3,l[23]=128|it,l[24]=0,l[25]=1,l[26]=(65280&t.byteLength)>>8,l[27]=(255&t.byteLength)>>0,l.set(t,28),l[23+(5+t.byteLength)+0]=128|st,l[23+(5+t.byteLength)+1]=0,l[23+(5+t.byteLength)+2]=1,l[23+(5+t.byteLength)+3]=(65280&r.byteLength)>>8,l[23+(5+t.byteLength)+4]=(255&r.byteLength)>>0,l.set(r,23+(5+t.byteLength)+5),l[23+(5+t.byteLength+5+r.byteLength)+0]=128|nt,l[23+(5+t.byteLength+5+r.byteLength)+1]=0,l[23+(5+t.byteLength+5+r.byteLength)+2]=1,l[23+(5+t.byteLength+5+r.byteLength)+3]=(65280&i.byteLength)>>8,l[23+(5+t.byteLength+5+r.byteLength)+4]=(255&i.byteLength)>>0,l.set(i,23+(5+t.byteLength+5+r.byteLength)+5);const c=[28,0,0,0,0],u=new Uint8Array(c.length+l.byteLength);return u.set(c,0),u.set(l,c.length),u}function Yi(e,t){let i=[];i[0]=t?28:44,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=e.byteLength>>24&255,i[6]=e.byteLength>>16&255,i[7]=e.byteLength>>8&255,i[8]=255&e.byteLength;const r=new Uint8Array(i.length+e.byteLength);return r.set(i,0),r.set(e,i.length),r}function qi(e,t){let i=[];i[0]=t?28:44,i[1]=1,i[2]=0,i[3]=0,i[4]=0;const r=new Uint8Array(i.length+e.byteLength);return r.set(i,0),r.set(e,i.length),r}function ji(e){return(126&e[0])>>1}function Ki(e){return e===dt}function Xi(e){return!function(e){return e>=32&&e<=40}(e)}function Zi(e){return e>=16&&e<=21}function Ji(e){if(0===e.length)return!1;const t=ji(e[0]);for(let i=1;i=i.byteLength)return this.eofFlag=!0,i.byteLength;let e=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],r=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===e||1===r)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let i=this.currentStartcodeOffset;i+=1===(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3;let r=e[i]>>1&63,s=(128&e[i])>>>7,a=this.findNextStartCodeOffset(i);this.currentStartcodeOffset=a,0===s&&(t={type:r,data:e.subarray(i,a)})}return t}}class er{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}function tr(e){return parseInt(e)===e}function ir(e){if(!tr(e.length))return!1;for(var t=0;t255)return!1;return!0}function rr(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!ir(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(tr(e.length)&&ir(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function sr(e){return new Uint8Array(e)}function ar(e,t,i,r,s){null==r&&null==s||(e=e.slice?e.slice(r,s):Array.prototype.slice.call(e,r,s)),t.set(e,i)}var nr,or={toBytes:function(e){var t=[],i=0;for(e=encodeURI(e);i191&&r<224?(t.push(String.fromCharCode((31&r)<<6|63&e[i+1])),i+=2):(t.push(String.fromCharCode((15&r)<<12|(63&e[i+1])<<6|63&e[i+2])),i+=3)}return t.join("")}},dr=(nr="0123456789abcdef",{toBytes:function(e){for(var t=[],i=0;i>4]+nr[15&r])}return t.join("")}}),lr={16:10,24:12,32:14},cr=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],ur=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],hr=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],fr=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],pr=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],_r=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],mr=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],gr=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],yr=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],br=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],vr=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Sr=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],wr=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Ar=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Br=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Ur(e){for(var t=[],i=0;i>2,this._Ke[i][t%4]=a[t],this._Kd[e-i][t%4]=a[t];for(var n,o=0,d=s;d>16&255]<<24^ur[n>>8&255]<<16^ur[255&n]<<8^ur[n>>24&255]^cr[o]<<24,o+=1,8!=s)for(t=1;t>8&255]<<8^ur[n>>16&255]<<16^ur[n>>24&255]<<24;for(t=s/2+1;t>2,c=d%4,this._Ke[l][c]=a[t],this._Kd[e-l][c]=a[t++],d++}for(var l=1;l>24&255]^wr[n>>16&255]^Ar[n>>8&255]^Br[255&n]},xr.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,i=[0,0,0,0],r=Ur(e),s=0;s<4;s++)r[s]^=this._Ke[0][s];for(var a=1;a>24&255]^pr[r[(s+1)%4]>>16&255]^_r[r[(s+2)%4]>>8&255]^mr[255&r[(s+3)%4]]^this._Ke[a][s];r=i.slice()}var n,o=sr(16);for(s=0;s<4;s++)n=this._Ke[t][s],o[4*s]=255&(ur[r[s]>>24&255]^n>>24),o[4*s+1]=255&(ur[r[(s+1)%4]>>16&255]^n>>16),o[4*s+2]=255&(ur[r[(s+2)%4]>>8&255]^n>>8),o[4*s+3]=255&(ur[255&r[(s+3)%4]]^n);return o},xr.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,i=[0,0,0,0],r=Ur(e),s=0;s<4;s++)r[s]^=this._Kd[0][s];for(var a=1;a>24&255]^yr[r[(s+3)%4]>>16&255]^br[r[(s+2)%4]>>8&255]^vr[255&r[(s+1)%4]]^this._Kd[a][s];r=i.slice()}var n,o=sr(16);for(s=0;s<4;s++)n=this._Kd[t][s],o[4*s]=255&(hr[r[s]>>24&255]^n>>24),o[4*s+1]=255&(hr[r[(s+3)%4]>>16&255]^n>>16),o[4*s+2]=255&(hr[r[(s+2)%4]>>8&255]^n>>8),o[4*s+3]=255&(hr[255&r[(s+1)%4]]^n);return o};var Er=function(e){if(!(this instanceof Er))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new xr(e)};Er.prototype.encrypt=function(e){if((e=rr(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=sr(e.length),i=sr(16),r=0;rNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},Lr.prototype.setBytes=function(e){if(16!=(e=rr(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Lr.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var Dr=function(e,t){if(!(this instanceof Dr))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Lr||(t=new Lr(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new xr(e)};Dr.prototype.encrypt=function(e){for(var t=rr(e,!0),i=0;i16)throw new Error("PKCS#7 padding byte out of range");for(var i=e.length-t,r=0;r>>2]>>>24-a%4*8&255;t[r+a>>>2]|=n<<24-(r+a)%4*8}else for(var o=0;o>>2]=i[o>>>2];return this.sigBytes+=s,this},clamp:function(){var t=this.words,i=this.sigBytes;t[i>>>2]&=4294967295<<32-i%4*8,t.length=e.ceil(i/4)},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],i=0;i>>2]>>>24-s%4*8&255;r.push((a>>>4).toString(16)),r.push((15&a).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,i=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new l.init(i,t/2)}},h=c.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],s=0;s>>2]>>>24-s%4*8&255;r.push(String.fromCharCode(a))}return r.join("")},parse:function(e){for(var t=e.length,i=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new l.init(i,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var i,r=this._data,s=r.words,a=r.sigBytes,n=this.blockSize,o=a/(4*n),d=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*n,c=e.min(4*d,a);if(d){for(var u=0;u>>2]|=e[s]<<24-s%4*8;t.call(this,r,i)}else t.apply(this,arguments)};r.prototype=e}}(),i.lib.WordArray)})),Nt((function(e,t){var i;e.exports=(i=Fr,function(){var e=i,t=e.lib.WordArray,r=e.enc;function s(e){return e<<8&4278255360|e>>>8&16711935}r.Utf16=r.Utf16BE={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],s=0;s>>2]>>>16-s%4*8&65535;r.push(String.fromCharCode(a))}return r.join("")},parse:function(e){for(var i=e.length,r=[],s=0;s>>1]|=e.charCodeAt(s)<<16-s%2*16;return t.create(r,2*i)}},r.Utf16LE={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],a=0;a>>2]>>>16-a%4*8&65535);r.push(String.fromCharCode(n))}return r.join("")},parse:function(e){for(var i=e.length,r=[],a=0;a>>1]|=s(e.charCodeAt(a)<<16-a%2*16);return t.create(r,2*i)}}}(),i.enc.Utf16)})),Nt((function(e,t){var i;e.exports=(i=Fr,function(){var e=i,t=e.lib.WordArray;function r(e,i,r){for(var s=[],a=0,n=0;n>>6-n%4*2;s[a>>>2]|=o<<24-a%4*8,a++}return t.create(s,a)}e.enc.Base64={stringify:function(e){var t=e.words,i=e.sigBytes,r=this._map;e.clamp();for(var s=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,o=0;o<4&&a+.75*o>>6*(3-o)&63));var d=r.charAt(64);if(d)for(;s.length%4;)s.push(d);return s.join("")},parse:function(e){var t=e.length,i=this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var a=0;a>>6-n%4*2;s[a>>>2]|=o<<24-a%4*8,a++}return t.create(s,a)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var i=e.words,r=e.sigBytes,s=t?this._safe_map:this._map;e.clamp();for(var a=[],n=0;n>>2]>>>24-n%4*8&255)<<16|(i[n+1>>>2]>>>24-(n+1)%4*8&255)<<8|i[n+2>>>2]>>>24-(n+2)%4*8&255,d=0;d<4&&n+.75*d>>6*(3-d)&63));var l=s.charAt(64);if(l)for(;a.length%4;)a.push(l);return a.join("")},parse:function(e,t){void 0===t&&(t=!0);var i=e.length,s=t?this._safe_map:this._map,a=this._reverseMap;if(!a){a=this._reverseMap=[];for(var n=0;n>>24)|4278255360&(s<<24|s>>>8)}var a=this._hash.words,n=e[t+0],d=e[t+1],f=e[t+2],p=e[t+3],_=e[t+4],m=e[t+5],g=e[t+6],y=e[t+7],b=e[t+8],v=e[t+9],S=e[t+10],w=e[t+11],A=e[t+12],B=e[t+13],U=e[t+14],x=e[t+15],E=a[0],T=a[1],k=a[2],C=a[3];E=l(E,T,k,C,n,7,o[0]),C=l(C,E,T,k,d,12,o[1]),k=l(k,C,E,T,f,17,o[2]),T=l(T,k,C,E,p,22,o[3]),E=l(E,T,k,C,_,7,o[4]),C=l(C,E,T,k,m,12,o[5]),k=l(k,C,E,T,g,17,o[6]),T=l(T,k,C,E,y,22,o[7]),E=l(E,T,k,C,b,7,o[8]),C=l(C,E,T,k,v,12,o[9]),k=l(k,C,E,T,S,17,o[10]),T=l(T,k,C,E,w,22,o[11]),E=l(E,T,k,C,A,7,o[12]),C=l(C,E,T,k,B,12,o[13]),k=l(k,C,E,T,U,17,o[14]),E=c(E,T=l(T,k,C,E,x,22,o[15]),k,C,d,5,o[16]),C=c(C,E,T,k,g,9,o[17]),k=c(k,C,E,T,w,14,o[18]),T=c(T,k,C,E,n,20,o[19]),E=c(E,T,k,C,m,5,o[20]),C=c(C,E,T,k,S,9,o[21]),k=c(k,C,E,T,x,14,o[22]),T=c(T,k,C,E,_,20,o[23]),E=c(E,T,k,C,v,5,o[24]),C=c(C,E,T,k,U,9,o[25]),k=c(k,C,E,T,p,14,o[26]),T=c(T,k,C,E,b,20,o[27]),E=c(E,T,k,C,B,5,o[28]),C=c(C,E,T,k,f,9,o[29]),k=c(k,C,E,T,y,14,o[30]),E=u(E,T=c(T,k,C,E,A,20,o[31]),k,C,m,4,o[32]),C=u(C,E,T,k,b,11,o[33]),k=u(k,C,E,T,w,16,o[34]),T=u(T,k,C,E,U,23,o[35]),E=u(E,T,k,C,d,4,o[36]),C=u(C,E,T,k,_,11,o[37]),k=u(k,C,E,T,y,16,o[38]),T=u(T,k,C,E,S,23,o[39]),E=u(E,T,k,C,B,4,o[40]),C=u(C,E,T,k,n,11,o[41]),k=u(k,C,E,T,p,16,o[42]),T=u(T,k,C,E,g,23,o[43]),E=u(E,T,k,C,v,4,o[44]),C=u(C,E,T,k,A,11,o[45]),k=u(k,C,E,T,x,16,o[46]),E=h(E,T=u(T,k,C,E,f,23,o[47]),k,C,n,6,o[48]),C=h(C,E,T,k,y,10,o[49]),k=h(k,C,E,T,U,15,o[50]),T=h(T,k,C,E,m,21,o[51]),E=h(E,T,k,C,A,6,o[52]),C=h(C,E,T,k,p,10,o[53]),k=h(k,C,E,T,S,15,o[54]),T=h(T,k,C,E,d,21,o[55]),E=h(E,T,k,C,b,6,o[56]),C=h(C,E,T,k,x,10,o[57]),k=h(k,C,E,T,g,15,o[58]),T=h(T,k,C,E,B,21,o[59]),E=h(E,T,k,C,_,6,o[60]),C=h(C,E,T,k,w,10,o[61]),k=h(k,C,E,T,f,15,o[62]),T=h(T,k,C,E,v,21,o[63]),a[0]=a[0]+E|0,a[1]=a[1]+T|0,a[2]=a[2]+k|0,a[3]=a[3]+C|0},_doFinalize:function(){var t=this._data,i=t.words,r=8*this._nDataBytes,s=8*t.sigBytes;i[s>>>5]|=128<<24-s%32;var a=e.floor(r/4294967296),n=r;i[15+(s+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),i[14+(s+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t.sigBytes=4*(i.length+1),this._process();for(var o=this._hash,d=o.words,l=0;l<4;l++){var c=d[l];d[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return o},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,i,r,s,a,n){var o=e+(t&i|~t&r)+s+n;return(o<>>32-a)+t}function c(e,t,i,r,s,a,n){var o=e+(t&r|i&~r)+s+n;return(o<>>32-a)+t}function u(e,t,i,r,s,a,n){var o=e+(t^i^r)+s+n;return(o<>>32-a)+t}function h(e,t,i,r,s,a,n){var o=e+(i^(t|~r))+s+n;return(o<>>32-a)+t}t.MD5=a._createHelper(d),t.HmacMD5=a._createHmacHelper(d)}(Math),i.MD5)})),Nt((function(e,t){var i,r,s,a,n,o,d,l;e.exports=(r=(i=l=Fr).lib,s=r.WordArray,a=r.Hasher,n=i.algo,o=[],d=n.SHA1=a.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=this._hash.words,r=i[0],s=i[1],a=i[2],n=i[3],d=i[4],l=0;l<80;l++){if(l<16)o[l]=0|e[t+l];else{var c=o[l-3]^o[l-8]^o[l-14]^o[l-16];o[l]=c<<1|c>>>31}var u=(r<<5|r>>>27)+d+o[l];u+=l<20?1518500249+(s&a|~s&n):l<40?1859775393+(s^a^n):l<60?(s&a|s&n|a&n)-1894007588:(s^a^n)-899497514,d=n,n=a,a=s<<30|s>>>2,s=r,r=u}i[0]=i[0]+r|0,i[1]=i[1]+s|0,i[2]=i[2]+a|0,i[3]=i[3]+n|0,i[4]=i[4]+d|0},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(i/4294967296),t[15+(r+64>>>9<<4)]=i,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}}),i.SHA1=a._createHelper(d),i.HmacSHA1=a._createHmacHelper(d),l.SHA1)})),Nt((function(e,t){var i;e.exports=(i=Fr,function(e){var t=i,r=t.lib,s=r.WordArray,a=r.Hasher,n=t.algo,o=[],d=[];!function(){function t(t){for(var i=e.sqrt(t),r=2;r<=i;r++)if(!(t%r))return!1;return!0}function i(e){return 4294967296*(e-(0|e))|0}for(var r=2,s=0;s<64;)t(r)&&(s<8&&(o[s]=i(e.pow(r,.5))),d[s]=i(e.pow(r,1/3)),s++),r++}();var l=[],c=n.SHA256=a.extend({_doReset:function(){this._hash=new s.init(o.slice(0))},_doProcessBlock:function(e,t){for(var i=this._hash.words,r=i[0],s=i[1],a=i[2],n=i[3],o=i[4],c=i[5],u=i[6],h=i[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],_=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,m=l[f-2],g=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;l[f]=_+l[f-7]+g+l[f-16]}var y=r&s^r&a^s&a,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),v=h+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&c^~o&u)+d[f]+l[f];h=u,u=c,c=o,o=n+v|0,n=a,a=s,s=r,r=v+(b+y)|0}i[0]=i[0]+r|0,i[1]=i[1]+s|0,i[2]=i[2]+a|0,i[3]=i[3]+n|0,i[4]=i[4]+o|0,i[5]=i[5]+c|0,i[6]=i[6]+u|0,i[7]=i[7]+h|0},_doFinalize:function(){var t=this._data,i=t.words,r=8*this._nDataBytes,s=8*t.sigBytes;return i[s>>>5]|=128<<24-s%32,i[14+(s+64>>>9<<4)]=e.floor(r/4294967296),i[15+(s+64>>>9<<4)]=r,t.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=a._createHelper(c),t.HmacSHA256=a._createHmacHelper(c)}(Math),i.SHA256)})),Nt((function(e,t){var i,r,s,a,n,o;e.exports=(r=(i=o=Fr).lib.WordArray,s=i.algo,a=s.SHA256,n=s.SHA224=a.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=4,e}}),i.SHA224=a._createHelper(n),i.HmacSHA224=a._createHmacHelper(n),o.SHA224)})),Nt((function(e,t){var i;e.exports=(i=Fr,function(){var e=i,t=e.lib.Hasher,r=e.x64,s=r.Word,a=r.WordArray,n=e.algo;function o(){return s.create.apply(s,arguments)}var d=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=o()}();var c=n.SHA512=t.extend({_doReset:function(){this._hash=new a.init([new s.init(1779033703,4089235720),new s.init(3144134277,2227873595),new s.init(1013904242,4271175723),new s.init(2773480762,1595750129),new s.init(1359893119,2917565137),new s.init(2600822924,725511199),new s.init(528734635,4215389547),new s.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var i=this._hash.words,r=i[0],s=i[1],a=i[2],n=i[3],o=i[4],c=i[5],u=i[6],h=i[7],f=r.high,p=r.low,_=s.high,m=s.low,g=a.high,y=a.low,b=n.high,v=n.low,S=o.high,w=o.low,A=c.high,B=c.low,U=u.high,x=u.low,E=h.high,T=h.low,k=f,C=p,L=_,D=m,I=g,F=y,P=b,M=v,z=S,R=w,N=A,G=B,O=U,H=x,V=E,$=T,W=0;W<80;W++){var Y,q,j=l[W];if(W<16)q=j.high=0|e[t+2*W],Y=j.low=0|e[t+2*W+1];else{var K=l[W-15],X=K.high,Z=K.low,J=(X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7,Q=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),ee=l[W-2],te=ee.high,ie=ee.low,re=(te>>>19|ie<<13)^(te<<3|ie>>>29)^te>>>6,se=(ie>>>19|te<<13)^(ie<<3|te>>>29)^(ie>>>6|te<<26),ae=l[W-7],ne=ae.high,oe=ae.low,de=l[W-16],le=de.high,ce=de.low;q=(q=(q=J+ne+((Y=Q+oe)>>>0>>0?1:0))+re+((Y+=se)>>>0>>0?1:0))+le+((Y+=ce)>>>0>>0?1:0),j.high=q,j.low=Y}var ue,he=z&N^~z&O,fe=R&G^~R&H,pe=k&L^k&I^L&I,_e=C&D^C&F^D&F,me=(k>>>28|C<<4)^(k<<30|C>>>2)^(k<<25|C>>>7),ge=(C>>>28|k<<4)^(C<<30|k>>>2)^(C<<25|k>>>7),ye=(z>>>14|R<<18)^(z>>>18|R<<14)^(z<<23|R>>>9),be=(R>>>14|z<<18)^(R>>>18|z<<14)^(R<<23|z>>>9),ve=d[W],Se=ve.high,we=ve.low,Ae=V+ye+((ue=$+be)>>>0<$>>>0?1:0),Be=ge+_e;V=O,$=H,O=N,H=G,N=z,G=R,z=P+(Ae=(Ae=(Ae=Ae+he+((ue+=fe)>>>0>>0?1:0))+Se+((ue+=we)>>>0>>0?1:0))+q+((ue+=Y)>>>0>>0?1:0))+((R=M+ue|0)>>>0>>0?1:0)|0,P=I,M=F,I=L,F=D,L=k,D=C,k=Ae+(me+pe+(Be>>>0>>0?1:0))+((C=ue+Be|0)>>>0>>0?1:0)|0}p=r.low=p+C,r.high=f+k+(p>>>0>>0?1:0),m=s.low=m+D,s.high=_+L+(m>>>0>>0?1:0),y=a.low=y+F,a.high=g+I+(y>>>0>>0?1:0),v=n.low=v+M,n.high=b+P+(v>>>0>>0?1:0),w=o.low=w+R,o.high=S+z+(w>>>0>>0?1:0),B=c.low=B+G,c.high=A+N+(B>>>0>>0?1:0),x=u.low=x+H,u.high=U+O+(x>>>0>>0?1:0),T=h.low=T+$,h.high=E+V+(T>>>0<$>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[30+(r+128>>>10<<5)]=Math.floor(i/4294967296),t[31+(r+128>>>10<<5)]=i,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(c),e.HmacSHA512=t._createHmacHelper(c)}(),i.SHA512)})),Nt((function(e,t){var i,r,s,a,n,o,d,l;e.exports=(r=(i=l=Fr).x64,s=r.Word,a=r.WordArray,n=i.algo,o=n.SHA512,d=n.SHA384=o.extend({_doReset:function(){this._hash=new a.init([new s.init(3418070365,3238371032),new s.init(1654270250,914150663),new s.init(2438529370,812702999),new s.init(355462360,4144912697),new s.init(1731405415,4290775857),new s.init(2394180231,1750603025),new s.init(3675008525,1694076839),new s.init(1203062813,3204075428)])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=16,e}}),i.SHA384=o._createHelper(d),i.HmacSHA384=o._createHmacHelper(d),l.SHA384)})),Nt((function(e,t){var i;e.exports=(i=Fr,function(e){var t=i,r=t.lib,s=r.WordArray,a=r.Hasher,n=t.x64.Word,o=t.algo,d=[],l=[],c=[];!function(){for(var e=1,t=0,i=0;i<24;i++){d[e+5*t]=(i+1)*(i+2)/2%64;var r=(2*e+3*t)%5;e=t%5,t=r}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var s=1,a=0;a<24;a++){for(var o=0,u=0,h=0;h<7;h++){if(1&s){var f=(1<>>24)|4278255360&(a<<24|a>>>8),n=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),(T=i[s]).high^=n,T.low^=a}for(var o=0;o<24;o++){for(var h=0;h<5;h++){for(var f=0,p=0,_=0;_<5;_++)f^=(T=i[h+5*_]).high,p^=T.low;var m=u[h];m.high=f,m.low=p}for(h=0;h<5;h++){var g=u[(h+4)%5],y=u[(h+1)%5],b=y.high,v=y.low;for(f=g.high^(b<<1|v>>>31),p=g.low^(v<<1|b>>>31),_=0;_<5;_++)(T=i[h+5*_]).high^=f,T.low^=p}for(var S=1;S<25;S++){var w=(T=i[S]).high,A=T.low,B=d[S];B<32?(f=w<>>32-B,p=A<>>32-B):(f=A<>>64-B,p=w<>>64-B);var U=u[l[S]];U.high=f,U.low=p}var x=u[0],E=i[0];for(x.high=E.high,x.low=E.low,h=0;h<5;h++)for(_=0;_<5;_++){var T=i[S=h+5*_],k=u[S],C=u[(h+1)%5+5*_],L=u[(h+2)%5+5*_];T.high=k.high^~C.high&L.high,T.low=k.low^~C.low&L.low}T=i[0];var D=c[o];T.high^=D.high,T.low^=D.low}},_doFinalize:function(){var t=this._data,i=t.words;this._nDataBytes;var r=8*t.sigBytes,a=32*this.blockSize;i[r>>>5]|=1<<24-r%32,i[(e.ceil((r+1)/a)*a>>>5)-1]|=128,t.sigBytes=4*i.length,this._process();for(var n=this._state,o=this.cfg.outputLength/8,d=o/8,l=[],c=0;c>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(h)}return new s.init(l,o)},clone:function(){for(var e=a.clone.call(this),t=e._state=this._state.slice(0),i=0;i<25;i++)t[i]=t[i].clone();return e}});t.SHA3=a._createHelper(h),t.HmacSHA3=a._createHmacHelper(h)}(Math),i.SHA3)})),Nt((function(e,t){var i;e.exports=(i=Fr,function(e){var t=i,r=t.lib,s=r.WordArray,a=r.Hasher,n=t.algo,o=s.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=s.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=s.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=s.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=s.create([0,1518500249,1859775393,2400959708,2840853838]),h=s.create([1352829926,1548603684,1836072691,2053994217,0]),f=n.RIPEMD160=a.extend({_doReset:function(){this._hash=s.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=0;i<16;i++){var r=t+i,s=e[r];e[r]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}var a,n,f,v,S,w,A,B,U,x,E,T=this._hash.words,k=u.words,C=h.words,L=o.words,D=d.words,I=l.words,F=c.words;for(w=a=T[0],A=n=T[1],B=f=T[2],U=v=T[3],x=S=T[4],i=0;i<80;i+=1)E=a+e[t+L[i]]|0,E+=i<16?p(n,f,v)+k[0]:i<32?_(n,f,v)+k[1]:i<48?m(n,f,v)+k[2]:i<64?g(n,f,v)+k[3]:y(n,f,v)+k[4],E=(E=b(E|=0,I[i]))+S|0,a=S,S=v,v=b(f,10),f=n,n=E,E=w+e[t+D[i]]|0,E+=i<16?y(A,B,U)+C[0]:i<32?g(A,B,U)+C[1]:i<48?m(A,B,U)+C[2]:i<64?_(A,B,U)+C[3]:p(A,B,U)+C[4],E=(E=b(E|=0,F[i]))+x|0,w=x,x=U,U=b(B,10),B=A,A=E;E=T[1]+f+U|0,T[1]=T[2]+v+x|0,T[2]=T[3]+S+w|0,T[3]=T[4]+a+A|0,T[4]=T[0]+n+B|0,T[0]=E},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),e.sigBytes=4*(t.length+1),this._process();for(var s=this._hash,a=s.words,n=0;n<5;n++){var o=a[n];a[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return s},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,i){return e^t^i}function _(e,t,i){return e&t|~e&i}function m(e,t,i){return(e|~t)^i}function g(e,t,i){return e&i|t&~i}function y(e,t,i){return e^(t|~i)}function b(e,t){return e<>>32-t}t.RIPEMD160=a._createHelper(f),t.HmacRIPEMD160=a._createHmacHelper(f)}(),i.RIPEMD160)})),Nt((function(e,t){var i,r,s;e.exports=(r=(i=Fr).lib.Base,s=i.enc.Utf8,void(i.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var i=e.blockSize,r=4*i;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),n=this._iKey=t.clone(),o=a.words,d=n.words,l=0;l>>2];e.sigBytes-=t}};r.BlockCipher=c.extend({cfg:c.cfg.extend({mode:f,padding:p}),reset:function(){var e;c.reset.call(this);var t=this.cfg,i=t.iv,r=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=r.createEncryptor:(e=r.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,i&&i.words):(this._mode=e.call(r,this,i&&i.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var _=r.CipherParams=s.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),m=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,i=e.salt;return(i?a.create([1398893684,1701076831]).concat(i).concat(t):t).toString(d)},parse:function(e){var t,i=d.parse(e),r=i.words;return 1398893684==r[0]&&1701076831==r[1]&&(t=a.create(r.slice(2,4)),r.splice(0,4),i.sigBytes-=16),_.create({ciphertext:i,salt:t})}},g=r.SerializableCipher=s.extend({cfg:s.extend({format:m}),encrypt:function(e,t,i,r){r=this.cfg.extend(r);var s=e.createEncryptor(i,r),a=s.finalize(t),n=s.cfg;return _.create({ciphertext:a,key:i,iv:n.iv,algorithm:e,mode:n.mode,padding:n.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,i,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(i,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,i,r,s){if(r||(r=a.random(8)),s)n=l.create({keySize:t+i,hasher:s}).compute(e,r);else var n=l.create({keySize:t+i}).compute(e,r);var o=a.create(n.words.slice(t),4*i);return n.sigBytes=4*t,_.create({key:n,iv:o,salt:r})}},b=r.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,i,r){var s=(r=this.cfg.extend(r)).kdf.execute(i,e.keySize,e.ivSize,r.salt,r.hasher);r.iv=s.iv;var a=g.encrypt.call(this,e,t,s.key,r);return a.mixIn(s),a},decrypt:function(e,t,i,r){r=this.cfg.extend(r),t=this._parse(t,r.format);var s=r.kdf.execute(i,e.keySize,e.ivSize,t.salt,r.hasher);return r.iv=s.iv,g.decrypt.call(this,e,t,s.key,r)}})}())})),Nt((function(e,t){var i;e.exports=((i=Fr).mode.CFB=function(){var e=i.lib.BlockCipherMode.extend();function t(e,t,i,r){var s,a=this._iv;a?(s=a.slice(0),this._iv=void 0):s=this._prevBlock,r.encryptBlock(s,0);for(var n=0;n>24&255)){var t=e>>16&255,i=e>>8&255,r=255&e;255===t?(t=0,255===i?(i=0,255===r?r=0:++r):++i):++t,e=0,e+=t<<16,e+=i<<8,e+=r}else e+=1<<24;return e}function r(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var s=e.Encryptor=e.extend({processBlock:function(e,t){var i=this._cipher,s=i.blockSize,a=this._iv,n=this._counter;a&&(n=this._counter=a.slice(0),this._iv=void 0),r(n);var o=n.slice(0);i.encryptBlock(o,0);for(var d=0;d>>2]|=s<<24-a%4*8,e.sigBytes+=s},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Ansix923)})),Nt((function(e,t){var i;e.exports=((i=Fr).pad.Iso10126={pad:function(e,t){var r=4*t,s=r-e.sigBytes%r;e.concat(i.lib.WordArray.random(s-1)).concat(i.lib.WordArray.create([s<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Iso10126)})),Nt((function(e,t){var i;e.exports=((i=Fr).pad.Iso97971={pad:function(e,t){e.concat(i.lib.WordArray.create([2147483648],1)),i.pad.ZeroPadding.pad(e,t)},unpad:function(e){i.pad.ZeroPadding.unpad(e),e.sigBytes--}},i.pad.Iso97971)})),Nt((function(e,t){var i;e.exports=((i=Fr).pad.ZeroPadding={pad:function(e,t){var i=4*t;e.clamp(),e.sigBytes+=i-(e.sigBytes%i||i)},unpad:function(e){var t=e.words,i=e.sigBytes-1;for(i=e.sigBytes-1;i>=0;i--)if(t[i>>>2]>>>24-i%4*8&255){e.sigBytes=i+1;break}}},i.pad.ZeroPadding)})),Nt((function(e,t){var i;e.exports=((i=Fr).pad.NoPadding={pad:function(){},unpad:function(){}},i.pad.NoPadding)})),Nt((function(e,t){var i;e.exports=(i=Fr,function(e){var t=i,r=t.lib.CipherParams,s=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(s)},parse:function(e){var t=s.parse(e);return r.create({ciphertext:t})}}}(),i.format.Hex)})),Nt((function(e,t){var i;e.exports=(i=Fr,function(){var e=i,t=e.lib.BlockCipher,r=e.algo,s=[],a=[],n=[],o=[],d=[],l=[],c=[],u=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var i=0,r=0;for(t=0;t<256;t++){var p=r^r<<1^r<<2^r<<3^r<<4;p=p>>>8^255&p^99,s[i]=p,a[p]=i;var _=e[i],m=e[_],g=e[m],y=257*e[p]^16843008*p;n[i]=y<<24|y>>>8,o[i]=y<<16|y>>>16,d[i]=y<<8|y>>>24,l[i]=y,y=16843009*g^65537*m^257*_^16843008*i,c[p]=y<<24|y>>>8,u[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,i?(i=_^e[e[e[g^_]]],r^=e[e[r]]):i=r=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],_=r.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,i=e.sigBytes/4,r=4*((this._nRounds=i+6)+1),a=this._keySchedule=[],n=0;n6&&n%i==4&&(l=s[l>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[255&l]):(l=s[(l=l<<8|l>>>24)>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[255&l],l^=p[n/i|0]<<24),a[n]=a[n-i]^l);for(var o=this._invKeySchedule=[],d=0;d>>24]]^u[s[l>>>16&255]]^h[s[l>>>8&255]]^f[s[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,n,o,d,l,s)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,c,u,h,f,a),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,r,s,a,n,o){for(var d=this._nRounds,l=e[t]^i[0],c=e[t+1]^i[1],u=e[t+2]^i[2],h=e[t+3]^i[3],f=4,p=1;p>>24]^s[c>>>16&255]^a[u>>>8&255]^n[255&h]^i[f++],m=r[c>>>24]^s[u>>>16&255]^a[h>>>8&255]^n[255&l]^i[f++],g=r[u>>>24]^s[h>>>16&255]^a[l>>>8&255]^n[255&c]^i[f++],y=r[h>>>24]^s[l>>>16&255]^a[c>>>8&255]^n[255&u]^i[f++];l=_,c=m,u=g,h=y}_=(o[l>>>24]<<24|o[c>>>16&255]<<16|o[u>>>8&255]<<8|o[255&h])^i[f++],m=(o[c>>>24]<<24|o[u>>>16&255]<<16|o[h>>>8&255]<<8|o[255&l])^i[f++],g=(o[u>>>24]<<24|o[h>>>16&255]<<16|o[l>>>8&255]<<8|o[255&c])^i[f++],y=(o[h>>>24]<<24|o[l>>>16&255]<<16|o[c>>>8&255]<<8|o[255&u])^i[f++],e[t]=_,e[t+1]=m,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(_)}(),i.AES)})),Nt((function(e,t){var i;e.exports=(i=Fr,function(){var e=i,t=e.lib,r=t.WordArray,s=t.BlockCipher,a=e.algo,n=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=a.DES=s.extend({_doReset:function(){for(var e=this._key.words,t=[],i=0;i<56;i++){var r=n[i]-1;t[i]=e[r>>>5]>>>31-r%32&1}for(var s=this._subKeys=[],a=0;a<16;a++){var l=s[a]=[],c=d[a];for(i=0;i<24;i++)l[i/6|0]|=t[(o[i]-1+c)%28]<<31-i%6,l[4+(i/6|0)]|=t[28+(o[i+24]-1+c)%28]<<31-i%6;for(l[0]=l[0]<<1|l[0]>>>31,i=1;i<7;i++)l[i]=l[i]>>>4*(i-1)+3;l[7]=l[7]<<5|l[7]>>>27}var u=this._invSubKeys=[];for(i=0;i<16;i++)u[i]=s[15-i]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,i){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var r=0;r<16;r++){for(var s=i[r],a=this._lBlock,n=this._rBlock,o=0,d=0;d<8;d++)o|=l[d][((n^s[d])&c[d])>>>0];this._lBlock=n,this._rBlock=a^o}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var i=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=i,this._lBlock^=i<>>e^this._lBlock)&t;this._lBlock^=i,this._rBlock^=i<192.");var t=e.slice(0,2),i=e.length<4?e.slice(0,2):e.slice(2,4),s=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(r.create(t)),this._des2=u.createEncryptor(r.create(i)),this._des3=u.createEncryptor(r.create(s))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=s._createHelper(p)}(),i.TripleDES)})),Nt((function(e,t){var i;e.exports=(i=Fr,function(){var e=i,t=e.lib.StreamCipher,r=e.algo,s=r.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,i=e.sigBytes,r=this._S=[],s=0;s<256;s++)r[s]=s;s=0;for(var a=0;s<256;s++){var n=s%i,o=t[n>>>2]>>>24-n%4*8&255;a=(a+r[s]+o)%256;var d=r[s];r[s]=r[a],r[a]=d}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=a.call(this)},keySize:8,ivSize:0});function a(){for(var e=this._S,t=this._i,i=this._j,r=0,s=0;s<4;s++){i=(i+e[t=(t+1)%256])%256;var a=e[t];e[t]=e[i],e[i]=a,r|=e[(e[t]+e[i])%256]<<24-8*s}return this._i=t,this._j=i,r}e.RC4=t._createHelper(s);var n=r.RC4Drop=s.extend({cfg:s.cfg.extend({drop:192}),_doReset:function(){s._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)a.call(this)}});e.RC4Drop=t._createHelper(n)}(),i.RC4)})),Nt((function(e,t){var i;e.exports=(i=Fr,function(){var e=i,t=e.lib.StreamCipher,r=e.algo,s=[],a=[],n=[],o=r.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,i=0;i<4;i++)e[i]=16711935&(e[i]<<8|e[i]>>>24)|4278255360&(e[i]<<24|e[i]>>>8);var r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],s=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,i=0;i<4;i++)d.call(this);for(i=0;i<8;i++)s[i]^=r[i+4&7];if(t){var a=t.words,n=a[0],o=a[1],l=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(s[0]^=l,s[1]^=u,s[2]^=c,s[3]^=h,s[4]^=l,s[5]^=u,s[6]^=c,s[7]^=h,i=0;i<4;i++)d.call(this)}},_doProcessBlock:function(e,t){var i=this._X;d.call(this),s[0]=i[0]^i[5]>>>16^i[3]<<16,s[1]=i[2]^i[7]>>>16^i[5]<<16,s[2]=i[4]^i[1]>>>16^i[7]<<16,s[3]=i[6]^i[3]>>>16^i[1]<<16;for(var r=0;r<4;r++)s[r]=16711935&(s[r]<<8|s[r]>>>24)|4278255360&(s[r]<<24|s[r]>>>8),e[t+r]^=s[r]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,i=0;i<8;i++)a[i]=t[i];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,i=0;i<8;i++){var r=e[i]+t[i],s=65535&r,o=r>>>16,d=((s*s>>>17)+s*o>>>15)+o*o,l=((4294901760&r)*r|0)+((65535&r)*r|0);n[i]=d^l}e[0]=n[0]+(n[7]<<16|n[7]>>>16)+(n[6]<<16|n[6]>>>16)|0,e[1]=n[1]+(n[0]<<8|n[0]>>>24)+n[7]|0,e[2]=n[2]+(n[1]<<16|n[1]>>>16)+(n[0]<<16|n[0]>>>16)|0,e[3]=n[3]+(n[2]<<8|n[2]>>>24)+n[1]|0,e[4]=n[4]+(n[3]<<16|n[3]>>>16)+(n[2]<<16|n[2]>>>16)|0,e[5]=n[5]+(n[4]<<8|n[4]>>>24)+n[3]|0,e[6]=n[6]+(n[5]<<16|n[5]>>>16)+(n[4]<<16|n[4]>>>16)|0,e[7]=n[7]+(n[6]<<8|n[6]>>>24)+n[5]|0}e.Rabbit=t._createHelper(o)}(),i.Rabbit)})),Nt((function(e,t){var i;e.exports=(i=Fr,function(){var e=i,t=e.lib.StreamCipher,r=e.algo,s=[],a=[],n=[],o=r.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],r=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var s=0;s<4;s++)d.call(this);for(s=0;s<8;s++)r[s]^=i[s+4&7];if(t){var a=t.words,n=a[0],o=a[1],l=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(r[0]^=l,r[1]^=u,r[2]^=c,r[3]^=h,r[4]^=l,r[5]^=u,r[6]^=c,r[7]^=h,s=0;s<4;s++)d.call(this)}},_doProcessBlock:function(e,t){var i=this._X;d.call(this),s[0]=i[0]^i[5]>>>16^i[3]<<16,s[1]=i[2]^i[7]>>>16^i[5]<<16,s[2]=i[4]^i[1]>>>16^i[7]<<16,s[3]=i[6]^i[3]>>>16^i[1]<<16;for(var r=0;r<4;r++)s[r]=16711935&(s[r]<<8|s[r]>>>24)|4278255360&(s[r]<<24|s[r]>>>8),e[t+r]^=s[r]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,i=0;i<8;i++)a[i]=t[i];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,i=0;i<8;i++){var r=e[i]+t[i],s=65535&r,o=r>>>16,d=((s*s>>>17)+s*o>>>15)+o*o,l=((4294901760&r)*r|0)+((65535&r)*r|0);n[i]=d^l}e[0]=n[0]+(n[7]<<16|n[7]>>>16)+(n[6]<<16|n[6]>>>16)|0,e[1]=n[1]+(n[0]<<8|n[0]>>>24)+n[7]|0,e[2]=n[2]+(n[1]<<16|n[1]>>>16)+(n[0]<<16|n[0]>>>16)|0,e[3]=n[3]+(n[2]<<8|n[2]>>>24)+n[1]|0,e[4]=n[4]+(n[3]<<16|n[3]>>>16)+(n[2]<<16|n[2]>>>16)|0,e[5]=n[5]+(n[4]<<8|n[4]>>>24)+n[3]|0,e[6]=n[6]+(n[5]<<16|n[5]>>>16)+(n[4]<<16|n[4]>>>16)|0,e[7]=n[7]+(n[6]<<8|n[6]>>>24)+n[5]|0}e.RabbitLegacy=t._createHelper(o)}(),i.RabbitLegacy)})),Nt((function(e,t){var i;e.exports=(i=Fr,function(){var e=i,t=e.lib.BlockCipher,r=e.algo;const s=16,a=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],n=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function d(e,t){let i=t>>24&255,r=t>>16&255,s=t>>8&255,a=255&t,n=e.sbox[0][i]+e.sbox[1][r];return n^=e.sbox[2][s],n+=e.sbox[3][a],n}function l(e,t,i){let r,a=t,n=i;for(let t=0;t1;--t)a^=e.pbox[t],n=d(e,a)^n,r=a,a=n,n=r;return r=a,a=n,n=r,n^=e.pbox[1],a^=e.pbox[0],{left:a,right:n}}function u(e,t,i){for(let t=0;t<4;t++){e.sbox[t]=[];for(let i=0;i<256;i++)e.sbox[t][i]=n[t][i]}let r=0;for(let n=0;n=i&&(r=0);let o=0,d=0,c=0;for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),i=new Uint8Array(i);const s=e.byteLength;let a=5;for(;as)break;let o=e[a+4],d=!1;if(r?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const r=e.slice(a+4+2,a+4+n);let s=new Ir.ModeOfOperation.ctr(t,new Ir.Counter(i));const o=s.decrypt(r);s=null,e.set(o,a+4+2)}a=a+4+n}return e}function zr(e,t,i){if(e.byteLength<=30)return e;const r=e.slice(32);let s=new Ir.ModeOfOperation.ctr(t,new Ir.Counter(i));const a=s.decrypt(r);return s=null,e.set(a,32),e}Nt((function(e,t){e.exports=Fr}));var Rr=Nt((function(e,t){var r,s,a,n=(r=new Date,s=4,a={setLogLevel:function(e){s=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=s&&console.debug("["+n.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=s&&console.info("["+n.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=s&&console.warn("["+n.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=s&&console.error("["+n.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}},a);n.getDurationString=function(e,t){var i;function r(e,t){for(var i=(""+e).split(".");i[0].length0){for(var i="",r=0;r0&&(i+=","),i+="["+n.getDurationString(e.start(r))+","+n.getDurationString(e.end(r))+"]";return i}return"(empty)"},t.Log=n;var o=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};o.prototype.getPosition=function(){return this.position},o.prototype.getEndPosition=function(){return this.buffer.byteLength},o.prototype.getLength=function(){return this.buffer.byteLength},o.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},o.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},o.prototype.readAnyInt=function(e,t){var i=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:i=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:i=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";i=this.dataview.getUint8(this.position)<<16,i|=this.dataview.getUint8(this.position+1)<<8,i|=this.dataview.getUint8(this.position+2);break;case 4:i=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";i=this.dataview.getUint32(this.position)<<32,i|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,i}throw"Not enough bytes in buffer"},o.prototype.readUint8=function(){return this.readAnyInt(1,!1)},o.prototype.readUint16=function(){return this.readAnyInt(2,!1)},o.prototype.readUint24=function(){return this.readAnyInt(3,!1)},o.prototype.readUint32=function(){return this.readAnyInt(4,!1)},o.prototype.readUint64=function(){return this.readAnyInt(8,!1)},o.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",i=0;ithis._byteLength&&(this._byteLength=t);else{for(i<1&&(i=1);t>i;)i*=2;var r=new ArrayBuffer(i),s=new Uint8Array(this._buffer);new Uint8Array(r,0,s.length).set(s),this.buffer=r,this._byteLength=t}}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),i=new Uint8Array(this._buffer,0,t.length);t.set(i),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Int32Array(e);return d.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),d.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},d.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Int16Array(e);return d.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),d.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},d.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Uint32Array(e);return d.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),d.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},d.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Uint16Array(e);return d.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),d.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},d.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var i=new Float64Array(e);return d.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),d.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},d.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Float32Array(e);return d.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),d.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,i,r,s){var a=new Uint8Array(e,t,s),n=new Uint8Array(i,r,s);a.set(n)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i=0;is;r--,s++){var a=t[s];t[s]=t[r],t[r]=a}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],i=0;i>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},d.prototype.adjustUint32=function(e,t){var i=this.position;this.seek(e),this.writeUint32(t),this.seek(i)},d.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var i=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},d.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var i=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},d.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var i=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},d.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var i=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},d.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var i=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(i,null==t?this.endianness:t),this.position+=8*e,i},d.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var i=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i};var c=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(c.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,n.debug("MultiBufferStream","Stream ready for parsing"),!0):(n.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(n.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){n.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(new Uint8Array(e),0),i.set(new Uint8Array(t),e.byteLength),i.buffer},c.prototype.reduceBuffer=function(e,t,i){var r;return(r=new Uint8Array(i)).set(new Uint8Array(e,t,i)),r.buffer.fileStart=e.fileStart+t,r.buffer.usedBytes=0,r.buffer},c.prototype.insertBuffer=function(e){for(var t=!0,i=0;ir.byteLength){this.buffers.splice(i,1),i--;continue}n.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=r.fileStart||(e=this.reduceBuffer(e,0,r.fileStart-e.fileStart)),n.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(i,0,e),0===i&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,s,a)}}t&&(n.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===i&&(this.buffer=e))},c.prototype.logBufferLevel=function(e){var t,i,r,s,a,o=[],d="";for(r=0,s=0,t=0;t0&&(d+=a.end-1+"]");var l=e?n.info:n.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+r+"/"+s+" bytes), continuous ranges: "+d)},c.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},c.prototype.findPosition=function(e,t,i){var r,s=null,a=-1;for(r=!0===e?0:this.bufferIndex;r=t?(n.debug("MultiBufferStream","Found position in existing buffer #"+a),a):-1},c.prototype.findEndContiguousBuf=function(e){var t,i,r,s=void 0!==e?e:this.bufferIndex;if(i=this.buffers[s],this.buffers.length>s+1)for(t=s+1;t>3;return 31===r&&i.data.length>=2&&(r=32+((7&i.data[0])<<3)+((224&i.data[1])>>5)),r}return null},i.DecoderConfigDescriptor=function(e){i.Descriptor.call(this,4,e)},i.DecoderConfigDescriptor.prototype=new i.Descriptor,i.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},i.DecoderSpecificInfo=function(e){i.Descriptor.call(this,5,e)},i.DecoderSpecificInfo.prototype=new i.Descriptor,i.SLConfigDescriptor=function(e){i.Descriptor.call(this,6,e)},i.SLConfigDescriptor.prototype=new i.Descriptor,this};t.MPEG4DescriptorParser=u;var h={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){h.FullBox.prototype=new h.Box,h.ContainerBox.prototype=new h.Box,h.SampleEntry.prototype=new h.Box,h.TrackGroupTypeBox.prototype=new h.FullBox,h.BASIC_BOXES.forEach((function(e){h.createBoxCtor(e)})),h.FULL_BOXES.forEach((function(e){h.createFullBoxCtor(e)})),h.CONTAINER_BOXES.forEach((function(e){h.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,i){this.type=e,this.size=t,this.uuid=i},FullBox:function(e,t,i){h.Box.call(this,e,t,i),this.flags=0,this.version=0},ContainerBox:function(e,t,i){h.Box.call(this,e,t,i),this.boxes=[]},SampleEntry:function(e,t,i,r){h.ContainerBox.call(this,e,t),this.hdr_size=i,this.start=r},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){h.FullBox.call(this,e,t)},createBoxCtor:function(e,t){h.boxCodes.push(e),h[e+"Box"]=function(t){h.Box.call(this,e,t)},h[e+"Box"].prototype=new h.Box,t&&(h[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){h[e+"Box"]=function(t){h.FullBox.call(this,e,t)},h[e+"Box"].prototype=new h.FullBox,h[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,i=0;ii?(n.error("BoxParser","Box of type '"+c+"' has a size "+l+" greater than its container size "+i),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):0!==l&&o+l>e.getEndPosition()?(e.seek(o),n.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):t?{code:h.OK,type:c,size:l,hdr_size:d,start:o}:(h[c+"Box"]?r=new h[c+"Box"](l):"uuid"!==c?(n.warn("BoxParser","Unknown box type: '"+c+"'"),(r=new h.Box(c,l)).has_unparsed_data=!0):h.UUIDBoxes[a]?r=new h.UUIDBoxes[a](l):(n.warn("BoxParser","Unknown uuid type: '"+a+"'"),(r=new h.Box(c,l)).uuid=a,r.has_unparsed_data=!0),r.hdr_size=d,r.start=o,r.write===h.Box.prototype.write&&"mdat"!==r.type&&(n.info("BoxParser","'"+u+"' box writing not yet implemented, keeping unparsed data in memory for later write"),r.parseDataAndRewind(e)),r.parse(e),(s=e.getPosition()-(r.start+r.size))<0?(n.warn("BoxParser","Parsing of box '"+u+"' did not read the entire indicated box data size (missing "+-s+" bytes), seeking forward"),e.seek(r.start+r.size)):s>0&&(n.error("BoxParser","Parsing of box '"+u+"' read "+s+" more bytes than the indicated box data size, seeking backwards"),0!==r.size&&e.seek(r.start+r.size)),{code:h.OK,box:r,size:r.size})},h.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},h.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},h.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.ContainerBox.prototype.parse=function(e){for(var t,i;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},h.SAMPLE_ENTRY_TYPE_VISUAL="Visual",h.SAMPLE_ENTRY_TYPE_AUDIO="Audio",h.SAMPLE_ENTRY_TYPE_HINT="Hint",h.SAMPLE_ENTRY_TYPE_METADATA="Metadata",h.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",h.SAMPLE_ENTRY_TYPE_SYSTEM="System",h.SAMPLE_ENTRY_TYPE_TEXT="Text",h.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},h.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},h.SampleEntry.prototype.parseFooter=function(e){h.ContainerBox.prototype.parse.call(this,e)},h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_HINT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT,"enct"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA,"encm"),h.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var i=0;i<3;i++)this.layer_size[i]=16==t?e.readUint16():e.readUint32()})),h.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),h.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),h.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)n.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void n.error("av1C reserved_2 parsing problem");var i=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(i)}else n.error("av1C reserved_1 parsing problem");else n.error("av1C version "+this.version+" not supported")})),h.createBoxCtor("avcC",(function(e){var t,i;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),i=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(i))})),h.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),h.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),h.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),h.createFullBoxCtor("co64",(function(e){var t,i;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(i=0;i>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),h.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),h.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),h.createFullBoxCtor("ctts",(function(e){var t,i;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(i=0;i>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|i>>6&3,this.acmod=i>>3&7,this.lfeon=i>>2&1,this.bit_rate_code=3&i|r>>5&7})),h.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var i=0;i>6,r.bsid=s>>1&31,r.bsmod=(1&s)<<4|a>>4&15,r.acmod=a>>1&7,r.lfeon=1&a,r.num_dep_sub=n>>1&15,r.num_dep_sub>0&&(r.chan_loc=(1&n)<<8|e.readUint8())}})),h.createFullBoxCtor("dfLa",(function(e){var t=[],i=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var r=e.readUint8(),s=Math.min(127&r,i.length-1);if(s?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(i[s]),128&r)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),h.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[i]=e.readString(4),t-=4,i++})),h.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),h.createBoxCtor("hvcC",(function(e){var t,i,r,s;this.configurationVersion=e.readUint8(),s=e.readUint8(),this.general_profile_space=s>>6,this.general_tier_flag=(32&s)>>5,this.general_profile_idc=31&s,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),s=e.readUint8(),this.constantFrameRate=s>>6,this.numTemporalLayers=(13&s)>>3,this.temporalIdNested=(4&s)>>2,this.lengthSizeMinusOne=3&s,this.nalu_arrays=[];var a=e.readUint8();for(t=0;t>7,n.nalu_type=63&s;var o=e.readUint16();for(i=0;i>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var i=0;if(this.version<2)i=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";i=e.readUint32()}for(var r=0;r>7,this.axis=1&t})),h.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),n.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),h.createFullBoxCtor("ipma",(function(e){var t,i;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?n.property_index=(127&a)<<8|e.readUint8():n.property_index=127&a}}})),h.createFullBoxCtor("iref",(function(e){var t,i;for(this.references=[];e.getPosition()>7,r.assignment_type=127&s,r.assignment_type){case 0:r.grouping_type=e.readString(4);break;case 1:r.grouping_type=e.readString(4),r.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:r.sub_track_id=e.readUint32();break;default:n.warn("BoxParser","Unknown leva assignement type")}}})),h.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),h.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),f.prototype.toString=function(){return"("+this.x+","+this.y+")"},h.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new f(e.readUint16(),e.readUint16()),this.display_primaries[1]=new f(e.readUint16(),e.readUint16()),this.display_primaries[2]=new f(e.readUint16(),e.readUint16()),this.white_point=new f(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),h.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),h.createFullBoxCtor("mehd",(function(e){1&this.flags&&(n.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),h.createFullBoxCtor("meta",(function(e){this.boxes=[],h.ContainerBox.prototype.parse.call(this,e)})),h.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),h.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),h.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),h.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),h.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),h.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),h.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var i=0;i0){var t=e.readUint32();this.kid=[];for(var i=0;i0&&(this.data=e.readUint8Array(r))})),h.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),h.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),h.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var i=0;i>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var i=e.readUint8(),r=0;r>7,this.num_leading_samples=127&t})),h.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)n.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=h.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),h.createSampleGroupCtor("stsa",(function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),h.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),h.createSampleGroupCtor("tsas",(function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("tscl",(function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("vipr",(function(e){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),i=0;i>6,this.sample_depends_on[r]=t>>4&3,this.sample_is_depended_on[r]=t>>2&3,this.sample_has_redundancy[r]=3&t})),h.createFullBoxCtor("senc"),h.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),n.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),i=0;i>31&1,r.referenced_size=2147483647&s,r.subsegment_duration=e.readUint32(),s=e.readUint32(),r.starts_with_SAP=s>>31&1,r.SAP_type=s>>28&7,r.SAP_delta_time=268435455&s}})),h.SingleItemTypeReferenceBox=function(e,t,i,r){h.Box.call(this,e,t),this.hdr_size=i,this.start=r},h.SingleItemTypeReferenceBox.prototype=new h.Box,h.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var i=0;i>4&15,this.sample_sizes[t+1]=15&r}else if(8===this.field_size)for(t=0;t0)for(i=0;i>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=h.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),h.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),h.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),h.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var i=e.readUint32(),r=0;r>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),h.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),h.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),h.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},h.createTrackGroupCtor("msrc"),h.TrackReferenceTypeBox=function(e,t,i,r){h.Box.call(this,e,t),this.hdr_size=i,this.start=r},h.TrackReferenceTypeBox.prototype=new h.Box,h.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},h.trefBox.prototype.parse=function(e){for(var t,i;e.getPosition()t&&this.flags&h.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var i=0;i>7&1,this.block_pad_lsb=i>>6&1,this.block_little_endian=i>>5&1,this.block_reversed=i>>4&1,this.pad_unknown=i>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),h.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),h.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),h.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),h.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=h.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),h.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),h.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=h.parseHex16(e)})),h.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),h.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),h.createFullBoxCtor("vvcC",(function(e){var t,i,r={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(r.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,i=this.num_sublayers-2;i>=0;--i){var n=r.extract_bits(1);this.ptl_sublayer_present_mask|=n<1;++i)r.extract_bits(1);for(this.sublayer_level_idc=[],i=this.num_sublayers-2;i>=0;--i)this.ptl_sublayer_present_mask&1<>=1;t+=h.decimalToHex(r,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var s=!1,a="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||s)&&(a="."+h.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+a,s=!0);t+=a}return t},h.vvc1SampleEntry.prototype.getCodec=h.vvi1SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var i="";if(this.vvcC.general_constraint_info){var r,s=[],a=0;for(a|=this.vvcC.ptl_frame_only_constraint<<7,a|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,s.push(a),a&&(r=e),a=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===r)i=".CA";else{i=".C";var n="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",o=0,d=0;for(e=0;e<=r;++e)for(o=o<<8|s[e],d+=8;d>=5;){i+=n[o>>d-5&31],o&=(1<<(d-=5))-1}d&&(i+=n[31&(o<<=5-d)])}}t+=i}return t},h.mp4aSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),i=this.esds.esd.getAudioConfig();return e+"."+h.decimalToHex(t)+(i?"."+i:"")}return e},h.stxtSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},h.vp08SampleEntry.prototype.getCodec=h.vp09SampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var i=this.vpcC.bitDepth;return 8==i&&(i="08"),e+".0"+this.vpcC.profile+"."+t+"."+i},h.av01SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this),i=this.av1C.seq_level_idx_0;return i<10&&(i="0"+i),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+i+(this.av1C.seq_tier_0?"H":"M")+"."+e},h.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),n.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>l?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>l&&e.writeUint64(this.size)},h.FullBox.prototype.writeHeader=function(e){this.size+=4,h.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},h.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},h.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},h.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},h.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},h.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},h.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&h.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&h.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&h.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&h.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[i]instanceof h.Box||t[i]instanceof h.Box||void 0===e[i]||void 0===t[i]||"function"==typeof e[i]||"function"==typeof t[i]||e.subBoxNames&&e.subBoxNames.indexOf(i.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(i.slice(0,4))>-1||"data"===i||"start"===i||"size"===i||"creation_time"===i||"modification_time"===i||h.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(i)>-1||e[i]===t[i]))return!1;return!0},h.boxEqual=function(e,t){if(!h.boxEqualFields(e,t))return!1;for(var i=0;i1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},g.prototype.setExtractionOptions=function(e,t,i){var r=this.getTrackById(e);if(r){var s={};this.extractedTracks.push(s),s.id=e,s.user=t,s.trak=r,r.nextSample=0,s.nb_samples=1e3,s.samples=[],i&&i.nbSamples&&(s.nb_samples=i.nbSamples)}},g.prototype.unsetExtractionOptions=function(e){for(var t=-1,i=0;i-1&&this.extractedTracks.splice(t,1)},g.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=h.parseOneBox(this.stream,false)).code===h.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var i;switch(i="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),i){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[i]&&n.warn("ISOFile","Duplicate Box of type: "+i+", overriding previous occurrence"),this[i]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},g.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(n.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(n.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(n.warn("ISOFile","Not ready to start parsing"),!1))},g.prototype.appendBuffer=function(e,t){var i;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(i=this.nextSeekPosition,this.nextSeekPosition=void 0):i=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(i=this.stream.getEndFilePositionAfter(i))):i=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(n.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+i),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),n.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),i},g.prototype.getInfo=function(){var e,t,i,r,s,a,n={},o=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(n.hasMoov=!0,n.duration=this.moov.mvhd.duration,n.timescale=this.moov.mvhd.timescale,n.isFragmented=null!=this.moov.mvex,n.isFragmented&&this.moov.mvex.mehd&&(n.fragment_duration=this.moov.mvex.mehd.fragment_duration),n.isProgressive=this.isProgressive,n.hasIOD=null!=this.moov.iods,n.brands=[],n.brands.push(this.ftyp.major_brand),n.brands=n.brands.concat(this.ftyp.compatible_brands),n.created=new Date(o+1e3*this.moov.mvhd.creation_time),n.modified=new Date(o+1e3*this.moov.mvhd.modification_time),n.tracks=[],n.audioTracks=[],n.videoTracks=[],n.subtitleTracks=[],n.metadataTracks=[],n.hintTracks=[],n.otherTracks=[],e=0;e0?n.mime+='video/mp4; codecs="':n.audioTracks&&n.audioTracks.length>0?n.mime+='audio/mp4; codecs="':n.mime+='application/mp4; codecs="',e=0;e=i.samples.length)&&(n.info("ISOFile","Sending fragmented data on track #"+r.id+" for samples ["+Math.max(0,i.nextSample-r.nb_samples)+","+(i.nextSample-1)+"]"),n.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(r.id,r.user,r.segmentStream.buffer,i.nextSample,e||i.nextSample>=i.samples.length),r.segmentStream=null,r!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=i.samples.length)&&(n.debug("ISOFile","Sending samples on track #"+a.id+" for sample "+i.nextSample),this.onSamples&&this.onSamples(a.id,a.user,a.samples),a.samples=[],a!==this.extractedTracks[t]))break}}}},g.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},g.prototype.getBoxes=function(e,t){var i=[];return g._sweep.call(this,e,i,t),i},g._sweep=function(e,t,i){for(var r in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&i)return;g._sweep.call(this.boxes[r],e,t,i)}},g.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},g.prototype.getTrackSample=function(e,t){var i=this.getTrackById(e);return this.getSample(i,t)},g.prototype.releaseUsedSamples=function(e,t,i){var r=0,s=this.getTrackById(e);s.lastValidSample||(s.lastValidSample=0);for(var a=s.lastValidSample;ae*s.timescale){l=r-1;break}t&&s.is_sync&&(d=r)}for(t&&(l=d),e=i.samples[l].cts,i.nextSample=l;i.samples[l].alreadyRead===i.samples[l].size&&i.samples[l+1];)l++;return a=i.samples[l].offset+i.samples[l].alreadyRead,n.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+i.nextSample+" on track "+i.tkhd.track_id+", time "+n.getDurationString(e,o)+" and offset: "+a),{offset:a,time:e/o}},g.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},g.prototype.seek=function(e,t){var i,r,s,a=this.moov,o={offset:1/0,time:1/0};if(this.moov){for(s=0;sthis.getTrackDuration(i)||((r=this.seekTrack(e,t,i)).offset-1){n=d;break}switch(n){case"Visual":if(s.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),a.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var u=new h.avcCBox;u.parse(new o(t.avcDecoderConfigRecord)),a.addBox(u)}else if(t.hevcDecoderConfigRecord){var f=new h.hvcCBox;f.parse(new o(t.hevcDecoderConfigRecord)),a.addBox(f)}break;case"Audio":s.add("smhd").set("balance",t.balance||0),a.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":s.add("hmhd");break;case"Subtitle":if(s.add("sthd"),"stpp"===t.type)a.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:s.add("nmhd")}t.description&&a.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){a.addBox(e)})),s.add("dinf").add("dref").addEntry((new h["url Box"]).set("flags",1));var p=s.add("stbl");return p.add("stsd").addEntry(a),p.add("stts").set("sample_counts",[]).set("sample_deltas",[]),p.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),p.add("stco").set("chunk_offsets",[]),p.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(i),t.id}},h.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},g.prototype.addSample=function(e,t,i){var r=i||{},s={},a=this.getTrackById(e);if(null!==a){s.number=a.samples.length,s.track_id=a.tkhd.track_id,s.timescale=a.mdia.mdhd.timescale,s.description_index=r.sample_description_index?r.sample_description_index-1:0,s.description=a.mdia.minf.stbl.stsd.entries[s.description_index],s.data=t,s.size=t.byteLength,s.alreadyRead=s.size,s.duration=r.duration||1,s.cts=r.cts||0,s.dts=r.dts||0,s.is_sync=r.is_sync||!1,s.is_leading=r.is_leading||0,s.depends_on=r.depends_on||0,s.is_depended_on=r.is_depended_on||0,s.has_redundancy=r.has_redundancy||0,s.degradation_priority=r.degradation_priority||0,s.offset=0,s.subsamples=r.subsamples,a.samples.push(s),a.samples_size+=s.size,a.samples_duration+=s.duration,void 0===a.first_dts&&(a.first_dts=r.dts),this.processSamples();var n=this.createSingleSampleMoof(s);return this.addBox(n),n.computeSize(),n.trafs[0].truns[0].data_offset=n.size+8,this.add("mdat").data=new Uint8Array(t),s}},g.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var i=new h.moofBox;i.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var r=i.add("traf"),s=this.getTrackById(e.track_id);return r.add("tfhd").set("track_id",e.track_id).set("flags",h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),r.add("tfdt").set("baseMediaDecodeTime",e.dts-(s.first_dts||0)),r.add("trun").set("flags",h.TRUN_FLAGS_DATA_OFFSET|h.TRUN_FLAGS_DURATION|h.TRUN_FLAGS_SIZE|h.TRUN_FLAGS_FLAGS|h.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),i},g.prototype.lastMoofIndex=0,g.prototype.samplesDataSize=0,g.prototype.resetTables=function(){var e,t,i,r,s,a;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(d=s[n].grouping_type+"/0",(o=new l(s[n].grouping_type,0)).is_fragment=!0,t.sample_groups_info[d]||(t.sample_groups_info[d]=o))}else for(n=0;n=2&&(d=r[n].grouping_type+"/0",o=new l(r[n].grouping_type,0),e.sample_groups_info[d]||(e.sample_groups_info[d]=o))},g.setSampleGroupProperties=function(e,t,i,r){var s,a;for(s in t.sample_groups=[],r){var n;if(t.sample_groups[s]={},t.sample_groups[s].grouping_type=r[s].grouping_type,t.sample_groups[s].grouping_type_parameter=r[s].grouping_type_parameter,i>=r[s].last_sample_in_run&&(r[s].last_sample_in_run<0&&(r[s].last_sample_in_run=0),r[s].entry_index++,r[s].entry_index<=r[s].sbgp.entries.length-1&&(r[s].last_sample_in_run+=r[s].sbgp.entries[r[s].entry_index].sample_count)),r[s].entry_index<=r[s].sbgp.entries.length-1?t.sample_groups[s].group_description_index=r[s].sbgp.entries[r[s].entry_index].group_description_index:t.sample_groups[s].group_description_index=-1,0!==t.sample_groups[s].group_description_index)n=r[s].fragment_description?r[s].fragment_description:r[s].description,t.sample_groups[s].group_description_index>0?(a=t.sample_groups[s].group_description_index>65535?(t.sample_groups[s].group_description_index>>16)-1:t.sample_groups[s].group_description_index-1,n&&a>=0&&(t.sample_groups[s].description=n.entries[a])):n&&n.version>=2&&n.default_group_description_index>0&&(t.sample_groups[s].description=n.entries[n.default_group_description_index-1])}},g.process_sdtp=function(e,t,i){t&&(e?(t.is_leading=e.is_leading[i],t.depends_on=e.sample_depends_on[i],t.is_depended_on=e.sample_is_depended_on[i],t.has_redundancy=e.sample_has_redundancy[i]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},g.prototype.buildSampleLists=function(){var e,t;for(e=0;eb&&(v++,b<0&&(b=0),b+=a.sample_counts[v]),t>0?(e.samples[t-1].duration=a.sample_deltas[v],e.samples_duration+=e.samples[t-1].duration,x.dts=e.samples[t-1].dts+e.samples[t-1].duration):x.dts=0,n?(t>=S&&(w++,S<0&&(S=0),S+=n.sample_counts[w]),x.cts=e.samples[t].dts+n.sample_offsets[w]):x.cts=x.dts,o?(t==o.sample_numbers[A]-1?(x.is_sync=!0,A++):(x.is_sync=!1,x.degradation_priority=0),l&&l.entries[B].sample_delta+U==t+1&&(x.subsamples=l.entries[B].subsamples,U+=l.entries[B].sample_delta,B++)):x.is_sync=!0,g.process_sdtp(e.mdia.minf.stbl.sdtp,x,x.number),x.degradation_priority=h?h.priority[t]:0,l&&l.entries[B].sample_delta+U==t&&(x.subsamples=l.entries[B].subsamples,U+=l.entries[B].sample_delta),(c.length>0||u.length>0)&&g.setSampleGroupProperties(e,x,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},g.prototype.updateSampleLists=function(){var e,t,i,r,s,a,n,o,d,l,c,u,f,p,_;if(void 0!==this.moov)for(;this.lastMoofIndex0&&g.initSampleGroups(u,c,c.sbgps,u.mdia.minf.stbl.sgpds,c.sgpds),t=0;t0?p.dts=u.samples[u.samples.length-2].dts+u.samples[u.samples.length-2].duration:(c.tfdt?p.dts=c.tfdt.baseMediaDecodeTime:p.dts=0,u.first_traf_merged=!0),p.cts=p.dts,m.flags&h.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+m.sample_composition_time_offset[i]),_=n,m.flags&h.TRUN_FLAGS_FLAGS?_=m.sample_flags[i]:0===i&&m.flags&h.TRUN_FLAGS_FIRST_FLAG&&(_=m.first_sample_flags),p.is_sync=!(_>>16&1),p.is_leading=_>>26&3,p.depends_on=_>>24&3,p.is_depended_on=_>>22&3,p.has_redundancy=_>>20&3,p.degradation_priority=65535&_;var y=!!(c.tfhd.flags&h.TFHD_FLAG_BASE_DATA_OFFSET),b=!!(c.tfhd.flags&h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),v=!!(m.flags&h.TRUN_FLAGS_DATA_OFFSET),S=0;S=y?c.tfhd.base_data_offset:b||0===t?l.start:o,p.offset=0===t&&0===i?v?S+m.data_offset:S:o,o=p.offset+p.size,(c.sbgps.length>0||c.sgpds.length>0||u.mdia.minf.stbl.sbgps.length>0||u.mdia.minf.stbl.sgpds.length>0)&&g.setSampleGroupProperties(u,p,p.number_in_traf,c.sample_groups_info)}}if(c.subs){u.has_fragment_subsamples=!0;var w=c.first_sample_index;for(t=0;t-1))return null;var a=(i=this.stream.buffers[s]).byteLength-(r.offset+r.alreadyRead-i.fileStart);if(r.size-r.alreadyRead<=a)return n.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-i.fileStart)+" read size: "+(r.size-r.alreadyRead)+" full size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,i,r.offset+r.alreadyRead-i.fileStart,r.size-r.alreadyRead),i.usedBytes+=r.size-r.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead=r.size,r;if(0===a)return null;n.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-i.fileStart)+" read size: "+a+" full size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,i,r.offset+r.alreadyRead-i.fileStart,a),r.alreadyRead+=a,i.usedBytes+=a,this.stream.logBufferLevel()}},g.prototype.releaseSample=function(e,t){var i=e.samples[t];return i.data?(this.samplesDataSize-=i.size,i.data=null,i.description=null,delete i.degradation_priority,delete i.depends_on,delete i.description_index,delete i.has_redundancy,delete i.is_depended_on,delete i.is_leading,delete i.is_sync,delete i.moof_number,delete i.number_in_traf,delete i.timescale,delete i.cts,delete i.dts,delete i.offset,delete i.size,delete i.track_id,delete i.duration,i.alreadyRead=0,i.size):0},g.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},g.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},g.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(i.protection=a.ipro.protections[a.iinf.item_infos[e].protection_index-1]),a.iinf.item_infos[e].item_type?i.type=a.iinf.item_infos[e].item_type:i.type="mime",i.content_type=a.iinf.item_infos[e].content_type,i.content_encoding=a.iinf.item_infos[e].content_encoding;if(a.grpl)for(e=0;e0&&h.property_index-1-1))return null;var o=(t=this.stream.buffers[a]).byteLength-(s.offset+s.alreadyRead-t.fileStart);if(!(s.length-s.alreadyRead<=o))return n.debug("ISOFile","Getting item #"+e+" extent #"+r+" partial data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-t.fileStart)+" read size: "+o+" full extent size: "+s.length+" full item size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,t,s.offset+s.alreadyRead-t.fileStart,o),s.alreadyRead+=o,i.alreadyRead+=o,t.usedBytes+=o,this.stream.logBufferLevel(),null;n.debug("ISOFile","Getting item #"+e+" extent #"+r+" data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-t.fileStart)+" read size: "+(s.length-s.alreadyRead)+" full extent size: "+s.length+" full item size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,t,s.offset+s.alreadyRead-t.fileStart,s.length-s.alreadyRead),t.usedBytes+=s.length-s.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead+=s.length-s.alreadyRead,s.alreadyRead=s.length}}return i.alreadyRead===i.size?i:null},g.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var i=0;i0?this.moov.traks[e].samples[0].duration:0),t.push(r)}return t},g.prototype.getPerformanceInfo=function(){var e={};return e.moov=this.moov,this.moov&&this.moov.traks&&this.moov.traks.length>1&&(e.moovAudioNum=this.moov.traks[0].samples.length,e.moovVideoNum=this.moov.traks[1].samples.length),e},h.Box.prototype.printHeader=function(e){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},h.FullBox.prototype.printHeader=function(e){this.size+=4,h.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},h.Box.prototype.print=function(e){this.printHeader(e)},h.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},h.tkhdBox.prototype.print=function(e){h.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var y={createFile:function(e,t){var i=void 0===e||e,r=new g(t);return r.discardMdatData=!i,r}};t.createFile=y.createFile}));function Nr(e){return e.reduce(((e,t)=>256*e+t))}function Gr(e){const t=[101,103,119,99],i=e.length-28,r=e.slice(i,i+t.length);return t.every(((e,t)=>e===r[t]))}Rr.Log,Rr.MP4BoxStream,Rr.DataStream,Rr.MultiBufferStream,Rr.MPEG4DescriptorParser,Rr.BoxParser,Rr.XMLSubtitlein4Parser,Rr.Textin4Parser,Rr.ISOFile,Rr.createFile;class Or{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(i+32,i+32+t))]}return null}(t,this.t);if(!i)return e;const r=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(r instanceof Error)return console.error(r.message),this.d=!0,e;this.A=!0,this.u=i[1],Gr(t)&&this.c++,WebAssembly.instantiate(i[2],r).then((e=>{if("function"!=typeof(t=e.instance.exports).parse||"object"!=typeof t.memory)return this.d=!0,void console.error("video_error_3");var t;this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}function Hr(){for(var e=arguments.length,t=new Array(e),i=0;i{const i=new r((0|e.byteLength)+(0|t.byteLength));return i.set(e,0),i.set(t,0|e.byteLength),i}),new r)}const Vr=16,$r=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],Wr=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Yr(e){const t=[];for(let i=0,r=e.length;i1===(e=e.toString(16)).length?"0"+e:e)).join("")}function jr(e){const t=[];for(let i=0,r=e.length;i>>6),t.push(128|63&r);else if(r<=55295||r>=57344&&r<=65535)t.push(224|r>>>12),t.push(128|r>>>6&63),t.push(128|63&r);else{if(!(r>=65536&&r<=1114111))throw t.push(r),new Error("input is not supported");i++,t.push(240|r>>>18&28),t.push(128|r>>>12&63),t.push(128|r>>>6&63),t.push(128|63&r)}}return t}function Kr(e){const t=[];for(let i=0,r=e.length;i=240&&e[i]<=247?(t.push(String.fromCodePoint(((7&e[i])<<18)+((63&e[i+1])<<12)+((63&e[i+2])<<6)+(63&e[i+3]))),i+=3):e[i]>=224&&e[i]<=239?(t.push(String.fromCodePoint(((15&e[i])<<12)+((63&e[i+1])<<6)+(63&e[i+2]))),i+=2):e[i]>=192&&e[i]<=223?(t.push(String.fromCodePoint(((31&e[i])<<6)+(63&e[i+1]))),i++):t.push(String.fromCodePoint(e[i]));return t.join("")}function Xr(e,t){const i=31&t;return e<>>32-i}function Zr(e){return(255&$r[e>>>24&255])<<24|(255&$r[e>>>16&255])<<16|(255&$r[e>>>8&255])<<8|255&$r[255&e]}function Jr(e){return e^Xr(e,2)^Xr(e,10)^Xr(e,18)^Xr(e,24)}function Qr(e){return e^Xr(e,13)^Xr(e,23)}function es(e,t,i){const r=new Array(4),s=new Array(4);for(let t=0;t<4;t++)s[0]=255&e[4*t],s[1]=255&e[4*t+1],s[2]=255&e[4*t+2],s[3]=255&e[4*t+3],r[t]=s[0]<<24|s[1]<<16|s[2]<<8|s[3];for(let e,t=0;t<32;t+=4)e=r[1]^r[2]^r[3]^i[t+0],r[0]^=Jr(Zr(e)),e=r[2]^r[3]^r[0]^i[t+1],r[1]^=Jr(Zr(e)),e=r[3]^r[0]^r[1]^i[t+2],r[2]^=Jr(Zr(e)),e=r[0]^r[1]^r[2]^i[t+3],r[3]^=Jr(Zr(e));for(let e=0;e<16;e+=4)t[e]=r[3-e/4]>>>24&255,t[e+1]=r[3-e/4]>>>16&255,t[e+2]=r[3-e/4]>>>8&255,t[e+3]=255&r[3-e/4]}function ts(e,t,i){const r=new Array(4),s=new Array(4);for(let t=0;t<4;t++)s[0]=255&e[0+4*t],s[1]=255&e[1+4*t],s[2]=255&e[2+4*t],s[3]=255&e[3+4*t],r[t]=s[0]<<24|s[1]<<16|s[2]<<8|s[3];r[0]^=2746333894,r[1]^=1453994832,r[2]^=1736282519,r[3]^=2993693404;for(let e,i=0;i<32;i+=4)e=r[1]^r[2]^r[3]^Wr[i+0],t[i+0]=r[0]^=Qr(Zr(e)),e=r[2]^r[3]^r[0]^Wr[i+1],t[i+1]=r[1]^=Qr(Zr(e)),e=r[3]^r[0]^r[1]^Wr[i+2],t[i+2]=r[2]^=Qr(Zr(e)),e=r[0]^r[1]^r[2]^Wr[i+3],t[i+3]=r[3]^=Qr(Zr(e));if(0===i)for(let e,i=0;i<16;i++)e=t[i],t[i]=t[31-i],t[31-i]=e}function is(e,t,i){let{padding:r="pkcs#7",mode:s,iv:a=[],output:n="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===s&&("string"==typeof a&&(a=Yr(a)),16!==a.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=Yr(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==i?jr(e):Yr(e):[...e],("pkcs#5"===r||"pkcs#7"===r)&&0!==i){const t=Vr-e.length%Vr;for(let i=0;i=Vr;){const t=e.slice(u,u+16),r=new Array(16);if("cbc"===s)for(let e=0;e2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=e.byteLength;let a=new Uint8Array(e.slice(0,5)),n=5;for(;ns){const t=new Uint8Array(a.length+e.length-n);t.set(a,0),t.set(e.slice(n),a.length),a=t;break}let l=e[n+4],c=!1,u=2;if(i?(r&&(u=3),l=l>>>1&63,c=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(l)):(l&=31,c=1===l||5===l),c){const i=is(e.slice(n+4+u,n+4+d),t,0,{padding:"none",output:"array"});let r=i[i.length-1];if(r>0&&r<16){let e=!0;for(let t=1;t<=r;t++)if(i[i.length-t]!==r){e=!1;break}e&&i.splice(i.length-r,r)}const s=new Uint8Array(u);s.set(e.slice(n+4,n+4+u),0);const o=Qt(Hr(s,new Uint8Array(i))),l=new Uint8Array(a.length+o.length);l.set(a,0),l.set(o,a.length),a=l}else{const t=e.slice(n+4,n+4+d),i=new Uint8Array(a.length+4+t.length);i.set(a,0),i.set(o,a.length),i.set(t,a.length+4),a=i}n=n+4+d}return a}const as={init:0,findFirstStartCode:1,findSecondStartCode:2};class ns extends class{on(e,t,i){const r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:i}),this}once(e,t,i){const r=this;function s(){r.off(e,s);for(var a=arguments.length,n=new Array(a),o=0;o1?i-1:0),s=1;s{delete i[e]})),void delete this.e;const r=i[e],s=[];if(r&&t)for(let e=0,i=r.length;e=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=as.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==as.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=as.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==as.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=as.findFirstStartCode}}}}function os(e,t,i){for(let r=2;r3&&void 0!==arguments[3]&&arguments[3];const s=e.byteLength;let a=5;for(;as)break;let o=e[a+4],d=!1;if(r?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const r=os(e.slice(a+4,a+4+n),t,i);e.set(r,a+4)}a=a+4+n}return e}function cs(){for(var e=arguments.length,t=new Array(e),i=0;ie+t.byteLength),0));let s=0;return t.forEach((e=>{r.set(e,s),s+=e.byteLength})),r}class us{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,i,r)));e.addEventListener(t,i,r);const s=()=>{oi(e.removeEventListener)&&e.removeEventListener(t,i,r)};return this.destroys.push(s),s}destroy(){this.master.debugLog("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class hs{static init(){hs.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in hs.types)hs.types.hasOwnProperty(e)&&(hs.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=hs.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,r=Array.prototype.slice.call(arguments,1),s=r.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let a=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return hs.box(hs.types.trak,hs.tkhd(e),hs.mdia(e))}static tkhd(e){let t=e.id,i=e.duration,r=e.presentWidth,s=e.presentHeight;return hs.box(hs.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>>8&255,255&r,0,0,s>>>8&255,255&s,0,0]))}static mdia(e){return hs.box(hs.types.mdia,hs.mdhd(e),hs.hdlr(e),hs.minf(e))}static mdhd(e){let t=e.timescale,i=e.duration;return hs.box(hs.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?hs.constants.HDLR_AUDIO:hs.constants.HDLR_VIDEO,hs.box(hs.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?hs.box(hs.types.smhd,hs.constants.SMHD):hs.box(hs.types.vmhd,hs.constants.VMHD),hs.box(hs.types.minf,t,hs.dinf(),hs.stbl(e))}static dinf(){return hs.box(hs.types.dinf,hs.box(hs.types.dref,hs.constants.DREF))}static stbl(e){return hs.box(hs.types.stbl,hs.stsd(e),hs.box(hs.types.stts,hs.constants.STTS),hs.box(hs.types.stsc,hs.constants.STSC),hs.box(hs.types.stsz,hs.constants.STSZ),hs.box(hs.types.stco,hs.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?hs.box(hs.types.stsd,hs.constants.STSD_PREFIX,hs.mp3(e)):hs.box(hs.types.stsd,hs.constants.STSD_PREFIX,hs.mp4a(e)):"avc"===e.videoType?hs.box(hs.types.stsd,hs.constants.STSD_PREFIX,hs.avc1(e)):hs.box(hs.types.stsd,hs.constants.STSD_PREFIX,hs.hvc1(e))}static mp3(e){let t=e.channelCount,i=e.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return hs.box(hs.types[".mp3"],r)}static mp4a(e){let t=e.channelCount,i=e.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return hs.box(hs.types.mp4a,r,hs.esds(e))}static esds(e){let t=e.config||[],i=t.length,r=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return hs.box(hs.types.esds,r)}static avc1(e){let t=e.avcc;const i=e.codecWidth,r=e.codecHeight;let s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,r>>>8&255,255&r,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return hs.box(hs.types.avc1,s,hs.box(hs.types.avcC,t))}static hvc1(e){let t=e.avcc;const i=e.codecWidth,r=e.codecHeight;let s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,r>>>8&255,255&r,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return hs.box(hs.types.hvc1,s,hs.box(hs.types.hvcC,t))}static mvex(e){return hs.box(hs.types.mvex,hs.trex(e))}static trex(e){let t=e.id,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return hs.box(hs.types.trex,i)}static moof(e,t){return hs.box(hs.types.moof,hs.mfhd(e.sequenceNumber),hs.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return hs.box(hs.types.mfhd,t)}static traf(e,t){let i=e.id,r=hs.box(hs.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),s=hs.box(hs.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),a=hs.sdtp(e),n=hs.trun(e,a.byteLength+16+16+8+16+8+8);return hs.box(hs.types.traf,r,s,n,a)}static sdtp(e){let t=new Uint8Array(5),i=e.flags;return t[4]=i.isLeading<<6|i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy,hs.box(hs.types.sdtp,t)}static trun(e,t){let i=new Uint8Array(28);t+=36,i.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let r=e.duration,s=e.size,a=e.flags,n=e.cts;return i.set([r>>>24&255,r>>>16&255,r>>>8&255,255&r,s>>>24&255,s>>>16&255,s>>>8&255,255&s,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.isNonSync,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n],12),hs.box(hs.types.trun,i)}static mdat(e){return hs.box(hs.types.mdat,e)}}hs.init();var fs,ps=Nt((function(e){e.exports=function(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e},e.exports.__esModule=!0,e.exports.default=e.exports}));(fs=ps)&&fs.__esModule&&Object.prototype.hasOwnProperty.call(fs,"default")&&fs.default;const _s=[44100,48e3,32e3,0],ms=[22050,24e3,16e3,0],gs=[11025,12e3,8e3,0],ys=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],bs=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],vs=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];function Ss(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),i=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let r=t[1]>>>3&3,s=(6&t[1])>>1,a=(240&t[2])>>>4,n=(12&t[2])>>>2,o=3!==(t[3]>>>6&3)?2:1,d=0,l=0;switch(r){case 0:d=gs[n];break;case 2:d=ms[n];break;case 3:d=_s[n]}switch(s){case 1:a=e[s]&&t=6?(r=5,t=new Array(4),n=s-3):(r=2,t=new Array(2),n=s):-1!==o.indexOf("android")?(r=2,t=new Array(2),n=s):(r=5,n=s,t=new Array(4),s>=6?n=s-3:1===a&&(r=2,t=new Array(2),n=s)),t[0]=r<<3,t[0]|=(15&s)>>>1,t[1]=(15&s)<<7,t[1]|=(15&a)<<3,5===r&&(t[1]|=(15&n)>>>1,t[2]=(1&n)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=Ms[s],this.sampling_index=s,this.channel_count=a,this.object_type=r,this.original_object_type=i,this.codec_mimetype="mp4a.40."+r,this.original_codec_mimetype="mp4a.40."+i}}class Ns{constructor(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}get bitsAvailable(){return this.bitLength-this.index}skipBits(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}getBits(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>r,a=8-r;if(a>=e)return i&&(this.index+=e),s>>a-e;{i&&(this.index+=a);const r=e-a;return s<>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}function Gs(e){return e[3]|e[2]<<8|e[1]<<16|e[0]<<24}const Os=new Array(214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72),Hs=new Array(2746333894,1453994832,1736282519,2993693404),Vs=new Array(462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257);function $s(e,t,i,r,s){var a=s;a=t+s>e.length&&r+s<=i.length?e.length-t:r+s>i.length&&t+s<=e.length?i.length-r:t+s<=e.length&&r+s<=i.length?s:i.length>24&255,e>>16&255,e>>8&255,255&e)}function Ys(e,t){return t+3>>19)^(r<<23|r>>>9)}function Ks(e,t){var i=new Array(36);i[0]=Ys(t,0),i[1]=Ys(t,4),i[2]=Ys(t,8),i[3]=Ys(t,12);for(var r=0;r<32;r++)i[r+4]=i[r]^Xs(i[r+1]^i[r+2]^i[r+3]^e[r]);var s=new Array(4);for(r=35;r>=32;r--)s[35-r]=i[r];var a=function(e){for(var t=new Array(4*e.length),i=0;i>>30)^(r<<10|r>>>22)^(r<<18|r>>>14)^(r<<24|r>>>8)}function Zs(e,t,i){if(null==e||null==e||e.length%16!=0)return console.log("sm4 key is error!"),null;if(null==i||null==i||i.length<=0)return console.log("cipher is error!"),null;if(null==t||null==t||t.length%16!=0)return console.log("iv is error!"),null;for(var r=qs(e),s=Math.ceil(i.length/16),a=new Array(i.length),n=t.slice(),o=0;o3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t=new Uint8Array(t),i=new Uint8Array(i);const a=e.byteLength;let n=5;for(;na)break;let d=e[n+4],l=!1,c=2;if(r?(s&&(c=3),d=d>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(d)):(d&=31,l=1===d||5===d),l){const r=Zs(t,i,e.slice(n+4+c,n+4+o));e.set(r,n+4+c)}n=n+4+o}return e}Date.now||(Date.now=function(){return(new Date).getTime()}),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=[],s=[],a=null,n=null,o=null,d=null,l=null,c=null,b=!1,v=null,B=null,be=!1,ve=!1,Ve=!!_i(i),Ke=0,Xe=0,Je=!1,et=null,dt=null,St=null,wt=[],Ut=null,zt=null,Rt=0,Nt=0,Gt=null,Ot=null,Ht=0,qt=0,Zt=!1,ri=!1,bi=!1,vi=null,Si=null,wi=!1,xi=!0,Ni=()=>{const e=fi();return{debug:e.debug,debugLevel:e.debugLevel,debugUuid:e.debugUuid,useOffscreen:e.useOffscreen,useWCS:e.useWCS,useMSE:e.useMSE,videoBuffer:e.videoBuffer,videoBufferDelay:e.videoBufferDelay,openWebglAlignment:e.openWebglAlignment,playType:e.playType,hasAudio:e.hasAudio,hasVideo:e.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:e.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:e.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:0,networkDelay:e.networkDelay,visibility:!0,useSIMD:e.useSIMD,isRecording:!1,recordType:e.recordType,isNakedFlow:e.isNakedFlow,checkFirstIFrame:e.checkFirstIFrame,audioBufferSize:1024,isM7sCrypto:e.isM7sCrypto,m7sCryptoAudio:e.m7sCryptoAudio,cryptoKey:e.cryptoKey,cryptoIV:e.cryptoIV,isSm4Crypto:e.isSm4Crypto,isSm4CryptoH265V2:e.isSm4CryptoH265V2,sm4CryptoKey:e.sm4CryptoKey,isXorCrypto:e.isXorCrypto,isHls265:!1,isFlv:e.isFlv,isFmp4:e.isFmp4,isMpeg4:e.isMpeg4,isTs:e.isTs,isFmp4Private:e.isFmp4Private,isEmitSEI:e.isEmitSEI,isRecordTypeFlv:!1,isWasmMp4:!1,isChrome:!1,isFirefox:!1,isDropSameTimestampGop:e.isDropSameTimestampGop,mseDecodeAudio:e.mseDecodeAudio,wcsDecodeAudio:e.wcsDecodeAudio,nakedFlowH265DemuxUseNew:e.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:e.mseDecoderUseWorker,mseAutoCleanupSourceBuffer:e.mseAutoCleanupSourceBuffer,mseAutoCleanupMaxBackwardDuration:e.mseAutoCleanupMaxBackwardDuration,mseAutoCleanupMinBackwardDuration:e.mseAutoCleanupMinBackwardDuration,mseCorrectTimeDuration:e.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:e.mseCorrectAudioTimeDuration,nakedFlowDemuxUseNew:e.nakedFlowDemuxUseNew,nakedFlowFps:e.nakedFlowFps,supportMSEDecodeHevc:!1}};"VideoEncoder"in self&&(a={hasInit:!1,isEmitInfo:!1,offscreenCanvas:null,offscreenCanvasCtx:null,decoder:null,init(){a.decoder=new VideoDecoder({output:function(e){if(oi(e.createImageBitmap))e.createImageBitmap().then((t=>{a.offscreenCanvasCtx.drawImage(t,0,0,e.codedWidth,e.codedHeight);let i=a.offscreenCanvas.transferToImageBitmap();postMessage({cmd:E,buffer:i,delay:ar.delay,ts:0},[i]),ci(e)}));else{a.offscreenCanvasCtx.drawImage(e,0,0,e.codedWidth,e.codedHeight);let t=a.offscreenCanvas.transferToImageBitmap();postMessage({cmd:E,buffer:t,delay:ar.delay,ts:0},[t]),ci(e)}},error:function(e){ar.debugError("worker","VideoDecoder error: ",e,e.toString())}})},destroy(){a.reset(),a.decoder&&"closed"!==a.decoder.state&&(a.decoder.close(),a.decoder=null)},decode:function(e,t,i){const r=e[0]>>4==1;if(a.hasInit){const i=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:r?ut:ht});a.decoder.decode(i)}else if(r&&0===e[1]){const t=15&e[0];postMessage({cmd:I,code:t});const i=new Uint8Array(e);postMessage({cmd:F,buffer:i,codecId:t},[i.buffer]);let r=null,s=null;const n=e.slice(5);t===De?(s=Ei(n),r={codec:s.codec,description:n}):t===Ie&&(s=Vi(n),r={codec:s.codec,description:n}),s&&s.codecWidth&&s.codecHeight&&(r.codedHeight=s.codecHeight,r.codedWidth=s.codecWidth),a.isEmitInfo||(ar.debugLog("worker","Webcodecs Video Decoder initSize"),postMessage({cmd:x,w:s.codecWidth,h:s.codecHeight}),a.isEmitInfo=!0,a.offscreenCanvas=new OffscreenCanvas(s.codecWidth,s.codecHeight),a.offscreenCanvasCtx=a.offscreenCanvas.getContext("2d"));try{a.decoder.configure(r),a.hasInit=!0}catch(e){ar.debugError("worker","VideoDecoder configure error",e.code,e,e.toString()),e.toString()}}else ar.debugWarn("worker",`VideoDecoder configure has not init , isIframe is ${r} , payload is ${e[1]} so drop this frame`)},reset(){a.hasInit=!1,a.isEmitInfo=!1,a.offscreenCanvas=null,a.offscreenCanvasCtx=null}});let Gi=function(){if(wi=!0,n)try{n.abort(),n=null,ar.debugLog("worker","abort success")}catch(e){n=null,ar.debugLog("worker","abort catch",e)}},$i={init(){$i.lastBuf=null,$i.vps=null,$i.sps=null,$i.pps=null,$i.streamType=null,$i.localDts=0,$i.pendingUnits={},$i.isSendSeqHeader=!1},destroy(){$i.lastBuf=null,$i.vps=null,$i.sps=null,$i.pps=null,$i.streamType=null,$i.localDts=0,$i.pendingUnits={},$i.isSendSeqHeader=!1},dispatch(e){const t=new Uint8Array(e);if(ar._opt.nakedFlowDemuxUseNew){const e=$i.extractNALu$3(t);if(0===e.length)return void ar.debugLog("worker","dispatch naluArray length is 0");$i.handleVideoFrames(e)}else $i.extractNALu$2(t)},getNaluDts(){const e=ar._opt.nakedFlowFps;let t=$i.localDts;return $i.localDts=$i.localDts+parseInt(1e3/e,10),t},getNaluAudioDts(){const e=ar._opt.sampleRate,t=ar._opt.audioBufferSize;return $i.localDts+parseInt(t/e*1e3)},extractNALu(e){let t,i,r=0,s=e.byteLength,a=0,n=[];for(;r1)for(let e=0;e{const t=Di(e);t===He||t===Oe?$i.handleVideoH264Nalu(e):Fi(t)&&r.push(e)})),1===r.length)$i.handleVideoH264Nalu(r[0]);else{if(Mi(r)){const e=Di(r[0]),t=Pi(e);$i.handleVideoH264NaluList(r,t,e)}else r.forEach((e=>{$i.handleVideoH264Nalu(e)}))}}else if($i.streamType===Me)if(ar._opt.nakedFlowH265DemuxUseNew){const t=$i.handleAddNaluStartCode(e),i=$i.extractNALu(t);if(0===i.length)return void ar.debugWarn("worker","handleVideoNalu","h265 naluList.length === 0");const r=[];if(i.forEach((e=>{const t=ji(e);t===nt||t===st||t===it?$i.handleVideoH265Nalu(e):Xi(t)&&r.push(e)})),1===r.length)$i.handleVideoH265Nalu(r[0]);else{if(Ji(r)){const e=ji(r[0]),t=Zi(e);$i.handleVideoH265NaluList(r,t,e)}else r.forEach((e=>{$i.handleVideoH265Nalu(e)}))}}else{ji(e)===nt?$i.extractH265PPS(e):$i.handleVideoH265Nalu(e)}},extractH264PPS(e){const t=$i.handleAddNaluStartCode(e);$i.extractNALu(t).forEach((e=>{Ii(Di(e))?$i.extractH264SEI(e):$i.handleVideoH264Nalu(e)}))},extractH265PPS(e){const t=$i.handleAddNaluStartCode(e);$i.extractNALu(t).forEach((e=>{Ki(ji(e))?$i.extractH265SEI(e):$i.handleVideoH265Nalu(e)}))},extractH264SEI(e){const t=$i.handleAddNaluStartCode(e);$i.extractNALu(t).forEach((e=>{$i.handleVideoH264Nalu(e)}))},extractH265SEI(e){const t=$i.handleAddNaluStartCode(e);$i.extractNALu(t).forEach((e=>{$i.handleVideoH265Nalu(e)}))},handleAddNaluStartCode(e){const t=[0,0,0,1],i=new Uint8Array(e.length+t.length);return i.set(t),i.set(e,t.length),i},handleVideoH264Nalu(e){const t=Di(e);switch(t){case Oe:$i.sps=e;break;case He:$i.pps=e}if($i.isSendSeqHeader){if($i.sps&&$i.pps){const e=Ti({sps:$i.sps,pps:$i.pps}),t=$i.localDts;ar.decode(e,{type:se,ts:t,isIFrame:!0,cts:0}),$i.sps=null,$i.pps=null}if(Fi(t)){const i=Pi(t),r=$i.getNaluDts(),s=Ci(e,i);$i.doDecode(s,{type:se,ts:r,isIFrame:i,cts:0})}}else if($i.sps&&$i.pps){$i.isSendSeqHeader=!0;const e=Ti({sps:$i.sps,pps:$i.pps});ar.decode(e,{type:se,ts:0,isIFrame:!0,cts:0}),$i.sps=null,$i.pps=null}},handleVideoH264NaluList(e,t,i){if($i.isSendSeqHeader){const r=$i.getNaluDts(),s=Li(e.reduce(((e,t)=>{const i=Qt(e),r=Qt(t),s=new Uint8Array(i.byteLength+r.byteLength);return s.set(i,0),s.set(r,i.byteLength),s})),t);$i.doDecode(s,{type:se,ts:r,isIFrame:t,cts:0}),ar.debugLog("worker",`handleVideoH264NaluList list size is ${e.length} package length is ${s.byteLength} isIFrame is ${t},nalu type is ${i}, dts is ${r}`)}},handleVideoH265Nalu(e){const t=ji(e);switch(t){case it:$i.vps=e;break;case st:$i.sps=e;break;case nt:$i.pps=e}if($i.isSendSeqHeader){if($i.vps&&$i.sps&&$i.pps){const e=Wi({vps:$i.vps,sps:$i.sps,pps:$i.pps}),t=$i.localDts;ar.decode(e,{type:se,ts:t,isIFrame:!0,cts:0}),$i.vps=null,$i.sps=null,$i.pps=null}if(Xi(t)){const i=Zi(t),r=$i.getNaluDts(),s=Yi(e,i);$i.doDecode(s,{type:se,ts:r,isIFrame:i,cts:0})}}else if($i.vps&&$i.sps&&$i.pps){$i.isSendSeqHeader=!0;const e=Wi({vps:$i.vps,sps:$i.sps,pps:$i.pps});ar.decode(e,{type:se,ts:0,isIFrame:!0,cts:0}),$i.vps=null,$i.sps=null,$i.pps=null}},handleVideoH265NaluList(e,t,i){if($i.isSendSeqHeader){const r=$i.getNaluDts(),s=qi(e.reduce(((e,t)=>{const i=Qt(e),r=Qt(t),s=new Uint8Array(i.byteLength+r.byteLength);return s.set(i,0),s.set(r,i.byteLength),s})),t);$i.doDecode(s,{type:se,ts:r,isIFrame:t,cts:0}),ar.debugLog("worker",`handleVideoH265NaluList list size is ${e.length} package length is ${s.byteLength} isIFrame is ${t},nalu type is ${i}, dts is ${r}`)}},doDecode(e,t){ar.calcNetworkDelay(t.ts),t.isIFrame&&ar.calcIframeIntervalTimestamp(t.ts),ar.decode(e,t)},handleVideoFrames(e){if(!$i.streamVideoType)for(let t of e)if($i.streamVideoType=di(t),$i.streamVideoType)break;$i.streamVideoType?$i.streamVideoType===Pe?$i.handleVideoH264Frames(e):this.streamVideoType===Me&&$i.handleVideoH265Frames(e):ar.debugWarn("worker","handleVideoFrames","streamVideoType is null")},handleVideoH264Frames(e){let t=[],i=[],r=!1,s=!1;$i.pendingUnits.units&&(t=$i.pendingUnits.units,s=$i.pendingUnits.vcl,r=$i.pendingUnits.iFrame,$i.pendingUnits={});let a={};for(let n of e){if(n.byteLength<4)continue;const e=Di(n);let o=!1,d=e===We;e!==$e&&e!==We||(a=$i.parseVideo264Header(n),o=!0),t.length&&s&&(a.isfms||!o)&&(i.push({units:t,isIFrame:r}),t=[],r=!1,s=!1),t.push(n),r=r||d,s=s||o}t.length&&($i.pendingUnits={units:t,vcl:s,iFrame:r}),i.forEach((e=>{const t=e.units,i=e.isIFrame;let r=null,s=null;if(t.forEach((e=>{const t=31&e[0];switch(t){case He:$i.pps=e;break;case Oe:$i.sps=e;break;case Ye:s=e}if(Fi(t)){const t=Qt(e);if(r){const e=new Uint8Array(r.byteLength+t.byteLength);e.set(r,0),e.set(t,r.byteLength),r=e}else r=t}})),!$i.isSendSeqHeader&&$i.sps&&$i.pps){$i.isSendSeqHeader=!0;const e=ki({sps:$i.sps,pps:$i.pps});ar.decode(e,{type:se,ts:0,isIFrame:!0,cts:0}),$i.sps=null,$i.pps=null}if($i.isSendSeqHeader){if($i.sps&&$i.pps){const e=ki({sps:$i.sps,pps:$i.pps}),t=$i.localDts;ar.decode(e,{type:se,ts:t,isIFrame:!0,cts:0}),$i.sps=null,$i.pps=null}if(r){const e=$i.getNaluDts(),t=Li(r,i);ar._opt.isEmitSEI&&s&&postMessage({cmd:j,buffer:s,ts:e},[s.buffer]),$i.doDecode(t,{type:se,ts:e,isIFrame:i,cts:0})}}}))},handleVideoH265Frames(e){let t=[],i=[],r=!1,s=!1;$i.pendingUnits.units&&(t=$i.pendingUnits.units,s=$i.pendingUnits.vcl,r=$i.pendingUnits.iFrame,$i.pendingUnits={});let a={};for(let n of e){if(n.byteLength<4)continue;const e=ji(n);let o=!1,d=Zi(e);Xi(e)&&(a=this.parseVideo265Header(n),o=!0),t.length&&s&&(a.isfms||!o)&&(i.push({units:t,isIFrame:r}),t=[],r=!1,s=!1),t.push(n),r=r||d,s=s||o}t.length&&($i.pendingUnits={units:t,vcl:s,iFrame:r}),i.forEach((e=>{const t=e.units,i=e.isIFrame;let r=null,s=null;if(t.forEach((e=>{const t=e[0]>>>1&63;switch(t){case nt:$i.pps=e;break;case st:$i.sps=e;break;case it:$i.vps=e;break;case ct:case lt:s=e}if(Xi(t)){const t=Qt(e);if(r){const e=new Uint8Array(r.byteLength+t.byteLength);e.set(r,0),e.set(t,r.byteLength),r=e}else r=t}})),!$i.isSendSeqHeader&&$i.sps&&$i.pps&&$i.vps){$i.isSendSeqHeader=!0;const e=Wi({sps:$i.sps,pps:$i.pps,vps:$i.vps});ar.decode(e,{type:se,ts:0,isIFrame:!0,cts:0}),$i.sps=null,$i.pps=null,$i.vps=null}if($i.isSendSeqHeader){if($i.sps&&$i.pps&&$i.vps){const e=Wi({sps:$i.sps,pps:$i.pps,vps:$i.vps}),t=$i.localDts;ar.decode(e,{type:se,ts:t,isIFrame:!0,cts:0}),$i.sps=null,$i.pps=null,$i.vps=null}if(r){const e=$i.getNaluDts(),t=qi(r,i);ar._opt.isEmitSEI&&s&&postMessage({cmd:j,buffer:s,ts:e},[s.buffer]),$i.doDecode(t,{type:se,ts:e,isIFrame:i,cts:0})}}}))},handleVideoH265Frames_1(e){e.forEach((e=>{$i.handleVideoNalu(e)}))},parseVideo264Header(e){const t=new Ns(e);t.readUByte();return{isfms:0===t.readUEG(),sType:t.readUEG()}},parseVideo265Header(e){const t=new Ns(e);return t.readUByte(),{nalType:t.readBits(6),isfms:0===t.readBits(1),sType:t.readBits(3)}}},tr={LOG_NAME:"worker fmp4Demuxer",mp4Box:null,offset:0,videoTrackId:null,audioTrackId:null,isHevc:!1,listenMp4Box(){tr.mp4Box=Rr.createFile(),tr.mp4Box.onReady=tr.onReady,tr.mp4Box.onError=tr.onError,tr.mp4Box.onSamples=tr.onSamples},initTransportDescarmber(){tr.transportDescarmber=new Or},_getSeqHeader(e){const t=tr.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new Rr.DataStream(void 0,0,Rr.DataStream.BIG_ENDIAN);let i=[];e.avcC?(e.avcC.write(t),i=[23,0,0,0,0]):(tr.isHevc=!0,ar.isHevc=!0,e.hvcC.write(t),i=[28,0,0,0,0]);const r=new Uint8Array(t.buffer,8),s=new Uint8Array(i.length+r.length);return s.set(i,0),s.set(r,i.length),s}return null},onReady(e){ar.debugLog(tr.LOG_NAME,"onReady()");const t=e.videoTracks[0],i=e.audioTracks[0];if(t){tr.videoTrackId=t.id;const e=tr._getSeqHeader(t);e&&(ar.debugLog(tr.LOG_NAME,"seqHeader"),ar.decodeVideo(e,0,!0,0)),tr.mp4Box.setExtractionOptions(t.id)}if(i&&ar._opt.hasAudio){tr.audioTrackId=i.id;const e=i.audio||{},t=Vt.indexOf(e.sample_rate),r=i.codec.replace("mp4a.40.","");tr.mp4Box.setExtractionOptions(i.id);const s=$t({profile:parseInt(r,10),sampleRate:t,channel:e.channel_count});ar.debugLog(tr.LOG_NAME,"aacADTSHeader"),ar.decodeAudio(s,0)}tr.mp4Box.start()},onError(e){ar.debugError(tr.LOG_NAME,"mp4Box onError",e)},onSamples(e,t,i){if(e===tr.videoTrackId){for(const e of i){const t=e.data,i=e.is_sync,r=1e3*e.cts/e.timescale;e.duration,e.timescale,i&&ar.calcIframeIntervalTimestamp(r);let s=null;s=tr.isHevc?qi(t,i):Li(t,i),ar.decode(s,{type:se,ts:r,isIFrame:i,cts:0})}tr.mp4Box.removeUsedSamples(e)}else if(e===tr.audioTrackId){if(ar._opt.hasAudio){for(const e of i){const t=e.data,i=1e3*e.cts/e.timescale;e.duration,e.timescale;const r=new Uint8Array(t.byteLength+2);r.set([175,1],0),r.set(t,2),ar.decode(r,{type:re,ts:i,isIFrame:!1,cts:0})}tr.mp4Box.removeUsedSamples(e)}}else ar.debugWarn(tr.LOG_NAME,"onSamples() trackId error",e)},dispatch(e){let t=new Uint8Array(e);tr.transportDescarmber&&(t=tr.transportDescarmber.transport(t)),t.buffer.fileStart=tr.offset,tr.offset+=t.byteLength,tr.mp4Box.appendBuffer(t.buffer)},destroy(){tr.mp4Box&&(tr.mp4Box.stop(),tr.mp4Box.flush(),tr.mp4Box.destroy(),tr.mp4Box=null),tr.transportDescarmber&&(tr.transportDescarmber.destroy(),tr.transportDescarmber=null),tr.offset=0,tr.videoTrackId=null,tr.audioTrackId=null,tr.isHevc=!1}},ir={LOG_NAME:"worker mpeg4Demuxer",lastBuffer:new Uint8Array(0),parsedOffset:0,firstStartCodeOffset:0,secondStartCodeOffset:0,state:"init",hasInitVideoCodec:!1,localDts:0,dispatch(e){const t=new Uint8Array(e);ir.extractNALu(t)},destroy(){ir.lastBuffer=new Uint8Array(0),ir.parsedOffset=0,ir.firstStartCodeOffset=0,ir.secondStartCodeOffset=0,ir.state="init",ir.hasInitVideoCodec=!1,ir.localDts=0},extractNALu(e){if(!e||e.byteLength<1)return void ar.debugWarn(ir.LOG_NAME,"extractNALu() buffer error",e);const t=new Uint8Array(ir.lastBuffer.length+e.length);for(t.set(ir.lastBuffer,0),t.set(new Uint8Array(e),ir.lastBuffer.length),ir.lastBuffer=t;;){if("init"===ir.state){let e=!1;for(;ir.lastBuffer.length-ir.parsedOffset>=4;)if(0===ir.lastBuffer[ir.parsedOffset])if(0===ir.lastBuffer[ir.parsedOffset+1])if(1===ir.lastBuffer[ir.parsedOffset+2]){if(182===ir.lastBuffer[ir.parsedOffset+3]){ir.state="findFirstStartCode",ir.firstStartCodeOffset=ir.parsedOffset,ir.parsedOffset+=4,e=!0;break}ir.parsedOffset++}else ir.parsedOffset++;else ir.parsedOffset++;else ir.parsedOffset++;if(e)continue;break}if("findFirstStartCode"===ir.state){let e=!1;for(;ir.lastBuffer.length-ir.parsedOffset>=4;)if(0===ir.lastBuffer[ir.parsedOffset])if(0===ir.lastBuffer[ir.parsedOffset+1])if(1===ir.lastBuffer[ir.parsedOffset+2]){if(182===ir.lastBuffer[ir.parsedOffset+3]){ir.state="findSecondStartCode",ir.secondStartCodeOffset=ir.parsedOffset,ir.parsedOffset+=4,e=!0;break}ir.parsedOffset++}else ir.parsedOffset++;else ir.parsedOffset++;else ir.parsedOffset++;if(e)continue;break}if("findSecondStartCode"===ir.state){if(!(ir.lastBuffer.length-ir.parsedOffset>0))break;{let e,t,i=192&ir.lastBuffer[ir.parsedOffset];e=0==i?ir.secondStartCodeOffset-14:ir.secondStartCodeOffset;let r=0==(192&ir.lastBuffer[ir.firstStartCodeOffset+4]);if(r){if(ir.firstStartCodeOffset-14<0)return void ar.debugWarn(ir.LOG_NAME,"firstStartCodeOffset -14 is",ir.firstStartCodeOffset-14);ir.hasInitVideoCodec||(ir.hasInitVideoCodec=!0,ar.debugLog(ir.LOG_NAME,"setCodec"),or.setCodec(Fe,"")),t=ir.lastBuffer.subarray(ir.firstStartCodeOffset-14,e)}else t=ir.lastBuffer.subarray(ir.firstStartCodeOffset,e);let s=ir.getNaluDts();ir.hasInitVideoCodec?(postMessage({cmd:R,type:Be,value:t.byteLength}),postMessage({cmd:R,type:Ue,value:s}),Ke=s,or.decode(t,r?1:0,s)):ar.debugWarn(ir.LOG_NAME,"has not init video codec"),ir.lastBuffer=ir.lastBuffer.subarray(e),ir.firstStartCodeOffset=0==i?14:0,ir.parsedOffset=ir.firstStartCodeOffset+4,ir.state="findFirstStartCode"}}}},getNaluDts(){let e=ir.localDts;return ir.localDts=ir.localDts+40,e}},rr={TAG_NAME:"worker TsLoaderV2",first_parse_:!0,tsPacketSize:0,syncOffset:0,pmt_:null,config_:null,media_info_:new zs,timescale_:90,duration_:0,pat_:{version_number:0,network_pid:0,program_map_pid:{}},current_program_:null,current_pmt_pid_:-1,program_pmt_map_:{},pes_slice_queues_:{},section_slice_queues_:{},video_metadata_:{vps:null,sps:null,pps:null,details:null},audio_metadata_:{codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},last_pcr_:null,audio_last_sample_pts_:void 0,aac_last_incomplete_data_:null,has_video_:!1,has_audio_:!1,video_init_segment_dispatched_:!1,audio_init_segment_dispatched_:!1,video_metadata_changed_:!1,audio_metadata_changed_:!1,loas_previous_frame:null,video_track_:{type:"video",id:1,sequenceNumber:0,samples:[],length:0},audio_track_:{type:"audio",id:2,sequenceNumber:0,samples:[],length:0},_remainingPacketData:null,init(){},destroy(){rr.media_info_=null,rr.pes_slice_queues_=null,rr.section_slice_queues_=null,rr.video_metadata_=null,rr.audio_metadata_=null,rr.aac_last_incomplete_data_=null,rr.video_track_=null,rr.audio_track_=null,rr._remainingPacketData=null},probe(e){let t=new Uint8Array(e),i=-1,r=188;if(t.byteLength<=3*r)return{needMoreData:!0};for(;-1===i;){let e=Math.min(1e3,t.byteLength-3*r);for(let s=0;s=4&&(i-=4),{match:!0,consumed:0,ts_packet_size:r,sync_offset:i})},_initPmt:()=>({program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}),dispatch(e){rr._remainingPacketData&&(e=cs(rr._remainingPacketData,e),rr._remainingPacketData=null);let t=e.buffer;const i=rr.parseChunks(t);i?rr._remainingPacketData=e.subarray(i):e.length>>6;i[1];let a=(31&i[1])<<8|i[2],n=(48&i[3])>>>4,o=15&i[3],d=!(!rr.pmt_||rr.pmt_.pcr_pid!==a),l={},c=4;if(2==n||3==n){let e=i[4];if(e>0&&(d||3==n)){if(l.discontinuity_indicator=(128&i[5])>>>7,l.random_access_indicator=(64&i[5])>>>6,l.elementary_stream_priority_indicator=(32&i[5])>>>5,(16&i[5])>>>4){let e=300*(i[6]<<25|i[7]<<17|i[8]<<9|i[9]<<1|i[10]>>>7)+((1&i[10])<<8|i[11]);rr.last_pcr_=e}}if(2==n||5+e===188){t+=188,204===rr.tsPacketSize&&(t+=16);continue}c=5+e}if(1==n||3==n)if(0===a||a===rr.current_pmt_pid_||null!=rr.pmt_&&rr.pmt_.pid_stream_type[a]===Cs){let i=188-c;rr.handleSectionSlice(e,t+c,i,{pid:a,payload_unit_start_indicator:s,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}else if(null!=rr.pmt_&&null!=rr.pmt_.pid_stream_type[a]){let i=188-c,r=rr.pmt_.pid_stream_type[a];a!==rr.pmt_.common_pids.h264&&a!==rr.pmt_.common_pids.h265&&a!==rr.pmt_.common_pids.adts_aac&&a!==rr.pmt_.common_pids.loas_aac&&a!==rr.pmt_.common_pids.ac3&&a!==rr.pmt_.common_pids.eac3&&a!==rr.pmt_.common_pids.opus&&a!==rr.pmt_.common_pids.mp3&&!0!==rr.pmt_.pes_private_data_pids[a]&&!0!==rr.pmt_.timed_id3_pids[a]&&!0!==rr.pmt_.synchronous_klv_pids[a]&&!0!==rr.pmt_.asynchronous_klv_pids[a]||rr.handlePESSlice(e,t+c,i,{pid:a,stream_type:r,payload_unit_start_indicator:s,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}t+=188,204===rr.tsPacketSize&&(t+=16)}return rr.dispatchAudioVideoMediaSegment(),t},handleSectionSlice(e,t,i,r){let s=new Uint8Array(e,t,i),a=rr.section_slice_queues_[r.pid];if(r.payload_unit_start_indicator){let n=s[0];if(null!=a&&0!==a.total_length){let s=new Uint8Array(e,t+1,Math.min(i,n));a.slices.push(s),a.total_length+=s.byteLength,a.total_length===a.expected_length?rr.emitSectionSlices(a,r):rr.clearSlices(a,r)}for(let o=1+n;o=a.expected_length&&rr.clearSlices(a,r),o+=d.byteLength}}else if(null!=a&&0!==a.total_length){let s=new Uint8Array(e,t,Math.min(i,a.expected_length-a.total_length));a.slices.push(s),a.total_length+=s.byteLength,a.total_length===a.expected_length?rr.emitSectionSlices(a,r):a.total_length>=a.expected_length&&rr.clearSlices(a,r)}},handlePESSlice(e,t,i,r){let s=new Uint8Array(e,t,i),a=s[0]<<16|s[1]<<8|s[2];s[3];let n=s[4]<<8|s[5];if(r.payload_unit_start_indicator){if(1!==a)return void ar.debugWarn(rr.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${a}`);let e=rr.pes_slice_queues_[r.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?rr.emitPESSlices(e,r):rr.clearSlices(e,r)),rr.pes_slice_queues_[r.pid]=new Is,rr.pes_slice_queues_[r.pid].random_access_indicator=r.random_access_indicator}if(null==rr.pes_slice_queues_[r.pid])return;let o=rr.pes_slice_queues_[r.pid];o.slices.push(s),r.payload_unit_start_indicator&&(o.expected_length=0===n?0:n+6),o.total_length+=s.byteLength,o.expected_length>0&&o.expected_length===o.total_length?rr.emitPESSlices(o,r):o.expected_length>0&&o.expected_length>>6,o=t[8];2!==n&&3!==n||(i=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,a=3===n?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:i);let d,l=9+o;if(0!==s){if(s<3+o)return void ar.debugWarn(rr.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");d=s-3-o}else d=t.byteLength-l;let c=t.subarray(l,l+d);switch(e.stream_type){case ws:case As:rr.parseMP3Payload(c,i);break;case Bs:rr.pmt_.common_pids.opus===e.pid||rr.pmt_.common_pids.ac3===e.pid||rr.pmt_.common_pids.eac3===e.pid||(rr.pmt_.asynchronous_klv_pids[e.pid]?rr.parseAsynchronousKLVMetadataPayload(c,e.pid,r):rr.pmt_.smpte2038_pids[e.pid]?rr.parseSMPTE2038MetadataPayload(c,i,a,e.pid,r):rr.parsePESPrivateDataPayload(c,i,a,e.pid,r));break;case Us:rr.parseADTSAACPayload(c,i);break;case xs:rr.parseLOASAACPayload(c,i);break;case Es:case Ts:break;case ks:rr.pmt_.timed_id3_pids[e.pid]?rr.parseTimedID3MetadataPayload(c,i,a,e.pid,r):rr.pmt_.synchronous_klv_pids[e.pid]&&rr.parseSynchronousKLVMetadataPayload(c,i,a,e.pid,r);break;case Ls:rr.parseH264Payload(c,i,a,e.random_access_indicator);break;case Ds:rr.parseH265Payload(c,i,a,e.random_access_indicator)}}else if((188===r||191===r||240===r||241===r||255===r||242===r||248===r)&&e.stream_type===Bs){let i,a=6;i=0!==s?s:t.byteLength-a;let n=t.subarray(a,a+i);rr.parsePESPrivateDataPayload(n,void 0,void 0,e.pid,r)}}else ar.debugError(rr.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${i}`)},parsePAT(e){let t=e[0];if(0!==t)return void Log.e(rr.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let i=(15&e[1])<<8|e[2];e[3],e[4];let r=(62&e[5])>>>1,s=1&e[5],a=e[6];e[7];let n=null;if(1===s&&0===a)n={version_number:0,network_pid:0,program_pmt_pid:{}},n.version_number=r;else if(n=rr.pat_,null==n)return;let o=i-5-4,d=-1,l=-1;for(let t=8;t<8+o;t+=4){let i=e[t]<<8|e[t+1],r=(31&e[t+2])<<8|e[t+3];0===i?n.network_pid=r:(n.program_pmt_pid[i]=r,-1===d&&(d=i),-1===l&&(l=r))}1===s&&0===a&&(null==rr.pat_&&ar.debugLog(rr.TAG_NAME,`Parsed first PAT: ${JSON.stringify(n)}`),rr.pat_=n,rr.current_program_=d,rr.current_pmt_pid_=l)},parsePMT(e){let t=e[0];if(2!==t)return void ar.debugError(rr.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let i,r=(15&e[1])<<8|e[2],s=e[3]<<8|e[4],a=(62&e[5])>>>1,n=1&e[5],o=e[6];if(e[7],1===n&&0===o)i=rr._initPmt(),i.program_number=s,i.version_number=a,rr.program_pmt_map_[s]=i;else if(i=rr.program_pmt_map_[s],null==i)return;i.pcr_pid=(31&e[8])<<8|e[9];let d=(15&e[10])<<8|e[11],l=12+d,c=r-9-d-4;for(let t=l;t0){for(let r=t+5;r0)for(let r=t+5;rrr.has_video_&&rr.has_audio_?rr.video_init_segment_dispatched_&&rr.audio_init_segment_dispatched_:rr.has_video_&&!rr.has_audio_?rr.video_init_segment_dispatched_:!(rr.has_video_||!rr.has_audio_)&&rr.audio_init_segment_dispatched_,dispatchVideoInitSegment(){let e=rr.video_metadata_.details,t={type:"video"};t.id=rr.video_track_.id,t.timescale=1e3,t.duration=rr.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;let i=t.frameRate.fps_den,r=t.frameRate.fps_num;if(t.refSampleDuration=i/r*1e3,t.codec=e.codec_mimetype,rr.video_metadata_.vps){ar.isHevc=!0;let e=rr.video_metadata_.vps.data.subarray(4),i=rr.video_metadata_.sps.data.subarray(4),r=rr.video_metadata_.pps.data.subarray(4);t.hvcc=Wi({vps:e,sps:i,pps:r}),0==rr.video_init_segment_dispatched_&&ar.debugLog(rr.TAG_NAME,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.hvcc&&ar.decodeVideo(t.hvcc,0,!0,0)}else{let e=rr.video_metadata_.sps.data.subarray(4),i=rr.video_metadata_.pps.data.subarray(4);t.avcc=ki({sps:e,pps:i}),0==rr.video_init_segment_dispatched_&&ar.debugLog(rr.TAG_NAME,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.avcc&&ar.decodeVideo(t.avcc,0,!0,0)}rr.video_init_segment_dispatched_=!0,rr.video_metadata_changed_=!1;let s=rr.media_info_;s.hasVideo=!0,s.width=t.codecWidth,s.height=t.codecHeight,s.fps=t.frameRate.fps,s.profile=t.profile,s.level=t.level,s.refFrames=e.ref_frames,s.chromaFormat=e.chroma_format_string,s.sarNum=t.sarRatio.width,s.sarDen=t.sarRatio.height,s.videoCodec=t.codec,s.hasAudio&&s.audioCodec?s.mimeType=`video/mp2t; codecs="${s.videoCodec},${s.audioCodec}"`:s.mimeType=`video/mp2t; codecs="${s.videoCodec}"`},dispatchVideoMediaSegment(){rr.isInitSegmentDispatched()&&rr.video_track_.length&&rr._preDoDecode()},dispatchAudioMediaSegment(){rr.isInitSegmentDispatched()&&rr.audio_track_.length&&rr._preDoDecode()},dispatchAudioVideoMediaSegment(){rr.isInitSegmentDispatched()&&(rr.audio_track_.length||rr.video_track_.length)&&rr._preDoDecode()},parseADTSAACPayload(e,t){if(rr.has_video_&&!rr.video_init_segment_dispatched_)return;if(rr.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+rr.aac_last_incomplete_data_.byteLength);t.set(rr.aac_last_incomplete_data_,0),t.set(e,rr.aac_last_incomplete_data_.byteLength),e=t}let i,r;if(null!=t&&(r=t/rr.timescale_),"aac"===rr.audio_metadata_.codec){if(null==t&&null!=rr.audio_last_sample_pts_)i=1024/rr.audio_metadata_.sampling_frequency*1e3,r=rr.audio_last_sample_pts_+i;else if(null==t)return void ar.debugWarn(rr.TAG_NAME,"AAC: Unknown pts");if(rr.aac_last_incomplete_data_&&rr.audio_last_sample_pts_){i=1024/rr.audio_metadata_.sampling_frequency*1e3;let e=rr.audio_last_sample_pts_+i;Math.abs(e-r)>1&&(ar.debugWarn(rr.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${r}ms`),r=e)}}let s,a=new Kt(e),n=null,o=r;for(;null!=(n=a.readNextAACFrame());){i=1024/n.sampling_frequency*1e3;const e={codec:"aac",data:n};0==rr.audio_init_segment_dispatched_?(rr.audio_metadata_={codec:"aac",audio_object_type:n.audio_object_type,sampling_freq_index:n.sampling_freq_index,sampling_frequency:n.sampling_frequency,channel_config:n.channel_config},rr.dispatchAudioInitSegment(e)):rr.detectAudioMetadataChange(e)&&(rr.dispatchAudioMediaSegment(),rr.dispatchAudioInitSegment(e)),s=o;let t=Math.floor(o);const r=new Uint8Array(n.data.length+2);r.set([175,1],0),r.set(n.data,2);let a={payload:r,length:r.byteLength,pts:t,dts:t,type:re};rr.audio_track_.samples.push(a),rr.audio_track_.length+=r.byteLength,o+=i}a.hasIncompleteData()&&(rr.aac_last_incomplete_data_=a.getIncompleteData()),s&&(rr.audio_last_sample_pts_=s)},parseLOASAACPayload(e,t){if(rr.has_video_&&!rr.video_init_segment_dispatched_)return;if(rr.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+rr.aac_last_incomplete_data_.byteLength);t.set(rr.aac_last_incomplete_data_,0),t.set(e,rr.aac_last_incomplete_data_.byteLength),e=t}let i,r;if(null!=t&&(r=t/rr.timescale_),"aac"===rr.audio_metadata_.codec){if(null==t&&null!=rr.audio_last_sample_pts_)i=1024/rr.audio_metadata_.sampling_frequency*1e3,r=rr.audio_last_sample_pts_+i;else if(null==t)return void ar.debugWarn(rr.TAG_NAME,"AAC: Unknown pts");if(rr.aac_last_incomplete_data_&&rr.audio_last_sample_pts_){i=1024/rr.audio_metadata_.sampling_frequency*1e3;let e=rr.audio_last_sample_pts_+i;Math.abs(e-r)>1&&(ar.debugWarn(rr.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${r}ms`),r=e)}}let s,a=new Xt(e),n=null,o=r;for(;null!=(n=a.readNextAACFrame(ai(this.loas_previous_frame)?void 0:this.loas_previous_frame));){rr.loas_previous_frame=n,i=1024/n.sampling_frequency*1e3;const e={codec:"aac",data:n};0==rr.audio_init_segment_dispatched_?(rr.audio_metadata_={codec:"aac",audio_object_type:n.audio_object_type,sampling_freq_index:n.sampling_freq_index,sampling_frequency:n.sampling_frequency,channel_config:n.channel_config},rr.dispatchAudioInitSegment(e)):rr.detectAudioMetadataChange(e)&&(rr.dispatchAudioMediaSegment(),rr.dispatchAudioInitSegment(e)),s=o;let t=Math.floor(o);const r=new Uint8Array(n.data.length+2);r.set([175,1],0),r.set(n.data,2);let a={payload:r,length:r.byteLength,pts:t,dts:t,type:re};rr.audio_track_.samples.push(a),rr.audio_track_.length+=r.byteLength,o+=i}a.hasIncompleteData()&&(rr.aac_last_incomplete_data_=a.getIncompleteData()),s&&(rr.audio_last_sample_pts_=s)},parseAC3Payload(e,t){},parseEAC3Payload(e,t){},parseOpusPayload(e,t){},parseMP3Payload(e,t){if(rr.has_video_&&!rr.video_init_segment_dispatched_)return;let i=[44100,48e3,32e3,0],r=[22050,24e3,16e3,0],s=[11025,12e3,8e3,0],a=e[1]>>>3&3,n=(6&e[1])>>1;e[2];let o=(12&e[2])>>>2,d=3!==(e[3]>>>6&3)?2:1,l=0,c=34;switch(a){case 0:l=s[o];break;case 2:l=r[o];break;case 3:l=i[o]}switch(n){case 1:c=34;break;case 2:c=33;break;case 3:c=32}const u={};u.object_type=c,u.sample_rate=l,u.channel_count=d,u.data=e;const h={codec:"mp3",data:u};0==rr.audio_init_segment_dispatched_?(rr.audio_metadata_={codec:"mp3",object_type:c,sample_rate:l,channel_count:d},rr.dispatchAudioInitSegment(h)):rr.detectAudioMetadataChange(h)&&(rr.dispatchAudioMediaSegment(),rr.dispatchAudioInitSegment(h));let f={payload:e,length:e.byteLength,pts:t/rr.timescale_,dts:t/rr.timescale_,type:re};rr.audio_track_.samples.push(f),rr.audio_track_.length+=e.byteLength},detectAudioMetadataChange(e){if(e.codec!==rr.audio_metadata_.codec)return ar.debugLog(rr.TAG_NAME,`Audio: Audio Codecs changed from ${rr.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===rr.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==rr.audio_metadata_.audio_object_type)return ar.debugLog(rr.TAG_NAME,`AAC: AudioObjectType changed from ${rr.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==rr.audio_metadata_.sampling_freq_index)return ar.debugLog(rr.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${rr.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==rr.audio_metadata_.channel_config)return ar.debugLog(rr.TAG_NAME,`AAC: Channel configuration changed from ${rr.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===rr.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==rr.audio_metadata_.sampling_frequency)return ar.debugLog(rr.TAG_NAME,`AC3: Sampling Frequency changed from ${rr.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==rr.audio_metadata_.bit_stream_identification)return ar.debugLog(rr.TAG_NAME,`AC3: Bit Stream Identification changed from ${rr.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==rr.audio_metadata_.bit_stream_mode)return ar.debugLog(rr.TAG_NAME,`AC3: BitStream Mode changed from ${rr.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==rr.audio_metadata_.channel_mode)return ar.debugLog(rr.TAG_NAME,`AC3: Channel Mode changed from ${rr.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==rr.audio_metadata_.low_frequency_effects_channel_on)return ar.debugLog(rr.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${rr.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===rr.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==rr.audio_metadata_.sample_rate)return ar.debugLog(rr.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${rr.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==rr.audio_metadata_.channel_count)return ar.debugLog(rr.TAG_NAME,`Opus: Channel count changed from ${rr.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===rr.audio_metadata_.codec){const t=e.data;if(t.object_type!==rr.audio_metadata_.object_type)return ar.debugLog(rr.TAG_NAME,`MP3: AudioObjectType changed from ${rr.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==rr.audio_metadata_.sample_rate)return ar.debugLog(rr.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${rr.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==rr.audio_metadata_.channel_count)return ar.debugLog(rr.TAG_NAME,`MP3: Channel count changed from ${rr.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1},dispatchAudioInitSegment(e){let t={type:"audio"};if(t.id=rr.audio_track_.id,t.timescale=1e3,t.duration=rr.duration_,"aac"===rr.audio_metadata_.codec){let i="aac"===e.codec?e.data:null,r=new Rs(i);t.audioSampleRate=r.sampling_rate,t.audioSampleRateIndex=r.sampling_index,t.channelCount=r.channel_count,t.codec=r.codec_mimetype,t.originalCodec=r.original_codec_mimetype,t.config=r.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale;const s=$t({profile:ar._opt.mseDecodeAudio?r.object_type:r.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});ar.decodeAudio(s,0)}else"ac-3"===rr.audio_metadata_.codec||"ec-3"===rr.audio_metadata_.codec||"opus"===rr.audio_metadata_.codec||"mp3"===rr.audio_metadata_.codec&&(t.audioSampleRate=rr.audio_metadata_.sample_rate,t.channelCount=rr.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==rr.audio_init_segment_dispatched_&&ar.debugLog(rr.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),rr.audio_init_segment_dispatched_=!0,rr.video_metadata_changed_=!1;let i=rr.media_info_;i.hasAudio=!0,i.audioCodec=t.originalCodec,i.audioSampleRate=t.audioSampleRate,i.audioChannelCount=t.channelCount,i.hasVideo&&i.videoCodec?i.mimeType=`video/mp2t; codecs="${i.videoCodec},${i.audioCodec}"`:i.mimeType=`video/mp2t; codecs="${i.audioCodec}"`},dispatchPESPrivateDataDescriptor(e,t,i){},parsePESPrivateDataPayload(e,t,i,r,s){let a=new Ps;if(a.pid=r,a.stream_id=s,a.len=e.byteLength,a.data=e,null!=t){let e=Math.floor(t/rr.timescale_);a.pts=e}else a.nearest_pts=rr.getNearestTimestampMilliseconds();if(null!=i){let e=Math.floor(i/rr.timescale_);a.dts=e}},parseTimedID3MetadataPayload(e,t,i,r,s){ar.debugLog(rr.TAG_NAME,`Timed ID3 Metadata: pid=${r}, pts=${t}, dts=${i}, stream_id=${s}`)},parseSynchronousKLVMetadataPayload(e,t,i,r,s){ar.debugLog(rr.TAG_NAME,`Synchronous KLV Metadata: pid=${r}, pts=${t}, dts=${i}, stream_id=${s}`)},parseAsynchronousKLVMetadataPayload(e,t,i){ar.debugLog(rr.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${i}`)},parseSMPTE2038MetadataPayload(e,t,i,r,s){ar.debugLog(rr.TAG_NAME,`SMPTE 2038 Metadata: pid=${r}, pts=${t}, dts=${i}, stream_id=${s}`)},getNearestTimestampMilliseconds(){if(null!=rr.audio_last_sample_pts_)return Math.floor(rr.audio_last_sample_pts_);if(null!=rr.last_pcr_){return Math.floor(rr.last_pcr_/300/rr.timescale_)}},_preDoDecode(){const e=rr.video_track_,t=rr.audio_track_;let i=e.samples;t.samples.length>0&&(i=e.samples.concat(t.samples),i=i.sort(((e,t)=>e.dts-t.dts))),i.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===se?rr._doDecodeVideo({...e,payload:t}):e.type===re&&rr._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0},_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?qi(t,e.isIFrame):Li(t,e.isIFrame),e.isIFrame&&ar.calcIframeIntervalTimestamp(e.dts);let r=ar.cryptoPayload(i,e.isIFrame);ar.decode(r,{type:se,ts:e.dts,isIFrame:e.isIFrame,cts:e.cts})},_doDecodeAudio(e){const t=new Uint8Array(e.payload);let i=t;_i(ar._opt.m7sCryptoAudio)&&(i=ar.cryptoPayloadAudio(t)),ar.decode(i,{type:re,ts:e.dts,isIFrame:!1,cts:0})}},sr=null;gi()&&(sr={TAG_NAME:"worker MediaSource",_resetInIt(){sr.isAvc=null,sr.isAAC=null,sr.videoInfo={},sr.videoMeta={},sr.audioMeta={},sr.sourceBuffer=null,sr.audioSourceBuffer=null,sr.hasInit=!1,sr.hasAudioInit=!1,sr.isAudioInitInfo=!1,sr.videoMimeType="",sr.audioMimeType="",sr.cacheTrack={},sr.cacheAudioTrack={},sr.timeInit=!1,sr.sequenceNumber=0,sr.audioSequenceNumber=0,sr.firstRenderTime=null,sr.firstAudioTime=null,sr.mediaSourceAppendBufferFull=!1,sr.mediaSourceAppendBufferError=!1,sr.mediaSourceAddSourceBufferError=!1,sr.mediaSourceBufferError=!1,sr.mediaSourceError=!1,sr.prevTimestamp=null,sr.decodeDiffTimestamp=null,sr.prevDts=null,sr.prevAudioDts=null,sr.prevPayloadBufferSize=0,sr.isWidthOrHeightChanged=!1,sr.prevTs=null,sr.prevAudioTs=null,sr.eventListenList=[],sr.pendingRemoveRanges=[],sr.pendingSegments=[],sr.pendingAudioRemoveRanges=[],sr.pendingAudioSegments=[],sr.supportVideoFrameCallbackHandle=null,sr.audioSourceBufferCheckTimeout=null,sr.audioSourceNoDataCheckTimeout=null,sr.hasPendingEos=!1,sr.$video={currentTime:0,readyState:0}},init(){sr.events=new us,sr._resetInIt(),sr.mediaSource=new self.MediaSource,sr.isDecodeFirstIIframe=!!mi(ar._opt.checkFirstIFrame),sr._bindMediaSourceEvents()},destroy(){sr.stop(),sr._clearAudioSourceBufferCheckTimeout(),sr.eventListenList&&sr.eventListenList.length&&(sr.eventListenList.forEach((e=>e())),sr.eventListenList=[]),sr._resetInIt(),sr.mediaSource=null},getState:()=>sr.mediaSource&&sr.mediaSource.readyState,isStateOpen:()=>sr.getState()===mt,isStateClosed:()=>sr.getState()===gt,isStateEnded:()=>sr.getState()===_t,_bindMediaSourceEvents(){const{proxy:e}=sr.events,t=e(sr.mediaSource,bt,(()=>{ar.debugLog(sr.TAG_NAME,"sourceOpen"),sr._onMediaSourceSourceOpen()})),i=e(sr.mediaSource,yt,(()=>{ar.debugLog(sr.TAG_NAME,"sourceClose")})),r=e(sr.mediaSource,vt,(()=>{ar.debugLog(sr.TAG_NAME,"sourceended")}));sr.eventListenList.push(t,i,r)},_onMediaSourceSourceOpen(){sr.sourceBuffer||(ar.debugLog(sr.TAG_NAME,"onMediaSourceSourceOpen() sourceBuffer is null and next init"),sr._initSourceBuffer()),sr.audioSourceBuffer||(ar.debugLog(sr.TAG_NAME,"onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),sr._initAudioSourceBuffer()),sr._hasPendingSegments()&&sr._doAppendSegments()},decodeVideo(e,t,i,r){if(ar.isDestroyed)ar.debugWarn(sr.TAG_NAME,"decodeVideo() and decoder is destroyed");else if(mi(sr.hasInit))if(i&&e[1]===Bt){const r=15&e[0];if(r===Ie&&mi(ar._opt.supportMSEDecodeHevc))return void sr.emitError(Ce.mediaSourceH265NotSupport);sr.videoInfo.codec=r,postMessage({cmd:I,code:r});const s=new Uint8Array(e);postMessage({cmd:F,buffer:s,codecId:r},[s.buffer]),sr.hasInit=sr._decodeConfigurationRecord(e,t,i,r)}else ar.debugWarn(sr.TAG_NAME,`decodeVideo has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`);else if(!sr.isDecodeFirstIIframe&&i&&(sr.isDecodeFirstIIframe=!0),sr.isDecodeFirstIIframe){if(i&&0===e[1]){const t=15&e[0];let i={};if(t===De){i=Ei(e.slice(5))}else t===Ie&&(i=Hi(e));const r=sr.videoInfo;r&&r.codecWidth&&r.codecWidth&&i&&i.codecWidth&&i.codecHeight&&(i.codecWidth!==r.codecWidth||i.codecHeight!==r.codecWidth)&&(ar.debugWarn(sr.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${r.codecWidth}, old height is ${r.codecHeight},\n new width is ${i.codecWidth}, new height is ${i.codecHeight},\n and emit change event`),sr.isWidthOrHeightChanged=!0,sr.emitError(Ce.mseWidthOrHeightChange,`width: ${r.codecWidth}->${i.codecWidth}, height: ${r.codecWidth}->${i.codecHeight}`))}if(sr.isWidthOrHeightChanged)return void ar.debugWarn(sr.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(pi(e))return void ar.debugLog(sr.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLengthsr.prevTs>0&&eS,_decodeConfigurationRecord(e,t,i,r){let s=e.slice(5),a={};if(r===De?a=Ei(s):r===Ie&&(a=Vi(s)),sr.videoInfo.width=a.codecWidth,sr.videoInfo.height=a.codecHeight,0===a.codecWidth&&0===a.codecHeight)return ar.debugWarn(sr.TAG_NAME,"_decodeConfigurationRecord error",JSON.stringify(a)),sr.emitError(Ce.mediaSourceDecoderConfigurationError,`width is ${0===a.codecWidth} and height is ${a.codecHeight}`),!1;const n={id:Ct,type:"video",timescale:1e3,duration:0,avcc:s,codecWidth:a.codecWidth,codecHeight:a.codecHeight,videoType:a.videoType},o=hs.generateInitSegment(n);sr.isAvc=r===De;let d=a.codec;return sr.videoMimeType=d?`video/mp4; codecs="${a.codec}"`:sr.isAvc?ft:pt,postMessage({cmd:x,w:a.codecWidth,h:a.codecHeight}),sr._initSourceBuffer(),sr.appendBuffer(o.buffer),sr.sequenceNumber=0,sr.cacheTrack={},sr.timeInit=!1,!0},_decodeAudioConfigurationRecord(e,t){const i=e[0]>>4,r=e[0]>>1&1,s=i===Ge,a=i===ze;if(mi(a||s))return ar.debugWarn(sr.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${i} ant auto wasm decode`),sr.emitError(Ce.mediaSourceAudioG711NotSupport),!1;const n={id:Lt,type:"audio",timescale:1e3};let o={};if(Wt(e)){if(o=jt(e.slice(2)),!o)return!1;n.audioSampleRate=o.sampleRate,n.channelCount=o.channelCount,n.config=o.config,n.refSampleDuration=1024/n.audioSampleRate*n.timescale}else{if(!s)return!1;if(o=Ss(e),!o)return!1;n.audioSampleRate=o.samplingRate,n.channelCount=o.channelCount,n.refSampleDuration=1152/n.audioSampleRate*n.timescale}n.codec=o.codec,n.duration=0;let d="mp4",l=o.codec,c=null;s&&mi(ar._opt.isFirefox)?(d="mpeg",l="",c=new Uint8Array):c=hs.generateInitSegment(n);let u=`${n.type}/${d}`;return l&&l.length>0&&(u+=`;codecs=${l}`),mi(sr.isAudioInitInfo)&&(Si=i===ze?r?16:8:0===r?8:16,postMessage({cmd:C,code:i}),postMessage({cmd:k,sampleRate:n.audioSampleRate,channels:n.channelCount,depth:Si}),sr.isAudioInitInfo=!0),sr.audioMimeType=u,sr.isAAC=a,sr._initAudioSourceBuffer(),sr.appendAudioBuffer(c.buffer),!0},_initSourceBuffer(){const{proxy:e}=sr.events;if(null===sr.sourceBuffer&&null!==sr.mediaSource&&sr.isStateOpen()&&sr.videoMimeType){try{ar.debugLog(sr.TAG_NAME,"_initSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",sr.videoMimeType),sr.sourceBuffer=sr.mediaSource.addSourceBuffer(sr.videoMimeType)}catch(e){return ar.debugError(sr.TAG_NAME,"_initSourceBuffer() appendBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),sr.emitError(Ce.mseWorkerAddSourceBufferError,e.code),void(sr.mediaSourceAddSourceBufferError=!0)}if(sr.sourceBuffer){const t=e(sr.sourceBuffer,"error",(e=>{sr.mediaSourceBufferError=!0,ar.debugError(sr.TAG_NAME,"mseSourceBufferError mseDecoder.sourceBuffer",e,e.toString()),sr.emitError(Ce.mseSourceBufferError,e.code)})),i=e(sr.sourceBuffer,"updateend",(()=>{sr._hasPendingRemoveRanges()?sr._doRemoveRanges():sr._hasPendingSegments()?sr._doAppendSegments():sr.hasPendingEos&&(ar.debugLog(sr.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),sr.endOfStream())}));sr.eventListenList.push(t,i)}}else ar.debugLog(sr.TAG_NAME,`_initSourceBuffer and mseDecoder.isStateOpen is ${sr.isStateOpen()} and mseDecoder.isAvc === null is ${null===sr.isAvc}`)},_initAudioSourceBuffer(){const{proxy:e}=sr.events;if(null===sr.audioSourceBuffer&&null!==sr.mediaSource&&sr.isStateOpen()&&sr.audioMimeType){try{ar.debugLog(sr.TAG_NAME,"_initAudioSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",sr.audioMimeType),sr._clearAudioSourceBufferCheckTimeout(),sr.audioSourceBuffer=sr.mediaSource.addSourceBuffer(sr.audioMimeType)}catch(e){return ar.debugError(sr.TAG_NAME,"_initAudioSourceBuffer() addSourceBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),sr.emitError(Ce.mseWorkerAddSourceBufferError,e.code),void(sr.mediaSourceAddSourceBufferError=!0)}if(sr.audioSourceBuffer){const t=e(sr.audioSourceBuffer,"error",(e=>{sr.mediaSourceBufferError=!0,ar.debugError(sr.TAG_NAME,"mseSourceBufferError mseDecoder.audioSourceBuffer",e.code,e.toString(),e),sr.emitError(Ce.mseSourceBufferError,e.code)})),i=e(sr.audioSourceBuffer,"updateend",(()=>{sr._hasPendingRemoveRanges()?sr._doRemoveRanges():sr._hasPendingSegments()?sr._doAppendSegments():sr.hasPendingEos&&(ar.debugLog(sr.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),sr.endOfStream())}));sr.eventListenList.push(t,i),null===sr.audioSourceNoDataCheckTimeout&&(sr.audioSourceNoDataCheckTimeout=setTimeout((()=>{sr._clearAudioNoDataCheckTimeout(),sr.emitError(Ce.mediaSourceAudioNoDataTimeout)}),1e3))}}else ar.debugLog(sr.TAG_NAME,`_initAudioSourceBuffer and mseDecoder.isStateOpen is ${sr.isStateOpen()} and mseDecoder.audioMimeType is ${sr.audioMimeType}`)},_decodeVideo(e,t,i,r,s){let a=e.slice(5),n=a.byteLength;if(0===n)return void ar.debugWarn(sr.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let o=(new Date).getTime(),d=!1;sr.prevTimestamp||(sr.prevTimestamp=o,d=!0);const l=o-sr.prevTimestamp;if(sr.decodeDiffTimestamp=l,l>1e3&&!d&&ar.isPlayer&&ar.debugLog(sr.TAG_NAME,`_decodeVideo now time is ${o} and prev time is ${sr.prevTimestamp}, diff time is ${l} ms`),sr.cacheTrack.id&&t>=sr.cacheTrack.dts){let e=8+sr.cacheTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(hs.types.mdat,4),i.set(sr.cacheTrack.data,8),sr.cacheTrack.duration=t-sr.cacheTrack.dts;let r=hs.moof(sr.cacheTrack,sr.cacheTrack.dts);sr.cacheTrack={};let s=new Uint8Array(r.byteLength+i.byteLength);s.set(r,0),s.set(i,r.byteLength),sr.appendBuffer(s.buffer)}else ar.debugLog(sr.TAG_NAME,`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${s} cacheTrack dts is ${sr.cacheTrack&&sr.cacheTrack.dts}`),sr.timeInit=!1,sr.cacheTrack={};sr.cacheTrack||(sr.cacheTrack={}),sr.cacheTrack.id=Ct,sr.cacheTrack.sequenceNumber=++sr.sequenceNumber,sr.cacheTrack.size=n,sr.cacheTrack.dts=t,sr.cacheTrack.cts=r,sr.cacheTrack.isKeyframe=i,sr.cacheTrack.data=a,sr.cacheTrack.flags={isLeading:0,dependsOn:i?2:1,isDependedOn:i?1:0,hasRedundancy:0,isNonSync:i?0:1},sr.prevTimestamp=(new Date).getTime()},_decodeAudio(e,t,i){let r=sr.isAAC?e.slice(2):e.slice(1),s=r.byteLength;if(sr.cacheAudioTrack.id&&t>=sr.cacheAudioTrack.dts){let e=8+sr.cacheAudioTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(hs.types.mdat,4),i.set(sr.cacheAudioTrack.data,8),sr.cacheAudioTrack.duration=t-sr.cacheAudioTrack.dts;let r=hs.moof(sr.cacheAudioTrack,sr.cacheAudioTrack.dts);sr.cacheAudioTrack={};let s=new Uint8Array(r.byteLength+i.byteLength);s.set(r,0),s.set(i,r.byteLength),sr.appendAudioBuffer(s.buffer)}else sr.cacheAudioTrack={};sr.cacheAudioTrack||(sr.cacheAudioTrack={}),sr.cacheAudioTrack.id=Lt,sr.cacheAudioTrack.sequenceNumber=++sr.audioSequenceNumber,sr.cacheAudioTrack.size=s,sr.cacheAudioTrack.dts=t,sr.cacheAudioTrack.cts=0,sr.cacheAudioTrack.data=r,sr.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}},appendBuffer(e){ar.isDestroyed?ar.debugWarn(sr.TAG_NAME,"appendBuffer() player is destroyed"):sr.mediaSourceAddSourceBufferError?ar.debugWarn(sr.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):sr.mediaSourceAppendBufferFull?ar.debugWarn(sr.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):sr.mediaSourceAppendBufferError?ar.debugWarn(sr.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):sr.mediaSourceBufferError?ar.debugWarn(sr.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(sr.pendingSegments.push(e),sr.sourceBuffer&&(ar._opt.mseAutoCleanupSourceBuffer&&sr._needCleanupSourceBuffer()&&sr._doCleanUpSourceBuffer(),mi(sr.getSourceBufferUpdating())&&sr.isStateOpen()&&mi(sr._hasPendingRemoveRanges()))?sr._doAppendSegments():sr.isStateClosed()?(sr.mediaSourceBufferError=!0,sr.emitError(Ce.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):sr.isStateEnded()&&(sr.mediaSourceBufferError=!0,sr.emitError(Ce.mseSourceBufferError,"mediaSource is end")))},appendAudioBuffer(e){ar.isDestroyed?ar.debugWarn(sr.TAG_NAME,"appendAudioBuffer() player is destroyed"):sr.mediaSourceAddSourceBufferError?ar.debugWarn(sr.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):sr.mediaSourceAppendBufferFull?ar.debugWarn(sr.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):sr.mediaSourceAppendBufferError?ar.debugWarn(sr.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):sr.mediaSourceBufferError?ar.debugWarn(sr.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(sr.pendingAudioSegments.push(e),sr.audioSourceBuffer&&(ar._opt.mseAutoCleanupSourceBuffer&&sr._needCleanupSourceBuffer()&&sr._doCleanUpSourceBuffer(),mi(sr.getAudioSourceBufferUpdating())&&sr.isStateOpen()&&mi(sr._hasPendingRemoveRanges()))?sr._doAppendSegments():sr.isStateClosed()?(sr.mediaSourceBufferError=!0,sr.emitError(Ce.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):sr.isStateEnded()&&(sr.mediaSourceBufferError=!0,sr.emitError(Ce.mseSourceBufferError,"mediaSource is end")))},getSourceBufferUpdating:()=>sr.sourceBuffer&&sr.sourceBuffer.updating,getAudioSourceBufferUpdating:()=>sr.audioSourceBuffer&&sr.audioSourceBuffer.updating,stop(){sr.abortSourceBuffer(),sr.removeSourceBuffer(),sr.endOfStream()},clearUpAllSourceBuffer(){if(sr.sourceBuffer){const e=sr.sourceBuffer.buffered;for(let t=0;tsr.pendingSegments.length>0||sr.pendingAudioSegments.length>0,getPendingSegmentsLength:()=>sr.pendingSegments.length,_handleUpdatePlaybackRate(){},_doAppendSegments(){if(sr.isStateClosed()||sr.isStateEnded())ar.debugLog(sr.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==sr.sourceBuffer){if(sr.needInitAudio()&&null===sr.audioSourceBuffer)return ar.debugLog(sr.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===sr.audioSourceBufferCheckTimeout&&(sr.audioSourceBufferCheckTimeout=setTimeout((()=>{sr._clearAudioSourceBufferCheckTimeout(),sr.emitError(Ce.mediaSourceAudioInitTimeout)}),1e3)));if(mi(sr.getSourceBufferUpdating())&&sr.pendingSegments.length>0){const e=sr.pendingSegments.shift();try{sr.sourceBuffer.appendBuffer(e)}catch(e){ar.debugError(sr.TAG_NAME,"mseDecoder.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(sr.stop(),sr.mediaSourceAppendBufferFull=!0,sr.emitError(Ce.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(sr.stop(),sr.mediaSourceAppendBufferError=!0,sr.emitError(Ce.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(sr.stop(),sr.mediaSourceBufferError=!0,sr.emitError(Ce.mseSourceBufferError,`code is ${e.code} , message is ${e.message}`))}}if(mi(sr.getAudioSourceBufferUpdating())&&sr.pendingAudioSegments.length>0){const e=sr.pendingAudioSegments.shift();try{sr.audioSourceBuffer.appendBuffer(e)}catch(e){ar.debugError(sr.TAG_NAME,"mseDecoder.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(sr.stop(),sr.mediaSourceAppendBufferFull=!0,sr.emitError(Ce.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(sr.stop(),sr.mediaSourceAppendBufferError=!0,sr.emitError(Ce.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(sr.stop(),sr.mediaSourceBufferError=!0,sr.emitError(Ce.mseSourceBufferError,e.code,`code is ${e.code} , message is ${e.message}`))}}}else ar.debugLog(sr.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")},_doCleanUpSourceBuffer(){const e=sr.$video.currentTime;if(sr.sourceBuffer){const t=sr.sourceBuffer.buffered;let i=!1;for(let r=0;r=ar._opt.mseAutoCleanupMaxBackwardDuration){i=!0;let t=e-ar._opt.mseAutoCleanupMinBackwardDuration;sr.pendingRemoveRanges.push({start:s,end:t})}}else a=ar._opt.mseAutoCleanupMaxBackwardDuration){i=!0;let t=e-ar._opt.mseAutoCleanupMinBackwardDuration;sr.pendingAudioRemoveRanges.push({start:s,end:t})}}else asr.pendingRemoveRanges.length>0||sr.pendingAudioRemoveRanges.length>0,needInitAudio:()=>ar._opt.hasAudio&&ar._opt.mseDecodeAudio,_doRemoveRanges(){if(sr.sourceBuffer&&mi(sr.getSourceBufferUpdating())){let e=sr.pendingRemoveRanges;for(;e.length&&mi(sr.getSourceBufferUpdating());){let t=e.shift();try{sr.sourceBuffer.remove(t.start,t.end)}catch(e){ar.debugWarn(sr.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e,e.toString())}}}if(sr.audioSourceBuffer&&mi(sr.getAudioSourceBufferUpdating())){let e=sr.pendingAudioRemoveRanges;for(;e.length&&mi(sr.getAudioSourceBufferUpdating());){let t=e.shift();try{sr.audioSourceBuffer.remove(t.start,t.end)}catch(e){ar.debugWarn(sr.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e,e.toString())}}}},_getPlaybackRate(){},_needCleanupSourceBuffer(){if(mi(ar._opt.mseAutoCleanupSourceBuffer))return!1;const e=sr.$video.currentTime;if(sr.sourceBuffer){let t=sr.sourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=ar._opt.mseAutoCleanupMaxBackwardDuration)return!0}if(sr.audioSourceBuffer){let t=sr.audioSourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=ar._opt.mseAutoCleanupMaxBackwardDuration)return!0}return!1},_clearAudioSourceBufferCheckTimeout(){sr.audioSourceBufferCheckTimeout&&(clearTimeout(sr.audioSourceBufferCheckTimeout),sr.audioSourceBufferCheckTimeout=null)},_clearAudioNoDataCheckTimeout(){sr.audioSourceNoDataCheckTimeout&&(clearTimeout(sr.audioSourceNoDataCheckTimeout),sr.audioSourceNoDataCheckTimeout=null)},getHandle:()=>sr.mediaSource.handle,emitError(e){postMessage({cmd:ie,value:e,msg:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""})}});let ar={isPlayer:!0,isHevc:null,isPlayback:!1,dropping:!1,isPushDropping:!1,isWorkerFetch:!1,isDestroyed:!1,fetchStatus:Et,_opt:Ni(),mp3Demuxer:null,delay:-1,pushLatestDelay:-1,firstTimestamp:null,startTimestamp:null,preDelayTimestamp:null,stopId:null,streamFps:null,streamAudioFps:null,streamVideoFps:null,writableStream:null,networkDelay:0,webglObj:null,startStreamRateAndStatsInterval:function(){ar.stopStreamRateAndStatsInterval(),l=setInterval((()=>{d&&d(0);const e=JSON.stringify({demuxBufferDelay:ar.getVideoBufferLength(),audioDemuxBufferDelay:ar.getAudioBufferLength(),streamBufferByteLength:ar.getStreamBufferLength(),netBuf:ar.networkDelay||0,pushLatestDelay:ar.pushLatestDelay||0,latestDelay:ar.delay,isStreamTsMoreThanLocal:Je,wasmDecodeDelay:Ke-Xe});postMessage({cmd:R,type:Ee,value:e})}),1e3)},stopStreamRateAndStatsInterval:function(){l&&(clearInterval(l),l=null)},useOffscreen:function(){return ar._opt.useOffscreen&&"undefined"!=typeof OffscreenCanvas},getDelay:function(e,t){if(!e||ar._opt.hasVideo&&!Ve)return-1;if(t===re)return ar.delay;if(ar.preDelayTimestamp&&ar.preDelayTimestamp>e)return ar.preDelayTimestamp-e>1e3&&ar.debugWarn("worker",`getDelay() and preDelayTimestamp is ${ar.preDelayTimestamp} > timestamp is ${e} more than ${ar.preDelayTimestamp-e}ms and return ${ar.delay}`),ar.preDelayTimestamp=e,ar.delay;if(ar.firstTimestamp){if(e){const t=Date.now()-ar.startTimestamp,i=e-ar.firstTimestamp;t>=i?(Je=!1,ar.delay=t-i):(Je=!0,ar.delay=i-t)}}else ar.firstTimestamp=e,ar.startTimestamp=Date.now(),ar.delay=-1;return ar.preDelayTimestamp=e,ar.delay},getDelayNotUpdateDelay:function(e,t){if(!e||ar._opt.hasVideo&&!Ve)return-1;if(t===re)return ar.pushLatestDelay;if(ar.preDelayTimestamp&&ar.preDelayTimestamp-e>1e3)return ar.debugWarn("worker",`getDelayNotUpdateDelay() and preDelayTimestamp is ${ar.preDelayTimestamp} > timestamp is ${e} more than ${ar.preDelayTimestamp-e}ms and return -1`),-1;if(ar.firstTimestamp){let t=-1;if(e){const i=Date.now()-ar.startTimestamp,r=e-ar.firstTimestamp;i>=r?(Je=!1,t=i-r):(Je=!0,t=r-i)}return t}return-1},resetDelay:function(){ar.firstTimestamp=null,ar.startTimestamp=null,ar.delay=-1,ar.dropping=!1},resetAllDelay:function(){ar.resetDelay(),ar.preDelayTimestamp=null},doDecode:function(e){ar._opt.isEmitSEI&&e.type===se&&ar.isWorkerFetch&&ar.findSei(e.payload,e.ts),ar.isPlayUseMSEAndDecoderInWorker()?e.type===re?ar._opt.mseDecodeAudio?sr.decodeAudio(e.payload,e.ts):e.decoder.decode(e.payload,e.ts):e.type===se&&sr.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):ar._opt.useWCS&&ar.useOffscreen()&&e.type===se&&a.decode?a.decode(e.payload,e.ts,e.cts):e.decoder.decode(e.payload,e.ts,e.isIFrame,e.cts)},decodeNext(e){if(0===r.length)return;const t=e.ts,s=r[0],a=e.type===se&&pi(e.payload);if(mi(i))a&&(ar.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${s.type} ts is ${s.ts}\n isVideoSqeHeader is ${a}`),r.shift(),ar.doDecode(s));else{const i=s.ts-t,n=s.type===re&&e.type===se;(i<=20||n||a)&&(ar.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${s.type} ts is ${s.ts}\n diff is ${i} and isVideoAndNextAudio is ${n} and isVideoSqeHeader is ${a}`),r.shift(),ar.doDecode(s))}},init:function(){ar.debugLog("worker","init and opt is",JSON.stringify(ar._opt));const e=ar._opt.playType===m,t=ar._opt.playType===g;if($i.init(),ar.isPlayer=e,ar.isPlayback=t,ar.isPlayUseMSEAndDecoderInWorker()&&sr&&sr.init(),a&&ar._opt.useWCS&&ar.useOffscreen()&&a.init(),mi(ar.isPlaybackCacheBeforeDecodeForFpsRender())){ar.debugLog("worker","setInterval()");const t=()=>{const t=ar._opt.videoBuffer+ar._opt.videoBufferDelay;let i=null;if(r.length){if(ar.isPushDropping)return void ar.debugWarn("worker",`loop() isPushDropping is true and bufferList length is ${r.length}`);if(ar.dropping){for(i=r.shift(),ar.debugWarn("worker",`loop() dropBuffer is dropping and isIFrame ${i.isIFrame} and delay is ${ar.delay} and bufferlist is ${r.length}`);!i.isIFrame&&r.length;)i=r.shift();const e=ar.getDelayNotUpdateDelay(i.ts,i.type);i.isIFrame&&e<=ar.getNotDroppingDelayTs()&&(ar.debugLog("worker","loop() is dropping = false, is iFrame"),ar.dropping=!1,ar.doDecode(i),ar.decodeNext(i))}else if(ar.isPlayback||ar.isPlayUseMSE()||0===ar._opt.videoBuffer)for(;r.length;)i=r.shift(),ar.doDecode(i);else if(i=r[0],-1===ar.getDelay(i.ts,i.type))ar.debugLog("worker","loop() common dumex delay is -1 ,data.ts is",i.ts),r.shift(),ar.doDecode(i),ar.decodeNext(i);else if(ar.delay>t&&e)ar.hasIframeInBufferList()?(ar.debugLog("worker",`delay is ${ar.delay} > maxDelay ${t}, set dropping is true`),ar.resetAllDelay(),ar.dropping=!0,postMessage({cmd:G})):(r.shift(),ar.doDecode(i),ar.decodeNext(i));else for(;r.length;){if(i=r[0],!(ar.getDelay(i.ts,i.type)>ar._opt.videoBuffer)){ar.delay<0&&ar.debugWarn("worker",`loop() do not decode and delay is ${ar.delay}, bufferList is ${r.length}`);break}r.shift(),ar.doDecode(i)}}else-1!==ar.delay&&ar.debugLog("worker","loop() bufferList is empty and reset delay"),ar.resetAllDelay()};ar.stopId=setInterval((()=>{let e=(new Date).getTime();et||(et=e);const i=e-et;i>100&&ar.debugWarn("worker",`loop demux diff time is ${i}`),t(),et=(new Date).getTime()}),20)}else ar.debugLog("worker","playback and playbackIsCacheBeforeDecodeForFpsRender is true");if(mi(ar._opt.checkFirstIFrame)&&(Ve=!0),ar.isPlayUseMSEAndDecoderInWorker()&&sr){const e=sr.getHandle();e&&postMessage({cmd:ee,mseHandle:e},[e])}},playbackCacheLoop:function(){ar.clearPlaybackCacheLoop();const e=()=>{let e=null;r.length&&(e=r.shift(),ar.doDecode(e))};e();const t=Math.ceil(1e3/(ar.streamFps*ar._opt.playbackRate));ar.debugLog("worker",`playbackCacheLoop fragDuration is ${t}, streamFps is ${ar.streamFps}, streamAudioFps is ${ar.streamAudioFps} ,streamVideoFps is ${ar.streamVideoFps} playbackRate is ${ar._opt.playbackRate}`),ar.stopId=setInterval(e,t)},clearPlaybackCacheLoop:function(){ar.stopId&&(clearInterval(ar.stopId),ar.stopId=null)},startPlaybackCacheLoop:function(){ar.playbackCacheLoop()},close:function(){if(ar.debugLog("worker","close"),ar.isDestroyed=!0,Gi(),!o||1!==o.readyState&&2!==o.readyState?o&&ar.debugLog("worker",`close() and socket.readyState is ${o.readyState}`):(wi=!0,o.close(1e3,"Client disconnecting")),o=null,ar.stopStreamRateAndStatsInterval(),ar.stopId&&(clearInterval(ar.stopId),ar.stopId=null),ar.mp3Demuxer&&(ar.mp3Demuxer.destroy(),ar.mp3Demuxer=null),ar.writableStream&&mi(ar.writableStream.locked)&&ar.writableStream.close().catch((e=>{ar.debugLog("worker","close() and writableStream.close() error",e.toString(),e)})),ar.writableStream=null,nr)try{nr.clear&&nr.clear(),nr=null}catch(e){ar.debugLog("worker","close() and audioDecoder.clear error",e.toString(),e)}if(or)try{or.clear&&or.clear(),or=null}catch(e){ar.debugLog("worker","close() and videoDecoder.clear error",e.toString())}d=null,et=null,Je=!1,Ke=0,Xe=0,a&&(a.destroy&&a.destroy(),a=null),sr&&(sr.destroy(),sr=null),ar.firstTimestamp=null,ar.startTimestamp=null,ar.networkDelay=0,ar.streamFps=null,ar.streamAudioFps=null,ar.streamVideoFps=null,ar.delay=-1,ar.pushLatestDelay=-1,ar.preDelayTimestamp=null,ar.dropping=!1,ar.isPushDropping=!1,ar.isPlayer=!0,ar.isPlayback=!1,ar.isWorkerFetch=!1,ar.isHevc=null,ar._opt=Ni(),ar.webglObj&&(ar.webglObj.destroy(),ar.offscreenCanvas.removeEventListener("webglcontextlost",ar.onOffscreenCanvasWebglContextLost),ar.offscreenCanvas.removeEventListener("webglcontextrestored",ar.onOffscreenCanvasWebglContextRestored),ar.offscreenCanvas=null,ar.offscreenCanvasGL=null,ar.offscreenCanvasCtx=null),r=[],s=[],c&&(c.close(),c=null),v=null,B=null,be=!1,ve=!1,Ve=!1,Zt=!1,ri=!1,bi=!1,vi=null,wt=[],Rt=0,Nt=0,dt=null,St=null,Gt=null,Ot=null,Si=null,Ht=0,qt=0,Ut=null,zt=null,ar.fetchStatus=Et,xi=!0,$i.destroy(),tr.destroy(),ir.destroy(),rr.destroy(),ar.debug=null,ar._opt={},postMessage({cmd:Y})},pushBuffer:function(e,t){if(t.type===re&&Wt(e)){if(ar.debugLog("worker",`pushBuffer audio ts is ${t.ts}, isAacCodecPacket is true`),ar._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:X,buffer:t},[t.buffer])}ar.decodeAudio(e,t.ts)}else if(t.type===se&&t.isIFrame&&pi(e)){if(ar.debugLog("worker",`pushBuffer video ts is ${t.ts}, isVideoSequenceHeader is true`),ar._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:Z,buffer:t},[t.buffer])}ar.decodeVideo(e,t.ts,t.isIFrame,t.cts)}else{if(ar._opt.isRecording)if(ar._opt.isRecordTypeFlv){const i=new Uint8Array(e);postMessage({cmd:J,type:t.type,buffer:i,ts:t.ts},[i.buffer])}else if(ar._opt.recordType===y)if(t.type===se){const i=new Uint8Array(e).slice(5);postMessage({cmd:P,buffer:i,isIFrame:t.isIFrame,ts:t.ts,cts:t.cts},[i.buffer])}else if(t.type===re&&ar._opt.isWasmMp4){const i=new Uint8Array(e),r=Yt(i)?i.slice(2):i.slice(1);postMessage({cmd:L,buffer:r,ts:t.ts},[r.buffer])}if(ar.isPlayer){if(t.type===se){if(Ht>0){const e=t.ts-Ot,i=Ht+Ht/2;e>i&&ar.debugLog("worker",`pushBuffer video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts}, preTs is ${Ot},\n diff is ${e} and preTsDuration is ${Ht} and maxDiff is ${i}\n maybe trigger black screen or flower screen\n `)}if(null!==Ot&&Ot>=t.ts&&(ar.debugWarn("worker",`pushBuffer() and isIFrame is ${t.isIFrame} and,\n options.ts is ${t.ts} less than (or equal) preTs is ${Ot} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${qt}`),Ot-t.ts>S&&(ar.debugWarn("worker",`pushBuffer,\n preTimestamp is ${Ot}, options.ts is ${t.ts},\n diff is ${Ot-t.ts} more than 3600000,\n and resetAllDelay`),ar.resetAllDelay(),Ot=null,Ht=0),ar._opt.isDropSameTimestampGop&&mi(t.isIFrame)&&Ve)){const e=ar.hasIframeInBufferList(),t=mi(ar.isPushDropping);return ar.debugLog("worker",`pushBuffer, isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next dropBuffer`),void(e&&t?ar.dropBuffer$2():(ar.clearBuffer(!0),_i(ar._opt.checkFirstIFrame)&&_i(i)&&(ar.isPlayUseMSEAndDecoderInWorker()?sr.isDecodeFirstIIframe=!1:postMessage({cmd:Q}))))}Ot>0&&(Ht=t.ts-Ot),qt=e.byteLength,Ot=t.ts}if(Ve){const e=ar._opt.videoBuffer+ar._opt.videoBufferDelay,i=ar.getDelayNotUpdateDelay(t.ts,t.type);ar.pushLatestDelay=i,ar.delay>0&&i>e&&ar.delay({type:e.type,ts:e.ts})));ar.debugLog("worker",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${r.length}, and ts list is ${JSON.stringify(i)}`)}const i=ar.getAudioBufferLength()>0,s=i?60:40;r.length>=s&&(ar.debugWarn("worker",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${r.length} more than ${s}, and hasAudio is ${i} an set streamFps is 25`),ar.streamVideoFps=25,postMessage({cmd:H,value:ar.streamVideoFps}),i?(ar.streamAudioFps=25,ar.streamFps=ar.streamVideoFps+ar.streamAudioFps):ar.streamFps=ar.streamVideoFps,ar.playbackCacheLoop())}}},getVideoBufferLength(){let e=0;return r.forEach((t=>{t.type===se&&(e+=1)})),e},hasIframeInBufferList:()=>r.some((e=>e.type===se&&e.isIFrame)),isAllIframeInBufferList(){const e=ar.getVideoBufferLength();let t=0;return r.forEach((e=>{e.type===se&&e.isIFrame&&(t+=1)})),e===t},getNotDroppingDelayTs:()=>ar._opt.videoBuffer+ar._opt.videoBufferDelay/2,getAudioBufferLength(){let e=0;return r.forEach((t=>{t.type===re&&(e+=1)})),e},getStreamBufferLength(){let e=0;return c&&c.buffer&&(e=c.buffer.byteLength),ar._opt.isNakedFlow?$i.lastBuf&&(e=$i.lastBuf.byteLength):ar._opt.isTs?rr._remainingPacketData&&(e=rr._remainingPacketData.byteLength):ar._opt.isFmp4&&tr.mp4Box&&(e=tr.mp4Box.getAllocatedSampleDataSize()),e},fetchStream:function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(ar.debugLog("worker","fetchStream, url is "+e,"options:",JSON.stringify(t)),ar.isWorkerFetch=!0,t.isFlv?ar._opt.isFlv=!0:t.isFmp4?ar._opt.isFmp4=!0:t.isMpeg4?ar._opt.isMpeg4=!0:t.isNakedFlow?ar._opt.isNakedFlow=!0:t.isTs&&(ar._opt.isTs=!0),d=si((e=>{postMessage({cmd:R,type:we,value:e})})),ar.startStreamRateAndStatsInterval(),t.isFmp4&&(tr.listenMp4Box(),ar._opt.isFmp4Private&&tr.initTransportDescarmber()),t.protocol===f){t.isFlv&&(c=new Ai(ar.demuxFlv())),n=new AbortController;const i=Object.assign({signal:n.signal},{headers:t.options&&t.options.headers||{}});fetch(e,i).then((e=>{if(_i(wi))return ar.debugLog("worker","request abort and run res.body.cancel()"),ar.fetchStatus=Et,void e.body.cancel();if(!hi(e))return ar.debugWarn("worker",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),Gi(),void postMessage({cmd:R,type:Ce.fetchError,value:`fetch response status is ${e.status} and ok is ${e.ok}`});if(postMessage({cmd:R,type:xe}),li())ar.writableStream=new WritableStream({write:e=>n&&n.signal&&n.signal.aborted?(ar.debugLog("worker","writableStream write() and abortController.signal.aborted is true so return"),void(ar.fetchStatus=kt)):_i(wi)?(ar.debugLog("worker","writableStream write() and requestAbort is true so return"),ar.fetchStatus=kt,void Gi()):void("string"!=typeof e?(ar.fetchStatus=Tt,d(e.byteLength),t.isFlv?c.write(e):t.isFmp4?ar.demuxFmp4(e):t.isMpeg4?ar.demuxMpeg4(e):t.isTs?ar.demuxTs(e):t.isNakedFlow&&ar.demuxNakedFlow(e)):ar.debugWarn("worker",`writableStream write() and value is "${e}" string so return`)),close:()=>{ar.debugLog("worker","writableStream close()"),ar.fetchStatus=kt,c&&(c.close(),c=null),Gi(),postMessage({cmd:R,type:Se,value:p,msg:"fetch done"})},abort:e=>{if(n&&n.signal&&n.signal.aborted)return ar.debugLog("worker","writableStream abort() and abortController.signal.aborted is true so return"),void(ar.fetchStatus=kt);c&&(c.close(),c=null),e.name!==At?(ar.debugLog("worker",`writableStream abort() and e is ${e.toString()}`),Gi(),postMessage({cmd:R,type:Ce.fetchError,value:e.toString()})):ar.debugLog("worker","writableStream abort() and e.name is AbortError so return")}}),e.body.pipeTo(ar.writableStream).catch((e=>{"AbortError"!==e.name&&ar.debugLog("worker","writableStream pipeTo() and e is",e.name,e.toString())}));else{const i=e.body.getReader(),r=()=>{i.read().then((e=>{let{done:i,value:s}=e;return i?(ar.debugLog("worker","fetchNext().then() and done is true"),ar.fetchStatus=kt,c&&(c.close(),c=null),Gi(),void postMessage({cmd:R,type:Se,value:p,msg:"fetch done"})):n&&n.signal&&n.signal.aborted?(ar.debugLog("worker","fetchNext().then() and abortController.signal.aborted is true so return"),void(ar.fetchStatus=kt)):_i(wi)?(ar.debugLog("worker","fetchNext().then() and requestAbort is true so return"),ar.fetchStatus=kt,void Gi()):void("string"!=typeof s?(ar.fetchStatus=Tt,d(s.byteLength),t.isFlv?c.write(s):t.isFmp4?ar.demuxFmp4(s):t.isMpeg4?ar.demuxMpeg4(s):t.isTs?ar.demuxTs(s):t.isNakedFlow&&ar.demuxNakedFlow(s),r()):ar.debugWarn("worker",`fetchNext().then() and value "${s}" is string so return`))})).catch((e=>{if(n&&n.signal&&n.signal.aborted)return ar.debugLog("worker","fetchNext().catch() and abortController.signal.aborted is true so return"),void(ar.fetchStatus=kt);c&&(c.close(),c=null),e.name!==At?(ar.debugLog("worker",`fetchNext().catch() and e is ${e.toString()}`),Gi(),postMessage({cmd:R,type:Ce.fetchError,value:e.toString()})):ar.debugLog("worker","fetchNext().catch() and e.name is AbortError so return")}))};r()}})).catch((e=>{n&&n.signal&&n.signal.aborted?ar.debugLog("worker","fetch().catch() and abortController.signal.aborted is true so return"):e.name!==At?(ar.debugLog("worker",`fetch().catch() and e is ${e.toString()}`),Gi(),postMessage({cmd:R,type:Ce.fetchError,value:e.toString()}),c&&(c.close(),c=null)):ar.debugLog("worker","fetch().catch() and e.name is AbortError so return")}))}else t.protocol===h&&(t.isFlv&&(c=new Ai(ar.demuxFlv())),o=new WebSocket(e,i),o.binaryType="arraybuffer",o.onopen=()=>{ar.debugLog("worker","fetchStream, WebsocketStream socket open"),postMessage({cmd:R,type:xe}),postMessage({cmd:R,type:ke})},o.onclose=e=>{ar.isDestroyed?ar.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} and isDestroyed is true, so return`):b?ar.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} but isSocketError is true , so return`):(ar.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code}`),1006===e.code&&ar.debugError("worker",`fetchStream, WebsocketStream socket close abnormally and code is ${e.code}`),_i(wi)?ar.debugLog("worker","fetchStream, WebsocketStream socket close and requestAbort is true so return"):(c&&(c.close(),c=null),postMessage({cmd:R,type:Se,value:_,msg:e.code})))},o.onerror=e=>{ar.debugError("worker","fetchStream, WebsocketStream socket error",e,e.toString()),b=!0,c&&(c.close(),c=null),ar.isDestroyed?ar.debugLog("worker","fetchStream, WebsocketStream on error and isDestroyed is true, so return"):postMessage({cmd:R,type:Ce.websocketError,value:e.isTrusted?"websocket user aborted":"websocket error"})},o.onmessage=e=>{"string"!=typeof e.data?(d(e.data.byteLength),t.isFlv?c.write(e.data):t.isFmp4?ar.demuxFmp4(e.data):t.isMpeg4?ar.demuxMpeg4(e.data):ar._opt.isNakedFlow?ar.demuxNakedFlow(e.data):ar.demuxM7s(e.data)):ar.debugWarn("worker",`socket on message is string "${e.data}" and return`)})},demuxFlv:function*(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),i=new Uint32Array(e);for(;;){t[3]=0;const e=yield 15,r=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const s=i[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let a=i[0];const n=(yield s).slice();switch(r){case ae:if(n.byteLength>0){let e=n;_i(ar._opt.m7sCryptoAudio)&&(e=ar.cryptoPayloadAudio(n)),ar.decode(e,{type:re,ts:a})}else ar.debugWarn("worker",`demuxFlv() type is audio and payload.byteLength is ${n.byteLength} and return`);break;case ne:if(n.byteLength>=6){const e=n[0];if(ar._isEnhancedH265Header(e))ar._decodeEnhancedH265Video(n,a);else{const e=15&n[0];let t=n[0]>>4===xt;const r=e===Ie;if(mi(t)&&_i(yi(n,r))&&(ar.debugLog("worker","demux() isIFrame is false and unit type is IDR and update to true"),t=!0),t&&pi(n)&&null===ar.isHevc){const e=15&n[0];ar.isHevc=e===Ie,vi=ei(n,ar.isHevc),ar.debugLog("worker",`demuxFlv() isVideoSequenceHeader is true and isHevc is ${ar.isHevc} and nalUnitSize is ${vi}`)}t&&ar.calcIframeIntervalTimestamp(a),ar.isPlayer&&ar.calcNetworkDelay(a),i[0]=n[4],i[1]=n[3],i[2]=n[2],i[3]=0;let s=i[0],o=ar.cryptoPayload(n,t);ar.decode(o,{type:se,ts:a,isIFrame:t,cts:s})}}else ar.debugWarn("worker",`demuxFlv() type is video and payload.byteLength is ${n.byteLength} and return`);break;case oe:postMessage({cmd:K,buffer:n},[n.buffer]);break;default:ar.debugLog("worker",`demuxFlv() type is ${r}`)}}},decode:function(e,t){t.type===re?ar._opt.hasAudio&&(postMessage({cmd:R,type:Ae,value:e.byteLength}),ar.isPlayer?ar.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts}):ar.isPlayback&&(ar.isPlaybackOnlyDecodeIFrame()||(ar.isPlaybackCacheBeforeDecodeForFpsRender(),ar.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts})))):t.type===se&&ar._opt.hasVideo&&(postMessage({cmd:R,type:Be,value:e.byteLength}),postMessage({cmd:R,type:Ue,value:t.ts}),ar.isPlayer?ar.pushBuffer(e,{type:t.type,ts:t.ts,isIFrame:t.isIFrame,cts:t.cts}):ar.isPlayback&&(ar.isPlaybackOnlyDecodeIFrame()?t.isIFrame&&ar.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}):(ar.isPlaybackCacheBeforeDecodeForFpsRender(),ar.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}))))},cryptoPayload:function(e,t){let i=e;return ar._opt.isM7sCrypto?ar._opt.cryptoIV&&ar._opt.cryptoIV.byteLength>0&&ar._opt.cryptoKey&&ar._opt.cryptoKey.byteLength>0?i=Mr(e,ar._opt.cryptoKey,ar._opt.cryptoIV,ar.isHevc):ar.debugError("worker",`isM7sCrypto cryptoKey.length is ${ar._opt.cryptoKey&&ar._opt.cryptoKey.byteLength} or cryptoIV.length is ${ar._opt.cryptoIV&&ar._opt.cryptoIV.byteLength} null`):ar._opt.isSm4Crypto?ar._opt.sm4CryptoKey?i=ar._opt.cryptoIV&&ar._opt.cryptoIV.byteLength>0&&ar._opt.cryptoKey&&ar._opt.cryptoKey.byteLength>0?Js(e,ar._opt.cryptoKey,ar._opt.cryptoIV,ar.isHevc,ar._opt.isSm4CryptoH265V2):ss(e,ar._opt.sm4CryptoKey,ar.isHevc,ar._opt.isSm4CryptoH265V2):ar._opt.sm4CryptoKey||ar.debugError("worker","isSm4Crypto opt.sm4CryptoKey is null"):ar._opt.isXorCrypto&&(ar._opt.cryptoIV&&ar._opt.cryptoIV.byteLength>0&&ar._opt.cryptoKey&&ar._opt.cryptoKey.byteLength>0?i=ls(e,ar._opt.cryptoKey,ar._opt.cryptoIV,ar.isHevc):ar.debugError("worker",`isXorCrypto cryptoKey.length is ${ar._opt.cryptoKey&&ar._opt.cryptoKey.byteLength} or cryptoIV.length is ${ar._opt.cryptoIV&&ar._opt.cryptoIV.byteLength} null`)),i},cryptoPayloadAudio:function(e){let t=e;if(ar._opt.isM7sCrypto)if(ar._opt.cryptoIV&&ar._opt.cryptoIV.byteLength>0&&ar._opt.cryptoKey&&ar._opt.cryptoKey.byteLength>0){e[0]>>4===ze&&(t=zr(e,ar._opt.cryptoKey,ar._opt.cryptoIV))}else ar.debugError("worker",`isM7sCrypto cryptoKey.length is ${ar._opt.cryptoKey&&ar._opt.cryptoKey.byteLength} or cryptoIV.length is ${ar._opt.cryptoIV&&ar._opt.cryptoIV.byteLength} null`);return t},setCodecAudio:function(e,t){const i=e[0]>>4,r=e[0]>>1&1;if(Si=i===ze?r?16:8:0===r?8:16,nr&&nr.setCodec)if(Wt(e)||i===Re||i===Ne||i===Ge){ar.debugLog("worker",`setCodecAudio: init audio codec, codeId is ${i} _opt.sampleRate is ${ar._opt.sampleRate}`);const r=i===ze?e.slice(2):new Uint8Array(0);nr.setCodec(i,ar._opt.sampleRate,r),i===ze&&postMessage({cmd:D,buffer:r},[r.buffer]),ve=!0,i!==ze&&(i===Ge?(ar.mp3Demuxer||(ar.mp3Demuxer=new ns(ar),ar.mp3Demuxer.on("data",((e,t)=>{nr.decode(e,t)}))),ar.mp3Demuxer.dispatch(e.slice(1),t)):nr.decode(e.slice(1),t));{const e=Number("1")||1;setTimeout((()=>{ar.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),ar.close(),postMessage({cmd:O})}),60*e*60*1e3)}}else ar.debugWarn("worker","setCodecAudio: hasInitAudioCodec is false, codecId is ",i);else ar.debugError("worker","setCodecAudio: audioDecoder or audioDecoder.setCodec is null")},decodeAudio:function(e,t){if(ar.isDestroyed)ar.debugLog("worker","decodeAudio, decoder is destroyed and return");else if(ar.isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio())sr.decodeAudio(e,t);else if(_i(i)&&_i(ar._opt.mseDecodeAudio))postMessage({cmd:z,payload:e,ts:t,cts:t},[e.buffer]);else{const i=e[0]>>4;if(ve){if(Wt(e))return void ar.debugLog("worker","decodeAudio and has already initialized and payload is aac codec packet so drop this frame");i===Ge?ar.mp3Demuxer.dispatch(e.slice(1),t):nr.decode(i===ze?e.slice(2):e.slice(1),t)}else ar.setCodecAudio(e,t)}},setCodecVideo:function(e,t){const i=15&e[0];if(or&&or.setCodec)if(pi(e))if(i===De||i===Ie){ar.debugLog("worker",`setCodecVideo: init video codec , codecId is ${i}`);const t=e.slice(5);if(i===De&&ar._opt.useSIMD){const e=Ei(t);if(e.codecWidth>w||e.codecHeight>w)return postMessage({cmd:W,value:`width: ${e.codecWidth} > 4080, height: ${e.codecHeight} > 4080`}),void ar.debugWarn("worker",`setCodecVideo: SIMD H264 decode video width is too large, width is ${e.codecWidth}, height is ${e.codecHeight}`)}const r=new Uint8Array(e);be=!0,or.setCodec(i,t),postMessage({cmd:I,code:i}),postMessage({cmd:F,buffer:r,codecId:i},[r.buffer])}else ar.debugWarn("worker",`setCodecVideo: hasInitVideoCodec is false, codecId is ${i} is not H264 or H265`);else ar.debugWarn("worker",`decodeVideo: hasInitVideoCodec is false, codecId is ${i} and isIFrame is ${t} and packetType is ${e[1]}`);else ar.debugError("worker","setCodecVideo: videoDecoder or videoDecoder.setCodec is null")},decodeVideo:function(e,t,r){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(ar.isDestroyed)ar.debugLog("worker","decodeVideo, decoder is destroyed and return");else if(ar.isPlayUseMSEAndDecoderInWorker())sr.decodeVideo(e,t,r,s);else if(_i(i))postMessage({cmd:M,payload:e,isIFrame:r,ts:t,cts:s,delay:ar.delay},[e.buffer]);else if(be)if(!Ve&&r&&(Ve=!0),Ve){if(r&&pi(e)){const t=15&e[0];let i={};if(t===De){i=Ei(e.slice(5))}else t===Ie&&(i=Hi(e));i.codecWidth&&i.codecHeight&&v&&B&&(i.codecWidth!==v||i.codecHeight!==B)&&(ar.debugWarn("worker",`\n decodeVideo: video width or height is changed,\n old width is ${v}, old height is ${B},\n new width is ${i.codecWidth}, new height is ${i.codecHeight},\n and emit change event`),ri=!0,postMessage({cmd:V,value:`width: ${v}->${i.codecWidth}, height: ${B}->${i.codecHeight}`}))}if(ri)return void ar.debugWarn("worker","decodeVideo: video width or height is changed, and return");if(bi)return void ar.debugWarn("worker","decodeVideo: simd decode error, and return");if(pi(e))return void ar.debugLog("worker","decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength0&&void 0!==arguments[0]&&arguments[0];ar.debugLog("worker",`clearBuffer,bufferList length is ${r.length}, need clear is ${e}`),e&&(r=[]),ar.isPlayer&&(ar.resetAllDelay(),_i(ar._opt.checkFirstIFrame)&&(ar.dropping=!0,postMessage({cmd:G}))),_i(ar._opt.checkFirstIFrame)&&mi(i)&&(Ve=!1)},dropBuffer$2:function(){if(r.length>0){let e=r.findIndex((e=>_i(e.isIFrame)&&e.type===se));if(ar.isAllIframeInBufferList())for(let t=0;t=ar.getNotDroppingDelayTs()){ar.debugLog("worker",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${s} and notDroppingDelayTs is ${ar.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){ar.isPushDropping=!0,postMessage({cmd:G});const t=r.length;r=r.slice(e);const i=r.shift();ar.resetAllDelay(),ar.getDelay(i.ts,i.type),ar.doDecode(i),ar.isPushDropping=!1,ar.debugLog("worker",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,new bufferList is ${r.length} and new delay is ${ar.delay} `)}else ar.isPushDropping=!1}0===r.length&&(ar.isPushDropping=!1)},demuxM7s:function(e){const t=new DataView(e),i=t.getUint32(1,!1),r=t.getUint8(0),s=new ArrayBuffer(4),a=new Uint32Array(s);switch(r){case re:ar.decode(new Uint8Array(e,5),{type:re,ts:i});break;case se:if(t.byteLength>=11){const r=new Uint8Array(e,5),s=r[0];if(ar._isEnhancedH265Header(s))ar._decodeEnhancedH265Video(r,i);else{const e=t.getUint8(5)>>4==1;if(e&&(ar.calcIframeIntervalTimestamp(i),pi(r)&&null===ar.isHevc)){const e=15&r[0];ar.isHevc=e===Ie}ar.isPlayer&&ar.calcNetworkDelay(i),a[0]=r[4],a[1]=r[3],a[2]=r[2],a[3]=0;let s=a[0],n=ar.cryptoPayload(r,e);ar.decode(n,{type:se,ts:i,isIFrame:e,cts:s})}}else ar.debugWarn("worker",`demuxM7s() type is video and arrayBuffer length is ${e.byteLength} and return`)}},demuxNakedFlow:function(e){$i.dispatch(e)},demuxFmp4:function(e){tr.dispatch(e)},demuxMpeg4:function(e){ir.dispatch(e)},demuxTs:function(e){rr.dispatch(e)},_decodeEnhancedH265Video:function(e,t){const i=e[0],r=48&i,s=15&i,a=e.slice(1,5),n=new ArrayBuffer(4),o=new Uint32Array(n),d="a"==String.fromCharCode(a[0]);if(ar.isHevc=mi(d),s===It){if(r===Mt){const i=e.slice(5);if(d);else{const r=new Uint8Array(5+i.length);r.set([28,0,0,0,0],0),r.set(i,5),vi=ei(e,ar.isHevc),ar.debugLog("worker",`demuxFlv() isVideoSequenceHeader(enhancedH265) is true and isHevc is ${ar.isHevc} and nalUnitSize is ${vi}`),ar.decode(r,{type:se,ts:t,isIFrame:!0,cts:0})}}}else if(s===Ft){let i=e,s=0;const a=r===Mt;if(a&&ar.calcIframeIntervalTimestamp(t),d);else{o[0]=e[4],o[1]=e[3],o[2]=e[2],o[3]=0,s=o[0];i=qi(e.slice(8),a),i=ar.cryptoPayload(i,a),ar.decode(i,{type:se,ts:t,isIFrame:a,cts:s})}}else if(s===Pt){const i=r===Mt;i&&ar.calcIframeIntervalTimestamp(t);let s=qi(e.slice(5),i);s=ar.cryptoPayload(s,i),ar.decode(s,{type:se,ts:t,isIFrame:i,cts:0})}},_isEnhancedH265Header:function(e){return(e&Dt)===Dt},findSei:function(e,t){let i=4;ni(vi)&&(i=vi);Jt(e.slice(5),i).forEach((e=>{const i=ar.isHevc?e[0]>>>1&63:31&e[0],r=ar.isHevc&&(i===ct||i===lt),s=mi(ar.isHevc)&&i===Ye;(r||s)&&postMessage({cmd:j,buffer:e,ts:t},[e.buffer])}))},calcNetworkDelay:function(e){if(!(Ve&&e>0))return;null===dt?(dt=e,St=ti()):et?i-t:0;ar.networkDelay=r,r>ar._opt.networkDelay&&ar._opt.playType===m&&(ar.debugWarn("worker",`calcNetworkDelay now dts:${e}, start dts is ${dt} vs start is ${t},local diff is ${i} ,delay is ${r}`),postMessage({cmd:R,type:Te,value:r}))},calcIframeIntervalTimestamp:function(e){null===Gt?Gt=e:Gt=ar._opt.playbackForwardMaxRateDecodeIFrame&&!(ar._opt.useMSE&&ar._opt.mseDecodeAudio)},isPlayUseMSE:function(){return ar.isPlayer&&ar._opt.useMSE&&_i(i)},isPlayUseMSEAndDecoderInWorker:function(){return ar.isPlayUseMSE()&&ar._opt.mseDecoderUseWorker},isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio:function(){return ar.isPlayUseMSEAndDecoderInWorker()&&ar._opt.mseDecodeAudio},playbackUpdatePlaybackRate:function(){mi(ar.isPlaybackCacheBeforeDecodeForFpsRender())&&ar.clearBuffer(!0)},onOffscreenCanvasWebglContextLost:function(e){ar.debugError("worker","handleOffscreenCanvasWebglContextLost and next try to create webgl"),e.preventDefault(),Zt=!0,ar.webglObj.destroy(),ar.webglObj=null,ar.offscreenCanvasGL=null,setTimeout((()=>{ar.offscreenCanvasGL=ar.offscreenCanvas.getContext("webgl"),ar.offscreenCanvasGL&&ar.offscreenCanvasGL.getContextAttributes().stencil?(ar.webglObj=u(ar.offscreenCanvasGL,ar._opt.openWebglAlignment),Zt=!1):ar.debugError("worker","handleOffscreenCanvasWebglContextLost, stencil is false")}),500)},onOffscreenCanvasWebglContextRestored:function(e){ar.debugLog("worker","handleOffscreenCanvasWebglContextRestored"),e.preventDefault()},videoInfo:function(e,t,i){postMessage({cmd:I,code:e}),postMessage({cmd:x,w:t,h:i}),v=t,B=i,ar.useOffscreen()&&(ar.offscreenCanvas=new OffscreenCanvas(t,i),ar.offscreenCanvasGL=ar.offscreenCanvas.getContext("webgl"),ar.webglObj=u(ar.offscreenCanvasGL,ar._opt.openWebglAlignment),ar.offscreenCanvas.addEventListener("webglcontextlost",ar.onOffscreenCanvasWebglContextLost,!1),ar.offscreenCanvas.addEventListener("webglcontextrestored",ar.onOffscreenCanvasWebglContextRestored,!1))},audioInfo:function(e,t,i){postMessage({cmd:C,code:e}),postMessage({cmd:k,sampleRate:t,channels:i,depth:Si}),Nt=i},yuvData:function(t,i){if(ar.isDestroyed)return void ar.debugLog("worker","yuvData, decoder is destroyed and return");const r=v*B*3/2;let s=e.HEAPU8.subarray(t,t+r),a=new Uint8Array(s);if(Ut=null,Xe=i,ar.useOffscreen())try{if(Zt)return;ar.webglObj.renderYUV(v,B,a);let e=ar.offscreenCanvas.transferToImageBitmap();postMessage({cmd:E,buffer:e,delay:ar.delay,ts:i},[e])}catch(e){ar.debugError("worker","yuvData, transferToImageBitmap error is",e,e.toString())}else postMessage({cmd:E,output:a,delay:ar.delay,ts:i},[a.buffer])},pcmData:function(e,i,r){if(ar.isDestroyed)return void ar.debugLog("worker","pcmData, decoder is destroyed and return");let a=i,n=[],o=0,d=ar._opt.audioBufferSize;for(let i=0;i<2;i++){let r=t.HEAPU32[(e>>2)+i]>>2;n[i]=t.HEAPF32.subarray(r,r+a)}if(Rt){if(!(a>=(i=d-Rt)))return Rt+=a,s[0]=Float32Array.of(...s[0],...n[0]),void(2==Nt&&(s[1]=Float32Array.of(...s[1],...n[1])));wt[0]=Float32Array.of(...s[0],...n[0].subarray(0,i)),2==Nt&&(wt[1]=Float32Array.of(...s[1],...n[1].subarray(0,i))),postMessage({cmd:T,buffer:wt,ts:r},wt.map((e=>e.buffer))),o=i,a-=i}for(Rt=a;Rt>=d;Rt-=d)wt[0]=n[0].slice(o,o+=d),2==Nt&&(wt[1]=n[1].slice(o-d,o)),postMessage({cmd:T,buffer:wt,ts:r},wt.map((e=>e.buffer)));Rt&&(s[0]=n[0].slice(o),2==Nt&&(s[1]=n[1].slice(o))),n=[]},errorInfo:function(e){null===Ut&&(Ut=ti());const t=ti(),i=ii(zt>0?2*zt:5e3,1e3,5e3),r=t-Ut;r>i&&(ar.debugWarn("worker",`errorInfo() emit simdDecodeError and\n iframeIntervalTimestamp is ${zt} and diff is ${r} and maxDiff is ${i}\n and replay`),bi=!0,postMessage({cmd:$}))},sendWebsocketMessage:function(e){o?o.readyState===Le?o.send(e):ar.debugError("worker","socket is not open"):ar.debugError("worker","socket is null")},timeEnd:function(){ar.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),ar.close(),postMessage({cmd:O})},postStreamToMain(e,t){postMessage({cmd:q,type:t,buffer:e},[e.buffer])},updatePlaybackIsPause(e){ar.debugLog("worker",`updatePlaybackIsPause, isPause is ${e}`),_i(e)?ar.clearPlaybackCacheLoop():ar.startPlaybackCacheLoop()},debugLog(e){if(ar._opt.debug&&ar.debug){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:{};var t,i,s;(s=e).ready=new Promise(((e,r)=>{t=e,i=r})),(s=void 0!==s?s:{}).locateFile=function(e){return"decoder-pro-audio.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_AUDIO_WASM_URL&&""!=JESSIBUCA_PRO_AUDIO_WASM_URL?JESSIBUCA_PRO_AUDIO_WASM_URL:e};var n,a,o,d=Object.assign({},s),l="./this.program",c="object"==typeof window,u="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";function p(e){return s.locateFile?s.locateFile(e,f):f+e}if(h){const{createRequire:e}=await import("module");var m=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-hard.js",document.baseURI).href),_=m("fs"),g=m("path");f=u?g.dirname(f)+"/":m("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-hard.js",document.baseURI).href)),n=(e,t)=>(e=J(e)?new URL(e):g.normalize(e),_.readFileSync(e,t?void 0:"utf8")),o=e=>{var t=n(e,!0);return t.buffer||(t=new Uint8Array(t)),t},a=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=J(e)?new URL(e):g.normalize(e),_.readFile(e,i?void 0:"utf8",((e,s)=>{e?r(e):t(i?s.buffer:s)}))},!s.thisProgram&&process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),s.inspect=()=>"[Emscripten Module object]"}else(c||u)&&(u?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),r&&(f=r),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",n=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},u&&(o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),a=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var y,v,b=s.print||console.log.bind(console),w=s.printErr||console.error.bind(console);Object.assign(s,d),d=null,s.arguments&&s.arguments,s.thisProgram&&(l=s.thisProgram),s.quit&&s.quit,s.wasmBinary&&(y=s.wasmBinary),"object"!=typeof WebAssembly&&j("no native wasm support detected");var S,E,A,B,U,x,k,T,C=!1;function D(e,t){e||j(t)}function L(){var e=v.buffer;s.HEAP8=S=new Int8Array(e),s.HEAP16=A=new Int16Array(e),s.HEAPU8=E=new Uint8Array(e),s.HEAPU16=B=new Uint16Array(e),s.HEAP32=U=new Int32Array(e),s.HEAPU32=x=new Uint32Array(e),s.HEAPF32=k=new Float32Array(e),s.HEAPF64=T=new Float64Array(e)}var I=[],F=[],P=[];function M(){if(s.preRun)for("function"==typeof s.preRun&&(s.preRun=[s.preRun]);s.preRun.length;)N(s.preRun.shift());se(I)}function R(){s.noFSInit||Te.init.initialized||Te.init(),Te.ignorePermissions=!1,se(F)}function z(){if(s.postRun)for("function"==typeof s.postRun&&(s.postRun=[s.postRun]);s.postRun.length;)G(s.postRun.shift());se(P)}function N(e){I.unshift(e)}function O(e){F.unshift(e)}function G(e){P.unshift(e)}var $=0,H=null;function V(e){$++,s.monitorRunDependencies&&s.monitorRunDependencies($)}function W(e){if($--,s.monitorRunDependencies&&s.monitorRunDependencies($),0==$&&H){var t=H;H=null,t()}}function j(e){s.onAbort&&s.onAbort(e),w(e="Aborted("+e+")"),C=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}var q,Y,K,X="data:application/octet-stream;base64,",Z=e=>e.startsWith(X),J=e=>e.startsWith("file://");function Q(e){if(e==q&&y)return new Uint8Array(y);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}function ee(e){if(!y&&(c||u)){if("function"==typeof fetch&&!J(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>Q(e)));if(a)return new Promise(((t,r)=>{a(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>Q(e)))}function te(e,t,r){return ee(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{w(`failed to asynchronously prepare wasm: ${e}`),j(e)}))}function re(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||Z(t)||J(t)||h||"function"!=typeof fetch?te(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return w(`wasm streaming compile failed: ${e}`),w("falling back to ArrayBuffer instantiation"),te(t,r,i)}))))}function ie(){var e={a:si};function t(e,t){return ni=e.exports,v=ni.E,L(),It=ni.H,O(ni.F),W(),ni}if(V(),s.instantiateWasm)try{return s.instantiateWasm(e,t)}catch(e){w(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return re(y,q,e,(function(e){t(e.instance)})).catch(i),{}}s.locateFile?Z(q="decoder-pro-audio.wasm")||(q=p(q)):q=new URL("decoder-pro-audio.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-hard.js",document.baseURI).href).href;var se=e=>{for(;e.length>0;)e.shift()(s)};function ne(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){x[this.ptr+4>>2]=e},this.get_type=function(){return x[this.ptr+4>>2]},this.set_destructor=function(e){x[this.ptr+8>>2]=e},this.get_destructor=function(){return x[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,S[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=S[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,S[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=S[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){x[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return x[this.ptr+16>>2]},this.get_exception_ptr=function(){if(ci(this.get_type()))return x[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}s.noExitRuntime;var ae=(e,t,r)=>{throw new ne(e).init(t,r),e},oe=e=>(U[oi()>>2]=e,e),de={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var s=e[i];"."===s?e.splice(i,1):".."===s?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=de.isAbs(e),r="/"===e.substr(-1);return(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=de.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=de.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return de.normalize(e.join("/"))},join2:(e,t)=>de.normalize(e+"/"+t)},le=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}j("initRandomDevice")},ce=e=>(ce=le())(e),ue={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:Te.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=de.isAbs(i)}return(t?"/":"")+(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=ue.resolve(e).substr(1),t=ue.resolve(t).substr(1);for(var i=r(e.split("/")),s=r(t.split("/")),n=Math.min(i.length,s.length),a=n,o=0;o{for(var i=t+r,s=t;e[s]&&!(s>=i);)++s;if(s-t>16&&e.buffer&&he)return he.decode(e.subarray(t,s));for(var n="";t>10,56320|1023&l)}}else n+=String.fromCharCode((31&a)<<6|o)}else n+=String.fromCharCode(a)}return n},pe=[],me=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},_e=(e,t,r,i)=>{if(!(i>0))return 0;for(var s=r,n=r+i-1,a=0;a=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a)),o<=127){if(r>=n)break;t[r++]=o}else if(o<=2047){if(r+1>=n)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=n)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=n)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o}}return t[r]=0,r-s};function ge(e,t,r){var i=r>0?r:me(e)+1,s=new Array(i),n=_e(e,s,0,s.length);return t&&(s.length=n),s}var ye=()=>{if(!pe.length){var e=null;if(h){var t=Buffer.alloc(256),r=0,i=process.stdin.fd;try{r=_.readSync(i,t)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}e=r>0?t.slice(0,r).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;pe=ge(e,!0)}return pe.shift()},ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},Te.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new Te.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,i,s){if(!e.tty||!e.tty.ops.get_char)throw new Te.ErrnoError(60);for(var n=0,a=0;aye(),put_char(e,t){null===t||10===t?(b(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(b(fe(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(w(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(w(fe(e.output,0)),e.output=[])}}},be=e=>{j()},we={ops_table:null,mount:e=>we.createNode(null,"/",16895,0),createNode(e,t,r,i){if(Te.isBlkdev(r)||Te.isFIFO(r))throw new Te.ErrnoError(63);we.ops_table||(we.ops_table={dir:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,lookup:we.node_ops.lookup,mknod:we.node_ops.mknod,rename:we.node_ops.rename,unlink:we.node_ops.unlink,rmdir:we.node_ops.rmdir,readdir:we.node_ops.readdir,symlink:we.node_ops.symlink},stream:{llseek:we.stream_ops.llseek}},file:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:{llseek:we.stream_ops.llseek,read:we.stream_ops.read,write:we.stream_ops.write,allocate:we.stream_ops.allocate,mmap:we.stream_ops.mmap,msync:we.stream_ops.msync}},link:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,readlink:we.node_ops.readlink},stream:{}},chrdev:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:Te.chrdev_stream_ops}});var s=Te.createNode(e,t,r,i);return Te.isDir(s.mode)?(s.node_ops=we.ops_table.dir.node,s.stream_ops=we.ops_table.dir.stream,s.contents={}):Te.isFile(s.mode)?(s.node_ops=we.ops_table.file.node,s.stream_ops=we.ops_table.file.stream,s.usedBytes=0,s.contents=null):Te.isLink(s.mode)?(s.node_ops=we.ops_table.link.node,s.stream_ops=we.ops_table.link.stream):Te.isChrdev(s.mode)&&(s.node_ops=we.ops_table.chrdev.node,s.stream_ops=we.ops_table.chrdev.stream),s.timestamp=Date.now(),e&&(e.contents[t]=s,e.timestamp=s.timestamp),s},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Te.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,Te.isDir(e.mode)?t.size=4096:Te.isFile(e.mode)?t.size=e.usedBytes:Te.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&we.resizeFileStorage(e,t.size)},lookup(e,t){throw Te.genericErrors[44]},mknod:(e,t,r,i)=>we.createNode(e,t,r,i),rename(e,t,r){if(Te.isDir(e.mode)){var i;try{i=Te.lookupNode(t,r)}catch(e){}if(i)for(var s in i.contents)throw new Te.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=Te.lookupNode(e,t);for(var i in r.contents)throw new Te.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink(e,t,r){var i=we.createNode(e,t,41471,0);return i.link=r,i},readlink(e){if(!Te.isLink(e.mode))throw new Te.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,i,s){var n=e.node.contents;if(s>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-s,i);if(a>8&&n.subarray)t.set(n.subarray(s,s+a),r);else for(var o=0;o0||r+t(we.stream_ops.write(e,t,0,i,r,!1),0)}},Se=(e,t,r,i)=>{var s=i?"":`al ${e}`;a(e,(r=>{D(r,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(r)),s&&W()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),s&&V()},Ee=(e,t,r,i,s,n)=>{Te.createDataFile(e,t,r,i,s,n)},Ae=s.preloadPlugins||[],Be=(e,t,r,i)=>{"undefined"!=typeof Browser&&Browser.init();var s=!1;return Ae.forEach((n=>{s||n.canHandle(t)&&(n.handle(e,t,r,i),s=!0)})),s},Ue=(e,t,r,i,s,n,a,o,d,l)=>{var c=t?ue.resolve(de.join2(e,t)):e;function u(r){function u(r){l&&l(),o||Ee(e,t,r,i,s,d),n&&n(),W()}Be(r,c,u,(()=>{a&&a(),W()}))||u(r)}V(),"string"==typeof r?Se(r,(e=>u(e)),a):u(r)},xe=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t},ke=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Te={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=ue.resolve(e)))return{path:"",node:null};if(t=Object.assign({follow_mount:!0,recurse_count:0},t),t.recurse_count>8)throw new Te.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),i=Te.root,s="/",n=0;n40)throw new Te.ErrnoError(32)}}return{path:s,node:i}},getPath(e){for(var t;;){if(Te.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,i=0;i>>0)%Te.nameTable.length},hashAddNode(e){var t=Te.hashName(e.parent.id,e.name);e.name_next=Te.nameTable[t],Te.nameTable[t]=e},hashRemoveNode(e){var t=Te.hashName(e.parent.id,e.name);if(Te.nameTable[t]===e)Te.nameTable[t]=e.name_next;else for(var r=Te.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=Te.mayLookup(e);if(r)throw new Te.ErrnoError(r,e);for(var i=Te.hashName(e.id,t),s=Te.nameTable[i];s;s=s.name_next){var n=s.name;if(s.parent.id===e.id&&n===t)return s}return Te.lookup(e,t)},createNode(e,t,r,i){var s=new Te.FSNode(e,t,r,i);return Te.hashAddNode(s),s},destroyNode(e){Te.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>Te.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){var t=Te.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{return Te.lookupNode(e,t),20}catch(e){}return Te.nodePermissions(e,"wx")},mayDelete(e,t,r){var i;try{i=Te.lookupNode(e,t)}catch(e){return e.errno}var s=Te.nodePermissions(e,"wx");if(s)return s;if(r){if(!Te.isDir(i.mode))return 54;if(Te.isRoot(i)||Te.getPath(i)===Te.cwd())return 10}else if(Te.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?Te.isLink(e.mode)?32:Te.isDir(e.mode)&&("r"!==Te.flagsToPermissionString(t)||512&t)?31:Te.nodePermissions(e,Te.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Te.MAX_OPEN_FDS;e++)if(!Te.streams[e])return e;throw new Te.ErrnoError(33)},getStreamChecked(e){var t=Te.getStream(e);if(!t)throw new Te.ErrnoError(8);return t},getStream:e=>Te.streams[e],createStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return Te.FSStream||(Te.FSStream=function(){this.shared={}},Te.FSStream.prototype={},Object.defineProperties(Te.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},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(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new Te.FSStream,e),-1==t&&(t=Te.nextfd()),e.fd=t,Te.streams[t]=e,e},closeStream(e){Te.streams[e]=null},chrdev_stream_ops:{open(e){var t=Te.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek(){throw new Te.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Te.devices[e]={stream_ops:t}},getDevice:e=>Te.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),Te.syncFSRequests++,Te.syncFSRequests>1&&w(`warning: ${Te.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Te.getMounts(Te.root.mount),i=0;function s(e){return Te.syncFSRequests--,t(e)}function n(e){if(e)return n.errored?void 0:(n.errored=!0,s(e));++i>=r.length&&s(null)}r.forEach((t=>{if(!t.type.syncfs)return n(null);t.type.syncfs(t,e,n)}))},mount(e,t,r){var i,s="/"===r,n=!r;if(s&&Te.root)throw new Te.ErrnoError(10);if(!s&&!n){var a=Te.lookupPath(r,{follow_mount:!1});if(r=a.path,i=a.node,Te.isMountpoint(i))throw new Te.ErrnoError(10);if(!Te.isDir(i.mode))throw new Te.ErrnoError(54)}var o={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(o);return d.mount=o,o.root=d,s?Te.root=d:i&&(i.mounted=o,i.mount&&i.mount.mounts.push(o)),d},unmount(e){var t=Te.lookupPath(e,{follow_mount:!1});if(!Te.isMountpoint(t.node))throw new Te.ErrnoError(28);var r=t.node,i=r.mounted,s=Te.getMounts(i);Object.keys(Te.nameTable).forEach((e=>{for(var t=Te.nameTable[e];t;){var r=t.name_next;s.includes(t.mount)&&Te.destroyNode(t),t=r}})),r.mounted=null;var n=r.mount.mounts.indexOf(i);r.mount.mounts.splice(n,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var i=Te.lookupPath(e,{parent:!0}).node,s=de.basename(e);if(!s||"."===s||".."===s)throw new Te.ErrnoError(28);var n=Te.mayCreate(i,s);if(n)throw new Te.ErrnoError(n);if(!i.node_ops.mknod)throw new Te.ErrnoError(63);return i.node_ops.mknod(i,s,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,Te.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,Te.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),i="",s=0;s(void 0===r&&(r=t,t=438),t|=8192,Te.mknod(e,t,r)),symlink(e,t){if(!ue.resolve(e))throw new Te.ErrnoError(44);var r=Te.lookupPath(t,{parent:!0}).node;if(!r)throw new Te.ErrnoError(44);var i=de.basename(t),s=Te.mayCreate(r,i);if(s)throw new Te.ErrnoError(s);if(!r.node_ops.symlink)throw new Te.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename(e,t){var r,i,s=de.dirname(e),n=de.dirname(t),a=de.basename(e),o=de.basename(t);if(r=Te.lookupPath(e,{parent:!0}).node,i=Te.lookupPath(t,{parent:!0}).node,!r||!i)throw new Te.ErrnoError(44);if(r.mount!==i.mount)throw new Te.ErrnoError(75);var d,l=Te.lookupNode(r,a),c=ue.relative(e,n);if("."!==c.charAt(0))throw new Te.ErrnoError(28);if("."!==(c=ue.relative(t,s)).charAt(0))throw new Te.ErrnoError(55);try{d=Te.lookupNode(i,o)}catch(e){}if(l!==d){var u=Te.isDir(l.mode),h=Te.mayDelete(r,a,u);if(h)throw new Te.ErrnoError(h);if(h=d?Te.mayDelete(i,o,u):Te.mayCreate(i,o))throw new Te.ErrnoError(h);if(!r.node_ops.rename)throw new Te.ErrnoError(63);if(Te.isMountpoint(l)||d&&Te.isMountpoint(d))throw new Te.ErrnoError(10);if(i!==r&&(h=Te.nodePermissions(r,"w")))throw new Te.ErrnoError(h);Te.hashRemoveNode(l);try{r.node_ops.rename(l,i,o)}catch(e){throw e}finally{Te.hashAddNode(l)}}},rmdir(e){var t=Te.lookupPath(e,{parent:!0}).node,r=de.basename(e),i=Te.lookupNode(t,r),s=Te.mayDelete(t,r,!0);if(s)throw new Te.ErrnoError(s);if(!t.node_ops.rmdir)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.rmdir(t,r),Te.destroyNode(i)},readdir(e){var t=Te.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new Te.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=Te.lookupPath(e,{parent:!0}).node;if(!t)throw new Te.ErrnoError(44);var r=de.basename(e),i=Te.lookupNode(t,r),s=Te.mayDelete(t,r,!1);if(s)throw new Te.ErrnoError(s);if(!t.node_ops.unlink)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.unlink(t,r),Te.destroyNode(i)},readlink(e){var t=Te.lookupPath(e).node;if(!t)throw new Te.ErrnoError(44);if(!t.node_ops.readlink)throw new Te.ErrnoError(28);return ue.resolve(Te.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=Te.lookupPath(e,{follow:!t}).node;if(!r)throw new Te.ErrnoError(44);if(!r.node_ops.getattr)throw new Te.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>Te.stat(e,!0),chmod(e,t,r){var i;if(!(i="string"==typeof e?Te.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new Te.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod(e,t){Te.chmod(e,t,!0)},fchmod(e,t){var r=Te.getStreamChecked(e);Te.chmod(r.node,t)},chown(e,t,r,i){var s;if(!(s="string"==typeof e?Te.lookupPath(e,{follow:!i}).node:e).node_ops.setattr)throw new Te.ErrnoError(63);s.node_ops.setattr(s,{timestamp:Date.now()})},lchown(e,t,r){Te.chown(e,t,r,!0)},fchown(e,t,r){var i=Te.getStreamChecked(e);Te.chown(i.node,t,r)},truncate(e,t){if(t<0)throw new Te.ErrnoError(28);var r;if(!(r="string"==typeof e?Te.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new Te.ErrnoError(63);if(Te.isDir(r.mode))throw new Te.ErrnoError(31);if(!Te.isFile(r.mode))throw new Te.ErrnoError(28);var i=Te.nodePermissions(r,"w");if(i)throw new Te.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=Te.getStreamChecked(e);if(0==(2097155&r.flags))throw new Te.ErrnoError(28);Te.truncate(r.node,t)},utime(e,t,r){var i=Te.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new Te.ErrnoError(44);var i;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?xe(t):t)?4095&r|32768:0,"object"==typeof e)i=e;else{e=de.normalize(e);try{i=Te.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var n=!1;if(64&t)if(i){if(128&t)throw new Te.ErrnoError(20)}else i=Te.mknod(e,r,0),n=!0;if(!i)throw new Te.ErrnoError(44);if(Te.isChrdev(i.mode)&&(t&=-513),65536&t&&!Te.isDir(i.mode))throw new Te.ErrnoError(54);if(!n){var a=Te.mayOpen(i,t);if(a)throw new Te.ErrnoError(a)}512&t&&!n&&Te.truncate(i,0),t&=-131713;var o=Te.createStream({node:i,path:Te.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return o.stream_ops.open&&o.stream_ops.open(o),!s.logReadFiles||1&t||(Te.readFiles||(Te.readFiles={}),e in Te.readFiles||(Te.readFiles[e]=1)),o},close(e){if(Te.isClosed(e))throw new Te.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Te.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Te.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Te.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,i,s){if(i<0||s<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(1==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.read)throw new Te.ErrnoError(28);var n=void 0!==s;if(n){if(!e.seekable)throw new Te.ErrnoError(70)}else s=e.position;var a=e.stream_ops.read(e,t,r,i,s);return n||(e.position+=a),a},write(e,t,r,i,s,n){if(i<0||s<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.write)throw new Te.ErrnoError(28);e.seekable&&1024&e.flags&&Te.llseek(e,0,2);var a=void 0!==s;if(a){if(!e.seekable)throw new Te.ErrnoError(70)}else s=e.position;var o=e.stream_ops.write(e,t,r,i,s,n);return a||(e.position+=o),o},allocate(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(t<0||r<=0)throw new Te.ErrnoError(28);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(!Te.isFile(e.node.mode)&&!Te.isDir(e.node.mode))throw new Te.ErrnoError(43);if(!e.stream_ops.allocate)throw new Te.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,i,s){if(0!=(2&i)&&0==(2&s)&&2!=(2097155&e.flags))throw new Te.ErrnoError(2);if(1==(2097155&e.flags))throw new Te.ErrnoError(2);if(!e.stream_ops.mmap)throw new Te.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,s)},msync:(e,t,r,i,s)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,s):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new Te.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,i=Te.open(e,t.flags),s=Te.stat(e).size,n=new Uint8Array(s);return Te.read(i,n,0,s,0),"utf8"===t.encoding?r=fe(n,0):"binary"===t.encoding&&(r=n),Te.close(i),r},writeFile(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=Te.open(e,r.flags,r.mode);if("string"==typeof t){var s=new Uint8Array(me(t)+1),n=_e(t,s,0,s.length);Te.write(i,s,0,n,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");Te.write(i,t,0,t.byteLength,void 0,r.canOwn)}Te.close(i)},cwd:()=>Te.currentPath,chdir(e){var t=Te.lookupPath(e,{follow:!0});if(null===t.node)throw new Te.ErrnoError(44);if(!Te.isDir(t.node.mode))throw new Te.ErrnoError(54);var r=Te.nodePermissions(t.node,"x");if(r)throw new Te.ErrnoError(r);Te.currentPath=t.path},createDefaultDirectories(){Te.mkdir("/tmp"),Te.mkdir("/home"),Te.mkdir("/home/web_user")},createDefaultDevices(){Te.mkdir("/dev"),Te.registerDevice(Te.makedev(1,3),{read:()=>0,write:(e,t,r,i,s)=>i}),Te.mkdev("/dev/null",Te.makedev(1,3)),ve.register(Te.makedev(5,0),ve.default_tty_ops),ve.register(Te.makedev(6,0),ve.default_tty1_ops),Te.mkdev("/dev/tty",Te.makedev(5,0)),Te.mkdev("/dev/tty1",Te.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=ce(e).byteLength),e[--t]);Te.createDevice("/dev","random",r),Te.createDevice("/dev","urandom",r),Te.mkdir("/dev/shm"),Te.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Te.mkdir("/proc");var e=Te.mkdir("/proc/self");Te.mkdir("/proc/self/fd"),Te.mount({mount(){var t=Te.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,i=Te.getStreamChecked(r),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return s.parent=s,s}},t}},{},"/proc/self/fd")},createStandardStreams(){s.stdin?Te.createDevice("/dev","stdin",s.stdin):Te.symlink("/dev/tty","/dev/stdin"),s.stdout?Te.createDevice("/dev","stdout",null,s.stdout):Te.symlink("/dev/tty","/dev/stdout"),s.stderr?Te.createDevice("/dev","stderr",null,s.stderr):Te.symlink("/dev/tty1","/dev/stderr"),Te.open("/dev/stdin",0),Te.open("/dev/stdout",1),Te.open("/dev/stderr",1)},ensureErrnoError(){Te.ErrnoError||(Te.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},Te.ErrnoError.prototype=new Error,Te.ErrnoError.prototype.constructor=Te.ErrnoError,[44].forEach((e=>{Te.genericErrors[e]=new Te.ErrnoError(e),Te.genericErrors[e].stack=""})))},staticInit(){Te.ensureErrnoError(),Te.nameTable=new Array(4096),Te.mount(we,{},"/"),Te.createDefaultDirectories(),Te.createDefaultDevices(),Te.createSpecialDirectories(),Te.filesystems={MEMFS:we}},init(e,t,r){Te.init.initialized=!0,Te.ensureErrnoError(),s.stdin=e||s.stdin,s.stdout=t||s.stdout,s.stderr=r||s.stderr,Te.createStandardStreams()},quit(){Te.init.initialized=!1;for(var e=0;ethis.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},n.prototype.setDataGetter=function(e){this.getter=e},n.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),s=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,n=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,a=1048576;s||(a=i);var o=this;o.setDataGetter((e=>{var t=e*a,s=(e+1)*a-1;if(s=Math.min(s,i-1),void 0===o.chunks[e]&&(o.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var s=new XMLHttpRequest;if(s.open("GET",r,!1),i!==a&&s.setRequestHeader("Range","bytes="+e+"-"+t),s.responseType="arraybuffer",s.overrideMimeType&&s.overrideMimeType("text/plain; charset=x-user-defined"),s.send(null),!(s.status>=200&&s.status<300||304===s.status))throw new Error("Couldn't load "+r+". Status: "+s.status);return void 0!==s.response?new Uint8Array(s.response||[]):ge(s.responseText||"",!0)})(t,s)),void 0===o.chunks[e])throw new Error("doXHR failed!");return o.chunks[e]})),!n&&i||(a=i=1,i=this.getter(0).length,a=i,b("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!u)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new n;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var o={isDevice:!1,contents:a}}else o={isDevice:!1,url:r};var d=Te.createFile(e,t,o,i,s);o.contents?d.contents=o.contents:o.url&&(d.contents=null,d.url=o.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,t,r,i,s){var n=e.node.contents;if(s>=n.length)return 0;var a=Math.min(n.length-s,i);if(n.slice)for(var o=0;o{var t=d.stream_ops[e];l[e]=function(){return Te.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,s)=>(Te.forceLoadFile(d),c(e,t,r,i,s)),l.mmap=(e,t,r,i,s)=>{Te.forceLoadFile(d);var n=be();if(!n)throw new Te.ErrnoError(48);return c(e,S,n,t,r),{ptr:n,allocated:!0}},d.stream_ops=l,d}},Ce=(e,t)=>e?fe(E,e,t):"",De={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(de.isAbs(t))return t;var i;if(i=-100===e?Te.cwd():De.getStreamFromFD(e).path,0==t.length){if(!r)throw new Te.ErrnoError(44);return i}return de.join2(i,t)},doStat(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&de.normalize(t)!==de.normalize(Te.getPath(e.node)))return-54;throw e}U[r>>2]=i.dev,U[r+4>>2]=i.mode,x[r+8>>2]=i.nlink,U[r+12>>2]=i.uid,U[r+16>>2]=i.gid,U[r+20>>2]=i.rdev,K=[i.size>>>0,(Y=i.size,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+24>>2]=K[0],U[r+28>>2]=K[1],U[r+32>>2]=4096,U[r+36>>2]=i.blocks;var s=i.atime.getTime(),n=i.mtime.getTime(),a=i.ctime.getTime();return K=[Math.floor(s/1e3)>>>0,(Y=Math.floor(s/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+40>>2]=K[0],U[r+44>>2]=K[1],x[r+48>>2]=s%1e3*1e3,K=[Math.floor(n/1e3)>>>0,(Y=Math.floor(n/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+56>>2]=K[0],U[r+60>>2]=K[1],x[r+64>>2]=n%1e3*1e3,K=[Math.floor(a/1e3)>>>0,(Y=Math.floor(a/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+72>>2]=K[0],U[r+76>>2]=K[1],x[r+80>>2]=a%1e3*1e3,K=[i.ino>>>0,(Y=i.ino,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+88>>2]=K[0],U[r+92>>2]=K[1],0},doMsync(e,t,r,i,s){if(!Te.isFile(t.node.mode))throw new Te.ErrnoError(43);if(2&i)return 0;var n=E.slice(e,e+r);Te.msync(t,n,s,r,i)},varargs:void 0,get(){var e=U[+De.varargs>>2];return De.varargs+=4,e},getp:()=>De.get(),getStr:e=>Ce(e),getStreamFromFD:e=>Te.getStreamChecked(e)};function Le(e,t,r){De.varargs=r;try{var i=De.getStreamFromFD(e);switch(t){case 0:if((s=De.get())<0)return-28;for(;Te.streams[s];)s++;return Te.createStream(i,s).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var s=De.get();return i.flags|=s,0;case 5:return s=De.getp(),A[s+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return oe(28),-1}}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}function Ie(e,t,r,i){De.varargs=i;try{t=De.getStr(t),t=De.calculateAt(e,t);var s=i?De.get():0;return Te.open(t,r,s).fd}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}var Fe,Pe,Me,Re=(e,t,r,i,s)=>{},ze=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Fe=e},Ne=e=>{for(var t="",r=e;E[r];)t+=Fe[E[r++]];return t},Oe={},Ge={},$e={},He=e=>{throw new Pe(e)},Ve=e=>{throw new Me(e)},We=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&Ve("Mismatched type converter count");for(var s=0;s{Ge.hasOwnProperty(e)?s[t]=Ge[e]:(n.push(e),Oe.hasOwnProperty(e)||(Oe[e]=[]),Oe[e].push((()=>{s[t]=Ge[e],++a===n.length&&i(s)})))})),0===n.length&&i(s)};function je(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||He(`type "${i}" must have a positive integer typeid pointer`),Ge.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;He(`Cannot register type '${i}' twice`)}if(Ge[e]=t,delete $e[e],Oe.hasOwnProperty(e)){var s=Oe[e];delete Oe[e],s.forEach((e=>e()))}}function qe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return je(e,t,r)}var Ye,Ke=8,Xe=(e,t,r,i)=>{qe(e,{name:t=Ne(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:Ke,readValueFromPointer:function(e){return this.fromWireType(E[e])},destructorFunction:null})},Ze=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Je=e=>{He(e.$$.ptrType.registeredClass.name+" instance already deleted")},Qe=!1,et=e=>{},tt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},rt=e=>{e.count.value-=1,0===e.count.value&&tt(e)},it=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=it(e,t,r.baseClass);return null===i?null:r.downcast(i)},st={},nt=()=>Object.keys(ut).length,at=()=>{var e=[];for(var t in ut)ut.hasOwnProperty(t)&&e.push(ut[t]);return e},ot=[],dt=()=>{for(;ot.length;){var e=ot.pop();e.$$.deleteScheduled=!1,e.delete()}},lt=e=>{Ye=e,ot.length&&Ye&&Ye(dt)},ct=()=>{s.getInheritedInstanceCount=nt,s.getLiveInheritedInstances=at,s.flushPendingDeletes=dt,s.setDelayFunction=lt},ut={},ht=(e,t)=>{for(void 0===t&&He("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},ft=(e,t)=>(t=ht(e,t),ut[t]),pt=(e,t)=>(t.ptrType&&t.ptr||Ve("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&Ve("Both smartPtrType and smartPtr must be specified"),t.count={value:1},_t(Object.create(e,{$$:{value:t}})));function mt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ft(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function s(){return this.isSmartPointer?pt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):pt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var n,a=this.registeredClass.getActualType(t),o=st[a];if(!o)return s.call(this);n=this.isConst?o.constPointerType:o.pointerType;var d=it(t,this.registeredClass,n.registeredClass);return null===d?s.call(this):this.isSmartPointer?pt(n.registeredClass.instancePrototype,{ptrType:n,ptr:d,smartPtrType:this,smartPtr:e}):pt(n.registeredClass.instancePrototype,{ptrType:n,ptr:d})}var _t=e=>"undefined"==typeof FinalizationRegistry?(_t=e=>e,e):(Qe=new FinalizationRegistry((e=>{rt(e.$$)})),_t=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};Qe.register(e,r,e)}return e},et=e=>Qe.unregister(e),_t(e)),gt=()=>{Object.assign(yt.prototype,{isAliasOf(e){if(!(this instanceof yt))return!1;if(!(e instanceof yt))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,s=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)s=i.upcast(s),i=i.baseClass;return t===i&&r===s},clone(){if(this.$$.ptr||Je(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=_t(Object.create(Object.getPrototypeOf(this),{$$:{value:Ze(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),et(this),rt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),ot.push(this),1===ot.length&&Ye&&Ye(dt),this.$$.deleteScheduled=!0,this}})};function yt(){}var vt=(e,t)=>Object.defineProperty(t,"name",{value:e}),bt=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||He(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},wt=(e,t,r)=>{s.hasOwnProperty(e)?((void 0===r||void 0!==s[e].overloadTable&&void 0!==s[e].overloadTable[r])&&He(`Cannot register public name '${e}' twice`),bt(s,e,e),s.hasOwnProperty(r)&&He(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),s[e].overloadTable[r]=t):(s[e]=t,void 0!==r&&(s[e].numArguments=r))},St=48,Et=57,At=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=St&&t<=Et?`_${e}`:e};function Bt(e,t,r,i,s,n,a,o){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=s,this.getActualType=n,this.upcast=a,this.downcast=o,this.pureVirtualFunctions=[]}var Ut=(e,t,r)=>{for(;t!==r;)t.upcast||He(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function xt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ut(t.$$.ptr,r,this.registeredClass)}function kt(e,t){var r;if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=Ut(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&He("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var s=t.clone();r=this.rawShare(r,nr.toHandle((()=>s.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:He("Unsupporting sharing policy")}return r}function Tt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ut(t.$$.ptr,r,this.registeredClass)}function Ct(e){return this.fromWireType(x[e>>2])}var Dt=()=>{Object.assign(Lt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:Ke,readValueFromPointer:Ct,deleteObject(e){null!==e&&e.delete()},fromWireType:mt})};function Lt(e,t,r,i,s,n,a,o,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=s,this.pointeeType=n,this.sharingPolicy=a,this.rawGetPointee=o,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,s||void 0!==t.baseClass?this.toWireType=kt:i?(this.toWireType=xt,this.destructorFunction=null):(this.toWireType=Tt,this.destructorFunction=null)}var It,Ft,Pt=(e,t,r)=>{s.hasOwnProperty(e)||Ve("Replacing nonexistant public symbol"),void 0!==s[e].overloadTable&&void 0!==r?s[e].overloadTable[r]=t:(s[e]=t,s[e].argCount=r)},Mt=(e,t,r)=>{var i=s["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},Rt=[],zt=e=>{var t=Rt[e];return t||(e>=Rt.length&&(Rt.length=e+1),Rt[e]=t=It.get(e)),t},Nt=(e,t,r)=>e.includes("j")?Mt(e,t,r):zt(t).apply(null,r),Ot=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),Nt(e,t,r)}},Gt=(e,t)=>{var r=(e=Ne(e)).includes("j")?Ot(e,t):zt(t);return"function"!=typeof r&&He(`unknown function pointer with signature ${e}: ${t}`),r},$t=(e,t)=>{var r=vt(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},Ht=e=>{var t=di(e),r=Ne(t);return ai(t),r},Vt=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Ge[t]||($e[t]?$e[t].forEach(e):(r.push(t),i[t]=!0))})),new Ft(`${e}: `+r.map(Ht).join([", "]))},Wt=(e,t,r,i,s,n,a,o,d,l,c,u,h)=>{c=Ne(c),n=Gt(s,n),o&&(o=Gt(a,o)),l&&(l=Gt(d,l)),h=Gt(u,h);var f=At(c);wt(f,(function(){Vt(`Cannot construct ${c} due to unbound types`,[i])})),We([e,t,r],i?[i]:[],(function(t){var r,s;t=t[0],s=i?(r=t.registeredClass).instancePrototype:yt.prototype;var a=vt(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new Pe("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new Pe(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new Pe(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(s,{constructor:{value:a}});a.prototype=d;var u=new Bt(c,a,d,h,r,n,o,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new Lt(c,u,!0,!1,!1),m=new Lt(c+"*",u,!1,!1,!1),_=new Lt(c+" const*",u,!1,!0,!1);return st[e]={pointerType:m,constPointerType:_},Pt(f,a),[p,m,_]}))},jt=(e,t)=>{for(var r=[],i=0;i>2]);return r},qt=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Yt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=vt(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,s=e.apply(i,t);return s instanceof Object?s:i}function Kt(e,t,r,i,s,n){var a=t.length;a<2&&He("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||n?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=o?1:2;l{var a=jt(t,r);s=Gt(i,s),We([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Pe(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Vt(`Cannot construct ${e.name} due to unbound types`,a)},We([],a,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Kt(r,i,null,s,n),[]))),[]}))},Zt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Jt=(e,t,r,i,s,n,a,o,d)=>{var l=jt(r,i);t=Ne(t),t=Zt(t),n=Gt(s,n),We([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function s(){Vt(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(s.argCount=r-2,s.className=e.name,c[t]=s):(bt(c,t,i),c[t].overloadTable[r-2]=s),We([],l,(function(s){var o=Kt(i,s,e,n,a,d);return void 0===c[t].overloadTable?(o.argCount=r-2,c[t]=o):c[t].overloadTable[r-2]=o,[]})),[]}))};function Qt(){Object.assign(er.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function er(){this.allocated=[void 0],this.freelist=[]}var tr=new er,rr=e=>{e>=tr.reserved&&0==--tr.get(e).refcount&&tr.free(e)},ir=()=>{for(var e=0,t=tr.reserved;t{tr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),tr.reserved=tr.allocated.length,s.count_emval_handles=ir},nr={toValue:e=>(e||He("Cannot use deleted val. handle = "+e),tr.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return tr.allocate({refcount:1,value:e})}}};function ar(e){return this.fromWireType(U[e>>2])}var or=(e,t)=>{qe(e,{name:t=Ne(t),fromWireType:e=>{var t=nr.toValue(e);return rr(e),t},toWireType:(e,t)=>nr.toHandle(t),argPackAdvance:Ke,readValueFromPointer:ar,destructorFunction:null})},dr=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},lr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(k[e>>2])};case 8:return function(e){return this.fromWireType(T[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},cr=(e,t,r)=>{qe(e,{name:t=Ne(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Ke,readValueFromPointer:lr(t,r),destructorFunction:null})},ur=(e,t,r)=>{switch(t){case 1:return r?e=>S[e>>0]:e=>E[e>>0];case 2:return r?e=>A[e>>1]:e=>B[e>>1];case 4:return r?e=>U[e>>2]:e=>x[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},hr=(e,t,r,i,s)=>{t=Ne(t);var n=e=>e;if(0===i){var a=32-8*r;n=e=>e<>>a}var o=t.includes("unsigned");qe(e,{name:t,fromWireType:n,toWireType:o?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:Ke,readValueFromPointer:ur(t,r,0!==i),destructorFunction:null})},fr=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function s(e){var t=x[e>>2],r=x[e+4>>2];return new i(S.buffer,r,t)}qe(e,{name:r=Ne(r),fromWireType:s,argPackAdvance:Ke,readValueFromPointer:s},{ignoreDuplicateRegistrations:!0})},pr=(e,t,r)=>_e(e,E,t,r),mr=(e,t)=>{var r="std::string"===(t=Ne(t));qe(e,{name:t,fromWireType(e){var t,i=x[e>>2],s=e+4;if(r)for(var n=s,a=0;a<=i;++a){var o=s+a;if(a==i||0==E[o]){var d=Ce(n,o-n);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),n=o+1}}else{var l=new Array(i);for(a=0;a>2]=i,r&&s)pr(t,a,i+1);else if(s)for(var o=0;o255&&(ai(a),He("String has UTF-16 code units that do not fit in 8 bits")),E[a+o]=d}else for(o=0;o{for(var r=e,i=r>>1,s=i+t/2;!(i>=s)&&B[i];)++i;if((r=i<<1)-e>32&&_r)return _r.decode(E.subarray(e,r));for(var n="",a=0;!(a>=t/2);++a){var o=A[e+2*a>>1];if(0==o)break;n+=String.fromCharCode(o)}return n},yr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,s=(r-=2)<2*e.length?r/2:e.length,n=0;n>1]=a,t+=2}return A[t>>1]=0,t-i},vr=e=>2*e.length,br=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var s=U[e+4*r>>2];if(0==s)break;if(++r,s>=65536){var n=s-65536;i+=String.fromCharCode(55296|n>>10,56320|1023&n)}else i+=String.fromCharCode(s)}return i},wr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,s=i+r-4,n=0;n=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++n)),U[t>>2]=a,(t+=4)+4>s)break}return U[t>>2]=0,t-i},Sr=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},Er=(e,t,r)=>{var i,s,n,a,o;r=Ne(r),2===t?(i=gr,s=yr,a=vr,n=()=>B,o=1):4===t&&(i=br,s=wr,a=Sr,n=()=>x,o=2),qe(e,{name:r,fromWireType:e=>{for(var r,s=x[e>>2],a=n(),d=e+4,l=0;l<=s;++l){var c=e+4+l*t;if(l==s||0==a[c>>o]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return ai(e),r},toWireType:(e,i)=>{"string"!=typeof i&&He(`Cannot pass non-string to C++ string type ${r}`);var n=a(i),d=li(4+n+t);return x[d>>2]=n>>o,s(i,d+4,n+t),null!==e&&e.push(ai,d),d},argPackAdvance:Ke,readValueFromPointer:ar,destructorFunction(e){ai(e)}})},Ar=(e,t)=>{qe(e,{isVoid:!0,name:t=Ne(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},Br={},Ur=e=>{var t=Br[e];return void 0===t?Ne(e):t},xr=[],kr=(e,t,r,i,s)=>(e=xr[e])(t=nr.toValue(t),t[r=Ur(r)],i,s),Tr=e=>{var t=xr.length;return xr.push(e),t},Cr=(e,t)=>{var r=Ge[e];return void 0===r&&He(t+" has unknown type "+Ht(e)),r},Dr=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},Lr=(e,t,r)=>{var i=[],s=e.toWireType(i,r);return i.length&&(x[t>>2]=nr.toHandle(i)),s},Ir=(e,t,r)=>{var i=Dr(e,t),s=i.shift();e--;var n="return function (obj, func, destructorsRef, args) {\n",a=0,o=[];0===r&&o.push("obj");for(var d=["retType"],l=[s],c=0;ce.name)).join(", ")}) => ${s.name}>`;return Tr(vt(h,u))},Fr=e=>{var t=nr.toValue(e);qt(t),rr(e)},Pr=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,Mr=()=>{j("")},Rr=()=>Date.now(),zr=(e,t,r)=>E.copyWithin(e,t,t+r),Nr=e=>{j("OOM")},Or=e=>{E.length,Nr()},Gr={},$r=()=>l||"./this.program",Hr=()=>{if(!Hr.strings){var e={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",_:$r()};for(var t in Gr)void 0===Gr[t]?delete e[t]:e[t]=Gr[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Hr.strings=r}return Hr.strings},Vr=(e,t)=>{for(var r=0;r>0]=e.charCodeAt(r);S[t>>0]=0},Wr=(e,t)=>{var r=0;return Hr().forEach(((i,s)=>{var n=t+r;x[e+4*s>>2]=n,Vr(i,n),r+=i.length+1})),0},jr=(e,t)=>{var r=Hr();x[e>>2]=r.length;var i=0;return r.forEach((e=>i+=e.length+1)),x[t>>2]=i,0};function qr(e){try{var t=De.getStreamFromFD(e);return Te.close(t),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Yr(e,t){try{var r=De.getStreamFromFD(e),i=r.tty?2:Te.isDir(r.mode)?3:Te.isLink(r.mode)?7:4;return S[t>>0]=i,A[t+2>>1]=0,K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[t+8>>2]=K[0],U[t+12>>2]=K[1],K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[t+16>>2]=K[0],U[t+20>>2]=K[1],0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Kr=(e,t,r,i)=>{for(var s=0,n=0;n>2],o=x[t+4>>2];t+=8;var d=Te.read(e,S,a,o,i);if(d<0)return-1;if(s+=d,d>2]=n,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Zr(e,t,r,i,s){var n=Pr(t,r);try{if(isNaN(n))return 61;var a=De.getStreamFromFD(e);return Te.llseek(a,n,i),K=[a.position>>>0,(Y=a.position,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[s>>2]=K[0],U[s+4>>2]=K[1],a.getdents&&0===n&&0===i&&(a.getdents=null),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Jr=(e,t,r,i)=>{for(var s=0,n=0;n>2],o=x[t+4>>2];t+=8;var d=Te.write(e,S,a,o,i);if(d<0)return-1;s+=d,void 0!==i&&(i+=d)}return s};function Qr(e,t,r,i){try{var s=De.getStreamFromFD(e),n=Jr(s,t,r);return x[i>>2]=n,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var ei=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=Te.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},ti=365,ri=146;Object.defineProperties(ei.prototype,{read:{get:function(){return(this.mode&ti)===ti},set:function(e){e?this.mode|=ti:this.mode&=~ti}},write:{get:function(){return(this.mode&ri)===ri},set:function(e){e?this.mode|=ri:this.mode&=~ri}},isFolder:{get:function(){return Te.isDir(this.mode)}},isDevice:{get:function(){return Te.isChrdev(this.mode)}}}),Te.FSNode=ei,Te.createPreloadedFile=Ue,Te.staticInit(),ze(),Pe=s.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Me=s.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},gt(),ct(),Dt(),Ft=s.UnboundTypeError=$t(Error,"UnboundTypeError"),Qt(),sr();var ii,si={o:ae,A:Le,s:Ie,q:Re,C:Xe,D:Wt,y:Xt,h:Jt,B:or,l:cr,c:hr,b:fr,m:mr,j:Er,n:Ar,f:kr,g:rr,e:Ir,d:Fr,a:Mr,i:Rr,w:zr,r:Or,u:Wr,v:jr,k:qr,t:Yr,z:Xr,p:Zr,x:Qr},ni=ie(),ai=e=>(ai=ni.G)(e),oi=()=>(oi=ni.I)(),di=e=>(di=ni.J)(e),li=e=>(li=ni.K)(e),ci=e=>(ci=ni.M)(e);function ui(){function e(){ii||(ii=!0,s.calledRun=!0,C||(R(),t(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),z()))}$>0||(M(),$>0||(s.setStatus?(s.setStatus("Running..."),setTimeout((function(){setTimeout((function(){s.setStatus("")}),1),e()}),1)):e()))}if(s.dynCall_viiijj=(e,t,r,i,n,a,o,d)=>(s.dynCall_viiijj=ni.N)(e,t,r,i,n,a,o,d),s.dynCall_jij=(e,t,r,i)=>(s.dynCall_jij=ni.O)(e,t,r,i),s.dynCall_jii=(e,t,r)=>(s.dynCall_jii=ni.P)(e,t,r),s.dynCall_jiji=(e,t,r,i,n)=>(s.dynCall_jiji=ni.Q)(e,t,r,i,n),H=function e(){ii||ui(),ii||(H=e)},s.preInit)for("function"==typeof s.preInit&&(s.preInit=[s.preInit]);s.preInit.length>0;)s.preInit.pop()();return ui(),e.ready}),a=1e-6,o="undefined"!=typeof Float32Array?Float32Array:Array;function d(){var e=new o(16);return o!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function l(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var c,u=function(e,t,r,i,s,n,a){var o=1/(t-r),d=1/(i-s),l=1/(n-a);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*d,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*o,e[13]=(s+i)*d,e[14]=(a+n)*l,e[15]=1,e};function h(e,t,r){var i=new o(3);return i[0]=e,i[1]=t,i[2]=r,i}c=new o(3),o!=Float32Array&&(c[0]=0,c[1]=0,c[2]=0);var f=(e,t)=>{t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);const r=function(){const t=m(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),r=m(e.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))return console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(i)),null;return i}();let i={program:r,attribLocations:{vertexPosition:e.getAttribLocation(r,"aVertexPosition"),texturePosition:e.getAttribLocation(r,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(r,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(r,"uModelMatrix"),viewMatrix:e.getUniformLocation(r,"uViewMatrix"),rgbatexture:e.getUniformLocation(r,"rgbaTexture"),ytexture:e.getUniformLocation(r,"yTexture"),utexture:e.getUniformLocation(r,"uTexture"),vtexture:e.getUniformLocation(r,"vTexture"),isyuv:e.getUniformLocation(r,"isyuv")}},s=function(){const t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),e.STATIC_DRAW);var r=[];r=r.concat([0,1],[1,1],[1,0],[0,0]);const i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW);const s=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,s);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,texPosition:i,indices:s}}(),n=p(),o=p(),c=p(),f=p();function p(){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function m(t,r){const i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(console.log("An error occurred compiling the shaders: "+e.getShaderInfoLog(i)),e.deleteShader(i),null)}function _(t,r){e.viewport(0,0,t,r),e.clearColor(0,0,0,0),e.clearDepth(1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);const n=d();u(n,-1,1,-1,1,.1,100);const p=d();l(p);const m=d();!function(e,t,r,i){var s,n,o,d,c,u,h,f,p,m,_=t[0],g=t[1],y=t[2],v=i[0],b=i[1],w=i[2],S=r[0],E=r[1],A=r[2];Math.abs(_-S)32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let r=e-this._current_word_bits_left;this._fillCurrentWord();let i=Math.min(r,this._current_word_bits_left),s=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const $t=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Ht=$t,Vt=$t;function Wt(e){let{profile:t,sampleRate:r,channel:i}=e;return new Uint8Array([175,0,t<<3|(14&r)>>1,(1&r)<<7|i<<3])}function jt(e){return qt(e)&&e[1]===Ut}function qt(e){return e[0]>>4===Ne}const Yt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Kt(e){let t=new Uint8Array(e),r=null,i=0,s=0,n=0,a=null;if(i=s=t[0]>>>3,n=(7&t[0])<<1|t[1]>>>7,n<0||n>=Yt.length)return void console.error("Flv: AAC invalid sampling frequency index!");let o=Yt[n],d=(120&t[1])>>>3;if(d<0||d>=8)return void console.log("Flv: AAC invalid channel configuration");5===i&&(a=(7&t[1])<<1|t[2]>>>7,t[2]);let l=self.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?n>=6?(i=5,r=new Array(4),a=n-3):(i=2,r=new Array(2),a=n):-1!==l.indexOf("android")?(i=2,r=new Array(2),a=n):(i=5,a=n,r=new Array(4),n>=6?a=n-3:1===d&&(i=2,r=new Array(2),a=n)),r[0]=i<<3,r[0]|=(15&n)>>>1,r[1]=(15&n)<<7,r[1]|=(15&d)<<3,5===i&&(r[1]|=(15&a)>>>1,r[2]=(1&a)<<7,r[2]|=8,r[3]=0),{audioType:"aac",config:r,sampleRate:o,channelCount:d,objectType:i,codec:"mp4a.40."+i,originalCodec:"mp4a.40."+s}}class Xt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+7>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(4095===(r[t+0]<<8|r[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let r=this.current_syncword_offset_,i=(8&e[r+1])>>>3,s=(6&e[r+1])>>>1,n=1&e[r+1],a=(192&e[r+2])>>>6,o=(60&e[r+2])>>>2,d=(1&e[r+2])<<2|(192&e[r+3])>>>6,l=(3&e[r+3])<<11|e[r+4]<<3|(224&e[r+5])>>>5;if(e[r+6],r+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let c=1===n?7:9,u=l-c;r+=c;let h=this.findNextSyncwordOffset(r+u);if(this.current_syncword_offset_=h,0!==i&&1!==i||0!==s)continue;let f=e.subarray(r,r+u);t={},t.audio_object_type=a+1,t.sampling_freq_index=o,t.sampling_frequency=Ht[o],t.channel_config=d,t.data=f}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Zt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+1>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(695===(r[t+0]<<3|r[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),r=0;for(let i=0;i<=t;i++)r<<=8,r|=e.readByte();return r}readNextAACFrame(e){let t=this.data_,r=null;for(;null==r&&!this.eof_flag_;){let i=this.current_syncword_offset_,s=(31&t[i+1])<<8|t[i+2];if(i+3+s>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let n=new Gt(t.subarray(i+3,i+3+s)),a=null;if(n.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(i+3+s),n.destroy();continue}a=e}else{let e=n.readBool();if(e&&n.readBool()){console.error("audioMuxVersionA is Not Supported"),n.destroy();break}if(e&&this.getLATMValue(n),!n.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),n.destroy();break}if(0!==n.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),n.destroy();break}if(0!==n.readBits(4)){console.error("more than 2 numProgram Not Supported"),n.destroy();break}if(0!==n.readBits(3)){console.error("more than 2 numLayer Not Supported"),n.destroy();break}let t=e?this.getLATMValue(n):0,r=n.readBits(5);t-=5;let i=n.readBits(4);t-=4;let s=n.readBits(4);t-=4,n.readBits(3),t-=3,t>0&&n.readBits(t);let o=n.readBits(3);if(0!==o){console.error(`frameLengthType = ${o}. Only frameLengthType = 0 Supported`),n.destroy();break}n.readByte();let d=n.readBool();if(d)if(e)this.getLATMValue(n);else{let e=0;for(;;){e<<=8;let t=n.readBool();if(e+=n.readByte(),!t)break}console.log(e)}n.readBool()&&n.readByte(),a={},a.audio_object_type=r,a.sampling_freq_index=i,a.sampling_frequency=Ht[a.sampling_freq_index],a.channel_config=s,a.other_data_present=d}let o=0;for(;;){let e=n.readByte();if(o+=e,255!==e)break}let d=new Uint8Array(o);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function Qt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return;const r=e.length,i=[];let s,n=0;for(;n+t>>=8),n+=t,s){if(n+s>r)break;i.push(e.subarray(n,n+s)),n+=s}return i}function er(e){const t=e.byteLength,r=new Uint8Array(4);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t;const i=new Uint8Array(t+4);return i.set(r,0),i.set(e,4),i}function tr(e,t){let r=null;return t?e.length>=28&&(r=1+(3&e[26])):e.length>=12&&(r=1+(3&e[9])),r}function rr(){return(new Date).getTime()}function ir(e,t,r){return Math.max(Math.min(e,Math.max(t,r)),Math.min(t,r))}function sr(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function nr(e){let t=0,r=sr();return i=>{if(s=i,"[object Number]"!==Object.prototype.toString.call(s))return;var s;t+=i;const n=sr(),a=n-r;a>=1e3&&(e(t/a*1e3),r=n,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();function ar(e){return null==e}function or(e){return!ar(e)}function dr(e){return"function"==typeof e}function lr(e){let t=null,r=31&e[0];return r!==He&&r!==Ve||(t=Re),t||(r=(126&e[0])>>1,r!==st&&r!==at&&r!==dt||(t=ze)),t}function cr(){return"undefined"!=typeof WritableStream}function ur(e){e.close()}function hr(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let r=e[0],i=null,s=1;if(e.length>0){let t=e[1];t&&t.ts-r.ts>1e5&&(r=t,s=2)}if(r)for(let n=s;n=1e3){e[n-1].ts-r.ts<1e3&&(i=n+1)}}}return i}function fr(e){return e.ok&&e.status>=200&&e.status<=299}function pr(){return function(e){let t="";if("object"==typeof e)try{t=JSON.stringify(e),t=JSON.parse(t)}catch(r){t=e}else t=e;return t}(U)}function mr(e){return e[0]>>4===xt&&e[1]===Ut}function _r(e){return!0===e||"true"===e}function gr(e){return!0!==e&&"true"!==e}function yr(){return!!(self.Worker&&self.MediaSource&&"canConstructInDedicatedWorker"in self.MediaSource&&!0===self.MediaSource.canConstructInDedicatedWorker)}function vr(e,t){const r=Qt(e.slice(5));let i=!1;return r.forEach((e=>{const r=t?e[0]>>>1&63:31&e[0];(t&&(r===Je||r===et||r===rt)||gr(t)&&r===We)&&(i=!0)})),i}var br=function(e,t,r,i){return new(r||(r=Promise))((function(s,n){function a(e){try{d(i.next(e))}catch(e){n(e)}}function o(e){try{d(i.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}d((i=i.apply(e,t||[])).next())}))};const wr=Symbol(32),Sr=Symbol(16),Er=Symbol(8);class Ar{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return br(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,r)=>{var i;this.reject=r,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(i=this.pull)||void 0===i||i.call(this,e)}))}))}readU32(){return this.read(wr)}readU16(){return this.read(Sr)}readU8(){return this.read(Er)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let r=0;const i=e=>t.length<(r=e);if("number"==typeof this.need){if(i(this.need))return;e=t.subarray(0,r)}else if(this.need===wr){if(i(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Sr){if(i(2))return;e=t[0]<<8|t[1]}else if(this.need===Er){if(i(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(i(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,r)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(i(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,r)),e=this.need}return this.consumed+=r,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,r=t+e;if(r<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,r);else{const e=new Uint8Array(r);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,r)}return this.buffer=new Uint8Array(e),this.buffer}}Ar.U32=wr,Ar.U16=Sr,Ar.U8=Er;class Br{constructor(e){this.log=function(t){if(e._opt.debugLevel==w){const n=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s1?r-1:0),s=1;s1?i-1:0),n=1;n=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[s]=t[e],s++);return new Uint8Array(i.buffer,0,s)}static parseSPS(e){let t=Ur._ebsp2rbsp(e),r=new Gt(t);r.readByte();let i=r.readByte();r.readByte();let s=r.readByte();r.readUEG();let n=Ur.getProfileString(i),a=Ur.getLevelString(s),o=1,d=420,l=[0,420,422,444],c=8;if((100===i||110===i||122===i||244===i||44===i||83===i||86===i||118===i||128===i||138===i||144===i)&&(o=r.readUEG(),3===o&&r.readBits(1),o<=3&&(d=l[o]),c=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool())){let e=3!==o?8:12;for(let t=0;t0&&e<16?(b=t[e-1],w=i[e-1]):255===e&&(b=r.readByte()<<8|r.readByte(),w=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);E=r.readBool(),A=t,B=2*e,S=A/B}}let U=1;1===b&&1===w||(U=b/w);let x=0,k=0;if(0===o)x=1,k=2-m;else{x=3===o?1:2,k=(1===o?2:1)*(2-m)}let T=16*(f+1),C=16*(p+1)*(2-m);T-=(_+g)*x,C-=(y+v)*k;let D=Math.ceil(T*U);return r.destroy(),r=null,{profile_string:n,level_string:a,bit_depth:c,ref_frames:h,chroma_format:d,chroma_format_string:Ur.getChromaFormatString(d),frame_rate:{fixed:E,fps:S,fps_den:B,fps_num:A},sar_ratio:{width:b,height:w},codec_size:{width:T,height:C},present_size:{width:D,height:C}}}static parseSPS$2(e){let t=e.subarray(1,4),r="avc1.";for(let e=0;e<3;e++){let i=t[e].toString(16);i.length<2&&(i="0"+i),r+=i}let i=Ur._ebsp2rbsp(e),s=new Gt(i);s.readByte();let n=s.readByte();s.readByte();let a=s.readByte();s.readUEG();let o=Ur.getProfileString(n),d=Ur.getLevelString(a),l=1,c=420,u=[0,420,422,444],h=8,f=8;if((100===n||110===n||122===n||244===n||44===n||83===n||86===n||118===n||128===n||138===n||144===n)&&(l=s.readUEG(),3===l&&s.readBits(1),l<=3&&(c=u[l]),h=s.readUEG()+8,f=s.readUEG()+8,s.readBits(1),s.readBool())){let e=3!==l?8:12;for(let t=0;t0&&e<16?(E=t[e-1],A=r[e-1]):255===e&&(E=s.readByte()<<8|s.readByte(),A=s.readByte()<<8|s.readByte())}if(s.readBool()&&s.readBool(),s.readBool()&&(s.readBits(4),s.readBool()&&s.readBits(24)),s.readBool()&&(s.readUEG(),s.readUEG()),s.readBool()){let e=s.readBits(32),t=s.readBits(32);U=s.readBool(),x=t,k=2*e,B=x/k}}let T=1;1===E&&1===A||(T=E/A);let C=0,D=0;if(0===l)C=1,D=2-y;else{C=3===l?1:2,D=(1===l?2:1)*(2-y)}let L=16*(_+1),I=16*(g+1)*(2-y);L-=(v+b)*C,I-=(w+S)*D;let F=Math.ceil(L*T);return s.destroy(),s=null,{codec_mimetype:r,profile_idc:n,level_idc:a,profile_string:o,level_string:d,chroma_format_idc:l,bit_depth:h,bit_depth_luma:h,bit_depth_chroma:f,ref_frames:m,chroma_format:c,chroma_format_string:Ur.getChromaFormatString(c),frame_rate:{fixed:U,fps:B,fps_den:k,fps_num:x},sar_ratio:{width:E,height:A},codec_size:{width:L,height:I},present_size:{width:F,height:I}}}static _skipScalingList(e,t){let r=8,i=8,s=0;for(let n=0;n=this.buflen)return this.iserro=!0,0;this.iserro=!1,r=this.bufoff+e>8?8-this.bufoff:e,t<<=r,t+=this.buffer[this.bufpos]>>8-this.bufoff-r&255>>8-r,this.bufoff+=r,e-=r,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,r=this.bufoff,i=this.read(e);return this.bufpos=t,this.bufoff=r,i}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.sps,4),t.sps=i}if(t.pps){const e=t.pps.byteLength,r=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.pps,4),t.pps=i}return t}function Tr(e){let{sps:t,pps:r}=e;const i=[23,0,0,0,0,1,66,0,30,255];i[0]=23,i[6]=t[1],i[7]=t[2],i[8]=t[3],i[10]=225,i[11]=t.byteLength>>8&255,i[12]=255&t.byteLength,i.push(...t,1,r.byteLength>>8&255,255&r.byteLength,...r);return new Uint8Array(i)}function Cr(e){let{sps:t,pps:r}=e,i=8+t.byteLength+1+2+r.byteLength,s=!1;const n=Ur.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(s=!0,i+=4);let a=new Uint8Array(i);a[0]=1,a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=255,a[5]=225;let o=t.byteLength;a[6]=o>>>8,a[7]=255&o;let d=8;a.set(t,8),d+=o,a[d]=1;let l=r.byteLength;a[d+1]=l>>>8,a[d+2]=255&l,a.set(r,d+3),d+=3+l,s&&(a[d]=252|n.chroma_format_idc,a[d+1]=248|n.bit_depth_luma-8,a[d+2]=248|n.bit_depth_chroma-8,a[d+3]=0,d+=4);const c=[23,0,0,0,0],u=new Uint8Array(c.length+a.byteLength);return u.set(c,0),u.set(a,c.length),u}function Dr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Lr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Ir(e){return 31&e[0]}function Fr(e){return e===Ye}function Pr(e){return!function(e){return e===He||e===Ve}(e)&&!Fr(e)}function Mr(e){return e===We}function Rr(e){if(0===e.length)return!1;const t=Ir(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=31&e[r],s=(128&e[r])>>>7,n=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=n,i>=Ze||0===s&&(t={type:i,data:e.subarray(r,n)})}return t}}class Nr{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Or=e=>{let t=e,r=t.byteLength,i=new Uint8Array(r),s=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[s]=t[e],s++);return new Uint8Array(i.buffer,0,s)},Gr=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class $r{static _ebsp2rbsp(e){let t=e,r=t.byteLength,i=new Uint8Array(r),s=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[s]=t[e],s++);return new Uint8Array(i.buffer,0,s)}static parseVPS(e){let t=$r._ebsp2rbsp(e),r=new Gt(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}}static parseSPS(e){let t=$r._ebsp2rbsp(e),r=new Gt(t);r.readByte(),r.readByte();let i=0,s=0,n=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<=16?(F=t[e-1],P=i[e-1]):255===e&&(F=r.readBits(16),P=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()){r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())}if(r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),L=r.readBool(),L&&(r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG()),r.readBool()){if(R=r.readBits(32),z=r.readBits(32),r.readBool()&&r.readUEG(),r.readBool()){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let s=0;s<=o;s++){let s=r.readBool();M=s;let n=!0,a=1;s||(n=r.readBool());let o=!1;if(n?r.readUEG():o=r.readBool(),o||(a=r.readUEG()+1),e){for(let e=0;e>6&3,r.general_tier_flag=e[1]>>5&1,r.general_profile_idc=31&e[1],r.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],r.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],r.general_constraint_indicator_flags=r.general_constraint_indicator_flags<<16|e[10]<<8|e[11],r.general_level_idc=e[12],r.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],r.parallelismType=3&e[15],r.chromaFormat=3&e[16],r.bitDepthLumaMinus8=7&e[17],r.bitDepthChromaMinus8=7&e[18],r.avgFrameRate=e[19]<<8|e[20],r.constantFrameRate=e[21]>>6&3,r.numTemporalLayers=e[21]>>3&7,r.temporalIdNested=e[21]>>2&1,r.lengthSizeMinusOne=3&e[21];let i=e[22],s=e.slice(23);for(let e=0;e0)for(let t=r;t<8;t++)e.read(2);i.sub_layer_profile_space=[],i.sub_layer_tier_flag=[],i.sub_layer_profile_idc=[],i.sub_layer_profile_compatibility_flag=[],i.sub_layer_progressive_source_flag=[],i.sub_layer_interlaced_source_flag=[],i.sub_layer_non_packed_constraint_flag=[],i.sub_layer_frame_only_constraint_flag=[],i.sub_layer_level_idc=[];for(let t=0;t{let t=Or(e),r=new Gt(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}})(t),a=(e=>{let t=Or(e),r=new Gt(t);r.readByte(),r.readByte();let i=0,s=0,n=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<16?(F=t[e-1],P=i[e-1]):255===e&&(F=r.readBits(16),P=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),L=r.readBool(),L&&(i+=r.readUEG(),s+=r.readUEG(),n+=r.readUEG(),a+=r.readUEG()),r.readBool()&&(R=r.readBits(32),z=r.readBits(32),r.readBool()&&(r.readUEG(),r.readBool()))){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let s=0;s<=o;s++){let s=r.readBool();M=s;let n=!1,a=1;s||(n=r.readBool());let o=!1;if(n?r.readSEG():o=r.readBool(),o||(cpbcnt=r.readUEG()+1),e)for(let e=0;e{let t=Or(e),r=new Gt(t);r.readByte(),r.readByte(),r.readUEG(),r.readUEG(),r.readBool(),r.readBool(),r.readBits(3),r.readBool(),r.readBool(),r.readUEG(),r.readUEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool()&&r.readUEG(),r.readSEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool(),r.readBool();let i=r.readBool(),s=r.readBool(),n=1;return s&&i?n=0:s?n=3:i&&(n=2),{parallelismType:n}})(r);s=Object.assign(s,n,a,o);let d=23+(5+t.byteLength)+(5+i.byteLength)+(5+r.byteLength),l=new Uint8Array(d);l[0]=1,l[1]=(3&s.general_profile_space)<<6|(s.general_tier_flag?1:0)<<5|31&s.general_profile_idc,l[2]=s.general_profile_compatibility_flags_1||0,l[3]=s.general_profile_compatibility_flags_2||0,l[4]=s.general_profile_compatibility_flags_3||0,l[5]=s.general_profile_compatibility_flags_4||0,l[6]=s.general_constraint_indicator_flags_1||0,l[7]=s.general_constraint_indicator_flags_2||0,l[8]=s.general_constraint_indicator_flags_3||0,l[9]=s.general_constraint_indicator_flags_4||0,l[10]=s.general_constraint_indicator_flags_5||0,l[11]=s.general_constraint_indicator_flags_6||0,l[12]=60,l[13]=240|(3840&s.min_spatial_segmentation_idc)>>8,l[14]=255&s.min_spatial_segmentation_idc,l[15]=252|3&s.parallelismType,l[16]=252|3&s.chroma_format_idc,l[17]=248|7&s.bit_depth_luma_minus8,l[18]=248|7&s.bit_depth_chroma_minus8,l[19]=0,l[20]=0,l[21]=(3&s.constant_frame_rate)<<6|(7&s.num_temporal_layers)<<3|(s.temporal_id_nested?1:0)<<2|3,l[22]=3,l[23]=128|st,l[24]=0,l[25]=1,l[26]=(65280&t.byteLength)>>8,l[27]=(255&t.byteLength)>>0,l.set(t,28),l[23+(5+t.byteLength)+0]=128|at,l[23+(5+t.byteLength)+1]=0,l[23+(5+t.byteLength)+2]=1,l[23+(5+t.byteLength)+3]=(65280&i.byteLength)>>8,l[23+(5+t.byteLength)+4]=(255&i.byteLength)>>0,l.set(i,23+(5+t.byteLength)+5),l[23+(5+t.byteLength+5+i.byteLength)+0]=128|dt,l[23+(5+t.byteLength+5+i.byteLength)+1]=0,l[23+(5+t.byteLength+5+i.byteLength)+2]=1,l[23+(5+t.byteLength+5+i.byteLength)+3]=(65280&r.byteLength)>>8,l[23+(5+t.byteLength+5+i.byteLength)+4]=(255&r.byteLength)>>0,l.set(r,23+(5+t.byteLength+5+i.byteLength)+5);const c=[28,0,0,0,0],u=new Uint8Array(c.length+l.byteLength);return u.set(c,0),u.set(l,c.length),u}function qr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Yr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Kr(e){return(126&e[0])>>1}function Xr(e){return e===ct}function Zr(e){return!function(e){return e>=32&&e<=40}(e)}function Jr(e){return e>=16&&e<=21}function Qr(e){if(0===e.length)return!1;const t=Kr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=e[r]>>1&63,s=(128&e[r])>>>7,n=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=n,0===s&&(t={type:i,data:e.subarray(r,n)})}return t}}class ti{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}function ri(e){return parseInt(e)===e}function ii(e){if(!ri(e.length))return!1;for(var t=0;t255)return!1;return!0}function si(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!ii(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(ri(e.length)&&ii(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function ni(e){return new Uint8Array(e)}function ai(e,t,r,i,s){null==i&&null==s||(e=e.slice?e.slice(i,s):Array.prototype.slice.call(e,i,s)),t.set(e,r)}var oi,di={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},li=(oi="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r>4]+oi[15&i])}return t.join("")}}),ci={16:10,24:12,32:14},ui=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],hi=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],fi=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],pi=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],mi=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],_i=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],gi=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],yi=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],vi=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],bi=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],wi=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Si=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Ei=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Ai=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Bi=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Ui(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=n[t],this._Kd[e-r][t%4]=n[t];for(var a,o=0,d=s;d>16&255]<<24^hi[a>>8&255]<<16^hi[255&a]<<8^hi[a>>24&255]^ui[o]<<24,o+=1,8!=s)for(t=1;t>8&255]<<8^hi[a>>16&255]<<16^hi[a>>24&255]<<24;for(t=s/2+1;t>2,c=d%4,this._Ke[l][c]=n[t],this._Kd[e-l][c]=n[t++],d++}for(var l=1;l>24&255]^Ei[a>>16&255]^Ai[a>>8&255]^Bi[255&a]},xi.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=Ui(e),s=0;s<4;s++)i[s]^=this._Ke[0][s];for(var n=1;n>24&255]^mi[i[(s+1)%4]>>16&255]^_i[i[(s+2)%4]>>8&255]^gi[255&i[(s+3)%4]]^this._Ke[n][s];i=r.slice()}var a,o=ni(16);for(s=0;s<4;s++)a=this._Ke[t][s],o[4*s]=255&(hi[i[s]>>24&255]^a>>24),o[4*s+1]=255&(hi[i[(s+1)%4]>>16&255]^a>>16),o[4*s+2]=255&(hi[i[(s+2)%4]>>8&255]^a>>8),o[4*s+3]=255&(hi[255&i[(s+3)%4]]^a);return o},xi.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=Ui(e),s=0;s<4;s++)i[s]^=this._Kd[0][s];for(var n=1;n>24&255]^vi[i[(s+3)%4]>>16&255]^bi[i[(s+2)%4]>>8&255]^wi[255&i[(s+1)%4]]^this._Kd[n][s];i=r.slice()}var a,o=ni(16);for(s=0;s<4;s++)a=this._Kd[t][s],o[4*s]=255&(fi[i[s]>>24&255]^a>>24),o[4*s+1]=255&(fi[i[(s+3)%4]>>16&255]^a>>16),o[4*s+2]=255&(fi[i[(s+2)%4]>>8&255]^a>>8),o[4*s+3]=255&(fi[255&i[(s+1)%4]]^a);return o};var ki=function(e){if(!(this instanceof ki))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new xi(e)};ki.prototype.encrypt=function(e){if((e=si(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=ni(e.length),r=ni(16),i=0;iNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},Li.prototype.setBytes=function(e){if(16!=(e=si(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Li.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var Ii=function(e,t){if(!(this instanceof Ii))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Li||(t=new Li(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new xi(e)};Ii.prototype.encrypt=function(e){for(var t=si(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,i=0;i>>2]>>>24-n%4*8&255;t[i+n>>>2]|=a<<24-(i+n)%4*8}else for(var o=0;o>>2]=r[o>>>2];return this.sigBytes+=s,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-s%4*8&255;i.push((n>>>4).toString(16)),i.push((15&n).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new l.init(r,t/2)}},h=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s>>2]>>>24-s%4*8&255;i.push(String.fromCharCode(n))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new l.init(r,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,s=i.words,n=i.sigBytes,a=this.blockSize,o=n/(4*a),d=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*a,c=e.min(4*d,n);if(d){for(var u=0;u>>2]|=e[s]<<24-s%4*8;t.call(this,i,r)}else t.apply(this,arguments)};i.prototype=e}}(),r.lib.WordArray)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(){var e=r,t=e.lib.WordArray,i=e.enc;function s(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s>>2]>>>16-s%4*8&65535;i.push(String.fromCharCode(n))}return i.join("")},parse:function(e){for(var r=e.length,i=[],s=0;s>>1]|=e.charCodeAt(s)<<16-s%2*16;return t.create(i,2*r)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535);i.push(String.fromCharCode(a))}return i.join("")},parse:function(e){for(var r=e.length,i=[],n=0;n>>1]|=s(e.charCodeAt(n)<<16-n%2*16);return t.create(i,2*r)}}}(),r.enc.Utf16)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(){var e=r,t=e.lib.WordArray;function i(e,r,i){for(var s=[],n=0,a=0;a>>6-a%4*2;s[n>>>2]|=o<<24-n%4*8,n++}return t.create(s,n)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var s=[],n=0;n>>2]>>>24-n%4*8&255)<<16|(t[n+1>>>2]>>>24-(n+1)%4*8&255)<<8|t[n+2>>>2]>>>24-(n+2)%4*8&255,o=0;o<4&&n+.75*o>>6*(3-o)&63));var d=i.charAt(64);if(d)for(;s.length%4;)s.push(d);return s.join("")},parse:function(e){var t=e.length,r=this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var n=0;n>>6-a%4*2;s[n>>>2]|=o<<24-n%4*8,n++}return t.create(s,n)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,s=t?this._safe_map:this._map;e.clamp();for(var n=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,d=0;d<4&&a+.75*d>>6*(3-d)&63));var l=s.charAt(64);if(l)for(;n.length%4;)n.push(l);return n.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,s=t?this._safe_map:this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var a=0;a>>24)|4278255360&(s<<24|s>>>8)}var n=this._hash.words,a=e[t+0],d=e[t+1],f=e[t+2],p=e[t+3],m=e[t+4],_=e[t+5],g=e[t+6],y=e[t+7],v=e[t+8],b=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],A=e[t+13],B=e[t+14],U=e[t+15],x=n[0],k=n[1],T=n[2],C=n[3];x=l(x,k,T,C,a,7,o[0]),C=l(C,x,k,T,d,12,o[1]),T=l(T,C,x,k,f,17,o[2]),k=l(k,T,C,x,p,22,o[3]),x=l(x,k,T,C,m,7,o[4]),C=l(C,x,k,T,_,12,o[5]),T=l(T,C,x,k,g,17,o[6]),k=l(k,T,C,x,y,22,o[7]),x=l(x,k,T,C,v,7,o[8]),C=l(C,x,k,T,b,12,o[9]),T=l(T,C,x,k,w,17,o[10]),k=l(k,T,C,x,S,22,o[11]),x=l(x,k,T,C,E,7,o[12]),C=l(C,x,k,T,A,12,o[13]),T=l(T,C,x,k,B,17,o[14]),x=c(x,k=l(k,T,C,x,U,22,o[15]),T,C,d,5,o[16]),C=c(C,x,k,T,g,9,o[17]),T=c(T,C,x,k,S,14,o[18]),k=c(k,T,C,x,a,20,o[19]),x=c(x,k,T,C,_,5,o[20]),C=c(C,x,k,T,w,9,o[21]),T=c(T,C,x,k,U,14,o[22]),k=c(k,T,C,x,m,20,o[23]),x=c(x,k,T,C,b,5,o[24]),C=c(C,x,k,T,B,9,o[25]),T=c(T,C,x,k,p,14,o[26]),k=c(k,T,C,x,v,20,o[27]),x=c(x,k,T,C,A,5,o[28]),C=c(C,x,k,T,f,9,o[29]),T=c(T,C,x,k,y,14,o[30]),x=u(x,k=c(k,T,C,x,E,20,o[31]),T,C,_,4,o[32]),C=u(C,x,k,T,v,11,o[33]),T=u(T,C,x,k,S,16,o[34]),k=u(k,T,C,x,B,23,o[35]),x=u(x,k,T,C,d,4,o[36]),C=u(C,x,k,T,m,11,o[37]),T=u(T,C,x,k,y,16,o[38]),k=u(k,T,C,x,w,23,o[39]),x=u(x,k,T,C,A,4,o[40]),C=u(C,x,k,T,a,11,o[41]),T=u(T,C,x,k,p,16,o[42]),k=u(k,T,C,x,g,23,o[43]),x=u(x,k,T,C,b,4,o[44]),C=u(C,x,k,T,E,11,o[45]),T=u(T,C,x,k,U,16,o[46]),x=h(x,k=u(k,T,C,x,f,23,o[47]),T,C,a,6,o[48]),C=h(C,x,k,T,y,10,o[49]),T=h(T,C,x,k,B,15,o[50]),k=h(k,T,C,x,_,21,o[51]),x=h(x,k,T,C,E,6,o[52]),C=h(C,x,k,T,p,10,o[53]),T=h(T,C,x,k,w,15,o[54]),k=h(k,T,C,x,d,21,o[55]),x=h(x,k,T,C,v,6,o[56]),C=h(C,x,k,T,U,10,o[57]),T=h(T,C,x,k,g,15,o[58]),k=h(k,T,C,x,A,21,o[59]),x=h(x,k,T,C,m,6,o[60]),C=h(C,x,k,T,S,10,o[61]),T=h(T,C,x,k,f,15,o[62]),k=h(k,T,C,x,b,21,o[63]),n[0]=n[0]+x|0,n[1]=n[1]+k|0,n[2]=n[2]+T|0,n[3]=n[3]+C|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,s=8*t.sigBytes;r[s>>>5]|=128<<24-s%32;var n=e.floor(i/4294967296),a=i;r[15+(s+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),r[14+(s+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var o=this._hash,d=o.words,l=0;l<4;l++){var c=d[l];d[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return o},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,i,s,n,a){var o=e+(t&r|~t&i)+s+a;return(o<>>32-n)+t}function c(e,t,r,i,s,n,a){var o=e+(t&i|r&~i)+s+a;return(o<>>32-n)+t}function u(e,t,r,i,s,n,a){var o=e+(t^r^i)+s+a;return(o<>>32-n)+t}function h(e,t,r,i,s,n,a){var o=e+(r^(t|~i))+s+a;return(o<>>32-n)+t}t.MD5=n._createHelper(d),t.HmacMD5=n._createHmacHelper(d)}(Math),r.MD5)})),Ot((function(e,t){var r,i,s,n,a,o,d,l;e.exports=(i=(r=l=Pi).lib,s=i.WordArray,n=i.Hasher,a=r.algo,o=[],d=a.SHA1=n.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],s=r[1],n=r[2],a=r[3],d=r[4],l=0;l<80;l++){if(l<16)o[l]=0|e[t+l];else{var c=o[l-3]^o[l-8]^o[l-14]^o[l-16];o[l]=c<<1|c>>>31}var u=(i<<5|i>>>27)+d+o[l];u+=l<20?1518500249+(s&n|~s&a):l<40?1859775393+(s^n^a):l<60?(s&n|s&a|n&a)-1894007588:(s^n^a)-899497514,d=a,a=n,n=s<<30|s>>>2,s=i,i=u}r[0]=r[0]+i|0,r[1]=r[1]+s|0,r[2]=r[2]+n|0,r[3]=r[3]+a|0,r[4]=r[4]+d|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=n._createHelper(d),r.HmacSHA1=n._createHmacHelper(d),l.SHA1)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(e){var t=r,i=t.lib,s=i.WordArray,n=i.Hasher,a=t.algo,o=[],d=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,s=0;s<64;)t(i)&&(s<8&&(o[s]=r(e.pow(i,.5))),d[s]=r(e.pow(i,1/3)),s++),i++}();var l=[],c=a.SHA256=n.extend({_doReset:function(){this._hash=new s.init(o.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],s=r[1],n=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,_=l[f-2],g=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;l[f]=m+l[f-7]+g+l[f-16]}var y=i&s^i&n^s&n,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=h+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&c^~o&u)+d[f]+l[f];h=u,u=c,c=o,o=a+b|0,a=n,n=s,s=i,i=b+(v+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+s|0,r[2]=r[2]+n|0,r[3]=r[3]+a|0,r[4]=r[4]+o|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,s=8*t.sigBytes;return r[s>>>5]|=128<<24-s%32,r[14+(s+64>>>9<<4)]=e.floor(i/4294967296),r[15+(s+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=n._createHelper(c),t.HmacSHA256=n._createHmacHelper(c)}(Math),r.SHA256)})),Ot((function(e,t){var r,i,s,n,a,o;e.exports=(i=(r=o=Pi).lib.WordArray,s=r.algo,n=s.SHA256,a=s.SHA224=n.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=n._createHelper(a),r.HmacSHA224=n._createHmacHelper(a),o.SHA224)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(){var e=r,t=e.lib.Hasher,i=e.x64,s=i.Word,n=i.WordArray,a=e.algo;function o(){return s.create.apply(s,arguments)}var d=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=o()}();var c=a.SHA512=t.extend({_doReset:function(){this._hash=new n.init([new s.init(1779033703,4089235720),new s.init(3144134277,2227873595),new s.init(1013904242,4271175723),new s.init(2773480762,1595750129),new s.init(1359893119,2917565137),new s.init(2600822924,725511199),new s.init(528734635,4215389547),new s.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],s=r[1],n=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=i.high,p=i.low,m=s.high,_=s.low,g=n.high,y=n.low,v=a.high,b=a.low,w=o.high,S=o.low,E=c.high,A=c.low,B=u.high,U=u.low,x=h.high,k=h.low,T=f,C=p,D=m,L=_,I=g,F=y,P=v,M=b,R=w,z=S,N=E,O=A,G=B,$=U,H=x,V=k,W=0;W<80;W++){var j,q,Y=l[W];if(W<16)q=Y.high=0|e[t+2*W],j=Y.low=0|e[t+2*W+1];else{var K=l[W-15],X=K.high,Z=K.low,J=(X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7,Q=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),ee=l[W-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,se=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),ne=l[W-7],ae=ne.high,oe=ne.low,de=l[W-16],le=de.high,ce=de.low;q=(q=(q=J+ae+((j=Q+oe)>>>0>>0?1:0))+ie+((j+=se)>>>0>>0?1:0))+le+((j+=ce)>>>0>>0?1:0),Y.high=q,Y.low=j}var ue,he=R&N^~R&G,fe=z&O^~z&$,pe=T&D^T&I^D&I,me=C&L^C&F^L&F,_e=(T>>>28|C<<4)^(T<<30|C>>>2)^(T<<25|C>>>7),ge=(C>>>28|T<<4)^(C<<30|T>>>2)^(C<<25|T>>>7),ye=(R>>>14|z<<18)^(R>>>18|z<<14)^(R<<23|z>>>9),ve=(z>>>14|R<<18)^(z>>>18|R<<14)^(z<<23|R>>>9),be=d[W],we=be.high,Se=be.low,Ee=H+ye+((ue=V+ve)>>>0>>0?1:0),Ae=ge+me;H=G,V=$,G=N,$=O,N=R,O=z,R=P+(Ee=(Ee=(Ee=Ee+he+((ue+=fe)>>>0>>0?1:0))+we+((ue+=Se)>>>0>>0?1:0))+q+((ue+=j)>>>0>>0?1:0))+((z=M+ue|0)>>>0>>0?1:0)|0,P=I,M=F,I=D,F=L,D=T,L=C,T=Ee+(_e+pe+(Ae>>>0>>0?1:0))+((C=ue+Ae|0)>>>0>>0?1:0)|0}p=i.low=p+C,i.high=f+T+(p>>>0>>0?1:0),_=s.low=_+L,s.high=m+D+(_>>>0>>0?1:0),y=n.low=y+F,n.high=g+I+(y>>>0>>0?1:0),b=a.low=b+M,a.high=v+P+(b>>>0>>0?1:0),S=o.low=S+z,o.high=w+R+(S>>>0>>0?1:0),A=c.low=A+O,c.high=E+N+(A>>>0>>0?1:0),U=u.low=U+$,u.high=B+G+(U>>>0<$>>>0?1:0),k=h.low=k+V,h.high=x+H+(k>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(c),e.HmacSHA512=t._createHmacHelper(c)}(),r.SHA512)})),Ot((function(e,t){var r,i,s,n,a,o,d,l;e.exports=(i=(r=l=Pi).x64,s=i.Word,n=i.WordArray,a=r.algo,o=a.SHA512,d=a.SHA384=o.extend({_doReset:function(){this._hash=new n.init([new s.init(3418070365,3238371032),new s.init(1654270250,914150663),new s.init(2438529370,812702999),new s.init(355462360,4144912697),new s.init(1731405415,4290775857),new s.init(2394180231,1750603025),new s.init(3675008525,1694076839),new s.init(1203062813,3204075428)])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=o._createHelper(d),r.HmacSHA384=o._createHmacHelper(d),l.SHA384)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(e){var t=r,i=t.lib,s=i.WordArray,n=i.Hasher,a=t.x64.Word,o=t.algo,d=[],l=[],c=[];!function(){for(var e=1,t=0,r=0;r<24;r++){d[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var s=1,n=0;n<24;n++){for(var o=0,u=0,h=0;h<7;h++){if(1&s){var f=(1<>>24)|4278255360&(n<<24|n>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(k=r[s]).high^=a,k.low^=n}for(var o=0;o<24;o++){for(var h=0;h<5;h++){for(var f=0,p=0,m=0;m<5;m++)f^=(k=r[h+5*m]).high,p^=k.low;var _=u[h];_.high=f,_.low=p}for(h=0;h<5;h++){var g=u[(h+4)%5],y=u[(h+1)%5],v=y.high,b=y.low;for(f=g.high^(v<<1|b>>>31),p=g.low^(b<<1|v>>>31),m=0;m<5;m++)(k=r[h+5*m]).high^=f,k.low^=p}for(var w=1;w<25;w++){var S=(k=r[w]).high,E=k.low,A=d[w];A<32?(f=S<>>32-A,p=E<>>32-A):(f=E<>>64-A,p=S<>>64-A);var B=u[l[w]];B.high=f,B.low=p}var U=u[0],x=r[0];for(U.high=x.high,U.low=x.low,h=0;h<5;h++)for(m=0;m<5;m++){var k=r[w=h+5*m],T=u[w],C=u[(h+1)%5+5*m],D=u[(h+2)%5+5*m];k.high=T.high^~C.high&D.high,k.low=T.low^~C.low&D.low}k=r[0];var L=c[o];k.high^=L.high,k.low^=L.low}},_doFinalize:function(){var t=this._data,r=t.words;this._nDataBytes;var i=8*t.sigBytes,n=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/n)*n>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,o=this.cfg.outputLength/8,d=o/8,l=[],c=0;c>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(h)}return new s.init(l,o)},clone:function(){for(var e=n.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=n._createHelper(h),t.HmacSHA3=n._createHmacHelper(h)}(Math),r.SHA3)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(e){var t=r,i=t.lib,s=i.WordArray,n=i.Hasher,a=t.algo,o=s.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=s.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=s.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=s.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=s.create([0,1518500249,1859775393,2400959708,2840853838]),h=s.create([1352829926,1548603684,1836072691,2053994217,0]),f=a.RIPEMD160=n.extend({_doReset:function(){this._hash=s.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,s=e[i];e[i]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}var n,a,f,b,w,S,E,A,B,U,x,k=this._hash.words,T=u.words,C=h.words,D=o.words,L=d.words,I=l.words,F=c.words;for(S=n=k[0],E=a=k[1],A=f=k[2],B=b=k[3],U=w=k[4],r=0;r<80;r+=1)x=n+e[t+D[r]]|0,x+=r<16?p(a,f,b)+T[0]:r<32?m(a,f,b)+T[1]:r<48?_(a,f,b)+T[2]:r<64?g(a,f,b)+T[3]:y(a,f,b)+T[4],x=(x=v(x|=0,I[r]))+w|0,n=w,w=b,b=v(f,10),f=a,a=x,x=S+e[t+L[r]]|0,x+=r<16?y(E,A,B)+C[0]:r<32?g(E,A,B)+C[1]:r<48?_(E,A,B)+C[2]:r<64?m(E,A,B)+C[3]:p(E,A,B)+C[4],x=(x=v(x|=0,F[r]))+U|0,S=U,U=B,B=v(A,10),A=E,E=x;x=k[1]+f+B|0,k[1]=k[2]+b+U|0,k[2]=k[3]+w+S|0,k[3]=k[4]+n+E|0,k[4]=k[0]+a+A|0,k[0]=x},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var s=this._hash,n=s.words,a=0;a<5;a++){var o=n[a];n[a]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return s},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function m(e,t,r){return e&t|~e&r}function _(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function v(e,t){return e<>>32-t}t.RIPEMD160=n._createHelper(f),t.HmacRIPEMD160=n._createHmacHelper(f)}(),r.RIPEMD160)})),Ot((function(e,t){var r,i,s;e.exports=(i=(r=Pi).lib.Base,s=r.enc.Utf8,void(r.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var n=this._oKey=t.clone(),a=this._iKey=t.clone(),o=n.words,d=a.words,l=0;l>>2];e.sigBytes-=t}};i.BlockCipher=c.extend({cfg:c.cfg.extend({mode:f,padding:p}),reset:function(){var e;c.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=i.CipherParams=s.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?n.create([1398893684,1701076831]).concat(r).concat(t):t).toString(d)},parse:function(e){var t,r=d.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=n.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),m.create({ciphertext:r,salt:t})}},g=i.SerializableCipher=s.extend({cfg:s.extend({format:_}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var s=e.createEncryptor(r,i),n=s.finalize(t),a=s.cfg;return m.create({ciphertext:n,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,i,s){if(i||(i=n.random(8)),s)a=l.create({keySize:t+r,hasher:s}).compute(e,i);else var a=l.create({keySize:t+r}).compute(e,i);var o=n.create(a.words.slice(t),4*r);return a.sigBytes=4*t,m.create({key:a,iv:o,salt:i})}},v=i.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var s=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=s.iv;var n=g.encrypt.call(this,e,t,s.key,i);return n.mixIn(s),n},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var s=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=s.iv,g.decrypt.call(this,e,t,s.key,i)}})}())})),Ot((function(e,t){var r;e.exports=((r=Pi).mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,i){var s,n=this._iv;n?(s=n.slice(0),this._iv=void 0):s=this._prevBlock,i.encryptBlock(s,0);for(var a=0;a>24&255)){var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}else e+=1<<24;return e}function i(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var s=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,s=r.blockSize,n=this._iv,a=this._counter;n&&(a=this._counter=n.slice(0),this._iv=void 0),i(a);var o=a.slice(0);r.encryptBlock(o,0);for(var d=0;d>>2]|=s<<24-n%4*8,e.sigBytes+=s},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),Ot((function(e,t){var r;e.exports=((r=Pi).pad.Iso10126={pad:function(e,t){var i=4*t,s=i-e.sigBytes%i;e.concat(r.lib.WordArray.random(s-1)).concat(r.lib.WordArray.create([s<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),Ot((function(e,t){var r;e.exports=((r=Pi).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),Ot((function(e,t){var r;e.exports=((r=Pi).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)})),Ot((function(e,t){var r;e.exports=((r=Pi).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(e){var t=r,i=t.lib.CipherParams,s=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(s)},parse:function(e){var t=s.parse(e);return i.create({ciphertext:t})}}}(),r.format.Hex)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(){var e=r,t=e.lib.BlockCipher,i=e.algo,s=[],n=[],a=[],o=[],d=[],l=[],c=[],u=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,s[r]=p,n[p]=r;var m=e[r],_=e[m],g=e[_],y=257*e[p]^16843008*p;a[r]=y<<24|y>>>8,o[r]=y<<16|y>>>16,d[r]=y<<8|y>>>24,l[r]=y,y=16843009*g^65537*_^257*m^16843008*r,c[p]=y<<24|y>>>8,u[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,r?(r=m^e[e[e[g^m]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=i.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),n=this._keySchedule=[],a=0;a6&&a%r==4&&(l=s[l>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[255&l]):(l=s[(l=l<<8|l>>>24)>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[255&l],l^=p[a/r|0]<<24),n[a]=n[a-r]^l);for(var o=this._invKeySchedule=[],d=0;d>>24]]^u[s[l>>>16&255]]^h[s[l>>>8&255]]^f[s[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,o,d,l,s)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,c,u,h,f,n),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,s,n,a,o){for(var d=this._nRounds,l=e[t]^r[0],c=e[t+1]^r[1],u=e[t+2]^r[2],h=e[t+3]^r[3],f=4,p=1;p>>24]^s[c>>>16&255]^n[u>>>8&255]^a[255&h]^r[f++],_=i[c>>>24]^s[u>>>16&255]^n[h>>>8&255]^a[255&l]^r[f++],g=i[u>>>24]^s[h>>>16&255]^n[l>>>8&255]^a[255&c]^r[f++],y=i[h>>>24]^s[l>>>16&255]^n[c>>>8&255]^a[255&u]^r[f++];l=m,c=_,u=g,h=y}m=(o[l>>>24]<<24|o[c>>>16&255]<<16|o[u>>>8&255]<<8|o[255&h])^r[f++],_=(o[c>>>24]<<24|o[u>>>16&255]<<16|o[h>>>8&255]<<8|o[255&l])^r[f++],g=(o[u>>>24]<<24|o[h>>>16&255]<<16|o[l>>>8&255]<<8|o[255&c])^r[f++],y=(o[h>>>24]<<24|o[l>>>16&255]<<16|o[c>>>8&255]<<8|o[255&u])^r[f++],e[t]=m,e[t+1]=_,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(m)}(),r.AES)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(){var e=r,t=e.lib,i=t.WordArray,s=t.BlockCipher,n=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=n.DES=s.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=a[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var s=this._subKeys=[],n=0;n<16;n++){var l=s[n]=[],c=d[n];for(r=0;r<24;r++)l[r/6|0]|=t[(o[r]-1+c)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(o[r+24]-1+c)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var u=this._invSubKeys=[];for(r=0;r<16;r++)u[r]=s[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var s=r[i],n=this._lBlock,a=this._rBlock,o=0,d=0;d<8;d++)o|=l[d][((a^s[d])&c[d])>>>0];this._lBlock=a,this._rBlock=n^o}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),s=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(i.create(t)),this._des2=u.createEncryptor(i.create(r)),this._des3=u.createEncryptor(i.create(s))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=s._createHelper(p)}(),r.TripleDES)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,s=i.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],s=0;s<256;s++)i[s]=s;s=0;for(var n=0;s<256;s++){var a=s%r,o=t[a>>>2]>>>24-a%4*8&255;n=(n+i[s]+o)%256;var d=i[s];i[s]=i[n],i[n]=d}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=n.call(this)},keySize:8,ivSize:0});function n(){for(var e=this._S,t=this._i,r=this._j,i=0,s=0;s<4;s++){r=(r+e[t=(t+1)%256])%256;var n=e[t];e[t]=e[r],e[r]=n,i|=e[(e[t]+e[r])%256]<<24-8*s}return this._i=t,this._j=r,i}e.RC4=t._createHelper(s);var a=i.RC4Drop=s.extend({cfg:s.cfg.extend({drop:192}),_doReset:function(){s._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)n.call(this)}});e.RC4Drop=t._createHelper(a)}(),r.RC4)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,s=[],n=[],a=[],o=i.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],s=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)d.call(this);for(r=0;r<8;r++)s[r]^=i[r+4&7];if(t){var n=t.words,a=n[0],o=n[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(s[0]^=l,s[1]^=u,s[2]^=c,s[3]^=h,s[4]^=l,s[5]^=u,s[6]^=c,s[7]^=h,r=0;r<4;r++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),s[0]=r[0]^r[5]>>>16^r[3]<<16,s[1]=r[2]^r[7]>>>16^r[5]<<16,s[2]=r[4]^r[1]>>>16^r[7]<<16,s[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)s[i]=16711935&(s[i]<<8|s[i]>>>24)|4278255360&(s[i]<<24|s[i]>>>8),e[t+i]^=s[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)n[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],s=65535&i,o=i>>>16,d=((s*s>>>17)+s*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=t._createHelper(o)}(),r.Rabbit)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,s=[],n=[],a=[],o=i.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var s=0;s<4;s++)d.call(this);for(s=0;s<8;s++)i[s]^=r[s+4&7];if(t){var n=t.words,a=n[0],o=n[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(i[0]^=l,i[1]^=u,i[2]^=c,i[3]^=h,i[4]^=l,i[5]^=u,i[6]^=c,i[7]^=h,s=0;s<4;s++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),s[0]=r[0]^r[5]>>>16^r[3]<<16,s[1]=r[2]^r[7]>>>16^r[5]<<16,s[2]=r[4]^r[1]>>>16^r[7]<<16,s[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)s[i]=16711935&(s[i]<<8|s[i]>>>24)|4278255360&(s[i]<<24|s[i]>>>8),e[t+i]^=s[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)n[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],s=65535&i,o=i>>>16,d=((s*s>>>17)+s*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=t._createHelper(o)}(),r.RabbitLegacy)})),Ot((function(e,t){var r;e.exports=(r=Pi,function(){var e=r,t=e.lib.BlockCipher,i=e.algo;const s=16,n=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function d(e,t){let r=t>>24&255,i=t>>16&255,s=t>>8&255,n=255&t,a=e.sbox[0][r]+e.sbox[1][i];return a^=e.sbox[2][s],a+=e.sbox[3][n],a}function l(e,t,r){let i,n=t,a=r;for(let t=0;t1;--t)n^=e.pbox[t],a=d(e,n)^a,i=n,n=a,a=i;return i=n,n=a,a=i,a^=e.pbox[1],n^=e.pbox[0],{left:n,right:a}}function u(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=a[t][r]}let i=0;for(let a=0;a=r&&(i=0);let o=0,d=0,c=0;for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),r=new Uint8Array(r);const s=e.byteLength;let n=5;for(;ns)break;let o=e[n+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=e.slice(n+4+2,n+4+a);let s=new Fi.ModeOfOperation.ctr(t,new Fi.Counter(r));const o=s.decrypt(i);s=null,e.set(o,n+4+2)}n=n+4+a}return e}function zi(e,t,r){if(e.byteLength<=30)return e;const i=e.slice(32);let s=new Fi.ModeOfOperation.ctr(t,new Fi.Counter(r));const n=s.decrypt(i);return s=null,e.set(n,32),e}Ot((function(e,t){e.exports=Pi}));var Ni=Ot((function(e,t){var r,s,n,a=(r=new Date,s=4,n={setLogLevel:function(e){s=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=s&&console.debug("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=s&&console.info("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=s&&console.warn("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=s&&console.error("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}},n);a.getDurationString=function(e,t){var r;function i(e,t){for(var r=(""+e).split(".");r[0].length0){for(var r="",i=0;i0&&(r+=","),r+="["+a.getDurationString(e.start(i))+","+a.getDurationString(e.end(i))+"]";return r}return"(empty)"},t.Log=a;var o=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};o.prototype.getPosition=function(){return this.position},o.prototype.getEndPosition=function(){return this.buffer.byteLength},o.prototype.getLength=function(){return this.buffer.byteLength},o.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},o.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},o.prototype.readAnyInt=function(e,t){var r=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:r=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:r=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";r=this.dataview.getUint8(this.position)<<16,r|=this.dataview.getUint8(this.position+1)<<8,r|=this.dataview.getUint8(this.position+2);break;case 4:r=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";r=this.dataview.getUint32(this.position)<<32,r|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,r}throw"Not enough bytes in buffer"},o.prototype.readUint8=function(){return this.readAnyInt(1,!1)},o.prototype.readUint16=function(){return this.readAnyInt(2,!1)},o.prototype.readUint24=function(){return this.readAnyInt(3,!1)},o.prototype.readUint32=function(){return this.readAnyInt(4,!1)},o.prototype.readUint64=function(){return this.readAnyInt(8,!1)},o.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",r=0;rthis._byteLength&&(this._byteLength=t);else{for(r<1&&(r=1);t>r;)r*=2;var i=new ArrayBuffer(r),s=new Uint8Array(this._buffer);new Uint8Array(i,0,s.length).set(s),this.buffer=i,this._byteLength=t}}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),r=new Uint8Array(this._buffer,0,t.length);t.set(r),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Int32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Int16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Uint32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Uint16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var r=new Float64Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Float32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,r,i,s){var n=new Uint8Array(e,t,s),a=new Uint8Array(r,i,s);n.set(a)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=0;rs;i--,s++){var n=t[s];t[s]=t[i],t[i]=n}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],r=0;r>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},d.prototype.adjustUint32=function(e,t){var r=this.position;this.seek(e),this.writeUint32(t),this.seek(r)},d.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var r=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var r=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var r=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var r=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var r=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=8*e,r},d.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var r=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r};var c=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(c.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,a.debug("MultiBufferStream","Stream ready for parsing"),!0):(a.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(a.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){a.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r.buffer},c.prototype.reduceBuffer=function(e,t,r){var i;return(i=new Uint8Array(r)).set(new Uint8Array(e,t,r)),i.buffer.fileStart=e.fileStart+t,i.buffer.usedBytes=0,i.buffer},c.prototype.insertBuffer=function(e){for(var t=!0,r=0;ri.byteLength){this.buffers.splice(r,1),r--;continue}a.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=i.fileStart||(e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)),a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(r,0,e),0===r&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,s,n)}}t&&(a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===r&&(this.buffer=e))},c.prototype.logBufferLevel=function(e){var t,r,i,s,n,o=[],d="";for(i=0,s=0,t=0;t0&&(d+=n.end-1+"]");var l=e?a.info:a.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+i+"/"+s+" bytes), continuous ranges: "+d)},c.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},c.prototype.findPosition=function(e,t,r){var i,s=null,n=-1;for(i=!0===e?0:this.bufferIndex;i=t?(a.debug("MultiBufferStream","Found position in existing buffer #"+n),n):-1},c.prototype.findEndContiguousBuf=function(e){var t,r,i,s=void 0!==e?e:this.bufferIndex;if(r=this.buffers[s],this.buffers.length>s+1)for(t=s+1;t>3;return 31===i&&r.data.length>=2&&(i=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),i}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};t.MPEG4DescriptorParser=u;var h={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){h.FullBox.prototype=new h.Box,h.ContainerBox.prototype=new h.Box,h.SampleEntry.prototype=new h.Box,h.TrackGroupTypeBox.prototype=new h.FullBox,h.BASIC_BOXES.forEach((function(e){h.createBoxCtor(e)})),h.FULL_BOXES.forEach((function(e){h.createFullBoxCtor(e)})),h.CONTAINER_BOXES.forEach((function(e){h.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,r){this.type=e,this.size=t,this.uuid=r},FullBox:function(e,t,r){h.Box.call(this,e,t,r),this.flags=0,this.version=0},ContainerBox:function(e,t,r){h.Box.call(this,e,t,r),this.boxes=[]},SampleEntry:function(e,t,r,i){h.ContainerBox.call(this,e,t),this.hdr_size=r,this.start=i},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){h.FullBox.call(this,e,t)},createBoxCtor:function(e,t){h.boxCodes.push(e),h[e+"Box"]=function(t){h.Box.call(this,e,t)},h[e+"Box"].prototype=new h.Box,t&&(h[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){h[e+"Box"]=function(t){h.FullBox.call(this,e,t)},h[e+"Box"].prototype=new h.FullBox,h[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,r=0;rr?(a.error("BoxParser","Box of type '"+c+"' has a size "+l+" greater than its container size "+r),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):0!==l&&o+l>e.getEndPosition()?(e.seek(o),a.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):t?{code:h.OK,type:c,size:l,hdr_size:d,start:o}:(h[c+"Box"]?i=new h[c+"Box"](l):"uuid"!==c?(a.warn("BoxParser","Unknown box type: '"+c+"'"),(i=new h.Box(c,l)).has_unparsed_data=!0):h.UUIDBoxes[n]?i=new h.UUIDBoxes[n](l):(a.warn("BoxParser","Unknown uuid type: '"+n+"'"),(i=new h.Box(c,l)).uuid=n,i.has_unparsed_data=!0),i.hdr_size=d,i.start=o,i.write===h.Box.prototype.write&&"mdat"!==i.type&&(a.info("BoxParser","'"+u+"' box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),(s=e.getPosition()-(i.start+i.size))<0?(a.warn("BoxParser","Parsing of box '"+u+"' did not read the entire indicated box data size (missing "+-s+" bytes), seeking forward"),e.seek(i.start+i.size)):s>0&&(a.error("BoxParser","Parsing of box '"+u+"' read "+s+" more bytes than the indicated box data size, seeking backwards"),0!==i.size&&e.seek(i.start+i.size)),{code:h.OK,box:i,size:i.size})},h.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},h.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},h.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.ContainerBox.prototype.parse=function(e){for(var t,r;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},h.SAMPLE_ENTRY_TYPE_VISUAL="Visual",h.SAMPLE_ENTRY_TYPE_AUDIO="Audio",h.SAMPLE_ENTRY_TYPE_HINT="Hint",h.SAMPLE_ENTRY_TYPE_METADATA="Metadata",h.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",h.SAMPLE_ENTRY_TYPE_SYSTEM="System",h.SAMPLE_ENTRY_TYPE_TEXT="Text",h.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},h.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},h.SampleEntry.prototype.parseFooter=function(e){h.ContainerBox.prototype.parse.call(this,e)},h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_HINT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT,"enct"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA,"encm"),h.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var r=0;r<3;r++)this.layer_size[r]=16==t?e.readUint16():e.readUint32()})),h.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),h.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),h.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)a.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void a.error("av1C reserved_2 parsing problem");var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)}else a.error("av1C reserved_1 parsing problem");else a.error("av1C version "+this.version+" not supported")})),h.createBoxCtor("avcC",(function(e){var t,r;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),r=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(r))})),h.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),h.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),h.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),h.createFullBoxCtor("co64",(function(e){var t,r;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(r=0;r>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),h.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),h.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),h.createFullBoxCtor("ctts",(function(e){var t,r;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(r=0;r>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|r>>6&3,this.acmod=r>>3&7,this.lfeon=r>>2&1,this.bit_rate_code=3&r|i>>5&7})),h.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var r=0;r>6,i.bsid=s>>1&31,i.bsmod=(1&s)<<4|n>>4&15,i.acmod=n>>1&7,i.lfeon=1&n,i.num_dep_sub=a>>1&15,i.num_dep_sub>0&&(i.chan_loc=(1&a)<<8|e.readUint8())}})),h.createFullBoxCtor("dfLa",(function(e){var t=[],r=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var i=e.readUint8(),s=Math.min(127&i,r.length-1);if(s?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(r[s]),128&i)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),h.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[r]=e.readString(4),t-=4,r++})),h.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),h.createBoxCtor("hvcC",(function(e){var t,r,i,s;this.configurationVersion=e.readUint8(),s=e.readUint8(),this.general_profile_space=s>>6,this.general_tier_flag=(32&s)>>5,this.general_profile_idc=31&s,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),s=e.readUint8(),this.constantFrameRate=s>>6,this.numTemporalLayers=(13&s)>>3,this.temporalIdNested=(4&s)>>2,this.lengthSizeMinusOne=3&s,this.nalu_arrays=[];var n=e.readUint8();for(t=0;t>7,a.nalu_type=63&s;var o=e.readUint16();for(r=0;r>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var r=0;if(this.version<2)r=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";r=e.readUint32()}for(var i=0;i>7,this.axis=1&t})),h.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),a.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),h.createFullBoxCtor("ipma",(function(e){var t,r;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?a.property_index=(127&n)<<8|e.readUint8():a.property_index=127&n}}})),h.createFullBoxCtor("iref",(function(e){var t,r;for(this.references=[];e.getPosition()>7,i.assignment_type=127&s,i.assignment_type){case 0:i.grouping_type=e.readString(4);break;case 1:i.grouping_type=e.readString(4),i.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:i.sub_track_id=e.readUint32();break;default:a.warn("BoxParser","Unknown leva assignement type")}}})),h.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),h.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),f.prototype.toString=function(){return"("+this.x+","+this.y+")"},h.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new f(e.readUint16(),e.readUint16()),this.display_primaries[1]=new f(e.readUint16(),e.readUint16()),this.display_primaries[2]=new f(e.readUint16(),e.readUint16()),this.white_point=new f(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),h.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),h.createFullBoxCtor("mehd",(function(e){1&this.flags&&(a.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),h.createFullBoxCtor("meta",(function(e){this.boxes=[],h.ContainerBox.prototype.parse.call(this,e)})),h.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),h.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),h.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),h.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),h.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),h.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),h.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var r=0;r0){var t=e.readUint32();this.kid=[];for(var r=0;r0&&(this.data=e.readUint8Array(i))})),h.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),h.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),h.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var r=0;r>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var r=e.readUint8(),i=0;i>7,this.num_leading_samples=127&t})),h.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)a.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=h.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),h.createSampleGroupCtor("stsa",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),h.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),h.createSampleGroupCtor("tsas",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("tscl",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("vipr",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),r=0;r>6,this.sample_depends_on[i]=t>>4&3,this.sample_is_depended_on[i]=t>>2&3,this.sample_has_redundancy[i]=3&t})),h.createFullBoxCtor("senc"),h.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),a.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),r=0;r>31&1,i.referenced_size=2147483647&s,i.subsegment_duration=e.readUint32(),s=e.readUint32(),i.starts_with_SAP=s>>31&1,i.SAP_type=s>>28&7,i.SAP_delta_time=268435455&s}})),h.SingleItemTypeReferenceBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.SingleItemTypeReferenceBox.prototype=new h.Box,h.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var r=0;r>4&15,this.sample_sizes[t+1]=15&i}else if(8===this.field_size)for(t=0;t0)for(r=0;r>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=h.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),h.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),h.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),h.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var r=e.readUint32(),i=0;i>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),h.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),h.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),h.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},h.createTrackGroupCtor("msrc"),h.TrackReferenceTypeBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.TrackReferenceTypeBox.prototype=new h.Box,h.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},h.trefBox.prototype.parse=function(e){for(var t,r;e.getPosition()t&&this.flags&h.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var r=0;r>7&1,this.block_pad_lsb=r>>6&1,this.block_little_endian=r>>5&1,this.block_reversed=r>>4&1,this.pad_unknown=r>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),h.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),h.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),h.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),h.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=h.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),h.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),h.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=h.parseHex16(e)})),h.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),h.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),h.createFullBoxCtor("vvcC",(function(e){var t,r,i={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(i.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,r=this.num_sublayers-2;r>=0;--r){var a=i.extract_bits(1);this.ptl_sublayer_present_mask|=a<1;++r)i.extract_bits(1);for(this.sublayer_level_idc=[],r=this.num_sublayers-2;r>=0;--r)this.ptl_sublayer_present_mask&1<>=1;t+=h.decimalToHex(i,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var s=!1,n="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||s)&&(n="."+h.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+n,s=!0);t+=n}return t},h.vvc1SampleEntry.prototype.getCodec=h.vvi1SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var r="";if(this.vvcC.general_constraint_info){var i,s=[],n=0;for(n|=this.vvcC.ptl_frame_only_constraint<<7,n|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,s.push(n),n&&(i=e),n=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===i)r=".CA";else{r=".C";var a="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",o=0,d=0;for(e=0;e<=i;++e)for(o=o<<8|s[e],d+=8;d>=5;){r+=a[o>>d-5&31],o&=(1<<(d-=5))-1}d&&(r+=a[31&(o<<=5-d)])}}t+=r}return t},h.mp4aSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),r=this.esds.esd.getAudioConfig();return e+"."+h.decimalToHex(t)+(r?"."+r:"")}return e},h.stxtSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},h.vp08SampleEntry.prototype.getCodec=h.vp09SampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var r=this.vpcC.bitDepth;return 8==r&&(r="08"),e+".0"+this.vpcC.profile+"."+t+"."+r},h.av01SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this),r=this.av1C.seq_level_idx_0;return r<10&&(r="0"+r),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+r+(this.av1C.seq_tier_0?"H":"M")+"."+e},h.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),a.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>l?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>l&&e.writeUint64(this.size)},h.FullBox.prototype.writeHeader=function(e){this.size+=4,h.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},h.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},h.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},h.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},h.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},h.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},h.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&h.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&h.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&h.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&h.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[r]instanceof h.Box||t[r]instanceof h.Box||void 0===e[r]||void 0===t[r]||"function"==typeof e[r]||"function"==typeof t[r]||e.subBoxNames&&e.subBoxNames.indexOf(r.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(r.slice(0,4))>-1||"data"===r||"start"===r||"size"===r||"creation_time"===r||"modification_time"===r||h.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(r)>-1||e[r]===t[r]))return!1;return!0},h.boxEqual=function(e,t){if(!h.boxEqualFields(e,t))return!1;for(var r=0;r1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},g.prototype.setExtractionOptions=function(e,t,r){var i=this.getTrackById(e);if(i){var s={};this.extractedTracks.push(s),s.id=e,s.user=t,s.trak=i,i.nextSample=0,s.nb_samples=1e3,s.samples=[],r&&r.nbSamples&&(s.nb_samples=r.nbSamples)}},g.prototype.unsetExtractionOptions=function(e){for(var t=-1,r=0;r-1&&this.extractedTracks.splice(t,1)},g.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=h.parseOneBox(this.stream,false)).code===h.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var r;switch(r="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),r){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[r]&&a.warn("ISOFile","Duplicate Box of type: "+r+", overriding previous occurrence"),this[r]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},g.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(a.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(a.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(a.warn("ISOFile","Not ready to start parsing"),!1))},g.prototype.appendBuffer=function(e,t){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(a.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),r},g.prototype.getInfo=function(){var e,t,r,i,s,n,a={},o=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(a.hasMoov=!0,a.duration=this.moov.mvhd.duration,a.timescale=this.moov.mvhd.timescale,a.isFragmented=null!=this.moov.mvex,a.isFragmented&&this.moov.mvex.mehd&&(a.fragment_duration=this.moov.mvex.mehd.fragment_duration),a.isProgressive=this.isProgressive,a.hasIOD=null!=this.moov.iods,a.brands=[],a.brands.push(this.ftyp.major_brand),a.brands=a.brands.concat(this.ftyp.compatible_brands),a.created=new Date(o+1e3*this.moov.mvhd.creation_time),a.modified=new Date(o+1e3*this.moov.mvhd.modification_time),a.tracks=[],a.audioTracks=[],a.videoTracks=[],a.subtitleTracks=[],a.metadataTracks=[],a.hintTracks=[],a.otherTracks=[],e=0;e0?a.mime+='video/mp4; codecs="':a.audioTracks&&a.audioTracks.length>0?a.mime+='audio/mp4; codecs="':a.mime+='application/mp4; codecs="',e=0;e=r.samples.length)&&(a.info("ISOFile","Sending fragmented data on track #"+i.id+" for samples ["+Math.max(0,r.nextSample-i.nb_samples)+","+(r.nextSample-1)+"]"),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(i.id,i.user,i.segmentStream.buffer,r.nextSample,e||r.nextSample>=r.samples.length),i.segmentStream=null,i!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=r.samples.length)&&(a.debug("ISOFile","Sending samples on track #"+n.id+" for sample "+r.nextSample),this.onSamples&&this.onSamples(n.id,n.user,n.samples),n.samples=[],n!==this.extractedTracks[t]))break}}}},g.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},g.prototype.getBoxes=function(e,t){var r=[];return g._sweep.call(this,e,r,t),r},g._sweep=function(e,t,r){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&r)return;g._sweep.call(this.boxes[i],e,t,r)}},g.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},g.prototype.getTrackSample=function(e,t){var r=this.getTrackById(e);return this.getSample(r,t)},g.prototype.releaseUsedSamples=function(e,t,r){var i=0,s=this.getTrackById(e);s.lastValidSample||(s.lastValidSample=0);for(var n=s.lastValidSample;ne*s.timescale){l=i-1;break}t&&s.is_sync&&(d=i)}for(t&&(l=d),e=r.samples[l].cts,r.nextSample=l;r.samples[l].alreadyRead===r.samples[l].size&&r.samples[l+1];)l++;return n=r.samples[l].offset+r.samples[l].alreadyRead,a.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+a.getDurationString(e,o)+" and offset: "+n),{offset:n,time:e/o}},g.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},g.prototype.seek=function(e,t){var r,i,s,n=this.moov,o={offset:1/0,time:1/0};if(this.moov){for(s=0;sthis.getTrackDuration(r)||((i=this.seekTrack(e,t,r)).offset-1){a=d;break}switch(a){case"Visual":if(s.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),n.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var u=new h.avcCBox;u.parse(new o(t.avcDecoderConfigRecord)),n.addBox(u)}else if(t.hevcDecoderConfigRecord){var f=new h.hvcCBox;f.parse(new o(t.hevcDecoderConfigRecord)),n.addBox(f)}break;case"Audio":s.add("smhd").set("balance",t.balance||0),n.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":s.add("hmhd");break;case"Subtitle":if(s.add("sthd"),"stpp"===t.type)n.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:s.add("nmhd")}t.description&&n.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){n.addBox(e)})),s.add("dinf").add("dref").addEntry((new h["url Box"]).set("flags",1));var p=s.add("stbl");return p.add("stsd").addEntry(n),p.add("stts").set("sample_counts",[]).set("sample_deltas",[]),p.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),p.add("stco").set("chunk_offsets",[]),p.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(r),t.id}},h.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},g.prototype.addSample=function(e,t,r){var i=r||{},s={},n=this.getTrackById(e);if(null!==n){s.number=n.samples.length,s.track_id=n.tkhd.track_id,s.timescale=n.mdia.mdhd.timescale,s.description_index=i.sample_description_index?i.sample_description_index-1:0,s.description=n.mdia.minf.stbl.stsd.entries[s.description_index],s.data=t,s.size=t.byteLength,s.alreadyRead=s.size,s.duration=i.duration||1,s.cts=i.cts||0,s.dts=i.dts||0,s.is_sync=i.is_sync||!1,s.is_leading=i.is_leading||0,s.depends_on=i.depends_on||0,s.is_depended_on=i.is_depended_on||0,s.has_redundancy=i.has_redundancy||0,s.degradation_priority=i.degradation_priority||0,s.offset=0,s.subsamples=i.subsamples,n.samples.push(s),n.samples_size+=s.size,n.samples_duration+=s.duration,void 0===n.first_dts&&(n.first_dts=i.dts),this.processSamples();var a=this.createSingleSampleMoof(s);return this.addBox(a),a.computeSize(),a.trafs[0].truns[0].data_offset=a.size+8,this.add("mdat").data=new Uint8Array(t),s}},g.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var r=new h.moofBox;r.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var i=r.add("traf"),s=this.getTrackById(e.track_id);return i.add("tfhd").set("track_id",e.track_id).set("flags",h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),i.add("tfdt").set("baseMediaDecodeTime",e.dts-(s.first_dts||0)),i.add("trun").set("flags",h.TRUN_FLAGS_DATA_OFFSET|h.TRUN_FLAGS_DURATION|h.TRUN_FLAGS_SIZE|h.TRUN_FLAGS_FLAGS|h.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),r},g.prototype.lastMoofIndex=0,g.prototype.samplesDataSize=0,g.prototype.resetTables=function(){var e,t,r,i,s,n;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(d=s[a].grouping_type+"/0",(o=new l(s[a].grouping_type,0)).is_fragment=!0,t.sample_groups_info[d]||(t.sample_groups_info[d]=o))}else for(a=0;a=2&&(d=i[a].grouping_type+"/0",o=new l(i[a].grouping_type,0),e.sample_groups_info[d]||(e.sample_groups_info[d]=o))},g.setSampleGroupProperties=function(e,t,r,i){var s,n;for(s in t.sample_groups=[],i){var a;if(t.sample_groups[s]={},t.sample_groups[s].grouping_type=i[s].grouping_type,t.sample_groups[s].grouping_type_parameter=i[s].grouping_type_parameter,r>=i[s].last_sample_in_run&&(i[s].last_sample_in_run<0&&(i[s].last_sample_in_run=0),i[s].entry_index++,i[s].entry_index<=i[s].sbgp.entries.length-1&&(i[s].last_sample_in_run+=i[s].sbgp.entries[i[s].entry_index].sample_count)),i[s].entry_index<=i[s].sbgp.entries.length-1?t.sample_groups[s].group_description_index=i[s].sbgp.entries[i[s].entry_index].group_description_index:t.sample_groups[s].group_description_index=-1,0!==t.sample_groups[s].group_description_index)a=i[s].fragment_description?i[s].fragment_description:i[s].description,t.sample_groups[s].group_description_index>0?(n=t.sample_groups[s].group_description_index>65535?(t.sample_groups[s].group_description_index>>16)-1:t.sample_groups[s].group_description_index-1,a&&n>=0&&(t.sample_groups[s].description=a.entries[n])):a&&a.version>=2&&a.default_group_description_index>0&&(t.sample_groups[s].description=a.entries[a.default_group_description_index-1])}},g.process_sdtp=function(e,t,r){t&&(e?(t.is_leading=e.is_leading[r],t.depends_on=e.sample_depends_on[r],t.is_depended_on=e.sample_is_depended_on[r],t.has_redundancy=e.sample_has_redundancy[r]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},g.prototype.buildSampleLists=function(){var e,t;for(e=0;ev&&(b++,v<0&&(v=0),v+=n.sample_counts[b]),t>0?(e.samples[t-1].duration=n.sample_deltas[b],e.samples_duration+=e.samples[t-1].duration,U.dts=e.samples[t-1].dts+e.samples[t-1].duration):U.dts=0,a?(t>=w&&(S++,w<0&&(w=0),w+=a.sample_counts[S]),U.cts=e.samples[t].dts+a.sample_offsets[S]):U.cts=U.dts,o?(t==o.sample_numbers[E]-1?(U.is_sync=!0,E++):(U.is_sync=!1,U.degradation_priority=0),l&&l.entries[A].sample_delta+B==t+1&&(U.subsamples=l.entries[A].subsamples,B+=l.entries[A].sample_delta,A++)):U.is_sync=!0,g.process_sdtp(e.mdia.minf.stbl.sdtp,U,U.number),U.degradation_priority=h?h.priority[t]:0,l&&l.entries[A].sample_delta+B==t&&(U.subsamples=l.entries[A].subsamples,B+=l.entries[A].sample_delta),(c.length>0||u.length>0)&&g.setSampleGroupProperties(e,U,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},g.prototype.updateSampleLists=function(){var e,t,r,i,s,n,a,o,d,l,c,u,f,p,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&g.initSampleGroups(u,c,c.sbgps,u.mdia.minf.stbl.sgpds,c.sgpds),t=0;t0?p.dts=u.samples[u.samples.length-2].dts+u.samples[u.samples.length-2].duration:(c.tfdt?p.dts=c.tfdt.baseMediaDecodeTime:p.dts=0,u.first_traf_merged=!0),p.cts=p.dts,_.flags&h.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+_.sample_composition_time_offset[r]),m=a,_.flags&h.TRUN_FLAGS_FLAGS?m=_.sample_flags[r]:0===r&&_.flags&h.TRUN_FLAGS_FIRST_FLAG&&(m=_.first_sample_flags),p.is_sync=!(m>>16&1),p.is_leading=m>>26&3,p.depends_on=m>>24&3,p.is_depended_on=m>>22&3,p.has_redundancy=m>>20&3,p.degradation_priority=65535&m;var y=!!(c.tfhd.flags&h.TFHD_FLAG_BASE_DATA_OFFSET),v=!!(c.tfhd.flags&h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),b=!!(_.flags&h.TRUN_FLAGS_DATA_OFFSET),w=0;w=y?c.tfhd.base_data_offset:v||0===t?l.start:o,p.offset=0===t&&0===r?b?w+_.data_offset:w:o,o=p.offset+p.size,(c.sbgps.length>0||c.sgpds.length>0||u.mdia.minf.stbl.sbgps.length>0||u.mdia.minf.stbl.sgpds.length>0)&&g.setSampleGroupProperties(u,p,p.number_in_traf,c.sample_groups_info)}}if(c.subs){u.has_fragment_subsamples=!0;var S=c.first_sample_index;for(t=0;t-1))return null;var n=(r=this.stream.buffers[s]).byteLength-(i.offset+i.alreadyRead-r.fileStart);if(i.size-i.alreadyRead<=n)return a.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+(i.size-i.alreadyRead)+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,i.size-i.alreadyRead),r.usedBytes+=i.size-i.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead=i.size,i;if(0===n)return null;a.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+n+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,n),i.alreadyRead+=n,r.usedBytes+=n,this.stream.logBufferLevel()}},g.prototype.releaseSample=function(e,t){var r=e.samples[t];return r.data?(this.samplesDataSize-=r.size,r.data=null,r.description=null,delete r.degradation_priority,delete r.depends_on,delete r.description_index,delete r.has_redundancy,delete r.is_depended_on,delete r.is_leading,delete r.is_sync,delete r.moof_number,delete r.number_in_traf,delete r.timescale,delete r.cts,delete r.dts,delete r.offset,delete r.size,delete r.track_id,delete r.duration,r.alreadyRead=0,r.size):0},g.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},g.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},g.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(r.protection=n.ipro.protections[n.iinf.item_infos[e].protection_index-1]),n.iinf.item_infos[e].item_type?r.type=n.iinf.item_infos[e].item_type:r.type="mime",r.content_type=n.iinf.item_infos[e].content_type,r.content_encoding=n.iinf.item_infos[e].content_encoding;if(n.grpl)for(e=0;e0&&h.property_index-1-1))return null;var o=(t=this.stream.buffers[n]).byteLength-(s.offset+s.alreadyRead-t.fileStart);if(!(s.length-s.alreadyRead<=o))return a.debug("ISOFile","Getting item #"+e+" extent #"+i+" partial data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-t.fileStart)+" read size: "+o+" full extent size: "+s.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,s.offset+s.alreadyRead-t.fileStart,o),s.alreadyRead+=o,r.alreadyRead+=o,t.usedBytes+=o,this.stream.logBufferLevel(),null;a.debug("ISOFile","Getting item #"+e+" extent #"+i+" data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-t.fileStart)+" read size: "+(s.length-s.alreadyRead)+" full extent size: "+s.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,s.offset+s.alreadyRead-t.fileStart,s.length-s.alreadyRead),t.usedBytes+=s.length-s.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead+=s.length-s.alreadyRead,s.alreadyRead=s.length}}return r.alreadyRead===r.size?r:null},g.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var r=0;r0?this.moov.traks[e].samples[0].duration:0),t.push(i)}return t},g.prototype.getPerformanceInfo=function(){var e={};return e.moov=this.moov,this.moov&&this.moov.traks&&this.moov.traks.length>1&&(e.moovAudioNum=this.moov.traks[0].samples.length,e.moovVideoNum=this.moov.traks[1].samples.length),e},h.Box.prototype.printHeader=function(e){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},h.FullBox.prototype.printHeader=function(e){this.size+=4,h.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},h.Box.prototype.print=function(e){this.printHeader(e)},h.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},h.tkhdBox.prototype.print=function(e){h.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var y={createFile:function(e,t){var r=void 0===e||e,i=new g(t);return i.discardMdatData=!r,i}};t.createFile=y.createFile}));function Oi(e){return e.reduce(((e,t)=>256*e+t))}function Gi(e){const t=[101,103,119,99],r=e.length-28,i=e.slice(r,r+t.length);return t.every(((e,t)=>e===i[t]))}Ni.Log,Ni.MP4BoxStream,Ni.DataStream,Ni.MultiBufferStream,Ni.MPEG4DescriptorParser,Ni.BoxParser,Ni.XMLSubtitlein4Parser,Ni.Textin4Parser,Ni.ISOFile,Ni.createFile;class $i{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(r+32,r+32+t))]}return null}(t,this.t);if(!r)return e;const i=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(i instanceof Error)return console.error(i.message),this.d=!0,e;this.A=!0,this.u=r[1],Gi(t)&&this.c++,WebAssembly.instantiate(r[2],i).then((e=>{if("function"!=typeof(t=e.instance.exports).parse||"object"!=typeof t.memory)return this.d=!0,void console.error("video_error_3");var t;this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}function Hi(){for(var e=arguments.length,t=new Array(e),r=0;r{const r=new i((0|e.byteLength)+(0|t.byteLength));return r.set(e,0),r.set(t,0|e.byteLength),r}),new i)}const Vi=16,Wi=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],ji=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function qi(e){const t=[];for(let r=0,i=e.length;r1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Ki(e){const t=[];for(let r=0,i=e.length;r>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}function Xi(e){const t=[];for(let r=0,i=e.length;r=240&&e[r]<=247?(t.push(String.fromCodePoint(((7&e[r])<<18)+((63&e[r+1])<<12)+((63&e[r+2])<<6)+(63&e[r+3]))),r+=3):e[r]>=224&&e[r]<=239?(t.push(String.fromCodePoint(((15&e[r])<<12)+((63&e[r+1])<<6)+(63&e[r+2]))),r+=2):e[r]>=192&&e[r]<=223?(t.push(String.fromCodePoint(((31&e[r])<<6)+(63&e[r+1]))),r++):t.push(String.fromCodePoint(e[r]));return t.join("")}function Zi(e,t){const r=31&t;return e<>>32-r}function Ji(e){return(255&Wi[e>>>24&255])<<24|(255&Wi[e>>>16&255])<<16|(255&Wi[e>>>8&255])<<8|255&Wi[255&e]}function Qi(e){return e^Zi(e,2)^Zi(e,10)^Zi(e,18)^Zi(e,24)}function es(e){return e^Zi(e,13)^Zi(e,23)}function ts(e,t,r){const i=new Array(4),s=new Array(4);for(let t=0;t<4;t++)s[0]=255&e[4*t],s[1]=255&e[4*t+1],s[2]=255&e[4*t+2],s[3]=255&e[4*t+3],i[t]=s[0]<<24|s[1]<<16|s[2]<<8|s[3];for(let e,t=0;t<32;t+=4)e=i[1]^i[2]^i[3]^r[t+0],i[0]^=Qi(Ji(e)),e=i[2]^i[3]^i[0]^r[t+1],i[1]^=Qi(Ji(e)),e=i[3]^i[0]^i[1]^r[t+2],i[2]^=Qi(Ji(e)),e=i[0]^i[1]^i[2]^r[t+3],i[3]^=Qi(Ji(e));for(let e=0;e<16;e+=4)t[e]=i[3-e/4]>>>24&255,t[e+1]=i[3-e/4]>>>16&255,t[e+2]=i[3-e/4]>>>8&255,t[e+3]=255&i[3-e/4]}function rs(e,t,r){const i=new Array(4),s=new Array(4);for(let t=0;t<4;t++)s[0]=255&e[0+4*t],s[1]=255&e[1+4*t],s[2]=255&e[2+4*t],s[3]=255&e[3+4*t],i[t]=s[0]<<24|s[1]<<16|s[2]<<8|s[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let e,r=0;r<32;r+=4)e=i[1]^i[2]^i[3]^ji[r+0],t[r+0]=i[0]^=es(Ji(e)),e=i[2]^i[3]^i[0]^ji[r+1],t[r+1]=i[1]^=es(Ji(e)),e=i[3]^i[0]^i[1]^ji[r+2],t[r+2]=i[2]^=es(Ji(e)),e=i[0]^i[1]^i[2]^ji[r+3],t[r+3]=i[3]^=es(Ji(e));if(0===r)for(let e,r=0;r<16;r++)e=t[r],t[r]=t[31-r],t[31-r]=e}function is(e,t,r){let{padding:i="pkcs#7",mode:s,iv:n=[],output:a="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===s&&("string"==typeof n&&(n=qi(n)),16!==n.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=qi(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==r?Ki(e):qi(e):[...e],("pkcs#5"===i||"pkcs#7"===i)&&0!==r){const t=Vi-e.length%Vi;for(let r=0;r=Vi;){const t=e.slice(u,u+16),i=new Array(16);if("cbc"===s)for(let e=0;e2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=e.byteLength;let n=new Uint8Array(e.slice(0,5)),a=5;for(;as){const t=new Uint8Array(n.length+e.length-a);t.set(n,0),t.set(e.slice(a),n.length),n=t;break}let l=e[a+4],c=!1,u=2;if(r?(i&&(u=3),l=l>>>1&63,c=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(l)):(l&=31,c=1===l||5===l),c){const r=is(e.slice(a+4+u,a+4+d),t,0,{padding:"none",output:"array"});let i=r[r.length-1];if(i>0&&i<16){let e=!0;for(let t=1;t<=i;t++)if(r[r.length-t]!==i){e=!1;break}e&&r.splice(r.length-i,i)}const s=new Uint8Array(u);s.set(e.slice(a+4,a+4+u),0);const o=er(Hi(s,new Uint8Array(r))),l=new Uint8Array(n.length+o.length);l.set(n,0),l.set(o,n.length),n=l}else{const t=e.slice(a+4,a+4+d),r=new Uint8Array(n.length+4+t.length);r.set(n,0),r.set(o,n.length),r.set(t,n.length+4),n=r}a=a+4+d}return n}const as={init:0,findFirstStartCode:1,findSecondStartCode:2};class os extends class{on(e,t,r){const i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:r}),this}once(e,t,r){const i=this;function s(){i.off(e,s);for(var n=arguments.length,a=new Array(n),o=0;o1?r-1:0),s=1;s{delete r[e]})),void delete this.e;const i=r[e],s=[];if(i&&t)for(let e=0,r=i.length;e=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=as.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==as.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=as.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==as.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=as.findFirstStartCode}}}}function ds(e,t,r){for(let i=2;i3&&void 0!==arguments[3]&&arguments[3];const s=e.byteLength;let n=5;for(;ns)break;let o=e[n+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=ds(e.slice(n+4,n+4+a),t,r);e.set(i,n+4)}n=n+4+a}return e}function us(){for(var e=arguments.length,t=new Array(e),r=0;re+t.byteLength),0));let s=0;return t.forEach((e=>{i.set(e,s),s+=e.byteLength})),i}class hs{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,r,i)));e.addEventListener(t,r,i);const s=()=>{dr(e.removeEventListener)&&e.removeEventListener(t,r,i)};return this.destroys.push(s),s}destroy(){this.master.debugLog("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class fs{static init(){fs.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in fs.types)fs.types.hasOwnProperty(e)&&(fs.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=fs.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,r=null,i=Array.prototype.slice.call(arguments,1),s=i.length;for(let e=0;e>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r.set(e,4);let n=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return fs.box(fs.types.trak,fs.tkhd(e),fs.mdia(e))}static tkhd(e){let t=e.id,r=e.duration,i=e.presentWidth,s=e.presentHeight;return fs.box(fs.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>>8&255,255&i,0,0,s>>>8&255,255&s,0,0]))}static mdia(e){return fs.box(fs.types.mdia,fs.mdhd(e),fs.hdlr(e),fs.minf(e))}static mdhd(e){let t=e.timescale,r=e.duration;return fs.box(fs.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?fs.constants.HDLR_AUDIO:fs.constants.HDLR_VIDEO,fs.box(fs.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?fs.box(fs.types.smhd,fs.constants.SMHD):fs.box(fs.types.vmhd,fs.constants.VMHD),fs.box(fs.types.minf,t,fs.dinf(),fs.stbl(e))}static dinf(){return fs.box(fs.types.dinf,fs.box(fs.types.dref,fs.constants.DREF))}static stbl(e){return fs.box(fs.types.stbl,fs.stsd(e),fs.box(fs.types.stts,fs.constants.STTS),fs.box(fs.types.stsc,fs.constants.STSC),fs.box(fs.types.stsz,fs.constants.STSZ),fs.box(fs.types.stco,fs.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?fs.box(fs.types.stsd,fs.constants.STSD_PREFIX,fs.mp3(e)):fs.box(fs.types.stsd,fs.constants.STSD_PREFIX,fs.mp4a(e)):"avc"===e.videoType?fs.box(fs.types.stsd,fs.constants.STSD_PREFIX,fs.avc1(e)):fs.box(fs.types.stsd,fs.constants.STSD_PREFIX,fs.hvc1(e))}static mp3(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return fs.box(fs.types[".mp3"],i)}static mp4a(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return fs.box(fs.types.mp4a,i,fs.esds(e))}static esds(e){let t=e.config||[],r=t.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(t).concat([6,1,2]));return fs.box(fs.types.esds,i)}static avc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return fs.box(fs.types.avc1,s,fs.box(fs.types.avcC,t))}static hvc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return fs.box(fs.types.hvc1,s,fs.box(fs.types.hvcC,t))}static mvex(e){return fs.box(fs.types.mvex,fs.trex(e))}static trex(e){let t=e.id,r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return fs.box(fs.types.trex,r)}static moof(e,t){return fs.box(fs.types.moof,fs.mfhd(e.sequenceNumber),fs.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return fs.box(fs.types.mfhd,t)}static traf(e,t){let r=e.id,i=fs.box(fs.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),s=fs.box(fs.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),n=fs.sdtp(e),a=fs.trun(e,n.byteLength+16+16+8+16+8+8);return fs.box(fs.types.traf,i,s,a,n)}static sdtp(e){let t=new Uint8Array(5),r=e.flags;return t[4]=r.isLeading<<6|r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy,fs.box(fs.types.sdtp,t)}static trun(e,t){let r=new Uint8Array(28);t+=36,r.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let i=e.duration,s=e.size,n=e.flags,a=e.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,s>>>24&255,s>>>16&255,s>>>8&255,255&s,n.isLeading<<2|n.dependsOn,n.isDependedOn<<6|n.hasRedundancy<<4|n.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12),fs.box(fs.types.trun,r)}static mdat(e){return fs.box(fs.types.mdat,e)}}fs.init();var ps,ms=Ot((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}));(ps=ms)&&ps.__esModule&&Object.prototype.hasOwnProperty.call(ps,"default")&&ps.default;const _s=[44100,48e3,32e3,0],gs=[22050,24e3,16e3,0],ys=[11025,12e3,8e3,0],vs=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],bs=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],ws=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];function Ss(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),r=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let i=t[1]>>>3&3,s=(6&t[1])>>1,n=(240&t[2])>>>4,a=(12&t[2])>>>2,o=3!==(t[3]>>>6&3)?2:1,d=0,l=0;switch(i){case 0:d=ys[a];break;case 2:d=gs[a];break;case 3:d=_s[a]}switch(s){case 1:n=e[s]&&t=6?(i=5,t=new Array(4),a=s-3):(i=2,t=new Array(2),a=s):-1!==o.indexOf("android")?(i=2,t=new Array(2),a=s):(i=5,a=s,t=new Array(4),s>=6?a=s-3:1===n&&(i=2,t=new Array(2),a=s)),t[0]=i<<3,t[0]|=(15&s)>>>1,t[1]=(15&s)<<7,t[1]|=(15&n)<<3,5===i&&(t[1]|=(15&a)>>>1,t[2]=(1&a)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=Rs[s],this.sampling_index=s,this.channel_count=n,this.object_type=i,this.original_object_type=r,this.codec_mimetype="mp4a.40."+i,this.original_codec_mimetype="mp4a.40."+r}}class Os{constructor(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}get bitsAvailable(){return this.bitLength-this.index}skipBits(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}getBits(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>i,n=8-i;if(n>=e)return r&&(this.index+=e),s>>n-e;{r&&(this.index+=n);const i=e-n;return s<>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}function Gs(e){return e[3]|e[2]<<8|e[1]<<16|e[0]<<24}const $s=new Array(214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72),Hs=new Array(2746333894,1453994832,1736282519,2993693404),Vs=new Array(462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257);function Ws(e,t,r,i,s){var n=s;n=t+s>e.length&&i+s<=r.length?e.length-t:i+s>r.length&&t+s<=e.length?r.length-i:t+s<=e.length&&i+s<=r.length?s:r.length>24&255,e>>16&255,e>>8&255,255&e)}function qs(e,t){return t+3>>19)^(i<<23|i>>>9)}function Xs(e,t){var r=new Array(36);r[0]=qs(t,0),r[1]=qs(t,4),r[2]=qs(t,8),r[3]=qs(t,12);for(var i=0;i<32;i++)r[i+4]=r[i]^Zs(r[i+1]^r[i+2]^r[i+3]^e[i]);var s=new Array(4);for(i=35;i>=32;i--)s[35-i]=r[i];var n=function(e){for(var t=new Array(4*e.length),r=0;r>>30)^(i<<10|i>>>22)^(i<<18|i>>>14)^(i<<24|i>>>8)}function Js(e,t,r){if(null==e||null==e||e.length%16!=0)return console.log("sm4 key is error!"),null;if(null==r||null==r||r.length<=0)return console.log("cipher is error!"),null;if(null==t||null==t||t.length%16!=0)return console.log("iv is error!"),null;for(var i=Ys(e),s=Math.ceil(r.length/16),n=new Array(r.length),a=t.slice(),o=0;o3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t=new Uint8Array(t),r=new Uint8Array(r);const n=e.byteLength;let a=5;for(;an)break;let d=e[a+4],l=!1,c=2;if(i?(s&&(c=3),d=d>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(d)):(d&=31,l=1===d||5===d),l){const i=Js(t,r,e.slice(a+4+c,a+4+o));e.set(i,a+4+c)}a=a+4+o}return e}Date.now||(Date.now=function(){return(new Date).getTime()}),n({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support")&&-1===e.indexOf("illegal icc")&&!e.indexOf("If you want to help, upload a sample of this file to")&&!e.indexOf("Reserved SBR extensions is not implemented"))})(e)||console.warn("JbPro[❌❌❌][worker]:",e)}}).then((e=>{!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[],s=[],n=null,a=null,o=null,d=null,l=null,c=null,u=!1,h=null,w=null,S=!1,U=!1,we=!!_r(r),Se=0,We=0,Ze=!1,Je=null,et=null,rt=null,ct=[],Et=null,At=null,xt=0,Nt=0,Ot=null,Gt=null,$t=0,Ht=0,Yt=!1,Jt=!1,sr=!1,br=null,wr=null,Sr=!1,Er=!0,xr=()=>{const e=pr();return{debug:e.debug,debugLevel:e.debugLevel,debugUuid:e.debugUuid,useOffscreen:e.useOffscreen,useWCS:e.useWCS,useMSE:e.useMSE,videoBuffer:e.videoBuffer,videoBufferDelay:e.videoBufferDelay,openWebglAlignment:e.openWebglAlignment,playType:e.playType,hasAudio:e.hasAudio,hasVideo:e.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:e.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:e.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:0,networkDelay:e.networkDelay,visibility:!0,useSIMD:e.useSIMD,isRecording:!1,recordType:e.recordType,isNakedFlow:e.isNakedFlow,checkFirstIFrame:e.checkFirstIFrame,audioBufferSize:1024,isM7sCrypto:e.isM7sCrypto,m7sCryptoAudio:e.m7sCryptoAudio,cryptoKey:e.cryptoKey,cryptoIV:e.cryptoIV,isSm4Crypto:e.isSm4Crypto,isSm4CryptoH265V2:e.isSm4CryptoH265V2,sm4CryptoKey:e.sm4CryptoKey,isXorCrypto:e.isXorCrypto,isHls265:!1,isFlv:e.isFlv,isFmp4:e.isFmp4,isMpeg4:e.isMpeg4,isTs:e.isTs,isFmp4Private:e.isFmp4Private,isEmitSEI:e.isEmitSEI,isRecordTypeFlv:!1,isWasmMp4:!1,isChrome:!1,isFirefox:!1,isDropSameTimestampGop:e.isDropSameTimestampGop,mseDecodeAudio:e.mseDecodeAudio,wcsDecodeAudio:e.wcsDecodeAudio,nakedFlowH265DemuxUseNew:e.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:e.mseDecoderUseWorker,mseAutoCleanupSourceBuffer:e.mseAutoCleanupSourceBuffer,mseAutoCleanupMaxBackwardDuration:e.mseAutoCleanupMaxBackwardDuration,mseAutoCleanupMinBackwardDuration:e.mseAutoCleanupMinBackwardDuration,mseCorrectTimeDuration:e.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:e.mseCorrectAudioTimeDuration,nakedFlowDemuxUseNew:e.nakedFlowDemuxUseNew,nakedFlowFps:e.nakedFlowFps,supportMSEDecodeHevc:!1}};"VideoEncoder"in self&&(n={hasInit:!1,isEmitInfo:!1,offscreenCanvas:null,offscreenCanvasCtx:null,decoder:null,init(){n.decoder=new VideoDecoder({output:function(e){if(dr(e.createImageBitmap))e.createImageBitmap().then((t=>{n.offscreenCanvasCtx.drawImage(t,0,0,e.codedWidth,e.codedHeight);let r=n.offscreenCanvas.transferToImageBitmap();postMessage({cmd:T,buffer:r,delay:ni.delay,ts:0},[r]),ur(e)}));else{n.offscreenCanvasCtx.drawImage(e,0,0,e.codedWidth,e.codedHeight);let t=n.offscreenCanvas.transferToImageBitmap();postMessage({cmd:T,buffer:t,delay:ni.delay,ts:0},[t]),ur(e)}},error:function(e){ni.debugError("worker","VideoDecoder error: ",e,e.toString())}})},destroy(){n.reset(),n.decoder&&"closed"!==n.decoder.state&&(n.decoder.close(),n.decoder=null)},decode:function(e,t,r){const i=e[0]>>4==1;if(n.hasInit){const r=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:i?ft:pt});n.decoder.decode(r)}else if(i&&0===e[1]){const t=15&e[0];postMessage({cmd:P,code:t});const r=new Uint8Array(e);postMessage({cmd:M,buffer:r,codecId:t},[r.buffer]);let i=null,s=null;const a=e.slice(5);t===Fe?(s=kr(a),i={codec:s.codec,description:a}):t===Pe&&(s=Vr(a),i={codec:s.codec,description:a}),s&&s.codecWidth&&s.codecHeight&&(i.codedHeight=s.codecHeight,i.codedWidth=s.codecWidth),n.isEmitInfo||(ni.debugLog("worker","Webcodecs Video Decoder initSize"),postMessage({cmd:k,w:s.codecWidth,h:s.codecHeight}),n.isEmitInfo=!0,n.offscreenCanvas=new OffscreenCanvas(s.codecWidth,s.codecHeight),n.offscreenCanvasCtx=n.offscreenCanvas.getContext("2d"));try{n.decoder.configure(i),n.hasInit=!0}catch(e){ni.debugError("worker","VideoDecoder configure error",e.code,e,e.toString()),e.toString()}}else ni.debugWarn("worker",`VideoDecoder configure has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)},reset(){n.hasInit=!1,n.isEmitInfo=!1,n.offscreenCanvas=null,n.offscreenCanvasCtx=null}});let Or=function(){if(Sr=!0,a)try{a.abort(),a=null,ni.debugLog("worker","abort success")}catch(e){a=null,ni.debugLog("worker","abort catch",e)}},Gr={init(){Gr.lastBuf=null,Gr.vps=null,Gr.sps=null,Gr.pps=null,Gr.streamType=null,Gr.localDts=0,Gr.pendingUnits={},Gr.isSendSeqHeader=!1},destroy(){Gr.lastBuf=null,Gr.vps=null,Gr.sps=null,Gr.pps=null,Gr.streamType=null,Gr.localDts=0,Gr.pendingUnits={},Gr.isSendSeqHeader=!1},dispatch(e){const t=new Uint8Array(e);if(ni._opt.nakedFlowDemuxUseNew){const e=Gr.extractNALu$3(t);if(0===e.length)return void ni.debugLog("worker","dispatch naluArray length is 0");Gr.handleVideoFrames(e)}else Gr.extractNALu$2(t)},getNaluDts(){const e=ni._opt.nakedFlowFps;let t=Gr.localDts;return Gr.localDts=Gr.localDts+parseInt(1e3/e,10),t},getNaluAudioDts(){const e=ni._opt.sampleRate,t=ni._opt.audioBufferSize;return Gr.localDts+parseInt(t/e*1e3)},extractNALu(e){let t,r,i=0,s=e.byteLength,n=0,a=[];for(;i1)for(let e=0;e{const t=Ir(e);t===Ve||t===He?Gr.handleVideoH264Nalu(e):Pr(t)&&i.push(e)})),1===i.length)Gr.handleVideoH264Nalu(i[0]);else if(Rr(i)){const e=Ir(i[0]),t=Mr(e);Gr.handleVideoH264NaluList(i,t,e)}else i.forEach((e=>{Gr.handleVideoH264Nalu(e)}))}else if(Gr.streamType===ze)if(ni._opt.nakedFlowH265DemuxUseNew){const t=Gr.handleAddNaluStartCode(e),r=Gr.extractNALu(t);if(0===r.length)return void ni.debugWarn("worker","handleVideoNalu","h265 naluList.length === 0");const i=[];if(r.forEach((e=>{const t=Kr(e);t===dt||t===at||t===st?Gr.handleVideoH265Nalu(e):Zr(t)&&i.push(e)})),1===i.length)Gr.handleVideoH265Nalu(i[0]);else if(Qr(i)){const e=Kr(i[0]),t=Jr(e);Gr.handleVideoH265NaluList(i,t,e)}else i.forEach((e=>{Gr.handleVideoH265Nalu(e)}))}else Kr(e)===dt?Gr.extractH265PPS(e):Gr.handleVideoH265Nalu(e)},extractH264PPS(e){const t=Gr.handleAddNaluStartCode(e);Gr.extractNALu(t).forEach((e=>{Fr(Ir(e))?Gr.extractH264SEI(e):Gr.handleVideoH264Nalu(e)}))},extractH265PPS(e){const t=Gr.handleAddNaluStartCode(e);Gr.extractNALu(t).forEach((e=>{Xr(Kr(e))?Gr.extractH265SEI(e):Gr.handleVideoH265Nalu(e)}))},extractH264SEI(e){const t=Gr.handleAddNaluStartCode(e);Gr.extractNALu(t).forEach((e=>{Gr.handleVideoH264Nalu(e)}))},extractH265SEI(e){const t=Gr.handleAddNaluStartCode(e);Gr.extractNALu(t).forEach((e=>{Gr.handleVideoH265Nalu(e)}))},handleAddNaluStartCode(e){const t=[0,0,0,1],r=new Uint8Array(e.length+t.length);return r.set(t),r.set(e,t.length),r},handleVideoH264Nalu(e){const t=Ir(e);switch(t){case He:Gr.sps=e;break;case Ve:Gr.pps=e}if(Gr.isSendSeqHeader){if(Gr.sps&&Gr.pps){const e=Tr({sps:Gr.sps,pps:Gr.pps}),t=Gr.localDts;ni.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null}if(Pr(t)){const r=Mr(t),i=Gr.getNaluDts(),s=Dr(e,r);Gr.doDecode(s,{type:ae,ts:i,isIFrame:r,cts:0})}}else if(Gr.sps&&Gr.pps){Gr.isSendSeqHeader=!0;const e=Tr({sps:Gr.sps,pps:Gr.pps});ni.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null}},handleVideoH264NaluList(e,t,r){if(Gr.isSendSeqHeader){const i=Gr.getNaluDts(),s=Lr(e.reduce(((e,t)=>{const r=er(e),i=er(t),s=new Uint8Array(r.byteLength+i.byteLength);return s.set(r,0),s.set(i,r.byteLength),s})),t);Gr.doDecode(s,{type:ae,ts:i,isIFrame:t,cts:0}),ni.debugLog("worker",`handleVideoH264NaluList list size is ${e.length} package length is ${s.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},handleVideoH265Nalu(e){const t=Kr(e);switch(t){case st:Gr.vps=e;break;case at:Gr.sps=e;break;case dt:Gr.pps=e}if(Gr.isSendSeqHeader){if(Gr.vps&&Gr.sps&&Gr.pps){const e=jr({vps:Gr.vps,sps:Gr.sps,pps:Gr.pps}),t=Gr.localDts;ni.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Gr.vps=null,Gr.sps=null,Gr.pps=null}if(Zr(t)){const r=Jr(t),i=Gr.getNaluDts(),s=qr(e,r);Gr.doDecode(s,{type:ae,ts:i,isIFrame:r,cts:0})}}else if(Gr.vps&&Gr.sps&&Gr.pps){Gr.isSendSeqHeader=!0;const e=jr({vps:Gr.vps,sps:Gr.sps,pps:Gr.pps});ni.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Gr.vps=null,Gr.sps=null,Gr.pps=null}},handleVideoH265NaluList(e,t,r){if(Gr.isSendSeqHeader){const i=Gr.getNaluDts(),s=Yr(e.reduce(((e,t)=>{const r=er(e),i=er(t),s=new Uint8Array(r.byteLength+i.byteLength);return s.set(r,0),s.set(i,r.byteLength),s})),t);Gr.doDecode(s,{type:ae,ts:i,isIFrame:t,cts:0}),ni.debugLog("worker",`handleVideoH265NaluList list size is ${e.length} package length is ${s.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},doDecode(e,t){ni.calcNetworkDelay(t.ts),t.isIFrame&&ni.calcIframeIntervalTimestamp(t.ts),ni.decode(e,t)},handleVideoFrames(e){if(!Gr.streamVideoType)for(let t of e)if(Gr.streamVideoType=lr(t),Gr.streamVideoType)break;Gr.streamVideoType?Gr.streamVideoType===Re?Gr.handleVideoH264Frames(e):this.streamVideoType===ze&&Gr.handleVideoH265Frames(e):ni.debugWarn("worker","handleVideoFrames","streamVideoType is null")},handleVideoH264Frames(e){let t=[],r=[],i=!1,s=!1;Gr.pendingUnits.units&&(t=Gr.pendingUnits.units,s=Gr.pendingUnits.vcl,i=Gr.pendingUnits.iFrame,Gr.pendingUnits={});let n={};for(let a of e){if(a.byteLength<4)continue;const e=Ir(a);let o=!1,d=e===qe;e!==je&&e!==qe||(n=Gr.parseVideo264Header(a),o=!0),t.length&&s&&(n.isfms||!o)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,s=!1),t.push(a),i=i||d,s=s||o}t.length&&(Gr.pendingUnits={units:t,vcl:s,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,s=null;if(t.forEach((e=>{const t=31&e[0];switch(t){case Ve:Gr.pps=e;break;case He:Gr.sps=e;break;case Ye:s=e}if(Pr(t)){const t=er(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Gr.isSendSeqHeader&&Gr.sps&&Gr.pps){Gr.isSendSeqHeader=!0;const e=Cr({sps:Gr.sps,pps:Gr.pps});ni.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null}if(Gr.isSendSeqHeader){if(Gr.sps&&Gr.pps){const e=Cr({sps:Gr.sps,pps:Gr.pps}),t=Gr.localDts;ni.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null}if(i){const e=Gr.getNaluDts(),t=Lr(i,r);ni._opt.isEmitSEI&&s&&postMessage({cmd:X,buffer:s,ts:e},[s.buffer]),Gr.doDecode(t,{type:ae,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames(e){let t=[],r=[],i=!1,s=!1;Gr.pendingUnits.units&&(t=Gr.pendingUnits.units,s=Gr.pendingUnits.vcl,i=Gr.pendingUnits.iFrame,Gr.pendingUnits={});let n={};for(let a of e){if(a.byteLength<4)continue;const e=Kr(a);let o=!1,d=Jr(e);Zr(e)&&(n=this.parseVideo265Header(a),o=!0),t.length&&s&&(n.isfms||!o)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,s=!1),t.push(a),i=i||d,s=s||o}t.length&&(Gr.pendingUnits={units:t,vcl:s,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,s=null;if(t.forEach((e=>{const t=e[0]>>>1&63;switch(t){case dt:Gr.pps=e;break;case at:Gr.sps=e;break;case st:Gr.vps=e;break;case ht:case ut:s=e}if(Zr(t)){const t=er(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Gr.isSendSeqHeader&&Gr.sps&&Gr.pps&&Gr.vps){Gr.isSendSeqHeader=!0;const e=jr({sps:Gr.sps,pps:Gr.pps,vps:Gr.vps});ni.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null,Gr.vps=null}if(Gr.isSendSeqHeader){if(Gr.sps&&Gr.pps&&Gr.vps){const e=jr({sps:Gr.sps,pps:Gr.pps,vps:Gr.vps}),t=Gr.localDts;ni.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null,Gr.vps=null}if(i){const e=Gr.getNaluDts(),t=Yr(i,r);ni._opt.isEmitSEI&&s&&postMessage({cmd:X,buffer:s,ts:e},[s.buffer]),Gr.doDecode(t,{type:ae,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames_1(e){e.forEach((e=>{Gr.handleVideoNalu(e)}))},parseVideo264Header(e){const t=new Os(e);return t.readUByte(),{isfms:0===t.readUEG(),sType:t.readUEG()}},parseVideo265Header(e){const t=new Os(e);return t.readUByte(),{nalType:t.readBits(6),isfms:0===t.readBits(1),sType:t.readBits(3)}}},Wr={LOG_NAME:"worker fmp4Demuxer",mp4Box:null,offset:0,videoTrackId:null,audioTrackId:null,isHevc:!1,listenMp4Box(){Wr.mp4Box=Ni.createFile(),Wr.mp4Box.onReady=Wr.onReady,Wr.mp4Box.onError=Wr.onError,Wr.mp4Box.onSamples=Wr.onSamples},initTransportDescarmber(){Wr.transportDescarmber=new $i},_getSeqHeader(e){const t=Wr.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new Ni.DataStream(void 0,0,Ni.DataStream.BIG_ENDIAN);let r=[];e.avcC?(e.avcC.write(t),r=[23,0,0,0,0]):(Wr.isHevc=!0,ni.isHevc=!0,e.hvcC.write(t),r=[28,0,0,0,0]);const i=new Uint8Array(t.buffer,8),s=new Uint8Array(r.length+i.length);return s.set(r,0),s.set(i,r.length),s}return null},onReady(e){ni.debugLog(Wr.LOG_NAME,"onReady()");const t=e.videoTracks[0],r=e.audioTracks[0];if(t){Wr.videoTrackId=t.id;const e=Wr._getSeqHeader(t);e&&(ni.debugLog(Wr.LOG_NAME,"seqHeader"),ni.decodeVideo(e,0,!0,0)),Wr.mp4Box.setExtractionOptions(t.id)}if(r&&ni._opt.hasAudio){Wr.audioTrackId=r.id;const e=r.audio||{},t=Vt.indexOf(e.sample_rate),i=r.codec.replace("mp4a.40.","");Wr.mp4Box.setExtractionOptions(r.id);const s=Wt({profile:parseInt(i,10),sampleRate:t,channel:e.channel_count});ni.debugLog(Wr.LOG_NAME,"aacADTSHeader"),ni.decodeAudio(s,0)}Wr.mp4Box.start()},onError(e){ni.debugError(Wr.LOG_NAME,"mp4Box onError",e)},onSamples(e,t,r){if(e===Wr.videoTrackId){for(const e of r){const t=e.data,r=e.is_sync,i=1e3*e.cts/e.timescale;e.duration,e.timescale,r&&ni.calcIframeIntervalTimestamp(i);let s=null;s=Wr.isHevc?Yr(t,r):Lr(t,r),ni.decode(s,{type:ae,ts:i,isIFrame:r,cts:0})}Wr.mp4Box.removeUsedSamples(e)}else if(e===Wr.audioTrackId){if(ni._opt.hasAudio){for(const e of r){const t=e.data,r=1e3*e.cts/e.timescale;e.duration,e.timescale;const i=new Uint8Array(t.byteLength+2);i.set([175,1],0),i.set(t,2),ni.decode(i,{type:ne,ts:r,isIFrame:!1,cts:0})}Wr.mp4Box.removeUsedSamples(e)}}else ni.debugWarn(Wr.LOG_NAME,"onSamples() trackId error",e)},dispatch(e){let t=new Uint8Array(e);Wr.transportDescarmber&&(t=Wr.transportDescarmber.transport(t)),t.buffer.fileStart=Wr.offset,Wr.offset+=t.byteLength,Wr.mp4Box.appendBuffer(t.buffer)},destroy(){Wr.mp4Box&&(Wr.mp4Box.stop(),Wr.mp4Box.flush(),Wr.mp4Box.destroy(),Wr.mp4Box=null),Wr.transportDescarmber&&(Wr.transportDescarmber.destroy(),Wr.transportDescarmber=null),Wr.offset=0,Wr.videoTrackId=null,Wr.audioTrackId=null,Wr.isHevc=!1}},ri={LOG_NAME:"worker mpeg4Demuxer",lastBuffer:new Uint8Array(0),parsedOffset:0,firstStartCodeOffset:0,secondStartCodeOffset:0,state:"init",hasInitVideoCodec:!1,localDts:0,dispatch(e){const t=new Uint8Array(e);ri.extractNALu(t)},destroy(){ri.lastBuffer=new Uint8Array(0),ri.parsedOffset=0,ri.firstStartCodeOffset=0,ri.secondStartCodeOffset=0,ri.state="init",ri.hasInitVideoCodec=!1,ri.localDts=0},extractNALu(e){if(!e||e.byteLength<1)return void ni.debugWarn(ri.LOG_NAME,"extractNALu() buffer error",e);const t=new Uint8Array(ri.lastBuffer.length+e.length);for(t.set(ri.lastBuffer,0),t.set(new Uint8Array(e),ri.lastBuffer.length),ri.lastBuffer=t;;){if("init"===ri.state){let e=!1;for(;ri.lastBuffer.length-ri.parsedOffset>=4;)if(0===ri.lastBuffer[ri.parsedOffset])if(0===ri.lastBuffer[ri.parsedOffset+1])if(1===ri.lastBuffer[ri.parsedOffset+2]){if(182===ri.lastBuffer[ri.parsedOffset+3]){ri.state="findFirstStartCode",ri.firstStartCodeOffset=ri.parsedOffset,ri.parsedOffset+=4,e=!0;break}ri.parsedOffset++}else ri.parsedOffset++;else ri.parsedOffset++;else ri.parsedOffset++;if(e)continue;break}if("findFirstStartCode"===ri.state){let e=!1;for(;ri.lastBuffer.length-ri.parsedOffset>=4;)if(0===ri.lastBuffer[ri.parsedOffset])if(0===ri.lastBuffer[ri.parsedOffset+1])if(1===ri.lastBuffer[ri.parsedOffset+2]){if(182===ri.lastBuffer[ri.parsedOffset+3]){ri.state="findSecondStartCode",ri.secondStartCodeOffset=ri.parsedOffset,ri.parsedOffset+=4,e=!0;break}ri.parsedOffset++}else ri.parsedOffset++;else ri.parsedOffset++;else ri.parsedOffset++;if(e)continue;break}if("findSecondStartCode"===ri.state){if(!(ri.lastBuffer.length-ri.parsedOffset>0))break;{let e,t,r=192&ri.lastBuffer[ri.parsedOffset];e=0==r?ri.secondStartCodeOffset-14:ri.secondStartCodeOffset;let i=0==(192&ri.lastBuffer[ri.firstStartCodeOffset+4]);if(i){if(ri.firstStartCodeOffset-14<0)return void ni.debugWarn(ri.LOG_NAME,"firstStartCodeOffset -14 is",ri.firstStartCodeOffset-14);ri.hasInitVideoCodec||(ri.hasInitVideoCodec=!0,ni.debugLog(ri.LOG_NAME,"setCodec"),oi.setCodec(Me,"")),t=ri.lastBuffer.subarray(ri.firstStartCodeOffset-14,e)}else t=ri.lastBuffer.subarray(ri.firstStartCodeOffset,e);let s=ri.getNaluDts();ri.hasInitVideoCodec?(postMessage({cmd:O,type:Ue,value:t.byteLength}),postMessage({cmd:O,type:xe,value:s}),Se=s,oi.decode(t,i?1:0,s)):ni.debugWarn(ri.LOG_NAME,"has not init video codec"),ri.lastBuffer=ri.lastBuffer.subarray(e),ri.firstStartCodeOffset=0==r?14:0,ri.parsedOffset=ri.firstStartCodeOffset+4,ri.state="findFirstStartCode"}}}},getNaluDts(){let e=ri.localDts;return ri.localDts=ri.localDts+40,e}},ii={TAG_NAME:"worker TsLoaderV2",first_parse_:!0,tsPacketSize:0,syncOffset:0,pmt_:null,config_:null,media_info_:new zs,timescale_:90,duration_:0,pat_:{version_number:0,network_pid:0,program_map_pid:{}},current_program_:null,current_pmt_pid_:-1,program_pmt_map_:{},pes_slice_queues_:{},section_slice_queues_:{},video_metadata_:{vps:null,sps:null,pps:null,details:null},audio_metadata_:{codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},last_pcr_:null,audio_last_sample_pts_:void 0,aac_last_incomplete_data_:null,has_video_:!1,has_audio_:!1,video_init_segment_dispatched_:!1,audio_init_segment_dispatched_:!1,video_metadata_changed_:!1,audio_metadata_changed_:!1,loas_previous_frame:null,video_track_:{type:"video",id:1,sequenceNumber:0,samples:[],length:0},audio_track_:{type:"audio",id:2,sequenceNumber:0,samples:[],length:0},_remainingPacketData:null,init(){},destroy(){ii.media_info_=null,ii.pes_slice_queues_=null,ii.section_slice_queues_=null,ii.video_metadata_=null,ii.audio_metadata_=null,ii.aac_last_incomplete_data_=null,ii.video_track_=null,ii.audio_track_=null,ii._remainingPacketData=null},probe(e){let t=new Uint8Array(e),r=-1,i=188;if(t.byteLength<=3*i)return{needMoreData:!0};for(;-1===r;){let e=Math.min(1e3,t.byteLength-3*i);for(let s=0;s=4&&(r-=4),{match:!0,consumed:0,ts_packet_size:i,sync_offset:r})},_initPmt:()=>({program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}),dispatch(e){ii._remainingPacketData&&(e=us(ii._remainingPacketData,e),ii._remainingPacketData=null);let t=e.buffer;const r=ii.parseChunks(t);r?ii._remainingPacketData=e.subarray(r):e.length>>6;r[1];let n=(31&r[1])<<8|r[2],a=(48&r[3])>>>4,o=15&r[3],d=!(!ii.pmt_||ii.pmt_.pcr_pid!==n),l={},c=4;if(2==a||3==a){let e=r[4];if(e>0&&(d||3==a)&&(l.discontinuity_indicator=(128&r[5])>>>7,l.random_access_indicator=(64&r[5])>>>6,l.elementary_stream_priority_indicator=(32&r[5])>>>5,(16&r[5])>>>4)){let e=300*(r[6]<<25|r[7]<<17|r[8]<<9|r[9]<<1|r[10]>>>7)+((1&r[10])<<8|r[11]);ii.last_pcr_=e}if(2==a||5+e===188){t+=188,204===ii.tsPacketSize&&(t+=16);continue}c=5+e}if(1==a||3==a)if(0===n||n===ii.current_pmt_pid_||null!=ii.pmt_&&ii.pmt_.pid_stream_type[n]===Ds){let r=188-c;ii.handleSectionSlice(e,t+c,r,{pid:n,payload_unit_start_indicator:s,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}else if(null!=ii.pmt_&&null!=ii.pmt_.pid_stream_type[n]){let r=188-c,i=ii.pmt_.pid_stream_type[n];n!==ii.pmt_.common_pids.h264&&n!==ii.pmt_.common_pids.h265&&n!==ii.pmt_.common_pids.adts_aac&&n!==ii.pmt_.common_pids.loas_aac&&n!==ii.pmt_.common_pids.ac3&&n!==ii.pmt_.common_pids.eac3&&n!==ii.pmt_.common_pids.opus&&n!==ii.pmt_.common_pids.mp3&&!0!==ii.pmt_.pes_private_data_pids[n]&&!0!==ii.pmt_.timed_id3_pids[n]&&!0!==ii.pmt_.synchronous_klv_pids[n]&&!0!==ii.pmt_.asynchronous_klv_pids[n]||ii.handlePESSlice(e,t+c,r,{pid:n,stream_type:i,payload_unit_start_indicator:s,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}t+=188,204===ii.tsPacketSize&&(t+=16)}return ii.dispatchAudioVideoMediaSegment(),t},handleSectionSlice(e,t,r,i){let s=new Uint8Array(e,t,r),n=ii.section_slice_queues_[i.pid];if(i.payload_unit_start_indicator){let a=s[0];if(null!=n&&0!==n.total_length){let s=new Uint8Array(e,t+1,Math.min(r,a));n.slices.push(s),n.total_length+=s.byteLength,n.total_length===n.expected_length?ii.emitSectionSlices(n,i):ii.clearSlices(n,i)}for(let o=1+a;o=n.expected_length&&ii.clearSlices(n,i),o+=d.byteLength}}else if(null!=n&&0!==n.total_length){let s=new Uint8Array(e,t,Math.min(r,n.expected_length-n.total_length));n.slices.push(s),n.total_length+=s.byteLength,n.total_length===n.expected_length?ii.emitSectionSlices(n,i):n.total_length>=n.expected_length&&ii.clearSlices(n,i)}},handlePESSlice(e,t,r,i){let s=new Uint8Array(e,t,r),n=s[0]<<16|s[1]<<8|s[2];s[3];let a=s[4]<<8|s[5];if(i.payload_unit_start_indicator){if(1!==n)return void ni.debugWarn(ii.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${n}`);let e=ii.pes_slice_queues_[i.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?ii.emitPESSlices(e,i):ii.clearSlices(e,i)),ii.pes_slice_queues_[i.pid]=new Fs,ii.pes_slice_queues_[i.pid].random_access_indicator=i.random_access_indicator}if(null==ii.pes_slice_queues_[i.pid])return;let o=ii.pes_slice_queues_[i.pid];o.slices.push(s),i.payload_unit_start_indicator&&(o.expected_length=0===a?0:a+6),o.total_length+=s.byteLength,o.expected_length>0&&o.expected_length===o.total_length?ii.emitPESSlices(o,i):o.expected_length>0&&o.expected_length>>6,o=t[8];2!==a&&3!==a||(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,n=3===a?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:r);let d,l=9+o;if(0!==s){if(s<3+o)return void ni.debugWarn(ii.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");d=s-3-o}else d=t.byteLength-l;let c=t.subarray(l,l+d);switch(e.stream_type){case Es:case As:ii.parseMP3Payload(c,r);break;case Bs:ii.pmt_.common_pids.opus===e.pid||ii.pmt_.common_pids.ac3===e.pid||ii.pmt_.common_pids.eac3===e.pid||(ii.pmt_.asynchronous_klv_pids[e.pid]?ii.parseAsynchronousKLVMetadataPayload(c,e.pid,i):ii.pmt_.smpte2038_pids[e.pid]?ii.parseSMPTE2038MetadataPayload(c,r,n,e.pid,i):ii.parsePESPrivateDataPayload(c,r,n,e.pid,i));break;case Us:ii.parseADTSAACPayload(c,r);break;case xs:ii.parseLOASAACPayload(c,r);break;case ks:case Ts:break;case Cs:ii.pmt_.timed_id3_pids[e.pid]?ii.parseTimedID3MetadataPayload(c,r,n,e.pid,i):ii.pmt_.synchronous_klv_pids[e.pid]&&ii.parseSynchronousKLVMetadataPayload(c,r,n,e.pid,i);break;case Ls:ii.parseH264Payload(c,r,n,e.random_access_indicator);break;case Is:ii.parseH265Payload(c,r,n,e.random_access_indicator)}}else if((188===i||191===i||240===i||241===i||255===i||242===i||248===i)&&e.stream_type===Bs){let r,n=6;r=0!==s?s:t.byteLength-n;let a=t.subarray(n,n+r);ii.parsePESPrivateDataPayload(a,void 0,void 0,e.pid,i)}}else ni.debugError(ii.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${r}`)},parsePAT(e){let t=e[0];if(0!==t)return void Log.e(ii.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let r=(15&e[1])<<8|e[2];e[3],e[4];let i=(62&e[5])>>>1,s=1&e[5],n=e[6];e[7];let a=null;if(1===s&&0===n)a={version_number:0,network_pid:0,program_pmt_pid:{}},a.version_number=i;else if(a=ii.pat_,null==a)return;let o=r-5-4,d=-1,l=-1;for(let t=8;t<8+o;t+=4){let r=e[t]<<8|e[t+1],i=(31&e[t+2])<<8|e[t+3];0===r?a.network_pid=i:(a.program_pmt_pid[r]=i,-1===d&&(d=r),-1===l&&(l=i))}1===s&&0===n&&(null==ii.pat_&&ni.debugLog(ii.TAG_NAME,`Parsed first PAT: ${JSON.stringify(a)}`),ii.pat_=a,ii.current_program_=d,ii.current_pmt_pid_=l)},parsePMT(e){let t=e[0];if(2!==t)return void ni.debugError(ii.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let r,i=(15&e[1])<<8|e[2],s=e[3]<<8|e[4],n=(62&e[5])>>>1,a=1&e[5],o=e[6];if(e[7],1===a&&0===o)r=ii._initPmt(),r.program_number=s,r.version_number=n,ii.program_pmt_map_[s]=r;else if(r=ii.program_pmt_map_[s],null==r)return;r.pcr_pid=(31&e[8])<<8|e[9];let d=(15&e[10])<<8|e[11],l=12+d,c=i-9-d-4;for(let t=l;t0){for(let i=t+5;i0)for(let i=t+5;iii.has_video_&&ii.has_audio_?ii.video_init_segment_dispatched_&&ii.audio_init_segment_dispatched_:ii.has_video_&&!ii.has_audio_?ii.video_init_segment_dispatched_:!(ii.has_video_||!ii.has_audio_)&&ii.audio_init_segment_dispatched_,dispatchVideoInitSegment(){let e=ii.video_metadata_.details,t={type:"video"};t.id=ii.video_track_.id,t.timescale=1e3,t.duration=ii.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;let r=t.frameRate.fps_den,i=t.frameRate.fps_num;if(t.refSampleDuration=r/i*1e3,t.codec=e.codec_mimetype,ii.video_metadata_.vps){ni.isHevc=!0;let e=ii.video_metadata_.vps.data.subarray(4),r=ii.video_metadata_.sps.data.subarray(4),i=ii.video_metadata_.pps.data.subarray(4);t.hvcc=jr({vps:e,sps:r,pps:i}),0==ii.video_init_segment_dispatched_&&ni.debugLog(ii.TAG_NAME,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.hvcc&&ni.decodeVideo(t.hvcc,0,!0,0)}else{let e=ii.video_metadata_.sps.data.subarray(4),r=ii.video_metadata_.pps.data.subarray(4);t.avcc=Cr({sps:e,pps:r}),0==ii.video_init_segment_dispatched_&&ni.debugLog(ii.TAG_NAME,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.avcc&&ni.decodeVideo(t.avcc,0,!0,0)}ii.video_init_segment_dispatched_=!0,ii.video_metadata_changed_=!1;let s=ii.media_info_;s.hasVideo=!0,s.width=t.codecWidth,s.height=t.codecHeight,s.fps=t.frameRate.fps,s.profile=t.profile,s.level=t.level,s.refFrames=e.ref_frames,s.chromaFormat=e.chroma_format_string,s.sarNum=t.sarRatio.width,s.sarDen=t.sarRatio.height,s.videoCodec=t.codec,s.hasAudio&&s.audioCodec?s.mimeType=`video/mp2t; codecs="${s.videoCodec},${s.audioCodec}"`:s.mimeType=`video/mp2t; codecs="${s.videoCodec}"`},dispatchVideoMediaSegment(){ii.isInitSegmentDispatched()&&ii.video_track_.length&&ii._preDoDecode()},dispatchAudioMediaSegment(){ii.isInitSegmentDispatched()&&ii.audio_track_.length&&ii._preDoDecode()},dispatchAudioVideoMediaSegment(){ii.isInitSegmentDispatched()&&(ii.audio_track_.length||ii.video_track_.length)&&ii._preDoDecode()},parseADTSAACPayload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;if(ii.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+ii.aac_last_incomplete_data_.byteLength);t.set(ii.aac_last_incomplete_data_,0),t.set(e,ii.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/ii.timescale_),"aac"===ii.audio_metadata_.codec){if(null==t&&null!=ii.audio_last_sample_pts_)r=1024/ii.audio_metadata_.sampling_frequency*1e3,i=ii.audio_last_sample_pts_+r;else if(null==t)return void ni.debugWarn(ii.TAG_NAME,"AAC: Unknown pts");if(ii.aac_last_incomplete_data_&&ii.audio_last_sample_pts_){r=1024/ii.audio_metadata_.sampling_frequency*1e3;let e=ii.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(ni.debugWarn(ii.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let s,n=new Xt(e),a=null,o=i;for(;null!=(a=n.readNextAACFrame());){r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},ii.dispatchAudioInitSegment(e)):ii.detectAudioMetadataChange(e)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(e)),s=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let n={payload:i,length:i.byteLength,pts:t,dts:t,type:ne};ii.audio_track_.samples.push(n),ii.audio_track_.length+=i.byteLength,o+=r}n.hasIncompleteData()&&(ii.aac_last_incomplete_data_=n.getIncompleteData()),s&&(ii.audio_last_sample_pts_=s)},parseLOASAACPayload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;if(ii.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+ii.aac_last_incomplete_data_.byteLength);t.set(ii.aac_last_incomplete_data_,0),t.set(e,ii.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/ii.timescale_),"aac"===ii.audio_metadata_.codec){if(null==t&&null!=ii.audio_last_sample_pts_)r=1024/ii.audio_metadata_.sampling_frequency*1e3,i=ii.audio_last_sample_pts_+r;else if(null==t)return void ni.debugWarn(ii.TAG_NAME,"AAC: Unknown pts");if(ii.aac_last_incomplete_data_&&ii.audio_last_sample_pts_){r=1024/ii.audio_metadata_.sampling_frequency*1e3;let e=ii.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(ni.debugWarn(ii.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let s,n=new Zt(e),a=null,o=i;for(;null!=(a=n.readNextAACFrame(ar(this.loas_previous_frame)?void 0:this.loas_previous_frame));){ii.loas_previous_frame=a,r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},ii.dispatchAudioInitSegment(e)):ii.detectAudioMetadataChange(e)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(e)),s=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let n={payload:i,length:i.byteLength,pts:t,dts:t,type:ne};ii.audio_track_.samples.push(n),ii.audio_track_.length+=i.byteLength,o+=r}n.hasIncompleteData()&&(ii.aac_last_incomplete_data_=n.getIncompleteData()),s&&(ii.audio_last_sample_pts_=s)},parseAC3Payload(e,t){},parseEAC3Payload(e,t){},parseOpusPayload(e,t){},parseMP3Payload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;let r=[44100,48e3,32e3,0],i=[22050,24e3,16e3,0],s=[11025,12e3,8e3,0],n=e[1]>>>3&3,a=(6&e[1])>>1;e[2];let o=(12&e[2])>>>2,d=3!=(e[3]>>>6&3)?2:1,l=0,c=34;switch(n){case 0:l=s[o];break;case 2:l=i[o];break;case 3:l=r[o]}switch(a){case 1:c=34;break;case 2:c=33;break;case 3:c=32}const u={};u.object_type=c,u.sample_rate=l,u.channel_count=d,u.data=e;const h={codec:"mp3",data:u};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"mp3",object_type:c,sample_rate:l,channel_count:d},ii.dispatchAudioInitSegment(h)):ii.detectAudioMetadataChange(h)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(h));let f={payload:e,length:e.byteLength,pts:t/ii.timescale_,dts:t/ii.timescale_,type:ne};ii.audio_track_.samples.push(f),ii.audio_track_.length+=e.byteLength},detectAudioMetadataChange(e){if(e.codec!==ii.audio_metadata_.codec)return ni.debugLog(ii.TAG_NAME,`Audio: Audio Codecs changed from ${ii.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===ii.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==ii.audio_metadata_.audio_object_type)return ni.debugLog(ii.TAG_NAME,`AAC: AudioObjectType changed from ${ii.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==ii.audio_metadata_.sampling_freq_index)return ni.debugLog(ii.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==ii.audio_metadata_.channel_config)return ni.debugLog(ii.TAG_NAME,`AAC: Channel configuration changed from ${ii.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===ii.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==ii.audio_metadata_.sampling_frequency)return ni.debugLog(ii.TAG_NAME,`AC3: Sampling Frequency changed from ${ii.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==ii.audio_metadata_.bit_stream_identification)return ni.debugLog(ii.TAG_NAME,`AC3: Bit Stream Identification changed from ${ii.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==ii.audio_metadata_.bit_stream_mode)return ni.debugLog(ii.TAG_NAME,`AC3: BitStream Mode changed from ${ii.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==ii.audio_metadata_.channel_mode)return ni.debugLog(ii.TAG_NAME,`AC3: Channel Mode changed from ${ii.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==ii.audio_metadata_.low_frequency_effects_channel_on)return ni.debugLog(ii.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${ii.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===ii.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==ii.audio_metadata_.sample_rate)return ni.debugLog(ii.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==ii.audio_metadata_.channel_count)return ni.debugLog(ii.TAG_NAME,`Opus: Channel count changed from ${ii.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===ii.audio_metadata_.codec){const t=e.data;if(t.object_type!==ii.audio_metadata_.object_type)return ni.debugLog(ii.TAG_NAME,`MP3: AudioObjectType changed from ${ii.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==ii.audio_metadata_.sample_rate)return ni.debugLog(ii.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==ii.audio_metadata_.channel_count)return ni.debugLog(ii.TAG_NAME,`MP3: Channel count changed from ${ii.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1},dispatchAudioInitSegment(e){let t={type:"audio"};if(t.id=ii.audio_track_.id,t.timescale=1e3,t.duration=ii.duration_,"aac"===ii.audio_metadata_.codec){let r="aac"===e.codec?e.data:null,i=new Ns(r);t.audioSampleRate=i.sampling_rate,t.audioSampleRateIndex=i.sampling_index,t.channelCount=i.channel_count,t.codec=i.codec_mimetype,t.originalCodec=i.original_codec_mimetype,t.config=i.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale;const s=Wt({profile:ni._opt.mseDecodeAudio?i.object_type:i.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});ni.decodeAudio(s,0)}else"ac-3"===ii.audio_metadata_.codec||"ec-3"===ii.audio_metadata_.codec||"opus"===ii.audio_metadata_.codec||"mp3"===ii.audio_metadata_.codec&&(t.audioSampleRate=ii.audio_metadata_.sample_rate,t.channelCount=ii.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==ii.audio_init_segment_dispatched_&&ni.debugLog(ii.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),ii.audio_init_segment_dispatched_=!0,ii.video_metadata_changed_=!1;let r=ii.media_info_;r.hasAudio=!0,r.audioCodec=t.originalCodec,r.audioSampleRate=t.audioSampleRate,r.audioChannelCount=t.channelCount,r.hasVideo&&r.videoCodec?r.mimeType=`video/mp2t; codecs="${r.videoCodec},${r.audioCodec}"`:r.mimeType=`video/mp2t; codecs="${r.audioCodec}"`},dispatchPESPrivateDataDescriptor(e,t,r){},parsePESPrivateDataPayload(e,t,r,i,s){let n=new Ms;if(n.pid=i,n.stream_id=s,n.len=e.byteLength,n.data=e,null!=t){let e=Math.floor(t/ii.timescale_);n.pts=e}else n.nearest_pts=ii.getNearestTimestampMilliseconds();if(null!=r){let e=Math.floor(r/ii.timescale_);n.dts=e}},parseTimedID3MetadataPayload(e,t,r,i,s){ni.debugLog(ii.TAG_NAME,`Timed ID3 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${s}`)},parseSynchronousKLVMetadataPayload(e,t,r,i,s){ni.debugLog(ii.TAG_NAME,`Synchronous KLV Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${s}`)},parseAsynchronousKLVMetadataPayload(e,t,r){ni.debugLog(ii.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${r}`)},parseSMPTE2038MetadataPayload(e,t,r,i,s){ni.debugLog(ii.TAG_NAME,`SMPTE 2038 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${s}`)},getNearestTimestampMilliseconds:()=>null!=ii.audio_last_sample_pts_?Math.floor(ii.audio_last_sample_pts_):null!=ii.last_pcr_?Math.floor(ii.last_pcr_/300/ii.timescale_):void 0,_preDoDecode(){const e=ii.video_track_,t=ii.audio_track_;let r=e.samples;t.samples.length>0&&(r=e.samples.concat(t.samples),r=r.sort(((e,t)=>e.dts-t.dts))),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===ae?ii._doDecodeVideo({...e,payload:t}):e.type===ne&&ii._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0},_doDecodeVideo(e){const t=new Uint8Array(e.payload);let r=null;r=e.isHevc?Yr(t,e.isIFrame):Lr(t,e.isIFrame),e.isIFrame&&ni.calcIframeIntervalTimestamp(e.dts);let i=ni.cryptoPayload(r,e.isIFrame);ni.decode(i,{type:ae,ts:e.dts,isIFrame:e.isIFrame,cts:e.cts})},_doDecodeAudio(e){const t=new Uint8Array(e.payload);let r=t;_r(ni._opt.m7sCryptoAudio)&&(r=ni.cryptoPayloadAudio(t)),ni.decode(r,{type:ne,ts:e.dts,isIFrame:!1,cts:0})}},si=null;yr()&&(si={TAG_NAME:"worker MediaSource",_resetInIt(){si.isAvc=null,si.isAAC=null,si.videoInfo={},si.videoMeta={},si.audioMeta={},si.sourceBuffer=null,si.audioSourceBuffer=null,si.hasInit=!1,si.hasAudioInit=!1,si.isAudioInitInfo=!1,si.videoMimeType="",si.audioMimeType="",si.cacheTrack={},si.cacheAudioTrack={},si.timeInit=!1,si.sequenceNumber=0,si.audioSequenceNumber=0,si.firstRenderTime=null,si.firstAudioTime=null,si.mediaSourceAppendBufferFull=!1,si.mediaSourceAppendBufferError=!1,si.mediaSourceAddSourceBufferError=!1,si.mediaSourceBufferError=!1,si.mediaSourceError=!1,si.prevTimestamp=null,si.decodeDiffTimestamp=null,si.prevDts=null,si.prevAudioDts=null,si.prevPayloadBufferSize=0,si.isWidthOrHeightChanged=!1,si.prevTs=null,si.prevAudioTs=null,si.eventListenList=[],si.pendingRemoveRanges=[],si.pendingSegments=[],si.pendingAudioRemoveRanges=[],si.pendingAudioSegments=[],si.supportVideoFrameCallbackHandle=null,si.audioSourceBufferCheckTimeout=null,si.audioSourceNoDataCheckTimeout=null,si.hasPendingEos=!1,si.$video={currentTime:0,readyState:0}},init(){si.events=new hs,si._resetInIt(),si.mediaSource=new self.MediaSource,si.isDecodeFirstIIframe=!!gr(ni._opt.checkFirstIFrame),si._bindMediaSourceEvents()},destroy(){si.stop(),si._clearAudioSourceBufferCheckTimeout(),si.eventListenList&&si.eventListenList.length&&(si.eventListenList.forEach((e=>e())),si.eventListenList=[]),si._resetInIt(),si.mediaSource=null},getState:()=>si.mediaSource&&si.mediaSource.readyState,isStateOpen:()=>si.getState()===yt,isStateClosed:()=>si.getState()===vt,isStateEnded:()=>si.getState()===gt,_bindMediaSourceEvents(){const{proxy:e}=si.events,t=e(si.mediaSource,wt,(()=>{ni.debugLog(si.TAG_NAME,"sourceOpen"),si._onMediaSourceSourceOpen()})),r=e(si.mediaSource,bt,(()=>{ni.debugLog(si.TAG_NAME,"sourceClose")})),i=e(si.mediaSource,St,(()=>{ni.debugLog(si.TAG_NAME,"sourceended")}));si.eventListenList.push(t,r,i)},_onMediaSourceSourceOpen(){si.sourceBuffer||(ni.debugLog(si.TAG_NAME,"onMediaSourceSourceOpen() sourceBuffer is null and next init"),si._initSourceBuffer()),si.audioSourceBuffer||(ni.debugLog(si.TAG_NAME,"onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),si._initAudioSourceBuffer()),si._hasPendingSegments()&&si._doAppendSegments()},decodeVideo(e,t,r,i){if(ni.isDestroyed)ni.debugWarn(si.TAG_NAME,"decodeVideo() and decoder is destroyed");else if(gr(si.hasInit))if(r&&e[1]===Ut){const i=15&e[0];if(i===Pe&&gr(ni._opt.supportMSEDecodeHevc))return void si.emitError(Le.mediaSourceH265NotSupport);si.videoInfo.codec=i,postMessage({cmd:P,code:i});const s=new Uint8Array(e);postMessage({cmd:M,buffer:s,codecId:i},[s.buffer]),si.hasInit=si._decodeConfigurationRecord(e,t,r,i)}else ni.debugWarn(si.TAG_NAME,`decodeVideo has not init , isIframe is ${r} , payload is ${e[1]} so drop this frame`);else if(!si.isDecodeFirstIIframe&&r&&(si.isDecodeFirstIIframe=!0),si.isDecodeFirstIIframe){if(r&&0===e[1]){const t=15&e[0];let r={};t===Fe?r=kr(e.slice(5)):t===Pe&&(r=Hr(e));const i=si.videoInfo;i&&i.codecWidth&&i.codecWidth&&r&&r.codecWidth&&r.codecHeight&&(r.codecWidth!==i.codecWidth||r.codecHeight!==i.codecWidth)&&(ni.debugWarn(si.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${i.codecWidth}, old height is ${i.codecHeight},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),si.isWidthOrHeightChanged=!0,si.emitError(Le.mseWidthOrHeightChange,`width: ${i.codecWidth}->${r.codecWidth}, height: ${i.codecWidth}->${r.codecHeight}`))}if(si.isWidthOrHeightChanged)return void ni.debugWarn(si.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(mr(e))return void ni.debugLog(si.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLengthsi.prevTs>0&&eE,_decodeConfigurationRecord(e,t,r,i){let s=e.slice(5),n={};if(i===Fe?n=kr(s):i===Pe&&(n=Vr(s)),si.videoInfo.width=n.codecWidth,si.videoInfo.height=n.codecHeight,0===n.codecWidth&&0===n.codecHeight)return ni.debugWarn(si.TAG_NAME,"_decodeConfigurationRecord error",JSON.stringify(n)),si.emitError(Le.mediaSourceDecoderConfigurationError,`width is ${0===n.codecWidth} and height is ${n.codecHeight}`),!1;const a={id:Lt,type:"video",timescale:1e3,duration:0,avcc:s,codecWidth:n.codecWidth,codecHeight:n.codecHeight,videoType:n.videoType},o=fs.generateInitSegment(a);si.isAvc=i===Fe;let d=n.codec;return si.videoMimeType=d?`video/mp4; codecs="${n.codec}"`:si.isAvc?mt:_t,postMessage({cmd:k,w:n.codecWidth,h:n.codecHeight}),si._initSourceBuffer(),si.appendBuffer(o.buffer),si.sequenceNumber=0,si.cacheTrack={},si.timeInit=!1,!0},_decodeAudioConfigurationRecord(e,t){const r=e[0]>>4,i=e[0]>>1&1,s=r===$e,n=r===Ne;if(gr(n||s))return ni.debugWarn(si.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${r} ant auto wasm decode`),si.emitError(Le.mediaSourceAudioG711NotSupport),!1;const a={id:It,type:"audio",timescale:1e3};let o={};if(jt(e)){if(o=Kt(e.slice(2)),!o)return!1;a.audioSampleRate=o.sampleRate,a.channelCount=o.channelCount,a.config=o.config,a.refSampleDuration=1024/a.audioSampleRate*a.timescale}else{if(!s)return!1;if(o=Ss(e),!o)return!1;a.audioSampleRate=o.samplingRate,a.channelCount=o.channelCount,a.refSampleDuration=1152/a.audioSampleRate*a.timescale}a.codec=o.codec,a.duration=0;let d="mp4",l=o.codec,c=null;s&&gr(ni._opt.isFirefox)?(d="mpeg",l="",c=new Uint8Array):c=fs.generateInitSegment(a);let u=`${a.type}/${d}`;return l&&l.length>0&&(u+=`;codecs=${l}`),gr(si.isAudioInitInfo)&&(wr=r===Ne?i?16:8:0===i?8:16,postMessage({cmd:L,code:r}),postMessage({cmd:D,sampleRate:a.audioSampleRate,channels:a.channelCount,depth:wr}),si.isAudioInitInfo=!0),si.audioMimeType=u,si.isAAC=n,si._initAudioSourceBuffer(),si.appendAudioBuffer(c.buffer),!0},_initSourceBuffer(){const{proxy:e}=si.events;if(null===si.sourceBuffer&&null!==si.mediaSource&&si.isStateOpen()&&si.videoMimeType){try{ni.debugLog(si.TAG_NAME,"_initSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",si.videoMimeType),si.sourceBuffer=si.mediaSource.addSourceBuffer(si.videoMimeType)}catch(e){return ni.debugError(si.TAG_NAME,"_initSourceBuffer() appendBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),si.emitError(Le.mseWorkerAddSourceBufferError,e.code),void(si.mediaSourceAddSourceBufferError=!0)}if(si.sourceBuffer){const t=e(si.sourceBuffer,"error",(e=>{si.mediaSourceBufferError=!0,ni.debugError(si.TAG_NAME,"mseSourceBufferError mseDecoder.sourceBuffer",e,e.toString()),si.emitError(Le.mseSourceBufferError,e.code)})),r=e(si.sourceBuffer,"updateend",(()=>{si._hasPendingRemoveRanges()?si._doRemoveRanges():si._hasPendingSegments()?si._doAppendSegments():si.hasPendingEos&&(ni.debugLog(si.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),si.endOfStream())}));si.eventListenList.push(t,r)}}else ni.debugLog(si.TAG_NAME,`_initSourceBuffer and mseDecoder.isStateOpen is ${si.isStateOpen()} and mseDecoder.isAvc === null is ${null===si.isAvc}`)},_initAudioSourceBuffer(){const{proxy:e}=si.events;if(null===si.audioSourceBuffer&&null!==si.mediaSource&&si.isStateOpen()&&si.audioMimeType){try{ni.debugLog(si.TAG_NAME,"_initAudioSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",si.audioMimeType),si._clearAudioSourceBufferCheckTimeout(),si.audioSourceBuffer=si.mediaSource.addSourceBuffer(si.audioMimeType)}catch(e){return ni.debugError(si.TAG_NAME,"_initAudioSourceBuffer() addSourceBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),si.emitError(Le.mseWorkerAddSourceBufferError,e.code),void(si.mediaSourceAddSourceBufferError=!0)}if(si.audioSourceBuffer){const t=e(si.audioSourceBuffer,"error",(e=>{si.mediaSourceBufferError=!0,ni.debugError(si.TAG_NAME,"mseSourceBufferError mseDecoder.audioSourceBuffer",e.code,e.toString(),e),si.emitError(Le.mseSourceBufferError,e.code)})),r=e(si.audioSourceBuffer,"updateend",(()=>{si._hasPendingRemoveRanges()?si._doRemoveRanges():si._hasPendingSegments()?si._doAppendSegments():si.hasPendingEos&&(ni.debugLog(si.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),si.endOfStream())}));si.eventListenList.push(t,r),null===si.audioSourceNoDataCheckTimeout&&(si.audioSourceNoDataCheckTimeout=setTimeout((()=>{si._clearAudioNoDataCheckTimeout(),si.emitError(Le.mediaSourceAudioNoDataTimeout)}),1e3))}}else ni.debugLog(si.TAG_NAME,`_initAudioSourceBuffer and mseDecoder.isStateOpen is ${si.isStateOpen()} and mseDecoder.audioMimeType is ${si.audioMimeType}`)},_decodeVideo(e,t,r,i,s){let n=e.slice(5),a=n.byteLength;if(0===a)return void ni.debugWarn(si.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let o=(new Date).getTime(),d=!1;si.prevTimestamp||(si.prevTimestamp=o,d=!0);const l=o-si.prevTimestamp;if(si.decodeDiffTimestamp=l,l>1e3&&!d&&ni.isPlayer&&ni.debugLog(si.TAG_NAME,`_decodeVideo now time is ${o} and prev time is ${si.prevTimestamp}, diff time is ${l} ms`),si.cacheTrack.id&&t>=si.cacheTrack.dts){let e=8+si.cacheTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(fs.types.mdat,4),r.set(si.cacheTrack.data,8),si.cacheTrack.duration=t-si.cacheTrack.dts;let i=fs.moof(si.cacheTrack,si.cacheTrack.dts);si.cacheTrack={};let s=new Uint8Array(i.byteLength+r.byteLength);s.set(i,0),s.set(r,i.byteLength),si.appendBuffer(s.buffer)}else ni.debugLog(si.TAG_NAME,`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${s} cacheTrack dts is ${si.cacheTrack&&si.cacheTrack.dts}`),si.timeInit=!1,si.cacheTrack={};si.cacheTrack||(si.cacheTrack={}),si.cacheTrack.id=Lt,si.cacheTrack.sequenceNumber=++si.sequenceNumber,si.cacheTrack.size=a,si.cacheTrack.dts=t,si.cacheTrack.cts=i,si.cacheTrack.isKeyframe=r,si.cacheTrack.data=n,si.cacheTrack.flags={isLeading:0,dependsOn:r?2:1,isDependedOn:r?1:0,hasRedundancy:0,isNonSync:r?0:1},si.prevTimestamp=(new Date).getTime()},_decodeAudio(e,t,r){let i=si.isAAC?e.slice(2):e.slice(1),s=i.byteLength;if(si.cacheAudioTrack.id&&t>=si.cacheAudioTrack.dts){let e=8+si.cacheAudioTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(fs.types.mdat,4),r.set(si.cacheAudioTrack.data,8),si.cacheAudioTrack.duration=t-si.cacheAudioTrack.dts;let i=fs.moof(si.cacheAudioTrack,si.cacheAudioTrack.dts);si.cacheAudioTrack={};let s=new Uint8Array(i.byteLength+r.byteLength);s.set(i,0),s.set(r,i.byteLength),si.appendAudioBuffer(s.buffer)}else si.cacheAudioTrack={};si.cacheAudioTrack||(si.cacheAudioTrack={}),si.cacheAudioTrack.id=It,si.cacheAudioTrack.sequenceNumber=++si.audioSequenceNumber,si.cacheAudioTrack.size=s,si.cacheAudioTrack.dts=t,si.cacheAudioTrack.cts=0,si.cacheAudioTrack.data=i,si.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}},appendBuffer(e){ni.isDestroyed?ni.debugWarn(si.TAG_NAME,"appendBuffer() player is destroyed"):si.mediaSourceAddSourceBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):si.mediaSourceAppendBufferFull?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):si.mediaSourceAppendBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):si.mediaSourceBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(si.pendingSegments.push(e),si.sourceBuffer&&(ni._opt.mseAutoCleanupSourceBuffer&&si._needCleanupSourceBuffer()&&si._doCleanUpSourceBuffer(),gr(si.getSourceBufferUpdating())&&si.isStateOpen()&&gr(si._hasPendingRemoveRanges()))?si._doAppendSegments():si.isStateClosed()?(si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):si.isStateEnded()&&(si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,"mediaSource is end")))},appendAudioBuffer(e){ni.isDestroyed?ni.debugWarn(si.TAG_NAME,"appendAudioBuffer() player is destroyed"):si.mediaSourceAddSourceBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):si.mediaSourceAppendBufferFull?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):si.mediaSourceAppendBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):si.mediaSourceBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(si.pendingAudioSegments.push(e),si.audioSourceBuffer&&(ni._opt.mseAutoCleanupSourceBuffer&&si._needCleanupSourceBuffer()&&si._doCleanUpSourceBuffer(),gr(si.getAudioSourceBufferUpdating())&&si.isStateOpen()&&gr(si._hasPendingRemoveRanges()))?si._doAppendSegments():si.isStateClosed()?(si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):si.isStateEnded()&&(si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,"mediaSource is end")))},getSourceBufferUpdating:()=>si.sourceBuffer&&si.sourceBuffer.updating,getAudioSourceBufferUpdating:()=>si.audioSourceBuffer&&si.audioSourceBuffer.updating,stop(){si.abortSourceBuffer(),si.removeSourceBuffer(),si.endOfStream()},clearUpAllSourceBuffer(){if(si.sourceBuffer){const e=si.sourceBuffer.buffered;for(let t=0;tsi.pendingSegments.length>0||si.pendingAudioSegments.length>0,getPendingSegmentsLength:()=>si.pendingSegments.length,_handleUpdatePlaybackRate(){},_doAppendSegments(){if(si.isStateClosed()||si.isStateEnded())ni.debugLog(si.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==si.sourceBuffer){if(si.needInitAudio()&&null===si.audioSourceBuffer)return ni.debugLog(si.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===si.audioSourceBufferCheckTimeout&&(si.audioSourceBufferCheckTimeout=setTimeout((()=>{si._clearAudioSourceBufferCheckTimeout(),si.emitError(Le.mediaSourceAudioInitTimeout)}),1e3)));if(gr(si.getSourceBufferUpdating())&&si.pendingSegments.length>0){const e=si.pendingSegments.shift();try{si.sourceBuffer.appendBuffer(e)}catch(e){ni.debugError(si.TAG_NAME,"mseDecoder.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(si.stop(),si.mediaSourceAppendBufferFull=!0,si.emitError(Le.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(si.stop(),si.mediaSourceAppendBufferError=!0,si.emitError(Le.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(si.stop(),si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,`code is ${e.code} , message is ${e.message}`))}}if(gr(si.getAudioSourceBufferUpdating())&&si.pendingAudioSegments.length>0){const e=si.pendingAudioSegments.shift();try{si.audioSourceBuffer.appendBuffer(e)}catch(e){ni.debugError(si.TAG_NAME,"mseDecoder.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(si.stop(),si.mediaSourceAppendBufferFull=!0,si.emitError(Le.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(si.stop(),si.mediaSourceAppendBufferError=!0,si.emitError(Le.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(si.stop(),si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,e.code,`code is ${e.code} , message is ${e.message}`))}}}else ni.debugLog(si.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")},_doCleanUpSourceBuffer(){const e=si.$video.currentTime;if(si.sourceBuffer){const t=si.sourceBuffer.buffered;let r=!1;for(let i=0;i=ni._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-ni._opt.mseAutoCleanupMinBackwardDuration;si.pendingRemoveRanges.push({start:s,end:t})}}else n=ni._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-ni._opt.mseAutoCleanupMinBackwardDuration;si.pendingAudioRemoveRanges.push({start:s,end:t})}}else nsi.pendingRemoveRanges.length>0||si.pendingAudioRemoveRanges.length>0,needInitAudio:()=>ni._opt.hasAudio&&ni._opt.mseDecodeAudio,_doRemoveRanges(){if(si.sourceBuffer&&gr(si.getSourceBufferUpdating())){let e=si.pendingRemoveRanges;for(;e.length&&gr(si.getSourceBufferUpdating());){let t=e.shift();try{si.sourceBuffer.remove(t.start,t.end)}catch(e){ni.debugWarn(si.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e,e.toString())}}}if(si.audioSourceBuffer&&gr(si.getAudioSourceBufferUpdating())){let e=si.pendingAudioRemoveRanges;for(;e.length&&gr(si.getAudioSourceBufferUpdating());){let t=e.shift();try{si.audioSourceBuffer.remove(t.start,t.end)}catch(e){ni.debugWarn(si.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e,e.toString())}}}},_getPlaybackRate(){},_needCleanupSourceBuffer(){if(gr(ni._opt.mseAutoCleanupSourceBuffer))return!1;const e=si.$video.currentTime;if(si.sourceBuffer){let t=si.sourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=ni._opt.mseAutoCleanupMaxBackwardDuration)return!0}if(si.audioSourceBuffer){let t=si.audioSourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=ni._opt.mseAutoCleanupMaxBackwardDuration)return!0}return!1},_clearAudioSourceBufferCheckTimeout(){si.audioSourceBufferCheckTimeout&&(clearTimeout(si.audioSourceBufferCheckTimeout),si.audioSourceBufferCheckTimeout=null)},_clearAudioNoDataCheckTimeout(){si.audioSourceNoDataCheckTimeout&&(clearTimeout(si.audioSourceNoDataCheckTimeout),si.audioSourceNoDataCheckTimeout=null)},getHandle:()=>si.mediaSource.handle,emitError(e){postMessage({cmd:se,value:e,msg:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""})}});let ni={isPlayer:!0,isHevc:null,isPlayback:!1,dropping:!1,isPushDropping:!1,isWorkerFetch:!1,isDestroyed:!1,fetchStatus:Tt,_opt:xr(),mp3Demuxer:null,delay:-1,pushLatestDelay:-1,firstTimestamp:null,startTimestamp:null,preDelayTimestamp:null,stopId:null,streamFps:null,streamAudioFps:null,streamVideoFps:null,writableStream:null,networkDelay:0,webglObj:null,startStreamRateAndStatsInterval:function(){ni.stopStreamRateAndStatsInterval(),l=setInterval((()=>{d&&d(0);const e=JSON.stringify({demuxBufferDelay:ni.getVideoBufferLength(),audioDemuxBufferDelay:ni.getAudioBufferLength(),streamBufferByteLength:ni.getStreamBufferLength(),netBuf:ni.networkDelay||0,pushLatestDelay:ni.pushLatestDelay||0,latestDelay:ni.delay,isStreamTsMoreThanLocal:Ze,wasmDecodeDelay:Se-We});postMessage({cmd:O,type:Te,value:e})}),1e3)},stopStreamRateAndStatsInterval:function(){l&&(clearInterval(l),l=null)},useOffscreen:function(){return ni._opt.useOffscreen&&"undefined"!=typeof OffscreenCanvas},getDelay:function(e,t){if(!e||ni._opt.hasVideo&&!we)return-1;if(t===ne)return ni.delay;if(ni.preDelayTimestamp&&ni.preDelayTimestamp>e)return ni.preDelayTimestamp-e>1e3&&ni.debugWarn("worker",`getDelay() and preDelayTimestamp is ${ni.preDelayTimestamp} > timestamp is ${e} more than ${ni.preDelayTimestamp-e}ms and return ${ni.delay}`),ni.preDelayTimestamp=e,ni.delay;if(ni.firstTimestamp){if(e){const t=Date.now()-ni.startTimestamp,r=e-ni.firstTimestamp;t>=r?(Ze=!1,ni.delay=t-r):(Ze=!0,ni.delay=r-t)}}else ni.firstTimestamp=e,ni.startTimestamp=Date.now(),ni.delay=-1;return ni.preDelayTimestamp=e,ni.delay},getDelayNotUpdateDelay:function(e,t){if(!e||ni._opt.hasVideo&&!we)return-1;if(t===ne)return ni.pushLatestDelay;if(ni.preDelayTimestamp&&ni.preDelayTimestamp-e>1e3)return ni.debugWarn("worker",`getDelayNotUpdateDelay() and preDelayTimestamp is ${ni.preDelayTimestamp} > timestamp is ${e} more than ${ni.preDelayTimestamp-e}ms and return -1`),-1;if(ni.firstTimestamp){let t=-1;if(e){const r=Date.now()-ni.startTimestamp,i=e-ni.firstTimestamp;r>=i?(Ze=!1,t=r-i):(Ze=!0,t=i-r)}return t}return-1},resetDelay:function(){ni.firstTimestamp=null,ni.startTimestamp=null,ni.delay=-1,ni.dropping=!1},resetAllDelay:function(){ni.resetDelay(),ni.preDelayTimestamp=null},doDecode:function(e){ni._opt.isEmitSEI&&e.type===ae&&ni.isWorkerFetch&&ni.findSei(e.payload,e.ts),ni.isPlayUseMSEAndDecoderInWorker()?e.type===ne?ni._opt.mseDecodeAudio?si.decodeAudio(e.payload,e.ts):e.decoder.decode(e.payload,e.ts):e.type===ae&&si.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):ni._opt.useWCS&&ni.useOffscreen()&&e.type===ae&&n.decode?n.decode(e.payload,e.ts,e.cts):e.decoder.decode(e.payload,e.ts,e.isIFrame,e.cts)},decodeNext(e){if(0===i.length)return;const t=e.ts,s=i[0],n=e.type===ae&&mr(e.payload);if(gr(r))n&&(ni.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${s.type} ts is ${s.ts}\n isVideoSqeHeader is ${n}`),i.shift(),ni.doDecode(s));else{const r=s.ts-t,a=s.type===ne&&e.type===ae;(r<=20||a||n)&&(ni.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${s.type} ts is ${s.ts}\n diff is ${r} and isVideoAndNextAudio is ${a} and isVideoSqeHeader is ${n}`),i.shift(),ni.doDecode(s))}},init:function(){ni.debugLog("worker","init and opt is",JSON.stringify(ni._opt));const e=ni._opt.playType===y,t=ni._opt.playType===v;if(Gr.init(),ni.isPlayer=e,ni.isPlayback=t,ni.isPlayUseMSEAndDecoderInWorker()&&si&&si.init(),n&&ni._opt.useWCS&&ni.useOffscreen()&&n.init(),gr(ni.isPlaybackCacheBeforeDecodeForFpsRender())){ni.debugLog("worker","setInterval()");const t=()=>{const t=ni._opt.videoBuffer+ni._opt.videoBufferDelay;let r=null;if(i.length){if(ni.isPushDropping)return void ni.debugWarn("worker",`loop() isPushDropping is true and bufferList length is ${i.length}`);if(ni.dropping){for(r=i.shift(),ni.debugWarn("worker",`loop() dropBuffer is dropping and isIFrame ${r.isIFrame} and delay is ${ni.delay} and bufferlist is ${i.length}`);!r.isIFrame&&i.length;)r=i.shift();const e=ni.getDelayNotUpdateDelay(r.ts,r.type);r.isIFrame&&e<=ni.getNotDroppingDelayTs()&&(ni.debugLog("worker","loop() is dropping = false, is iFrame"),ni.dropping=!1,ni.doDecode(r),ni.decodeNext(r))}else if(ni.isPlayback||ni.isPlayUseMSE()||0===ni._opt.videoBuffer)for(;i.length;)r=i.shift(),ni.doDecode(r);else if(r=i[0],-1===ni.getDelay(r.ts,r.type))ni.debugLog("worker","loop() common dumex delay is -1 ,data.ts is",r.ts),i.shift(),ni.doDecode(r),ni.decodeNext(r);else if(ni.delay>t&&e)ni.hasIframeInBufferList()?(ni.debugLog("worker",`delay is ${ni.delay} > maxDelay ${t}, set dropping is true`),ni.resetAllDelay(),ni.dropping=!0,postMessage({cmd:$})):(i.shift(),ni.doDecode(r),ni.decodeNext(r));else for(;i.length;){if(r=i[0],!(ni.getDelay(r.ts,r.type)>ni._opt.videoBuffer)){ni.delay<0&&ni.debugWarn("worker",`loop() do not decode and delay is ${ni.delay}, bufferList is ${i.length}`);break}i.shift(),ni.doDecode(r)}}else-1!==ni.delay&&ni.debugLog("worker","loop() bufferList is empty and reset delay"),ni.resetAllDelay()};ni.stopId=setInterval((()=>{let e=(new Date).getTime();Je||(Je=e);const r=e-Je;r>100&&ni.debugWarn("worker",`loop demux diff time is ${r}`),t(),Je=(new Date).getTime()}),20)}else ni.debugLog("worker","playback and playbackIsCacheBeforeDecodeForFpsRender is true");if(gr(ni._opt.checkFirstIFrame)&&(we=!0),ni.isPlayUseMSEAndDecoderInWorker()&&si){const e=si.getHandle();e&&postMessage({cmd:re,mseHandle:e},[e])}},playbackCacheLoop:function(){ni.clearPlaybackCacheLoop();const e=()=>{let e=null;i.length&&(e=i.shift(),ni.doDecode(e))};e();const t=Math.ceil(1e3/(ni.streamFps*ni._opt.playbackRate));ni.debugLog("worker",`playbackCacheLoop fragDuration is ${t}, streamFps is ${ni.streamFps}, streamAudioFps is ${ni.streamAudioFps} ,streamVideoFps is ${ni.streamVideoFps} playbackRate is ${ni._opt.playbackRate}`),ni.stopId=setInterval(e,t)},clearPlaybackCacheLoop:function(){ni.stopId&&(clearInterval(ni.stopId),ni.stopId=null)},startPlaybackCacheLoop:function(){ni.playbackCacheLoop()},close:function(){if(ni.debugLog("worker","close"),ni.isDestroyed=!0,Or(),!o||1!==o.readyState&&2!==o.readyState?o&&ni.debugLog("worker",`close() and socket.readyState is ${o.readyState}`):(Sr=!0,o.close(1e3,"Client disconnecting")),o=null,ni.stopStreamRateAndStatsInterval(),ni.stopId&&(clearInterval(ni.stopId),ni.stopId=null),ni.mp3Demuxer&&(ni.mp3Demuxer.destroy(),ni.mp3Demuxer=null),ni.writableStream&&gr(ni.writableStream.locked)&&ni.writableStream.close().catch((e=>{ni.debugLog("worker","close() and writableStream.close() error",e.toString(),e)})),ni.writableStream=null,ai)try{ai.clear&&ai.clear(),ai=null}catch(e){ni.debugLog("worker","close() and audioDecoder.clear error",e.toString(),e)}if(oi)try{oi.clear&&oi.clear(),oi=null}catch(e){ni.debugLog("worker","close() and videoDecoder.clear error",e.toString())}d=null,Je=null,Ze=!1,Se=0,We=0,n&&(n.destroy&&n.destroy(),n=null),si&&(si.destroy(),si=null),ni.firstTimestamp=null,ni.startTimestamp=null,ni.networkDelay=0,ni.streamFps=null,ni.streamAudioFps=null,ni.streamVideoFps=null,ni.delay=-1,ni.pushLatestDelay=-1,ni.preDelayTimestamp=null,ni.dropping=!1,ni.isPushDropping=!1,ni.isPlayer=!0,ni.isPlayback=!1,ni.isWorkerFetch=!1,ni.isHevc=null,ni._opt=xr(),ni.webglObj&&(ni.webglObj.destroy(),ni.offscreenCanvas.removeEventListener("webglcontextlost",ni.onOffscreenCanvasWebglContextLost),ni.offscreenCanvas.removeEventListener("webglcontextrestored",ni.onOffscreenCanvasWebglContextRestored),ni.offscreenCanvas=null,ni.offscreenCanvasGL=null,ni.offscreenCanvasCtx=null),i=[],s=[],c&&(c.close(),c=null),h=null,w=null,S=!1,U=!1,we=!1,Yt=!1,Jt=!1,sr=!1,br=null,ct=[],xt=0,Nt=0,et=null,rt=null,Ot=null,Gt=null,wr=null,$t=0,Ht=0,Et=null,At=null,ni.fetchStatus=Tt,Er=!0,Gr.destroy(),Wr.destroy(),ri.destroy(),ii.destroy(),ni.debug=null,ni._opt={},postMessage({cmd:Y})},pushBuffer:function(e,t){if(t.type===ne&&jt(e)){if(ni.debugLog("worker",`pushBuffer audio ts is ${t.ts}, isAacCodecPacket is true`),ni._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:J,buffer:t},[t.buffer])}ni.decodeAudio(e,t.ts)}else if(t.type===ae&&t.isIFrame&&mr(e)){if(ni.debugLog("worker",`pushBuffer video ts is ${t.ts}, isVideoSequenceHeader is true`),ni._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:Q,buffer:t},[t.buffer])}ni.decodeVideo(e,t.ts,t.isIFrame,t.cts)}else{if(ni._opt.isRecording)if(ni._opt.isRecordTypeFlv){const r=new Uint8Array(e);postMessage({cmd:ee,type:t.type,buffer:r,ts:t.ts},[r.buffer])}else if(ni._opt.recordType===b)if(t.type===ae){const r=new Uint8Array(e).slice(5);postMessage({cmd:R,buffer:r,isIFrame:t.isIFrame,ts:t.ts,cts:t.cts},[r.buffer])}else if(t.type===ne&&ni._opt.isWasmMp4){const r=new Uint8Array(e),i=qt(r)?r.slice(2):r.slice(1);postMessage({cmd:I,buffer:i,ts:t.ts},[i.buffer])}if(ni.isPlayer){if(t.type===ae){if($t>0){const e=t.ts-Gt,r=$t+$t/2;e>r&&ni.debugLog("worker",`pushBuffer video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts}, preTs is ${Gt},\n diff is ${e} and preTsDuration is ${$t} and maxDiff is ${r}\n maybe trigger black screen or flower screen\n `)}if(null!==Gt&&Gt>=t.ts&&(ni.debugWarn("worker",`pushBuffer() and isIFrame is ${t.isIFrame} and,\n options.ts is ${t.ts} less than (or equal) preTs is ${Gt} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${Ht}`),Gt-t.ts>E&&(ni.debugWarn("worker",`pushBuffer,\n preTimestamp is ${Gt}, options.ts is ${t.ts},\n diff is ${Gt-t.ts} more than 3600000,\n and resetAllDelay`),ni.resetAllDelay(),Gt=null,$t=0),ni._opt.isDropSameTimestampGop&&gr(t.isIFrame)&&we)){const e=ni.hasIframeInBufferList(),t=gr(ni.isPushDropping);return ni.debugLog("worker",`pushBuffer, isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next dropBuffer`),void(e&&t?ni.dropBuffer$2():(ni.clearBuffer(!0),_r(ni._opt.checkFirstIFrame)&&_r(r)&&(ni.isPlayUseMSEAndDecoderInWorker()?si.isDecodeFirstIIframe=!1:postMessage({cmd:te}))))}Gt>0&&($t=t.ts-Gt),Ht=e.byteLength,Gt=t.ts}if(we){const e=ni._opt.videoBuffer+ni._opt.videoBufferDelay,r=ni.getDelayNotUpdateDelay(t.ts,t.type);ni.pushLatestDelay=r,ni.delay>0&&r>e&&ni.delay({type:e.type,ts:e.ts})));ni.debugLog("worker",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${i.length}, and ts list is ${JSON.stringify(r)}`)}const r=ni.getAudioBufferLength()>0,s=r?60:40;i.length>=s&&(ni.debugWarn("worker",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${i.length} more than ${s}, and hasAudio is ${r} an set streamFps is 25`),ni.streamVideoFps=25,postMessage({cmd:V,value:ni.streamVideoFps}),r?(ni.streamAudioFps=25,ni.streamFps=ni.streamVideoFps+ni.streamAudioFps):ni.streamFps=ni.streamVideoFps,ni.playbackCacheLoop())}}},getVideoBufferLength(){let e=0;return i.forEach((t=>{t.type===ae&&(e+=1)})),e},hasIframeInBufferList:()=>i.some((e=>e.type===ae&&e.isIFrame)),isAllIframeInBufferList(){const e=ni.getVideoBufferLength();let t=0;return i.forEach((e=>{e.type===ae&&e.isIFrame&&(t+=1)})),e===t},getNotDroppingDelayTs:()=>ni._opt.videoBuffer+ni._opt.videoBufferDelay/2,getAudioBufferLength(){let e=0;return i.forEach((t=>{t.type===ne&&(e+=1)})),e},getStreamBufferLength(){let e=0;return c&&c.buffer&&(e=c.buffer.byteLength),ni._opt.isNakedFlow?Gr.lastBuf&&(e=Gr.lastBuf.byteLength):ni._opt.isTs?ii._remainingPacketData&&(e=ii._remainingPacketData.byteLength):ni._opt.isFmp4&&Wr.mp4Box&&(e=Wr.mp4Box.getAllocatedSampleDataSize()),e},fetchStream:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(ni.debugLog("worker","fetchStream, url is "+e,"options:",JSON.stringify(t)),ni.isWorkerFetch=!0,t.isFlv?ni._opt.isFlv=!0:t.isFmp4?ni._opt.isFmp4=!0:t.isMpeg4?ni._opt.isMpeg4=!0:t.isNakedFlow?ni._opt.isNakedFlow=!0:t.isTs&&(ni._opt.isTs=!0),d=nr((e=>{postMessage({cmd:O,type:Ae,value:e})})),ni.startStreamRateAndStatsInterval(),t.isFmp4&&(Wr.listenMp4Box(),ni._opt.isFmp4Private&&Wr.initTransportDescarmber()),t.protocol===m){t.isFlv&&(c=new Ar(ni.demuxFlv())),a=new AbortController;const r=Object.assign({signal:a.signal},{headers:t.options&&t.options.headers||{}});fetch(e,r).then((e=>{if(_r(Sr))return ni.debugLog("worker","request abort and run res.body.cancel()"),ni.fetchStatus=Tt,void e.body.cancel();if(!fr(e))return ni.debugWarn("worker",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),Or(),void postMessage({cmd:O,type:Le.fetchError,value:`fetch response status is ${e.status} and ok is ${e.ok}`});if(postMessage({cmd:O,type:ke}),cr())ni.writableStream=new WritableStream({write:e=>a&&a.signal&&a.signal.aborted?(ni.debugLog("worker","writableStream write() and abortController.signal.aborted is true so return"),void(ni.fetchStatus=Dt)):_r(Sr)?(ni.debugLog("worker","writableStream write() and requestAbort is true so return"),ni.fetchStatus=Dt,void Or()):void("string"!=typeof e?(ni.fetchStatus=Ct,d(e.byteLength),t.isFlv?c.write(e):t.isFmp4?ni.demuxFmp4(e):t.isMpeg4?ni.demuxMpeg4(e):t.isTs?ni.demuxTs(e):t.isNakedFlow&&ni.demuxNakedFlow(e)):ni.debugWarn("worker",`writableStream write() and value is "${e}" string so return`)),close:()=>{ni.debugLog("worker","writableStream close()"),ni.fetchStatus=Dt,c&&(c.close(),c=null),Or(),postMessage({cmd:O,type:Ee,value:_,msg:"fetch done"})},abort:e=>{if(a&&a.signal&&a.signal.aborted)return ni.debugLog("worker","writableStream abort() and abortController.signal.aborted is true so return"),void(ni.fetchStatus=Dt);c&&(c.close(),c=null),e.name!==Bt?(ni.debugLog("worker",`writableStream abort() and e is ${e.toString()}`),Or(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()})):ni.debugLog("worker","writableStream abort() and e.name is AbortError so return")}}),e.body.pipeTo(ni.writableStream).catch((e=>{"AbortError"!==e.name&&ni.debugLog("worker","writableStream pipeTo() and e is",e.name,e.toString())}));else{const r=e.body.getReader(),i=()=>{r.read().then((e=>{let{done:r,value:s}=e;return r?(ni.debugLog("worker","fetchNext().then() and done is true"),ni.fetchStatus=Dt,c&&(c.close(),c=null),Or(),void postMessage({cmd:O,type:Ee,value:_,msg:"fetch done"})):a&&a.signal&&a.signal.aborted?(ni.debugLog("worker","fetchNext().then() and abortController.signal.aborted is true so return"),void(ni.fetchStatus=Dt)):_r(Sr)?(ni.debugLog("worker","fetchNext().then() and requestAbort is true so return"),ni.fetchStatus=Dt,void Or()):void("string"!=typeof s?(ni.fetchStatus=Ct,d(s.byteLength),t.isFlv?c.write(s):t.isFmp4?ni.demuxFmp4(s):t.isMpeg4?ni.demuxMpeg4(s):t.isTs?ni.demuxTs(s):t.isNakedFlow&&ni.demuxNakedFlow(s),i()):ni.debugWarn("worker",`fetchNext().then() and value "${s}" is string so return`))})).catch((e=>{if(a&&a.signal&&a.signal.aborted)return ni.debugLog("worker","fetchNext().catch() and abortController.signal.aborted is true so return"),void(ni.fetchStatus=Dt);c&&(c.close(),c=null),e.name!==Bt?(ni.debugLog("worker",`fetchNext().catch() and e is ${e.toString()}`),Or(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()})):ni.debugLog("worker","fetchNext().catch() and e.name is AbortError so return")}))};i()}})).catch((e=>{a&&a.signal&&a.signal.aborted?ni.debugLog("worker","fetch().catch() and abortController.signal.aborted is true so return"):e.name!==Bt?(ni.debugLog("worker",`fetch().catch() and e is ${e.toString()}`),Or(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()}),c&&(c.close(),c=null)):ni.debugLog("worker","fetch().catch() and e.name is AbortError so return")}))}else t.protocol===p&&(t.isFlv&&(c=new Ar(ni.demuxFlv())),o=new WebSocket(e,r),o.binaryType="arraybuffer",o.onopen=()=>{ni.debugLog("worker","fetchStream, WebsocketStream socket open"),postMessage({cmd:O,type:ke}),postMessage({cmd:O,type:De})},o.onclose=e=>{ni.isDestroyed?ni.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} and isDestroyed is true, so return`):u?ni.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} but isSocketError is true , so return`):(ni.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code}`),1006===e.code&&ni.debugError("worker",`fetchStream, WebsocketStream socket close abnormally and code is ${e.code}`),_r(Sr)?ni.debugLog("worker","fetchStream, WebsocketStream socket close and requestAbort is true so return"):(c&&(c.close(),c=null),postMessage({cmd:O,type:Ee,value:g,msg:e.code})))},o.onerror=e=>{ni.debugError("worker","fetchStream, WebsocketStream socket error",e,e.toString()),u=!0,c&&(c.close(),c=null),ni.isDestroyed?ni.debugLog("worker","fetchStream, WebsocketStream on error and isDestroyed is true, so return"):postMessage({cmd:O,type:Le.websocketError,value:e.isTrusted?"websocket user aborted":"websocket error"})},o.onmessage=e=>{"string"!=typeof e.data?(d(e.data.byteLength),t.isFlv?c.write(e.data):t.isFmp4?ni.demuxFmp4(e.data):t.isMpeg4?ni.demuxMpeg4(e.data):ni._opt.isNakedFlow?ni.demuxNakedFlow(e.data):ni.demuxM7s(e.data)):ni.debugWarn("worker",`socket on message is string "${e.data}" and return`)})},demuxFlv:function*(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),r=new Uint32Array(e);for(;;){t[3]=0;const e=yield 15,i=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const s=r[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let n=r[0];const a=(yield s).slice();switch(i){case oe:if(a.byteLength>0){let e=a;_r(ni._opt.m7sCryptoAudio)&&(e=ni.cryptoPayloadAudio(a)),ni.decode(e,{type:ne,ts:n})}else ni.debugWarn("worker",`demuxFlv() type is audio and payload.byteLength is ${a.byteLength} and return`);break;case de:if(a.byteLength>=6){const e=a[0];if(ni._isEnhancedH265Header(e))ni._decodeEnhancedH265Video(a,n);else{const e=15&a[0];let t=a[0]>>4===kt;const i=e===Pe;if(gr(t)&&_r(vr(a,i))&&(ni.debugLog("worker","demux() isIFrame is false and unit type is IDR and update to true"),t=!0),t&&mr(a)&&null===ni.isHevc){const e=15&a[0];ni.isHevc=e===Pe,br=tr(a,ni.isHevc),ni.debugLog("worker",`demuxFlv() isVideoSequenceHeader is true and isHevc is ${ni.isHevc} and nalUnitSize is ${br}`)}t&&ni.calcIframeIntervalTimestamp(n),ni.isPlayer&&ni.calcNetworkDelay(n),r[0]=a[4],r[1]=a[3],r[2]=a[2],r[3]=0;let s=r[0],o=ni.cryptoPayload(a,t);ni.decode(o,{type:ae,ts:n,isIFrame:t,cts:s})}}else ni.debugWarn("worker",`demuxFlv() type is video and payload.byteLength is ${a.byteLength} and return`);break;case le:postMessage({cmd:Z,buffer:a},[a.buffer]);break;default:ni.debugLog("worker",`demuxFlv() type is ${i}`)}}},decode:function(e,t){t.type===ne?ni._opt.hasAudio&&(postMessage({cmd:O,type:Be,value:e.byteLength}),ni.isPlayer?ni.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts}):ni.isPlayback&&(ni.isPlaybackOnlyDecodeIFrame()||(ni.isPlaybackCacheBeforeDecodeForFpsRender(),ni.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts})))):t.type===ae&&ni._opt.hasVideo&&(postMessage({cmd:O,type:Ue,value:e.byteLength}),postMessage({cmd:O,type:xe,value:t.ts}),ni.isPlayer?ni.pushBuffer(e,{type:t.type,ts:t.ts,isIFrame:t.isIFrame,cts:t.cts}):ni.isPlayback&&(ni.isPlaybackOnlyDecodeIFrame()?t.isIFrame&&ni.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}):(ni.isPlaybackCacheBeforeDecodeForFpsRender(),ni.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}))))},cryptoPayload:function(e,t){let r=e;return ni._opt.isM7sCrypto?ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength>0&&ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength>0?r=Ri(e,ni._opt.cryptoKey,ni._opt.cryptoIV,ni.isHevc):ni.debugError("worker",`isM7sCrypto cryptoKey.length is ${ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength} or cryptoIV.length is ${ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength} null`):ni._opt.isSm4Crypto?ni._opt.sm4CryptoKey?r=ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength>0&&ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength>0?Qs(e,ni._opt.cryptoKey,ni._opt.cryptoIV,ni.isHevc,ni._opt.isSm4CryptoH265V2):ns(e,ni._opt.sm4CryptoKey,ni.isHevc,ni._opt.isSm4CryptoH265V2):ni._opt.sm4CryptoKey||ni.debugError("worker","isSm4Crypto opt.sm4CryptoKey is null"):ni._opt.isXorCrypto&&(ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength>0&&ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength>0?r=cs(e,ni._opt.cryptoKey,ni._opt.cryptoIV,ni.isHevc):ni.debugError("worker",`isXorCrypto cryptoKey.length is ${ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength} or cryptoIV.length is ${ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength} null`)),r},cryptoPayloadAudio:function(e){let t=e;return ni._opt.isM7sCrypto&&(ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength>0&&ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength>0?e[0]>>4===Ne&&(t=zi(e,ni._opt.cryptoKey,ni._opt.cryptoIV)):ni.debugError("worker",`isM7sCrypto cryptoKey.length is ${ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength} or cryptoIV.length is ${ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength} null`)),t},setCodecAudio:function(e,t){const r=e[0]>>4,i=e[0]>>1&1;if(wr=r===Ne?i?16:8:0===i?8:16,ai&&ai.setCodec)if(jt(e)||r===Oe||r===Ge||r===$e){ni.debugLog("worker",`setCodecAudio: init audio codec, codeId is ${r} _opt.sampleRate is ${ni._opt.sampleRate}`);const i=r===Ne?e.slice(2):new Uint8Array(0);ai.setCodec(r,ni._opt.sampleRate,i),r===Ne&&postMessage({cmd:F,buffer:i},[i.buffer]),U=!0,r!==Ne&&(r===$e?(ni.mp3Demuxer||(ni.mp3Demuxer=new os(ni),ni.mp3Demuxer.on("data",((e,t)=>{ai.decode(e,t)}))),ni.mp3Demuxer.dispatch(e.slice(1),t)):ai.decode(e.slice(1),t));{const e=Number("1")||1;setTimeout((()=>{ni.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),ni.close(),postMessage({cmd:H})}),60*e*60*1e3)}}else ni.debugWarn("worker","setCodecAudio: hasInitAudioCodec is false, codecId is ",r);else ni.debugError("worker","setCodecAudio: audioDecoder or audioDecoder.setCodec is null")},decodeAudio:function(e,t){if(ni.isDestroyed)ni.debugLog("worker","decodeAudio, decoder is destroyed and return");else if(ni.isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio())si.decodeAudio(e,t);else if(_r(r)&&_r(ni._opt.mseDecodeAudio))postMessage({cmd:N,payload:e,ts:t,cts:t},[e.buffer]);else{const r=e[0]>>4;if(U){if(jt(e))return void ni.debugLog("worker","decodeAudio and has already initialized and payload is aac codec packet so drop this frame");r===$e?ni.mp3Demuxer.dispatch(e.slice(1),t):ai.decode(r===Ne?e.slice(2):e.slice(1),t)}else ni.setCodecAudio(e,t)}},setCodecVideo:function(e,t){const r=15&e[0];if(oi&&oi.setCodec)if(mr(e))if(r===Fe||r===Pe){ni.debugLog("worker",`setCodecVideo: init video codec , codecId is ${r}`);const t=e.slice(5);if(r===Fe&&ni._opt.useSIMD){const e=kr(t);if(e.codecWidth>A||e.codecHeight>A)return postMessage({cmd:q,value:`width: ${e.codecWidth} > 4080, height: ${e.codecHeight} > 4080`}),void ni.debugWarn("worker",`setCodecVideo: SIMD H264 decode video width is too large, width is ${e.codecWidth}, height is ${e.codecHeight}`)}const i=new Uint8Array(e);S=!0,oi.setCodec(r,t),postMessage({cmd:P,code:r}),postMessage({cmd:M,buffer:i,codecId:r},[i.buffer])}else ni.debugWarn("worker",`setCodecVideo: hasInitVideoCodec is false, codecId is ${r} is not H264 or H265`);else ni.debugWarn("worker",`decodeVideo: hasInitVideoCodec is false, codecId is ${r} and isIFrame is ${t} and packetType is ${e[1]}`);else ni.debugError("worker","setCodecVideo: videoDecoder or videoDecoder.setCodec is null")},decodeVideo:function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(ni.isDestroyed)ni.debugLog("worker","decodeVideo, decoder is destroyed and return");else if(ni.isPlayUseMSEAndDecoderInWorker())si.decodeVideo(e,t,i,s);else if(_r(r))postMessage({cmd:z,payload:e,isIFrame:i,ts:t,cts:s,delay:ni.delay},[e.buffer]);else if(S)if(!we&&i&&(we=!0),we){if(i&&mr(e)){const t=15&e[0];let r={};t===Fe?r=kr(e.slice(5)):t===Pe&&(r=Hr(e)),r.codecWidth&&r.codecHeight&&h&&w&&(r.codecWidth!==h||r.codecHeight!==w)&&(ni.debugWarn("worker",`\n decodeVideo: video width or height is changed,\n old width is ${h}, old height is ${w},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),Jt=!0,postMessage({cmd:W,value:`width: ${h}->${r.codecWidth}, height: ${w}->${r.codecHeight}`}))}if(Jt)return void ni.debugWarn("worker","decodeVideo: video width or height is changed, and return");if(sr)return void ni.debugWarn("worker","decodeVideo: simd decode error, and return");if(mr(e))return void ni.debugLog("worker","decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength0&&void 0!==arguments[0]&&arguments[0];ni.debugLog("worker",`clearBuffer,bufferList length is ${i.length}, need clear is ${e}`),e&&(i=[]),ni.isPlayer&&(ni.resetAllDelay(),_r(ni._opt.checkFirstIFrame)&&(ni.dropping=!0,postMessage({cmd:$}))),_r(ni._opt.checkFirstIFrame)&&gr(r)&&(we=!1)},dropBuffer$2:function(){if(i.length>0){let e=i.findIndex((e=>_r(e.isIFrame)&&e.type===ae));if(ni.isAllIframeInBufferList())for(let t=0;t=ni.getNotDroppingDelayTs()){ni.debugLog("worker",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${s} and notDroppingDelayTs is ${ni.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){ni.isPushDropping=!0,postMessage({cmd:$});const t=i.length;i=i.slice(e);const r=i.shift();ni.resetAllDelay(),ni.getDelay(r.ts,r.type),ni.doDecode(r),ni.isPushDropping=!1,ni.debugLog("worker",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,new bufferList is ${i.length} and new delay is ${ni.delay} `)}else ni.isPushDropping=!1}0===i.length&&(ni.isPushDropping=!1)},demuxM7s:function(e){const t=new DataView(e),r=t.getUint32(1,!1),i=t.getUint8(0),s=new ArrayBuffer(4),n=new Uint32Array(s);switch(i){case ne:ni.decode(new Uint8Array(e,5),{type:ne,ts:r});break;case ae:if(t.byteLength>=11){const i=new Uint8Array(e,5),s=i[0];if(ni._isEnhancedH265Header(s))ni._decodeEnhancedH265Video(i,r);else{const e=t.getUint8(5)>>4==1;if(e&&(ni.calcIframeIntervalTimestamp(r),mr(i)&&null===ni.isHevc)){const e=15&i[0];ni.isHevc=e===Pe}ni.isPlayer&&ni.calcNetworkDelay(r),n[0]=i[4],n[1]=i[3],n[2]=i[2],n[3]=0;let s=n[0],a=ni.cryptoPayload(i,e);ni.decode(a,{type:ae,ts:r,isIFrame:e,cts:s})}}else ni.debugWarn("worker",`demuxM7s() type is video and arrayBuffer length is ${e.byteLength} and return`)}},demuxNakedFlow:function(e){Gr.dispatch(e)},demuxFmp4:function(e){Wr.dispatch(e)},demuxMpeg4:function(e){ri.dispatch(e)},demuxTs:function(e){ii.dispatch(e)},_decodeEnhancedH265Video:function(e,t){const r=e[0],i=48&r,s=15&r,n=e.slice(1,5),a=new ArrayBuffer(4),o=new Uint32Array(a),d="a"==String.fromCharCode(n[0]);if(ni.isHevc=gr(d),s===Pt){if(i===zt){const r=e.slice(5);if(d);else{const i=new Uint8Array(5+r.length);i.set([28,0,0,0,0],0),i.set(r,5),br=tr(e,ni.isHevc),ni.debugLog("worker",`demuxFlv() isVideoSequenceHeader(enhancedH265) is true and isHevc is ${ni.isHevc} and nalUnitSize is ${br}`),ni.decode(i,{type:ae,ts:t,isIFrame:!0,cts:0})}}}else if(s===Mt){let r=e,s=0;const n=i===zt;n&&ni.calcIframeIntervalTimestamp(t),d||(o[0]=e[4],o[1]=e[3],o[2]=e[2],o[3]=0,s=o[0],r=Yr(e.slice(8),n),r=ni.cryptoPayload(r,n),ni.decode(r,{type:ae,ts:t,isIFrame:n,cts:s}))}else if(s===Rt){const r=i===zt;r&&ni.calcIframeIntervalTimestamp(t);let s=Yr(e.slice(5),r);s=ni.cryptoPayload(s,r),ni.decode(s,{type:ae,ts:t,isIFrame:r,cts:0})}},_isEnhancedH265Header:function(e){return(e&Ft)===Ft},findSei:function(e,t){let r=4;or(br)&&(r=br),Qt(e.slice(5),r).forEach((e=>{const r=ni.isHevc?e[0]>>>1&63:31&e[0];(ni.isHevc&&(r===ht||r===ut)||gr(ni.isHevc)&&r===Ye)&&postMessage({cmd:X,buffer:e,ts:t},[e.buffer])}))},calcNetworkDelay:function(e){if(!(we&&e>0))return;null===et?(et=e,rt=rr()):et?r-t:0;ni.networkDelay=i,i>ni._opt.networkDelay&&ni._opt.playType===y&&(ni.debugWarn("worker",`calcNetworkDelay now dts:${e}, start dts is ${et} vs start is ${t},local diff is ${r} ,delay is ${i}`),postMessage({cmd:O,type:Ce,value:i}))},calcIframeIntervalTimestamp:function(e){null===Ot?Ot=e:Ot=ni._opt.playbackForwardMaxRateDecodeIFrame&&!(ni._opt.useMSE&&ni._opt.mseDecodeAudio)},isPlayUseMSE:function(){return ni.isPlayer&&ni._opt.useMSE&&_r(r)},isPlayUseMSEAndDecoderInWorker:function(){return ni.isPlayUseMSE()&&ni._opt.mseDecoderUseWorker},isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio:function(){return ni.isPlayUseMSEAndDecoderInWorker()&&ni._opt.mseDecodeAudio},playbackUpdatePlaybackRate:function(){gr(ni.isPlaybackCacheBeforeDecodeForFpsRender())&&ni.clearBuffer(!0)},onOffscreenCanvasWebglContextLost:function(e){ni.debugError("worker","handleOffscreenCanvasWebglContextLost and next try to create webgl"),e.preventDefault(),Yt=!0,ni.webglObj.destroy(),ni.webglObj=null,ni.offscreenCanvasGL=null,setTimeout((()=>{ni.offscreenCanvasGL=ni.offscreenCanvas.getContext("webgl"),ni.offscreenCanvasGL&&ni.offscreenCanvasGL.getContextAttributes().stencil?(ni.webglObj=f(ni.offscreenCanvasGL,ni._opt.openWebglAlignment),Yt=!1):ni.debugError("worker","handleOffscreenCanvasWebglContextLost, stencil is false")}),500)},onOffscreenCanvasWebglContextRestored:function(e){ni.debugLog("worker","handleOffscreenCanvasWebglContextRestored"),e.preventDefault()},videoInfo:function(e,t,r){postMessage({cmd:P,code:e}),postMessage({cmd:k,w:t,h:r}),h=t,w=r,ni.useOffscreen()&&(ni.offscreenCanvas=new OffscreenCanvas(t,r),ni.offscreenCanvasGL=ni.offscreenCanvas.getContext("webgl"),ni.webglObj=f(ni.offscreenCanvasGL,ni._opt.openWebglAlignment),ni.offscreenCanvas.addEventListener("webglcontextlost",ni.onOffscreenCanvasWebglContextLost,!1),ni.offscreenCanvas.addEventListener("webglcontextrestored",ni.onOffscreenCanvasWebglContextRestored,!1))},audioInfo:function(e,t,r){postMessage({cmd:L,code:e}),postMessage({cmd:D,sampleRate:t,channels:r,depth:wr}),Nt=r},yuvData:function(t,r){if(ni.isDestroyed)return void ni.debugLog("worker","yuvData, decoder is destroyed and return");const i=h*w*3/2;let s=e.HEAPU8.subarray(t,t+i),n=new Uint8Array(s);if(Et=null,We=r,ni.useOffscreen())try{if(Yt)return;ni.webglObj.renderYUV(h,w,n);let e=ni.offscreenCanvas.transferToImageBitmap();postMessage({cmd:T,buffer:e,delay:ni.delay,ts:r},[e])}catch(e){ni.debugError("worker","yuvData, transferToImageBitmap error is",e,e.toString())}else postMessage({cmd:T,output:n,delay:ni.delay,ts:r},[n.buffer])},pcmData:function(e,r,i){if(ni.isDestroyed)return void ni.debugLog("worker","pcmData, decoder is destroyed and return");let n=r,a=[],o=0,d=ni._opt.audioBufferSize;for(let r=0;r<2;r++){let i=t.HEAPU32[(e>>2)+r]>>2;a[r]=t.HEAPF32.subarray(i,i+n)}if(xt){if(!(n>=(r=d-xt)))return xt+=n,s[0]=Float32Array.of(...s[0],...a[0]),void(2==Nt&&(s[1]=Float32Array.of(...s[1],...a[1])));ct[0]=Float32Array.of(...s[0],...a[0].subarray(0,r)),2==Nt&&(ct[1]=Float32Array.of(...s[1],...a[1].subarray(0,r))),postMessage({cmd:C,buffer:ct,ts:i},ct.map((e=>e.buffer))),o=r,n-=r}for(xt=n;xt>=d;xt-=d)ct[0]=a[0].slice(o,o+=d),2==Nt&&(ct[1]=a[1].slice(o-d,o)),postMessage({cmd:C,buffer:ct,ts:i},ct.map((e=>e.buffer)));xt&&(s[0]=a[0].slice(o),2==Nt&&(s[1]=a[1].slice(o))),a=[]},errorInfo:function(e){null===Et&&(Et=rr());const t=rr(),r=ir(At>0?2*At:5e3,1e3,5e3),i=t-Et;i>r&&(ni.debugWarn("worker",`errorInfo() emit simdDecodeError and\n iframeIntervalTimestamp is ${At} and diff is ${i} and maxDiff is ${r}\n and replay`),sr=!0,postMessage({cmd:j}))},sendWebsocketMessage:function(e){o?o.readyState===Ie?o.send(e):ni.debugError("worker","socket is not open"):ni.debugError("worker","socket is null")},timeEnd:function(){ni.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),ni.close(),postMessage({cmd:H})},postStreamToMain(e,t){postMessage({cmd:K,type:t,buffer:e},[e.buffer])},updatePlaybackIsPause(e){ni.debugLog("worker",`updatePlaybackIsPause, isPause is ${e}`),_r(e)?ni.clearPlaybackCacheLoop():ni.startPlaybackCacheLoop()},debugLog(e){if(ni._opt.debug&&ni.debug){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:{};var t,i,s;(s=e).ready=new Promise(((e,r)=>{t=e,i=r})),(s=void 0!==s?s:{}).locateFile=function(e){return"decoder-pro-audio.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_AUDIO_WASM_URL&&""!=JESSIBUCA_PRO_AUDIO_WASM_URL?JESSIBUCA_PRO_AUDIO_WASM_URL:e};var n,a,o,d=Object.assign({},s),l="./this.program",c="object"==typeof window,u="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";function p(e){return s.locateFile?s.locateFile(e,f):f+e}if(h){const{createRequire:e}=await import("module");var m=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-hard.js",document.baseURI).href),_=m("fs"),g=m("path");f=u?g.dirname(f)+"/":m("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-hard.js",document.baseURI).href)),n=(e,t)=>(e=J(e)?new URL(e):g.normalize(e),_.readFileSync(e,t?void 0:"utf8")),o=e=>{var t=n(e,!0);return t.buffer||(t=new Uint8Array(t)),t},a=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=J(e)?new URL(e):g.normalize(e),_.readFile(e,i?void 0:"utf8",((e,s)=>{e?r(e):t(i?s.buffer:s)}))},!s.thisProgram&&process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),s.inspect=()=>"[Emscripten Module object]"}else(c||u)&&(u?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),r&&(f=r),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",n=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},u&&(o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),a=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var y,v,b=s.print||console.log.bind(console),w=s.printErr||console.error.bind(console);Object.assign(s,d),d=null,s.arguments&&s.arguments,s.thisProgram&&(l=s.thisProgram),s.quit&&s.quit,s.wasmBinary&&(y=s.wasmBinary),"object"!=typeof WebAssembly&&j("no native wasm support detected");var S,E,A,B,U,x,k,T,C=!1;function D(e,t){e||j(t)}function L(){var e=v.buffer;s.HEAP8=S=new Int8Array(e),s.HEAP16=A=new Int16Array(e),s.HEAPU8=E=new Uint8Array(e),s.HEAPU16=B=new Uint16Array(e),s.HEAP32=U=new Int32Array(e),s.HEAPU32=x=new Uint32Array(e),s.HEAPF32=k=new Float32Array(e),s.HEAPF64=T=new Float64Array(e)}var I=[],F=[],P=[];function M(){if(s.preRun)for("function"==typeof s.preRun&&(s.preRun=[s.preRun]);s.preRun.length;)N(s.preRun.shift());se(I)}function R(){s.noFSInit||Te.init.initialized||Te.init(),Te.ignorePermissions=!1,se(F)}function z(){if(s.postRun)for("function"==typeof s.postRun&&(s.postRun=[s.postRun]);s.postRun.length;)G(s.postRun.shift());se(P)}function N(e){I.unshift(e)}function O(e){F.unshift(e)}function G(e){P.unshift(e)}var $=0,H=null;function V(e){$++,s.monitorRunDependencies&&s.monitorRunDependencies($)}function W(e){if($--,s.monitorRunDependencies&&s.monitorRunDependencies($),0==$&&H){var t=H;H=null,t()}}function j(e){s.onAbort&&s.onAbort(e),w(e="Aborted("+e+")"),C=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}var q,Y,K,X="data:application/octet-stream;base64,",Z=e=>e.startsWith(X),J=e=>e.startsWith("file://");function Q(e){if(e==q&&y)return new Uint8Array(y);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}function ee(e){if(!y&&(c||u)){if("function"==typeof fetch&&!J(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>Q(e)));if(a)return new Promise(((t,r)=>{a(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>Q(e)))}function te(e,t,r){return ee(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{w(`failed to asynchronously prepare wasm: ${e}`),j(e)}))}function re(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||Z(t)||J(t)||h||"function"!=typeof fetch?te(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return w(`wasm streaming compile failed: ${e}`),w("falling back to ArrayBuffer instantiation"),te(t,r,i)}))))}function ie(){var e={a:si};function t(e,t){return ni=e.exports,v=ni.E,L(),It=ni.H,O(ni.F),W(),ni}if(V(),s.instantiateWasm)try{return s.instantiateWasm(e,t)}catch(e){w(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return re(y,q,e,(function(e){t(e.instance)})).catch(i),{}}s.locateFile?Z(q="decoder-pro-audio.wasm")||(q=p(q)):q=new URL("decoder-pro-audio.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-hard.js",document.baseURI).href).href;var se=e=>{for(;e.length>0;)e.shift()(s)};function ne(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){x[this.ptr+4>>2]=e},this.get_type=function(){return x[this.ptr+4>>2]},this.set_destructor=function(e){x[this.ptr+8>>2]=e},this.get_destructor=function(){return x[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,S[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=S[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,S[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=S[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){x[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return x[this.ptr+16>>2]},this.get_exception_ptr=function(){if(ci(this.get_type()))return x[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}s.noExitRuntime;var ae=(e,t,r)=>{throw new ne(e).init(t,r),e},oe=e=>(U[oi()>>2]=e,e),de={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var s=e[i];"."===s?e.splice(i,1):".."===s?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=de.isAbs(e),r="/"===e.substr(-1);return(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=de.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=de.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return de.normalize(e.join("/"))},join2:(e,t)=>de.normalize(e+"/"+t)},le=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}j("initRandomDevice")},ce=e=>(ce=le())(e),ue={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:Te.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=de.isAbs(i)}return(t?"/":"")+(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=ue.resolve(e).substr(1),t=ue.resolve(t).substr(1);for(var i=r(e.split("/")),s=r(t.split("/")),n=Math.min(i.length,s.length),a=n,o=0;o{for(var i=t+r,s=t;e[s]&&!(s>=i);)++s;if(s-t>16&&e.buffer&&he)return he.decode(e.subarray(t,s));for(var n="";t>10,56320|1023&l)}}else n+=String.fromCharCode((31&a)<<6|o)}else n+=String.fromCharCode(a)}return n},pe=[],me=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},_e=(e,t,r,i)=>{if(!(i>0))return 0;for(var s=r,n=r+i-1,a=0;a=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a)),o<=127){if(r>=n)break;t[r++]=o}else if(o<=2047){if(r+1>=n)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=n)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=n)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o}}return t[r]=0,r-s};function ge(e,t,r){var i=r>0?r:me(e)+1,s=new Array(i),n=_e(e,s,0,s.length);return t&&(s.length=n),s}var ye=()=>{if(!pe.length){var e=null;if(h){var t=Buffer.alloc(256),r=0,i=process.stdin.fd;try{r=_.readSync(i,t)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}e=r>0?t.slice(0,r).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;pe=ge(e,!0)}return pe.shift()},ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},Te.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new Te.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,i,s){if(!e.tty||!e.tty.ops.get_char)throw new Te.ErrnoError(60);for(var n=0,a=0;aye(),put_char(e,t){null===t||10===t?(b(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(b(fe(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(w(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(w(fe(e.output,0)),e.output=[])}}},be=e=>{j()},we={ops_table:null,mount:e=>we.createNode(null,"/",16895,0),createNode(e,t,r,i){if(Te.isBlkdev(r)||Te.isFIFO(r))throw new Te.ErrnoError(63);we.ops_table||(we.ops_table={dir:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,lookup:we.node_ops.lookup,mknod:we.node_ops.mknod,rename:we.node_ops.rename,unlink:we.node_ops.unlink,rmdir:we.node_ops.rmdir,readdir:we.node_ops.readdir,symlink:we.node_ops.symlink},stream:{llseek:we.stream_ops.llseek}},file:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:{llseek:we.stream_ops.llseek,read:we.stream_ops.read,write:we.stream_ops.write,allocate:we.stream_ops.allocate,mmap:we.stream_ops.mmap,msync:we.stream_ops.msync}},link:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,readlink:we.node_ops.readlink},stream:{}},chrdev:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:Te.chrdev_stream_ops}});var s=Te.createNode(e,t,r,i);return Te.isDir(s.mode)?(s.node_ops=we.ops_table.dir.node,s.stream_ops=we.ops_table.dir.stream,s.contents={}):Te.isFile(s.mode)?(s.node_ops=we.ops_table.file.node,s.stream_ops=we.ops_table.file.stream,s.usedBytes=0,s.contents=null):Te.isLink(s.mode)?(s.node_ops=we.ops_table.link.node,s.stream_ops=we.ops_table.link.stream):Te.isChrdev(s.mode)&&(s.node_ops=we.ops_table.chrdev.node,s.stream_ops=we.ops_table.chrdev.stream),s.timestamp=Date.now(),e&&(e.contents[t]=s,e.timestamp=s.timestamp),s},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Te.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,Te.isDir(e.mode)?t.size=4096:Te.isFile(e.mode)?t.size=e.usedBytes:Te.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&we.resizeFileStorage(e,t.size)},lookup(e,t){throw Te.genericErrors[44]},mknod:(e,t,r,i)=>we.createNode(e,t,r,i),rename(e,t,r){if(Te.isDir(e.mode)){var i;try{i=Te.lookupNode(t,r)}catch(e){}if(i)for(var s in i.contents)throw new Te.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=Te.lookupNode(e,t);for(var i in r.contents)throw new Te.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink(e,t,r){var i=we.createNode(e,t,41471,0);return i.link=r,i},readlink(e){if(!Te.isLink(e.mode))throw new Te.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,i,s){var n=e.node.contents;if(s>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-s,i);if(a>8&&n.subarray)t.set(n.subarray(s,s+a),r);else for(var o=0;o0||r+t(we.stream_ops.write(e,t,0,i,r,!1),0)}},Se=(e,t,r,i)=>{var s=i?"":`al ${e}`;a(e,(r=>{D(r,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(r)),s&&W()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),s&&V()},Ee=(e,t,r,i,s,n)=>{Te.createDataFile(e,t,r,i,s,n)},Ae=s.preloadPlugins||[],Be=(e,t,r,i)=>{"undefined"!=typeof Browser&&Browser.init();var s=!1;return Ae.forEach((n=>{s||n.canHandle(t)&&(n.handle(e,t,r,i),s=!0)})),s},Ue=(e,t,r,i,s,n,a,o,d,l)=>{var c=t?ue.resolve(de.join2(e,t)):e;function u(r){function u(r){l&&l(),o||Ee(e,t,r,i,s,d),n&&n(),W()}Be(r,c,u,(()=>{a&&a(),W()}))||u(r)}V(),"string"==typeof r?Se(r,(e=>u(e)),a):u(r)},xe=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t},ke=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Te={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=ue.resolve(e)))return{path:"",node:null};if(t=Object.assign({follow_mount:!0,recurse_count:0},t),t.recurse_count>8)throw new Te.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),i=Te.root,s="/",n=0;n40)throw new Te.ErrnoError(32)}}return{path:s,node:i}},getPath(e){for(var t;;){if(Te.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,i=0;i>>0)%Te.nameTable.length},hashAddNode(e){var t=Te.hashName(e.parent.id,e.name);e.name_next=Te.nameTable[t],Te.nameTable[t]=e},hashRemoveNode(e){var t=Te.hashName(e.parent.id,e.name);if(Te.nameTable[t]===e)Te.nameTable[t]=e.name_next;else for(var r=Te.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=Te.mayLookup(e);if(r)throw new Te.ErrnoError(r,e);for(var i=Te.hashName(e.id,t),s=Te.nameTable[i];s;s=s.name_next){var n=s.name;if(s.parent.id===e.id&&n===t)return s}return Te.lookup(e,t)},createNode(e,t,r,i){var s=new Te.FSNode(e,t,r,i);return Te.hashAddNode(s),s},destroyNode(e){Te.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>Te.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){var t=Te.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{return Te.lookupNode(e,t),20}catch(e){}return Te.nodePermissions(e,"wx")},mayDelete(e,t,r){var i;try{i=Te.lookupNode(e,t)}catch(e){return e.errno}var s=Te.nodePermissions(e,"wx");if(s)return s;if(r){if(!Te.isDir(i.mode))return 54;if(Te.isRoot(i)||Te.getPath(i)===Te.cwd())return 10}else if(Te.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?Te.isLink(e.mode)?32:Te.isDir(e.mode)&&("r"!==Te.flagsToPermissionString(t)||512&t)?31:Te.nodePermissions(e,Te.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Te.MAX_OPEN_FDS;e++)if(!Te.streams[e])return e;throw new Te.ErrnoError(33)},getStreamChecked(e){var t=Te.getStream(e);if(!t)throw new Te.ErrnoError(8);return t},getStream:e=>Te.streams[e],createStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return Te.FSStream||(Te.FSStream=function(){this.shared={}},Te.FSStream.prototype={},Object.defineProperties(Te.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},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(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new Te.FSStream,e),-1==t&&(t=Te.nextfd()),e.fd=t,Te.streams[t]=e,e},closeStream(e){Te.streams[e]=null},chrdev_stream_ops:{open(e){var t=Te.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek(){throw new Te.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Te.devices[e]={stream_ops:t}},getDevice:e=>Te.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),Te.syncFSRequests++,Te.syncFSRequests>1&&w(`warning: ${Te.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Te.getMounts(Te.root.mount),i=0;function s(e){return Te.syncFSRequests--,t(e)}function n(e){if(e)return n.errored?void 0:(n.errored=!0,s(e));++i>=r.length&&s(null)}r.forEach((t=>{if(!t.type.syncfs)return n(null);t.type.syncfs(t,e,n)}))},mount(e,t,r){var i,s="/"===r,n=!r;if(s&&Te.root)throw new Te.ErrnoError(10);if(!s&&!n){var a=Te.lookupPath(r,{follow_mount:!1});if(r=a.path,i=a.node,Te.isMountpoint(i))throw new Te.ErrnoError(10);if(!Te.isDir(i.mode))throw new Te.ErrnoError(54)}var o={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(o);return d.mount=o,o.root=d,s?Te.root=d:i&&(i.mounted=o,i.mount&&i.mount.mounts.push(o)),d},unmount(e){var t=Te.lookupPath(e,{follow_mount:!1});if(!Te.isMountpoint(t.node))throw new Te.ErrnoError(28);var r=t.node,i=r.mounted,s=Te.getMounts(i);Object.keys(Te.nameTable).forEach((e=>{for(var t=Te.nameTable[e];t;){var r=t.name_next;s.includes(t.mount)&&Te.destroyNode(t),t=r}})),r.mounted=null;var n=r.mount.mounts.indexOf(i);r.mount.mounts.splice(n,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var i=Te.lookupPath(e,{parent:!0}).node,s=de.basename(e);if(!s||"."===s||".."===s)throw new Te.ErrnoError(28);var n=Te.mayCreate(i,s);if(n)throw new Te.ErrnoError(n);if(!i.node_ops.mknod)throw new Te.ErrnoError(63);return i.node_ops.mknod(i,s,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,Te.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,Te.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),i="",s=0;s(void 0===r&&(r=t,t=438),t|=8192,Te.mknod(e,t,r)),symlink(e,t){if(!ue.resolve(e))throw new Te.ErrnoError(44);var r=Te.lookupPath(t,{parent:!0}).node;if(!r)throw new Te.ErrnoError(44);var i=de.basename(t),s=Te.mayCreate(r,i);if(s)throw new Te.ErrnoError(s);if(!r.node_ops.symlink)throw new Te.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename(e,t){var r,i,s=de.dirname(e),n=de.dirname(t),a=de.basename(e),o=de.basename(t);if(r=Te.lookupPath(e,{parent:!0}).node,i=Te.lookupPath(t,{parent:!0}).node,!r||!i)throw new Te.ErrnoError(44);if(r.mount!==i.mount)throw new Te.ErrnoError(75);var d,l=Te.lookupNode(r,a),c=ue.relative(e,n);if("."!==c.charAt(0))throw new Te.ErrnoError(28);if("."!==(c=ue.relative(t,s)).charAt(0))throw new Te.ErrnoError(55);try{d=Te.lookupNode(i,o)}catch(e){}if(l!==d){var u=Te.isDir(l.mode),h=Te.mayDelete(r,a,u);if(h)throw new Te.ErrnoError(h);if(h=d?Te.mayDelete(i,o,u):Te.mayCreate(i,o))throw new Te.ErrnoError(h);if(!r.node_ops.rename)throw new Te.ErrnoError(63);if(Te.isMountpoint(l)||d&&Te.isMountpoint(d))throw new Te.ErrnoError(10);if(i!==r&&(h=Te.nodePermissions(r,"w")))throw new Te.ErrnoError(h);Te.hashRemoveNode(l);try{r.node_ops.rename(l,i,o)}catch(e){throw e}finally{Te.hashAddNode(l)}}},rmdir(e){var t=Te.lookupPath(e,{parent:!0}).node,r=de.basename(e),i=Te.lookupNode(t,r),s=Te.mayDelete(t,r,!0);if(s)throw new Te.ErrnoError(s);if(!t.node_ops.rmdir)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.rmdir(t,r),Te.destroyNode(i)},readdir(e){var t=Te.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new Te.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=Te.lookupPath(e,{parent:!0}).node;if(!t)throw new Te.ErrnoError(44);var r=de.basename(e),i=Te.lookupNode(t,r),s=Te.mayDelete(t,r,!1);if(s)throw new Te.ErrnoError(s);if(!t.node_ops.unlink)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.unlink(t,r),Te.destroyNode(i)},readlink(e){var t=Te.lookupPath(e).node;if(!t)throw new Te.ErrnoError(44);if(!t.node_ops.readlink)throw new Te.ErrnoError(28);return ue.resolve(Te.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=Te.lookupPath(e,{follow:!t}).node;if(!r)throw new Te.ErrnoError(44);if(!r.node_ops.getattr)throw new Te.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>Te.stat(e,!0),chmod(e,t,r){var i;if(!(i="string"==typeof e?Te.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new Te.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod(e,t){Te.chmod(e,t,!0)},fchmod(e,t){var r=Te.getStreamChecked(e);Te.chmod(r.node,t)},chown(e,t,r,i){var s;if(!(s="string"==typeof e?Te.lookupPath(e,{follow:!i}).node:e).node_ops.setattr)throw new Te.ErrnoError(63);s.node_ops.setattr(s,{timestamp:Date.now()})},lchown(e,t,r){Te.chown(e,t,r,!0)},fchown(e,t,r){var i=Te.getStreamChecked(e);Te.chown(i.node,t,r)},truncate(e,t){if(t<0)throw new Te.ErrnoError(28);var r;if(!(r="string"==typeof e?Te.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new Te.ErrnoError(63);if(Te.isDir(r.mode))throw new Te.ErrnoError(31);if(!Te.isFile(r.mode))throw new Te.ErrnoError(28);var i=Te.nodePermissions(r,"w");if(i)throw new Te.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=Te.getStreamChecked(e);if(0==(2097155&r.flags))throw new Te.ErrnoError(28);Te.truncate(r.node,t)},utime(e,t,r){var i=Te.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new Te.ErrnoError(44);var i;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?xe(t):t)?4095&r|32768:0,"object"==typeof e)i=e;else{e=de.normalize(e);try{i=Te.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var n=!1;if(64&t)if(i){if(128&t)throw new Te.ErrnoError(20)}else i=Te.mknod(e,r,0),n=!0;if(!i)throw new Te.ErrnoError(44);if(Te.isChrdev(i.mode)&&(t&=-513),65536&t&&!Te.isDir(i.mode))throw new Te.ErrnoError(54);if(!n){var a=Te.mayOpen(i,t);if(a)throw new Te.ErrnoError(a)}512&t&&!n&&Te.truncate(i,0),t&=-131713;var o=Te.createStream({node:i,path:Te.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return o.stream_ops.open&&o.stream_ops.open(o),!s.logReadFiles||1&t||(Te.readFiles||(Te.readFiles={}),e in Te.readFiles||(Te.readFiles[e]=1)),o},close(e){if(Te.isClosed(e))throw new Te.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Te.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Te.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Te.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,i,s){if(i<0||s<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(1==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.read)throw new Te.ErrnoError(28);var n=void 0!==s;if(n){if(!e.seekable)throw new Te.ErrnoError(70)}else s=e.position;var a=e.stream_ops.read(e,t,r,i,s);return n||(e.position+=a),a},write(e,t,r,i,s,n){if(i<0||s<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.write)throw new Te.ErrnoError(28);e.seekable&&1024&e.flags&&Te.llseek(e,0,2);var a=void 0!==s;if(a){if(!e.seekable)throw new Te.ErrnoError(70)}else s=e.position;var o=e.stream_ops.write(e,t,r,i,s,n);return a||(e.position+=o),o},allocate(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(t<0||r<=0)throw new Te.ErrnoError(28);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(!Te.isFile(e.node.mode)&&!Te.isDir(e.node.mode))throw new Te.ErrnoError(43);if(!e.stream_ops.allocate)throw new Te.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,i,s){if(0!=(2&i)&&0==(2&s)&&2!=(2097155&e.flags))throw new Te.ErrnoError(2);if(1==(2097155&e.flags))throw new Te.ErrnoError(2);if(!e.stream_ops.mmap)throw new Te.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,s)},msync:(e,t,r,i,s)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,s):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new Te.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,i=Te.open(e,t.flags),s=Te.stat(e).size,n=new Uint8Array(s);return Te.read(i,n,0,s,0),"utf8"===t.encoding?r=fe(n,0):"binary"===t.encoding&&(r=n),Te.close(i),r},writeFile(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=Te.open(e,r.flags,r.mode);if("string"==typeof t){var s=new Uint8Array(me(t)+1),n=_e(t,s,0,s.length);Te.write(i,s,0,n,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");Te.write(i,t,0,t.byteLength,void 0,r.canOwn)}Te.close(i)},cwd:()=>Te.currentPath,chdir(e){var t=Te.lookupPath(e,{follow:!0});if(null===t.node)throw new Te.ErrnoError(44);if(!Te.isDir(t.node.mode))throw new Te.ErrnoError(54);var r=Te.nodePermissions(t.node,"x");if(r)throw new Te.ErrnoError(r);Te.currentPath=t.path},createDefaultDirectories(){Te.mkdir("/tmp"),Te.mkdir("/home"),Te.mkdir("/home/web_user")},createDefaultDevices(){Te.mkdir("/dev"),Te.registerDevice(Te.makedev(1,3),{read:()=>0,write:(e,t,r,i,s)=>i}),Te.mkdev("/dev/null",Te.makedev(1,3)),ve.register(Te.makedev(5,0),ve.default_tty_ops),ve.register(Te.makedev(6,0),ve.default_tty1_ops),Te.mkdev("/dev/tty",Te.makedev(5,0)),Te.mkdev("/dev/tty1",Te.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=ce(e).byteLength),e[--t]);Te.createDevice("/dev","random",r),Te.createDevice("/dev","urandom",r),Te.mkdir("/dev/shm"),Te.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Te.mkdir("/proc");var e=Te.mkdir("/proc/self");Te.mkdir("/proc/self/fd"),Te.mount({mount(){var t=Te.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,i=Te.getStreamChecked(r),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return s.parent=s,s}},t}},{},"/proc/self/fd")},createStandardStreams(){s.stdin?Te.createDevice("/dev","stdin",s.stdin):Te.symlink("/dev/tty","/dev/stdin"),s.stdout?Te.createDevice("/dev","stdout",null,s.stdout):Te.symlink("/dev/tty","/dev/stdout"),s.stderr?Te.createDevice("/dev","stderr",null,s.stderr):Te.symlink("/dev/tty1","/dev/stderr"),Te.open("/dev/stdin",0),Te.open("/dev/stdout",1),Te.open("/dev/stderr",1)},ensureErrnoError(){Te.ErrnoError||(Te.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},Te.ErrnoError.prototype=new Error,Te.ErrnoError.prototype.constructor=Te.ErrnoError,[44].forEach((e=>{Te.genericErrors[e]=new Te.ErrnoError(e),Te.genericErrors[e].stack=""})))},staticInit(){Te.ensureErrnoError(),Te.nameTable=new Array(4096),Te.mount(we,{},"/"),Te.createDefaultDirectories(),Te.createDefaultDevices(),Te.createSpecialDirectories(),Te.filesystems={MEMFS:we}},init(e,t,r){Te.init.initialized=!0,Te.ensureErrnoError(),s.stdin=e||s.stdin,s.stdout=t||s.stdout,s.stderr=r||s.stderr,Te.createStandardStreams()},quit(){Te.init.initialized=!1;for(var e=0;ethis.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},n.prototype.setDataGetter=function(e){this.getter=e},n.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),s=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,n=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,a=1048576;s||(a=i);var o=this;o.setDataGetter((e=>{var t=e*a,s=(e+1)*a-1;if(s=Math.min(s,i-1),void 0===o.chunks[e]&&(o.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var s=new XMLHttpRequest;if(s.open("GET",r,!1),i!==a&&s.setRequestHeader("Range","bytes="+e+"-"+t),s.responseType="arraybuffer",s.overrideMimeType&&s.overrideMimeType("text/plain; charset=x-user-defined"),s.send(null),!(s.status>=200&&s.status<300||304===s.status))throw new Error("Couldn't load "+r+". Status: "+s.status);return void 0!==s.response?new Uint8Array(s.response||[]):ge(s.responseText||"",!0)})(t,s)),void 0===o.chunks[e])throw new Error("doXHR failed!");return o.chunks[e]})),!n&&i||(a=i=1,i=this.getter(0).length,a=i,b("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!u)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new n;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var o={isDevice:!1,contents:a}}else o={isDevice:!1,url:r};var d=Te.createFile(e,t,o,i,s);o.contents?d.contents=o.contents:o.url&&(d.contents=null,d.url=o.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,t,r,i,s){var n=e.node.contents;if(s>=n.length)return 0;var a=Math.min(n.length-s,i);if(n.slice)for(var o=0;o{var t=d.stream_ops[e];l[e]=function(){return Te.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,s)=>(Te.forceLoadFile(d),c(e,t,r,i,s)),l.mmap=(e,t,r,i,s)=>{Te.forceLoadFile(d);var n=be();if(!n)throw new Te.ErrnoError(48);return c(e,S,n,t,r),{ptr:n,allocated:!0}},d.stream_ops=l,d}},Ce=(e,t)=>e?fe(E,e,t):"",De={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(de.isAbs(t))return t;var i;if(i=-100===e?Te.cwd():De.getStreamFromFD(e).path,0==t.length){if(!r)throw new Te.ErrnoError(44);return i}return de.join2(i,t)},doStat(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&de.normalize(t)!==de.normalize(Te.getPath(e.node)))return-54;throw e}U[r>>2]=i.dev,U[r+4>>2]=i.mode,x[r+8>>2]=i.nlink,U[r+12>>2]=i.uid,U[r+16>>2]=i.gid,U[r+20>>2]=i.rdev,K=[i.size>>>0,(Y=i.size,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+24>>2]=K[0],U[r+28>>2]=K[1],U[r+32>>2]=4096,U[r+36>>2]=i.blocks;var s=i.atime.getTime(),n=i.mtime.getTime(),a=i.ctime.getTime();return K=[Math.floor(s/1e3)>>>0,(Y=Math.floor(s/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+40>>2]=K[0],U[r+44>>2]=K[1],x[r+48>>2]=s%1e3*1e3,K=[Math.floor(n/1e3)>>>0,(Y=Math.floor(n/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+56>>2]=K[0],U[r+60>>2]=K[1],x[r+64>>2]=n%1e3*1e3,K=[Math.floor(a/1e3)>>>0,(Y=Math.floor(a/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+72>>2]=K[0],U[r+76>>2]=K[1],x[r+80>>2]=a%1e3*1e3,K=[i.ino>>>0,(Y=i.ino,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+88>>2]=K[0],U[r+92>>2]=K[1],0},doMsync(e,t,r,i,s){if(!Te.isFile(t.node.mode))throw new Te.ErrnoError(43);if(2&i)return 0;var n=E.slice(e,e+r);Te.msync(t,n,s,r,i)},varargs:void 0,get(){var e=U[+De.varargs>>2];return De.varargs+=4,e},getp:()=>De.get(),getStr:e=>Ce(e),getStreamFromFD:e=>Te.getStreamChecked(e)};function Le(e,t,r){De.varargs=r;try{var i=De.getStreamFromFD(e);switch(t){case 0:if((s=De.get())<0)return-28;for(;Te.streams[s];)s++;return Te.createStream(i,s).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var s=De.get();return i.flags|=s,0;case 5:return s=De.getp(),A[s+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return oe(28),-1}}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}function Ie(e,t,r,i){De.varargs=i;try{t=De.getStr(t),t=De.calculateAt(e,t);var s=i?De.get():0;return Te.open(t,r,s).fd}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}var Fe,Pe,Me,Re=(e,t,r,i,s)=>{},ze=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Fe=e},Ne=e=>{for(var t="",r=e;E[r];)t+=Fe[E[r++]];return t},Oe={},Ge={},$e={},He=e=>{throw new Pe(e)},Ve=e=>{throw new Me(e)},We=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&Ve("Mismatched type converter count");for(var s=0;s{Ge.hasOwnProperty(e)?s[t]=Ge[e]:(n.push(e),Oe.hasOwnProperty(e)||(Oe[e]=[]),Oe[e].push((()=>{s[t]=Ge[e],++a===n.length&&i(s)})))})),0===n.length&&i(s)};function je(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||He(`type "${i}" must have a positive integer typeid pointer`),Ge.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;He(`Cannot register type '${i}' twice`)}if(Ge[e]=t,delete $e[e],Oe.hasOwnProperty(e)){var s=Oe[e];delete Oe[e],s.forEach((e=>e()))}}function qe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return je(e,t,r)}var Ye,Ke=8,Xe=(e,t,r,i)=>{qe(e,{name:t=Ne(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:Ke,readValueFromPointer:function(e){return this.fromWireType(E[e])},destructorFunction:null})},Ze=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Je=e=>{He(e.$$.ptrType.registeredClass.name+" instance already deleted")},Qe=!1,et=e=>{},tt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},rt=e=>{e.count.value-=1,0===e.count.value&&tt(e)},it=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=it(e,t,r.baseClass);return null===i?null:r.downcast(i)},st={},nt=()=>Object.keys(ut).length,at=()=>{var e=[];for(var t in ut)ut.hasOwnProperty(t)&&e.push(ut[t]);return e},ot=[],dt=()=>{for(;ot.length;){var e=ot.pop();e.$$.deleteScheduled=!1,e.delete()}},lt=e=>{Ye=e,ot.length&&Ye&&Ye(dt)},ct=()=>{s.getInheritedInstanceCount=nt,s.getLiveInheritedInstances=at,s.flushPendingDeletes=dt,s.setDelayFunction=lt},ut={},ht=(e,t)=>{for(void 0===t&&He("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},ft=(e,t)=>(t=ht(e,t),ut[t]),pt=(e,t)=>(t.ptrType&&t.ptr||Ve("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&Ve("Both smartPtrType and smartPtr must be specified"),t.count={value:1},_t(Object.create(e,{$$:{value:t}})));function mt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ft(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function s(){return this.isSmartPointer?pt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):pt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var n,a=this.registeredClass.getActualType(t),o=st[a];if(!o)return s.call(this);n=this.isConst?o.constPointerType:o.pointerType;var d=it(t,this.registeredClass,n.registeredClass);return null===d?s.call(this):this.isSmartPointer?pt(n.registeredClass.instancePrototype,{ptrType:n,ptr:d,smartPtrType:this,smartPtr:e}):pt(n.registeredClass.instancePrototype,{ptrType:n,ptr:d})}var _t=e=>"undefined"==typeof FinalizationRegistry?(_t=e=>e,e):(Qe=new FinalizationRegistry((e=>{rt(e.$$)})),_t=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};Qe.register(e,r,e)}return e},et=e=>Qe.unregister(e),_t(e)),gt=()=>{Object.assign(yt.prototype,{isAliasOf(e){if(!(this instanceof yt))return!1;if(!(e instanceof yt))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,s=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)s=i.upcast(s),i=i.baseClass;return t===i&&r===s},clone(){if(this.$$.ptr||Je(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=_t(Object.create(Object.getPrototypeOf(this),{$$:{value:Ze(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),et(this),rt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),ot.push(this),1===ot.length&&Ye&&Ye(dt),this.$$.deleteScheduled=!0,this}})};function yt(){}var vt=(e,t)=>Object.defineProperty(t,"name",{value:e}),bt=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||He(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},wt=(e,t,r)=>{s.hasOwnProperty(e)?((void 0===r||void 0!==s[e].overloadTable&&void 0!==s[e].overloadTable[r])&&He(`Cannot register public name '${e}' twice`),bt(s,e,e),s.hasOwnProperty(r)&&He(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),s[e].overloadTable[r]=t):(s[e]=t,void 0!==r&&(s[e].numArguments=r))},St=48,Et=57,At=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=St&&t<=Et?`_${e}`:e};function Bt(e,t,r,i,s,n,a,o){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=s,this.getActualType=n,this.upcast=a,this.downcast=o,this.pureVirtualFunctions=[]}var Ut=(e,t,r)=>{for(;t!==r;)t.upcast||He(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function xt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ut(t.$$.ptr,r,this.registeredClass)}function kt(e,t){var r;if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=Ut(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&He("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var s=t.clone();r=this.rawShare(r,nr.toHandle((()=>s.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:He("Unsupporting sharing policy")}return r}function Tt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ut(t.$$.ptr,r,this.registeredClass)}function Ct(e){return this.fromWireType(x[e>>2])}var Dt=()=>{Object.assign(Lt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:Ke,readValueFromPointer:Ct,deleteObject(e){null!==e&&e.delete()},fromWireType:mt})};function Lt(e,t,r,i,s,n,a,o,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=s,this.pointeeType=n,this.sharingPolicy=a,this.rawGetPointee=o,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,s||void 0!==t.baseClass?this.toWireType=kt:i?(this.toWireType=xt,this.destructorFunction=null):(this.toWireType=Tt,this.destructorFunction=null)}var It,Ft,Pt=(e,t,r)=>{s.hasOwnProperty(e)||Ve("Replacing nonexistant public symbol"),void 0!==s[e].overloadTable&&void 0!==r?s[e].overloadTable[r]=t:(s[e]=t,s[e].argCount=r)},Mt=(e,t,r)=>{var i=s["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},Rt=[],zt=e=>{var t=Rt[e];return t||(e>=Rt.length&&(Rt.length=e+1),Rt[e]=t=It.get(e)),t},Nt=(e,t,r)=>e.includes("j")?Mt(e,t,r):zt(t).apply(null,r),Ot=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),Nt(e,t,r)}},Gt=(e,t)=>{var r=(e=Ne(e)).includes("j")?Ot(e,t):zt(t);return"function"!=typeof r&&He(`unknown function pointer with signature ${e}: ${t}`),r},$t=(e,t)=>{var r=vt(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},Ht=e=>{var t=di(e),r=Ne(t);return ai(t),r},Vt=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Ge[t]||($e[t]?$e[t].forEach(e):(r.push(t),i[t]=!0))})),new Ft(`${e}: `+r.map(Ht).join([", "]))},Wt=(e,t,r,i,s,n,a,o,d,l,c,u,h)=>{c=Ne(c),n=Gt(s,n),o&&(o=Gt(a,o)),l&&(l=Gt(d,l)),h=Gt(u,h);var f=At(c);wt(f,(function(){Vt(`Cannot construct ${c} due to unbound types`,[i])})),We([e,t,r],i?[i]:[],(function(t){var r,s;t=t[0],s=i?(r=t.registeredClass).instancePrototype:yt.prototype;var a=vt(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new Pe("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new Pe(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new Pe(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(s,{constructor:{value:a}});a.prototype=d;var u=new Bt(c,a,d,h,r,n,o,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new Lt(c,u,!0,!1,!1),m=new Lt(c+"*",u,!1,!1,!1),_=new Lt(c+" const*",u,!1,!0,!1);return st[e]={pointerType:m,constPointerType:_},Pt(f,a),[p,m,_]}))},jt=(e,t)=>{for(var r=[],i=0;i>2]);return r},qt=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Yt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=vt(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,s=e.apply(i,t);return s instanceof Object?s:i}function Kt(e,t,r,i,s,n){var a=t.length;a<2&&He("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||n?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=o?1:2;l{var a=jt(t,r);s=Gt(i,s),We([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Pe(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Vt(`Cannot construct ${e.name} due to unbound types`,a)},We([],a,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Kt(r,i,null,s,n),[]))),[]}))},Zt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Jt=(e,t,r,i,s,n,a,o,d)=>{var l=jt(r,i);t=Ne(t),t=Zt(t),n=Gt(s,n),We([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function s(){Vt(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(s.argCount=r-2,s.className=e.name,c[t]=s):(bt(c,t,i),c[t].overloadTable[r-2]=s),We([],l,(function(s){var o=Kt(i,s,e,n,a,d);return void 0===c[t].overloadTable?(o.argCount=r-2,c[t]=o):c[t].overloadTable[r-2]=o,[]})),[]}))};function Qt(){Object.assign(er.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function er(){this.allocated=[void 0],this.freelist=[]}var tr=new er,rr=e=>{e>=tr.reserved&&0==--tr.get(e).refcount&&tr.free(e)},ir=()=>{for(var e=0,t=tr.reserved;t{tr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),tr.reserved=tr.allocated.length,s.count_emval_handles=ir},nr={toValue:e=>(e||He("Cannot use deleted val. handle = "+e),tr.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return tr.allocate({refcount:1,value:e})}}};function ar(e){return this.fromWireType(U[e>>2])}var or=(e,t)=>{qe(e,{name:t=Ne(t),fromWireType:e=>{var t=nr.toValue(e);return rr(e),t},toWireType:(e,t)=>nr.toHandle(t),argPackAdvance:Ke,readValueFromPointer:ar,destructorFunction:null})},dr=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},lr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(k[e>>2])};case 8:return function(e){return this.fromWireType(T[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},cr=(e,t,r)=>{qe(e,{name:t=Ne(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Ke,readValueFromPointer:lr(t,r),destructorFunction:null})},ur=(e,t,r)=>{switch(t){case 1:return r?e=>S[e>>0]:e=>E[e>>0];case 2:return r?e=>A[e>>1]:e=>B[e>>1];case 4:return r?e=>U[e>>2]:e=>x[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},hr=(e,t,r,i,s)=>{t=Ne(t);var n=e=>e;if(0===i){var a=32-8*r;n=e=>e<>>a}var o=t.includes("unsigned");qe(e,{name:t,fromWireType:n,toWireType:o?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:Ke,readValueFromPointer:ur(t,r,0!==i),destructorFunction:null})},fr=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function s(e){var t=x[e>>2],r=x[e+4>>2];return new i(S.buffer,r,t)}qe(e,{name:r=Ne(r),fromWireType:s,argPackAdvance:Ke,readValueFromPointer:s},{ignoreDuplicateRegistrations:!0})},pr=(e,t,r)=>_e(e,E,t,r),mr=(e,t)=>{var r="std::string"===(t=Ne(t));qe(e,{name:t,fromWireType(e){var t,i=x[e>>2],s=e+4;if(r)for(var n=s,a=0;a<=i;++a){var o=s+a;if(a==i||0==E[o]){var d=Ce(n,o-n);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),n=o+1}}else{var l=new Array(i);for(a=0;a>2]=i,r&&s)pr(t,a,i+1);else if(s)for(var o=0;o255&&(ai(a),He("String has UTF-16 code units that do not fit in 8 bits")),E[a+o]=d}else for(o=0;o{for(var r=e,i=r>>1,s=i+t/2;!(i>=s)&&B[i];)++i;if((r=i<<1)-e>32&&_r)return _r.decode(E.subarray(e,r));for(var n="",a=0;!(a>=t/2);++a){var o=A[e+2*a>>1];if(0==o)break;n+=String.fromCharCode(o)}return n},yr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,s=(r-=2)<2*e.length?r/2:e.length,n=0;n>1]=a,t+=2}return A[t>>1]=0,t-i},vr=e=>2*e.length,br=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var s=U[e+4*r>>2];if(0==s)break;if(++r,s>=65536){var n=s-65536;i+=String.fromCharCode(55296|n>>10,56320|1023&n)}else i+=String.fromCharCode(s)}return i},wr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,s=i+r-4,n=0;n=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++n)),U[t>>2]=a,(t+=4)+4>s)break}return U[t>>2]=0,t-i},Sr=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},Er=(e,t,r)=>{var i,s,n,a,o;r=Ne(r),2===t?(i=gr,s=yr,a=vr,n=()=>B,o=1):4===t&&(i=br,s=wr,a=Sr,n=()=>x,o=2),qe(e,{name:r,fromWireType:e=>{for(var r,s=x[e>>2],a=n(),d=e+4,l=0;l<=s;++l){var c=e+4+l*t;if(l==s||0==a[c>>o]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return ai(e),r},toWireType:(e,i)=>{"string"!=typeof i&&He(`Cannot pass non-string to C++ string type ${r}`);var n=a(i),d=li(4+n+t);return x[d>>2]=n>>o,s(i,d+4,n+t),null!==e&&e.push(ai,d),d},argPackAdvance:Ke,readValueFromPointer:ar,destructorFunction(e){ai(e)}})},Ar=(e,t)=>{qe(e,{isVoid:!0,name:t=Ne(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},Br={},Ur=e=>{var t=Br[e];return void 0===t?Ne(e):t},xr=[],kr=(e,t,r,i,s)=>(e=xr[e])(t=nr.toValue(t),t[r=Ur(r)],i,s),Tr=e=>{var t=xr.length;return xr.push(e),t},Cr=(e,t)=>{var r=Ge[e];return void 0===r&&He(t+" has unknown type "+Ht(e)),r},Dr=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},Lr=(e,t,r)=>{var i=[],s=e.toWireType(i,r);return i.length&&(x[t>>2]=nr.toHandle(i)),s},Ir=(e,t,r)=>{var i=Dr(e,t),s=i.shift();e--;var n="return function (obj, func, destructorsRef, args) {\n",a=0,o=[];0===r&&o.push("obj");for(var d=["retType"],l=[s],c=0;ce.name)).join(", ")}) => ${s.name}>`;return Tr(vt(h,u))},Fr=e=>{var t=nr.toValue(e);qt(t),rr(e)},Pr=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,Mr=()=>{j("")},Rr=()=>Date.now(),zr=(e,t,r)=>E.copyWithin(e,t,t+r),Nr=e=>{j("OOM")},Or=e=>{E.length,Nr()},Gr={},$r=()=>l||"./this.program",Hr=()=>{if(!Hr.strings){var e={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",_:$r()};for(var t in Gr)void 0===Gr[t]?delete e[t]:e[t]=Gr[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Hr.strings=r}return Hr.strings},Vr=(e,t)=>{for(var r=0;r>0]=e.charCodeAt(r);S[t>>0]=0},Wr=(e,t)=>{var r=0;return Hr().forEach(((i,s)=>{var n=t+r;x[e+4*s>>2]=n,Vr(i,n),r+=i.length+1})),0},jr=(e,t)=>{var r=Hr();x[e>>2]=r.length;var i=0;return r.forEach((e=>i+=e.length+1)),x[t>>2]=i,0};function qr(e){try{var t=De.getStreamFromFD(e);return Te.close(t),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Yr(e,t){try{var r=De.getStreamFromFD(e),i=r.tty?2:Te.isDir(r.mode)?3:Te.isLink(r.mode)?7:4;return S[t>>0]=i,A[t+2>>1]=0,K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[t+8>>2]=K[0],U[t+12>>2]=K[1],K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[t+16>>2]=K[0],U[t+20>>2]=K[1],0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Kr=(e,t,r,i)=>{for(var s=0,n=0;n>2],o=x[t+4>>2];t+=8;var d=Te.read(e,S,a,o,i);if(d<0)return-1;if(s+=d,d>2]=n,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Zr(e,t,r,i,s){var n=Pr(t,r);try{if(isNaN(n))return 61;var a=De.getStreamFromFD(e);return Te.llseek(a,n,i),K=[a.position>>>0,(Y=a.position,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[s>>2]=K[0],U[s+4>>2]=K[1],a.getdents&&0===n&&0===i&&(a.getdents=null),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Jr=(e,t,r,i)=>{for(var s=0,n=0;n>2],o=x[t+4>>2];t+=8;var d=Te.write(e,S,a,o,i);if(d<0)return-1;s+=d,void 0!==i&&(i+=d)}return s};function Qr(e,t,r,i){try{var s=De.getStreamFromFD(e),n=Jr(s,t,r);return x[i>>2]=n,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var ei=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=Te.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},ti=365,ri=146;Object.defineProperties(ei.prototype,{read:{get:function(){return(this.mode&ti)===ti},set:function(e){e?this.mode|=ti:this.mode&=~ti}},write:{get:function(){return(this.mode&ri)===ri},set:function(e){e?this.mode|=ri:this.mode&=~ri}},isFolder:{get:function(){return Te.isDir(this.mode)}},isDevice:{get:function(){return Te.isChrdev(this.mode)}}}),Te.FSNode=ei,Te.createPreloadedFile=Ue,Te.staticInit(),ze(),Pe=s.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Me=s.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},gt(),ct(),Dt(),Ft=s.UnboundTypeError=$t(Error,"UnboundTypeError"),Qt(),sr();var ii,si={o:ae,A:Le,s:Ie,q:Re,C:Xe,D:Wt,y:Xt,h:Jt,B:or,l:cr,c:hr,b:fr,m:mr,j:Er,n:Ar,f:kr,g:rr,e:Ir,d:Fr,a:Mr,i:Rr,w:zr,r:Or,u:Wr,v:jr,k:qr,t:Yr,z:Xr,p:Zr,x:Qr},ni=ie(),ai=e=>(ai=ni.G)(e),oi=()=>(oi=ni.I)(),di=e=>(di=ni.J)(e),li=e=>(li=ni.K)(e),ci=e=>(ci=ni.M)(e);function ui(){function e(){ii||(ii=!0,s.calledRun=!0,C||(R(),t(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),z()))}$>0||(M(),$>0||(s.setStatus?(s.setStatus("Running..."),setTimeout((function(){setTimeout((function(){s.setStatus("")}),1),e()}),1)):e()))}if(s.dynCall_viiijj=(e,t,r,i,n,a,o,d)=>(s.dynCall_viiijj=ni.N)(e,t,r,i,n,a,o,d),s.dynCall_jij=(e,t,r,i)=>(s.dynCall_jij=ni.O)(e,t,r,i),s.dynCall_jii=(e,t,r)=>(s.dynCall_jii=ni.P)(e,t,r),s.dynCall_jiji=(e,t,r,i,n)=>(s.dynCall_jiji=ni.Q)(e,t,r,i,n),H=function e(){ii||ui(),ii||(H=e)},s.preInit)for("function"==typeof s.preInit&&(s.preInit=[s.preInit]);s.preInit.length>0;)s.preInit.pop()();return ui(),e.ready}),a=1e-6,o="undefined"!=typeof Float32Array?Float32Array:Array;function d(){var e=new o(16);return o!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function l(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var c,u=function(e,t,r,i,s,n,a){var o=1/(t-r),d=1/(i-s),l=1/(n-a);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*d,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*o,e[13]=(s+i)*d,e[14]=(a+n)*l,e[15]=1,e};function h(e,t,r){var i=new o(3);return i[0]=e,i[1]=t,i[2]=r,i}c=new o(3),o!=Float32Array&&(c[0]=0,c[1]=0,c[2]=0);var f=(e,t)=>{t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);const r=function(){const t=m(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),r=m(e.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))return console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(i)),null;return i}();let i={program:r,attribLocations:{vertexPosition:e.getAttribLocation(r,"aVertexPosition"),texturePosition:e.getAttribLocation(r,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(r,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(r,"uModelMatrix"),viewMatrix:e.getUniformLocation(r,"uViewMatrix"),rgbatexture:e.getUniformLocation(r,"rgbaTexture"),ytexture:e.getUniformLocation(r,"yTexture"),utexture:e.getUniformLocation(r,"uTexture"),vtexture:e.getUniformLocation(r,"vTexture"),isyuv:e.getUniformLocation(r,"isyuv")}},s=function(){const t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),e.STATIC_DRAW);var r=[];r=r.concat([0,1],[1,1],[1,0],[0,0]);const i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW);const s=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,s);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,texPosition:i,indices:s}}(),n=p(),o=p(),c=p(),f=p();function p(){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function m(t,r){const i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(console.log("An error occurred compiling the shaders: "+e.getShaderInfoLog(i)),e.deleteShader(i),null)}function _(t,r){e.viewport(0,0,t,r),e.clearColor(0,0,0,0),e.clearDepth(1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);const n=d();u(n,-1,1,-1,1,.1,100);const p=d();l(p);const m=d();!function(e,t,r,i){var s,n,o,d,c,u,h,f,p,m,_=t[0],g=t[1],y=t[2],v=i[0],b=i[1],w=i[2],S=r[0],E=r[1],A=r[2];Math.abs(_-S)32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let r=e-this._current_word_bits_left;this._fillCurrentWord();let i=Math.min(r,this._current_word_bits_left),s=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Ht=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Vt=Ht,Wt=Ht;function jt(e){let{profile:t,sampleRate:r,channel:i}=e;return new Uint8Array([175,0,t<<3|(14&r)>>1,(1&r)<<7|i<<3])}function qt(e){return Yt(e)&&e[1]===Ut}function Yt(e){return e[0]>>4===Ne}const Kt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Xt(e){let t=new Uint8Array(e),r=null,i=0,s=0,n=0,a=null;if(i=s=t[0]>>>3,n=(7&t[0])<<1|t[1]>>>7,n<0||n>=Kt.length)return void console.error("Flv: AAC invalid sampling frequency index!");let o=Kt[n],d=(120&t[1])>>>3;if(d<0||d>=8)return void console.log("Flv: AAC invalid channel configuration");5===i&&(a=(7&t[1])<<1|t[2]>>>7,t[2]);let l=Nt.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?n>=6?(i=5,r=new Array(4),a=n-3):(i=2,r=new Array(2),a=n):-1!==l.indexOf("android")?(i=2,r=new Array(2),a=n):(i=5,a=n,r=new Array(4),n>=6?a=n-3:1===d&&(i=2,r=new Array(2),a=n)),r[0]=i<<3,r[0]|=(15&n)>>>1,r[1]=(15&n)<<7,r[1]|=(15&d)<<3,5===i&&(r[1]|=(15&a)>>>1,r[2]=(1&a)<<7,r[2]|=8,r[3]=0),{audioType:"aac",config:r,sampleRate:o,channelCount:d,objectType:i,codec:"mp4a.40."+i,originalCodec:"mp4a.40."+s}}class Zt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+7>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(4095===(r[t+0]<<8|r[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let r=this.current_syncword_offset_,i=(8&e[r+1])>>>3,s=(6&e[r+1])>>>1,n=1&e[r+1],a=(192&e[r+2])>>>6,o=(60&e[r+2])>>>2,d=(1&e[r+2])<<2|(192&e[r+3])>>>6,l=(3&e[r+3])<<11|e[r+4]<<3|(224&e[r+5])>>>5;if(e[r+6],r+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let c=1===n?7:9,u=l-c;r+=c;let h=this.findNextSyncwordOffset(r+u);if(this.current_syncword_offset_=h,0!==i&&1!==i||0!==s)continue;let f=e.subarray(r,r+u);t={},t.audio_object_type=a+1,t.sampling_freq_index=o,t.sampling_frequency=Vt[o],t.channel_config=d,t.data=f}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Jt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+1>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(695===(r[t+0]<<3|r[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),r=0;for(let i=0;i<=t;i++)r<<=8,r|=e.readByte();return r}readNextAACFrame(e){let t=this.data_,r=null;for(;null==r&&!this.eof_flag_;){let i=this.current_syncword_offset_,s=(31&t[i+1])<<8|t[i+2];if(i+3+s>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let n=new $t(t.subarray(i+3,i+3+s)),a=null;if(n.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(i+3+s),n.destroy();continue}a=e}else{let e=n.readBool();if(e&&n.readBool()){console.error("audioMuxVersionA is Not Supported"),n.destroy();break}if(e&&this.getLATMValue(n),!n.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),n.destroy();break}if(0!==n.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),n.destroy();break}if(0!==n.readBits(4)){console.error("more than 2 numProgram Not Supported"),n.destroy();break}if(0!==n.readBits(3)){console.error("more than 2 numLayer Not Supported"),n.destroy();break}let t=e?this.getLATMValue(n):0,r=n.readBits(5);t-=5;let i=n.readBits(4);t-=4;let s=n.readBits(4);t-=4,n.readBits(3),t-=3,t>0&&n.readBits(t);let o=n.readBits(3);if(0!==o){console.error(`frameLengthType = ${o}. Only frameLengthType = 0 Supported`),n.destroy();break}n.readByte();let d=n.readBool();if(d)if(e)this.getLATMValue(n);else{let e=0;for(;;){e<<=8;let t=n.readBool();if(e+=n.readByte(),!t)break}console.log(e)}n.readBool()&&n.readByte(),a={},a.audio_object_type=r,a.sampling_freq_index=i,a.sampling_frequency=Vt[a.sampling_freq_index],a.channel_config=s,a.other_data_present=d}let o=0;for(;;){let e=n.readByte();if(o+=e,255!==e)break}let d=new Uint8Array(o);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function er(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return[];const r=e.length,i=[];let s,n=0;for(;n+t>>=8),n+=t,s){if(n+s>r)break;i.push(e.subarray(n,n+s)),n+=s}return i}function tr(e){const t=e.byteLength,r=new Uint8Array(4);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t;const i=new Uint8Array(t+4);return i.set(r,0),i.set(e,4),i}function rr(e,t){let r=null;return t?e.length>=28&&(r=1+(3&e[26])):e.length>=12&&(r=1+(3&e[9])),r}function ir(){return(new Date).getTime()}function sr(e,t,r){return Math.max(Math.min(e,Math.max(t,r)),Math.min(t,r))}function nr(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function ar(e){let t=0,r=nr();return i=>{if(s=i,"[object Number]"!==Object.prototype.toString.call(s))return;var s;t+=i;const n=nr(),a=n-r;a>=1e3&&(e(t/a*1e3),r=n,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();function or(e){return null==e}function dr(e){return!or(e)}function lr(e){return"function"==typeof e}function cr(e){let t=null,r=31&e[0];return r!==He&&r!==Ve||(t=Re),t||(r=(126&e[0])>>1,r!==st&&r!==at&&r!==dt||(t=ze)),t}function ur(){return"undefined"!=typeof WritableStream}function hr(e){e.close()}function fr(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let r=e[0],i=null,s=1;if(e.length>0){let t=e[1];t&&t.ts-r.ts>1e5&&(r=t,s=2)}if(r)for(let n=s;n=1e3){e[n-1].ts-r.ts<1e3&&(i=n+1)}}}return i}function pr(e){return e.ok&&e.status>=200&&e.status<=299}function mr(){return function(e){let t="";if("object"==typeof e)try{t=JSON.stringify(e),t=JSON.parse(t)}catch(r){t=e}else t=e;return t}(U)}function _r(e){return e[0]>>4===xt&&e[1]===Ut}function gr(e){return!0===e||"true"===e}function yr(e){return!0!==e&&"true"!==e}function vr(){return!!(Nt.Worker&&Nt.MediaSource&&"canConstructInDedicatedWorker"in Nt.MediaSource&&!0===Nt.MediaSource.canConstructInDedicatedWorker)}function br(e,t){const r=er(e.slice(5));let i=!1;return r.forEach((e=>{const r=t?e[0]>>>1&63:31&e[0];(t&&(r===Je||r===et||r===rt)||yr(t)&&r===We)&&(i=!0)})),i}var wr=function(e,t,r,i){return new(r||(r=Promise))((function(s,n){function a(e){try{d(i.next(e))}catch(e){n(e)}}function o(e){try{d(i.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}d((i=i.apply(e,t||[])).next())}))};const Sr=Symbol(32),Er=Symbol(16),Ar=Symbol(8);class Br{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return wr(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,r)=>{var i;this.reject=r,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(i=this.pull)||void 0===i||i.call(this,e)}))}))}readU32(){return this.read(Sr)}readU16(){return this.read(Er)}readU8(){return this.read(Ar)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let r=0;const i=e=>t.length<(r=e);if("number"==typeof this.need){if(i(this.need))return;e=t.subarray(0,r)}else if(this.need===Sr){if(i(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Er){if(i(2))return;e=t[0]<<8|t[1]}else if(this.need===Ar){if(i(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(i(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,r)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(i(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,r)),e=this.need}return this.consumed+=r,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,r=t+e;if(r<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,r);else{const e=new Uint8Array(r);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,r)}return this.buffer=new Uint8Array(e),this.buffer}}Br.U32=Sr,Br.U16=Er,Br.U8=Ar;class Ur{constructor(e){this.log=function(t){if(e._opt.debugLevel==w){const n=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s1?r-1:0),s=1;s1?i-1:0),n=1;n=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[s]=t[e],s++);return new Uint8Array(i.buffer,0,s)}static parseSPS(e){let t=xr._ebsp2rbsp(e),r=new $t(t);r.readByte();let i=r.readByte();r.readByte();let s=r.readByte();r.readUEG();let n=xr.getProfileString(i),a=xr.getLevelString(s),o=1,d=420,l=[0,420,422,444],c=8;if((100===i||110===i||122===i||244===i||44===i||83===i||86===i||118===i||128===i||138===i||144===i)&&(o=r.readUEG(),3===o&&r.readBits(1),o<=3&&(d=l[o]),c=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool())){let e=3!==o?8:12;for(let t=0;t0&&e<16?(b=t[e-1],w=i[e-1]):255===e&&(b=r.readByte()<<8|r.readByte(),w=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);E=r.readBool(),A=t,B=2*e,S=A/B}}let U=1;1===b&&1===w||(U=b/w);let x=0,k=0;if(0===o)x=1,k=2-m;else{x=3===o?1:2,k=(1===o?2:1)*(2-m)}let T=16*(f+1),C=16*(p+1)*(2-m);T-=(_+g)*x,C-=(y+v)*k;let D=Math.ceil(T*U);return r.destroy(),r=null,{profile_string:n,level_string:a,bit_depth:c,ref_frames:h,chroma_format:d,chroma_format_string:xr.getChromaFormatString(d),frame_rate:{fixed:E,fps:S,fps_den:B,fps_num:A},sar_ratio:{width:b,height:w},codec_size:{width:T,height:C},present_size:{width:D,height:C}}}static parseSPS$2(e){let t=e.subarray(1,4),r="avc1.";for(let e=0;e<3;e++){let i=t[e].toString(16);i.length<2&&(i="0"+i),r+=i}let i=xr._ebsp2rbsp(e),s=new $t(i);s.readByte();let n=s.readByte();s.readByte();let a=s.readByte();s.readUEG();let o=xr.getProfileString(n),d=xr.getLevelString(a),l=1,c=420,u=[0,420,422,444],h=8,f=8;if((100===n||110===n||122===n||244===n||44===n||83===n||86===n||118===n||128===n||138===n||144===n)&&(l=s.readUEG(),3===l&&s.readBits(1),l<=3&&(c=u[l]),h=s.readUEG()+8,f=s.readUEG()+8,s.readBits(1),s.readBool())){let e=3!==l?8:12;for(let t=0;t0&&e<16?(E=t[e-1],A=r[e-1]):255===e&&(E=s.readByte()<<8|s.readByte(),A=s.readByte()<<8|s.readByte())}if(s.readBool()&&s.readBool(),s.readBool()&&(s.readBits(4),s.readBool()&&s.readBits(24)),s.readBool()&&(s.readUEG(),s.readUEG()),s.readBool()){let e=s.readBits(32),t=s.readBits(32);U=s.readBool(),x=t,k=2*e,B=x/k}}let T=1;1===E&&1===A||(T=E/A);let C=0,D=0;if(0===l)C=1,D=2-y;else{C=3===l?1:2,D=(1===l?2:1)*(2-y)}let L=16*(_+1),I=16*(g+1)*(2-y);L-=(v+b)*C,I-=(w+S)*D;let F=Math.ceil(L*T);return s.destroy(),s=null,{codec_mimetype:r,profile_idc:n,level_idc:a,profile_string:o,level_string:d,chroma_format_idc:l,bit_depth:h,bit_depth_luma:h,bit_depth_chroma:f,ref_frames:m,chroma_format:c,chroma_format_string:xr.getChromaFormatString(c),frame_rate:{fixed:U,fps:B,fps_den:k,fps_num:x},sar_ratio:{width:E,height:A},codec_size:{width:L,height:I},present_size:{width:F,height:I}}}static _skipScalingList(e,t){let r=8,i=8,s=0;for(let n=0;n=this.buflen)return this.iserro=!0,0;this.iserro=!1,r=this.bufoff+e>8?8-this.bufoff:e,t<<=r,t+=this.buffer[this.bufpos]>>8-this.bufoff-r&255>>8-r,this.bufoff+=r,e-=r,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,r=this.bufoff,i=this.read(e);return this.bufpos=t,this.bufoff=r,i}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.sps,4),t.sps=i}if(t.pps){const e=t.pps.byteLength,r=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.pps,4),t.pps=i}return t}function Cr(e){let{sps:t,pps:r}=e;const i=[23,0,0,0,0,1,66,0,30,255];i[0]=23,i[6]=t[1],i[7]=t[2],i[8]=t[3],i[10]=225,i[11]=t.byteLength>>8&255,i[12]=255&t.byteLength,i.push(...t,1,r.byteLength>>8&255,255&r.byteLength,...r);return new Uint8Array(i)}function Dr(e){let{sps:t,pps:r}=e,i=8+t.byteLength+1+2+r.byteLength,s=!1;const n=xr.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(s=!0,i+=4);let a=new Uint8Array(i);a[0]=1,a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=255,a[5]=225;let o=t.byteLength;a[6]=o>>>8,a[7]=255&o;let d=8;a.set(t,8),d+=o,a[d]=1;let l=r.byteLength;a[d+1]=l>>>8,a[d+2]=255&l,a.set(r,d+3),d+=3+l,s&&(a[d]=252|n.chroma_format_idc,a[d+1]=248|n.bit_depth_luma-8,a[d+2]=248|n.bit_depth_chroma-8,a[d+3]=0,d+=4);const c=[23,0,0,0,0],u=new Uint8Array(c.length+a.byteLength);return u.set(c,0),u.set(a,c.length),u}function Lr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Ir(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Fr(e){return 31&e[0]}function Pr(e){return e===Ye}function Mr(e){return!function(e){return e===He||e===Ve}(e)&&!Pr(e)}function Rr(e){return e===We}function zr(e){if(0===e.length)return!1;const t=Fr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=31&e[r],s=(128&e[r])>>>7,n=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=n,i>=Ze||0===s&&(t={type:i,data:e.subarray(r,n)})}return t}}class Or{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Gr=e=>{let t=e,r=t.byteLength,i=new Uint8Array(r),s=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[s]=t[e],s++);return new Uint8Array(i.buffer,0,s)},$r=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Hr{static _ebsp2rbsp(e){let t=e,r=t.byteLength,i=new Uint8Array(r),s=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[s]=t[e],s++);return new Uint8Array(i.buffer,0,s)}static parseVPS(e){let t=Hr._ebsp2rbsp(e),r=new $t(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}}static parseSPS(e){let t=Hr._ebsp2rbsp(e),r=new $t(t);r.readByte(),r.readByte();let i=0,s=0,n=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<=16?(F=t[e-1],P=i[e-1]):255===e&&(F=r.readBits(16),P=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()){r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())}if(r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),L=r.readBool(),L&&(r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG()),r.readBool()){if(R=r.readBits(32),z=r.readBits(32),r.readBool()&&r.readUEG(),r.readBool()){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let s=0;s<=o;s++){let s=r.readBool();M=s;let n=!0,a=1;s||(n=r.readBool());let o=!1;if(n?r.readUEG():o=r.readBool(),o||(a=r.readUEG()+1),e){for(let e=0;e>6&3,r.general_tier_flag=e[1]>>5&1,r.general_profile_idc=31&e[1],r.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],r.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],r.general_constraint_indicator_flags=r.general_constraint_indicator_flags<<16|e[10]<<8|e[11],r.general_level_idc=e[12],r.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],r.parallelismType=3&e[15],r.chromaFormat=3&e[16],r.bitDepthLumaMinus8=7&e[17],r.bitDepthChromaMinus8=7&e[18],r.avgFrameRate=e[19]<<8|e[20],r.constantFrameRate=e[21]>>6&3,r.numTemporalLayers=e[21]>>3&7,r.temporalIdNested=e[21]>>2&1,r.lengthSizeMinusOne=3&e[21];let i=e[22],s=e.slice(23);for(let e=0;e0)for(let t=r;t<8;t++)e.read(2);i.sub_layer_profile_space=[],i.sub_layer_tier_flag=[],i.sub_layer_profile_idc=[],i.sub_layer_profile_compatibility_flag=[],i.sub_layer_progressive_source_flag=[],i.sub_layer_interlaced_source_flag=[],i.sub_layer_non_packed_constraint_flag=[],i.sub_layer_frame_only_constraint_flag=[],i.sub_layer_level_idc=[];for(let t=0;t{let t=Gr(e),r=new $t(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}})(t),a=(e=>{let t=Gr(e),r=new $t(t);r.readByte(),r.readByte();let i=0,s=0,n=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<16?(F=t[e-1],P=i[e-1]):255===e&&(F=r.readBits(16),P=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),L=r.readBool(),L&&(i+=r.readUEG(),s+=r.readUEG(),n+=r.readUEG(),a+=r.readUEG()),r.readBool()&&(R=r.readBits(32),z=r.readBits(32),r.readBool()&&(r.readUEG(),r.readBool()))){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let s=0;s<=o;s++){let s=r.readBool();M=s;let n=!1,a=1;s||(n=r.readBool());let o=!1;if(n?r.readSEG():o=r.readBool(),o||(cpbcnt=r.readUEG()+1),e)for(let e=0;e{let t=Gr(e),r=new $t(t);r.readByte(),r.readByte(),r.readUEG(),r.readUEG(),r.readBool(),r.readBool(),r.readBits(3),r.readBool(),r.readBool(),r.readUEG(),r.readUEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool()&&r.readUEG(),r.readSEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool(),r.readBool();let i=r.readBool(),s=r.readBool(),n=1;return s&&i?n=0:s?n=3:i&&(n=2),{parallelismType:n}})(r);s=Object.assign(s,n,a,o);let d=23+(5+t.byteLength)+(5+i.byteLength)+(5+r.byteLength),l=new Uint8Array(d);l[0]=1,l[1]=(3&s.general_profile_space)<<6|(s.general_tier_flag?1:0)<<5|31&s.general_profile_idc,l[2]=s.general_profile_compatibility_flags_1||0,l[3]=s.general_profile_compatibility_flags_2||0,l[4]=s.general_profile_compatibility_flags_3||0,l[5]=s.general_profile_compatibility_flags_4||0,l[6]=s.general_constraint_indicator_flags_1||0,l[7]=s.general_constraint_indicator_flags_2||0,l[8]=s.general_constraint_indicator_flags_3||0,l[9]=s.general_constraint_indicator_flags_4||0,l[10]=s.general_constraint_indicator_flags_5||0,l[11]=s.general_constraint_indicator_flags_6||0,l[12]=60,l[13]=240|(3840&s.min_spatial_segmentation_idc)>>8,l[14]=255&s.min_spatial_segmentation_idc,l[15]=252|3&s.parallelismType,l[16]=252|3&s.chroma_format_idc,l[17]=248|7&s.bit_depth_luma_minus8,l[18]=248|7&s.bit_depth_chroma_minus8,l[19]=0,l[20]=0,l[21]=(3&s.constant_frame_rate)<<6|(7&s.num_temporal_layers)<<3|(s.temporal_id_nested?1:0)<<2|3,l[22]=3,l[23]=128|st,l[24]=0,l[25]=1,l[26]=(65280&t.byteLength)>>8,l[27]=(255&t.byteLength)>>0,l.set(t,28),l[23+(5+t.byteLength)+0]=128|at,l[23+(5+t.byteLength)+1]=0,l[23+(5+t.byteLength)+2]=1,l[23+(5+t.byteLength)+3]=(65280&i.byteLength)>>8,l[23+(5+t.byteLength)+4]=(255&i.byteLength)>>0,l.set(i,23+(5+t.byteLength)+5),l[23+(5+t.byteLength+5+i.byteLength)+0]=128|dt,l[23+(5+t.byteLength+5+i.byteLength)+1]=0,l[23+(5+t.byteLength+5+i.byteLength)+2]=1,l[23+(5+t.byteLength+5+i.byteLength)+3]=(65280&r.byteLength)>>8,l[23+(5+t.byteLength+5+i.byteLength)+4]=(255&r.byteLength)>>0,l.set(r,23+(5+t.byteLength+5+i.byteLength)+5);const c=[28,0,0,0,0],u=new Uint8Array(c.length+l.byteLength);return u.set(c,0),u.set(l,c.length),u}function Yr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Kr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Xr(e){return(126&e[0])>>1}function Zr(e){return e===ct}function Jr(e){return!function(e){return e>=32&&e<=40}(e)}function Qr(e){return e>=16&&e<=21}function ei(e){if(0===e.length)return!1;const t=Xr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=e[r]>>1&63,s=(128&e[r])>>>7,n=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=n,0===s&&(t={type:i,data:e.subarray(r,n)})}return t}}class ri{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}function ii(e){return parseInt(e)===e}function si(e){if(!ii(e.length))return!1;for(var t=0;t255)return!1;return!0}function ni(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!si(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(ii(e.length)&&si(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function ai(e){return new Uint8Array(e)}function oi(e,t,r,i,s){null==i&&null==s||(e=e.slice?e.slice(i,s):Array.prototype.slice.call(e,i,s)),t.set(e,r)}var di,li={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},ci=(di="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r>4]+di[15&i])}return t.join("")}}),ui={16:10,24:12,32:14},hi=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],fi=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],pi=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],mi=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],_i=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],gi=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],yi=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],vi=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],bi=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],wi=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Si=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Ei=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Ai=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Bi=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Ui=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function xi(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=n[t],this._Kd[e-r][t%4]=n[t];for(var a,o=0,d=s;d>16&255]<<24^fi[a>>8&255]<<16^fi[255&a]<<8^fi[a>>24&255]^hi[o]<<24,o+=1,8!=s)for(t=1;t>8&255]<<8^fi[a>>16&255]<<16^fi[a>>24&255]<<24;for(t=s/2+1;t>2,c=d%4,this._Ke[l][c]=n[t],this._Kd[e-l][c]=n[t++],d++}for(var l=1;l>24&255]^Ai[a>>16&255]^Bi[a>>8&255]^Ui[255&a]},ki.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=xi(e),s=0;s<4;s++)i[s]^=this._Ke[0][s];for(var n=1;n>24&255]^_i[i[(s+1)%4]>>16&255]^gi[i[(s+2)%4]>>8&255]^yi[255&i[(s+3)%4]]^this._Ke[n][s];i=r.slice()}var a,o=ai(16);for(s=0;s<4;s++)a=this._Ke[t][s],o[4*s]=255&(fi[i[s]>>24&255]^a>>24),o[4*s+1]=255&(fi[i[(s+1)%4]>>16&255]^a>>16),o[4*s+2]=255&(fi[i[(s+2)%4]>>8&255]^a>>8),o[4*s+3]=255&(fi[255&i[(s+3)%4]]^a);return o},ki.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=xi(e),s=0;s<4;s++)i[s]^=this._Kd[0][s];for(var n=1;n>24&255]^bi[i[(s+3)%4]>>16&255]^wi[i[(s+2)%4]>>8&255]^Si[255&i[(s+1)%4]]^this._Kd[n][s];i=r.slice()}var a,o=ai(16);for(s=0;s<4;s++)a=this._Kd[t][s],o[4*s]=255&(pi[i[s]>>24&255]^a>>24),o[4*s+1]=255&(pi[i[(s+3)%4]>>16&255]^a>>16),o[4*s+2]=255&(pi[i[(s+2)%4]>>8&255]^a>>8),o[4*s+3]=255&(pi[255&i[(s+1)%4]]^a);return o};var Ti=function(e){if(!(this instanceof Ti))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new ki(e)};Ti.prototype.encrypt=function(e){if((e=ni(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=ai(e.length),r=ai(16),i=0;iNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},Ii.prototype.setBytes=function(e){if(16!=(e=ni(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Ii.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var Fi=function(e,t){if(!(this instanceof Fi))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Ii||(t=new Ii(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new ki(e)};Fi.prototype.encrypt=function(e){for(var t=ni(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,i=0;i>>2]>>>24-n%4*8&255;t[i+n>>>2]|=a<<24-(i+n)%4*8}else for(var o=0;o>>2]=r[o>>>2];return this.sigBytes+=s,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-s%4*8&255;i.push((n>>>4).toString(16)),i.push((15&n).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new l.init(r,t/2)}},h=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s>>2]>>>24-s%4*8&255;i.push(String.fromCharCode(n))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new l.init(r,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,s=i.words,n=i.sigBytes,a=this.blockSize,o=n/(4*a),d=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*a,c=e.min(4*d,n);if(d){for(var u=0;u>>2]|=e[s]<<24-s%4*8;t.call(this,i,r)}else t.apply(this,arguments)};i.prototype=e}}(),r.lib.WordArray)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.WordArray,i=e.enc;function s(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s>>2]>>>16-s%4*8&65535;i.push(String.fromCharCode(n))}return i.join("")},parse:function(e){for(var r=e.length,i=[],s=0;s>>1]|=e.charCodeAt(s)<<16-s%2*16;return t.create(i,2*r)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535);i.push(String.fromCharCode(a))}return i.join("")},parse:function(e){for(var r=e.length,i=[],n=0;n>>1]|=s(e.charCodeAt(n)<<16-n%2*16);return t.create(i,2*r)}}}(),r.enc.Utf16)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.WordArray;function i(e,r,i){for(var s=[],n=0,a=0;a>>6-a%4*2;s[n>>>2]|=o<<24-n%4*8,n++}return t.create(s,n)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var s=[],n=0;n>>2]>>>24-n%4*8&255)<<16|(t[n+1>>>2]>>>24-(n+1)%4*8&255)<<8|t[n+2>>>2]>>>24-(n+2)%4*8&255,o=0;o<4&&n+.75*o>>6*(3-o)&63));var d=i.charAt(64);if(d)for(;s.length%4;)s.push(d);return s.join("")},parse:function(e){var t=e.length,r=this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var n=0;n>>6-a%4*2;s[n>>>2]|=o<<24-n%4*8,n++}return t.create(s,n)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,s=t?this._safe_map:this._map;e.clamp();for(var n=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,d=0;d<4&&a+.75*d>>6*(3-d)&63));var l=s.charAt(64);if(l)for(;n.length%4;)n.push(l);return n.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,s=t?this._safe_map:this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var a=0;a>>24)|4278255360&(s<<24|s>>>8)}var n=this._hash.words,a=e[t+0],d=e[t+1],f=e[t+2],p=e[t+3],m=e[t+4],_=e[t+5],g=e[t+6],y=e[t+7],v=e[t+8],b=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],A=e[t+13],B=e[t+14],U=e[t+15],x=n[0],k=n[1],T=n[2],C=n[3];x=l(x,k,T,C,a,7,o[0]),C=l(C,x,k,T,d,12,o[1]),T=l(T,C,x,k,f,17,o[2]),k=l(k,T,C,x,p,22,o[3]),x=l(x,k,T,C,m,7,o[4]),C=l(C,x,k,T,_,12,o[5]),T=l(T,C,x,k,g,17,o[6]),k=l(k,T,C,x,y,22,o[7]),x=l(x,k,T,C,v,7,o[8]),C=l(C,x,k,T,b,12,o[9]),T=l(T,C,x,k,w,17,o[10]),k=l(k,T,C,x,S,22,o[11]),x=l(x,k,T,C,E,7,o[12]),C=l(C,x,k,T,A,12,o[13]),T=l(T,C,x,k,B,17,o[14]),x=c(x,k=l(k,T,C,x,U,22,o[15]),T,C,d,5,o[16]),C=c(C,x,k,T,g,9,o[17]),T=c(T,C,x,k,S,14,o[18]),k=c(k,T,C,x,a,20,o[19]),x=c(x,k,T,C,_,5,o[20]),C=c(C,x,k,T,w,9,o[21]),T=c(T,C,x,k,U,14,o[22]),k=c(k,T,C,x,m,20,o[23]),x=c(x,k,T,C,b,5,o[24]),C=c(C,x,k,T,B,9,o[25]),T=c(T,C,x,k,p,14,o[26]),k=c(k,T,C,x,v,20,o[27]),x=c(x,k,T,C,A,5,o[28]),C=c(C,x,k,T,f,9,o[29]),T=c(T,C,x,k,y,14,o[30]),x=u(x,k=c(k,T,C,x,E,20,o[31]),T,C,_,4,o[32]),C=u(C,x,k,T,v,11,o[33]),T=u(T,C,x,k,S,16,o[34]),k=u(k,T,C,x,B,23,o[35]),x=u(x,k,T,C,d,4,o[36]),C=u(C,x,k,T,m,11,o[37]),T=u(T,C,x,k,y,16,o[38]),k=u(k,T,C,x,w,23,o[39]),x=u(x,k,T,C,A,4,o[40]),C=u(C,x,k,T,a,11,o[41]),T=u(T,C,x,k,p,16,o[42]),k=u(k,T,C,x,g,23,o[43]),x=u(x,k,T,C,b,4,o[44]),C=u(C,x,k,T,E,11,o[45]),T=u(T,C,x,k,U,16,o[46]),x=h(x,k=u(k,T,C,x,f,23,o[47]),T,C,a,6,o[48]),C=h(C,x,k,T,y,10,o[49]),T=h(T,C,x,k,B,15,o[50]),k=h(k,T,C,x,_,21,o[51]),x=h(x,k,T,C,E,6,o[52]),C=h(C,x,k,T,p,10,o[53]),T=h(T,C,x,k,w,15,o[54]),k=h(k,T,C,x,d,21,o[55]),x=h(x,k,T,C,v,6,o[56]),C=h(C,x,k,T,U,10,o[57]),T=h(T,C,x,k,g,15,o[58]),k=h(k,T,C,x,A,21,o[59]),x=h(x,k,T,C,m,6,o[60]),C=h(C,x,k,T,S,10,o[61]),T=h(T,C,x,k,f,15,o[62]),k=h(k,T,C,x,b,21,o[63]),n[0]=n[0]+x|0,n[1]=n[1]+k|0,n[2]=n[2]+T|0,n[3]=n[3]+C|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,s=8*t.sigBytes;r[s>>>5]|=128<<24-s%32;var n=e.floor(i/4294967296),a=i;r[15+(s+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),r[14+(s+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var o=this._hash,d=o.words,l=0;l<4;l++){var c=d[l];d[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return o},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,i,s,n,a){var o=e+(t&r|~t&i)+s+a;return(o<>>32-n)+t}function c(e,t,r,i,s,n,a){var o=e+(t&i|r&~i)+s+a;return(o<>>32-n)+t}function u(e,t,r,i,s,n,a){var o=e+(t^r^i)+s+a;return(o<>>32-n)+t}function h(e,t,r,i,s,n,a){var o=e+(r^(t|~i))+s+a;return(o<>>32-n)+t}t.MD5=n._createHelper(d),t.HmacMD5=n._createHmacHelper(d)}(Math),r.MD5)})),Gt((function(e,t){var r,i,s,n,a,o,d,l;e.exports=(i=(r=l=Mi).lib,s=i.WordArray,n=i.Hasher,a=r.algo,o=[],d=a.SHA1=n.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],s=r[1],n=r[2],a=r[3],d=r[4],l=0;l<80;l++){if(l<16)o[l]=0|e[t+l];else{var c=o[l-3]^o[l-8]^o[l-14]^o[l-16];o[l]=c<<1|c>>>31}var u=(i<<5|i>>>27)+d+o[l];u+=l<20?1518500249+(s&n|~s&a):l<40?1859775393+(s^n^a):l<60?(s&n|s&a|n&a)-1894007588:(s^n^a)-899497514,d=a,a=n,n=s<<30|s>>>2,s=i,i=u}r[0]=r[0]+i|0,r[1]=r[1]+s|0,r[2]=r[2]+n|0,r[3]=r[3]+a|0,r[4]=r[4]+d|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=n._createHelper(d),r.HmacSHA1=n._createHmacHelper(d),l.SHA1)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,s=i.WordArray,n=i.Hasher,a=t.algo,o=[],d=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,s=0;s<64;)t(i)&&(s<8&&(o[s]=r(e.pow(i,.5))),d[s]=r(e.pow(i,1/3)),s++),i++}();var l=[],c=a.SHA256=n.extend({_doReset:function(){this._hash=new s.init(o.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],s=r[1],n=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,_=l[f-2],g=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;l[f]=m+l[f-7]+g+l[f-16]}var y=i&s^i&n^s&n,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=h+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&c^~o&u)+d[f]+l[f];h=u,u=c,c=o,o=a+b|0,a=n,n=s,s=i,i=b+(v+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+s|0,r[2]=r[2]+n|0,r[3]=r[3]+a|0,r[4]=r[4]+o|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,s=8*t.sigBytes;return r[s>>>5]|=128<<24-s%32,r[14+(s+64>>>9<<4)]=e.floor(i/4294967296),r[15+(s+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=n._createHelper(c),t.HmacSHA256=n._createHmacHelper(c)}(Math),r.SHA256)})),Gt((function(e,t){var r,i,s,n,a,o;e.exports=(i=(r=o=Mi).lib.WordArray,s=r.algo,n=s.SHA256,a=s.SHA224=n.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=n._createHelper(a),r.HmacSHA224=n._createHmacHelper(a),o.SHA224)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.Hasher,i=e.x64,s=i.Word,n=i.WordArray,a=e.algo;function o(){return s.create.apply(s,arguments)}var d=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=o()}();var c=a.SHA512=t.extend({_doReset:function(){this._hash=new n.init([new s.init(1779033703,4089235720),new s.init(3144134277,2227873595),new s.init(1013904242,4271175723),new s.init(2773480762,1595750129),new s.init(1359893119,2917565137),new s.init(2600822924,725511199),new s.init(528734635,4215389547),new s.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],s=r[1],n=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=i.high,p=i.low,m=s.high,_=s.low,g=n.high,y=n.low,v=a.high,b=a.low,w=o.high,S=o.low,E=c.high,A=c.low,B=u.high,U=u.low,x=h.high,k=h.low,T=f,C=p,D=m,L=_,I=g,F=y,P=v,M=b,R=w,z=S,N=E,O=A,G=B,$=U,H=x,V=k,W=0;W<80;W++){var j,q,Y=l[W];if(W<16)q=Y.high=0|e[t+2*W],j=Y.low=0|e[t+2*W+1];else{var K=l[W-15],X=K.high,Z=K.low,J=(X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7,Q=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),ee=l[W-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,se=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),ne=l[W-7],ae=ne.high,oe=ne.low,de=l[W-16],le=de.high,ce=de.low;q=(q=(q=J+ae+((j=Q+oe)>>>0>>0?1:0))+ie+((j+=se)>>>0>>0?1:0))+le+((j+=ce)>>>0>>0?1:0),Y.high=q,Y.low=j}var ue,he=R&N^~R&G,fe=z&O^~z&$,pe=T&D^T&I^D&I,me=C&L^C&F^L&F,_e=(T>>>28|C<<4)^(T<<30|C>>>2)^(T<<25|C>>>7),ge=(C>>>28|T<<4)^(C<<30|T>>>2)^(C<<25|T>>>7),ye=(R>>>14|z<<18)^(R>>>18|z<<14)^(R<<23|z>>>9),ve=(z>>>14|R<<18)^(z>>>18|R<<14)^(z<<23|R>>>9),be=d[W],we=be.high,Se=be.low,Ee=H+ye+((ue=V+ve)>>>0>>0?1:0),Ae=ge+me;H=G,V=$,G=N,$=O,N=R,O=z,R=P+(Ee=(Ee=(Ee=Ee+he+((ue+=fe)>>>0>>0?1:0))+we+((ue+=Se)>>>0>>0?1:0))+q+((ue+=j)>>>0>>0?1:0))+((z=M+ue|0)>>>0>>0?1:0)|0,P=I,M=F,I=D,F=L,D=T,L=C,T=Ee+(_e+pe+(Ae>>>0>>0?1:0))+((C=ue+Ae|0)>>>0>>0?1:0)|0}p=i.low=p+C,i.high=f+T+(p>>>0>>0?1:0),_=s.low=_+L,s.high=m+D+(_>>>0>>0?1:0),y=n.low=y+F,n.high=g+I+(y>>>0>>0?1:0),b=a.low=b+M,a.high=v+P+(b>>>0>>0?1:0),S=o.low=S+z,o.high=w+R+(S>>>0>>0?1:0),A=c.low=A+O,c.high=E+N+(A>>>0>>0?1:0),U=u.low=U+$,u.high=B+G+(U>>>0<$>>>0?1:0),k=h.low=k+V,h.high=x+H+(k>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(c),e.HmacSHA512=t._createHmacHelper(c)}(),r.SHA512)})),Gt((function(e,t){var r,i,s,n,a,o,d,l;e.exports=(i=(r=l=Mi).x64,s=i.Word,n=i.WordArray,a=r.algo,o=a.SHA512,d=a.SHA384=o.extend({_doReset:function(){this._hash=new n.init([new s.init(3418070365,3238371032),new s.init(1654270250,914150663),new s.init(2438529370,812702999),new s.init(355462360,4144912697),new s.init(1731405415,4290775857),new s.init(2394180231,1750603025),new s.init(3675008525,1694076839),new s.init(1203062813,3204075428)])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=o._createHelper(d),r.HmacSHA384=o._createHmacHelper(d),l.SHA384)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,s=i.WordArray,n=i.Hasher,a=t.x64.Word,o=t.algo,d=[],l=[],c=[];!function(){for(var e=1,t=0,r=0;r<24;r++){d[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var s=1,n=0;n<24;n++){for(var o=0,u=0,h=0;h<7;h++){if(1&s){var f=(1<>>24)|4278255360&(n<<24|n>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(k=r[s]).high^=a,k.low^=n}for(var o=0;o<24;o++){for(var h=0;h<5;h++){for(var f=0,p=0,m=0;m<5;m++)f^=(k=r[h+5*m]).high,p^=k.low;var _=u[h];_.high=f,_.low=p}for(h=0;h<5;h++){var g=u[(h+4)%5],y=u[(h+1)%5],v=y.high,b=y.low;for(f=g.high^(v<<1|b>>>31),p=g.low^(b<<1|v>>>31),m=0;m<5;m++)(k=r[h+5*m]).high^=f,k.low^=p}for(var w=1;w<25;w++){var S=(k=r[w]).high,E=k.low,A=d[w];A<32?(f=S<>>32-A,p=E<>>32-A):(f=E<>>64-A,p=S<>>64-A);var B=u[l[w]];B.high=f,B.low=p}var U=u[0],x=r[0];for(U.high=x.high,U.low=x.low,h=0;h<5;h++)for(m=0;m<5;m++){var k=r[w=h+5*m],T=u[w],C=u[(h+1)%5+5*m],D=u[(h+2)%5+5*m];k.high=T.high^~C.high&D.high,k.low=T.low^~C.low&D.low}k=r[0];var L=c[o];k.high^=L.high,k.low^=L.low}},_doFinalize:function(){var t=this._data,r=t.words;this._nDataBytes;var i=8*t.sigBytes,n=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/n)*n>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,o=this.cfg.outputLength/8,d=o/8,l=[],c=0;c>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(h)}return new s.init(l,o)},clone:function(){for(var e=n.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=n._createHelper(h),t.HmacSHA3=n._createHmacHelper(h)}(Math),r.SHA3)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,s=i.WordArray,n=i.Hasher,a=t.algo,o=s.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=s.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=s.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=s.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=s.create([0,1518500249,1859775393,2400959708,2840853838]),h=s.create([1352829926,1548603684,1836072691,2053994217,0]),f=a.RIPEMD160=n.extend({_doReset:function(){this._hash=s.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,s=e[i];e[i]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}var n,a,f,b,w,S,E,A,B,U,x,k=this._hash.words,T=u.words,C=h.words,D=o.words,L=d.words,I=l.words,F=c.words;for(S=n=k[0],E=a=k[1],A=f=k[2],B=b=k[3],U=w=k[4],r=0;r<80;r+=1)x=n+e[t+D[r]]|0,x+=r<16?p(a,f,b)+T[0]:r<32?m(a,f,b)+T[1]:r<48?_(a,f,b)+T[2]:r<64?g(a,f,b)+T[3]:y(a,f,b)+T[4],x=(x=v(x|=0,I[r]))+w|0,n=w,w=b,b=v(f,10),f=a,a=x,x=S+e[t+L[r]]|0,x+=r<16?y(E,A,B)+C[0]:r<32?g(E,A,B)+C[1]:r<48?_(E,A,B)+C[2]:r<64?m(E,A,B)+C[3]:p(E,A,B)+C[4],x=(x=v(x|=0,F[r]))+U|0,S=U,U=B,B=v(A,10),A=E,E=x;x=k[1]+f+B|0,k[1]=k[2]+b+U|0,k[2]=k[3]+w+S|0,k[3]=k[4]+n+E|0,k[4]=k[0]+a+A|0,k[0]=x},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var s=this._hash,n=s.words,a=0;a<5;a++){var o=n[a];n[a]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return s},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function m(e,t,r){return e&t|~e&r}function _(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function v(e,t){return e<>>32-t}t.RIPEMD160=n._createHelper(f),t.HmacRIPEMD160=n._createHmacHelper(f)}(),r.RIPEMD160)})),Gt((function(e,t){var r,i,s;e.exports=(i=(r=Mi).lib.Base,s=r.enc.Utf8,void(r.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var n=this._oKey=t.clone(),a=this._iKey=t.clone(),o=n.words,d=a.words,l=0;l>>2];e.sigBytes-=t}};i.BlockCipher=c.extend({cfg:c.cfg.extend({mode:f,padding:p}),reset:function(){var e;c.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=i.CipherParams=s.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?n.create([1398893684,1701076831]).concat(r).concat(t):t).toString(d)},parse:function(e){var t,r=d.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=n.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),m.create({ciphertext:r,salt:t})}},g=i.SerializableCipher=s.extend({cfg:s.extend({format:_}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var s=e.createEncryptor(r,i),n=s.finalize(t),a=s.cfg;return m.create({ciphertext:n,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,i,s){if(i||(i=n.random(8)),s)a=l.create({keySize:t+r,hasher:s}).compute(e,i);else var a=l.create({keySize:t+r}).compute(e,i);var o=n.create(a.words.slice(t),4*r);return a.sigBytes=4*t,m.create({key:a,iv:o,salt:i})}},v=i.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var s=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=s.iv;var n=g.encrypt.call(this,e,t,s.key,i);return n.mixIn(s),n},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var s=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=s.iv,g.decrypt.call(this,e,t,s.key,i)}})}())})),Gt((function(e,t){var r;e.exports=((r=Mi).mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,i){var s,n=this._iv;n?(s=n.slice(0),this._iv=void 0):s=this._prevBlock,i.encryptBlock(s,0);for(var a=0;a>24&255)){var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}else e+=1<<24;return e}function i(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var s=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,s=r.blockSize,n=this._iv,a=this._counter;n&&(a=this._counter=n.slice(0),this._iv=void 0),i(a);var o=a.slice(0);r.encryptBlock(o,0);for(var d=0;d>>2]|=s<<24-n%4*8,e.sigBytes+=s},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),Gt((function(e,t){var r;e.exports=((r=Mi).pad.Iso10126={pad:function(e,t){var i=4*t,s=i-e.sigBytes%i;e.concat(r.lib.WordArray.random(s-1)).concat(r.lib.WordArray.create([s<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),Gt((function(e,t){var r;e.exports=((r=Mi).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),Gt((function(e,t){var r;e.exports=((r=Mi).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)})),Gt((function(e,t){var r;e.exports=((r=Mi).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib.CipherParams,s=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(s)},parse:function(e){var t=s.parse(e);return i.create({ciphertext:t})}}}(),r.format.Hex)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.BlockCipher,i=e.algo,s=[],n=[],a=[],o=[],d=[],l=[],c=[],u=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,s[r]=p,n[p]=r;var m=e[r],_=e[m],g=e[_],y=257*e[p]^16843008*p;a[r]=y<<24|y>>>8,o[r]=y<<16|y>>>16,d[r]=y<<8|y>>>24,l[r]=y,y=16843009*g^65537*_^257*m^16843008*r,c[p]=y<<24|y>>>8,u[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,r?(r=m^e[e[e[g^m]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=i.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),n=this._keySchedule=[],a=0;a6&&a%r==4&&(l=s[l>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[255&l]):(l=s[(l=l<<8|l>>>24)>>>24]<<24|s[l>>>16&255]<<16|s[l>>>8&255]<<8|s[255&l],l^=p[a/r|0]<<24),n[a]=n[a-r]^l);for(var o=this._invKeySchedule=[],d=0;d>>24]]^u[s[l>>>16&255]]^h[s[l>>>8&255]]^f[s[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,o,d,l,s)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,c,u,h,f,n),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,s,n,a,o){for(var d=this._nRounds,l=e[t]^r[0],c=e[t+1]^r[1],u=e[t+2]^r[2],h=e[t+3]^r[3],f=4,p=1;p>>24]^s[c>>>16&255]^n[u>>>8&255]^a[255&h]^r[f++],_=i[c>>>24]^s[u>>>16&255]^n[h>>>8&255]^a[255&l]^r[f++],g=i[u>>>24]^s[h>>>16&255]^n[l>>>8&255]^a[255&c]^r[f++],y=i[h>>>24]^s[l>>>16&255]^n[c>>>8&255]^a[255&u]^r[f++];l=m,c=_,u=g,h=y}m=(o[l>>>24]<<24|o[c>>>16&255]<<16|o[u>>>8&255]<<8|o[255&h])^r[f++],_=(o[c>>>24]<<24|o[u>>>16&255]<<16|o[h>>>8&255]<<8|o[255&l])^r[f++],g=(o[u>>>24]<<24|o[h>>>16&255]<<16|o[l>>>8&255]<<8|o[255&c])^r[f++],y=(o[h>>>24]<<24|o[l>>>16&255]<<16|o[c>>>8&255]<<8|o[255&u])^r[f++],e[t]=m,e[t+1]=_,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(m)}(),r.AES)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib,i=t.WordArray,s=t.BlockCipher,n=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=n.DES=s.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=a[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var s=this._subKeys=[],n=0;n<16;n++){var l=s[n]=[],c=d[n];for(r=0;r<24;r++)l[r/6|0]|=t[(o[r]-1+c)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(o[r+24]-1+c)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var u=this._invSubKeys=[];for(r=0;r<16;r++)u[r]=s[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var s=r[i],n=this._lBlock,a=this._rBlock,o=0,d=0;d<8;d++)o|=l[d][((a^s[d])&c[d])>>>0];this._lBlock=a,this._rBlock=n^o}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),s=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(i.create(t)),this._des2=u.createEncryptor(i.create(r)),this._des3=u.createEncryptor(i.create(s))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=s._createHelper(p)}(),r.TripleDES)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,s=i.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],s=0;s<256;s++)i[s]=s;s=0;for(var n=0;s<256;s++){var a=s%r,o=t[a>>>2]>>>24-a%4*8&255;n=(n+i[s]+o)%256;var d=i[s];i[s]=i[n],i[n]=d}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=n.call(this)},keySize:8,ivSize:0});function n(){for(var e=this._S,t=this._i,r=this._j,i=0,s=0;s<4;s++){r=(r+e[t=(t+1)%256])%256;var n=e[t];e[t]=e[r],e[r]=n,i|=e[(e[t]+e[r])%256]<<24-8*s}return this._i=t,this._j=r,i}e.RC4=t._createHelper(s);var a=i.RC4Drop=s.extend({cfg:s.cfg.extend({drop:192}),_doReset:function(){s._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)n.call(this)}});e.RC4Drop=t._createHelper(a)}(),r.RC4)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,s=[],n=[],a=[],o=i.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],s=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)d.call(this);for(r=0;r<8;r++)s[r]^=i[r+4&7];if(t){var n=t.words,a=n[0],o=n[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(s[0]^=l,s[1]^=u,s[2]^=c,s[3]^=h,s[4]^=l,s[5]^=u,s[6]^=c,s[7]^=h,r=0;r<4;r++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),s[0]=r[0]^r[5]>>>16^r[3]<<16,s[1]=r[2]^r[7]>>>16^r[5]<<16,s[2]=r[4]^r[1]>>>16^r[7]<<16,s[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)s[i]=16711935&(s[i]<<8|s[i]>>>24)|4278255360&(s[i]<<24|s[i]>>>8),e[t+i]^=s[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)n[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],s=65535&i,o=i>>>16,d=((s*s>>>17)+s*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=t._createHelper(o)}(),r.Rabbit)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,s=[],n=[],a=[],o=i.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var s=0;s<4;s++)d.call(this);for(s=0;s<8;s++)i[s]^=r[s+4&7];if(t){var n=t.words,a=n[0],o=n[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(i[0]^=l,i[1]^=u,i[2]^=c,i[3]^=h,i[4]^=l,i[5]^=u,i[6]^=c,i[7]^=h,s=0;s<4;s++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),s[0]=r[0]^r[5]>>>16^r[3]<<16,s[1]=r[2]^r[7]>>>16^r[5]<<16,s[2]=r[4]^r[1]>>>16^r[7]<<16,s[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)s[i]=16711935&(s[i]<<8|s[i]>>>24)|4278255360&(s[i]<<24|s[i]>>>8),e[t+i]^=s[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)n[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],s=65535&i,o=i>>>16,d=((s*s>>>17)+s*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=t._createHelper(o)}(),r.RabbitLegacy)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.BlockCipher,i=e.algo;const s=16,n=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function d(e,t){let r=t>>24&255,i=t>>16&255,s=t>>8&255,n=255&t,a=e.sbox[0][r]+e.sbox[1][i];return a^=e.sbox[2][s],a+=e.sbox[3][n],a}function l(e,t,r){let i,n=t,a=r;for(let t=0;t1;--t)n^=e.pbox[t],a=d(e,n)^a,i=n,n=a,a=i;return i=n,n=a,a=i,a^=e.pbox[1],n^=e.pbox[0],{left:n,right:a}}function u(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=a[t][r]}let i=0;for(let a=0;a=r&&(i=0);let o=0,d=0,c=0;for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),r=new Uint8Array(r);const s=e.byteLength;let n=5;for(;ns)break;let o=e[n+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=e.slice(n+4+2,n+4+a);let s=new Pi.ModeOfOperation.ctr(t,new Pi.Counter(r));const o=s.decrypt(i);s=null,e.set(o,n+4+2)}n=n+4+a}return e}function Ni(e,t,r){if(e.byteLength<=30)return e;const i=e.slice(32);let s=new Pi.ModeOfOperation.ctr(t,new Pi.Counter(r));const n=s.decrypt(i);return s=null,e.set(n,32),e}Gt((function(e,t){e.exports=Mi}));var Oi=Gt((function(e,t){var r,s,n,a=(r=new Date,s=4,n={setLogLevel:function(e){s=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=s&&console.debug("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=s&&console.info("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=s&&console.warn("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=s&&console.error("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}},n);a.getDurationString=function(e,t){var r;function i(e,t){for(var r=(""+e).split(".");r[0].length0){for(var r="",i=0;i0&&(r+=","),r+="["+a.getDurationString(e.start(i))+","+a.getDurationString(e.end(i))+"]";return r}return"(empty)"},t.Log=a;var o=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};o.prototype.getPosition=function(){return this.position},o.prototype.getEndPosition=function(){return this.buffer.byteLength},o.prototype.getLength=function(){return this.buffer.byteLength},o.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},o.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},o.prototype.readAnyInt=function(e,t){var r=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:r=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:r=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";r=this.dataview.getUint8(this.position)<<16,r|=this.dataview.getUint8(this.position+1)<<8,r|=this.dataview.getUint8(this.position+2);break;case 4:r=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";r=this.dataview.getUint32(this.position)<<32,r|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,r}throw"Not enough bytes in buffer"},o.prototype.readUint8=function(){return this.readAnyInt(1,!1)},o.prototype.readUint16=function(){return this.readAnyInt(2,!1)},o.prototype.readUint24=function(){return this.readAnyInt(3,!1)},o.prototype.readUint32=function(){return this.readAnyInt(4,!1)},o.prototype.readUint64=function(){return this.readAnyInt(8,!1)},o.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",r=0;rthis._byteLength&&(this._byteLength=t);else{for(r<1&&(r=1);t>r;)r*=2;var i=new ArrayBuffer(r),s=new Uint8Array(this._buffer);new Uint8Array(i,0,s.length).set(s),this.buffer=i,this._byteLength=t}}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),r=new Uint8Array(this._buffer,0,t.length);t.set(r),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Int32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Int16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Uint32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Uint16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var r=new Float64Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Float32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,r,i,s){var n=new Uint8Array(e,t,s),a=new Uint8Array(r,i,s);n.set(a)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=0;rs;i--,s++){var n=t[s];t[s]=t[i],t[i]=n}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],r=0;r>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},d.prototype.adjustUint32=function(e,t){var r=this.position;this.seek(e),this.writeUint32(t),this.seek(r)},d.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var r=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var r=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var r=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var r=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var r=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=8*e,r},d.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var r=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r};var c=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(c.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,a.debug("MultiBufferStream","Stream ready for parsing"),!0):(a.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(a.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){a.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r.buffer},c.prototype.reduceBuffer=function(e,t,r){var i;return(i=new Uint8Array(r)).set(new Uint8Array(e,t,r)),i.buffer.fileStart=e.fileStart+t,i.buffer.usedBytes=0,i.buffer},c.prototype.insertBuffer=function(e){for(var t=!0,r=0;ri.byteLength){this.buffers.splice(r,1),r--;continue}a.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=i.fileStart||(e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)),a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(r,0,e),0===r&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,s,n)}}t&&(a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===r&&(this.buffer=e))},c.prototype.logBufferLevel=function(e){var t,r,i,s,n,o=[],d="";for(i=0,s=0,t=0;t0&&(d+=n.end-1+"]");var l=e?a.info:a.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+i+"/"+s+" bytes), continuous ranges: "+d)},c.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},c.prototype.findPosition=function(e,t,r){var i,s=null,n=-1;for(i=!0===e?0:this.bufferIndex;i=t?(a.debug("MultiBufferStream","Found position in existing buffer #"+n),n):-1},c.prototype.findEndContiguousBuf=function(e){var t,r,i,s=void 0!==e?e:this.bufferIndex;if(r=this.buffers[s],this.buffers.length>s+1)for(t=s+1;t>3;return 31===i&&r.data.length>=2&&(i=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),i}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};t.MPEG4DescriptorParser=u;var h={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){h.FullBox.prototype=new h.Box,h.ContainerBox.prototype=new h.Box,h.SampleEntry.prototype=new h.Box,h.TrackGroupTypeBox.prototype=new h.FullBox,h.BASIC_BOXES.forEach((function(e){h.createBoxCtor(e)})),h.FULL_BOXES.forEach((function(e){h.createFullBoxCtor(e)})),h.CONTAINER_BOXES.forEach((function(e){h.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,r){this.type=e,this.size=t,this.uuid=r},FullBox:function(e,t,r){h.Box.call(this,e,t,r),this.flags=0,this.version=0},ContainerBox:function(e,t,r){h.Box.call(this,e,t,r),this.boxes=[]},SampleEntry:function(e,t,r,i){h.ContainerBox.call(this,e,t),this.hdr_size=r,this.start=i},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){h.FullBox.call(this,e,t)},createBoxCtor:function(e,t){h.boxCodes.push(e),h[e+"Box"]=function(t){h.Box.call(this,e,t)},h[e+"Box"].prototype=new h.Box,t&&(h[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){h[e+"Box"]=function(t){h.FullBox.call(this,e,t)},h[e+"Box"].prototype=new h.FullBox,h[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,r=0;rr?(a.error("BoxParser","Box of type '"+c+"' has a size "+l+" greater than its container size "+r),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):0!==l&&o+l>e.getEndPosition()?(e.seek(o),a.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):t?{code:h.OK,type:c,size:l,hdr_size:d,start:o}:(h[c+"Box"]?i=new h[c+"Box"](l):"uuid"!==c?(a.warn("BoxParser","Unknown box type: '"+c+"'"),(i=new h.Box(c,l)).has_unparsed_data=!0):h.UUIDBoxes[n]?i=new h.UUIDBoxes[n](l):(a.warn("BoxParser","Unknown uuid type: '"+n+"'"),(i=new h.Box(c,l)).uuid=n,i.has_unparsed_data=!0),i.hdr_size=d,i.start=o,i.write===h.Box.prototype.write&&"mdat"!==i.type&&(a.info("BoxParser","'"+u+"' box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),(s=e.getPosition()-(i.start+i.size))<0?(a.warn("BoxParser","Parsing of box '"+u+"' did not read the entire indicated box data size (missing "+-s+" bytes), seeking forward"),e.seek(i.start+i.size)):s>0&&(a.error("BoxParser","Parsing of box '"+u+"' read "+s+" more bytes than the indicated box data size, seeking backwards"),0!==i.size&&e.seek(i.start+i.size)),{code:h.OK,box:i,size:i.size})},h.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},h.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},h.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.ContainerBox.prototype.parse=function(e){for(var t,r;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},h.SAMPLE_ENTRY_TYPE_VISUAL="Visual",h.SAMPLE_ENTRY_TYPE_AUDIO="Audio",h.SAMPLE_ENTRY_TYPE_HINT="Hint",h.SAMPLE_ENTRY_TYPE_METADATA="Metadata",h.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",h.SAMPLE_ENTRY_TYPE_SYSTEM="System",h.SAMPLE_ENTRY_TYPE_TEXT="Text",h.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},h.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},h.SampleEntry.prototype.parseFooter=function(e){h.ContainerBox.prototype.parse.call(this,e)},h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_HINT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT,"enct"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA,"encm"),h.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var r=0;r<3;r++)this.layer_size[r]=16==t?e.readUint16():e.readUint32()})),h.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),h.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),h.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)a.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void a.error("av1C reserved_2 parsing problem");var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)}else a.error("av1C reserved_1 parsing problem");else a.error("av1C version "+this.version+" not supported")})),h.createBoxCtor("avcC",(function(e){var t,r;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),r=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(r))})),h.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),h.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),h.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),h.createFullBoxCtor("co64",(function(e){var t,r;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(r=0;r>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),h.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),h.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),h.createFullBoxCtor("ctts",(function(e){var t,r;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(r=0;r>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|r>>6&3,this.acmod=r>>3&7,this.lfeon=r>>2&1,this.bit_rate_code=3&r|i>>5&7})),h.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var r=0;r>6,i.bsid=s>>1&31,i.bsmod=(1&s)<<4|n>>4&15,i.acmod=n>>1&7,i.lfeon=1&n,i.num_dep_sub=a>>1&15,i.num_dep_sub>0&&(i.chan_loc=(1&a)<<8|e.readUint8())}})),h.createFullBoxCtor("dfLa",(function(e){var t=[],r=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var i=e.readUint8(),s=Math.min(127&i,r.length-1);if(s?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(r[s]),128&i)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),h.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[r]=e.readString(4),t-=4,r++})),h.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),h.createBoxCtor("hvcC",(function(e){var t,r,i,s;this.configurationVersion=e.readUint8(),s=e.readUint8(),this.general_profile_space=s>>6,this.general_tier_flag=(32&s)>>5,this.general_profile_idc=31&s,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),s=e.readUint8(),this.constantFrameRate=s>>6,this.numTemporalLayers=(13&s)>>3,this.temporalIdNested=(4&s)>>2,this.lengthSizeMinusOne=3&s,this.nalu_arrays=[];var n=e.readUint8();for(t=0;t>7,a.nalu_type=63&s;var o=e.readUint16();for(r=0;r>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var r=0;if(this.version<2)r=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";r=e.readUint32()}for(var i=0;i>7,this.axis=1&t})),h.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),a.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),h.createFullBoxCtor("ipma",(function(e){var t,r;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?a.property_index=(127&n)<<8|e.readUint8():a.property_index=127&n}}})),h.createFullBoxCtor("iref",(function(e){var t,r;for(this.references=[];e.getPosition()>7,i.assignment_type=127&s,i.assignment_type){case 0:i.grouping_type=e.readString(4);break;case 1:i.grouping_type=e.readString(4),i.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:i.sub_track_id=e.readUint32();break;default:a.warn("BoxParser","Unknown leva assignement type")}}})),h.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),h.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),f.prototype.toString=function(){return"("+this.x+","+this.y+")"},h.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new f(e.readUint16(),e.readUint16()),this.display_primaries[1]=new f(e.readUint16(),e.readUint16()),this.display_primaries[2]=new f(e.readUint16(),e.readUint16()),this.white_point=new f(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),h.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),h.createFullBoxCtor("mehd",(function(e){1&this.flags&&(a.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),h.createFullBoxCtor("meta",(function(e){this.boxes=[],h.ContainerBox.prototype.parse.call(this,e)})),h.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),h.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),h.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),h.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),h.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),h.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),h.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var r=0;r0){var t=e.readUint32();this.kid=[];for(var r=0;r0&&(this.data=e.readUint8Array(i))})),h.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),h.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),h.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var r=0;r>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var r=e.readUint8(),i=0;i>7,this.num_leading_samples=127&t})),h.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)a.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=h.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),h.createSampleGroupCtor("stsa",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),h.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),h.createSampleGroupCtor("tsas",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("tscl",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("vipr",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),r=0;r>6,this.sample_depends_on[i]=t>>4&3,this.sample_is_depended_on[i]=t>>2&3,this.sample_has_redundancy[i]=3&t})),h.createFullBoxCtor("senc"),h.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),a.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),r=0;r>31&1,i.referenced_size=2147483647&s,i.subsegment_duration=e.readUint32(),s=e.readUint32(),i.starts_with_SAP=s>>31&1,i.SAP_type=s>>28&7,i.SAP_delta_time=268435455&s}})),h.SingleItemTypeReferenceBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.SingleItemTypeReferenceBox.prototype=new h.Box,h.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var r=0;r>4&15,this.sample_sizes[t+1]=15&i}else if(8===this.field_size)for(t=0;t0)for(r=0;r>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=h.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),h.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),h.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),h.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var r=e.readUint32(),i=0;i>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),h.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),h.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),h.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},h.createTrackGroupCtor("msrc"),h.TrackReferenceTypeBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.TrackReferenceTypeBox.prototype=new h.Box,h.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},h.trefBox.prototype.parse=function(e){for(var t,r;e.getPosition()t&&this.flags&h.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var r=0;r>7&1,this.block_pad_lsb=r>>6&1,this.block_little_endian=r>>5&1,this.block_reversed=r>>4&1,this.pad_unknown=r>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),h.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),h.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),h.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),h.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=h.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),h.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),h.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=h.parseHex16(e)})),h.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),h.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),h.createFullBoxCtor("vvcC",(function(e){var t,r,i={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(i.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,r=this.num_sublayers-2;r>=0;--r){var a=i.extract_bits(1);this.ptl_sublayer_present_mask|=a<1;++r)i.extract_bits(1);for(this.sublayer_level_idc=[],r=this.num_sublayers-2;r>=0;--r)this.ptl_sublayer_present_mask&1<>=1;t+=h.decimalToHex(i,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var s=!1,n="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||s)&&(n="."+h.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+n,s=!0);t+=n}return t},h.vvc1SampleEntry.prototype.getCodec=h.vvi1SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var r="";if(this.vvcC.general_constraint_info){var i,s=[],n=0;for(n|=this.vvcC.ptl_frame_only_constraint<<7,n|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,s.push(n),n&&(i=e),n=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===i)r=".CA";else{r=".C";var a="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",o=0,d=0;for(e=0;e<=i;++e)for(o=o<<8|s[e],d+=8;d>=5;){r+=a[o>>d-5&31],o&=(1<<(d-=5))-1}d&&(r+=a[31&(o<<=5-d)])}}t+=r}return t},h.mp4aSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),r=this.esds.esd.getAudioConfig();return e+"."+h.decimalToHex(t)+(r?"."+r:"")}return e},h.stxtSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},h.vp08SampleEntry.prototype.getCodec=h.vp09SampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var r=this.vpcC.bitDepth;return 8==r&&(r="08"),e+".0"+this.vpcC.profile+"."+t+"."+r},h.av01SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this),r=this.av1C.seq_level_idx_0;return r<10&&(r="0"+r),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+r+(this.av1C.seq_tier_0?"H":"M")+"."+e},h.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),a.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>l?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>l&&e.writeUint64(this.size)},h.FullBox.prototype.writeHeader=function(e){this.size+=4,h.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},h.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},h.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},h.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},h.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},h.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},h.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&h.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&h.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&h.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&h.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[r]instanceof h.Box||t[r]instanceof h.Box||void 0===e[r]||void 0===t[r]||"function"==typeof e[r]||"function"==typeof t[r]||e.subBoxNames&&e.subBoxNames.indexOf(r.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(r.slice(0,4))>-1||"data"===r||"start"===r||"size"===r||"creation_time"===r||"modification_time"===r||h.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(r)>-1||e[r]===t[r]))return!1;return!0},h.boxEqual=function(e,t){if(!h.boxEqualFields(e,t))return!1;for(var r=0;r1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},g.prototype.setExtractionOptions=function(e,t,r){var i=this.getTrackById(e);if(i){var s={};this.extractedTracks.push(s),s.id=e,s.user=t,s.trak=i,i.nextSample=0,s.nb_samples=1e3,s.samples=[],r&&r.nbSamples&&(s.nb_samples=r.nbSamples)}},g.prototype.unsetExtractionOptions=function(e){for(var t=-1,r=0;r-1&&this.extractedTracks.splice(t,1)},g.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=h.parseOneBox(this.stream,false)).code===h.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var r;switch(r="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),r){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[r]&&a.warn("ISOFile","Duplicate Box of type: "+r+", overriding previous occurrence"),this[r]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},g.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(a.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(a.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(a.warn("ISOFile","Not ready to start parsing"),!1))},g.prototype.appendBuffer=function(e,t){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(a.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),r},g.prototype.getInfo=function(){var e,t,r,i,s,n,a={},o=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(a.hasMoov=!0,a.duration=this.moov.mvhd.duration,a.timescale=this.moov.mvhd.timescale,a.isFragmented=null!=this.moov.mvex,a.isFragmented&&this.moov.mvex.mehd&&(a.fragment_duration=this.moov.mvex.mehd.fragment_duration),a.isProgressive=this.isProgressive,a.hasIOD=null!=this.moov.iods,a.brands=[],a.brands.push(this.ftyp.major_brand),a.brands=a.brands.concat(this.ftyp.compatible_brands),a.created=new Date(o+1e3*this.moov.mvhd.creation_time),a.modified=new Date(o+1e3*this.moov.mvhd.modification_time),a.tracks=[],a.audioTracks=[],a.videoTracks=[],a.subtitleTracks=[],a.metadataTracks=[],a.hintTracks=[],a.otherTracks=[],e=0;e0?a.mime+='video/mp4; codecs="':a.audioTracks&&a.audioTracks.length>0?a.mime+='audio/mp4; codecs="':a.mime+='application/mp4; codecs="',e=0;e=r.samples.length)&&(a.info("ISOFile","Sending fragmented data on track #"+i.id+" for samples ["+Math.max(0,r.nextSample-i.nb_samples)+","+(r.nextSample-1)+"]"),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(i.id,i.user,i.segmentStream.buffer,r.nextSample,e||r.nextSample>=r.samples.length),i.segmentStream=null,i!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=r.samples.length)&&(a.debug("ISOFile","Sending samples on track #"+n.id+" for sample "+r.nextSample),this.onSamples&&this.onSamples(n.id,n.user,n.samples),n.samples=[],n!==this.extractedTracks[t]))break}}}},g.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},g.prototype.getBoxes=function(e,t){var r=[];return g._sweep.call(this,e,r,t),r},g._sweep=function(e,t,r){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&r)return;g._sweep.call(this.boxes[i],e,t,r)}},g.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},g.prototype.getTrackSample=function(e,t){var r=this.getTrackById(e);return this.getSample(r,t)},g.prototype.releaseUsedSamples=function(e,t,r){var i=0,s=this.getTrackById(e);s.lastValidSample||(s.lastValidSample=0);for(var n=s.lastValidSample;ne*s.timescale){l=i-1;break}t&&s.is_sync&&(d=i)}for(t&&(l=d),e=r.samples[l].cts,r.nextSample=l;r.samples[l].alreadyRead===r.samples[l].size&&r.samples[l+1];)l++;return n=r.samples[l].offset+r.samples[l].alreadyRead,a.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+a.getDurationString(e,o)+" and offset: "+n),{offset:n,time:e/o}},g.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},g.prototype.seek=function(e,t){var r,i,s,n=this.moov,o={offset:1/0,time:1/0};if(this.moov){for(s=0;sthis.getTrackDuration(r)||((i=this.seekTrack(e,t,r)).offset-1){a=d;break}switch(a){case"Visual":if(s.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),n.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var u=new h.avcCBox;u.parse(new o(t.avcDecoderConfigRecord)),n.addBox(u)}else if(t.hevcDecoderConfigRecord){var f=new h.hvcCBox;f.parse(new o(t.hevcDecoderConfigRecord)),n.addBox(f)}break;case"Audio":s.add("smhd").set("balance",t.balance||0),n.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":s.add("hmhd");break;case"Subtitle":if(s.add("sthd"),"stpp"===t.type)n.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:s.add("nmhd")}t.description&&n.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){n.addBox(e)})),s.add("dinf").add("dref").addEntry((new h["url Box"]).set("flags",1));var p=s.add("stbl");return p.add("stsd").addEntry(n),p.add("stts").set("sample_counts",[]).set("sample_deltas",[]),p.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),p.add("stco").set("chunk_offsets",[]),p.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(r),t.id}},h.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},g.prototype.addSample=function(e,t,r){var i=r||{},s={},n=this.getTrackById(e);if(null!==n){s.number=n.samples.length,s.track_id=n.tkhd.track_id,s.timescale=n.mdia.mdhd.timescale,s.description_index=i.sample_description_index?i.sample_description_index-1:0,s.description=n.mdia.minf.stbl.stsd.entries[s.description_index],s.data=t,s.size=t.byteLength,s.alreadyRead=s.size,s.duration=i.duration||1,s.cts=i.cts||0,s.dts=i.dts||0,s.is_sync=i.is_sync||!1,s.is_leading=i.is_leading||0,s.depends_on=i.depends_on||0,s.is_depended_on=i.is_depended_on||0,s.has_redundancy=i.has_redundancy||0,s.degradation_priority=i.degradation_priority||0,s.offset=0,s.subsamples=i.subsamples,n.samples.push(s),n.samples_size+=s.size,n.samples_duration+=s.duration,void 0===n.first_dts&&(n.first_dts=i.dts),this.processSamples();var a=this.createSingleSampleMoof(s);return this.addBox(a),a.computeSize(),a.trafs[0].truns[0].data_offset=a.size+8,this.add("mdat").data=new Uint8Array(t),s}},g.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var r=new h.moofBox;r.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var i=r.add("traf"),s=this.getTrackById(e.track_id);return i.add("tfhd").set("track_id",e.track_id).set("flags",h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),i.add("tfdt").set("baseMediaDecodeTime",e.dts-(s.first_dts||0)),i.add("trun").set("flags",h.TRUN_FLAGS_DATA_OFFSET|h.TRUN_FLAGS_DURATION|h.TRUN_FLAGS_SIZE|h.TRUN_FLAGS_FLAGS|h.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),r},g.prototype.lastMoofIndex=0,g.prototype.samplesDataSize=0,g.prototype.resetTables=function(){var e,t,r,i,s,n;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(d=s[a].grouping_type+"/0",(o=new l(s[a].grouping_type,0)).is_fragment=!0,t.sample_groups_info[d]||(t.sample_groups_info[d]=o))}else for(a=0;a=2&&(d=i[a].grouping_type+"/0",o=new l(i[a].grouping_type,0),e.sample_groups_info[d]||(e.sample_groups_info[d]=o))},g.setSampleGroupProperties=function(e,t,r,i){var s,n;for(s in t.sample_groups=[],i){var a;if(t.sample_groups[s]={},t.sample_groups[s].grouping_type=i[s].grouping_type,t.sample_groups[s].grouping_type_parameter=i[s].grouping_type_parameter,r>=i[s].last_sample_in_run&&(i[s].last_sample_in_run<0&&(i[s].last_sample_in_run=0),i[s].entry_index++,i[s].entry_index<=i[s].sbgp.entries.length-1&&(i[s].last_sample_in_run+=i[s].sbgp.entries[i[s].entry_index].sample_count)),i[s].entry_index<=i[s].sbgp.entries.length-1?t.sample_groups[s].group_description_index=i[s].sbgp.entries[i[s].entry_index].group_description_index:t.sample_groups[s].group_description_index=-1,0!==t.sample_groups[s].group_description_index)a=i[s].fragment_description?i[s].fragment_description:i[s].description,t.sample_groups[s].group_description_index>0?(n=t.sample_groups[s].group_description_index>65535?(t.sample_groups[s].group_description_index>>16)-1:t.sample_groups[s].group_description_index-1,a&&n>=0&&(t.sample_groups[s].description=a.entries[n])):a&&a.version>=2&&a.default_group_description_index>0&&(t.sample_groups[s].description=a.entries[a.default_group_description_index-1])}},g.process_sdtp=function(e,t,r){t&&(e?(t.is_leading=e.is_leading[r],t.depends_on=e.sample_depends_on[r],t.is_depended_on=e.sample_is_depended_on[r],t.has_redundancy=e.sample_has_redundancy[r]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},g.prototype.buildSampleLists=function(){var e,t;for(e=0;ev&&(b++,v<0&&(v=0),v+=n.sample_counts[b]),t>0?(e.samples[t-1].duration=n.sample_deltas[b],e.samples_duration+=e.samples[t-1].duration,U.dts=e.samples[t-1].dts+e.samples[t-1].duration):U.dts=0,a?(t>=w&&(S++,w<0&&(w=0),w+=a.sample_counts[S]),U.cts=e.samples[t].dts+a.sample_offsets[S]):U.cts=U.dts,o?(t==o.sample_numbers[E]-1?(U.is_sync=!0,E++):(U.is_sync=!1,U.degradation_priority=0),l&&l.entries[A].sample_delta+B==t+1&&(U.subsamples=l.entries[A].subsamples,B+=l.entries[A].sample_delta,A++)):U.is_sync=!0,g.process_sdtp(e.mdia.minf.stbl.sdtp,U,U.number),U.degradation_priority=h?h.priority[t]:0,l&&l.entries[A].sample_delta+B==t&&(U.subsamples=l.entries[A].subsamples,B+=l.entries[A].sample_delta),(c.length>0||u.length>0)&&g.setSampleGroupProperties(e,U,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},g.prototype.updateSampleLists=function(){var e,t,r,i,s,n,a,o,d,l,c,u,f,p,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&g.initSampleGroups(u,c,c.sbgps,u.mdia.minf.stbl.sgpds,c.sgpds),t=0;t0?p.dts=u.samples[u.samples.length-2].dts+u.samples[u.samples.length-2].duration:(c.tfdt?p.dts=c.tfdt.baseMediaDecodeTime:p.dts=0,u.first_traf_merged=!0),p.cts=p.dts,_.flags&h.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+_.sample_composition_time_offset[r]),m=a,_.flags&h.TRUN_FLAGS_FLAGS?m=_.sample_flags[r]:0===r&&_.flags&h.TRUN_FLAGS_FIRST_FLAG&&(m=_.first_sample_flags),p.is_sync=!(m>>16&1),p.is_leading=m>>26&3,p.depends_on=m>>24&3,p.is_depended_on=m>>22&3,p.has_redundancy=m>>20&3,p.degradation_priority=65535&m;var y=!!(c.tfhd.flags&h.TFHD_FLAG_BASE_DATA_OFFSET),v=!!(c.tfhd.flags&h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),b=!!(_.flags&h.TRUN_FLAGS_DATA_OFFSET),w=0;w=y?c.tfhd.base_data_offset:v||0===t?l.start:o,p.offset=0===t&&0===r?b?w+_.data_offset:w:o,o=p.offset+p.size,(c.sbgps.length>0||c.sgpds.length>0||u.mdia.minf.stbl.sbgps.length>0||u.mdia.minf.stbl.sgpds.length>0)&&g.setSampleGroupProperties(u,p,p.number_in_traf,c.sample_groups_info)}}if(c.subs){u.has_fragment_subsamples=!0;var S=c.first_sample_index;for(t=0;t-1))return null;var n=(r=this.stream.buffers[s]).byteLength-(i.offset+i.alreadyRead-r.fileStart);if(i.size-i.alreadyRead<=n)return a.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+(i.size-i.alreadyRead)+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,i.size-i.alreadyRead),r.usedBytes+=i.size-i.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead=i.size,i;if(0===n)return null;a.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+n+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,n),i.alreadyRead+=n,r.usedBytes+=n,this.stream.logBufferLevel()}},g.prototype.releaseSample=function(e,t){var r=e.samples[t];return r.data?(this.samplesDataSize-=r.size,r.data=null,r.description=null,delete r.degradation_priority,delete r.depends_on,delete r.description_index,delete r.has_redundancy,delete r.is_depended_on,delete r.is_leading,delete r.is_sync,delete r.moof_number,delete r.number_in_traf,delete r.timescale,delete r.cts,delete r.dts,delete r.offset,delete r.size,delete r.track_id,delete r.duration,r.alreadyRead=0,r.size):0},g.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},g.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},g.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(r.protection=n.ipro.protections[n.iinf.item_infos[e].protection_index-1]),n.iinf.item_infos[e].item_type?r.type=n.iinf.item_infos[e].item_type:r.type="mime",r.content_type=n.iinf.item_infos[e].content_type,r.content_encoding=n.iinf.item_infos[e].content_encoding;if(n.grpl)for(e=0;e0&&h.property_index-1-1))return null;var o=(t=this.stream.buffers[n]).byteLength-(s.offset+s.alreadyRead-t.fileStart);if(!(s.length-s.alreadyRead<=o))return a.debug("ISOFile","Getting item #"+e+" extent #"+i+" partial data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-t.fileStart)+" read size: "+o+" full extent size: "+s.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,s.offset+s.alreadyRead-t.fileStart,o),s.alreadyRead+=o,r.alreadyRead+=o,t.usedBytes+=o,this.stream.logBufferLevel(),null;a.debug("ISOFile","Getting item #"+e+" extent #"+i+" data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-t.fileStart)+" read size: "+(s.length-s.alreadyRead)+" full extent size: "+s.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,s.offset+s.alreadyRead-t.fileStart,s.length-s.alreadyRead),t.usedBytes+=s.length-s.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead+=s.length-s.alreadyRead,s.alreadyRead=s.length}}return r.alreadyRead===r.size?r:null},g.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var r=0;r0?this.moov.traks[e].samples[0].duration:0),t.push(i)}return t},g.prototype.getPerformanceInfo=function(){var e={};return e.moov=this.moov,this.moov&&this.moov.traks&&this.moov.traks.length>1&&(e.moovAudioNum=this.moov.traks[0].samples.length,e.moovVideoNum=this.moov.traks[1].samples.length),e},h.Box.prototype.printHeader=function(e){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},h.FullBox.prototype.printHeader=function(e){this.size+=4,h.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},h.Box.prototype.print=function(e){this.printHeader(e)},h.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},h.tkhdBox.prototype.print=function(e){h.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var y={createFile:function(e,t){var r=void 0===e||e,i=new g(t);return i.discardMdatData=!r,i}};t.createFile=y.createFile}));function Gi(e){return e.reduce(((e,t)=>256*e+t))}function $i(e){const t=[101,103,119,99],r=e.length-28,i=e.slice(r,r+t.length);return t.every(((e,t)=>e===i[t]))}Oi.Log,Oi.MP4BoxStream,Oi.DataStream,Oi.MultiBufferStream,Oi.MPEG4DescriptorParser,Oi.BoxParser,Oi.XMLSubtitlein4Parser,Oi.Textin4Parser,Oi.ISOFile,Oi.createFile;class Hi{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(r+32,r+32+t))]}return null}(t,this.t);if(!r)return e;const i=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(i instanceof Error)return console.error(i.message),this.d=!0,e;this.A=!0,this.u=r[1],$i(t)&&this.c++,WebAssembly.instantiate(r[2],i).then((e=>{if("function"!=typeof(t=e.instance.exports).parse||"object"!=typeof t.memory)return this.d=!0,void console.error("video_error_3");var t;this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}function Vi(){for(var e=arguments.length,t=new Array(e),r=0;r{const r=new i((0|e.byteLength)+(0|t.byteLength));return r.set(e,0),r.set(t,0|e.byteLength),r}),new i)}const Wi=16,ji=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],qi=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Yi(e){const t=[];for(let r=0,i=e.length;r1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Xi(e){const t=[];for(let r=0,i=e.length;r>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}function Zi(e){const t=[];for(let r=0,i=e.length;r=240&&e[r]<=247?(t.push(String.fromCodePoint(((7&e[r])<<18)+((63&e[r+1])<<12)+((63&e[r+2])<<6)+(63&e[r+3]))),r+=3):e[r]>=224&&e[r]<=239?(t.push(String.fromCodePoint(((15&e[r])<<12)+((63&e[r+1])<<6)+(63&e[r+2]))),r+=2):e[r]>=192&&e[r]<=223?(t.push(String.fromCodePoint(((31&e[r])<<6)+(63&e[r+1]))),r++):t.push(String.fromCodePoint(e[r]));return t.join("")}function Ji(e,t){const r=31&t;return e<>>32-r}function Qi(e){return(255&ji[e>>>24&255])<<24|(255&ji[e>>>16&255])<<16|(255&ji[e>>>8&255])<<8|255&ji[255&e]}function es(e){return e^Ji(e,2)^Ji(e,10)^Ji(e,18)^Ji(e,24)}function ts(e){return e^Ji(e,13)^Ji(e,23)}function rs(e,t,r){const i=new Array(4),s=new Array(4);for(let t=0;t<4;t++)s[0]=255&e[4*t],s[1]=255&e[4*t+1],s[2]=255&e[4*t+2],s[3]=255&e[4*t+3],i[t]=s[0]<<24|s[1]<<16|s[2]<<8|s[3];for(let e,t=0;t<32;t+=4)e=i[1]^i[2]^i[3]^r[t+0],i[0]^=es(Qi(e)),e=i[2]^i[3]^i[0]^r[t+1],i[1]^=es(Qi(e)),e=i[3]^i[0]^i[1]^r[t+2],i[2]^=es(Qi(e)),e=i[0]^i[1]^i[2]^r[t+3],i[3]^=es(Qi(e));for(let e=0;e<16;e+=4)t[e]=i[3-e/4]>>>24&255,t[e+1]=i[3-e/4]>>>16&255,t[e+2]=i[3-e/4]>>>8&255,t[e+3]=255&i[3-e/4]}function is(e,t,r){const i=new Array(4),s=new Array(4);for(let t=0;t<4;t++)s[0]=255&e[0+4*t],s[1]=255&e[1+4*t],s[2]=255&e[2+4*t],s[3]=255&e[3+4*t],i[t]=s[0]<<24|s[1]<<16|s[2]<<8|s[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let e,r=0;r<32;r+=4)e=i[1]^i[2]^i[3]^qi[r+0],t[r+0]=i[0]^=ts(Qi(e)),e=i[2]^i[3]^i[0]^qi[r+1],t[r+1]=i[1]^=ts(Qi(e)),e=i[3]^i[0]^i[1]^qi[r+2],t[r+2]=i[2]^=ts(Qi(e)),e=i[0]^i[1]^i[2]^qi[r+3],t[r+3]=i[3]^=ts(Qi(e));if(0===r)for(let e,r=0;r<16;r++)e=t[r],t[r]=t[31-r],t[31-r]=e}function ss(e,t,r){let{padding:i="pkcs#7",mode:s,iv:n=[],output:a="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===s&&("string"==typeof n&&(n=Yi(n)),16!==n.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=Yi(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==r?Xi(e):Yi(e):[...e],("pkcs#5"===i||"pkcs#7"===i)&&0!==r){const t=Wi-e.length%Wi;for(let r=0;r=Wi;){const t=e.slice(u,u+16),i=new Array(16);if("cbc"===s)for(let e=0;e2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=e.byteLength;let n=new Uint8Array(e.slice(0,5)),a=5;for(;as){const t=new Uint8Array(n.length+e.length-a);t.set(n,0),t.set(e.slice(a),n.length),n=t;break}let l=e[a+4],c=!1,u=2;if(r?(i&&(u=3),l=l>>>1&63,c=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(l)):(l&=31,c=1===l||5===l),c){const r=ss(e.slice(a+4+u,a+4+d),t,0,{padding:"none",output:"array"});let i=r[r.length-1];if(i>0&&i<16){let e=!0;for(let t=1;t<=i;t++)if(r[r.length-t]!==i){e=!1;break}e&&r.splice(r.length-i,i)}const s=new Uint8Array(u);s.set(e.slice(a+4,a+4+u),0);const o=tr(Vi(s,new Uint8Array(r))),l=new Uint8Array(n.length+o.length);l.set(n,0),l.set(o,n.length),n=l}else{const t=e.slice(a+4,a+4+d),r=new Uint8Array(n.length+4+t.length);r.set(n,0),r.set(o,n.length),r.set(t,n.length+4),n=r}a=a+4+d}return n}const os={init:0,findFirstStartCode:1,findSecondStartCode:2};class ds extends class{on(e,t,r){const i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:r}),this}once(e,t,r){const i=this;function s(){i.off(e,s);for(var n=arguments.length,a=new Array(n),o=0;o1?r-1:0),s=1;s{delete r[e]})),void delete this.e;const i=r[e],s=[];if(i&&t)for(let e=0,r=i.length;e=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=os.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==os.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=os.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==os.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=os.findFirstStartCode}}}}function ls(e,t,r){for(let i=2;i3&&void 0!==arguments[3]&&arguments[3];const s=e.byteLength;let n=5;for(;ns)break;let o=e[n+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=ls(e.slice(n+4,n+4+a),t,r);e.set(i,n+4)}n=n+4+a}return e}function hs(){for(var e=arguments.length,t=new Array(e),r=0;re+t.byteLength),0));let s=0;return t.forEach((e=>{i.set(e,s),s+=e.byteLength})),i}class fs{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,r,i)));e.addEventListener(t,r,i);const s=()=>{lr(e.removeEventListener)&&e.removeEventListener(t,r,i)};return this.destroys.push(s),s}destroy(){this.master.debugLog("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class ps{static init(){ps.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in ps.types)ps.types.hasOwnProperty(e)&&(ps.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=ps.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,r=null,i=Array.prototype.slice.call(arguments,1),s=i.length;for(let e=0;e>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r.set(e,4);let n=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return ps.box(ps.types.trak,ps.tkhd(e),ps.mdia(e))}static tkhd(e){let t=e.id,r=e.duration,i=e.presentWidth,s=e.presentHeight;return ps.box(ps.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>>8&255,255&i,0,0,s>>>8&255,255&s,0,0]))}static mdia(e){return ps.box(ps.types.mdia,ps.mdhd(e),ps.hdlr(e),ps.minf(e))}static mdhd(e){let t=e.timescale,r=e.duration;return ps.box(ps.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?ps.constants.HDLR_AUDIO:ps.constants.HDLR_VIDEO,ps.box(ps.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?ps.box(ps.types.smhd,ps.constants.SMHD):ps.box(ps.types.vmhd,ps.constants.VMHD),ps.box(ps.types.minf,t,ps.dinf(),ps.stbl(e))}static dinf(){return ps.box(ps.types.dinf,ps.box(ps.types.dref,ps.constants.DREF))}static stbl(e){return ps.box(ps.types.stbl,ps.stsd(e),ps.box(ps.types.stts,ps.constants.STTS),ps.box(ps.types.stsc,ps.constants.STSC),ps.box(ps.types.stsz,ps.constants.STSZ),ps.box(ps.types.stco,ps.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?ps.box(ps.types.stsd,ps.constants.STSD_PREFIX,ps.mp3(e)):ps.box(ps.types.stsd,ps.constants.STSD_PREFIX,ps.mp4a(e)):"avc"===e.videoType?ps.box(ps.types.stsd,ps.constants.STSD_PREFIX,ps.avc1(e)):ps.box(ps.types.stsd,ps.constants.STSD_PREFIX,ps.hvc1(e))}static mp3(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return ps.box(ps.types[".mp3"],i)}static mp4a(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return ps.box(ps.types.mp4a,i,ps.esds(e))}static esds(e){let t=e.config||[],r=t.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(t).concat([6,1,2]));return ps.box(ps.types.esds,i)}static avc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return ps.box(ps.types.avc1,s,ps.box(ps.types.avcC,t))}static hvc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return ps.box(ps.types.hvc1,s,ps.box(ps.types.hvcC,t))}static mvex(e){return ps.box(ps.types.mvex,ps.trex(e))}static trex(e){let t=e.id,r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return ps.box(ps.types.trex,r)}static moof(e,t){return ps.box(ps.types.moof,ps.mfhd(e.sequenceNumber),ps.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return ps.box(ps.types.mfhd,t)}static traf(e,t){let r=e.id,i=ps.box(ps.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),s=ps.box(ps.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),n=ps.sdtp(e),a=ps.trun(e,n.byteLength+16+16+8+16+8+8);return ps.box(ps.types.traf,i,s,a,n)}static sdtp(e){let t=new Uint8Array(5),r=e.flags;return t[4]=r.isLeading<<6|r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy,ps.box(ps.types.sdtp,t)}static trun(e,t){let r=new Uint8Array(28);t+=36,r.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let i=e.duration,s=e.size,n=e.flags,a=e.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,s>>>24&255,s>>>16&255,s>>>8&255,255&s,n.isLeading<<2|n.dependsOn,n.isDependedOn<<6|n.hasRedundancy<<4|n.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12),ps.box(ps.types.trun,r)}static mdat(e){return ps.box(ps.types.mdat,e)}}ps.init();var ms,_s=Gt((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}));(ms=_s)&&ms.__esModule&&Object.prototype.hasOwnProperty.call(ms,"default")&&ms.default;const gs=[44100,48e3,32e3,0],ys=[22050,24e3,16e3,0],vs=[11025,12e3,8e3,0],bs=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],ws=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],Ss=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];function Es(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),r=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let i=t[1]>>>3&3,s=(6&t[1])>>1,n=(240&t[2])>>>4,a=(12&t[2])>>>2,o=3!==(t[3]>>>6&3)?2:1,d=0,l=0;switch(i){case 0:d=vs[a];break;case 2:d=ys[a];break;case 3:d=gs[a]}switch(s){case 1:n=e[s]&&t=6?(i=5,t=new Array(4),a=s-3):(i=2,t=new Array(2),a=s):-1!==o.indexOf("android")?(i=2,t=new Array(2),a=s):(i=5,a=s,t=new Array(4),s>=6?a=s-3:1===n&&(i=2,t=new Array(2),a=s)),t[0]=i<<3,t[0]|=(15&s)>>>1,t[1]=(15&s)<<7,t[1]|=(15&n)<<3,5===i&&(t[1]|=(15&a)>>>1,t[2]=(1&a)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=zs[s],this.sampling_index=s,this.channel_count=n,this.object_type=i,this.original_object_type=r,this.codec_mimetype="mp4a.40."+i,this.original_codec_mimetype="mp4a.40."+r}}class Gs{constructor(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}get bitsAvailable(){return this.bitLength-this.index}skipBits(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}getBits(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>i,n=8-i;if(n>=e)return r&&(this.index+=e),s>>n-e;{r&&(this.index+=n);const i=e-n;return s<>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}function $s(e){return e[3]|e[2]<<8|e[1]<<16|e[0]<<24}const Hs=new Array(214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72),Vs=new Array(2746333894,1453994832,1736282519,2993693404),Ws=new Array(462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257);function js(e,t,r,i,s){var n=s;n=t+s>e.length&&i+s<=r.length?e.length-t:i+s>r.length&&t+s<=e.length?r.length-i:t+s<=e.length&&i+s<=r.length?s:r.length>24&255,e>>16&255,e>>8&255,255&e)}function Ys(e,t){return t+3>>19)^(i<<23|i>>>9)}function Zs(e,t){var r=new Array(36);r[0]=Ys(t,0),r[1]=Ys(t,4),r[2]=Ys(t,8),r[3]=Ys(t,12);for(var i=0;i<32;i++)r[i+4]=r[i]^Js(r[i+1]^r[i+2]^r[i+3]^e[i]);var s=new Array(4);for(i=35;i>=32;i--)s[35-i]=r[i];var n=function(e){for(var t=new Array(4*e.length),r=0;r>>30)^(i<<10|i>>>22)^(i<<18|i>>>14)^(i<<24|i>>>8)}function Qs(e,t,r){if(null==e||null==e||e.length%16!=0)return console.log("sm4 key is error!"),null;if(null==r||null==r||r.length<=0)return console.log("cipher is error!"),null;if(null==t||null==t||t.length%16!=0)return console.log("iv is error!"),null;for(var i=Ks(e),s=Math.ceil(r.length/16),n=new Array(r.length),a=t.slice(),o=0;o3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t=new Uint8Array(t),r=new Uint8Array(r);const n=e.byteLength;let a=5;for(;an)break;let d=e[a+4],l=!1,c=2;if(i?(s&&(c=3),d=d>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(d)):(d&=31,l=1===d||5===d),l){const i=Qs(t,r,e.slice(a+4+c,a+4+o));e.set(i,a+4+c)}a=a+4+o}return e}Date.now||(Date.now=function(){return(new Date).getTime()}),n({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support")&&-1===e.indexOf("illegal icc")&&!e.indexOf("If you want to help, upload a sample of this file to")&&!e.indexOf("Reserved SBR extensions is not implemented"))})(e)||console.warn("JbPro[❌❌❌][worker]:",e)}}).then((e=>{!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[],s=[],n=null,a=null,o=null,d=null,l=null,c=null,u=!1,h=null,w=null,S=!1,U=!1,we=!!gr(r),Se=0,We=0,Ze=!1,Je=null,et=null,rt=null,ct=[],Et=null,At=null,xt=0,Nt=0,Ot=null,Gt=null,$t=0,Ht=0,Vt=!1,Kt=!1,Qt=!1,nr=null,wr=null,Sr=!1,Er=!0,Ar=()=>{const e=mr();return{debug:e.debug,debugLevel:e.debugLevel,debugUuid:e.debugUuid,useOffscreen:e.useOffscreen,useWCS:e.useWCS,useMSE:e.useMSE,videoBuffer:e.videoBuffer,videoBufferDelay:e.videoBufferDelay,openWebglAlignment:e.openWebglAlignment,playType:e.playType,hasAudio:e.hasAudio,hasVideo:e.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:e.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:e.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:0,networkDelay:e.networkDelay,visibility:!0,useSIMD:e.useSIMD,isRecording:!1,recordType:e.recordType,isNakedFlow:e.isNakedFlow,checkFirstIFrame:e.checkFirstIFrame,audioBufferSize:1024,isM7sCrypto:e.isM7sCrypto,m7sCryptoAudio:e.m7sCryptoAudio,cryptoKey:e.cryptoKey,cryptoIV:e.cryptoIV,isSm4Crypto:e.isSm4Crypto,isSm4CryptoH265V2:e.isSm4CryptoH265V2,sm4CryptoKey:e.sm4CryptoKey,isXorCrypto:e.isXorCrypto,isHls265:!1,isFlv:e.isFlv,isFmp4:e.isFmp4,isMpeg4:e.isMpeg4,isTs:e.isTs,isFmp4Private:e.isFmp4Private,isEmitSEI:e.isEmitSEI,isRecordTypeFlv:!1,isWasmMp4:!1,isChrome:!1,isFirefox:!1,isDropSameTimestampGop:e.isDropSameTimestampGop,mseDecodeAudio:e.mseDecodeAudio,wcsDecodeAudio:e.wcsDecodeAudio,nakedFlowH265DemuxUseNew:e.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:e.mseDecoderUseWorker,mseAutoCleanupSourceBuffer:e.mseAutoCleanupSourceBuffer,mseAutoCleanupMaxBackwardDuration:e.mseAutoCleanupMaxBackwardDuration,mseAutoCleanupMinBackwardDuration:e.mseAutoCleanupMinBackwardDuration,mseCorrectTimeDuration:e.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:e.mseCorrectAudioTimeDuration,nakedFlowDemuxUseNew:e.nakedFlowDemuxUseNew,nakedFlowFps:e.nakedFlowFps,supportMSEDecodeHevc:!1}};"VideoEncoder"in self&&(n={hasInit:!1,isEmitInfo:!1,offscreenCanvas:null,offscreenCanvasCtx:null,decoder:null,init(){n.decoder=new VideoDecoder({output:function(e){if(lr(e.createImageBitmap))e.createImageBitmap().then((t=>{n.offscreenCanvasCtx.drawImage(t,0,0,e.codedWidth,e.codedHeight);let r=n.offscreenCanvas.transferToImageBitmap();postMessage({cmd:T,buffer:r,delay:ni.delay,ts:0},[r]),hr(e)}));else{n.offscreenCanvasCtx.drawImage(e,0,0,e.codedWidth,e.codedHeight);let t=n.offscreenCanvas.transferToImageBitmap();postMessage({cmd:T,buffer:t,delay:ni.delay,ts:0},[t]),hr(e)}},error:function(e){ni.debugError("worker","VideoDecoder error: ",e,e.toString())}})},destroy(){n.reset(),n.decoder&&"closed"!==n.decoder.state&&(n.decoder.close(),n.decoder=null)},decode:function(e,t,r){const i=e[0]>>4==1;if(n.hasInit){const r=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:i?ft:pt});n.decoder.decode(r)}else if(i&&0===e[1]){const t=15&e[0];postMessage({cmd:P,code:t});const r=new Uint8Array(e);postMessage({cmd:M,buffer:r,codecId:t},[r.buffer]);let i=null,s=null;const a=e.slice(5);t===Fe?(s=Tr(a),i={codec:s.codec,description:a}):t===Pe&&(s=Wr(a),i={codec:s.codec,description:a}),s&&s.codecWidth&&s.codecHeight&&(i.codedHeight=s.codecHeight,i.codedWidth=s.codecWidth),n.isEmitInfo||(ni.debugLog("worker","Webcodecs Video Decoder initSize"),postMessage({cmd:k,w:s.codecWidth,h:s.codecHeight}),n.isEmitInfo=!0,n.offscreenCanvas=new OffscreenCanvas(s.codecWidth,s.codecHeight),n.offscreenCanvasCtx=n.offscreenCanvas.getContext("2d"));try{n.decoder.configure(i),n.hasInit=!0}catch(e){ni.debugError("worker","VideoDecoder configure error",e.code,e,e.toString()),e.toString()}}else ni.debugWarn("worker",`VideoDecoder configure has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)},reset(){n.hasInit=!1,n.isEmitInfo=!1,n.offscreenCanvas=null,n.offscreenCanvasCtx=null}});let kr=function(){if(Sr=!0,a)try{a.abort(),a=null,ni.debugLog("worker","abort success")}catch(e){a=null,ni.debugLog("worker","abort catch",e)}},Gr={init(){Gr.lastBuf=null,Gr.vps=null,Gr.sps=null,Gr.pps=null,Gr.streamType=null,Gr.localDts=0,Gr.pendingUnits={},Gr.isSendSeqHeader=!1},destroy(){Gr.lastBuf=null,Gr.vps=null,Gr.sps=null,Gr.pps=null,Gr.streamType=null,Gr.localDts=0,Gr.pendingUnits={},Gr.isSendSeqHeader=!1},dispatch(e){const t=new Uint8Array(e);if(ni._opt.nakedFlowDemuxUseNew){const e=Gr.extractNALu$3(t);if(0===e.length)return void ni.debugLog("worker","dispatch naluArray length is 0");Gr.handleVideoFrames(e)}else Gr.extractNALu$2(t)},getNaluDts(){const e=ni._opt.nakedFlowFps;let t=Gr.localDts;return Gr.localDts=Gr.localDts+parseInt(1e3/e,10),t},getNaluAudioDts(){const e=ni._opt.sampleRate,t=ni._opt.audioBufferSize;return Gr.localDts+parseInt(t/e*1e3)},extractNALu(e){let t,r,i=0,s=e.byteLength,n=0,a=[];for(;i1)for(let e=0;e{const t=Fr(e);t===Ve||t===He?Gr.handleVideoH264Nalu(e):Mr(t)&&i.push(e)})),1===i.length)Gr.handleVideoH264Nalu(i[0]);else if(zr(i)){const e=Fr(i[0]),t=Rr(e);Gr.handleVideoH264NaluList(i,t,e)}else i.forEach((e=>{Gr.handleVideoH264Nalu(e)}))}else if(Gr.streamType===ze)if(ni._opt.nakedFlowH265DemuxUseNew){const t=Gr.handleAddNaluStartCode(e),r=Gr.extractNALu(t);if(0===r.length)return void ni.debugWarn("worker","handleVideoNalu","h265 naluList.length === 0");const i=[];if(r.forEach((e=>{const t=Xr(e);t===dt||t===at||t===st?Gr.handleVideoH265Nalu(e):Jr(t)&&i.push(e)})),1===i.length)Gr.handleVideoH265Nalu(i[0]);else if(ei(i)){const e=Xr(i[0]),t=Qr(e);Gr.handleVideoH265NaluList(i,t,e)}else i.forEach((e=>{Gr.handleVideoH265Nalu(e)}))}else Xr(e)===dt?Gr.extractH265PPS(e):Gr.handleVideoH265Nalu(e)},extractH264PPS(e){const t=Gr.handleAddNaluStartCode(e);Gr.extractNALu(t).forEach((e=>{Pr(Fr(e))?Gr.extractH264SEI(e):Gr.handleVideoH264Nalu(e)}))},extractH265PPS(e){const t=Gr.handleAddNaluStartCode(e);Gr.extractNALu(t).forEach((e=>{Zr(Xr(e))?Gr.extractH265SEI(e):Gr.handleVideoH265Nalu(e)}))},extractH264SEI(e){const t=Gr.handleAddNaluStartCode(e);Gr.extractNALu(t).forEach((e=>{Gr.handleVideoH264Nalu(e)}))},extractH265SEI(e){const t=Gr.handleAddNaluStartCode(e);Gr.extractNALu(t).forEach((e=>{Gr.handleVideoH265Nalu(e)}))},handleAddNaluStartCode(e){const t=[0,0,0,1],r=new Uint8Array(e.length+t.length);return r.set(t),r.set(e,t.length),r},handleVideoH264Nalu(e){const t=Fr(e);switch(t){case He:Gr.sps=e;break;case Ve:Gr.pps=e}if(Gr.isSendSeqHeader){if(Gr.sps&&Gr.pps){const e=Cr({sps:Gr.sps,pps:Gr.pps}),t=Gr.localDts;ni.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null}if(Mr(t)){const r=Rr(t),i=Gr.getNaluDts(),s=Lr(e,r);Gr.doDecode(s,{type:ae,ts:i,isIFrame:r,cts:0})}}else if(Gr.sps&&Gr.pps){Gr.isSendSeqHeader=!0;const e=Cr({sps:Gr.sps,pps:Gr.pps});ni.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null}},handleVideoH264NaluList(e,t,r){if(Gr.isSendSeqHeader){const i=Gr.getNaluDts(),s=Ir(e.reduce(((e,t)=>{const r=tr(e),i=tr(t),s=new Uint8Array(r.byteLength+i.byteLength);return s.set(r,0),s.set(i,r.byteLength),s})),t);Gr.doDecode(s,{type:ae,ts:i,isIFrame:t,cts:0}),ni.debugLog("worker",`handleVideoH264NaluList list size is ${e.length} package length is ${s.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},handleVideoH265Nalu(e){const t=Xr(e);switch(t){case st:Gr.vps=e;break;case at:Gr.sps=e;break;case dt:Gr.pps=e}if(Gr.isSendSeqHeader){if(Gr.vps&&Gr.sps&&Gr.pps){const e=qr({vps:Gr.vps,sps:Gr.sps,pps:Gr.pps}),t=Gr.localDts;ni.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Gr.vps=null,Gr.sps=null,Gr.pps=null}if(Jr(t)){const r=Qr(t),i=Gr.getNaluDts(),s=Yr(e,r);Gr.doDecode(s,{type:ae,ts:i,isIFrame:r,cts:0})}}else if(Gr.vps&&Gr.sps&&Gr.pps){Gr.isSendSeqHeader=!0;const e=qr({vps:Gr.vps,sps:Gr.sps,pps:Gr.pps});ni.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Gr.vps=null,Gr.sps=null,Gr.pps=null}},handleVideoH265NaluList(e,t,r){if(Gr.isSendSeqHeader){const i=Gr.getNaluDts(),s=Kr(e.reduce(((e,t)=>{const r=tr(e),i=tr(t),s=new Uint8Array(r.byteLength+i.byteLength);return s.set(r,0),s.set(i,r.byteLength),s})),t);Gr.doDecode(s,{type:ae,ts:i,isIFrame:t,cts:0}),ni.debugLog("worker",`handleVideoH265NaluList list size is ${e.length} package length is ${s.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},doDecode(e,t){ni.calcNetworkDelay(t.ts),t.isIFrame&&ni.calcIframeIntervalTimestamp(t.ts),ni.decode(e,t)},handleVideoFrames(e){if(!Gr.streamVideoType)for(let t of e)if(Gr.streamVideoType=cr(t),Gr.streamVideoType)break;Gr.streamVideoType?Gr.streamVideoType===Re?Gr.handleVideoH264Frames(e):this.streamVideoType===ze&&Gr.handleVideoH265Frames(e):ni.debugWarn("worker","handleVideoFrames","streamVideoType is null")},handleVideoH264Frames(e){let t=[],r=[],i=!1,s=!1;Gr.pendingUnits.units&&(t=Gr.pendingUnits.units,s=Gr.pendingUnits.vcl,i=Gr.pendingUnits.iFrame,Gr.pendingUnits={});let n={};for(let a of e){if(a.byteLength<4)continue;const e=Fr(a);let o=!1,d=e===qe;e!==je&&e!==qe||(n=Gr.parseVideo264Header(a),o=!0),t.length&&s&&(n.isfms||!o)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,s=!1),t.push(a),i=i||d,s=s||o}t.length&&(Gr.pendingUnits={units:t,vcl:s,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,s=null;if(t.forEach((e=>{const t=31&e[0];switch(t){case Ve:Gr.pps=e;break;case He:Gr.sps=e;break;case Ye:s=e}if(Mr(t)){const t=tr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Gr.isSendSeqHeader&&Gr.sps&&Gr.pps){Gr.isSendSeqHeader=!0;const e=Dr({sps:Gr.sps,pps:Gr.pps});ni.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null}if(Gr.isSendSeqHeader){if(Gr.sps&&Gr.pps){const e=Dr({sps:Gr.sps,pps:Gr.pps}),t=Gr.localDts;ni.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null}if(i){const e=Gr.getNaluDts(),t=Ir(i,r);ni._opt.isEmitSEI&&s&&postMessage({cmd:X,buffer:s,ts:e},[s.buffer]),Gr.doDecode(t,{type:ae,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames(e){let t=[],r=[],i=!1,s=!1;Gr.pendingUnits.units&&(t=Gr.pendingUnits.units,s=Gr.pendingUnits.vcl,i=Gr.pendingUnits.iFrame,Gr.pendingUnits={});let n={};for(let a of e){if(a.byteLength<4)continue;const e=Xr(a);let o=!1,d=Qr(e);Jr(e)&&(n=this.parseVideo265Header(a),o=!0),t.length&&s&&(n.isfms||!o)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,s=!1),t.push(a),i=i||d,s=s||o}t.length&&(Gr.pendingUnits={units:t,vcl:s,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,s=null;if(t.forEach((e=>{const t=e[0]>>>1&63;switch(t){case dt:Gr.pps=e;break;case at:Gr.sps=e;break;case st:Gr.vps=e;break;case ht:case ut:s=e}if(Jr(t)){const t=tr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Gr.isSendSeqHeader&&Gr.sps&&Gr.pps&&Gr.vps){Gr.isSendSeqHeader=!0;const e=qr({sps:Gr.sps,pps:Gr.pps,vps:Gr.vps});ni.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null,Gr.vps=null}if(Gr.isSendSeqHeader){if(Gr.sps&&Gr.pps&&Gr.vps){const e=qr({sps:Gr.sps,pps:Gr.pps,vps:Gr.vps}),t=Gr.localDts;ni.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Gr.sps=null,Gr.pps=null,Gr.vps=null}if(i){const e=Gr.getNaluDts(),t=Kr(i,r);ni._opt.isEmitSEI&&s&&postMessage({cmd:X,buffer:s,ts:e},[s.buffer]),Gr.doDecode(t,{type:ae,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames_1(e){e.forEach((e=>{Gr.handleVideoNalu(e)}))},parseVideo264Header(e){const t=new Gs(e);return t.readUByte(),{isfms:0===t.readUEG(),sType:t.readUEG()}},parseVideo265Header(e){const t=new Gs(e);return t.readUByte(),{nalType:t.readBits(6),isfms:0===t.readBits(1),sType:t.readBits(3)}}},$r={LOG_NAME:"worker fmp4Demuxer",mp4Box:null,offset:0,videoTrackId:null,audioTrackId:null,isHevc:!1,listenMp4Box(){$r.mp4Box=Oi.createFile(),$r.mp4Box.onReady=$r.onReady,$r.mp4Box.onError=$r.onError,$r.mp4Box.onSamples=$r.onSamples},initTransportDescarmber(){$r.transportDescarmber=new Hi},_getSeqHeader(e){const t=$r.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new Oi.DataStream(void 0,0,Oi.DataStream.BIG_ENDIAN);let r=[];e.avcC?(e.avcC.write(t),r=[23,0,0,0,0]):($r.isHevc=!0,ni.isHevc=!0,e.hvcC.write(t),r=[28,0,0,0,0]);const i=new Uint8Array(t.buffer,8),s=new Uint8Array(r.length+i.length);return s.set(r,0),s.set(i,r.length),s}return null},onReady(e){ni.debugLog($r.LOG_NAME,"onReady()");const t=e.videoTracks[0],r=e.audioTracks[0];if(t){$r.videoTrackId=t.id;const e=$r._getSeqHeader(t);e&&(ni.debugLog($r.LOG_NAME,"seqHeader"),ni.decodeVideo(e,0,!0,0)),$r.mp4Box.setExtractionOptions(t.id)}if(r&&ni._opt.hasAudio){$r.audioTrackId=r.id;const e=r.audio||{},t=Wt.indexOf(e.sample_rate),i=r.codec.replace("mp4a.40.","");$r.mp4Box.setExtractionOptions(r.id);const s=jt({profile:parseInt(i,10),sampleRate:t,channel:e.channel_count});ni.debugLog($r.LOG_NAME,"aacADTSHeader"),ni.decodeAudio(s,0)}$r.mp4Box.start()},onError(e){ni.debugError($r.LOG_NAME,"mp4Box onError",e)},onSamples(e,t,r){if(e===$r.videoTrackId){for(const e of r){const t=e.data,r=e.is_sync,i=1e3*e.cts/e.timescale;e.duration,e.timescale,r&&ni.calcIframeIntervalTimestamp(i);let s=null;s=$r.isHevc?Kr(t,r):Ir(t,r),ni.decode(s,{type:ae,ts:i,isIFrame:r,cts:0})}$r.mp4Box.removeUsedSamples(e)}else if(e===$r.audioTrackId){if(ni._opt.hasAudio){for(const e of r){const t=e.data,r=1e3*e.cts/e.timescale;e.duration,e.timescale;const i=new Uint8Array(t.byteLength+2);i.set([175,1],0),i.set(t,2),ni.decode(i,{type:ne,ts:r,isIFrame:!1,cts:0})}$r.mp4Box.removeUsedSamples(e)}}else ni.debugWarn($r.LOG_NAME,"onSamples() trackId error",e)},dispatch(e){let t=new Uint8Array(e);$r.transportDescarmber&&(t=$r.transportDescarmber.transport(t)),t.buffer.fileStart=$r.offset,$r.offset+=t.byteLength,$r.mp4Box.appendBuffer(t.buffer)},destroy(){$r.mp4Box&&($r.mp4Box.stop(),$r.mp4Box.flush(),$r.mp4Box.destroy(),$r.mp4Box=null),$r.transportDescarmber&&($r.transportDescarmber.destroy(),$r.transportDescarmber=null),$r.offset=0,$r.videoTrackId=null,$r.audioTrackId=null,$r.isHevc=!1}},jr={LOG_NAME:"worker mpeg4Demuxer",lastBuffer:new Uint8Array(0),parsedOffset:0,firstStartCodeOffset:0,secondStartCodeOffset:0,state:"init",hasInitVideoCodec:!1,localDts:0,dispatch(e){const t=new Uint8Array(e);jr.extractNALu(t)},destroy(){jr.lastBuffer=new Uint8Array(0),jr.parsedOffset=0,jr.firstStartCodeOffset=0,jr.secondStartCodeOffset=0,jr.state="init",jr.hasInitVideoCodec=!1,jr.localDts=0},extractNALu(e){if(!e||e.byteLength<1)return void ni.debugWarn(jr.LOG_NAME,"extractNALu() buffer error",e);const t=new Uint8Array(jr.lastBuffer.length+e.length);for(t.set(jr.lastBuffer,0),t.set(new Uint8Array(e),jr.lastBuffer.length),jr.lastBuffer=t;;){if("init"===jr.state){let e=!1;for(;jr.lastBuffer.length-jr.parsedOffset>=4;)if(0===jr.lastBuffer[jr.parsedOffset])if(0===jr.lastBuffer[jr.parsedOffset+1])if(1===jr.lastBuffer[jr.parsedOffset+2]){if(182===jr.lastBuffer[jr.parsedOffset+3]){jr.state="findFirstStartCode",jr.firstStartCodeOffset=jr.parsedOffset,jr.parsedOffset+=4,e=!0;break}jr.parsedOffset++}else jr.parsedOffset++;else jr.parsedOffset++;else jr.parsedOffset++;if(e)continue;break}if("findFirstStartCode"===jr.state){let e=!1;for(;jr.lastBuffer.length-jr.parsedOffset>=4;)if(0===jr.lastBuffer[jr.parsedOffset])if(0===jr.lastBuffer[jr.parsedOffset+1])if(1===jr.lastBuffer[jr.parsedOffset+2]){if(182===jr.lastBuffer[jr.parsedOffset+3]){jr.state="findSecondStartCode",jr.secondStartCodeOffset=jr.parsedOffset,jr.parsedOffset+=4,e=!0;break}jr.parsedOffset++}else jr.parsedOffset++;else jr.parsedOffset++;else jr.parsedOffset++;if(e)continue;break}if("findSecondStartCode"===jr.state){if(!(jr.lastBuffer.length-jr.parsedOffset>0))break;{let e,t,r=192&jr.lastBuffer[jr.parsedOffset];e=0==r?jr.secondStartCodeOffset-14:jr.secondStartCodeOffset;let i=0==(192&jr.lastBuffer[jr.firstStartCodeOffset+4]);if(i){if(jr.firstStartCodeOffset-14<0)return void ni.debugWarn(jr.LOG_NAME,"firstStartCodeOffset -14 is",jr.firstStartCodeOffset-14);jr.hasInitVideoCodec||(jr.hasInitVideoCodec=!0,ni.debugLog(jr.LOG_NAME,"setCodec"),oi.setCodec(Me,"")),t=jr.lastBuffer.subarray(jr.firstStartCodeOffset-14,e)}else t=jr.lastBuffer.subarray(jr.firstStartCodeOffset,e);let s=jr.getNaluDts();jr.hasInitVideoCodec?(postMessage({cmd:O,type:Ue,value:t.byteLength}),postMessage({cmd:O,type:xe,value:s}),Se=s,oi.decode(t,i?1:0,s)):ni.debugWarn(jr.LOG_NAME,"has not init video codec"),jr.lastBuffer=jr.lastBuffer.subarray(e),jr.firstStartCodeOffset=0==r?14:0,jr.parsedOffset=jr.firstStartCodeOffset+4,jr.state="findFirstStartCode"}}}},getNaluDts(){let e=jr.localDts;return jr.localDts=jr.localDts+40,e}},ii={TAG_NAME:"worker TsLoaderV2",first_parse_:!0,tsPacketSize:0,syncOffset:0,pmt_:null,config_:null,media_info_:new Ns,timescale_:90,duration_:0,pat_:{version_number:0,network_pid:0,program_map_pid:{}},current_program_:null,current_pmt_pid_:-1,program_pmt_map_:{},pes_slice_queues_:{},section_slice_queues_:{},video_metadata_:{vps:null,sps:null,pps:null,details:null},audio_metadata_:{codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},last_pcr_:null,audio_last_sample_pts_:void 0,aac_last_incomplete_data_:null,has_video_:!1,has_audio_:!1,video_init_segment_dispatched_:!1,audio_init_segment_dispatched_:!1,video_metadata_changed_:!1,audio_metadata_changed_:!1,loas_previous_frame:null,video_track_:{type:"video",id:1,sequenceNumber:0,samples:[],length:0},audio_track_:{type:"audio",id:2,sequenceNumber:0,samples:[],length:0},_remainingPacketData:null,init(){},destroy(){ii.media_info_=null,ii.pes_slice_queues_=null,ii.section_slice_queues_=null,ii.video_metadata_=null,ii.audio_metadata_=null,ii.aac_last_incomplete_data_=null,ii.video_track_=null,ii.audio_track_=null,ii._remainingPacketData=null},probe(e){let t=new Uint8Array(e),r=-1,i=188;if(t.byteLength<=3*i)return{needMoreData:!0};for(;-1===r;){let e=Math.min(1e3,t.byteLength-3*i);for(let s=0;s=4&&(r-=4),{match:!0,consumed:0,ts_packet_size:i,sync_offset:r})},_initPmt:()=>({program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}),dispatch(e){ii._remainingPacketData&&(e=hs(ii._remainingPacketData,e),ii._remainingPacketData=null);let t=e.buffer;const r=ii.parseChunks(t);r?ii._remainingPacketData=e.subarray(r):e.length>>6;r[1];let n=(31&r[1])<<8|r[2],a=(48&r[3])>>>4,o=15&r[3],d=!(!ii.pmt_||ii.pmt_.pcr_pid!==n),l={},c=4;if(2==a||3==a){let e=r[4];if(e>0&&(d||3==a)&&(l.discontinuity_indicator=(128&r[5])>>>7,l.random_access_indicator=(64&r[5])>>>6,l.elementary_stream_priority_indicator=(32&r[5])>>>5,(16&r[5])>>>4)){let e=300*(r[6]<<25|r[7]<<17|r[8]<<9|r[9]<<1|r[10]>>>7)+((1&r[10])<<8|r[11]);ii.last_pcr_=e}if(2==a||5+e===188){t+=188,204===ii.tsPacketSize&&(t+=16);continue}c=5+e}if(1==a||3==a)if(0===n||n===ii.current_pmt_pid_||null!=ii.pmt_&&ii.pmt_.pid_stream_type[n]===Ls){let r=188-c;ii.handleSectionSlice(e,t+c,r,{pid:n,payload_unit_start_indicator:s,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}else if(null!=ii.pmt_&&null!=ii.pmt_.pid_stream_type[n]){let r=188-c,i=ii.pmt_.pid_stream_type[n];n!==ii.pmt_.common_pids.h264&&n!==ii.pmt_.common_pids.h265&&n!==ii.pmt_.common_pids.adts_aac&&n!==ii.pmt_.common_pids.loas_aac&&n!==ii.pmt_.common_pids.ac3&&n!==ii.pmt_.common_pids.eac3&&n!==ii.pmt_.common_pids.opus&&n!==ii.pmt_.common_pids.mp3&&!0!==ii.pmt_.pes_private_data_pids[n]&&!0!==ii.pmt_.timed_id3_pids[n]&&!0!==ii.pmt_.synchronous_klv_pids[n]&&!0!==ii.pmt_.asynchronous_klv_pids[n]||ii.handlePESSlice(e,t+c,r,{pid:n,stream_type:i,payload_unit_start_indicator:s,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}t+=188,204===ii.tsPacketSize&&(t+=16)}return ii.dispatchAudioVideoMediaSegment(),t},handleSectionSlice(e,t,r,i){let s=new Uint8Array(e,t,r),n=ii.section_slice_queues_[i.pid];if(i.payload_unit_start_indicator){let a=s[0];if(null!=n&&0!==n.total_length){let s=new Uint8Array(e,t+1,Math.min(r,a));n.slices.push(s),n.total_length+=s.byteLength,n.total_length===n.expected_length?ii.emitSectionSlices(n,i):ii.clearSlices(n,i)}for(let o=1+a;o=n.expected_length&&ii.clearSlices(n,i),o+=d.byteLength}}else if(null!=n&&0!==n.total_length){let s=new Uint8Array(e,t,Math.min(r,n.expected_length-n.total_length));n.slices.push(s),n.total_length+=s.byteLength,n.total_length===n.expected_length?ii.emitSectionSlices(n,i):n.total_length>=n.expected_length&&ii.clearSlices(n,i)}},handlePESSlice(e,t,r,i){let s=new Uint8Array(e,t,r),n=s[0]<<16|s[1]<<8|s[2];s[3];let a=s[4]<<8|s[5];if(i.payload_unit_start_indicator){if(1!==n)return void ni.debugWarn(ii.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${n}`);let e=ii.pes_slice_queues_[i.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?ii.emitPESSlices(e,i):ii.clearSlices(e,i)),ii.pes_slice_queues_[i.pid]=new Ps,ii.pes_slice_queues_[i.pid].random_access_indicator=i.random_access_indicator}if(null==ii.pes_slice_queues_[i.pid])return;let o=ii.pes_slice_queues_[i.pid];o.slices.push(s),i.payload_unit_start_indicator&&(o.expected_length=0===a?0:a+6),o.total_length+=s.byteLength,o.expected_length>0&&o.expected_length===o.total_length?ii.emitPESSlices(o,i):o.expected_length>0&&o.expected_length>>6,o=t[8];2!==a&&3!==a||(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,n=3===a?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:r);let d,l=9+o;if(0!==s){if(s<3+o)return void ni.debugWarn(ii.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");d=s-3-o}else d=t.byteLength-l;let c=t.subarray(l,l+d);switch(e.stream_type){case As:case Bs:ii.parseMP3Payload(c,r);break;case Us:ii.pmt_.common_pids.opus===e.pid||ii.pmt_.common_pids.ac3===e.pid||ii.pmt_.common_pids.eac3===e.pid||(ii.pmt_.asynchronous_klv_pids[e.pid]?ii.parseAsynchronousKLVMetadataPayload(c,e.pid,i):ii.pmt_.smpte2038_pids[e.pid]?ii.parseSMPTE2038MetadataPayload(c,r,n,e.pid,i):ii.parsePESPrivateDataPayload(c,r,n,e.pid,i));break;case xs:ii.parseADTSAACPayload(c,r);break;case ks:ii.parseLOASAACPayload(c,r);break;case Ts:case Cs:break;case Ds:ii.pmt_.timed_id3_pids[e.pid]?ii.parseTimedID3MetadataPayload(c,r,n,e.pid,i):ii.pmt_.synchronous_klv_pids[e.pid]&&ii.parseSynchronousKLVMetadataPayload(c,r,n,e.pid,i);break;case Is:ii.parseH264Payload(c,r,n,e.random_access_indicator);break;case Fs:ii.parseH265Payload(c,r,n,e.random_access_indicator)}}else if((188===i||191===i||240===i||241===i||255===i||242===i||248===i)&&e.stream_type===Us){let r,n=6;r=0!==s?s:t.byteLength-n;let a=t.subarray(n,n+r);ii.parsePESPrivateDataPayload(a,void 0,void 0,e.pid,i)}}else ni.debugError(ii.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${r}`)},parsePAT(e){let t=e[0];if(0!==t)return void Log.e(ii.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let r=(15&e[1])<<8|e[2];e[3],e[4];let i=(62&e[5])>>>1,s=1&e[5],n=e[6];e[7];let a=null;if(1===s&&0===n)a={version_number:0,network_pid:0,program_pmt_pid:{}},a.version_number=i;else if(a=ii.pat_,null==a)return;let o=r-5-4,d=-1,l=-1;for(let t=8;t<8+o;t+=4){let r=e[t]<<8|e[t+1],i=(31&e[t+2])<<8|e[t+3];0===r?a.network_pid=i:(a.program_pmt_pid[r]=i,-1===d&&(d=r),-1===l&&(l=i))}1===s&&0===n&&(null==ii.pat_&&ni.debugLog(ii.TAG_NAME,`Parsed first PAT: ${JSON.stringify(a)}`),ii.pat_=a,ii.current_program_=d,ii.current_pmt_pid_=l)},parsePMT(e){let t=e[0];if(2!==t)return void ni.debugError(ii.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let r,i=(15&e[1])<<8|e[2],s=e[3]<<8|e[4],n=(62&e[5])>>>1,a=1&e[5],o=e[6];if(e[7],1===a&&0===o)r=ii._initPmt(),r.program_number=s,r.version_number=n,ii.program_pmt_map_[s]=r;else if(r=ii.program_pmt_map_[s],null==r)return;r.pcr_pid=(31&e[8])<<8|e[9];let d=(15&e[10])<<8|e[11],l=12+d,c=i-9-d-4;for(let t=l;t0){for(let i=t+5;i0)for(let i=t+5;iii.has_video_&&ii.has_audio_?ii.video_init_segment_dispatched_&&ii.audio_init_segment_dispatched_:ii.has_video_&&!ii.has_audio_?ii.video_init_segment_dispatched_:!(ii.has_video_||!ii.has_audio_)&&ii.audio_init_segment_dispatched_,dispatchVideoInitSegment(){let e=ii.video_metadata_.details,t={type:"video"};t.id=ii.video_track_.id,t.timescale=1e3,t.duration=ii.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;let r=t.frameRate.fps_den,i=t.frameRate.fps_num;if(t.refSampleDuration=r/i*1e3,t.codec=e.codec_mimetype,ii.video_metadata_.vps){ni.isHevc=!0;let e=ii.video_metadata_.vps.data.subarray(4),r=ii.video_metadata_.sps.data.subarray(4),i=ii.video_metadata_.pps.data.subarray(4);t.hvcc=qr({vps:e,sps:r,pps:i}),0==ii.video_init_segment_dispatched_&&ni.debugLog(ii.TAG_NAME,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.hvcc&&ni.decodeVideo(t.hvcc,0,!0,0)}else{let e=ii.video_metadata_.sps.data.subarray(4),r=ii.video_metadata_.pps.data.subarray(4);t.avcc=Dr({sps:e,pps:r}),0==ii.video_init_segment_dispatched_&&ni.debugLog(ii.TAG_NAME,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.avcc&&ni.decodeVideo(t.avcc,0,!0,0)}ii.video_init_segment_dispatched_=!0,ii.video_metadata_changed_=!1;let s=ii.media_info_;s.hasVideo=!0,s.width=t.codecWidth,s.height=t.codecHeight,s.fps=t.frameRate.fps,s.profile=t.profile,s.level=t.level,s.refFrames=e.ref_frames,s.chromaFormat=e.chroma_format_string,s.sarNum=t.sarRatio.width,s.sarDen=t.sarRatio.height,s.videoCodec=t.codec,s.hasAudio&&s.audioCodec?s.mimeType=`video/mp2t; codecs="${s.videoCodec},${s.audioCodec}"`:s.mimeType=`video/mp2t; codecs="${s.videoCodec}"`},dispatchVideoMediaSegment(){ii.isInitSegmentDispatched()&&ii.video_track_.length&&ii._preDoDecode()},dispatchAudioMediaSegment(){ii.isInitSegmentDispatched()&&ii.audio_track_.length&&ii._preDoDecode()},dispatchAudioVideoMediaSegment(){ii.isInitSegmentDispatched()&&(ii.audio_track_.length||ii.video_track_.length)&&ii._preDoDecode()},parseADTSAACPayload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;if(ii.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+ii.aac_last_incomplete_data_.byteLength);t.set(ii.aac_last_incomplete_data_,0),t.set(e,ii.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/ii.timescale_),"aac"===ii.audio_metadata_.codec){if(null==t&&null!=ii.audio_last_sample_pts_)r=1024/ii.audio_metadata_.sampling_frequency*1e3,i=ii.audio_last_sample_pts_+r;else if(null==t)return void ni.debugWarn(ii.TAG_NAME,"AAC: Unknown pts");if(ii.aac_last_incomplete_data_&&ii.audio_last_sample_pts_){r=1024/ii.audio_metadata_.sampling_frequency*1e3;let e=ii.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(ni.debugWarn(ii.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let s,n=new Zt(e),a=null,o=i;for(;null!=(a=n.readNextAACFrame());){r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},ii.dispatchAudioInitSegment(e)):ii.detectAudioMetadataChange(e)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(e)),s=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let n={payload:i,length:i.byteLength,pts:t,dts:t,type:ne};ii.audio_track_.samples.push(n),ii.audio_track_.length+=i.byteLength,o+=r}n.hasIncompleteData()&&(ii.aac_last_incomplete_data_=n.getIncompleteData()),s&&(ii.audio_last_sample_pts_=s)},parseLOASAACPayload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;if(ii.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+ii.aac_last_incomplete_data_.byteLength);t.set(ii.aac_last_incomplete_data_,0),t.set(e,ii.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/ii.timescale_),"aac"===ii.audio_metadata_.codec){if(null==t&&null!=ii.audio_last_sample_pts_)r=1024/ii.audio_metadata_.sampling_frequency*1e3,i=ii.audio_last_sample_pts_+r;else if(null==t)return void ni.debugWarn(ii.TAG_NAME,"AAC: Unknown pts");if(ii.aac_last_incomplete_data_&&ii.audio_last_sample_pts_){r=1024/ii.audio_metadata_.sampling_frequency*1e3;let e=ii.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(ni.debugWarn(ii.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let s,n=new Jt(e),a=null,o=i;for(;null!=(a=n.readNextAACFrame(or(this.loas_previous_frame)?void 0:this.loas_previous_frame));){ii.loas_previous_frame=a,r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},ii.dispatchAudioInitSegment(e)):ii.detectAudioMetadataChange(e)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(e)),s=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let n={payload:i,length:i.byteLength,pts:t,dts:t,type:ne};ii.audio_track_.samples.push(n),ii.audio_track_.length+=i.byteLength,o+=r}n.hasIncompleteData()&&(ii.aac_last_incomplete_data_=n.getIncompleteData()),s&&(ii.audio_last_sample_pts_=s)},parseAC3Payload(e,t){},parseEAC3Payload(e,t){},parseOpusPayload(e,t){},parseMP3Payload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;let r=[44100,48e3,32e3,0],i=[22050,24e3,16e3,0],s=[11025,12e3,8e3,0],n=e[1]>>>3&3,a=(6&e[1])>>1;e[2];let o=(12&e[2])>>>2,d=3!=(e[3]>>>6&3)?2:1,l=0,c=34;switch(n){case 0:l=s[o];break;case 2:l=i[o];break;case 3:l=r[o]}switch(a){case 1:c=34;break;case 2:c=33;break;case 3:c=32}const u={};u.object_type=c,u.sample_rate=l,u.channel_count=d,u.data=e;const h={codec:"mp3",data:u};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"mp3",object_type:c,sample_rate:l,channel_count:d},ii.dispatchAudioInitSegment(h)):ii.detectAudioMetadataChange(h)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(h));let f={payload:e,length:e.byteLength,pts:t/ii.timescale_,dts:t/ii.timescale_,type:ne};ii.audio_track_.samples.push(f),ii.audio_track_.length+=e.byteLength},detectAudioMetadataChange(e){if(e.codec!==ii.audio_metadata_.codec)return ni.debugLog(ii.TAG_NAME,`Audio: Audio Codecs changed from ${ii.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===ii.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==ii.audio_metadata_.audio_object_type)return ni.debugLog(ii.TAG_NAME,`AAC: AudioObjectType changed from ${ii.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==ii.audio_metadata_.sampling_freq_index)return ni.debugLog(ii.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==ii.audio_metadata_.channel_config)return ni.debugLog(ii.TAG_NAME,`AAC: Channel configuration changed from ${ii.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===ii.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==ii.audio_metadata_.sampling_frequency)return ni.debugLog(ii.TAG_NAME,`AC3: Sampling Frequency changed from ${ii.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==ii.audio_metadata_.bit_stream_identification)return ni.debugLog(ii.TAG_NAME,`AC3: Bit Stream Identification changed from ${ii.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==ii.audio_metadata_.bit_stream_mode)return ni.debugLog(ii.TAG_NAME,`AC3: BitStream Mode changed from ${ii.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==ii.audio_metadata_.channel_mode)return ni.debugLog(ii.TAG_NAME,`AC3: Channel Mode changed from ${ii.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==ii.audio_metadata_.low_frequency_effects_channel_on)return ni.debugLog(ii.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${ii.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===ii.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==ii.audio_metadata_.sample_rate)return ni.debugLog(ii.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==ii.audio_metadata_.channel_count)return ni.debugLog(ii.TAG_NAME,`Opus: Channel count changed from ${ii.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===ii.audio_metadata_.codec){const t=e.data;if(t.object_type!==ii.audio_metadata_.object_type)return ni.debugLog(ii.TAG_NAME,`MP3: AudioObjectType changed from ${ii.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==ii.audio_metadata_.sample_rate)return ni.debugLog(ii.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==ii.audio_metadata_.channel_count)return ni.debugLog(ii.TAG_NAME,`MP3: Channel count changed from ${ii.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1},dispatchAudioInitSegment(e){let t={type:"audio"};if(t.id=ii.audio_track_.id,t.timescale=1e3,t.duration=ii.duration_,"aac"===ii.audio_metadata_.codec){let r="aac"===e.codec?e.data:null,i=new Os(r);t.audioSampleRate=i.sampling_rate,t.audioSampleRateIndex=i.sampling_index,t.channelCount=i.channel_count,t.codec=i.codec_mimetype,t.originalCodec=i.original_codec_mimetype,t.config=i.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale;const s=jt({profile:ni._opt.mseDecodeAudio?i.object_type:i.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});ni.decodeAudio(s,0)}else"ac-3"===ii.audio_metadata_.codec||"ec-3"===ii.audio_metadata_.codec||"opus"===ii.audio_metadata_.codec||"mp3"===ii.audio_metadata_.codec&&(t.audioSampleRate=ii.audio_metadata_.sample_rate,t.channelCount=ii.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==ii.audio_init_segment_dispatched_&&ni.debugLog(ii.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),ii.audio_init_segment_dispatched_=!0,ii.video_metadata_changed_=!1;let r=ii.media_info_;r.hasAudio=!0,r.audioCodec=t.originalCodec,r.audioSampleRate=t.audioSampleRate,r.audioChannelCount=t.channelCount,r.hasVideo&&r.videoCodec?r.mimeType=`video/mp2t; codecs="${r.videoCodec},${r.audioCodec}"`:r.mimeType=`video/mp2t; codecs="${r.audioCodec}"`},dispatchPESPrivateDataDescriptor(e,t,r){},parsePESPrivateDataPayload(e,t,r,i,s){let n=new Rs;if(n.pid=i,n.stream_id=s,n.len=e.byteLength,n.data=e,null!=t){let e=Math.floor(t/ii.timescale_);n.pts=e}else n.nearest_pts=ii.getNearestTimestampMilliseconds();if(null!=r){let e=Math.floor(r/ii.timescale_);n.dts=e}},parseTimedID3MetadataPayload(e,t,r,i,s){ni.debugLog(ii.TAG_NAME,`Timed ID3 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${s}`)},parseSynchronousKLVMetadataPayload(e,t,r,i,s){ni.debugLog(ii.TAG_NAME,`Synchronous KLV Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${s}`)},parseAsynchronousKLVMetadataPayload(e,t,r){ni.debugLog(ii.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${r}`)},parseSMPTE2038MetadataPayload(e,t,r,i,s){ni.debugLog(ii.TAG_NAME,`SMPTE 2038 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${s}`)},getNearestTimestampMilliseconds:()=>null!=ii.audio_last_sample_pts_?Math.floor(ii.audio_last_sample_pts_):null!=ii.last_pcr_?Math.floor(ii.last_pcr_/300/ii.timescale_):void 0,_preDoDecode(){const e=ii.video_track_,t=ii.audio_track_;let r=e.samples;t.samples.length>0&&(r=e.samples.concat(t.samples),r=r.sort(((e,t)=>e.dts-t.dts))),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===ae?ii._doDecodeVideo({...e,payload:t}):e.type===ne&&ii._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0},_doDecodeVideo(e){const t=new Uint8Array(e.payload);let r=null;r=e.isHevc?Kr(t,e.isIFrame):Ir(t,e.isIFrame),e.isIFrame&&ni.calcIframeIntervalTimestamp(e.dts);let i=ni.cryptoPayload(r,e.isIFrame);ni.decode(i,{type:ae,ts:e.dts,isIFrame:e.isIFrame,cts:e.cts})},_doDecodeAudio(e){const t=new Uint8Array(e.payload);let r=t;gr(ni._opt.m7sCryptoAudio)&&(r=ni.cryptoPayloadAudio(t)),ni.decode(r,{type:ne,ts:e.dts,isIFrame:!1,cts:0})}},si=null;vr()&&(si={TAG_NAME:"worker MediaSource",_resetInIt(){si.isAvc=null,si.isAAC=null,si.videoInfo={},si.videoMeta={},si.audioMeta={},si.sourceBuffer=null,si.audioSourceBuffer=null,si.hasInit=!1,si.hasAudioInit=!1,si.isAudioInitInfo=!1,si.videoMimeType="",si.audioMimeType="",si.cacheTrack={},si.cacheAudioTrack={},si.timeInit=!1,si.sequenceNumber=0,si.audioSequenceNumber=0,si.firstRenderTime=null,si.firstAudioTime=null,si.mediaSourceAppendBufferFull=!1,si.mediaSourceAppendBufferError=!1,si.mediaSourceAddSourceBufferError=!1,si.mediaSourceBufferError=!1,si.mediaSourceError=!1,si.prevTimestamp=null,si.decodeDiffTimestamp=null,si.prevDts=null,si.prevAudioDts=null,si.prevPayloadBufferSize=0,si.isWidthOrHeightChanged=!1,si.prevTs=null,si.prevAudioTs=null,si.eventListenList=[],si.pendingRemoveRanges=[],si.pendingSegments=[],si.pendingAudioRemoveRanges=[],si.pendingAudioSegments=[],si.supportVideoFrameCallbackHandle=null,si.audioSourceBufferCheckTimeout=null,si.audioSourceNoDataCheckTimeout=null,si.hasPendingEos=!1,si.$video={currentTime:0,readyState:0}},init(){si.events=new fs,si._resetInIt(),si.mediaSource=new self.MediaSource,si.isDecodeFirstIIframe=!!yr(ni._opt.checkFirstIFrame),si._bindMediaSourceEvents()},destroy(){si.stop(),si._clearAudioSourceBufferCheckTimeout(),si.eventListenList&&si.eventListenList.length&&(si.eventListenList.forEach((e=>e())),si.eventListenList=[]),si._resetInIt(),si.mediaSource=null},getState:()=>si.mediaSource&&si.mediaSource.readyState,isStateOpen:()=>si.getState()===yt,isStateClosed:()=>si.getState()===vt,isStateEnded:()=>si.getState()===gt,_bindMediaSourceEvents(){const{proxy:e}=si.events,t=e(si.mediaSource,wt,(()=>{ni.debugLog(si.TAG_NAME,"sourceOpen"),si._onMediaSourceSourceOpen()})),r=e(si.mediaSource,bt,(()=>{ni.debugLog(si.TAG_NAME,"sourceClose")})),i=e(si.mediaSource,St,(()=>{ni.debugLog(si.TAG_NAME,"sourceended")}));si.eventListenList.push(t,r,i)},_onMediaSourceSourceOpen(){si.sourceBuffer||(ni.debugLog(si.TAG_NAME,"onMediaSourceSourceOpen() sourceBuffer is null and next init"),si._initSourceBuffer()),si.audioSourceBuffer||(ni.debugLog(si.TAG_NAME,"onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),si._initAudioSourceBuffer()),si._hasPendingSegments()&&si._doAppendSegments()},decodeVideo(e,t,r,i){if(ni.isDestroyed)ni.debugWarn(si.TAG_NAME,"decodeVideo() and decoder is destroyed");else if(yr(si.hasInit))if(r&&e[1]===Ut){const i=15&e[0];if(i===Pe&&yr(ni._opt.supportMSEDecodeHevc))return void si.emitError(Le.mediaSourceH265NotSupport);si.videoInfo.codec=i,postMessage({cmd:P,code:i});const s=new Uint8Array(e);postMessage({cmd:M,buffer:s,codecId:i},[s.buffer]),si.hasInit=si._decodeConfigurationRecord(e,t,r,i)}else ni.debugWarn(si.TAG_NAME,`decodeVideo has not init , isIframe is ${r} , payload is ${e[1]} so drop this frame`);else if(!si.isDecodeFirstIIframe&&r&&(si.isDecodeFirstIIframe=!0),si.isDecodeFirstIIframe){if(r&&0===e[1]){const t=15&e[0];let r={};t===Fe?r=Tr(e.slice(5)):t===Pe&&(r=Vr(e));const i=si.videoInfo;i&&i.codecWidth&&i.codecWidth&&r&&r.codecWidth&&r.codecHeight&&(r.codecWidth!==i.codecWidth||r.codecHeight!==i.codecWidth)&&(ni.debugWarn(si.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${i.codecWidth}, old height is ${i.codecHeight},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),si.isWidthOrHeightChanged=!0,si.emitError(Le.mseWidthOrHeightChange,`width: ${i.codecWidth}->${r.codecWidth}, height: ${i.codecWidth}->${r.codecHeight}`))}if(si.isWidthOrHeightChanged)return void ni.debugWarn(si.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(_r(e))return void ni.debugLog(si.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLengthsi.prevTs>0&&eE,_decodeConfigurationRecord(e,t,r,i){let s=e.slice(5),n={};if(i===Fe?n=Tr(s):i===Pe&&(n=Wr(s)),si.videoInfo.width=n.codecWidth,si.videoInfo.height=n.codecHeight,0===n.codecWidth&&0===n.codecHeight)return ni.debugWarn(si.TAG_NAME,"_decodeConfigurationRecord error",JSON.stringify(n)),si.emitError(Le.mediaSourceDecoderConfigurationError,`width is ${0===n.codecWidth} and height is ${n.codecHeight}`),!1;const a={id:Lt,type:"video",timescale:1e3,duration:0,avcc:s,codecWidth:n.codecWidth,codecHeight:n.codecHeight,videoType:n.videoType},o=ps.generateInitSegment(a);si.isAvc=i===Fe;let d=n.codec;return si.videoMimeType=d?`video/mp4; codecs="${n.codec}"`:si.isAvc?mt:_t,postMessage({cmd:k,w:n.codecWidth,h:n.codecHeight}),si._initSourceBuffer(),si.appendBuffer(o.buffer),si.sequenceNumber=0,si.cacheTrack={},si.timeInit=!1,!0},_decodeAudioConfigurationRecord(e,t){const r=e[0]>>4,i=e[0]>>1&1,s=r===$e,n=r===Ne;if(yr(n||s))return ni.debugWarn(si.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${r} ant auto wasm decode`),si.emitError(Le.mediaSourceAudioG711NotSupport),!1;const a={id:It,type:"audio",timescale:1e3};let o={};if(qt(e)){if(o=Xt(e.slice(2)),!o)return!1;a.audioSampleRate=o.sampleRate,a.channelCount=o.channelCount,a.config=o.config,a.refSampleDuration=1024/a.audioSampleRate*a.timescale}else{if(!s)return!1;if(o=Es(e),!o)return!1;a.audioSampleRate=o.samplingRate,a.channelCount=o.channelCount,a.refSampleDuration=1152/a.audioSampleRate*a.timescale}a.codec=o.codec,a.duration=0;let d="mp4",l=o.codec,c=null;s&&yr(ni._opt.isFirefox)?(d="mpeg",l="",c=new Uint8Array):c=ps.generateInitSegment(a);let u=`${a.type}/${d}`;return l&&l.length>0&&(u+=`;codecs=${l}`),yr(si.isAudioInitInfo)&&(wr=r===Ne?i?16:8:0===i?8:16,postMessage({cmd:L,code:r}),postMessage({cmd:D,sampleRate:a.audioSampleRate,channels:a.channelCount,depth:wr}),si.isAudioInitInfo=!0),si.audioMimeType=u,si.isAAC=n,si._initAudioSourceBuffer(),si.appendAudioBuffer(c.buffer),!0},_initSourceBuffer(){const{proxy:e}=si.events;if(null===si.sourceBuffer&&null!==si.mediaSource&&si.isStateOpen()&&si.videoMimeType){try{ni.debugLog(si.TAG_NAME,"_initSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",si.videoMimeType),si.sourceBuffer=si.mediaSource.addSourceBuffer(si.videoMimeType)}catch(e){return ni.debugError(si.TAG_NAME,"_initSourceBuffer() appendBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),si.emitError(Le.mseWorkerAddSourceBufferError,e.code),void(si.mediaSourceAddSourceBufferError=!0)}if(si.sourceBuffer){const t=e(si.sourceBuffer,"error",(e=>{si.mediaSourceBufferError=!0,ni.debugError(si.TAG_NAME,"mseSourceBufferError mseDecoder.sourceBuffer",e,e.toString()),si.emitError(Le.mseSourceBufferError,e.code)})),r=e(si.sourceBuffer,"updateend",(()=>{si._hasPendingRemoveRanges()?si._doRemoveRanges():si._hasPendingSegments()?si._doAppendSegments():si.hasPendingEos&&(ni.debugLog(si.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),si.endOfStream())}));si.eventListenList.push(t,r)}}else ni.debugLog(si.TAG_NAME,`_initSourceBuffer and mseDecoder.isStateOpen is ${si.isStateOpen()} and mseDecoder.isAvc === null is ${null===si.isAvc}`)},_initAudioSourceBuffer(){const{proxy:e}=si.events;if(null===si.audioSourceBuffer&&null!==si.mediaSource&&si.isStateOpen()&&si.audioMimeType){try{ni.debugLog(si.TAG_NAME,"_initAudioSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",si.audioMimeType),si._clearAudioSourceBufferCheckTimeout(),si.audioSourceBuffer=si.mediaSource.addSourceBuffer(si.audioMimeType)}catch(e){return ni.debugError(si.TAG_NAME,"_initAudioSourceBuffer() addSourceBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),si.emitError(Le.mseWorkerAddSourceBufferError,e.code),void(si.mediaSourceAddSourceBufferError=!0)}if(si.audioSourceBuffer){const t=e(si.audioSourceBuffer,"error",(e=>{si.mediaSourceBufferError=!0,ni.debugError(si.TAG_NAME,"mseSourceBufferError mseDecoder.audioSourceBuffer",e.code,e.toString(),e),si.emitError(Le.mseSourceBufferError,e.code)})),r=e(si.audioSourceBuffer,"updateend",(()=>{si._hasPendingRemoveRanges()?si._doRemoveRanges():si._hasPendingSegments()?si._doAppendSegments():si.hasPendingEos&&(ni.debugLog(si.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),si.endOfStream())}));si.eventListenList.push(t,r),null===si.audioSourceNoDataCheckTimeout&&(si.audioSourceNoDataCheckTimeout=setTimeout((()=>{si._clearAudioNoDataCheckTimeout(),si.emitError(Le.mediaSourceAudioNoDataTimeout)}),1e3))}}else ni.debugLog(si.TAG_NAME,`_initAudioSourceBuffer and mseDecoder.isStateOpen is ${si.isStateOpen()} and mseDecoder.audioMimeType is ${si.audioMimeType}`)},_decodeVideo(e,t,r,i,s){let n=e.slice(5),a=n.byteLength;if(0===a)return void ni.debugWarn(si.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let o=(new Date).getTime(),d=!1;si.prevTimestamp||(si.prevTimestamp=o,d=!0);const l=o-si.prevTimestamp;if(si.decodeDiffTimestamp=l,l>1e3&&!d&&ni.isPlayer&&ni.debugLog(si.TAG_NAME,`_decodeVideo now time is ${o} and prev time is ${si.prevTimestamp}, diff time is ${l} ms`),si.cacheTrack.id&&t>=si.cacheTrack.dts){let e=8+si.cacheTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(ps.types.mdat,4),r.set(si.cacheTrack.data,8),si.cacheTrack.duration=t-si.cacheTrack.dts;let i=ps.moof(si.cacheTrack,si.cacheTrack.dts);si.cacheTrack={};let s=new Uint8Array(i.byteLength+r.byteLength);s.set(i,0),s.set(r,i.byteLength),si.appendBuffer(s.buffer)}else ni.debugLog(si.TAG_NAME,`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${s} cacheTrack dts is ${si.cacheTrack&&si.cacheTrack.dts}`),si.timeInit=!1,si.cacheTrack={};si.cacheTrack||(si.cacheTrack={}),si.cacheTrack.id=Lt,si.cacheTrack.sequenceNumber=++si.sequenceNumber,si.cacheTrack.size=a,si.cacheTrack.dts=t,si.cacheTrack.cts=i,si.cacheTrack.isKeyframe=r,si.cacheTrack.data=n,si.cacheTrack.flags={isLeading:0,dependsOn:r?2:1,isDependedOn:r?1:0,hasRedundancy:0,isNonSync:r?0:1},si.prevTimestamp=(new Date).getTime()},_decodeAudio(e,t,r){let i=si.isAAC?e.slice(2):e.slice(1),s=i.byteLength;if(si.cacheAudioTrack.id&&t>=si.cacheAudioTrack.dts){let e=8+si.cacheAudioTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(ps.types.mdat,4),r.set(si.cacheAudioTrack.data,8),si.cacheAudioTrack.duration=t-si.cacheAudioTrack.dts;let i=ps.moof(si.cacheAudioTrack,si.cacheAudioTrack.dts);si.cacheAudioTrack={};let s=new Uint8Array(i.byteLength+r.byteLength);s.set(i,0),s.set(r,i.byteLength),si.appendAudioBuffer(s.buffer)}else si.cacheAudioTrack={};si.cacheAudioTrack||(si.cacheAudioTrack={}),si.cacheAudioTrack.id=It,si.cacheAudioTrack.sequenceNumber=++si.audioSequenceNumber,si.cacheAudioTrack.size=s,si.cacheAudioTrack.dts=t,si.cacheAudioTrack.cts=0,si.cacheAudioTrack.data=i,si.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}},appendBuffer(e){ni.isDestroyed?ni.debugWarn(si.TAG_NAME,"appendBuffer() player is destroyed"):si.mediaSourceAddSourceBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):si.mediaSourceAppendBufferFull?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):si.mediaSourceAppendBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):si.mediaSourceBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(si.pendingSegments.push(e),si.sourceBuffer&&(ni._opt.mseAutoCleanupSourceBuffer&&si._needCleanupSourceBuffer()&&si._doCleanUpSourceBuffer(),yr(si.getSourceBufferUpdating())&&si.isStateOpen()&&yr(si._hasPendingRemoveRanges()))?si._doAppendSegments():si.isStateClosed()?(si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):si.isStateEnded()&&(si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,"mediaSource is end")))},appendAudioBuffer(e){ni.isDestroyed?ni.debugWarn(si.TAG_NAME,"appendAudioBuffer() player is destroyed"):si.mediaSourceAddSourceBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):si.mediaSourceAppendBufferFull?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):si.mediaSourceAppendBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):si.mediaSourceBufferError?ni.debugWarn(si.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(si.pendingAudioSegments.push(e),si.audioSourceBuffer&&(ni._opt.mseAutoCleanupSourceBuffer&&si._needCleanupSourceBuffer()&&si._doCleanUpSourceBuffer(),yr(si.getAudioSourceBufferUpdating())&&si.isStateOpen()&&yr(si._hasPendingRemoveRanges()))?si._doAppendSegments():si.isStateClosed()?(si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):si.isStateEnded()&&(si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,"mediaSource is end")))},getSourceBufferUpdating:()=>si.sourceBuffer&&si.sourceBuffer.updating,getAudioSourceBufferUpdating:()=>si.audioSourceBuffer&&si.audioSourceBuffer.updating,stop(){si.abortSourceBuffer(),si.removeSourceBuffer(),si.endOfStream()},clearUpAllSourceBuffer(){if(si.sourceBuffer){const e=si.sourceBuffer.buffered;for(let t=0;tsi.pendingSegments.length>0||si.pendingAudioSegments.length>0,getPendingSegmentsLength:()=>si.pendingSegments.length,_handleUpdatePlaybackRate(){},_doAppendSegments(){if(si.isStateClosed()||si.isStateEnded())ni.debugLog(si.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==si.sourceBuffer){if(si.needInitAudio()&&null===si.audioSourceBuffer)return ni.debugLog(si.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===si.audioSourceBufferCheckTimeout&&(si.audioSourceBufferCheckTimeout=setTimeout((()=>{si._clearAudioSourceBufferCheckTimeout(),si.emitError(Le.mediaSourceAudioInitTimeout)}),1e3)));if(yr(si.getSourceBufferUpdating())&&si.pendingSegments.length>0){const e=si.pendingSegments.shift();try{si.sourceBuffer.appendBuffer(e)}catch(e){ni.debugError(si.TAG_NAME,"mseDecoder.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(si.stop(),si.mediaSourceAppendBufferFull=!0,si.emitError(Le.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(si.stop(),si.mediaSourceAppendBufferError=!0,si.emitError(Le.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(si.stop(),si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,`code is ${e.code} , message is ${e.message}`))}}if(yr(si.getAudioSourceBufferUpdating())&&si.pendingAudioSegments.length>0){const e=si.pendingAudioSegments.shift();try{si.audioSourceBuffer.appendBuffer(e)}catch(e){ni.debugError(si.TAG_NAME,"mseDecoder.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(si.stop(),si.mediaSourceAppendBufferFull=!0,si.emitError(Le.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(si.stop(),si.mediaSourceAppendBufferError=!0,si.emitError(Le.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(si.stop(),si.mediaSourceBufferError=!0,si.emitError(Le.mseSourceBufferError,e.code,`code is ${e.code} , message is ${e.message}`))}}}else ni.debugLog(si.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")},_doCleanUpSourceBuffer(){const e=si.$video.currentTime;if(si.sourceBuffer){const t=si.sourceBuffer.buffered;let r=!1;for(let i=0;i=ni._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-ni._opt.mseAutoCleanupMinBackwardDuration;si.pendingRemoveRanges.push({start:s,end:t})}}else n=ni._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-ni._opt.mseAutoCleanupMinBackwardDuration;si.pendingAudioRemoveRanges.push({start:s,end:t})}}else nsi.pendingRemoveRanges.length>0||si.pendingAudioRemoveRanges.length>0,needInitAudio:()=>ni._opt.hasAudio&&ni._opt.mseDecodeAudio,_doRemoveRanges(){if(si.sourceBuffer&&yr(si.getSourceBufferUpdating())){let e=si.pendingRemoveRanges;for(;e.length&&yr(si.getSourceBufferUpdating());){let t=e.shift();try{si.sourceBuffer.remove(t.start,t.end)}catch(e){ni.debugWarn(si.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e,e.toString())}}}if(si.audioSourceBuffer&&yr(si.getAudioSourceBufferUpdating())){let e=si.pendingAudioRemoveRanges;for(;e.length&&yr(si.getAudioSourceBufferUpdating());){let t=e.shift();try{si.audioSourceBuffer.remove(t.start,t.end)}catch(e){ni.debugWarn(si.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e,e.toString())}}}},_getPlaybackRate(){},_needCleanupSourceBuffer(){if(yr(ni._opt.mseAutoCleanupSourceBuffer))return!1;const e=si.$video.currentTime;if(si.sourceBuffer){let t=si.sourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=ni._opt.mseAutoCleanupMaxBackwardDuration)return!0}if(si.audioSourceBuffer){let t=si.audioSourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=ni._opt.mseAutoCleanupMaxBackwardDuration)return!0}return!1},_clearAudioSourceBufferCheckTimeout(){si.audioSourceBufferCheckTimeout&&(clearTimeout(si.audioSourceBufferCheckTimeout),si.audioSourceBufferCheckTimeout=null)},_clearAudioNoDataCheckTimeout(){si.audioSourceNoDataCheckTimeout&&(clearTimeout(si.audioSourceNoDataCheckTimeout),si.audioSourceNoDataCheckTimeout=null)},getHandle:()=>si.mediaSource.handle,emitError(e){postMessage({cmd:se,value:e,msg:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""})}});let ni={isPlayer:!0,isHevc:null,isPlayback:!1,dropping:!1,isPushDropping:!1,isWorkerFetch:!1,isDestroyed:!1,fetchStatus:Tt,_opt:Ar(),mp3Demuxer:null,delay:-1,pushLatestDelay:-1,firstTimestamp:null,startTimestamp:null,preDelayTimestamp:null,stopId:null,streamFps:null,streamAudioFps:null,streamVideoFps:null,writableStream:null,networkDelay:0,webglObj:null,startStreamRateAndStatsInterval:function(){ni.stopStreamRateAndStatsInterval(),l=setInterval((()=>{d&&d(0);const e=JSON.stringify({demuxBufferDelay:ni.getVideoBufferLength(),audioDemuxBufferDelay:ni.getAudioBufferLength(),streamBufferByteLength:ni.getStreamBufferLength(),netBuf:ni.networkDelay||0,pushLatestDelay:ni.pushLatestDelay||0,latestDelay:ni.delay,isStreamTsMoreThanLocal:Ze,wasmDecodeDelay:Se-We});postMessage({cmd:O,type:Te,value:e})}),1e3)},stopStreamRateAndStatsInterval:function(){l&&(clearInterval(l),l=null)},useOffscreen:function(){return ni._opt.useOffscreen&&"undefined"!=typeof OffscreenCanvas},getDelay:function(e,t){if(!e||ni._opt.hasVideo&&!we)return-1;if(t===ne)return ni.delay;if(ni.preDelayTimestamp&&ni.preDelayTimestamp>e)return ni.preDelayTimestamp-e>1e3&&ni.debugWarn("worker",`getDelay() and preDelayTimestamp is ${ni.preDelayTimestamp} > timestamp is ${e} more than ${ni.preDelayTimestamp-e}ms and return ${ni.delay}`),ni.preDelayTimestamp=e,ni.delay;if(ni.firstTimestamp){if(e){const t=Date.now()-ni.startTimestamp,r=e-ni.firstTimestamp;t>=r?(Ze=!1,ni.delay=t-r):(Ze=!0,ni.delay=r-t)}}else ni.firstTimestamp=e,ni.startTimestamp=Date.now(),ni.delay=-1;return ni.preDelayTimestamp=e,ni.delay},getDelayNotUpdateDelay:function(e,t){if(!e||ni._opt.hasVideo&&!we)return-1;if(t===ne)return ni.pushLatestDelay;if(ni.preDelayTimestamp&&ni.preDelayTimestamp-e>1e3)return ni.debugWarn("worker",`getDelayNotUpdateDelay() and preDelayTimestamp is ${ni.preDelayTimestamp} > timestamp is ${e} more than ${ni.preDelayTimestamp-e}ms and return -1`),-1;if(ni.firstTimestamp){let t=-1;if(e){const r=Date.now()-ni.startTimestamp,i=e-ni.firstTimestamp;r>=i?(Ze=!1,t=r-i):(Ze=!0,t=i-r)}return t}return-1},resetDelay:function(){ni.firstTimestamp=null,ni.startTimestamp=null,ni.delay=-1,ni.dropping=!1},resetAllDelay:function(){ni.resetDelay(),ni.preDelayTimestamp=null},doDecode:function(e){ni._opt.isEmitSEI&&e.type===ae&&ni.isWorkerFetch&&ni.findSei(e.payload,e.ts),ni.isPlayUseMSEAndDecoderInWorker()?e.type===ne?ni._opt.mseDecodeAudio?si.decodeAudio(e.payload,e.ts):e.decoder.decode(e.payload,e.ts):e.type===ae&&si.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):ni._opt.useWCS&&ni.useOffscreen()&&e.type===ae&&n.decode?n.decode(e.payload,e.ts,e.cts):e.decoder.decode(e.payload,e.ts,e.isIFrame,e.cts)},decodeNext(e){if(0===i.length)return;const t=e.ts,s=i[0],n=e.type===ae&&_r(e.payload);if(yr(r))n&&(ni.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${s.type} ts is ${s.ts}\n isVideoSqeHeader is ${n}`),i.shift(),ni.doDecode(s));else{const r=s.ts-t,a=s.type===ne&&e.type===ae;(r<=20||a||n)&&(ni.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${s.type} ts is ${s.ts}\n diff is ${r} and isVideoAndNextAudio is ${a} and isVideoSqeHeader is ${n}`),i.shift(),ni.doDecode(s))}},init:function(){ni.debugLog("worker","init and opt is",JSON.stringify(ni._opt));const e=ni._opt.playType===y,t=ni._opt.playType===v;if(Gr.init(),ni.isPlayer=e,ni.isPlayback=t,ni.isPlayUseMSEAndDecoderInWorker()&&si&&si.init(),n&&ni._opt.useWCS&&ni.useOffscreen()&&n.init(),yr(ni.isPlaybackCacheBeforeDecodeForFpsRender())){ni.debugLog("worker","setInterval()");const t=()=>{const t=ni._opt.videoBuffer+ni._opt.videoBufferDelay;let r=null;if(i.length){if(ni.isPushDropping)return void ni.debugWarn("worker",`loop() isPushDropping is true and bufferList length is ${i.length}`);if(ni.dropping){for(r=i.shift(),ni.debugWarn("worker",`loop() dropBuffer is dropping and isIFrame ${r.isIFrame} and delay is ${ni.delay} and bufferlist is ${i.length}`);!r.isIFrame&&i.length;)r=i.shift();const e=ni.getDelayNotUpdateDelay(r.ts,r.type);r.isIFrame&&e<=ni.getNotDroppingDelayTs()&&(ni.debugLog("worker","loop() is dropping = false, is iFrame"),ni.dropping=!1,ni.doDecode(r),ni.decodeNext(r))}else if(ni.isPlayback||ni.isPlayUseMSE()||0===ni._opt.videoBuffer)for(;i.length;)r=i.shift(),ni.doDecode(r);else if(r=i[0],-1===ni.getDelay(r.ts,r.type))ni.debugLog("worker","loop() common dumex delay is -1 ,data.ts is",r.ts),i.shift(),ni.doDecode(r),ni.decodeNext(r);else if(ni.delay>t&&e)ni.hasIframeInBufferList()?(ni.debugLog("worker",`delay is ${ni.delay} > maxDelay ${t}, set dropping is true`),ni.resetAllDelay(),ni.dropping=!0,postMessage({cmd:$})):(i.shift(),ni.doDecode(r),ni.decodeNext(r));else for(;i.length;){if(r=i[0],!(ni.getDelay(r.ts,r.type)>ni._opt.videoBuffer)){ni.delay<0&&ni.debugWarn("worker",`loop() do not decode and delay is ${ni.delay}, bufferList is ${i.length}`);break}i.shift(),ni.doDecode(r)}}else-1!==ni.delay&&ni.debugLog("worker","loop() bufferList is empty and reset delay"),ni.resetAllDelay()};ni.stopId=setInterval((()=>{let e=(new Date).getTime();Je||(Je=e);const r=e-Je;r>100&&ni.debugWarn("worker",`loop demux diff time is ${r}`),t(),Je=(new Date).getTime()}),20)}else ni.debugLog("worker","playback and playbackIsCacheBeforeDecodeForFpsRender is true");if(yr(ni._opt.checkFirstIFrame)&&(we=!0),ni.isPlayUseMSEAndDecoderInWorker()&&si){const e=si.getHandle();e&&postMessage({cmd:re,mseHandle:e},[e])}},playbackCacheLoop:function(){ni.clearPlaybackCacheLoop();const e=()=>{let e=null;i.length&&(e=i.shift(),ni.doDecode(e))};e();const t=Math.ceil(1e3/(ni.streamFps*ni._opt.playbackRate));ni.debugLog("worker",`playbackCacheLoop fragDuration is ${t}, streamFps is ${ni.streamFps}, streamAudioFps is ${ni.streamAudioFps} ,streamVideoFps is ${ni.streamVideoFps} playbackRate is ${ni._opt.playbackRate}`),ni.stopId=setInterval(e,t)},clearPlaybackCacheLoop:function(){ni.stopId&&(clearInterval(ni.stopId),ni.stopId=null)},startPlaybackCacheLoop:function(){ni.playbackCacheLoop()},close:function(){if(ni.debugLog("worker","close"),ni.isDestroyed=!0,kr(),!o||1!==o.readyState&&2!==o.readyState?o&&ni.debugLog("worker",`close() and socket.readyState is ${o.readyState}`):(Sr=!0,o.close(1e3,"Client disconnecting")),o=null,ni.stopStreamRateAndStatsInterval(),ni.stopId&&(clearInterval(ni.stopId),ni.stopId=null),ni.mp3Demuxer&&(ni.mp3Demuxer.destroy(),ni.mp3Demuxer=null),ni.writableStream&&yr(ni.writableStream.locked)&&ni.writableStream.close().catch((e=>{ni.debugLog("worker","close() and writableStream.close() error",e.toString(),e)})),ni.writableStream=null,ai)try{ai.clear&&ai.clear(),ai=null}catch(e){ni.debugLog("worker","close() and audioDecoder.clear error",e.toString(),e)}if(oi)try{oi.clear&&oi.clear(),oi=null}catch(e){ni.debugLog("worker","close() and videoDecoder.clear error",e.toString())}d=null,Je=null,Ze=!1,Se=0,We=0,n&&(n.destroy&&n.destroy(),n=null),si&&(si.destroy(),si=null),ni.firstTimestamp=null,ni.startTimestamp=null,ni.networkDelay=0,ni.streamFps=null,ni.streamAudioFps=null,ni.streamVideoFps=null,ni.delay=-1,ni.pushLatestDelay=-1,ni.preDelayTimestamp=null,ni.dropping=!1,ni.isPushDropping=!1,ni.isPlayer=!0,ni.isPlayback=!1,ni.isWorkerFetch=!1,ni.isHevc=null,ni._opt=Ar(),ni.webglObj&&(ni.webglObj.destroy(),ni.offscreenCanvas.removeEventListener("webglcontextlost",ni.onOffscreenCanvasWebglContextLost),ni.offscreenCanvas.removeEventListener("webglcontextrestored",ni.onOffscreenCanvasWebglContextRestored),ni.offscreenCanvas=null,ni.offscreenCanvasGL=null,ni.offscreenCanvasCtx=null),i=[],s=[],c&&(c.close(),c=null),h=null,w=null,S=!1,U=!1,we=!1,Vt=!1,Kt=!1,Qt=!1,nr=null,ct=[],xt=0,Nt=0,et=null,rt=null,Ot=null,Gt=null,wr=null,$t=0,Ht=0,Et=null,At=null,ni.fetchStatus=Tt,Er=!0,Gr.destroy(),$r.destroy(),jr.destroy(),ii.destroy(),ni.debug=null,ni._opt={},postMessage({cmd:Y})},pushBuffer:function(e,t){if(t.type===ne&&qt(e)){if(ni.debugLog("worker",`pushBuffer audio ts is ${t.ts}, isAacCodecPacket is true`),ni._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:J,buffer:t},[t.buffer])}ni.decodeAudio(e,t.ts)}else if(t.type===ae&&t.isIFrame&&_r(e)){if(ni.debugLog("worker",`pushBuffer video ts is ${t.ts}, isVideoSequenceHeader is true`),ni._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:Q,buffer:t},[t.buffer])}ni.decodeVideo(e,t.ts,t.isIFrame,t.cts)}else{if(ni._opt.isRecording)if(ni._opt.isRecordTypeFlv){const r=new Uint8Array(e);postMessage({cmd:ee,type:t.type,buffer:r,ts:t.ts},[r.buffer])}else if(ni._opt.recordType===b)if(t.type===ae){const r=new Uint8Array(e).slice(5);postMessage({cmd:R,buffer:r,isIFrame:t.isIFrame,ts:t.ts,cts:t.cts},[r.buffer])}else if(t.type===ne&&ni._opt.isWasmMp4){const r=new Uint8Array(e),i=Yt(r)?r.slice(2):r.slice(1);postMessage({cmd:I,buffer:i,ts:t.ts},[i.buffer])}if(ni.isPlayer){if(t.type===ae){if($t>0){const e=t.ts-Gt,r=$t+$t/2;e>r&&ni.debugLog("worker",`pushBuffer video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts}, preTs is ${Gt},\n diff is ${e} and preTsDuration is ${$t} and maxDiff is ${r}\n maybe trigger black screen or flower screen\n `)}if(null!==Gt&&Gt>=t.ts&&(ni.debugWarn("worker",`pushBuffer() and isIFrame is ${t.isIFrame} and,\n options.ts is ${t.ts} less than (or equal) preTs is ${Gt} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${Ht}`),Gt-t.ts>E&&(ni.debugWarn("worker",`pushBuffer,\n preTimestamp is ${Gt}, options.ts is ${t.ts},\n diff is ${Gt-t.ts} more than 3600000,\n and resetAllDelay`),ni.resetAllDelay(),Gt=null,$t=0),ni._opt.isDropSameTimestampGop&&yr(t.isIFrame)&&we)){const e=ni.hasIframeInBufferList(),t=yr(ni.isPushDropping);return ni.debugLog("worker",`pushBuffer, isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next dropBuffer`),void(e&&t?ni.dropBuffer$2():(ni.clearBuffer(!0),gr(ni._opt.checkFirstIFrame)&&gr(r)&&(ni.isPlayUseMSEAndDecoderInWorker()?si.isDecodeFirstIIframe=!1:postMessage({cmd:te}))))}Gt>0&&($t=t.ts-Gt),Ht=e.byteLength,Gt=t.ts}if(we){const e=ni._opt.videoBuffer+ni._opt.videoBufferDelay,r=ni.getDelayNotUpdateDelay(t.ts,t.type);ni.pushLatestDelay=r,ni.delay>0&&r>e&&ni.delay({type:e.type,ts:e.ts})));ni.debugLog("worker",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${i.length}, and ts list is ${JSON.stringify(r)}`)}const r=ni.getAudioBufferLength()>0,s=r?60:40;i.length>=s&&(ni.debugWarn("worker",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${i.length} more than ${s}, and hasAudio is ${r} an set streamFps is 25`),ni.streamVideoFps=25,postMessage({cmd:V,value:ni.streamVideoFps}),r?(ni.streamAudioFps=25,ni.streamFps=ni.streamVideoFps+ni.streamAudioFps):ni.streamFps=ni.streamVideoFps,ni.playbackCacheLoop())}}},getVideoBufferLength(){let e=0;return i.forEach((t=>{t.type===ae&&(e+=1)})),e},hasIframeInBufferList:()=>i.some((e=>e.type===ae&&e.isIFrame)),isAllIframeInBufferList(){const e=ni.getVideoBufferLength();let t=0;return i.forEach((e=>{e.type===ae&&e.isIFrame&&(t+=1)})),e===t},getNotDroppingDelayTs:()=>ni._opt.videoBuffer+ni._opt.videoBufferDelay/2,getAudioBufferLength(){let e=0;return i.forEach((t=>{t.type===ne&&(e+=1)})),e},getStreamBufferLength(){let e=0;return c&&c.buffer&&(e=c.buffer.byteLength),ni._opt.isNakedFlow?Gr.lastBuf&&(e=Gr.lastBuf.byteLength):ni._opt.isTs?ii._remainingPacketData&&(e=ii._remainingPacketData.byteLength):ni._opt.isFmp4&&$r.mp4Box&&(e=$r.mp4Box.getAllocatedSampleDataSize()),e},fetchStream:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(ni.debugLog("worker","fetchStream, url is "+e,"options:",JSON.stringify(t)),ni.isWorkerFetch=!0,t.isFlv?ni._opt.isFlv=!0:t.isFmp4?ni._opt.isFmp4=!0:t.isMpeg4?ni._opt.isMpeg4=!0:t.isNakedFlow?ni._opt.isNakedFlow=!0:t.isTs&&(ni._opt.isTs=!0),d=ar((e=>{postMessage({cmd:O,type:Ae,value:e})})),ni.startStreamRateAndStatsInterval(),t.isFmp4&&($r.listenMp4Box(),ni._opt.isFmp4Private&&$r.initTransportDescarmber()),t.protocol===m){t.isFlv&&(c=new Br(ni.demuxFlv())),a=new AbortController;const r=Object.assign({signal:a.signal},{headers:t.options&&t.options.headers||{}});fetch(e,r).then((e=>{if(gr(Sr))return ni.debugLog("worker","request abort and run res.body.cancel()"),ni.fetchStatus=Tt,void e.body.cancel();if(!pr(e))return ni.debugWarn("worker",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),kr(),void postMessage({cmd:O,type:Le.fetchError,value:`fetch response status is ${e.status} and ok is ${e.ok}`});if(postMessage({cmd:O,type:ke}),ur())ni.writableStream=new WritableStream({write:e=>a&&a.signal&&a.signal.aborted?(ni.debugLog("worker","writableStream write() and abortController.signal.aborted is true so return"),void(ni.fetchStatus=Dt)):gr(Sr)?(ni.debugLog("worker","writableStream write() and requestAbort is true so return"),ni.fetchStatus=Dt,void kr()):void("string"!=typeof e?(ni.fetchStatus=Ct,d(e.byteLength),t.isFlv?c.write(e):t.isFmp4?ni.demuxFmp4(e):t.isMpeg4?ni.demuxMpeg4(e):t.isTs?ni.demuxTs(e):t.isNakedFlow&&ni.demuxNakedFlow(e)):ni.debugWarn("worker",`writableStream write() and value is "${e}" string so return`)),close:()=>{ni.debugLog("worker","writableStream close()"),ni.fetchStatus=Dt,c&&(c.close(),c=null),kr(),postMessage({cmd:O,type:Ee,value:_,msg:"fetch done"})},abort:e=>{if(a&&a.signal&&a.signal.aborted)return ni.debugLog("worker","writableStream abort() and abortController.signal.aborted is true so return"),void(ni.fetchStatus=Dt);c&&(c.close(),c=null),e.name!==Bt?(ni.debugLog("worker",`writableStream abort() and e is ${e.toString()}`),kr(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()})):ni.debugLog("worker","writableStream abort() and e.name is AbortError so return")}}),e.body.pipeTo(ni.writableStream).catch((e=>{"AbortError"!==e.name&&ni.debugLog("worker","writableStream pipeTo() and e is",e.name,e.toString())}));else{const r=e.body.getReader(),i=()=>{r.read().then((e=>{let{done:r,value:s}=e;return r?(ni.debugLog("worker","fetchNext().then() and done is true"),ni.fetchStatus=Dt,c&&(c.close(),c=null),kr(),void postMessage({cmd:O,type:Ee,value:_,msg:"fetch done"})):a&&a.signal&&a.signal.aborted?(ni.debugLog("worker","fetchNext().then() and abortController.signal.aborted is true so return"),void(ni.fetchStatus=Dt)):gr(Sr)?(ni.debugLog("worker","fetchNext().then() and requestAbort is true so return"),ni.fetchStatus=Dt,void kr()):void("string"!=typeof s?(ni.fetchStatus=Ct,d(s.byteLength),t.isFlv?c.write(s):t.isFmp4?ni.demuxFmp4(s):t.isMpeg4?ni.demuxMpeg4(s):t.isTs?ni.demuxTs(s):t.isNakedFlow&&ni.demuxNakedFlow(s),i()):ni.debugWarn("worker",`fetchNext().then() and value "${s}" is string so return`))})).catch((e=>{if(a&&a.signal&&a.signal.aborted)return ni.debugLog("worker","fetchNext().catch() and abortController.signal.aborted is true so return"),void(ni.fetchStatus=Dt);c&&(c.close(),c=null),e.name!==Bt?(ni.debugLog("worker",`fetchNext().catch() and e is ${e.toString()}`),kr(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()})):ni.debugLog("worker","fetchNext().catch() and e.name is AbortError so return")}))};i()}})).catch((e=>{a&&a.signal&&a.signal.aborted?ni.debugLog("worker","fetch().catch() and abortController.signal.aborted is true so return"):e.name!==Bt?(ni.debugLog("worker",`fetch().catch() and e is ${e.toString()}`),kr(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()}),c&&(c.close(),c=null)):ni.debugLog("worker","fetch().catch() and e.name is AbortError so return")}))}else t.protocol===p&&(t.isFlv&&(c=new Br(ni.demuxFlv())),o=new WebSocket(e,r),o.binaryType="arraybuffer",o.onopen=()=>{ni.debugLog("worker","fetchStream, WebsocketStream socket open"),postMessage({cmd:O,type:ke}),postMessage({cmd:O,type:De})},o.onclose=e=>{ni.isDestroyed?ni.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} and isDestroyed is true, so return`):u?ni.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} but isSocketError is true , so return`):(ni.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code}`),1006===e.code&&ni.debugError("worker",`fetchStream, WebsocketStream socket close abnormally and code is ${e.code}`),gr(Sr)?ni.debugLog("worker","fetchStream, WebsocketStream socket close and requestAbort is true so return"):(c&&(c.close(),c=null),postMessage({cmd:O,type:Ee,value:g,msg:e.code})))},o.onerror=e=>{ni.debugError("worker","fetchStream, WebsocketStream socket error",e,e.toString()),u=!0,c&&(c.close(),c=null),ni.isDestroyed?ni.debugLog("worker","fetchStream, WebsocketStream on error and isDestroyed is true, so return"):postMessage({cmd:O,type:Le.websocketError,value:e.isTrusted?"websocket user aborted":"websocket error"})},o.onmessage=e=>{"string"!=typeof e.data?(d(e.data.byteLength),t.isFlv?c.write(e.data):t.isFmp4?ni.demuxFmp4(e.data):t.isMpeg4?ni.demuxMpeg4(e.data):ni._opt.isNakedFlow?ni.demuxNakedFlow(e.data):ni.demuxM7s(e.data)):ni.debugWarn("worker",`socket on message is string "${e.data}" and return`)})},demuxFlv:function*(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),r=new Uint32Array(e);for(;;){t[3]=0;const e=yield 15,i=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const s=r[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let n=r[0];const a=(yield s).slice();switch(i){case oe:if(a.byteLength>0){let e=a;gr(ni._opt.m7sCryptoAudio)&&(e=ni.cryptoPayloadAudio(a)),ni.decode(e,{type:ne,ts:n})}else ni.debugWarn("worker",`demuxFlv() type is audio and payload.byteLength is ${a.byteLength} and return`);break;case de:if(a.byteLength>=6){const e=a[0];if(ni._isEnhancedH265Header(e))ni._decodeEnhancedH265Video(a,n);else{const e=15&a[0];let t=a[0]>>4===kt;const i=e===Pe;if(yr(t)&&gr(br(a,i))&&(ni.debugLog("worker","demux() isIFrame is false and unit type is IDR and update to true"),t=!0),t&&_r(a)&&null===ni.isHevc){const e=15&a[0];ni.isHevc=e===Pe,nr=rr(a,ni.isHevc),ni.debugLog("worker",`demuxFlv() isVideoSequenceHeader is true and isHevc is ${ni.isHevc} and nalUnitSize is ${nr}`)}t&&ni.calcIframeIntervalTimestamp(n),ni.isPlayer&&ni.calcNetworkDelay(n),r[0]=a[4],r[1]=a[3],r[2]=a[2],r[3]=0;let s=r[0],o=ni.cryptoPayload(a,t);ni.decode(o,{type:ae,ts:n,isIFrame:t,cts:s})}}else ni.debugWarn("worker",`demuxFlv() type is video and payload.byteLength is ${a.byteLength} and return`);break;case le:postMessage({cmd:Z,buffer:a},[a.buffer]);break;default:ni.debugLog("worker",`demuxFlv() type is ${i}`)}}},decode:function(e,t){t.type===ne?ni._opt.hasAudio&&(postMessage({cmd:O,type:Be,value:e.byteLength}),ni.isPlayer?ni.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts}):ni.isPlayback&&(ni.isPlaybackOnlyDecodeIFrame()||(ni.isPlaybackCacheBeforeDecodeForFpsRender(),ni.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts})))):t.type===ae&&ni._opt.hasVideo&&(postMessage({cmd:O,type:Ue,value:e.byteLength}),postMessage({cmd:O,type:xe,value:t.ts}),ni.isPlayer?ni.pushBuffer(e,{type:t.type,ts:t.ts,isIFrame:t.isIFrame,cts:t.cts}):ni.isPlayback&&(ni.isPlaybackOnlyDecodeIFrame()?t.isIFrame&&ni.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}):(ni.isPlaybackCacheBeforeDecodeForFpsRender(),ni.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}))))},cryptoPayload:function(e,t){let r=e;return ni._opt.isM7sCrypto?ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength>0&&ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength>0?r=zi(e,ni._opt.cryptoKey,ni._opt.cryptoIV,ni.isHevc):ni.debugError("worker",`isM7sCrypto cryptoKey.length is ${ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength} or cryptoIV.length is ${ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength} null`):ni._opt.isSm4Crypto?ni._opt.sm4CryptoKey?r=ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength>0&&ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength>0?en(e,ni._opt.cryptoKey,ni._opt.cryptoIV,ni.isHevc,ni._opt.isSm4CryptoH265V2):as(e,ni._opt.sm4CryptoKey,ni.isHevc,ni._opt.isSm4CryptoH265V2):ni._opt.sm4CryptoKey||ni.debugError("worker","isSm4Crypto opt.sm4CryptoKey is null"):ni._opt.isXorCrypto&&(ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength>0&&ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength>0?r=us(e,ni._opt.cryptoKey,ni._opt.cryptoIV,ni.isHevc):ni.debugError("worker",`isXorCrypto cryptoKey.length is ${ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength} or cryptoIV.length is ${ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength} null`)),r},cryptoPayloadAudio:function(e){let t=e;return ni._opt.isM7sCrypto&&(ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength>0&&ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength>0?e[0]>>4===Ne&&(t=Ni(e,ni._opt.cryptoKey,ni._opt.cryptoIV)):ni.debugError("worker",`isM7sCrypto cryptoKey.length is ${ni._opt.cryptoKey&&ni._opt.cryptoKey.byteLength} or cryptoIV.length is ${ni._opt.cryptoIV&&ni._opt.cryptoIV.byteLength} null`)),t},setCodecAudio:function(e,t){const r=e[0]>>4,i=e[0]>>1&1;if(wr=r===Ne?i?16:8:0===i?8:16,ai&&ai.setCodec)if(qt(e)||r===Oe||r===Ge||r===$e){ni.debugLog("worker",`setCodecAudio: init audio codec, codeId is ${r} _opt.sampleRate is ${ni._opt.sampleRate}`);const i=r===Ne?e.slice(2):new Uint8Array(0);ai.setCodec(r,ni._opt.sampleRate,i),r===Ne&&postMessage({cmd:F,buffer:i},[i.buffer]),U=!0,r!==Ne&&(r===$e?(ni.mp3Demuxer||(ni.mp3Demuxer=new ds(ni),ni.mp3Demuxer.on("data",((e,t)=>{ai.decode(e,t)}))),ni.mp3Demuxer.dispatch(e.slice(1),t)):ai.decode(e.slice(1),t));{const e=Number("1")||1;setTimeout((()=>{ni.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),ni.close(),postMessage({cmd:H})}),60*e*60*1e3)}}else ni.debugWarn("worker","setCodecAudio: hasInitAudioCodec is false, codecId is ",r);else ni.debugError("worker","setCodecAudio: audioDecoder or audioDecoder.setCodec is null")},decodeAudio:function(e,t){if(ni.isDestroyed)ni.debugLog("worker","decodeAudio, decoder is destroyed and return");else if(ni.isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio())si.decodeAudio(e,t);else if(gr(r)&&gr(ni._opt.mseDecodeAudio))postMessage({cmd:N,payload:e,ts:t,cts:t},[e.buffer]);else{const r=e[0]>>4;if(U){if(qt(e))return void ni.debugLog("worker","decodeAudio and has already initialized and payload is aac codec packet so drop this frame");r===$e?ni.mp3Demuxer.dispatch(e.slice(1),t):ai.decode(r===Ne?e.slice(2):e.slice(1),t)}else ni.setCodecAudio(e,t)}},setCodecVideo:function(e,t){const r=15&e[0];if(oi&&oi.setCodec)if(_r(e))if(r===Fe||r===Pe){ni.debugLog("worker",`setCodecVideo: init video codec , codecId is ${r}`);const t=e.slice(5);if(r===Fe&&ni._opt.useSIMD){const e=Tr(t);if(e.codecWidth>A||e.codecHeight>A)return postMessage({cmd:q,value:`width: ${e.codecWidth} > 4080, height: ${e.codecHeight} > 4080`}),void ni.debugWarn("worker",`setCodecVideo: SIMD H264 decode video width is too large, width is ${e.codecWidth}, height is ${e.codecHeight}`)}const i=new Uint8Array(e);S=!0,oi.setCodec(r,t),postMessage({cmd:P,code:r}),postMessage({cmd:M,buffer:i,codecId:r},[i.buffer])}else ni.debugWarn("worker",`setCodecVideo: hasInitVideoCodec is false, codecId is ${r} is not H264 or H265`);else ni.debugWarn("worker",`decodeVideo: hasInitVideoCodec is false, codecId is ${r} and isIFrame is ${t} and packetType is ${e[1]}`);else ni.debugError("worker","setCodecVideo: videoDecoder or videoDecoder.setCodec is null")},decodeVideo:function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(ni.isDestroyed)ni.debugLog("worker","decodeVideo, decoder is destroyed and return");else if(ni.isPlayUseMSEAndDecoderInWorker())si.decodeVideo(e,t,i,s);else if(gr(r))postMessage({cmd:z,payload:e,isIFrame:i,ts:t,cts:s,delay:ni.delay},[e.buffer]);else if(S)if(!we&&i&&(we=!0),we){if(i&&_r(e)){const t=15&e[0];let r={};t===Fe?r=Tr(e.slice(5)):t===Pe&&(r=Vr(e)),r.codecWidth&&r.codecHeight&&h&&w&&(r.codecWidth!==h||r.codecHeight!==w)&&(ni.debugWarn("worker",`\n decodeVideo: video width or height is changed,\n old width is ${h}, old height is ${w},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),Kt=!0,postMessage({cmd:W,value:`width: ${h}->${r.codecWidth}, height: ${w}->${r.codecHeight}`}))}if(Kt)return void ni.debugWarn("worker","decodeVideo: video width or height is changed, and return");if(Qt)return void ni.debugWarn("worker","decodeVideo: simd decode error, and return");if(_r(e))return void ni.debugLog("worker","decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength0&&void 0!==arguments[0]&&arguments[0];ni.debugLog("worker",`clearBuffer,bufferList length is ${i.length}, need clear is ${e}`),e&&(i=[]),ni.isPlayer&&(ni.resetAllDelay(),gr(ni._opt.checkFirstIFrame)&&(ni.dropping=!0,postMessage({cmd:$}))),gr(ni._opt.checkFirstIFrame)&&yr(r)&&(we=!1)},dropBuffer$2:function(){if(i.length>0){let e=i.findIndex((e=>gr(e.isIFrame)&&e.type===ae));if(ni.isAllIframeInBufferList())for(let t=0;t=ni.getNotDroppingDelayTs()){ni.debugLog("worker",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${s} and notDroppingDelayTs is ${ni.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){ni.isPushDropping=!0,postMessage({cmd:$});const t=i.length;i=i.slice(e);const r=i.shift();ni.resetAllDelay(),ni.getDelay(r.ts,r.type),ni.doDecode(r),ni.isPushDropping=!1,ni.debugLog("worker",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,new bufferList is ${i.length} and new delay is ${ni.delay} `)}else ni.isPushDropping=!1}0===i.length&&(ni.isPushDropping=!1)},demuxM7s:function(e){const t=new DataView(e),r=t.getUint32(1,!1),i=t.getUint8(0),s=new ArrayBuffer(4),n=new Uint32Array(s);switch(i){case ne:ni.decode(new Uint8Array(e,5),{type:ne,ts:r});break;case ae:if(t.byteLength>=11){const i=new Uint8Array(e,5),s=i[0];if(ni._isEnhancedH265Header(s))ni._decodeEnhancedH265Video(i,r);else{const e=t.getUint8(5)>>4==1;if(e&&(ni.calcIframeIntervalTimestamp(r),_r(i)&&null===ni.isHevc)){const e=15&i[0];ni.isHevc=e===Pe}ni.isPlayer&&ni.calcNetworkDelay(r),n[0]=i[4],n[1]=i[3],n[2]=i[2],n[3]=0;let s=n[0],a=ni.cryptoPayload(i,e);ni.decode(a,{type:ae,ts:r,isIFrame:e,cts:s})}}else ni.debugWarn("worker",`demuxM7s() type is video and arrayBuffer length is ${e.byteLength} and return`)}},demuxNakedFlow:function(e){Gr.dispatch(e)},demuxFmp4:function(e){$r.dispatch(e)},demuxMpeg4:function(e){jr.dispatch(e)},demuxTs:function(e){ii.dispatch(e)},_decodeEnhancedH265Video:function(e,t){const r=e[0],i=48&r,s=15&r,n=e.slice(1,5),a=new ArrayBuffer(4),o=new Uint32Array(a),d="a"==String.fromCharCode(n[0]);if(ni.isHevc=yr(d),s===Pt){if(i===zt){const r=e.slice(5);if(d);else{const i=new Uint8Array(5+r.length);i.set([28,0,0,0,0],0),i.set(r,5),nr=rr(e,ni.isHevc),ni.debugLog("worker",`demuxFlv() isVideoSequenceHeader(enhancedH265) is true and isHevc is ${ni.isHevc} and nalUnitSize is ${nr}`),ni.decode(i,{type:ae,ts:t,isIFrame:!0,cts:0})}}}else if(s===Mt){let r=e,s=0;const n=i===zt;n&&ni.calcIframeIntervalTimestamp(t),d||(o[0]=e[4],o[1]=e[3],o[2]=e[2],o[3]=0,s=o[0],r=Kr(e.slice(8),n),r=ni.cryptoPayload(r,n),ni.decode(r,{type:ae,ts:t,isIFrame:n,cts:s}))}else if(s===Rt){const r=i===zt;r&&ni.calcIframeIntervalTimestamp(t);let s=Kr(e.slice(5),r);s=ni.cryptoPayload(s,r),ni.decode(s,{type:ae,ts:t,isIFrame:r,cts:0})}},_isEnhancedH265Header:function(e){return(e&Ft)===Ft},findSei:function(e,t){let r=4;dr(nr)&&(r=nr),er(e.slice(5),r).forEach((e=>{const r=ni.isHevc?e[0]>>>1&63:31&e[0],i=ni.isHevc&&(r===ht||r===ut),s=yr(ni.isHevc)&&r===Ye;(i||s)&&postMessage({cmd:X,buffer:e,ts:t},[e.buffer])}))},calcNetworkDelay:function(e){if(!(we&&e>0))return;null===et?(et=e,rt=ir()):et?r-t:0;ni.networkDelay=i,i>ni._opt.networkDelay&&ni._opt.playType===y&&(ni.debugWarn("worker",`calcNetworkDelay now dts:${e}, start dts is ${et} vs start is ${t},local diff is ${r} ,delay is ${i}`),postMessage({cmd:O,type:Ce,value:i}))},calcIframeIntervalTimestamp:function(e){null===Ot?Ot=e:Ot=ni._opt.playbackForwardMaxRateDecodeIFrame&&!(ni._opt.useMSE&&ni._opt.mseDecodeAudio)},isPlayUseMSE:function(){return ni.isPlayer&&ni._opt.useMSE&&gr(r)},isPlayUseMSEAndDecoderInWorker:function(){return ni.isPlayUseMSE()&&ni._opt.mseDecoderUseWorker},isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio:function(){return ni.isPlayUseMSEAndDecoderInWorker()&&ni._opt.mseDecodeAudio},playbackUpdatePlaybackRate:function(){yr(ni.isPlaybackCacheBeforeDecodeForFpsRender())&&ni.clearBuffer(!0)},onOffscreenCanvasWebglContextLost:function(e){ni.debugError("worker","handleOffscreenCanvasWebglContextLost and next try to create webgl"),e.preventDefault(),Vt=!0,ni.webglObj.destroy(),ni.webglObj=null,ni.offscreenCanvasGL=null,setTimeout((()=>{ni.offscreenCanvasGL=ni.offscreenCanvas.getContext("webgl"),ni.offscreenCanvasGL&&ni.offscreenCanvasGL.getContextAttributes().stencil?(ni.webglObj=f(ni.offscreenCanvasGL,ni._opt.openWebglAlignment),Vt=!1):ni.debugError("worker","handleOffscreenCanvasWebglContextLost, stencil is false")}),500)},onOffscreenCanvasWebglContextRestored:function(e){ni.debugLog("worker","handleOffscreenCanvasWebglContextRestored"),e.preventDefault()},videoInfo:function(e,t,r){postMessage({cmd:P,code:e}),postMessage({cmd:k,w:t,h:r}),h=t,w=r,ni.useOffscreen()&&(ni.offscreenCanvas=new OffscreenCanvas(t,r),ni.offscreenCanvasGL=ni.offscreenCanvas.getContext("webgl"),ni.webglObj=f(ni.offscreenCanvasGL,ni._opt.openWebglAlignment),ni.offscreenCanvas.addEventListener("webglcontextlost",ni.onOffscreenCanvasWebglContextLost,!1),ni.offscreenCanvas.addEventListener("webglcontextrestored",ni.onOffscreenCanvasWebglContextRestored,!1))},audioInfo:function(e,t,r){postMessage({cmd:L,code:e}),postMessage({cmd:D,sampleRate:t,channels:r,depth:wr}),Nt=r},yuvData:function(t,r){if(ni.isDestroyed)return void ni.debugLog("worker","yuvData, decoder is destroyed and return");const i=h*w*3/2;let s=e.HEAPU8.subarray(t,t+i),n=new Uint8Array(s);if(Et=null,We=r,ni.useOffscreen())try{if(Vt)return;ni.webglObj.renderYUV(h,w,n);let e=ni.offscreenCanvas.transferToImageBitmap();postMessage({cmd:T,buffer:e,delay:ni.delay,ts:r},[e])}catch(e){ni.debugError("worker","yuvData, transferToImageBitmap error is",e,e.toString())}else postMessage({cmd:T,output:n,delay:ni.delay,ts:r},[n.buffer])},pcmData:function(e,r,i){if(ni.isDestroyed)return void ni.debugLog("worker","pcmData, decoder is destroyed and return");let n=r,a=[],o=0,d=ni._opt.audioBufferSize;for(let r=0;r<2;r++){let i=t.HEAPU32[(e>>2)+r]>>2;a[r]=t.HEAPF32.subarray(i,i+n)}if(xt){if(!(n>=(r=d-xt)))return xt+=n,s[0]=Float32Array.of(...s[0],...a[0]),void(2==Nt&&(s[1]=Float32Array.of(...s[1],...a[1])));ct[0]=Float32Array.of(...s[0],...a[0].subarray(0,r)),2==Nt&&(ct[1]=Float32Array.of(...s[1],...a[1].subarray(0,r))),postMessage({cmd:C,buffer:ct,ts:i},ct.map((e=>e.buffer))),o=r,n-=r}for(xt=n;xt>=d;xt-=d)ct[0]=a[0].slice(o,o+=d),2==Nt&&(ct[1]=a[1].slice(o-d,o)),postMessage({cmd:C,buffer:ct,ts:i},ct.map((e=>e.buffer)));xt&&(s[0]=a[0].slice(o),2==Nt&&(s[1]=a[1].slice(o))),a=[]},errorInfo:function(e){null===Et&&(Et=ir());const t=ir(),r=sr(At>0?2*At:5e3,1e3,5e3),i=t-Et;i>r&&(ni.debugWarn("worker",`errorInfo() emit simdDecodeError and\n iframeIntervalTimestamp is ${At} and diff is ${i} and maxDiff is ${r}\n and replay`),Qt=!0,postMessage({cmd:j}))},sendWebsocketMessage:function(e){o?o.readyState===Ie?o.send(e):ni.debugError("worker","socket is not open"):ni.debugError("worker","socket is null")},timeEnd:function(){ni.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),ni.close(),postMessage({cmd:H})},postStreamToMain(e,t){postMessage({cmd:K,type:t,buffer:e},[e.buffer])},updatePlaybackIsPause(e){ni.debugLog("worker",`updatePlaybackIsPause, isPause is ${e}`),gr(e)?ni.clearPlaybackCacheLoop():ni.startPlaybackCacheLoop()},debugLog(e){if(ni._opt.debug&&ni.debug){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:{};var t,i,n;(n=e).ready=new Promise(((e,r)=>{t=e,i=r})),(n=void 0!==n?n:{}).locateFile=function(e){return"decoder-pro-mt-worker.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_MT_WORKER_WASM_URL&&""!=JESSIBUCA_PRO_MT_WORKER_WASM_URL?JESSIBUCA_PRO_MT_WORKER_WASM_URL:e};var s,o,a,d=Object.assign({},n),l="./this.program",c=(e,t)=>{throw t},u="object"==typeof window,h="function"==typeof importScripts,f="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,p=n.ENVIRONMENT_IS_PTHREAD||!1,m="";function _(e){return n.locateFile?n.locateFile(e,m):m+e}if(f){const{createRequire:e}=await import("module");var g=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-mt.js",document.baseURI).href),y=g("fs"),v=g("path");let t;m=h?v.dirname(m)+"/":g("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-mt.js",document.baseURI).href)),s=(e,t)=>(e=se(e)?new URL(e):v.normalize(e),y.readFileSync(e,t?void 0:"utf8")),a=e=>{var t=s(e,!0);return t.buffer||(t=new Uint8Array(t)),t},o=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=se(e)?new URL(e):v.normalize(e),y.readFile(e,i?void 0:"utf8",((e,n)=>{e?r(e):t(i?n.buffer:n)}))},!n.thisProgram&&process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),c=(e,t)=>{throw process.exitCode=e,t},n.inspect=()=>"[Emscripten Module object]";try{t=g("worker_threads")}catch(e){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),e}global.Worker=t.Worker}else(u||h)&&(h?m=self.location.href:"undefined"!=typeof document&&document.currentScript&&(m=document.currentScript.src),r&&(m=r),m=0!==m.indexOf("blob:")?m.substr(0,m.replace(/[?#].*/,"").lastIndexOf("/")+1):"",f||(s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},h&&(a=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),o=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)}));f&&"undefined"==typeof performance&&(global.performance=g("perf_hooks").performance);var b=console.log.bind(console),w=console.error.bind(console);f&&(b=function(){for(var e=arguments.length,t=new Array(e),r=0;re.startsWith(ie),se=e=>e.startsWith("file://");function oe(e){if(e==ee&&S)return new Uint8Array(S);if(a)return a(e);throw"both async and sync fetching of the wasm failed"}function ae(e){if(!S&&(u||h)){if("function"==typeof fetch&&!se(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>oe(e)));if(o)return new Promise(((t,r)=>{o(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>oe(e)))}function de(e,t,r){return ae(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{U(`failed to asynchronously prepare wasm: ${e}`),Q(e)}))}function le(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||ne(t)||se(t)||f||"function"!=typeof fetch?de(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return U(`wasm streaming compile failed: ${e}`),U("falling back to ArrayBuffer instantiation"),de(t,r,i)}))))}function ce(){var e={a:Yi};function t(e,t){return Ki=e.exports,st(Ki.W),et=Ki.Z,q(Ki.R),A=t,J(),Ki}if(Z(),n.instantiateWasm)try{return n.instantiateWasm(e,t)}catch(e){U(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return le(S,ee,e,(function(e){t(e.instance,e.module)})).catch(i),{}}function ue(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}n.locateFile?ne(ee="decoder-pro-mt-worker.wasm")||(ee=_(ee)):ee=new URL("decoder-pro-mt-worker.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-mt.js",document.baseURI).href).href;var he=e=>{e.terminate(),e.onmessage=e=>{}},fe=e=>{var t=Xe.pthreads[e];delete Xe.pthreads[e],he(t),sn(e),Xe.runningWorkers.splice(Xe.runningWorkers.indexOf(t),1),t.pthread_ptr=0},pe=e=>{Xe.pthreads[e].postMessage({cmd:"cancel"})},me=e=>{var t=Xe.pthreads[e];Xe.returnWorkerToPool(t)},_e=e=>{var t=Xe.getNewWorker();if(!t)return 6;Xe.runningWorkers.push(t),Xe.pthreads[e.pthread_ptr]=t,t.pthread_ptr=e.pthread_ptr;var r={cmd:"run",start_routine:e.startRoutine,arg:e.arg,pthread_ptr:e.pthread_ptr};return f&&t.unref(),t.postMessage(r,e.transferList),0},ge=0,ye=()=>nt||ge>0,ve={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=ve.isAbs(e),r="/"===e.substr(-1);return(e=ve.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=ve.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=ve.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return ve.normalize(e.join("/"))},join2:(e,t)=>ve.normalize(e+"/"+t)},be=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>(e.set(crypto.getRandomValues(new Uint8Array(e.byteLength))),e);if(f)try{var e=g("crypto");if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}Q("initRandomDevice")},we=e=>(we=be())(e),Se={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:$e.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=ve.isAbs(i)}return(t?"/":"")+(e=ve.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=Se.resolve(e).substr(1),t=Se.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),s=Math.min(i.length,n.length),o=s,a=0;a{for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&Ee)return Ee.decode(e.buffer instanceof SharedArrayBuffer?e.slice(t,n):e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&o)<<6|a)}else s+=String.fromCharCode(o)}return s},xe=[],Ue=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},Be=(e,t,r,i)=>{if(!(i>0))return 0;for(var n=r,s=r+i-1,o=0;o=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++o)),a<=127){if(r>=s)break;t[r++]=a}else if(a<=2047){if(r+1>=s)break;t[r++]=192|a>>6,t[r++]=128|63&a}else if(a<=65535){if(r+2>=s)break;t[r++]=224|a>>12,t[r++]=128|a>>6&63,t[r++]=128|63&a}else{if(r+3>=s)break;t[r++]=240|a>>18,t[r++]=128|a>>12&63,t[r++]=128|a>>6&63,t[r++]=128|63&a}}return t[r]=0,r-n};function ke(e,t,r){var i=r>0?r:Ue(e)+1,n=new Array(i),s=Be(e,n,0,n.length);return t&&(n.length=s),n}var Te=()=>{if(!xe.length){var e=null;if(f){var t=Buffer.alloc(256),r=0,i=process.stdin.fd;try{r=y.readSync(i,t)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}e=r>0?t.slice(0,r).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;xe=ke(e,!0)}return xe.shift()},Ce={ttys:[],init(){},shutdown(){},register(e,t){Ce.ttys[e]={input:[],output:[],ops:t},$e.registerDevice(e,Ce.stream_ops)},stream_ops:{open(e){var t=Ce.ttys[e.node.rdev];if(!t)throw new $e.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new $e.ErrnoError(60);for(var s=0,o=0;oTe(),put_char(e,t){null===t||10===t?(x(Ae(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(x(Ae(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(U(Ae(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(U(Ae(e.output,0)),e.output=[])}}},De=e=>{Q()},Pe={ops_table:null,mount:e=>Pe.createNode(null,"/",16895,0),createNode(e,t,r,i){if($e.isBlkdev(r)||$e.isFIFO(r))throw new $e.ErrnoError(63);Pe.ops_table||(Pe.ops_table={dir:{node:{getattr:Pe.node_ops.getattr,setattr:Pe.node_ops.setattr,lookup:Pe.node_ops.lookup,mknod:Pe.node_ops.mknod,rename:Pe.node_ops.rename,unlink:Pe.node_ops.unlink,rmdir:Pe.node_ops.rmdir,readdir:Pe.node_ops.readdir,symlink:Pe.node_ops.symlink},stream:{llseek:Pe.stream_ops.llseek}},file:{node:{getattr:Pe.node_ops.getattr,setattr:Pe.node_ops.setattr},stream:{llseek:Pe.stream_ops.llseek,read:Pe.stream_ops.read,write:Pe.stream_ops.write,allocate:Pe.stream_ops.allocate,mmap:Pe.stream_ops.mmap,msync:Pe.stream_ops.msync}},link:{node:{getattr:Pe.node_ops.getattr,setattr:Pe.node_ops.setattr,readlink:Pe.node_ops.readlink},stream:{}},chrdev:{node:{getattr:Pe.node_ops.getattr,setattr:Pe.node_ops.setattr},stream:$e.chrdev_stream_ops}});var n=$e.createNode(e,t,r,i);return $e.isDir(n.mode)?(n.node_ops=Pe.ops_table.dir.node,n.stream_ops=Pe.ops_table.dir.stream,n.contents={}):$e.isFile(n.mode)?(n.node_ops=Pe.ops_table.file.node,n.stream_ops=Pe.ops_table.file.stream,n.usedBytes=0,n.contents=null):$e.isLink(n.mode)?(n.node_ops=Pe.ops_table.link.node,n.stream_ops=Pe.ops_table.link.stream):$e.isChrdev(n.mode)&&(n.node_ops=Pe.ops_table.chrdev.node,n.stream_ops=Pe.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n,e.timestamp=n.timestamp),n},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=$e.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,$e.isDir(e.mode)?t.size=4096:$e.isFile(e.mode)?t.size=e.usedBytes:$e.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&Pe.resizeFileStorage(e,t.size)},lookup(e,t){throw $e.genericErrors[44]},mknod:(e,t,r,i)=>Pe.createNode(e,t,r,i),rename(e,t,r){if($e.isDir(e.mode)){var i;try{i=$e.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new $e.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=$e.lookupNode(e,t);for(var i in r.contents)throw new $e.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink(e,t,r){var i=Pe.createNode(e,t,41471,0);return i.link=r,i},readlink(e){if(!$e.isLink(e.mode))throw new $e.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,i,n){var s=e.node.contents;if(n>=e.node.usedBytes)return 0;var o=Math.min(e.node.usedBytes-n,i);if(o>8&&s.subarray)t.set(s.subarray(n,n+o),r);else for(var a=0;a0||r+t(Pe.stream_ops.write(e,t,0,i,r,!1),0)}},Fe=(e,t,r,i)=>{var n=i?"":`al ${e}`;o(e,(r=>{R(r,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(r)),n&&J()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),n&&Z()},Le=(e,t,r,i,n,s)=>{$e.createDataFile(e,t,r,i,n,s)},Ie=n.preloadPlugins||[],Me=(e,t,r,i)=>{"undefined"!=typeof Browser&&Browser.init();var n=!1;return Ie.forEach((s=>{n||s.canHandle(t)&&(s.handle(e,t,r,i),n=!0)})),n},Re=(e,t,r,i,n,s,o,a,d,l)=>{var c=t?Se.resolve(ve.join2(e,t)):e;function u(r){function u(r){l&&l(),a||Le(e,t,r,i,n,d),s&&s(),J()}Me(r,c,u,(()=>{o&&o(),J()}))||u(r)}Z(),"string"==typeof r?Fe(r,(e=>u(e)),o):u(r)},ze=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t},Ne=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},$e={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=Se.resolve(e)))return{path:"",node:null};if(t=Object.assign({follow_mount:!0,recurse_count:0},t),t.recurse_count>8)throw new $e.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),i=$e.root,n="/",s=0;s40)throw new $e.ErrnoError(32)}}return{path:n,node:i}},getPath(e){for(var t;;){if($e.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,i=0;i>>0)%$e.nameTable.length},hashAddNode(e){var t=$e.hashName(e.parent.id,e.name);e.name_next=$e.nameTable[t],$e.nameTable[t]=e},hashRemoveNode(e){var t=$e.hashName(e.parent.id,e.name);if($e.nameTable[t]===e)$e.nameTable[t]=e.name_next;else for(var r=$e.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=$e.mayLookup(e);if(r)throw new $e.ErrnoError(r,e);for(var i=$e.hashName(e.id,t),n=$e.nameTable[i];n;n=n.name_next){var s=n.name;if(n.parent.id===e.id&&s===t)return n}return $e.lookup(e,t)},createNode(e,t,r,i){var n=new $e.FSNode(e,t,r,i);return $e.hashAddNode(n),n},destroyNode(e){$e.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>$e.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){var t=$e.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{return $e.lookupNode(e,t),20}catch(e){}return $e.nodePermissions(e,"wx")},mayDelete(e,t,r){var i;try{i=$e.lookupNode(e,t)}catch(e){return e.errno}var n=$e.nodePermissions(e,"wx");if(n)return n;if(r){if(!$e.isDir(i.mode))return 54;if($e.isRoot(i)||$e.getPath(i)===$e.cwd())return 10}else if($e.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?$e.isLink(e.mode)?32:$e.isDir(e.mode)&&("r"!==$e.flagsToPermissionString(t)||512&t)?31:$e.nodePermissions(e,$e.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=$e.MAX_OPEN_FDS;e++)if(!$e.streams[e])return e;throw new $e.ErrnoError(33)},getStreamChecked(e){var t=$e.getStream(e);if(!t)throw new $e.ErrnoError(8);return t},getStream:e=>$e.streams[e],createStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return $e.FSStream||($e.FSStream=function(){this.shared={}},$e.FSStream.prototype={},Object.defineProperties($e.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},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(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new $e.FSStream,e),-1==t&&(t=$e.nextfd()),e.fd=t,$e.streams[t]=e,e},closeStream(e){$e.streams[e]=null},chrdev_stream_ops:{open(e){var t=$e.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek(){throw new $e.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){$e.devices[e]={stream_ops:t}},getDevice:e=>$e.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),$e.syncFSRequests++,$e.syncFSRequests>1&&U(`warning: ${$e.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=$e.getMounts($e.root.mount),i=0;function n(e){return $e.syncFSRequests--,t(e)}function s(e){if(e)return s.errored?void 0:(s.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return s(null);t.type.syncfs(t,e,s)}))},mount(e,t,r){var i,n="/"===r,s=!r;if(n&&$e.root)throw new $e.ErrnoError(10);if(!n&&!s){var o=$e.lookupPath(r,{follow_mount:!1});if(r=o.path,i=o.node,$e.isMountpoint(i))throw new $e.ErrnoError(10);if(!$e.isDir(i.mode))throw new $e.ErrnoError(54)}var a={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(a);return d.mount=a,a.root=d,n?$e.root=d:i&&(i.mounted=a,i.mount&&i.mount.mounts.push(a)),d},unmount(e){var t=$e.lookupPath(e,{follow_mount:!1});if(!$e.isMountpoint(t.node))throw new $e.ErrnoError(28);var r=t.node,i=r.mounted,n=$e.getMounts(i);Object.keys($e.nameTable).forEach((e=>{for(var t=$e.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&$e.destroyNode(t),t=r}})),r.mounted=null;var s=r.mount.mounts.indexOf(i);r.mount.mounts.splice(s,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var i=$e.lookupPath(e,{parent:!0}).node,n=ve.basename(e);if(!n||"."===n||".."===n)throw new $e.ErrnoError(28);var s=$e.mayCreate(i,n);if(s)throw new $e.ErrnoError(s);if(!i.node_ops.mknod)throw new $e.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,$e.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,$e.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),i="",n=0;n(void 0===r&&(r=t,t=438),t|=8192,$e.mknod(e,t,r)),symlink(e,t){if(!Se.resolve(e))throw new $e.ErrnoError(44);var r=$e.lookupPath(t,{parent:!0}).node;if(!r)throw new $e.ErrnoError(44);var i=ve.basename(t),n=$e.mayCreate(r,i);if(n)throw new $e.ErrnoError(n);if(!r.node_ops.symlink)throw new $e.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename(e,t){var r,i,n=ve.dirname(e),s=ve.dirname(t),o=ve.basename(e),a=ve.basename(t);if(r=$e.lookupPath(e,{parent:!0}).node,i=$e.lookupPath(t,{parent:!0}).node,!r||!i)throw new $e.ErrnoError(44);if(r.mount!==i.mount)throw new $e.ErrnoError(75);var d,l=$e.lookupNode(r,o),c=Se.relative(e,s);if("."!==c.charAt(0))throw new $e.ErrnoError(28);if("."!==(c=Se.relative(t,n)).charAt(0))throw new $e.ErrnoError(55);try{d=$e.lookupNode(i,a)}catch(e){}if(l!==d){var u=$e.isDir(l.mode),h=$e.mayDelete(r,o,u);if(h)throw new $e.ErrnoError(h);if(h=d?$e.mayDelete(i,a,u):$e.mayCreate(i,a))throw new $e.ErrnoError(h);if(!r.node_ops.rename)throw new $e.ErrnoError(63);if($e.isMountpoint(l)||d&&$e.isMountpoint(d))throw new $e.ErrnoError(10);if(i!==r&&(h=$e.nodePermissions(r,"w")))throw new $e.ErrnoError(h);$e.hashRemoveNode(l);try{r.node_ops.rename(l,i,a)}catch(e){throw e}finally{$e.hashAddNode(l)}}},rmdir(e){var t=$e.lookupPath(e,{parent:!0}).node,r=ve.basename(e),i=$e.lookupNode(t,r),n=$e.mayDelete(t,r,!0);if(n)throw new $e.ErrnoError(n);if(!t.node_ops.rmdir)throw new $e.ErrnoError(63);if($e.isMountpoint(i))throw new $e.ErrnoError(10);t.node_ops.rmdir(t,r),$e.destroyNode(i)},readdir(e){var t=$e.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new $e.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=$e.lookupPath(e,{parent:!0}).node;if(!t)throw new $e.ErrnoError(44);var r=ve.basename(e),i=$e.lookupNode(t,r),n=$e.mayDelete(t,r,!1);if(n)throw new $e.ErrnoError(n);if(!t.node_ops.unlink)throw new $e.ErrnoError(63);if($e.isMountpoint(i))throw new $e.ErrnoError(10);t.node_ops.unlink(t,r),$e.destroyNode(i)},readlink(e){var t=$e.lookupPath(e).node;if(!t)throw new $e.ErrnoError(44);if(!t.node_ops.readlink)throw new $e.ErrnoError(28);return Se.resolve($e.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=$e.lookupPath(e,{follow:!t}).node;if(!r)throw new $e.ErrnoError(44);if(!r.node_ops.getattr)throw new $e.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>$e.stat(e,!0),chmod(e,t,r){var i;if(!(i="string"==typeof e?$e.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new $e.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod(e,t){$e.chmod(e,t,!0)},fchmod(e,t){var r=$e.getStreamChecked(e);$e.chmod(r.node,t)},chown(e,t,r,i){var n;if(!(n="string"==typeof e?$e.lookupPath(e,{follow:!i}).node:e).node_ops.setattr)throw new $e.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown(e,t,r){$e.chown(e,t,r,!0)},fchown(e,t,r){var i=$e.getStreamChecked(e);$e.chown(i.node,t,r)},truncate(e,t){if(t<0)throw new $e.ErrnoError(28);var r;if(!(r="string"==typeof e?$e.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new $e.ErrnoError(63);if($e.isDir(r.mode))throw new $e.ErrnoError(31);if(!$e.isFile(r.mode))throw new $e.ErrnoError(28);var i=$e.nodePermissions(r,"w");if(i)throw new $e.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=$e.getStreamChecked(e);if(0==(2097155&r.flags))throw new $e.ErrnoError(28);$e.truncate(r.node,t)},utime(e,t,r){var i=$e.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new $e.ErrnoError(44);var i;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?ze(t):t)?4095&r|32768:0,"object"==typeof e)i=e;else{e=ve.normalize(e);try{i=$e.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var s=!1;if(64&t)if(i){if(128&t)throw new $e.ErrnoError(20)}else i=$e.mknod(e,r,0),s=!0;if(!i)throw new $e.ErrnoError(44);if($e.isChrdev(i.mode)&&(t&=-513),65536&t&&!$e.isDir(i.mode))throw new $e.ErrnoError(54);if(!s){var o=$e.mayOpen(i,t);if(o)throw new $e.ErrnoError(o)}512&t&&!s&&$e.truncate(i,0),t&=-131713;var a=$e.createStream({node:i,path:$e.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return a.stream_ops.open&&a.stream_ops.open(a),!n.logReadFiles||1&t||($e.readFiles||($e.readFiles={}),e in $e.readFiles||($e.readFiles[e]=1)),a},close(e){if($e.isClosed(e))throw new $e.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{$e.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if($e.isClosed(e))throw new $e.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new $e.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new $e.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,i,n){if(i<0||n<0)throw new $e.ErrnoError(28);if($e.isClosed(e))throw new $e.ErrnoError(8);if(1==(2097155&e.flags))throw new $e.ErrnoError(8);if($e.isDir(e.node.mode))throw new $e.ErrnoError(31);if(!e.stream_ops.read)throw new $e.ErrnoError(28);var s=void 0!==n;if(s){if(!e.seekable)throw new $e.ErrnoError(70)}else n=e.position;var o=e.stream_ops.read(e,t,r,i,n);return s||(e.position+=o),o},write(e,t,r,i,n,s){if(i<0||n<0)throw new $e.ErrnoError(28);if($e.isClosed(e))throw new $e.ErrnoError(8);if(0==(2097155&e.flags))throw new $e.ErrnoError(8);if($e.isDir(e.node.mode))throw new $e.ErrnoError(31);if(!e.stream_ops.write)throw new $e.ErrnoError(28);e.seekable&&1024&e.flags&&$e.llseek(e,0,2);var o=void 0!==n;if(o){if(!e.seekable)throw new $e.ErrnoError(70)}else n=e.position;var a=e.stream_ops.write(e,t,r,i,n,s);return o||(e.position+=a),a},allocate(e,t,r){if($e.isClosed(e))throw new $e.ErrnoError(8);if(t<0||r<=0)throw new $e.ErrnoError(28);if(0==(2097155&e.flags))throw new $e.ErrnoError(8);if(!$e.isFile(e.node.mode)&&!$e.isDir(e.node.mode))throw new $e.ErrnoError(43);if(!e.stream_ops.allocate)throw new $e.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,i,n){if(0!=(2&i)&&0==(2&n)&&2!=(2097155&e.flags))throw new $e.ErrnoError(2);if(1==(2097155&e.flags))throw new $e.ErrnoError(2);if(!e.stream_ops.mmap)throw new $e.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n)},msync:(e,t,r,i,n)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new $e.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,i=$e.open(e,t.flags),n=$e.stat(e).size,s=new Uint8Array(n);return $e.read(i,s,0,n,0),"utf8"===t.encoding?r=Ae(s,0):"binary"===t.encoding&&(r=s),$e.close(i),r},writeFile(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=$e.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(Ue(t)+1),s=Be(t,n,0,n.length);$e.write(i,n,0,s,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");$e.write(i,t,0,t.byteLength,void 0,r.canOwn)}$e.close(i)},cwd:()=>$e.currentPath,chdir(e){var t=$e.lookupPath(e,{follow:!0});if(null===t.node)throw new $e.ErrnoError(44);if(!$e.isDir(t.node.mode))throw new $e.ErrnoError(54);var r=$e.nodePermissions(t.node,"x");if(r)throw new $e.ErrnoError(r);$e.currentPath=t.path},createDefaultDirectories(){$e.mkdir("/tmp"),$e.mkdir("/home"),$e.mkdir("/home/web_user")},createDefaultDevices(){$e.mkdir("/dev"),$e.registerDevice($e.makedev(1,3),{read:()=>0,write:(e,t,r,i,n)=>i}),$e.mkdev("/dev/null",$e.makedev(1,3)),Ce.register($e.makedev(5,0),Ce.default_tty_ops),Ce.register($e.makedev(6,0),Ce.default_tty1_ops),$e.mkdev("/dev/tty",$e.makedev(5,0)),$e.mkdev("/dev/tty1",$e.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=we(e).byteLength),e[--t]);$e.createDevice("/dev","random",r),$e.createDevice("/dev","urandom",r),$e.mkdir("/dev/shm"),$e.mkdir("/dev/shm/tmp")},createSpecialDirectories(){$e.mkdir("/proc");var e=$e.mkdir("/proc/self");$e.mkdir("/proc/self/fd"),$e.mount({mount(){var t=$e.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,i=$e.getStreamChecked(r),n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return n.parent=n,n}},t}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?$e.createDevice("/dev","stdin",n.stdin):$e.symlink("/dev/tty","/dev/stdin"),n.stdout?$e.createDevice("/dev","stdout",null,n.stdout):$e.symlink("/dev/tty","/dev/stdout"),n.stderr?$e.createDevice("/dev","stderr",null,n.stderr):$e.symlink("/dev/tty1","/dev/stderr"),$e.open("/dev/stdin",0),$e.open("/dev/stdout",1),$e.open("/dev/stderr",1)},ensureErrnoError(){$e.ErrnoError||($e.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},$e.ErrnoError.prototype=new Error,$e.ErrnoError.prototype.constructor=$e.ErrnoError,[44].forEach((e=>{$e.genericErrors[e]=new $e.ErrnoError(e),$e.genericErrors[e].stack=""})))},staticInit(){$e.ensureErrnoError(),$e.nameTable=new Array(4096),$e.mount(Pe,{},"/"),$e.createDefaultDirectories(),$e.createDefaultDevices(),$e.createSpecialDirectories(),$e.filesystems={MEMFS:Pe}},init(e,t,r){$e.init.initialized=!0,$e.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=t||n.stdout,n.stderr=r||n.stderr,$e.createStandardStreams()},quit(){$e.init.initialized=!1;for(var e=0;e<$e.streams.length;e++){var t=$e.streams[e];t&&$e.close(t)}},findObject(e,t){var r=$e.analyzePath(e,t);return r.exists?r.object:null},analyzePath(e,t){try{e=(i=$e.lookupPath(e,{follow:!t})).path}catch(e){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var i=$e.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=i.path,r.parentObject=i.node,r.name=ve.basename(e),i=$e.lookupPath(e,{follow:!t}),r.exists=!0,r.path=i.path,r.object=i.node,r.name=i.node.name,r.isRoot="/"===i.path}catch(e){r.error=e.errno}return r},createPath(e,t,r,i){e="string"==typeof e?e:$e.getPath(e);for(var n=t.split("/").reverse();n.length;){var s=n.pop();if(s){var o=ve.join2(e,s);try{$e.mkdir(o)}catch(e){}e=o}}return o},createFile(e,t,r,i,n){var s=ve.join2("string"==typeof e?e:$e.getPath(e),t),o=Ne(i,n);return $e.create(s,o)},createDataFile(e,t,r,i,n,s){var o=t;e&&(e="string"==typeof e?e:$e.getPath(e),o=t?ve.join2(e,t):e);var a=Ne(i,n),d=$e.create(o,a);if(r){if("string"==typeof r){for(var l=new Array(r.length),c=0,u=r.length;cthis.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},s.prototype.setDataGetter=function(e){this.getter=e},s.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,s=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,o=1048576;n||(o=i);var a=this;a.setDataGetter((e=>{var t=e*o,n=(e+1)*o-1;if(n=Math.min(n,i-1),void 0===a.chunks[e]&&(a.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==o&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):ke(n.responseText||"",!0)})(t,n)),void 0===a.chunks[e])throw new Error("doXHR failed!");return a.chunks[e]})),!s&&i||(o=i=1,i=this.getter(0).length,o=i,x("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=o,this.lengthKnown=!0},"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 o=new s;Object.defineProperties(o,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var a={isDevice:!1,contents:o}}else a={isDevice:!1,url:r};var d=$e.createFile(e,t,a,i,n);a.contents?d.contents=a.contents:a.url&&(d.contents=null,d.url=a.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,t,r,i,n){var s=e.node.contents;if(n>=s.length)return 0;var o=Math.min(s.length-n,i);if(s.slice)for(var a=0;a{var t=d.stream_ops[e];l[e]=function(){return $e.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,n)=>($e.forceLoadFile(d),c(e,t,r,i,n)),l.mmap=(e,t,r,i,n)=>{$e.forceLoadFile(d);var s=De();if(!s)throw new $e.ErrnoError(48);return c(e,k,s,t,r),{ptr:s,allocated:!0}},d.stream_ops=l,d}},Oe=(e,t)=>e?Ae(T,e,t):"",Ge={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(ve.isAbs(t))return t;var i;if(i=-100===e?$e.cwd():Ge.getStreamFromFD(e).path,0==t.length){if(!r)throw new $e.ErrnoError(44);return i}return ve.join2(i,t)},doStat(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&ve.normalize(t)!==ve.normalize($e.getPath(e.node)))return-54;throw e}P[r>>2]=i.dev,P[r+4>>2]=i.mode,F[r+8>>2]=i.nlink,P[r+12>>2]=i.uid,P[r+16>>2]=i.gid,P[r+20>>2]=i.rdev,re=[i.size>>>0,(te=i.size,+Math.abs(te)>=1?te>0?+Math.floor(te/4294967296)>>>0:~~+Math.ceil((te-+(~~te>>>0))/4294967296)>>>0:0)],P[r+24>>2]=re[0],P[r+28>>2]=re[1],P[r+32>>2]=4096,P[r+36>>2]=i.blocks;var n=i.atime.getTime(),s=i.mtime.getTime(),o=i.ctime.getTime();return re=[Math.floor(n/1e3)>>>0,(te=Math.floor(n/1e3),+Math.abs(te)>=1?te>0?+Math.floor(te/4294967296)>>>0:~~+Math.ceil((te-+(~~te>>>0))/4294967296)>>>0:0)],P[r+40>>2]=re[0],P[r+44>>2]=re[1],F[r+48>>2]=n%1e3*1e3,re=[Math.floor(s/1e3)>>>0,(te=Math.floor(s/1e3),+Math.abs(te)>=1?te>0?+Math.floor(te/4294967296)>>>0:~~+Math.ceil((te-+(~~te>>>0))/4294967296)>>>0:0)],P[r+56>>2]=re[0],P[r+60>>2]=re[1],F[r+64>>2]=s%1e3*1e3,re=[Math.floor(o/1e3)>>>0,(te=Math.floor(o/1e3),+Math.abs(te)>=1?te>0?+Math.floor(te/4294967296)>>>0:~~+Math.ceil((te-+(~~te>>>0))/4294967296)>>>0:0)],P[r+72>>2]=re[0],P[r+76>>2]=re[1],F[r+80>>2]=o%1e3*1e3,re=[i.ino>>>0,(te=i.ino,+Math.abs(te)>=1?te>0?+Math.floor(te/4294967296)>>>0:~~+Math.ceil((te-+(~~te>>>0))/4294967296)>>>0:0)],P[r+88>>2]=re[0],P[r+92>>2]=re[1],0},doMsync(e,t,r,i,n){if(!$e.isFile(t.node.mode))throw new $e.ErrnoError(43);if(2&i)return 0;var s=T.slice(e,e+r);$e.msync(t,s,n,r,i)},varargs:void 0,get(){var e=P[+Ge.varargs>>2];return Ge.varargs+=4,e},getp:()=>Ge.get(),getStr:e=>Oe(e),getStreamFromFD:e=>$e.getStreamChecked(e)},He=e=>{var t=ln(),r=e();return cn(t),r},We=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,Ve=function(e,t){var r=arguments.length-2,i=arguments;return He((()=>{for(var n=r,s=un(8*n),o=s>>3,a=0;a{if(B=e,p)throw Qe(e),"unwind";je(e)},Ye=qe,Ke=e=>{if(e instanceof ue||"unwind"==e)return B;c(1,e)},Xe={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init(){p?Xe.initWorker():Xe.initMainThread()},initMainThread(){j((()=>{Z(),Xe.loadWasmModuleToAllWorkers((()=>J()))}))},initWorker(){nt=!1},setExitStatus:e=>{B=e},terminateAllThreads__deps:["$terminateWorker"],terminateAllThreads:()=>{for(var e of Xe.runningWorkers)he(e);for(var e of Xe.unusedWorkers)he(e);Xe.unusedWorkers=[],Xe.runningWorkers=[],Xe.pthreads=[]},returnWorkerToPool:e=>{var t=e.pthread_ptr;delete Xe.pthreads[t],Xe.unusedWorkers.push(e),Xe.runningWorkers.splice(Xe.runningWorkers.indexOf(e),1),e.pthread_ptr=0,sn(t)},receiveObjectTransfer(e){},threadInitTLS(){Xe.tlsInitFunctions.forEach((e=>e()))},loadWasmModuleToWorker:e=>new Promise((t=>{e.onmessage=r=>{var i=r.data,s=i.cmd;if(i.targetThread&&i.targetThread!=Ji()){var o=Xe.pthreads[i.targetThread];o?o.postMessage(i,i.transferList):U(`Internal error! Worker sent a message "${s}" to target pthread ${i.targetThread}, but that thread no longer exists!`)}else"checkMailbox"===s?ai():"spawnThread"===s?_e(i):"cleanupThread"===s?me(i.thread):"killThread"===s?fe(i.thread):"cancelThread"===s?pe(i.thread):"loaded"===s?(e.loaded=!0,t(e)):"alert"===s?alert(`Thread ${i.threadId}: ${i.text}`):"setimmediate"===i.target?e.postMessage(i):"callHandler"===s?n[i.handler](...i.args):s&&U(`worker sent an unknown command ${s}`)},e.onerror=e=>{throw U(`worker sent an error! ${e.filename}:${e.lineno}: ${e.message}`),e},f&&(e.on("message",(t=>e.onmessage({data:t}))),e.on("error",(t=>e.onerror(t))));var r=[];for(var i of["onExit","onAbort","print","printErr"])n.hasOwnProperty(i)&&r.push(i);e.postMessage({cmd:"load",handlers:r,urlOrBlob:n.mainScriptUrlOrBlob,wasmMemory:E,wasmModule:A})})),loadWasmModuleToAllWorkers(e){e()},allocateUnusedWorker(){var e;if(n.locateFile){var t=_("decoder-pro-mt-worker.worker.js");e=new Worker(t,{type:"module"})}else e=new Worker(new URL("decoder-pro-mt-worker.worker.js","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-mt.js",document.baseURI).href),{type:"module"});Xe.unusedWorkers.push(e)},getNewWorker:()=>(0==Xe.unusedWorkers.length&&(Xe.allocateUnusedWorker(),Xe.loadWasmModuleToWorker(Xe.unusedWorkers[0])),Xe.unusedWorkers.pop())};n.PThread=Xe;var Ze=e=>{for(;e.length>0;)e.shift()(n)},Je=()=>{var e=Ji(),t=F[e+52>>2],r=F[e+56>>2];dn(t,t-r),cn(t)};function Qe(e){if(p)return Ve(1,0,e);Ye(e)}n.establishStackSpace=Je;var et,tt=[],rt=e=>{var t=tt[e];return t||(e>=tt.length&&(tt.length=e+1),tt[e]=t=et.get(e)),t},it=(e,t)=>{!function(e){ye()?Xe.setExitStatus(e):on(e)}(rt(e)(t))};n.invokeEntryPoint=it;var nt=n.noExitRuntime||!0,st=e=>{Xe.tlsInitFunctions.push(e)},ot=(e,t,r,i)=>{Q(`Assertion failed: ${Oe(e)}, at: `+[t?Oe(t):"unknown filename",r,i?Oe(i):"unknown function"])};function at(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){F[this.ptr+4>>2]=e},this.get_type=function(){return F[this.ptr+4>>2]},this.set_destructor=function(e){F[this.ptr+8>>2]=e},this.get_destructor=function(){return F[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,k[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=k[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,k[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=k[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){F[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return F[this.ptr+16>>2]},this.get_exception_ptr=function(){if(hn(this.get_type()))return F[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}var dt=(e,t,r)=>{throw new at(e).init(t,r),e},lt=e=>{tn(e,!h,1,!u,65536,!1),Xe.threadInitTLS()},ct=e=>{p?postMessage({cmd:"cleanupThread",thread:e}):me(e)};function ut(e,t,r,i){return p?Ve(2,1,e,t,r,i):ht(e,t,r,i)}var ht=(e,t,r,i)=>{if("undefined"==typeof SharedArrayBuffer)return U("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var n=[];if(p&&0===n.length)return ut(e,t,r,i);var s={startRoutine:r,pthread_ptr:e,arg:i,transferList:n};return p?(s.cmd="spawnThread",postMessage(s,n),0):_e(s)},ft=e=>(P[Qi()>>2]=e,e);function pt(e,t,r){if(p)return Ve(3,1,e,t,r);Ge.varargs=r;try{var i=Ge.getStreamFromFD(e);switch(t){case 0:if((n=Ge.get())<0)return-28;for(;$e.streams[n];)n++;return $e.createStream(i,n).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var n=Ge.get();return i.flags|=n,0;case 5:return n=Ge.getp(),C[n+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return ft(28),-1}}catch(e){if(void 0===$e||"ErrnoError"!==e.name)throw e;return-e.errno}}function mt(e,t,r,i){if(p)return Ve(4,1,e,t,r,i);Ge.varargs=i;try{t=Ge.getStr(t),t=Ge.calculateAt(e,t);var n=i?Ge.get():0;return $e.open(t,r,n).fd}catch(e){if(void 0===$e||"ErrnoError"!==e.name)throw e;return-e.errno}}var _t,gt,yt,vt=(e,t,r,i,n)=>{},bt=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);_t=e},wt=e=>{for(var t="",r=e;T[r];)t+=_t[T[r++]];return t},St={},Et={},At={},xt=e=>{throw new gt(e)},Ut=e=>{throw new yt(e)},Bt=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&Ut("Mismatched type converter count");for(var n=0;n{Et.hasOwnProperty(e)?n[t]=Et[e]:(s.push(e),St.hasOwnProperty(e)||(St[e]=[]),St[e].push((()=>{n[t]=Et[e],++o===s.length&&i(n)})))})),0===s.length&&i(n)};function kt(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||xt(`type "${i}" must have a positive integer typeid pointer`),Et.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;xt(`Cannot register type '${i}' twice`)}if(Et[e]=t,delete At[e],St.hasOwnProperty(e)){var n=St[e];delete St[e],n.forEach((e=>e()))}}function Tt(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return kt(e,t,r)}var Ct,Dt=8,Pt=(e,t,r,i)=>{Tt(e,{name:t=wt(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:Dt,readValueFromPointer:function(e){return this.fromWireType(T[e])},destructorFunction:null})},Ft=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Lt=e=>{xt(e.$$.ptrType.registeredClass.name+" instance already deleted")},It=!1,Mt=e=>{},Rt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},zt=e=>{e.count.value-=1,0===e.count.value&&Rt(e)},Nt=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=Nt(e,t,r.baseClass);return null===i?null:r.downcast(i)},$t={},Ot=()=>Object.keys(qt).length,Gt=()=>{var e=[];for(var t in qt)qt.hasOwnProperty(t)&&e.push(qt[t]);return e},Ht=[],Wt=()=>{for(;Ht.length;){var e=Ht.pop();e.$$.deleteScheduled=!1,e.delete()}},Vt=e=>{Ct=e,Ht.length&&Ct&&Ct(Wt)},jt=()=>{n.getInheritedInstanceCount=Ot,n.getLiveInheritedInstances=Gt,n.flushPendingDeletes=Wt,n.setDelayFunction=Vt},qt={},Yt=(e,t)=>{for(void 0===t&&xt("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},Kt=(e,t)=>(t=Yt(e,t),qt[t]),Xt=(e,t)=>(t.ptrType&&t.ptr||Ut("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&Ut("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Jt(Object.create(e,{$$:{value:t}})));function Zt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=Kt(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?Xt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Xt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,o=this.registeredClass.getActualType(t),a=$t[o];if(!a)return n.call(this);s=this.isConst?a.constPointerType:a.pointerType;var d=Nt(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?Xt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):Xt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}var Jt=e=>"undefined"==typeof FinalizationRegistry?(Jt=e=>e,e):(It=new FinalizationRegistry((e=>{zt(e.$$)})),Jt=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};It.register(e,r,e)}return e},Mt=e=>It.unregister(e),Jt(e)),Qt=()=>{Object.assign(er.prototype,{isAliasOf(e){if(!(this instanceof er))return!1;if(!(e instanceof er))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n},clone(){if(this.$$.ptr||Lt(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Jt(Object.create(Object.getPrototypeOf(this),{$$:{value:Ft(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Lt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&xt("Object already scheduled for deletion"),Mt(this),zt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Lt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&xt("Object already scheduled for deletion"),Ht.push(this),1===Ht.length&&Ct&&Ct(Wt),this.$$.deleteScheduled=!0,this}})};function er(){}var tr=(e,t)=>Object.defineProperty(t,"name",{value:e}),rr=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||xt(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},ir=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&xt(`Cannot register public name '${e}' twice`),rr(n,e,e),n.hasOwnProperty(r)&&xt(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,void 0!==r&&(n[e].numArguments=r))},nr=48,sr=57,or=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=nr&&t<=sr?`_${e}`:e};function ar(e,t,r,i,n,s,o,a){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=o,this.downcast=a,this.pureVirtualFunctions=[]}var dr=(e,t,r)=>{for(;t!==r;)t.upcast||xt(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function lr(e,t){if(null===t)return this.isReference&&xt(`null is not a valid ${this.name}`),0;t.$$||xt(`Cannot pass "${Or(t)}" as a ${this.name}`),t.$$.ptr||xt(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return dr(t.$$.ptr,r,this.registeredClass)}function cr(e,t){var r;if(null===t)return this.isReference&&xt(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||xt(`Cannot pass "${Or(t)}" as a ${this.name}`),t.$$.ptr||xt(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&xt(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=dr(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&xt("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:xt(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,zr.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:xt("Unsupporting sharing policy")}return r}function ur(e,t){if(null===t)return this.isReference&&xt(`null is not a valid ${this.name}`),0;t.$$||xt(`Cannot pass "${Or(t)}" as a ${this.name}`),t.$$.ptr||xt(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&xt(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return dr(t.$$.ptr,r,this.registeredClass)}function hr(e){return this.fromWireType(F[e>>2])}var fr=()=>{Object.assign(pr.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:Dt,readValueFromPointer:hr,deleteObject(e){null!==e&&e.delete()},fromWireType:Zt})};function pr(e,t,r,i,n,s,o,a,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=o,this.rawGetPointee=a,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=cr:i?(this.toWireType=lr,this.destructorFunction=null):(this.toWireType=ur,this.destructorFunction=null)}var mr,_r=(e,t,r)=>{n.hasOwnProperty(e)||Ut("Replacing nonexistant public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},gr=(e,t,r)=>{var i=n["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},yr=(e,t,r)=>e.includes("j")?gr(e,t,r):rt(t).apply(null,r),vr=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),yr(e,t,r)}},br=(e,t)=>{var r=(e=wt(e)).includes("j")?vr(e,t):rt(t);return"function"!=typeof r&&xt(`unknown function pointer with signature ${e}: ${t}`),r},wr=(e,t)=>{var r=tr(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},Sr=e=>{var t=en(e),r=wt(t);return Xi(t),r},Er=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Et[t]||(At[t]?At[t].forEach(e):(r.push(t),i[t]=!0))})),new mr(`${e}: `+r.map(Sr).join([", "]))},Ar=(e,t,r,i,n,s,o,a,d,l,c,u,h)=>{c=wt(c),s=br(n,s),a&&(a=br(o,a)),l&&(l=br(d,l)),h=br(u,h);var f=or(c);ir(f,(function(){Er(`Cannot construct ${c} due to unbound types`,[i])})),Bt([e,t,r],i?[i]:[],(function(t){var r,n;t=t[0],n=i?(r=t.registeredClass).instancePrototype:er.prototype;var o=tr(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new gt("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new gt(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new gt(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(n,{constructor:{value:o}});o.prototype=d;var u=new ar(c,o,d,h,r,s,a,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new pr(c,u,!0,!1,!1),m=new pr(c+"*",u,!1,!1,!1),_=new pr(c+" const*",u,!1,!0,!1);return $t[e]={pointerType:m,constPointerType:_},_r(f,o),[p,m,_]}))},xr=(e,t)=>{for(var r=[],i=0;i>2]);return r},Ur=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Br(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=tr(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function kr(e,t,r,i,n,s){var o=t.length;o<2&&xt("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||s?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=a?1:2;l{var o=xr(t,r);n=br(i,n),Bt([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new gt(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Er(`Cannot construct ${e.name} due to unbound types`,o)},Bt([],o,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=kr(r,i,null,n,s),[]))),[]}))},Cr=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Dr=(e,t,r,i,n,s,o,a,d)=>{var l=xr(r,i);t=wt(t),t=Cr(t),s=br(n,s),Bt([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function n(){Er(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),a&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,c[t]=n):(rr(c,t,i),c[t].overloadTable[r-2]=n),Bt([],l,(function(n){var a=kr(i,n,e,s,o,d);return void 0===c[t].overloadTable?(a.argCount=r-2,c[t]=a):c[t].overloadTable[r-2]=a,[]})),[]}))};function Pr(){Object.assign(Fr.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function Fr(){this.allocated=[void 0],this.freelist=[]}var Lr=new Fr,Ir=e=>{e>=Lr.reserved&&0==--Lr.get(e).refcount&&Lr.free(e)},Mr=()=>{for(var e=0,t=Lr.reserved;t{Lr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),Lr.reserved=Lr.allocated.length,n.count_emval_handles=Mr},zr={toValue:e=>(e||xt("Cannot use deleted val. handle = "+e),Lr.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return Lr.allocate({refcount:1,value:e})}}};function Nr(e){return this.fromWireType(P[e>>2])}var $r=(e,t)=>{Tt(e,{name:t=wt(t),fromWireType:e=>{var t=zr.toValue(e);return Ir(e),t},toWireType:(e,t)=>zr.toHandle(t),argPackAdvance:Dt,readValueFromPointer:Nr,destructorFunction:null})},Or=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},Gr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(L[e>>2])};case 8:return function(e){return this.fromWireType(I[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Hr=(e,t,r)=>{Tt(e,{name:t=wt(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Dt,readValueFromPointer:Gr(t,r),destructorFunction:null})},Wr=(e,t,r)=>{switch(t){case 1:return r?e=>k[e>>0]:e=>T[e>>0];case 2:return r?e=>C[e>>1]:e=>D[e>>1];case 4:return r?e=>P[e>>2]:e=>F[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Vr=(e,t,r,i,n)=>{t=wt(t);var s=e=>e;if(0===i){var o=32-8*r;s=e=>e<>>o}var a=t.includes("unsigned");Tt(e,{name:t,fromWireType:s,toWireType:a?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:Dt,readValueFromPointer:Wr(t,r,0!==i),destructorFunction:null})},jr=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=F[e>>2],r=F[e+4>>2];return new i(k.buffer,r,t)}Tt(e,{name:r=wt(r),fromWireType:n,argPackAdvance:Dt,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},qr=(e,t,r)=>Be(e,T,t,r),Yr=(e,t)=>{var r="std::string"===(t=wt(t));Tt(e,{name:t,fromWireType(e){var t,i=F[e>>2],n=e+4;if(r)for(var s=n,o=0;o<=i;++o){var a=n+o;if(o==i||0==T[a]){var d=Oe(s,a-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=a+1}}else{var l=new Array(i);for(o=0;o>2]=i,r&&n)qr(t,o,i+1);else if(n)for(var a=0;a255&&(Xi(o),xt("String has UTF-16 code units that do not fit in 8 bits")),T[o+a]=d}else for(a=0;a{for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&D[i];)++i;if((r=i<<1)-e>32&&Kr)return Kr.decode(T.slice(e,r));for(var s="",o=0;!(o>=t/2);++o){var a=C[e+2*o>>1];if(0==a)break;s+=String.fromCharCode(a)}return s},Zr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=o,t+=2}return C[t>>1]=0,t-i},Jr=e=>2*e.length,Qr=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var n=P[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i},ei=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++s)),P[t>>2]=o,(t+=4)+4>n)break}return P[t>>2]=0,t-i},ti=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},ri=(e,t,r)=>{var i,n,s,o,a;r=wt(r),2===t?(i=Xr,n=Zr,o=Jr,s=()=>D,a=1):4===t&&(i=Qr,n=ei,o=ti,s=()=>F,a=2),Tt(e,{name:r,fromWireType:e=>{for(var r,n=F[e>>2],o=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==o[c>>a]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return Xi(e),r},toWireType:(e,i)=>{"string"!=typeof i&&xt(`Cannot pass non-string to C++ string type ${r}`);var s=o(i),d=Zi(4+s+t);return F[d>>2]=s>>a,n(i,d+4,s+t),null!==e&&e.push(Xi,d),d},argPackAdvance:Dt,readValueFromPointer:Nr,destructorFunction(e){Xi(e)}})},ii=(e,t)=>{Tt(e,{isVoid:!0,name:t=wt(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},ni=()=>{if(!ye())try{p?on(B):Ye(B)}catch(e){Ke(e)}},si=e=>{if(!M)try{e(),ni()}catch(e){Ke(e)}},oi=e=>{if("function"==typeof Atomics.waitAsync){Atomics.waitAsync(P,e>>2,e).value.then(ai);var t=e+128;Atomics.store(P,t>>2,1)}};n.__emscripten_thread_mailbox_await=oi;var ai=()=>{var e=Ji();e&&(oi(e),si(an))};n.checkMailbox=ai;var di,li=(e,t,r)=>{if(e==t)setTimeout((()=>ai()));else if(p)postMessage({targetThread:e,cmd:"checkMailbox"});else{var i=Xe.pthreads[e];if(!i)return;i.postMessage({cmd:"checkMailbox"})}},ci=[],ui=(e,t,r,i)=>{ci.length=r;for(var n=i>>3,s=0;s{f&&Xe.pthreads[e].ref()},fi={},pi=e=>{var t=fi[e];return void 0===t?wt(e):t},mi=[],_i=(e,t,r,i,n)=>(e=mi[e])(t=zr.toValue(t),t[r=pi(r)],i,n),gi=e=>{var t=mi.length;return mi.push(e),t},yi=(e,t)=>{var r=Et[e];return void 0===r&&xt(t+" has unknown type "+Sr(e)),r},vi=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},bi=(e,t,r)=>{var i=[],n=e.toWireType(i,r);return i.length&&(F[t>>2]=zr.toHandle(i)),n},wi=(e,t,r)=>{var i=vi(e,t),n=i.shift();e--;var s="return function (obj, func, destructorsRef, args) {\n",o=0,a=[];0===r&&a.push("obj");for(var d=["retType"],l=[n],c=0;ce.name)).join(", ")}) => ${n.name}>`;return gi(tr(h,u))},Si=e=>{var t=zr.toValue(e);Ur(t),Ir(e)},Ei=()=>{Q("")},Ai=()=>{},xi=()=>Date.now(),Ui=()=>{ge+=1},Bi=()=>{throw Ui(),"unwind"};di=()=>performance.timeOrigin+performance.now();var ki=()=>f?g("os").cpus().length:navigator.hardwareConcurrency,Ti=e=>{Q("OOM")},Ci=e=>{T.length,Ti()},Di={},Pi=()=>l||"./this.program",Fi=()=>{if(!Fi.strings){var e={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",_:Pi()};for(var t in Di)void 0===Di[t]?delete e[t]:e[t]=Di[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Fi.strings=r}return Fi.strings},Li=(e,t)=>{for(var r=0;r>0]=e.charCodeAt(r);k[t>>0]=0},Ii=function(e,t){if(p)return Ve(5,1,e,t);var r=0;return Fi().forEach(((i,n)=>{var s=t+r;F[e+4*n>>2]=s,Li(i,s),r+=i.length+1})),0},Mi=function(e,t){if(p)return Ve(6,1,e,t);var r=Fi();F[e>>2]=r.length;var i=0;return r.forEach((e=>i+=e.length+1)),F[t>>2]=i,0};function Ri(e){if(p)return Ve(7,1,e);try{var t=Ge.getStreamFromFD(e);return $e.close(t),0}catch(e){if(void 0===$e||"ErrnoError"!==e.name)throw e;return e.errno}}function zi(e,t){if(p)return Ve(8,1,e,t);try{var r=Ge.getStreamFromFD(e),i=r.tty?2:$e.isDir(r.mode)?3:$e.isLink(r.mode)?7:4;return k[t>>0]=i,C[t+2>>1]=0,re=[0,(te=0,+Math.abs(te)>=1?te>0?+Math.floor(te/4294967296)>>>0:~~+Math.ceil((te-+(~~te>>>0))/4294967296)>>>0:0)],P[t+8>>2]=re[0],P[t+12>>2]=re[1],re=[0,(te=0,+Math.abs(te)>=1?te>0?+Math.floor(te/4294967296)>>>0:~~+Math.ceil((te-+(~~te>>>0))/4294967296)>>>0:0)],P[t+16>>2]=re[0],P[t+20>>2]=re[1],0}catch(e){if(void 0===$e||"ErrnoError"!==e.name)throw e;return e.errno}}var Ni=(e,t,r,i)=>{for(var n=0,s=0;s>2],a=F[t+4>>2];t+=8;var d=$e.read(e,k,o,a,i);if(d<0)return-1;if(n+=d,d>2]=s,0}catch(e){if(void 0===$e||"ErrnoError"!==e.name)throw e;return e.errno}}function Oi(e,t,r,i,n){if(p)return Ve(10,1,e,t,r,i,n);var s=We(t,r);try{if(isNaN(s))return 61;var o=Ge.getStreamFromFD(e);return $e.llseek(o,s,i),re=[o.position>>>0,(te=o.position,+Math.abs(te)>=1?te>0?+Math.floor(te/4294967296)>>>0:~~+Math.ceil((te-+(~~te>>>0))/4294967296)>>>0:0)],P[n>>2]=re[0],P[n+4>>2]=re[1],o.getdents&&0===s&&0===i&&(o.getdents=null),0}catch(e){if(void 0===$e||"ErrnoError"!==e.name)throw e;return e.errno}}var Gi=(e,t,r,i)=>{for(var n=0,s=0;s>2],a=F[t+4>>2];t+=8;var d=$e.write(e,k,o,a,i);if(d<0)return-1;n+=d,void 0!==i&&(i+=d)}return n};function Hi(e,t,r,i){if(p)return Ve(11,1,e,t,r,i);try{var n=Ge.getStreamFromFD(e),s=Gi(n,t,r);return F[i>>2]=s,0}catch(e){if(void 0===$e||"ErrnoError"!==e.name)throw e;return e.errno}}Xe.init();var Wi=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=$e.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},Vi=365,ji=146;Object.defineProperties(Wi.prototype,{read:{get:function(){return(this.mode&Vi)===Vi},set:function(e){e?this.mode|=Vi:this.mode&=~Vi}},write:{get:function(){return(this.mode&ji)===ji},set:function(e){e?this.mode|=ji:this.mode&=~ji}},isFolder:{get:function(){return $e.isDir(this.mode)}},isDevice:{get:function(){return $e.isChrdev(this.mode)}}}),$e.FSNode=Wi,$e.createPreloadedFile=Re,$e.staticInit(),bt(),gt=n.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},yt=n.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},Qt(),jt(),fr(),mr=n.UnboundTypeError=wr(Error,"UnboundTypeError"),Pr(),Rr();var qi=[je,Qe,ut,pt,mt,Ii,Mi,Ri,zi,$i,Oi,Hi],Yi={f:ot,s:dt,E:lt,m:ct,z:ht,N:pt,B:mt,u:vt,P:Pt,M:Ar,D:Tr,j:Dr,O:$r,p:Hr,d:Vr,c:jr,q:Yr,l:ri,Q:ii,w:li,A:ui,C:oi,J:hi,i:_i,r:Ir,h:wi,g:Si,b:Ei,n:Ai,k:xi,I:Bi,e:di,x:ki,v:Ci,G:Ii,H:Mi,y:Ye,o:Ri,F:zi,L:$i,t:Oi,K:Hi,a:E||n.wasmMemory},Ki=ce(),Xi=e=>(Xi=Ki.S)(e),Zi=e=>(Zi=Ki.T)(e),Ji=n._pthread_self=()=>(Ji=n._pthread_self=Ki.U)(),Qi=()=>(Qi=Ki.V)();n.__emscripten_tls_init=()=>(n.__emscripten_tls_init=Ki.W)();var en=e=>(en=Ki.X)(e);n.__embind_initialize_bindings=()=>(n.__embind_initialize_bindings=Ki.Y)();var tn=n.__emscripten_thread_init=(e,t,r,i,s,o)=>(tn=n.__emscripten_thread_init=Ki._)(e,t,r,i,s,o);n.__emscripten_thread_crashed=()=>(n.__emscripten_thread_crashed=Ki.$)();var rn,nn=(e,t,r,i)=>(nn=Ki.aa)(e,t,r,i),sn=e=>(sn=Ki.ba)(e),on=n.__emscripten_thread_exit=e=>(on=n.__emscripten_thread_exit=Ki.ca)(e),an=()=>(an=Ki.da)(),dn=(e,t)=>(dn=Ki.ea)(e,t),ln=()=>(ln=Ki.fa)(),cn=e=>(cn=Ki.ga)(e),un=e=>(un=Ki.ha)(e),hn=e=>(hn=Ki.ia)(e);function fn(){if(!(K>0)){if(p)return t(n),W(),void startWorker(n);H(),K>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e())}function e(){rn||(rn=!0,n.calledRun=!0,M||(W(),t(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),V()))}}if(n.dynCall_jiji=(e,t,r,i,s)=>(n.dynCall_jiji=Ki.ja)(e,t,r,i,s),n._ff_h264_cabac_tables=98885,n.wasmMemory=E,n.keepRuntimeAlive=ye,n.ExitStatus=ue,n.PThread=Xe,X=function e(){rn||fn(),rn||(X=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return fn(),e.ready}),o=(()=>{var e="undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-mt.js",document.baseURI).href;return async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var r,i,n;(n=t).ready=new Promise(((e,t)=>{r=e,i=t})),(n=void 0!==n?n:{}).locateFile=function(e){return"decoder-pro-audio.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_AUDIO_WASM_URL&&""!=JESSIBUCA_PRO_AUDIO_WASM_URL?JESSIBUCA_PRO_AUDIO_WASM_URL:e};var s,o,a,d=Object.assign({},n),l="./this.program",c="object"==typeof window,u="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";function p(e){return n.locateFile?n.locateFile(e,f):f+e}if(h){const{createRequire:e}=await import("module");var m=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-mt.js",document.baseURI).href),_=m("fs"),g=m("path");f=u?g.dirname(f)+"/":m("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-mt.js",document.baseURI).href)),s=(e,t)=>(e=J(e)?new URL(e):g.normalize(e),_.readFileSync(e,t?void 0:"utf8")),a=e=>{var t=s(e,!0);return t.buffer||(t=new Uint8Array(t)),t},o=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=J(e)?new URL(e):g.normalize(e),_.readFile(e,i?void 0:"utf8",((e,n)=>{e?r(e):t(i?n.buffer:n)}))},!n.thisProgram&&process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),n.inspect=()=>"[Emscripten Module object]"}else(c||u)&&(u?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),e&&(f=e),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},u&&(a=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),o=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var y,v,b=n.print||console.log.bind(console),w=n.printErr||console.error.bind(console);Object.assign(n,d),d=null,n.arguments&&n.arguments,n.thisProgram&&(l=n.thisProgram),n.quit&&n.quit,n.wasmBinary&&(y=n.wasmBinary),"object"!=typeof WebAssembly&&j("no native wasm support detected");var S,E,A,x,U,B,k,T,C=!1;function D(e,t){e||j(t)}function P(){var e=v.buffer;n.HEAP8=S=new Int8Array(e),n.HEAP16=A=new Int16Array(e),n.HEAPU8=E=new Uint8Array(e),n.HEAPU16=x=new Uint16Array(e),n.HEAP32=U=new Int32Array(e),n.HEAPU32=B=new Uint32Array(e),n.HEAPF32=k=new Float32Array(e),n.HEAPF64=T=new Float64Array(e)}var F=[],L=[],I=[];function M(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)N(n.preRun.shift());ne(F)}function R(){n.noFSInit||Te.init.initialized||Te.init(),Te.ignorePermissions=!1,ne(L)}function z(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)O(n.postRun.shift());ne(I)}function N(e){F.unshift(e)}function $(e){L.unshift(e)}function O(e){I.unshift(e)}var G=0,H=null;function W(e){G++,n.monitorRunDependencies&&n.monitorRunDependencies(G)}function V(e){if(G--,n.monitorRunDependencies&&n.monitorRunDependencies(G),0==G&&H){var t=H;H=null,t()}}function j(e){n.onAbort&&n.onAbort(e),w(e="Aborted("+e+")"),C=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}var q,Y,K,X="data:application/octet-stream;base64,",Z=e=>e.startsWith(X),J=e=>e.startsWith("file://");function Q(e){if(e==q&&y)return new Uint8Array(y);if(a)return a(e);throw"both async and sync fetching of the wasm failed"}function ee(e){if(!y&&(c||u)){if("function"==typeof fetch&&!J(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>Q(e)));if(o)return new Promise(((t,r)=>{o(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>Q(e)))}function te(e,t,r){return ee(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{w(`failed to asynchronously prepare wasm: ${e}`),j(e)}))}function re(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||Z(t)||J(t)||h||"function"!=typeof fetch?te(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return w(`wasm streaming compile failed: ${e}`),w("falling back to ArrayBuffer instantiation"),te(t,r,i)}))))}function ie(){var e={a:ni};function t(e,t){return si=e.exports,v=si.E,P(),Ft=si.H,$(si.F),V(),si}if(W(),n.instantiateWasm)try{return n.instantiateWasm(e,t)}catch(e){w(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return re(y,q,e,(function(e){t(e.instance)})).catch(i),{}}n.locateFile?Z(q="decoder-pro-audio.wasm")||(q=p(q)):q=new URL("decoder-pro-audio.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-mt.js",document.baseURI).href).href;var ne=e=>{for(;e.length>0;)e.shift()(n)};function se(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){B[this.ptr+4>>2]=e},this.get_type=function(){return B[this.ptr+4>>2]},this.set_destructor=function(e){B[this.ptr+8>>2]=e},this.get_destructor=function(){return B[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,S[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=S[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,S[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=S[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){B[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return B[this.ptr+16>>2]},this.get_exception_ptr=function(){if(ci(this.get_type()))return B[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}n.noExitRuntime;var oe=(e,t,r)=>{throw new se(e).init(t,r),e},ae=e=>(U[ai()>>2]=e,e),de={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=de.isAbs(e),r="/"===e.substr(-1);return(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=de.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=de.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return de.normalize(e.join("/"))},join2:(e,t)=>de.normalize(e+"/"+t)},le=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}j("initRandomDevice")},ce=e=>(ce=le())(e),ue={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:Te.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=de.isAbs(i)}return(t?"/":"")+(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=ue.resolve(e).substr(1),t=ue.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),s=Math.min(i.length,n.length),o=s,a=0;a{for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&he)return he.decode(e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&o)<<6|a)}else s+=String.fromCharCode(o)}return s},pe=[],me=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},_e=(e,t,r,i)=>{if(!(i>0))return 0;for(var n=r,s=r+i-1,o=0;o=55296&&a<=57343)a=65536+((1023&a)<<10)|1023&e.charCodeAt(++o);if(a<=127){if(r>=s)break;t[r++]=a}else if(a<=2047){if(r+1>=s)break;t[r++]=192|a>>6,t[r++]=128|63&a}else if(a<=65535){if(r+2>=s)break;t[r++]=224|a>>12,t[r++]=128|a>>6&63,t[r++]=128|63&a}else{if(r+3>=s)break;t[r++]=240|a>>18,t[r++]=128|a>>12&63,t[r++]=128|a>>6&63,t[r++]=128|63&a}}return t[r]=0,r-n};function ge(e,t,r){var i=r>0?r:me(e)+1,n=new Array(i),s=_e(e,n,0,n.length);return t&&(n.length=s),n}var ye=()=>{if(!pe.length){var e=null;if(h){var t=Buffer.alloc(256),r=0,i=process.stdin.fd;try{r=_.readSync(i,t)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}e=r>0?t.slice(0,r).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;pe=ge(e,!0)}return pe.shift()},ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},Te.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new Te.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new Te.ErrnoError(60);for(var s=0,o=0;oye(),put_char(e,t){null===t||10===t?(b(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(b(fe(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(w(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(w(fe(e.output,0)),e.output=[])}}},be=e=>{j()},we={ops_table:null,mount:e=>we.createNode(null,"/",16895,0),createNode(e,t,r,i){if(Te.isBlkdev(r)||Te.isFIFO(r))throw new Te.ErrnoError(63);we.ops_table||(we.ops_table={dir:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,lookup:we.node_ops.lookup,mknod:we.node_ops.mknod,rename:we.node_ops.rename,unlink:we.node_ops.unlink,rmdir:we.node_ops.rmdir,readdir:we.node_ops.readdir,symlink:we.node_ops.symlink},stream:{llseek:we.stream_ops.llseek}},file:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:{llseek:we.stream_ops.llseek,read:we.stream_ops.read,write:we.stream_ops.write,allocate:we.stream_ops.allocate,mmap:we.stream_ops.mmap,msync:we.stream_ops.msync}},link:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,readlink:we.node_ops.readlink},stream:{}},chrdev:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:Te.chrdev_stream_ops}});var n=Te.createNode(e,t,r,i);return Te.isDir(n.mode)?(n.node_ops=we.ops_table.dir.node,n.stream_ops=we.ops_table.dir.stream,n.contents={}):Te.isFile(n.mode)?(n.node_ops=we.ops_table.file.node,n.stream_ops=we.ops_table.file.stream,n.usedBytes=0,n.contents=null):Te.isLink(n.mode)?(n.node_ops=we.ops_table.link.node,n.stream_ops=we.ops_table.link.stream):Te.isChrdev(n.mode)&&(n.node_ops=we.ops_table.chrdev.node,n.stream_ops=we.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n,e.timestamp=n.timestamp),n},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Te.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,Te.isDir(e.mode)?t.size=4096:Te.isFile(e.mode)?t.size=e.usedBytes:Te.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&we.resizeFileStorage(e,t.size)},lookup(e,t){throw Te.genericErrors[44]},mknod:(e,t,r,i)=>we.createNode(e,t,r,i),rename(e,t,r){if(Te.isDir(e.mode)){var i;try{i=Te.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new Te.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=Te.lookupNode(e,t);for(var i in r.contents)throw new Te.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink(e,t,r){var i=we.createNode(e,t,41471,0);return i.link=r,i},readlink(e){if(!Te.isLink(e.mode))throw new Te.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,i,n){var s=e.node.contents;if(n>=e.node.usedBytes)return 0;var o=Math.min(e.node.usedBytes-n,i);if(o>8&&s.subarray)t.set(s.subarray(n,n+o),r);else for(var a=0;a0||r+t(we.stream_ops.write(e,t,0,i,r,!1),0)}},Se=(e,t,r,i)=>{var n=i?"":`al ${e}`;o(e,(r=>{D(r,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(r)),n&&V()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),n&&W()},Ee=(e,t,r,i,n,s)=>{Te.createDataFile(e,t,r,i,n,s)},Ae=n.preloadPlugins||[],xe=(e,t,r,i)=>{"undefined"!=typeof Browser&&Browser.init();var n=!1;return Ae.forEach((s=>{n||s.canHandle(t)&&(s.handle(e,t,r,i),n=!0)})),n},Ue=(e,t,r,i,n,s,o,a,d,l)=>{var c=t?ue.resolve(de.join2(e,t)):e;function u(r){function u(r){l&&l(),a||Ee(e,t,r,i,n,d),s&&s(),V()}xe(r,c,u,(()=>{o&&o(),V()}))||u(r)}W(),"string"==typeof r?Se(r,(e=>u(e)),o):u(r)},Be=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t},ke=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Te={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=ue.resolve(e)))return{path:"",node:null};if(t=Object.assign({follow_mount:!0,recurse_count:0},t),t.recurse_count>8)throw new Te.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),i=Te.root,n="/",s=0;s40)throw new Te.ErrnoError(32)}}return{path:n,node:i}},getPath(e){for(var t;;){if(Te.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,i=0;i>>0)%Te.nameTable.length},hashAddNode(e){var t=Te.hashName(e.parent.id,e.name);e.name_next=Te.nameTable[t],Te.nameTable[t]=e},hashRemoveNode(e){var t=Te.hashName(e.parent.id,e.name);if(Te.nameTable[t]===e)Te.nameTable[t]=e.name_next;else for(var r=Te.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=Te.mayLookup(e);if(r)throw new Te.ErrnoError(r,e);for(var i=Te.hashName(e.id,t),n=Te.nameTable[i];n;n=n.name_next){var s=n.name;if(n.parent.id===e.id&&s===t)return n}return Te.lookup(e,t)},createNode(e,t,r,i){var n=new Te.FSNode(e,t,r,i);return Te.hashAddNode(n),n},destroyNode(e){Te.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>Te.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){var t=Te.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{Te.lookupNode(e,t);return 20}catch(e){}return Te.nodePermissions(e,"wx")},mayDelete(e,t,r){var i;try{i=Te.lookupNode(e,t)}catch(e){return e.errno}var n=Te.nodePermissions(e,"wx");if(n)return n;if(r){if(!Te.isDir(i.mode))return 54;if(Te.isRoot(i)||Te.getPath(i)===Te.cwd())return 10}else if(Te.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?Te.isLink(e.mode)?32:Te.isDir(e.mode)&&("r"!==Te.flagsToPermissionString(t)||512&t)?31:Te.nodePermissions(e,Te.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Te.MAX_OPEN_FDS;e++)if(!Te.streams[e])return e;throw new Te.ErrnoError(33)},getStreamChecked(e){var t=Te.getStream(e);if(!t)throw new Te.ErrnoError(8);return t},getStream:e=>Te.streams[e],createStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return Te.FSStream||(Te.FSStream=function(){this.shared={}},Te.FSStream.prototype={},Object.defineProperties(Te.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},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(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new Te.FSStream,e),-1==t&&(t=Te.nextfd()),e.fd=t,Te.streams[t]=e,e},closeStream(e){Te.streams[e]=null},chrdev_stream_ops:{open(e){var t=Te.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek(){throw new Te.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Te.devices[e]={stream_ops:t}},getDevice:e=>Te.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),Te.syncFSRequests++,Te.syncFSRequests>1&&w(`warning: ${Te.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Te.getMounts(Te.root.mount),i=0;function n(e){return Te.syncFSRequests--,t(e)}function s(e){if(e)return s.errored?void 0:(s.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return s(null);t.type.syncfs(t,e,s)}))},mount(e,t,r){var i,n="/"===r,s=!r;if(n&&Te.root)throw new Te.ErrnoError(10);if(!n&&!s){var o=Te.lookupPath(r,{follow_mount:!1});if(r=o.path,i=o.node,Te.isMountpoint(i))throw new Te.ErrnoError(10);if(!Te.isDir(i.mode))throw new Te.ErrnoError(54)}var a={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(a);return d.mount=a,a.root=d,n?Te.root=d:i&&(i.mounted=a,i.mount&&i.mount.mounts.push(a)),d},unmount(e){var t=Te.lookupPath(e,{follow_mount:!1});if(!Te.isMountpoint(t.node))throw new Te.ErrnoError(28);var r=t.node,i=r.mounted,n=Te.getMounts(i);Object.keys(Te.nameTable).forEach((e=>{for(var t=Te.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&Te.destroyNode(t),t=r}})),r.mounted=null;var s=r.mount.mounts.indexOf(i);r.mount.mounts.splice(s,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var i=Te.lookupPath(e,{parent:!0}).node,n=de.basename(e);if(!n||"."===n||".."===n)throw new Te.ErrnoError(28);var s=Te.mayCreate(i,n);if(s)throw new Te.ErrnoError(s);if(!i.node_ops.mknod)throw new Te.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,Te.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,Te.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),i="",n=0;n(void 0===r&&(r=t,t=438),t|=8192,Te.mknod(e,t,r)),symlink(e,t){if(!ue.resolve(e))throw new Te.ErrnoError(44);var r=Te.lookupPath(t,{parent:!0}).node;if(!r)throw new Te.ErrnoError(44);var i=de.basename(t),n=Te.mayCreate(r,i);if(n)throw new Te.ErrnoError(n);if(!r.node_ops.symlink)throw new Te.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename(e,t){var r,i,n=de.dirname(e),s=de.dirname(t),o=de.basename(e),a=de.basename(t);if(r=Te.lookupPath(e,{parent:!0}).node,i=Te.lookupPath(t,{parent:!0}).node,!r||!i)throw new Te.ErrnoError(44);if(r.mount!==i.mount)throw new Te.ErrnoError(75);var d,l=Te.lookupNode(r,o),c=ue.relative(e,s);if("."!==c.charAt(0))throw new Te.ErrnoError(28);if("."!==(c=ue.relative(t,n)).charAt(0))throw new Te.ErrnoError(55);try{d=Te.lookupNode(i,a)}catch(e){}if(l!==d){var u=Te.isDir(l.mode),h=Te.mayDelete(r,o,u);if(h)throw new Te.ErrnoError(h);if(h=d?Te.mayDelete(i,a,u):Te.mayCreate(i,a))throw new Te.ErrnoError(h);if(!r.node_ops.rename)throw new Te.ErrnoError(63);if(Te.isMountpoint(l)||d&&Te.isMountpoint(d))throw new Te.ErrnoError(10);if(i!==r&&(h=Te.nodePermissions(r,"w")))throw new Te.ErrnoError(h);Te.hashRemoveNode(l);try{r.node_ops.rename(l,i,a)}catch(e){throw e}finally{Te.hashAddNode(l)}}},rmdir(e){var t=Te.lookupPath(e,{parent:!0}).node,r=de.basename(e),i=Te.lookupNode(t,r),n=Te.mayDelete(t,r,!0);if(n)throw new Te.ErrnoError(n);if(!t.node_ops.rmdir)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.rmdir(t,r),Te.destroyNode(i)},readdir(e){var t=Te.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new Te.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=Te.lookupPath(e,{parent:!0}).node;if(!t)throw new Te.ErrnoError(44);var r=de.basename(e),i=Te.lookupNode(t,r),n=Te.mayDelete(t,r,!1);if(n)throw new Te.ErrnoError(n);if(!t.node_ops.unlink)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.unlink(t,r),Te.destroyNode(i)},readlink(e){var t=Te.lookupPath(e).node;if(!t)throw new Te.ErrnoError(44);if(!t.node_ops.readlink)throw new Te.ErrnoError(28);return ue.resolve(Te.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=Te.lookupPath(e,{follow:!t}).node;if(!r)throw new Te.ErrnoError(44);if(!r.node_ops.getattr)throw new Te.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>Te.stat(e,!0),chmod(e,t,r){var i;"string"==typeof e?i=Te.lookupPath(e,{follow:!r}).node:i=e;if(!i.node_ops.setattr)throw new Te.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod(e,t){Te.chmod(e,t,!0)},fchmod(e,t){var r=Te.getStreamChecked(e);Te.chmod(r.node,t)},chown(e,t,r,i){var n;"string"==typeof e?n=Te.lookupPath(e,{follow:!i}).node:n=e;if(!n.node_ops.setattr)throw new Te.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown(e,t,r){Te.chown(e,t,r,!0)},fchown(e,t,r){var i=Te.getStreamChecked(e);Te.chown(i.node,t,r)},truncate(e,t){if(t<0)throw new Te.ErrnoError(28);var r;"string"==typeof e?r=Te.lookupPath(e,{follow:!0}).node:r=e;if(!r.node_ops.setattr)throw new Te.ErrnoError(63);if(Te.isDir(r.mode))throw new Te.ErrnoError(31);if(!Te.isFile(r.mode))throw new Te.ErrnoError(28);var i=Te.nodePermissions(r,"w");if(i)throw new Te.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=Te.getStreamChecked(e);if(0==(2097155&r.flags))throw new Te.ErrnoError(28);Te.truncate(r.node,t)},utime(e,t,r){var i=Te.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new Te.ErrnoError(44);var i;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?Be(t):t)?4095&r|32768:0,"object"==typeof e)i=e;else{e=de.normalize(e);try{i=Te.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var s=!1;if(64&t)if(i){if(128&t)throw new Te.ErrnoError(20)}else i=Te.mknod(e,r,0),s=!0;if(!i)throw new Te.ErrnoError(44);if(Te.isChrdev(i.mode)&&(t&=-513),65536&t&&!Te.isDir(i.mode))throw new Te.ErrnoError(54);if(!s){var o=Te.mayOpen(i,t);if(o)throw new Te.ErrnoError(o)}512&t&&!s&&Te.truncate(i,0),t&=-131713;var a=Te.createStream({node:i,path:Te.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return a.stream_ops.open&&a.stream_ops.open(a),!n.logReadFiles||1&t||(Te.readFiles||(Te.readFiles={}),e in Te.readFiles||(Te.readFiles[e]=1)),a},close(e){if(Te.isClosed(e))throw new Te.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Te.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Te.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Te.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,i,n){if(i<0||n<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(1==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.read)throw new Te.ErrnoError(28);var s=void 0!==n;if(s){if(!e.seekable)throw new Te.ErrnoError(70)}else n=e.position;var o=e.stream_ops.read(e,t,r,i,n);return s||(e.position+=o),o},write(e,t,r,i,n,s){if(i<0||n<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.write)throw new Te.ErrnoError(28);e.seekable&&1024&e.flags&&Te.llseek(e,0,2);var o=void 0!==n;if(o){if(!e.seekable)throw new Te.ErrnoError(70)}else n=e.position;var a=e.stream_ops.write(e,t,r,i,n,s);return o||(e.position+=a),a},allocate(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(t<0||r<=0)throw new Te.ErrnoError(28);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(!Te.isFile(e.node.mode)&&!Te.isDir(e.node.mode))throw new Te.ErrnoError(43);if(!e.stream_ops.allocate)throw new Te.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,i,n){if(0!=(2&i)&&0==(2&n)&&2!=(2097155&e.flags))throw new Te.ErrnoError(2);if(1==(2097155&e.flags))throw new Te.ErrnoError(2);if(!e.stream_ops.mmap)throw new Te.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n)},msync:(e,t,r,i,n)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new Te.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,i=Te.open(e,t.flags),n=Te.stat(e).size,s=new Uint8Array(n);return Te.read(i,s,0,n,0),"utf8"===t.encoding?r=fe(s,0):"binary"===t.encoding&&(r=s),Te.close(i),r},writeFile(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=Te.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(me(t)+1),s=_e(t,n,0,n.length);Te.write(i,n,0,s,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");Te.write(i,t,0,t.byteLength,void 0,r.canOwn)}Te.close(i)},cwd:()=>Te.currentPath,chdir(e){var t=Te.lookupPath(e,{follow:!0});if(null===t.node)throw new Te.ErrnoError(44);if(!Te.isDir(t.node.mode))throw new Te.ErrnoError(54);var r=Te.nodePermissions(t.node,"x");if(r)throw new Te.ErrnoError(r);Te.currentPath=t.path},createDefaultDirectories(){Te.mkdir("/tmp"),Te.mkdir("/home"),Te.mkdir("/home/web_user")},createDefaultDevices(){Te.mkdir("/dev"),Te.registerDevice(Te.makedev(1,3),{read:()=>0,write:(e,t,r,i,n)=>i}),Te.mkdev("/dev/null",Te.makedev(1,3)),ve.register(Te.makedev(5,0),ve.default_tty_ops),ve.register(Te.makedev(6,0),ve.default_tty1_ops),Te.mkdev("/dev/tty",Te.makedev(5,0)),Te.mkdev("/dev/tty1",Te.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=ce(e).byteLength),e[--t]);Te.createDevice("/dev","random",r),Te.createDevice("/dev","urandom",r),Te.mkdir("/dev/shm"),Te.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Te.mkdir("/proc");var e=Te.mkdir("/proc/self");Te.mkdir("/proc/self/fd"),Te.mount({mount(){var t=Te.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,i=Te.getStreamChecked(r),n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return n.parent=n,n}},t}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?Te.createDevice("/dev","stdin",n.stdin):Te.symlink("/dev/tty","/dev/stdin"),n.stdout?Te.createDevice("/dev","stdout",null,n.stdout):Te.symlink("/dev/tty","/dev/stdout"),n.stderr?Te.createDevice("/dev","stderr",null,n.stderr):Te.symlink("/dev/tty1","/dev/stderr"),Te.open("/dev/stdin",0),Te.open("/dev/stdout",1),Te.open("/dev/stderr",1)},ensureErrnoError(){Te.ErrnoError||(Te.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},Te.ErrnoError.prototype=new Error,Te.ErrnoError.prototype.constructor=Te.ErrnoError,[44].forEach((e=>{Te.genericErrors[e]=new Te.ErrnoError(e),Te.genericErrors[e].stack=""})))},staticInit(){Te.ensureErrnoError(),Te.nameTable=new Array(4096),Te.mount(we,{},"/"),Te.createDefaultDirectories(),Te.createDefaultDevices(),Te.createSpecialDirectories(),Te.filesystems={MEMFS:we}},init(e,t,r){Te.init.initialized=!0,Te.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=t||n.stdout,n.stderr=r||n.stderr,Te.createStandardStreams()},quit(){Te.init.initialized=!1;for(var e=0;ethis.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},s.prototype.setDataGetter=function(e){this.getter=e},s.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,s=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,o=1048576;n||(o=i);var a=this;a.setDataGetter((e=>{var t=e*o,n=(e+1)*o-1;if(n=Math.min(n,i-1),void 0===a.chunks[e]&&(a.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==o&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):ge(n.responseText||"",!0)})(t,n)),void 0===a.chunks[e])throw new Error("doXHR failed!");return a.chunks[e]})),!s&&i||(o=i=1,i=this.getter(0).length,o=i,b("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=o,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!u)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var o=new s;Object.defineProperties(o,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var a={isDevice:!1,contents:o}}else a={isDevice:!1,url:r};var d=Te.createFile(e,t,a,i,n);a.contents?d.contents=a.contents:a.url&&(d.contents=null,d.url=a.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,t,r,i,n){var s=e.node.contents;if(n>=s.length)return 0;var o=Math.min(s.length-n,i);if(s.slice)for(var a=0;a{var t=d.stream_ops[e];l[e]=function(){return Te.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,n)=>(Te.forceLoadFile(d),c(e,t,r,i,n)),l.mmap=(e,t,r,i,n)=>{Te.forceLoadFile(d);var s=be();if(!s)throw new Te.ErrnoError(48);return c(e,S,s,t,r),{ptr:s,allocated:!0}},d.stream_ops=l,d}},Ce=(e,t)=>e?fe(E,e,t):"",De={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(de.isAbs(t))return t;var i;-100===e?i=Te.cwd():i=De.getStreamFromFD(e).path;if(0==t.length){if(!r)throw new Te.ErrnoError(44);return i}return de.join2(i,t)},doStat(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&de.normalize(t)!==de.normalize(Te.getPath(e.node)))return-54;throw e}U[r>>2]=i.dev,U[r+4>>2]=i.mode,B[r+8>>2]=i.nlink,U[r+12>>2]=i.uid,U[r+16>>2]=i.gid,U[r+20>>2]=i.rdev,K=[i.size>>>0,(Y=i.size,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+24>>2]=K[0],U[r+28>>2]=K[1],U[r+32>>2]=4096,U[r+36>>2]=i.blocks;var n=i.atime.getTime(),s=i.mtime.getTime(),o=i.ctime.getTime();return K=[Math.floor(n/1e3)>>>0,(Y=Math.floor(n/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+40>>2]=K[0],U[r+44>>2]=K[1],B[r+48>>2]=n%1e3*1e3,K=[Math.floor(s/1e3)>>>0,(Y=Math.floor(s/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+56>>2]=K[0],U[r+60>>2]=K[1],B[r+64>>2]=s%1e3*1e3,K=[Math.floor(o/1e3)>>>0,(Y=Math.floor(o/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+72>>2]=K[0],U[r+76>>2]=K[1],B[r+80>>2]=o%1e3*1e3,K=[i.ino>>>0,(Y=i.ino,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+88>>2]=K[0],U[r+92>>2]=K[1],0},doMsync(e,t,r,i,n){if(!Te.isFile(t.node.mode))throw new Te.ErrnoError(43);if(2&i)return 0;var s=E.slice(e,e+r);Te.msync(t,s,n,r,i)},varargs:void 0,get(){var e=U[+De.varargs>>2];return De.varargs+=4,e},getp:()=>De.get(),getStr:e=>Ce(e),getStreamFromFD:e=>Te.getStreamChecked(e)};function Pe(e,t,r){De.varargs=r;try{var i=De.getStreamFromFD(e);switch(t){case 0:if((n=De.get())<0)return-28;for(;Te.streams[n];)n++;return Te.createStream(i,n).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var n=De.get();return i.flags|=n,0;case 5:n=De.getp();return A[n+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return ae(28),-1}}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}function Fe(e,t,r,i){De.varargs=i;try{t=De.getStr(t),t=De.calculateAt(e,t);var n=i?De.get():0;return Te.open(t,r,n).fd}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}var Le,Ie,Me,Re=(e,t,r,i,n)=>{},ze=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Le=e},Ne=e=>{for(var t="",r=e;E[r];)t+=Le[E[r++]];return t},$e={},Oe={},Ge={},He=e=>{throw new Ie(e)},We=e=>{throw new Me(e)},Ve=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&We("Mismatched type converter count");for(var n=0;n{Oe.hasOwnProperty(e)?n[t]=Oe[e]:(s.push(e),$e.hasOwnProperty(e)||($e[e]=[]),$e[e].push((()=>{n[t]=Oe[e],++o===s.length&&i(n)})))})),0===s.length&&i(n)};function je(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||He(`type "${i}" must have a positive integer typeid pointer`),Oe.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;He(`Cannot register type '${i}' twice`)}if(Oe[e]=t,delete Ge[e],$e.hasOwnProperty(e)){var n=$e[e];delete $e[e],n.forEach((e=>e()))}}function qe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return je(e,t,r)}var Ye,Ke=8,Xe=(e,t,r,i)=>{qe(e,{name:t=Ne(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:Ke,readValueFromPointer:function(e){return this.fromWireType(E[e])},destructorFunction:null})},Ze=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Je=e=>{He(e.$$.ptrType.registeredClass.name+" instance already deleted")},Qe=!1,et=e=>{},tt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},rt=e=>{e.count.value-=1,0===e.count.value&&tt(e)},it=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=it(e,t,r.baseClass);return null===i?null:r.downcast(i)},nt={},st=()=>Object.keys(ut).length,ot=()=>{var e=[];for(var t in ut)ut.hasOwnProperty(t)&&e.push(ut[t]);return e},at=[],dt=()=>{for(;at.length;){var e=at.pop();e.$$.deleteScheduled=!1,e.delete()}},lt=e=>{Ye=e,at.length&&Ye&&Ye(dt)},ct=()=>{n.getInheritedInstanceCount=st,n.getLiveInheritedInstances=ot,n.flushPendingDeletes=dt,n.setDelayFunction=lt},ut={},ht=(e,t)=>{for(void 0===t&&He("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},ft=(e,t)=>(t=ht(e,t),ut[t]),pt=(e,t)=>(t.ptrType&&t.ptr||We("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!==!!t.smartPtr&&We("Both smartPtrType and smartPtr must be specified"),t.count={value:1},_t(Object.create(e,{$$:{value:t}})));function mt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ft(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?pt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):pt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,o=this.registeredClass.getActualType(t),a=nt[o];if(!a)return n.call(this);s=this.isConst?a.constPointerType:a.pointerType;var d=it(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}var _t=e=>"undefined"==typeof FinalizationRegistry?(_t=e=>e,e):(Qe=new FinalizationRegistry((e=>{rt(e.$$)})),_t=e=>{var t=e.$$;if(!!t.smartPtr){var r={$$:t};Qe.register(e,r,e)}return e},et=e=>Qe.unregister(e),_t(e)),gt=()=>{Object.assign(yt.prototype,{isAliasOf(e){if(!(this instanceof yt))return!1;if(!(e instanceof yt))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n},clone(){if(this.$$.ptr||Je(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=_t(Object.create(Object.getPrototypeOf(this),{$$:{value:Ze(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),et(this),rt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),at.push(this),1===at.length&&Ye&&Ye(dt),this.$$.deleteScheduled=!0,this}})};function yt(){}var vt=(e,t)=>Object.defineProperty(t,"name",{value:e}),bt=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||He(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},wt=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&He(`Cannot register public name '${e}' twice`),bt(n,e,e),n.hasOwnProperty(r)&&He(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,void 0!==r&&(n[e].numArguments=r))},St=48,Et=57,At=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=St&&t<=Et?`_${e}`:e};function xt(e,t,r,i,n,s,o,a){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=o,this.downcast=a,this.pureVirtualFunctions=[]}var Ut=(e,t,r)=>{for(;t!==r;)t.upcast||He(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function Bt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ut(t.$$.ptr,r,this.registeredClass)}function kt(e,t){var r;if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=Ut(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&He("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,sr.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:He("Unsupporting sharing policy")}return r}function Tt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ut(t.$$.ptr,r,this.registeredClass)}function Ct(e){return this.fromWireType(B[e>>2])}var Dt=()=>{Object.assign(Pt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:Ke,readValueFromPointer:Ct,deleteObject(e){null!==e&&e.delete()},fromWireType:mt})};function Pt(e,t,r,i,n,s,o,a,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=o,this.rawGetPointee=a,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=kt:i?(this.toWireType=Bt,this.destructorFunction=null):(this.toWireType=Tt,this.destructorFunction=null)}var Ft,Lt,It=(e,t,r)=>{n.hasOwnProperty(e)||We("Replacing nonexistant public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},Mt=(e,t,r)=>{var i=n["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},Rt=[],zt=e=>{var t=Rt[e];return t||(e>=Rt.length&&(Rt.length=e+1),Rt[e]=t=Ft.get(e)),t},Nt=(e,t,r)=>e.includes("j")?Mt(e,t,r):zt(t).apply(null,r),$t=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),Nt(e,t,r)}},Ot=(e,t)=>{var r=(e=Ne(e)).includes("j")?$t(e,t):zt(t);return"function"!=typeof r&&He(`unknown function pointer with signature ${e}: ${t}`),r},Gt=(e,t)=>{var r=vt(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},Ht=e=>{var t=di(e),r=Ne(t);return oi(t),r},Wt=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Oe[t]||(Ge[t]?Ge[t].forEach(e):(r.push(t),i[t]=!0))})),new Lt(`${e}: `+r.map(Ht).join([", "]))},Vt=(e,t,r,i,n,s,o,a,d,l,c,u,h)=>{c=Ne(c),s=Ot(n,s),a&&(a=Ot(o,a)),l&&(l=Ot(d,l)),h=Ot(u,h);var f=At(c);wt(f,(function(){Wt(`Cannot construct ${c} due to unbound types`,[i])})),Ve([e,t,r],i?[i]:[],(function(t){var r,n;t=t[0],n=i?(r=t.registeredClass).instancePrototype:yt.prototype;var o=vt(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new Ie("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new Ie(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new Ie(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(n,{constructor:{value:o}});o.prototype=d;var u=new xt(c,o,d,h,r,s,a,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new Pt(c,u,!0,!1,!1),m=new Pt(c+"*",u,!1,!1,!1),_=new Pt(c+" const*",u,!1,!0,!1);return nt[e]={pointerType:m,constPointerType:_},It(f,o),[p,m,_]}))},jt=(e,t)=>{for(var r=[],i=0;i>2]);return r},qt=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Yt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=vt(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function Kt(e,t,r,i,n,s){var o=t.length;o<2&&He("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||s?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=a?1:2;l{var o=jt(t,r);n=Ot(i,n),Ve([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Ie(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Wt(`Cannot construct ${e.name} due to unbound types`,o)},Ve([],o,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Kt(r,i,null,n,s),[]))),[]}))},Zt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Jt=(e,t,r,i,n,s,o,a,d)=>{var l=jt(r,i);t=Ne(t),t=Zt(t),s=Ot(n,s),Ve([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function n(){Wt(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),a&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,c[t]=n):(bt(c,t,i),c[t].overloadTable[r-2]=n),Ve([],l,(function(n){var a=Kt(i,n,e,s,o,d);return void 0===c[t].overloadTable?(a.argCount=r-2,c[t]=a):c[t].overloadTable[r-2]=a,[]})),[]}))};function Qt(){Object.assign(er.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function er(){this.allocated=[void 0],this.freelist=[]}var tr=new er,rr=e=>{e>=tr.reserved&&0==--tr.get(e).refcount&&tr.free(e)},ir=()=>{for(var e=0,t=tr.reserved;t{tr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),tr.reserved=tr.allocated.length,n.count_emval_handles=ir},sr={toValue:e=>(e||He("Cannot use deleted val. handle = "+e),tr.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return tr.allocate({refcount:1,value:e})}}};function or(e){return this.fromWireType(U[e>>2])}var ar=(e,t)=>{qe(e,{name:t=Ne(t),fromWireType:e=>{var t=sr.toValue(e);return rr(e),t},toWireType:(e,t)=>sr.toHandle(t),argPackAdvance:Ke,readValueFromPointer:or,destructorFunction:null})},dr=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},lr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(k[e>>2])};case 8:return function(e){return this.fromWireType(T[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},cr=(e,t,r)=>{qe(e,{name:t=Ne(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Ke,readValueFromPointer:lr(t,r),destructorFunction:null})},ur=(e,t,r)=>{switch(t){case 1:return r?e=>S[e>>0]:e=>E[e>>0];case 2:return r?e=>A[e>>1]:e=>x[e>>1];case 4:return r?e=>U[e>>2]:e=>B[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},hr=(e,t,r,i,n)=>{t=Ne(t);var s=e=>e;if(0===i){var o=32-8*r;s=e=>e<>>o}var a=t.includes("unsigned");qe(e,{name:t,fromWireType:s,toWireType:a?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:Ke,readValueFromPointer:ur(t,r,0!==i),destructorFunction:null})},fr=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=B[e>>2],r=B[e+4>>2];return new i(S.buffer,r,t)}qe(e,{name:r=Ne(r),fromWireType:n,argPackAdvance:Ke,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},pr=(e,t,r)=>_e(e,E,t,r),mr=(e,t)=>{var r="std::string"===(t=Ne(t));qe(e,{name:t,fromWireType(e){var t,i=B[e>>2],n=e+4;if(r)for(var s=n,o=0;o<=i;++o){var a=n+o;if(o==i||0==E[a]){var d=Ce(s,a-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=a+1}}else{var l=new Array(i);for(o=0;o>2]=i,r&&n)pr(t,o,i+1);else if(n)for(var a=0;a255&&(oi(o),He("String has UTF-16 code units that do not fit in 8 bits")),E[o+a]=d}else for(a=0;a{for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&x[i];)++i;if((r=i<<1)-e>32&&_r)return _r.decode(E.subarray(e,r));for(var s="",o=0;!(o>=t/2);++o){var a=A[e+2*o>>1];if(0==a)break;s+=String.fromCharCode(a)}return s},yr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=o,t+=2}return A[t>>1]=0,t-i},vr=e=>2*e.length,br=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var n=U[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i},wr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&o<=57343)o=65536+((1023&o)<<10)|1023&e.charCodeAt(++s);if(U[t>>2]=o,(t+=4)+4>n)break}return U[t>>2]=0,t-i},Sr=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},Er=(e,t,r)=>{var i,n,s,o,a;r=Ne(r),2===t?(i=gr,n=yr,o=vr,s=()=>x,a=1):4===t&&(i=br,n=wr,o=Sr,s=()=>B,a=2),qe(e,{name:r,fromWireType:e=>{for(var r,n=B[e>>2],o=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==o[c>>a]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return oi(e),r},toWireType:(e,i)=>{"string"!=typeof i&&He(`Cannot pass non-string to C++ string type ${r}`);var s=o(i),d=li(4+s+t);return B[d>>2]=s>>a,n(i,d+4,s+t),null!==e&&e.push(oi,d),d},argPackAdvance:Ke,readValueFromPointer:or,destructorFunction(e){oi(e)}})},Ar=(e,t)=>{qe(e,{isVoid:!0,name:t=Ne(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},xr={},Ur=e=>{var t=xr[e];return void 0===t?Ne(e):t},Br=[],kr=(e,t,r,i,n)=>(e=Br[e])(t=sr.toValue(t),t[r=Ur(r)],i,n),Tr=e=>{var t=Br.length;return Br.push(e),t},Cr=(e,t)=>{var r=Oe[e];return void 0===r&&He(t+" has unknown type "+Ht(e)),r},Dr=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},Pr=(e,t,r)=>{var i=[],n=e.toWireType(i,r);return i.length&&(B[t>>2]=sr.toHandle(i)),n},Fr=(e,t,r)=>{var i=Dr(e,t),n=i.shift();e--;var s="return function (obj, func, destructorsRef, args) {\n",o=0,a=[];0===r&&a.push("obj");for(var d=["retType"],l=[n],c=0;ce.name)).join(", ")}) => ${n.name}>`;return Tr(vt(h,u))},Lr=e=>{var t=sr.toValue(e);qt(t),rr(e)},Ir=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,Mr=()=>{j("")},Rr=()=>Date.now(),zr=(e,t,r)=>E.copyWithin(e,t,t+r),Nr=e=>{j("OOM")},$r=e=>{E.length,Nr()},Or={},Gr=()=>l||"./this.program",Hr=()=>{if(!Hr.strings){var e={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",_:Gr()};for(var t in Or)void 0===Or[t]?delete e[t]:e[t]=Or[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Hr.strings=r}return Hr.strings},Wr=(e,t)=>{for(var r=0;r>0]=e.charCodeAt(r);S[t>>0]=0},Vr=(e,t)=>{var r=0;return Hr().forEach(((i,n)=>{var s=t+r;B[e+4*n>>2]=s,Wr(i,s),r+=i.length+1})),0},jr=(e,t)=>{var r=Hr();B[e>>2]=r.length;var i=0;return r.forEach((e=>i+=e.length+1)),B[t>>2]=i,0};function qr(e){try{var t=De.getStreamFromFD(e);return Te.close(t),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Yr(e,t){try{var r=De.getStreamFromFD(e),i=r.tty?2:Te.isDir(r.mode)?3:Te.isLink(r.mode)?7:4;return S[t>>0]=i,A[t+2>>1]=0,K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[t+8>>2]=K[0],U[t+12>>2]=K[1],K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[t+16>>2]=K[0],U[t+20>>2]=K[1],0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Kr=(e,t,r,i)=>{for(var n=0,s=0;s>2],a=B[t+4>>2];t+=8;var d=Te.read(e,S,o,a,i);if(d<0)return-1;if(n+=d,d>2]=s,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Zr(e,t,r,i,n){var s=Ir(t,r);try{if(isNaN(s))return 61;var o=De.getStreamFromFD(e);return Te.llseek(o,s,i),K=[o.position>>>0,(Y=o.position,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[n>>2]=K[0],U[n+4>>2]=K[1],o.getdents&&0===s&&0===i&&(o.getdents=null),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Jr=(e,t,r,i)=>{for(var n=0,s=0;s>2],a=B[t+4>>2];t+=8;var d=Te.write(e,S,o,a,i);if(d<0)return-1;n+=d,void 0!==i&&(i+=d)}return n};function Qr(e,t,r,i){try{var n=De.getStreamFromFD(e),s=Jr(n,t,r);return B[i>>2]=s,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var ei=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=Te.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},ti=365,ri=146;Object.defineProperties(ei.prototype,{read:{get:function(){return(this.mode&ti)===ti},set:function(e){e?this.mode|=ti:this.mode&=~ti}},write:{get:function(){return(this.mode&ri)===ri},set:function(e){e?this.mode|=ri:this.mode&=~ri}},isFolder:{get:function(){return Te.isDir(this.mode)}},isDevice:{get:function(){return Te.isChrdev(this.mode)}}}),Te.FSNode=ei,Te.createPreloadedFile=Ue,Te.staticInit(),ze(),Ie=n.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Me=n.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},gt(),ct(),Dt(),Lt=n.UnboundTypeError=Gt(Error,"UnboundTypeError"),Qt(),nr();var ii,ni={o:oe,A:Pe,s:Fe,q:Re,C:Xe,D:Vt,y:Xt,h:Jt,B:ar,l:cr,c:hr,b:fr,m:mr,j:Er,n:Ar,f:kr,g:rr,e:Fr,d:Lr,a:Mr,i:Rr,w:zr,r:$r,u:Vr,v:jr,k:qr,t:Yr,z:Xr,p:Zr,x:Qr},si=ie(),oi=e=>(oi=si.G)(e),ai=()=>(ai=si.I)(),di=e=>(di=si.J)(e),li=e=>(li=si.K)(e),ci=e=>(ci=si.M)(e);function ui(){function e(){ii||(ii=!0,n.calledRun=!0,C||(R(),r(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),z()))}G>0||(M(),G>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.dynCall_viiijj=(e,t,r,i,s,o,a,d)=>(n.dynCall_viiijj=si.N)(e,t,r,i,s,o,a,d),n.dynCall_jij=(e,t,r,i)=>(n.dynCall_jij=si.O)(e,t,r,i),n.dynCall_jii=(e,t,r)=>(n.dynCall_jii=si.P)(e,t,r),n.dynCall_jiji=(e,t,r,i,s)=>(n.dynCall_jiji=si.Q)(e,t,r,i,s),H=function e(){ii||ui(),ii||(H=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return ui(),t.ready}})(),a=1e-6,d="undefined"!=typeof Float32Array?Float32Array:Array;function l(){var e=new d(16);return d!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function c(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var u,h=function(e,t,r,i,n,s,o){var a=1/(t-r),d=1/(i-n),l=1/(s-o);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*d,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*a,e[13]=(n+i)*d,e[14]=(o+s)*l,e[15]=1,e};function f(e,t,r){var i=new d(3);return i[0]=e,i[1]=t,i[2]=r,i}u=new d(3),d!=Float32Array&&(u[0]=0,u[1]=0,u[2]=0);var p=(e,t)=>{t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);const r=function(){const t=m(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),r=m(e.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))return console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(i)),null;return i}();let i={program:r,attribLocations:{vertexPosition:e.getAttribLocation(r,"aVertexPosition"),texturePosition:e.getAttribLocation(r,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(r,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(r,"uModelMatrix"),viewMatrix:e.getUniformLocation(r,"uViewMatrix"),rgbatexture:e.getUniformLocation(r,"rgbaTexture"),ytexture:e.getUniformLocation(r,"yTexture"),utexture:e.getUniformLocation(r,"uTexture"),vtexture:e.getUniformLocation(r,"vTexture"),isyuv:e.getUniformLocation(r,"isyuv")}},n=function(){const t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),e.STATIC_DRAW);var r=[];r=r.concat([0,1],[1,1],[1,0],[0,0]);const i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW);const n=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,texPosition:i,indices:n}}(),s=p(),o=p(),d=p(),u=p();function p(){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function m(t,r){const i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(console.log("An error occurred compiling the shaders: "+e.getShaderInfoLog(i)),e.deleteShader(i),null)}function _(t,r){e.viewport(0,0,t,r),e.clearColor(0,0,0,0),e.clearDepth(1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);const s=l();h(s,-1,1,-1,1,.1,100);const p=l();c(p);const m=l();!function(e,t,r,i){var n,s,o,d,l,u,h,f,p,m,_=t[0],g=t[1],y=t[2],v=i[0],b=i[1],w=i[2],S=r[0],E=r[1],A=r[2];Math.abs(_-S)32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let r=e-this._current_word_bits_left;this._fillCurrentWord();let i=Math.min(r,this._current_word_bits_left),n=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Ht=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Wt=Ht,Vt=Ht;function jt(e){let{profile:t,sampleRate:r,channel:i}=e;return new Uint8Array([175,0,t<<3|(14&r)>>1,(1&r)<<7|i<<3])}function qt(e){return Yt(e)&&e[1]===Bt}function Yt(e){return e[0]>>4===$e}const Kt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Xt(e){let t=new Uint8Array(e),r=null,i=0,n=0,s=0,o=null;if(i=n=t[0]>>>3,s=(7&t[0])<<1|t[1]>>>7,s<0||s>=Kt.length)return void console.error("Flv: AAC invalid sampling frequency index!");let a=Kt[s],d=(120&t[1])>>>3;if(d<0||d>=8)return void console.log("Flv: AAC invalid channel configuration");5===i&&(o=(7&t[1])<<1|t[2]>>>7,t[2]);let l=self.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?s>=6?(i=5,r=new Array(4),o=s-3):(i=2,r=new Array(2),o=s):-1!==l.indexOf("android")?(i=2,r=new Array(2),o=s):(i=5,o=s,r=new Array(4),s>=6?o=s-3:1===d&&(i=2,r=new Array(2),o=s)),r[0]=i<<3,r[0]|=(15&s)>>>1,r[1]=(15&s)<<7,r[1]|=(15&d)<<3,5===i&&(r[1]|=(15&o)>>>1,r[2]=(1&o)<<7,r[2]|=8,r[3]=0),{audioType:"aac",config:r,sampleRate:a,channelCount:d,objectType:i,codec:"mp4a.40."+i,originalCodec:"mp4a.40."+n}}class Zt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+7>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(4095===(r[t+0]<<8|r[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let r=this.current_syncword_offset_,i=(8&e[r+1])>>>3,n=(6&e[r+1])>>>1,s=1&e[r+1],o=(192&e[r+2])>>>6,a=(60&e[r+2])>>>2,d=(1&e[r+2])<<2|(192&e[r+3])>>>6,l=(3&e[r+3])<<11|e[r+4]<<3|(224&e[r+5])>>>5;if(e[r+6],r+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let c=1===s?7:9,u=l-c;r+=c;let h=this.findNextSyncwordOffset(r+u);if(this.current_syncword_offset_=h,0!==i&&1!==i||0!==n)continue;let f=e.subarray(r,r+u);t={},t.audio_object_type=o+1,t.sampling_freq_index=a,t.sampling_frequency=Wt[a],t.channel_config=d,t.data=f}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Jt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+1>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(695===(r[t+0]<<3|r[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),r=0;for(let i=0;i<=t;i++)r<<=8,r|=e.readByte();return r}readNextAACFrame(e){let t=this.data_,r=null;for(;null==r&&!this.eof_flag_;){let i=this.current_syncword_offset_,n=(31&t[i+1])<<8|t[i+2];if(i+3+n>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let s=new Gt(t.subarray(i+3,i+3+n)),o=null;if(s.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(i+3+n),s.destroy();continue}o=e}else{let e=s.readBool();if(e&&s.readBool()){console.error("audioMuxVersionA is Not Supported"),s.destroy();break}if(e&&this.getLATMValue(s),!s.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),s.destroy();break}if(0!==s.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),s.destroy();break}if(0!==s.readBits(4)){console.error("more than 2 numProgram Not Supported"),s.destroy();break}if(0!==s.readBits(3)){console.error("more than 2 numLayer Not Supported"),s.destroy();break}let t=e?this.getLATMValue(s):0,r=s.readBits(5);t-=5;let i=s.readBits(4);t-=4;let n=s.readBits(4);t-=4,s.readBits(3),t-=3,t>0&&s.readBits(t);let a=s.readBits(3);if(0!==a){console.error(`frameLengthType = ${a}. Only frameLengthType = 0 Supported`),s.destroy();break}s.readByte();let d=s.readBool();if(d)if(e)this.getLATMValue(s);else{let e=0;for(;;){e<<=8;let t=s.readBool();if(e+=s.readByte(),!t)break}console.log(e)}s.readBool()&&s.readByte(),o={},o.audio_object_type=r,o.sampling_freq_index=i,o.sampling_frequency=Wt[o.sampling_freq_index],o.channel_config=n,o.other_data_present=d}let a=0;for(;;){let e=s.readByte();if(a+=e,255!==e)break}let d=new Uint8Array(a);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function er(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return;const r=e.length,i=[];let n,s=0;for(;s+t>>=8),s+=t,n){if(s+n>r)break;i.push(e.subarray(s,s+n)),s+=n}return i}function tr(e){const t=e.byteLength,r=new Uint8Array(4);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t;const i=new Uint8Array(t+4);return i.set(r,0),i.set(e,4),i}function rr(e,t){let r=null;return t?e.length>=28&&(r=1+(3&e[26])):e.length>=12&&(r=1+(3&e[9])),r}function ir(){return(new Date).getTime()}function nr(e,t,r){return Math.max(Math.min(e,Math.max(t,r)),Math.min(t,r))}function sr(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function or(e){let t=0,r=sr();return i=>{if(n=i,"[object Number]"!==Object.prototype.toString.call(n))return;var n;t+=i;const s=sr(),o=s-r;o>=1e3&&(e(t/o*1e3),r=s,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();function ar(e){return null==e}function dr(e){return!ar(e)}function lr(e){return"function"==typeof e}function cr(e){let t=null,r=31&e[0];return r!==We&&r!==Ve||(t=ze),t||(r=(126&e[0])>>1,r!==st&&r!==at&&r!==lt||(t=Ne)),t}function ur(){return"undefined"!=typeof WritableStream}function hr(e){e.close()}function fr(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let r=e[0],i=null,n=1;if(e.length>0){let t=e[1];t&&t.ts-r.ts>1e5&&(r=t,n=2)}if(r)for(let s=n;s=1e3){e[s-1].ts-r.ts<1e3&&(i=s+1)}}}return i}function pr(e){return e.ok&&e.status>=200&&e.status<=299}function mr(){return function(e){let t="";if("object"==typeof e)try{t=JSON.stringify(e),t=JSON.parse(t)}catch(r){t=e}else t=e;return t}(B)}function _r(e){return e[0]>>4===kt&&e[1]===Bt}function gr(e){return!0===e||"true"===e}function yr(e){return!0!==e&&"true"!==e}function vr(){return!!(self.Worker&&self.MediaSource&&"canConstructInDedicatedWorker"in self.MediaSource&&!0===self.MediaSource.canConstructInDedicatedWorker)}function br(e,t){const r=er(e.slice(5));let i=!1;return r.forEach((e=>{const r=t?e[0]>>>1&63:31&e[0];(t&&(r===Qe||r===tt||r===it)||yr(t)&&r===je)&&(i=!0)})),i}var wr=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}d((i=i.apply(e,t||[])).next())}))};const Sr=Symbol(32),Er=Symbol(16),Ar=Symbol(8);class xr{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return wr(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,r)=>{var i;this.reject=r,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(i=this.pull)||void 0===i||i.call(this,e)}))}))}readU32(){return this.read(Sr)}readU16(){return this.read(Er)}readU8(){return this.read(Ar)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let r=0;const i=e=>t.length<(r=e);if("number"==typeof this.need){if(i(this.need))return;e=t.subarray(0,r)}else if(this.need===Sr){if(i(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Er){if(i(2))return;e=t[0]<<8|t[1]}else if(this.need===Ar){if(i(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(i(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,r)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(i(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,r)),e=this.need}return this.consumed+=r,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,r=t+e;if(r<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,r);else{const e=new Uint8Array(r);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,r)}return this.buffer=new Uint8Array(e),this.buffer}}xr.U32=Sr,xr.U16=Er,xr.U8=Ar;class Ur{constructor(e){this.log=function(t){if(e._opt.debugLevel==S){const s=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n1?r-1:0),n=1;n1?i-1:0),s=1;s=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseSPS(e){let t=Br._ebsp2rbsp(e),r=new Gt(t);r.readByte();let i=r.readByte();r.readByte();let n=r.readByte();r.readUEG();let s=Br.getProfileString(i),o=Br.getLevelString(n),a=1,d=420,l=[0,420,422,444],c=8;if((100===i||110===i||122===i||244===i||44===i||83===i||86===i||118===i||128===i||138===i||144===i)&&(a=r.readUEG(),3===a&&r.readBits(1),a<=3&&(d=l[a]),c=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool())){let e=3!==a?8:12;for(let t=0;t0&&e<16?(b=t[e-1],w=i[e-1]):255===e&&(b=r.readByte()<<8|r.readByte(),w=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);E=r.readBool(),A=t,x=2*e,S=A/x}}let U=1;1===b&&1===w||(U=b/w);let B=0,k=0;if(0===a)B=1,k=2-m;else{B=3===a?1:2,k=(1===a?2:1)*(2-m)}let T=16*(f+1),C=16*(p+1)*(2-m);T-=(_+g)*B,C-=(y+v)*k;let D=Math.ceil(T*U);return r.destroy(),r=null,{profile_string:s,level_string:o,bit_depth:c,ref_frames:h,chroma_format:d,chroma_format_string:Br.getChromaFormatString(d),frame_rate:{fixed:E,fps:S,fps_den:x,fps_num:A},sar_ratio:{width:b,height:w},codec_size:{width:T,height:C},present_size:{width:D,height:C}}}static parseSPS$2(e){let t=e.subarray(1,4),r="avc1.";for(let e=0;e<3;e++){let i=t[e].toString(16);i.length<2&&(i="0"+i),r+=i}let i=Br._ebsp2rbsp(e),n=new Gt(i);n.readByte();let s=n.readByte();n.readByte();let o=n.readByte();n.readUEG();let a=Br.getProfileString(s),d=Br.getLevelString(o),l=1,c=420,u=[0,420,422,444],h=8,f=8;if((100===s||110===s||122===s||244===s||44===s||83===s||86===s||118===s||128===s||138===s||144===s)&&(l=n.readUEG(),3===l&&n.readBits(1),l<=3&&(c=u[l]),h=n.readUEG()+8,f=n.readUEG()+8,n.readBits(1),n.readBool())){let e=3!==l?8:12;for(let t=0;t0&&e<16?(E=t[e-1],A=r[e-1]):255===e&&(E=n.readByte()<<8|n.readByte(),A=n.readByte()<<8|n.readByte())}if(n.readBool()&&n.readBool(),n.readBool()&&(n.readBits(4),n.readBool()&&n.readBits(24)),n.readBool()&&(n.readUEG(),n.readUEG()),n.readBool()){let e=n.readBits(32),t=n.readBits(32);U=n.readBool(),B=t,k=2*e,x=B/k}}let T=1;1===E&&1===A||(T=E/A);let C=0,D=0;if(0===l)C=1,D=2-y;else{C=3===l?1:2,D=(1===l?2:1)*(2-y)}let P=16*(_+1),F=16*(g+1)*(2-y);P-=(v+b)*C,F-=(w+S)*D;let L=Math.ceil(P*T);return n.destroy(),n=null,{codec_mimetype:r,profile_idc:s,level_idc:o,profile_string:a,level_string:d,chroma_format_idc:l,bit_depth:h,bit_depth_luma:h,bit_depth_chroma:f,ref_frames:m,chroma_format:c,chroma_format_string:Br.getChromaFormatString(c),frame_rate:{fixed:U,fps:x,fps_den:k,fps_num:B},sar_ratio:{width:E,height:A},codec_size:{width:P,height:F},present_size:{width:L,height:F}}}static _skipScalingList(e,t){let r=8,i=8,n=0;for(let s=0;s=this.buflen)return this.iserro=!0,0;this.iserro=!1,r=this.bufoff+e>8?8-this.bufoff:e,t<<=r,t+=this.buffer[this.bufpos]>>8-this.bufoff-r&255>>8-r,this.bufoff+=r,e-=r,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,r=this.bufoff,i=this.read(e);return this.bufpos=t,this.bufoff=r,i}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.sps,4),t.sps=i}if(t.pps){const e=t.pps.byteLength,r=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.pps,4),t.pps=i}return t}function Cr(e){let{sps:t,pps:r}=e;const i=[23,0,0,0,0,1,66,0,30,255];i[0]=23,i[6]=t[1],i[7]=t[2],i[8]=t[3],i[10]=225,i[11]=t.byteLength>>8&255,i[12]=255&t.byteLength,i.push(...t,1,r.byteLength>>8&255,255&r.byteLength,...r);return new Uint8Array(i)}function Dr(e){let{sps:t,pps:r}=e,i=8+t.byteLength+1+2+r.byteLength,n=!1;const s=Br.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(n=!0,i+=4);let o=new Uint8Array(i);o[0]=1,o[1]=t[1],o[2]=t[2],o[3]=t[3],o[4]=255,o[5]=225;let a=t.byteLength;o[6]=a>>>8,o[7]=255&a;let d=8;o.set(t,8),d+=a,o[d]=1;let l=r.byteLength;o[d+1]=l>>>8,o[d+2]=255&l,o.set(r,d+3),d+=3+l,n&&(o[d]=252|s.chroma_format_idc,o[d+1]=248|s.bit_depth_luma-8,o[d+2]=248|s.bit_depth_chroma-8,o[d+3]=0,d+=4);const c=[23,0,0,0,0],u=new Uint8Array(c.length+o.byteLength);return u.set(c,0),u.set(o,c.length),u}function Pr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Fr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Lr(e){return 31&e[0]}function Ir(e){return e===Ke}function Mr(e){return!function(e){return e===We||e===Ve}(e)&&!Ir(e)}function Rr(e){return e===je}function zr(e){if(0===e.length)return!1;const t=Lr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=31&e[r],n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,i>=Je||0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class $r{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Or=e=>{let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)},Gr=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Hr{static _ebsp2rbsp(e){let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseVPS(e){let t=Hr._ebsp2rbsp(e),r=new Gt(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}}static parseSPS(e){let t=Hr._ebsp2rbsp(e),r=new Gt(t);r.readByte(),r.readByte();let i=0,n=0,s=0,o=0;r.readBits(4);let a=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=a;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<=16?(L=t[e-1],I=i[e-1]):255===e&&(L=r.readBits(16),I=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()){r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())}if(r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG()),r.readBool()){if(R=r.readBits(32),z=r.readBits(32),r.readBool()&&r.readUEG(),r.readBool()){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=a;n++){let n=r.readBool();M=n;let s=!0,o=1;n||(s=r.readBool());let a=!1;if(s?r.readUEG():a=r.readBool(),a||(o=r.readUEG()+1),e){for(let e=0;e>6&3,r.general_tier_flag=e[1]>>5&1,r.general_profile_idc=31&e[1],r.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],r.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],r.general_constraint_indicator_flags=r.general_constraint_indicator_flags<<16|e[10]<<8|e[11],r.general_level_idc=e[12],r.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],r.parallelismType=3&e[15],r.chromaFormat=3&e[16],r.bitDepthLumaMinus8=7&e[17],r.bitDepthChromaMinus8=7&e[18],r.avgFrameRate=e[19]<<8|e[20],r.constantFrameRate=e[21]>>6&3,r.numTemporalLayers=e[21]>>3&7,r.temporalIdNested=e[21]>>2&1,r.lengthSizeMinusOne=3&e[21];let i=e[22],n=e.slice(23);for(let e=0;e0)for(let t=r;t<8;t++)e.read(2);i.sub_layer_profile_space=[],i.sub_layer_tier_flag=[],i.sub_layer_profile_idc=[],i.sub_layer_profile_compatibility_flag=[],i.sub_layer_progressive_source_flag=[],i.sub_layer_interlaced_source_flag=[],i.sub_layer_non_packed_constraint_flag=[],i.sub_layer_frame_only_constraint_flag=[],i.sub_layer_level_idc=[];for(let t=0;t{let t=Or(e),r=new Gt(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}})(t),o=(e=>{let t=Or(e),r=new Gt(t);r.readByte(),r.readByte();let i=0,n=0,s=0,o=0;r.readBits(4);let a=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=a;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<16?(L=t[e-1],I=i[e-1]):255===e&&(L=r.readBits(16),I=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(i+=r.readUEG(),n+=r.readUEG(),s+=r.readUEG(),o+=r.readUEG()),r.readBool()&&(R=r.readBits(32),z=r.readBits(32),r.readBool()&&(r.readUEG(),r.readBool()))){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=a;n++){let n=r.readBool();M=n;let s=!1,o=1;n||(s=r.readBool());let a=!1;if(s?r.readSEG():a=r.readBool(),a||(cpbcnt=r.readUEG()+1),e)for(let e=0;e{let t=Or(e),r=new Gt(t);r.readByte(),r.readByte(),r.readUEG(),r.readUEG(),r.readBool(),r.readBool(),r.readBits(3),r.readBool(),r.readBool(),r.readUEG(),r.readUEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool()&&r.readUEG(),r.readSEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool(),r.readBool();let i=r.readBool(),n=r.readBool(),s=1;return n&&i?s=0:n?s=3:i&&(s=2),{parallelismType:s}})(r);n=Object.assign(n,s,o,a);let d=23+(5+t.byteLength)+(5+i.byteLength)+(5+r.byteLength),l=new Uint8Array(d);l[0]=1,l[1]=(3&n.general_profile_space)<<6|(n.general_tier_flag?1:0)<<5|31&n.general_profile_idc,l[2]=n.general_profile_compatibility_flags_1||0,l[3]=n.general_profile_compatibility_flags_2||0,l[4]=n.general_profile_compatibility_flags_3||0,l[5]=n.general_profile_compatibility_flags_4||0,l[6]=n.general_constraint_indicator_flags_1||0,l[7]=n.general_constraint_indicator_flags_2||0,l[8]=n.general_constraint_indicator_flags_3||0,l[9]=n.general_constraint_indicator_flags_4||0,l[10]=n.general_constraint_indicator_flags_5||0,l[11]=n.general_constraint_indicator_flags_6||0,l[12]=60,l[13]=240|(3840&n.min_spatial_segmentation_idc)>>8,l[14]=255&n.min_spatial_segmentation_idc,l[15]=252|3&n.parallelismType,l[16]=252|3&n.chroma_format_idc,l[17]=248|7&n.bit_depth_luma_minus8,l[18]=248|7&n.bit_depth_chroma_minus8,l[19]=0,l[20]=0,l[21]=(3&n.constant_frame_rate)<<6|(7&n.num_temporal_layers)<<3|(n.temporal_id_nested?1:0)<<2|3,l[22]=3,l[23]=128|st,l[24]=0,l[25]=1,l[26]=(65280&t.byteLength)>>8,l[27]=(255&t.byteLength)>>0,l.set(t,28),l[23+(5+t.byteLength)+0]=128|at,l[23+(5+t.byteLength)+1]=0,l[23+(5+t.byteLength)+2]=1,l[23+(5+t.byteLength)+3]=(65280&i.byteLength)>>8,l[23+(5+t.byteLength)+4]=(255&i.byteLength)>>0,l.set(i,23+(5+t.byteLength)+5),l[23+(5+t.byteLength+5+i.byteLength)+0]=128|lt,l[23+(5+t.byteLength+5+i.byteLength)+1]=0,l[23+(5+t.byteLength+5+i.byteLength)+2]=1,l[23+(5+t.byteLength+5+i.byteLength)+3]=(65280&r.byteLength)>>8,l[23+(5+t.byteLength+5+i.byteLength)+4]=(255&r.byteLength)>>0,l.set(r,23+(5+t.byteLength+5+i.byteLength)+5);const c=[28,0,0,0,0],u=new Uint8Array(c.length+l.byteLength);return u.set(c,0),u.set(l,c.length),u}function Yr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Kr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Xr(e){return(126&e[0])>>1}function Zr(e){return e===ut}function Jr(e){return!function(e){return e>=32&&e<=40}(e)}function Qr(e){return e>=16&&e<=21}function ei(e){if(0===e.length)return!1;const t=Xr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=e[r]>>1&63,n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class ri{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}function ii(e){return parseInt(e)===e}function ni(e){if(!ii(e.length))return!1;for(var t=0;t255)return!1;return!0}function si(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!ni(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(ii(e.length)&&ni(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function oi(e){return new Uint8Array(e)}function ai(e,t,r,i,n){null==i&&null==n||(e=e.slice?e.slice(i,n):Array.prototype.slice.call(e,i,n)),t.set(e,r)}var di,li={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},ci=(di="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r>4]+di[15&i])}return t.join("")}}),ui={16:10,24:12,32:14},hi=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],fi=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],pi=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],mi=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],_i=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],gi=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],yi=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],vi=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],bi=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],wi=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Si=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Ei=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Ai=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],xi=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Ui=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Bi(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=s[t],this._Kd[e-r][t%4]=s[t];for(var o,a=0,d=n;d>16&255]<<24^fi[o>>8&255]<<16^fi[255&o]<<8^fi[o>>24&255]^hi[a]<<24,a+=1,8!=n)for(t=1;t>8&255]<<8^fi[o>>16&255]<<16^fi[o>>24&255]<<24;for(t=n/2+1;t>2,c=d%4,this._Ke[l][c]=s[t],this._Kd[e-l][c]=s[t++],d++}for(var l=1;l>24&255]^Ai[o>>16&255]^xi[o>>8&255]^Ui[255&o]},ki.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=Bi(e),n=0;n<4;n++)i[n]^=this._Ke[0][n];for(var s=1;s>24&255]^_i[i[(n+1)%4]>>16&255]^gi[i[(n+2)%4]>>8&255]^yi[255&i[(n+3)%4]]^this._Ke[s][n];i=r.slice()}var o,a=oi(16);for(n=0;n<4;n++)o=this._Ke[t][n],a[4*n]=255&(fi[i[n]>>24&255]^o>>24),a[4*n+1]=255&(fi[i[(n+1)%4]>>16&255]^o>>16),a[4*n+2]=255&(fi[i[(n+2)%4]>>8&255]^o>>8),a[4*n+3]=255&(fi[255&i[(n+3)%4]]^o);return a},ki.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=Bi(e),n=0;n<4;n++)i[n]^=this._Kd[0][n];for(var s=1;s>24&255]^bi[i[(n+3)%4]>>16&255]^wi[i[(n+2)%4]>>8&255]^Si[255&i[(n+1)%4]]^this._Kd[s][n];i=r.slice()}var o,a=oi(16);for(n=0;n<4;n++)o=this._Kd[t][n],a[4*n]=255&(pi[i[n]>>24&255]^o>>24),a[4*n+1]=255&(pi[i[(n+3)%4]>>16&255]^o>>16),a[4*n+2]=255&(pi[i[(n+2)%4]>>8&255]^o>>8),a[4*n+3]=255&(pi[255&i[(n+1)%4]]^o);return a};var Ti=function(e){if(!(this instanceof Ti))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new ki(e)};Ti.prototype.encrypt=function(e){if((e=si(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=oi(e.length),r=oi(16),i=0;iNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},Fi.prototype.setBytes=function(e){if(16!=(e=si(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Fi.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var Li=function(e,t){if(!(this instanceof Li))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Fi||(t=new Fi(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new ki(e)};Li.prototype.encrypt=function(e){for(var t=si(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,i=0;i>>2]>>>24-s%4*8&255;t[i+s>>>2]|=o<<24-(i+s)%4*8}else for(var a=0;a>>2]=r[a>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-n%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new l.init(r,t/2)}},h=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new l.init(r,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=a.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,n=i.words,s=i.sigBytes,o=this.blockSize,a=s/(4*o),d=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,c=e.min(4*d,s);if(d){for(var u=0;u>>2]|=e[n]<<24-n%4*8;t.call(this,i,r)}else t.apply(this,arguments)};i.prototype=e}}(),r.lib.WordArray)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.WordArray,i=e.enc;function n(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var r=e.length,i=[],n=0;n>>1]|=e.charCodeAt(n)<<16-n%2*16;return t.create(i,2*r)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s>>2]>>>16-s%4*8&65535);i.push(String.fromCharCode(o))}return i.join("")},parse:function(e){for(var r=e.length,i=[],s=0;s>>1]|=n(e.charCodeAt(s)<<16-s%2*16);return t.create(i,2*r)}}}(),r.enc.Utf16)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.WordArray;function i(e,r,i){for(var n=[],s=0,o=0;o>>6-o%4*2;n[s>>>2]|=a<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var n=[],s=0;s>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,a=0;a<4&&s+.75*a>>6*(3-a)&63));var d=i.charAt(64);if(d)for(;n.length%4;)n.push(d);return n.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var s=0;s>>6-o%4*2;n[s>>>2]|=a<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,n=t?this._safe_map:this._map;e.clamp();for(var s=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(r[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|r[o+2>>>2]>>>24-(o+2)%4*8&255,d=0;d<4&&o+.75*d>>6*(3-d)&63));var l=n.charAt(64);if(l)for(;s.length%4;)s.push(l);return s.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,n=t?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var o=0;o>>24)|4278255360&(n<<24|n>>>8)}var s=this._hash.words,o=e[t+0],d=e[t+1],f=e[t+2],p=e[t+3],m=e[t+4],_=e[t+5],g=e[t+6],y=e[t+7],v=e[t+8],b=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],A=e[t+13],x=e[t+14],U=e[t+15],B=s[0],k=s[1],T=s[2],C=s[3];B=l(B,k,T,C,o,7,a[0]),C=l(C,B,k,T,d,12,a[1]),T=l(T,C,B,k,f,17,a[2]),k=l(k,T,C,B,p,22,a[3]),B=l(B,k,T,C,m,7,a[4]),C=l(C,B,k,T,_,12,a[5]),T=l(T,C,B,k,g,17,a[6]),k=l(k,T,C,B,y,22,a[7]),B=l(B,k,T,C,v,7,a[8]),C=l(C,B,k,T,b,12,a[9]),T=l(T,C,B,k,w,17,a[10]),k=l(k,T,C,B,S,22,a[11]),B=l(B,k,T,C,E,7,a[12]),C=l(C,B,k,T,A,12,a[13]),T=l(T,C,B,k,x,17,a[14]),B=c(B,k=l(k,T,C,B,U,22,a[15]),T,C,d,5,a[16]),C=c(C,B,k,T,g,9,a[17]),T=c(T,C,B,k,S,14,a[18]),k=c(k,T,C,B,o,20,a[19]),B=c(B,k,T,C,_,5,a[20]),C=c(C,B,k,T,w,9,a[21]),T=c(T,C,B,k,U,14,a[22]),k=c(k,T,C,B,m,20,a[23]),B=c(B,k,T,C,b,5,a[24]),C=c(C,B,k,T,x,9,a[25]),T=c(T,C,B,k,p,14,a[26]),k=c(k,T,C,B,v,20,a[27]),B=c(B,k,T,C,A,5,a[28]),C=c(C,B,k,T,f,9,a[29]),T=c(T,C,B,k,y,14,a[30]),B=u(B,k=c(k,T,C,B,E,20,a[31]),T,C,_,4,a[32]),C=u(C,B,k,T,v,11,a[33]),T=u(T,C,B,k,S,16,a[34]),k=u(k,T,C,B,x,23,a[35]),B=u(B,k,T,C,d,4,a[36]),C=u(C,B,k,T,m,11,a[37]),T=u(T,C,B,k,y,16,a[38]),k=u(k,T,C,B,w,23,a[39]),B=u(B,k,T,C,A,4,a[40]),C=u(C,B,k,T,o,11,a[41]),T=u(T,C,B,k,p,16,a[42]),k=u(k,T,C,B,g,23,a[43]),B=u(B,k,T,C,b,4,a[44]),C=u(C,B,k,T,E,11,a[45]),T=u(T,C,B,k,U,16,a[46]),B=h(B,k=u(k,T,C,B,f,23,a[47]),T,C,o,6,a[48]),C=h(C,B,k,T,y,10,a[49]),T=h(T,C,B,k,x,15,a[50]),k=h(k,T,C,B,_,21,a[51]),B=h(B,k,T,C,E,6,a[52]),C=h(C,B,k,T,p,10,a[53]),T=h(T,C,B,k,w,15,a[54]),k=h(k,T,C,B,d,21,a[55]),B=h(B,k,T,C,v,6,a[56]),C=h(C,B,k,T,U,10,a[57]),T=h(T,C,B,k,g,15,a[58]),k=h(k,T,C,B,A,21,a[59]),B=h(B,k,T,C,m,6,a[60]),C=h(C,B,k,T,S,10,a[61]),T=h(T,C,B,k,f,15,a[62]),k=h(k,T,C,B,b,21,a[63]),s[0]=s[0]+B|0,s[1]=s[1]+k|0,s[2]=s[2]+T|0,s[3]=s[3]+C|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;r[n>>>5]|=128<<24-n%32;var s=e.floor(i/4294967296),o=i;r[15+(n+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(n+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,d=a.words,l=0;l<4;l++){var c=d[l];d[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return a},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,i,n,s,o){var a=e+(t&r|~t&i)+n+o;return(a<>>32-s)+t}function c(e,t,r,i,n,s,o){var a=e+(t&i|r&~i)+n+o;return(a<>>32-s)+t}function u(e,t,r,i,n,s,o){var a=e+(t^r^i)+n+o;return(a<>>32-s)+t}function h(e,t,r,i,n,s,o){var a=e+(r^(t|~i))+n+o;return(a<>>32-s)+t}t.MD5=s._createHelper(d),t.HmacMD5=s._createHmacHelper(d)}(Math),r.MD5)})),Ot((function(e,t){var r,i,n,s,o,a,d,l;e.exports=(i=(r=l=Mi).lib,n=i.WordArray,s=i.Hasher,o=r.algo,a=[],d=o.SHA1=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],d=r[4],l=0;l<80;l++){if(l<16)a[l]=0|e[t+l];else{var c=a[l-3]^a[l-8]^a[l-14]^a[l-16];a[l]=c<<1|c>>>31}var u=(i<<5|i>>>27)+d+a[l];u+=l<20?1518500249+(n&s|~n&o):l<40?1859775393+(n^s^o):l<60?(n&s|n&o|s&o)-1894007588:(n^s^o)-899497514,d=o,o=s,s=n<<30|n>>>2,n=i,i=u}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+d|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=s._createHelper(d),r.HmacSHA1=s._createHmacHelper(d),l.SHA1)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,o=t.algo,a=[],d=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,n=0;n<64;)t(i)&&(n<8&&(a[n]=r(e.pow(i,.5))),d[n]=r(e.pow(i,1/3)),n++),i++}();var l=[],c=o.SHA256=s.extend({_doReset:function(){this._hash=new n.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],a=r[4],c=r[5],u=r[6],h=r[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,_=l[f-2],g=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;l[f]=m+l[f-7]+g+l[f-16]}var y=i&n^i&s^n&s,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&c^~a&u)+d[f]+l[f];h=u,u=c,c=a,a=o+b|0,o=s,s=n,n=i,i=b+(v+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+a|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=s._createHelper(c),t.HmacSHA256=s._createHmacHelper(c)}(Math),r.SHA256)})),Ot((function(e,t){var r,i,n,s,o,a;e.exports=(i=(r=a=Mi).lib.WordArray,n=r.algo,s=n.SHA256,o=n.SHA224=s.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=s._createHelper(o),r.HmacSHA224=s._createHmacHelper(o),a.SHA224)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.Hasher,i=e.x64,n=i.Word,s=i.WordArray,o=e.algo;function a(){return n.create.apply(n,arguments)}var d=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=a()}();var c=o.SHA512=t.extend({_doReset:function(){this._hash=new s.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],a=r[4],c=r[5],u=r[6],h=r[7],f=i.high,p=i.low,m=n.high,_=n.low,g=s.high,y=s.low,v=o.high,b=o.low,w=a.high,S=a.low,E=c.high,A=c.low,x=u.high,U=u.low,B=h.high,k=h.low,T=f,C=p,D=m,P=_,F=g,L=y,I=v,M=b,R=w,z=S,N=E,$=A,O=x,G=U,H=B,W=k,V=0;V<80;V++){var j,q,Y=l[V];if(V<16)q=Y.high=0|e[t+2*V],j=Y.low=0|e[t+2*V+1];else{var K=l[V-15],X=K.high,Z=K.low,J=(X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7,Q=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),ee=l[V-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ne=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),se=l[V-7],oe=se.high,ae=se.low,de=l[V-16],le=de.high,ce=de.low;q=(q=(q=J+oe+((j=Q+ae)>>>0>>0?1:0))+ie+((j+=ne)>>>0>>0?1:0))+le+((j+=ce)>>>0>>0?1:0),Y.high=q,Y.low=j}var ue,he=R&N^~R&O,fe=z&$^~z&G,pe=T&D^T&F^D&F,me=C&P^C&L^P&L,_e=(T>>>28|C<<4)^(T<<30|C>>>2)^(T<<25|C>>>7),ge=(C>>>28|T<<4)^(C<<30|T>>>2)^(C<<25|T>>>7),ye=(R>>>14|z<<18)^(R>>>18|z<<14)^(R<<23|z>>>9),ve=(z>>>14|R<<18)^(z>>>18|R<<14)^(z<<23|R>>>9),be=d[V],we=be.high,Se=be.low,Ee=H+ye+((ue=W+ve)>>>0>>0?1:0),Ae=ge+me;H=O,W=G,O=N,G=$,N=R,$=z,R=I+(Ee=(Ee=(Ee=Ee+he+((ue+=fe)>>>0>>0?1:0))+we+((ue+=Se)>>>0>>0?1:0))+q+((ue+=j)>>>0>>0?1:0))+((z=M+ue|0)>>>0>>0?1:0)|0,I=F,M=L,F=D,L=P,D=T,P=C,T=Ee+(_e+pe+(Ae>>>0>>0?1:0))+((C=ue+Ae|0)>>>0>>0?1:0)|0}p=i.low=p+C,i.high=f+T+(p>>>0>>0?1:0),_=n.low=_+P,n.high=m+D+(_>>>0

>>0?1:0),y=s.low=y+L,s.high=g+F+(y>>>0>>0?1:0),b=o.low=b+M,o.high=v+I+(b>>>0>>0?1:0),S=a.low=S+z,a.high=w+R+(S>>>0>>0?1:0),A=c.low=A+$,c.high=E+N+(A>>>0<$>>>0?1:0),U=u.low=U+G,u.high=x+O+(U>>>0>>0?1:0),k=h.low=k+W,h.high=B+H+(k>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(c),e.HmacSHA512=t._createHmacHelper(c)}(),r.SHA512)})),Ot((function(e,t){var r,i,n,s,o,a,d,l;e.exports=(i=(r=l=Mi).x64,n=i.Word,s=i.WordArray,o=r.algo,a=o.SHA512,d=o.SHA384=a.extend({_doReset:function(){this._hash=new s.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=a._createHelper(d),r.HmacSHA384=a._createHmacHelper(d),l.SHA384)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,o=t.x64.Word,a=t.algo,d=[],l=[],c=[];!function(){for(var e=1,t=0,r=0;r<24;r++){d[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var n=1,s=0;s<24;s++){for(var a=0,u=0,h=0;h<7;h++){if(1&n){var f=(1<>>24)|4278255360&(s<<24|s>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(k=r[n]).high^=o,k.low^=s}for(var a=0;a<24;a++){for(var h=0;h<5;h++){for(var f=0,p=0,m=0;m<5;m++)f^=(k=r[h+5*m]).high,p^=k.low;var _=u[h];_.high=f,_.low=p}for(h=0;h<5;h++){var g=u[(h+4)%5],y=u[(h+1)%5],v=y.high,b=y.low;for(f=g.high^(v<<1|b>>>31),p=g.low^(b<<1|v>>>31),m=0;m<5;m++)(k=r[h+5*m]).high^=f,k.low^=p}for(var w=1;w<25;w++){var S=(k=r[w]).high,E=k.low,A=d[w];A<32?(f=S<>>32-A,p=E<>>32-A):(f=E<>>64-A,p=S<>>64-A);var x=u[l[w]];x.high=f,x.low=p}var U=u[0],B=r[0];for(U.high=B.high,U.low=B.low,h=0;h<5;h++)for(m=0;m<5;m++){var k=r[w=h+5*m],T=u[w],C=u[(h+1)%5+5*m],D=u[(h+2)%5+5*m];k.high=T.high^~C.high&D.high,k.low=T.low^~C.low&D.low}k=r[0];var P=c[a];k.high^=P.high,k.low^=P.low}},_doFinalize:function(){var t=this._data,r=t.words;this._nDataBytes;var i=8*t.sigBytes,s=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/s)*s>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var o=this._state,a=this.cfg.outputLength/8,d=a/8,l=[],c=0;c>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(h)}return new n.init(l,a)},clone:function(){for(var e=s.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=s._createHelper(h),t.HmacSHA3=s._createHmacHelper(h)}(Math),r.SHA3)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,o=t.algo,a=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=n.create([0,1518500249,1859775393,2400959708,2840853838]),h=n.create([1352829926,1548603684,1836072691,2053994217,0]),f=o.RIPEMD160=s.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s,o,f,b,w,S,E,A,x,U,B,k=this._hash.words,T=u.words,C=h.words,D=a.words,P=d.words,F=l.words,L=c.words;for(S=s=k[0],E=o=k[1],A=f=k[2],x=b=k[3],U=w=k[4],r=0;r<80;r+=1)B=s+e[t+D[r]]|0,B+=r<16?p(o,f,b)+T[0]:r<32?m(o,f,b)+T[1]:r<48?_(o,f,b)+T[2]:r<64?g(o,f,b)+T[3]:y(o,f,b)+T[4],B=(B=v(B|=0,F[r]))+w|0,s=w,w=b,b=v(f,10),f=o,o=B,B=S+e[t+P[r]]|0,B+=r<16?y(E,A,x)+C[0]:r<32?g(E,A,x)+C[1]:r<48?_(E,A,x)+C[2]:r<64?m(E,A,x)+C[3]:p(E,A,x)+C[4],B=(B=v(B|=0,L[r]))+U|0,S=U,U=x,x=v(A,10),A=E,E=B;B=k[1]+f+x|0,k[1]=k[2]+b+U|0,k[2]=k[3]+w+S|0,k[3]=k[4]+s+E|0,k[4]=k[0]+o+A|0,k[0]=B},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var n=this._hash,s=n.words,o=0;o<5;o++){var a=s[o];s[o]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return n},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function m(e,t,r){return e&t|~e&r}function _(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function v(e,t){return e<>>32-t}t.RIPEMD160=s._createHelper(f),t.HmacRIPEMD160=s._createHmacHelper(f)}(),r.RIPEMD160)})),Ot((function(e,t){var r,i,n;e.exports=(i=(r=Mi).lib.Base,n=r.enc.Utf8,void(r.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),o=this._iKey=t.clone(),a=s.words,d=o.words,l=0;l>>2];e.sigBytes-=t}};i.BlockCipher=c.extend({cfg:c.cfg.extend({mode:f,padding:p}),reset:function(){var e;c.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=i.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?s.create([1398893684,1701076831]).concat(r).concat(t):t).toString(d)},parse:function(e){var t,r=d.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=s.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),m.create({ciphertext:r,salt:t})}},g=i.SerializableCipher=n.extend({cfg:n.extend({format:_}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),s=n.finalize(t),o=n.cfg;return m.create({ciphertext:s,key:r,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,i,n){if(i||(i=s.random(8)),n)o=l.create({keySize:t+r,hasher:n}).compute(e,i);else var o=l.create({keySize:t+r}).compute(e,i);var a=s.create(o.words.slice(t),4*r);return o.sigBytes=4*t,m.create({key:o,iv:a,salt:i})}},v=i.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=n.iv;var s=g.encrypt.call(this,e,t,n.key,i);return s.mixIn(n),s},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=n.iv,g.decrypt.call(this,e,t,n.key,i)}})}())})),Ot((function(e,t){var r;e.exports=((r=Mi).mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,i){var n,s=this._iv;s?(n=s.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var o=0;o>24&255)){var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}else e+=1<<24;return e}function i(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var n=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,s=this._iv,o=this._counter;s&&(o=this._counter=s.slice(0),this._iv=void 0),i(o);var a=o.slice(0);r.encryptBlock(a,0);for(var d=0;d>>2]|=n<<24-s%4*8,e.sigBytes+=n},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),Ot((function(e,t){var r;e.exports=((r=Mi).pad.Iso10126={pad:function(e,t){var i=4*t,n=i-e.sigBytes%i;e.concat(r.lib.WordArray.random(n-1)).concat(r.lib.WordArray.create([n<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),Ot((function(e,t){var r;e.exports=((r=Mi).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),Ot((function(e,t){var r;e.exports=((r=Mi).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)})),Ot((function(e,t){var r;e.exports=((r=Mi).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib.CipherParams,n=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return i.create({ciphertext:t})}}}(),r.format.Hex)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.BlockCipher,i=e.algo,n=[],s=[],o=[],a=[],d=[],l=[],c=[],u=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,n[r]=p,s[p]=r;var m=e[r],_=e[m],g=e[_],y=257*e[p]^16843008*p;o[r]=y<<24|y>>>8,a[r]=y<<16|y>>>16,d[r]=y<<8|y>>>24,l[r]=y,y=16843009*g^65537*_^257*m^16843008*r,c[p]=y<<24|y>>>8,u[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,r?(r=m^e[e[e[g^m]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=i.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),s=this._keySchedule=[],o=0;o6&&o%r==4&&(l=n[l>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l]):(l=n[(l=l<<8|l>>>24)>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l],l^=p[o/r|0]<<24),s[o]=s[o-r]^l);for(var a=this._invKeySchedule=[],d=0;d>>24]]^u[n[l>>>16&255]]^h[n[l>>>8&255]]^f[n[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,a,d,l,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,c,u,h,f,s),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,s,o,a){for(var d=this._nRounds,l=e[t]^r[0],c=e[t+1]^r[1],u=e[t+2]^r[2],h=e[t+3]^r[3],f=4,p=1;p>>24]^n[c>>>16&255]^s[u>>>8&255]^o[255&h]^r[f++],_=i[c>>>24]^n[u>>>16&255]^s[h>>>8&255]^o[255&l]^r[f++],g=i[u>>>24]^n[h>>>16&255]^s[l>>>8&255]^o[255&c]^r[f++],y=i[h>>>24]^n[l>>>16&255]^s[c>>>8&255]^o[255&u]^r[f++];l=m,c=_,u=g,h=y}m=(a[l>>>24]<<24|a[c>>>16&255]<<16|a[u>>>8&255]<<8|a[255&h])^r[f++],_=(a[c>>>24]<<24|a[u>>>16&255]<<16|a[h>>>8&255]<<8|a[255&l])^r[f++],g=(a[u>>>24]<<24|a[h>>>16&255]<<16|a[l>>>8&255]<<8|a[255&c])^r[f++],y=(a[h>>>24]<<24|a[l>>>16&255]<<16|a[c>>>8&255]<<8|a[255&u])^r[f++],e[t]=m,e[t+1]=_,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(m)}(),r.AES)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib,i=t.WordArray,n=t.BlockCipher,s=e.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=s.DES=n.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=o[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],s=0;s<16;s++){var l=n[s]=[],c=d[s];for(r=0;r<24;r++)l[r/6|0]|=t[(a[r]-1+c)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(a[r+24]-1+c)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var u=this._invSubKeys=[];for(r=0;r<16;r++)u[r]=n[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],s=this._lBlock,o=this._rBlock,a=0,d=0;d<8;d++)a|=l[d][((o^n[d])&c[d])>>>0];this._lBlock=o,this._rBlock=s^a}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),n=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(i.create(t)),this._des2=u.createEncryptor(i.create(r)),this._des3=u.createEncryptor(i.create(n))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=n._createHelper(p)}(),r.TripleDES)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=i.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var s=0;n<256;n++){var o=n%r,a=t[o>>>2]>>>24-o%4*8&255;s=(s+i[n]+a)%256;var d=i[n];i[n]=i[s],i[s]=d}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var e=this._S,t=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[r],e[r]=s,i|=e[(e[t]+e[r])%256]<<24-8*n}return this._i=t,this._j=r,i}e.RC4=t._createHelper(n);var o=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)s.call(this)}});e.RC4Drop=t._createHelper(o)}(),r.RC4)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],o=[],a=i.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)d.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(t){var s=t.words,o=s[0],a=s[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(n[0]^=l,n[1]^=u,n[2]^=c,n[3]^=h,n[4]^=l,n[5]^=u,n[6]^=c,n[7]^=h,r=0;r<4;r++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,a=i>>>16,d=((n*n>>>17)+n*a>>>15)+a*a,l=((4294901760&i)*i|0)+((65535&i)*i|0);o[r]=d^l}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=t._createHelper(a)}(),r.Rabbit)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],o=[],a=i.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var n=0;n<4;n++)d.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var s=t.words,o=s[0],a=s[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(i[0]^=l,i[1]^=u,i[2]^=c,i[3]^=h,i[4]^=l,i[5]^=u,i[6]^=c,i[7]^=h,n=0;n<4;n++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,a=i>>>16,d=((n*n>>>17)+n*a>>>15)+a*a,l=((4294901760&i)*i|0)+((65535&i)*i|0);o[r]=d^l}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=t._createHelper(a)}(),r.RabbitLegacy)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.BlockCipher,i=e.algo;const n=16,s=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],o=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var a={pbox:[],sbox:[]};function d(e,t){let r=t>>24&255,i=t>>16&255,n=t>>8&255,s=255&t,o=e.sbox[0][r]+e.sbox[1][i];return o^=e.sbox[2][n],o+=e.sbox[3][s],o}function l(e,t,r){let i,s=t,o=r;for(let t=0;t1;--t)s^=e.pbox[t],o=d(e,s)^o,i=s,s=o,o=i;return i=s,s=o,o=i,o^=e.pbox[1],s^=e.pbox[0],{left:s,right:o}}function u(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=o[t][r]}let i=0;for(let o=0;o=r&&(i=0);let a=0,d=0,c=0;for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),r=new Uint8Array(r);const n=e.byteLength;let s=5;for(;sn)break;let a=e[s+4],d=!1;if(i?(a=a>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(a)):(a&=31,d=1===a||5===a),d){const i=e.slice(s+4+2,s+4+o);let n=new Ii.ModeOfOperation.ctr(t,new Ii.Counter(r));const a=n.decrypt(i);n=null,e.set(a,s+4+2)}s=s+4+o}return e}function Ni(e,t,r){if(e.byteLength<=30)return e;const i=e.slice(32);let n=new Ii.ModeOfOperation.ctr(t,new Ii.Counter(r));const s=n.decrypt(i);return n=null,e.set(s,32),e}Ot((function(e,t){e.exports=Mi}));var $i=Ot((function(e,t){var r,n,s,o=(r=new Date,n=4,s={setLogLevel:function(e){n=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=n&&console.debug("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=n&&console.info("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=n&&console.warn("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=n&&console.error("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}},s);o.getDurationString=function(e,t){var r;function i(e,t){for(var r=(""+e).split(".");r[0].length0){for(var r="",i=0;i0&&(r+=","),r+="["+o.getDurationString(e.start(i))+","+o.getDurationString(e.end(i))+"]";return r}return"(empty)"},t.Log=o;var a=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};a.prototype.getPosition=function(){return this.position},a.prototype.getEndPosition=function(){return this.buffer.byteLength},a.prototype.getLength=function(){return this.buffer.byteLength},a.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},a.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},a.prototype.readAnyInt=function(e,t){var r=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:r=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:r=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";r=this.dataview.getUint8(this.position)<<16,r|=this.dataview.getUint8(this.position+1)<<8,r|=this.dataview.getUint8(this.position+2);break;case 4:r=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";r=this.dataview.getUint32(this.position)<<32,r|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,r}throw"Not enough bytes in buffer"},a.prototype.readUint8=function(){return this.readAnyInt(1,!1)},a.prototype.readUint16=function(){return this.readAnyInt(2,!1)},a.prototype.readUint24=function(){return this.readAnyInt(3,!1)},a.prototype.readUint32=function(){return this.readAnyInt(4,!1)},a.prototype.readUint64=function(){return this.readAnyInt(8,!1)},a.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",r=0;rthis._byteLength&&(this._byteLength=t);else{for(r<1&&(r=1);t>r;)r*=2;var i=new ArrayBuffer(r),n=new Uint8Array(this._buffer);new Uint8Array(i,0,n.length).set(n),this.buffer=i,this._byteLength=t}}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),r=new Uint8Array(this._buffer,0,t.length);t.set(r),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Int32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Int16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Uint32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Uint16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var r=new Float64Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Float32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,r,i,n){var s=new Uint8Array(e,t,n),o=new Uint8Array(r,i,n);s.set(o)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=0;rn;i--,n++){var s=t[n];t[n]=t[i],t[i]=s}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],r=0;r>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},d.prototype.adjustUint32=function(e,t){var r=this.position;this.seek(e),this.writeUint32(t),this.seek(r)},d.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var r=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var r=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var r=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var r=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var r=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=8*e,r},d.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var r=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r};var c=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(c.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,o.debug("MultiBufferStream","Stream ready for parsing"),!0):(o.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(o.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){o.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r.buffer},c.prototype.reduceBuffer=function(e,t,r){var i;return(i=new Uint8Array(r)).set(new Uint8Array(e,t,r)),i.buffer.fileStart=e.fileStart+t,i.buffer.usedBytes=0,i.buffer},c.prototype.insertBuffer=function(e){for(var t=!0,r=0;ri.byteLength){this.buffers.splice(r,1),r--;continue}o.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=i.fileStart||(e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)),o.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(r,0,e),0===r&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,n,s)}}t&&(o.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===r&&(this.buffer=e))},c.prototype.logBufferLevel=function(e){var t,r,i,n,s,a=[],d="";for(i=0,n=0,t=0;t0&&(d+=s.end-1+"]");var l=e?o.info:o.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+i+"/"+n+" bytes), continuous ranges: "+d)},c.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},c.prototype.findPosition=function(e,t,r){var i,n=null,s=-1;for(i=!0===e?0:this.bufferIndex;i=t?(o.debug("MultiBufferStream","Found position in existing buffer #"+s),s):-1},c.prototype.findEndContiguousBuf=function(e){var t,r,i,n=void 0!==e?e:this.bufferIndex;if(r=this.buffers[n],this.buffers.length>n+1)for(t=n+1;t>3;return 31===i&&r.data.length>=2&&(i=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),i}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};t.MPEG4DescriptorParser=u;var h={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){h.FullBox.prototype=new h.Box,h.ContainerBox.prototype=new h.Box,h.SampleEntry.prototype=new h.Box,h.TrackGroupTypeBox.prototype=new h.FullBox,h.BASIC_BOXES.forEach((function(e){h.createBoxCtor(e)})),h.FULL_BOXES.forEach((function(e){h.createFullBoxCtor(e)})),h.CONTAINER_BOXES.forEach((function(e){h.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,r){this.type=e,this.size=t,this.uuid=r},FullBox:function(e,t,r){h.Box.call(this,e,t,r),this.flags=0,this.version=0},ContainerBox:function(e,t,r){h.Box.call(this,e,t,r),this.boxes=[]},SampleEntry:function(e,t,r,i){h.ContainerBox.call(this,e,t),this.hdr_size=r,this.start=i},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){h.FullBox.call(this,e,t)},createBoxCtor:function(e,t){h.boxCodes.push(e),h[e+"Box"]=function(t){h.Box.call(this,e,t)},h[e+"Box"].prototype=new h.Box,t&&(h[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){h[e+"Box"]=function(t){h.FullBox.call(this,e,t)},h[e+"Box"].prototype=new h.FullBox,h[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,r=0;rr?(o.error("BoxParser","Box of type '"+c+"' has a size "+l+" greater than its container size "+r),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:a}):0!==l&&a+l>e.getEndPosition()?(e.seek(a),o.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:a}):t?{code:h.OK,type:c,size:l,hdr_size:d,start:a}:(h[c+"Box"]?i=new h[c+"Box"](l):"uuid"!==c?(o.warn("BoxParser","Unknown box type: '"+c+"'"),(i=new h.Box(c,l)).has_unparsed_data=!0):h.UUIDBoxes[s]?i=new h.UUIDBoxes[s](l):(o.warn("BoxParser","Unknown uuid type: '"+s+"'"),(i=new h.Box(c,l)).uuid=s,i.has_unparsed_data=!0),i.hdr_size=d,i.start=a,i.write===h.Box.prototype.write&&"mdat"!==i.type&&(o.info("BoxParser","'"+u+"' box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),(n=e.getPosition()-(i.start+i.size))<0?(o.warn("BoxParser","Parsing of box '"+u+"' did not read the entire indicated box data size (missing "+-n+" bytes), seeking forward"),e.seek(i.start+i.size)):n>0&&(o.error("BoxParser","Parsing of box '"+u+"' read "+n+" more bytes than the indicated box data size, seeking backwards"),0!==i.size&&e.seek(i.start+i.size)),{code:h.OK,box:i,size:i.size})},h.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},h.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},h.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.ContainerBox.prototype.parse=function(e){for(var t,r;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},h.SAMPLE_ENTRY_TYPE_VISUAL="Visual",h.SAMPLE_ENTRY_TYPE_AUDIO="Audio",h.SAMPLE_ENTRY_TYPE_HINT="Hint",h.SAMPLE_ENTRY_TYPE_METADATA="Metadata",h.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",h.SAMPLE_ENTRY_TYPE_SYSTEM="System",h.SAMPLE_ENTRY_TYPE_TEXT="Text",h.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},h.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},h.SampleEntry.prototype.parseFooter=function(e){h.ContainerBox.prototype.parse.call(this,e)},h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_HINT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT,"enct"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA,"encm"),h.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var r=0;r<3;r++)this.layer_size[r]=16==t?e.readUint16():e.readUint32()})),h.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),h.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),h.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)o.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void o.error("av1C reserved_2 parsing problem");var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)}else o.error("av1C reserved_1 parsing problem");else o.error("av1C version "+this.version+" not supported")})),h.createBoxCtor("avcC",(function(e){var t,r;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),r=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(r))})),h.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),h.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),h.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),h.createFullBoxCtor("co64",(function(e){var t,r;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(r=0;r>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),h.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),h.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),h.createFullBoxCtor("ctts",(function(e){var t,r;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(r=0;r>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|r>>6&3,this.acmod=r>>3&7,this.lfeon=r>>2&1,this.bit_rate_code=3&r|i>>5&7})),h.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var r=0;r>6,i.bsid=n>>1&31,i.bsmod=(1&n)<<4|s>>4&15,i.acmod=s>>1&7,i.lfeon=1&s,i.num_dep_sub=o>>1&15,i.num_dep_sub>0&&(i.chan_loc=(1&o)<<8|e.readUint8())}})),h.createFullBoxCtor("dfLa",(function(e){var t=[],r=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var i=e.readUint8(),n=Math.min(127&i,r.length-1);if(n?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(r[n]),128&i)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),h.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[r]=e.readString(4),t-=4,r++})),h.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),h.createBoxCtor("hvcC",(function(e){var t,r,i,n;this.configurationVersion=e.readUint8(),n=e.readUint8(),this.general_profile_space=n>>6,this.general_tier_flag=(32&n)>>5,this.general_profile_idc=31&n,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),n=e.readUint8(),this.constantFrameRate=n>>6,this.numTemporalLayers=(13&n)>>3,this.temporalIdNested=(4&n)>>2,this.lengthSizeMinusOne=3&n,this.nalu_arrays=[];var s=e.readUint8();for(t=0;t>7,o.nalu_type=63&n;var a=e.readUint16();for(r=0;r>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var r=0;if(this.version<2)r=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";r=e.readUint32()}for(var i=0;i>7,this.axis=1&t})),h.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),o.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),h.createFullBoxCtor("ipma",(function(e){var t,r;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?o.property_index=(127&s)<<8|e.readUint8():o.property_index=127&s}}})),h.createFullBoxCtor("iref",(function(e){var t,r;for(this.references=[];e.getPosition()>7,i.assignment_type=127&n,i.assignment_type){case 0:i.grouping_type=e.readString(4);break;case 1:i.grouping_type=e.readString(4),i.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:i.sub_track_id=e.readUint32();break;default:o.warn("BoxParser","Unknown leva assignement type")}}})),h.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),h.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),f.prototype.toString=function(){return"("+this.x+","+this.y+")"},h.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new f(e.readUint16(),e.readUint16()),this.display_primaries[1]=new f(e.readUint16(),e.readUint16()),this.display_primaries[2]=new f(e.readUint16(),e.readUint16()),this.white_point=new f(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),h.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),h.createFullBoxCtor("mehd",(function(e){1&this.flags&&(o.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),h.createFullBoxCtor("meta",(function(e){this.boxes=[],h.ContainerBox.prototype.parse.call(this,e)})),h.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),h.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),h.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),h.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),h.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),h.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),h.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var r=0;r0){var t=e.readUint32();this.kid=[];for(var r=0;r0&&(this.data=e.readUint8Array(i))})),h.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),h.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),h.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var r=0;r>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var r=e.readUint8(),i=0;i>7,this.num_leading_samples=127&t})),h.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)o.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=h.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),h.createSampleGroupCtor("stsa",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),h.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),h.createSampleGroupCtor("tsas",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("tscl",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("vipr",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),r=0;r>6,this.sample_depends_on[i]=t>>4&3,this.sample_is_depended_on[i]=t>>2&3,this.sample_has_redundancy[i]=3&t})),h.createFullBoxCtor("senc"),h.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),o.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),r=0;r>31&1,i.referenced_size=2147483647&n,i.subsegment_duration=e.readUint32(),n=e.readUint32(),i.starts_with_SAP=n>>31&1,i.SAP_type=n>>28&7,i.SAP_delta_time=268435455&n}})),h.SingleItemTypeReferenceBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.SingleItemTypeReferenceBox.prototype=new h.Box,h.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var r=0;r>4&15,this.sample_sizes[t+1]=15&i}else if(8===this.field_size)for(t=0;t0)for(r=0;r>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=h.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),h.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),h.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),h.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var r=e.readUint32(),i=0;i>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),h.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),h.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),h.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},h.createTrackGroupCtor("msrc"),h.TrackReferenceTypeBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.TrackReferenceTypeBox.prototype=new h.Box,h.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},h.trefBox.prototype.parse=function(e){for(var t,r;e.getPosition()t&&this.flags&h.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var r=0;r>7&1,this.block_pad_lsb=r>>6&1,this.block_little_endian=r>>5&1,this.block_reversed=r>>4&1,this.pad_unknown=r>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),h.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),h.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),h.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),h.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=h.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),h.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),h.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=h.parseHex16(e)})),h.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),h.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),h.createFullBoxCtor("vvcC",(function(e){var t,r,i={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(i.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,r=this.num_sublayers-2;r>=0;--r){var o=i.extract_bits(1);this.ptl_sublayer_present_mask|=o<1;++r)i.extract_bits(1);for(this.sublayer_level_idc=[],r=this.num_sublayers-2;r>=0;--r)this.ptl_sublayer_present_mask&1<>=1;t+=h.decimalToHex(i,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var n=!1,s="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||n)&&(s="."+h.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+s,n=!0);t+=s}return t},h.vvc1SampleEntry.prototype.getCodec=h.vvi1SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var r="";if(this.vvcC.general_constraint_info){var i,n=[],s=0;for(s|=this.vvcC.ptl_frame_only_constraint<<7,s|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,n.push(s),s&&(i=e),s=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===i)r=".CA";else{r=".C";var o="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",a=0,d=0;for(e=0;e<=i;++e)for(a=a<<8|n[e],d+=8;d>=5;){r+=o[a>>d-5&31],a&=(1<<(d-=5))-1}d&&(r+=o[31&(a<<=5-d)])}}t+=r}return t},h.mp4aSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),r=this.esds.esd.getAudioConfig();return e+"."+h.decimalToHex(t)+(r?"."+r:"")}return e},h.stxtSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},h.vp08SampleEntry.prototype.getCodec=h.vp09SampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var r=this.vpcC.bitDepth;return 8==r&&(r="08"),e+".0"+this.vpcC.profile+"."+t+"."+r},h.av01SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this),r=this.av1C.seq_level_idx_0;return r<10&&(r="0"+r),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+r+(this.av1C.seq_tier_0?"H":"M")+"."+e},h.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),o.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>l?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>l&&e.writeUint64(this.size)},h.FullBox.prototype.writeHeader=function(e){this.size+=4,h.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},h.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},h.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},h.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},h.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},h.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},h.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&h.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&h.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&h.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&h.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[r]instanceof h.Box||t[r]instanceof h.Box||void 0===e[r]||void 0===t[r]||"function"==typeof e[r]||"function"==typeof t[r]||e.subBoxNames&&e.subBoxNames.indexOf(r.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(r.slice(0,4))>-1||"data"===r||"start"===r||"size"===r||"creation_time"===r||"modification_time"===r||h.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(r)>-1||e[r]===t[r]))return!1;return!0},h.boxEqual=function(e,t){if(!h.boxEqualFields(e,t))return!1;for(var r=0;r1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},g.prototype.setExtractionOptions=function(e,t,r){var i=this.getTrackById(e);if(i){var n={};this.extractedTracks.push(n),n.id=e,n.user=t,n.trak=i,i.nextSample=0,n.nb_samples=1e3,n.samples=[],r&&r.nbSamples&&(n.nb_samples=r.nbSamples)}},g.prototype.unsetExtractionOptions=function(e){for(var t=-1,r=0;r-1&&this.extractedTracks.splice(t,1)},g.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=h.parseOneBox(this.stream,false)).code===h.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var r;switch(r="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),r){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[r]&&o.warn("ISOFile","Duplicate Box of type: "+r+", overriding previous occurrence"),this[r]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},g.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(o.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(o.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(o.warn("ISOFile","Not ready to start parsing"),!1))},g.prototype.appendBuffer=function(e,t){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(o.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),o.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),r},g.prototype.getInfo=function(){var e,t,r,i,n,s,o={},a=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(o.hasMoov=!0,o.duration=this.moov.mvhd.duration,o.timescale=this.moov.mvhd.timescale,o.isFragmented=null!=this.moov.mvex,o.isFragmented&&this.moov.mvex.mehd&&(o.fragment_duration=this.moov.mvex.mehd.fragment_duration),o.isProgressive=this.isProgressive,o.hasIOD=null!=this.moov.iods,o.brands=[],o.brands.push(this.ftyp.major_brand),o.brands=o.brands.concat(this.ftyp.compatible_brands),o.created=new Date(a+1e3*this.moov.mvhd.creation_time),o.modified=new Date(a+1e3*this.moov.mvhd.modification_time),o.tracks=[],o.audioTracks=[],o.videoTracks=[],o.subtitleTracks=[],o.metadataTracks=[],o.hintTracks=[],o.otherTracks=[],e=0;e0?o.mime+='video/mp4; codecs="':o.audioTracks&&o.audioTracks.length>0?o.mime+='audio/mp4; codecs="':o.mime+='application/mp4; codecs="',e=0;e=r.samples.length)&&(o.info("ISOFile","Sending fragmented data on track #"+i.id+" for samples ["+Math.max(0,r.nextSample-i.nb_samples)+","+(r.nextSample-1)+"]"),o.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(i.id,i.user,i.segmentStream.buffer,r.nextSample,e||r.nextSample>=r.samples.length),i.segmentStream=null,i!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=r.samples.length)&&(o.debug("ISOFile","Sending samples on track #"+s.id+" for sample "+r.nextSample),this.onSamples&&this.onSamples(s.id,s.user,s.samples),s.samples=[],s!==this.extractedTracks[t]))break}}}},g.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},g.prototype.getBoxes=function(e,t){var r=[];return g._sweep.call(this,e,r,t),r},g._sweep=function(e,t,r){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&r)return;g._sweep.call(this.boxes[i],e,t,r)}},g.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},g.prototype.getTrackSample=function(e,t){var r=this.getTrackById(e);return this.getSample(r,t)},g.prototype.releaseUsedSamples=function(e,t,r){var i=0,n=this.getTrackById(e);n.lastValidSample||(n.lastValidSample=0);for(var s=n.lastValidSample;se*n.timescale){l=i-1;break}t&&n.is_sync&&(d=i)}for(t&&(l=d),e=r.samples[l].cts,r.nextSample=l;r.samples[l].alreadyRead===r.samples[l].size&&r.samples[l+1];)l++;return s=r.samples[l].offset+r.samples[l].alreadyRead,o.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+o.getDurationString(e,a)+" and offset: "+s),{offset:s,time:e/a}},g.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},g.prototype.seek=function(e,t){var r,i,n,s=this.moov,a={offset:1/0,time:1/0};if(this.moov){for(n=0;nthis.getTrackDuration(r)||((i=this.seekTrack(e,t,r)).offset-1){o=d;break}switch(o){case"Visual":if(n.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),s.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var u=new h.avcCBox;u.parse(new a(t.avcDecoderConfigRecord)),s.addBox(u)}else if(t.hevcDecoderConfigRecord){var f=new h.hvcCBox;f.parse(new a(t.hevcDecoderConfigRecord)),s.addBox(f)}break;case"Audio":n.add("smhd").set("balance",t.balance||0),s.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":n.add("hmhd");break;case"Subtitle":if(n.add("sthd"),"stpp"===t.type)s.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:n.add("nmhd")}t.description&&s.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){s.addBox(e)})),n.add("dinf").add("dref").addEntry((new h["url Box"]).set("flags",1));var p=n.add("stbl");return p.add("stsd").addEntry(s),p.add("stts").set("sample_counts",[]).set("sample_deltas",[]),p.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),p.add("stco").set("chunk_offsets",[]),p.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(r),t.id}},h.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},g.prototype.addSample=function(e,t,r){var i=r||{},n={},s=this.getTrackById(e);if(null!==s){n.number=s.samples.length,n.track_id=s.tkhd.track_id,n.timescale=s.mdia.mdhd.timescale,n.description_index=i.sample_description_index?i.sample_description_index-1:0,n.description=s.mdia.minf.stbl.stsd.entries[n.description_index],n.data=t,n.size=t.byteLength,n.alreadyRead=n.size,n.duration=i.duration||1,n.cts=i.cts||0,n.dts=i.dts||0,n.is_sync=i.is_sync||!1,n.is_leading=i.is_leading||0,n.depends_on=i.depends_on||0,n.is_depended_on=i.is_depended_on||0,n.has_redundancy=i.has_redundancy||0,n.degradation_priority=i.degradation_priority||0,n.offset=0,n.subsamples=i.subsamples,s.samples.push(n),s.samples_size+=n.size,s.samples_duration+=n.duration,void 0===s.first_dts&&(s.first_dts=i.dts),this.processSamples();var o=this.createSingleSampleMoof(n);return this.addBox(o),o.computeSize(),o.trafs[0].truns[0].data_offset=o.size+8,this.add("mdat").data=new Uint8Array(t),n}},g.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var r=new h.moofBox;r.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var i=r.add("traf"),n=this.getTrackById(e.track_id);return i.add("tfhd").set("track_id",e.track_id).set("flags",h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),i.add("tfdt").set("baseMediaDecodeTime",e.dts-(n.first_dts||0)),i.add("trun").set("flags",h.TRUN_FLAGS_DATA_OFFSET|h.TRUN_FLAGS_DURATION|h.TRUN_FLAGS_SIZE|h.TRUN_FLAGS_FLAGS|h.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),r},g.prototype.lastMoofIndex=0,g.prototype.samplesDataSize=0,g.prototype.resetTables=function(){var e,t,r,i,n,s;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(d=n[o].grouping_type+"/0",(a=new l(n[o].grouping_type,0)).is_fragment=!0,t.sample_groups_info[d]||(t.sample_groups_info[d]=a))}else for(o=0;o=2&&(d=i[o].grouping_type+"/0",a=new l(i[o].grouping_type,0),e.sample_groups_info[d]||(e.sample_groups_info[d]=a))},g.setSampleGroupProperties=function(e,t,r,i){var n,s;for(n in t.sample_groups=[],i){var o;if(t.sample_groups[n]={},t.sample_groups[n].grouping_type=i[n].grouping_type,t.sample_groups[n].grouping_type_parameter=i[n].grouping_type_parameter,r>=i[n].last_sample_in_run&&(i[n].last_sample_in_run<0&&(i[n].last_sample_in_run=0),i[n].entry_index++,i[n].entry_index<=i[n].sbgp.entries.length-1&&(i[n].last_sample_in_run+=i[n].sbgp.entries[i[n].entry_index].sample_count)),i[n].entry_index<=i[n].sbgp.entries.length-1?t.sample_groups[n].group_description_index=i[n].sbgp.entries[i[n].entry_index].group_description_index:t.sample_groups[n].group_description_index=-1,0!==t.sample_groups[n].group_description_index)o=i[n].fragment_description?i[n].fragment_description:i[n].description,t.sample_groups[n].group_description_index>0?(s=t.sample_groups[n].group_description_index>65535?(t.sample_groups[n].group_description_index>>16)-1:t.sample_groups[n].group_description_index-1,o&&s>=0&&(t.sample_groups[n].description=o.entries[s])):o&&o.version>=2&&o.default_group_description_index>0&&(t.sample_groups[n].description=o.entries[o.default_group_description_index-1])}},g.process_sdtp=function(e,t,r){t&&(e?(t.is_leading=e.is_leading[r],t.depends_on=e.sample_depends_on[r],t.is_depended_on=e.sample_is_depended_on[r],t.has_redundancy=e.sample_has_redundancy[r]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},g.prototype.buildSampleLists=function(){var e,t;for(e=0;ev&&(b++,v<0&&(v=0),v+=s.sample_counts[b]),t>0?(e.samples[t-1].duration=s.sample_deltas[b],e.samples_duration+=e.samples[t-1].duration,U.dts=e.samples[t-1].dts+e.samples[t-1].duration):U.dts=0,o?(t>=w&&(S++,w<0&&(w=0),w+=o.sample_counts[S]),U.cts=e.samples[t].dts+o.sample_offsets[S]):U.cts=U.dts,a?(t==a.sample_numbers[E]-1?(U.is_sync=!0,E++):(U.is_sync=!1,U.degradation_priority=0),l&&l.entries[A].sample_delta+x==t+1&&(U.subsamples=l.entries[A].subsamples,x+=l.entries[A].sample_delta,A++)):U.is_sync=!0,g.process_sdtp(e.mdia.minf.stbl.sdtp,U,U.number),U.degradation_priority=h?h.priority[t]:0,l&&l.entries[A].sample_delta+x==t&&(U.subsamples=l.entries[A].subsamples,x+=l.entries[A].sample_delta),(c.length>0||u.length>0)&&g.setSampleGroupProperties(e,U,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},g.prototype.updateSampleLists=function(){var e,t,r,i,n,s,o,a,d,l,c,u,f,p,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&g.initSampleGroups(u,c,c.sbgps,u.mdia.minf.stbl.sgpds,c.sgpds),t=0;t0?p.dts=u.samples[u.samples.length-2].dts+u.samples[u.samples.length-2].duration:(c.tfdt?p.dts=c.tfdt.baseMediaDecodeTime:p.dts=0,u.first_traf_merged=!0),p.cts=p.dts,_.flags&h.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+_.sample_composition_time_offset[r]),m=o,_.flags&h.TRUN_FLAGS_FLAGS?m=_.sample_flags[r]:0===r&&_.flags&h.TRUN_FLAGS_FIRST_FLAG&&(m=_.first_sample_flags),p.is_sync=!(m>>16&1),p.is_leading=m>>26&3,p.depends_on=m>>24&3,p.is_depended_on=m>>22&3,p.has_redundancy=m>>20&3,p.degradation_priority=65535&m;var y=!!(c.tfhd.flags&h.TFHD_FLAG_BASE_DATA_OFFSET),v=!!(c.tfhd.flags&h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),b=!!(_.flags&h.TRUN_FLAGS_DATA_OFFSET),w=0;w=y?c.tfhd.base_data_offset:v||0===t?l.start:a,p.offset=0===t&&0===r?b?w+_.data_offset:w:a,a=p.offset+p.size,(c.sbgps.length>0||c.sgpds.length>0||u.mdia.minf.stbl.sbgps.length>0||u.mdia.minf.stbl.sgpds.length>0)&&g.setSampleGroupProperties(u,p,p.number_in_traf,c.sample_groups_info)}}if(c.subs){u.has_fragment_subsamples=!0;var S=c.first_sample_index;for(t=0;t-1))return null;var s=(r=this.stream.buffers[n]).byteLength-(i.offset+i.alreadyRead-r.fileStart);if(i.size-i.alreadyRead<=s)return o.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+(i.size-i.alreadyRead)+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,i.size-i.alreadyRead),r.usedBytes+=i.size-i.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead=i.size,i;if(0===s)return null;o.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+s+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,s),i.alreadyRead+=s,r.usedBytes+=s,this.stream.logBufferLevel()}},g.prototype.releaseSample=function(e,t){var r=e.samples[t];return r.data?(this.samplesDataSize-=r.size,r.data=null,r.description=null,delete r.degradation_priority,delete r.depends_on,delete r.description_index,delete r.has_redundancy,delete r.is_depended_on,delete r.is_leading,delete r.is_sync,delete r.moof_number,delete r.number_in_traf,delete r.timescale,delete r.cts,delete r.dts,delete r.offset,delete r.size,delete r.track_id,delete r.duration,r.alreadyRead=0,r.size):0},g.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},g.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},g.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(r.protection=s.ipro.protections[s.iinf.item_infos[e].protection_index-1]),s.iinf.item_infos[e].item_type?r.type=s.iinf.item_infos[e].item_type:r.type="mime",r.content_type=s.iinf.item_infos[e].content_type,r.content_encoding=s.iinf.item_infos[e].content_encoding;if(s.grpl)for(e=0;e0&&h.property_index-1-1))return null;var a=(t=this.stream.buffers[s]).byteLength-(n.offset+n.alreadyRead-t.fileStart);if(!(n.length-n.alreadyRead<=a))return o.debug("ISOFile","Getting item #"+e+" extent #"+i+" partial data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+a+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,a),n.alreadyRead+=a,r.alreadyRead+=a,t.usedBytes+=a,this.stream.logBufferLevel(),null;o.debug("ISOFile","Getting item #"+e+" extent #"+i+" data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+(n.length-n.alreadyRead)+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,n.length-n.alreadyRead),t.usedBytes+=n.length-n.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead+=n.length-n.alreadyRead,n.alreadyRead=n.length}}return r.alreadyRead===r.size?r:null},g.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var r=0;r0?this.moov.traks[e].samples[0].duration:0),t.push(i)}return t},g.prototype.getPerformanceInfo=function(){var e={};return e.moov=this.moov,this.moov&&this.moov.traks&&this.moov.traks.length>1&&(e.moovAudioNum=this.moov.traks[0].samples.length,e.moovVideoNum=this.moov.traks[1].samples.length),e},h.Box.prototype.printHeader=function(e){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},h.FullBox.prototype.printHeader=function(e){this.size+=4,h.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},h.Box.prototype.print=function(e){this.printHeader(e)},h.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},h.tkhdBox.prototype.print=function(e){h.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var y={createFile:function(e,t){var r=void 0===e||e,i=new g(t);return i.discardMdatData=!r,i}};t.createFile=y.createFile}));function Oi(e){return e.reduce(((e,t)=>256*e+t))}function Gi(e){const t=[101,103,119,99],r=e.length-28,i=e.slice(r,r+t.length);return t.every(((e,t)=>e===i[t]))}$i.Log,$i.MP4BoxStream,$i.DataStream,$i.MultiBufferStream,$i.MPEG4DescriptorParser,$i.BoxParser,$i.XMLSubtitlein4Parser,$i.Textin4Parser,$i.ISOFile,$i.createFile;class Hi{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(r+32,r+32+t))]}return null}(t,this.t);if(!r)return e;const i=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(i instanceof Error)return console.error(i.message),this.d=!0,e;this.A=!0,this.u=r[1],Gi(t)&&this.c++,WebAssembly.instantiate(r[2],i).then((e=>{if("function"!=typeof(t=e.instance.exports).parse||"object"!=typeof t.memory)return this.d=!0,void console.error("video_error_3");var t;this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}function Wi(){for(var e=arguments.length,t=new Array(e),r=0;r{const r=new i((0|e.byteLength)+(0|t.byteLength));return r.set(e,0),r.set(t,0|e.byteLength),r}),new i)}const Vi=16,ji=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],qi=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Yi(e){const t=[];for(let r=0,i=e.length;r1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Xi(e){const t=[];for(let r=0,i=e.length;r>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}function Zi(e){const t=[];for(let r=0,i=e.length;r=240&&e[r]<=247?(t.push(String.fromCodePoint(((7&e[r])<<18)+((63&e[r+1])<<12)+((63&e[r+2])<<6)+(63&e[r+3]))),r+=3):e[r]>=224&&e[r]<=239?(t.push(String.fromCodePoint(((15&e[r])<<12)+((63&e[r+1])<<6)+(63&e[r+2]))),r+=2):e[r]>=192&&e[r]<=223?(t.push(String.fromCodePoint(((31&e[r])<<6)+(63&e[r+1]))),r++):t.push(String.fromCodePoint(e[r]));return t.join("")}function Ji(e,t){const r=31&t;return e<>>32-r}function Qi(e){return(255&ji[e>>>24&255])<<24|(255&ji[e>>>16&255])<<16|(255&ji[e>>>8&255])<<8|255&ji[255&e]}function en(e){return e^Ji(e,2)^Ji(e,10)^Ji(e,18)^Ji(e,24)}function tn(e){return e^Ji(e,13)^Ji(e,23)}function rn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[4*t],n[1]=255&e[4*t+1],n[2]=255&e[4*t+2],n[3]=255&e[4*t+3],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];for(let e,t=0;t<32;t+=4)e=i[1]^i[2]^i[3]^r[t+0],i[0]^=en(Qi(e)),e=i[2]^i[3]^i[0]^r[t+1],i[1]^=en(Qi(e)),e=i[3]^i[0]^i[1]^r[t+2],i[2]^=en(Qi(e)),e=i[0]^i[1]^i[2]^r[t+3],i[3]^=en(Qi(e));for(let e=0;e<16;e+=4)t[e]=i[3-e/4]>>>24&255,t[e+1]=i[3-e/4]>>>16&255,t[e+2]=i[3-e/4]>>>8&255,t[e+3]=255&i[3-e/4]}function nn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[0+4*t],n[1]=255&e[1+4*t],n[2]=255&e[2+4*t],n[3]=255&e[3+4*t],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let e,r=0;r<32;r+=4)e=i[1]^i[2]^i[3]^qi[r+0],t[r+0]=i[0]^=tn(Qi(e)),e=i[2]^i[3]^i[0]^qi[r+1],t[r+1]=i[1]^=tn(Qi(e)),e=i[3]^i[0]^i[1]^qi[r+2],t[r+2]=i[2]^=tn(Qi(e)),e=i[0]^i[1]^i[2]^qi[r+3],t[r+3]=i[3]^=tn(Qi(e));if(0===r)for(let e,r=0;r<16;r++)e=t[r],t[r]=t[31-r],t[31-r]=e}function sn(e,t,r){let{padding:i="pkcs#7",mode:n,iv:s=[],output:o="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===n&&("string"==typeof s&&(s=Yi(s)),16!==s.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=Yi(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==r?Xi(e):Yi(e):[...e],("pkcs#5"===i||"pkcs#7"===i)&&0!==r){const t=Vi-e.length%Vi;for(let r=0;r=Vi;){const t=e.slice(u,u+16),i=new Array(16);if("cbc"===n)for(let e=0;e2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let s=new Uint8Array(e.slice(0,5)),o=5;for(;on){const t=new Uint8Array(s.length+e.length-o);t.set(s,0),t.set(e.slice(o),s.length),s=t;break}let l=e[o+4],c=!1,u=2;if(r?(i&&(u=3),l=l>>>1&63,c=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(l)):(l&=31,c=1===l||5===l),c){const r=sn(e.slice(o+4+u,o+4+d),t,0,{padding:"none",output:"array"});let i=r[r.length-1];if(i>0&&i<16){let e=!0;for(let t=1;t<=i;t++)if(r[r.length-t]!==i){e=!1;break}e&&r.splice(r.length-i,i)}const n=new Uint8Array(u);n.set(e.slice(o+4,o+4+u),0);const a=tr(Wi(n,new Uint8Array(r))),l=new Uint8Array(s.length+a.length);l.set(s,0),l.set(a,s.length),s=l}else{const t=e.slice(o+4,o+4+d),r=new Uint8Array(s.length+4+t.length);r.set(s,0),r.set(a,s.length),r.set(t,s.length+4),s=r}o=o+4+d}return s}const dn={init:0,findFirstStartCode:1,findSecondStartCode:2};class ln extends class{on(e,t,r){const i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:r}),this}once(e,t,r){const i=this;function n(){i.off(e,n);for(var s=arguments.length,o=new Array(s),a=0;a1?r-1:0),n=1;n{delete r[e]})),void delete this.e;const i=r[e],n=[];if(i&&t)for(let e=0,r=i.length;e=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=dn.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==dn.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=dn.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==dn.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=dn.findFirstStartCode}}}}function cn(e,t,r){for(let i=2;i3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let s=5;for(;sn)break;let a=e[s+4],d=!1;if(i?(a=a>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(a)):(a&=31,d=1===a||5===a),d){const i=cn(e.slice(s+4,s+4+o),t,r);e.set(i,s+4)}s=s+4+o}return e}function fn(){for(var e=arguments.length,t=new Array(e),r=0;re+t.byteLength),0));let n=0;return t.forEach((e=>{i.set(e,n),n+=e.byteLength})),i}class pn{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,r,i)));e.addEventListener(t,r,i);const n=()=>{lr(e.removeEventListener)&&e.removeEventListener(t,r,i)};return this.destroys.push(n),n}destroy(){this.master.debugLog("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class mn{static init(){mn.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in mn.types)mn.types.hasOwnProperty(e)&&(mn.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=mn.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,r=null,i=Array.prototype.slice.call(arguments,1),n=i.length;for(let e=0;e>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r.set(e,4);let s=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return mn.box(mn.types.trak,mn.tkhd(e),mn.mdia(e))}static tkhd(e){let t=e.id,r=e.duration,i=e.presentWidth,n=e.presentHeight;return mn.box(mn.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>>8&255,255&i,0,0,n>>>8&255,255&n,0,0]))}static mdia(e){return mn.box(mn.types.mdia,mn.mdhd(e),mn.hdlr(e),mn.minf(e))}static mdhd(e){let t=e.timescale,r=e.duration;return mn.box(mn.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?mn.constants.HDLR_AUDIO:mn.constants.HDLR_VIDEO,mn.box(mn.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?mn.box(mn.types.smhd,mn.constants.SMHD):mn.box(mn.types.vmhd,mn.constants.VMHD),mn.box(mn.types.minf,t,mn.dinf(),mn.stbl(e))}static dinf(){return mn.box(mn.types.dinf,mn.box(mn.types.dref,mn.constants.DREF))}static stbl(e){return mn.box(mn.types.stbl,mn.stsd(e),mn.box(mn.types.stts,mn.constants.STTS),mn.box(mn.types.stsc,mn.constants.STSC),mn.box(mn.types.stsz,mn.constants.STSZ),mn.box(mn.types.stco,mn.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.mp3(e)):mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.mp4a(e)):"avc"===e.videoType?mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.avc1(e)):mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.hvc1(e))}static mp3(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return mn.box(mn.types[".mp3"],i)}static mp4a(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return mn.box(mn.types.mp4a,i,mn.esds(e))}static esds(e){let t=e.config||[],r=t.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(t).concat([6,1,2]));return mn.box(mn.types.esds,i)}static avc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return mn.box(mn.types.avc1,n,mn.box(mn.types.avcC,t))}static hvc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return mn.box(mn.types.hvc1,n,mn.box(mn.types.hvcC,t))}static mvex(e){return mn.box(mn.types.mvex,mn.trex(e))}static trex(e){let t=e.id,r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return mn.box(mn.types.trex,r)}static moof(e,t){return mn.box(mn.types.moof,mn.mfhd(e.sequenceNumber),mn.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return mn.box(mn.types.mfhd,t)}static traf(e,t){let r=e.id,i=mn.box(mn.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),n=mn.box(mn.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),s=mn.sdtp(e),o=mn.trun(e,s.byteLength+16+16+8+16+8+8);return mn.box(mn.types.traf,i,n,o,s)}static sdtp(e){let t=new Uint8Array(5),r=e.flags;return t[4]=r.isLeading<<6|r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy,mn.box(mn.types.sdtp,t)}static trun(e,t){let r=new Uint8Array(28);t+=36,r.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let i=e.duration,n=e.size,s=e.flags,o=e.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.isNonSync,0,0,o>>>24&255,o>>>16&255,o>>>8&255,255&o],12),mn.box(mn.types.trun,r)}static mdat(e){return mn.box(mn.types.mdat,e)}}mn.init();var _n,gn=Ot((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}));(_n=gn)&&_n.__esModule&&Object.prototype.hasOwnProperty.call(_n,"default")&&_n.default;const yn=[44100,48e3,32e3,0],vn=[22050,24e3,16e3,0],bn=[11025,12e3,8e3,0],wn=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],Sn=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],En=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];function An(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),r=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let i=t[1]>>>3&3,n=(6&t[1])>>1,s=(240&t[2])>>>4,o=(12&t[2])>>>2,a=3!==(t[3]>>>6&3)?2:1,d=0,l=0;switch(i){case 0:d=bn[o];break;case 2:d=vn[o];break;case 3:d=yn[o]}switch(n){case 1:s=e[n]&&t=6?(i=5,t=new Array(4),o=n-3):(i=2,t=new Array(2),o=n):-1!==a.indexOf("android")?(i=2,t=new Array(2),o=n):(i=5,o=n,t=new Array(4),n>=6?o=n-3:1===s&&(i=2,t=new Array(2),o=n)),t[0]=i<<3,t[0]|=(15&n)>>>1,t[1]=(15&n)<<7,t[1]|=(15&s)<<3,5===i&&(t[1]|=(15&o)>>>1,t[2]=(1&o)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=Nn[n],this.sampling_index=n,this.channel_count=s,this.object_type=i,this.original_object_type=r,this.codec_mimetype="mp4a.40."+i,this.original_codec_mimetype="mp4a.40."+r}}class Gn{constructor(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}get bitsAvailable(){return this.bitLength-this.index}skipBits(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}getBits(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>i,s=8-i;if(s>=e)return r&&(this.index+=e),n>>s-e;{r&&(this.index+=s);const i=e-s;return n<>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}function Hn(e){return e[3]|e[2]<<8|e[1]<<16|e[0]<<24}const Wn=new Array(214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72),Vn=new Array(2746333894,1453994832,1736282519,2993693404),jn=new Array(462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257);function qn(e,t,r,i,n){var s=n;s=t+n>e.length&&i+n<=r.length?e.length-t:i+n>r.length&&t+n<=e.length?r.length-i:t+n<=e.length&&i+n<=r.length?n:r.length>24&255,e>>16&255,e>>8&255,255&e)}function Kn(e,t){return t+3>>19)^(i<<23|i>>>9)}function Jn(e,t){var r=new Array(36);r[0]=Kn(t,0),r[1]=Kn(t,4),r[2]=Kn(t,8),r[3]=Kn(t,12);for(var i=0;i<32;i++)r[i+4]=r[i]^Qn(r[i+1]^r[i+2]^r[i+3]^e[i]);var n=new Array(4);for(i=35;i>=32;i--)n[35-i]=r[i];var s=function(e){for(var t=new Array(4*e.length),r=0;r>>30)^(i<<10|i>>>22)^(i<<18|i>>>14)^(i<<24|i>>>8)}function es(e,t,r){if(null==e||null==e||e.length%16!=0)return console.log("sm4 key is error!"),null;if(null==r||null==r||r.length<=0)return console.log("cipher is error!"),null;if(null==t||null==t||t.length%16!=0)return console.log("iv is error!"),null;for(var i=Xn(e),n=Math.ceil(r.length/16),s=new Array(r.length),o=t.slice(),a=0;a3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t=new Uint8Array(t),r=new Uint8Array(r);const s=e.byteLength;let o=5;for(;os)break;let d=e[o+4],l=!1,c=2;if(i?(n&&(c=3),d=d>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(d)):(d&=31,l=1===d||5===d),l){const i=es(t,r,e.slice(o+4+c,o+4+a));e.set(i,o+4+c)}o=o+4+a}return e}Date.now||(Date.now=function(){return(new Date).getTime()});const rs=[];rs.push(o({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support")&&-1===e.indexOf("illegal icc")&&!e.indexOf("If you want to help, upload a sample of this file to")&&!e.indexOf("Reserved SBR extensions is not implemented"))})(e)||console.warn("JbPro[❌❌❌][worker]:",e)}}),s({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support, using thread emulation"))})(e)||console.warn("JbPro[❌❌❌][worker]:",e)}})),Promise.all(rs).then((e=>{const t=e[0];!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[],n=[],s=null,o=null,a=null,d=null,l=null,c=null,u=!1,h=null,f=null,S=!1,E=!1,B=!!gr(r),Se=0,Ee=0,je=!1,Je=null,Qe=null,tt=null,it=[],ut=null,At=null,xt=0,kt=0,$t=null,Ot=null,Gt=0,Ht=0,Wt=!1,Kt=!1,Qt=!1,sr=null,wr=null,Sr=!1,Er=!0,Ar=()=>{const e=mr();return{debug:e.debug,debugLevel:e.debugLevel,debugUuid:e.debugUuid,useOffscreen:e.useOffscreen,useWCS:e.useWCS,useMSE:e.useMSE,videoBuffer:e.videoBuffer,videoBufferDelay:e.videoBufferDelay,openWebglAlignment:e.openWebglAlignment,playType:e.playType,hasAudio:e.hasAudio,hasVideo:e.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:e.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:e.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:0,networkDelay:e.networkDelay,visibility:!0,useSIMD:e.useSIMD,isRecording:!1,recordType:e.recordType,isNakedFlow:e.isNakedFlow,checkFirstIFrame:e.checkFirstIFrame,audioBufferSize:1024,isM7sCrypto:e.isM7sCrypto,m7sCryptoAudio:e.m7sCryptoAudio,cryptoKey:e.cryptoKey,cryptoIV:e.cryptoIV,isSm4Crypto:e.isSm4Crypto,isSm4CryptoH265V2:e.isSm4CryptoH265V2,sm4CryptoKey:e.sm4CryptoKey,isXorCrypto:e.isXorCrypto,isHls265:!1,isFlv:e.isFlv,isFmp4:e.isFmp4,isMpeg4:e.isMpeg4,isTs:e.isTs,isFmp4Private:e.isFmp4Private,isEmitSEI:e.isEmitSEI,isRecordTypeFlv:!1,isWasmMp4:!1,isChrome:!1,isFirefox:!1,isDropSameTimestampGop:e.isDropSameTimestampGop,mseDecodeAudio:e.mseDecodeAudio,wcsDecodeAudio:e.wcsDecodeAudio,nakedFlowH265DemuxUseNew:e.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:e.mseDecoderUseWorker,mseAutoCleanupSourceBuffer:e.mseAutoCleanupSourceBuffer,mseAutoCleanupMaxBackwardDuration:e.mseAutoCleanupMaxBackwardDuration,mseAutoCleanupMinBackwardDuration:e.mseAutoCleanupMinBackwardDuration,mseCorrectTimeDuration:e.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:e.mseCorrectAudioTimeDuration,nakedFlowDemuxUseNew:e.nakedFlowDemuxUseNew,nakedFlowFps:e.nakedFlowFps,supportMSEDecodeHevc:!1}};"VideoEncoder"in self&&(s={hasInit:!1,isEmitInfo:!1,offscreenCanvas:null,offscreenCanvasCtx:null,decoder:null,init(){s.decoder=new VideoDecoder({output:function(e){if(lr(e.createImageBitmap))e.createImageBitmap().then((t=>{s.offscreenCanvasCtx.drawImage(t,0,0,e.codedWidth,e.codedHeight);let r=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:r,delay:si.delay,ts:0},[r]),hr(e)}));else{s.offscreenCanvasCtx.drawImage(e,0,0,e.codedWidth,e.codedHeight);let t=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:t,delay:si.delay,ts:0},[t]),hr(e)}},error:function(e){si.debugError("worker","VideoDecoder error: ",e,e.toString())}})},destroy(){s.reset(),s.decoder&&"closed"!==s.decoder.state&&(s.decoder.close(),s.decoder=null)},decode:function(e,t,r){const i=e[0]>>4==1;if(s.hasInit){const r=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:i?pt:mt});s.decoder.decode(r)}else if(i&&0===e[1]){const t=15&e[0];postMessage({cmd:M,code:t});const r=new Uint8Array(e);postMessage({cmd:R,buffer:r,codecId:t},[r.buffer]);let i=null,n=null;const o=e.slice(5);t===Ie?(n=Tr(o),i={codec:n.codec,description:o}):t===Me&&(n=Vr(o),i={codec:n.codec,description:o}),n&&n.codecWidth&&n.codecHeight&&(i.codedHeight=n.codecHeight,i.codedWidth=n.codecWidth),s.isEmitInfo||(si.debugLog("worker","Webcodecs Video Decoder initSize"),postMessage({cmd:T,w:n.codecWidth,h:n.codecHeight}),s.isEmitInfo=!0,s.offscreenCanvas=new OffscreenCanvas(n.codecWidth,n.codecHeight),s.offscreenCanvasCtx=s.offscreenCanvas.getContext("2d"));try{s.decoder.configure(i),s.hasInit=!0}catch(e){si.debugError("worker","VideoDecoder configure error",e.code,e,e.toString()),e.toString()}}else si.debugWarn("worker",`VideoDecoder configure has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)},reset(){s.hasInit=!1,s.isEmitInfo=!1,s.offscreenCanvas=null,s.offscreenCanvasCtx=null}});let kr=function(){if(Sr=!0,o)try{o.abort(),o=null,si.debugLog("worker","abort success")}catch(e){o=null,si.debugLog("worker","abort catch",e)}},Or={init(){Or.lastBuf=null,Or.vps=null,Or.sps=null,Or.pps=null,Or.streamType=null,Or.localDts=0,Or.pendingUnits={},Or.isSendSeqHeader=!1},destroy(){Or.lastBuf=null,Or.vps=null,Or.sps=null,Or.pps=null,Or.streamType=null,Or.localDts=0,Or.pendingUnits={},Or.isSendSeqHeader=!1},dispatch(e){const t=new Uint8Array(e);if(si._opt.nakedFlowDemuxUseNew){const e=Or.extractNALu$3(t);if(0===e.length)return void si.debugLog("worker","dispatch naluArray length is 0");Or.handleVideoFrames(e)}else Or.extractNALu$2(t)},getNaluDts(){const e=si._opt.nakedFlowFps;let t=Or.localDts;return Or.localDts=Or.localDts+parseInt(1e3/e,10),t},getNaluAudioDts(){const e=si._opt.sampleRate,t=si._opt.audioBufferSize;return Or.localDts+parseInt(t/e*1e3)},extractNALu(e){let t,r,i=0,n=e.byteLength,s=0,o=[];for(;i1)for(let e=0;e{const t=Lr(e);t===Ve||t===We?Or.handleVideoH264Nalu(e):Mr(t)&&i.push(e)})),1===i.length)Or.handleVideoH264Nalu(i[0]);else if(zr(i)){const e=Lr(i[0]),t=Rr(e);Or.handleVideoH264NaluList(i,t,e)}else i.forEach((e=>{Or.handleVideoH264Nalu(e)}))}else if(Or.streamType===Ne)if(si._opt.nakedFlowH265DemuxUseNew){const t=Or.handleAddNaluStartCode(e),r=Or.extractNALu(t);if(0===r.length)return void si.debugWarn("worker","handleVideoNalu","h265 naluList.length === 0");const i=[];if(r.forEach((e=>{const t=Xr(e);t===lt||t===at||t===st?Or.handleVideoH265Nalu(e):Jr(t)&&i.push(e)})),1===i.length)Or.handleVideoH265Nalu(i[0]);else if(ei(i)){const e=Xr(i[0]),t=Qr(e);Or.handleVideoH265NaluList(i,t,e)}else i.forEach((e=>{Or.handleVideoH265Nalu(e)}))}else Xr(e)===lt?Or.extractH265PPS(e):Or.handleVideoH265Nalu(e)},extractH264PPS(e){const t=Or.handleAddNaluStartCode(e);Or.extractNALu(t).forEach((e=>{Ir(Lr(e))?Or.extractH264SEI(e):Or.handleVideoH264Nalu(e)}))},extractH265PPS(e){const t=Or.handleAddNaluStartCode(e);Or.extractNALu(t).forEach((e=>{Zr(Xr(e))?Or.extractH265SEI(e):Or.handleVideoH265Nalu(e)}))},extractH264SEI(e){const t=Or.handleAddNaluStartCode(e);Or.extractNALu(t).forEach((e=>{Or.handleVideoH264Nalu(e)}))},extractH265SEI(e){const t=Or.handleAddNaluStartCode(e);Or.extractNALu(t).forEach((e=>{Or.handleVideoH265Nalu(e)}))},handleAddNaluStartCode(e){const t=[0,0,0,1],r=new Uint8Array(e.length+t.length);return r.set(t),r.set(e,t.length),r},handleVideoH264Nalu(e){const t=Lr(e);switch(t){case We:Or.sps=e;break;case Ve:Or.pps=e}if(Or.isSendSeqHeader){if(Or.sps&&Or.pps){const e=Cr({sps:Or.sps,pps:Or.pps}),t=Or.localDts;si.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null}if(Mr(t)){const r=Rr(t),i=Or.getNaluDts(),n=Pr(e,r);Or.doDecode(n,{type:ae,ts:i,isIFrame:r,cts:0})}}else if(Or.sps&&Or.pps){Or.isSendSeqHeader=!0;const e=Cr({sps:Or.sps,pps:Or.pps});si.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null}},handleVideoH264NaluList(e,t,r){if(Or.isSendSeqHeader){const i=Or.getNaluDts(),n=Fr(e.reduce(((e,t)=>{const r=tr(e),i=tr(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);Or.doDecode(n,{type:ae,ts:i,isIFrame:t,cts:0}),si.debugLog("worker",`handleVideoH264NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},handleVideoH265Nalu(e){const t=Xr(e);switch(t){case st:Or.vps=e;break;case at:Or.sps=e;break;case lt:Or.pps=e}if(Or.isSendSeqHeader){if(Or.vps&&Or.sps&&Or.pps){const e=qr({vps:Or.vps,sps:Or.sps,pps:Or.pps}),t=Or.localDts;si.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Or.vps=null,Or.sps=null,Or.pps=null}if(Jr(t)){const r=Qr(t),i=Or.getNaluDts(),n=Yr(e,r);Or.doDecode(n,{type:ae,ts:i,isIFrame:r,cts:0})}}else if(Or.vps&&Or.sps&&Or.pps){Or.isSendSeqHeader=!0;const e=qr({vps:Or.vps,sps:Or.sps,pps:Or.pps});si.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Or.vps=null,Or.sps=null,Or.pps=null}},handleVideoH265NaluList(e,t,r){if(Or.isSendSeqHeader){const i=Or.getNaluDts(),n=Kr(e.reduce(((e,t)=>{const r=tr(e),i=tr(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);Or.doDecode(n,{type:ae,ts:i,isIFrame:t,cts:0}),si.debugLog("worker",`handleVideoH265NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},doDecode(e,t){si.calcNetworkDelay(t.ts),t.isIFrame&&si.calcIframeIntervalTimestamp(t.ts),si.decode(e,t)},handleVideoFrames(e){if(!Or.streamVideoType)for(let t of e)if(Or.streamVideoType=cr(t),Or.streamVideoType)break;Or.streamVideoType?Or.streamVideoType===ze?Or.handleVideoH264Frames(e):this.streamVideoType===Ne&&Or.handleVideoH265Frames(e):si.debugWarn("worker","handleVideoFrames","streamVideoType is null")},handleVideoH264Frames(e){let t=[],r=[],i=!1,n=!1;Or.pendingUnits.units&&(t=Or.pendingUnits.units,n=Or.pendingUnits.vcl,i=Or.pendingUnits.iFrame,Or.pendingUnits={});let s={};for(let o of e){if(o.byteLength<4)continue;const e=Lr(o);let a=!1,d=e===Ye;e!==qe&&e!==Ye||(s=Or.parseVideo264Header(o),a=!0),t.length&&n&&(s.isfms||!a)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,n=!1),t.push(o),i=i||d,n=n||a}t.length&&(Or.pendingUnits={units:t,vcl:n,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,n=null;if(t.forEach((e=>{const t=31&e[0];switch(t){case Ve:Or.pps=e;break;case We:Or.sps=e;break;case Ke:n=e}if(Mr(t)){const t=tr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Or.isSendSeqHeader&&Or.sps&&Or.pps){Or.isSendSeqHeader=!0;const e=Dr({sps:Or.sps,pps:Or.pps});si.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null}if(Or.isSendSeqHeader){if(Or.sps&&Or.pps){const e=Dr({sps:Or.sps,pps:Or.pps}),t=Or.localDts;si.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null}if(i){const e=Or.getNaluDts(),t=Fr(i,r);si._opt.isEmitSEI&&n&&postMessage({cmd:Z,buffer:n,ts:e},[n.buffer]),Or.doDecode(t,{type:ae,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames(e){let t=[],r=[],i=!1,n=!1;Or.pendingUnits.units&&(t=Or.pendingUnits.units,n=Or.pendingUnits.vcl,i=Or.pendingUnits.iFrame,Or.pendingUnits={});let s={};for(let o of e){if(o.byteLength<4)continue;const e=Xr(o);let a=!1,d=Qr(e);Jr(e)&&(s=this.parseVideo265Header(o),a=!0),t.length&&n&&(s.isfms||!a)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,n=!1),t.push(o),i=i||d,n=n||a}t.length&&(Or.pendingUnits={units:t,vcl:n,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,n=null;if(t.forEach((e=>{const t=e[0]>>>1&63;switch(t){case lt:Or.pps=e;break;case at:Or.sps=e;break;case st:Or.vps=e;break;case ft:case ht:n=e}if(Jr(t)){const t=tr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Or.isSendSeqHeader&&Or.sps&&Or.pps&&Or.vps){Or.isSendSeqHeader=!0;const e=qr({sps:Or.sps,pps:Or.pps,vps:Or.vps});si.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null,Or.vps=null}if(Or.isSendSeqHeader){if(Or.sps&&Or.pps&&Or.vps){const e=qr({sps:Or.sps,pps:Or.pps,vps:Or.vps}),t=Or.localDts;si.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null,Or.vps=null}if(i){const e=Or.getNaluDts(),t=Kr(i,r);si._opt.isEmitSEI&&n&&postMessage({cmd:Z,buffer:n,ts:e},[n.buffer]),Or.doDecode(t,{type:ae,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames_1(e){e.forEach((e=>{Or.handleVideoNalu(e)}))},parseVideo264Header(e){const t=new Gn(e);return t.readUByte(),{isfms:0===t.readUEG(),sType:t.readUEG()}},parseVideo265Header(e){const t=new Gn(e);return t.readUByte(),{nalType:t.readBits(6),isfms:0===t.readBits(1),sType:t.readBits(3)}}},Gr={LOG_NAME:"worker fmp4Demuxer",mp4Box:null,offset:0,videoTrackId:null,audioTrackId:null,isHevc:!1,listenMp4Box(){Gr.mp4Box=$i.createFile(),Gr.mp4Box.onReady=Gr.onReady,Gr.mp4Box.onError=Gr.onError,Gr.mp4Box.onSamples=Gr.onSamples},initTransportDescarmber(){Gr.transportDescarmber=new Hi},_getSeqHeader(e){const t=Gr.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new $i.DataStream(void 0,0,$i.DataStream.BIG_ENDIAN);let r=[];e.avcC?(e.avcC.write(t),r=[23,0,0,0,0]):(Gr.isHevc=!0,si.isHevc=!0,e.hvcC.write(t),r=[28,0,0,0,0]);const i=new Uint8Array(t.buffer,8),n=new Uint8Array(r.length+i.length);return n.set(r,0),n.set(i,r.length),n}return null},onReady(e){si.debugLog(Gr.LOG_NAME,"onReady()");const t=e.videoTracks[0],r=e.audioTracks[0];if(t){Gr.videoTrackId=t.id;const e=Gr._getSeqHeader(t);e&&(si.debugLog(Gr.LOG_NAME,"seqHeader"),si.decodeVideo(e,0,!0,0)),Gr.mp4Box.setExtractionOptions(t.id)}if(r&&si._opt.hasAudio){Gr.audioTrackId=r.id;const e=r.audio||{},t=Vt.indexOf(e.sample_rate),i=r.codec.replace("mp4a.40.","");Gr.mp4Box.setExtractionOptions(r.id);const n=jt({profile:parseInt(i,10),sampleRate:t,channel:e.channel_count});si.debugLog(Gr.LOG_NAME,"aacADTSHeader"),si.decodeAudio(n,0)}Gr.mp4Box.start()},onError(e){si.debugError(Gr.LOG_NAME,"mp4Box onError",e)},onSamples(e,t,r){if(e===Gr.videoTrackId){for(const e of r){const t=e.data,r=e.is_sync,i=1e3*e.cts/e.timescale;e.duration,e.timescale,r&&si.calcIframeIntervalTimestamp(i);let n=null;n=Gr.isHevc?Kr(t,r):Fr(t,r),si.decode(n,{type:ae,ts:i,isIFrame:r,cts:0})}Gr.mp4Box.removeUsedSamples(e)}else if(e===Gr.audioTrackId){if(si._opt.hasAudio){for(const e of r){const t=e.data,r=1e3*e.cts/e.timescale;e.duration,e.timescale;const i=new Uint8Array(t.byteLength+2);i.set([175,1],0),i.set(t,2),si.decode(i,{type:oe,ts:r,isIFrame:!1,cts:0})}Gr.mp4Box.removeUsedSamples(e)}}else si.debugWarn(Gr.LOG_NAME,"onSamples() trackId error",e)},dispatch(e){let t=new Uint8Array(e);Gr.transportDescarmber&&(t=Gr.transportDescarmber.transport(t)),t.buffer.fileStart=Gr.offset,Gr.offset+=t.byteLength,Gr.mp4Box.appendBuffer(t.buffer)},destroy(){Gr.mp4Box&&(Gr.mp4Box.stop(),Gr.mp4Box.flush(),Gr.mp4Box.destroy(),Gr.mp4Box=null),Gr.transportDescarmber&&(Gr.transportDescarmber.destroy(),Gr.transportDescarmber=null),Gr.offset=0,Gr.videoTrackId=null,Gr.audioTrackId=null,Gr.isHevc=!1}},jr={LOG_NAME:"worker mpeg4Demuxer",lastBuffer:new Uint8Array(0),parsedOffset:0,firstStartCodeOffset:0,secondStartCodeOffset:0,state:"init",hasInitVideoCodec:!1,localDts:0,dispatch(e){const t=new Uint8Array(e);jr.extractNALu(t)},destroy(){jr.lastBuffer=new Uint8Array(0),jr.parsedOffset=0,jr.firstStartCodeOffset=0,jr.secondStartCodeOffset=0,jr.state="init",jr.hasInitVideoCodec=!1,jr.localDts=0},extractNALu(e){if(!e||e.byteLength<1)return void si.debugWarn(jr.LOG_NAME,"extractNALu() buffer error",e);const t=new Uint8Array(jr.lastBuffer.length+e.length);for(t.set(jr.lastBuffer,0),t.set(new Uint8Array(e),jr.lastBuffer.length),jr.lastBuffer=t;;){if("init"===jr.state){let e=!1;for(;jr.lastBuffer.length-jr.parsedOffset>=4;)if(0===jr.lastBuffer[jr.parsedOffset])if(0===jr.lastBuffer[jr.parsedOffset+1])if(1===jr.lastBuffer[jr.parsedOffset+2]){if(182===jr.lastBuffer[jr.parsedOffset+3]){jr.state="findFirstStartCode",jr.firstStartCodeOffset=jr.parsedOffset,jr.parsedOffset+=4,e=!0;break}jr.parsedOffset++}else jr.parsedOffset++;else jr.parsedOffset++;else jr.parsedOffset++;if(e)continue;break}if("findFirstStartCode"===jr.state){let e=!1;for(;jr.lastBuffer.length-jr.parsedOffset>=4;)if(0===jr.lastBuffer[jr.parsedOffset])if(0===jr.lastBuffer[jr.parsedOffset+1])if(1===jr.lastBuffer[jr.parsedOffset+2]){if(182===jr.lastBuffer[jr.parsedOffset+3]){jr.state="findSecondStartCode",jr.secondStartCodeOffset=jr.parsedOffset,jr.parsedOffset+=4,e=!0;break}jr.parsedOffset++}else jr.parsedOffset++;else jr.parsedOffset++;else jr.parsedOffset++;if(e)continue;break}if("findSecondStartCode"===jr.state){if(!(jr.lastBuffer.length-jr.parsedOffset>0))break;{let e,t,r=192&jr.lastBuffer[jr.parsedOffset];e=0==r?jr.secondStartCodeOffset-14:jr.secondStartCodeOffset;let i=0==(192&jr.lastBuffer[jr.firstStartCodeOffset+4]);if(i){if(jr.firstStartCodeOffset-14<0)return void si.debugWarn(jr.LOG_NAME,"firstStartCodeOffset -14 is",jr.firstStartCodeOffset-14);jr.hasInitVideoCodec||(jr.hasInitVideoCodec=!0,si.debugLog(jr.LOG_NAME,"setCodec"),ai.setCodec(Re,"")),t=jr.lastBuffer.subarray(jr.firstStartCodeOffset-14,e)}else t=jr.lastBuffer.subarray(jr.firstStartCodeOffset,e);let n=jr.getNaluDts();jr.hasInitVideoCodec?(postMessage({cmd:O,type:Be,value:t.byteLength}),postMessage({cmd:O,type:ke,value:n}),Se=n,ai.decode(t,i?1:0,n)):si.debugWarn(jr.LOG_NAME,"has not init video codec"),jr.lastBuffer=jr.lastBuffer.subarray(e),jr.firstStartCodeOffset=0==r?14:0,jr.parsedOffset=jr.firstStartCodeOffset+4,jr.state="findFirstStartCode"}}}},getNaluDts(){let e=jr.localDts;return jr.localDts=jr.localDts+40,e}},ii={TAG_NAME:"worker TsLoaderV2",first_parse_:!0,tsPacketSize:0,syncOffset:0,pmt_:null,config_:null,media_info_:new $n,timescale_:90,duration_:0,pat_:{version_number:0,network_pid:0,program_map_pid:{}},current_program_:null,current_pmt_pid_:-1,program_pmt_map_:{},pes_slice_queues_:{},section_slice_queues_:{},video_metadata_:{vps:null,sps:null,pps:null,details:null},audio_metadata_:{codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},last_pcr_:null,audio_last_sample_pts_:void 0,aac_last_incomplete_data_:null,has_video_:!1,has_audio_:!1,video_init_segment_dispatched_:!1,audio_init_segment_dispatched_:!1,video_metadata_changed_:!1,audio_metadata_changed_:!1,loas_previous_frame:null,video_track_:{type:"video",id:1,sequenceNumber:0,samples:[],length:0},audio_track_:{type:"audio",id:2,sequenceNumber:0,samples:[],length:0},_remainingPacketData:null,init(){},destroy(){ii.media_info_=null,ii.pes_slice_queues_=null,ii.section_slice_queues_=null,ii.video_metadata_=null,ii.audio_metadata_=null,ii.aac_last_incomplete_data_=null,ii.video_track_=null,ii.audio_track_=null,ii._remainingPacketData=null},probe(e){let t=new Uint8Array(e),r=-1,i=188;if(t.byteLength<=3*i)return{needMoreData:!0};for(;-1===r;){let e=Math.min(1e3,t.byteLength-3*i);for(let n=0;n=4&&(r-=4),{match:!0,consumed:0,ts_packet_size:i,sync_offset:r})},_initPmt:()=>({program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}),dispatch(e){ii._remainingPacketData&&(e=fn(ii._remainingPacketData,e),ii._remainingPacketData=null);let t=e.buffer;const r=ii.parseChunks(t);r?ii._remainingPacketData=e.subarray(r):e.length>>6;r[1];let s=(31&r[1])<<8|r[2],o=(48&r[3])>>>4,a=15&r[3],d=!(!ii.pmt_||ii.pmt_.pcr_pid!==s),l={},c=4;if(2==o||3==o){let e=r[4];if(e>0&&(d||3==o)&&(l.discontinuity_indicator=(128&r[5])>>>7,l.random_access_indicator=(64&r[5])>>>6,l.elementary_stream_priority_indicator=(32&r[5])>>>5,(16&r[5])>>>4)){let e=300*(r[6]<<25|r[7]<<17|r[8]<<9|r[9]<<1|r[10]>>>7)+((1&r[10])<<8|r[11]);ii.last_pcr_=e}if(2==o||5+e===188){t+=188,204===ii.tsPacketSize&&(t+=16);continue}c=5+e}if(1==o||3==o)if(0===s||s===ii.current_pmt_pid_||null!=ii.pmt_&&ii.pmt_.pid_stream_type[s]===Fn){let r=188-c;ii.handleSectionSlice(e,t+c,r,{pid:s,payload_unit_start_indicator:n,continuity_conunter:a,random_access_indicator:l.random_access_indicator})}else if(null!=ii.pmt_&&null!=ii.pmt_.pid_stream_type[s]){let r=188-c,i=ii.pmt_.pid_stream_type[s];s!==ii.pmt_.common_pids.h264&&s!==ii.pmt_.common_pids.h265&&s!==ii.pmt_.common_pids.adts_aac&&s!==ii.pmt_.common_pids.loas_aac&&s!==ii.pmt_.common_pids.ac3&&s!==ii.pmt_.common_pids.eac3&&s!==ii.pmt_.common_pids.opus&&s!==ii.pmt_.common_pids.mp3&&!0!==ii.pmt_.pes_private_data_pids[s]&&!0!==ii.pmt_.timed_id3_pids[s]&&!0!==ii.pmt_.synchronous_klv_pids[s]&&!0!==ii.pmt_.asynchronous_klv_pids[s]||ii.handlePESSlice(e,t+c,r,{pid:s,stream_type:i,payload_unit_start_indicator:n,continuity_conunter:a,random_access_indicator:l.random_access_indicator})}t+=188,204===ii.tsPacketSize&&(t+=16)}return ii.dispatchAudioVideoMediaSegment(),t},handleSectionSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=ii.section_slice_queues_[i.pid];if(i.payload_unit_start_indicator){let o=n[0];if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t+1,Math.min(r,o));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?ii.emitSectionSlices(s,i):ii.clearSlices(s,i)}for(let a=1+o;a=s.expected_length&&ii.clearSlices(s,i),a+=d.byteLength}}else if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t,Math.min(r,s.expected_length-s.total_length));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?ii.emitSectionSlices(s,i):s.total_length>=s.expected_length&&ii.clearSlices(s,i)}},handlePESSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=n[0]<<16|n[1]<<8|n[2];n[3];let o=n[4]<<8|n[5];if(i.payload_unit_start_indicator){if(1!==s)return void si.debugWarn(ii.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${s}`);let e=ii.pes_slice_queues_[i.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?ii.emitPESSlices(e,i):ii.clearSlices(e,i)),ii.pes_slice_queues_[i.pid]=new Mn,ii.pes_slice_queues_[i.pid].random_access_indicator=i.random_access_indicator}if(null==ii.pes_slice_queues_[i.pid])return;let a=ii.pes_slice_queues_[i.pid];a.slices.push(n),i.payload_unit_start_indicator&&(a.expected_length=0===o?0:o+6),a.total_length+=n.byteLength,a.expected_length>0&&a.expected_length===a.total_length?ii.emitPESSlices(a,i):a.expected_length>0&&a.expected_length>>6,a=t[8];2!==o&&3!==o||(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,s=3===o?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:r);let d,l=9+a;if(0!==n){if(n<3+a)return void si.debugWarn(ii.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");d=n-3-a}else d=t.byteLength-l;let c=t.subarray(l,l+d);switch(e.stream_type){case xn:case Un:ii.parseMP3Payload(c,r);break;case Bn:ii.pmt_.common_pids.opus===e.pid||ii.pmt_.common_pids.ac3===e.pid||ii.pmt_.common_pids.eac3===e.pid||(ii.pmt_.asynchronous_klv_pids[e.pid]?ii.parseAsynchronousKLVMetadataPayload(c,e.pid,i):ii.pmt_.smpte2038_pids[e.pid]?ii.parseSMPTE2038MetadataPayload(c,r,s,e.pid,i):ii.parsePESPrivateDataPayload(c,r,s,e.pid,i));break;case kn:ii.parseADTSAACPayload(c,r);break;case Tn:ii.parseLOASAACPayload(c,r);break;case Cn:case Dn:break;case Pn:ii.pmt_.timed_id3_pids[e.pid]?ii.parseTimedID3MetadataPayload(c,r,s,e.pid,i):ii.pmt_.synchronous_klv_pids[e.pid]&&ii.parseSynchronousKLVMetadataPayload(c,r,s,e.pid,i);break;case Ln:ii.parseH264Payload(c,r,s,e.random_access_indicator);break;case In:ii.parseH265Payload(c,r,s,e.random_access_indicator)}}else if((188===i||191===i||240===i||241===i||255===i||242===i||248===i)&&e.stream_type===Bn){let r,s=6;r=0!==n?n:t.byteLength-s;let o=t.subarray(s,s+r);ii.parsePESPrivateDataPayload(o,void 0,void 0,e.pid,i)}}else si.debugError(ii.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${r}`)},parsePAT(e){let t=e[0];if(0!==t)return void Log.e(ii.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let r=(15&e[1])<<8|e[2];e[3],e[4];let i=(62&e[5])>>>1,n=1&e[5],s=e[6];e[7];let o=null;if(1===n&&0===s)o={version_number:0,network_pid:0,program_pmt_pid:{}},o.version_number=i;else if(o=ii.pat_,null==o)return;let a=r-5-4,d=-1,l=-1;for(let t=8;t<8+a;t+=4){let r=e[t]<<8|e[t+1],i=(31&e[t+2])<<8|e[t+3];0===r?o.network_pid=i:(o.program_pmt_pid[r]=i,-1===d&&(d=r),-1===l&&(l=i))}1===n&&0===s&&(null==ii.pat_&&si.debugLog(ii.TAG_NAME,`Parsed first PAT: ${JSON.stringify(o)}`),ii.pat_=o,ii.current_program_=d,ii.current_pmt_pid_=l)},parsePMT(e){let t=e[0];if(2!==t)return void si.debugError(ii.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let r,i=(15&e[1])<<8|e[2],n=e[3]<<8|e[4],s=(62&e[5])>>>1,o=1&e[5],a=e[6];if(e[7],1===o&&0===a)r=ii._initPmt(),r.program_number=n,r.version_number=s,ii.program_pmt_map_[n]=r;else if(r=ii.program_pmt_map_[n],null==r)return;r.pcr_pid=(31&e[8])<<8|e[9];let d=(15&e[10])<<8|e[11],l=12+d,c=i-9-d-4;for(let t=l;t0){for(let i=t+5;i0)for(let i=t+5;iii.has_video_&&ii.has_audio_?ii.video_init_segment_dispatched_&&ii.audio_init_segment_dispatched_:ii.has_video_&&!ii.has_audio_?ii.video_init_segment_dispatched_:!(ii.has_video_||!ii.has_audio_)&&ii.audio_init_segment_dispatched_,dispatchVideoInitSegment(){let e=ii.video_metadata_.details,t={type:"video"};t.id=ii.video_track_.id,t.timescale=1e3,t.duration=ii.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;let r=t.frameRate.fps_den,i=t.frameRate.fps_num;if(t.refSampleDuration=r/i*1e3,t.codec=e.codec_mimetype,ii.video_metadata_.vps){si.isHevc=!0;let e=ii.video_metadata_.vps.data.subarray(4),r=ii.video_metadata_.sps.data.subarray(4),i=ii.video_metadata_.pps.data.subarray(4);t.hvcc=qr({vps:e,sps:r,pps:i}),0==ii.video_init_segment_dispatched_&&si.debugLog(ii.TAG_NAME,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.hvcc&&si.decodeVideo(t.hvcc,0,!0,0)}else{let e=ii.video_metadata_.sps.data.subarray(4),r=ii.video_metadata_.pps.data.subarray(4);t.avcc=Dr({sps:e,pps:r}),0==ii.video_init_segment_dispatched_&&si.debugLog(ii.TAG_NAME,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.avcc&&si.decodeVideo(t.avcc,0,!0,0)}ii.video_init_segment_dispatched_=!0,ii.video_metadata_changed_=!1;let n=ii.media_info_;n.hasVideo=!0,n.width=t.codecWidth,n.height=t.codecHeight,n.fps=t.frameRate.fps,n.profile=t.profile,n.level=t.level,n.refFrames=e.ref_frames,n.chromaFormat=e.chroma_format_string,n.sarNum=t.sarRatio.width,n.sarDen=t.sarRatio.height,n.videoCodec=t.codec,n.hasAudio&&n.audioCodec?n.mimeType=`video/mp2t; codecs="${n.videoCodec},${n.audioCodec}"`:n.mimeType=`video/mp2t; codecs="${n.videoCodec}"`},dispatchVideoMediaSegment(){ii.isInitSegmentDispatched()&&ii.video_track_.length&&ii._preDoDecode()},dispatchAudioMediaSegment(){ii.isInitSegmentDispatched()&&ii.audio_track_.length&&ii._preDoDecode()},dispatchAudioVideoMediaSegment(){ii.isInitSegmentDispatched()&&(ii.audio_track_.length||ii.video_track_.length)&&ii._preDoDecode()},parseADTSAACPayload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;if(ii.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+ii.aac_last_incomplete_data_.byteLength);t.set(ii.aac_last_incomplete_data_,0),t.set(e,ii.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/ii.timescale_),"aac"===ii.audio_metadata_.codec){if(null==t&&null!=ii.audio_last_sample_pts_)r=1024/ii.audio_metadata_.sampling_frequency*1e3,i=ii.audio_last_sample_pts_+r;else if(null==t)return void si.debugWarn(ii.TAG_NAME,"AAC: Unknown pts");if(ii.aac_last_incomplete_data_&&ii.audio_last_sample_pts_){r=1024/ii.audio_metadata_.sampling_frequency*1e3;let e=ii.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(si.debugWarn(ii.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Zt(e),o=null,a=i;for(;null!=(o=s.readNextAACFrame());){r=1024/o.sampling_frequency*1e3;const e={codec:"aac",data:o};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"aac",audio_object_type:o.audio_object_type,sampling_freq_index:o.sampling_freq_index,sampling_frequency:o.sampling_frequency,channel_config:o.channel_config},ii.dispatchAudioInitSegment(e)):ii.detectAudioMetadataChange(e)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(e)),n=a;let t=Math.floor(a);const i=new Uint8Array(o.data.length+2);i.set([175,1],0),i.set(o.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:oe};ii.audio_track_.samples.push(s),ii.audio_track_.length+=i.byteLength,a+=r}s.hasIncompleteData()&&(ii.aac_last_incomplete_data_=s.getIncompleteData()),n&&(ii.audio_last_sample_pts_=n)},parseLOASAACPayload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;if(ii.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+ii.aac_last_incomplete_data_.byteLength);t.set(ii.aac_last_incomplete_data_,0),t.set(e,ii.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/ii.timescale_),"aac"===ii.audio_metadata_.codec){if(null==t&&null!=ii.audio_last_sample_pts_)r=1024/ii.audio_metadata_.sampling_frequency*1e3,i=ii.audio_last_sample_pts_+r;else if(null==t)return void si.debugWarn(ii.TAG_NAME,"AAC: Unknown pts");if(ii.aac_last_incomplete_data_&&ii.audio_last_sample_pts_){r=1024/ii.audio_metadata_.sampling_frequency*1e3;let e=ii.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(si.debugWarn(ii.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Jt(e),o=null,a=i;for(;null!=(o=s.readNextAACFrame(ar(this.loas_previous_frame)?void 0:this.loas_previous_frame));){ii.loas_previous_frame=o,r=1024/o.sampling_frequency*1e3;const e={codec:"aac",data:o};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"aac",audio_object_type:o.audio_object_type,sampling_freq_index:o.sampling_freq_index,sampling_frequency:o.sampling_frequency,channel_config:o.channel_config},ii.dispatchAudioInitSegment(e)):ii.detectAudioMetadataChange(e)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(e)),n=a;let t=Math.floor(a);const i=new Uint8Array(o.data.length+2);i.set([175,1],0),i.set(o.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:oe};ii.audio_track_.samples.push(s),ii.audio_track_.length+=i.byteLength,a+=r}s.hasIncompleteData()&&(ii.aac_last_incomplete_data_=s.getIncompleteData()),n&&(ii.audio_last_sample_pts_=n)},parseAC3Payload(e,t){},parseEAC3Payload(e,t){},parseOpusPayload(e,t){},parseMP3Payload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;let r=[44100,48e3,32e3,0],i=[22050,24e3,16e3,0],n=[11025,12e3,8e3,0],s=e[1]>>>3&3,o=(6&e[1])>>1;e[2];let a=(12&e[2])>>>2,d=3!=(e[3]>>>6&3)?2:1,l=0,c=34;switch(s){case 0:l=n[a];break;case 2:l=i[a];break;case 3:l=r[a]}switch(o){case 1:c=34;break;case 2:c=33;break;case 3:c=32}const u={};u.object_type=c,u.sample_rate=l,u.channel_count=d,u.data=e;const h={codec:"mp3",data:u};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"mp3",object_type:c,sample_rate:l,channel_count:d},ii.dispatchAudioInitSegment(h)):ii.detectAudioMetadataChange(h)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(h));let f={payload:e,length:e.byteLength,pts:t/ii.timescale_,dts:t/ii.timescale_,type:oe};ii.audio_track_.samples.push(f),ii.audio_track_.length+=e.byteLength},detectAudioMetadataChange(e){if(e.codec!==ii.audio_metadata_.codec)return si.debugLog(ii.TAG_NAME,`Audio: Audio Codecs changed from ${ii.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===ii.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==ii.audio_metadata_.audio_object_type)return si.debugLog(ii.TAG_NAME,`AAC: AudioObjectType changed from ${ii.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==ii.audio_metadata_.sampling_freq_index)return si.debugLog(ii.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==ii.audio_metadata_.channel_config)return si.debugLog(ii.TAG_NAME,`AAC: Channel configuration changed from ${ii.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===ii.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==ii.audio_metadata_.sampling_frequency)return si.debugLog(ii.TAG_NAME,`AC3: Sampling Frequency changed from ${ii.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==ii.audio_metadata_.bit_stream_identification)return si.debugLog(ii.TAG_NAME,`AC3: Bit Stream Identification changed from ${ii.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==ii.audio_metadata_.bit_stream_mode)return si.debugLog(ii.TAG_NAME,`AC3: BitStream Mode changed from ${ii.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==ii.audio_metadata_.channel_mode)return si.debugLog(ii.TAG_NAME,`AC3: Channel Mode changed from ${ii.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==ii.audio_metadata_.low_frequency_effects_channel_on)return si.debugLog(ii.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${ii.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===ii.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==ii.audio_metadata_.sample_rate)return si.debugLog(ii.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==ii.audio_metadata_.channel_count)return si.debugLog(ii.TAG_NAME,`Opus: Channel count changed from ${ii.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===ii.audio_metadata_.codec){const t=e.data;if(t.object_type!==ii.audio_metadata_.object_type)return si.debugLog(ii.TAG_NAME,`MP3: AudioObjectType changed from ${ii.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==ii.audio_metadata_.sample_rate)return si.debugLog(ii.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==ii.audio_metadata_.channel_count)return si.debugLog(ii.TAG_NAME,`MP3: Channel count changed from ${ii.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1},dispatchAudioInitSegment(e){let t={type:"audio"};if(t.id=ii.audio_track_.id,t.timescale=1e3,t.duration=ii.duration_,"aac"===ii.audio_metadata_.codec){let r="aac"===e.codec?e.data:null,i=new On(r);t.audioSampleRate=i.sampling_rate,t.audioSampleRateIndex=i.sampling_index,t.channelCount=i.channel_count,t.codec=i.codec_mimetype,t.originalCodec=i.original_codec_mimetype,t.config=i.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale;const n=jt({profile:si._opt.mseDecodeAudio?i.object_type:i.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});si.decodeAudio(n,0)}else"ac-3"===ii.audio_metadata_.codec||"ec-3"===ii.audio_metadata_.codec||"opus"===ii.audio_metadata_.codec||"mp3"===ii.audio_metadata_.codec&&(t.audioSampleRate=ii.audio_metadata_.sample_rate,t.channelCount=ii.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==ii.audio_init_segment_dispatched_&&si.debugLog(ii.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),ii.audio_init_segment_dispatched_=!0,ii.video_metadata_changed_=!1;let r=ii.media_info_;r.hasAudio=!0,r.audioCodec=t.originalCodec,r.audioSampleRate=t.audioSampleRate,r.audioChannelCount=t.channelCount,r.hasVideo&&r.videoCodec?r.mimeType=`video/mp2t; codecs="${r.videoCodec},${r.audioCodec}"`:r.mimeType=`video/mp2t; codecs="${r.audioCodec}"`},dispatchPESPrivateDataDescriptor(e,t,r){},parsePESPrivateDataPayload(e,t,r,i,n){let s=new zn;if(s.pid=i,s.stream_id=n,s.len=e.byteLength,s.data=e,null!=t){let e=Math.floor(t/ii.timescale_);s.pts=e}else s.nearest_pts=ii.getNearestTimestampMilliseconds();if(null!=r){let e=Math.floor(r/ii.timescale_);s.dts=e}},parseTimedID3MetadataPayload(e,t,r,i,n){si.debugLog(ii.TAG_NAME,`Timed ID3 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseSynchronousKLVMetadataPayload(e,t,r,i,n){si.debugLog(ii.TAG_NAME,`Synchronous KLV Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseAsynchronousKLVMetadataPayload(e,t,r){si.debugLog(ii.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${r}`)},parseSMPTE2038MetadataPayload(e,t,r,i,n){si.debugLog(ii.TAG_NAME,`SMPTE 2038 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},getNearestTimestampMilliseconds:()=>null!=ii.audio_last_sample_pts_?Math.floor(ii.audio_last_sample_pts_):null!=ii.last_pcr_?Math.floor(ii.last_pcr_/300/ii.timescale_):void 0,_preDoDecode(){const e=ii.video_track_,t=ii.audio_track_;let r=e.samples;t.samples.length>0&&(r=e.samples.concat(t.samples),r=r.sort(((e,t)=>e.dts-t.dts))),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===ae?ii._doDecodeVideo({...e,payload:t}):e.type===oe&&ii._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0},_doDecodeVideo(e){const t=new Uint8Array(e.payload);let r=null;r=e.isHevc?Kr(t,e.isIFrame):Fr(t,e.isIFrame),e.isIFrame&&si.calcIframeIntervalTimestamp(e.dts);let i=si.cryptoPayload(r,e.isIFrame);si.decode(i,{type:ae,ts:e.dts,isIFrame:e.isIFrame,cts:e.cts})},_doDecodeAudio(e){const t=new Uint8Array(e.payload);let r=t;gr(si._opt.m7sCryptoAudio)&&(r=si.cryptoPayloadAudio(t)),si.decode(r,{type:oe,ts:e.dts,isIFrame:!1,cts:0})}},ni=null;vr()&&(ni={TAG_NAME:"worker MediaSource",_resetInIt(){ni.isAvc=null,ni.isAAC=null,ni.videoInfo={},ni.videoMeta={},ni.audioMeta={},ni.sourceBuffer=null,ni.audioSourceBuffer=null,ni.hasInit=!1,ni.hasAudioInit=!1,ni.isAudioInitInfo=!1,ni.videoMimeType="",ni.audioMimeType="",ni.cacheTrack={},ni.cacheAudioTrack={},ni.timeInit=!1,ni.sequenceNumber=0,ni.audioSequenceNumber=0,ni.firstRenderTime=null,ni.firstAudioTime=null,ni.mediaSourceAppendBufferFull=!1,ni.mediaSourceAppendBufferError=!1,ni.mediaSourceAddSourceBufferError=!1,ni.mediaSourceBufferError=!1,ni.mediaSourceError=!1,ni.prevTimestamp=null,ni.decodeDiffTimestamp=null,ni.prevDts=null,ni.prevAudioDts=null,ni.prevPayloadBufferSize=0,ni.isWidthOrHeightChanged=!1,ni.prevTs=null,ni.prevAudioTs=null,ni.eventListenList=[],ni.pendingRemoveRanges=[],ni.pendingSegments=[],ni.pendingAudioRemoveRanges=[],ni.pendingAudioSegments=[],ni.supportVideoFrameCallbackHandle=null,ni.audioSourceBufferCheckTimeout=null,ni.audioSourceNoDataCheckTimeout=null,ni.hasPendingEos=!1,ni.$video={currentTime:0,readyState:0}},init(){ni.events=new pn,ni._resetInIt(),ni.mediaSource=new self.MediaSource,ni.isDecodeFirstIIframe=!!yr(si._opt.checkFirstIFrame),ni._bindMediaSourceEvents()},destroy(){ni.stop(),ni._clearAudioSourceBufferCheckTimeout(),ni.eventListenList&&ni.eventListenList.length&&(ni.eventListenList.forEach((e=>e())),ni.eventListenList=[]),ni._resetInIt(),ni.mediaSource=null},getState:()=>ni.mediaSource&&ni.mediaSource.readyState,isStateOpen:()=>ni.getState()===vt,isStateClosed:()=>ni.getState()===bt,isStateEnded:()=>ni.getState()===yt,_bindMediaSourceEvents(){const{proxy:e}=ni.events,t=e(ni.mediaSource,St,(()=>{si.debugLog(ni.TAG_NAME,"sourceOpen"),ni._onMediaSourceSourceOpen()})),r=e(ni.mediaSource,wt,(()=>{si.debugLog(ni.TAG_NAME,"sourceClose")})),i=e(ni.mediaSource,Et,(()=>{si.debugLog(ni.TAG_NAME,"sourceended")}));ni.eventListenList.push(t,r,i)},_onMediaSourceSourceOpen(){ni.sourceBuffer||(si.debugLog(ni.TAG_NAME,"onMediaSourceSourceOpen() sourceBuffer is null and next init"),ni._initSourceBuffer()),ni.audioSourceBuffer||(si.debugLog(ni.TAG_NAME,"onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),ni._initAudioSourceBuffer()),ni._hasPendingSegments()&&ni._doAppendSegments()},decodeVideo(e,t,r,i){if(si.isDestroyed)si.debugWarn(ni.TAG_NAME,"decodeVideo() and decoder is destroyed");else if(yr(ni.hasInit))if(r&&e[1]===Bt){const i=15&e[0];if(i===Me&&yr(si._opt.supportMSEDecodeHevc))return void ni.emitError(Fe.mediaSourceH265NotSupport);ni.videoInfo.codec=i,postMessage({cmd:M,code:i});const n=new Uint8Array(e);postMessage({cmd:R,buffer:n,codecId:i},[n.buffer]),ni.hasInit=ni._decodeConfigurationRecord(e,t,r,i)}else si.debugWarn(ni.TAG_NAME,`decodeVideo has not init , isIframe is ${r} , payload is ${e[1]} so drop this frame`);else if(!ni.isDecodeFirstIIframe&&r&&(ni.isDecodeFirstIIframe=!0),ni.isDecodeFirstIIframe){if(r&&0===e[1]){const t=15&e[0];let r={};t===Ie?r=Tr(e.slice(5)):t===Me&&(r=Wr(e));const i=ni.videoInfo;i&&i.codecWidth&&i.codecWidth&&r&&r.codecWidth&&r.codecHeight&&(r.codecWidth!==i.codecWidth||r.codecHeight!==i.codecWidth)&&(si.debugWarn(ni.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${i.codecWidth}, old height is ${i.codecHeight},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),ni.isWidthOrHeightChanged=!0,ni.emitError(Fe.mseWidthOrHeightChange,`width: ${i.codecWidth}->${r.codecWidth}, height: ${i.codecWidth}->${r.codecHeight}`))}if(ni.isWidthOrHeightChanged)return void si.debugWarn(ni.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(_r(e))return void si.debugLog(ni.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLengthni.prevTs>0&&eA,_decodeConfigurationRecord(e,t,r,i){let n=e.slice(5),s={};if(i===Ie?s=Tr(n):i===Me&&(s=Vr(n)),ni.videoInfo.width=s.codecWidth,ni.videoInfo.height=s.codecHeight,0===s.codecWidth&&0===s.codecHeight)return si.debugWarn(ni.TAG_NAME,"_decodeConfigurationRecord error",JSON.stringify(s)),ni.emitError(Fe.mediaSourceDecoderConfigurationError,`width is ${0===s.codecWidth} and height is ${s.codecHeight}`),!1;const o={id:Ft,type:"video",timescale:1e3,duration:0,avcc:n,codecWidth:s.codecWidth,codecHeight:s.codecHeight,videoType:s.videoType},a=mn.generateInitSegment(o);ni.isAvc=i===Ie;let d=s.codec;return ni.videoMimeType=d?`video/mp4; codecs="${s.codec}"`:ni.isAvc?_t:gt,postMessage({cmd:T,w:s.codecWidth,h:s.codecHeight}),ni._initSourceBuffer(),ni.appendBuffer(a.buffer),ni.sequenceNumber=0,ni.cacheTrack={},ni.timeInit=!1,!0},_decodeAudioConfigurationRecord(e,t){const r=e[0]>>4,i=e[0]>>1&1,n=r===He,s=r===$e;if(yr(s||n))return si.debugWarn(ni.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${r} ant auto wasm decode`),ni.emitError(Fe.mediaSourceAudioG711NotSupport),!1;const o={id:Lt,type:"audio",timescale:1e3};let a={};if(qt(e)){if(a=Xt(e.slice(2)),!a)return!1;o.audioSampleRate=a.sampleRate,o.channelCount=a.channelCount,o.config=a.config,o.refSampleDuration=1024/o.audioSampleRate*o.timescale}else{if(!n)return!1;if(a=An(e),!a)return!1;o.audioSampleRate=a.samplingRate,o.channelCount=a.channelCount,o.refSampleDuration=1152/o.audioSampleRate*o.timescale}o.codec=a.codec,o.duration=0;let d="mp4",l=a.codec,c=null;n&&yr(si._opt.isFirefox)?(d="mpeg",l="",c=new Uint8Array):c=mn.generateInitSegment(o);let u=`${o.type}/${d}`;return l&&l.length>0&&(u+=`;codecs=${l}`),yr(ni.isAudioInitInfo)&&(wr=r===$e?i?16:8:0===i?8:16,postMessage({cmd:F,code:r}),postMessage({cmd:P,sampleRate:o.audioSampleRate,channels:o.channelCount,depth:wr}),ni.isAudioInitInfo=!0),ni.audioMimeType=u,ni.isAAC=s,ni._initAudioSourceBuffer(),ni.appendAudioBuffer(c.buffer),!0},_initSourceBuffer(){const{proxy:e}=ni.events;if(null===ni.sourceBuffer&&null!==ni.mediaSource&&ni.isStateOpen()&&ni.videoMimeType){try{si.debugLog(ni.TAG_NAME,"_initSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",ni.videoMimeType),ni.sourceBuffer=ni.mediaSource.addSourceBuffer(ni.videoMimeType)}catch(e){return si.debugError(ni.TAG_NAME,"_initSourceBuffer() appendBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),ni.emitError(Fe.mseWorkerAddSourceBufferError,e.code),void(ni.mediaSourceAddSourceBufferError=!0)}if(ni.sourceBuffer){const t=e(ni.sourceBuffer,"error",(e=>{ni.mediaSourceBufferError=!0,si.debugError(ni.TAG_NAME,"mseSourceBufferError mseDecoder.sourceBuffer",e,e.toString()),ni.emitError(Fe.mseSourceBufferError,e.code)})),r=e(ni.sourceBuffer,"updateend",(()=>{ni._hasPendingRemoveRanges()?ni._doRemoveRanges():ni._hasPendingSegments()?ni._doAppendSegments():ni.hasPendingEos&&(si.debugLog(ni.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),ni.endOfStream())}));ni.eventListenList.push(t,r)}}else si.debugLog(ni.TAG_NAME,`_initSourceBuffer and mseDecoder.isStateOpen is ${ni.isStateOpen()} and mseDecoder.isAvc === null is ${null===ni.isAvc}`)},_initAudioSourceBuffer(){const{proxy:e}=ni.events;if(null===ni.audioSourceBuffer&&null!==ni.mediaSource&&ni.isStateOpen()&&ni.audioMimeType){try{si.debugLog(ni.TAG_NAME,"_initAudioSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",ni.audioMimeType),ni._clearAudioSourceBufferCheckTimeout(),ni.audioSourceBuffer=ni.mediaSource.addSourceBuffer(ni.audioMimeType)}catch(e){return si.debugError(ni.TAG_NAME,"_initAudioSourceBuffer() addSourceBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),ni.emitError(Fe.mseWorkerAddSourceBufferError,e.code),void(ni.mediaSourceAddSourceBufferError=!0)}if(ni.audioSourceBuffer){const t=e(ni.audioSourceBuffer,"error",(e=>{ni.mediaSourceBufferError=!0,si.debugError(ni.TAG_NAME,"mseSourceBufferError mseDecoder.audioSourceBuffer",e.code,e.toString(),e),ni.emitError(Fe.mseSourceBufferError,e.code)})),r=e(ni.audioSourceBuffer,"updateend",(()=>{ni._hasPendingRemoveRanges()?ni._doRemoveRanges():ni._hasPendingSegments()?ni._doAppendSegments():ni.hasPendingEos&&(si.debugLog(ni.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),ni.endOfStream())}));ni.eventListenList.push(t,r),null===ni.audioSourceNoDataCheckTimeout&&(ni.audioSourceNoDataCheckTimeout=setTimeout((()=>{ni._clearAudioNoDataCheckTimeout(),ni.emitError(Fe.mediaSourceAudioNoDataTimeout)}),1e3))}}else si.debugLog(ni.TAG_NAME,`_initAudioSourceBuffer and mseDecoder.isStateOpen is ${ni.isStateOpen()} and mseDecoder.audioMimeType is ${ni.audioMimeType}`)},_decodeVideo(e,t,r,i,n){let s=e.slice(5),o=s.byteLength;if(0===o)return void si.debugWarn(ni.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let a=(new Date).getTime(),d=!1;ni.prevTimestamp||(ni.prevTimestamp=a,d=!0);const l=a-ni.prevTimestamp;if(ni.decodeDiffTimestamp=l,l>1e3&&!d&&si.isPlayer&&si.debugLog(ni.TAG_NAME,`_decodeVideo now time is ${a} and prev time is ${ni.prevTimestamp}, diff time is ${l} ms`),ni.cacheTrack.id&&t>=ni.cacheTrack.dts){let e=8+ni.cacheTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(mn.types.mdat,4),r.set(ni.cacheTrack.data,8),ni.cacheTrack.duration=t-ni.cacheTrack.dts;let i=mn.moof(ni.cacheTrack,ni.cacheTrack.dts);ni.cacheTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),ni.appendBuffer(n.buffer)}else si.debugLog(ni.TAG_NAME,`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${n} cacheTrack dts is ${ni.cacheTrack&&ni.cacheTrack.dts}`),ni.timeInit=!1,ni.cacheTrack={};ni.cacheTrack||(ni.cacheTrack={}),ni.cacheTrack.id=Ft,ni.cacheTrack.sequenceNumber=++ni.sequenceNumber,ni.cacheTrack.size=o,ni.cacheTrack.dts=t,ni.cacheTrack.cts=i,ni.cacheTrack.isKeyframe=r,ni.cacheTrack.data=s,ni.cacheTrack.flags={isLeading:0,dependsOn:r?2:1,isDependedOn:r?1:0,hasRedundancy:0,isNonSync:r?0:1},ni.prevTimestamp=(new Date).getTime()},_decodeAudio(e,t,r){let i=ni.isAAC?e.slice(2):e.slice(1),n=i.byteLength;if(ni.cacheAudioTrack.id&&t>=ni.cacheAudioTrack.dts){let e=8+ni.cacheAudioTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(mn.types.mdat,4),r.set(ni.cacheAudioTrack.data,8),ni.cacheAudioTrack.duration=t-ni.cacheAudioTrack.dts;let i=mn.moof(ni.cacheAudioTrack,ni.cacheAudioTrack.dts);ni.cacheAudioTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),ni.appendAudioBuffer(n.buffer)}else ni.cacheAudioTrack={};ni.cacheAudioTrack||(ni.cacheAudioTrack={}),ni.cacheAudioTrack.id=Lt,ni.cacheAudioTrack.sequenceNumber=++ni.audioSequenceNumber,ni.cacheAudioTrack.size=n,ni.cacheAudioTrack.dts=t,ni.cacheAudioTrack.cts=0,ni.cacheAudioTrack.data=i,ni.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}},appendBuffer(e){si.isDestroyed?si.debugWarn(ni.TAG_NAME,"appendBuffer() player is destroyed"):ni.mediaSourceAddSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):ni.mediaSourceAppendBufferFull?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):ni.mediaSourceAppendBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):ni.mediaSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(ni.pendingSegments.push(e),ni.sourceBuffer&&(si._opt.mseAutoCleanupSourceBuffer&&ni._needCleanupSourceBuffer()&&ni._doCleanUpSourceBuffer(),yr(ni.getSourceBufferUpdating())&&ni.isStateOpen()&&yr(ni._hasPendingRemoveRanges()))?ni._doAppendSegments():ni.isStateClosed()?(ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):ni.isStateEnded()&&(ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,"mediaSource is end")))},appendAudioBuffer(e){si.isDestroyed?si.debugWarn(ni.TAG_NAME,"appendAudioBuffer() player is destroyed"):ni.mediaSourceAddSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):ni.mediaSourceAppendBufferFull?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):ni.mediaSourceAppendBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):ni.mediaSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(ni.pendingAudioSegments.push(e),ni.audioSourceBuffer&&(si._opt.mseAutoCleanupSourceBuffer&&ni._needCleanupSourceBuffer()&&ni._doCleanUpSourceBuffer(),yr(ni.getAudioSourceBufferUpdating())&&ni.isStateOpen()&&yr(ni._hasPendingRemoveRanges()))?ni._doAppendSegments():ni.isStateClosed()?(ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):ni.isStateEnded()&&(ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,"mediaSource is end")))},getSourceBufferUpdating:()=>ni.sourceBuffer&&ni.sourceBuffer.updating,getAudioSourceBufferUpdating:()=>ni.audioSourceBuffer&&ni.audioSourceBuffer.updating,stop(){ni.abortSourceBuffer(),ni.removeSourceBuffer(),ni.endOfStream()},clearUpAllSourceBuffer(){if(ni.sourceBuffer){const e=ni.sourceBuffer.buffered;for(let t=0;tni.pendingSegments.length>0||ni.pendingAudioSegments.length>0,getPendingSegmentsLength:()=>ni.pendingSegments.length,_handleUpdatePlaybackRate(){},_doAppendSegments(){if(ni.isStateClosed()||ni.isStateEnded())si.debugLog(ni.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==ni.sourceBuffer){if(ni.needInitAudio()&&null===ni.audioSourceBuffer)return si.debugLog(ni.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===ni.audioSourceBufferCheckTimeout&&(ni.audioSourceBufferCheckTimeout=setTimeout((()=>{ni._clearAudioSourceBufferCheckTimeout(),ni.emitError(Fe.mediaSourceAudioInitTimeout)}),1e3)));if(yr(ni.getSourceBufferUpdating())&&ni.pendingSegments.length>0){const e=ni.pendingSegments.shift();try{ni.sourceBuffer.appendBuffer(e)}catch(e){si.debugError(ni.TAG_NAME,"mseDecoder.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(ni.stop(),ni.mediaSourceAppendBufferFull=!0,ni.emitError(Fe.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(ni.stop(),ni.mediaSourceAppendBufferError=!0,ni.emitError(Fe.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(ni.stop(),ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,`code is ${e.code} , message is ${e.message}`))}}if(yr(ni.getAudioSourceBufferUpdating())&&ni.pendingAudioSegments.length>0){const e=ni.pendingAudioSegments.shift();try{ni.audioSourceBuffer.appendBuffer(e)}catch(e){si.debugError(ni.TAG_NAME,"mseDecoder.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(ni.stop(),ni.mediaSourceAppendBufferFull=!0,ni.emitError(Fe.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(ni.stop(),ni.mediaSourceAppendBufferError=!0,ni.emitError(Fe.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(ni.stop(),ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,e.code,`code is ${e.code} , message is ${e.message}`))}}}else si.debugLog(ni.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")},_doCleanUpSourceBuffer(){const e=ni.$video.currentTime;if(ni.sourceBuffer){const t=ni.sourceBuffer.buffered;let r=!1;for(let i=0;i=si._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-si._opt.mseAutoCleanupMinBackwardDuration;ni.pendingRemoveRanges.push({start:n,end:t})}}else s=si._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-si._opt.mseAutoCleanupMinBackwardDuration;ni.pendingAudioRemoveRanges.push({start:n,end:t})}}else sni.pendingRemoveRanges.length>0||ni.pendingAudioRemoveRanges.length>0,needInitAudio:()=>si._opt.hasAudio&&si._opt.mseDecodeAudio,_doRemoveRanges(){if(ni.sourceBuffer&&yr(ni.getSourceBufferUpdating())){let e=ni.pendingRemoveRanges;for(;e.length&&yr(ni.getSourceBufferUpdating());){let t=e.shift();try{ni.sourceBuffer.remove(t.start,t.end)}catch(e){si.debugWarn(ni.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e,e.toString())}}}if(ni.audioSourceBuffer&&yr(ni.getAudioSourceBufferUpdating())){let e=ni.pendingAudioRemoveRanges;for(;e.length&&yr(ni.getAudioSourceBufferUpdating());){let t=e.shift();try{ni.audioSourceBuffer.remove(t.start,t.end)}catch(e){si.debugWarn(ni.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e,e.toString())}}}},_getPlaybackRate(){},_needCleanupSourceBuffer(){if(yr(si._opt.mseAutoCleanupSourceBuffer))return!1;const e=ni.$video.currentTime;if(ni.sourceBuffer){let t=ni.sourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=si._opt.mseAutoCleanupMaxBackwardDuration)return!0}if(ni.audioSourceBuffer){let t=ni.audioSourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=si._opt.mseAutoCleanupMaxBackwardDuration)return!0}return!1},_clearAudioSourceBufferCheckTimeout(){ni.audioSourceBufferCheckTimeout&&(clearTimeout(ni.audioSourceBufferCheckTimeout),ni.audioSourceBufferCheckTimeout=null)},_clearAudioNoDataCheckTimeout(){ni.audioSourceNoDataCheckTimeout&&(clearTimeout(ni.audioSourceNoDataCheckTimeout),ni.audioSourceNoDataCheckTimeout=null)},getHandle:()=>ni.mediaSource.handle,emitError(e){postMessage({cmd:se,value:e,msg:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""})}});let si={isPlayer:!0,isHevc:null,isPlayback:!1,dropping:!1,isPushDropping:!1,isWorkerFetch:!1,isDestroyed:!1,fetchStatus:Ct,_opt:Ar(),mp3Demuxer:null,delay:-1,pushLatestDelay:-1,firstTimestamp:null,startTimestamp:null,preDelayTimestamp:null,stopId:null,streamFps:null,streamAudioFps:null,streamVideoFps:null,writableStream:null,networkDelay:0,webglObj:null,startStreamRateAndStatsInterval:function(){si.stopStreamRateAndStatsInterval(),l=setInterval((()=>{d&&d(0);const e=JSON.stringify({demuxBufferDelay:si.getVideoBufferLength(),audioDemuxBufferDelay:si.getAudioBufferLength(),streamBufferByteLength:si.getStreamBufferLength(),netBuf:si.networkDelay||0,pushLatestDelay:si.pushLatestDelay||0,latestDelay:si.delay,isStreamTsMoreThanLocal:je,wasmDecodeDelay:Se-Ee});postMessage({cmd:O,type:Ce,value:e})}),1e3)},stopStreamRateAndStatsInterval:function(){l&&(clearInterval(l),l=null)},useOffscreen:function(){return si._opt.useOffscreen&&"undefined"!=typeof OffscreenCanvas},getDelay:function(e,t){if(!e||si._opt.hasVideo&&!B)return-1;if(t===oe)return si.delay;if(si.preDelayTimestamp&&si.preDelayTimestamp>e)return si.preDelayTimestamp-e>1e3&&si.debugWarn("worker",`getDelay() and preDelayTimestamp is ${si.preDelayTimestamp} > timestamp is ${e} more than ${si.preDelayTimestamp-e}ms and return ${si.delay}`),si.preDelayTimestamp=e,si.delay;if(si.firstTimestamp){if(e){const t=Date.now()-si.startTimestamp,r=e-si.firstTimestamp;t>=r?(je=!1,si.delay=t-r):(je=!0,si.delay=r-t)}}else si.firstTimestamp=e,si.startTimestamp=Date.now(),si.delay=-1;return si.preDelayTimestamp=e,si.delay},getDelayNotUpdateDelay:function(e,t){if(!e||si._opt.hasVideo&&!B)return-1;if(t===oe)return si.pushLatestDelay;if(si.preDelayTimestamp&&si.preDelayTimestamp-e>1e3)return si.debugWarn("worker",`getDelayNotUpdateDelay() and preDelayTimestamp is ${si.preDelayTimestamp} > timestamp is ${e} more than ${si.preDelayTimestamp-e}ms and return -1`),-1;if(si.firstTimestamp){let t=-1;if(e){const r=Date.now()-si.startTimestamp,i=e-si.firstTimestamp;r>=i?(je=!1,t=r-i):(je=!0,t=i-r)}return t}return-1},resetDelay:function(){si.firstTimestamp=null,si.startTimestamp=null,si.delay=-1,si.dropping=!1},resetAllDelay:function(){si.resetDelay(),si.preDelayTimestamp=null},doDecode:function(e){si._opt.isEmitSEI&&e.type===ae&&si.isWorkerFetch&&si.findSei(e.payload,e.ts),si.isPlayUseMSEAndDecoderInWorker()?e.type===oe?si._opt.mseDecodeAudio?ni.decodeAudio(e.payload,e.ts):e.decoder.decode(e.payload,e.ts):e.type===ae&&ni.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):si._opt.useWCS&&si.useOffscreen()&&e.type===ae&&s.decode?s.decode(e.payload,e.ts,e.cts):e.decoder.decode(e.payload,e.ts,e.isIFrame,e.cts)},decodeNext(e){if(0===i.length)return;const t=e.ts,n=i[0],s=e.type===ae&&_r(e.payload);if(yr(r))s&&(si.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n isVideoSqeHeader is ${s}`),i.shift(),si.doDecode(n));else{const r=n.ts-t,o=n.type===oe&&e.type===ae;(r<=20||o||s)&&(si.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n diff is ${r} and isVideoAndNextAudio is ${o} and isVideoSqeHeader is ${s}`),i.shift(),si.doDecode(n))}},init:function(){si.debugLog("worker","init and opt is",JSON.stringify(si._opt));const e=si._opt.playType===v,t=si._opt.playType===b;if(Or.init(),si.isPlayer=e,si.isPlayback=t,si.isPlayUseMSEAndDecoderInWorker()&&ni&&ni.init(),s&&si._opt.useWCS&&si.useOffscreen()&&s.init(),yr(si.isPlaybackCacheBeforeDecodeForFpsRender())){si.debugLog("worker","setInterval()");const t=()=>{const t=si._opt.videoBuffer+si._opt.videoBufferDelay;let r=null;if(i.length){if(si.isPushDropping)return void si.debugWarn("worker",`loop() isPushDropping is true and bufferList length is ${i.length}`);if(si.dropping){for(r=i.shift(),si.debugWarn("worker",`loop() dropBuffer is dropping and isIFrame ${r.isIFrame} and delay is ${si.delay} and bufferlist is ${i.length}`);!r.isIFrame&&i.length;)r=i.shift();const e=si.getDelayNotUpdateDelay(r.ts,r.type);r.isIFrame&&e<=si.getNotDroppingDelayTs()&&(si.debugLog("worker","loop() is dropping = false, is iFrame"),si.dropping=!1,si.doDecode(r),si.decodeNext(r))}else if(si.isPlayback||si.isPlayUseMSE()||0===si._opt.videoBuffer)for(;i.length;)r=i.shift(),si.doDecode(r);else if(r=i[0],-1===si.getDelay(r.ts,r.type))si.debugLog("worker","loop() common dumex delay is -1 ,data.ts is",r.ts),i.shift(),si.doDecode(r),si.decodeNext(r);else if(si.delay>t&&e)si.hasIframeInBufferList()?(si.debugLog("worker",`delay is ${si.delay} > maxDelay ${t}, set dropping is true`),si.resetAllDelay(),si.dropping=!0,postMessage({cmd:H})):(i.shift(),si.doDecode(r),si.decodeNext(r));else for(;i.length;){if(r=i[0],!(si.getDelay(r.ts,r.type)>si._opt.videoBuffer)){si.delay<0&&si.debugWarn("worker",`loop() do not decode and delay is ${si.delay}, bufferList is ${i.length}`);break}i.shift(),si.doDecode(r)}}else-1!==si.delay&&si.debugLog("worker","loop() bufferList is empty and reset delay"),si.resetAllDelay()};si.stopId=setInterval((()=>{let e=(new Date).getTime();Je||(Je=e);const r=e-Je;r>100&&si.debugWarn("worker",`loop demux diff time is ${r}`),t(),Je=(new Date).getTime()}),20)}else si.debugLog("worker","playback and playbackIsCacheBeforeDecodeForFpsRender is true");if(yr(si._opt.checkFirstIFrame)&&(B=!0),si.isPlayUseMSEAndDecoderInWorker()&&ni){const e=ni.getHandle();e&&postMessage({cmd:ie,mseHandle:e},[e])}},playbackCacheLoop:function(){si.clearPlaybackCacheLoop();const e=()=>{let e=null;i.length&&(e=i.shift(),si.doDecode(e))};e();const t=Math.ceil(1e3/(si.streamFps*si._opt.playbackRate));si.debugLog("worker",`playbackCacheLoop fragDuration is ${t}, streamFps is ${si.streamFps}, streamAudioFps is ${si.streamAudioFps} ,streamVideoFps is ${si.streamVideoFps} playbackRate is ${si._opt.playbackRate}`),si.stopId=setInterval(e,t)},clearPlaybackCacheLoop:function(){si.stopId&&(clearInterval(si.stopId),si.stopId=null)},startPlaybackCacheLoop:function(){si.playbackCacheLoop()},close:function(){if(si.debugLog("worker","close"),si.isDestroyed=!0,kr(),!a||1!==a.readyState&&2!==a.readyState?a&&si.debugLog("worker",`close() and socket.readyState is ${a.readyState}`):(Sr=!0,a.close(1e3,"Client disconnecting")),a=null,si.stopStreamRateAndStatsInterval(),si.stopId&&(clearInterval(si.stopId),si.stopId=null),si.mp3Demuxer&&(si.mp3Demuxer.destroy(),si.mp3Demuxer=null),si.writableStream&&yr(si.writableStream.locked)&&si.writableStream.close().catch((e=>{si.debugLog("worker","close() and writableStream.close() error",e.toString(),e)})),si.writableStream=null,oi)try{oi.clear&&oi.clear(),oi=null}catch(e){si.debugLog("worker","close() and audioDecoder.clear error",e.toString(),e)}if(ai)try{ai.clear&&ai.clear(),ai=null}catch(e){si.debugLog("worker","close() and videoDecoder.clear error",e.toString())}d=null,Je=null,je=!1,Se=0,Ee=0,s&&(s.destroy&&s.destroy(),s=null),ni&&(ni.destroy(),ni=null),si.firstTimestamp=null,si.startTimestamp=null,si.networkDelay=0,si.streamFps=null,si.streamAudioFps=null,si.streamVideoFps=null,si.delay=-1,si.pushLatestDelay=-1,si.preDelayTimestamp=null,si.dropping=!1,si.isPushDropping=!1,si.isPlayer=!0,si.isPlayback=!1,si.isWorkerFetch=!1,si.isHevc=null,si._opt=Ar(),si.webglObj&&(si.webglObj.destroy(),si.offscreenCanvas.removeEventListener("webglcontextlost",si.onOffscreenCanvasWebglContextLost),si.offscreenCanvas.removeEventListener("webglcontextrestored",si.onOffscreenCanvasWebglContextRestored),si.offscreenCanvas=null,si.offscreenCanvasGL=null,si.offscreenCanvasCtx=null),i=[],n=[],c&&(c.close(),c=null),h=null,f=null,S=!1,E=!1,B=!1,Wt=!1,Kt=!1,Qt=!1,sr=null,it=[],xt=0,kt=0,Qe=null,tt=null,$t=null,Ot=null,wr=null,Gt=0,Ht=0,ut=null,At=null,si.fetchStatus=Ct,Er=!0,Or.destroy(),Gr.destroy(),jr.destroy(),ii.destroy(),si.debug=null,si._opt={},postMessage({cmd:K})},pushBuffer:function(e,t){if(t.type===oe&&qt(e)){if(si.debugLog("worker",`pushBuffer audio ts is ${t.ts}, isAacCodecPacket is true`),si._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:Q,buffer:t},[t.buffer])}si.decodeAudio(e,t.ts)}else if(t.type===ae&&t.isIFrame&&_r(e)){if(si.debugLog("worker",`pushBuffer video ts is ${t.ts}, isVideoSequenceHeader is true`),si._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:ee,buffer:t},[t.buffer])}si.decodeVideo(e,t.ts,t.isIFrame,t.cts)}else{if(si._opt.isRecording)if(si._opt.isRecordTypeFlv){const r=new Uint8Array(e);postMessage({cmd:te,type:t.type,buffer:r,ts:t.ts},[r.buffer])}else if(si._opt.recordType===w)if(t.type===ae){const r=new Uint8Array(e).slice(5);postMessage({cmd:z,buffer:r,isIFrame:t.isIFrame,ts:t.ts,cts:t.cts},[r.buffer])}else if(t.type===oe&&si._opt.isWasmMp4){const r=new Uint8Array(e),i=Yt(r)?r.slice(2):r.slice(1);postMessage({cmd:L,buffer:i,ts:t.ts},[i.buffer])}if(si.isPlayer){if(t.type===ae){if(Gt>0){const e=t.ts-Ot,r=Gt+Gt/2;e>r&&si.debugLog("worker",`pushBuffer video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts}, preTs is ${Ot},\n diff is ${e} and preTsDuration is ${Gt} and maxDiff is ${r}\n maybe trigger black screen or flower screen\n `)}if(null!==Ot&&Ot>=t.ts&&(si.debugWarn("worker",`pushBuffer() and isIFrame is ${t.isIFrame} and,\n options.ts is ${t.ts} less than (or equal) preTs is ${Ot} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${Ht}`),Ot-t.ts>A&&(si.debugWarn("worker",`pushBuffer,\n preTimestamp is ${Ot}, options.ts is ${t.ts},\n diff is ${Ot-t.ts} more than 3600000,\n and resetAllDelay`),si.resetAllDelay(),Ot=null,Gt=0),si._opt.isDropSameTimestampGop&&yr(t.isIFrame)&&B)){const e=si.hasIframeInBufferList(),t=yr(si.isPushDropping);return si.debugLog("worker",`pushBuffer, isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next dropBuffer`),void(e&&t?si.dropBuffer$2():(si.clearBuffer(!0),gr(si._opt.checkFirstIFrame)&&gr(r)&&(si.isPlayUseMSEAndDecoderInWorker()?ni.isDecodeFirstIIframe=!1:postMessage({cmd:re}))))}Ot>0&&(Gt=t.ts-Ot),Ht=e.byteLength,Ot=t.ts}if(B){const e=si._opt.videoBuffer+si._opt.videoBufferDelay,r=si.getDelayNotUpdateDelay(t.ts,t.type);si.pushLatestDelay=r,si.delay>0&&r>e&&si.delay({type:e.type,ts:e.ts})));si.debugLog("worker",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${i.length}, and ts list is ${JSON.stringify(r)}`)}const r=si.getAudioBufferLength()>0,n=r?60:40;i.length>=n&&(si.debugWarn("worker",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${i.length} more than ${n}, and hasAudio is ${r} an set streamFps is 25`),si.streamVideoFps=25,postMessage({cmd:V,value:si.streamVideoFps}),r?(si.streamAudioFps=25,si.streamFps=si.streamVideoFps+si.streamAudioFps):si.streamFps=si.streamVideoFps,si.playbackCacheLoop())}}},getVideoBufferLength(){let e=0;return i.forEach((t=>{t.type===ae&&(e+=1)})),e},hasIframeInBufferList:()=>i.some((e=>e.type===ae&&e.isIFrame)),isAllIframeInBufferList(){const e=si.getVideoBufferLength();let t=0;return i.forEach((e=>{e.type===ae&&e.isIFrame&&(t+=1)})),e===t},getNotDroppingDelayTs:()=>si._opt.videoBuffer+si._opt.videoBufferDelay/2,getAudioBufferLength(){let e=0;return i.forEach((t=>{t.type===oe&&(e+=1)})),e},getStreamBufferLength(){let e=0;return c&&c.buffer&&(e=c.buffer.byteLength),si._opt.isNakedFlow?Or.lastBuf&&(e=Or.lastBuf.byteLength):si._opt.isTs?ii._remainingPacketData&&(e=ii._remainingPacketData.byteLength):si._opt.isFmp4&&Gr.mp4Box&&(e=Gr.mp4Box.getAllocatedSampleDataSize()),e},fetchStream:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(si.debugLog("worker","fetchStream, url is "+e,"options:",JSON.stringify(t)),si.isWorkerFetch=!0,t.isFlv?si._opt.isFlv=!0:t.isFmp4?si._opt.isFmp4=!0:t.isMpeg4?si._opt.isMpeg4=!0:t.isNakedFlow?si._opt.isNakedFlow=!0:t.isTs&&(si._opt.isTs=!0),d=or((e=>{postMessage({cmd:O,type:xe,value:e})})),si.startStreamRateAndStatsInterval(),t.isFmp4&&(Gr.listenMp4Box(),si._opt.isFmp4Private&&Gr.initTransportDescarmber()),t.protocol===_){t.isFlv&&(c=new xr(si.demuxFlv())),o=new AbortController;const r=Object.assign({signal:o.signal},{headers:t.options&&t.options.headers||{}});fetch(e,r).then((e=>{if(gr(Sr))return si.debugLog("worker","request abort and run res.body.cancel()"),si.fetchStatus=Ct,void e.body.cancel();if(!pr(e))return si.debugWarn("worker",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),kr(),void postMessage({cmd:O,type:Fe.fetchError,value:`fetch response status is ${e.status} and ok is ${e.ok}`});if(postMessage({cmd:O,type:Te}),ur())si.writableStream=new WritableStream({write:e=>o&&o.signal&&o.signal.aborted?(si.debugLog("worker","writableStream write() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt)):gr(Sr)?(si.debugLog("worker","writableStream write() and requestAbort is true so return"),si.fetchStatus=Pt,void kr()):void("string"!=typeof e?(si.fetchStatus=Dt,d(e.byteLength),t.isFlv?c.write(e):t.isFmp4?si.demuxFmp4(e):t.isMpeg4?si.demuxMpeg4(e):t.isTs?si.demuxTs(e):t.isNakedFlow&&si.demuxNakedFlow(e)):si.debugWarn("worker",`writableStream write() and value is "${e}" string so return`)),close:()=>{si.debugLog("worker","writableStream close()"),si.fetchStatus=Pt,c&&(c.close(),c=null),kr(),postMessage({cmd:O,type:Ae,value:g,msg:"fetch done"})},abort:e=>{if(o&&o.signal&&o.signal.aborted)return si.debugLog("worker","writableStream abort() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt);c&&(c.close(),c=null),e.name!==Ut?(si.debugLog("worker",`writableStream abort() and e is ${e.toString()}`),kr(),postMessage({cmd:O,type:Fe.fetchError,value:e.toString()})):si.debugLog("worker","writableStream abort() and e.name is AbortError so return")}}),e.body.pipeTo(si.writableStream).catch((e=>{"AbortError"!==e.name&&si.debugLog("worker","writableStream pipeTo() and e is",e.name,e.toString())}));else{const r=e.body.getReader(),i=()=>{r.read().then((e=>{let{done:r,value:n}=e;return r?(si.debugLog("worker","fetchNext().then() and done is true"),si.fetchStatus=Pt,c&&(c.close(),c=null),kr(),void postMessage({cmd:O,type:Ae,value:g,msg:"fetch done"})):o&&o.signal&&o.signal.aborted?(si.debugLog("worker","fetchNext().then() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt)):gr(Sr)?(si.debugLog("worker","fetchNext().then() and requestAbort is true so return"),si.fetchStatus=Pt,void kr()):void("string"!=typeof n?(si.fetchStatus=Dt,d(n.byteLength),t.isFlv?c.write(n):t.isFmp4?si.demuxFmp4(n):t.isMpeg4?si.demuxMpeg4(n):t.isTs?si.demuxTs(n):t.isNakedFlow&&si.demuxNakedFlow(n),i()):si.debugWarn("worker",`fetchNext().then() and value "${n}" is string so return`))})).catch((e=>{if(o&&o.signal&&o.signal.aborted)return si.debugLog("worker","fetchNext().catch() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt);c&&(c.close(),c=null),e.name!==Ut?(si.debugLog("worker",`fetchNext().catch() and e is ${e.toString()}`),kr(),postMessage({cmd:O,type:Fe.fetchError,value:e.toString()})):si.debugLog("worker","fetchNext().catch() and e.name is AbortError so return")}))};i()}})).catch((e=>{o&&o.signal&&o.signal.aborted?si.debugLog("worker","fetch().catch() and abortController.signal.aborted is true so return"):e.name!==Ut?(si.debugLog("worker",`fetch().catch() and e is ${e.toString()}`),kr(),postMessage({cmd:O,type:Fe.fetchError,value:e.toString()}),c&&(c.close(),c=null)):si.debugLog("worker","fetch().catch() and e.name is AbortError so return")}))}else t.protocol===m&&(t.isFlv&&(c=new xr(si.demuxFlv())),a=new WebSocket(e,r),a.binaryType="arraybuffer",a.onopen=()=>{si.debugLog("worker","fetchStream, WebsocketStream socket open"),postMessage({cmd:O,type:Te}),postMessage({cmd:O,type:Pe})},a.onclose=e=>{si.isDestroyed?si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} and isDestroyed is true, so return`):u?si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} but isSocketError is true , so return`):(si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code}`),1006===e.code&&si.debugError("worker",`fetchStream, WebsocketStream socket close abnormally and code is ${e.code}`),gr(Sr)?si.debugLog("worker","fetchStream, WebsocketStream socket close and requestAbort is true so return"):(c&&(c.close(),c=null),postMessage({cmd:O,type:Ae,value:y,msg:e.code})))},a.onerror=e=>{si.debugError("worker","fetchStream, WebsocketStream socket error",e,e.toString()),u=!0,c&&(c.close(),c=null),si.isDestroyed?si.debugLog("worker","fetchStream, WebsocketStream on error and isDestroyed is true, so return"):postMessage({cmd:O,type:Fe.websocketError,value:e.isTrusted?"websocket user aborted":"websocket error"})},a.onmessage=e=>{"string"!=typeof e.data?(d(e.data.byteLength),t.isFlv?c.write(e.data):t.isFmp4?si.demuxFmp4(e.data):t.isMpeg4?si.demuxMpeg4(e.data):si._opt.isNakedFlow?si.demuxNakedFlow(e.data):si.demuxM7s(e.data)):si.debugWarn("worker",`socket on message is string "${e.data}" and return`)})},demuxFlv:function*(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),r=new Uint32Array(e);for(;;){t[3]=0;const e=yield 15,i=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const n=r[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let s=r[0];const o=(yield n).slice();switch(i){case de:if(o.byteLength>0){let e=o;gr(si._opt.m7sCryptoAudio)&&(e=si.cryptoPayloadAudio(o)),si.decode(e,{type:oe,ts:s})}else si.debugWarn("worker",`demuxFlv() type is audio and payload.byteLength is ${o.byteLength} and return`);break;case le:if(o.byteLength>=6){const e=o[0];if(si._isEnhancedH265Header(e))si._decodeEnhancedH265Video(o,s);else{const e=15&o[0];let t=o[0]>>4===Tt;const i=e===Me;if(yr(t)&&gr(br(o,i))&&(si.debugLog("worker","demux() isIFrame is false and unit type is IDR and update to true"),t=!0),t&&_r(o)&&null===si.isHevc){const e=15&o[0];si.isHevc=e===Me,sr=rr(o,si.isHevc),si.debugLog("worker",`demuxFlv() isVideoSequenceHeader is true and isHevc is ${si.isHevc} and nalUnitSize is ${sr}`)}t&&si.calcIframeIntervalTimestamp(s),si.isPlayer&&si.calcNetworkDelay(s),r[0]=o[4],r[1]=o[3],r[2]=o[2],r[3]=0;let n=r[0],a=si.cryptoPayload(o,t);si.decode(a,{type:ae,ts:s,isIFrame:t,cts:n})}}else si.debugWarn("worker",`demuxFlv() type is video and payload.byteLength is ${o.byteLength} and return`);break;case ce:postMessage({cmd:J,buffer:o},[o.buffer]);break;default:si.debugLog("worker",`demuxFlv() type is ${i}`)}}},decode:function(e,t){t.type===oe?si._opt.hasAudio&&(postMessage({cmd:O,type:Ue,value:e.byteLength}),si.isPlayer?si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts}):si.isPlayback&&(si.isPlaybackOnlyDecodeIFrame()||(si.isPlaybackCacheBeforeDecodeForFpsRender(),si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts})))):t.type===ae&&si._opt.hasVideo&&(postMessage({cmd:O,type:Be,value:e.byteLength}),postMessage({cmd:O,type:ke,value:t.ts}),si.isPlayer?si.pushBuffer(e,{type:t.type,ts:t.ts,isIFrame:t.isIFrame,cts:t.cts}):si.isPlayback&&(si.isPlaybackOnlyDecodeIFrame()?t.isIFrame&&si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}):(si.isPlaybackCacheBeforeDecodeForFpsRender(),si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}))))},cryptoPayload:function(e,t){let r=e;return si._opt.isM7sCrypto?si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?r=zi(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc):si.debugError("worker",`isM7sCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`):si._opt.isSm4Crypto?si._opt.sm4CryptoKey?r=si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?ts(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc,si._opt.isSm4CryptoH265V2):an(e,si._opt.sm4CryptoKey,si.isHevc,si._opt.isSm4CryptoH265V2):si._opt.sm4CryptoKey||si.debugError("worker","isSm4Crypto opt.sm4CryptoKey is null"):si._opt.isXorCrypto&&(si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?r=hn(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc):si.debugError("worker",`isXorCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`)),r},cryptoPayloadAudio:function(e){let t=e;return si._opt.isM7sCrypto&&(si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?e[0]>>4===$e&&(t=Ni(e,si._opt.cryptoKey,si._opt.cryptoIV)):si.debugError("worker",`isM7sCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`)),t},setCodecAudio:function(e,t){const r=e[0]>>4,i=e[0]>>1&1;if(wr=r===$e?i?16:8:0===i?8:16,oi&&oi.setCodec)if(qt(e)||r===Oe||r===Ge||r===He){si.debugLog("worker",`setCodecAudio: init audio codec, codeId is ${r} _opt.sampleRate is ${si._opt.sampleRate}`);const i=r===$e?e.slice(2):new Uint8Array(0);oi.setCodec(r,si._opt.sampleRate,i),r===$e&&postMessage({cmd:I,buffer:i},[i.buffer]),E=!0,r!==$e&&(r===He?(si.mp3Demuxer||(si.mp3Demuxer=new ln(si),si.mp3Demuxer.on("data",((e,t)=>{oi.decode(e,t)}))),si.mp3Demuxer.dispatch(e.slice(1),t)):oi.decode(e.slice(1),t));{const e=Number("1")||1;setTimeout((()=>{si.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),si.close(),postMessage({cmd:W})}),60*e*60*1e3)}}else si.debugWarn("worker","setCodecAudio: hasInitAudioCodec is false, codecId is ",r);else si.debugError("worker","setCodecAudio: audioDecoder or audioDecoder.setCodec is null")},decodeAudio:function(e,t){if(si.isDestroyed)si.debugLog("worker","decodeAudio, decoder is destroyed and return");else if(si.isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio())ni.decodeAudio(e,t);else if(gr(r)&&gr(si._opt.mseDecodeAudio))postMessage({cmd:$,payload:e,ts:t,cts:t},[e.buffer]);else{const r=e[0]>>4;if(E){if(qt(e))return void si.debugLog("worker","decodeAudio and has already initialized and payload is aac codec packet so drop this frame");r===He?si.mp3Demuxer.dispatch(e.slice(1),t):oi.decode(r===$e?e.slice(2):e.slice(1),t)}else si.setCodecAudio(e,t)}},setCodecVideo:function(e,t){const r=15&e[0];if(ai&&ai.setCodec)if(_r(e))if(r===Ie||r===Me){si.debugLog("worker",`setCodecVideo: init video codec , codecId is ${r}`);const t=e.slice(5);if(r===Ie&&si._opt.useSIMD){const e=Tr(t);if(e.codecWidth>x||e.codecHeight>x)return postMessage({cmd:Y,value:`width: ${e.codecWidth} > 4080, height: ${e.codecHeight} > 4080`}),void si.debugWarn("worker",`setCodecVideo: SIMD H264 decode video width is too large, width is ${e.codecWidth}, height is ${e.codecHeight}`)}const i=new Uint8Array(e);S=!0,ai.setCodec(r,t),postMessage({cmd:M,code:r}),postMessage({cmd:R,buffer:i,codecId:r},[i.buffer])}else si.debugWarn("worker",`setCodecVideo: hasInitVideoCodec is false, codecId is ${r} is not H264 or H265`);else si.debugWarn("worker",`decodeVideo: hasInitVideoCodec is false, codecId is ${r} and isIFrame is ${t} and packetType is ${e[1]}`);else si.debugError("worker","setCodecVideo: videoDecoder or videoDecoder.setCodec is null")},decodeVideo:function(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(si.isDestroyed)si.debugLog("worker","decodeVideo, decoder is destroyed and return");else if(si.isPlayUseMSEAndDecoderInWorker())ni.decodeVideo(e,t,i,n);else if(gr(r))postMessage({cmd:N,payload:e,isIFrame:i,ts:t,cts:n,delay:si.delay},[e.buffer]);else if(S)if(!B&&i&&(B=!0),B){if(i&&_r(e)){const t=15&e[0];let r={};t===Ie?r=Tr(e.slice(5)):t===Me&&(r=Wr(e)),r.codecWidth&&r.codecHeight&&h&&f&&(r.codecWidth!==h||r.codecHeight!==f)&&(si.debugWarn("worker",`\n decodeVideo: video width or height is changed,\n old width is ${h}, old height is ${f},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),Kt=!0,postMessage({cmd:j,value:`width: ${h}->${r.codecWidth}, height: ${f}->${r.codecHeight}`}))}if(Kt)return void si.debugWarn("worker","decodeVideo: video width or height is changed, and return");if(Qt)return void si.debugWarn("worker","decodeVideo: simd decode error, and return");if(_r(e))return void si.debugLog("worker","decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength0&&void 0!==arguments[0]&&arguments[0];si.debugLog("worker",`clearBuffer,bufferList length is ${i.length}, need clear is ${e}`),e&&(i=[]),si.isPlayer&&(si.resetAllDelay(),gr(si._opt.checkFirstIFrame)&&(si.dropping=!0,postMessage({cmd:H}))),gr(si._opt.checkFirstIFrame)&&yr(r)&&(B=!1)},dropBuffer$2:function(){if(i.length>0){let e=i.findIndex((e=>gr(e.isIFrame)&&e.type===ae));if(si.isAllIframeInBufferList())for(let t=0;t=si.getNotDroppingDelayTs()){si.debugLog("worker",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${n} and notDroppingDelayTs is ${si.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){si.isPushDropping=!0,postMessage({cmd:H});const t=i.length;i=i.slice(e);const r=i.shift();si.resetAllDelay(),si.getDelay(r.ts,r.type),si.doDecode(r),si.isPushDropping=!1,si.debugLog("worker",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,new bufferList is ${i.length} and new delay is ${si.delay} `)}else si.isPushDropping=!1}0===i.length&&(si.isPushDropping=!1)},demuxM7s:function(e){const t=new DataView(e),r=t.getUint32(1,!1),i=t.getUint8(0),n=new ArrayBuffer(4),s=new Uint32Array(n);switch(i){case oe:si.decode(new Uint8Array(e,5),{type:oe,ts:r});break;case ae:if(t.byteLength>=11){const i=new Uint8Array(e,5),n=i[0];if(si._isEnhancedH265Header(n))si._decodeEnhancedH265Video(i,r);else{const e=t.getUint8(5)>>4==1;if(e&&(si.calcIframeIntervalTimestamp(r),_r(i)&&null===si.isHevc)){const e=15&i[0];si.isHevc=e===Me}si.isPlayer&&si.calcNetworkDelay(r),s[0]=i[4],s[1]=i[3],s[2]=i[2],s[3]=0;let n=s[0],o=si.cryptoPayload(i,e);si.decode(o,{type:ae,ts:r,isIFrame:e,cts:n})}}else si.debugWarn("worker",`demuxM7s() type is video and arrayBuffer length is ${e.byteLength} and return`)}},demuxNakedFlow:function(e){Or.dispatch(e)},demuxFmp4:function(e){Gr.dispatch(e)},demuxMpeg4:function(e){jr.dispatch(e)},demuxTs:function(e){ii.dispatch(e)},_decodeEnhancedH265Video:function(e,t){const r=e[0],i=48&r,n=15&r,s=e.slice(1,5),o=new ArrayBuffer(4),a=new Uint32Array(o),d="a"==String.fromCharCode(s[0]);if(si.isHevc=yr(d),n===Mt){if(i===Nt){const r=e.slice(5);if(d);else{const i=new Uint8Array(5+r.length);i.set([28,0,0,0,0],0),i.set(r,5),sr=rr(e,si.isHevc),si.debugLog("worker",`demuxFlv() isVideoSequenceHeader(enhancedH265) is true and isHevc is ${si.isHevc} and nalUnitSize is ${sr}`),si.decode(i,{type:ae,ts:t,isIFrame:!0,cts:0})}}}else if(n===Rt){let r=e,n=0;const s=i===Nt;s&&si.calcIframeIntervalTimestamp(t),d||(a[0]=e[4],a[1]=e[3],a[2]=e[2],a[3]=0,n=a[0],r=Kr(e.slice(8),s),r=si.cryptoPayload(r,s),si.decode(r,{type:ae,ts:t,isIFrame:s,cts:n}))}else if(n===zt){const r=i===Nt;r&&si.calcIframeIntervalTimestamp(t);let n=Kr(e.slice(5),r);n=si.cryptoPayload(n,r),si.decode(n,{type:ae,ts:t,isIFrame:r,cts:0})}},_isEnhancedH265Header:function(e){return(e&It)===It},findSei:function(e,t){let r=4;dr(sr)&&(r=sr),er(e.slice(5),r).forEach((e=>{const r=si.isHevc?e[0]>>>1&63:31&e[0];(si.isHevc&&(r===ft||r===ht)||yr(si.isHevc)&&r===Ke)&&postMessage({cmd:Z,buffer:e,ts:t},[e.buffer])}))},calcNetworkDelay:function(e){if(!(B&&e>0))return;null===Qe?(Qe=e,tt=ir()):et?r-t:0;si.networkDelay=i,i>si._opt.networkDelay&&si._opt.playType===v&&(si.debugWarn("worker",`calcNetworkDelay now dts:${e}, start dts is ${Qe} vs start is ${t},local diff is ${r} ,delay is ${i}`),postMessage({cmd:O,type:De,value:i}))},calcIframeIntervalTimestamp:function(e){null===$t?$t=e:$t=si._opt.playbackForwardMaxRateDecodeIFrame&&!(si._opt.useMSE&&si._opt.mseDecodeAudio)},isPlayUseMSE:function(){return si.isPlayer&&si._opt.useMSE&&gr(r)},isPlayUseMSEAndDecoderInWorker:function(){return si.isPlayUseMSE()&&si._opt.mseDecoderUseWorker},isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio:function(){return si.isPlayUseMSEAndDecoderInWorker()&&si._opt.mseDecodeAudio},playbackUpdatePlaybackRate:function(){yr(si.isPlaybackCacheBeforeDecodeForFpsRender())&&si.clearBuffer(!0)},onOffscreenCanvasWebglContextLost:function(e){si.debugError("worker","handleOffscreenCanvasWebglContextLost and next try to create webgl"),e.preventDefault(),Wt=!0,si.webglObj.destroy(),si.webglObj=null,si.offscreenCanvasGL=null,setTimeout((()=>{si.offscreenCanvasGL=si.offscreenCanvas.getContext("webgl"),si.offscreenCanvasGL&&si.offscreenCanvasGL.getContextAttributes().stencil?(si.webglObj=p(si.offscreenCanvasGL,si._opt.openWebglAlignment),Wt=!1):si.debugError("worker","handleOffscreenCanvasWebglContextLost, stencil is false")}),500)},onOffscreenCanvasWebglContextRestored:function(e){si.debugLog("worker","handleOffscreenCanvasWebglContextRestored"),e.preventDefault()},videoInfo:function(e,t,r){postMessage({cmd:M,code:e}),postMessage({cmd:T,w:t,h:r}),h=t,f=r,si.useOffscreen()&&(si.offscreenCanvas=new OffscreenCanvas(t,r),si.offscreenCanvasGL=si.offscreenCanvas.getContext("webgl"),si.webglObj=p(si.offscreenCanvasGL,si._opt.openWebglAlignment),si.offscreenCanvas.addEventListener("webglcontextlost",si.onOffscreenCanvasWebglContextLost,!1),si.offscreenCanvas.addEventListener("webglcontextrestored",si.onOffscreenCanvasWebglContextRestored,!1))},audioInfo:function(e,t,r){postMessage({cmd:F,code:e}),postMessage({cmd:P,sampleRate:t,channels:r,depth:wr}),kt=r},yuvData:function(t,r){if(si.isDestroyed)return void si.debugLog("worker","yuvData, decoder is destroyed and return");const i=h*f*3/2;let n=e.HEAPU8.subarray(t,t+i),s=new Uint8Array(n);if(ut=null,Ee=r,si.useOffscreen())try{if(Wt)return;si.webglObj.renderYUV(h,f,s);let e=si.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:e,delay:si.delay,ts:r},[e])}catch(e){si.debugError("worker","yuvData, transferToImageBitmap error is",e,e.toString())}else postMessage({cmd:C,output:s,delay:si.delay,ts:r},[s.buffer])},pcmData:function(e,r,i){if(si.isDestroyed)return void si.debugLog("worker","pcmData, decoder is destroyed and return");let s=r,o=[],a=0,d=si._opt.audioBufferSize;for(let r=0;r<2;r++){let i=t.HEAPU32[(e>>2)+r]>>2;o[r]=t.HEAPF32.subarray(i,i+s)}if(xt){if(!(s>=(r=d-xt)))return xt+=s,n[0]=Float32Array.of(...n[0],...o[0]),void(2==kt&&(n[1]=Float32Array.of(...n[1],...o[1])));it[0]=Float32Array.of(...n[0],...o[0].subarray(0,r)),2==kt&&(it[1]=Float32Array.of(...n[1],...o[1].subarray(0,r))),postMessage({cmd:D,buffer:it,ts:i},it.map((e=>e.buffer))),a=r,s-=r}for(xt=s;xt>=d;xt-=d)it[0]=o[0].slice(a,a+=d),2==kt&&(it[1]=o[1].slice(a-d,a)),postMessage({cmd:D,buffer:it,ts:i},it.map((e=>e.buffer)));xt&&(n[0]=o[0].slice(a),2==kt&&(n[1]=o[1].slice(a))),o=[]},errorInfo:function(e){null===ut&&(ut=ir());const t=ir(),r=nr(At>0?2*At:5e3,1e3,5e3),i=t-ut;i>r&&(si.debugWarn("worker",`errorInfo() emit simdDecodeError and\n iframeIntervalTimestamp is ${At} and diff is ${i} and maxDiff is ${r}\n and replay`),Qt=!0,postMessage({cmd:q}))},sendWebsocketMessage:function(e){a?a.readyState===Le?a.send(e):si.debugError("worker","socket is not open"):si.debugError("worker","socket is null")},timeEnd:function(){si.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),si.close(),postMessage({cmd:W})},postStreamToMain(e,t){postMessage({cmd:X,type:t,buffer:e},[e.buffer])},updatePlaybackIsPause(e){si.debugLog("worker",`updatePlaybackIsPause, isPause is ${e}`),gr(e)?si.clearPlaybackCacheLoop():si.startPlaybackCacheLoop()},debugLog(e){if(si._opt.debug&&si.debug){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:{};var t,i,n;(n=e).ready=new Promise(((e,r)=>{t=e,i=r})),(n=void 0!==n?n:{}).locateFile=function(e){return"decoder-pro-mt-worker.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_MT_WORKER_WASM_URL&&""!=JESSIBUCA_PRO_MT_WORKER_WASM_URL?JESSIBUCA_PRO_MT_WORKER_WASM_URL:e};var s,o,a,d=Object.assign({},n),l="./this.program",c=(e,t)=>{throw t},u="object"==typeof window,h="function"==typeof importScripts,f="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,p=n.ENVIRONMENT_IS_PTHREAD||!1,m="";function _(e){return n.locateFile?n.locateFile(e,m):m+e}if(f){const{createRequire:e}=await import("module");var g=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-mt.js",document.baseURI).href),y=g("fs"),v=g("path");let t;m=h?v.dirname(m)+"/":g("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-mt.js",document.baseURI).href)),s=(e,t)=>(e=se(e)?new URL(e):v.normalize(e),y.readFileSync(e,t?void 0:"utf8")),a=e=>{var t=s(e,!0);return t.buffer||(t=new Uint8Array(t)),t},o=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=se(e)?new URL(e):v.normalize(e),y.readFile(e,i?void 0:"utf8",((e,n)=>{e?r(e):t(i?n.buffer:n)}))},!n.thisProgram&&process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),c=(e,t)=>{throw process.exitCode=e,t},n.inspect=()=>"[Emscripten Module object]";try{t=g("worker_threads")}catch(e){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),e}global.Worker=t.Worker}else(u||h)&&(h?m=self.location.href:"undefined"!=typeof document&&document.currentScript&&(m=document.currentScript.src),r&&(m=r),m=0!==m.indexOf("blob:")?m.substr(0,m.replace(/[?#].*/,"").lastIndexOf("/")+1):"",f||(s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},h&&(a=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),o=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)}));f&&"undefined"==typeof performance&&(global.performance=g("perf_hooks").performance);var b=console.log.bind(console),w=console.error.bind(console);f&&(b=function(){for(var e=arguments.length,t=new Array(e),r=0;re.startsWith(ie),se=e=>e.startsWith("file://");function oe(e){if(e==ee&&S)return new Uint8Array(S);if(a)return a(e);throw"both async and sync fetching of the wasm failed"}function ae(e){if(!S&&(u||h)){if("function"==typeof fetch&&!se(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>oe(e)));if(o)return new Promise(((t,r)=>{o(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>oe(e)))}function de(e,t,r){return ae(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{U(`failed to asynchronously prepare wasm: ${e}`),Q(e)}))}function le(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||ne(t)||se(t)||f||"function"!=typeof fetch?de(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return U(`wasm streaming compile failed: ${e}`),U("falling back to ArrayBuffer instantiation"),de(t,r,i)}))))}function ce(){var e={a:Yi};function t(e,t){return Ki=e.exports,st(Ki.W),et=Ki.Z,q(Ki.R),A=t,J(),Ki}if(Z(),n.instantiateWasm)try{return n.instantiateWasm(e,t)}catch(e){U(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return le(S,ee,e,(function(e){t(e.instance,e.module)})).catch(i),{}}function ue(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}n.locateFile?ne(ee="decoder-pro-mt-worker.wasm")||(ee=_(ee)):ee=new URL("decoder-pro-mt-worker.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-mt.js",document.baseURI).href).href;var he=e=>{e.terminate(),e.onmessage=e=>{}},fe=e=>{var t=Xe.pthreads[e];delete Xe.pthreads[e],he(t),sn(e),Xe.runningWorkers.splice(Xe.runningWorkers.indexOf(t),1),t.pthread_ptr=0},pe=e=>{Xe.pthreads[e].postMessage({cmd:"cancel"})},me=e=>{var t=Xe.pthreads[e];Xe.returnWorkerToPool(t)},_e=e=>{var t=Xe.getNewWorker();if(!t)return 6;Xe.runningWorkers.push(t),Xe.pthreads[e.pthread_ptr]=t,t.pthread_ptr=e.pthread_ptr;var r={cmd:"run",start_routine:e.startRoutine,arg:e.arg,pthread_ptr:e.pthread_ptr};return f&&t.unref(),t.postMessage(r,e.transferList),0},ge=0,ye=()=>nt||ge>0,ve={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=ve.isAbs(e),r="/"===e.substr(-1);return(e=ve.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=ve.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=ve.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return ve.normalize(e.join("/"))},join2:(e,t)=>ve.normalize(e+"/"+t)},be=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>(e.set(crypto.getRandomValues(new Uint8Array(e.byteLength))),e);if(f)try{var e=g("crypto");if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}Q("initRandomDevice")},we=e=>(we=be())(e),Se={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:$e.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=ve.isAbs(i)}return(t?"/":"")+(e=ve.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=Se.resolve(e).substr(1),t=Se.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),s=Math.min(i.length,n.length),o=s,a=0;a{for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&Ee)return Ee.decode(e.buffer instanceof SharedArrayBuffer?e.slice(t,n):e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&o)<<6|a)}else s+=String.fromCharCode(o)}return s},xe=[],Ue=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},Be=(e,t,r,i)=>{if(!(i>0))return 0;for(var n=r,s=r+i-1,o=0;o=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++o)),a<=127){if(r>=s)break;t[r++]=a}else if(a<=2047){if(r+1>=s)break;t[r++]=192|a>>6,t[r++]=128|63&a}else if(a<=65535){if(r+2>=s)break;t[r++]=224|a>>12,t[r++]=128|a>>6&63,t[r++]=128|63&a}else{if(r+3>=s)break;t[r++]=240|a>>18,t[r++]=128|a>>12&63,t[r++]=128|a>>6&63,t[r++]=128|63&a}}return t[r]=0,r-n};function ke(e,t,r){var i=r>0?r:Ue(e)+1,n=new Array(i),s=Be(e,n,0,n.length);return t&&(n.length=s),n}var Te=()=>{if(!xe.length){var e=null;if(f){var t=Buffer.alloc(256),r=0,i=process.stdin.fd;try{r=y.readSync(i,t)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}e=r>0?t.slice(0,r).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;xe=ke(e,!0)}return xe.shift()},Ce={ttys:[],init(){},shutdown(){},register(e,t){Ce.ttys[e]={input:[],output:[],ops:t},$e.registerDevice(e,Ce.stream_ops)},stream_ops:{open(e){var t=Ce.ttys[e.node.rdev];if(!t)throw new $e.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new $e.ErrnoError(60);for(var s=0,o=0;oTe(),put_char(e,t){null===t||10===t?(x(Ae(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(x(Ae(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(U(Ae(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(U(Ae(e.output,0)),e.output=[])}}},De=e=>{Q()},Pe={ops_table:null,mount:e=>Pe.createNode(null,"/",16895,0),createNode(e,t,r,i){if($e.isBlkdev(r)||$e.isFIFO(r))throw new $e.ErrnoError(63);Pe.ops_table||(Pe.ops_table={dir:{node:{getattr:Pe.node_ops.getattr,setattr:Pe.node_ops.setattr,lookup:Pe.node_ops.lookup,mknod:Pe.node_ops.mknod,rename:Pe.node_ops.rename,unlink:Pe.node_ops.unlink,rmdir:Pe.node_ops.rmdir,readdir:Pe.node_ops.readdir,symlink:Pe.node_ops.symlink},stream:{llseek:Pe.stream_ops.llseek}},file:{node:{getattr:Pe.node_ops.getattr,setattr:Pe.node_ops.setattr},stream:{llseek:Pe.stream_ops.llseek,read:Pe.stream_ops.read,write:Pe.stream_ops.write,allocate:Pe.stream_ops.allocate,mmap:Pe.stream_ops.mmap,msync:Pe.stream_ops.msync}},link:{node:{getattr:Pe.node_ops.getattr,setattr:Pe.node_ops.setattr,readlink:Pe.node_ops.readlink},stream:{}},chrdev:{node:{getattr:Pe.node_ops.getattr,setattr:Pe.node_ops.setattr},stream:$e.chrdev_stream_ops}});var n=$e.createNode(e,t,r,i);return $e.isDir(n.mode)?(n.node_ops=Pe.ops_table.dir.node,n.stream_ops=Pe.ops_table.dir.stream,n.contents={}):$e.isFile(n.mode)?(n.node_ops=Pe.ops_table.file.node,n.stream_ops=Pe.ops_table.file.stream,n.usedBytes=0,n.contents=null):$e.isLink(n.mode)?(n.node_ops=Pe.ops_table.link.node,n.stream_ops=Pe.ops_table.link.stream):$e.isChrdev(n.mode)&&(n.node_ops=Pe.ops_table.chrdev.node,n.stream_ops=Pe.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n,e.timestamp=n.timestamp),n},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=$e.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,$e.isDir(e.mode)?t.size=4096:$e.isFile(e.mode)?t.size=e.usedBytes:$e.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&Pe.resizeFileStorage(e,t.size)},lookup(e,t){throw $e.genericErrors[44]},mknod:(e,t,r,i)=>Pe.createNode(e,t,r,i),rename(e,t,r){if($e.isDir(e.mode)){var i;try{i=$e.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new $e.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=$e.lookupNode(e,t);for(var i in r.contents)throw new $e.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink(e,t,r){var i=Pe.createNode(e,t,41471,0);return i.link=r,i},readlink(e){if(!$e.isLink(e.mode))throw new $e.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,i,n){var s=e.node.contents;if(n>=e.node.usedBytes)return 0;var o=Math.min(e.node.usedBytes-n,i);if(o>8&&s.subarray)t.set(s.subarray(n,n+o),r);else for(var a=0;a0||r+t(Pe.stream_ops.write(e,t,0,i,r,!1),0)}},Fe=(e,t,r,i)=>{var n=i?"":`al ${e}`;o(e,(r=>{R(r,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(r)),n&&J()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),n&&Z()},Le=(e,t,r,i,n,s)=>{$e.createDataFile(e,t,r,i,n,s)},Ie=n.preloadPlugins||[],Me=(e,t,r,i)=>{"undefined"!=typeof Browser&&Browser.init();var n=!1;return Ie.forEach((s=>{n||s.canHandle(t)&&(s.handle(e,t,r,i),n=!0)})),n},Re=(e,t,r,i,n,s,o,a,d,l)=>{var c=t?Se.resolve(ve.join2(e,t)):e;function u(r){function u(r){l&&l(),a||Le(e,t,r,i,n,d),s&&s(),J()}Me(r,c,u,(()=>{o&&o(),J()}))||u(r)}Z(),"string"==typeof r?Fe(r,(e=>u(e)),o):u(r)},ze=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t},Ne=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},$e={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=Se.resolve(e)))return{path:"",node:null};if(t=Object.assign({follow_mount:!0,recurse_count:0},t),t.recurse_count>8)throw new $e.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),i=$e.root,n="/",s=0;s40)throw new $e.ErrnoError(32)}}return{path:n,node:i}},getPath(e){for(var t;;){if($e.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,i=0;i>>0)%$e.nameTable.length},hashAddNode(e){var t=$e.hashName(e.parent.id,e.name);e.name_next=$e.nameTable[t],$e.nameTable[t]=e},hashRemoveNode(e){var t=$e.hashName(e.parent.id,e.name);if($e.nameTable[t]===e)$e.nameTable[t]=e.name_next;else for(var r=$e.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=$e.mayLookup(e);if(r)throw new $e.ErrnoError(r,e);for(var i=$e.hashName(e.id,t),n=$e.nameTable[i];n;n=n.name_next){var s=n.name;if(n.parent.id===e.id&&s===t)return n}return $e.lookup(e,t)},createNode(e,t,r,i){var n=new $e.FSNode(e,t,r,i);return $e.hashAddNode(n),n},destroyNode(e){$e.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>$e.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){var t=$e.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{return $e.lookupNode(e,t),20}catch(e){}return $e.nodePermissions(e,"wx")},mayDelete(e,t,r){var i;try{i=$e.lookupNode(e,t)}catch(e){return e.errno}var n=$e.nodePermissions(e,"wx");if(n)return n;if(r){if(!$e.isDir(i.mode))return 54;if($e.isRoot(i)||$e.getPath(i)===$e.cwd())return 10}else if($e.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?$e.isLink(e.mode)?32:$e.isDir(e.mode)&&("r"!==$e.flagsToPermissionString(t)||512&t)?31:$e.nodePermissions(e,$e.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=$e.MAX_OPEN_FDS;e++)if(!$e.streams[e])return e;throw new $e.ErrnoError(33)},getStreamChecked(e){var t=$e.getStream(e);if(!t)throw new $e.ErrnoError(8);return t},getStream:e=>$e.streams[e],createStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return $e.FSStream||($e.FSStream=function(){this.shared={}},$e.FSStream.prototype={},Object.defineProperties($e.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},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(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new $e.FSStream,e),-1==t&&(t=$e.nextfd()),e.fd=t,$e.streams[t]=e,e},closeStream(e){$e.streams[e]=null},chrdev_stream_ops:{open(e){var t=$e.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek(){throw new $e.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){$e.devices[e]={stream_ops:t}},getDevice:e=>$e.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),$e.syncFSRequests++,$e.syncFSRequests>1&&U(`warning: ${$e.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=$e.getMounts($e.root.mount),i=0;function n(e){return $e.syncFSRequests--,t(e)}function s(e){if(e)return s.errored?void 0:(s.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return s(null);t.type.syncfs(t,e,s)}))},mount(e,t,r){var i,n="/"===r,s=!r;if(n&&$e.root)throw new $e.ErrnoError(10);if(!n&&!s){var o=$e.lookupPath(r,{follow_mount:!1});if(r=o.path,i=o.node,$e.isMountpoint(i))throw new $e.ErrnoError(10);if(!$e.isDir(i.mode))throw new $e.ErrnoError(54)}var a={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(a);return d.mount=a,a.root=d,n?$e.root=d:i&&(i.mounted=a,i.mount&&i.mount.mounts.push(a)),d},unmount(e){var t=$e.lookupPath(e,{follow_mount:!1});if(!$e.isMountpoint(t.node))throw new $e.ErrnoError(28);var r=t.node,i=r.mounted,n=$e.getMounts(i);Object.keys($e.nameTable).forEach((e=>{for(var t=$e.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&$e.destroyNode(t),t=r}})),r.mounted=null;var s=r.mount.mounts.indexOf(i);r.mount.mounts.splice(s,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var i=$e.lookupPath(e,{parent:!0}).node,n=ve.basename(e);if(!n||"."===n||".."===n)throw new $e.ErrnoError(28);var s=$e.mayCreate(i,n);if(s)throw new $e.ErrnoError(s);if(!i.node_ops.mknod)throw new $e.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,$e.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,$e.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),i="",n=0;n(void 0===r&&(r=t,t=438),t|=8192,$e.mknod(e,t,r)),symlink(e,t){if(!Se.resolve(e))throw new $e.ErrnoError(44);var r=$e.lookupPath(t,{parent:!0}).node;if(!r)throw new $e.ErrnoError(44);var i=ve.basename(t),n=$e.mayCreate(r,i);if(n)throw new $e.ErrnoError(n);if(!r.node_ops.symlink)throw new $e.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename(e,t){var r,i,n=ve.dirname(e),s=ve.dirname(t),o=ve.basename(e),a=ve.basename(t);if(r=$e.lookupPath(e,{parent:!0}).node,i=$e.lookupPath(t,{parent:!0}).node,!r||!i)throw new $e.ErrnoError(44);if(r.mount!==i.mount)throw new $e.ErrnoError(75);var d,l=$e.lookupNode(r,o),c=Se.relative(e,s);if("."!==c.charAt(0))throw new $e.ErrnoError(28);if("."!==(c=Se.relative(t,n)).charAt(0))throw new $e.ErrnoError(55);try{d=$e.lookupNode(i,a)}catch(e){}if(l!==d){var u=$e.isDir(l.mode),h=$e.mayDelete(r,o,u);if(h)throw new $e.ErrnoError(h);if(h=d?$e.mayDelete(i,a,u):$e.mayCreate(i,a))throw new $e.ErrnoError(h);if(!r.node_ops.rename)throw new $e.ErrnoError(63);if($e.isMountpoint(l)||d&&$e.isMountpoint(d))throw new $e.ErrnoError(10);if(i!==r&&(h=$e.nodePermissions(r,"w")))throw new $e.ErrnoError(h);$e.hashRemoveNode(l);try{r.node_ops.rename(l,i,a)}catch(e){throw e}finally{$e.hashAddNode(l)}}},rmdir(e){var t=$e.lookupPath(e,{parent:!0}).node,r=ve.basename(e),i=$e.lookupNode(t,r),n=$e.mayDelete(t,r,!0);if(n)throw new $e.ErrnoError(n);if(!t.node_ops.rmdir)throw new $e.ErrnoError(63);if($e.isMountpoint(i))throw new $e.ErrnoError(10);t.node_ops.rmdir(t,r),$e.destroyNode(i)},readdir(e){var t=$e.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new $e.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=$e.lookupPath(e,{parent:!0}).node;if(!t)throw new $e.ErrnoError(44);var r=ve.basename(e),i=$e.lookupNode(t,r),n=$e.mayDelete(t,r,!1);if(n)throw new $e.ErrnoError(n);if(!t.node_ops.unlink)throw new $e.ErrnoError(63);if($e.isMountpoint(i))throw new $e.ErrnoError(10);t.node_ops.unlink(t,r),$e.destroyNode(i)},readlink(e){var t=$e.lookupPath(e).node;if(!t)throw new $e.ErrnoError(44);if(!t.node_ops.readlink)throw new $e.ErrnoError(28);return Se.resolve($e.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=$e.lookupPath(e,{follow:!t}).node;if(!r)throw new $e.ErrnoError(44);if(!r.node_ops.getattr)throw new $e.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>$e.stat(e,!0),chmod(e,t,r){var i;if(!(i="string"==typeof e?$e.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new $e.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod(e,t){$e.chmod(e,t,!0)},fchmod(e,t){var r=$e.getStreamChecked(e);$e.chmod(r.node,t)},chown(e,t,r,i){var n;if(!(n="string"==typeof e?$e.lookupPath(e,{follow:!i}).node:e).node_ops.setattr)throw new $e.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown(e,t,r){$e.chown(e,t,r,!0)},fchown(e,t,r){var i=$e.getStreamChecked(e);$e.chown(i.node,t,r)},truncate(e,t){if(t<0)throw new $e.ErrnoError(28);var r;if(!(r="string"==typeof e?$e.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new $e.ErrnoError(63);if($e.isDir(r.mode))throw new $e.ErrnoError(31);if(!$e.isFile(r.mode))throw new $e.ErrnoError(28);var i=$e.nodePermissions(r,"w");if(i)throw new $e.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=$e.getStreamChecked(e);if(0==(2097155&r.flags))throw new $e.ErrnoError(28);$e.truncate(r.node,t)},utime(e,t,r){var i=$e.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new $e.ErrnoError(44);var i;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?ze(t):t)?4095&r|32768:0,"object"==typeof e)i=e;else{e=ve.normalize(e);try{i=$e.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var s=!1;if(64&t)if(i){if(128&t)throw new $e.ErrnoError(20)}else i=$e.mknod(e,r,0),s=!0;if(!i)throw new $e.ErrnoError(44);if($e.isChrdev(i.mode)&&(t&=-513),65536&t&&!$e.isDir(i.mode))throw new $e.ErrnoError(54);if(!s){var o=$e.mayOpen(i,t);if(o)throw new $e.ErrnoError(o)}512&t&&!s&&$e.truncate(i,0),t&=-131713;var a=$e.createStream({node:i,path:$e.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return a.stream_ops.open&&a.stream_ops.open(a),!n.logReadFiles||1&t||($e.readFiles||($e.readFiles={}),e in $e.readFiles||($e.readFiles[e]=1)),a},close(e){if($e.isClosed(e))throw new $e.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{$e.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if($e.isClosed(e))throw new $e.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new $e.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new $e.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,i,n){if(i<0||n<0)throw new $e.ErrnoError(28);if($e.isClosed(e))throw new $e.ErrnoError(8);if(1==(2097155&e.flags))throw new $e.ErrnoError(8);if($e.isDir(e.node.mode))throw new $e.ErrnoError(31);if(!e.stream_ops.read)throw new $e.ErrnoError(28);var s=void 0!==n;if(s){if(!e.seekable)throw new $e.ErrnoError(70)}else n=e.position;var o=e.stream_ops.read(e,t,r,i,n);return s||(e.position+=o),o},write(e,t,r,i,n,s){if(i<0||n<0)throw new $e.ErrnoError(28);if($e.isClosed(e))throw new $e.ErrnoError(8);if(0==(2097155&e.flags))throw new $e.ErrnoError(8);if($e.isDir(e.node.mode))throw new $e.ErrnoError(31);if(!e.stream_ops.write)throw new $e.ErrnoError(28);e.seekable&&1024&e.flags&&$e.llseek(e,0,2);var o=void 0!==n;if(o){if(!e.seekable)throw new $e.ErrnoError(70)}else n=e.position;var a=e.stream_ops.write(e,t,r,i,n,s);return o||(e.position+=a),a},allocate(e,t,r){if($e.isClosed(e))throw new $e.ErrnoError(8);if(t<0||r<=0)throw new $e.ErrnoError(28);if(0==(2097155&e.flags))throw new $e.ErrnoError(8);if(!$e.isFile(e.node.mode)&&!$e.isDir(e.node.mode))throw new $e.ErrnoError(43);if(!e.stream_ops.allocate)throw new $e.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,i,n){if(0!=(2&i)&&0==(2&n)&&2!=(2097155&e.flags))throw new $e.ErrnoError(2);if(1==(2097155&e.flags))throw new $e.ErrnoError(2);if(!e.stream_ops.mmap)throw new $e.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n)},msync:(e,t,r,i,n)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new $e.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,i=$e.open(e,t.flags),n=$e.stat(e).size,s=new Uint8Array(n);return $e.read(i,s,0,n,0),"utf8"===t.encoding?r=Ae(s,0):"binary"===t.encoding&&(r=s),$e.close(i),r},writeFile(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=$e.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(Ue(t)+1),s=Be(t,n,0,n.length);$e.write(i,n,0,s,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");$e.write(i,t,0,t.byteLength,void 0,r.canOwn)}$e.close(i)},cwd:()=>$e.currentPath,chdir(e){var t=$e.lookupPath(e,{follow:!0});if(null===t.node)throw new $e.ErrnoError(44);if(!$e.isDir(t.node.mode))throw new $e.ErrnoError(54);var r=$e.nodePermissions(t.node,"x");if(r)throw new $e.ErrnoError(r);$e.currentPath=t.path},createDefaultDirectories(){$e.mkdir("/tmp"),$e.mkdir("/home"),$e.mkdir("/home/web_user")},createDefaultDevices(){$e.mkdir("/dev"),$e.registerDevice($e.makedev(1,3),{read:()=>0,write:(e,t,r,i,n)=>i}),$e.mkdev("/dev/null",$e.makedev(1,3)),Ce.register($e.makedev(5,0),Ce.default_tty_ops),Ce.register($e.makedev(6,0),Ce.default_tty1_ops),$e.mkdev("/dev/tty",$e.makedev(5,0)),$e.mkdev("/dev/tty1",$e.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=we(e).byteLength),e[--t]);$e.createDevice("/dev","random",r),$e.createDevice("/dev","urandom",r),$e.mkdir("/dev/shm"),$e.mkdir("/dev/shm/tmp")},createSpecialDirectories(){$e.mkdir("/proc");var e=$e.mkdir("/proc/self");$e.mkdir("/proc/self/fd"),$e.mount({mount(){var t=$e.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,i=$e.getStreamChecked(r),n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return n.parent=n,n}},t}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?$e.createDevice("/dev","stdin",n.stdin):$e.symlink("/dev/tty","/dev/stdin"),n.stdout?$e.createDevice("/dev","stdout",null,n.stdout):$e.symlink("/dev/tty","/dev/stdout"),n.stderr?$e.createDevice("/dev","stderr",null,n.stderr):$e.symlink("/dev/tty1","/dev/stderr"),$e.open("/dev/stdin",0),$e.open("/dev/stdout",1),$e.open("/dev/stderr",1)},ensureErrnoError(){$e.ErrnoError||($e.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},$e.ErrnoError.prototype=new Error,$e.ErrnoError.prototype.constructor=$e.ErrnoError,[44].forEach((e=>{$e.genericErrors[e]=new $e.ErrnoError(e),$e.genericErrors[e].stack=""})))},staticInit(){$e.ensureErrnoError(),$e.nameTable=new Array(4096),$e.mount(Pe,{},"/"),$e.createDefaultDirectories(),$e.createDefaultDevices(),$e.createSpecialDirectories(),$e.filesystems={MEMFS:Pe}},init(e,t,r){$e.init.initialized=!0,$e.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=t||n.stdout,n.stderr=r||n.stderr,$e.createStandardStreams()},quit(){$e.init.initialized=!1;for(var e=0;e<$e.streams.length;e++){var t=$e.streams[e];t&&$e.close(t)}},findObject(e,t){var r=$e.analyzePath(e,t);return r.exists?r.object:null},analyzePath(e,t){try{e=(i=$e.lookupPath(e,{follow:!t})).path}catch(e){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var i=$e.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=i.path,r.parentObject=i.node,r.name=ve.basename(e),i=$e.lookupPath(e,{follow:!t}),r.exists=!0,r.path=i.path,r.object=i.node,r.name=i.node.name,r.isRoot="/"===i.path}catch(e){r.error=e.errno}return r},createPath(e,t,r,i){e="string"==typeof e?e:$e.getPath(e);for(var n=t.split("/").reverse();n.length;){var s=n.pop();if(s){var o=ve.join2(e,s);try{$e.mkdir(o)}catch(e){}e=o}}return o},createFile(e,t,r,i,n){var s=ve.join2("string"==typeof e?e:$e.getPath(e),t),o=Ne(i,n);return $e.create(s,o)},createDataFile(e,t,r,i,n,s){var o=t;e&&(e="string"==typeof e?e:$e.getPath(e),o=t?ve.join2(e,t):e);var a=Ne(i,n),d=$e.create(o,a);if(r){if("string"==typeof r){for(var l=new Array(r.length),c=0,u=r.length;cthis.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},s.prototype.setDataGetter=function(e){this.getter=e},s.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,s=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,o=1048576;n||(o=i);var a=this;a.setDataGetter((e=>{var t=e*o,n=(e+1)*o-1;if(n=Math.min(n,i-1),void 0===a.chunks[e]&&(a.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==o&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):ke(n.responseText||"",!0)})(t,n)),void 0===a.chunks[e])throw new Error("doXHR failed!");return a.chunks[e]})),!s&&i||(o=i=1,i=this.getter(0).length,o=i,x("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=o,this.lengthKnown=!0},"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 o=new s;Object.defineProperties(o,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var a={isDevice:!1,contents:o}}else a={isDevice:!1,url:r};var d=$e.createFile(e,t,a,i,n);a.contents?d.contents=a.contents:a.url&&(d.contents=null,d.url=a.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,t,r,i,n){var s=e.node.contents;if(n>=s.length)return 0;var o=Math.min(s.length-n,i);if(s.slice)for(var a=0;a{var t=d.stream_ops[e];l[e]=function(){return $e.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,n)=>($e.forceLoadFile(d),c(e,t,r,i,n)),l.mmap=(e,t,r,i,n)=>{$e.forceLoadFile(d);var s=De();if(!s)throw new $e.ErrnoError(48);return c(e,k,s,t,r),{ptr:s,allocated:!0}},d.stream_ops=l,d}},Oe=(e,t)=>e?Ae(T,e,t):"",Ge={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(ve.isAbs(t))return t;var i;if(i=-100===e?$e.cwd():Ge.getStreamFromFD(e).path,0==t.length){if(!r)throw new $e.ErrnoError(44);return i}return ve.join2(i,t)},doStat(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&ve.normalize(t)!==ve.normalize($e.getPath(e.node)))return-54;throw e}P[r>>2]=i.dev,P[r+4>>2]=i.mode,F[r+8>>2]=i.nlink,P[r+12>>2]=i.uid,P[r+16>>2]=i.gid,P[r+20>>2]=i.rdev,re=[i.size>>>0,(te=i.size,+Math.abs(te)>=1?te>0?+Math.floor(te/4294967296)>>>0:~~+Math.ceil((te-+(~~te>>>0))/4294967296)>>>0:0)],P[r+24>>2]=re[0],P[r+28>>2]=re[1],P[r+32>>2]=4096,P[r+36>>2]=i.blocks;var n=i.atime.getTime(),s=i.mtime.getTime(),o=i.ctime.getTime();return re=[Math.floor(n/1e3)>>>0,(te=Math.floor(n/1e3),+Math.abs(te)>=1?te>0?+Math.floor(te/4294967296)>>>0:~~+Math.ceil((te-+(~~te>>>0))/4294967296)>>>0:0)],P[r+40>>2]=re[0],P[r+44>>2]=re[1],F[r+48>>2]=n%1e3*1e3,re=[Math.floor(s/1e3)>>>0,(te=Math.floor(s/1e3),+Math.abs(te)>=1?te>0?+Math.floor(te/4294967296)>>>0:~~+Math.ceil((te-+(~~te>>>0))/4294967296)>>>0:0)],P[r+56>>2]=re[0],P[r+60>>2]=re[1],F[r+64>>2]=s%1e3*1e3,re=[Math.floor(o/1e3)>>>0,(te=Math.floor(o/1e3),+Math.abs(te)>=1?te>0?+Math.floor(te/4294967296)>>>0:~~+Math.ceil((te-+(~~te>>>0))/4294967296)>>>0:0)],P[r+72>>2]=re[0],P[r+76>>2]=re[1],F[r+80>>2]=o%1e3*1e3,re=[i.ino>>>0,(te=i.ino,+Math.abs(te)>=1?te>0?+Math.floor(te/4294967296)>>>0:~~+Math.ceil((te-+(~~te>>>0))/4294967296)>>>0:0)],P[r+88>>2]=re[0],P[r+92>>2]=re[1],0},doMsync(e,t,r,i,n){if(!$e.isFile(t.node.mode))throw new $e.ErrnoError(43);if(2&i)return 0;var s=T.slice(e,e+r);$e.msync(t,s,n,r,i)},varargs:void 0,get(){var e=P[+Ge.varargs>>2];return Ge.varargs+=4,e},getp:()=>Ge.get(),getStr:e=>Oe(e),getStreamFromFD:e=>$e.getStreamChecked(e)},He=e=>{var t=ln(),r=e();return cn(t),r},We=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,Ve=function(e,t){var r=arguments.length-2,i=arguments;return He((()=>{for(var n=r,s=un(8*n),o=s>>3,a=0;a{if(B=e,p)throw Qe(e),"unwind";je(e)},Ye=qe,Ke=e=>{if(e instanceof ue||"unwind"==e)return B;c(1,e)},Xe={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init(){p?Xe.initWorker():Xe.initMainThread()},initMainThread(){j((()=>{Z(),Xe.loadWasmModuleToAllWorkers((()=>J()))}))},initWorker(){nt=!1},setExitStatus:e=>{B=e},terminateAllThreads__deps:["$terminateWorker"],terminateAllThreads:()=>{for(var e of Xe.runningWorkers)he(e);for(var e of Xe.unusedWorkers)he(e);Xe.unusedWorkers=[],Xe.runningWorkers=[],Xe.pthreads=[]},returnWorkerToPool:e=>{var t=e.pthread_ptr;delete Xe.pthreads[t],Xe.unusedWorkers.push(e),Xe.runningWorkers.splice(Xe.runningWorkers.indexOf(e),1),e.pthread_ptr=0,sn(t)},receiveObjectTransfer(e){},threadInitTLS(){Xe.tlsInitFunctions.forEach((e=>e()))},loadWasmModuleToWorker:e=>new Promise((t=>{e.onmessage=r=>{var i=r.data,s=i.cmd;if(i.targetThread&&i.targetThread!=Ji()){var o=Xe.pthreads[i.targetThread];o?o.postMessage(i,i.transferList):U(`Internal error! Worker sent a message "${s}" to target pthread ${i.targetThread}, but that thread no longer exists!`)}else"checkMailbox"===s?ai():"spawnThread"===s?_e(i):"cleanupThread"===s?me(i.thread):"killThread"===s?fe(i.thread):"cancelThread"===s?pe(i.thread):"loaded"===s?(e.loaded=!0,t(e)):"alert"===s?alert(`Thread ${i.threadId}: ${i.text}`):"setimmediate"===i.target?e.postMessage(i):"callHandler"===s?n[i.handler](...i.args):s&&U(`worker sent an unknown command ${s}`)},e.onerror=e=>{throw U(`worker sent an error! ${e.filename}:${e.lineno}: ${e.message}`),e},f&&(e.on("message",(t=>e.onmessage({data:t}))),e.on("error",(t=>e.onerror(t))));var r=[];for(var i of["onExit","onAbort","print","printErr"])n.hasOwnProperty(i)&&r.push(i);e.postMessage({cmd:"load",handlers:r,urlOrBlob:n.mainScriptUrlOrBlob,wasmMemory:E,wasmModule:A})})),loadWasmModuleToAllWorkers(e){e()},allocateUnusedWorker(){var e;if(n.locateFile){var t=_("decoder-pro-mt-worker.worker.js");e=new Worker(t,{type:"module"})}else e=new Worker(new URL("decoder-pro-mt-worker.worker.js","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-mt.js",document.baseURI).href),{type:"module"});Xe.unusedWorkers.push(e)},getNewWorker:()=>(0==Xe.unusedWorkers.length&&(Xe.allocateUnusedWorker(),Xe.loadWasmModuleToWorker(Xe.unusedWorkers[0])),Xe.unusedWorkers.pop())};n.PThread=Xe;var Ze=e=>{for(;e.length>0;)e.shift()(n)},Je=()=>{var e=Ji(),t=F[e+52>>2],r=F[e+56>>2];dn(t,t-r),cn(t)};function Qe(e){if(p)return Ve(1,0,e);Ye(e)}n.establishStackSpace=Je;var et,tt=[],rt=e=>{var t=tt[e];return t||(e>=tt.length&&(tt.length=e+1),tt[e]=t=et.get(e)),t},it=(e,t)=>{!function(e){ye()?Xe.setExitStatus(e):on(e)}(rt(e)(t))};n.invokeEntryPoint=it;var nt=n.noExitRuntime||!0,st=e=>{Xe.tlsInitFunctions.push(e)},ot=(e,t,r,i)=>{Q(`Assertion failed: ${Oe(e)}, at: `+[t?Oe(t):"unknown filename",r,i?Oe(i):"unknown function"])};function at(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){F[this.ptr+4>>2]=e},this.get_type=function(){return F[this.ptr+4>>2]},this.set_destructor=function(e){F[this.ptr+8>>2]=e},this.get_destructor=function(){return F[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,k[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=k[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,k[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=k[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){F[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return F[this.ptr+16>>2]},this.get_exception_ptr=function(){if(hn(this.get_type()))return F[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}var dt=(e,t,r)=>{throw new at(e).init(t,r),e},lt=e=>{tn(e,!h,1,!u,65536,!1),Xe.threadInitTLS()},ct=e=>{p?postMessage({cmd:"cleanupThread",thread:e}):me(e)};function ut(e,t,r,i){return p?Ve(2,1,e,t,r,i):ht(e,t,r,i)}var ht=(e,t,r,i)=>{if("undefined"==typeof SharedArrayBuffer)return U("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var n=[];if(p&&0===n.length)return ut(e,t,r,i);var s={startRoutine:r,pthread_ptr:e,arg:i,transferList:n};return p?(s.cmd="spawnThread",postMessage(s,n),0):_e(s)},ft=e=>(P[Qi()>>2]=e,e);function pt(e,t,r){if(p)return Ve(3,1,e,t,r);Ge.varargs=r;try{var i=Ge.getStreamFromFD(e);switch(t){case 0:if((n=Ge.get())<0)return-28;for(;$e.streams[n];)n++;return $e.createStream(i,n).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var n=Ge.get();return i.flags|=n,0;case 5:return n=Ge.getp(),C[n+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return ft(28),-1}}catch(e){if(void 0===$e||"ErrnoError"!==e.name)throw e;return-e.errno}}function mt(e,t,r,i){if(p)return Ve(4,1,e,t,r,i);Ge.varargs=i;try{t=Ge.getStr(t),t=Ge.calculateAt(e,t);var n=i?Ge.get():0;return $e.open(t,r,n).fd}catch(e){if(void 0===$e||"ErrnoError"!==e.name)throw e;return-e.errno}}var _t,gt,yt,vt=(e,t,r,i,n)=>{},bt=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);_t=e},wt=e=>{for(var t="",r=e;T[r];)t+=_t[T[r++]];return t},St={},Et={},At={},xt=e=>{throw new gt(e)},Ut=e=>{throw new yt(e)},Bt=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&Ut("Mismatched type converter count");for(var n=0;n{Et.hasOwnProperty(e)?n[t]=Et[e]:(s.push(e),St.hasOwnProperty(e)||(St[e]=[]),St[e].push((()=>{n[t]=Et[e],++o===s.length&&i(n)})))})),0===s.length&&i(n)};function kt(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||xt(`type "${i}" must have a positive integer typeid pointer`),Et.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;xt(`Cannot register type '${i}' twice`)}if(Et[e]=t,delete At[e],St.hasOwnProperty(e)){var n=St[e];delete St[e],n.forEach((e=>e()))}}function Tt(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return kt(e,t,r)}var Ct,Dt=8,Pt=(e,t,r,i)=>{Tt(e,{name:t=wt(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:Dt,readValueFromPointer:function(e){return this.fromWireType(T[e])},destructorFunction:null})},Ft=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Lt=e=>{xt(e.$$.ptrType.registeredClass.name+" instance already deleted")},It=!1,Mt=e=>{},Rt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},zt=e=>{e.count.value-=1,0===e.count.value&&Rt(e)},Nt=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=Nt(e,t,r.baseClass);return null===i?null:r.downcast(i)},$t={},Ot=()=>Object.keys(qt).length,Gt=()=>{var e=[];for(var t in qt)qt.hasOwnProperty(t)&&e.push(qt[t]);return e},Ht=[],Wt=()=>{for(;Ht.length;){var e=Ht.pop();e.$$.deleteScheduled=!1,e.delete()}},Vt=e=>{Ct=e,Ht.length&&Ct&&Ct(Wt)},jt=()=>{n.getInheritedInstanceCount=Ot,n.getLiveInheritedInstances=Gt,n.flushPendingDeletes=Wt,n.setDelayFunction=Vt},qt={},Yt=(e,t)=>{for(void 0===t&&xt("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},Kt=(e,t)=>(t=Yt(e,t),qt[t]),Xt=(e,t)=>(t.ptrType&&t.ptr||Ut("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&Ut("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Jt(Object.create(e,{$$:{value:t}})));function Zt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=Kt(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?Xt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Xt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,o=this.registeredClass.getActualType(t),a=$t[o];if(!a)return n.call(this);s=this.isConst?a.constPointerType:a.pointerType;var d=Nt(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?Xt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):Xt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}var Jt=e=>"undefined"==typeof FinalizationRegistry?(Jt=e=>e,e):(It=new FinalizationRegistry((e=>{zt(e.$$)})),Jt=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};It.register(e,r,e)}return e},Mt=e=>It.unregister(e),Jt(e)),Qt=()=>{Object.assign(er.prototype,{isAliasOf(e){if(!(this instanceof er))return!1;if(!(e instanceof er))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n},clone(){if(this.$$.ptr||Lt(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Jt(Object.create(Object.getPrototypeOf(this),{$$:{value:Ft(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Lt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&xt("Object already scheduled for deletion"),Mt(this),zt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Lt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&xt("Object already scheduled for deletion"),Ht.push(this),1===Ht.length&&Ct&&Ct(Wt),this.$$.deleteScheduled=!0,this}})};function er(){}var tr=(e,t)=>Object.defineProperty(t,"name",{value:e}),rr=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||xt(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},ir=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&xt(`Cannot register public name '${e}' twice`),rr(n,e,e),n.hasOwnProperty(r)&&xt(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,void 0!==r&&(n[e].numArguments=r))},nr=48,sr=57,or=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=nr&&t<=sr?`_${e}`:e};function ar(e,t,r,i,n,s,o,a){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=o,this.downcast=a,this.pureVirtualFunctions=[]}var dr=(e,t,r)=>{for(;t!==r;)t.upcast||xt(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function lr(e,t){if(null===t)return this.isReference&&xt(`null is not a valid ${this.name}`),0;t.$$||xt(`Cannot pass "${Or(t)}" as a ${this.name}`),t.$$.ptr||xt(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return dr(t.$$.ptr,r,this.registeredClass)}function cr(e,t){var r;if(null===t)return this.isReference&&xt(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||xt(`Cannot pass "${Or(t)}" as a ${this.name}`),t.$$.ptr||xt(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&xt(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=dr(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&xt("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:xt(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,zr.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:xt("Unsupporting sharing policy")}return r}function ur(e,t){if(null===t)return this.isReference&&xt(`null is not a valid ${this.name}`),0;t.$$||xt(`Cannot pass "${Or(t)}" as a ${this.name}`),t.$$.ptr||xt(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&xt(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return dr(t.$$.ptr,r,this.registeredClass)}function hr(e){return this.fromWireType(F[e>>2])}var fr=()=>{Object.assign(pr.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:Dt,readValueFromPointer:hr,deleteObject(e){null!==e&&e.delete()},fromWireType:Zt})};function pr(e,t,r,i,n,s,o,a,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=o,this.rawGetPointee=a,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=cr:i?(this.toWireType=lr,this.destructorFunction=null):(this.toWireType=ur,this.destructorFunction=null)}var mr,_r=(e,t,r)=>{n.hasOwnProperty(e)||Ut("Replacing nonexistant public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},gr=(e,t,r)=>{var i=n["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},yr=(e,t,r)=>e.includes("j")?gr(e,t,r):rt(t).apply(null,r),vr=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),yr(e,t,r)}},br=(e,t)=>{var r=(e=wt(e)).includes("j")?vr(e,t):rt(t);return"function"!=typeof r&&xt(`unknown function pointer with signature ${e}: ${t}`),r},wr=(e,t)=>{var r=tr(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},Sr=e=>{var t=en(e),r=wt(t);return Xi(t),r},Er=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Et[t]||(At[t]?At[t].forEach(e):(r.push(t),i[t]=!0))})),new mr(`${e}: `+r.map(Sr).join([", "]))},Ar=(e,t,r,i,n,s,o,a,d,l,c,u,h)=>{c=wt(c),s=br(n,s),a&&(a=br(o,a)),l&&(l=br(d,l)),h=br(u,h);var f=or(c);ir(f,(function(){Er(`Cannot construct ${c} due to unbound types`,[i])})),Bt([e,t,r],i?[i]:[],(function(t){var r,n;t=t[0],n=i?(r=t.registeredClass).instancePrototype:er.prototype;var o=tr(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new gt("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new gt(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new gt(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(n,{constructor:{value:o}});o.prototype=d;var u=new ar(c,o,d,h,r,s,a,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new pr(c,u,!0,!1,!1),m=new pr(c+"*",u,!1,!1,!1),_=new pr(c+" const*",u,!1,!0,!1);return $t[e]={pointerType:m,constPointerType:_},_r(f,o),[p,m,_]}))},xr=(e,t)=>{for(var r=[],i=0;i>2]);return r},Ur=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Br(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=tr(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function kr(e,t,r,i,n,s){var o=t.length;o<2&&xt("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||s?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=a?1:2;l{var o=xr(t,r);n=br(i,n),Bt([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new gt(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Er(`Cannot construct ${e.name} due to unbound types`,o)},Bt([],o,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=kr(r,i,null,n,s),[]))),[]}))},Cr=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Dr=(e,t,r,i,n,s,o,a,d)=>{var l=xr(r,i);t=wt(t),t=Cr(t),s=br(n,s),Bt([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function n(){Er(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),a&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,c[t]=n):(rr(c,t,i),c[t].overloadTable[r-2]=n),Bt([],l,(function(n){var a=kr(i,n,e,s,o,d);return void 0===c[t].overloadTable?(a.argCount=r-2,c[t]=a):c[t].overloadTable[r-2]=a,[]})),[]}))};function Pr(){Object.assign(Fr.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function Fr(){this.allocated=[void 0],this.freelist=[]}var Lr=new Fr,Ir=e=>{e>=Lr.reserved&&0==--Lr.get(e).refcount&&Lr.free(e)},Mr=()=>{for(var e=0,t=Lr.reserved;t{Lr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),Lr.reserved=Lr.allocated.length,n.count_emval_handles=Mr},zr={toValue:e=>(e||xt("Cannot use deleted val. handle = "+e),Lr.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return Lr.allocate({refcount:1,value:e})}}};function Nr(e){return this.fromWireType(P[e>>2])}var $r=(e,t)=>{Tt(e,{name:t=wt(t),fromWireType:e=>{var t=zr.toValue(e);return Ir(e),t},toWireType:(e,t)=>zr.toHandle(t),argPackAdvance:Dt,readValueFromPointer:Nr,destructorFunction:null})},Or=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},Gr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(L[e>>2])};case 8:return function(e){return this.fromWireType(I[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Hr=(e,t,r)=>{Tt(e,{name:t=wt(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Dt,readValueFromPointer:Gr(t,r),destructorFunction:null})},Wr=(e,t,r)=>{switch(t){case 1:return r?e=>k[e>>0]:e=>T[e>>0];case 2:return r?e=>C[e>>1]:e=>D[e>>1];case 4:return r?e=>P[e>>2]:e=>F[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Vr=(e,t,r,i,n)=>{t=wt(t);var s=e=>e;if(0===i){var o=32-8*r;s=e=>e<>>o}var a=t.includes("unsigned");Tt(e,{name:t,fromWireType:s,toWireType:a?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:Dt,readValueFromPointer:Wr(t,r,0!==i),destructorFunction:null})},jr=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=F[e>>2],r=F[e+4>>2];return new i(k.buffer,r,t)}Tt(e,{name:r=wt(r),fromWireType:n,argPackAdvance:Dt,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},qr=(e,t,r)=>Be(e,T,t,r),Yr=(e,t)=>{var r="std::string"===(t=wt(t));Tt(e,{name:t,fromWireType(e){var t,i=F[e>>2],n=e+4;if(r)for(var s=n,o=0;o<=i;++o){var a=n+o;if(o==i||0==T[a]){var d=Oe(s,a-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=a+1}}else{var l=new Array(i);for(o=0;o>2]=i,r&&n)qr(t,o,i+1);else if(n)for(var a=0;a255&&(Xi(o),xt("String has UTF-16 code units that do not fit in 8 bits")),T[o+a]=d}else for(a=0;a{for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&D[i];)++i;if((r=i<<1)-e>32&&Kr)return Kr.decode(T.slice(e,r));for(var s="",o=0;!(o>=t/2);++o){var a=C[e+2*o>>1];if(0==a)break;s+=String.fromCharCode(a)}return s},Zr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=o,t+=2}return C[t>>1]=0,t-i},Jr=e=>2*e.length,Qr=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var n=P[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i},ei=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++s)),P[t>>2]=o,(t+=4)+4>n)break}return P[t>>2]=0,t-i},ti=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},ri=(e,t,r)=>{var i,n,s,o,a;r=wt(r),2===t?(i=Xr,n=Zr,o=Jr,s=()=>D,a=1):4===t&&(i=Qr,n=ei,o=ti,s=()=>F,a=2),Tt(e,{name:r,fromWireType:e=>{for(var r,n=F[e>>2],o=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==o[c>>a]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return Xi(e),r},toWireType:(e,i)=>{"string"!=typeof i&&xt(`Cannot pass non-string to C++ string type ${r}`);var s=o(i),d=Zi(4+s+t);return F[d>>2]=s>>a,n(i,d+4,s+t),null!==e&&e.push(Xi,d),d},argPackAdvance:Dt,readValueFromPointer:Nr,destructorFunction(e){Xi(e)}})},ii=(e,t)=>{Tt(e,{isVoid:!0,name:t=wt(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},ni=()=>{if(!ye())try{p?on(B):Ye(B)}catch(e){Ke(e)}},si=e=>{if(!M)try{e(),ni()}catch(e){Ke(e)}},oi=e=>{if("function"==typeof Atomics.waitAsync){Atomics.waitAsync(P,e>>2,e).value.then(ai);var t=e+128;Atomics.store(P,t>>2,1)}};n.__emscripten_thread_mailbox_await=oi;var ai=()=>{var e=Ji();e&&(oi(e),si(an))};n.checkMailbox=ai;var di,li=(e,t,r)=>{if(e==t)setTimeout((()=>ai()));else if(p)postMessage({targetThread:e,cmd:"checkMailbox"});else{var i=Xe.pthreads[e];if(!i)return;i.postMessage({cmd:"checkMailbox"})}},ci=[],ui=(e,t,r,i)=>{ci.length=r;for(var n=i>>3,s=0;s{f&&Xe.pthreads[e].ref()},fi={},pi=e=>{var t=fi[e];return void 0===t?wt(e):t},mi=[],_i=(e,t,r,i,n)=>(e=mi[e])(t=zr.toValue(t),t[r=pi(r)],i,n),gi=e=>{var t=mi.length;return mi.push(e),t},yi=(e,t)=>{var r=Et[e];return void 0===r&&xt(t+" has unknown type "+Sr(e)),r},vi=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},bi=(e,t,r)=>{var i=[],n=e.toWireType(i,r);return i.length&&(F[t>>2]=zr.toHandle(i)),n},wi=(e,t,r)=>{var i=vi(e,t),n=i.shift();e--;var s="return function (obj, func, destructorsRef, args) {\n",o=0,a=[];0===r&&a.push("obj");for(var d=["retType"],l=[n],c=0;ce.name)).join(", ")}) => ${n.name}>`;return gi(tr(h,u))},Si=e=>{var t=zr.toValue(e);Ur(t),Ir(e)},Ei=()=>{Q("")},Ai=()=>{},xi=()=>Date.now(),Ui=()=>{ge+=1},Bi=()=>{throw Ui(),"unwind"};di=()=>performance.timeOrigin+performance.now();var ki=()=>f?g("os").cpus().length:navigator.hardwareConcurrency,Ti=e=>{Q("OOM")},Ci=e=>{T.length,Ti()},Di={},Pi=()=>l||"./this.program",Fi=()=>{if(!Fi.strings){var e={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",_:Pi()};for(var t in Di)void 0===Di[t]?delete e[t]:e[t]=Di[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Fi.strings=r}return Fi.strings},Li=(e,t)=>{for(var r=0;r>0]=e.charCodeAt(r);k[t>>0]=0},Ii=function(e,t){if(p)return Ve(5,1,e,t);var r=0;return Fi().forEach(((i,n)=>{var s=t+r;F[e+4*n>>2]=s,Li(i,s),r+=i.length+1})),0},Mi=function(e,t){if(p)return Ve(6,1,e,t);var r=Fi();F[e>>2]=r.length;var i=0;return r.forEach((e=>i+=e.length+1)),F[t>>2]=i,0};function Ri(e){if(p)return Ve(7,1,e);try{var t=Ge.getStreamFromFD(e);return $e.close(t),0}catch(e){if(void 0===$e||"ErrnoError"!==e.name)throw e;return e.errno}}function zi(e,t){if(p)return Ve(8,1,e,t);try{var r=Ge.getStreamFromFD(e),i=r.tty?2:$e.isDir(r.mode)?3:$e.isLink(r.mode)?7:4;return k[t>>0]=i,C[t+2>>1]=0,re=[0,(te=0,+Math.abs(te)>=1?te>0?+Math.floor(te/4294967296)>>>0:~~+Math.ceil((te-+(~~te>>>0))/4294967296)>>>0:0)],P[t+8>>2]=re[0],P[t+12>>2]=re[1],re=[0,(te=0,+Math.abs(te)>=1?te>0?+Math.floor(te/4294967296)>>>0:~~+Math.ceil((te-+(~~te>>>0))/4294967296)>>>0:0)],P[t+16>>2]=re[0],P[t+20>>2]=re[1],0}catch(e){if(void 0===$e||"ErrnoError"!==e.name)throw e;return e.errno}}var Ni=(e,t,r,i)=>{for(var n=0,s=0;s>2],a=F[t+4>>2];t+=8;var d=$e.read(e,k,o,a,i);if(d<0)return-1;if(n+=d,d>2]=s,0}catch(e){if(void 0===$e||"ErrnoError"!==e.name)throw e;return e.errno}}function Oi(e,t,r,i,n){if(p)return Ve(10,1,e,t,r,i,n);var s=We(t,r);try{if(isNaN(s))return 61;var o=Ge.getStreamFromFD(e);return $e.llseek(o,s,i),re=[o.position>>>0,(te=o.position,+Math.abs(te)>=1?te>0?+Math.floor(te/4294967296)>>>0:~~+Math.ceil((te-+(~~te>>>0))/4294967296)>>>0:0)],P[n>>2]=re[0],P[n+4>>2]=re[1],o.getdents&&0===s&&0===i&&(o.getdents=null),0}catch(e){if(void 0===$e||"ErrnoError"!==e.name)throw e;return e.errno}}var Gi=(e,t,r,i)=>{for(var n=0,s=0;s>2],a=F[t+4>>2];t+=8;var d=$e.write(e,k,o,a,i);if(d<0)return-1;n+=d,void 0!==i&&(i+=d)}return n};function Hi(e,t,r,i){if(p)return Ve(11,1,e,t,r,i);try{var n=Ge.getStreamFromFD(e),s=Gi(n,t,r);return F[i>>2]=s,0}catch(e){if(void 0===$e||"ErrnoError"!==e.name)throw e;return e.errno}}Xe.init();var Wi=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=$e.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},Vi=365,ji=146;Object.defineProperties(Wi.prototype,{read:{get:function(){return(this.mode&Vi)===Vi},set:function(e){e?this.mode|=Vi:this.mode&=~Vi}},write:{get:function(){return(this.mode&ji)===ji},set:function(e){e?this.mode|=ji:this.mode&=~ji}},isFolder:{get:function(){return $e.isDir(this.mode)}},isDevice:{get:function(){return $e.isChrdev(this.mode)}}}),$e.FSNode=Wi,$e.createPreloadedFile=Re,$e.staticInit(),bt(),gt=n.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},yt=n.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},Qt(),jt(),fr(),mr=n.UnboundTypeError=wr(Error,"UnboundTypeError"),Pr(),Rr();var qi=[je,Qe,ut,pt,mt,Ii,Mi,Ri,zi,$i,Oi,Hi],Yi={f:ot,s:dt,E:lt,m:ct,z:ht,N:pt,B:mt,u:vt,P:Pt,M:Ar,D:Tr,j:Dr,O:$r,p:Hr,d:Vr,c:jr,q:Yr,l:ri,Q:ii,w:li,A:ui,C:oi,J:hi,i:_i,r:Ir,h:wi,g:Si,b:Ei,n:Ai,k:xi,I:Bi,e:di,x:ki,v:Ci,G:Ii,H:Mi,y:Ye,o:Ri,F:zi,L:$i,t:Oi,K:Hi,a:E||n.wasmMemory},Ki=ce(),Xi=e=>(Xi=Ki.S)(e),Zi=e=>(Zi=Ki.T)(e),Ji=n._pthread_self=()=>(Ji=n._pthread_self=Ki.U)(),Qi=()=>(Qi=Ki.V)();n.__emscripten_tls_init=()=>(n.__emscripten_tls_init=Ki.W)();var en=e=>(en=Ki.X)(e);n.__embind_initialize_bindings=()=>(n.__embind_initialize_bindings=Ki.Y)();var tn=n.__emscripten_thread_init=(e,t,r,i,s,o)=>(tn=n.__emscripten_thread_init=Ki._)(e,t,r,i,s,o);n.__emscripten_thread_crashed=()=>(n.__emscripten_thread_crashed=Ki.$)();var rn,nn=(e,t,r,i)=>(nn=Ki.aa)(e,t,r,i),sn=e=>(sn=Ki.ba)(e),on=n.__emscripten_thread_exit=e=>(on=n.__emscripten_thread_exit=Ki.ca)(e),an=()=>(an=Ki.da)(),dn=(e,t)=>(dn=Ki.ea)(e,t),ln=()=>(ln=Ki.fa)(),cn=e=>(cn=Ki.ga)(e),un=e=>(un=Ki.ha)(e),hn=e=>(hn=Ki.ia)(e);function fn(){if(!(K>0)){if(p)return t(n),W(),void startWorker(n);H(),K>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e())}function e(){rn||(rn=!0,n.calledRun=!0,M||(W(),t(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),V()))}}if(n.dynCall_jiji=(e,t,r,i,s)=>(n.dynCall_jiji=Ki.ja)(e,t,r,i,s),n._ff_h264_cabac_tables=98885,n.wasmMemory=E,n.keepRuntimeAlive=ye,n.ExitStatus=ue,n.PThread=Xe,X=function e(){rn||fn(),rn||(X=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return fn(),e.ready}),o=(()=>{var e="undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-mt.js",document.baseURI).href;return async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var r,i,n;(n=t).ready=new Promise(((e,t)=>{r=e,i=t})),(n=void 0!==n?n:{}).locateFile=function(e){return"decoder-pro-audio.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_AUDIO_WASM_URL&&""!=JESSIBUCA_PRO_AUDIO_WASM_URL?JESSIBUCA_PRO_AUDIO_WASM_URL:e};var s,o,a,d=Object.assign({},n),l="./this.program",c="object"==typeof window,u="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";function p(e){return n.locateFile?n.locateFile(e,f):f+e}if(h){const{createRequire:e}=await import("module");var m=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-mt.js",document.baseURI).href),_=m("fs"),g=m("path");f=u?g.dirname(f)+"/":m("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-mt.js",document.baseURI).href)),s=(e,t)=>(e=J(e)?new URL(e):g.normalize(e),_.readFileSync(e,t?void 0:"utf8")),a=e=>{var t=s(e,!0);return t.buffer||(t=new Uint8Array(t)),t},o=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=J(e)?new URL(e):g.normalize(e),_.readFile(e,i?void 0:"utf8",((e,n)=>{e?r(e):t(i?n.buffer:n)}))},!n.thisProgram&&process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),n.inspect=()=>"[Emscripten Module object]"}else(c||u)&&(u?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),e&&(f=e),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},u&&(a=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),o=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var y,v,b=n.print||console.log.bind(console),w=n.printErr||console.error.bind(console);Object.assign(n,d),d=null,n.arguments&&n.arguments,n.thisProgram&&(l=n.thisProgram),n.quit&&n.quit,n.wasmBinary&&(y=n.wasmBinary),"object"!=typeof WebAssembly&&j("no native wasm support detected");var S,E,A,x,U,B,k,T,C=!1;function D(e,t){e||j(t)}function P(){var e=v.buffer;n.HEAP8=S=new Int8Array(e),n.HEAP16=A=new Int16Array(e),n.HEAPU8=E=new Uint8Array(e),n.HEAPU16=x=new Uint16Array(e),n.HEAP32=U=new Int32Array(e),n.HEAPU32=B=new Uint32Array(e),n.HEAPF32=k=new Float32Array(e),n.HEAPF64=T=new Float64Array(e)}var F=[],L=[],I=[];function M(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)N(n.preRun.shift());ne(F)}function R(){n.noFSInit||Te.init.initialized||Te.init(),Te.ignorePermissions=!1,ne(L)}function z(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)O(n.postRun.shift());ne(I)}function N(e){F.unshift(e)}function $(e){L.unshift(e)}function O(e){I.unshift(e)}var G=0,H=null;function W(e){G++,n.monitorRunDependencies&&n.monitorRunDependencies(G)}function V(e){if(G--,n.monitorRunDependencies&&n.monitorRunDependencies(G),0==G&&H){var t=H;H=null,t()}}function j(e){n.onAbort&&n.onAbort(e),w(e="Aborted("+e+")"),C=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}var q,Y,K,X="data:application/octet-stream;base64,",Z=e=>e.startsWith(X),J=e=>e.startsWith("file://");function Q(e){if(e==q&&y)return new Uint8Array(y);if(a)return a(e);throw"both async and sync fetching of the wasm failed"}function ee(e){if(!y&&(c||u)){if("function"==typeof fetch&&!J(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>Q(e)));if(o)return new Promise(((t,r)=>{o(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>Q(e)))}function te(e,t,r){return ee(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{w(`failed to asynchronously prepare wasm: ${e}`),j(e)}))}function re(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||Z(t)||J(t)||h||"function"!=typeof fetch?te(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return w(`wasm streaming compile failed: ${e}`),w("falling back to ArrayBuffer instantiation"),te(t,r,i)}))))}function ie(){var e={a:ni};function t(e,t){return si=e.exports,v=si.E,P(),Ft=si.H,$(si.F),V(),si}if(W(),n.instantiateWasm)try{return n.instantiateWasm(e,t)}catch(e){w(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return re(y,q,e,(function(e){t(e.instance)})).catch(i),{}}n.locateFile?Z(q="decoder-pro-audio.wasm")||(q=p(q)):q=new URL("decoder-pro-audio.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-mt.js",document.baseURI).href).href;var ne=e=>{for(;e.length>0;)e.shift()(n)};function se(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){B[this.ptr+4>>2]=e},this.get_type=function(){return B[this.ptr+4>>2]},this.set_destructor=function(e){B[this.ptr+8>>2]=e},this.get_destructor=function(){return B[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,S[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=S[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,S[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=S[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){B[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return B[this.ptr+16>>2]},this.get_exception_ptr=function(){if(ci(this.get_type()))return B[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}n.noExitRuntime;var oe=(e,t,r)=>{throw new se(e).init(t,r),e},ae=e=>(U[ai()>>2]=e,e),de={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=de.isAbs(e),r="/"===e.substr(-1);return(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=de.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=de.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return de.normalize(e.join("/"))},join2:(e,t)=>de.normalize(e+"/"+t)},le=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}j("initRandomDevice")},ce=e=>(ce=le())(e),ue={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:Te.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=de.isAbs(i)}return(t?"/":"")+(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=ue.resolve(e).substr(1),t=ue.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),s=Math.min(i.length,n.length),o=s,a=0;a{for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&he)return he.decode(e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&o)<<6|a)}else s+=String.fromCharCode(o)}return s},pe=[],me=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},_e=(e,t,r,i)=>{if(!(i>0))return 0;for(var n=r,s=r+i-1,o=0;o=55296&&a<=57343)a=65536+((1023&a)<<10)|1023&e.charCodeAt(++o);if(a<=127){if(r>=s)break;t[r++]=a}else if(a<=2047){if(r+1>=s)break;t[r++]=192|a>>6,t[r++]=128|63&a}else if(a<=65535){if(r+2>=s)break;t[r++]=224|a>>12,t[r++]=128|a>>6&63,t[r++]=128|63&a}else{if(r+3>=s)break;t[r++]=240|a>>18,t[r++]=128|a>>12&63,t[r++]=128|a>>6&63,t[r++]=128|63&a}}return t[r]=0,r-n};function ge(e,t,r){var i=r>0?r:me(e)+1,n=new Array(i),s=_e(e,n,0,n.length);return t&&(n.length=s),n}var ye=()=>{if(!pe.length){var e=null;if(h){var t=Buffer.alloc(256),r=0,i=process.stdin.fd;try{r=_.readSync(i,t)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}e=r>0?t.slice(0,r).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;pe=ge(e,!0)}return pe.shift()},ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},Te.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new Te.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new Te.ErrnoError(60);for(var s=0,o=0;oye(),put_char(e,t){null===t||10===t?(b(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(b(fe(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(w(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(w(fe(e.output,0)),e.output=[])}}},be=e=>{j()},we={ops_table:null,mount:e=>we.createNode(null,"/",16895,0),createNode(e,t,r,i){if(Te.isBlkdev(r)||Te.isFIFO(r))throw new Te.ErrnoError(63);we.ops_table||(we.ops_table={dir:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,lookup:we.node_ops.lookup,mknod:we.node_ops.mknod,rename:we.node_ops.rename,unlink:we.node_ops.unlink,rmdir:we.node_ops.rmdir,readdir:we.node_ops.readdir,symlink:we.node_ops.symlink},stream:{llseek:we.stream_ops.llseek}},file:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:{llseek:we.stream_ops.llseek,read:we.stream_ops.read,write:we.stream_ops.write,allocate:we.stream_ops.allocate,mmap:we.stream_ops.mmap,msync:we.stream_ops.msync}},link:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,readlink:we.node_ops.readlink},stream:{}},chrdev:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:Te.chrdev_stream_ops}});var n=Te.createNode(e,t,r,i);return Te.isDir(n.mode)?(n.node_ops=we.ops_table.dir.node,n.stream_ops=we.ops_table.dir.stream,n.contents={}):Te.isFile(n.mode)?(n.node_ops=we.ops_table.file.node,n.stream_ops=we.ops_table.file.stream,n.usedBytes=0,n.contents=null):Te.isLink(n.mode)?(n.node_ops=we.ops_table.link.node,n.stream_ops=we.ops_table.link.stream):Te.isChrdev(n.mode)&&(n.node_ops=we.ops_table.chrdev.node,n.stream_ops=we.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n,e.timestamp=n.timestamp),n},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Te.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,Te.isDir(e.mode)?t.size=4096:Te.isFile(e.mode)?t.size=e.usedBytes:Te.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&we.resizeFileStorage(e,t.size)},lookup(e,t){throw Te.genericErrors[44]},mknod:(e,t,r,i)=>we.createNode(e,t,r,i),rename(e,t,r){if(Te.isDir(e.mode)){var i;try{i=Te.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new Te.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=Te.lookupNode(e,t);for(var i in r.contents)throw new Te.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink(e,t,r){var i=we.createNode(e,t,41471,0);return i.link=r,i},readlink(e){if(!Te.isLink(e.mode))throw new Te.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,i,n){var s=e.node.contents;if(n>=e.node.usedBytes)return 0;var o=Math.min(e.node.usedBytes-n,i);if(o>8&&s.subarray)t.set(s.subarray(n,n+o),r);else for(var a=0;a0||r+t(we.stream_ops.write(e,t,0,i,r,!1),0)}},Se=(e,t,r,i)=>{var n=i?"":`al ${e}`;o(e,(r=>{D(r,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(r)),n&&V()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),n&&W()},Ee=(e,t,r,i,n,s)=>{Te.createDataFile(e,t,r,i,n,s)},Ae=n.preloadPlugins||[],xe=(e,t,r,i)=>{"undefined"!=typeof Browser&&Browser.init();var n=!1;return Ae.forEach((s=>{n||s.canHandle(t)&&(s.handle(e,t,r,i),n=!0)})),n},Ue=(e,t,r,i,n,s,o,a,d,l)=>{var c=t?ue.resolve(de.join2(e,t)):e;function u(r){function u(r){l&&l(),a||Ee(e,t,r,i,n,d),s&&s(),V()}xe(r,c,u,(()=>{o&&o(),V()}))||u(r)}W(),"string"==typeof r?Se(r,(e=>u(e)),o):u(r)},Be=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t},ke=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Te={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=ue.resolve(e)))return{path:"",node:null};if(t=Object.assign({follow_mount:!0,recurse_count:0},t),t.recurse_count>8)throw new Te.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),i=Te.root,n="/",s=0;s40)throw new Te.ErrnoError(32)}}return{path:n,node:i}},getPath(e){for(var t;;){if(Te.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,i=0;i>>0)%Te.nameTable.length},hashAddNode(e){var t=Te.hashName(e.parent.id,e.name);e.name_next=Te.nameTable[t],Te.nameTable[t]=e},hashRemoveNode(e){var t=Te.hashName(e.parent.id,e.name);if(Te.nameTable[t]===e)Te.nameTable[t]=e.name_next;else for(var r=Te.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=Te.mayLookup(e);if(r)throw new Te.ErrnoError(r,e);for(var i=Te.hashName(e.id,t),n=Te.nameTable[i];n;n=n.name_next){var s=n.name;if(n.parent.id===e.id&&s===t)return n}return Te.lookup(e,t)},createNode(e,t,r,i){var n=new Te.FSNode(e,t,r,i);return Te.hashAddNode(n),n},destroyNode(e){Te.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>Te.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){var t=Te.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{Te.lookupNode(e,t);return 20}catch(e){}return Te.nodePermissions(e,"wx")},mayDelete(e,t,r){var i;try{i=Te.lookupNode(e,t)}catch(e){return e.errno}var n=Te.nodePermissions(e,"wx");if(n)return n;if(r){if(!Te.isDir(i.mode))return 54;if(Te.isRoot(i)||Te.getPath(i)===Te.cwd())return 10}else if(Te.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?Te.isLink(e.mode)?32:Te.isDir(e.mode)&&("r"!==Te.flagsToPermissionString(t)||512&t)?31:Te.nodePermissions(e,Te.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Te.MAX_OPEN_FDS;e++)if(!Te.streams[e])return e;throw new Te.ErrnoError(33)},getStreamChecked(e){var t=Te.getStream(e);if(!t)throw new Te.ErrnoError(8);return t},getStream:e=>Te.streams[e],createStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return Te.FSStream||(Te.FSStream=function(){this.shared={}},Te.FSStream.prototype={},Object.defineProperties(Te.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},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(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new Te.FSStream,e),-1==t&&(t=Te.nextfd()),e.fd=t,Te.streams[t]=e,e},closeStream(e){Te.streams[e]=null},chrdev_stream_ops:{open(e){var t=Te.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek(){throw new Te.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Te.devices[e]={stream_ops:t}},getDevice:e=>Te.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),Te.syncFSRequests++,Te.syncFSRequests>1&&w(`warning: ${Te.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Te.getMounts(Te.root.mount),i=0;function n(e){return Te.syncFSRequests--,t(e)}function s(e){if(e)return s.errored?void 0:(s.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return s(null);t.type.syncfs(t,e,s)}))},mount(e,t,r){var i,n="/"===r,s=!r;if(n&&Te.root)throw new Te.ErrnoError(10);if(!n&&!s){var o=Te.lookupPath(r,{follow_mount:!1});if(r=o.path,i=o.node,Te.isMountpoint(i))throw new Te.ErrnoError(10);if(!Te.isDir(i.mode))throw new Te.ErrnoError(54)}var a={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(a);return d.mount=a,a.root=d,n?Te.root=d:i&&(i.mounted=a,i.mount&&i.mount.mounts.push(a)),d},unmount(e){var t=Te.lookupPath(e,{follow_mount:!1});if(!Te.isMountpoint(t.node))throw new Te.ErrnoError(28);var r=t.node,i=r.mounted,n=Te.getMounts(i);Object.keys(Te.nameTable).forEach((e=>{for(var t=Te.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&Te.destroyNode(t),t=r}})),r.mounted=null;var s=r.mount.mounts.indexOf(i);r.mount.mounts.splice(s,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var i=Te.lookupPath(e,{parent:!0}).node,n=de.basename(e);if(!n||"."===n||".."===n)throw new Te.ErrnoError(28);var s=Te.mayCreate(i,n);if(s)throw new Te.ErrnoError(s);if(!i.node_ops.mknod)throw new Te.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,Te.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,Te.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),i="",n=0;n(void 0===r&&(r=t,t=438),t|=8192,Te.mknod(e,t,r)),symlink(e,t){if(!ue.resolve(e))throw new Te.ErrnoError(44);var r=Te.lookupPath(t,{parent:!0}).node;if(!r)throw new Te.ErrnoError(44);var i=de.basename(t),n=Te.mayCreate(r,i);if(n)throw new Te.ErrnoError(n);if(!r.node_ops.symlink)throw new Te.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename(e,t){var r,i,n=de.dirname(e),s=de.dirname(t),o=de.basename(e),a=de.basename(t);if(r=Te.lookupPath(e,{parent:!0}).node,i=Te.lookupPath(t,{parent:!0}).node,!r||!i)throw new Te.ErrnoError(44);if(r.mount!==i.mount)throw new Te.ErrnoError(75);var d,l=Te.lookupNode(r,o),c=ue.relative(e,s);if("."!==c.charAt(0))throw new Te.ErrnoError(28);if("."!==(c=ue.relative(t,n)).charAt(0))throw new Te.ErrnoError(55);try{d=Te.lookupNode(i,a)}catch(e){}if(l!==d){var u=Te.isDir(l.mode),h=Te.mayDelete(r,o,u);if(h)throw new Te.ErrnoError(h);if(h=d?Te.mayDelete(i,a,u):Te.mayCreate(i,a))throw new Te.ErrnoError(h);if(!r.node_ops.rename)throw new Te.ErrnoError(63);if(Te.isMountpoint(l)||d&&Te.isMountpoint(d))throw new Te.ErrnoError(10);if(i!==r&&(h=Te.nodePermissions(r,"w")))throw new Te.ErrnoError(h);Te.hashRemoveNode(l);try{r.node_ops.rename(l,i,a)}catch(e){throw e}finally{Te.hashAddNode(l)}}},rmdir(e){var t=Te.lookupPath(e,{parent:!0}).node,r=de.basename(e),i=Te.lookupNode(t,r),n=Te.mayDelete(t,r,!0);if(n)throw new Te.ErrnoError(n);if(!t.node_ops.rmdir)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.rmdir(t,r),Te.destroyNode(i)},readdir(e){var t=Te.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new Te.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=Te.lookupPath(e,{parent:!0}).node;if(!t)throw new Te.ErrnoError(44);var r=de.basename(e),i=Te.lookupNode(t,r),n=Te.mayDelete(t,r,!1);if(n)throw new Te.ErrnoError(n);if(!t.node_ops.unlink)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.unlink(t,r),Te.destroyNode(i)},readlink(e){var t=Te.lookupPath(e).node;if(!t)throw new Te.ErrnoError(44);if(!t.node_ops.readlink)throw new Te.ErrnoError(28);return ue.resolve(Te.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=Te.lookupPath(e,{follow:!t}).node;if(!r)throw new Te.ErrnoError(44);if(!r.node_ops.getattr)throw new Te.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>Te.stat(e,!0),chmod(e,t,r){var i;"string"==typeof e?i=Te.lookupPath(e,{follow:!r}).node:i=e;if(!i.node_ops.setattr)throw new Te.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod(e,t){Te.chmod(e,t,!0)},fchmod(e,t){var r=Te.getStreamChecked(e);Te.chmod(r.node,t)},chown(e,t,r,i){var n;"string"==typeof e?n=Te.lookupPath(e,{follow:!i}).node:n=e;if(!n.node_ops.setattr)throw new Te.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown(e,t,r){Te.chown(e,t,r,!0)},fchown(e,t,r){var i=Te.getStreamChecked(e);Te.chown(i.node,t,r)},truncate(e,t){if(t<0)throw new Te.ErrnoError(28);var r;"string"==typeof e?r=Te.lookupPath(e,{follow:!0}).node:r=e;if(!r.node_ops.setattr)throw new Te.ErrnoError(63);if(Te.isDir(r.mode))throw new Te.ErrnoError(31);if(!Te.isFile(r.mode))throw new Te.ErrnoError(28);var i=Te.nodePermissions(r,"w");if(i)throw new Te.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=Te.getStreamChecked(e);if(0==(2097155&r.flags))throw new Te.ErrnoError(28);Te.truncate(r.node,t)},utime(e,t,r){var i=Te.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new Te.ErrnoError(44);var i;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?Be(t):t)?4095&r|32768:0,"object"==typeof e)i=e;else{e=de.normalize(e);try{i=Te.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var s=!1;if(64&t)if(i){if(128&t)throw new Te.ErrnoError(20)}else i=Te.mknod(e,r,0),s=!0;if(!i)throw new Te.ErrnoError(44);if(Te.isChrdev(i.mode)&&(t&=-513),65536&t&&!Te.isDir(i.mode))throw new Te.ErrnoError(54);if(!s){var o=Te.mayOpen(i,t);if(o)throw new Te.ErrnoError(o)}512&t&&!s&&Te.truncate(i,0),t&=-131713;var a=Te.createStream({node:i,path:Te.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return a.stream_ops.open&&a.stream_ops.open(a),!n.logReadFiles||1&t||(Te.readFiles||(Te.readFiles={}),e in Te.readFiles||(Te.readFiles[e]=1)),a},close(e){if(Te.isClosed(e))throw new Te.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Te.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Te.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Te.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,i,n){if(i<0||n<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(1==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.read)throw new Te.ErrnoError(28);var s=void 0!==n;if(s){if(!e.seekable)throw new Te.ErrnoError(70)}else n=e.position;var o=e.stream_ops.read(e,t,r,i,n);return s||(e.position+=o),o},write(e,t,r,i,n,s){if(i<0||n<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.write)throw new Te.ErrnoError(28);e.seekable&&1024&e.flags&&Te.llseek(e,0,2);var o=void 0!==n;if(o){if(!e.seekable)throw new Te.ErrnoError(70)}else n=e.position;var a=e.stream_ops.write(e,t,r,i,n,s);return o||(e.position+=a),a},allocate(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(t<0||r<=0)throw new Te.ErrnoError(28);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(!Te.isFile(e.node.mode)&&!Te.isDir(e.node.mode))throw new Te.ErrnoError(43);if(!e.stream_ops.allocate)throw new Te.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,i,n){if(0!=(2&i)&&0==(2&n)&&2!=(2097155&e.flags))throw new Te.ErrnoError(2);if(1==(2097155&e.flags))throw new Te.ErrnoError(2);if(!e.stream_ops.mmap)throw new Te.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n)},msync:(e,t,r,i,n)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new Te.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,i=Te.open(e,t.flags),n=Te.stat(e).size,s=new Uint8Array(n);return Te.read(i,s,0,n,0),"utf8"===t.encoding?r=fe(s,0):"binary"===t.encoding&&(r=s),Te.close(i),r},writeFile(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=Te.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(me(t)+1),s=_e(t,n,0,n.length);Te.write(i,n,0,s,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");Te.write(i,t,0,t.byteLength,void 0,r.canOwn)}Te.close(i)},cwd:()=>Te.currentPath,chdir(e){var t=Te.lookupPath(e,{follow:!0});if(null===t.node)throw new Te.ErrnoError(44);if(!Te.isDir(t.node.mode))throw new Te.ErrnoError(54);var r=Te.nodePermissions(t.node,"x");if(r)throw new Te.ErrnoError(r);Te.currentPath=t.path},createDefaultDirectories(){Te.mkdir("/tmp"),Te.mkdir("/home"),Te.mkdir("/home/web_user")},createDefaultDevices(){Te.mkdir("/dev"),Te.registerDevice(Te.makedev(1,3),{read:()=>0,write:(e,t,r,i,n)=>i}),Te.mkdev("/dev/null",Te.makedev(1,3)),ve.register(Te.makedev(5,0),ve.default_tty_ops),ve.register(Te.makedev(6,0),ve.default_tty1_ops),Te.mkdev("/dev/tty",Te.makedev(5,0)),Te.mkdev("/dev/tty1",Te.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=ce(e).byteLength),e[--t]);Te.createDevice("/dev","random",r),Te.createDevice("/dev","urandom",r),Te.mkdir("/dev/shm"),Te.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Te.mkdir("/proc");var e=Te.mkdir("/proc/self");Te.mkdir("/proc/self/fd"),Te.mount({mount(){var t=Te.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,i=Te.getStreamChecked(r),n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return n.parent=n,n}},t}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?Te.createDevice("/dev","stdin",n.stdin):Te.symlink("/dev/tty","/dev/stdin"),n.stdout?Te.createDevice("/dev","stdout",null,n.stdout):Te.symlink("/dev/tty","/dev/stdout"),n.stderr?Te.createDevice("/dev","stderr",null,n.stderr):Te.symlink("/dev/tty1","/dev/stderr"),Te.open("/dev/stdin",0),Te.open("/dev/stdout",1),Te.open("/dev/stderr",1)},ensureErrnoError(){Te.ErrnoError||(Te.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},Te.ErrnoError.prototype=new Error,Te.ErrnoError.prototype.constructor=Te.ErrnoError,[44].forEach((e=>{Te.genericErrors[e]=new Te.ErrnoError(e),Te.genericErrors[e].stack=""})))},staticInit(){Te.ensureErrnoError(),Te.nameTable=new Array(4096),Te.mount(we,{},"/"),Te.createDefaultDirectories(),Te.createDefaultDevices(),Te.createSpecialDirectories(),Te.filesystems={MEMFS:we}},init(e,t,r){Te.init.initialized=!0,Te.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=t||n.stdout,n.stderr=r||n.stderr,Te.createStandardStreams()},quit(){Te.init.initialized=!1;for(var e=0;ethis.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},s.prototype.setDataGetter=function(e){this.getter=e},s.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,s=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,o=1048576;n||(o=i);var a=this;a.setDataGetter((e=>{var t=e*o,n=(e+1)*o-1;if(n=Math.min(n,i-1),void 0===a.chunks[e]&&(a.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==o&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):ge(n.responseText||"",!0)})(t,n)),void 0===a.chunks[e])throw new Error("doXHR failed!");return a.chunks[e]})),!s&&i||(o=i=1,i=this.getter(0).length,o=i,b("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=o,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!u)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var o=new s;Object.defineProperties(o,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var a={isDevice:!1,contents:o}}else a={isDevice:!1,url:r};var d=Te.createFile(e,t,a,i,n);a.contents?d.contents=a.contents:a.url&&(d.contents=null,d.url=a.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,t,r,i,n){var s=e.node.contents;if(n>=s.length)return 0;var o=Math.min(s.length-n,i);if(s.slice)for(var a=0;a{var t=d.stream_ops[e];l[e]=function(){return Te.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,n)=>(Te.forceLoadFile(d),c(e,t,r,i,n)),l.mmap=(e,t,r,i,n)=>{Te.forceLoadFile(d);var s=be();if(!s)throw new Te.ErrnoError(48);return c(e,S,s,t,r),{ptr:s,allocated:!0}},d.stream_ops=l,d}},Ce=(e,t)=>e?fe(E,e,t):"",De={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(de.isAbs(t))return t;var i;-100===e?i=Te.cwd():i=De.getStreamFromFD(e).path;if(0==t.length){if(!r)throw new Te.ErrnoError(44);return i}return de.join2(i,t)},doStat(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&de.normalize(t)!==de.normalize(Te.getPath(e.node)))return-54;throw e}U[r>>2]=i.dev,U[r+4>>2]=i.mode,B[r+8>>2]=i.nlink,U[r+12>>2]=i.uid,U[r+16>>2]=i.gid,U[r+20>>2]=i.rdev,K=[i.size>>>0,(Y=i.size,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+24>>2]=K[0],U[r+28>>2]=K[1],U[r+32>>2]=4096,U[r+36>>2]=i.blocks;var n=i.atime.getTime(),s=i.mtime.getTime(),o=i.ctime.getTime();return K=[Math.floor(n/1e3)>>>0,(Y=Math.floor(n/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+40>>2]=K[0],U[r+44>>2]=K[1],B[r+48>>2]=n%1e3*1e3,K=[Math.floor(s/1e3)>>>0,(Y=Math.floor(s/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+56>>2]=K[0],U[r+60>>2]=K[1],B[r+64>>2]=s%1e3*1e3,K=[Math.floor(o/1e3)>>>0,(Y=Math.floor(o/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+72>>2]=K[0],U[r+76>>2]=K[1],B[r+80>>2]=o%1e3*1e3,K=[i.ino>>>0,(Y=i.ino,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[r+88>>2]=K[0],U[r+92>>2]=K[1],0},doMsync(e,t,r,i,n){if(!Te.isFile(t.node.mode))throw new Te.ErrnoError(43);if(2&i)return 0;var s=E.slice(e,e+r);Te.msync(t,s,n,r,i)},varargs:void 0,get(){var e=U[+De.varargs>>2];return De.varargs+=4,e},getp:()=>De.get(),getStr:e=>Ce(e),getStreamFromFD:e=>Te.getStreamChecked(e)};function Pe(e,t,r){De.varargs=r;try{var i=De.getStreamFromFD(e);switch(t){case 0:if((n=De.get())<0)return-28;for(;Te.streams[n];)n++;return Te.createStream(i,n).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var n=De.get();return i.flags|=n,0;case 5:n=De.getp();return A[n+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return ae(28),-1}}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}function Fe(e,t,r,i){De.varargs=i;try{t=De.getStr(t),t=De.calculateAt(e,t);var n=i?De.get():0;return Te.open(t,r,n).fd}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}var Le,Ie,Me,Re=(e,t,r,i,n)=>{},ze=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Le=e},Ne=e=>{for(var t="",r=e;E[r];)t+=Le[E[r++]];return t},$e={},Oe={},Ge={},He=e=>{throw new Ie(e)},We=e=>{throw new Me(e)},Ve=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&We("Mismatched type converter count");for(var n=0;n{Oe.hasOwnProperty(e)?n[t]=Oe[e]:(s.push(e),$e.hasOwnProperty(e)||($e[e]=[]),$e[e].push((()=>{n[t]=Oe[e],++o===s.length&&i(n)})))})),0===s.length&&i(n)};function je(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||He(`type "${i}" must have a positive integer typeid pointer`),Oe.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;He(`Cannot register type '${i}' twice`)}if(Oe[e]=t,delete Ge[e],$e.hasOwnProperty(e)){var n=$e[e];delete $e[e],n.forEach((e=>e()))}}function qe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return je(e,t,r)}var Ye,Ke=8,Xe=(e,t,r,i)=>{qe(e,{name:t=Ne(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:Ke,readValueFromPointer:function(e){return this.fromWireType(E[e])},destructorFunction:null})},Ze=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Je=e=>{He(e.$$.ptrType.registeredClass.name+" instance already deleted")},Qe=!1,et=e=>{},tt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},rt=e=>{e.count.value-=1,0===e.count.value&&tt(e)},it=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=it(e,t,r.baseClass);return null===i?null:r.downcast(i)},nt={},st=()=>Object.keys(ut).length,ot=()=>{var e=[];for(var t in ut)ut.hasOwnProperty(t)&&e.push(ut[t]);return e},at=[],dt=()=>{for(;at.length;){var e=at.pop();e.$$.deleteScheduled=!1,e.delete()}},lt=e=>{Ye=e,at.length&&Ye&&Ye(dt)},ct=()=>{n.getInheritedInstanceCount=st,n.getLiveInheritedInstances=ot,n.flushPendingDeletes=dt,n.setDelayFunction=lt},ut={},ht=(e,t)=>{for(void 0===t&&He("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},ft=(e,t)=>(t=ht(e,t),ut[t]),pt=(e,t)=>(t.ptrType&&t.ptr||We("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!==!!t.smartPtr&&We("Both smartPtrType and smartPtr must be specified"),t.count={value:1},_t(Object.create(e,{$$:{value:t}})));function mt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ft(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?pt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):pt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,o=this.registeredClass.getActualType(t),a=nt[o];if(!a)return n.call(this);s=this.isConst?a.constPointerType:a.pointerType;var d=it(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}var _t=e=>"undefined"==typeof FinalizationRegistry?(_t=e=>e,e):(Qe=new FinalizationRegistry((e=>{rt(e.$$)})),_t=e=>{var t=e.$$;if(!!t.smartPtr){var r={$$:t};Qe.register(e,r,e)}return e},et=e=>Qe.unregister(e),_t(e)),gt=()=>{Object.assign(yt.prototype,{isAliasOf(e){if(!(this instanceof yt))return!1;if(!(e instanceof yt))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n},clone(){if(this.$$.ptr||Je(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=_t(Object.create(Object.getPrototypeOf(this),{$$:{value:Ze(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),et(this),rt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),at.push(this),1===at.length&&Ye&&Ye(dt),this.$$.deleteScheduled=!0,this}})};function yt(){}var vt=(e,t)=>Object.defineProperty(t,"name",{value:e}),bt=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||He(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},wt=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&He(`Cannot register public name '${e}' twice`),bt(n,e,e),n.hasOwnProperty(r)&&He(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,void 0!==r&&(n[e].numArguments=r))},St=48,Et=57,At=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=St&&t<=Et?`_${e}`:e};function xt(e,t,r,i,n,s,o,a){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=o,this.downcast=a,this.pureVirtualFunctions=[]}var Ut=(e,t,r)=>{for(;t!==r;)t.upcast||He(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function Bt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ut(t.$$.ptr,r,this.registeredClass)}function kt(e,t){var r;if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=Ut(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&He("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,sr.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:He("Unsupporting sharing policy")}return r}function Tt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ut(t.$$.ptr,r,this.registeredClass)}function Ct(e){return this.fromWireType(B[e>>2])}var Dt=()=>{Object.assign(Pt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:Ke,readValueFromPointer:Ct,deleteObject(e){null!==e&&e.delete()},fromWireType:mt})};function Pt(e,t,r,i,n,s,o,a,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=o,this.rawGetPointee=a,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=kt:i?(this.toWireType=Bt,this.destructorFunction=null):(this.toWireType=Tt,this.destructorFunction=null)}var Ft,Lt,It=(e,t,r)=>{n.hasOwnProperty(e)||We("Replacing nonexistant public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},Mt=(e,t,r)=>{var i=n["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},Rt=[],zt=e=>{var t=Rt[e];return t||(e>=Rt.length&&(Rt.length=e+1),Rt[e]=t=Ft.get(e)),t},Nt=(e,t,r)=>e.includes("j")?Mt(e,t,r):zt(t).apply(null,r),$t=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),Nt(e,t,r)}},Ot=(e,t)=>{var r=(e=Ne(e)).includes("j")?$t(e,t):zt(t);return"function"!=typeof r&&He(`unknown function pointer with signature ${e}: ${t}`),r},Gt=(e,t)=>{var r=vt(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},Ht=e=>{var t=di(e),r=Ne(t);return oi(t),r},Wt=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Oe[t]||(Ge[t]?Ge[t].forEach(e):(r.push(t),i[t]=!0))})),new Lt(`${e}: `+r.map(Ht).join([", "]))},Vt=(e,t,r,i,n,s,o,a,d,l,c,u,h)=>{c=Ne(c),s=Ot(n,s),a&&(a=Ot(o,a)),l&&(l=Ot(d,l)),h=Ot(u,h);var f=At(c);wt(f,(function(){Wt(`Cannot construct ${c} due to unbound types`,[i])})),Ve([e,t,r],i?[i]:[],(function(t){var r,n;t=t[0],n=i?(r=t.registeredClass).instancePrototype:yt.prototype;var o=vt(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new Ie("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new Ie(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new Ie(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(n,{constructor:{value:o}});o.prototype=d;var u=new xt(c,o,d,h,r,s,a,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new Pt(c,u,!0,!1,!1),m=new Pt(c+"*",u,!1,!1,!1),_=new Pt(c+" const*",u,!1,!0,!1);return nt[e]={pointerType:m,constPointerType:_},It(f,o),[p,m,_]}))},jt=(e,t)=>{for(var r=[],i=0;i>2]);return r},qt=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Yt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=vt(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function Kt(e,t,r,i,n,s){var o=t.length;o<2&&He("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||s?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=a?1:2;l{var o=jt(t,r);n=Ot(i,n),Ve([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Ie(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Wt(`Cannot construct ${e.name} due to unbound types`,o)},Ve([],o,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Kt(r,i,null,n,s),[]))),[]}))},Zt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Jt=(e,t,r,i,n,s,o,a,d)=>{var l=jt(r,i);t=Ne(t),t=Zt(t),s=Ot(n,s),Ve([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function n(){Wt(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),a&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,c[t]=n):(bt(c,t,i),c[t].overloadTable[r-2]=n),Ve([],l,(function(n){var a=Kt(i,n,e,s,o,d);return void 0===c[t].overloadTable?(a.argCount=r-2,c[t]=a):c[t].overloadTable[r-2]=a,[]})),[]}))};function Qt(){Object.assign(er.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function er(){this.allocated=[void 0],this.freelist=[]}var tr=new er,rr=e=>{e>=tr.reserved&&0==--tr.get(e).refcount&&tr.free(e)},ir=()=>{for(var e=0,t=tr.reserved;t{tr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),tr.reserved=tr.allocated.length,n.count_emval_handles=ir},sr={toValue:e=>(e||He("Cannot use deleted val. handle = "+e),tr.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return tr.allocate({refcount:1,value:e})}}};function or(e){return this.fromWireType(U[e>>2])}var ar=(e,t)=>{qe(e,{name:t=Ne(t),fromWireType:e=>{var t=sr.toValue(e);return rr(e),t},toWireType:(e,t)=>sr.toHandle(t),argPackAdvance:Ke,readValueFromPointer:or,destructorFunction:null})},dr=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},lr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(k[e>>2])};case 8:return function(e){return this.fromWireType(T[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},cr=(e,t,r)=>{qe(e,{name:t=Ne(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Ke,readValueFromPointer:lr(t,r),destructorFunction:null})},ur=(e,t,r)=>{switch(t){case 1:return r?e=>S[e>>0]:e=>E[e>>0];case 2:return r?e=>A[e>>1]:e=>x[e>>1];case 4:return r?e=>U[e>>2]:e=>B[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},hr=(e,t,r,i,n)=>{t=Ne(t);var s=e=>e;if(0===i){var o=32-8*r;s=e=>e<>>o}var a=t.includes("unsigned");qe(e,{name:t,fromWireType:s,toWireType:a?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:Ke,readValueFromPointer:ur(t,r,0!==i),destructorFunction:null})},fr=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=B[e>>2],r=B[e+4>>2];return new i(S.buffer,r,t)}qe(e,{name:r=Ne(r),fromWireType:n,argPackAdvance:Ke,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},pr=(e,t,r)=>_e(e,E,t,r),mr=(e,t)=>{var r="std::string"===(t=Ne(t));qe(e,{name:t,fromWireType(e){var t,i=B[e>>2],n=e+4;if(r)for(var s=n,o=0;o<=i;++o){var a=n+o;if(o==i||0==E[a]){var d=Ce(s,a-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=a+1}}else{var l=new Array(i);for(o=0;o>2]=i,r&&n)pr(t,o,i+1);else if(n)for(var a=0;a255&&(oi(o),He("String has UTF-16 code units that do not fit in 8 bits")),E[o+a]=d}else for(a=0;a{for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&x[i];)++i;if((r=i<<1)-e>32&&_r)return _r.decode(E.subarray(e,r));for(var s="",o=0;!(o>=t/2);++o){var a=A[e+2*o>>1];if(0==a)break;s+=String.fromCharCode(a)}return s},yr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=o,t+=2}return A[t>>1]=0,t-i},vr=e=>2*e.length,br=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var n=U[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i},wr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&o<=57343)o=65536+((1023&o)<<10)|1023&e.charCodeAt(++s);if(U[t>>2]=o,(t+=4)+4>n)break}return U[t>>2]=0,t-i},Sr=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},Er=(e,t,r)=>{var i,n,s,o,a;r=Ne(r),2===t?(i=gr,n=yr,o=vr,s=()=>x,a=1):4===t&&(i=br,n=wr,o=Sr,s=()=>B,a=2),qe(e,{name:r,fromWireType:e=>{for(var r,n=B[e>>2],o=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==o[c>>a]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return oi(e),r},toWireType:(e,i)=>{"string"!=typeof i&&He(`Cannot pass non-string to C++ string type ${r}`);var s=o(i),d=li(4+s+t);return B[d>>2]=s>>a,n(i,d+4,s+t),null!==e&&e.push(oi,d),d},argPackAdvance:Ke,readValueFromPointer:or,destructorFunction(e){oi(e)}})},Ar=(e,t)=>{qe(e,{isVoid:!0,name:t=Ne(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},xr={},Ur=e=>{var t=xr[e];return void 0===t?Ne(e):t},Br=[],kr=(e,t,r,i,n)=>(e=Br[e])(t=sr.toValue(t),t[r=Ur(r)],i,n),Tr=e=>{var t=Br.length;return Br.push(e),t},Cr=(e,t)=>{var r=Oe[e];return void 0===r&&He(t+" has unknown type "+Ht(e)),r},Dr=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},Pr=(e,t,r)=>{var i=[],n=e.toWireType(i,r);return i.length&&(B[t>>2]=sr.toHandle(i)),n},Fr=(e,t,r)=>{var i=Dr(e,t),n=i.shift();e--;var s="return function (obj, func, destructorsRef, args) {\n",o=0,a=[];0===r&&a.push("obj");for(var d=["retType"],l=[n],c=0;ce.name)).join(", ")}) => ${n.name}>`;return Tr(vt(h,u))},Lr=e=>{var t=sr.toValue(e);qt(t),rr(e)},Ir=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,Mr=()=>{j("")},Rr=()=>Date.now(),zr=(e,t,r)=>E.copyWithin(e,t,t+r),Nr=e=>{j("OOM")},$r=e=>{E.length,Nr()},Or={},Gr=()=>l||"./this.program",Hr=()=>{if(!Hr.strings){var e={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",_:Gr()};for(var t in Or)void 0===Or[t]?delete e[t]:e[t]=Or[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Hr.strings=r}return Hr.strings},Wr=(e,t)=>{for(var r=0;r>0]=e.charCodeAt(r);S[t>>0]=0},Vr=(e,t)=>{var r=0;return Hr().forEach(((i,n)=>{var s=t+r;B[e+4*n>>2]=s,Wr(i,s),r+=i.length+1})),0},jr=(e,t)=>{var r=Hr();B[e>>2]=r.length;var i=0;return r.forEach((e=>i+=e.length+1)),B[t>>2]=i,0};function qr(e){try{var t=De.getStreamFromFD(e);return Te.close(t),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Yr(e,t){try{var r=De.getStreamFromFD(e),i=r.tty?2:Te.isDir(r.mode)?3:Te.isLink(r.mode)?7:4;return S[t>>0]=i,A[t+2>>1]=0,K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[t+8>>2]=K[0],U[t+12>>2]=K[1],K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[t+16>>2]=K[0],U[t+20>>2]=K[1],0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Kr=(e,t,r,i)=>{for(var n=0,s=0;s>2],a=B[t+4>>2];t+=8;var d=Te.read(e,S,o,a,i);if(d<0)return-1;if(n+=d,d>2]=s,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Zr(e,t,r,i,n){var s=Ir(t,r);try{if(isNaN(s))return 61;var o=De.getStreamFromFD(e);return Te.llseek(o,s,i),K=[o.position>>>0,(Y=o.position,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],U[n>>2]=K[0],U[n+4>>2]=K[1],o.getdents&&0===s&&0===i&&(o.getdents=null),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Jr=(e,t,r,i)=>{for(var n=0,s=0;s>2],a=B[t+4>>2];t+=8;var d=Te.write(e,S,o,a,i);if(d<0)return-1;n+=d,void 0!==i&&(i+=d)}return n};function Qr(e,t,r,i){try{var n=De.getStreamFromFD(e),s=Jr(n,t,r);return B[i>>2]=s,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var ei=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=Te.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},ti=365,ri=146;Object.defineProperties(ei.prototype,{read:{get:function(){return(this.mode&ti)===ti},set:function(e){e?this.mode|=ti:this.mode&=~ti}},write:{get:function(){return(this.mode&ri)===ri},set:function(e){e?this.mode|=ri:this.mode&=~ri}},isFolder:{get:function(){return Te.isDir(this.mode)}},isDevice:{get:function(){return Te.isChrdev(this.mode)}}}),Te.FSNode=ei,Te.createPreloadedFile=Ue,Te.staticInit(),ze(),Ie=n.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Me=n.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},gt(),ct(),Dt(),Lt=n.UnboundTypeError=Gt(Error,"UnboundTypeError"),Qt(),nr();var ii,ni={o:oe,A:Pe,s:Fe,q:Re,C:Xe,D:Vt,y:Xt,h:Jt,B:ar,l:cr,c:hr,b:fr,m:mr,j:Er,n:Ar,f:kr,g:rr,e:Fr,d:Lr,a:Mr,i:Rr,w:zr,r:$r,u:Vr,v:jr,k:qr,t:Yr,z:Xr,p:Zr,x:Qr},si=ie(),oi=e=>(oi=si.G)(e),ai=()=>(ai=si.I)(),di=e=>(di=si.J)(e),li=e=>(li=si.K)(e),ci=e=>(ci=si.M)(e);function ui(){function e(){ii||(ii=!0,n.calledRun=!0,C||(R(),r(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),z()))}G>0||(M(),G>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.dynCall_viiijj=(e,t,r,i,s,o,a,d)=>(n.dynCall_viiijj=si.N)(e,t,r,i,s,o,a,d),n.dynCall_jij=(e,t,r,i)=>(n.dynCall_jij=si.O)(e,t,r,i),n.dynCall_jii=(e,t,r)=>(n.dynCall_jii=si.P)(e,t,r),n.dynCall_jiji=(e,t,r,i,s)=>(n.dynCall_jiji=si.Q)(e,t,r,i,s),H=function e(){ii||ui(),ii||(H=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return ui(),t.ready}})(),a=1e-6,d="undefined"!=typeof Float32Array?Float32Array:Array;function l(){var e=new d(16);return d!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function c(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var u,h=function(e,t,r,i,n,s,o){var a=1/(t-r),d=1/(i-n),l=1/(s-o);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*d,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*a,e[13]=(n+i)*d,e[14]=(o+s)*l,e[15]=1,e};function f(e,t,r){var i=new d(3);return i[0]=e,i[1]=t,i[2]=r,i}u=new d(3),d!=Float32Array&&(u[0]=0,u[1]=0,u[2]=0);var p=(e,t)=>{t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);const r=function(){const t=m(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),r=m(e.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))return console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(i)),null;return i}();let i={program:r,attribLocations:{vertexPosition:e.getAttribLocation(r,"aVertexPosition"),texturePosition:e.getAttribLocation(r,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(r,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(r,"uModelMatrix"),viewMatrix:e.getUniformLocation(r,"uViewMatrix"),rgbatexture:e.getUniformLocation(r,"rgbaTexture"),ytexture:e.getUniformLocation(r,"yTexture"),utexture:e.getUniformLocation(r,"uTexture"),vtexture:e.getUniformLocation(r,"vTexture"),isyuv:e.getUniformLocation(r,"isyuv")}},n=function(){const t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),e.STATIC_DRAW);var r=[];r=r.concat([0,1],[1,1],[1,0],[0,0]);const i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW);const n=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,texPosition:i,indices:n}}(),s=p(),o=p(),d=p(),u=p();function p(){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function m(t,r){const i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(console.log("An error occurred compiling the shaders: "+e.getShaderInfoLog(i)),e.deleteShader(i),null)}function _(t,r){e.viewport(0,0,t,r),e.clearColor(0,0,0,0),e.clearDepth(1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);const s=l();h(s,-1,1,-1,1,.1,100);const p=l();c(p);const m=l();!function(e,t,r,i){var n,s,o,d,l,u,h,f,p,m,_=t[0],g=t[1],y=t[2],v=i[0],b=i[1],w=i[2],S=r[0],E=r[1],A=r[2];Math.abs(_-S)32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let r=e-this._current_word_bits_left;this._fillCurrentWord();let i=Math.min(r,this._current_word_bits_left),n=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Wt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Vt=Wt,jt=Wt;function qt(e){let{profile:t,sampleRate:r,channel:i}=e;return new Uint8Array([175,0,t<<3|(14&r)>>1,(1&r)<<7|i<<3])}function Yt(e){return Kt(e)&&e[1]===Bt}function Kt(e){return e[0]>>4===$e}const Xt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Zt(e){let t=new Uint8Array(e),r=null,i=0,n=0,s=0,o=null;if(i=n=t[0]>>>3,s=(7&t[0])<<1|t[1]>>>7,s<0||s>=Xt.length)return void console.error("Flv: AAC invalid sampling frequency index!");let a=Xt[s],d=(120&t[1])>>>3;if(d<0||d>=8)return void console.log("Flv: AAC invalid channel configuration");5===i&&(o=(7&t[1])<<1|t[2]>>>7,t[2]);let l=$t.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?s>=6?(i=5,r=new Array(4),o=s-3):(i=2,r=new Array(2),o=s):-1!==l.indexOf("android")?(i=2,r=new Array(2),o=s):(i=5,o=s,r=new Array(4),s>=6?o=s-3:1===d&&(i=2,r=new Array(2),o=s)),r[0]=i<<3,r[0]|=(15&s)>>>1,r[1]=(15&s)<<7,r[1]|=(15&d)<<3,5===i&&(r[1]|=(15&o)>>>1,r[2]=(1&o)<<7,r[2]|=8,r[3]=0),{audioType:"aac",config:r,sampleRate:a,channelCount:d,objectType:i,codec:"mp4a.40."+i,originalCodec:"mp4a.40."+n}}class Jt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+7>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(4095===(r[t+0]<<8|r[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let r=this.current_syncword_offset_,i=(8&e[r+1])>>>3,n=(6&e[r+1])>>>1,s=1&e[r+1],o=(192&e[r+2])>>>6,a=(60&e[r+2])>>>2,d=(1&e[r+2])<<2|(192&e[r+3])>>>6,l=(3&e[r+3])<<11|e[r+4]<<3|(224&e[r+5])>>>5;if(e[r+6],r+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let c=1===s?7:9,u=l-c;r+=c;let h=this.findNextSyncwordOffset(r+u);if(this.current_syncword_offset_=h,0!==i&&1!==i||0!==n)continue;let f=e.subarray(r,r+u);t={},t.audio_object_type=o+1,t.sampling_freq_index=a,t.sampling_frequency=Vt[a],t.channel_config=d,t.data=f}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Qt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+1>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(695===(r[t+0]<<3|r[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),r=0;for(let i=0;i<=t;i++)r<<=8,r|=e.readByte();return r}readNextAACFrame(e){let t=this.data_,r=null;for(;null==r&&!this.eof_flag_;){let i=this.current_syncword_offset_,n=(31&t[i+1])<<8|t[i+2];if(i+3+n>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let s=new Ht(t.subarray(i+3,i+3+n)),o=null;if(s.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(i+3+n),s.destroy();continue}o=e}else{let e=s.readBool();if(e&&s.readBool()){console.error("audioMuxVersionA is Not Supported"),s.destroy();break}if(e&&this.getLATMValue(s),!s.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),s.destroy();break}if(0!==s.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),s.destroy();break}if(0!==s.readBits(4)){console.error("more than 2 numProgram Not Supported"),s.destroy();break}if(0!==s.readBits(3)){console.error("more than 2 numLayer Not Supported"),s.destroy();break}let t=e?this.getLATMValue(s):0,r=s.readBits(5);t-=5;let i=s.readBits(4);t-=4;let n=s.readBits(4);t-=4,s.readBits(3),t-=3,t>0&&s.readBits(t);let a=s.readBits(3);if(0!==a){console.error(`frameLengthType = ${a}. Only frameLengthType = 0 Supported`),s.destroy();break}s.readByte();let d=s.readBool();if(d)if(e)this.getLATMValue(s);else{let e=0;for(;;){e<<=8;let t=s.readBool();if(e+=s.readByte(),!t)break}console.log(e)}s.readBool()&&s.readByte(),o={},o.audio_object_type=r,o.sampling_freq_index=i,o.sampling_frequency=Vt[o.sampling_freq_index],o.channel_config=n,o.other_data_present=d}let a=0;for(;;){let e=s.readByte();if(a+=e,255!==e)break}let d=new Uint8Array(a);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function tr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return[];const r=e.length,i=[];let n,s=0;for(;s+t>>=8),s+=t,n){if(s+n>r)break;i.push(e.subarray(s,s+n)),s+=n}return i}function rr(e){const t=e.byteLength,r=new Uint8Array(4);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t;const i=new Uint8Array(t+4);return i.set(r,0),i.set(e,4),i}function ir(e,t){let r=null;return t?e.length>=28&&(r=1+(3&e[26])):e.length>=12&&(r=1+(3&e[9])),r}function nr(){return(new Date).getTime()}function sr(e,t,r){return Math.max(Math.min(e,Math.max(t,r)),Math.min(t,r))}function or(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function ar(e){let t=0,r=or();return i=>{if(n=i,"[object Number]"!==Object.prototype.toString.call(n))return;var n;t+=i;const s=or(),o=s-r;o>=1e3&&(e(t/o*1e3),r=s,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();function dr(e){return null==e}function lr(e){return!dr(e)}function cr(e){return"function"==typeof e}function ur(e){let t=null,r=31&e[0];return r!==We&&r!==Ve||(t=ze),t||(r=(126&e[0])>>1,r!==st&&r!==at&&r!==lt||(t=Ne)),t}function hr(){return"undefined"!=typeof WritableStream}function fr(e){e.close()}function pr(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let r=e[0],i=null,n=1;if(e.length>0){let t=e[1];t&&t.ts-r.ts>1e5&&(r=t,n=2)}if(r)for(let s=n;s=1e3){e[s-1].ts-r.ts<1e3&&(i=s+1)}}}return i}function mr(e){return e.ok&&e.status>=200&&e.status<=299}function _r(){return function(e){let t="";if("object"==typeof e)try{t=JSON.stringify(e),t=JSON.parse(t)}catch(r){t=e}else t=e;return t}(B)}function gr(e){return e[0]>>4===kt&&e[1]===Bt}function yr(e){return!0===e||"true"===e}function vr(e){return!0!==e&&"true"!==e}function br(){return!!($t.Worker&&$t.MediaSource&&"canConstructInDedicatedWorker"in $t.MediaSource&&!0===$t.MediaSource.canConstructInDedicatedWorker)}function wr(e,t){const r=tr(e.slice(5));let i=!1;return r.forEach((e=>{const r=t?e[0]>>>1&63:31&e[0];(t&&(r===Qe||r===tt||r===it)||vr(t)&&r===je)&&(i=!0)})),i}var Sr=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}d((i=i.apply(e,t||[])).next())}))};const Er=Symbol(32),Ar=Symbol(16),xr=Symbol(8);class Ur{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return Sr(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,r)=>{var i;this.reject=r,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(i=this.pull)||void 0===i||i.call(this,e)}))}))}readU32(){return this.read(Er)}readU16(){return this.read(Ar)}readU8(){return this.read(xr)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let r=0;const i=e=>t.length<(r=e);if("number"==typeof this.need){if(i(this.need))return;e=t.subarray(0,r)}else if(this.need===Er){if(i(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Ar){if(i(2))return;e=t[0]<<8|t[1]}else if(this.need===xr){if(i(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(i(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,r)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(i(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,r)),e=this.need}return this.consumed+=r,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,r=t+e;if(r<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,r);else{const e=new Uint8Array(r);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,r)}return this.buffer=new Uint8Array(e),this.buffer}}Ur.U32=Er,Ur.U16=Ar,Ur.U8=xr;class Br{constructor(e){this.log=function(t){if(e._opt.debugLevel==S){const s=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n1?r-1:0),n=1;n1?i-1:0),s=1;s=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseSPS(e){let t=kr._ebsp2rbsp(e),r=new Ht(t);r.readByte();let i=r.readByte();r.readByte();let n=r.readByte();r.readUEG();let s=kr.getProfileString(i),o=kr.getLevelString(n),a=1,d=420,l=[0,420,422,444],c=8;if((100===i||110===i||122===i||244===i||44===i||83===i||86===i||118===i||128===i||138===i||144===i)&&(a=r.readUEG(),3===a&&r.readBits(1),a<=3&&(d=l[a]),c=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool())){let e=3!==a?8:12;for(let t=0;t0&&e<16?(b=t[e-1],w=i[e-1]):255===e&&(b=r.readByte()<<8|r.readByte(),w=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);E=r.readBool(),A=t,x=2*e,S=A/x}}let U=1;1===b&&1===w||(U=b/w);let B=0,k=0;if(0===a)B=1,k=2-m;else{B=3===a?1:2,k=(1===a?2:1)*(2-m)}let T=16*(f+1),C=16*(p+1)*(2-m);T-=(_+g)*B,C-=(y+v)*k;let D=Math.ceil(T*U);return r.destroy(),r=null,{profile_string:s,level_string:o,bit_depth:c,ref_frames:h,chroma_format:d,chroma_format_string:kr.getChromaFormatString(d),frame_rate:{fixed:E,fps:S,fps_den:x,fps_num:A},sar_ratio:{width:b,height:w},codec_size:{width:T,height:C},present_size:{width:D,height:C}}}static parseSPS$2(e){let t=e.subarray(1,4),r="avc1.";for(let e=0;e<3;e++){let i=t[e].toString(16);i.length<2&&(i="0"+i),r+=i}let i=kr._ebsp2rbsp(e),n=new Ht(i);n.readByte();let s=n.readByte();n.readByte();let o=n.readByte();n.readUEG();let a=kr.getProfileString(s),d=kr.getLevelString(o),l=1,c=420,u=[0,420,422,444],h=8,f=8;if((100===s||110===s||122===s||244===s||44===s||83===s||86===s||118===s||128===s||138===s||144===s)&&(l=n.readUEG(),3===l&&n.readBits(1),l<=3&&(c=u[l]),h=n.readUEG()+8,f=n.readUEG()+8,n.readBits(1),n.readBool())){let e=3!==l?8:12;for(let t=0;t0&&e<16?(E=t[e-1],A=r[e-1]):255===e&&(E=n.readByte()<<8|n.readByte(),A=n.readByte()<<8|n.readByte())}if(n.readBool()&&n.readBool(),n.readBool()&&(n.readBits(4),n.readBool()&&n.readBits(24)),n.readBool()&&(n.readUEG(),n.readUEG()),n.readBool()){let e=n.readBits(32),t=n.readBits(32);U=n.readBool(),B=t,k=2*e,x=B/k}}let T=1;1===E&&1===A||(T=E/A);let C=0,D=0;if(0===l)C=1,D=2-y;else{C=3===l?1:2,D=(1===l?2:1)*(2-y)}let P=16*(_+1),F=16*(g+1)*(2-y);P-=(v+b)*C,F-=(w+S)*D;let L=Math.ceil(P*T);return n.destroy(),n=null,{codec_mimetype:r,profile_idc:s,level_idc:o,profile_string:a,level_string:d,chroma_format_idc:l,bit_depth:h,bit_depth_luma:h,bit_depth_chroma:f,ref_frames:m,chroma_format:c,chroma_format_string:kr.getChromaFormatString(c),frame_rate:{fixed:U,fps:x,fps_den:k,fps_num:B},sar_ratio:{width:E,height:A},codec_size:{width:P,height:F},present_size:{width:L,height:F}}}static _skipScalingList(e,t){let r=8,i=8,n=0;for(let s=0;s=this.buflen)return this.iserro=!0,0;this.iserro=!1,r=this.bufoff+e>8?8-this.bufoff:e,t<<=r,t+=this.buffer[this.bufpos]>>8-this.bufoff-r&255>>8-r,this.bufoff+=r,e-=r,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,r=this.bufoff,i=this.read(e);return this.bufpos=t,this.bufoff=r,i}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.sps,4),t.sps=i}if(t.pps){const e=t.pps.byteLength,r=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.pps,4),t.pps=i}return t}function Dr(e){let{sps:t,pps:r}=e;const i=[23,0,0,0,0,1,66,0,30,255];i[0]=23,i[6]=t[1],i[7]=t[2],i[8]=t[3],i[10]=225,i[11]=t.byteLength>>8&255,i[12]=255&t.byteLength,i.push(...t,1,r.byteLength>>8&255,255&r.byteLength,...r);return new Uint8Array(i)}function Pr(e){let{sps:t,pps:r}=e,i=8+t.byteLength+1+2+r.byteLength,n=!1;const s=kr.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(n=!0,i+=4);let o=new Uint8Array(i);o[0]=1,o[1]=t[1],o[2]=t[2],o[3]=t[3],o[4]=255,o[5]=225;let a=t.byteLength;o[6]=a>>>8,o[7]=255&a;let d=8;o.set(t,8),d+=a,o[d]=1;let l=r.byteLength;o[d+1]=l>>>8,o[d+2]=255&l,o.set(r,d+3),d+=3+l,n&&(o[d]=252|s.chroma_format_idc,o[d+1]=248|s.bit_depth_luma-8,o[d+2]=248|s.bit_depth_chroma-8,o[d+3]=0,d+=4);const c=[23,0,0,0,0],u=new Uint8Array(c.length+o.byteLength);return u.set(c,0),u.set(o,c.length),u}function Fr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Lr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Ir(e){return 31&e[0]}function Mr(e){return e===Ke}function Rr(e){return!function(e){return e===We||e===Ve}(e)&&!Mr(e)}function zr(e){return e===je}function Nr(e){if(0===e.length)return!1;const t=Ir(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=31&e[r],n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,i>=Je||0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class Or{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Gr=e=>{let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)},Hr=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Wr{static _ebsp2rbsp(e){let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseVPS(e){let t=Wr._ebsp2rbsp(e),r=new Ht(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}}static parseSPS(e){let t=Wr._ebsp2rbsp(e),r=new Ht(t);r.readByte(),r.readByte();let i=0,n=0,s=0,o=0;r.readBits(4);let a=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=a;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<=16?(L=t[e-1],I=i[e-1]):255===e&&(L=r.readBits(16),I=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()){r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())}if(r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG()),r.readBool()){if(R=r.readBits(32),z=r.readBits(32),r.readBool()&&r.readUEG(),r.readBool()){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=a;n++){let n=r.readBool();M=n;let s=!0,o=1;n||(s=r.readBool());let a=!1;if(s?r.readUEG():a=r.readBool(),a||(o=r.readUEG()+1),e){for(let e=0;e>6&3,r.general_tier_flag=e[1]>>5&1,r.general_profile_idc=31&e[1],r.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],r.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],r.general_constraint_indicator_flags=r.general_constraint_indicator_flags<<16|e[10]<<8|e[11],r.general_level_idc=e[12],r.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],r.parallelismType=3&e[15],r.chromaFormat=3&e[16],r.bitDepthLumaMinus8=7&e[17],r.bitDepthChromaMinus8=7&e[18],r.avgFrameRate=e[19]<<8|e[20],r.constantFrameRate=e[21]>>6&3,r.numTemporalLayers=e[21]>>3&7,r.temporalIdNested=e[21]>>2&1,r.lengthSizeMinusOne=3&e[21];let i=e[22],n=e.slice(23);for(let e=0;e0)for(let t=r;t<8;t++)e.read(2);i.sub_layer_profile_space=[],i.sub_layer_tier_flag=[],i.sub_layer_profile_idc=[],i.sub_layer_profile_compatibility_flag=[],i.sub_layer_progressive_source_flag=[],i.sub_layer_interlaced_source_flag=[],i.sub_layer_non_packed_constraint_flag=[],i.sub_layer_frame_only_constraint_flag=[],i.sub_layer_level_idc=[];for(let t=0;t{let t=Gr(e),r=new Ht(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}})(t),o=(e=>{let t=Gr(e),r=new Ht(t);r.readByte(),r.readByte();let i=0,n=0,s=0,o=0;r.readBits(4);let a=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=a;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<16?(L=t[e-1],I=i[e-1]):255===e&&(L=r.readBits(16),I=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(i+=r.readUEG(),n+=r.readUEG(),s+=r.readUEG(),o+=r.readUEG()),r.readBool()&&(R=r.readBits(32),z=r.readBits(32),r.readBool()&&(r.readUEG(),r.readBool()))){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=a;n++){let n=r.readBool();M=n;let s=!1,o=1;n||(s=r.readBool());let a=!1;if(s?r.readSEG():a=r.readBool(),a||(cpbcnt=r.readUEG()+1),e)for(let e=0;e{let t=Gr(e),r=new Ht(t);r.readByte(),r.readByte(),r.readUEG(),r.readUEG(),r.readBool(),r.readBool(),r.readBits(3),r.readBool(),r.readBool(),r.readUEG(),r.readUEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool()&&r.readUEG(),r.readSEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool(),r.readBool();let i=r.readBool(),n=r.readBool(),s=1;return n&&i?s=0:n?s=3:i&&(s=2),{parallelismType:s}})(r);n=Object.assign(n,s,o,a);let d=23+(5+t.byteLength)+(5+i.byteLength)+(5+r.byteLength),l=new Uint8Array(d);l[0]=1,l[1]=(3&n.general_profile_space)<<6|(n.general_tier_flag?1:0)<<5|31&n.general_profile_idc,l[2]=n.general_profile_compatibility_flags_1||0,l[3]=n.general_profile_compatibility_flags_2||0,l[4]=n.general_profile_compatibility_flags_3||0,l[5]=n.general_profile_compatibility_flags_4||0,l[6]=n.general_constraint_indicator_flags_1||0,l[7]=n.general_constraint_indicator_flags_2||0,l[8]=n.general_constraint_indicator_flags_3||0,l[9]=n.general_constraint_indicator_flags_4||0,l[10]=n.general_constraint_indicator_flags_5||0,l[11]=n.general_constraint_indicator_flags_6||0,l[12]=60,l[13]=240|(3840&n.min_spatial_segmentation_idc)>>8,l[14]=255&n.min_spatial_segmentation_idc,l[15]=252|3&n.parallelismType,l[16]=252|3&n.chroma_format_idc,l[17]=248|7&n.bit_depth_luma_minus8,l[18]=248|7&n.bit_depth_chroma_minus8,l[19]=0,l[20]=0,l[21]=(3&n.constant_frame_rate)<<6|(7&n.num_temporal_layers)<<3|(n.temporal_id_nested?1:0)<<2|3,l[22]=3,l[23]=128|st,l[24]=0,l[25]=1,l[26]=(65280&t.byteLength)>>8,l[27]=(255&t.byteLength)>>0,l.set(t,28),l[23+(5+t.byteLength)+0]=128|at,l[23+(5+t.byteLength)+1]=0,l[23+(5+t.byteLength)+2]=1,l[23+(5+t.byteLength)+3]=(65280&i.byteLength)>>8,l[23+(5+t.byteLength)+4]=(255&i.byteLength)>>0,l.set(i,23+(5+t.byteLength)+5),l[23+(5+t.byteLength+5+i.byteLength)+0]=128|lt,l[23+(5+t.byteLength+5+i.byteLength)+1]=0,l[23+(5+t.byteLength+5+i.byteLength)+2]=1,l[23+(5+t.byteLength+5+i.byteLength)+3]=(65280&r.byteLength)>>8,l[23+(5+t.byteLength+5+i.byteLength)+4]=(255&r.byteLength)>>0,l.set(r,23+(5+t.byteLength+5+i.byteLength)+5);const c=[28,0,0,0,0],u=new Uint8Array(c.length+l.byteLength);return u.set(c,0),u.set(l,c.length),u}function Kr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Xr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Zr(e){return(126&e[0])>>1}function Jr(e){return e===ut}function Qr(e){return!function(e){return e>=32&&e<=40}(e)}function ei(e){return e>=16&&e<=21}function ti(e){if(0===e.length)return!1;const t=Zr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=e[r]>>1&63,n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class ii{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}function ni(e){return parseInt(e)===e}function si(e){if(!ni(e.length))return!1;for(var t=0;t255)return!1;return!0}function oi(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!si(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(ni(e.length)&&si(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function ai(e){return new Uint8Array(e)}function di(e,t,r,i,n){null==i&&null==n||(e=e.slice?e.slice(i,n):Array.prototype.slice.call(e,i,n)),t.set(e,r)}var li,ci={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},ui=(li="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r>4]+li[15&i])}return t.join("")}}),hi={16:10,24:12,32:14},fi=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],pi=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],mi=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],_i=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],gi=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],yi=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],vi=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],bi=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],wi=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],Si=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Ei=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Ai=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],xi=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Ui=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Bi=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function ki(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=s[t],this._Kd[e-r][t%4]=s[t];for(var o,a=0,d=n;d>16&255]<<24^pi[o>>8&255]<<16^pi[255&o]<<8^pi[o>>24&255]^fi[a]<<24,a+=1,8!=n)for(t=1;t>8&255]<<8^pi[o>>16&255]<<16^pi[o>>24&255]<<24;for(t=n/2+1;t>2,c=d%4,this._Ke[l][c]=s[t],this._Kd[e-l][c]=s[t++],d++}for(var l=1;l>24&255]^xi[o>>16&255]^Ui[o>>8&255]^Bi[255&o]},Ti.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=ki(e),n=0;n<4;n++)i[n]^=this._Ke[0][n];for(var s=1;s>24&255]^gi[i[(n+1)%4]>>16&255]^yi[i[(n+2)%4]>>8&255]^vi[255&i[(n+3)%4]]^this._Ke[s][n];i=r.slice()}var o,a=ai(16);for(n=0;n<4;n++)o=this._Ke[t][n],a[4*n]=255&(pi[i[n]>>24&255]^o>>24),a[4*n+1]=255&(pi[i[(n+1)%4]>>16&255]^o>>16),a[4*n+2]=255&(pi[i[(n+2)%4]>>8&255]^o>>8),a[4*n+3]=255&(pi[255&i[(n+3)%4]]^o);return a},Ti.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=ki(e),n=0;n<4;n++)i[n]^=this._Kd[0][n];for(var s=1;s>24&255]^wi[i[(n+3)%4]>>16&255]^Si[i[(n+2)%4]>>8&255]^Ei[255&i[(n+1)%4]]^this._Kd[s][n];i=r.slice()}var o,a=ai(16);for(n=0;n<4;n++)o=this._Kd[t][n],a[4*n]=255&(mi[i[n]>>24&255]^o>>24),a[4*n+1]=255&(mi[i[(n+3)%4]>>16&255]^o>>16),a[4*n+2]=255&(mi[i[(n+2)%4]>>8&255]^o>>8),a[4*n+3]=255&(mi[255&i[(n+1)%4]]^o);return a};var Ci=function(e){if(!(this instanceof Ci))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new Ti(e)};Ci.prototype.encrypt=function(e){if((e=oi(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=ai(e.length),r=ai(16),i=0;iNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},Li.prototype.setBytes=function(e){if(16!=(e=oi(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Li.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var Ii=function(e,t){if(!(this instanceof Ii))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Li||(t=new Li(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new Ti(e)};Ii.prototype.encrypt=function(e){for(var t=oi(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,i=0;i>>2]>>>24-s%4*8&255;t[i+s>>>2]|=o<<24-(i+s)%4*8}else for(var a=0;a>>2]=r[a>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-n%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new l.init(r,t/2)}},h=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new l.init(r,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=a.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,n=i.words,s=i.sigBytes,o=this.blockSize,a=s/(4*o),d=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,c=e.min(4*d,s);if(d){for(var u=0;u>>2]|=e[n]<<24-n%4*8;t.call(this,i,r)}else t.apply(this,arguments)};i.prototype=e}}(),r.lib.WordArray)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.WordArray,i=e.enc;function n(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var r=e.length,i=[],n=0;n>>1]|=e.charCodeAt(n)<<16-n%2*16;return t.create(i,2*r)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s>>2]>>>16-s%4*8&65535);i.push(String.fromCharCode(o))}return i.join("")},parse:function(e){for(var r=e.length,i=[],s=0;s>>1]|=n(e.charCodeAt(s)<<16-s%2*16);return t.create(i,2*r)}}}(),r.enc.Utf16)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.WordArray;function i(e,r,i){for(var n=[],s=0,o=0;o>>6-o%4*2;n[s>>>2]|=a<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var n=[],s=0;s>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,a=0;a<4&&s+.75*a>>6*(3-a)&63));var d=i.charAt(64);if(d)for(;n.length%4;)n.push(d);return n.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var s=0;s>>6-o%4*2;n[s>>>2]|=a<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,n=t?this._safe_map:this._map;e.clamp();for(var s=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(r[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|r[o+2>>>2]>>>24-(o+2)%4*8&255,d=0;d<4&&o+.75*d>>6*(3-d)&63));var l=n.charAt(64);if(l)for(;s.length%4;)s.push(l);return s.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,n=t?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var o=0;o>>24)|4278255360&(n<<24|n>>>8)}var s=this._hash.words,o=e[t+0],d=e[t+1],f=e[t+2],p=e[t+3],m=e[t+4],_=e[t+5],g=e[t+6],y=e[t+7],v=e[t+8],b=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],A=e[t+13],x=e[t+14],U=e[t+15],B=s[0],k=s[1],T=s[2],C=s[3];B=l(B,k,T,C,o,7,a[0]),C=l(C,B,k,T,d,12,a[1]),T=l(T,C,B,k,f,17,a[2]),k=l(k,T,C,B,p,22,a[3]),B=l(B,k,T,C,m,7,a[4]),C=l(C,B,k,T,_,12,a[5]),T=l(T,C,B,k,g,17,a[6]),k=l(k,T,C,B,y,22,a[7]),B=l(B,k,T,C,v,7,a[8]),C=l(C,B,k,T,b,12,a[9]),T=l(T,C,B,k,w,17,a[10]),k=l(k,T,C,B,S,22,a[11]),B=l(B,k,T,C,E,7,a[12]),C=l(C,B,k,T,A,12,a[13]),T=l(T,C,B,k,x,17,a[14]),B=c(B,k=l(k,T,C,B,U,22,a[15]),T,C,d,5,a[16]),C=c(C,B,k,T,g,9,a[17]),T=c(T,C,B,k,S,14,a[18]),k=c(k,T,C,B,o,20,a[19]),B=c(B,k,T,C,_,5,a[20]),C=c(C,B,k,T,w,9,a[21]),T=c(T,C,B,k,U,14,a[22]),k=c(k,T,C,B,m,20,a[23]),B=c(B,k,T,C,b,5,a[24]),C=c(C,B,k,T,x,9,a[25]),T=c(T,C,B,k,p,14,a[26]),k=c(k,T,C,B,v,20,a[27]),B=c(B,k,T,C,A,5,a[28]),C=c(C,B,k,T,f,9,a[29]),T=c(T,C,B,k,y,14,a[30]),B=u(B,k=c(k,T,C,B,E,20,a[31]),T,C,_,4,a[32]),C=u(C,B,k,T,v,11,a[33]),T=u(T,C,B,k,S,16,a[34]),k=u(k,T,C,B,x,23,a[35]),B=u(B,k,T,C,d,4,a[36]),C=u(C,B,k,T,m,11,a[37]),T=u(T,C,B,k,y,16,a[38]),k=u(k,T,C,B,w,23,a[39]),B=u(B,k,T,C,A,4,a[40]),C=u(C,B,k,T,o,11,a[41]),T=u(T,C,B,k,p,16,a[42]),k=u(k,T,C,B,g,23,a[43]),B=u(B,k,T,C,b,4,a[44]),C=u(C,B,k,T,E,11,a[45]),T=u(T,C,B,k,U,16,a[46]),B=h(B,k=u(k,T,C,B,f,23,a[47]),T,C,o,6,a[48]),C=h(C,B,k,T,y,10,a[49]),T=h(T,C,B,k,x,15,a[50]),k=h(k,T,C,B,_,21,a[51]),B=h(B,k,T,C,E,6,a[52]),C=h(C,B,k,T,p,10,a[53]),T=h(T,C,B,k,w,15,a[54]),k=h(k,T,C,B,d,21,a[55]),B=h(B,k,T,C,v,6,a[56]),C=h(C,B,k,T,U,10,a[57]),T=h(T,C,B,k,g,15,a[58]),k=h(k,T,C,B,A,21,a[59]),B=h(B,k,T,C,m,6,a[60]),C=h(C,B,k,T,S,10,a[61]),T=h(T,C,B,k,f,15,a[62]),k=h(k,T,C,B,b,21,a[63]),s[0]=s[0]+B|0,s[1]=s[1]+k|0,s[2]=s[2]+T|0,s[3]=s[3]+C|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;r[n>>>5]|=128<<24-n%32;var s=e.floor(i/4294967296),o=i;r[15+(n+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(n+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,d=a.words,l=0;l<4;l++){var c=d[l];d[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return a},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,i,n,s,o){var a=e+(t&r|~t&i)+n+o;return(a<>>32-s)+t}function c(e,t,r,i,n,s,o){var a=e+(t&i|r&~i)+n+o;return(a<>>32-s)+t}function u(e,t,r,i,n,s,o){var a=e+(t^r^i)+n+o;return(a<>>32-s)+t}function h(e,t,r,i,n,s,o){var a=e+(r^(t|~i))+n+o;return(a<>>32-s)+t}t.MD5=s._createHelper(d),t.HmacMD5=s._createHmacHelper(d)}(Math),r.MD5)})),Gt((function(e,t){var r,i,n,s,o,a,d,l;e.exports=(i=(r=l=Ri).lib,n=i.WordArray,s=i.Hasher,o=r.algo,a=[],d=o.SHA1=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],d=r[4],l=0;l<80;l++){if(l<16)a[l]=0|e[t+l];else{var c=a[l-3]^a[l-8]^a[l-14]^a[l-16];a[l]=c<<1|c>>>31}var u=(i<<5|i>>>27)+d+a[l];u+=l<20?1518500249+(n&s|~n&o):l<40?1859775393+(n^s^o):l<60?(n&s|n&o|s&o)-1894007588:(n^s^o)-899497514,d=o,o=s,s=n<<30|n>>>2,n=i,i=u}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+d|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=s._createHelper(d),r.HmacSHA1=s._createHmacHelper(d),l.SHA1)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,o=t.algo,a=[],d=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,n=0;n<64;)t(i)&&(n<8&&(a[n]=r(e.pow(i,.5))),d[n]=r(e.pow(i,1/3)),n++),i++}();var l=[],c=o.SHA256=s.extend({_doReset:function(){this._hash=new n.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],a=r[4],c=r[5],u=r[6],h=r[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,_=l[f-2],g=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;l[f]=m+l[f-7]+g+l[f-16]}var y=i&n^i&s^n&s,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&c^~a&u)+d[f]+l[f];h=u,u=c,c=a,a=o+b|0,o=s,s=n,n=i,i=b+(v+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+a|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=s._createHelper(c),t.HmacSHA256=s._createHmacHelper(c)}(Math),r.SHA256)})),Gt((function(e,t){var r,i,n,s,o,a;e.exports=(i=(r=a=Ri).lib.WordArray,n=r.algo,s=n.SHA256,o=n.SHA224=s.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=s._createHelper(o),r.HmacSHA224=s._createHmacHelper(o),a.SHA224)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.Hasher,i=e.x64,n=i.Word,s=i.WordArray,o=e.algo;function a(){return n.create.apply(n,arguments)}var d=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=a()}();var c=o.SHA512=t.extend({_doReset:function(){this._hash=new s.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],a=r[4],c=r[5],u=r[6],h=r[7],f=i.high,p=i.low,m=n.high,_=n.low,g=s.high,y=s.low,v=o.high,b=o.low,w=a.high,S=a.low,E=c.high,A=c.low,x=u.high,U=u.low,B=h.high,k=h.low,T=f,C=p,D=m,P=_,F=g,L=y,I=v,M=b,R=w,z=S,N=E,$=A,O=x,G=U,H=B,W=k,V=0;V<80;V++){var j,q,Y=l[V];if(V<16)q=Y.high=0|e[t+2*V],j=Y.low=0|e[t+2*V+1];else{var K=l[V-15],X=K.high,Z=K.low,J=(X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7,Q=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),ee=l[V-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ne=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),se=l[V-7],oe=se.high,ae=se.low,de=l[V-16],le=de.high,ce=de.low;q=(q=(q=J+oe+((j=Q+ae)>>>0>>0?1:0))+ie+((j+=ne)>>>0>>0?1:0))+le+((j+=ce)>>>0>>0?1:0),Y.high=q,Y.low=j}var ue,he=R&N^~R&O,fe=z&$^~z&G,pe=T&D^T&F^D&F,me=C&P^C&L^P&L,_e=(T>>>28|C<<4)^(T<<30|C>>>2)^(T<<25|C>>>7),ge=(C>>>28|T<<4)^(C<<30|T>>>2)^(C<<25|T>>>7),ye=(R>>>14|z<<18)^(R>>>18|z<<14)^(R<<23|z>>>9),ve=(z>>>14|R<<18)^(z>>>18|R<<14)^(z<<23|R>>>9),be=d[V],we=be.high,Se=be.low,Ee=H+ye+((ue=W+ve)>>>0>>0?1:0),Ae=ge+me;H=O,W=G,O=N,G=$,N=R,$=z,R=I+(Ee=(Ee=(Ee=Ee+he+((ue+=fe)>>>0>>0?1:0))+we+((ue+=Se)>>>0>>0?1:0))+q+((ue+=j)>>>0>>0?1:0))+((z=M+ue|0)>>>0>>0?1:0)|0,I=F,M=L,F=D,L=P,D=T,P=C,T=Ee+(_e+pe+(Ae>>>0>>0?1:0))+((C=ue+Ae|0)>>>0>>0?1:0)|0}p=i.low=p+C,i.high=f+T+(p>>>0>>0?1:0),_=n.low=_+P,n.high=m+D+(_>>>0

>>0?1:0),y=s.low=y+L,s.high=g+F+(y>>>0>>0?1:0),b=o.low=b+M,o.high=v+I+(b>>>0>>0?1:0),S=a.low=S+z,a.high=w+R+(S>>>0>>0?1:0),A=c.low=A+$,c.high=E+N+(A>>>0<$>>>0?1:0),U=u.low=U+G,u.high=x+O+(U>>>0>>0?1:0),k=h.low=k+W,h.high=B+H+(k>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(c),e.HmacSHA512=t._createHmacHelper(c)}(),r.SHA512)})),Gt((function(e,t){var r,i,n,s,o,a,d,l;e.exports=(i=(r=l=Ri).x64,n=i.Word,s=i.WordArray,o=r.algo,a=o.SHA512,d=o.SHA384=a.extend({_doReset:function(){this._hash=new s.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=a._createHelper(d),r.HmacSHA384=a._createHmacHelper(d),l.SHA384)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,o=t.x64.Word,a=t.algo,d=[],l=[],c=[];!function(){for(var e=1,t=0,r=0;r<24;r++){d[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var n=1,s=0;s<24;s++){for(var a=0,u=0,h=0;h<7;h++){if(1&n){var f=(1<>>24)|4278255360&(s<<24|s>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(k=r[n]).high^=o,k.low^=s}for(var a=0;a<24;a++){for(var h=0;h<5;h++){for(var f=0,p=0,m=0;m<5;m++)f^=(k=r[h+5*m]).high,p^=k.low;var _=u[h];_.high=f,_.low=p}for(h=0;h<5;h++){var g=u[(h+4)%5],y=u[(h+1)%5],v=y.high,b=y.low;for(f=g.high^(v<<1|b>>>31),p=g.low^(b<<1|v>>>31),m=0;m<5;m++)(k=r[h+5*m]).high^=f,k.low^=p}for(var w=1;w<25;w++){var S=(k=r[w]).high,E=k.low,A=d[w];A<32?(f=S<>>32-A,p=E<>>32-A):(f=E<>>64-A,p=S<>>64-A);var x=u[l[w]];x.high=f,x.low=p}var U=u[0],B=r[0];for(U.high=B.high,U.low=B.low,h=0;h<5;h++)for(m=0;m<5;m++){var k=r[w=h+5*m],T=u[w],C=u[(h+1)%5+5*m],D=u[(h+2)%5+5*m];k.high=T.high^~C.high&D.high,k.low=T.low^~C.low&D.low}k=r[0];var P=c[a];k.high^=P.high,k.low^=P.low}},_doFinalize:function(){var t=this._data,r=t.words;this._nDataBytes;var i=8*t.sigBytes,s=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/s)*s>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var o=this._state,a=this.cfg.outputLength/8,d=a/8,l=[],c=0;c>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(h)}return new n.init(l,a)},clone:function(){for(var e=s.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=s._createHelper(h),t.HmacSHA3=s._createHmacHelper(h)}(Math),r.SHA3)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,o=t.algo,a=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=n.create([0,1518500249,1859775393,2400959708,2840853838]),h=n.create([1352829926,1548603684,1836072691,2053994217,0]),f=o.RIPEMD160=s.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s,o,f,b,w,S,E,A,x,U,B,k=this._hash.words,T=u.words,C=h.words,D=a.words,P=d.words,F=l.words,L=c.words;for(S=s=k[0],E=o=k[1],A=f=k[2],x=b=k[3],U=w=k[4],r=0;r<80;r+=1)B=s+e[t+D[r]]|0,B+=r<16?p(o,f,b)+T[0]:r<32?m(o,f,b)+T[1]:r<48?_(o,f,b)+T[2]:r<64?g(o,f,b)+T[3]:y(o,f,b)+T[4],B=(B=v(B|=0,F[r]))+w|0,s=w,w=b,b=v(f,10),f=o,o=B,B=S+e[t+P[r]]|0,B+=r<16?y(E,A,x)+C[0]:r<32?g(E,A,x)+C[1]:r<48?_(E,A,x)+C[2]:r<64?m(E,A,x)+C[3]:p(E,A,x)+C[4],B=(B=v(B|=0,L[r]))+U|0,S=U,U=x,x=v(A,10),A=E,E=B;B=k[1]+f+x|0,k[1]=k[2]+b+U|0,k[2]=k[3]+w+S|0,k[3]=k[4]+s+E|0,k[4]=k[0]+o+A|0,k[0]=B},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var n=this._hash,s=n.words,o=0;o<5;o++){var a=s[o];s[o]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return n},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function m(e,t,r){return e&t|~e&r}function _(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function v(e,t){return e<>>32-t}t.RIPEMD160=s._createHelper(f),t.HmacRIPEMD160=s._createHmacHelper(f)}(),r.RIPEMD160)})),Gt((function(e,t){var r,i,n;e.exports=(i=(r=Ri).lib.Base,n=r.enc.Utf8,void(r.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),o=this._iKey=t.clone(),a=s.words,d=o.words,l=0;l>>2];e.sigBytes-=t}};i.BlockCipher=c.extend({cfg:c.cfg.extend({mode:f,padding:p}),reset:function(){var e;c.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=i.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?s.create([1398893684,1701076831]).concat(r).concat(t):t).toString(d)},parse:function(e){var t,r=d.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=s.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),m.create({ciphertext:r,salt:t})}},g=i.SerializableCipher=n.extend({cfg:n.extend({format:_}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),s=n.finalize(t),o=n.cfg;return m.create({ciphertext:s,key:r,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,i,n){if(i||(i=s.random(8)),n)o=l.create({keySize:t+r,hasher:n}).compute(e,i);else var o=l.create({keySize:t+r}).compute(e,i);var a=s.create(o.words.slice(t),4*r);return o.sigBytes=4*t,m.create({key:o,iv:a,salt:i})}},v=i.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=n.iv;var s=g.encrypt.call(this,e,t,n.key,i);return s.mixIn(n),s},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=n.iv,g.decrypt.call(this,e,t,n.key,i)}})}())})),Gt((function(e,t){var r;e.exports=((r=Ri).mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,i){var n,s=this._iv;s?(n=s.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var o=0;o>24&255)){var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}else e+=1<<24;return e}function i(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var n=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,s=this._iv,o=this._counter;s&&(o=this._counter=s.slice(0),this._iv=void 0),i(o);var a=o.slice(0);r.encryptBlock(a,0);for(var d=0;d>>2]|=n<<24-s%4*8,e.sigBytes+=n},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),Gt((function(e,t){var r;e.exports=((r=Ri).pad.Iso10126={pad:function(e,t){var i=4*t,n=i-e.sigBytes%i;e.concat(r.lib.WordArray.random(n-1)).concat(r.lib.WordArray.create([n<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),Gt((function(e,t){var r;e.exports=((r=Ri).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),Gt((function(e,t){var r;e.exports=((r=Ri).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)})),Gt((function(e,t){var r;e.exports=((r=Ri).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib.CipherParams,n=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return i.create({ciphertext:t})}}}(),r.format.Hex)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.BlockCipher,i=e.algo,n=[],s=[],o=[],a=[],d=[],l=[],c=[],u=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,n[r]=p,s[p]=r;var m=e[r],_=e[m],g=e[_],y=257*e[p]^16843008*p;o[r]=y<<24|y>>>8,a[r]=y<<16|y>>>16,d[r]=y<<8|y>>>24,l[r]=y,y=16843009*g^65537*_^257*m^16843008*r,c[p]=y<<24|y>>>8,u[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,r?(r=m^e[e[e[g^m]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=i.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),s=this._keySchedule=[],o=0;o6&&o%r==4&&(l=n[l>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l]):(l=n[(l=l<<8|l>>>24)>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l],l^=p[o/r|0]<<24),s[o]=s[o-r]^l);for(var a=this._invKeySchedule=[],d=0;d>>24]]^u[n[l>>>16&255]]^h[n[l>>>8&255]]^f[n[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,a,d,l,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,c,u,h,f,s),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,s,o,a){for(var d=this._nRounds,l=e[t]^r[0],c=e[t+1]^r[1],u=e[t+2]^r[2],h=e[t+3]^r[3],f=4,p=1;p>>24]^n[c>>>16&255]^s[u>>>8&255]^o[255&h]^r[f++],_=i[c>>>24]^n[u>>>16&255]^s[h>>>8&255]^o[255&l]^r[f++],g=i[u>>>24]^n[h>>>16&255]^s[l>>>8&255]^o[255&c]^r[f++],y=i[h>>>24]^n[l>>>16&255]^s[c>>>8&255]^o[255&u]^r[f++];l=m,c=_,u=g,h=y}m=(a[l>>>24]<<24|a[c>>>16&255]<<16|a[u>>>8&255]<<8|a[255&h])^r[f++],_=(a[c>>>24]<<24|a[u>>>16&255]<<16|a[h>>>8&255]<<8|a[255&l])^r[f++],g=(a[u>>>24]<<24|a[h>>>16&255]<<16|a[l>>>8&255]<<8|a[255&c])^r[f++],y=(a[h>>>24]<<24|a[l>>>16&255]<<16|a[c>>>8&255]<<8|a[255&u])^r[f++],e[t]=m,e[t+1]=_,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(m)}(),r.AES)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib,i=t.WordArray,n=t.BlockCipher,s=e.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=s.DES=n.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=o[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],s=0;s<16;s++){var l=n[s]=[],c=d[s];for(r=0;r<24;r++)l[r/6|0]|=t[(a[r]-1+c)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(a[r+24]-1+c)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var u=this._invSubKeys=[];for(r=0;r<16;r++)u[r]=n[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],s=this._lBlock,o=this._rBlock,a=0,d=0;d<8;d++)a|=l[d][((o^n[d])&c[d])>>>0];this._lBlock=o,this._rBlock=s^a}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),n=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(i.create(t)),this._des2=u.createEncryptor(i.create(r)),this._des3=u.createEncryptor(i.create(n))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=n._createHelper(p)}(),r.TripleDES)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=i.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var s=0;n<256;n++){var o=n%r,a=t[o>>>2]>>>24-o%4*8&255;s=(s+i[n]+a)%256;var d=i[n];i[n]=i[s],i[s]=d}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var e=this._S,t=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[r],e[r]=s,i|=e[(e[t]+e[r])%256]<<24-8*n}return this._i=t,this._j=r,i}e.RC4=t._createHelper(n);var o=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)s.call(this)}});e.RC4Drop=t._createHelper(o)}(),r.RC4)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],o=[],a=i.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)d.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(t){var s=t.words,o=s[0],a=s[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(n[0]^=l,n[1]^=u,n[2]^=c,n[3]^=h,n[4]^=l,n[5]^=u,n[6]^=c,n[7]^=h,r=0;r<4;r++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,a=i>>>16,d=((n*n>>>17)+n*a>>>15)+a*a,l=((4294901760&i)*i|0)+((65535&i)*i|0);o[r]=d^l}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=t._createHelper(a)}(),r.Rabbit)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],o=[],a=i.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var n=0;n<4;n++)d.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var s=t.words,o=s[0],a=s[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(i[0]^=l,i[1]^=u,i[2]^=c,i[3]^=h,i[4]^=l,i[5]^=u,i[6]^=c,i[7]^=h,n=0;n<4;n++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,a=i>>>16,d=((n*n>>>17)+n*a>>>15)+a*a,l=((4294901760&i)*i|0)+((65535&i)*i|0);o[r]=d^l}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=t._createHelper(a)}(),r.RabbitLegacy)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.BlockCipher,i=e.algo;const n=16,s=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],o=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var a={pbox:[],sbox:[]};function d(e,t){let r=t>>24&255,i=t>>16&255,n=t>>8&255,s=255&t,o=e.sbox[0][r]+e.sbox[1][i];return o^=e.sbox[2][n],o+=e.sbox[3][s],o}function l(e,t,r){let i,s=t,o=r;for(let t=0;t1;--t)s^=e.pbox[t],o=d(e,s)^o,i=s,s=o,o=i;return i=s,s=o,o=i,o^=e.pbox[1],s^=e.pbox[0],{left:s,right:o}}function u(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=o[t][r]}let i=0;for(let o=0;o=r&&(i=0);let a=0,d=0,c=0;for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),r=new Uint8Array(r);const n=e.byteLength;let s=5;for(;sn)break;let a=e[s+4],d=!1;if(i?(a=a>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(a)):(a&=31,d=1===a||5===a),d){const i=e.slice(s+4+2,s+4+o);let n=new Mi.ModeOfOperation.ctr(t,new Mi.Counter(r));const a=n.decrypt(i);n=null,e.set(a,s+4+2)}s=s+4+o}return e}function $i(e,t,r){if(e.byteLength<=30)return e;const i=e.slice(32);let n=new Mi.ModeOfOperation.ctr(t,new Mi.Counter(r));const s=n.decrypt(i);return n=null,e.set(s,32),e}Gt((function(e,t){e.exports=Ri}));var Oi=Gt((function(e,t){var r,n,s,o=(r=new Date,n=4,s={setLogLevel:function(e){n=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=n&&console.debug("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=n&&console.info("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=n&&console.warn("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=n&&console.error("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}},s);o.getDurationString=function(e,t){var r;function i(e,t){for(var r=(""+e).split(".");r[0].length0){for(var r="",i=0;i0&&(r+=","),r+="["+o.getDurationString(e.start(i))+","+o.getDurationString(e.end(i))+"]";return r}return"(empty)"},t.Log=o;var a=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};a.prototype.getPosition=function(){return this.position},a.prototype.getEndPosition=function(){return this.buffer.byteLength},a.prototype.getLength=function(){return this.buffer.byteLength},a.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},a.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},a.prototype.readAnyInt=function(e,t){var r=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:r=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:r=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";r=this.dataview.getUint8(this.position)<<16,r|=this.dataview.getUint8(this.position+1)<<8,r|=this.dataview.getUint8(this.position+2);break;case 4:r=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";r=this.dataview.getUint32(this.position)<<32,r|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,r}throw"Not enough bytes in buffer"},a.prototype.readUint8=function(){return this.readAnyInt(1,!1)},a.prototype.readUint16=function(){return this.readAnyInt(2,!1)},a.prototype.readUint24=function(){return this.readAnyInt(3,!1)},a.prototype.readUint32=function(){return this.readAnyInt(4,!1)},a.prototype.readUint64=function(){return this.readAnyInt(8,!1)},a.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",r=0;rthis._byteLength&&(this._byteLength=t);else{for(r<1&&(r=1);t>r;)r*=2;var i=new ArrayBuffer(r),n=new Uint8Array(this._buffer);new Uint8Array(i,0,n.length).set(n),this.buffer=i,this._byteLength=t}}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),r=new Uint8Array(this._buffer,0,t.length);t.set(r),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Int32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Int16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Uint32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Uint16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var r=new Float64Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Float32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,r,i,n){var s=new Uint8Array(e,t,n),o=new Uint8Array(r,i,n);s.set(o)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=0;rn;i--,n++){var s=t[n];t[n]=t[i],t[i]=s}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],r=0;r>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},d.prototype.adjustUint32=function(e,t){var r=this.position;this.seek(e),this.writeUint32(t),this.seek(r)},d.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var r=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var r=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var r=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var r=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var r=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=8*e,r},d.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var r=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r};var c=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(c.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,o.debug("MultiBufferStream","Stream ready for parsing"),!0):(o.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(o.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){o.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r.buffer},c.prototype.reduceBuffer=function(e,t,r){var i;return(i=new Uint8Array(r)).set(new Uint8Array(e,t,r)),i.buffer.fileStart=e.fileStart+t,i.buffer.usedBytes=0,i.buffer},c.prototype.insertBuffer=function(e){for(var t=!0,r=0;ri.byteLength){this.buffers.splice(r,1),r--;continue}o.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=i.fileStart||(e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)),o.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(r,0,e),0===r&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,n,s)}}t&&(o.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===r&&(this.buffer=e))},c.prototype.logBufferLevel=function(e){var t,r,i,n,s,a=[],d="";for(i=0,n=0,t=0;t0&&(d+=s.end-1+"]");var l=e?o.info:o.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+i+"/"+n+" bytes), continuous ranges: "+d)},c.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},c.prototype.findPosition=function(e,t,r){var i,n=null,s=-1;for(i=!0===e?0:this.bufferIndex;i=t?(o.debug("MultiBufferStream","Found position in existing buffer #"+s),s):-1},c.prototype.findEndContiguousBuf=function(e){var t,r,i,n=void 0!==e?e:this.bufferIndex;if(r=this.buffers[n],this.buffers.length>n+1)for(t=n+1;t>3;return 31===i&&r.data.length>=2&&(i=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),i}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};t.MPEG4DescriptorParser=u;var h={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){h.FullBox.prototype=new h.Box,h.ContainerBox.prototype=new h.Box,h.SampleEntry.prototype=new h.Box,h.TrackGroupTypeBox.prototype=new h.FullBox,h.BASIC_BOXES.forEach((function(e){h.createBoxCtor(e)})),h.FULL_BOXES.forEach((function(e){h.createFullBoxCtor(e)})),h.CONTAINER_BOXES.forEach((function(e){h.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,r){this.type=e,this.size=t,this.uuid=r},FullBox:function(e,t,r){h.Box.call(this,e,t,r),this.flags=0,this.version=0},ContainerBox:function(e,t,r){h.Box.call(this,e,t,r),this.boxes=[]},SampleEntry:function(e,t,r,i){h.ContainerBox.call(this,e,t),this.hdr_size=r,this.start=i},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){h.FullBox.call(this,e,t)},createBoxCtor:function(e,t){h.boxCodes.push(e),h[e+"Box"]=function(t){h.Box.call(this,e,t)},h[e+"Box"].prototype=new h.Box,t&&(h[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){h[e+"Box"]=function(t){h.FullBox.call(this,e,t)},h[e+"Box"].prototype=new h.FullBox,h[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,r=0;rr?(o.error("BoxParser","Box of type '"+c+"' has a size "+l+" greater than its container size "+r),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:a}):0!==l&&a+l>e.getEndPosition()?(e.seek(a),o.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:a}):t?{code:h.OK,type:c,size:l,hdr_size:d,start:a}:(h[c+"Box"]?i=new h[c+"Box"](l):"uuid"!==c?(o.warn("BoxParser","Unknown box type: '"+c+"'"),(i=new h.Box(c,l)).has_unparsed_data=!0):h.UUIDBoxes[s]?i=new h.UUIDBoxes[s](l):(o.warn("BoxParser","Unknown uuid type: '"+s+"'"),(i=new h.Box(c,l)).uuid=s,i.has_unparsed_data=!0),i.hdr_size=d,i.start=a,i.write===h.Box.prototype.write&&"mdat"!==i.type&&(o.info("BoxParser","'"+u+"' box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),(n=e.getPosition()-(i.start+i.size))<0?(o.warn("BoxParser","Parsing of box '"+u+"' did not read the entire indicated box data size (missing "+-n+" bytes), seeking forward"),e.seek(i.start+i.size)):n>0&&(o.error("BoxParser","Parsing of box '"+u+"' read "+n+" more bytes than the indicated box data size, seeking backwards"),0!==i.size&&e.seek(i.start+i.size)),{code:h.OK,box:i,size:i.size})},h.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},h.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},h.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.ContainerBox.prototype.parse=function(e){for(var t,r;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},h.SAMPLE_ENTRY_TYPE_VISUAL="Visual",h.SAMPLE_ENTRY_TYPE_AUDIO="Audio",h.SAMPLE_ENTRY_TYPE_HINT="Hint",h.SAMPLE_ENTRY_TYPE_METADATA="Metadata",h.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",h.SAMPLE_ENTRY_TYPE_SYSTEM="System",h.SAMPLE_ENTRY_TYPE_TEXT="Text",h.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},h.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},h.SampleEntry.prototype.parseFooter=function(e){h.ContainerBox.prototype.parse.call(this,e)},h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_HINT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT,"enct"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA,"encm"),h.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var r=0;r<3;r++)this.layer_size[r]=16==t?e.readUint16():e.readUint32()})),h.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),h.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),h.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)o.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void o.error("av1C reserved_2 parsing problem");var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)}else o.error("av1C reserved_1 parsing problem");else o.error("av1C version "+this.version+" not supported")})),h.createBoxCtor("avcC",(function(e){var t,r;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),r=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(r))})),h.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),h.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),h.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),h.createFullBoxCtor("co64",(function(e){var t,r;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(r=0;r>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),h.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),h.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),h.createFullBoxCtor("ctts",(function(e){var t,r;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(r=0;r>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|r>>6&3,this.acmod=r>>3&7,this.lfeon=r>>2&1,this.bit_rate_code=3&r|i>>5&7})),h.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var r=0;r>6,i.bsid=n>>1&31,i.bsmod=(1&n)<<4|s>>4&15,i.acmod=s>>1&7,i.lfeon=1&s,i.num_dep_sub=o>>1&15,i.num_dep_sub>0&&(i.chan_loc=(1&o)<<8|e.readUint8())}})),h.createFullBoxCtor("dfLa",(function(e){var t=[],r=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var i=e.readUint8(),n=Math.min(127&i,r.length-1);if(n?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(r[n]),128&i)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),h.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[r]=e.readString(4),t-=4,r++})),h.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),h.createBoxCtor("hvcC",(function(e){var t,r,i,n;this.configurationVersion=e.readUint8(),n=e.readUint8(),this.general_profile_space=n>>6,this.general_tier_flag=(32&n)>>5,this.general_profile_idc=31&n,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),n=e.readUint8(),this.constantFrameRate=n>>6,this.numTemporalLayers=(13&n)>>3,this.temporalIdNested=(4&n)>>2,this.lengthSizeMinusOne=3&n,this.nalu_arrays=[];var s=e.readUint8();for(t=0;t>7,o.nalu_type=63&n;var a=e.readUint16();for(r=0;r>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var r=0;if(this.version<2)r=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";r=e.readUint32()}for(var i=0;i>7,this.axis=1&t})),h.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),o.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),h.createFullBoxCtor("ipma",(function(e){var t,r;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?o.property_index=(127&s)<<8|e.readUint8():o.property_index=127&s}}})),h.createFullBoxCtor("iref",(function(e){var t,r;for(this.references=[];e.getPosition()>7,i.assignment_type=127&n,i.assignment_type){case 0:i.grouping_type=e.readString(4);break;case 1:i.grouping_type=e.readString(4),i.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:i.sub_track_id=e.readUint32();break;default:o.warn("BoxParser","Unknown leva assignement type")}}})),h.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),h.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),f.prototype.toString=function(){return"("+this.x+","+this.y+")"},h.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new f(e.readUint16(),e.readUint16()),this.display_primaries[1]=new f(e.readUint16(),e.readUint16()),this.display_primaries[2]=new f(e.readUint16(),e.readUint16()),this.white_point=new f(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),h.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),h.createFullBoxCtor("mehd",(function(e){1&this.flags&&(o.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),h.createFullBoxCtor("meta",(function(e){this.boxes=[],h.ContainerBox.prototype.parse.call(this,e)})),h.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),h.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),h.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),h.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),h.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),h.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),h.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var r=0;r0){var t=e.readUint32();this.kid=[];for(var r=0;r0&&(this.data=e.readUint8Array(i))})),h.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),h.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),h.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var r=0;r>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var r=e.readUint8(),i=0;i>7,this.num_leading_samples=127&t})),h.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)o.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=h.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),h.createSampleGroupCtor("stsa",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),h.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),h.createSampleGroupCtor("tsas",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("tscl",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("vipr",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),r=0;r>6,this.sample_depends_on[i]=t>>4&3,this.sample_is_depended_on[i]=t>>2&3,this.sample_has_redundancy[i]=3&t})),h.createFullBoxCtor("senc"),h.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),o.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),r=0;r>31&1,i.referenced_size=2147483647&n,i.subsegment_duration=e.readUint32(),n=e.readUint32(),i.starts_with_SAP=n>>31&1,i.SAP_type=n>>28&7,i.SAP_delta_time=268435455&n}})),h.SingleItemTypeReferenceBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.SingleItemTypeReferenceBox.prototype=new h.Box,h.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var r=0;r>4&15,this.sample_sizes[t+1]=15&i}else if(8===this.field_size)for(t=0;t0)for(r=0;r>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=h.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),h.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),h.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),h.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var r=e.readUint32(),i=0;i>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),h.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),h.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),h.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},h.createTrackGroupCtor("msrc"),h.TrackReferenceTypeBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.TrackReferenceTypeBox.prototype=new h.Box,h.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},h.trefBox.prototype.parse=function(e){for(var t,r;e.getPosition()t&&this.flags&h.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var r=0;r>7&1,this.block_pad_lsb=r>>6&1,this.block_little_endian=r>>5&1,this.block_reversed=r>>4&1,this.pad_unknown=r>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),h.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),h.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),h.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),h.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=h.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),h.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),h.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=h.parseHex16(e)})),h.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),h.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),h.createFullBoxCtor("vvcC",(function(e){var t,r,i={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(i.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,r=this.num_sublayers-2;r>=0;--r){var o=i.extract_bits(1);this.ptl_sublayer_present_mask|=o<1;++r)i.extract_bits(1);for(this.sublayer_level_idc=[],r=this.num_sublayers-2;r>=0;--r)this.ptl_sublayer_present_mask&1<>=1;t+=h.decimalToHex(i,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var n=!1,s="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||n)&&(s="."+h.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+s,n=!0);t+=s}return t},h.vvc1SampleEntry.prototype.getCodec=h.vvi1SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var r="";if(this.vvcC.general_constraint_info){var i,n=[],s=0;for(s|=this.vvcC.ptl_frame_only_constraint<<7,s|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,n.push(s),s&&(i=e),s=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===i)r=".CA";else{r=".C";var o="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",a=0,d=0;for(e=0;e<=i;++e)for(a=a<<8|n[e],d+=8;d>=5;){r+=o[a>>d-5&31],a&=(1<<(d-=5))-1}d&&(r+=o[31&(a<<=5-d)])}}t+=r}return t},h.mp4aSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),r=this.esds.esd.getAudioConfig();return e+"."+h.decimalToHex(t)+(r?"."+r:"")}return e},h.stxtSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},h.vp08SampleEntry.prototype.getCodec=h.vp09SampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var r=this.vpcC.bitDepth;return 8==r&&(r="08"),e+".0"+this.vpcC.profile+"."+t+"."+r},h.av01SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this),r=this.av1C.seq_level_idx_0;return r<10&&(r="0"+r),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+r+(this.av1C.seq_tier_0?"H":"M")+"."+e},h.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),o.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>l?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>l&&e.writeUint64(this.size)},h.FullBox.prototype.writeHeader=function(e){this.size+=4,h.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},h.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},h.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},h.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},h.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},h.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},h.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&h.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&h.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&h.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&h.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[r]instanceof h.Box||t[r]instanceof h.Box||void 0===e[r]||void 0===t[r]||"function"==typeof e[r]||"function"==typeof t[r]||e.subBoxNames&&e.subBoxNames.indexOf(r.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(r.slice(0,4))>-1||"data"===r||"start"===r||"size"===r||"creation_time"===r||"modification_time"===r||h.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(r)>-1||e[r]===t[r]))return!1;return!0},h.boxEqual=function(e,t){if(!h.boxEqualFields(e,t))return!1;for(var r=0;r1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},g.prototype.setExtractionOptions=function(e,t,r){var i=this.getTrackById(e);if(i){var n={};this.extractedTracks.push(n),n.id=e,n.user=t,n.trak=i,i.nextSample=0,n.nb_samples=1e3,n.samples=[],r&&r.nbSamples&&(n.nb_samples=r.nbSamples)}},g.prototype.unsetExtractionOptions=function(e){for(var t=-1,r=0;r-1&&this.extractedTracks.splice(t,1)},g.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=h.parseOneBox(this.stream,false)).code===h.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var r;switch(r="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),r){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[r]&&o.warn("ISOFile","Duplicate Box of type: "+r+", overriding previous occurrence"),this[r]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},g.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(o.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(o.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(o.warn("ISOFile","Not ready to start parsing"),!1))},g.prototype.appendBuffer=function(e,t){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(o.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),o.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),r},g.prototype.getInfo=function(){var e,t,r,i,n,s,o={},a=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(o.hasMoov=!0,o.duration=this.moov.mvhd.duration,o.timescale=this.moov.mvhd.timescale,o.isFragmented=null!=this.moov.mvex,o.isFragmented&&this.moov.mvex.mehd&&(o.fragment_duration=this.moov.mvex.mehd.fragment_duration),o.isProgressive=this.isProgressive,o.hasIOD=null!=this.moov.iods,o.brands=[],o.brands.push(this.ftyp.major_brand),o.brands=o.brands.concat(this.ftyp.compatible_brands),o.created=new Date(a+1e3*this.moov.mvhd.creation_time),o.modified=new Date(a+1e3*this.moov.mvhd.modification_time),o.tracks=[],o.audioTracks=[],o.videoTracks=[],o.subtitleTracks=[],o.metadataTracks=[],o.hintTracks=[],o.otherTracks=[],e=0;e0?o.mime+='video/mp4; codecs="':o.audioTracks&&o.audioTracks.length>0?o.mime+='audio/mp4; codecs="':o.mime+='application/mp4; codecs="',e=0;e=r.samples.length)&&(o.info("ISOFile","Sending fragmented data on track #"+i.id+" for samples ["+Math.max(0,r.nextSample-i.nb_samples)+","+(r.nextSample-1)+"]"),o.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(i.id,i.user,i.segmentStream.buffer,r.nextSample,e||r.nextSample>=r.samples.length),i.segmentStream=null,i!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=r.samples.length)&&(o.debug("ISOFile","Sending samples on track #"+s.id+" for sample "+r.nextSample),this.onSamples&&this.onSamples(s.id,s.user,s.samples),s.samples=[],s!==this.extractedTracks[t]))break}}}},g.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},g.prototype.getBoxes=function(e,t){var r=[];return g._sweep.call(this,e,r,t),r},g._sweep=function(e,t,r){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&r)return;g._sweep.call(this.boxes[i],e,t,r)}},g.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},g.prototype.getTrackSample=function(e,t){var r=this.getTrackById(e);return this.getSample(r,t)},g.prototype.releaseUsedSamples=function(e,t,r){var i=0,n=this.getTrackById(e);n.lastValidSample||(n.lastValidSample=0);for(var s=n.lastValidSample;se*n.timescale){l=i-1;break}t&&n.is_sync&&(d=i)}for(t&&(l=d),e=r.samples[l].cts,r.nextSample=l;r.samples[l].alreadyRead===r.samples[l].size&&r.samples[l+1];)l++;return s=r.samples[l].offset+r.samples[l].alreadyRead,o.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+o.getDurationString(e,a)+" and offset: "+s),{offset:s,time:e/a}},g.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},g.prototype.seek=function(e,t){var r,i,n,s=this.moov,a={offset:1/0,time:1/0};if(this.moov){for(n=0;nthis.getTrackDuration(r)||((i=this.seekTrack(e,t,r)).offset-1){o=d;break}switch(o){case"Visual":if(n.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),s.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var u=new h.avcCBox;u.parse(new a(t.avcDecoderConfigRecord)),s.addBox(u)}else if(t.hevcDecoderConfigRecord){var f=new h.hvcCBox;f.parse(new a(t.hevcDecoderConfigRecord)),s.addBox(f)}break;case"Audio":n.add("smhd").set("balance",t.balance||0),s.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":n.add("hmhd");break;case"Subtitle":if(n.add("sthd"),"stpp"===t.type)s.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:n.add("nmhd")}t.description&&s.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){s.addBox(e)})),n.add("dinf").add("dref").addEntry((new h["url Box"]).set("flags",1));var p=n.add("stbl");return p.add("stsd").addEntry(s),p.add("stts").set("sample_counts",[]).set("sample_deltas",[]),p.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),p.add("stco").set("chunk_offsets",[]),p.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(r),t.id}},h.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},g.prototype.addSample=function(e,t,r){var i=r||{},n={},s=this.getTrackById(e);if(null!==s){n.number=s.samples.length,n.track_id=s.tkhd.track_id,n.timescale=s.mdia.mdhd.timescale,n.description_index=i.sample_description_index?i.sample_description_index-1:0,n.description=s.mdia.minf.stbl.stsd.entries[n.description_index],n.data=t,n.size=t.byteLength,n.alreadyRead=n.size,n.duration=i.duration||1,n.cts=i.cts||0,n.dts=i.dts||0,n.is_sync=i.is_sync||!1,n.is_leading=i.is_leading||0,n.depends_on=i.depends_on||0,n.is_depended_on=i.is_depended_on||0,n.has_redundancy=i.has_redundancy||0,n.degradation_priority=i.degradation_priority||0,n.offset=0,n.subsamples=i.subsamples,s.samples.push(n),s.samples_size+=n.size,s.samples_duration+=n.duration,void 0===s.first_dts&&(s.first_dts=i.dts),this.processSamples();var o=this.createSingleSampleMoof(n);return this.addBox(o),o.computeSize(),o.trafs[0].truns[0].data_offset=o.size+8,this.add("mdat").data=new Uint8Array(t),n}},g.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var r=new h.moofBox;r.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var i=r.add("traf"),n=this.getTrackById(e.track_id);return i.add("tfhd").set("track_id",e.track_id).set("flags",h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),i.add("tfdt").set("baseMediaDecodeTime",e.dts-(n.first_dts||0)),i.add("trun").set("flags",h.TRUN_FLAGS_DATA_OFFSET|h.TRUN_FLAGS_DURATION|h.TRUN_FLAGS_SIZE|h.TRUN_FLAGS_FLAGS|h.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),r},g.prototype.lastMoofIndex=0,g.prototype.samplesDataSize=0,g.prototype.resetTables=function(){var e,t,r,i,n,s;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(d=n[o].grouping_type+"/0",(a=new l(n[o].grouping_type,0)).is_fragment=!0,t.sample_groups_info[d]||(t.sample_groups_info[d]=a))}else for(o=0;o=2&&(d=i[o].grouping_type+"/0",a=new l(i[o].grouping_type,0),e.sample_groups_info[d]||(e.sample_groups_info[d]=a))},g.setSampleGroupProperties=function(e,t,r,i){var n,s;for(n in t.sample_groups=[],i){var o;if(t.sample_groups[n]={},t.sample_groups[n].grouping_type=i[n].grouping_type,t.sample_groups[n].grouping_type_parameter=i[n].grouping_type_parameter,r>=i[n].last_sample_in_run&&(i[n].last_sample_in_run<0&&(i[n].last_sample_in_run=0),i[n].entry_index++,i[n].entry_index<=i[n].sbgp.entries.length-1&&(i[n].last_sample_in_run+=i[n].sbgp.entries[i[n].entry_index].sample_count)),i[n].entry_index<=i[n].sbgp.entries.length-1?t.sample_groups[n].group_description_index=i[n].sbgp.entries[i[n].entry_index].group_description_index:t.sample_groups[n].group_description_index=-1,0!==t.sample_groups[n].group_description_index)o=i[n].fragment_description?i[n].fragment_description:i[n].description,t.sample_groups[n].group_description_index>0?(s=t.sample_groups[n].group_description_index>65535?(t.sample_groups[n].group_description_index>>16)-1:t.sample_groups[n].group_description_index-1,o&&s>=0&&(t.sample_groups[n].description=o.entries[s])):o&&o.version>=2&&o.default_group_description_index>0&&(t.sample_groups[n].description=o.entries[o.default_group_description_index-1])}},g.process_sdtp=function(e,t,r){t&&(e?(t.is_leading=e.is_leading[r],t.depends_on=e.sample_depends_on[r],t.is_depended_on=e.sample_is_depended_on[r],t.has_redundancy=e.sample_has_redundancy[r]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},g.prototype.buildSampleLists=function(){var e,t;for(e=0;ev&&(b++,v<0&&(v=0),v+=s.sample_counts[b]),t>0?(e.samples[t-1].duration=s.sample_deltas[b],e.samples_duration+=e.samples[t-1].duration,U.dts=e.samples[t-1].dts+e.samples[t-1].duration):U.dts=0,o?(t>=w&&(S++,w<0&&(w=0),w+=o.sample_counts[S]),U.cts=e.samples[t].dts+o.sample_offsets[S]):U.cts=U.dts,a?(t==a.sample_numbers[E]-1?(U.is_sync=!0,E++):(U.is_sync=!1,U.degradation_priority=0),l&&l.entries[A].sample_delta+x==t+1&&(U.subsamples=l.entries[A].subsamples,x+=l.entries[A].sample_delta,A++)):U.is_sync=!0,g.process_sdtp(e.mdia.minf.stbl.sdtp,U,U.number),U.degradation_priority=h?h.priority[t]:0,l&&l.entries[A].sample_delta+x==t&&(U.subsamples=l.entries[A].subsamples,x+=l.entries[A].sample_delta),(c.length>0||u.length>0)&&g.setSampleGroupProperties(e,U,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},g.prototype.updateSampleLists=function(){var e,t,r,i,n,s,o,a,d,l,c,u,f,p,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&g.initSampleGroups(u,c,c.sbgps,u.mdia.minf.stbl.sgpds,c.sgpds),t=0;t0?p.dts=u.samples[u.samples.length-2].dts+u.samples[u.samples.length-2].duration:(c.tfdt?p.dts=c.tfdt.baseMediaDecodeTime:p.dts=0,u.first_traf_merged=!0),p.cts=p.dts,_.flags&h.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+_.sample_composition_time_offset[r]),m=o,_.flags&h.TRUN_FLAGS_FLAGS?m=_.sample_flags[r]:0===r&&_.flags&h.TRUN_FLAGS_FIRST_FLAG&&(m=_.first_sample_flags),p.is_sync=!(m>>16&1),p.is_leading=m>>26&3,p.depends_on=m>>24&3,p.is_depended_on=m>>22&3,p.has_redundancy=m>>20&3,p.degradation_priority=65535&m;var y=!!(c.tfhd.flags&h.TFHD_FLAG_BASE_DATA_OFFSET),v=!!(c.tfhd.flags&h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),b=!!(_.flags&h.TRUN_FLAGS_DATA_OFFSET),w=0;w=y?c.tfhd.base_data_offset:v||0===t?l.start:a,p.offset=0===t&&0===r?b?w+_.data_offset:w:a,a=p.offset+p.size,(c.sbgps.length>0||c.sgpds.length>0||u.mdia.minf.stbl.sbgps.length>0||u.mdia.minf.stbl.sgpds.length>0)&&g.setSampleGroupProperties(u,p,p.number_in_traf,c.sample_groups_info)}}if(c.subs){u.has_fragment_subsamples=!0;var S=c.first_sample_index;for(t=0;t-1))return null;var s=(r=this.stream.buffers[n]).byteLength-(i.offset+i.alreadyRead-r.fileStart);if(i.size-i.alreadyRead<=s)return o.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+(i.size-i.alreadyRead)+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,i.size-i.alreadyRead),r.usedBytes+=i.size-i.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead=i.size,i;if(0===s)return null;o.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+s+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,s),i.alreadyRead+=s,r.usedBytes+=s,this.stream.logBufferLevel()}},g.prototype.releaseSample=function(e,t){var r=e.samples[t];return r.data?(this.samplesDataSize-=r.size,r.data=null,r.description=null,delete r.degradation_priority,delete r.depends_on,delete r.description_index,delete r.has_redundancy,delete r.is_depended_on,delete r.is_leading,delete r.is_sync,delete r.moof_number,delete r.number_in_traf,delete r.timescale,delete r.cts,delete r.dts,delete r.offset,delete r.size,delete r.track_id,delete r.duration,r.alreadyRead=0,r.size):0},g.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},g.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},g.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(r.protection=s.ipro.protections[s.iinf.item_infos[e].protection_index-1]),s.iinf.item_infos[e].item_type?r.type=s.iinf.item_infos[e].item_type:r.type="mime",r.content_type=s.iinf.item_infos[e].content_type,r.content_encoding=s.iinf.item_infos[e].content_encoding;if(s.grpl)for(e=0;e0&&h.property_index-1-1))return null;var a=(t=this.stream.buffers[s]).byteLength-(n.offset+n.alreadyRead-t.fileStart);if(!(n.length-n.alreadyRead<=a))return o.debug("ISOFile","Getting item #"+e+" extent #"+i+" partial data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+a+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,a),n.alreadyRead+=a,r.alreadyRead+=a,t.usedBytes+=a,this.stream.logBufferLevel(),null;o.debug("ISOFile","Getting item #"+e+" extent #"+i+" data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+(n.length-n.alreadyRead)+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,n.length-n.alreadyRead),t.usedBytes+=n.length-n.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead+=n.length-n.alreadyRead,n.alreadyRead=n.length}}return r.alreadyRead===r.size?r:null},g.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var r=0;r0?this.moov.traks[e].samples[0].duration:0),t.push(i)}return t},g.prototype.getPerformanceInfo=function(){var e={};return e.moov=this.moov,this.moov&&this.moov.traks&&this.moov.traks.length>1&&(e.moovAudioNum=this.moov.traks[0].samples.length,e.moovVideoNum=this.moov.traks[1].samples.length),e},h.Box.prototype.printHeader=function(e){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},h.FullBox.prototype.printHeader=function(e){this.size+=4,h.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},h.Box.prototype.print=function(e){this.printHeader(e)},h.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},h.tkhdBox.prototype.print=function(e){h.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var y={createFile:function(e,t){var r=void 0===e||e,i=new g(t);return i.discardMdatData=!r,i}};t.createFile=y.createFile}));function Gi(e){return e.reduce(((e,t)=>256*e+t))}function Hi(e){const t=[101,103,119,99],r=e.length-28,i=e.slice(r,r+t.length);return t.every(((e,t)=>e===i[t]))}Oi.Log,Oi.MP4BoxStream,Oi.DataStream,Oi.MultiBufferStream,Oi.MPEG4DescriptorParser,Oi.BoxParser,Oi.XMLSubtitlein4Parser,Oi.Textin4Parser,Oi.ISOFile,Oi.createFile;class Wi{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(r+32,r+32+t))]}return null}(t,this.t);if(!r)return e;const i=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(i instanceof Error)return console.error(i.message),this.d=!0,e;this.A=!0,this.u=r[1],Hi(t)&&this.c++,WebAssembly.instantiate(r[2],i).then((e=>{if("function"!=typeof(t=e.instance.exports).parse||"object"!=typeof t.memory)return this.d=!0,void console.error("video_error_3");var t;this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}function Vi(){for(var e=arguments.length,t=new Array(e),r=0;r{const r=new i((0|e.byteLength)+(0|t.byteLength));return r.set(e,0),r.set(t,0|e.byteLength),r}),new i)}const ji=16,qi=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],Yi=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Ki(e){const t=[];for(let r=0,i=e.length;r1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Zi(e){const t=[];for(let r=0,i=e.length;r>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}function Ji(e){const t=[];for(let r=0,i=e.length;r=240&&e[r]<=247?(t.push(String.fromCodePoint(((7&e[r])<<18)+((63&e[r+1])<<12)+((63&e[r+2])<<6)+(63&e[r+3]))),r+=3):e[r]>=224&&e[r]<=239?(t.push(String.fromCodePoint(((15&e[r])<<12)+((63&e[r+1])<<6)+(63&e[r+2]))),r+=2):e[r]>=192&&e[r]<=223?(t.push(String.fromCodePoint(((31&e[r])<<6)+(63&e[r+1]))),r++):t.push(String.fromCodePoint(e[r]));return t.join("")}function Qi(e,t){const r=31&t;return e<>>32-r}function en(e){return(255&qi[e>>>24&255])<<24|(255&qi[e>>>16&255])<<16|(255&qi[e>>>8&255])<<8|255&qi[255&e]}function tn(e){return e^Qi(e,2)^Qi(e,10)^Qi(e,18)^Qi(e,24)}function rn(e){return e^Qi(e,13)^Qi(e,23)}function nn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[4*t],n[1]=255&e[4*t+1],n[2]=255&e[4*t+2],n[3]=255&e[4*t+3],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];for(let e,t=0;t<32;t+=4)e=i[1]^i[2]^i[3]^r[t+0],i[0]^=tn(en(e)),e=i[2]^i[3]^i[0]^r[t+1],i[1]^=tn(en(e)),e=i[3]^i[0]^i[1]^r[t+2],i[2]^=tn(en(e)),e=i[0]^i[1]^i[2]^r[t+3],i[3]^=tn(en(e));for(let e=0;e<16;e+=4)t[e]=i[3-e/4]>>>24&255,t[e+1]=i[3-e/4]>>>16&255,t[e+2]=i[3-e/4]>>>8&255,t[e+3]=255&i[3-e/4]}function sn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[0+4*t],n[1]=255&e[1+4*t],n[2]=255&e[2+4*t],n[3]=255&e[3+4*t],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let e,r=0;r<32;r+=4)e=i[1]^i[2]^i[3]^Yi[r+0],t[r+0]=i[0]^=rn(en(e)),e=i[2]^i[3]^i[0]^Yi[r+1],t[r+1]=i[1]^=rn(en(e)),e=i[3]^i[0]^i[1]^Yi[r+2],t[r+2]=i[2]^=rn(en(e)),e=i[0]^i[1]^i[2]^Yi[r+3],t[r+3]=i[3]^=rn(en(e));if(0===r)for(let e,r=0;r<16;r++)e=t[r],t[r]=t[31-r],t[31-r]=e}function on(e,t,r){let{padding:i="pkcs#7",mode:n,iv:s=[],output:o="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===n&&("string"==typeof s&&(s=Ki(s)),16!==s.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=Ki(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==r?Zi(e):Ki(e):[...e],("pkcs#5"===i||"pkcs#7"===i)&&0!==r){const t=ji-e.length%ji;for(let r=0;r=ji;){const t=e.slice(u,u+16),i=new Array(16);if("cbc"===n)for(let e=0;e2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let s=new Uint8Array(e.slice(0,5)),o=5;for(;on){const t=new Uint8Array(s.length+e.length-o);t.set(s,0),t.set(e.slice(o),s.length),s=t;break}let l=e[o+4],c=!1,u=2;if(r?(i&&(u=3),l=l>>>1&63,c=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(l)):(l&=31,c=1===l||5===l),c){const r=on(e.slice(o+4+u,o+4+d),t,0,{padding:"none",output:"array"});let i=r[r.length-1];if(i>0&&i<16){let e=!0;for(let t=1;t<=i;t++)if(r[r.length-t]!==i){e=!1;break}e&&r.splice(r.length-i,i)}const n=new Uint8Array(u);n.set(e.slice(o+4,o+4+u),0);const a=rr(Vi(n,new Uint8Array(r))),l=new Uint8Array(s.length+a.length);l.set(s,0),l.set(a,s.length),s=l}else{const t=e.slice(o+4,o+4+d),r=new Uint8Array(s.length+4+t.length);r.set(s,0),r.set(a,s.length),r.set(t,s.length+4),s=r}o=o+4+d}return s}const ln={init:0,findFirstStartCode:1,findSecondStartCode:2};class cn extends class{on(e,t,r){const i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:r}),this}once(e,t,r){const i=this;function n(){i.off(e,n);for(var s=arguments.length,o=new Array(s),a=0;a1?r-1:0),n=1;n{delete r[e]})),void delete this.e;const i=r[e],n=[];if(i&&t)for(let e=0,r=i.length;e=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=ln.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==ln.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=ln.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==ln.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=ln.findFirstStartCode}}}}function un(e,t,r){for(let i=2;i3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let s=5;for(;sn)break;let a=e[s+4],d=!1;if(i?(a=a>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(a)):(a&=31,d=1===a||5===a),d){const i=un(e.slice(s+4,s+4+o),t,r);e.set(i,s+4)}s=s+4+o}return e}function pn(){for(var e=arguments.length,t=new Array(e),r=0;re+t.byteLength),0));let n=0;return t.forEach((e=>{i.set(e,n),n+=e.byteLength})),i}class mn{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,r,i)));e.addEventListener(t,r,i);const n=()=>{cr(e.removeEventListener)&&e.removeEventListener(t,r,i)};return this.destroys.push(n),n}destroy(){this.master.debugLog("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class _n{static init(){_n.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in _n.types)_n.types.hasOwnProperty(e)&&(_n.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=_n.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,r=null,i=Array.prototype.slice.call(arguments,1),n=i.length;for(let e=0;e>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r.set(e,4);let s=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return _n.box(_n.types.trak,_n.tkhd(e),_n.mdia(e))}static tkhd(e){let t=e.id,r=e.duration,i=e.presentWidth,n=e.presentHeight;return _n.box(_n.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>>8&255,255&i,0,0,n>>>8&255,255&n,0,0]))}static mdia(e){return _n.box(_n.types.mdia,_n.mdhd(e),_n.hdlr(e),_n.minf(e))}static mdhd(e){let t=e.timescale,r=e.duration;return _n.box(_n.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?_n.constants.HDLR_AUDIO:_n.constants.HDLR_VIDEO,_n.box(_n.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?_n.box(_n.types.smhd,_n.constants.SMHD):_n.box(_n.types.vmhd,_n.constants.VMHD),_n.box(_n.types.minf,t,_n.dinf(),_n.stbl(e))}static dinf(){return _n.box(_n.types.dinf,_n.box(_n.types.dref,_n.constants.DREF))}static stbl(e){return _n.box(_n.types.stbl,_n.stsd(e),_n.box(_n.types.stts,_n.constants.STTS),_n.box(_n.types.stsc,_n.constants.STSC),_n.box(_n.types.stsz,_n.constants.STSZ),_n.box(_n.types.stco,_n.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?_n.box(_n.types.stsd,_n.constants.STSD_PREFIX,_n.mp3(e)):_n.box(_n.types.stsd,_n.constants.STSD_PREFIX,_n.mp4a(e)):"avc"===e.videoType?_n.box(_n.types.stsd,_n.constants.STSD_PREFIX,_n.avc1(e)):_n.box(_n.types.stsd,_n.constants.STSD_PREFIX,_n.hvc1(e))}static mp3(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return _n.box(_n.types[".mp3"],i)}static mp4a(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return _n.box(_n.types.mp4a,i,_n.esds(e))}static esds(e){let t=e.config||[],r=t.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(t).concat([6,1,2]));return _n.box(_n.types.esds,i)}static avc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return _n.box(_n.types.avc1,n,_n.box(_n.types.avcC,t))}static hvc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return _n.box(_n.types.hvc1,n,_n.box(_n.types.hvcC,t))}static mvex(e){return _n.box(_n.types.mvex,_n.trex(e))}static trex(e){let t=e.id,r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return _n.box(_n.types.trex,r)}static moof(e,t){return _n.box(_n.types.moof,_n.mfhd(e.sequenceNumber),_n.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return _n.box(_n.types.mfhd,t)}static traf(e,t){let r=e.id,i=_n.box(_n.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),n=_n.box(_n.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),s=_n.sdtp(e),o=_n.trun(e,s.byteLength+16+16+8+16+8+8);return _n.box(_n.types.traf,i,n,o,s)}static sdtp(e){let t=new Uint8Array(5),r=e.flags;return t[4]=r.isLeading<<6|r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy,_n.box(_n.types.sdtp,t)}static trun(e,t){let r=new Uint8Array(28);t+=36,r.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let i=e.duration,n=e.size,s=e.flags,o=e.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.isNonSync,0,0,o>>>24&255,o>>>16&255,o>>>8&255,255&o],12),_n.box(_n.types.trun,r)}static mdat(e){return _n.box(_n.types.mdat,e)}}_n.init();var gn,yn=Gt((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}));(gn=yn)&&gn.__esModule&&Object.prototype.hasOwnProperty.call(gn,"default")&&gn.default;const vn=[44100,48e3,32e3,0],bn=[22050,24e3,16e3,0],wn=[11025,12e3,8e3,0],Sn=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],En=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],An=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];function xn(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),r=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let i=t[1]>>>3&3,n=(6&t[1])>>1,s=(240&t[2])>>>4,o=(12&t[2])>>>2,a=3!==(t[3]>>>6&3)?2:1,d=0,l=0;switch(i){case 0:d=wn[o];break;case 2:d=bn[o];break;case 3:d=vn[o]}switch(n){case 1:s=e[n]&&t=6?(i=5,t=new Array(4),o=n-3):(i=2,t=new Array(2),o=n):-1!==a.indexOf("android")?(i=2,t=new Array(2),o=n):(i=5,o=n,t=new Array(4),n>=6?o=n-3:1===s&&(i=2,t=new Array(2),o=n)),t[0]=i<<3,t[0]|=(15&n)>>>1,t[1]=(15&n)<<7,t[1]|=(15&s)<<3,5===i&&(t[1]|=(15&o)>>>1,t[2]=(1&o)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=$n[n],this.sampling_index=n,this.channel_count=s,this.object_type=i,this.original_object_type=r,this.codec_mimetype="mp4a.40."+i,this.original_codec_mimetype="mp4a.40."+r}}class Hn{constructor(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}get bitsAvailable(){return this.bitLength-this.index}skipBits(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}getBits(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>i,s=8-i;if(s>=e)return r&&(this.index+=e),n>>s-e;{r&&(this.index+=s);const i=e-s;return n<>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}function Wn(e){return e[3]|e[2]<<8|e[1]<<16|e[0]<<24}const Vn=new Array(214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72),jn=new Array(2746333894,1453994832,1736282519,2993693404),qn=new Array(462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257);function Yn(e,t,r,i,n){var s=n;s=t+n>e.length&&i+n<=r.length?e.length-t:i+n>r.length&&t+n<=e.length?r.length-i:t+n<=e.length&&i+n<=r.length?n:r.length>24&255,e>>16&255,e>>8&255,255&e)}function Xn(e,t){return t+3>>19)^(i<<23|i>>>9)}function Qn(e,t){var r=new Array(36);r[0]=Xn(t,0),r[1]=Xn(t,4),r[2]=Xn(t,8),r[3]=Xn(t,12);for(var i=0;i<32;i++)r[i+4]=r[i]^es(r[i+1]^r[i+2]^r[i+3]^e[i]);var n=new Array(4);for(i=35;i>=32;i--)n[35-i]=r[i];var s=function(e){for(var t=new Array(4*e.length),r=0;r>>30)^(i<<10|i>>>22)^(i<<18|i>>>14)^(i<<24|i>>>8)}function ts(e,t,r){if(null==e||null==e||e.length%16!=0)return console.log("sm4 key is error!"),null;if(null==r||null==r||r.length<=0)return console.log("cipher is error!"),null;if(null==t||null==t||t.length%16!=0)return console.log("iv is error!"),null;for(var i=Zn(e),n=Math.ceil(r.length/16),s=new Array(r.length),o=t.slice(),a=0;a3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t=new Uint8Array(t),r=new Uint8Array(r);const s=e.byteLength;let o=5;for(;os)break;let d=e[o+4],l=!1,c=2;if(i?(n&&(c=3),d=d>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(d)):(d&=31,l=1===d||5===d),l){const i=ts(t,r,e.slice(o+4+c,o+4+a));e.set(i,o+4+c)}o=o+4+a}return e}Date.now||(Date.now=function(){return(new Date).getTime()});const is=[];is.push(o({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support")&&-1===e.indexOf("illegal icc")&&!e.indexOf("If you want to help, upload a sample of this file to")&&!e.indexOf("Reserved SBR extensions is not implemented"))})(e)||console.warn("JbPro[❌❌❌][worker]:",e)}}),s({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support, using thread emulation"))})(e)||console.warn("JbPro[❌❌❌][worker]:",e)}})),Promise.all(is).then((e=>{const t=e[0];!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[],n=[],s=null,o=null,a=null,d=null,l=null,c=null,u=!1,h=null,f=null,S=!1,E=!1,B=!!yr(r),Se=0,Ee=0,je=!1,Je=null,Qe=null,tt=null,it=[],ut=null,At=null,xt=0,kt=0,$t=null,Ot=null,Gt=0,Ht=0,Wt=!1,Vt=!1,Xt=!1,er=null,or=null,Sr=!1,Er=!0,Ar=()=>{const e=_r();return{debug:e.debug,debugLevel:e.debugLevel,debugUuid:e.debugUuid,useOffscreen:e.useOffscreen,useWCS:e.useWCS,useMSE:e.useMSE,videoBuffer:e.videoBuffer,videoBufferDelay:e.videoBufferDelay,openWebglAlignment:e.openWebglAlignment,playType:e.playType,hasAudio:e.hasAudio,hasVideo:e.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:e.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:e.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:0,networkDelay:e.networkDelay,visibility:!0,useSIMD:e.useSIMD,isRecording:!1,recordType:e.recordType,isNakedFlow:e.isNakedFlow,checkFirstIFrame:e.checkFirstIFrame,audioBufferSize:1024,isM7sCrypto:e.isM7sCrypto,m7sCryptoAudio:e.m7sCryptoAudio,cryptoKey:e.cryptoKey,cryptoIV:e.cryptoIV,isSm4Crypto:e.isSm4Crypto,isSm4CryptoH265V2:e.isSm4CryptoH265V2,sm4CryptoKey:e.sm4CryptoKey,isXorCrypto:e.isXorCrypto,isHls265:!1,isFlv:e.isFlv,isFmp4:e.isFmp4,isMpeg4:e.isMpeg4,isTs:e.isTs,isFmp4Private:e.isFmp4Private,isEmitSEI:e.isEmitSEI,isRecordTypeFlv:!1,isWasmMp4:!1,isChrome:!1,isFirefox:!1,isDropSameTimestampGop:e.isDropSameTimestampGop,mseDecodeAudio:e.mseDecodeAudio,wcsDecodeAudio:e.wcsDecodeAudio,nakedFlowH265DemuxUseNew:e.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:e.mseDecoderUseWorker,mseAutoCleanupSourceBuffer:e.mseAutoCleanupSourceBuffer,mseAutoCleanupMaxBackwardDuration:e.mseAutoCleanupMaxBackwardDuration,mseAutoCleanupMinBackwardDuration:e.mseAutoCleanupMinBackwardDuration,mseCorrectTimeDuration:e.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:e.mseCorrectAudioTimeDuration,nakedFlowDemuxUseNew:e.nakedFlowDemuxUseNew,nakedFlowFps:e.nakedFlowFps,supportMSEDecodeHevc:!1}};"VideoEncoder"in self&&(s={hasInit:!1,isEmitInfo:!1,offscreenCanvas:null,offscreenCanvasCtx:null,decoder:null,init(){s.decoder=new VideoDecoder({output:function(e){if(cr(e.createImageBitmap))e.createImageBitmap().then((t=>{s.offscreenCanvasCtx.drawImage(t,0,0,e.codedWidth,e.codedHeight);let r=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:r,delay:si.delay,ts:0},[r]),fr(e)}));else{s.offscreenCanvasCtx.drawImage(e,0,0,e.codedWidth,e.codedHeight);let t=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:t,delay:si.delay,ts:0},[t]),fr(e)}},error:function(e){si.debugError("worker","VideoDecoder error: ",e,e.toString())}})},destroy(){s.reset(),s.decoder&&"closed"!==s.decoder.state&&(s.decoder.close(),s.decoder=null)},decode:function(e,t,r){const i=e[0]>>4==1;if(s.hasInit){const r=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:i?pt:mt});s.decoder.decode(r)}else if(i&&0===e[1]){const t=15&e[0];postMessage({cmd:M,code:t});const r=new Uint8Array(e);postMessage({cmd:R,buffer:r,codecId:t},[r.buffer]);let i=null,n=null;const o=e.slice(5);t===Ie?(n=Cr(o),i={codec:n.codec,description:o}):t===Me&&(n=jr(o),i={codec:n.codec,description:o}),n&&n.codecWidth&&n.codecHeight&&(i.codedHeight=n.codecHeight,i.codedWidth=n.codecWidth),s.isEmitInfo||(si.debugLog("worker","Webcodecs Video Decoder initSize"),postMessage({cmd:T,w:n.codecWidth,h:n.codecHeight}),s.isEmitInfo=!0,s.offscreenCanvas=new OffscreenCanvas(n.codecWidth,n.codecHeight),s.offscreenCanvasCtx=s.offscreenCanvas.getContext("2d"));try{s.decoder.configure(i),s.hasInit=!0}catch(e){si.debugError("worker","VideoDecoder configure error",e.code,e,e.toString()),e.toString()}}else si.debugWarn("worker",`VideoDecoder configure has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)},reset(){s.hasInit=!1,s.isEmitInfo=!1,s.offscreenCanvas=null,s.offscreenCanvasCtx=null}});let xr=function(){if(Sr=!0,o)try{o.abort(),o=null,si.debugLog("worker","abort success")}catch(e){o=null,si.debugLog("worker","abort catch",e)}},Tr={init(){Tr.lastBuf=null,Tr.vps=null,Tr.sps=null,Tr.pps=null,Tr.streamType=null,Tr.localDts=0,Tr.pendingUnits={},Tr.isSendSeqHeader=!1},destroy(){Tr.lastBuf=null,Tr.vps=null,Tr.sps=null,Tr.pps=null,Tr.streamType=null,Tr.localDts=0,Tr.pendingUnits={},Tr.isSendSeqHeader=!1},dispatch(e){const t=new Uint8Array(e);if(si._opt.nakedFlowDemuxUseNew){const e=Tr.extractNALu$3(t);if(0===e.length)return void si.debugLog("worker","dispatch naluArray length is 0");Tr.handleVideoFrames(e)}else Tr.extractNALu$2(t)},getNaluDts(){const e=si._opt.nakedFlowFps;let t=Tr.localDts;return Tr.localDts=Tr.localDts+parseInt(1e3/e,10),t},getNaluAudioDts(){const e=si._opt.sampleRate,t=si._opt.audioBufferSize;return Tr.localDts+parseInt(t/e*1e3)},extractNALu(e){let t,r,i=0,n=e.byteLength,s=0,o=[];for(;i1)for(let e=0;e{const t=Ir(e);t===Ve||t===We?Tr.handleVideoH264Nalu(e):Rr(t)&&i.push(e)})),1===i.length)Tr.handleVideoH264Nalu(i[0]);else if(Nr(i)){const e=Ir(i[0]),t=zr(e);Tr.handleVideoH264NaluList(i,t,e)}else i.forEach((e=>{Tr.handleVideoH264Nalu(e)}))}else if(Tr.streamType===Ne)if(si._opt.nakedFlowH265DemuxUseNew){const t=Tr.handleAddNaluStartCode(e),r=Tr.extractNALu(t);if(0===r.length)return void si.debugWarn("worker","handleVideoNalu","h265 naluList.length === 0");const i=[];if(r.forEach((e=>{const t=Zr(e);t===lt||t===at||t===st?Tr.handleVideoH265Nalu(e):Qr(t)&&i.push(e)})),1===i.length)Tr.handleVideoH265Nalu(i[0]);else if(ti(i)){const e=Zr(i[0]),t=ei(e);Tr.handleVideoH265NaluList(i,t,e)}else i.forEach((e=>{Tr.handleVideoH265Nalu(e)}))}else Zr(e)===lt?Tr.extractH265PPS(e):Tr.handleVideoH265Nalu(e)},extractH264PPS(e){const t=Tr.handleAddNaluStartCode(e);Tr.extractNALu(t).forEach((e=>{Mr(Ir(e))?Tr.extractH264SEI(e):Tr.handleVideoH264Nalu(e)}))},extractH265PPS(e){const t=Tr.handleAddNaluStartCode(e);Tr.extractNALu(t).forEach((e=>{Jr(Zr(e))?Tr.extractH265SEI(e):Tr.handleVideoH265Nalu(e)}))},extractH264SEI(e){const t=Tr.handleAddNaluStartCode(e);Tr.extractNALu(t).forEach((e=>{Tr.handleVideoH264Nalu(e)}))},extractH265SEI(e){const t=Tr.handleAddNaluStartCode(e);Tr.extractNALu(t).forEach((e=>{Tr.handleVideoH265Nalu(e)}))},handleAddNaluStartCode(e){const t=[0,0,0,1],r=new Uint8Array(e.length+t.length);return r.set(t),r.set(e,t.length),r},handleVideoH264Nalu(e){const t=Ir(e);switch(t){case We:Tr.sps=e;break;case Ve:Tr.pps=e}if(Tr.isSendSeqHeader){if(Tr.sps&&Tr.pps){const e=Dr({sps:Tr.sps,pps:Tr.pps}),t=Tr.localDts;si.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Tr.sps=null,Tr.pps=null}if(Rr(t)){const r=zr(t),i=Tr.getNaluDts(),n=Fr(e,r);Tr.doDecode(n,{type:ae,ts:i,isIFrame:r,cts:0})}}else if(Tr.sps&&Tr.pps){Tr.isSendSeqHeader=!0;const e=Dr({sps:Tr.sps,pps:Tr.pps});si.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Tr.sps=null,Tr.pps=null}},handleVideoH264NaluList(e,t,r){if(Tr.isSendSeqHeader){const i=Tr.getNaluDts(),n=Lr(e.reduce(((e,t)=>{const r=rr(e),i=rr(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);Tr.doDecode(n,{type:ae,ts:i,isIFrame:t,cts:0}),si.debugLog("worker",`handleVideoH264NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},handleVideoH265Nalu(e){const t=Zr(e);switch(t){case st:Tr.vps=e;break;case at:Tr.sps=e;break;case lt:Tr.pps=e}if(Tr.isSendSeqHeader){if(Tr.vps&&Tr.sps&&Tr.pps){const e=Yr({vps:Tr.vps,sps:Tr.sps,pps:Tr.pps}),t=Tr.localDts;si.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Tr.vps=null,Tr.sps=null,Tr.pps=null}if(Qr(t)){const r=ei(t),i=Tr.getNaluDts(),n=Kr(e,r);Tr.doDecode(n,{type:ae,ts:i,isIFrame:r,cts:0})}}else if(Tr.vps&&Tr.sps&&Tr.pps){Tr.isSendSeqHeader=!0;const e=Yr({vps:Tr.vps,sps:Tr.sps,pps:Tr.pps});si.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Tr.vps=null,Tr.sps=null,Tr.pps=null}},handleVideoH265NaluList(e,t,r){if(Tr.isSendSeqHeader){const i=Tr.getNaluDts(),n=Xr(e.reduce(((e,t)=>{const r=rr(e),i=rr(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);Tr.doDecode(n,{type:ae,ts:i,isIFrame:t,cts:0}),si.debugLog("worker",`handleVideoH265NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},doDecode(e,t){si.calcNetworkDelay(t.ts),t.isIFrame&&si.calcIframeIntervalTimestamp(t.ts),si.decode(e,t)},handleVideoFrames(e){if(!Tr.streamVideoType)for(let t of e)if(Tr.streamVideoType=ur(t),Tr.streamVideoType)break;Tr.streamVideoType?Tr.streamVideoType===ze?Tr.handleVideoH264Frames(e):this.streamVideoType===Ne&&Tr.handleVideoH265Frames(e):si.debugWarn("worker","handleVideoFrames","streamVideoType is null")},handleVideoH264Frames(e){let t=[],r=[],i=!1,n=!1;Tr.pendingUnits.units&&(t=Tr.pendingUnits.units,n=Tr.pendingUnits.vcl,i=Tr.pendingUnits.iFrame,Tr.pendingUnits={});let s={};for(let o of e){if(o.byteLength<4)continue;const e=Ir(o);let a=!1,d=e===Ye;e!==qe&&e!==Ye||(s=Tr.parseVideo264Header(o),a=!0),t.length&&n&&(s.isfms||!a)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,n=!1),t.push(o),i=i||d,n=n||a}t.length&&(Tr.pendingUnits={units:t,vcl:n,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,n=null;if(t.forEach((e=>{const t=31&e[0];switch(t){case Ve:Tr.pps=e;break;case We:Tr.sps=e;break;case Ke:n=e}if(Rr(t)){const t=rr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Tr.isSendSeqHeader&&Tr.sps&&Tr.pps){Tr.isSendSeqHeader=!0;const e=Pr({sps:Tr.sps,pps:Tr.pps});si.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Tr.sps=null,Tr.pps=null}if(Tr.isSendSeqHeader){if(Tr.sps&&Tr.pps){const e=Pr({sps:Tr.sps,pps:Tr.pps}),t=Tr.localDts;si.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Tr.sps=null,Tr.pps=null}if(i){const e=Tr.getNaluDts(),t=Lr(i,r);si._opt.isEmitSEI&&n&&postMessage({cmd:Z,buffer:n,ts:e},[n.buffer]),Tr.doDecode(t,{type:ae,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames(e){let t=[],r=[],i=!1,n=!1;Tr.pendingUnits.units&&(t=Tr.pendingUnits.units,n=Tr.pendingUnits.vcl,i=Tr.pendingUnits.iFrame,Tr.pendingUnits={});let s={};for(let o of e){if(o.byteLength<4)continue;const e=Zr(o);let a=!1,d=ei(e);Qr(e)&&(s=this.parseVideo265Header(o),a=!0),t.length&&n&&(s.isfms||!a)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,n=!1),t.push(o),i=i||d,n=n||a}t.length&&(Tr.pendingUnits={units:t,vcl:n,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,n=null;if(t.forEach((e=>{const t=e[0]>>>1&63;switch(t){case lt:Tr.pps=e;break;case at:Tr.sps=e;break;case st:Tr.vps=e;break;case ft:case ht:n=e}if(Qr(t)){const t=rr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Tr.isSendSeqHeader&&Tr.sps&&Tr.pps&&Tr.vps){Tr.isSendSeqHeader=!0;const e=Yr({sps:Tr.sps,pps:Tr.pps,vps:Tr.vps});si.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Tr.sps=null,Tr.pps=null,Tr.vps=null}if(Tr.isSendSeqHeader){if(Tr.sps&&Tr.pps&&Tr.vps){const e=Yr({sps:Tr.sps,pps:Tr.pps,vps:Tr.vps}),t=Tr.localDts;si.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Tr.sps=null,Tr.pps=null,Tr.vps=null}if(i){const e=Tr.getNaluDts(),t=Xr(i,r);si._opt.isEmitSEI&&n&&postMessage({cmd:Z,buffer:n,ts:e},[n.buffer]),Tr.doDecode(t,{type:ae,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames_1(e){e.forEach((e=>{Tr.handleVideoNalu(e)}))},parseVideo264Header(e){const t=new Hn(e);return t.readUByte(),{isfms:0===t.readUEG(),sType:t.readUEG()}},parseVideo265Header(e){const t=new Hn(e);return t.readUByte(),{nalType:t.readBits(6),isfms:0===t.readBits(1),sType:t.readBits(3)}}},Gr={LOG_NAME:"worker fmp4Demuxer",mp4Box:null,offset:0,videoTrackId:null,audioTrackId:null,isHevc:!1,listenMp4Box(){Gr.mp4Box=Oi.createFile(),Gr.mp4Box.onReady=Gr.onReady,Gr.mp4Box.onError=Gr.onError,Gr.mp4Box.onSamples=Gr.onSamples},initTransportDescarmber(){Gr.transportDescarmber=new Wi},_getSeqHeader(e){const t=Gr.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new Oi.DataStream(void 0,0,Oi.DataStream.BIG_ENDIAN);let r=[];e.avcC?(e.avcC.write(t),r=[23,0,0,0,0]):(Gr.isHevc=!0,si.isHevc=!0,e.hvcC.write(t),r=[28,0,0,0,0]);const i=new Uint8Array(t.buffer,8),n=new Uint8Array(r.length+i.length);return n.set(r,0),n.set(i,r.length),n}return null},onReady(e){si.debugLog(Gr.LOG_NAME,"onReady()");const t=e.videoTracks[0],r=e.audioTracks[0];if(t){Gr.videoTrackId=t.id;const e=Gr._getSeqHeader(t);e&&(si.debugLog(Gr.LOG_NAME,"seqHeader"),si.decodeVideo(e,0,!0,0)),Gr.mp4Box.setExtractionOptions(t.id)}if(r&&si._opt.hasAudio){Gr.audioTrackId=r.id;const e=r.audio||{},t=jt.indexOf(e.sample_rate),i=r.codec.replace("mp4a.40.","");Gr.mp4Box.setExtractionOptions(r.id);const n=qt({profile:parseInt(i,10),sampleRate:t,channel:e.channel_count});si.debugLog(Gr.LOG_NAME,"aacADTSHeader"),si.decodeAudio(n,0)}Gr.mp4Box.start()},onError(e){si.debugError(Gr.LOG_NAME,"mp4Box onError",e)},onSamples(e,t,r){if(e===Gr.videoTrackId){for(const e of r){const t=e.data,r=e.is_sync,i=1e3*e.cts/e.timescale;e.duration,e.timescale,r&&si.calcIframeIntervalTimestamp(i);let n=null;n=Gr.isHevc?Xr(t,r):Lr(t,r),si.decode(n,{type:ae,ts:i,isIFrame:r,cts:0})}Gr.mp4Box.removeUsedSamples(e)}else if(e===Gr.audioTrackId){if(si._opt.hasAudio){for(const e of r){const t=e.data,r=1e3*e.cts/e.timescale;e.duration,e.timescale;const i=new Uint8Array(t.byteLength+2);i.set([175,1],0),i.set(t,2),si.decode(i,{type:oe,ts:r,isIFrame:!1,cts:0})}Gr.mp4Box.removeUsedSamples(e)}}else si.debugWarn(Gr.LOG_NAME,"onSamples() trackId error",e)},dispatch(e){let t=new Uint8Array(e);Gr.transportDescarmber&&(t=Gr.transportDescarmber.transport(t)),t.buffer.fileStart=Gr.offset,Gr.offset+=t.byteLength,Gr.mp4Box.appendBuffer(t.buffer)},destroy(){Gr.mp4Box&&(Gr.mp4Box.stop(),Gr.mp4Box.flush(),Gr.mp4Box.destroy(),Gr.mp4Box=null),Gr.transportDescarmber&&(Gr.transportDescarmber.destroy(),Gr.transportDescarmber=null),Gr.offset=0,Gr.videoTrackId=null,Gr.audioTrackId=null,Gr.isHevc=!1}},Hr={LOG_NAME:"worker mpeg4Demuxer",lastBuffer:new Uint8Array(0),parsedOffset:0,firstStartCodeOffset:0,secondStartCodeOffset:0,state:"init",hasInitVideoCodec:!1,localDts:0,dispatch(e){const t=new Uint8Array(e);Hr.extractNALu(t)},destroy(){Hr.lastBuffer=new Uint8Array(0),Hr.parsedOffset=0,Hr.firstStartCodeOffset=0,Hr.secondStartCodeOffset=0,Hr.state="init",Hr.hasInitVideoCodec=!1,Hr.localDts=0},extractNALu(e){if(!e||e.byteLength<1)return void si.debugWarn(Hr.LOG_NAME,"extractNALu() buffer error",e);const t=new Uint8Array(Hr.lastBuffer.length+e.length);for(t.set(Hr.lastBuffer,0),t.set(new Uint8Array(e),Hr.lastBuffer.length),Hr.lastBuffer=t;;){if("init"===Hr.state){let e=!1;for(;Hr.lastBuffer.length-Hr.parsedOffset>=4;)if(0===Hr.lastBuffer[Hr.parsedOffset])if(0===Hr.lastBuffer[Hr.parsedOffset+1])if(1===Hr.lastBuffer[Hr.parsedOffset+2]){if(182===Hr.lastBuffer[Hr.parsedOffset+3]){Hr.state="findFirstStartCode",Hr.firstStartCodeOffset=Hr.parsedOffset,Hr.parsedOffset+=4,e=!0;break}Hr.parsedOffset++}else Hr.parsedOffset++;else Hr.parsedOffset++;else Hr.parsedOffset++;if(e)continue;break}if("findFirstStartCode"===Hr.state){let e=!1;for(;Hr.lastBuffer.length-Hr.parsedOffset>=4;)if(0===Hr.lastBuffer[Hr.parsedOffset])if(0===Hr.lastBuffer[Hr.parsedOffset+1])if(1===Hr.lastBuffer[Hr.parsedOffset+2]){if(182===Hr.lastBuffer[Hr.parsedOffset+3]){Hr.state="findSecondStartCode",Hr.secondStartCodeOffset=Hr.parsedOffset,Hr.parsedOffset+=4,e=!0;break}Hr.parsedOffset++}else Hr.parsedOffset++;else Hr.parsedOffset++;else Hr.parsedOffset++;if(e)continue;break}if("findSecondStartCode"===Hr.state){if(!(Hr.lastBuffer.length-Hr.parsedOffset>0))break;{let e,t,r=192&Hr.lastBuffer[Hr.parsedOffset];e=0==r?Hr.secondStartCodeOffset-14:Hr.secondStartCodeOffset;let i=0==(192&Hr.lastBuffer[Hr.firstStartCodeOffset+4]);if(i){if(Hr.firstStartCodeOffset-14<0)return void si.debugWarn(Hr.LOG_NAME,"firstStartCodeOffset -14 is",Hr.firstStartCodeOffset-14);Hr.hasInitVideoCodec||(Hr.hasInitVideoCodec=!0,si.debugLog(Hr.LOG_NAME,"setCodec"),ai.setCodec(Re,"")),t=Hr.lastBuffer.subarray(Hr.firstStartCodeOffset-14,e)}else t=Hr.lastBuffer.subarray(Hr.firstStartCodeOffset,e);let n=Hr.getNaluDts();Hr.hasInitVideoCodec?(postMessage({cmd:O,type:Be,value:t.byteLength}),postMessage({cmd:O,type:ke,value:n}),Se=n,ai.decode(t,i?1:0,n)):si.debugWarn(Hr.LOG_NAME,"has not init video codec"),Hr.lastBuffer=Hr.lastBuffer.subarray(e),Hr.firstStartCodeOffset=0==r?14:0,Hr.parsedOffset=Hr.firstStartCodeOffset+4,Hr.state="findFirstStartCode"}}}},getNaluDts(){let e=Hr.localDts;return Hr.localDts=Hr.localDts+40,e}},qr={TAG_NAME:"worker TsLoaderV2",first_parse_:!0,tsPacketSize:0,syncOffset:0,pmt_:null,config_:null,media_info_:new On,timescale_:90,duration_:0,pat_:{version_number:0,network_pid:0,program_map_pid:{}},current_program_:null,current_pmt_pid_:-1,program_pmt_map_:{},pes_slice_queues_:{},section_slice_queues_:{},video_metadata_:{vps:null,sps:null,pps:null,details:null},audio_metadata_:{codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},last_pcr_:null,audio_last_sample_pts_:void 0,aac_last_incomplete_data_:null,has_video_:!1,has_audio_:!1,video_init_segment_dispatched_:!1,audio_init_segment_dispatched_:!1,video_metadata_changed_:!1,audio_metadata_changed_:!1,loas_previous_frame:null,video_track_:{type:"video",id:1,sequenceNumber:0,samples:[],length:0},audio_track_:{type:"audio",id:2,sequenceNumber:0,samples:[],length:0},_remainingPacketData:null,init(){},destroy(){qr.media_info_=null,qr.pes_slice_queues_=null,qr.section_slice_queues_=null,qr.video_metadata_=null,qr.audio_metadata_=null,qr.aac_last_incomplete_data_=null,qr.video_track_=null,qr.audio_track_=null,qr._remainingPacketData=null},probe(e){let t=new Uint8Array(e),r=-1,i=188;if(t.byteLength<=3*i)return{needMoreData:!0};for(;-1===r;){let e=Math.min(1e3,t.byteLength-3*i);for(let n=0;n=4&&(r-=4),{match:!0,consumed:0,ts_packet_size:i,sync_offset:r})},_initPmt:()=>({program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}),dispatch(e){qr._remainingPacketData&&(e=pn(qr._remainingPacketData,e),qr._remainingPacketData=null);let t=e.buffer;const r=qr.parseChunks(t);r?qr._remainingPacketData=e.subarray(r):e.length>>6;r[1];let s=(31&r[1])<<8|r[2],o=(48&r[3])>>>4,a=15&r[3],d=!(!qr.pmt_||qr.pmt_.pcr_pid!==s),l={},c=4;if(2==o||3==o){let e=r[4];if(e>0&&(d||3==o)&&(l.discontinuity_indicator=(128&r[5])>>>7,l.random_access_indicator=(64&r[5])>>>6,l.elementary_stream_priority_indicator=(32&r[5])>>>5,(16&r[5])>>>4)){let e=300*(r[6]<<25|r[7]<<17|r[8]<<9|r[9]<<1|r[10]>>>7)+((1&r[10])<<8|r[11]);qr.last_pcr_=e}if(2==o||5+e===188){t+=188,204===qr.tsPacketSize&&(t+=16);continue}c=5+e}if(1==o||3==o)if(0===s||s===qr.current_pmt_pid_||null!=qr.pmt_&&qr.pmt_.pid_stream_type[s]===Ln){let r=188-c;qr.handleSectionSlice(e,t+c,r,{pid:s,payload_unit_start_indicator:n,continuity_conunter:a,random_access_indicator:l.random_access_indicator})}else if(null!=qr.pmt_&&null!=qr.pmt_.pid_stream_type[s]){let r=188-c,i=qr.pmt_.pid_stream_type[s];s!==qr.pmt_.common_pids.h264&&s!==qr.pmt_.common_pids.h265&&s!==qr.pmt_.common_pids.adts_aac&&s!==qr.pmt_.common_pids.loas_aac&&s!==qr.pmt_.common_pids.ac3&&s!==qr.pmt_.common_pids.eac3&&s!==qr.pmt_.common_pids.opus&&s!==qr.pmt_.common_pids.mp3&&!0!==qr.pmt_.pes_private_data_pids[s]&&!0!==qr.pmt_.timed_id3_pids[s]&&!0!==qr.pmt_.synchronous_klv_pids[s]&&!0!==qr.pmt_.asynchronous_klv_pids[s]||qr.handlePESSlice(e,t+c,r,{pid:s,stream_type:i,payload_unit_start_indicator:n,continuity_conunter:a,random_access_indicator:l.random_access_indicator})}t+=188,204===qr.tsPacketSize&&(t+=16)}return qr.dispatchAudioVideoMediaSegment(),t},handleSectionSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=qr.section_slice_queues_[i.pid];if(i.payload_unit_start_indicator){let o=n[0];if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t+1,Math.min(r,o));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?qr.emitSectionSlices(s,i):qr.clearSlices(s,i)}for(let a=1+o;a=s.expected_length&&qr.clearSlices(s,i),a+=d.byteLength}}else if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t,Math.min(r,s.expected_length-s.total_length));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?qr.emitSectionSlices(s,i):s.total_length>=s.expected_length&&qr.clearSlices(s,i)}},handlePESSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=n[0]<<16|n[1]<<8|n[2];n[3];let o=n[4]<<8|n[5];if(i.payload_unit_start_indicator){if(1!==s)return void si.debugWarn(qr.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${s}`);let e=qr.pes_slice_queues_[i.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?qr.emitPESSlices(e,i):qr.clearSlices(e,i)),qr.pes_slice_queues_[i.pid]=new Rn,qr.pes_slice_queues_[i.pid].random_access_indicator=i.random_access_indicator}if(null==qr.pes_slice_queues_[i.pid])return;let a=qr.pes_slice_queues_[i.pid];a.slices.push(n),i.payload_unit_start_indicator&&(a.expected_length=0===o?0:o+6),a.total_length+=n.byteLength,a.expected_length>0&&a.expected_length===a.total_length?qr.emitPESSlices(a,i):a.expected_length>0&&a.expected_length>>6,a=t[8];2!==o&&3!==o||(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,s=3===o?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:r);let d,l=9+a;if(0!==n){if(n<3+a)return void si.debugWarn(qr.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");d=n-3-a}else d=t.byteLength-l;let c=t.subarray(l,l+d);switch(e.stream_type){case Un:case Bn:qr.parseMP3Payload(c,r);break;case kn:qr.pmt_.common_pids.opus===e.pid||qr.pmt_.common_pids.ac3===e.pid||qr.pmt_.common_pids.eac3===e.pid||(qr.pmt_.asynchronous_klv_pids[e.pid]?qr.parseAsynchronousKLVMetadataPayload(c,e.pid,i):qr.pmt_.smpte2038_pids[e.pid]?qr.parseSMPTE2038MetadataPayload(c,r,s,e.pid,i):qr.parsePESPrivateDataPayload(c,r,s,e.pid,i));break;case Tn:qr.parseADTSAACPayload(c,r);break;case Cn:qr.parseLOASAACPayload(c,r);break;case Dn:case Pn:break;case Fn:qr.pmt_.timed_id3_pids[e.pid]?qr.parseTimedID3MetadataPayload(c,r,s,e.pid,i):qr.pmt_.synchronous_klv_pids[e.pid]&&qr.parseSynchronousKLVMetadataPayload(c,r,s,e.pid,i);break;case In:qr.parseH264Payload(c,r,s,e.random_access_indicator);break;case Mn:qr.parseH265Payload(c,r,s,e.random_access_indicator)}}else if((188===i||191===i||240===i||241===i||255===i||242===i||248===i)&&e.stream_type===kn){let r,s=6;r=0!==n?n:t.byteLength-s;let o=t.subarray(s,s+r);qr.parsePESPrivateDataPayload(o,void 0,void 0,e.pid,i)}}else si.debugError(qr.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${r}`)},parsePAT(e){let t=e[0];if(0!==t)return void Log.e(qr.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let r=(15&e[1])<<8|e[2];e[3],e[4];let i=(62&e[5])>>>1,n=1&e[5],s=e[6];e[7];let o=null;if(1===n&&0===s)o={version_number:0,network_pid:0,program_pmt_pid:{}},o.version_number=i;else if(o=qr.pat_,null==o)return;let a=r-5-4,d=-1,l=-1;for(let t=8;t<8+a;t+=4){let r=e[t]<<8|e[t+1],i=(31&e[t+2])<<8|e[t+3];0===r?o.network_pid=i:(o.program_pmt_pid[r]=i,-1===d&&(d=r),-1===l&&(l=i))}1===n&&0===s&&(null==qr.pat_&&si.debugLog(qr.TAG_NAME,`Parsed first PAT: ${JSON.stringify(o)}`),qr.pat_=o,qr.current_program_=d,qr.current_pmt_pid_=l)},parsePMT(e){let t=e[0];if(2!==t)return void si.debugError(qr.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let r,i=(15&e[1])<<8|e[2],n=e[3]<<8|e[4],s=(62&e[5])>>>1,o=1&e[5],a=e[6];if(e[7],1===o&&0===a)r=qr._initPmt(),r.program_number=n,r.version_number=s,qr.program_pmt_map_[n]=r;else if(r=qr.program_pmt_map_[n],null==r)return;r.pcr_pid=(31&e[8])<<8|e[9];let d=(15&e[10])<<8|e[11],l=12+d,c=i-9-d-4;for(let t=l;t0){for(let i=t+5;i0)for(let i=t+5;iqr.has_video_&&qr.has_audio_?qr.video_init_segment_dispatched_&&qr.audio_init_segment_dispatched_:qr.has_video_&&!qr.has_audio_?qr.video_init_segment_dispatched_:!(qr.has_video_||!qr.has_audio_)&&qr.audio_init_segment_dispatched_,dispatchVideoInitSegment(){let e=qr.video_metadata_.details,t={type:"video"};t.id=qr.video_track_.id,t.timescale=1e3,t.duration=qr.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;let r=t.frameRate.fps_den,i=t.frameRate.fps_num;if(t.refSampleDuration=r/i*1e3,t.codec=e.codec_mimetype,qr.video_metadata_.vps){si.isHevc=!0;let e=qr.video_metadata_.vps.data.subarray(4),r=qr.video_metadata_.sps.data.subarray(4),i=qr.video_metadata_.pps.data.subarray(4);t.hvcc=Yr({vps:e,sps:r,pps:i}),0==qr.video_init_segment_dispatched_&&si.debugLog(qr.TAG_NAME,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.hvcc&&si.decodeVideo(t.hvcc,0,!0,0)}else{let e=qr.video_metadata_.sps.data.subarray(4),r=qr.video_metadata_.pps.data.subarray(4);t.avcc=Pr({sps:e,pps:r}),0==qr.video_init_segment_dispatched_&&si.debugLog(qr.TAG_NAME,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.avcc&&si.decodeVideo(t.avcc,0,!0,0)}qr.video_init_segment_dispatched_=!0,qr.video_metadata_changed_=!1;let n=qr.media_info_;n.hasVideo=!0,n.width=t.codecWidth,n.height=t.codecHeight,n.fps=t.frameRate.fps,n.profile=t.profile,n.level=t.level,n.refFrames=e.ref_frames,n.chromaFormat=e.chroma_format_string,n.sarNum=t.sarRatio.width,n.sarDen=t.sarRatio.height,n.videoCodec=t.codec,n.hasAudio&&n.audioCodec?n.mimeType=`video/mp2t; codecs="${n.videoCodec},${n.audioCodec}"`:n.mimeType=`video/mp2t; codecs="${n.videoCodec}"`},dispatchVideoMediaSegment(){qr.isInitSegmentDispatched()&&qr.video_track_.length&&qr._preDoDecode()},dispatchAudioMediaSegment(){qr.isInitSegmentDispatched()&&qr.audio_track_.length&&qr._preDoDecode()},dispatchAudioVideoMediaSegment(){qr.isInitSegmentDispatched()&&(qr.audio_track_.length||qr.video_track_.length)&&qr._preDoDecode()},parseADTSAACPayload(e,t){if(qr.has_video_&&!qr.video_init_segment_dispatched_)return;if(qr.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+qr.aac_last_incomplete_data_.byteLength);t.set(qr.aac_last_incomplete_data_,0),t.set(e,qr.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/qr.timescale_),"aac"===qr.audio_metadata_.codec){if(null==t&&null!=qr.audio_last_sample_pts_)r=1024/qr.audio_metadata_.sampling_frequency*1e3,i=qr.audio_last_sample_pts_+r;else if(null==t)return void si.debugWarn(qr.TAG_NAME,"AAC: Unknown pts");if(qr.aac_last_incomplete_data_&&qr.audio_last_sample_pts_){r=1024/qr.audio_metadata_.sampling_frequency*1e3;let e=qr.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(si.debugWarn(qr.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Jt(e),o=null,a=i;for(;null!=(o=s.readNextAACFrame());){r=1024/o.sampling_frequency*1e3;const e={codec:"aac",data:o};0==qr.audio_init_segment_dispatched_?(qr.audio_metadata_={codec:"aac",audio_object_type:o.audio_object_type,sampling_freq_index:o.sampling_freq_index,sampling_frequency:o.sampling_frequency,channel_config:o.channel_config},qr.dispatchAudioInitSegment(e)):qr.detectAudioMetadataChange(e)&&(qr.dispatchAudioMediaSegment(),qr.dispatchAudioInitSegment(e)),n=a;let t=Math.floor(a);const i=new Uint8Array(o.data.length+2);i.set([175,1],0),i.set(o.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:oe};qr.audio_track_.samples.push(s),qr.audio_track_.length+=i.byteLength,a+=r}s.hasIncompleteData()&&(qr.aac_last_incomplete_data_=s.getIncompleteData()),n&&(qr.audio_last_sample_pts_=n)},parseLOASAACPayload(e,t){if(qr.has_video_&&!qr.video_init_segment_dispatched_)return;if(qr.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+qr.aac_last_incomplete_data_.byteLength);t.set(qr.aac_last_incomplete_data_,0),t.set(e,qr.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/qr.timescale_),"aac"===qr.audio_metadata_.codec){if(null==t&&null!=qr.audio_last_sample_pts_)r=1024/qr.audio_metadata_.sampling_frequency*1e3,i=qr.audio_last_sample_pts_+r;else if(null==t)return void si.debugWarn(qr.TAG_NAME,"AAC: Unknown pts");if(qr.aac_last_incomplete_data_&&qr.audio_last_sample_pts_){r=1024/qr.audio_metadata_.sampling_frequency*1e3;let e=qr.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(si.debugWarn(qr.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Qt(e),o=null,a=i;for(;null!=(o=s.readNextAACFrame(dr(this.loas_previous_frame)?void 0:this.loas_previous_frame));){qr.loas_previous_frame=o,r=1024/o.sampling_frequency*1e3;const e={codec:"aac",data:o};0==qr.audio_init_segment_dispatched_?(qr.audio_metadata_={codec:"aac",audio_object_type:o.audio_object_type,sampling_freq_index:o.sampling_freq_index,sampling_frequency:o.sampling_frequency,channel_config:o.channel_config},qr.dispatchAudioInitSegment(e)):qr.detectAudioMetadataChange(e)&&(qr.dispatchAudioMediaSegment(),qr.dispatchAudioInitSegment(e)),n=a;let t=Math.floor(a);const i=new Uint8Array(o.data.length+2);i.set([175,1],0),i.set(o.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:oe};qr.audio_track_.samples.push(s),qr.audio_track_.length+=i.byteLength,a+=r}s.hasIncompleteData()&&(qr.aac_last_incomplete_data_=s.getIncompleteData()),n&&(qr.audio_last_sample_pts_=n)},parseAC3Payload(e,t){},parseEAC3Payload(e,t){},parseOpusPayload(e,t){},parseMP3Payload(e,t){if(qr.has_video_&&!qr.video_init_segment_dispatched_)return;let r=[44100,48e3,32e3,0],i=[22050,24e3,16e3,0],n=[11025,12e3,8e3,0],s=e[1]>>>3&3,o=(6&e[1])>>1;e[2];let a=(12&e[2])>>>2,d=3!=(e[3]>>>6&3)?2:1,l=0,c=34;switch(s){case 0:l=n[a];break;case 2:l=i[a];break;case 3:l=r[a]}switch(o){case 1:c=34;break;case 2:c=33;break;case 3:c=32}const u={};u.object_type=c,u.sample_rate=l,u.channel_count=d,u.data=e;const h={codec:"mp3",data:u};0==qr.audio_init_segment_dispatched_?(qr.audio_metadata_={codec:"mp3",object_type:c,sample_rate:l,channel_count:d},qr.dispatchAudioInitSegment(h)):qr.detectAudioMetadataChange(h)&&(qr.dispatchAudioMediaSegment(),qr.dispatchAudioInitSegment(h));let f={payload:e,length:e.byteLength,pts:t/qr.timescale_,dts:t/qr.timescale_,type:oe};qr.audio_track_.samples.push(f),qr.audio_track_.length+=e.byteLength},detectAudioMetadataChange(e){if(e.codec!==qr.audio_metadata_.codec)return si.debugLog(qr.TAG_NAME,`Audio: Audio Codecs changed from ${qr.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===qr.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==qr.audio_metadata_.audio_object_type)return si.debugLog(qr.TAG_NAME,`AAC: AudioObjectType changed from ${qr.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==qr.audio_metadata_.sampling_freq_index)return si.debugLog(qr.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${qr.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==qr.audio_metadata_.channel_config)return si.debugLog(qr.TAG_NAME,`AAC: Channel configuration changed from ${qr.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===qr.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==qr.audio_metadata_.sampling_frequency)return si.debugLog(qr.TAG_NAME,`AC3: Sampling Frequency changed from ${qr.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==qr.audio_metadata_.bit_stream_identification)return si.debugLog(qr.TAG_NAME,`AC3: Bit Stream Identification changed from ${qr.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==qr.audio_metadata_.bit_stream_mode)return si.debugLog(qr.TAG_NAME,`AC3: BitStream Mode changed from ${qr.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==qr.audio_metadata_.channel_mode)return si.debugLog(qr.TAG_NAME,`AC3: Channel Mode changed from ${qr.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==qr.audio_metadata_.low_frequency_effects_channel_on)return si.debugLog(qr.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${qr.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===qr.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==qr.audio_metadata_.sample_rate)return si.debugLog(qr.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${qr.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==qr.audio_metadata_.channel_count)return si.debugLog(qr.TAG_NAME,`Opus: Channel count changed from ${qr.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===qr.audio_metadata_.codec){const t=e.data;if(t.object_type!==qr.audio_metadata_.object_type)return si.debugLog(qr.TAG_NAME,`MP3: AudioObjectType changed from ${qr.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==qr.audio_metadata_.sample_rate)return si.debugLog(qr.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${qr.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==qr.audio_metadata_.channel_count)return si.debugLog(qr.TAG_NAME,`MP3: Channel count changed from ${qr.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1},dispatchAudioInitSegment(e){let t={type:"audio"};if(t.id=qr.audio_track_.id,t.timescale=1e3,t.duration=qr.duration_,"aac"===qr.audio_metadata_.codec){let r="aac"===e.codec?e.data:null,i=new Gn(r);t.audioSampleRate=i.sampling_rate,t.audioSampleRateIndex=i.sampling_index,t.channelCount=i.channel_count,t.codec=i.codec_mimetype,t.originalCodec=i.original_codec_mimetype,t.config=i.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale;const n=qt({profile:si._opt.mseDecodeAudio?i.object_type:i.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});si.decodeAudio(n,0)}else"ac-3"===qr.audio_metadata_.codec||"ec-3"===qr.audio_metadata_.codec||"opus"===qr.audio_metadata_.codec||"mp3"===qr.audio_metadata_.codec&&(t.audioSampleRate=qr.audio_metadata_.sample_rate,t.channelCount=qr.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==qr.audio_init_segment_dispatched_&&si.debugLog(qr.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),qr.audio_init_segment_dispatched_=!0,qr.video_metadata_changed_=!1;let r=qr.media_info_;r.hasAudio=!0,r.audioCodec=t.originalCodec,r.audioSampleRate=t.audioSampleRate,r.audioChannelCount=t.channelCount,r.hasVideo&&r.videoCodec?r.mimeType=`video/mp2t; codecs="${r.videoCodec},${r.audioCodec}"`:r.mimeType=`video/mp2t; codecs="${r.audioCodec}"`},dispatchPESPrivateDataDescriptor(e,t,r){},parsePESPrivateDataPayload(e,t,r,i,n){let s=new Nn;if(s.pid=i,s.stream_id=n,s.len=e.byteLength,s.data=e,null!=t){let e=Math.floor(t/qr.timescale_);s.pts=e}else s.nearest_pts=qr.getNearestTimestampMilliseconds();if(null!=r){let e=Math.floor(r/qr.timescale_);s.dts=e}},parseTimedID3MetadataPayload(e,t,r,i,n){si.debugLog(qr.TAG_NAME,`Timed ID3 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseSynchronousKLVMetadataPayload(e,t,r,i,n){si.debugLog(qr.TAG_NAME,`Synchronous KLV Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseAsynchronousKLVMetadataPayload(e,t,r){si.debugLog(qr.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${r}`)},parseSMPTE2038MetadataPayload(e,t,r,i,n){si.debugLog(qr.TAG_NAME,`SMPTE 2038 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},getNearestTimestampMilliseconds:()=>null!=qr.audio_last_sample_pts_?Math.floor(qr.audio_last_sample_pts_):null!=qr.last_pcr_?Math.floor(qr.last_pcr_/300/qr.timescale_):void 0,_preDoDecode(){const e=qr.video_track_,t=qr.audio_track_;let r=e.samples;t.samples.length>0&&(r=e.samples.concat(t.samples),r=r.sort(((e,t)=>e.dts-t.dts))),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===ae?qr._doDecodeVideo({...e,payload:t}):e.type===oe&&qr._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0},_doDecodeVideo(e){const t=new Uint8Array(e.payload);let r=null;r=e.isHevc?Xr(t,e.isIFrame):Lr(t,e.isIFrame),e.isIFrame&&si.calcIframeIntervalTimestamp(e.dts);let i=si.cryptoPayload(r,e.isIFrame);si.decode(i,{type:ae,ts:e.dts,isIFrame:e.isIFrame,cts:e.cts})},_doDecodeAudio(e){const t=new Uint8Array(e.payload);let r=t;yr(si._opt.m7sCryptoAudio)&&(r=si.cryptoPayloadAudio(t)),si.decode(r,{type:oe,ts:e.dts,isIFrame:!1,cts:0})}},ni=null;br()&&(ni={TAG_NAME:"worker MediaSource",_resetInIt(){ni.isAvc=null,ni.isAAC=null,ni.videoInfo={},ni.videoMeta={},ni.audioMeta={},ni.sourceBuffer=null,ni.audioSourceBuffer=null,ni.hasInit=!1,ni.hasAudioInit=!1,ni.isAudioInitInfo=!1,ni.videoMimeType="",ni.audioMimeType="",ni.cacheTrack={},ni.cacheAudioTrack={},ni.timeInit=!1,ni.sequenceNumber=0,ni.audioSequenceNumber=0,ni.firstRenderTime=null,ni.firstAudioTime=null,ni.mediaSourceAppendBufferFull=!1,ni.mediaSourceAppendBufferError=!1,ni.mediaSourceAddSourceBufferError=!1,ni.mediaSourceBufferError=!1,ni.mediaSourceError=!1,ni.prevTimestamp=null,ni.decodeDiffTimestamp=null,ni.prevDts=null,ni.prevAudioDts=null,ni.prevPayloadBufferSize=0,ni.isWidthOrHeightChanged=!1,ni.prevTs=null,ni.prevAudioTs=null,ni.eventListenList=[],ni.pendingRemoveRanges=[],ni.pendingSegments=[],ni.pendingAudioRemoveRanges=[],ni.pendingAudioSegments=[],ni.supportVideoFrameCallbackHandle=null,ni.audioSourceBufferCheckTimeout=null,ni.audioSourceNoDataCheckTimeout=null,ni.hasPendingEos=!1,ni.$video={currentTime:0,readyState:0}},init(){ni.events=new mn,ni._resetInIt(),ni.mediaSource=new self.MediaSource,ni.isDecodeFirstIIframe=!!vr(si._opt.checkFirstIFrame),ni._bindMediaSourceEvents()},destroy(){ni.stop(),ni._clearAudioSourceBufferCheckTimeout(),ni.eventListenList&&ni.eventListenList.length&&(ni.eventListenList.forEach((e=>e())),ni.eventListenList=[]),ni._resetInIt(),ni.mediaSource=null},getState:()=>ni.mediaSource&&ni.mediaSource.readyState,isStateOpen:()=>ni.getState()===vt,isStateClosed:()=>ni.getState()===bt,isStateEnded:()=>ni.getState()===yt,_bindMediaSourceEvents(){const{proxy:e}=ni.events,t=e(ni.mediaSource,St,(()=>{si.debugLog(ni.TAG_NAME,"sourceOpen"),ni._onMediaSourceSourceOpen()})),r=e(ni.mediaSource,wt,(()=>{si.debugLog(ni.TAG_NAME,"sourceClose")})),i=e(ni.mediaSource,Et,(()=>{si.debugLog(ni.TAG_NAME,"sourceended")}));ni.eventListenList.push(t,r,i)},_onMediaSourceSourceOpen(){ni.sourceBuffer||(si.debugLog(ni.TAG_NAME,"onMediaSourceSourceOpen() sourceBuffer is null and next init"),ni._initSourceBuffer()),ni.audioSourceBuffer||(si.debugLog(ni.TAG_NAME,"onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),ni._initAudioSourceBuffer()),ni._hasPendingSegments()&&ni._doAppendSegments()},decodeVideo(e,t,r,i){if(si.isDestroyed)si.debugWarn(ni.TAG_NAME,"decodeVideo() and decoder is destroyed");else if(vr(ni.hasInit))if(r&&e[1]===Bt){const i=15&e[0];if(i===Me&&vr(si._opt.supportMSEDecodeHevc))return void ni.emitError(Fe.mediaSourceH265NotSupport);ni.videoInfo.codec=i,postMessage({cmd:M,code:i});const n=new Uint8Array(e);postMessage({cmd:R,buffer:n,codecId:i},[n.buffer]),ni.hasInit=ni._decodeConfigurationRecord(e,t,r,i)}else si.debugWarn(ni.TAG_NAME,`decodeVideo has not init , isIframe is ${r} , payload is ${e[1]} so drop this frame`);else if(!ni.isDecodeFirstIIframe&&r&&(ni.isDecodeFirstIIframe=!0),ni.isDecodeFirstIIframe){if(r&&0===e[1]){const t=15&e[0];let r={};t===Ie?r=Cr(e.slice(5)):t===Me&&(r=Vr(e));const i=ni.videoInfo;i&&i.codecWidth&&i.codecWidth&&r&&r.codecWidth&&r.codecHeight&&(r.codecWidth!==i.codecWidth||r.codecHeight!==i.codecWidth)&&(si.debugWarn(ni.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${i.codecWidth}, old height is ${i.codecHeight},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),ni.isWidthOrHeightChanged=!0,ni.emitError(Fe.mseWidthOrHeightChange,`width: ${i.codecWidth}->${r.codecWidth}, height: ${i.codecWidth}->${r.codecHeight}`))}if(ni.isWidthOrHeightChanged)return void si.debugWarn(ni.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(gr(e))return void si.debugLog(ni.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLengthni.prevTs>0&&eA,_decodeConfigurationRecord(e,t,r,i){let n=e.slice(5),s={};if(i===Ie?s=Cr(n):i===Me&&(s=jr(n)),ni.videoInfo.width=s.codecWidth,ni.videoInfo.height=s.codecHeight,0===s.codecWidth&&0===s.codecHeight)return si.debugWarn(ni.TAG_NAME,"_decodeConfigurationRecord error",JSON.stringify(s)),ni.emitError(Fe.mediaSourceDecoderConfigurationError,`width is ${0===s.codecWidth} and height is ${s.codecHeight}`),!1;const o={id:Ft,type:"video",timescale:1e3,duration:0,avcc:n,codecWidth:s.codecWidth,codecHeight:s.codecHeight,videoType:s.videoType},a=_n.generateInitSegment(o);ni.isAvc=i===Ie;let d=s.codec;return ni.videoMimeType=d?`video/mp4; codecs="${s.codec}"`:ni.isAvc?_t:gt,postMessage({cmd:T,w:s.codecWidth,h:s.codecHeight}),ni._initSourceBuffer(),ni.appendBuffer(a.buffer),ni.sequenceNumber=0,ni.cacheTrack={},ni.timeInit=!1,!0},_decodeAudioConfigurationRecord(e,t){const r=e[0]>>4,i=e[0]>>1&1,n=r===He,s=r===$e;if(vr(s||n))return si.debugWarn(ni.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${r} ant auto wasm decode`),ni.emitError(Fe.mediaSourceAudioG711NotSupport),!1;const o={id:Lt,type:"audio",timescale:1e3};let a={};if(Yt(e)){if(a=Zt(e.slice(2)),!a)return!1;o.audioSampleRate=a.sampleRate,o.channelCount=a.channelCount,o.config=a.config,o.refSampleDuration=1024/o.audioSampleRate*o.timescale}else{if(!n)return!1;if(a=xn(e),!a)return!1;o.audioSampleRate=a.samplingRate,o.channelCount=a.channelCount,o.refSampleDuration=1152/o.audioSampleRate*o.timescale}o.codec=a.codec,o.duration=0;let d="mp4",l=a.codec,c=null;n&&vr(si._opt.isFirefox)?(d="mpeg",l="",c=new Uint8Array):c=_n.generateInitSegment(o);let u=`${o.type}/${d}`;return l&&l.length>0&&(u+=`;codecs=${l}`),vr(ni.isAudioInitInfo)&&(or=r===$e?i?16:8:0===i?8:16,postMessage({cmd:F,code:r}),postMessage({cmd:P,sampleRate:o.audioSampleRate,channels:o.channelCount,depth:or}),ni.isAudioInitInfo=!0),ni.audioMimeType=u,ni.isAAC=s,ni._initAudioSourceBuffer(),ni.appendAudioBuffer(c.buffer),!0},_initSourceBuffer(){const{proxy:e}=ni.events;if(null===ni.sourceBuffer&&null!==ni.mediaSource&&ni.isStateOpen()&&ni.videoMimeType){try{si.debugLog(ni.TAG_NAME,"_initSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",ni.videoMimeType),ni.sourceBuffer=ni.mediaSource.addSourceBuffer(ni.videoMimeType)}catch(e){return si.debugError(ni.TAG_NAME,"_initSourceBuffer() appendBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),ni.emitError(Fe.mseWorkerAddSourceBufferError,e.code),void(ni.mediaSourceAddSourceBufferError=!0)}if(ni.sourceBuffer){const t=e(ni.sourceBuffer,"error",(e=>{ni.mediaSourceBufferError=!0,si.debugError(ni.TAG_NAME,"mseSourceBufferError mseDecoder.sourceBuffer",e,e.toString()),ni.emitError(Fe.mseSourceBufferError,e.code)})),r=e(ni.sourceBuffer,"updateend",(()=>{ni._hasPendingRemoveRanges()?ni._doRemoveRanges():ni._hasPendingSegments()?ni._doAppendSegments():ni.hasPendingEos&&(si.debugLog(ni.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),ni.endOfStream())}));ni.eventListenList.push(t,r)}}else si.debugLog(ni.TAG_NAME,`_initSourceBuffer and mseDecoder.isStateOpen is ${ni.isStateOpen()} and mseDecoder.isAvc === null is ${null===ni.isAvc}`)},_initAudioSourceBuffer(){const{proxy:e}=ni.events;if(null===ni.audioSourceBuffer&&null!==ni.mediaSource&&ni.isStateOpen()&&ni.audioMimeType){try{si.debugLog(ni.TAG_NAME,"_initAudioSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",ni.audioMimeType),ni._clearAudioSourceBufferCheckTimeout(),ni.audioSourceBuffer=ni.mediaSource.addSourceBuffer(ni.audioMimeType)}catch(e){return si.debugError(ni.TAG_NAME,"_initAudioSourceBuffer() addSourceBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),ni.emitError(Fe.mseWorkerAddSourceBufferError,e.code),void(ni.mediaSourceAddSourceBufferError=!0)}if(ni.audioSourceBuffer){const t=e(ni.audioSourceBuffer,"error",(e=>{ni.mediaSourceBufferError=!0,si.debugError(ni.TAG_NAME,"mseSourceBufferError mseDecoder.audioSourceBuffer",e.code,e.toString(),e),ni.emitError(Fe.mseSourceBufferError,e.code)})),r=e(ni.audioSourceBuffer,"updateend",(()=>{ni._hasPendingRemoveRanges()?ni._doRemoveRanges():ni._hasPendingSegments()?ni._doAppendSegments():ni.hasPendingEos&&(si.debugLog(ni.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),ni.endOfStream())}));ni.eventListenList.push(t,r),null===ni.audioSourceNoDataCheckTimeout&&(ni.audioSourceNoDataCheckTimeout=setTimeout((()=>{ni._clearAudioNoDataCheckTimeout(),ni.emitError(Fe.mediaSourceAudioNoDataTimeout)}),1e3))}}else si.debugLog(ni.TAG_NAME,`_initAudioSourceBuffer and mseDecoder.isStateOpen is ${ni.isStateOpen()} and mseDecoder.audioMimeType is ${ni.audioMimeType}`)},_decodeVideo(e,t,r,i,n){let s=e.slice(5),o=s.byteLength;if(0===o)return void si.debugWarn(ni.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let a=(new Date).getTime(),d=!1;ni.prevTimestamp||(ni.prevTimestamp=a,d=!0);const l=a-ni.prevTimestamp;if(ni.decodeDiffTimestamp=l,l>1e3&&!d&&si.isPlayer&&si.debugLog(ni.TAG_NAME,`_decodeVideo now time is ${a} and prev time is ${ni.prevTimestamp}, diff time is ${l} ms`),ni.cacheTrack.id&&t>=ni.cacheTrack.dts){let e=8+ni.cacheTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(_n.types.mdat,4),r.set(ni.cacheTrack.data,8),ni.cacheTrack.duration=t-ni.cacheTrack.dts;let i=_n.moof(ni.cacheTrack,ni.cacheTrack.dts);ni.cacheTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),ni.appendBuffer(n.buffer)}else si.debugLog(ni.TAG_NAME,`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${n} cacheTrack dts is ${ni.cacheTrack&&ni.cacheTrack.dts}`),ni.timeInit=!1,ni.cacheTrack={};ni.cacheTrack||(ni.cacheTrack={}),ni.cacheTrack.id=Ft,ni.cacheTrack.sequenceNumber=++ni.sequenceNumber,ni.cacheTrack.size=o,ni.cacheTrack.dts=t,ni.cacheTrack.cts=i,ni.cacheTrack.isKeyframe=r,ni.cacheTrack.data=s,ni.cacheTrack.flags={isLeading:0,dependsOn:r?2:1,isDependedOn:r?1:0,hasRedundancy:0,isNonSync:r?0:1},ni.prevTimestamp=(new Date).getTime()},_decodeAudio(e,t,r){let i=ni.isAAC?e.slice(2):e.slice(1),n=i.byteLength;if(ni.cacheAudioTrack.id&&t>=ni.cacheAudioTrack.dts){let e=8+ni.cacheAudioTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(_n.types.mdat,4),r.set(ni.cacheAudioTrack.data,8),ni.cacheAudioTrack.duration=t-ni.cacheAudioTrack.dts;let i=_n.moof(ni.cacheAudioTrack,ni.cacheAudioTrack.dts);ni.cacheAudioTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),ni.appendAudioBuffer(n.buffer)}else ni.cacheAudioTrack={};ni.cacheAudioTrack||(ni.cacheAudioTrack={}),ni.cacheAudioTrack.id=Lt,ni.cacheAudioTrack.sequenceNumber=++ni.audioSequenceNumber,ni.cacheAudioTrack.size=n,ni.cacheAudioTrack.dts=t,ni.cacheAudioTrack.cts=0,ni.cacheAudioTrack.data=i,ni.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}},appendBuffer(e){si.isDestroyed?si.debugWarn(ni.TAG_NAME,"appendBuffer() player is destroyed"):ni.mediaSourceAddSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):ni.mediaSourceAppendBufferFull?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):ni.mediaSourceAppendBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):ni.mediaSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(ni.pendingSegments.push(e),ni.sourceBuffer&&(si._opt.mseAutoCleanupSourceBuffer&&ni._needCleanupSourceBuffer()&&ni._doCleanUpSourceBuffer(),vr(ni.getSourceBufferUpdating())&&ni.isStateOpen()&&vr(ni._hasPendingRemoveRanges()))?ni._doAppendSegments():ni.isStateClosed()?(ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):ni.isStateEnded()&&(ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,"mediaSource is end")))},appendAudioBuffer(e){si.isDestroyed?si.debugWarn(ni.TAG_NAME,"appendAudioBuffer() player is destroyed"):ni.mediaSourceAddSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):ni.mediaSourceAppendBufferFull?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):ni.mediaSourceAppendBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):ni.mediaSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(ni.pendingAudioSegments.push(e),ni.audioSourceBuffer&&(si._opt.mseAutoCleanupSourceBuffer&&ni._needCleanupSourceBuffer()&&ni._doCleanUpSourceBuffer(),vr(ni.getAudioSourceBufferUpdating())&&ni.isStateOpen()&&vr(ni._hasPendingRemoveRanges()))?ni._doAppendSegments():ni.isStateClosed()?(ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):ni.isStateEnded()&&(ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,"mediaSource is end")))},getSourceBufferUpdating:()=>ni.sourceBuffer&&ni.sourceBuffer.updating,getAudioSourceBufferUpdating:()=>ni.audioSourceBuffer&&ni.audioSourceBuffer.updating,stop(){ni.abortSourceBuffer(),ni.removeSourceBuffer(),ni.endOfStream()},clearUpAllSourceBuffer(){if(ni.sourceBuffer){const e=ni.sourceBuffer.buffered;for(let t=0;tni.pendingSegments.length>0||ni.pendingAudioSegments.length>0,getPendingSegmentsLength:()=>ni.pendingSegments.length,_handleUpdatePlaybackRate(){},_doAppendSegments(){if(ni.isStateClosed()||ni.isStateEnded())si.debugLog(ni.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==ni.sourceBuffer){if(ni.needInitAudio()&&null===ni.audioSourceBuffer)return si.debugLog(ni.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===ni.audioSourceBufferCheckTimeout&&(ni.audioSourceBufferCheckTimeout=setTimeout((()=>{ni._clearAudioSourceBufferCheckTimeout(),ni.emitError(Fe.mediaSourceAudioInitTimeout)}),1e3)));if(vr(ni.getSourceBufferUpdating())&&ni.pendingSegments.length>0){const e=ni.pendingSegments.shift();try{ni.sourceBuffer.appendBuffer(e)}catch(e){si.debugError(ni.TAG_NAME,"mseDecoder.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(ni.stop(),ni.mediaSourceAppendBufferFull=!0,ni.emitError(Fe.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(ni.stop(),ni.mediaSourceAppendBufferError=!0,ni.emitError(Fe.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(ni.stop(),ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,`code is ${e.code} , message is ${e.message}`))}}if(vr(ni.getAudioSourceBufferUpdating())&&ni.pendingAudioSegments.length>0){const e=ni.pendingAudioSegments.shift();try{ni.audioSourceBuffer.appendBuffer(e)}catch(e){si.debugError(ni.TAG_NAME,"mseDecoder.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(ni.stop(),ni.mediaSourceAppendBufferFull=!0,ni.emitError(Fe.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(ni.stop(),ni.mediaSourceAppendBufferError=!0,ni.emitError(Fe.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(ni.stop(),ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,e.code,`code is ${e.code} , message is ${e.message}`))}}}else si.debugLog(ni.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")},_doCleanUpSourceBuffer(){const e=ni.$video.currentTime;if(ni.sourceBuffer){const t=ni.sourceBuffer.buffered;let r=!1;for(let i=0;i=si._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-si._opt.mseAutoCleanupMinBackwardDuration;ni.pendingRemoveRanges.push({start:n,end:t})}}else s=si._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-si._opt.mseAutoCleanupMinBackwardDuration;ni.pendingAudioRemoveRanges.push({start:n,end:t})}}else sni.pendingRemoveRanges.length>0||ni.pendingAudioRemoveRanges.length>0,needInitAudio:()=>si._opt.hasAudio&&si._opt.mseDecodeAudio,_doRemoveRanges(){if(ni.sourceBuffer&&vr(ni.getSourceBufferUpdating())){let e=ni.pendingRemoveRanges;for(;e.length&&vr(ni.getSourceBufferUpdating());){let t=e.shift();try{ni.sourceBuffer.remove(t.start,t.end)}catch(e){si.debugWarn(ni.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e,e.toString())}}}if(ni.audioSourceBuffer&&vr(ni.getAudioSourceBufferUpdating())){let e=ni.pendingAudioRemoveRanges;for(;e.length&&vr(ni.getAudioSourceBufferUpdating());){let t=e.shift();try{ni.audioSourceBuffer.remove(t.start,t.end)}catch(e){si.debugWarn(ni.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e,e.toString())}}}},_getPlaybackRate(){},_needCleanupSourceBuffer(){if(vr(si._opt.mseAutoCleanupSourceBuffer))return!1;const e=ni.$video.currentTime;if(ni.sourceBuffer){let t=ni.sourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=si._opt.mseAutoCleanupMaxBackwardDuration)return!0}if(ni.audioSourceBuffer){let t=ni.audioSourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=si._opt.mseAutoCleanupMaxBackwardDuration)return!0}return!1},_clearAudioSourceBufferCheckTimeout(){ni.audioSourceBufferCheckTimeout&&(clearTimeout(ni.audioSourceBufferCheckTimeout),ni.audioSourceBufferCheckTimeout=null)},_clearAudioNoDataCheckTimeout(){ni.audioSourceNoDataCheckTimeout&&(clearTimeout(ni.audioSourceNoDataCheckTimeout),ni.audioSourceNoDataCheckTimeout=null)},getHandle:()=>ni.mediaSource.handle,emitError(e){postMessage({cmd:se,value:e,msg:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""})}});let si={isPlayer:!0,isHevc:null,isPlayback:!1,dropping:!1,isPushDropping:!1,isWorkerFetch:!1,isDestroyed:!1,fetchStatus:Ct,_opt:Ar(),mp3Demuxer:null,delay:-1,pushLatestDelay:-1,firstTimestamp:null,startTimestamp:null,preDelayTimestamp:null,stopId:null,streamFps:null,streamAudioFps:null,streamVideoFps:null,writableStream:null,networkDelay:0,webglObj:null,startStreamRateAndStatsInterval:function(){si.stopStreamRateAndStatsInterval(),l=setInterval((()=>{d&&d(0);const e=JSON.stringify({demuxBufferDelay:si.getVideoBufferLength(),audioDemuxBufferDelay:si.getAudioBufferLength(),streamBufferByteLength:si.getStreamBufferLength(),netBuf:si.networkDelay||0,pushLatestDelay:si.pushLatestDelay||0,latestDelay:si.delay,isStreamTsMoreThanLocal:je,wasmDecodeDelay:Se-Ee});postMessage({cmd:O,type:Ce,value:e})}),1e3)},stopStreamRateAndStatsInterval:function(){l&&(clearInterval(l),l=null)},useOffscreen:function(){return si._opt.useOffscreen&&"undefined"!=typeof OffscreenCanvas},getDelay:function(e,t){if(!e||si._opt.hasVideo&&!B)return-1;if(t===oe)return si.delay;if(si.preDelayTimestamp&&si.preDelayTimestamp>e)return si.preDelayTimestamp-e>1e3&&si.debugWarn("worker",`getDelay() and preDelayTimestamp is ${si.preDelayTimestamp} > timestamp is ${e} more than ${si.preDelayTimestamp-e}ms and return ${si.delay}`),si.preDelayTimestamp=e,si.delay;if(si.firstTimestamp){if(e){const t=Date.now()-si.startTimestamp,r=e-si.firstTimestamp;t>=r?(je=!1,si.delay=t-r):(je=!0,si.delay=r-t)}}else si.firstTimestamp=e,si.startTimestamp=Date.now(),si.delay=-1;return si.preDelayTimestamp=e,si.delay},getDelayNotUpdateDelay:function(e,t){if(!e||si._opt.hasVideo&&!B)return-1;if(t===oe)return si.pushLatestDelay;if(si.preDelayTimestamp&&si.preDelayTimestamp-e>1e3)return si.debugWarn("worker",`getDelayNotUpdateDelay() and preDelayTimestamp is ${si.preDelayTimestamp} > timestamp is ${e} more than ${si.preDelayTimestamp-e}ms and return -1`),-1;if(si.firstTimestamp){let t=-1;if(e){const r=Date.now()-si.startTimestamp,i=e-si.firstTimestamp;r>=i?(je=!1,t=r-i):(je=!0,t=i-r)}return t}return-1},resetDelay:function(){si.firstTimestamp=null,si.startTimestamp=null,si.delay=-1,si.dropping=!1},resetAllDelay:function(){si.resetDelay(),si.preDelayTimestamp=null},doDecode:function(e){si._opt.isEmitSEI&&e.type===ae&&si.isWorkerFetch&&si.findSei(e.payload,e.ts),si.isPlayUseMSEAndDecoderInWorker()?e.type===oe?si._opt.mseDecodeAudio?ni.decodeAudio(e.payload,e.ts):e.decoder.decode(e.payload,e.ts):e.type===ae&&ni.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):si._opt.useWCS&&si.useOffscreen()&&e.type===ae&&s.decode?s.decode(e.payload,e.ts,e.cts):e.decoder.decode(e.payload,e.ts,e.isIFrame,e.cts)},decodeNext(e){if(0===i.length)return;const t=e.ts,n=i[0],s=e.type===ae&&gr(e.payload);if(vr(r))s&&(si.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n isVideoSqeHeader is ${s}`),i.shift(),si.doDecode(n));else{const r=n.ts-t,o=n.type===oe&&e.type===ae;(r<=20||o||s)&&(si.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n diff is ${r} and isVideoAndNextAudio is ${o} and isVideoSqeHeader is ${s}`),i.shift(),si.doDecode(n))}},init:function(){si.debugLog("worker","init and opt is",JSON.stringify(si._opt));const e=si._opt.playType===v,t=si._opt.playType===b;if(Tr.init(),si.isPlayer=e,si.isPlayback=t,si.isPlayUseMSEAndDecoderInWorker()&&ni&&ni.init(),s&&si._opt.useWCS&&si.useOffscreen()&&s.init(),vr(si.isPlaybackCacheBeforeDecodeForFpsRender())){si.debugLog("worker","setInterval()");const t=()=>{const t=si._opt.videoBuffer+si._opt.videoBufferDelay;let r=null;if(i.length){if(si.isPushDropping)return void si.debugWarn("worker",`loop() isPushDropping is true and bufferList length is ${i.length}`);if(si.dropping){for(r=i.shift(),si.debugWarn("worker",`loop() dropBuffer is dropping and isIFrame ${r.isIFrame} and delay is ${si.delay} and bufferlist is ${i.length}`);!r.isIFrame&&i.length;)r=i.shift();const e=si.getDelayNotUpdateDelay(r.ts,r.type);r.isIFrame&&e<=si.getNotDroppingDelayTs()&&(si.debugLog("worker","loop() is dropping = false, is iFrame"),si.dropping=!1,si.doDecode(r),si.decodeNext(r))}else if(si.isPlayback||si.isPlayUseMSE()||0===si._opt.videoBuffer)for(;i.length;)r=i.shift(),si.doDecode(r);else if(r=i[0],-1===si.getDelay(r.ts,r.type))si.debugLog("worker","loop() common dumex delay is -1 ,data.ts is",r.ts),i.shift(),si.doDecode(r),si.decodeNext(r);else if(si.delay>t&&e)si.hasIframeInBufferList()?(si.debugLog("worker",`delay is ${si.delay} > maxDelay ${t}, set dropping is true`),si.resetAllDelay(),si.dropping=!0,postMessage({cmd:H})):(i.shift(),si.doDecode(r),si.decodeNext(r));else for(;i.length;){if(r=i[0],!(si.getDelay(r.ts,r.type)>si._opt.videoBuffer)){si.delay<0&&si.debugWarn("worker",`loop() do not decode and delay is ${si.delay}, bufferList is ${i.length}`);break}i.shift(),si.doDecode(r)}}else-1!==si.delay&&si.debugLog("worker","loop() bufferList is empty and reset delay"),si.resetAllDelay()};si.stopId=setInterval((()=>{let e=(new Date).getTime();Je||(Je=e);const r=e-Je;r>100&&si.debugWarn("worker",`loop demux diff time is ${r}`),t(),Je=(new Date).getTime()}),20)}else si.debugLog("worker","playback and playbackIsCacheBeforeDecodeForFpsRender is true");if(vr(si._opt.checkFirstIFrame)&&(B=!0),si.isPlayUseMSEAndDecoderInWorker()&&ni){const e=ni.getHandle();e&&postMessage({cmd:ie,mseHandle:e},[e])}},playbackCacheLoop:function(){si.clearPlaybackCacheLoop();const e=()=>{let e=null;i.length&&(e=i.shift(),si.doDecode(e))};e();const t=Math.ceil(1e3/(si.streamFps*si._opt.playbackRate));si.debugLog("worker",`playbackCacheLoop fragDuration is ${t}, streamFps is ${si.streamFps}, streamAudioFps is ${si.streamAudioFps} ,streamVideoFps is ${si.streamVideoFps} playbackRate is ${si._opt.playbackRate}`),si.stopId=setInterval(e,t)},clearPlaybackCacheLoop:function(){si.stopId&&(clearInterval(si.stopId),si.stopId=null)},startPlaybackCacheLoop:function(){si.playbackCacheLoop()},close:function(){if(si.debugLog("worker","close"),si.isDestroyed=!0,xr(),!a||1!==a.readyState&&2!==a.readyState?a&&si.debugLog("worker",`close() and socket.readyState is ${a.readyState}`):(Sr=!0,a.close(1e3,"Client disconnecting")),a=null,si.stopStreamRateAndStatsInterval(),si.stopId&&(clearInterval(si.stopId),si.stopId=null),si.mp3Demuxer&&(si.mp3Demuxer.destroy(),si.mp3Demuxer=null),si.writableStream&&vr(si.writableStream.locked)&&si.writableStream.close().catch((e=>{si.debugLog("worker","close() and writableStream.close() error",e.toString(),e)})),si.writableStream=null,oi)try{oi.clear&&oi.clear(),oi=null}catch(e){si.debugLog("worker","close() and audioDecoder.clear error",e.toString(),e)}if(ai)try{ai.clear&&ai.clear(),ai=null}catch(e){si.debugLog("worker","close() and videoDecoder.clear error",e.toString())}d=null,Je=null,je=!1,Se=0,Ee=0,s&&(s.destroy&&s.destroy(),s=null),ni&&(ni.destroy(),ni=null),si.firstTimestamp=null,si.startTimestamp=null,si.networkDelay=0,si.streamFps=null,si.streamAudioFps=null,si.streamVideoFps=null,si.delay=-1,si.pushLatestDelay=-1,si.preDelayTimestamp=null,si.dropping=!1,si.isPushDropping=!1,si.isPlayer=!0,si.isPlayback=!1,si.isWorkerFetch=!1,si.isHevc=null,si._opt=Ar(),si.webglObj&&(si.webglObj.destroy(),si.offscreenCanvas.removeEventListener("webglcontextlost",si.onOffscreenCanvasWebglContextLost),si.offscreenCanvas.removeEventListener("webglcontextrestored",si.onOffscreenCanvasWebglContextRestored),si.offscreenCanvas=null,si.offscreenCanvasGL=null,si.offscreenCanvasCtx=null),i=[],n=[],c&&(c.close(),c=null),h=null,f=null,S=!1,E=!1,B=!1,Wt=!1,Vt=!1,Xt=!1,er=null,it=[],xt=0,kt=0,Qe=null,tt=null,$t=null,Ot=null,or=null,Gt=0,Ht=0,ut=null,At=null,si.fetchStatus=Ct,Er=!0,Tr.destroy(),Gr.destroy(),Hr.destroy(),qr.destroy(),si.debug=null,si._opt={},postMessage({cmd:K})},pushBuffer:function(e,t){if(t.type===oe&&Yt(e)){if(si.debugLog("worker",`pushBuffer audio ts is ${t.ts}, isAacCodecPacket is true`),si._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:Q,buffer:t},[t.buffer])}si.decodeAudio(e,t.ts)}else if(t.type===ae&&t.isIFrame&&gr(e)){if(si.debugLog("worker",`pushBuffer video ts is ${t.ts}, isVideoSequenceHeader is true`),si._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:ee,buffer:t},[t.buffer])}si.decodeVideo(e,t.ts,t.isIFrame,t.cts)}else{if(si._opt.isRecording)if(si._opt.isRecordTypeFlv){const r=new Uint8Array(e);postMessage({cmd:te,type:t.type,buffer:r,ts:t.ts},[r.buffer])}else if(si._opt.recordType===w)if(t.type===ae){const r=new Uint8Array(e).slice(5);postMessage({cmd:z,buffer:r,isIFrame:t.isIFrame,ts:t.ts,cts:t.cts},[r.buffer])}else if(t.type===oe&&si._opt.isWasmMp4){const r=new Uint8Array(e),i=Kt(r)?r.slice(2):r.slice(1);postMessage({cmd:L,buffer:i,ts:t.ts},[i.buffer])}if(si.isPlayer){if(t.type===ae){if(Gt>0){const e=t.ts-Ot,r=Gt+Gt/2;e>r&&si.debugLog("worker",`pushBuffer video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts}, preTs is ${Ot},\n diff is ${e} and preTsDuration is ${Gt} and maxDiff is ${r}\n maybe trigger black screen or flower screen\n `)}if(null!==Ot&&Ot>=t.ts&&(si.debugWarn("worker",`pushBuffer() and isIFrame is ${t.isIFrame} and,\n options.ts is ${t.ts} less than (or equal) preTs is ${Ot} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${Ht}`),Ot-t.ts>A&&(si.debugWarn("worker",`pushBuffer,\n preTimestamp is ${Ot}, options.ts is ${t.ts},\n diff is ${Ot-t.ts} more than 3600000,\n and resetAllDelay`),si.resetAllDelay(),Ot=null,Gt=0),si._opt.isDropSameTimestampGop&&vr(t.isIFrame)&&B)){const e=si.hasIframeInBufferList(),t=vr(si.isPushDropping);return si.debugLog("worker",`pushBuffer, isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next dropBuffer`),void(e&&t?si.dropBuffer$2():(si.clearBuffer(!0),yr(si._opt.checkFirstIFrame)&&yr(r)&&(si.isPlayUseMSEAndDecoderInWorker()?ni.isDecodeFirstIIframe=!1:postMessage({cmd:re}))))}Ot>0&&(Gt=t.ts-Ot),Ht=e.byteLength,Ot=t.ts}if(B){const e=si._opt.videoBuffer+si._opt.videoBufferDelay,r=si.getDelayNotUpdateDelay(t.ts,t.type);si.pushLatestDelay=r,si.delay>0&&r>e&&si.delay({type:e.type,ts:e.ts})));si.debugLog("worker",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${i.length}, and ts list is ${JSON.stringify(r)}`)}const r=si.getAudioBufferLength()>0,n=r?60:40;i.length>=n&&(si.debugWarn("worker",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${i.length} more than ${n}, and hasAudio is ${r} an set streamFps is 25`),si.streamVideoFps=25,postMessage({cmd:V,value:si.streamVideoFps}),r?(si.streamAudioFps=25,si.streamFps=si.streamVideoFps+si.streamAudioFps):si.streamFps=si.streamVideoFps,si.playbackCacheLoop())}}},getVideoBufferLength(){let e=0;return i.forEach((t=>{t.type===ae&&(e+=1)})),e},hasIframeInBufferList:()=>i.some((e=>e.type===ae&&e.isIFrame)),isAllIframeInBufferList(){const e=si.getVideoBufferLength();let t=0;return i.forEach((e=>{e.type===ae&&e.isIFrame&&(t+=1)})),e===t},getNotDroppingDelayTs:()=>si._opt.videoBuffer+si._opt.videoBufferDelay/2,getAudioBufferLength(){let e=0;return i.forEach((t=>{t.type===oe&&(e+=1)})),e},getStreamBufferLength(){let e=0;return c&&c.buffer&&(e=c.buffer.byteLength),si._opt.isNakedFlow?Tr.lastBuf&&(e=Tr.lastBuf.byteLength):si._opt.isTs?qr._remainingPacketData&&(e=qr._remainingPacketData.byteLength):si._opt.isFmp4&&Gr.mp4Box&&(e=Gr.mp4Box.getAllocatedSampleDataSize()),e},fetchStream:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(si.debugLog("worker","fetchStream, url is "+e,"options:",JSON.stringify(t)),si.isWorkerFetch=!0,t.isFlv?si._opt.isFlv=!0:t.isFmp4?si._opt.isFmp4=!0:t.isMpeg4?si._opt.isMpeg4=!0:t.isNakedFlow?si._opt.isNakedFlow=!0:t.isTs&&(si._opt.isTs=!0),d=ar((e=>{postMessage({cmd:O,type:xe,value:e})})),si.startStreamRateAndStatsInterval(),t.isFmp4&&(Gr.listenMp4Box(),si._opt.isFmp4Private&&Gr.initTransportDescarmber()),t.protocol===_){t.isFlv&&(c=new Ur(si.demuxFlv())),o=new AbortController;const r=Object.assign({signal:o.signal},{headers:t.options&&t.options.headers||{}});fetch(e,r).then((e=>{if(yr(Sr))return si.debugLog("worker","request abort and run res.body.cancel()"),si.fetchStatus=Ct,void e.body.cancel();if(!mr(e))return si.debugWarn("worker",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),xr(),void postMessage({cmd:O,type:Fe.fetchError,value:`fetch response status is ${e.status} and ok is ${e.ok}`});if(postMessage({cmd:O,type:Te}),hr())si.writableStream=new WritableStream({write:e=>o&&o.signal&&o.signal.aborted?(si.debugLog("worker","writableStream write() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt)):yr(Sr)?(si.debugLog("worker","writableStream write() and requestAbort is true so return"),si.fetchStatus=Pt,void xr()):void("string"!=typeof e?(si.fetchStatus=Dt,d(e.byteLength),t.isFlv?c.write(e):t.isFmp4?si.demuxFmp4(e):t.isMpeg4?si.demuxMpeg4(e):t.isTs?si.demuxTs(e):t.isNakedFlow&&si.demuxNakedFlow(e)):si.debugWarn("worker",`writableStream write() and value is "${e}" string so return`)),close:()=>{si.debugLog("worker","writableStream close()"),si.fetchStatus=Pt,c&&(c.close(),c=null),xr(),postMessage({cmd:O,type:Ae,value:g,msg:"fetch done"})},abort:e=>{if(o&&o.signal&&o.signal.aborted)return si.debugLog("worker","writableStream abort() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt);c&&(c.close(),c=null),e.name!==Ut?(si.debugLog("worker",`writableStream abort() and e is ${e.toString()}`),xr(),postMessage({cmd:O,type:Fe.fetchError,value:e.toString()})):si.debugLog("worker","writableStream abort() and e.name is AbortError so return")}}),e.body.pipeTo(si.writableStream).catch((e=>{"AbortError"!==e.name&&si.debugLog("worker","writableStream pipeTo() and e is",e.name,e.toString())}));else{const r=e.body.getReader(),i=()=>{r.read().then((e=>{let{done:r,value:n}=e;return r?(si.debugLog("worker","fetchNext().then() and done is true"),si.fetchStatus=Pt,c&&(c.close(),c=null),xr(),void postMessage({cmd:O,type:Ae,value:g,msg:"fetch done"})):o&&o.signal&&o.signal.aborted?(si.debugLog("worker","fetchNext().then() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt)):yr(Sr)?(si.debugLog("worker","fetchNext().then() and requestAbort is true so return"),si.fetchStatus=Pt,void xr()):void("string"!=typeof n?(si.fetchStatus=Dt,d(n.byteLength),t.isFlv?c.write(n):t.isFmp4?si.demuxFmp4(n):t.isMpeg4?si.demuxMpeg4(n):t.isTs?si.demuxTs(n):t.isNakedFlow&&si.demuxNakedFlow(n),i()):si.debugWarn("worker",`fetchNext().then() and value "${n}" is string so return`))})).catch((e=>{if(o&&o.signal&&o.signal.aborted)return si.debugLog("worker","fetchNext().catch() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt);c&&(c.close(),c=null),e.name!==Ut?(si.debugLog("worker",`fetchNext().catch() and e is ${e.toString()}`),xr(),postMessage({cmd:O,type:Fe.fetchError,value:e.toString()})):si.debugLog("worker","fetchNext().catch() and e.name is AbortError so return")}))};i()}})).catch((e=>{o&&o.signal&&o.signal.aborted?si.debugLog("worker","fetch().catch() and abortController.signal.aborted is true so return"):e.name!==Ut?(si.debugLog("worker",`fetch().catch() and e is ${e.toString()}`),xr(),postMessage({cmd:O,type:Fe.fetchError,value:e.toString()}),c&&(c.close(),c=null)):si.debugLog("worker","fetch().catch() and e.name is AbortError so return")}))}else t.protocol===m&&(t.isFlv&&(c=new Ur(si.demuxFlv())),a=new WebSocket(e,r),a.binaryType="arraybuffer",a.onopen=()=>{si.debugLog("worker","fetchStream, WebsocketStream socket open"),postMessage({cmd:O,type:Te}),postMessage({cmd:O,type:Pe})},a.onclose=e=>{si.isDestroyed?si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} and isDestroyed is true, so return`):u?si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} but isSocketError is true , so return`):(si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code}`),1006===e.code&&si.debugError("worker",`fetchStream, WebsocketStream socket close abnormally and code is ${e.code}`),yr(Sr)?si.debugLog("worker","fetchStream, WebsocketStream socket close and requestAbort is true so return"):(c&&(c.close(),c=null),postMessage({cmd:O,type:Ae,value:y,msg:e.code})))},a.onerror=e=>{si.debugError("worker","fetchStream, WebsocketStream socket error",e,e.toString()),u=!0,c&&(c.close(),c=null),si.isDestroyed?si.debugLog("worker","fetchStream, WebsocketStream on error and isDestroyed is true, so return"):postMessage({cmd:O,type:Fe.websocketError,value:e.isTrusted?"websocket user aborted":"websocket error"})},a.onmessage=e=>{"string"!=typeof e.data?(d(e.data.byteLength),t.isFlv?c.write(e.data):t.isFmp4?si.demuxFmp4(e.data):t.isMpeg4?si.demuxMpeg4(e.data):si._opt.isNakedFlow?si.demuxNakedFlow(e.data):si.demuxM7s(e.data)):si.debugWarn("worker",`socket on message is string "${e.data}" and return`)})},demuxFlv:function*(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),r=new Uint32Array(e);for(;;){t[3]=0;const e=yield 15,i=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const n=r[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let s=r[0];const o=(yield n).slice();switch(i){case de:if(o.byteLength>0){let e=o;yr(si._opt.m7sCryptoAudio)&&(e=si.cryptoPayloadAudio(o)),si.decode(e,{type:oe,ts:s})}else si.debugWarn("worker",`demuxFlv() type is audio and payload.byteLength is ${o.byteLength} and return`);break;case le:if(o.byteLength>=6){const e=o[0];if(si._isEnhancedH265Header(e))si._decodeEnhancedH265Video(o,s);else{const e=15&o[0];let t=o[0]>>4===Tt;const i=e===Me;if(vr(t)&&yr(wr(o,i))&&(si.debugLog("worker","demux() isIFrame is false and unit type is IDR and update to true"),t=!0),t&&gr(o)&&null===si.isHevc){const e=15&o[0];si.isHevc=e===Me,er=ir(o,si.isHevc),si.debugLog("worker",`demuxFlv() isVideoSequenceHeader is true and isHevc is ${si.isHevc} and nalUnitSize is ${er}`)}t&&si.calcIframeIntervalTimestamp(s),si.isPlayer&&si.calcNetworkDelay(s),r[0]=o[4],r[1]=o[3],r[2]=o[2],r[3]=0;let n=r[0],a=si.cryptoPayload(o,t);si.decode(a,{type:ae,ts:s,isIFrame:t,cts:n})}}else si.debugWarn("worker",`demuxFlv() type is video and payload.byteLength is ${o.byteLength} and return`);break;case ce:postMessage({cmd:J,buffer:o},[o.buffer]);break;default:si.debugLog("worker",`demuxFlv() type is ${i}`)}}},decode:function(e,t){t.type===oe?si._opt.hasAudio&&(postMessage({cmd:O,type:Ue,value:e.byteLength}),si.isPlayer?si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts}):si.isPlayback&&(si.isPlaybackOnlyDecodeIFrame()||(si.isPlaybackCacheBeforeDecodeForFpsRender(),si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts})))):t.type===ae&&si._opt.hasVideo&&(postMessage({cmd:O,type:Be,value:e.byteLength}),postMessage({cmd:O,type:ke,value:t.ts}),si.isPlayer?si.pushBuffer(e,{type:t.type,ts:t.ts,isIFrame:t.isIFrame,cts:t.cts}):si.isPlayback&&(si.isPlaybackOnlyDecodeIFrame()?t.isIFrame&&si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}):(si.isPlaybackCacheBeforeDecodeForFpsRender(),si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}))))},cryptoPayload:function(e,t){let r=e;return si._opt.isM7sCrypto?si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?r=Ni(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc):si.debugError("worker",`isM7sCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`):si._opt.isSm4Crypto?si._opt.sm4CryptoKey?r=si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?rs(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc,si._opt.isSm4CryptoH265V2):dn(e,si._opt.sm4CryptoKey,si.isHevc,si._opt.isSm4CryptoH265V2):si._opt.sm4CryptoKey||si.debugError("worker","isSm4Crypto opt.sm4CryptoKey is null"):si._opt.isXorCrypto&&(si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?r=fn(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc):si.debugError("worker",`isXorCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`)),r},cryptoPayloadAudio:function(e){let t=e;return si._opt.isM7sCrypto&&(si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?e[0]>>4===$e&&(t=$i(e,si._opt.cryptoKey,si._opt.cryptoIV)):si.debugError("worker",`isM7sCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`)),t},setCodecAudio:function(e,t){const r=e[0]>>4,i=e[0]>>1&1;if(or=r===$e?i?16:8:0===i?8:16,oi&&oi.setCodec)if(Yt(e)||r===Oe||r===Ge||r===He){si.debugLog("worker",`setCodecAudio: init audio codec, codeId is ${r} _opt.sampleRate is ${si._opt.sampleRate}`);const i=r===$e?e.slice(2):new Uint8Array(0);oi.setCodec(r,si._opt.sampleRate,i),r===$e&&postMessage({cmd:I,buffer:i},[i.buffer]),E=!0,r!==$e&&(r===He?(si.mp3Demuxer||(si.mp3Demuxer=new cn(si),si.mp3Demuxer.on("data",((e,t)=>{oi.decode(e,t)}))),si.mp3Demuxer.dispatch(e.slice(1),t)):oi.decode(e.slice(1),t));{const e=Number("1")||1;setTimeout((()=>{si.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),si.close(),postMessage({cmd:W})}),60*e*60*1e3)}}else si.debugWarn("worker","setCodecAudio: hasInitAudioCodec is false, codecId is ",r);else si.debugError("worker","setCodecAudio: audioDecoder or audioDecoder.setCodec is null")},decodeAudio:function(e,t){if(si.isDestroyed)si.debugLog("worker","decodeAudio, decoder is destroyed and return");else if(si.isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio())ni.decodeAudio(e,t);else if(yr(r)&&yr(si._opt.mseDecodeAudio))postMessage({cmd:$,payload:e,ts:t,cts:t},[e.buffer]);else{const r=e[0]>>4;if(E){if(Yt(e))return void si.debugLog("worker","decodeAudio and has already initialized and payload is aac codec packet so drop this frame");r===He?si.mp3Demuxer.dispatch(e.slice(1),t):oi.decode(r===$e?e.slice(2):e.slice(1),t)}else si.setCodecAudio(e,t)}},setCodecVideo:function(e,t){const r=15&e[0];if(ai&&ai.setCodec)if(gr(e))if(r===Ie||r===Me){si.debugLog("worker",`setCodecVideo: init video codec , codecId is ${r}`);const t=e.slice(5);if(r===Ie&&si._opt.useSIMD){const e=Cr(t);if(e.codecWidth>x||e.codecHeight>x)return postMessage({cmd:Y,value:`width: ${e.codecWidth} > 4080, height: ${e.codecHeight} > 4080`}),void si.debugWarn("worker",`setCodecVideo: SIMD H264 decode video width is too large, width is ${e.codecWidth}, height is ${e.codecHeight}`)}const i=new Uint8Array(e);S=!0,ai.setCodec(r,t),postMessage({cmd:M,code:r}),postMessage({cmd:R,buffer:i,codecId:r},[i.buffer])}else si.debugWarn("worker",`setCodecVideo: hasInitVideoCodec is false, codecId is ${r} is not H264 or H265`);else si.debugWarn("worker",`decodeVideo: hasInitVideoCodec is false, codecId is ${r} and isIFrame is ${t} and packetType is ${e[1]}`);else si.debugError("worker","setCodecVideo: videoDecoder or videoDecoder.setCodec is null")},decodeVideo:function(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(si.isDestroyed)si.debugLog("worker","decodeVideo, decoder is destroyed and return");else if(si.isPlayUseMSEAndDecoderInWorker())ni.decodeVideo(e,t,i,n);else if(yr(r))postMessage({cmd:N,payload:e,isIFrame:i,ts:t,cts:n,delay:si.delay},[e.buffer]);else if(S)if(!B&&i&&(B=!0),B){if(i&&gr(e)){const t=15&e[0];let r={};t===Ie?r=Cr(e.slice(5)):t===Me&&(r=Vr(e)),r.codecWidth&&r.codecHeight&&h&&f&&(r.codecWidth!==h||r.codecHeight!==f)&&(si.debugWarn("worker",`\n decodeVideo: video width or height is changed,\n old width is ${h}, old height is ${f},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),Vt=!0,postMessage({cmd:j,value:`width: ${h}->${r.codecWidth}, height: ${f}->${r.codecHeight}`}))}if(Vt)return void si.debugWarn("worker","decodeVideo: video width or height is changed, and return");if(Xt)return void si.debugWarn("worker","decodeVideo: simd decode error, and return");if(gr(e))return void si.debugLog("worker","decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength0&&void 0!==arguments[0]&&arguments[0];si.debugLog("worker",`clearBuffer,bufferList length is ${i.length}, need clear is ${e}`),e&&(i=[]),si.isPlayer&&(si.resetAllDelay(),yr(si._opt.checkFirstIFrame)&&(si.dropping=!0,postMessage({cmd:H}))),yr(si._opt.checkFirstIFrame)&&vr(r)&&(B=!1)},dropBuffer$2:function(){if(i.length>0){let e=i.findIndex((e=>yr(e.isIFrame)&&e.type===ae));if(si.isAllIframeInBufferList())for(let t=0;t=si.getNotDroppingDelayTs()){si.debugLog("worker",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${n} and notDroppingDelayTs is ${si.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){si.isPushDropping=!0,postMessage({cmd:H});const t=i.length;i=i.slice(e);const r=i.shift();si.resetAllDelay(),si.getDelay(r.ts,r.type),si.doDecode(r),si.isPushDropping=!1,si.debugLog("worker",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,new bufferList is ${i.length} and new delay is ${si.delay} `)}else si.isPushDropping=!1}0===i.length&&(si.isPushDropping=!1)},demuxM7s:function(e){const t=new DataView(e),r=t.getUint32(1,!1),i=t.getUint8(0),n=new ArrayBuffer(4),s=new Uint32Array(n);switch(i){case oe:si.decode(new Uint8Array(e,5),{type:oe,ts:r});break;case ae:if(t.byteLength>=11){const i=new Uint8Array(e,5),n=i[0];if(si._isEnhancedH265Header(n))si._decodeEnhancedH265Video(i,r);else{const e=t.getUint8(5)>>4==1;if(e&&(si.calcIframeIntervalTimestamp(r),gr(i)&&null===si.isHevc)){const e=15&i[0];si.isHevc=e===Me}si.isPlayer&&si.calcNetworkDelay(r),s[0]=i[4],s[1]=i[3],s[2]=i[2],s[3]=0;let n=s[0],o=si.cryptoPayload(i,e);si.decode(o,{type:ae,ts:r,isIFrame:e,cts:n})}}else si.debugWarn("worker",`demuxM7s() type is video and arrayBuffer length is ${e.byteLength} and return`)}},demuxNakedFlow:function(e){Tr.dispatch(e)},demuxFmp4:function(e){Gr.dispatch(e)},demuxMpeg4:function(e){Hr.dispatch(e)},demuxTs:function(e){qr.dispatch(e)},_decodeEnhancedH265Video:function(e,t){const r=e[0],i=48&r,n=15&r,s=e.slice(1,5),o=new ArrayBuffer(4),a=new Uint32Array(o),d="a"==String.fromCharCode(s[0]);if(si.isHevc=vr(d),n===Mt){if(i===Nt){const r=e.slice(5);if(d);else{const i=new Uint8Array(5+r.length);i.set([28,0,0,0,0],0),i.set(r,5),er=ir(e,si.isHevc),si.debugLog("worker",`demuxFlv() isVideoSequenceHeader(enhancedH265) is true and isHevc is ${si.isHevc} and nalUnitSize is ${er}`),si.decode(i,{type:ae,ts:t,isIFrame:!0,cts:0})}}}else if(n===Rt){let r=e,n=0;const s=i===Nt;s&&si.calcIframeIntervalTimestamp(t),d||(a[0]=e[4],a[1]=e[3],a[2]=e[2],a[3]=0,n=a[0],r=Xr(e.slice(8),s),r=si.cryptoPayload(r,s),si.decode(r,{type:ae,ts:t,isIFrame:s,cts:n}))}else if(n===zt){const r=i===Nt;r&&si.calcIframeIntervalTimestamp(t);let n=Xr(e.slice(5),r);n=si.cryptoPayload(n,r),si.decode(n,{type:ae,ts:t,isIFrame:r,cts:0})}},_isEnhancedH265Header:function(e){return(e&It)===It},findSei:function(e,t){let r=4;lr(er)&&(r=er),tr(e.slice(5),r).forEach((e=>{const r=si.isHevc?e[0]>>>1&63:31&e[0],i=si.isHevc&&(r===ft||r===ht),n=vr(si.isHevc)&&r===Ke;(i||n)&&postMessage({cmd:Z,buffer:e,ts:t},[e.buffer])}))},calcNetworkDelay:function(e){if(!(B&&e>0))return;null===Qe?(Qe=e,tt=nr()):et?r-t:0;si.networkDelay=i,i>si._opt.networkDelay&&si._opt.playType===v&&(si.debugWarn("worker",`calcNetworkDelay now dts:${e}, start dts is ${Qe} vs start is ${t},local diff is ${r} ,delay is ${i}`),postMessage({cmd:O,type:De,value:i}))},calcIframeIntervalTimestamp:function(e){null===$t?$t=e:$t=si._opt.playbackForwardMaxRateDecodeIFrame&&!(si._opt.useMSE&&si._opt.mseDecodeAudio)},isPlayUseMSE:function(){return si.isPlayer&&si._opt.useMSE&&yr(r)},isPlayUseMSEAndDecoderInWorker:function(){return si.isPlayUseMSE()&&si._opt.mseDecoderUseWorker},isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio:function(){return si.isPlayUseMSEAndDecoderInWorker()&&si._opt.mseDecodeAudio},playbackUpdatePlaybackRate:function(){vr(si.isPlaybackCacheBeforeDecodeForFpsRender())&&si.clearBuffer(!0)},onOffscreenCanvasWebglContextLost:function(e){si.debugError("worker","handleOffscreenCanvasWebglContextLost and next try to create webgl"),e.preventDefault(),Wt=!0,si.webglObj.destroy(),si.webglObj=null,si.offscreenCanvasGL=null,setTimeout((()=>{si.offscreenCanvasGL=si.offscreenCanvas.getContext("webgl"),si.offscreenCanvasGL&&si.offscreenCanvasGL.getContextAttributes().stencil?(si.webglObj=p(si.offscreenCanvasGL,si._opt.openWebglAlignment),Wt=!1):si.debugError("worker","handleOffscreenCanvasWebglContextLost, stencil is false")}),500)},onOffscreenCanvasWebglContextRestored:function(e){si.debugLog("worker","handleOffscreenCanvasWebglContextRestored"),e.preventDefault()},videoInfo:function(e,t,r){postMessage({cmd:M,code:e}),postMessage({cmd:T,w:t,h:r}),h=t,f=r,si.useOffscreen()&&(si.offscreenCanvas=new OffscreenCanvas(t,r),si.offscreenCanvasGL=si.offscreenCanvas.getContext("webgl"),si.webglObj=p(si.offscreenCanvasGL,si._opt.openWebglAlignment),si.offscreenCanvas.addEventListener("webglcontextlost",si.onOffscreenCanvasWebglContextLost,!1),si.offscreenCanvas.addEventListener("webglcontextrestored",si.onOffscreenCanvasWebglContextRestored,!1))},audioInfo:function(e,t,r){postMessage({cmd:F,code:e}),postMessage({cmd:P,sampleRate:t,channels:r,depth:or}),kt=r},yuvData:function(t,r){if(si.isDestroyed)return void si.debugLog("worker","yuvData, decoder is destroyed and return");const i=h*f*3/2;let n=e.HEAPU8.subarray(t,t+i),s=new Uint8Array(n);if(ut=null,Ee=r,si.useOffscreen())try{if(Wt)return;si.webglObj.renderYUV(h,f,s);let e=si.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:e,delay:si.delay,ts:r},[e])}catch(e){si.debugError("worker","yuvData, transferToImageBitmap error is",e,e.toString())}else postMessage({cmd:C,output:s,delay:si.delay,ts:r},[s.buffer])},pcmData:function(e,r,i){if(si.isDestroyed)return void si.debugLog("worker","pcmData, decoder is destroyed and return");let s=r,o=[],a=0,d=si._opt.audioBufferSize;for(let r=0;r<2;r++){let i=t.HEAPU32[(e>>2)+r]>>2;o[r]=t.HEAPF32.subarray(i,i+s)}if(xt){if(!(s>=(r=d-xt)))return xt+=s,n[0]=Float32Array.of(...n[0],...o[0]),void(2==kt&&(n[1]=Float32Array.of(...n[1],...o[1])));it[0]=Float32Array.of(...n[0],...o[0].subarray(0,r)),2==kt&&(it[1]=Float32Array.of(...n[1],...o[1].subarray(0,r))),postMessage({cmd:D,buffer:it,ts:i},it.map((e=>e.buffer))),a=r,s-=r}for(xt=s;xt>=d;xt-=d)it[0]=o[0].slice(a,a+=d),2==kt&&(it[1]=o[1].slice(a-d,a)),postMessage({cmd:D,buffer:it,ts:i},it.map((e=>e.buffer)));xt&&(n[0]=o[0].slice(a),2==kt&&(n[1]=o[1].slice(a))),o=[]},errorInfo:function(e){null===ut&&(ut=nr());const t=nr(),r=sr(At>0?2*At:5e3,1e3,5e3),i=t-ut;i>r&&(si.debugWarn("worker",`errorInfo() emit simdDecodeError and\n iframeIntervalTimestamp is ${At} and diff is ${i} and maxDiff is ${r}\n and replay`),Xt=!0,postMessage({cmd:q}))},sendWebsocketMessage:function(e){a?a.readyState===Le?a.send(e):si.debugError("worker","socket is not open"):si.debugError("worker","socket is null")},timeEnd:function(){si.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),si.close(),postMessage({cmd:W})},postStreamToMain(e,t){postMessage({cmd:X,type:t,buffer:e},[e.buffer])},updatePlaybackIsPause(e){si.debugLog("worker",`updatePlaybackIsPause, isPause is ${e}`),yr(e)?si.clearPlaybackCacheLoop():si.startPlaybackCacheLoop()},debugLog(e){if(si._opt.debug&&si.debug){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:{};var t,i,n;(n=e).ready=new Promise(((e,r)=>{t=e,i=r})),(n=void 0!==n?n:{}).locateFile=function(e){return"decoder-pro-simd-mt-worker.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_SIMD_MT_WORKER_WASM_URL&&""!=JESSIBUCA_PRO_SIMD_MT_WORKER_WASM_URL?JESSIBUCA_PRO_SIMD_MT_WORKER_WASM_URL:e};var s,a,o,d=Object.assign({},n),l=(e,t)=>{throw t},c="object"==typeof window,u="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f=n.ENVIRONMENT_IS_PTHREAD||!1,p="";function m(e){return n.locateFile?n.locateFile(e,p):p+e}if(h){const{createRequire:e}=await import("module");var _=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd-mt.js",document.baseURI).href),g=_("fs"),y=_("path");let t;p=u?y.dirname(p)+"/":_("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd-mt.js",document.baseURI).href)),s=(e,t)=>(e=te(e)?new URL(e):y.normalize(e),g.readFileSync(e,t?void 0:"utf8")),o=e=>{var t=s(e,!0);return t.buffer||(t=new Uint8Array(t)),t},a=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=te(e)?new URL(e):y.normalize(e),g.readFile(e,i?void 0:"utf8",((e,n)=>{e?r(e):t(i?n.buffer:n)}))},!n.thisProgram&&process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),l=(e,t)=>{throw process.exitCode=e,t},n.inspect=()=>"[Emscripten Module object]";try{t=_("worker_threads")}catch(e){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),e}global.Worker=t.Worker}else(c||u)&&(u?p=self.location.href:"undefined"!=typeof document&&document.currentScript&&(p=document.currentScript.src),r&&(p=r),p=0!==p.indexOf("blob:")?p.substr(0,p.replace(/[?#].*/,"").lastIndexOf("/")+1):"",h||(s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},u&&(o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),a=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)}));h&&"undefined"==typeof performance&&(global.performance=_("perf_hooks").performance);var v=console.log.bind(console),b=console.error.bind(console);h&&(v=function(){for(var e=arguments.length,t=new Array(e),r=0;re.startsWith(Q),te=e=>e.startsWith("file://");function re(e){if(e==J&&w)return new Uint8Array(w);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}function ie(e){if(!w&&(c||u)){if("function"==typeof fetch&&!te(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>re(e)));if(a)return new Promise(((t,r)=>{a(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>re(e)))}function ne(e,t,r){return ie(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{U(`failed to asynchronously prepare wasm: ${e}`),Z(e)}))}function se(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||ee(t)||te(t)||h||"function"!=typeof fetch?ne(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return U(`wasm streaming compile failed: ${e}`),U("falling back to ArrayBuffer instantiation"),ne(t,r,i)}))))}function ae(){var e={a:hi};function t(e,t){return fi=e.exports,Le(fi.R),Te=fi.V,V(fi.N),E=t,X(),fi}if(K(),n.instantiateWasm)try{return n.instantiateWasm(e,t)}catch(e){U(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return se(w,J,e,(function(e){t(e.instance,e.module)})).catch(i),{}}function oe(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}n.locateFile?ee(J="decoder-pro-simd-mt-worker.wasm")||(J=m(J)):J=new URL("decoder-pro-simd-mt-worker.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd-mt.js",document.baseURI).href).href;var de=e=>{e.terminate(),e.onmessage=e=>{}},le=e=>{var t=Ae.pthreads[e];delete Ae.pthreads[e],de(t),wi(e),Ae.runningWorkers.splice(Ae.runningWorkers.indexOf(t),1),t.pthread_ptr=0},ce=e=>{Ae.pthreads[e].postMessage({cmd:"cancel"})},ue=e=>{var t=Ae.pthreads[e];Ae.returnWorkerToPool(t)},he=e=>{var t=Ae.getNewWorker();if(!t)return 6;Ae.runningWorkers.push(t),Ae.pthreads[e.pthread_ptr]=t,t.pthread_ptr=e.pthread_ptr;var r={cmd:"run",start_routine:e.startRoutine,arg:e.arg,pthread_ptr:e.pthread_ptr};return h&&t.unref(),t.postMessage(r,e.transferList),0},fe=0,pe=()=>Pe||fe>0,me="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,_e=(e,t,r)=>{for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&me)return me.decode(e.buffer instanceof SharedArrayBuffer?e.slice(t,n):e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&a)<<6|o)}else s+=String.fromCharCode(a)}return s},ge=(e,t)=>e?_e(T,e,t):"",ye=e=>{var t=Ui(),r=e();return xi(t),r},ve=function(e,t){var r=arguments.length-2,i=arguments;return ye((()=>{for(var n=r,s=Bi(8*n),a=s>>3,o=0;o{if(x=e,f)throw Be(e),"unwind";be(e)},Se=we,Ee=e=>{if(e instanceof oe||"unwind"==e)return x;l(1,e)},Ae={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init(){f?Ae.initWorker():Ae.initMainThread()},initMainThread(){for(var e=8;e--;)Ae.allocateUnusedWorker();W((()=>{K(),Ae.loadWasmModuleToAllWorkers((()=>X()))}))},initWorker(){Pe=!1},setExitStatus:e=>{x=e},terminateAllThreads__deps:["$terminateWorker"],terminateAllThreads:()=>{for(var e of Ae.runningWorkers)de(e);for(var e of Ae.unusedWorkers)de(e);Ae.unusedWorkers=[],Ae.runningWorkers=[],Ae.pthreads=[]},returnWorkerToPool:e=>{var t=e.pthread_ptr;delete Ae.pthreads[t],Ae.unusedWorkers.push(e),Ae.runningWorkers.splice(Ae.runningWorkers.indexOf(e),1),e.pthread_ptr=0,wi(t)},receiveObjectTransfer(e){},threadInitTLS(){Ae.tlsInitFunctions.forEach((e=>e()))},loadWasmModuleToWorker:e=>new Promise((t=>{e.onmessage=r=>{var i=r.data,s=i.cmd;if(i.targetThread&&i.targetThread!=_i()){var a=Ae.pthreads[i.targetThread];a?a.postMessage(i,i.transferList):U(`Internal error! Worker sent a message "${s}" to target pthread ${i.targetThread}, but that thread no longer exists!`)}else"checkMailbox"===s?Ir():"spawnThread"===s?he(i):"cleanupThread"===s?ue(i.thread):"killThread"===s?le(i.thread):"cancelThread"===s?ce(i.thread):"loaded"===s?(e.loaded=!0,h&&!e.pthread_ptr&&e.unref(),t(e)):"alert"===s?alert(`Thread ${i.threadId}: ${i.text}`):"setimmediate"===i.target?e.postMessage(i):"callHandler"===s?n[i.handler](...i.args):s&&U(`worker sent an unknown command ${s}`)},e.onerror=e=>{throw U(`worker sent an error! ${e.filename}:${e.lineno}: ${e.message}`),e},h&&(e.on("message",(t=>e.onmessage({data:t}))),e.on("error",(t=>e.onerror(t))));var r=[];for(var i of["onExit","onAbort","print","printErr"])n.hasOwnProperty(i)&&r.push(i);e.postMessage({cmd:"load",handlers:r,urlOrBlob:n.mainScriptUrlOrBlob,wasmMemory:S,wasmModule:E})})),loadWasmModuleToAllWorkers(e){if(f)return e();Promise.all(Ae.unusedWorkers.map(Ae.loadWasmModuleToWorker)).then(e)},allocateUnusedWorker(){var e;if(n.locateFile){var t=m("decoder-pro-simd-mt-worker.worker.js");e=new Worker(t,{type:"module"})}else e=new Worker(new URL("decoder-pro-simd-mt-worker.worker.js","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd-mt.js",document.baseURI).href),{type:"module"});Ae.unusedWorkers.push(e)},getNewWorker:()=>(0==Ae.unusedWorkers.length&&(Ae.allocateUnusedWorker(),Ae.loadWasmModuleToWorker(Ae.unusedWorkers[0])),Ae.unusedWorkers.pop())};n.PThread=Ae;var Ue=e=>{for(;e.length>0;)e.shift()(n)},xe=()=>{var e=_i(),t=P[e+52>>2],r=P[e+56>>2];Ai(t,t-r),xi(t)};function Be(e){if(f)return ve(1,0,e);Se(e)}n.establishStackSpace=xe;var Te,ke=[],Ce=e=>{var t=ke[e];return t||(e>=ke.length&&(ke.length=e+1),ke[e]=t=Te.get(e)),t},De=(e,t)=>{!function(e){pe()?Ae.setExitStatus(e):Si(e)}(Ce(e)(t))};n.invokeEntryPoint=De;var Pe=n.noExitRuntime||!0,Le=e=>{Ae.tlsInitFunctions.push(e)},Ie=(e,t,r,i)=>{Z(`Assertion failed: ${ge(e)}, at: `+[t?ge(t):"unknown filename",r,i?ge(i):"unknown function"])};function Fe(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){P[this.ptr+4>>2]=e},this.get_type=function(){return P[this.ptr+4>>2]},this.set_destructor=function(e){P[this.ptr+8>>2]=e},this.get_destructor=function(){return P[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,B[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=B[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,B[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=B[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){P[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return P[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Ti(this.get_type()))return P[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}var Re=(e,t,r)=>{throw new Fe(e).init(t,r),e},Me=e=>{yi(e,!u,1,!c,16777216,!1),Ae.threadInitTLS()},ze=e=>{f?postMessage({cmd:"cleanupThread",thread:e}):ue(e)};function $e(e,t,r,i){return f?ve(2,1,e,t,r,i):He(e,t,r,i)}var Ne,Oe,Ge,He=(e,t,r,i)=>{if("undefined"==typeof SharedArrayBuffer)return U("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var n=[];if(f&&0===n.length)return $e(e,t,r,i);var s={startRoutine:r,pthread_ptr:e,arg:i,transferList:n};return f?(s.cmd="spawnThread",postMessage(s,n),0):he(s)},We=(e,t,r,i,n)=>{},Ve=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Ne=e},je=e=>{for(var t="",r=e;T[r];)t+=Ne[T[r++]];return t},qe={},Ye={},Ke={},Xe=e=>{throw new Oe(e)},Ze=e=>{throw new Ge(e)},Je=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&Ze("Mismatched type converter count");for(var n=0;n{Ye.hasOwnProperty(e)?n[t]=Ye[e]:(s.push(e),qe.hasOwnProperty(e)||(qe[e]=[]),qe[e].push((()=>{n[t]=Ye[e],++a===s.length&&i(n)})))})),0===s.length&&i(n)};function Qe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||Xe(`type "${i}" must have a positive integer typeid pointer`),Ye.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;Xe(`Cannot register type '${i}' twice`)}if(Ye[e]=t,delete Ke[e],qe.hasOwnProperty(e)){var n=qe[e];delete qe[e],n.forEach((e=>e()))}}function et(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return Qe(e,t,r)}var tt,rt=8,it=(e,t,r,i)=>{et(e,{name:t=je(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:rt,readValueFromPointer:function(e){return this.fromWireType(T[e])},destructorFunction:null})},nt=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),st=e=>{Xe(e.$$.ptrType.registeredClass.name+" instance already deleted")},at=!1,ot=e=>{},dt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},lt=e=>{e.count.value-=1,0===e.count.value&&dt(e)},ct=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=ct(e,t,r.baseClass);return null===i?null:r.downcast(i)},ut={},ht=()=>Object.keys(yt).length,ft=()=>{var e=[];for(var t in yt)yt.hasOwnProperty(t)&&e.push(yt[t]);return e},pt=[],mt=()=>{for(;pt.length;){var e=pt.pop();e.$$.deleteScheduled=!1,e.delete()}},_t=e=>{tt=e,pt.length&&tt&&tt(mt)},gt=()=>{n.getInheritedInstanceCount=ht,n.getLiveInheritedInstances=ft,n.flushPendingDeletes=mt,n.setDelayFunction=_t},yt={},vt=(e,t)=>{for(void 0===t&&Xe("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},bt=(e,t)=>(t=vt(e,t),yt[t]),wt=(e,t)=>(t.ptrType&&t.ptr||Ze("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&Ze("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Et(Object.create(e,{$$:{value:t}})));function St(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=bt(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?wt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):wt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,a=this.registeredClass.getActualType(t),o=ut[a];if(!o)return n.call(this);s=this.isConst?o.constPointerType:o.pointerType;var d=ct(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?wt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):wt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}var Et=e=>"undefined"==typeof FinalizationRegistry?(Et=e=>e,e):(at=new FinalizationRegistry((e=>{lt(e.$$)})),Et=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};at.register(e,r,e)}return e},ot=e=>at.unregister(e),Et(e)),At=()=>{Object.assign(Ut.prototype,{isAliasOf(e){if(!(this instanceof Ut))return!1;if(!(e instanceof Ut))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n},clone(){if(this.$$.ptr||st(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Et(Object.create(Object.getPrototypeOf(this),{$$:{value:nt(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||st(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Xe("Object already scheduled for deletion"),ot(this),lt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||st(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Xe("Object already scheduled for deletion"),pt.push(this),1===pt.length&&tt&&tt(mt),this.$$.deleteScheduled=!0,this}})};function Ut(){}var xt=(e,t)=>Object.defineProperty(t,"name",{value:e}),Bt=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||Xe(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},Tt=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&Xe(`Cannot register public name '${e}' twice`),Bt(n,e,e),n.hasOwnProperty(r)&&Xe(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,void 0!==r&&(n[e].numArguments=r))},kt=48,Ct=57,Dt=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=kt&&t<=Ct?`_${e}`:e};function Pt(e,t,r,i,n,s,a,o){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=a,this.downcast=o,this.pureVirtualFunctions=[]}var Lt=(e,t,r)=>{for(;t!==r;)t.upcast||Xe(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function It(e,t){if(null===t)return this.isReference&&Xe(`null is not a valid ${this.name}`),0;t.$$||Xe(`Cannot pass "${hr(t)}" as a ${this.name}`),t.$$.ptr||Xe(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Lt(t.$$.ptr,r,this.registeredClass)}function Ft(e,t){var r;if(null===t)return this.isReference&&Xe(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||Xe(`Cannot pass "${hr(t)}" as a ${this.name}`),t.$$.ptr||Xe(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&Xe(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=Lt(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&Xe("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:Xe(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,lr.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:Xe("Unsupporting sharing policy")}return r}function Rt(e,t){if(null===t)return this.isReference&&Xe(`null is not a valid ${this.name}`),0;t.$$||Xe(`Cannot pass "${hr(t)}" as a ${this.name}`),t.$$.ptr||Xe(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&Xe(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Lt(t.$$.ptr,r,this.registeredClass)}function Mt(e){return this.fromWireType(P[e>>2])}var zt=()=>{Object.assign($t.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:rt,readValueFromPointer:Mt,deleteObject(e){null!==e&&e.delete()},fromWireType:St})};function $t(e,t,r,i,n,s,a,o,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=a,this.rawGetPointee=o,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=Ft:i?(this.toWireType=It,this.destructorFunction=null):(this.toWireType=Rt,this.destructorFunction=null)}var Nt,Ot=(e,t,r)=>{n.hasOwnProperty(e)||Ze("Replacing nonexistant public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},Gt=(e,t,r)=>{var i=n["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},Ht=(e,t,r)=>e.includes("j")?Gt(e,t,r):Ce(t).apply(null,r),Wt=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),Ht(e,t,r)}},Vt=(e,t)=>{var r=(e=je(e)).includes("j")?Wt(e,t):Ce(t);return"function"!=typeof r&&Xe(`unknown function pointer with signature ${e}: ${t}`),r},jt=(e,t)=>{var r=xt(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},qt=e=>{var t=gi(e),r=je(t);return pi(t),r},Yt=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Ye[t]||(Ke[t]?Ke[t].forEach(e):(r.push(t),i[t]=!0))})),new Nt(`${e}: `+r.map(qt).join([", "]))},Kt=(e,t,r,i,n,s,a,o,d,l,c,u,h)=>{c=je(c),s=Vt(n,s),o&&(o=Vt(a,o)),l&&(l=Vt(d,l)),h=Vt(u,h);var f=Dt(c);Tt(f,(function(){Yt(`Cannot construct ${c} due to unbound types`,[i])})),Je([e,t,r],i?[i]:[],(function(t){var r,n;t=t[0],n=i?(r=t.registeredClass).instancePrototype:Ut.prototype;var a=xt(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new Oe("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new Oe(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new Oe(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(n,{constructor:{value:a}});a.prototype=d;var u=new Pt(c,a,d,h,r,s,o,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new $t(c,u,!0,!1,!1),m=new $t(c+"*",u,!1,!1,!1),_=new $t(c+" const*",u,!1,!0,!1);return ut[e]={pointerType:m,constPointerType:_},Ot(f,a),[p,m,_]}))},Xt=(e,t)=>{for(var r=[],i=0;i>2]);return r},Zt=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Jt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=xt(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function Qt(e,t,r,i,n,s){var a=t.length;a<2&&Xe("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||s?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=o?1:2;l{var a=Xt(t,r);n=Vt(i,n),Je([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Oe(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Yt(`Cannot construct ${e.name} due to unbound types`,a)},Je([],a,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Qt(r,i,null,n,s),[]))),[]}))},tr=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},rr=(e,t,r,i,n,s,a,o,d)=>{var l=Xt(r,i);t=je(t),t=tr(t),s=Vt(n,s),Je([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function n(){Yt(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,c[t]=n):(Bt(c,t,i),c[t].overloadTable[r-2]=n),Je([],l,(function(n){var o=Qt(i,n,e,s,a,d);return void 0===c[t].overloadTable?(o.argCount=r-2,c[t]=o):c[t].overloadTable[r-2]=o,[]})),[]}))};function ir(){Object.assign(nr.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function nr(){this.allocated=[void 0],this.freelist=[]}var sr=new nr,ar=e=>{e>=sr.reserved&&0==--sr.get(e).refcount&&sr.free(e)},or=()=>{for(var e=0,t=sr.reserved;t{sr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),sr.reserved=sr.allocated.length,n.count_emval_handles=or},lr={toValue:e=>(e||Xe("Cannot use deleted val. handle = "+e),sr.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return sr.allocate({refcount:1,value:e})}}};function cr(e){return this.fromWireType(D[e>>2])}var ur=(e,t)=>{et(e,{name:t=je(t),fromWireType:e=>{var t=lr.toValue(e);return ar(e),t},toWireType:(e,t)=>lr.toHandle(t),argPackAdvance:rt,readValueFromPointer:cr,destructorFunction:null})},hr=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},fr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(L[e>>2])};case 8:return function(e){return this.fromWireType(I[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},pr=(e,t,r)=>{et(e,{name:t=je(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:rt,readValueFromPointer:fr(t,r),destructorFunction:null})},mr=(e,t,r)=>{switch(t){case 1:return r?e=>B[e>>0]:e=>T[e>>0];case 2:return r?e=>k[e>>1]:e=>C[e>>1];case 4:return r?e=>D[e>>2]:e=>P[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},_r=(e,t,r,i,n)=>{t=je(t);var s=e=>e;if(0===i){var a=32-8*r;s=e=>e<>>a}var o=t.includes("unsigned");et(e,{name:t,fromWireType:s,toWireType:o?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:rt,readValueFromPointer:mr(t,r,0!==i),destructorFunction:null})},gr=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=P[e>>2],r=P[e+4>>2];return new i(B.buffer,r,t)}et(e,{name:r=je(r),fromWireType:n,argPackAdvance:rt,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},yr=(e,t,r,i)=>{if(!(i>0))return 0;for(var n=r,s=r+i-1,a=0;a=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a)),o<=127){if(r>=s)break;t[r++]=o}else if(o<=2047){if(r+1>=s)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=s)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=s)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o}}return t[r]=0,r-n},vr=(e,t,r)=>yr(e,T,t,r),br=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},wr=(e,t)=>{var r="std::string"===(t=je(t));et(e,{name:t,fromWireType(e){var t,i=P[e>>2],n=e+4;if(r)for(var s=n,a=0;a<=i;++a){var o=n+a;if(a==i||0==T[o]){var d=ge(s,o-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=o+1}}else{var l=new Array(i);for(a=0;a>2]=i,r&&n)vr(t,a,i+1);else if(n)for(var o=0;o255&&(pi(a),Xe("String has UTF-16 code units that do not fit in 8 bits")),T[a+o]=d}else for(o=0;o{for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&C[i];)++i;if((r=i<<1)-e>32&&Sr)return Sr.decode(T.slice(e,r));for(var s="",a=0;!(a>=t/2);++a){var o=k[e+2*a>>1];if(0==o)break;s+=String.fromCharCode(o)}return s},Ar=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=a,t+=2}return k[t>>1]=0,t-i},Ur=e=>2*e.length,xr=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var n=D[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i},Br=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++s)),D[t>>2]=a,(t+=4)+4>n)break}return D[t>>2]=0,t-i},Tr=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},kr=(e,t,r)=>{var i,n,s,a,o;r=je(r),2===t?(i=Er,n=Ar,a=Ur,s=()=>C,o=1):4===t&&(i=xr,n=Br,a=Tr,s=()=>P,o=2),et(e,{name:r,fromWireType:e=>{for(var r,n=P[e>>2],a=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==a[c>>o]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return pi(e),r},toWireType:(e,i)=>{"string"!=typeof i&&Xe(`Cannot pass non-string to C++ string type ${r}`);var s=a(i),d=mi(4+s+t);return P[d>>2]=s>>o,n(i,d+4,s+t),null!==e&&e.push(pi,d),d},argPackAdvance:rt,readValueFromPointer:cr,destructorFunction(e){pi(e)}})},Cr=(e,t)=>{et(e,{isVoid:!0,name:t=je(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},Dr=()=>{if(!pe())try{f?Si(x):Se(x)}catch(e){Ee(e)}},Pr=e=>{if(!F)try{e(),Dr()}catch(e){Ee(e)}},Lr=e=>{if("function"==typeof Atomics.waitAsync){Atomics.waitAsync(D,e>>2,e).value.then(Ir);var t=e+128;Atomics.store(D,t>>2,1)}};n.__emscripten_thread_mailbox_await=Lr;var Ir=()=>{var e=_i();e&&(Lr(e),Pr(Ei))};n.checkMailbox=Ir;var Fr,Rr=(e,t,r)=>{if(e==t)setTimeout((()=>Ir()));else if(f)postMessage({targetThread:e,cmd:"checkMailbox"});else{var i=Ae.pthreads[e];if(!i)return;i.postMessage({cmd:"checkMailbox"})}},Mr=[],zr=(e,t,r,i)=>{Mr.length=r;for(var n=i>>3,s=0;s{h&&Ae.pthreads[e].ref()},Nr={},Or=e=>{var t=Nr[e];return void 0===t?je(e):t},Gr=[],Hr=(e,t,r,i,n)=>(e=Gr[e])(t=lr.toValue(t),t[r=Or(r)],i,n),Wr=e=>{var t=Gr.length;return Gr.push(e),t},Vr=(e,t)=>{var r=Ye[e];return void 0===r&&Xe(t+" has unknown type "+qt(e)),r},jr=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},qr=(e,t,r)=>{var i=[],n=e.toWireType(i,r);return i.length&&(P[t>>2]=lr.toHandle(i)),n},Yr=(e,t,r)=>{var i=jr(e,t),n=i.shift();e--;var s="return function (obj, func, destructorsRef, args) {\n",a=0,o=[];0===r&&o.push("obj");for(var d=["retType"],l=[n],c=0;ce.name)).join(", ")}) => ${n.name}>`;return Wr(xt(h,u))},Kr=e=>{e>4&&(sr.get(e).refcount+=1)},Xr=e=>lr.toHandle(Or(e)),Zr=()=>lr.toHandle({}),Jr=e=>lr.toHandle(ge(e)),Qr=e=>{var t=lr.toValue(e);Zt(t),ar(e)},ei=(e,t,r)=>{e=lr.toValue(e),t=lr.toValue(t),r=lr.toValue(r),e[t]=r},ti=(e,t)=>{var r=(e=Vr(e,"_emval_take_value")).readValueFromPointer(t);return lr.toHandle(r)},ri=()=>{Z("")},ii=()=>{},ni=()=>{fe+=1},si=()=>{throw ni(),"unwind"};Fr=()=>performance.timeOrigin+performance.now();var ai=e=>{Z("OOM")},oi=e=>{T.length,ai()},di=[null,[],[]],li=(e,t)=>{var r=di[e];0===t||10===t?((1===e?A:U)(_e(r,0)),r.length=0):r.push(t)};function ci(e,t,r,i){if(f)return ve(3,1,e,t,r,i);for(var n=0,s=0;s>2],o=P[t+4>>2];t+=8;for(var d=0;d>2]=n,0}Ae.init(),Ve(),Oe=n.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Ge=n.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},At(),gt(),zt(),Nt=n.UnboundTypeError=jt(Error,"UnboundTypeError"),ir(),dr();var ui=[be,Be,$e,ci],hi={e:Ie,s:Re,D:Me,m:ze,A:He,v:We,J:it,u:Kt,t:er,j:rr,I:ur,o:pr,c:_r,b:gr,p:wr,k:kr,K:Cr,x:Rr,E:zr,C:Lr,G:$r,h:Hr,d:ar,g:Yr,L:Kr,q:Xr,H:Zr,B:Jr,i:Qr,r:ei,M:ti,l:ri,n:ii,F:si,f:Fr,w:oi,z:Se,y:ci,a:S||n.wasmMemory},fi=ae(),pi=e=>(pi=fi.O)(e),mi=e=>(mi=fi.P)(e),_i=n._pthread_self=()=>(_i=n._pthread_self=fi.Q)();n.__emscripten_tls_init=()=>(n.__emscripten_tls_init=fi.R)();var gi=e=>(gi=fi.S)(e);n.__embind_initialize_bindings=()=>(n.__embind_initialize_bindings=fi.T)();var yi=n.__emscripten_thread_init=(e,t,r,i,s,a)=>(yi=n.__emscripten_thread_init=fi.U)(e,t,r,i,s,a);n.__emscripten_thread_crashed=()=>(n.__emscripten_thread_crashed=fi.W)();var vi,bi=(e,t,r,i)=>(bi=fi.X)(e,t,r,i),wi=e=>(wi=fi.Y)(e),Si=n.__emscripten_thread_exit=e=>(Si=n.__emscripten_thread_exit=fi.Z)(e),Ei=()=>(Ei=fi._)(),Ai=(e,t)=>(Ai=fi.$)(e,t),Ui=()=>(Ui=fi.aa)(),xi=e=>(xi=fi.ba)(e),Bi=e=>(Bi=fi.ca)(e),Ti=e=>(Ti=fi.da)(e);function ki(){if(!(q>0)){if(f)return t(n),G(),void startWorker(n);O(),q>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e())}function e(){vi||(vi=!0,n.calledRun=!0,F||(G(),t(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),H()))}}if(n.dynCall_jiji=(e,t,r,i,s)=>(n.dynCall_jiji=fi.ea)(e,t,r,i,s),n.___start_em_js=143516,n.___stop_em_js=143573,n.wasmMemory=S,n.keepRuntimeAlive=pe,n.ExitStatus=oe,n.PThread=Ae,Y=function e(){vi||ki(),vi||(Y=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return ki(),e.ready}),a=(()=>{var e="undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd-mt.js",document.baseURI).href;return async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var r,i,n;(n=t).ready=new Promise(((e,t)=>{r=e,i=t})),(n=void 0!==n?n:{}).locateFile=function(e){return"decoder-pro-audio.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_AUDIO_WASM_URL&&""!=JESSIBUCA_PRO_AUDIO_WASM_URL?JESSIBUCA_PRO_AUDIO_WASM_URL:e};var s,a,o,d=Object.assign({},n),l="./this.program",c="object"==typeof window,u="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";function p(e){return n.locateFile?n.locateFile(e,f):f+e}if(h){const{createRequire:e}=await import("module");var m=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd-mt.js",document.baseURI).href),_=m("fs"),g=m("path");f=u?g.dirname(f)+"/":m("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd-mt.js",document.baseURI).href)),s=(e,t)=>(e=J(e)?new URL(e):g.normalize(e),_.readFileSync(e,t?void 0:"utf8")),o=e=>{var t=s(e,!0);return t.buffer||(t=new Uint8Array(t)),t},a=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=J(e)?new URL(e):g.normalize(e),_.readFile(e,i?void 0:"utf8",((e,n)=>{e?r(e):t(i?n.buffer:n)}))},!n.thisProgram&&process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),n.inspect=()=>"[Emscripten Module object]"}else(c||u)&&(u?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),e&&(f=e),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},u&&(o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),a=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var y,v,b=n.print||console.log.bind(console),w=n.printErr||console.error.bind(console);Object.assign(n,d),d=null,n.arguments&&n.arguments,n.thisProgram&&(l=n.thisProgram),n.quit&&n.quit,n.wasmBinary&&(y=n.wasmBinary),"object"!=typeof WebAssembly&&j("no native wasm support detected");var S,E,A,U,x,B,T,k,C=!1;function D(e,t){e||j(t)}function P(){var e=v.buffer;n.HEAP8=S=new Int8Array(e),n.HEAP16=A=new Int16Array(e),n.HEAPU8=E=new Uint8Array(e),n.HEAPU16=U=new Uint16Array(e),n.HEAP32=x=new Int32Array(e),n.HEAPU32=B=new Uint32Array(e),n.HEAPF32=T=new Float32Array(e),n.HEAPF64=k=new Float64Array(e)}var L=[],I=[],F=[];function R(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)$(n.preRun.shift());ne(L)}function M(){n.noFSInit||ke.init.initialized||ke.init(),ke.ignorePermissions=!1,ne(I)}function z(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)O(n.postRun.shift());ne(F)}function $(e){L.unshift(e)}function N(e){I.unshift(e)}function O(e){F.unshift(e)}var G=0,H=null;function W(e){G++,n.monitorRunDependencies&&n.monitorRunDependencies(G)}function V(e){if(G--,n.monitorRunDependencies&&n.monitorRunDependencies(G),0==G&&H){var t=H;H=null,t()}}function j(e){n.onAbort&&n.onAbort(e),w(e="Aborted("+e+")"),C=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}var q,Y,K,X="data:application/octet-stream;base64,",Z=e=>e.startsWith(X),J=e=>e.startsWith("file://");function Q(e){if(e==q&&y)return new Uint8Array(y);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}function ee(e){if(!y&&(c||u)){if("function"==typeof fetch&&!J(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>Q(e)));if(a)return new Promise(((t,r)=>{a(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>Q(e)))}function te(e,t,r){return ee(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{w(`failed to asynchronously prepare wasm: ${e}`),j(e)}))}function re(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||Z(t)||J(t)||h||"function"!=typeof fetch?te(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return w(`wasm streaming compile failed: ${e}`),w("falling back to ArrayBuffer instantiation"),te(t,r,i)}))))}function ie(){var e={a:ni};function t(e,t){return si=e.exports,v=si.E,P(),Lt=si.H,N(si.F),V(),si}if(W(),n.instantiateWasm)try{return n.instantiateWasm(e,t)}catch(e){w(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return re(y,q,e,(function(e){t(e.instance)})).catch(i),{}}n.locateFile?Z(q="decoder-pro-audio.wasm")||(q=p(q)):q=new URL("decoder-pro-audio.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd-mt.js",document.baseURI).href).href;var ne=e=>{for(;e.length>0;)e.shift()(n)};function se(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){B[this.ptr+4>>2]=e},this.get_type=function(){return B[this.ptr+4>>2]},this.set_destructor=function(e){B[this.ptr+8>>2]=e},this.get_destructor=function(){return B[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,S[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=S[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,S[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=S[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){B[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return B[this.ptr+16>>2]},this.get_exception_ptr=function(){if(ci(this.get_type()))return B[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}n.noExitRuntime;var ae=(e,t,r)=>{throw new se(e).init(t,r),e},oe=e=>(x[oi()>>2]=e,e),de={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=de.isAbs(e),r="/"===e.substr(-1);return(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=de.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=de.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return de.normalize(e.join("/"))},join2:(e,t)=>de.normalize(e+"/"+t)},le=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}j("initRandomDevice")},ce=e=>(ce=le())(e),ue={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:ke.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=de.isAbs(i)}return(t?"/":"")+(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=ue.resolve(e).substr(1),t=ue.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),s=Math.min(i.length,n.length),a=s,o=0;o{for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&he)return he.decode(e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&a)<<6|o)}else s+=String.fromCharCode(a)}return s},pe=[],me=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},_e=(e,t,r,i)=>{if(!(i>0))return 0;for(var n=r,s=r+i-1,a=0;a=55296&&o<=57343)o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a);if(o<=127){if(r>=s)break;t[r++]=o}else if(o<=2047){if(r+1>=s)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=s)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=s)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o}}return t[r]=0,r-n};function ge(e,t,r){var i=r>0?r:me(e)+1,n=new Array(i),s=_e(e,n,0,n.length);return t&&(n.length=s),n}var ye=()=>{if(!pe.length){var e=null;if(h){var t=Buffer.alloc(256),r=0,i=process.stdin.fd;try{r=_.readSync(i,t)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}e=r>0?t.slice(0,r).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;pe=ge(e,!0)}return pe.shift()},ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},ke.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new ke.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new ke.ErrnoError(60);for(var s=0,a=0;aye(),put_char(e,t){null===t||10===t?(b(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(b(fe(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(w(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(w(fe(e.output,0)),e.output=[])}}},be=e=>{j()},we={ops_table:null,mount:e=>we.createNode(null,"/",16895,0),createNode(e,t,r,i){if(ke.isBlkdev(r)||ke.isFIFO(r))throw new ke.ErrnoError(63);we.ops_table||(we.ops_table={dir:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,lookup:we.node_ops.lookup,mknod:we.node_ops.mknod,rename:we.node_ops.rename,unlink:we.node_ops.unlink,rmdir:we.node_ops.rmdir,readdir:we.node_ops.readdir,symlink:we.node_ops.symlink},stream:{llseek:we.stream_ops.llseek}},file:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:{llseek:we.stream_ops.llseek,read:we.stream_ops.read,write:we.stream_ops.write,allocate:we.stream_ops.allocate,mmap:we.stream_ops.mmap,msync:we.stream_ops.msync}},link:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,readlink:we.node_ops.readlink},stream:{}},chrdev:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:ke.chrdev_stream_ops}});var n=ke.createNode(e,t,r,i);return ke.isDir(n.mode)?(n.node_ops=we.ops_table.dir.node,n.stream_ops=we.ops_table.dir.stream,n.contents={}):ke.isFile(n.mode)?(n.node_ops=we.ops_table.file.node,n.stream_ops=we.ops_table.file.stream,n.usedBytes=0,n.contents=null):ke.isLink(n.mode)?(n.node_ops=we.ops_table.link.node,n.stream_ops=we.ops_table.link.stream):ke.isChrdev(n.mode)&&(n.node_ops=we.ops_table.chrdev.node,n.stream_ops=we.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n,e.timestamp=n.timestamp),n},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=ke.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,ke.isDir(e.mode)?t.size=4096:ke.isFile(e.mode)?t.size=e.usedBytes:ke.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&we.resizeFileStorage(e,t.size)},lookup(e,t){throw ke.genericErrors[44]},mknod:(e,t,r,i)=>we.createNode(e,t,r,i),rename(e,t,r){if(ke.isDir(e.mode)){var i;try{i=ke.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new ke.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=ke.lookupNode(e,t);for(var i in r.contents)throw new ke.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink(e,t,r){var i=we.createNode(e,t,41471,0);return i.link=r,i},readlink(e){if(!ke.isLink(e.mode))throw new ke.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,i,n){var s=e.node.contents;if(n>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-n,i);if(a>8&&s.subarray)t.set(s.subarray(n,n+a),r);else for(var o=0;o0||r+t(we.stream_ops.write(e,t,0,i,r,!1),0)}},Se=(e,t,r,i)=>{var n=i?"":`al ${e}`;a(e,(r=>{D(r,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(r)),n&&V()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),n&&W()},Ee=(e,t,r,i,n,s)=>{ke.createDataFile(e,t,r,i,n,s)},Ae=n.preloadPlugins||[],Ue=(e,t,r,i)=>{"undefined"!=typeof Browser&&Browser.init();var n=!1;return Ae.forEach((s=>{n||s.canHandle(t)&&(s.handle(e,t,r,i),n=!0)})),n},xe=(e,t,r,i,n,s,a,o,d,l)=>{var c=t?ue.resolve(de.join2(e,t)):e;function u(r){function u(r){l&&l(),o||Ee(e,t,r,i,n,d),s&&s(),V()}Ue(r,c,u,(()=>{a&&a(),V()}))||u(r)}W(),"string"==typeof r?Se(r,(e=>u(e)),a):u(r)},Be=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t},Te=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},ke={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=ue.resolve(e)))return{path:"",node:null};if(t=Object.assign({follow_mount:!0,recurse_count:0},t),t.recurse_count>8)throw new ke.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),i=ke.root,n="/",s=0;s40)throw new ke.ErrnoError(32)}}return{path:n,node:i}},getPath(e){for(var t;;){if(ke.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,i=0;i>>0)%ke.nameTable.length},hashAddNode(e){var t=ke.hashName(e.parent.id,e.name);e.name_next=ke.nameTable[t],ke.nameTable[t]=e},hashRemoveNode(e){var t=ke.hashName(e.parent.id,e.name);if(ke.nameTable[t]===e)ke.nameTable[t]=e.name_next;else for(var r=ke.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=ke.mayLookup(e);if(r)throw new ke.ErrnoError(r,e);for(var i=ke.hashName(e.id,t),n=ke.nameTable[i];n;n=n.name_next){var s=n.name;if(n.parent.id===e.id&&s===t)return n}return ke.lookup(e,t)},createNode(e,t,r,i){var n=new ke.FSNode(e,t,r,i);return ke.hashAddNode(n),n},destroyNode(e){ke.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>ke.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){var t=ke.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{ke.lookupNode(e,t);return 20}catch(e){}return ke.nodePermissions(e,"wx")},mayDelete(e,t,r){var i;try{i=ke.lookupNode(e,t)}catch(e){return e.errno}var n=ke.nodePermissions(e,"wx");if(n)return n;if(r){if(!ke.isDir(i.mode))return 54;if(ke.isRoot(i)||ke.getPath(i)===ke.cwd())return 10}else if(ke.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?ke.isLink(e.mode)?32:ke.isDir(e.mode)&&("r"!==ke.flagsToPermissionString(t)||512&t)?31:ke.nodePermissions(e,ke.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=ke.MAX_OPEN_FDS;e++)if(!ke.streams[e])return e;throw new ke.ErrnoError(33)},getStreamChecked(e){var t=ke.getStream(e);if(!t)throw new ke.ErrnoError(8);return t},getStream:e=>ke.streams[e],createStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return ke.FSStream||(ke.FSStream=function(){this.shared={}},ke.FSStream.prototype={},Object.defineProperties(ke.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},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(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new ke.FSStream,e),-1==t&&(t=ke.nextfd()),e.fd=t,ke.streams[t]=e,e},closeStream(e){ke.streams[e]=null},chrdev_stream_ops:{open(e){var t=ke.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek(){throw new ke.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){ke.devices[e]={stream_ops:t}},getDevice:e=>ke.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),ke.syncFSRequests++,ke.syncFSRequests>1&&w(`warning: ${ke.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=ke.getMounts(ke.root.mount),i=0;function n(e){return ke.syncFSRequests--,t(e)}function s(e){if(e)return s.errored?void 0:(s.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return s(null);t.type.syncfs(t,e,s)}))},mount(e,t,r){var i,n="/"===r,s=!r;if(n&&ke.root)throw new ke.ErrnoError(10);if(!n&&!s){var a=ke.lookupPath(r,{follow_mount:!1});if(r=a.path,i=a.node,ke.isMountpoint(i))throw new ke.ErrnoError(10);if(!ke.isDir(i.mode))throw new ke.ErrnoError(54)}var o={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(o);return d.mount=o,o.root=d,n?ke.root=d:i&&(i.mounted=o,i.mount&&i.mount.mounts.push(o)),d},unmount(e){var t=ke.lookupPath(e,{follow_mount:!1});if(!ke.isMountpoint(t.node))throw new ke.ErrnoError(28);var r=t.node,i=r.mounted,n=ke.getMounts(i);Object.keys(ke.nameTable).forEach((e=>{for(var t=ke.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&ke.destroyNode(t),t=r}})),r.mounted=null;var s=r.mount.mounts.indexOf(i);r.mount.mounts.splice(s,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var i=ke.lookupPath(e,{parent:!0}).node,n=de.basename(e);if(!n||"."===n||".."===n)throw new ke.ErrnoError(28);var s=ke.mayCreate(i,n);if(s)throw new ke.ErrnoError(s);if(!i.node_ops.mknod)throw new ke.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,ke.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,ke.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),i="",n=0;n(void 0===r&&(r=t,t=438),t|=8192,ke.mknod(e,t,r)),symlink(e,t){if(!ue.resolve(e))throw new ke.ErrnoError(44);var r=ke.lookupPath(t,{parent:!0}).node;if(!r)throw new ke.ErrnoError(44);var i=de.basename(t),n=ke.mayCreate(r,i);if(n)throw new ke.ErrnoError(n);if(!r.node_ops.symlink)throw new ke.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename(e,t){var r,i,n=de.dirname(e),s=de.dirname(t),a=de.basename(e),o=de.basename(t);if(r=ke.lookupPath(e,{parent:!0}).node,i=ke.lookupPath(t,{parent:!0}).node,!r||!i)throw new ke.ErrnoError(44);if(r.mount!==i.mount)throw new ke.ErrnoError(75);var d,l=ke.lookupNode(r,a),c=ue.relative(e,s);if("."!==c.charAt(0))throw new ke.ErrnoError(28);if("."!==(c=ue.relative(t,n)).charAt(0))throw new ke.ErrnoError(55);try{d=ke.lookupNode(i,o)}catch(e){}if(l!==d){var u=ke.isDir(l.mode),h=ke.mayDelete(r,a,u);if(h)throw new ke.ErrnoError(h);if(h=d?ke.mayDelete(i,o,u):ke.mayCreate(i,o))throw new ke.ErrnoError(h);if(!r.node_ops.rename)throw new ke.ErrnoError(63);if(ke.isMountpoint(l)||d&&ke.isMountpoint(d))throw new ke.ErrnoError(10);if(i!==r&&(h=ke.nodePermissions(r,"w")))throw new ke.ErrnoError(h);ke.hashRemoveNode(l);try{r.node_ops.rename(l,i,o)}catch(e){throw e}finally{ke.hashAddNode(l)}}},rmdir(e){var t=ke.lookupPath(e,{parent:!0}).node,r=de.basename(e),i=ke.lookupNode(t,r),n=ke.mayDelete(t,r,!0);if(n)throw new ke.ErrnoError(n);if(!t.node_ops.rmdir)throw new ke.ErrnoError(63);if(ke.isMountpoint(i))throw new ke.ErrnoError(10);t.node_ops.rmdir(t,r),ke.destroyNode(i)},readdir(e){var t=ke.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new ke.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=ke.lookupPath(e,{parent:!0}).node;if(!t)throw new ke.ErrnoError(44);var r=de.basename(e),i=ke.lookupNode(t,r),n=ke.mayDelete(t,r,!1);if(n)throw new ke.ErrnoError(n);if(!t.node_ops.unlink)throw new ke.ErrnoError(63);if(ke.isMountpoint(i))throw new ke.ErrnoError(10);t.node_ops.unlink(t,r),ke.destroyNode(i)},readlink(e){var t=ke.lookupPath(e).node;if(!t)throw new ke.ErrnoError(44);if(!t.node_ops.readlink)throw new ke.ErrnoError(28);return ue.resolve(ke.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=ke.lookupPath(e,{follow:!t}).node;if(!r)throw new ke.ErrnoError(44);if(!r.node_ops.getattr)throw new ke.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>ke.stat(e,!0),chmod(e,t,r){var i;"string"==typeof e?i=ke.lookupPath(e,{follow:!r}).node:i=e;if(!i.node_ops.setattr)throw new ke.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod(e,t){ke.chmod(e,t,!0)},fchmod(e,t){var r=ke.getStreamChecked(e);ke.chmod(r.node,t)},chown(e,t,r,i){var n;"string"==typeof e?n=ke.lookupPath(e,{follow:!i}).node:n=e;if(!n.node_ops.setattr)throw new ke.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown(e,t,r){ke.chown(e,t,r,!0)},fchown(e,t,r){var i=ke.getStreamChecked(e);ke.chown(i.node,t,r)},truncate(e,t){if(t<0)throw new ke.ErrnoError(28);var r;"string"==typeof e?r=ke.lookupPath(e,{follow:!0}).node:r=e;if(!r.node_ops.setattr)throw new ke.ErrnoError(63);if(ke.isDir(r.mode))throw new ke.ErrnoError(31);if(!ke.isFile(r.mode))throw new ke.ErrnoError(28);var i=ke.nodePermissions(r,"w");if(i)throw new ke.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=ke.getStreamChecked(e);if(0==(2097155&r.flags))throw new ke.ErrnoError(28);ke.truncate(r.node,t)},utime(e,t,r){var i=ke.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new ke.ErrnoError(44);var i;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?Be(t):t)?4095&r|32768:0,"object"==typeof e)i=e;else{e=de.normalize(e);try{i=ke.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var s=!1;if(64&t)if(i){if(128&t)throw new ke.ErrnoError(20)}else i=ke.mknod(e,r,0),s=!0;if(!i)throw new ke.ErrnoError(44);if(ke.isChrdev(i.mode)&&(t&=-513),65536&t&&!ke.isDir(i.mode))throw new ke.ErrnoError(54);if(!s){var a=ke.mayOpen(i,t);if(a)throw new ke.ErrnoError(a)}512&t&&!s&&ke.truncate(i,0),t&=-131713;var o=ke.createStream({node:i,path:ke.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return o.stream_ops.open&&o.stream_ops.open(o),!n.logReadFiles||1&t||(ke.readFiles||(ke.readFiles={}),e in ke.readFiles||(ke.readFiles[e]=1)),o},close(e){if(ke.isClosed(e))throw new ke.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{ke.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(ke.isClosed(e))throw new ke.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new ke.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new ke.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,i,n){if(i<0||n<0)throw new ke.ErrnoError(28);if(ke.isClosed(e))throw new ke.ErrnoError(8);if(1==(2097155&e.flags))throw new ke.ErrnoError(8);if(ke.isDir(e.node.mode))throw new ke.ErrnoError(31);if(!e.stream_ops.read)throw new ke.ErrnoError(28);var s=void 0!==n;if(s){if(!e.seekable)throw new ke.ErrnoError(70)}else n=e.position;var a=e.stream_ops.read(e,t,r,i,n);return s||(e.position+=a),a},write(e,t,r,i,n,s){if(i<0||n<0)throw new ke.ErrnoError(28);if(ke.isClosed(e))throw new ke.ErrnoError(8);if(0==(2097155&e.flags))throw new ke.ErrnoError(8);if(ke.isDir(e.node.mode))throw new ke.ErrnoError(31);if(!e.stream_ops.write)throw new ke.ErrnoError(28);e.seekable&&1024&e.flags&&ke.llseek(e,0,2);var a=void 0!==n;if(a){if(!e.seekable)throw new ke.ErrnoError(70)}else n=e.position;var o=e.stream_ops.write(e,t,r,i,n,s);return a||(e.position+=o),o},allocate(e,t,r){if(ke.isClosed(e))throw new ke.ErrnoError(8);if(t<0||r<=0)throw new ke.ErrnoError(28);if(0==(2097155&e.flags))throw new ke.ErrnoError(8);if(!ke.isFile(e.node.mode)&&!ke.isDir(e.node.mode))throw new ke.ErrnoError(43);if(!e.stream_ops.allocate)throw new ke.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,i,n){if(0!=(2&i)&&0==(2&n)&&2!=(2097155&e.flags))throw new ke.ErrnoError(2);if(1==(2097155&e.flags))throw new ke.ErrnoError(2);if(!e.stream_ops.mmap)throw new ke.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n)},msync:(e,t,r,i,n)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new ke.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,i=ke.open(e,t.flags),n=ke.stat(e).size,s=new Uint8Array(n);return ke.read(i,s,0,n,0),"utf8"===t.encoding?r=fe(s,0):"binary"===t.encoding&&(r=s),ke.close(i),r},writeFile(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=ke.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(me(t)+1),s=_e(t,n,0,n.length);ke.write(i,n,0,s,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");ke.write(i,t,0,t.byteLength,void 0,r.canOwn)}ke.close(i)},cwd:()=>ke.currentPath,chdir(e){var t=ke.lookupPath(e,{follow:!0});if(null===t.node)throw new ke.ErrnoError(44);if(!ke.isDir(t.node.mode))throw new ke.ErrnoError(54);var r=ke.nodePermissions(t.node,"x");if(r)throw new ke.ErrnoError(r);ke.currentPath=t.path},createDefaultDirectories(){ke.mkdir("/tmp"),ke.mkdir("/home"),ke.mkdir("/home/web_user")},createDefaultDevices(){ke.mkdir("/dev"),ke.registerDevice(ke.makedev(1,3),{read:()=>0,write:(e,t,r,i,n)=>i}),ke.mkdev("/dev/null",ke.makedev(1,3)),ve.register(ke.makedev(5,0),ve.default_tty_ops),ve.register(ke.makedev(6,0),ve.default_tty1_ops),ke.mkdev("/dev/tty",ke.makedev(5,0)),ke.mkdev("/dev/tty1",ke.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=ce(e).byteLength),e[--t]);ke.createDevice("/dev","random",r),ke.createDevice("/dev","urandom",r),ke.mkdir("/dev/shm"),ke.mkdir("/dev/shm/tmp")},createSpecialDirectories(){ke.mkdir("/proc");var e=ke.mkdir("/proc/self");ke.mkdir("/proc/self/fd"),ke.mount({mount(){var t=ke.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,i=ke.getStreamChecked(r),n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return n.parent=n,n}},t}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?ke.createDevice("/dev","stdin",n.stdin):ke.symlink("/dev/tty","/dev/stdin"),n.stdout?ke.createDevice("/dev","stdout",null,n.stdout):ke.symlink("/dev/tty","/dev/stdout"),n.stderr?ke.createDevice("/dev","stderr",null,n.stderr):ke.symlink("/dev/tty1","/dev/stderr"),ke.open("/dev/stdin",0),ke.open("/dev/stdout",1),ke.open("/dev/stderr",1)},ensureErrnoError(){ke.ErrnoError||(ke.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},ke.ErrnoError.prototype=new Error,ke.ErrnoError.prototype.constructor=ke.ErrnoError,[44].forEach((e=>{ke.genericErrors[e]=new ke.ErrnoError(e),ke.genericErrors[e].stack=""})))},staticInit(){ke.ensureErrnoError(),ke.nameTable=new Array(4096),ke.mount(we,{},"/"),ke.createDefaultDirectories(),ke.createDefaultDevices(),ke.createSpecialDirectories(),ke.filesystems={MEMFS:we}},init(e,t,r){ke.init.initialized=!0,ke.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=t||n.stdout,n.stderr=r||n.stderr,ke.createStandardStreams()},quit(){ke.init.initialized=!1;for(var e=0;ethis.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},s.prototype.setDataGetter=function(e){this.getter=e},s.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,s=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,a=1048576;n||(a=i);var o=this;o.setDataGetter((e=>{var t=e*a,n=(e+1)*a-1;if(n=Math.min(n,i-1),void 0===o.chunks[e]&&(o.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==a&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):ge(n.responseText||"",!0)})(t,n)),void 0===o.chunks[e])throw new Error("doXHR failed!");return o.chunks[e]})),!s&&i||(a=i=1,i=this.getter(0).length,a=i,b("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!u)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new s;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var o={isDevice:!1,contents:a}}else o={isDevice:!1,url:r};var d=ke.createFile(e,t,o,i,n);o.contents?d.contents=o.contents:o.url&&(d.contents=null,d.url=o.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,t,r,i,n){var s=e.node.contents;if(n>=s.length)return 0;var a=Math.min(s.length-n,i);if(s.slice)for(var o=0;o{var t=d.stream_ops[e];l[e]=function(){return ke.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,n)=>(ke.forceLoadFile(d),c(e,t,r,i,n)),l.mmap=(e,t,r,i,n)=>{ke.forceLoadFile(d);var s=be();if(!s)throw new ke.ErrnoError(48);return c(e,S,s,t,r),{ptr:s,allocated:!0}},d.stream_ops=l,d}},Ce=(e,t)=>e?fe(E,e,t):"",De={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(de.isAbs(t))return t;var i;-100===e?i=ke.cwd():i=De.getStreamFromFD(e).path;if(0==t.length){if(!r)throw new ke.ErrnoError(44);return i}return de.join2(i,t)},doStat(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&de.normalize(t)!==de.normalize(ke.getPath(e.node)))return-54;throw e}x[r>>2]=i.dev,x[r+4>>2]=i.mode,B[r+8>>2]=i.nlink,x[r+12>>2]=i.uid,x[r+16>>2]=i.gid,x[r+20>>2]=i.rdev,K=[i.size>>>0,(Y=i.size,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+24>>2]=K[0],x[r+28>>2]=K[1],x[r+32>>2]=4096,x[r+36>>2]=i.blocks;var n=i.atime.getTime(),s=i.mtime.getTime(),a=i.ctime.getTime();return K=[Math.floor(n/1e3)>>>0,(Y=Math.floor(n/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+40>>2]=K[0],x[r+44>>2]=K[1],B[r+48>>2]=n%1e3*1e3,K=[Math.floor(s/1e3)>>>0,(Y=Math.floor(s/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+56>>2]=K[0],x[r+60>>2]=K[1],B[r+64>>2]=s%1e3*1e3,K=[Math.floor(a/1e3)>>>0,(Y=Math.floor(a/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+72>>2]=K[0],x[r+76>>2]=K[1],B[r+80>>2]=a%1e3*1e3,K=[i.ino>>>0,(Y=i.ino,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+88>>2]=K[0],x[r+92>>2]=K[1],0},doMsync(e,t,r,i,n){if(!ke.isFile(t.node.mode))throw new ke.ErrnoError(43);if(2&i)return 0;var s=E.slice(e,e+r);ke.msync(t,s,n,r,i)},varargs:void 0,get(){var e=x[+De.varargs>>2];return De.varargs+=4,e},getp:()=>De.get(),getStr:e=>Ce(e),getStreamFromFD:e=>ke.getStreamChecked(e)};function Pe(e,t,r){De.varargs=r;try{var i=De.getStreamFromFD(e);switch(t){case 0:if((n=De.get())<0)return-28;for(;ke.streams[n];)n++;return ke.createStream(i,n).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var n=De.get();return i.flags|=n,0;case 5:n=De.getp();return A[n+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return oe(28),-1}}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return-e.errno}}function Le(e,t,r,i){De.varargs=i;try{t=De.getStr(t),t=De.calculateAt(e,t);var n=i?De.get():0;return ke.open(t,r,n).fd}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return-e.errno}}var Ie,Fe,Re,Me=(e,t,r,i,n)=>{},ze=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Ie=e},$e=e=>{for(var t="",r=e;E[r];)t+=Ie[E[r++]];return t},Ne={},Oe={},Ge={},He=e=>{throw new Fe(e)},We=e=>{throw new Re(e)},Ve=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&We("Mismatched type converter count");for(var n=0;n{Oe.hasOwnProperty(e)?n[t]=Oe[e]:(s.push(e),Ne.hasOwnProperty(e)||(Ne[e]=[]),Ne[e].push((()=>{n[t]=Oe[e],++a===s.length&&i(n)})))})),0===s.length&&i(n)};function je(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||He(`type "${i}" must have a positive integer typeid pointer`),Oe.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;He(`Cannot register type '${i}' twice`)}if(Oe[e]=t,delete Ge[e],Ne.hasOwnProperty(e)){var n=Ne[e];delete Ne[e],n.forEach((e=>e()))}}function qe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return je(e,t,r)}var Ye,Ke=8,Xe=(e,t,r,i)=>{qe(e,{name:t=$e(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:Ke,readValueFromPointer:function(e){return this.fromWireType(E[e])},destructorFunction:null})},Ze=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Je=e=>{He(e.$$.ptrType.registeredClass.name+" instance already deleted")},Qe=!1,et=e=>{},tt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},rt=e=>{e.count.value-=1,0===e.count.value&&tt(e)},it=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=it(e,t,r.baseClass);return null===i?null:r.downcast(i)},nt={},st=()=>Object.keys(ut).length,at=()=>{var e=[];for(var t in ut)ut.hasOwnProperty(t)&&e.push(ut[t]);return e},ot=[],dt=()=>{for(;ot.length;){var e=ot.pop();e.$$.deleteScheduled=!1,e.delete()}},lt=e=>{Ye=e,ot.length&&Ye&&Ye(dt)},ct=()=>{n.getInheritedInstanceCount=st,n.getLiveInheritedInstances=at,n.flushPendingDeletes=dt,n.setDelayFunction=lt},ut={},ht=(e,t)=>{for(void 0===t&&He("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},ft=(e,t)=>(t=ht(e,t),ut[t]),pt=(e,t)=>(t.ptrType&&t.ptr||We("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!==!!t.smartPtr&&We("Both smartPtrType and smartPtr must be specified"),t.count={value:1},_t(Object.create(e,{$$:{value:t}})));function mt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ft(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?pt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):pt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,a=this.registeredClass.getActualType(t),o=nt[a];if(!o)return n.call(this);s=this.isConst?o.constPointerType:o.pointerType;var d=it(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}var _t=e=>"undefined"==typeof FinalizationRegistry?(_t=e=>e,e):(Qe=new FinalizationRegistry((e=>{rt(e.$$)})),_t=e=>{var t=e.$$;if(!!t.smartPtr){var r={$$:t};Qe.register(e,r,e)}return e},et=e=>Qe.unregister(e),_t(e)),gt=()=>{Object.assign(yt.prototype,{isAliasOf(e){if(!(this instanceof yt))return!1;if(!(e instanceof yt))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n},clone(){if(this.$$.ptr||Je(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=_t(Object.create(Object.getPrototypeOf(this),{$$:{value:Ze(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),et(this),rt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),ot.push(this),1===ot.length&&Ye&&Ye(dt),this.$$.deleteScheduled=!0,this}})};function yt(){}var vt=(e,t)=>Object.defineProperty(t,"name",{value:e}),bt=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||He(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},wt=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&He(`Cannot register public name '${e}' twice`),bt(n,e,e),n.hasOwnProperty(r)&&He(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,void 0!==r&&(n[e].numArguments=r))},St=48,Et=57,At=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=St&&t<=Et?`_${e}`:e};function Ut(e,t,r,i,n,s,a,o){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=a,this.downcast=o,this.pureVirtualFunctions=[]}var xt=(e,t,r)=>{for(;t!==r;)t.upcast||He(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function Bt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return xt(t.$$.ptr,r,this.registeredClass)}function Tt(e,t){var r;if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=xt(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&He("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,sr.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:He("Unsupporting sharing policy")}return r}function kt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return xt(t.$$.ptr,r,this.registeredClass)}function Ct(e){return this.fromWireType(B[e>>2])}var Dt=()=>{Object.assign(Pt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:Ke,readValueFromPointer:Ct,deleteObject(e){null!==e&&e.delete()},fromWireType:mt})};function Pt(e,t,r,i,n,s,a,o,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=a,this.rawGetPointee=o,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=Tt:i?(this.toWireType=Bt,this.destructorFunction=null):(this.toWireType=kt,this.destructorFunction=null)}var Lt,It,Ft=(e,t,r)=>{n.hasOwnProperty(e)||We("Replacing nonexistant public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},Rt=(e,t,r)=>{var i=n["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},Mt=[],zt=e=>{var t=Mt[e];return t||(e>=Mt.length&&(Mt.length=e+1),Mt[e]=t=Lt.get(e)),t},$t=(e,t,r)=>e.includes("j")?Rt(e,t,r):zt(t).apply(null,r),Nt=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),$t(e,t,r)}},Ot=(e,t)=>{var r=(e=$e(e)).includes("j")?Nt(e,t):zt(t);return"function"!=typeof r&&He(`unknown function pointer with signature ${e}: ${t}`),r},Gt=(e,t)=>{var r=vt(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},Ht=e=>{var t=di(e),r=$e(t);return ai(t),r},Wt=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Oe[t]||(Ge[t]?Ge[t].forEach(e):(r.push(t),i[t]=!0))})),new It(`${e}: `+r.map(Ht).join([", "]))},Vt=(e,t,r,i,n,s,a,o,d,l,c,u,h)=>{c=$e(c),s=Ot(n,s),o&&(o=Ot(a,o)),l&&(l=Ot(d,l)),h=Ot(u,h);var f=At(c);wt(f,(function(){Wt(`Cannot construct ${c} due to unbound types`,[i])})),Ve([e,t,r],i?[i]:[],(function(t){var r,n;t=t[0],n=i?(r=t.registeredClass).instancePrototype:yt.prototype;var a=vt(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new Fe("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new Fe(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new Fe(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(n,{constructor:{value:a}});a.prototype=d;var u=new Ut(c,a,d,h,r,s,o,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new Pt(c,u,!0,!1,!1),m=new Pt(c+"*",u,!1,!1,!1),_=new Pt(c+" const*",u,!1,!0,!1);return nt[e]={pointerType:m,constPointerType:_},Ft(f,a),[p,m,_]}))},jt=(e,t)=>{for(var r=[],i=0;i>2]);return r},qt=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Yt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=vt(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function Kt(e,t,r,i,n,s){var a=t.length;a<2&&He("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||s?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=o?1:2;l{var a=jt(t,r);n=Ot(i,n),Ve([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Fe(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Wt(`Cannot construct ${e.name} due to unbound types`,a)},Ve([],a,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Kt(r,i,null,n,s),[]))),[]}))},Zt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Jt=(e,t,r,i,n,s,a,o,d)=>{var l=jt(r,i);t=$e(t),t=Zt(t),s=Ot(n,s),Ve([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function n(){Wt(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,c[t]=n):(bt(c,t,i),c[t].overloadTable[r-2]=n),Ve([],l,(function(n){var o=Kt(i,n,e,s,a,d);return void 0===c[t].overloadTable?(o.argCount=r-2,c[t]=o):c[t].overloadTable[r-2]=o,[]})),[]}))};function Qt(){Object.assign(er.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function er(){this.allocated=[void 0],this.freelist=[]}var tr=new er,rr=e=>{e>=tr.reserved&&0==--tr.get(e).refcount&&tr.free(e)},ir=()=>{for(var e=0,t=tr.reserved;t{tr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),tr.reserved=tr.allocated.length,n.count_emval_handles=ir},sr={toValue:e=>(e||He("Cannot use deleted val. handle = "+e),tr.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return tr.allocate({refcount:1,value:e})}}};function ar(e){return this.fromWireType(x[e>>2])}var or=(e,t)=>{qe(e,{name:t=$e(t),fromWireType:e=>{var t=sr.toValue(e);return rr(e),t},toWireType:(e,t)=>sr.toHandle(t),argPackAdvance:Ke,readValueFromPointer:ar,destructorFunction:null})},dr=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},lr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(T[e>>2])};case 8:return function(e){return this.fromWireType(k[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},cr=(e,t,r)=>{qe(e,{name:t=$e(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Ke,readValueFromPointer:lr(t,r),destructorFunction:null})},ur=(e,t,r)=>{switch(t){case 1:return r?e=>S[e>>0]:e=>E[e>>0];case 2:return r?e=>A[e>>1]:e=>U[e>>1];case 4:return r?e=>x[e>>2]:e=>B[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},hr=(e,t,r,i,n)=>{t=$e(t);var s=e=>e;if(0===i){var a=32-8*r;s=e=>e<>>a}var o=t.includes("unsigned");qe(e,{name:t,fromWireType:s,toWireType:o?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:Ke,readValueFromPointer:ur(t,r,0!==i),destructorFunction:null})},fr=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=B[e>>2],r=B[e+4>>2];return new i(S.buffer,r,t)}qe(e,{name:r=$e(r),fromWireType:n,argPackAdvance:Ke,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},pr=(e,t,r)=>_e(e,E,t,r),mr=(e,t)=>{var r="std::string"===(t=$e(t));qe(e,{name:t,fromWireType(e){var t,i=B[e>>2],n=e+4;if(r)for(var s=n,a=0;a<=i;++a){var o=n+a;if(a==i||0==E[o]){var d=Ce(s,o-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=o+1}}else{var l=new Array(i);for(a=0;a>2]=i,r&&n)pr(t,a,i+1);else if(n)for(var o=0;o255&&(ai(a),He("String has UTF-16 code units that do not fit in 8 bits")),E[a+o]=d}else for(o=0;o{for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&U[i];)++i;if((r=i<<1)-e>32&&_r)return _r.decode(E.subarray(e,r));for(var s="",a=0;!(a>=t/2);++a){var o=A[e+2*a>>1];if(0==o)break;s+=String.fromCharCode(o)}return s},yr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=a,t+=2}return A[t>>1]=0,t-i},vr=e=>2*e.length,br=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var n=x[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i},wr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&a<=57343)a=65536+((1023&a)<<10)|1023&e.charCodeAt(++s);if(x[t>>2]=a,(t+=4)+4>n)break}return x[t>>2]=0,t-i},Sr=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},Er=(e,t,r)=>{var i,n,s,a,o;r=$e(r),2===t?(i=gr,n=yr,a=vr,s=()=>U,o=1):4===t&&(i=br,n=wr,a=Sr,s=()=>B,o=2),qe(e,{name:r,fromWireType:e=>{for(var r,n=B[e>>2],a=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==a[c>>o]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return ai(e),r},toWireType:(e,i)=>{"string"!=typeof i&&He(`Cannot pass non-string to C++ string type ${r}`);var s=a(i),d=li(4+s+t);return B[d>>2]=s>>o,n(i,d+4,s+t),null!==e&&e.push(ai,d),d},argPackAdvance:Ke,readValueFromPointer:ar,destructorFunction(e){ai(e)}})},Ar=(e,t)=>{qe(e,{isVoid:!0,name:t=$e(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},Ur={},xr=e=>{var t=Ur[e];return void 0===t?$e(e):t},Br=[],Tr=(e,t,r,i,n)=>(e=Br[e])(t=sr.toValue(t),t[r=xr(r)],i,n),kr=e=>{var t=Br.length;return Br.push(e),t},Cr=(e,t)=>{var r=Oe[e];return void 0===r&&He(t+" has unknown type "+Ht(e)),r},Dr=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},Pr=(e,t,r)=>{var i=[],n=e.toWireType(i,r);return i.length&&(B[t>>2]=sr.toHandle(i)),n},Lr=(e,t,r)=>{var i=Dr(e,t),n=i.shift();e--;var s="return function (obj, func, destructorsRef, args) {\n",a=0,o=[];0===r&&o.push("obj");for(var d=["retType"],l=[n],c=0;ce.name)).join(", ")}) => ${n.name}>`;return kr(vt(h,u))},Ir=e=>{var t=sr.toValue(e);qt(t),rr(e)},Fr=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,Rr=()=>{j("")},Mr=()=>Date.now(),zr=(e,t,r)=>E.copyWithin(e,t,t+r),$r=e=>{j("OOM")},Nr=e=>{E.length,$r()},Or={},Gr=()=>l||"./this.program",Hr=()=>{if(!Hr.strings){var e={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",_:Gr()};for(var t in Or)void 0===Or[t]?delete e[t]:e[t]=Or[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Hr.strings=r}return Hr.strings},Wr=(e,t)=>{for(var r=0;r>0]=e.charCodeAt(r);S[t>>0]=0},Vr=(e,t)=>{var r=0;return Hr().forEach(((i,n)=>{var s=t+r;B[e+4*n>>2]=s,Wr(i,s),r+=i.length+1})),0},jr=(e,t)=>{var r=Hr();B[e>>2]=r.length;var i=0;return r.forEach((e=>i+=e.length+1)),B[t>>2]=i,0};function qr(e){try{var t=De.getStreamFromFD(e);return ke.close(t),0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}function Yr(e,t){try{var r=De.getStreamFromFD(e),i=r.tty?2:ke.isDir(r.mode)?3:ke.isLink(r.mode)?7:4;return S[t>>0]=i,A[t+2>>1]=0,K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[t+8>>2]=K[0],x[t+12>>2]=K[1],K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[t+16>>2]=K[0],x[t+20>>2]=K[1],0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}var Kr=(e,t,r,i)=>{for(var n=0,s=0;s>2],o=B[t+4>>2];t+=8;var d=ke.read(e,S,a,o,i);if(d<0)return-1;if(n+=d,d>2]=s,0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}function Zr(e,t,r,i,n){var s=Fr(t,r);try{if(isNaN(s))return 61;var a=De.getStreamFromFD(e);return ke.llseek(a,s,i),K=[a.position>>>0,(Y=a.position,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[n>>2]=K[0],x[n+4>>2]=K[1],a.getdents&&0===s&&0===i&&(a.getdents=null),0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}var Jr=(e,t,r,i)=>{for(var n=0,s=0;s>2],o=B[t+4>>2];t+=8;var d=ke.write(e,S,a,o,i);if(d<0)return-1;n+=d,void 0!==i&&(i+=d)}return n};function Qr(e,t,r,i){try{var n=De.getStreamFromFD(e),s=Jr(n,t,r);return B[i>>2]=s,0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}var ei=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=ke.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},ti=365,ri=146;Object.defineProperties(ei.prototype,{read:{get:function(){return(this.mode&ti)===ti},set:function(e){e?this.mode|=ti:this.mode&=~ti}},write:{get:function(){return(this.mode&ri)===ri},set:function(e){e?this.mode|=ri:this.mode&=~ri}},isFolder:{get:function(){return ke.isDir(this.mode)}},isDevice:{get:function(){return ke.isChrdev(this.mode)}}}),ke.FSNode=ei,ke.createPreloadedFile=xe,ke.staticInit(),ze(),Fe=n.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Re=n.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},gt(),ct(),Dt(),It=n.UnboundTypeError=Gt(Error,"UnboundTypeError"),Qt(),nr();var ii,ni={o:ae,A:Pe,s:Le,q:Me,C:Xe,D:Vt,y:Xt,h:Jt,B:or,l:cr,c:hr,b:fr,m:mr,j:Er,n:Ar,f:Tr,g:rr,e:Lr,d:Ir,a:Rr,i:Mr,w:zr,r:Nr,u:Vr,v:jr,k:qr,t:Yr,z:Xr,p:Zr,x:Qr},si=ie(),ai=e=>(ai=si.G)(e),oi=()=>(oi=si.I)(),di=e=>(di=si.J)(e),li=e=>(li=si.K)(e),ci=e=>(ci=si.M)(e);function ui(){function e(){ii||(ii=!0,n.calledRun=!0,C||(M(),r(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),z()))}G>0||(R(),G>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.dynCall_viiijj=(e,t,r,i,s,a,o,d)=>(n.dynCall_viiijj=si.N)(e,t,r,i,s,a,o,d),n.dynCall_jij=(e,t,r,i)=>(n.dynCall_jij=si.O)(e,t,r,i),n.dynCall_jii=(e,t,r)=>(n.dynCall_jii=si.P)(e,t,r),n.dynCall_jiji=(e,t,r,i,s)=>(n.dynCall_jiji=si.Q)(e,t,r,i,s),H=function e(){ii||ui(),ii||(H=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return ui(),t.ready}})(),o=1e-6,d="undefined"!=typeof Float32Array?Float32Array:Array;function l(){var e=new d(16);return d!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function c(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var u,h=function(e,t,r,i,n,s,a){var o=1/(t-r),d=1/(i-n),l=1/(s-a);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*d,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*o,e[13]=(n+i)*d,e[14]=(a+s)*l,e[15]=1,e};function f(e,t,r){var i=new d(3);return i[0]=e,i[1]=t,i[2]=r,i}u=new d(3),d!=Float32Array&&(u[0]=0,u[1]=0,u[2]=0);var p=(e,t)=>{t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);const r=function(){const t=m(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),r=m(e.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))return console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(i)),null;return i}();let i={program:r,attribLocations:{vertexPosition:e.getAttribLocation(r,"aVertexPosition"),texturePosition:e.getAttribLocation(r,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(r,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(r,"uModelMatrix"),viewMatrix:e.getUniformLocation(r,"uViewMatrix"),rgbatexture:e.getUniformLocation(r,"rgbaTexture"),ytexture:e.getUniformLocation(r,"yTexture"),utexture:e.getUniformLocation(r,"uTexture"),vtexture:e.getUniformLocation(r,"vTexture"),isyuv:e.getUniformLocation(r,"isyuv")}},n=function(){const t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),e.STATIC_DRAW);var r=[];r=r.concat([0,1],[1,1],[1,0],[0,0]);const i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW);const n=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,texPosition:i,indices:n}}(),s=p(),a=p(),d=p(),u=p();function p(){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function m(t,r){const i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(console.log("An error occurred compiling the shaders: "+e.getShaderInfoLog(i)),e.deleteShader(i),null)}function _(t,r){e.viewport(0,0,t,r),e.clearColor(0,0,0,0),e.clearDepth(1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);const s=l();h(s,-1,1,-1,1,.1,100);const p=l();c(p);const m=l();!function(e,t,r,i){var n,s,a,d,l,u,h,f,p,m,_=t[0],g=t[1],y=t[2],v=i[0],b=i[1],w=i[2],S=r[0],E=r[1],A=r[2];Math.abs(_-S)32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let r=e-this._current_word_bits_left;this._fillCurrentWord();let i=Math.min(r,this._current_word_bits_left),n=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Ht=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Wt=Ht,Vt=Ht;function jt(e){let{profile:t,sampleRate:r,channel:i}=e;return new Uint8Array([175,0,t<<3|(14&r)>>1,(1&r)<<7|i<<3])}function qt(e){return Yt(e)&&e[1]===Bt}function Yt(e){return e[0]>>4===Ne}const Kt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Xt(e){let t=new Uint8Array(e),r=null,i=0,n=0,s=0,a=null;if(i=n=t[0]>>>3,s=(7&t[0])<<1|t[1]>>>7,s<0||s>=Kt.length)return void console.error("Flv: AAC invalid sampling frequency index!");let o=Kt[s],d=(120&t[1])>>>3;if(d<0||d>=8)return void console.log("Flv: AAC invalid channel configuration");5===i&&(a=(7&t[1])<<1|t[2]>>>7,t[2]);let l=self.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?s>=6?(i=5,r=new Array(4),a=s-3):(i=2,r=new Array(2),a=s):-1!==l.indexOf("android")?(i=2,r=new Array(2),a=s):(i=5,a=s,r=new Array(4),s>=6?a=s-3:1===d&&(i=2,r=new Array(2),a=s)),r[0]=i<<3,r[0]|=(15&s)>>>1,r[1]=(15&s)<<7,r[1]|=(15&d)<<3,5===i&&(r[1]|=(15&a)>>>1,r[2]=(1&a)<<7,r[2]|=8,r[3]=0),{audioType:"aac",config:r,sampleRate:o,channelCount:d,objectType:i,codec:"mp4a.40."+i,originalCodec:"mp4a.40."+n}}class Zt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+7>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(4095===(r[t+0]<<8|r[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let r=this.current_syncword_offset_,i=(8&e[r+1])>>>3,n=(6&e[r+1])>>>1,s=1&e[r+1],a=(192&e[r+2])>>>6,o=(60&e[r+2])>>>2,d=(1&e[r+2])<<2|(192&e[r+3])>>>6,l=(3&e[r+3])<<11|e[r+4]<<3|(224&e[r+5])>>>5;if(e[r+6],r+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let c=1===s?7:9,u=l-c;r+=c;let h=this.findNextSyncwordOffset(r+u);if(this.current_syncword_offset_=h,0!==i&&1!==i||0!==n)continue;let f=e.subarray(r,r+u);t={},t.audio_object_type=a+1,t.sampling_freq_index=o,t.sampling_frequency=Wt[o],t.channel_config=d,t.data=f}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Jt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+1>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(695===(r[t+0]<<3|r[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),r=0;for(let i=0;i<=t;i++)r<<=8,r|=e.readByte();return r}readNextAACFrame(e){let t=this.data_,r=null;for(;null==r&&!this.eof_flag_;){let i=this.current_syncword_offset_,n=(31&t[i+1])<<8|t[i+2];if(i+3+n>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let s=new Gt(t.subarray(i+3,i+3+n)),a=null;if(s.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(i+3+n),s.destroy();continue}a=e}else{let e=s.readBool();if(e&&s.readBool()){console.error("audioMuxVersionA is Not Supported"),s.destroy();break}if(e&&this.getLATMValue(s),!s.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),s.destroy();break}if(0!==s.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),s.destroy();break}if(0!==s.readBits(4)){console.error("more than 2 numProgram Not Supported"),s.destroy();break}if(0!==s.readBits(3)){console.error("more than 2 numLayer Not Supported"),s.destroy();break}let t=e?this.getLATMValue(s):0,r=s.readBits(5);t-=5;let i=s.readBits(4);t-=4;let n=s.readBits(4);t-=4,s.readBits(3),t-=3,t>0&&s.readBits(t);let o=s.readBits(3);if(0!==o){console.error(`frameLengthType = ${o}. Only frameLengthType = 0 Supported`),s.destroy();break}s.readByte();let d=s.readBool();if(d)if(e)this.getLATMValue(s);else{let e=0;for(;;){e<<=8;let t=s.readBool();if(e+=s.readByte(),!t)break}console.log(e)}s.readBool()&&s.readByte(),a={},a.audio_object_type=r,a.sampling_freq_index=i,a.sampling_frequency=Wt[a.sampling_freq_index],a.channel_config=n,a.other_data_present=d}let o=0;for(;;){let e=s.readByte();if(o+=e,255!==e)break}let d=new Uint8Array(o);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function er(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return;const r=e.length,i=[];let n,s=0;for(;s+t>>=8),s+=t,n){if(s+n>r)break;i.push(e.subarray(s,s+n)),s+=n}return i}function tr(e){const t=e.byteLength,r=new Uint8Array(4);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t;const i=new Uint8Array(t+4);return i.set(r,0),i.set(e,4),i}function rr(e,t){let r=null;return t?e.length>=28&&(r=1+(3&e[26])):e.length>=12&&(r=1+(3&e[9])),r}function ir(){return(new Date).getTime()}function nr(e,t,r){return Math.max(Math.min(e,Math.max(t,r)),Math.min(t,r))}function sr(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function ar(e){let t=0,r=sr();return i=>{if(n=i,"[object Number]"!==Object.prototype.toString.call(n))return;var n;t+=i;const s=sr(),a=s-r;a>=1e3&&(e(t/a*1e3),r=s,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();function or(e){return null==e}function dr(e){return!or(e)}function lr(e){return"function"==typeof e}function cr(e){let t=null,r=31&e[0];return r!==We&&r!==Ve||(t=ze),t||(r=(126&e[0])>>1,r!==st&&r!==ot&&r!==lt||(t=$e)),t}function ur(){return"undefined"!=typeof WritableStream}function hr(e){e.close()}function fr(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let r=e[0],i=null,n=1;if(e.length>0){let t=e[1];t&&t.ts-r.ts>1e5&&(r=t,n=2)}if(r)for(let s=n;s=1e3){e[s-1].ts-r.ts<1e3&&(i=s+1)}}}return i}function pr(e){return e.ok&&e.status>=200&&e.status<=299}function mr(){return function(e){let t="";if("object"==typeof e)try{t=JSON.stringify(e),t=JSON.parse(t)}catch(r){t=e}else t=e;return t}(B)}function _r(e){return e[0]>>4===Tt&&e[1]===Bt}function gr(e){return!0===e||"true"===e}function yr(e){return!0!==e&&"true"!==e}function vr(){return!!(self.Worker&&self.MediaSource&&"canConstructInDedicatedWorker"in self.MediaSource&&!0===self.MediaSource.canConstructInDedicatedWorker)}function br(e,t){const r=er(e.slice(5));let i=!1;return r.forEach((e=>{const r=t?e[0]>>>1&63:31&e[0];(t&&(r===Qe||r===tt||r===it)||yr(t)&&r===je)&&(i=!0)})),i}var wr=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function a(e){try{d(i.next(e))}catch(e){s(e)}}function o(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}d((i=i.apply(e,t||[])).next())}))};const Sr=Symbol(32),Er=Symbol(16),Ar=Symbol(8);class Ur{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return wr(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,r)=>{var i;this.reject=r,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(i=this.pull)||void 0===i||i.call(this,e)}))}))}readU32(){return this.read(Sr)}readU16(){return this.read(Er)}readU8(){return this.read(Ar)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let r=0;const i=e=>t.length<(r=e);if("number"==typeof this.need){if(i(this.need))return;e=t.subarray(0,r)}else if(this.need===Sr){if(i(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Er){if(i(2))return;e=t[0]<<8|t[1]}else if(this.need===Ar){if(i(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(i(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,r)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(i(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,r)),e=this.need}return this.consumed+=r,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,r=t+e;if(r<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,r);else{const e=new Uint8Array(r);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,r)}return this.buffer=new Uint8Array(e),this.buffer}}Ur.U32=Sr,Ur.U16=Er,Ur.U8=Ar;class xr{constructor(e){this.log=function(t){if(e._opt.debugLevel==S){const s=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n1?r-1:0),n=1;n1?i-1:0),s=1;s=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseSPS(e){let t=Br._ebsp2rbsp(e),r=new Gt(t);r.readByte();let i=r.readByte();r.readByte();let n=r.readByte();r.readUEG();let s=Br.getProfileString(i),a=Br.getLevelString(n),o=1,d=420,l=[0,420,422,444],c=8;if((100===i||110===i||122===i||244===i||44===i||83===i||86===i||118===i||128===i||138===i||144===i)&&(o=r.readUEG(),3===o&&r.readBits(1),o<=3&&(d=l[o]),c=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool())){let e=3!==o?8:12;for(let t=0;t0&&e<16?(b=t[e-1],w=i[e-1]):255===e&&(b=r.readByte()<<8|r.readByte(),w=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);E=r.readBool(),A=t,U=2*e,S=A/U}}let x=1;1===b&&1===w||(x=b/w);let B=0,T=0;if(0===o)B=1,T=2-m;else{B=3===o?1:2,T=(1===o?2:1)*(2-m)}let k=16*(f+1),C=16*(p+1)*(2-m);k-=(_+g)*B,C-=(y+v)*T;let D=Math.ceil(k*x);return r.destroy(),r=null,{profile_string:s,level_string:a,bit_depth:c,ref_frames:h,chroma_format:d,chroma_format_string:Br.getChromaFormatString(d),frame_rate:{fixed:E,fps:S,fps_den:U,fps_num:A},sar_ratio:{width:b,height:w},codec_size:{width:k,height:C},present_size:{width:D,height:C}}}static parseSPS$2(e){let t=e.subarray(1,4),r="avc1.";for(let e=0;e<3;e++){let i=t[e].toString(16);i.length<2&&(i="0"+i),r+=i}let i=Br._ebsp2rbsp(e),n=new Gt(i);n.readByte();let s=n.readByte();n.readByte();let a=n.readByte();n.readUEG();let o=Br.getProfileString(s),d=Br.getLevelString(a),l=1,c=420,u=[0,420,422,444],h=8,f=8;if((100===s||110===s||122===s||244===s||44===s||83===s||86===s||118===s||128===s||138===s||144===s)&&(l=n.readUEG(),3===l&&n.readBits(1),l<=3&&(c=u[l]),h=n.readUEG()+8,f=n.readUEG()+8,n.readBits(1),n.readBool())){let e=3!==l?8:12;for(let t=0;t0&&e<16?(E=t[e-1],A=r[e-1]):255===e&&(E=n.readByte()<<8|n.readByte(),A=n.readByte()<<8|n.readByte())}if(n.readBool()&&n.readBool(),n.readBool()&&(n.readBits(4),n.readBool()&&n.readBits(24)),n.readBool()&&(n.readUEG(),n.readUEG()),n.readBool()){let e=n.readBits(32),t=n.readBits(32);x=n.readBool(),B=t,T=2*e,U=B/T}}let k=1;1===E&&1===A||(k=E/A);let C=0,D=0;if(0===l)C=1,D=2-y;else{C=3===l?1:2,D=(1===l?2:1)*(2-y)}let P=16*(_+1),L=16*(g+1)*(2-y);P-=(v+b)*C,L-=(w+S)*D;let I=Math.ceil(P*k);return n.destroy(),n=null,{codec_mimetype:r,profile_idc:s,level_idc:a,profile_string:o,level_string:d,chroma_format_idc:l,bit_depth:h,bit_depth_luma:h,bit_depth_chroma:f,ref_frames:m,chroma_format:c,chroma_format_string:Br.getChromaFormatString(c),frame_rate:{fixed:x,fps:U,fps_den:T,fps_num:B},sar_ratio:{width:E,height:A},codec_size:{width:P,height:L},present_size:{width:I,height:L}}}static _skipScalingList(e,t){let r=8,i=8,n=0;for(let s=0;s=this.buflen)return this.iserro=!0,0;this.iserro=!1,r=this.bufoff+e>8?8-this.bufoff:e,t<<=r,t+=this.buffer[this.bufpos]>>8-this.bufoff-r&255>>8-r,this.bufoff+=r,e-=r,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,r=this.bufoff,i=this.read(e);return this.bufpos=t,this.bufoff=r,i}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.sps,4),t.sps=i}if(t.pps){const e=t.pps.byteLength,r=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.pps,4),t.pps=i}return t}function Cr(e){let{sps:t,pps:r}=e;const i=[23,0,0,0,0,1,66,0,30,255];i[0]=23,i[6]=t[1],i[7]=t[2],i[8]=t[3],i[10]=225,i[11]=t.byteLength>>8&255,i[12]=255&t.byteLength,i.push(...t,1,r.byteLength>>8&255,255&r.byteLength,...r);return new Uint8Array(i)}function Dr(e){let{sps:t,pps:r}=e,i=8+t.byteLength+1+2+r.byteLength,n=!1;const s=Br.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(n=!0,i+=4);let a=new Uint8Array(i);a[0]=1,a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=255,a[5]=225;let o=t.byteLength;a[6]=o>>>8,a[7]=255&o;let d=8;a.set(t,8),d+=o,a[d]=1;let l=r.byteLength;a[d+1]=l>>>8,a[d+2]=255&l,a.set(r,d+3),d+=3+l,n&&(a[d]=252|s.chroma_format_idc,a[d+1]=248|s.bit_depth_luma-8,a[d+2]=248|s.bit_depth_chroma-8,a[d+3]=0,d+=4);const c=[23,0,0,0,0],u=new Uint8Array(c.length+a.byteLength);return u.set(c,0),u.set(a,c.length),u}function Pr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Lr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Ir(e){return 31&e[0]}function Fr(e){return e===Ke}function Rr(e){return!function(e){return e===We||e===Ve}(e)&&!Fr(e)}function Mr(e){return e===je}function zr(e){if(0===e.length)return!1;const t=Ir(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=31&e[r],n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,i>=Je||0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class Nr{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Or=e=>{let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)},Gr=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Hr{static _ebsp2rbsp(e){let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseVPS(e){let t=Hr._ebsp2rbsp(e),r=new Gt(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}}static parseSPS(e){let t=Hr._ebsp2rbsp(e),r=new Gt(t);r.readByte(),r.readByte();let i=0,n=0,s=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<=16?(I=t[e-1],F=i[e-1]):255===e&&(I=r.readBits(16),F=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()){r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())}if(r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG()),r.readBool()){if(M=r.readBits(32),z=r.readBits(32),r.readBool()&&r.readUEG(),r.readBool()){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=o;n++){let n=r.readBool();R=n;let s=!0,a=1;n||(s=r.readBool());let o=!1;if(s?r.readUEG():o=r.readBool(),o||(a=r.readUEG()+1),e){for(let e=0;e>6&3,r.general_tier_flag=e[1]>>5&1,r.general_profile_idc=31&e[1],r.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],r.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],r.general_constraint_indicator_flags=r.general_constraint_indicator_flags<<16|e[10]<<8|e[11],r.general_level_idc=e[12],r.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],r.parallelismType=3&e[15],r.chromaFormat=3&e[16],r.bitDepthLumaMinus8=7&e[17],r.bitDepthChromaMinus8=7&e[18],r.avgFrameRate=e[19]<<8|e[20],r.constantFrameRate=e[21]>>6&3,r.numTemporalLayers=e[21]>>3&7,r.temporalIdNested=e[21]>>2&1,r.lengthSizeMinusOne=3&e[21];let i=e[22],n=e.slice(23);for(let e=0;e0)for(let t=r;t<8;t++)e.read(2);i.sub_layer_profile_space=[],i.sub_layer_tier_flag=[],i.sub_layer_profile_idc=[],i.sub_layer_profile_compatibility_flag=[],i.sub_layer_progressive_source_flag=[],i.sub_layer_interlaced_source_flag=[],i.sub_layer_non_packed_constraint_flag=[],i.sub_layer_frame_only_constraint_flag=[],i.sub_layer_level_idc=[];for(let t=0;t{let t=Or(e),r=new Gt(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}})(t),a=(e=>{let t=Or(e),r=new Gt(t);r.readByte(),r.readByte();let i=0,n=0,s=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<16?(I=t[e-1],F=i[e-1]):255===e&&(I=r.readBits(16),F=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(i+=r.readUEG(),n+=r.readUEG(),s+=r.readUEG(),a+=r.readUEG()),r.readBool()&&(M=r.readBits(32),z=r.readBits(32),r.readBool()&&(r.readUEG(),r.readBool()))){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=o;n++){let n=r.readBool();R=n;let s=!1,a=1;n||(s=r.readBool());let o=!1;if(s?r.readSEG():o=r.readBool(),o||(cpbcnt=r.readUEG()+1),e)for(let e=0;e{let t=Or(e),r=new Gt(t);r.readByte(),r.readByte(),r.readUEG(),r.readUEG(),r.readBool(),r.readBool(),r.readBits(3),r.readBool(),r.readBool(),r.readUEG(),r.readUEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool()&&r.readUEG(),r.readSEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool(),r.readBool();let i=r.readBool(),n=r.readBool(),s=1;return n&&i?s=0:n?s=3:i&&(s=2),{parallelismType:s}})(r);n=Object.assign(n,s,a,o);let d=23+(5+t.byteLength)+(5+i.byteLength)+(5+r.byteLength),l=new Uint8Array(d);l[0]=1,l[1]=(3&n.general_profile_space)<<6|(n.general_tier_flag?1:0)<<5|31&n.general_profile_idc,l[2]=n.general_profile_compatibility_flags_1||0,l[3]=n.general_profile_compatibility_flags_2||0,l[4]=n.general_profile_compatibility_flags_3||0,l[5]=n.general_profile_compatibility_flags_4||0,l[6]=n.general_constraint_indicator_flags_1||0,l[7]=n.general_constraint_indicator_flags_2||0,l[8]=n.general_constraint_indicator_flags_3||0,l[9]=n.general_constraint_indicator_flags_4||0,l[10]=n.general_constraint_indicator_flags_5||0,l[11]=n.general_constraint_indicator_flags_6||0,l[12]=60,l[13]=240|(3840&n.min_spatial_segmentation_idc)>>8,l[14]=255&n.min_spatial_segmentation_idc,l[15]=252|3&n.parallelismType,l[16]=252|3&n.chroma_format_idc,l[17]=248|7&n.bit_depth_luma_minus8,l[18]=248|7&n.bit_depth_chroma_minus8,l[19]=0,l[20]=0,l[21]=(3&n.constant_frame_rate)<<6|(7&n.num_temporal_layers)<<3|(n.temporal_id_nested?1:0)<<2|3,l[22]=3,l[23]=128|st,l[24]=0,l[25]=1,l[26]=(65280&t.byteLength)>>8,l[27]=(255&t.byteLength)>>0,l.set(t,28),l[23+(5+t.byteLength)+0]=128|ot,l[23+(5+t.byteLength)+1]=0,l[23+(5+t.byteLength)+2]=1,l[23+(5+t.byteLength)+3]=(65280&i.byteLength)>>8,l[23+(5+t.byteLength)+4]=(255&i.byteLength)>>0,l.set(i,23+(5+t.byteLength)+5),l[23+(5+t.byteLength+5+i.byteLength)+0]=128|lt,l[23+(5+t.byteLength+5+i.byteLength)+1]=0,l[23+(5+t.byteLength+5+i.byteLength)+2]=1,l[23+(5+t.byteLength+5+i.byteLength)+3]=(65280&r.byteLength)>>8,l[23+(5+t.byteLength+5+i.byteLength)+4]=(255&r.byteLength)>>0,l.set(r,23+(5+t.byteLength+5+i.byteLength)+5);const c=[28,0,0,0,0],u=new Uint8Array(c.length+l.byteLength);return u.set(c,0),u.set(l,c.length),u}function Yr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Kr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Xr(e){return(126&e[0])>>1}function Zr(e){return e===ut}function Jr(e){return!function(e){return e>=32&&e<=40}(e)}function Qr(e){return e>=16&&e<=21}function ei(e){if(0===e.length)return!1;const t=Xr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=e[r]>>1&63,n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class ri{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}function ii(e){return parseInt(e)===e}function ni(e){if(!ii(e.length))return!1;for(var t=0;t255)return!1;return!0}function si(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!ni(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(ii(e.length)&&ni(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function ai(e){return new Uint8Array(e)}function oi(e,t,r,i,n){null==i&&null==n||(e=e.slice?e.slice(i,n):Array.prototype.slice.call(e,i,n)),t.set(e,r)}var di,li={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},ci=(di="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r>4]+di[15&i])}return t.join("")}}),ui={16:10,24:12,32:14},hi=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],fi=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],pi=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],mi=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],_i=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],gi=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],yi=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],vi=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],bi=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],wi=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Si=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Ei=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Ai=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Ui=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],xi=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Bi(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=s[t],this._Kd[e-r][t%4]=s[t];for(var a,o=0,d=n;d>16&255]<<24^fi[a>>8&255]<<16^fi[255&a]<<8^fi[a>>24&255]^hi[o]<<24,o+=1,8!=n)for(t=1;t>8&255]<<8^fi[a>>16&255]<<16^fi[a>>24&255]<<24;for(t=n/2+1;t>2,c=d%4,this._Ke[l][c]=s[t],this._Kd[e-l][c]=s[t++],d++}for(var l=1;l>24&255]^Ai[a>>16&255]^Ui[a>>8&255]^xi[255&a]},Ti.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=Bi(e),n=0;n<4;n++)i[n]^=this._Ke[0][n];for(var s=1;s>24&255]^_i[i[(n+1)%4]>>16&255]^gi[i[(n+2)%4]>>8&255]^yi[255&i[(n+3)%4]]^this._Ke[s][n];i=r.slice()}var a,o=ai(16);for(n=0;n<4;n++)a=this._Ke[t][n],o[4*n]=255&(fi[i[n]>>24&255]^a>>24),o[4*n+1]=255&(fi[i[(n+1)%4]>>16&255]^a>>16),o[4*n+2]=255&(fi[i[(n+2)%4]>>8&255]^a>>8),o[4*n+3]=255&(fi[255&i[(n+3)%4]]^a);return o},Ti.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=Bi(e),n=0;n<4;n++)i[n]^=this._Kd[0][n];for(var s=1;s>24&255]^bi[i[(n+3)%4]>>16&255]^wi[i[(n+2)%4]>>8&255]^Si[255&i[(n+1)%4]]^this._Kd[s][n];i=r.slice()}var a,o=ai(16);for(n=0;n<4;n++)a=this._Kd[t][n],o[4*n]=255&(pi[i[n]>>24&255]^a>>24),o[4*n+1]=255&(pi[i[(n+3)%4]>>16&255]^a>>16),o[4*n+2]=255&(pi[i[(n+2)%4]>>8&255]^a>>8),o[4*n+3]=255&(pi[255&i[(n+1)%4]]^a);return o};var ki=function(e){if(!(this instanceof ki))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new Ti(e)};ki.prototype.encrypt=function(e){if((e=si(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=ai(e.length),r=ai(16),i=0;iNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},Li.prototype.setBytes=function(e){if(16!=(e=si(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Li.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var Ii=function(e,t){if(!(this instanceof Ii))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Li||(t=new Li(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new Ti(e)};Ii.prototype.encrypt=function(e){for(var t=si(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,i=0;i>>2]>>>24-s%4*8&255;t[i+s>>>2]|=a<<24-(i+s)%4*8}else for(var o=0;o>>2]=r[o>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-n%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new l.init(r,t/2)}},h=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new l.init(r,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,n=i.words,s=i.sigBytes,a=this.blockSize,o=s/(4*a),d=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*a,c=e.min(4*d,s);if(d){for(var u=0;u>>2]|=e[n]<<24-n%4*8;t.call(this,i,r)}else t.apply(this,arguments)};i.prototype=e}}(),r.lib.WordArray)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.WordArray,i=e.enc;function n(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var r=e.length,i=[],n=0;n>>1]|=e.charCodeAt(n)<<16-n%2*16;return t.create(i,2*r)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s>>2]>>>16-s%4*8&65535);i.push(String.fromCharCode(a))}return i.join("")},parse:function(e){for(var r=e.length,i=[],s=0;s>>1]|=n(e.charCodeAt(s)<<16-s%2*16);return t.create(i,2*r)}}}(),r.enc.Utf16)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.WordArray;function i(e,r,i){for(var n=[],s=0,a=0;a>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var n=[],s=0;s>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,o=0;o<4&&s+.75*o>>6*(3-o)&63));var d=i.charAt(64);if(d)for(;n.length%4;)n.push(d);return n.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var s=0;s>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,n=t?this._safe_map:this._map;e.clamp();for(var s=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,d=0;d<4&&a+.75*d>>6*(3-d)&63));var l=n.charAt(64);if(l)for(;s.length%4;)s.push(l);return s.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,n=t?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var a=0;a>>24)|4278255360&(n<<24|n>>>8)}var s=this._hash.words,a=e[t+0],d=e[t+1],f=e[t+2],p=e[t+3],m=e[t+4],_=e[t+5],g=e[t+6],y=e[t+7],v=e[t+8],b=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],A=e[t+13],U=e[t+14],x=e[t+15],B=s[0],T=s[1],k=s[2],C=s[3];B=l(B,T,k,C,a,7,o[0]),C=l(C,B,T,k,d,12,o[1]),k=l(k,C,B,T,f,17,o[2]),T=l(T,k,C,B,p,22,o[3]),B=l(B,T,k,C,m,7,o[4]),C=l(C,B,T,k,_,12,o[5]),k=l(k,C,B,T,g,17,o[6]),T=l(T,k,C,B,y,22,o[7]),B=l(B,T,k,C,v,7,o[8]),C=l(C,B,T,k,b,12,o[9]),k=l(k,C,B,T,w,17,o[10]),T=l(T,k,C,B,S,22,o[11]),B=l(B,T,k,C,E,7,o[12]),C=l(C,B,T,k,A,12,o[13]),k=l(k,C,B,T,U,17,o[14]),B=c(B,T=l(T,k,C,B,x,22,o[15]),k,C,d,5,o[16]),C=c(C,B,T,k,g,9,o[17]),k=c(k,C,B,T,S,14,o[18]),T=c(T,k,C,B,a,20,o[19]),B=c(B,T,k,C,_,5,o[20]),C=c(C,B,T,k,w,9,o[21]),k=c(k,C,B,T,x,14,o[22]),T=c(T,k,C,B,m,20,o[23]),B=c(B,T,k,C,b,5,o[24]),C=c(C,B,T,k,U,9,o[25]),k=c(k,C,B,T,p,14,o[26]),T=c(T,k,C,B,v,20,o[27]),B=c(B,T,k,C,A,5,o[28]),C=c(C,B,T,k,f,9,o[29]),k=c(k,C,B,T,y,14,o[30]),B=u(B,T=c(T,k,C,B,E,20,o[31]),k,C,_,4,o[32]),C=u(C,B,T,k,v,11,o[33]),k=u(k,C,B,T,S,16,o[34]),T=u(T,k,C,B,U,23,o[35]),B=u(B,T,k,C,d,4,o[36]),C=u(C,B,T,k,m,11,o[37]),k=u(k,C,B,T,y,16,o[38]),T=u(T,k,C,B,w,23,o[39]),B=u(B,T,k,C,A,4,o[40]),C=u(C,B,T,k,a,11,o[41]),k=u(k,C,B,T,p,16,o[42]),T=u(T,k,C,B,g,23,o[43]),B=u(B,T,k,C,b,4,o[44]),C=u(C,B,T,k,E,11,o[45]),k=u(k,C,B,T,x,16,o[46]),B=h(B,T=u(T,k,C,B,f,23,o[47]),k,C,a,6,o[48]),C=h(C,B,T,k,y,10,o[49]),k=h(k,C,B,T,U,15,o[50]),T=h(T,k,C,B,_,21,o[51]),B=h(B,T,k,C,E,6,o[52]),C=h(C,B,T,k,p,10,o[53]),k=h(k,C,B,T,w,15,o[54]),T=h(T,k,C,B,d,21,o[55]),B=h(B,T,k,C,v,6,o[56]),C=h(C,B,T,k,x,10,o[57]),k=h(k,C,B,T,g,15,o[58]),T=h(T,k,C,B,A,21,o[59]),B=h(B,T,k,C,m,6,o[60]),C=h(C,B,T,k,S,10,o[61]),k=h(k,C,B,T,f,15,o[62]),T=h(T,k,C,B,b,21,o[63]),s[0]=s[0]+B|0,s[1]=s[1]+T|0,s[2]=s[2]+k|0,s[3]=s[3]+C|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;r[n>>>5]|=128<<24-n%32;var s=e.floor(i/4294967296),a=i;r[15+(n+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var o=this._hash,d=o.words,l=0;l<4;l++){var c=d[l];d[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return o},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,i,n,s,a){var o=e+(t&r|~t&i)+n+a;return(o<>>32-s)+t}function c(e,t,r,i,n,s,a){var o=e+(t&i|r&~i)+n+a;return(o<>>32-s)+t}function u(e,t,r,i,n,s,a){var o=e+(t^r^i)+n+a;return(o<>>32-s)+t}function h(e,t,r,i,n,s,a){var o=e+(r^(t|~i))+n+a;return(o<>>32-s)+t}t.MD5=s._createHelper(d),t.HmacMD5=s._createHmacHelper(d)}(Math),r.MD5)})),Ot((function(e,t){var r,i,n,s,a,o,d,l;e.exports=(i=(r=l=Ri).lib,n=i.WordArray,s=i.Hasher,a=r.algo,o=[],d=a.SHA1=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],d=r[4],l=0;l<80;l++){if(l<16)o[l]=0|e[t+l];else{var c=o[l-3]^o[l-8]^o[l-14]^o[l-16];o[l]=c<<1|c>>>31}var u=(i<<5|i>>>27)+d+o[l];u+=l<20?1518500249+(n&s|~n&a):l<40?1859775393+(n^s^a):l<60?(n&s|n&a|s&a)-1894007588:(n^s^a)-899497514,d=a,a=s,s=n<<30|n>>>2,n=i,i=u}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+d|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=s._createHelper(d),r.HmacSHA1=s._createHmacHelper(d),l.SHA1)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,a=t.algo,o=[],d=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,n=0;n<64;)t(i)&&(n<8&&(o[n]=r(e.pow(i,.5))),d[n]=r(e.pow(i,1/3)),n++),i++}();var l=[],c=a.SHA256=s.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,_=l[f-2],g=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;l[f]=m+l[f-7]+g+l[f-16]}var y=i&n^i&s^n&s,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=h+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&c^~o&u)+d[f]+l[f];h=u,u=c,c=o,o=a+b|0,a=s,s=n,n=i,i=b+(v+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+o|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=s._createHelper(c),t.HmacSHA256=s._createHmacHelper(c)}(Math),r.SHA256)})),Ot((function(e,t){var r,i,n,s,a,o;e.exports=(i=(r=o=Ri).lib.WordArray,n=r.algo,s=n.SHA256,a=n.SHA224=s.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=s._createHelper(a),r.HmacSHA224=s._createHmacHelper(a),o.SHA224)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.Hasher,i=e.x64,n=i.Word,s=i.WordArray,a=e.algo;function o(){return n.create.apply(n,arguments)}var d=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=o()}();var c=a.SHA512=t.extend({_doReset:function(){this._hash=new s.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=i.high,p=i.low,m=n.high,_=n.low,g=s.high,y=s.low,v=a.high,b=a.low,w=o.high,S=o.low,E=c.high,A=c.low,U=u.high,x=u.low,B=h.high,T=h.low,k=f,C=p,D=m,P=_,L=g,I=y,F=v,R=b,M=w,z=S,$=E,N=A,O=U,G=x,H=B,W=T,V=0;V<80;V++){var j,q,Y=l[V];if(V<16)q=Y.high=0|e[t+2*V],j=Y.low=0|e[t+2*V+1];else{var K=l[V-15],X=K.high,Z=K.low,J=(X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7,Q=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),ee=l[V-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ne=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),se=l[V-7],ae=se.high,oe=se.low,de=l[V-16],le=de.high,ce=de.low;q=(q=(q=J+ae+((j=Q+oe)>>>0>>0?1:0))+ie+((j+=ne)>>>0>>0?1:0))+le+((j+=ce)>>>0>>0?1:0),Y.high=q,Y.low=j}var ue,he=M&$^~M&O,fe=z&N^~z&G,pe=k&D^k&L^D&L,me=C&P^C&I^P&I,_e=(k>>>28|C<<4)^(k<<30|C>>>2)^(k<<25|C>>>7),ge=(C>>>28|k<<4)^(C<<30|k>>>2)^(C<<25|k>>>7),ye=(M>>>14|z<<18)^(M>>>18|z<<14)^(M<<23|z>>>9),ve=(z>>>14|M<<18)^(z>>>18|M<<14)^(z<<23|M>>>9),be=d[V],we=be.high,Se=be.low,Ee=H+ye+((ue=W+ve)>>>0>>0?1:0),Ae=ge+me;H=O,W=G,O=$,G=N,$=M,N=z,M=F+(Ee=(Ee=(Ee=Ee+he+((ue+=fe)>>>0>>0?1:0))+we+((ue+=Se)>>>0>>0?1:0))+q+((ue+=j)>>>0>>0?1:0))+((z=R+ue|0)>>>0>>0?1:0)|0,F=L,R=I,L=D,I=P,D=k,P=C,k=Ee+(_e+pe+(Ae>>>0>>0?1:0))+((C=ue+Ae|0)>>>0>>0?1:0)|0}p=i.low=p+C,i.high=f+k+(p>>>0>>0?1:0),_=n.low=_+P,n.high=m+D+(_>>>0

>>0?1:0),y=s.low=y+I,s.high=g+L+(y>>>0>>0?1:0),b=a.low=b+R,a.high=v+F+(b>>>0>>0?1:0),S=o.low=S+z,o.high=w+M+(S>>>0>>0?1:0),A=c.low=A+N,c.high=E+$+(A>>>0>>0?1:0),x=u.low=x+G,u.high=U+O+(x>>>0>>0?1:0),T=h.low=T+W,h.high=B+H+(T>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(c),e.HmacSHA512=t._createHmacHelper(c)}(),r.SHA512)})),Ot((function(e,t){var r,i,n,s,a,o,d,l;e.exports=(i=(r=l=Ri).x64,n=i.Word,s=i.WordArray,a=r.algo,o=a.SHA512,d=a.SHA384=o.extend({_doReset:function(){this._hash=new s.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=o._createHelper(d),r.HmacSHA384=o._createHmacHelper(d),l.SHA384)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,a=t.x64.Word,o=t.algo,d=[],l=[],c=[];!function(){for(var e=1,t=0,r=0;r<24;r++){d[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var n=1,s=0;s<24;s++){for(var o=0,u=0,h=0;h<7;h++){if(1&n){var f=(1<>>24)|4278255360&(s<<24|s>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(T=r[n]).high^=a,T.low^=s}for(var o=0;o<24;o++){for(var h=0;h<5;h++){for(var f=0,p=0,m=0;m<5;m++)f^=(T=r[h+5*m]).high,p^=T.low;var _=u[h];_.high=f,_.low=p}for(h=0;h<5;h++){var g=u[(h+4)%5],y=u[(h+1)%5],v=y.high,b=y.low;for(f=g.high^(v<<1|b>>>31),p=g.low^(b<<1|v>>>31),m=0;m<5;m++)(T=r[h+5*m]).high^=f,T.low^=p}for(var w=1;w<25;w++){var S=(T=r[w]).high,E=T.low,A=d[w];A<32?(f=S<>>32-A,p=E<>>32-A):(f=E<>>64-A,p=S<>>64-A);var U=u[l[w]];U.high=f,U.low=p}var x=u[0],B=r[0];for(x.high=B.high,x.low=B.low,h=0;h<5;h++)for(m=0;m<5;m++){var T=r[w=h+5*m],k=u[w],C=u[(h+1)%5+5*m],D=u[(h+2)%5+5*m];T.high=k.high^~C.high&D.high,T.low=k.low^~C.low&D.low}T=r[0];var P=c[o];T.high^=P.high,T.low^=P.low}},_doFinalize:function(){var t=this._data,r=t.words;this._nDataBytes;var i=8*t.sigBytes,s=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/s)*s>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,o=this.cfg.outputLength/8,d=o/8,l=[],c=0;c>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(h)}return new n.init(l,o)},clone:function(){for(var e=s.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=s._createHelper(h),t.HmacSHA3=s._createHmacHelper(h)}(Math),r.SHA3)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,a=t.algo,o=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=n.create([0,1518500249,1859775393,2400959708,2840853838]),h=n.create([1352829926,1548603684,1836072691,2053994217,0]),f=a.RIPEMD160=s.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s,a,f,b,w,S,E,A,U,x,B,T=this._hash.words,k=u.words,C=h.words,D=o.words,P=d.words,L=l.words,I=c.words;for(S=s=T[0],E=a=T[1],A=f=T[2],U=b=T[3],x=w=T[4],r=0;r<80;r+=1)B=s+e[t+D[r]]|0,B+=r<16?p(a,f,b)+k[0]:r<32?m(a,f,b)+k[1]:r<48?_(a,f,b)+k[2]:r<64?g(a,f,b)+k[3]:y(a,f,b)+k[4],B=(B=v(B|=0,L[r]))+w|0,s=w,w=b,b=v(f,10),f=a,a=B,B=S+e[t+P[r]]|0,B+=r<16?y(E,A,U)+C[0]:r<32?g(E,A,U)+C[1]:r<48?_(E,A,U)+C[2]:r<64?m(E,A,U)+C[3]:p(E,A,U)+C[4],B=(B=v(B|=0,I[r]))+x|0,S=x,x=U,U=v(A,10),A=E,E=B;B=T[1]+f+U|0,T[1]=T[2]+b+x|0,T[2]=T[3]+w+S|0,T[3]=T[4]+s+E|0,T[4]=T[0]+a+A|0,T[0]=B},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var n=this._hash,s=n.words,a=0;a<5;a++){var o=s[a];s[a]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return n},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function m(e,t,r){return e&t|~e&r}function _(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function v(e,t){return e<>>32-t}t.RIPEMD160=s._createHelper(f),t.HmacRIPEMD160=s._createHmacHelper(f)}(),r.RIPEMD160)})),Ot((function(e,t){var r,i,n;e.exports=(i=(r=Ri).lib.Base,n=r.enc.Utf8,void(r.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),a=this._iKey=t.clone(),o=s.words,d=a.words,l=0;l>>2];e.sigBytes-=t}};i.BlockCipher=c.extend({cfg:c.cfg.extend({mode:f,padding:p}),reset:function(){var e;c.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=i.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?s.create([1398893684,1701076831]).concat(r).concat(t):t).toString(d)},parse:function(e){var t,r=d.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=s.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),m.create({ciphertext:r,salt:t})}},g=i.SerializableCipher=n.extend({cfg:n.extend({format:_}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),s=n.finalize(t),a=n.cfg;return m.create({ciphertext:s,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,i,n){if(i||(i=s.random(8)),n)a=l.create({keySize:t+r,hasher:n}).compute(e,i);else var a=l.create({keySize:t+r}).compute(e,i);var o=s.create(a.words.slice(t),4*r);return a.sigBytes=4*t,m.create({key:a,iv:o,salt:i})}},v=i.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=n.iv;var s=g.encrypt.call(this,e,t,n.key,i);return s.mixIn(n),s},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=n.iv,g.decrypt.call(this,e,t,n.key,i)}})}())})),Ot((function(e,t){var r;e.exports=((r=Ri).mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,i){var n,s=this._iv;s?(n=s.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var a=0;a>24&255)){var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}else e+=1<<24;return e}function i(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var n=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,s=this._iv,a=this._counter;s&&(a=this._counter=s.slice(0),this._iv=void 0),i(a);var o=a.slice(0);r.encryptBlock(o,0);for(var d=0;d>>2]|=n<<24-s%4*8,e.sigBytes+=n},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),Ot((function(e,t){var r;e.exports=((r=Ri).pad.Iso10126={pad:function(e,t){var i=4*t,n=i-e.sigBytes%i;e.concat(r.lib.WordArray.random(n-1)).concat(r.lib.WordArray.create([n<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),Ot((function(e,t){var r;e.exports=((r=Ri).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),Ot((function(e,t){var r;e.exports=((r=Ri).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)})),Ot((function(e,t){var r;e.exports=((r=Ri).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib.CipherParams,n=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return i.create({ciphertext:t})}}}(),r.format.Hex)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.BlockCipher,i=e.algo,n=[],s=[],a=[],o=[],d=[],l=[],c=[],u=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,n[r]=p,s[p]=r;var m=e[r],_=e[m],g=e[_],y=257*e[p]^16843008*p;a[r]=y<<24|y>>>8,o[r]=y<<16|y>>>16,d[r]=y<<8|y>>>24,l[r]=y,y=16843009*g^65537*_^257*m^16843008*r,c[p]=y<<24|y>>>8,u[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,r?(r=m^e[e[e[g^m]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=i.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),s=this._keySchedule=[],a=0;a6&&a%r==4&&(l=n[l>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l]):(l=n[(l=l<<8|l>>>24)>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l],l^=p[a/r|0]<<24),s[a]=s[a-r]^l);for(var o=this._invKeySchedule=[],d=0;d>>24]]^u[n[l>>>16&255]]^h[n[l>>>8&255]]^f[n[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,o,d,l,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,c,u,h,f,s),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,s,a,o){for(var d=this._nRounds,l=e[t]^r[0],c=e[t+1]^r[1],u=e[t+2]^r[2],h=e[t+3]^r[3],f=4,p=1;p>>24]^n[c>>>16&255]^s[u>>>8&255]^a[255&h]^r[f++],_=i[c>>>24]^n[u>>>16&255]^s[h>>>8&255]^a[255&l]^r[f++],g=i[u>>>24]^n[h>>>16&255]^s[l>>>8&255]^a[255&c]^r[f++],y=i[h>>>24]^n[l>>>16&255]^s[c>>>8&255]^a[255&u]^r[f++];l=m,c=_,u=g,h=y}m=(o[l>>>24]<<24|o[c>>>16&255]<<16|o[u>>>8&255]<<8|o[255&h])^r[f++],_=(o[c>>>24]<<24|o[u>>>16&255]<<16|o[h>>>8&255]<<8|o[255&l])^r[f++],g=(o[u>>>24]<<24|o[h>>>16&255]<<16|o[l>>>8&255]<<8|o[255&c])^r[f++],y=(o[h>>>24]<<24|o[l>>>16&255]<<16|o[c>>>8&255]<<8|o[255&u])^r[f++],e[t]=m,e[t+1]=_,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(m)}(),r.AES)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib,i=t.WordArray,n=t.BlockCipher,s=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=s.DES=n.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=a[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],s=0;s<16;s++){var l=n[s]=[],c=d[s];for(r=0;r<24;r++)l[r/6|0]|=t[(o[r]-1+c)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(o[r+24]-1+c)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var u=this._invSubKeys=[];for(r=0;r<16;r++)u[r]=n[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],s=this._lBlock,a=this._rBlock,o=0,d=0;d<8;d++)o|=l[d][((a^n[d])&c[d])>>>0];this._lBlock=a,this._rBlock=s^o}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),n=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(i.create(t)),this._des2=u.createEncryptor(i.create(r)),this._des3=u.createEncryptor(i.create(n))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=n._createHelper(p)}(),r.TripleDES)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=i.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var s=0;n<256;n++){var a=n%r,o=t[a>>>2]>>>24-a%4*8&255;s=(s+i[n]+o)%256;var d=i[n];i[n]=i[s],i[s]=d}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var e=this._S,t=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[r],e[r]=s,i|=e[(e[t]+e[r])%256]<<24-8*n}return this._i=t,this._j=r,i}e.RC4=t._createHelper(n);var a=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)s.call(this)}});e.RC4Drop=t._createHelper(a)}(),r.RC4)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],a=[],o=i.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)d.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(t){var s=t.words,a=s[0],o=s[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(n[0]^=l,n[1]^=u,n[2]^=c,n[3]^=h,n[4]^=l,n[5]^=u,n[6]^=c,n[7]^=h,r=0;r<4;r++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,d=((n*n>>>17)+n*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=t._createHelper(o)}(),r.Rabbit)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],a=[],o=i.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var n=0;n<4;n++)d.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var s=t.words,a=s[0],o=s[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(i[0]^=l,i[1]^=u,i[2]^=c,i[3]^=h,i[4]^=l,i[5]^=u,i[6]^=c,i[7]^=h,n=0;n<4;n++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,d=((n*n>>>17)+n*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=t._createHelper(o)}(),r.RabbitLegacy)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.BlockCipher,i=e.algo;const n=16,s=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function d(e,t){let r=t>>24&255,i=t>>16&255,n=t>>8&255,s=255&t,a=e.sbox[0][r]+e.sbox[1][i];return a^=e.sbox[2][n],a+=e.sbox[3][s],a}function l(e,t,r){let i,s=t,a=r;for(let t=0;t1;--t)s^=e.pbox[t],a=d(e,s)^a,i=s,s=a,a=i;return i=s,s=a,a=i,a^=e.pbox[1],s^=e.pbox[0],{left:s,right:a}}function u(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=a[t][r]}let i=0;for(let a=0;a=r&&(i=0);let o=0,d=0,c=0;for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),r=new Uint8Array(r);const n=e.byteLength;let s=5;for(;sn)break;let o=e[s+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=e.slice(s+4+2,s+4+a);let n=new Fi.ModeOfOperation.ctr(t,new Fi.Counter(r));const o=n.decrypt(i);n=null,e.set(o,s+4+2)}s=s+4+a}return e}function $i(e,t,r){if(e.byteLength<=30)return e;const i=e.slice(32);let n=new Fi.ModeOfOperation.ctr(t,new Fi.Counter(r));const s=n.decrypt(i);return n=null,e.set(s,32),e}Ot((function(e,t){e.exports=Ri}));var Ni=Ot((function(e,t){var r,n,s,a=(r=new Date,n=4,s={setLogLevel:function(e){n=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=n&&console.debug("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=n&&console.info("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=n&&console.warn("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=n&&console.error("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}},s);a.getDurationString=function(e,t){var r;function i(e,t){for(var r=(""+e).split(".");r[0].length0){for(var r="",i=0;i0&&(r+=","),r+="["+a.getDurationString(e.start(i))+","+a.getDurationString(e.end(i))+"]";return r}return"(empty)"},t.Log=a;var o=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};o.prototype.getPosition=function(){return this.position},o.prototype.getEndPosition=function(){return this.buffer.byteLength},o.prototype.getLength=function(){return this.buffer.byteLength},o.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},o.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},o.prototype.readAnyInt=function(e,t){var r=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:r=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:r=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";r=this.dataview.getUint8(this.position)<<16,r|=this.dataview.getUint8(this.position+1)<<8,r|=this.dataview.getUint8(this.position+2);break;case 4:r=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";r=this.dataview.getUint32(this.position)<<32,r|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,r}throw"Not enough bytes in buffer"},o.prototype.readUint8=function(){return this.readAnyInt(1,!1)},o.prototype.readUint16=function(){return this.readAnyInt(2,!1)},o.prototype.readUint24=function(){return this.readAnyInt(3,!1)},o.prototype.readUint32=function(){return this.readAnyInt(4,!1)},o.prototype.readUint64=function(){return this.readAnyInt(8,!1)},o.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",r=0;rthis._byteLength&&(this._byteLength=t);else{for(r<1&&(r=1);t>r;)r*=2;var i=new ArrayBuffer(r),n=new Uint8Array(this._buffer);new Uint8Array(i,0,n.length).set(n),this.buffer=i,this._byteLength=t}}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),r=new Uint8Array(this._buffer,0,t.length);t.set(r),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Int32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Int16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Uint32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Uint16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var r=new Float64Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Float32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,r,i,n){var s=new Uint8Array(e,t,n),a=new Uint8Array(r,i,n);s.set(a)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=0;rn;i--,n++){var s=t[n];t[n]=t[i],t[i]=s}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],r=0;r>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},d.prototype.adjustUint32=function(e,t){var r=this.position;this.seek(e),this.writeUint32(t),this.seek(r)},d.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var r=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var r=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var r=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var r=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var r=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=8*e,r},d.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var r=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r};var c=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(c.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,a.debug("MultiBufferStream","Stream ready for parsing"),!0):(a.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(a.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){a.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r.buffer},c.prototype.reduceBuffer=function(e,t,r){var i;return(i=new Uint8Array(r)).set(new Uint8Array(e,t,r)),i.buffer.fileStart=e.fileStart+t,i.buffer.usedBytes=0,i.buffer},c.prototype.insertBuffer=function(e){for(var t=!0,r=0;ri.byteLength){this.buffers.splice(r,1),r--;continue}a.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=i.fileStart||(e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)),a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(r,0,e),0===r&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,n,s)}}t&&(a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===r&&(this.buffer=e))},c.prototype.logBufferLevel=function(e){var t,r,i,n,s,o=[],d="";for(i=0,n=0,t=0;t0&&(d+=s.end-1+"]");var l=e?a.info:a.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+i+"/"+n+" bytes), continuous ranges: "+d)},c.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},c.prototype.findPosition=function(e,t,r){var i,n=null,s=-1;for(i=!0===e?0:this.bufferIndex;i=t?(a.debug("MultiBufferStream","Found position in existing buffer #"+s),s):-1},c.prototype.findEndContiguousBuf=function(e){var t,r,i,n=void 0!==e?e:this.bufferIndex;if(r=this.buffers[n],this.buffers.length>n+1)for(t=n+1;t>3;return 31===i&&r.data.length>=2&&(i=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),i}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};t.MPEG4DescriptorParser=u;var h={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){h.FullBox.prototype=new h.Box,h.ContainerBox.prototype=new h.Box,h.SampleEntry.prototype=new h.Box,h.TrackGroupTypeBox.prototype=new h.FullBox,h.BASIC_BOXES.forEach((function(e){h.createBoxCtor(e)})),h.FULL_BOXES.forEach((function(e){h.createFullBoxCtor(e)})),h.CONTAINER_BOXES.forEach((function(e){h.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,r){this.type=e,this.size=t,this.uuid=r},FullBox:function(e,t,r){h.Box.call(this,e,t,r),this.flags=0,this.version=0},ContainerBox:function(e,t,r){h.Box.call(this,e,t,r),this.boxes=[]},SampleEntry:function(e,t,r,i){h.ContainerBox.call(this,e,t),this.hdr_size=r,this.start=i},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){h.FullBox.call(this,e,t)},createBoxCtor:function(e,t){h.boxCodes.push(e),h[e+"Box"]=function(t){h.Box.call(this,e,t)},h[e+"Box"].prototype=new h.Box,t&&(h[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){h[e+"Box"]=function(t){h.FullBox.call(this,e,t)},h[e+"Box"].prototype=new h.FullBox,h[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,r=0;rr?(a.error("BoxParser","Box of type '"+c+"' has a size "+l+" greater than its container size "+r),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):0!==l&&o+l>e.getEndPosition()?(e.seek(o),a.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):t?{code:h.OK,type:c,size:l,hdr_size:d,start:o}:(h[c+"Box"]?i=new h[c+"Box"](l):"uuid"!==c?(a.warn("BoxParser","Unknown box type: '"+c+"'"),(i=new h.Box(c,l)).has_unparsed_data=!0):h.UUIDBoxes[s]?i=new h.UUIDBoxes[s](l):(a.warn("BoxParser","Unknown uuid type: '"+s+"'"),(i=new h.Box(c,l)).uuid=s,i.has_unparsed_data=!0),i.hdr_size=d,i.start=o,i.write===h.Box.prototype.write&&"mdat"!==i.type&&(a.info("BoxParser","'"+u+"' box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),(n=e.getPosition()-(i.start+i.size))<0?(a.warn("BoxParser","Parsing of box '"+u+"' did not read the entire indicated box data size (missing "+-n+" bytes), seeking forward"),e.seek(i.start+i.size)):n>0&&(a.error("BoxParser","Parsing of box '"+u+"' read "+n+" more bytes than the indicated box data size, seeking backwards"),0!==i.size&&e.seek(i.start+i.size)),{code:h.OK,box:i,size:i.size})},h.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},h.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},h.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.ContainerBox.prototype.parse=function(e){for(var t,r;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},h.SAMPLE_ENTRY_TYPE_VISUAL="Visual",h.SAMPLE_ENTRY_TYPE_AUDIO="Audio",h.SAMPLE_ENTRY_TYPE_HINT="Hint",h.SAMPLE_ENTRY_TYPE_METADATA="Metadata",h.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",h.SAMPLE_ENTRY_TYPE_SYSTEM="System",h.SAMPLE_ENTRY_TYPE_TEXT="Text",h.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},h.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},h.SampleEntry.prototype.parseFooter=function(e){h.ContainerBox.prototype.parse.call(this,e)},h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_HINT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT,"enct"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA,"encm"),h.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var r=0;r<3;r++)this.layer_size[r]=16==t?e.readUint16():e.readUint32()})),h.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),h.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),h.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)a.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void a.error("av1C reserved_2 parsing problem");var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)}else a.error("av1C reserved_1 parsing problem");else a.error("av1C version "+this.version+" not supported")})),h.createBoxCtor("avcC",(function(e){var t,r;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),r=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(r))})),h.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),h.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),h.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),h.createFullBoxCtor("co64",(function(e){var t,r;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(r=0;r>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),h.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),h.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),h.createFullBoxCtor("ctts",(function(e){var t,r;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(r=0;r>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|r>>6&3,this.acmod=r>>3&7,this.lfeon=r>>2&1,this.bit_rate_code=3&r|i>>5&7})),h.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var r=0;r>6,i.bsid=n>>1&31,i.bsmod=(1&n)<<4|s>>4&15,i.acmod=s>>1&7,i.lfeon=1&s,i.num_dep_sub=a>>1&15,i.num_dep_sub>0&&(i.chan_loc=(1&a)<<8|e.readUint8())}})),h.createFullBoxCtor("dfLa",(function(e){var t=[],r=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var i=e.readUint8(),n=Math.min(127&i,r.length-1);if(n?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(r[n]),128&i)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),h.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[r]=e.readString(4),t-=4,r++})),h.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),h.createBoxCtor("hvcC",(function(e){var t,r,i,n;this.configurationVersion=e.readUint8(),n=e.readUint8(),this.general_profile_space=n>>6,this.general_tier_flag=(32&n)>>5,this.general_profile_idc=31&n,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),n=e.readUint8(),this.constantFrameRate=n>>6,this.numTemporalLayers=(13&n)>>3,this.temporalIdNested=(4&n)>>2,this.lengthSizeMinusOne=3&n,this.nalu_arrays=[];var s=e.readUint8();for(t=0;t>7,a.nalu_type=63&n;var o=e.readUint16();for(r=0;r>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var r=0;if(this.version<2)r=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";r=e.readUint32()}for(var i=0;i>7,this.axis=1&t})),h.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),a.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),h.createFullBoxCtor("ipma",(function(e){var t,r;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?a.property_index=(127&s)<<8|e.readUint8():a.property_index=127&s}}})),h.createFullBoxCtor("iref",(function(e){var t,r;for(this.references=[];e.getPosition()>7,i.assignment_type=127&n,i.assignment_type){case 0:i.grouping_type=e.readString(4);break;case 1:i.grouping_type=e.readString(4),i.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:i.sub_track_id=e.readUint32();break;default:a.warn("BoxParser","Unknown leva assignement type")}}})),h.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),h.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),f.prototype.toString=function(){return"("+this.x+","+this.y+")"},h.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new f(e.readUint16(),e.readUint16()),this.display_primaries[1]=new f(e.readUint16(),e.readUint16()),this.display_primaries[2]=new f(e.readUint16(),e.readUint16()),this.white_point=new f(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),h.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),h.createFullBoxCtor("mehd",(function(e){1&this.flags&&(a.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),h.createFullBoxCtor("meta",(function(e){this.boxes=[],h.ContainerBox.prototype.parse.call(this,e)})),h.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),h.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),h.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),h.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),h.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),h.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),h.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var r=0;r0){var t=e.readUint32();this.kid=[];for(var r=0;r0&&(this.data=e.readUint8Array(i))})),h.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),h.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),h.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var r=0;r>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var r=e.readUint8(),i=0;i>7,this.num_leading_samples=127&t})),h.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)a.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=h.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),h.createSampleGroupCtor("stsa",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),h.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),h.createSampleGroupCtor("tsas",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("tscl",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("vipr",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),r=0;r>6,this.sample_depends_on[i]=t>>4&3,this.sample_is_depended_on[i]=t>>2&3,this.sample_has_redundancy[i]=3&t})),h.createFullBoxCtor("senc"),h.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),a.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),r=0;r>31&1,i.referenced_size=2147483647&n,i.subsegment_duration=e.readUint32(),n=e.readUint32(),i.starts_with_SAP=n>>31&1,i.SAP_type=n>>28&7,i.SAP_delta_time=268435455&n}})),h.SingleItemTypeReferenceBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.SingleItemTypeReferenceBox.prototype=new h.Box,h.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var r=0;r>4&15,this.sample_sizes[t+1]=15&i}else if(8===this.field_size)for(t=0;t0)for(r=0;r>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=h.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),h.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),h.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),h.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var r=e.readUint32(),i=0;i>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),h.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),h.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),h.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},h.createTrackGroupCtor("msrc"),h.TrackReferenceTypeBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.TrackReferenceTypeBox.prototype=new h.Box,h.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},h.trefBox.prototype.parse=function(e){for(var t,r;e.getPosition()t&&this.flags&h.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var r=0;r>7&1,this.block_pad_lsb=r>>6&1,this.block_little_endian=r>>5&1,this.block_reversed=r>>4&1,this.pad_unknown=r>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),h.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),h.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),h.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),h.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=h.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),h.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),h.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=h.parseHex16(e)})),h.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),h.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),h.createFullBoxCtor("vvcC",(function(e){var t,r,i={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(i.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,r=this.num_sublayers-2;r>=0;--r){var a=i.extract_bits(1);this.ptl_sublayer_present_mask|=a<1;++r)i.extract_bits(1);for(this.sublayer_level_idc=[],r=this.num_sublayers-2;r>=0;--r)this.ptl_sublayer_present_mask&1<>=1;t+=h.decimalToHex(i,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var n=!1,s="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||n)&&(s="."+h.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+s,n=!0);t+=s}return t},h.vvc1SampleEntry.prototype.getCodec=h.vvi1SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var r="";if(this.vvcC.general_constraint_info){var i,n=[],s=0;for(s|=this.vvcC.ptl_frame_only_constraint<<7,s|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,n.push(s),s&&(i=e),s=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===i)r=".CA";else{r=".C";var a="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",o=0,d=0;for(e=0;e<=i;++e)for(o=o<<8|n[e],d+=8;d>=5;){r+=a[o>>d-5&31],o&=(1<<(d-=5))-1}d&&(r+=a[31&(o<<=5-d)])}}t+=r}return t},h.mp4aSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),r=this.esds.esd.getAudioConfig();return e+"."+h.decimalToHex(t)+(r?"."+r:"")}return e},h.stxtSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},h.vp08SampleEntry.prototype.getCodec=h.vp09SampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var r=this.vpcC.bitDepth;return 8==r&&(r="08"),e+".0"+this.vpcC.profile+"."+t+"."+r},h.av01SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this),r=this.av1C.seq_level_idx_0;return r<10&&(r="0"+r),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+r+(this.av1C.seq_tier_0?"H":"M")+"."+e},h.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),a.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>l?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>l&&e.writeUint64(this.size)},h.FullBox.prototype.writeHeader=function(e){this.size+=4,h.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},h.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},h.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},h.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},h.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},h.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},h.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&h.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&h.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&h.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&h.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[r]instanceof h.Box||t[r]instanceof h.Box||void 0===e[r]||void 0===t[r]||"function"==typeof e[r]||"function"==typeof t[r]||e.subBoxNames&&e.subBoxNames.indexOf(r.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(r.slice(0,4))>-1||"data"===r||"start"===r||"size"===r||"creation_time"===r||"modification_time"===r||h.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(r)>-1||e[r]===t[r]))return!1;return!0},h.boxEqual=function(e,t){if(!h.boxEqualFields(e,t))return!1;for(var r=0;r1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},g.prototype.setExtractionOptions=function(e,t,r){var i=this.getTrackById(e);if(i){var n={};this.extractedTracks.push(n),n.id=e,n.user=t,n.trak=i,i.nextSample=0,n.nb_samples=1e3,n.samples=[],r&&r.nbSamples&&(n.nb_samples=r.nbSamples)}},g.prototype.unsetExtractionOptions=function(e){for(var t=-1,r=0;r-1&&this.extractedTracks.splice(t,1)},g.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=h.parseOneBox(this.stream,false)).code===h.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var r;switch(r="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),r){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[r]&&a.warn("ISOFile","Duplicate Box of type: "+r+", overriding previous occurrence"),this[r]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},g.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(a.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(a.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(a.warn("ISOFile","Not ready to start parsing"),!1))},g.prototype.appendBuffer=function(e,t){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(a.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),r},g.prototype.getInfo=function(){var e,t,r,i,n,s,a={},o=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(a.hasMoov=!0,a.duration=this.moov.mvhd.duration,a.timescale=this.moov.mvhd.timescale,a.isFragmented=null!=this.moov.mvex,a.isFragmented&&this.moov.mvex.mehd&&(a.fragment_duration=this.moov.mvex.mehd.fragment_duration),a.isProgressive=this.isProgressive,a.hasIOD=null!=this.moov.iods,a.brands=[],a.brands.push(this.ftyp.major_brand),a.brands=a.brands.concat(this.ftyp.compatible_brands),a.created=new Date(o+1e3*this.moov.mvhd.creation_time),a.modified=new Date(o+1e3*this.moov.mvhd.modification_time),a.tracks=[],a.audioTracks=[],a.videoTracks=[],a.subtitleTracks=[],a.metadataTracks=[],a.hintTracks=[],a.otherTracks=[],e=0;e0?a.mime+='video/mp4; codecs="':a.audioTracks&&a.audioTracks.length>0?a.mime+='audio/mp4; codecs="':a.mime+='application/mp4; codecs="',e=0;e=r.samples.length)&&(a.info("ISOFile","Sending fragmented data on track #"+i.id+" for samples ["+Math.max(0,r.nextSample-i.nb_samples)+","+(r.nextSample-1)+"]"),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(i.id,i.user,i.segmentStream.buffer,r.nextSample,e||r.nextSample>=r.samples.length),i.segmentStream=null,i!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=r.samples.length)&&(a.debug("ISOFile","Sending samples on track #"+s.id+" for sample "+r.nextSample),this.onSamples&&this.onSamples(s.id,s.user,s.samples),s.samples=[],s!==this.extractedTracks[t]))break}}}},g.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},g.prototype.getBoxes=function(e,t){var r=[];return g._sweep.call(this,e,r,t),r},g._sweep=function(e,t,r){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&r)return;g._sweep.call(this.boxes[i],e,t,r)}},g.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},g.prototype.getTrackSample=function(e,t){var r=this.getTrackById(e);return this.getSample(r,t)},g.prototype.releaseUsedSamples=function(e,t,r){var i=0,n=this.getTrackById(e);n.lastValidSample||(n.lastValidSample=0);for(var s=n.lastValidSample;se*n.timescale){l=i-1;break}t&&n.is_sync&&(d=i)}for(t&&(l=d),e=r.samples[l].cts,r.nextSample=l;r.samples[l].alreadyRead===r.samples[l].size&&r.samples[l+1];)l++;return s=r.samples[l].offset+r.samples[l].alreadyRead,a.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+a.getDurationString(e,o)+" and offset: "+s),{offset:s,time:e/o}},g.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},g.prototype.seek=function(e,t){var r,i,n,s=this.moov,o={offset:1/0,time:1/0};if(this.moov){for(n=0;nthis.getTrackDuration(r)||((i=this.seekTrack(e,t,r)).offset-1){a=d;break}switch(a){case"Visual":if(n.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),s.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var u=new h.avcCBox;u.parse(new o(t.avcDecoderConfigRecord)),s.addBox(u)}else if(t.hevcDecoderConfigRecord){var f=new h.hvcCBox;f.parse(new o(t.hevcDecoderConfigRecord)),s.addBox(f)}break;case"Audio":n.add("smhd").set("balance",t.balance||0),s.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":n.add("hmhd");break;case"Subtitle":if(n.add("sthd"),"stpp"===t.type)s.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:n.add("nmhd")}t.description&&s.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){s.addBox(e)})),n.add("dinf").add("dref").addEntry((new h["url Box"]).set("flags",1));var p=n.add("stbl");return p.add("stsd").addEntry(s),p.add("stts").set("sample_counts",[]).set("sample_deltas",[]),p.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),p.add("stco").set("chunk_offsets",[]),p.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(r),t.id}},h.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},g.prototype.addSample=function(e,t,r){var i=r||{},n={},s=this.getTrackById(e);if(null!==s){n.number=s.samples.length,n.track_id=s.tkhd.track_id,n.timescale=s.mdia.mdhd.timescale,n.description_index=i.sample_description_index?i.sample_description_index-1:0,n.description=s.mdia.minf.stbl.stsd.entries[n.description_index],n.data=t,n.size=t.byteLength,n.alreadyRead=n.size,n.duration=i.duration||1,n.cts=i.cts||0,n.dts=i.dts||0,n.is_sync=i.is_sync||!1,n.is_leading=i.is_leading||0,n.depends_on=i.depends_on||0,n.is_depended_on=i.is_depended_on||0,n.has_redundancy=i.has_redundancy||0,n.degradation_priority=i.degradation_priority||0,n.offset=0,n.subsamples=i.subsamples,s.samples.push(n),s.samples_size+=n.size,s.samples_duration+=n.duration,void 0===s.first_dts&&(s.first_dts=i.dts),this.processSamples();var a=this.createSingleSampleMoof(n);return this.addBox(a),a.computeSize(),a.trafs[0].truns[0].data_offset=a.size+8,this.add("mdat").data=new Uint8Array(t),n}},g.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var r=new h.moofBox;r.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var i=r.add("traf"),n=this.getTrackById(e.track_id);return i.add("tfhd").set("track_id",e.track_id).set("flags",h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),i.add("tfdt").set("baseMediaDecodeTime",e.dts-(n.first_dts||0)),i.add("trun").set("flags",h.TRUN_FLAGS_DATA_OFFSET|h.TRUN_FLAGS_DURATION|h.TRUN_FLAGS_SIZE|h.TRUN_FLAGS_FLAGS|h.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),r},g.prototype.lastMoofIndex=0,g.prototype.samplesDataSize=0,g.prototype.resetTables=function(){var e,t,r,i,n,s;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(d=n[a].grouping_type+"/0",(o=new l(n[a].grouping_type,0)).is_fragment=!0,t.sample_groups_info[d]||(t.sample_groups_info[d]=o))}else for(a=0;a=2&&(d=i[a].grouping_type+"/0",o=new l(i[a].grouping_type,0),e.sample_groups_info[d]||(e.sample_groups_info[d]=o))},g.setSampleGroupProperties=function(e,t,r,i){var n,s;for(n in t.sample_groups=[],i){var a;if(t.sample_groups[n]={},t.sample_groups[n].grouping_type=i[n].grouping_type,t.sample_groups[n].grouping_type_parameter=i[n].grouping_type_parameter,r>=i[n].last_sample_in_run&&(i[n].last_sample_in_run<0&&(i[n].last_sample_in_run=0),i[n].entry_index++,i[n].entry_index<=i[n].sbgp.entries.length-1&&(i[n].last_sample_in_run+=i[n].sbgp.entries[i[n].entry_index].sample_count)),i[n].entry_index<=i[n].sbgp.entries.length-1?t.sample_groups[n].group_description_index=i[n].sbgp.entries[i[n].entry_index].group_description_index:t.sample_groups[n].group_description_index=-1,0!==t.sample_groups[n].group_description_index)a=i[n].fragment_description?i[n].fragment_description:i[n].description,t.sample_groups[n].group_description_index>0?(s=t.sample_groups[n].group_description_index>65535?(t.sample_groups[n].group_description_index>>16)-1:t.sample_groups[n].group_description_index-1,a&&s>=0&&(t.sample_groups[n].description=a.entries[s])):a&&a.version>=2&&a.default_group_description_index>0&&(t.sample_groups[n].description=a.entries[a.default_group_description_index-1])}},g.process_sdtp=function(e,t,r){t&&(e?(t.is_leading=e.is_leading[r],t.depends_on=e.sample_depends_on[r],t.is_depended_on=e.sample_is_depended_on[r],t.has_redundancy=e.sample_has_redundancy[r]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},g.prototype.buildSampleLists=function(){var e,t;for(e=0;ev&&(b++,v<0&&(v=0),v+=s.sample_counts[b]),t>0?(e.samples[t-1].duration=s.sample_deltas[b],e.samples_duration+=e.samples[t-1].duration,x.dts=e.samples[t-1].dts+e.samples[t-1].duration):x.dts=0,a?(t>=w&&(S++,w<0&&(w=0),w+=a.sample_counts[S]),x.cts=e.samples[t].dts+a.sample_offsets[S]):x.cts=x.dts,o?(t==o.sample_numbers[E]-1?(x.is_sync=!0,E++):(x.is_sync=!1,x.degradation_priority=0),l&&l.entries[A].sample_delta+U==t+1&&(x.subsamples=l.entries[A].subsamples,U+=l.entries[A].sample_delta,A++)):x.is_sync=!0,g.process_sdtp(e.mdia.minf.stbl.sdtp,x,x.number),x.degradation_priority=h?h.priority[t]:0,l&&l.entries[A].sample_delta+U==t&&(x.subsamples=l.entries[A].subsamples,U+=l.entries[A].sample_delta),(c.length>0||u.length>0)&&g.setSampleGroupProperties(e,x,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},g.prototype.updateSampleLists=function(){var e,t,r,i,n,s,a,o,d,l,c,u,f,p,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&g.initSampleGroups(u,c,c.sbgps,u.mdia.minf.stbl.sgpds,c.sgpds),t=0;t0?p.dts=u.samples[u.samples.length-2].dts+u.samples[u.samples.length-2].duration:(c.tfdt?p.dts=c.tfdt.baseMediaDecodeTime:p.dts=0,u.first_traf_merged=!0),p.cts=p.dts,_.flags&h.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+_.sample_composition_time_offset[r]),m=a,_.flags&h.TRUN_FLAGS_FLAGS?m=_.sample_flags[r]:0===r&&_.flags&h.TRUN_FLAGS_FIRST_FLAG&&(m=_.first_sample_flags),p.is_sync=!(m>>16&1),p.is_leading=m>>26&3,p.depends_on=m>>24&3,p.is_depended_on=m>>22&3,p.has_redundancy=m>>20&3,p.degradation_priority=65535&m;var y=!!(c.tfhd.flags&h.TFHD_FLAG_BASE_DATA_OFFSET),v=!!(c.tfhd.flags&h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),b=!!(_.flags&h.TRUN_FLAGS_DATA_OFFSET),w=0;w=y?c.tfhd.base_data_offset:v||0===t?l.start:o,p.offset=0===t&&0===r?b?w+_.data_offset:w:o,o=p.offset+p.size,(c.sbgps.length>0||c.sgpds.length>0||u.mdia.minf.stbl.sbgps.length>0||u.mdia.minf.stbl.sgpds.length>0)&&g.setSampleGroupProperties(u,p,p.number_in_traf,c.sample_groups_info)}}if(c.subs){u.has_fragment_subsamples=!0;var S=c.first_sample_index;for(t=0;t-1))return null;var s=(r=this.stream.buffers[n]).byteLength-(i.offset+i.alreadyRead-r.fileStart);if(i.size-i.alreadyRead<=s)return a.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+(i.size-i.alreadyRead)+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,i.size-i.alreadyRead),r.usedBytes+=i.size-i.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead=i.size,i;if(0===s)return null;a.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+s+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,s),i.alreadyRead+=s,r.usedBytes+=s,this.stream.logBufferLevel()}},g.prototype.releaseSample=function(e,t){var r=e.samples[t];return r.data?(this.samplesDataSize-=r.size,r.data=null,r.description=null,delete r.degradation_priority,delete r.depends_on,delete r.description_index,delete r.has_redundancy,delete r.is_depended_on,delete r.is_leading,delete r.is_sync,delete r.moof_number,delete r.number_in_traf,delete r.timescale,delete r.cts,delete r.dts,delete r.offset,delete r.size,delete r.track_id,delete r.duration,r.alreadyRead=0,r.size):0},g.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},g.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},g.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(r.protection=s.ipro.protections[s.iinf.item_infos[e].protection_index-1]),s.iinf.item_infos[e].item_type?r.type=s.iinf.item_infos[e].item_type:r.type="mime",r.content_type=s.iinf.item_infos[e].content_type,r.content_encoding=s.iinf.item_infos[e].content_encoding;if(s.grpl)for(e=0;e0&&h.property_index-1-1))return null;var o=(t=this.stream.buffers[s]).byteLength-(n.offset+n.alreadyRead-t.fileStart);if(!(n.length-n.alreadyRead<=o))return a.debug("ISOFile","Getting item #"+e+" extent #"+i+" partial data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+o+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,o),n.alreadyRead+=o,r.alreadyRead+=o,t.usedBytes+=o,this.stream.logBufferLevel(),null;a.debug("ISOFile","Getting item #"+e+" extent #"+i+" data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+(n.length-n.alreadyRead)+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,n.length-n.alreadyRead),t.usedBytes+=n.length-n.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead+=n.length-n.alreadyRead,n.alreadyRead=n.length}}return r.alreadyRead===r.size?r:null},g.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var r=0;r0?this.moov.traks[e].samples[0].duration:0),t.push(i)}return t},g.prototype.getPerformanceInfo=function(){var e={};return e.moov=this.moov,this.moov&&this.moov.traks&&this.moov.traks.length>1&&(e.moovAudioNum=this.moov.traks[0].samples.length,e.moovVideoNum=this.moov.traks[1].samples.length),e},h.Box.prototype.printHeader=function(e){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},h.FullBox.prototype.printHeader=function(e){this.size+=4,h.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},h.Box.prototype.print=function(e){this.printHeader(e)},h.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},h.tkhdBox.prototype.print=function(e){h.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var y={createFile:function(e,t){var r=void 0===e||e,i=new g(t);return i.discardMdatData=!r,i}};t.createFile=y.createFile}));function Oi(e){return e.reduce(((e,t)=>256*e+t))}function Gi(e){const t=[101,103,119,99],r=e.length-28,i=e.slice(r,r+t.length);return t.every(((e,t)=>e===i[t]))}Ni.Log,Ni.MP4BoxStream,Ni.DataStream,Ni.MultiBufferStream,Ni.MPEG4DescriptorParser,Ni.BoxParser,Ni.XMLSubtitlein4Parser,Ni.Textin4Parser,Ni.ISOFile,Ni.createFile;class Hi{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(r+32,r+32+t))]}return null}(t,this.t);if(!r)return e;const i=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(i instanceof Error)return console.error(i.message),this.d=!0,e;this.A=!0,this.u=r[1],Gi(t)&&this.c++,WebAssembly.instantiate(r[2],i).then((e=>{if("function"!=typeof(t=e.instance.exports).parse||"object"!=typeof t.memory)return this.d=!0,void console.error("video_error_3");var t;this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}function Wi(){for(var e=arguments.length,t=new Array(e),r=0;r{const r=new i((0|e.byteLength)+(0|t.byteLength));return r.set(e,0),r.set(t,0|e.byteLength),r}),new i)}const Vi=16,ji=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],qi=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Yi(e){const t=[];for(let r=0,i=e.length;r1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Xi(e){const t=[];for(let r=0,i=e.length;r>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}function Zi(e){const t=[];for(let r=0,i=e.length;r=240&&e[r]<=247?(t.push(String.fromCodePoint(((7&e[r])<<18)+((63&e[r+1])<<12)+((63&e[r+2])<<6)+(63&e[r+3]))),r+=3):e[r]>=224&&e[r]<=239?(t.push(String.fromCodePoint(((15&e[r])<<12)+((63&e[r+1])<<6)+(63&e[r+2]))),r+=2):e[r]>=192&&e[r]<=223?(t.push(String.fromCodePoint(((31&e[r])<<6)+(63&e[r+1]))),r++):t.push(String.fromCodePoint(e[r]));return t.join("")}function Ji(e,t){const r=31&t;return e<>>32-r}function Qi(e){return(255&ji[e>>>24&255])<<24|(255&ji[e>>>16&255])<<16|(255&ji[e>>>8&255])<<8|255&ji[255&e]}function en(e){return e^Ji(e,2)^Ji(e,10)^Ji(e,18)^Ji(e,24)}function tn(e){return e^Ji(e,13)^Ji(e,23)}function rn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[4*t],n[1]=255&e[4*t+1],n[2]=255&e[4*t+2],n[3]=255&e[4*t+3],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];for(let e,t=0;t<32;t+=4)e=i[1]^i[2]^i[3]^r[t+0],i[0]^=en(Qi(e)),e=i[2]^i[3]^i[0]^r[t+1],i[1]^=en(Qi(e)),e=i[3]^i[0]^i[1]^r[t+2],i[2]^=en(Qi(e)),e=i[0]^i[1]^i[2]^r[t+3],i[3]^=en(Qi(e));for(let e=0;e<16;e+=4)t[e]=i[3-e/4]>>>24&255,t[e+1]=i[3-e/4]>>>16&255,t[e+2]=i[3-e/4]>>>8&255,t[e+3]=255&i[3-e/4]}function nn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[0+4*t],n[1]=255&e[1+4*t],n[2]=255&e[2+4*t],n[3]=255&e[3+4*t],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let e,r=0;r<32;r+=4)e=i[1]^i[2]^i[3]^qi[r+0],t[r+0]=i[0]^=tn(Qi(e)),e=i[2]^i[3]^i[0]^qi[r+1],t[r+1]=i[1]^=tn(Qi(e)),e=i[3]^i[0]^i[1]^qi[r+2],t[r+2]=i[2]^=tn(Qi(e)),e=i[0]^i[1]^i[2]^qi[r+3],t[r+3]=i[3]^=tn(Qi(e));if(0===r)for(let e,r=0;r<16;r++)e=t[r],t[r]=t[31-r],t[31-r]=e}function sn(e,t,r){let{padding:i="pkcs#7",mode:n,iv:s=[],output:a="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===n&&("string"==typeof s&&(s=Yi(s)),16!==s.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=Yi(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==r?Xi(e):Yi(e):[...e],("pkcs#5"===i||"pkcs#7"===i)&&0!==r){const t=Vi-e.length%Vi;for(let r=0;r=Vi;){const t=e.slice(u,u+16),i=new Array(16);if("cbc"===n)for(let e=0;e2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let s=new Uint8Array(e.slice(0,5)),a=5;for(;an){const t=new Uint8Array(s.length+e.length-a);t.set(s,0),t.set(e.slice(a),s.length),s=t;break}let l=e[a+4],c=!1,u=2;if(r?(i&&(u=3),l=l>>>1&63,c=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(l)):(l&=31,c=1===l||5===l),c){const r=sn(e.slice(a+4+u,a+4+d),t,0,{padding:"none",output:"array"});let i=r[r.length-1];if(i>0&&i<16){let e=!0;for(let t=1;t<=i;t++)if(r[r.length-t]!==i){e=!1;break}e&&r.splice(r.length-i,i)}const n=new Uint8Array(u);n.set(e.slice(a+4,a+4+u),0);const o=tr(Wi(n,new Uint8Array(r))),l=new Uint8Array(s.length+o.length);l.set(s,0),l.set(o,s.length),s=l}else{const t=e.slice(a+4,a+4+d),r=new Uint8Array(s.length+4+t.length);r.set(s,0),r.set(o,s.length),r.set(t,s.length+4),s=r}a=a+4+d}return s}const dn={init:0,findFirstStartCode:1,findSecondStartCode:2};class ln extends class{on(e,t,r){const i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:r}),this}once(e,t,r){const i=this;function n(){i.off(e,n);for(var s=arguments.length,a=new Array(s),o=0;o1?r-1:0),n=1;n{delete r[e]})),void delete this.e;const i=r[e],n=[];if(i&&t)for(let e=0,r=i.length;e=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=dn.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==dn.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=dn.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==dn.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=dn.findFirstStartCode}}}}function cn(e,t,r){for(let i=2;i3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let s=5;for(;sn)break;let o=e[s+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=cn(e.slice(s+4,s+4+a),t,r);e.set(i,s+4)}s=s+4+a}return e}function fn(){for(var e=arguments.length,t=new Array(e),r=0;re+t.byteLength),0));let n=0;return t.forEach((e=>{i.set(e,n),n+=e.byteLength})),i}class pn{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,r,i)));e.addEventListener(t,r,i);const n=()=>{lr(e.removeEventListener)&&e.removeEventListener(t,r,i)};return this.destroys.push(n),n}destroy(){this.master.debugLog("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class mn{static init(){mn.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in mn.types)mn.types.hasOwnProperty(e)&&(mn.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=mn.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,r=null,i=Array.prototype.slice.call(arguments,1),n=i.length;for(let e=0;e>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r.set(e,4);let s=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return mn.box(mn.types.trak,mn.tkhd(e),mn.mdia(e))}static tkhd(e){let t=e.id,r=e.duration,i=e.presentWidth,n=e.presentHeight;return mn.box(mn.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>>8&255,255&i,0,0,n>>>8&255,255&n,0,0]))}static mdia(e){return mn.box(mn.types.mdia,mn.mdhd(e),mn.hdlr(e),mn.minf(e))}static mdhd(e){let t=e.timescale,r=e.duration;return mn.box(mn.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?mn.constants.HDLR_AUDIO:mn.constants.HDLR_VIDEO,mn.box(mn.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?mn.box(mn.types.smhd,mn.constants.SMHD):mn.box(mn.types.vmhd,mn.constants.VMHD),mn.box(mn.types.minf,t,mn.dinf(),mn.stbl(e))}static dinf(){return mn.box(mn.types.dinf,mn.box(mn.types.dref,mn.constants.DREF))}static stbl(e){return mn.box(mn.types.stbl,mn.stsd(e),mn.box(mn.types.stts,mn.constants.STTS),mn.box(mn.types.stsc,mn.constants.STSC),mn.box(mn.types.stsz,mn.constants.STSZ),mn.box(mn.types.stco,mn.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.mp3(e)):mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.mp4a(e)):"avc"===e.videoType?mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.avc1(e)):mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.hvc1(e))}static mp3(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return mn.box(mn.types[".mp3"],i)}static mp4a(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return mn.box(mn.types.mp4a,i,mn.esds(e))}static esds(e){let t=e.config||[],r=t.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(t).concat([6,1,2]));return mn.box(mn.types.esds,i)}static avc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return mn.box(mn.types.avc1,n,mn.box(mn.types.avcC,t))}static hvc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return mn.box(mn.types.hvc1,n,mn.box(mn.types.hvcC,t))}static mvex(e){return mn.box(mn.types.mvex,mn.trex(e))}static trex(e){let t=e.id,r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return mn.box(mn.types.trex,r)}static moof(e,t){return mn.box(mn.types.moof,mn.mfhd(e.sequenceNumber),mn.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return mn.box(mn.types.mfhd,t)}static traf(e,t){let r=e.id,i=mn.box(mn.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),n=mn.box(mn.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),s=mn.sdtp(e),a=mn.trun(e,s.byteLength+16+16+8+16+8+8);return mn.box(mn.types.traf,i,n,a,s)}static sdtp(e){let t=new Uint8Array(5),r=e.flags;return t[4]=r.isLeading<<6|r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy,mn.box(mn.types.sdtp,t)}static trun(e,t){let r=new Uint8Array(28);t+=36,r.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let i=e.duration,n=e.size,s=e.flags,a=e.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12),mn.box(mn.types.trun,r)}static mdat(e){return mn.box(mn.types.mdat,e)}}mn.init();var _n,gn=Ot((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}));(_n=gn)&&_n.__esModule&&Object.prototype.hasOwnProperty.call(_n,"default")&&_n.default;const yn=[44100,48e3,32e3,0],vn=[22050,24e3,16e3,0],bn=[11025,12e3,8e3,0],wn=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],Sn=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],En=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];function An(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),r=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let i=t[1]>>>3&3,n=(6&t[1])>>1,s=(240&t[2])>>>4,a=(12&t[2])>>>2,o=3!==(t[3]>>>6&3)?2:1,d=0,l=0;switch(i){case 0:d=bn[a];break;case 2:d=vn[a];break;case 3:d=yn[a]}switch(n){case 1:s=e[n]&&t=6?(i=5,t=new Array(4),a=n-3):(i=2,t=new Array(2),a=n):-1!==o.indexOf("android")?(i=2,t=new Array(2),a=n):(i=5,a=n,t=new Array(4),n>=6?a=n-3:1===s&&(i=2,t=new Array(2),a=n)),t[0]=i<<3,t[0]|=(15&n)>>>1,t[1]=(15&n)<<7,t[1]|=(15&s)<<3,5===i&&(t[1]|=(15&a)>>>1,t[2]=(1&a)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=$n[n],this.sampling_index=n,this.channel_count=s,this.object_type=i,this.original_object_type=r,this.codec_mimetype="mp4a.40."+i,this.original_codec_mimetype="mp4a.40."+r}}class Gn{constructor(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}get bitsAvailable(){return this.bitLength-this.index}skipBits(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}getBits(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>i,s=8-i;if(s>=e)return r&&(this.index+=e),n>>s-e;{r&&(this.index+=s);const i=e-s;return n<>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}function Hn(e){return e[3]|e[2]<<8|e[1]<<16|e[0]<<24}const Wn=new Array(214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72),Vn=new Array(2746333894,1453994832,1736282519,2993693404),jn=new Array(462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257);function qn(e,t,r,i,n){var s=n;s=t+n>e.length&&i+n<=r.length?e.length-t:i+n>r.length&&t+n<=e.length?r.length-i:t+n<=e.length&&i+n<=r.length?n:r.length>24&255,e>>16&255,e>>8&255,255&e)}function Kn(e,t){return t+3>>19)^(i<<23|i>>>9)}function Jn(e,t){var r=new Array(36);r[0]=Kn(t,0),r[1]=Kn(t,4),r[2]=Kn(t,8),r[3]=Kn(t,12);for(var i=0;i<32;i++)r[i+4]=r[i]^Qn(r[i+1]^r[i+2]^r[i+3]^e[i]);var n=new Array(4);for(i=35;i>=32;i--)n[35-i]=r[i];var s=function(e){for(var t=new Array(4*e.length),r=0;r>>30)^(i<<10|i>>>22)^(i<<18|i>>>14)^(i<<24|i>>>8)}function es(e,t,r){if(null==e||null==e||e.length%16!=0)return console.log("sm4 key is error!"),null;if(null==r||null==r||r.length<=0)return console.log("cipher is error!"),null;if(null==t||null==t||t.length%16!=0)return console.log("iv is error!"),null;for(var i=Xn(e),n=Math.ceil(r.length/16),s=new Array(r.length),a=t.slice(),o=0;o3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t=new Uint8Array(t),r=new Uint8Array(r);const s=e.byteLength;let a=5;for(;as)break;let d=e[a+4],l=!1,c=2;if(i?(n&&(c=3),d=d>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(d)):(d&=31,l=1===d||5===d),l){const i=es(t,r,e.slice(a+4+c,a+4+o));e.set(i,a+4+c)}a=a+4+o}return e}Date.now||(Date.now=function(){return(new Date).getTime()});const rs=[];rs.push(a({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support")&&-1===e.indexOf("illegal icc")&&!e.indexOf("If you want to help, upload a sample of this file to")&&!e.indexOf("Reserved SBR extensions is not implemented"))})(e)||console.warn("JbPro[❌❌❌][worker]:",e)}}),s({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support, using thread emulation"))})(e)||console.warn("JbPro[❌❌❌][worker]:",e)}})),Promise.all(rs).then((e=>{const t=e[0];!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[],n=[],s=null,a=null,o=null,d=null,l=null,c=null,u=!1,h=null,f=null,S=!1,E=!1,B=!!gr(r),Se=0,Ee=0,je=!1,Je=null,Qe=null,tt=null,it=[],ut=null,At=null,Ut=0,Tt=0,Nt=null,Ot=null,Gt=0,Ht=0,Wt=!1,Kt=!1,Qt=!1,sr=null,wr=null,Sr=!1,Er=!0,Ar=()=>{const e=mr();return{debug:e.debug,debugLevel:e.debugLevel,debugUuid:e.debugUuid,useOffscreen:e.useOffscreen,useWCS:e.useWCS,useMSE:e.useMSE,videoBuffer:e.videoBuffer,videoBufferDelay:e.videoBufferDelay,openWebglAlignment:e.openWebglAlignment,playType:e.playType,hasAudio:e.hasAudio,hasVideo:e.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:e.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:e.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:0,networkDelay:e.networkDelay,visibility:!0,useSIMD:e.useSIMD,isRecording:!1,recordType:e.recordType,isNakedFlow:e.isNakedFlow,checkFirstIFrame:e.checkFirstIFrame,audioBufferSize:1024,isM7sCrypto:e.isM7sCrypto,m7sCryptoAudio:e.m7sCryptoAudio,cryptoKey:e.cryptoKey,cryptoIV:e.cryptoIV,isSm4Crypto:e.isSm4Crypto,isSm4CryptoH265V2:e.isSm4CryptoH265V2,sm4CryptoKey:e.sm4CryptoKey,isXorCrypto:e.isXorCrypto,isHls265:!1,isFlv:e.isFlv,isFmp4:e.isFmp4,isMpeg4:e.isMpeg4,isTs:e.isTs,isFmp4Private:e.isFmp4Private,isEmitSEI:e.isEmitSEI,isRecordTypeFlv:!1,isWasmMp4:!1,isChrome:!1,isFirefox:!1,isDropSameTimestampGop:e.isDropSameTimestampGop,mseDecodeAudio:e.mseDecodeAudio,wcsDecodeAudio:e.wcsDecodeAudio,nakedFlowH265DemuxUseNew:e.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:e.mseDecoderUseWorker,mseAutoCleanupSourceBuffer:e.mseAutoCleanupSourceBuffer,mseAutoCleanupMaxBackwardDuration:e.mseAutoCleanupMaxBackwardDuration,mseAutoCleanupMinBackwardDuration:e.mseAutoCleanupMinBackwardDuration,mseCorrectTimeDuration:e.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:e.mseCorrectAudioTimeDuration,nakedFlowDemuxUseNew:e.nakedFlowDemuxUseNew,nakedFlowFps:e.nakedFlowFps,supportMSEDecodeHevc:!1}};"VideoEncoder"in self&&(s={hasInit:!1,isEmitInfo:!1,offscreenCanvas:null,offscreenCanvasCtx:null,decoder:null,init(){s.decoder=new VideoDecoder({output:function(e){if(lr(e.createImageBitmap))e.createImageBitmap().then((t=>{s.offscreenCanvasCtx.drawImage(t,0,0,e.codedWidth,e.codedHeight);let r=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:r,delay:si.delay,ts:0},[r]),hr(e)}));else{s.offscreenCanvasCtx.drawImage(e,0,0,e.codedWidth,e.codedHeight);let t=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:t,delay:si.delay,ts:0},[t]),hr(e)}},error:function(e){si.debugError("worker","VideoDecoder error: ",e,e.toString())}})},destroy(){s.reset(),s.decoder&&"closed"!==s.decoder.state&&(s.decoder.close(),s.decoder=null)},decode:function(e,t,r){const i=e[0]>>4==1;if(s.hasInit){const r=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:i?pt:mt});s.decoder.decode(r)}else if(i&&0===e[1]){const t=15&e[0];postMessage({cmd:R,code:t});const r=new Uint8Array(e);postMessage({cmd:M,buffer:r,codecId:t},[r.buffer]);let i=null,n=null;const a=e.slice(5);t===Fe?(n=kr(a),i={codec:n.codec,description:a}):t===Re&&(n=Vr(a),i={codec:n.codec,description:a}),n&&n.codecWidth&&n.codecHeight&&(i.codedHeight=n.codecHeight,i.codedWidth=n.codecWidth),s.isEmitInfo||(si.debugLog("worker","Webcodecs Video Decoder initSize"),postMessage({cmd:k,w:n.codecWidth,h:n.codecHeight}),s.isEmitInfo=!0,s.offscreenCanvas=new OffscreenCanvas(n.codecWidth,n.codecHeight),s.offscreenCanvasCtx=s.offscreenCanvas.getContext("2d"));try{s.decoder.configure(i),s.hasInit=!0}catch(e){si.debugError("worker","VideoDecoder configure error",e.code,e,e.toString()),e.toString()}}else si.debugWarn("worker",`VideoDecoder configure has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)},reset(){s.hasInit=!1,s.isEmitInfo=!1,s.offscreenCanvas=null,s.offscreenCanvasCtx=null}});let Tr=function(){if(Sr=!0,a)try{a.abort(),a=null,si.debugLog("worker","abort success")}catch(e){a=null,si.debugLog("worker","abort catch",e)}},Or={init(){Or.lastBuf=null,Or.vps=null,Or.sps=null,Or.pps=null,Or.streamType=null,Or.localDts=0,Or.pendingUnits={},Or.isSendSeqHeader=!1},destroy(){Or.lastBuf=null,Or.vps=null,Or.sps=null,Or.pps=null,Or.streamType=null,Or.localDts=0,Or.pendingUnits={},Or.isSendSeqHeader=!1},dispatch(e){const t=new Uint8Array(e);if(si._opt.nakedFlowDemuxUseNew){const e=Or.extractNALu$3(t);if(0===e.length)return void si.debugLog("worker","dispatch naluArray length is 0");Or.handleVideoFrames(e)}else Or.extractNALu$2(t)},getNaluDts(){const e=si._opt.nakedFlowFps;let t=Or.localDts;return Or.localDts=Or.localDts+parseInt(1e3/e,10),t},getNaluAudioDts(){const e=si._opt.sampleRate,t=si._opt.audioBufferSize;return Or.localDts+parseInt(t/e*1e3)},extractNALu(e){let t,r,i=0,n=e.byteLength,s=0,a=[];for(;i1)for(let e=0;e{const t=Ir(e);t===Ve||t===We?Or.handleVideoH264Nalu(e):Rr(t)&&i.push(e)})),1===i.length)Or.handleVideoH264Nalu(i[0]);else if(zr(i)){const e=Ir(i[0]),t=Mr(e);Or.handleVideoH264NaluList(i,t,e)}else i.forEach((e=>{Or.handleVideoH264Nalu(e)}))}else if(Or.streamType===$e)if(si._opt.nakedFlowH265DemuxUseNew){const t=Or.handleAddNaluStartCode(e),r=Or.extractNALu(t);if(0===r.length)return void si.debugWarn("worker","handleVideoNalu","h265 naluList.length === 0");const i=[];if(r.forEach((e=>{const t=Xr(e);t===lt||t===ot||t===st?Or.handleVideoH265Nalu(e):Jr(t)&&i.push(e)})),1===i.length)Or.handleVideoH265Nalu(i[0]);else if(ei(i)){const e=Xr(i[0]),t=Qr(e);Or.handleVideoH265NaluList(i,t,e)}else i.forEach((e=>{Or.handleVideoH265Nalu(e)}))}else Xr(e)===lt?Or.extractH265PPS(e):Or.handleVideoH265Nalu(e)},extractH264PPS(e){const t=Or.handleAddNaluStartCode(e);Or.extractNALu(t).forEach((e=>{Fr(Ir(e))?Or.extractH264SEI(e):Or.handleVideoH264Nalu(e)}))},extractH265PPS(e){const t=Or.handleAddNaluStartCode(e);Or.extractNALu(t).forEach((e=>{Zr(Xr(e))?Or.extractH265SEI(e):Or.handleVideoH265Nalu(e)}))},extractH264SEI(e){const t=Or.handleAddNaluStartCode(e);Or.extractNALu(t).forEach((e=>{Or.handleVideoH264Nalu(e)}))},extractH265SEI(e){const t=Or.handleAddNaluStartCode(e);Or.extractNALu(t).forEach((e=>{Or.handleVideoH265Nalu(e)}))},handleAddNaluStartCode(e){const t=[0,0,0,1],r=new Uint8Array(e.length+t.length);return r.set(t),r.set(e,t.length),r},handleVideoH264Nalu(e){const t=Ir(e);switch(t){case We:Or.sps=e;break;case Ve:Or.pps=e}if(Or.isSendSeqHeader){if(Or.sps&&Or.pps){const e=Cr({sps:Or.sps,pps:Or.pps}),t=Or.localDts;si.decode(e,{type:oe,ts:t,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null}if(Rr(t)){const r=Mr(t),i=Or.getNaluDts(),n=Pr(e,r);Or.doDecode(n,{type:oe,ts:i,isIFrame:r,cts:0})}}else if(Or.sps&&Or.pps){Or.isSendSeqHeader=!0;const e=Cr({sps:Or.sps,pps:Or.pps});si.decode(e,{type:oe,ts:0,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null}},handleVideoH264NaluList(e,t,r){if(Or.isSendSeqHeader){const i=Or.getNaluDts(),n=Lr(e.reduce(((e,t)=>{const r=tr(e),i=tr(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);Or.doDecode(n,{type:oe,ts:i,isIFrame:t,cts:0}),si.debugLog("worker",`handleVideoH264NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},handleVideoH265Nalu(e){const t=Xr(e);switch(t){case st:Or.vps=e;break;case ot:Or.sps=e;break;case lt:Or.pps=e}if(Or.isSendSeqHeader){if(Or.vps&&Or.sps&&Or.pps){const e=qr({vps:Or.vps,sps:Or.sps,pps:Or.pps}),t=Or.localDts;si.decode(e,{type:oe,ts:t,isIFrame:!0,cts:0}),Or.vps=null,Or.sps=null,Or.pps=null}if(Jr(t)){const r=Qr(t),i=Or.getNaluDts(),n=Yr(e,r);Or.doDecode(n,{type:oe,ts:i,isIFrame:r,cts:0})}}else if(Or.vps&&Or.sps&&Or.pps){Or.isSendSeqHeader=!0;const e=qr({vps:Or.vps,sps:Or.sps,pps:Or.pps});si.decode(e,{type:oe,ts:0,isIFrame:!0,cts:0}),Or.vps=null,Or.sps=null,Or.pps=null}},handleVideoH265NaluList(e,t,r){if(Or.isSendSeqHeader){const i=Or.getNaluDts(),n=Kr(e.reduce(((e,t)=>{const r=tr(e),i=tr(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);Or.doDecode(n,{type:oe,ts:i,isIFrame:t,cts:0}),si.debugLog("worker",`handleVideoH265NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},doDecode(e,t){si.calcNetworkDelay(t.ts),t.isIFrame&&si.calcIframeIntervalTimestamp(t.ts),si.decode(e,t)},handleVideoFrames(e){if(!Or.streamVideoType)for(let t of e)if(Or.streamVideoType=cr(t),Or.streamVideoType)break;Or.streamVideoType?Or.streamVideoType===ze?Or.handleVideoH264Frames(e):this.streamVideoType===$e&&Or.handleVideoH265Frames(e):si.debugWarn("worker","handleVideoFrames","streamVideoType is null")},handleVideoH264Frames(e){let t=[],r=[],i=!1,n=!1;Or.pendingUnits.units&&(t=Or.pendingUnits.units,n=Or.pendingUnits.vcl,i=Or.pendingUnits.iFrame,Or.pendingUnits={});let s={};for(let a of e){if(a.byteLength<4)continue;const e=Ir(a);let o=!1,d=e===Ye;e!==qe&&e!==Ye||(s=Or.parseVideo264Header(a),o=!0),t.length&&n&&(s.isfms||!o)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,n=!1),t.push(a),i=i||d,n=n||o}t.length&&(Or.pendingUnits={units:t,vcl:n,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,n=null;if(t.forEach((e=>{const t=31&e[0];switch(t){case Ve:Or.pps=e;break;case We:Or.sps=e;break;case Ke:n=e}if(Rr(t)){const t=tr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Or.isSendSeqHeader&&Or.sps&&Or.pps){Or.isSendSeqHeader=!0;const e=Dr({sps:Or.sps,pps:Or.pps});si.decode(e,{type:oe,ts:0,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null}if(Or.isSendSeqHeader){if(Or.sps&&Or.pps){const e=Dr({sps:Or.sps,pps:Or.pps}),t=Or.localDts;si.decode(e,{type:oe,ts:t,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null}if(i){const e=Or.getNaluDts(),t=Lr(i,r);si._opt.isEmitSEI&&n&&postMessage({cmd:Z,buffer:n,ts:e},[n.buffer]),Or.doDecode(t,{type:oe,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames(e){let t=[],r=[],i=!1,n=!1;Or.pendingUnits.units&&(t=Or.pendingUnits.units,n=Or.pendingUnits.vcl,i=Or.pendingUnits.iFrame,Or.pendingUnits={});let s={};for(let a of e){if(a.byteLength<4)continue;const e=Xr(a);let o=!1,d=Qr(e);Jr(e)&&(s=this.parseVideo265Header(a),o=!0),t.length&&n&&(s.isfms||!o)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,n=!1),t.push(a),i=i||d,n=n||o}t.length&&(Or.pendingUnits={units:t,vcl:n,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,n=null;if(t.forEach((e=>{const t=e[0]>>>1&63;switch(t){case lt:Or.pps=e;break;case ot:Or.sps=e;break;case st:Or.vps=e;break;case ft:case ht:n=e}if(Jr(t)){const t=tr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Or.isSendSeqHeader&&Or.sps&&Or.pps&&Or.vps){Or.isSendSeqHeader=!0;const e=qr({sps:Or.sps,pps:Or.pps,vps:Or.vps});si.decode(e,{type:oe,ts:0,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null,Or.vps=null}if(Or.isSendSeqHeader){if(Or.sps&&Or.pps&&Or.vps){const e=qr({sps:Or.sps,pps:Or.pps,vps:Or.vps}),t=Or.localDts;si.decode(e,{type:oe,ts:t,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null,Or.vps=null}if(i){const e=Or.getNaluDts(),t=Kr(i,r);si._opt.isEmitSEI&&n&&postMessage({cmd:Z,buffer:n,ts:e},[n.buffer]),Or.doDecode(t,{type:oe,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames_1(e){e.forEach((e=>{Or.handleVideoNalu(e)}))},parseVideo264Header(e){const t=new Gn(e);return t.readUByte(),{isfms:0===t.readUEG(),sType:t.readUEG()}},parseVideo265Header(e){const t=new Gn(e);return t.readUByte(),{nalType:t.readBits(6),isfms:0===t.readBits(1),sType:t.readBits(3)}}},Gr={LOG_NAME:"worker fmp4Demuxer",mp4Box:null,offset:0,videoTrackId:null,audioTrackId:null,isHevc:!1,listenMp4Box(){Gr.mp4Box=Ni.createFile(),Gr.mp4Box.onReady=Gr.onReady,Gr.mp4Box.onError=Gr.onError,Gr.mp4Box.onSamples=Gr.onSamples},initTransportDescarmber(){Gr.transportDescarmber=new Hi},_getSeqHeader(e){const t=Gr.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new Ni.DataStream(void 0,0,Ni.DataStream.BIG_ENDIAN);let r=[];e.avcC?(e.avcC.write(t),r=[23,0,0,0,0]):(Gr.isHevc=!0,si.isHevc=!0,e.hvcC.write(t),r=[28,0,0,0,0]);const i=new Uint8Array(t.buffer,8),n=new Uint8Array(r.length+i.length);return n.set(r,0),n.set(i,r.length),n}return null},onReady(e){si.debugLog(Gr.LOG_NAME,"onReady()");const t=e.videoTracks[0],r=e.audioTracks[0];if(t){Gr.videoTrackId=t.id;const e=Gr._getSeqHeader(t);e&&(si.debugLog(Gr.LOG_NAME,"seqHeader"),si.decodeVideo(e,0,!0,0)),Gr.mp4Box.setExtractionOptions(t.id)}if(r&&si._opt.hasAudio){Gr.audioTrackId=r.id;const e=r.audio||{},t=Vt.indexOf(e.sample_rate),i=r.codec.replace("mp4a.40.","");Gr.mp4Box.setExtractionOptions(r.id);const n=jt({profile:parseInt(i,10),sampleRate:t,channel:e.channel_count});si.debugLog(Gr.LOG_NAME,"aacADTSHeader"),si.decodeAudio(n,0)}Gr.mp4Box.start()},onError(e){si.debugError(Gr.LOG_NAME,"mp4Box onError",e)},onSamples(e,t,r){if(e===Gr.videoTrackId){for(const e of r){const t=e.data,r=e.is_sync,i=1e3*e.cts/e.timescale;e.duration,e.timescale,r&&si.calcIframeIntervalTimestamp(i);let n=null;n=Gr.isHevc?Kr(t,r):Lr(t,r),si.decode(n,{type:oe,ts:i,isIFrame:r,cts:0})}Gr.mp4Box.removeUsedSamples(e)}else if(e===Gr.audioTrackId){if(si._opt.hasAudio){for(const e of r){const t=e.data,r=1e3*e.cts/e.timescale;e.duration,e.timescale;const i=new Uint8Array(t.byteLength+2);i.set([175,1],0),i.set(t,2),si.decode(i,{type:ae,ts:r,isIFrame:!1,cts:0})}Gr.mp4Box.removeUsedSamples(e)}}else si.debugWarn(Gr.LOG_NAME,"onSamples() trackId error",e)},dispatch(e){let t=new Uint8Array(e);Gr.transportDescarmber&&(t=Gr.transportDescarmber.transport(t)),t.buffer.fileStart=Gr.offset,Gr.offset+=t.byteLength,Gr.mp4Box.appendBuffer(t.buffer)},destroy(){Gr.mp4Box&&(Gr.mp4Box.stop(),Gr.mp4Box.flush(),Gr.mp4Box.destroy(),Gr.mp4Box=null),Gr.transportDescarmber&&(Gr.transportDescarmber.destroy(),Gr.transportDescarmber=null),Gr.offset=0,Gr.videoTrackId=null,Gr.audioTrackId=null,Gr.isHevc=!1}},jr={LOG_NAME:"worker mpeg4Demuxer",lastBuffer:new Uint8Array(0),parsedOffset:0,firstStartCodeOffset:0,secondStartCodeOffset:0,state:"init",hasInitVideoCodec:!1,localDts:0,dispatch(e){const t=new Uint8Array(e);jr.extractNALu(t)},destroy(){jr.lastBuffer=new Uint8Array(0),jr.parsedOffset=0,jr.firstStartCodeOffset=0,jr.secondStartCodeOffset=0,jr.state="init",jr.hasInitVideoCodec=!1,jr.localDts=0},extractNALu(e){if(!e||e.byteLength<1)return void si.debugWarn(jr.LOG_NAME,"extractNALu() buffer error",e);const t=new Uint8Array(jr.lastBuffer.length+e.length);for(t.set(jr.lastBuffer,0),t.set(new Uint8Array(e),jr.lastBuffer.length),jr.lastBuffer=t;;){if("init"===jr.state){let e=!1;for(;jr.lastBuffer.length-jr.parsedOffset>=4;)if(0===jr.lastBuffer[jr.parsedOffset])if(0===jr.lastBuffer[jr.parsedOffset+1])if(1===jr.lastBuffer[jr.parsedOffset+2]){if(182===jr.lastBuffer[jr.parsedOffset+3]){jr.state="findFirstStartCode",jr.firstStartCodeOffset=jr.parsedOffset,jr.parsedOffset+=4,e=!0;break}jr.parsedOffset++}else jr.parsedOffset++;else jr.parsedOffset++;else jr.parsedOffset++;if(e)continue;break}if("findFirstStartCode"===jr.state){let e=!1;for(;jr.lastBuffer.length-jr.parsedOffset>=4;)if(0===jr.lastBuffer[jr.parsedOffset])if(0===jr.lastBuffer[jr.parsedOffset+1])if(1===jr.lastBuffer[jr.parsedOffset+2]){if(182===jr.lastBuffer[jr.parsedOffset+3]){jr.state="findSecondStartCode",jr.secondStartCodeOffset=jr.parsedOffset,jr.parsedOffset+=4,e=!0;break}jr.parsedOffset++}else jr.parsedOffset++;else jr.parsedOffset++;else jr.parsedOffset++;if(e)continue;break}if("findSecondStartCode"===jr.state){if(!(jr.lastBuffer.length-jr.parsedOffset>0))break;{let e,t,r=192&jr.lastBuffer[jr.parsedOffset];e=0==r?jr.secondStartCodeOffset-14:jr.secondStartCodeOffset;let i=0==(192&jr.lastBuffer[jr.firstStartCodeOffset+4]);if(i){if(jr.firstStartCodeOffset-14<0)return void si.debugWarn(jr.LOG_NAME,"firstStartCodeOffset -14 is",jr.firstStartCodeOffset-14);jr.hasInitVideoCodec||(jr.hasInitVideoCodec=!0,si.debugLog(jr.LOG_NAME,"setCodec"),oi.setCodec(Me,"")),t=jr.lastBuffer.subarray(jr.firstStartCodeOffset-14,e)}else t=jr.lastBuffer.subarray(jr.firstStartCodeOffset,e);let n=jr.getNaluDts();jr.hasInitVideoCodec?(postMessage({cmd:O,type:Be,value:t.byteLength}),postMessage({cmd:O,type:Te,value:n}),Se=n,oi.decode(t,i?1:0,n)):si.debugWarn(jr.LOG_NAME,"has not init video codec"),jr.lastBuffer=jr.lastBuffer.subarray(e),jr.firstStartCodeOffset=0==r?14:0,jr.parsedOffset=jr.firstStartCodeOffset+4,jr.state="findFirstStartCode"}}}},getNaluDts(){let e=jr.localDts;return jr.localDts=jr.localDts+40,e}},ii={TAG_NAME:"worker TsLoaderV2",first_parse_:!0,tsPacketSize:0,syncOffset:0,pmt_:null,config_:null,media_info_:new Nn,timescale_:90,duration_:0,pat_:{version_number:0,network_pid:0,program_map_pid:{}},current_program_:null,current_pmt_pid_:-1,program_pmt_map_:{},pes_slice_queues_:{},section_slice_queues_:{},video_metadata_:{vps:null,sps:null,pps:null,details:null},audio_metadata_:{codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},last_pcr_:null,audio_last_sample_pts_:void 0,aac_last_incomplete_data_:null,has_video_:!1,has_audio_:!1,video_init_segment_dispatched_:!1,audio_init_segment_dispatched_:!1,video_metadata_changed_:!1,audio_metadata_changed_:!1,loas_previous_frame:null,video_track_:{type:"video",id:1,sequenceNumber:0,samples:[],length:0},audio_track_:{type:"audio",id:2,sequenceNumber:0,samples:[],length:0},_remainingPacketData:null,init(){},destroy(){ii.media_info_=null,ii.pes_slice_queues_=null,ii.section_slice_queues_=null,ii.video_metadata_=null,ii.audio_metadata_=null,ii.aac_last_incomplete_data_=null,ii.video_track_=null,ii.audio_track_=null,ii._remainingPacketData=null},probe(e){let t=new Uint8Array(e),r=-1,i=188;if(t.byteLength<=3*i)return{needMoreData:!0};for(;-1===r;){let e=Math.min(1e3,t.byteLength-3*i);for(let n=0;n=4&&(r-=4),{match:!0,consumed:0,ts_packet_size:i,sync_offset:r})},_initPmt:()=>({program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}),dispatch(e){ii._remainingPacketData&&(e=fn(ii._remainingPacketData,e),ii._remainingPacketData=null);let t=e.buffer;const r=ii.parseChunks(t);r?ii._remainingPacketData=e.subarray(r):e.length>>6;r[1];let s=(31&r[1])<<8|r[2],a=(48&r[3])>>>4,o=15&r[3],d=!(!ii.pmt_||ii.pmt_.pcr_pid!==s),l={},c=4;if(2==a||3==a){let e=r[4];if(e>0&&(d||3==a)&&(l.discontinuity_indicator=(128&r[5])>>>7,l.random_access_indicator=(64&r[5])>>>6,l.elementary_stream_priority_indicator=(32&r[5])>>>5,(16&r[5])>>>4)){let e=300*(r[6]<<25|r[7]<<17|r[8]<<9|r[9]<<1|r[10]>>>7)+((1&r[10])<<8|r[11]);ii.last_pcr_=e}if(2==a||5+e===188){t+=188,204===ii.tsPacketSize&&(t+=16);continue}c=5+e}if(1==a||3==a)if(0===s||s===ii.current_pmt_pid_||null!=ii.pmt_&&ii.pmt_.pid_stream_type[s]===Ln){let r=188-c;ii.handleSectionSlice(e,t+c,r,{pid:s,payload_unit_start_indicator:n,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}else if(null!=ii.pmt_&&null!=ii.pmt_.pid_stream_type[s]){let r=188-c,i=ii.pmt_.pid_stream_type[s];s!==ii.pmt_.common_pids.h264&&s!==ii.pmt_.common_pids.h265&&s!==ii.pmt_.common_pids.adts_aac&&s!==ii.pmt_.common_pids.loas_aac&&s!==ii.pmt_.common_pids.ac3&&s!==ii.pmt_.common_pids.eac3&&s!==ii.pmt_.common_pids.opus&&s!==ii.pmt_.common_pids.mp3&&!0!==ii.pmt_.pes_private_data_pids[s]&&!0!==ii.pmt_.timed_id3_pids[s]&&!0!==ii.pmt_.synchronous_klv_pids[s]&&!0!==ii.pmt_.asynchronous_klv_pids[s]||ii.handlePESSlice(e,t+c,r,{pid:s,stream_type:i,payload_unit_start_indicator:n,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}t+=188,204===ii.tsPacketSize&&(t+=16)}return ii.dispatchAudioVideoMediaSegment(),t},handleSectionSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=ii.section_slice_queues_[i.pid];if(i.payload_unit_start_indicator){let a=n[0];if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t+1,Math.min(r,a));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?ii.emitSectionSlices(s,i):ii.clearSlices(s,i)}for(let o=1+a;o=s.expected_length&&ii.clearSlices(s,i),o+=d.byteLength}}else if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t,Math.min(r,s.expected_length-s.total_length));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?ii.emitSectionSlices(s,i):s.total_length>=s.expected_length&&ii.clearSlices(s,i)}},handlePESSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=n[0]<<16|n[1]<<8|n[2];n[3];let a=n[4]<<8|n[5];if(i.payload_unit_start_indicator){if(1!==s)return void si.debugWarn(ii.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${s}`);let e=ii.pes_slice_queues_[i.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?ii.emitPESSlices(e,i):ii.clearSlices(e,i)),ii.pes_slice_queues_[i.pid]=new Rn,ii.pes_slice_queues_[i.pid].random_access_indicator=i.random_access_indicator}if(null==ii.pes_slice_queues_[i.pid])return;let o=ii.pes_slice_queues_[i.pid];o.slices.push(n),i.payload_unit_start_indicator&&(o.expected_length=0===a?0:a+6),o.total_length+=n.byteLength,o.expected_length>0&&o.expected_length===o.total_length?ii.emitPESSlices(o,i):o.expected_length>0&&o.expected_length>>6,o=t[8];2!==a&&3!==a||(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,s=3===a?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:r);let d,l=9+o;if(0!==n){if(n<3+o)return void si.debugWarn(ii.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");d=n-3-o}else d=t.byteLength-l;let c=t.subarray(l,l+d);switch(e.stream_type){case Un:case xn:ii.parseMP3Payload(c,r);break;case Bn:ii.pmt_.common_pids.opus===e.pid||ii.pmt_.common_pids.ac3===e.pid||ii.pmt_.common_pids.eac3===e.pid||(ii.pmt_.asynchronous_klv_pids[e.pid]?ii.parseAsynchronousKLVMetadataPayload(c,e.pid,i):ii.pmt_.smpte2038_pids[e.pid]?ii.parseSMPTE2038MetadataPayload(c,r,s,e.pid,i):ii.parsePESPrivateDataPayload(c,r,s,e.pid,i));break;case Tn:ii.parseADTSAACPayload(c,r);break;case kn:ii.parseLOASAACPayload(c,r);break;case Cn:case Dn:break;case Pn:ii.pmt_.timed_id3_pids[e.pid]?ii.parseTimedID3MetadataPayload(c,r,s,e.pid,i):ii.pmt_.synchronous_klv_pids[e.pid]&&ii.parseSynchronousKLVMetadataPayload(c,r,s,e.pid,i);break;case In:ii.parseH264Payload(c,r,s,e.random_access_indicator);break;case Fn:ii.parseH265Payload(c,r,s,e.random_access_indicator)}}else if((188===i||191===i||240===i||241===i||255===i||242===i||248===i)&&e.stream_type===Bn){let r,s=6;r=0!==n?n:t.byteLength-s;let a=t.subarray(s,s+r);ii.parsePESPrivateDataPayload(a,void 0,void 0,e.pid,i)}}else si.debugError(ii.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${r}`)},parsePAT(e){let t=e[0];if(0!==t)return void Log.e(ii.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let r=(15&e[1])<<8|e[2];e[3],e[4];let i=(62&e[5])>>>1,n=1&e[5],s=e[6];e[7];let a=null;if(1===n&&0===s)a={version_number:0,network_pid:0,program_pmt_pid:{}},a.version_number=i;else if(a=ii.pat_,null==a)return;let o=r-5-4,d=-1,l=-1;for(let t=8;t<8+o;t+=4){let r=e[t]<<8|e[t+1],i=(31&e[t+2])<<8|e[t+3];0===r?a.network_pid=i:(a.program_pmt_pid[r]=i,-1===d&&(d=r),-1===l&&(l=i))}1===n&&0===s&&(null==ii.pat_&&si.debugLog(ii.TAG_NAME,`Parsed first PAT: ${JSON.stringify(a)}`),ii.pat_=a,ii.current_program_=d,ii.current_pmt_pid_=l)},parsePMT(e){let t=e[0];if(2!==t)return void si.debugError(ii.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let r,i=(15&e[1])<<8|e[2],n=e[3]<<8|e[4],s=(62&e[5])>>>1,a=1&e[5],o=e[6];if(e[7],1===a&&0===o)r=ii._initPmt(),r.program_number=n,r.version_number=s,ii.program_pmt_map_[n]=r;else if(r=ii.program_pmt_map_[n],null==r)return;r.pcr_pid=(31&e[8])<<8|e[9];let d=(15&e[10])<<8|e[11],l=12+d,c=i-9-d-4;for(let t=l;t0){for(let i=t+5;i0)for(let i=t+5;iii.has_video_&&ii.has_audio_?ii.video_init_segment_dispatched_&&ii.audio_init_segment_dispatched_:ii.has_video_&&!ii.has_audio_?ii.video_init_segment_dispatched_:!(ii.has_video_||!ii.has_audio_)&&ii.audio_init_segment_dispatched_,dispatchVideoInitSegment(){let e=ii.video_metadata_.details,t={type:"video"};t.id=ii.video_track_.id,t.timescale=1e3,t.duration=ii.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;let r=t.frameRate.fps_den,i=t.frameRate.fps_num;if(t.refSampleDuration=r/i*1e3,t.codec=e.codec_mimetype,ii.video_metadata_.vps){si.isHevc=!0;let e=ii.video_metadata_.vps.data.subarray(4),r=ii.video_metadata_.sps.data.subarray(4),i=ii.video_metadata_.pps.data.subarray(4);t.hvcc=qr({vps:e,sps:r,pps:i}),0==ii.video_init_segment_dispatched_&&si.debugLog(ii.TAG_NAME,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.hvcc&&si.decodeVideo(t.hvcc,0,!0,0)}else{let e=ii.video_metadata_.sps.data.subarray(4),r=ii.video_metadata_.pps.data.subarray(4);t.avcc=Dr({sps:e,pps:r}),0==ii.video_init_segment_dispatched_&&si.debugLog(ii.TAG_NAME,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.avcc&&si.decodeVideo(t.avcc,0,!0,0)}ii.video_init_segment_dispatched_=!0,ii.video_metadata_changed_=!1;let n=ii.media_info_;n.hasVideo=!0,n.width=t.codecWidth,n.height=t.codecHeight,n.fps=t.frameRate.fps,n.profile=t.profile,n.level=t.level,n.refFrames=e.ref_frames,n.chromaFormat=e.chroma_format_string,n.sarNum=t.sarRatio.width,n.sarDen=t.sarRatio.height,n.videoCodec=t.codec,n.hasAudio&&n.audioCodec?n.mimeType=`video/mp2t; codecs="${n.videoCodec},${n.audioCodec}"`:n.mimeType=`video/mp2t; codecs="${n.videoCodec}"`},dispatchVideoMediaSegment(){ii.isInitSegmentDispatched()&&ii.video_track_.length&&ii._preDoDecode()},dispatchAudioMediaSegment(){ii.isInitSegmentDispatched()&&ii.audio_track_.length&&ii._preDoDecode()},dispatchAudioVideoMediaSegment(){ii.isInitSegmentDispatched()&&(ii.audio_track_.length||ii.video_track_.length)&&ii._preDoDecode()},parseADTSAACPayload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;if(ii.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+ii.aac_last_incomplete_data_.byteLength);t.set(ii.aac_last_incomplete_data_,0),t.set(e,ii.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/ii.timescale_),"aac"===ii.audio_metadata_.codec){if(null==t&&null!=ii.audio_last_sample_pts_)r=1024/ii.audio_metadata_.sampling_frequency*1e3,i=ii.audio_last_sample_pts_+r;else if(null==t)return void si.debugWarn(ii.TAG_NAME,"AAC: Unknown pts");if(ii.aac_last_incomplete_data_&&ii.audio_last_sample_pts_){r=1024/ii.audio_metadata_.sampling_frequency*1e3;let e=ii.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(si.debugWarn(ii.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Zt(e),a=null,o=i;for(;null!=(a=s.readNextAACFrame());){r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},ii.dispatchAudioInitSegment(e)):ii.detectAudioMetadataChange(e)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(e)),n=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:ae};ii.audio_track_.samples.push(s),ii.audio_track_.length+=i.byteLength,o+=r}s.hasIncompleteData()&&(ii.aac_last_incomplete_data_=s.getIncompleteData()),n&&(ii.audio_last_sample_pts_=n)},parseLOASAACPayload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;if(ii.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+ii.aac_last_incomplete_data_.byteLength);t.set(ii.aac_last_incomplete_data_,0),t.set(e,ii.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/ii.timescale_),"aac"===ii.audio_metadata_.codec){if(null==t&&null!=ii.audio_last_sample_pts_)r=1024/ii.audio_metadata_.sampling_frequency*1e3,i=ii.audio_last_sample_pts_+r;else if(null==t)return void si.debugWarn(ii.TAG_NAME,"AAC: Unknown pts");if(ii.aac_last_incomplete_data_&&ii.audio_last_sample_pts_){r=1024/ii.audio_metadata_.sampling_frequency*1e3;let e=ii.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(si.debugWarn(ii.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Jt(e),a=null,o=i;for(;null!=(a=s.readNextAACFrame(or(this.loas_previous_frame)?void 0:this.loas_previous_frame));){ii.loas_previous_frame=a,r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},ii.dispatchAudioInitSegment(e)):ii.detectAudioMetadataChange(e)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(e)),n=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:ae};ii.audio_track_.samples.push(s),ii.audio_track_.length+=i.byteLength,o+=r}s.hasIncompleteData()&&(ii.aac_last_incomplete_data_=s.getIncompleteData()),n&&(ii.audio_last_sample_pts_=n)},parseAC3Payload(e,t){},parseEAC3Payload(e,t){},parseOpusPayload(e,t){},parseMP3Payload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;let r=[44100,48e3,32e3,0],i=[22050,24e3,16e3,0],n=[11025,12e3,8e3,0],s=e[1]>>>3&3,a=(6&e[1])>>1;e[2];let o=(12&e[2])>>>2,d=3!=(e[3]>>>6&3)?2:1,l=0,c=34;switch(s){case 0:l=n[o];break;case 2:l=i[o];break;case 3:l=r[o]}switch(a){case 1:c=34;break;case 2:c=33;break;case 3:c=32}const u={};u.object_type=c,u.sample_rate=l,u.channel_count=d,u.data=e;const h={codec:"mp3",data:u};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"mp3",object_type:c,sample_rate:l,channel_count:d},ii.dispatchAudioInitSegment(h)):ii.detectAudioMetadataChange(h)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(h));let f={payload:e,length:e.byteLength,pts:t/ii.timescale_,dts:t/ii.timescale_,type:ae};ii.audio_track_.samples.push(f),ii.audio_track_.length+=e.byteLength},detectAudioMetadataChange(e){if(e.codec!==ii.audio_metadata_.codec)return si.debugLog(ii.TAG_NAME,`Audio: Audio Codecs changed from ${ii.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===ii.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==ii.audio_metadata_.audio_object_type)return si.debugLog(ii.TAG_NAME,`AAC: AudioObjectType changed from ${ii.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==ii.audio_metadata_.sampling_freq_index)return si.debugLog(ii.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==ii.audio_metadata_.channel_config)return si.debugLog(ii.TAG_NAME,`AAC: Channel configuration changed from ${ii.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===ii.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==ii.audio_metadata_.sampling_frequency)return si.debugLog(ii.TAG_NAME,`AC3: Sampling Frequency changed from ${ii.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==ii.audio_metadata_.bit_stream_identification)return si.debugLog(ii.TAG_NAME,`AC3: Bit Stream Identification changed from ${ii.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==ii.audio_metadata_.bit_stream_mode)return si.debugLog(ii.TAG_NAME,`AC3: BitStream Mode changed from ${ii.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==ii.audio_metadata_.channel_mode)return si.debugLog(ii.TAG_NAME,`AC3: Channel Mode changed from ${ii.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==ii.audio_metadata_.low_frequency_effects_channel_on)return si.debugLog(ii.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${ii.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===ii.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==ii.audio_metadata_.sample_rate)return si.debugLog(ii.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==ii.audio_metadata_.channel_count)return si.debugLog(ii.TAG_NAME,`Opus: Channel count changed from ${ii.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===ii.audio_metadata_.codec){const t=e.data;if(t.object_type!==ii.audio_metadata_.object_type)return si.debugLog(ii.TAG_NAME,`MP3: AudioObjectType changed from ${ii.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==ii.audio_metadata_.sample_rate)return si.debugLog(ii.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==ii.audio_metadata_.channel_count)return si.debugLog(ii.TAG_NAME,`MP3: Channel count changed from ${ii.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1},dispatchAudioInitSegment(e){let t={type:"audio"};if(t.id=ii.audio_track_.id,t.timescale=1e3,t.duration=ii.duration_,"aac"===ii.audio_metadata_.codec){let r="aac"===e.codec?e.data:null,i=new On(r);t.audioSampleRate=i.sampling_rate,t.audioSampleRateIndex=i.sampling_index,t.channelCount=i.channel_count,t.codec=i.codec_mimetype,t.originalCodec=i.original_codec_mimetype,t.config=i.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale;const n=jt({profile:si._opt.mseDecodeAudio?i.object_type:i.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});si.decodeAudio(n,0)}else"ac-3"===ii.audio_metadata_.codec||"ec-3"===ii.audio_metadata_.codec||"opus"===ii.audio_metadata_.codec||"mp3"===ii.audio_metadata_.codec&&(t.audioSampleRate=ii.audio_metadata_.sample_rate,t.channelCount=ii.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==ii.audio_init_segment_dispatched_&&si.debugLog(ii.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),ii.audio_init_segment_dispatched_=!0,ii.video_metadata_changed_=!1;let r=ii.media_info_;r.hasAudio=!0,r.audioCodec=t.originalCodec,r.audioSampleRate=t.audioSampleRate,r.audioChannelCount=t.channelCount,r.hasVideo&&r.videoCodec?r.mimeType=`video/mp2t; codecs="${r.videoCodec},${r.audioCodec}"`:r.mimeType=`video/mp2t; codecs="${r.audioCodec}"`},dispatchPESPrivateDataDescriptor(e,t,r){},parsePESPrivateDataPayload(e,t,r,i,n){let s=new zn;if(s.pid=i,s.stream_id=n,s.len=e.byteLength,s.data=e,null!=t){let e=Math.floor(t/ii.timescale_);s.pts=e}else s.nearest_pts=ii.getNearestTimestampMilliseconds();if(null!=r){let e=Math.floor(r/ii.timescale_);s.dts=e}},parseTimedID3MetadataPayload(e,t,r,i,n){si.debugLog(ii.TAG_NAME,`Timed ID3 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseSynchronousKLVMetadataPayload(e,t,r,i,n){si.debugLog(ii.TAG_NAME,`Synchronous KLV Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseAsynchronousKLVMetadataPayload(e,t,r){si.debugLog(ii.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${r}`)},parseSMPTE2038MetadataPayload(e,t,r,i,n){si.debugLog(ii.TAG_NAME,`SMPTE 2038 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},getNearestTimestampMilliseconds:()=>null!=ii.audio_last_sample_pts_?Math.floor(ii.audio_last_sample_pts_):null!=ii.last_pcr_?Math.floor(ii.last_pcr_/300/ii.timescale_):void 0,_preDoDecode(){const e=ii.video_track_,t=ii.audio_track_;let r=e.samples;t.samples.length>0&&(r=e.samples.concat(t.samples),r=r.sort(((e,t)=>e.dts-t.dts))),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===oe?ii._doDecodeVideo({...e,payload:t}):e.type===ae&&ii._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0},_doDecodeVideo(e){const t=new Uint8Array(e.payload);let r=null;r=e.isHevc?Kr(t,e.isIFrame):Lr(t,e.isIFrame),e.isIFrame&&si.calcIframeIntervalTimestamp(e.dts);let i=si.cryptoPayload(r,e.isIFrame);si.decode(i,{type:oe,ts:e.dts,isIFrame:e.isIFrame,cts:e.cts})},_doDecodeAudio(e){const t=new Uint8Array(e.payload);let r=t;gr(si._opt.m7sCryptoAudio)&&(r=si.cryptoPayloadAudio(t)),si.decode(r,{type:ae,ts:e.dts,isIFrame:!1,cts:0})}},ni=null;vr()&&(ni={TAG_NAME:"worker MediaSource",_resetInIt(){ni.isAvc=null,ni.isAAC=null,ni.videoInfo={},ni.videoMeta={},ni.audioMeta={},ni.sourceBuffer=null,ni.audioSourceBuffer=null,ni.hasInit=!1,ni.hasAudioInit=!1,ni.isAudioInitInfo=!1,ni.videoMimeType="",ni.audioMimeType="",ni.cacheTrack={},ni.cacheAudioTrack={},ni.timeInit=!1,ni.sequenceNumber=0,ni.audioSequenceNumber=0,ni.firstRenderTime=null,ni.firstAudioTime=null,ni.mediaSourceAppendBufferFull=!1,ni.mediaSourceAppendBufferError=!1,ni.mediaSourceAddSourceBufferError=!1,ni.mediaSourceBufferError=!1,ni.mediaSourceError=!1,ni.prevTimestamp=null,ni.decodeDiffTimestamp=null,ni.prevDts=null,ni.prevAudioDts=null,ni.prevPayloadBufferSize=0,ni.isWidthOrHeightChanged=!1,ni.prevTs=null,ni.prevAudioTs=null,ni.eventListenList=[],ni.pendingRemoveRanges=[],ni.pendingSegments=[],ni.pendingAudioRemoveRanges=[],ni.pendingAudioSegments=[],ni.supportVideoFrameCallbackHandle=null,ni.audioSourceBufferCheckTimeout=null,ni.audioSourceNoDataCheckTimeout=null,ni.hasPendingEos=!1,ni.$video={currentTime:0,readyState:0}},init(){ni.events=new pn,ni._resetInIt(),ni.mediaSource=new self.MediaSource,ni.isDecodeFirstIIframe=!!yr(si._opt.checkFirstIFrame),ni._bindMediaSourceEvents()},destroy(){ni.stop(),ni._clearAudioSourceBufferCheckTimeout(),ni.eventListenList&&ni.eventListenList.length&&(ni.eventListenList.forEach((e=>e())),ni.eventListenList=[]),ni._resetInIt(),ni.mediaSource=null},getState:()=>ni.mediaSource&&ni.mediaSource.readyState,isStateOpen:()=>ni.getState()===vt,isStateClosed:()=>ni.getState()===bt,isStateEnded:()=>ni.getState()===yt,_bindMediaSourceEvents(){const{proxy:e}=ni.events,t=e(ni.mediaSource,St,(()=>{si.debugLog(ni.TAG_NAME,"sourceOpen"),ni._onMediaSourceSourceOpen()})),r=e(ni.mediaSource,wt,(()=>{si.debugLog(ni.TAG_NAME,"sourceClose")})),i=e(ni.mediaSource,Et,(()=>{si.debugLog(ni.TAG_NAME,"sourceended")}));ni.eventListenList.push(t,r,i)},_onMediaSourceSourceOpen(){ni.sourceBuffer||(si.debugLog(ni.TAG_NAME,"onMediaSourceSourceOpen() sourceBuffer is null and next init"),ni._initSourceBuffer()),ni.audioSourceBuffer||(si.debugLog(ni.TAG_NAME,"onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),ni._initAudioSourceBuffer()),ni._hasPendingSegments()&&ni._doAppendSegments()},decodeVideo(e,t,r,i){if(si.isDestroyed)si.debugWarn(ni.TAG_NAME,"decodeVideo() and decoder is destroyed");else if(yr(ni.hasInit))if(r&&e[1]===Bt){const i=15&e[0];if(i===Re&&yr(si._opt.supportMSEDecodeHevc))return void ni.emitError(Le.mediaSourceH265NotSupport);ni.videoInfo.codec=i,postMessage({cmd:R,code:i});const n=new Uint8Array(e);postMessage({cmd:M,buffer:n,codecId:i},[n.buffer]),ni.hasInit=ni._decodeConfigurationRecord(e,t,r,i)}else si.debugWarn(ni.TAG_NAME,`decodeVideo has not init , isIframe is ${r} , payload is ${e[1]} so drop this frame`);else if(!ni.isDecodeFirstIIframe&&r&&(ni.isDecodeFirstIIframe=!0),ni.isDecodeFirstIIframe){if(r&&0===e[1]){const t=15&e[0];let r={};t===Fe?r=kr(e.slice(5)):t===Re&&(r=Wr(e));const i=ni.videoInfo;i&&i.codecWidth&&i.codecWidth&&r&&r.codecWidth&&r.codecHeight&&(r.codecWidth!==i.codecWidth||r.codecHeight!==i.codecWidth)&&(si.debugWarn(ni.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${i.codecWidth}, old height is ${i.codecHeight},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),ni.isWidthOrHeightChanged=!0,ni.emitError(Le.mseWidthOrHeightChange,`width: ${i.codecWidth}->${r.codecWidth}, height: ${i.codecWidth}->${r.codecHeight}`))}if(ni.isWidthOrHeightChanged)return void si.debugWarn(ni.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(_r(e))return void si.debugLog(ni.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLengthni.prevTs>0&&eA,_decodeConfigurationRecord(e,t,r,i){let n=e.slice(5),s={};if(i===Fe?s=kr(n):i===Re&&(s=Vr(n)),ni.videoInfo.width=s.codecWidth,ni.videoInfo.height=s.codecHeight,0===s.codecWidth&&0===s.codecHeight)return si.debugWarn(ni.TAG_NAME,"_decodeConfigurationRecord error",JSON.stringify(s)),ni.emitError(Le.mediaSourceDecoderConfigurationError,`width is ${0===s.codecWidth} and height is ${s.codecHeight}`),!1;const a={id:Lt,type:"video",timescale:1e3,duration:0,avcc:n,codecWidth:s.codecWidth,codecHeight:s.codecHeight,videoType:s.videoType},o=mn.generateInitSegment(a);ni.isAvc=i===Fe;let d=s.codec;return ni.videoMimeType=d?`video/mp4; codecs="${s.codec}"`:ni.isAvc?_t:gt,postMessage({cmd:k,w:s.codecWidth,h:s.codecHeight}),ni._initSourceBuffer(),ni.appendBuffer(o.buffer),ni.sequenceNumber=0,ni.cacheTrack={},ni.timeInit=!1,!0},_decodeAudioConfigurationRecord(e,t){const r=e[0]>>4,i=e[0]>>1&1,n=r===He,s=r===Ne;if(yr(s||n))return si.debugWarn(ni.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${r} ant auto wasm decode`),ni.emitError(Le.mediaSourceAudioG711NotSupport),!1;const a={id:It,type:"audio",timescale:1e3};let o={};if(qt(e)){if(o=Xt(e.slice(2)),!o)return!1;a.audioSampleRate=o.sampleRate,a.channelCount=o.channelCount,a.config=o.config,a.refSampleDuration=1024/a.audioSampleRate*a.timescale}else{if(!n)return!1;if(o=An(e),!o)return!1;a.audioSampleRate=o.samplingRate,a.channelCount=o.channelCount,a.refSampleDuration=1152/a.audioSampleRate*a.timescale}a.codec=o.codec,a.duration=0;let d="mp4",l=o.codec,c=null;n&&yr(si._opt.isFirefox)?(d="mpeg",l="",c=new Uint8Array):c=mn.generateInitSegment(a);let u=`${a.type}/${d}`;return l&&l.length>0&&(u+=`;codecs=${l}`),yr(ni.isAudioInitInfo)&&(wr=r===Ne?i?16:8:0===i?8:16,postMessage({cmd:L,code:r}),postMessage({cmd:P,sampleRate:a.audioSampleRate,channels:a.channelCount,depth:wr}),ni.isAudioInitInfo=!0),ni.audioMimeType=u,ni.isAAC=s,ni._initAudioSourceBuffer(),ni.appendAudioBuffer(c.buffer),!0},_initSourceBuffer(){const{proxy:e}=ni.events;if(null===ni.sourceBuffer&&null!==ni.mediaSource&&ni.isStateOpen()&&ni.videoMimeType){try{si.debugLog(ni.TAG_NAME,"_initSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",ni.videoMimeType),ni.sourceBuffer=ni.mediaSource.addSourceBuffer(ni.videoMimeType)}catch(e){return si.debugError(ni.TAG_NAME,"_initSourceBuffer() appendBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),ni.emitError(Le.mseWorkerAddSourceBufferError,e.code),void(ni.mediaSourceAddSourceBufferError=!0)}if(ni.sourceBuffer){const t=e(ni.sourceBuffer,"error",(e=>{ni.mediaSourceBufferError=!0,si.debugError(ni.TAG_NAME,"mseSourceBufferError mseDecoder.sourceBuffer",e,e.toString()),ni.emitError(Le.mseSourceBufferError,e.code)})),r=e(ni.sourceBuffer,"updateend",(()=>{ni._hasPendingRemoveRanges()?ni._doRemoveRanges():ni._hasPendingSegments()?ni._doAppendSegments():ni.hasPendingEos&&(si.debugLog(ni.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),ni.endOfStream())}));ni.eventListenList.push(t,r)}}else si.debugLog(ni.TAG_NAME,`_initSourceBuffer and mseDecoder.isStateOpen is ${ni.isStateOpen()} and mseDecoder.isAvc === null is ${null===ni.isAvc}`)},_initAudioSourceBuffer(){const{proxy:e}=ni.events;if(null===ni.audioSourceBuffer&&null!==ni.mediaSource&&ni.isStateOpen()&&ni.audioMimeType){try{si.debugLog(ni.TAG_NAME,"_initAudioSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",ni.audioMimeType),ni._clearAudioSourceBufferCheckTimeout(),ni.audioSourceBuffer=ni.mediaSource.addSourceBuffer(ni.audioMimeType)}catch(e){return si.debugError(ni.TAG_NAME,"_initAudioSourceBuffer() addSourceBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),ni.emitError(Le.mseWorkerAddSourceBufferError,e.code),void(ni.mediaSourceAddSourceBufferError=!0)}if(ni.audioSourceBuffer){const t=e(ni.audioSourceBuffer,"error",(e=>{ni.mediaSourceBufferError=!0,si.debugError(ni.TAG_NAME,"mseSourceBufferError mseDecoder.audioSourceBuffer",e.code,e.toString(),e),ni.emitError(Le.mseSourceBufferError,e.code)})),r=e(ni.audioSourceBuffer,"updateend",(()=>{ni._hasPendingRemoveRanges()?ni._doRemoveRanges():ni._hasPendingSegments()?ni._doAppendSegments():ni.hasPendingEos&&(si.debugLog(ni.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),ni.endOfStream())}));ni.eventListenList.push(t,r),null===ni.audioSourceNoDataCheckTimeout&&(ni.audioSourceNoDataCheckTimeout=setTimeout((()=>{ni._clearAudioNoDataCheckTimeout(),ni.emitError(Le.mediaSourceAudioNoDataTimeout)}),1e3))}}else si.debugLog(ni.TAG_NAME,`_initAudioSourceBuffer and mseDecoder.isStateOpen is ${ni.isStateOpen()} and mseDecoder.audioMimeType is ${ni.audioMimeType}`)},_decodeVideo(e,t,r,i,n){let s=e.slice(5),a=s.byteLength;if(0===a)return void si.debugWarn(ni.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let o=(new Date).getTime(),d=!1;ni.prevTimestamp||(ni.prevTimestamp=o,d=!0);const l=o-ni.prevTimestamp;if(ni.decodeDiffTimestamp=l,l>1e3&&!d&&si.isPlayer&&si.debugLog(ni.TAG_NAME,`_decodeVideo now time is ${o} and prev time is ${ni.prevTimestamp}, diff time is ${l} ms`),ni.cacheTrack.id&&t>=ni.cacheTrack.dts){let e=8+ni.cacheTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(mn.types.mdat,4),r.set(ni.cacheTrack.data,8),ni.cacheTrack.duration=t-ni.cacheTrack.dts;let i=mn.moof(ni.cacheTrack,ni.cacheTrack.dts);ni.cacheTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),ni.appendBuffer(n.buffer)}else si.debugLog(ni.TAG_NAME,`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${n} cacheTrack dts is ${ni.cacheTrack&&ni.cacheTrack.dts}`),ni.timeInit=!1,ni.cacheTrack={};ni.cacheTrack||(ni.cacheTrack={}),ni.cacheTrack.id=Lt,ni.cacheTrack.sequenceNumber=++ni.sequenceNumber,ni.cacheTrack.size=a,ni.cacheTrack.dts=t,ni.cacheTrack.cts=i,ni.cacheTrack.isKeyframe=r,ni.cacheTrack.data=s,ni.cacheTrack.flags={isLeading:0,dependsOn:r?2:1,isDependedOn:r?1:0,hasRedundancy:0,isNonSync:r?0:1},ni.prevTimestamp=(new Date).getTime()},_decodeAudio(e,t,r){let i=ni.isAAC?e.slice(2):e.slice(1),n=i.byteLength;if(ni.cacheAudioTrack.id&&t>=ni.cacheAudioTrack.dts){let e=8+ni.cacheAudioTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(mn.types.mdat,4),r.set(ni.cacheAudioTrack.data,8),ni.cacheAudioTrack.duration=t-ni.cacheAudioTrack.dts;let i=mn.moof(ni.cacheAudioTrack,ni.cacheAudioTrack.dts);ni.cacheAudioTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),ni.appendAudioBuffer(n.buffer)}else ni.cacheAudioTrack={};ni.cacheAudioTrack||(ni.cacheAudioTrack={}),ni.cacheAudioTrack.id=It,ni.cacheAudioTrack.sequenceNumber=++ni.audioSequenceNumber,ni.cacheAudioTrack.size=n,ni.cacheAudioTrack.dts=t,ni.cacheAudioTrack.cts=0,ni.cacheAudioTrack.data=i,ni.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}},appendBuffer(e){si.isDestroyed?si.debugWarn(ni.TAG_NAME,"appendBuffer() player is destroyed"):ni.mediaSourceAddSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):ni.mediaSourceAppendBufferFull?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):ni.mediaSourceAppendBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):ni.mediaSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(ni.pendingSegments.push(e),ni.sourceBuffer&&(si._opt.mseAutoCleanupSourceBuffer&&ni._needCleanupSourceBuffer()&&ni._doCleanUpSourceBuffer(),yr(ni.getSourceBufferUpdating())&&ni.isStateOpen()&&yr(ni._hasPendingRemoveRanges()))?ni._doAppendSegments():ni.isStateClosed()?(ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):ni.isStateEnded()&&(ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,"mediaSource is end")))},appendAudioBuffer(e){si.isDestroyed?si.debugWarn(ni.TAG_NAME,"appendAudioBuffer() player is destroyed"):ni.mediaSourceAddSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):ni.mediaSourceAppendBufferFull?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):ni.mediaSourceAppendBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):ni.mediaSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(ni.pendingAudioSegments.push(e),ni.audioSourceBuffer&&(si._opt.mseAutoCleanupSourceBuffer&&ni._needCleanupSourceBuffer()&&ni._doCleanUpSourceBuffer(),yr(ni.getAudioSourceBufferUpdating())&&ni.isStateOpen()&&yr(ni._hasPendingRemoveRanges()))?ni._doAppendSegments():ni.isStateClosed()?(ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):ni.isStateEnded()&&(ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,"mediaSource is end")))},getSourceBufferUpdating:()=>ni.sourceBuffer&&ni.sourceBuffer.updating,getAudioSourceBufferUpdating:()=>ni.audioSourceBuffer&&ni.audioSourceBuffer.updating,stop(){ni.abortSourceBuffer(),ni.removeSourceBuffer(),ni.endOfStream()},clearUpAllSourceBuffer(){if(ni.sourceBuffer){const e=ni.sourceBuffer.buffered;for(let t=0;tni.pendingSegments.length>0||ni.pendingAudioSegments.length>0,getPendingSegmentsLength:()=>ni.pendingSegments.length,_handleUpdatePlaybackRate(){},_doAppendSegments(){if(ni.isStateClosed()||ni.isStateEnded())si.debugLog(ni.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==ni.sourceBuffer){if(ni.needInitAudio()&&null===ni.audioSourceBuffer)return si.debugLog(ni.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===ni.audioSourceBufferCheckTimeout&&(ni.audioSourceBufferCheckTimeout=setTimeout((()=>{ni._clearAudioSourceBufferCheckTimeout(),ni.emitError(Le.mediaSourceAudioInitTimeout)}),1e3)));if(yr(ni.getSourceBufferUpdating())&&ni.pendingSegments.length>0){const e=ni.pendingSegments.shift();try{ni.sourceBuffer.appendBuffer(e)}catch(e){si.debugError(ni.TAG_NAME,"mseDecoder.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(ni.stop(),ni.mediaSourceAppendBufferFull=!0,ni.emitError(Le.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(ni.stop(),ni.mediaSourceAppendBufferError=!0,ni.emitError(Le.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(ni.stop(),ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,`code is ${e.code} , message is ${e.message}`))}}if(yr(ni.getAudioSourceBufferUpdating())&&ni.pendingAudioSegments.length>0){const e=ni.pendingAudioSegments.shift();try{ni.audioSourceBuffer.appendBuffer(e)}catch(e){si.debugError(ni.TAG_NAME,"mseDecoder.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(ni.stop(),ni.mediaSourceAppendBufferFull=!0,ni.emitError(Le.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(ni.stop(),ni.mediaSourceAppendBufferError=!0,ni.emitError(Le.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(ni.stop(),ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,e.code,`code is ${e.code} , message is ${e.message}`))}}}else si.debugLog(ni.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")},_doCleanUpSourceBuffer(){const e=ni.$video.currentTime;if(ni.sourceBuffer){const t=ni.sourceBuffer.buffered;let r=!1;for(let i=0;i=si._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-si._opt.mseAutoCleanupMinBackwardDuration;ni.pendingRemoveRanges.push({start:n,end:t})}}else s=si._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-si._opt.mseAutoCleanupMinBackwardDuration;ni.pendingAudioRemoveRanges.push({start:n,end:t})}}else sni.pendingRemoveRanges.length>0||ni.pendingAudioRemoveRanges.length>0,needInitAudio:()=>si._opt.hasAudio&&si._opt.mseDecodeAudio,_doRemoveRanges(){if(ni.sourceBuffer&&yr(ni.getSourceBufferUpdating())){let e=ni.pendingRemoveRanges;for(;e.length&&yr(ni.getSourceBufferUpdating());){let t=e.shift();try{ni.sourceBuffer.remove(t.start,t.end)}catch(e){si.debugWarn(ni.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e,e.toString())}}}if(ni.audioSourceBuffer&&yr(ni.getAudioSourceBufferUpdating())){let e=ni.pendingAudioRemoveRanges;for(;e.length&&yr(ni.getAudioSourceBufferUpdating());){let t=e.shift();try{ni.audioSourceBuffer.remove(t.start,t.end)}catch(e){si.debugWarn(ni.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e,e.toString())}}}},_getPlaybackRate(){},_needCleanupSourceBuffer(){if(yr(si._opt.mseAutoCleanupSourceBuffer))return!1;const e=ni.$video.currentTime;if(ni.sourceBuffer){let t=ni.sourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=si._opt.mseAutoCleanupMaxBackwardDuration)return!0}if(ni.audioSourceBuffer){let t=ni.audioSourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=si._opt.mseAutoCleanupMaxBackwardDuration)return!0}return!1},_clearAudioSourceBufferCheckTimeout(){ni.audioSourceBufferCheckTimeout&&(clearTimeout(ni.audioSourceBufferCheckTimeout),ni.audioSourceBufferCheckTimeout=null)},_clearAudioNoDataCheckTimeout(){ni.audioSourceNoDataCheckTimeout&&(clearTimeout(ni.audioSourceNoDataCheckTimeout),ni.audioSourceNoDataCheckTimeout=null)},getHandle:()=>ni.mediaSource.handle,emitError(e){postMessage({cmd:se,value:e,msg:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""})}});let si={isPlayer:!0,isHevc:null,isPlayback:!1,dropping:!1,isPushDropping:!1,isWorkerFetch:!1,isDestroyed:!1,fetchStatus:Ct,_opt:Ar(),mp3Demuxer:null,delay:-1,pushLatestDelay:-1,firstTimestamp:null,startTimestamp:null,preDelayTimestamp:null,stopId:null,streamFps:null,streamAudioFps:null,streamVideoFps:null,writableStream:null,networkDelay:0,webglObj:null,startStreamRateAndStatsInterval:function(){si.stopStreamRateAndStatsInterval(),l=setInterval((()=>{d&&d(0);const e=JSON.stringify({demuxBufferDelay:si.getVideoBufferLength(),audioDemuxBufferDelay:si.getAudioBufferLength(),streamBufferByteLength:si.getStreamBufferLength(),netBuf:si.networkDelay||0,pushLatestDelay:si.pushLatestDelay||0,latestDelay:si.delay,isStreamTsMoreThanLocal:je,wasmDecodeDelay:Se-Ee});postMessage({cmd:O,type:Ce,value:e})}),1e3)},stopStreamRateAndStatsInterval:function(){l&&(clearInterval(l),l=null)},useOffscreen:function(){return si._opt.useOffscreen&&"undefined"!=typeof OffscreenCanvas},getDelay:function(e,t){if(!e||si._opt.hasVideo&&!B)return-1;if(t===ae)return si.delay;if(si.preDelayTimestamp&&si.preDelayTimestamp>e)return si.preDelayTimestamp-e>1e3&&si.debugWarn("worker",`getDelay() and preDelayTimestamp is ${si.preDelayTimestamp} > timestamp is ${e} more than ${si.preDelayTimestamp-e}ms and return ${si.delay}`),si.preDelayTimestamp=e,si.delay;if(si.firstTimestamp){if(e){const t=Date.now()-si.startTimestamp,r=e-si.firstTimestamp;t>=r?(je=!1,si.delay=t-r):(je=!0,si.delay=r-t)}}else si.firstTimestamp=e,si.startTimestamp=Date.now(),si.delay=-1;return si.preDelayTimestamp=e,si.delay},getDelayNotUpdateDelay:function(e,t){if(!e||si._opt.hasVideo&&!B)return-1;if(t===ae)return si.pushLatestDelay;if(si.preDelayTimestamp&&si.preDelayTimestamp-e>1e3)return si.debugWarn("worker",`getDelayNotUpdateDelay() and preDelayTimestamp is ${si.preDelayTimestamp} > timestamp is ${e} more than ${si.preDelayTimestamp-e}ms and return -1`),-1;if(si.firstTimestamp){let t=-1;if(e){const r=Date.now()-si.startTimestamp,i=e-si.firstTimestamp;r>=i?(je=!1,t=r-i):(je=!0,t=i-r)}return t}return-1},resetDelay:function(){si.firstTimestamp=null,si.startTimestamp=null,si.delay=-1,si.dropping=!1},resetAllDelay:function(){si.resetDelay(),si.preDelayTimestamp=null},doDecode:function(e){si._opt.isEmitSEI&&e.type===oe&&si.isWorkerFetch&&si.findSei(e.payload,e.ts),si.isPlayUseMSEAndDecoderInWorker()?e.type===ae?si._opt.mseDecodeAudio?ni.decodeAudio(e.payload,e.ts):e.decoder.decode(e.payload,e.ts):e.type===oe&&ni.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):si._opt.useWCS&&si.useOffscreen()&&e.type===oe&&s.decode?s.decode(e.payload,e.ts,e.cts):e.decoder.decode(e.payload,e.ts,e.isIFrame,e.cts)},decodeNext(e){if(0===i.length)return;const t=e.ts,n=i[0],s=e.type===oe&&_r(e.payload);if(yr(r))s&&(si.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n isVideoSqeHeader is ${s}`),i.shift(),si.doDecode(n));else{const r=n.ts-t,a=n.type===ae&&e.type===oe;(r<=20||a||s)&&(si.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n diff is ${r} and isVideoAndNextAudio is ${a} and isVideoSqeHeader is ${s}`),i.shift(),si.doDecode(n))}},init:function(){si.debugLog("worker","init and opt is",JSON.stringify(si._opt));const e=si._opt.playType===v,t=si._opt.playType===b;if(Or.init(),si.isPlayer=e,si.isPlayback=t,si.isPlayUseMSEAndDecoderInWorker()&&ni&&ni.init(),s&&si._opt.useWCS&&si.useOffscreen()&&s.init(),yr(si.isPlaybackCacheBeforeDecodeForFpsRender())){si.debugLog("worker","setInterval()");const t=()=>{const t=si._opt.videoBuffer+si._opt.videoBufferDelay;let r=null;if(i.length){if(si.isPushDropping)return void si.debugWarn("worker",`loop() isPushDropping is true and bufferList length is ${i.length}`);if(si.dropping){for(r=i.shift(),si.debugWarn("worker",`loop() dropBuffer is dropping and isIFrame ${r.isIFrame} and delay is ${si.delay} and bufferlist is ${i.length}`);!r.isIFrame&&i.length;)r=i.shift();const e=si.getDelayNotUpdateDelay(r.ts,r.type);r.isIFrame&&e<=si.getNotDroppingDelayTs()&&(si.debugLog("worker","loop() is dropping = false, is iFrame"),si.dropping=!1,si.doDecode(r),si.decodeNext(r))}else if(si.isPlayback||si.isPlayUseMSE()||0===si._opt.videoBuffer)for(;i.length;)r=i.shift(),si.doDecode(r);else if(r=i[0],-1===si.getDelay(r.ts,r.type))si.debugLog("worker","loop() common dumex delay is -1 ,data.ts is",r.ts),i.shift(),si.doDecode(r),si.decodeNext(r);else if(si.delay>t&&e)si.hasIframeInBufferList()?(si.debugLog("worker",`delay is ${si.delay} > maxDelay ${t}, set dropping is true`),si.resetAllDelay(),si.dropping=!0,postMessage({cmd:H})):(i.shift(),si.doDecode(r),si.decodeNext(r));else for(;i.length;){if(r=i[0],!(si.getDelay(r.ts,r.type)>si._opt.videoBuffer)){si.delay<0&&si.debugWarn("worker",`loop() do not decode and delay is ${si.delay}, bufferList is ${i.length}`);break}i.shift(),si.doDecode(r)}}else-1!==si.delay&&si.debugLog("worker","loop() bufferList is empty and reset delay"),si.resetAllDelay()};si.stopId=setInterval((()=>{let e=(new Date).getTime();Je||(Je=e);const r=e-Je;r>100&&si.debugWarn("worker",`loop demux diff time is ${r}`),t(),Je=(new Date).getTime()}),20)}else si.debugLog("worker","playback and playbackIsCacheBeforeDecodeForFpsRender is true");if(yr(si._opt.checkFirstIFrame)&&(B=!0),si.isPlayUseMSEAndDecoderInWorker()&&ni){const e=ni.getHandle();e&&postMessage({cmd:ie,mseHandle:e},[e])}},playbackCacheLoop:function(){si.clearPlaybackCacheLoop();const e=()=>{let e=null;i.length&&(e=i.shift(),si.doDecode(e))};e();const t=Math.ceil(1e3/(si.streamFps*si._opt.playbackRate));si.debugLog("worker",`playbackCacheLoop fragDuration is ${t}, streamFps is ${si.streamFps}, streamAudioFps is ${si.streamAudioFps} ,streamVideoFps is ${si.streamVideoFps} playbackRate is ${si._opt.playbackRate}`),si.stopId=setInterval(e,t)},clearPlaybackCacheLoop:function(){si.stopId&&(clearInterval(si.stopId),si.stopId=null)},startPlaybackCacheLoop:function(){si.playbackCacheLoop()},close:function(){if(si.debugLog("worker","close"),si.isDestroyed=!0,Tr(),!o||1!==o.readyState&&2!==o.readyState?o&&si.debugLog("worker",`close() and socket.readyState is ${o.readyState}`):(Sr=!0,o.close(1e3,"Client disconnecting")),o=null,si.stopStreamRateAndStatsInterval(),si.stopId&&(clearInterval(si.stopId),si.stopId=null),si.mp3Demuxer&&(si.mp3Demuxer.destroy(),si.mp3Demuxer=null),si.writableStream&&yr(si.writableStream.locked)&&si.writableStream.close().catch((e=>{si.debugLog("worker","close() and writableStream.close() error",e.toString(),e)})),si.writableStream=null,ai)try{ai.clear&&ai.clear(),ai=null}catch(e){si.debugLog("worker","close() and audioDecoder.clear error",e.toString(),e)}if(oi)try{oi.clear&&oi.clear(),oi=null}catch(e){si.debugLog("worker","close() and videoDecoder.clear error",e.toString())}d=null,Je=null,je=!1,Se=0,Ee=0,s&&(s.destroy&&s.destroy(),s=null),ni&&(ni.destroy(),ni=null),si.firstTimestamp=null,si.startTimestamp=null,si.networkDelay=0,si.streamFps=null,si.streamAudioFps=null,si.streamVideoFps=null,si.delay=-1,si.pushLatestDelay=-1,si.preDelayTimestamp=null,si.dropping=!1,si.isPushDropping=!1,si.isPlayer=!0,si.isPlayback=!1,si.isWorkerFetch=!1,si.isHevc=null,si._opt=Ar(),si.webglObj&&(si.webglObj.destroy(),si.offscreenCanvas.removeEventListener("webglcontextlost",si.onOffscreenCanvasWebglContextLost),si.offscreenCanvas.removeEventListener("webglcontextrestored",si.onOffscreenCanvasWebglContextRestored),si.offscreenCanvas=null,si.offscreenCanvasGL=null,si.offscreenCanvasCtx=null),i=[],n=[],c&&(c.close(),c=null),h=null,f=null,S=!1,E=!1,B=!1,Wt=!1,Kt=!1,Qt=!1,sr=null,it=[],Ut=0,Tt=0,Qe=null,tt=null,Nt=null,Ot=null,wr=null,Gt=0,Ht=0,ut=null,At=null,si.fetchStatus=Ct,Er=!0,Or.destroy(),Gr.destroy(),jr.destroy(),ii.destroy(),si.debug=null,si._opt={},postMessage({cmd:K})},pushBuffer:function(e,t){if(t.type===ae&&qt(e)){if(si.debugLog("worker",`pushBuffer audio ts is ${t.ts}, isAacCodecPacket is true`),si._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:Q,buffer:t},[t.buffer])}si.decodeAudio(e,t.ts)}else if(t.type===oe&&t.isIFrame&&_r(e)){if(si.debugLog("worker",`pushBuffer video ts is ${t.ts}, isVideoSequenceHeader is true`),si._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:ee,buffer:t},[t.buffer])}si.decodeVideo(e,t.ts,t.isIFrame,t.cts)}else{if(si._opt.isRecording)if(si._opt.isRecordTypeFlv){const r=new Uint8Array(e);postMessage({cmd:te,type:t.type,buffer:r,ts:t.ts},[r.buffer])}else if(si._opt.recordType===w)if(t.type===oe){const r=new Uint8Array(e).slice(5);postMessage({cmd:z,buffer:r,isIFrame:t.isIFrame,ts:t.ts,cts:t.cts},[r.buffer])}else if(t.type===ae&&si._opt.isWasmMp4){const r=new Uint8Array(e),i=Yt(r)?r.slice(2):r.slice(1);postMessage({cmd:I,buffer:i,ts:t.ts},[i.buffer])}if(si.isPlayer){if(t.type===oe){if(Gt>0){const e=t.ts-Ot,r=Gt+Gt/2;e>r&&si.debugLog("worker",`pushBuffer video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts}, preTs is ${Ot},\n diff is ${e} and preTsDuration is ${Gt} and maxDiff is ${r}\n maybe trigger black screen or flower screen\n `)}if(null!==Ot&&Ot>=t.ts&&(si.debugWarn("worker",`pushBuffer() and isIFrame is ${t.isIFrame} and,\n options.ts is ${t.ts} less than (or equal) preTs is ${Ot} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${Ht}`),Ot-t.ts>A&&(si.debugWarn("worker",`pushBuffer,\n preTimestamp is ${Ot}, options.ts is ${t.ts},\n diff is ${Ot-t.ts} more than 3600000,\n and resetAllDelay`),si.resetAllDelay(),Ot=null,Gt=0),si._opt.isDropSameTimestampGop&&yr(t.isIFrame)&&B)){const e=si.hasIframeInBufferList(),t=yr(si.isPushDropping);return si.debugLog("worker",`pushBuffer, isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next dropBuffer`),void(e&&t?si.dropBuffer$2():(si.clearBuffer(!0),gr(si._opt.checkFirstIFrame)&&gr(r)&&(si.isPlayUseMSEAndDecoderInWorker()?ni.isDecodeFirstIIframe=!1:postMessage({cmd:re}))))}Ot>0&&(Gt=t.ts-Ot),Ht=e.byteLength,Ot=t.ts}if(B){const e=si._opt.videoBuffer+si._opt.videoBufferDelay,r=si.getDelayNotUpdateDelay(t.ts,t.type);si.pushLatestDelay=r,si.delay>0&&r>e&&si.delay({type:e.type,ts:e.ts})));si.debugLog("worker",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${i.length}, and ts list is ${JSON.stringify(r)}`)}const r=si.getAudioBufferLength()>0,n=r?60:40;i.length>=n&&(si.debugWarn("worker",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${i.length} more than ${n}, and hasAudio is ${r} an set streamFps is 25`),si.streamVideoFps=25,postMessage({cmd:V,value:si.streamVideoFps}),r?(si.streamAudioFps=25,si.streamFps=si.streamVideoFps+si.streamAudioFps):si.streamFps=si.streamVideoFps,si.playbackCacheLoop())}}},getVideoBufferLength(){let e=0;return i.forEach((t=>{t.type===oe&&(e+=1)})),e},hasIframeInBufferList:()=>i.some((e=>e.type===oe&&e.isIFrame)),isAllIframeInBufferList(){const e=si.getVideoBufferLength();let t=0;return i.forEach((e=>{e.type===oe&&e.isIFrame&&(t+=1)})),e===t},getNotDroppingDelayTs:()=>si._opt.videoBuffer+si._opt.videoBufferDelay/2,getAudioBufferLength(){let e=0;return i.forEach((t=>{t.type===ae&&(e+=1)})),e},getStreamBufferLength(){let e=0;return c&&c.buffer&&(e=c.buffer.byteLength),si._opt.isNakedFlow?Or.lastBuf&&(e=Or.lastBuf.byteLength):si._opt.isTs?ii._remainingPacketData&&(e=ii._remainingPacketData.byteLength):si._opt.isFmp4&&Gr.mp4Box&&(e=Gr.mp4Box.getAllocatedSampleDataSize()),e},fetchStream:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(si.debugLog("worker","fetchStream, url is "+e,"options:",JSON.stringify(t)),si.isWorkerFetch=!0,t.isFlv?si._opt.isFlv=!0:t.isFmp4?si._opt.isFmp4=!0:t.isMpeg4?si._opt.isMpeg4=!0:t.isNakedFlow?si._opt.isNakedFlow=!0:t.isTs&&(si._opt.isTs=!0),d=ar((e=>{postMessage({cmd:O,type:Ue,value:e})})),si.startStreamRateAndStatsInterval(),t.isFmp4&&(Gr.listenMp4Box(),si._opt.isFmp4Private&&Gr.initTransportDescarmber()),t.protocol===_){t.isFlv&&(c=new Ur(si.demuxFlv())),a=new AbortController;const r=Object.assign({signal:a.signal},{headers:t.options&&t.options.headers||{}});fetch(e,r).then((e=>{if(gr(Sr))return si.debugLog("worker","request abort and run res.body.cancel()"),si.fetchStatus=Ct,void e.body.cancel();if(!pr(e))return si.debugWarn("worker",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),Tr(),void postMessage({cmd:O,type:Le.fetchError,value:`fetch response status is ${e.status} and ok is ${e.ok}`});if(postMessage({cmd:O,type:ke}),ur())si.writableStream=new WritableStream({write:e=>a&&a.signal&&a.signal.aborted?(si.debugLog("worker","writableStream write() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt)):gr(Sr)?(si.debugLog("worker","writableStream write() and requestAbort is true so return"),si.fetchStatus=Pt,void Tr()):void("string"!=typeof e?(si.fetchStatus=Dt,d(e.byteLength),t.isFlv?c.write(e):t.isFmp4?si.demuxFmp4(e):t.isMpeg4?si.demuxMpeg4(e):t.isTs?si.demuxTs(e):t.isNakedFlow&&si.demuxNakedFlow(e)):si.debugWarn("worker",`writableStream write() and value is "${e}" string so return`)),close:()=>{si.debugLog("worker","writableStream close()"),si.fetchStatus=Pt,c&&(c.close(),c=null),Tr(),postMessage({cmd:O,type:Ae,value:g,msg:"fetch done"})},abort:e=>{if(a&&a.signal&&a.signal.aborted)return si.debugLog("worker","writableStream abort() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt);c&&(c.close(),c=null),e.name!==xt?(si.debugLog("worker",`writableStream abort() and e is ${e.toString()}`),Tr(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()})):si.debugLog("worker","writableStream abort() and e.name is AbortError so return")}}),e.body.pipeTo(si.writableStream).catch((e=>{"AbortError"!==e.name&&si.debugLog("worker","writableStream pipeTo() and e is",e.name,e.toString())}));else{const r=e.body.getReader(),i=()=>{r.read().then((e=>{let{done:r,value:n}=e;return r?(si.debugLog("worker","fetchNext().then() and done is true"),si.fetchStatus=Pt,c&&(c.close(),c=null),Tr(),void postMessage({cmd:O,type:Ae,value:g,msg:"fetch done"})):a&&a.signal&&a.signal.aborted?(si.debugLog("worker","fetchNext().then() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt)):gr(Sr)?(si.debugLog("worker","fetchNext().then() and requestAbort is true so return"),si.fetchStatus=Pt,void Tr()):void("string"!=typeof n?(si.fetchStatus=Dt,d(n.byteLength),t.isFlv?c.write(n):t.isFmp4?si.demuxFmp4(n):t.isMpeg4?si.demuxMpeg4(n):t.isTs?si.demuxTs(n):t.isNakedFlow&&si.demuxNakedFlow(n),i()):si.debugWarn("worker",`fetchNext().then() and value "${n}" is string so return`))})).catch((e=>{if(a&&a.signal&&a.signal.aborted)return si.debugLog("worker","fetchNext().catch() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt);c&&(c.close(),c=null),e.name!==xt?(si.debugLog("worker",`fetchNext().catch() and e is ${e.toString()}`),Tr(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()})):si.debugLog("worker","fetchNext().catch() and e.name is AbortError so return")}))};i()}})).catch((e=>{a&&a.signal&&a.signal.aborted?si.debugLog("worker","fetch().catch() and abortController.signal.aborted is true so return"):e.name!==xt?(si.debugLog("worker",`fetch().catch() and e is ${e.toString()}`),Tr(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()}),c&&(c.close(),c=null)):si.debugLog("worker","fetch().catch() and e.name is AbortError so return")}))}else t.protocol===m&&(t.isFlv&&(c=new Ur(si.demuxFlv())),o=new WebSocket(e,r),o.binaryType="arraybuffer",o.onopen=()=>{si.debugLog("worker","fetchStream, WebsocketStream socket open"),postMessage({cmd:O,type:ke}),postMessage({cmd:O,type:Pe})},o.onclose=e=>{si.isDestroyed?si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} and isDestroyed is true, so return`):u?si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} but isSocketError is true , so return`):(si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code}`),1006===e.code&&si.debugError("worker",`fetchStream, WebsocketStream socket close abnormally and code is ${e.code}`),gr(Sr)?si.debugLog("worker","fetchStream, WebsocketStream socket close and requestAbort is true so return"):(c&&(c.close(),c=null),postMessage({cmd:O,type:Ae,value:y,msg:e.code})))},o.onerror=e=>{si.debugError("worker","fetchStream, WebsocketStream socket error",e,e.toString()),u=!0,c&&(c.close(),c=null),si.isDestroyed?si.debugLog("worker","fetchStream, WebsocketStream on error and isDestroyed is true, so return"):postMessage({cmd:O,type:Le.websocketError,value:e.isTrusted?"websocket user aborted":"websocket error"})},o.onmessage=e=>{"string"!=typeof e.data?(d(e.data.byteLength),t.isFlv?c.write(e.data):t.isFmp4?si.demuxFmp4(e.data):t.isMpeg4?si.demuxMpeg4(e.data):si._opt.isNakedFlow?si.demuxNakedFlow(e.data):si.demuxM7s(e.data)):si.debugWarn("worker",`socket on message is string "${e.data}" and return`)})},demuxFlv:function*(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),r=new Uint32Array(e);for(;;){t[3]=0;const e=yield 15,i=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const n=r[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let s=r[0];const a=(yield n).slice();switch(i){case de:if(a.byteLength>0){let e=a;gr(si._opt.m7sCryptoAudio)&&(e=si.cryptoPayloadAudio(a)),si.decode(e,{type:ae,ts:s})}else si.debugWarn("worker",`demuxFlv() type is audio and payload.byteLength is ${a.byteLength} and return`);break;case le:if(a.byteLength>=6){const e=a[0];if(si._isEnhancedH265Header(e))si._decodeEnhancedH265Video(a,s);else{const e=15&a[0];let t=a[0]>>4===kt;const i=e===Re;if(yr(t)&&gr(br(a,i))&&(si.debugLog("worker","demux() isIFrame is false and unit type is IDR and update to true"),t=!0),t&&_r(a)&&null===si.isHevc){const e=15&a[0];si.isHevc=e===Re,sr=rr(a,si.isHevc),si.debugLog("worker",`demuxFlv() isVideoSequenceHeader is true and isHevc is ${si.isHevc} and nalUnitSize is ${sr}`)}t&&si.calcIframeIntervalTimestamp(s),si.isPlayer&&si.calcNetworkDelay(s),r[0]=a[4],r[1]=a[3],r[2]=a[2],r[3]=0;let n=r[0],o=si.cryptoPayload(a,t);si.decode(o,{type:oe,ts:s,isIFrame:t,cts:n})}}else si.debugWarn("worker",`demuxFlv() type is video and payload.byteLength is ${a.byteLength} and return`);break;case ce:postMessage({cmd:J,buffer:a},[a.buffer]);break;default:si.debugLog("worker",`demuxFlv() type is ${i}`)}}},decode:function(e,t){t.type===ae?si._opt.hasAudio&&(postMessage({cmd:O,type:xe,value:e.byteLength}),si.isPlayer?si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts}):si.isPlayback&&(si.isPlaybackOnlyDecodeIFrame()||(si.isPlaybackCacheBeforeDecodeForFpsRender(),si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts})))):t.type===oe&&si._opt.hasVideo&&(postMessage({cmd:O,type:Be,value:e.byteLength}),postMessage({cmd:O,type:Te,value:t.ts}),si.isPlayer?si.pushBuffer(e,{type:t.type,ts:t.ts,isIFrame:t.isIFrame,cts:t.cts}):si.isPlayback&&(si.isPlaybackOnlyDecodeIFrame()?t.isIFrame&&si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}):(si.isPlaybackCacheBeforeDecodeForFpsRender(),si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}))))},cryptoPayload:function(e,t){let r=e;return si._opt.isM7sCrypto?si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?r=zi(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc):si.debugError("worker",`isM7sCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`):si._opt.isSm4Crypto?si._opt.sm4CryptoKey?r=si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?ts(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc,si._opt.isSm4CryptoH265V2):on(e,si._opt.sm4CryptoKey,si.isHevc,si._opt.isSm4CryptoH265V2):si._opt.sm4CryptoKey||si.debugError("worker","isSm4Crypto opt.sm4CryptoKey is null"):si._opt.isXorCrypto&&(si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?r=hn(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc):si.debugError("worker",`isXorCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`)),r},cryptoPayloadAudio:function(e){let t=e;return si._opt.isM7sCrypto&&(si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?e[0]>>4===Ne&&(t=$i(e,si._opt.cryptoKey,si._opt.cryptoIV)):si.debugError("worker",`isM7sCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`)),t},setCodecAudio:function(e,t){const r=e[0]>>4,i=e[0]>>1&1;if(wr=r===Ne?i?16:8:0===i?8:16,ai&&ai.setCodec)if(qt(e)||r===Oe||r===Ge||r===He){si.debugLog("worker",`setCodecAudio: init audio codec, codeId is ${r} _opt.sampleRate is ${si._opt.sampleRate}`);const i=r===Ne?e.slice(2):new Uint8Array(0);ai.setCodec(r,si._opt.sampleRate,i),r===Ne&&postMessage({cmd:F,buffer:i},[i.buffer]),E=!0,r!==Ne&&(r===He?(si.mp3Demuxer||(si.mp3Demuxer=new ln(si),si.mp3Demuxer.on("data",((e,t)=>{ai.decode(e,t)}))),si.mp3Demuxer.dispatch(e.slice(1),t)):ai.decode(e.slice(1),t));{const e=Number("1")||1;setTimeout((()=>{si.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),si.close(),postMessage({cmd:W})}),60*e*60*1e3)}}else si.debugWarn("worker","setCodecAudio: hasInitAudioCodec is false, codecId is ",r);else si.debugError("worker","setCodecAudio: audioDecoder or audioDecoder.setCodec is null")},decodeAudio:function(e,t){if(si.isDestroyed)si.debugLog("worker","decodeAudio, decoder is destroyed and return");else if(si.isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio())ni.decodeAudio(e,t);else if(gr(r)&&gr(si._opt.mseDecodeAudio))postMessage({cmd:N,payload:e,ts:t,cts:t},[e.buffer]);else{const r=e[0]>>4;if(E){if(qt(e))return void si.debugLog("worker","decodeAudio and has already initialized and payload is aac codec packet so drop this frame");r===He?si.mp3Demuxer.dispatch(e.slice(1),t):ai.decode(r===Ne?e.slice(2):e.slice(1),t)}else si.setCodecAudio(e,t)}},setCodecVideo:function(e,t){const r=15&e[0];if(oi&&oi.setCodec)if(_r(e))if(r===Fe||r===Re){si.debugLog("worker",`setCodecVideo: init video codec , codecId is ${r}`);const t=e.slice(5);if(r===Fe&&si._opt.useSIMD){const e=kr(t);if(e.codecWidth>U||e.codecHeight>U)return postMessage({cmd:Y,value:`width: ${e.codecWidth} > 4080, height: ${e.codecHeight} > 4080`}),void si.debugWarn("worker",`setCodecVideo: SIMD H264 decode video width is too large, width is ${e.codecWidth}, height is ${e.codecHeight}`)}const i=new Uint8Array(e);S=!0,oi.setCodec(r,t),postMessage({cmd:R,code:r}),postMessage({cmd:M,buffer:i,codecId:r},[i.buffer])}else si.debugWarn("worker",`setCodecVideo: hasInitVideoCodec is false, codecId is ${r} is not H264 or H265`);else si.debugWarn("worker",`decodeVideo: hasInitVideoCodec is false, codecId is ${r} and isIFrame is ${t} and packetType is ${e[1]}`);else si.debugError("worker","setCodecVideo: videoDecoder or videoDecoder.setCodec is null")},decodeVideo:function(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(si.isDestroyed)si.debugLog("worker","decodeVideo, decoder is destroyed and return");else if(si.isPlayUseMSEAndDecoderInWorker())ni.decodeVideo(e,t,i,n);else if(gr(r))postMessage({cmd:$,payload:e,isIFrame:i,ts:t,cts:n,delay:si.delay},[e.buffer]);else if(S)if(!B&&i&&(B=!0),B){if(i&&_r(e)){const t=15&e[0];let r={};t===Fe?r=kr(e.slice(5)):t===Re&&(r=Wr(e)),r.codecWidth&&r.codecHeight&&h&&f&&(r.codecWidth!==h||r.codecHeight!==f)&&(si.debugWarn("worker",`\n decodeVideo: video width or height is changed,\n old width is ${h}, old height is ${f},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),Kt=!0,postMessage({cmd:j,value:`width: ${h}->${r.codecWidth}, height: ${f}->${r.codecHeight}`}))}if(Kt)return void si.debugWarn("worker","decodeVideo: video width or height is changed, and return");if(Qt)return void si.debugWarn("worker","decodeVideo: simd decode error, and return");if(_r(e))return void si.debugLog("worker","decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength0&&void 0!==arguments[0]&&arguments[0];si.debugLog("worker",`clearBuffer,bufferList length is ${i.length}, need clear is ${e}`),e&&(i=[]),si.isPlayer&&(si.resetAllDelay(),gr(si._opt.checkFirstIFrame)&&(si.dropping=!0,postMessage({cmd:H}))),gr(si._opt.checkFirstIFrame)&&yr(r)&&(B=!1)},dropBuffer$2:function(){if(i.length>0){let e=i.findIndex((e=>gr(e.isIFrame)&&e.type===oe));if(si.isAllIframeInBufferList())for(let t=0;t=si.getNotDroppingDelayTs()){si.debugLog("worker",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${n} and notDroppingDelayTs is ${si.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){si.isPushDropping=!0,postMessage({cmd:H});const t=i.length;i=i.slice(e);const r=i.shift();si.resetAllDelay(),si.getDelay(r.ts,r.type),si.doDecode(r),si.isPushDropping=!1,si.debugLog("worker",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,new bufferList is ${i.length} and new delay is ${si.delay} `)}else si.isPushDropping=!1}0===i.length&&(si.isPushDropping=!1)},demuxM7s:function(e){const t=new DataView(e),r=t.getUint32(1,!1),i=t.getUint8(0),n=new ArrayBuffer(4),s=new Uint32Array(n);switch(i){case ae:si.decode(new Uint8Array(e,5),{type:ae,ts:r});break;case oe:if(t.byteLength>=11){const i=new Uint8Array(e,5),n=i[0];if(si._isEnhancedH265Header(n))si._decodeEnhancedH265Video(i,r);else{const e=t.getUint8(5)>>4==1;if(e&&(si.calcIframeIntervalTimestamp(r),_r(i)&&null===si.isHevc)){const e=15&i[0];si.isHevc=e===Re}si.isPlayer&&si.calcNetworkDelay(r),s[0]=i[4],s[1]=i[3],s[2]=i[2],s[3]=0;let n=s[0],a=si.cryptoPayload(i,e);si.decode(a,{type:oe,ts:r,isIFrame:e,cts:n})}}else si.debugWarn("worker",`demuxM7s() type is video and arrayBuffer length is ${e.byteLength} and return`)}},demuxNakedFlow:function(e){Or.dispatch(e)},demuxFmp4:function(e){Gr.dispatch(e)},demuxMpeg4:function(e){jr.dispatch(e)},demuxTs:function(e){ii.dispatch(e)},_decodeEnhancedH265Video:function(e,t){const r=e[0],i=48&r,n=15&r,s=e.slice(1,5),a=new ArrayBuffer(4),o=new Uint32Array(a),d="a"==String.fromCharCode(s[0]);if(si.isHevc=yr(d),n===Rt){if(i===$t){const r=e.slice(5);if(d);else{const i=new Uint8Array(5+r.length);i.set([28,0,0,0,0],0),i.set(r,5),sr=rr(e,si.isHevc),si.debugLog("worker",`demuxFlv() isVideoSequenceHeader(enhancedH265) is true and isHevc is ${si.isHevc} and nalUnitSize is ${sr}`),si.decode(i,{type:oe,ts:t,isIFrame:!0,cts:0})}}}else if(n===Mt){let r=e,n=0;const s=i===$t;s&&si.calcIframeIntervalTimestamp(t),d||(o[0]=e[4],o[1]=e[3],o[2]=e[2],o[3]=0,n=o[0],r=Kr(e.slice(8),s),r=si.cryptoPayload(r,s),si.decode(r,{type:oe,ts:t,isIFrame:s,cts:n}))}else if(n===zt){const r=i===$t;r&&si.calcIframeIntervalTimestamp(t);let n=Kr(e.slice(5),r);n=si.cryptoPayload(n,r),si.decode(n,{type:oe,ts:t,isIFrame:r,cts:0})}},_isEnhancedH265Header:function(e){return(e&Ft)===Ft},findSei:function(e,t){let r=4;dr(sr)&&(r=sr),er(e.slice(5),r).forEach((e=>{const r=si.isHevc?e[0]>>>1&63:31&e[0];(si.isHevc&&(r===ft||r===ht)||yr(si.isHevc)&&r===Ke)&&postMessage({cmd:Z,buffer:e,ts:t},[e.buffer])}))},calcNetworkDelay:function(e){if(!(B&&e>0))return;null===Qe?(Qe=e,tt=ir()):et?r-t:0;si.networkDelay=i,i>si._opt.networkDelay&&si._opt.playType===v&&(si.debugWarn("worker",`calcNetworkDelay now dts:${e}, start dts is ${Qe} vs start is ${t},local diff is ${r} ,delay is ${i}`),postMessage({cmd:O,type:De,value:i}))},calcIframeIntervalTimestamp:function(e){null===Nt?Nt=e:Nt=si._opt.playbackForwardMaxRateDecodeIFrame&&!(si._opt.useMSE&&si._opt.mseDecodeAudio)},isPlayUseMSE:function(){return si.isPlayer&&si._opt.useMSE&&gr(r)},isPlayUseMSEAndDecoderInWorker:function(){return si.isPlayUseMSE()&&si._opt.mseDecoderUseWorker},isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio:function(){return si.isPlayUseMSEAndDecoderInWorker()&&si._opt.mseDecodeAudio},playbackUpdatePlaybackRate:function(){yr(si.isPlaybackCacheBeforeDecodeForFpsRender())&&si.clearBuffer(!0)},onOffscreenCanvasWebglContextLost:function(e){si.debugError("worker","handleOffscreenCanvasWebglContextLost and next try to create webgl"),e.preventDefault(),Wt=!0,si.webglObj.destroy(),si.webglObj=null,si.offscreenCanvasGL=null,setTimeout((()=>{si.offscreenCanvasGL=si.offscreenCanvas.getContext("webgl"),si.offscreenCanvasGL&&si.offscreenCanvasGL.getContextAttributes().stencil?(si.webglObj=p(si.offscreenCanvasGL,si._opt.openWebglAlignment),Wt=!1):si.debugError("worker","handleOffscreenCanvasWebglContextLost, stencil is false")}),500)},onOffscreenCanvasWebglContextRestored:function(e){si.debugLog("worker","handleOffscreenCanvasWebglContextRestored"),e.preventDefault()},videoInfo:function(e,t,r){postMessage({cmd:R,code:e}),postMessage({cmd:k,w:t,h:r}),h=t,f=r,si.useOffscreen()&&(si.offscreenCanvas=new OffscreenCanvas(t,r),si.offscreenCanvasGL=si.offscreenCanvas.getContext("webgl"),si.webglObj=p(si.offscreenCanvasGL,si._opt.openWebglAlignment),si.offscreenCanvas.addEventListener("webglcontextlost",si.onOffscreenCanvasWebglContextLost,!1),si.offscreenCanvas.addEventListener("webglcontextrestored",si.onOffscreenCanvasWebglContextRestored,!1))},audioInfo:function(e,t,r){postMessage({cmd:L,code:e}),postMessage({cmd:P,sampleRate:t,channels:r,depth:wr}),Tt=r},yuvData:function(t,r){if(si.isDestroyed)return void si.debugLog("worker","yuvData, decoder is destroyed and return");const i=h*f*3/2;let n=e.HEAPU8.subarray(t,t+i),s=new Uint8Array(n);if(ut=null,Ee=r,si.useOffscreen())try{if(Wt)return;si.webglObj.renderYUV(h,f,s);let e=si.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:e,delay:si.delay,ts:r},[e])}catch(e){si.debugError("worker","yuvData, transferToImageBitmap error is",e,e.toString())}else postMessage({cmd:C,output:s,delay:si.delay,ts:r},[s.buffer])},pcmData:function(e,r,i){if(si.isDestroyed)return void si.debugLog("worker","pcmData, decoder is destroyed and return");let s=r,a=[],o=0,d=si._opt.audioBufferSize;for(let r=0;r<2;r++){let i=t.HEAPU32[(e>>2)+r]>>2;a[r]=t.HEAPF32.subarray(i,i+s)}if(Ut){if(!(s>=(r=d-Ut)))return Ut+=s,n[0]=Float32Array.of(...n[0],...a[0]),void(2==Tt&&(n[1]=Float32Array.of(...n[1],...a[1])));it[0]=Float32Array.of(...n[0],...a[0].subarray(0,r)),2==Tt&&(it[1]=Float32Array.of(...n[1],...a[1].subarray(0,r))),postMessage({cmd:D,buffer:it,ts:i},it.map((e=>e.buffer))),o=r,s-=r}for(Ut=s;Ut>=d;Ut-=d)it[0]=a[0].slice(o,o+=d),2==Tt&&(it[1]=a[1].slice(o-d,o)),postMessage({cmd:D,buffer:it,ts:i},it.map((e=>e.buffer)));Ut&&(n[0]=a[0].slice(o),2==Tt&&(n[1]=a[1].slice(o))),a=[]},errorInfo:function(e){null===ut&&(ut=ir());const t=ir(),r=nr(At>0?2*At:5e3,1e3,5e3),i=t-ut;i>r&&(si.debugWarn("worker",`errorInfo() emit simdDecodeError and\n iframeIntervalTimestamp is ${At} and diff is ${i} and maxDiff is ${r}\n and replay`),Qt=!0,postMessage({cmd:q}))},sendWebsocketMessage:function(e){o?o.readyState===Ie?o.send(e):si.debugError("worker","socket is not open"):si.debugError("worker","socket is null")},timeEnd:function(){si.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),si.close(),postMessage({cmd:W})},postStreamToMain(e,t){postMessage({cmd:X,type:t,buffer:e},[e.buffer])},updatePlaybackIsPause(e){si.debugLog("worker",`updatePlaybackIsPause, isPause is ${e}`),gr(e)?si.clearPlaybackCacheLoop():si.startPlaybackCacheLoop()},debugLog(e){if(si._opt.debug&&si.debug){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:{};var t,i,n;(n=e).ready=new Promise(((e,r)=>{t=e,i=r})),(n=void 0!==n?n:{}).locateFile=function(e){return"decoder-pro-simd-mt-worker.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_SIMD_MT_WORKER_WASM_URL&&""!=JESSIBUCA_PRO_SIMD_MT_WORKER_WASM_URL?JESSIBUCA_PRO_SIMD_MT_WORKER_WASM_URL:e};var s,a,o,d=Object.assign({},n),l=(e,t)=>{throw t},c="object"==typeof window,u="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f=n.ENVIRONMENT_IS_PTHREAD||!1,p="";function m(e){return n.locateFile?n.locateFile(e,p):p+e}if(h){const{createRequire:e}=await import("module");var _=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd-mt.js",document.baseURI).href),g=_("fs"),y=_("path");let t;p=u?y.dirname(p)+"/":_("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd-mt.js",document.baseURI).href)),s=(e,t)=>(e=te(e)?new URL(e):y.normalize(e),g.readFileSync(e,t?void 0:"utf8")),o=e=>{var t=s(e,!0);return t.buffer||(t=new Uint8Array(t)),t},a=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=te(e)?new URL(e):y.normalize(e),g.readFile(e,i?void 0:"utf8",((e,n)=>{e?r(e):t(i?n.buffer:n)}))},!n.thisProgram&&process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),l=(e,t)=>{throw process.exitCode=e,t},n.inspect=()=>"[Emscripten Module object]";try{t=_("worker_threads")}catch(e){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),e}global.Worker=t.Worker}else(c||u)&&(u?p=self.location.href:"undefined"!=typeof document&&document.currentScript&&(p=document.currentScript.src),r&&(p=r),p=0!==p.indexOf("blob:")?p.substr(0,p.replace(/[?#].*/,"").lastIndexOf("/")+1):"",h||(s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},u&&(o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),a=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)}));h&&"undefined"==typeof performance&&(global.performance=_("perf_hooks").performance);var v=console.log.bind(console),b=console.error.bind(console);h&&(v=function(){for(var e=arguments.length,t=new Array(e),r=0;re.startsWith(Q),te=e=>e.startsWith("file://");function re(e){if(e==J&&w)return new Uint8Array(w);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}function ie(e){if(!w&&(c||u)){if("function"==typeof fetch&&!te(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>re(e)));if(a)return new Promise(((t,r)=>{a(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>re(e)))}function ne(e,t,r){return ie(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{U(`failed to asynchronously prepare wasm: ${e}`),Z(e)}))}function se(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||ee(t)||te(t)||h||"function"!=typeof fetch?ne(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return U(`wasm streaming compile failed: ${e}`),U("falling back to ArrayBuffer instantiation"),ne(t,r,i)}))))}function ae(){var e={a:hi};function t(e,t){return fi=e.exports,Le(fi.R),Te=fi.V,V(fi.N),E=t,X(),fi}if(K(),n.instantiateWasm)try{return n.instantiateWasm(e,t)}catch(e){U(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return se(w,J,e,(function(e){t(e.instance,e.module)})).catch(i),{}}function oe(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}n.locateFile?ee(J="decoder-pro-simd-mt-worker.wasm")||(J=m(J)):J=new URL("decoder-pro-simd-mt-worker.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd-mt.js",document.baseURI).href).href;var de=e=>{e.terminate(),e.onmessage=e=>{}},le=e=>{var t=Ae.pthreads[e];delete Ae.pthreads[e],de(t),wi(e),Ae.runningWorkers.splice(Ae.runningWorkers.indexOf(t),1),t.pthread_ptr=0},ce=e=>{Ae.pthreads[e].postMessage({cmd:"cancel"})},ue=e=>{var t=Ae.pthreads[e];Ae.returnWorkerToPool(t)},he=e=>{var t=Ae.getNewWorker();if(!t)return 6;Ae.runningWorkers.push(t),Ae.pthreads[e.pthread_ptr]=t,t.pthread_ptr=e.pthread_ptr;var r={cmd:"run",start_routine:e.startRoutine,arg:e.arg,pthread_ptr:e.pthread_ptr};return h&&t.unref(),t.postMessage(r,e.transferList),0},fe=0,pe=()=>Pe||fe>0,me="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,_e=(e,t,r)=>{for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&me)return me.decode(e.buffer instanceof SharedArrayBuffer?e.slice(t,n):e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&a)<<6|o)}else s+=String.fromCharCode(a)}return s},ge=(e,t)=>e?_e(T,e,t):"",ye=e=>{var t=Ui(),r=e();return xi(t),r},ve=function(e,t){var r=arguments.length-2,i=arguments;return ye((()=>{for(var n=r,s=Bi(8*n),a=s>>3,o=0;o{if(x=e,f)throw Be(e),"unwind";be(e)},Se=we,Ee=e=>{if(e instanceof oe||"unwind"==e)return x;l(1,e)},Ae={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init(){f?Ae.initWorker():Ae.initMainThread()},initMainThread(){for(var e=8;e--;)Ae.allocateUnusedWorker();W((()=>{K(),Ae.loadWasmModuleToAllWorkers((()=>X()))}))},initWorker(){Pe=!1},setExitStatus:e=>{x=e},terminateAllThreads__deps:["$terminateWorker"],terminateAllThreads:()=>{for(var e of Ae.runningWorkers)de(e);for(var e of Ae.unusedWorkers)de(e);Ae.unusedWorkers=[],Ae.runningWorkers=[],Ae.pthreads=[]},returnWorkerToPool:e=>{var t=e.pthread_ptr;delete Ae.pthreads[t],Ae.unusedWorkers.push(e),Ae.runningWorkers.splice(Ae.runningWorkers.indexOf(e),1),e.pthread_ptr=0,wi(t)},receiveObjectTransfer(e){},threadInitTLS(){Ae.tlsInitFunctions.forEach((e=>e()))},loadWasmModuleToWorker:e=>new Promise((t=>{e.onmessage=r=>{var i=r.data,s=i.cmd;if(i.targetThread&&i.targetThread!=_i()){var a=Ae.pthreads[i.targetThread];a?a.postMessage(i,i.transferList):U(`Internal error! Worker sent a message "${s}" to target pthread ${i.targetThread}, but that thread no longer exists!`)}else"checkMailbox"===s?Ir():"spawnThread"===s?he(i):"cleanupThread"===s?ue(i.thread):"killThread"===s?le(i.thread):"cancelThread"===s?ce(i.thread):"loaded"===s?(e.loaded=!0,h&&!e.pthread_ptr&&e.unref(),t(e)):"alert"===s?alert(`Thread ${i.threadId}: ${i.text}`):"setimmediate"===i.target?e.postMessage(i):"callHandler"===s?n[i.handler](...i.args):s&&U(`worker sent an unknown command ${s}`)},e.onerror=e=>{throw U(`worker sent an error! ${e.filename}:${e.lineno}: ${e.message}`),e},h&&(e.on("message",(t=>e.onmessage({data:t}))),e.on("error",(t=>e.onerror(t))));var r=[];for(var i of["onExit","onAbort","print","printErr"])n.hasOwnProperty(i)&&r.push(i);e.postMessage({cmd:"load",handlers:r,urlOrBlob:n.mainScriptUrlOrBlob,wasmMemory:S,wasmModule:E})})),loadWasmModuleToAllWorkers(e){if(f)return e();Promise.all(Ae.unusedWorkers.map(Ae.loadWasmModuleToWorker)).then(e)},allocateUnusedWorker(){var e;if(n.locateFile){var t=m("decoder-pro-simd-mt-worker.worker.js");e=new Worker(t,{type:"module"})}else e=new Worker(new URL("decoder-pro-simd-mt-worker.worker.js","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd-mt.js",document.baseURI).href),{type:"module"});Ae.unusedWorkers.push(e)},getNewWorker:()=>(0==Ae.unusedWorkers.length&&(Ae.allocateUnusedWorker(),Ae.loadWasmModuleToWorker(Ae.unusedWorkers[0])),Ae.unusedWorkers.pop())};n.PThread=Ae;var Ue=e=>{for(;e.length>0;)e.shift()(n)},xe=()=>{var e=_i(),t=P[e+52>>2],r=P[e+56>>2];Ai(t,t-r),xi(t)};function Be(e){if(f)return ve(1,0,e);Se(e)}n.establishStackSpace=xe;var Te,ke=[],Ce=e=>{var t=ke[e];return t||(e>=ke.length&&(ke.length=e+1),ke[e]=t=Te.get(e)),t},De=(e,t)=>{!function(e){pe()?Ae.setExitStatus(e):Si(e)}(Ce(e)(t))};n.invokeEntryPoint=De;var Pe=n.noExitRuntime||!0,Le=e=>{Ae.tlsInitFunctions.push(e)},Ie=(e,t,r,i)=>{Z(`Assertion failed: ${ge(e)}, at: `+[t?ge(t):"unknown filename",r,i?ge(i):"unknown function"])};function Fe(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){P[this.ptr+4>>2]=e},this.get_type=function(){return P[this.ptr+4>>2]},this.set_destructor=function(e){P[this.ptr+8>>2]=e},this.get_destructor=function(){return P[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,B[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=B[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,B[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=B[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){P[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return P[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Ti(this.get_type()))return P[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}var Re=(e,t,r)=>{throw new Fe(e).init(t,r),e},Me=e=>{yi(e,!u,1,!c,16777216,!1),Ae.threadInitTLS()},ze=e=>{f?postMessage({cmd:"cleanupThread",thread:e}):ue(e)};function $e(e,t,r,i){return f?ve(2,1,e,t,r,i):He(e,t,r,i)}var Ne,Oe,Ge,He=(e,t,r,i)=>{if("undefined"==typeof SharedArrayBuffer)return U("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var n=[];if(f&&0===n.length)return $e(e,t,r,i);var s={startRoutine:r,pthread_ptr:e,arg:i,transferList:n};return f?(s.cmd="spawnThread",postMessage(s,n),0):he(s)},We=(e,t,r,i,n)=>{},Ve=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Ne=e},je=e=>{for(var t="",r=e;T[r];)t+=Ne[T[r++]];return t},qe={},Ye={},Ke={},Xe=e=>{throw new Oe(e)},Ze=e=>{throw new Ge(e)},Je=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&Ze("Mismatched type converter count");for(var n=0;n{Ye.hasOwnProperty(e)?n[t]=Ye[e]:(s.push(e),qe.hasOwnProperty(e)||(qe[e]=[]),qe[e].push((()=>{n[t]=Ye[e],++a===s.length&&i(n)})))})),0===s.length&&i(n)};function Qe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||Xe(`type "${i}" must have a positive integer typeid pointer`),Ye.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;Xe(`Cannot register type '${i}' twice`)}if(Ye[e]=t,delete Ke[e],qe.hasOwnProperty(e)){var n=qe[e];delete qe[e],n.forEach((e=>e()))}}function et(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return Qe(e,t,r)}var tt,rt=8,it=(e,t,r,i)=>{et(e,{name:t=je(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:rt,readValueFromPointer:function(e){return this.fromWireType(T[e])},destructorFunction:null})},nt=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),st=e=>{Xe(e.$$.ptrType.registeredClass.name+" instance already deleted")},at=!1,ot=e=>{},dt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},lt=e=>{e.count.value-=1,0===e.count.value&&dt(e)},ct=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=ct(e,t,r.baseClass);return null===i?null:r.downcast(i)},ut={},ht=()=>Object.keys(yt).length,ft=()=>{var e=[];for(var t in yt)yt.hasOwnProperty(t)&&e.push(yt[t]);return e},pt=[],mt=()=>{for(;pt.length;){var e=pt.pop();e.$$.deleteScheduled=!1,e.delete()}},_t=e=>{tt=e,pt.length&&tt&&tt(mt)},gt=()=>{n.getInheritedInstanceCount=ht,n.getLiveInheritedInstances=ft,n.flushPendingDeletes=mt,n.setDelayFunction=_t},yt={},vt=(e,t)=>{for(void 0===t&&Xe("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},bt=(e,t)=>(t=vt(e,t),yt[t]),wt=(e,t)=>(t.ptrType&&t.ptr||Ze("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&Ze("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Et(Object.create(e,{$$:{value:t}})));function St(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=bt(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?wt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):wt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,a=this.registeredClass.getActualType(t),o=ut[a];if(!o)return n.call(this);s=this.isConst?o.constPointerType:o.pointerType;var d=ct(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?wt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):wt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}var Et=e=>"undefined"==typeof FinalizationRegistry?(Et=e=>e,e):(at=new FinalizationRegistry((e=>{lt(e.$$)})),Et=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};at.register(e,r,e)}return e},ot=e=>at.unregister(e),Et(e)),At=()=>{Object.assign(Ut.prototype,{isAliasOf(e){if(!(this instanceof Ut))return!1;if(!(e instanceof Ut))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n},clone(){if(this.$$.ptr||st(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Et(Object.create(Object.getPrototypeOf(this),{$$:{value:nt(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||st(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Xe("Object already scheduled for deletion"),ot(this),lt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||st(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Xe("Object already scheduled for deletion"),pt.push(this),1===pt.length&&tt&&tt(mt),this.$$.deleteScheduled=!0,this}})};function Ut(){}var xt=(e,t)=>Object.defineProperty(t,"name",{value:e}),Bt=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||Xe(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},Tt=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&Xe(`Cannot register public name '${e}' twice`),Bt(n,e,e),n.hasOwnProperty(r)&&Xe(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,void 0!==r&&(n[e].numArguments=r))},kt=48,Ct=57,Dt=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=kt&&t<=Ct?`_${e}`:e};function Pt(e,t,r,i,n,s,a,o){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=a,this.downcast=o,this.pureVirtualFunctions=[]}var Lt=(e,t,r)=>{for(;t!==r;)t.upcast||Xe(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function It(e,t){if(null===t)return this.isReference&&Xe(`null is not a valid ${this.name}`),0;t.$$||Xe(`Cannot pass "${hr(t)}" as a ${this.name}`),t.$$.ptr||Xe(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Lt(t.$$.ptr,r,this.registeredClass)}function Ft(e,t){var r;if(null===t)return this.isReference&&Xe(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||Xe(`Cannot pass "${hr(t)}" as a ${this.name}`),t.$$.ptr||Xe(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&Xe(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=Lt(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&Xe("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:Xe(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,lr.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:Xe("Unsupporting sharing policy")}return r}function Rt(e,t){if(null===t)return this.isReference&&Xe(`null is not a valid ${this.name}`),0;t.$$||Xe(`Cannot pass "${hr(t)}" as a ${this.name}`),t.$$.ptr||Xe(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&Xe(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Lt(t.$$.ptr,r,this.registeredClass)}function Mt(e){return this.fromWireType(P[e>>2])}var zt=()=>{Object.assign($t.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:rt,readValueFromPointer:Mt,deleteObject(e){null!==e&&e.delete()},fromWireType:St})};function $t(e,t,r,i,n,s,a,o,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=a,this.rawGetPointee=o,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=Ft:i?(this.toWireType=It,this.destructorFunction=null):(this.toWireType=Rt,this.destructorFunction=null)}var Nt,Ot=(e,t,r)=>{n.hasOwnProperty(e)||Ze("Replacing nonexistant public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},Gt=(e,t,r)=>{var i=n["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},Ht=(e,t,r)=>e.includes("j")?Gt(e,t,r):Ce(t).apply(null,r),Wt=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),Ht(e,t,r)}},Vt=(e,t)=>{var r=(e=je(e)).includes("j")?Wt(e,t):Ce(t);return"function"!=typeof r&&Xe(`unknown function pointer with signature ${e}: ${t}`),r},jt=(e,t)=>{var r=xt(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},qt=e=>{var t=gi(e),r=je(t);return pi(t),r},Yt=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Ye[t]||(Ke[t]?Ke[t].forEach(e):(r.push(t),i[t]=!0))})),new Nt(`${e}: `+r.map(qt).join([", "]))},Kt=(e,t,r,i,n,s,a,o,d,l,c,u,h)=>{c=je(c),s=Vt(n,s),o&&(o=Vt(a,o)),l&&(l=Vt(d,l)),h=Vt(u,h);var f=Dt(c);Tt(f,(function(){Yt(`Cannot construct ${c} due to unbound types`,[i])})),Je([e,t,r],i?[i]:[],(function(t){var r,n;t=t[0],n=i?(r=t.registeredClass).instancePrototype:Ut.prototype;var a=xt(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new Oe("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new Oe(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new Oe(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(n,{constructor:{value:a}});a.prototype=d;var u=new Pt(c,a,d,h,r,s,o,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new $t(c,u,!0,!1,!1),m=new $t(c+"*",u,!1,!1,!1),_=new $t(c+" const*",u,!1,!0,!1);return ut[e]={pointerType:m,constPointerType:_},Ot(f,a),[p,m,_]}))},Xt=(e,t)=>{for(var r=[],i=0;i>2]);return r},Zt=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Jt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=xt(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function Qt(e,t,r,i,n,s){var a=t.length;a<2&&Xe("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||s?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=o?1:2;l{var a=Xt(t,r);n=Vt(i,n),Je([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Oe(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Yt(`Cannot construct ${e.name} due to unbound types`,a)},Je([],a,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Qt(r,i,null,n,s),[]))),[]}))},tr=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},rr=(e,t,r,i,n,s,a,o,d)=>{var l=Xt(r,i);t=je(t),t=tr(t),s=Vt(n,s),Je([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function n(){Yt(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,c[t]=n):(Bt(c,t,i),c[t].overloadTable[r-2]=n),Je([],l,(function(n){var o=Qt(i,n,e,s,a,d);return void 0===c[t].overloadTable?(o.argCount=r-2,c[t]=o):c[t].overloadTable[r-2]=o,[]})),[]}))};function ir(){Object.assign(nr.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function nr(){this.allocated=[void 0],this.freelist=[]}var sr=new nr,ar=e=>{e>=sr.reserved&&0==--sr.get(e).refcount&&sr.free(e)},or=()=>{for(var e=0,t=sr.reserved;t{sr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),sr.reserved=sr.allocated.length,n.count_emval_handles=or},lr={toValue:e=>(e||Xe("Cannot use deleted val. handle = "+e),sr.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return sr.allocate({refcount:1,value:e})}}};function cr(e){return this.fromWireType(D[e>>2])}var ur=(e,t)=>{et(e,{name:t=je(t),fromWireType:e=>{var t=lr.toValue(e);return ar(e),t},toWireType:(e,t)=>lr.toHandle(t),argPackAdvance:rt,readValueFromPointer:cr,destructorFunction:null})},hr=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},fr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(L[e>>2])};case 8:return function(e){return this.fromWireType(I[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},pr=(e,t,r)=>{et(e,{name:t=je(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:rt,readValueFromPointer:fr(t,r),destructorFunction:null})},mr=(e,t,r)=>{switch(t){case 1:return r?e=>B[e>>0]:e=>T[e>>0];case 2:return r?e=>k[e>>1]:e=>C[e>>1];case 4:return r?e=>D[e>>2]:e=>P[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},_r=(e,t,r,i,n)=>{t=je(t);var s=e=>e;if(0===i){var a=32-8*r;s=e=>e<>>a}var o=t.includes("unsigned");et(e,{name:t,fromWireType:s,toWireType:o?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:rt,readValueFromPointer:mr(t,r,0!==i),destructorFunction:null})},gr=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=P[e>>2],r=P[e+4>>2];return new i(B.buffer,r,t)}et(e,{name:r=je(r),fromWireType:n,argPackAdvance:rt,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},yr=(e,t,r,i)=>{if(!(i>0))return 0;for(var n=r,s=r+i-1,a=0;a=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a)),o<=127){if(r>=s)break;t[r++]=o}else if(o<=2047){if(r+1>=s)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=s)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=s)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o}}return t[r]=0,r-n},vr=(e,t,r)=>yr(e,T,t,r),br=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},wr=(e,t)=>{var r="std::string"===(t=je(t));et(e,{name:t,fromWireType(e){var t,i=P[e>>2],n=e+4;if(r)for(var s=n,a=0;a<=i;++a){var o=n+a;if(a==i||0==T[o]){var d=ge(s,o-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=o+1}}else{var l=new Array(i);for(a=0;a>2]=i,r&&n)vr(t,a,i+1);else if(n)for(var o=0;o255&&(pi(a),Xe("String has UTF-16 code units that do not fit in 8 bits")),T[a+o]=d}else for(o=0;o{for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&C[i];)++i;if((r=i<<1)-e>32&&Sr)return Sr.decode(T.slice(e,r));for(var s="",a=0;!(a>=t/2);++a){var o=k[e+2*a>>1];if(0==o)break;s+=String.fromCharCode(o)}return s},Ar=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=a,t+=2}return k[t>>1]=0,t-i},Ur=e=>2*e.length,xr=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var n=D[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i},Br=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++s)),D[t>>2]=a,(t+=4)+4>n)break}return D[t>>2]=0,t-i},Tr=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},kr=(e,t,r)=>{var i,n,s,a,o;r=je(r),2===t?(i=Er,n=Ar,a=Ur,s=()=>C,o=1):4===t&&(i=xr,n=Br,a=Tr,s=()=>P,o=2),et(e,{name:r,fromWireType:e=>{for(var r,n=P[e>>2],a=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==a[c>>o]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return pi(e),r},toWireType:(e,i)=>{"string"!=typeof i&&Xe(`Cannot pass non-string to C++ string type ${r}`);var s=a(i),d=mi(4+s+t);return P[d>>2]=s>>o,n(i,d+4,s+t),null!==e&&e.push(pi,d),d},argPackAdvance:rt,readValueFromPointer:cr,destructorFunction(e){pi(e)}})},Cr=(e,t)=>{et(e,{isVoid:!0,name:t=je(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},Dr=()=>{if(!pe())try{f?Si(x):Se(x)}catch(e){Ee(e)}},Pr=e=>{if(!F)try{e(),Dr()}catch(e){Ee(e)}},Lr=e=>{if("function"==typeof Atomics.waitAsync){Atomics.waitAsync(D,e>>2,e).value.then(Ir);var t=e+128;Atomics.store(D,t>>2,1)}};n.__emscripten_thread_mailbox_await=Lr;var Ir=()=>{var e=_i();e&&(Lr(e),Pr(Ei))};n.checkMailbox=Ir;var Fr,Rr=(e,t,r)=>{if(e==t)setTimeout((()=>Ir()));else if(f)postMessage({targetThread:e,cmd:"checkMailbox"});else{var i=Ae.pthreads[e];if(!i)return;i.postMessage({cmd:"checkMailbox"})}},Mr=[],zr=(e,t,r,i)=>{Mr.length=r;for(var n=i>>3,s=0;s{h&&Ae.pthreads[e].ref()},Nr={},Or=e=>{var t=Nr[e];return void 0===t?je(e):t},Gr=[],Hr=(e,t,r,i,n)=>(e=Gr[e])(t=lr.toValue(t),t[r=Or(r)],i,n),Wr=e=>{var t=Gr.length;return Gr.push(e),t},Vr=(e,t)=>{var r=Ye[e];return void 0===r&&Xe(t+" has unknown type "+qt(e)),r},jr=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},qr=(e,t,r)=>{var i=[],n=e.toWireType(i,r);return i.length&&(P[t>>2]=lr.toHandle(i)),n},Yr=(e,t,r)=>{var i=jr(e,t),n=i.shift();e--;var s="return function (obj, func, destructorsRef, args) {\n",a=0,o=[];0===r&&o.push("obj");for(var d=["retType"],l=[n],c=0;ce.name)).join(", ")}) => ${n.name}>`;return Wr(xt(h,u))},Kr=e=>{e>4&&(sr.get(e).refcount+=1)},Xr=e=>lr.toHandle(Or(e)),Zr=()=>lr.toHandle({}),Jr=e=>lr.toHandle(ge(e)),Qr=e=>{var t=lr.toValue(e);Zt(t),ar(e)},ei=(e,t,r)=>{e=lr.toValue(e),t=lr.toValue(t),r=lr.toValue(r),e[t]=r},ti=(e,t)=>{var r=(e=Vr(e,"_emval_take_value")).readValueFromPointer(t);return lr.toHandle(r)},ri=()=>{Z("")},ii=()=>{},ni=()=>{fe+=1},si=()=>{throw ni(),"unwind"};Fr=()=>performance.timeOrigin+performance.now();var ai=e=>{Z("OOM")},oi=e=>{T.length,ai()},di=[null,[],[]],li=(e,t)=>{var r=di[e];0===t||10===t?((1===e?A:U)(_e(r,0)),r.length=0):r.push(t)};function ci(e,t,r,i){if(f)return ve(3,1,e,t,r,i);for(var n=0,s=0;s>2],o=P[t+4>>2];t+=8;for(var d=0;d>2]=n,0}Ae.init(),Ve(),Oe=n.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Ge=n.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},At(),gt(),zt(),Nt=n.UnboundTypeError=jt(Error,"UnboundTypeError"),ir(),dr();var ui=[be,Be,$e,ci],hi={e:Ie,s:Re,D:Me,m:ze,A:He,v:We,J:it,u:Kt,t:er,j:rr,I:ur,o:pr,c:_r,b:gr,p:wr,k:kr,K:Cr,x:Rr,E:zr,C:Lr,G:$r,h:Hr,d:ar,g:Yr,L:Kr,q:Xr,H:Zr,B:Jr,i:Qr,r:ei,M:ti,l:ri,n:ii,F:si,f:Fr,w:oi,z:Se,y:ci,a:S||n.wasmMemory},fi=ae(),pi=e=>(pi=fi.O)(e),mi=e=>(mi=fi.P)(e),_i=n._pthread_self=()=>(_i=n._pthread_self=fi.Q)();n.__emscripten_tls_init=()=>(n.__emscripten_tls_init=fi.R)();var gi=e=>(gi=fi.S)(e);n.__embind_initialize_bindings=()=>(n.__embind_initialize_bindings=fi.T)();var yi=n.__emscripten_thread_init=(e,t,r,i,s,a)=>(yi=n.__emscripten_thread_init=fi.U)(e,t,r,i,s,a);n.__emscripten_thread_crashed=()=>(n.__emscripten_thread_crashed=fi.W)();var vi,bi=(e,t,r,i)=>(bi=fi.X)(e,t,r,i),wi=e=>(wi=fi.Y)(e),Si=n.__emscripten_thread_exit=e=>(Si=n.__emscripten_thread_exit=fi.Z)(e),Ei=()=>(Ei=fi._)(),Ai=(e,t)=>(Ai=fi.$)(e,t),Ui=()=>(Ui=fi.aa)(),xi=e=>(xi=fi.ba)(e),Bi=e=>(Bi=fi.ca)(e),Ti=e=>(Ti=fi.da)(e);function ki(){if(!(q>0)){if(f)return t(n),G(),void startWorker(n);O(),q>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e())}function e(){vi||(vi=!0,n.calledRun=!0,F||(G(),t(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),H()))}}if(n.dynCall_jiji=(e,t,r,i,s)=>(n.dynCall_jiji=fi.ea)(e,t,r,i,s),n.___start_em_js=143516,n.___stop_em_js=143573,n.wasmMemory=S,n.keepRuntimeAlive=pe,n.ExitStatus=oe,n.PThread=Ae,Y=function e(){vi||ki(),vi||(Y=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return ki(),e.ready}),a=(()=>{var e="undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd-mt.js",document.baseURI).href;return async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var r,i,n;(n=t).ready=new Promise(((e,t)=>{r=e,i=t})),(n=void 0!==n?n:{}).locateFile=function(e){return"decoder-pro-audio.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_AUDIO_WASM_URL&&""!=JESSIBUCA_PRO_AUDIO_WASM_URL?JESSIBUCA_PRO_AUDIO_WASM_URL:e};var s,a,o,d=Object.assign({},n),l="./this.program",c="object"==typeof window,u="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";function p(e){return n.locateFile?n.locateFile(e,f):f+e}if(h){const{createRequire:e}=await import("module");var m=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd-mt.js",document.baseURI).href),_=m("fs"),g=m("path");f=u?g.dirname(f)+"/":m("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd-mt.js",document.baseURI).href)),s=(e,t)=>(e=J(e)?new URL(e):g.normalize(e),_.readFileSync(e,t?void 0:"utf8")),o=e=>{var t=s(e,!0);return t.buffer||(t=new Uint8Array(t)),t},a=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=J(e)?new URL(e):g.normalize(e),_.readFile(e,i?void 0:"utf8",((e,n)=>{e?r(e):t(i?n.buffer:n)}))},!n.thisProgram&&process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),n.inspect=()=>"[Emscripten Module object]"}else(c||u)&&(u?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),e&&(f=e),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},u&&(o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),a=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var y,v,b=n.print||console.log.bind(console),w=n.printErr||console.error.bind(console);Object.assign(n,d),d=null,n.arguments&&n.arguments,n.thisProgram&&(l=n.thisProgram),n.quit&&n.quit,n.wasmBinary&&(y=n.wasmBinary),"object"!=typeof WebAssembly&&j("no native wasm support detected");var S,E,A,U,x,B,T,k,C=!1;function D(e,t){e||j(t)}function P(){var e=v.buffer;n.HEAP8=S=new Int8Array(e),n.HEAP16=A=new Int16Array(e),n.HEAPU8=E=new Uint8Array(e),n.HEAPU16=U=new Uint16Array(e),n.HEAP32=x=new Int32Array(e),n.HEAPU32=B=new Uint32Array(e),n.HEAPF32=T=new Float32Array(e),n.HEAPF64=k=new Float64Array(e)}var L=[],I=[],F=[];function R(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)$(n.preRun.shift());ne(L)}function M(){n.noFSInit||ke.init.initialized||ke.init(),ke.ignorePermissions=!1,ne(I)}function z(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)O(n.postRun.shift());ne(F)}function $(e){L.unshift(e)}function N(e){I.unshift(e)}function O(e){F.unshift(e)}var G=0,H=null;function W(e){G++,n.monitorRunDependencies&&n.monitorRunDependencies(G)}function V(e){if(G--,n.monitorRunDependencies&&n.monitorRunDependencies(G),0==G&&H){var t=H;H=null,t()}}function j(e){n.onAbort&&n.onAbort(e),w(e="Aborted("+e+")"),C=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}var q,Y,K,X="data:application/octet-stream;base64,",Z=e=>e.startsWith(X),J=e=>e.startsWith("file://");function Q(e){if(e==q&&y)return new Uint8Array(y);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}function ee(e){if(!y&&(c||u)){if("function"==typeof fetch&&!J(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>Q(e)));if(a)return new Promise(((t,r)=>{a(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>Q(e)))}function te(e,t,r){return ee(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{w(`failed to asynchronously prepare wasm: ${e}`),j(e)}))}function re(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||Z(t)||J(t)||h||"function"!=typeof fetch?te(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return w(`wasm streaming compile failed: ${e}`),w("falling back to ArrayBuffer instantiation"),te(t,r,i)}))))}function ie(){var e={a:ni};function t(e,t){return si=e.exports,v=si.E,P(),Lt=si.H,N(si.F),V(),si}if(W(),n.instantiateWasm)try{return n.instantiateWasm(e,t)}catch(e){w(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return re(y,q,e,(function(e){t(e.instance)})).catch(i),{}}n.locateFile?Z(q="decoder-pro-audio.wasm")||(q=p(q)):q=new URL("decoder-pro-audio.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd-mt.js",document.baseURI).href).href;var ne=e=>{for(;e.length>0;)e.shift()(n)};function se(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){B[this.ptr+4>>2]=e},this.get_type=function(){return B[this.ptr+4>>2]},this.set_destructor=function(e){B[this.ptr+8>>2]=e},this.get_destructor=function(){return B[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,S[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=S[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,S[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=S[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){B[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return B[this.ptr+16>>2]},this.get_exception_ptr=function(){if(ci(this.get_type()))return B[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}n.noExitRuntime;var ae=(e,t,r)=>{throw new se(e).init(t,r),e},oe=e=>(x[oi()>>2]=e,e),de={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=de.isAbs(e),r="/"===e.substr(-1);return(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=de.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=de.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return de.normalize(e.join("/"))},join2:(e,t)=>de.normalize(e+"/"+t)},le=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}j("initRandomDevice")},ce=e=>(ce=le())(e),ue={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:ke.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=de.isAbs(i)}return(t?"/":"")+(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=ue.resolve(e).substr(1),t=ue.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),s=Math.min(i.length,n.length),a=s,o=0;o{for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&he)return he.decode(e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&a)<<6|o)}else s+=String.fromCharCode(a)}return s},pe=[],me=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},_e=(e,t,r,i)=>{if(!(i>0))return 0;for(var n=r,s=r+i-1,a=0;a=55296&&o<=57343)o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a);if(o<=127){if(r>=s)break;t[r++]=o}else if(o<=2047){if(r+1>=s)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=s)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=s)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o}}return t[r]=0,r-n};function ge(e,t,r){var i=r>0?r:me(e)+1,n=new Array(i),s=_e(e,n,0,n.length);return t&&(n.length=s),n}var ye=()=>{if(!pe.length){var e=null;if(h){var t=Buffer.alloc(256),r=0,i=process.stdin.fd;try{r=_.readSync(i,t)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}e=r>0?t.slice(0,r).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;pe=ge(e,!0)}return pe.shift()},ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},ke.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new ke.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new ke.ErrnoError(60);for(var s=0,a=0;aye(),put_char(e,t){null===t||10===t?(b(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(b(fe(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(w(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(w(fe(e.output,0)),e.output=[])}}},be=e=>{j()},we={ops_table:null,mount:e=>we.createNode(null,"/",16895,0),createNode(e,t,r,i){if(ke.isBlkdev(r)||ke.isFIFO(r))throw new ke.ErrnoError(63);we.ops_table||(we.ops_table={dir:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,lookup:we.node_ops.lookup,mknod:we.node_ops.mknod,rename:we.node_ops.rename,unlink:we.node_ops.unlink,rmdir:we.node_ops.rmdir,readdir:we.node_ops.readdir,symlink:we.node_ops.symlink},stream:{llseek:we.stream_ops.llseek}},file:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:{llseek:we.stream_ops.llseek,read:we.stream_ops.read,write:we.stream_ops.write,allocate:we.stream_ops.allocate,mmap:we.stream_ops.mmap,msync:we.stream_ops.msync}},link:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,readlink:we.node_ops.readlink},stream:{}},chrdev:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:ke.chrdev_stream_ops}});var n=ke.createNode(e,t,r,i);return ke.isDir(n.mode)?(n.node_ops=we.ops_table.dir.node,n.stream_ops=we.ops_table.dir.stream,n.contents={}):ke.isFile(n.mode)?(n.node_ops=we.ops_table.file.node,n.stream_ops=we.ops_table.file.stream,n.usedBytes=0,n.contents=null):ke.isLink(n.mode)?(n.node_ops=we.ops_table.link.node,n.stream_ops=we.ops_table.link.stream):ke.isChrdev(n.mode)&&(n.node_ops=we.ops_table.chrdev.node,n.stream_ops=we.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n,e.timestamp=n.timestamp),n},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=ke.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,ke.isDir(e.mode)?t.size=4096:ke.isFile(e.mode)?t.size=e.usedBytes:ke.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&we.resizeFileStorage(e,t.size)},lookup(e,t){throw ke.genericErrors[44]},mknod:(e,t,r,i)=>we.createNode(e,t,r,i),rename(e,t,r){if(ke.isDir(e.mode)){var i;try{i=ke.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new ke.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=ke.lookupNode(e,t);for(var i in r.contents)throw new ke.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink(e,t,r){var i=we.createNode(e,t,41471,0);return i.link=r,i},readlink(e){if(!ke.isLink(e.mode))throw new ke.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,i,n){var s=e.node.contents;if(n>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-n,i);if(a>8&&s.subarray)t.set(s.subarray(n,n+a),r);else for(var o=0;o0||r+t(we.stream_ops.write(e,t,0,i,r,!1),0)}},Se=(e,t,r,i)=>{var n=i?"":`al ${e}`;a(e,(r=>{D(r,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(r)),n&&V()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),n&&W()},Ee=(e,t,r,i,n,s)=>{ke.createDataFile(e,t,r,i,n,s)},Ae=n.preloadPlugins||[],Ue=(e,t,r,i)=>{"undefined"!=typeof Browser&&Browser.init();var n=!1;return Ae.forEach((s=>{n||s.canHandle(t)&&(s.handle(e,t,r,i),n=!0)})),n},xe=(e,t,r,i,n,s,a,o,d,l)=>{var c=t?ue.resolve(de.join2(e,t)):e;function u(r){function u(r){l&&l(),o||Ee(e,t,r,i,n,d),s&&s(),V()}Ue(r,c,u,(()=>{a&&a(),V()}))||u(r)}W(),"string"==typeof r?Se(r,(e=>u(e)),a):u(r)},Be=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t},Te=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},ke={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=ue.resolve(e)))return{path:"",node:null};if(t=Object.assign({follow_mount:!0,recurse_count:0},t),t.recurse_count>8)throw new ke.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),i=ke.root,n="/",s=0;s40)throw new ke.ErrnoError(32)}}return{path:n,node:i}},getPath(e){for(var t;;){if(ke.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,i=0;i>>0)%ke.nameTable.length},hashAddNode(e){var t=ke.hashName(e.parent.id,e.name);e.name_next=ke.nameTable[t],ke.nameTable[t]=e},hashRemoveNode(e){var t=ke.hashName(e.parent.id,e.name);if(ke.nameTable[t]===e)ke.nameTable[t]=e.name_next;else for(var r=ke.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=ke.mayLookup(e);if(r)throw new ke.ErrnoError(r,e);for(var i=ke.hashName(e.id,t),n=ke.nameTable[i];n;n=n.name_next){var s=n.name;if(n.parent.id===e.id&&s===t)return n}return ke.lookup(e,t)},createNode(e,t,r,i){var n=new ke.FSNode(e,t,r,i);return ke.hashAddNode(n),n},destroyNode(e){ke.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>ke.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){var t=ke.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{ke.lookupNode(e,t);return 20}catch(e){}return ke.nodePermissions(e,"wx")},mayDelete(e,t,r){var i;try{i=ke.lookupNode(e,t)}catch(e){return e.errno}var n=ke.nodePermissions(e,"wx");if(n)return n;if(r){if(!ke.isDir(i.mode))return 54;if(ke.isRoot(i)||ke.getPath(i)===ke.cwd())return 10}else if(ke.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?ke.isLink(e.mode)?32:ke.isDir(e.mode)&&("r"!==ke.flagsToPermissionString(t)||512&t)?31:ke.nodePermissions(e,ke.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=ke.MAX_OPEN_FDS;e++)if(!ke.streams[e])return e;throw new ke.ErrnoError(33)},getStreamChecked(e){var t=ke.getStream(e);if(!t)throw new ke.ErrnoError(8);return t},getStream:e=>ke.streams[e],createStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return ke.FSStream||(ke.FSStream=function(){this.shared={}},ke.FSStream.prototype={},Object.defineProperties(ke.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},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(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new ke.FSStream,e),-1==t&&(t=ke.nextfd()),e.fd=t,ke.streams[t]=e,e},closeStream(e){ke.streams[e]=null},chrdev_stream_ops:{open(e){var t=ke.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek(){throw new ke.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){ke.devices[e]={stream_ops:t}},getDevice:e=>ke.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),ke.syncFSRequests++,ke.syncFSRequests>1&&w(`warning: ${ke.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=ke.getMounts(ke.root.mount),i=0;function n(e){return ke.syncFSRequests--,t(e)}function s(e){if(e)return s.errored?void 0:(s.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return s(null);t.type.syncfs(t,e,s)}))},mount(e,t,r){var i,n="/"===r,s=!r;if(n&&ke.root)throw new ke.ErrnoError(10);if(!n&&!s){var a=ke.lookupPath(r,{follow_mount:!1});if(r=a.path,i=a.node,ke.isMountpoint(i))throw new ke.ErrnoError(10);if(!ke.isDir(i.mode))throw new ke.ErrnoError(54)}var o={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(o);return d.mount=o,o.root=d,n?ke.root=d:i&&(i.mounted=o,i.mount&&i.mount.mounts.push(o)),d},unmount(e){var t=ke.lookupPath(e,{follow_mount:!1});if(!ke.isMountpoint(t.node))throw new ke.ErrnoError(28);var r=t.node,i=r.mounted,n=ke.getMounts(i);Object.keys(ke.nameTable).forEach((e=>{for(var t=ke.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&ke.destroyNode(t),t=r}})),r.mounted=null;var s=r.mount.mounts.indexOf(i);r.mount.mounts.splice(s,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var i=ke.lookupPath(e,{parent:!0}).node,n=de.basename(e);if(!n||"."===n||".."===n)throw new ke.ErrnoError(28);var s=ke.mayCreate(i,n);if(s)throw new ke.ErrnoError(s);if(!i.node_ops.mknod)throw new ke.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,ke.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,ke.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),i="",n=0;n(void 0===r&&(r=t,t=438),t|=8192,ke.mknod(e,t,r)),symlink(e,t){if(!ue.resolve(e))throw new ke.ErrnoError(44);var r=ke.lookupPath(t,{parent:!0}).node;if(!r)throw new ke.ErrnoError(44);var i=de.basename(t),n=ke.mayCreate(r,i);if(n)throw new ke.ErrnoError(n);if(!r.node_ops.symlink)throw new ke.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename(e,t){var r,i,n=de.dirname(e),s=de.dirname(t),a=de.basename(e),o=de.basename(t);if(r=ke.lookupPath(e,{parent:!0}).node,i=ke.lookupPath(t,{parent:!0}).node,!r||!i)throw new ke.ErrnoError(44);if(r.mount!==i.mount)throw new ke.ErrnoError(75);var d,l=ke.lookupNode(r,a),c=ue.relative(e,s);if("."!==c.charAt(0))throw new ke.ErrnoError(28);if("."!==(c=ue.relative(t,n)).charAt(0))throw new ke.ErrnoError(55);try{d=ke.lookupNode(i,o)}catch(e){}if(l!==d){var u=ke.isDir(l.mode),h=ke.mayDelete(r,a,u);if(h)throw new ke.ErrnoError(h);if(h=d?ke.mayDelete(i,o,u):ke.mayCreate(i,o))throw new ke.ErrnoError(h);if(!r.node_ops.rename)throw new ke.ErrnoError(63);if(ke.isMountpoint(l)||d&&ke.isMountpoint(d))throw new ke.ErrnoError(10);if(i!==r&&(h=ke.nodePermissions(r,"w")))throw new ke.ErrnoError(h);ke.hashRemoveNode(l);try{r.node_ops.rename(l,i,o)}catch(e){throw e}finally{ke.hashAddNode(l)}}},rmdir(e){var t=ke.lookupPath(e,{parent:!0}).node,r=de.basename(e),i=ke.lookupNode(t,r),n=ke.mayDelete(t,r,!0);if(n)throw new ke.ErrnoError(n);if(!t.node_ops.rmdir)throw new ke.ErrnoError(63);if(ke.isMountpoint(i))throw new ke.ErrnoError(10);t.node_ops.rmdir(t,r),ke.destroyNode(i)},readdir(e){var t=ke.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new ke.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=ke.lookupPath(e,{parent:!0}).node;if(!t)throw new ke.ErrnoError(44);var r=de.basename(e),i=ke.lookupNode(t,r),n=ke.mayDelete(t,r,!1);if(n)throw new ke.ErrnoError(n);if(!t.node_ops.unlink)throw new ke.ErrnoError(63);if(ke.isMountpoint(i))throw new ke.ErrnoError(10);t.node_ops.unlink(t,r),ke.destroyNode(i)},readlink(e){var t=ke.lookupPath(e).node;if(!t)throw new ke.ErrnoError(44);if(!t.node_ops.readlink)throw new ke.ErrnoError(28);return ue.resolve(ke.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=ke.lookupPath(e,{follow:!t}).node;if(!r)throw new ke.ErrnoError(44);if(!r.node_ops.getattr)throw new ke.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>ke.stat(e,!0),chmod(e,t,r){var i;"string"==typeof e?i=ke.lookupPath(e,{follow:!r}).node:i=e;if(!i.node_ops.setattr)throw new ke.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod(e,t){ke.chmod(e,t,!0)},fchmod(e,t){var r=ke.getStreamChecked(e);ke.chmod(r.node,t)},chown(e,t,r,i){var n;"string"==typeof e?n=ke.lookupPath(e,{follow:!i}).node:n=e;if(!n.node_ops.setattr)throw new ke.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown(e,t,r){ke.chown(e,t,r,!0)},fchown(e,t,r){var i=ke.getStreamChecked(e);ke.chown(i.node,t,r)},truncate(e,t){if(t<0)throw new ke.ErrnoError(28);var r;"string"==typeof e?r=ke.lookupPath(e,{follow:!0}).node:r=e;if(!r.node_ops.setattr)throw new ke.ErrnoError(63);if(ke.isDir(r.mode))throw new ke.ErrnoError(31);if(!ke.isFile(r.mode))throw new ke.ErrnoError(28);var i=ke.nodePermissions(r,"w");if(i)throw new ke.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=ke.getStreamChecked(e);if(0==(2097155&r.flags))throw new ke.ErrnoError(28);ke.truncate(r.node,t)},utime(e,t,r){var i=ke.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new ke.ErrnoError(44);var i;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?Be(t):t)?4095&r|32768:0,"object"==typeof e)i=e;else{e=de.normalize(e);try{i=ke.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var s=!1;if(64&t)if(i){if(128&t)throw new ke.ErrnoError(20)}else i=ke.mknod(e,r,0),s=!0;if(!i)throw new ke.ErrnoError(44);if(ke.isChrdev(i.mode)&&(t&=-513),65536&t&&!ke.isDir(i.mode))throw new ke.ErrnoError(54);if(!s){var a=ke.mayOpen(i,t);if(a)throw new ke.ErrnoError(a)}512&t&&!s&&ke.truncate(i,0),t&=-131713;var o=ke.createStream({node:i,path:ke.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return o.stream_ops.open&&o.stream_ops.open(o),!n.logReadFiles||1&t||(ke.readFiles||(ke.readFiles={}),e in ke.readFiles||(ke.readFiles[e]=1)),o},close(e){if(ke.isClosed(e))throw new ke.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{ke.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(ke.isClosed(e))throw new ke.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new ke.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new ke.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,i,n){if(i<0||n<0)throw new ke.ErrnoError(28);if(ke.isClosed(e))throw new ke.ErrnoError(8);if(1==(2097155&e.flags))throw new ke.ErrnoError(8);if(ke.isDir(e.node.mode))throw new ke.ErrnoError(31);if(!e.stream_ops.read)throw new ke.ErrnoError(28);var s=void 0!==n;if(s){if(!e.seekable)throw new ke.ErrnoError(70)}else n=e.position;var a=e.stream_ops.read(e,t,r,i,n);return s||(e.position+=a),a},write(e,t,r,i,n,s){if(i<0||n<0)throw new ke.ErrnoError(28);if(ke.isClosed(e))throw new ke.ErrnoError(8);if(0==(2097155&e.flags))throw new ke.ErrnoError(8);if(ke.isDir(e.node.mode))throw new ke.ErrnoError(31);if(!e.stream_ops.write)throw new ke.ErrnoError(28);e.seekable&&1024&e.flags&&ke.llseek(e,0,2);var a=void 0!==n;if(a){if(!e.seekable)throw new ke.ErrnoError(70)}else n=e.position;var o=e.stream_ops.write(e,t,r,i,n,s);return a||(e.position+=o),o},allocate(e,t,r){if(ke.isClosed(e))throw new ke.ErrnoError(8);if(t<0||r<=0)throw new ke.ErrnoError(28);if(0==(2097155&e.flags))throw new ke.ErrnoError(8);if(!ke.isFile(e.node.mode)&&!ke.isDir(e.node.mode))throw new ke.ErrnoError(43);if(!e.stream_ops.allocate)throw new ke.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,i,n){if(0!=(2&i)&&0==(2&n)&&2!=(2097155&e.flags))throw new ke.ErrnoError(2);if(1==(2097155&e.flags))throw new ke.ErrnoError(2);if(!e.stream_ops.mmap)throw new ke.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n)},msync:(e,t,r,i,n)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new ke.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,i=ke.open(e,t.flags),n=ke.stat(e).size,s=new Uint8Array(n);return ke.read(i,s,0,n,0),"utf8"===t.encoding?r=fe(s,0):"binary"===t.encoding&&(r=s),ke.close(i),r},writeFile(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=ke.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(me(t)+1),s=_e(t,n,0,n.length);ke.write(i,n,0,s,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");ke.write(i,t,0,t.byteLength,void 0,r.canOwn)}ke.close(i)},cwd:()=>ke.currentPath,chdir(e){var t=ke.lookupPath(e,{follow:!0});if(null===t.node)throw new ke.ErrnoError(44);if(!ke.isDir(t.node.mode))throw new ke.ErrnoError(54);var r=ke.nodePermissions(t.node,"x");if(r)throw new ke.ErrnoError(r);ke.currentPath=t.path},createDefaultDirectories(){ke.mkdir("/tmp"),ke.mkdir("/home"),ke.mkdir("/home/web_user")},createDefaultDevices(){ke.mkdir("/dev"),ke.registerDevice(ke.makedev(1,3),{read:()=>0,write:(e,t,r,i,n)=>i}),ke.mkdev("/dev/null",ke.makedev(1,3)),ve.register(ke.makedev(5,0),ve.default_tty_ops),ve.register(ke.makedev(6,0),ve.default_tty1_ops),ke.mkdev("/dev/tty",ke.makedev(5,0)),ke.mkdev("/dev/tty1",ke.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=ce(e).byteLength),e[--t]);ke.createDevice("/dev","random",r),ke.createDevice("/dev","urandom",r),ke.mkdir("/dev/shm"),ke.mkdir("/dev/shm/tmp")},createSpecialDirectories(){ke.mkdir("/proc");var e=ke.mkdir("/proc/self");ke.mkdir("/proc/self/fd"),ke.mount({mount(){var t=ke.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,i=ke.getStreamChecked(r),n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return n.parent=n,n}},t}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?ke.createDevice("/dev","stdin",n.stdin):ke.symlink("/dev/tty","/dev/stdin"),n.stdout?ke.createDevice("/dev","stdout",null,n.stdout):ke.symlink("/dev/tty","/dev/stdout"),n.stderr?ke.createDevice("/dev","stderr",null,n.stderr):ke.symlink("/dev/tty1","/dev/stderr"),ke.open("/dev/stdin",0),ke.open("/dev/stdout",1),ke.open("/dev/stderr",1)},ensureErrnoError(){ke.ErrnoError||(ke.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},ke.ErrnoError.prototype=new Error,ke.ErrnoError.prototype.constructor=ke.ErrnoError,[44].forEach((e=>{ke.genericErrors[e]=new ke.ErrnoError(e),ke.genericErrors[e].stack=""})))},staticInit(){ke.ensureErrnoError(),ke.nameTable=new Array(4096),ke.mount(we,{},"/"),ke.createDefaultDirectories(),ke.createDefaultDevices(),ke.createSpecialDirectories(),ke.filesystems={MEMFS:we}},init(e,t,r){ke.init.initialized=!0,ke.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=t||n.stdout,n.stderr=r||n.stderr,ke.createStandardStreams()},quit(){ke.init.initialized=!1;for(var e=0;ethis.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},s.prototype.setDataGetter=function(e){this.getter=e},s.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,s=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,a=1048576;n||(a=i);var o=this;o.setDataGetter((e=>{var t=e*a,n=(e+1)*a-1;if(n=Math.min(n,i-1),void 0===o.chunks[e]&&(o.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==a&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):ge(n.responseText||"",!0)})(t,n)),void 0===o.chunks[e])throw new Error("doXHR failed!");return o.chunks[e]})),!s&&i||(a=i=1,i=this.getter(0).length,a=i,b("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!u)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new s;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var o={isDevice:!1,contents:a}}else o={isDevice:!1,url:r};var d=ke.createFile(e,t,o,i,n);o.contents?d.contents=o.contents:o.url&&(d.contents=null,d.url=o.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,t,r,i,n){var s=e.node.contents;if(n>=s.length)return 0;var a=Math.min(s.length-n,i);if(s.slice)for(var o=0;o{var t=d.stream_ops[e];l[e]=function(){return ke.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,n)=>(ke.forceLoadFile(d),c(e,t,r,i,n)),l.mmap=(e,t,r,i,n)=>{ke.forceLoadFile(d);var s=be();if(!s)throw new ke.ErrnoError(48);return c(e,S,s,t,r),{ptr:s,allocated:!0}},d.stream_ops=l,d}},Ce=(e,t)=>e?fe(E,e,t):"",De={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(de.isAbs(t))return t;var i;-100===e?i=ke.cwd():i=De.getStreamFromFD(e).path;if(0==t.length){if(!r)throw new ke.ErrnoError(44);return i}return de.join2(i,t)},doStat(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&de.normalize(t)!==de.normalize(ke.getPath(e.node)))return-54;throw e}x[r>>2]=i.dev,x[r+4>>2]=i.mode,B[r+8>>2]=i.nlink,x[r+12>>2]=i.uid,x[r+16>>2]=i.gid,x[r+20>>2]=i.rdev,K=[i.size>>>0,(Y=i.size,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+24>>2]=K[0],x[r+28>>2]=K[1],x[r+32>>2]=4096,x[r+36>>2]=i.blocks;var n=i.atime.getTime(),s=i.mtime.getTime(),a=i.ctime.getTime();return K=[Math.floor(n/1e3)>>>0,(Y=Math.floor(n/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+40>>2]=K[0],x[r+44>>2]=K[1],B[r+48>>2]=n%1e3*1e3,K=[Math.floor(s/1e3)>>>0,(Y=Math.floor(s/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+56>>2]=K[0],x[r+60>>2]=K[1],B[r+64>>2]=s%1e3*1e3,K=[Math.floor(a/1e3)>>>0,(Y=Math.floor(a/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+72>>2]=K[0],x[r+76>>2]=K[1],B[r+80>>2]=a%1e3*1e3,K=[i.ino>>>0,(Y=i.ino,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+88>>2]=K[0],x[r+92>>2]=K[1],0},doMsync(e,t,r,i,n){if(!ke.isFile(t.node.mode))throw new ke.ErrnoError(43);if(2&i)return 0;var s=E.slice(e,e+r);ke.msync(t,s,n,r,i)},varargs:void 0,get(){var e=x[+De.varargs>>2];return De.varargs+=4,e},getp:()=>De.get(),getStr:e=>Ce(e),getStreamFromFD:e=>ke.getStreamChecked(e)};function Pe(e,t,r){De.varargs=r;try{var i=De.getStreamFromFD(e);switch(t){case 0:if((n=De.get())<0)return-28;for(;ke.streams[n];)n++;return ke.createStream(i,n).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var n=De.get();return i.flags|=n,0;case 5:n=De.getp();return A[n+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return oe(28),-1}}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return-e.errno}}function Le(e,t,r,i){De.varargs=i;try{t=De.getStr(t),t=De.calculateAt(e,t);var n=i?De.get():0;return ke.open(t,r,n).fd}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return-e.errno}}var Ie,Fe,Re,Me=(e,t,r,i,n)=>{},ze=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Ie=e},$e=e=>{for(var t="",r=e;E[r];)t+=Ie[E[r++]];return t},Ne={},Oe={},Ge={},He=e=>{throw new Fe(e)},We=e=>{throw new Re(e)},Ve=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&We("Mismatched type converter count");for(var n=0;n{Oe.hasOwnProperty(e)?n[t]=Oe[e]:(s.push(e),Ne.hasOwnProperty(e)||(Ne[e]=[]),Ne[e].push((()=>{n[t]=Oe[e],++a===s.length&&i(n)})))})),0===s.length&&i(n)};function je(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||He(`type "${i}" must have a positive integer typeid pointer`),Oe.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;He(`Cannot register type '${i}' twice`)}if(Oe[e]=t,delete Ge[e],Ne.hasOwnProperty(e)){var n=Ne[e];delete Ne[e],n.forEach((e=>e()))}}function qe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return je(e,t,r)}var Ye,Ke=8,Xe=(e,t,r,i)=>{qe(e,{name:t=$e(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:Ke,readValueFromPointer:function(e){return this.fromWireType(E[e])},destructorFunction:null})},Ze=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Je=e=>{He(e.$$.ptrType.registeredClass.name+" instance already deleted")},Qe=!1,et=e=>{},tt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},rt=e=>{e.count.value-=1,0===e.count.value&&tt(e)},it=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=it(e,t,r.baseClass);return null===i?null:r.downcast(i)},nt={},st=()=>Object.keys(ut).length,at=()=>{var e=[];for(var t in ut)ut.hasOwnProperty(t)&&e.push(ut[t]);return e},ot=[],dt=()=>{for(;ot.length;){var e=ot.pop();e.$$.deleteScheduled=!1,e.delete()}},lt=e=>{Ye=e,ot.length&&Ye&&Ye(dt)},ct=()=>{n.getInheritedInstanceCount=st,n.getLiveInheritedInstances=at,n.flushPendingDeletes=dt,n.setDelayFunction=lt},ut={},ht=(e,t)=>{for(void 0===t&&He("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},ft=(e,t)=>(t=ht(e,t),ut[t]),pt=(e,t)=>(t.ptrType&&t.ptr||We("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!==!!t.smartPtr&&We("Both smartPtrType and smartPtr must be specified"),t.count={value:1},_t(Object.create(e,{$$:{value:t}})));function mt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ft(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?pt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):pt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,a=this.registeredClass.getActualType(t),o=nt[a];if(!o)return n.call(this);s=this.isConst?o.constPointerType:o.pointerType;var d=it(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}var _t=e=>"undefined"==typeof FinalizationRegistry?(_t=e=>e,e):(Qe=new FinalizationRegistry((e=>{rt(e.$$)})),_t=e=>{var t=e.$$;if(!!t.smartPtr){var r={$$:t};Qe.register(e,r,e)}return e},et=e=>Qe.unregister(e),_t(e)),gt=()=>{Object.assign(yt.prototype,{isAliasOf(e){if(!(this instanceof yt))return!1;if(!(e instanceof yt))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n},clone(){if(this.$$.ptr||Je(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=_t(Object.create(Object.getPrototypeOf(this),{$$:{value:Ze(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),et(this),rt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),ot.push(this),1===ot.length&&Ye&&Ye(dt),this.$$.deleteScheduled=!0,this}})};function yt(){}var vt=(e,t)=>Object.defineProperty(t,"name",{value:e}),bt=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||He(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},wt=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&He(`Cannot register public name '${e}' twice`),bt(n,e,e),n.hasOwnProperty(r)&&He(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,void 0!==r&&(n[e].numArguments=r))},St=48,Et=57,At=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=St&&t<=Et?`_${e}`:e};function Ut(e,t,r,i,n,s,a,o){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=a,this.downcast=o,this.pureVirtualFunctions=[]}var xt=(e,t,r)=>{for(;t!==r;)t.upcast||He(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function Bt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return xt(t.$$.ptr,r,this.registeredClass)}function Tt(e,t){var r;if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=xt(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&He("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,sr.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:He("Unsupporting sharing policy")}return r}function kt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return xt(t.$$.ptr,r,this.registeredClass)}function Ct(e){return this.fromWireType(B[e>>2])}var Dt=()=>{Object.assign(Pt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:Ke,readValueFromPointer:Ct,deleteObject(e){null!==e&&e.delete()},fromWireType:mt})};function Pt(e,t,r,i,n,s,a,o,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=a,this.rawGetPointee=o,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=Tt:i?(this.toWireType=Bt,this.destructorFunction=null):(this.toWireType=kt,this.destructorFunction=null)}var Lt,It,Ft=(e,t,r)=>{n.hasOwnProperty(e)||We("Replacing nonexistant public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},Rt=(e,t,r)=>{var i=n["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},Mt=[],zt=e=>{var t=Mt[e];return t||(e>=Mt.length&&(Mt.length=e+1),Mt[e]=t=Lt.get(e)),t},$t=(e,t,r)=>e.includes("j")?Rt(e,t,r):zt(t).apply(null,r),Nt=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),$t(e,t,r)}},Ot=(e,t)=>{var r=(e=$e(e)).includes("j")?Nt(e,t):zt(t);return"function"!=typeof r&&He(`unknown function pointer with signature ${e}: ${t}`),r},Gt=(e,t)=>{var r=vt(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},Ht=e=>{var t=di(e),r=$e(t);return ai(t),r},Wt=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Oe[t]||(Ge[t]?Ge[t].forEach(e):(r.push(t),i[t]=!0))})),new It(`${e}: `+r.map(Ht).join([", "]))},Vt=(e,t,r,i,n,s,a,o,d,l,c,u,h)=>{c=$e(c),s=Ot(n,s),o&&(o=Ot(a,o)),l&&(l=Ot(d,l)),h=Ot(u,h);var f=At(c);wt(f,(function(){Wt(`Cannot construct ${c} due to unbound types`,[i])})),Ve([e,t,r],i?[i]:[],(function(t){var r,n;t=t[0],n=i?(r=t.registeredClass).instancePrototype:yt.prototype;var a=vt(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new Fe("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new Fe(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new Fe(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(n,{constructor:{value:a}});a.prototype=d;var u=new Ut(c,a,d,h,r,s,o,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new Pt(c,u,!0,!1,!1),m=new Pt(c+"*",u,!1,!1,!1),_=new Pt(c+" const*",u,!1,!0,!1);return nt[e]={pointerType:m,constPointerType:_},Ft(f,a),[p,m,_]}))},jt=(e,t)=>{for(var r=[],i=0;i>2]);return r},qt=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Yt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=vt(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function Kt(e,t,r,i,n,s){var a=t.length;a<2&&He("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||s?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=o?1:2;l{var a=jt(t,r);n=Ot(i,n),Ve([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Fe(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Wt(`Cannot construct ${e.name} due to unbound types`,a)},Ve([],a,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Kt(r,i,null,n,s),[]))),[]}))},Zt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Jt=(e,t,r,i,n,s,a,o,d)=>{var l=jt(r,i);t=$e(t),t=Zt(t),s=Ot(n,s),Ve([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function n(){Wt(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,c[t]=n):(bt(c,t,i),c[t].overloadTable[r-2]=n),Ve([],l,(function(n){var o=Kt(i,n,e,s,a,d);return void 0===c[t].overloadTable?(o.argCount=r-2,c[t]=o):c[t].overloadTable[r-2]=o,[]})),[]}))};function Qt(){Object.assign(er.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function er(){this.allocated=[void 0],this.freelist=[]}var tr=new er,rr=e=>{e>=tr.reserved&&0==--tr.get(e).refcount&&tr.free(e)},ir=()=>{for(var e=0,t=tr.reserved;t{tr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),tr.reserved=tr.allocated.length,n.count_emval_handles=ir},sr={toValue:e=>(e||He("Cannot use deleted val. handle = "+e),tr.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return tr.allocate({refcount:1,value:e})}}};function ar(e){return this.fromWireType(x[e>>2])}var or=(e,t)=>{qe(e,{name:t=$e(t),fromWireType:e=>{var t=sr.toValue(e);return rr(e),t},toWireType:(e,t)=>sr.toHandle(t),argPackAdvance:Ke,readValueFromPointer:ar,destructorFunction:null})},dr=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},lr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(T[e>>2])};case 8:return function(e){return this.fromWireType(k[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},cr=(e,t,r)=>{qe(e,{name:t=$e(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Ke,readValueFromPointer:lr(t,r),destructorFunction:null})},ur=(e,t,r)=>{switch(t){case 1:return r?e=>S[e>>0]:e=>E[e>>0];case 2:return r?e=>A[e>>1]:e=>U[e>>1];case 4:return r?e=>x[e>>2]:e=>B[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},hr=(e,t,r,i,n)=>{t=$e(t);var s=e=>e;if(0===i){var a=32-8*r;s=e=>e<>>a}var o=t.includes("unsigned");qe(e,{name:t,fromWireType:s,toWireType:o?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:Ke,readValueFromPointer:ur(t,r,0!==i),destructorFunction:null})},fr=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=B[e>>2],r=B[e+4>>2];return new i(S.buffer,r,t)}qe(e,{name:r=$e(r),fromWireType:n,argPackAdvance:Ke,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},pr=(e,t,r)=>_e(e,E,t,r),mr=(e,t)=>{var r="std::string"===(t=$e(t));qe(e,{name:t,fromWireType(e){var t,i=B[e>>2],n=e+4;if(r)for(var s=n,a=0;a<=i;++a){var o=n+a;if(a==i||0==E[o]){var d=Ce(s,o-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=o+1}}else{var l=new Array(i);for(a=0;a>2]=i,r&&n)pr(t,a,i+1);else if(n)for(var o=0;o255&&(ai(a),He("String has UTF-16 code units that do not fit in 8 bits")),E[a+o]=d}else for(o=0;o{for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&U[i];)++i;if((r=i<<1)-e>32&&_r)return _r.decode(E.subarray(e,r));for(var s="",a=0;!(a>=t/2);++a){var o=A[e+2*a>>1];if(0==o)break;s+=String.fromCharCode(o)}return s},yr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=a,t+=2}return A[t>>1]=0,t-i},vr=e=>2*e.length,br=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var n=x[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i},wr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&a<=57343)a=65536+((1023&a)<<10)|1023&e.charCodeAt(++s);if(x[t>>2]=a,(t+=4)+4>n)break}return x[t>>2]=0,t-i},Sr=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},Er=(e,t,r)=>{var i,n,s,a,o;r=$e(r),2===t?(i=gr,n=yr,a=vr,s=()=>U,o=1):4===t&&(i=br,n=wr,a=Sr,s=()=>B,o=2),qe(e,{name:r,fromWireType:e=>{for(var r,n=B[e>>2],a=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==a[c>>o]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return ai(e),r},toWireType:(e,i)=>{"string"!=typeof i&&He(`Cannot pass non-string to C++ string type ${r}`);var s=a(i),d=li(4+s+t);return B[d>>2]=s>>o,n(i,d+4,s+t),null!==e&&e.push(ai,d),d},argPackAdvance:Ke,readValueFromPointer:ar,destructorFunction(e){ai(e)}})},Ar=(e,t)=>{qe(e,{isVoid:!0,name:t=$e(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},Ur={},xr=e=>{var t=Ur[e];return void 0===t?$e(e):t},Br=[],Tr=(e,t,r,i,n)=>(e=Br[e])(t=sr.toValue(t),t[r=xr(r)],i,n),kr=e=>{var t=Br.length;return Br.push(e),t},Cr=(e,t)=>{var r=Oe[e];return void 0===r&&He(t+" has unknown type "+Ht(e)),r},Dr=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},Pr=(e,t,r)=>{var i=[],n=e.toWireType(i,r);return i.length&&(B[t>>2]=sr.toHandle(i)),n},Lr=(e,t,r)=>{var i=Dr(e,t),n=i.shift();e--;var s="return function (obj, func, destructorsRef, args) {\n",a=0,o=[];0===r&&o.push("obj");for(var d=["retType"],l=[n],c=0;ce.name)).join(", ")}) => ${n.name}>`;return kr(vt(h,u))},Ir=e=>{var t=sr.toValue(e);qt(t),rr(e)},Fr=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,Rr=()=>{j("")},Mr=()=>Date.now(),zr=(e,t,r)=>E.copyWithin(e,t,t+r),$r=e=>{j("OOM")},Nr=e=>{E.length,$r()},Or={},Gr=()=>l||"./this.program",Hr=()=>{if(!Hr.strings){var e={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",_:Gr()};for(var t in Or)void 0===Or[t]?delete e[t]:e[t]=Or[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Hr.strings=r}return Hr.strings},Wr=(e,t)=>{for(var r=0;r>0]=e.charCodeAt(r);S[t>>0]=0},Vr=(e,t)=>{var r=0;return Hr().forEach(((i,n)=>{var s=t+r;B[e+4*n>>2]=s,Wr(i,s),r+=i.length+1})),0},jr=(e,t)=>{var r=Hr();B[e>>2]=r.length;var i=0;return r.forEach((e=>i+=e.length+1)),B[t>>2]=i,0};function qr(e){try{var t=De.getStreamFromFD(e);return ke.close(t),0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}function Yr(e,t){try{var r=De.getStreamFromFD(e),i=r.tty?2:ke.isDir(r.mode)?3:ke.isLink(r.mode)?7:4;return S[t>>0]=i,A[t+2>>1]=0,K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[t+8>>2]=K[0],x[t+12>>2]=K[1],K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[t+16>>2]=K[0],x[t+20>>2]=K[1],0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}var Kr=(e,t,r,i)=>{for(var n=0,s=0;s>2],o=B[t+4>>2];t+=8;var d=ke.read(e,S,a,o,i);if(d<0)return-1;if(n+=d,d>2]=s,0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}function Zr(e,t,r,i,n){var s=Fr(t,r);try{if(isNaN(s))return 61;var a=De.getStreamFromFD(e);return ke.llseek(a,s,i),K=[a.position>>>0,(Y=a.position,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[n>>2]=K[0],x[n+4>>2]=K[1],a.getdents&&0===s&&0===i&&(a.getdents=null),0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}var Jr=(e,t,r,i)=>{for(var n=0,s=0;s>2],o=B[t+4>>2];t+=8;var d=ke.write(e,S,a,o,i);if(d<0)return-1;n+=d,void 0!==i&&(i+=d)}return n};function Qr(e,t,r,i){try{var n=De.getStreamFromFD(e),s=Jr(n,t,r);return B[i>>2]=s,0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}var ei=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=ke.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},ti=365,ri=146;Object.defineProperties(ei.prototype,{read:{get:function(){return(this.mode&ti)===ti},set:function(e){e?this.mode|=ti:this.mode&=~ti}},write:{get:function(){return(this.mode&ri)===ri},set:function(e){e?this.mode|=ri:this.mode&=~ri}},isFolder:{get:function(){return ke.isDir(this.mode)}},isDevice:{get:function(){return ke.isChrdev(this.mode)}}}),ke.FSNode=ei,ke.createPreloadedFile=xe,ke.staticInit(),ze(),Fe=n.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Re=n.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},gt(),ct(),Dt(),It=n.UnboundTypeError=Gt(Error,"UnboundTypeError"),Qt(),nr();var ii,ni={o:ae,A:Pe,s:Le,q:Me,C:Xe,D:Vt,y:Xt,h:Jt,B:or,l:cr,c:hr,b:fr,m:mr,j:Er,n:Ar,f:Tr,g:rr,e:Lr,d:Ir,a:Rr,i:Mr,w:zr,r:Nr,u:Vr,v:jr,k:qr,t:Yr,z:Xr,p:Zr,x:Qr},si=ie(),ai=e=>(ai=si.G)(e),oi=()=>(oi=si.I)(),di=e=>(di=si.J)(e),li=e=>(li=si.K)(e),ci=e=>(ci=si.M)(e);function ui(){function e(){ii||(ii=!0,n.calledRun=!0,C||(M(),r(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),z()))}G>0||(R(),G>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.dynCall_viiijj=(e,t,r,i,s,a,o,d)=>(n.dynCall_viiijj=si.N)(e,t,r,i,s,a,o,d),n.dynCall_jij=(e,t,r,i)=>(n.dynCall_jij=si.O)(e,t,r,i),n.dynCall_jii=(e,t,r)=>(n.dynCall_jii=si.P)(e,t,r),n.dynCall_jiji=(e,t,r,i,s)=>(n.dynCall_jiji=si.Q)(e,t,r,i,s),H=function e(){ii||ui(),ii||(H=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return ui(),t.ready}})(),o=1e-6,d="undefined"!=typeof Float32Array?Float32Array:Array;function l(){var e=new d(16);return d!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function c(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var u,h=function(e,t,r,i,n,s,a){var o=1/(t-r),d=1/(i-n),l=1/(s-a);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*d,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*o,e[13]=(n+i)*d,e[14]=(a+s)*l,e[15]=1,e};function f(e,t,r){var i=new d(3);return i[0]=e,i[1]=t,i[2]=r,i}u=new d(3),d!=Float32Array&&(u[0]=0,u[1]=0,u[2]=0);var p=(e,t)=>{t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);const r=function(){const t=m(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),r=m(e.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))return console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(i)),null;return i}();let i={program:r,attribLocations:{vertexPosition:e.getAttribLocation(r,"aVertexPosition"),texturePosition:e.getAttribLocation(r,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(r,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(r,"uModelMatrix"),viewMatrix:e.getUniformLocation(r,"uViewMatrix"),rgbatexture:e.getUniformLocation(r,"rgbaTexture"),ytexture:e.getUniformLocation(r,"yTexture"),utexture:e.getUniformLocation(r,"uTexture"),vtexture:e.getUniformLocation(r,"vTexture"),isyuv:e.getUniformLocation(r,"isyuv")}},n=function(){const t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),e.STATIC_DRAW);var r=[];r=r.concat([0,1],[1,1],[1,0],[0,0]);const i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW);const n=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,texPosition:i,indices:n}}(),s=p(),a=p(),d=p(),u=p();function p(){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function m(t,r){const i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(console.log("An error occurred compiling the shaders: "+e.getShaderInfoLog(i)),e.deleteShader(i),null)}function _(t,r){e.viewport(0,0,t,r),e.clearColor(0,0,0,0),e.clearDepth(1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);const s=l();h(s,-1,1,-1,1,.1,100);const p=l();c(p);const m=l();!function(e,t,r,i){var n,s,a,d,l,u,h,f,p,m,_=t[0],g=t[1],y=t[2],v=i[0],b=i[1],w=i[2],S=r[0],E=r[1],A=r[2];Math.abs(_-S)32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let r=e-this._current_word_bits_left;this._fillCurrentWord();let i=Math.min(r,this._current_word_bits_left),n=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Wt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Vt=Wt,jt=Wt;function qt(e){let{profile:t,sampleRate:r,channel:i}=e;return new Uint8Array([175,0,t<<3|(14&r)>>1,(1&r)<<7|i<<3])}function Yt(e){return Kt(e)&&e[1]===Bt}function Kt(e){return e[0]>>4===Ne}const Xt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Zt(e){let t=new Uint8Array(e),r=null,i=0,n=0,s=0,a=null;if(i=n=t[0]>>>3,s=(7&t[0])<<1|t[1]>>>7,s<0||s>=Xt.length)return void console.error("Flv: AAC invalid sampling frequency index!");let o=Xt[s],d=(120&t[1])>>>3;if(d<0||d>=8)return void console.log("Flv: AAC invalid channel configuration");5===i&&(a=(7&t[1])<<1|t[2]>>>7,t[2]);let l=Nt.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?s>=6?(i=5,r=new Array(4),a=s-3):(i=2,r=new Array(2),a=s):-1!==l.indexOf("android")?(i=2,r=new Array(2),a=s):(i=5,a=s,r=new Array(4),s>=6?a=s-3:1===d&&(i=2,r=new Array(2),a=s)),r[0]=i<<3,r[0]|=(15&s)>>>1,r[1]=(15&s)<<7,r[1]|=(15&d)<<3,5===i&&(r[1]|=(15&a)>>>1,r[2]=(1&a)<<7,r[2]|=8,r[3]=0),{audioType:"aac",config:r,sampleRate:o,channelCount:d,objectType:i,codec:"mp4a.40."+i,originalCodec:"mp4a.40."+n}}class Jt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+7>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(4095===(r[t+0]<<8|r[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let r=this.current_syncword_offset_,i=(8&e[r+1])>>>3,n=(6&e[r+1])>>>1,s=1&e[r+1],a=(192&e[r+2])>>>6,o=(60&e[r+2])>>>2,d=(1&e[r+2])<<2|(192&e[r+3])>>>6,l=(3&e[r+3])<<11|e[r+4]<<3|(224&e[r+5])>>>5;if(e[r+6],r+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let c=1===s?7:9,u=l-c;r+=c;let h=this.findNextSyncwordOffset(r+u);if(this.current_syncword_offset_=h,0!==i&&1!==i||0!==n)continue;let f=e.subarray(r,r+u);t={},t.audio_object_type=a+1,t.sampling_freq_index=o,t.sampling_frequency=Vt[o],t.channel_config=d,t.data=f}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Qt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+1>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(695===(r[t+0]<<3|r[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),r=0;for(let i=0;i<=t;i++)r<<=8,r|=e.readByte();return r}readNextAACFrame(e){let t=this.data_,r=null;for(;null==r&&!this.eof_flag_;){let i=this.current_syncword_offset_,n=(31&t[i+1])<<8|t[i+2];if(i+3+n>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let s=new Ht(t.subarray(i+3,i+3+n)),a=null;if(s.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(i+3+n),s.destroy();continue}a=e}else{let e=s.readBool();if(e&&s.readBool()){console.error("audioMuxVersionA is Not Supported"),s.destroy();break}if(e&&this.getLATMValue(s),!s.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),s.destroy();break}if(0!==s.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),s.destroy();break}if(0!==s.readBits(4)){console.error("more than 2 numProgram Not Supported"),s.destroy();break}if(0!==s.readBits(3)){console.error("more than 2 numLayer Not Supported"),s.destroy();break}let t=e?this.getLATMValue(s):0,r=s.readBits(5);t-=5;let i=s.readBits(4);t-=4;let n=s.readBits(4);t-=4,s.readBits(3),t-=3,t>0&&s.readBits(t);let o=s.readBits(3);if(0!==o){console.error(`frameLengthType = ${o}. Only frameLengthType = 0 Supported`),s.destroy();break}s.readByte();let d=s.readBool();if(d)if(e)this.getLATMValue(s);else{let e=0;for(;;){e<<=8;let t=s.readBool();if(e+=s.readByte(),!t)break}console.log(e)}s.readBool()&&s.readByte(),a={},a.audio_object_type=r,a.sampling_freq_index=i,a.sampling_frequency=Vt[a.sampling_freq_index],a.channel_config=n,a.other_data_present=d}let o=0;for(;;){let e=s.readByte();if(o+=e,255!==e)break}let d=new Uint8Array(o);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function tr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return[];const r=e.length,i=[];let n,s=0;for(;s+t>>=8),s+=t,n){if(s+n>r)break;i.push(e.subarray(s,s+n)),s+=n}return i}function rr(e){const t=e.byteLength,r=new Uint8Array(4);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t;const i=new Uint8Array(t+4);return i.set(r,0),i.set(e,4),i}function ir(e,t){let r=null;return t?e.length>=28&&(r=1+(3&e[26])):e.length>=12&&(r=1+(3&e[9])),r}function nr(){return(new Date).getTime()}function sr(e,t,r){return Math.max(Math.min(e,Math.max(t,r)),Math.min(t,r))}function ar(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function or(e){let t=0,r=ar();return i=>{if(n=i,"[object Number]"!==Object.prototype.toString.call(n))return;var n;t+=i;const s=ar(),a=s-r;a>=1e3&&(e(t/a*1e3),r=s,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();function dr(e){return null==e}function lr(e){return!dr(e)}function cr(e){return"function"==typeof e}function ur(e){let t=null,r=31&e[0];return r!==We&&r!==Ve||(t=ze),t||(r=(126&e[0])>>1,r!==st&&r!==ot&&r!==lt||(t=$e)),t}function hr(){return"undefined"!=typeof WritableStream}function fr(e){e.close()}function pr(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let r=e[0],i=null,n=1;if(e.length>0){let t=e[1];t&&t.ts-r.ts>1e5&&(r=t,n=2)}if(r)for(let s=n;s=1e3){e[s-1].ts-r.ts<1e3&&(i=s+1)}}}return i}function mr(e){return e.ok&&e.status>=200&&e.status<=299}function _r(){return function(e){let t="";if("object"==typeof e)try{t=JSON.stringify(e),t=JSON.parse(t)}catch(r){t=e}else t=e;return t}(B)}function gr(e){return e[0]>>4===Tt&&e[1]===Bt}function yr(e){return!0===e||"true"===e}function vr(e){return!0!==e&&"true"!==e}function br(){return!!(Nt.Worker&&Nt.MediaSource&&"canConstructInDedicatedWorker"in Nt.MediaSource&&!0===Nt.MediaSource.canConstructInDedicatedWorker)}function wr(e,t){const r=tr(e.slice(5));let i=!1;return r.forEach((e=>{const r=t?e[0]>>>1&63:31&e[0];(t&&(r===Qe||r===tt||r===it)||vr(t)&&r===je)&&(i=!0)})),i}var Sr=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function a(e){try{d(i.next(e))}catch(e){s(e)}}function o(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}d((i=i.apply(e,t||[])).next())}))};const Er=Symbol(32),Ar=Symbol(16),Ur=Symbol(8);class xr{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return Sr(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,r)=>{var i;this.reject=r,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(i=this.pull)||void 0===i||i.call(this,e)}))}))}readU32(){return this.read(Er)}readU16(){return this.read(Ar)}readU8(){return this.read(Ur)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let r=0;const i=e=>t.length<(r=e);if("number"==typeof this.need){if(i(this.need))return;e=t.subarray(0,r)}else if(this.need===Er){if(i(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Ar){if(i(2))return;e=t[0]<<8|t[1]}else if(this.need===Ur){if(i(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(i(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,r)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(i(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,r)),e=this.need}return this.consumed+=r,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,r=t+e;if(r<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,r);else{const e=new Uint8Array(r);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,r)}return this.buffer=new Uint8Array(e),this.buffer}}xr.U32=Er,xr.U16=Ar,xr.U8=Ur;class Br{constructor(e){this.log=function(t){if(e._opt.debugLevel==S){const s=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n1?r-1:0),n=1;n1?i-1:0),s=1;s=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseSPS(e){let t=Tr._ebsp2rbsp(e),r=new Ht(t);r.readByte();let i=r.readByte();r.readByte();let n=r.readByte();r.readUEG();let s=Tr.getProfileString(i),a=Tr.getLevelString(n),o=1,d=420,l=[0,420,422,444],c=8;if((100===i||110===i||122===i||244===i||44===i||83===i||86===i||118===i||128===i||138===i||144===i)&&(o=r.readUEG(),3===o&&r.readBits(1),o<=3&&(d=l[o]),c=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool())){let e=3!==o?8:12;for(let t=0;t0&&e<16?(b=t[e-1],w=i[e-1]):255===e&&(b=r.readByte()<<8|r.readByte(),w=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);E=r.readBool(),A=t,U=2*e,S=A/U}}let x=1;1===b&&1===w||(x=b/w);let B=0,T=0;if(0===o)B=1,T=2-m;else{B=3===o?1:2,T=(1===o?2:1)*(2-m)}let k=16*(f+1),C=16*(p+1)*(2-m);k-=(_+g)*B,C-=(y+v)*T;let D=Math.ceil(k*x);return r.destroy(),r=null,{profile_string:s,level_string:a,bit_depth:c,ref_frames:h,chroma_format:d,chroma_format_string:Tr.getChromaFormatString(d),frame_rate:{fixed:E,fps:S,fps_den:U,fps_num:A},sar_ratio:{width:b,height:w},codec_size:{width:k,height:C},present_size:{width:D,height:C}}}static parseSPS$2(e){let t=e.subarray(1,4),r="avc1.";for(let e=0;e<3;e++){let i=t[e].toString(16);i.length<2&&(i="0"+i),r+=i}let i=Tr._ebsp2rbsp(e),n=new Ht(i);n.readByte();let s=n.readByte();n.readByte();let a=n.readByte();n.readUEG();let o=Tr.getProfileString(s),d=Tr.getLevelString(a),l=1,c=420,u=[0,420,422,444],h=8,f=8;if((100===s||110===s||122===s||244===s||44===s||83===s||86===s||118===s||128===s||138===s||144===s)&&(l=n.readUEG(),3===l&&n.readBits(1),l<=3&&(c=u[l]),h=n.readUEG()+8,f=n.readUEG()+8,n.readBits(1),n.readBool())){let e=3!==l?8:12;for(let t=0;t0&&e<16?(E=t[e-1],A=r[e-1]):255===e&&(E=n.readByte()<<8|n.readByte(),A=n.readByte()<<8|n.readByte())}if(n.readBool()&&n.readBool(),n.readBool()&&(n.readBits(4),n.readBool()&&n.readBits(24)),n.readBool()&&(n.readUEG(),n.readUEG()),n.readBool()){let e=n.readBits(32),t=n.readBits(32);x=n.readBool(),B=t,T=2*e,U=B/T}}let k=1;1===E&&1===A||(k=E/A);let C=0,D=0;if(0===l)C=1,D=2-y;else{C=3===l?1:2,D=(1===l?2:1)*(2-y)}let P=16*(_+1),L=16*(g+1)*(2-y);P-=(v+b)*C,L-=(w+S)*D;let I=Math.ceil(P*k);return n.destroy(),n=null,{codec_mimetype:r,profile_idc:s,level_idc:a,profile_string:o,level_string:d,chroma_format_idc:l,bit_depth:h,bit_depth_luma:h,bit_depth_chroma:f,ref_frames:m,chroma_format:c,chroma_format_string:Tr.getChromaFormatString(c),frame_rate:{fixed:x,fps:U,fps_den:T,fps_num:B},sar_ratio:{width:E,height:A},codec_size:{width:P,height:L},present_size:{width:I,height:L}}}static _skipScalingList(e,t){let r=8,i=8,n=0;for(let s=0;s=this.buflen)return this.iserro=!0,0;this.iserro=!1,r=this.bufoff+e>8?8-this.bufoff:e,t<<=r,t+=this.buffer[this.bufpos]>>8-this.bufoff-r&255>>8-r,this.bufoff+=r,e-=r,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,r=this.bufoff,i=this.read(e);return this.bufpos=t,this.bufoff=r,i}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.sps,4),t.sps=i}if(t.pps){const e=t.pps.byteLength,r=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.pps,4),t.pps=i}return t}function Dr(e){let{sps:t,pps:r}=e;const i=[23,0,0,0,0,1,66,0,30,255];i[0]=23,i[6]=t[1],i[7]=t[2],i[8]=t[3],i[10]=225,i[11]=t.byteLength>>8&255,i[12]=255&t.byteLength,i.push(...t,1,r.byteLength>>8&255,255&r.byteLength,...r);return new Uint8Array(i)}function Pr(e){let{sps:t,pps:r}=e,i=8+t.byteLength+1+2+r.byteLength,n=!1;const s=Tr.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(n=!0,i+=4);let a=new Uint8Array(i);a[0]=1,a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=255,a[5]=225;let o=t.byteLength;a[6]=o>>>8,a[7]=255&o;let d=8;a.set(t,8),d+=o,a[d]=1;let l=r.byteLength;a[d+1]=l>>>8,a[d+2]=255&l,a.set(r,d+3),d+=3+l,n&&(a[d]=252|s.chroma_format_idc,a[d+1]=248|s.bit_depth_luma-8,a[d+2]=248|s.bit_depth_chroma-8,a[d+3]=0,d+=4);const c=[23,0,0,0,0],u=new Uint8Array(c.length+a.byteLength);return u.set(c,0),u.set(a,c.length),u}function Lr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Ir(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Fr(e){return 31&e[0]}function Rr(e){return e===Ke}function Mr(e){return!function(e){return e===We||e===Ve}(e)&&!Rr(e)}function zr(e){return e===je}function $r(e){if(0===e.length)return!1;const t=Fr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=31&e[r],n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,i>=Je||0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class Or{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Gr=e=>{let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)},Hr=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Wr{static _ebsp2rbsp(e){let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseVPS(e){let t=Wr._ebsp2rbsp(e),r=new Ht(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}}static parseSPS(e){let t=Wr._ebsp2rbsp(e),r=new Ht(t);r.readByte(),r.readByte();let i=0,n=0,s=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<=16?(I=t[e-1],F=i[e-1]):255===e&&(I=r.readBits(16),F=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()){r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())}if(r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG()),r.readBool()){if(M=r.readBits(32),z=r.readBits(32),r.readBool()&&r.readUEG(),r.readBool()){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=o;n++){let n=r.readBool();R=n;let s=!0,a=1;n||(s=r.readBool());let o=!1;if(s?r.readUEG():o=r.readBool(),o||(a=r.readUEG()+1),e){for(let e=0;e>6&3,r.general_tier_flag=e[1]>>5&1,r.general_profile_idc=31&e[1],r.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],r.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],r.general_constraint_indicator_flags=r.general_constraint_indicator_flags<<16|e[10]<<8|e[11],r.general_level_idc=e[12],r.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],r.parallelismType=3&e[15],r.chromaFormat=3&e[16],r.bitDepthLumaMinus8=7&e[17],r.bitDepthChromaMinus8=7&e[18],r.avgFrameRate=e[19]<<8|e[20],r.constantFrameRate=e[21]>>6&3,r.numTemporalLayers=e[21]>>3&7,r.temporalIdNested=e[21]>>2&1,r.lengthSizeMinusOne=3&e[21];let i=e[22],n=e.slice(23);for(let e=0;e0)for(let t=r;t<8;t++)e.read(2);i.sub_layer_profile_space=[],i.sub_layer_tier_flag=[],i.sub_layer_profile_idc=[],i.sub_layer_profile_compatibility_flag=[],i.sub_layer_progressive_source_flag=[],i.sub_layer_interlaced_source_flag=[],i.sub_layer_non_packed_constraint_flag=[],i.sub_layer_frame_only_constraint_flag=[],i.sub_layer_level_idc=[];for(let t=0;t{let t=Gr(e),r=new Ht(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}})(t),a=(e=>{let t=Gr(e),r=new Ht(t);r.readByte(),r.readByte();let i=0,n=0,s=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<16?(I=t[e-1],F=i[e-1]):255===e&&(I=r.readBits(16),F=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(i+=r.readUEG(),n+=r.readUEG(),s+=r.readUEG(),a+=r.readUEG()),r.readBool()&&(M=r.readBits(32),z=r.readBits(32),r.readBool()&&(r.readUEG(),r.readBool()))){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=o;n++){let n=r.readBool();R=n;let s=!1,a=1;n||(s=r.readBool());let o=!1;if(s?r.readSEG():o=r.readBool(),o||(cpbcnt=r.readUEG()+1),e)for(let e=0;e{let t=Gr(e),r=new Ht(t);r.readByte(),r.readByte(),r.readUEG(),r.readUEG(),r.readBool(),r.readBool(),r.readBits(3),r.readBool(),r.readBool(),r.readUEG(),r.readUEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool()&&r.readUEG(),r.readSEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool(),r.readBool();let i=r.readBool(),n=r.readBool(),s=1;return n&&i?s=0:n?s=3:i&&(s=2),{parallelismType:s}})(r);n=Object.assign(n,s,a,o);let d=23+(5+t.byteLength)+(5+i.byteLength)+(5+r.byteLength),l=new Uint8Array(d);l[0]=1,l[1]=(3&n.general_profile_space)<<6|(n.general_tier_flag?1:0)<<5|31&n.general_profile_idc,l[2]=n.general_profile_compatibility_flags_1||0,l[3]=n.general_profile_compatibility_flags_2||0,l[4]=n.general_profile_compatibility_flags_3||0,l[5]=n.general_profile_compatibility_flags_4||0,l[6]=n.general_constraint_indicator_flags_1||0,l[7]=n.general_constraint_indicator_flags_2||0,l[8]=n.general_constraint_indicator_flags_3||0,l[9]=n.general_constraint_indicator_flags_4||0,l[10]=n.general_constraint_indicator_flags_5||0,l[11]=n.general_constraint_indicator_flags_6||0,l[12]=60,l[13]=240|(3840&n.min_spatial_segmentation_idc)>>8,l[14]=255&n.min_spatial_segmentation_idc,l[15]=252|3&n.parallelismType,l[16]=252|3&n.chroma_format_idc,l[17]=248|7&n.bit_depth_luma_minus8,l[18]=248|7&n.bit_depth_chroma_minus8,l[19]=0,l[20]=0,l[21]=(3&n.constant_frame_rate)<<6|(7&n.num_temporal_layers)<<3|(n.temporal_id_nested?1:0)<<2|3,l[22]=3,l[23]=128|st,l[24]=0,l[25]=1,l[26]=(65280&t.byteLength)>>8,l[27]=(255&t.byteLength)>>0,l.set(t,28),l[23+(5+t.byteLength)+0]=128|ot,l[23+(5+t.byteLength)+1]=0,l[23+(5+t.byteLength)+2]=1,l[23+(5+t.byteLength)+3]=(65280&i.byteLength)>>8,l[23+(5+t.byteLength)+4]=(255&i.byteLength)>>0,l.set(i,23+(5+t.byteLength)+5),l[23+(5+t.byteLength+5+i.byteLength)+0]=128|lt,l[23+(5+t.byteLength+5+i.byteLength)+1]=0,l[23+(5+t.byteLength+5+i.byteLength)+2]=1,l[23+(5+t.byteLength+5+i.byteLength)+3]=(65280&r.byteLength)>>8,l[23+(5+t.byteLength+5+i.byteLength)+4]=(255&r.byteLength)>>0,l.set(r,23+(5+t.byteLength+5+i.byteLength)+5);const c=[28,0,0,0,0],u=new Uint8Array(c.length+l.byteLength);return u.set(c,0),u.set(l,c.length),u}function Kr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Xr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Zr(e){return(126&e[0])>>1}function Jr(e){return e===ut}function Qr(e){return!function(e){return e>=32&&e<=40}(e)}function ei(e){return e>=16&&e<=21}function ti(e){if(0===e.length)return!1;const t=Zr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=e[r]>>1&63,n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class ii{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}function ni(e){return parseInt(e)===e}function si(e){if(!ni(e.length))return!1;for(var t=0;t255)return!1;return!0}function ai(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!si(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(ni(e.length)&&si(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function oi(e){return new Uint8Array(e)}function di(e,t,r,i,n){null==i&&null==n||(e=e.slice?e.slice(i,n):Array.prototype.slice.call(e,i,n)),t.set(e,r)}var li,ci={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},ui=(li="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r>4]+li[15&i])}return t.join("")}}),hi={16:10,24:12,32:14},fi=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],pi=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],mi=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],_i=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],gi=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],yi=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],vi=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],bi=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],wi=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],Si=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Ei=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Ai=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Ui=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],xi=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Bi=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Ti(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=s[t],this._Kd[e-r][t%4]=s[t];for(var a,o=0,d=n;d>16&255]<<24^pi[a>>8&255]<<16^pi[255&a]<<8^pi[a>>24&255]^fi[o]<<24,o+=1,8!=n)for(t=1;t>8&255]<<8^pi[a>>16&255]<<16^pi[a>>24&255]<<24;for(t=n/2+1;t>2,c=d%4,this._Ke[l][c]=s[t],this._Kd[e-l][c]=s[t++],d++}for(var l=1;l>24&255]^Ui[a>>16&255]^xi[a>>8&255]^Bi[255&a]},ki.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=Ti(e),n=0;n<4;n++)i[n]^=this._Ke[0][n];for(var s=1;s>24&255]^gi[i[(n+1)%4]>>16&255]^yi[i[(n+2)%4]>>8&255]^vi[255&i[(n+3)%4]]^this._Ke[s][n];i=r.slice()}var a,o=oi(16);for(n=0;n<4;n++)a=this._Ke[t][n],o[4*n]=255&(pi[i[n]>>24&255]^a>>24),o[4*n+1]=255&(pi[i[(n+1)%4]>>16&255]^a>>16),o[4*n+2]=255&(pi[i[(n+2)%4]>>8&255]^a>>8),o[4*n+3]=255&(pi[255&i[(n+3)%4]]^a);return o},ki.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=Ti(e),n=0;n<4;n++)i[n]^=this._Kd[0][n];for(var s=1;s>24&255]^wi[i[(n+3)%4]>>16&255]^Si[i[(n+2)%4]>>8&255]^Ei[255&i[(n+1)%4]]^this._Kd[s][n];i=r.slice()}var a,o=oi(16);for(n=0;n<4;n++)a=this._Kd[t][n],o[4*n]=255&(mi[i[n]>>24&255]^a>>24),o[4*n+1]=255&(mi[i[(n+3)%4]>>16&255]^a>>16),o[4*n+2]=255&(mi[i[(n+2)%4]>>8&255]^a>>8),o[4*n+3]=255&(mi[255&i[(n+1)%4]]^a);return o};var Ci=function(e){if(!(this instanceof Ci))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new ki(e)};Ci.prototype.encrypt=function(e){if((e=ai(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=oi(e.length),r=oi(16),i=0;iNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},Ii.prototype.setBytes=function(e){if(16!=(e=ai(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Ii.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var Fi=function(e,t){if(!(this instanceof Fi))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Ii||(t=new Ii(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new ki(e)};Fi.prototype.encrypt=function(e){for(var t=ai(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,i=0;i>>2]>>>24-s%4*8&255;t[i+s>>>2]|=a<<24-(i+s)%4*8}else for(var o=0;o>>2]=r[o>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-n%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new l.init(r,t/2)}},h=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new l.init(r,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,n=i.words,s=i.sigBytes,a=this.blockSize,o=s/(4*a),d=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*a,c=e.min(4*d,s);if(d){for(var u=0;u>>2]|=e[n]<<24-n%4*8;t.call(this,i,r)}else t.apply(this,arguments)};i.prototype=e}}(),r.lib.WordArray)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.WordArray,i=e.enc;function n(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var r=e.length,i=[],n=0;n>>1]|=e.charCodeAt(n)<<16-n%2*16;return t.create(i,2*r)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s>>2]>>>16-s%4*8&65535);i.push(String.fromCharCode(a))}return i.join("")},parse:function(e){for(var r=e.length,i=[],s=0;s>>1]|=n(e.charCodeAt(s)<<16-s%2*16);return t.create(i,2*r)}}}(),r.enc.Utf16)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.WordArray;function i(e,r,i){for(var n=[],s=0,a=0;a>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var n=[],s=0;s>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,o=0;o<4&&s+.75*o>>6*(3-o)&63));var d=i.charAt(64);if(d)for(;n.length%4;)n.push(d);return n.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var s=0;s>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,n=t?this._safe_map:this._map;e.clamp();for(var s=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,d=0;d<4&&a+.75*d>>6*(3-d)&63));var l=n.charAt(64);if(l)for(;s.length%4;)s.push(l);return s.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,n=t?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var a=0;a>>24)|4278255360&(n<<24|n>>>8)}var s=this._hash.words,a=e[t+0],d=e[t+1],f=e[t+2],p=e[t+3],m=e[t+4],_=e[t+5],g=e[t+6],y=e[t+7],v=e[t+8],b=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],A=e[t+13],U=e[t+14],x=e[t+15],B=s[0],T=s[1],k=s[2],C=s[3];B=l(B,T,k,C,a,7,o[0]),C=l(C,B,T,k,d,12,o[1]),k=l(k,C,B,T,f,17,o[2]),T=l(T,k,C,B,p,22,o[3]),B=l(B,T,k,C,m,7,o[4]),C=l(C,B,T,k,_,12,o[5]),k=l(k,C,B,T,g,17,o[6]),T=l(T,k,C,B,y,22,o[7]),B=l(B,T,k,C,v,7,o[8]),C=l(C,B,T,k,b,12,o[9]),k=l(k,C,B,T,w,17,o[10]),T=l(T,k,C,B,S,22,o[11]),B=l(B,T,k,C,E,7,o[12]),C=l(C,B,T,k,A,12,o[13]),k=l(k,C,B,T,U,17,o[14]),B=c(B,T=l(T,k,C,B,x,22,o[15]),k,C,d,5,o[16]),C=c(C,B,T,k,g,9,o[17]),k=c(k,C,B,T,S,14,o[18]),T=c(T,k,C,B,a,20,o[19]),B=c(B,T,k,C,_,5,o[20]),C=c(C,B,T,k,w,9,o[21]),k=c(k,C,B,T,x,14,o[22]),T=c(T,k,C,B,m,20,o[23]),B=c(B,T,k,C,b,5,o[24]),C=c(C,B,T,k,U,9,o[25]),k=c(k,C,B,T,p,14,o[26]),T=c(T,k,C,B,v,20,o[27]),B=c(B,T,k,C,A,5,o[28]),C=c(C,B,T,k,f,9,o[29]),k=c(k,C,B,T,y,14,o[30]),B=u(B,T=c(T,k,C,B,E,20,o[31]),k,C,_,4,o[32]),C=u(C,B,T,k,v,11,o[33]),k=u(k,C,B,T,S,16,o[34]),T=u(T,k,C,B,U,23,o[35]),B=u(B,T,k,C,d,4,o[36]),C=u(C,B,T,k,m,11,o[37]),k=u(k,C,B,T,y,16,o[38]),T=u(T,k,C,B,w,23,o[39]),B=u(B,T,k,C,A,4,o[40]),C=u(C,B,T,k,a,11,o[41]),k=u(k,C,B,T,p,16,o[42]),T=u(T,k,C,B,g,23,o[43]),B=u(B,T,k,C,b,4,o[44]),C=u(C,B,T,k,E,11,o[45]),k=u(k,C,B,T,x,16,o[46]),B=h(B,T=u(T,k,C,B,f,23,o[47]),k,C,a,6,o[48]),C=h(C,B,T,k,y,10,o[49]),k=h(k,C,B,T,U,15,o[50]),T=h(T,k,C,B,_,21,o[51]),B=h(B,T,k,C,E,6,o[52]),C=h(C,B,T,k,p,10,o[53]),k=h(k,C,B,T,w,15,o[54]),T=h(T,k,C,B,d,21,o[55]),B=h(B,T,k,C,v,6,o[56]),C=h(C,B,T,k,x,10,o[57]),k=h(k,C,B,T,g,15,o[58]),T=h(T,k,C,B,A,21,o[59]),B=h(B,T,k,C,m,6,o[60]),C=h(C,B,T,k,S,10,o[61]),k=h(k,C,B,T,f,15,o[62]),T=h(T,k,C,B,b,21,o[63]),s[0]=s[0]+B|0,s[1]=s[1]+T|0,s[2]=s[2]+k|0,s[3]=s[3]+C|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;r[n>>>5]|=128<<24-n%32;var s=e.floor(i/4294967296),a=i;r[15+(n+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var o=this._hash,d=o.words,l=0;l<4;l++){var c=d[l];d[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return o},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,i,n,s,a){var o=e+(t&r|~t&i)+n+a;return(o<>>32-s)+t}function c(e,t,r,i,n,s,a){var o=e+(t&i|r&~i)+n+a;return(o<>>32-s)+t}function u(e,t,r,i,n,s,a){var o=e+(t^r^i)+n+a;return(o<>>32-s)+t}function h(e,t,r,i,n,s,a){var o=e+(r^(t|~i))+n+a;return(o<>>32-s)+t}t.MD5=s._createHelper(d),t.HmacMD5=s._createHmacHelper(d)}(Math),r.MD5)})),Gt((function(e,t){var r,i,n,s,a,o,d,l;e.exports=(i=(r=l=Mi).lib,n=i.WordArray,s=i.Hasher,a=r.algo,o=[],d=a.SHA1=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],d=r[4],l=0;l<80;l++){if(l<16)o[l]=0|e[t+l];else{var c=o[l-3]^o[l-8]^o[l-14]^o[l-16];o[l]=c<<1|c>>>31}var u=(i<<5|i>>>27)+d+o[l];u+=l<20?1518500249+(n&s|~n&a):l<40?1859775393+(n^s^a):l<60?(n&s|n&a|s&a)-1894007588:(n^s^a)-899497514,d=a,a=s,s=n<<30|n>>>2,n=i,i=u}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+d|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=s._createHelper(d),r.HmacSHA1=s._createHmacHelper(d),l.SHA1)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,a=t.algo,o=[],d=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,n=0;n<64;)t(i)&&(n<8&&(o[n]=r(e.pow(i,.5))),d[n]=r(e.pow(i,1/3)),n++),i++}();var l=[],c=a.SHA256=s.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,_=l[f-2],g=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;l[f]=m+l[f-7]+g+l[f-16]}var y=i&n^i&s^n&s,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=h+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&c^~o&u)+d[f]+l[f];h=u,u=c,c=o,o=a+b|0,a=s,s=n,n=i,i=b+(v+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+o|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=s._createHelper(c),t.HmacSHA256=s._createHmacHelper(c)}(Math),r.SHA256)})),Gt((function(e,t){var r,i,n,s,a,o;e.exports=(i=(r=o=Mi).lib.WordArray,n=r.algo,s=n.SHA256,a=n.SHA224=s.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=s._createHelper(a),r.HmacSHA224=s._createHmacHelper(a),o.SHA224)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.Hasher,i=e.x64,n=i.Word,s=i.WordArray,a=e.algo;function o(){return n.create.apply(n,arguments)}var d=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=o()}();var c=a.SHA512=t.extend({_doReset:function(){this._hash=new s.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=i.high,p=i.low,m=n.high,_=n.low,g=s.high,y=s.low,v=a.high,b=a.low,w=o.high,S=o.low,E=c.high,A=c.low,U=u.high,x=u.low,B=h.high,T=h.low,k=f,C=p,D=m,P=_,L=g,I=y,F=v,R=b,M=w,z=S,$=E,N=A,O=U,G=x,H=B,W=T,V=0;V<80;V++){var j,q,Y=l[V];if(V<16)q=Y.high=0|e[t+2*V],j=Y.low=0|e[t+2*V+1];else{var K=l[V-15],X=K.high,Z=K.low,J=(X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7,Q=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),ee=l[V-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ne=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),se=l[V-7],ae=se.high,oe=se.low,de=l[V-16],le=de.high,ce=de.low;q=(q=(q=J+ae+((j=Q+oe)>>>0>>0?1:0))+ie+((j+=ne)>>>0>>0?1:0))+le+((j+=ce)>>>0>>0?1:0),Y.high=q,Y.low=j}var ue,he=M&$^~M&O,fe=z&N^~z&G,pe=k&D^k&L^D&L,me=C&P^C&I^P&I,_e=(k>>>28|C<<4)^(k<<30|C>>>2)^(k<<25|C>>>7),ge=(C>>>28|k<<4)^(C<<30|k>>>2)^(C<<25|k>>>7),ye=(M>>>14|z<<18)^(M>>>18|z<<14)^(M<<23|z>>>9),ve=(z>>>14|M<<18)^(z>>>18|M<<14)^(z<<23|M>>>9),be=d[V],we=be.high,Se=be.low,Ee=H+ye+((ue=W+ve)>>>0>>0?1:0),Ae=ge+me;H=O,W=G,O=$,G=N,$=M,N=z,M=F+(Ee=(Ee=(Ee=Ee+he+((ue+=fe)>>>0>>0?1:0))+we+((ue+=Se)>>>0>>0?1:0))+q+((ue+=j)>>>0>>0?1:0))+((z=R+ue|0)>>>0>>0?1:0)|0,F=L,R=I,L=D,I=P,D=k,P=C,k=Ee+(_e+pe+(Ae>>>0>>0?1:0))+((C=ue+Ae|0)>>>0>>0?1:0)|0}p=i.low=p+C,i.high=f+k+(p>>>0>>0?1:0),_=n.low=_+P,n.high=m+D+(_>>>0

>>0?1:0),y=s.low=y+I,s.high=g+L+(y>>>0>>0?1:0),b=a.low=b+R,a.high=v+F+(b>>>0>>0?1:0),S=o.low=S+z,o.high=w+M+(S>>>0>>0?1:0),A=c.low=A+N,c.high=E+$+(A>>>0>>0?1:0),x=u.low=x+G,u.high=U+O+(x>>>0>>0?1:0),T=h.low=T+W,h.high=B+H+(T>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(c),e.HmacSHA512=t._createHmacHelper(c)}(),r.SHA512)})),Gt((function(e,t){var r,i,n,s,a,o,d,l;e.exports=(i=(r=l=Mi).x64,n=i.Word,s=i.WordArray,a=r.algo,o=a.SHA512,d=a.SHA384=o.extend({_doReset:function(){this._hash=new s.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=o._createHelper(d),r.HmacSHA384=o._createHmacHelper(d),l.SHA384)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,a=t.x64.Word,o=t.algo,d=[],l=[],c=[];!function(){for(var e=1,t=0,r=0;r<24;r++){d[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var n=1,s=0;s<24;s++){for(var o=0,u=0,h=0;h<7;h++){if(1&n){var f=(1<>>24)|4278255360&(s<<24|s>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(T=r[n]).high^=a,T.low^=s}for(var o=0;o<24;o++){for(var h=0;h<5;h++){for(var f=0,p=0,m=0;m<5;m++)f^=(T=r[h+5*m]).high,p^=T.low;var _=u[h];_.high=f,_.low=p}for(h=0;h<5;h++){var g=u[(h+4)%5],y=u[(h+1)%5],v=y.high,b=y.low;for(f=g.high^(v<<1|b>>>31),p=g.low^(b<<1|v>>>31),m=0;m<5;m++)(T=r[h+5*m]).high^=f,T.low^=p}for(var w=1;w<25;w++){var S=(T=r[w]).high,E=T.low,A=d[w];A<32?(f=S<>>32-A,p=E<>>32-A):(f=E<>>64-A,p=S<>>64-A);var U=u[l[w]];U.high=f,U.low=p}var x=u[0],B=r[0];for(x.high=B.high,x.low=B.low,h=0;h<5;h++)for(m=0;m<5;m++){var T=r[w=h+5*m],k=u[w],C=u[(h+1)%5+5*m],D=u[(h+2)%5+5*m];T.high=k.high^~C.high&D.high,T.low=k.low^~C.low&D.low}T=r[0];var P=c[o];T.high^=P.high,T.low^=P.low}},_doFinalize:function(){var t=this._data,r=t.words;this._nDataBytes;var i=8*t.sigBytes,s=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/s)*s>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,o=this.cfg.outputLength/8,d=o/8,l=[],c=0;c>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(h)}return new n.init(l,o)},clone:function(){for(var e=s.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=s._createHelper(h),t.HmacSHA3=s._createHmacHelper(h)}(Math),r.SHA3)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,a=t.algo,o=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=n.create([0,1518500249,1859775393,2400959708,2840853838]),h=n.create([1352829926,1548603684,1836072691,2053994217,0]),f=a.RIPEMD160=s.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s,a,f,b,w,S,E,A,U,x,B,T=this._hash.words,k=u.words,C=h.words,D=o.words,P=d.words,L=l.words,I=c.words;for(S=s=T[0],E=a=T[1],A=f=T[2],U=b=T[3],x=w=T[4],r=0;r<80;r+=1)B=s+e[t+D[r]]|0,B+=r<16?p(a,f,b)+k[0]:r<32?m(a,f,b)+k[1]:r<48?_(a,f,b)+k[2]:r<64?g(a,f,b)+k[3]:y(a,f,b)+k[4],B=(B=v(B|=0,L[r]))+w|0,s=w,w=b,b=v(f,10),f=a,a=B,B=S+e[t+P[r]]|0,B+=r<16?y(E,A,U)+C[0]:r<32?g(E,A,U)+C[1]:r<48?_(E,A,U)+C[2]:r<64?m(E,A,U)+C[3]:p(E,A,U)+C[4],B=(B=v(B|=0,I[r]))+x|0,S=x,x=U,U=v(A,10),A=E,E=B;B=T[1]+f+U|0,T[1]=T[2]+b+x|0,T[2]=T[3]+w+S|0,T[3]=T[4]+s+E|0,T[4]=T[0]+a+A|0,T[0]=B},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var n=this._hash,s=n.words,a=0;a<5;a++){var o=s[a];s[a]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return n},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function m(e,t,r){return e&t|~e&r}function _(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function v(e,t){return e<>>32-t}t.RIPEMD160=s._createHelper(f),t.HmacRIPEMD160=s._createHmacHelper(f)}(),r.RIPEMD160)})),Gt((function(e,t){var r,i,n;e.exports=(i=(r=Mi).lib.Base,n=r.enc.Utf8,void(r.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),a=this._iKey=t.clone(),o=s.words,d=a.words,l=0;l>>2];e.sigBytes-=t}};i.BlockCipher=c.extend({cfg:c.cfg.extend({mode:f,padding:p}),reset:function(){var e;c.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=i.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?s.create([1398893684,1701076831]).concat(r).concat(t):t).toString(d)},parse:function(e){var t,r=d.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=s.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),m.create({ciphertext:r,salt:t})}},g=i.SerializableCipher=n.extend({cfg:n.extend({format:_}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),s=n.finalize(t),a=n.cfg;return m.create({ciphertext:s,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,i,n){if(i||(i=s.random(8)),n)a=l.create({keySize:t+r,hasher:n}).compute(e,i);else var a=l.create({keySize:t+r}).compute(e,i);var o=s.create(a.words.slice(t),4*r);return a.sigBytes=4*t,m.create({key:a,iv:o,salt:i})}},v=i.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=n.iv;var s=g.encrypt.call(this,e,t,n.key,i);return s.mixIn(n),s},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=n.iv,g.decrypt.call(this,e,t,n.key,i)}})}())})),Gt((function(e,t){var r;e.exports=((r=Mi).mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,i){var n,s=this._iv;s?(n=s.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var a=0;a>24&255)){var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}else e+=1<<24;return e}function i(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var n=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,s=this._iv,a=this._counter;s&&(a=this._counter=s.slice(0),this._iv=void 0),i(a);var o=a.slice(0);r.encryptBlock(o,0);for(var d=0;d>>2]|=n<<24-s%4*8,e.sigBytes+=n},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),Gt((function(e,t){var r;e.exports=((r=Mi).pad.Iso10126={pad:function(e,t){var i=4*t,n=i-e.sigBytes%i;e.concat(r.lib.WordArray.random(n-1)).concat(r.lib.WordArray.create([n<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),Gt((function(e,t){var r;e.exports=((r=Mi).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),Gt((function(e,t){var r;e.exports=((r=Mi).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)})),Gt((function(e,t){var r;e.exports=((r=Mi).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib.CipherParams,n=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return i.create({ciphertext:t})}}}(),r.format.Hex)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.BlockCipher,i=e.algo,n=[],s=[],a=[],o=[],d=[],l=[],c=[],u=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,n[r]=p,s[p]=r;var m=e[r],_=e[m],g=e[_],y=257*e[p]^16843008*p;a[r]=y<<24|y>>>8,o[r]=y<<16|y>>>16,d[r]=y<<8|y>>>24,l[r]=y,y=16843009*g^65537*_^257*m^16843008*r,c[p]=y<<24|y>>>8,u[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,r?(r=m^e[e[e[g^m]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=i.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),s=this._keySchedule=[],a=0;a6&&a%r==4&&(l=n[l>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l]):(l=n[(l=l<<8|l>>>24)>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l],l^=p[a/r|0]<<24),s[a]=s[a-r]^l);for(var o=this._invKeySchedule=[],d=0;d>>24]]^u[n[l>>>16&255]]^h[n[l>>>8&255]]^f[n[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,o,d,l,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,c,u,h,f,s),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,s,a,o){for(var d=this._nRounds,l=e[t]^r[0],c=e[t+1]^r[1],u=e[t+2]^r[2],h=e[t+3]^r[3],f=4,p=1;p>>24]^n[c>>>16&255]^s[u>>>8&255]^a[255&h]^r[f++],_=i[c>>>24]^n[u>>>16&255]^s[h>>>8&255]^a[255&l]^r[f++],g=i[u>>>24]^n[h>>>16&255]^s[l>>>8&255]^a[255&c]^r[f++],y=i[h>>>24]^n[l>>>16&255]^s[c>>>8&255]^a[255&u]^r[f++];l=m,c=_,u=g,h=y}m=(o[l>>>24]<<24|o[c>>>16&255]<<16|o[u>>>8&255]<<8|o[255&h])^r[f++],_=(o[c>>>24]<<24|o[u>>>16&255]<<16|o[h>>>8&255]<<8|o[255&l])^r[f++],g=(o[u>>>24]<<24|o[h>>>16&255]<<16|o[l>>>8&255]<<8|o[255&c])^r[f++],y=(o[h>>>24]<<24|o[l>>>16&255]<<16|o[c>>>8&255]<<8|o[255&u])^r[f++],e[t]=m,e[t+1]=_,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(m)}(),r.AES)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib,i=t.WordArray,n=t.BlockCipher,s=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=s.DES=n.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=a[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],s=0;s<16;s++){var l=n[s]=[],c=d[s];for(r=0;r<24;r++)l[r/6|0]|=t[(o[r]-1+c)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(o[r+24]-1+c)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var u=this._invSubKeys=[];for(r=0;r<16;r++)u[r]=n[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],s=this._lBlock,a=this._rBlock,o=0,d=0;d<8;d++)o|=l[d][((a^n[d])&c[d])>>>0];this._lBlock=a,this._rBlock=s^o}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),n=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(i.create(t)),this._des2=u.createEncryptor(i.create(r)),this._des3=u.createEncryptor(i.create(n))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=n._createHelper(p)}(),r.TripleDES)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=i.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var s=0;n<256;n++){var a=n%r,o=t[a>>>2]>>>24-a%4*8&255;s=(s+i[n]+o)%256;var d=i[n];i[n]=i[s],i[s]=d}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var e=this._S,t=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[r],e[r]=s,i|=e[(e[t]+e[r])%256]<<24-8*n}return this._i=t,this._j=r,i}e.RC4=t._createHelper(n);var a=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)s.call(this)}});e.RC4Drop=t._createHelper(a)}(),r.RC4)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],a=[],o=i.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)d.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(t){var s=t.words,a=s[0],o=s[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(n[0]^=l,n[1]^=u,n[2]^=c,n[3]^=h,n[4]^=l,n[5]^=u,n[6]^=c,n[7]^=h,r=0;r<4;r++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,d=((n*n>>>17)+n*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=t._createHelper(o)}(),r.Rabbit)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],a=[],o=i.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var n=0;n<4;n++)d.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var s=t.words,a=s[0],o=s[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(i[0]^=l,i[1]^=u,i[2]^=c,i[3]^=h,i[4]^=l,i[5]^=u,i[6]^=c,i[7]^=h,n=0;n<4;n++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,d=((n*n>>>17)+n*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=t._createHelper(o)}(),r.RabbitLegacy)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.BlockCipher,i=e.algo;const n=16,s=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function d(e,t){let r=t>>24&255,i=t>>16&255,n=t>>8&255,s=255&t,a=e.sbox[0][r]+e.sbox[1][i];return a^=e.sbox[2][n],a+=e.sbox[3][s],a}function l(e,t,r){let i,s=t,a=r;for(let t=0;t1;--t)s^=e.pbox[t],a=d(e,s)^a,i=s,s=a,a=i;return i=s,s=a,a=i,a^=e.pbox[1],s^=e.pbox[0],{left:s,right:a}}function u(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=a[t][r]}let i=0;for(let a=0;a=r&&(i=0);let o=0,d=0,c=0;for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),r=new Uint8Array(r);const n=e.byteLength;let s=5;for(;sn)break;let o=e[s+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=e.slice(s+4+2,s+4+a);let n=new Ri.ModeOfOperation.ctr(t,new Ri.Counter(r));const o=n.decrypt(i);n=null,e.set(o,s+4+2)}s=s+4+a}return e}function Ni(e,t,r){if(e.byteLength<=30)return e;const i=e.slice(32);let n=new Ri.ModeOfOperation.ctr(t,new Ri.Counter(r));const s=n.decrypt(i);return n=null,e.set(s,32),e}Gt((function(e,t){e.exports=Mi}));var Oi=Gt((function(e,t){var r,n,s,a=(r=new Date,n=4,s={setLogLevel:function(e){n=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=n&&console.debug("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=n&&console.info("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=n&&console.warn("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=n&&console.error("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}},s);a.getDurationString=function(e,t){var r;function i(e,t){for(var r=(""+e).split(".");r[0].length0){for(var r="",i=0;i0&&(r+=","),r+="["+a.getDurationString(e.start(i))+","+a.getDurationString(e.end(i))+"]";return r}return"(empty)"},t.Log=a;var o=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};o.prototype.getPosition=function(){return this.position},o.prototype.getEndPosition=function(){return this.buffer.byteLength},o.prototype.getLength=function(){return this.buffer.byteLength},o.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},o.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},o.prototype.readAnyInt=function(e,t){var r=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:r=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:r=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";r=this.dataview.getUint8(this.position)<<16,r|=this.dataview.getUint8(this.position+1)<<8,r|=this.dataview.getUint8(this.position+2);break;case 4:r=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";r=this.dataview.getUint32(this.position)<<32,r|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,r}throw"Not enough bytes in buffer"},o.prototype.readUint8=function(){return this.readAnyInt(1,!1)},o.prototype.readUint16=function(){return this.readAnyInt(2,!1)},o.prototype.readUint24=function(){return this.readAnyInt(3,!1)},o.prototype.readUint32=function(){return this.readAnyInt(4,!1)},o.prototype.readUint64=function(){return this.readAnyInt(8,!1)},o.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",r=0;rthis._byteLength&&(this._byteLength=t);else{for(r<1&&(r=1);t>r;)r*=2;var i=new ArrayBuffer(r),n=new Uint8Array(this._buffer);new Uint8Array(i,0,n.length).set(n),this.buffer=i,this._byteLength=t}}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),r=new Uint8Array(this._buffer,0,t.length);t.set(r),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Int32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Int16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Uint32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Uint16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var r=new Float64Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Float32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,r,i,n){var s=new Uint8Array(e,t,n),a=new Uint8Array(r,i,n);s.set(a)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=0;rn;i--,n++){var s=t[n];t[n]=t[i],t[i]=s}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],r=0;r>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},d.prototype.adjustUint32=function(e,t){var r=this.position;this.seek(e),this.writeUint32(t),this.seek(r)},d.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var r=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var r=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var r=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var r=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var r=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=8*e,r},d.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var r=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r};var c=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(c.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,a.debug("MultiBufferStream","Stream ready for parsing"),!0):(a.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(a.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){a.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r.buffer},c.prototype.reduceBuffer=function(e,t,r){var i;return(i=new Uint8Array(r)).set(new Uint8Array(e,t,r)),i.buffer.fileStart=e.fileStart+t,i.buffer.usedBytes=0,i.buffer},c.prototype.insertBuffer=function(e){for(var t=!0,r=0;ri.byteLength){this.buffers.splice(r,1),r--;continue}a.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=i.fileStart||(e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)),a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(r,0,e),0===r&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,n,s)}}t&&(a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===r&&(this.buffer=e))},c.prototype.logBufferLevel=function(e){var t,r,i,n,s,o=[],d="";for(i=0,n=0,t=0;t0&&(d+=s.end-1+"]");var l=e?a.info:a.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+i+"/"+n+" bytes), continuous ranges: "+d)},c.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},c.prototype.findPosition=function(e,t,r){var i,n=null,s=-1;for(i=!0===e?0:this.bufferIndex;i=t?(a.debug("MultiBufferStream","Found position in existing buffer #"+s),s):-1},c.prototype.findEndContiguousBuf=function(e){var t,r,i,n=void 0!==e?e:this.bufferIndex;if(r=this.buffers[n],this.buffers.length>n+1)for(t=n+1;t>3;return 31===i&&r.data.length>=2&&(i=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),i}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};t.MPEG4DescriptorParser=u;var h={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){h.FullBox.prototype=new h.Box,h.ContainerBox.prototype=new h.Box,h.SampleEntry.prototype=new h.Box,h.TrackGroupTypeBox.prototype=new h.FullBox,h.BASIC_BOXES.forEach((function(e){h.createBoxCtor(e)})),h.FULL_BOXES.forEach((function(e){h.createFullBoxCtor(e)})),h.CONTAINER_BOXES.forEach((function(e){h.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,r){this.type=e,this.size=t,this.uuid=r},FullBox:function(e,t,r){h.Box.call(this,e,t,r),this.flags=0,this.version=0},ContainerBox:function(e,t,r){h.Box.call(this,e,t,r),this.boxes=[]},SampleEntry:function(e,t,r,i){h.ContainerBox.call(this,e,t),this.hdr_size=r,this.start=i},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){h.FullBox.call(this,e,t)},createBoxCtor:function(e,t){h.boxCodes.push(e),h[e+"Box"]=function(t){h.Box.call(this,e,t)},h[e+"Box"].prototype=new h.Box,t&&(h[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){h[e+"Box"]=function(t){h.FullBox.call(this,e,t)},h[e+"Box"].prototype=new h.FullBox,h[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,r=0;rr?(a.error("BoxParser","Box of type '"+c+"' has a size "+l+" greater than its container size "+r),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):0!==l&&o+l>e.getEndPosition()?(e.seek(o),a.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):t?{code:h.OK,type:c,size:l,hdr_size:d,start:o}:(h[c+"Box"]?i=new h[c+"Box"](l):"uuid"!==c?(a.warn("BoxParser","Unknown box type: '"+c+"'"),(i=new h.Box(c,l)).has_unparsed_data=!0):h.UUIDBoxes[s]?i=new h.UUIDBoxes[s](l):(a.warn("BoxParser","Unknown uuid type: '"+s+"'"),(i=new h.Box(c,l)).uuid=s,i.has_unparsed_data=!0),i.hdr_size=d,i.start=o,i.write===h.Box.prototype.write&&"mdat"!==i.type&&(a.info("BoxParser","'"+u+"' box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),(n=e.getPosition()-(i.start+i.size))<0?(a.warn("BoxParser","Parsing of box '"+u+"' did not read the entire indicated box data size (missing "+-n+" bytes), seeking forward"),e.seek(i.start+i.size)):n>0&&(a.error("BoxParser","Parsing of box '"+u+"' read "+n+" more bytes than the indicated box data size, seeking backwards"),0!==i.size&&e.seek(i.start+i.size)),{code:h.OK,box:i,size:i.size})},h.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},h.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},h.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.ContainerBox.prototype.parse=function(e){for(var t,r;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},h.SAMPLE_ENTRY_TYPE_VISUAL="Visual",h.SAMPLE_ENTRY_TYPE_AUDIO="Audio",h.SAMPLE_ENTRY_TYPE_HINT="Hint",h.SAMPLE_ENTRY_TYPE_METADATA="Metadata",h.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",h.SAMPLE_ENTRY_TYPE_SYSTEM="System",h.SAMPLE_ENTRY_TYPE_TEXT="Text",h.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},h.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},h.SampleEntry.prototype.parseFooter=function(e){h.ContainerBox.prototype.parse.call(this,e)},h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_HINT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT,"enct"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA,"encm"),h.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var r=0;r<3;r++)this.layer_size[r]=16==t?e.readUint16():e.readUint32()})),h.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),h.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),h.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)a.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void a.error("av1C reserved_2 parsing problem");var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)}else a.error("av1C reserved_1 parsing problem");else a.error("av1C version "+this.version+" not supported")})),h.createBoxCtor("avcC",(function(e){var t,r;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),r=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(r))})),h.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),h.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),h.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),h.createFullBoxCtor("co64",(function(e){var t,r;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(r=0;r>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),h.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),h.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),h.createFullBoxCtor("ctts",(function(e){var t,r;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(r=0;r>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|r>>6&3,this.acmod=r>>3&7,this.lfeon=r>>2&1,this.bit_rate_code=3&r|i>>5&7})),h.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var r=0;r>6,i.bsid=n>>1&31,i.bsmod=(1&n)<<4|s>>4&15,i.acmod=s>>1&7,i.lfeon=1&s,i.num_dep_sub=a>>1&15,i.num_dep_sub>0&&(i.chan_loc=(1&a)<<8|e.readUint8())}})),h.createFullBoxCtor("dfLa",(function(e){var t=[],r=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var i=e.readUint8(),n=Math.min(127&i,r.length-1);if(n?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(r[n]),128&i)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),h.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[r]=e.readString(4),t-=4,r++})),h.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),h.createBoxCtor("hvcC",(function(e){var t,r,i,n;this.configurationVersion=e.readUint8(),n=e.readUint8(),this.general_profile_space=n>>6,this.general_tier_flag=(32&n)>>5,this.general_profile_idc=31&n,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),n=e.readUint8(),this.constantFrameRate=n>>6,this.numTemporalLayers=(13&n)>>3,this.temporalIdNested=(4&n)>>2,this.lengthSizeMinusOne=3&n,this.nalu_arrays=[];var s=e.readUint8();for(t=0;t>7,a.nalu_type=63&n;var o=e.readUint16();for(r=0;r>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var r=0;if(this.version<2)r=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";r=e.readUint32()}for(var i=0;i>7,this.axis=1&t})),h.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),a.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),h.createFullBoxCtor("ipma",(function(e){var t,r;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?a.property_index=(127&s)<<8|e.readUint8():a.property_index=127&s}}})),h.createFullBoxCtor("iref",(function(e){var t,r;for(this.references=[];e.getPosition()>7,i.assignment_type=127&n,i.assignment_type){case 0:i.grouping_type=e.readString(4);break;case 1:i.grouping_type=e.readString(4),i.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:i.sub_track_id=e.readUint32();break;default:a.warn("BoxParser","Unknown leva assignement type")}}})),h.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),h.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),f.prototype.toString=function(){return"("+this.x+","+this.y+")"},h.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new f(e.readUint16(),e.readUint16()),this.display_primaries[1]=new f(e.readUint16(),e.readUint16()),this.display_primaries[2]=new f(e.readUint16(),e.readUint16()),this.white_point=new f(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),h.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),h.createFullBoxCtor("mehd",(function(e){1&this.flags&&(a.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),h.createFullBoxCtor("meta",(function(e){this.boxes=[],h.ContainerBox.prototype.parse.call(this,e)})),h.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),h.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),h.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),h.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),h.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),h.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),h.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var r=0;r0){var t=e.readUint32();this.kid=[];for(var r=0;r0&&(this.data=e.readUint8Array(i))})),h.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),h.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),h.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var r=0;r>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var r=e.readUint8(),i=0;i>7,this.num_leading_samples=127&t})),h.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)a.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=h.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),h.createSampleGroupCtor("stsa",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),h.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),h.createSampleGroupCtor("tsas",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("tscl",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("vipr",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),r=0;r>6,this.sample_depends_on[i]=t>>4&3,this.sample_is_depended_on[i]=t>>2&3,this.sample_has_redundancy[i]=3&t})),h.createFullBoxCtor("senc"),h.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),a.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),r=0;r>31&1,i.referenced_size=2147483647&n,i.subsegment_duration=e.readUint32(),n=e.readUint32(),i.starts_with_SAP=n>>31&1,i.SAP_type=n>>28&7,i.SAP_delta_time=268435455&n}})),h.SingleItemTypeReferenceBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.SingleItemTypeReferenceBox.prototype=new h.Box,h.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var r=0;r>4&15,this.sample_sizes[t+1]=15&i}else if(8===this.field_size)for(t=0;t0)for(r=0;r>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=h.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),h.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),h.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),h.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var r=e.readUint32(),i=0;i>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),h.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),h.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),h.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},h.createTrackGroupCtor("msrc"),h.TrackReferenceTypeBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.TrackReferenceTypeBox.prototype=new h.Box,h.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},h.trefBox.prototype.parse=function(e){for(var t,r;e.getPosition()t&&this.flags&h.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var r=0;r>7&1,this.block_pad_lsb=r>>6&1,this.block_little_endian=r>>5&1,this.block_reversed=r>>4&1,this.pad_unknown=r>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),h.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),h.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),h.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),h.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=h.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),h.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),h.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=h.parseHex16(e)})),h.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),h.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),h.createFullBoxCtor("vvcC",(function(e){var t,r,i={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(i.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,r=this.num_sublayers-2;r>=0;--r){var a=i.extract_bits(1);this.ptl_sublayer_present_mask|=a<1;++r)i.extract_bits(1);for(this.sublayer_level_idc=[],r=this.num_sublayers-2;r>=0;--r)this.ptl_sublayer_present_mask&1<>=1;t+=h.decimalToHex(i,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var n=!1,s="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||n)&&(s="."+h.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+s,n=!0);t+=s}return t},h.vvc1SampleEntry.prototype.getCodec=h.vvi1SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var r="";if(this.vvcC.general_constraint_info){var i,n=[],s=0;for(s|=this.vvcC.ptl_frame_only_constraint<<7,s|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,n.push(s),s&&(i=e),s=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===i)r=".CA";else{r=".C";var a="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",o=0,d=0;for(e=0;e<=i;++e)for(o=o<<8|n[e],d+=8;d>=5;){r+=a[o>>d-5&31],o&=(1<<(d-=5))-1}d&&(r+=a[31&(o<<=5-d)])}}t+=r}return t},h.mp4aSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),r=this.esds.esd.getAudioConfig();return e+"."+h.decimalToHex(t)+(r?"."+r:"")}return e},h.stxtSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},h.vp08SampleEntry.prototype.getCodec=h.vp09SampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var r=this.vpcC.bitDepth;return 8==r&&(r="08"),e+".0"+this.vpcC.profile+"."+t+"."+r},h.av01SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this),r=this.av1C.seq_level_idx_0;return r<10&&(r="0"+r),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+r+(this.av1C.seq_tier_0?"H":"M")+"."+e},h.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),a.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>l?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>l&&e.writeUint64(this.size)},h.FullBox.prototype.writeHeader=function(e){this.size+=4,h.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},h.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},h.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},h.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},h.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},h.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},h.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&h.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&h.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&h.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&h.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[r]instanceof h.Box||t[r]instanceof h.Box||void 0===e[r]||void 0===t[r]||"function"==typeof e[r]||"function"==typeof t[r]||e.subBoxNames&&e.subBoxNames.indexOf(r.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(r.slice(0,4))>-1||"data"===r||"start"===r||"size"===r||"creation_time"===r||"modification_time"===r||h.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(r)>-1||e[r]===t[r]))return!1;return!0},h.boxEqual=function(e,t){if(!h.boxEqualFields(e,t))return!1;for(var r=0;r1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},g.prototype.setExtractionOptions=function(e,t,r){var i=this.getTrackById(e);if(i){var n={};this.extractedTracks.push(n),n.id=e,n.user=t,n.trak=i,i.nextSample=0,n.nb_samples=1e3,n.samples=[],r&&r.nbSamples&&(n.nb_samples=r.nbSamples)}},g.prototype.unsetExtractionOptions=function(e){for(var t=-1,r=0;r-1&&this.extractedTracks.splice(t,1)},g.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=h.parseOneBox(this.stream,false)).code===h.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var r;switch(r="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),r){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[r]&&a.warn("ISOFile","Duplicate Box of type: "+r+", overriding previous occurrence"),this[r]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},g.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(a.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(a.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(a.warn("ISOFile","Not ready to start parsing"),!1))},g.prototype.appendBuffer=function(e,t){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(a.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),r},g.prototype.getInfo=function(){var e,t,r,i,n,s,a={},o=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(a.hasMoov=!0,a.duration=this.moov.mvhd.duration,a.timescale=this.moov.mvhd.timescale,a.isFragmented=null!=this.moov.mvex,a.isFragmented&&this.moov.mvex.mehd&&(a.fragment_duration=this.moov.mvex.mehd.fragment_duration),a.isProgressive=this.isProgressive,a.hasIOD=null!=this.moov.iods,a.brands=[],a.brands.push(this.ftyp.major_brand),a.brands=a.brands.concat(this.ftyp.compatible_brands),a.created=new Date(o+1e3*this.moov.mvhd.creation_time),a.modified=new Date(o+1e3*this.moov.mvhd.modification_time),a.tracks=[],a.audioTracks=[],a.videoTracks=[],a.subtitleTracks=[],a.metadataTracks=[],a.hintTracks=[],a.otherTracks=[],e=0;e0?a.mime+='video/mp4; codecs="':a.audioTracks&&a.audioTracks.length>0?a.mime+='audio/mp4; codecs="':a.mime+='application/mp4; codecs="',e=0;e=r.samples.length)&&(a.info("ISOFile","Sending fragmented data on track #"+i.id+" for samples ["+Math.max(0,r.nextSample-i.nb_samples)+","+(r.nextSample-1)+"]"),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(i.id,i.user,i.segmentStream.buffer,r.nextSample,e||r.nextSample>=r.samples.length),i.segmentStream=null,i!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=r.samples.length)&&(a.debug("ISOFile","Sending samples on track #"+s.id+" for sample "+r.nextSample),this.onSamples&&this.onSamples(s.id,s.user,s.samples),s.samples=[],s!==this.extractedTracks[t]))break}}}},g.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},g.prototype.getBoxes=function(e,t){var r=[];return g._sweep.call(this,e,r,t),r},g._sweep=function(e,t,r){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&r)return;g._sweep.call(this.boxes[i],e,t,r)}},g.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},g.prototype.getTrackSample=function(e,t){var r=this.getTrackById(e);return this.getSample(r,t)},g.prototype.releaseUsedSamples=function(e,t,r){var i=0,n=this.getTrackById(e);n.lastValidSample||(n.lastValidSample=0);for(var s=n.lastValidSample;se*n.timescale){l=i-1;break}t&&n.is_sync&&(d=i)}for(t&&(l=d),e=r.samples[l].cts,r.nextSample=l;r.samples[l].alreadyRead===r.samples[l].size&&r.samples[l+1];)l++;return s=r.samples[l].offset+r.samples[l].alreadyRead,a.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+a.getDurationString(e,o)+" and offset: "+s),{offset:s,time:e/o}},g.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},g.prototype.seek=function(e,t){var r,i,n,s=this.moov,o={offset:1/0,time:1/0};if(this.moov){for(n=0;nthis.getTrackDuration(r)||((i=this.seekTrack(e,t,r)).offset-1){a=d;break}switch(a){case"Visual":if(n.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),s.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var u=new h.avcCBox;u.parse(new o(t.avcDecoderConfigRecord)),s.addBox(u)}else if(t.hevcDecoderConfigRecord){var f=new h.hvcCBox;f.parse(new o(t.hevcDecoderConfigRecord)),s.addBox(f)}break;case"Audio":n.add("smhd").set("balance",t.balance||0),s.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":n.add("hmhd");break;case"Subtitle":if(n.add("sthd"),"stpp"===t.type)s.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:n.add("nmhd")}t.description&&s.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){s.addBox(e)})),n.add("dinf").add("dref").addEntry((new h["url Box"]).set("flags",1));var p=n.add("stbl");return p.add("stsd").addEntry(s),p.add("stts").set("sample_counts",[]).set("sample_deltas",[]),p.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),p.add("stco").set("chunk_offsets",[]),p.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(r),t.id}},h.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},g.prototype.addSample=function(e,t,r){var i=r||{},n={},s=this.getTrackById(e);if(null!==s){n.number=s.samples.length,n.track_id=s.tkhd.track_id,n.timescale=s.mdia.mdhd.timescale,n.description_index=i.sample_description_index?i.sample_description_index-1:0,n.description=s.mdia.minf.stbl.stsd.entries[n.description_index],n.data=t,n.size=t.byteLength,n.alreadyRead=n.size,n.duration=i.duration||1,n.cts=i.cts||0,n.dts=i.dts||0,n.is_sync=i.is_sync||!1,n.is_leading=i.is_leading||0,n.depends_on=i.depends_on||0,n.is_depended_on=i.is_depended_on||0,n.has_redundancy=i.has_redundancy||0,n.degradation_priority=i.degradation_priority||0,n.offset=0,n.subsamples=i.subsamples,s.samples.push(n),s.samples_size+=n.size,s.samples_duration+=n.duration,void 0===s.first_dts&&(s.first_dts=i.dts),this.processSamples();var a=this.createSingleSampleMoof(n);return this.addBox(a),a.computeSize(),a.trafs[0].truns[0].data_offset=a.size+8,this.add("mdat").data=new Uint8Array(t),n}},g.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var r=new h.moofBox;r.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var i=r.add("traf"),n=this.getTrackById(e.track_id);return i.add("tfhd").set("track_id",e.track_id).set("flags",h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),i.add("tfdt").set("baseMediaDecodeTime",e.dts-(n.first_dts||0)),i.add("trun").set("flags",h.TRUN_FLAGS_DATA_OFFSET|h.TRUN_FLAGS_DURATION|h.TRUN_FLAGS_SIZE|h.TRUN_FLAGS_FLAGS|h.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),r},g.prototype.lastMoofIndex=0,g.prototype.samplesDataSize=0,g.prototype.resetTables=function(){var e,t,r,i,n,s;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(d=n[a].grouping_type+"/0",(o=new l(n[a].grouping_type,0)).is_fragment=!0,t.sample_groups_info[d]||(t.sample_groups_info[d]=o))}else for(a=0;a=2&&(d=i[a].grouping_type+"/0",o=new l(i[a].grouping_type,0),e.sample_groups_info[d]||(e.sample_groups_info[d]=o))},g.setSampleGroupProperties=function(e,t,r,i){var n,s;for(n in t.sample_groups=[],i){var a;if(t.sample_groups[n]={},t.sample_groups[n].grouping_type=i[n].grouping_type,t.sample_groups[n].grouping_type_parameter=i[n].grouping_type_parameter,r>=i[n].last_sample_in_run&&(i[n].last_sample_in_run<0&&(i[n].last_sample_in_run=0),i[n].entry_index++,i[n].entry_index<=i[n].sbgp.entries.length-1&&(i[n].last_sample_in_run+=i[n].sbgp.entries[i[n].entry_index].sample_count)),i[n].entry_index<=i[n].sbgp.entries.length-1?t.sample_groups[n].group_description_index=i[n].sbgp.entries[i[n].entry_index].group_description_index:t.sample_groups[n].group_description_index=-1,0!==t.sample_groups[n].group_description_index)a=i[n].fragment_description?i[n].fragment_description:i[n].description,t.sample_groups[n].group_description_index>0?(s=t.sample_groups[n].group_description_index>65535?(t.sample_groups[n].group_description_index>>16)-1:t.sample_groups[n].group_description_index-1,a&&s>=0&&(t.sample_groups[n].description=a.entries[s])):a&&a.version>=2&&a.default_group_description_index>0&&(t.sample_groups[n].description=a.entries[a.default_group_description_index-1])}},g.process_sdtp=function(e,t,r){t&&(e?(t.is_leading=e.is_leading[r],t.depends_on=e.sample_depends_on[r],t.is_depended_on=e.sample_is_depended_on[r],t.has_redundancy=e.sample_has_redundancy[r]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},g.prototype.buildSampleLists=function(){var e,t;for(e=0;ev&&(b++,v<0&&(v=0),v+=s.sample_counts[b]),t>0?(e.samples[t-1].duration=s.sample_deltas[b],e.samples_duration+=e.samples[t-1].duration,x.dts=e.samples[t-1].dts+e.samples[t-1].duration):x.dts=0,a?(t>=w&&(S++,w<0&&(w=0),w+=a.sample_counts[S]),x.cts=e.samples[t].dts+a.sample_offsets[S]):x.cts=x.dts,o?(t==o.sample_numbers[E]-1?(x.is_sync=!0,E++):(x.is_sync=!1,x.degradation_priority=0),l&&l.entries[A].sample_delta+U==t+1&&(x.subsamples=l.entries[A].subsamples,U+=l.entries[A].sample_delta,A++)):x.is_sync=!0,g.process_sdtp(e.mdia.minf.stbl.sdtp,x,x.number),x.degradation_priority=h?h.priority[t]:0,l&&l.entries[A].sample_delta+U==t&&(x.subsamples=l.entries[A].subsamples,U+=l.entries[A].sample_delta),(c.length>0||u.length>0)&&g.setSampleGroupProperties(e,x,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},g.prototype.updateSampleLists=function(){var e,t,r,i,n,s,a,o,d,l,c,u,f,p,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&g.initSampleGroups(u,c,c.sbgps,u.mdia.minf.stbl.sgpds,c.sgpds),t=0;t0?p.dts=u.samples[u.samples.length-2].dts+u.samples[u.samples.length-2].duration:(c.tfdt?p.dts=c.tfdt.baseMediaDecodeTime:p.dts=0,u.first_traf_merged=!0),p.cts=p.dts,_.flags&h.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+_.sample_composition_time_offset[r]),m=a,_.flags&h.TRUN_FLAGS_FLAGS?m=_.sample_flags[r]:0===r&&_.flags&h.TRUN_FLAGS_FIRST_FLAG&&(m=_.first_sample_flags),p.is_sync=!(m>>16&1),p.is_leading=m>>26&3,p.depends_on=m>>24&3,p.is_depended_on=m>>22&3,p.has_redundancy=m>>20&3,p.degradation_priority=65535&m;var y=!!(c.tfhd.flags&h.TFHD_FLAG_BASE_DATA_OFFSET),v=!!(c.tfhd.flags&h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),b=!!(_.flags&h.TRUN_FLAGS_DATA_OFFSET),w=0;w=y?c.tfhd.base_data_offset:v||0===t?l.start:o,p.offset=0===t&&0===r?b?w+_.data_offset:w:o,o=p.offset+p.size,(c.sbgps.length>0||c.sgpds.length>0||u.mdia.minf.stbl.sbgps.length>0||u.mdia.minf.stbl.sgpds.length>0)&&g.setSampleGroupProperties(u,p,p.number_in_traf,c.sample_groups_info)}}if(c.subs){u.has_fragment_subsamples=!0;var S=c.first_sample_index;for(t=0;t-1))return null;var s=(r=this.stream.buffers[n]).byteLength-(i.offset+i.alreadyRead-r.fileStart);if(i.size-i.alreadyRead<=s)return a.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+(i.size-i.alreadyRead)+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,i.size-i.alreadyRead),r.usedBytes+=i.size-i.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead=i.size,i;if(0===s)return null;a.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+s+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,s),i.alreadyRead+=s,r.usedBytes+=s,this.stream.logBufferLevel()}},g.prototype.releaseSample=function(e,t){var r=e.samples[t];return r.data?(this.samplesDataSize-=r.size,r.data=null,r.description=null,delete r.degradation_priority,delete r.depends_on,delete r.description_index,delete r.has_redundancy,delete r.is_depended_on,delete r.is_leading,delete r.is_sync,delete r.moof_number,delete r.number_in_traf,delete r.timescale,delete r.cts,delete r.dts,delete r.offset,delete r.size,delete r.track_id,delete r.duration,r.alreadyRead=0,r.size):0},g.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},g.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},g.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(r.protection=s.ipro.protections[s.iinf.item_infos[e].protection_index-1]),s.iinf.item_infos[e].item_type?r.type=s.iinf.item_infos[e].item_type:r.type="mime",r.content_type=s.iinf.item_infos[e].content_type,r.content_encoding=s.iinf.item_infos[e].content_encoding;if(s.grpl)for(e=0;e0&&h.property_index-1-1))return null;var o=(t=this.stream.buffers[s]).byteLength-(n.offset+n.alreadyRead-t.fileStart);if(!(n.length-n.alreadyRead<=o))return a.debug("ISOFile","Getting item #"+e+" extent #"+i+" partial data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+o+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,o),n.alreadyRead+=o,r.alreadyRead+=o,t.usedBytes+=o,this.stream.logBufferLevel(),null;a.debug("ISOFile","Getting item #"+e+" extent #"+i+" data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+(n.length-n.alreadyRead)+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,n.length-n.alreadyRead),t.usedBytes+=n.length-n.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead+=n.length-n.alreadyRead,n.alreadyRead=n.length}}return r.alreadyRead===r.size?r:null},g.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var r=0;r0?this.moov.traks[e].samples[0].duration:0),t.push(i)}return t},g.prototype.getPerformanceInfo=function(){var e={};return e.moov=this.moov,this.moov&&this.moov.traks&&this.moov.traks.length>1&&(e.moovAudioNum=this.moov.traks[0].samples.length,e.moovVideoNum=this.moov.traks[1].samples.length),e},h.Box.prototype.printHeader=function(e){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},h.FullBox.prototype.printHeader=function(e){this.size+=4,h.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},h.Box.prototype.print=function(e){this.printHeader(e)},h.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},h.tkhdBox.prototype.print=function(e){h.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var y={createFile:function(e,t){var r=void 0===e||e,i=new g(t);return i.discardMdatData=!r,i}};t.createFile=y.createFile}));function Gi(e){return e.reduce(((e,t)=>256*e+t))}function Hi(e){const t=[101,103,119,99],r=e.length-28,i=e.slice(r,r+t.length);return t.every(((e,t)=>e===i[t]))}Oi.Log,Oi.MP4BoxStream,Oi.DataStream,Oi.MultiBufferStream,Oi.MPEG4DescriptorParser,Oi.BoxParser,Oi.XMLSubtitlein4Parser,Oi.Textin4Parser,Oi.ISOFile,Oi.createFile;class Wi{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(r+32,r+32+t))]}return null}(t,this.t);if(!r)return e;const i=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(i instanceof Error)return console.error(i.message),this.d=!0,e;this.A=!0,this.u=r[1],Hi(t)&&this.c++,WebAssembly.instantiate(r[2],i).then((e=>{if("function"!=typeof(t=e.instance.exports).parse||"object"!=typeof t.memory)return this.d=!0,void console.error("video_error_3");var t;this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}function Vi(){for(var e=arguments.length,t=new Array(e),r=0;r{const r=new i((0|e.byteLength)+(0|t.byteLength));return r.set(e,0),r.set(t,0|e.byteLength),r}),new i)}const ji=16,qi=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],Yi=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Ki(e){const t=[];for(let r=0,i=e.length;r1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Zi(e){const t=[];for(let r=0,i=e.length;r>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}function Ji(e){const t=[];for(let r=0,i=e.length;r=240&&e[r]<=247?(t.push(String.fromCodePoint(((7&e[r])<<18)+((63&e[r+1])<<12)+((63&e[r+2])<<6)+(63&e[r+3]))),r+=3):e[r]>=224&&e[r]<=239?(t.push(String.fromCodePoint(((15&e[r])<<12)+((63&e[r+1])<<6)+(63&e[r+2]))),r+=2):e[r]>=192&&e[r]<=223?(t.push(String.fromCodePoint(((31&e[r])<<6)+(63&e[r+1]))),r++):t.push(String.fromCodePoint(e[r]));return t.join("")}function Qi(e,t){const r=31&t;return e<>>32-r}function en(e){return(255&qi[e>>>24&255])<<24|(255&qi[e>>>16&255])<<16|(255&qi[e>>>8&255])<<8|255&qi[255&e]}function tn(e){return e^Qi(e,2)^Qi(e,10)^Qi(e,18)^Qi(e,24)}function rn(e){return e^Qi(e,13)^Qi(e,23)}function nn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[4*t],n[1]=255&e[4*t+1],n[2]=255&e[4*t+2],n[3]=255&e[4*t+3],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];for(let e,t=0;t<32;t+=4)e=i[1]^i[2]^i[3]^r[t+0],i[0]^=tn(en(e)),e=i[2]^i[3]^i[0]^r[t+1],i[1]^=tn(en(e)),e=i[3]^i[0]^i[1]^r[t+2],i[2]^=tn(en(e)),e=i[0]^i[1]^i[2]^r[t+3],i[3]^=tn(en(e));for(let e=0;e<16;e+=4)t[e]=i[3-e/4]>>>24&255,t[e+1]=i[3-e/4]>>>16&255,t[e+2]=i[3-e/4]>>>8&255,t[e+3]=255&i[3-e/4]}function sn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[0+4*t],n[1]=255&e[1+4*t],n[2]=255&e[2+4*t],n[3]=255&e[3+4*t],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let e,r=0;r<32;r+=4)e=i[1]^i[2]^i[3]^Yi[r+0],t[r+0]=i[0]^=rn(en(e)),e=i[2]^i[3]^i[0]^Yi[r+1],t[r+1]=i[1]^=rn(en(e)),e=i[3]^i[0]^i[1]^Yi[r+2],t[r+2]=i[2]^=rn(en(e)),e=i[0]^i[1]^i[2]^Yi[r+3],t[r+3]=i[3]^=rn(en(e));if(0===r)for(let e,r=0;r<16;r++)e=t[r],t[r]=t[31-r],t[31-r]=e}function an(e,t,r){let{padding:i="pkcs#7",mode:n,iv:s=[],output:a="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===n&&("string"==typeof s&&(s=Ki(s)),16!==s.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=Ki(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==r?Zi(e):Ki(e):[...e],("pkcs#5"===i||"pkcs#7"===i)&&0!==r){const t=ji-e.length%ji;for(let r=0;r=ji;){const t=e.slice(u,u+16),i=new Array(16);if("cbc"===n)for(let e=0;e2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let s=new Uint8Array(e.slice(0,5)),a=5;for(;an){const t=new Uint8Array(s.length+e.length-a);t.set(s,0),t.set(e.slice(a),s.length),s=t;break}let l=e[a+4],c=!1,u=2;if(r?(i&&(u=3),l=l>>>1&63,c=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(l)):(l&=31,c=1===l||5===l),c){const r=an(e.slice(a+4+u,a+4+d),t,0,{padding:"none",output:"array"});let i=r[r.length-1];if(i>0&&i<16){let e=!0;for(let t=1;t<=i;t++)if(r[r.length-t]!==i){e=!1;break}e&&r.splice(r.length-i,i)}const n=new Uint8Array(u);n.set(e.slice(a+4,a+4+u),0);const o=rr(Vi(n,new Uint8Array(r))),l=new Uint8Array(s.length+o.length);l.set(s,0),l.set(o,s.length),s=l}else{const t=e.slice(a+4,a+4+d),r=new Uint8Array(s.length+4+t.length);r.set(s,0),r.set(o,s.length),r.set(t,s.length+4),s=r}a=a+4+d}return s}const ln={init:0,findFirstStartCode:1,findSecondStartCode:2};class cn extends class{on(e,t,r){const i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:r}),this}once(e,t,r){const i=this;function n(){i.off(e,n);for(var s=arguments.length,a=new Array(s),o=0;o1?r-1:0),n=1;n{delete r[e]})),void delete this.e;const i=r[e],n=[];if(i&&t)for(let e=0,r=i.length;e=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=ln.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==ln.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=ln.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==ln.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=ln.findFirstStartCode}}}}function un(e,t,r){for(let i=2;i3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let s=5;for(;sn)break;let o=e[s+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=un(e.slice(s+4,s+4+a),t,r);e.set(i,s+4)}s=s+4+a}return e}function pn(){for(var e=arguments.length,t=new Array(e),r=0;re+t.byteLength),0));let n=0;return t.forEach((e=>{i.set(e,n),n+=e.byteLength})),i}class mn{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,r,i)));e.addEventListener(t,r,i);const n=()=>{cr(e.removeEventListener)&&e.removeEventListener(t,r,i)};return this.destroys.push(n),n}destroy(){this.master.debugLog("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class _n{static init(){_n.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in _n.types)_n.types.hasOwnProperty(e)&&(_n.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=_n.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,r=null,i=Array.prototype.slice.call(arguments,1),n=i.length;for(let e=0;e>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r.set(e,4);let s=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return _n.box(_n.types.trak,_n.tkhd(e),_n.mdia(e))}static tkhd(e){let t=e.id,r=e.duration,i=e.presentWidth,n=e.presentHeight;return _n.box(_n.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>>8&255,255&i,0,0,n>>>8&255,255&n,0,0]))}static mdia(e){return _n.box(_n.types.mdia,_n.mdhd(e),_n.hdlr(e),_n.minf(e))}static mdhd(e){let t=e.timescale,r=e.duration;return _n.box(_n.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?_n.constants.HDLR_AUDIO:_n.constants.HDLR_VIDEO,_n.box(_n.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?_n.box(_n.types.smhd,_n.constants.SMHD):_n.box(_n.types.vmhd,_n.constants.VMHD),_n.box(_n.types.minf,t,_n.dinf(),_n.stbl(e))}static dinf(){return _n.box(_n.types.dinf,_n.box(_n.types.dref,_n.constants.DREF))}static stbl(e){return _n.box(_n.types.stbl,_n.stsd(e),_n.box(_n.types.stts,_n.constants.STTS),_n.box(_n.types.stsc,_n.constants.STSC),_n.box(_n.types.stsz,_n.constants.STSZ),_n.box(_n.types.stco,_n.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?_n.box(_n.types.stsd,_n.constants.STSD_PREFIX,_n.mp3(e)):_n.box(_n.types.stsd,_n.constants.STSD_PREFIX,_n.mp4a(e)):"avc"===e.videoType?_n.box(_n.types.stsd,_n.constants.STSD_PREFIX,_n.avc1(e)):_n.box(_n.types.stsd,_n.constants.STSD_PREFIX,_n.hvc1(e))}static mp3(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return _n.box(_n.types[".mp3"],i)}static mp4a(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return _n.box(_n.types.mp4a,i,_n.esds(e))}static esds(e){let t=e.config||[],r=t.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(t).concat([6,1,2]));return _n.box(_n.types.esds,i)}static avc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return _n.box(_n.types.avc1,n,_n.box(_n.types.avcC,t))}static hvc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return _n.box(_n.types.hvc1,n,_n.box(_n.types.hvcC,t))}static mvex(e){return _n.box(_n.types.mvex,_n.trex(e))}static trex(e){let t=e.id,r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return _n.box(_n.types.trex,r)}static moof(e,t){return _n.box(_n.types.moof,_n.mfhd(e.sequenceNumber),_n.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return _n.box(_n.types.mfhd,t)}static traf(e,t){let r=e.id,i=_n.box(_n.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),n=_n.box(_n.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),s=_n.sdtp(e),a=_n.trun(e,s.byteLength+16+16+8+16+8+8);return _n.box(_n.types.traf,i,n,a,s)}static sdtp(e){let t=new Uint8Array(5),r=e.flags;return t[4]=r.isLeading<<6|r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy,_n.box(_n.types.sdtp,t)}static trun(e,t){let r=new Uint8Array(28);t+=36,r.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let i=e.duration,n=e.size,s=e.flags,a=e.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12),_n.box(_n.types.trun,r)}static mdat(e){return _n.box(_n.types.mdat,e)}}_n.init();var gn,yn=Gt((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}));(gn=yn)&&gn.__esModule&&Object.prototype.hasOwnProperty.call(gn,"default")&&gn.default;const vn=[44100,48e3,32e3,0],bn=[22050,24e3,16e3,0],wn=[11025,12e3,8e3,0],Sn=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],En=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],An=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];function Un(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),r=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let i=t[1]>>>3&3,n=(6&t[1])>>1,s=(240&t[2])>>>4,a=(12&t[2])>>>2,o=3!==(t[3]>>>6&3)?2:1,d=0,l=0;switch(i){case 0:d=wn[a];break;case 2:d=bn[a];break;case 3:d=vn[a]}switch(n){case 1:s=e[n]&&t=6?(i=5,t=new Array(4),a=n-3):(i=2,t=new Array(2),a=n):-1!==o.indexOf("android")?(i=2,t=new Array(2),a=n):(i=5,a=n,t=new Array(4),n>=6?a=n-3:1===s&&(i=2,t=new Array(2),a=n)),t[0]=i<<3,t[0]|=(15&n)>>>1,t[1]=(15&n)<<7,t[1]|=(15&s)<<3,5===i&&(t[1]|=(15&a)>>>1,t[2]=(1&a)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=Nn[n],this.sampling_index=n,this.channel_count=s,this.object_type=i,this.original_object_type=r,this.codec_mimetype="mp4a.40."+i,this.original_codec_mimetype="mp4a.40."+r}}class Hn{constructor(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}get bitsAvailable(){return this.bitLength-this.index}skipBits(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}getBits(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>i,s=8-i;if(s>=e)return r&&(this.index+=e),n>>s-e;{r&&(this.index+=s);const i=e-s;return n<>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}function Wn(e){return e[3]|e[2]<<8|e[1]<<16|e[0]<<24}const Vn=new Array(214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72),jn=new Array(2746333894,1453994832,1736282519,2993693404),qn=new Array(462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257);function Yn(e,t,r,i,n){var s=n;s=t+n>e.length&&i+n<=r.length?e.length-t:i+n>r.length&&t+n<=e.length?r.length-i:t+n<=e.length&&i+n<=r.length?n:r.length>24&255,e>>16&255,e>>8&255,255&e)}function Xn(e,t){return t+3>>19)^(i<<23|i>>>9)}function Qn(e,t){var r=new Array(36);r[0]=Xn(t,0),r[1]=Xn(t,4),r[2]=Xn(t,8),r[3]=Xn(t,12);for(var i=0;i<32;i++)r[i+4]=r[i]^es(r[i+1]^r[i+2]^r[i+3]^e[i]);var n=new Array(4);for(i=35;i>=32;i--)n[35-i]=r[i];var s=function(e){for(var t=new Array(4*e.length),r=0;r>>30)^(i<<10|i>>>22)^(i<<18|i>>>14)^(i<<24|i>>>8)}function ts(e,t,r){if(null==e||null==e||e.length%16!=0)return console.log("sm4 key is error!"),null;if(null==r||null==r||r.length<=0)return console.log("cipher is error!"),null;if(null==t||null==t||t.length%16!=0)return console.log("iv is error!"),null;for(var i=Zn(e),n=Math.ceil(r.length/16),s=new Array(r.length),a=t.slice(),o=0;o3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t=new Uint8Array(t),r=new Uint8Array(r);const s=e.byteLength;let a=5;for(;as)break;let d=e[a+4],l=!1,c=2;if(i?(n&&(c=3),d=d>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(d)):(d&=31,l=1===d||5===d),l){const i=ts(t,r,e.slice(a+4+c,a+4+o));e.set(i,a+4+c)}a=a+4+o}return e}Date.now||(Date.now=function(){return(new Date).getTime()});const is=[];is.push(a({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support")&&-1===e.indexOf("illegal icc")&&!e.indexOf("If you want to help, upload a sample of this file to")&&!e.indexOf("Reserved SBR extensions is not implemented"))})(e)||console.warn("JbPro[❌❌❌][worker]:",e)}}),s({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support, using thread emulation"))})(e)||console.warn("JbPro[❌❌❌][worker]:",e)}})),Promise.all(is).then((e=>{const t=e[0];!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[],n=[],s=null,a=null,o=null,d=null,l=null,c=null,u=!1,h=null,f=null,S=!1,E=!1,B=!!yr(r),Se=0,Ee=0,je=!1,Je=null,Qe=null,tt=null,it=[],ut=null,At=null,Ut=0,Tt=0,Nt=null,Ot=null,Gt=0,Ht=0,Wt=!1,Vt=!1,Xt=!1,er=null,ar=null,Sr=!1,Er=!0,Ar=()=>{const e=_r();return{debug:e.debug,debugLevel:e.debugLevel,debugUuid:e.debugUuid,useOffscreen:e.useOffscreen,useWCS:e.useWCS,useMSE:e.useMSE,videoBuffer:e.videoBuffer,videoBufferDelay:e.videoBufferDelay,openWebglAlignment:e.openWebglAlignment,playType:e.playType,hasAudio:e.hasAudio,hasVideo:e.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:e.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:e.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:0,networkDelay:e.networkDelay,visibility:!0,useSIMD:e.useSIMD,isRecording:!1,recordType:e.recordType,isNakedFlow:e.isNakedFlow,checkFirstIFrame:e.checkFirstIFrame,audioBufferSize:1024,isM7sCrypto:e.isM7sCrypto,m7sCryptoAudio:e.m7sCryptoAudio,cryptoKey:e.cryptoKey,cryptoIV:e.cryptoIV,isSm4Crypto:e.isSm4Crypto,isSm4CryptoH265V2:e.isSm4CryptoH265V2,sm4CryptoKey:e.sm4CryptoKey,isXorCrypto:e.isXorCrypto,isHls265:!1,isFlv:e.isFlv,isFmp4:e.isFmp4,isMpeg4:e.isMpeg4,isTs:e.isTs,isFmp4Private:e.isFmp4Private,isEmitSEI:e.isEmitSEI,isRecordTypeFlv:!1,isWasmMp4:!1,isChrome:!1,isFirefox:!1,isDropSameTimestampGop:e.isDropSameTimestampGop,mseDecodeAudio:e.mseDecodeAudio,wcsDecodeAudio:e.wcsDecodeAudio,nakedFlowH265DemuxUseNew:e.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:e.mseDecoderUseWorker,mseAutoCleanupSourceBuffer:e.mseAutoCleanupSourceBuffer,mseAutoCleanupMaxBackwardDuration:e.mseAutoCleanupMaxBackwardDuration,mseAutoCleanupMinBackwardDuration:e.mseAutoCleanupMinBackwardDuration,mseCorrectTimeDuration:e.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:e.mseCorrectAudioTimeDuration,nakedFlowDemuxUseNew:e.nakedFlowDemuxUseNew,nakedFlowFps:e.nakedFlowFps,supportMSEDecodeHevc:!1}};"VideoEncoder"in self&&(s={hasInit:!1,isEmitInfo:!1,offscreenCanvas:null,offscreenCanvasCtx:null,decoder:null,init(){s.decoder=new VideoDecoder({output:function(e){if(cr(e.createImageBitmap))e.createImageBitmap().then((t=>{s.offscreenCanvasCtx.drawImage(t,0,0,e.codedWidth,e.codedHeight);let r=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:r,delay:si.delay,ts:0},[r]),fr(e)}));else{s.offscreenCanvasCtx.drawImage(e,0,0,e.codedWidth,e.codedHeight);let t=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:t,delay:si.delay,ts:0},[t]),fr(e)}},error:function(e){si.debugError("worker","VideoDecoder error: ",e,e.toString())}})},destroy(){s.reset(),s.decoder&&"closed"!==s.decoder.state&&(s.decoder.close(),s.decoder=null)},decode:function(e,t,r){const i=e[0]>>4==1;if(s.hasInit){const r=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:i?pt:mt});s.decoder.decode(r)}else if(i&&0===e[1]){const t=15&e[0];postMessage({cmd:R,code:t});const r=new Uint8Array(e);postMessage({cmd:M,buffer:r,codecId:t},[r.buffer]);let i=null,n=null;const a=e.slice(5);t===Fe?(n=Cr(a),i={codec:n.codec,description:a}):t===Re&&(n=jr(a),i={codec:n.codec,description:a}),n&&n.codecWidth&&n.codecHeight&&(i.codedHeight=n.codecHeight,i.codedWidth=n.codecWidth),s.isEmitInfo||(si.debugLog("worker","Webcodecs Video Decoder initSize"),postMessage({cmd:k,w:n.codecWidth,h:n.codecHeight}),s.isEmitInfo=!0,s.offscreenCanvas=new OffscreenCanvas(n.codecWidth,n.codecHeight),s.offscreenCanvasCtx=s.offscreenCanvas.getContext("2d"));try{s.decoder.configure(i),s.hasInit=!0}catch(e){si.debugError("worker","VideoDecoder configure error",e.code,e,e.toString()),e.toString()}}else si.debugWarn("worker",`VideoDecoder configure has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)},reset(){s.hasInit=!1,s.isEmitInfo=!1,s.offscreenCanvas=null,s.offscreenCanvasCtx=null}});let Ur=function(){if(Sr=!0,a)try{a.abort(),a=null,si.debugLog("worker","abort success")}catch(e){a=null,si.debugLog("worker","abort catch",e)}},kr={init(){kr.lastBuf=null,kr.vps=null,kr.sps=null,kr.pps=null,kr.streamType=null,kr.localDts=0,kr.pendingUnits={},kr.isSendSeqHeader=!1},destroy(){kr.lastBuf=null,kr.vps=null,kr.sps=null,kr.pps=null,kr.streamType=null,kr.localDts=0,kr.pendingUnits={},kr.isSendSeqHeader=!1},dispatch(e){const t=new Uint8Array(e);if(si._opt.nakedFlowDemuxUseNew){const e=kr.extractNALu$3(t);if(0===e.length)return void si.debugLog("worker","dispatch naluArray length is 0");kr.handleVideoFrames(e)}else kr.extractNALu$2(t)},getNaluDts(){const e=si._opt.nakedFlowFps;let t=kr.localDts;return kr.localDts=kr.localDts+parseInt(1e3/e,10),t},getNaluAudioDts(){const e=si._opt.sampleRate,t=si._opt.audioBufferSize;return kr.localDts+parseInt(t/e*1e3)},extractNALu(e){let t,r,i=0,n=e.byteLength,s=0,a=[];for(;i1)for(let e=0;e{const t=Fr(e);t===Ve||t===We?kr.handleVideoH264Nalu(e):Mr(t)&&i.push(e)})),1===i.length)kr.handleVideoH264Nalu(i[0]);else if($r(i)){const e=Fr(i[0]),t=zr(e);kr.handleVideoH264NaluList(i,t,e)}else i.forEach((e=>{kr.handleVideoH264Nalu(e)}))}else if(kr.streamType===$e)if(si._opt.nakedFlowH265DemuxUseNew){const t=kr.handleAddNaluStartCode(e),r=kr.extractNALu(t);if(0===r.length)return void si.debugWarn("worker","handleVideoNalu","h265 naluList.length === 0");const i=[];if(r.forEach((e=>{const t=Zr(e);t===lt||t===ot||t===st?kr.handleVideoH265Nalu(e):Qr(t)&&i.push(e)})),1===i.length)kr.handleVideoH265Nalu(i[0]);else if(ti(i)){const e=Zr(i[0]),t=ei(e);kr.handleVideoH265NaluList(i,t,e)}else i.forEach((e=>{kr.handleVideoH265Nalu(e)}))}else Zr(e)===lt?kr.extractH265PPS(e):kr.handleVideoH265Nalu(e)},extractH264PPS(e){const t=kr.handleAddNaluStartCode(e);kr.extractNALu(t).forEach((e=>{Rr(Fr(e))?kr.extractH264SEI(e):kr.handleVideoH264Nalu(e)}))},extractH265PPS(e){const t=kr.handleAddNaluStartCode(e);kr.extractNALu(t).forEach((e=>{Jr(Zr(e))?kr.extractH265SEI(e):kr.handleVideoH265Nalu(e)}))},extractH264SEI(e){const t=kr.handleAddNaluStartCode(e);kr.extractNALu(t).forEach((e=>{kr.handleVideoH264Nalu(e)}))},extractH265SEI(e){const t=kr.handleAddNaluStartCode(e);kr.extractNALu(t).forEach((e=>{kr.handleVideoH265Nalu(e)}))},handleAddNaluStartCode(e){const t=[0,0,0,1],r=new Uint8Array(e.length+t.length);return r.set(t),r.set(e,t.length),r},handleVideoH264Nalu(e){const t=Fr(e);switch(t){case We:kr.sps=e;break;case Ve:kr.pps=e}if(kr.isSendSeqHeader){if(kr.sps&&kr.pps){const e=Dr({sps:kr.sps,pps:kr.pps}),t=kr.localDts;si.decode(e,{type:oe,ts:t,isIFrame:!0,cts:0}),kr.sps=null,kr.pps=null}if(Mr(t)){const r=zr(t),i=kr.getNaluDts(),n=Lr(e,r);kr.doDecode(n,{type:oe,ts:i,isIFrame:r,cts:0})}}else if(kr.sps&&kr.pps){kr.isSendSeqHeader=!0;const e=Dr({sps:kr.sps,pps:kr.pps});si.decode(e,{type:oe,ts:0,isIFrame:!0,cts:0}),kr.sps=null,kr.pps=null}},handleVideoH264NaluList(e,t,r){if(kr.isSendSeqHeader){const i=kr.getNaluDts(),n=Ir(e.reduce(((e,t)=>{const r=rr(e),i=rr(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);kr.doDecode(n,{type:oe,ts:i,isIFrame:t,cts:0}),si.debugLog("worker",`handleVideoH264NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},handleVideoH265Nalu(e){const t=Zr(e);switch(t){case st:kr.vps=e;break;case ot:kr.sps=e;break;case lt:kr.pps=e}if(kr.isSendSeqHeader){if(kr.vps&&kr.sps&&kr.pps){const e=Yr({vps:kr.vps,sps:kr.sps,pps:kr.pps}),t=kr.localDts;si.decode(e,{type:oe,ts:t,isIFrame:!0,cts:0}),kr.vps=null,kr.sps=null,kr.pps=null}if(Qr(t)){const r=ei(t),i=kr.getNaluDts(),n=Kr(e,r);kr.doDecode(n,{type:oe,ts:i,isIFrame:r,cts:0})}}else if(kr.vps&&kr.sps&&kr.pps){kr.isSendSeqHeader=!0;const e=Yr({vps:kr.vps,sps:kr.sps,pps:kr.pps});si.decode(e,{type:oe,ts:0,isIFrame:!0,cts:0}),kr.vps=null,kr.sps=null,kr.pps=null}},handleVideoH265NaluList(e,t,r){if(kr.isSendSeqHeader){const i=kr.getNaluDts(),n=Xr(e.reduce(((e,t)=>{const r=rr(e),i=rr(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);kr.doDecode(n,{type:oe,ts:i,isIFrame:t,cts:0}),si.debugLog("worker",`handleVideoH265NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},doDecode(e,t){si.calcNetworkDelay(t.ts),t.isIFrame&&si.calcIframeIntervalTimestamp(t.ts),si.decode(e,t)},handleVideoFrames(e){if(!kr.streamVideoType)for(let t of e)if(kr.streamVideoType=ur(t),kr.streamVideoType)break;kr.streamVideoType?kr.streamVideoType===ze?kr.handleVideoH264Frames(e):this.streamVideoType===$e&&kr.handleVideoH265Frames(e):si.debugWarn("worker","handleVideoFrames","streamVideoType is null")},handleVideoH264Frames(e){let t=[],r=[],i=!1,n=!1;kr.pendingUnits.units&&(t=kr.pendingUnits.units,n=kr.pendingUnits.vcl,i=kr.pendingUnits.iFrame,kr.pendingUnits={});let s={};for(let a of e){if(a.byteLength<4)continue;const e=Fr(a);let o=!1,d=e===Ye;e!==qe&&e!==Ye||(s=kr.parseVideo264Header(a),o=!0),t.length&&n&&(s.isfms||!o)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,n=!1),t.push(a),i=i||d,n=n||o}t.length&&(kr.pendingUnits={units:t,vcl:n,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,n=null;if(t.forEach((e=>{const t=31&e[0];switch(t){case Ve:kr.pps=e;break;case We:kr.sps=e;break;case Ke:n=e}if(Mr(t)){const t=rr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!kr.isSendSeqHeader&&kr.sps&&kr.pps){kr.isSendSeqHeader=!0;const e=Pr({sps:kr.sps,pps:kr.pps});si.decode(e,{type:oe,ts:0,isIFrame:!0,cts:0}),kr.sps=null,kr.pps=null}if(kr.isSendSeqHeader){if(kr.sps&&kr.pps){const e=Pr({sps:kr.sps,pps:kr.pps}),t=kr.localDts;si.decode(e,{type:oe,ts:t,isIFrame:!0,cts:0}),kr.sps=null,kr.pps=null}if(i){const e=kr.getNaluDts(),t=Ir(i,r);si._opt.isEmitSEI&&n&&postMessage({cmd:Z,buffer:n,ts:e},[n.buffer]),kr.doDecode(t,{type:oe,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames(e){let t=[],r=[],i=!1,n=!1;kr.pendingUnits.units&&(t=kr.pendingUnits.units,n=kr.pendingUnits.vcl,i=kr.pendingUnits.iFrame,kr.pendingUnits={});let s={};for(let a of e){if(a.byteLength<4)continue;const e=Zr(a);let o=!1,d=ei(e);Qr(e)&&(s=this.parseVideo265Header(a),o=!0),t.length&&n&&(s.isfms||!o)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,n=!1),t.push(a),i=i||d,n=n||o}t.length&&(kr.pendingUnits={units:t,vcl:n,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,n=null;if(t.forEach((e=>{const t=e[0]>>>1&63;switch(t){case lt:kr.pps=e;break;case ot:kr.sps=e;break;case st:kr.vps=e;break;case ft:case ht:n=e}if(Qr(t)){const t=rr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!kr.isSendSeqHeader&&kr.sps&&kr.pps&&kr.vps){kr.isSendSeqHeader=!0;const e=Yr({sps:kr.sps,pps:kr.pps,vps:kr.vps});si.decode(e,{type:oe,ts:0,isIFrame:!0,cts:0}),kr.sps=null,kr.pps=null,kr.vps=null}if(kr.isSendSeqHeader){if(kr.sps&&kr.pps&&kr.vps){const e=Yr({sps:kr.sps,pps:kr.pps,vps:kr.vps}),t=kr.localDts;si.decode(e,{type:oe,ts:t,isIFrame:!0,cts:0}),kr.sps=null,kr.pps=null,kr.vps=null}if(i){const e=kr.getNaluDts(),t=Xr(i,r);si._opt.isEmitSEI&&n&&postMessage({cmd:Z,buffer:n,ts:e},[n.buffer]),kr.doDecode(t,{type:oe,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames_1(e){e.forEach((e=>{kr.handleVideoNalu(e)}))},parseVideo264Header(e){const t=new Hn(e);return t.readUByte(),{isfms:0===t.readUEG(),sType:t.readUEG()}},parseVideo265Header(e){const t=new Hn(e);return t.readUByte(),{nalType:t.readBits(6),isfms:0===t.readBits(1),sType:t.readBits(3)}}},Gr={LOG_NAME:"worker fmp4Demuxer",mp4Box:null,offset:0,videoTrackId:null,audioTrackId:null,isHevc:!1,listenMp4Box(){Gr.mp4Box=Oi.createFile(),Gr.mp4Box.onReady=Gr.onReady,Gr.mp4Box.onError=Gr.onError,Gr.mp4Box.onSamples=Gr.onSamples},initTransportDescarmber(){Gr.transportDescarmber=new Wi},_getSeqHeader(e){const t=Gr.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new Oi.DataStream(void 0,0,Oi.DataStream.BIG_ENDIAN);let r=[];e.avcC?(e.avcC.write(t),r=[23,0,0,0,0]):(Gr.isHevc=!0,si.isHevc=!0,e.hvcC.write(t),r=[28,0,0,0,0]);const i=new Uint8Array(t.buffer,8),n=new Uint8Array(r.length+i.length);return n.set(r,0),n.set(i,r.length),n}return null},onReady(e){si.debugLog(Gr.LOG_NAME,"onReady()");const t=e.videoTracks[0],r=e.audioTracks[0];if(t){Gr.videoTrackId=t.id;const e=Gr._getSeqHeader(t);e&&(si.debugLog(Gr.LOG_NAME,"seqHeader"),si.decodeVideo(e,0,!0,0)),Gr.mp4Box.setExtractionOptions(t.id)}if(r&&si._opt.hasAudio){Gr.audioTrackId=r.id;const e=r.audio||{},t=jt.indexOf(e.sample_rate),i=r.codec.replace("mp4a.40.","");Gr.mp4Box.setExtractionOptions(r.id);const n=qt({profile:parseInt(i,10),sampleRate:t,channel:e.channel_count});si.debugLog(Gr.LOG_NAME,"aacADTSHeader"),si.decodeAudio(n,0)}Gr.mp4Box.start()},onError(e){si.debugError(Gr.LOG_NAME,"mp4Box onError",e)},onSamples(e,t,r){if(e===Gr.videoTrackId){for(const e of r){const t=e.data,r=e.is_sync,i=1e3*e.cts/e.timescale;e.duration,e.timescale,r&&si.calcIframeIntervalTimestamp(i);let n=null;n=Gr.isHevc?Xr(t,r):Ir(t,r),si.decode(n,{type:oe,ts:i,isIFrame:r,cts:0})}Gr.mp4Box.removeUsedSamples(e)}else if(e===Gr.audioTrackId){if(si._opt.hasAudio){for(const e of r){const t=e.data,r=1e3*e.cts/e.timescale;e.duration,e.timescale;const i=new Uint8Array(t.byteLength+2);i.set([175,1],0),i.set(t,2),si.decode(i,{type:ae,ts:r,isIFrame:!1,cts:0})}Gr.mp4Box.removeUsedSamples(e)}}else si.debugWarn(Gr.LOG_NAME,"onSamples() trackId error",e)},dispatch(e){let t=new Uint8Array(e);Gr.transportDescarmber&&(t=Gr.transportDescarmber.transport(t)),t.buffer.fileStart=Gr.offset,Gr.offset+=t.byteLength,Gr.mp4Box.appendBuffer(t.buffer)},destroy(){Gr.mp4Box&&(Gr.mp4Box.stop(),Gr.mp4Box.flush(),Gr.mp4Box.destroy(),Gr.mp4Box=null),Gr.transportDescarmber&&(Gr.transportDescarmber.destroy(),Gr.transportDescarmber=null),Gr.offset=0,Gr.videoTrackId=null,Gr.audioTrackId=null,Gr.isHevc=!1}},Hr={LOG_NAME:"worker mpeg4Demuxer",lastBuffer:new Uint8Array(0),parsedOffset:0,firstStartCodeOffset:0,secondStartCodeOffset:0,state:"init",hasInitVideoCodec:!1,localDts:0,dispatch(e){const t=new Uint8Array(e);Hr.extractNALu(t)},destroy(){Hr.lastBuffer=new Uint8Array(0),Hr.parsedOffset=0,Hr.firstStartCodeOffset=0,Hr.secondStartCodeOffset=0,Hr.state="init",Hr.hasInitVideoCodec=!1,Hr.localDts=0},extractNALu(e){if(!e||e.byteLength<1)return void si.debugWarn(Hr.LOG_NAME,"extractNALu() buffer error",e);const t=new Uint8Array(Hr.lastBuffer.length+e.length);for(t.set(Hr.lastBuffer,0),t.set(new Uint8Array(e),Hr.lastBuffer.length),Hr.lastBuffer=t;;){if("init"===Hr.state){let e=!1;for(;Hr.lastBuffer.length-Hr.parsedOffset>=4;)if(0===Hr.lastBuffer[Hr.parsedOffset])if(0===Hr.lastBuffer[Hr.parsedOffset+1])if(1===Hr.lastBuffer[Hr.parsedOffset+2]){if(182===Hr.lastBuffer[Hr.parsedOffset+3]){Hr.state="findFirstStartCode",Hr.firstStartCodeOffset=Hr.parsedOffset,Hr.parsedOffset+=4,e=!0;break}Hr.parsedOffset++}else Hr.parsedOffset++;else Hr.parsedOffset++;else Hr.parsedOffset++;if(e)continue;break}if("findFirstStartCode"===Hr.state){let e=!1;for(;Hr.lastBuffer.length-Hr.parsedOffset>=4;)if(0===Hr.lastBuffer[Hr.parsedOffset])if(0===Hr.lastBuffer[Hr.parsedOffset+1])if(1===Hr.lastBuffer[Hr.parsedOffset+2]){if(182===Hr.lastBuffer[Hr.parsedOffset+3]){Hr.state="findSecondStartCode",Hr.secondStartCodeOffset=Hr.parsedOffset,Hr.parsedOffset+=4,e=!0;break}Hr.parsedOffset++}else Hr.parsedOffset++;else Hr.parsedOffset++;else Hr.parsedOffset++;if(e)continue;break}if("findSecondStartCode"===Hr.state){if(!(Hr.lastBuffer.length-Hr.parsedOffset>0))break;{let e,t,r=192&Hr.lastBuffer[Hr.parsedOffset];e=0==r?Hr.secondStartCodeOffset-14:Hr.secondStartCodeOffset;let i=0==(192&Hr.lastBuffer[Hr.firstStartCodeOffset+4]);if(i){if(Hr.firstStartCodeOffset-14<0)return void si.debugWarn(Hr.LOG_NAME,"firstStartCodeOffset -14 is",Hr.firstStartCodeOffset-14);Hr.hasInitVideoCodec||(Hr.hasInitVideoCodec=!0,si.debugLog(Hr.LOG_NAME,"setCodec"),oi.setCodec(Me,"")),t=Hr.lastBuffer.subarray(Hr.firstStartCodeOffset-14,e)}else t=Hr.lastBuffer.subarray(Hr.firstStartCodeOffset,e);let n=Hr.getNaluDts();Hr.hasInitVideoCodec?(postMessage({cmd:O,type:Be,value:t.byteLength}),postMessage({cmd:O,type:Te,value:n}),Se=n,oi.decode(t,i?1:0,n)):si.debugWarn(Hr.LOG_NAME,"has not init video codec"),Hr.lastBuffer=Hr.lastBuffer.subarray(e),Hr.firstStartCodeOffset=0==r?14:0,Hr.parsedOffset=Hr.firstStartCodeOffset+4,Hr.state="findFirstStartCode"}}}},getNaluDts(){let e=Hr.localDts;return Hr.localDts=Hr.localDts+40,e}},qr={TAG_NAME:"worker TsLoaderV2",first_parse_:!0,tsPacketSize:0,syncOffset:0,pmt_:null,config_:null,media_info_:new On,timescale_:90,duration_:0,pat_:{version_number:0,network_pid:0,program_map_pid:{}},current_program_:null,current_pmt_pid_:-1,program_pmt_map_:{},pes_slice_queues_:{},section_slice_queues_:{},video_metadata_:{vps:null,sps:null,pps:null,details:null},audio_metadata_:{codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},last_pcr_:null,audio_last_sample_pts_:void 0,aac_last_incomplete_data_:null,has_video_:!1,has_audio_:!1,video_init_segment_dispatched_:!1,audio_init_segment_dispatched_:!1,video_metadata_changed_:!1,audio_metadata_changed_:!1,loas_previous_frame:null,video_track_:{type:"video",id:1,sequenceNumber:0,samples:[],length:0},audio_track_:{type:"audio",id:2,sequenceNumber:0,samples:[],length:0},_remainingPacketData:null,init(){},destroy(){qr.media_info_=null,qr.pes_slice_queues_=null,qr.section_slice_queues_=null,qr.video_metadata_=null,qr.audio_metadata_=null,qr.aac_last_incomplete_data_=null,qr.video_track_=null,qr.audio_track_=null,qr._remainingPacketData=null},probe(e){let t=new Uint8Array(e),r=-1,i=188;if(t.byteLength<=3*i)return{needMoreData:!0};for(;-1===r;){let e=Math.min(1e3,t.byteLength-3*i);for(let n=0;n=4&&(r-=4),{match:!0,consumed:0,ts_packet_size:i,sync_offset:r})},_initPmt:()=>({program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}),dispatch(e){qr._remainingPacketData&&(e=pn(qr._remainingPacketData,e),qr._remainingPacketData=null);let t=e.buffer;const r=qr.parseChunks(t);r?qr._remainingPacketData=e.subarray(r):e.length>>6;r[1];let s=(31&r[1])<<8|r[2],a=(48&r[3])>>>4,o=15&r[3],d=!(!qr.pmt_||qr.pmt_.pcr_pid!==s),l={},c=4;if(2==a||3==a){let e=r[4];if(e>0&&(d||3==a)&&(l.discontinuity_indicator=(128&r[5])>>>7,l.random_access_indicator=(64&r[5])>>>6,l.elementary_stream_priority_indicator=(32&r[5])>>>5,(16&r[5])>>>4)){let e=300*(r[6]<<25|r[7]<<17|r[8]<<9|r[9]<<1|r[10]>>>7)+((1&r[10])<<8|r[11]);qr.last_pcr_=e}if(2==a||5+e===188){t+=188,204===qr.tsPacketSize&&(t+=16);continue}c=5+e}if(1==a||3==a)if(0===s||s===qr.current_pmt_pid_||null!=qr.pmt_&&qr.pmt_.pid_stream_type[s]===In){let r=188-c;qr.handleSectionSlice(e,t+c,r,{pid:s,payload_unit_start_indicator:n,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}else if(null!=qr.pmt_&&null!=qr.pmt_.pid_stream_type[s]){let r=188-c,i=qr.pmt_.pid_stream_type[s];s!==qr.pmt_.common_pids.h264&&s!==qr.pmt_.common_pids.h265&&s!==qr.pmt_.common_pids.adts_aac&&s!==qr.pmt_.common_pids.loas_aac&&s!==qr.pmt_.common_pids.ac3&&s!==qr.pmt_.common_pids.eac3&&s!==qr.pmt_.common_pids.opus&&s!==qr.pmt_.common_pids.mp3&&!0!==qr.pmt_.pes_private_data_pids[s]&&!0!==qr.pmt_.timed_id3_pids[s]&&!0!==qr.pmt_.synchronous_klv_pids[s]&&!0!==qr.pmt_.asynchronous_klv_pids[s]||qr.handlePESSlice(e,t+c,r,{pid:s,stream_type:i,payload_unit_start_indicator:n,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}t+=188,204===qr.tsPacketSize&&(t+=16)}return qr.dispatchAudioVideoMediaSegment(),t},handleSectionSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=qr.section_slice_queues_[i.pid];if(i.payload_unit_start_indicator){let a=n[0];if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t+1,Math.min(r,a));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?qr.emitSectionSlices(s,i):qr.clearSlices(s,i)}for(let o=1+a;o=s.expected_length&&qr.clearSlices(s,i),o+=d.byteLength}}else if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t,Math.min(r,s.expected_length-s.total_length));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?qr.emitSectionSlices(s,i):s.total_length>=s.expected_length&&qr.clearSlices(s,i)}},handlePESSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=n[0]<<16|n[1]<<8|n[2];n[3];let a=n[4]<<8|n[5];if(i.payload_unit_start_indicator){if(1!==s)return void si.debugWarn(qr.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${s}`);let e=qr.pes_slice_queues_[i.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?qr.emitPESSlices(e,i):qr.clearSlices(e,i)),qr.pes_slice_queues_[i.pid]=new Mn,qr.pes_slice_queues_[i.pid].random_access_indicator=i.random_access_indicator}if(null==qr.pes_slice_queues_[i.pid])return;let o=qr.pes_slice_queues_[i.pid];o.slices.push(n),i.payload_unit_start_indicator&&(o.expected_length=0===a?0:a+6),o.total_length+=n.byteLength,o.expected_length>0&&o.expected_length===o.total_length?qr.emitPESSlices(o,i):o.expected_length>0&&o.expected_length>>6,o=t[8];2!==a&&3!==a||(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,s=3===a?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:r);let d,l=9+o;if(0!==n){if(n<3+o)return void si.debugWarn(qr.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");d=n-3-o}else d=t.byteLength-l;let c=t.subarray(l,l+d);switch(e.stream_type){case xn:case Bn:qr.parseMP3Payload(c,r);break;case Tn:qr.pmt_.common_pids.opus===e.pid||qr.pmt_.common_pids.ac3===e.pid||qr.pmt_.common_pids.eac3===e.pid||(qr.pmt_.asynchronous_klv_pids[e.pid]?qr.parseAsynchronousKLVMetadataPayload(c,e.pid,i):qr.pmt_.smpte2038_pids[e.pid]?qr.parseSMPTE2038MetadataPayload(c,r,s,e.pid,i):qr.parsePESPrivateDataPayload(c,r,s,e.pid,i));break;case kn:qr.parseADTSAACPayload(c,r);break;case Cn:qr.parseLOASAACPayload(c,r);break;case Dn:case Pn:break;case Ln:qr.pmt_.timed_id3_pids[e.pid]?qr.parseTimedID3MetadataPayload(c,r,s,e.pid,i):qr.pmt_.synchronous_klv_pids[e.pid]&&qr.parseSynchronousKLVMetadataPayload(c,r,s,e.pid,i);break;case Fn:qr.parseH264Payload(c,r,s,e.random_access_indicator);break;case Rn:qr.parseH265Payload(c,r,s,e.random_access_indicator)}}else if((188===i||191===i||240===i||241===i||255===i||242===i||248===i)&&e.stream_type===Tn){let r,s=6;r=0!==n?n:t.byteLength-s;let a=t.subarray(s,s+r);qr.parsePESPrivateDataPayload(a,void 0,void 0,e.pid,i)}}else si.debugError(qr.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${r}`)},parsePAT(e){let t=e[0];if(0!==t)return void Log.e(qr.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let r=(15&e[1])<<8|e[2];e[3],e[4];let i=(62&e[5])>>>1,n=1&e[5],s=e[6];e[7];let a=null;if(1===n&&0===s)a={version_number:0,network_pid:0,program_pmt_pid:{}},a.version_number=i;else if(a=qr.pat_,null==a)return;let o=r-5-4,d=-1,l=-1;for(let t=8;t<8+o;t+=4){let r=e[t]<<8|e[t+1],i=(31&e[t+2])<<8|e[t+3];0===r?a.network_pid=i:(a.program_pmt_pid[r]=i,-1===d&&(d=r),-1===l&&(l=i))}1===n&&0===s&&(null==qr.pat_&&si.debugLog(qr.TAG_NAME,`Parsed first PAT: ${JSON.stringify(a)}`),qr.pat_=a,qr.current_program_=d,qr.current_pmt_pid_=l)},parsePMT(e){let t=e[0];if(2!==t)return void si.debugError(qr.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let r,i=(15&e[1])<<8|e[2],n=e[3]<<8|e[4],s=(62&e[5])>>>1,a=1&e[5],o=e[6];if(e[7],1===a&&0===o)r=qr._initPmt(),r.program_number=n,r.version_number=s,qr.program_pmt_map_[n]=r;else if(r=qr.program_pmt_map_[n],null==r)return;r.pcr_pid=(31&e[8])<<8|e[9];let d=(15&e[10])<<8|e[11],l=12+d,c=i-9-d-4;for(let t=l;t0){for(let i=t+5;i0)for(let i=t+5;iqr.has_video_&&qr.has_audio_?qr.video_init_segment_dispatched_&&qr.audio_init_segment_dispatched_:qr.has_video_&&!qr.has_audio_?qr.video_init_segment_dispatched_:!(qr.has_video_||!qr.has_audio_)&&qr.audio_init_segment_dispatched_,dispatchVideoInitSegment(){let e=qr.video_metadata_.details,t={type:"video"};t.id=qr.video_track_.id,t.timescale=1e3,t.duration=qr.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;let r=t.frameRate.fps_den,i=t.frameRate.fps_num;if(t.refSampleDuration=r/i*1e3,t.codec=e.codec_mimetype,qr.video_metadata_.vps){si.isHevc=!0;let e=qr.video_metadata_.vps.data.subarray(4),r=qr.video_metadata_.sps.data.subarray(4),i=qr.video_metadata_.pps.data.subarray(4);t.hvcc=Yr({vps:e,sps:r,pps:i}),0==qr.video_init_segment_dispatched_&&si.debugLog(qr.TAG_NAME,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.hvcc&&si.decodeVideo(t.hvcc,0,!0,0)}else{let e=qr.video_metadata_.sps.data.subarray(4),r=qr.video_metadata_.pps.data.subarray(4);t.avcc=Pr({sps:e,pps:r}),0==qr.video_init_segment_dispatched_&&si.debugLog(qr.TAG_NAME,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.avcc&&si.decodeVideo(t.avcc,0,!0,0)}qr.video_init_segment_dispatched_=!0,qr.video_metadata_changed_=!1;let n=qr.media_info_;n.hasVideo=!0,n.width=t.codecWidth,n.height=t.codecHeight,n.fps=t.frameRate.fps,n.profile=t.profile,n.level=t.level,n.refFrames=e.ref_frames,n.chromaFormat=e.chroma_format_string,n.sarNum=t.sarRatio.width,n.sarDen=t.sarRatio.height,n.videoCodec=t.codec,n.hasAudio&&n.audioCodec?n.mimeType=`video/mp2t; codecs="${n.videoCodec},${n.audioCodec}"`:n.mimeType=`video/mp2t; codecs="${n.videoCodec}"`},dispatchVideoMediaSegment(){qr.isInitSegmentDispatched()&&qr.video_track_.length&&qr._preDoDecode()},dispatchAudioMediaSegment(){qr.isInitSegmentDispatched()&&qr.audio_track_.length&&qr._preDoDecode()},dispatchAudioVideoMediaSegment(){qr.isInitSegmentDispatched()&&(qr.audio_track_.length||qr.video_track_.length)&&qr._preDoDecode()},parseADTSAACPayload(e,t){if(qr.has_video_&&!qr.video_init_segment_dispatched_)return;if(qr.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+qr.aac_last_incomplete_data_.byteLength);t.set(qr.aac_last_incomplete_data_,0),t.set(e,qr.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/qr.timescale_),"aac"===qr.audio_metadata_.codec){if(null==t&&null!=qr.audio_last_sample_pts_)r=1024/qr.audio_metadata_.sampling_frequency*1e3,i=qr.audio_last_sample_pts_+r;else if(null==t)return void si.debugWarn(qr.TAG_NAME,"AAC: Unknown pts");if(qr.aac_last_incomplete_data_&&qr.audio_last_sample_pts_){r=1024/qr.audio_metadata_.sampling_frequency*1e3;let e=qr.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(si.debugWarn(qr.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Jt(e),a=null,o=i;for(;null!=(a=s.readNextAACFrame());){r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==qr.audio_init_segment_dispatched_?(qr.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},qr.dispatchAudioInitSegment(e)):qr.detectAudioMetadataChange(e)&&(qr.dispatchAudioMediaSegment(),qr.dispatchAudioInitSegment(e)),n=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:ae};qr.audio_track_.samples.push(s),qr.audio_track_.length+=i.byteLength,o+=r}s.hasIncompleteData()&&(qr.aac_last_incomplete_data_=s.getIncompleteData()),n&&(qr.audio_last_sample_pts_=n)},parseLOASAACPayload(e,t){if(qr.has_video_&&!qr.video_init_segment_dispatched_)return;if(qr.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+qr.aac_last_incomplete_data_.byteLength);t.set(qr.aac_last_incomplete_data_,0),t.set(e,qr.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/qr.timescale_),"aac"===qr.audio_metadata_.codec){if(null==t&&null!=qr.audio_last_sample_pts_)r=1024/qr.audio_metadata_.sampling_frequency*1e3,i=qr.audio_last_sample_pts_+r;else if(null==t)return void si.debugWarn(qr.TAG_NAME,"AAC: Unknown pts");if(qr.aac_last_incomplete_data_&&qr.audio_last_sample_pts_){r=1024/qr.audio_metadata_.sampling_frequency*1e3;let e=qr.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(si.debugWarn(qr.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Qt(e),a=null,o=i;for(;null!=(a=s.readNextAACFrame(dr(this.loas_previous_frame)?void 0:this.loas_previous_frame));){qr.loas_previous_frame=a,r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==qr.audio_init_segment_dispatched_?(qr.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},qr.dispatchAudioInitSegment(e)):qr.detectAudioMetadataChange(e)&&(qr.dispatchAudioMediaSegment(),qr.dispatchAudioInitSegment(e)),n=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:ae};qr.audio_track_.samples.push(s),qr.audio_track_.length+=i.byteLength,o+=r}s.hasIncompleteData()&&(qr.aac_last_incomplete_data_=s.getIncompleteData()),n&&(qr.audio_last_sample_pts_=n)},parseAC3Payload(e,t){},parseEAC3Payload(e,t){},parseOpusPayload(e,t){},parseMP3Payload(e,t){if(qr.has_video_&&!qr.video_init_segment_dispatched_)return;let r=[44100,48e3,32e3,0],i=[22050,24e3,16e3,0],n=[11025,12e3,8e3,0],s=e[1]>>>3&3,a=(6&e[1])>>1;e[2];let o=(12&e[2])>>>2,d=3!=(e[3]>>>6&3)?2:1,l=0,c=34;switch(s){case 0:l=n[o];break;case 2:l=i[o];break;case 3:l=r[o]}switch(a){case 1:c=34;break;case 2:c=33;break;case 3:c=32}const u={};u.object_type=c,u.sample_rate=l,u.channel_count=d,u.data=e;const h={codec:"mp3",data:u};0==qr.audio_init_segment_dispatched_?(qr.audio_metadata_={codec:"mp3",object_type:c,sample_rate:l,channel_count:d},qr.dispatchAudioInitSegment(h)):qr.detectAudioMetadataChange(h)&&(qr.dispatchAudioMediaSegment(),qr.dispatchAudioInitSegment(h));let f={payload:e,length:e.byteLength,pts:t/qr.timescale_,dts:t/qr.timescale_,type:ae};qr.audio_track_.samples.push(f),qr.audio_track_.length+=e.byteLength},detectAudioMetadataChange(e){if(e.codec!==qr.audio_metadata_.codec)return si.debugLog(qr.TAG_NAME,`Audio: Audio Codecs changed from ${qr.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===qr.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==qr.audio_metadata_.audio_object_type)return si.debugLog(qr.TAG_NAME,`AAC: AudioObjectType changed from ${qr.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==qr.audio_metadata_.sampling_freq_index)return si.debugLog(qr.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${qr.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==qr.audio_metadata_.channel_config)return si.debugLog(qr.TAG_NAME,`AAC: Channel configuration changed from ${qr.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===qr.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==qr.audio_metadata_.sampling_frequency)return si.debugLog(qr.TAG_NAME,`AC3: Sampling Frequency changed from ${qr.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==qr.audio_metadata_.bit_stream_identification)return si.debugLog(qr.TAG_NAME,`AC3: Bit Stream Identification changed from ${qr.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==qr.audio_metadata_.bit_stream_mode)return si.debugLog(qr.TAG_NAME,`AC3: BitStream Mode changed from ${qr.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==qr.audio_metadata_.channel_mode)return si.debugLog(qr.TAG_NAME,`AC3: Channel Mode changed from ${qr.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==qr.audio_metadata_.low_frequency_effects_channel_on)return si.debugLog(qr.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${qr.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===qr.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==qr.audio_metadata_.sample_rate)return si.debugLog(qr.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${qr.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==qr.audio_metadata_.channel_count)return si.debugLog(qr.TAG_NAME,`Opus: Channel count changed from ${qr.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===qr.audio_metadata_.codec){const t=e.data;if(t.object_type!==qr.audio_metadata_.object_type)return si.debugLog(qr.TAG_NAME,`MP3: AudioObjectType changed from ${qr.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==qr.audio_metadata_.sample_rate)return si.debugLog(qr.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${qr.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==qr.audio_metadata_.channel_count)return si.debugLog(qr.TAG_NAME,`MP3: Channel count changed from ${qr.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1},dispatchAudioInitSegment(e){let t={type:"audio"};if(t.id=qr.audio_track_.id,t.timescale=1e3,t.duration=qr.duration_,"aac"===qr.audio_metadata_.codec){let r="aac"===e.codec?e.data:null,i=new Gn(r);t.audioSampleRate=i.sampling_rate,t.audioSampleRateIndex=i.sampling_index,t.channelCount=i.channel_count,t.codec=i.codec_mimetype,t.originalCodec=i.original_codec_mimetype,t.config=i.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale;const n=qt({profile:si._opt.mseDecodeAudio?i.object_type:i.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});si.decodeAudio(n,0)}else"ac-3"===qr.audio_metadata_.codec||"ec-3"===qr.audio_metadata_.codec||"opus"===qr.audio_metadata_.codec||"mp3"===qr.audio_metadata_.codec&&(t.audioSampleRate=qr.audio_metadata_.sample_rate,t.channelCount=qr.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==qr.audio_init_segment_dispatched_&&si.debugLog(qr.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),qr.audio_init_segment_dispatched_=!0,qr.video_metadata_changed_=!1;let r=qr.media_info_;r.hasAudio=!0,r.audioCodec=t.originalCodec,r.audioSampleRate=t.audioSampleRate,r.audioChannelCount=t.channelCount,r.hasVideo&&r.videoCodec?r.mimeType=`video/mp2t; codecs="${r.videoCodec},${r.audioCodec}"`:r.mimeType=`video/mp2t; codecs="${r.audioCodec}"`},dispatchPESPrivateDataDescriptor(e,t,r){},parsePESPrivateDataPayload(e,t,r,i,n){let s=new $n;if(s.pid=i,s.stream_id=n,s.len=e.byteLength,s.data=e,null!=t){let e=Math.floor(t/qr.timescale_);s.pts=e}else s.nearest_pts=qr.getNearestTimestampMilliseconds();if(null!=r){let e=Math.floor(r/qr.timescale_);s.dts=e}},parseTimedID3MetadataPayload(e,t,r,i,n){si.debugLog(qr.TAG_NAME,`Timed ID3 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseSynchronousKLVMetadataPayload(e,t,r,i,n){si.debugLog(qr.TAG_NAME,`Synchronous KLV Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseAsynchronousKLVMetadataPayload(e,t,r){si.debugLog(qr.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${r}`)},parseSMPTE2038MetadataPayload(e,t,r,i,n){si.debugLog(qr.TAG_NAME,`SMPTE 2038 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},getNearestTimestampMilliseconds:()=>null!=qr.audio_last_sample_pts_?Math.floor(qr.audio_last_sample_pts_):null!=qr.last_pcr_?Math.floor(qr.last_pcr_/300/qr.timescale_):void 0,_preDoDecode(){const e=qr.video_track_,t=qr.audio_track_;let r=e.samples;t.samples.length>0&&(r=e.samples.concat(t.samples),r=r.sort(((e,t)=>e.dts-t.dts))),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===oe?qr._doDecodeVideo({...e,payload:t}):e.type===ae&&qr._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0},_doDecodeVideo(e){const t=new Uint8Array(e.payload);let r=null;r=e.isHevc?Xr(t,e.isIFrame):Ir(t,e.isIFrame),e.isIFrame&&si.calcIframeIntervalTimestamp(e.dts);let i=si.cryptoPayload(r,e.isIFrame);si.decode(i,{type:oe,ts:e.dts,isIFrame:e.isIFrame,cts:e.cts})},_doDecodeAudio(e){const t=new Uint8Array(e.payload);let r=t;yr(si._opt.m7sCryptoAudio)&&(r=si.cryptoPayloadAudio(t)),si.decode(r,{type:ae,ts:e.dts,isIFrame:!1,cts:0})}},ni=null;br()&&(ni={TAG_NAME:"worker MediaSource",_resetInIt(){ni.isAvc=null,ni.isAAC=null,ni.videoInfo={},ni.videoMeta={},ni.audioMeta={},ni.sourceBuffer=null,ni.audioSourceBuffer=null,ni.hasInit=!1,ni.hasAudioInit=!1,ni.isAudioInitInfo=!1,ni.videoMimeType="",ni.audioMimeType="",ni.cacheTrack={},ni.cacheAudioTrack={},ni.timeInit=!1,ni.sequenceNumber=0,ni.audioSequenceNumber=0,ni.firstRenderTime=null,ni.firstAudioTime=null,ni.mediaSourceAppendBufferFull=!1,ni.mediaSourceAppendBufferError=!1,ni.mediaSourceAddSourceBufferError=!1,ni.mediaSourceBufferError=!1,ni.mediaSourceError=!1,ni.prevTimestamp=null,ni.decodeDiffTimestamp=null,ni.prevDts=null,ni.prevAudioDts=null,ni.prevPayloadBufferSize=0,ni.isWidthOrHeightChanged=!1,ni.prevTs=null,ni.prevAudioTs=null,ni.eventListenList=[],ni.pendingRemoveRanges=[],ni.pendingSegments=[],ni.pendingAudioRemoveRanges=[],ni.pendingAudioSegments=[],ni.supportVideoFrameCallbackHandle=null,ni.audioSourceBufferCheckTimeout=null,ni.audioSourceNoDataCheckTimeout=null,ni.hasPendingEos=!1,ni.$video={currentTime:0,readyState:0}},init(){ni.events=new mn,ni._resetInIt(),ni.mediaSource=new self.MediaSource,ni.isDecodeFirstIIframe=!!vr(si._opt.checkFirstIFrame),ni._bindMediaSourceEvents()},destroy(){ni.stop(),ni._clearAudioSourceBufferCheckTimeout(),ni.eventListenList&&ni.eventListenList.length&&(ni.eventListenList.forEach((e=>e())),ni.eventListenList=[]),ni._resetInIt(),ni.mediaSource=null},getState:()=>ni.mediaSource&&ni.mediaSource.readyState,isStateOpen:()=>ni.getState()===vt,isStateClosed:()=>ni.getState()===bt,isStateEnded:()=>ni.getState()===yt,_bindMediaSourceEvents(){const{proxy:e}=ni.events,t=e(ni.mediaSource,St,(()=>{si.debugLog(ni.TAG_NAME,"sourceOpen"),ni._onMediaSourceSourceOpen()})),r=e(ni.mediaSource,wt,(()=>{si.debugLog(ni.TAG_NAME,"sourceClose")})),i=e(ni.mediaSource,Et,(()=>{si.debugLog(ni.TAG_NAME,"sourceended")}));ni.eventListenList.push(t,r,i)},_onMediaSourceSourceOpen(){ni.sourceBuffer||(si.debugLog(ni.TAG_NAME,"onMediaSourceSourceOpen() sourceBuffer is null and next init"),ni._initSourceBuffer()),ni.audioSourceBuffer||(si.debugLog(ni.TAG_NAME,"onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),ni._initAudioSourceBuffer()),ni._hasPendingSegments()&&ni._doAppendSegments()},decodeVideo(e,t,r,i){if(si.isDestroyed)si.debugWarn(ni.TAG_NAME,"decodeVideo() and decoder is destroyed");else if(vr(ni.hasInit))if(r&&e[1]===Bt){const i=15&e[0];if(i===Re&&vr(si._opt.supportMSEDecodeHevc))return void ni.emitError(Le.mediaSourceH265NotSupport);ni.videoInfo.codec=i,postMessage({cmd:R,code:i});const n=new Uint8Array(e);postMessage({cmd:M,buffer:n,codecId:i},[n.buffer]),ni.hasInit=ni._decodeConfigurationRecord(e,t,r,i)}else si.debugWarn(ni.TAG_NAME,`decodeVideo has not init , isIframe is ${r} , payload is ${e[1]} so drop this frame`);else if(!ni.isDecodeFirstIIframe&&r&&(ni.isDecodeFirstIIframe=!0),ni.isDecodeFirstIIframe){if(r&&0===e[1]){const t=15&e[0];let r={};t===Fe?r=Cr(e.slice(5)):t===Re&&(r=Vr(e));const i=ni.videoInfo;i&&i.codecWidth&&i.codecWidth&&r&&r.codecWidth&&r.codecHeight&&(r.codecWidth!==i.codecWidth||r.codecHeight!==i.codecWidth)&&(si.debugWarn(ni.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${i.codecWidth}, old height is ${i.codecHeight},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),ni.isWidthOrHeightChanged=!0,ni.emitError(Le.mseWidthOrHeightChange,`width: ${i.codecWidth}->${r.codecWidth}, height: ${i.codecWidth}->${r.codecHeight}`))}if(ni.isWidthOrHeightChanged)return void si.debugWarn(ni.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(gr(e))return void si.debugLog(ni.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLengthni.prevTs>0&&eA,_decodeConfigurationRecord(e,t,r,i){let n=e.slice(5),s={};if(i===Fe?s=Cr(n):i===Re&&(s=jr(n)),ni.videoInfo.width=s.codecWidth,ni.videoInfo.height=s.codecHeight,0===s.codecWidth&&0===s.codecHeight)return si.debugWarn(ni.TAG_NAME,"_decodeConfigurationRecord error",JSON.stringify(s)),ni.emitError(Le.mediaSourceDecoderConfigurationError,`width is ${0===s.codecWidth} and height is ${s.codecHeight}`),!1;const a={id:Lt,type:"video",timescale:1e3,duration:0,avcc:n,codecWidth:s.codecWidth,codecHeight:s.codecHeight,videoType:s.videoType},o=_n.generateInitSegment(a);ni.isAvc=i===Fe;let d=s.codec;return ni.videoMimeType=d?`video/mp4; codecs="${s.codec}"`:ni.isAvc?_t:gt,postMessage({cmd:k,w:s.codecWidth,h:s.codecHeight}),ni._initSourceBuffer(),ni.appendBuffer(o.buffer),ni.sequenceNumber=0,ni.cacheTrack={},ni.timeInit=!1,!0},_decodeAudioConfigurationRecord(e,t){const r=e[0]>>4,i=e[0]>>1&1,n=r===He,s=r===Ne;if(vr(s||n))return si.debugWarn(ni.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${r} ant auto wasm decode`),ni.emitError(Le.mediaSourceAudioG711NotSupport),!1;const a={id:It,type:"audio",timescale:1e3};let o={};if(Yt(e)){if(o=Zt(e.slice(2)),!o)return!1;a.audioSampleRate=o.sampleRate,a.channelCount=o.channelCount,a.config=o.config,a.refSampleDuration=1024/a.audioSampleRate*a.timescale}else{if(!n)return!1;if(o=Un(e),!o)return!1;a.audioSampleRate=o.samplingRate,a.channelCount=o.channelCount,a.refSampleDuration=1152/a.audioSampleRate*a.timescale}a.codec=o.codec,a.duration=0;let d="mp4",l=o.codec,c=null;n&&vr(si._opt.isFirefox)?(d="mpeg",l="",c=new Uint8Array):c=_n.generateInitSegment(a);let u=`${a.type}/${d}`;return l&&l.length>0&&(u+=`;codecs=${l}`),vr(ni.isAudioInitInfo)&&(ar=r===Ne?i?16:8:0===i?8:16,postMessage({cmd:L,code:r}),postMessage({cmd:P,sampleRate:a.audioSampleRate,channels:a.channelCount,depth:ar}),ni.isAudioInitInfo=!0),ni.audioMimeType=u,ni.isAAC=s,ni._initAudioSourceBuffer(),ni.appendAudioBuffer(c.buffer),!0},_initSourceBuffer(){const{proxy:e}=ni.events;if(null===ni.sourceBuffer&&null!==ni.mediaSource&&ni.isStateOpen()&&ni.videoMimeType){try{si.debugLog(ni.TAG_NAME,"_initSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",ni.videoMimeType),ni.sourceBuffer=ni.mediaSource.addSourceBuffer(ni.videoMimeType)}catch(e){return si.debugError(ni.TAG_NAME,"_initSourceBuffer() appendBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),ni.emitError(Le.mseWorkerAddSourceBufferError,e.code),void(ni.mediaSourceAddSourceBufferError=!0)}if(ni.sourceBuffer){const t=e(ni.sourceBuffer,"error",(e=>{ni.mediaSourceBufferError=!0,si.debugError(ni.TAG_NAME,"mseSourceBufferError mseDecoder.sourceBuffer",e,e.toString()),ni.emitError(Le.mseSourceBufferError,e.code)})),r=e(ni.sourceBuffer,"updateend",(()=>{ni._hasPendingRemoveRanges()?ni._doRemoveRanges():ni._hasPendingSegments()?ni._doAppendSegments():ni.hasPendingEos&&(si.debugLog(ni.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),ni.endOfStream())}));ni.eventListenList.push(t,r)}}else si.debugLog(ni.TAG_NAME,`_initSourceBuffer and mseDecoder.isStateOpen is ${ni.isStateOpen()} and mseDecoder.isAvc === null is ${null===ni.isAvc}`)},_initAudioSourceBuffer(){const{proxy:e}=ni.events;if(null===ni.audioSourceBuffer&&null!==ni.mediaSource&&ni.isStateOpen()&&ni.audioMimeType){try{si.debugLog(ni.TAG_NAME,"_initAudioSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",ni.audioMimeType),ni._clearAudioSourceBufferCheckTimeout(),ni.audioSourceBuffer=ni.mediaSource.addSourceBuffer(ni.audioMimeType)}catch(e){return si.debugError(ni.TAG_NAME,"_initAudioSourceBuffer() addSourceBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),ni.emitError(Le.mseWorkerAddSourceBufferError,e.code),void(ni.mediaSourceAddSourceBufferError=!0)}if(ni.audioSourceBuffer){const t=e(ni.audioSourceBuffer,"error",(e=>{ni.mediaSourceBufferError=!0,si.debugError(ni.TAG_NAME,"mseSourceBufferError mseDecoder.audioSourceBuffer",e.code,e.toString(),e),ni.emitError(Le.mseSourceBufferError,e.code)})),r=e(ni.audioSourceBuffer,"updateend",(()=>{ni._hasPendingRemoveRanges()?ni._doRemoveRanges():ni._hasPendingSegments()?ni._doAppendSegments():ni.hasPendingEos&&(si.debugLog(ni.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),ni.endOfStream())}));ni.eventListenList.push(t,r),null===ni.audioSourceNoDataCheckTimeout&&(ni.audioSourceNoDataCheckTimeout=setTimeout((()=>{ni._clearAudioNoDataCheckTimeout(),ni.emitError(Le.mediaSourceAudioNoDataTimeout)}),1e3))}}else si.debugLog(ni.TAG_NAME,`_initAudioSourceBuffer and mseDecoder.isStateOpen is ${ni.isStateOpen()} and mseDecoder.audioMimeType is ${ni.audioMimeType}`)},_decodeVideo(e,t,r,i,n){let s=e.slice(5),a=s.byteLength;if(0===a)return void si.debugWarn(ni.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let o=(new Date).getTime(),d=!1;ni.prevTimestamp||(ni.prevTimestamp=o,d=!0);const l=o-ni.prevTimestamp;if(ni.decodeDiffTimestamp=l,l>1e3&&!d&&si.isPlayer&&si.debugLog(ni.TAG_NAME,`_decodeVideo now time is ${o} and prev time is ${ni.prevTimestamp}, diff time is ${l} ms`),ni.cacheTrack.id&&t>=ni.cacheTrack.dts){let e=8+ni.cacheTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(_n.types.mdat,4),r.set(ni.cacheTrack.data,8),ni.cacheTrack.duration=t-ni.cacheTrack.dts;let i=_n.moof(ni.cacheTrack,ni.cacheTrack.dts);ni.cacheTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),ni.appendBuffer(n.buffer)}else si.debugLog(ni.TAG_NAME,`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${n} cacheTrack dts is ${ni.cacheTrack&&ni.cacheTrack.dts}`),ni.timeInit=!1,ni.cacheTrack={};ni.cacheTrack||(ni.cacheTrack={}),ni.cacheTrack.id=Lt,ni.cacheTrack.sequenceNumber=++ni.sequenceNumber,ni.cacheTrack.size=a,ni.cacheTrack.dts=t,ni.cacheTrack.cts=i,ni.cacheTrack.isKeyframe=r,ni.cacheTrack.data=s,ni.cacheTrack.flags={isLeading:0,dependsOn:r?2:1,isDependedOn:r?1:0,hasRedundancy:0,isNonSync:r?0:1},ni.prevTimestamp=(new Date).getTime()},_decodeAudio(e,t,r){let i=ni.isAAC?e.slice(2):e.slice(1),n=i.byteLength;if(ni.cacheAudioTrack.id&&t>=ni.cacheAudioTrack.dts){let e=8+ni.cacheAudioTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(_n.types.mdat,4),r.set(ni.cacheAudioTrack.data,8),ni.cacheAudioTrack.duration=t-ni.cacheAudioTrack.dts;let i=_n.moof(ni.cacheAudioTrack,ni.cacheAudioTrack.dts);ni.cacheAudioTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),ni.appendAudioBuffer(n.buffer)}else ni.cacheAudioTrack={};ni.cacheAudioTrack||(ni.cacheAudioTrack={}),ni.cacheAudioTrack.id=It,ni.cacheAudioTrack.sequenceNumber=++ni.audioSequenceNumber,ni.cacheAudioTrack.size=n,ni.cacheAudioTrack.dts=t,ni.cacheAudioTrack.cts=0,ni.cacheAudioTrack.data=i,ni.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}},appendBuffer(e){si.isDestroyed?si.debugWarn(ni.TAG_NAME,"appendBuffer() player is destroyed"):ni.mediaSourceAddSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):ni.mediaSourceAppendBufferFull?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):ni.mediaSourceAppendBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):ni.mediaSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(ni.pendingSegments.push(e),ni.sourceBuffer&&(si._opt.mseAutoCleanupSourceBuffer&&ni._needCleanupSourceBuffer()&&ni._doCleanUpSourceBuffer(),vr(ni.getSourceBufferUpdating())&&ni.isStateOpen()&&vr(ni._hasPendingRemoveRanges()))?ni._doAppendSegments():ni.isStateClosed()?(ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):ni.isStateEnded()&&(ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,"mediaSource is end")))},appendAudioBuffer(e){si.isDestroyed?si.debugWarn(ni.TAG_NAME,"appendAudioBuffer() player is destroyed"):ni.mediaSourceAddSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):ni.mediaSourceAppendBufferFull?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):ni.mediaSourceAppendBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):ni.mediaSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(ni.pendingAudioSegments.push(e),ni.audioSourceBuffer&&(si._opt.mseAutoCleanupSourceBuffer&&ni._needCleanupSourceBuffer()&&ni._doCleanUpSourceBuffer(),vr(ni.getAudioSourceBufferUpdating())&&ni.isStateOpen()&&vr(ni._hasPendingRemoveRanges()))?ni._doAppendSegments():ni.isStateClosed()?(ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):ni.isStateEnded()&&(ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,"mediaSource is end")))},getSourceBufferUpdating:()=>ni.sourceBuffer&&ni.sourceBuffer.updating,getAudioSourceBufferUpdating:()=>ni.audioSourceBuffer&&ni.audioSourceBuffer.updating,stop(){ni.abortSourceBuffer(),ni.removeSourceBuffer(),ni.endOfStream()},clearUpAllSourceBuffer(){if(ni.sourceBuffer){const e=ni.sourceBuffer.buffered;for(let t=0;tni.pendingSegments.length>0||ni.pendingAudioSegments.length>0,getPendingSegmentsLength:()=>ni.pendingSegments.length,_handleUpdatePlaybackRate(){},_doAppendSegments(){if(ni.isStateClosed()||ni.isStateEnded())si.debugLog(ni.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==ni.sourceBuffer){if(ni.needInitAudio()&&null===ni.audioSourceBuffer)return si.debugLog(ni.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===ni.audioSourceBufferCheckTimeout&&(ni.audioSourceBufferCheckTimeout=setTimeout((()=>{ni._clearAudioSourceBufferCheckTimeout(),ni.emitError(Le.mediaSourceAudioInitTimeout)}),1e3)));if(vr(ni.getSourceBufferUpdating())&&ni.pendingSegments.length>0){const e=ni.pendingSegments.shift();try{ni.sourceBuffer.appendBuffer(e)}catch(e){si.debugError(ni.TAG_NAME,"mseDecoder.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(ni.stop(),ni.mediaSourceAppendBufferFull=!0,ni.emitError(Le.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(ni.stop(),ni.mediaSourceAppendBufferError=!0,ni.emitError(Le.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(ni.stop(),ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,`code is ${e.code} , message is ${e.message}`))}}if(vr(ni.getAudioSourceBufferUpdating())&&ni.pendingAudioSegments.length>0){const e=ni.pendingAudioSegments.shift();try{ni.audioSourceBuffer.appendBuffer(e)}catch(e){si.debugError(ni.TAG_NAME,"mseDecoder.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(ni.stop(),ni.mediaSourceAppendBufferFull=!0,ni.emitError(Le.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(ni.stop(),ni.mediaSourceAppendBufferError=!0,ni.emitError(Le.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(ni.stop(),ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,e.code,`code is ${e.code} , message is ${e.message}`))}}}else si.debugLog(ni.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")},_doCleanUpSourceBuffer(){const e=ni.$video.currentTime;if(ni.sourceBuffer){const t=ni.sourceBuffer.buffered;let r=!1;for(let i=0;i=si._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-si._opt.mseAutoCleanupMinBackwardDuration;ni.pendingRemoveRanges.push({start:n,end:t})}}else s=si._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-si._opt.mseAutoCleanupMinBackwardDuration;ni.pendingAudioRemoveRanges.push({start:n,end:t})}}else sni.pendingRemoveRanges.length>0||ni.pendingAudioRemoveRanges.length>0,needInitAudio:()=>si._opt.hasAudio&&si._opt.mseDecodeAudio,_doRemoveRanges(){if(ni.sourceBuffer&&vr(ni.getSourceBufferUpdating())){let e=ni.pendingRemoveRanges;for(;e.length&&vr(ni.getSourceBufferUpdating());){let t=e.shift();try{ni.sourceBuffer.remove(t.start,t.end)}catch(e){si.debugWarn(ni.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e,e.toString())}}}if(ni.audioSourceBuffer&&vr(ni.getAudioSourceBufferUpdating())){let e=ni.pendingAudioRemoveRanges;for(;e.length&&vr(ni.getAudioSourceBufferUpdating());){let t=e.shift();try{ni.audioSourceBuffer.remove(t.start,t.end)}catch(e){si.debugWarn(ni.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e,e.toString())}}}},_getPlaybackRate(){},_needCleanupSourceBuffer(){if(vr(si._opt.mseAutoCleanupSourceBuffer))return!1;const e=ni.$video.currentTime;if(ni.sourceBuffer){let t=ni.sourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=si._opt.mseAutoCleanupMaxBackwardDuration)return!0}if(ni.audioSourceBuffer){let t=ni.audioSourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=si._opt.mseAutoCleanupMaxBackwardDuration)return!0}return!1},_clearAudioSourceBufferCheckTimeout(){ni.audioSourceBufferCheckTimeout&&(clearTimeout(ni.audioSourceBufferCheckTimeout),ni.audioSourceBufferCheckTimeout=null)},_clearAudioNoDataCheckTimeout(){ni.audioSourceNoDataCheckTimeout&&(clearTimeout(ni.audioSourceNoDataCheckTimeout),ni.audioSourceNoDataCheckTimeout=null)},getHandle:()=>ni.mediaSource.handle,emitError(e){postMessage({cmd:se,value:e,msg:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""})}});let si={isPlayer:!0,isHevc:null,isPlayback:!1,dropping:!1,isPushDropping:!1,isWorkerFetch:!1,isDestroyed:!1,fetchStatus:Ct,_opt:Ar(),mp3Demuxer:null,delay:-1,pushLatestDelay:-1,firstTimestamp:null,startTimestamp:null,preDelayTimestamp:null,stopId:null,streamFps:null,streamAudioFps:null,streamVideoFps:null,writableStream:null,networkDelay:0,webglObj:null,startStreamRateAndStatsInterval:function(){si.stopStreamRateAndStatsInterval(),l=setInterval((()=>{d&&d(0);const e=JSON.stringify({demuxBufferDelay:si.getVideoBufferLength(),audioDemuxBufferDelay:si.getAudioBufferLength(),streamBufferByteLength:si.getStreamBufferLength(),netBuf:si.networkDelay||0,pushLatestDelay:si.pushLatestDelay||0,latestDelay:si.delay,isStreamTsMoreThanLocal:je,wasmDecodeDelay:Se-Ee});postMessage({cmd:O,type:Ce,value:e})}),1e3)},stopStreamRateAndStatsInterval:function(){l&&(clearInterval(l),l=null)},useOffscreen:function(){return si._opt.useOffscreen&&"undefined"!=typeof OffscreenCanvas},getDelay:function(e,t){if(!e||si._opt.hasVideo&&!B)return-1;if(t===ae)return si.delay;if(si.preDelayTimestamp&&si.preDelayTimestamp>e)return si.preDelayTimestamp-e>1e3&&si.debugWarn("worker",`getDelay() and preDelayTimestamp is ${si.preDelayTimestamp} > timestamp is ${e} more than ${si.preDelayTimestamp-e}ms and return ${si.delay}`),si.preDelayTimestamp=e,si.delay;if(si.firstTimestamp){if(e){const t=Date.now()-si.startTimestamp,r=e-si.firstTimestamp;t>=r?(je=!1,si.delay=t-r):(je=!0,si.delay=r-t)}}else si.firstTimestamp=e,si.startTimestamp=Date.now(),si.delay=-1;return si.preDelayTimestamp=e,si.delay},getDelayNotUpdateDelay:function(e,t){if(!e||si._opt.hasVideo&&!B)return-1;if(t===ae)return si.pushLatestDelay;if(si.preDelayTimestamp&&si.preDelayTimestamp-e>1e3)return si.debugWarn("worker",`getDelayNotUpdateDelay() and preDelayTimestamp is ${si.preDelayTimestamp} > timestamp is ${e} more than ${si.preDelayTimestamp-e}ms and return -1`),-1;if(si.firstTimestamp){let t=-1;if(e){const r=Date.now()-si.startTimestamp,i=e-si.firstTimestamp;r>=i?(je=!1,t=r-i):(je=!0,t=i-r)}return t}return-1},resetDelay:function(){si.firstTimestamp=null,si.startTimestamp=null,si.delay=-1,si.dropping=!1},resetAllDelay:function(){si.resetDelay(),si.preDelayTimestamp=null},doDecode:function(e){si._opt.isEmitSEI&&e.type===oe&&si.isWorkerFetch&&si.findSei(e.payload,e.ts),si.isPlayUseMSEAndDecoderInWorker()?e.type===ae?si._opt.mseDecodeAudio?ni.decodeAudio(e.payload,e.ts):e.decoder.decode(e.payload,e.ts):e.type===oe&&ni.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):si._opt.useWCS&&si.useOffscreen()&&e.type===oe&&s.decode?s.decode(e.payload,e.ts,e.cts):e.decoder.decode(e.payload,e.ts,e.isIFrame,e.cts)},decodeNext(e){if(0===i.length)return;const t=e.ts,n=i[0],s=e.type===oe&&gr(e.payload);if(vr(r))s&&(si.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n isVideoSqeHeader is ${s}`),i.shift(),si.doDecode(n));else{const r=n.ts-t,a=n.type===ae&&e.type===oe;(r<=20||a||s)&&(si.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n diff is ${r} and isVideoAndNextAudio is ${a} and isVideoSqeHeader is ${s}`),i.shift(),si.doDecode(n))}},init:function(){si.debugLog("worker","init and opt is",JSON.stringify(si._opt));const e=si._opt.playType===v,t=si._opt.playType===b;if(kr.init(),si.isPlayer=e,si.isPlayback=t,si.isPlayUseMSEAndDecoderInWorker()&&ni&&ni.init(),s&&si._opt.useWCS&&si.useOffscreen()&&s.init(),vr(si.isPlaybackCacheBeforeDecodeForFpsRender())){si.debugLog("worker","setInterval()");const t=()=>{const t=si._opt.videoBuffer+si._opt.videoBufferDelay;let r=null;if(i.length){if(si.isPushDropping)return void si.debugWarn("worker",`loop() isPushDropping is true and bufferList length is ${i.length}`);if(si.dropping){for(r=i.shift(),si.debugWarn("worker",`loop() dropBuffer is dropping and isIFrame ${r.isIFrame} and delay is ${si.delay} and bufferlist is ${i.length}`);!r.isIFrame&&i.length;)r=i.shift();const e=si.getDelayNotUpdateDelay(r.ts,r.type);r.isIFrame&&e<=si.getNotDroppingDelayTs()&&(si.debugLog("worker","loop() is dropping = false, is iFrame"),si.dropping=!1,si.doDecode(r),si.decodeNext(r))}else if(si.isPlayback||si.isPlayUseMSE()||0===si._opt.videoBuffer)for(;i.length;)r=i.shift(),si.doDecode(r);else if(r=i[0],-1===si.getDelay(r.ts,r.type))si.debugLog("worker","loop() common dumex delay is -1 ,data.ts is",r.ts),i.shift(),si.doDecode(r),si.decodeNext(r);else if(si.delay>t&&e)si.hasIframeInBufferList()?(si.debugLog("worker",`delay is ${si.delay} > maxDelay ${t}, set dropping is true`),si.resetAllDelay(),si.dropping=!0,postMessage({cmd:H})):(i.shift(),si.doDecode(r),si.decodeNext(r));else for(;i.length;){if(r=i[0],!(si.getDelay(r.ts,r.type)>si._opt.videoBuffer)){si.delay<0&&si.debugWarn("worker",`loop() do not decode and delay is ${si.delay}, bufferList is ${i.length}`);break}i.shift(),si.doDecode(r)}}else-1!==si.delay&&si.debugLog("worker","loop() bufferList is empty and reset delay"),si.resetAllDelay()};si.stopId=setInterval((()=>{let e=(new Date).getTime();Je||(Je=e);const r=e-Je;r>100&&si.debugWarn("worker",`loop demux diff time is ${r}`),t(),Je=(new Date).getTime()}),20)}else si.debugLog("worker","playback and playbackIsCacheBeforeDecodeForFpsRender is true");if(vr(si._opt.checkFirstIFrame)&&(B=!0),si.isPlayUseMSEAndDecoderInWorker()&&ni){const e=ni.getHandle();e&&postMessage({cmd:ie,mseHandle:e},[e])}},playbackCacheLoop:function(){si.clearPlaybackCacheLoop();const e=()=>{let e=null;i.length&&(e=i.shift(),si.doDecode(e))};e();const t=Math.ceil(1e3/(si.streamFps*si._opt.playbackRate));si.debugLog("worker",`playbackCacheLoop fragDuration is ${t}, streamFps is ${si.streamFps}, streamAudioFps is ${si.streamAudioFps} ,streamVideoFps is ${si.streamVideoFps} playbackRate is ${si._opt.playbackRate}`),si.stopId=setInterval(e,t)},clearPlaybackCacheLoop:function(){si.stopId&&(clearInterval(si.stopId),si.stopId=null)},startPlaybackCacheLoop:function(){si.playbackCacheLoop()},close:function(){if(si.debugLog("worker","close"),si.isDestroyed=!0,Ur(),!o||1!==o.readyState&&2!==o.readyState?o&&si.debugLog("worker",`close() and socket.readyState is ${o.readyState}`):(Sr=!0,o.close(1e3,"Client disconnecting")),o=null,si.stopStreamRateAndStatsInterval(),si.stopId&&(clearInterval(si.stopId),si.stopId=null),si.mp3Demuxer&&(si.mp3Demuxer.destroy(),si.mp3Demuxer=null),si.writableStream&&vr(si.writableStream.locked)&&si.writableStream.close().catch((e=>{si.debugLog("worker","close() and writableStream.close() error",e.toString(),e)})),si.writableStream=null,ai)try{ai.clear&&ai.clear(),ai=null}catch(e){si.debugLog("worker","close() and audioDecoder.clear error",e.toString(),e)}if(oi)try{oi.clear&&oi.clear(),oi=null}catch(e){si.debugLog("worker","close() and videoDecoder.clear error",e.toString())}d=null,Je=null,je=!1,Se=0,Ee=0,s&&(s.destroy&&s.destroy(),s=null),ni&&(ni.destroy(),ni=null),si.firstTimestamp=null,si.startTimestamp=null,si.networkDelay=0,si.streamFps=null,si.streamAudioFps=null,si.streamVideoFps=null,si.delay=-1,si.pushLatestDelay=-1,si.preDelayTimestamp=null,si.dropping=!1,si.isPushDropping=!1,si.isPlayer=!0,si.isPlayback=!1,si.isWorkerFetch=!1,si.isHevc=null,si._opt=Ar(),si.webglObj&&(si.webglObj.destroy(),si.offscreenCanvas.removeEventListener("webglcontextlost",si.onOffscreenCanvasWebglContextLost),si.offscreenCanvas.removeEventListener("webglcontextrestored",si.onOffscreenCanvasWebglContextRestored),si.offscreenCanvas=null,si.offscreenCanvasGL=null,si.offscreenCanvasCtx=null),i=[],n=[],c&&(c.close(),c=null),h=null,f=null,S=!1,E=!1,B=!1,Wt=!1,Vt=!1,Xt=!1,er=null,it=[],Ut=0,Tt=0,Qe=null,tt=null,Nt=null,Ot=null,ar=null,Gt=0,Ht=0,ut=null,At=null,si.fetchStatus=Ct,Er=!0,kr.destroy(),Gr.destroy(),Hr.destroy(),qr.destroy(),si.debug=null,si._opt={},postMessage({cmd:K})},pushBuffer:function(e,t){if(t.type===ae&&Yt(e)){if(si.debugLog("worker",`pushBuffer audio ts is ${t.ts}, isAacCodecPacket is true`),si._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:Q,buffer:t},[t.buffer])}si.decodeAudio(e,t.ts)}else if(t.type===oe&&t.isIFrame&&gr(e)){if(si.debugLog("worker",`pushBuffer video ts is ${t.ts}, isVideoSequenceHeader is true`),si._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:ee,buffer:t},[t.buffer])}si.decodeVideo(e,t.ts,t.isIFrame,t.cts)}else{if(si._opt.isRecording)if(si._opt.isRecordTypeFlv){const r=new Uint8Array(e);postMessage({cmd:te,type:t.type,buffer:r,ts:t.ts},[r.buffer])}else if(si._opt.recordType===w)if(t.type===oe){const r=new Uint8Array(e).slice(5);postMessage({cmd:z,buffer:r,isIFrame:t.isIFrame,ts:t.ts,cts:t.cts},[r.buffer])}else if(t.type===ae&&si._opt.isWasmMp4){const r=new Uint8Array(e),i=Kt(r)?r.slice(2):r.slice(1);postMessage({cmd:I,buffer:i,ts:t.ts},[i.buffer])}if(si.isPlayer){if(t.type===oe){if(Gt>0){const e=t.ts-Ot,r=Gt+Gt/2;e>r&&si.debugLog("worker",`pushBuffer video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts}, preTs is ${Ot},\n diff is ${e} and preTsDuration is ${Gt} and maxDiff is ${r}\n maybe trigger black screen or flower screen\n `)}if(null!==Ot&&Ot>=t.ts&&(si.debugWarn("worker",`pushBuffer() and isIFrame is ${t.isIFrame} and,\n options.ts is ${t.ts} less than (or equal) preTs is ${Ot} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${Ht}`),Ot-t.ts>A&&(si.debugWarn("worker",`pushBuffer,\n preTimestamp is ${Ot}, options.ts is ${t.ts},\n diff is ${Ot-t.ts} more than 3600000,\n and resetAllDelay`),si.resetAllDelay(),Ot=null,Gt=0),si._opt.isDropSameTimestampGop&&vr(t.isIFrame)&&B)){const e=si.hasIframeInBufferList(),t=vr(si.isPushDropping);return si.debugLog("worker",`pushBuffer, isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next dropBuffer`),void(e&&t?si.dropBuffer$2():(si.clearBuffer(!0),yr(si._opt.checkFirstIFrame)&&yr(r)&&(si.isPlayUseMSEAndDecoderInWorker()?ni.isDecodeFirstIIframe=!1:postMessage({cmd:re}))))}Ot>0&&(Gt=t.ts-Ot),Ht=e.byteLength,Ot=t.ts}if(B){const e=si._opt.videoBuffer+si._opt.videoBufferDelay,r=si.getDelayNotUpdateDelay(t.ts,t.type);si.pushLatestDelay=r,si.delay>0&&r>e&&si.delay({type:e.type,ts:e.ts})));si.debugLog("worker",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${i.length}, and ts list is ${JSON.stringify(r)}`)}const r=si.getAudioBufferLength()>0,n=r?60:40;i.length>=n&&(si.debugWarn("worker",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${i.length} more than ${n}, and hasAudio is ${r} an set streamFps is 25`),si.streamVideoFps=25,postMessage({cmd:V,value:si.streamVideoFps}),r?(si.streamAudioFps=25,si.streamFps=si.streamVideoFps+si.streamAudioFps):si.streamFps=si.streamVideoFps,si.playbackCacheLoop())}}},getVideoBufferLength(){let e=0;return i.forEach((t=>{t.type===oe&&(e+=1)})),e},hasIframeInBufferList:()=>i.some((e=>e.type===oe&&e.isIFrame)),isAllIframeInBufferList(){const e=si.getVideoBufferLength();let t=0;return i.forEach((e=>{e.type===oe&&e.isIFrame&&(t+=1)})),e===t},getNotDroppingDelayTs:()=>si._opt.videoBuffer+si._opt.videoBufferDelay/2,getAudioBufferLength(){let e=0;return i.forEach((t=>{t.type===ae&&(e+=1)})),e},getStreamBufferLength(){let e=0;return c&&c.buffer&&(e=c.buffer.byteLength),si._opt.isNakedFlow?kr.lastBuf&&(e=kr.lastBuf.byteLength):si._opt.isTs?qr._remainingPacketData&&(e=qr._remainingPacketData.byteLength):si._opt.isFmp4&&Gr.mp4Box&&(e=Gr.mp4Box.getAllocatedSampleDataSize()),e},fetchStream:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(si.debugLog("worker","fetchStream, url is "+e,"options:",JSON.stringify(t)),si.isWorkerFetch=!0,t.isFlv?si._opt.isFlv=!0:t.isFmp4?si._opt.isFmp4=!0:t.isMpeg4?si._opt.isMpeg4=!0:t.isNakedFlow?si._opt.isNakedFlow=!0:t.isTs&&(si._opt.isTs=!0),d=or((e=>{postMessage({cmd:O,type:Ue,value:e})})),si.startStreamRateAndStatsInterval(),t.isFmp4&&(Gr.listenMp4Box(),si._opt.isFmp4Private&&Gr.initTransportDescarmber()),t.protocol===_){t.isFlv&&(c=new xr(si.demuxFlv())),a=new AbortController;const r=Object.assign({signal:a.signal},{headers:t.options&&t.options.headers||{}});fetch(e,r).then((e=>{if(yr(Sr))return si.debugLog("worker","request abort and run res.body.cancel()"),si.fetchStatus=Ct,void e.body.cancel();if(!mr(e))return si.debugWarn("worker",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),Ur(),void postMessage({cmd:O,type:Le.fetchError,value:`fetch response status is ${e.status} and ok is ${e.ok}`});if(postMessage({cmd:O,type:ke}),hr())si.writableStream=new WritableStream({write:e=>a&&a.signal&&a.signal.aborted?(si.debugLog("worker","writableStream write() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt)):yr(Sr)?(si.debugLog("worker","writableStream write() and requestAbort is true so return"),si.fetchStatus=Pt,void Ur()):void("string"!=typeof e?(si.fetchStatus=Dt,d(e.byteLength),t.isFlv?c.write(e):t.isFmp4?si.demuxFmp4(e):t.isMpeg4?si.demuxMpeg4(e):t.isTs?si.demuxTs(e):t.isNakedFlow&&si.demuxNakedFlow(e)):si.debugWarn("worker",`writableStream write() and value is "${e}" string so return`)),close:()=>{si.debugLog("worker","writableStream close()"),si.fetchStatus=Pt,c&&(c.close(),c=null),Ur(),postMessage({cmd:O,type:Ae,value:g,msg:"fetch done"})},abort:e=>{if(a&&a.signal&&a.signal.aborted)return si.debugLog("worker","writableStream abort() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt);c&&(c.close(),c=null),e.name!==xt?(si.debugLog("worker",`writableStream abort() and e is ${e.toString()}`),Ur(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()})):si.debugLog("worker","writableStream abort() and e.name is AbortError so return")}}),e.body.pipeTo(si.writableStream).catch((e=>{"AbortError"!==e.name&&si.debugLog("worker","writableStream pipeTo() and e is",e.name,e.toString())}));else{const r=e.body.getReader(),i=()=>{r.read().then((e=>{let{done:r,value:n}=e;return r?(si.debugLog("worker","fetchNext().then() and done is true"),si.fetchStatus=Pt,c&&(c.close(),c=null),Ur(),void postMessage({cmd:O,type:Ae,value:g,msg:"fetch done"})):a&&a.signal&&a.signal.aborted?(si.debugLog("worker","fetchNext().then() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt)):yr(Sr)?(si.debugLog("worker","fetchNext().then() and requestAbort is true so return"),si.fetchStatus=Pt,void Ur()):void("string"!=typeof n?(si.fetchStatus=Dt,d(n.byteLength),t.isFlv?c.write(n):t.isFmp4?si.demuxFmp4(n):t.isMpeg4?si.demuxMpeg4(n):t.isTs?si.demuxTs(n):t.isNakedFlow&&si.demuxNakedFlow(n),i()):si.debugWarn("worker",`fetchNext().then() and value "${n}" is string so return`))})).catch((e=>{if(a&&a.signal&&a.signal.aborted)return si.debugLog("worker","fetchNext().catch() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt);c&&(c.close(),c=null),e.name!==xt?(si.debugLog("worker",`fetchNext().catch() and e is ${e.toString()}`),Ur(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()})):si.debugLog("worker","fetchNext().catch() and e.name is AbortError so return")}))};i()}})).catch((e=>{a&&a.signal&&a.signal.aborted?si.debugLog("worker","fetch().catch() and abortController.signal.aborted is true so return"):e.name!==xt?(si.debugLog("worker",`fetch().catch() and e is ${e.toString()}`),Ur(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()}),c&&(c.close(),c=null)):si.debugLog("worker","fetch().catch() and e.name is AbortError so return")}))}else t.protocol===m&&(t.isFlv&&(c=new xr(si.demuxFlv())),o=new WebSocket(e,r),o.binaryType="arraybuffer",o.onopen=()=>{si.debugLog("worker","fetchStream, WebsocketStream socket open"),postMessage({cmd:O,type:ke}),postMessage({cmd:O,type:Pe})},o.onclose=e=>{si.isDestroyed?si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} and isDestroyed is true, so return`):u?si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} but isSocketError is true , so return`):(si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code}`),1006===e.code&&si.debugError("worker",`fetchStream, WebsocketStream socket close abnormally and code is ${e.code}`),yr(Sr)?si.debugLog("worker","fetchStream, WebsocketStream socket close and requestAbort is true so return"):(c&&(c.close(),c=null),postMessage({cmd:O,type:Ae,value:y,msg:e.code})))},o.onerror=e=>{si.debugError("worker","fetchStream, WebsocketStream socket error",e,e.toString()),u=!0,c&&(c.close(),c=null),si.isDestroyed?si.debugLog("worker","fetchStream, WebsocketStream on error and isDestroyed is true, so return"):postMessage({cmd:O,type:Le.websocketError,value:e.isTrusted?"websocket user aborted":"websocket error"})},o.onmessage=e=>{"string"!=typeof e.data?(d(e.data.byteLength),t.isFlv?c.write(e.data):t.isFmp4?si.demuxFmp4(e.data):t.isMpeg4?si.demuxMpeg4(e.data):si._opt.isNakedFlow?si.demuxNakedFlow(e.data):si.demuxM7s(e.data)):si.debugWarn("worker",`socket on message is string "${e.data}" and return`)})},demuxFlv:function*(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),r=new Uint32Array(e);for(;;){t[3]=0;const e=yield 15,i=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const n=r[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let s=r[0];const a=(yield n).slice();switch(i){case de:if(a.byteLength>0){let e=a;yr(si._opt.m7sCryptoAudio)&&(e=si.cryptoPayloadAudio(a)),si.decode(e,{type:ae,ts:s})}else si.debugWarn("worker",`demuxFlv() type is audio and payload.byteLength is ${a.byteLength} and return`);break;case le:if(a.byteLength>=6){const e=a[0];if(si._isEnhancedH265Header(e))si._decodeEnhancedH265Video(a,s);else{const e=15&a[0];let t=a[0]>>4===kt;const i=e===Re;if(vr(t)&&yr(wr(a,i))&&(si.debugLog("worker","demux() isIFrame is false and unit type is IDR and update to true"),t=!0),t&&gr(a)&&null===si.isHevc){const e=15&a[0];si.isHevc=e===Re,er=ir(a,si.isHevc),si.debugLog("worker",`demuxFlv() isVideoSequenceHeader is true and isHevc is ${si.isHevc} and nalUnitSize is ${er}`)}t&&si.calcIframeIntervalTimestamp(s),si.isPlayer&&si.calcNetworkDelay(s),r[0]=a[4],r[1]=a[3],r[2]=a[2],r[3]=0;let n=r[0],o=si.cryptoPayload(a,t);si.decode(o,{type:oe,ts:s,isIFrame:t,cts:n})}}else si.debugWarn("worker",`demuxFlv() type is video and payload.byteLength is ${a.byteLength} and return`);break;case ce:postMessage({cmd:J,buffer:a},[a.buffer]);break;default:si.debugLog("worker",`demuxFlv() type is ${i}`)}}},decode:function(e,t){t.type===ae?si._opt.hasAudio&&(postMessage({cmd:O,type:xe,value:e.byteLength}),si.isPlayer?si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts}):si.isPlayback&&(si.isPlaybackOnlyDecodeIFrame()||(si.isPlaybackCacheBeforeDecodeForFpsRender(),si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts})))):t.type===oe&&si._opt.hasVideo&&(postMessage({cmd:O,type:Be,value:e.byteLength}),postMessage({cmd:O,type:Te,value:t.ts}),si.isPlayer?si.pushBuffer(e,{type:t.type,ts:t.ts,isIFrame:t.isIFrame,cts:t.cts}):si.isPlayback&&(si.isPlaybackOnlyDecodeIFrame()?t.isIFrame&&si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}):(si.isPlaybackCacheBeforeDecodeForFpsRender(),si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}))))},cryptoPayload:function(e,t){let r=e;return si._opt.isM7sCrypto?si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?r=$i(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc):si.debugError("worker",`isM7sCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`):si._opt.isSm4Crypto?si._opt.sm4CryptoKey?r=si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?rs(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc,si._opt.isSm4CryptoH265V2):dn(e,si._opt.sm4CryptoKey,si.isHevc,si._opt.isSm4CryptoH265V2):si._opt.sm4CryptoKey||si.debugError("worker","isSm4Crypto opt.sm4CryptoKey is null"):si._opt.isXorCrypto&&(si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?r=fn(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc):si.debugError("worker",`isXorCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`)),r},cryptoPayloadAudio:function(e){let t=e;return si._opt.isM7sCrypto&&(si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?e[0]>>4===Ne&&(t=Ni(e,si._opt.cryptoKey,si._opt.cryptoIV)):si.debugError("worker",`isM7sCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`)),t},setCodecAudio:function(e,t){const r=e[0]>>4,i=e[0]>>1&1;if(ar=r===Ne?i?16:8:0===i?8:16,ai&&ai.setCodec)if(Yt(e)||r===Oe||r===Ge||r===He){si.debugLog("worker",`setCodecAudio: init audio codec, codeId is ${r} _opt.sampleRate is ${si._opt.sampleRate}`);const i=r===Ne?e.slice(2):new Uint8Array(0);ai.setCodec(r,si._opt.sampleRate,i),r===Ne&&postMessage({cmd:F,buffer:i},[i.buffer]),E=!0,r!==Ne&&(r===He?(si.mp3Demuxer||(si.mp3Demuxer=new cn(si),si.mp3Demuxer.on("data",((e,t)=>{ai.decode(e,t)}))),si.mp3Demuxer.dispatch(e.slice(1),t)):ai.decode(e.slice(1),t));{const e=Number("1")||1;setTimeout((()=>{si.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),si.close(),postMessage({cmd:W})}),60*e*60*1e3)}}else si.debugWarn("worker","setCodecAudio: hasInitAudioCodec is false, codecId is ",r);else si.debugError("worker","setCodecAudio: audioDecoder or audioDecoder.setCodec is null")},decodeAudio:function(e,t){if(si.isDestroyed)si.debugLog("worker","decodeAudio, decoder is destroyed and return");else if(si.isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio())ni.decodeAudio(e,t);else if(yr(r)&&yr(si._opt.mseDecodeAudio))postMessage({cmd:N,payload:e,ts:t,cts:t},[e.buffer]);else{const r=e[0]>>4;if(E){if(Yt(e))return void si.debugLog("worker","decodeAudio and has already initialized and payload is aac codec packet so drop this frame");r===He?si.mp3Demuxer.dispatch(e.slice(1),t):ai.decode(r===Ne?e.slice(2):e.slice(1),t)}else si.setCodecAudio(e,t)}},setCodecVideo:function(e,t){const r=15&e[0];if(oi&&oi.setCodec)if(gr(e))if(r===Fe||r===Re){si.debugLog("worker",`setCodecVideo: init video codec , codecId is ${r}`);const t=e.slice(5);if(r===Fe&&si._opt.useSIMD){const e=Cr(t);if(e.codecWidth>U||e.codecHeight>U)return postMessage({cmd:Y,value:`width: ${e.codecWidth} > 4080, height: ${e.codecHeight} > 4080`}),void si.debugWarn("worker",`setCodecVideo: SIMD H264 decode video width is too large, width is ${e.codecWidth}, height is ${e.codecHeight}`)}const i=new Uint8Array(e);S=!0,oi.setCodec(r,t),postMessage({cmd:R,code:r}),postMessage({cmd:M,buffer:i,codecId:r},[i.buffer])}else si.debugWarn("worker",`setCodecVideo: hasInitVideoCodec is false, codecId is ${r} is not H264 or H265`);else si.debugWarn("worker",`decodeVideo: hasInitVideoCodec is false, codecId is ${r} and isIFrame is ${t} and packetType is ${e[1]}`);else si.debugError("worker","setCodecVideo: videoDecoder or videoDecoder.setCodec is null")},decodeVideo:function(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(si.isDestroyed)si.debugLog("worker","decodeVideo, decoder is destroyed and return");else if(si.isPlayUseMSEAndDecoderInWorker())ni.decodeVideo(e,t,i,n);else if(yr(r))postMessage({cmd:$,payload:e,isIFrame:i,ts:t,cts:n,delay:si.delay},[e.buffer]);else if(S)if(!B&&i&&(B=!0),B){if(i&&gr(e)){const t=15&e[0];let r={};t===Fe?r=Cr(e.slice(5)):t===Re&&(r=Vr(e)),r.codecWidth&&r.codecHeight&&h&&f&&(r.codecWidth!==h||r.codecHeight!==f)&&(si.debugWarn("worker",`\n decodeVideo: video width or height is changed,\n old width is ${h}, old height is ${f},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),Vt=!0,postMessage({cmd:j,value:`width: ${h}->${r.codecWidth}, height: ${f}->${r.codecHeight}`}))}if(Vt)return void si.debugWarn("worker","decodeVideo: video width or height is changed, and return");if(Xt)return void si.debugWarn("worker","decodeVideo: simd decode error, and return");if(gr(e))return void si.debugLog("worker","decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength0&&void 0!==arguments[0]&&arguments[0];si.debugLog("worker",`clearBuffer,bufferList length is ${i.length}, need clear is ${e}`),e&&(i=[]),si.isPlayer&&(si.resetAllDelay(),yr(si._opt.checkFirstIFrame)&&(si.dropping=!0,postMessage({cmd:H}))),yr(si._opt.checkFirstIFrame)&&vr(r)&&(B=!1)},dropBuffer$2:function(){if(i.length>0){let e=i.findIndex((e=>yr(e.isIFrame)&&e.type===oe));if(si.isAllIframeInBufferList())for(let t=0;t=si.getNotDroppingDelayTs()){si.debugLog("worker",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${n} and notDroppingDelayTs is ${si.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){si.isPushDropping=!0,postMessage({cmd:H});const t=i.length;i=i.slice(e);const r=i.shift();si.resetAllDelay(),si.getDelay(r.ts,r.type),si.doDecode(r),si.isPushDropping=!1,si.debugLog("worker",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,new bufferList is ${i.length} and new delay is ${si.delay} `)}else si.isPushDropping=!1}0===i.length&&(si.isPushDropping=!1)},demuxM7s:function(e){const t=new DataView(e),r=t.getUint32(1,!1),i=t.getUint8(0),n=new ArrayBuffer(4),s=new Uint32Array(n);switch(i){case ae:si.decode(new Uint8Array(e,5),{type:ae,ts:r});break;case oe:if(t.byteLength>=11){const i=new Uint8Array(e,5),n=i[0];if(si._isEnhancedH265Header(n))si._decodeEnhancedH265Video(i,r);else{const e=t.getUint8(5)>>4==1;if(e&&(si.calcIframeIntervalTimestamp(r),gr(i)&&null===si.isHevc)){const e=15&i[0];si.isHevc=e===Re}si.isPlayer&&si.calcNetworkDelay(r),s[0]=i[4],s[1]=i[3],s[2]=i[2],s[3]=0;let n=s[0],a=si.cryptoPayload(i,e);si.decode(a,{type:oe,ts:r,isIFrame:e,cts:n})}}else si.debugWarn("worker",`demuxM7s() type is video and arrayBuffer length is ${e.byteLength} and return`)}},demuxNakedFlow:function(e){kr.dispatch(e)},demuxFmp4:function(e){Gr.dispatch(e)},demuxMpeg4:function(e){Hr.dispatch(e)},demuxTs:function(e){qr.dispatch(e)},_decodeEnhancedH265Video:function(e,t){const r=e[0],i=48&r,n=15&r,s=e.slice(1,5),a=new ArrayBuffer(4),o=new Uint32Array(a),d="a"==String.fromCharCode(s[0]);if(si.isHevc=vr(d),n===Rt){if(i===$t){const r=e.slice(5);if(d);else{const i=new Uint8Array(5+r.length);i.set([28,0,0,0,0],0),i.set(r,5),er=ir(e,si.isHevc),si.debugLog("worker",`demuxFlv() isVideoSequenceHeader(enhancedH265) is true and isHevc is ${si.isHevc} and nalUnitSize is ${er}`),si.decode(i,{type:oe,ts:t,isIFrame:!0,cts:0})}}}else if(n===Mt){let r=e,n=0;const s=i===$t;s&&si.calcIframeIntervalTimestamp(t),d||(o[0]=e[4],o[1]=e[3],o[2]=e[2],o[3]=0,n=o[0],r=Xr(e.slice(8),s),r=si.cryptoPayload(r,s),si.decode(r,{type:oe,ts:t,isIFrame:s,cts:n}))}else if(n===zt){const r=i===$t;r&&si.calcIframeIntervalTimestamp(t);let n=Xr(e.slice(5),r);n=si.cryptoPayload(n,r),si.decode(n,{type:oe,ts:t,isIFrame:r,cts:0})}},_isEnhancedH265Header:function(e){return(e&Ft)===Ft},findSei:function(e,t){let r=4;lr(er)&&(r=er),tr(e.slice(5),r).forEach((e=>{const r=si.isHevc?e[0]>>>1&63:31&e[0],i=si.isHevc&&(r===ft||r===ht),n=vr(si.isHevc)&&r===Ke;(i||n)&&postMessage({cmd:Z,buffer:e,ts:t},[e.buffer])}))},calcNetworkDelay:function(e){if(!(B&&e>0))return;null===Qe?(Qe=e,tt=nr()):et?r-t:0;si.networkDelay=i,i>si._opt.networkDelay&&si._opt.playType===v&&(si.debugWarn("worker",`calcNetworkDelay now dts:${e}, start dts is ${Qe} vs start is ${t},local diff is ${r} ,delay is ${i}`),postMessage({cmd:O,type:De,value:i}))},calcIframeIntervalTimestamp:function(e){null===Nt?Nt=e:Nt=si._opt.playbackForwardMaxRateDecodeIFrame&&!(si._opt.useMSE&&si._opt.mseDecodeAudio)},isPlayUseMSE:function(){return si.isPlayer&&si._opt.useMSE&&yr(r)},isPlayUseMSEAndDecoderInWorker:function(){return si.isPlayUseMSE()&&si._opt.mseDecoderUseWorker},isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio:function(){return si.isPlayUseMSEAndDecoderInWorker()&&si._opt.mseDecodeAudio},playbackUpdatePlaybackRate:function(){vr(si.isPlaybackCacheBeforeDecodeForFpsRender())&&si.clearBuffer(!0)},onOffscreenCanvasWebglContextLost:function(e){si.debugError("worker","handleOffscreenCanvasWebglContextLost and next try to create webgl"),e.preventDefault(),Wt=!0,si.webglObj.destroy(),si.webglObj=null,si.offscreenCanvasGL=null,setTimeout((()=>{si.offscreenCanvasGL=si.offscreenCanvas.getContext("webgl"),si.offscreenCanvasGL&&si.offscreenCanvasGL.getContextAttributes().stencil?(si.webglObj=p(si.offscreenCanvasGL,si._opt.openWebglAlignment),Wt=!1):si.debugError("worker","handleOffscreenCanvasWebglContextLost, stencil is false")}),500)},onOffscreenCanvasWebglContextRestored:function(e){si.debugLog("worker","handleOffscreenCanvasWebglContextRestored"),e.preventDefault()},videoInfo:function(e,t,r){postMessage({cmd:R,code:e}),postMessage({cmd:k,w:t,h:r}),h=t,f=r,si.useOffscreen()&&(si.offscreenCanvas=new OffscreenCanvas(t,r),si.offscreenCanvasGL=si.offscreenCanvas.getContext("webgl"),si.webglObj=p(si.offscreenCanvasGL,si._opt.openWebglAlignment),si.offscreenCanvas.addEventListener("webglcontextlost",si.onOffscreenCanvasWebglContextLost,!1),si.offscreenCanvas.addEventListener("webglcontextrestored",si.onOffscreenCanvasWebglContextRestored,!1))},audioInfo:function(e,t,r){postMessage({cmd:L,code:e}),postMessage({cmd:P,sampleRate:t,channels:r,depth:ar}),Tt=r},yuvData:function(t,r){if(si.isDestroyed)return void si.debugLog("worker","yuvData, decoder is destroyed and return");const i=h*f*3/2;let n=e.HEAPU8.subarray(t,t+i),s=new Uint8Array(n);if(ut=null,Ee=r,si.useOffscreen())try{if(Wt)return;si.webglObj.renderYUV(h,f,s);let e=si.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:e,delay:si.delay,ts:r},[e])}catch(e){si.debugError("worker","yuvData, transferToImageBitmap error is",e,e.toString())}else postMessage({cmd:C,output:s,delay:si.delay,ts:r},[s.buffer])},pcmData:function(e,r,i){if(si.isDestroyed)return void si.debugLog("worker","pcmData, decoder is destroyed and return");let s=r,a=[],o=0,d=si._opt.audioBufferSize;for(let r=0;r<2;r++){let i=t.HEAPU32[(e>>2)+r]>>2;a[r]=t.HEAPF32.subarray(i,i+s)}if(Ut){if(!(s>=(r=d-Ut)))return Ut+=s,n[0]=Float32Array.of(...n[0],...a[0]),void(2==Tt&&(n[1]=Float32Array.of(...n[1],...a[1])));it[0]=Float32Array.of(...n[0],...a[0].subarray(0,r)),2==Tt&&(it[1]=Float32Array.of(...n[1],...a[1].subarray(0,r))),postMessage({cmd:D,buffer:it,ts:i},it.map((e=>e.buffer))),o=r,s-=r}for(Ut=s;Ut>=d;Ut-=d)it[0]=a[0].slice(o,o+=d),2==Tt&&(it[1]=a[1].slice(o-d,o)),postMessage({cmd:D,buffer:it,ts:i},it.map((e=>e.buffer)));Ut&&(n[0]=a[0].slice(o),2==Tt&&(n[1]=a[1].slice(o))),a=[]},errorInfo:function(e){null===ut&&(ut=nr());const t=nr(),r=sr(At>0?2*At:5e3,1e3,5e3),i=t-ut;i>r&&(si.debugWarn("worker",`errorInfo() emit simdDecodeError and\n iframeIntervalTimestamp is ${At} and diff is ${i} and maxDiff is ${r}\n and replay`),Xt=!0,postMessage({cmd:q}))},sendWebsocketMessage:function(e){o?o.readyState===Ie?o.send(e):si.debugError("worker","socket is not open"):si.debugError("worker","socket is null")},timeEnd:function(){si.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),si.close(),postMessage({cmd:W})},postStreamToMain(e,t){postMessage({cmd:X,type:t,buffer:e},[e.buffer])},updatePlaybackIsPause(e){si.debugLog("worker",`updatePlaybackIsPause, isPause is ${e}`),yr(e)?si.clearPlaybackCacheLoop():si.startPlaybackCacheLoop()},debugLog(e){if(si._opt.debug&&si.debug){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:{};var t,i,n;(n=e).ready=new Promise(((e,r)=>{t=e,i=r})),(n=void 0!==n?n:{}).locateFile=function(e){return"decoder-pro-simd.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_SIMD_WASM_URL&&""!=JESSIBUCA_PRO_SIMD_WASM_URL?JESSIBUCA_PRO_SIMD_WASM_URL:e};var s,a,o,d=Object.assign({},n),l="object"==typeof window,c="function"==typeof importScripts,u="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,h="";function f(e){return n.locateFile?n.locateFile(e,h):h+e}if(u){const{createRequire:e}=await import("module");var p=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href),m=p("fs"),_=p("path");h=c?_.dirname(h)+"/":p("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href)),s=(e,t)=>(e=Y(e)?new URL(e):_.normalize(e),m.readFileSync(e,t?void 0:"utf8")),o=e=>{var t=s(e,!0);return t.buffer||(t=new Uint8Array(t)),t},a=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=Y(e)?new URL(e):_.normalize(e),m.readFile(e,i?void 0:"utf8",((e,n)=>{e?r(e):t(i?n.buffer:n)}))},!n.thisProgram&&process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),n.inspect=()=>"[Emscripten Module object]"}else(l||c)&&(c?h=self.location.href:"undefined"!=typeof document&&document.currentScript&&(h=document.currentScript.src),r&&(h=r),h=0!==h.indexOf("blob:")?h.substr(0,h.replace(/[?#].*/,"").lastIndexOf("/")+1):"",s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},c&&(o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),a=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var g,y,v=n.print||console.log.bind(console),b=n.printErr||console.error.bind(console);Object.assign(n,d),d=null,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.quit&&n.quit,n.wasmBinary&&(g=n.wasmBinary),"object"!=typeof WebAssembly&&W("no native wasm support detected");var w,S,E,A,U,B,x,T,k=!1;function C(){var e=y.buffer;n.HEAP8=w=new Int8Array(e),n.HEAP16=E=new Int16Array(e),n.HEAPU8=S=new Uint8Array(e),n.HEAPU16=A=new Uint16Array(e),n.HEAP32=U=new Int32Array(e),n.HEAPU32=B=new Uint32Array(e),n.HEAPF32=x=new Float32Array(e),n.HEAPF64=T=new Float64Array(e)}var D=[],P=[],L=[];function F(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)M(n.preRun.shift());ee(D)}function I(){ee(P)}function R(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)N(n.postRun.shift());ee(L)}function M(e){D.unshift(e)}function z(e){P.unshift(e)}function N(e){L.unshift(e)}var $=0,O=null;function G(e){$++,n.monitorRunDependencies&&n.monitorRunDependencies($)}function H(e){if($--,n.monitorRunDependencies&&n.monitorRunDependencies($),0==$&&O){var t=O;O=null,t()}}function W(e){n.onAbort&&n.onAbort(e),b(e="Aborted("+e+")"),k=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}var V,j="data:application/octet-stream;base64,",q=e=>e.startsWith(j),Y=e=>e.startsWith("file://");function K(e){if(e==V&&g)return new Uint8Array(g);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}function X(e){if(!g&&(l||c)){if("function"==typeof fetch&&!Y(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>K(e)));if(a)return new Promise(((t,r)=>{a(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>K(e)))}function Z(e,t,r){return X(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{b(`failed to asynchronously prepare wasm: ${e}`),W(e)}))}function J(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||q(t)||Y(t)||u||"function"!=typeof fetch?Z(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return b(`wasm streaming compile failed: ${e}`),b("falling back to ArrayBuffer instantiation"),Z(t,r,i)}))))}function Q(){var e={a:Ar};function t(e,t){return Ur=e.exports,y=Ur.C,C(),rt=Ur.G,z(Ur.D),H(),Ur}if(G(),n.instantiateWasm)try{return n.instantiateWasm(e,t)}catch(e){b(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return J(g,V,e,(function(e){t(e.instance)})).catch(i),{}}n.locateFile?q(V="decoder-pro-simd.wasm")||(V=f(V)):V=new URL("decoder-pro-simd.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href).href;var ee=e=>{for(;e.length>0;)e.shift()(n)};function te(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){B[this.ptr+4>>2]=e},this.get_type=function(){return B[this.ptr+4>>2]},this.set_destructor=function(e){B[this.ptr+8>>2]=e},this.get_destructor=function(){return B[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,w[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=w[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,w[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=w[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){B[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return B[this.ptr+16>>2]},this.get_exception_ptr=function(){if(kr(this.get_type()))return B[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}n.noExitRuntime;var re,ie,ne,se=(e,t,r)=>{throw new te(e).init(t,r),e},ae=(e,t,r,i,n)=>{},oe=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);re=e},de=e=>{for(var t="",r=e;S[r];)t+=re[S[r++]];return t},le={},ce={},ue={},he=e=>{throw new ie(e)},fe=e=>{throw new ne(e)},pe=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&fe("Mismatched type converter count");for(var n=0;n{ce.hasOwnProperty(e)?n[t]=ce[e]:(s.push(e),le.hasOwnProperty(e)||(le[e]=[]),le[e].push((()=>{n[t]=ce[e],++a===s.length&&i(n)})))})),0===s.length&&i(n)};function me(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||he(`type "${i}" must have a positive integer typeid pointer`),ce.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;he(`Cannot register type '${i}' twice`)}if(ce[e]=t,delete ue[e],le.hasOwnProperty(e)){var n=le[e];delete le[e],n.forEach((e=>e()))}}function _e(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return me(e,t,r)}var ge,ye=8,ve=(e,t,r,i)=>{_e(e,{name:t=de(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:ye,readValueFromPointer:function(e){return this.fromWireType(S[e])},destructorFunction:null})},be=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),we=e=>{he(e.$$.ptrType.registeredClass.name+" instance already deleted")},Se=!1,Ee=e=>{},Ae=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},Ue=e=>{e.count.value-=1,0===e.count.value&&Ae(e)},Be=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=Be(e,t,r.baseClass);return null===i?null:r.downcast(i)},xe={},Te=()=>Object.keys(Fe).length,ke=()=>{var e=[];for(var t in Fe)Fe.hasOwnProperty(t)&&e.push(Fe[t]);return e},Ce=[],De=()=>{for(;Ce.length;){var e=Ce.pop();e.$$.deleteScheduled=!1,e.delete()}},Pe=e=>{ge=e,Ce.length&&ge&&ge(De)},Le=()=>{n.getInheritedInstanceCount=Te,n.getLiveInheritedInstances=ke,n.flushPendingDeletes=De,n.setDelayFunction=Pe},Fe={},Ie=(e,t)=>{for(void 0===t&&he("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},Re=(e,t)=>(t=Ie(e,t),Fe[t]),Me=(e,t)=>(t.ptrType&&t.ptr||fe("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&fe("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Ne(Object.create(e,{$$:{value:t}})));function ze(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=Re(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?Me(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Me(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,a=this.registeredClass.getActualType(t),o=xe[a];if(!o)return n.call(this);s=this.isConst?o.constPointerType:o.pointerType;var d=Be(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?Me(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):Me(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}var Ne=e=>"undefined"==typeof FinalizationRegistry?(Ne=e=>e,e):(Se=new FinalizationRegistry((e=>{Ue(e.$$)})),Ne=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};Se.register(e,r,e)}return e},Ee=e=>Se.unregister(e),Ne(e)),$e=()=>{Object.assign(Oe.prototype,{isAliasOf(e){if(!(this instanceof Oe))return!1;if(!(e instanceof Oe))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n},clone(){if(this.$$.ptr||we(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Ne(Object.create(Object.getPrototypeOf(this),{$$:{value:be(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||we(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&he("Object already scheduled for deletion"),Ee(this),Ue(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||we(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&he("Object already scheduled for deletion"),Ce.push(this),1===Ce.length&&ge&&ge(De),this.$$.deleteScheduled=!0,this}})};function Oe(){}var Ge=(e,t)=>Object.defineProperty(t,"name",{value:e}),He=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||he(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},We=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&he(`Cannot register public name '${e}' twice`),He(n,e,e),n.hasOwnProperty(r)&&he(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,void 0!==r&&(n[e].numArguments=r))},Ve=48,je=57,qe=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=Ve&&t<=je?`_${e}`:e};function Ye(e,t,r,i,n,s,a,o){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=a,this.downcast=o,this.pureVirtualFunctions=[]}var Ke=(e,t,r)=>{for(;t!==r;)t.upcast||he(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function Xe(e,t){if(null===t)return this.isReference&&he(`null is not a valid ${this.name}`),0;t.$$||he(`Cannot pass "${Pt(t)}" as a ${this.name}`),t.$$.ptr||he(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ke(t.$$.ptr,r,this.registeredClass)}function Ze(e,t){var r;if(null===t)return this.isReference&&he(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||he(`Cannot pass "${Pt(t)}" as a ${this.name}`),t.$$.ptr||he(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&he(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=Ke(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&he("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:he(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,Tt.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:he("Unsupporting sharing policy")}return r}function Je(e,t){if(null===t)return this.isReference&&he(`null is not a valid ${this.name}`),0;t.$$||he(`Cannot pass "${Pt(t)}" as a ${this.name}`),t.$$.ptr||he(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&he(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ke(t.$$.ptr,r,this.registeredClass)}function Qe(e){return this.fromWireType(B[e>>2])}var et=()=>{Object.assign(tt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:ye,readValueFromPointer:Qe,deleteObject(e){null!==e&&e.delete()},fromWireType:ze})};function tt(e,t,r,i,n,s,a,o,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=a,this.rawGetPointee=o,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=Ze:i?(this.toWireType=Xe,this.destructorFunction=null):(this.toWireType=Je,this.destructorFunction=null)}var rt,it,nt=(e,t,r)=>{n.hasOwnProperty(e)||fe("Replacing nonexistant public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},st=(e,t,r)=>{var i=n["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},at=[],ot=e=>{var t=at[e];return t||(e>=at.length&&(at.length=e+1),at[e]=t=rt.get(e)),t},dt=(e,t,r)=>e.includes("j")?st(e,t,r):ot(t).apply(null,r),lt=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),dt(e,t,r)}},ct=(e,t)=>{var r=(e=de(e)).includes("j")?lt(e,t):ot(t);return"function"!=typeof r&&he(`unknown function pointer with signature ${e}: ${t}`),r},ut=(e,t)=>{var r=Ge(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},ht=e=>{var t=Tr(e),r=de(t);return Br(t),r},ft=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||ce[t]||(ue[t]?ue[t].forEach(e):(r.push(t),i[t]=!0))})),new it(`${e}: `+r.map(ht).join([", "]))},pt=(e,t,r,i,n,s,a,o,d,l,c,u,h)=>{c=de(c),s=ct(n,s),o&&(o=ct(a,o)),l&&(l=ct(d,l)),h=ct(u,h);var f=qe(c);We(f,(function(){ft(`Cannot construct ${c} due to unbound types`,[i])})),pe([e,t,r],i?[i]:[],(function(t){var r,n;t=t[0],n=i?(r=t.registeredClass).instancePrototype:Oe.prototype;var a=Ge(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new ie("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new ie(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new ie(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(n,{constructor:{value:a}});a.prototype=d;var u=new Ye(c,a,d,h,r,s,o,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new tt(c,u,!0,!1,!1),m=new tt(c+"*",u,!1,!1,!1),_=new tt(c+" const*",u,!1,!0,!1);return xe[e]={pointerType:m,constPointerType:_},nt(f,a),[p,m,_]}))},mt=(e,t)=>{for(var r=[],i=0;i>2]);return r},_t=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function gt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=Ge(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function yt(e,t,r,i,n,s){var a=t.length;a<2&&he("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||s?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=o?1:2;l{var a=mt(t,r);n=ct(i,n),pe([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new ie(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{ft(`Cannot construct ${e.name} due to unbound types`,a)},pe([],a,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=yt(r,i,null,n,s),[]))),[]}))},bt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},wt=(e,t,r,i,n,s,a,o,d)=>{var l=mt(r,i);t=de(t),t=bt(t),s=ct(n,s),pe([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function n(){ft(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,c[t]=n):(He(c,t,i),c[t].overloadTable[r-2]=n),pe([],l,(function(n){var o=yt(i,n,e,s,a,d);return void 0===c[t].overloadTable?(o.argCount=r-2,c[t]=o):c[t].overloadTable[r-2]=o,[]})),[]}))};function St(){Object.assign(Et.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function Et(){this.allocated=[void 0],this.freelist=[]}var At=new Et,Ut=e=>{e>=At.reserved&&0==--At.get(e).refcount&&At.free(e)},Bt=()=>{for(var e=0,t=At.reserved;t{At.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),At.reserved=At.allocated.length,n.count_emval_handles=Bt},Tt={toValue:e=>(e||he("Cannot use deleted val. handle = "+e),At.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return At.allocate({refcount:1,value:e})}}};function kt(e){return this.fromWireType(U[e>>2])}var Ct,Dt=(e,t)=>{_e(e,{name:t=de(t),fromWireType:e=>{var t=Tt.toValue(e);return Ut(e),t},toWireType:(e,t)=>Tt.toHandle(t),argPackAdvance:ye,readValueFromPointer:kt,destructorFunction:null})},Pt=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},Lt=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(x[e>>2])};case 8:return function(e){return this.fromWireType(T[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Ft=(e,t,r)=>{_e(e,{name:t=de(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:ye,readValueFromPointer:Lt(t,r),destructorFunction:null})},It=(e,t,r)=>{switch(t){case 1:return r?e=>w[e>>0]:e=>S[e>>0];case 2:return r?e=>E[e>>1]:e=>A[e>>1];case 4:return r?e=>U[e>>2]:e=>B[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Rt=(e,t,r,i,n)=>{t=de(t);var s=e=>e;if(0===i){var a=32-8*r;s=e=>e<>>a}var o=t.includes("unsigned");_e(e,{name:t,fromWireType:s,toWireType:o?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:ye,readValueFromPointer:It(t,r,0!==i),destructorFunction:null})},Mt=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=B[e>>2],r=B[e+4>>2];return new i(w.buffer,r,t)}_e(e,{name:r=de(r),fromWireType:n,argPackAdvance:ye,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},zt=(e,t,r,i)=>{if(!(i>0))return 0;for(var n=r,s=r+i-1,a=0;a=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a)),o<=127){if(r>=s)break;t[r++]=o}else if(o<=2047){if(r+1>=s)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=s)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=s)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o}}return t[r]=0,r-n},Nt=(e,t,r)=>zt(e,S,t,r),$t=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},Ot="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,Gt=(e,t,r)=>{for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&Ot)return Ot.decode(e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&a)<<6|o)}else s+=String.fromCharCode(a)}return s},Ht=(e,t)=>e?Gt(S,e,t):"",Wt=(e,t)=>{var r="std::string"===(t=de(t));_e(e,{name:t,fromWireType(e){var t,i=B[e>>2],n=e+4;if(r)for(var s=n,a=0;a<=i;++a){var o=n+a;if(a==i||0==S[o]){var d=Ht(s,o-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=o+1}}else{var l=new Array(i);for(a=0;a>2]=i,r&&n)Nt(t,a,i+1);else if(n)for(var o=0;o255&&(Br(a),he("String has UTF-16 code units that do not fit in 8 bits")),S[a+o]=d}else for(o=0;o{for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&A[i];)++i;if((r=i<<1)-e>32&&Vt)return Vt.decode(S.subarray(e,r));for(var s="",a=0;!(a>=t/2);++a){var o=E[e+2*a>>1];if(0==o)break;s+=String.fromCharCode(o)}return s},qt=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=a,t+=2}return E[t>>1]=0,t-i},Yt=e=>2*e.length,Kt=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var n=U[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i},Xt=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++s)),U[t>>2]=a,(t+=4)+4>n)break}return U[t>>2]=0,t-i},Zt=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},Jt=(e,t,r)=>{var i,n,s,a,o;r=de(r),2===t?(i=jt,n=qt,a=Yt,s=()=>A,o=1):4===t&&(i=Kt,n=Xt,a=Zt,s=()=>B,o=2),_e(e,{name:r,fromWireType:e=>{for(var r,n=B[e>>2],a=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==a[c>>o]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return Br(e),r},toWireType:(e,i)=>{"string"!=typeof i&&he(`Cannot pass non-string to C++ string type ${r}`);var s=a(i),d=xr(4+s+t);return B[d>>2]=s>>o,n(i,d+4,s+t),null!==e&&e.push(Br,d),d},argPackAdvance:ye,readValueFromPointer:kt,destructorFunction(e){Br(e)}})},Qt=(e,t)=>{_e(e,{isVoid:!0,name:t=de(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},er={},tr=e=>{var t=er[e];return void 0===t?de(e):t},rr=[],ir=(e,t,r,i,n)=>(e=rr[e])(t=Tt.toValue(t),t[r=tr(r)],i,n),nr=e=>{var t=rr.length;return rr.push(e),t},sr=(e,t)=>{var r=ce[e];return void 0===r&&he(t+" has unknown type "+ht(e)),r},ar=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},or=(e,t,r)=>{var i=[],n=e.toWireType(i,r);return i.length&&(B[t>>2]=Tt.toHandle(i)),n},dr=(e,t,r)=>{var i=ar(e,t),n=i.shift();e--;var s="return function (obj, func, destructorsRef, args) {\n",a=0,o=[];0===r&&o.push("obj");for(var d=["retType"],l=[n],c=0;ce.name)).join(", ")}) => ${n.name}>`;return nr(Ge(h,u))},lr=e=>{e>4&&(At.get(e).refcount+=1)},cr=e=>Tt.toHandle(tr(e)),ur=()=>Tt.toHandle({}),hr=e=>Tt.toHandle(Ht(e)),fr=e=>{var t=Tt.toValue(e);_t(t),Ut(e)},pr=(e,t,r)=>{e=Tt.toValue(e),t=Tt.toValue(t),r=Tt.toValue(r),e[t]=r},mr=(e,t)=>{var r=(e=sr(e,"_emval_take_value")).readValueFromPointer(t);return Tt.toHandle(r)},_r=()=>{W("")};Ct=()=>performance.now();var gr=(e,t,r)=>S.copyWithin(e,t,t+r),yr=e=>{W("OOM")},vr=e=>{S.length,yr()},br=[null,[],[]],wr=(e,t)=>{var r=br[e];0===t||10===t?((1===e?v:b)(Gt(r,0)),r.length=0):r.push(t)},Sr=(e,t,r,i)=>{for(var n=0,s=0;s>2],o=B[t+4>>2];t+=8;for(var d=0;d>2]=n,0};oe(),ie=n.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},ne=n.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},$e(),Le(),et(),it=n.UnboundTypeError=ut(Error,"UnboundTypeError"),St(),xt();var Er,Ar={o:se,r:ae,x:ve,q:pt,p:vt,h:wt,w:Dt,k:Ft,b:Rt,a:Mt,l:Wt,i:Jt,y:Qt,g:ir,c:Ut,f:dr,z:lr,m:cr,B:ur,v:hr,e:fr,n:pr,A:mr,j:_r,d:Ct,u:gr,s:vr,t:Sr},Ur=Q(),Br=e=>(Br=Ur.E)(e),xr=e=>(xr=Ur.F)(e),Tr=e=>(Tr=Ur.H)(e),kr=e=>(kr=Ur.I)(e);function Cr(){function e(){Er||(Er=!0,n.calledRun=!0,k||(I(),t(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),R()))}$>0||(F(),$>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.dynCall_jiji=(e,t,r,i,s)=>(n.dynCall_jiji=Ur.J)(e,t,r,i,s),n.___start_em_js=143452,n.___stop_em_js=143509,O=function e(){Er||Cr(),Er||(O=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return Cr(),e.ready}),a=(()=>{var e="undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href;return async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var r,i,n;(n=t).ready=new Promise(((e,t)=>{r=e,i=t})),(n=void 0!==n?n:{}).locateFile=function(e){return"decoder-pro-audio.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_AUDIO_WASM_URL&&""!=JESSIBUCA_PRO_AUDIO_WASM_URL?JESSIBUCA_PRO_AUDIO_WASM_URL:e};var s,a,o,d=Object.assign({},n),l="./this.program",c="object"==typeof window,u="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";function p(e){return n.locateFile?n.locateFile(e,f):f+e}if(h){const{createRequire:e}=await import("module");var m=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href),_=m("fs"),g=m("path");f=u?g.dirname(f)+"/":m("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href)),s=(e,t)=>(e=J(e)?new URL(e):g.normalize(e),_.readFileSync(e,t?void 0:"utf8")),o=e=>{var t=s(e,!0);return t.buffer||(t=new Uint8Array(t)),t},a=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=J(e)?new URL(e):g.normalize(e),_.readFile(e,i?void 0:"utf8",((e,n)=>{e?r(e):t(i?n.buffer:n)}))},!n.thisProgram&&process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),n.inspect=()=>"[Emscripten Module object]"}else(c||u)&&(u?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),e&&(f=e),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},u&&(o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),a=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var y,v,b=n.print||console.log.bind(console),w=n.printErr||console.error.bind(console);Object.assign(n,d),d=null,n.arguments&&n.arguments,n.thisProgram&&(l=n.thisProgram),n.quit&&n.quit,n.wasmBinary&&(y=n.wasmBinary),"object"!=typeof WebAssembly&&j("no native wasm support detected");var S,E,A,U,B,x,T,k,C=!1;function D(e,t){e||j(t)}function P(){var e=v.buffer;n.HEAP8=S=new Int8Array(e),n.HEAP16=A=new Int16Array(e),n.HEAPU8=E=new Uint8Array(e),n.HEAPU16=U=new Uint16Array(e),n.HEAP32=B=new Int32Array(e),n.HEAPU32=x=new Uint32Array(e),n.HEAPF32=T=new Float32Array(e),n.HEAPF64=k=new Float64Array(e)}var L=[],F=[],I=[];function R(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)N(n.preRun.shift());ne(L)}function M(){n.noFSInit||ke.init.initialized||ke.init(),ke.ignorePermissions=!1,ne(F)}function z(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)O(n.postRun.shift());ne(I)}function N(e){L.unshift(e)}function $(e){F.unshift(e)}function O(e){I.unshift(e)}var G=0,H=null;function W(e){G++,n.monitorRunDependencies&&n.monitorRunDependencies(G)}function V(e){if(G--,n.monitorRunDependencies&&n.monitorRunDependencies(G),0==G&&H){var t=H;H=null,t()}}function j(e){n.onAbort&&n.onAbort(e),w(e="Aborted("+e+")"),C=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}var q,Y,K,X="data:application/octet-stream;base64,",Z=e=>e.startsWith(X),J=e=>e.startsWith("file://");function Q(e){if(e==q&&y)return new Uint8Array(y);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}function ee(e){if(!y&&(c||u)){if("function"==typeof fetch&&!J(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>Q(e)));if(a)return new Promise(((t,r)=>{a(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>Q(e)))}function te(e,t,r){return ee(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{w(`failed to asynchronously prepare wasm: ${e}`),j(e)}))}function re(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||Z(t)||J(t)||h||"function"!=typeof fetch?te(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return w(`wasm streaming compile failed: ${e}`),w("falling back to ArrayBuffer instantiation"),te(t,r,i)}))))}function ie(){var e={a:ni};function t(e,t){return si=e.exports,v=si.E,P(),Lt=si.H,$(si.F),V(),si}if(W(),n.instantiateWasm)try{return n.instantiateWasm(e,t)}catch(e){w(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return re(y,q,e,(function(e){t(e.instance)})).catch(i),{}}n.locateFile?Z(q="decoder-pro-audio.wasm")||(q=p(q)):q=new URL("decoder-pro-audio.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href).href;var ne=e=>{for(;e.length>0;)e.shift()(n)};function se(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){x[this.ptr+4>>2]=e},this.get_type=function(){return x[this.ptr+4>>2]},this.set_destructor=function(e){x[this.ptr+8>>2]=e},this.get_destructor=function(){return x[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,S[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=S[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,S[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=S[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){x[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return x[this.ptr+16>>2]},this.get_exception_ptr=function(){if(ci(this.get_type()))return x[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}n.noExitRuntime;var ae=(e,t,r)=>{throw new se(e).init(t,r),e},oe=e=>(B[oi()>>2]=e,e),de={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=de.isAbs(e),r="/"===e.substr(-1);return(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=de.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=de.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return de.normalize(e.join("/"))},join2:(e,t)=>de.normalize(e+"/"+t)},le=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}j("initRandomDevice")},ce=e=>(ce=le())(e),ue={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:ke.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=de.isAbs(i)}return(t?"/":"")+(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=ue.resolve(e).substr(1),t=ue.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),s=Math.min(i.length,n.length),a=s,o=0;o{for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&he)return he.decode(e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&a)<<6|o)}else s+=String.fromCharCode(a)}return s},pe=[],me=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},_e=(e,t,r,i)=>{if(!(i>0))return 0;for(var n=r,s=r+i-1,a=0;a=55296&&o<=57343)o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a);if(o<=127){if(r>=s)break;t[r++]=o}else if(o<=2047){if(r+1>=s)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=s)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=s)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o}}return t[r]=0,r-n};function ge(e,t,r){var i=r>0?r:me(e)+1,n=new Array(i),s=_e(e,n,0,n.length);return t&&(n.length=s),n}var ye=()=>{if(!pe.length){var e=null;if(h){var t=Buffer.alloc(256),r=0,i=process.stdin.fd;try{r=_.readSync(i,t)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}e=r>0?t.slice(0,r).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;pe=ge(e,!0)}return pe.shift()},ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},ke.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new ke.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new ke.ErrnoError(60);for(var s=0,a=0;aye(),put_char(e,t){null===t||10===t?(b(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(b(fe(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(w(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(w(fe(e.output,0)),e.output=[])}}},be=e=>{j()},we={ops_table:null,mount:e=>we.createNode(null,"/",16895,0),createNode(e,t,r,i){if(ke.isBlkdev(r)||ke.isFIFO(r))throw new ke.ErrnoError(63);we.ops_table||(we.ops_table={dir:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,lookup:we.node_ops.lookup,mknod:we.node_ops.mknod,rename:we.node_ops.rename,unlink:we.node_ops.unlink,rmdir:we.node_ops.rmdir,readdir:we.node_ops.readdir,symlink:we.node_ops.symlink},stream:{llseek:we.stream_ops.llseek}},file:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:{llseek:we.stream_ops.llseek,read:we.stream_ops.read,write:we.stream_ops.write,allocate:we.stream_ops.allocate,mmap:we.stream_ops.mmap,msync:we.stream_ops.msync}},link:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,readlink:we.node_ops.readlink},stream:{}},chrdev:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:ke.chrdev_stream_ops}});var n=ke.createNode(e,t,r,i);return ke.isDir(n.mode)?(n.node_ops=we.ops_table.dir.node,n.stream_ops=we.ops_table.dir.stream,n.contents={}):ke.isFile(n.mode)?(n.node_ops=we.ops_table.file.node,n.stream_ops=we.ops_table.file.stream,n.usedBytes=0,n.contents=null):ke.isLink(n.mode)?(n.node_ops=we.ops_table.link.node,n.stream_ops=we.ops_table.link.stream):ke.isChrdev(n.mode)&&(n.node_ops=we.ops_table.chrdev.node,n.stream_ops=we.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n,e.timestamp=n.timestamp),n},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=ke.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,ke.isDir(e.mode)?t.size=4096:ke.isFile(e.mode)?t.size=e.usedBytes:ke.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&we.resizeFileStorage(e,t.size)},lookup(e,t){throw ke.genericErrors[44]},mknod:(e,t,r,i)=>we.createNode(e,t,r,i),rename(e,t,r){if(ke.isDir(e.mode)){var i;try{i=ke.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new ke.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=ke.lookupNode(e,t);for(var i in r.contents)throw new ke.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink(e,t,r){var i=we.createNode(e,t,41471,0);return i.link=r,i},readlink(e){if(!ke.isLink(e.mode))throw new ke.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,i,n){var s=e.node.contents;if(n>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-n,i);if(a>8&&s.subarray)t.set(s.subarray(n,n+a),r);else for(var o=0;o0||r+t(we.stream_ops.write(e,t,0,i,r,!1),0)}},Se=(e,t,r,i)=>{var n=i?"":`al ${e}`;a(e,(r=>{D(r,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(r)),n&&V()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),n&&W()},Ee=(e,t,r,i,n,s)=>{ke.createDataFile(e,t,r,i,n,s)},Ae=n.preloadPlugins||[],Ue=(e,t,r,i)=>{"undefined"!=typeof Browser&&Browser.init();var n=!1;return Ae.forEach((s=>{n||s.canHandle(t)&&(s.handle(e,t,r,i),n=!0)})),n},Be=(e,t,r,i,n,s,a,o,d,l)=>{var c=t?ue.resolve(de.join2(e,t)):e;function u(r){function u(r){l&&l(),o||Ee(e,t,r,i,n,d),s&&s(),V()}Ue(r,c,u,(()=>{a&&a(),V()}))||u(r)}W(),"string"==typeof r?Se(r,(e=>u(e)),a):u(r)},xe=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t},Te=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},ke={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=ue.resolve(e)))return{path:"",node:null};if(t=Object.assign({follow_mount:!0,recurse_count:0},t),t.recurse_count>8)throw new ke.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),i=ke.root,n="/",s=0;s40)throw new ke.ErrnoError(32)}}return{path:n,node:i}},getPath(e){for(var t;;){if(ke.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,i=0;i>>0)%ke.nameTable.length},hashAddNode(e){var t=ke.hashName(e.parent.id,e.name);e.name_next=ke.nameTable[t],ke.nameTable[t]=e},hashRemoveNode(e){var t=ke.hashName(e.parent.id,e.name);if(ke.nameTable[t]===e)ke.nameTable[t]=e.name_next;else for(var r=ke.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=ke.mayLookup(e);if(r)throw new ke.ErrnoError(r,e);for(var i=ke.hashName(e.id,t),n=ke.nameTable[i];n;n=n.name_next){var s=n.name;if(n.parent.id===e.id&&s===t)return n}return ke.lookup(e,t)},createNode(e,t,r,i){var n=new ke.FSNode(e,t,r,i);return ke.hashAddNode(n),n},destroyNode(e){ke.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>ke.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){var t=ke.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{ke.lookupNode(e,t);return 20}catch(e){}return ke.nodePermissions(e,"wx")},mayDelete(e,t,r){var i;try{i=ke.lookupNode(e,t)}catch(e){return e.errno}var n=ke.nodePermissions(e,"wx");if(n)return n;if(r){if(!ke.isDir(i.mode))return 54;if(ke.isRoot(i)||ke.getPath(i)===ke.cwd())return 10}else if(ke.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?ke.isLink(e.mode)?32:ke.isDir(e.mode)&&("r"!==ke.flagsToPermissionString(t)||512&t)?31:ke.nodePermissions(e,ke.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=ke.MAX_OPEN_FDS;e++)if(!ke.streams[e])return e;throw new ke.ErrnoError(33)},getStreamChecked(e){var t=ke.getStream(e);if(!t)throw new ke.ErrnoError(8);return t},getStream:e=>ke.streams[e],createStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return ke.FSStream||(ke.FSStream=function(){this.shared={}},ke.FSStream.prototype={},Object.defineProperties(ke.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},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(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new ke.FSStream,e),-1==t&&(t=ke.nextfd()),e.fd=t,ke.streams[t]=e,e},closeStream(e){ke.streams[e]=null},chrdev_stream_ops:{open(e){var t=ke.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek(){throw new ke.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){ke.devices[e]={stream_ops:t}},getDevice:e=>ke.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),ke.syncFSRequests++,ke.syncFSRequests>1&&w(`warning: ${ke.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=ke.getMounts(ke.root.mount),i=0;function n(e){return ke.syncFSRequests--,t(e)}function s(e){if(e)return s.errored?void 0:(s.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return s(null);t.type.syncfs(t,e,s)}))},mount(e,t,r){var i,n="/"===r,s=!r;if(n&&ke.root)throw new ke.ErrnoError(10);if(!n&&!s){var a=ke.lookupPath(r,{follow_mount:!1});if(r=a.path,i=a.node,ke.isMountpoint(i))throw new ke.ErrnoError(10);if(!ke.isDir(i.mode))throw new ke.ErrnoError(54)}var o={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(o);return d.mount=o,o.root=d,n?ke.root=d:i&&(i.mounted=o,i.mount&&i.mount.mounts.push(o)),d},unmount(e){var t=ke.lookupPath(e,{follow_mount:!1});if(!ke.isMountpoint(t.node))throw new ke.ErrnoError(28);var r=t.node,i=r.mounted,n=ke.getMounts(i);Object.keys(ke.nameTable).forEach((e=>{for(var t=ke.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&ke.destroyNode(t),t=r}})),r.mounted=null;var s=r.mount.mounts.indexOf(i);r.mount.mounts.splice(s,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var i=ke.lookupPath(e,{parent:!0}).node,n=de.basename(e);if(!n||"."===n||".."===n)throw new ke.ErrnoError(28);var s=ke.mayCreate(i,n);if(s)throw new ke.ErrnoError(s);if(!i.node_ops.mknod)throw new ke.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,ke.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,ke.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),i="",n=0;n(void 0===r&&(r=t,t=438),t|=8192,ke.mknod(e,t,r)),symlink(e,t){if(!ue.resolve(e))throw new ke.ErrnoError(44);var r=ke.lookupPath(t,{parent:!0}).node;if(!r)throw new ke.ErrnoError(44);var i=de.basename(t),n=ke.mayCreate(r,i);if(n)throw new ke.ErrnoError(n);if(!r.node_ops.symlink)throw new ke.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename(e,t){var r,i,n=de.dirname(e),s=de.dirname(t),a=de.basename(e),o=de.basename(t);if(r=ke.lookupPath(e,{parent:!0}).node,i=ke.lookupPath(t,{parent:!0}).node,!r||!i)throw new ke.ErrnoError(44);if(r.mount!==i.mount)throw new ke.ErrnoError(75);var d,l=ke.lookupNode(r,a),c=ue.relative(e,s);if("."!==c.charAt(0))throw new ke.ErrnoError(28);if("."!==(c=ue.relative(t,n)).charAt(0))throw new ke.ErrnoError(55);try{d=ke.lookupNode(i,o)}catch(e){}if(l!==d){var u=ke.isDir(l.mode),h=ke.mayDelete(r,a,u);if(h)throw new ke.ErrnoError(h);if(h=d?ke.mayDelete(i,o,u):ke.mayCreate(i,o))throw new ke.ErrnoError(h);if(!r.node_ops.rename)throw new ke.ErrnoError(63);if(ke.isMountpoint(l)||d&&ke.isMountpoint(d))throw new ke.ErrnoError(10);if(i!==r&&(h=ke.nodePermissions(r,"w")))throw new ke.ErrnoError(h);ke.hashRemoveNode(l);try{r.node_ops.rename(l,i,o)}catch(e){throw e}finally{ke.hashAddNode(l)}}},rmdir(e){var t=ke.lookupPath(e,{parent:!0}).node,r=de.basename(e),i=ke.lookupNode(t,r),n=ke.mayDelete(t,r,!0);if(n)throw new ke.ErrnoError(n);if(!t.node_ops.rmdir)throw new ke.ErrnoError(63);if(ke.isMountpoint(i))throw new ke.ErrnoError(10);t.node_ops.rmdir(t,r),ke.destroyNode(i)},readdir(e){var t=ke.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new ke.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=ke.lookupPath(e,{parent:!0}).node;if(!t)throw new ke.ErrnoError(44);var r=de.basename(e),i=ke.lookupNode(t,r),n=ke.mayDelete(t,r,!1);if(n)throw new ke.ErrnoError(n);if(!t.node_ops.unlink)throw new ke.ErrnoError(63);if(ke.isMountpoint(i))throw new ke.ErrnoError(10);t.node_ops.unlink(t,r),ke.destroyNode(i)},readlink(e){var t=ke.lookupPath(e).node;if(!t)throw new ke.ErrnoError(44);if(!t.node_ops.readlink)throw new ke.ErrnoError(28);return ue.resolve(ke.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=ke.lookupPath(e,{follow:!t}).node;if(!r)throw new ke.ErrnoError(44);if(!r.node_ops.getattr)throw new ke.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>ke.stat(e,!0),chmod(e,t,r){var i;"string"==typeof e?i=ke.lookupPath(e,{follow:!r}).node:i=e;if(!i.node_ops.setattr)throw new ke.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod(e,t){ke.chmod(e,t,!0)},fchmod(e,t){var r=ke.getStreamChecked(e);ke.chmod(r.node,t)},chown(e,t,r,i){var n;"string"==typeof e?n=ke.lookupPath(e,{follow:!i}).node:n=e;if(!n.node_ops.setattr)throw new ke.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown(e,t,r){ke.chown(e,t,r,!0)},fchown(e,t,r){var i=ke.getStreamChecked(e);ke.chown(i.node,t,r)},truncate(e,t){if(t<0)throw new ke.ErrnoError(28);var r;"string"==typeof e?r=ke.lookupPath(e,{follow:!0}).node:r=e;if(!r.node_ops.setattr)throw new ke.ErrnoError(63);if(ke.isDir(r.mode))throw new ke.ErrnoError(31);if(!ke.isFile(r.mode))throw new ke.ErrnoError(28);var i=ke.nodePermissions(r,"w");if(i)throw new ke.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=ke.getStreamChecked(e);if(0==(2097155&r.flags))throw new ke.ErrnoError(28);ke.truncate(r.node,t)},utime(e,t,r){var i=ke.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new ke.ErrnoError(44);var i;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?xe(t):t)?4095&r|32768:0,"object"==typeof e)i=e;else{e=de.normalize(e);try{i=ke.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var s=!1;if(64&t)if(i){if(128&t)throw new ke.ErrnoError(20)}else i=ke.mknod(e,r,0),s=!0;if(!i)throw new ke.ErrnoError(44);if(ke.isChrdev(i.mode)&&(t&=-513),65536&t&&!ke.isDir(i.mode))throw new ke.ErrnoError(54);if(!s){var a=ke.mayOpen(i,t);if(a)throw new ke.ErrnoError(a)}512&t&&!s&&ke.truncate(i,0),t&=-131713;var o=ke.createStream({node:i,path:ke.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return o.stream_ops.open&&o.stream_ops.open(o),!n.logReadFiles||1&t||(ke.readFiles||(ke.readFiles={}),e in ke.readFiles||(ke.readFiles[e]=1)),o},close(e){if(ke.isClosed(e))throw new ke.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{ke.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(ke.isClosed(e))throw new ke.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new ke.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new ke.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,i,n){if(i<0||n<0)throw new ke.ErrnoError(28);if(ke.isClosed(e))throw new ke.ErrnoError(8);if(1==(2097155&e.flags))throw new ke.ErrnoError(8);if(ke.isDir(e.node.mode))throw new ke.ErrnoError(31);if(!e.stream_ops.read)throw new ke.ErrnoError(28);var s=void 0!==n;if(s){if(!e.seekable)throw new ke.ErrnoError(70)}else n=e.position;var a=e.stream_ops.read(e,t,r,i,n);return s||(e.position+=a),a},write(e,t,r,i,n,s){if(i<0||n<0)throw new ke.ErrnoError(28);if(ke.isClosed(e))throw new ke.ErrnoError(8);if(0==(2097155&e.flags))throw new ke.ErrnoError(8);if(ke.isDir(e.node.mode))throw new ke.ErrnoError(31);if(!e.stream_ops.write)throw new ke.ErrnoError(28);e.seekable&&1024&e.flags&&ke.llseek(e,0,2);var a=void 0!==n;if(a){if(!e.seekable)throw new ke.ErrnoError(70)}else n=e.position;var o=e.stream_ops.write(e,t,r,i,n,s);return a||(e.position+=o),o},allocate(e,t,r){if(ke.isClosed(e))throw new ke.ErrnoError(8);if(t<0||r<=0)throw new ke.ErrnoError(28);if(0==(2097155&e.flags))throw new ke.ErrnoError(8);if(!ke.isFile(e.node.mode)&&!ke.isDir(e.node.mode))throw new ke.ErrnoError(43);if(!e.stream_ops.allocate)throw new ke.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,i,n){if(0!=(2&i)&&0==(2&n)&&2!=(2097155&e.flags))throw new ke.ErrnoError(2);if(1==(2097155&e.flags))throw new ke.ErrnoError(2);if(!e.stream_ops.mmap)throw new ke.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n)},msync:(e,t,r,i,n)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new ke.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,i=ke.open(e,t.flags),n=ke.stat(e).size,s=new Uint8Array(n);return ke.read(i,s,0,n,0),"utf8"===t.encoding?r=fe(s,0):"binary"===t.encoding&&(r=s),ke.close(i),r},writeFile(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=ke.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(me(t)+1),s=_e(t,n,0,n.length);ke.write(i,n,0,s,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");ke.write(i,t,0,t.byteLength,void 0,r.canOwn)}ke.close(i)},cwd:()=>ke.currentPath,chdir(e){var t=ke.lookupPath(e,{follow:!0});if(null===t.node)throw new ke.ErrnoError(44);if(!ke.isDir(t.node.mode))throw new ke.ErrnoError(54);var r=ke.nodePermissions(t.node,"x");if(r)throw new ke.ErrnoError(r);ke.currentPath=t.path},createDefaultDirectories(){ke.mkdir("/tmp"),ke.mkdir("/home"),ke.mkdir("/home/web_user")},createDefaultDevices(){ke.mkdir("/dev"),ke.registerDevice(ke.makedev(1,3),{read:()=>0,write:(e,t,r,i,n)=>i}),ke.mkdev("/dev/null",ke.makedev(1,3)),ve.register(ke.makedev(5,0),ve.default_tty_ops),ve.register(ke.makedev(6,0),ve.default_tty1_ops),ke.mkdev("/dev/tty",ke.makedev(5,0)),ke.mkdev("/dev/tty1",ke.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=ce(e).byteLength),e[--t]);ke.createDevice("/dev","random",r),ke.createDevice("/dev","urandom",r),ke.mkdir("/dev/shm"),ke.mkdir("/dev/shm/tmp")},createSpecialDirectories(){ke.mkdir("/proc");var e=ke.mkdir("/proc/self");ke.mkdir("/proc/self/fd"),ke.mount({mount(){var t=ke.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,i=ke.getStreamChecked(r),n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return n.parent=n,n}},t}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?ke.createDevice("/dev","stdin",n.stdin):ke.symlink("/dev/tty","/dev/stdin"),n.stdout?ke.createDevice("/dev","stdout",null,n.stdout):ke.symlink("/dev/tty","/dev/stdout"),n.stderr?ke.createDevice("/dev","stderr",null,n.stderr):ke.symlink("/dev/tty1","/dev/stderr"),ke.open("/dev/stdin",0),ke.open("/dev/stdout",1),ke.open("/dev/stderr",1)},ensureErrnoError(){ke.ErrnoError||(ke.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},ke.ErrnoError.prototype=new Error,ke.ErrnoError.prototype.constructor=ke.ErrnoError,[44].forEach((e=>{ke.genericErrors[e]=new ke.ErrnoError(e),ke.genericErrors[e].stack=""})))},staticInit(){ke.ensureErrnoError(),ke.nameTable=new Array(4096),ke.mount(we,{},"/"),ke.createDefaultDirectories(),ke.createDefaultDevices(),ke.createSpecialDirectories(),ke.filesystems={MEMFS:we}},init(e,t,r){ke.init.initialized=!0,ke.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=t||n.stdout,n.stderr=r||n.stderr,ke.createStandardStreams()},quit(){ke.init.initialized=!1;for(var e=0;ethis.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},s.prototype.setDataGetter=function(e){this.getter=e},s.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,s=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,a=1048576;n||(a=i);var o=this;o.setDataGetter((e=>{var t=e*a,n=(e+1)*a-1;if(n=Math.min(n,i-1),void 0===o.chunks[e]&&(o.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==a&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):ge(n.responseText||"",!0)})(t,n)),void 0===o.chunks[e])throw new Error("doXHR failed!");return o.chunks[e]})),!s&&i||(a=i=1,i=this.getter(0).length,a=i,b("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!u)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new s;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var o={isDevice:!1,contents:a}}else o={isDevice:!1,url:r};var d=ke.createFile(e,t,o,i,n);o.contents?d.contents=o.contents:o.url&&(d.contents=null,d.url=o.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,t,r,i,n){var s=e.node.contents;if(n>=s.length)return 0;var a=Math.min(s.length-n,i);if(s.slice)for(var o=0;o{var t=d.stream_ops[e];l[e]=function(){return ke.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,n)=>(ke.forceLoadFile(d),c(e,t,r,i,n)),l.mmap=(e,t,r,i,n)=>{ke.forceLoadFile(d);var s=be();if(!s)throw new ke.ErrnoError(48);return c(e,S,s,t,r),{ptr:s,allocated:!0}},d.stream_ops=l,d}},Ce=(e,t)=>e?fe(E,e,t):"",De={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(de.isAbs(t))return t;var i;-100===e?i=ke.cwd():i=De.getStreamFromFD(e).path;if(0==t.length){if(!r)throw new ke.ErrnoError(44);return i}return de.join2(i,t)},doStat(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&de.normalize(t)!==de.normalize(ke.getPath(e.node)))return-54;throw e}B[r>>2]=i.dev,B[r+4>>2]=i.mode,x[r+8>>2]=i.nlink,B[r+12>>2]=i.uid,B[r+16>>2]=i.gid,B[r+20>>2]=i.rdev,K=[i.size>>>0,(Y=i.size,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],B[r+24>>2]=K[0],B[r+28>>2]=K[1],B[r+32>>2]=4096,B[r+36>>2]=i.blocks;var n=i.atime.getTime(),s=i.mtime.getTime(),a=i.ctime.getTime();return K=[Math.floor(n/1e3)>>>0,(Y=Math.floor(n/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],B[r+40>>2]=K[0],B[r+44>>2]=K[1],x[r+48>>2]=n%1e3*1e3,K=[Math.floor(s/1e3)>>>0,(Y=Math.floor(s/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],B[r+56>>2]=K[0],B[r+60>>2]=K[1],x[r+64>>2]=s%1e3*1e3,K=[Math.floor(a/1e3)>>>0,(Y=Math.floor(a/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],B[r+72>>2]=K[0],B[r+76>>2]=K[1],x[r+80>>2]=a%1e3*1e3,K=[i.ino>>>0,(Y=i.ino,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],B[r+88>>2]=K[0],B[r+92>>2]=K[1],0},doMsync(e,t,r,i,n){if(!ke.isFile(t.node.mode))throw new ke.ErrnoError(43);if(2&i)return 0;var s=E.slice(e,e+r);ke.msync(t,s,n,r,i)},varargs:void 0,get(){var e=B[+De.varargs>>2];return De.varargs+=4,e},getp:()=>De.get(),getStr:e=>Ce(e),getStreamFromFD:e=>ke.getStreamChecked(e)};function Pe(e,t,r){De.varargs=r;try{var i=De.getStreamFromFD(e);switch(t){case 0:if((n=De.get())<0)return-28;for(;ke.streams[n];)n++;return ke.createStream(i,n).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var n=De.get();return i.flags|=n,0;case 5:n=De.getp();return A[n+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return oe(28),-1}}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return-e.errno}}function Le(e,t,r,i){De.varargs=i;try{t=De.getStr(t),t=De.calculateAt(e,t);var n=i?De.get():0;return ke.open(t,r,n).fd}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return-e.errno}}var Fe,Ie,Re,Me=(e,t,r,i,n)=>{},ze=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Fe=e},Ne=e=>{for(var t="",r=e;E[r];)t+=Fe[E[r++]];return t},$e={},Oe={},Ge={},He=e=>{throw new Ie(e)},We=e=>{throw new Re(e)},Ve=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&We("Mismatched type converter count");for(var n=0;n{Oe.hasOwnProperty(e)?n[t]=Oe[e]:(s.push(e),$e.hasOwnProperty(e)||($e[e]=[]),$e[e].push((()=>{n[t]=Oe[e],++a===s.length&&i(n)})))})),0===s.length&&i(n)};function je(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||He(`type "${i}" must have a positive integer typeid pointer`),Oe.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;He(`Cannot register type '${i}' twice`)}if(Oe[e]=t,delete Ge[e],$e.hasOwnProperty(e)){var n=$e[e];delete $e[e],n.forEach((e=>e()))}}function qe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return je(e,t,r)}var Ye,Ke=8,Xe=(e,t,r,i)=>{qe(e,{name:t=Ne(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:Ke,readValueFromPointer:function(e){return this.fromWireType(E[e])},destructorFunction:null})},Ze=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Je=e=>{He(e.$$.ptrType.registeredClass.name+" instance already deleted")},Qe=!1,et=e=>{},tt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},rt=e=>{e.count.value-=1,0===e.count.value&&tt(e)},it=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=it(e,t,r.baseClass);return null===i?null:r.downcast(i)},nt={},st=()=>Object.keys(ut).length,at=()=>{var e=[];for(var t in ut)ut.hasOwnProperty(t)&&e.push(ut[t]);return e},ot=[],dt=()=>{for(;ot.length;){var e=ot.pop();e.$$.deleteScheduled=!1,e.delete()}},lt=e=>{Ye=e,ot.length&&Ye&&Ye(dt)},ct=()=>{n.getInheritedInstanceCount=st,n.getLiveInheritedInstances=at,n.flushPendingDeletes=dt,n.setDelayFunction=lt},ut={},ht=(e,t)=>{for(void 0===t&&He("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},ft=(e,t)=>(t=ht(e,t),ut[t]),pt=(e,t)=>(t.ptrType&&t.ptr||We("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!==!!t.smartPtr&&We("Both smartPtrType and smartPtr must be specified"),t.count={value:1},_t(Object.create(e,{$$:{value:t}})));function mt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ft(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?pt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):pt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,a=this.registeredClass.getActualType(t),o=nt[a];if(!o)return n.call(this);s=this.isConst?o.constPointerType:o.pointerType;var d=it(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}var _t=e=>"undefined"==typeof FinalizationRegistry?(_t=e=>e,e):(Qe=new FinalizationRegistry((e=>{rt(e.$$)})),_t=e=>{var t=e.$$;if(!!t.smartPtr){var r={$$:t};Qe.register(e,r,e)}return e},et=e=>Qe.unregister(e),_t(e)),gt=()=>{Object.assign(yt.prototype,{isAliasOf(e){if(!(this instanceof yt))return!1;if(!(e instanceof yt))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n},clone(){if(this.$$.ptr||Je(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=_t(Object.create(Object.getPrototypeOf(this),{$$:{value:Ze(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),et(this),rt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),ot.push(this),1===ot.length&&Ye&&Ye(dt),this.$$.deleteScheduled=!0,this}})};function yt(){}var vt=(e,t)=>Object.defineProperty(t,"name",{value:e}),bt=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||He(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},wt=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&He(`Cannot register public name '${e}' twice`),bt(n,e,e),n.hasOwnProperty(r)&&He(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,void 0!==r&&(n[e].numArguments=r))},St=48,Et=57,At=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=St&&t<=Et?`_${e}`:e};function Ut(e,t,r,i,n,s,a,o){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=a,this.downcast=o,this.pureVirtualFunctions=[]}var Bt=(e,t,r)=>{for(;t!==r;)t.upcast||He(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function xt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Bt(t.$$.ptr,r,this.registeredClass)}function Tt(e,t){var r;if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=Bt(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&He("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,sr.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:He("Unsupporting sharing policy")}return r}function kt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Bt(t.$$.ptr,r,this.registeredClass)}function Ct(e){return this.fromWireType(x[e>>2])}var Dt=()=>{Object.assign(Pt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:Ke,readValueFromPointer:Ct,deleteObject(e){null!==e&&e.delete()},fromWireType:mt})};function Pt(e,t,r,i,n,s,a,o,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=a,this.rawGetPointee=o,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=Tt:i?(this.toWireType=xt,this.destructorFunction=null):(this.toWireType=kt,this.destructorFunction=null)}var Lt,Ft,It=(e,t,r)=>{n.hasOwnProperty(e)||We("Replacing nonexistant public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},Rt=(e,t,r)=>{var i=n["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},Mt=[],zt=e=>{var t=Mt[e];return t||(e>=Mt.length&&(Mt.length=e+1),Mt[e]=t=Lt.get(e)),t},Nt=(e,t,r)=>e.includes("j")?Rt(e,t,r):zt(t).apply(null,r),$t=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),Nt(e,t,r)}},Ot=(e,t)=>{var r=(e=Ne(e)).includes("j")?$t(e,t):zt(t);return"function"!=typeof r&&He(`unknown function pointer with signature ${e}: ${t}`),r},Gt=(e,t)=>{var r=vt(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},Ht=e=>{var t=di(e),r=Ne(t);return ai(t),r},Wt=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Oe[t]||(Ge[t]?Ge[t].forEach(e):(r.push(t),i[t]=!0))})),new Ft(`${e}: `+r.map(Ht).join([", "]))},Vt=(e,t,r,i,n,s,a,o,d,l,c,u,h)=>{c=Ne(c),s=Ot(n,s),o&&(o=Ot(a,o)),l&&(l=Ot(d,l)),h=Ot(u,h);var f=At(c);wt(f,(function(){Wt(`Cannot construct ${c} due to unbound types`,[i])})),Ve([e,t,r],i?[i]:[],(function(t){var r,n;t=t[0],n=i?(r=t.registeredClass).instancePrototype:yt.prototype;var a=vt(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new Ie("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new Ie(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new Ie(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(n,{constructor:{value:a}});a.prototype=d;var u=new Ut(c,a,d,h,r,s,o,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new Pt(c,u,!0,!1,!1),m=new Pt(c+"*",u,!1,!1,!1),_=new Pt(c+" const*",u,!1,!0,!1);return nt[e]={pointerType:m,constPointerType:_},It(f,a),[p,m,_]}))},jt=(e,t)=>{for(var r=[],i=0;i>2]);return r},qt=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Yt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=vt(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function Kt(e,t,r,i,n,s){var a=t.length;a<2&&He("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||s?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=o?1:2;l{var a=jt(t,r);n=Ot(i,n),Ve([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Ie(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Wt(`Cannot construct ${e.name} due to unbound types`,a)},Ve([],a,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Kt(r,i,null,n,s),[]))),[]}))},Zt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Jt=(e,t,r,i,n,s,a,o,d)=>{var l=jt(r,i);t=Ne(t),t=Zt(t),s=Ot(n,s),Ve([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function n(){Wt(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,c[t]=n):(bt(c,t,i),c[t].overloadTable[r-2]=n),Ve([],l,(function(n){var o=Kt(i,n,e,s,a,d);return void 0===c[t].overloadTable?(o.argCount=r-2,c[t]=o):c[t].overloadTable[r-2]=o,[]})),[]}))};function Qt(){Object.assign(er.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function er(){this.allocated=[void 0],this.freelist=[]}var tr=new er,rr=e=>{e>=tr.reserved&&0==--tr.get(e).refcount&&tr.free(e)},ir=()=>{for(var e=0,t=tr.reserved;t{tr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),tr.reserved=tr.allocated.length,n.count_emval_handles=ir},sr={toValue:e=>(e||He("Cannot use deleted val. handle = "+e),tr.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return tr.allocate({refcount:1,value:e})}}};function ar(e){return this.fromWireType(B[e>>2])}var or=(e,t)=>{qe(e,{name:t=Ne(t),fromWireType:e=>{var t=sr.toValue(e);return rr(e),t},toWireType:(e,t)=>sr.toHandle(t),argPackAdvance:Ke,readValueFromPointer:ar,destructorFunction:null})},dr=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},lr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(T[e>>2])};case 8:return function(e){return this.fromWireType(k[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},cr=(e,t,r)=>{qe(e,{name:t=Ne(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Ke,readValueFromPointer:lr(t,r),destructorFunction:null})},ur=(e,t,r)=>{switch(t){case 1:return r?e=>S[e>>0]:e=>E[e>>0];case 2:return r?e=>A[e>>1]:e=>U[e>>1];case 4:return r?e=>B[e>>2]:e=>x[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},hr=(e,t,r,i,n)=>{t=Ne(t);var s=e=>e;if(0===i){var a=32-8*r;s=e=>e<>>a}var o=t.includes("unsigned");qe(e,{name:t,fromWireType:s,toWireType:o?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:Ke,readValueFromPointer:ur(t,r,0!==i),destructorFunction:null})},fr=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=x[e>>2],r=x[e+4>>2];return new i(S.buffer,r,t)}qe(e,{name:r=Ne(r),fromWireType:n,argPackAdvance:Ke,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},pr=(e,t,r)=>_e(e,E,t,r),mr=(e,t)=>{var r="std::string"===(t=Ne(t));qe(e,{name:t,fromWireType(e){var t,i=x[e>>2],n=e+4;if(r)for(var s=n,a=0;a<=i;++a){var o=n+a;if(a==i||0==E[o]){var d=Ce(s,o-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=o+1}}else{var l=new Array(i);for(a=0;a>2]=i,r&&n)pr(t,a,i+1);else if(n)for(var o=0;o255&&(ai(a),He("String has UTF-16 code units that do not fit in 8 bits")),E[a+o]=d}else for(o=0;o{for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&U[i];)++i;if((r=i<<1)-e>32&&_r)return _r.decode(E.subarray(e,r));for(var s="",a=0;!(a>=t/2);++a){var o=A[e+2*a>>1];if(0==o)break;s+=String.fromCharCode(o)}return s},yr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=a,t+=2}return A[t>>1]=0,t-i},vr=e=>2*e.length,br=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var n=B[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i},wr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&a<=57343)a=65536+((1023&a)<<10)|1023&e.charCodeAt(++s);if(B[t>>2]=a,(t+=4)+4>n)break}return B[t>>2]=0,t-i},Sr=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},Er=(e,t,r)=>{var i,n,s,a,o;r=Ne(r),2===t?(i=gr,n=yr,a=vr,s=()=>U,o=1):4===t&&(i=br,n=wr,a=Sr,s=()=>x,o=2),qe(e,{name:r,fromWireType:e=>{for(var r,n=x[e>>2],a=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==a[c>>o]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return ai(e),r},toWireType:(e,i)=>{"string"!=typeof i&&He(`Cannot pass non-string to C++ string type ${r}`);var s=a(i),d=li(4+s+t);return x[d>>2]=s>>o,n(i,d+4,s+t),null!==e&&e.push(ai,d),d},argPackAdvance:Ke,readValueFromPointer:ar,destructorFunction(e){ai(e)}})},Ar=(e,t)=>{qe(e,{isVoid:!0,name:t=Ne(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},Ur={},Br=e=>{var t=Ur[e];return void 0===t?Ne(e):t},xr=[],Tr=(e,t,r,i,n)=>(e=xr[e])(t=sr.toValue(t),t[r=Br(r)],i,n),kr=e=>{var t=xr.length;return xr.push(e),t},Cr=(e,t)=>{var r=Oe[e];return void 0===r&&He(t+" has unknown type "+Ht(e)),r},Dr=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},Pr=(e,t,r)=>{var i=[],n=e.toWireType(i,r);return i.length&&(x[t>>2]=sr.toHandle(i)),n},Lr=(e,t,r)=>{var i=Dr(e,t),n=i.shift();e--;var s="return function (obj, func, destructorsRef, args) {\n",a=0,o=[];0===r&&o.push("obj");for(var d=["retType"],l=[n],c=0;ce.name)).join(", ")}) => ${n.name}>`;return kr(vt(h,u))},Fr=e=>{var t=sr.toValue(e);qt(t),rr(e)},Ir=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,Rr=()=>{j("")},Mr=()=>Date.now(),zr=(e,t,r)=>E.copyWithin(e,t,t+r),Nr=e=>{j("OOM")},$r=e=>{E.length,Nr()},Or={},Gr=()=>l||"./this.program",Hr=()=>{if(!Hr.strings){var e={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",_:Gr()};for(var t in Or)void 0===Or[t]?delete e[t]:e[t]=Or[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Hr.strings=r}return Hr.strings},Wr=(e,t)=>{for(var r=0;r>0]=e.charCodeAt(r);S[t>>0]=0},Vr=(e,t)=>{var r=0;return Hr().forEach(((i,n)=>{var s=t+r;x[e+4*n>>2]=s,Wr(i,s),r+=i.length+1})),0},jr=(e,t)=>{var r=Hr();x[e>>2]=r.length;var i=0;return r.forEach((e=>i+=e.length+1)),x[t>>2]=i,0};function qr(e){try{var t=De.getStreamFromFD(e);return ke.close(t),0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}function Yr(e,t){try{var r=De.getStreamFromFD(e),i=r.tty?2:ke.isDir(r.mode)?3:ke.isLink(r.mode)?7:4;return S[t>>0]=i,A[t+2>>1]=0,K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],B[t+8>>2]=K[0],B[t+12>>2]=K[1],K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],B[t+16>>2]=K[0],B[t+20>>2]=K[1],0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}var Kr=(e,t,r,i)=>{for(var n=0,s=0;s>2],o=x[t+4>>2];t+=8;var d=ke.read(e,S,a,o,i);if(d<0)return-1;if(n+=d,d>2]=s,0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}function Zr(e,t,r,i,n){var s=Ir(t,r);try{if(isNaN(s))return 61;var a=De.getStreamFromFD(e);return ke.llseek(a,s,i),K=[a.position>>>0,(Y=a.position,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],B[n>>2]=K[0],B[n+4>>2]=K[1],a.getdents&&0===s&&0===i&&(a.getdents=null),0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}var Jr=(e,t,r,i)=>{for(var n=0,s=0;s>2],o=x[t+4>>2];t+=8;var d=ke.write(e,S,a,o,i);if(d<0)return-1;n+=d,void 0!==i&&(i+=d)}return n};function Qr(e,t,r,i){try{var n=De.getStreamFromFD(e),s=Jr(n,t,r);return x[i>>2]=s,0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}var ei=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=ke.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},ti=365,ri=146;Object.defineProperties(ei.prototype,{read:{get:function(){return(this.mode&ti)===ti},set:function(e){e?this.mode|=ti:this.mode&=~ti}},write:{get:function(){return(this.mode&ri)===ri},set:function(e){e?this.mode|=ri:this.mode&=~ri}},isFolder:{get:function(){return ke.isDir(this.mode)}},isDevice:{get:function(){return ke.isChrdev(this.mode)}}}),ke.FSNode=ei,ke.createPreloadedFile=Be,ke.staticInit(),ze(),Ie=n.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Re=n.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},gt(),ct(),Dt(),Ft=n.UnboundTypeError=Gt(Error,"UnboundTypeError"),Qt(),nr();var ii,ni={o:ae,A:Pe,s:Le,q:Me,C:Xe,D:Vt,y:Xt,h:Jt,B:or,l:cr,c:hr,b:fr,m:mr,j:Er,n:Ar,f:Tr,g:rr,e:Lr,d:Fr,a:Rr,i:Mr,w:zr,r:$r,u:Vr,v:jr,k:qr,t:Yr,z:Xr,p:Zr,x:Qr},si=ie(),ai=e=>(ai=si.G)(e),oi=()=>(oi=si.I)(),di=e=>(di=si.J)(e),li=e=>(li=si.K)(e),ci=e=>(ci=si.M)(e);function ui(){function e(){ii||(ii=!0,n.calledRun=!0,C||(M(),r(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),z()))}G>0||(R(),G>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.dynCall_viiijj=(e,t,r,i,s,a,o,d)=>(n.dynCall_viiijj=si.N)(e,t,r,i,s,a,o,d),n.dynCall_jij=(e,t,r,i)=>(n.dynCall_jij=si.O)(e,t,r,i),n.dynCall_jii=(e,t,r)=>(n.dynCall_jii=si.P)(e,t,r),n.dynCall_jiji=(e,t,r,i,s)=>(n.dynCall_jiji=si.Q)(e,t,r,i,s),H=function e(){ii||ui(),ii||(H=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return ui(),t.ready}})(),o=1e-6,d="undefined"!=typeof Float32Array?Float32Array:Array;function l(){var e=new d(16);return d!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function c(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var u,h=function(e,t,r,i,n,s,a){var o=1/(t-r),d=1/(i-n),l=1/(s-a);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*d,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*o,e[13]=(n+i)*d,e[14]=(a+s)*l,e[15]=1,e};function f(e,t,r){var i=new d(3);return i[0]=e,i[1]=t,i[2]=r,i}u=new d(3),d!=Float32Array&&(u[0]=0,u[1]=0,u[2]=0);var p=(e,t)=>{t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);const r=function(){const t=m(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),r=m(e.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))return console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(i)),null;return i}();let i={program:r,attribLocations:{vertexPosition:e.getAttribLocation(r,"aVertexPosition"),texturePosition:e.getAttribLocation(r,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(r,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(r,"uModelMatrix"),viewMatrix:e.getUniformLocation(r,"uViewMatrix"),rgbatexture:e.getUniformLocation(r,"rgbaTexture"),ytexture:e.getUniformLocation(r,"yTexture"),utexture:e.getUniformLocation(r,"uTexture"),vtexture:e.getUniformLocation(r,"vTexture"),isyuv:e.getUniformLocation(r,"isyuv")}},n=function(){const t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),e.STATIC_DRAW);var r=[];r=r.concat([0,1],[1,1],[1,0],[0,0]);const i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW);const n=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,texPosition:i,indices:n}}(),s=p(),a=p(),d=p(),u=p();function p(){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function m(t,r){const i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(console.log("An error occurred compiling the shaders: "+e.getShaderInfoLog(i)),e.deleteShader(i),null)}function _(t,r){e.viewport(0,0,t,r),e.clearColor(0,0,0,0),e.clearDepth(1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);const s=l();h(s,-1,1,-1,1,.1,100);const p=l();c(p);const m=l();!function(e,t,r,i){var n,s,a,d,l,u,h,f,p,m,_=t[0],g=t[1],y=t[2],v=i[0],b=i[1],w=i[2],S=r[0],E=r[1],A=r[2];Math.abs(_-S)32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let r=e-this._current_word_bits_left;this._fillCurrentWord();let i=Math.min(r,this._current_word_bits_left),n=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Ht=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Wt=Ht,Vt=Ht;function jt(e){let{profile:t,sampleRate:r,channel:i}=e;return new Uint8Array([175,0,t<<3|(14&r)>>1,(1&r)<<7|i<<3])}function qt(e){return Yt(e)&&e[1]===xt}function Yt(e){return e[0]>>4===$e}const Kt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Xt(e){let t=new Uint8Array(e),r=null,i=0,n=0,s=0,a=null;if(i=n=t[0]>>>3,s=(7&t[0])<<1|t[1]>>>7,s<0||s>=Kt.length)return void console.error("Flv: AAC invalid sampling frequency index!");let o=Kt[s],d=(120&t[1])>>>3;if(d<0||d>=8)return void console.log("Flv: AAC invalid channel configuration");5===i&&(a=(7&t[1])<<1|t[2]>>>7,t[2]);let l=self.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?s>=6?(i=5,r=new Array(4),a=s-3):(i=2,r=new Array(2),a=s):-1!==l.indexOf("android")?(i=2,r=new Array(2),a=s):(i=5,a=s,r=new Array(4),s>=6?a=s-3:1===d&&(i=2,r=new Array(2),a=s)),r[0]=i<<3,r[0]|=(15&s)>>>1,r[1]=(15&s)<<7,r[1]|=(15&d)<<3,5===i&&(r[1]|=(15&a)>>>1,r[2]=(1&a)<<7,r[2]|=8,r[3]=0),{audioType:"aac",config:r,sampleRate:o,channelCount:d,objectType:i,codec:"mp4a.40."+i,originalCodec:"mp4a.40."+n}}class Zt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+7>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(4095===(r[t+0]<<8|r[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let r=this.current_syncword_offset_,i=(8&e[r+1])>>>3,n=(6&e[r+1])>>>1,s=1&e[r+1],a=(192&e[r+2])>>>6,o=(60&e[r+2])>>>2,d=(1&e[r+2])<<2|(192&e[r+3])>>>6,l=(3&e[r+3])<<11|e[r+4]<<3|(224&e[r+5])>>>5;if(e[r+6],r+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let c=1===s?7:9,u=l-c;r+=c;let h=this.findNextSyncwordOffset(r+u);if(this.current_syncword_offset_=h,0!==i&&1!==i||0!==n)continue;let f=e.subarray(r,r+u);t={},t.audio_object_type=a+1,t.sampling_freq_index=o,t.sampling_frequency=Wt[o],t.channel_config=d,t.data=f}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Jt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+1>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(695===(r[t+0]<<3|r[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),r=0;for(let i=0;i<=t;i++)r<<=8,r|=e.readByte();return r}readNextAACFrame(e){let t=this.data_,r=null;for(;null==r&&!this.eof_flag_;){let i=this.current_syncword_offset_,n=(31&t[i+1])<<8|t[i+2];if(i+3+n>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let s=new Gt(t.subarray(i+3,i+3+n)),a=null;if(s.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(i+3+n),s.destroy();continue}a=e}else{let e=s.readBool();if(e&&s.readBool()){console.error("audioMuxVersionA is Not Supported"),s.destroy();break}if(e&&this.getLATMValue(s),!s.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),s.destroy();break}if(0!==s.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),s.destroy();break}if(0!==s.readBits(4)){console.error("more than 2 numProgram Not Supported"),s.destroy();break}if(0!==s.readBits(3)){console.error("more than 2 numLayer Not Supported"),s.destroy();break}let t=e?this.getLATMValue(s):0,r=s.readBits(5);t-=5;let i=s.readBits(4);t-=4;let n=s.readBits(4);t-=4,s.readBits(3),t-=3,t>0&&s.readBits(t);let o=s.readBits(3);if(0!==o){console.error(`frameLengthType = ${o}. Only frameLengthType = 0 Supported`),s.destroy();break}s.readByte();let d=s.readBool();if(d)if(e)this.getLATMValue(s);else{let e=0;for(;;){e<<=8;let t=s.readBool();if(e+=s.readByte(),!t)break}console.log(e)}s.readBool()&&s.readByte(),a={},a.audio_object_type=r,a.sampling_freq_index=i,a.sampling_frequency=Wt[a.sampling_freq_index],a.channel_config=n,a.other_data_present=d}let o=0;for(;;){let e=s.readByte();if(o+=e,255!==e)break}let d=new Uint8Array(o);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function er(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return;const r=e.length,i=[];let n,s=0;for(;s+t>>=8),s+=t,n){if(s+n>r)break;i.push(e.subarray(s,s+n)),s+=n}return i}function tr(e){const t=e.byteLength,r=new Uint8Array(4);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t;const i=new Uint8Array(t+4);return i.set(r,0),i.set(e,4),i}function rr(e,t){let r=null;return t?e.length>=28&&(r=1+(3&e[26])):e.length>=12&&(r=1+(3&e[9])),r}function ir(){return(new Date).getTime()}function nr(e,t,r){return Math.max(Math.min(e,Math.max(t,r)),Math.min(t,r))}function sr(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function ar(e){let t=0,r=sr();return i=>{if(n=i,"[object Number]"!==Object.prototype.toString.call(n))return;var n;t+=i;const s=sr(),a=s-r;a>=1e3&&(e(t/a*1e3),r=s,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();function or(e){return null==e}function dr(e){return!or(e)}function lr(e){return"function"==typeof e}function cr(e){let t=null,r=31&e[0];return r!==We&&r!==Ve||(t=ze),t||(r=(126&e[0])>>1,r!==st&&r!==ot&&r!==lt||(t=Ne)),t}function ur(){return"undefined"!=typeof WritableStream}function hr(e){e.close()}function fr(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let r=e[0],i=null,n=1;if(e.length>0){let t=e[1];t&&t.ts-r.ts>1e5&&(r=t,n=2)}if(r)for(let s=n;s=1e3){e[s-1].ts-r.ts<1e3&&(i=s+1)}}}return i}function pr(e){return e.ok&&e.status>=200&&e.status<=299}function mr(){return function(e){let t="";if("object"==typeof e)try{t=JSON.stringify(e),t=JSON.parse(t)}catch(r){t=e}else t=e;return t}(x)}function _r(e){return e[0]>>4===Tt&&e[1]===xt}function gr(e){return!0===e||"true"===e}function yr(e){return!0!==e&&"true"!==e}function vr(){return!!(self.Worker&&self.MediaSource&&"canConstructInDedicatedWorker"in self.MediaSource&&!0===self.MediaSource.canConstructInDedicatedWorker)}function br(e,t){const r=er(e.slice(5));let i=!1;return r.forEach((e=>{const r=t?e[0]>>>1&63:31&e[0];(t&&(r===Qe||r===tt||r===it)||yr(t)&&r===je)&&(i=!0)})),i}var wr=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function a(e){try{d(i.next(e))}catch(e){s(e)}}function o(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}d((i=i.apply(e,t||[])).next())}))};const Sr=Symbol(32),Er=Symbol(16),Ar=Symbol(8);class Ur{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return wr(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,r)=>{var i;this.reject=r,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(i=this.pull)||void 0===i||i.call(this,e)}))}))}readU32(){return this.read(Sr)}readU16(){return this.read(Er)}readU8(){return this.read(Ar)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let r=0;const i=e=>t.length<(r=e);if("number"==typeof this.need){if(i(this.need))return;e=t.subarray(0,r)}else if(this.need===Sr){if(i(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Er){if(i(2))return;e=t[0]<<8|t[1]}else if(this.need===Ar){if(i(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(i(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,r)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(i(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,r)),e=this.need}return this.consumed+=r,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,r=t+e;if(r<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,r);else{const e=new Uint8Array(r);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,r)}return this.buffer=new Uint8Array(e),this.buffer}}Ur.U32=Sr,Ur.U16=Er,Ur.U8=Ar;class Br{constructor(e){this.log=function(t){if(e._opt.debugLevel==S){const s=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n1?r-1:0),n=1;n1?i-1:0),s=1;s=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseSPS(e){let t=xr._ebsp2rbsp(e),r=new Gt(t);r.readByte();let i=r.readByte();r.readByte();let n=r.readByte();r.readUEG();let s=xr.getProfileString(i),a=xr.getLevelString(n),o=1,d=420,l=[0,420,422,444],c=8;if((100===i||110===i||122===i||244===i||44===i||83===i||86===i||118===i||128===i||138===i||144===i)&&(o=r.readUEG(),3===o&&r.readBits(1),o<=3&&(d=l[o]),c=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool())){let e=3!==o?8:12;for(let t=0;t0&&e<16?(b=t[e-1],w=i[e-1]):255===e&&(b=r.readByte()<<8|r.readByte(),w=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);E=r.readBool(),A=t,U=2*e,S=A/U}}let B=1;1===b&&1===w||(B=b/w);let x=0,T=0;if(0===o)x=1,T=2-m;else{x=3===o?1:2,T=(1===o?2:1)*(2-m)}let k=16*(f+1),C=16*(p+1)*(2-m);k-=(_+g)*x,C-=(y+v)*T;let D=Math.ceil(k*B);return r.destroy(),r=null,{profile_string:s,level_string:a,bit_depth:c,ref_frames:h,chroma_format:d,chroma_format_string:xr.getChromaFormatString(d),frame_rate:{fixed:E,fps:S,fps_den:U,fps_num:A},sar_ratio:{width:b,height:w},codec_size:{width:k,height:C},present_size:{width:D,height:C}}}static parseSPS$2(e){let t=e.subarray(1,4),r="avc1.";for(let e=0;e<3;e++){let i=t[e].toString(16);i.length<2&&(i="0"+i),r+=i}let i=xr._ebsp2rbsp(e),n=new Gt(i);n.readByte();let s=n.readByte();n.readByte();let a=n.readByte();n.readUEG();let o=xr.getProfileString(s),d=xr.getLevelString(a),l=1,c=420,u=[0,420,422,444],h=8,f=8;if((100===s||110===s||122===s||244===s||44===s||83===s||86===s||118===s||128===s||138===s||144===s)&&(l=n.readUEG(),3===l&&n.readBits(1),l<=3&&(c=u[l]),h=n.readUEG()+8,f=n.readUEG()+8,n.readBits(1),n.readBool())){let e=3!==l?8:12;for(let t=0;t0&&e<16?(E=t[e-1],A=r[e-1]):255===e&&(E=n.readByte()<<8|n.readByte(),A=n.readByte()<<8|n.readByte())}if(n.readBool()&&n.readBool(),n.readBool()&&(n.readBits(4),n.readBool()&&n.readBits(24)),n.readBool()&&(n.readUEG(),n.readUEG()),n.readBool()){let e=n.readBits(32),t=n.readBits(32);B=n.readBool(),x=t,T=2*e,U=x/T}}let k=1;1===E&&1===A||(k=E/A);let C=0,D=0;if(0===l)C=1,D=2-y;else{C=3===l?1:2,D=(1===l?2:1)*(2-y)}let P=16*(_+1),L=16*(g+1)*(2-y);P-=(v+b)*C,L-=(w+S)*D;let F=Math.ceil(P*k);return n.destroy(),n=null,{codec_mimetype:r,profile_idc:s,level_idc:a,profile_string:o,level_string:d,chroma_format_idc:l,bit_depth:h,bit_depth_luma:h,bit_depth_chroma:f,ref_frames:m,chroma_format:c,chroma_format_string:xr.getChromaFormatString(c),frame_rate:{fixed:B,fps:U,fps_den:T,fps_num:x},sar_ratio:{width:E,height:A},codec_size:{width:P,height:L},present_size:{width:F,height:L}}}static _skipScalingList(e,t){let r=8,i=8,n=0;for(let s=0;s=this.buflen)return this.iserro=!0,0;this.iserro=!1,r=this.bufoff+e>8?8-this.bufoff:e,t<<=r,t+=this.buffer[this.bufpos]>>8-this.bufoff-r&255>>8-r,this.bufoff+=r,e-=r,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,r=this.bufoff,i=this.read(e);return this.bufpos=t,this.bufoff=r,i}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.sps,4),t.sps=i}if(t.pps){const e=t.pps.byteLength,r=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.pps,4),t.pps=i}return t}function Cr(e){let{sps:t,pps:r}=e;const i=[23,0,0,0,0,1,66,0,30,255];i[0]=23,i[6]=t[1],i[7]=t[2],i[8]=t[3],i[10]=225,i[11]=t.byteLength>>8&255,i[12]=255&t.byteLength,i.push(...t,1,r.byteLength>>8&255,255&r.byteLength,...r);return new Uint8Array(i)}function Dr(e){let{sps:t,pps:r}=e,i=8+t.byteLength+1+2+r.byteLength,n=!1;const s=xr.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(n=!0,i+=4);let a=new Uint8Array(i);a[0]=1,a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=255,a[5]=225;let o=t.byteLength;a[6]=o>>>8,a[7]=255&o;let d=8;a.set(t,8),d+=o,a[d]=1;let l=r.byteLength;a[d+1]=l>>>8,a[d+2]=255&l,a.set(r,d+3),d+=3+l,n&&(a[d]=252|s.chroma_format_idc,a[d+1]=248|s.bit_depth_luma-8,a[d+2]=248|s.bit_depth_chroma-8,a[d+3]=0,d+=4);const c=[23,0,0,0,0],u=new Uint8Array(c.length+a.byteLength);return u.set(c,0),u.set(a,c.length),u}function Pr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Lr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Fr(e){return 31&e[0]}function Ir(e){return e===Ke}function Rr(e){return!function(e){return e===We||e===Ve}(e)&&!Ir(e)}function Mr(e){return e===je}function zr(e){if(0===e.length)return!1;const t=Fr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=31&e[r],n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,i>=Je||0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class $r{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Or=e=>{let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)},Gr=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Hr{static _ebsp2rbsp(e){let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseVPS(e){let t=Hr._ebsp2rbsp(e),r=new Gt(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}}static parseSPS(e){let t=Hr._ebsp2rbsp(e),r=new Gt(t);r.readByte(),r.readByte();let i=0,n=0,s=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<=16?(F=t[e-1],I=i[e-1]):255===e&&(F=r.readBits(16),I=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()){r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())}if(r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG()),r.readBool()){if(M=r.readBits(32),z=r.readBits(32),r.readBool()&&r.readUEG(),r.readBool()){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=o;n++){let n=r.readBool();R=n;let s=!0,a=1;n||(s=r.readBool());let o=!1;if(s?r.readUEG():o=r.readBool(),o||(a=r.readUEG()+1),e){for(let e=0;e>6&3,r.general_tier_flag=e[1]>>5&1,r.general_profile_idc=31&e[1],r.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],r.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],r.general_constraint_indicator_flags=r.general_constraint_indicator_flags<<16|e[10]<<8|e[11],r.general_level_idc=e[12],r.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],r.parallelismType=3&e[15],r.chromaFormat=3&e[16],r.bitDepthLumaMinus8=7&e[17],r.bitDepthChromaMinus8=7&e[18],r.avgFrameRate=e[19]<<8|e[20],r.constantFrameRate=e[21]>>6&3,r.numTemporalLayers=e[21]>>3&7,r.temporalIdNested=e[21]>>2&1,r.lengthSizeMinusOne=3&e[21];let i=e[22],n=e.slice(23);for(let e=0;e0)for(let t=r;t<8;t++)e.read(2);i.sub_layer_profile_space=[],i.sub_layer_tier_flag=[],i.sub_layer_profile_idc=[],i.sub_layer_profile_compatibility_flag=[],i.sub_layer_progressive_source_flag=[],i.sub_layer_interlaced_source_flag=[],i.sub_layer_non_packed_constraint_flag=[],i.sub_layer_frame_only_constraint_flag=[],i.sub_layer_level_idc=[];for(let t=0;t{let t=Or(e),r=new Gt(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}})(t),a=(e=>{let t=Or(e),r=new Gt(t);r.readByte(),r.readByte();let i=0,n=0,s=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<16?(F=t[e-1],I=i[e-1]):255===e&&(F=r.readBits(16),I=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(i+=r.readUEG(),n+=r.readUEG(),s+=r.readUEG(),a+=r.readUEG()),r.readBool()&&(M=r.readBits(32),z=r.readBits(32),r.readBool()&&(r.readUEG(),r.readBool()))){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=o;n++){let n=r.readBool();R=n;let s=!1,a=1;n||(s=r.readBool());let o=!1;if(s?r.readSEG():o=r.readBool(),o||(cpbcnt=r.readUEG()+1),e)for(let e=0;e{let t=Or(e),r=new Gt(t);r.readByte(),r.readByte(),r.readUEG(),r.readUEG(),r.readBool(),r.readBool(),r.readBits(3),r.readBool(),r.readBool(),r.readUEG(),r.readUEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool()&&r.readUEG(),r.readSEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool(),r.readBool();let i=r.readBool(),n=r.readBool(),s=1;return n&&i?s=0:n?s=3:i&&(s=2),{parallelismType:s}})(r);n=Object.assign(n,s,a,o);let d=23+(5+t.byteLength)+(5+i.byteLength)+(5+r.byteLength),l=new Uint8Array(d);l[0]=1,l[1]=(3&n.general_profile_space)<<6|(n.general_tier_flag?1:0)<<5|31&n.general_profile_idc,l[2]=n.general_profile_compatibility_flags_1||0,l[3]=n.general_profile_compatibility_flags_2||0,l[4]=n.general_profile_compatibility_flags_3||0,l[5]=n.general_profile_compatibility_flags_4||0,l[6]=n.general_constraint_indicator_flags_1||0,l[7]=n.general_constraint_indicator_flags_2||0,l[8]=n.general_constraint_indicator_flags_3||0,l[9]=n.general_constraint_indicator_flags_4||0,l[10]=n.general_constraint_indicator_flags_5||0,l[11]=n.general_constraint_indicator_flags_6||0,l[12]=60,l[13]=240|(3840&n.min_spatial_segmentation_idc)>>8,l[14]=255&n.min_spatial_segmentation_idc,l[15]=252|3&n.parallelismType,l[16]=252|3&n.chroma_format_idc,l[17]=248|7&n.bit_depth_luma_minus8,l[18]=248|7&n.bit_depth_chroma_minus8,l[19]=0,l[20]=0,l[21]=(3&n.constant_frame_rate)<<6|(7&n.num_temporal_layers)<<3|(n.temporal_id_nested?1:0)<<2|3,l[22]=3,l[23]=128|st,l[24]=0,l[25]=1,l[26]=(65280&t.byteLength)>>8,l[27]=(255&t.byteLength)>>0,l.set(t,28),l[23+(5+t.byteLength)+0]=128|ot,l[23+(5+t.byteLength)+1]=0,l[23+(5+t.byteLength)+2]=1,l[23+(5+t.byteLength)+3]=(65280&i.byteLength)>>8,l[23+(5+t.byteLength)+4]=(255&i.byteLength)>>0,l.set(i,23+(5+t.byteLength)+5),l[23+(5+t.byteLength+5+i.byteLength)+0]=128|lt,l[23+(5+t.byteLength+5+i.byteLength)+1]=0,l[23+(5+t.byteLength+5+i.byteLength)+2]=1,l[23+(5+t.byteLength+5+i.byteLength)+3]=(65280&r.byteLength)>>8,l[23+(5+t.byteLength+5+i.byteLength)+4]=(255&r.byteLength)>>0,l.set(r,23+(5+t.byteLength+5+i.byteLength)+5);const c=[28,0,0,0,0],u=new Uint8Array(c.length+l.byteLength);return u.set(c,0),u.set(l,c.length),u}function Yr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Kr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Xr(e){return(126&e[0])>>1}function Zr(e){return e===ut}function Jr(e){return!function(e){return e>=32&&e<=40}(e)}function Qr(e){return e>=16&&e<=21}function ei(e){if(0===e.length)return!1;const t=Xr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=e[r]>>1&63,n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class ri{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}function ii(e){return parseInt(e)===e}function ni(e){if(!ii(e.length))return!1;for(var t=0;t255)return!1;return!0}function si(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!ni(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(ii(e.length)&&ni(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function ai(e){return new Uint8Array(e)}function oi(e,t,r,i,n){null==i&&null==n||(e=e.slice?e.slice(i,n):Array.prototype.slice.call(e,i,n)),t.set(e,r)}var di,li={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},ci=(di="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r>4]+di[15&i])}return t.join("")}}),ui={16:10,24:12,32:14},hi=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],fi=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],pi=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],mi=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],_i=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],gi=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],yi=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],vi=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],bi=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],wi=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Si=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Ei=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Ai=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Ui=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Bi=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function xi(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=s[t],this._Kd[e-r][t%4]=s[t];for(var a,o=0,d=n;d>16&255]<<24^fi[a>>8&255]<<16^fi[255&a]<<8^fi[a>>24&255]^hi[o]<<24,o+=1,8!=n)for(t=1;t>8&255]<<8^fi[a>>16&255]<<16^fi[a>>24&255]<<24;for(t=n/2+1;t>2,c=d%4,this._Ke[l][c]=s[t],this._Kd[e-l][c]=s[t++],d++}for(var l=1;l>24&255]^Ai[a>>16&255]^Ui[a>>8&255]^Bi[255&a]},Ti.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=xi(e),n=0;n<4;n++)i[n]^=this._Ke[0][n];for(var s=1;s>24&255]^_i[i[(n+1)%4]>>16&255]^gi[i[(n+2)%4]>>8&255]^yi[255&i[(n+3)%4]]^this._Ke[s][n];i=r.slice()}var a,o=ai(16);for(n=0;n<4;n++)a=this._Ke[t][n],o[4*n]=255&(fi[i[n]>>24&255]^a>>24),o[4*n+1]=255&(fi[i[(n+1)%4]>>16&255]^a>>16),o[4*n+2]=255&(fi[i[(n+2)%4]>>8&255]^a>>8),o[4*n+3]=255&(fi[255&i[(n+3)%4]]^a);return o},Ti.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=xi(e),n=0;n<4;n++)i[n]^=this._Kd[0][n];for(var s=1;s>24&255]^bi[i[(n+3)%4]>>16&255]^wi[i[(n+2)%4]>>8&255]^Si[255&i[(n+1)%4]]^this._Kd[s][n];i=r.slice()}var a,o=ai(16);for(n=0;n<4;n++)a=this._Kd[t][n],o[4*n]=255&(pi[i[n]>>24&255]^a>>24),o[4*n+1]=255&(pi[i[(n+3)%4]>>16&255]^a>>16),o[4*n+2]=255&(pi[i[(n+2)%4]>>8&255]^a>>8),o[4*n+3]=255&(pi[255&i[(n+1)%4]]^a);return o};var ki=function(e){if(!(this instanceof ki))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new Ti(e)};ki.prototype.encrypt=function(e){if((e=si(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=ai(e.length),r=ai(16),i=0;iNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},Li.prototype.setBytes=function(e){if(16!=(e=si(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Li.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var Fi=function(e,t){if(!(this instanceof Fi))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Li||(t=new Li(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new Ti(e)};Fi.prototype.encrypt=function(e){for(var t=si(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,i=0;i>>2]>>>24-s%4*8&255;t[i+s>>>2]|=a<<24-(i+s)%4*8}else for(var o=0;o>>2]=r[o>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-n%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new l.init(r,t/2)}},h=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new l.init(r,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,n=i.words,s=i.sigBytes,a=this.blockSize,o=s/(4*a),d=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*a,c=e.min(4*d,s);if(d){for(var u=0;u>>2]|=e[n]<<24-n%4*8;t.call(this,i,r)}else t.apply(this,arguments)};i.prototype=e}}(),r.lib.WordArray)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.WordArray,i=e.enc;function n(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var r=e.length,i=[],n=0;n>>1]|=e.charCodeAt(n)<<16-n%2*16;return t.create(i,2*r)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s>>2]>>>16-s%4*8&65535);i.push(String.fromCharCode(a))}return i.join("")},parse:function(e){for(var r=e.length,i=[],s=0;s>>1]|=n(e.charCodeAt(s)<<16-s%2*16);return t.create(i,2*r)}}}(),r.enc.Utf16)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.WordArray;function i(e,r,i){for(var n=[],s=0,a=0;a>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var n=[],s=0;s>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,o=0;o<4&&s+.75*o>>6*(3-o)&63));var d=i.charAt(64);if(d)for(;n.length%4;)n.push(d);return n.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var s=0;s>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,n=t?this._safe_map:this._map;e.clamp();for(var s=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,d=0;d<4&&a+.75*d>>6*(3-d)&63));var l=n.charAt(64);if(l)for(;s.length%4;)s.push(l);return s.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,n=t?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var a=0;a>>24)|4278255360&(n<<24|n>>>8)}var s=this._hash.words,a=e[t+0],d=e[t+1],f=e[t+2],p=e[t+3],m=e[t+4],_=e[t+5],g=e[t+6],y=e[t+7],v=e[t+8],b=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],A=e[t+13],U=e[t+14],B=e[t+15],x=s[0],T=s[1],k=s[2],C=s[3];x=l(x,T,k,C,a,7,o[0]),C=l(C,x,T,k,d,12,o[1]),k=l(k,C,x,T,f,17,o[2]),T=l(T,k,C,x,p,22,o[3]),x=l(x,T,k,C,m,7,o[4]),C=l(C,x,T,k,_,12,o[5]),k=l(k,C,x,T,g,17,o[6]),T=l(T,k,C,x,y,22,o[7]),x=l(x,T,k,C,v,7,o[8]),C=l(C,x,T,k,b,12,o[9]),k=l(k,C,x,T,w,17,o[10]),T=l(T,k,C,x,S,22,o[11]),x=l(x,T,k,C,E,7,o[12]),C=l(C,x,T,k,A,12,o[13]),k=l(k,C,x,T,U,17,o[14]),x=c(x,T=l(T,k,C,x,B,22,o[15]),k,C,d,5,o[16]),C=c(C,x,T,k,g,9,o[17]),k=c(k,C,x,T,S,14,o[18]),T=c(T,k,C,x,a,20,o[19]),x=c(x,T,k,C,_,5,o[20]),C=c(C,x,T,k,w,9,o[21]),k=c(k,C,x,T,B,14,o[22]),T=c(T,k,C,x,m,20,o[23]),x=c(x,T,k,C,b,5,o[24]),C=c(C,x,T,k,U,9,o[25]),k=c(k,C,x,T,p,14,o[26]),T=c(T,k,C,x,v,20,o[27]),x=c(x,T,k,C,A,5,o[28]),C=c(C,x,T,k,f,9,o[29]),k=c(k,C,x,T,y,14,o[30]),x=u(x,T=c(T,k,C,x,E,20,o[31]),k,C,_,4,o[32]),C=u(C,x,T,k,v,11,o[33]),k=u(k,C,x,T,S,16,o[34]),T=u(T,k,C,x,U,23,o[35]),x=u(x,T,k,C,d,4,o[36]),C=u(C,x,T,k,m,11,o[37]),k=u(k,C,x,T,y,16,o[38]),T=u(T,k,C,x,w,23,o[39]),x=u(x,T,k,C,A,4,o[40]),C=u(C,x,T,k,a,11,o[41]),k=u(k,C,x,T,p,16,o[42]),T=u(T,k,C,x,g,23,o[43]),x=u(x,T,k,C,b,4,o[44]),C=u(C,x,T,k,E,11,o[45]),k=u(k,C,x,T,B,16,o[46]),x=h(x,T=u(T,k,C,x,f,23,o[47]),k,C,a,6,o[48]),C=h(C,x,T,k,y,10,o[49]),k=h(k,C,x,T,U,15,o[50]),T=h(T,k,C,x,_,21,o[51]),x=h(x,T,k,C,E,6,o[52]),C=h(C,x,T,k,p,10,o[53]),k=h(k,C,x,T,w,15,o[54]),T=h(T,k,C,x,d,21,o[55]),x=h(x,T,k,C,v,6,o[56]),C=h(C,x,T,k,B,10,o[57]),k=h(k,C,x,T,g,15,o[58]),T=h(T,k,C,x,A,21,o[59]),x=h(x,T,k,C,m,6,o[60]),C=h(C,x,T,k,S,10,o[61]),k=h(k,C,x,T,f,15,o[62]),T=h(T,k,C,x,b,21,o[63]),s[0]=s[0]+x|0,s[1]=s[1]+T|0,s[2]=s[2]+k|0,s[3]=s[3]+C|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;r[n>>>5]|=128<<24-n%32;var s=e.floor(i/4294967296),a=i;r[15+(n+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var o=this._hash,d=o.words,l=0;l<4;l++){var c=d[l];d[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return o},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,i,n,s,a){var o=e+(t&r|~t&i)+n+a;return(o<>>32-s)+t}function c(e,t,r,i,n,s,a){var o=e+(t&i|r&~i)+n+a;return(o<>>32-s)+t}function u(e,t,r,i,n,s,a){var o=e+(t^r^i)+n+a;return(o<>>32-s)+t}function h(e,t,r,i,n,s,a){var o=e+(r^(t|~i))+n+a;return(o<>>32-s)+t}t.MD5=s._createHelper(d),t.HmacMD5=s._createHmacHelper(d)}(Math),r.MD5)})),Ot((function(e,t){var r,i,n,s,a,o,d,l;e.exports=(i=(r=l=Ri).lib,n=i.WordArray,s=i.Hasher,a=r.algo,o=[],d=a.SHA1=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],d=r[4],l=0;l<80;l++){if(l<16)o[l]=0|e[t+l];else{var c=o[l-3]^o[l-8]^o[l-14]^o[l-16];o[l]=c<<1|c>>>31}var u=(i<<5|i>>>27)+d+o[l];u+=l<20?1518500249+(n&s|~n&a):l<40?1859775393+(n^s^a):l<60?(n&s|n&a|s&a)-1894007588:(n^s^a)-899497514,d=a,a=s,s=n<<30|n>>>2,n=i,i=u}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+d|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=s._createHelper(d),r.HmacSHA1=s._createHmacHelper(d),l.SHA1)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,a=t.algo,o=[],d=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,n=0;n<64;)t(i)&&(n<8&&(o[n]=r(e.pow(i,.5))),d[n]=r(e.pow(i,1/3)),n++),i++}();var l=[],c=a.SHA256=s.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,_=l[f-2],g=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;l[f]=m+l[f-7]+g+l[f-16]}var y=i&n^i&s^n&s,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=h+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&c^~o&u)+d[f]+l[f];h=u,u=c,c=o,o=a+b|0,a=s,s=n,n=i,i=b+(v+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+o|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=s._createHelper(c),t.HmacSHA256=s._createHmacHelper(c)}(Math),r.SHA256)})),Ot((function(e,t){var r,i,n,s,a,o;e.exports=(i=(r=o=Ri).lib.WordArray,n=r.algo,s=n.SHA256,a=n.SHA224=s.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=s._createHelper(a),r.HmacSHA224=s._createHmacHelper(a),o.SHA224)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.Hasher,i=e.x64,n=i.Word,s=i.WordArray,a=e.algo;function o(){return n.create.apply(n,arguments)}var d=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=o()}();var c=a.SHA512=t.extend({_doReset:function(){this._hash=new s.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=i.high,p=i.low,m=n.high,_=n.low,g=s.high,y=s.low,v=a.high,b=a.low,w=o.high,S=o.low,E=c.high,A=c.low,U=u.high,B=u.low,x=h.high,T=h.low,k=f,C=p,D=m,P=_,L=g,F=y,I=v,R=b,M=w,z=S,N=E,$=A,O=U,G=B,H=x,W=T,V=0;V<80;V++){var j,q,Y=l[V];if(V<16)q=Y.high=0|e[t+2*V],j=Y.low=0|e[t+2*V+1];else{var K=l[V-15],X=K.high,Z=K.low,J=(X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7,Q=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),ee=l[V-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ne=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),se=l[V-7],ae=se.high,oe=se.low,de=l[V-16],le=de.high,ce=de.low;q=(q=(q=J+ae+((j=Q+oe)>>>0>>0?1:0))+ie+((j+=ne)>>>0>>0?1:0))+le+((j+=ce)>>>0>>0?1:0),Y.high=q,Y.low=j}var ue,he=M&N^~M&O,fe=z&$^~z&G,pe=k&D^k&L^D&L,me=C&P^C&F^P&F,_e=(k>>>28|C<<4)^(k<<30|C>>>2)^(k<<25|C>>>7),ge=(C>>>28|k<<4)^(C<<30|k>>>2)^(C<<25|k>>>7),ye=(M>>>14|z<<18)^(M>>>18|z<<14)^(M<<23|z>>>9),ve=(z>>>14|M<<18)^(z>>>18|M<<14)^(z<<23|M>>>9),be=d[V],we=be.high,Se=be.low,Ee=H+ye+((ue=W+ve)>>>0>>0?1:0),Ae=ge+me;H=O,W=G,O=N,G=$,N=M,$=z,M=I+(Ee=(Ee=(Ee=Ee+he+((ue+=fe)>>>0>>0?1:0))+we+((ue+=Se)>>>0>>0?1:0))+q+((ue+=j)>>>0>>0?1:0))+((z=R+ue|0)>>>0>>0?1:0)|0,I=L,R=F,L=D,F=P,D=k,P=C,k=Ee+(_e+pe+(Ae>>>0>>0?1:0))+((C=ue+Ae|0)>>>0>>0?1:0)|0}p=i.low=p+C,i.high=f+k+(p>>>0>>0?1:0),_=n.low=_+P,n.high=m+D+(_>>>0

>>0?1:0),y=s.low=y+F,s.high=g+L+(y>>>0>>0?1:0),b=a.low=b+R,a.high=v+I+(b>>>0>>0?1:0),S=o.low=S+z,o.high=w+M+(S>>>0>>0?1:0),A=c.low=A+$,c.high=E+N+(A>>>0<$>>>0?1:0),B=u.low=B+G,u.high=U+O+(B>>>0>>0?1:0),T=h.low=T+W,h.high=x+H+(T>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(c),e.HmacSHA512=t._createHmacHelper(c)}(),r.SHA512)})),Ot((function(e,t){var r,i,n,s,a,o,d,l;e.exports=(i=(r=l=Ri).x64,n=i.Word,s=i.WordArray,a=r.algo,o=a.SHA512,d=a.SHA384=o.extend({_doReset:function(){this._hash=new s.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=o._createHelper(d),r.HmacSHA384=o._createHmacHelper(d),l.SHA384)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,a=t.x64.Word,o=t.algo,d=[],l=[],c=[];!function(){for(var e=1,t=0,r=0;r<24;r++){d[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var n=1,s=0;s<24;s++){for(var o=0,u=0,h=0;h<7;h++){if(1&n){var f=(1<>>24)|4278255360&(s<<24|s>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(T=r[n]).high^=a,T.low^=s}for(var o=0;o<24;o++){for(var h=0;h<5;h++){for(var f=0,p=0,m=0;m<5;m++)f^=(T=r[h+5*m]).high,p^=T.low;var _=u[h];_.high=f,_.low=p}for(h=0;h<5;h++){var g=u[(h+4)%5],y=u[(h+1)%5],v=y.high,b=y.low;for(f=g.high^(v<<1|b>>>31),p=g.low^(b<<1|v>>>31),m=0;m<5;m++)(T=r[h+5*m]).high^=f,T.low^=p}for(var w=1;w<25;w++){var S=(T=r[w]).high,E=T.low,A=d[w];A<32?(f=S<>>32-A,p=E<>>32-A):(f=E<>>64-A,p=S<>>64-A);var U=u[l[w]];U.high=f,U.low=p}var B=u[0],x=r[0];for(B.high=x.high,B.low=x.low,h=0;h<5;h++)for(m=0;m<5;m++){var T=r[w=h+5*m],k=u[w],C=u[(h+1)%5+5*m],D=u[(h+2)%5+5*m];T.high=k.high^~C.high&D.high,T.low=k.low^~C.low&D.low}T=r[0];var P=c[o];T.high^=P.high,T.low^=P.low}},_doFinalize:function(){var t=this._data,r=t.words;this._nDataBytes;var i=8*t.sigBytes,s=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/s)*s>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,o=this.cfg.outputLength/8,d=o/8,l=[],c=0;c>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(h)}return new n.init(l,o)},clone:function(){for(var e=s.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=s._createHelper(h),t.HmacSHA3=s._createHmacHelper(h)}(Math),r.SHA3)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,a=t.algo,o=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=n.create([0,1518500249,1859775393,2400959708,2840853838]),h=n.create([1352829926,1548603684,1836072691,2053994217,0]),f=a.RIPEMD160=s.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s,a,f,b,w,S,E,A,U,B,x,T=this._hash.words,k=u.words,C=h.words,D=o.words,P=d.words,L=l.words,F=c.words;for(S=s=T[0],E=a=T[1],A=f=T[2],U=b=T[3],B=w=T[4],r=0;r<80;r+=1)x=s+e[t+D[r]]|0,x+=r<16?p(a,f,b)+k[0]:r<32?m(a,f,b)+k[1]:r<48?_(a,f,b)+k[2]:r<64?g(a,f,b)+k[3]:y(a,f,b)+k[4],x=(x=v(x|=0,L[r]))+w|0,s=w,w=b,b=v(f,10),f=a,a=x,x=S+e[t+P[r]]|0,x+=r<16?y(E,A,U)+C[0]:r<32?g(E,A,U)+C[1]:r<48?_(E,A,U)+C[2]:r<64?m(E,A,U)+C[3]:p(E,A,U)+C[4],x=(x=v(x|=0,F[r]))+B|0,S=B,B=U,U=v(A,10),A=E,E=x;x=T[1]+f+U|0,T[1]=T[2]+b+B|0,T[2]=T[3]+w+S|0,T[3]=T[4]+s+E|0,T[4]=T[0]+a+A|0,T[0]=x},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var n=this._hash,s=n.words,a=0;a<5;a++){var o=s[a];s[a]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return n},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function m(e,t,r){return e&t|~e&r}function _(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function v(e,t){return e<>>32-t}t.RIPEMD160=s._createHelper(f),t.HmacRIPEMD160=s._createHmacHelper(f)}(),r.RIPEMD160)})),Ot((function(e,t){var r,i,n;e.exports=(i=(r=Ri).lib.Base,n=r.enc.Utf8,void(r.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),a=this._iKey=t.clone(),o=s.words,d=a.words,l=0;l>>2];e.sigBytes-=t}};i.BlockCipher=c.extend({cfg:c.cfg.extend({mode:f,padding:p}),reset:function(){var e;c.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=i.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?s.create([1398893684,1701076831]).concat(r).concat(t):t).toString(d)},parse:function(e){var t,r=d.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=s.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),m.create({ciphertext:r,salt:t})}},g=i.SerializableCipher=n.extend({cfg:n.extend({format:_}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),s=n.finalize(t),a=n.cfg;return m.create({ciphertext:s,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,i,n){if(i||(i=s.random(8)),n)a=l.create({keySize:t+r,hasher:n}).compute(e,i);else var a=l.create({keySize:t+r}).compute(e,i);var o=s.create(a.words.slice(t),4*r);return a.sigBytes=4*t,m.create({key:a,iv:o,salt:i})}},v=i.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=n.iv;var s=g.encrypt.call(this,e,t,n.key,i);return s.mixIn(n),s},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=n.iv,g.decrypt.call(this,e,t,n.key,i)}})}())})),Ot((function(e,t){var r;e.exports=((r=Ri).mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,i){var n,s=this._iv;s?(n=s.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var a=0;a>24&255)){var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}else e+=1<<24;return e}function i(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var n=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,s=this._iv,a=this._counter;s&&(a=this._counter=s.slice(0),this._iv=void 0),i(a);var o=a.slice(0);r.encryptBlock(o,0);for(var d=0;d>>2]|=n<<24-s%4*8,e.sigBytes+=n},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),Ot((function(e,t){var r;e.exports=((r=Ri).pad.Iso10126={pad:function(e,t){var i=4*t,n=i-e.sigBytes%i;e.concat(r.lib.WordArray.random(n-1)).concat(r.lib.WordArray.create([n<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),Ot((function(e,t){var r;e.exports=((r=Ri).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),Ot((function(e,t){var r;e.exports=((r=Ri).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)})),Ot((function(e,t){var r;e.exports=((r=Ri).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib.CipherParams,n=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return i.create({ciphertext:t})}}}(),r.format.Hex)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.BlockCipher,i=e.algo,n=[],s=[],a=[],o=[],d=[],l=[],c=[],u=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,n[r]=p,s[p]=r;var m=e[r],_=e[m],g=e[_],y=257*e[p]^16843008*p;a[r]=y<<24|y>>>8,o[r]=y<<16|y>>>16,d[r]=y<<8|y>>>24,l[r]=y,y=16843009*g^65537*_^257*m^16843008*r,c[p]=y<<24|y>>>8,u[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,r?(r=m^e[e[e[g^m]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=i.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),s=this._keySchedule=[],a=0;a6&&a%r==4&&(l=n[l>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l]):(l=n[(l=l<<8|l>>>24)>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l],l^=p[a/r|0]<<24),s[a]=s[a-r]^l);for(var o=this._invKeySchedule=[],d=0;d>>24]]^u[n[l>>>16&255]]^h[n[l>>>8&255]]^f[n[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,o,d,l,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,c,u,h,f,s),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,s,a,o){for(var d=this._nRounds,l=e[t]^r[0],c=e[t+1]^r[1],u=e[t+2]^r[2],h=e[t+3]^r[3],f=4,p=1;p>>24]^n[c>>>16&255]^s[u>>>8&255]^a[255&h]^r[f++],_=i[c>>>24]^n[u>>>16&255]^s[h>>>8&255]^a[255&l]^r[f++],g=i[u>>>24]^n[h>>>16&255]^s[l>>>8&255]^a[255&c]^r[f++],y=i[h>>>24]^n[l>>>16&255]^s[c>>>8&255]^a[255&u]^r[f++];l=m,c=_,u=g,h=y}m=(o[l>>>24]<<24|o[c>>>16&255]<<16|o[u>>>8&255]<<8|o[255&h])^r[f++],_=(o[c>>>24]<<24|o[u>>>16&255]<<16|o[h>>>8&255]<<8|o[255&l])^r[f++],g=(o[u>>>24]<<24|o[h>>>16&255]<<16|o[l>>>8&255]<<8|o[255&c])^r[f++],y=(o[h>>>24]<<24|o[l>>>16&255]<<16|o[c>>>8&255]<<8|o[255&u])^r[f++],e[t]=m,e[t+1]=_,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(m)}(),r.AES)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib,i=t.WordArray,n=t.BlockCipher,s=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=s.DES=n.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=a[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],s=0;s<16;s++){var l=n[s]=[],c=d[s];for(r=0;r<24;r++)l[r/6|0]|=t[(o[r]-1+c)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(o[r+24]-1+c)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var u=this._invSubKeys=[];for(r=0;r<16;r++)u[r]=n[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],s=this._lBlock,a=this._rBlock,o=0,d=0;d<8;d++)o|=l[d][((a^n[d])&c[d])>>>0];this._lBlock=a,this._rBlock=s^o}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),n=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(i.create(t)),this._des2=u.createEncryptor(i.create(r)),this._des3=u.createEncryptor(i.create(n))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=n._createHelper(p)}(),r.TripleDES)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=i.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var s=0;n<256;n++){var a=n%r,o=t[a>>>2]>>>24-a%4*8&255;s=(s+i[n]+o)%256;var d=i[n];i[n]=i[s],i[s]=d}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var e=this._S,t=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[r],e[r]=s,i|=e[(e[t]+e[r])%256]<<24-8*n}return this._i=t,this._j=r,i}e.RC4=t._createHelper(n);var a=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)s.call(this)}});e.RC4Drop=t._createHelper(a)}(),r.RC4)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],a=[],o=i.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)d.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(t){var s=t.words,a=s[0],o=s[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(n[0]^=l,n[1]^=u,n[2]^=c,n[3]^=h,n[4]^=l,n[5]^=u,n[6]^=c,n[7]^=h,r=0;r<4;r++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,d=((n*n>>>17)+n*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=t._createHelper(o)}(),r.Rabbit)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],a=[],o=i.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var n=0;n<4;n++)d.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var s=t.words,a=s[0],o=s[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(i[0]^=l,i[1]^=u,i[2]^=c,i[3]^=h,i[4]^=l,i[5]^=u,i[6]^=c,i[7]^=h,n=0;n<4;n++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,d=((n*n>>>17)+n*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=t._createHelper(o)}(),r.RabbitLegacy)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.BlockCipher,i=e.algo;const n=16,s=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function d(e,t){let r=t>>24&255,i=t>>16&255,n=t>>8&255,s=255&t,a=e.sbox[0][r]+e.sbox[1][i];return a^=e.sbox[2][n],a+=e.sbox[3][s],a}function l(e,t,r){let i,s=t,a=r;for(let t=0;t1;--t)s^=e.pbox[t],a=d(e,s)^a,i=s,s=a,a=i;return i=s,s=a,a=i,a^=e.pbox[1],s^=e.pbox[0],{left:s,right:a}}function u(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=a[t][r]}let i=0;for(let a=0;a=r&&(i=0);let o=0,d=0,c=0;for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),r=new Uint8Array(r);const n=e.byteLength;let s=5;for(;sn)break;let o=e[s+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=e.slice(s+4+2,s+4+a);let n=new Ii.ModeOfOperation.ctr(t,new Ii.Counter(r));const o=n.decrypt(i);n=null,e.set(o,s+4+2)}s=s+4+a}return e}function Ni(e,t,r){if(e.byteLength<=30)return e;const i=e.slice(32);let n=new Ii.ModeOfOperation.ctr(t,new Ii.Counter(r));const s=n.decrypt(i);return n=null,e.set(s,32),e}Ot((function(e,t){e.exports=Ri}));var $i=Ot((function(e,t){var r,n,s,a=(r=new Date,n=4,s={setLogLevel:function(e){n=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=n&&console.debug("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=n&&console.info("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=n&&console.warn("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=n&&console.error("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}},s);a.getDurationString=function(e,t){var r;function i(e,t){for(var r=(""+e).split(".");r[0].length0){for(var r="",i=0;i0&&(r+=","),r+="["+a.getDurationString(e.start(i))+","+a.getDurationString(e.end(i))+"]";return r}return"(empty)"},t.Log=a;var o=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};o.prototype.getPosition=function(){return this.position},o.prototype.getEndPosition=function(){return this.buffer.byteLength},o.prototype.getLength=function(){return this.buffer.byteLength},o.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},o.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},o.prototype.readAnyInt=function(e,t){var r=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:r=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:r=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";r=this.dataview.getUint8(this.position)<<16,r|=this.dataview.getUint8(this.position+1)<<8,r|=this.dataview.getUint8(this.position+2);break;case 4:r=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";r=this.dataview.getUint32(this.position)<<32,r|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,r}throw"Not enough bytes in buffer"},o.prototype.readUint8=function(){return this.readAnyInt(1,!1)},o.prototype.readUint16=function(){return this.readAnyInt(2,!1)},o.prototype.readUint24=function(){return this.readAnyInt(3,!1)},o.prototype.readUint32=function(){return this.readAnyInt(4,!1)},o.prototype.readUint64=function(){return this.readAnyInt(8,!1)},o.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",r=0;rthis._byteLength&&(this._byteLength=t);else{for(r<1&&(r=1);t>r;)r*=2;var i=new ArrayBuffer(r),n=new Uint8Array(this._buffer);new Uint8Array(i,0,n.length).set(n),this.buffer=i,this._byteLength=t}}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),r=new Uint8Array(this._buffer,0,t.length);t.set(r),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Int32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Int16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Uint32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Uint16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var r=new Float64Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Float32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,r,i,n){var s=new Uint8Array(e,t,n),a=new Uint8Array(r,i,n);s.set(a)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=0;rn;i--,n++){var s=t[n];t[n]=t[i],t[i]=s}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],r=0;r>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},d.prototype.adjustUint32=function(e,t){var r=this.position;this.seek(e),this.writeUint32(t),this.seek(r)},d.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var r=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var r=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var r=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var r=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var r=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=8*e,r},d.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var r=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r};var c=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(c.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,a.debug("MultiBufferStream","Stream ready for parsing"),!0):(a.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(a.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){a.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r.buffer},c.prototype.reduceBuffer=function(e,t,r){var i;return(i=new Uint8Array(r)).set(new Uint8Array(e,t,r)),i.buffer.fileStart=e.fileStart+t,i.buffer.usedBytes=0,i.buffer},c.prototype.insertBuffer=function(e){for(var t=!0,r=0;ri.byteLength){this.buffers.splice(r,1),r--;continue}a.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=i.fileStart||(e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)),a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(r,0,e),0===r&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,n,s)}}t&&(a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===r&&(this.buffer=e))},c.prototype.logBufferLevel=function(e){var t,r,i,n,s,o=[],d="";for(i=0,n=0,t=0;t0&&(d+=s.end-1+"]");var l=e?a.info:a.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+i+"/"+n+" bytes), continuous ranges: "+d)},c.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},c.prototype.findPosition=function(e,t,r){var i,n=null,s=-1;for(i=!0===e?0:this.bufferIndex;i=t?(a.debug("MultiBufferStream","Found position in existing buffer #"+s),s):-1},c.prototype.findEndContiguousBuf=function(e){var t,r,i,n=void 0!==e?e:this.bufferIndex;if(r=this.buffers[n],this.buffers.length>n+1)for(t=n+1;t>3;return 31===i&&r.data.length>=2&&(i=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),i}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};t.MPEG4DescriptorParser=u;var h={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){h.FullBox.prototype=new h.Box,h.ContainerBox.prototype=new h.Box,h.SampleEntry.prototype=new h.Box,h.TrackGroupTypeBox.prototype=new h.FullBox,h.BASIC_BOXES.forEach((function(e){h.createBoxCtor(e)})),h.FULL_BOXES.forEach((function(e){h.createFullBoxCtor(e)})),h.CONTAINER_BOXES.forEach((function(e){h.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,r){this.type=e,this.size=t,this.uuid=r},FullBox:function(e,t,r){h.Box.call(this,e,t,r),this.flags=0,this.version=0},ContainerBox:function(e,t,r){h.Box.call(this,e,t,r),this.boxes=[]},SampleEntry:function(e,t,r,i){h.ContainerBox.call(this,e,t),this.hdr_size=r,this.start=i},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){h.FullBox.call(this,e,t)},createBoxCtor:function(e,t){h.boxCodes.push(e),h[e+"Box"]=function(t){h.Box.call(this,e,t)},h[e+"Box"].prototype=new h.Box,t&&(h[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){h[e+"Box"]=function(t){h.FullBox.call(this,e,t)},h[e+"Box"].prototype=new h.FullBox,h[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,r=0;rr?(a.error("BoxParser","Box of type '"+c+"' has a size "+l+" greater than its container size "+r),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):0!==l&&o+l>e.getEndPosition()?(e.seek(o),a.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):t?{code:h.OK,type:c,size:l,hdr_size:d,start:o}:(h[c+"Box"]?i=new h[c+"Box"](l):"uuid"!==c?(a.warn("BoxParser","Unknown box type: '"+c+"'"),(i=new h.Box(c,l)).has_unparsed_data=!0):h.UUIDBoxes[s]?i=new h.UUIDBoxes[s](l):(a.warn("BoxParser","Unknown uuid type: '"+s+"'"),(i=new h.Box(c,l)).uuid=s,i.has_unparsed_data=!0),i.hdr_size=d,i.start=o,i.write===h.Box.prototype.write&&"mdat"!==i.type&&(a.info("BoxParser","'"+u+"' box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),(n=e.getPosition()-(i.start+i.size))<0?(a.warn("BoxParser","Parsing of box '"+u+"' did not read the entire indicated box data size (missing "+-n+" bytes), seeking forward"),e.seek(i.start+i.size)):n>0&&(a.error("BoxParser","Parsing of box '"+u+"' read "+n+" more bytes than the indicated box data size, seeking backwards"),0!==i.size&&e.seek(i.start+i.size)),{code:h.OK,box:i,size:i.size})},h.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},h.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},h.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.ContainerBox.prototype.parse=function(e){for(var t,r;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},h.SAMPLE_ENTRY_TYPE_VISUAL="Visual",h.SAMPLE_ENTRY_TYPE_AUDIO="Audio",h.SAMPLE_ENTRY_TYPE_HINT="Hint",h.SAMPLE_ENTRY_TYPE_METADATA="Metadata",h.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",h.SAMPLE_ENTRY_TYPE_SYSTEM="System",h.SAMPLE_ENTRY_TYPE_TEXT="Text",h.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},h.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},h.SampleEntry.prototype.parseFooter=function(e){h.ContainerBox.prototype.parse.call(this,e)},h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_HINT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT,"enct"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA,"encm"),h.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var r=0;r<3;r++)this.layer_size[r]=16==t?e.readUint16():e.readUint32()})),h.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),h.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),h.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)a.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void a.error("av1C reserved_2 parsing problem");var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)}else a.error("av1C reserved_1 parsing problem");else a.error("av1C version "+this.version+" not supported")})),h.createBoxCtor("avcC",(function(e){var t,r;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),r=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(r))})),h.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),h.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),h.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),h.createFullBoxCtor("co64",(function(e){var t,r;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(r=0;r>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),h.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),h.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),h.createFullBoxCtor("ctts",(function(e){var t,r;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(r=0;r>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|r>>6&3,this.acmod=r>>3&7,this.lfeon=r>>2&1,this.bit_rate_code=3&r|i>>5&7})),h.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var r=0;r>6,i.bsid=n>>1&31,i.bsmod=(1&n)<<4|s>>4&15,i.acmod=s>>1&7,i.lfeon=1&s,i.num_dep_sub=a>>1&15,i.num_dep_sub>0&&(i.chan_loc=(1&a)<<8|e.readUint8())}})),h.createFullBoxCtor("dfLa",(function(e){var t=[],r=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var i=e.readUint8(),n=Math.min(127&i,r.length-1);if(n?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(r[n]),128&i)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),h.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[r]=e.readString(4),t-=4,r++})),h.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),h.createBoxCtor("hvcC",(function(e){var t,r,i,n;this.configurationVersion=e.readUint8(),n=e.readUint8(),this.general_profile_space=n>>6,this.general_tier_flag=(32&n)>>5,this.general_profile_idc=31&n,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),n=e.readUint8(),this.constantFrameRate=n>>6,this.numTemporalLayers=(13&n)>>3,this.temporalIdNested=(4&n)>>2,this.lengthSizeMinusOne=3&n,this.nalu_arrays=[];var s=e.readUint8();for(t=0;t>7,a.nalu_type=63&n;var o=e.readUint16();for(r=0;r>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var r=0;if(this.version<2)r=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";r=e.readUint32()}for(var i=0;i>7,this.axis=1&t})),h.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),a.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),h.createFullBoxCtor("ipma",(function(e){var t,r;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?a.property_index=(127&s)<<8|e.readUint8():a.property_index=127&s}}})),h.createFullBoxCtor("iref",(function(e){var t,r;for(this.references=[];e.getPosition()>7,i.assignment_type=127&n,i.assignment_type){case 0:i.grouping_type=e.readString(4);break;case 1:i.grouping_type=e.readString(4),i.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:i.sub_track_id=e.readUint32();break;default:a.warn("BoxParser","Unknown leva assignement type")}}})),h.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),h.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),f.prototype.toString=function(){return"("+this.x+","+this.y+")"},h.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new f(e.readUint16(),e.readUint16()),this.display_primaries[1]=new f(e.readUint16(),e.readUint16()),this.display_primaries[2]=new f(e.readUint16(),e.readUint16()),this.white_point=new f(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),h.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),h.createFullBoxCtor("mehd",(function(e){1&this.flags&&(a.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),h.createFullBoxCtor("meta",(function(e){this.boxes=[],h.ContainerBox.prototype.parse.call(this,e)})),h.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),h.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),h.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),h.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),h.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),h.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),h.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var r=0;r0){var t=e.readUint32();this.kid=[];for(var r=0;r0&&(this.data=e.readUint8Array(i))})),h.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),h.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),h.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var r=0;r>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var r=e.readUint8(),i=0;i>7,this.num_leading_samples=127&t})),h.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)a.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=h.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),h.createSampleGroupCtor("stsa",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),h.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),h.createSampleGroupCtor("tsas",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("tscl",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("vipr",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),r=0;r>6,this.sample_depends_on[i]=t>>4&3,this.sample_is_depended_on[i]=t>>2&3,this.sample_has_redundancy[i]=3&t})),h.createFullBoxCtor("senc"),h.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),a.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),r=0;r>31&1,i.referenced_size=2147483647&n,i.subsegment_duration=e.readUint32(),n=e.readUint32(),i.starts_with_SAP=n>>31&1,i.SAP_type=n>>28&7,i.SAP_delta_time=268435455&n}})),h.SingleItemTypeReferenceBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.SingleItemTypeReferenceBox.prototype=new h.Box,h.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var r=0;r>4&15,this.sample_sizes[t+1]=15&i}else if(8===this.field_size)for(t=0;t0)for(r=0;r>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=h.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),h.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),h.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),h.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var r=e.readUint32(),i=0;i>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),h.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),h.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),h.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},h.createTrackGroupCtor("msrc"),h.TrackReferenceTypeBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.TrackReferenceTypeBox.prototype=new h.Box,h.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},h.trefBox.prototype.parse=function(e){for(var t,r;e.getPosition()t&&this.flags&h.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var r=0;r>7&1,this.block_pad_lsb=r>>6&1,this.block_little_endian=r>>5&1,this.block_reversed=r>>4&1,this.pad_unknown=r>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),h.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),h.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),h.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),h.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=h.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),h.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),h.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=h.parseHex16(e)})),h.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),h.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),h.createFullBoxCtor("vvcC",(function(e){var t,r,i={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(i.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,r=this.num_sublayers-2;r>=0;--r){var a=i.extract_bits(1);this.ptl_sublayer_present_mask|=a<1;++r)i.extract_bits(1);for(this.sublayer_level_idc=[],r=this.num_sublayers-2;r>=0;--r)this.ptl_sublayer_present_mask&1<>=1;t+=h.decimalToHex(i,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var n=!1,s="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||n)&&(s="."+h.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+s,n=!0);t+=s}return t},h.vvc1SampleEntry.prototype.getCodec=h.vvi1SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var r="";if(this.vvcC.general_constraint_info){var i,n=[],s=0;for(s|=this.vvcC.ptl_frame_only_constraint<<7,s|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,n.push(s),s&&(i=e),s=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===i)r=".CA";else{r=".C";var a="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",o=0,d=0;for(e=0;e<=i;++e)for(o=o<<8|n[e],d+=8;d>=5;){r+=a[o>>d-5&31],o&=(1<<(d-=5))-1}d&&(r+=a[31&(o<<=5-d)])}}t+=r}return t},h.mp4aSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),r=this.esds.esd.getAudioConfig();return e+"."+h.decimalToHex(t)+(r?"."+r:"")}return e},h.stxtSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},h.vp08SampleEntry.prototype.getCodec=h.vp09SampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var r=this.vpcC.bitDepth;return 8==r&&(r="08"),e+".0"+this.vpcC.profile+"."+t+"."+r},h.av01SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this),r=this.av1C.seq_level_idx_0;return r<10&&(r="0"+r),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+r+(this.av1C.seq_tier_0?"H":"M")+"."+e},h.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),a.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>l?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>l&&e.writeUint64(this.size)},h.FullBox.prototype.writeHeader=function(e){this.size+=4,h.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},h.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},h.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},h.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},h.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},h.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},h.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&h.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&h.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&h.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&h.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[r]instanceof h.Box||t[r]instanceof h.Box||void 0===e[r]||void 0===t[r]||"function"==typeof e[r]||"function"==typeof t[r]||e.subBoxNames&&e.subBoxNames.indexOf(r.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(r.slice(0,4))>-1||"data"===r||"start"===r||"size"===r||"creation_time"===r||"modification_time"===r||h.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(r)>-1||e[r]===t[r]))return!1;return!0},h.boxEqual=function(e,t){if(!h.boxEqualFields(e,t))return!1;for(var r=0;r1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},g.prototype.setExtractionOptions=function(e,t,r){var i=this.getTrackById(e);if(i){var n={};this.extractedTracks.push(n),n.id=e,n.user=t,n.trak=i,i.nextSample=0,n.nb_samples=1e3,n.samples=[],r&&r.nbSamples&&(n.nb_samples=r.nbSamples)}},g.prototype.unsetExtractionOptions=function(e){for(var t=-1,r=0;r-1&&this.extractedTracks.splice(t,1)},g.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=h.parseOneBox(this.stream,false)).code===h.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var r;switch(r="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),r){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[r]&&a.warn("ISOFile","Duplicate Box of type: "+r+", overriding previous occurrence"),this[r]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},g.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(a.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(a.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(a.warn("ISOFile","Not ready to start parsing"),!1))},g.prototype.appendBuffer=function(e,t){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(a.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),r},g.prototype.getInfo=function(){var e,t,r,i,n,s,a={},o=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(a.hasMoov=!0,a.duration=this.moov.mvhd.duration,a.timescale=this.moov.mvhd.timescale,a.isFragmented=null!=this.moov.mvex,a.isFragmented&&this.moov.mvex.mehd&&(a.fragment_duration=this.moov.mvex.mehd.fragment_duration),a.isProgressive=this.isProgressive,a.hasIOD=null!=this.moov.iods,a.brands=[],a.brands.push(this.ftyp.major_brand),a.brands=a.brands.concat(this.ftyp.compatible_brands),a.created=new Date(o+1e3*this.moov.mvhd.creation_time),a.modified=new Date(o+1e3*this.moov.mvhd.modification_time),a.tracks=[],a.audioTracks=[],a.videoTracks=[],a.subtitleTracks=[],a.metadataTracks=[],a.hintTracks=[],a.otherTracks=[],e=0;e0?a.mime+='video/mp4; codecs="':a.audioTracks&&a.audioTracks.length>0?a.mime+='audio/mp4; codecs="':a.mime+='application/mp4; codecs="',e=0;e=r.samples.length)&&(a.info("ISOFile","Sending fragmented data on track #"+i.id+" for samples ["+Math.max(0,r.nextSample-i.nb_samples)+","+(r.nextSample-1)+"]"),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(i.id,i.user,i.segmentStream.buffer,r.nextSample,e||r.nextSample>=r.samples.length),i.segmentStream=null,i!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=r.samples.length)&&(a.debug("ISOFile","Sending samples on track #"+s.id+" for sample "+r.nextSample),this.onSamples&&this.onSamples(s.id,s.user,s.samples),s.samples=[],s!==this.extractedTracks[t]))break}}}},g.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},g.prototype.getBoxes=function(e,t){var r=[];return g._sweep.call(this,e,r,t),r},g._sweep=function(e,t,r){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&r)return;g._sweep.call(this.boxes[i],e,t,r)}},g.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},g.prototype.getTrackSample=function(e,t){var r=this.getTrackById(e);return this.getSample(r,t)},g.prototype.releaseUsedSamples=function(e,t,r){var i=0,n=this.getTrackById(e);n.lastValidSample||(n.lastValidSample=0);for(var s=n.lastValidSample;se*n.timescale){l=i-1;break}t&&n.is_sync&&(d=i)}for(t&&(l=d),e=r.samples[l].cts,r.nextSample=l;r.samples[l].alreadyRead===r.samples[l].size&&r.samples[l+1];)l++;return s=r.samples[l].offset+r.samples[l].alreadyRead,a.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+a.getDurationString(e,o)+" and offset: "+s),{offset:s,time:e/o}},g.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},g.prototype.seek=function(e,t){var r,i,n,s=this.moov,o={offset:1/0,time:1/0};if(this.moov){for(n=0;nthis.getTrackDuration(r)||((i=this.seekTrack(e,t,r)).offset-1){a=d;break}switch(a){case"Visual":if(n.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),s.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var u=new h.avcCBox;u.parse(new o(t.avcDecoderConfigRecord)),s.addBox(u)}else if(t.hevcDecoderConfigRecord){var f=new h.hvcCBox;f.parse(new o(t.hevcDecoderConfigRecord)),s.addBox(f)}break;case"Audio":n.add("smhd").set("balance",t.balance||0),s.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":n.add("hmhd");break;case"Subtitle":if(n.add("sthd"),"stpp"===t.type)s.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:n.add("nmhd")}t.description&&s.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){s.addBox(e)})),n.add("dinf").add("dref").addEntry((new h["url Box"]).set("flags",1));var p=n.add("stbl");return p.add("stsd").addEntry(s),p.add("stts").set("sample_counts",[]).set("sample_deltas",[]),p.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),p.add("stco").set("chunk_offsets",[]),p.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(r),t.id}},h.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},g.prototype.addSample=function(e,t,r){var i=r||{},n={},s=this.getTrackById(e);if(null!==s){n.number=s.samples.length,n.track_id=s.tkhd.track_id,n.timescale=s.mdia.mdhd.timescale,n.description_index=i.sample_description_index?i.sample_description_index-1:0,n.description=s.mdia.minf.stbl.stsd.entries[n.description_index],n.data=t,n.size=t.byteLength,n.alreadyRead=n.size,n.duration=i.duration||1,n.cts=i.cts||0,n.dts=i.dts||0,n.is_sync=i.is_sync||!1,n.is_leading=i.is_leading||0,n.depends_on=i.depends_on||0,n.is_depended_on=i.is_depended_on||0,n.has_redundancy=i.has_redundancy||0,n.degradation_priority=i.degradation_priority||0,n.offset=0,n.subsamples=i.subsamples,s.samples.push(n),s.samples_size+=n.size,s.samples_duration+=n.duration,void 0===s.first_dts&&(s.first_dts=i.dts),this.processSamples();var a=this.createSingleSampleMoof(n);return this.addBox(a),a.computeSize(),a.trafs[0].truns[0].data_offset=a.size+8,this.add("mdat").data=new Uint8Array(t),n}},g.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var r=new h.moofBox;r.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var i=r.add("traf"),n=this.getTrackById(e.track_id);return i.add("tfhd").set("track_id",e.track_id).set("flags",h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),i.add("tfdt").set("baseMediaDecodeTime",e.dts-(n.first_dts||0)),i.add("trun").set("flags",h.TRUN_FLAGS_DATA_OFFSET|h.TRUN_FLAGS_DURATION|h.TRUN_FLAGS_SIZE|h.TRUN_FLAGS_FLAGS|h.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),r},g.prototype.lastMoofIndex=0,g.prototype.samplesDataSize=0,g.prototype.resetTables=function(){var e,t,r,i,n,s;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(d=n[a].grouping_type+"/0",(o=new l(n[a].grouping_type,0)).is_fragment=!0,t.sample_groups_info[d]||(t.sample_groups_info[d]=o))}else for(a=0;a=2&&(d=i[a].grouping_type+"/0",o=new l(i[a].grouping_type,0),e.sample_groups_info[d]||(e.sample_groups_info[d]=o))},g.setSampleGroupProperties=function(e,t,r,i){var n,s;for(n in t.sample_groups=[],i){var a;if(t.sample_groups[n]={},t.sample_groups[n].grouping_type=i[n].grouping_type,t.sample_groups[n].grouping_type_parameter=i[n].grouping_type_parameter,r>=i[n].last_sample_in_run&&(i[n].last_sample_in_run<0&&(i[n].last_sample_in_run=0),i[n].entry_index++,i[n].entry_index<=i[n].sbgp.entries.length-1&&(i[n].last_sample_in_run+=i[n].sbgp.entries[i[n].entry_index].sample_count)),i[n].entry_index<=i[n].sbgp.entries.length-1?t.sample_groups[n].group_description_index=i[n].sbgp.entries[i[n].entry_index].group_description_index:t.sample_groups[n].group_description_index=-1,0!==t.sample_groups[n].group_description_index)a=i[n].fragment_description?i[n].fragment_description:i[n].description,t.sample_groups[n].group_description_index>0?(s=t.sample_groups[n].group_description_index>65535?(t.sample_groups[n].group_description_index>>16)-1:t.sample_groups[n].group_description_index-1,a&&s>=0&&(t.sample_groups[n].description=a.entries[s])):a&&a.version>=2&&a.default_group_description_index>0&&(t.sample_groups[n].description=a.entries[a.default_group_description_index-1])}},g.process_sdtp=function(e,t,r){t&&(e?(t.is_leading=e.is_leading[r],t.depends_on=e.sample_depends_on[r],t.is_depended_on=e.sample_is_depended_on[r],t.has_redundancy=e.sample_has_redundancy[r]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},g.prototype.buildSampleLists=function(){var e,t;for(e=0;ev&&(b++,v<0&&(v=0),v+=s.sample_counts[b]),t>0?(e.samples[t-1].duration=s.sample_deltas[b],e.samples_duration+=e.samples[t-1].duration,B.dts=e.samples[t-1].dts+e.samples[t-1].duration):B.dts=0,a?(t>=w&&(S++,w<0&&(w=0),w+=a.sample_counts[S]),B.cts=e.samples[t].dts+a.sample_offsets[S]):B.cts=B.dts,o?(t==o.sample_numbers[E]-1?(B.is_sync=!0,E++):(B.is_sync=!1,B.degradation_priority=0),l&&l.entries[A].sample_delta+U==t+1&&(B.subsamples=l.entries[A].subsamples,U+=l.entries[A].sample_delta,A++)):B.is_sync=!0,g.process_sdtp(e.mdia.minf.stbl.sdtp,B,B.number),B.degradation_priority=h?h.priority[t]:0,l&&l.entries[A].sample_delta+U==t&&(B.subsamples=l.entries[A].subsamples,U+=l.entries[A].sample_delta),(c.length>0||u.length>0)&&g.setSampleGroupProperties(e,B,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},g.prototype.updateSampleLists=function(){var e,t,r,i,n,s,a,o,d,l,c,u,f,p,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&g.initSampleGroups(u,c,c.sbgps,u.mdia.minf.stbl.sgpds,c.sgpds),t=0;t0?p.dts=u.samples[u.samples.length-2].dts+u.samples[u.samples.length-2].duration:(c.tfdt?p.dts=c.tfdt.baseMediaDecodeTime:p.dts=0,u.first_traf_merged=!0),p.cts=p.dts,_.flags&h.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+_.sample_composition_time_offset[r]),m=a,_.flags&h.TRUN_FLAGS_FLAGS?m=_.sample_flags[r]:0===r&&_.flags&h.TRUN_FLAGS_FIRST_FLAG&&(m=_.first_sample_flags),p.is_sync=!(m>>16&1),p.is_leading=m>>26&3,p.depends_on=m>>24&3,p.is_depended_on=m>>22&3,p.has_redundancy=m>>20&3,p.degradation_priority=65535&m;var y=!!(c.tfhd.flags&h.TFHD_FLAG_BASE_DATA_OFFSET),v=!!(c.tfhd.flags&h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),b=!!(_.flags&h.TRUN_FLAGS_DATA_OFFSET),w=0;w=y?c.tfhd.base_data_offset:v||0===t?l.start:o,p.offset=0===t&&0===r?b?w+_.data_offset:w:o,o=p.offset+p.size,(c.sbgps.length>0||c.sgpds.length>0||u.mdia.minf.stbl.sbgps.length>0||u.mdia.minf.stbl.sgpds.length>0)&&g.setSampleGroupProperties(u,p,p.number_in_traf,c.sample_groups_info)}}if(c.subs){u.has_fragment_subsamples=!0;var S=c.first_sample_index;for(t=0;t-1))return null;var s=(r=this.stream.buffers[n]).byteLength-(i.offset+i.alreadyRead-r.fileStart);if(i.size-i.alreadyRead<=s)return a.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+(i.size-i.alreadyRead)+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,i.size-i.alreadyRead),r.usedBytes+=i.size-i.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead=i.size,i;if(0===s)return null;a.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+s+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,s),i.alreadyRead+=s,r.usedBytes+=s,this.stream.logBufferLevel()}},g.prototype.releaseSample=function(e,t){var r=e.samples[t];return r.data?(this.samplesDataSize-=r.size,r.data=null,r.description=null,delete r.degradation_priority,delete r.depends_on,delete r.description_index,delete r.has_redundancy,delete r.is_depended_on,delete r.is_leading,delete r.is_sync,delete r.moof_number,delete r.number_in_traf,delete r.timescale,delete r.cts,delete r.dts,delete r.offset,delete r.size,delete r.track_id,delete r.duration,r.alreadyRead=0,r.size):0},g.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},g.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},g.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(r.protection=s.ipro.protections[s.iinf.item_infos[e].protection_index-1]),s.iinf.item_infos[e].item_type?r.type=s.iinf.item_infos[e].item_type:r.type="mime",r.content_type=s.iinf.item_infos[e].content_type,r.content_encoding=s.iinf.item_infos[e].content_encoding;if(s.grpl)for(e=0;e0&&h.property_index-1-1))return null;var o=(t=this.stream.buffers[s]).byteLength-(n.offset+n.alreadyRead-t.fileStart);if(!(n.length-n.alreadyRead<=o))return a.debug("ISOFile","Getting item #"+e+" extent #"+i+" partial data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+o+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,o),n.alreadyRead+=o,r.alreadyRead+=o,t.usedBytes+=o,this.stream.logBufferLevel(),null;a.debug("ISOFile","Getting item #"+e+" extent #"+i+" data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+(n.length-n.alreadyRead)+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,n.length-n.alreadyRead),t.usedBytes+=n.length-n.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead+=n.length-n.alreadyRead,n.alreadyRead=n.length}}return r.alreadyRead===r.size?r:null},g.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var r=0;r0?this.moov.traks[e].samples[0].duration:0),t.push(i)}return t},g.prototype.getPerformanceInfo=function(){var e={};return e.moov=this.moov,this.moov&&this.moov.traks&&this.moov.traks.length>1&&(e.moovAudioNum=this.moov.traks[0].samples.length,e.moovVideoNum=this.moov.traks[1].samples.length),e},h.Box.prototype.printHeader=function(e){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},h.FullBox.prototype.printHeader=function(e){this.size+=4,h.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},h.Box.prototype.print=function(e){this.printHeader(e)},h.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},h.tkhdBox.prototype.print=function(e){h.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var y={createFile:function(e,t){var r=void 0===e||e,i=new g(t);return i.discardMdatData=!r,i}};t.createFile=y.createFile}));function Oi(e){return e.reduce(((e,t)=>256*e+t))}function Gi(e){const t=[101,103,119,99],r=e.length-28,i=e.slice(r,r+t.length);return t.every(((e,t)=>e===i[t]))}$i.Log,$i.MP4BoxStream,$i.DataStream,$i.MultiBufferStream,$i.MPEG4DescriptorParser,$i.BoxParser,$i.XMLSubtitlein4Parser,$i.Textin4Parser,$i.ISOFile,$i.createFile;class Hi{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(r+32,r+32+t))]}return null}(t,this.t);if(!r)return e;const i=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(i instanceof Error)return console.error(i.message),this.d=!0,e;this.A=!0,this.u=r[1],Gi(t)&&this.c++,WebAssembly.instantiate(r[2],i).then((e=>{if("function"!=typeof(t=e.instance.exports).parse||"object"!=typeof t.memory)return this.d=!0,void console.error("video_error_3");var t;this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}function Wi(){for(var e=arguments.length,t=new Array(e),r=0;r{const r=new i((0|e.byteLength)+(0|t.byteLength));return r.set(e,0),r.set(t,0|e.byteLength),r}),new i)}const Vi=16,ji=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],qi=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Yi(e){const t=[];for(let r=0,i=e.length;r1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Xi(e){const t=[];for(let r=0,i=e.length;r>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}function Zi(e){const t=[];for(let r=0,i=e.length;r=240&&e[r]<=247?(t.push(String.fromCodePoint(((7&e[r])<<18)+((63&e[r+1])<<12)+((63&e[r+2])<<6)+(63&e[r+3]))),r+=3):e[r]>=224&&e[r]<=239?(t.push(String.fromCodePoint(((15&e[r])<<12)+((63&e[r+1])<<6)+(63&e[r+2]))),r+=2):e[r]>=192&&e[r]<=223?(t.push(String.fromCodePoint(((31&e[r])<<6)+(63&e[r+1]))),r++):t.push(String.fromCodePoint(e[r]));return t.join("")}function Ji(e,t){const r=31&t;return e<>>32-r}function Qi(e){return(255&ji[e>>>24&255])<<24|(255&ji[e>>>16&255])<<16|(255&ji[e>>>8&255])<<8|255&ji[255&e]}function en(e){return e^Ji(e,2)^Ji(e,10)^Ji(e,18)^Ji(e,24)}function tn(e){return e^Ji(e,13)^Ji(e,23)}function rn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[4*t],n[1]=255&e[4*t+1],n[2]=255&e[4*t+2],n[3]=255&e[4*t+3],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];for(let e,t=0;t<32;t+=4)e=i[1]^i[2]^i[3]^r[t+0],i[0]^=en(Qi(e)),e=i[2]^i[3]^i[0]^r[t+1],i[1]^=en(Qi(e)),e=i[3]^i[0]^i[1]^r[t+2],i[2]^=en(Qi(e)),e=i[0]^i[1]^i[2]^r[t+3],i[3]^=en(Qi(e));for(let e=0;e<16;e+=4)t[e]=i[3-e/4]>>>24&255,t[e+1]=i[3-e/4]>>>16&255,t[e+2]=i[3-e/4]>>>8&255,t[e+3]=255&i[3-e/4]}function nn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[0+4*t],n[1]=255&e[1+4*t],n[2]=255&e[2+4*t],n[3]=255&e[3+4*t],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let e,r=0;r<32;r+=4)e=i[1]^i[2]^i[3]^qi[r+0],t[r+0]=i[0]^=tn(Qi(e)),e=i[2]^i[3]^i[0]^qi[r+1],t[r+1]=i[1]^=tn(Qi(e)),e=i[3]^i[0]^i[1]^qi[r+2],t[r+2]=i[2]^=tn(Qi(e)),e=i[0]^i[1]^i[2]^qi[r+3],t[r+3]=i[3]^=tn(Qi(e));if(0===r)for(let e,r=0;r<16;r++)e=t[r],t[r]=t[31-r],t[31-r]=e}function sn(e,t,r){let{padding:i="pkcs#7",mode:n,iv:s=[],output:a="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===n&&("string"==typeof s&&(s=Yi(s)),16!==s.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=Yi(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==r?Xi(e):Yi(e):[...e],("pkcs#5"===i||"pkcs#7"===i)&&0!==r){const t=Vi-e.length%Vi;for(let r=0;r=Vi;){const t=e.slice(u,u+16),i=new Array(16);if("cbc"===n)for(let e=0;e2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let s=new Uint8Array(e.slice(0,5)),a=5;for(;an){const t=new Uint8Array(s.length+e.length-a);t.set(s,0),t.set(e.slice(a),s.length),s=t;break}let l=e[a+4],c=!1,u=2;if(r?(i&&(u=3),l=l>>>1&63,c=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(l)):(l&=31,c=1===l||5===l),c){const r=sn(e.slice(a+4+u,a+4+d),t,0,{padding:"none",output:"array"});let i=r[r.length-1];if(i>0&&i<16){let e=!0;for(let t=1;t<=i;t++)if(r[r.length-t]!==i){e=!1;break}e&&r.splice(r.length-i,i)}const n=new Uint8Array(u);n.set(e.slice(a+4,a+4+u),0);const o=tr(Wi(n,new Uint8Array(r))),l=new Uint8Array(s.length+o.length);l.set(s,0),l.set(o,s.length),s=l}else{const t=e.slice(a+4,a+4+d),r=new Uint8Array(s.length+4+t.length);r.set(s,0),r.set(o,s.length),r.set(t,s.length+4),s=r}a=a+4+d}return s}const dn={init:0,findFirstStartCode:1,findSecondStartCode:2};class ln extends class{on(e,t,r){const i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:r}),this}once(e,t,r){const i=this;function n(){i.off(e,n);for(var s=arguments.length,a=new Array(s),o=0;o1?r-1:0),n=1;n{delete r[e]})),void delete this.e;const i=r[e],n=[];if(i&&t)for(let e=0,r=i.length;e=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=dn.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==dn.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=dn.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==dn.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=dn.findFirstStartCode}}}}function cn(e,t,r){for(let i=2;i3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let s=5;for(;sn)break;let o=e[s+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=cn(e.slice(s+4,s+4+a),t,r);e.set(i,s+4)}s=s+4+a}return e}function fn(){for(var e=arguments.length,t=new Array(e),r=0;re+t.byteLength),0));let n=0;return t.forEach((e=>{i.set(e,n),n+=e.byteLength})),i}class pn{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,r,i)));e.addEventListener(t,r,i);const n=()=>{lr(e.removeEventListener)&&e.removeEventListener(t,r,i)};return this.destroys.push(n),n}destroy(){this.master.debugLog("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class mn{static init(){mn.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in mn.types)mn.types.hasOwnProperty(e)&&(mn.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=mn.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,r=null,i=Array.prototype.slice.call(arguments,1),n=i.length;for(let e=0;e>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r.set(e,4);let s=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return mn.box(mn.types.trak,mn.tkhd(e),mn.mdia(e))}static tkhd(e){let t=e.id,r=e.duration,i=e.presentWidth,n=e.presentHeight;return mn.box(mn.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>>8&255,255&i,0,0,n>>>8&255,255&n,0,0]))}static mdia(e){return mn.box(mn.types.mdia,mn.mdhd(e),mn.hdlr(e),mn.minf(e))}static mdhd(e){let t=e.timescale,r=e.duration;return mn.box(mn.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?mn.constants.HDLR_AUDIO:mn.constants.HDLR_VIDEO,mn.box(mn.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?mn.box(mn.types.smhd,mn.constants.SMHD):mn.box(mn.types.vmhd,mn.constants.VMHD),mn.box(mn.types.minf,t,mn.dinf(),mn.stbl(e))}static dinf(){return mn.box(mn.types.dinf,mn.box(mn.types.dref,mn.constants.DREF))}static stbl(e){return mn.box(mn.types.stbl,mn.stsd(e),mn.box(mn.types.stts,mn.constants.STTS),mn.box(mn.types.stsc,mn.constants.STSC),mn.box(mn.types.stsz,mn.constants.STSZ),mn.box(mn.types.stco,mn.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.mp3(e)):mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.mp4a(e)):"avc"===e.videoType?mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.avc1(e)):mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.hvc1(e))}static mp3(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return mn.box(mn.types[".mp3"],i)}static mp4a(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return mn.box(mn.types.mp4a,i,mn.esds(e))}static esds(e){let t=e.config||[],r=t.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(t).concat([6,1,2]));return mn.box(mn.types.esds,i)}static avc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return mn.box(mn.types.avc1,n,mn.box(mn.types.avcC,t))}static hvc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return mn.box(mn.types.hvc1,n,mn.box(mn.types.hvcC,t))}static mvex(e){return mn.box(mn.types.mvex,mn.trex(e))}static trex(e){let t=e.id,r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return mn.box(mn.types.trex,r)}static moof(e,t){return mn.box(mn.types.moof,mn.mfhd(e.sequenceNumber),mn.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return mn.box(mn.types.mfhd,t)}static traf(e,t){let r=e.id,i=mn.box(mn.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),n=mn.box(mn.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),s=mn.sdtp(e),a=mn.trun(e,s.byteLength+16+16+8+16+8+8);return mn.box(mn.types.traf,i,n,a,s)}static sdtp(e){let t=new Uint8Array(5),r=e.flags;return t[4]=r.isLeading<<6|r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy,mn.box(mn.types.sdtp,t)}static trun(e,t){let r=new Uint8Array(28);t+=36,r.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let i=e.duration,n=e.size,s=e.flags,a=e.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12),mn.box(mn.types.trun,r)}static mdat(e){return mn.box(mn.types.mdat,e)}}mn.init();var _n,gn=Ot((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}));(_n=gn)&&_n.__esModule&&Object.prototype.hasOwnProperty.call(_n,"default")&&_n.default;const yn=[44100,48e3,32e3,0],vn=[22050,24e3,16e3,0],bn=[11025,12e3,8e3,0],wn=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],Sn=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],En=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];function An(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),r=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let i=t[1]>>>3&3,n=(6&t[1])>>1,s=(240&t[2])>>>4,a=(12&t[2])>>>2,o=3!==(t[3]>>>6&3)?2:1,d=0,l=0;switch(i){case 0:d=bn[a];break;case 2:d=vn[a];break;case 3:d=yn[a]}switch(n){case 1:s=e[n]&&t=6?(i=5,t=new Array(4),a=n-3):(i=2,t=new Array(2),a=n):-1!==o.indexOf("android")?(i=2,t=new Array(2),a=n):(i=5,a=n,t=new Array(4),n>=6?a=n-3:1===s&&(i=2,t=new Array(2),a=n)),t[0]=i<<3,t[0]|=(15&n)>>>1,t[1]=(15&n)<<7,t[1]|=(15&s)<<3,5===i&&(t[1]|=(15&a)>>>1,t[2]=(1&a)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=Nn[n],this.sampling_index=n,this.channel_count=s,this.object_type=i,this.original_object_type=r,this.codec_mimetype="mp4a.40."+i,this.original_codec_mimetype="mp4a.40."+r}}class Gn{constructor(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}get bitsAvailable(){return this.bitLength-this.index}skipBits(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}getBits(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>i,s=8-i;if(s>=e)return r&&(this.index+=e),n>>s-e;{r&&(this.index+=s);const i=e-s;return n<>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}function Hn(e){return e[3]|e[2]<<8|e[1]<<16|e[0]<<24}const Wn=new Array(214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72),Vn=new Array(2746333894,1453994832,1736282519,2993693404),jn=new Array(462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257);function qn(e,t,r,i,n){var s=n;s=t+n>e.length&&i+n<=r.length?e.length-t:i+n>r.length&&t+n<=e.length?r.length-i:t+n<=e.length&&i+n<=r.length?n:r.length>24&255,e>>16&255,e>>8&255,255&e)}function Kn(e,t){return t+3>>19)^(i<<23|i>>>9)}function Jn(e,t){var r=new Array(36);r[0]=Kn(t,0),r[1]=Kn(t,4),r[2]=Kn(t,8),r[3]=Kn(t,12);for(var i=0;i<32;i++)r[i+4]=r[i]^Qn(r[i+1]^r[i+2]^r[i+3]^e[i]);var n=new Array(4);for(i=35;i>=32;i--)n[35-i]=r[i];var s=function(e){for(var t=new Array(4*e.length),r=0;r>>30)^(i<<10|i>>>22)^(i<<18|i>>>14)^(i<<24|i>>>8)}function es(e,t,r){if(null==e||null==e||e.length%16!=0)return console.log("sm4 key is error!"),null;if(null==r||null==r||r.length<=0)return console.log("cipher is error!"),null;if(null==t||null==t||t.length%16!=0)return console.log("iv is error!"),null;for(var i=Xn(e),n=Math.ceil(r.length/16),s=new Array(r.length),a=t.slice(),o=0;o3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t=new Uint8Array(t),r=new Uint8Array(r);const s=e.byteLength;let a=5;for(;as)break;let d=e[a+4],l=!1,c=2;if(i?(n&&(c=3),d=d>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(d)):(d&=31,l=1===d||5===d),l){const i=es(t,r,e.slice(a+4+c,a+4+o));e.set(i,a+4+c)}a=a+4+o}return e}Date.now||(Date.now=function(){return(new Date).getTime()});const rs=[];rs.push(a({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support")&&-1===e.indexOf("illegal icc")&&!e.indexOf("If you want to help, upload a sample of this file to")&&!e.indexOf("Reserved SBR extensions is not implemented"))})(e)||console.warn("JbPro[❌❌❌][worker]:",e)}}),s({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support, using thread emulation"))})(e)||console.warn("JbPro[❌❌❌][worker]:",e)}})),Promise.all(rs).then((e=>{const t=e[0];!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[],n=[],s=null,a=null,o=null,d=null,l=null,c=null,u=!1,h=null,f=null,S=!1,E=!1,x=!!gr(r),Se=0,Ee=0,je=!1,Je=null,Qe=null,tt=null,it=[],ut=null,At=null,Ut=0,Tt=0,$t=null,Ot=null,Gt=0,Ht=0,Wt=!1,Kt=!1,Qt=!1,sr=null,wr=null,Sr=!1,Er=!0,Ar=()=>{const e=mr();return{debug:e.debug,debugLevel:e.debugLevel,debugUuid:e.debugUuid,useOffscreen:e.useOffscreen,useWCS:e.useWCS,useMSE:e.useMSE,videoBuffer:e.videoBuffer,videoBufferDelay:e.videoBufferDelay,openWebglAlignment:e.openWebglAlignment,playType:e.playType,hasAudio:e.hasAudio,hasVideo:e.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:e.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:e.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:0,networkDelay:e.networkDelay,visibility:!0,useSIMD:e.useSIMD,isRecording:!1,recordType:e.recordType,isNakedFlow:e.isNakedFlow,checkFirstIFrame:e.checkFirstIFrame,audioBufferSize:1024,isM7sCrypto:e.isM7sCrypto,m7sCryptoAudio:e.m7sCryptoAudio,cryptoKey:e.cryptoKey,cryptoIV:e.cryptoIV,isSm4Crypto:e.isSm4Crypto,isSm4CryptoH265V2:e.isSm4CryptoH265V2,sm4CryptoKey:e.sm4CryptoKey,isXorCrypto:e.isXorCrypto,isHls265:!1,isFlv:e.isFlv,isFmp4:e.isFmp4,isMpeg4:e.isMpeg4,isTs:e.isTs,isFmp4Private:e.isFmp4Private,isEmitSEI:e.isEmitSEI,isRecordTypeFlv:!1,isWasmMp4:!1,isChrome:!1,isFirefox:!1,isDropSameTimestampGop:e.isDropSameTimestampGop,mseDecodeAudio:e.mseDecodeAudio,wcsDecodeAudio:e.wcsDecodeAudio,nakedFlowH265DemuxUseNew:e.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:e.mseDecoderUseWorker,mseAutoCleanupSourceBuffer:e.mseAutoCleanupSourceBuffer,mseAutoCleanupMaxBackwardDuration:e.mseAutoCleanupMaxBackwardDuration,mseAutoCleanupMinBackwardDuration:e.mseAutoCleanupMinBackwardDuration,mseCorrectTimeDuration:e.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:e.mseCorrectAudioTimeDuration,nakedFlowDemuxUseNew:e.nakedFlowDemuxUseNew,nakedFlowFps:e.nakedFlowFps,supportMSEDecodeHevc:!1}};"VideoEncoder"in self&&(s={hasInit:!1,isEmitInfo:!1,offscreenCanvas:null,offscreenCanvasCtx:null,decoder:null,init(){s.decoder=new VideoDecoder({output:function(e){if(lr(e.createImageBitmap))e.createImageBitmap().then((t=>{s.offscreenCanvasCtx.drawImage(t,0,0,e.codedWidth,e.codedHeight);let r=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:r,delay:si.delay,ts:0},[r]),hr(e)}));else{s.offscreenCanvasCtx.drawImage(e,0,0,e.codedWidth,e.codedHeight);let t=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:t,delay:si.delay,ts:0},[t]),hr(e)}},error:function(e){si.debugError("worker","VideoDecoder error: ",e,e.toString())}})},destroy(){s.reset(),s.decoder&&"closed"!==s.decoder.state&&(s.decoder.close(),s.decoder=null)},decode:function(e,t,r){const i=e[0]>>4==1;if(s.hasInit){const r=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:i?pt:mt});s.decoder.decode(r)}else if(i&&0===e[1]){const t=15&e[0];postMessage({cmd:R,code:t});const r=new Uint8Array(e);postMessage({cmd:M,buffer:r,codecId:t},[r.buffer]);let i=null,n=null;const a=e.slice(5);t===Ie?(n=kr(a),i={codec:n.codec,description:a}):t===Re&&(n=Vr(a),i={codec:n.codec,description:a}),n&&n.codecWidth&&n.codecHeight&&(i.codedHeight=n.codecHeight,i.codedWidth=n.codecWidth),s.isEmitInfo||(si.debugLog("worker","Webcodecs Video Decoder initSize"),postMessage({cmd:k,w:n.codecWidth,h:n.codecHeight}),s.isEmitInfo=!0,s.offscreenCanvas=new OffscreenCanvas(n.codecWidth,n.codecHeight),s.offscreenCanvasCtx=s.offscreenCanvas.getContext("2d"));try{s.decoder.configure(i),s.hasInit=!0}catch(e){si.debugError("worker","VideoDecoder configure error",e.code,e,e.toString()),e.toString()}}else si.debugWarn("worker",`VideoDecoder configure has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)},reset(){s.hasInit=!1,s.isEmitInfo=!1,s.offscreenCanvas=null,s.offscreenCanvasCtx=null}});let Tr=function(){if(Sr=!0,a)try{a.abort(),a=null,si.debugLog("worker","abort success")}catch(e){a=null,si.debugLog("worker","abort catch",e)}},Or={init(){Or.lastBuf=null,Or.vps=null,Or.sps=null,Or.pps=null,Or.streamType=null,Or.localDts=0,Or.pendingUnits={},Or.isSendSeqHeader=!1},destroy(){Or.lastBuf=null,Or.vps=null,Or.sps=null,Or.pps=null,Or.streamType=null,Or.localDts=0,Or.pendingUnits={},Or.isSendSeqHeader=!1},dispatch(e){const t=new Uint8Array(e);if(si._opt.nakedFlowDemuxUseNew){const e=Or.extractNALu$3(t);if(0===e.length)return void si.debugLog("worker","dispatch naluArray length is 0");Or.handleVideoFrames(e)}else Or.extractNALu$2(t)},getNaluDts(){const e=si._opt.nakedFlowFps;let t=Or.localDts;return Or.localDts=Or.localDts+parseInt(1e3/e,10),t},getNaluAudioDts(){const e=si._opt.sampleRate,t=si._opt.audioBufferSize;return Or.localDts+parseInt(t/e*1e3)},extractNALu(e){let t,r,i=0,n=e.byteLength,s=0,a=[];for(;i1)for(let e=0;e{const t=Fr(e);t===Ve||t===We?Or.handleVideoH264Nalu(e):Rr(t)&&i.push(e)})),1===i.length)Or.handleVideoH264Nalu(i[0]);else if(zr(i)){const e=Fr(i[0]),t=Mr(e);Or.handleVideoH264NaluList(i,t,e)}else i.forEach((e=>{Or.handleVideoH264Nalu(e)}))}else if(Or.streamType===Ne)if(si._opt.nakedFlowH265DemuxUseNew){const t=Or.handleAddNaluStartCode(e),r=Or.extractNALu(t);if(0===r.length)return void si.debugWarn("worker","handleVideoNalu","h265 naluList.length === 0");const i=[];if(r.forEach((e=>{const t=Xr(e);t===lt||t===ot||t===st?Or.handleVideoH265Nalu(e):Jr(t)&&i.push(e)})),1===i.length)Or.handleVideoH265Nalu(i[0]);else if(ei(i)){const e=Xr(i[0]),t=Qr(e);Or.handleVideoH265NaluList(i,t,e)}else i.forEach((e=>{Or.handleVideoH265Nalu(e)}))}else Xr(e)===lt?Or.extractH265PPS(e):Or.handleVideoH265Nalu(e)},extractH264PPS(e){const t=Or.handleAddNaluStartCode(e);Or.extractNALu(t).forEach((e=>{Ir(Fr(e))?Or.extractH264SEI(e):Or.handleVideoH264Nalu(e)}))},extractH265PPS(e){const t=Or.handleAddNaluStartCode(e);Or.extractNALu(t).forEach((e=>{Zr(Xr(e))?Or.extractH265SEI(e):Or.handleVideoH265Nalu(e)}))},extractH264SEI(e){const t=Or.handleAddNaluStartCode(e);Or.extractNALu(t).forEach((e=>{Or.handleVideoH264Nalu(e)}))},extractH265SEI(e){const t=Or.handleAddNaluStartCode(e);Or.extractNALu(t).forEach((e=>{Or.handleVideoH265Nalu(e)}))},handleAddNaluStartCode(e){const t=[0,0,0,1],r=new Uint8Array(e.length+t.length);return r.set(t),r.set(e,t.length),r},handleVideoH264Nalu(e){const t=Fr(e);switch(t){case We:Or.sps=e;break;case Ve:Or.pps=e}if(Or.isSendSeqHeader){if(Or.sps&&Or.pps){const e=Cr({sps:Or.sps,pps:Or.pps}),t=Or.localDts;si.decode(e,{type:oe,ts:t,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null}if(Rr(t)){const r=Mr(t),i=Or.getNaluDts(),n=Pr(e,r);Or.doDecode(n,{type:oe,ts:i,isIFrame:r,cts:0})}}else if(Or.sps&&Or.pps){Or.isSendSeqHeader=!0;const e=Cr({sps:Or.sps,pps:Or.pps});si.decode(e,{type:oe,ts:0,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null}},handleVideoH264NaluList(e,t,r){if(Or.isSendSeqHeader){const i=Or.getNaluDts(),n=Lr(e.reduce(((e,t)=>{const r=tr(e),i=tr(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);Or.doDecode(n,{type:oe,ts:i,isIFrame:t,cts:0}),si.debugLog("worker",`handleVideoH264NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},handleVideoH265Nalu(e){const t=Xr(e);switch(t){case st:Or.vps=e;break;case ot:Or.sps=e;break;case lt:Or.pps=e}if(Or.isSendSeqHeader){if(Or.vps&&Or.sps&&Or.pps){const e=qr({vps:Or.vps,sps:Or.sps,pps:Or.pps}),t=Or.localDts;si.decode(e,{type:oe,ts:t,isIFrame:!0,cts:0}),Or.vps=null,Or.sps=null,Or.pps=null}if(Jr(t)){const r=Qr(t),i=Or.getNaluDts(),n=Yr(e,r);Or.doDecode(n,{type:oe,ts:i,isIFrame:r,cts:0})}}else if(Or.vps&&Or.sps&&Or.pps){Or.isSendSeqHeader=!0;const e=qr({vps:Or.vps,sps:Or.sps,pps:Or.pps});si.decode(e,{type:oe,ts:0,isIFrame:!0,cts:0}),Or.vps=null,Or.sps=null,Or.pps=null}},handleVideoH265NaluList(e,t,r){if(Or.isSendSeqHeader){const i=Or.getNaluDts(),n=Kr(e.reduce(((e,t)=>{const r=tr(e),i=tr(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);Or.doDecode(n,{type:oe,ts:i,isIFrame:t,cts:0}),si.debugLog("worker",`handleVideoH265NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},doDecode(e,t){si.calcNetworkDelay(t.ts),t.isIFrame&&si.calcIframeIntervalTimestamp(t.ts),si.decode(e,t)},handleVideoFrames(e){if(!Or.streamVideoType)for(let t of e)if(Or.streamVideoType=cr(t),Or.streamVideoType)break;Or.streamVideoType?Or.streamVideoType===ze?Or.handleVideoH264Frames(e):this.streamVideoType===Ne&&Or.handleVideoH265Frames(e):si.debugWarn("worker","handleVideoFrames","streamVideoType is null")},handleVideoH264Frames(e){let t=[],r=[],i=!1,n=!1;Or.pendingUnits.units&&(t=Or.pendingUnits.units,n=Or.pendingUnits.vcl,i=Or.pendingUnits.iFrame,Or.pendingUnits={});let s={};for(let a of e){if(a.byteLength<4)continue;const e=Fr(a);let o=!1,d=e===Ye;e!==qe&&e!==Ye||(s=Or.parseVideo264Header(a),o=!0),t.length&&n&&(s.isfms||!o)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,n=!1),t.push(a),i=i||d,n=n||o}t.length&&(Or.pendingUnits={units:t,vcl:n,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,n=null;if(t.forEach((e=>{const t=31&e[0];switch(t){case Ve:Or.pps=e;break;case We:Or.sps=e;break;case Ke:n=e}if(Rr(t)){const t=tr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Or.isSendSeqHeader&&Or.sps&&Or.pps){Or.isSendSeqHeader=!0;const e=Dr({sps:Or.sps,pps:Or.pps});si.decode(e,{type:oe,ts:0,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null}if(Or.isSendSeqHeader){if(Or.sps&&Or.pps){const e=Dr({sps:Or.sps,pps:Or.pps}),t=Or.localDts;si.decode(e,{type:oe,ts:t,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null}if(i){const e=Or.getNaluDts(),t=Lr(i,r);si._opt.isEmitSEI&&n&&postMessage({cmd:Z,buffer:n,ts:e},[n.buffer]),Or.doDecode(t,{type:oe,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames(e){let t=[],r=[],i=!1,n=!1;Or.pendingUnits.units&&(t=Or.pendingUnits.units,n=Or.pendingUnits.vcl,i=Or.pendingUnits.iFrame,Or.pendingUnits={});let s={};for(let a of e){if(a.byteLength<4)continue;const e=Xr(a);let o=!1,d=Qr(e);Jr(e)&&(s=this.parseVideo265Header(a),o=!0),t.length&&n&&(s.isfms||!o)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,n=!1),t.push(a),i=i||d,n=n||o}t.length&&(Or.pendingUnits={units:t,vcl:n,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,n=null;if(t.forEach((e=>{const t=e[0]>>>1&63;switch(t){case lt:Or.pps=e;break;case ot:Or.sps=e;break;case st:Or.vps=e;break;case ft:case ht:n=e}if(Jr(t)){const t=tr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Or.isSendSeqHeader&&Or.sps&&Or.pps&&Or.vps){Or.isSendSeqHeader=!0;const e=qr({sps:Or.sps,pps:Or.pps,vps:Or.vps});si.decode(e,{type:oe,ts:0,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null,Or.vps=null}if(Or.isSendSeqHeader){if(Or.sps&&Or.pps&&Or.vps){const e=qr({sps:Or.sps,pps:Or.pps,vps:Or.vps}),t=Or.localDts;si.decode(e,{type:oe,ts:t,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null,Or.vps=null}if(i){const e=Or.getNaluDts(),t=Kr(i,r);si._opt.isEmitSEI&&n&&postMessage({cmd:Z,buffer:n,ts:e},[n.buffer]),Or.doDecode(t,{type:oe,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames_1(e){e.forEach((e=>{Or.handleVideoNalu(e)}))},parseVideo264Header(e){const t=new Gn(e);return t.readUByte(),{isfms:0===t.readUEG(),sType:t.readUEG()}},parseVideo265Header(e){const t=new Gn(e);return t.readUByte(),{nalType:t.readBits(6),isfms:0===t.readBits(1),sType:t.readBits(3)}}},Gr={LOG_NAME:"worker fmp4Demuxer",mp4Box:null,offset:0,videoTrackId:null,audioTrackId:null,isHevc:!1,listenMp4Box(){Gr.mp4Box=$i.createFile(),Gr.mp4Box.onReady=Gr.onReady,Gr.mp4Box.onError=Gr.onError,Gr.mp4Box.onSamples=Gr.onSamples},initTransportDescarmber(){Gr.transportDescarmber=new Hi},_getSeqHeader(e){const t=Gr.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new $i.DataStream(void 0,0,$i.DataStream.BIG_ENDIAN);let r=[];e.avcC?(e.avcC.write(t),r=[23,0,0,0,0]):(Gr.isHevc=!0,si.isHevc=!0,e.hvcC.write(t),r=[28,0,0,0,0]);const i=new Uint8Array(t.buffer,8),n=new Uint8Array(r.length+i.length);return n.set(r,0),n.set(i,r.length),n}return null},onReady(e){si.debugLog(Gr.LOG_NAME,"onReady()");const t=e.videoTracks[0],r=e.audioTracks[0];if(t){Gr.videoTrackId=t.id;const e=Gr._getSeqHeader(t);e&&(si.debugLog(Gr.LOG_NAME,"seqHeader"),si.decodeVideo(e,0,!0,0)),Gr.mp4Box.setExtractionOptions(t.id)}if(r&&si._opt.hasAudio){Gr.audioTrackId=r.id;const e=r.audio||{},t=Vt.indexOf(e.sample_rate),i=r.codec.replace("mp4a.40.","");Gr.mp4Box.setExtractionOptions(r.id);const n=jt({profile:parseInt(i,10),sampleRate:t,channel:e.channel_count});si.debugLog(Gr.LOG_NAME,"aacADTSHeader"),si.decodeAudio(n,0)}Gr.mp4Box.start()},onError(e){si.debugError(Gr.LOG_NAME,"mp4Box onError",e)},onSamples(e,t,r){if(e===Gr.videoTrackId){for(const e of r){const t=e.data,r=e.is_sync,i=1e3*e.cts/e.timescale;e.duration,e.timescale,r&&si.calcIframeIntervalTimestamp(i);let n=null;n=Gr.isHevc?Kr(t,r):Lr(t,r),si.decode(n,{type:oe,ts:i,isIFrame:r,cts:0})}Gr.mp4Box.removeUsedSamples(e)}else if(e===Gr.audioTrackId){if(si._opt.hasAudio){for(const e of r){const t=e.data,r=1e3*e.cts/e.timescale;e.duration,e.timescale;const i=new Uint8Array(t.byteLength+2);i.set([175,1],0),i.set(t,2),si.decode(i,{type:ae,ts:r,isIFrame:!1,cts:0})}Gr.mp4Box.removeUsedSamples(e)}}else si.debugWarn(Gr.LOG_NAME,"onSamples() trackId error",e)},dispatch(e){let t=new Uint8Array(e);Gr.transportDescarmber&&(t=Gr.transportDescarmber.transport(t)),t.buffer.fileStart=Gr.offset,Gr.offset+=t.byteLength,Gr.mp4Box.appendBuffer(t.buffer)},destroy(){Gr.mp4Box&&(Gr.mp4Box.stop(),Gr.mp4Box.flush(),Gr.mp4Box.destroy(),Gr.mp4Box=null),Gr.transportDescarmber&&(Gr.transportDescarmber.destroy(),Gr.transportDescarmber=null),Gr.offset=0,Gr.videoTrackId=null,Gr.audioTrackId=null,Gr.isHevc=!1}},jr={LOG_NAME:"worker mpeg4Demuxer",lastBuffer:new Uint8Array(0),parsedOffset:0,firstStartCodeOffset:0,secondStartCodeOffset:0,state:"init",hasInitVideoCodec:!1,localDts:0,dispatch(e){const t=new Uint8Array(e);jr.extractNALu(t)},destroy(){jr.lastBuffer=new Uint8Array(0),jr.parsedOffset=0,jr.firstStartCodeOffset=0,jr.secondStartCodeOffset=0,jr.state="init",jr.hasInitVideoCodec=!1,jr.localDts=0},extractNALu(e){if(!e||e.byteLength<1)return void si.debugWarn(jr.LOG_NAME,"extractNALu() buffer error",e);const t=new Uint8Array(jr.lastBuffer.length+e.length);for(t.set(jr.lastBuffer,0),t.set(new Uint8Array(e),jr.lastBuffer.length),jr.lastBuffer=t;;){if("init"===jr.state){let e=!1;for(;jr.lastBuffer.length-jr.parsedOffset>=4;)if(0===jr.lastBuffer[jr.parsedOffset])if(0===jr.lastBuffer[jr.parsedOffset+1])if(1===jr.lastBuffer[jr.parsedOffset+2]){if(182===jr.lastBuffer[jr.parsedOffset+3]){jr.state="findFirstStartCode",jr.firstStartCodeOffset=jr.parsedOffset,jr.parsedOffset+=4,e=!0;break}jr.parsedOffset++}else jr.parsedOffset++;else jr.parsedOffset++;else jr.parsedOffset++;if(e)continue;break}if("findFirstStartCode"===jr.state){let e=!1;for(;jr.lastBuffer.length-jr.parsedOffset>=4;)if(0===jr.lastBuffer[jr.parsedOffset])if(0===jr.lastBuffer[jr.parsedOffset+1])if(1===jr.lastBuffer[jr.parsedOffset+2]){if(182===jr.lastBuffer[jr.parsedOffset+3]){jr.state="findSecondStartCode",jr.secondStartCodeOffset=jr.parsedOffset,jr.parsedOffset+=4,e=!0;break}jr.parsedOffset++}else jr.parsedOffset++;else jr.parsedOffset++;else jr.parsedOffset++;if(e)continue;break}if("findSecondStartCode"===jr.state){if(!(jr.lastBuffer.length-jr.parsedOffset>0))break;{let e,t,r=192&jr.lastBuffer[jr.parsedOffset];e=0==r?jr.secondStartCodeOffset-14:jr.secondStartCodeOffset;let i=0==(192&jr.lastBuffer[jr.firstStartCodeOffset+4]);if(i){if(jr.firstStartCodeOffset-14<0)return void si.debugWarn(jr.LOG_NAME,"firstStartCodeOffset -14 is",jr.firstStartCodeOffset-14);jr.hasInitVideoCodec||(jr.hasInitVideoCodec=!0,si.debugLog(jr.LOG_NAME,"setCodec"),oi.setCodec(Me,"")),t=jr.lastBuffer.subarray(jr.firstStartCodeOffset-14,e)}else t=jr.lastBuffer.subarray(jr.firstStartCodeOffset,e);let n=jr.getNaluDts();jr.hasInitVideoCodec?(postMessage({cmd:O,type:xe,value:t.byteLength}),postMessage({cmd:O,type:Te,value:n}),Se=n,oi.decode(t,i?1:0,n)):si.debugWarn(jr.LOG_NAME,"has not init video codec"),jr.lastBuffer=jr.lastBuffer.subarray(e),jr.firstStartCodeOffset=0==r?14:0,jr.parsedOffset=jr.firstStartCodeOffset+4,jr.state="findFirstStartCode"}}}},getNaluDts(){let e=jr.localDts;return jr.localDts=jr.localDts+40,e}},ii={TAG_NAME:"worker TsLoaderV2",first_parse_:!0,tsPacketSize:0,syncOffset:0,pmt_:null,config_:null,media_info_:new $n,timescale_:90,duration_:0,pat_:{version_number:0,network_pid:0,program_map_pid:{}},current_program_:null,current_pmt_pid_:-1,program_pmt_map_:{},pes_slice_queues_:{},section_slice_queues_:{},video_metadata_:{vps:null,sps:null,pps:null,details:null},audio_metadata_:{codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},last_pcr_:null,audio_last_sample_pts_:void 0,aac_last_incomplete_data_:null,has_video_:!1,has_audio_:!1,video_init_segment_dispatched_:!1,audio_init_segment_dispatched_:!1,video_metadata_changed_:!1,audio_metadata_changed_:!1,loas_previous_frame:null,video_track_:{type:"video",id:1,sequenceNumber:0,samples:[],length:0},audio_track_:{type:"audio",id:2,sequenceNumber:0,samples:[],length:0},_remainingPacketData:null,init(){},destroy(){ii.media_info_=null,ii.pes_slice_queues_=null,ii.section_slice_queues_=null,ii.video_metadata_=null,ii.audio_metadata_=null,ii.aac_last_incomplete_data_=null,ii.video_track_=null,ii.audio_track_=null,ii._remainingPacketData=null},probe(e){let t=new Uint8Array(e),r=-1,i=188;if(t.byteLength<=3*i)return{needMoreData:!0};for(;-1===r;){let e=Math.min(1e3,t.byteLength-3*i);for(let n=0;n=4&&(r-=4),{match:!0,consumed:0,ts_packet_size:i,sync_offset:r})},_initPmt:()=>({program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}),dispatch(e){ii._remainingPacketData&&(e=fn(ii._remainingPacketData,e),ii._remainingPacketData=null);let t=e.buffer;const r=ii.parseChunks(t);r?ii._remainingPacketData=e.subarray(r):e.length>>6;r[1];let s=(31&r[1])<<8|r[2],a=(48&r[3])>>>4,o=15&r[3],d=!(!ii.pmt_||ii.pmt_.pcr_pid!==s),l={},c=4;if(2==a||3==a){let e=r[4];if(e>0&&(d||3==a)&&(l.discontinuity_indicator=(128&r[5])>>>7,l.random_access_indicator=(64&r[5])>>>6,l.elementary_stream_priority_indicator=(32&r[5])>>>5,(16&r[5])>>>4)){let e=300*(r[6]<<25|r[7]<<17|r[8]<<9|r[9]<<1|r[10]>>>7)+((1&r[10])<<8|r[11]);ii.last_pcr_=e}if(2==a||5+e===188){t+=188,204===ii.tsPacketSize&&(t+=16);continue}c=5+e}if(1==a||3==a)if(0===s||s===ii.current_pmt_pid_||null!=ii.pmt_&&ii.pmt_.pid_stream_type[s]===Ln){let r=188-c;ii.handleSectionSlice(e,t+c,r,{pid:s,payload_unit_start_indicator:n,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}else if(null!=ii.pmt_&&null!=ii.pmt_.pid_stream_type[s]){let r=188-c,i=ii.pmt_.pid_stream_type[s];s!==ii.pmt_.common_pids.h264&&s!==ii.pmt_.common_pids.h265&&s!==ii.pmt_.common_pids.adts_aac&&s!==ii.pmt_.common_pids.loas_aac&&s!==ii.pmt_.common_pids.ac3&&s!==ii.pmt_.common_pids.eac3&&s!==ii.pmt_.common_pids.opus&&s!==ii.pmt_.common_pids.mp3&&!0!==ii.pmt_.pes_private_data_pids[s]&&!0!==ii.pmt_.timed_id3_pids[s]&&!0!==ii.pmt_.synchronous_klv_pids[s]&&!0!==ii.pmt_.asynchronous_klv_pids[s]||ii.handlePESSlice(e,t+c,r,{pid:s,stream_type:i,payload_unit_start_indicator:n,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}t+=188,204===ii.tsPacketSize&&(t+=16)}return ii.dispatchAudioVideoMediaSegment(),t},handleSectionSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=ii.section_slice_queues_[i.pid];if(i.payload_unit_start_indicator){let a=n[0];if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t+1,Math.min(r,a));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?ii.emitSectionSlices(s,i):ii.clearSlices(s,i)}for(let o=1+a;o=s.expected_length&&ii.clearSlices(s,i),o+=d.byteLength}}else if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t,Math.min(r,s.expected_length-s.total_length));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?ii.emitSectionSlices(s,i):s.total_length>=s.expected_length&&ii.clearSlices(s,i)}},handlePESSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=n[0]<<16|n[1]<<8|n[2];n[3];let a=n[4]<<8|n[5];if(i.payload_unit_start_indicator){if(1!==s)return void si.debugWarn(ii.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${s}`);let e=ii.pes_slice_queues_[i.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?ii.emitPESSlices(e,i):ii.clearSlices(e,i)),ii.pes_slice_queues_[i.pid]=new Rn,ii.pes_slice_queues_[i.pid].random_access_indicator=i.random_access_indicator}if(null==ii.pes_slice_queues_[i.pid])return;let o=ii.pes_slice_queues_[i.pid];o.slices.push(n),i.payload_unit_start_indicator&&(o.expected_length=0===a?0:a+6),o.total_length+=n.byteLength,o.expected_length>0&&o.expected_length===o.total_length?ii.emitPESSlices(o,i):o.expected_length>0&&o.expected_length>>6,o=t[8];2!==a&&3!==a||(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,s=3===a?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:r);let d,l=9+o;if(0!==n){if(n<3+o)return void si.debugWarn(ii.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");d=n-3-o}else d=t.byteLength-l;let c=t.subarray(l,l+d);switch(e.stream_type){case Un:case Bn:ii.parseMP3Payload(c,r);break;case xn:ii.pmt_.common_pids.opus===e.pid||ii.pmt_.common_pids.ac3===e.pid||ii.pmt_.common_pids.eac3===e.pid||(ii.pmt_.asynchronous_klv_pids[e.pid]?ii.parseAsynchronousKLVMetadataPayload(c,e.pid,i):ii.pmt_.smpte2038_pids[e.pid]?ii.parseSMPTE2038MetadataPayload(c,r,s,e.pid,i):ii.parsePESPrivateDataPayload(c,r,s,e.pid,i));break;case Tn:ii.parseADTSAACPayload(c,r);break;case kn:ii.parseLOASAACPayload(c,r);break;case Cn:case Dn:break;case Pn:ii.pmt_.timed_id3_pids[e.pid]?ii.parseTimedID3MetadataPayload(c,r,s,e.pid,i):ii.pmt_.synchronous_klv_pids[e.pid]&&ii.parseSynchronousKLVMetadataPayload(c,r,s,e.pid,i);break;case Fn:ii.parseH264Payload(c,r,s,e.random_access_indicator);break;case In:ii.parseH265Payload(c,r,s,e.random_access_indicator)}}else if((188===i||191===i||240===i||241===i||255===i||242===i||248===i)&&e.stream_type===xn){let r,s=6;r=0!==n?n:t.byteLength-s;let a=t.subarray(s,s+r);ii.parsePESPrivateDataPayload(a,void 0,void 0,e.pid,i)}}else si.debugError(ii.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${r}`)},parsePAT(e){let t=e[0];if(0!==t)return void Log.e(ii.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let r=(15&e[1])<<8|e[2];e[3],e[4];let i=(62&e[5])>>>1,n=1&e[5],s=e[6];e[7];let a=null;if(1===n&&0===s)a={version_number:0,network_pid:0,program_pmt_pid:{}},a.version_number=i;else if(a=ii.pat_,null==a)return;let o=r-5-4,d=-1,l=-1;for(let t=8;t<8+o;t+=4){let r=e[t]<<8|e[t+1],i=(31&e[t+2])<<8|e[t+3];0===r?a.network_pid=i:(a.program_pmt_pid[r]=i,-1===d&&(d=r),-1===l&&(l=i))}1===n&&0===s&&(null==ii.pat_&&si.debugLog(ii.TAG_NAME,`Parsed first PAT: ${JSON.stringify(a)}`),ii.pat_=a,ii.current_program_=d,ii.current_pmt_pid_=l)},parsePMT(e){let t=e[0];if(2!==t)return void si.debugError(ii.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let r,i=(15&e[1])<<8|e[2],n=e[3]<<8|e[4],s=(62&e[5])>>>1,a=1&e[5],o=e[6];if(e[7],1===a&&0===o)r=ii._initPmt(),r.program_number=n,r.version_number=s,ii.program_pmt_map_[n]=r;else if(r=ii.program_pmt_map_[n],null==r)return;r.pcr_pid=(31&e[8])<<8|e[9];let d=(15&e[10])<<8|e[11],l=12+d,c=i-9-d-4;for(let t=l;t0){for(let i=t+5;i0)for(let i=t+5;iii.has_video_&&ii.has_audio_?ii.video_init_segment_dispatched_&&ii.audio_init_segment_dispatched_:ii.has_video_&&!ii.has_audio_?ii.video_init_segment_dispatched_:!(ii.has_video_||!ii.has_audio_)&&ii.audio_init_segment_dispatched_,dispatchVideoInitSegment(){let e=ii.video_metadata_.details,t={type:"video"};t.id=ii.video_track_.id,t.timescale=1e3,t.duration=ii.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;let r=t.frameRate.fps_den,i=t.frameRate.fps_num;if(t.refSampleDuration=r/i*1e3,t.codec=e.codec_mimetype,ii.video_metadata_.vps){si.isHevc=!0;let e=ii.video_metadata_.vps.data.subarray(4),r=ii.video_metadata_.sps.data.subarray(4),i=ii.video_metadata_.pps.data.subarray(4);t.hvcc=qr({vps:e,sps:r,pps:i}),0==ii.video_init_segment_dispatched_&&si.debugLog(ii.TAG_NAME,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.hvcc&&si.decodeVideo(t.hvcc,0,!0,0)}else{let e=ii.video_metadata_.sps.data.subarray(4),r=ii.video_metadata_.pps.data.subarray(4);t.avcc=Dr({sps:e,pps:r}),0==ii.video_init_segment_dispatched_&&si.debugLog(ii.TAG_NAME,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.avcc&&si.decodeVideo(t.avcc,0,!0,0)}ii.video_init_segment_dispatched_=!0,ii.video_metadata_changed_=!1;let n=ii.media_info_;n.hasVideo=!0,n.width=t.codecWidth,n.height=t.codecHeight,n.fps=t.frameRate.fps,n.profile=t.profile,n.level=t.level,n.refFrames=e.ref_frames,n.chromaFormat=e.chroma_format_string,n.sarNum=t.sarRatio.width,n.sarDen=t.sarRatio.height,n.videoCodec=t.codec,n.hasAudio&&n.audioCodec?n.mimeType=`video/mp2t; codecs="${n.videoCodec},${n.audioCodec}"`:n.mimeType=`video/mp2t; codecs="${n.videoCodec}"`},dispatchVideoMediaSegment(){ii.isInitSegmentDispatched()&&ii.video_track_.length&&ii._preDoDecode()},dispatchAudioMediaSegment(){ii.isInitSegmentDispatched()&&ii.audio_track_.length&&ii._preDoDecode()},dispatchAudioVideoMediaSegment(){ii.isInitSegmentDispatched()&&(ii.audio_track_.length||ii.video_track_.length)&&ii._preDoDecode()},parseADTSAACPayload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;if(ii.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+ii.aac_last_incomplete_data_.byteLength);t.set(ii.aac_last_incomplete_data_,0),t.set(e,ii.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/ii.timescale_),"aac"===ii.audio_metadata_.codec){if(null==t&&null!=ii.audio_last_sample_pts_)r=1024/ii.audio_metadata_.sampling_frequency*1e3,i=ii.audio_last_sample_pts_+r;else if(null==t)return void si.debugWarn(ii.TAG_NAME,"AAC: Unknown pts");if(ii.aac_last_incomplete_data_&&ii.audio_last_sample_pts_){r=1024/ii.audio_metadata_.sampling_frequency*1e3;let e=ii.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(si.debugWarn(ii.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Zt(e),a=null,o=i;for(;null!=(a=s.readNextAACFrame());){r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},ii.dispatchAudioInitSegment(e)):ii.detectAudioMetadataChange(e)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(e)),n=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:ae};ii.audio_track_.samples.push(s),ii.audio_track_.length+=i.byteLength,o+=r}s.hasIncompleteData()&&(ii.aac_last_incomplete_data_=s.getIncompleteData()),n&&(ii.audio_last_sample_pts_=n)},parseLOASAACPayload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;if(ii.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+ii.aac_last_incomplete_data_.byteLength);t.set(ii.aac_last_incomplete_data_,0),t.set(e,ii.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/ii.timescale_),"aac"===ii.audio_metadata_.codec){if(null==t&&null!=ii.audio_last_sample_pts_)r=1024/ii.audio_metadata_.sampling_frequency*1e3,i=ii.audio_last_sample_pts_+r;else if(null==t)return void si.debugWarn(ii.TAG_NAME,"AAC: Unknown pts");if(ii.aac_last_incomplete_data_&&ii.audio_last_sample_pts_){r=1024/ii.audio_metadata_.sampling_frequency*1e3;let e=ii.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(si.debugWarn(ii.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Jt(e),a=null,o=i;for(;null!=(a=s.readNextAACFrame(or(this.loas_previous_frame)?void 0:this.loas_previous_frame));){ii.loas_previous_frame=a,r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},ii.dispatchAudioInitSegment(e)):ii.detectAudioMetadataChange(e)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(e)),n=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:ae};ii.audio_track_.samples.push(s),ii.audio_track_.length+=i.byteLength,o+=r}s.hasIncompleteData()&&(ii.aac_last_incomplete_data_=s.getIncompleteData()),n&&(ii.audio_last_sample_pts_=n)},parseAC3Payload(e,t){},parseEAC3Payload(e,t){},parseOpusPayload(e,t){},parseMP3Payload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;let r=[44100,48e3,32e3,0],i=[22050,24e3,16e3,0],n=[11025,12e3,8e3,0],s=e[1]>>>3&3,a=(6&e[1])>>1;e[2];let o=(12&e[2])>>>2,d=3!=(e[3]>>>6&3)?2:1,l=0,c=34;switch(s){case 0:l=n[o];break;case 2:l=i[o];break;case 3:l=r[o]}switch(a){case 1:c=34;break;case 2:c=33;break;case 3:c=32}const u={};u.object_type=c,u.sample_rate=l,u.channel_count=d,u.data=e;const h={codec:"mp3",data:u};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"mp3",object_type:c,sample_rate:l,channel_count:d},ii.dispatchAudioInitSegment(h)):ii.detectAudioMetadataChange(h)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(h));let f={payload:e,length:e.byteLength,pts:t/ii.timescale_,dts:t/ii.timescale_,type:ae};ii.audio_track_.samples.push(f),ii.audio_track_.length+=e.byteLength},detectAudioMetadataChange(e){if(e.codec!==ii.audio_metadata_.codec)return si.debugLog(ii.TAG_NAME,`Audio: Audio Codecs changed from ${ii.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===ii.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==ii.audio_metadata_.audio_object_type)return si.debugLog(ii.TAG_NAME,`AAC: AudioObjectType changed from ${ii.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==ii.audio_metadata_.sampling_freq_index)return si.debugLog(ii.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==ii.audio_metadata_.channel_config)return si.debugLog(ii.TAG_NAME,`AAC: Channel configuration changed from ${ii.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===ii.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==ii.audio_metadata_.sampling_frequency)return si.debugLog(ii.TAG_NAME,`AC3: Sampling Frequency changed from ${ii.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==ii.audio_metadata_.bit_stream_identification)return si.debugLog(ii.TAG_NAME,`AC3: Bit Stream Identification changed from ${ii.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==ii.audio_metadata_.bit_stream_mode)return si.debugLog(ii.TAG_NAME,`AC3: BitStream Mode changed from ${ii.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==ii.audio_metadata_.channel_mode)return si.debugLog(ii.TAG_NAME,`AC3: Channel Mode changed from ${ii.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==ii.audio_metadata_.low_frequency_effects_channel_on)return si.debugLog(ii.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${ii.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===ii.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==ii.audio_metadata_.sample_rate)return si.debugLog(ii.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==ii.audio_metadata_.channel_count)return si.debugLog(ii.TAG_NAME,`Opus: Channel count changed from ${ii.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===ii.audio_metadata_.codec){const t=e.data;if(t.object_type!==ii.audio_metadata_.object_type)return si.debugLog(ii.TAG_NAME,`MP3: AudioObjectType changed from ${ii.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==ii.audio_metadata_.sample_rate)return si.debugLog(ii.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==ii.audio_metadata_.channel_count)return si.debugLog(ii.TAG_NAME,`MP3: Channel count changed from ${ii.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1},dispatchAudioInitSegment(e){let t={type:"audio"};if(t.id=ii.audio_track_.id,t.timescale=1e3,t.duration=ii.duration_,"aac"===ii.audio_metadata_.codec){let r="aac"===e.codec?e.data:null,i=new On(r);t.audioSampleRate=i.sampling_rate,t.audioSampleRateIndex=i.sampling_index,t.channelCount=i.channel_count,t.codec=i.codec_mimetype,t.originalCodec=i.original_codec_mimetype,t.config=i.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale;const n=jt({profile:si._opt.mseDecodeAudio?i.object_type:i.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});si.decodeAudio(n,0)}else"ac-3"===ii.audio_metadata_.codec||"ec-3"===ii.audio_metadata_.codec||"opus"===ii.audio_metadata_.codec||"mp3"===ii.audio_metadata_.codec&&(t.audioSampleRate=ii.audio_metadata_.sample_rate,t.channelCount=ii.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==ii.audio_init_segment_dispatched_&&si.debugLog(ii.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),ii.audio_init_segment_dispatched_=!0,ii.video_metadata_changed_=!1;let r=ii.media_info_;r.hasAudio=!0,r.audioCodec=t.originalCodec,r.audioSampleRate=t.audioSampleRate,r.audioChannelCount=t.channelCount,r.hasVideo&&r.videoCodec?r.mimeType=`video/mp2t; codecs="${r.videoCodec},${r.audioCodec}"`:r.mimeType=`video/mp2t; codecs="${r.audioCodec}"`},dispatchPESPrivateDataDescriptor(e,t,r){},parsePESPrivateDataPayload(e,t,r,i,n){let s=new zn;if(s.pid=i,s.stream_id=n,s.len=e.byteLength,s.data=e,null!=t){let e=Math.floor(t/ii.timescale_);s.pts=e}else s.nearest_pts=ii.getNearestTimestampMilliseconds();if(null!=r){let e=Math.floor(r/ii.timescale_);s.dts=e}},parseTimedID3MetadataPayload(e,t,r,i,n){si.debugLog(ii.TAG_NAME,`Timed ID3 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseSynchronousKLVMetadataPayload(e,t,r,i,n){si.debugLog(ii.TAG_NAME,`Synchronous KLV Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseAsynchronousKLVMetadataPayload(e,t,r){si.debugLog(ii.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${r}`)},parseSMPTE2038MetadataPayload(e,t,r,i,n){si.debugLog(ii.TAG_NAME,`SMPTE 2038 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},getNearestTimestampMilliseconds:()=>null!=ii.audio_last_sample_pts_?Math.floor(ii.audio_last_sample_pts_):null!=ii.last_pcr_?Math.floor(ii.last_pcr_/300/ii.timescale_):void 0,_preDoDecode(){const e=ii.video_track_,t=ii.audio_track_;let r=e.samples;t.samples.length>0&&(r=e.samples.concat(t.samples),r=r.sort(((e,t)=>e.dts-t.dts))),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===oe?ii._doDecodeVideo({...e,payload:t}):e.type===ae&&ii._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0},_doDecodeVideo(e){const t=new Uint8Array(e.payload);let r=null;r=e.isHevc?Kr(t,e.isIFrame):Lr(t,e.isIFrame),e.isIFrame&&si.calcIframeIntervalTimestamp(e.dts);let i=si.cryptoPayload(r,e.isIFrame);si.decode(i,{type:oe,ts:e.dts,isIFrame:e.isIFrame,cts:e.cts})},_doDecodeAudio(e){const t=new Uint8Array(e.payload);let r=t;gr(si._opt.m7sCryptoAudio)&&(r=si.cryptoPayloadAudio(t)),si.decode(r,{type:ae,ts:e.dts,isIFrame:!1,cts:0})}},ni=null;vr()&&(ni={TAG_NAME:"worker MediaSource",_resetInIt(){ni.isAvc=null,ni.isAAC=null,ni.videoInfo={},ni.videoMeta={},ni.audioMeta={},ni.sourceBuffer=null,ni.audioSourceBuffer=null,ni.hasInit=!1,ni.hasAudioInit=!1,ni.isAudioInitInfo=!1,ni.videoMimeType="",ni.audioMimeType="",ni.cacheTrack={},ni.cacheAudioTrack={},ni.timeInit=!1,ni.sequenceNumber=0,ni.audioSequenceNumber=0,ni.firstRenderTime=null,ni.firstAudioTime=null,ni.mediaSourceAppendBufferFull=!1,ni.mediaSourceAppendBufferError=!1,ni.mediaSourceAddSourceBufferError=!1,ni.mediaSourceBufferError=!1,ni.mediaSourceError=!1,ni.prevTimestamp=null,ni.decodeDiffTimestamp=null,ni.prevDts=null,ni.prevAudioDts=null,ni.prevPayloadBufferSize=0,ni.isWidthOrHeightChanged=!1,ni.prevTs=null,ni.prevAudioTs=null,ni.eventListenList=[],ni.pendingRemoveRanges=[],ni.pendingSegments=[],ni.pendingAudioRemoveRanges=[],ni.pendingAudioSegments=[],ni.supportVideoFrameCallbackHandle=null,ni.audioSourceBufferCheckTimeout=null,ni.audioSourceNoDataCheckTimeout=null,ni.hasPendingEos=!1,ni.$video={currentTime:0,readyState:0}},init(){ni.events=new pn,ni._resetInIt(),ni.mediaSource=new self.MediaSource,ni.isDecodeFirstIIframe=!!yr(si._opt.checkFirstIFrame),ni._bindMediaSourceEvents()},destroy(){ni.stop(),ni._clearAudioSourceBufferCheckTimeout(),ni.eventListenList&&ni.eventListenList.length&&(ni.eventListenList.forEach((e=>e())),ni.eventListenList=[]),ni._resetInIt(),ni.mediaSource=null},getState:()=>ni.mediaSource&&ni.mediaSource.readyState,isStateOpen:()=>ni.getState()===vt,isStateClosed:()=>ni.getState()===bt,isStateEnded:()=>ni.getState()===yt,_bindMediaSourceEvents(){const{proxy:e}=ni.events,t=e(ni.mediaSource,St,(()=>{si.debugLog(ni.TAG_NAME,"sourceOpen"),ni._onMediaSourceSourceOpen()})),r=e(ni.mediaSource,wt,(()=>{si.debugLog(ni.TAG_NAME,"sourceClose")})),i=e(ni.mediaSource,Et,(()=>{si.debugLog(ni.TAG_NAME,"sourceended")}));ni.eventListenList.push(t,r,i)},_onMediaSourceSourceOpen(){ni.sourceBuffer||(si.debugLog(ni.TAG_NAME,"onMediaSourceSourceOpen() sourceBuffer is null and next init"),ni._initSourceBuffer()),ni.audioSourceBuffer||(si.debugLog(ni.TAG_NAME,"onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),ni._initAudioSourceBuffer()),ni._hasPendingSegments()&&ni._doAppendSegments()},decodeVideo(e,t,r,i){if(si.isDestroyed)si.debugWarn(ni.TAG_NAME,"decodeVideo() and decoder is destroyed");else if(yr(ni.hasInit))if(r&&e[1]===xt){const i=15&e[0];if(i===Re&&yr(si._opt.supportMSEDecodeHevc))return void ni.emitError(Le.mediaSourceH265NotSupport);ni.videoInfo.codec=i,postMessage({cmd:R,code:i});const n=new Uint8Array(e);postMessage({cmd:M,buffer:n,codecId:i},[n.buffer]),ni.hasInit=ni._decodeConfigurationRecord(e,t,r,i)}else si.debugWarn(ni.TAG_NAME,`decodeVideo has not init , isIframe is ${r} , payload is ${e[1]} so drop this frame`);else if(!ni.isDecodeFirstIIframe&&r&&(ni.isDecodeFirstIIframe=!0),ni.isDecodeFirstIIframe){if(r&&0===e[1]){const t=15&e[0];let r={};t===Ie?r=kr(e.slice(5)):t===Re&&(r=Wr(e));const i=ni.videoInfo;i&&i.codecWidth&&i.codecWidth&&r&&r.codecWidth&&r.codecHeight&&(r.codecWidth!==i.codecWidth||r.codecHeight!==i.codecWidth)&&(si.debugWarn(ni.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${i.codecWidth}, old height is ${i.codecHeight},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),ni.isWidthOrHeightChanged=!0,ni.emitError(Le.mseWidthOrHeightChange,`width: ${i.codecWidth}->${r.codecWidth}, height: ${i.codecWidth}->${r.codecHeight}`))}if(ni.isWidthOrHeightChanged)return void si.debugWarn(ni.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(_r(e))return void si.debugLog(ni.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLengthni.prevTs>0&&eA,_decodeConfigurationRecord(e,t,r,i){let n=e.slice(5),s={};if(i===Ie?s=kr(n):i===Re&&(s=Vr(n)),ni.videoInfo.width=s.codecWidth,ni.videoInfo.height=s.codecHeight,0===s.codecWidth&&0===s.codecHeight)return si.debugWarn(ni.TAG_NAME,"_decodeConfigurationRecord error",JSON.stringify(s)),ni.emitError(Le.mediaSourceDecoderConfigurationError,`width is ${0===s.codecWidth} and height is ${s.codecHeight}`),!1;const a={id:Lt,type:"video",timescale:1e3,duration:0,avcc:n,codecWidth:s.codecWidth,codecHeight:s.codecHeight,videoType:s.videoType},o=mn.generateInitSegment(a);ni.isAvc=i===Ie;let d=s.codec;return ni.videoMimeType=d?`video/mp4; codecs="${s.codec}"`:ni.isAvc?_t:gt,postMessage({cmd:k,w:s.codecWidth,h:s.codecHeight}),ni._initSourceBuffer(),ni.appendBuffer(o.buffer),ni.sequenceNumber=0,ni.cacheTrack={},ni.timeInit=!1,!0},_decodeAudioConfigurationRecord(e,t){const r=e[0]>>4,i=e[0]>>1&1,n=r===He,s=r===$e;if(yr(s||n))return si.debugWarn(ni.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${r} ant auto wasm decode`),ni.emitError(Le.mediaSourceAudioG711NotSupport),!1;const a={id:Ft,type:"audio",timescale:1e3};let o={};if(qt(e)){if(o=Xt(e.slice(2)),!o)return!1;a.audioSampleRate=o.sampleRate,a.channelCount=o.channelCount,a.config=o.config,a.refSampleDuration=1024/a.audioSampleRate*a.timescale}else{if(!n)return!1;if(o=An(e),!o)return!1;a.audioSampleRate=o.samplingRate,a.channelCount=o.channelCount,a.refSampleDuration=1152/a.audioSampleRate*a.timescale}a.codec=o.codec,a.duration=0;let d="mp4",l=o.codec,c=null;n&&yr(si._opt.isFirefox)?(d="mpeg",l="",c=new Uint8Array):c=mn.generateInitSegment(a);let u=`${a.type}/${d}`;return l&&l.length>0&&(u+=`;codecs=${l}`),yr(ni.isAudioInitInfo)&&(wr=r===$e?i?16:8:0===i?8:16,postMessage({cmd:L,code:r}),postMessage({cmd:P,sampleRate:a.audioSampleRate,channels:a.channelCount,depth:wr}),ni.isAudioInitInfo=!0),ni.audioMimeType=u,ni.isAAC=s,ni._initAudioSourceBuffer(),ni.appendAudioBuffer(c.buffer),!0},_initSourceBuffer(){const{proxy:e}=ni.events;if(null===ni.sourceBuffer&&null!==ni.mediaSource&&ni.isStateOpen()&&ni.videoMimeType){try{si.debugLog(ni.TAG_NAME,"_initSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",ni.videoMimeType),ni.sourceBuffer=ni.mediaSource.addSourceBuffer(ni.videoMimeType)}catch(e){return si.debugError(ni.TAG_NAME,"_initSourceBuffer() appendBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),ni.emitError(Le.mseWorkerAddSourceBufferError,e.code),void(ni.mediaSourceAddSourceBufferError=!0)}if(ni.sourceBuffer){const t=e(ni.sourceBuffer,"error",(e=>{ni.mediaSourceBufferError=!0,si.debugError(ni.TAG_NAME,"mseSourceBufferError mseDecoder.sourceBuffer",e,e.toString()),ni.emitError(Le.mseSourceBufferError,e.code)})),r=e(ni.sourceBuffer,"updateend",(()=>{ni._hasPendingRemoveRanges()?ni._doRemoveRanges():ni._hasPendingSegments()?ni._doAppendSegments():ni.hasPendingEos&&(si.debugLog(ni.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),ni.endOfStream())}));ni.eventListenList.push(t,r)}}else si.debugLog(ni.TAG_NAME,`_initSourceBuffer and mseDecoder.isStateOpen is ${ni.isStateOpen()} and mseDecoder.isAvc === null is ${null===ni.isAvc}`)},_initAudioSourceBuffer(){const{proxy:e}=ni.events;if(null===ni.audioSourceBuffer&&null!==ni.mediaSource&&ni.isStateOpen()&&ni.audioMimeType){try{si.debugLog(ni.TAG_NAME,"_initAudioSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",ni.audioMimeType),ni._clearAudioSourceBufferCheckTimeout(),ni.audioSourceBuffer=ni.mediaSource.addSourceBuffer(ni.audioMimeType)}catch(e){return si.debugError(ni.TAG_NAME,"_initAudioSourceBuffer() addSourceBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),ni.emitError(Le.mseWorkerAddSourceBufferError,e.code),void(ni.mediaSourceAddSourceBufferError=!0)}if(ni.audioSourceBuffer){const t=e(ni.audioSourceBuffer,"error",(e=>{ni.mediaSourceBufferError=!0,si.debugError(ni.TAG_NAME,"mseSourceBufferError mseDecoder.audioSourceBuffer",e.code,e.toString(),e),ni.emitError(Le.mseSourceBufferError,e.code)})),r=e(ni.audioSourceBuffer,"updateend",(()=>{ni._hasPendingRemoveRanges()?ni._doRemoveRanges():ni._hasPendingSegments()?ni._doAppendSegments():ni.hasPendingEos&&(si.debugLog(ni.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),ni.endOfStream())}));ni.eventListenList.push(t,r),null===ni.audioSourceNoDataCheckTimeout&&(ni.audioSourceNoDataCheckTimeout=setTimeout((()=>{ni._clearAudioNoDataCheckTimeout(),ni.emitError(Le.mediaSourceAudioNoDataTimeout)}),1e3))}}else si.debugLog(ni.TAG_NAME,`_initAudioSourceBuffer and mseDecoder.isStateOpen is ${ni.isStateOpen()} and mseDecoder.audioMimeType is ${ni.audioMimeType}`)},_decodeVideo(e,t,r,i,n){let s=e.slice(5),a=s.byteLength;if(0===a)return void si.debugWarn(ni.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let o=(new Date).getTime(),d=!1;ni.prevTimestamp||(ni.prevTimestamp=o,d=!0);const l=o-ni.prevTimestamp;if(ni.decodeDiffTimestamp=l,l>1e3&&!d&&si.isPlayer&&si.debugLog(ni.TAG_NAME,`_decodeVideo now time is ${o} and prev time is ${ni.prevTimestamp}, diff time is ${l} ms`),ni.cacheTrack.id&&t>=ni.cacheTrack.dts){let e=8+ni.cacheTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(mn.types.mdat,4),r.set(ni.cacheTrack.data,8),ni.cacheTrack.duration=t-ni.cacheTrack.dts;let i=mn.moof(ni.cacheTrack,ni.cacheTrack.dts);ni.cacheTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),ni.appendBuffer(n.buffer)}else si.debugLog(ni.TAG_NAME,`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${n} cacheTrack dts is ${ni.cacheTrack&&ni.cacheTrack.dts}`),ni.timeInit=!1,ni.cacheTrack={};ni.cacheTrack||(ni.cacheTrack={}),ni.cacheTrack.id=Lt,ni.cacheTrack.sequenceNumber=++ni.sequenceNumber,ni.cacheTrack.size=a,ni.cacheTrack.dts=t,ni.cacheTrack.cts=i,ni.cacheTrack.isKeyframe=r,ni.cacheTrack.data=s,ni.cacheTrack.flags={isLeading:0,dependsOn:r?2:1,isDependedOn:r?1:0,hasRedundancy:0,isNonSync:r?0:1},ni.prevTimestamp=(new Date).getTime()},_decodeAudio(e,t,r){let i=ni.isAAC?e.slice(2):e.slice(1),n=i.byteLength;if(ni.cacheAudioTrack.id&&t>=ni.cacheAudioTrack.dts){let e=8+ni.cacheAudioTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(mn.types.mdat,4),r.set(ni.cacheAudioTrack.data,8),ni.cacheAudioTrack.duration=t-ni.cacheAudioTrack.dts;let i=mn.moof(ni.cacheAudioTrack,ni.cacheAudioTrack.dts);ni.cacheAudioTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),ni.appendAudioBuffer(n.buffer)}else ni.cacheAudioTrack={};ni.cacheAudioTrack||(ni.cacheAudioTrack={}),ni.cacheAudioTrack.id=Ft,ni.cacheAudioTrack.sequenceNumber=++ni.audioSequenceNumber,ni.cacheAudioTrack.size=n,ni.cacheAudioTrack.dts=t,ni.cacheAudioTrack.cts=0,ni.cacheAudioTrack.data=i,ni.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}},appendBuffer(e){si.isDestroyed?si.debugWarn(ni.TAG_NAME,"appendBuffer() player is destroyed"):ni.mediaSourceAddSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):ni.mediaSourceAppendBufferFull?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):ni.mediaSourceAppendBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):ni.mediaSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(ni.pendingSegments.push(e),ni.sourceBuffer&&(si._opt.mseAutoCleanupSourceBuffer&&ni._needCleanupSourceBuffer()&&ni._doCleanUpSourceBuffer(),yr(ni.getSourceBufferUpdating())&&ni.isStateOpen()&&yr(ni._hasPendingRemoveRanges()))?ni._doAppendSegments():ni.isStateClosed()?(ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):ni.isStateEnded()&&(ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,"mediaSource is end")))},appendAudioBuffer(e){si.isDestroyed?si.debugWarn(ni.TAG_NAME,"appendAudioBuffer() player is destroyed"):ni.mediaSourceAddSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):ni.mediaSourceAppendBufferFull?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):ni.mediaSourceAppendBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):ni.mediaSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(ni.pendingAudioSegments.push(e),ni.audioSourceBuffer&&(si._opt.mseAutoCleanupSourceBuffer&&ni._needCleanupSourceBuffer()&&ni._doCleanUpSourceBuffer(),yr(ni.getAudioSourceBufferUpdating())&&ni.isStateOpen()&&yr(ni._hasPendingRemoveRanges()))?ni._doAppendSegments():ni.isStateClosed()?(ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):ni.isStateEnded()&&(ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,"mediaSource is end")))},getSourceBufferUpdating:()=>ni.sourceBuffer&&ni.sourceBuffer.updating,getAudioSourceBufferUpdating:()=>ni.audioSourceBuffer&&ni.audioSourceBuffer.updating,stop(){ni.abortSourceBuffer(),ni.removeSourceBuffer(),ni.endOfStream()},clearUpAllSourceBuffer(){if(ni.sourceBuffer){const e=ni.sourceBuffer.buffered;for(let t=0;tni.pendingSegments.length>0||ni.pendingAudioSegments.length>0,getPendingSegmentsLength:()=>ni.pendingSegments.length,_handleUpdatePlaybackRate(){},_doAppendSegments(){if(ni.isStateClosed()||ni.isStateEnded())si.debugLog(ni.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==ni.sourceBuffer){if(ni.needInitAudio()&&null===ni.audioSourceBuffer)return si.debugLog(ni.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===ni.audioSourceBufferCheckTimeout&&(ni.audioSourceBufferCheckTimeout=setTimeout((()=>{ni._clearAudioSourceBufferCheckTimeout(),ni.emitError(Le.mediaSourceAudioInitTimeout)}),1e3)));if(yr(ni.getSourceBufferUpdating())&&ni.pendingSegments.length>0){const e=ni.pendingSegments.shift();try{ni.sourceBuffer.appendBuffer(e)}catch(e){si.debugError(ni.TAG_NAME,"mseDecoder.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(ni.stop(),ni.mediaSourceAppendBufferFull=!0,ni.emitError(Le.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(ni.stop(),ni.mediaSourceAppendBufferError=!0,ni.emitError(Le.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(ni.stop(),ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,`code is ${e.code} , message is ${e.message}`))}}if(yr(ni.getAudioSourceBufferUpdating())&&ni.pendingAudioSegments.length>0){const e=ni.pendingAudioSegments.shift();try{ni.audioSourceBuffer.appendBuffer(e)}catch(e){si.debugError(ni.TAG_NAME,"mseDecoder.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(ni.stop(),ni.mediaSourceAppendBufferFull=!0,ni.emitError(Le.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(ni.stop(),ni.mediaSourceAppendBufferError=!0,ni.emitError(Le.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(ni.stop(),ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,e.code,`code is ${e.code} , message is ${e.message}`))}}}else si.debugLog(ni.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")},_doCleanUpSourceBuffer(){const e=ni.$video.currentTime;if(ni.sourceBuffer){const t=ni.sourceBuffer.buffered;let r=!1;for(let i=0;i=si._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-si._opt.mseAutoCleanupMinBackwardDuration;ni.pendingRemoveRanges.push({start:n,end:t})}}else s=si._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-si._opt.mseAutoCleanupMinBackwardDuration;ni.pendingAudioRemoveRanges.push({start:n,end:t})}}else sni.pendingRemoveRanges.length>0||ni.pendingAudioRemoveRanges.length>0,needInitAudio:()=>si._opt.hasAudio&&si._opt.mseDecodeAudio,_doRemoveRanges(){if(ni.sourceBuffer&&yr(ni.getSourceBufferUpdating())){let e=ni.pendingRemoveRanges;for(;e.length&&yr(ni.getSourceBufferUpdating());){let t=e.shift();try{ni.sourceBuffer.remove(t.start,t.end)}catch(e){si.debugWarn(ni.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e,e.toString())}}}if(ni.audioSourceBuffer&&yr(ni.getAudioSourceBufferUpdating())){let e=ni.pendingAudioRemoveRanges;for(;e.length&&yr(ni.getAudioSourceBufferUpdating());){let t=e.shift();try{ni.audioSourceBuffer.remove(t.start,t.end)}catch(e){si.debugWarn(ni.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e,e.toString())}}}},_getPlaybackRate(){},_needCleanupSourceBuffer(){if(yr(si._opt.mseAutoCleanupSourceBuffer))return!1;const e=ni.$video.currentTime;if(ni.sourceBuffer){let t=ni.sourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=si._opt.mseAutoCleanupMaxBackwardDuration)return!0}if(ni.audioSourceBuffer){let t=ni.audioSourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=si._opt.mseAutoCleanupMaxBackwardDuration)return!0}return!1},_clearAudioSourceBufferCheckTimeout(){ni.audioSourceBufferCheckTimeout&&(clearTimeout(ni.audioSourceBufferCheckTimeout),ni.audioSourceBufferCheckTimeout=null)},_clearAudioNoDataCheckTimeout(){ni.audioSourceNoDataCheckTimeout&&(clearTimeout(ni.audioSourceNoDataCheckTimeout),ni.audioSourceNoDataCheckTimeout=null)},getHandle:()=>ni.mediaSource.handle,emitError(e){postMessage({cmd:se,value:e,msg:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""})}});let si={isPlayer:!0,isHevc:null,isPlayback:!1,dropping:!1,isPushDropping:!1,isWorkerFetch:!1,isDestroyed:!1,fetchStatus:Ct,_opt:Ar(),mp3Demuxer:null,delay:-1,pushLatestDelay:-1,firstTimestamp:null,startTimestamp:null,preDelayTimestamp:null,stopId:null,streamFps:null,streamAudioFps:null,streamVideoFps:null,writableStream:null,networkDelay:0,webglObj:null,startStreamRateAndStatsInterval:function(){si.stopStreamRateAndStatsInterval(),l=setInterval((()=>{d&&d(0);const e=JSON.stringify({demuxBufferDelay:si.getVideoBufferLength(),audioDemuxBufferDelay:si.getAudioBufferLength(),streamBufferByteLength:si.getStreamBufferLength(),netBuf:si.networkDelay||0,pushLatestDelay:si.pushLatestDelay||0,latestDelay:si.delay,isStreamTsMoreThanLocal:je,wasmDecodeDelay:Se-Ee});postMessage({cmd:O,type:Ce,value:e})}),1e3)},stopStreamRateAndStatsInterval:function(){l&&(clearInterval(l),l=null)},useOffscreen:function(){return si._opt.useOffscreen&&"undefined"!=typeof OffscreenCanvas},getDelay:function(e,t){if(!e||si._opt.hasVideo&&!x)return-1;if(t===ae)return si.delay;if(si.preDelayTimestamp&&si.preDelayTimestamp>e)return si.preDelayTimestamp-e>1e3&&si.debugWarn("worker",`getDelay() and preDelayTimestamp is ${si.preDelayTimestamp} > timestamp is ${e} more than ${si.preDelayTimestamp-e}ms and return ${si.delay}`),si.preDelayTimestamp=e,si.delay;if(si.firstTimestamp){if(e){const t=Date.now()-si.startTimestamp,r=e-si.firstTimestamp;t>=r?(je=!1,si.delay=t-r):(je=!0,si.delay=r-t)}}else si.firstTimestamp=e,si.startTimestamp=Date.now(),si.delay=-1;return si.preDelayTimestamp=e,si.delay},getDelayNotUpdateDelay:function(e,t){if(!e||si._opt.hasVideo&&!x)return-1;if(t===ae)return si.pushLatestDelay;if(si.preDelayTimestamp&&si.preDelayTimestamp-e>1e3)return si.debugWarn("worker",`getDelayNotUpdateDelay() and preDelayTimestamp is ${si.preDelayTimestamp} > timestamp is ${e} more than ${si.preDelayTimestamp-e}ms and return -1`),-1;if(si.firstTimestamp){let t=-1;if(e){const r=Date.now()-si.startTimestamp,i=e-si.firstTimestamp;r>=i?(je=!1,t=r-i):(je=!0,t=i-r)}return t}return-1},resetDelay:function(){si.firstTimestamp=null,si.startTimestamp=null,si.delay=-1,si.dropping=!1},resetAllDelay:function(){si.resetDelay(),si.preDelayTimestamp=null},doDecode:function(e){si._opt.isEmitSEI&&e.type===oe&&si.isWorkerFetch&&si.findSei(e.payload,e.ts),si.isPlayUseMSEAndDecoderInWorker()?e.type===ae?si._opt.mseDecodeAudio?ni.decodeAudio(e.payload,e.ts):e.decoder.decode(e.payload,e.ts):e.type===oe&&ni.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):si._opt.useWCS&&si.useOffscreen()&&e.type===oe&&s.decode?s.decode(e.payload,e.ts,e.cts):e.decoder.decode(e.payload,e.ts,e.isIFrame,e.cts)},decodeNext(e){if(0===i.length)return;const t=e.ts,n=i[0],s=e.type===oe&&_r(e.payload);if(yr(r))s&&(si.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n isVideoSqeHeader is ${s}`),i.shift(),si.doDecode(n));else{const r=n.ts-t,a=n.type===ae&&e.type===oe;(r<=20||a||s)&&(si.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n diff is ${r} and isVideoAndNextAudio is ${a} and isVideoSqeHeader is ${s}`),i.shift(),si.doDecode(n))}},init:function(){si.debugLog("worker","init and opt is",JSON.stringify(si._opt));const e=si._opt.playType===v,t=si._opt.playType===b;if(Or.init(),si.isPlayer=e,si.isPlayback=t,si.isPlayUseMSEAndDecoderInWorker()&&ni&&ni.init(),s&&si._opt.useWCS&&si.useOffscreen()&&s.init(),yr(si.isPlaybackCacheBeforeDecodeForFpsRender())){si.debugLog("worker","setInterval()");const t=()=>{const t=si._opt.videoBuffer+si._opt.videoBufferDelay;let r=null;if(i.length){if(si.isPushDropping)return void si.debugWarn("worker",`loop() isPushDropping is true and bufferList length is ${i.length}`);if(si.dropping){for(r=i.shift(),si.debugWarn("worker",`loop() dropBuffer is dropping and isIFrame ${r.isIFrame} and delay is ${si.delay} and bufferlist is ${i.length}`);!r.isIFrame&&i.length;)r=i.shift();const e=si.getDelayNotUpdateDelay(r.ts,r.type);r.isIFrame&&e<=si.getNotDroppingDelayTs()&&(si.debugLog("worker","loop() is dropping = false, is iFrame"),si.dropping=!1,si.doDecode(r),si.decodeNext(r))}else if(si.isPlayback||si.isPlayUseMSE()||0===si._opt.videoBuffer)for(;i.length;)r=i.shift(),si.doDecode(r);else if(r=i[0],-1===si.getDelay(r.ts,r.type))si.debugLog("worker","loop() common dumex delay is -1 ,data.ts is",r.ts),i.shift(),si.doDecode(r),si.decodeNext(r);else if(si.delay>t&&e)si.hasIframeInBufferList()?(si.debugLog("worker",`delay is ${si.delay} > maxDelay ${t}, set dropping is true`),si.resetAllDelay(),si.dropping=!0,postMessage({cmd:H})):(i.shift(),si.doDecode(r),si.decodeNext(r));else for(;i.length;){if(r=i[0],!(si.getDelay(r.ts,r.type)>si._opt.videoBuffer)){si.delay<0&&si.debugWarn("worker",`loop() do not decode and delay is ${si.delay}, bufferList is ${i.length}`);break}i.shift(),si.doDecode(r)}}else-1!==si.delay&&si.debugLog("worker","loop() bufferList is empty and reset delay"),si.resetAllDelay()};si.stopId=setInterval((()=>{let e=(new Date).getTime();Je||(Je=e);const r=e-Je;r>100&&si.debugWarn("worker",`loop demux diff time is ${r}`),t(),Je=(new Date).getTime()}),20)}else si.debugLog("worker","playback and playbackIsCacheBeforeDecodeForFpsRender is true");if(yr(si._opt.checkFirstIFrame)&&(x=!0),si.isPlayUseMSEAndDecoderInWorker()&&ni){const e=ni.getHandle();e&&postMessage({cmd:ie,mseHandle:e},[e])}},playbackCacheLoop:function(){si.clearPlaybackCacheLoop();const e=()=>{let e=null;i.length&&(e=i.shift(),si.doDecode(e))};e();const t=Math.ceil(1e3/(si.streamFps*si._opt.playbackRate));si.debugLog("worker",`playbackCacheLoop fragDuration is ${t}, streamFps is ${si.streamFps}, streamAudioFps is ${si.streamAudioFps} ,streamVideoFps is ${si.streamVideoFps} playbackRate is ${si._opt.playbackRate}`),si.stopId=setInterval(e,t)},clearPlaybackCacheLoop:function(){si.stopId&&(clearInterval(si.stopId),si.stopId=null)},startPlaybackCacheLoop:function(){si.playbackCacheLoop()},close:function(){if(si.debugLog("worker","close"),si.isDestroyed=!0,Tr(),!o||1!==o.readyState&&2!==o.readyState?o&&si.debugLog("worker",`close() and socket.readyState is ${o.readyState}`):(Sr=!0,o.close(1e3,"Client disconnecting")),o=null,si.stopStreamRateAndStatsInterval(),si.stopId&&(clearInterval(si.stopId),si.stopId=null),si.mp3Demuxer&&(si.mp3Demuxer.destroy(),si.mp3Demuxer=null),si.writableStream&&yr(si.writableStream.locked)&&si.writableStream.close().catch((e=>{si.debugLog("worker","close() and writableStream.close() error",e.toString(),e)})),si.writableStream=null,ai)try{ai.clear&&ai.clear(),ai=null}catch(e){si.debugLog("worker","close() and audioDecoder.clear error",e.toString(),e)}if(oi)try{oi.clear&&oi.clear(),oi=null}catch(e){si.debugLog("worker","close() and videoDecoder.clear error",e.toString())}d=null,Je=null,je=!1,Se=0,Ee=0,s&&(s.destroy&&s.destroy(),s=null),ni&&(ni.destroy(),ni=null),si.firstTimestamp=null,si.startTimestamp=null,si.networkDelay=0,si.streamFps=null,si.streamAudioFps=null,si.streamVideoFps=null,si.delay=-1,si.pushLatestDelay=-1,si.preDelayTimestamp=null,si.dropping=!1,si.isPushDropping=!1,si.isPlayer=!0,si.isPlayback=!1,si.isWorkerFetch=!1,si.isHevc=null,si._opt=Ar(),si.webglObj&&(si.webglObj.destroy(),si.offscreenCanvas.removeEventListener("webglcontextlost",si.onOffscreenCanvasWebglContextLost),si.offscreenCanvas.removeEventListener("webglcontextrestored",si.onOffscreenCanvasWebglContextRestored),si.offscreenCanvas=null,si.offscreenCanvasGL=null,si.offscreenCanvasCtx=null),i=[],n=[],c&&(c.close(),c=null),h=null,f=null,S=!1,E=!1,x=!1,Wt=!1,Kt=!1,Qt=!1,sr=null,it=[],Ut=0,Tt=0,Qe=null,tt=null,$t=null,Ot=null,wr=null,Gt=0,Ht=0,ut=null,At=null,si.fetchStatus=Ct,Er=!0,Or.destroy(),Gr.destroy(),jr.destroy(),ii.destroy(),si.debug=null,si._opt={},postMessage({cmd:K})},pushBuffer:function(e,t){if(t.type===ae&&qt(e)){if(si.debugLog("worker",`pushBuffer audio ts is ${t.ts}, isAacCodecPacket is true`),si._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:Q,buffer:t},[t.buffer])}si.decodeAudio(e,t.ts)}else if(t.type===oe&&t.isIFrame&&_r(e)){if(si.debugLog("worker",`pushBuffer video ts is ${t.ts}, isVideoSequenceHeader is true`),si._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:ee,buffer:t},[t.buffer])}si.decodeVideo(e,t.ts,t.isIFrame,t.cts)}else{if(si._opt.isRecording)if(si._opt.isRecordTypeFlv){const r=new Uint8Array(e);postMessage({cmd:te,type:t.type,buffer:r,ts:t.ts},[r.buffer])}else if(si._opt.recordType===w)if(t.type===oe){const r=new Uint8Array(e).slice(5);postMessage({cmd:z,buffer:r,isIFrame:t.isIFrame,ts:t.ts,cts:t.cts},[r.buffer])}else if(t.type===ae&&si._opt.isWasmMp4){const r=new Uint8Array(e),i=Yt(r)?r.slice(2):r.slice(1);postMessage({cmd:F,buffer:i,ts:t.ts},[i.buffer])}if(si.isPlayer){if(t.type===oe){if(Gt>0){const e=t.ts-Ot,r=Gt+Gt/2;e>r&&si.debugLog("worker",`pushBuffer video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts}, preTs is ${Ot},\n diff is ${e} and preTsDuration is ${Gt} and maxDiff is ${r}\n maybe trigger black screen or flower screen\n `)}if(null!==Ot&&Ot>=t.ts&&(si.debugWarn("worker",`pushBuffer() and isIFrame is ${t.isIFrame} and,\n options.ts is ${t.ts} less than (or equal) preTs is ${Ot} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${Ht}`),Ot-t.ts>A&&(si.debugWarn("worker",`pushBuffer,\n preTimestamp is ${Ot}, options.ts is ${t.ts},\n diff is ${Ot-t.ts} more than 3600000,\n and resetAllDelay`),si.resetAllDelay(),Ot=null,Gt=0),si._opt.isDropSameTimestampGop&&yr(t.isIFrame)&&x)){const e=si.hasIframeInBufferList(),t=yr(si.isPushDropping);return si.debugLog("worker",`pushBuffer, isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next dropBuffer`),void(e&&t?si.dropBuffer$2():(si.clearBuffer(!0),gr(si._opt.checkFirstIFrame)&&gr(r)&&(si.isPlayUseMSEAndDecoderInWorker()?ni.isDecodeFirstIIframe=!1:postMessage({cmd:re}))))}Ot>0&&(Gt=t.ts-Ot),Ht=e.byteLength,Ot=t.ts}if(x){const e=si._opt.videoBuffer+si._opt.videoBufferDelay,r=si.getDelayNotUpdateDelay(t.ts,t.type);si.pushLatestDelay=r,si.delay>0&&r>e&&si.delay({type:e.type,ts:e.ts})));si.debugLog("worker",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${i.length}, and ts list is ${JSON.stringify(r)}`)}const r=si.getAudioBufferLength()>0,n=r?60:40;i.length>=n&&(si.debugWarn("worker",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${i.length} more than ${n}, and hasAudio is ${r} an set streamFps is 25`),si.streamVideoFps=25,postMessage({cmd:V,value:si.streamVideoFps}),r?(si.streamAudioFps=25,si.streamFps=si.streamVideoFps+si.streamAudioFps):si.streamFps=si.streamVideoFps,si.playbackCacheLoop())}}},getVideoBufferLength(){let e=0;return i.forEach((t=>{t.type===oe&&(e+=1)})),e},hasIframeInBufferList:()=>i.some((e=>e.type===oe&&e.isIFrame)),isAllIframeInBufferList(){const e=si.getVideoBufferLength();let t=0;return i.forEach((e=>{e.type===oe&&e.isIFrame&&(t+=1)})),e===t},getNotDroppingDelayTs:()=>si._opt.videoBuffer+si._opt.videoBufferDelay/2,getAudioBufferLength(){let e=0;return i.forEach((t=>{t.type===ae&&(e+=1)})),e},getStreamBufferLength(){let e=0;return c&&c.buffer&&(e=c.buffer.byteLength),si._opt.isNakedFlow?Or.lastBuf&&(e=Or.lastBuf.byteLength):si._opt.isTs?ii._remainingPacketData&&(e=ii._remainingPacketData.byteLength):si._opt.isFmp4&&Gr.mp4Box&&(e=Gr.mp4Box.getAllocatedSampleDataSize()),e},fetchStream:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(si.debugLog("worker","fetchStream, url is "+e,"options:",JSON.stringify(t)),si.isWorkerFetch=!0,t.isFlv?si._opt.isFlv=!0:t.isFmp4?si._opt.isFmp4=!0:t.isMpeg4?si._opt.isMpeg4=!0:t.isNakedFlow?si._opt.isNakedFlow=!0:t.isTs&&(si._opt.isTs=!0),d=ar((e=>{postMessage({cmd:O,type:Ue,value:e})})),si.startStreamRateAndStatsInterval(),t.isFmp4&&(Gr.listenMp4Box(),si._opt.isFmp4Private&&Gr.initTransportDescarmber()),t.protocol===_){t.isFlv&&(c=new Ur(si.demuxFlv())),a=new AbortController;const r=Object.assign({signal:a.signal},{headers:t.options&&t.options.headers||{}});fetch(e,r).then((e=>{if(gr(Sr))return si.debugLog("worker","request abort and run res.body.cancel()"),si.fetchStatus=Ct,void e.body.cancel();if(!pr(e))return si.debugWarn("worker",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),Tr(),void postMessage({cmd:O,type:Le.fetchError,value:`fetch response status is ${e.status} and ok is ${e.ok}`});if(postMessage({cmd:O,type:ke}),ur())si.writableStream=new WritableStream({write:e=>a&&a.signal&&a.signal.aborted?(si.debugLog("worker","writableStream write() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt)):gr(Sr)?(si.debugLog("worker","writableStream write() and requestAbort is true so return"),si.fetchStatus=Pt,void Tr()):void("string"!=typeof e?(si.fetchStatus=Dt,d(e.byteLength),t.isFlv?c.write(e):t.isFmp4?si.demuxFmp4(e):t.isMpeg4?si.demuxMpeg4(e):t.isTs?si.demuxTs(e):t.isNakedFlow&&si.demuxNakedFlow(e)):si.debugWarn("worker",`writableStream write() and value is "${e}" string so return`)),close:()=>{si.debugLog("worker","writableStream close()"),si.fetchStatus=Pt,c&&(c.close(),c=null),Tr(),postMessage({cmd:O,type:Ae,value:g,msg:"fetch done"})},abort:e=>{if(a&&a.signal&&a.signal.aborted)return si.debugLog("worker","writableStream abort() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt);c&&(c.close(),c=null),e.name!==Bt?(si.debugLog("worker",`writableStream abort() and e is ${e.toString()}`),Tr(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()})):si.debugLog("worker","writableStream abort() and e.name is AbortError so return")}}),e.body.pipeTo(si.writableStream).catch((e=>{"AbortError"!==e.name&&si.debugLog("worker","writableStream pipeTo() and e is",e.name,e.toString())}));else{const r=e.body.getReader(),i=()=>{r.read().then((e=>{let{done:r,value:n}=e;return r?(si.debugLog("worker","fetchNext().then() and done is true"),si.fetchStatus=Pt,c&&(c.close(),c=null),Tr(),void postMessage({cmd:O,type:Ae,value:g,msg:"fetch done"})):a&&a.signal&&a.signal.aborted?(si.debugLog("worker","fetchNext().then() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt)):gr(Sr)?(si.debugLog("worker","fetchNext().then() and requestAbort is true so return"),si.fetchStatus=Pt,void Tr()):void("string"!=typeof n?(si.fetchStatus=Dt,d(n.byteLength),t.isFlv?c.write(n):t.isFmp4?si.demuxFmp4(n):t.isMpeg4?si.demuxMpeg4(n):t.isTs?si.demuxTs(n):t.isNakedFlow&&si.demuxNakedFlow(n),i()):si.debugWarn("worker",`fetchNext().then() and value "${n}" is string so return`))})).catch((e=>{if(a&&a.signal&&a.signal.aborted)return si.debugLog("worker","fetchNext().catch() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt);c&&(c.close(),c=null),e.name!==Bt?(si.debugLog("worker",`fetchNext().catch() and e is ${e.toString()}`),Tr(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()})):si.debugLog("worker","fetchNext().catch() and e.name is AbortError so return")}))};i()}})).catch((e=>{a&&a.signal&&a.signal.aborted?si.debugLog("worker","fetch().catch() and abortController.signal.aborted is true so return"):e.name!==Bt?(si.debugLog("worker",`fetch().catch() and e is ${e.toString()}`),Tr(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()}),c&&(c.close(),c=null)):si.debugLog("worker","fetch().catch() and e.name is AbortError so return")}))}else t.protocol===m&&(t.isFlv&&(c=new Ur(si.demuxFlv())),o=new WebSocket(e,r),o.binaryType="arraybuffer",o.onopen=()=>{si.debugLog("worker","fetchStream, WebsocketStream socket open"),postMessage({cmd:O,type:ke}),postMessage({cmd:O,type:Pe})},o.onclose=e=>{si.isDestroyed?si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} and isDestroyed is true, so return`):u?si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} but isSocketError is true , so return`):(si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code}`),1006===e.code&&si.debugError("worker",`fetchStream, WebsocketStream socket close abnormally and code is ${e.code}`),gr(Sr)?si.debugLog("worker","fetchStream, WebsocketStream socket close and requestAbort is true so return"):(c&&(c.close(),c=null),postMessage({cmd:O,type:Ae,value:y,msg:e.code})))},o.onerror=e=>{si.debugError("worker","fetchStream, WebsocketStream socket error",e,e.toString()),u=!0,c&&(c.close(),c=null),si.isDestroyed?si.debugLog("worker","fetchStream, WebsocketStream on error and isDestroyed is true, so return"):postMessage({cmd:O,type:Le.websocketError,value:e.isTrusted?"websocket user aborted":"websocket error"})},o.onmessage=e=>{"string"!=typeof e.data?(d(e.data.byteLength),t.isFlv?c.write(e.data):t.isFmp4?si.demuxFmp4(e.data):t.isMpeg4?si.demuxMpeg4(e.data):si._opt.isNakedFlow?si.demuxNakedFlow(e.data):si.demuxM7s(e.data)):si.debugWarn("worker",`socket on message is string "${e.data}" and return`)})},demuxFlv:function*(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),r=new Uint32Array(e);for(;;){t[3]=0;const e=yield 15,i=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const n=r[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let s=r[0];const a=(yield n).slice();switch(i){case de:if(a.byteLength>0){let e=a;gr(si._opt.m7sCryptoAudio)&&(e=si.cryptoPayloadAudio(a)),si.decode(e,{type:ae,ts:s})}else si.debugWarn("worker",`demuxFlv() type is audio and payload.byteLength is ${a.byteLength} and return`);break;case le:if(a.byteLength>=6){const e=a[0];if(si._isEnhancedH265Header(e))si._decodeEnhancedH265Video(a,s);else{const e=15&a[0];let t=a[0]>>4===kt;const i=e===Re;if(yr(t)&&gr(br(a,i))&&(si.debugLog("worker","demux() isIFrame is false and unit type is IDR and update to true"),t=!0),t&&_r(a)&&null===si.isHevc){const e=15&a[0];si.isHevc=e===Re,sr=rr(a,si.isHevc),si.debugLog("worker",`demuxFlv() isVideoSequenceHeader is true and isHevc is ${si.isHevc} and nalUnitSize is ${sr}`)}t&&si.calcIframeIntervalTimestamp(s),si.isPlayer&&si.calcNetworkDelay(s),r[0]=a[4],r[1]=a[3],r[2]=a[2],r[3]=0;let n=r[0],o=si.cryptoPayload(a,t);si.decode(o,{type:oe,ts:s,isIFrame:t,cts:n})}}else si.debugWarn("worker",`demuxFlv() type is video and payload.byteLength is ${a.byteLength} and return`);break;case ce:postMessage({cmd:J,buffer:a},[a.buffer]);break;default:si.debugLog("worker",`demuxFlv() type is ${i}`)}}},decode:function(e,t){t.type===ae?si._opt.hasAudio&&(postMessage({cmd:O,type:Be,value:e.byteLength}),si.isPlayer?si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts}):si.isPlayback&&(si.isPlaybackOnlyDecodeIFrame()||(si.isPlaybackCacheBeforeDecodeForFpsRender(),si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts})))):t.type===oe&&si._opt.hasVideo&&(postMessage({cmd:O,type:xe,value:e.byteLength}),postMessage({cmd:O,type:Te,value:t.ts}),si.isPlayer?si.pushBuffer(e,{type:t.type,ts:t.ts,isIFrame:t.isIFrame,cts:t.cts}):si.isPlayback&&(si.isPlaybackOnlyDecodeIFrame()?t.isIFrame&&si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}):(si.isPlaybackCacheBeforeDecodeForFpsRender(),si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}))))},cryptoPayload:function(e,t){let r=e;return si._opt.isM7sCrypto?si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?r=zi(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc):si.debugError("worker",`isM7sCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`):si._opt.isSm4Crypto?si._opt.sm4CryptoKey?r=si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?ts(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc,si._opt.isSm4CryptoH265V2):on(e,si._opt.sm4CryptoKey,si.isHevc,si._opt.isSm4CryptoH265V2):si._opt.sm4CryptoKey||si.debugError("worker","isSm4Crypto opt.sm4CryptoKey is null"):si._opt.isXorCrypto&&(si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?r=hn(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc):si.debugError("worker",`isXorCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`)),r},cryptoPayloadAudio:function(e){let t=e;return si._opt.isM7sCrypto&&(si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?e[0]>>4===$e&&(t=Ni(e,si._opt.cryptoKey,si._opt.cryptoIV)):si.debugError("worker",`isM7sCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`)),t},setCodecAudio:function(e,t){const r=e[0]>>4,i=e[0]>>1&1;if(wr=r===$e?i?16:8:0===i?8:16,ai&&ai.setCodec)if(qt(e)||r===Oe||r===Ge||r===He){si.debugLog("worker",`setCodecAudio: init audio codec, codeId is ${r} _opt.sampleRate is ${si._opt.sampleRate}`);const i=r===$e?e.slice(2):new Uint8Array(0);ai.setCodec(r,si._opt.sampleRate,i),r===$e&&postMessage({cmd:I,buffer:i},[i.buffer]),E=!0,r!==$e&&(r===He?(si.mp3Demuxer||(si.mp3Demuxer=new ln(si),si.mp3Demuxer.on("data",((e,t)=>{ai.decode(e,t)}))),si.mp3Demuxer.dispatch(e.slice(1),t)):ai.decode(e.slice(1),t));{const e=Number("1")||1;setTimeout((()=>{si.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),si.close(),postMessage({cmd:W})}),60*e*60*1e3)}}else si.debugWarn("worker","setCodecAudio: hasInitAudioCodec is false, codecId is ",r);else si.debugError("worker","setCodecAudio: audioDecoder or audioDecoder.setCodec is null")},decodeAudio:function(e,t){if(si.isDestroyed)si.debugLog("worker","decodeAudio, decoder is destroyed and return");else if(si.isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio())ni.decodeAudio(e,t);else if(gr(r)&&gr(si._opt.mseDecodeAudio))postMessage({cmd:$,payload:e,ts:t,cts:t},[e.buffer]);else{const r=e[0]>>4;if(E){if(qt(e))return void si.debugLog("worker","decodeAudio and has already initialized and payload is aac codec packet so drop this frame");r===He?si.mp3Demuxer.dispatch(e.slice(1),t):ai.decode(r===$e?e.slice(2):e.slice(1),t)}else si.setCodecAudio(e,t)}},setCodecVideo:function(e,t){const r=15&e[0];if(oi&&oi.setCodec)if(_r(e))if(r===Ie||r===Re){si.debugLog("worker",`setCodecVideo: init video codec , codecId is ${r}`);const t=e.slice(5);if(r===Ie&&si._opt.useSIMD){const e=kr(t);if(e.codecWidth>U||e.codecHeight>U)return postMessage({cmd:Y,value:`width: ${e.codecWidth} > 4080, height: ${e.codecHeight} > 4080`}),void si.debugWarn("worker",`setCodecVideo: SIMD H264 decode video width is too large, width is ${e.codecWidth}, height is ${e.codecHeight}`)}const i=new Uint8Array(e);S=!0,oi.setCodec(r,t),postMessage({cmd:R,code:r}),postMessage({cmd:M,buffer:i,codecId:r},[i.buffer])}else si.debugWarn("worker",`setCodecVideo: hasInitVideoCodec is false, codecId is ${r} is not H264 or H265`);else si.debugWarn("worker",`decodeVideo: hasInitVideoCodec is false, codecId is ${r} and isIFrame is ${t} and packetType is ${e[1]}`);else si.debugError("worker","setCodecVideo: videoDecoder or videoDecoder.setCodec is null")},decodeVideo:function(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(si.isDestroyed)si.debugLog("worker","decodeVideo, decoder is destroyed and return");else if(si.isPlayUseMSEAndDecoderInWorker())ni.decodeVideo(e,t,i,n);else if(gr(r))postMessage({cmd:N,payload:e,isIFrame:i,ts:t,cts:n,delay:si.delay},[e.buffer]);else if(S)if(!x&&i&&(x=!0),x){if(i&&_r(e)){const t=15&e[0];let r={};t===Ie?r=kr(e.slice(5)):t===Re&&(r=Wr(e)),r.codecWidth&&r.codecHeight&&h&&f&&(r.codecWidth!==h||r.codecHeight!==f)&&(si.debugWarn("worker",`\n decodeVideo: video width or height is changed,\n old width is ${h}, old height is ${f},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),Kt=!0,postMessage({cmd:j,value:`width: ${h}->${r.codecWidth}, height: ${f}->${r.codecHeight}`}))}if(Kt)return void si.debugWarn("worker","decodeVideo: video width or height is changed, and return");if(Qt)return void si.debugWarn("worker","decodeVideo: simd decode error, and return");if(_r(e))return void si.debugLog("worker","decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength0&&void 0!==arguments[0]&&arguments[0];si.debugLog("worker",`clearBuffer,bufferList length is ${i.length}, need clear is ${e}`),e&&(i=[]),si.isPlayer&&(si.resetAllDelay(),gr(si._opt.checkFirstIFrame)&&(si.dropping=!0,postMessage({cmd:H}))),gr(si._opt.checkFirstIFrame)&&yr(r)&&(x=!1)},dropBuffer$2:function(){if(i.length>0){let e=i.findIndex((e=>gr(e.isIFrame)&&e.type===oe));if(si.isAllIframeInBufferList())for(let t=0;t=si.getNotDroppingDelayTs()){si.debugLog("worker",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${n} and notDroppingDelayTs is ${si.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){si.isPushDropping=!0,postMessage({cmd:H});const t=i.length;i=i.slice(e);const r=i.shift();si.resetAllDelay(),si.getDelay(r.ts,r.type),si.doDecode(r),si.isPushDropping=!1,si.debugLog("worker",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,new bufferList is ${i.length} and new delay is ${si.delay} `)}else si.isPushDropping=!1}0===i.length&&(si.isPushDropping=!1)},demuxM7s:function(e){const t=new DataView(e),r=t.getUint32(1,!1),i=t.getUint8(0),n=new ArrayBuffer(4),s=new Uint32Array(n);switch(i){case ae:si.decode(new Uint8Array(e,5),{type:ae,ts:r});break;case oe:if(t.byteLength>=11){const i=new Uint8Array(e,5),n=i[0];if(si._isEnhancedH265Header(n))si._decodeEnhancedH265Video(i,r);else{const e=t.getUint8(5)>>4==1;if(e&&(si.calcIframeIntervalTimestamp(r),_r(i)&&null===si.isHevc)){const e=15&i[0];si.isHevc=e===Re}si.isPlayer&&si.calcNetworkDelay(r),s[0]=i[4],s[1]=i[3],s[2]=i[2],s[3]=0;let n=s[0],a=si.cryptoPayload(i,e);si.decode(a,{type:oe,ts:r,isIFrame:e,cts:n})}}else si.debugWarn("worker",`demuxM7s() type is video and arrayBuffer length is ${e.byteLength} and return`)}},demuxNakedFlow:function(e){Or.dispatch(e)},demuxFmp4:function(e){Gr.dispatch(e)},demuxMpeg4:function(e){jr.dispatch(e)},demuxTs:function(e){ii.dispatch(e)},_decodeEnhancedH265Video:function(e,t){const r=e[0],i=48&r,n=15&r,s=e.slice(1,5),a=new ArrayBuffer(4),o=new Uint32Array(a),d="a"==String.fromCharCode(s[0]);if(si.isHevc=yr(d),n===Rt){if(i===Nt){const r=e.slice(5);if(d);else{const i=new Uint8Array(5+r.length);i.set([28,0,0,0,0],0),i.set(r,5),sr=rr(e,si.isHevc),si.debugLog("worker",`demuxFlv() isVideoSequenceHeader(enhancedH265) is true and isHevc is ${si.isHevc} and nalUnitSize is ${sr}`),si.decode(i,{type:oe,ts:t,isIFrame:!0,cts:0})}}}else if(n===Mt){let r=e,n=0;const s=i===Nt;s&&si.calcIframeIntervalTimestamp(t),d||(o[0]=e[4],o[1]=e[3],o[2]=e[2],o[3]=0,n=o[0],r=Kr(e.slice(8),s),r=si.cryptoPayload(r,s),si.decode(r,{type:oe,ts:t,isIFrame:s,cts:n}))}else if(n===zt){const r=i===Nt;r&&si.calcIframeIntervalTimestamp(t);let n=Kr(e.slice(5),r);n=si.cryptoPayload(n,r),si.decode(n,{type:oe,ts:t,isIFrame:r,cts:0})}},_isEnhancedH265Header:function(e){return(e&It)===It},findSei:function(e,t){let r=4;dr(sr)&&(r=sr),er(e.slice(5),r).forEach((e=>{const r=si.isHevc?e[0]>>>1&63:31&e[0];(si.isHevc&&(r===ft||r===ht)||yr(si.isHevc)&&r===Ke)&&postMessage({cmd:Z,buffer:e,ts:t},[e.buffer])}))},calcNetworkDelay:function(e){if(!(x&&e>0))return;null===Qe?(Qe=e,tt=ir()):et?r-t:0;si.networkDelay=i,i>si._opt.networkDelay&&si._opt.playType===v&&(si.debugWarn("worker",`calcNetworkDelay now dts:${e}, start dts is ${Qe} vs start is ${t},local diff is ${r} ,delay is ${i}`),postMessage({cmd:O,type:De,value:i}))},calcIframeIntervalTimestamp:function(e){null===$t?$t=e:$t=si._opt.playbackForwardMaxRateDecodeIFrame&&!(si._opt.useMSE&&si._opt.mseDecodeAudio)},isPlayUseMSE:function(){return si.isPlayer&&si._opt.useMSE&&gr(r)},isPlayUseMSEAndDecoderInWorker:function(){return si.isPlayUseMSE()&&si._opt.mseDecoderUseWorker},isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio:function(){return si.isPlayUseMSEAndDecoderInWorker()&&si._opt.mseDecodeAudio},playbackUpdatePlaybackRate:function(){yr(si.isPlaybackCacheBeforeDecodeForFpsRender())&&si.clearBuffer(!0)},onOffscreenCanvasWebglContextLost:function(e){si.debugError("worker","handleOffscreenCanvasWebglContextLost and next try to create webgl"),e.preventDefault(),Wt=!0,si.webglObj.destroy(),si.webglObj=null,si.offscreenCanvasGL=null,setTimeout((()=>{si.offscreenCanvasGL=si.offscreenCanvas.getContext("webgl"),si.offscreenCanvasGL&&si.offscreenCanvasGL.getContextAttributes().stencil?(si.webglObj=p(si.offscreenCanvasGL,si._opt.openWebglAlignment),Wt=!1):si.debugError("worker","handleOffscreenCanvasWebglContextLost, stencil is false")}),500)},onOffscreenCanvasWebglContextRestored:function(e){si.debugLog("worker","handleOffscreenCanvasWebglContextRestored"),e.preventDefault()},videoInfo:function(e,t,r){postMessage({cmd:R,code:e}),postMessage({cmd:k,w:t,h:r}),h=t,f=r,si.useOffscreen()&&(si.offscreenCanvas=new OffscreenCanvas(t,r),si.offscreenCanvasGL=si.offscreenCanvas.getContext("webgl"),si.webglObj=p(si.offscreenCanvasGL,si._opt.openWebglAlignment),si.offscreenCanvas.addEventListener("webglcontextlost",si.onOffscreenCanvasWebglContextLost,!1),si.offscreenCanvas.addEventListener("webglcontextrestored",si.onOffscreenCanvasWebglContextRestored,!1))},audioInfo:function(e,t,r){postMessage({cmd:L,code:e}),postMessage({cmd:P,sampleRate:t,channels:r,depth:wr}),Tt=r},yuvData:function(t,r){if(si.isDestroyed)return void si.debugLog("worker","yuvData, decoder is destroyed and return");const i=h*f*3/2;let n=e.HEAPU8.subarray(t,t+i),s=new Uint8Array(n);if(ut=null,Ee=r,si.useOffscreen())try{if(Wt)return;si.webglObj.renderYUV(h,f,s);let e=si.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:e,delay:si.delay,ts:r},[e])}catch(e){si.debugError("worker","yuvData, transferToImageBitmap error is",e,e.toString())}else postMessage({cmd:C,output:s,delay:si.delay,ts:r},[s.buffer])},pcmData:function(e,r,i){if(si.isDestroyed)return void si.debugLog("worker","pcmData, decoder is destroyed and return");let s=r,a=[],o=0,d=si._opt.audioBufferSize;for(let r=0;r<2;r++){let i=t.HEAPU32[(e>>2)+r]>>2;a[r]=t.HEAPF32.subarray(i,i+s)}if(Ut){if(!(s>=(r=d-Ut)))return Ut+=s,n[0]=Float32Array.of(...n[0],...a[0]),void(2==Tt&&(n[1]=Float32Array.of(...n[1],...a[1])));it[0]=Float32Array.of(...n[0],...a[0].subarray(0,r)),2==Tt&&(it[1]=Float32Array.of(...n[1],...a[1].subarray(0,r))),postMessage({cmd:D,buffer:it,ts:i},it.map((e=>e.buffer))),o=r,s-=r}for(Ut=s;Ut>=d;Ut-=d)it[0]=a[0].slice(o,o+=d),2==Tt&&(it[1]=a[1].slice(o-d,o)),postMessage({cmd:D,buffer:it,ts:i},it.map((e=>e.buffer)));Ut&&(n[0]=a[0].slice(o),2==Tt&&(n[1]=a[1].slice(o))),a=[]},errorInfo:function(e){null===ut&&(ut=ir());const t=ir(),r=nr(At>0?2*At:5e3,1e3,5e3),i=t-ut;i>r&&(si.debugWarn("worker",`errorInfo() emit simdDecodeError and\n iframeIntervalTimestamp is ${At} and diff is ${i} and maxDiff is ${r}\n and replay`),Qt=!0,postMessage({cmd:q}))},sendWebsocketMessage:function(e){o?o.readyState===Fe?o.send(e):si.debugError("worker","socket is not open"):si.debugError("worker","socket is null")},timeEnd:function(){si.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),si.close(),postMessage({cmd:W})},postStreamToMain(e,t){postMessage({cmd:X,type:t,buffer:e},[e.buffer])},updatePlaybackIsPause(e){si.debugLog("worker",`updatePlaybackIsPause, isPause is ${e}`),gr(e)?si.clearPlaybackCacheLoop():si.startPlaybackCacheLoop()},debugLog(e){if(si._opt.debug&&si.debug){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:{};var t,i,n;(n=e).ready=new Promise(((e,r)=>{t=e,i=r})),(n=void 0!==n?n:{}).locateFile=function(e){return"decoder-pro-simd.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_SIMD_WASM_URL&&""!=JESSIBUCA_PRO_SIMD_WASM_URL?JESSIBUCA_PRO_SIMD_WASM_URL:e};var s,a,o,d=Object.assign({},n),l="object"==typeof window,c="function"==typeof importScripts,u="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,h="";function f(e){return n.locateFile?n.locateFile(e,h):h+e}if(u){const{createRequire:e}=await import("module");var p=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href),m=p("fs"),_=p("path");h=c?_.dirname(h)+"/":p("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href)),s=(e,t)=>(e=Y(e)?new URL(e):_.normalize(e),m.readFileSync(e,t?void 0:"utf8")),o=e=>{var t=s(e,!0);return t.buffer||(t=new Uint8Array(t)),t},a=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=Y(e)?new URL(e):_.normalize(e),m.readFile(e,i?void 0:"utf8",((e,n)=>{e?r(e):t(i?n.buffer:n)}))},!n.thisProgram&&process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),n.inspect=()=>"[Emscripten Module object]"}else(l||c)&&(c?h=self.location.href:"undefined"!=typeof document&&document.currentScript&&(h=document.currentScript.src),r&&(h=r),h=0!==h.indexOf("blob:")?h.substr(0,h.replace(/[?#].*/,"").lastIndexOf("/")+1):"",s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},c&&(o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),a=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var g,y,v=n.print||console.log.bind(console),b=n.printErr||console.error.bind(console);Object.assign(n,d),d=null,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.quit&&n.quit,n.wasmBinary&&(g=n.wasmBinary),"object"!=typeof WebAssembly&&W("no native wasm support detected");var w,S,E,A,U,B,x,T,k=!1;function C(){var e=y.buffer;n.HEAP8=w=new Int8Array(e),n.HEAP16=E=new Int16Array(e),n.HEAPU8=S=new Uint8Array(e),n.HEAPU16=A=new Uint16Array(e),n.HEAP32=U=new Int32Array(e),n.HEAPU32=B=new Uint32Array(e),n.HEAPF32=x=new Float32Array(e),n.HEAPF64=T=new Float64Array(e)}var D=[],P=[],L=[];function F(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)M(n.preRun.shift());ee(D)}function I(){ee(P)}function R(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)N(n.postRun.shift());ee(L)}function M(e){D.unshift(e)}function z(e){P.unshift(e)}function N(e){L.unshift(e)}var $=0,O=null;function G(e){$++,n.monitorRunDependencies&&n.monitorRunDependencies($)}function H(e){if($--,n.monitorRunDependencies&&n.monitorRunDependencies($),0==$&&O){var t=O;O=null,t()}}function W(e){n.onAbort&&n.onAbort(e),b(e="Aborted("+e+")"),k=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}var V,j="data:application/octet-stream;base64,",q=e=>e.startsWith(j),Y=e=>e.startsWith("file://");function K(e){if(e==V&&g)return new Uint8Array(g);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}function X(e){if(!g&&(l||c)){if("function"==typeof fetch&&!Y(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>K(e)));if(a)return new Promise(((t,r)=>{a(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>K(e)))}function Z(e,t,r){return X(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{b(`failed to asynchronously prepare wasm: ${e}`),W(e)}))}function J(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||q(t)||Y(t)||u||"function"!=typeof fetch?Z(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return b(`wasm streaming compile failed: ${e}`),b("falling back to ArrayBuffer instantiation"),Z(t,r,i)}))))}function Q(){var e={a:Ar};function t(e,t){return Ur=e.exports,y=Ur.C,C(),rt=Ur.G,z(Ur.D),H(),Ur}if(G(),n.instantiateWasm)try{return n.instantiateWasm(e,t)}catch(e){b(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return J(g,V,e,(function(e){t(e.instance)})).catch(i),{}}n.locateFile?q(V="decoder-pro-simd.wasm")||(V=f(V)):V=new URL("decoder-pro-simd.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href).href;var ee=e=>{for(;e.length>0;)e.shift()(n)};function te(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){B[this.ptr+4>>2]=e},this.get_type=function(){return B[this.ptr+4>>2]},this.set_destructor=function(e){B[this.ptr+8>>2]=e},this.get_destructor=function(){return B[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,w[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=w[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,w[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=w[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){B[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return B[this.ptr+16>>2]},this.get_exception_ptr=function(){if(kr(this.get_type()))return B[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}n.noExitRuntime;var re,ie,ne,se=(e,t,r)=>{throw new te(e).init(t,r),e},ae=(e,t,r,i,n)=>{},oe=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);re=e},de=e=>{for(var t="",r=e;S[r];)t+=re[S[r++]];return t},le={},ce={},ue={},he=e=>{throw new ie(e)},fe=e=>{throw new ne(e)},pe=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&fe("Mismatched type converter count");for(var n=0;n{ce.hasOwnProperty(e)?n[t]=ce[e]:(s.push(e),le.hasOwnProperty(e)||(le[e]=[]),le[e].push((()=>{n[t]=ce[e],++a===s.length&&i(n)})))})),0===s.length&&i(n)};function me(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||he(`type "${i}" must have a positive integer typeid pointer`),ce.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;he(`Cannot register type '${i}' twice`)}if(ce[e]=t,delete ue[e],le.hasOwnProperty(e)){var n=le[e];delete le[e],n.forEach((e=>e()))}}function _e(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return me(e,t,r)}var ge,ye=8,ve=(e,t,r,i)=>{_e(e,{name:t=de(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:ye,readValueFromPointer:function(e){return this.fromWireType(S[e])},destructorFunction:null})},be=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),we=e=>{he(e.$$.ptrType.registeredClass.name+" instance already deleted")},Se=!1,Ee=e=>{},Ae=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},Ue=e=>{e.count.value-=1,0===e.count.value&&Ae(e)},Be=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=Be(e,t,r.baseClass);return null===i?null:r.downcast(i)},xe={},Te=()=>Object.keys(Fe).length,ke=()=>{var e=[];for(var t in Fe)Fe.hasOwnProperty(t)&&e.push(Fe[t]);return e},Ce=[],De=()=>{for(;Ce.length;){var e=Ce.pop();e.$$.deleteScheduled=!1,e.delete()}},Pe=e=>{ge=e,Ce.length&&ge&&ge(De)},Le=()=>{n.getInheritedInstanceCount=Te,n.getLiveInheritedInstances=ke,n.flushPendingDeletes=De,n.setDelayFunction=Pe},Fe={},Ie=(e,t)=>{for(void 0===t&&he("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},Re=(e,t)=>(t=Ie(e,t),Fe[t]),Me=(e,t)=>(t.ptrType&&t.ptr||fe("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&fe("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Ne(Object.create(e,{$$:{value:t}})));function ze(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=Re(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?Me(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Me(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,a=this.registeredClass.getActualType(t),o=xe[a];if(!o)return n.call(this);s=this.isConst?o.constPointerType:o.pointerType;var d=Be(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?Me(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):Me(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}var Ne=e=>"undefined"==typeof FinalizationRegistry?(Ne=e=>e,e):(Se=new FinalizationRegistry((e=>{Ue(e.$$)})),Ne=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};Se.register(e,r,e)}return e},Ee=e=>Se.unregister(e),Ne(e)),$e=()=>{Object.assign(Oe.prototype,{isAliasOf(e){if(!(this instanceof Oe))return!1;if(!(e instanceof Oe))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n},clone(){if(this.$$.ptr||we(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Ne(Object.create(Object.getPrototypeOf(this),{$$:{value:be(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||we(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&he("Object already scheduled for deletion"),Ee(this),Ue(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||we(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&he("Object already scheduled for deletion"),Ce.push(this),1===Ce.length&&ge&&ge(De),this.$$.deleteScheduled=!0,this}})};function Oe(){}var Ge=(e,t)=>Object.defineProperty(t,"name",{value:e}),He=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||he(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},We=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&he(`Cannot register public name '${e}' twice`),He(n,e,e),n.hasOwnProperty(r)&&he(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,void 0!==r&&(n[e].numArguments=r))},Ve=48,je=57,qe=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=Ve&&t<=je?`_${e}`:e};function Ye(e,t,r,i,n,s,a,o){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=a,this.downcast=o,this.pureVirtualFunctions=[]}var Ke=(e,t,r)=>{for(;t!==r;)t.upcast||he(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function Xe(e,t){if(null===t)return this.isReference&&he(`null is not a valid ${this.name}`),0;t.$$||he(`Cannot pass "${Pt(t)}" as a ${this.name}`),t.$$.ptr||he(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ke(t.$$.ptr,r,this.registeredClass)}function Ze(e,t){var r;if(null===t)return this.isReference&&he(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||he(`Cannot pass "${Pt(t)}" as a ${this.name}`),t.$$.ptr||he(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&he(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=Ke(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&he("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:he(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,Tt.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:he("Unsupporting sharing policy")}return r}function Je(e,t){if(null===t)return this.isReference&&he(`null is not a valid ${this.name}`),0;t.$$||he(`Cannot pass "${Pt(t)}" as a ${this.name}`),t.$$.ptr||he(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&he(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ke(t.$$.ptr,r,this.registeredClass)}function Qe(e){return this.fromWireType(B[e>>2])}var et=()=>{Object.assign(tt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:ye,readValueFromPointer:Qe,deleteObject(e){null!==e&&e.delete()},fromWireType:ze})};function tt(e,t,r,i,n,s,a,o,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=a,this.rawGetPointee=o,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=Ze:i?(this.toWireType=Xe,this.destructorFunction=null):(this.toWireType=Je,this.destructorFunction=null)}var rt,it,nt=(e,t,r)=>{n.hasOwnProperty(e)||fe("Replacing nonexistant public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},st=(e,t,r)=>{var i=n["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},at=[],ot=e=>{var t=at[e];return t||(e>=at.length&&(at.length=e+1),at[e]=t=rt.get(e)),t},dt=(e,t,r)=>e.includes("j")?st(e,t,r):ot(t).apply(null,r),lt=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),dt(e,t,r)}},ct=(e,t)=>{var r=(e=de(e)).includes("j")?lt(e,t):ot(t);return"function"!=typeof r&&he(`unknown function pointer with signature ${e}: ${t}`),r},ut=(e,t)=>{var r=Ge(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},ht=e=>{var t=Tr(e),r=de(t);return Br(t),r},ft=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||ce[t]||(ue[t]?ue[t].forEach(e):(r.push(t),i[t]=!0))})),new it(`${e}: `+r.map(ht).join([", "]))},pt=(e,t,r,i,n,s,a,o,d,l,c,u,h)=>{c=de(c),s=ct(n,s),o&&(o=ct(a,o)),l&&(l=ct(d,l)),h=ct(u,h);var f=qe(c);We(f,(function(){ft(`Cannot construct ${c} due to unbound types`,[i])})),pe([e,t,r],i?[i]:[],(function(t){var r,n;t=t[0],n=i?(r=t.registeredClass).instancePrototype:Oe.prototype;var a=Ge(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new ie("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new ie(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new ie(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(n,{constructor:{value:a}});a.prototype=d;var u=new Ye(c,a,d,h,r,s,o,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new tt(c,u,!0,!1,!1),m=new tt(c+"*",u,!1,!1,!1),_=new tt(c+" const*",u,!1,!0,!1);return xe[e]={pointerType:m,constPointerType:_},nt(f,a),[p,m,_]}))},mt=(e,t)=>{for(var r=[],i=0;i>2]);return r},_t=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function gt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=Ge(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function yt(e,t,r,i,n,s){var a=t.length;a<2&&he("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||s?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=o?1:2;l{var a=mt(t,r);n=ct(i,n),pe([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new ie(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{ft(`Cannot construct ${e.name} due to unbound types`,a)},pe([],a,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=yt(r,i,null,n,s),[]))),[]}))},bt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},wt=(e,t,r,i,n,s,a,o,d)=>{var l=mt(r,i);t=de(t),t=bt(t),s=ct(n,s),pe([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function n(){ft(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,c[t]=n):(He(c,t,i),c[t].overloadTable[r-2]=n),pe([],l,(function(n){var o=yt(i,n,e,s,a,d);return void 0===c[t].overloadTable?(o.argCount=r-2,c[t]=o):c[t].overloadTable[r-2]=o,[]})),[]}))};function St(){Object.assign(Et.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function Et(){this.allocated=[void 0],this.freelist=[]}var At=new Et,Ut=e=>{e>=At.reserved&&0==--At.get(e).refcount&&At.free(e)},Bt=()=>{for(var e=0,t=At.reserved;t{At.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),At.reserved=At.allocated.length,n.count_emval_handles=Bt},Tt={toValue:e=>(e||he("Cannot use deleted val. handle = "+e),At.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return At.allocate({refcount:1,value:e})}}};function kt(e){return this.fromWireType(U[e>>2])}var Ct,Dt=(e,t)=>{_e(e,{name:t=de(t),fromWireType:e=>{var t=Tt.toValue(e);return Ut(e),t},toWireType:(e,t)=>Tt.toHandle(t),argPackAdvance:ye,readValueFromPointer:kt,destructorFunction:null})},Pt=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},Lt=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(x[e>>2])};case 8:return function(e){return this.fromWireType(T[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Ft=(e,t,r)=>{_e(e,{name:t=de(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:ye,readValueFromPointer:Lt(t,r),destructorFunction:null})},It=(e,t,r)=>{switch(t){case 1:return r?e=>w[e>>0]:e=>S[e>>0];case 2:return r?e=>E[e>>1]:e=>A[e>>1];case 4:return r?e=>U[e>>2]:e=>B[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Rt=(e,t,r,i,n)=>{t=de(t);var s=e=>e;if(0===i){var a=32-8*r;s=e=>e<>>a}var o=t.includes("unsigned");_e(e,{name:t,fromWireType:s,toWireType:o?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:ye,readValueFromPointer:It(t,r,0!==i),destructorFunction:null})},Mt=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=B[e>>2],r=B[e+4>>2];return new i(w.buffer,r,t)}_e(e,{name:r=de(r),fromWireType:n,argPackAdvance:ye,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},zt=(e,t,r,i)=>{if(!(i>0))return 0;for(var n=r,s=r+i-1,a=0;a=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a)),o<=127){if(r>=s)break;t[r++]=o}else if(o<=2047){if(r+1>=s)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=s)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=s)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o}}return t[r]=0,r-n},Nt=(e,t,r)=>zt(e,S,t,r),$t=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},Ot="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,Gt=(e,t,r)=>{for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&Ot)return Ot.decode(e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&a)<<6|o)}else s+=String.fromCharCode(a)}return s},Ht=(e,t)=>e?Gt(S,e,t):"",Wt=(e,t)=>{var r="std::string"===(t=de(t));_e(e,{name:t,fromWireType(e){var t,i=B[e>>2],n=e+4;if(r)for(var s=n,a=0;a<=i;++a){var o=n+a;if(a==i||0==S[o]){var d=Ht(s,o-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=o+1}}else{var l=new Array(i);for(a=0;a>2]=i,r&&n)Nt(t,a,i+1);else if(n)for(var o=0;o255&&(Br(a),he("String has UTF-16 code units that do not fit in 8 bits")),S[a+o]=d}else for(o=0;o{for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&A[i];)++i;if((r=i<<1)-e>32&&Vt)return Vt.decode(S.subarray(e,r));for(var s="",a=0;!(a>=t/2);++a){var o=E[e+2*a>>1];if(0==o)break;s+=String.fromCharCode(o)}return s},qt=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=a,t+=2}return E[t>>1]=0,t-i},Yt=e=>2*e.length,Kt=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var n=U[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i},Xt=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++s)),U[t>>2]=a,(t+=4)+4>n)break}return U[t>>2]=0,t-i},Zt=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},Jt=(e,t,r)=>{var i,n,s,a,o;r=de(r),2===t?(i=jt,n=qt,a=Yt,s=()=>A,o=1):4===t&&(i=Kt,n=Xt,a=Zt,s=()=>B,o=2),_e(e,{name:r,fromWireType:e=>{for(var r,n=B[e>>2],a=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==a[c>>o]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return Br(e),r},toWireType:(e,i)=>{"string"!=typeof i&&he(`Cannot pass non-string to C++ string type ${r}`);var s=a(i),d=xr(4+s+t);return B[d>>2]=s>>o,n(i,d+4,s+t),null!==e&&e.push(Br,d),d},argPackAdvance:ye,readValueFromPointer:kt,destructorFunction(e){Br(e)}})},Qt=(e,t)=>{_e(e,{isVoid:!0,name:t=de(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},er={},tr=e=>{var t=er[e];return void 0===t?de(e):t},rr=[],ir=(e,t,r,i,n)=>(e=rr[e])(t=Tt.toValue(t),t[r=tr(r)],i,n),nr=e=>{var t=rr.length;return rr.push(e),t},sr=(e,t)=>{var r=ce[e];return void 0===r&&he(t+" has unknown type "+ht(e)),r},ar=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},or=(e,t,r)=>{var i=[],n=e.toWireType(i,r);return i.length&&(B[t>>2]=Tt.toHandle(i)),n},dr=(e,t,r)=>{var i=ar(e,t),n=i.shift();e--;var s="return function (obj, func, destructorsRef, args) {\n",a=0,o=[];0===r&&o.push("obj");for(var d=["retType"],l=[n],c=0;ce.name)).join(", ")}) => ${n.name}>`;return nr(Ge(h,u))},lr=e=>{e>4&&(At.get(e).refcount+=1)},cr=e=>Tt.toHandle(tr(e)),ur=()=>Tt.toHandle({}),hr=e=>Tt.toHandle(Ht(e)),fr=e=>{var t=Tt.toValue(e);_t(t),Ut(e)},pr=(e,t,r)=>{e=Tt.toValue(e),t=Tt.toValue(t),r=Tt.toValue(r),e[t]=r},mr=(e,t)=>{var r=(e=sr(e,"_emval_take_value")).readValueFromPointer(t);return Tt.toHandle(r)},_r=()=>{W("")};Ct=()=>performance.now();var gr=(e,t,r)=>S.copyWithin(e,t,t+r),yr=e=>{W("OOM")},vr=e=>{S.length,yr()},br=[null,[],[]],wr=(e,t)=>{var r=br[e];0===t||10===t?((1===e?v:b)(Gt(r,0)),r.length=0):r.push(t)},Sr=(e,t,r,i)=>{for(var n=0,s=0;s>2],o=B[t+4>>2];t+=8;for(var d=0;d>2]=n,0};oe(),ie=n.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},ne=n.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},$e(),Le(),et(),it=n.UnboundTypeError=ut(Error,"UnboundTypeError"),St(),xt();var Er,Ar={o:se,r:ae,x:ve,q:pt,p:vt,h:wt,w:Dt,k:Ft,b:Rt,a:Mt,l:Wt,i:Jt,y:Qt,g:ir,c:Ut,f:dr,z:lr,m:cr,B:ur,v:hr,e:fr,n:pr,A:mr,j:_r,d:Ct,u:gr,s:vr,t:Sr},Ur=Q(),Br=e=>(Br=Ur.E)(e),xr=e=>(xr=Ur.F)(e),Tr=e=>(Tr=Ur.H)(e),kr=e=>(kr=Ur.I)(e);function Cr(){function e(){Er||(Er=!0,n.calledRun=!0,k||(I(),t(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),R()))}$>0||(F(),$>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.dynCall_jiji=(e,t,r,i,s)=>(n.dynCall_jiji=Ur.J)(e,t,r,i,s),n.___start_em_js=143452,n.___stop_em_js=143509,O=function e(){Er||Cr(),Er||(O=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return Cr(),e.ready}),a=(()=>{var e="undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href;return async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var r,i,n;(n=t).ready=new Promise(((e,t)=>{r=e,i=t})),(n=void 0!==n?n:{}).locateFile=function(e){return"decoder-pro-audio.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_AUDIO_WASM_URL&&""!=JESSIBUCA_PRO_AUDIO_WASM_URL?JESSIBUCA_PRO_AUDIO_WASM_URL:e};var s,a,o,d=Object.assign({},n),l="./this.program",c="object"==typeof window,u="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";function p(e){return n.locateFile?n.locateFile(e,f):f+e}if(h){const{createRequire:e}=await import("module");var m=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href),_=m("fs"),g=m("path");f=u?g.dirname(f)+"/":m("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href)),s=(e,t)=>(e=J(e)?new URL(e):g.normalize(e),_.readFileSync(e,t?void 0:"utf8")),o=e=>{var t=s(e,!0);return t.buffer||(t=new Uint8Array(t)),t},a=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=J(e)?new URL(e):g.normalize(e),_.readFile(e,i?void 0:"utf8",((e,n)=>{e?r(e):t(i?n.buffer:n)}))},!n.thisProgram&&process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),n.inspect=()=>"[Emscripten Module object]"}else(c||u)&&(u?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),e&&(f=e),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},u&&(o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),a=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var y,v,b=n.print||console.log.bind(console),w=n.printErr||console.error.bind(console);Object.assign(n,d),d=null,n.arguments&&n.arguments,n.thisProgram&&(l=n.thisProgram),n.quit&&n.quit,n.wasmBinary&&(y=n.wasmBinary),"object"!=typeof WebAssembly&&j("no native wasm support detected");var S,E,A,U,B,x,T,k,C=!1;function D(e,t){e||j(t)}function P(){var e=v.buffer;n.HEAP8=S=new Int8Array(e),n.HEAP16=A=new Int16Array(e),n.HEAPU8=E=new Uint8Array(e),n.HEAPU16=U=new Uint16Array(e),n.HEAP32=B=new Int32Array(e),n.HEAPU32=x=new Uint32Array(e),n.HEAPF32=T=new Float32Array(e),n.HEAPF64=k=new Float64Array(e)}var L=[],F=[],I=[];function R(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)N(n.preRun.shift());ne(L)}function M(){n.noFSInit||ke.init.initialized||ke.init(),ke.ignorePermissions=!1,ne(F)}function z(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)O(n.postRun.shift());ne(I)}function N(e){L.unshift(e)}function $(e){F.unshift(e)}function O(e){I.unshift(e)}var G=0,H=null;function W(e){G++,n.monitorRunDependencies&&n.monitorRunDependencies(G)}function V(e){if(G--,n.monitorRunDependencies&&n.monitorRunDependencies(G),0==G&&H){var t=H;H=null,t()}}function j(e){n.onAbort&&n.onAbort(e),w(e="Aborted("+e+")"),C=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}var q,Y,K,X="data:application/octet-stream;base64,",Z=e=>e.startsWith(X),J=e=>e.startsWith("file://");function Q(e){if(e==q&&y)return new Uint8Array(y);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}function ee(e){if(!y&&(c||u)){if("function"==typeof fetch&&!J(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>Q(e)));if(a)return new Promise(((t,r)=>{a(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>Q(e)))}function te(e,t,r){return ee(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{w(`failed to asynchronously prepare wasm: ${e}`),j(e)}))}function re(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||Z(t)||J(t)||h||"function"!=typeof fetch?te(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return w(`wasm streaming compile failed: ${e}`),w("falling back to ArrayBuffer instantiation"),te(t,r,i)}))))}function ie(){var e={a:ni};function t(e,t){return si=e.exports,v=si.E,P(),Lt=si.H,$(si.F),V(),si}if(W(),n.instantiateWasm)try{return n.instantiateWasm(e,t)}catch(e){w(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return re(y,q,e,(function(e){t(e.instance)})).catch(i),{}}n.locateFile?Z(q="decoder-pro-audio.wasm")||(q=p(q)):q=new URL("decoder-pro-audio.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href).href;var ne=e=>{for(;e.length>0;)e.shift()(n)};function se(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){x[this.ptr+4>>2]=e},this.get_type=function(){return x[this.ptr+4>>2]},this.set_destructor=function(e){x[this.ptr+8>>2]=e},this.get_destructor=function(){return x[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,S[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=S[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,S[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=S[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){x[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return x[this.ptr+16>>2]},this.get_exception_ptr=function(){if(ci(this.get_type()))return x[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}n.noExitRuntime;var ae=(e,t,r)=>{throw new se(e).init(t,r),e},oe=e=>(B[oi()>>2]=e,e),de={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=de.isAbs(e),r="/"===e.substr(-1);return(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=de.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=de.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return de.normalize(e.join("/"))},join2:(e,t)=>de.normalize(e+"/"+t)},le=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}j("initRandomDevice")},ce=e=>(ce=le())(e),ue={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:ke.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=de.isAbs(i)}return(t?"/":"")+(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=ue.resolve(e).substr(1),t=ue.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),s=Math.min(i.length,n.length),a=s,o=0;o{for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&he)return he.decode(e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&a)<<6|o)}else s+=String.fromCharCode(a)}return s},pe=[],me=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},_e=(e,t,r,i)=>{if(!(i>0))return 0;for(var n=r,s=r+i-1,a=0;a=55296&&o<=57343)o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a);if(o<=127){if(r>=s)break;t[r++]=o}else if(o<=2047){if(r+1>=s)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=s)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=s)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o}}return t[r]=0,r-n};function ge(e,t,r){var i=r>0?r:me(e)+1,n=new Array(i),s=_e(e,n,0,n.length);return t&&(n.length=s),n}var ye=()=>{if(!pe.length){var e=null;if(h){var t=Buffer.alloc(256),r=0,i=process.stdin.fd;try{r=_.readSync(i,t)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}e=r>0?t.slice(0,r).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;pe=ge(e,!0)}return pe.shift()},ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},ke.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new ke.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new ke.ErrnoError(60);for(var s=0,a=0;aye(),put_char(e,t){null===t||10===t?(b(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(b(fe(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(w(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(w(fe(e.output,0)),e.output=[])}}},be=e=>{j()},we={ops_table:null,mount:e=>we.createNode(null,"/",16895,0),createNode(e,t,r,i){if(ke.isBlkdev(r)||ke.isFIFO(r))throw new ke.ErrnoError(63);we.ops_table||(we.ops_table={dir:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,lookup:we.node_ops.lookup,mknod:we.node_ops.mknod,rename:we.node_ops.rename,unlink:we.node_ops.unlink,rmdir:we.node_ops.rmdir,readdir:we.node_ops.readdir,symlink:we.node_ops.symlink},stream:{llseek:we.stream_ops.llseek}},file:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:{llseek:we.stream_ops.llseek,read:we.stream_ops.read,write:we.stream_ops.write,allocate:we.stream_ops.allocate,mmap:we.stream_ops.mmap,msync:we.stream_ops.msync}},link:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,readlink:we.node_ops.readlink},stream:{}},chrdev:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:ke.chrdev_stream_ops}});var n=ke.createNode(e,t,r,i);return ke.isDir(n.mode)?(n.node_ops=we.ops_table.dir.node,n.stream_ops=we.ops_table.dir.stream,n.contents={}):ke.isFile(n.mode)?(n.node_ops=we.ops_table.file.node,n.stream_ops=we.ops_table.file.stream,n.usedBytes=0,n.contents=null):ke.isLink(n.mode)?(n.node_ops=we.ops_table.link.node,n.stream_ops=we.ops_table.link.stream):ke.isChrdev(n.mode)&&(n.node_ops=we.ops_table.chrdev.node,n.stream_ops=we.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n,e.timestamp=n.timestamp),n},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=ke.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,ke.isDir(e.mode)?t.size=4096:ke.isFile(e.mode)?t.size=e.usedBytes:ke.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&we.resizeFileStorage(e,t.size)},lookup(e,t){throw ke.genericErrors[44]},mknod:(e,t,r,i)=>we.createNode(e,t,r,i),rename(e,t,r){if(ke.isDir(e.mode)){var i;try{i=ke.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new ke.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=ke.lookupNode(e,t);for(var i in r.contents)throw new ke.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink(e,t,r){var i=we.createNode(e,t,41471,0);return i.link=r,i},readlink(e){if(!ke.isLink(e.mode))throw new ke.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,i,n){var s=e.node.contents;if(n>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-n,i);if(a>8&&s.subarray)t.set(s.subarray(n,n+a),r);else for(var o=0;o0||r+t(we.stream_ops.write(e,t,0,i,r,!1),0)}},Se=(e,t,r,i)=>{var n=i?"":`al ${e}`;a(e,(r=>{D(r,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(r)),n&&V()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),n&&W()},Ee=(e,t,r,i,n,s)=>{ke.createDataFile(e,t,r,i,n,s)},Ae=n.preloadPlugins||[],Ue=(e,t,r,i)=>{"undefined"!=typeof Browser&&Browser.init();var n=!1;return Ae.forEach((s=>{n||s.canHandle(t)&&(s.handle(e,t,r,i),n=!0)})),n},Be=(e,t,r,i,n,s,a,o,d,l)=>{var c=t?ue.resolve(de.join2(e,t)):e;function u(r){function u(r){l&&l(),o||Ee(e,t,r,i,n,d),s&&s(),V()}Ue(r,c,u,(()=>{a&&a(),V()}))||u(r)}W(),"string"==typeof r?Se(r,(e=>u(e)),a):u(r)},xe=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t},Te=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},ke={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=ue.resolve(e)))return{path:"",node:null};if(t=Object.assign({follow_mount:!0,recurse_count:0},t),t.recurse_count>8)throw new ke.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),i=ke.root,n="/",s=0;s40)throw new ke.ErrnoError(32)}}return{path:n,node:i}},getPath(e){for(var t;;){if(ke.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,i=0;i>>0)%ke.nameTable.length},hashAddNode(e){var t=ke.hashName(e.parent.id,e.name);e.name_next=ke.nameTable[t],ke.nameTable[t]=e},hashRemoveNode(e){var t=ke.hashName(e.parent.id,e.name);if(ke.nameTable[t]===e)ke.nameTable[t]=e.name_next;else for(var r=ke.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=ke.mayLookup(e);if(r)throw new ke.ErrnoError(r,e);for(var i=ke.hashName(e.id,t),n=ke.nameTable[i];n;n=n.name_next){var s=n.name;if(n.parent.id===e.id&&s===t)return n}return ke.lookup(e,t)},createNode(e,t,r,i){var n=new ke.FSNode(e,t,r,i);return ke.hashAddNode(n),n},destroyNode(e){ke.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>ke.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){var t=ke.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{ke.lookupNode(e,t);return 20}catch(e){}return ke.nodePermissions(e,"wx")},mayDelete(e,t,r){var i;try{i=ke.lookupNode(e,t)}catch(e){return e.errno}var n=ke.nodePermissions(e,"wx");if(n)return n;if(r){if(!ke.isDir(i.mode))return 54;if(ke.isRoot(i)||ke.getPath(i)===ke.cwd())return 10}else if(ke.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?ke.isLink(e.mode)?32:ke.isDir(e.mode)&&("r"!==ke.flagsToPermissionString(t)||512&t)?31:ke.nodePermissions(e,ke.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=ke.MAX_OPEN_FDS;e++)if(!ke.streams[e])return e;throw new ke.ErrnoError(33)},getStreamChecked(e){var t=ke.getStream(e);if(!t)throw new ke.ErrnoError(8);return t},getStream:e=>ke.streams[e],createStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return ke.FSStream||(ke.FSStream=function(){this.shared={}},ke.FSStream.prototype={},Object.defineProperties(ke.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},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(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new ke.FSStream,e),-1==t&&(t=ke.nextfd()),e.fd=t,ke.streams[t]=e,e},closeStream(e){ke.streams[e]=null},chrdev_stream_ops:{open(e){var t=ke.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek(){throw new ke.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){ke.devices[e]={stream_ops:t}},getDevice:e=>ke.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),ke.syncFSRequests++,ke.syncFSRequests>1&&w(`warning: ${ke.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=ke.getMounts(ke.root.mount),i=0;function n(e){return ke.syncFSRequests--,t(e)}function s(e){if(e)return s.errored?void 0:(s.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return s(null);t.type.syncfs(t,e,s)}))},mount(e,t,r){var i,n="/"===r,s=!r;if(n&&ke.root)throw new ke.ErrnoError(10);if(!n&&!s){var a=ke.lookupPath(r,{follow_mount:!1});if(r=a.path,i=a.node,ke.isMountpoint(i))throw new ke.ErrnoError(10);if(!ke.isDir(i.mode))throw new ke.ErrnoError(54)}var o={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(o);return d.mount=o,o.root=d,n?ke.root=d:i&&(i.mounted=o,i.mount&&i.mount.mounts.push(o)),d},unmount(e){var t=ke.lookupPath(e,{follow_mount:!1});if(!ke.isMountpoint(t.node))throw new ke.ErrnoError(28);var r=t.node,i=r.mounted,n=ke.getMounts(i);Object.keys(ke.nameTable).forEach((e=>{for(var t=ke.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&ke.destroyNode(t),t=r}})),r.mounted=null;var s=r.mount.mounts.indexOf(i);r.mount.mounts.splice(s,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var i=ke.lookupPath(e,{parent:!0}).node,n=de.basename(e);if(!n||"."===n||".."===n)throw new ke.ErrnoError(28);var s=ke.mayCreate(i,n);if(s)throw new ke.ErrnoError(s);if(!i.node_ops.mknod)throw new ke.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,ke.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,ke.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),i="",n=0;n(void 0===r&&(r=t,t=438),t|=8192,ke.mknod(e,t,r)),symlink(e,t){if(!ue.resolve(e))throw new ke.ErrnoError(44);var r=ke.lookupPath(t,{parent:!0}).node;if(!r)throw new ke.ErrnoError(44);var i=de.basename(t),n=ke.mayCreate(r,i);if(n)throw new ke.ErrnoError(n);if(!r.node_ops.symlink)throw new ke.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename(e,t){var r,i,n=de.dirname(e),s=de.dirname(t),a=de.basename(e),o=de.basename(t);if(r=ke.lookupPath(e,{parent:!0}).node,i=ke.lookupPath(t,{parent:!0}).node,!r||!i)throw new ke.ErrnoError(44);if(r.mount!==i.mount)throw new ke.ErrnoError(75);var d,l=ke.lookupNode(r,a),c=ue.relative(e,s);if("."!==c.charAt(0))throw new ke.ErrnoError(28);if("."!==(c=ue.relative(t,n)).charAt(0))throw new ke.ErrnoError(55);try{d=ke.lookupNode(i,o)}catch(e){}if(l!==d){var u=ke.isDir(l.mode),h=ke.mayDelete(r,a,u);if(h)throw new ke.ErrnoError(h);if(h=d?ke.mayDelete(i,o,u):ke.mayCreate(i,o))throw new ke.ErrnoError(h);if(!r.node_ops.rename)throw new ke.ErrnoError(63);if(ke.isMountpoint(l)||d&&ke.isMountpoint(d))throw new ke.ErrnoError(10);if(i!==r&&(h=ke.nodePermissions(r,"w")))throw new ke.ErrnoError(h);ke.hashRemoveNode(l);try{r.node_ops.rename(l,i,o)}catch(e){throw e}finally{ke.hashAddNode(l)}}},rmdir(e){var t=ke.lookupPath(e,{parent:!0}).node,r=de.basename(e),i=ke.lookupNode(t,r),n=ke.mayDelete(t,r,!0);if(n)throw new ke.ErrnoError(n);if(!t.node_ops.rmdir)throw new ke.ErrnoError(63);if(ke.isMountpoint(i))throw new ke.ErrnoError(10);t.node_ops.rmdir(t,r),ke.destroyNode(i)},readdir(e){var t=ke.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new ke.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=ke.lookupPath(e,{parent:!0}).node;if(!t)throw new ke.ErrnoError(44);var r=de.basename(e),i=ke.lookupNode(t,r),n=ke.mayDelete(t,r,!1);if(n)throw new ke.ErrnoError(n);if(!t.node_ops.unlink)throw new ke.ErrnoError(63);if(ke.isMountpoint(i))throw new ke.ErrnoError(10);t.node_ops.unlink(t,r),ke.destroyNode(i)},readlink(e){var t=ke.lookupPath(e).node;if(!t)throw new ke.ErrnoError(44);if(!t.node_ops.readlink)throw new ke.ErrnoError(28);return ue.resolve(ke.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=ke.lookupPath(e,{follow:!t}).node;if(!r)throw new ke.ErrnoError(44);if(!r.node_ops.getattr)throw new ke.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>ke.stat(e,!0),chmod(e,t,r){var i;"string"==typeof e?i=ke.lookupPath(e,{follow:!r}).node:i=e;if(!i.node_ops.setattr)throw new ke.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod(e,t){ke.chmod(e,t,!0)},fchmod(e,t){var r=ke.getStreamChecked(e);ke.chmod(r.node,t)},chown(e,t,r,i){var n;"string"==typeof e?n=ke.lookupPath(e,{follow:!i}).node:n=e;if(!n.node_ops.setattr)throw new ke.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown(e,t,r){ke.chown(e,t,r,!0)},fchown(e,t,r){var i=ke.getStreamChecked(e);ke.chown(i.node,t,r)},truncate(e,t){if(t<0)throw new ke.ErrnoError(28);var r;"string"==typeof e?r=ke.lookupPath(e,{follow:!0}).node:r=e;if(!r.node_ops.setattr)throw new ke.ErrnoError(63);if(ke.isDir(r.mode))throw new ke.ErrnoError(31);if(!ke.isFile(r.mode))throw new ke.ErrnoError(28);var i=ke.nodePermissions(r,"w");if(i)throw new ke.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=ke.getStreamChecked(e);if(0==(2097155&r.flags))throw new ke.ErrnoError(28);ke.truncate(r.node,t)},utime(e,t,r){var i=ke.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new ke.ErrnoError(44);var i;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?xe(t):t)?4095&r|32768:0,"object"==typeof e)i=e;else{e=de.normalize(e);try{i=ke.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var s=!1;if(64&t)if(i){if(128&t)throw new ke.ErrnoError(20)}else i=ke.mknod(e,r,0),s=!0;if(!i)throw new ke.ErrnoError(44);if(ke.isChrdev(i.mode)&&(t&=-513),65536&t&&!ke.isDir(i.mode))throw new ke.ErrnoError(54);if(!s){var a=ke.mayOpen(i,t);if(a)throw new ke.ErrnoError(a)}512&t&&!s&&ke.truncate(i,0),t&=-131713;var o=ke.createStream({node:i,path:ke.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return o.stream_ops.open&&o.stream_ops.open(o),!n.logReadFiles||1&t||(ke.readFiles||(ke.readFiles={}),e in ke.readFiles||(ke.readFiles[e]=1)),o},close(e){if(ke.isClosed(e))throw new ke.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{ke.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(ke.isClosed(e))throw new ke.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new ke.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new ke.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,i,n){if(i<0||n<0)throw new ke.ErrnoError(28);if(ke.isClosed(e))throw new ke.ErrnoError(8);if(1==(2097155&e.flags))throw new ke.ErrnoError(8);if(ke.isDir(e.node.mode))throw new ke.ErrnoError(31);if(!e.stream_ops.read)throw new ke.ErrnoError(28);var s=void 0!==n;if(s){if(!e.seekable)throw new ke.ErrnoError(70)}else n=e.position;var a=e.stream_ops.read(e,t,r,i,n);return s||(e.position+=a),a},write(e,t,r,i,n,s){if(i<0||n<0)throw new ke.ErrnoError(28);if(ke.isClosed(e))throw new ke.ErrnoError(8);if(0==(2097155&e.flags))throw new ke.ErrnoError(8);if(ke.isDir(e.node.mode))throw new ke.ErrnoError(31);if(!e.stream_ops.write)throw new ke.ErrnoError(28);e.seekable&&1024&e.flags&&ke.llseek(e,0,2);var a=void 0!==n;if(a){if(!e.seekable)throw new ke.ErrnoError(70)}else n=e.position;var o=e.stream_ops.write(e,t,r,i,n,s);return a||(e.position+=o),o},allocate(e,t,r){if(ke.isClosed(e))throw new ke.ErrnoError(8);if(t<0||r<=0)throw new ke.ErrnoError(28);if(0==(2097155&e.flags))throw new ke.ErrnoError(8);if(!ke.isFile(e.node.mode)&&!ke.isDir(e.node.mode))throw new ke.ErrnoError(43);if(!e.stream_ops.allocate)throw new ke.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,i,n){if(0!=(2&i)&&0==(2&n)&&2!=(2097155&e.flags))throw new ke.ErrnoError(2);if(1==(2097155&e.flags))throw new ke.ErrnoError(2);if(!e.stream_ops.mmap)throw new ke.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n)},msync:(e,t,r,i,n)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new ke.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,i=ke.open(e,t.flags),n=ke.stat(e).size,s=new Uint8Array(n);return ke.read(i,s,0,n,0),"utf8"===t.encoding?r=fe(s,0):"binary"===t.encoding&&(r=s),ke.close(i),r},writeFile(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=ke.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(me(t)+1),s=_e(t,n,0,n.length);ke.write(i,n,0,s,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");ke.write(i,t,0,t.byteLength,void 0,r.canOwn)}ke.close(i)},cwd:()=>ke.currentPath,chdir(e){var t=ke.lookupPath(e,{follow:!0});if(null===t.node)throw new ke.ErrnoError(44);if(!ke.isDir(t.node.mode))throw new ke.ErrnoError(54);var r=ke.nodePermissions(t.node,"x");if(r)throw new ke.ErrnoError(r);ke.currentPath=t.path},createDefaultDirectories(){ke.mkdir("/tmp"),ke.mkdir("/home"),ke.mkdir("/home/web_user")},createDefaultDevices(){ke.mkdir("/dev"),ke.registerDevice(ke.makedev(1,3),{read:()=>0,write:(e,t,r,i,n)=>i}),ke.mkdev("/dev/null",ke.makedev(1,3)),ve.register(ke.makedev(5,0),ve.default_tty_ops),ve.register(ke.makedev(6,0),ve.default_tty1_ops),ke.mkdev("/dev/tty",ke.makedev(5,0)),ke.mkdev("/dev/tty1",ke.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=ce(e).byteLength),e[--t]);ke.createDevice("/dev","random",r),ke.createDevice("/dev","urandom",r),ke.mkdir("/dev/shm"),ke.mkdir("/dev/shm/tmp")},createSpecialDirectories(){ke.mkdir("/proc");var e=ke.mkdir("/proc/self");ke.mkdir("/proc/self/fd"),ke.mount({mount(){var t=ke.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,i=ke.getStreamChecked(r),n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return n.parent=n,n}},t}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?ke.createDevice("/dev","stdin",n.stdin):ke.symlink("/dev/tty","/dev/stdin"),n.stdout?ke.createDevice("/dev","stdout",null,n.stdout):ke.symlink("/dev/tty","/dev/stdout"),n.stderr?ke.createDevice("/dev","stderr",null,n.stderr):ke.symlink("/dev/tty1","/dev/stderr"),ke.open("/dev/stdin",0),ke.open("/dev/stdout",1),ke.open("/dev/stderr",1)},ensureErrnoError(){ke.ErrnoError||(ke.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},ke.ErrnoError.prototype=new Error,ke.ErrnoError.prototype.constructor=ke.ErrnoError,[44].forEach((e=>{ke.genericErrors[e]=new ke.ErrnoError(e),ke.genericErrors[e].stack=""})))},staticInit(){ke.ensureErrnoError(),ke.nameTable=new Array(4096),ke.mount(we,{},"/"),ke.createDefaultDirectories(),ke.createDefaultDevices(),ke.createSpecialDirectories(),ke.filesystems={MEMFS:we}},init(e,t,r){ke.init.initialized=!0,ke.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=t||n.stdout,n.stderr=r||n.stderr,ke.createStandardStreams()},quit(){ke.init.initialized=!1;for(var e=0;ethis.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},s.prototype.setDataGetter=function(e){this.getter=e},s.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,s=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,a=1048576;n||(a=i);var o=this;o.setDataGetter((e=>{var t=e*a,n=(e+1)*a-1;if(n=Math.min(n,i-1),void 0===o.chunks[e]&&(o.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==a&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):ge(n.responseText||"",!0)})(t,n)),void 0===o.chunks[e])throw new Error("doXHR failed!");return o.chunks[e]})),!s&&i||(a=i=1,i=this.getter(0).length,a=i,b("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!u)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new s;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var o={isDevice:!1,contents:a}}else o={isDevice:!1,url:r};var d=ke.createFile(e,t,o,i,n);o.contents?d.contents=o.contents:o.url&&(d.contents=null,d.url=o.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,t,r,i,n){var s=e.node.contents;if(n>=s.length)return 0;var a=Math.min(s.length-n,i);if(s.slice)for(var o=0;o{var t=d.stream_ops[e];l[e]=function(){return ke.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,n)=>(ke.forceLoadFile(d),c(e,t,r,i,n)),l.mmap=(e,t,r,i,n)=>{ke.forceLoadFile(d);var s=be();if(!s)throw new ke.ErrnoError(48);return c(e,S,s,t,r),{ptr:s,allocated:!0}},d.stream_ops=l,d}},Ce=(e,t)=>e?fe(E,e,t):"",De={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(de.isAbs(t))return t;var i;-100===e?i=ke.cwd():i=De.getStreamFromFD(e).path;if(0==t.length){if(!r)throw new ke.ErrnoError(44);return i}return de.join2(i,t)},doStat(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&de.normalize(t)!==de.normalize(ke.getPath(e.node)))return-54;throw e}B[r>>2]=i.dev,B[r+4>>2]=i.mode,x[r+8>>2]=i.nlink,B[r+12>>2]=i.uid,B[r+16>>2]=i.gid,B[r+20>>2]=i.rdev,K=[i.size>>>0,(Y=i.size,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],B[r+24>>2]=K[0],B[r+28>>2]=K[1],B[r+32>>2]=4096,B[r+36>>2]=i.blocks;var n=i.atime.getTime(),s=i.mtime.getTime(),a=i.ctime.getTime();return K=[Math.floor(n/1e3)>>>0,(Y=Math.floor(n/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],B[r+40>>2]=K[0],B[r+44>>2]=K[1],x[r+48>>2]=n%1e3*1e3,K=[Math.floor(s/1e3)>>>0,(Y=Math.floor(s/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],B[r+56>>2]=K[0],B[r+60>>2]=K[1],x[r+64>>2]=s%1e3*1e3,K=[Math.floor(a/1e3)>>>0,(Y=Math.floor(a/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],B[r+72>>2]=K[0],B[r+76>>2]=K[1],x[r+80>>2]=a%1e3*1e3,K=[i.ino>>>0,(Y=i.ino,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],B[r+88>>2]=K[0],B[r+92>>2]=K[1],0},doMsync(e,t,r,i,n){if(!ke.isFile(t.node.mode))throw new ke.ErrnoError(43);if(2&i)return 0;var s=E.slice(e,e+r);ke.msync(t,s,n,r,i)},varargs:void 0,get(){var e=B[+De.varargs>>2];return De.varargs+=4,e},getp:()=>De.get(),getStr:e=>Ce(e),getStreamFromFD:e=>ke.getStreamChecked(e)};function Pe(e,t,r){De.varargs=r;try{var i=De.getStreamFromFD(e);switch(t){case 0:if((n=De.get())<0)return-28;for(;ke.streams[n];)n++;return ke.createStream(i,n).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var n=De.get();return i.flags|=n,0;case 5:n=De.getp();return A[n+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return oe(28),-1}}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return-e.errno}}function Le(e,t,r,i){De.varargs=i;try{t=De.getStr(t),t=De.calculateAt(e,t);var n=i?De.get():0;return ke.open(t,r,n).fd}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return-e.errno}}var Fe,Ie,Re,Me=(e,t,r,i,n)=>{},ze=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Fe=e},Ne=e=>{for(var t="",r=e;E[r];)t+=Fe[E[r++]];return t},$e={},Oe={},Ge={},He=e=>{throw new Ie(e)},We=e=>{throw new Re(e)},Ve=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&We("Mismatched type converter count");for(var n=0;n{Oe.hasOwnProperty(e)?n[t]=Oe[e]:(s.push(e),$e.hasOwnProperty(e)||($e[e]=[]),$e[e].push((()=>{n[t]=Oe[e],++a===s.length&&i(n)})))})),0===s.length&&i(n)};function je(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||He(`type "${i}" must have a positive integer typeid pointer`),Oe.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;He(`Cannot register type '${i}' twice`)}if(Oe[e]=t,delete Ge[e],$e.hasOwnProperty(e)){var n=$e[e];delete $e[e],n.forEach((e=>e()))}}function qe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return je(e,t,r)}var Ye,Ke=8,Xe=(e,t,r,i)=>{qe(e,{name:t=Ne(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:Ke,readValueFromPointer:function(e){return this.fromWireType(E[e])},destructorFunction:null})},Ze=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Je=e=>{He(e.$$.ptrType.registeredClass.name+" instance already deleted")},Qe=!1,et=e=>{},tt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},rt=e=>{e.count.value-=1,0===e.count.value&&tt(e)},it=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=it(e,t,r.baseClass);return null===i?null:r.downcast(i)},nt={},st=()=>Object.keys(ut).length,at=()=>{var e=[];for(var t in ut)ut.hasOwnProperty(t)&&e.push(ut[t]);return e},ot=[],dt=()=>{for(;ot.length;){var e=ot.pop();e.$$.deleteScheduled=!1,e.delete()}},lt=e=>{Ye=e,ot.length&&Ye&&Ye(dt)},ct=()=>{n.getInheritedInstanceCount=st,n.getLiveInheritedInstances=at,n.flushPendingDeletes=dt,n.setDelayFunction=lt},ut={},ht=(e,t)=>{for(void 0===t&&He("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},ft=(e,t)=>(t=ht(e,t),ut[t]),pt=(e,t)=>(t.ptrType&&t.ptr||We("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!==!!t.smartPtr&&We("Both smartPtrType and smartPtr must be specified"),t.count={value:1},_t(Object.create(e,{$$:{value:t}})));function mt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ft(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?pt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):pt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,a=this.registeredClass.getActualType(t),o=nt[a];if(!o)return n.call(this);s=this.isConst?o.constPointerType:o.pointerType;var d=it(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}var _t=e=>"undefined"==typeof FinalizationRegistry?(_t=e=>e,e):(Qe=new FinalizationRegistry((e=>{rt(e.$$)})),_t=e=>{var t=e.$$;if(!!t.smartPtr){var r={$$:t};Qe.register(e,r,e)}return e},et=e=>Qe.unregister(e),_t(e)),gt=()=>{Object.assign(yt.prototype,{isAliasOf(e){if(!(this instanceof yt))return!1;if(!(e instanceof yt))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n},clone(){if(this.$$.ptr||Je(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=_t(Object.create(Object.getPrototypeOf(this),{$$:{value:Ze(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),et(this),rt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),ot.push(this),1===ot.length&&Ye&&Ye(dt),this.$$.deleteScheduled=!0,this}})};function yt(){}var vt=(e,t)=>Object.defineProperty(t,"name",{value:e}),bt=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||He(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},wt=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&He(`Cannot register public name '${e}' twice`),bt(n,e,e),n.hasOwnProperty(r)&&He(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,void 0!==r&&(n[e].numArguments=r))},St=48,Et=57,At=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=St&&t<=Et?`_${e}`:e};function Ut(e,t,r,i,n,s,a,o){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=a,this.downcast=o,this.pureVirtualFunctions=[]}var Bt=(e,t,r)=>{for(;t!==r;)t.upcast||He(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function xt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Bt(t.$$.ptr,r,this.registeredClass)}function Tt(e,t){var r;if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=Bt(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&He("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,sr.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:He("Unsupporting sharing policy")}return r}function kt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Bt(t.$$.ptr,r,this.registeredClass)}function Ct(e){return this.fromWireType(x[e>>2])}var Dt=()=>{Object.assign(Pt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:Ke,readValueFromPointer:Ct,deleteObject(e){null!==e&&e.delete()},fromWireType:mt})};function Pt(e,t,r,i,n,s,a,o,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=a,this.rawGetPointee=o,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=Tt:i?(this.toWireType=xt,this.destructorFunction=null):(this.toWireType=kt,this.destructorFunction=null)}var Lt,Ft,It=(e,t,r)=>{n.hasOwnProperty(e)||We("Replacing nonexistant public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},Rt=(e,t,r)=>{var i=n["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},Mt=[],zt=e=>{var t=Mt[e];return t||(e>=Mt.length&&(Mt.length=e+1),Mt[e]=t=Lt.get(e)),t},Nt=(e,t,r)=>e.includes("j")?Rt(e,t,r):zt(t).apply(null,r),$t=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),Nt(e,t,r)}},Ot=(e,t)=>{var r=(e=Ne(e)).includes("j")?$t(e,t):zt(t);return"function"!=typeof r&&He(`unknown function pointer with signature ${e}: ${t}`),r},Gt=(e,t)=>{var r=vt(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},Ht=e=>{var t=di(e),r=Ne(t);return ai(t),r},Wt=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Oe[t]||(Ge[t]?Ge[t].forEach(e):(r.push(t),i[t]=!0))})),new Ft(`${e}: `+r.map(Ht).join([", "]))},Vt=(e,t,r,i,n,s,a,o,d,l,c,u,h)=>{c=Ne(c),s=Ot(n,s),o&&(o=Ot(a,o)),l&&(l=Ot(d,l)),h=Ot(u,h);var f=At(c);wt(f,(function(){Wt(`Cannot construct ${c} due to unbound types`,[i])})),Ve([e,t,r],i?[i]:[],(function(t){var r,n;t=t[0],n=i?(r=t.registeredClass).instancePrototype:yt.prototype;var a=vt(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new Ie("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new Ie(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new Ie(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(n,{constructor:{value:a}});a.prototype=d;var u=new Ut(c,a,d,h,r,s,o,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new Pt(c,u,!0,!1,!1),m=new Pt(c+"*",u,!1,!1,!1),_=new Pt(c+" const*",u,!1,!0,!1);return nt[e]={pointerType:m,constPointerType:_},It(f,a),[p,m,_]}))},jt=(e,t)=>{for(var r=[],i=0;i>2]);return r},qt=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Yt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=vt(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function Kt(e,t,r,i,n,s){var a=t.length;a<2&&He("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||s?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=o?1:2;l{var a=jt(t,r);n=Ot(i,n),Ve([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Ie(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Wt(`Cannot construct ${e.name} due to unbound types`,a)},Ve([],a,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Kt(r,i,null,n,s),[]))),[]}))},Zt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Jt=(e,t,r,i,n,s,a,o,d)=>{var l=jt(r,i);t=Ne(t),t=Zt(t),s=Ot(n,s),Ve([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function n(){Wt(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,c[t]=n):(bt(c,t,i),c[t].overloadTable[r-2]=n),Ve([],l,(function(n){var o=Kt(i,n,e,s,a,d);return void 0===c[t].overloadTable?(o.argCount=r-2,c[t]=o):c[t].overloadTable[r-2]=o,[]})),[]}))};function Qt(){Object.assign(er.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function er(){this.allocated=[void 0],this.freelist=[]}var tr=new er,rr=e=>{e>=tr.reserved&&0==--tr.get(e).refcount&&tr.free(e)},ir=()=>{for(var e=0,t=tr.reserved;t{tr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),tr.reserved=tr.allocated.length,n.count_emval_handles=ir},sr={toValue:e=>(e||He("Cannot use deleted val. handle = "+e),tr.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return tr.allocate({refcount:1,value:e})}}};function ar(e){return this.fromWireType(B[e>>2])}var or=(e,t)=>{qe(e,{name:t=Ne(t),fromWireType:e=>{var t=sr.toValue(e);return rr(e),t},toWireType:(e,t)=>sr.toHandle(t),argPackAdvance:Ke,readValueFromPointer:ar,destructorFunction:null})},dr=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},lr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(T[e>>2])};case 8:return function(e){return this.fromWireType(k[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},cr=(e,t,r)=>{qe(e,{name:t=Ne(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Ke,readValueFromPointer:lr(t,r),destructorFunction:null})},ur=(e,t,r)=>{switch(t){case 1:return r?e=>S[e>>0]:e=>E[e>>0];case 2:return r?e=>A[e>>1]:e=>U[e>>1];case 4:return r?e=>B[e>>2]:e=>x[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},hr=(e,t,r,i,n)=>{t=Ne(t);var s=e=>e;if(0===i){var a=32-8*r;s=e=>e<>>a}var o=t.includes("unsigned");qe(e,{name:t,fromWireType:s,toWireType:o?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:Ke,readValueFromPointer:ur(t,r,0!==i),destructorFunction:null})},fr=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=x[e>>2],r=x[e+4>>2];return new i(S.buffer,r,t)}qe(e,{name:r=Ne(r),fromWireType:n,argPackAdvance:Ke,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},pr=(e,t,r)=>_e(e,E,t,r),mr=(e,t)=>{var r="std::string"===(t=Ne(t));qe(e,{name:t,fromWireType(e){var t,i=x[e>>2],n=e+4;if(r)for(var s=n,a=0;a<=i;++a){var o=n+a;if(a==i||0==E[o]){var d=Ce(s,o-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=o+1}}else{var l=new Array(i);for(a=0;a>2]=i,r&&n)pr(t,a,i+1);else if(n)for(var o=0;o255&&(ai(a),He("String has UTF-16 code units that do not fit in 8 bits")),E[a+o]=d}else for(o=0;o{for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&U[i];)++i;if((r=i<<1)-e>32&&_r)return _r.decode(E.subarray(e,r));for(var s="",a=0;!(a>=t/2);++a){var o=A[e+2*a>>1];if(0==o)break;s+=String.fromCharCode(o)}return s},yr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=a,t+=2}return A[t>>1]=0,t-i},vr=e=>2*e.length,br=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var n=B[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i},wr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&a<=57343)a=65536+((1023&a)<<10)|1023&e.charCodeAt(++s);if(B[t>>2]=a,(t+=4)+4>n)break}return B[t>>2]=0,t-i},Sr=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},Er=(e,t,r)=>{var i,n,s,a,o;r=Ne(r),2===t?(i=gr,n=yr,a=vr,s=()=>U,o=1):4===t&&(i=br,n=wr,a=Sr,s=()=>x,o=2),qe(e,{name:r,fromWireType:e=>{for(var r,n=x[e>>2],a=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==a[c>>o]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return ai(e),r},toWireType:(e,i)=>{"string"!=typeof i&&He(`Cannot pass non-string to C++ string type ${r}`);var s=a(i),d=li(4+s+t);return x[d>>2]=s>>o,n(i,d+4,s+t),null!==e&&e.push(ai,d),d},argPackAdvance:Ke,readValueFromPointer:ar,destructorFunction(e){ai(e)}})},Ar=(e,t)=>{qe(e,{isVoid:!0,name:t=Ne(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},Ur={},Br=e=>{var t=Ur[e];return void 0===t?Ne(e):t},xr=[],Tr=(e,t,r,i,n)=>(e=xr[e])(t=sr.toValue(t),t[r=Br(r)],i,n),kr=e=>{var t=xr.length;return xr.push(e),t},Cr=(e,t)=>{var r=Oe[e];return void 0===r&&He(t+" has unknown type "+Ht(e)),r},Dr=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},Pr=(e,t,r)=>{var i=[],n=e.toWireType(i,r);return i.length&&(x[t>>2]=sr.toHandle(i)),n},Lr=(e,t,r)=>{var i=Dr(e,t),n=i.shift();e--;var s="return function (obj, func, destructorsRef, args) {\n",a=0,o=[];0===r&&o.push("obj");for(var d=["retType"],l=[n],c=0;ce.name)).join(", ")}) => ${n.name}>`;return kr(vt(h,u))},Fr=e=>{var t=sr.toValue(e);qt(t),rr(e)},Ir=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,Rr=()=>{j("")},Mr=()=>Date.now(),zr=(e,t,r)=>E.copyWithin(e,t,t+r),Nr=e=>{j("OOM")},$r=e=>{E.length,Nr()},Or={},Gr=()=>l||"./this.program",Hr=()=>{if(!Hr.strings){var e={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",_:Gr()};for(var t in Or)void 0===Or[t]?delete e[t]:e[t]=Or[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Hr.strings=r}return Hr.strings},Wr=(e,t)=>{for(var r=0;r>0]=e.charCodeAt(r);S[t>>0]=0},Vr=(e,t)=>{var r=0;return Hr().forEach(((i,n)=>{var s=t+r;x[e+4*n>>2]=s,Wr(i,s),r+=i.length+1})),0},jr=(e,t)=>{var r=Hr();x[e>>2]=r.length;var i=0;return r.forEach((e=>i+=e.length+1)),x[t>>2]=i,0};function qr(e){try{var t=De.getStreamFromFD(e);return ke.close(t),0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}function Yr(e,t){try{var r=De.getStreamFromFD(e),i=r.tty?2:ke.isDir(r.mode)?3:ke.isLink(r.mode)?7:4;return S[t>>0]=i,A[t+2>>1]=0,K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],B[t+8>>2]=K[0],B[t+12>>2]=K[1],K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],B[t+16>>2]=K[0],B[t+20>>2]=K[1],0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}var Kr=(e,t,r,i)=>{for(var n=0,s=0;s>2],o=x[t+4>>2];t+=8;var d=ke.read(e,S,a,o,i);if(d<0)return-1;if(n+=d,d>2]=s,0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}function Zr(e,t,r,i,n){var s=Ir(t,r);try{if(isNaN(s))return 61;var a=De.getStreamFromFD(e);return ke.llseek(a,s,i),K=[a.position>>>0,(Y=a.position,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],B[n>>2]=K[0],B[n+4>>2]=K[1],a.getdents&&0===s&&0===i&&(a.getdents=null),0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}var Jr=(e,t,r,i)=>{for(var n=0,s=0;s>2],o=x[t+4>>2];t+=8;var d=ke.write(e,S,a,o,i);if(d<0)return-1;n+=d,void 0!==i&&(i+=d)}return n};function Qr(e,t,r,i){try{var n=De.getStreamFromFD(e),s=Jr(n,t,r);return x[i>>2]=s,0}catch(e){if(void 0===ke||"ErrnoError"!==e.name)throw e;return e.errno}}var ei=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=ke.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},ti=365,ri=146;Object.defineProperties(ei.prototype,{read:{get:function(){return(this.mode&ti)===ti},set:function(e){e?this.mode|=ti:this.mode&=~ti}},write:{get:function(){return(this.mode&ri)===ri},set:function(e){e?this.mode|=ri:this.mode&=~ri}},isFolder:{get:function(){return ke.isDir(this.mode)}},isDevice:{get:function(){return ke.isChrdev(this.mode)}}}),ke.FSNode=ei,ke.createPreloadedFile=Be,ke.staticInit(),ze(),Ie=n.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Re=n.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},gt(),ct(),Dt(),Ft=n.UnboundTypeError=Gt(Error,"UnboundTypeError"),Qt(),nr();var ii,ni={o:ae,A:Pe,s:Le,q:Me,C:Xe,D:Vt,y:Xt,h:Jt,B:or,l:cr,c:hr,b:fr,m:mr,j:Er,n:Ar,f:Tr,g:rr,e:Lr,d:Fr,a:Rr,i:Mr,w:zr,r:$r,u:Vr,v:jr,k:qr,t:Yr,z:Xr,p:Zr,x:Qr},si=ie(),ai=e=>(ai=si.G)(e),oi=()=>(oi=si.I)(),di=e=>(di=si.J)(e),li=e=>(li=si.K)(e),ci=e=>(ci=si.M)(e);function ui(){function e(){ii||(ii=!0,n.calledRun=!0,C||(M(),r(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),z()))}G>0||(R(),G>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.dynCall_viiijj=(e,t,r,i,s,a,o,d)=>(n.dynCall_viiijj=si.N)(e,t,r,i,s,a,o,d),n.dynCall_jij=(e,t,r,i)=>(n.dynCall_jij=si.O)(e,t,r,i),n.dynCall_jii=(e,t,r)=>(n.dynCall_jii=si.P)(e,t,r),n.dynCall_jiji=(e,t,r,i,s)=>(n.dynCall_jiji=si.Q)(e,t,r,i,s),H=function e(){ii||ui(),ii||(H=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return ui(),t.ready}})(),o=1e-6,d="undefined"!=typeof Float32Array?Float32Array:Array;function l(){var e=new d(16);return d!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function c(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var u,h=function(e,t,r,i,n,s,a){var o=1/(t-r),d=1/(i-n),l=1/(s-a);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*d,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*o,e[13]=(n+i)*d,e[14]=(a+s)*l,e[15]=1,e};function f(e,t,r){var i=new d(3);return i[0]=e,i[1]=t,i[2]=r,i}u=new d(3),d!=Float32Array&&(u[0]=0,u[1]=0,u[2]=0);var p=(e,t)=>{t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);const r=function(){const t=m(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),r=m(e.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))return console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(i)),null;return i}();let i={program:r,attribLocations:{vertexPosition:e.getAttribLocation(r,"aVertexPosition"),texturePosition:e.getAttribLocation(r,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(r,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(r,"uModelMatrix"),viewMatrix:e.getUniformLocation(r,"uViewMatrix"),rgbatexture:e.getUniformLocation(r,"rgbaTexture"),ytexture:e.getUniformLocation(r,"yTexture"),utexture:e.getUniformLocation(r,"uTexture"),vtexture:e.getUniformLocation(r,"vTexture"),isyuv:e.getUniformLocation(r,"isyuv")}},n=function(){const t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),e.STATIC_DRAW);var r=[];r=r.concat([0,1],[1,1],[1,0],[0,0]);const i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW);const n=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,texPosition:i,indices:n}}(),s=p(),a=p(),d=p(),u=p();function p(){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function m(t,r){const i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(console.log("An error occurred compiling the shaders: "+e.getShaderInfoLog(i)),e.deleteShader(i),null)}function _(t,r){e.viewport(0,0,t,r),e.clearColor(0,0,0,0),e.clearDepth(1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);const s=l();h(s,-1,1,-1,1,.1,100);const p=l();c(p);const m=l();!function(e,t,r,i){var n,s,a,d,l,u,h,f,p,m,_=t[0],g=t[1],y=t[2],v=i[0],b=i[1],w=i[2],S=r[0],E=r[1],A=r[2];Math.abs(_-S)32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let r=e-this._current_word_bits_left;this._fillCurrentWord();let i=Math.min(r,this._current_word_bits_left),n=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Wt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Vt=Wt,jt=Wt;function qt(e){let{profile:t,sampleRate:r,channel:i}=e;return new Uint8Array([175,0,t<<3|(14&r)>>1,(1&r)<<7|i<<3])}function Yt(e){return Kt(e)&&e[1]===xt}function Kt(e){return e[0]>>4===$e}const Xt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Zt(e){let t=new Uint8Array(e),r=null,i=0,n=0,s=0,a=null;if(i=n=t[0]>>>3,s=(7&t[0])<<1|t[1]>>>7,s<0||s>=Xt.length)return void console.error("Flv: AAC invalid sampling frequency index!");let o=Xt[s],d=(120&t[1])>>>3;if(d<0||d>=8)return void console.log("Flv: AAC invalid channel configuration");5===i&&(a=(7&t[1])<<1|t[2]>>>7,t[2]);let l=$t.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?s>=6?(i=5,r=new Array(4),a=s-3):(i=2,r=new Array(2),a=s):-1!==l.indexOf("android")?(i=2,r=new Array(2),a=s):(i=5,a=s,r=new Array(4),s>=6?a=s-3:1===d&&(i=2,r=new Array(2),a=s)),r[0]=i<<3,r[0]|=(15&s)>>>1,r[1]=(15&s)<<7,r[1]|=(15&d)<<3,5===i&&(r[1]|=(15&a)>>>1,r[2]=(1&a)<<7,r[2]|=8,r[3]=0),{audioType:"aac",config:r,sampleRate:o,channelCount:d,objectType:i,codec:"mp4a.40."+i,originalCodec:"mp4a.40."+n}}class Jt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+7>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(4095===(r[t+0]<<8|r[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let r=this.current_syncword_offset_,i=(8&e[r+1])>>>3,n=(6&e[r+1])>>>1,s=1&e[r+1],a=(192&e[r+2])>>>6,o=(60&e[r+2])>>>2,d=(1&e[r+2])<<2|(192&e[r+3])>>>6,l=(3&e[r+3])<<11|e[r+4]<<3|(224&e[r+5])>>>5;if(e[r+6],r+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let c=1===s?7:9,u=l-c;r+=c;let h=this.findNextSyncwordOffset(r+u);if(this.current_syncword_offset_=h,0!==i&&1!==i||0!==n)continue;let f=e.subarray(r,r+u);t={},t.audio_object_type=a+1,t.sampling_freq_index=o,t.sampling_frequency=Vt[o],t.channel_config=d,t.data=f}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Qt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+1>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(695===(r[t+0]<<3|r[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),r=0;for(let i=0;i<=t;i++)r<<=8,r|=e.readByte();return r}readNextAACFrame(e){let t=this.data_,r=null;for(;null==r&&!this.eof_flag_;){let i=this.current_syncword_offset_,n=(31&t[i+1])<<8|t[i+2];if(i+3+n>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let s=new Ht(t.subarray(i+3,i+3+n)),a=null;if(s.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(i+3+n),s.destroy();continue}a=e}else{let e=s.readBool();if(e&&s.readBool()){console.error("audioMuxVersionA is Not Supported"),s.destroy();break}if(e&&this.getLATMValue(s),!s.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),s.destroy();break}if(0!==s.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),s.destroy();break}if(0!==s.readBits(4)){console.error("more than 2 numProgram Not Supported"),s.destroy();break}if(0!==s.readBits(3)){console.error("more than 2 numLayer Not Supported"),s.destroy();break}let t=e?this.getLATMValue(s):0,r=s.readBits(5);t-=5;let i=s.readBits(4);t-=4;let n=s.readBits(4);t-=4,s.readBits(3),t-=3,t>0&&s.readBits(t);let o=s.readBits(3);if(0!==o){console.error(`frameLengthType = ${o}. Only frameLengthType = 0 Supported`),s.destroy();break}s.readByte();let d=s.readBool();if(d)if(e)this.getLATMValue(s);else{let e=0;for(;;){e<<=8;let t=s.readBool();if(e+=s.readByte(),!t)break}console.log(e)}s.readBool()&&s.readByte(),a={},a.audio_object_type=r,a.sampling_freq_index=i,a.sampling_frequency=Vt[a.sampling_freq_index],a.channel_config=n,a.other_data_present=d}let o=0;for(;;){let e=s.readByte();if(o+=e,255!==e)break}let d=new Uint8Array(o);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function tr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return[];const r=e.length,i=[];let n,s=0;for(;s+t>>=8),s+=t,n){if(s+n>r)break;i.push(e.subarray(s,s+n)),s+=n}return i}function rr(e){const t=e.byteLength,r=new Uint8Array(4);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t;const i=new Uint8Array(t+4);return i.set(r,0),i.set(e,4),i}function ir(e,t){let r=null;return t?e.length>=28&&(r=1+(3&e[26])):e.length>=12&&(r=1+(3&e[9])),r}function nr(){return(new Date).getTime()}function sr(e,t,r){return Math.max(Math.min(e,Math.max(t,r)),Math.min(t,r))}function ar(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function or(e){let t=0,r=ar();return i=>{if(n=i,"[object Number]"!==Object.prototype.toString.call(n))return;var n;t+=i;const s=ar(),a=s-r;a>=1e3&&(e(t/a*1e3),r=s,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();function dr(e){return null==e}function lr(e){return!dr(e)}function cr(e){return"function"==typeof e}function ur(e){let t=null,r=31&e[0];return r!==We&&r!==Ve||(t=ze),t||(r=(126&e[0])>>1,r!==st&&r!==ot&&r!==lt||(t=Ne)),t}function hr(){return"undefined"!=typeof WritableStream}function fr(e){e.close()}function pr(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let r=e[0],i=null,n=1;if(e.length>0){let t=e[1];t&&t.ts-r.ts>1e5&&(r=t,n=2)}if(r)for(let s=n;s=1e3){e[s-1].ts-r.ts<1e3&&(i=s+1)}}}return i}function mr(e){return e.ok&&e.status>=200&&e.status<=299}function _r(){return function(e){let t="";if("object"==typeof e)try{t=JSON.stringify(e),t=JSON.parse(t)}catch(r){t=e}else t=e;return t}(x)}function gr(e){return e[0]>>4===Tt&&e[1]===xt}function yr(e){return!0===e||"true"===e}function vr(e){return!0!==e&&"true"!==e}function br(){return!!($t.Worker&&$t.MediaSource&&"canConstructInDedicatedWorker"in $t.MediaSource&&!0===$t.MediaSource.canConstructInDedicatedWorker)}function wr(e,t){const r=tr(e.slice(5));let i=!1;return r.forEach((e=>{const r=t?e[0]>>>1&63:31&e[0];(t&&(r===Qe||r===tt||r===it)||vr(t)&&r===je)&&(i=!0)})),i}var Sr=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function a(e){try{d(i.next(e))}catch(e){s(e)}}function o(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}d((i=i.apply(e,t||[])).next())}))};const Er=Symbol(32),Ar=Symbol(16),Ur=Symbol(8);class Br{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return Sr(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,r)=>{var i;this.reject=r,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(i=this.pull)||void 0===i||i.call(this,e)}))}))}readU32(){return this.read(Er)}readU16(){return this.read(Ar)}readU8(){return this.read(Ur)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let r=0;const i=e=>t.length<(r=e);if("number"==typeof this.need){if(i(this.need))return;e=t.subarray(0,r)}else if(this.need===Er){if(i(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Ar){if(i(2))return;e=t[0]<<8|t[1]}else if(this.need===Ur){if(i(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(i(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,r)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(i(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,r)),e=this.need}return this.consumed+=r,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,r=t+e;if(r<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,r);else{const e=new Uint8Array(r);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,r)}return this.buffer=new Uint8Array(e),this.buffer}}Br.U32=Er,Br.U16=Ar,Br.U8=Ur;class xr{constructor(e){this.log=function(t){if(e._opt.debugLevel==S){const s=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n1?r-1:0),n=1;n1?i-1:0),s=1;s=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseSPS(e){let t=Tr._ebsp2rbsp(e),r=new Ht(t);r.readByte();let i=r.readByte();r.readByte();let n=r.readByte();r.readUEG();let s=Tr.getProfileString(i),a=Tr.getLevelString(n),o=1,d=420,l=[0,420,422,444],c=8;if((100===i||110===i||122===i||244===i||44===i||83===i||86===i||118===i||128===i||138===i||144===i)&&(o=r.readUEG(),3===o&&r.readBits(1),o<=3&&(d=l[o]),c=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool())){let e=3!==o?8:12;for(let t=0;t0&&e<16?(b=t[e-1],w=i[e-1]):255===e&&(b=r.readByte()<<8|r.readByte(),w=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);E=r.readBool(),A=t,U=2*e,S=A/U}}let B=1;1===b&&1===w||(B=b/w);let x=0,T=0;if(0===o)x=1,T=2-m;else{x=3===o?1:2,T=(1===o?2:1)*(2-m)}let k=16*(f+1),C=16*(p+1)*(2-m);k-=(_+g)*x,C-=(y+v)*T;let D=Math.ceil(k*B);return r.destroy(),r=null,{profile_string:s,level_string:a,bit_depth:c,ref_frames:h,chroma_format:d,chroma_format_string:Tr.getChromaFormatString(d),frame_rate:{fixed:E,fps:S,fps_den:U,fps_num:A},sar_ratio:{width:b,height:w},codec_size:{width:k,height:C},present_size:{width:D,height:C}}}static parseSPS$2(e){let t=e.subarray(1,4),r="avc1.";for(let e=0;e<3;e++){let i=t[e].toString(16);i.length<2&&(i="0"+i),r+=i}let i=Tr._ebsp2rbsp(e),n=new Ht(i);n.readByte();let s=n.readByte();n.readByte();let a=n.readByte();n.readUEG();let o=Tr.getProfileString(s),d=Tr.getLevelString(a),l=1,c=420,u=[0,420,422,444],h=8,f=8;if((100===s||110===s||122===s||244===s||44===s||83===s||86===s||118===s||128===s||138===s||144===s)&&(l=n.readUEG(),3===l&&n.readBits(1),l<=3&&(c=u[l]),h=n.readUEG()+8,f=n.readUEG()+8,n.readBits(1),n.readBool())){let e=3!==l?8:12;for(let t=0;t0&&e<16?(E=t[e-1],A=r[e-1]):255===e&&(E=n.readByte()<<8|n.readByte(),A=n.readByte()<<8|n.readByte())}if(n.readBool()&&n.readBool(),n.readBool()&&(n.readBits(4),n.readBool()&&n.readBits(24)),n.readBool()&&(n.readUEG(),n.readUEG()),n.readBool()){let e=n.readBits(32),t=n.readBits(32);B=n.readBool(),x=t,T=2*e,U=x/T}}let k=1;1===E&&1===A||(k=E/A);let C=0,D=0;if(0===l)C=1,D=2-y;else{C=3===l?1:2,D=(1===l?2:1)*(2-y)}let P=16*(_+1),L=16*(g+1)*(2-y);P-=(v+b)*C,L-=(w+S)*D;let F=Math.ceil(P*k);return n.destroy(),n=null,{codec_mimetype:r,profile_idc:s,level_idc:a,profile_string:o,level_string:d,chroma_format_idc:l,bit_depth:h,bit_depth_luma:h,bit_depth_chroma:f,ref_frames:m,chroma_format:c,chroma_format_string:Tr.getChromaFormatString(c),frame_rate:{fixed:B,fps:U,fps_den:T,fps_num:x},sar_ratio:{width:E,height:A},codec_size:{width:P,height:L},present_size:{width:F,height:L}}}static _skipScalingList(e,t){let r=8,i=8,n=0;for(let s=0;s=this.buflen)return this.iserro=!0,0;this.iserro=!1,r=this.bufoff+e>8?8-this.bufoff:e,t<<=r,t+=this.buffer[this.bufpos]>>8-this.bufoff-r&255>>8-r,this.bufoff+=r,e-=r,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,r=this.bufoff,i=this.read(e);return this.bufpos=t,this.bufoff=r,i}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.sps,4),t.sps=i}if(t.pps){const e=t.pps.byteLength,r=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.pps,4),t.pps=i}return t}function Dr(e){let{sps:t,pps:r}=e;const i=[23,0,0,0,0,1,66,0,30,255];i[0]=23,i[6]=t[1],i[7]=t[2],i[8]=t[3],i[10]=225,i[11]=t.byteLength>>8&255,i[12]=255&t.byteLength,i.push(...t,1,r.byteLength>>8&255,255&r.byteLength,...r);return new Uint8Array(i)}function Pr(e){let{sps:t,pps:r}=e,i=8+t.byteLength+1+2+r.byteLength,n=!1;const s=Tr.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(n=!0,i+=4);let a=new Uint8Array(i);a[0]=1,a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=255,a[5]=225;let o=t.byteLength;a[6]=o>>>8,a[7]=255&o;let d=8;a.set(t,8),d+=o,a[d]=1;let l=r.byteLength;a[d+1]=l>>>8,a[d+2]=255&l,a.set(r,d+3),d+=3+l,n&&(a[d]=252|s.chroma_format_idc,a[d+1]=248|s.bit_depth_luma-8,a[d+2]=248|s.bit_depth_chroma-8,a[d+3]=0,d+=4);const c=[23,0,0,0,0],u=new Uint8Array(c.length+a.byteLength);return u.set(c,0),u.set(a,c.length),u}function Lr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Fr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Ir(e){return 31&e[0]}function Rr(e){return e===Ke}function Mr(e){return!function(e){return e===We||e===Ve}(e)&&!Rr(e)}function zr(e){return e===je}function Nr(e){if(0===e.length)return!1;const t=Ir(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=31&e[r],n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,i>=Je||0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class Or{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Gr=e=>{let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)},Hr=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Wr{static _ebsp2rbsp(e){let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseVPS(e){let t=Wr._ebsp2rbsp(e),r=new Ht(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}}static parseSPS(e){let t=Wr._ebsp2rbsp(e),r=new Ht(t);r.readByte(),r.readByte();let i=0,n=0,s=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<=16?(F=t[e-1],I=i[e-1]):255===e&&(F=r.readBits(16),I=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()){r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())}if(r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG()),r.readBool()){if(M=r.readBits(32),z=r.readBits(32),r.readBool()&&r.readUEG(),r.readBool()){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=o;n++){let n=r.readBool();R=n;let s=!0,a=1;n||(s=r.readBool());let o=!1;if(s?r.readUEG():o=r.readBool(),o||(a=r.readUEG()+1),e){for(let e=0;e>6&3,r.general_tier_flag=e[1]>>5&1,r.general_profile_idc=31&e[1],r.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],r.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],r.general_constraint_indicator_flags=r.general_constraint_indicator_flags<<16|e[10]<<8|e[11],r.general_level_idc=e[12],r.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],r.parallelismType=3&e[15],r.chromaFormat=3&e[16],r.bitDepthLumaMinus8=7&e[17],r.bitDepthChromaMinus8=7&e[18],r.avgFrameRate=e[19]<<8|e[20],r.constantFrameRate=e[21]>>6&3,r.numTemporalLayers=e[21]>>3&7,r.temporalIdNested=e[21]>>2&1,r.lengthSizeMinusOne=3&e[21];let i=e[22],n=e.slice(23);for(let e=0;e0)for(let t=r;t<8;t++)e.read(2);i.sub_layer_profile_space=[],i.sub_layer_tier_flag=[],i.sub_layer_profile_idc=[],i.sub_layer_profile_compatibility_flag=[],i.sub_layer_progressive_source_flag=[],i.sub_layer_interlaced_source_flag=[],i.sub_layer_non_packed_constraint_flag=[],i.sub_layer_frame_only_constraint_flag=[],i.sub_layer_level_idc=[];for(let t=0;t{let t=Gr(e),r=new Ht(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}})(t),a=(e=>{let t=Gr(e),r=new Ht(t);r.readByte(),r.readByte();let i=0,n=0,s=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<16?(F=t[e-1],I=i[e-1]):255===e&&(F=r.readBits(16),I=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(i+=r.readUEG(),n+=r.readUEG(),s+=r.readUEG(),a+=r.readUEG()),r.readBool()&&(M=r.readBits(32),z=r.readBits(32),r.readBool()&&(r.readUEG(),r.readBool()))){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=o;n++){let n=r.readBool();R=n;let s=!1,a=1;n||(s=r.readBool());let o=!1;if(s?r.readSEG():o=r.readBool(),o||(cpbcnt=r.readUEG()+1),e)for(let e=0;e{let t=Gr(e),r=new Ht(t);r.readByte(),r.readByte(),r.readUEG(),r.readUEG(),r.readBool(),r.readBool(),r.readBits(3),r.readBool(),r.readBool(),r.readUEG(),r.readUEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool()&&r.readUEG(),r.readSEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool(),r.readBool();let i=r.readBool(),n=r.readBool(),s=1;return n&&i?s=0:n?s=3:i&&(s=2),{parallelismType:s}})(r);n=Object.assign(n,s,a,o);let d=23+(5+t.byteLength)+(5+i.byteLength)+(5+r.byteLength),l=new Uint8Array(d);l[0]=1,l[1]=(3&n.general_profile_space)<<6|(n.general_tier_flag?1:0)<<5|31&n.general_profile_idc,l[2]=n.general_profile_compatibility_flags_1||0,l[3]=n.general_profile_compatibility_flags_2||0,l[4]=n.general_profile_compatibility_flags_3||0,l[5]=n.general_profile_compatibility_flags_4||0,l[6]=n.general_constraint_indicator_flags_1||0,l[7]=n.general_constraint_indicator_flags_2||0,l[8]=n.general_constraint_indicator_flags_3||0,l[9]=n.general_constraint_indicator_flags_4||0,l[10]=n.general_constraint_indicator_flags_5||0,l[11]=n.general_constraint_indicator_flags_6||0,l[12]=60,l[13]=240|(3840&n.min_spatial_segmentation_idc)>>8,l[14]=255&n.min_spatial_segmentation_idc,l[15]=252|3&n.parallelismType,l[16]=252|3&n.chroma_format_idc,l[17]=248|7&n.bit_depth_luma_minus8,l[18]=248|7&n.bit_depth_chroma_minus8,l[19]=0,l[20]=0,l[21]=(3&n.constant_frame_rate)<<6|(7&n.num_temporal_layers)<<3|(n.temporal_id_nested?1:0)<<2|3,l[22]=3,l[23]=128|st,l[24]=0,l[25]=1,l[26]=(65280&t.byteLength)>>8,l[27]=(255&t.byteLength)>>0,l.set(t,28),l[23+(5+t.byteLength)+0]=128|ot,l[23+(5+t.byteLength)+1]=0,l[23+(5+t.byteLength)+2]=1,l[23+(5+t.byteLength)+3]=(65280&i.byteLength)>>8,l[23+(5+t.byteLength)+4]=(255&i.byteLength)>>0,l.set(i,23+(5+t.byteLength)+5),l[23+(5+t.byteLength+5+i.byteLength)+0]=128|lt,l[23+(5+t.byteLength+5+i.byteLength)+1]=0,l[23+(5+t.byteLength+5+i.byteLength)+2]=1,l[23+(5+t.byteLength+5+i.byteLength)+3]=(65280&r.byteLength)>>8,l[23+(5+t.byteLength+5+i.byteLength)+4]=(255&r.byteLength)>>0,l.set(r,23+(5+t.byteLength+5+i.byteLength)+5);const c=[28,0,0,0,0],u=new Uint8Array(c.length+l.byteLength);return u.set(c,0),u.set(l,c.length),u}function Kr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Xr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Zr(e){return(126&e[0])>>1}function Jr(e){return e===ut}function Qr(e){return!function(e){return e>=32&&e<=40}(e)}function ei(e){return e>=16&&e<=21}function ti(e){if(0===e.length)return!1;const t=Zr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=e[r]>>1&63,n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class ii{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}function ni(e){return parseInt(e)===e}function si(e){if(!ni(e.length))return!1;for(var t=0;t255)return!1;return!0}function ai(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!si(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(ni(e.length)&&si(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function oi(e){return new Uint8Array(e)}function di(e,t,r,i,n){null==i&&null==n||(e=e.slice?e.slice(i,n):Array.prototype.slice.call(e,i,n)),t.set(e,r)}var li,ci={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},ui=(li="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r>4]+li[15&i])}return t.join("")}}),hi={16:10,24:12,32:14},fi=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],pi=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],mi=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],_i=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],gi=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],yi=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],vi=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],bi=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],wi=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],Si=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Ei=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Ai=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Ui=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Bi=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],xi=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Ti(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=s[t],this._Kd[e-r][t%4]=s[t];for(var a,o=0,d=n;d>16&255]<<24^pi[a>>8&255]<<16^pi[255&a]<<8^pi[a>>24&255]^fi[o]<<24,o+=1,8!=n)for(t=1;t>8&255]<<8^pi[a>>16&255]<<16^pi[a>>24&255]<<24;for(t=n/2+1;t>2,c=d%4,this._Ke[l][c]=s[t],this._Kd[e-l][c]=s[t++],d++}for(var l=1;l>24&255]^Ui[a>>16&255]^Bi[a>>8&255]^xi[255&a]},ki.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=Ti(e),n=0;n<4;n++)i[n]^=this._Ke[0][n];for(var s=1;s>24&255]^gi[i[(n+1)%4]>>16&255]^yi[i[(n+2)%4]>>8&255]^vi[255&i[(n+3)%4]]^this._Ke[s][n];i=r.slice()}var a,o=oi(16);for(n=0;n<4;n++)a=this._Ke[t][n],o[4*n]=255&(pi[i[n]>>24&255]^a>>24),o[4*n+1]=255&(pi[i[(n+1)%4]>>16&255]^a>>16),o[4*n+2]=255&(pi[i[(n+2)%4]>>8&255]^a>>8),o[4*n+3]=255&(pi[255&i[(n+3)%4]]^a);return o},ki.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=Ti(e),n=0;n<4;n++)i[n]^=this._Kd[0][n];for(var s=1;s>24&255]^wi[i[(n+3)%4]>>16&255]^Si[i[(n+2)%4]>>8&255]^Ei[255&i[(n+1)%4]]^this._Kd[s][n];i=r.slice()}var a,o=oi(16);for(n=0;n<4;n++)a=this._Kd[t][n],o[4*n]=255&(mi[i[n]>>24&255]^a>>24),o[4*n+1]=255&(mi[i[(n+3)%4]>>16&255]^a>>16),o[4*n+2]=255&(mi[i[(n+2)%4]>>8&255]^a>>8),o[4*n+3]=255&(mi[255&i[(n+1)%4]]^a);return o};var Ci=function(e){if(!(this instanceof Ci))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new ki(e)};Ci.prototype.encrypt=function(e){if((e=ai(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=oi(e.length),r=oi(16),i=0;iNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},Fi.prototype.setBytes=function(e){if(16!=(e=ai(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Fi.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var Ii=function(e,t){if(!(this instanceof Ii))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Fi||(t=new Fi(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new ki(e)};Ii.prototype.encrypt=function(e){for(var t=ai(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,i=0;i>>2]>>>24-s%4*8&255;t[i+s>>>2]|=a<<24-(i+s)%4*8}else for(var o=0;o>>2]=r[o>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-n%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new l.init(r,t/2)}},h=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new l.init(r,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,n=i.words,s=i.sigBytes,a=this.blockSize,o=s/(4*a),d=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*a,c=e.min(4*d,s);if(d){for(var u=0;u>>2]|=e[n]<<24-n%4*8;t.call(this,i,r)}else t.apply(this,arguments)};i.prototype=e}}(),r.lib.WordArray)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.WordArray,i=e.enc;function n(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var r=e.length,i=[],n=0;n>>1]|=e.charCodeAt(n)<<16-n%2*16;return t.create(i,2*r)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s>>2]>>>16-s%4*8&65535);i.push(String.fromCharCode(a))}return i.join("")},parse:function(e){for(var r=e.length,i=[],s=0;s>>1]|=n(e.charCodeAt(s)<<16-s%2*16);return t.create(i,2*r)}}}(),r.enc.Utf16)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.WordArray;function i(e,r,i){for(var n=[],s=0,a=0;a>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var n=[],s=0;s>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,o=0;o<4&&s+.75*o>>6*(3-o)&63));var d=i.charAt(64);if(d)for(;n.length%4;)n.push(d);return n.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var s=0;s>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,n=t?this._safe_map:this._map;e.clamp();for(var s=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,d=0;d<4&&a+.75*d>>6*(3-d)&63));var l=n.charAt(64);if(l)for(;s.length%4;)s.push(l);return s.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,n=t?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var a=0;a>>24)|4278255360&(n<<24|n>>>8)}var s=this._hash.words,a=e[t+0],d=e[t+1],f=e[t+2],p=e[t+3],m=e[t+4],_=e[t+5],g=e[t+6],y=e[t+7],v=e[t+8],b=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],A=e[t+13],U=e[t+14],B=e[t+15],x=s[0],T=s[1],k=s[2],C=s[3];x=l(x,T,k,C,a,7,o[0]),C=l(C,x,T,k,d,12,o[1]),k=l(k,C,x,T,f,17,o[2]),T=l(T,k,C,x,p,22,o[3]),x=l(x,T,k,C,m,7,o[4]),C=l(C,x,T,k,_,12,o[5]),k=l(k,C,x,T,g,17,o[6]),T=l(T,k,C,x,y,22,o[7]),x=l(x,T,k,C,v,7,o[8]),C=l(C,x,T,k,b,12,o[9]),k=l(k,C,x,T,w,17,o[10]),T=l(T,k,C,x,S,22,o[11]),x=l(x,T,k,C,E,7,o[12]),C=l(C,x,T,k,A,12,o[13]),k=l(k,C,x,T,U,17,o[14]),x=c(x,T=l(T,k,C,x,B,22,o[15]),k,C,d,5,o[16]),C=c(C,x,T,k,g,9,o[17]),k=c(k,C,x,T,S,14,o[18]),T=c(T,k,C,x,a,20,o[19]),x=c(x,T,k,C,_,5,o[20]),C=c(C,x,T,k,w,9,o[21]),k=c(k,C,x,T,B,14,o[22]),T=c(T,k,C,x,m,20,o[23]),x=c(x,T,k,C,b,5,o[24]),C=c(C,x,T,k,U,9,o[25]),k=c(k,C,x,T,p,14,o[26]),T=c(T,k,C,x,v,20,o[27]),x=c(x,T,k,C,A,5,o[28]),C=c(C,x,T,k,f,9,o[29]),k=c(k,C,x,T,y,14,o[30]),x=u(x,T=c(T,k,C,x,E,20,o[31]),k,C,_,4,o[32]),C=u(C,x,T,k,v,11,o[33]),k=u(k,C,x,T,S,16,o[34]),T=u(T,k,C,x,U,23,o[35]),x=u(x,T,k,C,d,4,o[36]),C=u(C,x,T,k,m,11,o[37]),k=u(k,C,x,T,y,16,o[38]),T=u(T,k,C,x,w,23,o[39]),x=u(x,T,k,C,A,4,o[40]),C=u(C,x,T,k,a,11,o[41]),k=u(k,C,x,T,p,16,o[42]),T=u(T,k,C,x,g,23,o[43]),x=u(x,T,k,C,b,4,o[44]),C=u(C,x,T,k,E,11,o[45]),k=u(k,C,x,T,B,16,o[46]),x=h(x,T=u(T,k,C,x,f,23,o[47]),k,C,a,6,o[48]),C=h(C,x,T,k,y,10,o[49]),k=h(k,C,x,T,U,15,o[50]),T=h(T,k,C,x,_,21,o[51]),x=h(x,T,k,C,E,6,o[52]),C=h(C,x,T,k,p,10,o[53]),k=h(k,C,x,T,w,15,o[54]),T=h(T,k,C,x,d,21,o[55]),x=h(x,T,k,C,v,6,o[56]),C=h(C,x,T,k,B,10,o[57]),k=h(k,C,x,T,g,15,o[58]),T=h(T,k,C,x,A,21,o[59]),x=h(x,T,k,C,m,6,o[60]),C=h(C,x,T,k,S,10,o[61]),k=h(k,C,x,T,f,15,o[62]),T=h(T,k,C,x,b,21,o[63]),s[0]=s[0]+x|0,s[1]=s[1]+T|0,s[2]=s[2]+k|0,s[3]=s[3]+C|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;r[n>>>5]|=128<<24-n%32;var s=e.floor(i/4294967296),a=i;r[15+(n+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var o=this._hash,d=o.words,l=0;l<4;l++){var c=d[l];d[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return o},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,i,n,s,a){var o=e+(t&r|~t&i)+n+a;return(o<>>32-s)+t}function c(e,t,r,i,n,s,a){var o=e+(t&i|r&~i)+n+a;return(o<>>32-s)+t}function u(e,t,r,i,n,s,a){var o=e+(t^r^i)+n+a;return(o<>>32-s)+t}function h(e,t,r,i,n,s,a){var o=e+(r^(t|~i))+n+a;return(o<>>32-s)+t}t.MD5=s._createHelper(d),t.HmacMD5=s._createHmacHelper(d)}(Math),r.MD5)})),Gt((function(e,t){var r,i,n,s,a,o,d,l;e.exports=(i=(r=l=Mi).lib,n=i.WordArray,s=i.Hasher,a=r.algo,o=[],d=a.SHA1=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],d=r[4],l=0;l<80;l++){if(l<16)o[l]=0|e[t+l];else{var c=o[l-3]^o[l-8]^o[l-14]^o[l-16];o[l]=c<<1|c>>>31}var u=(i<<5|i>>>27)+d+o[l];u+=l<20?1518500249+(n&s|~n&a):l<40?1859775393+(n^s^a):l<60?(n&s|n&a|s&a)-1894007588:(n^s^a)-899497514,d=a,a=s,s=n<<30|n>>>2,n=i,i=u}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+d|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=s._createHelper(d),r.HmacSHA1=s._createHmacHelper(d),l.SHA1)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,a=t.algo,o=[],d=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,n=0;n<64;)t(i)&&(n<8&&(o[n]=r(e.pow(i,.5))),d[n]=r(e.pow(i,1/3)),n++),i++}();var l=[],c=a.SHA256=s.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,_=l[f-2],g=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;l[f]=m+l[f-7]+g+l[f-16]}var y=i&n^i&s^n&s,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=h+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&c^~o&u)+d[f]+l[f];h=u,u=c,c=o,o=a+b|0,a=s,s=n,n=i,i=b+(v+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+o|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=s._createHelper(c),t.HmacSHA256=s._createHmacHelper(c)}(Math),r.SHA256)})),Gt((function(e,t){var r,i,n,s,a,o;e.exports=(i=(r=o=Mi).lib.WordArray,n=r.algo,s=n.SHA256,a=n.SHA224=s.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=s._createHelper(a),r.HmacSHA224=s._createHmacHelper(a),o.SHA224)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.Hasher,i=e.x64,n=i.Word,s=i.WordArray,a=e.algo;function o(){return n.create.apply(n,arguments)}var d=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=o()}();var c=a.SHA512=t.extend({_doReset:function(){this._hash=new s.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=i.high,p=i.low,m=n.high,_=n.low,g=s.high,y=s.low,v=a.high,b=a.low,w=o.high,S=o.low,E=c.high,A=c.low,U=u.high,B=u.low,x=h.high,T=h.low,k=f,C=p,D=m,P=_,L=g,F=y,I=v,R=b,M=w,z=S,N=E,$=A,O=U,G=B,H=x,W=T,V=0;V<80;V++){var j,q,Y=l[V];if(V<16)q=Y.high=0|e[t+2*V],j=Y.low=0|e[t+2*V+1];else{var K=l[V-15],X=K.high,Z=K.low,J=(X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7,Q=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),ee=l[V-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ne=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),se=l[V-7],ae=se.high,oe=se.low,de=l[V-16],le=de.high,ce=de.low;q=(q=(q=J+ae+((j=Q+oe)>>>0>>0?1:0))+ie+((j+=ne)>>>0>>0?1:0))+le+((j+=ce)>>>0>>0?1:0),Y.high=q,Y.low=j}var ue,he=M&N^~M&O,fe=z&$^~z&G,pe=k&D^k&L^D&L,me=C&P^C&F^P&F,_e=(k>>>28|C<<4)^(k<<30|C>>>2)^(k<<25|C>>>7),ge=(C>>>28|k<<4)^(C<<30|k>>>2)^(C<<25|k>>>7),ye=(M>>>14|z<<18)^(M>>>18|z<<14)^(M<<23|z>>>9),ve=(z>>>14|M<<18)^(z>>>18|M<<14)^(z<<23|M>>>9),be=d[V],we=be.high,Se=be.low,Ee=H+ye+((ue=W+ve)>>>0>>0?1:0),Ae=ge+me;H=O,W=G,O=N,G=$,N=M,$=z,M=I+(Ee=(Ee=(Ee=Ee+he+((ue+=fe)>>>0>>0?1:0))+we+((ue+=Se)>>>0>>0?1:0))+q+((ue+=j)>>>0>>0?1:0))+((z=R+ue|0)>>>0>>0?1:0)|0,I=L,R=F,L=D,F=P,D=k,P=C,k=Ee+(_e+pe+(Ae>>>0>>0?1:0))+((C=ue+Ae|0)>>>0>>0?1:0)|0}p=i.low=p+C,i.high=f+k+(p>>>0>>0?1:0),_=n.low=_+P,n.high=m+D+(_>>>0

>>0?1:0),y=s.low=y+F,s.high=g+L+(y>>>0>>0?1:0),b=a.low=b+R,a.high=v+I+(b>>>0>>0?1:0),S=o.low=S+z,o.high=w+M+(S>>>0>>0?1:0),A=c.low=A+$,c.high=E+N+(A>>>0<$>>>0?1:0),B=u.low=B+G,u.high=U+O+(B>>>0>>0?1:0),T=h.low=T+W,h.high=x+H+(T>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(c),e.HmacSHA512=t._createHmacHelper(c)}(),r.SHA512)})),Gt((function(e,t){var r,i,n,s,a,o,d,l;e.exports=(i=(r=l=Mi).x64,n=i.Word,s=i.WordArray,a=r.algo,o=a.SHA512,d=a.SHA384=o.extend({_doReset:function(){this._hash=new s.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=o._createHelper(d),r.HmacSHA384=o._createHmacHelper(d),l.SHA384)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,a=t.x64.Word,o=t.algo,d=[],l=[],c=[];!function(){for(var e=1,t=0,r=0;r<24;r++){d[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var n=1,s=0;s<24;s++){for(var o=0,u=0,h=0;h<7;h++){if(1&n){var f=(1<>>24)|4278255360&(s<<24|s>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(T=r[n]).high^=a,T.low^=s}for(var o=0;o<24;o++){for(var h=0;h<5;h++){for(var f=0,p=0,m=0;m<5;m++)f^=(T=r[h+5*m]).high,p^=T.low;var _=u[h];_.high=f,_.low=p}for(h=0;h<5;h++){var g=u[(h+4)%5],y=u[(h+1)%5],v=y.high,b=y.low;for(f=g.high^(v<<1|b>>>31),p=g.low^(b<<1|v>>>31),m=0;m<5;m++)(T=r[h+5*m]).high^=f,T.low^=p}for(var w=1;w<25;w++){var S=(T=r[w]).high,E=T.low,A=d[w];A<32?(f=S<>>32-A,p=E<>>32-A):(f=E<>>64-A,p=S<>>64-A);var U=u[l[w]];U.high=f,U.low=p}var B=u[0],x=r[0];for(B.high=x.high,B.low=x.low,h=0;h<5;h++)for(m=0;m<5;m++){var T=r[w=h+5*m],k=u[w],C=u[(h+1)%5+5*m],D=u[(h+2)%5+5*m];T.high=k.high^~C.high&D.high,T.low=k.low^~C.low&D.low}T=r[0];var P=c[o];T.high^=P.high,T.low^=P.low}},_doFinalize:function(){var t=this._data,r=t.words;this._nDataBytes;var i=8*t.sigBytes,s=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/s)*s>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,o=this.cfg.outputLength/8,d=o/8,l=[],c=0;c>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(h)}return new n.init(l,o)},clone:function(){for(var e=s.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=s._createHelper(h),t.HmacSHA3=s._createHmacHelper(h)}(Math),r.SHA3)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,a=t.algo,o=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=n.create([0,1518500249,1859775393,2400959708,2840853838]),h=n.create([1352829926,1548603684,1836072691,2053994217,0]),f=a.RIPEMD160=s.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s,a,f,b,w,S,E,A,U,B,x,T=this._hash.words,k=u.words,C=h.words,D=o.words,P=d.words,L=l.words,F=c.words;for(S=s=T[0],E=a=T[1],A=f=T[2],U=b=T[3],B=w=T[4],r=0;r<80;r+=1)x=s+e[t+D[r]]|0,x+=r<16?p(a,f,b)+k[0]:r<32?m(a,f,b)+k[1]:r<48?_(a,f,b)+k[2]:r<64?g(a,f,b)+k[3]:y(a,f,b)+k[4],x=(x=v(x|=0,L[r]))+w|0,s=w,w=b,b=v(f,10),f=a,a=x,x=S+e[t+P[r]]|0,x+=r<16?y(E,A,U)+C[0]:r<32?g(E,A,U)+C[1]:r<48?_(E,A,U)+C[2]:r<64?m(E,A,U)+C[3]:p(E,A,U)+C[4],x=(x=v(x|=0,F[r]))+B|0,S=B,B=U,U=v(A,10),A=E,E=x;x=T[1]+f+U|0,T[1]=T[2]+b+B|0,T[2]=T[3]+w+S|0,T[3]=T[4]+s+E|0,T[4]=T[0]+a+A|0,T[0]=x},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var n=this._hash,s=n.words,a=0;a<5;a++){var o=s[a];s[a]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return n},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function m(e,t,r){return e&t|~e&r}function _(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function v(e,t){return e<>>32-t}t.RIPEMD160=s._createHelper(f),t.HmacRIPEMD160=s._createHmacHelper(f)}(),r.RIPEMD160)})),Gt((function(e,t){var r,i,n;e.exports=(i=(r=Mi).lib.Base,n=r.enc.Utf8,void(r.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),a=this._iKey=t.clone(),o=s.words,d=a.words,l=0;l>>2];e.sigBytes-=t}};i.BlockCipher=c.extend({cfg:c.cfg.extend({mode:f,padding:p}),reset:function(){var e;c.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=i.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?s.create([1398893684,1701076831]).concat(r).concat(t):t).toString(d)},parse:function(e){var t,r=d.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=s.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),m.create({ciphertext:r,salt:t})}},g=i.SerializableCipher=n.extend({cfg:n.extend({format:_}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),s=n.finalize(t),a=n.cfg;return m.create({ciphertext:s,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,i,n){if(i||(i=s.random(8)),n)a=l.create({keySize:t+r,hasher:n}).compute(e,i);else var a=l.create({keySize:t+r}).compute(e,i);var o=s.create(a.words.slice(t),4*r);return a.sigBytes=4*t,m.create({key:a,iv:o,salt:i})}},v=i.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=n.iv;var s=g.encrypt.call(this,e,t,n.key,i);return s.mixIn(n),s},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=n.iv,g.decrypt.call(this,e,t,n.key,i)}})}())})),Gt((function(e,t){var r;e.exports=((r=Mi).mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,i){var n,s=this._iv;s?(n=s.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var a=0;a>24&255)){var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}else e+=1<<24;return e}function i(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var n=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,s=this._iv,a=this._counter;s&&(a=this._counter=s.slice(0),this._iv=void 0),i(a);var o=a.slice(0);r.encryptBlock(o,0);for(var d=0;d>>2]|=n<<24-s%4*8,e.sigBytes+=n},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),Gt((function(e,t){var r;e.exports=((r=Mi).pad.Iso10126={pad:function(e,t){var i=4*t,n=i-e.sigBytes%i;e.concat(r.lib.WordArray.random(n-1)).concat(r.lib.WordArray.create([n<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),Gt((function(e,t){var r;e.exports=((r=Mi).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),Gt((function(e,t){var r;e.exports=((r=Mi).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)})),Gt((function(e,t){var r;e.exports=((r=Mi).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib.CipherParams,n=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return i.create({ciphertext:t})}}}(),r.format.Hex)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.BlockCipher,i=e.algo,n=[],s=[],a=[],o=[],d=[],l=[],c=[],u=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,n[r]=p,s[p]=r;var m=e[r],_=e[m],g=e[_],y=257*e[p]^16843008*p;a[r]=y<<24|y>>>8,o[r]=y<<16|y>>>16,d[r]=y<<8|y>>>24,l[r]=y,y=16843009*g^65537*_^257*m^16843008*r,c[p]=y<<24|y>>>8,u[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,r?(r=m^e[e[e[g^m]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=i.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),s=this._keySchedule=[],a=0;a6&&a%r==4&&(l=n[l>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l]):(l=n[(l=l<<8|l>>>24)>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l],l^=p[a/r|0]<<24),s[a]=s[a-r]^l);for(var o=this._invKeySchedule=[],d=0;d>>24]]^u[n[l>>>16&255]]^h[n[l>>>8&255]]^f[n[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,o,d,l,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,c,u,h,f,s),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,s,a,o){for(var d=this._nRounds,l=e[t]^r[0],c=e[t+1]^r[1],u=e[t+2]^r[2],h=e[t+3]^r[3],f=4,p=1;p>>24]^n[c>>>16&255]^s[u>>>8&255]^a[255&h]^r[f++],_=i[c>>>24]^n[u>>>16&255]^s[h>>>8&255]^a[255&l]^r[f++],g=i[u>>>24]^n[h>>>16&255]^s[l>>>8&255]^a[255&c]^r[f++],y=i[h>>>24]^n[l>>>16&255]^s[c>>>8&255]^a[255&u]^r[f++];l=m,c=_,u=g,h=y}m=(o[l>>>24]<<24|o[c>>>16&255]<<16|o[u>>>8&255]<<8|o[255&h])^r[f++],_=(o[c>>>24]<<24|o[u>>>16&255]<<16|o[h>>>8&255]<<8|o[255&l])^r[f++],g=(o[u>>>24]<<24|o[h>>>16&255]<<16|o[l>>>8&255]<<8|o[255&c])^r[f++],y=(o[h>>>24]<<24|o[l>>>16&255]<<16|o[c>>>8&255]<<8|o[255&u])^r[f++],e[t]=m,e[t+1]=_,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(m)}(),r.AES)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib,i=t.WordArray,n=t.BlockCipher,s=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=s.DES=n.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=a[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],s=0;s<16;s++){var l=n[s]=[],c=d[s];for(r=0;r<24;r++)l[r/6|0]|=t[(o[r]-1+c)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(o[r+24]-1+c)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var u=this._invSubKeys=[];for(r=0;r<16;r++)u[r]=n[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],s=this._lBlock,a=this._rBlock,o=0,d=0;d<8;d++)o|=l[d][((a^n[d])&c[d])>>>0];this._lBlock=a,this._rBlock=s^o}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),n=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(i.create(t)),this._des2=u.createEncryptor(i.create(r)),this._des3=u.createEncryptor(i.create(n))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=n._createHelper(p)}(),r.TripleDES)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=i.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var s=0;n<256;n++){var a=n%r,o=t[a>>>2]>>>24-a%4*8&255;s=(s+i[n]+o)%256;var d=i[n];i[n]=i[s],i[s]=d}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var e=this._S,t=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[r],e[r]=s,i|=e[(e[t]+e[r])%256]<<24-8*n}return this._i=t,this._j=r,i}e.RC4=t._createHelper(n);var a=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)s.call(this)}});e.RC4Drop=t._createHelper(a)}(),r.RC4)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],a=[],o=i.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)d.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(t){var s=t.words,a=s[0],o=s[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(n[0]^=l,n[1]^=u,n[2]^=c,n[3]^=h,n[4]^=l,n[5]^=u,n[6]^=c,n[7]^=h,r=0;r<4;r++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,d=((n*n>>>17)+n*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=t._createHelper(o)}(),r.Rabbit)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],a=[],o=i.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var n=0;n<4;n++)d.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var s=t.words,a=s[0],o=s[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(i[0]^=l,i[1]^=u,i[2]^=c,i[3]^=h,i[4]^=l,i[5]^=u,i[6]^=c,i[7]^=h,n=0;n<4;n++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,d=((n*n>>>17)+n*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=t._createHelper(o)}(),r.RabbitLegacy)})),Gt((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.BlockCipher,i=e.algo;const n=16,s=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function d(e,t){let r=t>>24&255,i=t>>16&255,n=t>>8&255,s=255&t,a=e.sbox[0][r]+e.sbox[1][i];return a^=e.sbox[2][n],a+=e.sbox[3][s],a}function l(e,t,r){let i,s=t,a=r;for(let t=0;t1;--t)s^=e.pbox[t],a=d(e,s)^a,i=s,s=a,a=i;return i=s,s=a,a=i,a^=e.pbox[1],s^=e.pbox[0],{left:s,right:a}}function u(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=a[t][r]}let i=0;for(let a=0;a=r&&(i=0);let o=0,d=0,c=0;for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),r=new Uint8Array(r);const n=e.byteLength;let s=5;for(;sn)break;let o=e[s+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=e.slice(s+4+2,s+4+a);let n=new Ri.ModeOfOperation.ctr(t,new Ri.Counter(r));const o=n.decrypt(i);n=null,e.set(o,s+4+2)}s=s+4+a}return e}function $i(e,t,r){if(e.byteLength<=30)return e;const i=e.slice(32);let n=new Ri.ModeOfOperation.ctr(t,new Ri.Counter(r));const s=n.decrypt(i);return n=null,e.set(s,32),e}Gt((function(e,t){e.exports=Mi}));var Oi=Gt((function(e,t){var r,n,s,a=(r=new Date,n=4,s={setLogLevel:function(e){n=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=n&&console.debug("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=n&&console.info("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=n&&console.warn("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=n&&console.error("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}},s);a.getDurationString=function(e,t){var r;function i(e,t){for(var r=(""+e).split(".");r[0].length0){for(var r="",i=0;i0&&(r+=","),r+="["+a.getDurationString(e.start(i))+","+a.getDurationString(e.end(i))+"]";return r}return"(empty)"},t.Log=a;var o=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};o.prototype.getPosition=function(){return this.position},o.prototype.getEndPosition=function(){return this.buffer.byteLength},o.prototype.getLength=function(){return this.buffer.byteLength},o.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},o.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},o.prototype.readAnyInt=function(e,t){var r=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:r=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:r=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";r=this.dataview.getUint8(this.position)<<16,r|=this.dataview.getUint8(this.position+1)<<8,r|=this.dataview.getUint8(this.position+2);break;case 4:r=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";r=this.dataview.getUint32(this.position)<<32,r|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,r}throw"Not enough bytes in buffer"},o.prototype.readUint8=function(){return this.readAnyInt(1,!1)},o.prototype.readUint16=function(){return this.readAnyInt(2,!1)},o.prototype.readUint24=function(){return this.readAnyInt(3,!1)},o.prototype.readUint32=function(){return this.readAnyInt(4,!1)},o.prototype.readUint64=function(){return this.readAnyInt(8,!1)},o.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",r=0;rthis._byteLength&&(this._byteLength=t);else{for(r<1&&(r=1);t>r;)r*=2;var i=new ArrayBuffer(r),n=new Uint8Array(this._buffer);new Uint8Array(i,0,n.length).set(n),this.buffer=i,this._byteLength=t}}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),r=new Uint8Array(this._buffer,0,t.length);t.set(r),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Int32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Int16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Uint32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Uint16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var r=new Float64Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Float32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,r,i,n){var s=new Uint8Array(e,t,n),a=new Uint8Array(r,i,n);s.set(a)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=0;rn;i--,n++){var s=t[n];t[n]=t[i],t[i]=s}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],r=0;r>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},d.prototype.adjustUint32=function(e,t){var r=this.position;this.seek(e),this.writeUint32(t),this.seek(r)},d.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var r=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var r=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var r=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var r=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var r=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=8*e,r},d.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var r=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r};var c=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(c.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,a.debug("MultiBufferStream","Stream ready for parsing"),!0):(a.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(a.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){a.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r.buffer},c.prototype.reduceBuffer=function(e,t,r){var i;return(i=new Uint8Array(r)).set(new Uint8Array(e,t,r)),i.buffer.fileStart=e.fileStart+t,i.buffer.usedBytes=0,i.buffer},c.prototype.insertBuffer=function(e){for(var t=!0,r=0;ri.byteLength){this.buffers.splice(r,1),r--;continue}a.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=i.fileStart||(e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)),a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(r,0,e),0===r&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,n,s)}}t&&(a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===r&&(this.buffer=e))},c.prototype.logBufferLevel=function(e){var t,r,i,n,s,o=[],d="";for(i=0,n=0,t=0;t0&&(d+=s.end-1+"]");var l=e?a.info:a.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+i+"/"+n+" bytes), continuous ranges: "+d)},c.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},c.prototype.findPosition=function(e,t,r){var i,n=null,s=-1;for(i=!0===e?0:this.bufferIndex;i=t?(a.debug("MultiBufferStream","Found position in existing buffer #"+s),s):-1},c.prototype.findEndContiguousBuf=function(e){var t,r,i,n=void 0!==e?e:this.bufferIndex;if(r=this.buffers[n],this.buffers.length>n+1)for(t=n+1;t>3;return 31===i&&r.data.length>=2&&(i=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),i}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};t.MPEG4DescriptorParser=u;var h={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){h.FullBox.prototype=new h.Box,h.ContainerBox.prototype=new h.Box,h.SampleEntry.prototype=new h.Box,h.TrackGroupTypeBox.prototype=new h.FullBox,h.BASIC_BOXES.forEach((function(e){h.createBoxCtor(e)})),h.FULL_BOXES.forEach((function(e){h.createFullBoxCtor(e)})),h.CONTAINER_BOXES.forEach((function(e){h.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,r){this.type=e,this.size=t,this.uuid=r},FullBox:function(e,t,r){h.Box.call(this,e,t,r),this.flags=0,this.version=0},ContainerBox:function(e,t,r){h.Box.call(this,e,t,r),this.boxes=[]},SampleEntry:function(e,t,r,i){h.ContainerBox.call(this,e,t),this.hdr_size=r,this.start=i},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){h.FullBox.call(this,e,t)},createBoxCtor:function(e,t){h.boxCodes.push(e),h[e+"Box"]=function(t){h.Box.call(this,e,t)},h[e+"Box"].prototype=new h.Box,t&&(h[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){h[e+"Box"]=function(t){h.FullBox.call(this,e,t)},h[e+"Box"].prototype=new h.FullBox,h[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,r=0;rr?(a.error("BoxParser","Box of type '"+c+"' has a size "+l+" greater than its container size "+r),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):0!==l&&o+l>e.getEndPosition()?(e.seek(o),a.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):t?{code:h.OK,type:c,size:l,hdr_size:d,start:o}:(h[c+"Box"]?i=new h[c+"Box"](l):"uuid"!==c?(a.warn("BoxParser","Unknown box type: '"+c+"'"),(i=new h.Box(c,l)).has_unparsed_data=!0):h.UUIDBoxes[s]?i=new h.UUIDBoxes[s](l):(a.warn("BoxParser","Unknown uuid type: '"+s+"'"),(i=new h.Box(c,l)).uuid=s,i.has_unparsed_data=!0),i.hdr_size=d,i.start=o,i.write===h.Box.prototype.write&&"mdat"!==i.type&&(a.info("BoxParser","'"+u+"' box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),(n=e.getPosition()-(i.start+i.size))<0?(a.warn("BoxParser","Parsing of box '"+u+"' did not read the entire indicated box data size (missing "+-n+" bytes), seeking forward"),e.seek(i.start+i.size)):n>0&&(a.error("BoxParser","Parsing of box '"+u+"' read "+n+" more bytes than the indicated box data size, seeking backwards"),0!==i.size&&e.seek(i.start+i.size)),{code:h.OK,box:i,size:i.size})},h.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},h.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},h.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.ContainerBox.prototype.parse=function(e){for(var t,r;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},h.SAMPLE_ENTRY_TYPE_VISUAL="Visual",h.SAMPLE_ENTRY_TYPE_AUDIO="Audio",h.SAMPLE_ENTRY_TYPE_HINT="Hint",h.SAMPLE_ENTRY_TYPE_METADATA="Metadata",h.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",h.SAMPLE_ENTRY_TYPE_SYSTEM="System",h.SAMPLE_ENTRY_TYPE_TEXT="Text",h.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},h.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},h.SampleEntry.prototype.parseFooter=function(e){h.ContainerBox.prototype.parse.call(this,e)},h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_HINT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT,"enct"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA,"encm"),h.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var r=0;r<3;r++)this.layer_size[r]=16==t?e.readUint16():e.readUint32()})),h.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),h.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),h.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)a.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void a.error("av1C reserved_2 parsing problem");var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)}else a.error("av1C reserved_1 parsing problem");else a.error("av1C version "+this.version+" not supported")})),h.createBoxCtor("avcC",(function(e){var t,r;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),r=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(r))})),h.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),h.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),h.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),h.createFullBoxCtor("co64",(function(e){var t,r;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(r=0;r>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),h.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),h.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),h.createFullBoxCtor("ctts",(function(e){var t,r;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(r=0;r>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|r>>6&3,this.acmod=r>>3&7,this.lfeon=r>>2&1,this.bit_rate_code=3&r|i>>5&7})),h.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var r=0;r>6,i.bsid=n>>1&31,i.bsmod=(1&n)<<4|s>>4&15,i.acmod=s>>1&7,i.lfeon=1&s,i.num_dep_sub=a>>1&15,i.num_dep_sub>0&&(i.chan_loc=(1&a)<<8|e.readUint8())}})),h.createFullBoxCtor("dfLa",(function(e){var t=[],r=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var i=e.readUint8(),n=Math.min(127&i,r.length-1);if(n?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(r[n]),128&i)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),h.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[r]=e.readString(4),t-=4,r++})),h.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),h.createBoxCtor("hvcC",(function(e){var t,r,i,n;this.configurationVersion=e.readUint8(),n=e.readUint8(),this.general_profile_space=n>>6,this.general_tier_flag=(32&n)>>5,this.general_profile_idc=31&n,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),n=e.readUint8(),this.constantFrameRate=n>>6,this.numTemporalLayers=(13&n)>>3,this.temporalIdNested=(4&n)>>2,this.lengthSizeMinusOne=3&n,this.nalu_arrays=[];var s=e.readUint8();for(t=0;t>7,a.nalu_type=63&n;var o=e.readUint16();for(r=0;r>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var r=0;if(this.version<2)r=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";r=e.readUint32()}for(var i=0;i>7,this.axis=1&t})),h.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),a.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),h.createFullBoxCtor("ipma",(function(e){var t,r;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?a.property_index=(127&s)<<8|e.readUint8():a.property_index=127&s}}})),h.createFullBoxCtor("iref",(function(e){var t,r;for(this.references=[];e.getPosition()>7,i.assignment_type=127&n,i.assignment_type){case 0:i.grouping_type=e.readString(4);break;case 1:i.grouping_type=e.readString(4),i.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:i.sub_track_id=e.readUint32();break;default:a.warn("BoxParser","Unknown leva assignement type")}}})),h.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),h.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),f.prototype.toString=function(){return"("+this.x+","+this.y+")"},h.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new f(e.readUint16(),e.readUint16()),this.display_primaries[1]=new f(e.readUint16(),e.readUint16()),this.display_primaries[2]=new f(e.readUint16(),e.readUint16()),this.white_point=new f(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),h.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),h.createFullBoxCtor("mehd",(function(e){1&this.flags&&(a.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),h.createFullBoxCtor("meta",(function(e){this.boxes=[],h.ContainerBox.prototype.parse.call(this,e)})),h.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),h.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),h.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),h.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),h.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),h.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),h.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var r=0;r0){var t=e.readUint32();this.kid=[];for(var r=0;r0&&(this.data=e.readUint8Array(i))})),h.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),h.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),h.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var r=0;r>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var r=e.readUint8(),i=0;i>7,this.num_leading_samples=127&t})),h.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)a.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=h.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),h.createSampleGroupCtor("stsa",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),h.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),h.createSampleGroupCtor("tsas",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("tscl",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("vipr",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),r=0;r>6,this.sample_depends_on[i]=t>>4&3,this.sample_is_depended_on[i]=t>>2&3,this.sample_has_redundancy[i]=3&t})),h.createFullBoxCtor("senc"),h.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),a.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),r=0;r>31&1,i.referenced_size=2147483647&n,i.subsegment_duration=e.readUint32(),n=e.readUint32(),i.starts_with_SAP=n>>31&1,i.SAP_type=n>>28&7,i.SAP_delta_time=268435455&n}})),h.SingleItemTypeReferenceBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.SingleItemTypeReferenceBox.prototype=new h.Box,h.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var r=0;r>4&15,this.sample_sizes[t+1]=15&i}else if(8===this.field_size)for(t=0;t0)for(r=0;r>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=h.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),h.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),h.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),h.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var r=e.readUint32(),i=0;i>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),h.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),h.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),h.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},h.createTrackGroupCtor("msrc"),h.TrackReferenceTypeBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.TrackReferenceTypeBox.prototype=new h.Box,h.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},h.trefBox.prototype.parse=function(e){for(var t,r;e.getPosition()t&&this.flags&h.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var r=0;r>7&1,this.block_pad_lsb=r>>6&1,this.block_little_endian=r>>5&1,this.block_reversed=r>>4&1,this.pad_unknown=r>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),h.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),h.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),h.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),h.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=h.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),h.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),h.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=h.parseHex16(e)})),h.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),h.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),h.createFullBoxCtor("vvcC",(function(e){var t,r,i={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(i.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,r=this.num_sublayers-2;r>=0;--r){var a=i.extract_bits(1);this.ptl_sublayer_present_mask|=a<1;++r)i.extract_bits(1);for(this.sublayer_level_idc=[],r=this.num_sublayers-2;r>=0;--r)this.ptl_sublayer_present_mask&1<>=1;t+=h.decimalToHex(i,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var n=!1,s="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||n)&&(s="."+h.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+s,n=!0);t+=s}return t},h.vvc1SampleEntry.prototype.getCodec=h.vvi1SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var r="";if(this.vvcC.general_constraint_info){var i,n=[],s=0;for(s|=this.vvcC.ptl_frame_only_constraint<<7,s|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,n.push(s),s&&(i=e),s=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===i)r=".CA";else{r=".C";var a="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",o=0,d=0;for(e=0;e<=i;++e)for(o=o<<8|n[e],d+=8;d>=5;){r+=a[o>>d-5&31],o&=(1<<(d-=5))-1}d&&(r+=a[31&(o<<=5-d)])}}t+=r}return t},h.mp4aSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),r=this.esds.esd.getAudioConfig();return e+"."+h.decimalToHex(t)+(r?"."+r:"")}return e},h.stxtSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},h.vp08SampleEntry.prototype.getCodec=h.vp09SampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var r=this.vpcC.bitDepth;return 8==r&&(r="08"),e+".0"+this.vpcC.profile+"."+t+"."+r},h.av01SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this),r=this.av1C.seq_level_idx_0;return r<10&&(r="0"+r),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+r+(this.av1C.seq_tier_0?"H":"M")+"."+e},h.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),a.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>l?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>l&&e.writeUint64(this.size)},h.FullBox.prototype.writeHeader=function(e){this.size+=4,h.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},h.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},h.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},h.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},h.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},h.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},h.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&h.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&h.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&h.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&h.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[r]instanceof h.Box||t[r]instanceof h.Box||void 0===e[r]||void 0===t[r]||"function"==typeof e[r]||"function"==typeof t[r]||e.subBoxNames&&e.subBoxNames.indexOf(r.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(r.slice(0,4))>-1||"data"===r||"start"===r||"size"===r||"creation_time"===r||"modification_time"===r||h.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(r)>-1||e[r]===t[r]))return!1;return!0},h.boxEqual=function(e,t){if(!h.boxEqualFields(e,t))return!1;for(var r=0;r1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},g.prototype.setExtractionOptions=function(e,t,r){var i=this.getTrackById(e);if(i){var n={};this.extractedTracks.push(n),n.id=e,n.user=t,n.trak=i,i.nextSample=0,n.nb_samples=1e3,n.samples=[],r&&r.nbSamples&&(n.nb_samples=r.nbSamples)}},g.prototype.unsetExtractionOptions=function(e){for(var t=-1,r=0;r-1&&this.extractedTracks.splice(t,1)},g.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=h.parseOneBox(this.stream,false)).code===h.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var r;switch(r="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),r){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[r]&&a.warn("ISOFile","Duplicate Box of type: "+r+", overriding previous occurrence"),this[r]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},g.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(a.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(a.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(a.warn("ISOFile","Not ready to start parsing"),!1))},g.prototype.appendBuffer=function(e,t){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(a.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),r},g.prototype.getInfo=function(){var e,t,r,i,n,s,a={},o=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(a.hasMoov=!0,a.duration=this.moov.mvhd.duration,a.timescale=this.moov.mvhd.timescale,a.isFragmented=null!=this.moov.mvex,a.isFragmented&&this.moov.mvex.mehd&&(a.fragment_duration=this.moov.mvex.mehd.fragment_duration),a.isProgressive=this.isProgressive,a.hasIOD=null!=this.moov.iods,a.brands=[],a.brands.push(this.ftyp.major_brand),a.brands=a.brands.concat(this.ftyp.compatible_brands),a.created=new Date(o+1e3*this.moov.mvhd.creation_time),a.modified=new Date(o+1e3*this.moov.mvhd.modification_time),a.tracks=[],a.audioTracks=[],a.videoTracks=[],a.subtitleTracks=[],a.metadataTracks=[],a.hintTracks=[],a.otherTracks=[],e=0;e0?a.mime+='video/mp4; codecs="':a.audioTracks&&a.audioTracks.length>0?a.mime+='audio/mp4; codecs="':a.mime+='application/mp4; codecs="',e=0;e=r.samples.length)&&(a.info("ISOFile","Sending fragmented data on track #"+i.id+" for samples ["+Math.max(0,r.nextSample-i.nb_samples)+","+(r.nextSample-1)+"]"),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(i.id,i.user,i.segmentStream.buffer,r.nextSample,e||r.nextSample>=r.samples.length),i.segmentStream=null,i!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=r.samples.length)&&(a.debug("ISOFile","Sending samples on track #"+s.id+" for sample "+r.nextSample),this.onSamples&&this.onSamples(s.id,s.user,s.samples),s.samples=[],s!==this.extractedTracks[t]))break}}}},g.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},g.prototype.getBoxes=function(e,t){var r=[];return g._sweep.call(this,e,r,t),r},g._sweep=function(e,t,r){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&r)return;g._sweep.call(this.boxes[i],e,t,r)}},g.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},g.prototype.getTrackSample=function(e,t){var r=this.getTrackById(e);return this.getSample(r,t)},g.prototype.releaseUsedSamples=function(e,t,r){var i=0,n=this.getTrackById(e);n.lastValidSample||(n.lastValidSample=0);for(var s=n.lastValidSample;se*n.timescale){l=i-1;break}t&&n.is_sync&&(d=i)}for(t&&(l=d),e=r.samples[l].cts,r.nextSample=l;r.samples[l].alreadyRead===r.samples[l].size&&r.samples[l+1];)l++;return s=r.samples[l].offset+r.samples[l].alreadyRead,a.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+a.getDurationString(e,o)+" and offset: "+s),{offset:s,time:e/o}},g.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},g.prototype.seek=function(e,t){var r,i,n,s=this.moov,o={offset:1/0,time:1/0};if(this.moov){for(n=0;nthis.getTrackDuration(r)||((i=this.seekTrack(e,t,r)).offset-1){a=d;break}switch(a){case"Visual":if(n.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),s.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var u=new h.avcCBox;u.parse(new o(t.avcDecoderConfigRecord)),s.addBox(u)}else if(t.hevcDecoderConfigRecord){var f=new h.hvcCBox;f.parse(new o(t.hevcDecoderConfigRecord)),s.addBox(f)}break;case"Audio":n.add("smhd").set("balance",t.balance||0),s.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":n.add("hmhd");break;case"Subtitle":if(n.add("sthd"),"stpp"===t.type)s.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:n.add("nmhd")}t.description&&s.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){s.addBox(e)})),n.add("dinf").add("dref").addEntry((new h["url Box"]).set("flags",1));var p=n.add("stbl");return p.add("stsd").addEntry(s),p.add("stts").set("sample_counts",[]).set("sample_deltas",[]),p.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),p.add("stco").set("chunk_offsets",[]),p.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(r),t.id}},h.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},g.prototype.addSample=function(e,t,r){var i=r||{},n={},s=this.getTrackById(e);if(null!==s){n.number=s.samples.length,n.track_id=s.tkhd.track_id,n.timescale=s.mdia.mdhd.timescale,n.description_index=i.sample_description_index?i.sample_description_index-1:0,n.description=s.mdia.minf.stbl.stsd.entries[n.description_index],n.data=t,n.size=t.byteLength,n.alreadyRead=n.size,n.duration=i.duration||1,n.cts=i.cts||0,n.dts=i.dts||0,n.is_sync=i.is_sync||!1,n.is_leading=i.is_leading||0,n.depends_on=i.depends_on||0,n.is_depended_on=i.is_depended_on||0,n.has_redundancy=i.has_redundancy||0,n.degradation_priority=i.degradation_priority||0,n.offset=0,n.subsamples=i.subsamples,s.samples.push(n),s.samples_size+=n.size,s.samples_duration+=n.duration,void 0===s.first_dts&&(s.first_dts=i.dts),this.processSamples();var a=this.createSingleSampleMoof(n);return this.addBox(a),a.computeSize(),a.trafs[0].truns[0].data_offset=a.size+8,this.add("mdat").data=new Uint8Array(t),n}},g.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var r=new h.moofBox;r.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var i=r.add("traf"),n=this.getTrackById(e.track_id);return i.add("tfhd").set("track_id",e.track_id).set("flags",h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),i.add("tfdt").set("baseMediaDecodeTime",e.dts-(n.first_dts||0)),i.add("trun").set("flags",h.TRUN_FLAGS_DATA_OFFSET|h.TRUN_FLAGS_DURATION|h.TRUN_FLAGS_SIZE|h.TRUN_FLAGS_FLAGS|h.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),r},g.prototype.lastMoofIndex=0,g.prototype.samplesDataSize=0,g.prototype.resetTables=function(){var e,t,r,i,n,s;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(d=n[a].grouping_type+"/0",(o=new l(n[a].grouping_type,0)).is_fragment=!0,t.sample_groups_info[d]||(t.sample_groups_info[d]=o))}else for(a=0;a=2&&(d=i[a].grouping_type+"/0",o=new l(i[a].grouping_type,0),e.sample_groups_info[d]||(e.sample_groups_info[d]=o))},g.setSampleGroupProperties=function(e,t,r,i){var n,s;for(n in t.sample_groups=[],i){var a;if(t.sample_groups[n]={},t.sample_groups[n].grouping_type=i[n].grouping_type,t.sample_groups[n].grouping_type_parameter=i[n].grouping_type_parameter,r>=i[n].last_sample_in_run&&(i[n].last_sample_in_run<0&&(i[n].last_sample_in_run=0),i[n].entry_index++,i[n].entry_index<=i[n].sbgp.entries.length-1&&(i[n].last_sample_in_run+=i[n].sbgp.entries[i[n].entry_index].sample_count)),i[n].entry_index<=i[n].sbgp.entries.length-1?t.sample_groups[n].group_description_index=i[n].sbgp.entries[i[n].entry_index].group_description_index:t.sample_groups[n].group_description_index=-1,0!==t.sample_groups[n].group_description_index)a=i[n].fragment_description?i[n].fragment_description:i[n].description,t.sample_groups[n].group_description_index>0?(s=t.sample_groups[n].group_description_index>65535?(t.sample_groups[n].group_description_index>>16)-1:t.sample_groups[n].group_description_index-1,a&&s>=0&&(t.sample_groups[n].description=a.entries[s])):a&&a.version>=2&&a.default_group_description_index>0&&(t.sample_groups[n].description=a.entries[a.default_group_description_index-1])}},g.process_sdtp=function(e,t,r){t&&(e?(t.is_leading=e.is_leading[r],t.depends_on=e.sample_depends_on[r],t.is_depended_on=e.sample_is_depended_on[r],t.has_redundancy=e.sample_has_redundancy[r]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},g.prototype.buildSampleLists=function(){var e,t;for(e=0;ev&&(b++,v<0&&(v=0),v+=s.sample_counts[b]),t>0?(e.samples[t-1].duration=s.sample_deltas[b],e.samples_duration+=e.samples[t-1].duration,B.dts=e.samples[t-1].dts+e.samples[t-1].duration):B.dts=0,a?(t>=w&&(S++,w<0&&(w=0),w+=a.sample_counts[S]),B.cts=e.samples[t].dts+a.sample_offsets[S]):B.cts=B.dts,o?(t==o.sample_numbers[E]-1?(B.is_sync=!0,E++):(B.is_sync=!1,B.degradation_priority=0),l&&l.entries[A].sample_delta+U==t+1&&(B.subsamples=l.entries[A].subsamples,U+=l.entries[A].sample_delta,A++)):B.is_sync=!0,g.process_sdtp(e.mdia.minf.stbl.sdtp,B,B.number),B.degradation_priority=h?h.priority[t]:0,l&&l.entries[A].sample_delta+U==t&&(B.subsamples=l.entries[A].subsamples,U+=l.entries[A].sample_delta),(c.length>0||u.length>0)&&g.setSampleGroupProperties(e,B,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},g.prototype.updateSampleLists=function(){var e,t,r,i,n,s,a,o,d,l,c,u,f,p,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&g.initSampleGroups(u,c,c.sbgps,u.mdia.minf.stbl.sgpds,c.sgpds),t=0;t0?p.dts=u.samples[u.samples.length-2].dts+u.samples[u.samples.length-2].duration:(c.tfdt?p.dts=c.tfdt.baseMediaDecodeTime:p.dts=0,u.first_traf_merged=!0),p.cts=p.dts,_.flags&h.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+_.sample_composition_time_offset[r]),m=a,_.flags&h.TRUN_FLAGS_FLAGS?m=_.sample_flags[r]:0===r&&_.flags&h.TRUN_FLAGS_FIRST_FLAG&&(m=_.first_sample_flags),p.is_sync=!(m>>16&1),p.is_leading=m>>26&3,p.depends_on=m>>24&3,p.is_depended_on=m>>22&3,p.has_redundancy=m>>20&3,p.degradation_priority=65535&m;var y=!!(c.tfhd.flags&h.TFHD_FLAG_BASE_DATA_OFFSET),v=!!(c.tfhd.flags&h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),b=!!(_.flags&h.TRUN_FLAGS_DATA_OFFSET),w=0;w=y?c.tfhd.base_data_offset:v||0===t?l.start:o,p.offset=0===t&&0===r?b?w+_.data_offset:w:o,o=p.offset+p.size,(c.sbgps.length>0||c.sgpds.length>0||u.mdia.minf.stbl.sbgps.length>0||u.mdia.minf.stbl.sgpds.length>0)&&g.setSampleGroupProperties(u,p,p.number_in_traf,c.sample_groups_info)}}if(c.subs){u.has_fragment_subsamples=!0;var S=c.first_sample_index;for(t=0;t-1))return null;var s=(r=this.stream.buffers[n]).byteLength-(i.offset+i.alreadyRead-r.fileStart);if(i.size-i.alreadyRead<=s)return a.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+(i.size-i.alreadyRead)+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,i.size-i.alreadyRead),r.usedBytes+=i.size-i.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead=i.size,i;if(0===s)return null;a.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+s+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,s),i.alreadyRead+=s,r.usedBytes+=s,this.stream.logBufferLevel()}},g.prototype.releaseSample=function(e,t){var r=e.samples[t];return r.data?(this.samplesDataSize-=r.size,r.data=null,r.description=null,delete r.degradation_priority,delete r.depends_on,delete r.description_index,delete r.has_redundancy,delete r.is_depended_on,delete r.is_leading,delete r.is_sync,delete r.moof_number,delete r.number_in_traf,delete r.timescale,delete r.cts,delete r.dts,delete r.offset,delete r.size,delete r.track_id,delete r.duration,r.alreadyRead=0,r.size):0},g.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},g.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},g.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(r.protection=s.ipro.protections[s.iinf.item_infos[e].protection_index-1]),s.iinf.item_infos[e].item_type?r.type=s.iinf.item_infos[e].item_type:r.type="mime",r.content_type=s.iinf.item_infos[e].content_type,r.content_encoding=s.iinf.item_infos[e].content_encoding;if(s.grpl)for(e=0;e0&&h.property_index-1-1))return null;var o=(t=this.stream.buffers[s]).byteLength-(n.offset+n.alreadyRead-t.fileStart);if(!(n.length-n.alreadyRead<=o))return a.debug("ISOFile","Getting item #"+e+" extent #"+i+" partial data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+o+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,o),n.alreadyRead+=o,r.alreadyRead+=o,t.usedBytes+=o,this.stream.logBufferLevel(),null;a.debug("ISOFile","Getting item #"+e+" extent #"+i+" data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+(n.length-n.alreadyRead)+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,n.length-n.alreadyRead),t.usedBytes+=n.length-n.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead+=n.length-n.alreadyRead,n.alreadyRead=n.length}}return r.alreadyRead===r.size?r:null},g.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var r=0;r0?this.moov.traks[e].samples[0].duration:0),t.push(i)}return t},g.prototype.getPerformanceInfo=function(){var e={};return e.moov=this.moov,this.moov&&this.moov.traks&&this.moov.traks.length>1&&(e.moovAudioNum=this.moov.traks[0].samples.length,e.moovVideoNum=this.moov.traks[1].samples.length),e},h.Box.prototype.printHeader=function(e){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},h.FullBox.prototype.printHeader=function(e){this.size+=4,h.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},h.Box.prototype.print=function(e){this.printHeader(e)},h.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},h.tkhdBox.prototype.print=function(e){h.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var y={createFile:function(e,t){var r=void 0===e||e,i=new g(t);return i.discardMdatData=!r,i}};t.createFile=y.createFile}));function Gi(e){return e.reduce(((e,t)=>256*e+t))}function Hi(e){const t=[101,103,119,99],r=e.length-28,i=e.slice(r,r+t.length);return t.every(((e,t)=>e===i[t]))}Oi.Log,Oi.MP4BoxStream,Oi.DataStream,Oi.MultiBufferStream,Oi.MPEG4DescriptorParser,Oi.BoxParser,Oi.XMLSubtitlein4Parser,Oi.Textin4Parser,Oi.ISOFile,Oi.createFile;class Wi{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(r+32,r+32+t))]}return null}(t,this.t);if(!r)return e;const i=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(i instanceof Error)return console.error(i.message),this.d=!0,e;this.A=!0,this.u=r[1],Hi(t)&&this.c++,WebAssembly.instantiate(r[2],i).then((e=>{if("function"!=typeof(t=e.instance.exports).parse||"object"!=typeof t.memory)return this.d=!0,void console.error("video_error_3");var t;this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}function Vi(){for(var e=arguments.length,t=new Array(e),r=0;r{const r=new i((0|e.byteLength)+(0|t.byteLength));return r.set(e,0),r.set(t,0|e.byteLength),r}),new i)}const ji=16,qi=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],Yi=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Ki(e){const t=[];for(let r=0,i=e.length;r1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Zi(e){const t=[];for(let r=0,i=e.length;r>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}function Ji(e){const t=[];for(let r=0,i=e.length;r=240&&e[r]<=247?(t.push(String.fromCodePoint(((7&e[r])<<18)+((63&e[r+1])<<12)+((63&e[r+2])<<6)+(63&e[r+3]))),r+=3):e[r]>=224&&e[r]<=239?(t.push(String.fromCodePoint(((15&e[r])<<12)+((63&e[r+1])<<6)+(63&e[r+2]))),r+=2):e[r]>=192&&e[r]<=223?(t.push(String.fromCodePoint(((31&e[r])<<6)+(63&e[r+1]))),r++):t.push(String.fromCodePoint(e[r]));return t.join("")}function Qi(e,t){const r=31&t;return e<>>32-r}function en(e){return(255&qi[e>>>24&255])<<24|(255&qi[e>>>16&255])<<16|(255&qi[e>>>8&255])<<8|255&qi[255&e]}function tn(e){return e^Qi(e,2)^Qi(e,10)^Qi(e,18)^Qi(e,24)}function rn(e){return e^Qi(e,13)^Qi(e,23)}function nn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[4*t],n[1]=255&e[4*t+1],n[2]=255&e[4*t+2],n[3]=255&e[4*t+3],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];for(let e,t=0;t<32;t+=4)e=i[1]^i[2]^i[3]^r[t+0],i[0]^=tn(en(e)),e=i[2]^i[3]^i[0]^r[t+1],i[1]^=tn(en(e)),e=i[3]^i[0]^i[1]^r[t+2],i[2]^=tn(en(e)),e=i[0]^i[1]^i[2]^r[t+3],i[3]^=tn(en(e));for(let e=0;e<16;e+=4)t[e]=i[3-e/4]>>>24&255,t[e+1]=i[3-e/4]>>>16&255,t[e+2]=i[3-e/4]>>>8&255,t[e+3]=255&i[3-e/4]}function sn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[0+4*t],n[1]=255&e[1+4*t],n[2]=255&e[2+4*t],n[3]=255&e[3+4*t],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let e,r=0;r<32;r+=4)e=i[1]^i[2]^i[3]^Yi[r+0],t[r+0]=i[0]^=rn(en(e)),e=i[2]^i[3]^i[0]^Yi[r+1],t[r+1]=i[1]^=rn(en(e)),e=i[3]^i[0]^i[1]^Yi[r+2],t[r+2]=i[2]^=rn(en(e)),e=i[0]^i[1]^i[2]^Yi[r+3],t[r+3]=i[3]^=rn(en(e));if(0===r)for(let e,r=0;r<16;r++)e=t[r],t[r]=t[31-r],t[31-r]=e}function an(e,t,r){let{padding:i="pkcs#7",mode:n,iv:s=[],output:a="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===n&&("string"==typeof s&&(s=Ki(s)),16!==s.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=Ki(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==r?Zi(e):Ki(e):[...e],("pkcs#5"===i||"pkcs#7"===i)&&0!==r){const t=ji-e.length%ji;for(let r=0;r=ji;){const t=e.slice(u,u+16),i=new Array(16);if("cbc"===n)for(let e=0;e2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let s=new Uint8Array(e.slice(0,5)),a=5;for(;an){const t=new Uint8Array(s.length+e.length-a);t.set(s,0),t.set(e.slice(a),s.length),s=t;break}let l=e[a+4],c=!1,u=2;if(r?(i&&(u=3),l=l>>>1&63,c=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(l)):(l&=31,c=1===l||5===l),c){const r=an(e.slice(a+4+u,a+4+d),t,0,{padding:"none",output:"array"});let i=r[r.length-1];if(i>0&&i<16){let e=!0;for(let t=1;t<=i;t++)if(r[r.length-t]!==i){e=!1;break}e&&r.splice(r.length-i,i)}const n=new Uint8Array(u);n.set(e.slice(a+4,a+4+u),0);const o=rr(Vi(n,new Uint8Array(r))),l=new Uint8Array(s.length+o.length);l.set(s,0),l.set(o,s.length),s=l}else{const t=e.slice(a+4,a+4+d),r=new Uint8Array(s.length+4+t.length);r.set(s,0),r.set(o,s.length),r.set(t,s.length+4),s=r}a=a+4+d}return s}const ln={init:0,findFirstStartCode:1,findSecondStartCode:2};class cn extends class{on(e,t,r){const i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:r}),this}once(e,t,r){const i=this;function n(){i.off(e,n);for(var s=arguments.length,a=new Array(s),o=0;o1?r-1:0),n=1;n{delete r[e]})),void delete this.e;const i=r[e],n=[];if(i&&t)for(let e=0,r=i.length;e=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=ln.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==ln.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=ln.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==ln.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=ln.findFirstStartCode}}}}function un(e,t,r){for(let i=2;i3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let s=5;for(;sn)break;let o=e[s+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=un(e.slice(s+4,s+4+a),t,r);e.set(i,s+4)}s=s+4+a}return e}function pn(){for(var e=arguments.length,t=new Array(e),r=0;re+t.byteLength),0));let n=0;return t.forEach((e=>{i.set(e,n),n+=e.byteLength})),i}class mn{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,r,i)));e.addEventListener(t,r,i);const n=()=>{cr(e.removeEventListener)&&e.removeEventListener(t,r,i)};return this.destroys.push(n),n}destroy(){this.master.debugLog("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class _n{static init(){_n.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in _n.types)_n.types.hasOwnProperty(e)&&(_n.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=_n.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,r=null,i=Array.prototype.slice.call(arguments,1),n=i.length;for(let e=0;e>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r.set(e,4);let s=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return _n.box(_n.types.trak,_n.tkhd(e),_n.mdia(e))}static tkhd(e){let t=e.id,r=e.duration,i=e.presentWidth,n=e.presentHeight;return _n.box(_n.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>>8&255,255&i,0,0,n>>>8&255,255&n,0,0]))}static mdia(e){return _n.box(_n.types.mdia,_n.mdhd(e),_n.hdlr(e),_n.minf(e))}static mdhd(e){let t=e.timescale,r=e.duration;return _n.box(_n.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?_n.constants.HDLR_AUDIO:_n.constants.HDLR_VIDEO,_n.box(_n.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?_n.box(_n.types.smhd,_n.constants.SMHD):_n.box(_n.types.vmhd,_n.constants.VMHD),_n.box(_n.types.minf,t,_n.dinf(),_n.stbl(e))}static dinf(){return _n.box(_n.types.dinf,_n.box(_n.types.dref,_n.constants.DREF))}static stbl(e){return _n.box(_n.types.stbl,_n.stsd(e),_n.box(_n.types.stts,_n.constants.STTS),_n.box(_n.types.stsc,_n.constants.STSC),_n.box(_n.types.stsz,_n.constants.STSZ),_n.box(_n.types.stco,_n.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?_n.box(_n.types.stsd,_n.constants.STSD_PREFIX,_n.mp3(e)):_n.box(_n.types.stsd,_n.constants.STSD_PREFIX,_n.mp4a(e)):"avc"===e.videoType?_n.box(_n.types.stsd,_n.constants.STSD_PREFIX,_n.avc1(e)):_n.box(_n.types.stsd,_n.constants.STSD_PREFIX,_n.hvc1(e))}static mp3(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return _n.box(_n.types[".mp3"],i)}static mp4a(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return _n.box(_n.types.mp4a,i,_n.esds(e))}static esds(e){let t=e.config||[],r=t.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(t).concat([6,1,2]));return _n.box(_n.types.esds,i)}static avc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return _n.box(_n.types.avc1,n,_n.box(_n.types.avcC,t))}static hvc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return _n.box(_n.types.hvc1,n,_n.box(_n.types.hvcC,t))}static mvex(e){return _n.box(_n.types.mvex,_n.trex(e))}static trex(e){let t=e.id,r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return _n.box(_n.types.trex,r)}static moof(e,t){return _n.box(_n.types.moof,_n.mfhd(e.sequenceNumber),_n.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return _n.box(_n.types.mfhd,t)}static traf(e,t){let r=e.id,i=_n.box(_n.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),n=_n.box(_n.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),s=_n.sdtp(e),a=_n.trun(e,s.byteLength+16+16+8+16+8+8);return _n.box(_n.types.traf,i,n,a,s)}static sdtp(e){let t=new Uint8Array(5),r=e.flags;return t[4]=r.isLeading<<6|r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy,_n.box(_n.types.sdtp,t)}static trun(e,t){let r=new Uint8Array(28);t+=36,r.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let i=e.duration,n=e.size,s=e.flags,a=e.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12),_n.box(_n.types.trun,r)}static mdat(e){return _n.box(_n.types.mdat,e)}}_n.init();var gn,yn=Gt((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}));(gn=yn)&&gn.__esModule&&Object.prototype.hasOwnProperty.call(gn,"default")&&gn.default;const vn=[44100,48e3,32e3,0],bn=[22050,24e3,16e3,0],wn=[11025,12e3,8e3,0],Sn=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],En=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],An=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];function Un(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),r=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let i=t[1]>>>3&3,n=(6&t[1])>>1,s=(240&t[2])>>>4,a=(12&t[2])>>>2,o=3!==(t[3]>>>6&3)?2:1,d=0,l=0;switch(i){case 0:d=wn[a];break;case 2:d=bn[a];break;case 3:d=vn[a]}switch(n){case 1:s=e[n]&&t=6?(i=5,t=new Array(4),a=n-3):(i=2,t=new Array(2),a=n):-1!==o.indexOf("android")?(i=2,t=new Array(2),a=n):(i=5,a=n,t=new Array(4),n>=6?a=n-3:1===s&&(i=2,t=new Array(2),a=n)),t[0]=i<<3,t[0]|=(15&n)>>>1,t[1]=(15&n)<<7,t[1]|=(15&s)<<3,5===i&&(t[1]|=(15&a)>>>1,t[2]=(1&a)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=$n[n],this.sampling_index=n,this.channel_count=s,this.object_type=i,this.original_object_type=r,this.codec_mimetype="mp4a.40."+i,this.original_codec_mimetype="mp4a.40."+r}}class Hn{constructor(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}get bitsAvailable(){return this.bitLength-this.index}skipBits(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}getBits(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>i,s=8-i;if(s>=e)return r&&(this.index+=e),n>>s-e;{r&&(this.index+=s);const i=e-s;return n<>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}function Wn(e){return e[3]|e[2]<<8|e[1]<<16|e[0]<<24}const Vn=new Array(214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72),jn=new Array(2746333894,1453994832,1736282519,2993693404),qn=new Array(462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257);function Yn(e,t,r,i,n){var s=n;s=t+n>e.length&&i+n<=r.length?e.length-t:i+n>r.length&&t+n<=e.length?r.length-i:t+n<=e.length&&i+n<=r.length?n:r.length>24&255,e>>16&255,e>>8&255,255&e)}function Xn(e,t){return t+3>>19)^(i<<23|i>>>9)}function Qn(e,t){var r=new Array(36);r[0]=Xn(t,0),r[1]=Xn(t,4),r[2]=Xn(t,8),r[3]=Xn(t,12);for(var i=0;i<32;i++)r[i+4]=r[i]^es(r[i+1]^r[i+2]^r[i+3]^e[i]);var n=new Array(4);for(i=35;i>=32;i--)n[35-i]=r[i];var s=function(e){for(var t=new Array(4*e.length),r=0;r>>30)^(i<<10|i>>>22)^(i<<18|i>>>14)^(i<<24|i>>>8)}function ts(e,t,r){if(null==e||null==e||e.length%16!=0)return console.log("sm4 key is error!"),null;if(null==r||null==r||r.length<=0)return console.log("cipher is error!"),null;if(null==t||null==t||t.length%16!=0)return console.log("iv is error!"),null;for(var i=Zn(e),n=Math.ceil(r.length/16),s=new Array(r.length),a=t.slice(),o=0;o3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t=new Uint8Array(t),r=new Uint8Array(r);const s=e.byteLength;let a=5;for(;as)break;let d=e[a+4],l=!1,c=2;if(i?(n&&(c=3),d=d>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(d)):(d&=31,l=1===d||5===d),l){const i=ts(t,r,e.slice(a+4+c,a+4+o));e.set(i,a+4+c)}a=a+4+o}return e}Date.now||(Date.now=function(){return(new Date).getTime()});const is=[];is.push(a({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support")&&-1===e.indexOf("illegal icc")&&!e.indexOf("If you want to help, upload a sample of this file to")&&!e.indexOf("Reserved SBR extensions is not implemented"))})(e)||console.warn("JbPro[❌❌❌][worker]:",e)}}),s({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support, using thread emulation"))})(e)||console.warn("JbPro[❌❌❌][worker]:",e)}})),Promise.all(is).then((e=>{const t=e[0];!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[],n=[],s=null,a=null,o=null,d=null,l=null,c=null,u=!1,h=null,f=null,S=!1,E=!1,x=!!yr(r),Se=0,Ee=0,je=!1,Je=null,Qe=null,tt=null,it=[],ut=null,At=null,Ut=0,Tt=0,$t=null,Ot=null,Gt=0,Ht=0,Wt=!1,Vt=!1,Xt=!1,er=null,ar=null,Sr=!1,Er=!0,Ar=()=>{const e=_r();return{debug:e.debug,debugLevel:e.debugLevel,debugUuid:e.debugUuid,useOffscreen:e.useOffscreen,useWCS:e.useWCS,useMSE:e.useMSE,videoBuffer:e.videoBuffer,videoBufferDelay:e.videoBufferDelay,openWebglAlignment:e.openWebglAlignment,playType:e.playType,hasAudio:e.hasAudio,hasVideo:e.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:e.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:e.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:0,networkDelay:e.networkDelay,visibility:!0,useSIMD:e.useSIMD,isRecording:!1,recordType:e.recordType,isNakedFlow:e.isNakedFlow,checkFirstIFrame:e.checkFirstIFrame,audioBufferSize:1024,isM7sCrypto:e.isM7sCrypto,m7sCryptoAudio:e.m7sCryptoAudio,cryptoKey:e.cryptoKey,cryptoIV:e.cryptoIV,isSm4Crypto:e.isSm4Crypto,isSm4CryptoH265V2:e.isSm4CryptoH265V2,sm4CryptoKey:e.sm4CryptoKey,isXorCrypto:e.isXorCrypto,isHls265:!1,isFlv:e.isFlv,isFmp4:e.isFmp4,isMpeg4:e.isMpeg4,isTs:e.isTs,isFmp4Private:e.isFmp4Private,isEmitSEI:e.isEmitSEI,isRecordTypeFlv:!1,isWasmMp4:!1,isChrome:!1,isFirefox:!1,isDropSameTimestampGop:e.isDropSameTimestampGop,mseDecodeAudio:e.mseDecodeAudio,wcsDecodeAudio:e.wcsDecodeAudio,nakedFlowH265DemuxUseNew:e.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:e.mseDecoderUseWorker,mseAutoCleanupSourceBuffer:e.mseAutoCleanupSourceBuffer,mseAutoCleanupMaxBackwardDuration:e.mseAutoCleanupMaxBackwardDuration,mseAutoCleanupMinBackwardDuration:e.mseAutoCleanupMinBackwardDuration,mseCorrectTimeDuration:e.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:e.mseCorrectAudioTimeDuration,nakedFlowDemuxUseNew:e.nakedFlowDemuxUseNew,nakedFlowFps:e.nakedFlowFps,supportMSEDecodeHevc:!1}};"VideoEncoder"in self&&(s={hasInit:!1,isEmitInfo:!1,offscreenCanvas:null,offscreenCanvasCtx:null,decoder:null,init(){s.decoder=new VideoDecoder({output:function(e){if(cr(e.createImageBitmap))e.createImageBitmap().then((t=>{s.offscreenCanvasCtx.drawImage(t,0,0,e.codedWidth,e.codedHeight);let r=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:r,delay:si.delay,ts:0},[r]),fr(e)}));else{s.offscreenCanvasCtx.drawImage(e,0,0,e.codedWidth,e.codedHeight);let t=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:t,delay:si.delay,ts:0},[t]),fr(e)}},error:function(e){si.debugError("worker","VideoDecoder error: ",e,e.toString())}})},destroy(){s.reset(),s.decoder&&"closed"!==s.decoder.state&&(s.decoder.close(),s.decoder=null)},decode:function(e,t,r){const i=e[0]>>4==1;if(s.hasInit){const r=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:i?pt:mt});s.decoder.decode(r)}else if(i&&0===e[1]){const t=15&e[0];postMessage({cmd:R,code:t});const r=new Uint8Array(e);postMessage({cmd:M,buffer:r,codecId:t},[r.buffer]);let i=null,n=null;const a=e.slice(5);t===Ie?(n=Cr(a),i={codec:n.codec,description:a}):t===Re&&(n=jr(a),i={codec:n.codec,description:a}),n&&n.codecWidth&&n.codecHeight&&(i.codedHeight=n.codecHeight,i.codedWidth=n.codecWidth),s.isEmitInfo||(si.debugLog("worker","Webcodecs Video Decoder initSize"),postMessage({cmd:k,w:n.codecWidth,h:n.codecHeight}),s.isEmitInfo=!0,s.offscreenCanvas=new OffscreenCanvas(n.codecWidth,n.codecHeight),s.offscreenCanvasCtx=s.offscreenCanvas.getContext("2d"));try{s.decoder.configure(i),s.hasInit=!0}catch(e){si.debugError("worker","VideoDecoder configure error",e.code,e,e.toString()),e.toString()}}else si.debugWarn("worker",`VideoDecoder configure has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)},reset(){s.hasInit=!1,s.isEmitInfo=!1,s.offscreenCanvas=null,s.offscreenCanvasCtx=null}});let Ur=function(){if(Sr=!0,a)try{a.abort(),a=null,si.debugLog("worker","abort success")}catch(e){a=null,si.debugLog("worker","abort catch",e)}},kr={init(){kr.lastBuf=null,kr.vps=null,kr.sps=null,kr.pps=null,kr.streamType=null,kr.localDts=0,kr.pendingUnits={},kr.isSendSeqHeader=!1},destroy(){kr.lastBuf=null,kr.vps=null,kr.sps=null,kr.pps=null,kr.streamType=null,kr.localDts=0,kr.pendingUnits={},kr.isSendSeqHeader=!1},dispatch(e){const t=new Uint8Array(e);if(si._opt.nakedFlowDemuxUseNew){const e=kr.extractNALu$3(t);if(0===e.length)return void si.debugLog("worker","dispatch naluArray length is 0");kr.handleVideoFrames(e)}else kr.extractNALu$2(t)},getNaluDts(){const e=si._opt.nakedFlowFps;let t=kr.localDts;return kr.localDts=kr.localDts+parseInt(1e3/e,10),t},getNaluAudioDts(){const e=si._opt.sampleRate,t=si._opt.audioBufferSize;return kr.localDts+parseInt(t/e*1e3)},extractNALu(e){let t,r,i=0,n=e.byteLength,s=0,a=[];for(;i1)for(let e=0;e{const t=Ir(e);t===Ve||t===We?kr.handleVideoH264Nalu(e):Mr(t)&&i.push(e)})),1===i.length)kr.handleVideoH264Nalu(i[0]);else if(Nr(i)){const e=Ir(i[0]),t=zr(e);kr.handleVideoH264NaluList(i,t,e)}else i.forEach((e=>{kr.handleVideoH264Nalu(e)}))}else if(kr.streamType===Ne)if(si._opt.nakedFlowH265DemuxUseNew){const t=kr.handleAddNaluStartCode(e),r=kr.extractNALu(t);if(0===r.length)return void si.debugWarn("worker","handleVideoNalu","h265 naluList.length === 0");const i=[];if(r.forEach((e=>{const t=Zr(e);t===lt||t===ot||t===st?kr.handleVideoH265Nalu(e):Qr(t)&&i.push(e)})),1===i.length)kr.handleVideoH265Nalu(i[0]);else if(ti(i)){const e=Zr(i[0]),t=ei(e);kr.handleVideoH265NaluList(i,t,e)}else i.forEach((e=>{kr.handleVideoH265Nalu(e)}))}else Zr(e)===lt?kr.extractH265PPS(e):kr.handleVideoH265Nalu(e)},extractH264PPS(e){const t=kr.handleAddNaluStartCode(e);kr.extractNALu(t).forEach((e=>{Rr(Ir(e))?kr.extractH264SEI(e):kr.handleVideoH264Nalu(e)}))},extractH265PPS(e){const t=kr.handleAddNaluStartCode(e);kr.extractNALu(t).forEach((e=>{Jr(Zr(e))?kr.extractH265SEI(e):kr.handleVideoH265Nalu(e)}))},extractH264SEI(e){const t=kr.handleAddNaluStartCode(e);kr.extractNALu(t).forEach((e=>{kr.handleVideoH264Nalu(e)}))},extractH265SEI(e){const t=kr.handleAddNaluStartCode(e);kr.extractNALu(t).forEach((e=>{kr.handleVideoH265Nalu(e)}))},handleAddNaluStartCode(e){const t=[0,0,0,1],r=new Uint8Array(e.length+t.length);return r.set(t),r.set(e,t.length),r},handleVideoH264Nalu(e){const t=Ir(e);switch(t){case We:kr.sps=e;break;case Ve:kr.pps=e}if(kr.isSendSeqHeader){if(kr.sps&&kr.pps){const e=Dr({sps:kr.sps,pps:kr.pps}),t=kr.localDts;si.decode(e,{type:oe,ts:t,isIFrame:!0,cts:0}),kr.sps=null,kr.pps=null}if(Mr(t)){const r=zr(t),i=kr.getNaluDts(),n=Lr(e,r);kr.doDecode(n,{type:oe,ts:i,isIFrame:r,cts:0})}}else if(kr.sps&&kr.pps){kr.isSendSeqHeader=!0;const e=Dr({sps:kr.sps,pps:kr.pps});si.decode(e,{type:oe,ts:0,isIFrame:!0,cts:0}),kr.sps=null,kr.pps=null}},handleVideoH264NaluList(e,t,r){if(kr.isSendSeqHeader){const i=kr.getNaluDts(),n=Fr(e.reduce(((e,t)=>{const r=rr(e),i=rr(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);kr.doDecode(n,{type:oe,ts:i,isIFrame:t,cts:0}),si.debugLog("worker",`handleVideoH264NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},handleVideoH265Nalu(e){const t=Zr(e);switch(t){case st:kr.vps=e;break;case ot:kr.sps=e;break;case lt:kr.pps=e}if(kr.isSendSeqHeader){if(kr.vps&&kr.sps&&kr.pps){const e=Yr({vps:kr.vps,sps:kr.sps,pps:kr.pps}),t=kr.localDts;si.decode(e,{type:oe,ts:t,isIFrame:!0,cts:0}),kr.vps=null,kr.sps=null,kr.pps=null}if(Qr(t)){const r=ei(t),i=kr.getNaluDts(),n=Kr(e,r);kr.doDecode(n,{type:oe,ts:i,isIFrame:r,cts:0})}}else if(kr.vps&&kr.sps&&kr.pps){kr.isSendSeqHeader=!0;const e=Yr({vps:kr.vps,sps:kr.sps,pps:kr.pps});si.decode(e,{type:oe,ts:0,isIFrame:!0,cts:0}),kr.vps=null,kr.sps=null,kr.pps=null}},handleVideoH265NaluList(e,t,r){if(kr.isSendSeqHeader){const i=kr.getNaluDts(),n=Xr(e.reduce(((e,t)=>{const r=rr(e),i=rr(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);kr.doDecode(n,{type:oe,ts:i,isIFrame:t,cts:0}),si.debugLog("worker",`handleVideoH265NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},doDecode(e,t){si.calcNetworkDelay(t.ts),t.isIFrame&&si.calcIframeIntervalTimestamp(t.ts),si.decode(e,t)},handleVideoFrames(e){if(!kr.streamVideoType)for(let t of e)if(kr.streamVideoType=ur(t),kr.streamVideoType)break;kr.streamVideoType?kr.streamVideoType===ze?kr.handleVideoH264Frames(e):this.streamVideoType===Ne&&kr.handleVideoH265Frames(e):si.debugWarn("worker","handleVideoFrames","streamVideoType is null")},handleVideoH264Frames(e){let t=[],r=[],i=!1,n=!1;kr.pendingUnits.units&&(t=kr.pendingUnits.units,n=kr.pendingUnits.vcl,i=kr.pendingUnits.iFrame,kr.pendingUnits={});let s={};for(let a of e){if(a.byteLength<4)continue;const e=Ir(a);let o=!1,d=e===Ye;e!==qe&&e!==Ye||(s=kr.parseVideo264Header(a),o=!0),t.length&&n&&(s.isfms||!o)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,n=!1),t.push(a),i=i||d,n=n||o}t.length&&(kr.pendingUnits={units:t,vcl:n,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,n=null;if(t.forEach((e=>{const t=31&e[0];switch(t){case Ve:kr.pps=e;break;case We:kr.sps=e;break;case Ke:n=e}if(Mr(t)){const t=rr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!kr.isSendSeqHeader&&kr.sps&&kr.pps){kr.isSendSeqHeader=!0;const e=Pr({sps:kr.sps,pps:kr.pps});si.decode(e,{type:oe,ts:0,isIFrame:!0,cts:0}),kr.sps=null,kr.pps=null}if(kr.isSendSeqHeader){if(kr.sps&&kr.pps){const e=Pr({sps:kr.sps,pps:kr.pps}),t=kr.localDts;si.decode(e,{type:oe,ts:t,isIFrame:!0,cts:0}),kr.sps=null,kr.pps=null}if(i){const e=kr.getNaluDts(),t=Fr(i,r);si._opt.isEmitSEI&&n&&postMessage({cmd:Z,buffer:n,ts:e},[n.buffer]),kr.doDecode(t,{type:oe,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames(e){let t=[],r=[],i=!1,n=!1;kr.pendingUnits.units&&(t=kr.pendingUnits.units,n=kr.pendingUnits.vcl,i=kr.pendingUnits.iFrame,kr.pendingUnits={});let s={};for(let a of e){if(a.byteLength<4)continue;const e=Zr(a);let o=!1,d=ei(e);Qr(e)&&(s=this.parseVideo265Header(a),o=!0),t.length&&n&&(s.isfms||!o)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,n=!1),t.push(a),i=i||d,n=n||o}t.length&&(kr.pendingUnits={units:t,vcl:n,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,n=null;if(t.forEach((e=>{const t=e[0]>>>1&63;switch(t){case lt:kr.pps=e;break;case ot:kr.sps=e;break;case st:kr.vps=e;break;case ft:case ht:n=e}if(Qr(t)){const t=rr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!kr.isSendSeqHeader&&kr.sps&&kr.pps&&kr.vps){kr.isSendSeqHeader=!0;const e=Yr({sps:kr.sps,pps:kr.pps,vps:kr.vps});si.decode(e,{type:oe,ts:0,isIFrame:!0,cts:0}),kr.sps=null,kr.pps=null,kr.vps=null}if(kr.isSendSeqHeader){if(kr.sps&&kr.pps&&kr.vps){const e=Yr({sps:kr.sps,pps:kr.pps,vps:kr.vps}),t=kr.localDts;si.decode(e,{type:oe,ts:t,isIFrame:!0,cts:0}),kr.sps=null,kr.pps=null,kr.vps=null}if(i){const e=kr.getNaluDts(),t=Xr(i,r);si._opt.isEmitSEI&&n&&postMessage({cmd:Z,buffer:n,ts:e},[n.buffer]),kr.doDecode(t,{type:oe,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames_1(e){e.forEach((e=>{kr.handleVideoNalu(e)}))},parseVideo264Header(e){const t=new Hn(e);return t.readUByte(),{isfms:0===t.readUEG(),sType:t.readUEG()}},parseVideo265Header(e){const t=new Hn(e);return t.readUByte(),{nalType:t.readBits(6),isfms:0===t.readBits(1),sType:t.readBits(3)}}},Gr={LOG_NAME:"worker fmp4Demuxer",mp4Box:null,offset:0,videoTrackId:null,audioTrackId:null,isHevc:!1,listenMp4Box(){Gr.mp4Box=Oi.createFile(),Gr.mp4Box.onReady=Gr.onReady,Gr.mp4Box.onError=Gr.onError,Gr.mp4Box.onSamples=Gr.onSamples},initTransportDescarmber(){Gr.transportDescarmber=new Wi},_getSeqHeader(e){const t=Gr.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new Oi.DataStream(void 0,0,Oi.DataStream.BIG_ENDIAN);let r=[];e.avcC?(e.avcC.write(t),r=[23,0,0,0,0]):(Gr.isHevc=!0,si.isHevc=!0,e.hvcC.write(t),r=[28,0,0,0,0]);const i=new Uint8Array(t.buffer,8),n=new Uint8Array(r.length+i.length);return n.set(r,0),n.set(i,r.length),n}return null},onReady(e){si.debugLog(Gr.LOG_NAME,"onReady()");const t=e.videoTracks[0],r=e.audioTracks[0];if(t){Gr.videoTrackId=t.id;const e=Gr._getSeqHeader(t);e&&(si.debugLog(Gr.LOG_NAME,"seqHeader"),si.decodeVideo(e,0,!0,0)),Gr.mp4Box.setExtractionOptions(t.id)}if(r&&si._opt.hasAudio){Gr.audioTrackId=r.id;const e=r.audio||{},t=jt.indexOf(e.sample_rate),i=r.codec.replace("mp4a.40.","");Gr.mp4Box.setExtractionOptions(r.id);const n=qt({profile:parseInt(i,10),sampleRate:t,channel:e.channel_count});si.debugLog(Gr.LOG_NAME,"aacADTSHeader"),si.decodeAudio(n,0)}Gr.mp4Box.start()},onError(e){si.debugError(Gr.LOG_NAME,"mp4Box onError",e)},onSamples(e,t,r){if(e===Gr.videoTrackId){for(const e of r){const t=e.data,r=e.is_sync,i=1e3*e.cts/e.timescale;e.duration,e.timescale,r&&si.calcIframeIntervalTimestamp(i);let n=null;n=Gr.isHevc?Xr(t,r):Fr(t,r),si.decode(n,{type:oe,ts:i,isIFrame:r,cts:0})}Gr.mp4Box.removeUsedSamples(e)}else if(e===Gr.audioTrackId){if(si._opt.hasAudio){for(const e of r){const t=e.data,r=1e3*e.cts/e.timescale;e.duration,e.timescale;const i=new Uint8Array(t.byteLength+2);i.set([175,1],0),i.set(t,2),si.decode(i,{type:ae,ts:r,isIFrame:!1,cts:0})}Gr.mp4Box.removeUsedSamples(e)}}else si.debugWarn(Gr.LOG_NAME,"onSamples() trackId error",e)},dispatch(e){let t=new Uint8Array(e);Gr.transportDescarmber&&(t=Gr.transportDescarmber.transport(t)),t.buffer.fileStart=Gr.offset,Gr.offset+=t.byteLength,Gr.mp4Box.appendBuffer(t.buffer)},destroy(){Gr.mp4Box&&(Gr.mp4Box.stop(),Gr.mp4Box.flush(),Gr.mp4Box.destroy(),Gr.mp4Box=null),Gr.transportDescarmber&&(Gr.transportDescarmber.destroy(),Gr.transportDescarmber=null),Gr.offset=0,Gr.videoTrackId=null,Gr.audioTrackId=null,Gr.isHevc=!1}},Hr={LOG_NAME:"worker mpeg4Demuxer",lastBuffer:new Uint8Array(0),parsedOffset:0,firstStartCodeOffset:0,secondStartCodeOffset:0,state:"init",hasInitVideoCodec:!1,localDts:0,dispatch(e){const t=new Uint8Array(e);Hr.extractNALu(t)},destroy(){Hr.lastBuffer=new Uint8Array(0),Hr.parsedOffset=0,Hr.firstStartCodeOffset=0,Hr.secondStartCodeOffset=0,Hr.state="init",Hr.hasInitVideoCodec=!1,Hr.localDts=0},extractNALu(e){if(!e||e.byteLength<1)return void si.debugWarn(Hr.LOG_NAME,"extractNALu() buffer error",e);const t=new Uint8Array(Hr.lastBuffer.length+e.length);for(t.set(Hr.lastBuffer,0),t.set(new Uint8Array(e),Hr.lastBuffer.length),Hr.lastBuffer=t;;){if("init"===Hr.state){let e=!1;for(;Hr.lastBuffer.length-Hr.parsedOffset>=4;)if(0===Hr.lastBuffer[Hr.parsedOffset])if(0===Hr.lastBuffer[Hr.parsedOffset+1])if(1===Hr.lastBuffer[Hr.parsedOffset+2]){if(182===Hr.lastBuffer[Hr.parsedOffset+3]){Hr.state="findFirstStartCode",Hr.firstStartCodeOffset=Hr.parsedOffset,Hr.parsedOffset+=4,e=!0;break}Hr.parsedOffset++}else Hr.parsedOffset++;else Hr.parsedOffset++;else Hr.parsedOffset++;if(e)continue;break}if("findFirstStartCode"===Hr.state){let e=!1;for(;Hr.lastBuffer.length-Hr.parsedOffset>=4;)if(0===Hr.lastBuffer[Hr.parsedOffset])if(0===Hr.lastBuffer[Hr.parsedOffset+1])if(1===Hr.lastBuffer[Hr.parsedOffset+2]){if(182===Hr.lastBuffer[Hr.parsedOffset+3]){Hr.state="findSecondStartCode",Hr.secondStartCodeOffset=Hr.parsedOffset,Hr.parsedOffset+=4,e=!0;break}Hr.parsedOffset++}else Hr.parsedOffset++;else Hr.parsedOffset++;else Hr.parsedOffset++;if(e)continue;break}if("findSecondStartCode"===Hr.state){if(!(Hr.lastBuffer.length-Hr.parsedOffset>0))break;{let e,t,r=192&Hr.lastBuffer[Hr.parsedOffset];e=0==r?Hr.secondStartCodeOffset-14:Hr.secondStartCodeOffset;let i=0==(192&Hr.lastBuffer[Hr.firstStartCodeOffset+4]);if(i){if(Hr.firstStartCodeOffset-14<0)return void si.debugWarn(Hr.LOG_NAME,"firstStartCodeOffset -14 is",Hr.firstStartCodeOffset-14);Hr.hasInitVideoCodec||(Hr.hasInitVideoCodec=!0,si.debugLog(Hr.LOG_NAME,"setCodec"),oi.setCodec(Me,"")),t=Hr.lastBuffer.subarray(Hr.firstStartCodeOffset-14,e)}else t=Hr.lastBuffer.subarray(Hr.firstStartCodeOffset,e);let n=Hr.getNaluDts();Hr.hasInitVideoCodec?(postMessage({cmd:O,type:xe,value:t.byteLength}),postMessage({cmd:O,type:Te,value:n}),Se=n,oi.decode(t,i?1:0,n)):si.debugWarn(Hr.LOG_NAME,"has not init video codec"),Hr.lastBuffer=Hr.lastBuffer.subarray(e),Hr.firstStartCodeOffset=0==r?14:0,Hr.parsedOffset=Hr.firstStartCodeOffset+4,Hr.state="findFirstStartCode"}}}},getNaluDts(){let e=Hr.localDts;return Hr.localDts=Hr.localDts+40,e}},qr={TAG_NAME:"worker TsLoaderV2",first_parse_:!0,tsPacketSize:0,syncOffset:0,pmt_:null,config_:null,media_info_:new On,timescale_:90,duration_:0,pat_:{version_number:0,network_pid:0,program_map_pid:{}},current_program_:null,current_pmt_pid_:-1,program_pmt_map_:{},pes_slice_queues_:{},section_slice_queues_:{},video_metadata_:{vps:null,sps:null,pps:null,details:null},audio_metadata_:{codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},last_pcr_:null,audio_last_sample_pts_:void 0,aac_last_incomplete_data_:null,has_video_:!1,has_audio_:!1,video_init_segment_dispatched_:!1,audio_init_segment_dispatched_:!1,video_metadata_changed_:!1,audio_metadata_changed_:!1,loas_previous_frame:null,video_track_:{type:"video",id:1,sequenceNumber:0,samples:[],length:0},audio_track_:{type:"audio",id:2,sequenceNumber:0,samples:[],length:0},_remainingPacketData:null,init(){},destroy(){qr.media_info_=null,qr.pes_slice_queues_=null,qr.section_slice_queues_=null,qr.video_metadata_=null,qr.audio_metadata_=null,qr.aac_last_incomplete_data_=null,qr.video_track_=null,qr.audio_track_=null,qr._remainingPacketData=null},probe(e){let t=new Uint8Array(e),r=-1,i=188;if(t.byteLength<=3*i)return{needMoreData:!0};for(;-1===r;){let e=Math.min(1e3,t.byteLength-3*i);for(let n=0;n=4&&(r-=4),{match:!0,consumed:0,ts_packet_size:i,sync_offset:r})},_initPmt:()=>({program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}),dispatch(e){qr._remainingPacketData&&(e=pn(qr._remainingPacketData,e),qr._remainingPacketData=null);let t=e.buffer;const r=qr.parseChunks(t);r?qr._remainingPacketData=e.subarray(r):e.length>>6;r[1];let s=(31&r[1])<<8|r[2],a=(48&r[3])>>>4,o=15&r[3],d=!(!qr.pmt_||qr.pmt_.pcr_pid!==s),l={},c=4;if(2==a||3==a){let e=r[4];if(e>0&&(d||3==a)&&(l.discontinuity_indicator=(128&r[5])>>>7,l.random_access_indicator=(64&r[5])>>>6,l.elementary_stream_priority_indicator=(32&r[5])>>>5,(16&r[5])>>>4)){let e=300*(r[6]<<25|r[7]<<17|r[8]<<9|r[9]<<1|r[10]>>>7)+((1&r[10])<<8|r[11]);qr.last_pcr_=e}if(2==a||5+e===188){t+=188,204===qr.tsPacketSize&&(t+=16);continue}c=5+e}if(1==a||3==a)if(0===s||s===qr.current_pmt_pid_||null!=qr.pmt_&&qr.pmt_.pid_stream_type[s]===Fn){let r=188-c;qr.handleSectionSlice(e,t+c,r,{pid:s,payload_unit_start_indicator:n,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}else if(null!=qr.pmt_&&null!=qr.pmt_.pid_stream_type[s]){let r=188-c,i=qr.pmt_.pid_stream_type[s];s!==qr.pmt_.common_pids.h264&&s!==qr.pmt_.common_pids.h265&&s!==qr.pmt_.common_pids.adts_aac&&s!==qr.pmt_.common_pids.loas_aac&&s!==qr.pmt_.common_pids.ac3&&s!==qr.pmt_.common_pids.eac3&&s!==qr.pmt_.common_pids.opus&&s!==qr.pmt_.common_pids.mp3&&!0!==qr.pmt_.pes_private_data_pids[s]&&!0!==qr.pmt_.timed_id3_pids[s]&&!0!==qr.pmt_.synchronous_klv_pids[s]&&!0!==qr.pmt_.asynchronous_klv_pids[s]||qr.handlePESSlice(e,t+c,r,{pid:s,stream_type:i,payload_unit_start_indicator:n,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}t+=188,204===qr.tsPacketSize&&(t+=16)}return qr.dispatchAudioVideoMediaSegment(),t},handleSectionSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=qr.section_slice_queues_[i.pid];if(i.payload_unit_start_indicator){let a=n[0];if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t+1,Math.min(r,a));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?qr.emitSectionSlices(s,i):qr.clearSlices(s,i)}for(let o=1+a;o=s.expected_length&&qr.clearSlices(s,i),o+=d.byteLength}}else if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t,Math.min(r,s.expected_length-s.total_length));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?qr.emitSectionSlices(s,i):s.total_length>=s.expected_length&&qr.clearSlices(s,i)}},handlePESSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=n[0]<<16|n[1]<<8|n[2];n[3];let a=n[4]<<8|n[5];if(i.payload_unit_start_indicator){if(1!==s)return void si.debugWarn(qr.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${s}`);let e=qr.pes_slice_queues_[i.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?qr.emitPESSlices(e,i):qr.clearSlices(e,i)),qr.pes_slice_queues_[i.pid]=new Mn,qr.pes_slice_queues_[i.pid].random_access_indicator=i.random_access_indicator}if(null==qr.pes_slice_queues_[i.pid])return;let o=qr.pes_slice_queues_[i.pid];o.slices.push(n),i.payload_unit_start_indicator&&(o.expected_length=0===a?0:a+6),o.total_length+=n.byteLength,o.expected_length>0&&o.expected_length===o.total_length?qr.emitPESSlices(o,i):o.expected_length>0&&o.expected_length>>6,o=t[8];2!==a&&3!==a||(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,s=3===a?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:r);let d,l=9+o;if(0!==n){if(n<3+o)return void si.debugWarn(qr.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");d=n-3-o}else d=t.byteLength-l;let c=t.subarray(l,l+d);switch(e.stream_type){case Bn:case xn:qr.parseMP3Payload(c,r);break;case Tn:qr.pmt_.common_pids.opus===e.pid||qr.pmt_.common_pids.ac3===e.pid||qr.pmt_.common_pids.eac3===e.pid||(qr.pmt_.asynchronous_klv_pids[e.pid]?qr.parseAsynchronousKLVMetadataPayload(c,e.pid,i):qr.pmt_.smpte2038_pids[e.pid]?qr.parseSMPTE2038MetadataPayload(c,r,s,e.pid,i):qr.parsePESPrivateDataPayload(c,r,s,e.pid,i));break;case kn:qr.parseADTSAACPayload(c,r);break;case Cn:qr.parseLOASAACPayload(c,r);break;case Dn:case Pn:break;case Ln:qr.pmt_.timed_id3_pids[e.pid]?qr.parseTimedID3MetadataPayload(c,r,s,e.pid,i):qr.pmt_.synchronous_klv_pids[e.pid]&&qr.parseSynchronousKLVMetadataPayload(c,r,s,e.pid,i);break;case In:qr.parseH264Payload(c,r,s,e.random_access_indicator);break;case Rn:qr.parseH265Payload(c,r,s,e.random_access_indicator)}}else if((188===i||191===i||240===i||241===i||255===i||242===i||248===i)&&e.stream_type===Tn){let r,s=6;r=0!==n?n:t.byteLength-s;let a=t.subarray(s,s+r);qr.parsePESPrivateDataPayload(a,void 0,void 0,e.pid,i)}}else si.debugError(qr.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${r}`)},parsePAT(e){let t=e[0];if(0!==t)return void Log.e(qr.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let r=(15&e[1])<<8|e[2];e[3],e[4];let i=(62&e[5])>>>1,n=1&e[5],s=e[6];e[7];let a=null;if(1===n&&0===s)a={version_number:0,network_pid:0,program_pmt_pid:{}},a.version_number=i;else if(a=qr.pat_,null==a)return;let o=r-5-4,d=-1,l=-1;for(let t=8;t<8+o;t+=4){let r=e[t]<<8|e[t+1],i=(31&e[t+2])<<8|e[t+3];0===r?a.network_pid=i:(a.program_pmt_pid[r]=i,-1===d&&(d=r),-1===l&&(l=i))}1===n&&0===s&&(null==qr.pat_&&si.debugLog(qr.TAG_NAME,`Parsed first PAT: ${JSON.stringify(a)}`),qr.pat_=a,qr.current_program_=d,qr.current_pmt_pid_=l)},parsePMT(e){let t=e[0];if(2!==t)return void si.debugError(qr.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let r,i=(15&e[1])<<8|e[2],n=e[3]<<8|e[4],s=(62&e[5])>>>1,a=1&e[5],o=e[6];if(e[7],1===a&&0===o)r=qr._initPmt(),r.program_number=n,r.version_number=s,qr.program_pmt_map_[n]=r;else if(r=qr.program_pmt_map_[n],null==r)return;r.pcr_pid=(31&e[8])<<8|e[9];let d=(15&e[10])<<8|e[11],l=12+d,c=i-9-d-4;for(let t=l;t0){for(let i=t+5;i0)for(let i=t+5;iqr.has_video_&&qr.has_audio_?qr.video_init_segment_dispatched_&&qr.audio_init_segment_dispatched_:qr.has_video_&&!qr.has_audio_?qr.video_init_segment_dispatched_:!(qr.has_video_||!qr.has_audio_)&&qr.audio_init_segment_dispatched_,dispatchVideoInitSegment(){let e=qr.video_metadata_.details,t={type:"video"};t.id=qr.video_track_.id,t.timescale=1e3,t.duration=qr.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;let r=t.frameRate.fps_den,i=t.frameRate.fps_num;if(t.refSampleDuration=r/i*1e3,t.codec=e.codec_mimetype,qr.video_metadata_.vps){si.isHevc=!0;let e=qr.video_metadata_.vps.data.subarray(4),r=qr.video_metadata_.sps.data.subarray(4),i=qr.video_metadata_.pps.data.subarray(4);t.hvcc=Yr({vps:e,sps:r,pps:i}),0==qr.video_init_segment_dispatched_&&si.debugLog(qr.TAG_NAME,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.hvcc&&si.decodeVideo(t.hvcc,0,!0,0)}else{let e=qr.video_metadata_.sps.data.subarray(4),r=qr.video_metadata_.pps.data.subarray(4);t.avcc=Pr({sps:e,pps:r}),0==qr.video_init_segment_dispatched_&&si.debugLog(qr.TAG_NAME,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.avcc&&si.decodeVideo(t.avcc,0,!0,0)}qr.video_init_segment_dispatched_=!0,qr.video_metadata_changed_=!1;let n=qr.media_info_;n.hasVideo=!0,n.width=t.codecWidth,n.height=t.codecHeight,n.fps=t.frameRate.fps,n.profile=t.profile,n.level=t.level,n.refFrames=e.ref_frames,n.chromaFormat=e.chroma_format_string,n.sarNum=t.sarRatio.width,n.sarDen=t.sarRatio.height,n.videoCodec=t.codec,n.hasAudio&&n.audioCodec?n.mimeType=`video/mp2t; codecs="${n.videoCodec},${n.audioCodec}"`:n.mimeType=`video/mp2t; codecs="${n.videoCodec}"`},dispatchVideoMediaSegment(){qr.isInitSegmentDispatched()&&qr.video_track_.length&&qr._preDoDecode()},dispatchAudioMediaSegment(){qr.isInitSegmentDispatched()&&qr.audio_track_.length&&qr._preDoDecode()},dispatchAudioVideoMediaSegment(){qr.isInitSegmentDispatched()&&(qr.audio_track_.length||qr.video_track_.length)&&qr._preDoDecode()},parseADTSAACPayload(e,t){if(qr.has_video_&&!qr.video_init_segment_dispatched_)return;if(qr.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+qr.aac_last_incomplete_data_.byteLength);t.set(qr.aac_last_incomplete_data_,0),t.set(e,qr.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/qr.timescale_),"aac"===qr.audio_metadata_.codec){if(null==t&&null!=qr.audio_last_sample_pts_)r=1024/qr.audio_metadata_.sampling_frequency*1e3,i=qr.audio_last_sample_pts_+r;else if(null==t)return void si.debugWarn(qr.TAG_NAME,"AAC: Unknown pts");if(qr.aac_last_incomplete_data_&&qr.audio_last_sample_pts_){r=1024/qr.audio_metadata_.sampling_frequency*1e3;let e=qr.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(si.debugWarn(qr.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Jt(e),a=null,o=i;for(;null!=(a=s.readNextAACFrame());){r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==qr.audio_init_segment_dispatched_?(qr.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},qr.dispatchAudioInitSegment(e)):qr.detectAudioMetadataChange(e)&&(qr.dispatchAudioMediaSegment(),qr.dispatchAudioInitSegment(e)),n=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:ae};qr.audio_track_.samples.push(s),qr.audio_track_.length+=i.byteLength,o+=r}s.hasIncompleteData()&&(qr.aac_last_incomplete_data_=s.getIncompleteData()),n&&(qr.audio_last_sample_pts_=n)},parseLOASAACPayload(e,t){if(qr.has_video_&&!qr.video_init_segment_dispatched_)return;if(qr.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+qr.aac_last_incomplete_data_.byteLength);t.set(qr.aac_last_incomplete_data_,0),t.set(e,qr.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/qr.timescale_),"aac"===qr.audio_metadata_.codec){if(null==t&&null!=qr.audio_last_sample_pts_)r=1024/qr.audio_metadata_.sampling_frequency*1e3,i=qr.audio_last_sample_pts_+r;else if(null==t)return void si.debugWarn(qr.TAG_NAME,"AAC: Unknown pts");if(qr.aac_last_incomplete_data_&&qr.audio_last_sample_pts_){r=1024/qr.audio_metadata_.sampling_frequency*1e3;let e=qr.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(si.debugWarn(qr.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Qt(e),a=null,o=i;for(;null!=(a=s.readNextAACFrame(dr(this.loas_previous_frame)?void 0:this.loas_previous_frame));){qr.loas_previous_frame=a,r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==qr.audio_init_segment_dispatched_?(qr.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},qr.dispatchAudioInitSegment(e)):qr.detectAudioMetadataChange(e)&&(qr.dispatchAudioMediaSegment(),qr.dispatchAudioInitSegment(e)),n=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:ae};qr.audio_track_.samples.push(s),qr.audio_track_.length+=i.byteLength,o+=r}s.hasIncompleteData()&&(qr.aac_last_incomplete_data_=s.getIncompleteData()),n&&(qr.audio_last_sample_pts_=n)},parseAC3Payload(e,t){},parseEAC3Payload(e,t){},parseOpusPayload(e,t){},parseMP3Payload(e,t){if(qr.has_video_&&!qr.video_init_segment_dispatched_)return;let r=[44100,48e3,32e3,0],i=[22050,24e3,16e3,0],n=[11025,12e3,8e3,0],s=e[1]>>>3&3,a=(6&e[1])>>1;e[2];let o=(12&e[2])>>>2,d=3!=(e[3]>>>6&3)?2:1,l=0,c=34;switch(s){case 0:l=n[o];break;case 2:l=i[o];break;case 3:l=r[o]}switch(a){case 1:c=34;break;case 2:c=33;break;case 3:c=32}const u={};u.object_type=c,u.sample_rate=l,u.channel_count=d,u.data=e;const h={codec:"mp3",data:u};0==qr.audio_init_segment_dispatched_?(qr.audio_metadata_={codec:"mp3",object_type:c,sample_rate:l,channel_count:d},qr.dispatchAudioInitSegment(h)):qr.detectAudioMetadataChange(h)&&(qr.dispatchAudioMediaSegment(),qr.dispatchAudioInitSegment(h));let f={payload:e,length:e.byteLength,pts:t/qr.timescale_,dts:t/qr.timescale_,type:ae};qr.audio_track_.samples.push(f),qr.audio_track_.length+=e.byteLength},detectAudioMetadataChange(e){if(e.codec!==qr.audio_metadata_.codec)return si.debugLog(qr.TAG_NAME,`Audio: Audio Codecs changed from ${qr.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===qr.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==qr.audio_metadata_.audio_object_type)return si.debugLog(qr.TAG_NAME,`AAC: AudioObjectType changed from ${qr.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==qr.audio_metadata_.sampling_freq_index)return si.debugLog(qr.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${qr.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==qr.audio_metadata_.channel_config)return si.debugLog(qr.TAG_NAME,`AAC: Channel configuration changed from ${qr.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===qr.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==qr.audio_metadata_.sampling_frequency)return si.debugLog(qr.TAG_NAME,`AC3: Sampling Frequency changed from ${qr.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==qr.audio_metadata_.bit_stream_identification)return si.debugLog(qr.TAG_NAME,`AC3: Bit Stream Identification changed from ${qr.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==qr.audio_metadata_.bit_stream_mode)return si.debugLog(qr.TAG_NAME,`AC3: BitStream Mode changed from ${qr.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==qr.audio_metadata_.channel_mode)return si.debugLog(qr.TAG_NAME,`AC3: Channel Mode changed from ${qr.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==qr.audio_metadata_.low_frequency_effects_channel_on)return si.debugLog(qr.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${qr.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===qr.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==qr.audio_metadata_.sample_rate)return si.debugLog(qr.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${qr.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==qr.audio_metadata_.channel_count)return si.debugLog(qr.TAG_NAME,`Opus: Channel count changed from ${qr.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===qr.audio_metadata_.codec){const t=e.data;if(t.object_type!==qr.audio_metadata_.object_type)return si.debugLog(qr.TAG_NAME,`MP3: AudioObjectType changed from ${qr.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==qr.audio_metadata_.sample_rate)return si.debugLog(qr.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${qr.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==qr.audio_metadata_.channel_count)return si.debugLog(qr.TAG_NAME,`MP3: Channel count changed from ${qr.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1},dispatchAudioInitSegment(e){let t={type:"audio"};if(t.id=qr.audio_track_.id,t.timescale=1e3,t.duration=qr.duration_,"aac"===qr.audio_metadata_.codec){let r="aac"===e.codec?e.data:null,i=new Gn(r);t.audioSampleRate=i.sampling_rate,t.audioSampleRateIndex=i.sampling_index,t.channelCount=i.channel_count,t.codec=i.codec_mimetype,t.originalCodec=i.original_codec_mimetype,t.config=i.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale;const n=qt({profile:si._opt.mseDecodeAudio?i.object_type:i.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});si.decodeAudio(n,0)}else"ac-3"===qr.audio_metadata_.codec||"ec-3"===qr.audio_metadata_.codec||"opus"===qr.audio_metadata_.codec||"mp3"===qr.audio_metadata_.codec&&(t.audioSampleRate=qr.audio_metadata_.sample_rate,t.channelCount=qr.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==qr.audio_init_segment_dispatched_&&si.debugLog(qr.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),qr.audio_init_segment_dispatched_=!0,qr.video_metadata_changed_=!1;let r=qr.media_info_;r.hasAudio=!0,r.audioCodec=t.originalCodec,r.audioSampleRate=t.audioSampleRate,r.audioChannelCount=t.channelCount,r.hasVideo&&r.videoCodec?r.mimeType=`video/mp2t; codecs="${r.videoCodec},${r.audioCodec}"`:r.mimeType=`video/mp2t; codecs="${r.audioCodec}"`},dispatchPESPrivateDataDescriptor(e,t,r){},parsePESPrivateDataPayload(e,t,r,i,n){let s=new Nn;if(s.pid=i,s.stream_id=n,s.len=e.byteLength,s.data=e,null!=t){let e=Math.floor(t/qr.timescale_);s.pts=e}else s.nearest_pts=qr.getNearestTimestampMilliseconds();if(null!=r){let e=Math.floor(r/qr.timescale_);s.dts=e}},parseTimedID3MetadataPayload(e,t,r,i,n){si.debugLog(qr.TAG_NAME,`Timed ID3 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseSynchronousKLVMetadataPayload(e,t,r,i,n){si.debugLog(qr.TAG_NAME,`Synchronous KLV Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseAsynchronousKLVMetadataPayload(e,t,r){si.debugLog(qr.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${r}`)},parseSMPTE2038MetadataPayload(e,t,r,i,n){si.debugLog(qr.TAG_NAME,`SMPTE 2038 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},getNearestTimestampMilliseconds:()=>null!=qr.audio_last_sample_pts_?Math.floor(qr.audio_last_sample_pts_):null!=qr.last_pcr_?Math.floor(qr.last_pcr_/300/qr.timescale_):void 0,_preDoDecode(){const e=qr.video_track_,t=qr.audio_track_;let r=e.samples;t.samples.length>0&&(r=e.samples.concat(t.samples),r=r.sort(((e,t)=>e.dts-t.dts))),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===oe?qr._doDecodeVideo({...e,payload:t}):e.type===ae&&qr._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0},_doDecodeVideo(e){const t=new Uint8Array(e.payload);let r=null;r=e.isHevc?Xr(t,e.isIFrame):Fr(t,e.isIFrame),e.isIFrame&&si.calcIframeIntervalTimestamp(e.dts);let i=si.cryptoPayload(r,e.isIFrame);si.decode(i,{type:oe,ts:e.dts,isIFrame:e.isIFrame,cts:e.cts})},_doDecodeAudio(e){const t=new Uint8Array(e.payload);let r=t;yr(si._opt.m7sCryptoAudio)&&(r=si.cryptoPayloadAudio(t)),si.decode(r,{type:ae,ts:e.dts,isIFrame:!1,cts:0})}},ni=null;br()&&(ni={TAG_NAME:"worker MediaSource",_resetInIt(){ni.isAvc=null,ni.isAAC=null,ni.videoInfo={},ni.videoMeta={},ni.audioMeta={},ni.sourceBuffer=null,ni.audioSourceBuffer=null,ni.hasInit=!1,ni.hasAudioInit=!1,ni.isAudioInitInfo=!1,ni.videoMimeType="",ni.audioMimeType="",ni.cacheTrack={},ni.cacheAudioTrack={},ni.timeInit=!1,ni.sequenceNumber=0,ni.audioSequenceNumber=0,ni.firstRenderTime=null,ni.firstAudioTime=null,ni.mediaSourceAppendBufferFull=!1,ni.mediaSourceAppendBufferError=!1,ni.mediaSourceAddSourceBufferError=!1,ni.mediaSourceBufferError=!1,ni.mediaSourceError=!1,ni.prevTimestamp=null,ni.decodeDiffTimestamp=null,ni.prevDts=null,ni.prevAudioDts=null,ni.prevPayloadBufferSize=0,ni.isWidthOrHeightChanged=!1,ni.prevTs=null,ni.prevAudioTs=null,ni.eventListenList=[],ni.pendingRemoveRanges=[],ni.pendingSegments=[],ni.pendingAudioRemoveRanges=[],ni.pendingAudioSegments=[],ni.supportVideoFrameCallbackHandle=null,ni.audioSourceBufferCheckTimeout=null,ni.audioSourceNoDataCheckTimeout=null,ni.hasPendingEos=!1,ni.$video={currentTime:0,readyState:0}},init(){ni.events=new mn,ni._resetInIt(),ni.mediaSource=new self.MediaSource,ni.isDecodeFirstIIframe=!!vr(si._opt.checkFirstIFrame),ni._bindMediaSourceEvents()},destroy(){ni.stop(),ni._clearAudioSourceBufferCheckTimeout(),ni.eventListenList&&ni.eventListenList.length&&(ni.eventListenList.forEach((e=>e())),ni.eventListenList=[]),ni._resetInIt(),ni.mediaSource=null},getState:()=>ni.mediaSource&&ni.mediaSource.readyState,isStateOpen:()=>ni.getState()===vt,isStateClosed:()=>ni.getState()===bt,isStateEnded:()=>ni.getState()===yt,_bindMediaSourceEvents(){const{proxy:e}=ni.events,t=e(ni.mediaSource,St,(()=>{si.debugLog(ni.TAG_NAME,"sourceOpen"),ni._onMediaSourceSourceOpen()})),r=e(ni.mediaSource,wt,(()=>{si.debugLog(ni.TAG_NAME,"sourceClose")})),i=e(ni.mediaSource,Et,(()=>{si.debugLog(ni.TAG_NAME,"sourceended")}));ni.eventListenList.push(t,r,i)},_onMediaSourceSourceOpen(){ni.sourceBuffer||(si.debugLog(ni.TAG_NAME,"onMediaSourceSourceOpen() sourceBuffer is null and next init"),ni._initSourceBuffer()),ni.audioSourceBuffer||(si.debugLog(ni.TAG_NAME,"onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),ni._initAudioSourceBuffer()),ni._hasPendingSegments()&&ni._doAppendSegments()},decodeVideo(e,t,r,i){if(si.isDestroyed)si.debugWarn(ni.TAG_NAME,"decodeVideo() and decoder is destroyed");else if(vr(ni.hasInit))if(r&&e[1]===xt){const i=15&e[0];if(i===Re&&vr(si._opt.supportMSEDecodeHevc))return void ni.emitError(Le.mediaSourceH265NotSupport);ni.videoInfo.codec=i,postMessage({cmd:R,code:i});const n=new Uint8Array(e);postMessage({cmd:M,buffer:n,codecId:i},[n.buffer]),ni.hasInit=ni._decodeConfigurationRecord(e,t,r,i)}else si.debugWarn(ni.TAG_NAME,`decodeVideo has not init , isIframe is ${r} , payload is ${e[1]} so drop this frame`);else if(!ni.isDecodeFirstIIframe&&r&&(ni.isDecodeFirstIIframe=!0),ni.isDecodeFirstIIframe){if(r&&0===e[1]){const t=15&e[0];let r={};t===Ie?r=Cr(e.slice(5)):t===Re&&(r=Vr(e));const i=ni.videoInfo;i&&i.codecWidth&&i.codecWidth&&r&&r.codecWidth&&r.codecHeight&&(r.codecWidth!==i.codecWidth||r.codecHeight!==i.codecWidth)&&(si.debugWarn(ni.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${i.codecWidth}, old height is ${i.codecHeight},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),ni.isWidthOrHeightChanged=!0,ni.emitError(Le.mseWidthOrHeightChange,`width: ${i.codecWidth}->${r.codecWidth}, height: ${i.codecWidth}->${r.codecHeight}`))}if(ni.isWidthOrHeightChanged)return void si.debugWarn(ni.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(gr(e))return void si.debugLog(ni.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLengthni.prevTs>0&&eA,_decodeConfigurationRecord(e,t,r,i){let n=e.slice(5),s={};if(i===Ie?s=Cr(n):i===Re&&(s=jr(n)),ni.videoInfo.width=s.codecWidth,ni.videoInfo.height=s.codecHeight,0===s.codecWidth&&0===s.codecHeight)return si.debugWarn(ni.TAG_NAME,"_decodeConfigurationRecord error",JSON.stringify(s)),ni.emitError(Le.mediaSourceDecoderConfigurationError,`width is ${0===s.codecWidth} and height is ${s.codecHeight}`),!1;const a={id:Lt,type:"video",timescale:1e3,duration:0,avcc:n,codecWidth:s.codecWidth,codecHeight:s.codecHeight,videoType:s.videoType},o=_n.generateInitSegment(a);ni.isAvc=i===Ie;let d=s.codec;return ni.videoMimeType=d?`video/mp4; codecs="${s.codec}"`:ni.isAvc?_t:gt,postMessage({cmd:k,w:s.codecWidth,h:s.codecHeight}),ni._initSourceBuffer(),ni.appendBuffer(o.buffer),ni.sequenceNumber=0,ni.cacheTrack={},ni.timeInit=!1,!0},_decodeAudioConfigurationRecord(e,t){const r=e[0]>>4,i=e[0]>>1&1,n=r===He,s=r===$e;if(vr(s||n))return si.debugWarn(ni.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${r} ant auto wasm decode`),ni.emitError(Le.mediaSourceAudioG711NotSupport),!1;const a={id:Ft,type:"audio",timescale:1e3};let o={};if(Yt(e)){if(o=Zt(e.slice(2)),!o)return!1;a.audioSampleRate=o.sampleRate,a.channelCount=o.channelCount,a.config=o.config,a.refSampleDuration=1024/a.audioSampleRate*a.timescale}else{if(!n)return!1;if(o=Un(e),!o)return!1;a.audioSampleRate=o.samplingRate,a.channelCount=o.channelCount,a.refSampleDuration=1152/a.audioSampleRate*a.timescale}a.codec=o.codec,a.duration=0;let d="mp4",l=o.codec,c=null;n&&vr(si._opt.isFirefox)?(d="mpeg",l="",c=new Uint8Array):c=_n.generateInitSegment(a);let u=`${a.type}/${d}`;return l&&l.length>0&&(u+=`;codecs=${l}`),vr(ni.isAudioInitInfo)&&(ar=r===$e?i?16:8:0===i?8:16,postMessage({cmd:L,code:r}),postMessage({cmd:P,sampleRate:a.audioSampleRate,channels:a.channelCount,depth:ar}),ni.isAudioInitInfo=!0),ni.audioMimeType=u,ni.isAAC=s,ni._initAudioSourceBuffer(),ni.appendAudioBuffer(c.buffer),!0},_initSourceBuffer(){const{proxy:e}=ni.events;if(null===ni.sourceBuffer&&null!==ni.mediaSource&&ni.isStateOpen()&&ni.videoMimeType){try{si.debugLog(ni.TAG_NAME,"_initSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",ni.videoMimeType),ni.sourceBuffer=ni.mediaSource.addSourceBuffer(ni.videoMimeType)}catch(e){return si.debugError(ni.TAG_NAME,"_initSourceBuffer() appendBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),ni.emitError(Le.mseWorkerAddSourceBufferError,e.code),void(ni.mediaSourceAddSourceBufferError=!0)}if(ni.sourceBuffer){const t=e(ni.sourceBuffer,"error",(e=>{ni.mediaSourceBufferError=!0,si.debugError(ni.TAG_NAME,"mseSourceBufferError mseDecoder.sourceBuffer",e,e.toString()),ni.emitError(Le.mseSourceBufferError,e.code)})),r=e(ni.sourceBuffer,"updateend",(()=>{ni._hasPendingRemoveRanges()?ni._doRemoveRanges():ni._hasPendingSegments()?ni._doAppendSegments():ni.hasPendingEos&&(si.debugLog(ni.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),ni.endOfStream())}));ni.eventListenList.push(t,r)}}else si.debugLog(ni.TAG_NAME,`_initSourceBuffer and mseDecoder.isStateOpen is ${ni.isStateOpen()} and mseDecoder.isAvc === null is ${null===ni.isAvc}`)},_initAudioSourceBuffer(){const{proxy:e}=ni.events;if(null===ni.audioSourceBuffer&&null!==ni.mediaSource&&ni.isStateOpen()&&ni.audioMimeType){try{si.debugLog(ni.TAG_NAME,"_initAudioSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",ni.audioMimeType),ni._clearAudioSourceBufferCheckTimeout(),ni.audioSourceBuffer=ni.mediaSource.addSourceBuffer(ni.audioMimeType)}catch(e){return si.debugError(ni.TAG_NAME,"_initAudioSourceBuffer() addSourceBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),ni.emitError(Le.mseWorkerAddSourceBufferError,e.code),void(ni.mediaSourceAddSourceBufferError=!0)}if(ni.audioSourceBuffer){const t=e(ni.audioSourceBuffer,"error",(e=>{ni.mediaSourceBufferError=!0,si.debugError(ni.TAG_NAME,"mseSourceBufferError mseDecoder.audioSourceBuffer",e.code,e.toString(),e),ni.emitError(Le.mseSourceBufferError,e.code)})),r=e(ni.audioSourceBuffer,"updateend",(()=>{ni._hasPendingRemoveRanges()?ni._doRemoveRanges():ni._hasPendingSegments()?ni._doAppendSegments():ni.hasPendingEos&&(si.debugLog(ni.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),ni.endOfStream())}));ni.eventListenList.push(t,r),null===ni.audioSourceNoDataCheckTimeout&&(ni.audioSourceNoDataCheckTimeout=setTimeout((()=>{ni._clearAudioNoDataCheckTimeout(),ni.emitError(Le.mediaSourceAudioNoDataTimeout)}),1e3))}}else si.debugLog(ni.TAG_NAME,`_initAudioSourceBuffer and mseDecoder.isStateOpen is ${ni.isStateOpen()} and mseDecoder.audioMimeType is ${ni.audioMimeType}`)},_decodeVideo(e,t,r,i,n){let s=e.slice(5),a=s.byteLength;if(0===a)return void si.debugWarn(ni.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let o=(new Date).getTime(),d=!1;ni.prevTimestamp||(ni.prevTimestamp=o,d=!0);const l=o-ni.prevTimestamp;if(ni.decodeDiffTimestamp=l,l>1e3&&!d&&si.isPlayer&&si.debugLog(ni.TAG_NAME,`_decodeVideo now time is ${o} and prev time is ${ni.prevTimestamp}, diff time is ${l} ms`),ni.cacheTrack.id&&t>=ni.cacheTrack.dts){let e=8+ni.cacheTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(_n.types.mdat,4),r.set(ni.cacheTrack.data,8),ni.cacheTrack.duration=t-ni.cacheTrack.dts;let i=_n.moof(ni.cacheTrack,ni.cacheTrack.dts);ni.cacheTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),ni.appendBuffer(n.buffer)}else si.debugLog(ni.TAG_NAME,`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${n} cacheTrack dts is ${ni.cacheTrack&&ni.cacheTrack.dts}`),ni.timeInit=!1,ni.cacheTrack={};ni.cacheTrack||(ni.cacheTrack={}),ni.cacheTrack.id=Lt,ni.cacheTrack.sequenceNumber=++ni.sequenceNumber,ni.cacheTrack.size=a,ni.cacheTrack.dts=t,ni.cacheTrack.cts=i,ni.cacheTrack.isKeyframe=r,ni.cacheTrack.data=s,ni.cacheTrack.flags={isLeading:0,dependsOn:r?2:1,isDependedOn:r?1:0,hasRedundancy:0,isNonSync:r?0:1},ni.prevTimestamp=(new Date).getTime()},_decodeAudio(e,t,r){let i=ni.isAAC?e.slice(2):e.slice(1),n=i.byteLength;if(ni.cacheAudioTrack.id&&t>=ni.cacheAudioTrack.dts){let e=8+ni.cacheAudioTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(_n.types.mdat,4),r.set(ni.cacheAudioTrack.data,8),ni.cacheAudioTrack.duration=t-ni.cacheAudioTrack.dts;let i=_n.moof(ni.cacheAudioTrack,ni.cacheAudioTrack.dts);ni.cacheAudioTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),ni.appendAudioBuffer(n.buffer)}else ni.cacheAudioTrack={};ni.cacheAudioTrack||(ni.cacheAudioTrack={}),ni.cacheAudioTrack.id=Ft,ni.cacheAudioTrack.sequenceNumber=++ni.audioSequenceNumber,ni.cacheAudioTrack.size=n,ni.cacheAudioTrack.dts=t,ni.cacheAudioTrack.cts=0,ni.cacheAudioTrack.data=i,ni.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}},appendBuffer(e){si.isDestroyed?si.debugWarn(ni.TAG_NAME,"appendBuffer() player is destroyed"):ni.mediaSourceAddSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):ni.mediaSourceAppendBufferFull?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):ni.mediaSourceAppendBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):ni.mediaSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(ni.pendingSegments.push(e),ni.sourceBuffer&&(si._opt.mseAutoCleanupSourceBuffer&&ni._needCleanupSourceBuffer()&&ni._doCleanUpSourceBuffer(),vr(ni.getSourceBufferUpdating())&&ni.isStateOpen()&&vr(ni._hasPendingRemoveRanges()))?ni._doAppendSegments():ni.isStateClosed()?(ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):ni.isStateEnded()&&(ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,"mediaSource is end")))},appendAudioBuffer(e){si.isDestroyed?si.debugWarn(ni.TAG_NAME,"appendAudioBuffer() player is destroyed"):ni.mediaSourceAddSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):ni.mediaSourceAppendBufferFull?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):ni.mediaSourceAppendBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):ni.mediaSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(ni.pendingAudioSegments.push(e),ni.audioSourceBuffer&&(si._opt.mseAutoCleanupSourceBuffer&&ni._needCleanupSourceBuffer()&&ni._doCleanUpSourceBuffer(),vr(ni.getAudioSourceBufferUpdating())&&ni.isStateOpen()&&vr(ni._hasPendingRemoveRanges()))?ni._doAppendSegments():ni.isStateClosed()?(ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):ni.isStateEnded()&&(ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,"mediaSource is end")))},getSourceBufferUpdating:()=>ni.sourceBuffer&&ni.sourceBuffer.updating,getAudioSourceBufferUpdating:()=>ni.audioSourceBuffer&&ni.audioSourceBuffer.updating,stop(){ni.abortSourceBuffer(),ni.removeSourceBuffer(),ni.endOfStream()},clearUpAllSourceBuffer(){if(ni.sourceBuffer){const e=ni.sourceBuffer.buffered;for(let t=0;tni.pendingSegments.length>0||ni.pendingAudioSegments.length>0,getPendingSegmentsLength:()=>ni.pendingSegments.length,_handleUpdatePlaybackRate(){},_doAppendSegments(){if(ni.isStateClosed()||ni.isStateEnded())si.debugLog(ni.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==ni.sourceBuffer){if(ni.needInitAudio()&&null===ni.audioSourceBuffer)return si.debugLog(ni.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===ni.audioSourceBufferCheckTimeout&&(ni.audioSourceBufferCheckTimeout=setTimeout((()=>{ni._clearAudioSourceBufferCheckTimeout(),ni.emitError(Le.mediaSourceAudioInitTimeout)}),1e3)));if(vr(ni.getSourceBufferUpdating())&&ni.pendingSegments.length>0){const e=ni.pendingSegments.shift();try{ni.sourceBuffer.appendBuffer(e)}catch(e){si.debugError(ni.TAG_NAME,"mseDecoder.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(ni.stop(),ni.mediaSourceAppendBufferFull=!0,ni.emitError(Le.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(ni.stop(),ni.mediaSourceAppendBufferError=!0,ni.emitError(Le.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(ni.stop(),ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,`code is ${e.code} , message is ${e.message}`))}}if(vr(ni.getAudioSourceBufferUpdating())&&ni.pendingAudioSegments.length>0){const e=ni.pendingAudioSegments.shift();try{ni.audioSourceBuffer.appendBuffer(e)}catch(e){si.debugError(ni.TAG_NAME,"mseDecoder.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(ni.stop(),ni.mediaSourceAppendBufferFull=!0,ni.emitError(Le.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(ni.stop(),ni.mediaSourceAppendBufferError=!0,ni.emitError(Le.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(ni.stop(),ni.mediaSourceBufferError=!0,ni.emitError(Le.mseSourceBufferError,e.code,`code is ${e.code} , message is ${e.message}`))}}}else si.debugLog(ni.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")},_doCleanUpSourceBuffer(){const e=ni.$video.currentTime;if(ni.sourceBuffer){const t=ni.sourceBuffer.buffered;let r=!1;for(let i=0;i=si._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-si._opt.mseAutoCleanupMinBackwardDuration;ni.pendingRemoveRanges.push({start:n,end:t})}}else s=si._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-si._opt.mseAutoCleanupMinBackwardDuration;ni.pendingAudioRemoveRanges.push({start:n,end:t})}}else sni.pendingRemoveRanges.length>0||ni.pendingAudioRemoveRanges.length>0,needInitAudio:()=>si._opt.hasAudio&&si._opt.mseDecodeAudio,_doRemoveRanges(){if(ni.sourceBuffer&&vr(ni.getSourceBufferUpdating())){let e=ni.pendingRemoveRanges;for(;e.length&&vr(ni.getSourceBufferUpdating());){let t=e.shift();try{ni.sourceBuffer.remove(t.start,t.end)}catch(e){si.debugWarn(ni.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e,e.toString())}}}if(ni.audioSourceBuffer&&vr(ni.getAudioSourceBufferUpdating())){let e=ni.pendingAudioRemoveRanges;for(;e.length&&vr(ni.getAudioSourceBufferUpdating());){let t=e.shift();try{ni.audioSourceBuffer.remove(t.start,t.end)}catch(e){si.debugWarn(ni.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e,e.toString())}}}},_getPlaybackRate(){},_needCleanupSourceBuffer(){if(vr(si._opt.mseAutoCleanupSourceBuffer))return!1;const e=ni.$video.currentTime;if(ni.sourceBuffer){let t=ni.sourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=si._opt.mseAutoCleanupMaxBackwardDuration)return!0}if(ni.audioSourceBuffer){let t=ni.audioSourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=si._opt.mseAutoCleanupMaxBackwardDuration)return!0}return!1},_clearAudioSourceBufferCheckTimeout(){ni.audioSourceBufferCheckTimeout&&(clearTimeout(ni.audioSourceBufferCheckTimeout),ni.audioSourceBufferCheckTimeout=null)},_clearAudioNoDataCheckTimeout(){ni.audioSourceNoDataCheckTimeout&&(clearTimeout(ni.audioSourceNoDataCheckTimeout),ni.audioSourceNoDataCheckTimeout=null)},getHandle:()=>ni.mediaSource.handle,emitError(e){postMessage({cmd:se,value:e,msg:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""})}});let si={isPlayer:!0,isHevc:null,isPlayback:!1,dropping:!1,isPushDropping:!1,isWorkerFetch:!1,isDestroyed:!1,fetchStatus:Ct,_opt:Ar(),mp3Demuxer:null,delay:-1,pushLatestDelay:-1,firstTimestamp:null,startTimestamp:null,preDelayTimestamp:null,stopId:null,streamFps:null,streamAudioFps:null,streamVideoFps:null,writableStream:null,networkDelay:0,webglObj:null,startStreamRateAndStatsInterval:function(){si.stopStreamRateAndStatsInterval(),l=setInterval((()=>{d&&d(0);const e=JSON.stringify({demuxBufferDelay:si.getVideoBufferLength(),audioDemuxBufferDelay:si.getAudioBufferLength(),streamBufferByteLength:si.getStreamBufferLength(),netBuf:si.networkDelay||0,pushLatestDelay:si.pushLatestDelay||0,latestDelay:si.delay,isStreamTsMoreThanLocal:je,wasmDecodeDelay:Se-Ee});postMessage({cmd:O,type:Ce,value:e})}),1e3)},stopStreamRateAndStatsInterval:function(){l&&(clearInterval(l),l=null)},useOffscreen:function(){return si._opt.useOffscreen&&"undefined"!=typeof OffscreenCanvas},getDelay:function(e,t){if(!e||si._opt.hasVideo&&!x)return-1;if(t===ae)return si.delay;if(si.preDelayTimestamp&&si.preDelayTimestamp>e)return si.preDelayTimestamp-e>1e3&&si.debugWarn("worker",`getDelay() and preDelayTimestamp is ${si.preDelayTimestamp} > timestamp is ${e} more than ${si.preDelayTimestamp-e}ms and return ${si.delay}`),si.preDelayTimestamp=e,si.delay;if(si.firstTimestamp){if(e){const t=Date.now()-si.startTimestamp,r=e-si.firstTimestamp;t>=r?(je=!1,si.delay=t-r):(je=!0,si.delay=r-t)}}else si.firstTimestamp=e,si.startTimestamp=Date.now(),si.delay=-1;return si.preDelayTimestamp=e,si.delay},getDelayNotUpdateDelay:function(e,t){if(!e||si._opt.hasVideo&&!x)return-1;if(t===ae)return si.pushLatestDelay;if(si.preDelayTimestamp&&si.preDelayTimestamp-e>1e3)return si.debugWarn("worker",`getDelayNotUpdateDelay() and preDelayTimestamp is ${si.preDelayTimestamp} > timestamp is ${e} more than ${si.preDelayTimestamp-e}ms and return -1`),-1;if(si.firstTimestamp){let t=-1;if(e){const r=Date.now()-si.startTimestamp,i=e-si.firstTimestamp;r>=i?(je=!1,t=r-i):(je=!0,t=i-r)}return t}return-1},resetDelay:function(){si.firstTimestamp=null,si.startTimestamp=null,si.delay=-1,si.dropping=!1},resetAllDelay:function(){si.resetDelay(),si.preDelayTimestamp=null},doDecode:function(e){si._opt.isEmitSEI&&e.type===oe&&si.isWorkerFetch&&si.findSei(e.payload,e.ts),si.isPlayUseMSEAndDecoderInWorker()?e.type===ae?si._opt.mseDecodeAudio?ni.decodeAudio(e.payload,e.ts):e.decoder.decode(e.payload,e.ts):e.type===oe&&ni.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):si._opt.useWCS&&si.useOffscreen()&&e.type===oe&&s.decode?s.decode(e.payload,e.ts,e.cts):e.decoder.decode(e.payload,e.ts,e.isIFrame,e.cts)},decodeNext(e){if(0===i.length)return;const t=e.ts,n=i[0],s=e.type===oe&&gr(e.payload);if(vr(r))s&&(si.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n isVideoSqeHeader is ${s}`),i.shift(),si.doDecode(n));else{const r=n.ts-t,a=n.type===ae&&e.type===oe;(r<=20||a||s)&&(si.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n diff is ${r} and isVideoAndNextAudio is ${a} and isVideoSqeHeader is ${s}`),i.shift(),si.doDecode(n))}},init:function(){si.debugLog("worker","init and opt is",JSON.stringify(si._opt));const e=si._opt.playType===v,t=si._opt.playType===b;if(kr.init(),si.isPlayer=e,si.isPlayback=t,si.isPlayUseMSEAndDecoderInWorker()&&ni&&ni.init(),s&&si._opt.useWCS&&si.useOffscreen()&&s.init(),vr(si.isPlaybackCacheBeforeDecodeForFpsRender())){si.debugLog("worker","setInterval()");const t=()=>{const t=si._opt.videoBuffer+si._opt.videoBufferDelay;let r=null;if(i.length){if(si.isPushDropping)return void si.debugWarn("worker",`loop() isPushDropping is true and bufferList length is ${i.length}`);if(si.dropping){for(r=i.shift(),si.debugWarn("worker",`loop() dropBuffer is dropping and isIFrame ${r.isIFrame} and delay is ${si.delay} and bufferlist is ${i.length}`);!r.isIFrame&&i.length;)r=i.shift();const e=si.getDelayNotUpdateDelay(r.ts,r.type);r.isIFrame&&e<=si.getNotDroppingDelayTs()&&(si.debugLog("worker","loop() is dropping = false, is iFrame"),si.dropping=!1,si.doDecode(r),si.decodeNext(r))}else if(si.isPlayback||si.isPlayUseMSE()||0===si._opt.videoBuffer)for(;i.length;)r=i.shift(),si.doDecode(r);else if(r=i[0],-1===si.getDelay(r.ts,r.type))si.debugLog("worker","loop() common dumex delay is -1 ,data.ts is",r.ts),i.shift(),si.doDecode(r),si.decodeNext(r);else if(si.delay>t&&e)si.hasIframeInBufferList()?(si.debugLog("worker",`delay is ${si.delay} > maxDelay ${t}, set dropping is true`),si.resetAllDelay(),si.dropping=!0,postMessage({cmd:H})):(i.shift(),si.doDecode(r),si.decodeNext(r));else for(;i.length;){if(r=i[0],!(si.getDelay(r.ts,r.type)>si._opt.videoBuffer)){si.delay<0&&si.debugWarn("worker",`loop() do not decode and delay is ${si.delay}, bufferList is ${i.length}`);break}i.shift(),si.doDecode(r)}}else-1!==si.delay&&si.debugLog("worker","loop() bufferList is empty and reset delay"),si.resetAllDelay()};si.stopId=setInterval((()=>{let e=(new Date).getTime();Je||(Je=e);const r=e-Je;r>100&&si.debugWarn("worker",`loop demux diff time is ${r}`),t(),Je=(new Date).getTime()}),20)}else si.debugLog("worker","playback and playbackIsCacheBeforeDecodeForFpsRender is true");if(vr(si._opt.checkFirstIFrame)&&(x=!0),si.isPlayUseMSEAndDecoderInWorker()&&ni){const e=ni.getHandle();e&&postMessage({cmd:ie,mseHandle:e},[e])}},playbackCacheLoop:function(){si.clearPlaybackCacheLoop();const e=()=>{let e=null;i.length&&(e=i.shift(),si.doDecode(e))};e();const t=Math.ceil(1e3/(si.streamFps*si._opt.playbackRate));si.debugLog("worker",`playbackCacheLoop fragDuration is ${t}, streamFps is ${si.streamFps}, streamAudioFps is ${si.streamAudioFps} ,streamVideoFps is ${si.streamVideoFps} playbackRate is ${si._opt.playbackRate}`),si.stopId=setInterval(e,t)},clearPlaybackCacheLoop:function(){si.stopId&&(clearInterval(si.stopId),si.stopId=null)},startPlaybackCacheLoop:function(){si.playbackCacheLoop()},close:function(){if(si.debugLog("worker","close"),si.isDestroyed=!0,Ur(),!o||1!==o.readyState&&2!==o.readyState?o&&si.debugLog("worker",`close() and socket.readyState is ${o.readyState}`):(Sr=!0,o.close(1e3,"Client disconnecting")),o=null,si.stopStreamRateAndStatsInterval(),si.stopId&&(clearInterval(si.stopId),si.stopId=null),si.mp3Demuxer&&(si.mp3Demuxer.destroy(),si.mp3Demuxer=null),si.writableStream&&vr(si.writableStream.locked)&&si.writableStream.close().catch((e=>{si.debugLog("worker","close() and writableStream.close() error",e.toString(),e)})),si.writableStream=null,ai)try{ai.clear&&ai.clear(),ai=null}catch(e){si.debugLog("worker","close() and audioDecoder.clear error",e.toString(),e)}if(oi)try{oi.clear&&oi.clear(),oi=null}catch(e){si.debugLog("worker","close() and videoDecoder.clear error",e.toString())}d=null,Je=null,je=!1,Se=0,Ee=0,s&&(s.destroy&&s.destroy(),s=null),ni&&(ni.destroy(),ni=null),si.firstTimestamp=null,si.startTimestamp=null,si.networkDelay=0,si.streamFps=null,si.streamAudioFps=null,si.streamVideoFps=null,si.delay=-1,si.pushLatestDelay=-1,si.preDelayTimestamp=null,si.dropping=!1,si.isPushDropping=!1,si.isPlayer=!0,si.isPlayback=!1,si.isWorkerFetch=!1,si.isHevc=null,si._opt=Ar(),si.webglObj&&(si.webglObj.destroy(),si.offscreenCanvas.removeEventListener("webglcontextlost",si.onOffscreenCanvasWebglContextLost),si.offscreenCanvas.removeEventListener("webglcontextrestored",si.onOffscreenCanvasWebglContextRestored),si.offscreenCanvas=null,si.offscreenCanvasGL=null,si.offscreenCanvasCtx=null),i=[],n=[],c&&(c.close(),c=null),h=null,f=null,S=!1,E=!1,x=!1,Wt=!1,Vt=!1,Xt=!1,er=null,it=[],Ut=0,Tt=0,Qe=null,tt=null,$t=null,Ot=null,ar=null,Gt=0,Ht=0,ut=null,At=null,si.fetchStatus=Ct,Er=!0,kr.destroy(),Gr.destroy(),Hr.destroy(),qr.destroy(),si.debug=null,si._opt={},postMessage({cmd:K})},pushBuffer:function(e,t){if(t.type===ae&&Yt(e)){if(si.debugLog("worker",`pushBuffer audio ts is ${t.ts}, isAacCodecPacket is true`),si._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:Q,buffer:t},[t.buffer])}si.decodeAudio(e,t.ts)}else if(t.type===oe&&t.isIFrame&&gr(e)){if(si.debugLog("worker",`pushBuffer video ts is ${t.ts}, isVideoSequenceHeader is true`),si._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:ee,buffer:t},[t.buffer])}si.decodeVideo(e,t.ts,t.isIFrame,t.cts)}else{if(si._opt.isRecording)if(si._opt.isRecordTypeFlv){const r=new Uint8Array(e);postMessage({cmd:te,type:t.type,buffer:r,ts:t.ts},[r.buffer])}else if(si._opt.recordType===w)if(t.type===oe){const r=new Uint8Array(e).slice(5);postMessage({cmd:z,buffer:r,isIFrame:t.isIFrame,ts:t.ts,cts:t.cts},[r.buffer])}else if(t.type===ae&&si._opt.isWasmMp4){const r=new Uint8Array(e),i=Kt(r)?r.slice(2):r.slice(1);postMessage({cmd:F,buffer:i,ts:t.ts},[i.buffer])}if(si.isPlayer){if(t.type===oe){if(Gt>0){const e=t.ts-Ot,r=Gt+Gt/2;e>r&&si.debugLog("worker",`pushBuffer video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts}, preTs is ${Ot},\n diff is ${e} and preTsDuration is ${Gt} and maxDiff is ${r}\n maybe trigger black screen or flower screen\n `)}if(null!==Ot&&Ot>=t.ts&&(si.debugWarn("worker",`pushBuffer() and isIFrame is ${t.isIFrame} and,\n options.ts is ${t.ts} less than (or equal) preTs is ${Ot} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${Ht}`),Ot-t.ts>A&&(si.debugWarn("worker",`pushBuffer,\n preTimestamp is ${Ot}, options.ts is ${t.ts},\n diff is ${Ot-t.ts} more than 3600000,\n and resetAllDelay`),si.resetAllDelay(),Ot=null,Gt=0),si._opt.isDropSameTimestampGop&&vr(t.isIFrame)&&x)){const e=si.hasIframeInBufferList(),t=vr(si.isPushDropping);return si.debugLog("worker",`pushBuffer, isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next dropBuffer`),void(e&&t?si.dropBuffer$2():(si.clearBuffer(!0),yr(si._opt.checkFirstIFrame)&&yr(r)&&(si.isPlayUseMSEAndDecoderInWorker()?ni.isDecodeFirstIIframe=!1:postMessage({cmd:re}))))}Ot>0&&(Gt=t.ts-Ot),Ht=e.byteLength,Ot=t.ts}if(x){const e=si._opt.videoBuffer+si._opt.videoBufferDelay,r=si.getDelayNotUpdateDelay(t.ts,t.type);si.pushLatestDelay=r,si.delay>0&&r>e&&si.delay({type:e.type,ts:e.ts})));si.debugLog("worker",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${i.length}, and ts list is ${JSON.stringify(r)}`)}const r=si.getAudioBufferLength()>0,n=r?60:40;i.length>=n&&(si.debugWarn("worker",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${i.length} more than ${n}, and hasAudio is ${r} an set streamFps is 25`),si.streamVideoFps=25,postMessage({cmd:V,value:si.streamVideoFps}),r?(si.streamAudioFps=25,si.streamFps=si.streamVideoFps+si.streamAudioFps):si.streamFps=si.streamVideoFps,si.playbackCacheLoop())}}},getVideoBufferLength(){let e=0;return i.forEach((t=>{t.type===oe&&(e+=1)})),e},hasIframeInBufferList:()=>i.some((e=>e.type===oe&&e.isIFrame)),isAllIframeInBufferList(){const e=si.getVideoBufferLength();let t=0;return i.forEach((e=>{e.type===oe&&e.isIFrame&&(t+=1)})),e===t},getNotDroppingDelayTs:()=>si._opt.videoBuffer+si._opt.videoBufferDelay/2,getAudioBufferLength(){let e=0;return i.forEach((t=>{t.type===ae&&(e+=1)})),e},getStreamBufferLength(){let e=0;return c&&c.buffer&&(e=c.buffer.byteLength),si._opt.isNakedFlow?kr.lastBuf&&(e=kr.lastBuf.byteLength):si._opt.isTs?qr._remainingPacketData&&(e=qr._remainingPacketData.byteLength):si._opt.isFmp4&&Gr.mp4Box&&(e=Gr.mp4Box.getAllocatedSampleDataSize()),e},fetchStream:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(si.debugLog("worker","fetchStream, url is "+e,"options:",JSON.stringify(t)),si.isWorkerFetch=!0,t.isFlv?si._opt.isFlv=!0:t.isFmp4?si._opt.isFmp4=!0:t.isMpeg4?si._opt.isMpeg4=!0:t.isNakedFlow?si._opt.isNakedFlow=!0:t.isTs&&(si._opt.isTs=!0),d=or((e=>{postMessage({cmd:O,type:Ue,value:e})})),si.startStreamRateAndStatsInterval(),t.isFmp4&&(Gr.listenMp4Box(),si._opt.isFmp4Private&&Gr.initTransportDescarmber()),t.protocol===_){t.isFlv&&(c=new Br(si.demuxFlv())),a=new AbortController;const r=Object.assign({signal:a.signal},{headers:t.options&&t.options.headers||{}});fetch(e,r).then((e=>{if(yr(Sr))return si.debugLog("worker","request abort and run res.body.cancel()"),si.fetchStatus=Ct,void e.body.cancel();if(!mr(e))return si.debugWarn("worker",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),Ur(),void postMessage({cmd:O,type:Le.fetchError,value:`fetch response status is ${e.status} and ok is ${e.ok}`});if(postMessage({cmd:O,type:ke}),hr())si.writableStream=new WritableStream({write:e=>a&&a.signal&&a.signal.aborted?(si.debugLog("worker","writableStream write() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt)):yr(Sr)?(si.debugLog("worker","writableStream write() and requestAbort is true so return"),si.fetchStatus=Pt,void Ur()):void("string"!=typeof e?(si.fetchStatus=Dt,d(e.byteLength),t.isFlv?c.write(e):t.isFmp4?si.demuxFmp4(e):t.isMpeg4?si.demuxMpeg4(e):t.isTs?si.demuxTs(e):t.isNakedFlow&&si.demuxNakedFlow(e)):si.debugWarn("worker",`writableStream write() and value is "${e}" string so return`)),close:()=>{si.debugLog("worker","writableStream close()"),si.fetchStatus=Pt,c&&(c.close(),c=null),Ur(),postMessage({cmd:O,type:Ae,value:g,msg:"fetch done"})},abort:e=>{if(a&&a.signal&&a.signal.aborted)return si.debugLog("worker","writableStream abort() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt);c&&(c.close(),c=null),e.name!==Bt?(si.debugLog("worker",`writableStream abort() and e is ${e.toString()}`),Ur(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()})):si.debugLog("worker","writableStream abort() and e.name is AbortError so return")}}),e.body.pipeTo(si.writableStream).catch((e=>{"AbortError"!==e.name&&si.debugLog("worker","writableStream pipeTo() and e is",e.name,e.toString())}));else{const r=e.body.getReader(),i=()=>{r.read().then((e=>{let{done:r,value:n}=e;return r?(si.debugLog("worker","fetchNext().then() and done is true"),si.fetchStatus=Pt,c&&(c.close(),c=null),Ur(),void postMessage({cmd:O,type:Ae,value:g,msg:"fetch done"})):a&&a.signal&&a.signal.aborted?(si.debugLog("worker","fetchNext().then() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt)):yr(Sr)?(si.debugLog("worker","fetchNext().then() and requestAbort is true so return"),si.fetchStatus=Pt,void Ur()):void("string"!=typeof n?(si.fetchStatus=Dt,d(n.byteLength),t.isFlv?c.write(n):t.isFmp4?si.demuxFmp4(n):t.isMpeg4?si.demuxMpeg4(n):t.isTs?si.demuxTs(n):t.isNakedFlow&&si.demuxNakedFlow(n),i()):si.debugWarn("worker",`fetchNext().then() and value "${n}" is string so return`))})).catch((e=>{if(a&&a.signal&&a.signal.aborted)return si.debugLog("worker","fetchNext().catch() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt);c&&(c.close(),c=null),e.name!==Bt?(si.debugLog("worker",`fetchNext().catch() and e is ${e.toString()}`),Ur(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()})):si.debugLog("worker","fetchNext().catch() and e.name is AbortError so return")}))};i()}})).catch((e=>{a&&a.signal&&a.signal.aborted?si.debugLog("worker","fetch().catch() and abortController.signal.aborted is true so return"):e.name!==Bt?(si.debugLog("worker",`fetch().catch() and e is ${e.toString()}`),Ur(),postMessage({cmd:O,type:Le.fetchError,value:e.toString()}),c&&(c.close(),c=null)):si.debugLog("worker","fetch().catch() and e.name is AbortError so return")}))}else t.protocol===m&&(t.isFlv&&(c=new Br(si.demuxFlv())),o=new WebSocket(e,r),o.binaryType="arraybuffer",o.onopen=()=>{si.debugLog("worker","fetchStream, WebsocketStream socket open"),postMessage({cmd:O,type:ke}),postMessage({cmd:O,type:Pe})},o.onclose=e=>{si.isDestroyed?si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} and isDestroyed is true, so return`):u?si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} but isSocketError is true , so return`):(si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code}`),1006===e.code&&si.debugError("worker",`fetchStream, WebsocketStream socket close abnormally and code is ${e.code}`),yr(Sr)?si.debugLog("worker","fetchStream, WebsocketStream socket close and requestAbort is true so return"):(c&&(c.close(),c=null),postMessage({cmd:O,type:Ae,value:y,msg:e.code})))},o.onerror=e=>{si.debugError("worker","fetchStream, WebsocketStream socket error",e,e.toString()),u=!0,c&&(c.close(),c=null),si.isDestroyed?si.debugLog("worker","fetchStream, WebsocketStream on error and isDestroyed is true, so return"):postMessage({cmd:O,type:Le.websocketError,value:e.isTrusted?"websocket user aborted":"websocket error"})},o.onmessage=e=>{"string"!=typeof e.data?(d(e.data.byteLength),t.isFlv?c.write(e.data):t.isFmp4?si.demuxFmp4(e.data):t.isMpeg4?si.demuxMpeg4(e.data):si._opt.isNakedFlow?si.demuxNakedFlow(e.data):si.demuxM7s(e.data)):si.debugWarn("worker",`socket on message is string "${e.data}" and return`)})},demuxFlv:function*(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),r=new Uint32Array(e);for(;;){t[3]=0;const e=yield 15,i=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const n=r[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let s=r[0];const a=(yield n).slice();switch(i){case de:if(a.byteLength>0){let e=a;yr(si._opt.m7sCryptoAudio)&&(e=si.cryptoPayloadAudio(a)),si.decode(e,{type:ae,ts:s})}else si.debugWarn("worker",`demuxFlv() type is audio and payload.byteLength is ${a.byteLength} and return`);break;case le:if(a.byteLength>=6){const e=a[0];if(si._isEnhancedH265Header(e))si._decodeEnhancedH265Video(a,s);else{const e=15&a[0];let t=a[0]>>4===kt;const i=e===Re;if(vr(t)&&yr(wr(a,i))&&(si.debugLog("worker","demux() isIFrame is false and unit type is IDR and update to true"),t=!0),t&&gr(a)&&null===si.isHevc){const e=15&a[0];si.isHevc=e===Re,er=ir(a,si.isHevc),si.debugLog("worker",`demuxFlv() isVideoSequenceHeader is true and isHevc is ${si.isHevc} and nalUnitSize is ${er}`)}t&&si.calcIframeIntervalTimestamp(s),si.isPlayer&&si.calcNetworkDelay(s),r[0]=a[4],r[1]=a[3],r[2]=a[2],r[3]=0;let n=r[0],o=si.cryptoPayload(a,t);si.decode(o,{type:oe,ts:s,isIFrame:t,cts:n})}}else si.debugWarn("worker",`demuxFlv() type is video and payload.byteLength is ${a.byteLength} and return`);break;case ce:postMessage({cmd:J,buffer:a},[a.buffer]);break;default:si.debugLog("worker",`demuxFlv() type is ${i}`)}}},decode:function(e,t){t.type===ae?si._opt.hasAudio&&(postMessage({cmd:O,type:Be,value:e.byteLength}),si.isPlayer?si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts}):si.isPlayback&&(si.isPlaybackOnlyDecodeIFrame()||(si.isPlaybackCacheBeforeDecodeForFpsRender(),si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts})))):t.type===oe&&si._opt.hasVideo&&(postMessage({cmd:O,type:xe,value:e.byteLength}),postMessage({cmd:O,type:Te,value:t.ts}),si.isPlayer?si.pushBuffer(e,{type:t.type,ts:t.ts,isIFrame:t.isIFrame,cts:t.cts}):si.isPlayback&&(si.isPlaybackOnlyDecodeIFrame()?t.isIFrame&&si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}):(si.isPlaybackCacheBeforeDecodeForFpsRender(),si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}))))},cryptoPayload:function(e,t){let r=e;return si._opt.isM7sCrypto?si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?r=Ni(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc):si.debugError("worker",`isM7sCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`):si._opt.isSm4Crypto?si._opt.sm4CryptoKey?r=si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?rs(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc,si._opt.isSm4CryptoH265V2):dn(e,si._opt.sm4CryptoKey,si.isHevc,si._opt.isSm4CryptoH265V2):si._opt.sm4CryptoKey||si.debugError("worker","isSm4Crypto opt.sm4CryptoKey is null"):si._opt.isXorCrypto&&(si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?r=fn(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc):si.debugError("worker",`isXorCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`)),r},cryptoPayloadAudio:function(e){let t=e;return si._opt.isM7sCrypto&&(si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?e[0]>>4===$e&&(t=$i(e,si._opt.cryptoKey,si._opt.cryptoIV)):si.debugError("worker",`isM7sCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`)),t},setCodecAudio:function(e,t){const r=e[0]>>4,i=e[0]>>1&1;if(ar=r===$e?i?16:8:0===i?8:16,ai&&ai.setCodec)if(Yt(e)||r===Oe||r===Ge||r===He){si.debugLog("worker",`setCodecAudio: init audio codec, codeId is ${r} _opt.sampleRate is ${si._opt.sampleRate}`);const i=r===$e?e.slice(2):new Uint8Array(0);ai.setCodec(r,si._opt.sampleRate,i),r===$e&&postMessage({cmd:I,buffer:i},[i.buffer]),E=!0,r!==$e&&(r===He?(si.mp3Demuxer||(si.mp3Demuxer=new cn(si),si.mp3Demuxer.on("data",((e,t)=>{ai.decode(e,t)}))),si.mp3Demuxer.dispatch(e.slice(1),t)):ai.decode(e.slice(1),t));{const e=Number("1")||1;setTimeout((()=>{si.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),si.close(),postMessage({cmd:W})}),60*e*60*1e3)}}else si.debugWarn("worker","setCodecAudio: hasInitAudioCodec is false, codecId is ",r);else si.debugError("worker","setCodecAudio: audioDecoder or audioDecoder.setCodec is null")},decodeAudio:function(e,t){if(si.isDestroyed)si.debugLog("worker","decodeAudio, decoder is destroyed and return");else if(si.isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio())ni.decodeAudio(e,t);else if(yr(r)&&yr(si._opt.mseDecodeAudio))postMessage({cmd:$,payload:e,ts:t,cts:t},[e.buffer]);else{const r=e[0]>>4;if(E){if(Yt(e))return void si.debugLog("worker","decodeAudio and has already initialized and payload is aac codec packet so drop this frame");r===He?si.mp3Demuxer.dispatch(e.slice(1),t):ai.decode(r===$e?e.slice(2):e.slice(1),t)}else si.setCodecAudio(e,t)}},setCodecVideo:function(e,t){const r=15&e[0];if(oi&&oi.setCodec)if(gr(e))if(r===Ie||r===Re){si.debugLog("worker",`setCodecVideo: init video codec , codecId is ${r}`);const t=e.slice(5);if(r===Ie&&si._opt.useSIMD){const e=Cr(t);if(e.codecWidth>U||e.codecHeight>U)return postMessage({cmd:Y,value:`width: ${e.codecWidth} > 4080, height: ${e.codecHeight} > 4080`}),void si.debugWarn("worker",`setCodecVideo: SIMD H264 decode video width is too large, width is ${e.codecWidth}, height is ${e.codecHeight}`)}const i=new Uint8Array(e);S=!0,oi.setCodec(r,t),postMessage({cmd:R,code:r}),postMessage({cmd:M,buffer:i,codecId:r},[i.buffer])}else si.debugWarn("worker",`setCodecVideo: hasInitVideoCodec is false, codecId is ${r} is not H264 or H265`);else si.debugWarn("worker",`decodeVideo: hasInitVideoCodec is false, codecId is ${r} and isIFrame is ${t} and packetType is ${e[1]}`);else si.debugError("worker","setCodecVideo: videoDecoder or videoDecoder.setCodec is null")},decodeVideo:function(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(si.isDestroyed)si.debugLog("worker","decodeVideo, decoder is destroyed and return");else if(si.isPlayUseMSEAndDecoderInWorker())ni.decodeVideo(e,t,i,n);else if(yr(r))postMessage({cmd:N,payload:e,isIFrame:i,ts:t,cts:n,delay:si.delay},[e.buffer]);else if(S)if(!x&&i&&(x=!0),x){if(i&&gr(e)){const t=15&e[0];let r={};t===Ie?r=Cr(e.slice(5)):t===Re&&(r=Vr(e)),r.codecWidth&&r.codecHeight&&h&&f&&(r.codecWidth!==h||r.codecHeight!==f)&&(si.debugWarn("worker",`\n decodeVideo: video width or height is changed,\n old width is ${h}, old height is ${f},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),Vt=!0,postMessage({cmd:j,value:`width: ${h}->${r.codecWidth}, height: ${f}->${r.codecHeight}`}))}if(Vt)return void si.debugWarn("worker","decodeVideo: video width or height is changed, and return");if(Xt)return void si.debugWarn("worker","decodeVideo: simd decode error, and return");if(gr(e))return void si.debugLog("worker","decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength0&&void 0!==arguments[0]&&arguments[0];si.debugLog("worker",`clearBuffer,bufferList length is ${i.length}, need clear is ${e}`),e&&(i=[]),si.isPlayer&&(si.resetAllDelay(),yr(si._opt.checkFirstIFrame)&&(si.dropping=!0,postMessage({cmd:H}))),yr(si._opt.checkFirstIFrame)&&vr(r)&&(x=!1)},dropBuffer$2:function(){if(i.length>0){let e=i.findIndex((e=>yr(e.isIFrame)&&e.type===oe));if(si.isAllIframeInBufferList())for(let t=0;t=si.getNotDroppingDelayTs()){si.debugLog("worker",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${n} and notDroppingDelayTs is ${si.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){si.isPushDropping=!0,postMessage({cmd:H});const t=i.length;i=i.slice(e);const r=i.shift();si.resetAllDelay(),si.getDelay(r.ts,r.type),si.doDecode(r),si.isPushDropping=!1,si.debugLog("worker",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,new bufferList is ${i.length} and new delay is ${si.delay} `)}else si.isPushDropping=!1}0===i.length&&(si.isPushDropping=!1)},demuxM7s:function(e){const t=new DataView(e),r=t.getUint32(1,!1),i=t.getUint8(0),n=new ArrayBuffer(4),s=new Uint32Array(n);switch(i){case ae:si.decode(new Uint8Array(e,5),{type:ae,ts:r});break;case oe:if(t.byteLength>=11){const i=new Uint8Array(e,5),n=i[0];if(si._isEnhancedH265Header(n))si._decodeEnhancedH265Video(i,r);else{const e=t.getUint8(5)>>4==1;if(e&&(si.calcIframeIntervalTimestamp(r),gr(i)&&null===si.isHevc)){const e=15&i[0];si.isHevc=e===Re}si.isPlayer&&si.calcNetworkDelay(r),s[0]=i[4],s[1]=i[3],s[2]=i[2],s[3]=0;let n=s[0],a=si.cryptoPayload(i,e);si.decode(a,{type:oe,ts:r,isIFrame:e,cts:n})}}else si.debugWarn("worker",`demuxM7s() type is video and arrayBuffer length is ${e.byteLength} and return`)}},demuxNakedFlow:function(e){kr.dispatch(e)},demuxFmp4:function(e){Gr.dispatch(e)},demuxMpeg4:function(e){Hr.dispatch(e)},demuxTs:function(e){qr.dispatch(e)},_decodeEnhancedH265Video:function(e,t){const r=e[0],i=48&r,n=15&r,s=e.slice(1,5),a=new ArrayBuffer(4),o=new Uint32Array(a),d="a"==String.fromCharCode(s[0]);if(si.isHevc=vr(d),n===Rt){if(i===Nt){const r=e.slice(5);if(d);else{const i=new Uint8Array(5+r.length);i.set([28,0,0,0,0],0),i.set(r,5),er=ir(e,si.isHevc),si.debugLog("worker",`demuxFlv() isVideoSequenceHeader(enhancedH265) is true and isHevc is ${si.isHevc} and nalUnitSize is ${er}`),si.decode(i,{type:oe,ts:t,isIFrame:!0,cts:0})}}}else if(n===Mt){let r=e,n=0;const s=i===Nt;s&&si.calcIframeIntervalTimestamp(t),d||(o[0]=e[4],o[1]=e[3],o[2]=e[2],o[3]=0,n=o[0],r=Xr(e.slice(8),s),r=si.cryptoPayload(r,s),si.decode(r,{type:oe,ts:t,isIFrame:s,cts:n}))}else if(n===zt){const r=i===Nt;r&&si.calcIframeIntervalTimestamp(t);let n=Xr(e.slice(5),r);n=si.cryptoPayload(n,r),si.decode(n,{type:oe,ts:t,isIFrame:r,cts:0})}},_isEnhancedH265Header:function(e){return(e&It)===It},findSei:function(e,t){let r=4;lr(er)&&(r=er),tr(e.slice(5),r).forEach((e=>{const r=si.isHevc?e[0]>>>1&63:31&e[0],i=si.isHevc&&(r===ft||r===ht),n=vr(si.isHevc)&&r===Ke;(i||n)&&postMessage({cmd:Z,buffer:e,ts:t},[e.buffer])}))},calcNetworkDelay:function(e){if(!(x&&e>0))return;null===Qe?(Qe=e,tt=nr()):et?r-t:0;si.networkDelay=i,i>si._opt.networkDelay&&si._opt.playType===v&&(si.debugWarn("worker",`calcNetworkDelay now dts:${e}, start dts is ${Qe} vs start is ${t},local diff is ${r} ,delay is ${i}`),postMessage({cmd:O,type:De,value:i}))},calcIframeIntervalTimestamp:function(e){null===$t?$t=e:$t=si._opt.playbackForwardMaxRateDecodeIFrame&&!(si._opt.useMSE&&si._opt.mseDecodeAudio)},isPlayUseMSE:function(){return si.isPlayer&&si._opt.useMSE&&yr(r)},isPlayUseMSEAndDecoderInWorker:function(){return si.isPlayUseMSE()&&si._opt.mseDecoderUseWorker},isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio:function(){return si.isPlayUseMSEAndDecoderInWorker()&&si._opt.mseDecodeAudio},playbackUpdatePlaybackRate:function(){vr(si.isPlaybackCacheBeforeDecodeForFpsRender())&&si.clearBuffer(!0)},onOffscreenCanvasWebglContextLost:function(e){si.debugError("worker","handleOffscreenCanvasWebglContextLost and next try to create webgl"),e.preventDefault(),Wt=!0,si.webglObj.destroy(),si.webglObj=null,si.offscreenCanvasGL=null,setTimeout((()=>{si.offscreenCanvasGL=si.offscreenCanvas.getContext("webgl"),si.offscreenCanvasGL&&si.offscreenCanvasGL.getContextAttributes().stencil?(si.webglObj=p(si.offscreenCanvasGL,si._opt.openWebglAlignment),Wt=!1):si.debugError("worker","handleOffscreenCanvasWebglContextLost, stencil is false")}),500)},onOffscreenCanvasWebglContextRestored:function(e){si.debugLog("worker","handleOffscreenCanvasWebglContextRestored"),e.preventDefault()},videoInfo:function(e,t,r){postMessage({cmd:R,code:e}),postMessage({cmd:k,w:t,h:r}),h=t,f=r,si.useOffscreen()&&(si.offscreenCanvas=new OffscreenCanvas(t,r),si.offscreenCanvasGL=si.offscreenCanvas.getContext("webgl"),si.webglObj=p(si.offscreenCanvasGL,si._opt.openWebglAlignment),si.offscreenCanvas.addEventListener("webglcontextlost",si.onOffscreenCanvasWebglContextLost,!1),si.offscreenCanvas.addEventListener("webglcontextrestored",si.onOffscreenCanvasWebglContextRestored,!1))},audioInfo:function(e,t,r){postMessage({cmd:L,code:e}),postMessage({cmd:P,sampleRate:t,channels:r,depth:ar}),Tt=r},yuvData:function(t,r){if(si.isDestroyed)return void si.debugLog("worker","yuvData, decoder is destroyed and return");const i=h*f*3/2;let n=e.HEAPU8.subarray(t,t+i),s=new Uint8Array(n);if(ut=null,Ee=r,si.useOffscreen())try{if(Wt)return;si.webglObj.renderYUV(h,f,s);let e=si.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:e,delay:si.delay,ts:r},[e])}catch(e){si.debugError("worker","yuvData, transferToImageBitmap error is",e,e.toString())}else postMessage({cmd:C,output:s,delay:si.delay,ts:r},[s.buffer])},pcmData:function(e,r,i){if(si.isDestroyed)return void si.debugLog("worker","pcmData, decoder is destroyed and return");let s=r,a=[],o=0,d=si._opt.audioBufferSize;for(let r=0;r<2;r++){let i=t.HEAPU32[(e>>2)+r]>>2;a[r]=t.HEAPF32.subarray(i,i+s)}if(Ut){if(!(s>=(r=d-Ut)))return Ut+=s,n[0]=Float32Array.of(...n[0],...a[0]),void(2==Tt&&(n[1]=Float32Array.of(...n[1],...a[1])));it[0]=Float32Array.of(...n[0],...a[0].subarray(0,r)),2==Tt&&(it[1]=Float32Array.of(...n[1],...a[1].subarray(0,r))),postMessage({cmd:D,buffer:it,ts:i},it.map((e=>e.buffer))),o=r,s-=r}for(Ut=s;Ut>=d;Ut-=d)it[0]=a[0].slice(o,o+=d),2==Tt&&(it[1]=a[1].slice(o-d,o)),postMessage({cmd:D,buffer:it,ts:i},it.map((e=>e.buffer)));Ut&&(n[0]=a[0].slice(o),2==Tt&&(n[1]=a[1].slice(o))),a=[]},errorInfo:function(e){null===ut&&(ut=nr());const t=nr(),r=sr(At>0?2*At:5e3,1e3,5e3),i=t-ut;i>r&&(si.debugWarn("worker",`errorInfo() emit simdDecodeError and\n iframeIntervalTimestamp is ${At} and diff is ${i} and maxDiff is ${r}\n and replay`),Xt=!0,postMessage({cmd:q}))},sendWebsocketMessage:function(e){o?o.readyState===Fe?o.send(e):si.debugError("worker","socket is not open"):si.debugError("worker","socket is null")},timeEnd:function(){si.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),si.close(),postMessage({cmd:W})},postStreamToMain(e,t){postMessage({cmd:X,type:t,buffer:e},[e.buffer])},updatePlaybackIsPause(e){si.debugLog("worker",`updatePlaybackIsPause, isPause is ${e}`),yr(e)?si.clearPlaybackCacheLoop():si.startPlaybackCacheLoop()},debugLog(e){if(si._opt.debug&&si.debug){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:{};var t,i,n;(n=e).ready=new Promise(((e,r)=>{t=e,i=r})),(n=void 0!==n?n:{}).locateFile=function(e){return"decoder-pro.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_WASM_URL&&""!=JESSIBUCA_PRO_WASM_URL?JESSIBUCA_PRO_WASM_URL:e};var s,o,a,d=Object.assign({},n),l="./this.program",c="object"==typeof window,u="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";function p(e){return n.locateFile?n.locateFile(e,f):f+e}if(h){const{createRequire:e}=await import("module");var m=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro.js",document.baseURI).href),_=m("fs"),g=m("path");f=u?g.dirname(f)+"/":m("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro.js",document.baseURI).href)),s=(e,t)=>(e=J(e)?new URL(e):g.normalize(e),_.readFileSync(e,t?void 0:"utf8")),a=e=>{var t=s(e,!0);return t.buffer||(t=new Uint8Array(t)),t},o=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=J(e)?new URL(e):g.normalize(e),_.readFile(e,i?void 0:"utf8",((e,n)=>{e?r(e):t(i?n.buffer:n)}))},!n.thisProgram&&process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),n.inspect=()=>"[Emscripten Module object]"}else(c||u)&&(u?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),r&&(f=r),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},u&&(a=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),o=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var y,v,b=n.print||console.log.bind(console),w=n.printErr||console.error.bind(console);Object.assign(n,d),d=null,n.arguments&&n.arguments,n.thisProgram&&(l=n.thisProgram),n.quit&&n.quit,n.wasmBinary&&(y=n.wasmBinary),"object"!=typeof WebAssembly&&j("no native wasm support detected");var S,E,A,U,x,B,k,T,C=!1;function D(e,t){e||j(t)}function P(){var e=v.buffer;n.HEAP8=S=new Int8Array(e),n.HEAP16=A=new Int16Array(e),n.HEAPU8=E=new Uint8Array(e),n.HEAPU16=U=new Uint16Array(e),n.HEAP32=x=new Int32Array(e),n.HEAPU32=B=new Uint32Array(e),n.HEAPF32=k=new Float32Array(e),n.HEAPF64=T=new Float64Array(e)}var F=[],L=[],I=[];function M(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)N(n.preRun.shift());ne(F)}function R(){n.noFSInit||Te.init.initialized||Te.init(),Te.ignorePermissions=!1,ne(L)}function z(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)O(n.postRun.shift());ne(I)}function N(e){F.unshift(e)}function $(e){L.unshift(e)}function O(e){I.unshift(e)}var G=0,H=null;function W(e){G++,n.monitorRunDependencies&&n.monitorRunDependencies(G)}function V(e){if(G--,n.monitorRunDependencies&&n.monitorRunDependencies(G),0==G&&H){var t=H;H=null,t()}}function j(e){n.onAbort&&n.onAbort(e),w(e="Aborted("+e+")"),C=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}var q,Y,K,X="data:application/octet-stream;base64,",Z=e=>e.startsWith(X),J=e=>e.startsWith("file://");function Q(e){if(e==q&&y)return new Uint8Array(y);if(a)return a(e);throw"both async and sync fetching of the wasm failed"}function ee(e){if(!y&&(c||u)){if("function"==typeof fetch&&!J(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>Q(e)));if(o)return new Promise(((t,r)=>{o(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>Q(e)))}function te(e,t,r){return ee(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{w(`failed to asynchronously prepare wasm: ${e}`),j(e)}))}function re(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||Z(t)||J(t)||h||"function"!=typeof fetch?te(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return w(`wasm streaming compile failed: ${e}`),w("falling back to ArrayBuffer instantiation"),te(t,r,i)}))))}function ie(){var e={a:ni};function t(e,t){return si=e.exports,v=si.E,P(),Ft=si.I,$(si.F),V(),si}if(W(),n.instantiateWasm)try{return n.instantiateWasm(e,t)}catch(e){w(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return re(y,q,e,(function(e){t(e.instance)})).catch(i),{}}n.locateFile?Z(q="decoder-pro.wasm")||(q=p(q)):q=new URL("decoder-pro.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro.js",document.baseURI).href).href;var ne=e=>{for(;e.length>0;)e.shift()(n)};function se(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){B[this.ptr+4>>2]=e},this.get_type=function(){return B[this.ptr+4>>2]},this.set_destructor=function(e){B[this.ptr+8>>2]=e},this.get_destructor=function(){return B[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,S[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=S[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,S[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=S[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){B[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return B[this.ptr+16>>2]},this.get_exception_ptr=function(){if(ci(this.get_type()))return B[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}n.noExitRuntime;var oe=(e,t,r)=>{throw new se(e).init(t,r),e},ae=e=>(x[di()>>2]=e,e),de={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=de.isAbs(e),r="/"===e.substr(-1);return(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=de.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=de.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return de.normalize(e.join("/"))},join2:(e,t)=>de.normalize(e+"/"+t)},le=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}j("initRandomDevice")},ce=e=>(ce=le())(e),ue={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:Te.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=de.isAbs(i)}return(t?"/":"")+(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=ue.resolve(e).substr(1),t=ue.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),s=Math.min(i.length,n.length),o=s,a=0;a{for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&he)return he.decode(e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&o)<<6|a)}else s+=String.fromCharCode(o)}return s},pe=[],me=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},_e=(e,t,r,i)=>{if(!(i>0))return 0;for(var n=r,s=r+i-1,o=0;o=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++o)),a<=127){if(r>=s)break;t[r++]=a}else if(a<=2047){if(r+1>=s)break;t[r++]=192|a>>6,t[r++]=128|63&a}else if(a<=65535){if(r+2>=s)break;t[r++]=224|a>>12,t[r++]=128|a>>6&63,t[r++]=128|63&a}else{if(r+3>=s)break;t[r++]=240|a>>18,t[r++]=128|a>>12&63,t[r++]=128|a>>6&63,t[r++]=128|63&a}}return t[r]=0,r-n};function ge(e,t,r){var i=r>0?r:me(e)+1,n=new Array(i),s=_e(e,n,0,n.length);return t&&(n.length=s),n}var ye=()=>{if(!pe.length){var e=null;if(h){var t=Buffer.alloc(256),r=0,i=process.stdin.fd;try{r=_.readSync(i,t)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}e=r>0?t.slice(0,r).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;pe=ge(e,!0)}return pe.shift()},ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},Te.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new Te.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new Te.ErrnoError(60);for(var s=0,o=0;oye(),put_char(e,t){null===t||10===t?(b(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(b(fe(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(w(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(w(fe(e.output,0)),e.output=[])}}},be=e=>{j()},we={ops_table:null,mount:e=>we.createNode(null,"/",16895,0),createNode(e,t,r,i){if(Te.isBlkdev(r)||Te.isFIFO(r))throw new Te.ErrnoError(63);we.ops_table||(we.ops_table={dir:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,lookup:we.node_ops.lookup,mknod:we.node_ops.mknod,rename:we.node_ops.rename,unlink:we.node_ops.unlink,rmdir:we.node_ops.rmdir,readdir:we.node_ops.readdir,symlink:we.node_ops.symlink},stream:{llseek:we.stream_ops.llseek}},file:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:{llseek:we.stream_ops.llseek,read:we.stream_ops.read,write:we.stream_ops.write,allocate:we.stream_ops.allocate,mmap:we.stream_ops.mmap,msync:we.stream_ops.msync}},link:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,readlink:we.node_ops.readlink},stream:{}},chrdev:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:Te.chrdev_stream_ops}});var n=Te.createNode(e,t,r,i);return Te.isDir(n.mode)?(n.node_ops=we.ops_table.dir.node,n.stream_ops=we.ops_table.dir.stream,n.contents={}):Te.isFile(n.mode)?(n.node_ops=we.ops_table.file.node,n.stream_ops=we.ops_table.file.stream,n.usedBytes=0,n.contents=null):Te.isLink(n.mode)?(n.node_ops=we.ops_table.link.node,n.stream_ops=we.ops_table.link.stream):Te.isChrdev(n.mode)&&(n.node_ops=we.ops_table.chrdev.node,n.stream_ops=we.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n,e.timestamp=n.timestamp),n},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Te.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,Te.isDir(e.mode)?t.size=4096:Te.isFile(e.mode)?t.size=e.usedBytes:Te.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&we.resizeFileStorage(e,t.size)},lookup(e,t){throw Te.genericErrors[44]},mknod:(e,t,r,i)=>we.createNode(e,t,r,i),rename(e,t,r){if(Te.isDir(e.mode)){var i;try{i=Te.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new Te.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=Te.lookupNode(e,t);for(var i in r.contents)throw new Te.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink(e,t,r){var i=we.createNode(e,t,41471,0);return i.link=r,i},readlink(e){if(!Te.isLink(e.mode))throw new Te.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,i,n){var s=e.node.contents;if(n>=e.node.usedBytes)return 0;var o=Math.min(e.node.usedBytes-n,i);if(o>8&&s.subarray)t.set(s.subarray(n,n+o),r);else for(var a=0;a0||r+t(we.stream_ops.write(e,t,0,i,r,!1),0)}},Se=(e,t,r,i)=>{var n=i?"":`al ${e}`;o(e,(r=>{D(r,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(r)),n&&V()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),n&&W()},Ee=(e,t,r,i,n,s)=>{Te.createDataFile(e,t,r,i,n,s)},Ae=n.preloadPlugins||[],Ue=(e,t,r,i)=>{"undefined"!=typeof Browser&&Browser.init();var n=!1;return Ae.forEach((s=>{n||s.canHandle(t)&&(s.handle(e,t,r,i),n=!0)})),n},xe=(e,t,r,i,n,s,o,a,d,l)=>{var c=t?ue.resolve(de.join2(e,t)):e;function u(r){function u(r){l&&l(),a||Ee(e,t,r,i,n,d),s&&s(),V()}Ue(r,c,u,(()=>{o&&o(),V()}))||u(r)}W(),"string"==typeof r?Se(r,(e=>u(e)),o):u(r)},Be=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t},ke=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Te={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=ue.resolve(e)))return{path:"",node:null};if(t=Object.assign({follow_mount:!0,recurse_count:0},t),t.recurse_count>8)throw new Te.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),i=Te.root,n="/",s=0;s40)throw new Te.ErrnoError(32)}}return{path:n,node:i}},getPath(e){for(var t;;){if(Te.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,i=0;i>>0)%Te.nameTable.length},hashAddNode(e){var t=Te.hashName(e.parent.id,e.name);e.name_next=Te.nameTable[t],Te.nameTable[t]=e},hashRemoveNode(e){var t=Te.hashName(e.parent.id,e.name);if(Te.nameTable[t]===e)Te.nameTable[t]=e.name_next;else for(var r=Te.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=Te.mayLookup(e);if(r)throw new Te.ErrnoError(r,e);for(var i=Te.hashName(e.id,t),n=Te.nameTable[i];n;n=n.name_next){var s=n.name;if(n.parent.id===e.id&&s===t)return n}return Te.lookup(e,t)},createNode(e,t,r,i){var n=new Te.FSNode(e,t,r,i);return Te.hashAddNode(n),n},destroyNode(e){Te.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>Te.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){var t=Te.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{return Te.lookupNode(e,t),20}catch(e){}return Te.nodePermissions(e,"wx")},mayDelete(e,t,r){var i;try{i=Te.lookupNode(e,t)}catch(e){return e.errno}var n=Te.nodePermissions(e,"wx");if(n)return n;if(r){if(!Te.isDir(i.mode))return 54;if(Te.isRoot(i)||Te.getPath(i)===Te.cwd())return 10}else if(Te.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?Te.isLink(e.mode)?32:Te.isDir(e.mode)&&("r"!==Te.flagsToPermissionString(t)||512&t)?31:Te.nodePermissions(e,Te.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Te.MAX_OPEN_FDS;e++)if(!Te.streams[e])return e;throw new Te.ErrnoError(33)},getStreamChecked(e){var t=Te.getStream(e);if(!t)throw new Te.ErrnoError(8);return t},getStream:e=>Te.streams[e],createStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return Te.FSStream||(Te.FSStream=function(){this.shared={}},Te.FSStream.prototype={},Object.defineProperties(Te.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},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(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new Te.FSStream,e),-1==t&&(t=Te.nextfd()),e.fd=t,Te.streams[t]=e,e},closeStream(e){Te.streams[e]=null},chrdev_stream_ops:{open(e){var t=Te.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek(){throw new Te.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Te.devices[e]={stream_ops:t}},getDevice:e=>Te.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),Te.syncFSRequests++,Te.syncFSRequests>1&&w(`warning: ${Te.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Te.getMounts(Te.root.mount),i=0;function n(e){return Te.syncFSRequests--,t(e)}function s(e){if(e)return s.errored?void 0:(s.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return s(null);t.type.syncfs(t,e,s)}))},mount(e,t,r){var i,n="/"===r,s=!r;if(n&&Te.root)throw new Te.ErrnoError(10);if(!n&&!s){var o=Te.lookupPath(r,{follow_mount:!1});if(r=o.path,i=o.node,Te.isMountpoint(i))throw new Te.ErrnoError(10);if(!Te.isDir(i.mode))throw new Te.ErrnoError(54)}var a={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(a);return d.mount=a,a.root=d,n?Te.root=d:i&&(i.mounted=a,i.mount&&i.mount.mounts.push(a)),d},unmount(e){var t=Te.lookupPath(e,{follow_mount:!1});if(!Te.isMountpoint(t.node))throw new Te.ErrnoError(28);var r=t.node,i=r.mounted,n=Te.getMounts(i);Object.keys(Te.nameTable).forEach((e=>{for(var t=Te.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&Te.destroyNode(t),t=r}})),r.mounted=null;var s=r.mount.mounts.indexOf(i);r.mount.mounts.splice(s,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var i=Te.lookupPath(e,{parent:!0}).node,n=de.basename(e);if(!n||"."===n||".."===n)throw new Te.ErrnoError(28);var s=Te.mayCreate(i,n);if(s)throw new Te.ErrnoError(s);if(!i.node_ops.mknod)throw new Te.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,Te.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,Te.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),i="",n=0;n(void 0===r&&(r=t,t=438),t|=8192,Te.mknod(e,t,r)),symlink(e,t){if(!ue.resolve(e))throw new Te.ErrnoError(44);var r=Te.lookupPath(t,{parent:!0}).node;if(!r)throw new Te.ErrnoError(44);var i=de.basename(t),n=Te.mayCreate(r,i);if(n)throw new Te.ErrnoError(n);if(!r.node_ops.symlink)throw new Te.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename(e,t){var r,i,n=de.dirname(e),s=de.dirname(t),o=de.basename(e),a=de.basename(t);if(r=Te.lookupPath(e,{parent:!0}).node,i=Te.lookupPath(t,{parent:!0}).node,!r||!i)throw new Te.ErrnoError(44);if(r.mount!==i.mount)throw new Te.ErrnoError(75);var d,l=Te.lookupNode(r,o),c=ue.relative(e,s);if("."!==c.charAt(0))throw new Te.ErrnoError(28);if("."!==(c=ue.relative(t,n)).charAt(0))throw new Te.ErrnoError(55);try{d=Te.lookupNode(i,a)}catch(e){}if(l!==d){var u=Te.isDir(l.mode),h=Te.mayDelete(r,o,u);if(h)throw new Te.ErrnoError(h);if(h=d?Te.mayDelete(i,a,u):Te.mayCreate(i,a))throw new Te.ErrnoError(h);if(!r.node_ops.rename)throw new Te.ErrnoError(63);if(Te.isMountpoint(l)||d&&Te.isMountpoint(d))throw new Te.ErrnoError(10);if(i!==r&&(h=Te.nodePermissions(r,"w")))throw new Te.ErrnoError(h);Te.hashRemoveNode(l);try{r.node_ops.rename(l,i,a)}catch(e){throw e}finally{Te.hashAddNode(l)}}},rmdir(e){var t=Te.lookupPath(e,{parent:!0}).node,r=de.basename(e),i=Te.lookupNode(t,r),n=Te.mayDelete(t,r,!0);if(n)throw new Te.ErrnoError(n);if(!t.node_ops.rmdir)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.rmdir(t,r),Te.destroyNode(i)},readdir(e){var t=Te.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new Te.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=Te.lookupPath(e,{parent:!0}).node;if(!t)throw new Te.ErrnoError(44);var r=de.basename(e),i=Te.lookupNode(t,r),n=Te.mayDelete(t,r,!1);if(n)throw new Te.ErrnoError(n);if(!t.node_ops.unlink)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.unlink(t,r),Te.destroyNode(i)},readlink(e){var t=Te.lookupPath(e).node;if(!t)throw new Te.ErrnoError(44);if(!t.node_ops.readlink)throw new Te.ErrnoError(28);return ue.resolve(Te.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=Te.lookupPath(e,{follow:!t}).node;if(!r)throw new Te.ErrnoError(44);if(!r.node_ops.getattr)throw new Te.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>Te.stat(e,!0),chmod(e,t,r){var i;if(!(i="string"==typeof e?Te.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new Te.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod(e,t){Te.chmod(e,t,!0)},fchmod(e,t){var r=Te.getStreamChecked(e);Te.chmod(r.node,t)},chown(e,t,r,i){var n;if(!(n="string"==typeof e?Te.lookupPath(e,{follow:!i}).node:e).node_ops.setattr)throw new Te.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown(e,t,r){Te.chown(e,t,r,!0)},fchown(e,t,r){var i=Te.getStreamChecked(e);Te.chown(i.node,t,r)},truncate(e,t){if(t<0)throw new Te.ErrnoError(28);var r;if(!(r="string"==typeof e?Te.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new Te.ErrnoError(63);if(Te.isDir(r.mode))throw new Te.ErrnoError(31);if(!Te.isFile(r.mode))throw new Te.ErrnoError(28);var i=Te.nodePermissions(r,"w");if(i)throw new Te.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=Te.getStreamChecked(e);if(0==(2097155&r.flags))throw new Te.ErrnoError(28);Te.truncate(r.node,t)},utime(e,t,r){var i=Te.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new Te.ErrnoError(44);var i;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?Be(t):t)?4095&r|32768:0,"object"==typeof e)i=e;else{e=de.normalize(e);try{i=Te.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var s=!1;if(64&t)if(i){if(128&t)throw new Te.ErrnoError(20)}else i=Te.mknod(e,r,0),s=!0;if(!i)throw new Te.ErrnoError(44);if(Te.isChrdev(i.mode)&&(t&=-513),65536&t&&!Te.isDir(i.mode))throw new Te.ErrnoError(54);if(!s){var o=Te.mayOpen(i,t);if(o)throw new Te.ErrnoError(o)}512&t&&!s&&Te.truncate(i,0),t&=-131713;var a=Te.createStream({node:i,path:Te.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return a.stream_ops.open&&a.stream_ops.open(a),!n.logReadFiles||1&t||(Te.readFiles||(Te.readFiles={}),e in Te.readFiles||(Te.readFiles[e]=1)),a},close(e){if(Te.isClosed(e))throw new Te.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Te.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Te.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Te.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,i,n){if(i<0||n<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(1==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.read)throw new Te.ErrnoError(28);var s=void 0!==n;if(s){if(!e.seekable)throw new Te.ErrnoError(70)}else n=e.position;var o=e.stream_ops.read(e,t,r,i,n);return s||(e.position+=o),o},write(e,t,r,i,n,s){if(i<0||n<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.write)throw new Te.ErrnoError(28);e.seekable&&1024&e.flags&&Te.llseek(e,0,2);var o=void 0!==n;if(o){if(!e.seekable)throw new Te.ErrnoError(70)}else n=e.position;var a=e.stream_ops.write(e,t,r,i,n,s);return o||(e.position+=a),a},allocate(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(t<0||r<=0)throw new Te.ErrnoError(28);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(!Te.isFile(e.node.mode)&&!Te.isDir(e.node.mode))throw new Te.ErrnoError(43);if(!e.stream_ops.allocate)throw new Te.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,i,n){if(0!=(2&i)&&0==(2&n)&&2!=(2097155&e.flags))throw new Te.ErrnoError(2);if(1==(2097155&e.flags))throw new Te.ErrnoError(2);if(!e.stream_ops.mmap)throw new Te.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n)},msync:(e,t,r,i,n)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new Te.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,i=Te.open(e,t.flags),n=Te.stat(e).size,s=new Uint8Array(n);return Te.read(i,s,0,n,0),"utf8"===t.encoding?r=fe(s,0):"binary"===t.encoding&&(r=s),Te.close(i),r},writeFile(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=Te.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(me(t)+1),s=_e(t,n,0,n.length);Te.write(i,n,0,s,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");Te.write(i,t,0,t.byteLength,void 0,r.canOwn)}Te.close(i)},cwd:()=>Te.currentPath,chdir(e){var t=Te.lookupPath(e,{follow:!0});if(null===t.node)throw new Te.ErrnoError(44);if(!Te.isDir(t.node.mode))throw new Te.ErrnoError(54);var r=Te.nodePermissions(t.node,"x");if(r)throw new Te.ErrnoError(r);Te.currentPath=t.path},createDefaultDirectories(){Te.mkdir("/tmp"),Te.mkdir("/home"),Te.mkdir("/home/web_user")},createDefaultDevices(){Te.mkdir("/dev"),Te.registerDevice(Te.makedev(1,3),{read:()=>0,write:(e,t,r,i,n)=>i}),Te.mkdev("/dev/null",Te.makedev(1,3)),ve.register(Te.makedev(5,0),ve.default_tty_ops),ve.register(Te.makedev(6,0),ve.default_tty1_ops),Te.mkdev("/dev/tty",Te.makedev(5,0)),Te.mkdev("/dev/tty1",Te.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=ce(e).byteLength),e[--t]);Te.createDevice("/dev","random",r),Te.createDevice("/dev","urandom",r),Te.mkdir("/dev/shm"),Te.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Te.mkdir("/proc");var e=Te.mkdir("/proc/self");Te.mkdir("/proc/self/fd"),Te.mount({mount(){var t=Te.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,i=Te.getStreamChecked(r),n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return n.parent=n,n}},t}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?Te.createDevice("/dev","stdin",n.stdin):Te.symlink("/dev/tty","/dev/stdin"),n.stdout?Te.createDevice("/dev","stdout",null,n.stdout):Te.symlink("/dev/tty","/dev/stdout"),n.stderr?Te.createDevice("/dev","stderr",null,n.stderr):Te.symlink("/dev/tty1","/dev/stderr"),Te.open("/dev/stdin",0),Te.open("/dev/stdout",1),Te.open("/dev/stderr",1)},ensureErrnoError(){Te.ErrnoError||(Te.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},Te.ErrnoError.prototype=new Error,Te.ErrnoError.prototype.constructor=Te.ErrnoError,[44].forEach((e=>{Te.genericErrors[e]=new Te.ErrnoError(e),Te.genericErrors[e].stack=""})))},staticInit(){Te.ensureErrnoError(),Te.nameTable=new Array(4096),Te.mount(we,{},"/"),Te.createDefaultDirectories(),Te.createDefaultDevices(),Te.createSpecialDirectories(),Te.filesystems={MEMFS:we}},init(e,t,r){Te.init.initialized=!0,Te.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=t||n.stdout,n.stderr=r||n.stderr,Te.createStandardStreams()},quit(){Te.init.initialized=!1;for(var e=0;ethis.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},s.prototype.setDataGetter=function(e){this.getter=e},s.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,s=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,o=1048576;n||(o=i);var a=this;a.setDataGetter((e=>{var t=e*o,n=(e+1)*o-1;if(n=Math.min(n,i-1),void 0===a.chunks[e]&&(a.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==o&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):ge(n.responseText||"",!0)})(t,n)),void 0===a.chunks[e])throw new Error("doXHR failed!");return a.chunks[e]})),!s&&i||(o=i=1,i=this.getter(0).length,o=i,b("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=o,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!u)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var o=new s;Object.defineProperties(o,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var a={isDevice:!1,contents:o}}else a={isDevice:!1,url:r};var d=Te.createFile(e,t,a,i,n);a.contents?d.contents=a.contents:a.url&&(d.contents=null,d.url=a.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,t,r,i,n){var s=e.node.contents;if(n>=s.length)return 0;var o=Math.min(s.length-n,i);if(s.slice)for(var a=0;a{var t=d.stream_ops[e];l[e]=function(){return Te.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,n)=>(Te.forceLoadFile(d),c(e,t,r,i,n)),l.mmap=(e,t,r,i,n)=>{Te.forceLoadFile(d);var s=be();if(!s)throw new Te.ErrnoError(48);return c(e,S,s,t,r),{ptr:s,allocated:!0}},d.stream_ops=l,d}},Ce=(e,t)=>e?fe(E,e,t):"",De={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(de.isAbs(t))return t;var i;if(i=-100===e?Te.cwd():De.getStreamFromFD(e).path,0==t.length){if(!r)throw new Te.ErrnoError(44);return i}return de.join2(i,t)},doStat(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&de.normalize(t)!==de.normalize(Te.getPath(e.node)))return-54;throw e}x[r>>2]=i.dev,x[r+4>>2]=i.mode,B[r+8>>2]=i.nlink,x[r+12>>2]=i.uid,x[r+16>>2]=i.gid,x[r+20>>2]=i.rdev,K=[i.size>>>0,(Y=i.size,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+24>>2]=K[0],x[r+28>>2]=K[1],x[r+32>>2]=4096,x[r+36>>2]=i.blocks;var n=i.atime.getTime(),s=i.mtime.getTime(),o=i.ctime.getTime();return K=[Math.floor(n/1e3)>>>0,(Y=Math.floor(n/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+40>>2]=K[0],x[r+44>>2]=K[1],B[r+48>>2]=n%1e3*1e3,K=[Math.floor(s/1e3)>>>0,(Y=Math.floor(s/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+56>>2]=K[0],x[r+60>>2]=K[1],B[r+64>>2]=s%1e3*1e3,K=[Math.floor(o/1e3)>>>0,(Y=Math.floor(o/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+72>>2]=K[0],x[r+76>>2]=K[1],B[r+80>>2]=o%1e3*1e3,K=[i.ino>>>0,(Y=i.ino,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+88>>2]=K[0],x[r+92>>2]=K[1],0},doMsync(e,t,r,i,n){if(!Te.isFile(t.node.mode))throw new Te.ErrnoError(43);if(2&i)return 0;var s=E.slice(e,e+r);Te.msync(t,s,n,r,i)},varargs:void 0,get(){var e=x[+De.varargs>>2];return De.varargs+=4,e},getp:()=>De.get(),getStr:e=>Ce(e),getStreamFromFD:e=>Te.getStreamChecked(e)};function Pe(e,t,r){De.varargs=r;try{var i=De.getStreamFromFD(e);switch(t){case 0:if((n=De.get())<0)return-28;for(;Te.streams[n];)n++;return Te.createStream(i,n).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var n=De.get();return i.flags|=n,0;case 5:return n=De.getp(),A[n+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return ae(28),-1}}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}function Fe(e,t,r,i){De.varargs=i;try{t=De.getStr(t),t=De.calculateAt(e,t);var n=i?De.get():0;return Te.open(t,r,n).fd}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}var Le,Ie,Me,Re=(e,t,r,i,n)=>{},ze=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Le=e},Ne=e=>{for(var t="",r=e;E[r];)t+=Le[E[r++]];return t},$e={},Oe={},Ge={},He=e=>{throw new Ie(e)},We=e=>{throw new Me(e)},Ve=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&We("Mismatched type converter count");for(var n=0;n{Oe.hasOwnProperty(e)?n[t]=Oe[e]:(s.push(e),$e.hasOwnProperty(e)||($e[e]=[]),$e[e].push((()=>{n[t]=Oe[e],++o===s.length&&i(n)})))})),0===s.length&&i(n)};function je(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||He(`type "${i}" must have a positive integer typeid pointer`),Oe.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;He(`Cannot register type '${i}' twice`)}if(Oe[e]=t,delete Ge[e],$e.hasOwnProperty(e)){var n=$e[e];delete $e[e],n.forEach((e=>e()))}}function qe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return je(e,t,r)}var Ye,Ke=8,Xe=(e,t,r,i)=>{qe(e,{name:t=Ne(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:Ke,readValueFromPointer:function(e){return this.fromWireType(E[e])},destructorFunction:null})},Ze=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Je=e=>{He(e.$$.ptrType.registeredClass.name+" instance already deleted")},Qe=!1,et=e=>{},tt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},rt=e=>{e.count.value-=1,0===e.count.value&&tt(e)},it=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=it(e,t,r.baseClass);return null===i?null:r.downcast(i)},nt={},st=()=>Object.keys(ut).length,ot=()=>{var e=[];for(var t in ut)ut.hasOwnProperty(t)&&e.push(ut[t]);return e},at=[],dt=()=>{for(;at.length;){var e=at.pop();e.$$.deleteScheduled=!1,e.delete()}},lt=e=>{Ye=e,at.length&&Ye&&Ye(dt)},ct=()=>{n.getInheritedInstanceCount=st,n.getLiveInheritedInstances=ot,n.flushPendingDeletes=dt,n.setDelayFunction=lt},ut={},ht=(e,t)=>{for(void 0===t&&He("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},ft=(e,t)=>(t=ht(e,t),ut[t]),pt=(e,t)=>(t.ptrType&&t.ptr||We("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&We("Both smartPtrType and smartPtr must be specified"),t.count={value:1},_t(Object.create(e,{$$:{value:t}})));function mt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ft(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?pt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):pt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,o=this.registeredClass.getActualType(t),a=nt[o];if(!a)return n.call(this);s=this.isConst?a.constPointerType:a.pointerType;var d=it(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}var _t=e=>"undefined"==typeof FinalizationRegistry?(_t=e=>e,e):(Qe=new FinalizationRegistry((e=>{rt(e.$$)})),_t=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};Qe.register(e,r,e)}return e},et=e=>Qe.unregister(e),_t(e)),gt=()=>{Object.assign(yt.prototype,{isAliasOf(e){if(!(this instanceof yt))return!1;if(!(e instanceof yt))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n},clone(){if(this.$$.ptr||Je(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=_t(Object.create(Object.getPrototypeOf(this),{$$:{value:Ze(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),et(this),rt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),at.push(this),1===at.length&&Ye&&Ye(dt),this.$$.deleteScheduled=!0,this}})};function yt(){}var vt=(e,t)=>Object.defineProperty(t,"name",{value:e}),bt=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||He(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},wt=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&He(`Cannot register public name '${e}' twice`),bt(n,e,e),n.hasOwnProperty(r)&&He(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,void 0!==r&&(n[e].numArguments=r))},St=48,Et=57,At=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=St&&t<=Et?`_${e}`:e};function Ut(e,t,r,i,n,s,o,a){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=o,this.downcast=a,this.pureVirtualFunctions=[]}var xt=(e,t,r)=>{for(;t!==r;)t.upcast||He(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function Bt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return xt(t.$$.ptr,r,this.registeredClass)}function kt(e,t){var r;if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=xt(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&He("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,sr.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:He("Unsupporting sharing policy")}return r}function Tt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return xt(t.$$.ptr,r,this.registeredClass)}function Ct(e){return this.fromWireType(B[e>>2])}var Dt=()=>{Object.assign(Pt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:Ke,readValueFromPointer:Ct,deleteObject(e){null!==e&&e.delete()},fromWireType:mt})};function Pt(e,t,r,i,n,s,o,a,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=o,this.rawGetPointee=a,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=kt:i?(this.toWireType=Bt,this.destructorFunction=null):(this.toWireType=Tt,this.destructorFunction=null)}var Ft,Lt,It=(e,t,r)=>{n.hasOwnProperty(e)||We("Replacing nonexistant public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},Mt=(e,t,r)=>{var i=n["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},Rt=[],zt=e=>{var t=Rt[e];return t||(e>=Rt.length&&(Rt.length=e+1),Rt[e]=t=Ft.get(e)),t},Nt=(e,t,r)=>e.includes("j")?Mt(e,t,r):zt(t).apply(null,r),$t=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),Nt(e,t,r)}},Ot=(e,t)=>{var r=(e=Ne(e)).includes("j")?$t(e,t):zt(t);return"function"!=typeof r&&He(`unknown function pointer with signature ${e}: ${t}`),r},Gt=(e,t)=>{var r=vt(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},Ht=e=>{var t=li(e),r=Ne(t);return oi(t),r},Wt=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Oe[t]||(Ge[t]?Ge[t].forEach(e):(r.push(t),i[t]=!0))})),new Lt(`${e}: `+r.map(Ht).join([", "]))},Vt=(e,t,r,i,n,s,o,a,d,l,c,u,h)=>{c=Ne(c),s=Ot(n,s),a&&(a=Ot(o,a)),l&&(l=Ot(d,l)),h=Ot(u,h);var f=At(c);wt(f,(function(){Wt(`Cannot construct ${c} due to unbound types`,[i])})),Ve([e,t,r],i?[i]:[],(function(t){var r,n;t=t[0],n=i?(r=t.registeredClass).instancePrototype:yt.prototype;var o=vt(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new Ie("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new Ie(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new Ie(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(n,{constructor:{value:o}});o.prototype=d;var u=new Ut(c,o,d,h,r,s,a,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new Pt(c,u,!0,!1,!1),m=new Pt(c+"*",u,!1,!1,!1),_=new Pt(c+" const*",u,!1,!0,!1);return nt[e]={pointerType:m,constPointerType:_},It(f,o),[p,m,_]}))},jt=(e,t)=>{for(var r=[],i=0;i>2]);return r},qt=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Yt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=vt(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function Kt(e,t,r,i,n,s){var o=t.length;o<2&&He("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||s?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=a?1:2;l{var o=jt(t,r);n=Ot(i,n),Ve([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Ie(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Wt(`Cannot construct ${e.name} due to unbound types`,o)},Ve([],o,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Kt(r,i,null,n,s),[]))),[]}))},Zt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Jt=(e,t,r,i,n,s,o,a,d)=>{var l=jt(r,i);t=Ne(t),t=Zt(t),s=Ot(n,s),Ve([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function n(){Wt(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),a&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,c[t]=n):(bt(c,t,i),c[t].overloadTable[r-2]=n),Ve([],l,(function(n){var a=Kt(i,n,e,s,o,d);return void 0===c[t].overloadTable?(a.argCount=r-2,c[t]=a):c[t].overloadTable[r-2]=a,[]})),[]}))};function Qt(){Object.assign(er.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function er(){this.allocated=[void 0],this.freelist=[]}var tr=new er,rr=e=>{e>=tr.reserved&&0==--tr.get(e).refcount&&tr.free(e)},ir=()=>{for(var e=0,t=tr.reserved;t{tr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),tr.reserved=tr.allocated.length,n.count_emval_handles=ir},sr={toValue:e=>(e||He("Cannot use deleted val. handle = "+e),tr.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return tr.allocate({refcount:1,value:e})}}};function or(e){return this.fromWireType(x[e>>2])}var ar=(e,t)=>{qe(e,{name:t=Ne(t),fromWireType:e=>{var t=sr.toValue(e);return rr(e),t},toWireType:(e,t)=>sr.toHandle(t),argPackAdvance:Ke,readValueFromPointer:or,destructorFunction:null})},dr=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},lr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(k[e>>2])};case 8:return function(e){return this.fromWireType(T[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},cr=(e,t,r)=>{qe(e,{name:t=Ne(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Ke,readValueFromPointer:lr(t,r),destructorFunction:null})},ur=(e,t,r)=>{switch(t){case 1:return r?e=>S[e>>0]:e=>E[e>>0];case 2:return r?e=>A[e>>1]:e=>U[e>>1];case 4:return r?e=>x[e>>2]:e=>B[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},hr=(e,t,r,i,n)=>{t=Ne(t);var s=e=>e;if(0===i){var o=32-8*r;s=e=>e<>>o}var a=t.includes("unsigned");qe(e,{name:t,fromWireType:s,toWireType:a?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:Ke,readValueFromPointer:ur(t,r,0!==i),destructorFunction:null})},fr=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=B[e>>2],r=B[e+4>>2];return new i(S.buffer,r,t)}qe(e,{name:r=Ne(r),fromWireType:n,argPackAdvance:Ke,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},pr=(e,t,r)=>_e(e,E,t,r),mr=(e,t)=>{var r="std::string"===(t=Ne(t));qe(e,{name:t,fromWireType(e){var t,i=B[e>>2],n=e+4;if(r)for(var s=n,o=0;o<=i;++o){var a=n+o;if(o==i||0==E[a]){var d=Ce(s,a-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=a+1}}else{var l=new Array(i);for(o=0;o>2]=i,r&&n)pr(t,o,i+1);else if(n)for(var a=0;a255&&(oi(o),He("String has UTF-16 code units that do not fit in 8 bits")),E[o+a]=d}else for(a=0;a{for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&U[i];)++i;if((r=i<<1)-e>32&&_r)return _r.decode(E.subarray(e,r));for(var s="",o=0;!(o>=t/2);++o){var a=A[e+2*o>>1];if(0==a)break;s+=String.fromCharCode(a)}return s},yr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=o,t+=2}return A[t>>1]=0,t-i},vr=e=>2*e.length,br=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var n=x[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i},wr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++s)),x[t>>2]=o,(t+=4)+4>n)break}return x[t>>2]=0,t-i},Sr=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},Er=(e,t,r)=>{var i,n,s,o,a;r=Ne(r),2===t?(i=gr,n=yr,o=vr,s=()=>U,a=1):4===t&&(i=br,n=wr,o=Sr,s=()=>B,a=2),qe(e,{name:r,fromWireType:e=>{for(var r,n=B[e>>2],o=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==o[c>>a]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return oi(e),r},toWireType:(e,i)=>{"string"!=typeof i&&He(`Cannot pass non-string to C++ string type ${r}`);var s=o(i),d=ai(4+s+t);return B[d>>2]=s>>a,n(i,d+4,s+t),null!==e&&e.push(oi,d),d},argPackAdvance:Ke,readValueFromPointer:or,destructorFunction(e){oi(e)}})},Ar=(e,t)=>{qe(e,{isVoid:!0,name:t=Ne(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},Ur={},xr=e=>{var t=Ur[e];return void 0===t?Ne(e):t},Br=[],kr=(e,t,r,i,n)=>(e=Br[e])(t=sr.toValue(t),t[r=xr(r)],i,n),Tr=e=>{var t=Br.length;return Br.push(e),t},Cr=(e,t)=>{var r=Oe[e];return void 0===r&&He(t+" has unknown type "+Ht(e)),r},Dr=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},Pr=(e,t,r)=>{var i=[],n=e.toWireType(i,r);return i.length&&(B[t>>2]=sr.toHandle(i)),n},Fr=(e,t,r)=>{var i=Dr(e,t),n=i.shift();e--;var s="return function (obj, func, destructorsRef, args) {\n",o=0,a=[];0===r&&a.push("obj");for(var d=["retType"],l=[n],c=0;ce.name)).join(", ")}) => ${n.name}>`;return Tr(vt(h,u))},Lr=e=>{var t=sr.toValue(e);qt(t),rr(e)},Ir=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,Mr=()=>{j("")},Rr=()=>Date.now(),zr=(e,t,r)=>E.copyWithin(e,t,t+r),Nr=e=>{j("OOM")},$r=e=>{E.length,Nr()},Or={},Gr=()=>l||"./this.program",Hr=()=>{if(!Hr.strings){var e={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",_:Gr()};for(var t in Or)void 0===Or[t]?delete e[t]:e[t]=Or[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Hr.strings=r}return Hr.strings},Wr=(e,t)=>{for(var r=0;r>0]=e.charCodeAt(r);S[t>>0]=0},Vr=(e,t)=>{var r=0;return Hr().forEach(((i,n)=>{var s=t+r;B[e+4*n>>2]=s,Wr(i,s),r+=i.length+1})),0},jr=(e,t)=>{var r=Hr();B[e>>2]=r.length;var i=0;return r.forEach((e=>i+=e.length+1)),B[t>>2]=i,0};function qr(e){try{var t=De.getStreamFromFD(e);return Te.close(t),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Yr(e,t){try{var r=De.getStreamFromFD(e),i=r.tty?2:Te.isDir(r.mode)?3:Te.isLink(r.mode)?7:4;return S[t>>0]=i,A[t+2>>1]=0,K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[t+8>>2]=K[0],x[t+12>>2]=K[1],K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[t+16>>2]=K[0],x[t+20>>2]=K[1],0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Kr=(e,t,r,i)=>{for(var n=0,s=0;s>2],a=B[t+4>>2];t+=8;var d=Te.read(e,S,o,a,i);if(d<0)return-1;if(n+=d,d>2]=s,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Zr(e,t,r,i,n){var s=Ir(t,r);try{if(isNaN(s))return 61;var o=De.getStreamFromFD(e);return Te.llseek(o,s,i),K=[o.position>>>0,(Y=o.position,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[n>>2]=K[0],x[n+4>>2]=K[1],o.getdents&&0===s&&0===i&&(o.getdents=null),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Jr=(e,t,r,i)=>{for(var n=0,s=0;s>2],a=B[t+4>>2];t+=8;var d=Te.write(e,S,o,a,i);if(d<0)return-1;n+=d,void 0!==i&&(i+=d)}return n};function Qr(e,t,r,i){try{var n=De.getStreamFromFD(e),s=Jr(n,t,r);return B[i>>2]=s,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var ei=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=Te.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},ti=365,ri=146;Object.defineProperties(ei.prototype,{read:{get:function(){return(this.mode&ti)===ti},set:function(e){e?this.mode|=ti:this.mode&=~ti}},write:{get:function(){return(this.mode&ri)===ri},set:function(e){e?this.mode|=ri:this.mode&=~ri}},isFolder:{get:function(){return Te.isDir(this.mode)}},isDevice:{get:function(){return Te.isChrdev(this.mode)}}}),Te.FSNode=ei,Te.createPreloadedFile=xe,Te.staticInit(),ze(),Ie=n.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Me=n.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},gt(),ct(),Dt(),Lt=n.UnboundTypeError=Gt(Error,"UnboundTypeError"),Qt(),nr();var ii,ni={o:oe,A:Pe,s:Fe,q:Re,C:Xe,D:Vt,y:Xt,h:Jt,B:ar,l:cr,c:hr,b:fr,m:mr,j:Er,n:Ar,g:kr,d:rr,f:Fr,e:Lr,a:Mr,i:Rr,w:zr,r:$r,u:Vr,v:jr,k:qr,t:Yr,z:Xr,p:Zr,x:Qr},si=ie(),oi=e=>(oi=si.G)(e),ai=e=>(ai=si.H)(e),di=()=>(di=si.J)(),li=e=>(li=si.K)(e),ci=e=>(ci=si.M)(e);function ui(){function e(){ii||(ii=!0,n.calledRun=!0,C||(R(),t(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),z()))}G>0||(M(),G>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.dynCall_jiji=(e,t,r,i,s)=>(n.dynCall_jiji=si.N)(e,t,r,i,s),n._ff_h264_cabac_tables=74396,H=function e(){ii||ui(),ii||(H=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return ui(),e.ready}),o=(()=>{var e="undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro.js",document.baseURI).href;return async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var r,i,n;(n=t).ready=new Promise(((e,t)=>{r=e,i=t})),(n=void 0!==n?n:{}).locateFile=function(e){return"decoder-pro-audio.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_AUDIO_WASM_URL&&""!=JESSIBUCA_PRO_AUDIO_WASM_URL?JESSIBUCA_PRO_AUDIO_WASM_URL:e};var s,o,a,d=Object.assign({},n),l="./this.program",c="object"==typeof window,u="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";function p(e){return n.locateFile?n.locateFile(e,f):f+e}if(h){const{createRequire:e}=await import("module");var m=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro.js",document.baseURI).href),_=m("fs"),g=m("path");f=u?g.dirname(f)+"/":m("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro.js",document.baseURI).href)),s=(e,t)=>(e=J(e)?new URL(e):g.normalize(e),_.readFileSync(e,t?void 0:"utf8")),a=e=>{var t=s(e,!0);return t.buffer||(t=new Uint8Array(t)),t},o=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=J(e)?new URL(e):g.normalize(e),_.readFile(e,i?void 0:"utf8",((e,n)=>{e?r(e):t(i?n.buffer:n)}))},!n.thisProgram&&process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),n.inspect=()=>"[Emscripten Module object]"}else(c||u)&&(u?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),e&&(f=e),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},u&&(a=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),o=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var y,v,b=n.print||console.log.bind(console),w=n.printErr||console.error.bind(console);Object.assign(n,d),d=null,n.arguments&&n.arguments,n.thisProgram&&(l=n.thisProgram),n.quit&&n.quit,n.wasmBinary&&(y=n.wasmBinary),"object"!=typeof WebAssembly&&j("no native wasm support detected");var S,E,A,U,x,B,k,T,C=!1;function D(e,t){e||j(t)}function P(){var e=v.buffer;n.HEAP8=S=new Int8Array(e),n.HEAP16=A=new Int16Array(e),n.HEAPU8=E=new Uint8Array(e),n.HEAPU16=U=new Uint16Array(e),n.HEAP32=x=new Int32Array(e),n.HEAPU32=B=new Uint32Array(e),n.HEAPF32=k=new Float32Array(e),n.HEAPF64=T=new Float64Array(e)}var F=[],L=[],I=[];function M(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)N(n.preRun.shift());ne(F)}function R(){n.noFSInit||Te.init.initialized||Te.init(),Te.ignorePermissions=!1,ne(L)}function z(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)O(n.postRun.shift());ne(I)}function N(e){F.unshift(e)}function $(e){L.unshift(e)}function O(e){I.unshift(e)}var G=0,H=null;function W(e){G++,n.monitorRunDependencies&&n.monitorRunDependencies(G)}function V(e){if(G--,n.monitorRunDependencies&&n.monitorRunDependencies(G),0==G&&H){var t=H;H=null,t()}}function j(e){n.onAbort&&n.onAbort(e),w(e="Aborted("+e+")"),C=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}var q,Y,K,X="data:application/octet-stream;base64,",Z=e=>e.startsWith(X),J=e=>e.startsWith("file://");function Q(e){if(e==q&&y)return new Uint8Array(y);if(a)return a(e);throw"both async and sync fetching of the wasm failed"}function ee(e){if(!y&&(c||u)){if("function"==typeof fetch&&!J(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>Q(e)));if(o)return new Promise(((t,r)=>{o(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>Q(e)))}function te(e,t,r){return ee(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{w(`failed to asynchronously prepare wasm: ${e}`),j(e)}))}function re(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||Z(t)||J(t)||h||"function"!=typeof fetch?te(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return w(`wasm streaming compile failed: ${e}`),w("falling back to ArrayBuffer instantiation"),te(t,r,i)}))))}function ie(){var e={a:ni};function t(e,t){return si=e.exports,v=si.E,P(),Ft=si.H,$(si.F),V(),si}if(W(),n.instantiateWasm)try{return n.instantiateWasm(e,t)}catch(e){w(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return re(y,q,e,(function(e){t(e.instance)})).catch(i),{}}n.locateFile?Z(q="decoder-pro-audio.wasm")||(q=p(q)):q=new URL("decoder-pro-audio.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro.js",document.baseURI).href).href;var ne=e=>{for(;e.length>0;)e.shift()(n)};function se(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){B[this.ptr+4>>2]=e},this.get_type=function(){return B[this.ptr+4>>2]},this.set_destructor=function(e){B[this.ptr+8>>2]=e},this.get_destructor=function(){return B[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,S[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=S[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,S[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=S[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){B[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return B[this.ptr+16>>2]},this.get_exception_ptr=function(){if(ci(this.get_type()))return B[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}n.noExitRuntime;var oe=(e,t,r)=>{throw new se(e).init(t,r),e},ae=e=>(x[ai()>>2]=e,e),de={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=de.isAbs(e),r="/"===e.substr(-1);return(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=de.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=de.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return de.normalize(e.join("/"))},join2:(e,t)=>de.normalize(e+"/"+t)},le=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}j("initRandomDevice")},ce=e=>(ce=le())(e),ue={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:Te.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=de.isAbs(i)}return(t?"/":"")+(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=ue.resolve(e).substr(1),t=ue.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),s=Math.min(i.length,n.length),o=s,a=0;a{for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&he)return he.decode(e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&o)<<6|a)}else s+=String.fromCharCode(o)}return s},pe=[],me=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},_e=(e,t,r,i)=>{if(!(i>0))return 0;for(var n=r,s=r+i-1,o=0;o=55296&&a<=57343)a=65536+((1023&a)<<10)|1023&e.charCodeAt(++o);if(a<=127){if(r>=s)break;t[r++]=a}else if(a<=2047){if(r+1>=s)break;t[r++]=192|a>>6,t[r++]=128|63&a}else if(a<=65535){if(r+2>=s)break;t[r++]=224|a>>12,t[r++]=128|a>>6&63,t[r++]=128|63&a}else{if(r+3>=s)break;t[r++]=240|a>>18,t[r++]=128|a>>12&63,t[r++]=128|a>>6&63,t[r++]=128|63&a}}return t[r]=0,r-n};function ge(e,t,r){var i=r>0?r:me(e)+1,n=new Array(i),s=_e(e,n,0,n.length);return t&&(n.length=s),n}var ye=()=>{if(!pe.length){var e=null;if(h){var t=Buffer.alloc(256),r=0,i=process.stdin.fd;try{r=_.readSync(i,t)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}e=r>0?t.slice(0,r).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;pe=ge(e,!0)}return pe.shift()},ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},Te.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new Te.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new Te.ErrnoError(60);for(var s=0,o=0;oye(),put_char(e,t){null===t||10===t?(b(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(b(fe(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(w(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(w(fe(e.output,0)),e.output=[])}}},be=e=>{j()},we={ops_table:null,mount:e=>we.createNode(null,"/",16895,0),createNode(e,t,r,i){if(Te.isBlkdev(r)||Te.isFIFO(r))throw new Te.ErrnoError(63);we.ops_table||(we.ops_table={dir:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,lookup:we.node_ops.lookup,mknod:we.node_ops.mknod,rename:we.node_ops.rename,unlink:we.node_ops.unlink,rmdir:we.node_ops.rmdir,readdir:we.node_ops.readdir,symlink:we.node_ops.symlink},stream:{llseek:we.stream_ops.llseek}},file:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:{llseek:we.stream_ops.llseek,read:we.stream_ops.read,write:we.stream_ops.write,allocate:we.stream_ops.allocate,mmap:we.stream_ops.mmap,msync:we.stream_ops.msync}},link:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,readlink:we.node_ops.readlink},stream:{}},chrdev:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:Te.chrdev_stream_ops}});var n=Te.createNode(e,t,r,i);return Te.isDir(n.mode)?(n.node_ops=we.ops_table.dir.node,n.stream_ops=we.ops_table.dir.stream,n.contents={}):Te.isFile(n.mode)?(n.node_ops=we.ops_table.file.node,n.stream_ops=we.ops_table.file.stream,n.usedBytes=0,n.contents=null):Te.isLink(n.mode)?(n.node_ops=we.ops_table.link.node,n.stream_ops=we.ops_table.link.stream):Te.isChrdev(n.mode)&&(n.node_ops=we.ops_table.chrdev.node,n.stream_ops=we.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n,e.timestamp=n.timestamp),n},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Te.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,Te.isDir(e.mode)?t.size=4096:Te.isFile(e.mode)?t.size=e.usedBytes:Te.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&we.resizeFileStorage(e,t.size)},lookup(e,t){throw Te.genericErrors[44]},mknod:(e,t,r,i)=>we.createNode(e,t,r,i),rename(e,t,r){if(Te.isDir(e.mode)){var i;try{i=Te.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new Te.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=Te.lookupNode(e,t);for(var i in r.contents)throw new Te.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink(e,t,r){var i=we.createNode(e,t,41471,0);return i.link=r,i},readlink(e){if(!Te.isLink(e.mode))throw new Te.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,i,n){var s=e.node.contents;if(n>=e.node.usedBytes)return 0;var o=Math.min(e.node.usedBytes-n,i);if(o>8&&s.subarray)t.set(s.subarray(n,n+o),r);else for(var a=0;a0||r+t(we.stream_ops.write(e,t,0,i,r,!1),0)}},Se=(e,t,r,i)=>{var n=i?"":`al ${e}`;o(e,(r=>{D(r,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(r)),n&&V()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),n&&W()},Ee=(e,t,r,i,n,s)=>{Te.createDataFile(e,t,r,i,n,s)},Ae=n.preloadPlugins||[],Ue=(e,t,r,i)=>{"undefined"!=typeof Browser&&Browser.init();var n=!1;return Ae.forEach((s=>{n||s.canHandle(t)&&(s.handle(e,t,r,i),n=!0)})),n},xe=(e,t,r,i,n,s,o,a,d,l)=>{var c=t?ue.resolve(de.join2(e,t)):e;function u(r){function u(r){l&&l(),a||Ee(e,t,r,i,n,d),s&&s(),V()}Ue(r,c,u,(()=>{o&&o(),V()}))||u(r)}W(),"string"==typeof r?Se(r,(e=>u(e)),o):u(r)},Be=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t},ke=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Te={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=ue.resolve(e)))return{path:"",node:null};if(t=Object.assign({follow_mount:!0,recurse_count:0},t),t.recurse_count>8)throw new Te.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),i=Te.root,n="/",s=0;s40)throw new Te.ErrnoError(32)}}return{path:n,node:i}},getPath(e){for(var t;;){if(Te.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,i=0;i>>0)%Te.nameTable.length},hashAddNode(e){var t=Te.hashName(e.parent.id,e.name);e.name_next=Te.nameTable[t],Te.nameTable[t]=e},hashRemoveNode(e){var t=Te.hashName(e.parent.id,e.name);if(Te.nameTable[t]===e)Te.nameTable[t]=e.name_next;else for(var r=Te.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=Te.mayLookup(e);if(r)throw new Te.ErrnoError(r,e);for(var i=Te.hashName(e.id,t),n=Te.nameTable[i];n;n=n.name_next){var s=n.name;if(n.parent.id===e.id&&s===t)return n}return Te.lookup(e,t)},createNode(e,t,r,i){var n=new Te.FSNode(e,t,r,i);return Te.hashAddNode(n),n},destroyNode(e){Te.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>Te.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){var t=Te.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{Te.lookupNode(e,t);return 20}catch(e){}return Te.nodePermissions(e,"wx")},mayDelete(e,t,r){var i;try{i=Te.lookupNode(e,t)}catch(e){return e.errno}var n=Te.nodePermissions(e,"wx");if(n)return n;if(r){if(!Te.isDir(i.mode))return 54;if(Te.isRoot(i)||Te.getPath(i)===Te.cwd())return 10}else if(Te.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?Te.isLink(e.mode)?32:Te.isDir(e.mode)&&("r"!==Te.flagsToPermissionString(t)||512&t)?31:Te.nodePermissions(e,Te.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Te.MAX_OPEN_FDS;e++)if(!Te.streams[e])return e;throw new Te.ErrnoError(33)},getStreamChecked(e){var t=Te.getStream(e);if(!t)throw new Te.ErrnoError(8);return t},getStream:e=>Te.streams[e],createStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return Te.FSStream||(Te.FSStream=function(){this.shared={}},Te.FSStream.prototype={},Object.defineProperties(Te.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},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(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new Te.FSStream,e),-1==t&&(t=Te.nextfd()),e.fd=t,Te.streams[t]=e,e},closeStream(e){Te.streams[e]=null},chrdev_stream_ops:{open(e){var t=Te.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek(){throw new Te.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Te.devices[e]={stream_ops:t}},getDevice:e=>Te.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),Te.syncFSRequests++,Te.syncFSRequests>1&&w(`warning: ${Te.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Te.getMounts(Te.root.mount),i=0;function n(e){return Te.syncFSRequests--,t(e)}function s(e){if(e)return s.errored?void 0:(s.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return s(null);t.type.syncfs(t,e,s)}))},mount(e,t,r){var i,n="/"===r,s=!r;if(n&&Te.root)throw new Te.ErrnoError(10);if(!n&&!s){var o=Te.lookupPath(r,{follow_mount:!1});if(r=o.path,i=o.node,Te.isMountpoint(i))throw new Te.ErrnoError(10);if(!Te.isDir(i.mode))throw new Te.ErrnoError(54)}var a={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(a);return d.mount=a,a.root=d,n?Te.root=d:i&&(i.mounted=a,i.mount&&i.mount.mounts.push(a)),d},unmount(e){var t=Te.lookupPath(e,{follow_mount:!1});if(!Te.isMountpoint(t.node))throw new Te.ErrnoError(28);var r=t.node,i=r.mounted,n=Te.getMounts(i);Object.keys(Te.nameTable).forEach((e=>{for(var t=Te.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&Te.destroyNode(t),t=r}})),r.mounted=null;var s=r.mount.mounts.indexOf(i);r.mount.mounts.splice(s,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var i=Te.lookupPath(e,{parent:!0}).node,n=de.basename(e);if(!n||"."===n||".."===n)throw new Te.ErrnoError(28);var s=Te.mayCreate(i,n);if(s)throw new Te.ErrnoError(s);if(!i.node_ops.mknod)throw new Te.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,Te.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,Te.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),i="",n=0;n(void 0===r&&(r=t,t=438),t|=8192,Te.mknod(e,t,r)),symlink(e,t){if(!ue.resolve(e))throw new Te.ErrnoError(44);var r=Te.lookupPath(t,{parent:!0}).node;if(!r)throw new Te.ErrnoError(44);var i=de.basename(t),n=Te.mayCreate(r,i);if(n)throw new Te.ErrnoError(n);if(!r.node_ops.symlink)throw new Te.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename(e,t){var r,i,n=de.dirname(e),s=de.dirname(t),o=de.basename(e),a=de.basename(t);if(r=Te.lookupPath(e,{parent:!0}).node,i=Te.lookupPath(t,{parent:!0}).node,!r||!i)throw new Te.ErrnoError(44);if(r.mount!==i.mount)throw new Te.ErrnoError(75);var d,l=Te.lookupNode(r,o),c=ue.relative(e,s);if("."!==c.charAt(0))throw new Te.ErrnoError(28);if("."!==(c=ue.relative(t,n)).charAt(0))throw new Te.ErrnoError(55);try{d=Te.lookupNode(i,a)}catch(e){}if(l!==d){var u=Te.isDir(l.mode),h=Te.mayDelete(r,o,u);if(h)throw new Te.ErrnoError(h);if(h=d?Te.mayDelete(i,a,u):Te.mayCreate(i,a))throw new Te.ErrnoError(h);if(!r.node_ops.rename)throw new Te.ErrnoError(63);if(Te.isMountpoint(l)||d&&Te.isMountpoint(d))throw new Te.ErrnoError(10);if(i!==r&&(h=Te.nodePermissions(r,"w")))throw new Te.ErrnoError(h);Te.hashRemoveNode(l);try{r.node_ops.rename(l,i,a)}catch(e){throw e}finally{Te.hashAddNode(l)}}},rmdir(e){var t=Te.lookupPath(e,{parent:!0}).node,r=de.basename(e),i=Te.lookupNode(t,r),n=Te.mayDelete(t,r,!0);if(n)throw new Te.ErrnoError(n);if(!t.node_ops.rmdir)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.rmdir(t,r),Te.destroyNode(i)},readdir(e){var t=Te.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new Te.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=Te.lookupPath(e,{parent:!0}).node;if(!t)throw new Te.ErrnoError(44);var r=de.basename(e),i=Te.lookupNode(t,r),n=Te.mayDelete(t,r,!1);if(n)throw new Te.ErrnoError(n);if(!t.node_ops.unlink)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.unlink(t,r),Te.destroyNode(i)},readlink(e){var t=Te.lookupPath(e).node;if(!t)throw new Te.ErrnoError(44);if(!t.node_ops.readlink)throw new Te.ErrnoError(28);return ue.resolve(Te.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=Te.lookupPath(e,{follow:!t}).node;if(!r)throw new Te.ErrnoError(44);if(!r.node_ops.getattr)throw new Te.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>Te.stat(e,!0),chmod(e,t,r){var i;"string"==typeof e?i=Te.lookupPath(e,{follow:!r}).node:i=e;if(!i.node_ops.setattr)throw new Te.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod(e,t){Te.chmod(e,t,!0)},fchmod(e,t){var r=Te.getStreamChecked(e);Te.chmod(r.node,t)},chown(e,t,r,i){var n;"string"==typeof e?n=Te.lookupPath(e,{follow:!i}).node:n=e;if(!n.node_ops.setattr)throw new Te.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown(e,t,r){Te.chown(e,t,r,!0)},fchown(e,t,r){var i=Te.getStreamChecked(e);Te.chown(i.node,t,r)},truncate(e,t){if(t<0)throw new Te.ErrnoError(28);var r;"string"==typeof e?r=Te.lookupPath(e,{follow:!0}).node:r=e;if(!r.node_ops.setattr)throw new Te.ErrnoError(63);if(Te.isDir(r.mode))throw new Te.ErrnoError(31);if(!Te.isFile(r.mode))throw new Te.ErrnoError(28);var i=Te.nodePermissions(r,"w");if(i)throw new Te.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=Te.getStreamChecked(e);if(0==(2097155&r.flags))throw new Te.ErrnoError(28);Te.truncate(r.node,t)},utime(e,t,r){var i=Te.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new Te.ErrnoError(44);var i;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?Be(t):t)?4095&r|32768:0,"object"==typeof e)i=e;else{e=de.normalize(e);try{i=Te.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var s=!1;if(64&t)if(i){if(128&t)throw new Te.ErrnoError(20)}else i=Te.mknod(e,r,0),s=!0;if(!i)throw new Te.ErrnoError(44);if(Te.isChrdev(i.mode)&&(t&=-513),65536&t&&!Te.isDir(i.mode))throw new Te.ErrnoError(54);if(!s){var o=Te.mayOpen(i,t);if(o)throw new Te.ErrnoError(o)}512&t&&!s&&Te.truncate(i,0),t&=-131713;var a=Te.createStream({node:i,path:Te.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return a.stream_ops.open&&a.stream_ops.open(a),!n.logReadFiles||1&t||(Te.readFiles||(Te.readFiles={}),e in Te.readFiles||(Te.readFiles[e]=1)),a},close(e){if(Te.isClosed(e))throw new Te.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Te.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Te.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Te.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,i,n){if(i<0||n<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(1==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.read)throw new Te.ErrnoError(28);var s=void 0!==n;if(s){if(!e.seekable)throw new Te.ErrnoError(70)}else n=e.position;var o=e.stream_ops.read(e,t,r,i,n);return s||(e.position+=o),o},write(e,t,r,i,n,s){if(i<0||n<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.write)throw new Te.ErrnoError(28);e.seekable&&1024&e.flags&&Te.llseek(e,0,2);var o=void 0!==n;if(o){if(!e.seekable)throw new Te.ErrnoError(70)}else n=e.position;var a=e.stream_ops.write(e,t,r,i,n,s);return o||(e.position+=a),a},allocate(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(t<0||r<=0)throw new Te.ErrnoError(28);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(!Te.isFile(e.node.mode)&&!Te.isDir(e.node.mode))throw new Te.ErrnoError(43);if(!e.stream_ops.allocate)throw new Te.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,i,n){if(0!=(2&i)&&0==(2&n)&&2!=(2097155&e.flags))throw new Te.ErrnoError(2);if(1==(2097155&e.flags))throw new Te.ErrnoError(2);if(!e.stream_ops.mmap)throw new Te.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n)},msync:(e,t,r,i,n)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new Te.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,i=Te.open(e,t.flags),n=Te.stat(e).size,s=new Uint8Array(n);return Te.read(i,s,0,n,0),"utf8"===t.encoding?r=fe(s,0):"binary"===t.encoding&&(r=s),Te.close(i),r},writeFile(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=Te.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(me(t)+1),s=_e(t,n,0,n.length);Te.write(i,n,0,s,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");Te.write(i,t,0,t.byteLength,void 0,r.canOwn)}Te.close(i)},cwd:()=>Te.currentPath,chdir(e){var t=Te.lookupPath(e,{follow:!0});if(null===t.node)throw new Te.ErrnoError(44);if(!Te.isDir(t.node.mode))throw new Te.ErrnoError(54);var r=Te.nodePermissions(t.node,"x");if(r)throw new Te.ErrnoError(r);Te.currentPath=t.path},createDefaultDirectories(){Te.mkdir("/tmp"),Te.mkdir("/home"),Te.mkdir("/home/web_user")},createDefaultDevices(){Te.mkdir("/dev"),Te.registerDevice(Te.makedev(1,3),{read:()=>0,write:(e,t,r,i,n)=>i}),Te.mkdev("/dev/null",Te.makedev(1,3)),ve.register(Te.makedev(5,0),ve.default_tty_ops),ve.register(Te.makedev(6,0),ve.default_tty1_ops),Te.mkdev("/dev/tty",Te.makedev(5,0)),Te.mkdev("/dev/tty1",Te.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=ce(e).byteLength),e[--t]);Te.createDevice("/dev","random",r),Te.createDevice("/dev","urandom",r),Te.mkdir("/dev/shm"),Te.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Te.mkdir("/proc");var e=Te.mkdir("/proc/self");Te.mkdir("/proc/self/fd"),Te.mount({mount(){var t=Te.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,i=Te.getStreamChecked(r),n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return n.parent=n,n}},t}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?Te.createDevice("/dev","stdin",n.stdin):Te.symlink("/dev/tty","/dev/stdin"),n.stdout?Te.createDevice("/dev","stdout",null,n.stdout):Te.symlink("/dev/tty","/dev/stdout"),n.stderr?Te.createDevice("/dev","stderr",null,n.stderr):Te.symlink("/dev/tty1","/dev/stderr"),Te.open("/dev/stdin",0),Te.open("/dev/stdout",1),Te.open("/dev/stderr",1)},ensureErrnoError(){Te.ErrnoError||(Te.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},Te.ErrnoError.prototype=new Error,Te.ErrnoError.prototype.constructor=Te.ErrnoError,[44].forEach((e=>{Te.genericErrors[e]=new Te.ErrnoError(e),Te.genericErrors[e].stack=""})))},staticInit(){Te.ensureErrnoError(),Te.nameTable=new Array(4096),Te.mount(we,{},"/"),Te.createDefaultDirectories(),Te.createDefaultDevices(),Te.createSpecialDirectories(),Te.filesystems={MEMFS:we}},init(e,t,r){Te.init.initialized=!0,Te.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=t||n.stdout,n.stderr=r||n.stderr,Te.createStandardStreams()},quit(){Te.init.initialized=!1;for(var e=0;ethis.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},s.prototype.setDataGetter=function(e){this.getter=e},s.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,s=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,o=1048576;n||(o=i);var a=this;a.setDataGetter((e=>{var t=e*o,n=(e+1)*o-1;if(n=Math.min(n,i-1),void 0===a.chunks[e]&&(a.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==o&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):ge(n.responseText||"",!0)})(t,n)),void 0===a.chunks[e])throw new Error("doXHR failed!");return a.chunks[e]})),!s&&i||(o=i=1,i=this.getter(0).length,o=i,b("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=o,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!u)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var o=new s;Object.defineProperties(o,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var a={isDevice:!1,contents:o}}else a={isDevice:!1,url:r};var d=Te.createFile(e,t,a,i,n);a.contents?d.contents=a.contents:a.url&&(d.contents=null,d.url=a.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,t,r,i,n){var s=e.node.contents;if(n>=s.length)return 0;var o=Math.min(s.length-n,i);if(s.slice)for(var a=0;a{var t=d.stream_ops[e];l[e]=function(){return Te.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,n)=>(Te.forceLoadFile(d),c(e,t,r,i,n)),l.mmap=(e,t,r,i,n)=>{Te.forceLoadFile(d);var s=be();if(!s)throw new Te.ErrnoError(48);return c(e,S,s,t,r),{ptr:s,allocated:!0}},d.stream_ops=l,d}},Ce=(e,t)=>e?fe(E,e,t):"",De={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(de.isAbs(t))return t;var i;-100===e?i=Te.cwd():i=De.getStreamFromFD(e).path;if(0==t.length){if(!r)throw new Te.ErrnoError(44);return i}return de.join2(i,t)},doStat(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&de.normalize(t)!==de.normalize(Te.getPath(e.node)))return-54;throw e}x[r>>2]=i.dev,x[r+4>>2]=i.mode,B[r+8>>2]=i.nlink,x[r+12>>2]=i.uid,x[r+16>>2]=i.gid,x[r+20>>2]=i.rdev,K=[i.size>>>0,(Y=i.size,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+24>>2]=K[0],x[r+28>>2]=K[1],x[r+32>>2]=4096,x[r+36>>2]=i.blocks;var n=i.atime.getTime(),s=i.mtime.getTime(),o=i.ctime.getTime();return K=[Math.floor(n/1e3)>>>0,(Y=Math.floor(n/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+40>>2]=K[0],x[r+44>>2]=K[1],B[r+48>>2]=n%1e3*1e3,K=[Math.floor(s/1e3)>>>0,(Y=Math.floor(s/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+56>>2]=K[0],x[r+60>>2]=K[1],B[r+64>>2]=s%1e3*1e3,K=[Math.floor(o/1e3)>>>0,(Y=Math.floor(o/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+72>>2]=K[0],x[r+76>>2]=K[1],B[r+80>>2]=o%1e3*1e3,K=[i.ino>>>0,(Y=i.ino,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+88>>2]=K[0],x[r+92>>2]=K[1],0},doMsync(e,t,r,i,n){if(!Te.isFile(t.node.mode))throw new Te.ErrnoError(43);if(2&i)return 0;var s=E.slice(e,e+r);Te.msync(t,s,n,r,i)},varargs:void 0,get(){var e=x[+De.varargs>>2];return De.varargs+=4,e},getp:()=>De.get(),getStr:e=>Ce(e),getStreamFromFD:e=>Te.getStreamChecked(e)};function Pe(e,t,r){De.varargs=r;try{var i=De.getStreamFromFD(e);switch(t){case 0:if((n=De.get())<0)return-28;for(;Te.streams[n];)n++;return Te.createStream(i,n).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var n=De.get();return i.flags|=n,0;case 5:n=De.getp();return A[n+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return ae(28),-1}}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}function Fe(e,t,r,i){De.varargs=i;try{t=De.getStr(t),t=De.calculateAt(e,t);var n=i?De.get():0;return Te.open(t,r,n).fd}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}var Le,Ie,Me,Re=(e,t,r,i,n)=>{},ze=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Le=e},Ne=e=>{for(var t="",r=e;E[r];)t+=Le[E[r++]];return t},$e={},Oe={},Ge={},He=e=>{throw new Ie(e)},We=e=>{throw new Me(e)},Ve=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&We("Mismatched type converter count");for(var n=0;n{Oe.hasOwnProperty(e)?n[t]=Oe[e]:(s.push(e),$e.hasOwnProperty(e)||($e[e]=[]),$e[e].push((()=>{n[t]=Oe[e],++o===s.length&&i(n)})))})),0===s.length&&i(n)};function je(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||He(`type "${i}" must have a positive integer typeid pointer`),Oe.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;He(`Cannot register type '${i}' twice`)}if(Oe[e]=t,delete Ge[e],$e.hasOwnProperty(e)){var n=$e[e];delete $e[e],n.forEach((e=>e()))}}function qe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return je(e,t,r)}var Ye,Ke=8,Xe=(e,t,r,i)=>{qe(e,{name:t=Ne(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:Ke,readValueFromPointer:function(e){return this.fromWireType(E[e])},destructorFunction:null})},Ze=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Je=e=>{He(e.$$.ptrType.registeredClass.name+" instance already deleted")},Qe=!1,et=e=>{},tt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},rt=e=>{e.count.value-=1,0===e.count.value&&tt(e)},it=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=it(e,t,r.baseClass);return null===i?null:r.downcast(i)},nt={},st=()=>Object.keys(ut).length,ot=()=>{var e=[];for(var t in ut)ut.hasOwnProperty(t)&&e.push(ut[t]);return e},at=[],dt=()=>{for(;at.length;){var e=at.pop();e.$$.deleteScheduled=!1,e.delete()}},lt=e=>{Ye=e,at.length&&Ye&&Ye(dt)},ct=()=>{n.getInheritedInstanceCount=st,n.getLiveInheritedInstances=ot,n.flushPendingDeletes=dt,n.setDelayFunction=lt},ut={},ht=(e,t)=>{for(void 0===t&&He("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},ft=(e,t)=>(t=ht(e,t),ut[t]),pt=(e,t)=>(t.ptrType&&t.ptr||We("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!==!!t.smartPtr&&We("Both smartPtrType and smartPtr must be specified"),t.count={value:1},_t(Object.create(e,{$$:{value:t}})));function mt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ft(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?pt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):pt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,o=this.registeredClass.getActualType(t),a=nt[o];if(!a)return n.call(this);s=this.isConst?a.constPointerType:a.pointerType;var d=it(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}var _t=e=>"undefined"==typeof FinalizationRegistry?(_t=e=>e,e):(Qe=new FinalizationRegistry((e=>{rt(e.$$)})),_t=e=>{var t=e.$$;if(!!t.smartPtr){var r={$$:t};Qe.register(e,r,e)}return e},et=e=>Qe.unregister(e),_t(e)),gt=()=>{Object.assign(yt.prototype,{isAliasOf(e){if(!(this instanceof yt))return!1;if(!(e instanceof yt))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n},clone(){if(this.$$.ptr||Je(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=_t(Object.create(Object.getPrototypeOf(this),{$$:{value:Ze(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),et(this),rt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),at.push(this),1===at.length&&Ye&&Ye(dt),this.$$.deleteScheduled=!0,this}})};function yt(){}var vt=(e,t)=>Object.defineProperty(t,"name",{value:e}),bt=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||He(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},wt=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&He(`Cannot register public name '${e}' twice`),bt(n,e,e),n.hasOwnProperty(r)&&He(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,void 0!==r&&(n[e].numArguments=r))},St=48,Et=57,At=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=St&&t<=Et?`_${e}`:e};function Ut(e,t,r,i,n,s,o,a){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=o,this.downcast=a,this.pureVirtualFunctions=[]}var xt=(e,t,r)=>{for(;t!==r;)t.upcast||He(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function Bt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return xt(t.$$.ptr,r,this.registeredClass)}function kt(e,t){var r;if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=xt(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&He("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,sr.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:He("Unsupporting sharing policy")}return r}function Tt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return xt(t.$$.ptr,r,this.registeredClass)}function Ct(e){return this.fromWireType(B[e>>2])}var Dt=()=>{Object.assign(Pt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:Ke,readValueFromPointer:Ct,deleteObject(e){null!==e&&e.delete()},fromWireType:mt})};function Pt(e,t,r,i,n,s,o,a,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=o,this.rawGetPointee=a,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=kt:i?(this.toWireType=Bt,this.destructorFunction=null):(this.toWireType=Tt,this.destructorFunction=null)}var Ft,Lt,It=(e,t,r)=>{n.hasOwnProperty(e)||We("Replacing nonexistant public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},Mt=(e,t,r)=>{var i=n["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},Rt=[],zt=e=>{var t=Rt[e];return t||(e>=Rt.length&&(Rt.length=e+1),Rt[e]=t=Ft.get(e)),t},Nt=(e,t,r)=>e.includes("j")?Mt(e,t,r):zt(t).apply(null,r),$t=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),Nt(e,t,r)}},Ot=(e,t)=>{var r=(e=Ne(e)).includes("j")?$t(e,t):zt(t);return"function"!=typeof r&&He(`unknown function pointer with signature ${e}: ${t}`),r},Gt=(e,t)=>{var r=vt(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},Ht=e=>{var t=di(e),r=Ne(t);return oi(t),r},Wt=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Oe[t]||(Ge[t]?Ge[t].forEach(e):(r.push(t),i[t]=!0))})),new Lt(`${e}: `+r.map(Ht).join([", "]))},Vt=(e,t,r,i,n,s,o,a,d,l,c,u,h)=>{c=Ne(c),s=Ot(n,s),a&&(a=Ot(o,a)),l&&(l=Ot(d,l)),h=Ot(u,h);var f=At(c);wt(f,(function(){Wt(`Cannot construct ${c} due to unbound types`,[i])})),Ve([e,t,r],i?[i]:[],(function(t){var r,n;t=t[0],n=i?(r=t.registeredClass).instancePrototype:yt.prototype;var o=vt(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new Ie("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new Ie(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new Ie(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(n,{constructor:{value:o}});o.prototype=d;var u=new Ut(c,o,d,h,r,s,a,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new Pt(c,u,!0,!1,!1),m=new Pt(c+"*",u,!1,!1,!1),_=new Pt(c+" const*",u,!1,!0,!1);return nt[e]={pointerType:m,constPointerType:_},It(f,o),[p,m,_]}))},jt=(e,t)=>{for(var r=[],i=0;i>2]);return r},qt=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Yt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=vt(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function Kt(e,t,r,i,n,s){var o=t.length;o<2&&He("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||s?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=a?1:2;l{var o=jt(t,r);n=Ot(i,n),Ve([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Ie(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Wt(`Cannot construct ${e.name} due to unbound types`,o)},Ve([],o,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Kt(r,i,null,n,s),[]))),[]}))},Zt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Jt=(e,t,r,i,n,s,o,a,d)=>{var l=jt(r,i);t=Ne(t),t=Zt(t),s=Ot(n,s),Ve([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function n(){Wt(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),a&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,c[t]=n):(bt(c,t,i),c[t].overloadTable[r-2]=n),Ve([],l,(function(n){var a=Kt(i,n,e,s,o,d);return void 0===c[t].overloadTable?(a.argCount=r-2,c[t]=a):c[t].overloadTable[r-2]=a,[]})),[]}))};function Qt(){Object.assign(er.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function er(){this.allocated=[void 0],this.freelist=[]}var tr=new er,rr=e=>{e>=tr.reserved&&0==--tr.get(e).refcount&&tr.free(e)},ir=()=>{for(var e=0,t=tr.reserved;t{tr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),tr.reserved=tr.allocated.length,n.count_emval_handles=ir},sr={toValue:e=>(e||He("Cannot use deleted val. handle = "+e),tr.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return tr.allocate({refcount:1,value:e})}}};function or(e){return this.fromWireType(x[e>>2])}var ar=(e,t)=>{qe(e,{name:t=Ne(t),fromWireType:e=>{var t=sr.toValue(e);return rr(e),t},toWireType:(e,t)=>sr.toHandle(t),argPackAdvance:Ke,readValueFromPointer:or,destructorFunction:null})},dr=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},lr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(k[e>>2])};case 8:return function(e){return this.fromWireType(T[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},cr=(e,t,r)=>{qe(e,{name:t=Ne(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Ke,readValueFromPointer:lr(t,r),destructorFunction:null})},ur=(e,t,r)=>{switch(t){case 1:return r?e=>S[e>>0]:e=>E[e>>0];case 2:return r?e=>A[e>>1]:e=>U[e>>1];case 4:return r?e=>x[e>>2]:e=>B[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},hr=(e,t,r,i,n)=>{t=Ne(t);var s=e=>e;if(0===i){var o=32-8*r;s=e=>e<>>o}var a=t.includes("unsigned");qe(e,{name:t,fromWireType:s,toWireType:a?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:Ke,readValueFromPointer:ur(t,r,0!==i),destructorFunction:null})},fr=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=B[e>>2],r=B[e+4>>2];return new i(S.buffer,r,t)}qe(e,{name:r=Ne(r),fromWireType:n,argPackAdvance:Ke,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},pr=(e,t,r)=>_e(e,E,t,r),mr=(e,t)=>{var r="std::string"===(t=Ne(t));qe(e,{name:t,fromWireType(e){var t,i=B[e>>2],n=e+4;if(r)for(var s=n,o=0;o<=i;++o){var a=n+o;if(o==i||0==E[a]){var d=Ce(s,a-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=a+1}}else{var l=new Array(i);for(o=0;o>2]=i,r&&n)pr(t,o,i+1);else if(n)for(var a=0;a255&&(oi(o),He("String has UTF-16 code units that do not fit in 8 bits")),E[o+a]=d}else for(a=0;a{for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&U[i];)++i;if((r=i<<1)-e>32&&_r)return _r.decode(E.subarray(e,r));for(var s="",o=0;!(o>=t/2);++o){var a=A[e+2*o>>1];if(0==a)break;s+=String.fromCharCode(a)}return s},yr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=o,t+=2}return A[t>>1]=0,t-i},vr=e=>2*e.length,br=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var n=x[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i},wr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&o<=57343)o=65536+((1023&o)<<10)|1023&e.charCodeAt(++s);if(x[t>>2]=o,(t+=4)+4>n)break}return x[t>>2]=0,t-i},Sr=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},Er=(e,t,r)=>{var i,n,s,o,a;r=Ne(r),2===t?(i=gr,n=yr,o=vr,s=()=>U,a=1):4===t&&(i=br,n=wr,o=Sr,s=()=>B,a=2),qe(e,{name:r,fromWireType:e=>{for(var r,n=B[e>>2],o=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==o[c>>a]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return oi(e),r},toWireType:(e,i)=>{"string"!=typeof i&&He(`Cannot pass non-string to C++ string type ${r}`);var s=o(i),d=li(4+s+t);return B[d>>2]=s>>a,n(i,d+4,s+t),null!==e&&e.push(oi,d),d},argPackAdvance:Ke,readValueFromPointer:or,destructorFunction(e){oi(e)}})},Ar=(e,t)=>{qe(e,{isVoid:!0,name:t=Ne(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},Ur={},xr=e=>{var t=Ur[e];return void 0===t?Ne(e):t},Br=[],kr=(e,t,r,i,n)=>(e=Br[e])(t=sr.toValue(t),t[r=xr(r)],i,n),Tr=e=>{var t=Br.length;return Br.push(e),t},Cr=(e,t)=>{var r=Oe[e];return void 0===r&&He(t+" has unknown type "+Ht(e)),r},Dr=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},Pr=(e,t,r)=>{var i=[],n=e.toWireType(i,r);return i.length&&(B[t>>2]=sr.toHandle(i)),n},Fr=(e,t,r)=>{var i=Dr(e,t),n=i.shift();e--;var s="return function (obj, func, destructorsRef, args) {\n",o=0,a=[];0===r&&a.push("obj");for(var d=["retType"],l=[n],c=0;ce.name)).join(", ")}) => ${n.name}>`;return Tr(vt(h,u))},Lr=e=>{var t=sr.toValue(e);qt(t),rr(e)},Ir=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,Mr=()=>{j("")},Rr=()=>Date.now(),zr=(e,t,r)=>E.copyWithin(e,t,t+r),Nr=e=>{j("OOM")},$r=e=>{E.length,Nr()},Or={},Gr=()=>l||"./this.program",Hr=()=>{if(!Hr.strings){var e={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",_:Gr()};for(var t in Or)void 0===Or[t]?delete e[t]:e[t]=Or[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Hr.strings=r}return Hr.strings},Wr=(e,t)=>{for(var r=0;r>0]=e.charCodeAt(r);S[t>>0]=0},Vr=(e,t)=>{var r=0;return Hr().forEach(((i,n)=>{var s=t+r;B[e+4*n>>2]=s,Wr(i,s),r+=i.length+1})),0},jr=(e,t)=>{var r=Hr();B[e>>2]=r.length;var i=0;return r.forEach((e=>i+=e.length+1)),B[t>>2]=i,0};function qr(e){try{var t=De.getStreamFromFD(e);return Te.close(t),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Yr(e,t){try{var r=De.getStreamFromFD(e),i=r.tty?2:Te.isDir(r.mode)?3:Te.isLink(r.mode)?7:4;return S[t>>0]=i,A[t+2>>1]=0,K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[t+8>>2]=K[0],x[t+12>>2]=K[1],K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[t+16>>2]=K[0],x[t+20>>2]=K[1],0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Kr=(e,t,r,i)=>{for(var n=0,s=0;s>2],a=B[t+4>>2];t+=8;var d=Te.read(e,S,o,a,i);if(d<0)return-1;if(n+=d,d>2]=s,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Zr(e,t,r,i,n){var s=Ir(t,r);try{if(isNaN(s))return 61;var o=De.getStreamFromFD(e);return Te.llseek(o,s,i),K=[o.position>>>0,(Y=o.position,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[n>>2]=K[0],x[n+4>>2]=K[1],o.getdents&&0===s&&0===i&&(o.getdents=null),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Jr=(e,t,r,i)=>{for(var n=0,s=0;s>2],a=B[t+4>>2];t+=8;var d=Te.write(e,S,o,a,i);if(d<0)return-1;n+=d,void 0!==i&&(i+=d)}return n};function Qr(e,t,r,i){try{var n=De.getStreamFromFD(e),s=Jr(n,t,r);return B[i>>2]=s,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var ei=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=Te.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},ti=365,ri=146;Object.defineProperties(ei.prototype,{read:{get:function(){return(this.mode&ti)===ti},set:function(e){e?this.mode|=ti:this.mode&=~ti}},write:{get:function(){return(this.mode&ri)===ri},set:function(e){e?this.mode|=ri:this.mode&=~ri}},isFolder:{get:function(){return Te.isDir(this.mode)}},isDevice:{get:function(){return Te.isChrdev(this.mode)}}}),Te.FSNode=ei,Te.createPreloadedFile=xe,Te.staticInit(),ze(),Ie=n.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Me=n.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},gt(),ct(),Dt(),Lt=n.UnboundTypeError=Gt(Error,"UnboundTypeError"),Qt(),nr();var ii,ni={o:oe,A:Pe,s:Fe,q:Re,C:Xe,D:Vt,y:Xt,h:Jt,B:ar,l:cr,c:hr,b:fr,m:mr,j:Er,n:Ar,f:kr,g:rr,e:Fr,d:Lr,a:Mr,i:Rr,w:zr,r:$r,u:Vr,v:jr,k:qr,t:Yr,z:Xr,p:Zr,x:Qr},si=ie(),oi=e=>(oi=si.G)(e),ai=()=>(ai=si.I)(),di=e=>(di=si.J)(e),li=e=>(li=si.K)(e),ci=e=>(ci=si.M)(e);function ui(){function e(){ii||(ii=!0,n.calledRun=!0,C||(R(),r(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),z()))}G>0||(M(),G>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.dynCall_viiijj=(e,t,r,i,s,o,a,d)=>(n.dynCall_viiijj=si.N)(e,t,r,i,s,o,a,d),n.dynCall_jij=(e,t,r,i)=>(n.dynCall_jij=si.O)(e,t,r,i),n.dynCall_jii=(e,t,r)=>(n.dynCall_jii=si.P)(e,t,r),n.dynCall_jiji=(e,t,r,i,s)=>(n.dynCall_jiji=si.Q)(e,t,r,i,s),H=function e(){ii||ui(),ii||(H=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return ui(),t.ready}})(),a=1e-6,d="undefined"!=typeof Float32Array?Float32Array:Array;function l(){var e=new d(16);return d!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function c(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var u,h=function(e,t,r,i,n,s,o){var a=1/(t-r),d=1/(i-n),l=1/(s-o);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*d,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*a,e[13]=(n+i)*d,e[14]=(o+s)*l,e[15]=1,e};function f(e,t,r){var i=new d(3);return i[0]=e,i[1]=t,i[2]=r,i}u=new d(3),d!=Float32Array&&(u[0]=0,u[1]=0,u[2]=0);var p=(e,t)=>{t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);const r=function(){const t=m(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),r=m(e.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))return console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(i)),null;return i}();let i={program:r,attribLocations:{vertexPosition:e.getAttribLocation(r,"aVertexPosition"),texturePosition:e.getAttribLocation(r,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(r,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(r,"uModelMatrix"),viewMatrix:e.getUniformLocation(r,"uViewMatrix"),rgbatexture:e.getUniformLocation(r,"rgbaTexture"),ytexture:e.getUniformLocation(r,"yTexture"),utexture:e.getUniformLocation(r,"uTexture"),vtexture:e.getUniformLocation(r,"vTexture"),isyuv:e.getUniformLocation(r,"isyuv")}},n=function(){const t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),e.STATIC_DRAW);var r=[];r=r.concat([0,1],[1,1],[1,0],[0,0]);const i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW);const n=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,texPosition:i,indices:n}}(),s=p(),o=p(),d=p(),u=p();function p(){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function m(t,r){const i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(console.log("An error occurred compiling the shaders: "+e.getShaderInfoLog(i)),e.deleteShader(i),null)}function _(t,r){e.viewport(0,0,t,r),e.clearColor(0,0,0,0),e.clearDepth(1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);const s=l();h(s,-1,1,-1,1,.1,100);const p=l();c(p);const m=l();!function(e,t,r,i){var n,s,o,d,l,u,h,f,p,m,_=t[0],g=t[1],y=t[2],v=i[0],b=i[1],w=i[2],S=r[0],E=r[1],A=r[2];Math.abs(_-S)32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let r=e-this._current_word_bits_left;this._fillCurrentWord();let i=Math.min(r,this._current_word_bits_left),n=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Ht=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Wt=Ht,Vt=Ht;function jt(e){let{profile:t,sampleRate:r,channel:i}=e;return new Uint8Array([175,0,t<<3|(14&r)>>1,(1&r)<<7|i<<3])}function qt(e){return Yt(e)&&e[1]===Bt}function Yt(e){return e[0]>>4===$e}const Kt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Xt(e){let t=new Uint8Array(e),r=null,i=0,n=0,s=0,o=null;if(i=n=t[0]>>>3,s=(7&t[0])<<1|t[1]>>>7,s<0||s>=Kt.length)return void console.error("Flv: AAC invalid sampling frequency index!");let a=Kt[s],d=(120&t[1])>>>3;if(d<0||d>=8)return void console.log("Flv: AAC invalid channel configuration");5===i&&(o=(7&t[1])<<1|t[2]>>>7,t[2]);let l=self.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?s>=6?(i=5,r=new Array(4),o=s-3):(i=2,r=new Array(2),o=s):-1!==l.indexOf("android")?(i=2,r=new Array(2),o=s):(i=5,o=s,r=new Array(4),s>=6?o=s-3:1===d&&(i=2,r=new Array(2),o=s)),r[0]=i<<3,r[0]|=(15&s)>>>1,r[1]=(15&s)<<7,r[1]|=(15&d)<<3,5===i&&(r[1]|=(15&o)>>>1,r[2]=(1&o)<<7,r[2]|=8,r[3]=0),{audioType:"aac",config:r,sampleRate:a,channelCount:d,objectType:i,codec:"mp4a.40."+i,originalCodec:"mp4a.40."+n}}class Zt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+7>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(4095===(r[t+0]<<8|r[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let r=this.current_syncword_offset_,i=(8&e[r+1])>>>3,n=(6&e[r+1])>>>1,s=1&e[r+1],o=(192&e[r+2])>>>6,a=(60&e[r+2])>>>2,d=(1&e[r+2])<<2|(192&e[r+3])>>>6,l=(3&e[r+3])<<11|e[r+4]<<3|(224&e[r+5])>>>5;if(e[r+6],r+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let c=1===s?7:9,u=l-c;r+=c;let h=this.findNextSyncwordOffset(r+u);if(this.current_syncword_offset_=h,0!==i&&1!==i||0!==n)continue;let f=e.subarray(r,r+u);t={},t.audio_object_type=o+1,t.sampling_freq_index=a,t.sampling_frequency=Wt[a],t.channel_config=d,t.data=f}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Jt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+1>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(695===(r[t+0]<<3|r[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),r=0;for(let i=0;i<=t;i++)r<<=8,r|=e.readByte();return r}readNextAACFrame(e){let t=this.data_,r=null;for(;null==r&&!this.eof_flag_;){let i=this.current_syncword_offset_,n=(31&t[i+1])<<8|t[i+2];if(i+3+n>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let s=new Gt(t.subarray(i+3,i+3+n)),o=null;if(s.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(i+3+n),s.destroy();continue}o=e}else{let e=s.readBool();if(e&&s.readBool()){console.error("audioMuxVersionA is Not Supported"),s.destroy();break}if(e&&this.getLATMValue(s),!s.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),s.destroy();break}if(0!==s.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),s.destroy();break}if(0!==s.readBits(4)){console.error("more than 2 numProgram Not Supported"),s.destroy();break}if(0!==s.readBits(3)){console.error("more than 2 numLayer Not Supported"),s.destroy();break}let t=e?this.getLATMValue(s):0,r=s.readBits(5);t-=5;let i=s.readBits(4);t-=4;let n=s.readBits(4);t-=4,s.readBits(3),t-=3,t>0&&s.readBits(t);let a=s.readBits(3);if(0!==a){console.error(`frameLengthType = ${a}. Only frameLengthType = 0 Supported`),s.destroy();break}s.readByte();let d=s.readBool();if(d)if(e)this.getLATMValue(s);else{let e=0;for(;;){e<<=8;let t=s.readBool();if(e+=s.readByte(),!t)break}console.log(e)}s.readBool()&&s.readByte(),o={},o.audio_object_type=r,o.sampling_freq_index=i,o.sampling_frequency=Wt[o.sampling_freq_index],o.channel_config=n,o.other_data_present=d}let a=0;for(;;){let e=s.readByte();if(a+=e,255!==e)break}let d=new Uint8Array(a);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function er(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return;const r=e.length,i=[];let n,s=0;for(;s+t>>=8),s+=t,n){if(s+n>r)break;i.push(e.subarray(s,s+n)),s+=n}return i}function tr(e){const t=e.byteLength,r=new Uint8Array(4);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t;const i=new Uint8Array(t+4);return i.set(r,0),i.set(e,4),i}function rr(e,t){let r=null;return t?e.length>=28&&(r=1+(3&e[26])):e.length>=12&&(r=1+(3&e[9])),r}function ir(){return(new Date).getTime()}function nr(e,t,r){return Math.max(Math.min(e,Math.max(t,r)),Math.min(t,r))}function sr(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function or(e){let t=0,r=sr();return i=>{if(n=i,"[object Number]"!==Object.prototype.toString.call(n))return;var n;t+=i;const s=sr(),o=s-r;o>=1e3&&(e(t/o*1e3),r=s,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();function ar(e){return null==e}function dr(e){return!ar(e)}function lr(e){return"function"==typeof e}function cr(e){let t=null,r=31&e[0];return r!==We&&r!==Ve||(t=ze),t||(r=(126&e[0])>>1,r!==st&&r!==at&&r!==lt||(t=Ne)),t}function ur(){return"undefined"!=typeof WritableStream}function hr(e){e.close()}function fr(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let r=e[0],i=null,n=1;if(e.length>0){let t=e[1];t&&t.ts-r.ts>1e5&&(r=t,n=2)}if(r)for(let s=n;s=1e3){e[s-1].ts-r.ts<1e3&&(i=s+1)}}}return i}function pr(e){return e.ok&&e.status>=200&&e.status<=299}function mr(){return function(e){let t="";if("object"==typeof e)try{t=JSON.stringify(e),t=JSON.parse(t)}catch(r){t=e}else t=e;return t}(B)}function _r(e){return e[0]>>4===kt&&e[1]===Bt}function gr(e){return!0===e||"true"===e}function yr(e){return!0!==e&&"true"!==e}function vr(){return!!(self.Worker&&self.MediaSource&&"canConstructInDedicatedWorker"in self.MediaSource&&!0===self.MediaSource.canConstructInDedicatedWorker)}function br(e,t){const r=er(e.slice(5));let i=!1;return r.forEach((e=>{const r=t?e[0]>>>1&63:31&e[0];(t&&(r===Qe||r===tt||r===it)||yr(t)&&r===je)&&(i=!0)})),i}var wr=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}d((i=i.apply(e,t||[])).next())}))};const Sr=Symbol(32),Er=Symbol(16),Ar=Symbol(8);class Ur{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return wr(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,r)=>{var i;this.reject=r,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(i=this.pull)||void 0===i||i.call(this,e)}))}))}readU32(){return this.read(Sr)}readU16(){return this.read(Er)}readU8(){return this.read(Ar)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let r=0;const i=e=>t.length<(r=e);if("number"==typeof this.need){if(i(this.need))return;e=t.subarray(0,r)}else if(this.need===Sr){if(i(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Er){if(i(2))return;e=t[0]<<8|t[1]}else if(this.need===Ar){if(i(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(i(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,r)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(i(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,r)),e=this.need}return this.consumed+=r,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,r=t+e;if(r<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,r);else{const e=new Uint8Array(r);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,r)}return this.buffer=new Uint8Array(e),this.buffer}}Ur.U32=Sr,Ur.U16=Er,Ur.U8=Ar;class xr{constructor(e){this.log=function(t){if(e._opt.debugLevel==S){const s=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n1?r-1:0),n=1;n1?i-1:0),s=1;s=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseSPS(e){let t=Br._ebsp2rbsp(e),r=new Gt(t);r.readByte();let i=r.readByte();r.readByte();let n=r.readByte();r.readUEG();let s=Br.getProfileString(i),o=Br.getLevelString(n),a=1,d=420,l=[0,420,422,444],c=8;if((100===i||110===i||122===i||244===i||44===i||83===i||86===i||118===i||128===i||138===i||144===i)&&(a=r.readUEG(),3===a&&r.readBits(1),a<=3&&(d=l[a]),c=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool())){let e=3!==a?8:12;for(let t=0;t0&&e<16?(b=t[e-1],w=i[e-1]):255===e&&(b=r.readByte()<<8|r.readByte(),w=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);E=r.readBool(),A=t,U=2*e,S=A/U}}let x=1;1===b&&1===w||(x=b/w);let B=0,k=0;if(0===a)B=1,k=2-m;else{B=3===a?1:2,k=(1===a?2:1)*(2-m)}let T=16*(f+1),C=16*(p+1)*(2-m);T-=(_+g)*B,C-=(y+v)*k;let D=Math.ceil(T*x);return r.destroy(),r=null,{profile_string:s,level_string:o,bit_depth:c,ref_frames:h,chroma_format:d,chroma_format_string:Br.getChromaFormatString(d),frame_rate:{fixed:E,fps:S,fps_den:U,fps_num:A},sar_ratio:{width:b,height:w},codec_size:{width:T,height:C},present_size:{width:D,height:C}}}static parseSPS$2(e){let t=e.subarray(1,4),r="avc1.";for(let e=0;e<3;e++){let i=t[e].toString(16);i.length<2&&(i="0"+i),r+=i}let i=Br._ebsp2rbsp(e),n=new Gt(i);n.readByte();let s=n.readByte();n.readByte();let o=n.readByte();n.readUEG();let a=Br.getProfileString(s),d=Br.getLevelString(o),l=1,c=420,u=[0,420,422,444],h=8,f=8;if((100===s||110===s||122===s||244===s||44===s||83===s||86===s||118===s||128===s||138===s||144===s)&&(l=n.readUEG(),3===l&&n.readBits(1),l<=3&&(c=u[l]),h=n.readUEG()+8,f=n.readUEG()+8,n.readBits(1),n.readBool())){let e=3!==l?8:12;for(let t=0;t0&&e<16?(E=t[e-1],A=r[e-1]):255===e&&(E=n.readByte()<<8|n.readByte(),A=n.readByte()<<8|n.readByte())}if(n.readBool()&&n.readBool(),n.readBool()&&(n.readBits(4),n.readBool()&&n.readBits(24)),n.readBool()&&(n.readUEG(),n.readUEG()),n.readBool()){let e=n.readBits(32),t=n.readBits(32);x=n.readBool(),B=t,k=2*e,U=B/k}}let T=1;1===E&&1===A||(T=E/A);let C=0,D=0;if(0===l)C=1,D=2-y;else{C=3===l?1:2,D=(1===l?2:1)*(2-y)}let P=16*(_+1),F=16*(g+1)*(2-y);P-=(v+b)*C,F-=(w+S)*D;let L=Math.ceil(P*T);return n.destroy(),n=null,{codec_mimetype:r,profile_idc:s,level_idc:o,profile_string:a,level_string:d,chroma_format_idc:l,bit_depth:h,bit_depth_luma:h,bit_depth_chroma:f,ref_frames:m,chroma_format:c,chroma_format_string:Br.getChromaFormatString(c),frame_rate:{fixed:x,fps:U,fps_den:k,fps_num:B},sar_ratio:{width:E,height:A},codec_size:{width:P,height:F},present_size:{width:L,height:F}}}static _skipScalingList(e,t){let r=8,i=8,n=0;for(let s=0;s=this.buflen)return this.iserro=!0,0;this.iserro=!1,r=this.bufoff+e>8?8-this.bufoff:e,t<<=r,t+=this.buffer[this.bufpos]>>8-this.bufoff-r&255>>8-r,this.bufoff+=r,e-=r,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,r=this.bufoff,i=this.read(e);return this.bufpos=t,this.bufoff=r,i}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.sps,4),t.sps=i}if(t.pps){const e=t.pps.byteLength,r=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.pps,4),t.pps=i}return t}function Cr(e){let{sps:t,pps:r}=e;const i=[23,0,0,0,0,1,66,0,30,255];i[0]=23,i[6]=t[1],i[7]=t[2],i[8]=t[3],i[10]=225,i[11]=t.byteLength>>8&255,i[12]=255&t.byteLength,i.push(...t,1,r.byteLength>>8&255,255&r.byteLength,...r);return new Uint8Array(i)}function Dr(e){let{sps:t,pps:r}=e,i=8+t.byteLength+1+2+r.byteLength,n=!1;const s=Br.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(n=!0,i+=4);let o=new Uint8Array(i);o[0]=1,o[1]=t[1],o[2]=t[2],o[3]=t[3],o[4]=255,o[5]=225;let a=t.byteLength;o[6]=a>>>8,o[7]=255&a;let d=8;o.set(t,8),d+=a,o[d]=1;let l=r.byteLength;o[d+1]=l>>>8,o[d+2]=255&l,o.set(r,d+3),d+=3+l,n&&(o[d]=252|s.chroma_format_idc,o[d+1]=248|s.bit_depth_luma-8,o[d+2]=248|s.bit_depth_chroma-8,o[d+3]=0,d+=4);const c=[23,0,0,0,0],u=new Uint8Array(c.length+o.byteLength);return u.set(c,0),u.set(o,c.length),u}function Pr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Fr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Lr(e){return 31&e[0]}function Ir(e){return e===Ke}function Mr(e){return!function(e){return e===We||e===Ve}(e)&&!Ir(e)}function Rr(e){return e===je}function zr(e){if(0===e.length)return!1;const t=Lr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=31&e[r],n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,i>=Je||0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class $r{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Or=e=>{let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)},Gr=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Hr{static _ebsp2rbsp(e){let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseVPS(e){let t=Hr._ebsp2rbsp(e),r=new Gt(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}}static parseSPS(e){let t=Hr._ebsp2rbsp(e),r=new Gt(t);r.readByte(),r.readByte();let i=0,n=0,s=0,o=0;r.readBits(4);let a=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=a;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<=16?(L=t[e-1],I=i[e-1]):255===e&&(L=r.readBits(16),I=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()){r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())}if(r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG()),r.readBool()){if(R=r.readBits(32),z=r.readBits(32),r.readBool()&&r.readUEG(),r.readBool()){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=a;n++){let n=r.readBool();M=n;let s=!0,o=1;n||(s=r.readBool());let a=!1;if(s?r.readUEG():a=r.readBool(),a||(o=r.readUEG()+1),e){for(let e=0;e>6&3,r.general_tier_flag=e[1]>>5&1,r.general_profile_idc=31&e[1],r.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],r.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],r.general_constraint_indicator_flags=r.general_constraint_indicator_flags<<16|e[10]<<8|e[11],r.general_level_idc=e[12],r.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],r.parallelismType=3&e[15],r.chromaFormat=3&e[16],r.bitDepthLumaMinus8=7&e[17],r.bitDepthChromaMinus8=7&e[18],r.avgFrameRate=e[19]<<8|e[20],r.constantFrameRate=e[21]>>6&3,r.numTemporalLayers=e[21]>>3&7,r.temporalIdNested=e[21]>>2&1,r.lengthSizeMinusOne=3&e[21];let i=e[22],n=e.slice(23);for(let e=0;e0)for(let t=r;t<8;t++)e.read(2);i.sub_layer_profile_space=[],i.sub_layer_tier_flag=[],i.sub_layer_profile_idc=[],i.sub_layer_profile_compatibility_flag=[],i.sub_layer_progressive_source_flag=[],i.sub_layer_interlaced_source_flag=[],i.sub_layer_non_packed_constraint_flag=[],i.sub_layer_frame_only_constraint_flag=[],i.sub_layer_level_idc=[];for(let t=0;t{let t=Or(e),r=new Gt(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}})(t),o=(e=>{let t=Or(e),r=new Gt(t);r.readByte(),r.readByte();let i=0,n=0,s=0,o=0;r.readBits(4);let a=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=a;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<16?(L=t[e-1],I=i[e-1]):255===e&&(L=r.readBits(16),I=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(i+=r.readUEG(),n+=r.readUEG(),s+=r.readUEG(),o+=r.readUEG()),r.readBool()&&(R=r.readBits(32),z=r.readBits(32),r.readBool()&&(r.readUEG(),r.readBool()))){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=a;n++){let n=r.readBool();M=n;let s=!1,o=1;n||(s=r.readBool());let a=!1;if(s?r.readSEG():a=r.readBool(),a||(cpbcnt=r.readUEG()+1),e)for(let e=0;e{let t=Or(e),r=new Gt(t);r.readByte(),r.readByte(),r.readUEG(),r.readUEG(),r.readBool(),r.readBool(),r.readBits(3),r.readBool(),r.readBool(),r.readUEG(),r.readUEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool()&&r.readUEG(),r.readSEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool(),r.readBool();let i=r.readBool(),n=r.readBool(),s=1;return n&&i?s=0:n?s=3:i&&(s=2),{parallelismType:s}})(r);n=Object.assign(n,s,o,a);let d=23+(5+t.byteLength)+(5+i.byteLength)+(5+r.byteLength),l=new Uint8Array(d);l[0]=1,l[1]=(3&n.general_profile_space)<<6|(n.general_tier_flag?1:0)<<5|31&n.general_profile_idc,l[2]=n.general_profile_compatibility_flags_1||0,l[3]=n.general_profile_compatibility_flags_2||0,l[4]=n.general_profile_compatibility_flags_3||0,l[5]=n.general_profile_compatibility_flags_4||0,l[6]=n.general_constraint_indicator_flags_1||0,l[7]=n.general_constraint_indicator_flags_2||0,l[8]=n.general_constraint_indicator_flags_3||0,l[9]=n.general_constraint_indicator_flags_4||0,l[10]=n.general_constraint_indicator_flags_5||0,l[11]=n.general_constraint_indicator_flags_6||0,l[12]=60,l[13]=240|(3840&n.min_spatial_segmentation_idc)>>8,l[14]=255&n.min_spatial_segmentation_idc,l[15]=252|3&n.parallelismType,l[16]=252|3&n.chroma_format_idc,l[17]=248|7&n.bit_depth_luma_minus8,l[18]=248|7&n.bit_depth_chroma_minus8,l[19]=0,l[20]=0,l[21]=(3&n.constant_frame_rate)<<6|(7&n.num_temporal_layers)<<3|(n.temporal_id_nested?1:0)<<2|3,l[22]=3,l[23]=128|st,l[24]=0,l[25]=1,l[26]=(65280&t.byteLength)>>8,l[27]=(255&t.byteLength)>>0,l.set(t,28),l[23+(5+t.byteLength)+0]=128|at,l[23+(5+t.byteLength)+1]=0,l[23+(5+t.byteLength)+2]=1,l[23+(5+t.byteLength)+3]=(65280&i.byteLength)>>8,l[23+(5+t.byteLength)+4]=(255&i.byteLength)>>0,l.set(i,23+(5+t.byteLength)+5),l[23+(5+t.byteLength+5+i.byteLength)+0]=128|lt,l[23+(5+t.byteLength+5+i.byteLength)+1]=0,l[23+(5+t.byteLength+5+i.byteLength)+2]=1,l[23+(5+t.byteLength+5+i.byteLength)+3]=(65280&r.byteLength)>>8,l[23+(5+t.byteLength+5+i.byteLength)+4]=(255&r.byteLength)>>0,l.set(r,23+(5+t.byteLength+5+i.byteLength)+5);const c=[28,0,0,0,0],u=new Uint8Array(c.length+l.byteLength);return u.set(c,0),u.set(l,c.length),u}function Yr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Kr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Xr(e){return(126&e[0])>>1}function Zr(e){return e===ut}function Jr(e){return!function(e){return e>=32&&e<=40}(e)}function Qr(e){return e>=16&&e<=21}function ei(e){if(0===e.length)return!1;const t=Xr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=e[r]>>1&63,n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class ri{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}function ii(e){return parseInt(e)===e}function ni(e){if(!ii(e.length))return!1;for(var t=0;t255)return!1;return!0}function si(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!ni(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(ii(e.length)&&ni(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function oi(e){return new Uint8Array(e)}function ai(e,t,r,i,n){null==i&&null==n||(e=e.slice?e.slice(i,n):Array.prototype.slice.call(e,i,n)),t.set(e,r)}var di,li={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},ci=(di="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r>4]+di[15&i])}return t.join("")}}),ui={16:10,24:12,32:14},hi=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],fi=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],pi=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],mi=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],_i=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],gi=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],yi=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],vi=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],bi=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],wi=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Si=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Ei=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Ai=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Ui=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],xi=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Bi(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=s[t],this._Kd[e-r][t%4]=s[t];for(var o,a=0,d=n;d>16&255]<<24^fi[o>>8&255]<<16^fi[255&o]<<8^fi[o>>24&255]^hi[a]<<24,a+=1,8!=n)for(t=1;t>8&255]<<8^fi[o>>16&255]<<16^fi[o>>24&255]<<24;for(t=n/2+1;t>2,c=d%4,this._Ke[l][c]=s[t],this._Kd[e-l][c]=s[t++],d++}for(var l=1;l>24&255]^Ai[o>>16&255]^Ui[o>>8&255]^xi[255&o]},ki.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=Bi(e),n=0;n<4;n++)i[n]^=this._Ke[0][n];for(var s=1;s>24&255]^_i[i[(n+1)%4]>>16&255]^gi[i[(n+2)%4]>>8&255]^yi[255&i[(n+3)%4]]^this._Ke[s][n];i=r.slice()}var o,a=oi(16);for(n=0;n<4;n++)o=this._Ke[t][n],a[4*n]=255&(fi[i[n]>>24&255]^o>>24),a[4*n+1]=255&(fi[i[(n+1)%4]>>16&255]^o>>16),a[4*n+2]=255&(fi[i[(n+2)%4]>>8&255]^o>>8),a[4*n+3]=255&(fi[255&i[(n+3)%4]]^o);return a},ki.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=Bi(e),n=0;n<4;n++)i[n]^=this._Kd[0][n];for(var s=1;s>24&255]^bi[i[(n+3)%4]>>16&255]^wi[i[(n+2)%4]>>8&255]^Si[255&i[(n+1)%4]]^this._Kd[s][n];i=r.slice()}var o,a=oi(16);for(n=0;n<4;n++)o=this._Kd[t][n],a[4*n]=255&(pi[i[n]>>24&255]^o>>24),a[4*n+1]=255&(pi[i[(n+3)%4]>>16&255]^o>>16),a[4*n+2]=255&(pi[i[(n+2)%4]>>8&255]^o>>8),a[4*n+3]=255&(pi[255&i[(n+1)%4]]^o);return a};var Ti=function(e){if(!(this instanceof Ti))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new ki(e)};Ti.prototype.encrypt=function(e){if((e=si(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=oi(e.length),r=oi(16),i=0;iNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},Fi.prototype.setBytes=function(e){if(16!=(e=si(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Fi.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var Li=function(e,t){if(!(this instanceof Li))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Fi||(t=new Fi(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new ki(e)};Li.prototype.encrypt=function(e){for(var t=si(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,i=0;i>>2]>>>24-s%4*8&255;t[i+s>>>2]|=o<<24-(i+s)%4*8}else for(var a=0;a>>2]=r[a>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-n%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new l.init(r,t/2)}},h=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new l.init(r,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=a.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,n=i.words,s=i.sigBytes,o=this.blockSize,a=s/(4*o),d=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,c=e.min(4*d,s);if(d){for(var u=0;u>>2]|=e[n]<<24-n%4*8;t.call(this,i,r)}else t.apply(this,arguments)};i.prototype=e}}(),r.lib.WordArray)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.WordArray,i=e.enc;function n(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var r=e.length,i=[],n=0;n>>1]|=e.charCodeAt(n)<<16-n%2*16;return t.create(i,2*r)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s>>2]>>>16-s%4*8&65535);i.push(String.fromCharCode(o))}return i.join("")},parse:function(e){for(var r=e.length,i=[],s=0;s>>1]|=n(e.charCodeAt(s)<<16-s%2*16);return t.create(i,2*r)}}}(),r.enc.Utf16)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.WordArray;function i(e,r,i){for(var n=[],s=0,o=0;o>>6-o%4*2;n[s>>>2]|=a<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var n=[],s=0;s>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,a=0;a<4&&s+.75*a>>6*(3-a)&63));var d=i.charAt(64);if(d)for(;n.length%4;)n.push(d);return n.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var s=0;s>>6-o%4*2;n[s>>>2]|=a<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,n=t?this._safe_map:this._map;e.clamp();for(var s=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(r[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|r[o+2>>>2]>>>24-(o+2)%4*8&255,d=0;d<4&&o+.75*d>>6*(3-d)&63));var l=n.charAt(64);if(l)for(;s.length%4;)s.push(l);return s.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,n=t?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var o=0;o>>24)|4278255360&(n<<24|n>>>8)}var s=this._hash.words,o=e[t+0],d=e[t+1],f=e[t+2],p=e[t+3],m=e[t+4],_=e[t+5],g=e[t+6],y=e[t+7],v=e[t+8],b=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],A=e[t+13],U=e[t+14],x=e[t+15],B=s[0],k=s[1],T=s[2],C=s[3];B=l(B,k,T,C,o,7,a[0]),C=l(C,B,k,T,d,12,a[1]),T=l(T,C,B,k,f,17,a[2]),k=l(k,T,C,B,p,22,a[3]),B=l(B,k,T,C,m,7,a[4]),C=l(C,B,k,T,_,12,a[5]),T=l(T,C,B,k,g,17,a[6]),k=l(k,T,C,B,y,22,a[7]),B=l(B,k,T,C,v,7,a[8]),C=l(C,B,k,T,b,12,a[9]),T=l(T,C,B,k,w,17,a[10]),k=l(k,T,C,B,S,22,a[11]),B=l(B,k,T,C,E,7,a[12]),C=l(C,B,k,T,A,12,a[13]),T=l(T,C,B,k,U,17,a[14]),B=c(B,k=l(k,T,C,B,x,22,a[15]),T,C,d,5,a[16]),C=c(C,B,k,T,g,9,a[17]),T=c(T,C,B,k,S,14,a[18]),k=c(k,T,C,B,o,20,a[19]),B=c(B,k,T,C,_,5,a[20]),C=c(C,B,k,T,w,9,a[21]),T=c(T,C,B,k,x,14,a[22]),k=c(k,T,C,B,m,20,a[23]),B=c(B,k,T,C,b,5,a[24]),C=c(C,B,k,T,U,9,a[25]),T=c(T,C,B,k,p,14,a[26]),k=c(k,T,C,B,v,20,a[27]),B=c(B,k,T,C,A,5,a[28]),C=c(C,B,k,T,f,9,a[29]),T=c(T,C,B,k,y,14,a[30]),B=u(B,k=c(k,T,C,B,E,20,a[31]),T,C,_,4,a[32]),C=u(C,B,k,T,v,11,a[33]),T=u(T,C,B,k,S,16,a[34]),k=u(k,T,C,B,U,23,a[35]),B=u(B,k,T,C,d,4,a[36]),C=u(C,B,k,T,m,11,a[37]),T=u(T,C,B,k,y,16,a[38]),k=u(k,T,C,B,w,23,a[39]),B=u(B,k,T,C,A,4,a[40]),C=u(C,B,k,T,o,11,a[41]),T=u(T,C,B,k,p,16,a[42]),k=u(k,T,C,B,g,23,a[43]),B=u(B,k,T,C,b,4,a[44]),C=u(C,B,k,T,E,11,a[45]),T=u(T,C,B,k,x,16,a[46]),B=h(B,k=u(k,T,C,B,f,23,a[47]),T,C,o,6,a[48]),C=h(C,B,k,T,y,10,a[49]),T=h(T,C,B,k,U,15,a[50]),k=h(k,T,C,B,_,21,a[51]),B=h(B,k,T,C,E,6,a[52]),C=h(C,B,k,T,p,10,a[53]),T=h(T,C,B,k,w,15,a[54]),k=h(k,T,C,B,d,21,a[55]),B=h(B,k,T,C,v,6,a[56]),C=h(C,B,k,T,x,10,a[57]),T=h(T,C,B,k,g,15,a[58]),k=h(k,T,C,B,A,21,a[59]),B=h(B,k,T,C,m,6,a[60]),C=h(C,B,k,T,S,10,a[61]),T=h(T,C,B,k,f,15,a[62]),k=h(k,T,C,B,b,21,a[63]),s[0]=s[0]+B|0,s[1]=s[1]+k|0,s[2]=s[2]+T|0,s[3]=s[3]+C|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;r[n>>>5]|=128<<24-n%32;var s=e.floor(i/4294967296),o=i;r[15+(n+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(n+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,d=a.words,l=0;l<4;l++){var c=d[l];d[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return a},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,i,n,s,o){var a=e+(t&r|~t&i)+n+o;return(a<>>32-s)+t}function c(e,t,r,i,n,s,o){var a=e+(t&i|r&~i)+n+o;return(a<>>32-s)+t}function u(e,t,r,i,n,s,o){var a=e+(t^r^i)+n+o;return(a<>>32-s)+t}function h(e,t,r,i,n,s,o){var a=e+(r^(t|~i))+n+o;return(a<>>32-s)+t}t.MD5=s._createHelper(d),t.HmacMD5=s._createHmacHelper(d)}(Math),r.MD5)})),Ot((function(e,t){var r,i,n,s,o,a,d,l;e.exports=(i=(r=l=Mi).lib,n=i.WordArray,s=i.Hasher,o=r.algo,a=[],d=o.SHA1=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],d=r[4],l=0;l<80;l++){if(l<16)a[l]=0|e[t+l];else{var c=a[l-3]^a[l-8]^a[l-14]^a[l-16];a[l]=c<<1|c>>>31}var u=(i<<5|i>>>27)+d+a[l];u+=l<20?1518500249+(n&s|~n&o):l<40?1859775393+(n^s^o):l<60?(n&s|n&o|s&o)-1894007588:(n^s^o)-899497514,d=o,o=s,s=n<<30|n>>>2,n=i,i=u}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+d|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=s._createHelper(d),r.HmacSHA1=s._createHmacHelper(d),l.SHA1)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,o=t.algo,a=[],d=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,n=0;n<64;)t(i)&&(n<8&&(a[n]=r(e.pow(i,.5))),d[n]=r(e.pow(i,1/3)),n++),i++}();var l=[],c=o.SHA256=s.extend({_doReset:function(){this._hash=new n.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],a=r[4],c=r[5],u=r[6],h=r[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,_=l[f-2],g=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;l[f]=m+l[f-7]+g+l[f-16]}var y=i&n^i&s^n&s,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&c^~a&u)+d[f]+l[f];h=u,u=c,c=a,a=o+b|0,o=s,s=n,n=i,i=b+(v+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+a|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=s._createHelper(c),t.HmacSHA256=s._createHmacHelper(c)}(Math),r.SHA256)})),Ot((function(e,t){var r,i,n,s,o,a;e.exports=(i=(r=a=Mi).lib.WordArray,n=r.algo,s=n.SHA256,o=n.SHA224=s.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=s._createHelper(o),r.HmacSHA224=s._createHmacHelper(o),a.SHA224)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.Hasher,i=e.x64,n=i.Word,s=i.WordArray,o=e.algo;function a(){return n.create.apply(n,arguments)}var d=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=a()}();var c=o.SHA512=t.extend({_doReset:function(){this._hash=new s.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],a=r[4],c=r[5],u=r[6],h=r[7],f=i.high,p=i.low,m=n.high,_=n.low,g=s.high,y=s.low,v=o.high,b=o.low,w=a.high,S=a.low,E=c.high,A=c.low,U=u.high,x=u.low,B=h.high,k=h.low,T=f,C=p,D=m,P=_,F=g,L=y,I=v,M=b,R=w,z=S,N=E,$=A,O=U,G=x,H=B,W=k,V=0;V<80;V++){var j,q,Y=l[V];if(V<16)q=Y.high=0|e[t+2*V],j=Y.low=0|e[t+2*V+1];else{var K=l[V-15],X=K.high,Z=K.low,J=(X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7,Q=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),ee=l[V-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ne=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),se=l[V-7],oe=se.high,ae=se.low,de=l[V-16],le=de.high,ce=de.low;q=(q=(q=J+oe+((j=Q+ae)>>>0>>0?1:0))+ie+((j+=ne)>>>0>>0?1:0))+le+((j+=ce)>>>0>>0?1:0),Y.high=q,Y.low=j}var ue,he=R&N^~R&O,fe=z&$^~z&G,pe=T&D^T&F^D&F,me=C&P^C&L^P&L,_e=(T>>>28|C<<4)^(T<<30|C>>>2)^(T<<25|C>>>7),ge=(C>>>28|T<<4)^(C<<30|T>>>2)^(C<<25|T>>>7),ye=(R>>>14|z<<18)^(R>>>18|z<<14)^(R<<23|z>>>9),ve=(z>>>14|R<<18)^(z>>>18|R<<14)^(z<<23|R>>>9),be=d[V],we=be.high,Se=be.low,Ee=H+ye+((ue=W+ve)>>>0>>0?1:0),Ae=ge+me;H=O,W=G,O=N,G=$,N=R,$=z,R=I+(Ee=(Ee=(Ee=Ee+he+((ue+=fe)>>>0>>0?1:0))+we+((ue+=Se)>>>0>>0?1:0))+q+((ue+=j)>>>0>>0?1:0))+((z=M+ue|0)>>>0>>0?1:0)|0,I=F,M=L,F=D,L=P,D=T,P=C,T=Ee+(_e+pe+(Ae>>>0>>0?1:0))+((C=ue+Ae|0)>>>0>>0?1:0)|0}p=i.low=p+C,i.high=f+T+(p>>>0>>0?1:0),_=n.low=_+P,n.high=m+D+(_>>>0

>>0?1:0),y=s.low=y+L,s.high=g+F+(y>>>0>>0?1:0),b=o.low=b+M,o.high=v+I+(b>>>0>>0?1:0),S=a.low=S+z,a.high=w+R+(S>>>0>>0?1:0),A=c.low=A+$,c.high=E+N+(A>>>0<$>>>0?1:0),x=u.low=x+G,u.high=U+O+(x>>>0>>0?1:0),k=h.low=k+W,h.high=B+H+(k>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(c),e.HmacSHA512=t._createHmacHelper(c)}(),r.SHA512)})),Ot((function(e,t){var r,i,n,s,o,a,d,l;e.exports=(i=(r=l=Mi).x64,n=i.Word,s=i.WordArray,o=r.algo,a=o.SHA512,d=o.SHA384=a.extend({_doReset:function(){this._hash=new s.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=a._createHelper(d),r.HmacSHA384=a._createHmacHelper(d),l.SHA384)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,o=t.x64.Word,a=t.algo,d=[],l=[],c=[];!function(){for(var e=1,t=0,r=0;r<24;r++){d[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var n=1,s=0;s<24;s++){for(var a=0,u=0,h=0;h<7;h++){if(1&n){var f=(1<>>24)|4278255360&(s<<24|s>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(k=r[n]).high^=o,k.low^=s}for(var a=0;a<24;a++){for(var h=0;h<5;h++){for(var f=0,p=0,m=0;m<5;m++)f^=(k=r[h+5*m]).high,p^=k.low;var _=u[h];_.high=f,_.low=p}for(h=0;h<5;h++){var g=u[(h+4)%5],y=u[(h+1)%5],v=y.high,b=y.low;for(f=g.high^(v<<1|b>>>31),p=g.low^(b<<1|v>>>31),m=0;m<5;m++)(k=r[h+5*m]).high^=f,k.low^=p}for(var w=1;w<25;w++){var S=(k=r[w]).high,E=k.low,A=d[w];A<32?(f=S<>>32-A,p=E<>>32-A):(f=E<>>64-A,p=S<>>64-A);var U=u[l[w]];U.high=f,U.low=p}var x=u[0],B=r[0];for(x.high=B.high,x.low=B.low,h=0;h<5;h++)for(m=0;m<5;m++){var k=r[w=h+5*m],T=u[w],C=u[(h+1)%5+5*m],D=u[(h+2)%5+5*m];k.high=T.high^~C.high&D.high,k.low=T.low^~C.low&D.low}k=r[0];var P=c[a];k.high^=P.high,k.low^=P.low}},_doFinalize:function(){var t=this._data,r=t.words;this._nDataBytes;var i=8*t.sigBytes,s=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/s)*s>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var o=this._state,a=this.cfg.outputLength/8,d=a/8,l=[],c=0;c>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(h)}return new n.init(l,a)},clone:function(){for(var e=s.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=s._createHelper(h),t.HmacSHA3=s._createHmacHelper(h)}(Math),r.SHA3)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,o=t.algo,a=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=n.create([0,1518500249,1859775393,2400959708,2840853838]),h=n.create([1352829926,1548603684,1836072691,2053994217,0]),f=o.RIPEMD160=s.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s,o,f,b,w,S,E,A,U,x,B,k=this._hash.words,T=u.words,C=h.words,D=a.words,P=d.words,F=l.words,L=c.words;for(S=s=k[0],E=o=k[1],A=f=k[2],U=b=k[3],x=w=k[4],r=0;r<80;r+=1)B=s+e[t+D[r]]|0,B+=r<16?p(o,f,b)+T[0]:r<32?m(o,f,b)+T[1]:r<48?_(o,f,b)+T[2]:r<64?g(o,f,b)+T[3]:y(o,f,b)+T[4],B=(B=v(B|=0,F[r]))+w|0,s=w,w=b,b=v(f,10),f=o,o=B,B=S+e[t+P[r]]|0,B+=r<16?y(E,A,U)+C[0]:r<32?g(E,A,U)+C[1]:r<48?_(E,A,U)+C[2]:r<64?m(E,A,U)+C[3]:p(E,A,U)+C[4],B=(B=v(B|=0,L[r]))+x|0,S=x,x=U,U=v(A,10),A=E,E=B;B=k[1]+f+U|0,k[1]=k[2]+b+x|0,k[2]=k[3]+w+S|0,k[3]=k[4]+s+E|0,k[4]=k[0]+o+A|0,k[0]=B},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var n=this._hash,s=n.words,o=0;o<5;o++){var a=s[o];s[o]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return n},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function m(e,t,r){return e&t|~e&r}function _(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function v(e,t){return e<>>32-t}t.RIPEMD160=s._createHelper(f),t.HmacRIPEMD160=s._createHmacHelper(f)}(),r.RIPEMD160)})),Ot((function(e,t){var r,i,n;e.exports=(i=(r=Mi).lib.Base,n=r.enc.Utf8,void(r.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),o=this._iKey=t.clone(),a=s.words,d=o.words,l=0;l>>2];e.sigBytes-=t}};i.BlockCipher=c.extend({cfg:c.cfg.extend({mode:f,padding:p}),reset:function(){var e;c.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=i.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?s.create([1398893684,1701076831]).concat(r).concat(t):t).toString(d)},parse:function(e){var t,r=d.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=s.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),m.create({ciphertext:r,salt:t})}},g=i.SerializableCipher=n.extend({cfg:n.extend({format:_}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),s=n.finalize(t),o=n.cfg;return m.create({ciphertext:s,key:r,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,i,n){if(i||(i=s.random(8)),n)o=l.create({keySize:t+r,hasher:n}).compute(e,i);else var o=l.create({keySize:t+r}).compute(e,i);var a=s.create(o.words.slice(t),4*r);return o.sigBytes=4*t,m.create({key:o,iv:a,salt:i})}},v=i.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=n.iv;var s=g.encrypt.call(this,e,t,n.key,i);return s.mixIn(n),s},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=n.iv,g.decrypt.call(this,e,t,n.key,i)}})}())})),Ot((function(e,t){var r;e.exports=((r=Mi).mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,i){var n,s=this._iv;s?(n=s.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var o=0;o>24&255)){var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}else e+=1<<24;return e}function i(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var n=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,s=this._iv,o=this._counter;s&&(o=this._counter=s.slice(0),this._iv=void 0),i(o);var a=o.slice(0);r.encryptBlock(a,0);for(var d=0;d>>2]|=n<<24-s%4*8,e.sigBytes+=n},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),Ot((function(e,t){var r;e.exports=((r=Mi).pad.Iso10126={pad:function(e,t){var i=4*t,n=i-e.sigBytes%i;e.concat(r.lib.WordArray.random(n-1)).concat(r.lib.WordArray.create([n<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),Ot((function(e,t){var r;e.exports=((r=Mi).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),Ot((function(e,t){var r;e.exports=((r=Mi).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)})),Ot((function(e,t){var r;e.exports=((r=Mi).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib.CipherParams,n=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return i.create({ciphertext:t})}}}(),r.format.Hex)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.BlockCipher,i=e.algo,n=[],s=[],o=[],a=[],d=[],l=[],c=[],u=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,n[r]=p,s[p]=r;var m=e[r],_=e[m],g=e[_],y=257*e[p]^16843008*p;o[r]=y<<24|y>>>8,a[r]=y<<16|y>>>16,d[r]=y<<8|y>>>24,l[r]=y,y=16843009*g^65537*_^257*m^16843008*r,c[p]=y<<24|y>>>8,u[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,r?(r=m^e[e[e[g^m]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=i.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),s=this._keySchedule=[],o=0;o6&&o%r==4&&(l=n[l>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l]):(l=n[(l=l<<8|l>>>24)>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l],l^=p[o/r|0]<<24),s[o]=s[o-r]^l);for(var a=this._invKeySchedule=[],d=0;d>>24]]^u[n[l>>>16&255]]^h[n[l>>>8&255]]^f[n[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,a,d,l,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,c,u,h,f,s),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,s,o,a){for(var d=this._nRounds,l=e[t]^r[0],c=e[t+1]^r[1],u=e[t+2]^r[2],h=e[t+3]^r[3],f=4,p=1;p>>24]^n[c>>>16&255]^s[u>>>8&255]^o[255&h]^r[f++],_=i[c>>>24]^n[u>>>16&255]^s[h>>>8&255]^o[255&l]^r[f++],g=i[u>>>24]^n[h>>>16&255]^s[l>>>8&255]^o[255&c]^r[f++],y=i[h>>>24]^n[l>>>16&255]^s[c>>>8&255]^o[255&u]^r[f++];l=m,c=_,u=g,h=y}m=(a[l>>>24]<<24|a[c>>>16&255]<<16|a[u>>>8&255]<<8|a[255&h])^r[f++],_=(a[c>>>24]<<24|a[u>>>16&255]<<16|a[h>>>8&255]<<8|a[255&l])^r[f++],g=(a[u>>>24]<<24|a[h>>>16&255]<<16|a[l>>>8&255]<<8|a[255&c])^r[f++],y=(a[h>>>24]<<24|a[l>>>16&255]<<16|a[c>>>8&255]<<8|a[255&u])^r[f++],e[t]=m,e[t+1]=_,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(m)}(),r.AES)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib,i=t.WordArray,n=t.BlockCipher,s=e.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=s.DES=n.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=o[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],s=0;s<16;s++){var l=n[s]=[],c=d[s];for(r=0;r<24;r++)l[r/6|0]|=t[(a[r]-1+c)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(a[r+24]-1+c)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var u=this._invSubKeys=[];for(r=0;r<16;r++)u[r]=n[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],s=this._lBlock,o=this._rBlock,a=0,d=0;d<8;d++)a|=l[d][((o^n[d])&c[d])>>>0];this._lBlock=o,this._rBlock=s^a}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),n=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(i.create(t)),this._des2=u.createEncryptor(i.create(r)),this._des3=u.createEncryptor(i.create(n))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=n._createHelper(p)}(),r.TripleDES)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=i.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var s=0;n<256;n++){var o=n%r,a=t[o>>>2]>>>24-o%4*8&255;s=(s+i[n]+a)%256;var d=i[n];i[n]=i[s],i[s]=d}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var e=this._S,t=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[r],e[r]=s,i|=e[(e[t]+e[r])%256]<<24-8*n}return this._i=t,this._j=r,i}e.RC4=t._createHelper(n);var o=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)s.call(this)}});e.RC4Drop=t._createHelper(o)}(),r.RC4)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],o=[],a=i.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)d.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(t){var s=t.words,o=s[0],a=s[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(n[0]^=l,n[1]^=u,n[2]^=c,n[3]^=h,n[4]^=l,n[5]^=u,n[6]^=c,n[7]^=h,r=0;r<4;r++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,a=i>>>16,d=((n*n>>>17)+n*a>>>15)+a*a,l=((4294901760&i)*i|0)+((65535&i)*i|0);o[r]=d^l}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=t._createHelper(a)}(),r.Rabbit)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],o=[],a=i.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var n=0;n<4;n++)d.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var s=t.words,o=s[0],a=s[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(i[0]^=l,i[1]^=u,i[2]^=c,i[3]^=h,i[4]^=l,i[5]^=u,i[6]^=c,i[7]^=h,n=0;n<4;n++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,a=i>>>16,d=((n*n>>>17)+n*a>>>15)+a*a,l=((4294901760&i)*i|0)+((65535&i)*i|0);o[r]=d^l}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=t._createHelper(a)}(),r.RabbitLegacy)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.BlockCipher,i=e.algo;const n=16,s=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],o=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var a={pbox:[],sbox:[]};function d(e,t){let r=t>>24&255,i=t>>16&255,n=t>>8&255,s=255&t,o=e.sbox[0][r]+e.sbox[1][i];return o^=e.sbox[2][n],o+=e.sbox[3][s],o}function l(e,t,r){let i,s=t,o=r;for(let t=0;t1;--t)s^=e.pbox[t],o=d(e,s)^o,i=s,s=o,o=i;return i=s,s=o,o=i,o^=e.pbox[1],s^=e.pbox[0],{left:s,right:o}}function u(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=o[t][r]}let i=0;for(let o=0;o=r&&(i=0);let a=0,d=0,c=0;for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),r=new Uint8Array(r);const n=e.byteLength;let s=5;for(;sn)break;let a=e[s+4],d=!1;if(i?(a=a>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(a)):(a&=31,d=1===a||5===a),d){const i=e.slice(s+4+2,s+4+o);let n=new Ii.ModeOfOperation.ctr(t,new Ii.Counter(r));const a=n.decrypt(i);n=null,e.set(a,s+4+2)}s=s+4+o}return e}function Ni(e,t,r){if(e.byteLength<=30)return e;const i=e.slice(32);let n=new Ii.ModeOfOperation.ctr(t,new Ii.Counter(r));const s=n.decrypt(i);return n=null,e.set(s,32),e}Ot((function(e,t){e.exports=Mi}));var $i=Ot((function(e,t){var r,n,s,o=(r=new Date,n=4,s={setLogLevel:function(e){n=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=n&&console.debug("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=n&&console.info("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=n&&console.warn("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=n&&console.error("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}},s);o.getDurationString=function(e,t){var r;function i(e,t){for(var r=(""+e).split(".");r[0].length0){for(var r="",i=0;i0&&(r+=","),r+="["+o.getDurationString(e.start(i))+","+o.getDurationString(e.end(i))+"]";return r}return"(empty)"},t.Log=o;var a=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};a.prototype.getPosition=function(){return this.position},a.prototype.getEndPosition=function(){return this.buffer.byteLength},a.prototype.getLength=function(){return this.buffer.byteLength},a.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},a.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},a.prototype.readAnyInt=function(e,t){var r=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:r=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:r=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";r=this.dataview.getUint8(this.position)<<16,r|=this.dataview.getUint8(this.position+1)<<8,r|=this.dataview.getUint8(this.position+2);break;case 4:r=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";r=this.dataview.getUint32(this.position)<<32,r|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,r}throw"Not enough bytes in buffer"},a.prototype.readUint8=function(){return this.readAnyInt(1,!1)},a.prototype.readUint16=function(){return this.readAnyInt(2,!1)},a.prototype.readUint24=function(){return this.readAnyInt(3,!1)},a.prototype.readUint32=function(){return this.readAnyInt(4,!1)},a.prototype.readUint64=function(){return this.readAnyInt(8,!1)},a.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",r=0;rthis._byteLength&&(this._byteLength=t);else{for(r<1&&(r=1);t>r;)r*=2;var i=new ArrayBuffer(r),n=new Uint8Array(this._buffer);new Uint8Array(i,0,n.length).set(n),this.buffer=i,this._byteLength=t}}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),r=new Uint8Array(this._buffer,0,t.length);t.set(r),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Int32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Int16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Uint32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Uint16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var r=new Float64Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Float32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,r,i,n){var s=new Uint8Array(e,t,n),o=new Uint8Array(r,i,n);s.set(o)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=0;rn;i--,n++){var s=t[n];t[n]=t[i],t[i]=s}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],r=0;r>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},d.prototype.adjustUint32=function(e,t){var r=this.position;this.seek(e),this.writeUint32(t),this.seek(r)},d.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var r=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var r=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var r=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var r=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var r=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=8*e,r},d.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var r=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r};var c=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(c.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,o.debug("MultiBufferStream","Stream ready for parsing"),!0):(o.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(o.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){o.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r.buffer},c.prototype.reduceBuffer=function(e,t,r){var i;return(i=new Uint8Array(r)).set(new Uint8Array(e,t,r)),i.buffer.fileStart=e.fileStart+t,i.buffer.usedBytes=0,i.buffer},c.prototype.insertBuffer=function(e){for(var t=!0,r=0;ri.byteLength){this.buffers.splice(r,1),r--;continue}o.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=i.fileStart||(e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)),o.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(r,0,e),0===r&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,n,s)}}t&&(o.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===r&&(this.buffer=e))},c.prototype.logBufferLevel=function(e){var t,r,i,n,s,a=[],d="";for(i=0,n=0,t=0;t0&&(d+=s.end-1+"]");var l=e?o.info:o.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+i+"/"+n+" bytes), continuous ranges: "+d)},c.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},c.prototype.findPosition=function(e,t,r){var i,n=null,s=-1;for(i=!0===e?0:this.bufferIndex;i=t?(o.debug("MultiBufferStream","Found position in existing buffer #"+s),s):-1},c.prototype.findEndContiguousBuf=function(e){var t,r,i,n=void 0!==e?e:this.bufferIndex;if(r=this.buffers[n],this.buffers.length>n+1)for(t=n+1;t>3;return 31===i&&r.data.length>=2&&(i=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),i}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};t.MPEG4DescriptorParser=u;var h={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){h.FullBox.prototype=new h.Box,h.ContainerBox.prototype=new h.Box,h.SampleEntry.prototype=new h.Box,h.TrackGroupTypeBox.prototype=new h.FullBox,h.BASIC_BOXES.forEach((function(e){h.createBoxCtor(e)})),h.FULL_BOXES.forEach((function(e){h.createFullBoxCtor(e)})),h.CONTAINER_BOXES.forEach((function(e){h.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,r){this.type=e,this.size=t,this.uuid=r},FullBox:function(e,t,r){h.Box.call(this,e,t,r),this.flags=0,this.version=0},ContainerBox:function(e,t,r){h.Box.call(this,e,t,r),this.boxes=[]},SampleEntry:function(e,t,r,i){h.ContainerBox.call(this,e,t),this.hdr_size=r,this.start=i},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){h.FullBox.call(this,e,t)},createBoxCtor:function(e,t){h.boxCodes.push(e),h[e+"Box"]=function(t){h.Box.call(this,e,t)},h[e+"Box"].prototype=new h.Box,t&&(h[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){h[e+"Box"]=function(t){h.FullBox.call(this,e,t)},h[e+"Box"].prototype=new h.FullBox,h[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,r=0;rr?(o.error("BoxParser","Box of type '"+c+"' has a size "+l+" greater than its container size "+r),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:a}):0!==l&&a+l>e.getEndPosition()?(e.seek(a),o.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:a}):t?{code:h.OK,type:c,size:l,hdr_size:d,start:a}:(h[c+"Box"]?i=new h[c+"Box"](l):"uuid"!==c?(o.warn("BoxParser","Unknown box type: '"+c+"'"),(i=new h.Box(c,l)).has_unparsed_data=!0):h.UUIDBoxes[s]?i=new h.UUIDBoxes[s](l):(o.warn("BoxParser","Unknown uuid type: '"+s+"'"),(i=new h.Box(c,l)).uuid=s,i.has_unparsed_data=!0),i.hdr_size=d,i.start=a,i.write===h.Box.prototype.write&&"mdat"!==i.type&&(o.info("BoxParser","'"+u+"' box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),(n=e.getPosition()-(i.start+i.size))<0?(o.warn("BoxParser","Parsing of box '"+u+"' did not read the entire indicated box data size (missing "+-n+" bytes), seeking forward"),e.seek(i.start+i.size)):n>0&&(o.error("BoxParser","Parsing of box '"+u+"' read "+n+" more bytes than the indicated box data size, seeking backwards"),0!==i.size&&e.seek(i.start+i.size)),{code:h.OK,box:i,size:i.size})},h.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},h.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},h.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.ContainerBox.prototype.parse=function(e){for(var t,r;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},h.SAMPLE_ENTRY_TYPE_VISUAL="Visual",h.SAMPLE_ENTRY_TYPE_AUDIO="Audio",h.SAMPLE_ENTRY_TYPE_HINT="Hint",h.SAMPLE_ENTRY_TYPE_METADATA="Metadata",h.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",h.SAMPLE_ENTRY_TYPE_SYSTEM="System",h.SAMPLE_ENTRY_TYPE_TEXT="Text",h.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},h.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},h.SampleEntry.prototype.parseFooter=function(e){h.ContainerBox.prototype.parse.call(this,e)},h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_HINT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT,"enct"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA,"encm"),h.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var r=0;r<3;r++)this.layer_size[r]=16==t?e.readUint16():e.readUint32()})),h.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),h.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),h.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)o.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void o.error("av1C reserved_2 parsing problem");var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)}else o.error("av1C reserved_1 parsing problem");else o.error("av1C version "+this.version+" not supported")})),h.createBoxCtor("avcC",(function(e){var t,r;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),r=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(r))})),h.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),h.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),h.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),h.createFullBoxCtor("co64",(function(e){var t,r;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(r=0;r>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),h.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),h.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),h.createFullBoxCtor("ctts",(function(e){var t,r;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(r=0;r>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|r>>6&3,this.acmod=r>>3&7,this.lfeon=r>>2&1,this.bit_rate_code=3&r|i>>5&7})),h.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var r=0;r>6,i.bsid=n>>1&31,i.bsmod=(1&n)<<4|s>>4&15,i.acmod=s>>1&7,i.lfeon=1&s,i.num_dep_sub=o>>1&15,i.num_dep_sub>0&&(i.chan_loc=(1&o)<<8|e.readUint8())}})),h.createFullBoxCtor("dfLa",(function(e){var t=[],r=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var i=e.readUint8(),n=Math.min(127&i,r.length-1);if(n?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(r[n]),128&i)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),h.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[r]=e.readString(4),t-=4,r++})),h.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),h.createBoxCtor("hvcC",(function(e){var t,r,i,n;this.configurationVersion=e.readUint8(),n=e.readUint8(),this.general_profile_space=n>>6,this.general_tier_flag=(32&n)>>5,this.general_profile_idc=31&n,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),n=e.readUint8(),this.constantFrameRate=n>>6,this.numTemporalLayers=(13&n)>>3,this.temporalIdNested=(4&n)>>2,this.lengthSizeMinusOne=3&n,this.nalu_arrays=[];var s=e.readUint8();for(t=0;t>7,o.nalu_type=63&n;var a=e.readUint16();for(r=0;r>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var r=0;if(this.version<2)r=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";r=e.readUint32()}for(var i=0;i>7,this.axis=1&t})),h.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),o.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),h.createFullBoxCtor("ipma",(function(e){var t,r;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?o.property_index=(127&s)<<8|e.readUint8():o.property_index=127&s}}})),h.createFullBoxCtor("iref",(function(e){var t,r;for(this.references=[];e.getPosition()>7,i.assignment_type=127&n,i.assignment_type){case 0:i.grouping_type=e.readString(4);break;case 1:i.grouping_type=e.readString(4),i.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:i.sub_track_id=e.readUint32();break;default:o.warn("BoxParser","Unknown leva assignement type")}}})),h.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),h.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),f.prototype.toString=function(){return"("+this.x+","+this.y+")"},h.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new f(e.readUint16(),e.readUint16()),this.display_primaries[1]=new f(e.readUint16(),e.readUint16()),this.display_primaries[2]=new f(e.readUint16(),e.readUint16()),this.white_point=new f(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),h.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),h.createFullBoxCtor("mehd",(function(e){1&this.flags&&(o.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),h.createFullBoxCtor("meta",(function(e){this.boxes=[],h.ContainerBox.prototype.parse.call(this,e)})),h.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),h.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),h.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),h.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),h.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),h.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),h.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var r=0;r0){var t=e.readUint32();this.kid=[];for(var r=0;r0&&(this.data=e.readUint8Array(i))})),h.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),h.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),h.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var r=0;r>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var r=e.readUint8(),i=0;i>7,this.num_leading_samples=127&t})),h.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)o.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=h.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),h.createSampleGroupCtor("stsa",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),h.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),h.createSampleGroupCtor("tsas",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("tscl",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("vipr",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),r=0;r>6,this.sample_depends_on[i]=t>>4&3,this.sample_is_depended_on[i]=t>>2&3,this.sample_has_redundancy[i]=3&t})),h.createFullBoxCtor("senc"),h.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),o.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),r=0;r>31&1,i.referenced_size=2147483647&n,i.subsegment_duration=e.readUint32(),n=e.readUint32(),i.starts_with_SAP=n>>31&1,i.SAP_type=n>>28&7,i.SAP_delta_time=268435455&n}})),h.SingleItemTypeReferenceBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.SingleItemTypeReferenceBox.prototype=new h.Box,h.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var r=0;r>4&15,this.sample_sizes[t+1]=15&i}else if(8===this.field_size)for(t=0;t0)for(r=0;r>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=h.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),h.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),h.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),h.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var r=e.readUint32(),i=0;i>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),h.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),h.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),h.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},h.createTrackGroupCtor("msrc"),h.TrackReferenceTypeBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.TrackReferenceTypeBox.prototype=new h.Box,h.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},h.trefBox.prototype.parse=function(e){for(var t,r;e.getPosition()t&&this.flags&h.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var r=0;r>7&1,this.block_pad_lsb=r>>6&1,this.block_little_endian=r>>5&1,this.block_reversed=r>>4&1,this.pad_unknown=r>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),h.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),h.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),h.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),h.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=h.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),h.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),h.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=h.parseHex16(e)})),h.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),h.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),h.createFullBoxCtor("vvcC",(function(e){var t,r,i={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(i.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,r=this.num_sublayers-2;r>=0;--r){var o=i.extract_bits(1);this.ptl_sublayer_present_mask|=o<1;++r)i.extract_bits(1);for(this.sublayer_level_idc=[],r=this.num_sublayers-2;r>=0;--r)this.ptl_sublayer_present_mask&1<>=1;t+=h.decimalToHex(i,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var n=!1,s="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||n)&&(s="."+h.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+s,n=!0);t+=s}return t},h.vvc1SampleEntry.prototype.getCodec=h.vvi1SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var r="";if(this.vvcC.general_constraint_info){var i,n=[],s=0;for(s|=this.vvcC.ptl_frame_only_constraint<<7,s|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,n.push(s),s&&(i=e),s=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===i)r=".CA";else{r=".C";var o="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",a=0,d=0;for(e=0;e<=i;++e)for(a=a<<8|n[e],d+=8;d>=5;){r+=o[a>>d-5&31],a&=(1<<(d-=5))-1}d&&(r+=o[31&(a<<=5-d)])}}t+=r}return t},h.mp4aSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),r=this.esds.esd.getAudioConfig();return e+"."+h.decimalToHex(t)+(r?"."+r:"")}return e},h.stxtSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},h.vp08SampleEntry.prototype.getCodec=h.vp09SampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var r=this.vpcC.bitDepth;return 8==r&&(r="08"),e+".0"+this.vpcC.profile+"."+t+"."+r},h.av01SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this),r=this.av1C.seq_level_idx_0;return r<10&&(r="0"+r),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+r+(this.av1C.seq_tier_0?"H":"M")+"."+e},h.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),o.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>l?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>l&&e.writeUint64(this.size)},h.FullBox.prototype.writeHeader=function(e){this.size+=4,h.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},h.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},h.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},h.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},h.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},h.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},h.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&h.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&h.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&h.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&h.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[r]instanceof h.Box||t[r]instanceof h.Box||void 0===e[r]||void 0===t[r]||"function"==typeof e[r]||"function"==typeof t[r]||e.subBoxNames&&e.subBoxNames.indexOf(r.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(r.slice(0,4))>-1||"data"===r||"start"===r||"size"===r||"creation_time"===r||"modification_time"===r||h.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(r)>-1||e[r]===t[r]))return!1;return!0},h.boxEqual=function(e,t){if(!h.boxEqualFields(e,t))return!1;for(var r=0;r1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},g.prototype.setExtractionOptions=function(e,t,r){var i=this.getTrackById(e);if(i){var n={};this.extractedTracks.push(n),n.id=e,n.user=t,n.trak=i,i.nextSample=0,n.nb_samples=1e3,n.samples=[],r&&r.nbSamples&&(n.nb_samples=r.nbSamples)}},g.prototype.unsetExtractionOptions=function(e){for(var t=-1,r=0;r-1&&this.extractedTracks.splice(t,1)},g.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=h.parseOneBox(this.stream,false)).code===h.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var r;switch(r="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),r){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[r]&&o.warn("ISOFile","Duplicate Box of type: "+r+", overriding previous occurrence"),this[r]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},g.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(o.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(o.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(o.warn("ISOFile","Not ready to start parsing"),!1))},g.prototype.appendBuffer=function(e,t){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(o.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),o.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),r},g.prototype.getInfo=function(){var e,t,r,i,n,s,o={},a=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(o.hasMoov=!0,o.duration=this.moov.mvhd.duration,o.timescale=this.moov.mvhd.timescale,o.isFragmented=null!=this.moov.mvex,o.isFragmented&&this.moov.mvex.mehd&&(o.fragment_duration=this.moov.mvex.mehd.fragment_duration),o.isProgressive=this.isProgressive,o.hasIOD=null!=this.moov.iods,o.brands=[],o.brands.push(this.ftyp.major_brand),o.brands=o.brands.concat(this.ftyp.compatible_brands),o.created=new Date(a+1e3*this.moov.mvhd.creation_time),o.modified=new Date(a+1e3*this.moov.mvhd.modification_time),o.tracks=[],o.audioTracks=[],o.videoTracks=[],o.subtitleTracks=[],o.metadataTracks=[],o.hintTracks=[],o.otherTracks=[],e=0;e0?o.mime+='video/mp4; codecs="':o.audioTracks&&o.audioTracks.length>0?o.mime+='audio/mp4; codecs="':o.mime+='application/mp4; codecs="',e=0;e=r.samples.length)&&(o.info("ISOFile","Sending fragmented data on track #"+i.id+" for samples ["+Math.max(0,r.nextSample-i.nb_samples)+","+(r.nextSample-1)+"]"),o.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(i.id,i.user,i.segmentStream.buffer,r.nextSample,e||r.nextSample>=r.samples.length),i.segmentStream=null,i!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=r.samples.length)&&(o.debug("ISOFile","Sending samples on track #"+s.id+" for sample "+r.nextSample),this.onSamples&&this.onSamples(s.id,s.user,s.samples),s.samples=[],s!==this.extractedTracks[t]))break}}}},g.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},g.prototype.getBoxes=function(e,t){var r=[];return g._sweep.call(this,e,r,t),r},g._sweep=function(e,t,r){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&r)return;g._sweep.call(this.boxes[i],e,t,r)}},g.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},g.prototype.getTrackSample=function(e,t){var r=this.getTrackById(e);return this.getSample(r,t)},g.prototype.releaseUsedSamples=function(e,t,r){var i=0,n=this.getTrackById(e);n.lastValidSample||(n.lastValidSample=0);for(var s=n.lastValidSample;se*n.timescale){l=i-1;break}t&&n.is_sync&&(d=i)}for(t&&(l=d),e=r.samples[l].cts,r.nextSample=l;r.samples[l].alreadyRead===r.samples[l].size&&r.samples[l+1];)l++;return s=r.samples[l].offset+r.samples[l].alreadyRead,o.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+o.getDurationString(e,a)+" and offset: "+s),{offset:s,time:e/a}},g.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},g.prototype.seek=function(e,t){var r,i,n,s=this.moov,a={offset:1/0,time:1/0};if(this.moov){for(n=0;nthis.getTrackDuration(r)||((i=this.seekTrack(e,t,r)).offset-1){o=d;break}switch(o){case"Visual":if(n.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),s.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var u=new h.avcCBox;u.parse(new a(t.avcDecoderConfigRecord)),s.addBox(u)}else if(t.hevcDecoderConfigRecord){var f=new h.hvcCBox;f.parse(new a(t.hevcDecoderConfigRecord)),s.addBox(f)}break;case"Audio":n.add("smhd").set("balance",t.balance||0),s.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":n.add("hmhd");break;case"Subtitle":if(n.add("sthd"),"stpp"===t.type)s.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:n.add("nmhd")}t.description&&s.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){s.addBox(e)})),n.add("dinf").add("dref").addEntry((new h["url Box"]).set("flags",1));var p=n.add("stbl");return p.add("stsd").addEntry(s),p.add("stts").set("sample_counts",[]).set("sample_deltas",[]),p.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),p.add("stco").set("chunk_offsets",[]),p.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(r),t.id}},h.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},g.prototype.addSample=function(e,t,r){var i=r||{},n={},s=this.getTrackById(e);if(null!==s){n.number=s.samples.length,n.track_id=s.tkhd.track_id,n.timescale=s.mdia.mdhd.timescale,n.description_index=i.sample_description_index?i.sample_description_index-1:0,n.description=s.mdia.minf.stbl.stsd.entries[n.description_index],n.data=t,n.size=t.byteLength,n.alreadyRead=n.size,n.duration=i.duration||1,n.cts=i.cts||0,n.dts=i.dts||0,n.is_sync=i.is_sync||!1,n.is_leading=i.is_leading||0,n.depends_on=i.depends_on||0,n.is_depended_on=i.is_depended_on||0,n.has_redundancy=i.has_redundancy||0,n.degradation_priority=i.degradation_priority||0,n.offset=0,n.subsamples=i.subsamples,s.samples.push(n),s.samples_size+=n.size,s.samples_duration+=n.duration,void 0===s.first_dts&&(s.first_dts=i.dts),this.processSamples();var o=this.createSingleSampleMoof(n);return this.addBox(o),o.computeSize(),o.trafs[0].truns[0].data_offset=o.size+8,this.add("mdat").data=new Uint8Array(t),n}},g.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var r=new h.moofBox;r.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var i=r.add("traf"),n=this.getTrackById(e.track_id);return i.add("tfhd").set("track_id",e.track_id).set("flags",h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),i.add("tfdt").set("baseMediaDecodeTime",e.dts-(n.first_dts||0)),i.add("trun").set("flags",h.TRUN_FLAGS_DATA_OFFSET|h.TRUN_FLAGS_DURATION|h.TRUN_FLAGS_SIZE|h.TRUN_FLAGS_FLAGS|h.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),r},g.prototype.lastMoofIndex=0,g.prototype.samplesDataSize=0,g.prototype.resetTables=function(){var e,t,r,i,n,s;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(d=n[o].grouping_type+"/0",(a=new l(n[o].grouping_type,0)).is_fragment=!0,t.sample_groups_info[d]||(t.sample_groups_info[d]=a))}else for(o=0;o=2&&(d=i[o].grouping_type+"/0",a=new l(i[o].grouping_type,0),e.sample_groups_info[d]||(e.sample_groups_info[d]=a))},g.setSampleGroupProperties=function(e,t,r,i){var n,s;for(n in t.sample_groups=[],i){var o;if(t.sample_groups[n]={},t.sample_groups[n].grouping_type=i[n].grouping_type,t.sample_groups[n].grouping_type_parameter=i[n].grouping_type_parameter,r>=i[n].last_sample_in_run&&(i[n].last_sample_in_run<0&&(i[n].last_sample_in_run=0),i[n].entry_index++,i[n].entry_index<=i[n].sbgp.entries.length-1&&(i[n].last_sample_in_run+=i[n].sbgp.entries[i[n].entry_index].sample_count)),i[n].entry_index<=i[n].sbgp.entries.length-1?t.sample_groups[n].group_description_index=i[n].sbgp.entries[i[n].entry_index].group_description_index:t.sample_groups[n].group_description_index=-1,0!==t.sample_groups[n].group_description_index)o=i[n].fragment_description?i[n].fragment_description:i[n].description,t.sample_groups[n].group_description_index>0?(s=t.sample_groups[n].group_description_index>65535?(t.sample_groups[n].group_description_index>>16)-1:t.sample_groups[n].group_description_index-1,o&&s>=0&&(t.sample_groups[n].description=o.entries[s])):o&&o.version>=2&&o.default_group_description_index>0&&(t.sample_groups[n].description=o.entries[o.default_group_description_index-1])}},g.process_sdtp=function(e,t,r){t&&(e?(t.is_leading=e.is_leading[r],t.depends_on=e.sample_depends_on[r],t.is_depended_on=e.sample_is_depended_on[r],t.has_redundancy=e.sample_has_redundancy[r]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},g.prototype.buildSampleLists=function(){var e,t;for(e=0;ev&&(b++,v<0&&(v=0),v+=s.sample_counts[b]),t>0?(e.samples[t-1].duration=s.sample_deltas[b],e.samples_duration+=e.samples[t-1].duration,x.dts=e.samples[t-1].dts+e.samples[t-1].duration):x.dts=0,o?(t>=w&&(S++,w<0&&(w=0),w+=o.sample_counts[S]),x.cts=e.samples[t].dts+o.sample_offsets[S]):x.cts=x.dts,a?(t==a.sample_numbers[E]-1?(x.is_sync=!0,E++):(x.is_sync=!1,x.degradation_priority=0),l&&l.entries[A].sample_delta+U==t+1&&(x.subsamples=l.entries[A].subsamples,U+=l.entries[A].sample_delta,A++)):x.is_sync=!0,g.process_sdtp(e.mdia.minf.stbl.sdtp,x,x.number),x.degradation_priority=h?h.priority[t]:0,l&&l.entries[A].sample_delta+U==t&&(x.subsamples=l.entries[A].subsamples,U+=l.entries[A].sample_delta),(c.length>0||u.length>0)&&g.setSampleGroupProperties(e,x,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},g.prototype.updateSampleLists=function(){var e,t,r,i,n,s,o,a,d,l,c,u,f,p,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&g.initSampleGroups(u,c,c.sbgps,u.mdia.minf.stbl.sgpds,c.sgpds),t=0;t0?p.dts=u.samples[u.samples.length-2].dts+u.samples[u.samples.length-2].duration:(c.tfdt?p.dts=c.tfdt.baseMediaDecodeTime:p.dts=0,u.first_traf_merged=!0),p.cts=p.dts,_.flags&h.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+_.sample_composition_time_offset[r]),m=o,_.flags&h.TRUN_FLAGS_FLAGS?m=_.sample_flags[r]:0===r&&_.flags&h.TRUN_FLAGS_FIRST_FLAG&&(m=_.first_sample_flags),p.is_sync=!(m>>16&1),p.is_leading=m>>26&3,p.depends_on=m>>24&3,p.is_depended_on=m>>22&3,p.has_redundancy=m>>20&3,p.degradation_priority=65535&m;var y=!!(c.tfhd.flags&h.TFHD_FLAG_BASE_DATA_OFFSET),v=!!(c.tfhd.flags&h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),b=!!(_.flags&h.TRUN_FLAGS_DATA_OFFSET),w=0;w=y?c.tfhd.base_data_offset:v||0===t?l.start:a,p.offset=0===t&&0===r?b?w+_.data_offset:w:a,a=p.offset+p.size,(c.sbgps.length>0||c.sgpds.length>0||u.mdia.minf.stbl.sbgps.length>0||u.mdia.minf.stbl.sgpds.length>0)&&g.setSampleGroupProperties(u,p,p.number_in_traf,c.sample_groups_info)}}if(c.subs){u.has_fragment_subsamples=!0;var S=c.first_sample_index;for(t=0;t-1))return null;var s=(r=this.stream.buffers[n]).byteLength-(i.offset+i.alreadyRead-r.fileStart);if(i.size-i.alreadyRead<=s)return o.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+(i.size-i.alreadyRead)+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,i.size-i.alreadyRead),r.usedBytes+=i.size-i.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead=i.size,i;if(0===s)return null;o.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+s+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,s),i.alreadyRead+=s,r.usedBytes+=s,this.stream.logBufferLevel()}},g.prototype.releaseSample=function(e,t){var r=e.samples[t];return r.data?(this.samplesDataSize-=r.size,r.data=null,r.description=null,delete r.degradation_priority,delete r.depends_on,delete r.description_index,delete r.has_redundancy,delete r.is_depended_on,delete r.is_leading,delete r.is_sync,delete r.moof_number,delete r.number_in_traf,delete r.timescale,delete r.cts,delete r.dts,delete r.offset,delete r.size,delete r.track_id,delete r.duration,r.alreadyRead=0,r.size):0},g.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},g.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},g.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(r.protection=s.ipro.protections[s.iinf.item_infos[e].protection_index-1]),s.iinf.item_infos[e].item_type?r.type=s.iinf.item_infos[e].item_type:r.type="mime",r.content_type=s.iinf.item_infos[e].content_type,r.content_encoding=s.iinf.item_infos[e].content_encoding;if(s.grpl)for(e=0;e0&&h.property_index-1-1))return null;var a=(t=this.stream.buffers[s]).byteLength-(n.offset+n.alreadyRead-t.fileStart);if(!(n.length-n.alreadyRead<=a))return o.debug("ISOFile","Getting item #"+e+" extent #"+i+" partial data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+a+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,a),n.alreadyRead+=a,r.alreadyRead+=a,t.usedBytes+=a,this.stream.logBufferLevel(),null;o.debug("ISOFile","Getting item #"+e+" extent #"+i+" data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+(n.length-n.alreadyRead)+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,n.length-n.alreadyRead),t.usedBytes+=n.length-n.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead+=n.length-n.alreadyRead,n.alreadyRead=n.length}}return r.alreadyRead===r.size?r:null},g.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var r=0;r0?this.moov.traks[e].samples[0].duration:0),t.push(i)}return t},g.prototype.getPerformanceInfo=function(){var e={};return e.moov=this.moov,this.moov&&this.moov.traks&&this.moov.traks.length>1&&(e.moovAudioNum=this.moov.traks[0].samples.length,e.moovVideoNum=this.moov.traks[1].samples.length),e},h.Box.prototype.printHeader=function(e){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},h.FullBox.prototype.printHeader=function(e){this.size+=4,h.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},h.Box.prototype.print=function(e){this.printHeader(e)},h.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},h.tkhdBox.prototype.print=function(e){h.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var y={createFile:function(e,t){var r=void 0===e||e,i=new g(t);return i.discardMdatData=!r,i}};t.createFile=y.createFile}));function Oi(e){return e.reduce(((e,t)=>256*e+t))}function Gi(e){const t=[101,103,119,99],r=e.length-28,i=e.slice(r,r+t.length);return t.every(((e,t)=>e===i[t]))}$i.Log,$i.MP4BoxStream,$i.DataStream,$i.MultiBufferStream,$i.MPEG4DescriptorParser,$i.BoxParser,$i.XMLSubtitlein4Parser,$i.Textin4Parser,$i.ISOFile,$i.createFile;class Hi{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(r+32,r+32+t))]}return null}(t,this.t);if(!r)return e;const i=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(i instanceof Error)return console.error(i.message),this.d=!0,e;this.A=!0,this.u=r[1],Gi(t)&&this.c++,WebAssembly.instantiate(r[2],i).then((e=>{if("function"!=typeof(t=e.instance.exports).parse||"object"!=typeof t.memory)return this.d=!0,void console.error("video_error_3");var t;this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}function Wi(){for(var e=arguments.length,t=new Array(e),r=0;r{const r=new i((0|e.byteLength)+(0|t.byteLength));return r.set(e,0),r.set(t,0|e.byteLength),r}),new i)}const Vi=16,ji=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],qi=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Yi(e){const t=[];for(let r=0,i=e.length;r1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Xi(e){const t=[];for(let r=0,i=e.length;r>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}function Zi(e){const t=[];for(let r=0,i=e.length;r=240&&e[r]<=247?(t.push(String.fromCodePoint(((7&e[r])<<18)+((63&e[r+1])<<12)+((63&e[r+2])<<6)+(63&e[r+3]))),r+=3):e[r]>=224&&e[r]<=239?(t.push(String.fromCodePoint(((15&e[r])<<12)+((63&e[r+1])<<6)+(63&e[r+2]))),r+=2):e[r]>=192&&e[r]<=223?(t.push(String.fromCodePoint(((31&e[r])<<6)+(63&e[r+1]))),r++):t.push(String.fromCodePoint(e[r]));return t.join("")}function Ji(e,t){const r=31&t;return e<>>32-r}function Qi(e){return(255&ji[e>>>24&255])<<24|(255&ji[e>>>16&255])<<16|(255&ji[e>>>8&255])<<8|255&ji[255&e]}function en(e){return e^Ji(e,2)^Ji(e,10)^Ji(e,18)^Ji(e,24)}function tn(e){return e^Ji(e,13)^Ji(e,23)}function rn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[4*t],n[1]=255&e[4*t+1],n[2]=255&e[4*t+2],n[3]=255&e[4*t+3],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];for(let e,t=0;t<32;t+=4)e=i[1]^i[2]^i[3]^r[t+0],i[0]^=en(Qi(e)),e=i[2]^i[3]^i[0]^r[t+1],i[1]^=en(Qi(e)),e=i[3]^i[0]^i[1]^r[t+2],i[2]^=en(Qi(e)),e=i[0]^i[1]^i[2]^r[t+3],i[3]^=en(Qi(e));for(let e=0;e<16;e+=4)t[e]=i[3-e/4]>>>24&255,t[e+1]=i[3-e/4]>>>16&255,t[e+2]=i[3-e/4]>>>8&255,t[e+3]=255&i[3-e/4]}function nn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[0+4*t],n[1]=255&e[1+4*t],n[2]=255&e[2+4*t],n[3]=255&e[3+4*t],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let e,r=0;r<32;r+=4)e=i[1]^i[2]^i[3]^qi[r+0],t[r+0]=i[0]^=tn(Qi(e)),e=i[2]^i[3]^i[0]^qi[r+1],t[r+1]=i[1]^=tn(Qi(e)),e=i[3]^i[0]^i[1]^qi[r+2],t[r+2]=i[2]^=tn(Qi(e)),e=i[0]^i[1]^i[2]^qi[r+3],t[r+3]=i[3]^=tn(Qi(e));if(0===r)for(let e,r=0;r<16;r++)e=t[r],t[r]=t[31-r],t[31-r]=e}function sn(e,t,r){let{padding:i="pkcs#7",mode:n,iv:s=[],output:o="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===n&&("string"==typeof s&&(s=Yi(s)),16!==s.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=Yi(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==r?Xi(e):Yi(e):[...e],("pkcs#5"===i||"pkcs#7"===i)&&0!==r){const t=Vi-e.length%Vi;for(let r=0;r=Vi;){const t=e.slice(u,u+16),i=new Array(16);if("cbc"===n)for(let e=0;e2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let s=new Uint8Array(e.slice(0,5)),o=5;for(;on){const t=new Uint8Array(s.length+e.length-o);t.set(s,0),t.set(e.slice(o),s.length),s=t;break}let l=e[o+4],c=!1,u=2;if(r?(i&&(u=3),l=l>>>1&63,c=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(l)):(l&=31,c=1===l||5===l),c){const r=sn(e.slice(o+4+u,o+4+d),t,0,{padding:"none",output:"array"});let i=r[r.length-1];if(i>0&&i<16){let e=!0;for(let t=1;t<=i;t++)if(r[r.length-t]!==i){e=!1;break}e&&r.splice(r.length-i,i)}const n=new Uint8Array(u);n.set(e.slice(o+4,o+4+u),0);const a=tr(Wi(n,new Uint8Array(r))),l=new Uint8Array(s.length+a.length);l.set(s,0),l.set(a,s.length),s=l}else{const t=e.slice(o+4,o+4+d),r=new Uint8Array(s.length+4+t.length);r.set(s,0),r.set(a,s.length),r.set(t,s.length+4),s=r}o=o+4+d}return s}const dn={init:0,findFirstStartCode:1,findSecondStartCode:2};class ln extends class{on(e,t,r){const i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:r}),this}once(e,t,r){const i=this;function n(){i.off(e,n);for(var s=arguments.length,o=new Array(s),a=0;a1?r-1:0),n=1;n{delete r[e]})),void delete this.e;const i=r[e],n=[];if(i&&t)for(let e=0,r=i.length;e=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=dn.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==dn.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=dn.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==dn.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=dn.findFirstStartCode}}}}function cn(e,t,r){for(let i=2;i3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let s=5;for(;sn)break;let a=e[s+4],d=!1;if(i?(a=a>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(a)):(a&=31,d=1===a||5===a),d){const i=cn(e.slice(s+4,s+4+o),t,r);e.set(i,s+4)}s=s+4+o}return e}function fn(){for(var e=arguments.length,t=new Array(e),r=0;re+t.byteLength),0));let n=0;return t.forEach((e=>{i.set(e,n),n+=e.byteLength})),i}class pn{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,r,i)));e.addEventListener(t,r,i);const n=()=>{lr(e.removeEventListener)&&e.removeEventListener(t,r,i)};return this.destroys.push(n),n}destroy(){this.master.debugLog("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class mn{static init(){mn.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in mn.types)mn.types.hasOwnProperty(e)&&(mn.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=mn.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,r=null,i=Array.prototype.slice.call(arguments,1),n=i.length;for(let e=0;e>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r.set(e,4);let s=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return mn.box(mn.types.trak,mn.tkhd(e),mn.mdia(e))}static tkhd(e){let t=e.id,r=e.duration,i=e.presentWidth,n=e.presentHeight;return mn.box(mn.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>>8&255,255&i,0,0,n>>>8&255,255&n,0,0]))}static mdia(e){return mn.box(mn.types.mdia,mn.mdhd(e),mn.hdlr(e),mn.minf(e))}static mdhd(e){let t=e.timescale,r=e.duration;return mn.box(mn.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?mn.constants.HDLR_AUDIO:mn.constants.HDLR_VIDEO,mn.box(mn.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?mn.box(mn.types.smhd,mn.constants.SMHD):mn.box(mn.types.vmhd,mn.constants.VMHD),mn.box(mn.types.minf,t,mn.dinf(),mn.stbl(e))}static dinf(){return mn.box(mn.types.dinf,mn.box(mn.types.dref,mn.constants.DREF))}static stbl(e){return mn.box(mn.types.stbl,mn.stsd(e),mn.box(mn.types.stts,mn.constants.STTS),mn.box(mn.types.stsc,mn.constants.STSC),mn.box(mn.types.stsz,mn.constants.STSZ),mn.box(mn.types.stco,mn.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.mp3(e)):mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.mp4a(e)):"avc"===e.videoType?mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.avc1(e)):mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.hvc1(e))}static mp3(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return mn.box(mn.types[".mp3"],i)}static mp4a(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return mn.box(mn.types.mp4a,i,mn.esds(e))}static esds(e){let t=e.config||[],r=t.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(t).concat([6,1,2]));return mn.box(mn.types.esds,i)}static avc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return mn.box(mn.types.avc1,n,mn.box(mn.types.avcC,t))}static hvc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return mn.box(mn.types.hvc1,n,mn.box(mn.types.hvcC,t))}static mvex(e){return mn.box(mn.types.mvex,mn.trex(e))}static trex(e){let t=e.id,r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return mn.box(mn.types.trex,r)}static moof(e,t){return mn.box(mn.types.moof,mn.mfhd(e.sequenceNumber),mn.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return mn.box(mn.types.mfhd,t)}static traf(e,t){let r=e.id,i=mn.box(mn.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),n=mn.box(mn.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),s=mn.sdtp(e),o=mn.trun(e,s.byteLength+16+16+8+16+8+8);return mn.box(mn.types.traf,i,n,o,s)}static sdtp(e){let t=new Uint8Array(5),r=e.flags;return t[4]=r.isLeading<<6|r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy,mn.box(mn.types.sdtp,t)}static trun(e,t){let r=new Uint8Array(28);t+=36,r.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let i=e.duration,n=e.size,s=e.flags,o=e.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.isNonSync,0,0,o>>>24&255,o>>>16&255,o>>>8&255,255&o],12),mn.box(mn.types.trun,r)}static mdat(e){return mn.box(mn.types.mdat,e)}}mn.init();var _n,gn=Ot((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}));(_n=gn)&&_n.__esModule&&Object.prototype.hasOwnProperty.call(_n,"default")&&_n.default;const yn=[44100,48e3,32e3,0],vn=[22050,24e3,16e3,0],bn=[11025,12e3,8e3,0],wn=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],Sn=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],En=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];function An(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),r=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let i=t[1]>>>3&3,n=(6&t[1])>>1,s=(240&t[2])>>>4,o=(12&t[2])>>>2,a=3!==(t[3]>>>6&3)?2:1,d=0,l=0;switch(i){case 0:d=bn[o];break;case 2:d=vn[o];break;case 3:d=yn[o]}switch(n){case 1:s=e[n]&&t=6?(i=5,t=new Array(4),o=n-3):(i=2,t=new Array(2),o=n):-1!==a.indexOf("android")?(i=2,t=new Array(2),o=n):(i=5,o=n,t=new Array(4),n>=6?o=n-3:1===s&&(i=2,t=new Array(2),o=n)),t[0]=i<<3,t[0]|=(15&n)>>>1,t[1]=(15&n)<<7,t[1]|=(15&s)<<3,5===i&&(t[1]|=(15&o)>>>1,t[2]=(1&o)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=Nn[n],this.sampling_index=n,this.channel_count=s,this.object_type=i,this.original_object_type=r,this.codec_mimetype="mp4a.40."+i,this.original_codec_mimetype="mp4a.40."+r}}class Gn{constructor(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}get bitsAvailable(){return this.bitLength-this.index}skipBits(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}getBits(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>i,s=8-i;if(s>=e)return r&&(this.index+=e),n>>s-e;{r&&(this.index+=s);const i=e-s;return n<>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}function Hn(e){return e[3]|e[2]<<8|e[1]<<16|e[0]<<24}const Wn=new Array(214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72),Vn=new Array(2746333894,1453994832,1736282519,2993693404),jn=new Array(462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257);function qn(e,t,r,i,n){var s=n;s=t+n>e.length&&i+n<=r.length?e.length-t:i+n>r.length&&t+n<=e.length?r.length-i:t+n<=e.length&&i+n<=r.length?n:r.length>24&255,e>>16&255,e>>8&255,255&e)}function Kn(e,t){return t+3>>19)^(i<<23|i>>>9)}function Jn(e,t){var r=new Array(36);r[0]=Kn(t,0),r[1]=Kn(t,4),r[2]=Kn(t,8),r[3]=Kn(t,12);for(var i=0;i<32;i++)r[i+4]=r[i]^Qn(r[i+1]^r[i+2]^r[i+3]^e[i]);var n=new Array(4);for(i=35;i>=32;i--)n[35-i]=r[i];var s=function(e){for(var t=new Array(4*e.length),r=0;r>>30)^(i<<10|i>>>22)^(i<<18|i>>>14)^(i<<24|i>>>8)}function es(e,t,r){if(null==e||null==e||e.length%16!=0)return console.log("sm4 key is error!"),null;if(null==r||null==r||r.length<=0)return console.log("cipher is error!"),null;if(null==t||null==t||t.length%16!=0)return console.log("iv is error!"),null;for(var i=Xn(e),n=Math.ceil(r.length/16),s=new Array(r.length),o=t.slice(),a=0;a3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t=new Uint8Array(t),r=new Uint8Array(r);const s=e.byteLength;let o=5;for(;os)break;let d=e[o+4],l=!1,c=2;if(i?(n&&(c=3),d=d>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(d)):(d&=31,l=1===d||5===d),l){const i=es(t,r,e.slice(o+4+c,o+4+a));e.set(i,o+4+c)}o=o+4+a}return e}Date.now||(Date.now=function(){return(new Date).getTime()});const rs=[];rs.push(o({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support")&&-1===e.indexOf("illegal icc")&&!e.indexOf("If you want to help, upload a sample of this file to")&&!e.indexOf("Reserved SBR extensions is not implemented"))})(e)||console.warn("JbPro[❌❌❌][worker]:",e)}}),s({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support, using thread emulation"))})(e)||console.warn("JbPro[❌❌❌][worker]",e)}})),Promise.all(rs).then((e=>{const t=e[0];!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[],n=[],s=null,o=null,a=null,d=null,l=null,c=null,u=!1,h=null,f=null,S=!1,E=!1,B=!!gr(r),Se=0,Ee=0,je=!1,Je=null,Qe=null,tt=null,it=[],ut=null,At=null,Ut=0,kt=0,$t=null,Ot=null,Gt=0,Ht=0,Wt=!1,Kt=!1,Qt=!1,sr=null,wr=null,Sr=!1,Er=!0,Ar=()=>{const e=mr();return{debug:e.debug,debugLevel:e.debugLevel,debugUuid:e.debugUuid,useOffscreen:e.useOffscreen,useWCS:e.useWCS,useMSE:e.useMSE,videoBuffer:e.videoBuffer,videoBufferDelay:e.videoBufferDelay,openWebglAlignment:e.openWebglAlignment,playType:e.playType,hasAudio:e.hasAudio,hasVideo:e.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:e.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:e.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:0,networkDelay:e.networkDelay,visibility:!0,useSIMD:e.useSIMD,isRecording:!1,recordType:e.recordType,isNakedFlow:e.isNakedFlow,checkFirstIFrame:e.checkFirstIFrame,audioBufferSize:1024,isM7sCrypto:e.isM7sCrypto,m7sCryptoAudio:e.m7sCryptoAudio,cryptoKey:e.cryptoKey,cryptoIV:e.cryptoIV,isSm4Crypto:e.isSm4Crypto,isSm4CryptoH265V2:e.isSm4CryptoH265V2,sm4CryptoKey:e.sm4CryptoKey,isXorCrypto:e.isXorCrypto,isHls265:!1,isFlv:e.isFlv,isFmp4:e.isFmp4,isMpeg4:e.isMpeg4,isTs:e.isTs,isFmp4Private:e.isFmp4Private,isEmitSEI:e.isEmitSEI,isRecordTypeFlv:!1,isWasmMp4:!1,isChrome:!1,isFirefox:!1,isDropSameTimestampGop:e.isDropSameTimestampGop,mseDecodeAudio:e.mseDecodeAudio,wcsDecodeAudio:e.wcsDecodeAudio,nakedFlowH265DemuxUseNew:e.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:e.mseDecoderUseWorker,mseAutoCleanupSourceBuffer:e.mseAutoCleanupSourceBuffer,mseAutoCleanupMaxBackwardDuration:e.mseAutoCleanupMaxBackwardDuration,mseAutoCleanupMinBackwardDuration:e.mseAutoCleanupMinBackwardDuration,mseCorrectTimeDuration:e.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:e.mseCorrectAudioTimeDuration,nakedFlowDemuxUseNew:e.nakedFlowDemuxUseNew,nakedFlowFps:e.nakedFlowFps,supportMSEDecodeHevc:!1}};"VideoEncoder"in self&&(s={hasInit:!1,isEmitInfo:!1,offscreenCanvas:null,offscreenCanvasCtx:null,decoder:null,init(){s.decoder=new VideoDecoder({output:function(e){if(lr(e.createImageBitmap))e.createImageBitmap().then((t=>{s.offscreenCanvasCtx.drawImage(t,0,0,e.codedWidth,e.codedHeight);let r=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:r,delay:si.delay,ts:0},[r]),hr(e)}));else{s.offscreenCanvasCtx.drawImage(e,0,0,e.codedWidth,e.codedHeight);let t=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:t,delay:si.delay,ts:0},[t]),hr(e)}},error:function(e){si.debugError("worker","VideoDecoder error: ",e,e.toString())}})},destroy(){s.reset(),s.decoder&&"closed"!==s.decoder.state&&(s.decoder.close(),s.decoder=null)},decode:function(e,t,r){const i=e[0]>>4==1;if(s.hasInit){const r=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:i?pt:mt});s.decoder.decode(r)}else if(i&&0===e[1]){const t=15&e[0];postMessage({cmd:M,code:t});const r=new Uint8Array(e);postMessage({cmd:R,buffer:r,codecId:t},[r.buffer]);let i=null,n=null;const o=e.slice(5);t===Ie?(n=Tr(o),i={codec:n.codec,description:o}):t===Me&&(n=Vr(o),i={codec:n.codec,description:o}),n&&n.codecWidth&&n.codecHeight&&(i.codedHeight=n.codecHeight,i.codedWidth=n.codecWidth),s.isEmitInfo||(si.debugLog("worker","Webcodecs Video Decoder initSize"),postMessage({cmd:T,w:n.codecWidth,h:n.codecHeight}),s.isEmitInfo=!0,s.offscreenCanvas=new OffscreenCanvas(n.codecWidth,n.codecHeight),s.offscreenCanvasCtx=s.offscreenCanvas.getContext("2d"));try{s.decoder.configure(i),s.hasInit=!0}catch(e){si.debugError("worker","VideoDecoder configure error",e.code,e,e.toString()),e.toString()}}else si.debugWarn("worker",`VideoDecoder configure has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)},reset(){s.hasInit=!1,s.isEmitInfo=!1,s.offscreenCanvas=null,s.offscreenCanvasCtx=null}});let kr=function(){if(Sr=!0,o)try{o.abort(),o=null,si.debugLog("worker","abort success")}catch(e){o=null,si.debugLog("worker","abort catch",e)}},Or={init(){Or.lastBuf=null,Or.vps=null,Or.sps=null,Or.pps=null,Or.streamType=null,Or.localDts=0,Or.pendingUnits={},Or.isSendSeqHeader=!1},destroy(){Or.lastBuf=null,Or.vps=null,Or.sps=null,Or.pps=null,Or.streamType=null,Or.localDts=0,Or.pendingUnits={},Or.isSendSeqHeader=!1},dispatch(e){const t=new Uint8Array(e);if(si._opt.nakedFlowDemuxUseNew){const e=Or.extractNALu$3(t);if(0===e.length)return void si.debugLog("worker","dispatch naluArray length is 0");Or.handleVideoFrames(e)}else Or.extractNALu$2(t)},getNaluDts(){const e=si._opt.nakedFlowFps;let t=Or.localDts;return Or.localDts=Or.localDts+parseInt(1e3/e,10),t},getNaluAudioDts(){const e=si._opt.sampleRate,t=si._opt.audioBufferSize;return Or.localDts+parseInt(t/e*1e3)},extractNALu(e){let t,r,i=0,n=e.byteLength,s=0,o=[];for(;i1)for(let e=0;e{const t=Lr(e);t===Ve||t===We?Or.handleVideoH264Nalu(e):Mr(t)&&i.push(e)})),1===i.length)Or.handleVideoH264Nalu(i[0]);else if(zr(i)){const e=Lr(i[0]),t=Rr(e);Or.handleVideoH264NaluList(i,t,e)}else i.forEach((e=>{Or.handleVideoH264Nalu(e)}))}else if(Or.streamType===Ne)if(si._opt.nakedFlowH265DemuxUseNew){const t=Or.handleAddNaluStartCode(e),r=Or.extractNALu(t);if(0===r.length)return void si.debugWarn("worker","handleVideoNalu","h265 naluList.length === 0");const i=[];if(r.forEach((e=>{const t=Xr(e);t===lt||t===at||t===st?Or.handleVideoH265Nalu(e):Jr(t)&&i.push(e)})),1===i.length)Or.handleVideoH265Nalu(i[0]);else if(ei(i)){const e=Xr(i[0]),t=Qr(e);Or.handleVideoH265NaluList(i,t,e)}else i.forEach((e=>{Or.handleVideoH265Nalu(e)}))}else Xr(e)===lt?Or.extractH265PPS(e):Or.handleVideoH265Nalu(e)},extractH264PPS(e){const t=Or.handleAddNaluStartCode(e);Or.extractNALu(t).forEach((e=>{Ir(Lr(e))?Or.extractH264SEI(e):Or.handleVideoH264Nalu(e)}))},extractH265PPS(e){const t=Or.handleAddNaluStartCode(e);Or.extractNALu(t).forEach((e=>{Zr(Xr(e))?Or.extractH265SEI(e):Or.handleVideoH265Nalu(e)}))},extractH264SEI(e){const t=Or.handleAddNaluStartCode(e);Or.extractNALu(t).forEach((e=>{Or.handleVideoH264Nalu(e)}))},extractH265SEI(e){const t=Or.handleAddNaluStartCode(e);Or.extractNALu(t).forEach((e=>{Or.handleVideoH265Nalu(e)}))},handleAddNaluStartCode(e){const t=[0,0,0,1],r=new Uint8Array(e.length+t.length);return r.set(t),r.set(e,t.length),r},handleVideoH264Nalu(e){const t=Lr(e);switch(t){case We:Or.sps=e;break;case Ve:Or.pps=e}if(Or.isSendSeqHeader){if(Or.sps&&Or.pps){const e=Cr({sps:Or.sps,pps:Or.pps}),t=Or.localDts;si.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null}if(Mr(t)){const r=Rr(t),i=Or.getNaluDts(),n=Pr(e,r);Or.doDecode(n,{type:ae,ts:i,isIFrame:r,cts:0})}}else if(Or.sps&&Or.pps){Or.isSendSeqHeader=!0;const e=Cr({sps:Or.sps,pps:Or.pps});si.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null}},handleVideoH264NaluList(e,t,r){if(Or.isSendSeqHeader){const i=Or.getNaluDts(),n=Fr(e.reduce(((e,t)=>{const r=tr(e),i=tr(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);Or.doDecode(n,{type:ae,ts:i,isIFrame:t,cts:0}),si.debugLog("worker",`handleVideoH264NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},handleVideoH265Nalu(e){const t=Xr(e);switch(t){case st:Or.vps=e;break;case at:Or.sps=e;break;case lt:Or.pps=e}if(Or.isSendSeqHeader){if(Or.vps&&Or.sps&&Or.pps){const e=qr({vps:Or.vps,sps:Or.sps,pps:Or.pps}),t=Or.localDts;si.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Or.vps=null,Or.sps=null,Or.pps=null}if(Jr(t)){const r=Qr(t),i=Or.getNaluDts(),n=Yr(e,r);Or.doDecode(n,{type:ae,ts:i,isIFrame:r,cts:0})}}else if(Or.vps&&Or.sps&&Or.pps){Or.isSendSeqHeader=!0;const e=qr({vps:Or.vps,sps:Or.sps,pps:Or.pps});si.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Or.vps=null,Or.sps=null,Or.pps=null}},handleVideoH265NaluList(e,t,r){if(Or.isSendSeqHeader){const i=Or.getNaluDts(),n=Kr(e.reduce(((e,t)=>{const r=tr(e),i=tr(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);Or.doDecode(n,{type:ae,ts:i,isIFrame:t,cts:0}),si.debugLog("worker",`handleVideoH265NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},doDecode(e,t){si.calcNetworkDelay(t.ts),t.isIFrame&&si.calcIframeIntervalTimestamp(t.ts),si.decode(e,t)},handleVideoFrames(e){if(!Or.streamVideoType)for(let t of e)if(Or.streamVideoType=cr(t),Or.streamVideoType)break;Or.streamVideoType?Or.streamVideoType===ze?Or.handleVideoH264Frames(e):this.streamVideoType===Ne&&Or.handleVideoH265Frames(e):si.debugWarn("worker","handleVideoFrames","streamVideoType is null")},handleVideoH264Frames(e){let t=[],r=[],i=!1,n=!1;Or.pendingUnits.units&&(t=Or.pendingUnits.units,n=Or.pendingUnits.vcl,i=Or.pendingUnits.iFrame,Or.pendingUnits={});let s={};for(let o of e){if(o.byteLength<4)continue;const e=Lr(o);let a=!1,d=e===Ye;e!==qe&&e!==Ye||(s=Or.parseVideo264Header(o),a=!0),t.length&&n&&(s.isfms||!a)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,n=!1),t.push(o),i=i||d,n=n||a}t.length&&(Or.pendingUnits={units:t,vcl:n,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,n=null;if(t.forEach((e=>{const t=31&e[0];switch(t){case Ve:Or.pps=e;break;case We:Or.sps=e;break;case Ke:n=e}if(Mr(t)){const t=tr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Or.isSendSeqHeader&&Or.sps&&Or.pps){Or.isSendSeqHeader=!0;const e=Dr({sps:Or.sps,pps:Or.pps});si.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null}if(Or.isSendSeqHeader){if(Or.sps&&Or.pps){const e=Dr({sps:Or.sps,pps:Or.pps}),t=Or.localDts;si.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null}if(i){const e=Or.getNaluDts(),t=Fr(i,r);si._opt.isEmitSEI&&n&&postMessage({cmd:Z,buffer:n,ts:e},[n.buffer]),Or.doDecode(t,{type:ae,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames(e){let t=[],r=[],i=!1,n=!1;Or.pendingUnits.units&&(t=Or.pendingUnits.units,n=Or.pendingUnits.vcl,i=Or.pendingUnits.iFrame,Or.pendingUnits={});let s={};for(let o of e){if(o.byteLength<4)continue;const e=Xr(o);let a=!1,d=Qr(e);Jr(e)&&(s=this.parseVideo265Header(o),a=!0),t.length&&n&&(s.isfms||!a)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,n=!1),t.push(o),i=i||d,n=n||a}t.length&&(Or.pendingUnits={units:t,vcl:n,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,n=null;if(t.forEach((e=>{const t=e[0]>>>1&63;switch(t){case lt:Or.pps=e;break;case at:Or.sps=e;break;case st:Or.vps=e;break;case ft:case ht:n=e}if(Jr(t)){const t=tr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Or.isSendSeqHeader&&Or.sps&&Or.pps&&Or.vps){Or.isSendSeqHeader=!0;const e=qr({sps:Or.sps,pps:Or.pps,vps:Or.vps});si.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null,Or.vps=null}if(Or.isSendSeqHeader){if(Or.sps&&Or.pps&&Or.vps){const e=qr({sps:Or.sps,pps:Or.pps,vps:Or.vps}),t=Or.localDts;si.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Or.sps=null,Or.pps=null,Or.vps=null}if(i){const e=Or.getNaluDts(),t=Kr(i,r);si._opt.isEmitSEI&&n&&postMessage({cmd:Z,buffer:n,ts:e},[n.buffer]),Or.doDecode(t,{type:ae,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames_1(e){e.forEach((e=>{Or.handleVideoNalu(e)}))},parseVideo264Header(e){const t=new Gn(e);return t.readUByte(),{isfms:0===t.readUEG(),sType:t.readUEG()}},parseVideo265Header(e){const t=new Gn(e);return t.readUByte(),{nalType:t.readBits(6),isfms:0===t.readBits(1),sType:t.readBits(3)}}},Gr={LOG_NAME:"worker fmp4Demuxer",mp4Box:null,offset:0,videoTrackId:null,audioTrackId:null,isHevc:!1,listenMp4Box(){Gr.mp4Box=$i.createFile(),Gr.mp4Box.onReady=Gr.onReady,Gr.mp4Box.onError=Gr.onError,Gr.mp4Box.onSamples=Gr.onSamples},initTransportDescarmber(){Gr.transportDescarmber=new Hi},_getSeqHeader(e){const t=Gr.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new $i.DataStream(void 0,0,$i.DataStream.BIG_ENDIAN);let r=[];e.avcC?(e.avcC.write(t),r=[23,0,0,0,0]):(Gr.isHevc=!0,si.isHevc=!0,e.hvcC.write(t),r=[28,0,0,0,0]);const i=new Uint8Array(t.buffer,8),n=new Uint8Array(r.length+i.length);return n.set(r,0),n.set(i,r.length),n}return null},onReady(e){si.debugLog(Gr.LOG_NAME,"onReady()");const t=e.videoTracks[0],r=e.audioTracks[0];if(t){Gr.videoTrackId=t.id;const e=Gr._getSeqHeader(t);e&&(si.debugLog(Gr.LOG_NAME,"seqHeader"),si.decodeVideo(e,0,!0,0)),Gr.mp4Box.setExtractionOptions(t.id)}if(r&&si._opt.hasAudio){Gr.audioTrackId=r.id;const e=r.audio||{},t=Vt.indexOf(e.sample_rate),i=r.codec.replace("mp4a.40.","");Gr.mp4Box.setExtractionOptions(r.id);const n=jt({profile:parseInt(i,10),sampleRate:t,channel:e.channel_count});si.debugLog(Gr.LOG_NAME,"aacADTSHeader"),si.decodeAudio(n,0)}Gr.mp4Box.start()},onError(e){si.debugError(Gr.LOG_NAME,"mp4Box onError",e)},onSamples(e,t,r){if(e===Gr.videoTrackId){for(const e of r){const t=e.data,r=e.is_sync,i=1e3*e.cts/e.timescale;e.duration,e.timescale,r&&si.calcIframeIntervalTimestamp(i);let n=null;n=Gr.isHevc?Kr(t,r):Fr(t,r),si.decode(n,{type:ae,ts:i,isIFrame:r,cts:0})}Gr.mp4Box.removeUsedSamples(e)}else if(e===Gr.audioTrackId){if(si._opt.hasAudio){for(const e of r){const t=e.data,r=1e3*e.cts/e.timescale;e.duration,e.timescale;const i=new Uint8Array(t.byteLength+2);i.set([175,1],0),i.set(t,2),si.decode(i,{type:oe,ts:r,isIFrame:!1,cts:0})}Gr.mp4Box.removeUsedSamples(e)}}else si.debugWarn(Gr.LOG_NAME,"onSamples() trackId error",e)},dispatch(e){let t=new Uint8Array(e);Gr.transportDescarmber&&(t=Gr.transportDescarmber.transport(t)),t.buffer.fileStart=Gr.offset,Gr.offset+=t.byteLength,Gr.mp4Box.appendBuffer(t.buffer)},destroy(){Gr.mp4Box&&(Gr.mp4Box.stop(),Gr.mp4Box.flush(),Gr.mp4Box.destroy(),Gr.mp4Box=null),Gr.transportDescarmber&&(Gr.transportDescarmber.destroy(),Gr.transportDescarmber=null),Gr.offset=0,Gr.videoTrackId=null,Gr.audioTrackId=null,Gr.isHevc=!1}},jr={LOG_NAME:"worker mpeg4Demuxer",lastBuffer:new Uint8Array(0),parsedOffset:0,firstStartCodeOffset:0,secondStartCodeOffset:0,state:"init",hasInitVideoCodec:!1,localDts:0,dispatch(e){const t=new Uint8Array(e);jr.extractNALu(t)},destroy(){jr.lastBuffer=new Uint8Array(0),jr.parsedOffset=0,jr.firstStartCodeOffset=0,jr.secondStartCodeOffset=0,jr.state="init",jr.hasInitVideoCodec=!1,jr.localDts=0},extractNALu(e){if(!e||e.byteLength<1)return void si.debugWarn(jr.LOG_NAME,"extractNALu() buffer error",e);const t=new Uint8Array(jr.lastBuffer.length+e.length);for(t.set(jr.lastBuffer,0),t.set(new Uint8Array(e),jr.lastBuffer.length),jr.lastBuffer=t;;){if("init"===jr.state){let e=!1;for(;jr.lastBuffer.length-jr.parsedOffset>=4;)if(0===jr.lastBuffer[jr.parsedOffset])if(0===jr.lastBuffer[jr.parsedOffset+1])if(1===jr.lastBuffer[jr.parsedOffset+2]){if(182===jr.lastBuffer[jr.parsedOffset+3]){jr.state="findFirstStartCode",jr.firstStartCodeOffset=jr.parsedOffset,jr.parsedOffset+=4,e=!0;break}jr.parsedOffset++}else jr.parsedOffset++;else jr.parsedOffset++;else jr.parsedOffset++;if(e)continue;break}if("findFirstStartCode"===jr.state){let e=!1;for(;jr.lastBuffer.length-jr.parsedOffset>=4;)if(0===jr.lastBuffer[jr.parsedOffset])if(0===jr.lastBuffer[jr.parsedOffset+1])if(1===jr.lastBuffer[jr.parsedOffset+2]){if(182===jr.lastBuffer[jr.parsedOffset+3]){jr.state="findSecondStartCode",jr.secondStartCodeOffset=jr.parsedOffset,jr.parsedOffset+=4,e=!0;break}jr.parsedOffset++}else jr.parsedOffset++;else jr.parsedOffset++;else jr.parsedOffset++;if(e)continue;break}if("findSecondStartCode"===jr.state){if(!(jr.lastBuffer.length-jr.parsedOffset>0))break;{let e,t,r=192&jr.lastBuffer[jr.parsedOffset];e=0==r?jr.secondStartCodeOffset-14:jr.secondStartCodeOffset;let i=0==(192&jr.lastBuffer[jr.firstStartCodeOffset+4]);if(i){if(jr.firstStartCodeOffset-14<0)return void si.debugWarn(jr.LOG_NAME,"firstStartCodeOffset -14 is",jr.firstStartCodeOffset-14);jr.hasInitVideoCodec||(jr.hasInitVideoCodec=!0,si.debugLog(jr.LOG_NAME,"setCodec"),ai.setCodec(Re,"")),t=jr.lastBuffer.subarray(jr.firstStartCodeOffset-14,e)}else t=jr.lastBuffer.subarray(jr.firstStartCodeOffset,e);let n=jr.getNaluDts();jr.hasInitVideoCodec?(postMessage({cmd:O,type:Be,value:t.byteLength}),postMessage({cmd:O,type:ke,value:n}),Se=n,ai.decode(t,i?1:0,n)):si.debugWarn(jr.LOG_NAME,"has not init video codec"),jr.lastBuffer=jr.lastBuffer.subarray(e),jr.firstStartCodeOffset=0==r?14:0,jr.parsedOffset=jr.firstStartCodeOffset+4,jr.state="findFirstStartCode"}}}},getNaluDts(){let e=jr.localDts;return jr.localDts=jr.localDts+40,e}},ii={TAG_NAME:"worker TsLoaderV2",first_parse_:!0,tsPacketSize:0,syncOffset:0,pmt_:null,config_:null,media_info_:new $n,timescale_:90,duration_:0,pat_:{version_number:0,network_pid:0,program_map_pid:{}},current_program_:null,current_pmt_pid_:-1,program_pmt_map_:{},pes_slice_queues_:{},section_slice_queues_:{},video_metadata_:{vps:null,sps:null,pps:null,details:null},audio_metadata_:{codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},last_pcr_:null,audio_last_sample_pts_:void 0,aac_last_incomplete_data_:null,has_video_:!1,has_audio_:!1,video_init_segment_dispatched_:!1,audio_init_segment_dispatched_:!1,video_metadata_changed_:!1,audio_metadata_changed_:!1,loas_previous_frame:null,video_track_:{type:"video",id:1,sequenceNumber:0,samples:[],length:0},audio_track_:{type:"audio",id:2,sequenceNumber:0,samples:[],length:0},_remainingPacketData:null,init(){},destroy(){ii.media_info_=null,ii.pes_slice_queues_=null,ii.section_slice_queues_=null,ii.video_metadata_=null,ii.audio_metadata_=null,ii.aac_last_incomplete_data_=null,ii.video_track_=null,ii.audio_track_=null,ii._remainingPacketData=null},probe(e){let t=new Uint8Array(e),r=-1,i=188;if(t.byteLength<=3*i)return{needMoreData:!0};for(;-1===r;){let e=Math.min(1e3,t.byteLength-3*i);for(let n=0;n=4&&(r-=4),{match:!0,consumed:0,ts_packet_size:i,sync_offset:r})},_initPmt:()=>({program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}),dispatch(e){ii._remainingPacketData&&(e=fn(ii._remainingPacketData,e),ii._remainingPacketData=null);let t=e.buffer;const r=ii.parseChunks(t);r?ii._remainingPacketData=e.subarray(r):e.length>>6;r[1];let s=(31&r[1])<<8|r[2],o=(48&r[3])>>>4,a=15&r[3],d=!(!ii.pmt_||ii.pmt_.pcr_pid!==s),l={},c=4;if(2==o||3==o){let e=r[4];if(e>0&&(d||3==o)&&(l.discontinuity_indicator=(128&r[5])>>>7,l.random_access_indicator=(64&r[5])>>>6,l.elementary_stream_priority_indicator=(32&r[5])>>>5,(16&r[5])>>>4)){let e=300*(r[6]<<25|r[7]<<17|r[8]<<9|r[9]<<1|r[10]>>>7)+((1&r[10])<<8|r[11]);ii.last_pcr_=e}if(2==o||5+e===188){t+=188,204===ii.tsPacketSize&&(t+=16);continue}c=5+e}if(1==o||3==o)if(0===s||s===ii.current_pmt_pid_||null!=ii.pmt_&&ii.pmt_.pid_stream_type[s]===Fn){let r=188-c;ii.handleSectionSlice(e,t+c,r,{pid:s,payload_unit_start_indicator:n,continuity_conunter:a,random_access_indicator:l.random_access_indicator})}else if(null!=ii.pmt_&&null!=ii.pmt_.pid_stream_type[s]){let r=188-c,i=ii.pmt_.pid_stream_type[s];s!==ii.pmt_.common_pids.h264&&s!==ii.pmt_.common_pids.h265&&s!==ii.pmt_.common_pids.adts_aac&&s!==ii.pmt_.common_pids.loas_aac&&s!==ii.pmt_.common_pids.ac3&&s!==ii.pmt_.common_pids.eac3&&s!==ii.pmt_.common_pids.opus&&s!==ii.pmt_.common_pids.mp3&&!0!==ii.pmt_.pes_private_data_pids[s]&&!0!==ii.pmt_.timed_id3_pids[s]&&!0!==ii.pmt_.synchronous_klv_pids[s]&&!0!==ii.pmt_.asynchronous_klv_pids[s]||ii.handlePESSlice(e,t+c,r,{pid:s,stream_type:i,payload_unit_start_indicator:n,continuity_conunter:a,random_access_indicator:l.random_access_indicator})}t+=188,204===ii.tsPacketSize&&(t+=16)}return ii.dispatchAudioVideoMediaSegment(),t},handleSectionSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=ii.section_slice_queues_[i.pid];if(i.payload_unit_start_indicator){let o=n[0];if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t+1,Math.min(r,o));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?ii.emitSectionSlices(s,i):ii.clearSlices(s,i)}for(let a=1+o;a=s.expected_length&&ii.clearSlices(s,i),a+=d.byteLength}}else if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t,Math.min(r,s.expected_length-s.total_length));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?ii.emitSectionSlices(s,i):s.total_length>=s.expected_length&&ii.clearSlices(s,i)}},handlePESSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=n[0]<<16|n[1]<<8|n[2];n[3];let o=n[4]<<8|n[5];if(i.payload_unit_start_indicator){if(1!==s)return void si.debugWarn(ii.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${s}`);let e=ii.pes_slice_queues_[i.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?ii.emitPESSlices(e,i):ii.clearSlices(e,i)),ii.pes_slice_queues_[i.pid]=new Mn,ii.pes_slice_queues_[i.pid].random_access_indicator=i.random_access_indicator}if(null==ii.pes_slice_queues_[i.pid])return;let a=ii.pes_slice_queues_[i.pid];a.slices.push(n),i.payload_unit_start_indicator&&(a.expected_length=0===o?0:o+6),a.total_length+=n.byteLength,a.expected_length>0&&a.expected_length===a.total_length?ii.emitPESSlices(a,i):a.expected_length>0&&a.expected_length>>6,a=t[8];2!==o&&3!==o||(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,s=3===o?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:r);let d,l=9+a;if(0!==n){if(n<3+a)return void si.debugWarn(ii.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");d=n-3-a}else d=t.byteLength-l;let c=t.subarray(l,l+d);switch(e.stream_type){case Un:case xn:ii.parseMP3Payload(c,r);break;case Bn:ii.pmt_.common_pids.opus===e.pid||ii.pmt_.common_pids.ac3===e.pid||ii.pmt_.common_pids.eac3===e.pid||(ii.pmt_.asynchronous_klv_pids[e.pid]?ii.parseAsynchronousKLVMetadataPayload(c,e.pid,i):ii.pmt_.smpte2038_pids[e.pid]?ii.parseSMPTE2038MetadataPayload(c,r,s,e.pid,i):ii.parsePESPrivateDataPayload(c,r,s,e.pid,i));break;case kn:ii.parseADTSAACPayload(c,r);break;case Tn:ii.parseLOASAACPayload(c,r);break;case Cn:case Dn:break;case Pn:ii.pmt_.timed_id3_pids[e.pid]?ii.parseTimedID3MetadataPayload(c,r,s,e.pid,i):ii.pmt_.synchronous_klv_pids[e.pid]&&ii.parseSynchronousKLVMetadataPayload(c,r,s,e.pid,i);break;case Ln:ii.parseH264Payload(c,r,s,e.random_access_indicator);break;case In:ii.parseH265Payload(c,r,s,e.random_access_indicator)}}else if((188===i||191===i||240===i||241===i||255===i||242===i||248===i)&&e.stream_type===Bn){let r,s=6;r=0!==n?n:t.byteLength-s;let o=t.subarray(s,s+r);ii.parsePESPrivateDataPayload(o,void 0,void 0,e.pid,i)}}else si.debugError(ii.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${r}`)},parsePAT(e){let t=e[0];if(0!==t)return void Log.e(ii.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let r=(15&e[1])<<8|e[2];e[3],e[4];let i=(62&e[5])>>>1,n=1&e[5],s=e[6];e[7];let o=null;if(1===n&&0===s)o={version_number:0,network_pid:0,program_pmt_pid:{}},o.version_number=i;else if(o=ii.pat_,null==o)return;let a=r-5-4,d=-1,l=-1;for(let t=8;t<8+a;t+=4){let r=e[t]<<8|e[t+1],i=(31&e[t+2])<<8|e[t+3];0===r?o.network_pid=i:(o.program_pmt_pid[r]=i,-1===d&&(d=r),-1===l&&(l=i))}1===n&&0===s&&(null==ii.pat_&&si.debugLog(ii.TAG_NAME,`Parsed first PAT: ${JSON.stringify(o)}`),ii.pat_=o,ii.current_program_=d,ii.current_pmt_pid_=l)},parsePMT(e){let t=e[0];if(2!==t)return void si.debugError(ii.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let r,i=(15&e[1])<<8|e[2],n=e[3]<<8|e[4],s=(62&e[5])>>>1,o=1&e[5],a=e[6];if(e[7],1===o&&0===a)r=ii._initPmt(),r.program_number=n,r.version_number=s,ii.program_pmt_map_[n]=r;else if(r=ii.program_pmt_map_[n],null==r)return;r.pcr_pid=(31&e[8])<<8|e[9];let d=(15&e[10])<<8|e[11],l=12+d,c=i-9-d-4;for(let t=l;t0){for(let i=t+5;i0)for(let i=t+5;iii.has_video_&&ii.has_audio_?ii.video_init_segment_dispatched_&&ii.audio_init_segment_dispatched_:ii.has_video_&&!ii.has_audio_?ii.video_init_segment_dispatched_:!(ii.has_video_||!ii.has_audio_)&&ii.audio_init_segment_dispatched_,dispatchVideoInitSegment(){let e=ii.video_metadata_.details,t={type:"video"};t.id=ii.video_track_.id,t.timescale=1e3,t.duration=ii.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;let r=t.frameRate.fps_den,i=t.frameRate.fps_num;if(t.refSampleDuration=r/i*1e3,t.codec=e.codec_mimetype,ii.video_metadata_.vps){si.isHevc=!0;let e=ii.video_metadata_.vps.data.subarray(4),r=ii.video_metadata_.sps.data.subarray(4),i=ii.video_metadata_.pps.data.subarray(4);t.hvcc=qr({vps:e,sps:r,pps:i}),0==ii.video_init_segment_dispatched_&&si.debugLog(ii.TAG_NAME,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.hvcc&&si.decodeVideo(t.hvcc,0,!0,0)}else{let e=ii.video_metadata_.sps.data.subarray(4),r=ii.video_metadata_.pps.data.subarray(4);t.avcc=Dr({sps:e,pps:r}),0==ii.video_init_segment_dispatched_&&si.debugLog(ii.TAG_NAME,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.avcc&&si.decodeVideo(t.avcc,0,!0,0)}ii.video_init_segment_dispatched_=!0,ii.video_metadata_changed_=!1;let n=ii.media_info_;n.hasVideo=!0,n.width=t.codecWidth,n.height=t.codecHeight,n.fps=t.frameRate.fps,n.profile=t.profile,n.level=t.level,n.refFrames=e.ref_frames,n.chromaFormat=e.chroma_format_string,n.sarNum=t.sarRatio.width,n.sarDen=t.sarRatio.height,n.videoCodec=t.codec,n.hasAudio&&n.audioCodec?n.mimeType=`video/mp2t; codecs="${n.videoCodec},${n.audioCodec}"`:n.mimeType=`video/mp2t; codecs="${n.videoCodec}"`},dispatchVideoMediaSegment(){ii.isInitSegmentDispatched()&&ii.video_track_.length&&ii._preDoDecode()},dispatchAudioMediaSegment(){ii.isInitSegmentDispatched()&&ii.audio_track_.length&&ii._preDoDecode()},dispatchAudioVideoMediaSegment(){ii.isInitSegmentDispatched()&&(ii.audio_track_.length||ii.video_track_.length)&&ii._preDoDecode()},parseADTSAACPayload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;if(ii.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+ii.aac_last_incomplete_data_.byteLength);t.set(ii.aac_last_incomplete_data_,0),t.set(e,ii.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/ii.timescale_),"aac"===ii.audio_metadata_.codec){if(null==t&&null!=ii.audio_last_sample_pts_)r=1024/ii.audio_metadata_.sampling_frequency*1e3,i=ii.audio_last_sample_pts_+r;else if(null==t)return void si.debugWarn(ii.TAG_NAME,"AAC: Unknown pts");if(ii.aac_last_incomplete_data_&&ii.audio_last_sample_pts_){r=1024/ii.audio_metadata_.sampling_frequency*1e3;let e=ii.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(si.debugWarn(ii.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Zt(e),o=null,a=i;for(;null!=(o=s.readNextAACFrame());){r=1024/o.sampling_frequency*1e3;const e={codec:"aac",data:o};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"aac",audio_object_type:o.audio_object_type,sampling_freq_index:o.sampling_freq_index,sampling_frequency:o.sampling_frequency,channel_config:o.channel_config},ii.dispatchAudioInitSegment(e)):ii.detectAudioMetadataChange(e)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(e)),n=a;let t=Math.floor(a);const i=new Uint8Array(o.data.length+2);i.set([175,1],0),i.set(o.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:oe};ii.audio_track_.samples.push(s),ii.audio_track_.length+=i.byteLength,a+=r}s.hasIncompleteData()&&(ii.aac_last_incomplete_data_=s.getIncompleteData()),n&&(ii.audio_last_sample_pts_=n)},parseLOASAACPayload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;if(ii.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+ii.aac_last_incomplete_data_.byteLength);t.set(ii.aac_last_incomplete_data_,0),t.set(e,ii.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/ii.timescale_),"aac"===ii.audio_metadata_.codec){if(null==t&&null!=ii.audio_last_sample_pts_)r=1024/ii.audio_metadata_.sampling_frequency*1e3,i=ii.audio_last_sample_pts_+r;else if(null==t)return void si.debugWarn(ii.TAG_NAME,"AAC: Unknown pts");if(ii.aac_last_incomplete_data_&&ii.audio_last_sample_pts_){r=1024/ii.audio_metadata_.sampling_frequency*1e3;let e=ii.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(si.debugWarn(ii.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Jt(e),o=null,a=i;for(;null!=(o=s.readNextAACFrame(ar(this.loas_previous_frame)?void 0:this.loas_previous_frame));){ii.loas_previous_frame=o,r=1024/o.sampling_frequency*1e3;const e={codec:"aac",data:o};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"aac",audio_object_type:o.audio_object_type,sampling_freq_index:o.sampling_freq_index,sampling_frequency:o.sampling_frequency,channel_config:o.channel_config},ii.dispatchAudioInitSegment(e)):ii.detectAudioMetadataChange(e)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(e)),n=a;let t=Math.floor(a);const i=new Uint8Array(o.data.length+2);i.set([175,1],0),i.set(o.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:oe};ii.audio_track_.samples.push(s),ii.audio_track_.length+=i.byteLength,a+=r}s.hasIncompleteData()&&(ii.aac_last_incomplete_data_=s.getIncompleteData()),n&&(ii.audio_last_sample_pts_=n)},parseAC3Payload(e,t){},parseEAC3Payload(e,t){},parseOpusPayload(e,t){},parseMP3Payload(e,t){if(ii.has_video_&&!ii.video_init_segment_dispatched_)return;let r=[44100,48e3,32e3,0],i=[22050,24e3,16e3,0],n=[11025,12e3,8e3,0],s=e[1]>>>3&3,o=(6&e[1])>>1;e[2];let a=(12&e[2])>>>2,d=3!=(e[3]>>>6&3)?2:1,l=0,c=34;switch(s){case 0:l=n[a];break;case 2:l=i[a];break;case 3:l=r[a]}switch(o){case 1:c=34;break;case 2:c=33;break;case 3:c=32}const u={};u.object_type=c,u.sample_rate=l,u.channel_count=d,u.data=e;const h={codec:"mp3",data:u};0==ii.audio_init_segment_dispatched_?(ii.audio_metadata_={codec:"mp3",object_type:c,sample_rate:l,channel_count:d},ii.dispatchAudioInitSegment(h)):ii.detectAudioMetadataChange(h)&&(ii.dispatchAudioMediaSegment(),ii.dispatchAudioInitSegment(h));let f={payload:e,length:e.byteLength,pts:t/ii.timescale_,dts:t/ii.timescale_,type:oe};ii.audio_track_.samples.push(f),ii.audio_track_.length+=e.byteLength},detectAudioMetadataChange(e){if(e.codec!==ii.audio_metadata_.codec)return si.debugLog(ii.TAG_NAME,`Audio: Audio Codecs changed from ${ii.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===ii.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==ii.audio_metadata_.audio_object_type)return si.debugLog(ii.TAG_NAME,`AAC: AudioObjectType changed from ${ii.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==ii.audio_metadata_.sampling_freq_index)return si.debugLog(ii.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==ii.audio_metadata_.channel_config)return si.debugLog(ii.TAG_NAME,`AAC: Channel configuration changed from ${ii.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===ii.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==ii.audio_metadata_.sampling_frequency)return si.debugLog(ii.TAG_NAME,`AC3: Sampling Frequency changed from ${ii.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==ii.audio_metadata_.bit_stream_identification)return si.debugLog(ii.TAG_NAME,`AC3: Bit Stream Identification changed from ${ii.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==ii.audio_metadata_.bit_stream_mode)return si.debugLog(ii.TAG_NAME,`AC3: BitStream Mode changed from ${ii.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==ii.audio_metadata_.channel_mode)return si.debugLog(ii.TAG_NAME,`AC3: Channel Mode changed from ${ii.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==ii.audio_metadata_.low_frequency_effects_channel_on)return si.debugLog(ii.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${ii.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===ii.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==ii.audio_metadata_.sample_rate)return si.debugLog(ii.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==ii.audio_metadata_.channel_count)return si.debugLog(ii.TAG_NAME,`Opus: Channel count changed from ${ii.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===ii.audio_metadata_.codec){const t=e.data;if(t.object_type!==ii.audio_metadata_.object_type)return si.debugLog(ii.TAG_NAME,`MP3: AudioObjectType changed from ${ii.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==ii.audio_metadata_.sample_rate)return si.debugLog(ii.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${ii.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==ii.audio_metadata_.channel_count)return si.debugLog(ii.TAG_NAME,`MP3: Channel count changed from ${ii.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1},dispatchAudioInitSegment(e){let t={type:"audio"};if(t.id=ii.audio_track_.id,t.timescale=1e3,t.duration=ii.duration_,"aac"===ii.audio_metadata_.codec){let r="aac"===e.codec?e.data:null,i=new On(r);t.audioSampleRate=i.sampling_rate,t.audioSampleRateIndex=i.sampling_index,t.channelCount=i.channel_count,t.codec=i.codec_mimetype,t.originalCodec=i.original_codec_mimetype,t.config=i.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale;const n=jt({profile:si._opt.mseDecodeAudio?i.object_type:i.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});si.decodeAudio(n,0)}else"ac-3"===ii.audio_metadata_.codec||"ec-3"===ii.audio_metadata_.codec||"opus"===ii.audio_metadata_.codec||"mp3"===ii.audio_metadata_.codec&&(t.audioSampleRate=ii.audio_metadata_.sample_rate,t.channelCount=ii.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==ii.audio_init_segment_dispatched_&&si.debugLog(ii.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),ii.audio_init_segment_dispatched_=!0,ii.video_metadata_changed_=!1;let r=ii.media_info_;r.hasAudio=!0,r.audioCodec=t.originalCodec,r.audioSampleRate=t.audioSampleRate,r.audioChannelCount=t.channelCount,r.hasVideo&&r.videoCodec?r.mimeType=`video/mp2t; codecs="${r.videoCodec},${r.audioCodec}"`:r.mimeType=`video/mp2t; codecs="${r.audioCodec}"`},dispatchPESPrivateDataDescriptor(e,t,r){},parsePESPrivateDataPayload(e,t,r,i,n){let s=new zn;if(s.pid=i,s.stream_id=n,s.len=e.byteLength,s.data=e,null!=t){let e=Math.floor(t/ii.timescale_);s.pts=e}else s.nearest_pts=ii.getNearestTimestampMilliseconds();if(null!=r){let e=Math.floor(r/ii.timescale_);s.dts=e}},parseTimedID3MetadataPayload(e,t,r,i,n){si.debugLog(ii.TAG_NAME,`Timed ID3 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseSynchronousKLVMetadataPayload(e,t,r,i,n){si.debugLog(ii.TAG_NAME,`Synchronous KLV Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseAsynchronousKLVMetadataPayload(e,t,r){si.debugLog(ii.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${r}`)},parseSMPTE2038MetadataPayload(e,t,r,i,n){si.debugLog(ii.TAG_NAME,`SMPTE 2038 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},getNearestTimestampMilliseconds:()=>null!=ii.audio_last_sample_pts_?Math.floor(ii.audio_last_sample_pts_):null!=ii.last_pcr_?Math.floor(ii.last_pcr_/300/ii.timescale_):void 0,_preDoDecode(){const e=ii.video_track_,t=ii.audio_track_;let r=e.samples;t.samples.length>0&&(r=e.samples.concat(t.samples),r=r.sort(((e,t)=>e.dts-t.dts))),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===ae?ii._doDecodeVideo({...e,payload:t}):e.type===oe&&ii._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0},_doDecodeVideo(e){const t=new Uint8Array(e.payload);let r=null;r=e.isHevc?Kr(t,e.isIFrame):Fr(t,e.isIFrame),e.isIFrame&&si.calcIframeIntervalTimestamp(e.dts);let i=si.cryptoPayload(r,e.isIFrame);si.decode(i,{type:ae,ts:e.dts,isIFrame:e.isIFrame,cts:e.cts})},_doDecodeAudio(e){const t=new Uint8Array(e.payload);let r=t;gr(si._opt.m7sCryptoAudio)&&(r=si.cryptoPayloadAudio(t)),si.decode(r,{type:oe,ts:e.dts,isIFrame:!1,cts:0})}},ni=null;vr()&&(ni={TAG_NAME:"worker MediaSource",_resetInIt(){ni.isAvc=null,ni.isAAC=null,ni.videoInfo={},ni.videoMeta={},ni.audioMeta={},ni.sourceBuffer=null,ni.audioSourceBuffer=null,ni.hasInit=!1,ni.hasAudioInit=!1,ni.isAudioInitInfo=!1,ni.videoMimeType="",ni.audioMimeType="",ni.cacheTrack={},ni.cacheAudioTrack={},ni.timeInit=!1,ni.sequenceNumber=0,ni.audioSequenceNumber=0,ni.firstRenderTime=null,ni.firstAudioTime=null,ni.mediaSourceAppendBufferFull=!1,ni.mediaSourceAppendBufferError=!1,ni.mediaSourceAddSourceBufferError=!1,ni.mediaSourceBufferError=!1,ni.mediaSourceError=!1,ni.prevTimestamp=null,ni.decodeDiffTimestamp=null,ni.prevDts=null,ni.prevAudioDts=null,ni.prevPayloadBufferSize=0,ni.isWidthOrHeightChanged=!1,ni.prevTs=null,ni.prevAudioTs=null,ni.eventListenList=[],ni.pendingRemoveRanges=[],ni.pendingSegments=[],ni.pendingAudioRemoveRanges=[],ni.pendingAudioSegments=[],ni.supportVideoFrameCallbackHandle=null,ni.audioSourceBufferCheckTimeout=null,ni.audioSourceNoDataCheckTimeout=null,ni.hasPendingEos=!1,ni.$video={currentTime:0,readyState:0}},init(){ni.events=new pn,ni._resetInIt(),ni.mediaSource=new self.MediaSource,ni.isDecodeFirstIIframe=!!yr(si._opt.checkFirstIFrame),ni._bindMediaSourceEvents()},destroy(){ni.stop(),ni._clearAudioSourceBufferCheckTimeout(),ni.eventListenList&&ni.eventListenList.length&&(ni.eventListenList.forEach((e=>e())),ni.eventListenList=[]),ni._resetInIt(),ni.mediaSource=null},getState:()=>ni.mediaSource&&ni.mediaSource.readyState,isStateOpen:()=>ni.getState()===vt,isStateClosed:()=>ni.getState()===bt,isStateEnded:()=>ni.getState()===yt,_bindMediaSourceEvents(){const{proxy:e}=ni.events,t=e(ni.mediaSource,St,(()=>{si.debugLog(ni.TAG_NAME,"sourceOpen"),ni._onMediaSourceSourceOpen()})),r=e(ni.mediaSource,wt,(()=>{si.debugLog(ni.TAG_NAME,"sourceClose")})),i=e(ni.mediaSource,Et,(()=>{si.debugLog(ni.TAG_NAME,"sourceended")}));ni.eventListenList.push(t,r,i)},_onMediaSourceSourceOpen(){ni.sourceBuffer||(si.debugLog(ni.TAG_NAME,"onMediaSourceSourceOpen() sourceBuffer is null and next init"),ni._initSourceBuffer()),ni.audioSourceBuffer||(si.debugLog(ni.TAG_NAME,"onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),ni._initAudioSourceBuffer()),ni._hasPendingSegments()&&ni._doAppendSegments()},decodeVideo(e,t,r,i){if(si.isDestroyed)si.debugWarn(ni.TAG_NAME,"decodeVideo() and decoder is destroyed");else if(yr(ni.hasInit))if(r&&e[1]===Bt){const i=15&e[0];if(i===Me&&yr(si._opt.supportMSEDecodeHevc))return void ni.emitError(Fe.mediaSourceH265NotSupport);ni.videoInfo.codec=i,postMessage({cmd:M,code:i});const n=new Uint8Array(e);postMessage({cmd:R,buffer:n,codecId:i},[n.buffer]),ni.hasInit=ni._decodeConfigurationRecord(e,t,r,i)}else si.debugWarn(ni.TAG_NAME,`decodeVideo has not init , isIframe is ${r} , payload is ${e[1]} so drop this frame`);else if(!ni.isDecodeFirstIIframe&&r&&(ni.isDecodeFirstIIframe=!0),ni.isDecodeFirstIIframe){if(r&&0===e[1]){const t=15&e[0];let r={};t===Ie?r=Tr(e.slice(5)):t===Me&&(r=Wr(e));const i=ni.videoInfo;i&&i.codecWidth&&i.codecWidth&&r&&r.codecWidth&&r.codecHeight&&(r.codecWidth!==i.codecWidth||r.codecHeight!==i.codecWidth)&&(si.debugWarn(ni.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${i.codecWidth}, old height is ${i.codecHeight},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),ni.isWidthOrHeightChanged=!0,ni.emitError(Fe.mseWidthOrHeightChange,`width: ${i.codecWidth}->${r.codecWidth}, height: ${i.codecWidth}->${r.codecHeight}`))}if(ni.isWidthOrHeightChanged)return void si.debugWarn(ni.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(_r(e))return void si.debugLog(ni.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLengthni.prevTs>0&&eA,_decodeConfigurationRecord(e,t,r,i){let n=e.slice(5),s={};if(i===Ie?s=Tr(n):i===Me&&(s=Vr(n)),ni.videoInfo.width=s.codecWidth,ni.videoInfo.height=s.codecHeight,0===s.codecWidth&&0===s.codecHeight)return si.debugWarn(ni.TAG_NAME,"_decodeConfigurationRecord error",JSON.stringify(s)),ni.emitError(Fe.mediaSourceDecoderConfigurationError,`width is ${0===s.codecWidth} and height is ${s.codecHeight}`),!1;const o={id:Ft,type:"video",timescale:1e3,duration:0,avcc:n,codecWidth:s.codecWidth,codecHeight:s.codecHeight,videoType:s.videoType},a=mn.generateInitSegment(o);ni.isAvc=i===Ie;let d=s.codec;return ni.videoMimeType=d?`video/mp4; codecs="${s.codec}"`:ni.isAvc?_t:gt,postMessage({cmd:T,w:s.codecWidth,h:s.codecHeight}),ni._initSourceBuffer(),ni.appendBuffer(a.buffer),ni.sequenceNumber=0,ni.cacheTrack={},ni.timeInit=!1,!0},_decodeAudioConfigurationRecord(e,t){const r=e[0]>>4,i=e[0]>>1&1,n=r===He,s=r===$e;if(yr(s||n))return si.debugWarn(ni.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${r} ant auto wasm decode`),ni.emitError(Fe.mediaSourceAudioG711NotSupport),!1;const o={id:Lt,type:"audio",timescale:1e3};let a={};if(qt(e)){if(a=Xt(e.slice(2)),!a)return!1;o.audioSampleRate=a.sampleRate,o.channelCount=a.channelCount,o.config=a.config,o.refSampleDuration=1024/o.audioSampleRate*o.timescale}else{if(!n)return!1;if(a=An(e),!a)return!1;o.audioSampleRate=a.samplingRate,o.channelCount=a.channelCount,o.refSampleDuration=1152/o.audioSampleRate*o.timescale}o.codec=a.codec,o.duration=0;let d="mp4",l=a.codec,c=null;n&&yr(si._opt.isFirefox)?(d="mpeg",l="",c=new Uint8Array):c=mn.generateInitSegment(o);let u=`${o.type}/${d}`;return l&&l.length>0&&(u+=`;codecs=${l}`),yr(ni.isAudioInitInfo)&&(wr=r===$e?i?16:8:0===i?8:16,postMessage({cmd:F,code:r}),postMessage({cmd:P,sampleRate:o.audioSampleRate,channels:o.channelCount,depth:wr}),ni.isAudioInitInfo=!0),ni.audioMimeType=u,ni.isAAC=s,ni._initAudioSourceBuffer(),ni.appendAudioBuffer(c.buffer),!0},_initSourceBuffer(){const{proxy:e}=ni.events;if(null===ni.sourceBuffer&&null!==ni.mediaSource&&ni.isStateOpen()&&ni.videoMimeType){try{si.debugLog(ni.TAG_NAME,"_initSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",ni.videoMimeType),ni.sourceBuffer=ni.mediaSource.addSourceBuffer(ni.videoMimeType)}catch(e){return si.debugError(ni.TAG_NAME,"_initSourceBuffer() appendBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),ni.emitError(Fe.mseWorkerAddSourceBufferError,e.code),void(ni.mediaSourceAddSourceBufferError=!0)}if(ni.sourceBuffer){const t=e(ni.sourceBuffer,"error",(e=>{ni.mediaSourceBufferError=!0,si.debugError(ni.TAG_NAME,"mseSourceBufferError mseDecoder.sourceBuffer",e,e.toString()),ni.emitError(Fe.mseSourceBufferError,e.code)})),r=e(ni.sourceBuffer,"updateend",(()=>{ni._hasPendingRemoveRanges()?ni._doRemoveRanges():ni._hasPendingSegments()?ni._doAppendSegments():ni.hasPendingEos&&(si.debugLog(ni.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),ni.endOfStream())}));ni.eventListenList.push(t,r)}}else si.debugLog(ni.TAG_NAME,`_initSourceBuffer and mseDecoder.isStateOpen is ${ni.isStateOpen()} and mseDecoder.isAvc === null is ${null===ni.isAvc}`)},_initAudioSourceBuffer(){const{proxy:e}=ni.events;if(null===ni.audioSourceBuffer&&null!==ni.mediaSource&&ni.isStateOpen()&&ni.audioMimeType){try{si.debugLog(ni.TAG_NAME,"_initAudioSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",ni.audioMimeType),ni._clearAudioSourceBufferCheckTimeout(),ni.audioSourceBuffer=ni.mediaSource.addSourceBuffer(ni.audioMimeType)}catch(e){return si.debugError(ni.TAG_NAME,"_initAudioSourceBuffer() addSourceBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),ni.emitError(Fe.mseWorkerAddSourceBufferError,e.code),void(ni.mediaSourceAddSourceBufferError=!0)}if(ni.audioSourceBuffer){const t=e(ni.audioSourceBuffer,"error",(e=>{ni.mediaSourceBufferError=!0,si.debugError(ni.TAG_NAME,"mseSourceBufferError mseDecoder.audioSourceBuffer",e.code,e.toString(),e),ni.emitError(Fe.mseSourceBufferError,e.code)})),r=e(ni.audioSourceBuffer,"updateend",(()=>{ni._hasPendingRemoveRanges()?ni._doRemoveRanges():ni._hasPendingSegments()?ni._doAppendSegments():ni.hasPendingEos&&(si.debugLog(ni.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),ni.endOfStream())}));ni.eventListenList.push(t,r),null===ni.audioSourceNoDataCheckTimeout&&(ni.audioSourceNoDataCheckTimeout=setTimeout((()=>{ni._clearAudioNoDataCheckTimeout(),ni.emitError(Fe.mediaSourceAudioNoDataTimeout)}),1e3))}}else si.debugLog(ni.TAG_NAME,`_initAudioSourceBuffer and mseDecoder.isStateOpen is ${ni.isStateOpen()} and mseDecoder.audioMimeType is ${ni.audioMimeType}`)},_decodeVideo(e,t,r,i,n){let s=e.slice(5),o=s.byteLength;if(0===o)return void si.debugWarn(ni.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let a=(new Date).getTime(),d=!1;ni.prevTimestamp||(ni.prevTimestamp=a,d=!0);const l=a-ni.prevTimestamp;if(ni.decodeDiffTimestamp=l,l>1e3&&!d&&si.isPlayer&&si.debugLog(ni.TAG_NAME,`_decodeVideo now time is ${a} and prev time is ${ni.prevTimestamp}, diff time is ${l} ms`),ni.cacheTrack.id&&t>=ni.cacheTrack.dts){let e=8+ni.cacheTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(mn.types.mdat,4),r.set(ni.cacheTrack.data,8),ni.cacheTrack.duration=t-ni.cacheTrack.dts;let i=mn.moof(ni.cacheTrack,ni.cacheTrack.dts);ni.cacheTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),ni.appendBuffer(n.buffer)}else si.debugLog(ni.TAG_NAME,`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${n} cacheTrack dts is ${ni.cacheTrack&&ni.cacheTrack.dts}`),ni.timeInit=!1,ni.cacheTrack={};ni.cacheTrack||(ni.cacheTrack={}),ni.cacheTrack.id=Ft,ni.cacheTrack.sequenceNumber=++ni.sequenceNumber,ni.cacheTrack.size=o,ni.cacheTrack.dts=t,ni.cacheTrack.cts=i,ni.cacheTrack.isKeyframe=r,ni.cacheTrack.data=s,ni.cacheTrack.flags={isLeading:0,dependsOn:r?2:1,isDependedOn:r?1:0,hasRedundancy:0,isNonSync:r?0:1},ni.prevTimestamp=(new Date).getTime()},_decodeAudio(e,t,r){let i=ni.isAAC?e.slice(2):e.slice(1),n=i.byteLength;if(ni.cacheAudioTrack.id&&t>=ni.cacheAudioTrack.dts){let e=8+ni.cacheAudioTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(mn.types.mdat,4),r.set(ni.cacheAudioTrack.data,8),ni.cacheAudioTrack.duration=t-ni.cacheAudioTrack.dts;let i=mn.moof(ni.cacheAudioTrack,ni.cacheAudioTrack.dts);ni.cacheAudioTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),ni.appendAudioBuffer(n.buffer)}else ni.cacheAudioTrack={};ni.cacheAudioTrack||(ni.cacheAudioTrack={}),ni.cacheAudioTrack.id=Lt,ni.cacheAudioTrack.sequenceNumber=++ni.audioSequenceNumber,ni.cacheAudioTrack.size=n,ni.cacheAudioTrack.dts=t,ni.cacheAudioTrack.cts=0,ni.cacheAudioTrack.data=i,ni.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}},appendBuffer(e){si.isDestroyed?si.debugWarn(ni.TAG_NAME,"appendBuffer() player is destroyed"):ni.mediaSourceAddSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):ni.mediaSourceAppendBufferFull?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):ni.mediaSourceAppendBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):ni.mediaSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(ni.pendingSegments.push(e),ni.sourceBuffer&&(si._opt.mseAutoCleanupSourceBuffer&&ni._needCleanupSourceBuffer()&&ni._doCleanUpSourceBuffer(),yr(ni.getSourceBufferUpdating())&&ni.isStateOpen()&&yr(ni._hasPendingRemoveRanges()))?ni._doAppendSegments():ni.isStateClosed()?(ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):ni.isStateEnded()&&(ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,"mediaSource is end")))},appendAudioBuffer(e){si.isDestroyed?si.debugWarn(ni.TAG_NAME,"appendAudioBuffer() player is destroyed"):ni.mediaSourceAddSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):ni.mediaSourceAppendBufferFull?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):ni.mediaSourceAppendBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):ni.mediaSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(ni.pendingAudioSegments.push(e),ni.audioSourceBuffer&&(si._opt.mseAutoCleanupSourceBuffer&&ni._needCleanupSourceBuffer()&&ni._doCleanUpSourceBuffer(),yr(ni.getAudioSourceBufferUpdating())&&ni.isStateOpen()&&yr(ni._hasPendingRemoveRanges()))?ni._doAppendSegments():ni.isStateClosed()?(ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):ni.isStateEnded()&&(ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,"mediaSource is end")))},getSourceBufferUpdating:()=>ni.sourceBuffer&&ni.sourceBuffer.updating,getAudioSourceBufferUpdating:()=>ni.audioSourceBuffer&&ni.audioSourceBuffer.updating,stop(){ni.abortSourceBuffer(),ni.removeSourceBuffer(),ni.endOfStream()},clearUpAllSourceBuffer(){if(ni.sourceBuffer){const e=ni.sourceBuffer.buffered;for(let t=0;tni.pendingSegments.length>0||ni.pendingAudioSegments.length>0,getPendingSegmentsLength:()=>ni.pendingSegments.length,_handleUpdatePlaybackRate(){},_doAppendSegments(){if(ni.isStateClosed()||ni.isStateEnded())si.debugLog(ni.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==ni.sourceBuffer){if(ni.needInitAudio()&&null===ni.audioSourceBuffer)return si.debugLog(ni.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===ni.audioSourceBufferCheckTimeout&&(ni.audioSourceBufferCheckTimeout=setTimeout((()=>{ni._clearAudioSourceBufferCheckTimeout(),ni.emitError(Fe.mediaSourceAudioInitTimeout)}),1e3)));if(yr(ni.getSourceBufferUpdating())&&ni.pendingSegments.length>0){const e=ni.pendingSegments.shift();try{ni.sourceBuffer.appendBuffer(e)}catch(e){si.debugError(ni.TAG_NAME,"mseDecoder.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(ni.stop(),ni.mediaSourceAppendBufferFull=!0,ni.emitError(Fe.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(ni.stop(),ni.mediaSourceAppendBufferError=!0,ni.emitError(Fe.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(ni.stop(),ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,`code is ${e.code} , message is ${e.message}`))}}if(yr(ni.getAudioSourceBufferUpdating())&&ni.pendingAudioSegments.length>0){const e=ni.pendingAudioSegments.shift();try{ni.audioSourceBuffer.appendBuffer(e)}catch(e){si.debugError(ni.TAG_NAME,"mseDecoder.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(ni.stop(),ni.mediaSourceAppendBufferFull=!0,ni.emitError(Fe.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(ni.stop(),ni.mediaSourceAppendBufferError=!0,ni.emitError(Fe.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(ni.stop(),ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,e.code,`code is ${e.code} , message is ${e.message}`))}}}else si.debugLog(ni.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")},_doCleanUpSourceBuffer(){const e=ni.$video.currentTime;if(ni.sourceBuffer){const t=ni.sourceBuffer.buffered;let r=!1;for(let i=0;i=si._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-si._opt.mseAutoCleanupMinBackwardDuration;ni.pendingRemoveRanges.push({start:n,end:t})}}else s=si._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-si._opt.mseAutoCleanupMinBackwardDuration;ni.pendingAudioRemoveRanges.push({start:n,end:t})}}else sni.pendingRemoveRanges.length>0||ni.pendingAudioRemoveRanges.length>0,needInitAudio:()=>si._opt.hasAudio&&si._opt.mseDecodeAudio,_doRemoveRanges(){if(ni.sourceBuffer&&yr(ni.getSourceBufferUpdating())){let e=ni.pendingRemoveRanges;for(;e.length&&yr(ni.getSourceBufferUpdating());){let t=e.shift();try{ni.sourceBuffer.remove(t.start,t.end)}catch(e){si.debugWarn(ni.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e,e.toString())}}}if(ni.audioSourceBuffer&&yr(ni.getAudioSourceBufferUpdating())){let e=ni.pendingAudioRemoveRanges;for(;e.length&&yr(ni.getAudioSourceBufferUpdating());){let t=e.shift();try{ni.audioSourceBuffer.remove(t.start,t.end)}catch(e){si.debugWarn(ni.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e,e.toString())}}}},_getPlaybackRate(){},_needCleanupSourceBuffer(){if(yr(si._opt.mseAutoCleanupSourceBuffer))return!1;const e=ni.$video.currentTime;if(ni.sourceBuffer){let t=ni.sourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=si._opt.mseAutoCleanupMaxBackwardDuration)return!0}if(ni.audioSourceBuffer){let t=ni.audioSourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=si._opt.mseAutoCleanupMaxBackwardDuration)return!0}return!1},_clearAudioSourceBufferCheckTimeout(){ni.audioSourceBufferCheckTimeout&&(clearTimeout(ni.audioSourceBufferCheckTimeout),ni.audioSourceBufferCheckTimeout=null)},_clearAudioNoDataCheckTimeout(){ni.audioSourceNoDataCheckTimeout&&(clearTimeout(ni.audioSourceNoDataCheckTimeout),ni.audioSourceNoDataCheckTimeout=null)},getHandle:()=>ni.mediaSource.handle,emitError(e){postMessage({cmd:se,value:e,msg:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""})}});let si={isPlayer:!0,isHevc:null,isPlayback:!1,dropping:!1,isPushDropping:!1,isWorkerFetch:!1,isDestroyed:!1,fetchStatus:Ct,_opt:Ar(),mp3Demuxer:null,delay:-1,pushLatestDelay:-1,firstTimestamp:null,startTimestamp:null,preDelayTimestamp:null,stopId:null,streamFps:null,streamAudioFps:null,streamVideoFps:null,writableStream:null,networkDelay:0,webglObj:null,startStreamRateAndStatsInterval:function(){si.stopStreamRateAndStatsInterval(),l=setInterval((()=>{d&&d(0);const e=JSON.stringify({demuxBufferDelay:si.getVideoBufferLength(),audioDemuxBufferDelay:si.getAudioBufferLength(),streamBufferByteLength:si.getStreamBufferLength(),netBuf:si.networkDelay||0,pushLatestDelay:si.pushLatestDelay||0,latestDelay:si.delay,isStreamTsMoreThanLocal:je,wasmDecodeDelay:Se-Ee});postMessage({cmd:O,type:Ce,value:e})}),1e3)},stopStreamRateAndStatsInterval:function(){l&&(clearInterval(l),l=null)},useOffscreen:function(){return si._opt.useOffscreen&&"undefined"!=typeof OffscreenCanvas},getDelay:function(e,t){if(!e||si._opt.hasVideo&&!B)return-1;if(t===oe)return si.delay;if(si.preDelayTimestamp&&si.preDelayTimestamp>e)return si.preDelayTimestamp-e>1e3&&si.debugWarn("worker",`getDelay() and preDelayTimestamp is ${si.preDelayTimestamp} > timestamp is ${e} more than ${si.preDelayTimestamp-e}ms and return ${si.delay}`),si.preDelayTimestamp=e,si.delay;if(si.firstTimestamp){if(e){const t=Date.now()-si.startTimestamp,r=e-si.firstTimestamp;t>=r?(je=!1,si.delay=t-r):(je=!0,si.delay=r-t)}}else si.firstTimestamp=e,si.startTimestamp=Date.now(),si.delay=-1;return si.preDelayTimestamp=e,si.delay},getDelayNotUpdateDelay:function(e,t){if(!e||si._opt.hasVideo&&!B)return-1;if(t===oe)return si.pushLatestDelay;if(si.preDelayTimestamp&&si.preDelayTimestamp-e>1e3)return si.debugWarn("worker",`getDelayNotUpdateDelay() and preDelayTimestamp is ${si.preDelayTimestamp} > timestamp is ${e} more than ${si.preDelayTimestamp-e}ms and return -1`),-1;if(si.firstTimestamp){let t=-1;if(e){const r=Date.now()-si.startTimestamp,i=e-si.firstTimestamp;r>=i?(je=!1,t=r-i):(je=!0,t=i-r)}return t}return-1},resetDelay:function(){si.firstTimestamp=null,si.startTimestamp=null,si.delay=-1,si.dropping=!1},resetAllDelay:function(){si.resetDelay(),si.preDelayTimestamp=null},doDecode:function(e){si._opt.isEmitSEI&&e.type===ae&&si.isWorkerFetch&&si.findSei(e.payload,e.ts),si.isPlayUseMSEAndDecoderInWorker()?e.type===oe?si._opt.mseDecodeAudio?ni.decodeAudio(e.payload,e.ts):e.decoder.decode(e.payload,e.ts):e.type===ae&&ni.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):si._opt.useWCS&&si.useOffscreen()&&e.type===ae&&s.decode?s.decode(e.payload,e.ts,e.cts):e.decoder.decode(e.payload,e.ts,e.isIFrame,e.cts)},decodeNext(e){if(0===i.length)return;const t=e.ts,n=i[0],s=e.type===ae&&_r(e.payload);if(yr(r))s&&(si.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n isVideoSqeHeader is ${s}`),i.shift(),si.doDecode(n));else{const r=n.ts-t,o=n.type===oe&&e.type===ae;(r<=20||o||s)&&(si.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n diff is ${r} and isVideoAndNextAudio is ${o} and isVideoSqeHeader is ${s}`),i.shift(),si.doDecode(n))}},init:function(){si.debugLog("worker","init and opt is",JSON.stringify(si._opt));const e=si._opt.playType===v,t=si._opt.playType===b;if(Or.init(),si.isPlayer=e,si.isPlayback=t,si.isPlayUseMSEAndDecoderInWorker()&&ni&&ni.init(),s&&si._opt.useWCS&&si.useOffscreen()&&s.init(),yr(si.isPlaybackCacheBeforeDecodeForFpsRender())){si.debugLog("worker","setInterval()");const t=()=>{const t=si._opt.videoBuffer+si._opt.videoBufferDelay;let r=null;if(i.length){if(si.isPushDropping)return void si.debugWarn("worker",`loop() isPushDropping is true and bufferList length is ${i.length}`);if(si.dropping){for(r=i.shift(),si.debugWarn("worker",`loop() dropBuffer is dropping and isIFrame ${r.isIFrame} and delay is ${si.delay} and bufferlist is ${i.length}`);!r.isIFrame&&i.length;)r=i.shift();const e=si.getDelayNotUpdateDelay(r.ts,r.type);r.isIFrame&&e<=si.getNotDroppingDelayTs()&&(si.debugLog("worker","loop() is dropping = false, is iFrame"),si.dropping=!1,si.doDecode(r),si.decodeNext(r))}else if(si.isPlayback||si.isPlayUseMSE()||0===si._opt.videoBuffer)for(;i.length;)r=i.shift(),si.doDecode(r);else if(r=i[0],-1===si.getDelay(r.ts,r.type))si.debugLog("worker","loop() common dumex delay is -1 ,data.ts is",r.ts),i.shift(),si.doDecode(r),si.decodeNext(r);else if(si.delay>t&&e)si.hasIframeInBufferList()?(si.debugLog("worker",`delay is ${si.delay} > maxDelay ${t}, set dropping is true`),si.resetAllDelay(),si.dropping=!0,postMessage({cmd:H})):(i.shift(),si.doDecode(r),si.decodeNext(r));else for(;i.length;){if(r=i[0],!(si.getDelay(r.ts,r.type)>si._opt.videoBuffer)){si.delay<0&&si.debugWarn("worker",`loop() do not decode and delay is ${si.delay}, bufferList is ${i.length}`);break}i.shift(),si.doDecode(r)}}else-1!==si.delay&&si.debugLog("worker","loop() bufferList is empty and reset delay"),si.resetAllDelay()};si.stopId=setInterval((()=>{let e=(new Date).getTime();Je||(Je=e);const r=e-Je;r>100&&si.debugWarn("worker",`loop demux diff time is ${r}`),t(),Je=(new Date).getTime()}),20)}else si.debugLog("worker","playback and playbackIsCacheBeforeDecodeForFpsRender is true");if(yr(si._opt.checkFirstIFrame)&&(B=!0),si.isPlayUseMSEAndDecoderInWorker()&&ni){const e=ni.getHandle();e&&postMessage({cmd:ie,mseHandle:e},[e])}},playbackCacheLoop:function(){si.clearPlaybackCacheLoop();const e=()=>{let e=null;i.length&&(e=i.shift(),si.doDecode(e))};e();const t=Math.ceil(1e3/(si.streamFps*si._opt.playbackRate));si.debugLog("worker",`playbackCacheLoop fragDuration is ${t}, streamFps is ${si.streamFps}, streamAudioFps is ${si.streamAudioFps} ,streamVideoFps is ${si.streamVideoFps} playbackRate is ${si._opt.playbackRate}`),si.stopId=setInterval(e,t)},clearPlaybackCacheLoop:function(){si.stopId&&(clearInterval(si.stopId),si.stopId=null)},startPlaybackCacheLoop:function(){si.playbackCacheLoop()},close:function(){if(si.debugLog("worker","close"),si.isDestroyed=!0,kr(),!a||1!==a.readyState&&2!==a.readyState?a&&si.debugLog("worker",`close() and socket.readyState is ${a.readyState}`):(Sr=!0,a.close(1e3,"Client disconnecting")),a=null,si.stopStreamRateAndStatsInterval(),si.stopId&&(clearInterval(si.stopId),si.stopId=null),si.mp3Demuxer&&(si.mp3Demuxer.destroy(),si.mp3Demuxer=null),si.writableStream&&yr(si.writableStream.locked)&&si.writableStream.close().catch((e=>{si.debugLog("worker","close() and writableStream.close() error",e.toString(),e)})),si.writableStream=null,oi)try{oi.clear&&oi.clear(),oi=null}catch(e){si.debugLog("worker","close() and audioDecoder.clear error",e.toString(),e)}if(ai)try{ai.clear&&ai.clear(),ai=null}catch(e){si.debugLog("worker","close() and videoDecoder.clear error",e.toString())}d=null,Je=null,je=!1,Se=0,Ee=0,s&&(s.destroy&&s.destroy(),s=null),ni&&(ni.destroy(),ni=null),si.firstTimestamp=null,si.startTimestamp=null,si.networkDelay=0,si.streamFps=null,si.streamAudioFps=null,si.streamVideoFps=null,si.delay=-1,si.pushLatestDelay=-1,si.preDelayTimestamp=null,si.dropping=!1,si.isPushDropping=!1,si.isPlayer=!0,si.isPlayback=!1,si.isWorkerFetch=!1,si.isHevc=null,si._opt=Ar(),si.webglObj&&(si.webglObj.destroy(),si.offscreenCanvas.removeEventListener("webglcontextlost",si.onOffscreenCanvasWebglContextLost),si.offscreenCanvas.removeEventListener("webglcontextrestored",si.onOffscreenCanvasWebglContextRestored),si.offscreenCanvas=null,si.offscreenCanvasGL=null,si.offscreenCanvasCtx=null),i=[],n=[],c&&(c.close(),c=null),h=null,f=null,S=!1,E=!1,B=!1,Wt=!1,Kt=!1,Qt=!1,sr=null,it=[],Ut=0,kt=0,Qe=null,tt=null,$t=null,Ot=null,wr=null,Gt=0,Ht=0,ut=null,At=null,si.fetchStatus=Ct,Er=!0,Or.destroy(),Gr.destroy(),jr.destroy(),ii.destroy(),si.debug=null,si._opt={},postMessage({cmd:K})},pushBuffer:function(e,t){if(t.type===oe&&qt(e)){if(si.debugLog("worker",`pushBuffer audio ts is ${t.ts}, isAacCodecPacket is true`),si._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:Q,buffer:t},[t.buffer])}si.decodeAudio(e,t.ts)}else if(t.type===ae&&t.isIFrame&&_r(e)){if(si.debugLog("worker",`pushBuffer video ts is ${t.ts}, isVideoSequenceHeader is true`),si._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:ee,buffer:t},[t.buffer])}si.decodeVideo(e,t.ts,t.isIFrame,t.cts)}else{if(si._opt.isRecording)if(si._opt.isRecordTypeFlv){const r=new Uint8Array(e);postMessage({cmd:te,type:t.type,buffer:r,ts:t.ts},[r.buffer])}else if(si._opt.recordType===w)if(t.type===ae){const r=new Uint8Array(e).slice(5);postMessage({cmd:z,buffer:r,isIFrame:t.isIFrame,ts:t.ts,cts:t.cts},[r.buffer])}else if(t.type===oe&&si._opt.isWasmMp4){const r=new Uint8Array(e),i=Yt(r)?r.slice(2):r.slice(1);postMessage({cmd:L,buffer:i,ts:t.ts},[i.buffer])}if(si.isPlayer){if(t.type===ae){if(Gt>0){const e=t.ts-Ot,r=Gt+Gt/2;e>r&&si.debugLog("worker",`pushBuffer video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts}, preTs is ${Ot},\n diff is ${e} and preTsDuration is ${Gt} and maxDiff is ${r}\n maybe trigger black screen or flower screen\n `)}if(null!==Ot&&Ot>=t.ts&&(si.debugWarn("worker",`pushBuffer() and isIFrame is ${t.isIFrame} and,\n options.ts is ${t.ts} less than (or equal) preTs is ${Ot} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${Ht}`),Ot-t.ts>A&&(si.debugWarn("worker",`pushBuffer,\n preTimestamp is ${Ot}, options.ts is ${t.ts},\n diff is ${Ot-t.ts} more than 3600000,\n and resetAllDelay`),si.resetAllDelay(),Ot=null,Gt=0),si._opt.isDropSameTimestampGop&&yr(t.isIFrame)&&B)){const e=si.hasIframeInBufferList(),t=yr(si.isPushDropping);return si.debugLog("worker",`pushBuffer, isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next dropBuffer`),void(e&&t?si.dropBuffer$2():(si.clearBuffer(!0),gr(si._opt.checkFirstIFrame)&&gr(r)&&(si.isPlayUseMSEAndDecoderInWorker()?ni.isDecodeFirstIIframe=!1:postMessage({cmd:re}))))}Ot>0&&(Gt=t.ts-Ot),Ht=e.byteLength,Ot=t.ts}if(B){const e=si._opt.videoBuffer+si._opt.videoBufferDelay,r=si.getDelayNotUpdateDelay(t.ts,t.type);si.pushLatestDelay=r,si.delay>0&&r>e&&si.delay({type:e.type,ts:e.ts})));si.debugLog("worker",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${i.length}, and ts list is ${JSON.stringify(r)}`)}const r=si.getAudioBufferLength()>0,n=r?60:40;i.length>=n&&(si.debugWarn("worker",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${i.length} more than ${n}, and hasAudio is ${r} an set streamFps is 25`),si.streamVideoFps=25,postMessage({cmd:V,value:si.streamVideoFps}),r?(si.streamAudioFps=25,si.streamFps=si.streamVideoFps+si.streamAudioFps):si.streamFps=si.streamVideoFps,si.playbackCacheLoop())}}},getVideoBufferLength(){let e=0;return i.forEach((t=>{t.type===ae&&(e+=1)})),e},hasIframeInBufferList:()=>i.some((e=>e.type===ae&&e.isIFrame)),isAllIframeInBufferList(){const e=si.getVideoBufferLength();let t=0;return i.forEach((e=>{e.type===ae&&e.isIFrame&&(t+=1)})),e===t},getNotDroppingDelayTs:()=>si._opt.videoBuffer+si._opt.videoBufferDelay/2,getAudioBufferLength(){let e=0;return i.forEach((t=>{t.type===oe&&(e+=1)})),e},getStreamBufferLength(){let e=0;return c&&c.buffer&&(e=c.buffer.byteLength),si._opt.isNakedFlow?Or.lastBuf&&(e=Or.lastBuf.byteLength):si._opt.isTs?ii._remainingPacketData&&(e=ii._remainingPacketData.byteLength):si._opt.isFmp4&&Gr.mp4Box&&(e=Gr.mp4Box.getAllocatedSampleDataSize()),e},fetchStream:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(si.debugLog("worker","fetchStream, url is "+e,"options:",JSON.stringify(t)),si.isWorkerFetch=!0,t.isFlv?si._opt.isFlv=!0:t.isFmp4?si._opt.isFmp4=!0:t.isMpeg4?si._opt.isMpeg4=!0:t.isNakedFlow?si._opt.isNakedFlow=!0:t.isTs&&(si._opt.isTs=!0),d=or((e=>{postMessage({cmd:O,type:Ue,value:e})})),si.startStreamRateAndStatsInterval(),t.isFmp4&&(Gr.listenMp4Box(),si._opt.isFmp4Private&&Gr.initTransportDescarmber()),t.protocol===_){t.isFlv&&(c=new Ur(si.demuxFlv())),o=new AbortController;const r=Object.assign({signal:o.signal},{headers:t.options&&t.options.headers||{}});fetch(e,r).then((e=>{if(gr(Sr))return si.debugLog("worker","request abort and run res.body.cancel()"),si.fetchStatus=Ct,void e.body.cancel();if(!pr(e))return si.debugWarn("worker",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),kr(),void postMessage({cmd:O,type:Fe.fetchError,value:`fetch response status is ${e.status} and ok is ${e.ok}`});if(postMessage({cmd:O,type:Te}),ur())si.writableStream=new WritableStream({write:e=>o&&o.signal&&o.signal.aborted?(si.debugLog("worker","writableStream write() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt)):gr(Sr)?(si.debugLog("worker","writableStream write() and requestAbort is true so return"),si.fetchStatus=Pt,void kr()):void("string"!=typeof e?(si.fetchStatus=Dt,d(e.byteLength),t.isFlv?c.write(e):t.isFmp4?si.demuxFmp4(e):t.isMpeg4?si.demuxMpeg4(e):t.isTs?si.demuxTs(e):t.isNakedFlow&&si.demuxNakedFlow(e)):si.debugWarn("worker",`writableStream write() and value is "${e}" string so return`)),close:()=>{si.debugLog("worker","writableStream close()"),si.fetchStatus=Pt,c&&(c.close(),c=null),kr(),postMessage({cmd:O,type:Ae,value:g,msg:"fetch done"})},abort:e=>{if(o&&o.signal&&o.signal.aborted)return si.debugLog("worker","writableStream abort() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt);c&&(c.close(),c=null),e.name!==xt?(si.debugLog("worker",`writableStream abort() and e is ${e.toString()}`),kr(),postMessage({cmd:O,type:Fe.fetchError,value:e.toString()})):si.debugLog("worker","writableStream abort() and e.name is AbortError so return")}}),e.body.pipeTo(si.writableStream).catch((e=>{"AbortError"!==e.name&&si.debugLog("worker","writableStream pipeTo() and e is",e.name,e.toString())}));else{const r=e.body.getReader(),i=()=>{r.read().then((e=>{let{done:r,value:n}=e;return r?(si.debugLog("worker","fetchNext().then() and done is true"),si.fetchStatus=Pt,c&&(c.close(),c=null),kr(),void postMessage({cmd:O,type:Ae,value:g,msg:"fetch done"})):o&&o.signal&&o.signal.aborted?(si.debugLog("worker","fetchNext().then() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt)):gr(Sr)?(si.debugLog("worker","fetchNext().then() and requestAbort is true so return"),si.fetchStatus=Pt,void kr()):void("string"!=typeof n?(si.fetchStatus=Dt,d(n.byteLength),t.isFlv?c.write(n):t.isFmp4?si.demuxFmp4(n):t.isMpeg4?si.demuxMpeg4(n):t.isTs?si.demuxTs(n):t.isNakedFlow&&si.demuxNakedFlow(n),i()):si.debugWarn("worker",`fetchNext().then() and value "${n}" is string so return`))})).catch((e=>{if(o&&o.signal&&o.signal.aborted)return si.debugLog("worker","fetchNext().catch() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt);c&&(c.close(),c=null),e.name!==xt?(si.debugLog("worker",`fetchNext().catch() and e is ${e.toString()}`),kr(),postMessage({cmd:O,type:Fe.fetchError,value:e.toString()})):si.debugLog("worker","fetchNext().catch() and e.name is AbortError so return")}))};i()}})).catch((e=>{o&&o.signal&&o.signal.aborted?si.debugLog("worker","fetch().catch() and abortController.signal.aborted is true so return"):e.name!==xt?(si.debugLog("worker",`fetch().catch() and e is ${e.toString()}`),kr(),postMessage({cmd:O,type:Fe.fetchError,value:e.toString()}),c&&(c.close(),c=null)):si.debugLog("worker","fetch().catch() and e.name is AbortError so return")}))}else t.protocol===m&&(t.isFlv&&(c=new Ur(si.demuxFlv())),a=new WebSocket(e,r),a.binaryType="arraybuffer",a.onopen=()=>{si.debugLog("worker","fetchStream, WebsocketStream socket open"),postMessage({cmd:O,type:Te}),postMessage({cmd:O,type:Pe})},a.onclose=e=>{si.isDestroyed?si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} and isDestroyed is true, so return`):u?si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} but isSocketError is true , so return`):(si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code}`),1006===e.code&&si.debugError("worker",`fetchStream, WebsocketStream socket close abnormally and code is ${e.code}`),gr(Sr)?si.debugLog("worker","fetchStream, WebsocketStream socket close and requestAbort is true so return"):(c&&(c.close(),c=null),postMessage({cmd:O,type:Ae,value:y,msg:e.code})))},a.onerror=e=>{si.debugError("worker","fetchStream, WebsocketStream socket error",e,e.toString()),u=!0,c&&(c.close(),c=null),si.isDestroyed?si.debugLog("worker","fetchStream, WebsocketStream on error and isDestroyed is true, so return"):postMessage({cmd:O,type:Fe.websocketError,value:e.isTrusted?"websocket user aborted":"websocket error"})},a.onmessage=e=>{"string"!=typeof e.data?(d(e.data.byteLength),t.isFlv?c.write(e.data):t.isFmp4?si.demuxFmp4(e.data):t.isMpeg4?si.demuxMpeg4(e.data):si._opt.isNakedFlow?si.demuxNakedFlow(e.data):si.demuxM7s(e.data)):si.debugWarn("worker",`socket on message is string "${e.data}" and return`)})},demuxFlv:function*(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),r=new Uint32Array(e);for(;;){t[3]=0;const e=yield 15,i=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const n=r[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let s=r[0];const o=(yield n).slice();switch(i){case de:if(o.byteLength>0){let e=o;gr(si._opt.m7sCryptoAudio)&&(e=si.cryptoPayloadAudio(o)),si.decode(e,{type:oe,ts:s})}else si.debugWarn("worker",`demuxFlv() type is audio and payload.byteLength is ${o.byteLength} and return`);break;case le:if(o.byteLength>=6){const e=o[0];if(si._isEnhancedH265Header(e))si._decodeEnhancedH265Video(o,s);else{const e=15&o[0];let t=o[0]>>4===Tt;const i=e===Me;if(yr(t)&&gr(br(o,i))&&(si.debugLog("worker","demux() isIFrame is false and unit type is IDR and update to true"),t=!0),t&&_r(o)&&null===si.isHevc){const e=15&o[0];si.isHevc=e===Me,sr=rr(o,si.isHevc),si.debugLog("worker",`demuxFlv() isVideoSequenceHeader is true and isHevc is ${si.isHevc} and nalUnitSize is ${sr}`)}t&&si.calcIframeIntervalTimestamp(s),si.isPlayer&&si.calcNetworkDelay(s),r[0]=o[4],r[1]=o[3],r[2]=o[2],r[3]=0;let n=r[0],a=si.cryptoPayload(o,t);si.decode(a,{type:ae,ts:s,isIFrame:t,cts:n})}}else si.debugWarn("worker",`demuxFlv() type is video and payload.byteLength is ${o.byteLength} and return`);break;case ce:postMessage({cmd:J,buffer:o},[o.buffer]);break;default:si.debugLog("worker",`demuxFlv() type is ${i}`)}}},decode:function(e,t){t.type===oe?si._opt.hasAudio&&(postMessage({cmd:O,type:xe,value:e.byteLength}),si.isPlayer?si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts}):si.isPlayback&&(si.isPlaybackOnlyDecodeIFrame()||(si.isPlaybackCacheBeforeDecodeForFpsRender(),si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts})))):t.type===ae&&si._opt.hasVideo&&(postMessage({cmd:O,type:Be,value:e.byteLength}),postMessage({cmd:O,type:ke,value:t.ts}),si.isPlayer?si.pushBuffer(e,{type:t.type,ts:t.ts,isIFrame:t.isIFrame,cts:t.cts}):si.isPlayback&&(si.isPlaybackOnlyDecodeIFrame()?t.isIFrame&&si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}):(si.isPlaybackCacheBeforeDecodeForFpsRender(),si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}))))},cryptoPayload:function(e,t){let r=e;return si._opt.isM7sCrypto?si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?r=zi(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc):si.debugError("worker",`isM7sCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`):si._opt.isSm4Crypto?si._opt.sm4CryptoKey?r=si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?ts(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc,si._opt.isSm4CryptoH265V2):an(e,si._opt.sm4CryptoKey,si.isHevc,si._opt.isSm4CryptoH265V2):si._opt.sm4CryptoKey||si.debugError("worker","isSm4Crypto opt.sm4CryptoKey is null"):si._opt.isXorCrypto&&(si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?r=hn(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc):si.debugError("worker",`isXorCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`)),r},cryptoPayloadAudio:function(e){let t=e;return si._opt.isM7sCrypto&&(si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?e[0]>>4===$e&&(t=Ni(e,si._opt.cryptoKey,si._opt.cryptoIV)):si.debugError("worker",`isM7sCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`)),t},setCodecAudio:function(e,t){const r=e[0]>>4,i=e[0]>>1&1;if(wr=r===$e?i?16:8:0===i?8:16,oi&&oi.setCodec)if(qt(e)||r===Oe||r===Ge||r===He){si.debugLog("worker",`setCodecAudio: init audio codec, codeId is ${r} _opt.sampleRate is ${si._opt.sampleRate}`);const i=r===$e?e.slice(2):new Uint8Array(0);oi.setCodec(r,si._opt.sampleRate,i),r===$e&&postMessage({cmd:I,buffer:i},[i.buffer]),E=!0,r!==$e&&(r===He?(si.mp3Demuxer||(si.mp3Demuxer=new ln(si),si.mp3Demuxer.on("data",((e,t)=>{oi.decode(e,t)}))),si.mp3Demuxer.dispatch(e.slice(1),t)):oi.decode(e.slice(1),t));{const e=Number("1")||1;setTimeout((()=>{si.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),si.close(),postMessage({cmd:W})}),60*e*60*1e3)}}else si.debugWarn("worker","setCodecAudio: hasInitAudioCodec is false, codecId is ",r);else si.debugError("worker","setCodecAudio: audioDecoder or audioDecoder.setCodec is null")},decodeAudio:function(e,t){if(si.isDestroyed)si.debugLog("worker","decodeAudio, decoder is destroyed and return");else if(si.isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio())ni.decodeAudio(e,t);else if(gr(r)&&gr(si._opt.mseDecodeAudio))postMessage({cmd:$,payload:e,ts:t,cts:t},[e.buffer]);else{const r=e[0]>>4;if(E){if(qt(e))return void si.debugLog("worker","decodeAudio and has already initialized and payload is aac codec packet so drop this frame");r===He?si.mp3Demuxer.dispatch(e.slice(1),t):oi.decode(r===$e?e.slice(2):e.slice(1),t)}else si.setCodecAudio(e,t)}},setCodecVideo:function(e,t){const r=15&e[0];if(ai&&ai.setCodec)if(_r(e))if(r===Ie||r===Me){si.debugLog("worker",`setCodecVideo: init video codec , codecId is ${r}`);const t=e.slice(5);if(r===Ie&&si._opt.useSIMD){const e=Tr(t);if(e.codecWidth>U||e.codecHeight>U)return postMessage({cmd:Y,value:`width: ${e.codecWidth} > 4080, height: ${e.codecHeight} > 4080`}),void si.debugWarn("worker",`setCodecVideo: SIMD H264 decode video width is too large, width is ${e.codecWidth}, height is ${e.codecHeight}`)}const i=new Uint8Array(e);S=!0,ai.setCodec(r,t),postMessage({cmd:M,code:r}),postMessage({cmd:R,buffer:i,codecId:r},[i.buffer])}else si.debugWarn("worker",`setCodecVideo: hasInitVideoCodec is false, codecId is ${r} is not H264 or H265`);else si.debugWarn("worker",`decodeVideo: hasInitVideoCodec is false, codecId is ${r} and isIFrame is ${t} and packetType is ${e[1]}`);else si.debugError("worker","setCodecVideo: videoDecoder or videoDecoder.setCodec is null")},decodeVideo:function(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(si.isDestroyed)si.debugLog("worker","decodeVideo, decoder is destroyed and return");else if(si.isPlayUseMSEAndDecoderInWorker())ni.decodeVideo(e,t,i,n);else if(gr(r))postMessage({cmd:N,payload:e,isIFrame:i,ts:t,cts:n,delay:si.delay},[e.buffer]);else if(S)if(!B&&i&&(B=!0),B){if(i&&_r(e)){const t=15&e[0];let r={};t===Ie?r=Tr(e.slice(5)):t===Me&&(r=Wr(e)),r.codecWidth&&r.codecHeight&&h&&f&&(r.codecWidth!==h||r.codecHeight!==f)&&(si.debugWarn("worker",`\n decodeVideo: video width or height is changed,\n old width is ${h}, old height is ${f},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),Kt=!0,postMessage({cmd:j,value:`width: ${h}->${r.codecWidth}, height: ${f}->${r.codecHeight}`}))}if(Kt)return void si.debugWarn("worker","decodeVideo: video width or height is changed, and return");if(Qt)return void si.debugWarn("worker","decodeVideo: simd decode error, and return");if(_r(e))return void si.debugLog("worker","decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength0&&void 0!==arguments[0]&&arguments[0];si.debugLog("worker",`clearBuffer,bufferList length is ${i.length}, need clear is ${e}`),e&&(i=[]),si.isPlayer&&(si.resetAllDelay(),gr(si._opt.checkFirstIFrame)&&(si.dropping=!0,postMessage({cmd:H}))),gr(si._opt.checkFirstIFrame)&&yr(r)&&(B=!1)},dropBuffer$2:function(){if(i.length>0){let e=i.findIndex((e=>gr(e.isIFrame)&&e.type===ae));if(si.isAllIframeInBufferList())for(let t=0;t=si.getNotDroppingDelayTs()){si.debugLog("worker",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${n} and notDroppingDelayTs is ${si.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){si.isPushDropping=!0,postMessage({cmd:H});const t=i.length;i=i.slice(e);const r=i.shift();si.resetAllDelay(),si.getDelay(r.ts,r.type),si.doDecode(r),si.isPushDropping=!1,si.debugLog("worker",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,new bufferList is ${i.length} and new delay is ${si.delay} `)}else si.isPushDropping=!1}0===i.length&&(si.isPushDropping=!1)},demuxM7s:function(e){const t=new DataView(e),r=t.getUint32(1,!1),i=t.getUint8(0),n=new ArrayBuffer(4),s=new Uint32Array(n);switch(i){case oe:si.decode(new Uint8Array(e,5),{type:oe,ts:r});break;case ae:if(t.byteLength>=11){const i=new Uint8Array(e,5),n=i[0];if(si._isEnhancedH265Header(n))si._decodeEnhancedH265Video(i,r);else{const e=t.getUint8(5)>>4==1;if(e&&(si.calcIframeIntervalTimestamp(r),_r(i)&&null===si.isHevc)){const e=15&i[0];si.isHevc=e===Me}si.isPlayer&&si.calcNetworkDelay(r),s[0]=i[4],s[1]=i[3],s[2]=i[2],s[3]=0;let n=s[0],o=si.cryptoPayload(i,e);si.decode(o,{type:ae,ts:r,isIFrame:e,cts:n})}}else si.debugWarn("worker",`demuxM7s() type is video and arrayBuffer length is ${e.byteLength} and return`)}},demuxNakedFlow:function(e){Or.dispatch(e)},demuxFmp4:function(e){Gr.dispatch(e)},demuxMpeg4:function(e){jr.dispatch(e)},demuxTs:function(e){ii.dispatch(e)},_decodeEnhancedH265Video:function(e,t){const r=e[0],i=48&r,n=15&r,s=e.slice(1,5),o=new ArrayBuffer(4),a=new Uint32Array(o),d="a"==String.fromCharCode(s[0]);if(si.isHevc=yr(d),n===Mt){if(i===Nt){const r=e.slice(5);if(d);else{const i=new Uint8Array(5+r.length);i.set([28,0,0,0,0],0),i.set(r,5),sr=rr(e,si.isHevc),si.debugLog("worker",`demuxFlv() isVideoSequenceHeader(enhancedH265) is true and isHevc is ${si.isHevc} and nalUnitSize is ${sr}`),si.decode(i,{type:ae,ts:t,isIFrame:!0,cts:0})}}}else if(n===Rt){let r=e,n=0;const s=i===Nt;s&&si.calcIframeIntervalTimestamp(t),d||(a[0]=e[4],a[1]=e[3],a[2]=e[2],a[3]=0,n=a[0],r=Kr(e.slice(8),s),r=si.cryptoPayload(r,s),si.decode(r,{type:ae,ts:t,isIFrame:s,cts:n}))}else if(n===zt){const r=i===Nt;r&&si.calcIframeIntervalTimestamp(t);let n=Kr(e.slice(5),r);n=si.cryptoPayload(n,r),si.decode(n,{type:ae,ts:t,isIFrame:r,cts:0})}},_isEnhancedH265Header:function(e){return(e&It)===It},findSei:function(e,t){let r=4;dr(sr)&&(r=sr),er(e.slice(5),r).forEach((e=>{const r=si.isHevc?e[0]>>>1&63:31&e[0];(si.isHevc&&(r===ft||r===ht)||yr(si.isHevc)&&r===Ke)&&postMessage({cmd:Z,buffer:e,ts:t},[e.buffer])}))},calcNetworkDelay:function(e){if(!(B&&e>0))return;null===Qe?(Qe=e,tt=ir()):et?r-t:0;si.networkDelay=i,i>si._opt.networkDelay&&si._opt.playType===v&&(si.debugWarn("worker",`calcNetworkDelay now dts:${e}, start dts is ${Qe} vs start is ${t},local diff is ${r} ,delay is ${i}`),postMessage({cmd:O,type:De,value:i}))},calcIframeIntervalTimestamp:function(e){null===$t?$t=e:$t=si._opt.playbackForwardMaxRateDecodeIFrame&&!(si._opt.useMSE&&si._opt.mseDecodeAudio)},isPlayUseMSE:function(){return si.isPlayer&&si._opt.useMSE&&gr(r)},isPlayUseMSEAndDecoderInWorker:function(){return si.isPlayUseMSE()&&si._opt.mseDecoderUseWorker},isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio:function(){return si.isPlayUseMSEAndDecoderInWorker()&&si._opt.mseDecodeAudio},playbackUpdatePlaybackRate:function(){yr(si.isPlaybackCacheBeforeDecodeForFpsRender())&&si.clearBuffer(!0)},onOffscreenCanvasWebglContextLost:function(e){si.debugError("worker","handleOffscreenCanvasWebglContextLost and next try to create webgl"),e.preventDefault(),Wt=!0,si.webglObj.destroy(),si.webglObj=null,si.offscreenCanvasGL=null,setTimeout((()=>{si.offscreenCanvasGL=si.offscreenCanvas.getContext("webgl"),si.offscreenCanvasGL&&si.offscreenCanvasGL.getContextAttributes().stencil?(si.webglObj=p(si.offscreenCanvasGL,si._opt.openWebglAlignment),Wt=!1):si.debugError("worker","handleOffscreenCanvasWebglContextLost, stencil is false")}),500)},onOffscreenCanvasWebglContextRestored:function(e){si.debugLog("worker","handleOffscreenCanvasWebglContextRestored"),e.preventDefault()},videoInfo:function(e,t,r){postMessage({cmd:M,code:e}),postMessage({cmd:T,w:t,h:r}),h=t,f=r,si.useOffscreen()&&(si.offscreenCanvas=new OffscreenCanvas(t,r),si.offscreenCanvasGL=si.offscreenCanvas.getContext("webgl"),si.webglObj=p(si.offscreenCanvasGL,si._opt.openWebglAlignment),si.offscreenCanvas.addEventListener("webglcontextlost",si.onOffscreenCanvasWebglContextLost,!1),si.offscreenCanvas.addEventListener("webglcontextrestored",si.onOffscreenCanvasWebglContextRestored,!1))},audioInfo:function(e,t,r){postMessage({cmd:F,code:e}),postMessage({cmd:P,sampleRate:t,channels:r,depth:wr}),kt=r},yuvData:function(t,r){if(si.isDestroyed)return void si.debugLog("worker","yuvData, decoder is destroyed and return");const i=h*f*3/2;let n=e.HEAPU8.subarray(t,t+i),s=new Uint8Array(n);if(ut=null,Ee=r,si.useOffscreen())try{if(Wt)return;si.webglObj.renderYUV(h,f,s);let e=si.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:e,delay:si.delay,ts:r},[e])}catch(e){si.debugError("worker","yuvData, transferToImageBitmap error is",e,e.toString())}else postMessage({cmd:C,output:s,delay:si.delay,ts:r},[s.buffer])},pcmData:function(e,r,i){if(si.isDestroyed)return void si.debugLog("worker","pcmData, decoder is destroyed and return");let s=r,o=[],a=0,d=si._opt.audioBufferSize;for(let r=0;r<2;r++){let i=t.HEAPU32[(e>>2)+r]>>2;o[r]=t.HEAPF32.subarray(i,i+s)}if(Ut){if(!(s>=(r=d-Ut)))return Ut+=s,n[0]=Float32Array.of(...n[0],...o[0]),void(2==kt&&(n[1]=Float32Array.of(...n[1],...o[1])));it[0]=Float32Array.of(...n[0],...o[0].subarray(0,r)),2==kt&&(it[1]=Float32Array.of(...n[1],...o[1].subarray(0,r))),postMessage({cmd:D,buffer:it,ts:i},it.map((e=>e.buffer))),a=r,s-=r}for(Ut=s;Ut>=d;Ut-=d)it[0]=o[0].slice(a,a+=d),2==kt&&(it[1]=o[1].slice(a-d,a)),postMessage({cmd:D,buffer:it,ts:i},it.map((e=>e.buffer)));Ut&&(n[0]=o[0].slice(a),2==kt&&(n[1]=o[1].slice(a))),o=[]},errorInfo:function(e){null===ut&&(ut=ir());const t=ir(),r=nr(At>0?2*At:5e3,1e3,5e3),i=t-ut;i>r&&(si.debugWarn("worker",`errorInfo() emit simdDecodeError and\n iframeIntervalTimestamp is ${At} and diff is ${i} and maxDiff is ${r}\n and replay`),Qt=!0,postMessage({cmd:q}))},sendWebsocketMessage:function(e){a?a.readyState===Le?a.send(e):si.debugError("worker","socket is not open"):si.debugError("worker","socket is null")},timeEnd:function(){si.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),si.close(),postMessage({cmd:W})},postStreamToMain(e,t){postMessage({cmd:X,type:t,buffer:e},[e.buffer])},updatePlaybackIsPause(e){si.debugLog("worker",`updatePlaybackIsPause, isPause is ${e}`),gr(e)?si.clearPlaybackCacheLoop():si.startPlaybackCacheLoop()},debugLog(e){if(si._opt.debug&&si.debug){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:{};var t,i,n;(n=e).ready=new Promise(((e,r)=>{t=e,i=r})),(n=void 0!==n?n:{}).locateFile=function(e){return"decoder-pro.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_WASM_URL&&""!=JESSIBUCA_PRO_WASM_URL?JESSIBUCA_PRO_WASM_URL:e};var s,o,a,d=Object.assign({},n),l="./this.program",c="object"==typeof window,u="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";function p(e){return n.locateFile?n.locateFile(e,f):f+e}if(h){const{createRequire:e}=await import("module");var m=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro.js",document.baseURI).href),_=m("fs"),g=m("path");f=u?g.dirname(f)+"/":m("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro.js",document.baseURI).href)),s=(e,t)=>(e=J(e)?new URL(e):g.normalize(e),_.readFileSync(e,t?void 0:"utf8")),a=e=>{var t=s(e,!0);return t.buffer||(t=new Uint8Array(t)),t},o=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=J(e)?new URL(e):g.normalize(e),_.readFile(e,i?void 0:"utf8",((e,n)=>{e?r(e):t(i?n.buffer:n)}))},!n.thisProgram&&process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),n.inspect=()=>"[Emscripten Module object]"}else(c||u)&&(u?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),r&&(f=r),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},u&&(a=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),o=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var y,v,b=n.print||console.log.bind(console),w=n.printErr||console.error.bind(console);Object.assign(n,d),d=null,n.arguments&&n.arguments,n.thisProgram&&(l=n.thisProgram),n.quit&&n.quit,n.wasmBinary&&(y=n.wasmBinary),"object"!=typeof WebAssembly&&j("no native wasm support detected");var S,E,A,U,x,B,k,T,C=!1;function D(e,t){e||j(t)}function P(){var e=v.buffer;n.HEAP8=S=new Int8Array(e),n.HEAP16=A=new Int16Array(e),n.HEAPU8=E=new Uint8Array(e),n.HEAPU16=U=new Uint16Array(e),n.HEAP32=x=new Int32Array(e),n.HEAPU32=B=new Uint32Array(e),n.HEAPF32=k=new Float32Array(e),n.HEAPF64=T=new Float64Array(e)}var F=[],L=[],I=[];function M(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)N(n.preRun.shift());ne(F)}function R(){n.noFSInit||Te.init.initialized||Te.init(),Te.ignorePermissions=!1,ne(L)}function z(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)O(n.postRun.shift());ne(I)}function N(e){F.unshift(e)}function $(e){L.unshift(e)}function O(e){I.unshift(e)}var G=0,H=null;function W(e){G++,n.monitorRunDependencies&&n.monitorRunDependencies(G)}function V(e){if(G--,n.monitorRunDependencies&&n.monitorRunDependencies(G),0==G&&H){var t=H;H=null,t()}}function j(e){n.onAbort&&n.onAbort(e),w(e="Aborted("+e+")"),C=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}var q,Y,K,X="data:application/octet-stream;base64,",Z=e=>e.startsWith(X),J=e=>e.startsWith("file://");function Q(e){if(e==q&&y)return new Uint8Array(y);if(a)return a(e);throw"both async and sync fetching of the wasm failed"}function ee(e){if(!y&&(c||u)){if("function"==typeof fetch&&!J(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>Q(e)));if(o)return new Promise(((t,r)=>{o(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>Q(e)))}function te(e,t,r){return ee(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{w(`failed to asynchronously prepare wasm: ${e}`),j(e)}))}function re(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||Z(t)||J(t)||h||"function"!=typeof fetch?te(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return w(`wasm streaming compile failed: ${e}`),w("falling back to ArrayBuffer instantiation"),te(t,r,i)}))))}function ie(){var e={a:ni};function t(e,t){return si=e.exports,v=si.E,P(),Ft=si.I,$(si.F),V(),si}if(W(),n.instantiateWasm)try{return n.instantiateWasm(e,t)}catch(e){w(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return re(y,q,e,(function(e){t(e.instance)})).catch(i),{}}n.locateFile?Z(q="decoder-pro.wasm")||(q=p(q)):q=new URL("decoder-pro.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro.js",document.baseURI).href).href;var ne=e=>{for(;e.length>0;)e.shift()(n)};function se(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){B[this.ptr+4>>2]=e},this.get_type=function(){return B[this.ptr+4>>2]},this.set_destructor=function(e){B[this.ptr+8>>2]=e},this.get_destructor=function(){return B[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,S[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=S[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,S[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=S[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){B[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return B[this.ptr+16>>2]},this.get_exception_ptr=function(){if(ci(this.get_type()))return B[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}n.noExitRuntime;var oe=(e,t,r)=>{throw new se(e).init(t,r),e},ae=e=>(x[di()>>2]=e,e),de={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=de.isAbs(e),r="/"===e.substr(-1);return(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=de.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=de.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return de.normalize(e.join("/"))},join2:(e,t)=>de.normalize(e+"/"+t)},le=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}j("initRandomDevice")},ce=e=>(ce=le())(e),ue={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:Te.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=de.isAbs(i)}return(t?"/":"")+(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=ue.resolve(e).substr(1),t=ue.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),s=Math.min(i.length,n.length),o=s,a=0;a{for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&he)return he.decode(e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&o)<<6|a)}else s+=String.fromCharCode(o)}return s},pe=[],me=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},_e=(e,t,r,i)=>{if(!(i>0))return 0;for(var n=r,s=r+i-1,o=0;o=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++o)),a<=127){if(r>=s)break;t[r++]=a}else if(a<=2047){if(r+1>=s)break;t[r++]=192|a>>6,t[r++]=128|63&a}else if(a<=65535){if(r+2>=s)break;t[r++]=224|a>>12,t[r++]=128|a>>6&63,t[r++]=128|63&a}else{if(r+3>=s)break;t[r++]=240|a>>18,t[r++]=128|a>>12&63,t[r++]=128|a>>6&63,t[r++]=128|63&a}}return t[r]=0,r-n};function ge(e,t,r){var i=r>0?r:me(e)+1,n=new Array(i),s=_e(e,n,0,n.length);return t&&(n.length=s),n}var ye=()=>{if(!pe.length){var e=null;if(h){var t=Buffer.alloc(256),r=0,i=process.stdin.fd;try{r=_.readSync(i,t)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}e=r>0?t.slice(0,r).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;pe=ge(e,!0)}return pe.shift()},ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},Te.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new Te.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new Te.ErrnoError(60);for(var s=0,o=0;oye(),put_char(e,t){null===t||10===t?(b(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(b(fe(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(w(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(w(fe(e.output,0)),e.output=[])}}},be=e=>{j()},we={ops_table:null,mount:e=>we.createNode(null,"/",16895,0),createNode(e,t,r,i){if(Te.isBlkdev(r)||Te.isFIFO(r))throw new Te.ErrnoError(63);we.ops_table||(we.ops_table={dir:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,lookup:we.node_ops.lookup,mknod:we.node_ops.mknod,rename:we.node_ops.rename,unlink:we.node_ops.unlink,rmdir:we.node_ops.rmdir,readdir:we.node_ops.readdir,symlink:we.node_ops.symlink},stream:{llseek:we.stream_ops.llseek}},file:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:{llseek:we.stream_ops.llseek,read:we.stream_ops.read,write:we.stream_ops.write,allocate:we.stream_ops.allocate,mmap:we.stream_ops.mmap,msync:we.stream_ops.msync}},link:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,readlink:we.node_ops.readlink},stream:{}},chrdev:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:Te.chrdev_stream_ops}});var n=Te.createNode(e,t,r,i);return Te.isDir(n.mode)?(n.node_ops=we.ops_table.dir.node,n.stream_ops=we.ops_table.dir.stream,n.contents={}):Te.isFile(n.mode)?(n.node_ops=we.ops_table.file.node,n.stream_ops=we.ops_table.file.stream,n.usedBytes=0,n.contents=null):Te.isLink(n.mode)?(n.node_ops=we.ops_table.link.node,n.stream_ops=we.ops_table.link.stream):Te.isChrdev(n.mode)&&(n.node_ops=we.ops_table.chrdev.node,n.stream_ops=we.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n,e.timestamp=n.timestamp),n},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Te.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,Te.isDir(e.mode)?t.size=4096:Te.isFile(e.mode)?t.size=e.usedBytes:Te.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&we.resizeFileStorage(e,t.size)},lookup(e,t){throw Te.genericErrors[44]},mknod:(e,t,r,i)=>we.createNode(e,t,r,i),rename(e,t,r){if(Te.isDir(e.mode)){var i;try{i=Te.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new Te.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=Te.lookupNode(e,t);for(var i in r.contents)throw new Te.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink(e,t,r){var i=we.createNode(e,t,41471,0);return i.link=r,i},readlink(e){if(!Te.isLink(e.mode))throw new Te.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,i,n){var s=e.node.contents;if(n>=e.node.usedBytes)return 0;var o=Math.min(e.node.usedBytes-n,i);if(o>8&&s.subarray)t.set(s.subarray(n,n+o),r);else for(var a=0;a0||r+t(we.stream_ops.write(e,t,0,i,r,!1),0)}},Se=(e,t,r,i)=>{var n=i?"":`al ${e}`;o(e,(r=>{D(r,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(r)),n&&V()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),n&&W()},Ee=(e,t,r,i,n,s)=>{Te.createDataFile(e,t,r,i,n,s)},Ae=n.preloadPlugins||[],Ue=(e,t,r,i)=>{"undefined"!=typeof Browser&&Browser.init();var n=!1;return Ae.forEach((s=>{n||s.canHandle(t)&&(s.handle(e,t,r,i),n=!0)})),n},xe=(e,t,r,i,n,s,o,a,d,l)=>{var c=t?ue.resolve(de.join2(e,t)):e;function u(r){function u(r){l&&l(),a||Ee(e,t,r,i,n,d),s&&s(),V()}Ue(r,c,u,(()=>{o&&o(),V()}))||u(r)}W(),"string"==typeof r?Se(r,(e=>u(e)),o):u(r)},Be=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t},ke=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Te={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=ue.resolve(e)))return{path:"",node:null};if(t=Object.assign({follow_mount:!0,recurse_count:0},t),t.recurse_count>8)throw new Te.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),i=Te.root,n="/",s=0;s40)throw new Te.ErrnoError(32)}}return{path:n,node:i}},getPath(e){for(var t;;){if(Te.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,i=0;i>>0)%Te.nameTable.length},hashAddNode(e){var t=Te.hashName(e.parent.id,e.name);e.name_next=Te.nameTable[t],Te.nameTable[t]=e},hashRemoveNode(e){var t=Te.hashName(e.parent.id,e.name);if(Te.nameTable[t]===e)Te.nameTable[t]=e.name_next;else for(var r=Te.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=Te.mayLookup(e);if(r)throw new Te.ErrnoError(r,e);for(var i=Te.hashName(e.id,t),n=Te.nameTable[i];n;n=n.name_next){var s=n.name;if(n.parent.id===e.id&&s===t)return n}return Te.lookup(e,t)},createNode(e,t,r,i){var n=new Te.FSNode(e,t,r,i);return Te.hashAddNode(n),n},destroyNode(e){Te.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>Te.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){var t=Te.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{return Te.lookupNode(e,t),20}catch(e){}return Te.nodePermissions(e,"wx")},mayDelete(e,t,r){var i;try{i=Te.lookupNode(e,t)}catch(e){return e.errno}var n=Te.nodePermissions(e,"wx");if(n)return n;if(r){if(!Te.isDir(i.mode))return 54;if(Te.isRoot(i)||Te.getPath(i)===Te.cwd())return 10}else if(Te.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?Te.isLink(e.mode)?32:Te.isDir(e.mode)&&("r"!==Te.flagsToPermissionString(t)||512&t)?31:Te.nodePermissions(e,Te.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Te.MAX_OPEN_FDS;e++)if(!Te.streams[e])return e;throw new Te.ErrnoError(33)},getStreamChecked(e){var t=Te.getStream(e);if(!t)throw new Te.ErrnoError(8);return t},getStream:e=>Te.streams[e],createStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return Te.FSStream||(Te.FSStream=function(){this.shared={}},Te.FSStream.prototype={},Object.defineProperties(Te.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},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(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new Te.FSStream,e),-1==t&&(t=Te.nextfd()),e.fd=t,Te.streams[t]=e,e},closeStream(e){Te.streams[e]=null},chrdev_stream_ops:{open(e){var t=Te.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek(){throw new Te.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Te.devices[e]={stream_ops:t}},getDevice:e=>Te.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),Te.syncFSRequests++,Te.syncFSRequests>1&&w(`warning: ${Te.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Te.getMounts(Te.root.mount),i=0;function n(e){return Te.syncFSRequests--,t(e)}function s(e){if(e)return s.errored?void 0:(s.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return s(null);t.type.syncfs(t,e,s)}))},mount(e,t,r){var i,n="/"===r,s=!r;if(n&&Te.root)throw new Te.ErrnoError(10);if(!n&&!s){var o=Te.lookupPath(r,{follow_mount:!1});if(r=o.path,i=o.node,Te.isMountpoint(i))throw new Te.ErrnoError(10);if(!Te.isDir(i.mode))throw new Te.ErrnoError(54)}var a={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(a);return d.mount=a,a.root=d,n?Te.root=d:i&&(i.mounted=a,i.mount&&i.mount.mounts.push(a)),d},unmount(e){var t=Te.lookupPath(e,{follow_mount:!1});if(!Te.isMountpoint(t.node))throw new Te.ErrnoError(28);var r=t.node,i=r.mounted,n=Te.getMounts(i);Object.keys(Te.nameTable).forEach((e=>{for(var t=Te.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&Te.destroyNode(t),t=r}})),r.mounted=null;var s=r.mount.mounts.indexOf(i);r.mount.mounts.splice(s,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var i=Te.lookupPath(e,{parent:!0}).node,n=de.basename(e);if(!n||"."===n||".."===n)throw new Te.ErrnoError(28);var s=Te.mayCreate(i,n);if(s)throw new Te.ErrnoError(s);if(!i.node_ops.mknod)throw new Te.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,Te.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,Te.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),i="",n=0;n(void 0===r&&(r=t,t=438),t|=8192,Te.mknod(e,t,r)),symlink(e,t){if(!ue.resolve(e))throw new Te.ErrnoError(44);var r=Te.lookupPath(t,{parent:!0}).node;if(!r)throw new Te.ErrnoError(44);var i=de.basename(t),n=Te.mayCreate(r,i);if(n)throw new Te.ErrnoError(n);if(!r.node_ops.symlink)throw new Te.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename(e,t){var r,i,n=de.dirname(e),s=de.dirname(t),o=de.basename(e),a=de.basename(t);if(r=Te.lookupPath(e,{parent:!0}).node,i=Te.lookupPath(t,{parent:!0}).node,!r||!i)throw new Te.ErrnoError(44);if(r.mount!==i.mount)throw new Te.ErrnoError(75);var d,l=Te.lookupNode(r,o),c=ue.relative(e,s);if("."!==c.charAt(0))throw new Te.ErrnoError(28);if("."!==(c=ue.relative(t,n)).charAt(0))throw new Te.ErrnoError(55);try{d=Te.lookupNode(i,a)}catch(e){}if(l!==d){var u=Te.isDir(l.mode),h=Te.mayDelete(r,o,u);if(h)throw new Te.ErrnoError(h);if(h=d?Te.mayDelete(i,a,u):Te.mayCreate(i,a))throw new Te.ErrnoError(h);if(!r.node_ops.rename)throw new Te.ErrnoError(63);if(Te.isMountpoint(l)||d&&Te.isMountpoint(d))throw new Te.ErrnoError(10);if(i!==r&&(h=Te.nodePermissions(r,"w")))throw new Te.ErrnoError(h);Te.hashRemoveNode(l);try{r.node_ops.rename(l,i,a)}catch(e){throw e}finally{Te.hashAddNode(l)}}},rmdir(e){var t=Te.lookupPath(e,{parent:!0}).node,r=de.basename(e),i=Te.lookupNode(t,r),n=Te.mayDelete(t,r,!0);if(n)throw new Te.ErrnoError(n);if(!t.node_ops.rmdir)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.rmdir(t,r),Te.destroyNode(i)},readdir(e){var t=Te.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new Te.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=Te.lookupPath(e,{parent:!0}).node;if(!t)throw new Te.ErrnoError(44);var r=de.basename(e),i=Te.lookupNode(t,r),n=Te.mayDelete(t,r,!1);if(n)throw new Te.ErrnoError(n);if(!t.node_ops.unlink)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.unlink(t,r),Te.destroyNode(i)},readlink(e){var t=Te.lookupPath(e).node;if(!t)throw new Te.ErrnoError(44);if(!t.node_ops.readlink)throw new Te.ErrnoError(28);return ue.resolve(Te.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=Te.lookupPath(e,{follow:!t}).node;if(!r)throw new Te.ErrnoError(44);if(!r.node_ops.getattr)throw new Te.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>Te.stat(e,!0),chmod(e,t,r){var i;if(!(i="string"==typeof e?Te.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new Te.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod(e,t){Te.chmod(e,t,!0)},fchmod(e,t){var r=Te.getStreamChecked(e);Te.chmod(r.node,t)},chown(e,t,r,i){var n;if(!(n="string"==typeof e?Te.lookupPath(e,{follow:!i}).node:e).node_ops.setattr)throw new Te.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown(e,t,r){Te.chown(e,t,r,!0)},fchown(e,t,r){var i=Te.getStreamChecked(e);Te.chown(i.node,t,r)},truncate(e,t){if(t<0)throw new Te.ErrnoError(28);var r;if(!(r="string"==typeof e?Te.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new Te.ErrnoError(63);if(Te.isDir(r.mode))throw new Te.ErrnoError(31);if(!Te.isFile(r.mode))throw new Te.ErrnoError(28);var i=Te.nodePermissions(r,"w");if(i)throw new Te.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=Te.getStreamChecked(e);if(0==(2097155&r.flags))throw new Te.ErrnoError(28);Te.truncate(r.node,t)},utime(e,t,r){var i=Te.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new Te.ErrnoError(44);var i;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?Be(t):t)?4095&r|32768:0,"object"==typeof e)i=e;else{e=de.normalize(e);try{i=Te.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var s=!1;if(64&t)if(i){if(128&t)throw new Te.ErrnoError(20)}else i=Te.mknod(e,r,0),s=!0;if(!i)throw new Te.ErrnoError(44);if(Te.isChrdev(i.mode)&&(t&=-513),65536&t&&!Te.isDir(i.mode))throw new Te.ErrnoError(54);if(!s){var o=Te.mayOpen(i,t);if(o)throw new Te.ErrnoError(o)}512&t&&!s&&Te.truncate(i,0),t&=-131713;var a=Te.createStream({node:i,path:Te.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return a.stream_ops.open&&a.stream_ops.open(a),!n.logReadFiles||1&t||(Te.readFiles||(Te.readFiles={}),e in Te.readFiles||(Te.readFiles[e]=1)),a},close(e){if(Te.isClosed(e))throw new Te.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Te.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Te.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Te.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,i,n){if(i<0||n<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(1==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.read)throw new Te.ErrnoError(28);var s=void 0!==n;if(s){if(!e.seekable)throw new Te.ErrnoError(70)}else n=e.position;var o=e.stream_ops.read(e,t,r,i,n);return s||(e.position+=o),o},write(e,t,r,i,n,s){if(i<0||n<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.write)throw new Te.ErrnoError(28);e.seekable&&1024&e.flags&&Te.llseek(e,0,2);var o=void 0!==n;if(o){if(!e.seekable)throw new Te.ErrnoError(70)}else n=e.position;var a=e.stream_ops.write(e,t,r,i,n,s);return o||(e.position+=a),a},allocate(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(t<0||r<=0)throw new Te.ErrnoError(28);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(!Te.isFile(e.node.mode)&&!Te.isDir(e.node.mode))throw new Te.ErrnoError(43);if(!e.stream_ops.allocate)throw new Te.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,i,n){if(0!=(2&i)&&0==(2&n)&&2!=(2097155&e.flags))throw new Te.ErrnoError(2);if(1==(2097155&e.flags))throw new Te.ErrnoError(2);if(!e.stream_ops.mmap)throw new Te.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n)},msync:(e,t,r,i,n)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new Te.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,i=Te.open(e,t.flags),n=Te.stat(e).size,s=new Uint8Array(n);return Te.read(i,s,0,n,0),"utf8"===t.encoding?r=fe(s,0):"binary"===t.encoding&&(r=s),Te.close(i),r},writeFile(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=Te.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(me(t)+1),s=_e(t,n,0,n.length);Te.write(i,n,0,s,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");Te.write(i,t,0,t.byteLength,void 0,r.canOwn)}Te.close(i)},cwd:()=>Te.currentPath,chdir(e){var t=Te.lookupPath(e,{follow:!0});if(null===t.node)throw new Te.ErrnoError(44);if(!Te.isDir(t.node.mode))throw new Te.ErrnoError(54);var r=Te.nodePermissions(t.node,"x");if(r)throw new Te.ErrnoError(r);Te.currentPath=t.path},createDefaultDirectories(){Te.mkdir("/tmp"),Te.mkdir("/home"),Te.mkdir("/home/web_user")},createDefaultDevices(){Te.mkdir("/dev"),Te.registerDevice(Te.makedev(1,3),{read:()=>0,write:(e,t,r,i,n)=>i}),Te.mkdev("/dev/null",Te.makedev(1,3)),ve.register(Te.makedev(5,0),ve.default_tty_ops),ve.register(Te.makedev(6,0),ve.default_tty1_ops),Te.mkdev("/dev/tty",Te.makedev(5,0)),Te.mkdev("/dev/tty1",Te.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=ce(e).byteLength),e[--t]);Te.createDevice("/dev","random",r),Te.createDevice("/dev","urandom",r),Te.mkdir("/dev/shm"),Te.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Te.mkdir("/proc");var e=Te.mkdir("/proc/self");Te.mkdir("/proc/self/fd"),Te.mount({mount(){var t=Te.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,i=Te.getStreamChecked(r),n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return n.parent=n,n}},t}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?Te.createDevice("/dev","stdin",n.stdin):Te.symlink("/dev/tty","/dev/stdin"),n.stdout?Te.createDevice("/dev","stdout",null,n.stdout):Te.symlink("/dev/tty","/dev/stdout"),n.stderr?Te.createDevice("/dev","stderr",null,n.stderr):Te.symlink("/dev/tty1","/dev/stderr"),Te.open("/dev/stdin",0),Te.open("/dev/stdout",1),Te.open("/dev/stderr",1)},ensureErrnoError(){Te.ErrnoError||(Te.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},Te.ErrnoError.prototype=new Error,Te.ErrnoError.prototype.constructor=Te.ErrnoError,[44].forEach((e=>{Te.genericErrors[e]=new Te.ErrnoError(e),Te.genericErrors[e].stack=""})))},staticInit(){Te.ensureErrnoError(),Te.nameTable=new Array(4096),Te.mount(we,{},"/"),Te.createDefaultDirectories(),Te.createDefaultDevices(),Te.createSpecialDirectories(),Te.filesystems={MEMFS:we}},init(e,t,r){Te.init.initialized=!0,Te.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=t||n.stdout,n.stderr=r||n.stderr,Te.createStandardStreams()},quit(){Te.init.initialized=!1;for(var e=0;ethis.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},s.prototype.setDataGetter=function(e){this.getter=e},s.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,s=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,o=1048576;n||(o=i);var a=this;a.setDataGetter((e=>{var t=e*o,n=(e+1)*o-1;if(n=Math.min(n,i-1),void 0===a.chunks[e]&&(a.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==o&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):ge(n.responseText||"",!0)})(t,n)),void 0===a.chunks[e])throw new Error("doXHR failed!");return a.chunks[e]})),!s&&i||(o=i=1,i=this.getter(0).length,o=i,b("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=o,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!u)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var o=new s;Object.defineProperties(o,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var a={isDevice:!1,contents:o}}else a={isDevice:!1,url:r};var d=Te.createFile(e,t,a,i,n);a.contents?d.contents=a.contents:a.url&&(d.contents=null,d.url=a.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,t,r,i,n){var s=e.node.contents;if(n>=s.length)return 0;var o=Math.min(s.length-n,i);if(s.slice)for(var a=0;a{var t=d.stream_ops[e];l[e]=function(){return Te.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,n)=>(Te.forceLoadFile(d),c(e,t,r,i,n)),l.mmap=(e,t,r,i,n)=>{Te.forceLoadFile(d);var s=be();if(!s)throw new Te.ErrnoError(48);return c(e,S,s,t,r),{ptr:s,allocated:!0}},d.stream_ops=l,d}},Ce=(e,t)=>e?fe(E,e,t):"",De={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(de.isAbs(t))return t;var i;if(i=-100===e?Te.cwd():De.getStreamFromFD(e).path,0==t.length){if(!r)throw new Te.ErrnoError(44);return i}return de.join2(i,t)},doStat(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&de.normalize(t)!==de.normalize(Te.getPath(e.node)))return-54;throw e}x[r>>2]=i.dev,x[r+4>>2]=i.mode,B[r+8>>2]=i.nlink,x[r+12>>2]=i.uid,x[r+16>>2]=i.gid,x[r+20>>2]=i.rdev,K=[i.size>>>0,(Y=i.size,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+24>>2]=K[0],x[r+28>>2]=K[1],x[r+32>>2]=4096,x[r+36>>2]=i.blocks;var n=i.atime.getTime(),s=i.mtime.getTime(),o=i.ctime.getTime();return K=[Math.floor(n/1e3)>>>0,(Y=Math.floor(n/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+40>>2]=K[0],x[r+44>>2]=K[1],B[r+48>>2]=n%1e3*1e3,K=[Math.floor(s/1e3)>>>0,(Y=Math.floor(s/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+56>>2]=K[0],x[r+60>>2]=K[1],B[r+64>>2]=s%1e3*1e3,K=[Math.floor(o/1e3)>>>0,(Y=Math.floor(o/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+72>>2]=K[0],x[r+76>>2]=K[1],B[r+80>>2]=o%1e3*1e3,K=[i.ino>>>0,(Y=i.ino,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+88>>2]=K[0],x[r+92>>2]=K[1],0},doMsync(e,t,r,i,n){if(!Te.isFile(t.node.mode))throw new Te.ErrnoError(43);if(2&i)return 0;var s=E.slice(e,e+r);Te.msync(t,s,n,r,i)},varargs:void 0,get(){var e=x[+De.varargs>>2];return De.varargs+=4,e},getp:()=>De.get(),getStr:e=>Ce(e),getStreamFromFD:e=>Te.getStreamChecked(e)};function Pe(e,t,r){De.varargs=r;try{var i=De.getStreamFromFD(e);switch(t){case 0:if((n=De.get())<0)return-28;for(;Te.streams[n];)n++;return Te.createStream(i,n).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var n=De.get();return i.flags|=n,0;case 5:return n=De.getp(),A[n+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return ae(28),-1}}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}function Fe(e,t,r,i){De.varargs=i;try{t=De.getStr(t),t=De.calculateAt(e,t);var n=i?De.get():0;return Te.open(t,r,n).fd}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}var Le,Ie,Me,Re=(e,t,r,i,n)=>{},ze=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Le=e},Ne=e=>{for(var t="",r=e;E[r];)t+=Le[E[r++]];return t},$e={},Oe={},Ge={},He=e=>{throw new Ie(e)},We=e=>{throw new Me(e)},Ve=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&We("Mismatched type converter count");for(var n=0;n{Oe.hasOwnProperty(e)?n[t]=Oe[e]:(s.push(e),$e.hasOwnProperty(e)||($e[e]=[]),$e[e].push((()=>{n[t]=Oe[e],++o===s.length&&i(n)})))})),0===s.length&&i(n)};function je(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||He(`type "${i}" must have a positive integer typeid pointer`),Oe.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;He(`Cannot register type '${i}' twice`)}if(Oe[e]=t,delete Ge[e],$e.hasOwnProperty(e)){var n=$e[e];delete $e[e],n.forEach((e=>e()))}}function qe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return je(e,t,r)}var Ye,Ke=8,Xe=(e,t,r,i)=>{qe(e,{name:t=Ne(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:Ke,readValueFromPointer:function(e){return this.fromWireType(E[e])},destructorFunction:null})},Ze=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Je=e=>{He(e.$$.ptrType.registeredClass.name+" instance already deleted")},Qe=!1,et=e=>{},tt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},rt=e=>{e.count.value-=1,0===e.count.value&&tt(e)},it=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=it(e,t,r.baseClass);return null===i?null:r.downcast(i)},nt={},st=()=>Object.keys(ut).length,ot=()=>{var e=[];for(var t in ut)ut.hasOwnProperty(t)&&e.push(ut[t]);return e},at=[],dt=()=>{for(;at.length;){var e=at.pop();e.$$.deleteScheduled=!1,e.delete()}},lt=e=>{Ye=e,at.length&&Ye&&Ye(dt)},ct=()=>{n.getInheritedInstanceCount=st,n.getLiveInheritedInstances=ot,n.flushPendingDeletes=dt,n.setDelayFunction=lt},ut={},ht=(e,t)=>{for(void 0===t&&He("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},ft=(e,t)=>(t=ht(e,t),ut[t]),pt=(e,t)=>(t.ptrType&&t.ptr||We("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&We("Both smartPtrType and smartPtr must be specified"),t.count={value:1},_t(Object.create(e,{$$:{value:t}})));function mt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ft(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?pt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):pt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,o=this.registeredClass.getActualType(t),a=nt[o];if(!a)return n.call(this);s=this.isConst?a.constPointerType:a.pointerType;var d=it(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}var _t=e=>"undefined"==typeof FinalizationRegistry?(_t=e=>e,e):(Qe=new FinalizationRegistry((e=>{rt(e.$$)})),_t=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};Qe.register(e,r,e)}return e},et=e=>Qe.unregister(e),_t(e)),gt=()=>{Object.assign(yt.prototype,{isAliasOf(e){if(!(this instanceof yt))return!1;if(!(e instanceof yt))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n},clone(){if(this.$$.ptr||Je(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=_t(Object.create(Object.getPrototypeOf(this),{$$:{value:Ze(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),et(this),rt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),at.push(this),1===at.length&&Ye&&Ye(dt),this.$$.deleteScheduled=!0,this}})};function yt(){}var vt=(e,t)=>Object.defineProperty(t,"name",{value:e}),bt=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||He(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},wt=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&He(`Cannot register public name '${e}' twice`),bt(n,e,e),n.hasOwnProperty(r)&&He(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,void 0!==r&&(n[e].numArguments=r))},St=48,Et=57,At=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=St&&t<=Et?`_${e}`:e};function Ut(e,t,r,i,n,s,o,a){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=o,this.downcast=a,this.pureVirtualFunctions=[]}var xt=(e,t,r)=>{for(;t!==r;)t.upcast||He(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function Bt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return xt(t.$$.ptr,r,this.registeredClass)}function kt(e,t){var r;if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=xt(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&He("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,sr.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:He("Unsupporting sharing policy")}return r}function Tt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return xt(t.$$.ptr,r,this.registeredClass)}function Ct(e){return this.fromWireType(B[e>>2])}var Dt=()=>{Object.assign(Pt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:Ke,readValueFromPointer:Ct,deleteObject(e){null!==e&&e.delete()},fromWireType:mt})};function Pt(e,t,r,i,n,s,o,a,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=o,this.rawGetPointee=a,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=kt:i?(this.toWireType=Bt,this.destructorFunction=null):(this.toWireType=Tt,this.destructorFunction=null)}var Ft,Lt,It=(e,t,r)=>{n.hasOwnProperty(e)||We("Replacing nonexistant public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},Mt=(e,t,r)=>{var i=n["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},Rt=[],zt=e=>{var t=Rt[e];return t||(e>=Rt.length&&(Rt.length=e+1),Rt[e]=t=Ft.get(e)),t},Nt=(e,t,r)=>e.includes("j")?Mt(e,t,r):zt(t).apply(null,r),$t=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),Nt(e,t,r)}},Ot=(e,t)=>{var r=(e=Ne(e)).includes("j")?$t(e,t):zt(t);return"function"!=typeof r&&He(`unknown function pointer with signature ${e}: ${t}`),r},Gt=(e,t)=>{var r=vt(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},Ht=e=>{var t=li(e),r=Ne(t);return oi(t),r},Wt=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Oe[t]||(Ge[t]?Ge[t].forEach(e):(r.push(t),i[t]=!0))})),new Lt(`${e}: `+r.map(Ht).join([", "]))},Vt=(e,t,r,i,n,s,o,a,d,l,c,u,h)=>{c=Ne(c),s=Ot(n,s),a&&(a=Ot(o,a)),l&&(l=Ot(d,l)),h=Ot(u,h);var f=At(c);wt(f,(function(){Wt(`Cannot construct ${c} due to unbound types`,[i])})),Ve([e,t,r],i?[i]:[],(function(t){var r,n;t=t[0],n=i?(r=t.registeredClass).instancePrototype:yt.prototype;var o=vt(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new Ie("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new Ie(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new Ie(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(n,{constructor:{value:o}});o.prototype=d;var u=new Ut(c,o,d,h,r,s,a,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new Pt(c,u,!0,!1,!1),m=new Pt(c+"*",u,!1,!1,!1),_=new Pt(c+" const*",u,!1,!0,!1);return nt[e]={pointerType:m,constPointerType:_},It(f,o),[p,m,_]}))},jt=(e,t)=>{for(var r=[],i=0;i>2]);return r},qt=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Yt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=vt(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function Kt(e,t,r,i,n,s){var o=t.length;o<2&&He("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||s?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=a?1:2;l{var o=jt(t,r);n=Ot(i,n),Ve([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Ie(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Wt(`Cannot construct ${e.name} due to unbound types`,o)},Ve([],o,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Kt(r,i,null,n,s),[]))),[]}))},Zt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Jt=(e,t,r,i,n,s,o,a,d)=>{var l=jt(r,i);t=Ne(t),t=Zt(t),s=Ot(n,s),Ve([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function n(){Wt(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),a&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,c[t]=n):(bt(c,t,i),c[t].overloadTable[r-2]=n),Ve([],l,(function(n){var a=Kt(i,n,e,s,o,d);return void 0===c[t].overloadTable?(a.argCount=r-2,c[t]=a):c[t].overloadTable[r-2]=a,[]})),[]}))};function Qt(){Object.assign(er.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function er(){this.allocated=[void 0],this.freelist=[]}var tr=new er,rr=e=>{e>=tr.reserved&&0==--tr.get(e).refcount&&tr.free(e)},ir=()=>{for(var e=0,t=tr.reserved;t{tr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),tr.reserved=tr.allocated.length,n.count_emval_handles=ir},sr={toValue:e=>(e||He("Cannot use deleted val. handle = "+e),tr.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return tr.allocate({refcount:1,value:e})}}};function or(e){return this.fromWireType(x[e>>2])}var ar=(e,t)=>{qe(e,{name:t=Ne(t),fromWireType:e=>{var t=sr.toValue(e);return rr(e),t},toWireType:(e,t)=>sr.toHandle(t),argPackAdvance:Ke,readValueFromPointer:or,destructorFunction:null})},dr=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},lr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(k[e>>2])};case 8:return function(e){return this.fromWireType(T[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},cr=(e,t,r)=>{qe(e,{name:t=Ne(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Ke,readValueFromPointer:lr(t,r),destructorFunction:null})},ur=(e,t,r)=>{switch(t){case 1:return r?e=>S[e>>0]:e=>E[e>>0];case 2:return r?e=>A[e>>1]:e=>U[e>>1];case 4:return r?e=>x[e>>2]:e=>B[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},hr=(e,t,r,i,n)=>{t=Ne(t);var s=e=>e;if(0===i){var o=32-8*r;s=e=>e<>>o}var a=t.includes("unsigned");qe(e,{name:t,fromWireType:s,toWireType:a?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:Ke,readValueFromPointer:ur(t,r,0!==i),destructorFunction:null})},fr=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=B[e>>2],r=B[e+4>>2];return new i(S.buffer,r,t)}qe(e,{name:r=Ne(r),fromWireType:n,argPackAdvance:Ke,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},pr=(e,t,r)=>_e(e,E,t,r),mr=(e,t)=>{var r="std::string"===(t=Ne(t));qe(e,{name:t,fromWireType(e){var t,i=B[e>>2],n=e+4;if(r)for(var s=n,o=0;o<=i;++o){var a=n+o;if(o==i||0==E[a]){var d=Ce(s,a-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=a+1}}else{var l=new Array(i);for(o=0;o>2]=i,r&&n)pr(t,o,i+1);else if(n)for(var a=0;a255&&(oi(o),He("String has UTF-16 code units that do not fit in 8 bits")),E[o+a]=d}else for(a=0;a{for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&U[i];)++i;if((r=i<<1)-e>32&&_r)return _r.decode(E.subarray(e,r));for(var s="",o=0;!(o>=t/2);++o){var a=A[e+2*o>>1];if(0==a)break;s+=String.fromCharCode(a)}return s},yr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=o,t+=2}return A[t>>1]=0,t-i},vr=e=>2*e.length,br=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var n=x[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i},wr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++s)),x[t>>2]=o,(t+=4)+4>n)break}return x[t>>2]=0,t-i},Sr=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},Er=(e,t,r)=>{var i,n,s,o,a;r=Ne(r),2===t?(i=gr,n=yr,o=vr,s=()=>U,a=1):4===t&&(i=br,n=wr,o=Sr,s=()=>B,a=2),qe(e,{name:r,fromWireType:e=>{for(var r,n=B[e>>2],o=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==o[c>>a]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return oi(e),r},toWireType:(e,i)=>{"string"!=typeof i&&He(`Cannot pass non-string to C++ string type ${r}`);var s=o(i),d=ai(4+s+t);return B[d>>2]=s>>a,n(i,d+4,s+t),null!==e&&e.push(oi,d),d},argPackAdvance:Ke,readValueFromPointer:or,destructorFunction(e){oi(e)}})},Ar=(e,t)=>{qe(e,{isVoid:!0,name:t=Ne(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},Ur={},xr=e=>{var t=Ur[e];return void 0===t?Ne(e):t},Br=[],kr=(e,t,r,i,n)=>(e=Br[e])(t=sr.toValue(t),t[r=xr(r)],i,n),Tr=e=>{var t=Br.length;return Br.push(e),t},Cr=(e,t)=>{var r=Oe[e];return void 0===r&&He(t+" has unknown type "+Ht(e)),r},Dr=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},Pr=(e,t,r)=>{var i=[],n=e.toWireType(i,r);return i.length&&(B[t>>2]=sr.toHandle(i)),n},Fr=(e,t,r)=>{var i=Dr(e,t),n=i.shift();e--;var s="return function (obj, func, destructorsRef, args) {\n",o=0,a=[];0===r&&a.push("obj");for(var d=["retType"],l=[n],c=0;ce.name)).join(", ")}) => ${n.name}>`;return Tr(vt(h,u))},Lr=e=>{var t=sr.toValue(e);qt(t),rr(e)},Ir=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,Mr=()=>{j("")},Rr=()=>Date.now(),zr=(e,t,r)=>E.copyWithin(e,t,t+r),Nr=e=>{j("OOM")},$r=e=>{E.length,Nr()},Or={},Gr=()=>l||"./this.program",Hr=()=>{if(!Hr.strings){var e={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",_:Gr()};for(var t in Or)void 0===Or[t]?delete e[t]:e[t]=Or[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Hr.strings=r}return Hr.strings},Wr=(e,t)=>{for(var r=0;r>0]=e.charCodeAt(r);S[t>>0]=0},Vr=(e,t)=>{var r=0;return Hr().forEach(((i,n)=>{var s=t+r;B[e+4*n>>2]=s,Wr(i,s),r+=i.length+1})),0},jr=(e,t)=>{var r=Hr();B[e>>2]=r.length;var i=0;return r.forEach((e=>i+=e.length+1)),B[t>>2]=i,0};function qr(e){try{var t=De.getStreamFromFD(e);return Te.close(t),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Yr(e,t){try{var r=De.getStreamFromFD(e),i=r.tty?2:Te.isDir(r.mode)?3:Te.isLink(r.mode)?7:4;return S[t>>0]=i,A[t+2>>1]=0,K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[t+8>>2]=K[0],x[t+12>>2]=K[1],K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[t+16>>2]=K[0],x[t+20>>2]=K[1],0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Kr=(e,t,r,i)=>{for(var n=0,s=0;s>2],a=B[t+4>>2];t+=8;var d=Te.read(e,S,o,a,i);if(d<0)return-1;if(n+=d,d>2]=s,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Zr(e,t,r,i,n){var s=Ir(t,r);try{if(isNaN(s))return 61;var o=De.getStreamFromFD(e);return Te.llseek(o,s,i),K=[o.position>>>0,(Y=o.position,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[n>>2]=K[0],x[n+4>>2]=K[1],o.getdents&&0===s&&0===i&&(o.getdents=null),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Jr=(e,t,r,i)=>{for(var n=0,s=0;s>2],a=B[t+4>>2];t+=8;var d=Te.write(e,S,o,a,i);if(d<0)return-1;n+=d,void 0!==i&&(i+=d)}return n};function Qr(e,t,r,i){try{var n=De.getStreamFromFD(e),s=Jr(n,t,r);return B[i>>2]=s,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var ei=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=Te.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},ti=365,ri=146;Object.defineProperties(ei.prototype,{read:{get:function(){return(this.mode&ti)===ti},set:function(e){e?this.mode|=ti:this.mode&=~ti}},write:{get:function(){return(this.mode&ri)===ri},set:function(e){e?this.mode|=ri:this.mode&=~ri}},isFolder:{get:function(){return Te.isDir(this.mode)}},isDevice:{get:function(){return Te.isChrdev(this.mode)}}}),Te.FSNode=ei,Te.createPreloadedFile=xe,Te.staticInit(),ze(),Ie=n.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Me=n.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},gt(),ct(),Dt(),Lt=n.UnboundTypeError=Gt(Error,"UnboundTypeError"),Qt(),nr();var ii,ni={o:oe,A:Pe,s:Fe,q:Re,C:Xe,D:Vt,y:Xt,h:Jt,B:ar,l:cr,c:hr,b:fr,m:mr,j:Er,n:Ar,g:kr,d:rr,f:Fr,e:Lr,a:Mr,i:Rr,w:zr,r:$r,u:Vr,v:jr,k:qr,t:Yr,z:Xr,p:Zr,x:Qr},si=ie(),oi=e=>(oi=si.G)(e),ai=e=>(ai=si.H)(e),di=()=>(di=si.J)(),li=e=>(li=si.K)(e),ci=e=>(ci=si.M)(e);function ui(){function e(){ii||(ii=!0,n.calledRun=!0,C||(R(),t(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),z()))}G>0||(M(),G>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.dynCall_jiji=(e,t,r,i,s)=>(n.dynCall_jiji=si.N)(e,t,r,i,s),n._ff_h264_cabac_tables=74396,H=function e(){ii||ui(),ii||(H=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return ui(),e.ready}),o=(()=>{var e="undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro.js",document.baseURI).href;return async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var r,i,n;(n=t).ready=new Promise(((e,t)=>{r=e,i=t})),(n=void 0!==n?n:{}).locateFile=function(e){return"decoder-pro-audio.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_AUDIO_WASM_URL&&""!=JESSIBUCA_PRO_AUDIO_WASM_URL?JESSIBUCA_PRO_AUDIO_WASM_URL:e};var s,o,a,d=Object.assign({},n),l="./this.program",c="object"==typeof window,u="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";function p(e){return n.locateFile?n.locateFile(e,f):f+e}if(h){const{createRequire:e}=await import("module");var m=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro.js",document.baseURI).href),_=m("fs"),g=m("path");f=u?g.dirname(f)+"/":m("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro.js",document.baseURI).href)),s=(e,t)=>(e=J(e)?new URL(e):g.normalize(e),_.readFileSync(e,t?void 0:"utf8")),a=e=>{var t=s(e,!0);return t.buffer||(t=new Uint8Array(t)),t},o=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=J(e)?new URL(e):g.normalize(e),_.readFile(e,i?void 0:"utf8",((e,n)=>{e?r(e):t(i?n.buffer:n)}))},!n.thisProgram&&process.argv.length>1&&(l=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),n.inspect=()=>"[Emscripten Module object]"}else(c||u)&&(u?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),e&&(f=e),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},u&&(a=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),o=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var y,v,b=n.print||console.log.bind(console),w=n.printErr||console.error.bind(console);Object.assign(n,d),d=null,n.arguments&&n.arguments,n.thisProgram&&(l=n.thisProgram),n.quit&&n.quit,n.wasmBinary&&(y=n.wasmBinary),"object"!=typeof WebAssembly&&j("no native wasm support detected");var S,E,A,U,x,B,k,T,C=!1;function D(e,t){e||j(t)}function P(){var e=v.buffer;n.HEAP8=S=new Int8Array(e),n.HEAP16=A=new Int16Array(e),n.HEAPU8=E=new Uint8Array(e),n.HEAPU16=U=new Uint16Array(e),n.HEAP32=x=new Int32Array(e),n.HEAPU32=B=new Uint32Array(e),n.HEAPF32=k=new Float32Array(e),n.HEAPF64=T=new Float64Array(e)}var F=[],L=[],I=[];function M(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)N(n.preRun.shift());ne(F)}function R(){n.noFSInit||Te.init.initialized||Te.init(),Te.ignorePermissions=!1,ne(L)}function z(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)O(n.postRun.shift());ne(I)}function N(e){F.unshift(e)}function $(e){L.unshift(e)}function O(e){I.unshift(e)}var G=0,H=null;function W(e){G++,n.monitorRunDependencies&&n.monitorRunDependencies(G)}function V(e){if(G--,n.monitorRunDependencies&&n.monitorRunDependencies(G),0==G&&H){var t=H;H=null,t()}}function j(e){n.onAbort&&n.onAbort(e),w(e="Aborted("+e+")"),C=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}var q,Y,K,X="data:application/octet-stream;base64,",Z=e=>e.startsWith(X),J=e=>e.startsWith("file://");function Q(e){if(e==q&&y)return new Uint8Array(y);if(a)return a(e);throw"both async and sync fetching of the wasm failed"}function ee(e){if(!y&&(c||u)){if("function"==typeof fetch&&!J(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>Q(e)));if(o)return new Promise(((t,r)=>{o(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>Q(e)))}function te(e,t,r){return ee(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{w(`failed to asynchronously prepare wasm: ${e}`),j(e)}))}function re(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||Z(t)||J(t)||h||"function"!=typeof fetch?te(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return w(`wasm streaming compile failed: ${e}`),w("falling back to ArrayBuffer instantiation"),te(t,r,i)}))))}function ie(){var e={a:ni};function t(e,t){return si=e.exports,v=si.E,P(),Ft=si.H,$(si.F),V(),si}if(W(),n.instantiateWasm)try{return n.instantiateWasm(e,t)}catch(e){w(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return re(y,q,e,(function(e){t(e.instance)})).catch(i),{}}n.locateFile?Z(q="decoder-pro-audio.wasm")||(q=p(q)):q=new URL("decoder-pro-audio.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro.js",document.baseURI).href).href;var ne=e=>{for(;e.length>0;)e.shift()(n)};function se(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){B[this.ptr+4>>2]=e},this.get_type=function(){return B[this.ptr+4>>2]},this.set_destructor=function(e){B[this.ptr+8>>2]=e},this.get_destructor=function(){return B[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,S[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=S[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,S[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=S[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){B[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return B[this.ptr+16>>2]},this.get_exception_ptr=function(){if(ci(this.get_type()))return B[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}n.noExitRuntime;var oe=(e,t,r)=>{throw new se(e).init(t,r),e},ae=e=>(x[ai()>>2]=e,e),de={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=de.isAbs(e),r="/"===e.substr(-1);return(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=de.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=de.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return de.normalize(e.join("/"))},join2:(e,t)=>de.normalize(e+"/"+t)},le=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}j("initRandomDevice")},ce=e=>(ce=le())(e),ue={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:Te.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=de.isAbs(i)}return(t?"/":"")+(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=ue.resolve(e).substr(1),t=ue.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),s=Math.min(i.length,n.length),o=s,a=0;a{for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&he)return he.decode(e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&o)<<6|a)}else s+=String.fromCharCode(o)}return s},pe=[],me=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},_e=(e,t,r,i)=>{if(!(i>0))return 0;for(var n=r,s=r+i-1,o=0;o=55296&&a<=57343)a=65536+((1023&a)<<10)|1023&e.charCodeAt(++o);if(a<=127){if(r>=s)break;t[r++]=a}else if(a<=2047){if(r+1>=s)break;t[r++]=192|a>>6,t[r++]=128|63&a}else if(a<=65535){if(r+2>=s)break;t[r++]=224|a>>12,t[r++]=128|a>>6&63,t[r++]=128|63&a}else{if(r+3>=s)break;t[r++]=240|a>>18,t[r++]=128|a>>12&63,t[r++]=128|a>>6&63,t[r++]=128|63&a}}return t[r]=0,r-n};function ge(e,t,r){var i=r>0?r:me(e)+1,n=new Array(i),s=_e(e,n,0,n.length);return t&&(n.length=s),n}var ye=()=>{if(!pe.length){var e=null;if(h){var t=Buffer.alloc(256),r=0,i=process.stdin.fd;try{r=_.readSync(i,t)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}e=r>0?t.slice(0,r).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;pe=ge(e,!0)}return pe.shift()},ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},Te.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new Te.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new Te.ErrnoError(60);for(var s=0,o=0;oye(),put_char(e,t){null===t||10===t?(b(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(b(fe(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(w(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(w(fe(e.output,0)),e.output=[])}}},be=e=>{j()},we={ops_table:null,mount:e=>we.createNode(null,"/",16895,0),createNode(e,t,r,i){if(Te.isBlkdev(r)||Te.isFIFO(r))throw new Te.ErrnoError(63);we.ops_table||(we.ops_table={dir:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,lookup:we.node_ops.lookup,mknod:we.node_ops.mknod,rename:we.node_ops.rename,unlink:we.node_ops.unlink,rmdir:we.node_ops.rmdir,readdir:we.node_ops.readdir,symlink:we.node_ops.symlink},stream:{llseek:we.stream_ops.llseek}},file:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:{llseek:we.stream_ops.llseek,read:we.stream_ops.read,write:we.stream_ops.write,allocate:we.stream_ops.allocate,mmap:we.stream_ops.mmap,msync:we.stream_ops.msync}},link:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr,readlink:we.node_ops.readlink},stream:{}},chrdev:{node:{getattr:we.node_ops.getattr,setattr:we.node_ops.setattr},stream:Te.chrdev_stream_ops}});var n=Te.createNode(e,t,r,i);return Te.isDir(n.mode)?(n.node_ops=we.ops_table.dir.node,n.stream_ops=we.ops_table.dir.stream,n.contents={}):Te.isFile(n.mode)?(n.node_ops=we.ops_table.file.node,n.stream_ops=we.ops_table.file.stream,n.usedBytes=0,n.contents=null):Te.isLink(n.mode)?(n.node_ops=we.ops_table.link.node,n.stream_ops=we.ops_table.link.stream):Te.isChrdev(n.mode)&&(n.node_ops=we.ops_table.chrdev.node,n.stream_ops=we.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n,e.timestamp=n.timestamp),n},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Te.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,Te.isDir(e.mode)?t.size=4096:Te.isFile(e.mode)?t.size=e.usedBytes:Te.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&we.resizeFileStorage(e,t.size)},lookup(e,t){throw Te.genericErrors[44]},mknod:(e,t,r,i)=>we.createNode(e,t,r,i),rename(e,t,r){if(Te.isDir(e.mode)){var i;try{i=Te.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new Te.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=Te.lookupNode(e,t);for(var i in r.contents)throw new Te.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink(e,t,r){var i=we.createNode(e,t,41471,0);return i.link=r,i},readlink(e){if(!Te.isLink(e.mode))throw new Te.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,i,n){var s=e.node.contents;if(n>=e.node.usedBytes)return 0;var o=Math.min(e.node.usedBytes-n,i);if(o>8&&s.subarray)t.set(s.subarray(n,n+o),r);else for(var a=0;a0||r+t(we.stream_ops.write(e,t,0,i,r,!1),0)}},Se=(e,t,r,i)=>{var n=i?"":`al ${e}`;o(e,(r=>{D(r,`Loading data file "${e}" failed (no arrayBuffer).`),t(new Uint8Array(r)),n&&V()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),n&&W()},Ee=(e,t,r,i,n,s)=>{Te.createDataFile(e,t,r,i,n,s)},Ae=n.preloadPlugins||[],Ue=(e,t,r,i)=>{"undefined"!=typeof Browser&&Browser.init();var n=!1;return Ae.forEach((s=>{n||s.canHandle(t)&&(s.handle(e,t,r,i),n=!0)})),n},xe=(e,t,r,i,n,s,o,a,d,l)=>{var c=t?ue.resolve(de.join2(e,t)):e;function u(r){function u(r){l&&l(),a||Ee(e,t,r,i,n,d),s&&s(),V()}Ue(r,c,u,(()=>{o&&o(),V()}))||u(r)}W(),"string"==typeof r?Se(r,(e=>u(e)),o):u(r)},Be=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t},ke=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Te={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=ue.resolve(e)))return{path:"",node:null};if(t=Object.assign({follow_mount:!0,recurse_count:0},t),t.recurse_count>8)throw new Te.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),i=Te.root,n="/",s=0;s40)throw new Te.ErrnoError(32)}}return{path:n,node:i}},getPath(e){for(var t;;){if(Te.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,i=0;i>>0)%Te.nameTable.length},hashAddNode(e){var t=Te.hashName(e.parent.id,e.name);e.name_next=Te.nameTable[t],Te.nameTable[t]=e},hashRemoveNode(e){var t=Te.hashName(e.parent.id,e.name);if(Te.nameTable[t]===e)Te.nameTable[t]=e.name_next;else for(var r=Te.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=Te.mayLookup(e);if(r)throw new Te.ErrnoError(r,e);for(var i=Te.hashName(e.id,t),n=Te.nameTable[i];n;n=n.name_next){var s=n.name;if(n.parent.id===e.id&&s===t)return n}return Te.lookup(e,t)},createNode(e,t,r,i){var n=new Te.FSNode(e,t,r,i);return Te.hashAddNode(n),n},destroyNode(e){Te.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>Te.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){var t=Te.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{Te.lookupNode(e,t);return 20}catch(e){}return Te.nodePermissions(e,"wx")},mayDelete(e,t,r){var i;try{i=Te.lookupNode(e,t)}catch(e){return e.errno}var n=Te.nodePermissions(e,"wx");if(n)return n;if(r){if(!Te.isDir(i.mode))return 54;if(Te.isRoot(i)||Te.getPath(i)===Te.cwd())return 10}else if(Te.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?Te.isLink(e.mode)?32:Te.isDir(e.mode)&&("r"!==Te.flagsToPermissionString(t)||512&t)?31:Te.nodePermissions(e,Te.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Te.MAX_OPEN_FDS;e++)if(!Te.streams[e])return e;throw new Te.ErrnoError(33)},getStreamChecked(e){var t=Te.getStream(e);if(!t)throw new Te.ErrnoError(8);return t},getStream:e=>Te.streams[e],createStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return Te.FSStream||(Te.FSStream=function(){this.shared={}},Te.FSStream.prototype={},Object.defineProperties(Te.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},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(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new Te.FSStream,e),-1==t&&(t=Te.nextfd()),e.fd=t,Te.streams[t]=e,e},closeStream(e){Te.streams[e]=null},chrdev_stream_ops:{open(e){var t=Te.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek(){throw new Te.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Te.devices[e]={stream_ops:t}},getDevice:e=>Te.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),Te.syncFSRequests++,Te.syncFSRequests>1&&w(`warning: ${Te.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Te.getMounts(Te.root.mount),i=0;function n(e){return Te.syncFSRequests--,t(e)}function s(e){if(e)return s.errored?void 0:(s.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return s(null);t.type.syncfs(t,e,s)}))},mount(e,t,r){var i,n="/"===r,s=!r;if(n&&Te.root)throw new Te.ErrnoError(10);if(!n&&!s){var o=Te.lookupPath(r,{follow_mount:!1});if(r=o.path,i=o.node,Te.isMountpoint(i))throw new Te.ErrnoError(10);if(!Te.isDir(i.mode))throw new Te.ErrnoError(54)}var a={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(a);return d.mount=a,a.root=d,n?Te.root=d:i&&(i.mounted=a,i.mount&&i.mount.mounts.push(a)),d},unmount(e){var t=Te.lookupPath(e,{follow_mount:!1});if(!Te.isMountpoint(t.node))throw new Te.ErrnoError(28);var r=t.node,i=r.mounted,n=Te.getMounts(i);Object.keys(Te.nameTable).forEach((e=>{for(var t=Te.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&Te.destroyNode(t),t=r}})),r.mounted=null;var s=r.mount.mounts.indexOf(i);r.mount.mounts.splice(s,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var i=Te.lookupPath(e,{parent:!0}).node,n=de.basename(e);if(!n||"."===n||".."===n)throw new Te.ErrnoError(28);var s=Te.mayCreate(i,n);if(s)throw new Te.ErrnoError(s);if(!i.node_ops.mknod)throw new Te.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,Te.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,Te.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),i="",n=0;n(void 0===r&&(r=t,t=438),t|=8192,Te.mknod(e,t,r)),symlink(e,t){if(!ue.resolve(e))throw new Te.ErrnoError(44);var r=Te.lookupPath(t,{parent:!0}).node;if(!r)throw new Te.ErrnoError(44);var i=de.basename(t),n=Te.mayCreate(r,i);if(n)throw new Te.ErrnoError(n);if(!r.node_ops.symlink)throw new Te.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename(e,t){var r,i,n=de.dirname(e),s=de.dirname(t),o=de.basename(e),a=de.basename(t);if(r=Te.lookupPath(e,{parent:!0}).node,i=Te.lookupPath(t,{parent:!0}).node,!r||!i)throw new Te.ErrnoError(44);if(r.mount!==i.mount)throw new Te.ErrnoError(75);var d,l=Te.lookupNode(r,o),c=ue.relative(e,s);if("."!==c.charAt(0))throw new Te.ErrnoError(28);if("."!==(c=ue.relative(t,n)).charAt(0))throw new Te.ErrnoError(55);try{d=Te.lookupNode(i,a)}catch(e){}if(l!==d){var u=Te.isDir(l.mode),h=Te.mayDelete(r,o,u);if(h)throw new Te.ErrnoError(h);if(h=d?Te.mayDelete(i,a,u):Te.mayCreate(i,a))throw new Te.ErrnoError(h);if(!r.node_ops.rename)throw new Te.ErrnoError(63);if(Te.isMountpoint(l)||d&&Te.isMountpoint(d))throw new Te.ErrnoError(10);if(i!==r&&(h=Te.nodePermissions(r,"w")))throw new Te.ErrnoError(h);Te.hashRemoveNode(l);try{r.node_ops.rename(l,i,a)}catch(e){throw e}finally{Te.hashAddNode(l)}}},rmdir(e){var t=Te.lookupPath(e,{parent:!0}).node,r=de.basename(e),i=Te.lookupNode(t,r),n=Te.mayDelete(t,r,!0);if(n)throw new Te.ErrnoError(n);if(!t.node_ops.rmdir)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.rmdir(t,r),Te.destroyNode(i)},readdir(e){var t=Te.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new Te.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=Te.lookupPath(e,{parent:!0}).node;if(!t)throw new Te.ErrnoError(44);var r=de.basename(e),i=Te.lookupNode(t,r),n=Te.mayDelete(t,r,!1);if(n)throw new Te.ErrnoError(n);if(!t.node_ops.unlink)throw new Te.ErrnoError(63);if(Te.isMountpoint(i))throw new Te.ErrnoError(10);t.node_ops.unlink(t,r),Te.destroyNode(i)},readlink(e){var t=Te.lookupPath(e).node;if(!t)throw new Te.ErrnoError(44);if(!t.node_ops.readlink)throw new Te.ErrnoError(28);return ue.resolve(Te.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=Te.lookupPath(e,{follow:!t}).node;if(!r)throw new Te.ErrnoError(44);if(!r.node_ops.getattr)throw new Te.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>Te.stat(e,!0),chmod(e,t,r){var i;"string"==typeof e?i=Te.lookupPath(e,{follow:!r}).node:i=e;if(!i.node_ops.setattr)throw new Te.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod(e,t){Te.chmod(e,t,!0)},fchmod(e,t){var r=Te.getStreamChecked(e);Te.chmod(r.node,t)},chown(e,t,r,i){var n;"string"==typeof e?n=Te.lookupPath(e,{follow:!i}).node:n=e;if(!n.node_ops.setattr)throw new Te.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown(e,t,r){Te.chown(e,t,r,!0)},fchown(e,t,r){var i=Te.getStreamChecked(e);Te.chown(i.node,t,r)},truncate(e,t){if(t<0)throw new Te.ErrnoError(28);var r;"string"==typeof e?r=Te.lookupPath(e,{follow:!0}).node:r=e;if(!r.node_ops.setattr)throw new Te.ErrnoError(63);if(Te.isDir(r.mode))throw new Te.ErrnoError(31);if(!Te.isFile(r.mode))throw new Te.ErrnoError(28);var i=Te.nodePermissions(r,"w");if(i)throw new Te.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=Te.getStreamChecked(e);if(0==(2097155&r.flags))throw new Te.ErrnoError(28);Te.truncate(r.node,t)},utime(e,t,r){var i=Te.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new Te.ErrnoError(44);var i;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?Be(t):t)?4095&r|32768:0,"object"==typeof e)i=e;else{e=de.normalize(e);try{i=Te.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var s=!1;if(64&t)if(i){if(128&t)throw new Te.ErrnoError(20)}else i=Te.mknod(e,r,0),s=!0;if(!i)throw new Te.ErrnoError(44);if(Te.isChrdev(i.mode)&&(t&=-513),65536&t&&!Te.isDir(i.mode))throw new Te.ErrnoError(54);if(!s){var o=Te.mayOpen(i,t);if(o)throw new Te.ErrnoError(o)}512&t&&!s&&Te.truncate(i,0),t&=-131713;var a=Te.createStream({node:i,path:Te.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return a.stream_ops.open&&a.stream_ops.open(a),!n.logReadFiles||1&t||(Te.readFiles||(Te.readFiles={}),e in Te.readFiles||(Te.readFiles[e]=1)),a},close(e){if(Te.isClosed(e))throw new Te.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Te.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Te.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Te.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,i,n){if(i<0||n<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(1==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.read)throw new Te.ErrnoError(28);var s=void 0!==n;if(s){if(!e.seekable)throw new Te.ErrnoError(70)}else n=e.position;var o=e.stream_ops.read(e,t,r,i,n);return s||(e.position+=o),o},write(e,t,r,i,n,s){if(i<0||n<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.write)throw new Te.ErrnoError(28);e.seekable&&1024&e.flags&&Te.llseek(e,0,2);var o=void 0!==n;if(o){if(!e.seekable)throw new Te.ErrnoError(70)}else n=e.position;var a=e.stream_ops.write(e,t,r,i,n,s);return o||(e.position+=a),a},allocate(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(t<0||r<=0)throw new Te.ErrnoError(28);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(!Te.isFile(e.node.mode)&&!Te.isDir(e.node.mode))throw new Te.ErrnoError(43);if(!e.stream_ops.allocate)throw new Te.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,i,n){if(0!=(2&i)&&0==(2&n)&&2!=(2097155&e.flags))throw new Te.ErrnoError(2);if(1==(2097155&e.flags))throw new Te.ErrnoError(2);if(!e.stream_ops.mmap)throw new Te.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n)},msync:(e,t,r,i,n)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new Te.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,i=Te.open(e,t.flags),n=Te.stat(e).size,s=new Uint8Array(n);return Te.read(i,s,0,n,0),"utf8"===t.encoding?r=fe(s,0):"binary"===t.encoding&&(r=s),Te.close(i),r},writeFile(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=Te.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(me(t)+1),s=_e(t,n,0,n.length);Te.write(i,n,0,s,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");Te.write(i,t,0,t.byteLength,void 0,r.canOwn)}Te.close(i)},cwd:()=>Te.currentPath,chdir(e){var t=Te.lookupPath(e,{follow:!0});if(null===t.node)throw new Te.ErrnoError(44);if(!Te.isDir(t.node.mode))throw new Te.ErrnoError(54);var r=Te.nodePermissions(t.node,"x");if(r)throw new Te.ErrnoError(r);Te.currentPath=t.path},createDefaultDirectories(){Te.mkdir("/tmp"),Te.mkdir("/home"),Te.mkdir("/home/web_user")},createDefaultDevices(){Te.mkdir("/dev"),Te.registerDevice(Te.makedev(1,3),{read:()=>0,write:(e,t,r,i,n)=>i}),Te.mkdev("/dev/null",Te.makedev(1,3)),ve.register(Te.makedev(5,0),ve.default_tty_ops),ve.register(Te.makedev(6,0),ve.default_tty1_ops),Te.mkdev("/dev/tty",Te.makedev(5,0)),Te.mkdev("/dev/tty1",Te.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=ce(e).byteLength),e[--t]);Te.createDevice("/dev","random",r),Te.createDevice("/dev","urandom",r),Te.mkdir("/dev/shm"),Te.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Te.mkdir("/proc");var e=Te.mkdir("/proc/self");Te.mkdir("/proc/self/fd"),Te.mount({mount(){var t=Te.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,i=Te.getStreamChecked(r),n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return n.parent=n,n}},t}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?Te.createDevice("/dev","stdin",n.stdin):Te.symlink("/dev/tty","/dev/stdin"),n.stdout?Te.createDevice("/dev","stdout",null,n.stdout):Te.symlink("/dev/tty","/dev/stdout"),n.stderr?Te.createDevice("/dev","stderr",null,n.stderr):Te.symlink("/dev/tty1","/dev/stderr"),Te.open("/dev/stdin",0),Te.open("/dev/stdout",1),Te.open("/dev/stderr",1)},ensureErrnoError(){Te.ErrnoError||(Te.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},Te.ErrnoError.prototype=new Error,Te.ErrnoError.prototype.constructor=Te.ErrnoError,[44].forEach((e=>{Te.genericErrors[e]=new Te.ErrnoError(e),Te.genericErrors[e].stack=""})))},staticInit(){Te.ensureErrnoError(),Te.nameTable=new Array(4096),Te.mount(we,{},"/"),Te.createDefaultDirectories(),Te.createDefaultDevices(),Te.createSpecialDirectories(),Te.filesystems={MEMFS:we}},init(e,t,r){Te.init.initialized=!0,Te.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=t||n.stdout,n.stderr=r||n.stderr,Te.createStandardStreams()},quit(){Te.init.initialized=!1;for(var e=0;ethis.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},s.prototype.setDataGetter=function(e){this.getter=e},s.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,s=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,o=1048576;n||(o=i);var a=this;a.setDataGetter((e=>{var t=e*o,n=(e+1)*o-1;if(n=Math.min(n,i-1),void 0===a.chunks[e]&&(a.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==o&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):ge(n.responseText||"",!0)})(t,n)),void 0===a.chunks[e])throw new Error("doXHR failed!");return a.chunks[e]})),!s&&i||(o=i=1,i=this.getter(0).length,o=i,b("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=o,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!u)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var o=new s;Object.defineProperties(o,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var a={isDevice:!1,contents:o}}else a={isDevice:!1,url:r};var d=Te.createFile(e,t,a,i,n);a.contents?d.contents=a.contents:a.url&&(d.contents=null,d.url=a.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,t,r,i,n){var s=e.node.contents;if(n>=s.length)return 0;var o=Math.min(s.length-n,i);if(s.slice)for(var a=0;a{var t=d.stream_ops[e];l[e]=function(){return Te.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,n)=>(Te.forceLoadFile(d),c(e,t,r,i,n)),l.mmap=(e,t,r,i,n)=>{Te.forceLoadFile(d);var s=be();if(!s)throw new Te.ErrnoError(48);return c(e,S,s,t,r),{ptr:s,allocated:!0}},d.stream_ops=l,d}},Ce=(e,t)=>e?fe(E,e,t):"",De={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(de.isAbs(t))return t;var i;-100===e?i=Te.cwd():i=De.getStreamFromFD(e).path;if(0==t.length){if(!r)throw new Te.ErrnoError(44);return i}return de.join2(i,t)},doStat(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&de.normalize(t)!==de.normalize(Te.getPath(e.node)))return-54;throw e}x[r>>2]=i.dev,x[r+4>>2]=i.mode,B[r+8>>2]=i.nlink,x[r+12>>2]=i.uid,x[r+16>>2]=i.gid,x[r+20>>2]=i.rdev,K=[i.size>>>0,(Y=i.size,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+24>>2]=K[0],x[r+28>>2]=K[1],x[r+32>>2]=4096,x[r+36>>2]=i.blocks;var n=i.atime.getTime(),s=i.mtime.getTime(),o=i.ctime.getTime();return K=[Math.floor(n/1e3)>>>0,(Y=Math.floor(n/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+40>>2]=K[0],x[r+44>>2]=K[1],B[r+48>>2]=n%1e3*1e3,K=[Math.floor(s/1e3)>>>0,(Y=Math.floor(s/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+56>>2]=K[0],x[r+60>>2]=K[1],B[r+64>>2]=s%1e3*1e3,K=[Math.floor(o/1e3)>>>0,(Y=Math.floor(o/1e3),+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+72>>2]=K[0],x[r+76>>2]=K[1],B[r+80>>2]=o%1e3*1e3,K=[i.ino>>>0,(Y=i.ino,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[r+88>>2]=K[0],x[r+92>>2]=K[1],0},doMsync(e,t,r,i,n){if(!Te.isFile(t.node.mode))throw new Te.ErrnoError(43);if(2&i)return 0;var s=E.slice(e,e+r);Te.msync(t,s,n,r,i)},varargs:void 0,get(){var e=x[+De.varargs>>2];return De.varargs+=4,e},getp:()=>De.get(),getStr:e=>Ce(e),getStreamFromFD:e=>Te.getStreamChecked(e)};function Pe(e,t,r){De.varargs=r;try{var i=De.getStreamFromFD(e);switch(t){case 0:if((n=De.get())<0)return-28;for(;Te.streams[n];)n++;return Te.createStream(i,n).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var n=De.get();return i.flags|=n,0;case 5:n=De.getp();return A[n+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return ae(28),-1}}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}function Fe(e,t,r,i){De.varargs=i;try{t=De.getStr(t),t=De.calculateAt(e,t);var n=i?De.get():0;return Te.open(t,r,n).fd}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}}var Le,Ie,Me,Re=(e,t,r,i,n)=>{},ze=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Le=e},Ne=e=>{for(var t="",r=e;E[r];)t+=Le[E[r++]];return t},$e={},Oe={},Ge={},He=e=>{throw new Ie(e)},We=e=>{throw new Me(e)},Ve=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&We("Mismatched type converter count");for(var n=0;n{Oe.hasOwnProperty(e)?n[t]=Oe[e]:(s.push(e),$e.hasOwnProperty(e)||($e[e]=[]),$e[e].push((()=>{n[t]=Oe[e],++o===s.length&&i(n)})))})),0===s.length&&i(n)};function je(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||He(`type "${i}" must have a positive integer typeid pointer`),Oe.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;He(`Cannot register type '${i}' twice`)}if(Oe[e]=t,delete Ge[e],$e.hasOwnProperty(e)){var n=$e[e];delete $e[e],n.forEach((e=>e()))}}function qe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return je(e,t,r)}var Ye,Ke=8,Xe=(e,t,r,i)=>{qe(e,{name:t=Ne(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:Ke,readValueFromPointer:function(e){return this.fromWireType(E[e])},destructorFunction:null})},Ze=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Je=e=>{He(e.$$.ptrType.registeredClass.name+" instance already deleted")},Qe=!1,et=e=>{},tt=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},rt=e=>{e.count.value-=1,0===e.count.value&&tt(e)},it=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=it(e,t,r.baseClass);return null===i?null:r.downcast(i)},nt={},st=()=>Object.keys(ut).length,ot=()=>{var e=[];for(var t in ut)ut.hasOwnProperty(t)&&e.push(ut[t]);return e},at=[],dt=()=>{for(;at.length;){var e=at.pop();e.$$.deleteScheduled=!1,e.delete()}},lt=e=>{Ye=e,at.length&&Ye&&Ye(dt)},ct=()=>{n.getInheritedInstanceCount=st,n.getLiveInheritedInstances=ot,n.flushPendingDeletes=dt,n.setDelayFunction=lt},ut={},ht=(e,t)=>{for(void 0===t&&He("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},ft=(e,t)=>(t=ht(e,t),ut[t]),pt=(e,t)=>(t.ptrType&&t.ptr||We("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!==!!t.smartPtr&&We("Both smartPtrType and smartPtr must be specified"),t.count={value:1},_t(Object.create(e,{$$:{value:t}})));function mt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ft(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?pt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):pt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,o=this.registeredClass.getActualType(t),a=nt[o];if(!a)return n.call(this);s=this.isConst?a.constPointerType:a.pointerType;var d=it(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):pt(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}var _t=e=>"undefined"==typeof FinalizationRegistry?(_t=e=>e,e):(Qe=new FinalizationRegistry((e=>{rt(e.$$)})),_t=e=>{var t=e.$$;if(!!t.smartPtr){var r={$$:t};Qe.register(e,r,e)}return e},et=e=>Qe.unregister(e),_t(e)),gt=()=>{Object.assign(yt.prototype,{isAliasOf(e){if(!(this instanceof yt))return!1;if(!(e instanceof yt))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n},clone(){if(this.$$.ptr||Je(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=_t(Object.create(Object.getPrototypeOf(this),{$$:{value:Ze(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),et(this),rt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),at.push(this),1===at.length&&Ye&&Ye(dt),this.$$.deleteScheduled=!0,this}})};function yt(){}var vt=(e,t)=>Object.defineProperty(t,"name",{value:e}),bt=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||He(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},wt=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&He(`Cannot register public name '${e}' twice`),bt(n,e,e),n.hasOwnProperty(r)&&He(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,void 0!==r&&(n[e].numArguments=r))},St=48,Et=57,At=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=St&&t<=Et?`_${e}`:e};function Ut(e,t,r,i,n,s,o,a){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=o,this.downcast=a,this.pureVirtualFunctions=[]}var xt=(e,t,r)=>{for(;t!==r;)t.upcast||He(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function Bt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return xt(t.$$.ptr,r,this.registeredClass)}function kt(e,t){var r;if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=xt(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&He("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:He(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,sr.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:He("Unsupporting sharing policy")}return r}function Tt(e,t){if(null===t)return this.isReference&&He(`null is not a valid ${this.name}`),0;t.$$||He(`Cannot pass "${dr(t)}" as a ${this.name}`),t.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&He(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return xt(t.$$.ptr,r,this.registeredClass)}function Ct(e){return this.fromWireType(B[e>>2])}var Dt=()=>{Object.assign(Pt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:Ke,readValueFromPointer:Ct,deleteObject(e){null!==e&&e.delete()},fromWireType:mt})};function Pt(e,t,r,i,n,s,o,a,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=o,this.rawGetPointee=a,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=kt:i?(this.toWireType=Bt,this.destructorFunction=null):(this.toWireType=Tt,this.destructorFunction=null)}var Ft,Lt,It=(e,t,r)=>{n.hasOwnProperty(e)||We("Replacing nonexistant public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},Mt=(e,t,r)=>{var i=n["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},Rt=[],zt=e=>{var t=Rt[e];return t||(e>=Rt.length&&(Rt.length=e+1),Rt[e]=t=Ft.get(e)),t},Nt=(e,t,r)=>e.includes("j")?Mt(e,t,r):zt(t).apply(null,r),$t=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),Nt(e,t,r)}},Ot=(e,t)=>{var r=(e=Ne(e)).includes("j")?$t(e,t):zt(t);return"function"!=typeof r&&He(`unknown function pointer with signature ${e}: ${t}`),r},Gt=(e,t)=>{var r=vt(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},Ht=e=>{var t=di(e),r=Ne(t);return oi(t),r},Wt=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Oe[t]||(Ge[t]?Ge[t].forEach(e):(r.push(t),i[t]=!0))})),new Lt(`${e}: `+r.map(Ht).join([", "]))},Vt=(e,t,r,i,n,s,o,a,d,l,c,u,h)=>{c=Ne(c),s=Ot(n,s),a&&(a=Ot(o,a)),l&&(l=Ot(d,l)),h=Ot(u,h);var f=At(c);wt(f,(function(){Wt(`Cannot construct ${c} due to unbound types`,[i])})),Ve([e,t,r],i?[i]:[],(function(t){var r,n;t=t[0],n=i?(r=t.registeredClass).instancePrototype:yt.prototype;var o=vt(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new Ie("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new Ie(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new Ie(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(n,{constructor:{value:o}});o.prototype=d;var u=new Ut(c,o,d,h,r,s,a,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new Pt(c,u,!0,!1,!1),m=new Pt(c+"*",u,!1,!1,!1),_=new Pt(c+" const*",u,!1,!0,!1);return nt[e]={pointerType:m,constPointerType:_},It(f,o),[p,m,_]}))},jt=(e,t)=>{for(var r=[],i=0;i>2]);return r},qt=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Yt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=vt(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function Kt(e,t,r,i,n,s){var o=t.length;o<2&&He("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||s?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=a?1:2;l{var o=jt(t,r);n=Ot(i,n),Ve([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Ie(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Wt(`Cannot construct ${e.name} due to unbound types`,o)},Ve([],o,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Kt(r,i,null,n,s),[]))),[]}))},Zt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Jt=(e,t,r,i,n,s,o,a,d)=>{var l=jt(r,i);t=Ne(t),t=Zt(t),s=Ot(n,s),Ve([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function n(){Wt(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),a&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,c[t]=n):(bt(c,t,i),c[t].overloadTable[r-2]=n),Ve([],l,(function(n){var a=Kt(i,n,e,s,o,d);return void 0===c[t].overloadTable?(a.argCount=r-2,c[t]=a):c[t].overloadTable[r-2]=a,[]})),[]}))};function Qt(){Object.assign(er.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function er(){this.allocated=[void 0],this.freelist=[]}var tr=new er,rr=e=>{e>=tr.reserved&&0==--tr.get(e).refcount&&tr.free(e)},ir=()=>{for(var e=0,t=tr.reserved;t{tr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),tr.reserved=tr.allocated.length,n.count_emval_handles=ir},sr={toValue:e=>(e||He("Cannot use deleted val. handle = "+e),tr.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return tr.allocate({refcount:1,value:e})}}};function or(e){return this.fromWireType(x[e>>2])}var ar=(e,t)=>{qe(e,{name:t=Ne(t),fromWireType:e=>{var t=sr.toValue(e);return rr(e),t},toWireType:(e,t)=>sr.toHandle(t),argPackAdvance:Ke,readValueFromPointer:or,destructorFunction:null})},dr=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},lr=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(k[e>>2])};case 8:return function(e){return this.fromWireType(T[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},cr=(e,t,r)=>{qe(e,{name:t=Ne(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Ke,readValueFromPointer:lr(t,r),destructorFunction:null})},ur=(e,t,r)=>{switch(t){case 1:return r?e=>S[e>>0]:e=>E[e>>0];case 2:return r?e=>A[e>>1]:e=>U[e>>1];case 4:return r?e=>x[e>>2]:e=>B[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},hr=(e,t,r,i,n)=>{t=Ne(t);var s=e=>e;if(0===i){var o=32-8*r;s=e=>e<>>o}var a=t.includes("unsigned");qe(e,{name:t,fromWireType:s,toWireType:a?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:Ke,readValueFromPointer:ur(t,r,0!==i),destructorFunction:null})},fr=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=B[e>>2],r=B[e+4>>2];return new i(S.buffer,r,t)}qe(e,{name:r=Ne(r),fromWireType:n,argPackAdvance:Ke,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},pr=(e,t,r)=>_e(e,E,t,r),mr=(e,t)=>{var r="std::string"===(t=Ne(t));qe(e,{name:t,fromWireType(e){var t,i=B[e>>2],n=e+4;if(r)for(var s=n,o=0;o<=i;++o){var a=n+o;if(o==i||0==E[a]){var d=Ce(s,a-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=a+1}}else{var l=new Array(i);for(o=0;o>2]=i,r&&n)pr(t,o,i+1);else if(n)for(var a=0;a255&&(oi(o),He("String has UTF-16 code units that do not fit in 8 bits")),E[o+a]=d}else for(a=0;a{for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&U[i];)++i;if((r=i<<1)-e>32&&_r)return _r.decode(E.subarray(e,r));for(var s="",o=0;!(o>=t/2);++o){var a=A[e+2*o>>1];if(0==a)break;s+=String.fromCharCode(a)}return s},yr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=o,t+=2}return A[t>>1]=0,t-i},vr=e=>2*e.length,br=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var n=x[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i},wr=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&o<=57343)o=65536+((1023&o)<<10)|1023&e.charCodeAt(++s);if(x[t>>2]=o,(t+=4)+4>n)break}return x[t>>2]=0,t-i},Sr=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},Er=(e,t,r)=>{var i,n,s,o,a;r=Ne(r),2===t?(i=gr,n=yr,o=vr,s=()=>U,a=1):4===t&&(i=br,n=wr,o=Sr,s=()=>B,a=2),qe(e,{name:r,fromWireType:e=>{for(var r,n=B[e>>2],o=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==o[c>>a]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return oi(e),r},toWireType:(e,i)=>{"string"!=typeof i&&He(`Cannot pass non-string to C++ string type ${r}`);var s=o(i),d=li(4+s+t);return B[d>>2]=s>>a,n(i,d+4,s+t),null!==e&&e.push(oi,d),d},argPackAdvance:Ke,readValueFromPointer:or,destructorFunction(e){oi(e)}})},Ar=(e,t)=>{qe(e,{isVoid:!0,name:t=Ne(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},Ur={},xr=e=>{var t=Ur[e];return void 0===t?Ne(e):t},Br=[],kr=(e,t,r,i,n)=>(e=Br[e])(t=sr.toValue(t),t[r=xr(r)],i,n),Tr=e=>{var t=Br.length;return Br.push(e),t},Cr=(e,t)=>{var r=Oe[e];return void 0===r&&He(t+" has unknown type "+Ht(e)),r},Dr=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},Pr=(e,t,r)=>{var i=[],n=e.toWireType(i,r);return i.length&&(B[t>>2]=sr.toHandle(i)),n},Fr=(e,t,r)=>{var i=Dr(e,t),n=i.shift();e--;var s="return function (obj, func, destructorsRef, args) {\n",o=0,a=[];0===r&&a.push("obj");for(var d=["retType"],l=[n],c=0;ce.name)).join(", ")}) => ${n.name}>`;return Tr(vt(h,u))},Lr=e=>{var t=sr.toValue(e);qt(t),rr(e)},Ir=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,Mr=()=>{j("")},Rr=()=>Date.now(),zr=(e,t,r)=>E.copyWithin(e,t,t+r),Nr=e=>{j("OOM")},$r=e=>{E.length,Nr()},Or={},Gr=()=>l||"./this.program",Hr=()=>{if(!Hr.strings){var e={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",_:Gr()};for(var t in Or)void 0===Or[t]?delete e[t]:e[t]=Or[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Hr.strings=r}return Hr.strings},Wr=(e,t)=>{for(var r=0;r>0]=e.charCodeAt(r);S[t>>0]=0},Vr=(e,t)=>{var r=0;return Hr().forEach(((i,n)=>{var s=t+r;B[e+4*n>>2]=s,Wr(i,s),r+=i.length+1})),0},jr=(e,t)=>{var r=Hr();B[e>>2]=r.length;var i=0;return r.forEach((e=>i+=e.length+1)),B[t>>2]=i,0};function qr(e){try{var t=De.getStreamFromFD(e);return Te.close(t),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Yr(e,t){try{var r=De.getStreamFromFD(e),i=r.tty?2:Te.isDir(r.mode)?3:Te.isLink(r.mode)?7:4;return S[t>>0]=i,A[t+2>>1]=0,K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[t+8>>2]=K[0],x[t+12>>2]=K[1],K=[0,(Y=0,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[t+16>>2]=K[0],x[t+20>>2]=K[1],0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Kr=(e,t,r,i)=>{for(var n=0,s=0;s>2],a=B[t+4>>2];t+=8;var d=Te.read(e,S,o,a,i);if(d<0)return-1;if(n+=d,d>2]=s,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}function Zr(e,t,r,i,n){var s=Ir(t,r);try{if(isNaN(s))return 61;var o=De.getStreamFromFD(e);return Te.llseek(o,s,i),K=[o.position>>>0,(Y=o.position,+Math.abs(Y)>=1?Y>0?+Math.floor(Y/4294967296)>>>0:~~+Math.ceil((Y-+(~~Y>>>0))/4294967296)>>>0:0)],x[n>>2]=K[0],x[n+4>>2]=K[1],o.getdents&&0===s&&0===i&&(o.getdents=null),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var Jr=(e,t,r,i)=>{for(var n=0,s=0;s>2],a=B[t+4>>2];t+=8;var d=Te.write(e,S,o,a,i);if(d<0)return-1;n+=d,void 0!==i&&(i+=d)}return n};function Qr(e,t,r,i){try{var n=De.getStreamFromFD(e),s=Jr(n,t,r);return B[i>>2]=s,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}}var ei=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=Te.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},ti=365,ri=146;Object.defineProperties(ei.prototype,{read:{get:function(){return(this.mode&ti)===ti},set:function(e){e?this.mode|=ti:this.mode&=~ti}},write:{get:function(){return(this.mode&ri)===ri},set:function(e){e?this.mode|=ri:this.mode&=~ri}},isFolder:{get:function(){return Te.isDir(this.mode)}},isDevice:{get:function(){return Te.isChrdev(this.mode)}}}),Te.FSNode=ei,Te.createPreloadedFile=xe,Te.staticInit(),ze(),Ie=n.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Me=n.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},gt(),ct(),Dt(),Lt=n.UnboundTypeError=Gt(Error,"UnboundTypeError"),Qt(),nr();var ii,ni={o:oe,A:Pe,s:Fe,q:Re,C:Xe,D:Vt,y:Xt,h:Jt,B:ar,l:cr,c:hr,b:fr,m:mr,j:Er,n:Ar,f:kr,g:rr,e:Fr,d:Lr,a:Mr,i:Rr,w:zr,r:$r,u:Vr,v:jr,k:qr,t:Yr,z:Xr,p:Zr,x:Qr},si=ie(),oi=e=>(oi=si.G)(e),ai=()=>(ai=si.I)(),di=e=>(di=si.J)(e),li=e=>(li=si.K)(e),ci=e=>(ci=si.M)(e);function ui(){function e(){ii||(ii=!0,n.calledRun=!0,C||(R(),r(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),z()))}G>0||(M(),G>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.dynCall_viiijj=(e,t,r,i,s,o,a,d)=>(n.dynCall_viiijj=si.N)(e,t,r,i,s,o,a,d),n.dynCall_jij=(e,t,r,i)=>(n.dynCall_jij=si.O)(e,t,r,i),n.dynCall_jii=(e,t,r)=>(n.dynCall_jii=si.P)(e,t,r),n.dynCall_jiji=(e,t,r,i,s)=>(n.dynCall_jiji=si.Q)(e,t,r,i,s),H=function e(){ii||ui(),ii||(H=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return ui(),t.ready}})(),a=1e-6,d="undefined"!=typeof Float32Array?Float32Array:Array;function l(){var e=new d(16);return d!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function c(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var u,h=function(e,t,r,i,n,s,o){var a=1/(t-r),d=1/(i-n),l=1/(s-o);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*d,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*a,e[13]=(n+i)*d,e[14]=(o+s)*l,e[15]=1,e};function f(e,t,r){var i=new d(3);return i[0]=e,i[1]=t,i[2]=r,i}u=new d(3),d!=Float32Array&&(u[0]=0,u[1]=0,u[2]=0);var p=(e,t)=>{t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);const r=function(){const t=m(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),r=m(e.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))return console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(i)),null;return i}();let i={program:r,attribLocations:{vertexPosition:e.getAttribLocation(r,"aVertexPosition"),texturePosition:e.getAttribLocation(r,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(r,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(r,"uModelMatrix"),viewMatrix:e.getUniformLocation(r,"uViewMatrix"),rgbatexture:e.getUniformLocation(r,"rgbaTexture"),ytexture:e.getUniformLocation(r,"yTexture"),utexture:e.getUniformLocation(r,"uTexture"),vtexture:e.getUniformLocation(r,"vTexture"),isyuv:e.getUniformLocation(r,"isyuv")}},n=function(){const t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),e.STATIC_DRAW);var r=[];r=r.concat([0,1],[1,1],[1,0],[0,0]);const i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW);const n=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,texPosition:i,indices:n}}(),s=p(),o=p(),d=p(),u=p();function p(){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function m(t,r){const i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(console.log("An error occurred compiling the shaders: "+e.getShaderInfoLog(i)),e.deleteShader(i),null)}function _(t,r){e.viewport(0,0,t,r),e.clearColor(0,0,0,0),e.clearDepth(1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);const s=l();h(s,-1,1,-1,1,.1,100);const p=l();c(p);const m=l();!function(e,t,r,i){var n,s,o,d,l,u,h,f,p,m,_=t[0],g=t[1],y=t[2],v=i[0],b=i[1],w=i[2],S=r[0],E=r[1],A=r[2];Math.abs(_-S)32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let r=e-this._current_word_bits_left;this._fillCurrentWord();let i=Math.min(r,this._current_word_bits_left),n=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Wt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Vt=Wt,jt=Wt;function qt(e){let{profile:t,sampleRate:r,channel:i}=e;return new Uint8Array([175,0,t<<3|(14&r)>>1,(1&r)<<7|i<<3])}function Yt(e){return Kt(e)&&e[1]===Bt}function Kt(e){return e[0]>>4===$e}const Xt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Zt(e){let t=new Uint8Array(e),r=null,i=0,n=0,s=0,o=null;if(i=n=t[0]>>>3,s=(7&t[0])<<1|t[1]>>>7,s<0||s>=Xt.length)return void console.error("Flv: AAC invalid sampling frequency index!");let a=Xt[s],d=(120&t[1])>>>3;if(d<0||d>=8)return void console.log("Flv: AAC invalid channel configuration");5===i&&(o=(7&t[1])<<1|t[2]>>>7,t[2]);let l=$t.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?s>=6?(i=5,r=new Array(4),o=s-3):(i=2,r=new Array(2),o=s):-1!==l.indexOf("android")?(i=2,r=new Array(2),o=s):(i=5,o=s,r=new Array(4),s>=6?o=s-3:1===d&&(i=2,r=new Array(2),o=s)),r[0]=i<<3,r[0]|=(15&s)>>>1,r[1]=(15&s)<<7,r[1]|=(15&d)<<3,5===i&&(r[1]|=(15&o)>>>1,r[2]=(1&o)<<7,r[2]|=8,r[3]=0),{audioType:"aac",config:r,sampleRate:a,channelCount:d,objectType:i,codec:"mp4a.40."+i,originalCodec:"mp4a.40."+n}}class Jt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+7>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(4095===(r[t+0]<<8|r[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let r=this.current_syncword_offset_,i=(8&e[r+1])>>>3,n=(6&e[r+1])>>>1,s=1&e[r+1],o=(192&e[r+2])>>>6,a=(60&e[r+2])>>>2,d=(1&e[r+2])<<2|(192&e[r+3])>>>6,l=(3&e[r+3])<<11|e[r+4]<<3|(224&e[r+5])>>>5;if(e[r+6],r+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let c=1===s?7:9,u=l-c;r+=c;let h=this.findNextSyncwordOffset(r+u);if(this.current_syncword_offset_=h,0!==i&&1!==i||0!==n)continue;let f=e.subarray(r,r+u);t={},t.audio_object_type=o+1,t.sampling_freq_index=a,t.sampling_frequency=Vt[a],t.channel_config=d,t.data=f}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Qt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+1>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(695===(r[t+0]<<3|r[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),r=0;for(let i=0;i<=t;i++)r<<=8,r|=e.readByte();return r}readNextAACFrame(e){let t=this.data_,r=null;for(;null==r&&!this.eof_flag_;){let i=this.current_syncword_offset_,n=(31&t[i+1])<<8|t[i+2];if(i+3+n>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let s=new Ht(t.subarray(i+3,i+3+n)),o=null;if(s.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(i+3+n),s.destroy();continue}o=e}else{let e=s.readBool();if(e&&s.readBool()){console.error("audioMuxVersionA is Not Supported"),s.destroy();break}if(e&&this.getLATMValue(s),!s.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),s.destroy();break}if(0!==s.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),s.destroy();break}if(0!==s.readBits(4)){console.error("more than 2 numProgram Not Supported"),s.destroy();break}if(0!==s.readBits(3)){console.error("more than 2 numLayer Not Supported"),s.destroy();break}let t=e?this.getLATMValue(s):0,r=s.readBits(5);t-=5;let i=s.readBits(4);t-=4;let n=s.readBits(4);t-=4,s.readBits(3),t-=3,t>0&&s.readBits(t);let a=s.readBits(3);if(0!==a){console.error(`frameLengthType = ${a}. Only frameLengthType = 0 Supported`),s.destroy();break}s.readByte();let d=s.readBool();if(d)if(e)this.getLATMValue(s);else{let e=0;for(;;){e<<=8;let t=s.readBool();if(e+=s.readByte(),!t)break}console.log(e)}s.readBool()&&s.readByte(),o={},o.audio_object_type=r,o.sampling_freq_index=i,o.sampling_frequency=Vt[o.sampling_freq_index],o.channel_config=n,o.other_data_present=d}let a=0;for(;;){let e=s.readByte();if(a+=e,255!==e)break}let d=new Uint8Array(a);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function tr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return[];const r=e.length,i=[];let n,s=0;for(;s+t>>=8),s+=t,n){if(s+n>r)break;i.push(e.subarray(s,s+n)),s+=n}return i}function rr(e){const t=e.byteLength,r=new Uint8Array(4);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t;const i=new Uint8Array(t+4);return i.set(r,0),i.set(e,4),i}function ir(e,t){let r=null;return t?e.length>=28&&(r=1+(3&e[26])):e.length>=12&&(r=1+(3&e[9])),r}function nr(){return(new Date).getTime()}function sr(e,t,r){return Math.max(Math.min(e,Math.max(t,r)),Math.min(t,r))}function or(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function ar(e){let t=0,r=or();return i=>{if(n=i,"[object Number]"!==Object.prototype.toString.call(n))return;var n;t+=i;const s=or(),o=s-r;o>=1e3&&(e(t/o*1e3),r=s,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();function dr(e){return null==e}function lr(e){return!dr(e)}function cr(e){return"function"==typeof e}function ur(e){let t=null,r=31&e[0];return r!==We&&r!==Ve||(t=ze),t||(r=(126&e[0])>>1,r!==st&&r!==at&&r!==lt||(t=Ne)),t}function hr(){return"undefined"!=typeof WritableStream}function fr(e){e.close()}function pr(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let r=e[0],i=null,n=1;if(e.length>0){let t=e[1];t&&t.ts-r.ts>1e5&&(r=t,n=2)}if(r)for(let s=n;s=1e3){e[s-1].ts-r.ts<1e3&&(i=s+1)}}}return i}function mr(e){return e.ok&&e.status>=200&&e.status<=299}function _r(){return function(e){let t="";if("object"==typeof e)try{t=JSON.stringify(e),t=JSON.parse(t)}catch(r){t=e}else t=e;return t}(B)}function gr(e){return e[0]>>4===kt&&e[1]===Bt}function yr(e){return!0===e||"true"===e}function vr(e){return!0!==e&&"true"!==e}function br(){return!!($t.Worker&&$t.MediaSource&&"canConstructInDedicatedWorker"in $t.MediaSource&&!0===$t.MediaSource.canConstructInDedicatedWorker)}function wr(e,t){const r=tr(e.slice(5));let i=!1;return r.forEach((e=>{const r=t?e[0]>>>1&63:31&e[0];(t&&(r===Qe||r===tt||r===it)||vr(t)&&r===je)&&(i=!0)})),i}var Sr=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}d((i=i.apply(e,t||[])).next())}))};const Er=Symbol(32),Ar=Symbol(16),Ur=Symbol(8);class xr{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return Sr(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,r)=>{var i;this.reject=r,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(i=this.pull)||void 0===i||i.call(this,e)}))}))}readU32(){return this.read(Er)}readU16(){return this.read(Ar)}readU8(){return this.read(Ur)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let r=0;const i=e=>t.length<(r=e);if("number"==typeof this.need){if(i(this.need))return;e=t.subarray(0,r)}else if(this.need===Er){if(i(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Ar){if(i(2))return;e=t[0]<<8|t[1]}else if(this.need===Ur){if(i(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(i(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,r)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(i(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,r)),e=this.need}return this.consumed+=r,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,r=t+e;if(r<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,r);else{const e=new Uint8Array(r);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,r)}return this.buffer=new Uint8Array(e),this.buffer}}xr.U32=Er,xr.U16=Ar,xr.U8=Ur;class Br{constructor(e){this.log=function(t){if(e._opt.debugLevel==S){const s=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n1?r-1:0),n=1;n1?i-1:0),s=1;s=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseSPS(e){let t=kr._ebsp2rbsp(e),r=new Ht(t);r.readByte();let i=r.readByte();r.readByte();let n=r.readByte();r.readUEG();let s=kr.getProfileString(i),o=kr.getLevelString(n),a=1,d=420,l=[0,420,422,444],c=8;if((100===i||110===i||122===i||244===i||44===i||83===i||86===i||118===i||128===i||138===i||144===i)&&(a=r.readUEG(),3===a&&r.readBits(1),a<=3&&(d=l[a]),c=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool())){let e=3!==a?8:12;for(let t=0;t0&&e<16?(b=t[e-1],w=i[e-1]):255===e&&(b=r.readByte()<<8|r.readByte(),w=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);E=r.readBool(),A=t,U=2*e,S=A/U}}let x=1;1===b&&1===w||(x=b/w);let B=0,k=0;if(0===a)B=1,k=2-m;else{B=3===a?1:2,k=(1===a?2:1)*(2-m)}let T=16*(f+1),C=16*(p+1)*(2-m);T-=(_+g)*B,C-=(y+v)*k;let D=Math.ceil(T*x);return r.destroy(),r=null,{profile_string:s,level_string:o,bit_depth:c,ref_frames:h,chroma_format:d,chroma_format_string:kr.getChromaFormatString(d),frame_rate:{fixed:E,fps:S,fps_den:U,fps_num:A},sar_ratio:{width:b,height:w},codec_size:{width:T,height:C},present_size:{width:D,height:C}}}static parseSPS$2(e){let t=e.subarray(1,4),r="avc1.";for(let e=0;e<3;e++){let i=t[e].toString(16);i.length<2&&(i="0"+i),r+=i}let i=kr._ebsp2rbsp(e),n=new Ht(i);n.readByte();let s=n.readByte();n.readByte();let o=n.readByte();n.readUEG();let a=kr.getProfileString(s),d=kr.getLevelString(o),l=1,c=420,u=[0,420,422,444],h=8,f=8;if((100===s||110===s||122===s||244===s||44===s||83===s||86===s||118===s||128===s||138===s||144===s)&&(l=n.readUEG(),3===l&&n.readBits(1),l<=3&&(c=u[l]),h=n.readUEG()+8,f=n.readUEG()+8,n.readBits(1),n.readBool())){let e=3!==l?8:12;for(let t=0;t0&&e<16?(E=t[e-1],A=r[e-1]):255===e&&(E=n.readByte()<<8|n.readByte(),A=n.readByte()<<8|n.readByte())}if(n.readBool()&&n.readBool(),n.readBool()&&(n.readBits(4),n.readBool()&&n.readBits(24)),n.readBool()&&(n.readUEG(),n.readUEG()),n.readBool()){let e=n.readBits(32),t=n.readBits(32);x=n.readBool(),B=t,k=2*e,U=B/k}}let T=1;1===E&&1===A||(T=E/A);let C=0,D=0;if(0===l)C=1,D=2-y;else{C=3===l?1:2,D=(1===l?2:1)*(2-y)}let P=16*(_+1),F=16*(g+1)*(2-y);P-=(v+b)*C,F-=(w+S)*D;let L=Math.ceil(P*T);return n.destroy(),n=null,{codec_mimetype:r,profile_idc:s,level_idc:o,profile_string:a,level_string:d,chroma_format_idc:l,bit_depth:h,bit_depth_luma:h,bit_depth_chroma:f,ref_frames:m,chroma_format:c,chroma_format_string:kr.getChromaFormatString(c),frame_rate:{fixed:x,fps:U,fps_den:k,fps_num:B},sar_ratio:{width:E,height:A},codec_size:{width:P,height:F},present_size:{width:L,height:F}}}static _skipScalingList(e,t){let r=8,i=8,n=0;for(let s=0;s=this.buflen)return this.iserro=!0,0;this.iserro=!1,r=this.bufoff+e>8?8-this.bufoff:e,t<<=r,t+=this.buffer[this.bufpos]>>8-this.bufoff-r&255>>8-r,this.bufoff+=r,e-=r,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,r=this.bufoff,i=this.read(e);return this.bufpos=t,this.bufoff=r,i}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.sps,4),t.sps=i}if(t.pps){const e=t.pps.byteLength,r=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.pps,4),t.pps=i}return t}function Dr(e){let{sps:t,pps:r}=e;const i=[23,0,0,0,0,1,66,0,30,255];i[0]=23,i[6]=t[1],i[7]=t[2],i[8]=t[3],i[10]=225,i[11]=t.byteLength>>8&255,i[12]=255&t.byteLength,i.push(...t,1,r.byteLength>>8&255,255&r.byteLength,...r);return new Uint8Array(i)}function Pr(e){let{sps:t,pps:r}=e,i=8+t.byteLength+1+2+r.byteLength,n=!1;const s=kr.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(n=!0,i+=4);let o=new Uint8Array(i);o[0]=1,o[1]=t[1],o[2]=t[2],o[3]=t[3],o[4]=255,o[5]=225;let a=t.byteLength;o[6]=a>>>8,o[7]=255&a;let d=8;o.set(t,8),d+=a,o[d]=1;let l=r.byteLength;o[d+1]=l>>>8,o[d+2]=255&l,o.set(r,d+3),d+=3+l,n&&(o[d]=252|s.chroma_format_idc,o[d+1]=248|s.bit_depth_luma-8,o[d+2]=248|s.bit_depth_chroma-8,o[d+3]=0,d+=4);const c=[23,0,0,0,0],u=new Uint8Array(c.length+o.byteLength);return u.set(c,0),u.set(o,c.length),u}function Fr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Lr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Ir(e){return 31&e[0]}function Mr(e){return e===Ke}function Rr(e){return!function(e){return e===We||e===Ve}(e)&&!Mr(e)}function zr(e){return e===je}function Nr(e){if(0===e.length)return!1;const t=Ir(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=31&e[r],n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,i>=Je||0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class Or{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Gr=e=>{let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)},Hr=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Wr{static _ebsp2rbsp(e){let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseVPS(e){let t=Wr._ebsp2rbsp(e),r=new Ht(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}}static parseSPS(e){let t=Wr._ebsp2rbsp(e),r=new Ht(t);r.readByte(),r.readByte();let i=0,n=0,s=0,o=0;r.readBits(4);let a=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=a;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<=16?(L=t[e-1],I=i[e-1]):255===e&&(L=r.readBits(16),I=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()){r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())}if(r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG()),r.readBool()){if(R=r.readBits(32),z=r.readBits(32),r.readBool()&&r.readUEG(),r.readBool()){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=a;n++){let n=r.readBool();M=n;let s=!0,o=1;n||(s=r.readBool());let a=!1;if(s?r.readUEG():a=r.readBool(),a||(o=r.readUEG()+1),e){for(let e=0;e>6&3,r.general_tier_flag=e[1]>>5&1,r.general_profile_idc=31&e[1],r.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],r.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],r.general_constraint_indicator_flags=r.general_constraint_indicator_flags<<16|e[10]<<8|e[11],r.general_level_idc=e[12],r.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],r.parallelismType=3&e[15],r.chromaFormat=3&e[16],r.bitDepthLumaMinus8=7&e[17],r.bitDepthChromaMinus8=7&e[18],r.avgFrameRate=e[19]<<8|e[20],r.constantFrameRate=e[21]>>6&3,r.numTemporalLayers=e[21]>>3&7,r.temporalIdNested=e[21]>>2&1,r.lengthSizeMinusOne=3&e[21];let i=e[22],n=e.slice(23);for(let e=0;e0)for(let t=r;t<8;t++)e.read(2);i.sub_layer_profile_space=[],i.sub_layer_tier_flag=[],i.sub_layer_profile_idc=[],i.sub_layer_profile_compatibility_flag=[],i.sub_layer_progressive_source_flag=[],i.sub_layer_interlaced_source_flag=[],i.sub_layer_non_packed_constraint_flag=[],i.sub_layer_frame_only_constraint_flag=[],i.sub_layer_level_idc=[];for(let t=0;t{let t=Gr(e),r=new Ht(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}})(t),o=(e=>{let t=Gr(e),r=new Ht(t);r.readByte(),r.readByte();let i=0,n=0,s=0,o=0;r.readBits(4);let a=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=a;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<16?(L=t[e-1],I=i[e-1]):255===e&&(L=r.readBits(16),I=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(i+=r.readUEG(),n+=r.readUEG(),s+=r.readUEG(),o+=r.readUEG()),r.readBool()&&(R=r.readBits(32),z=r.readBits(32),r.readBool()&&(r.readUEG(),r.readBool()))){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=a;n++){let n=r.readBool();M=n;let s=!1,o=1;n||(s=r.readBool());let a=!1;if(s?r.readSEG():a=r.readBool(),a||(cpbcnt=r.readUEG()+1),e)for(let e=0;e{let t=Gr(e),r=new Ht(t);r.readByte(),r.readByte(),r.readUEG(),r.readUEG(),r.readBool(),r.readBool(),r.readBits(3),r.readBool(),r.readBool(),r.readUEG(),r.readUEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool()&&r.readUEG(),r.readSEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool(),r.readBool();let i=r.readBool(),n=r.readBool(),s=1;return n&&i?s=0:n?s=3:i&&(s=2),{parallelismType:s}})(r);n=Object.assign(n,s,o,a);let d=23+(5+t.byteLength)+(5+i.byteLength)+(5+r.byteLength),l=new Uint8Array(d);l[0]=1,l[1]=(3&n.general_profile_space)<<6|(n.general_tier_flag?1:0)<<5|31&n.general_profile_idc,l[2]=n.general_profile_compatibility_flags_1||0,l[3]=n.general_profile_compatibility_flags_2||0,l[4]=n.general_profile_compatibility_flags_3||0,l[5]=n.general_profile_compatibility_flags_4||0,l[6]=n.general_constraint_indicator_flags_1||0,l[7]=n.general_constraint_indicator_flags_2||0,l[8]=n.general_constraint_indicator_flags_3||0,l[9]=n.general_constraint_indicator_flags_4||0,l[10]=n.general_constraint_indicator_flags_5||0,l[11]=n.general_constraint_indicator_flags_6||0,l[12]=60,l[13]=240|(3840&n.min_spatial_segmentation_idc)>>8,l[14]=255&n.min_spatial_segmentation_idc,l[15]=252|3&n.parallelismType,l[16]=252|3&n.chroma_format_idc,l[17]=248|7&n.bit_depth_luma_minus8,l[18]=248|7&n.bit_depth_chroma_minus8,l[19]=0,l[20]=0,l[21]=(3&n.constant_frame_rate)<<6|(7&n.num_temporal_layers)<<3|(n.temporal_id_nested?1:0)<<2|3,l[22]=3,l[23]=128|st,l[24]=0,l[25]=1,l[26]=(65280&t.byteLength)>>8,l[27]=(255&t.byteLength)>>0,l.set(t,28),l[23+(5+t.byteLength)+0]=128|at,l[23+(5+t.byteLength)+1]=0,l[23+(5+t.byteLength)+2]=1,l[23+(5+t.byteLength)+3]=(65280&i.byteLength)>>8,l[23+(5+t.byteLength)+4]=(255&i.byteLength)>>0,l.set(i,23+(5+t.byteLength)+5),l[23+(5+t.byteLength+5+i.byteLength)+0]=128|lt,l[23+(5+t.byteLength+5+i.byteLength)+1]=0,l[23+(5+t.byteLength+5+i.byteLength)+2]=1,l[23+(5+t.byteLength+5+i.byteLength)+3]=(65280&r.byteLength)>>8,l[23+(5+t.byteLength+5+i.byteLength)+4]=(255&r.byteLength)>>0,l.set(r,23+(5+t.byteLength+5+i.byteLength)+5);const c=[28,0,0,0,0],u=new Uint8Array(c.length+l.byteLength);return u.set(c,0),u.set(l,c.length),u}function Kr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Xr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Zr(e){return(126&e[0])>>1}function Jr(e){return e===ut}function Qr(e){return!function(e){return e>=32&&e<=40}(e)}function ei(e){return e>=16&&e<=21}function ti(e){if(0===e.length)return!1;const t=Zr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=e[r]>>1&63,n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class ii{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}function ni(e){return parseInt(e)===e}function si(e){if(!ni(e.length))return!1;for(var t=0;t255)return!1;return!0}function oi(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!si(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(ni(e.length)&&si(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function ai(e){return new Uint8Array(e)}function di(e,t,r,i,n){null==i&&null==n||(e=e.slice?e.slice(i,n):Array.prototype.slice.call(e,i,n)),t.set(e,r)}var li,ci={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},ui=(li="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r>4]+li[15&i])}return t.join("")}}),hi={16:10,24:12,32:14},fi=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],pi=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],mi=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],_i=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],gi=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],yi=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],vi=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],bi=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],wi=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],Si=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Ei=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Ai=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Ui=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],xi=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Bi=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function ki(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=s[t],this._Kd[e-r][t%4]=s[t];for(var o,a=0,d=n;d>16&255]<<24^pi[o>>8&255]<<16^pi[255&o]<<8^pi[o>>24&255]^fi[a]<<24,a+=1,8!=n)for(t=1;t>8&255]<<8^pi[o>>16&255]<<16^pi[o>>24&255]<<24;for(t=n/2+1;t>2,c=d%4,this._Ke[l][c]=s[t],this._Kd[e-l][c]=s[t++],d++}for(var l=1;l>24&255]^Ui[o>>16&255]^xi[o>>8&255]^Bi[255&o]},Ti.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=ki(e),n=0;n<4;n++)i[n]^=this._Ke[0][n];for(var s=1;s>24&255]^gi[i[(n+1)%4]>>16&255]^yi[i[(n+2)%4]>>8&255]^vi[255&i[(n+3)%4]]^this._Ke[s][n];i=r.slice()}var o,a=ai(16);for(n=0;n<4;n++)o=this._Ke[t][n],a[4*n]=255&(pi[i[n]>>24&255]^o>>24),a[4*n+1]=255&(pi[i[(n+1)%4]>>16&255]^o>>16),a[4*n+2]=255&(pi[i[(n+2)%4]>>8&255]^o>>8),a[4*n+3]=255&(pi[255&i[(n+3)%4]]^o);return a},Ti.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=ki(e),n=0;n<4;n++)i[n]^=this._Kd[0][n];for(var s=1;s>24&255]^wi[i[(n+3)%4]>>16&255]^Si[i[(n+2)%4]>>8&255]^Ei[255&i[(n+1)%4]]^this._Kd[s][n];i=r.slice()}var o,a=ai(16);for(n=0;n<4;n++)o=this._Kd[t][n],a[4*n]=255&(mi[i[n]>>24&255]^o>>24),a[4*n+1]=255&(mi[i[(n+3)%4]>>16&255]^o>>16),a[4*n+2]=255&(mi[i[(n+2)%4]>>8&255]^o>>8),a[4*n+3]=255&(mi[255&i[(n+1)%4]]^o);return a};var Ci=function(e){if(!(this instanceof Ci))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new Ti(e)};Ci.prototype.encrypt=function(e){if((e=oi(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=ai(e.length),r=ai(16),i=0;iNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},Li.prototype.setBytes=function(e){if(16!=(e=oi(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Li.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var Ii=function(e,t){if(!(this instanceof Ii))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Li||(t=new Li(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new Ti(e)};Ii.prototype.encrypt=function(e){for(var t=oi(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,i=0;i>>2]>>>24-s%4*8&255;t[i+s>>>2]|=o<<24-(i+s)%4*8}else for(var a=0;a>>2]=r[a>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-n%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new l.init(r,t/2)}},h=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new l.init(r,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=a.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,n=i.words,s=i.sigBytes,o=this.blockSize,a=s/(4*o),d=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,c=e.min(4*d,s);if(d){for(var u=0;u>>2]|=e[n]<<24-n%4*8;t.call(this,i,r)}else t.apply(this,arguments)};i.prototype=e}}(),r.lib.WordArray)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.WordArray,i=e.enc;function n(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var r=e.length,i=[],n=0;n>>1]|=e.charCodeAt(n)<<16-n%2*16;return t.create(i,2*r)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s>>2]>>>16-s%4*8&65535);i.push(String.fromCharCode(o))}return i.join("")},parse:function(e){for(var r=e.length,i=[],s=0;s>>1]|=n(e.charCodeAt(s)<<16-s%2*16);return t.create(i,2*r)}}}(),r.enc.Utf16)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.WordArray;function i(e,r,i){for(var n=[],s=0,o=0;o>>6-o%4*2;n[s>>>2]|=a<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var n=[],s=0;s>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,a=0;a<4&&s+.75*a>>6*(3-a)&63));var d=i.charAt(64);if(d)for(;n.length%4;)n.push(d);return n.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var s=0;s>>6-o%4*2;n[s>>>2]|=a<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,n=t?this._safe_map:this._map;e.clamp();for(var s=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(r[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|r[o+2>>>2]>>>24-(o+2)%4*8&255,d=0;d<4&&o+.75*d>>6*(3-d)&63));var l=n.charAt(64);if(l)for(;s.length%4;)s.push(l);return s.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,n=t?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var o=0;o>>24)|4278255360&(n<<24|n>>>8)}var s=this._hash.words,o=e[t+0],d=e[t+1],f=e[t+2],p=e[t+3],m=e[t+4],_=e[t+5],g=e[t+6],y=e[t+7],v=e[t+8],b=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],A=e[t+13],U=e[t+14],x=e[t+15],B=s[0],k=s[1],T=s[2],C=s[3];B=l(B,k,T,C,o,7,a[0]),C=l(C,B,k,T,d,12,a[1]),T=l(T,C,B,k,f,17,a[2]),k=l(k,T,C,B,p,22,a[3]),B=l(B,k,T,C,m,7,a[4]),C=l(C,B,k,T,_,12,a[5]),T=l(T,C,B,k,g,17,a[6]),k=l(k,T,C,B,y,22,a[7]),B=l(B,k,T,C,v,7,a[8]),C=l(C,B,k,T,b,12,a[9]),T=l(T,C,B,k,w,17,a[10]),k=l(k,T,C,B,S,22,a[11]),B=l(B,k,T,C,E,7,a[12]),C=l(C,B,k,T,A,12,a[13]),T=l(T,C,B,k,U,17,a[14]),B=c(B,k=l(k,T,C,B,x,22,a[15]),T,C,d,5,a[16]),C=c(C,B,k,T,g,9,a[17]),T=c(T,C,B,k,S,14,a[18]),k=c(k,T,C,B,o,20,a[19]),B=c(B,k,T,C,_,5,a[20]),C=c(C,B,k,T,w,9,a[21]),T=c(T,C,B,k,x,14,a[22]),k=c(k,T,C,B,m,20,a[23]),B=c(B,k,T,C,b,5,a[24]),C=c(C,B,k,T,U,9,a[25]),T=c(T,C,B,k,p,14,a[26]),k=c(k,T,C,B,v,20,a[27]),B=c(B,k,T,C,A,5,a[28]),C=c(C,B,k,T,f,9,a[29]),T=c(T,C,B,k,y,14,a[30]),B=u(B,k=c(k,T,C,B,E,20,a[31]),T,C,_,4,a[32]),C=u(C,B,k,T,v,11,a[33]),T=u(T,C,B,k,S,16,a[34]),k=u(k,T,C,B,U,23,a[35]),B=u(B,k,T,C,d,4,a[36]),C=u(C,B,k,T,m,11,a[37]),T=u(T,C,B,k,y,16,a[38]),k=u(k,T,C,B,w,23,a[39]),B=u(B,k,T,C,A,4,a[40]),C=u(C,B,k,T,o,11,a[41]),T=u(T,C,B,k,p,16,a[42]),k=u(k,T,C,B,g,23,a[43]),B=u(B,k,T,C,b,4,a[44]),C=u(C,B,k,T,E,11,a[45]),T=u(T,C,B,k,x,16,a[46]),B=h(B,k=u(k,T,C,B,f,23,a[47]),T,C,o,6,a[48]),C=h(C,B,k,T,y,10,a[49]),T=h(T,C,B,k,U,15,a[50]),k=h(k,T,C,B,_,21,a[51]),B=h(B,k,T,C,E,6,a[52]),C=h(C,B,k,T,p,10,a[53]),T=h(T,C,B,k,w,15,a[54]),k=h(k,T,C,B,d,21,a[55]),B=h(B,k,T,C,v,6,a[56]),C=h(C,B,k,T,x,10,a[57]),T=h(T,C,B,k,g,15,a[58]),k=h(k,T,C,B,A,21,a[59]),B=h(B,k,T,C,m,6,a[60]),C=h(C,B,k,T,S,10,a[61]),T=h(T,C,B,k,f,15,a[62]),k=h(k,T,C,B,b,21,a[63]),s[0]=s[0]+B|0,s[1]=s[1]+k|0,s[2]=s[2]+T|0,s[3]=s[3]+C|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;r[n>>>5]|=128<<24-n%32;var s=e.floor(i/4294967296),o=i;r[15+(n+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(n+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,d=a.words,l=0;l<4;l++){var c=d[l];d[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return a},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,i,n,s,o){var a=e+(t&r|~t&i)+n+o;return(a<>>32-s)+t}function c(e,t,r,i,n,s,o){var a=e+(t&i|r&~i)+n+o;return(a<>>32-s)+t}function u(e,t,r,i,n,s,o){var a=e+(t^r^i)+n+o;return(a<>>32-s)+t}function h(e,t,r,i,n,s,o){var a=e+(r^(t|~i))+n+o;return(a<>>32-s)+t}t.MD5=s._createHelper(d),t.HmacMD5=s._createHmacHelper(d)}(Math),r.MD5)})),Gt((function(e,t){var r,i,n,s,o,a,d,l;e.exports=(i=(r=l=Ri).lib,n=i.WordArray,s=i.Hasher,o=r.algo,a=[],d=o.SHA1=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],d=r[4],l=0;l<80;l++){if(l<16)a[l]=0|e[t+l];else{var c=a[l-3]^a[l-8]^a[l-14]^a[l-16];a[l]=c<<1|c>>>31}var u=(i<<5|i>>>27)+d+a[l];u+=l<20?1518500249+(n&s|~n&o):l<40?1859775393+(n^s^o):l<60?(n&s|n&o|s&o)-1894007588:(n^s^o)-899497514,d=o,o=s,s=n<<30|n>>>2,n=i,i=u}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+d|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=s._createHelper(d),r.HmacSHA1=s._createHmacHelper(d),l.SHA1)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,o=t.algo,a=[],d=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,n=0;n<64;)t(i)&&(n<8&&(a[n]=r(e.pow(i,.5))),d[n]=r(e.pow(i,1/3)),n++),i++}();var l=[],c=o.SHA256=s.extend({_doReset:function(){this._hash=new n.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],a=r[4],c=r[5],u=r[6],h=r[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,_=l[f-2],g=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;l[f]=m+l[f-7]+g+l[f-16]}var y=i&n^i&s^n&s,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&c^~a&u)+d[f]+l[f];h=u,u=c,c=a,a=o+b|0,o=s,s=n,n=i,i=b+(v+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+a|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=s._createHelper(c),t.HmacSHA256=s._createHmacHelper(c)}(Math),r.SHA256)})),Gt((function(e,t){var r,i,n,s,o,a;e.exports=(i=(r=a=Ri).lib.WordArray,n=r.algo,s=n.SHA256,o=n.SHA224=s.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=s._createHelper(o),r.HmacSHA224=s._createHmacHelper(o),a.SHA224)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.Hasher,i=e.x64,n=i.Word,s=i.WordArray,o=e.algo;function a(){return n.create.apply(n,arguments)}var d=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=a()}();var c=o.SHA512=t.extend({_doReset:function(){this._hash=new s.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],a=r[4],c=r[5],u=r[6],h=r[7],f=i.high,p=i.low,m=n.high,_=n.low,g=s.high,y=s.low,v=o.high,b=o.low,w=a.high,S=a.low,E=c.high,A=c.low,U=u.high,x=u.low,B=h.high,k=h.low,T=f,C=p,D=m,P=_,F=g,L=y,I=v,M=b,R=w,z=S,N=E,$=A,O=U,G=x,H=B,W=k,V=0;V<80;V++){var j,q,Y=l[V];if(V<16)q=Y.high=0|e[t+2*V],j=Y.low=0|e[t+2*V+1];else{var K=l[V-15],X=K.high,Z=K.low,J=(X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7,Q=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),ee=l[V-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ne=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),se=l[V-7],oe=se.high,ae=se.low,de=l[V-16],le=de.high,ce=de.low;q=(q=(q=J+oe+((j=Q+ae)>>>0>>0?1:0))+ie+((j+=ne)>>>0>>0?1:0))+le+((j+=ce)>>>0>>0?1:0),Y.high=q,Y.low=j}var ue,he=R&N^~R&O,fe=z&$^~z&G,pe=T&D^T&F^D&F,me=C&P^C&L^P&L,_e=(T>>>28|C<<4)^(T<<30|C>>>2)^(T<<25|C>>>7),ge=(C>>>28|T<<4)^(C<<30|T>>>2)^(C<<25|T>>>7),ye=(R>>>14|z<<18)^(R>>>18|z<<14)^(R<<23|z>>>9),ve=(z>>>14|R<<18)^(z>>>18|R<<14)^(z<<23|R>>>9),be=d[V],we=be.high,Se=be.low,Ee=H+ye+((ue=W+ve)>>>0>>0?1:0),Ae=ge+me;H=O,W=G,O=N,G=$,N=R,$=z,R=I+(Ee=(Ee=(Ee=Ee+he+((ue+=fe)>>>0>>0?1:0))+we+((ue+=Se)>>>0>>0?1:0))+q+((ue+=j)>>>0>>0?1:0))+((z=M+ue|0)>>>0>>0?1:0)|0,I=F,M=L,F=D,L=P,D=T,P=C,T=Ee+(_e+pe+(Ae>>>0>>0?1:0))+((C=ue+Ae|0)>>>0>>0?1:0)|0}p=i.low=p+C,i.high=f+T+(p>>>0>>0?1:0),_=n.low=_+P,n.high=m+D+(_>>>0

>>0?1:0),y=s.low=y+L,s.high=g+F+(y>>>0>>0?1:0),b=o.low=b+M,o.high=v+I+(b>>>0>>0?1:0),S=a.low=S+z,a.high=w+R+(S>>>0>>0?1:0),A=c.low=A+$,c.high=E+N+(A>>>0<$>>>0?1:0),x=u.low=x+G,u.high=U+O+(x>>>0>>0?1:0),k=h.low=k+W,h.high=B+H+(k>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(c),e.HmacSHA512=t._createHmacHelper(c)}(),r.SHA512)})),Gt((function(e,t){var r,i,n,s,o,a,d,l;e.exports=(i=(r=l=Ri).x64,n=i.Word,s=i.WordArray,o=r.algo,a=o.SHA512,d=o.SHA384=a.extend({_doReset:function(){this._hash=new s.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=a._createHelper(d),r.HmacSHA384=a._createHmacHelper(d),l.SHA384)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,o=t.x64.Word,a=t.algo,d=[],l=[],c=[];!function(){for(var e=1,t=0,r=0;r<24;r++){d[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var n=1,s=0;s<24;s++){for(var a=0,u=0,h=0;h<7;h++){if(1&n){var f=(1<>>24)|4278255360&(s<<24|s>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(k=r[n]).high^=o,k.low^=s}for(var a=0;a<24;a++){for(var h=0;h<5;h++){for(var f=0,p=0,m=0;m<5;m++)f^=(k=r[h+5*m]).high,p^=k.low;var _=u[h];_.high=f,_.low=p}for(h=0;h<5;h++){var g=u[(h+4)%5],y=u[(h+1)%5],v=y.high,b=y.low;for(f=g.high^(v<<1|b>>>31),p=g.low^(b<<1|v>>>31),m=0;m<5;m++)(k=r[h+5*m]).high^=f,k.low^=p}for(var w=1;w<25;w++){var S=(k=r[w]).high,E=k.low,A=d[w];A<32?(f=S<>>32-A,p=E<>>32-A):(f=E<>>64-A,p=S<>>64-A);var U=u[l[w]];U.high=f,U.low=p}var x=u[0],B=r[0];for(x.high=B.high,x.low=B.low,h=0;h<5;h++)for(m=0;m<5;m++){var k=r[w=h+5*m],T=u[w],C=u[(h+1)%5+5*m],D=u[(h+2)%5+5*m];k.high=T.high^~C.high&D.high,k.low=T.low^~C.low&D.low}k=r[0];var P=c[a];k.high^=P.high,k.low^=P.low}},_doFinalize:function(){var t=this._data,r=t.words;this._nDataBytes;var i=8*t.sigBytes,s=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/s)*s>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var o=this._state,a=this.cfg.outputLength/8,d=a/8,l=[],c=0;c>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(h)}return new n.init(l,a)},clone:function(){for(var e=s.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=s._createHelper(h),t.HmacSHA3=s._createHmacHelper(h)}(Math),r.SHA3)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,o=t.algo,a=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=n.create([0,1518500249,1859775393,2400959708,2840853838]),h=n.create([1352829926,1548603684,1836072691,2053994217,0]),f=o.RIPEMD160=s.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s,o,f,b,w,S,E,A,U,x,B,k=this._hash.words,T=u.words,C=h.words,D=a.words,P=d.words,F=l.words,L=c.words;for(S=s=k[0],E=o=k[1],A=f=k[2],U=b=k[3],x=w=k[4],r=0;r<80;r+=1)B=s+e[t+D[r]]|0,B+=r<16?p(o,f,b)+T[0]:r<32?m(o,f,b)+T[1]:r<48?_(o,f,b)+T[2]:r<64?g(o,f,b)+T[3]:y(o,f,b)+T[4],B=(B=v(B|=0,F[r]))+w|0,s=w,w=b,b=v(f,10),f=o,o=B,B=S+e[t+P[r]]|0,B+=r<16?y(E,A,U)+C[0]:r<32?g(E,A,U)+C[1]:r<48?_(E,A,U)+C[2]:r<64?m(E,A,U)+C[3]:p(E,A,U)+C[4],B=(B=v(B|=0,L[r]))+x|0,S=x,x=U,U=v(A,10),A=E,E=B;B=k[1]+f+U|0,k[1]=k[2]+b+x|0,k[2]=k[3]+w+S|0,k[3]=k[4]+s+E|0,k[4]=k[0]+o+A|0,k[0]=B},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var n=this._hash,s=n.words,o=0;o<5;o++){var a=s[o];s[o]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return n},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function m(e,t,r){return e&t|~e&r}function _(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function v(e,t){return e<>>32-t}t.RIPEMD160=s._createHelper(f),t.HmacRIPEMD160=s._createHmacHelper(f)}(),r.RIPEMD160)})),Gt((function(e,t){var r,i,n;e.exports=(i=(r=Ri).lib.Base,n=r.enc.Utf8,void(r.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),o=this._iKey=t.clone(),a=s.words,d=o.words,l=0;l>>2];e.sigBytes-=t}};i.BlockCipher=c.extend({cfg:c.cfg.extend({mode:f,padding:p}),reset:function(){var e;c.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=i.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?s.create([1398893684,1701076831]).concat(r).concat(t):t).toString(d)},parse:function(e){var t,r=d.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=s.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),m.create({ciphertext:r,salt:t})}},g=i.SerializableCipher=n.extend({cfg:n.extend({format:_}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),s=n.finalize(t),o=n.cfg;return m.create({ciphertext:s,key:r,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,i,n){if(i||(i=s.random(8)),n)o=l.create({keySize:t+r,hasher:n}).compute(e,i);else var o=l.create({keySize:t+r}).compute(e,i);var a=s.create(o.words.slice(t),4*r);return o.sigBytes=4*t,m.create({key:o,iv:a,salt:i})}},v=i.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=n.iv;var s=g.encrypt.call(this,e,t,n.key,i);return s.mixIn(n),s},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=n.iv,g.decrypt.call(this,e,t,n.key,i)}})}())})),Gt((function(e,t){var r;e.exports=((r=Ri).mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,i){var n,s=this._iv;s?(n=s.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var o=0;o>24&255)){var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}else e+=1<<24;return e}function i(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var n=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,s=this._iv,o=this._counter;s&&(o=this._counter=s.slice(0),this._iv=void 0),i(o);var a=o.slice(0);r.encryptBlock(a,0);for(var d=0;d>>2]|=n<<24-s%4*8,e.sigBytes+=n},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),Gt((function(e,t){var r;e.exports=((r=Ri).pad.Iso10126={pad:function(e,t){var i=4*t,n=i-e.sigBytes%i;e.concat(r.lib.WordArray.random(n-1)).concat(r.lib.WordArray.create([n<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),Gt((function(e,t){var r;e.exports=((r=Ri).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),Gt((function(e,t){var r;e.exports=((r=Ri).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)})),Gt((function(e,t){var r;e.exports=((r=Ri).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib.CipherParams,n=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return i.create({ciphertext:t})}}}(),r.format.Hex)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.BlockCipher,i=e.algo,n=[],s=[],o=[],a=[],d=[],l=[],c=[],u=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,n[r]=p,s[p]=r;var m=e[r],_=e[m],g=e[_],y=257*e[p]^16843008*p;o[r]=y<<24|y>>>8,a[r]=y<<16|y>>>16,d[r]=y<<8|y>>>24,l[r]=y,y=16843009*g^65537*_^257*m^16843008*r,c[p]=y<<24|y>>>8,u[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,r?(r=m^e[e[e[g^m]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=i.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),s=this._keySchedule=[],o=0;o6&&o%r==4&&(l=n[l>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l]):(l=n[(l=l<<8|l>>>24)>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l],l^=p[o/r|0]<<24),s[o]=s[o-r]^l);for(var a=this._invKeySchedule=[],d=0;d>>24]]^u[n[l>>>16&255]]^h[n[l>>>8&255]]^f[n[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,a,d,l,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,c,u,h,f,s),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,s,o,a){for(var d=this._nRounds,l=e[t]^r[0],c=e[t+1]^r[1],u=e[t+2]^r[2],h=e[t+3]^r[3],f=4,p=1;p>>24]^n[c>>>16&255]^s[u>>>8&255]^o[255&h]^r[f++],_=i[c>>>24]^n[u>>>16&255]^s[h>>>8&255]^o[255&l]^r[f++],g=i[u>>>24]^n[h>>>16&255]^s[l>>>8&255]^o[255&c]^r[f++],y=i[h>>>24]^n[l>>>16&255]^s[c>>>8&255]^o[255&u]^r[f++];l=m,c=_,u=g,h=y}m=(a[l>>>24]<<24|a[c>>>16&255]<<16|a[u>>>8&255]<<8|a[255&h])^r[f++],_=(a[c>>>24]<<24|a[u>>>16&255]<<16|a[h>>>8&255]<<8|a[255&l])^r[f++],g=(a[u>>>24]<<24|a[h>>>16&255]<<16|a[l>>>8&255]<<8|a[255&c])^r[f++],y=(a[h>>>24]<<24|a[l>>>16&255]<<16|a[c>>>8&255]<<8|a[255&u])^r[f++],e[t]=m,e[t+1]=_,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(m)}(),r.AES)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib,i=t.WordArray,n=t.BlockCipher,s=e.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=s.DES=n.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=o[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],s=0;s<16;s++){var l=n[s]=[],c=d[s];for(r=0;r<24;r++)l[r/6|0]|=t[(a[r]-1+c)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(a[r+24]-1+c)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var u=this._invSubKeys=[];for(r=0;r<16;r++)u[r]=n[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],s=this._lBlock,o=this._rBlock,a=0,d=0;d<8;d++)a|=l[d][((o^n[d])&c[d])>>>0];this._lBlock=o,this._rBlock=s^a}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),n=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(i.create(t)),this._des2=u.createEncryptor(i.create(r)),this._des3=u.createEncryptor(i.create(n))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=n._createHelper(p)}(),r.TripleDES)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=i.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var s=0;n<256;n++){var o=n%r,a=t[o>>>2]>>>24-o%4*8&255;s=(s+i[n]+a)%256;var d=i[n];i[n]=i[s],i[s]=d}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var e=this._S,t=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[r],e[r]=s,i|=e[(e[t]+e[r])%256]<<24-8*n}return this._i=t,this._j=r,i}e.RC4=t._createHelper(n);var o=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)s.call(this)}});e.RC4Drop=t._createHelper(o)}(),r.RC4)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],o=[],a=i.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)d.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(t){var s=t.words,o=s[0],a=s[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(n[0]^=l,n[1]^=u,n[2]^=c,n[3]^=h,n[4]^=l,n[5]^=u,n[6]^=c,n[7]^=h,r=0;r<4;r++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,a=i>>>16,d=((n*n>>>17)+n*a>>>15)+a*a,l=((4294901760&i)*i|0)+((65535&i)*i|0);o[r]=d^l}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=t._createHelper(a)}(),r.Rabbit)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],o=[],a=i.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var n=0;n<4;n++)d.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var s=t.words,o=s[0],a=s[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(i[0]^=l,i[1]^=u,i[2]^=c,i[3]^=h,i[4]^=l,i[5]^=u,i[6]^=c,i[7]^=h,n=0;n<4;n++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,a=i>>>16,d=((n*n>>>17)+n*a>>>15)+a*a,l=((4294901760&i)*i|0)+((65535&i)*i|0);o[r]=d^l}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=t._createHelper(a)}(),r.RabbitLegacy)})),Gt((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.BlockCipher,i=e.algo;const n=16,s=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],o=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var a={pbox:[],sbox:[]};function d(e,t){let r=t>>24&255,i=t>>16&255,n=t>>8&255,s=255&t,o=e.sbox[0][r]+e.sbox[1][i];return o^=e.sbox[2][n],o+=e.sbox[3][s],o}function l(e,t,r){let i,s=t,o=r;for(let t=0;t1;--t)s^=e.pbox[t],o=d(e,s)^o,i=s,s=o,o=i;return i=s,s=o,o=i,o^=e.pbox[1],s^=e.pbox[0],{left:s,right:o}}function u(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=o[t][r]}let i=0;for(let o=0;o=r&&(i=0);let a=0,d=0,c=0;for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),r=new Uint8Array(r);const n=e.byteLength;let s=5;for(;sn)break;let a=e[s+4],d=!1;if(i?(a=a>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(a)):(a&=31,d=1===a||5===a),d){const i=e.slice(s+4+2,s+4+o);let n=new Mi.ModeOfOperation.ctr(t,new Mi.Counter(r));const a=n.decrypt(i);n=null,e.set(a,s+4+2)}s=s+4+o}return e}function $i(e,t,r){if(e.byteLength<=30)return e;const i=e.slice(32);let n=new Mi.ModeOfOperation.ctr(t,new Mi.Counter(r));const s=n.decrypt(i);return n=null,e.set(s,32),e}Gt((function(e,t){e.exports=Ri}));var Oi=Gt((function(e,t){var r,n,s,o=(r=new Date,n=4,s={setLogLevel:function(e){n=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=n&&console.debug("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=n&&console.info("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=n&&console.warn("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=n&&console.error("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}},s);o.getDurationString=function(e,t){var r;function i(e,t){for(var r=(""+e).split(".");r[0].length0){for(var r="",i=0;i0&&(r+=","),r+="["+o.getDurationString(e.start(i))+","+o.getDurationString(e.end(i))+"]";return r}return"(empty)"},t.Log=o;var a=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};a.prototype.getPosition=function(){return this.position},a.prototype.getEndPosition=function(){return this.buffer.byteLength},a.prototype.getLength=function(){return this.buffer.byteLength},a.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},a.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},a.prototype.readAnyInt=function(e,t){var r=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:r=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:r=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";r=this.dataview.getUint8(this.position)<<16,r|=this.dataview.getUint8(this.position+1)<<8,r|=this.dataview.getUint8(this.position+2);break;case 4:r=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";r=this.dataview.getUint32(this.position)<<32,r|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,r}throw"Not enough bytes in buffer"},a.prototype.readUint8=function(){return this.readAnyInt(1,!1)},a.prototype.readUint16=function(){return this.readAnyInt(2,!1)},a.prototype.readUint24=function(){return this.readAnyInt(3,!1)},a.prototype.readUint32=function(){return this.readAnyInt(4,!1)},a.prototype.readUint64=function(){return this.readAnyInt(8,!1)},a.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",r=0;rthis._byteLength&&(this._byteLength=t);else{for(r<1&&(r=1);t>r;)r*=2;var i=new ArrayBuffer(r),n=new Uint8Array(this._buffer);new Uint8Array(i,0,n.length).set(n),this.buffer=i,this._byteLength=t}}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),r=new Uint8Array(this._buffer,0,t.length);t.set(r),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Int32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Int16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Uint32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Uint16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var r=new Float64Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Float32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,r,i,n){var s=new Uint8Array(e,t,n),o=new Uint8Array(r,i,n);s.set(o)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=0;rn;i--,n++){var s=t[n];t[n]=t[i],t[i]=s}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],r=0;r>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},d.prototype.adjustUint32=function(e,t){var r=this.position;this.seek(e),this.writeUint32(t),this.seek(r)},d.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var r=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var r=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var r=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var r=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var r=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=8*e,r},d.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var r=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r};var c=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(c.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,o.debug("MultiBufferStream","Stream ready for parsing"),!0):(o.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(o.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){o.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r.buffer},c.prototype.reduceBuffer=function(e,t,r){var i;return(i=new Uint8Array(r)).set(new Uint8Array(e,t,r)),i.buffer.fileStart=e.fileStart+t,i.buffer.usedBytes=0,i.buffer},c.prototype.insertBuffer=function(e){for(var t=!0,r=0;ri.byteLength){this.buffers.splice(r,1),r--;continue}o.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=i.fileStart||(e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)),o.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(r,0,e),0===r&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,n,s)}}t&&(o.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===r&&(this.buffer=e))},c.prototype.logBufferLevel=function(e){var t,r,i,n,s,a=[],d="";for(i=0,n=0,t=0;t0&&(d+=s.end-1+"]");var l=e?o.info:o.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+i+"/"+n+" bytes), continuous ranges: "+d)},c.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},c.prototype.findPosition=function(e,t,r){var i,n=null,s=-1;for(i=!0===e?0:this.bufferIndex;i=t?(o.debug("MultiBufferStream","Found position in existing buffer #"+s),s):-1},c.prototype.findEndContiguousBuf=function(e){var t,r,i,n=void 0!==e?e:this.bufferIndex;if(r=this.buffers[n],this.buffers.length>n+1)for(t=n+1;t>3;return 31===i&&r.data.length>=2&&(i=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),i}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};t.MPEG4DescriptorParser=u;var h={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){h.FullBox.prototype=new h.Box,h.ContainerBox.prototype=new h.Box,h.SampleEntry.prototype=new h.Box,h.TrackGroupTypeBox.prototype=new h.FullBox,h.BASIC_BOXES.forEach((function(e){h.createBoxCtor(e)})),h.FULL_BOXES.forEach((function(e){h.createFullBoxCtor(e)})),h.CONTAINER_BOXES.forEach((function(e){h.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,r){this.type=e,this.size=t,this.uuid=r},FullBox:function(e,t,r){h.Box.call(this,e,t,r),this.flags=0,this.version=0},ContainerBox:function(e,t,r){h.Box.call(this,e,t,r),this.boxes=[]},SampleEntry:function(e,t,r,i){h.ContainerBox.call(this,e,t),this.hdr_size=r,this.start=i},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){h.FullBox.call(this,e,t)},createBoxCtor:function(e,t){h.boxCodes.push(e),h[e+"Box"]=function(t){h.Box.call(this,e,t)},h[e+"Box"].prototype=new h.Box,t&&(h[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){h[e+"Box"]=function(t){h.FullBox.call(this,e,t)},h[e+"Box"].prototype=new h.FullBox,h[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,r=0;rr?(o.error("BoxParser","Box of type '"+c+"' has a size "+l+" greater than its container size "+r),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:a}):0!==l&&a+l>e.getEndPosition()?(e.seek(a),o.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:a}):t?{code:h.OK,type:c,size:l,hdr_size:d,start:a}:(h[c+"Box"]?i=new h[c+"Box"](l):"uuid"!==c?(o.warn("BoxParser","Unknown box type: '"+c+"'"),(i=new h.Box(c,l)).has_unparsed_data=!0):h.UUIDBoxes[s]?i=new h.UUIDBoxes[s](l):(o.warn("BoxParser","Unknown uuid type: '"+s+"'"),(i=new h.Box(c,l)).uuid=s,i.has_unparsed_data=!0),i.hdr_size=d,i.start=a,i.write===h.Box.prototype.write&&"mdat"!==i.type&&(o.info("BoxParser","'"+u+"' box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),(n=e.getPosition()-(i.start+i.size))<0?(o.warn("BoxParser","Parsing of box '"+u+"' did not read the entire indicated box data size (missing "+-n+" bytes), seeking forward"),e.seek(i.start+i.size)):n>0&&(o.error("BoxParser","Parsing of box '"+u+"' read "+n+" more bytes than the indicated box data size, seeking backwards"),0!==i.size&&e.seek(i.start+i.size)),{code:h.OK,box:i,size:i.size})},h.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},h.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},h.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.ContainerBox.prototype.parse=function(e){for(var t,r;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},h.SAMPLE_ENTRY_TYPE_VISUAL="Visual",h.SAMPLE_ENTRY_TYPE_AUDIO="Audio",h.SAMPLE_ENTRY_TYPE_HINT="Hint",h.SAMPLE_ENTRY_TYPE_METADATA="Metadata",h.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",h.SAMPLE_ENTRY_TYPE_SYSTEM="System",h.SAMPLE_ENTRY_TYPE_TEXT="Text",h.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},h.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},h.SampleEntry.prototype.parseFooter=function(e){h.ContainerBox.prototype.parse.call(this,e)},h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_HINT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT,"enct"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA,"encm"),h.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var r=0;r<3;r++)this.layer_size[r]=16==t?e.readUint16():e.readUint32()})),h.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),h.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),h.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)o.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void o.error("av1C reserved_2 parsing problem");var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)}else o.error("av1C reserved_1 parsing problem");else o.error("av1C version "+this.version+" not supported")})),h.createBoxCtor("avcC",(function(e){var t,r;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),r=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(r))})),h.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),h.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),h.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),h.createFullBoxCtor("co64",(function(e){var t,r;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(r=0;r>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),h.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),h.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),h.createFullBoxCtor("ctts",(function(e){var t,r;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(r=0;r>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|r>>6&3,this.acmod=r>>3&7,this.lfeon=r>>2&1,this.bit_rate_code=3&r|i>>5&7})),h.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var r=0;r>6,i.bsid=n>>1&31,i.bsmod=(1&n)<<4|s>>4&15,i.acmod=s>>1&7,i.lfeon=1&s,i.num_dep_sub=o>>1&15,i.num_dep_sub>0&&(i.chan_loc=(1&o)<<8|e.readUint8())}})),h.createFullBoxCtor("dfLa",(function(e){var t=[],r=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var i=e.readUint8(),n=Math.min(127&i,r.length-1);if(n?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(r[n]),128&i)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),h.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[r]=e.readString(4),t-=4,r++})),h.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),h.createBoxCtor("hvcC",(function(e){var t,r,i,n;this.configurationVersion=e.readUint8(),n=e.readUint8(),this.general_profile_space=n>>6,this.general_tier_flag=(32&n)>>5,this.general_profile_idc=31&n,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),n=e.readUint8(),this.constantFrameRate=n>>6,this.numTemporalLayers=(13&n)>>3,this.temporalIdNested=(4&n)>>2,this.lengthSizeMinusOne=3&n,this.nalu_arrays=[];var s=e.readUint8();for(t=0;t>7,o.nalu_type=63&n;var a=e.readUint16();for(r=0;r>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var r=0;if(this.version<2)r=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";r=e.readUint32()}for(var i=0;i>7,this.axis=1&t})),h.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),o.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),h.createFullBoxCtor("ipma",(function(e){var t,r;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?o.property_index=(127&s)<<8|e.readUint8():o.property_index=127&s}}})),h.createFullBoxCtor("iref",(function(e){var t,r;for(this.references=[];e.getPosition()>7,i.assignment_type=127&n,i.assignment_type){case 0:i.grouping_type=e.readString(4);break;case 1:i.grouping_type=e.readString(4),i.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:i.sub_track_id=e.readUint32();break;default:o.warn("BoxParser","Unknown leva assignement type")}}})),h.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),h.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),f.prototype.toString=function(){return"("+this.x+","+this.y+")"},h.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new f(e.readUint16(),e.readUint16()),this.display_primaries[1]=new f(e.readUint16(),e.readUint16()),this.display_primaries[2]=new f(e.readUint16(),e.readUint16()),this.white_point=new f(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),h.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),h.createFullBoxCtor("mehd",(function(e){1&this.flags&&(o.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),h.createFullBoxCtor("meta",(function(e){this.boxes=[],h.ContainerBox.prototype.parse.call(this,e)})),h.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),h.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),h.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),h.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),h.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),h.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),h.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var r=0;r0){var t=e.readUint32();this.kid=[];for(var r=0;r0&&(this.data=e.readUint8Array(i))})),h.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),h.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),h.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var r=0;r>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var r=e.readUint8(),i=0;i>7,this.num_leading_samples=127&t})),h.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)o.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=h.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),h.createSampleGroupCtor("stsa",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),h.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),h.createSampleGroupCtor("tsas",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("tscl",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("vipr",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),r=0;r>6,this.sample_depends_on[i]=t>>4&3,this.sample_is_depended_on[i]=t>>2&3,this.sample_has_redundancy[i]=3&t})),h.createFullBoxCtor("senc"),h.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),o.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),r=0;r>31&1,i.referenced_size=2147483647&n,i.subsegment_duration=e.readUint32(),n=e.readUint32(),i.starts_with_SAP=n>>31&1,i.SAP_type=n>>28&7,i.SAP_delta_time=268435455&n}})),h.SingleItemTypeReferenceBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.SingleItemTypeReferenceBox.prototype=new h.Box,h.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var r=0;r>4&15,this.sample_sizes[t+1]=15&i}else if(8===this.field_size)for(t=0;t0)for(r=0;r>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=h.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),h.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),h.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),h.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var r=e.readUint32(),i=0;i>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),h.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),h.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),h.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},h.createTrackGroupCtor("msrc"),h.TrackReferenceTypeBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.TrackReferenceTypeBox.prototype=new h.Box,h.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},h.trefBox.prototype.parse=function(e){for(var t,r;e.getPosition()t&&this.flags&h.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var r=0;r>7&1,this.block_pad_lsb=r>>6&1,this.block_little_endian=r>>5&1,this.block_reversed=r>>4&1,this.pad_unknown=r>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),h.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),h.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),h.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),h.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=h.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),h.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),h.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=h.parseHex16(e)})),h.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),h.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),h.createFullBoxCtor("vvcC",(function(e){var t,r,i={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(i.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,r=this.num_sublayers-2;r>=0;--r){var o=i.extract_bits(1);this.ptl_sublayer_present_mask|=o<1;++r)i.extract_bits(1);for(this.sublayer_level_idc=[],r=this.num_sublayers-2;r>=0;--r)this.ptl_sublayer_present_mask&1<>=1;t+=h.decimalToHex(i,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var n=!1,s="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||n)&&(s="."+h.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+s,n=!0);t+=s}return t},h.vvc1SampleEntry.prototype.getCodec=h.vvi1SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var r="";if(this.vvcC.general_constraint_info){var i,n=[],s=0;for(s|=this.vvcC.ptl_frame_only_constraint<<7,s|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,n.push(s),s&&(i=e),s=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===i)r=".CA";else{r=".C";var o="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",a=0,d=0;for(e=0;e<=i;++e)for(a=a<<8|n[e],d+=8;d>=5;){r+=o[a>>d-5&31],a&=(1<<(d-=5))-1}d&&(r+=o[31&(a<<=5-d)])}}t+=r}return t},h.mp4aSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),r=this.esds.esd.getAudioConfig();return e+"."+h.decimalToHex(t)+(r?"."+r:"")}return e},h.stxtSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},h.vp08SampleEntry.prototype.getCodec=h.vp09SampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var r=this.vpcC.bitDepth;return 8==r&&(r="08"),e+".0"+this.vpcC.profile+"."+t+"."+r},h.av01SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this),r=this.av1C.seq_level_idx_0;return r<10&&(r="0"+r),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+r+(this.av1C.seq_tier_0?"H":"M")+"."+e},h.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),o.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>l?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>l&&e.writeUint64(this.size)},h.FullBox.prototype.writeHeader=function(e){this.size+=4,h.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},h.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},h.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},h.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},h.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},h.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},h.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&h.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&h.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&h.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&h.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[r]instanceof h.Box||t[r]instanceof h.Box||void 0===e[r]||void 0===t[r]||"function"==typeof e[r]||"function"==typeof t[r]||e.subBoxNames&&e.subBoxNames.indexOf(r.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(r.slice(0,4))>-1||"data"===r||"start"===r||"size"===r||"creation_time"===r||"modification_time"===r||h.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(r)>-1||e[r]===t[r]))return!1;return!0},h.boxEqual=function(e,t){if(!h.boxEqualFields(e,t))return!1;for(var r=0;r1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},g.prototype.setExtractionOptions=function(e,t,r){var i=this.getTrackById(e);if(i){var n={};this.extractedTracks.push(n),n.id=e,n.user=t,n.trak=i,i.nextSample=0,n.nb_samples=1e3,n.samples=[],r&&r.nbSamples&&(n.nb_samples=r.nbSamples)}},g.prototype.unsetExtractionOptions=function(e){for(var t=-1,r=0;r-1&&this.extractedTracks.splice(t,1)},g.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=h.parseOneBox(this.stream,false)).code===h.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var r;switch(r="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),r){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[r]&&o.warn("ISOFile","Duplicate Box of type: "+r+", overriding previous occurrence"),this[r]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},g.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(o.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(o.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(o.warn("ISOFile","Not ready to start parsing"),!1))},g.prototype.appendBuffer=function(e,t){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(o.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),o.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),r},g.prototype.getInfo=function(){var e,t,r,i,n,s,o={},a=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(o.hasMoov=!0,o.duration=this.moov.mvhd.duration,o.timescale=this.moov.mvhd.timescale,o.isFragmented=null!=this.moov.mvex,o.isFragmented&&this.moov.mvex.mehd&&(o.fragment_duration=this.moov.mvex.mehd.fragment_duration),o.isProgressive=this.isProgressive,o.hasIOD=null!=this.moov.iods,o.brands=[],o.brands.push(this.ftyp.major_brand),o.brands=o.brands.concat(this.ftyp.compatible_brands),o.created=new Date(a+1e3*this.moov.mvhd.creation_time),o.modified=new Date(a+1e3*this.moov.mvhd.modification_time),o.tracks=[],o.audioTracks=[],o.videoTracks=[],o.subtitleTracks=[],o.metadataTracks=[],o.hintTracks=[],o.otherTracks=[],e=0;e0?o.mime+='video/mp4; codecs="':o.audioTracks&&o.audioTracks.length>0?o.mime+='audio/mp4; codecs="':o.mime+='application/mp4; codecs="',e=0;e=r.samples.length)&&(o.info("ISOFile","Sending fragmented data on track #"+i.id+" for samples ["+Math.max(0,r.nextSample-i.nb_samples)+","+(r.nextSample-1)+"]"),o.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(i.id,i.user,i.segmentStream.buffer,r.nextSample,e||r.nextSample>=r.samples.length),i.segmentStream=null,i!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=r.samples.length)&&(o.debug("ISOFile","Sending samples on track #"+s.id+" for sample "+r.nextSample),this.onSamples&&this.onSamples(s.id,s.user,s.samples),s.samples=[],s!==this.extractedTracks[t]))break}}}},g.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},g.prototype.getBoxes=function(e,t){var r=[];return g._sweep.call(this,e,r,t),r},g._sweep=function(e,t,r){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&r)return;g._sweep.call(this.boxes[i],e,t,r)}},g.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},g.prototype.getTrackSample=function(e,t){var r=this.getTrackById(e);return this.getSample(r,t)},g.prototype.releaseUsedSamples=function(e,t,r){var i=0,n=this.getTrackById(e);n.lastValidSample||(n.lastValidSample=0);for(var s=n.lastValidSample;se*n.timescale){l=i-1;break}t&&n.is_sync&&(d=i)}for(t&&(l=d),e=r.samples[l].cts,r.nextSample=l;r.samples[l].alreadyRead===r.samples[l].size&&r.samples[l+1];)l++;return s=r.samples[l].offset+r.samples[l].alreadyRead,o.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+o.getDurationString(e,a)+" and offset: "+s),{offset:s,time:e/a}},g.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},g.prototype.seek=function(e,t){var r,i,n,s=this.moov,a={offset:1/0,time:1/0};if(this.moov){for(n=0;nthis.getTrackDuration(r)||((i=this.seekTrack(e,t,r)).offset-1){o=d;break}switch(o){case"Visual":if(n.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),s.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var u=new h.avcCBox;u.parse(new a(t.avcDecoderConfigRecord)),s.addBox(u)}else if(t.hevcDecoderConfigRecord){var f=new h.hvcCBox;f.parse(new a(t.hevcDecoderConfigRecord)),s.addBox(f)}break;case"Audio":n.add("smhd").set("balance",t.balance||0),s.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":n.add("hmhd");break;case"Subtitle":if(n.add("sthd"),"stpp"===t.type)s.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:n.add("nmhd")}t.description&&s.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){s.addBox(e)})),n.add("dinf").add("dref").addEntry((new h["url Box"]).set("flags",1));var p=n.add("stbl");return p.add("stsd").addEntry(s),p.add("stts").set("sample_counts",[]).set("sample_deltas",[]),p.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),p.add("stco").set("chunk_offsets",[]),p.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(r),t.id}},h.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},g.prototype.addSample=function(e,t,r){var i=r||{},n={},s=this.getTrackById(e);if(null!==s){n.number=s.samples.length,n.track_id=s.tkhd.track_id,n.timescale=s.mdia.mdhd.timescale,n.description_index=i.sample_description_index?i.sample_description_index-1:0,n.description=s.mdia.minf.stbl.stsd.entries[n.description_index],n.data=t,n.size=t.byteLength,n.alreadyRead=n.size,n.duration=i.duration||1,n.cts=i.cts||0,n.dts=i.dts||0,n.is_sync=i.is_sync||!1,n.is_leading=i.is_leading||0,n.depends_on=i.depends_on||0,n.is_depended_on=i.is_depended_on||0,n.has_redundancy=i.has_redundancy||0,n.degradation_priority=i.degradation_priority||0,n.offset=0,n.subsamples=i.subsamples,s.samples.push(n),s.samples_size+=n.size,s.samples_duration+=n.duration,void 0===s.first_dts&&(s.first_dts=i.dts),this.processSamples();var o=this.createSingleSampleMoof(n);return this.addBox(o),o.computeSize(),o.trafs[0].truns[0].data_offset=o.size+8,this.add("mdat").data=new Uint8Array(t),n}},g.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var r=new h.moofBox;r.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var i=r.add("traf"),n=this.getTrackById(e.track_id);return i.add("tfhd").set("track_id",e.track_id).set("flags",h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),i.add("tfdt").set("baseMediaDecodeTime",e.dts-(n.first_dts||0)),i.add("trun").set("flags",h.TRUN_FLAGS_DATA_OFFSET|h.TRUN_FLAGS_DURATION|h.TRUN_FLAGS_SIZE|h.TRUN_FLAGS_FLAGS|h.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),r},g.prototype.lastMoofIndex=0,g.prototype.samplesDataSize=0,g.prototype.resetTables=function(){var e,t,r,i,n,s;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(d=n[o].grouping_type+"/0",(a=new l(n[o].grouping_type,0)).is_fragment=!0,t.sample_groups_info[d]||(t.sample_groups_info[d]=a))}else for(o=0;o=2&&(d=i[o].grouping_type+"/0",a=new l(i[o].grouping_type,0),e.sample_groups_info[d]||(e.sample_groups_info[d]=a))},g.setSampleGroupProperties=function(e,t,r,i){var n,s;for(n in t.sample_groups=[],i){var o;if(t.sample_groups[n]={},t.sample_groups[n].grouping_type=i[n].grouping_type,t.sample_groups[n].grouping_type_parameter=i[n].grouping_type_parameter,r>=i[n].last_sample_in_run&&(i[n].last_sample_in_run<0&&(i[n].last_sample_in_run=0),i[n].entry_index++,i[n].entry_index<=i[n].sbgp.entries.length-1&&(i[n].last_sample_in_run+=i[n].sbgp.entries[i[n].entry_index].sample_count)),i[n].entry_index<=i[n].sbgp.entries.length-1?t.sample_groups[n].group_description_index=i[n].sbgp.entries[i[n].entry_index].group_description_index:t.sample_groups[n].group_description_index=-1,0!==t.sample_groups[n].group_description_index)o=i[n].fragment_description?i[n].fragment_description:i[n].description,t.sample_groups[n].group_description_index>0?(s=t.sample_groups[n].group_description_index>65535?(t.sample_groups[n].group_description_index>>16)-1:t.sample_groups[n].group_description_index-1,o&&s>=0&&(t.sample_groups[n].description=o.entries[s])):o&&o.version>=2&&o.default_group_description_index>0&&(t.sample_groups[n].description=o.entries[o.default_group_description_index-1])}},g.process_sdtp=function(e,t,r){t&&(e?(t.is_leading=e.is_leading[r],t.depends_on=e.sample_depends_on[r],t.is_depended_on=e.sample_is_depended_on[r],t.has_redundancy=e.sample_has_redundancy[r]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},g.prototype.buildSampleLists=function(){var e,t;for(e=0;ev&&(b++,v<0&&(v=0),v+=s.sample_counts[b]),t>0?(e.samples[t-1].duration=s.sample_deltas[b],e.samples_duration+=e.samples[t-1].duration,x.dts=e.samples[t-1].dts+e.samples[t-1].duration):x.dts=0,o?(t>=w&&(S++,w<0&&(w=0),w+=o.sample_counts[S]),x.cts=e.samples[t].dts+o.sample_offsets[S]):x.cts=x.dts,a?(t==a.sample_numbers[E]-1?(x.is_sync=!0,E++):(x.is_sync=!1,x.degradation_priority=0),l&&l.entries[A].sample_delta+U==t+1&&(x.subsamples=l.entries[A].subsamples,U+=l.entries[A].sample_delta,A++)):x.is_sync=!0,g.process_sdtp(e.mdia.minf.stbl.sdtp,x,x.number),x.degradation_priority=h?h.priority[t]:0,l&&l.entries[A].sample_delta+U==t&&(x.subsamples=l.entries[A].subsamples,U+=l.entries[A].sample_delta),(c.length>0||u.length>0)&&g.setSampleGroupProperties(e,x,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},g.prototype.updateSampleLists=function(){var e,t,r,i,n,s,o,a,d,l,c,u,f,p,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&g.initSampleGroups(u,c,c.sbgps,u.mdia.minf.stbl.sgpds,c.sgpds),t=0;t0?p.dts=u.samples[u.samples.length-2].dts+u.samples[u.samples.length-2].duration:(c.tfdt?p.dts=c.tfdt.baseMediaDecodeTime:p.dts=0,u.first_traf_merged=!0),p.cts=p.dts,_.flags&h.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+_.sample_composition_time_offset[r]),m=o,_.flags&h.TRUN_FLAGS_FLAGS?m=_.sample_flags[r]:0===r&&_.flags&h.TRUN_FLAGS_FIRST_FLAG&&(m=_.first_sample_flags),p.is_sync=!(m>>16&1),p.is_leading=m>>26&3,p.depends_on=m>>24&3,p.is_depended_on=m>>22&3,p.has_redundancy=m>>20&3,p.degradation_priority=65535&m;var y=!!(c.tfhd.flags&h.TFHD_FLAG_BASE_DATA_OFFSET),v=!!(c.tfhd.flags&h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),b=!!(_.flags&h.TRUN_FLAGS_DATA_OFFSET),w=0;w=y?c.tfhd.base_data_offset:v||0===t?l.start:a,p.offset=0===t&&0===r?b?w+_.data_offset:w:a,a=p.offset+p.size,(c.sbgps.length>0||c.sgpds.length>0||u.mdia.minf.stbl.sbgps.length>0||u.mdia.minf.stbl.sgpds.length>0)&&g.setSampleGroupProperties(u,p,p.number_in_traf,c.sample_groups_info)}}if(c.subs){u.has_fragment_subsamples=!0;var S=c.first_sample_index;for(t=0;t-1))return null;var s=(r=this.stream.buffers[n]).byteLength-(i.offset+i.alreadyRead-r.fileStart);if(i.size-i.alreadyRead<=s)return o.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+(i.size-i.alreadyRead)+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,i.size-i.alreadyRead),r.usedBytes+=i.size-i.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead=i.size,i;if(0===s)return null;o.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+s+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,s),i.alreadyRead+=s,r.usedBytes+=s,this.stream.logBufferLevel()}},g.prototype.releaseSample=function(e,t){var r=e.samples[t];return r.data?(this.samplesDataSize-=r.size,r.data=null,r.description=null,delete r.degradation_priority,delete r.depends_on,delete r.description_index,delete r.has_redundancy,delete r.is_depended_on,delete r.is_leading,delete r.is_sync,delete r.moof_number,delete r.number_in_traf,delete r.timescale,delete r.cts,delete r.dts,delete r.offset,delete r.size,delete r.track_id,delete r.duration,r.alreadyRead=0,r.size):0},g.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},g.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},g.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(r.protection=s.ipro.protections[s.iinf.item_infos[e].protection_index-1]),s.iinf.item_infos[e].item_type?r.type=s.iinf.item_infos[e].item_type:r.type="mime",r.content_type=s.iinf.item_infos[e].content_type,r.content_encoding=s.iinf.item_infos[e].content_encoding;if(s.grpl)for(e=0;e0&&h.property_index-1-1))return null;var a=(t=this.stream.buffers[s]).byteLength-(n.offset+n.alreadyRead-t.fileStart);if(!(n.length-n.alreadyRead<=a))return o.debug("ISOFile","Getting item #"+e+" extent #"+i+" partial data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+a+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,a),n.alreadyRead+=a,r.alreadyRead+=a,t.usedBytes+=a,this.stream.logBufferLevel(),null;o.debug("ISOFile","Getting item #"+e+" extent #"+i+" data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+(n.length-n.alreadyRead)+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,n.length-n.alreadyRead),t.usedBytes+=n.length-n.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead+=n.length-n.alreadyRead,n.alreadyRead=n.length}}return r.alreadyRead===r.size?r:null},g.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var r=0;r0?this.moov.traks[e].samples[0].duration:0),t.push(i)}return t},g.prototype.getPerformanceInfo=function(){var e={};return e.moov=this.moov,this.moov&&this.moov.traks&&this.moov.traks.length>1&&(e.moovAudioNum=this.moov.traks[0].samples.length,e.moovVideoNum=this.moov.traks[1].samples.length),e},h.Box.prototype.printHeader=function(e){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},h.FullBox.prototype.printHeader=function(e){this.size+=4,h.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},h.Box.prototype.print=function(e){this.printHeader(e)},h.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},h.tkhdBox.prototype.print=function(e){h.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var y={createFile:function(e,t){var r=void 0===e||e,i=new g(t);return i.discardMdatData=!r,i}};t.createFile=y.createFile}));function Gi(e){return e.reduce(((e,t)=>256*e+t))}function Hi(e){const t=[101,103,119,99],r=e.length-28,i=e.slice(r,r+t.length);return t.every(((e,t)=>e===i[t]))}Oi.Log,Oi.MP4BoxStream,Oi.DataStream,Oi.MultiBufferStream,Oi.MPEG4DescriptorParser,Oi.BoxParser,Oi.XMLSubtitlein4Parser,Oi.Textin4Parser,Oi.ISOFile,Oi.createFile;class Wi{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(r+32,r+32+t))]}return null}(t,this.t);if(!r)return e;const i=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(i instanceof Error)return console.error(i.message),this.d=!0,e;this.A=!0,this.u=r[1],Hi(t)&&this.c++,WebAssembly.instantiate(r[2],i).then((e=>{if("function"!=typeof(t=e.instance.exports).parse||"object"!=typeof t.memory)return this.d=!0,void console.error("video_error_3");var t;this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}function Vi(){for(var e=arguments.length,t=new Array(e),r=0;r{const r=new i((0|e.byteLength)+(0|t.byteLength));return r.set(e,0),r.set(t,0|e.byteLength),r}),new i)}const ji=16,qi=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],Yi=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Ki(e){const t=[];for(let r=0,i=e.length;r1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Zi(e){const t=[];for(let r=0,i=e.length;r>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}function Ji(e){const t=[];for(let r=0,i=e.length;r=240&&e[r]<=247?(t.push(String.fromCodePoint(((7&e[r])<<18)+((63&e[r+1])<<12)+((63&e[r+2])<<6)+(63&e[r+3]))),r+=3):e[r]>=224&&e[r]<=239?(t.push(String.fromCodePoint(((15&e[r])<<12)+((63&e[r+1])<<6)+(63&e[r+2]))),r+=2):e[r]>=192&&e[r]<=223?(t.push(String.fromCodePoint(((31&e[r])<<6)+(63&e[r+1]))),r++):t.push(String.fromCodePoint(e[r]));return t.join("")}function Qi(e,t){const r=31&t;return e<>>32-r}function en(e){return(255&qi[e>>>24&255])<<24|(255&qi[e>>>16&255])<<16|(255&qi[e>>>8&255])<<8|255&qi[255&e]}function tn(e){return e^Qi(e,2)^Qi(e,10)^Qi(e,18)^Qi(e,24)}function rn(e){return e^Qi(e,13)^Qi(e,23)}function nn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[4*t],n[1]=255&e[4*t+1],n[2]=255&e[4*t+2],n[3]=255&e[4*t+3],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];for(let e,t=0;t<32;t+=4)e=i[1]^i[2]^i[3]^r[t+0],i[0]^=tn(en(e)),e=i[2]^i[3]^i[0]^r[t+1],i[1]^=tn(en(e)),e=i[3]^i[0]^i[1]^r[t+2],i[2]^=tn(en(e)),e=i[0]^i[1]^i[2]^r[t+3],i[3]^=tn(en(e));for(let e=0;e<16;e+=4)t[e]=i[3-e/4]>>>24&255,t[e+1]=i[3-e/4]>>>16&255,t[e+2]=i[3-e/4]>>>8&255,t[e+3]=255&i[3-e/4]}function sn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[0+4*t],n[1]=255&e[1+4*t],n[2]=255&e[2+4*t],n[3]=255&e[3+4*t],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let e,r=0;r<32;r+=4)e=i[1]^i[2]^i[3]^Yi[r+0],t[r+0]=i[0]^=rn(en(e)),e=i[2]^i[3]^i[0]^Yi[r+1],t[r+1]=i[1]^=rn(en(e)),e=i[3]^i[0]^i[1]^Yi[r+2],t[r+2]=i[2]^=rn(en(e)),e=i[0]^i[1]^i[2]^Yi[r+3],t[r+3]=i[3]^=rn(en(e));if(0===r)for(let e,r=0;r<16;r++)e=t[r],t[r]=t[31-r],t[31-r]=e}function on(e,t,r){let{padding:i="pkcs#7",mode:n,iv:s=[],output:o="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===n&&("string"==typeof s&&(s=Ki(s)),16!==s.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=Ki(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==r?Zi(e):Ki(e):[...e],("pkcs#5"===i||"pkcs#7"===i)&&0!==r){const t=ji-e.length%ji;for(let r=0;r=ji;){const t=e.slice(u,u+16),i=new Array(16);if("cbc"===n)for(let e=0;e2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let s=new Uint8Array(e.slice(0,5)),o=5;for(;on){const t=new Uint8Array(s.length+e.length-o);t.set(s,0),t.set(e.slice(o),s.length),s=t;break}let l=e[o+4],c=!1,u=2;if(r?(i&&(u=3),l=l>>>1&63,c=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(l)):(l&=31,c=1===l||5===l),c){const r=on(e.slice(o+4+u,o+4+d),t,0,{padding:"none",output:"array"});let i=r[r.length-1];if(i>0&&i<16){let e=!0;for(let t=1;t<=i;t++)if(r[r.length-t]!==i){e=!1;break}e&&r.splice(r.length-i,i)}const n=new Uint8Array(u);n.set(e.slice(o+4,o+4+u),0);const a=rr(Vi(n,new Uint8Array(r))),l=new Uint8Array(s.length+a.length);l.set(s,0),l.set(a,s.length),s=l}else{const t=e.slice(o+4,o+4+d),r=new Uint8Array(s.length+4+t.length);r.set(s,0),r.set(a,s.length),r.set(t,s.length+4),s=r}o=o+4+d}return s}const ln={init:0,findFirstStartCode:1,findSecondStartCode:2};class cn extends class{on(e,t,r){const i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:r}),this}once(e,t,r){const i=this;function n(){i.off(e,n);for(var s=arguments.length,o=new Array(s),a=0;a1?r-1:0),n=1;n{delete r[e]})),void delete this.e;const i=r[e],n=[];if(i&&t)for(let e=0,r=i.length;e=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=ln.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==ln.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=ln.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==ln.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=ln.findFirstStartCode}}}}function un(e,t,r){for(let i=2;i3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let s=5;for(;sn)break;let a=e[s+4],d=!1;if(i?(a=a>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(a)):(a&=31,d=1===a||5===a),d){const i=un(e.slice(s+4,s+4+o),t,r);e.set(i,s+4)}s=s+4+o}return e}function pn(){for(var e=arguments.length,t=new Array(e),r=0;re+t.byteLength),0));let n=0;return t.forEach((e=>{i.set(e,n),n+=e.byteLength})),i}class mn{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,r,i)));e.addEventListener(t,r,i);const n=()=>{cr(e.removeEventListener)&&e.removeEventListener(t,r,i)};return this.destroys.push(n),n}destroy(){this.master.debugLog("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class _n{static init(){_n.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in _n.types)_n.types.hasOwnProperty(e)&&(_n.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=_n.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,r=null,i=Array.prototype.slice.call(arguments,1),n=i.length;for(let e=0;e>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r.set(e,4);let s=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return _n.box(_n.types.trak,_n.tkhd(e),_n.mdia(e))}static tkhd(e){let t=e.id,r=e.duration,i=e.presentWidth,n=e.presentHeight;return _n.box(_n.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>>8&255,255&i,0,0,n>>>8&255,255&n,0,0]))}static mdia(e){return _n.box(_n.types.mdia,_n.mdhd(e),_n.hdlr(e),_n.minf(e))}static mdhd(e){let t=e.timescale,r=e.duration;return _n.box(_n.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?_n.constants.HDLR_AUDIO:_n.constants.HDLR_VIDEO,_n.box(_n.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?_n.box(_n.types.smhd,_n.constants.SMHD):_n.box(_n.types.vmhd,_n.constants.VMHD),_n.box(_n.types.minf,t,_n.dinf(),_n.stbl(e))}static dinf(){return _n.box(_n.types.dinf,_n.box(_n.types.dref,_n.constants.DREF))}static stbl(e){return _n.box(_n.types.stbl,_n.stsd(e),_n.box(_n.types.stts,_n.constants.STTS),_n.box(_n.types.stsc,_n.constants.STSC),_n.box(_n.types.stsz,_n.constants.STSZ),_n.box(_n.types.stco,_n.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?_n.box(_n.types.stsd,_n.constants.STSD_PREFIX,_n.mp3(e)):_n.box(_n.types.stsd,_n.constants.STSD_PREFIX,_n.mp4a(e)):"avc"===e.videoType?_n.box(_n.types.stsd,_n.constants.STSD_PREFIX,_n.avc1(e)):_n.box(_n.types.stsd,_n.constants.STSD_PREFIX,_n.hvc1(e))}static mp3(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return _n.box(_n.types[".mp3"],i)}static mp4a(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return _n.box(_n.types.mp4a,i,_n.esds(e))}static esds(e){let t=e.config||[],r=t.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(t).concat([6,1,2]));return _n.box(_n.types.esds,i)}static avc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return _n.box(_n.types.avc1,n,_n.box(_n.types.avcC,t))}static hvc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return _n.box(_n.types.hvc1,n,_n.box(_n.types.hvcC,t))}static mvex(e){return _n.box(_n.types.mvex,_n.trex(e))}static trex(e){let t=e.id,r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return _n.box(_n.types.trex,r)}static moof(e,t){return _n.box(_n.types.moof,_n.mfhd(e.sequenceNumber),_n.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return _n.box(_n.types.mfhd,t)}static traf(e,t){let r=e.id,i=_n.box(_n.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),n=_n.box(_n.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),s=_n.sdtp(e),o=_n.trun(e,s.byteLength+16+16+8+16+8+8);return _n.box(_n.types.traf,i,n,o,s)}static sdtp(e){let t=new Uint8Array(5),r=e.flags;return t[4]=r.isLeading<<6|r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy,_n.box(_n.types.sdtp,t)}static trun(e,t){let r=new Uint8Array(28);t+=36,r.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let i=e.duration,n=e.size,s=e.flags,o=e.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.isNonSync,0,0,o>>>24&255,o>>>16&255,o>>>8&255,255&o],12),_n.box(_n.types.trun,r)}static mdat(e){return _n.box(_n.types.mdat,e)}}_n.init();var gn,yn=Gt((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}));(gn=yn)&&gn.__esModule&&Object.prototype.hasOwnProperty.call(gn,"default")&&gn.default;const vn=[44100,48e3,32e3,0],bn=[22050,24e3,16e3,0],wn=[11025,12e3,8e3,0],Sn=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],En=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],An=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];function Un(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),r=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let i=t[1]>>>3&3,n=(6&t[1])>>1,s=(240&t[2])>>>4,o=(12&t[2])>>>2,a=3!==(t[3]>>>6&3)?2:1,d=0,l=0;switch(i){case 0:d=wn[o];break;case 2:d=bn[o];break;case 3:d=vn[o]}switch(n){case 1:s=e[n]&&t=6?(i=5,t=new Array(4),o=n-3):(i=2,t=new Array(2),o=n):-1!==a.indexOf("android")?(i=2,t=new Array(2),o=n):(i=5,o=n,t=new Array(4),n>=6?o=n-3:1===s&&(i=2,t=new Array(2),o=n)),t[0]=i<<3,t[0]|=(15&n)>>>1,t[1]=(15&n)<<7,t[1]|=(15&s)<<3,5===i&&(t[1]|=(15&o)>>>1,t[2]=(1&o)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=$n[n],this.sampling_index=n,this.channel_count=s,this.object_type=i,this.original_object_type=r,this.codec_mimetype="mp4a.40."+i,this.original_codec_mimetype="mp4a.40."+r}}class Hn{constructor(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}get bitsAvailable(){return this.bitLength-this.index}skipBits(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}getBits(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>i,s=8-i;if(s>=e)return r&&(this.index+=e),n>>s-e;{r&&(this.index+=s);const i=e-s;return n<>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}function Wn(e){return e[3]|e[2]<<8|e[1]<<16|e[0]<<24}const Vn=new Array(214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72),jn=new Array(2746333894,1453994832,1736282519,2993693404),qn=new Array(462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257);function Yn(e,t,r,i,n){var s=n;s=t+n>e.length&&i+n<=r.length?e.length-t:i+n>r.length&&t+n<=e.length?r.length-i:t+n<=e.length&&i+n<=r.length?n:r.length>24&255,e>>16&255,e>>8&255,255&e)}function Xn(e,t){return t+3>>19)^(i<<23|i>>>9)}function Qn(e,t){var r=new Array(36);r[0]=Xn(t,0),r[1]=Xn(t,4),r[2]=Xn(t,8),r[3]=Xn(t,12);for(var i=0;i<32;i++)r[i+4]=r[i]^es(r[i+1]^r[i+2]^r[i+3]^e[i]);var n=new Array(4);for(i=35;i>=32;i--)n[35-i]=r[i];var s=function(e){for(var t=new Array(4*e.length),r=0;r>>30)^(i<<10|i>>>22)^(i<<18|i>>>14)^(i<<24|i>>>8)}function ts(e,t,r){if(null==e||null==e||e.length%16!=0)return console.log("sm4 key is error!"),null;if(null==r||null==r||r.length<=0)return console.log("cipher is error!"),null;if(null==t||null==t||t.length%16!=0)return console.log("iv is error!"),null;for(var i=Zn(e),n=Math.ceil(r.length/16),s=new Array(r.length),o=t.slice(),a=0;a3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t=new Uint8Array(t),r=new Uint8Array(r);const s=e.byteLength;let o=5;for(;os)break;let d=e[o+4],l=!1,c=2;if(i?(n&&(c=3),d=d>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(d)):(d&=31,l=1===d||5===d),l){const i=ts(t,r,e.slice(o+4+c,o+4+a));e.set(i,o+4+c)}o=o+4+a}return e}Date.now||(Date.now=function(){return(new Date).getTime()});const is=[];is.push(o({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support")&&-1===e.indexOf("illegal icc")&&!e.indexOf("If you want to help, upload a sample of this file to")&&!e.indexOf("Reserved SBR extensions is not implemented"))})(e)||console.warn("JbPro[❌❌❌][worker]:",e)}}),s({printErr:function(e){(function(e){return!(!e||-1===e.indexOf("not compiled with thread support, using thread emulation"))})(e)||console.warn("JbPro[❌❌❌][worker]",e)}})),Promise.all(is).then((e=>{const t=e[0];!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[],n=[],s=null,o=null,a=null,d=null,l=null,c=null,u=!1,h=null,f=null,S=!1,E=!1,B=!!yr(r),Se=0,Ee=0,je=!1,Je=null,Qe=null,tt=null,it=[],ut=null,At=null,Ut=0,kt=0,$t=null,Ot=null,Gt=0,Ht=0,Wt=!1,Vt=!1,Xt=!1,er=null,or=null,Sr=!1,Er=!0,Ar=()=>{const e=_r();return{debug:e.debug,debugLevel:e.debugLevel,debugUuid:e.debugUuid,useOffscreen:e.useOffscreen,useWCS:e.useWCS,useMSE:e.useMSE,videoBuffer:e.videoBuffer,videoBufferDelay:e.videoBufferDelay,openWebglAlignment:e.openWebglAlignment,playType:e.playType,hasAudio:e.hasAudio,hasVideo:e.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:e.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:e.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:0,networkDelay:e.networkDelay,visibility:!0,useSIMD:e.useSIMD,isRecording:!1,recordType:e.recordType,isNakedFlow:e.isNakedFlow,checkFirstIFrame:e.checkFirstIFrame,audioBufferSize:1024,isM7sCrypto:e.isM7sCrypto,m7sCryptoAudio:e.m7sCryptoAudio,cryptoKey:e.cryptoKey,cryptoIV:e.cryptoIV,isSm4Crypto:e.isSm4Crypto,isSm4CryptoH265V2:e.isSm4CryptoH265V2,sm4CryptoKey:e.sm4CryptoKey,isXorCrypto:e.isXorCrypto,isHls265:!1,isFlv:e.isFlv,isFmp4:e.isFmp4,isMpeg4:e.isMpeg4,isTs:e.isTs,isFmp4Private:e.isFmp4Private,isEmitSEI:e.isEmitSEI,isRecordTypeFlv:!1,isWasmMp4:!1,isChrome:!1,isFirefox:!1,isDropSameTimestampGop:e.isDropSameTimestampGop,mseDecodeAudio:e.mseDecodeAudio,wcsDecodeAudio:e.wcsDecodeAudio,nakedFlowH265DemuxUseNew:e.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:e.mseDecoderUseWorker,mseAutoCleanupSourceBuffer:e.mseAutoCleanupSourceBuffer,mseAutoCleanupMaxBackwardDuration:e.mseAutoCleanupMaxBackwardDuration,mseAutoCleanupMinBackwardDuration:e.mseAutoCleanupMinBackwardDuration,mseCorrectTimeDuration:e.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:e.mseCorrectAudioTimeDuration,nakedFlowDemuxUseNew:e.nakedFlowDemuxUseNew,nakedFlowFps:e.nakedFlowFps,supportMSEDecodeHevc:!1}};"VideoEncoder"in self&&(s={hasInit:!1,isEmitInfo:!1,offscreenCanvas:null,offscreenCanvasCtx:null,decoder:null,init(){s.decoder=new VideoDecoder({output:function(e){if(cr(e.createImageBitmap))e.createImageBitmap().then((t=>{s.offscreenCanvasCtx.drawImage(t,0,0,e.codedWidth,e.codedHeight);let r=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:r,delay:si.delay,ts:0},[r]),fr(e)}));else{s.offscreenCanvasCtx.drawImage(e,0,0,e.codedWidth,e.codedHeight);let t=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:t,delay:si.delay,ts:0},[t]),fr(e)}},error:function(e){si.debugError("worker","VideoDecoder error: ",e,e.toString())}})},destroy(){s.reset(),s.decoder&&"closed"!==s.decoder.state&&(s.decoder.close(),s.decoder=null)},decode:function(e,t,r){const i=e[0]>>4==1;if(s.hasInit){const r=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:i?pt:mt});s.decoder.decode(r)}else if(i&&0===e[1]){const t=15&e[0];postMessage({cmd:M,code:t});const r=new Uint8Array(e);postMessage({cmd:R,buffer:r,codecId:t},[r.buffer]);let i=null,n=null;const o=e.slice(5);t===Ie?(n=Cr(o),i={codec:n.codec,description:o}):t===Me&&(n=jr(o),i={codec:n.codec,description:o}),n&&n.codecWidth&&n.codecHeight&&(i.codedHeight=n.codecHeight,i.codedWidth=n.codecWidth),s.isEmitInfo||(si.debugLog("worker","Webcodecs Video Decoder initSize"),postMessage({cmd:T,w:n.codecWidth,h:n.codecHeight}),s.isEmitInfo=!0,s.offscreenCanvas=new OffscreenCanvas(n.codecWidth,n.codecHeight),s.offscreenCanvasCtx=s.offscreenCanvas.getContext("2d"));try{s.decoder.configure(i),s.hasInit=!0}catch(e){si.debugError("worker","VideoDecoder configure error",e.code,e,e.toString()),e.toString()}}else si.debugWarn("worker",`VideoDecoder configure has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)},reset(){s.hasInit=!1,s.isEmitInfo=!1,s.offscreenCanvas=null,s.offscreenCanvasCtx=null}});let Ur=function(){if(Sr=!0,o)try{o.abort(),o=null,si.debugLog("worker","abort success")}catch(e){o=null,si.debugLog("worker","abort catch",e)}},Tr={init(){Tr.lastBuf=null,Tr.vps=null,Tr.sps=null,Tr.pps=null,Tr.streamType=null,Tr.localDts=0,Tr.pendingUnits={},Tr.isSendSeqHeader=!1},destroy(){Tr.lastBuf=null,Tr.vps=null,Tr.sps=null,Tr.pps=null,Tr.streamType=null,Tr.localDts=0,Tr.pendingUnits={},Tr.isSendSeqHeader=!1},dispatch(e){const t=new Uint8Array(e);if(si._opt.nakedFlowDemuxUseNew){const e=Tr.extractNALu$3(t);if(0===e.length)return void si.debugLog("worker","dispatch naluArray length is 0");Tr.handleVideoFrames(e)}else Tr.extractNALu$2(t)},getNaluDts(){const e=si._opt.nakedFlowFps;let t=Tr.localDts;return Tr.localDts=Tr.localDts+parseInt(1e3/e,10),t},getNaluAudioDts(){const e=si._opt.sampleRate,t=si._opt.audioBufferSize;return Tr.localDts+parseInt(t/e*1e3)},extractNALu(e){let t,r,i=0,n=e.byteLength,s=0,o=[];for(;i1)for(let e=0;e{const t=Ir(e);t===Ve||t===We?Tr.handleVideoH264Nalu(e):Rr(t)&&i.push(e)})),1===i.length)Tr.handleVideoH264Nalu(i[0]);else if(Nr(i)){const e=Ir(i[0]),t=zr(e);Tr.handleVideoH264NaluList(i,t,e)}else i.forEach((e=>{Tr.handleVideoH264Nalu(e)}))}else if(Tr.streamType===Ne)if(si._opt.nakedFlowH265DemuxUseNew){const t=Tr.handleAddNaluStartCode(e),r=Tr.extractNALu(t);if(0===r.length)return void si.debugWarn("worker","handleVideoNalu","h265 naluList.length === 0");const i=[];if(r.forEach((e=>{const t=Zr(e);t===lt||t===at||t===st?Tr.handleVideoH265Nalu(e):Qr(t)&&i.push(e)})),1===i.length)Tr.handleVideoH265Nalu(i[0]);else if(ti(i)){const e=Zr(i[0]),t=ei(e);Tr.handleVideoH265NaluList(i,t,e)}else i.forEach((e=>{Tr.handleVideoH265Nalu(e)}))}else Zr(e)===lt?Tr.extractH265PPS(e):Tr.handleVideoH265Nalu(e)},extractH264PPS(e){const t=Tr.handleAddNaluStartCode(e);Tr.extractNALu(t).forEach((e=>{Mr(Ir(e))?Tr.extractH264SEI(e):Tr.handleVideoH264Nalu(e)}))},extractH265PPS(e){const t=Tr.handleAddNaluStartCode(e);Tr.extractNALu(t).forEach((e=>{Jr(Zr(e))?Tr.extractH265SEI(e):Tr.handleVideoH265Nalu(e)}))},extractH264SEI(e){const t=Tr.handleAddNaluStartCode(e);Tr.extractNALu(t).forEach((e=>{Tr.handleVideoH264Nalu(e)}))},extractH265SEI(e){const t=Tr.handleAddNaluStartCode(e);Tr.extractNALu(t).forEach((e=>{Tr.handleVideoH265Nalu(e)}))},handleAddNaluStartCode(e){const t=[0,0,0,1],r=new Uint8Array(e.length+t.length);return r.set(t),r.set(e,t.length),r},handleVideoH264Nalu(e){const t=Ir(e);switch(t){case We:Tr.sps=e;break;case Ve:Tr.pps=e}if(Tr.isSendSeqHeader){if(Tr.sps&&Tr.pps){const e=Dr({sps:Tr.sps,pps:Tr.pps}),t=Tr.localDts;si.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Tr.sps=null,Tr.pps=null}if(Rr(t)){const r=zr(t),i=Tr.getNaluDts(),n=Fr(e,r);Tr.doDecode(n,{type:ae,ts:i,isIFrame:r,cts:0})}}else if(Tr.sps&&Tr.pps){Tr.isSendSeqHeader=!0;const e=Dr({sps:Tr.sps,pps:Tr.pps});si.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Tr.sps=null,Tr.pps=null}},handleVideoH264NaluList(e,t,r){if(Tr.isSendSeqHeader){const i=Tr.getNaluDts(),n=Lr(e.reduce(((e,t)=>{const r=rr(e),i=rr(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);Tr.doDecode(n,{type:ae,ts:i,isIFrame:t,cts:0}),si.debugLog("worker",`handleVideoH264NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},handleVideoH265Nalu(e){const t=Zr(e);switch(t){case st:Tr.vps=e;break;case at:Tr.sps=e;break;case lt:Tr.pps=e}if(Tr.isSendSeqHeader){if(Tr.vps&&Tr.sps&&Tr.pps){const e=Yr({vps:Tr.vps,sps:Tr.sps,pps:Tr.pps}),t=Tr.localDts;si.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Tr.vps=null,Tr.sps=null,Tr.pps=null}if(Qr(t)){const r=ei(t),i=Tr.getNaluDts(),n=Kr(e,r);Tr.doDecode(n,{type:ae,ts:i,isIFrame:r,cts:0})}}else if(Tr.vps&&Tr.sps&&Tr.pps){Tr.isSendSeqHeader=!0;const e=Yr({vps:Tr.vps,sps:Tr.sps,pps:Tr.pps});si.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Tr.vps=null,Tr.sps=null,Tr.pps=null}},handleVideoH265NaluList(e,t,r){if(Tr.isSendSeqHeader){const i=Tr.getNaluDts(),n=Xr(e.reduce(((e,t)=>{const r=rr(e),i=rr(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);Tr.doDecode(n,{type:ae,ts:i,isIFrame:t,cts:0}),si.debugLog("worker",`handleVideoH265NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}},doDecode(e,t){si.calcNetworkDelay(t.ts),t.isIFrame&&si.calcIframeIntervalTimestamp(t.ts),si.decode(e,t)},handleVideoFrames(e){if(!Tr.streamVideoType)for(let t of e)if(Tr.streamVideoType=ur(t),Tr.streamVideoType)break;Tr.streamVideoType?Tr.streamVideoType===ze?Tr.handleVideoH264Frames(e):this.streamVideoType===Ne&&Tr.handleVideoH265Frames(e):si.debugWarn("worker","handleVideoFrames","streamVideoType is null")},handleVideoH264Frames(e){let t=[],r=[],i=!1,n=!1;Tr.pendingUnits.units&&(t=Tr.pendingUnits.units,n=Tr.pendingUnits.vcl,i=Tr.pendingUnits.iFrame,Tr.pendingUnits={});let s={};for(let o of e){if(o.byteLength<4)continue;const e=Ir(o);let a=!1,d=e===Ye;e!==qe&&e!==Ye||(s=Tr.parseVideo264Header(o),a=!0),t.length&&n&&(s.isfms||!a)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,n=!1),t.push(o),i=i||d,n=n||a}t.length&&(Tr.pendingUnits={units:t,vcl:n,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,n=null;if(t.forEach((e=>{const t=31&e[0];switch(t){case Ve:Tr.pps=e;break;case We:Tr.sps=e;break;case Ke:n=e}if(Rr(t)){const t=rr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Tr.isSendSeqHeader&&Tr.sps&&Tr.pps){Tr.isSendSeqHeader=!0;const e=Pr({sps:Tr.sps,pps:Tr.pps});si.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Tr.sps=null,Tr.pps=null}if(Tr.isSendSeqHeader){if(Tr.sps&&Tr.pps){const e=Pr({sps:Tr.sps,pps:Tr.pps}),t=Tr.localDts;si.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Tr.sps=null,Tr.pps=null}if(i){const e=Tr.getNaluDts(),t=Lr(i,r);si._opt.isEmitSEI&&n&&postMessage({cmd:Z,buffer:n,ts:e},[n.buffer]),Tr.doDecode(t,{type:ae,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames(e){let t=[],r=[],i=!1,n=!1;Tr.pendingUnits.units&&(t=Tr.pendingUnits.units,n=Tr.pendingUnits.vcl,i=Tr.pendingUnits.iFrame,Tr.pendingUnits={});let s={};for(let o of e){if(o.byteLength<4)continue;const e=Zr(o);let a=!1,d=ei(e);Qr(e)&&(s=this.parseVideo265Header(o),a=!0),t.length&&n&&(s.isfms||!a)&&(r.push({units:t,isIFrame:i}),t=[],i=!1,n=!1),t.push(o),i=i||d,n=n||a}t.length&&(Tr.pendingUnits={units:t,vcl:n,iFrame:i}),r.forEach((e=>{const t=e.units,r=e.isIFrame;let i=null,n=null;if(t.forEach((e=>{const t=e[0]>>>1&63;switch(t){case lt:Tr.pps=e;break;case at:Tr.sps=e;break;case st:Tr.vps=e;break;case ft:case ht:n=e}if(Qr(t)){const t=rr(e);if(i){const e=new Uint8Array(i.byteLength+t.byteLength);e.set(i,0),e.set(t,i.byteLength),i=e}else i=t}})),!Tr.isSendSeqHeader&&Tr.sps&&Tr.pps&&Tr.vps){Tr.isSendSeqHeader=!0;const e=Yr({sps:Tr.sps,pps:Tr.pps,vps:Tr.vps});si.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Tr.sps=null,Tr.pps=null,Tr.vps=null}if(Tr.isSendSeqHeader){if(Tr.sps&&Tr.pps&&Tr.vps){const e=Yr({sps:Tr.sps,pps:Tr.pps,vps:Tr.vps}),t=Tr.localDts;si.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Tr.sps=null,Tr.pps=null,Tr.vps=null}if(i){const e=Tr.getNaluDts(),t=Xr(i,r);si._opt.isEmitSEI&&n&&postMessage({cmd:Z,buffer:n,ts:e},[n.buffer]),Tr.doDecode(t,{type:ae,ts:e,isIFrame:r,cts:0})}}}))},handleVideoH265Frames_1(e){e.forEach((e=>{Tr.handleVideoNalu(e)}))},parseVideo264Header(e){const t=new Hn(e);return t.readUByte(),{isfms:0===t.readUEG(),sType:t.readUEG()}},parseVideo265Header(e){const t=new Hn(e);return t.readUByte(),{nalType:t.readBits(6),isfms:0===t.readBits(1),sType:t.readBits(3)}}},Gr={LOG_NAME:"worker fmp4Demuxer",mp4Box:null,offset:0,videoTrackId:null,audioTrackId:null,isHevc:!1,listenMp4Box(){Gr.mp4Box=Oi.createFile(),Gr.mp4Box.onReady=Gr.onReady,Gr.mp4Box.onError=Gr.onError,Gr.mp4Box.onSamples=Gr.onSamples},initTransportDescarmber(){Gr.transportDescarmber=new Wi},_getSeqHeader(e){const t=Gr.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new Oi.DataStream(void 0,0,Oi.DataStream.BIG_ENDIAN);let r=[];e.avcC?(e.avcC.write(t),r=[23,0,0,0,0]):(Gr.isHevc=!0,si.isHevc=!0,e.hvcC.write(t),r=[28,0,0,0,0]);const i=new Uint8Array(t.buffer,8),n=new Uint8Array(r.length+i.length);return n.set(r,0),n.set(i,r.length),n}return null},onReady(e){si.debugLog(Gr.LOG_NAME,"onReady()");const t=e.videoTracks[0],r=e.audioTracks[0];if(t){Gr.videoTrackId=t.id;const e=Gr._getSeqHeader(t);e&&(si.debugLog(Gr.LOG_NAME,"seqHeader"),si.decodeVideo(e,0,!0,0)),Gr.mp4Box.setExtractionOptions(t.id)}if(r&&si._opt.hasAudio){Gr.audioTrackId=r.id;const e=r.audio||{},t=jt.indexOf(e.sample_rate),i=r.codec.replace("mp4a.40.","");Gr.mp4Box.setExtractionOptions(r.id);const n=qt({profile:parseInt(i,10),sampleRate:t,channel:e.channel_count});si.debugLog(Gr.LOG_NAME,"aacADTSHeader"),si.decodeAudio(n,0)}Gr.mp4Box.start()},onError(e){si.debugError(Gr.LOG_NAME,"mp4Box onError",e)},onSamples(e,t,r){if(e===Gr.videoTrackId){for(const e of r){const t=e.data,r=e.is_sync,i=1e3*e.cts/e.timescale;e.duration,e.timescale,r&&si.calcIframeIntervalTimestamp(i);let n=null;n=Gr.isHevc?Xr(t,r):Lr(t,r),si.decode(n,{type:ae,ts:i,isIFrame:r,cts:0})}Gr.mp4Box.removeUsedSamples(e)}else if(e===Gr.audioTrackId){if(si._opt.hasAudio){for(const e of r){const t=e.data,r=1e3*e.cts/e.timescale;e.duration,e.timescale;const i=new Uint8Array(t.byteLength+2);i.set([175,1],0),i.set(t,2),si.decode(i,{type:oe,ts:r,isIFrame:!1,cts:0})}Gr.mp4Box.removeUsedSamples(e)}}else si.debugWarn(Gr.LOG_NAME,"onSamples() trackId error",e)},dispatch(e){let t=new Uint8Array(e);Gr.transportDescarmber&&(t=Gr.transportDescarmber.transport(t)),t.buffer.fileStart=Gr.offset,Gr.offset+=t.byteLength,Gr.mp4Box.appendBuffer(t.buffer)},destroy(){Gr.mp4Box&&(Gr.mp4Box.stop(),Gr.mp4Box.flush(),Gr.mp4Box.destroy(),Gr.mp4Box=null),Gr.transportDescarmber&&(Gr.transportDescarmber.destroy(),Gr.transportDescarmber=null),Gr.offset=0,Gr.videoTrackId=null,Gr.audioTrackId=null,Gr.isHevc=!1}},Hr={LOG_NAME:"worker mpeg4Demuxer",lastBuffer:new Uint8Array(0),parsedOffset:0,firstStartCodeOffset:0,secondStartCodeOffset:0,state:"init",hasInitVideoCodec:!1,localDts:0,dispatch(e){const t=new Uint8Array(e);Hr.extractNALu(t)},destroy(){Hr.lastBuffer=new Uint8Array(0),Hr.parsedOffset=0,Hr.firstStartCodeOffset=0,Hr.secondStartCodeOffset=0,Hr.state="init",Hr.hasInitVideoCodec=!1,Hr.localDts=0},extractNALu(e){if(!e||e.byteLength<1)return void si.debugWarn(Hr.LOG_NAME,"extractNALu() buffer error",e);const t=new Uint8Array(Hr.lastBuffer.length+e.length);for(t.set(Hr.lastBuffer,0),t.set(new Uint8Array(e),Hr.lastBuffer.length),Hr.lastBuffer=t;;){if("init"===Hr.state){let e=!1;for(;Hr.lastBuffer.length-Hr.parsedOffset>=4;)if(0===Hr.lastBuffer[Hr.parsedOffset])if(0===Hr.lastBuffer[Hr.parsedOffset+1])if(1===Hr.lastBuffer[Hr.parsedOffset+2]){if(182===Hr.lastBuffer[Hr.parsedOffset+3]){Hr.state="findFirstStartCode",Hr.firstStartCodeOffset=Hr.parsedOffset,Hr.parsedOffset+=4,e=!0;break}Hr.parsedOffset++}else Hr.parsedOffset++;else Hr.parsedOffset++;else Hr.parsedOffset++;if(e)continue;break}if("findFirstStartCode"===Hr.state){let e=!1;for(;Hr.lastBuffer.length-Hr.parsedOffset>=4;)if(0===Hr.lastBuffer[Hr.parsedOffset])if(0===Hr.lastBuffer[Hr.parsedOffset+1])if(1===Hr.lastBuffer[Hr.parsedOffset+2]){if(182===Hr.lastBuffer[Hr.parsedOffset+3]){Hr.state="findSecondStartCode",Hr.secondStartCodeOffset=Hr.parsedOffset,Hr.parsedOffset+=4,e=!0;break}Hr.parsedOffset++}else Hr.parsedOffset++;else Hr.parsedOffset++;else Hr.parsedOffset++;if(e)continue;break}if("findSecondStartCode"===Hr.state){if(!(Hr.lastBuffer.length-Hr.parsedOffset>0))break;{let e,t,r=192&Hr.lastBuffer[Hr.parsedOffset];e=0==r?Hr.secondStartCodeOffset-14:Hr.secondStartCodeOffset;let i=0==(192&Hr.lastBuffer[Hr.firstStartCodeOffset+4]);if(i){if(Hr.firstStartCodeOffset-14<0)return void si.debugWarn(Hr.LOG_NAME,"firstStartCodeOffset -14 is",Hr.firstStartCodeOffset-14);Hr.hasInitVideoCodec||(Hr.hasInitVideoCodec=!0,si.debugLog(Hr.LOG_NAME,"setCodec"),ai.setCodec(Re,"")),t=Hr.lastBuffer.subarray(Hr.firstStartCodeOffset-14,e)}else t=Hr.lastBuffer.subarray(Hr.firstStartCodeOffset,e);let n=Hr.getNaluDts();Hr.hasInitVideoCodec?(postMessage({cmd:O,type:Be,value:t.byteLength}),postMessage({cmd:O,type:ke,value:n}),Se=n,ai.decode(t,i?1:0,n)):si.debugWarn(Hr.LOG_NAME,"has not init video codec"),Hr.lastBuffer=Hr.lastBuffer.subarray(e),Hr.firstStartCodeOffset=0==r?14:0,Hr.parsedOffset=Hr.firstStartCodeOffset+4,Hr.state="findFirstStartCode"}}}},getNaluDts(){let e=Hr.localDts;return Hr.localDts=Hr.localDts+40,e}},qr={TAG_NAME:"worker TsLoaderV2",first_parse_:!0,tsPacketSize:0,syncOffset:0,pmt_:null,config_:null,media_info_:new On,timescale_:90,duration_:0,pat_:{version_number:0,network_pid:0,program_map_pid:{}},current_program_:null,current_pmt_pid_:-1,program_pmt_map_:{},pes_slice_queues_:{},section_slice_queues_:{},video_metadata_:{vps:null,sps:null,pps:null,details:null},audio_metadata_:{codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},last_pcr_:null,audio_last_sample_pts_:void 0,aac_last_incomplete_data_:null,has_video_:!1,has_audio_:!1,video_init_segment_dispatched_:!1,audio_init_segment_dispatched_:!1,video_metadata_changed_:!1,audio_metadata_changed_:!1,loas_previous_frame:null,video_track_:{type:"video",id:1,sequenceNumber:0,samples:[],length:0},audio_track_:{type:"audio",id:2,sequenceNumber:0,samples:[],length:0},_remainingPacketData:null,init(){},destroy(){qr.media_info_=null,qr.pes_slice_queues_=null,qr.section_slice_queues_=null,qr.video_metadata_=null,qr.audio_metadata_=null,qr.aac_last_incomplete_data_=null,qr.video_track_=null,qr.audio_track_=null,qr._remainingPacketData=null},probe(e){let t=new Uint8Array(e),r=-1,i=188;if(t.byteLength<=3*i)return{needMoreData:!0};for(;-1===r;){let e=Math.min(1e3,t.byteLength-3*i);for(let n=0;n=4&&(r-=4),{match:!0,consumed:0,ts_packet_size:i,sync_offset:r})},_initPmt:()=>({program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}),dispatch(e){qr._remainingPacketData&&(e=pn(qr._remainingPacketData,e),qr._remainingPacketData=null);let t=e.buffer;const r=qr.parseChunks(t);r?qr._remainingPacketData=e.subarray(r):e.length>>6;r[1];let s=(31&r[1])<<8|r[2],o=(48&r[3])>>>4,a=15&r[3],d=!(!qr.pmt_||qr.pmt_.pcr_pid!==s),l={},c=4;if(2==o||3==o){let e=r[4];if(e>0&&(d||3==o)&&(l.discontinuity_indicator=(128&r[5])>>>7,l.random_access_indicator=(64&r[5])>>>6,l.elementary_stream_priority_indicator=(32&r[5])>>>5,(16&r[5])>>>4)){let e=300*(r[6]<<25|r[7]<<17|r[8]<<9|r[9]<<1|r[10]>>>7)+((1&r[10])<<8|r[11]);qr.last_pcr_=e}if(2==o||5+e===188){t+=188,204===qr.tsPacketSize&&(t+=16);continue}c=5+e}if(1==o||3==o)if(0===s||s===qr.current_pmt_pid_||null!=qr.pmt_&&qr.pmt_.pid_stream_type[s]===Ln){let r=188-c;qr.handleSectionSlice(e,t+c,r,{pid:s,payload_unit_start_indicator:n,continuity_conunter:a,random_access_indicator:l.random_access_indicator})}else if(null!=qr.pmt_&&null!=qr.pmt_.pid_stream_type[s]){let r=188-c,i=qr.pmt_.pid_stream_type[s];s!==qr.pmt_.common_pids.h264&&s!==qr.pmt_.common_pids.h265&&s!==qr.pmt_.common_pids.adts_aac&&s!==qr.pmt_.common_pids.loas_aac&&s!==qr.pmt_.common_pids.ac3&&s!==qr.pmt_.common_pids.eac3&&s!==qr.pmt_.common_pids.opus&&s!==qr.pmt_.common_pids.mp3&&!0!==qr.pmt_.pes_private_data_pids[s]&&!0!==qr.pmt_.timed_id3_pids[s]&&!0!==qr.pmt_.synchronous_klv_pids[s]&&!0!==qr.pmt_.asynchronous_klv_pids[s]||qr.handlePESSlice(e,t+c,r,{pid:s,stream_type:i,payload_unit_start_indicator:n,continuity_conunter:a,random_access_indicator:l.random_access_indicator})}t+=188,204===qr.tsPacketSize&&(t+=16)}return qr.dispatchAudioVideoMediaSegment(),t},handleSectionSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=qr.section_slice_queues_[i.pid];if(i.payload_unit_start_indicator){let o=n[0];if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t+1,Math.min(r,o));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?qr.emitSectionSlices(s,i):qr.clearSlices(s,i)}for(let a=1+o;a=s.expected_length&&qr.clearSlices(s,i),a+=d.byteLength}}else if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t,Math.min(r,s.expected_length-s.total_length));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?qr.emitSectionSlices(s,i):s.total_length>=s.expected_length&&qr.clearSlices(s,i)}},handlePESSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=n[0]<<16|n[1]<<8|n[2];n[3];let o=n[4]<<8|n[5];if(i.payload_unit_start_indicator){if(1!==s)return void si.debugWarn(qr.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${s}`);let e=qr.pes_slice_queues_[i.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?qr.emitPESSlices(e,i):qr.clearSlices(e,i)),qr.pes_slice_queues_[i.pid]=new Rn,qr.pes_slice_queues_[i.pid].random_access_indicator=i.random_access_indicator}if(null==qr.pes_slice_queues_[i.pid])return;let a=qr.pes_slice_queues_[i.pid];a.slices.push(n),i.payload_unit_start_indicator&&(a.expected_length=0===o?0:o+6),a.total_length+=n.byteLength,a.expected_length>0&&a.expected_length===a.total_length?qr.emitPESSlices(a,i):a.expected_length>0&&a.expected_length>>6,a=t[8];2!==o&&3!==o||(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,s=3===o?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:r);let d,l=9+a;if(0!==n){if(n<3+a)return void si.debugWarn(qr.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");d=n-3-a}else d=t.byteLength-l;let c=t.subarray(l,l+d);switch(e.stream_type){case xn:case Bn:qr.parseMP3Payload(c,r);break;case kn:qr.pmt_.common_pids.opus===e.pid||qr.pmt_.common_pids.ac3===e.pid||qr.pmt_.common_pids.eac3===e.pid||(qr.pmt_.asynchronous_klv_pids[e.pid]?qr.parseAsynchronousKLVMetadataPayload(c,e.pid,i):qr.pmt_.smpte2038_pids[e.pid]?qr.parseSMPTE2038MetadataPayload(c,r,s,e.pid,i):qr.parsePESPrivateDataPayload(c,r,s,e.pid,i));break;case Tn:qr.parseADTSAACPayload(c,r);break;case Cn:qr.parseLOASAACPayload(c,r);break;case Dn:case Pn:break;case Fn:qr.pmt_.timed_id3_pids[e.pid]?qr.parseTimedID3MetadataPayload(c,r,s,e.pid,i):qr.pmt_.synchronous_klv_pids[e.pid]&&qr.parseSynchronousKLVMetadataPayload(c,r,s,e.pid,i);break;case In:qr.parseH264Payload(c,r,s,e.random_access_indicator);break;case Mn:qr.parseH265Payload(c,r,s,e.random_access_indicator)}}else if((188===i||191===i||240===i||241===i||255===i||242===i||248===i)&&e.stream_type===kn){let r,s=6;r=0!==n?n:t.byteLength-s;let o=t.subarray(s,s+r);qr.parsePESPrivateDataPayload(o,void 0,void 0,e.pid,i)}}else si.debugError(qr.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${r}`)},parsePAT(e){let t=e[0];if(0!==t)return void Log.e(qr.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let r=(15&e[1])<<8|e[2];e[3],e[4];let i=(62&e[5])>>>1,n=1&e[5],s=e[6];e[7];let o=null;if(1===n&&0===s)o={version_number:0,network_pid:0,program_pmt_pid:{}},o.version_number=i;else if(o=qr.pat_,null==o)return;let a=r-5-4,d=-1,l=-1;for(let t=8;t<8+a;t+=4){let r=e[t]<<8|e[t+1],i=(31&e[t+2])<<8|e[t+3];0===r?o.network_pid=i:(o.program_pmt_pid[r]=i,-1===d&&(d=r),-1===l&&(l=i))}1===n&&0===s&&(null==qr.pat_&&si.debugLog(qr.TAG_NAME,`Parsed first PAT: ${JSON.stringify(o)}`),qr.pat_=o,qr.current_program_=d,qr.current_pmt_pid_=l)},parsePMT(e){let t=e[0];if(2!==t)return void si.debugError(qr.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let r,i=(15&e[1])<<8|e[2],n=e[3]<<8|e[4],s=(62&e[5])>>>1,o=1&e[5],a=e[6];if(e[7],1===o&&0===a)r=qr._initPmt(),r.program_number=n,r.version_number=s,qr.program_pmt_map_[n]=r;else if(r=qr.program_pmt_map_[n],null==r)return;r.pcr_pid=(31&e[8])<<8|e[9];let d=(15&e[10])<<8|e[11],l=12+d,c=i-9-d-4;for(let t=l;t0){for(let i=t+5;i0)for(let i=t+5;iqr.has_video_&&qr.has_audio_?qr.video_init_segment_dispatched_&&qr.audio_init_segment_dispatched_:qr.has_video_&&!qr.has_audio_?qr.video_init_segment_dispatched_:!(qr.has_video_||!qr.has_audio_)&&qr.audio_init_segment_dispatched_,dispatchVideoInitSegment(){let e=qr.video_metadata_.details,t={type:"video"};t.id=qr.video_track_.id,t.timescale=1e3,t.duration=qr.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;let r=t.frameRate.fps_den,i=t.frameRate.fps_num;if(t.refSampleDuration=r/i*1e3,t.codec=e.codec_mimetype,qr.video_metadata_.vps){si.isHevc=!0;let e=qr.video_metadata_.vps.data.subarray(4),r=qr.video_metadata_.sps.data.subarray(4),i=qr.video_metadata_.pps.data.subarray(4);t.hvcc=Yr({vps:e,sps:r,pps:i}),0==qr.video_init_segment_dispatched_&&si.debugLog(qr.TAG_NAME,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.hvcc&&si.decodeVideo(t.hvcc,0,!0,0)}else{let e=qr.video_metadata_.sps.data.subarray(4),r=qr.video_metadata_.pps.data.subarray(4);t.avcc=Pr({sps:e,pps:r}),0==qr.video_init_segment_dispatched_&&si.debugLog(qr.TAG_NAME,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.avcc&&si.decodeVideo(t.avcc,0,!0,0)}qr.video_init_segment_dispatched_=!0,qr.video_metadata_changed_=!1;let n=qr.media_info_;n.hasVideo=!0,n.width=t.codecWidth,n.height=t.codecHeight,n.fps=t.frameRate.fps,n.profile=t.profile,n.level=t.level,n.refFrames=e.ref_frames,n.chromaFormat=e.chroma_format_string,n.sarNum=t.sarRatio.width,n.sarDen=t.sarRatio.height,n.videoCodec=t.codec,n.hasAudio&&n.audioCodec?n.mimeType=`video/mp2t; codecs="${n.videoCodec},${n.audioCodec}"`:n.mimeType=`video/mp2t; codecs="${n.videoCodec}"`},dispatchVideoMediaSegment(){qr.isInitSegmentDispatched()&&qr.video_track_.length&&qr._preDoDecode()},dispatchAudioMediaSegment(){qr.isInitSegmentDispatched()&&qr.audio_track_.length&&qr._preDoDecode()},dispatchAudioVideoMediaSegment(){qr.isInitSegmentDispatched()&&(qr.audio_track_.length||qr.video_track_.length)&&qr._preDoDecode()},parseADTSAACPayload(e,t){if(qr.has_video_&&!qr.video_init_segment_dispatched_)return;if(qr.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+qr.aac_last_incomplete_data_.byteLength);t.set(qr.aac_last_incomplete_data_,0),t.set(e,qr.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/qr.timescale_),"aac"===qr.audio_metadata_.codec){if(null==t&&null!=qr.audio_last_sample_pts_)r=1024/qr.audio_metadata_.sampling_frequency*1e3,i=qr.audio_last_sample_pts_+r;else if(null==t)return void si.debugWarn(qr.TAG_NAME,"AAC: Unknown pts");if(qr.aac_last_incomplete_data_&&qr.audio_last_sample_pts_){r=1024/qr.audio_metadata_.sampling_frequency*1e3;let e=qr.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(si.debugWarn(qr.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Jt(e),o=null,a=i;for(;null!=(o=s.readNextAACFrame());){r=1024/o.sampling_frequency*1e3;const e={codec:"aac",data:o};0==qr.audio_init_segment_dispatched_?(qr.audio_metadata_={codec:"aac",audio_object_type:o.audio_object_type,sampling_freq_index:o.sampling_freq_index,sampling_frequency:o.sampling_frequency,channel_config:o.channel_config},qr.dispatchAudioInitSegment(e)):qr.detectAudioMetadataChange(e)&&(qr.dispatchAudioMediaSegment(),qr.dispatchAudioInitSegment(e)),n=a;let t=Math.floor(a);const i=new Uint8Array(o.data.length+2);i.set([175,1],0),i.set(o.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:oe};qr.audio_track_.samples.push(s),qr.audio_track_.length+=i.byteLength,a+=r}s.hasIncompleteData()&&(qr.aac_last_incomplete_data_=s.getIncompleteData()),n&&(qr.audio_last_sample_pts_=n)},parseLOASAACPayload(e,t){if(qr.has_video_&&!qr.video_init_segment_dispatched_)return;if(qr.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+qr.aac_last_incomplete_data_.byteLength);t.set(qr.aac_last_incomplete_data_,0),t.set(e,qr.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/qr.timescale_),"aac"===qr.audio_metadata_.codec){if(null==t&&null!=qr.audio_last_sample_pts_)r=1024/qr.audio_metadata_.sampling_frequency*1e3,i=qr.audio_last_sample_pts_+r;else if(null==t)return void si.debugWarn(qr.TAG_NAME,"AAC: Unknown pts");if(qr.aac_last_incomplete_data_&&qr.audio_last_sample_pts_){r=1024/qr.audio_metadata_.sampling_frequency*1e3;let e=qr.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(si.debugWarn(qr.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Qt(e),o=null,a=i;for(;null!=(o=s.readNextAACFrame(dr(this.loas_previous_frame)?void 0:this.loas_previous_frame));){qr.loas_previous_frame=o,r=1024/o.sampling_frequency*1e3;const e={codec:"aac",data:o};0==qr.audio_init_segment_dispatched_?(qr.audio_metadata_={codec:"aac",audio_object_type:o.audio_object_type,sampling_freq_index:o.sampling_freq_index,sampling_frequency:o.sampling_frequency,channel_config:o.channel_config},qr.dispatchAudioInitSegment(e)):qr.detectAudioMetadataChange(e)&&(qr.dispatchAudioMediaSegment(),qr.dispatchAudioInitSegment(e)),n=a;let t=Math.floor(a);const i=new Uint8Array(o.data.length+2);i.set([175,1],0),i.set(o.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:oe};qr.audio_track_.samples.push(s),qr.audio_track_.length+=i.byteLength,a+=r}s.hasIncompleteData()&&(qr.aac_last_incomplete_data_=s.getIncompleteData()),n&&(qr.audio_last_sample_pts_=n)},parseAC3Payload(e,t){},parseEAC3Payload(e,t){},parseOpusPayload(e,t){},parseMP3Payload(e,t){if(qr.has_video_&&!qr.video_init_segment_dispatched_)return;let r=[44100,48e3,32e3,0],i=[22050,24e3,16e3,0],n=[11025,12e3,8e3,0],s=e[1]>>>3&3,o=(6&e[1])>>1;e[2];let a=(12&e[2])>>>2,d=3!=(e[3]>>>6&3)?2:1,l=0,c=34;switch(s){case 0:l=n[a];break;case 2:l=i[a];break;case 3:l=r[a]}switch(o){case 1:c=34;break;case 2:c=33;break;case 3:c=32}const u={};u.object_type=c,u.sample_rate=l,u.channel_count=d,u.data=e;const h={codec:"mp3",data:u};0==qr.audio_init_segment_dispatched_?(qr.audio_metadata_={codec:"mp3",object_type:c,sample_rate:l,channel_count:d},qr.dispatchAudioInitSegment(h)):qr.detectAudioMetadataChange(h)&&(qr.dispatchAudioMediaSegment(),qr.dispatchAudioInitSegment(h));let f={payload:e,length:e.byteLength,pts:t/qr.timescale_,dts:t/qr.timescale_,type:oe};qr.audio_track_.samples.push(f),qr.audio_track_.length+=e.byteLength},detectAudioMetadataChange(e){if(e.codec!==qr.audio_metadata_.codec)return si.debugLog(qr.TAG_NAME,`Audio: Audio Codecs changed from ${qr.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===qr.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==qr.audio_metadata_.audio_object_type)return si.debugLog(qr.TAG_NAME,`AAC: AudioObjectType changed from ${qr.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==qr.audio_metadata_.sampling_freq_index)return si.debugLog(qr.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${qr.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==qr.audio_metadata_.channel_config)return si.debugLog(qr.TAG_NAME,`AAC: Channel configuration changed from ${qr.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===qr.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==qr.audio_metadata_.sampling_frequency)return si.debugLog(qr.TAG_NAME,`AC3: Sampling Frequency changed from ${qr.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==qr.audio_metadata_.bit_stream_identification)return si.debugLog(qr.TAG_NAME,`AC3: Bit Stream Identification changed from ${qr.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==qr.audio_metadata_.bit_stream_mode)return si.debugLog(qr.TAG_NAME,`AC3: BitStream Mode changed from ${qr.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==qr.audio_metadata_.channel_mode)return si.debugLog(qr.TAG_NAME,`AC3: Channel Mode changed from ${qr.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==qr.audio_metadata_.low_frequency_effects_channel_on)return si.debugLog(qr.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${qr.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===qr.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==qr.audio_metadata_.sample_rate)return si.debugLog(qr.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${qr.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==qr.audio_metadata_.channel_count)return si.debugLog(qr.TAG_NAME,`Opus: Channel count changed from ${qr.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===qr.audio_metadata_.codec){const t=e.data;if(t.object_type!==qr.audio_metadata_.object_type)return si.debugLog(qr.TAG_NAME,`MP3: AudioObjectType changed from ${qr.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==qr.audio_metadata_.sample_rate)return si.debugLog(qr.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${qr.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==qr.audio_metadata_.channel_count)return si.debugLog(qr.TAG_NAME,`MP3: Channel count changed from ${qr.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1},dispatchAudioInitSegment(e){let t={type:"audio"};if(t.id=qr.audio_track_.id,t.timescale=1e3,t.duration=qr.duration_,"aac"===qr.audio_metadata_.codec){let r="aac"===e.codec?e.data:null,i=new Gn(r);t.audioSampleRate=i.sampling_rate,t.audioSampleRateIndex=i.sampling_index,t.channelCount=i.channel_count,t.codec=i.codec_mimetype,t.originalCodec=i.original_codec_mimetype,t.config=i.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale;const n=qt({profile:si._opt.mseDecodeAudio?i.object_type:i.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});si.decodeAudio(n,0)}else"ac-3"===qr.audio_metadata_.codec||"ec-3"===qr.audio_metadata_.codec||"opus"===qr.audio_metadata_.codec||"mp3"===qr.audio_metadata_.codec&&(t.audioSampleRate=qr.audio_metadata_.sample_rate,t.channelCount=qr.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==qr.audio_init_segment_dispatched_&&si.debugLog(qr.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),qr.audio_init_segment_dispatched_=!0,qr.video_metadata_changed_=!1;let r=qr.media_info_;r.hasAudio=!0,r.audioCodec=t.originalCodec,r.audioSampleRate=t.audioSampleRate,r.audioChannelCount=t.channelCount,r.hasVideo&&r.videoCodec?r.mimeType=`video/mp2t; codecs="${r.videoCodec},${r.audioCodec}"`:r.mimeType=`video/mp2t; codecs="${r.audioCodec}"`},dispatchPESPrivateDataDescriptor(e,t,r){},parsePESPrivateDataPayload(e,t,r,i,n){let s=new Nn;if(s.pid=i,s.stream_id=n,s.len=e.byteLength,s.data=e,null!=t){let e=Math.floor(t/qr.timescale_);s.pts=e}else s.nearest_pts=qr.getNearestTimestampMilliseconds();if(null!=r){let e=Math.floor(r/qr.timescale_);s.dts=e}},parseTimedID3MetadataPayload(e,t,r,i,n){si.debugLog(qr.TAG_NAME,`Timed ID3 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseSynchronousKLVMetadataPayload(e,t,r,i,n){si.debugLog(qr.TAG_NAME,`Synchronous KLV Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseAsynchronousKLVMetadataPayload(e,t,r){si.debugLog(qr.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${r}`)},parseSMPTE2038MetadataPayload(e,t,r,i,n){si.debugLog(qr.TAG_NAME,`SMPTE 2038 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},getNearestTimestampMilliseconds:()=>null!=qr.audio_last_sample_pts_?Math.floor(qr.audio_last_sample_pts_):null!=qr.last_pcr_?Math.floor(qr.last_pcr_/300/qr.timescale_):void 0,_preDoDecode(){const e=qr.video_track_,t=qr.audio_track_;let r=e.samples;t.samples.length>0&&(r=e.samples.concat(t.samples),r=r.sort(((e,t)=>e.dts-t.dts))),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===ae?qr._doDecodeVideo({...e,payload:t}):e.type===oe&&qr._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0},_doDecodeVideo(e){const t=new Uint8Array(e.payload);let r=null;r=e.isHevc?Xr(t,e.isIFrame):Lr(t,e.isIFrame),e.isIFrame&&si.calcIframeIntervalTimestamp(e.dts);let i=si.cryptoPayload(r,e.isIFrame);si.decode(i,{type:ae,ts:e.dts,isIFrame:e.isIFrame,cts:e.cts})},_doDecodeAudio(e){const t=new Uint8Array(e.payload);let r=t;yr(si._opt.m7sCryptoAudio)&&(r=si.cryptoPayloadAudio(t)),si.decode(r,{type:oe,ts:e.dts,isIFrame:!1,cts:0})}},ni=null;br()&&(ni={TAG_NAME:"worker MediaSource",_resetInIt(){ni.isAvc=null,ni.isAAC=null,ni.videoInfo={},ni.videoMeta={},ni.audioMeta={},ni.sourceBuffer=null,ni.audioSourceBuffer=null,ni.hasInit=!1,ni.hasAudioInit=!1,ni.isAudioInitInfo=!1,ni.videoMimeType="",ni.audioMimeType="",ni.cacheTrack={},ni.cacheAudioTrack={},ni.timeInit=!1,ni.sequenceNumber=0,ni.audioSequenceNumber=0,ni.firstRenderTime=null,ni.firstAudioTime=null,ni.mediaSourceAppendBufferFull=!1,ni.mediaSourceAppendBufferError=!1,ni.mediaSourceAddSourceBufferError=!1,ni.mediaSourceBufferError=!1,ni.mediaSourceError=!1,ni.prevTimestamp=null,ni.decodeDiffTimestamp=null,ni.prevDts=null,ni.prevAudioDts=null,ni.prevPayloadBufferSize=0,ni.isWidthOrHeightChanged=!1,ni.prevTs=null,ni.prevAudioTs=null,ni.eventListenList=[],ni.pendingRemoveRanges=[],ni.pendingSegments=[],ni.pendingAudioRemoveRanges=[],ni.pendingAudioSegments=[],ni.supportVideoFrameCallbackHandle=null,ni.audioSourceBufferCheckTimeout=null,ni.audioSourceNoDataCheckTimeout=null,ni.hasPendingEos=!1,ni.$video={currentTime:0,readyState:0}},init(){ni.events=new mn,ni._resetInIt(),ni.mediaSource=new self.MediaSource,ni.isDecodeFirstIIframe=!!vr(si._opt.checkFirstIFrame),ni._bindMediaSourceEvents()},destroy(){ni.stop(),ni._clearAudioSourceBufferCheckTimeout(),ni.eventListenList&&ni.eventListenList.length&&(ni.eventListenList.forEach((e=>e())),ni.eventListenList=[]),ni._resetInIt(),ni.mediaSource=null},getState:()=>ni.mediaSource&&ni.mediaSource.readyState,isStateOpen:()=>ni.getState()===vt,isStateClosed:()=>ni.getState()===bt,isStateEnded:()=>ni.getState()===yt,_bindMediaSourceEvents(){const{proxy:e}=ni.events,t=e(ni.mediaSource,St,(()=>{si.debugLog(ni.TAG_NAME,"sourceOpen"),ni._onMediaSourceSourceOpen()})),r=e(ni.mediaSource,wt,(()=>{si.debugLog(ni.TAG_NAME,"sourceClose")})),i=e(ni.mediaSource,Et,(()=>{si.debugLog(ni.TAG_NAME,"sourceended")}));ni.eventListenList.push(t,r,i)},_onMediaSourceSourceOpen(){ni.sourceBuffer||(si.debugLog(ni.TAG_NAME,"onMediaSourceSourceOpen() sourceBuffer is null and next init"),ni._initSourceBuffer()),ni.audioSourceBuffer||(si.debugLog(ni.TAG_NAME,"onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),ni._initAudioSourceBuffer()),ni._hasPendingSegments()&&ni._doAppendSegments()},decodeVideo(e,t,r,i){if(si.isDestroyed)si.debugWarn(ni.TAG_NAME,"decodeVideo() and decoder is destroyed");else if(vr(ni.hasInit))if(r&&e[1]===Bt){const i=15&e[0];if(i===Me&&vr(si._opt.supportMSEDecodeHevc))return void ni.emitError(Fe.mediaSourceH265NotSupport);ni.videoInfo.codec=i,postMessage({cmd:M,code:i});const n=new Uint8Array(e);postMessage({cmd:R,buffer:n,codecId:i},[n.buffer]),ni.hasInit=ni._decodeConfigurationRecord(e,t,r,i)}else si.debugWarn(ni.TAG_NAME,`decodeVideo has not init , isIframe is ${r} , payload is ${e[1]} so drop this frame`);else if(!ni.isDecodeFirstIIframe&&r&&(ni.isDecodeFirstIIframe=!0),ni.isDecodeFirstIIframe){if(r&&0===e[1]){const t=15&e[0];let r={};t===Ie?r=Cr(e.slice(5)):t===Me&&(r=Vr(e));const i=ni.videoInfo;i&&i.codecWidth&&i.codecWidth&&r&&r.codecWidth&&r.codecHeight&&(r.codecWidth!==i.codecWidth||r.codecHeight!==i.codecWidth)&&(si.debugWarn(ni.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${i.codecWidth}, old height is ${i.codecHeight},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),ni.isWidthOrHeightChanged=!0,ni.emitError(Fe.mseWidthOrHeightChange,`width: ${i.codecWidth}->${r.codecWidth}, height: ${i.codecWidth}->${r.codecHeight}`))}if(ni.isWidthOrHeightChanged)return void si.debugWarn(ni.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(gr(e))return void si.debugLog(ni.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLengthni.prevTs>0&&eA,_decodeConfigurationRecord(e,t,r,i){let n=e.slice(5),s={};if(i===Ie?s=Cr(n):i===Me&&(s=jr(n)),ni.videoInfo.width=s.codecWidth,ni.videoInfo.height=s.codecHeight,0===s.codecWidth&&0===s.codecHeight)return si.debugWarn(ni.TAG_NAME,"_decodeConfigurationRecord error",JSON.stringify(s)),ni.emitError(Fe.mediaSourceDecoderConfigurationError,`width is ${0===s.codecWidth} and height is ${s.codecHeight}`),!1;const o={id:Ft,type:"video",timescale:1e3,duration:0,avcc:n,codecWidth:s.codecWidth,codecHeight:s.codecHeight,videoType:s.videoType},a=_n.generateInitSegment(o);ni.isAvc=i===Ie;let d=s.codec;return ni.videoMimeType=d?`video/mp4; codecs="${s.codec}"`:ni.isAvc?_t:gt,postMessage({cmd:T,w:s.codecWidth,h:s.codecHeight}),ni._initSourceBuffer(),ni.appendBuffer(a.buffer),ni.sequenceNumber=0,ni.cacheTrack={},ni.timeInit=!1,!0},_decodeAudioConfigurationRecord(e,t){const r=e[0]>>4,i=e[0]>>1&1,n=r===He,s=r===$e;if(vr(s||n))return si.debugWarn(ni.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${r} ant auto wasm decode`),ni.emitError(Fe.mediaSourceAudioG711NotSupport),!1;const o={id:Lt,type:"audio",timescale:1e3};let a={};if(Yt(e)){if(a=Zt(e.slice(2)),!a)return!1;o.audioSampleRate=a.sampleRate,o.channelCount=a.channelCount,o.config=a.config,o.refSampleDuration=1024/o.audioSampleRate*o.timescale}else{if(!n)return!1;if(a=Un(e),!a)return!1;o.audioSampleRate=a.samplingRate,o.channelCount=a.channelCount,o.refSampleDuration=1152/o.audioSampleRate*o.timescale}o.codec=a.codec,o.duration=0;let d="mp4",l=a.codec,c=null;n&&vr(si._opt.isFirefox)?(d="mpeg",l="",c=new Uint8Array):c=_n.generateInitSegment(o);let u=`${o.type}/${d}`;return l&&l.length>0&&(u+=`;codecs=${l}`),vr(ni.isAudioInitInfo)&&(or=r===$e?i?16:8:0===i?8:16,postMessage({cmd:F,code:r}),postMessage({cmd:P,sampleRate:o.audioSampleRate,channels:o.channelCount,depth:or}),ni.isAudioInitInfo=!0),ni.audioMimeType=u,ni.isAAC=s,ni._initAudioSourceBuffer(),ni.appendAudioBuffer(c.buffer),!0},_initSourceBuffer(){const{proxy:e}=ni.events;if(null===ni.sourceBuffer&&null!==ni.mediaSource&&ni.isStateOpen()&&ni.videoMimeType){try{si.debugLog(ni.TAG_NAME,"_initSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",ni.videoMimeType),ni.sourceBuffer=ni.mediaSource.addSourceBuffer(ni.videoMimeType)}catch(e){return si.debugError(ni.TAG_NAME,"_initSourceBuffer() appendBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),ni.emitError(Fe.mseWorkerAddSourceBufferError,e.code),void(ni.mediaSourceAddSourceBufferError=!0)}if(ni.sourceBuffer){const t=e(ni.sourceBuffer,"error",(e=>{ni.mediaSourceBufferError=!0,si.debugError(ni.TAG_NAME,"mseSourceBufferError mseDecoder.sourceBuffer",e,e.toString()),ni.emitError(Fe.mseSourceBufferError,e.code)})),r=e(ni.sourceBuffer,"updateend",(()=>{ni._hasPendingRemoveRanges()?ni._doRemoveRanges():ni._hasPendingSegments()?ni._doAppendSegments():ni.hasPendingEos&&(si.debugLog(ni.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),ni.endOfStream())}));ni.eventListenList.push(t,r)}}else si.debugLog(ni.TAG_NAME,`_initSourceBuffer and mseDecoder.isStateOpen is ${ni.isStateOpen()} and mseDecoder.isAvc === null is ${null===ni.isAvc}`)},_initAudioSourceBuffer(){const{proxy:e}=ni.events;if(null===ni.audioSourceBuffer&&null!==ni.mediaSource&&ni.isStateOpen()&&ni.audioMimeType){try{si.debugLog(ni.TAG_NAME,"_initAudioSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",ni.audioMimeType),ni._clearAudioSourceBufferCheckTimeout(),ni.audioSourceBuffer=ni.mediaSource.addSourceBuffer(ni.audioMimeType)}catch(e){return si.debugError(ni.TAG_NAME,"_initAudioSourceBuffer() addSourceBuffer mseDecoder.mediaSource.addSourceBuffer()",e.code,e.toString(),e),ni.emitError(Fe.mseWorkerAddSourceBufferError,e.code),void(ni.mediaSourceAddSourceBufferError=!0)}if(ni.audioSourceBuffer){const t=e(ni.audioSourceBuffer,"error",(e=>{ni.mediaSourceBufferError=!0,si.debugError(ni.TAG_NAME,"mseSourceBufferError mseDecoder.audioSourceBuffer",e.code,e.toString(),e),ni.emitError(Fe.mseSourceBufferError,e.code)})),r=e(ni.audioSourceBuffer,"updateend",(()=>{ni._hasPendingRemoveRanges()?ni._doRemoveRanges():ni._hasPendingSegments()?ni._doAppendSegments():ni.hasPendingEos&&(si.debugLog(ni.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),ni.endOfStream())}));ni.eventListenList.push(t,r),null===ni.audioSourceNoDataCheckTimeout&&(ni.audioSourceNoDataCheckTimeout=setTimeout((()=>{ni._clearAudioNoDataCheckTimeout(),ni.emitError(Fe.mediaSourceAudioNoDataTimeout)}),1e3))}}else si.debugLog(ni.TAG_NAME,`_initAudioSourceBuffer and mseDecoder.isStateOpen is ${ni.isStateOpen()} and mseDecoder.audioMimeType is ${ni.audioMimeType}`)},_decodeVideo(e,t,r,i,n){let s=e.slice(5),o=s.byteLength;if(0===o)return void si.debugWarn(ni.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let a=(new Date).getTime(),d=!1;ni.prevTimestamp||(ni.prevTimestamp=a,d=!0);const l=a-ni.prevTimestamp;if(ni.decodeDiffTimestamp=l,l>1e3&&!d&&si.isPlayer&&si.debugLog(ni.TAG_NAME,`_decodeVideo now time is ${a} and prev time is ${ni.prevTimestamp}, diff time is ${l} ms`),ni.cacheTrack.id&&t>=ni.cacheTrack.dts){let e=8+ni.cacheTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(_n.types.mdat,4),r.set(ni.cacheTrack.data,8),ni.cacheTrack.duration=t-ni.cacheTrack.dts;let i=_n.moof(ni.cacheTrack,ni.cacheTrack.dts);ni.cacheTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),ni.appendBuffer(n.buffer)}else si.debugLog(ni.TAG_NAME,`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${n} cacheTrack dts is ${ni.cacheTrack&&ni.cacheTrack.dts}`),ni.timeInit=!1,ni.cacheTrack={};ni.cacheTrack||(ni.cacheTrack={}),ni.cacheTrack.id=Ft,ni.cacheTrack.sequenceNumber=++ni.sequenceNumber,ni.cacheTrack.size=o,ni.cacheTrack.dts=t,ni.cacheTrack.cts=i,ni.cacheTrack.isKeyframe=r,ni.cacheTrack.data=s,ni.cacheTrack.flags={isLeading:0,dependsOn:r?2:1,isDependedOn:r?1:0,hasRedundancy:0,isNonSync:r?0:1},ni.prevTimestamp=(new Date).getTime()},_decodeAudio(e,t,r){let i=ni.isAAC?e.slice(2):e.slice(1),n=i.byteLength;if(ni.cacheAudioTrack.id&&t>=ni.cacheAudioTrack.dts){let e=8+ni.cacheAudioTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(_n.types.mdat,4),r.set(ni.cacheAudioTrack.data,8),ni.cacheAudioTrack.duration=t-ni.cacheAudioTrack.dts;let i=_n.moof(ni.cacheAudioTrack,ni.cacheAudioTrack.dts);ni.cacheAudioTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),ni.appendAudioBuffer(n.buffer)}else ni.cacheAudioTrack={};ni.cacheAudioTrack||(ni.cacheAudioTrack={}),ni.cacheAudioTrack.id=Lt,ni.cacheAudioTrack.sequenceNumber=++ni.audioSequenceNumber,ni.cacheAudioTrack.size=n,ni.cacheAudioTrack.dts=t,ni.cacheAudioTrack.cts=0,ni.cacheAudioTrack.data=i,ni.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}},appendBuffer(e){si.isDestroyed?si.debugWarn(ni.TAG_NAME,"appendBuffer() player is destroyed"):ni.mediaSourceAddSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):ni.mediaSourceAppendBufferFull?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):ni.mediaSourceAppendBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):ni.mediaSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(ni.pendingSegments.push(e),ni.sourceBuffer&&(si._opt.mseAutoCleanupSourceBuffer&&ni._needCleanupSourceBuffer()&&ni._doCleanUpSourceBuffer(),vr(ni.getSourceBufferUpdating())&&ni.isStateOpen()&&vr(ni._hasPendingRemoveRanges()))?ni._doAppendSegments():ni.isStateClosed()?(ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):ni.isStateEnded()&&(ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,"mediaSource is end")))},appendAudioBuffer(e){si.isDestroyed?si.debugWarn(ni.TAG_NAME,"appendAudioBuffer() player is destroyed"):ni.mediaSourceAddSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):ni.mediaSourceAppendBufferFull?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):ni.mediaSourceAppendBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):ni.mediaSourceBufferError?si.debugWarn(ni.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(ni.pendingAudioSegments.push(e),ni.audioSourceBuffer&&(si._opt.mseAutoCleanupSourceBuffer&&ni._needCleanupSourceBuffer()&&ni._doCleanUpSourceBuffer(),vr(ni.getAudioSourceBufferUpdating())&&ni.isStateOpen()&&vr(ni._hasPendingRemoveRanges()))?ni._doAppendSegments():ni.isStateClosed()?(ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):ni.isStateEnded()&&(ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,"mediaSource is end")))},getSourceBufferUpdating:()=>ni.sourceBuffer&&ni.sourceBuffer.updating,getAudioSourceBufferUpdating:()=>ni.audioSourceBuffer&&ni.audioSourceBuffer.updating,stop(){ni.abortSourceBuffer(),ni.removeSourceBuffer(),ni.endOfStream()},clearUpAllSourceBuffer(){if(ni.sourceBuffer){const e=ni.sourceBuffer.buffered;for(let t=0;tni.pendingSegments.length>0||ni.pendingAudioSegments.length>0,getPendingSegmentsLength:()=>ni.pendingSegments.length,_handleUpdatePlaybackRate(){},_doAppendSegments(){if(ni.isStateClosed()||ni.isStateEnded())si.debugLog(ni.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==ni.sourceBuffer){if(ni.needInitAudio()&&null===ni.audioSourceBuffer)return si.debugLog(ni.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===ni.audioSourceBufferCheckTimeout&&(ni.audioSourceBufferCheckTimeout=setTimeout((()=>{ni._clearAudioSourceBufferCheckTimeout(),ni.emitError(Fe.mediaSourceAudioInitTimeout)}),1e3)));if(vr(ni.getSourceBufferUpdating())&&ni.pendingSegments.length>0){const e=ni.pendingSegments.shift();try{ni.sourceBuffer.appendBuffer(e)}catch(e){si.debugError(ni.TAG_NAME,"mseDecoder.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(ni.stop(),ni.mediaSourceAppendBufferFull=!0,ni.emitError(Fe.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(ni.stop(),ni.mediaSourceAppendBufferError=!0,ni.emitError(Fe.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(ni.stop(),ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,`code is ${e.code} , message is ${e.message}`))}}if(vr(ni.getAudioSourceBufferUpdating())&&ni.pendingAudioSegments.length>0){const e=ni.pendingAudioSegments.shift();try{ni.audioSourceBuffer.appendBuffer(e)}catch(e){si.debugError(ni.TAG_NAME,"mseDecoder.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(ni.stop(),ni.mediaSourceAppendBufferFull=!0,ni.emitError(Fe.mediaSourceFull,`code is ${e.code} , message is ${e.message}`)):11===e.code?(ni.stop(),ni.mediaSourceAppendBufferError=!0,ni.emitError(Fe.mediaSourceAppendBufferError,`code is ${e.code} , message is ${e.message}`)):(ni.stop(),ni.mediaSourceBufferError=!0,ni.emitError(Fe.mseSourceBufferError,e.code,`code is ${e.code} , message is ${e.message}`))}}}else si.debugLog(ni.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")},_doCleanUpSourceBuffer(){const e=ni.$video.currentTime;if(ni.sourceBuffer){const t=ni.sourceBuffer.buffered;let r=!1;for(let i=0;i=si._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-si._opt.mseAutoCleanupMinBackwardDuration;ni.pendingRemoveRanges.push({start:n,end:t})}}else s=si._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-si._opt.mseAutoCleanupMinBackwardDuration;ni.pendingAudioRemoveRanges.push({start:n,end:t})}}else sni.pendingRemoveRanges.length>0||ni.pendingAudioRemoveRanges.length>0,needInitAudio:()=>si._opt.hasAudio&&si._opt.mseDecodeAudio,_doRemoveRanges(){if(ni.sourceBuffer&&vr(ni.getSourceBufferUpdating())){let e=ni.pendingRemoveRanges;for(;e.length&&vr(ni.getSourceBufferUpdating());){let t=e.shift();try{ni.sourceBuffer.remove(t.start,t.end)}catch(e){si.debugWarn(ni.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e,e.toString())}}}if(ni.audioSourceBuffer&&vr(ni.getAudioSourceBufferUpdating())){let e=ni.pendingAudioRemoveRanges;for(;e.length&&vr(ni.getAudioSourceBufferUpdating());){let t=e.shift();try{ni.audioSourceBuffer.remove(t.start,t.end)}catch(e){si.debugWarn(ni.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e,e.toString())}}}},_getPlaybackRate(){},_needCleanupSourceBuffer(){if(vr(si._opt.mseAutoCleanupSourceBuffer))return!1;const e=ni.$video.currentTime;if(ni.sourceBuffer){let t=ni.sourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=si._opt.mseAutoCleanupMaxBackwardDuration)return!0}if(ni.audioSourceBuffer){let t=ni.audioSourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=si._opt.mseAutoCleanupMaxBackwardDuration)return!0}return!1},_clearAudioSourceBufferCheckTimeout(){ni.audioSourceBufferCheckTimeout&&(clearTimeout(ni.audioSourceBufferCheckTimeout),ni.audioSourceBufferCheckTimeout=null)},_clearAudioNoDataCheckTimeout(){ni.audioSourceNoDataCheckTimeout&&(clearTimeout(ni.audioSourceNoDataCheckTimeout),ni.audioSourceNoDataCheckTimeout=null)},getHandle:()=>ni.mediaSource.handle,emitError(e){postMessage({cmd:se,value:e,msg:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""})}});let si={isPlayer:!0,isHevc:null,isPlayback:!1,dropping:!1,isPushDropping:!1,isWorkerFetch:!1,isDestroyed:!1,fetchStatus:Ct,_opt:Ar(),mp3Demuxer:null,delay:-1,pushLatestDelay:-1,firstTimestamp:null,startTimestamp:null,preDelayTimestamp:null,stopId:null,streamFps:null,streamAudioFps:null,streamVideoFps:null,writableStream:null,networkDelay:0,webglObj:null,startStreamRateAndStatsInterval:function(){si.stopStreamRateAndStatsInterval(),l=setInterval((()=>{d&&d(0);const e=JSON.stringify({demuxBufferDelay:si.getVideoBufferLength(),audioDemuxBufferDelay:si.getAudioBufferLength(),streamBufferByteLength:si.getStreamBufferLength(),netBuf:si.networkDelay||0,pushLatestDelay:si.pushLatestDelay||0,latestDelay:si.delay,isStreamTsMoreThanLocal:je,wasmDecodeDelay:Se-Ee});postMessage({cmd:O,type:Ce,value:e})}),1e3)},stopStreamRateAndStatsInterval:function(){l&&(clearInterval(l),l=null)},useOffscreen:function(){return si._opt.useOffscreen&&"undefined"!=typeof OffscreenCanvas},getDelay:function(e,t){if(!e||si._opt.hasVideo&&!B)return-1;if(t===oe)return si.delay;if(si.preDelayTimestamp&&si.preDelayTimestamp>e)return si.preDelayTimestamp-e>1e3&&si.debugWarn("worker",`getDelay() and preDelayTimestamp is ${si.preDelayTimestamp} > timestamp is ${e} more than ${si.preDelayTimestamp-e}ms and return ${si.delay}`),si.preDelayTimestamp=e,si.delay;if(si.firstTimestamp){if(e){const t=Date.now()-si.startTimestamp,r=e-si.firstTimestamp;t>=r?(je=!1,si.delay=t-r):(je=!0,si.delay=r-t)}}else si.firstTimestamp=e,si.startTimestamp=Date.now(),si.delay=-1;return si.preDelayTimestamp=e,si.delay},getDelayNotUpdateDelay:function(e,t){if(!e||si._opt.hasVideo&&!B)return-1;if(t===oe)return si.pushLatestDelay;if(si.preDelayTimestamp&&si.preDelayTimestamp-e>1e3)return si.debugWarn("worker",`getDelayNotUpdateDelay() and preDelayTimestamp is ${si.preDelayTimestamp} > timestamp is ${e} more than ${si.preDelayTimestamp-e}ms and return -1`),-1;if(si.firstTimestamp){let t=-1;if(e){const r=Date.now()-si.startTimestamp,i=e-si.firstTimestamp;r>=i?(je=!1,t=r-i):(je=!0,t=i-r)}return t}return-1},resetDelay:function(){si.firstTimestamp=null,si.startTimestamp=null,si.delay=-1,si.dropping=!1},resetAllDelay:function(){si.resetDelay(),si.preDelayTimestamp=null},doDecode:function(e){si._opt.isEmitSEI&&e.type===ae&&si.isWorkerFetch&&si.findSei(e.payload,e.ts),si.isPlayUseMSEAndDecoderInWorker()?e.type===oe?si._opt.mseDecodeAudio?ni.decodeAudio(e.payload,e.ts):e.decoder.decode(e.payload,e.ts):e.type===ae&&ni.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):si._opt.useWCS&&si.useOffscreen()&&e.type===ae&&s.decode?s.decode(e.payload,e.ts,e.cts):e.decoder.decode(e.payload,e.ts,e.isIFrame,e.cts)},decodeNext(e){if(0===i.length)return;const t=e.ts,n=i[0],s=e.type===ae&&gr(e.payload);if(vr(r))s&&(si.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n isVideoSqeHeader is ${s}`),i.shift(),si.doDecode(n));else{const r=n.ts-t,o=n.type===oe&&e.type===ae;(r<=20||o||s)&&(si.debugLog("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n diff is ${r} and isVideoAndNextAudio is ${o} and isVideoSqeHeader is ${s}`),i.shift(),si.doDecode(n))}},init:function(){si.debugLog("worker","init and opt is",JSON.stringify(si._opt));const e=si._opt.playType===v,t=si._opt.playType===b;if(Tr.init(),si.isPlayer=e,si.isPlayback=t,si.isPlayUseMSEAndDecoderInWorker()&&ni&&ni.init(),s&&si._opt.useWCS&&si.useOffscreen()&&s.init(),vr(si.isPlaybackCacheBeforeDecodeForFpsRender())){si.debugLog("worker","setInterval()");const t=()=>{const t=si._opt.videoBuffer+si._opt.videoBufferDelay;let r=null;if(i.length){if(si.isPushDropping)return void si.debugWarn("worker",`loop() isPushDropping is true and bufferList length is ${i.length}`);if(si.dropping){for(r=i.shift(),si.debugWarn("worker",`loop() dropBuffer is dropping and isIFrame ${r.isIFrame} and delay is ${si.delay} and bufferlist is ${i.length}`);!r.isIFrame&&i.length;)r=i.shift();const e=si.getDelayNotUpdateDelay(r.ts,r.type);r.isIFrame&&e<=si.getNotDroppingDelayTs()&&(si.debugLog("worker","loop() is dropping = false, is iFrame"),si.dropping=!1,si.doDecode(r),si.decodeNext(r))}else if(si.isPlayback||si.isPlayUseMSE()||0===si._opt.videoBuffer)for(;i.length;)r=i.shift(),si.doDecode(r);else if(r=i[0],-1===si.getDelay(r.ts,r.type))si.debugLog("worker","loop() common dumex delay is -1 ,data.ts is",r.ts),i.shift(),si.doDecode(r),si.decodeNext(r);else if(si.delay>t&&e)si.hasIframeInBufferList()?(si.debugLog("worker",`delay is ${si.delay} > maxDelay ${t}, set dropping is true`),si.resetAllDelay(),si.dropping=!0,postMessage({cmd:H})):(i.shift(),si.doDecode(r),si.decodeNext(r));else for(;i.length;){if(r=i[0],!(si.getDelay(r.ts,r.type)>si._opt.videoBuffer)){si.delay<0&&si.debugWarn("worker",`loop() do not decode and delay is ${si.delay}, bufferList is ${i.length}`);break}i.shift(),si.doDecode(r)}}else-1!==si.delay&&si.debugLog("worker","loop() bufferList is empty and reset delay"),si.resetAllDelay()};si.stopId=setInterval((()=>{let e=(new Date).getTime();Je||(Je=e);const r=e-Je;r>100&&si.debugWarn("worker",`loop demux diff time is ${r}`),t(),Je=(new Date).getTime()}),20)}else si.debugLog("worker","playback and playbackIsCacheBeforeDecodeForFpsRender is true");if(vr(si._opt.checkFirstIFrame)&&(B=!0),si.isPlayUseMSEAndDecoderInWorker()&&ni){const e=ni.getHandle();e&&postMessage({cmd:ie,mseHandle:e},[e])}},playbackCacheLoop:function(){si.clearPlaybackCacheLoop();const e=()=>{let e=null;i.length&&(e=i.shift(),si.doDecode(e))};e();const t=Math.ceil(1e3/(si.streamFps*si._opt.playbackRate));si.debugLog("worker",`playbackCacheLoop fragDuration is ${t}, streamFps is ${si.streamFps}, streamAudioFps is ${si.streamAudioFps} ,streamVideoFps is ${si.streamVideoFps} playbackRate is ${si._opt.playbackRate}`),si.stopId=setInterval(e,t)},clearPlaybackCacheLoop:function(){si.stopId&&(clearInterval(si.stopId),si.stopId=null)},startPlaybackCacheLoop:function(){si.playbackCacheLoop()},close:function(){if(si.debugLog("worker","close"),si.isDestroyed=!0,Ur(),!a||1!==a.readyState&&2!==a.readyState?a&&si.debugLog("worker",`close() and socket.readyState is ${a.readyState}`):(Sr=!0,a.close(1e3,"Client disconnecting")),a=null,si.stopStreamRateAndStatsInterval(),si.stopId&&(clearInterval(si.stopId),si.stopId=null),si.mp3Demuxer&&(si.mp3Demuxer.destroy(),si.mp3Demuxer=null),si.writableStream&&vr(si.writableStream.locked)&&si.writableStream.close().catch((e=>{si.debugLog("worker","close() and writableStream.close() error",e.toString(),e)})),si.writableStream=null,oi)try{oi.clear&&oi.clear(),oi=null}catch(e){si.debugLog("worker","close() and audioDecoder.clear error",e.toString(),e)}if(ai)try{ai.clear&&ai.clear(),ai=null}catch(e){si.debugLog("worker","close() and videoDecoder.clear error",e.toString())}d=null,Je=null,je=!1,Se=0,Ee=0,s&&(s.destroy&&s.destroy(),s=null),ni&&(ni.destroy(),ni=null),si.firstTimestamp=null,si.startTimestamp=null,si.networkDelay=0,si.streamFps=null,si.streamAudioFps=null,si.streamVideoFps=null,si.delay=-1,si.pushLatestDelay=-1,si.preDelayTimestamp=null,si.dropping=!1,si.isPushDropping=!1,si.isPlayer=!0,si.isPlayback=!1,si.isWorkerFetch=!1,si.isHevc=null,si._opt=Ar(),si.webglObj&&(si.webglObj.destroy(),si.offscreenCanvas.removeEventListener("webglcontextlost",si.onOffscreenCanvasWebglContextLost),si.offscreenCanvas.removeEventListener("webglcontextrestored",si.onOffscreenCanvasWebglContextRestored),si.offscreenCanvas=null,si.offscreenCanvasGL=null,si.offscreenCanvasCtx=null),i=[],n=[],c&&(c.close(),c=null),h=null,f=null,S=!1,E=!1,B=!1,Wt=!1,Vt=!1,Xt=!1,er=null,it=[],Ut=0,kt=0,Qe=null,tt=null,$t=null,Ot=null,or=null,Gt=0,Ht=0,ut=null,At=null,si.fetchStatus=Ct,Er=!0,Tr.destroy(),Gr.destroy(),Hr.destroy(),qr.destroy(),si.debug=null,si._opt={},postMessage({cmd:K})},pushBuffer:function(e,t){if(t.type===oe&&Yt(e)){if(si.debugLog("worker",`pushBuffer audio ts is ${t.ts}, isAacCodecPacket is true`),si._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:Q,buffer:t},[t.buffer])}si.decodeAudio(e,t.ts)}else if(t.type===ae&&t.isIFrame&&gr(e)){if(si.debugLog("worker",`pushBuffer video ts is ${t.ts}, isVideoSequenceHeader is true`),si._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:ee,buffer:t},[t.buffer])}si.decodeVideo(e,t.ts,t.isIFrame,t.cts)}else{if(si._opt.isRecording)if(si._opt.isRecordTypeFlv){const r=new Uint8Array(e);postMessage({cmd:te,type:t.type,buffer:r,ts:t.ts},[r.buffer])}else if(si._opt.recordType===w)if(t.type===ae){const r=new Uint8Array(e).slice(5);postMessage({cmd:z,buffer:r,isIFrame:t.isIFrame,ts:t.ts,cts:t.cts},[r.buffer])}else if(t.type===oe&&si._opt.isWasmMp4){const r=new Uint8Array(e),i=Kt(r)?r.slice(2):r.slice(1);postMessage({cmd:L,buffer:i,ts:t.ts},[i.buffer])}if(si.isPlayer){if(t.type===ae){if(Gt>0){const e=t.ts-Ot,r=Gt+Gt/2;e>r&&si.debugLog("worker",`pushBuffer video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts}, preTs is ${Ot},\n diff is ${e} and preTsDuration is ${Gt} and maxDiff is ${r}\n maybe trigger black screen or flower screen\n `)}if(null!==Ot&&Ot>=t.ts&&(si.debugWarn("worker",`pushBuffer() and isIFrame is ${t.isIFrame} and,\n options.ts is ${t.ts} less than (or equal) preTs is ${Ot} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${Ht}`),Ot-t.ts>A&&(si.debugWarn("worker",`pushBuffer,\n preTimestamp is ${Ot}, options.ts is ${t.ts},\n diff is ${Ot-t.ts} more than 3600000,\n and resetAllDelay`),si.resetAllDelay(),Ot=null,Gt=0),si._opt.isDropSameTimestampGop&&vr(t.isIFrame)&&B)){const e=si.hasIframeInBufferList(),t=vr(si.isPushDropping);return si.debugLog("worker",`pushBuffer, isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next dropBuffer`),void(e&&t?si.dropBuffer$2():(si.clearBuffer(!0),yr(si._opt.checkFirstIFrame)&&yr(r)&&(si.isPlayUseMSEAndDecoderInWorker()?ni.isDecodeFirstIIframe=!1:postMessage({cmd:re}))))}Ot>0&&(Gt=t.ts-Ot),Ht=e.byteLength,Ot=t.ts}if(B){const e=si._opt.videoBuffer+si._opt.videoBufferDelay,r=si.getDelayNotUpdateDelay(t.ts,t.type);si.pushLatestDelay=r,si.delay>0&&r>e&&si.delay({type:e.type,ts:e.ts})));si.debugLog("worker",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${i.length}, and ts list is ${JSON.stringify(r)}`)}const r=si.getAudioBufferLength()>0,n=r?60:40;i.length>=n&&(si.debugWarn("worker",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${i.length} more than ${n}, and hasAudio is ${r} an set streamFps is 25`),si.streamVideoFps=25,postMessage({cmd:V,value:si.streamVideoFps}),r?(si.streamAudioFps=25,si.streamFps=si.streamVideoFps+si.streamAudioFps):si.streamFps=si.streamVideoFps,si.playbackCacheLoop())}}},getVideoBufferLength(){let e=0;return i.forEach((t=>{t.type===ae&&(e+=1)})),e},hasIframeInBufferList:()=>i.some((e=>e.type===ae&&e.isIFrame)),isAllIframeInBufferList(){const e=si.getVideoBufferLength();let t=0;return i.forEach((e=>{e.type===ae&&e.isIFrame&&(t+=1)})),e===t},getNotDroppingDelayTs:()=>si._opt.videoBuffer+si._opt.videoBufferDelay/2,getAudioBufferLength(){let e=0;return i.forEach((t=>{t.type===oe&&(e+=1)})),e},getStreamBufferLength(){let e=0;return c&&c.buffer&&(e=c.buffer.byteLength),si._opt.isNakedFlow?Tr.lastBuf&&(e=Tr.lastBuf.byteLength):si._opt.isTs?qr._remainingPacketData&&(e=qr._remainingPacketData.byteLength):si._opt.isFmp4&&Gr.mp4Box&&(e=Gr.mp4Box.getAllocatedSampleDataSize()),e},fetchStream:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(si.debugLog("worker","fetchStream, url is "+e,"options:",JSON.stringify(t)),si.isWorkerFetch=!0,t.isFlv?si._opt.isFlv=!0:t.isFmp4?si._opt.isFmp4=!0:t.isMpeg4?si._opt.isMpeg4=!0:t.isNakedFlow?si._opt.isNakedFlow=!0:t.isTs&&(si._opt.isTs=!0),d=ar((e=>{postMessage({cmd:O,type:Ue,value:e})})),si.startStreamRateAndStatsInterval(),t.isFmp4&&(Gr.listenMp4Box(),si._opt.isFmp4Private&&Gr.initTransportDescarmber()),t.protocol===_){t.isFlv&&(c=new xr(si.demuxFlv())),o=new AbortController;const r=Object.assign({signal:o.signal},{headers:t.options&&t.options.headers||{}});fetch(e,r).then((e=>{if(yr(Sr))return si.debugLog("worker","request abort and run res.body.cancel()"),si.fetchStatus=Ct,void e.body.cancel();if(!mr(e))return si.debugWarn("worker",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),Ur(),void postMessage({cmd:O,type:Fe.fetchError,value:`fetch response status is ${e.status} and ok is ${e.ok}`});if(postMessage({cmd:O,type:Te}),hr())si.writableStream=new WritableStream({write:e=>o&&o.signal&&o.signal.aborted?(si.debugLog("worker","writableStream write() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt)):yr(Sr)?(si.debugLog("worker","writableStream write() and requestAbort is true so return"),si.fetchStatus=Pt,void Ur()):void("string"!=typeof e?(si.fetchStatus=Dt,d(e.byteLength),t.isFlv?c.write(e):t.isFmp4?si.demuxFmp4(e):t.isMpeg4?si.demuxMpeg4(e):t.isTs?si.demuxTs(e):t.isNakedFlow&&si.demuxNakedFlow(e)):si.debugWarn("worker",`writableStream write() and value is "${e}" string so return`)),close:()=>{si.debugLog("worker","writableStream close()"),si.fetchStatus=Pt,c&&(c.close(),c=null),Ur(),postMessage({cmd:O,type:Ae,value:g,msg:"fetch done"})},abort:e=>{if(o&&o.signal&&o.signal.aborted)return si.debugLog("worker","writableStream abort() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt);c&&(c.close(),c=null),e.name!==xt?(si.debugLog("worker",`writableStream abort() and e is ${e.toString()}`),Ur(),postMessage({cmd:O,type:Fe.fetchError,value:e.toString()})):si.debugLog("worker","writableStream abort() and e.name is AbortError so return")}}),e.body.pipeTo(si.writableStream).catch((e=>{"AbortError"!==e.name&&si.debugLog("worker","writableStream pipeTo() and e is",e.name,e.toString())}));else{const r=e.body.getReader(),i=()=>{r.read().then((e=>{let{done:r,value:n}=e;return r?(si.debugLog("worker","fetchNext().then() and done is true"),si.fetchStatus=Pt,c&&(c.close(),c=null),Ur(),void postMessage({cmd:O,type:Ae,value:g,msg:"fetch done"})):o&&o.signal&&o.signal.aborted?(si.debugLog("worker","fetchNext().then() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt)):yr(Sr)?(si.debugLog("worker","fetchNext().then() and requestAbort is true so return"),si.fetchStatus=Pt,void Ur()):void("string"!=typeof n?(si.fetchStatus=Dt,d(n.byteLength),t.isFlv?c.write(n):t.isFmp4?si.demuxFmp4(n):t.isMpeg4?si.demuxMpeg4(n):t.isTs?si.demuxTs(n):t.isNakedFlow&&si.demuxNakedFlow(n),i()):si.debugWarn("worker",`fetchNext().then() and value "${n}" is string so return`))})).catch((e=>{if(o&&o.signal&&o.signal.aborted)return si.debugLog("worker","fetchNext().catch() and abortController.signal.aborted is true so return"),void(si.fetchStatus=Pt);c&&(c.close(),c=null),e.name!==xt?(si.debugLog("worker",`fetchNext().catch() and e is ${e.toString()}`),Ur(),postMessage({cmd:O,type:Fe.fetchError,value:e.toString()})):si.debugLog("worker","fetchNext().catch() and e.name is AbortError so return")}))};i()}})).catch((e=>{o&&o.signal&&o.signal.aborted?si.debugLog("worker","fetch().catch() and abortController.signal.aborted is true so return"):e.name!==xt?(si.debugLog("worker",`fetch().catch() and e is ${e.toString()}`),Ur(),postMessage({cmd:O,type:Fe.fetchError,value:e.toString()}),c&&(c.close(),c=null)):si.debugLog("worker","fetch().catch() and e.name is AbortError so return")}))}else t.protocol===m&&(t.isFlv&&(c=new xr(si.demuxFlv())),a=new WebSocket(e,r),a.binaryType="arraybuffer",a.onopen=()=>{si.debugLog("worker","fetchStream, WebsocketStream socket open"),postMessage({cmd:O,type:Te}),postMessage({cmd:O,type:Pe})},a.onclose=e=>{si.isDestroyed?si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} and isDestroyed is true, so return`):u?si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code} but isSocketError is true , so return`):(si.debugLog("worker",`fetchStream, WebsocketStream socket close and code is ${e.code}`),1006===e.code&&si.debugError("worker",`fetchStream, WebsocketStream socket close abnormally and code is ${e.code}`),yr(Sr)?si.debugLog("worker","fetchStream, WebsocketStream socket close and requestAbort is true so return"):(c&&(c.close(),c=null),postMessage({cmd:O,type:Ae,value:y,msg:e.code})))},a.onerror=e=>{si.debugError("worker","fetchStream, WebsocketStream socket error",e,e.toString()),u=!0,c&&(c.close(),c=null),si.isDestroyed?si.debugLog("worker","fetchStream, WebsocketStream on error and isDestroyed is true, so return"):postMessage({cmd:O,type:Fe.websocketError,value:e.isTrusted?"websocket user aborted":"websocket error"})},a.onmessage=e=>{"string"!=typeof e.data?(d(e.data.byteLength),t.isFlv?c.write(e.data):t.isFmp4?si.demuxFmp4(e.data):t.isMpeg4?si.demuxMpeg4(e.data):si._opt.isNakedFlow?si.demuxNakedFlow(e.data):si.demuxM7s(e.data)):si.debugWarn("worker",`socket on message is string "${e.data}" and return`)})},demuxFlv:function*(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),r=new Uint32Array(e);for(;;){t[3]=0;const e=yield 15,i=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const n=r[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let s=r[0];const o=(yield n).slice();switch(i){case de:if(o.byteLength>0){let e=o;yr(si._opt.m7sCryptoAudio)&&(e=si.cryptoPayloadAudio(o)),si.decode(e,{type:oe,ts:s})}else si.debugWarn("worker",`demuxFlv() type is audio and payload.byteLength is ${o.byteLength} and return`);break;case le:if(o.byteLength>=6){const e=o[0];if(si._isEnhancedH265Header(e))si._decodeEnhancedH265Video(o,s);else{const e=15&o[0];let t=o[0]>>4===Tt;const i=e===Me;if(vr(t)&&yr(wr(o,i))&&(si.debugLog("worker","demux() isIFrame is false and unit type is IDR and update to true"),t=!0),t&&gr(o)&&null===si.isHevc){const e=15&o[0];si.isHevc=e===Me,er=ir(o,si.isHevc),si.debugLog("worker",`demuxFlv() isVideoSequenceHeader is true and isHevc is ${si.isHevc} and nalUnitSize is ${er}`)}t&&si.calcIframeIntervalTimestamp(s),si.isPlayer&&si.calcNetworkDelay(s),r[0]=o[4],r[1]=o[3],r[2]=o[2],r[3]=0;let n=r[0],a=si.cryptoPayload(o,t);si.decode(a,{type:ae,ts:s,isIFrame:t,cts:n})}}else si.debugWarn("worker",`demuxFlv() type is video and payload.byteLength is ${o.byteLength} and return`);break;case ce:postMessage({cmd:J,buffer:o},[o.buffer]);break;default:si.debugLog("worker",`demuxFlv() type is ${i}`)}}},decode:function(e,t){t.type===oe?si._opt.hasAudio&&(postMessage({cmd:O,type:xe,value:e.byteLength}),si.isPlayer?si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts}):si.isPlayback&&(si.isPlaybackOnlyDecodeIFrame()||(si.isPlaybackCacheBeforeDecodeForFpsRender(),si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts})))):t.type===ae&&si._opt.hasVideo&&(postMessage({cmd:O,type:Be,value:e.byteLength}),postMessage({cmd:O,type:ke,value:t.ts}),si.isPlayer?si.pushBuffer(e,{type:t.type,ts:t.ts,isIFrame:t.isIFrame,cts:t.cts}):si.isPlayback&&(si.isPlaybackOnlyDecodeIFrame()?t.isIFrame&&si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}):(si.isPlaybackCacheBeforeDecodeForFpsRender(),si.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}))))},cryptoPayload:function(e,t){let r=e;return si._opt.isM7sCrypto?si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?r=Ni(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc):si.debugError("worker",`isM7sCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`):si._opt.isSm4Crypto?si._opt.sm4CryptoKey?r=si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?rs(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc,si._opt.isSm4CryptoH265V2):dn(e,si._opt.sm4CryptoKey,si.isHevc,si._opt.isSm4CryptoH265V2):si._opt.sm4CryptoKey||si.debugError("worker","isSm4Crypto opt.sm4CryptoKey is null"):si._opt.isXorCrypto&&(si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?r=fn(e,si._opt.cryptoKey,si._opt.cryptoIV,si.isHevc):si.debugError("worker",`isXorCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`)),r},cryptoPayloadAudio:function(e){let t=e;return si._opt.isM7sCrypto&&(si._opt.cryptoIV&&si._opt.cryptoIV.byteLength>0&&si._opt.cryptoKey&&si._opt.cryptoKey.byteLength>0?e[0]>>4===$e&&(t=$i(e,si._opt.cryptoKey,si._opt.cryptoIV)):si.debugError("worker",`isM7sCrypto cryptoKey.length is ${si._opt.cryptoKey&&si._opt.cryptoKey.byteLength} or cryptoIV.length is ${si._opt.cryptoIV&&si._opt.cryptoIV.byteLength} null`)),t},setCodecAudio:function(e,t){const r=e[0]>>4,i=e[0]>>1&1;if(or=r===$e?i?16:8:0===i?8:16,oi&&oi.setCodec)if(Yt(e)||r===Oe||r===Ge||r===He){si.debugLog("worker",`setCodecAudio: init audio codec, codeId is ${r} _opt.sampleRate is ${si._opt.sampleRate}`);const i=r===$e?e.slice(2):new Uint8Array(0);oi.setCodec(r,si._opt.sampleRate,i),r===$e&&postMessage({cmd:I,buffer:i},[i.buffer]),E=!0,r!==$e&&(r===He?(si.mp3Demuxer||(si.mp3Demuxer=new cn(si),si.mp3Demuxer.on("data",((e,t)=>{oi.decode(e,t)}))),si.mp3Demuxer.dispatch(e.slice(1),t)):oi.decode(e.slice(1),t));{const e=Number("1")||1;setTimeout((()=>{si.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),si.close(),postMessage({cmd:W})}),60*e*60*1e3)}}else si.debugWarn("worker","setCodecAudio: hasInitAudioCodec is false, codecId is ",r);else si.debugError("worker","setCodecAudio: audioDecoder or audioDecoder.setCodec is null")},decodeAudio:function(e,t){if(si.isDestroyed)si.debugLog("worker","decodeAudio, decoder is destroyed and return");else if(si.isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio())ni.decodeAudio(e,t);else if(yr(r)&&yr(si._opt.mseDecodeAudio))postMessage({cmd:$,payload:e,ts:t,cts:t},[e.buffer]);else{const r=e[0]>>4;if(E){if(Yt(e))return void si.debugLog("worker","decodeAudio and has already initialized and payload is aac codec packet so drop this frame");r===He?si.mp3Demuxer.dispatch(e.slice(1),t):oi.decode(r===$e?e.slice(2):e.slice(1),t)}else si.setCodecAudio(e,t)}},setCodecVideo:function(e,t){const r=15&e[0];if(ai&&ai.setCodec)if(gr(e))if(r===Ie||r===Me){si.debugLog("worker",`setCodecVideo: init video codec , codecId is ${r}`);const t=e.slice(5);if(r===Ie&&si._opt.useSIMD){const e=Cr(t);if(e.codecWidth>U||e.codecHeight>U)return postMessage({cmd:Y,value:`width: ${e.codecWidth} > 4080, height: ${e.codecHeight} > 4080`}),void si.debugWarn("worker",`setCodecVideo: SIMD H264 decode video width is too large, width is ${e.codecWidth}, height is ${e.codecHeight}`)}const i=new Uint8Array(e);S=!0,ai.setCodec(r,t),postMessage({cmd:M,code:r}),postMessage({cmd:R,buffer:i,codecId:r},[i.buffer])}else si.debugWarn("worker",`setCodecVideo: hasInitVideoCodec is false, codecId is ${r} is not H264 or H265`);else si.debugWarn("worker",`decodeVideo: hasInitVideoCodec is false, codecId is ${r} and isIFrame is ${t} and packetType is ${e[1]}`);else si.debugError("worker","setCodecVideo: videoDecoder or videoDecoder.setCodec is null")},decodeVideo:function(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(si.isDestroyed)si.debugLog("worker","decodeVideo, decoder is destroyed and return");else if(si.isPlayUseMSEAndDecoderInWorker())ni.decodeVideo(e,t,i,n);else if(yr(r))postMessage({cmd:N,payload:e,isIFrame:i,ts:t,cts:n,delay:si.delay},[e.buffer]);else if(S)if(!B&&i&&(B=!0),B){if(i&&gr(e)){const t=15&e[0];let r={};t===Ie?r=Cr(e.slice(5)):t===Me&&(r=Vr(e)),r.codecWidth&&r.codecHeight&&h&&f&&(r.codecWidth!==h||r.codecHeight!==f)&&(si.debugWarn("worker",`\n decodeVideo: video width or height is changed,\n old width is ${h}, old height is ${f},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),Vt=!0,postMessage({cmd:j,value:`width: ${h}->${r.codecWidth}, height: ${f}->${r.codecHeight}`}))}if(Vt)return void si.debugWarn("worker","decodeVideo: video width or height is changed, and return");if(Xt)return void si.debugWarn("worker","decodeVideo: simd decode error, and return");if(gr(e))return void si.debugLog("worker","decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength0&&void 0!==arguments[0]&&arguments[0];si.debugLog("worker",`clearBuffer,bufferList length is ${i.length}, need clear is ${e}`),e&&(i=[]),si.isPlayer&&(si.resetAllDelay(),yr(si._opt.checkFirstIFrame)&&(si.dropping=!0,postMessage({cmd:H}))),yr(si._opt.checkFirstIFrame)&&vr(r)&&(B=!1)},dropBuffer$2:function(){if(i.length>0){let e=i.findIndex((e=>yr(e.isIFrame)&&e.type===ae));if(si.isAllIframeInBufferList())for(let t=0;t=si.getNotDroppingDelayTs()){si.debugLog("worker",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${n} and notDroppingDelayTs is ${si.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){si.isPushDropping=!0,postMessage({cmd:H});const t=i.length;i=i.slice(e);const r=i.shift();si.resetAllDelay(),si.getDelay(r.ts,r.type),si.doDecode(r),si.isPushDropping=!1,si.debugLog("worker",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,new bufferList is ${i.length} and new delay is ${si.delay} `)}else si.isPushDropping=!1}0===i.length&&(si.isPushDropping=!1)},demuxM7s:function(e){const t=new DataView(e),r=t.getUint32(1,!1),i=t.getUint8(0),n=new ArrayBuffer(4),s=new Uint32Array(n);switch(i){case oe:si.decode(new Uint8Array(e,5),{type:oe,ts:r});break;case ae:if(t.byteLength>=11){const i=new Uint8Array(e,5),n=i[0];if(si._isEnhancedH265Header(n))si._decodeEnhancedH265Video(i,r);else{const e=t.getUint8(5)>>4==1;if(e&&(si.calcIframeIntervalTimestamp(r),gr(i)&&null===si.isHevc)){const e=15&i[0];si.isHevc=e===Me}si.isPlayer&&si.calcNetworkDelay(r),s[0]=i[4],s[1]=i[3],s[2]=i[2],s[3]=0;let n=s[0],o=si.cryptoPayload(i,e);si.decode(o,{type:ae,ts:r,isIFrame:e,cts:n})}}else si.debugWarn("worker",`demuxM7s() type is video and arrayBuffer length is ${e.byteLength} and return`)}},demuxNakedFlow:function(e){Tr.dispatch(e)},demuxFmp4:function(e){Gr.dispatch(e)},demuxMpeg4:function(e){Hr.dispatch(e)},demuxTs:function(e){qr.dispatch(e)},_decodeEnhancedH265Video:function(e,t){const r=e[0],i=48&r,n=15&r,s=e.slice(1,5),o=new ArrayBuffer(4),a=new Uint32Array(o),d="a"==String.fromCharCode(s[0]);if(si.isHevc=vr(d),n===Mt){if(i===Nt){const r=e.slice(5);if(d);else{const i=new Uint8Array(5+r.length);i.set([28,0,0,0,0],0),i.set(r,5),er=ir(e,si.isHevc),si.debugLog("worker",`demuxFlv() isVideoSequenceHeader(enhancedH265) is true and isHevc is ${si.isHevc} and nalUnitSize is ${er}`),si.decode(i,{type:ae,ts:t,isIFrame:!0,cts:0})}}}else if(n===Rt){let r=e,n=0;const s=i===Nt;s&&si.calcIframeIntervalTimestamp(t),d||(a[0]=e[4],a[1]=e[3],a[2]=e[2],a[3]=0,n=a[0],r=Xr(e.slice(8),s),r=si.cryptoPayload(r,s),si.decode(r,{type:ae,ts:t,isIFrame:s,cts:n}))}else if(n===zt){const r=i===Nt;r&&si.calcIframeIntervalTimestamp(t);let n=Xr(e.slice(5),r);n=si.cryptoPayload(n,r),si.decode(n,{type:ae,ts:t,isIFrame:r,cts:0})}},_isEnhancedH265Header:function(e){return(e&It)===It},findSei:function(e,t){let r=4;lr(er)&&(r=er),tr(e.slice(5),r).forEach((e=>{const r=si.isHevc?e[0]>>>1&63:31&e[0],i=si.isHevc&&(r===ft||r===ht),n=vr(si.isHevc)&&r===Ke;(i||n)&&postMessage({cmd:Z,buffer:e,ts:t},[e.buffer])}))},calcNetworkDelay:function(e){if(!(B&&e>0))return;null===Qe?(Qe=e,tt=nr()):et?r-t:0;si.networkDelay=i,i>si._opt.networkDelay&&si._opt.playType===v&&(si.debugWarn("worker",`calcNetworkDelay now dts:${e}, start dts is ${Qe} vs start is ${t},local diff is ${r} ,delay is ${i}`),postMessage({cmd:O,type:De,value:i}))},calcIframeIntervalTimestamp:function(e){null===$t?$t=e:$t=si._opt.playbackForwardMaxRateDecodeIFrame&&!(si._opt.useMSE&&si._opt.mseDecodeAudio)},isPlayUseMSE:function(){return si.isPlayer&&si._opt.useMSE&&yr(r)},isPlayUseMSEAndDecoderInWorker:function(){return si.isPlayUseMSE()&&si._opt.mseDecoderUseWorker},isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio:function(){return si.isPlayUseMSEAndDecoderInWorker()&&si._opt.mseDecodeAudio},playbackUpdatePlaybackRate:function(){vr(si.isPlaybackCacheBeforeDecodeForFpsRender())&&si.clearBuffer(!0)},onOffscreenCanvasWebglContextLost:function(e){si.debugError("worker","handleOffscreenCanvasWebglContextLost and next try to create webgl"),e.preventDefault(),Wt=!0,si.webglObj.destroy(),si.webglObj=null,si.offscreenCanvasGL=null,setTimeout((()=>{si.offscreenCanvasGL=si.offscreenCanvas.getContext("webgl"),si.offscreenCanvasGL&&si.offscreenCanvasGL.getContextAttributes().stencil?(si.webglObj=p(si.offscreenCanvasGL,si._opt.openWebglAlignment),Wt=!1):si.debugError("worker","handleOffscreenCanvasWebglContextLost, stencil is false")}),500)},onOffscreenCanvasWebglContextRestored:function(e){si.debugLog("worker","handleOffscreenCanvasWebglContextRestored"),e.preventDefault()},videoInfo:function(e,t,r){postMessage({cmd:M,code:e}),postMessage({cmd:T,w:t,h:r}),h=t,f=r,si.useOffscreen()&&(si.offscreenCanvas=new OffscreenCanvas(t,r),si.offscreenCanvasGL=si.offscreenCanvas.getContext("webgl"),si.webglObj=p(si.offscreenCanvasGL,si._opt.openWebglAlignment),si.offscreenCanvas.addEventListener("webglcontextlost",si.onOffscreenCanvasWebglContextLost,!1),si.offscreenCanvas.addEventListener("webglcontextrestored",si.onOffscreenCanvasWebglContextRestored,!1))},audioInfo:function(e,t,r){postMessage({cmd:F,code:e}),postMessage({cmd:P,sampleRate:t,channels:r,depth:or}),kt=r},yuvData:function(t,r){if(si.isDestroyed)return void si.debugLog("worker","yuvData, decoder is destroyed and return");const i=h*f*3/2;let n=e.HEAPU8.subarray(t,t+i),s=new Uint8Array(n);if(ut=null,Ee=r,si.useOffscreen())try{if(Wt)return;si.webglObj.renderYUV(h,f,s);let e=si.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:e,delay:si.delay,ts:r},[e])}catch(e){si.debugError("worker","yuvData, transferToImageBitmap error is",e,e.toString())}else postMessage({cmd:C,output:s,delay:si.delay,ts:r},[s.buffer])},pcmData:function(e,r,i){if(si.isDestroyed)return void si.debugLog("worker","pcmData, decoder is destroyed and return");let s=r,o=[],a=0,d=si._opt.audioBufferSize;for(let r=0;r<2;r++){let i=t.HEAPU32[(e>>2)+r]>>2;o[r]=t.HEAPF32.subarray(i,i+s)}if(Ut){if(!(s>=(r=d-Ut)))return Ut+=s,n[0]=Float32Array.of(...n[0],...o[0]),void(2==kt&&(n[1]=Float32Array.of(...n[1],...o[1])));it[0]=Float32Array.of(...n[0],...o[0].subarray(0,r)),2==kt&&(it[1]=Float32Array.of(...n[1],...o[1].subarray(0,r))),postMessage({cmd:D,buffer:it,ts:i},it.map((e=>e.buffer))),a=r,s-=r}for(Ut=s;Ut>=d;Ut-=d)it[0]=o[0].slice(a,a+=d),2==kt&&(it[1]=o[1].slice(a-d,a)),postMessage({cmd:D,buffer:it,ts:i},it.map((e=>e.buffer)));Ut&&(n[0]=o[0].slice(a),2==kt&&(n[1]=o[1].slice(a))),o=[]},errorInfo:function(e){null===ut&&(ut=nr());const t=nr(),r=sr(At>0?2*At:5e3,1e3,5e3),i=t-ut;i>r&&(si.debugWarn("worker",`errorInfo() emit simdDecodeError and\n iframeIntervalTimestamp is ${At} and diff is ${i} and maxDiff is ${r}\n and replay`),Xt=!0,postMessage({cmd:q}))},sendWebsocketMessage:function(e){a?a.readyState===Le?a.send(e):si.debugError("worker","socket is not open"):si.debugError("worker","socket is null")},timeEnd:function(){si.debugError("worker","Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),si.close(),postMessage({cmd:W})},postStreamToMain(e,t){postMessage({cmd:X,type:t,buffer:e},[e.buffer])},updatePlaybackIsPause(e){si.debugLog("worker",`updatePlaybackIsPause, isPause is ${e}`),yr(e)?si.clearPlaybackCacheLoop():si.startPlaybackCacheLoop()},debugLog(e){if(si._opt.debug&&si.debug){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?i-1:0),r=1;r1?i-1:0),r=1;r1?s-1:0),o=1;o32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let i=e-this._current_word_bits_left;this._fillCurrentWord();let s=Math.min(i,this._current_word_bits_left),r=this._current_word>>>32-s;return this._current_word<<=s,this._current_word_bits_left-=s,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Dr=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],xr=Dr,Rr=Dr;function Pr(e){let{profile:t,sampleRate:i,channel:s}=e;return new Uint8Array([175,0,t<<3|(14&i)>>1,(1&i)<<7|s<<3])}function Br(e){return Ir(e)&&e[1]===ys}function Ir(e){return e[0]>>4===_t}function Mr(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}function Fr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return 1024*t/e}const Ur=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Or(e){let t=new Uint8Array(e),i=null,s=0,r=0,o=0,a=null;if(s=r=t[0]>>>3,o=(7&t[0])<<1|t[1]>>>7,o<0||o>=Ur.length)return void console.error("Flv: AAC invalid sampling frequency index!");let n=Ur[o],l=(120&t[1])>>>3;if(l<0||l>=8)return void console.log("Flv: AAC invalid channel configuration");5===s&&(a=(7&t[1])<<1|t[2]>>>7,t[2]);let d=self.navigator.userAgent.toLowerCase();return-1!==d.indexOf("firefox")?o>=6?(s=5,i=new Array(4),a=o-3):(s=2,i=new Array(2),a=o):-1!==d.indexOf("android")?(s=2,i=new Array(2),a=o):(s=5,a=o,i=new Array(4),o>=6?a=o-3:1===l&&(s=2,i=new Array(2),a=o)),i[0]=s<<3,i[0]|=(15&o)>>>1,i[1]=(15&o)<<7,i[1]|=(15&l)<<3,5===s&&(i[1]|=(15&a)>>>1,i[2]=(1&a)<<7,i[2]|=8,i[3]=0),{audioType:"aac",config:i,sampleRate:n,channelCount:l,objectType:s,codec:"mp4a.40."+s,originalCodec:"mp4a.40."+r}}class Nr{constructor(e){this.buffer=e,this.buflen=e.length,this.bufpos=0,this.bufoff=0,this.iserro=!1}read(e){let t=0,i=0;for(;e;){if(e<0||this.bufpos>=this.buflen)return this.iserro=!0,0;this.iserro=!1,i=this.bufoff+e>8?8-this.bufoff:e,t<<=i,t+=this.buffer[this.bufpos]>>8-this.bufoff-i&255>>8-i,this.bufoff+=i,e-=i,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,i=this.bufoff,s=this.read(e);return this.bufpos=t,this.bufoff=i,s}read_golomb(){let e;for(e=0;0==this.read(1)&&!this.iserro;e++);return(1<=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(4095===(i[t+0]<<8|i[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let i=this.current_syncword_offset_,s=(8&e[i+1])>>>3,r=(6&e[i+1])>>>1,o=1&e[i+1],a=(192&e[i+2])>>>6,n=(60&e[i+2])>>>2,l=(1&e[i+2])<<2|(192&e[i+3])>>>6,d=(3&e[i+3])<<11|e[i+4]<<3|(224&e[i+5])>>>5;if(e[i+6],i+d>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let h=1===o?7:9,c=d-h;i+=h;let u=this.findNextSyncwordOffset(i+c);if(this.current_syncword_offset_=u,0!==s&&1!==s||0!==r)continue;let p=e.subarray(i,i+c);t={},t.audio_object_type=a+1,t.sampling_freq_index=n,t.sampling_frequency=xr[n],t.channel_config=l,t.data=p}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Hr{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,i=this.data_;for(;;){if(t+1>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(695===(i[t+0]<<3|i[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),i=0;for(let s=0;s<=t;s++)i<<=8,i|=e.readByte();return i}readNextAACFrame(e){let t=this.data_,i=null;for(;null==i&&!this.eof_flag_;){let s=this.current_syncword_offset_,r=(31&t[s+1])<<8|t[s+2];if(s+3+r>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let o=new Cr(t.subarray(s+3,s+3+r)),a=null;if(o.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(s+3+r),o.destroy();continue}a=e}else{let e=o.readBool();if(e&&o.readBool()){console.error("audioMuxVersionA is Not Supported"),o.destroy();break}if(e&&this.getLATMValue(o),!o.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),o.destroy();break}if(0!==o.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),o.destroy();break}if(0!==o.readBits(4)){console.error("more than 2 numProgram Not Supported"),o.destroy();break}if(0!==o.readBits(3)){console.error("more than 2 numLayer Not Supported"),o.destroy();break}let t=e?this.getLATMValue(o):0,i=o.readBits(5);t-=5;let s=o.readBits(4);t-=4;let r=o.readBits(4);t-=4,o.readBits(3),t-=3,t>0&&o.readBits(t);let n=o.readBits(3);if(0!==n){console.error(`frameLengthType = ${n}. Only frameLengthType = 0 Supported`),o.destroy();break}o.readByte();let l=o.readBool();if(l)if(e)this.getLATMValue(o);else{let e=0;for(;;){e<<=8;let t=o.readBool();if(e+=o.readByte(),!t)break}console.log(e)}o.readBool()&&o.readByte(),a={},a.audio_object_type=i,a.sampling_freq_index=s,a.sampling_frequency=xr[a.sampling_freq_index],a.channel_config=r,a.other_data_present=l}let n=0;for(;;){let e=o.readByte();if(n+=e,255!==e)break}let l=new Uint8Array(n);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function Jr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return;const i=e.length,s=[];let r,o=0;for(;o+t>>=8),o+=t,r){if(o+r>i)break;s.push(e.subarray(o,o+r)),o+=r}return s}function qr(e){const t=e.byteLength,i=new Uint8Array(4);i[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t;const s=new Uint8Array(t+4);return s.set(i,0),s.set(e,4),s}function Kr(){}function Yr(e){let t=null;const i=["webgl","experimental-webgl","moz-webgl","webkit-3d"];let s=0;for(;!t&&s0&&void 0!==arguments[0]?arguments[0]:"";const t=e.split(","),i=atob(t[1]),s=t[0].replace("data:","").replace(";base64","");let r=i.length,o=new Uint8Array(r);for(;r--;)o[r]=i.charCodeAt(r);return new File([o],"file",{type:s})}function Zr(){return(new Date).getTime()}function eo(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}function to(e,t,i){if(e)return"object"==typeof t&&Object.keys(t).forEach((i=>{to(e,i,t[i])})),e.style[t]=i,e}function io(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return 0;const s=getComputedStyle(e,null).getPropertyValue(t);return i?parseFloat(s):s}function so(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function ro(e){let t=0,i=so();return s=>{if(!_o(s))return;t+=s;const r=so(),o=r-i;o>=1e3&&(e(t/o*1e3),i=r,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();const oo='"8-13-2024"',ao=!1;function no(){return/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase())}function lo(){return!(no()||/ipad|android(?!.*mobile)|tablet|kindle|silk/i.test(window.navigator.userAgent.toLowerCase()))}function ho(){const e=window.navigator.userAgent.toLowerCase();return/android/i.test(e)}function co(){const e=window.navigator.userAgent.toLowerCase();return/firefox/i.test(e)}function uo(){const e=window.navigator.userAgent.toLowerCase()||"",t={type:"",version:""},i={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:e.indexOf("chrome")>-1&&e.indexOf("safari")>-1,Firefox:e.indexOf("firefox")>-1,Opera:e.indexOf("opera")>-1,Safari:e.indexOf("safari")>-1&&-1==e.indexOf("chrome"),Edge:e.indexOf("edge")>-1,QQBrowser:/qqbrowser/.test(e),WeixinBrowser:/MicroMessenger/i.test(e)};for(let s in i)if(i[s]){let i="";if("IE"===s){const t=e.match(/(msie\s|trident.*rv:)([\w.]+)/);t&&t.length>2&&(i=e.match(/(msie\s|trident.*rv:)([\w.]+)/)[2])}else if("Chrome"===s){for(let e in navigator.mimeTypes)"application/360softmgrplugin"===navigator.mimeTypes[e].type&&(s="360");const t=e.match(/chrome\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Firefox"===s){const t=e.match(/firefox\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Opera"===s){const t=e.match(/opera\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Safari"===s){const t=e.match(/version\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Edge"===s){const t=e.match(/edge\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("QQBrowser"===s){const t=e.match(/qqbrowser\/([\d.]+)/);t&&t.length>1&&(i=t[1])}t.type=s,t.version=parseInt(i)}return t}function po(){const e=window.navigator.userAgent.toLowerCase();return e&&/iphone|ipad|ipod|ios/.test(e)}function fo(){const e=window.navigator.userAgent;return!e.match(/Chrome/gi)&&!!e.match(/Safari/gi)}function mo(e,t){if(0===arguments.length)return null;var i,s=t||"{y}-{m}-{d} {h}:{i}:{s}";"object"==typeof e?i=e:(10===(""+e).length&&(e=1e3*parseInt(e)),e=+e,i=new Date(e));var r={y:i.getFullYear(),m:i.getMonth()+1,d:i.getDate(),h:i.getHours(),i:i.getMinutes(),s:i.getSeconds(),a:i.getDay()},o=s.replace(/{(y|m|d|h|i|s|a)+}/g,((e,t)=>{var i=r[t];return"a"===t?["一","二","三","四","五","六","日"][i-1]:(e.length>0&&i<10&&(i="0"+i),i||0)}));return o}function go(){return"VideoFrame"in window}function yo(e){if("string"!=typeof e)return e;var t=Number(e);return isNaN(t)?e:t}function Ao(){return"xxxxxxxxxxxx4xxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}function bo(e,t){let i,s,r=!1;return function o(){for(var a=arguments.length,n=new Array(a),l=0;l{r=!1,i&&(o.apply(s,i),i=null,s=null)}),t)}}function vo(e){if(null==e||""==e)return"0 Bytes";const t=new Array("Bytes","KB","MB","GB","TB","PB","EB","ZB","YB");let i=0;const s=parseFloat(e);i=Math.floor(Math.log(s)/Math.log(1024));var r=s/Math.pow(1024,i);return(r=r.toFixed(2))+t[i]}function _o(e){return"[object Number]"===Object.prototype.toString.call(e)}function So(){let e=!1;return"MediaSource"in self&&(self.MediaSource.isTypeSupported(ui)||self.MediaSource.isTypeSupported(pi)||self.MediaSource.isTypeSupported(fi)||self.MediaSource.isTypeSupported(mi)||self.MediaSource.isTypeSupported(gi))&&(e=!0),e}function Eo(){const e=uo();return"chrome"===e.type.toLowerCase()&&e.version>=107}function wo(){let e=!1;return"MediaStreamTrackGenerator"in window&&(e=!0),e}function To(){let e=!1;return"MediaStream"in window&&(e=!0),e}function ko(e,t){let i=window.URL.createObjectURL(t),s=window.document.createElement("a");s.download=e,s.href=i;let r=window.document.createEvent("MouseEvents");r.initEvent("click",!0,!0),s.dispatchEvent(r),setTimeout((()=>{window.URL.revokeObjectURL(i)}),po()?1e3:0)}function Lo(e){return null==e}function Co(e){return!0===e||!1===e}function Do(e){return!Lo(e)}function xo(e){let t={left:"",right:"",top:"",bottom:"",opacity:1,backgroundColor:"",image:{src:"",width:"100",height:"60"},text:{content:"",fontSize:"14",color:"#000",width:"",height:""},rect:{color:"green",lineWidth:2,width:"",height:"",fill:"",fillOpacity:.2},line:{x1:"",y1:"",x2:"",y2:"",color:"green",lineWidth:2},polygon:{color:"green",lineWidth:2,list:[],fill:"",fillOpacity:.2},html:""};const i=Object.assign(t.image,e.image||{}),s=Object.assign(t.text,e.text||{}),r=Object.assign(t.rect,e.rect||{}),o=Object.assign(t.line,e.line||{});return t=Object.assign(t,e,{image:i,text:s,rect:r,line:o}),t}function Ro(e,t){let i={container:e||"",text:"",opacity:"",angle:"",color:"",fontSize:"",fontFamily:""};return i=Object.assign(i,t),{watermark_parent_node:i.container,watermark_alpha:i.opacity,watermark_angle:i.angle,watermark_fontsize:i.fontSize,watermark_color:i.color,watermark_font:i.fontFamily,watermark_txt:i.text}}function Po(e,t){return new Promise(((i,s)=>{let r=xo(t);if(!r.image.src&&!r.text.content)return i(e);let o=document.createElement("canvas");o.width=t.width,o.height=t.height;let a=o.getContext("2d");a.imageSmoothingEnabled=!0,a.imageSmoothingEnabled&&(a.imageSmoothingQuality="high");let n=0,l=0;_o(r.left)?n=r.left:_o(r.right)&&(n=o.width-r.right),_o(r.top)?l=r.top:_o(r.bottom)&&(l=o.height-r.bottom);const d=new Image;d.src=e,d.onload=()=>{if(a.drawImage(d,0,0),r.image&&r.image.src){const e=new Image;e.src=r.image.src,e.setAttribute("crossOrigin","Anonymous"),e.onload=()=>{n-=r.image.width,a.drawImage(e,n,l,r.image.width,r.image.height),i(o.toDataURL(t.format,t.quality))},e.onerror=e=>{s()}}else r.text&&r.text.content&&(a.font=r.text.fontSize+"px 宋体",a.fillStyle=r.text.color,a.textAlign="right",a.fillText(r.text.content,n,l),i(o.toDataURL(t.format,t.quality)))},d.onerror=e=>{s(e)}}))}function Bo(e){var t,i=0;if(0===e.length)return i;for(t=0;t{if(!t.copyright)return i(e);let r=document.createElement("canvas");r.width=t.width,r.height=t.height;let o=r.getContext("2d");o.imageSmoothingEnabled=!0,o.imageSmoothingEnabled&&(o.imageSmoothingQuality="high");const a=new Image;a.src=e,a.onload=()=>{o.drawImage(a,0,0);const e=Bo(t.copyright),s=o.getImageData(0,0,r.width,r.height);!function(e,t){for(var i=e.data,s=0,r=0;r<32;r++){var o=t>>r&1,a=254&i[s]|o;i[s]=a,s+=4}}(s,e),o.putImageData(s,0,0),i(r.toDataURL(t.format,t.quality))},a.onerror=e=>{s(e)}}))}function Mo(e){var t;if(e>-1){var i=Math.floor(e/3600),s=Math.floor(e/60)%60,r=e%60;t=i<10?"0"+i+":":i+":",s<10&&(t+="0"),t+=s+":",(r=Math.round(r))<10&&(t+="0"),t+=r.toFixed(0)}return t}function Fo(e,t){let i="";if(e>-1){const s=Math.floor(e/60)%60;let r=e%60;r=Math.round(r),i=s<10?"0"+s+":":s+":",r<10&&(i+="0"),i+=r,Lo(t)||(t<10&&(t="0"+t),i+=":"+t)}return i}function Uo(e){let t="";if(e>-1){const i=Math.floor(e/60/60)%60;let s=Math.floor(e/60)%60,r=e%60;s=Math.round(s),t=i<10?"0"+i+":":i+":",s<10&&(t+="0"),t+=s+":",r<10&&(t+="0"),t+=r}return t}function Oo(e,t){const i=Math.floor(t/60)%60,s=Math.floor(t%60);return new Date(e).setHours(i,s,0,0)}function No(e,t){const i=Math.floor(t/60/60)%60,s=Math.floor(t/60)%60,r=t%60;return new Date(e).setHours(i,s,r,0)}function jo(e){return(""+e).length}function Go(e){return e&&0===Object.keys(e).length}function zo(e){return!Go(e)}function Wo(e){return"string"==typeof e}const Vo=()=>{const e=window.navigator.userAgent;return/MicroMessenger/i.test(e)},Ho=()=>{const e=window.navigator.userAgent;return/Chrome/i.test(e)};function $o(e){const t=e||window.event;return t.target||t.srcElement}function Jo(){return co()&&function(){const e=navigator.userAgent.toLowerCase();return/macintosh|mac os x/i.test(e)}()}function qo(e){return"function"==typeof e}function Ko(e){if(no()){let t=0,i=0;if(1===e.touches.length){let s=e.touches[0];t=s.clientX,i=s.clientY}return{posX:t,posY:i}}let t=0,i=0;const s=e||window.event;return s.pageX||s.pageY?(t=s.pageX,i=s.pageY):(s.clientX||s.clientY)&&(t=e.clientX+document.documentElement.scrollLeft+document.body.scrollLeft,i=e.clientY+document.documentElement.scrollTop+document.body.scrollTop),{posX:t,posY:i}}function Yo(){let e=document.createElement("video"),t=e.canPlayType("application/vnd.apple.mpegurl");return e=null,t}function Qo(e){let t=ua(e.hasAudio)&&(e.useMSE||e.useWCS&&!e.useOffscreen)&&ua(e.demuxUseWorker);return!!(ua(t)&&e.useMSE&&e.mseDecodeAudio&&ua(e.demuxUseWorker))||(!!(ua(t)&&e.useWCS&&e.wcsDecodeAudio)||t)}function Xo(e){let t=null,i=31&e[0];return i!==kt&&i!==Lt||(t=bt),t||(i=(126&e[0])>>1,i!==Gt&&i!==Wt&&i!==Ht||(t=vt)),t}function Zo(e){e.close()}function ea(e){e.close()}function ta(){return"https:"===window.location.protocol||"localhost"===window.location.hostname}function ia(e){const t=Object.prototype.toString;return function(e){switch(t.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:try{return e instanceof Error}catch(e){return!1}}}(e)?e.message:null==e?"":"object"==typeof e?JSON.stringify(e,null,2):String(e)}function sa(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let i=e[0],s=null,r=1;if(e.length>0){let t=e[1];t&&t.ts-i.ts>1e5&&(i=t,r=2)}if(i)for(let o=r;o=1e3){e[o-1].ts-i.ts<1e3&&(s=o+1)}}}return s}function ra(e){for(var t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),i=window.atob(t),s=new Uint8Array(i.length),r=0;r>4===As&&e[1]===ys}function ca(e){return!0===e||"true"===e}function ua(e){return!0!==e&&"true"!==e}function pa(e){return e.replace(/-([a-z])/g,(function(e,t){return t.toUpperCase()}))}function fa(){return/iphone/i.test(navigator.userAgent)}function ma(){return window.performance&&window.performance.memory?window.performance.memory:null}function ga(){try{var e=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!e.getContext("webgl2"))}catch(e){return!1}}function ya(e){return e.trim().match(/^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/)[1]}function Aa(){let e=!1;return"requestVideoFrameCallback"in HTMLVideoElement.prototype&&(e=!0),e}function ba(){let e=!1;return"PressureObserver"in window&&(e=!0),e}function va(e,t){const i=Jr(e.slice(5));let s=!1;return i.forEach((e=>{const i=t?e[0]>>>1&63:31&e[0];(t&&(i===Mt||i===Ut||i===Nt)||ua(t)&&i===Ct)&&(s=!0)})),s}function _a(){let e={down:"mousedown",move:"mousemove",up:"mouseup",click:"click"};return no()&&(e={down:"touchstart",move:"touchmove",up:"touchend",click:"click"}),e}class Sa{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,i,s)));e.addEventListener(t,i,s);const r=()=>{qo(e.removeEventListener)&&e.removeEventListener(t,i,s)};return this.destroys.push(r),r}destroy(){this.master.debugLog("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class Ea{on(e,t,i){const s=this.e||(this.e={});return(s[e]||(s[e]=[])).push({fn:t,ctx:i}),this}once(e,t,i){const s=this;function r(){s.off(e,r);for(var o=arguments.length,a=new Array(o),n=0;n1?i-1:0),r=1;r{delete i[e]})),void delete this.e;const s=i[e],r=[];if(s&&t)for(let e=0,i=s.length;e0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=this.gl.createProgram();return this.gl.attachShader(i,e),this.gl.attachShader(i,t),this.gl.linkProgram(i),this.gl.getProgramParameter(i,this.gl.LINK_STATUS)?i:(console.log("Unable to initialize the shader program: "+this.gl.getProgramInfoLog(i)),null)}_loadShader(e,t){const i=this.gl,s=i.createShader(e);return i.shaderSource(s,t),i.compileShader(s),i.getShaderParameter(s,i.COMPILE_STATUS)?s:(console.log("An error occurred compiling the shaders: "+i.getShaderInfoLog(s)),i.deleteShader(s),null)}_initBuffers(){const e=this.gl,t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);const i=[-1,-1,1,-1,1,1,-1,1];e.bufferData(e.ARRAY_BUFFER,new Float32Array(i),e.STATIC_DRAW);var s=[];s=s.concat([0,1],[1,1],[1,0],[0,0]);const r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array(s),e.STATIC_DRAW);const o=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{positions:i,position:t,texPosition:r,indices:o}}_createTexture(){let e=this.gl.createTexture();return this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),e}_drawScene(e,t,i){this.gl.viewport(0,0,e,t),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._buffers.position),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array(this._buffers.positions),this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this._programInfo.attribLocations.vertexPosition,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this._programInfo.attribLocations.vertexPosition),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._buffers.texPosition),this.gl.vertexAttribPointer(this._programInfo.attribLocations.texturePosition,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this._programInfo.attribLocations.texturePosition),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this._buffers.indices);i?(this.gl.activeTexture(this.gl.TEXTURE0+3),this.gl.bindTexture(this.gl.TEXTURE_2D,this._ytexture),this.gl.activeTexture(this.gl.TEXTURE0+4),this.gl.bindTexture(this.gl.TEXTURE_2D,this._utexture),this.gl.activeTexture(this.gl.TEXTURE0+5),this.gl.bindTexture(this.gl.TEXTURE_2D,this._vtexture)):(this.gl.activeTexture(this.gl.TEXTURE0+2),this.gl.bindTexture(this.gl.TEXTURE_2D,this._rgbatexture)),this.gl.useProgram(this._programInfo.program),this.gl.uniform1i(this._programInfo.uniformLocations.rgbatexture,2),this.gl.uniform1i(this._programInfo.uniformLocations.ytexture,3),this.gl.uniform1i(this._programInfo.uniformLocations.utexture,4),this.gl.uniform1i(this._programInfo.uniformLocations.vtexture,5),this.gl.uniform1i(this._programInfo.uniformLocations.isyuv,i?1:0),this.gl.drawElements(this.gl.TRIANGLES,6,this.gl.UNSIGNED_SHORT,0)}_calRect(e,t,i,s,r,o){let a=2*e/r-1,n=2*(o-t-s)/o-1,l=2*(e+i)/r-1,d=2*(o-t)/o-1;return[a,n,l,n,l,d,a,d]}_clear(){this.gl.clearColor(0,0,0,1),this.gl.clearDepth(1),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}render(e,t,i,s,r){const o=this.gl;this._clear(),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,this._ytexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e,t,0,o.LUMINANCE,o.UNSIGNED_BYTE,i),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,this._utexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e/2,t/2,0,o.LUMINANCE,o.UNSIGNED_BYTE,s),o.activeTexture(o.TEXTURE2),o.bindTexture(o.TEXTURE_2D,this._vtexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e/2,t/2,0,o.LUMINANCE,o.UNSIGNED_BYTE,r),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}renderYUV(e,t,i){let s=i.slice(0,e*t),r=i.slice(e*t,e*t*5/4),o=i.slice(e*t*5/4,e*t*3/2);const a=this.gl;this._clear(),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this._ytexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e,t,0,a.LUMINANCE,a.UNSIGNED_BYTE,s),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,this._utexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,r),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,this._vtexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,o),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}drawDom(e,t,i,s,r){const o=this.gl;o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,this._rgbatexture),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,r),this._buffers.positions=this._calRect(i,s,r.width,r.height,e,t),this._drawScene(e,t,!1)}}const Pa=1,Ba=2,Ia=4;class Ma{constructor(e){this.gpu=e,this.pipeline=null,this.matrixGroupInfo=null,this.depthTexture=null,this.textureGroupInfo=null,this.hasInited=!1,this.buffers=this._initBuffer(),this.isDestroyed=!1,this._initPipeline().then((e=>{this.isDestroyed||(this.pipeline=e,this.matrixGroupInfo=this._initMatrixGroupInfo(),this.matrixGroupInfo&&(this.hasInited=!0))}))}destroy(){this.isDestroyed=!1,this.gpu&&(this.gpu.device.destroy(),this.gpu=null),this.hasInited=!1,this.pipeline=null,this.matrixGroupInfo=null,this.depthTexture=null,this.textureGroupInfo=null}_initBuffer(){const e=this.gpu.device,t=new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),i=e.createBuffer({size:t.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST});e.queue.writeBuffer(i,0,t);const s=new Float32Array([0,1,1,1,1,0,0,0]),r=e.createBuffer({size:s.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST});e.queue.writeBuffer(r,0,s);const o=new Uint16Array([0,1,2,0,2,3]),a=e.createBuffer({size:o.byteLength,usage:window.GPUBufferUsage.INDEX|window.GPUBufferUsage.COPY_DST});return e.queue.writeBuffer(a,0,o),{positionBuffer:i,texpositionBuffer:r,indexBuffer:a}}_initPipeline(){return new Promise(((e,t)=>{const i=this.gpu.device,s=this.gpu.format,r={layout:"auto",vertex:{module:i.createShaderModule({code:"\n\n @binding(0) @group(0) var uModelMatrix : mat4x4;\n @binding(1) @group(0) var uViewMatrix : mat4x4;\n @binding(2) @group(0) var uProjectionMatrix : mat4x4;\n\n struct VertexOutput {\n @builtin(position) Position : vec4,\n @location(0) vTexturePosition : vec2,\n }\n\n @vertex\n fn main(\n @location(0) aVertexPosition : vec4,\n @location(1) aTexturePosition : vec2\n ) -> VertexOutput {\n var output : VertexOutput;\n var tmppos : vec4 = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n output.Position = vec4(tmppos.x, tmppos.y, (tmppos.z+1.)/2., tmppos.w); // webgl z [-1, 1], webgpu z [0, 1], 这里z做下调整 z-webgpu = (z-webgl+1)/2\n output.vTexturePosition = aTexturePosition;\n return output;\n }\n\n "}),entryPoint:"main",buffers:[{arrayStride:12,attributes:[{shaderLocation:0,offset:0,format:"float32x3"}]},{arrayStride:8,attributes:[{shaderLocation:1,offset:0,format:"float32x2"}]}]},primitive:{topology:"triangle-list"},fragment:{module:i.createShaderModule({code:"\n @group(1) @binding(0) var mySampler: sampler;\n @group(1) @binding(1) var pixelType: i32;\n @group(1) @binding(2) var yTexture: texture_2d;\n @group(1) @binding(3) var uTexture: texture_2d;\n @group(1) @binding(4) var vTexture: texture_2d;\n @group(1) @binding(5) var uvTexture: texture_2d;\n @group(1) @binding(6) var rgbaTexture: texture_2d;\n\n const YUV2RGB : mat4x4 = mat4x4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n @fragment\n fn main(\n @location(0) vTexturePosition: vec2\n ) -> @location(0) vec4 {\n if(pixelType == 1){\n var y : f32= textureSample(yTexture, mySampler, vTexturePosition).r;\n var u : f32 = textureSample(uTexture, mySampler, vTexturePosition).r;\n var v : f32 = textureSample(vTexture, mySampler, vTexturePosition).r;\n\n return vec4(y, u, v, 1.0)*YUV2RGB;\n } else if (pixelType == 2) {\n\n var y : f32= textureSample(yTexture, mySampler, vTexturePosition).r;\n var u : f32 = textureSample(uvTexture, mySampler, vTexturePosition).r;\n var v : f32 = textureSample(uvTexture, mySampler, vTexturePosition).g;\n\n return vec4(y, u, v, 1.0)*YUV2RGB;\n } else {\n\n return textureSample(rgbaTexture, mySampler, vTexturePosition);\n }\n\n }\n\n "}),entryPoint:"main",targets:[{format:s}]},depthStencil:{depthWriteEnabled:!0,depthCompare:"less",format:"depth24plus"}};i.createRenderPipelineAsync(r).then((t=>{e(t)})).catch((e=>{t(e)}))}))}_initMatrixGroupInfo(){if(!this.gpu)return null;const e=this.gpu.device,t=this.pipeline,i=ka();Da(i,-1,1,-1,1,.1,100);const s=ka();La(s);const r=ka();!function(e,t,i,s){var r,o,a,n,l,d,h,c,u,p,f=t[0],m=t[1],g=t[2],y=s[0],A=s[1],b=s[2],v=i[0],_=i[1],S=i[2];Math.abs(f-v)xo(e)));this.configList=i,this._updateDom()}_resizeDomForVideo(){const e=this.player.width,t=this.player.height,i=this.player.getVideoInfo();if(!(i&&i.height>0&&i.width>0))return;let s=i.width,r=i.height;const o=this.player._opt;let a=t,n=e;if(this.player.isControlBarShow()){const e=o.playType===_?Qt:Yt;no()&&this.player.fullscreen&&o.useWebFullScreen?n-=e:a-=e}const l=o.rotate;let d=(n-s)/2,h=(a-r)/2;270!==l&&90!==l||(s=i.height,r=i.width);const c=n/s,u=a/r;let p=c>u?u:c;o.isResize||c!==u&&(p=c+","+u),o.isFullResize&&(p=c>u?c:u);let f="scale("+p+")";"none"===o.mirrorRotate&&l&&(f+=" rotate("+l+"deg)"),"level"===o.mirrorRotate?f+=" rotateY(180deg)":"vertical"===o.mirrorRotate&&(f+=" rotateX(180deg)"),this.scale=-1!==(""+p).indexOf(",")?c:p,this.shadowRootInnerDom.style.transform=f,this.shadowRootInnerDom.style.left=d+"px",this.shadowRootInnerDom.style.top=h+"px",this.shadowRootInnerDom.style.width=i.width+"px",this.shadowRootInnerDom.style.height=i.height+"px",this.shadowRootInnerDom.style.display="block"}_resizeDomForCanvas(){const e=this.player.getVideoInfo();if(!(e&&e.height>0&&e.width>0))return;const t=this.player._opt;let i=this.player.width,s=this.player.height;if(this.player.isControlBarShow()){const e=t.playType===_?Qt:Yt;no()&&this.player.fullscreen&&t.useWebFullScreen?i-=e:s-=e}let r=e.width,o=e.height;const a=t.rotate;let n=(i-r)/2,l=(s-o)/2;270!==a&&90!==a||(r=e.height,o=e.width);const d=i/r,h=s/o;let c=d>h?h:d;t.isResize||d!==h&&(c=d+","+h),t.isFullResize&&(c=d>h?d:h);let u="scale("+c+")";"none"===t.mirrorRotate&&a&&(u+=" rotate("+a+"deg)"),"level"===t.mirrorRotate?u+=" rotateY(180deg)":"vertical"===t.mirrorRotate&&(u+=" rotateX(180deg)"),this.shadowRootInnerDom.style.height=e.height+"px",this.shadowRootInnerDom.style.width=e.width+"px",this.shadowRootInnerDom.style.padding="0",this.shadowRootInnerDom.style.transform=u,this.shadowRootInnerDom.style.left=n+"px",this.shadowRootInnerDom.style.top=l+"px",this.shadowRootInnerDom.style.display="block"}_resizeDomRatio(){const e=this.player.getVideoInfo();if(!(e&&e.height>0&&e.width>0))return;const t=this.player._opt.aspectRatio.split(":").map(Number);let i=this.player.width,s=this.player.height;const r=this.player._opt;let o=0;this.player.isControlBarShow()&&(o=r.playType===_?Qt:Yt,s-=o);const a=e.width/e.height,n=t[0]/t[1];if(a>n){const t=n*e.height/e.width;this.shadowRootInnerDom.style.width=100*t+"%",this.shadowRootInnerDom.style.height=`calc(100% - ${o}px)`,this.shadowRootInnerDom.style.padding=`0 ${(i-i*t)/2}px`}else{const t=e.width/n/e.height;this.shadowRootInnerDom.style.width="100%",this.shadowRootInnerDom.style.height=`calc(${100*t}% - ${o}px)`,this.shadowRootInnerDom.style.padding=(s-s*t)/2+"px 0"}this.shadowRootInnerDom.style.display="block"}_updateDom(){this.shadowRoot&&this.configList.forEach((e=>{const t=document.createElement("div");let i=null;if(e.image&&e.image.src?(i=document.createElement("img"),i.style.height="100%",i.style.width="100%",i.style.objectFit="contain",i.src=e.image.src):e.text&&e.text.content?i=document.createTextNode(e.text.content):(e.rect&&e.rect.color&&e.rect.width||e.html||e.line&&e.line.x1&&e.line.y1&&e.line.x2&&e.line.y2||e.polygon&&e.polygon.list&&e.polygon.list.length>=3)&&(i=document.createElement("div")),i){if(t.appendChild(i),t.style.visibility="",t.style.position="absolute",t.style.display="block",t.style["-ms-user-select"]="none",t.style["-moz-user-select"]="none",t.style["-webkit-user-select"]="none",t.style["-o-user-select"]="none",t.style["user-select"]="none",t.style["-webkit-touch-callout"]="none",t.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",t.style["-webkit-text-size-adjust"]="none",t.style["-webkit-touch-callout"]="none",t.style.opacity=e.opacity,Do(e.left)&&(_o(e.left)?t.style.left=e.left+"px":t.style.left=e.left),Do(e.right)&&(_o(e.right)?t.style.right=e.right+"px":t.style.right=e.right),Do(e.top)&&(_o(e.top)?t.style.top=e.top+"px":t.style.top=e.top),Do(e.bottom)&&(_o(e.bottom)?t.style.bottom=e.bottom+"px":t.style.bottom=e.bottom),e.backgroundColor&&(t.style.backgroundColor=e.backgroundColor),t.style.overflow="hidden",t.style.zIndex="9999999",e.image&&e.image.src)t.style.width=e.image.width+"px",t.style.height=e.image.height+"px";else if(e.text&&e.text.content)t.style.fontSize=e.text.fontSize+"px",t.style.color=e.text.color,e.text.width&&(t.style.width=e.text.width+"px"),e.text.height&&(t.style.height=e.text.height+"px");else if(e.rect&&e.rect.color&&e.rect.width){if(t.style.width=e.rect.width+"px",t.style.height=e.rect.height+"px",t.style.borderWidth=e.rect.lineWidth+"px",t.style.borderStyle="solid",t.style.borderColor=e.rect.color,e.rect.fill){const i=document.createElement("div");i.style.position="absolute",i.style.width="100%",i.style.height="100%",i.style.backgroundColor=e.rect.fill,e.rect.fillOpacity&&(i.style.opacity=e.rect.fillOpacity),t.appendChild(i)}}else if(e.html)t.style.width="100%",t.style.height="100%",t.innerHTML=e.html;else if(e.line&&e.line.x1&&e.line.y1&&e.line.x2&&e.line.y2)this.settingLine(t,e.line);else if(e.polygon&&e.polygon.list&&e.polygon.list.length>=3){t.style.width="100%",t.style.height="100%";let i=e.polygon.list;const s=e.polygon.color,r=e.polygon.lineWidth;if(i=i.sort(((e,t)=>(e.index||0)-(t.index||0))),e.polygon.fill){const s=document.createElement("div");s.style.position="absolute",s.style.width="100%",s.style.height="100%";const r="polygon("+i.map((e=>`${e.x}px ${e.y}px`)).join(", ")+")";s.style.clipPath=r,s.style.backgroundColor=e.polygon.fill,e.polygon.fillOpacity&&(s.style.opacity=e.polygon.fillOpacity),t.appendChild(s)}i.forEach(((e,o)=>{const a=document.createElement("div");if(o===i.length-1){const o=i[0],n={x1:e.x,y1:e.y,x2:o.x,y2:o.y,color:s,lineWidth:r};return this.settingLine(a,n),void t.appendChild(a)}const n=i[o+1],l={x1:e.x,y1:e.y,x2:n.x,y2:n.y,color:s,lineWidth:r};this.settingLine(a,l),t.appendChild(a)}))}this.isDynamic&&(this.shadowRootDynamicDom=t),this.shadowRootInnerDom.appendChild(t)}}))}settingLine(e,t){const i=t.x1,s=t.y1,r=t.x2,o=t.y2;var a=Math.sqrt((i-r)**2+(s-o)**2),n=180*Math.atan2(o-s,r-i)/Math.PI;e.style.backgroundColor=t.color,e.style.width=a+"px",e.style.height=t.lineWidth+"px",e.style.position="absolute",e.style.top=s+"px",e.style.left=i+"px",e.style.transform="rotate("+n+"deg)",e.style.transformOrigin="0 0"}remove(){this._removeDom()}_removeDom(){this.shadowRootInnerDom&&(this.shadowRootInnerDom.innerHTML="")}}class Ua extends Ea{constructor(){super(),this.videoInfo={width:null,height:null,encType:null,encTypeCode:null},this.init=!1,this.prevAiFaceDetectTime=null,this.prevAiObjectDetectTime=null,this.prevOcclusionDetectTime=null,this.contentWatermark=null,this.aiContentWatermark=null,this.tempContentList=[],this.tempAiContentList=[],this.streamFps=0}destroy(){this.resetInit(),this.contentWatermark&&(this.contentWatermark.destroy(),this.contentWatermark=null),this.tempContentList=[],this.aiContentWatermark&&(this.aiContentWatermark.destroy(),this.aiContentWatermark=null),this.tempAiContentList=[],this.prevAiFaceDetectTime=null,this.prevAiObjectDetectTime=null,this.streamFps=0,this.off()}resetInit(){this.videoInfo={width:null,height:null,encType:null,encTypeCode:null},this.init=!1}getHasInit(){return this.init}updateVideoInfo(e){Do(e.encTypeCode)&&(this.videoInfo.encType=gt[e.encTypeCode],this.videoInfo.encTypeCode=e.encTypeCode),Do(e.encType)&&(this.videoInfo.encType=e.encType),Do(e.width)&&(this.videoInfo.width=e.width),Do(e.height)&&(this.videoInfo.height=e.height),Do(this.videoInfo.encType)&&Do(this.videoInfo.height)&&Do(this.videoInfo.width)&&!this.init&&(this.player.emit(ot.videoInfo,this.videoInfo),this.init=!0)}getVideoInfo(){return this.videoInfo}clearView(){this.tempContentList=[],this.tempAiContentList=[]}resize(){if(this.player.debugLog("CommonVideo","resize()"),"default"===this.player._opt.aspectRatio||no()?this._resize():this._resizeRatio(),this.contentWatermark&&this.contentWatermark.resize(),this.aiContentWatermark&&this.aiContentWatermark.resize(),this.player.singleWatermark&&this.player.singleWatermark.resize(),this.player.ghostWatermark&&this.player.ghostWatermark.resize(),this.player.dynamicWatermark&&this.player.dynamicWatermark.resize(),this.player.zoom&&this.player.zooming){const e=this._getStyleScale();this.player.zoom.updatePrevVideoElementStyleScale(e),this.player.zoom.updateVideoElementScale()}}_resizeRatio(){this.player.debugLog("CommonVideo","_resizeRatio()");const e=this.player._opt.aspectRatio.split(":").map(Number);let t=this.player.width,i=this.player.height;const s=this.player._opt;let r=0;this.player.isControlBarShow()&&(r=s.playType===_?Qt:Yt,i-=r);const o=this.videoInfo,a=o.width/o.height,n=e[0]/e[1];if(this.getType()===H&&(this.$videoElement.style.left="0",this.$videoElement.style.top="0",this.$videoElement.style.transform="none"),this.getType()===$&&this.player._opt.videoRenderSupportScale&&(this.$videoElement.style.objectFit="fill"),a>n){const e=n*o.height/o.width;this.$videoElement.style.width=100*e+"%",this.$videoElement.style.height=`calc(100% - ${r}px)`,this.$videoElement.style.padding=`0 ${(t-t*e)/2}px`}else{const e=o.width/n/o.height;this.$videoElement.style.width="100%",this.$videoElement.style.height=`calc(${100*e}% - ${r}px)`,this.$videoElement.style.padding=(i-i*e)/2+"px 0"}}play(){}pause(){}setRate(e){}getType(){return""}getCanvasType(){return""}getCurrentTime(){return 0}getStreamFps(){return this.streamFps}isPlaying(){return!0}isVideoPlaying(){return this.isPlaying()}getPlaybackQuality(){return null}setStreamFps(e){this.player.debugLog("CommonVideo","setStreamFps",e),this.streamFps=e}addContentToCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.tempContentList=e}addAiContentToCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.tempAiContentList=e}doAddContentToWatermark(){if(this.tempContentList.length>0){this.contentWatermark||(this.contentWatermark=new Fa(this.player),this.contentWatermark.resize());const e=[];this.tempContentList.forEach((t=>{let i={left:t.x||0,top:t.y||0};"text"===t.type?i.text={content:t.text,fontSize:t.fontSize||"14",color:t.color||"#000"}:"rect"===t.type?i.rect={width:t.width,height:t.height,color:t.color||"green",lineWidth:t.lineWidth||2,fill:t.fill||"",fillOpacity:t.fillOpacity||.2}:"polygon"===t.type?i.polygon={list:t.list,color:t.color||"green",lineWidth:t.lineWidth||2,fill:t.fill,fillOpacity:t.fillOpacity||.2}:"line"===t.type&&(i.line={color:t.color||"green",lineWidth:t.lineWidth||2,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}),e.push(i)})),this.contentWatermark.update(e)}else this.contentWatermark&&this.contentWatermark.remove()}doAddAiContentToWatermark(){if(this.tempAiContentList.length>0){this.aiContentWatermark||(this.aiContentWatermark=new Fa(this.player),this.aiContentWatermark.resize());const e=this.tempAiContentList.map((e=>{let t={left:e.x,top:e.y};return"text"===e.type?t.text={content:e.text,fontSize:e.fontSize,color:e.color}:"rect"===e.type&&(t.rect={width:e.width,height:e.height,color:e.color,lineWidth:e.lineWidth}),t}));this.aiContentWatermark.update(e)}else this.aiContentWatermark&&this.aiContentWatermark.remove()}_getStyleScale(){let e=this.$videoElement.style.transform.match(/scale\([0-9., ]*\)/g),t="";if(e&&e[0]){t=e[0].replace("scale(","").replace(")","").split(",")}return t}getReadyStateInited(){return!0}screenshotByCurrentWatermark(){}initCanvasViewSize(){}bindMediaStream(){}}var Oa="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0;function Na(e,t,i){var s=new XMLHttpRequest;s.open("GET",e),s.responseType="blob",s.onload=function(){Wa(s.response,t,i)},s.onerror=function(){console.error("could not download file")},s.send()}function ja(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return t.status>=200&&t.status<=299}function Ga(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(i){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var za=Oa.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),Wa="object"!=typeof window||window!==Oa?function(){}:"download"in HTMLAnchorElement.prototype&&!za?function(e,t,i){var s=Oa.URL||Oa.webkitURL,r=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",r.download=t,r.rel="noopener","string"==typeof e?(r.href=e,r.origin!==location.origin?ja(r.href)?Na(e,t,i):Ga(r,r.target="_blank"):Ga(r)):(r.href=s.createObjectURL(e),setTimeout((function(){s.revokeObjectURL(r.href)}),4e4),setTimeout((function(){Ga(r)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download","string"==typeof e)if(ja(e))Na(e,t,i);else{var s=document.createElement("a");s.href=e,s.target="_blank",setTimeout((function(){Ga(s)}))}else navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e}(e,i),t)}:function(e,t,i,s){if((s=s||open("","_blank"))&&(s.document.title=s.document.body.innerText="downloading..."),"string"==typeof e)return Na(e,t,i);var r="application/octet-stream"===e.type,o=/constructor/i.test(Oa.HTMLElement)||Oa.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent);if((a||r&&o||za)&&"undefined"!=typeof FileReader){var n=new FileReader;n.onloadend=function(){var e=n.result;e=a?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),s?s.location.href=e:location=e,s=null},n.readAsDataURL(e)}else{var l=Oa.URL||Oa.webkitURL,d=l.createObjectURL(e);s?s.location=d:location.href=d,s=null,setTimeout((function(){l.revokeObjectURL(d)}),4e4)}};function Va(e){return new Promise(((t,i)=>{navigator.gpu?navigator.gpu.requestAdapter().then((s=>{s?s.requestDevice().then((r=>{if(r){const o=e.getContext("webgpu");if(o){const e=navigator.gpu.getPreferredCanvasFormat();o.configure({device:r,format:e,alphaMode:"opaque"}),t({adapter:s,device:r,context:o,format:e})}else i('WebGPU "context" create fail')}else i('WebGPU "device" request fail')})).catch((e=>{i('WebGPU "adapter.requestDevice()" fail')})):i('WebGPU "adapter" request fail is empty')})).catch((e=>{i('WebGPU "navigator.gpu.requestAdapter()" fail')})):i("WebGPU not support!!")}))}class Ha{constructor(e,t){this.canvas=e,this.gl=t;const i=t.createShader(t.VERTEX_SHADER);if(t.shaderSource(i,"\n attribute vec2 xy;\n varying highp vec2 uv;\n void main(void) {\n gl_Position = vec4(xy, 0.0, 1.0);\n // Map vertex coordinates (-1 to +1) to UV coordinates (0 to 1).\n // UV coordinates are Y-flipped relative to vertex coordinates.\n uv = vec2((1.0 + xy.x) / 2.0, (1.0 - xy.y) / 2.0);\n }\n "),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS))throw t.getShaderInfoLog(i);const s=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(s,"\n varying highp vec2 uv;\n uniform sampler2D texture;\n void main(void) {\n gl_FragColor = texture2D(texture, uv);\n }\n "),t.compileShader(s),!t.getShaderParameter(s,t.COMPILE_STATUS))throw t.getShaderInfoLog(s);const r=t.createProgram();if(t.attachShader(r,i),t.attachShader(r,s),t.linkProgram(r),!t.getProgramParameter(r,t.LINK_STATUS))throw t.getProgramInfoLog(r);t.useProgram(r);const o=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),t.STATIC_DRAW);const a=t.getAttribLocation(r,"xy");t.vertexAttribPointer(a,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(a);const n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this.program=r,this.buffer=o,this.vertexShader=i,this.fragmentShader=s,this.texture=n}destroy(){this.gl.deleteProgram(this.program),this.gl.deleteBuffer(this.buffer),this.gl.deleteTexture(this.texture),this.gl.deleteShader(this.vertexShader),this.gl.deleteShader(this.fragmentShader),this.program=null,this.buffer=null,this.vertexShader=null,this.fragmentShader=null,this.texture=null}render(e){this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight;const t=this.gl;t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight),t.clearColor(1,0,0,1),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4)}}class $a extends Ua{constructor(e){super(),this.player=e;const t=document.createElement("canvas");t.style.position="absolute",t.style.top=0,t.style.left=0,this.$videoElement=t,e.$container.appendChild(this.$videoElement),this.context2D=null,this.contextGl=null,this.webglRender=null,this.webglRectRender=null,this.webGPURender=null,this.isWebglContextLost=!1,this.isWcsWebgl2=!1,this.isWcsWebgpu=!1,this.bitmaprenderer=null,this.renderType=null,this.controlHeight=0,this.proxyDestroyList=[],this._initCanvasRender()}destroy(){super.destroy(),this.proxyDestroyList.length>0&&(this.proxyDestroyList.forEach((e=>{e&&e()})),this.proxyDestroyList=[]),this.contextGl&&(this.contextGl=null),this.context2D&&(this.context2D=null),this.webglRender&&(this.webglRender.destroy(),this.webglRender=null),this.webglRectRender&&(this.webglRectRender.destroy(),this.webglRectRender=null),this.webGPURender&&(this.webGPURender.destroy(),this.webGPURender=null),this.bitmaprenderer&&(this.bitmaprenderer=null),this.renderType=null,this.isWebglContextLost=!1,this.isWcsWebgpu=!1,this.isWcsWebgl2=!1,this.videoInfo={width:"",height:"",encType:""},this.player.$container.removeChild(this.$videoElement),this.init=!1,this.off()}_initContext2D(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.context2D=this.$videoElement.getContext("2d",e)}_initContextGl(){if(this.player.events,this.contextGl=Yr(this.$videoElement),!this.contextGl)throw this.player.debugError("CommonCanvasLoader","_initContextGl() createContextGL error"),new Error("CommonCanvasLoader and _initContextGl createContextGL error");this._bindContextGlEvents(),this.webglRender=new Ra(this.contextGl,this.player._opt.openWebglAlignment)}_initContextGl2(){if(this.contextGl=Qr(this.$videoElement),this.contextGl){this._bindContextGlEvents(2);try{this.webglRender=new Ha(this.$videoElement,this.contextGl)}catch(e){this.player.debugError("CommonCanvasLoader",`create webgl2Render error is ${e} and next use context2d.draw render`),this.contextGl=null,this.webglRender=null,this._initContext2D()}}else this.player.debugError("CommonCanvasLoader","_initContextGl2() createContextGL2 error")}_bindContextGlEvents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;const{proxy:t}=this.player.events,i=t(this.$videoElement,"webglcontextlost",(t=>{t.preventDefault(),this.player.debugError("canvasVideo","webglcontextlost error",t),this.isWebglContextLost=!0,this.webglRender&&(this.player.debugLog("CommonCanvasLoader","webglcontextlost error and destroy webglRender"),this.webglRender.destroy(),this.webglRender=null),this.webglRectRender&&(this.player.debugLog("CommonCanvasLoader","webglcontextlost error and destroy webglRectRender"),this.webglRectRender.destroy(),this.webglRectRender=null),this.contextGl=null,setTimeout((()=>{if(this.player.debugLog("CommonCanvasLoader",`createContextGL() version ${e}`),1===e?this.contextGl=Yr(this.$videoElement):2===e&&(this.contextGl=Qr(this.$videoElement)),this.player.debugLog("CommonCanvasLoader","createContextGL success"),this.contextGl&&this.contextGl.getContextAttributes){const t=this.contextGl.getContextAttributes();t&&t.stencil?(1===e?this.webglRender=new Ra(this.contextGl,this.player._opt.openWebglAlignment):2===e&&(this.webglRender=new Ha(this.$videoElement,this.contextGl)),this.isWebglContextLost=!1,this.player.debugLog("CommonCanvasLoader","webglcontextlost error reset and getContextAttributes().stencil is true")):(this.player.debugError("CommonCanvasLoader","webglcontextlost error, getContextAttributes().stencil is false"),this.player.emitError(lt.webglContextLostError))}else this.player.debugError("CommonCanvasLoader","webglcontextlost error, getContextAttributes().stencil is false"),this.player.emitError(lt.webglContextLostError)}),500)})),s=t(this.$videoElement,"webglcontextrestored",(e=>{e.preventDefault(),this.player.debugLog("CommonCanvasLoader","webglcontextrestored ",e)}));this.proxyDestroyList.push(i,s)}_initContextGPU(){Va(this.$videoElement).then((e=>{this.player.isDestroyedOrClosed()||(e?(this.webGPURender=new Ma(e),this.player.debugLog("CommonCanvasLoader","webGPURender init success")):(this.player.debugWarn("CommonCanvasLoader","webGPURender init failed because context is null and next use webgl render"),this.renderType=ii,this._initContextGl()))})).catch((e=>{this.player.isDestroyedOrClosed()||(this.player.debugWarn("CommonCanvasLoader",`createWebGPUContext error is ${e} and next use webgl render`),this.renderType=ii,this._initContextGl())}))}initCanvasViewSize(){this.$videoElement.width=this.videoInfo.width,this.$videoElement.height=this.videoInfo.height,this.resize()}screenshot(e,t,i,s){e=e||Zr(),s=s||pt.download;let r=.92;!Vi[t]&&pt[t]&&(s=t,t="png",i=void 0),"string"==typeof i&&(s=i,i=void 0),void 0!==i&&(r=Number(i));const o=Vi[t]||Vi.png,a=this.$videoElement.toDataURL(o,r);if(s===pt.base64)return a;{const t=Xr(a);if(s===pt.blob)return t;if(s===pt.download){const i=o.split("/")[1];Wa(t,e+"."+i)}}}screenshotWatermark(e){return new Promise(((t,i)=>{Wo(e)&&(e={filename:e}),(e=e||{}).width=this.videoInfo.width,e.height=this.videoInfo.height,e.filename=e.filename||Zr(),e.format=e.format?Vi[e.format]:Vi.png,e.quality=Number(e.quality)||.92,e.type=e.type||pt.download;const s=this.$videoElement.toDataURL(e.format,e.quality);Po(s,e).then((i=>{if(e.type===pt.base64)t(s);else{const s=Xr(i);if(e.type===pt.blob)t(s);else if(e.type===pt.download){t();const i=e.format.split("/")[1];Wa(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}))}screenshotCopyrightWatermark(e){return new Promise(((t,i)=>{if(Wo(e)){(e=(e={filename:e})||{}).width=this.videoInfo.width,e.height=this.videoInfo.height,e.filename=e.filename||Zr(),e.format=e.format?Vi[e.format]:Vi.png,e.quality=Number(e.quality)||.92,e.type=e.type||pt.download;const s=this.$videoElement.toDataURL(e.format,e.quality);Io(s,e).then((i=>{if(e.type===pt.base64)t(s);else{const s=Xr(i);if(e.type===pt.blob)t(s);else if(e.type===pt.download){t();const i=e.format.split("/")[1];Wa(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}}))}screenshotByCurrentWatermark(e){}render(){}clearView(){super.clearView()}play(){}pause(){}_resize(){this.player.debugLog("canvasVideo","_resize()");const e=this.player._opt;let t=this.player.width,i=this.player.height;if(this.player.isControlBarShow()){const s=this.controlHeight;no()&&this.player.fullscreen&&e.useWebFullScreen?t-=s:i-=s}let s=this.$videoElement.width,r=this.$videoElement.height;const o=e.rotate;let a=(t-s)/2,n=(i-r)/2;270!==o&&90!==o||(s=this.$videoElement.height,r=this.$videoElement.width);const l=t/s,d=i/r;let h=l>d?d:l;ua(e.isResize)&&l!==d&&(h=l+","+d),e.isFullResize&&(h=l>d?l:d);let c="scale("+h+")";"none"===e.mirrorRotate&&o&&(c+=" rotate("+o+"deg)"),"level"===e.mirrorRotate?c+=" rotateY(180deg)":"vertical"===e.mirrorRotate&&(c+=" rotateX(180deg)"),this.$videoElement.style.height=this.videoInfo.height+"px",this.$videoElement.style.width=this.videoInfo.width+"px",this.$videoElement.style.padding="0",this.$videoElement.style.transform=c,this.$videoElement.style.left=a+"px",this.$videoElement.style.top=n+"px"}initFps(){}setStreamFps(e){}getStreamFps(){return 25}getType(){return H}getCanvasType(){let e=this.renderType===ri?ri:ii;return this.isWcsWebgl2?e=si:this.isWcsWebgpu&&(e=ri),e}}class Ja extends $a{constructor(e){super(e),this.TAG_NAME="CanvasVideo",this.yuvList=[],this.controlHeight=Yt,this.tempTextCanvas=null,this.tempTextCanvasCtx=null,this.player.debugLog("CanvasVideo","init")}async destroy(){super.destroy(),this.yuvList=[],this.tempTextCanvas&&(this.tempTextCanvasCtx.clearRect(0,0,this.tempTextCanvas.width,this.tempTextCanvas.height),this.tempTextCanvas.width=0,this.tempTextCanvas.height=0,this.tempTextCanvas=null),this.player.debugLog("CanvasVideoLoader","destroy")}_initCanvasRender(){this.player._opt.useWCS&&!this._supportOffscreen()?(this.renderType=ti,this.player._opt.useWebGPU?Va(this.$videoElement).then((e=>{this.player.isDestroyedOrClosed()||(e?(this.webGPURender=new Ma(e),this.isWcsWebgpu=!0,this.player.debugLog(this.TAG_NAME,"webGPURender init success")):(this.player.debugWarn(this.TAG_NAME,"webGPURender init failed because context is null and next use webgl render"),this._initWebglRenderForWCS()))})).catch((()=>{this.player.isDestroyedOrClosed()||(this.player.debugWarn(this.TAG_NAME,`createWebGPUContext error is ${e} and next use webgl render`),this._initWebglRenderForWCS())})):this._initWebglRenderForWCS()):this.player._opt.useMSE&&this.player._opt.mseUseCanvasRender?(this.renderType=ai,this._initContext2D()):this.player.isOldHls()&&this.player._opt.useCanvasRender?(this.renderType=ni,this._initContext2D()):this.player.isWebrtcH264()&&this.player._opt.webrtcUseCanvasRender?(this.renderType=li,this._initContext2D()):this._supportOffscreen()?(this.renderType=oi,this._bindOffscreen()):this.player._opt.useWebGPU?(this.renderType=ri,this._initContextGPU()):(this.renderType=ii,this._initContextGl())}_initWebglRenderForWCS(){this.player._opt.wcsUseWebgl2Render&&ga()?(this._initContextGl2(),this.webglRender&&(this.isWcsWebgl2=!0)):this._initContext2D()}_supportOffscreen(){return"function"==typeof this.$videoElement.transferControlToOffscreen&&this.player._opt.useOffscreen}_bindOffscreen(){this.bitmaprenderer=this.$videoElement.getContext("bitmaprenderer")}render(e){this.yuvList.push(e),this.startRender()}startRender(){for(;!(this.yuvList.length<=0);){const e=this.yuvList.shift();this.doRender(e)}}doRender(e){if(this.renderType!==ai){const t={ts:e.ts||0,fps:!0};this.player.updateStats(t)}switch(this.renderType){case oi:this.bitmaprenderer.transferFromImageBitmap(e.buffer);break;case ii:case ri:if(this.isWebglContextLost)return void this.player.debugWarn("CanvasVideoLoader","doRender() and webgl context is lost");let t=e.output;if(this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector){null===this.prevAiFaceDetectTime&&(this.prevAiFaceDetectTime=Zr());const i=Zr();i-this.prevAiFaceDetectTime>=this.player._opt.aiFaceDetectInterval&&(t=this.player.ai.faceDetector.detect({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output,ts:e.ts||0}),this.prevAiFaceDetectTime=i)}if(this.player.objectDetectActive&&this.player.ai&&this.player.ai.objectDetector){null===this.prevAiObjectDetectTime&&(this.prevAiObjectDetectTime=Zr());const i=Zr();i-this.prevAiObjectDetectTime>=this.player._opt.aiObjectDetectInterval&&(t=this.player.ai.objectDetector.detect({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output,ts:e.ts||0}),this.prevAiObjectDetectTime=i)}if(this.player.occlusionDetectActive&&this.player.ai&&this.player.ai.occlusionDetector){null===this.prevAiOcclusionDetectTime&&(this.prevAiOcclusionDetectTime=Zr());const t=Zr();if(t-this.prevAiOcclusionDetectTime>=this.player._opt.aiOcclusionDetectInterval){const i=this.player.ai.occlusionDetector.check({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output});this.prevAiOcclusionDetectTime=t,i&&this.player.emit(ot.aiOcclusionDetectResult,{ts:e.ts||0})}}if(this.player.imageDetectActive&&this.player.ai&&this.player.ai.imageDetector){const t=this.player.ai.imageDetector.check({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output});if(t&&t.data&&(this.player.emit(ot.aiImageDetectResult,{type:t.type,ts:e.ts||0}),this.player._opt.aiImageDetectDrop))return void this.player.debugLog("CanvasVideoLoader",`doRender() and ai image detect result type is ${t.type} and drop`)}if(this.renderType===ri)try{if(!this.webGPURender)return void this.player.debugWarn("CanvasVideoLoader","doRender webgpu render is not init");this.webGPURender.renderYUV(this.$videoElement.width,this.$videoElement.height,t)}catch(e){this.player.debugError("CanvasVideoLoader",`doRender webgpu render and error: ${e.toString()}`)}else if(this.renderType===ii)try{this.webglRender.renderYUV(this.$videoElement.width,this.$videoElement.height,t)}catch(e){this.player.debugError("CanvasVideoLoader",`doRender webgl render context is lost ${this.contextGl&&this.contextGl.isContextLost()} and error: ${e.toString()}`)}break;case ti:if(this.webGPURender)this.webGPURender.render(e.videoFrame),Zo(e.videoFrame);else if(this.webglRender)this.webglRender.render(e.videoFrame),Zo(e.videoFrame);else if(this.context2D)if(qo(e.videoFrame.createImageBitmap))try{e.videoFrame.createImageBitmap().then((t=>{this.context2D.drawImage(t,0,0,this.$videoElement.width,this.$videoElement.height),Zo(e.videoFrame)}))}catch(e){}else this.context2D.drawImage(e.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height),Zo(e.videoFrame);else this.player.debugWarn("CanvasVideoLoader","doRender() and webcodecs context is lost");break;case ai:case ni:case li:this.context2D.drawImage(e.$video,0,0,this.$videoElement.width,this.$videoElement.height)}let t=e.ts||0;this.renderType===ai&&(t=parseInt(1e3*e.$video.currentTime,10)+(this.player.mseDecoder.firstRenderTime||0)),this.player.updateCurrentPts(t),this.doAddContentToWatermark(),this.doAddAiContentToWatermark()}clearView(){switch(super.clearView(),this.renderType){case oi:(function(e,t){const i=document.createElement("canvas");i.width=e,i.height=t;const s=window.createImageBitmap(i,0,0,e,t);return i.width=0,i.height=0,s})(this.$videoElement.width,this.$videoElement.height).then((e=>{this.bitmaprenderer.transferFromImageBitmap(e)}));break;case ii:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case ri:this.webGPURender.clear();break;case ti:this.webGPURender?this.webGPURender.clear():this.contextGl?this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT):this.context2D&&this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height);break;case ai:case ni:case li:this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height)}}_initTempTextCanvas(){this.tempTextCanvas=document.createElement("canvas"),this.tempTextCanvasCtx=this.tempTextCanvas.getContext("2d"),this.tempTextCanvas.width=600,this.tempTextCanvas.height=20}doAddContentToCanvas(){this.tempContentList.length>0&&this.context2D&&function(e){let{ctx:t,list:i}=e;t.save(),(i||[]).forEach((e=>{"text"===e.type?(t.font=`${e.fontSize||12}px Arial`,t.fillStyle=e.color||"green",t.fillText(e.text,e.x,e.y)):"rect"===e.type&&(t.strokeStyle=e.color||"green",t.lineWidth=e.lineWidth||2,t.strokeRect(e.x,e.y,e.width,e.height))})),t.restore()}({ctx:this.context2D,list:this.tempContentList})}doAddContentToWebGlCanvas(){this.tempContentList.length>0&&this.contextGl&&this.webglRectRender&&this.tempContentList.forEach((e=>{const t=e.x,i=e.y;if("rect"===e.type){const r=e.width,o=e.height,a=(s=e.color||"#008000",[parseInt(s.substring(1,3),16)/255,parseInt(s.substring(3,5),16)/255,parseInt(s.substring(5,7),16)/255,1]),n=e.lineWidth||4;if(!r||!o)return;this.webglRectRender.drawBox({x:t,y:i,width:r,height:o,lineColor:a,lineWidth:n,canvasWidth:this.$videoElement.width,canvasHeight:this.$videoElement.height})}else if("text"===e.type){const s=e.text||"";if(!s)return;const r=e.fontSize||20,o=e.color||"#008000";this.tempTextCanvas||this._initTempTextCanvas(),this.tempTextCanvasCtx.clearRect(0,0,this.tempTextCanvas.width,this.tempTextCanvas.height),this.tempTextCanvasCtx.font=`${r}px Arial`,this.tempTextCanvasCtx.fillStyle=o,this.tempTextCanvasCtx.textBaseline="top",this.tempTextCanvasCtx.fillText(s,0,0),this.webglRender.drawDom(this.$videoElement.width,this.$videoElement.height,t,i,this.tempTextCanvas)}var s}))}}class qa extends Ua{constructor(e){super(),this.player=e,this.TAG_NAME="Video";const t=document.createElement("video");t.muted=!0,t.disablePictureInPicture=!0,ho()&&(t.poster="noposter"),t.style.position="absolute",t.style.top=0,t.style.left=0,this._delayPlay=!1,e.$container.appendChild(t),this.$videoElement=t,this.$canvasElement=null,this.canvasContext=null,this.mediaStream=null,this.vwriter=null,this.awriter=null,this.trackGenerator=null,this.audioTrackGenerator=null,this.fixChromeVideoFlashBug(),this.fixMobileAutoFullscreen(),this.resize(),this.eventListenList=[],this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes=0,this.isRetryPlaying=!1,this.isRetryPlayingTimes=0,this.canplayReceived=!1,this.progressProxyDestroy=null,this.checkVideoCanplayTimeout=null,this.visibilityChangePlayTimeout=null,this.pauseDelayTimeout=null,this.replayTimeout=null,this.detectAndFixStuckPlaybackStartTime=null;const i=Aa();this.supportVideoFrameCallbackHandle=null;const{proxy:s}=this.player.events,r=s(this.$videoElement,"canplay",(()=>{this.player.debugLog("Video","canplay"),this.player.isDestroyedOrClosed()||(this.canplayReceived=!0,this._delayPlay?(this.clearCheckVideoCanplayTimeout(),this._play(),Aa()?this.supportVideoFrameCallbackHandle||(this.player.debugLog("Video","support requestVideoFrameCallback and use videoFrameCallback"),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))):this.player.debugWarn("Video","not support requestVideoFrameCallback and use timeupdate event to update stats")):this.$videoElement.paused&&(this.player.isMSEPlaybackRateChangePause?(this.player.debugLog("Video",`canplay and video is paused and isMSEPlaybackRateChangePause is ${this.player.isMSEPlaybackRateChangePause} so next try to play`),this.player.isMSEPlaybackRateChangePause=!1,this._play()):this.player.isMSECurrentMoreThanBufferedPause?(this.player.debugLog("Video",`canplay and video is paused and isMSECurrentMoreThanBufferedPause is ${this.player.isMSECurrentMoreThanBufferedPause} so next try to play`),this.player.isMSECurrentMoreThanBufferedPause=!1,this._play()):(this.player.debugWarn("Video","canplay and video is paused and try to play"),this._play())))})),o=s(this.$videoElement,"waiting",(()=>{this.player.debugLog("Video","waiting")})),a=s(this.$videoElement,"loadedmetadata",(()=>{this.player.debugLog("Video","loadedmetadata")})),n=s(this.$videoElement,"timeupdate",(t=>{if(!this.player.isDestroyedOrClosed()){if(ua(i)){const t=parseInt(1e3*this.getCurrentTime(),10);if(e.isWebrtcH264()||this.player.isOldHls()||this.player.isAliyunRtc())this.player.emit(ot.timeUpdate,t),e.handleRender(),e.updateStats({fps:!0,ts:t,dts:t}),this.player.updateCurrentPts(t);else if(ca(this.player._opt.useMSE)&&ua(this.player._opt.mseUseCanvasRender))if(this.player.mseDecoder){let e=parseInt(1e3*this.getCurrentTime(),10)+(this.player.mseDecoder.firstRenderTime||0);this.player.updateCurrentPts(e)}else if(this.player._opt.mseDecoderUseWorker){let e=parseInt(1e3*this.getCurrentTime(),10)+(this.player._mseWorkerData.firstRenderTime||0);this.player.updateCurrentPts(e)}this.doAddContentToWatermark()}this.player.isMseDecoderUseWorker()&&(this.player.decoderWorker.updateVideoTimestamp(this.getCurrentTime()),this._handleUpdatePlaybackRate())}})),l=s(this.$videoElement,"error",(e=>{if(!this.$videoElement.error)return void this.player.debugError(this.TAG_NAME,"on error",e);let t={};if(this.player.isUseMSE()&&(t=this.player.getMseMineType()),this.player.debugError("Video","Error Code "+this.$videoElement.error.code+" "+Ys[this.$videoElement.error.code]+"; Details: "+this.$videoElement.error.message+"; Video Info: "+JSON.stringify(this.videoInfo)+"; Mse Mine Type: "+t.video+"; "),this.player.isUseMSE()){this.$videoElement.error.code;const e=this.$videoElement.error.message;-1!==e.indexOf(Qs)&&(this.player.isMSEVideoDecoderInitializationFailedNotSupportHevc=!0),-1!==e.indexOf(Xs)&&(this.player.isMSEAudioDecoderError=!0)}this.player.isHlsCanVideoPlay()})),d=s(this.$videoElement,"stalled",(()=>{this._detectAndFixStuckPlayback(!0)}));if(this.progressProxyDestroy=s(this.$videoElement,"progress",(()=>{this._detectAndFixStuckPlayback()})),this.eventListenList.push(r,o,n,l,a,d),this.player.isUseMSE()){const e=s(this.$videoElement,es,(()=>{this.player.debugLog(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate),this.$videoElement&&this.$videoElement.paused&&(this.player.debugWarn(this.TAG_NAME,"ratechange and video is paused and sent isMSEPlaybackRateChangePause true"),this.player.isMSEPlaybackRateChangePause=!0)}));this.eventListenList.push(e),this.player.on(ot.visibilityChange,(e=>{e&&(this.visibilityChangePlayTimeout=setTimeout((()=>{if(this.clearVisibilityChangePlayTimeout(),this.player.isPlaying()&&this.$videoElement){const e=this.getVideoBufferLastTime();e-this.$videoElement.currentTime>this.getBufferMaxDelayTime()&&(this.player.debugLog(this.TAG_NAME,`visibilityChange is true and lastTime is ${e} and currentTime is ${this.$videoElement.currentTime} so set currentTime to lastTime`),this.$videoElement.currentTime=e)}}),300))}))}this.player.debugLog("Video","init")}async destroy(){if(super.destroy(),this.clearCheckVideoCanplayTimeout(),this.clearReplayTimeout(),this.clearVisibilityChangePlayTimeout(),this.clearPauseDelayTimeout(),this._cancelVideoFrameCallback(),this._removeProgressProxyDestroy(),this.eventListenList.length&&(this.eventListenList.forEach((e=>{e()})),this.eventListenList=[]),this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes=0,this.isRetryPlaying=!1,this.isRetryPlayingTimes=0,this.canplayReceived=!1,this.player._opt.videoRenderSupportScale&&this._isNeedAddBackDropFilter()){const e=this.player.$container;e.style.backdropFilter="none",e.style.transform="none"}if(this.$canvasElement&&(this.$canvasElement.height=0,this.$canvasElement.width=0,this.$canvasElement=null),this.canvasContext=null,this.$videoElement){this.$videoElement.pause&&(this.$videoElement.pause(),this.$videoElement.muted=!0),this.$videoElement.currentTime=0,this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")),this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"));try{this.$videoElement.load()}catch(e){}this.player.$container.removeChild(this.$videoElement),this.$videoElement=null}this.trackGenerator&&(this.trackGenerator.stop(),this.trackGenerator=null),this.audioTrackGenerator&&(this.audioTrackGenerator.stop(),this.audioTrackGenerator=null),this.vwriter&&(await this.vwriter.close(),this.vwriter=null),this.awriter&&(await this.awriter.close(),this.awriter=null),this._delayPlay=!1,this.mediaStream&&(this.mediaStream.getTracks().forEach((e=>e.stop())),this.mediaStream=null),this.off(),this.player.debugLog("Video","destroy")}_createScreenShotCanvas(){const e=document.createElement("canvas");this.$canvasElement=e,this.canvasContext=e.getContext("2d"),this.canvasContext.imageSmoothingEnabled=!0,this.canvasContext.imageSmoothingEnabled&&(this.canvasContext.imageSmoothingQuality="high")}bindMediaStream(){if(this.player.canVideoTrackWritter()&&wo()&&To()&&!this.mediaStream){this.player.debugLog(this.TAG_NAME,"bindMediaStream"),this.trackGenerator=new MediaStreamTrackGenerator({kind:"video"}),this.player.useVideoPlayAudio()&&(this.audioTrackGenerator=new MediaStreamTrackGenerator({kind:"audio"}),this.awriter=this.audioTrackGenerator.writable.getWriter());const e=[this.trackGenerator];this.audioTrackGenerator&&e.push(this.audioTrackGenerator),this.mediaStream=new MediaStream(e),this.$videoElement.srcObject=this.mediaStream,this.vwriter=this.trackGenerator.writable.getWriter()}}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())return void this.player.debugLog("Video","videoFrameCallback() and isDestroyedOrClosed and return");this.player.handleRender();const i=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)||0;if(this.player.isUseHls265UseMse())this.player.updateStats({fps:!0,ts:i});else if(this.player.isMseDecoderUseWorker()){this.player._times.videoStart||(this.player._times.videoStart=Zr(),this.player.handlePlayToRenderTimes());const e=i+(this.player._mseWorkerData.firstRenderTime||0);if(this.player.updateStats({fps:!0,dfps:!0,ts:e,mseTs:i}),this.player.emit(ot.timeUpdate,e),ua(this.getHasInit())&&t.width&&t.height){const e={width:t.width,height:t.height};this.updateVideoInfo(e),this.initCanvasViewSize()}}if(this.player.isWebrtcH264()||this.player.isOldHls()||this.player.isAliyunRtc()){if(this.player.emit(ot.timeUpdate,i),ua(this.getHasInit())&&t.width&&t.height){const e={width:t.width,height:t.height};this.videoInfo.encTypeCode||this.player.isOldHls()||(e.encTypeCode=yt),this.updateVideoInfo(e)}this.player.updateStats({fps:!0,ts:i,dts:i}),this.player.updateCurrentPts(i),this.doAddContentToWatermark()}else if(ca(this.player._opt.useMSE)&&ua(this.player._opt.mseUseCanvasRender)){if(this.player.mseDecoder){let e=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)+(this.player.mseDecoder.firstRenderTime||0);this.player.updateCurrentPts(e)}else if(this.player._opt.mseDecoderUseWorker){let e=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)+(this.player._mseWorkerData.firstRenderTime||0);this.player.updateCurrentPts(e)}this.doAddContentToWatermark()}this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}fixChromeVideoFlashBug(){if(this.player._opt.videoRenderSupportScale&&this._isNeedAddBackDropFilter()){const e=this.player.$container;e.style.backdropFilter="blur(0px)",e.style.transform="translateZ(0)"}}fixMobileAutoFullscreen(){const e=po(),t=ho();(e||t)&&(this.player.debugLog("Video",`fixMobileAutoFullscreen and isIOS ${e} and isAndroid ${t}`),this.$videoElement.setAttribute("webkit-playsinline","true"),this.$videoElement.setAttribute("playsinline","true"),this.$videoElement.setAttribute("x5-video-player-type","h5-page"))}_detectAndFixStuckPlayback(e){const t=this.$videoElement,i=t.buffered,s=t.readyState;if(this.player.debugLog(this.TAG_NAME,`_detectAndFixStuckPlayback() and isStalled is ${e} ,canplayReceived is ${this.canplayReceived} ,videoReadyState is ${s} and bufferedLength is ${i.length} and startTime is ${i.length>0?i.start(0):"null"} and currentTime is ${t.currentTime}`),e||ua(this.canplayReceived)||s<2){if(i.length>0&&t.currentTime=1e3*this.player._opt.mseWaitVideoCanplayTimeout&&(this.player.debugWarn(this.TAG_NAME,`_detectAndFixStuckPlayback() and video is stuck and currentTime is ${t.currentTime} , diff is ${e} and timeout`),this.player.emit(lt.mseWaitVideoCanplayTimeout,e))}}else this._removeProgressProxyDestroy()}_removeProgressProxyDestroy(){this.progressProxyDestroy&&(this.player.debugLog(this.TAG_NAME,"_removeProgressProxyDestroy()"),this.progressProxyDestroy(),this.progressProxyDestroy=null),this.detectAndFixStuckPlaybackStartTime=null}_isNeedAddBackDropFilter(){const e=uo().type.toLowerCase();return"chrome"===e||"edge"===e}isPaused(){let e=!0;return this.$videoElement&&(e=this.$videoElement.paused),e}isPause(){return this.isPaused()}_getVideoReadyState(){let e=0;return this.$videoElement&&(e=this.$videoElement.readyState),e}_getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}play(){if(this.$videoElement){const e=this._getVideoReadyState();if(this.player.debugLog("Video",`play and readyState: ${e}`),0===e)return this.player.debugLog("Video","readyState is 0 and set _delayPlay to true and listen canplay event to play"),this._delayPlay=!0,void(null===this.checkVideoCanplayTimeout&&(this.checkVideoCanplayTimeout=setTimeout((()=>{if(this.clearCheckVideoCanplayTimeout(),!this.player.isDestroyedOrClosed()&&ua(this.isPlaying())){const e=this._getBufferStore();this.player.debugWarn("Video",`checkVideoCanplayTimeout and video is not playing and buffer store is ${e} and retry play`),this.$videoElement.currentTime=e,this._replay()}}),1e3)));this._play()}}_play(){this.$videoElement&&this.$videoElement.play().then((()=>{this._delayPlay=!1,this.player.debugLog("Video","_play success"),this.isPlaying()?(this.player.emit(ot.removeLoadingBgImage),this.isRetryPlayingTimes=0,this.isRetryPlaying=!1):this.replayTimeout=setTimeout((()=>{this.clearReplayTimeout(),this._replay()}),100)})).catch((e=>{this.player.isDestroyedOrClosed()?this.player.debugLog("Video","_play error and player is isDestroyedOrClosed and return"):(this.player.debugLog("Video",`_play error and\n e.name is ${e.name},\n e.message is ${e.message},\n e.toString() is ${e.toString()}`),this.player.debugError("Video","_play error",e),this.isRetryPlaying=!1,this.replayTimeout=setTimeout((()=>{this.clearReplayTimeout(),this._replay()}),100))}))}_replay(){if(!this.isPlaying()&&ua(this.player.isDestroyedOrClosed())&&ua(this.isRetryPlaying)){if(this.isRetryPlaying=!0,this.isRetryPlayingTimes>=3){let e="";return void(this.player.isWebrtcH264()?(e=`_replay(webrtc H264) then but not playing and retry play times is ${this.isRetryPlayingTimes} and emit error`,this.player.debugError("Video",e),this.player.emitError(lt.videoElementPlayingFailedForWebrtc,e)):(e=`_replay then but not playing and retry play times is ${this.isRetryPlayingTimes} and emit error to use canvas render`,this.player.debugError("Video",e),this.player.emitError(lt.videoElementPlayingFailed,e)))}this.player.debugWarn("Video",`_play then but not playing and retry play and isRetryPlayingTimes is ${this.isRetryPlayingTimes}`),this._play(),this.isRetryPlayingTimes++}else this.player.debugLog("Video",`_replay() and isPlaying is ${this.isPlaying()} and isRetryPlaying is ${this.isRetryPlaying} and isDestroyedOrClosed is ${this.player.isDestroyedOrClosed()} and return;`)}pause(e){this.player.debugLog(this.TAG_NAME,"pause and isNow is "+e),this.isPlaying()&&(e?(this.$videoElement&&this.$videoElement.pause(),this._cancelVideoFrameCallback()):this.pauseDelayTimeout=setTimeout((()=>{this.clearPauseDelayTimeout(),this.$videoElement&&this.$videoElement.pause(),this._cancelVideoFrameCallback()}),100))}clearView(){super.clearView(),this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")))}screenshot(e,t,i,s){if(!this._canScreenshot())return this.player.debugWarn("Video",`screenshot failed, video is not ready and stats is ${this._getVideoReadyState()}`),null;e=e||Zr(),s=s||pt.download;let r=.92;!Vi[t]&&pt[t]&&(s=t,t="png",i=void 0),"string"==typeof i&&(s=i,i=void 0),void 0!==i&&(r=Number(i));const o=this.$videoElement;this.$canvasElement||this._createScreenShotCanvas();let a=this.$canvasElement;a.width=o.videoWidth,a.height=o.videoHeight,this.canvasContext.drawImage(o,0,0,a.width,a.height);const n=Vi[t]||Vi.png,l=a.toDataURL(n,r);if(this.canvasContext.clearRect(0,0,a.width,a.height),a.width=0,a.height=0,s===pt.base64)return l;{const t=Xr(l);if(s===pt.blob)return t;if(s===pt.download){const i=n.split("/")[1];Wa(t,e+"."+i)}}}screenshotWatermark(e){return new Promise(((t,i)=>{if(Wo(e)&&(e={filename:e}),!this._canScreenshot())return this.player.debugWarn("Video","screenshot failed, video is not ready"),i("screenshot failed, video is not ready");const s=this.$videoElement;(e=e||{}).width=s.videoWidth,e.height=s.videoHeight,e.filename=e.filename||Zr(),e.format=e.format?Vi[e.format]:Vi.png,e.quality=Number(e.quality)||.92,e.type=e.type||pt.download,this.$canvasElement||this._createScreenShotCanvas();let r=this.$canvasElement;r.width=s.videoWidth,r.height=s.videoHeight,this.canvasContext.drawImage(s,0,0,r.width,r.height);const o=r.toDataURL(e.format,e.quality);this.canvasContext.clearRect(0,0,r.width,r.height),r.width=0,r.height=0,Po(o,e).then((i=>{if(e.type===pt.base64)t(o);else{const s=Xr(i);if(e.type===pt.blob)t(s);else if(e.type===pt.download){t();const i=e.format.split("/")[1];Wa(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}))}screenshotCopyrightWatermark(e){return new Promise(((t,i)=>{if(Wo(e)&&(e={filename:e}),!this._canScreenshot())return this.player.debugWarn("Video","screenshot failed, video is not ready"),i("screenshot failed, video is not ready");const s=this.$videoElement;(e=e||{}).width=s.videoWidth,e.height=s.videoHeight,e.filename=e.filename||Zr(),e.format=e.format?Vi[e.format]:Vi.png,e.quality=Number(e.quality)||.92,e.type=e.type||pt.download,this.$canvasElement||this._createScreenShotCanvas();let r=this.$canvasElement;r.width=s.videoWidth,r.height=s.videoHeight,this.canvasContext.drawImage(s,0,0,r.width,r.height);const o=r.toDataURL(e.format,e.quality);this.canvasContext.clearRect(0,0,r.width,r.height),r.width=0,r.height=0,Io(o,e).then((i=>{if(e.type===pt.base64)t(o);else{const s=Xr(i);if(e.type===pt.blob)t(s);else if(e.type===pt.download){t();const i=e.format.split("/")[1];Wa(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}))}screenshotByCurrentWatermark(e){}initCanvasViewSize(){this.resize()}clear(){const e=this.$videoElement,t=e.buffered,i=t.length?t.end(t.length-1):0;e.currentTime=i}render(e){if(this.vwriter){if(this.$videoElement.srcObject||(this.$videoElement.srcObject=this.mediaStream),this.isPaused()){const e=this._getVideoReadyState();if(this.player.debugWarn("Video","render() error, video is paused and readyState is "+e),4===e&&ua(this.isRenderRetryPlaying)){if(this.isRenderRetryPlaying=!0,this.isRenderRetryPlayingTimes>3){const t="render() error, video is paused and readyState is "+e+", retry times is "+this.isRenderRetryPlayingTimes+", emit error and use canvas render";return this.player.debugError("Video",t),void this.player.emitError(lt.videoElementPlayingFailed,t)}this.$videoElement.play().then((()=>{this.isRenderRetryPlayingTimes=0,this.isRenderRetryPlaying=!1,this.player.debugLog("Video","render() video is paused and replay success")})).catch((e=>{this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes++,this.player.debugLog("Video",`_play error render() error, video is paused and replay error and\n e.name is ${e.name},\n e.message is ${e.message},\n e.toString() is ${e.toString()}`),this.player.debugError("Video","render() error, video is paused and replay error ",e)}))}}if(this.player.updateStats({fps:!0,ts:e.ts||0}),e.videoFrame)this.vwriter.write(e.videoFrame),Zo(e.videoFrame);else if(e.output){let s=e.output;if(this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector){null===this.prevAiFaceDetectTime&&(this.prevAiFaceDetectTime=Zr());const t=Zr();t-this.prevAiFaceDetectTime>this.player._opt.aiFaceDetectInterval&&(s=this.player.ai.faceDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0}),this.prevAiFaceDetectTime=t)}if(this.player.objectDetectActive&&this.player.ai&&this.player.ai.objectDetector){null===this.prevAiObjectDetectTime&&(this.prevAiObjectDetectTime=Zr());const t=Zr();t-this.prevAiObjectDetectTime>this.player._opt.aiObjectDetectInterval&&(s=this.player.ai.objectDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0}),this.prevAiObjectDetectTime=t)}if(this.player.occlusionDetectActive&&this.player.ai&&this.player.ai.occlusionDetector){null===this.prevAiOcclusionDetectTime&&(this.prevAiOcclusionDetectTime=Zr());const t=Zr();if(t-this.prevAiOcclusionDetectTime>=this.player._opt.aiOcclusionDetectInterval){const i=this.player.ai.occlusionDetector.check({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0});this.prevAiOcclusionDetectTime=t,i&&(this.player.debugLog("Video","render() and ai occlusion detect result is true"),this.player.emit(ot.aiOcclusionDetectResult,{ts:e.ts||0}))}}if(this.player.imageDetectActive&&this.player.ai&&this.player.ai.imageDetector){const t=this.player.ai.imageDetector.check({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0});if(t&&t.data&&(this.player.emit(ot.aiImageDetectResult,{type:t.type,ts:e.ts||0}),this.player._opt.aiImageDetectDrop))return void this.player.debugLog("Video",`render() and ai image detect result type is ${t.type} and drop`)}try{const r=(t=s,i={format:"I420",codedWidth:this.videoInfo.width,codedHeight:this.videoInfo.height,timestamp:e.ts},new VideoFrame(t,i));this.vwriter.write(r),Zo(r)}catch(e){this.player.debugError("Video","render error",e),this.player.emitError(lt.wasmUseVideoRenderError,`code is ${e.code} and message is ${e.message}`)}}this.player.updateCurrentPts(e.ts||0),this.doAddContentToWatermark(),this.doAddAiContentToWatermark()}else this.player.debugWarn("Video","render and this.vwriter is null");var t,i}_resize(){this.player.debugLog("Video","_resize()");let e=this.player.width,t=this.player.height;const i=this.player._opt,s=i.rotate;if(this.player.isControlBarShow()){const s=i.playType===_?Qt:Yt;no()&&this.player.fullscreen&&i.useWebFullScreen?e-=s:t-=s}this.$videoElement.width=e,this.$videoElement.height=t,this.$videoElement.style.width=e+"px",this.$videoElement.style.height=t+"px",270!==s&&90!==s||(this.$videoElement.width=t,this.$videoElement.height=e,this.$videoElement.style.width=t+"px",this.$videoElement.style.height=e+"px");let r=(e-this.$videoElement.width)/2,o=(t-this.$videoElement.height)/2,a="contain";ua(i.isResize)&&(a="fill"),i.isFullResize&&(a="none");let n="";"none"===i.mirrorRotate&&s&&(n+=" rotate("+s+"deg)"),"level"===i.mirrorRotate?n+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(n+=" rotateX(180deg)"),this.player._opt.videoRenderSupportScale&&(this.$videoElement.style.objectFit=a),this.$videoElement.style.transform=n,this.$videoElement.style.padding="0",this.$videoElement.style.left=r+"px",this.$videoElement.style.top=o+"px"}getType(){return $}getCurrentTime(){return this.$videoElement.currentTime}isPlaying(){return this.$videoElement&&ua(this.$videoElement.paused)&&ua(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}isVideoPlaying(){return this.isPlaying()}_canScreenshot(){return this.$videoElement&&this.$videoElement.readyState>=1}getPlaybackQuality(){let e=null;if(this.$videoElement){if(qo(this.$videoElement.getVideoPlaybackQuality)){const t=this.$videoElement.getVideoPlaybackQuality();e={droppedVideoFrames:t.droppedVideoFrames||t.corruptedVideoFrames,totalVideoFrames:t.totalVideoFrames,creationTime:t.creationTime}}else e={droppedVideoFrames:this.$videoElement.webkitDroppedFrameCount,totalVideoFrames:this.$videoElement.webkitDecodedFrameCount,creationTime:Zr()};e&&(e.renderedVideoFrames=e.totalVideoFrames-e.droppedVideoFrames)}return e}setRate(e){this.$videoElement&&(this.$videoElement.playbackRate=e)}get rate(){let e=1;return this.$videoElement&&(e=this.$videoElement.playbackRate),e}clearCheckVideoCanplayTimeout(){this.checkVideoCanplayTimeout&&(clearTimeout(this.checkVideoCanplayTimeout),this.checkVideoCanplayTimeout=null)}clearReplayTimeout(){this.replayTimeout&&(clearTimeout(this.replayTimeout),this.replayTimeout=null)}clearVisibilityChangePlayTimeout(){this.visibilityChangePlayTimeout&&(clearTimeout(this.visibilityChangePlayTimeout),this.visibilityChangePlayTimeout=null)}clearPauseDelayTimeout(){this.pauseDelayTimeout&&(clearTimeout(this.pauseDelayTimeout),this.pauseDelayTimeout=null)}_cancelVideoFrameCallback(){this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null)}_getBufferStore(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.buffered.start(0)),t}_handleUpdatePlaybackRate(){const e=this.$videoElement,t=e.buffered;t.length&&t.start(0);const i=t.length?t.end(t.length-1):0;let s=e.currentTime;const r=i-s,o=this.getBufferMaxDelayTime();if(this.player.updateStats({mseVideoBufferDelayTime:r}),r>o)this.player.debugLog(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current is ${s} , delay buffer is more than ${o} is ${r} and new time is ${i}`),e.currentTime=i,s=e.currentTime;else if(r<0&&0===i)return this.player.debugWarn(this.TAG_NAME,`handleUpdatePlaybackRate and delay buffer is ${i} - current is ${s} = ${r} < 0 and check video is paused : ${e.paused} `),void this.player.emit(lt.mediaSourceBufferedIsZeroError,"video.buffered is empty");if(s>1){const t=this._getPlaybackRate(i-s);e.playbackRate!==t&&(this.player.debugLog(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current time is ${s} and delay is ${i-s} set playbackRate is ${t} `),e.playbackRate=t)}}_getPlaybackRate(e){const t=this.$videoElement;let i=this.player._opt.videoBufferDelay+this.player._opt.videoBuffer;const s=Math.max(i,1e3),r=s/2;return e*=1e3,1===t.playbackRate?e>s?1.2:1:e<=r?1:t.playbackRate}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}getVideoBufferLastTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;i.length&&i.start(0);t=i.length?i.end(i.length-1):0}return t}getVideoBufferDelayTime(){const e=this.$videoElement;const t=this.getVideoBufferLastTime()-e.currentTime;return t>0?t:0}checkSourceBufferDelay(){const e=this.$videoElement;let t=0,i=0;return e.buffered.length>0&&(i=e.buffered.end(e.buffered.length-1),t=i-e.currentTime),t<0&&(this.player.debugWarn(this.TAG_NAME,`checkVideoSourceBufferDelay ${t} < 0, and buffered is ${i} ,currentTime is ${e.currentTime} , try to seek ${e.currentTime} to ${i}`),e.currentTime=i,e.paused&&(this.player.debugWarn(this.TAG_NAME,"checkSourceBufferDelay and video is paused and sent isMSECurrentMoreThanBufferedPause true"),this.player.isMSECurrentMoreThanBufferedPause=!0),t=0),t}checkSourceBufferStore(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.currentTime-e.buffered.start(0)),t}getVideoBufferTimeRange(){const e=this.$videoElement;let t=null;if(e){const i=e.buffered,s=i.length?i.start(0):0,r=i.length?i.end(i.length-1):0;t={start:s,end:r,diff:r-s}}return t}getDecodePlaybackRate(){let e=0;const t=this.$videoElement;return t&&(e=t.playbackRate),e}getBufferMaxDelayTime(){let e=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3;return Math.max(5,e+3)}getReadyStateInited(){return this._getVideoReadyState()>=1}}class Ka extends $a{constructor(e){super(e),this.controlHeight=Qt,this.bufferList=[],this.playing=!1,this.playInterval=null,this.fps=1,this.preFps=1,this.streamFps=0,this.playbackRate=1,this._firstTimestamp=null,this._renderFps=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._hasCalcFps=!1,this.player.on(ot.playbackPause,(e=>{e?(this.pause(),this.player.playback.isPlaybackPauseClearCache&&this.clear()):this.resume()})),this.player.debugLog("CanvasPlaybackLoader","init")}async destroy(){this._stopSync(),this.clear(),this._firstTimestamp=null,this.playing=!1,this.playbackRate=1,this.fps=1,this.preFps=1,this._renderFps=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._hasCalcFps=!1,super.destroy(),this.player.debugLog("CanvasPlaybackLoader","destroy")}_initCanvasRender(){this.player._opt.useWCS?(this.renderType=ti,ga()&&this.player._opt.wcsUseWebgl2Render?(this._initContextGl2(),this.webglRender&&(this.isWcsWebgl2=!0)):this._initContext2D()):this.player._opt.useWebGPU?(this.renderType=ri,this._initContextGPU()):(this.renderType=ii,this._initContextGl())}_sync(){this._stopSync(),this._doPlay(),this.playInterval=setInterval((()=>{this._doPlay()}),this.fragDuration)}_doPlay(){if(this.bufferList.length>0&&!this.player.seeking){const e=this.bufferList.shift();e&&e.buffer&&(this._doRender(e.buffer),this.player.handleRender(),this.player.playback.updateStats({ts:e.ts,tfTs:e.tfTs}))}}_stopSync(){this.playInterval&&(clearInterval(this.playInterval),this.playInterval=null)}_doRender(e){if(this.player._opt.useWCS)if(this.webglRender)this.webglRender.render(e),Zo(e);else if(qo(e.createImageBitmap))try{e.createImageBitmap().then((t=>{this.context2D.drawImage(t,0,0,this.$videoElement.width,this.$videoElement.height),Zo(e)}))}catch(e){}else this.context2D.drawImage(e,0,0,this.$videoElement.width,this.$videoElement.height),Zo(e);else if(this.getCanvasType()===ii)try{this.webglRender.renderYUV(this.$videoElement.width,this.$videoElement.height,e)}catch(e){this.player.debugError("CanvasPlaybackLoader",`doRender webgl render context is lost ${this.contextGl&&this.contextGl.isContextLost()} and error: ${e.toString()}`)}else if(this.getCanvasType()===ri)try{if(!this.webGPURender)return void this.player.debugWarn("CanvasVideoLoader","doRender webgpu render is not init");this.webGPURender.renderYUV(this.$videoElement.width,this.$videoElement.height,e)}catch(e){this.player.debugError("CanvasPlaybackLoader",`doRender webgpu render and error: ${e.toString()}`)}}get rate(){return this.playbackRate}get fragDuration(){return Math.ceil(1e3/(this.fps*this.playbackRate))}get bufferSize(){return this.bufferList.length}getStreamFps(){return this.streamFps}initFps(){this._hasCalcFps?this.player.debugLog("CanvasPlaybackLoader","initFps, has calc fps"):(this.preFps=eo(this.player.playback.fps,1,100),this.fps=this.preFps)}setFps(e){e!==this.fps?(e>100&&this.player.debugWarn("CanvasPlaybackLoader","setFps max",e),e<0&&this.player.debugWarn("CanvasPlaybackLoader","setFps min",e),this.fps=eo(e,1,100),this.player.debugLog("CanvasPlaybackLoader",`setFps ${this.preFps} -> ${this.fps}`),this.player.playback.isUseFpsRender&&this._sync()):this.player.debugLog("CanvasPlaybackLoader",`setFps, same fps ${e}`)}setStreamFps(e){this.player.debugLog("CanvasPlaybackLoader","setStreamFps",e),this._hasCalcFps=!0,this.streamFps=e,this.preFps=e,this.setFps(e)}setRate(e){e!==this.playbackRate&&(this.playbackRate=e,this.player.playback.isUseFpsRender&&this._sync())}render$2(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);const t={tfTs:e.ts-this._firstTimestamp,ts:e.ts};e.videoFrame?t.buffer=e.videoFrame:t.buffer=e.output,this.bufferList.push(t),this.startRender(),this.player.handleRender(),this.player.playback.updateStats({ts:e.ts,tfTs:t.tfTs})}startRender(){for(;!(this.bufferList.length<=0);){const e=this.bufferList.shift();this._doRender(e.buffer)}}pushData(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);const t={tfTs:e.ts-this._firstTimestamp,ts:e.ts};e.videoFrame?t.buffer=e.videoFrame:t.buffer=e.output;const i=this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender;if(i||this.bufferSize>this.fps*this.playbackRate*2&&(this.player.debugWarn("CanvasPlaybackLoader",`buffer size is ${this.bufferSize}`),this._doPlay()),this.bufferList.push(t),!this._hasCalcFps){const e=sa(this.bufferList);null!==e&&e!==this.preFps&&(this.player.debugLog("CanvasPlaybackLoader",`calc fps is ${e} pre fps is ${this.preFps} and updatePreFps`),this.setStreamFps(e))}if(!i){const e=this.bufferList.length,t=e/(this.fps*this.playbackRate);this.player.debugLog("CanvasPlaybackLoader","rate is",t),t<=1?this.setFps(this.preFps):(this.setFps(this.fps+Math.floor(t*this.playbackRate)),this.player.debugWarn("CanvasPlaybackLoader","rate is",t,"fps is",this.fps,"bufferListLength is",e))}}initVideo(){this.player.playback&&this.player.playback.isUseFpsRender&&this._sync(),this.playing=!0}initVideoDelay(){const e=this.player._opt.playbackDelayTime;e>0?this.delayTimeout=setTimeout((()=>{this.initVideo()}),e):this.initVideo()}clearView(){super.clearView(),this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT)}clear(){this.player._opt.useWCS&&this.bufferList.forEach((e=>{e.buffer&&Zo(e.buffer)})),this.bufferList=[]}resume(){this.player.playback.isUseFpsRender&&this._sync(),this.playing=!0}pause(){this.player.playback.isUseFpsRender&&this._stopSync(),this.playing=!1}}class Ya{constructor(e){return new(Ya.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.useMSE?e.mseUseCanvasRender?Ja:qa:e.isHls&&ua(e.supportHls265)||e.isWebrtc&&ua(e.isWebrtcH265)?e.useCanvasRender?Ja:qa:e.isAliyunRtc?qa:e.useWCS?e.playType===_?Ka:!e.useOffscreen&&e.wcsUseVideoRender?qa:Ja:e.playType===_?Ka:e.wasmUseVideoRender&&!e.useOffscreen?qa:Ja}}class Qa extends Ea{constructor(e){super(),this.bufferList=[],this.player=e,this.$audio=null,this.scriptNode=null,this.workletProcessorNode=null,this.workletWorkerCloseTimeout=null,this.hasInitScriptNode=!1,this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:vr}),this.gainNode=this.audioContext.createGain();const t=this.audioContext.createBufferSource();t.buffer=this.audioContext.createBuffer(1,1,22050),t.connect(this.audioContext.destination),t.noteOn?t.noteOn(0):t.start(0),this.audioBufferSourceNode=t,this.mediaStreamAudioDestinationNode=this.audioContext.createMediaStreamDestination(),this.gainNode.gain.value=0,this._prevVolume=null,this.playing=!1,this.audioInfo={encTypeCode:"",encType:"",channels:"",sampleRate:"",depth:""},this.init=!1,this.hasAudio=!1,this.audioResumeStateTimeout=null,this.audioContextContextResumeLock=!1}async destroy(){return this.closeAudio(),this.resetInit(),this.clearAudioResumeStateTimeout(),this.audioContext&&(await this.audioContext.close(),this.audioContext=null),this.gainNode&&(this.gainNode.disconnect(),this.gainNode=null),this.hasAudio=!1,this.playing=!1,this.scriptNode&&(this.scriptNode.disconnect(),this.scriptNode.onaudioprocess=Kr,this.scriptNode=null),await this._destroyWorklet(),this.workletProcessorNode&&(this.workletProcessorNode.disconnect(),this.workletProcessorNode.port.onmessage=Kr,this.workletProcessorNode=null),this.audioBufferSourceNode&&(this.audioBufferSourceNode.stop(),this.audioBufferSourceNode=null),this.mediaStreamAudioDestinationNode&&(this.mediaStreamAudioDestinationNode.disconnect(),this.mediaStreamAudioDestinationNode=null),this.hasInitScriptNode=!1,this._prevVolume=null,this.audioContextContextResumeLock=!1,this.off(),!0}_destroyWorklet(){return new Promise(((e,t)=>{this.workletProcessorNode?(this.workletProcessorNode.port.postMessage({type:"destroy"}),this.workletWorkerCloseTimeout=setTimeout((()=>{this.player.debugLog(this.TAG_NAME,"send close and wait 10ms destroy directly"),this.workletWorkerCloseTimeout&&(clearTimeout(this.workletWorkerCloseTimeout),this.workletWorkerCloseTimeout=null),e()}),10)):e()}))}resetInit(){this.audioInfo={encTypeCode:"",encType:"",channels:"",sampleRate:"",depth:""},this.init=!1}getAudioInfo(){return this.audioInfo}updateAudioInfo(e){e.encTypeCode&&(this.audioInfo.encTypeCode=e.encTypeCode,this.audioInfo.encType=Tt[e.encTypeCode]),e.channels&&(this.audioInfo.channels=e.channels),e.sampleRate&&(this.audioInfo.sampleRate=e.sampleRate),e.depth&&(this.audioInfo.depth=e.depth),this.audioInfo.sampleRate&&this.audioInfo.channels&&this.audioInfo.encType&&!this.init&&(this.player.emit(ot.audioInfo,this.audioInfo),this.init=!0)}get isPlaying(){return this.playing}get isMute(){return 0===this.gainNode.gain.value||this.isStateSuspended()}get volume(){return this.gainNode.gain.value}get bufferSize(){return this.bufferList.length}get audioContextState(){let e=null;return this.audioContext&&(e=this.audioContext.state),e}initScriptNode(){}initMobileScriptNode(){}initWorkletScriptNode(){}getEngineType(){return""}mute(e){e?(this.setVolume(0),this.clear()):this.setVolume(this.player.lastVolume||.5)}setVolume(e){e=parseFloat(e).toFixed(2),isNaN(e)||(this.audioEnabled(!0),e=eo(e,0,1),null!==this._prevVolume&&this._prevVolume===e||(null===this._prevVolume?this.player.emit(ot.mute,0===e):0===this._prevVolume&&e>0?this.player.emit(ot.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(ot.mute,!0),this.gainNode.gain.value=e,this.player.emit(ot.volumechange,this.player.volume),this.player.emit(ot.volume,this.player.volume),this._prevVolume=e))}closeAudio(){this.hasInitScriptNode&&(this.scriptNode&&this.scriptNode.disconnect(this.gainNode),this.workletProcessorNode&&this.workletProcessorNode.disconnect(this.gainNode),this.gainNode&&(this.gainNode.disconnect(this.mediaStreamAudioDestinationNode),this.$audio||this.gainNode.disconnect(this.audioContext.destination))),this.clear()}audioEnabled(e){if(e&&this.isStateSuspended()){if(this.audioContextContextResumeLock)return;this.audioContextContextResumeLock=!0,this.audioContext.resume().then((()=>{this.player.emit(ot.audioResumeState,{state:this.audioContextState,isRunning:this.isStateRunning()})})).finally((()=>{this.audioContextContextResumeLock=!1})),this.audioResumeStateTimeout=setTimeout((()=>{this.clearAudioResumeStateTimeout(),this.audioContextContextResumeLock=!1,this.isStateSuspended()&&this.player.emit(ot.audioResumeState,{state:this.audioContextState,isRunning:this.isStateRunning()})}),1e3)}}isStateRunning(){return"running"===this.audioContextState}isStateSuspended(){return"suspended"===this.audioContextState}clearAudioResumeStateTimeout(){this.audioResumeStateTimeout&&(clearTimeout(this.audioResumeStateTimeout),this.audioResumeStateTimeout=null)}clear(){this.bufferList=[]}play(e,t){}pause(){this.playing=!1}resume(){this.playing=!0}setRate(e){}getAudioBufferSize(){return 0}}class Xa{constructor(e,t,i,s){this.player=e,this.audio=t,this.channel=i,this.bufferSize=s}destroy(){this.buffer=null,this.channel=null}extract(e,t){let i=this.provide(t);for(let t=0;t=a){try{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:0;const s=2*(t=t||0);i>=0||(i=(e.length-s)/2);const r=2*i;this.ensureCapacity(i+this._frameCount);const o=this.endIndex;this.vector.set(e.subarray(s,s+r),o),this._frameCount+=i}putBuffer(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t=t||0,i>=0||(i=e.frameCount-t),this.putSamples(e.vector,e.position+t,i)}receive(e){e>=0&&!(e>this._frameCount)||(e=this.frameCount),this._frameCount-=e,this._position+=e}receiveSamples(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=2*t,s=this.startIndex;e.set(this._vector.subarray(s,s+i)),this.receive(t)}extract(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.startIndex+2*t,r=2*i;e.set(this._vector.subarray(s,s+r))}ensureCapacity(){const e=parseInt(2*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0));if(this._vector.length0&&void 0!==arguments[0]?arguments[0]:0;this.ensureCapacity(this._frameCount+e)}rewind(){this._position>0&&(this._vector.set(this._vector.subarray(this.startIndex,this.endIndex)),this._position=0)}}class en{constructor(e){e?(this._inputBuffer=new Za,this._outputBuffer=new Za):this._inputBuffer=this._outputBuffer=null}destroy(){this.clear(),this._outputBuffer&&(this._outputBuffer.destroy(),this._outputBuffer=null),this._inputBuffer&&(this._inputBuffer.destroy(),this._inputBuffer=null)}get inputBuffer(){return this._inputBuffer}set inputBuffer(e){this._inputBuffer=e}get outputBuffer(){return this._outputBuffer}set outputBuffer(e){this._outputBuffer=e}clear(){this._inputBuffer.clear(),this._outputBuffer.clear()}}class tn extends en{constructor(e){super(e),this.reset(),this._rate=1}destroy(){super.destroy()}set rate(e){this._rate=e}reset(){this.slopeCount=0,this.prevSampleL=0,this.prevSampleR=0}clone(){const e=new tn;return e.rate=this._rate,e}process(){const e=this._inputBuffer.frameCount;this._outputBuffer.ensureAdditionalCapacity(e/this._rate+1);const t=this.transpose(e);this._inputBuffer.receive(),this._outputBuffer.put(t)}transpose(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(0===e)return 0;const t=this._inputBuffer.vector,i=this._inputBuffer.startIndex,s=this._outputBuffer.vector,r=this._outputBuffer.endIndex;let o=0,a=0;for(;this.slopeCount<1;)s[r+2*a]=(1-this.slopeCount)*this.prevSampleL+this.slopeCount*t[i],s[r+2*a+1]=(1-this.slopeCount)*this.prevSampleR+this.slopeCount*t[i+1],a+=1,this.slopeCount+=this._rate;if(this.slopeCount-=1,1!==e)e:for(;;){for(;this.slopeCount>1;)if(this.slopeCount-=1,o+=1,o>=e-1)break e;const n=i+2*o;s[r+2*a]=(1-this.slopeCount)*t[n]+this.slopeCount*t[n+2],s[r+2*a+1]=(1-this.slopeCount)*t[n+1]+this.slopeCount*t[n+3],a+=1,this.slopeCount+=this._rate}return this.prevSampleL=t[i+2*e-2],this.prevSampleR=t[i+2*e-1],a}}const sn=function(){};class rn extends class{constructor(e){this._pipe=e}destroy(){}get pipe(){return this._pipe}get inputBuffer(){return this._pipe.inputBuffer}get outputBuffer(){return this._pipe.outputBuffer}fillInputBuffer(){throw new Error("fillInputBuffer() not overridden")}fillOutputBuffer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;for(;this.outputBuffer.frameCount2&&void 0!==arguments[2]?arguments[2]:sn;super(t),this.callback=i,this.sourceSound=e,this.historyBufferSize=22050,this._sourcePosition=0,this.outputBufferPosition=0,this._position=0}destroy(){this.clear(),this.sourceSound.destroy(),this.sourceSound=null,this._sourcePosition=0,this.outputBufferPosition=0,this._position=0}get position(){return this._position}set position(e){if(e>this._position)throw new RangeError("New position may not be greater than current position");const t=this.outputBufferPosition-(this._position-e);if(t<0)throw new RangeError("New position falls outside of history buffer");this.outputBufferPosition=t,this._position=e}get sourcePosition(){return this._sourcePosition}set sourcePosition(e){this.clear(),this._sourcePosition=e}onEnd(){this.callback()}fillInputBuffer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=new Float32Array(2*e),i=this.sourceSound.extract(t,e,this._sourcePosition);this._sourcePosition+=i,this.inputBuffer.putSamples(t,0,i)}extract(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillOutputBuffer(this.outputBufferPosition+t);const i=Math.min(t,this.outputBuffer.frameCount-this.outputBufferPosition);this.outputBuffer.extract(e,this.outputBufferPosition,i);const s=this.outputBufferPosition+i;return this.outputBufferPosition=Math.min(this.historyBufferSize,s),this.outputBuffer.receive(Math.max(s-this.historyBufferSize,0)),this._position+=i,i}handleSampleData(e){this.extract(e.data,4096)}clear(){super.clear(),this.outputBufferPosition=0}}const on=[[124,186,248,310,372,434,496,558,620,682,744,806,868,930,992,1054,1116,1178,1240,1302,1364,1426,1488,0],[-100,-75,-50,-25,25,50,75,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-20,-15,-10,-5,5,10,15,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-4,-3,-2,-1,1,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],an=-10/1.5;class nn extends en{constructor(e){super(e),this._quickSeek=!0,this.midBufferDirty=!1,this.midBuffer=null,this.refMidBuffer=null,this.overlapLength=0,this.autoSeqSetting=!0,this.autoSeekSetting=!0,this._tempo=1,this.setParameters(44100,0,0,8)}destroy(){this.clear(),super.destroy()}clear(){super.clear(),this.clearMidBuffer(),this.refMidBuffer=null}clearMidBuffer(){this.midBufferDirty&&(this.midBufferDirty=!1),this.midBuffer=null}setParameters(e,t,i,s){e>0&&(this.sampleRate=e),s>0&&(this.overlapMs=s),t>0?(this.sequenceMs=t,this.autoSeqSetting=!1):this.autoSeqSetting=!0,i>0?(this.seekWindowMs=i,this.autoSeekSetting=!1):this.autoSeekSetting=!0,this.calculateSequenceParameters(),this.calculateOverlapLength(this.overlapMs),this.tempo=this._tempo}set tempo(e){let t;this._tempo=e,this.calculateSequenceParameters(),this.nominalSkip=this._tempo*(this.seekWindowLength-this.overlapLength),this.skipFract=0,t=Math.floor(this.nominalSkip+.5),this.sampleReq=Math.max(t+this.overlapLength,this.seekWindowLength)+this.seekLength}get tempo(){return this._tempo}get inputChunkSize(){return this.sampleReq}get outputChunkSize(){return this.overlapLength+Math.max(0,this.seekWindowLength-2*this.overlapLength)}calculateOverlapLength(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;e=this.sampleRate*t/1e3,e=e<16?16:e,e-=e%8,this.overlapLength=e,this.refMidBuffer=new Float32Array(2*this.overlapLength),this.midBuffer=new Float32Array(2*this.overlapLength)}checkLimits(e,t,i){return ei?i:e}calculateSequenceParameters(){let e,t;this.autoSeqSetting&&(e=150+-50*this._tempo,e=this.checkLimits(e,50,125),this.sequenceMs=Math.floor(e+.5)),this.autoSeekSetting&&(t=28.333333333333332+an*this._tempo,t=this.checkLimits(t,15,25),this.seekWindowMs=Math.floor(t+.5)),this.seekWindowLength=Math.floor(this.sampleRate*this.sequenceMs/1e3),this.seekLength=Math.floor(this.sampleRate*this.seekWindowMs/1e3)}set quickSeek(e){this._quickSeek=e}clone(){const e=new nn;return e.tempo=this._tempo,e.setParameters(this.sampleRate,this.sequenceMs,this.seekWindowMs,this.overlapMs),e}seekBestOverlapPosition(){return this._quickSeek?this.seekBestOverlapPositionStereoQuick():this.seekBestOverlapPositionStereo()}seekBestOverlapPositionStereo(){let e,t,i,s=0;for(this.preCalculateCorrelationReferenceStereo(),e=0,t=Number.MIN_VALUE;st&&(t=i,e=s);return e}seekBestOverlapPositionStereoQuick(){let e,t,i,s,r,o=0;for(this.preCalculateCorrelationReferenceStereo(),t=Number.MIN_VALUE,e=0,s=0,r=0;o<4;o+=1){let a=0;for(;on[o][a]&&(r=s+on[o][a],!(r>=this.seekLength));)i=this.calculateCrossCorrelationStereo(2*r,this.refMidBuffer),i>t&&(t=i,e=r),a+=1;s=e}return e}preCalculateCorrelationReferenceStereo(){let e,t,i=0;for(;i=this.sampleReq;){e=this.seekBestOverlapPosition(),this._outputBuffer.ensureAdditionalCapacity(this.overlapLength),this.overlap(Math.floor(e)),this._outputBuffer.put(this.overlapLength),t=this.seekWindowLength-2*this.overlapLength,t>0&&this._outputBuffer.putBuffer(this._inputBuffer,e+this.overlapLength,t);const s=this._inputBuffer.startIndex+2*(e+this.seekWindowLength-this.overlapLength);this.midBuffer.set(this._inputBuffer.vector.subarray(s,s+2*this.overlapLength)),this.skipFract+=this.nominalSkip,i=Math.floor(this.skipFract),this.skipFract-=i,this._inputBuffer.receive(i)}}}const ln=function(e,t){return(e>t?e-t:t-e)>1e-10};class dn{constructor(){this.transposer=new tn(!1),this.stretch=new nn(!1),this._inputBuffer=new Za,this._intermediateBuffer=new Za,this._outputBuffer=new Za,this._rate=0,this._tempo=0,this.virtualPitch=1,this.virtualRate=1,this.virtualTempo=1,this.calculateEffectiveRateAndTempo()}destroy(){this.clear(),this._inputBuffer.destroy(),this._intermediateBuffer.destroy(),this._outputBuffer.destroy(),this._inputBuffer=null,this._intermediateBuffer=null,this._outputBuffer=null}clear(){this.transposer.clear(),this.stretch.clear()}clone(){const e=new dn;return e.rate=this.rate,e.tempo=this.tempo,e}get rate(){return this._rate}set rate(e){this.virtualRate=e,this.calculateEffectiveRateAndTempo()}set rateChange(e){this._rate=1+.01*e}get tempo(){return this._tempo}set tempo(e){this.virtualTempo=e,this.calculateEffectiveRateAndTempo()}set tempoChange(e){this.tempo=1+.01*e}set pitch(e){this.virtualPitch=e,this.calculateEffectiveRateAndTempo()}set pitchOctaves(e){this.pitch=Math.exp(.69314718056*e),this.calculateEffectiveRateAndTempo()}set pitchSemitones(e){this.pitchOctaves=e/12}get inputBuffer(){return this._inputBuffer}get outputBuffer(){return this._outputBuffer}calculateEffectiveRateAndTempo(){const e=this._tempo,t=this._rate;this._tempo=this.virtualTempo/this.virtualPitch,this._rate=this.virtualRate*this.virtualPitch,ln(this._tempo,e)&&(this.stretch.tempo=this._tempo),ln(this._rate,t)&&(this.transposer.rate=this._rate),this._rate>1?this._outputBuffer!=this.transposer.outputBuffer&&(this.stretch.inputBuffer=this._inputBuffer,this.stretch.outputBuffer=this._intermediateBuffer,this.transposer.inputBuffer=this._intermediateBuffer,this.transposer.outputBuffer=this._outputBuffer):this._outputBuffer!=this.stretch.outputBuffer&&(this.transposer.inputBuffer=this._inputBuffer,this.transposer.outputBuffer=this._intermediateBuffer,this.stretch.inputBuffer=this._intermediateBuffer,this.stretch.outputBuffer=this._outputBuffer)}process(){this._rate>1?(this.stretch.process(),this.transposer.process()):(this.transposer.process(),this.stretch.process())}}class hn{constructor(e,t,i){this.player=e,this.audio=t,this.soundTouch=new dn,this.soundTouch.tempo=1,this.soundTouch.rate=1,this.filter=new rn(i,this.soundTouch)}destroy(){this.filter&&(this.filter.destroy(),this.filter=null),this.soundTouch&&(this.soundTouch.destroy(),this.soundTouch=null)}setRate(e){e!==this.soundTouch.rate&&(this.soundTouch.tempo=e)}provide(e){let t=new Float32Array(2*e),i=this.filter.extract(t,e),s=new Float32Array(i),r=new Float32Array(i);for(let e=0;e{e()})),this.eventListenList=[]),this.$audio&&(this.$audio.pause(),this.$audio.srcObject=null,this.$audio.parentNode&&this.$audio.parentNode.removeChild(this.$audio),this.$audio=null),this.processor&&(this.processor.destroy(),this.processor=null),this.rateProcessor&&(this.rateProcessor.destroy(),this.rateProcessor=null),this.scriptNodeInterval&&(clearInterval(this.scriptNodeInterval),this.scriptNodeInterval=null),this.defaultPlaybackRate=1,this.playbackRate=1,this.scriptStartTime=0,this.audioBufferSize=0,this.engineType=vs,this.player.debugLog("AudioContext","destroy"),!0}isAudioPlaying(){return this.$audio&&ua(this.$audio.paused)&&ua(this.$audio.ended)&&0!==this.$audio.playbackRate&&0!==this.$audio.readyState}_bindAudioProxy(){const{proxy:e}=this.player.events,t=e(this.$audio,"canplay",(()=>{this.player.debugLog("AudioContext","canplay"),this._delayPlay&&this._audioElementPlay()}));this.eventListenList.push(t)}_getAudioElementReadyState(){let e=0;return this.$audio&&(e=this.$audio.readyState),e}audioElementPlay(){if(this.$audio){const e=this._getAudioElementReadyState();if(this.player.debugLog("AudioContext",`play and readyState: ${e}`),!(0!==e||Vo()&&po()))return this.player.debugWarn("AudioContext","readyState is 0 and set _delayPlay to true"),void(this._delayPlay=!0);this._audioElementPlay()}}_audioElementPlay(){this.$audio&&this.$audio.play().then((()=>{this._delayPlay=!1,this.player.debugLog("AudioContext","_audioElementPlay success"),setTimeout((()=>{this.isAudioPlaying()||(this.player.debugWarn("AudioContext","play failed and retry play"),this._audioElementPlay())}),100),this.isAudioPlaying()&&(this.player.debugLog("AudioContext","play success and remove document click event listener"),document.removeEventListener("click",this._audioElementPlay.bind(this)))})).catch((e=>{this.player.debugError("AudioContext","_audioElementPlay error",e),document.addEventListener("click",this._audioElementPlay.bind(this))}))}getAudioBufferSize(){return this.audioBufferSize}get oneBufferDuration(){return this.audioBufferSize/this.audioContext.sampleRate*1e3}get isActiveEngineType(){return this.engineType===_s}getBufferListDuration(){return this.bufferList.length*this.oneBufferDuration}isMoreThanMinBufferDuration(){return this.getBufferListDuration()>=100*this.playbackRate}initProcessor(){this.processor=new Xa(this.player,this,this.audioInfo.channels,this.audioBufferSize),this.rateProcessor=new hn(this.player,this,this.processor)}getAutoAudioEngineType(){let e=this.player._opt.audioEngine||vs;const t=()=>{e=Vo()&&ho()?_s:(po()&&this.player._opt.supportLockScreenPlayAudio||ta()&&this.supportAudioWorklet(),vs)};return this.player._opt.audioEngine?this.player._opt.audioEngine===bs&&ta()&&this.supportAudioWorklet()?e=vs:this.player._opt.audioEngine===_s?e=_s:this.player._opt.audioEngine===vs?e=vs:t():t(),e}getAudioBufferSizeByType(){const e=this.engineType;this.player._opt.hasVideo;const t=this.player._opt.weiXinInAndroidAudioBufferSize;return e===bs?1024:e===_s?t||4800:1024}supportAudioWorklet(){return this.audioContext&&this.audioContext.audioWorklet&&"function"==typeof this.audioContext.audioWorklet.addModule}initScriptNode(){this.playing=!0,this.hasInitScriptNode||(this.initProcessor(),this.engineType===bs?this.initWorkletScriptNode():this.engineType===_s?this.initIntervalScriptNode():this.engineType===vs&&this.initProcessScriptNode(),this.audioElementPlay())}getEngineType(){return this.engineType}isPlaybackRateSpeed(){return this.playbackRate>this.defaultPlaybackRate}initProcessScriptNode(){const e=this.audioContext.createScriptProcessor(this.audioBufferSize,0,this.audioInfo.channels);e.onaudioprocess=e=>{const t=e.outputBuffer;this.handleScriptNodeCallback(t)},e.connect(this.gainNode),this.scriptNode=e,this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.$audio?this.$audio.srcObject=this.mediaStreamAudioDestinationNode.stream:this.gainNode.connect(this.audioContext.destination),this.hasInitScriptNode=!0}initIntervalScriptNode(){this.scriptStartTime=0;const e=1e3*this.audioBufferSize/this.audioContext.sampleRate;this.scriptNodeInterval=setInterval((()=>{if(0===this.bufferList.length||ua(this.playing)||this.isMute)return void(this.playing&&ua(this.isMute)&&this.player.debugLog("AudioContext",`interval script node and bufferList is ${this.bufferList.length} or playing is ${this.playing}`));const e=this.audioContext.createBufferSource(),t=this.audioContext.createBuffer(this.audioInfo.channels,this.audioBufferSize,this.audioContext.sampleRate);this.handleScriptNodeCallback(t,(()=>{this.scriptStartTime{"init"===e.data.message?(this.audioBufferSize=e.data.audioBufferSize,this.start=e.data.start,this.channels=e.data.channels,this.state=0,this.offset=0,this.samplesArray=[]):"stop"===e.data.message?(this.state=0,this.start=!1,this.offset=0,this.samplesArray=[]):"data"===e.data.message?this.samplesArray.push(e.data.buffer):"zero"===e.data.message&&this.samplesArray.push({left:new Float32Array(this.audioBufferSize).fill(0),right:new Float32Array(this.audioBufferSize).fill(0)})}}process(e,t,i){const s=t[0][0],r=t[0][1];if(0===this.offset&&this.port.postMessage({message:"beep"}),0===this.state)this.state=1;else if(1===this.state&&this.samplesArray.length>=4)this.state=2;else if(2===this.state){const e=this.samplesArray[0];for(let t=0;t{if(this.player.isDestroyedOrClosed())return void this.player.debugLog("AudioContext","initWorkletScriptNode() player is destroyed");if(!this.audioContext)return void this.player.debugWarn("AudioContext","initWorkletScriptNode audioContext is null");let e=[1];2===this.audioInfo.channels&&(e=[1,1]);try{this.workletProcessorNode=new AudioWorkletNode(this.audioContext,"worklet-processor",{numberOfOutputs:this.audioInfo.channels,outputChannelCount:e})}catch(e){this.player.debugError("AudioContext","initWorkletScriptNode error",e),this.workletProcessorNode=null,this.tierDownToProcessScript()}this.workletProcessorNode&&(this.workletProcessorNode.connect(this.gainNode),this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.$audio?this.$audio.srcObject=this.mediaStreamAudioDestinationNode.stream:this.gainNode.connect(this.audioContext.destination),this.hasInitScriptNode=!0,this.workletProcessorNode.port.postMessage({message:"init",audioBufferSize:this.audioBufferSize,start:!0,channels:this.audioInfo.channels}),this.workletProcessorNode.port.onmessage=e=>{this.workletProcessorNode?this.audioContext?this.handleScriptNodeCallback(this.workletProcessorNode,null,!0):this.workletProcessorNode.port.postMessage({message:"zero"}):this.player.debugError("AudioContext","workletProcessorNode is null")})})),this.clearWorkletUrlTimeout=setTimeout((()=>{URL.revokeObjectURL(this.workletUrl),this.workletUrl=null,this.clearWorkletUrlTimeout=null}),te)}tierDownToProcessScript(){this.player.debugLog("AudioContext","tierDownToProcessScript"),this.engineType=vs,this.audioBufferSize=this.getAudioBufferSizeByType(),this.initProcessScriptNode(),this.audioElementPlay()}handleScriptNodeCallback(e,t){let i,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t=t||Kr;let r=e.length;s&&(i=e,r=this.audioBufferSize);const o=this.audioInfo.channels;if(this.playing&&this.isMoreThanMinBufferDuration()){if(this.player._opt,this.player.openSyncAudioAndVideo()&&ca(this.player.visibility)){this.calcPlaybackRateBySync();const r=this.player.getAudioSyncVideoDiff();if(r>this.player._opt.syncAudioAndVideoDiff){const a=this.player.getCurrentVideoAndAudio();return this.player.debugWarn("AudioContext",`audioSyncVideoOption more than diff :${r},\n and video is ${a.video} ,\n and audio is ${a.audio} , waiting and bufferList is ${this.bufferList.length}, fill zero`),s?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,o),void t()}}let a=this._provide(r);if(0===a.size)return ua(this.player.isPlaybackOnlyDecodeIFrame())&&this.player.debugWarn("AudioContext",`bufferList size is ${this.bufferList.length} outputBufferLength is ${r},and bufferItem.size is 0, fill zero`),s?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,o),void t();a&&a.ts&&(this.player.audioTimestamp=a.ts),s?i.port.postMessage({message:"data",buffer:a}):this.fillScriptNodeOutputBuffer(e,o,a),t()}else 0===this.bufferList.length&&this.playing&&ua(this.isMute)&&ua(this.player.isPlaybackOnlyDecodeIFrame())&&this.player.debugWarn("AudioContext",`bufferList size is 0 and outputBufferLength is ${r}, fill zero`),s?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,o),t()}fillScriptNodeOutputBuffer(e,t,i){if(1===t){const t=e.getChannelData(0);i?0===i.size?t.fill(0):t.set(i.left):t.fill(0)}else if(2===t){const t=e.getChannelData(0),s=e.getChannelData(1);i?0===i.size?(t.fill(0),s.fill(0)):(t.set(i.left),s.set(i.right)):(t.fill(0),s.fill(0))}}play(e,t){this.isMute||(this.hasInitScriptNode?(this.hasAudio=!0,this.player.latestAudioTimestamp=t,this.bufferList.push({buffer:e,ts:t}),ua(this.player.openSyncAudioAndVideo())&&this.calcPlaybackRateByBuffer()):this.player.debugWarn("AudioContext","play has not init script node"))}calcPlaybackRateBySync(){if(this.isMute)return;if(!this.playing)return;const e=Math.floor(2e3/this.oneBufferDuration);if(this.bufferList.length>e)return this.player.debugWarn("AudioContext",`bufferList length ${this.bufferList.length} more than ${e}, and drop`),void this.clear();const t=this.player.getAudioSyncVideoDiff();if(this.getEngineType()===_s){if(t<-this.player._opt.syncAudioAndVideoDiff){this.player.debugWarn("AudioContext",`engine active , audioSyncVideoOption ${-this.player._opt.syncAudioAndVideoDiff} less than diff :${t},\n and bufferlist is ${this.bufferList.length}`);const e=this.player.getRenderCurrentPts();for(;this.bufferList.length>0;){const t=this.bufferList[0],i=t.ts-e;if(i>-this.player._opt.syncAudioAndVideoDiff/2){this.player.audioTimestamp=t.ts,this.player.debugLog("AudioContext",`engine active , audioSyncVideoOption\n item.ts is ${t.ts} and currentVideoTimestamp is ${e}, diff is ${i} > -${this.player._opt.syncAudioAndVideoDiff/2} and end`);break}this.bufferList.shift(),this.player.audioTimestamp=t.ts}}}else{let e=this.playbackRate;t<-this.player._opt.syncAudioAndVideoDiff?e===this.defaultPlaybackRate&&(this.player.debugLog("AudioContext",`audioSyncVideoOption ${-this.player._opt.syncAudioAndVideoDiff} less than diff :${t},\n speed up, playbackRate is ${e},\n and bufferList is ${this.bufferList.length}`),e=this.defaultPlaybackRate+.2):t>-this.player._opt.syncAudioAndVideoDiff/2&&e!==this.defaultPlaybackRate&&(this.player.debugLog("AudioContext",`diff is ${t} > -${this.player._opt.syncAudioAndVideoDiff/2} and speed to 1`),e=this.defaultPlaybackRate),this.updatePlaybackRate(e)}}calcPlaybackRateByBuffer(){if(this.isMute)return;if(!this.playing)return;let e=this.playbackRate,t=1e3,i=5e3;this.isAudioPlayer&&(t=this.player._opt.videoBufferDelay,i=this.player._opt.videoBufferMax);const s=Math.floor(t/this.oneBufferDuration),r=Math.floor(i/this.oneBufferDuration);if(this.bufferList.length>r)return this.player.debugWarn("AudioContext",`bufferList length ${this.bufferList.length} more than ${r}, and drop`),void this.clear();this.getEngineType()!==_s&&(this.bufferList.length>s?(e=this.defaultPlaybackRate+.2,this.player.debugLog("AudioContext",`bufferList length ${this.bufferList.length} more than ${s}, speed up, playbackRate is ${e}`)):this.bufferList.length0?this.player.emit(ot.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(ot.mute,!0),this.$video.volume=e,this.player.emit(ot.volumechange,this.player.volume),this.player.emit(ot.volume,this.player.volume),this._prevVolume=e))}clear(){}play(e,t){const i=this.player.video.awriter;if(i)if(e.close)try{i.write(e),ea(e)}catch(e){this.player.debugError("Video","play audio error",e)}else try{const s=function(e,t){const i={...t,format:"f32-planar",data:new Float32Array(0)};if(i.numberOfFrames=e[0].length/e.length,1===e.length)i.data=new Float32Array(e[0]);else if(2===e.length){const t=new Float32Array(e[0].length+e[1].length);for(let i=0;i{this.listenPlaybackPause(e)})),this.player.debugLog("AudioPlaybackContext","init")}async destroy(){return this.delayTimeout&&(clearTimeout(this.delayTimeout),this.delayTimeout=null),await super.destroy(),this.player.debugLog("AudioPlaybackLoader","destroy"),!0}listenPlaybackPause(e){e?(this.pause(),this.player.playback.isPlaybackPauseClearCache&&this.clear()):this.resume()}initScriptNodeDelay(){const e=this.player._opt.playbackDelayTime;e>0?this.delayTimeout=setTimeout((()=>{this.initScriptNode()}),e):this.initScriptNode()}setRate(e){e!==this.defaultPlaybackRate&&this.rateProcessor&&(this.player.debugLog("AudioPlaybackContext","setRate",e),this.defaultPlaybackRate=e,this.updatePlaybackRate(e))}}class fn extends cn{constructor(e){super(e),this.TAG_NAME="AudioPlayerLoader",this.isAudioPlayer=!0,this.player.debugLog(this.TAG_NAME,"init")}async destroy(){return await super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy"),!0}play(e,t){ua(this.playing)||super.play(e,t)}pause(){this.player.debugLog(this.TAG_NAME,"pause"),this.playing=!1,this.clear()}resume(){this.player.debugLog(this.TAG_NAME,"resume"),this.playing=!0}}class mn extends Ea{constructor(e){super(),this.TAG_NAME="AudioWebrtcPlayerLoader",this.$video=new Audio,this.player=e,this.init=!1,this._prevVolume=null,this.eventsDestroy=[],this._handleDocumentClickPlay=this._handleClickPlay.bind(this),this._initAudioEvents(),this.player.debugLog(this.TAG_NAME,"init")}async destroy(){return this.resetInit(),this.off(),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this._prevVolume=null,this.$video&&(this.$video.pause(),this.$video.srcObject=null,this.$video=null),this.player.debugLog(this.TAG_NAME,"destroy"),!0}_initAudioEvents(){const{proxy:e}=this.player.events,t=e(this.$video,"timeupdate",(e=>{const t=parseInt(e.timeStamp,10);this.player.handleRender(),this.player.updateStats({ts:t})}));this.eventsDestroy.push(t)}resetInit(){this.init=!1}_handleClickPlay(){this.$video&&(this.$video.play(),document.removeEventListener("click",this._handleDocumentClickPlay))}bindStream(e){this.$video.srcObject=e,this.$video.volume=1,this.$video.play().catch((e=>{this.player.debugWarn(this.TAG_NAME,"audio play error",e),document.addEventListener("click",this._handleDocumentClickPlay)}))}getEngineType(){return"audio"}get isPlaying(){return!0}get volume(){return ca(this.$video.muted)?0:this.$video.volume}get isMute(){return 0===this.$video.volume||ca(this.$video.muted)}mute(e){this.setVolume(e?0:this.player.lastVolume||.5)}setVolume(e){e=parseFloat(e),isNaN(e)||null===this.$video||(this.$video.muted&&(this.$video.muted=!1),e=eo(e,0,1),po()&&(this.$video.muted=0===e),null!==this._prevVolume&&this._prevVolume===e||(null===this._prevVolume?this.player.emit(ot.mute,0===e):0===this._prevVolume&&e>0?this.player.emit(ot.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(ot.mute,!0),this.$video.volume=e,this.player.emit(ot.volumechange,this.player.volume),this.player.emit(ot.volume,this.player.volume),this._prevVolume=e))}pause(){}resume(){}audioEnabled(){this.mute(!1)}}class gn{constructor(e){return new(gn.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.playType===_?e.useMSE&&e.mseDecodeAudio?un:pn:e.playType===v?e.isWebrtc?mn:fn:e.isHls&&ua(e.supportHls265)||e.isWebrtc&&ua(e.isWebrtcH265)||e.useMSE&&e.mseDecodeAudio||e.isAliyunRtc||e.useWCS&&e.wcsDecodeAudio||e.useWasm&&e.wasmPlayAudioUseVideoRender?un:cn}}class yn extends Ea{constructor(e){super(),this.player=e,this.playing=!1,this._requestAbort=!1,this._status=Js,this.writableStream=null,this.abortController=new AbortController,this.streamRate=ro((t=>{e.emit(ot.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,e.debugLog("FetchStream","init")}async destroy(){return this.abort(),await this._closeWritableStream(),this.off(),this._status=Js,this.streamRate=null,this.stopStreamRateInterval(),this.player.debugLog("FetchStream","destroy"),!0}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}async _closeWritableStream(){if(this.writableStream&&ua(this.writableStream.locked))try{await this.writableStream.close(),this.writableStream=null,this.player.debugLog("FetchStream","close writableStream success")}catch(e){this.player.debugLog("FetchStream","destroy and writableStream.close()",e)}}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{demux:i}=this.player;this.player._times.streamStart=Zr();const s=Object.assign({signal:this.abortController.signal},{headers:t.headers||{}});fetch(e,s).then((e=>{if(this._requestAbort)return this._status=Js,void e.body.cancel();if(!function(e){return e.ok&&e.status>=200&&e.status<=299}(e))return this.player.debugError("FetchStream",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),this.abort(),void this.emit(lt.fetchError,`fetch response status is ${e.status} and ok is ${e.ok}`);if(this.emit(ot.streamSuccess),this.startStreamRateInterval(),"undefined"!=typeof WritableStream)this.player.debugLog("FetchStream","use WritableStream() to read stream"),this.writableStream=new WritableStream({write:e=>this.abortController&&this.abortController.signal&&this.abortController.signal.aborted?(this.player.debugLog("FetchStream","writableStream.write() and this.abortController.signal.aborted so return"),void(this._status=Ks)):ca(this._requestAbort)?(this.player.debugLog("FetchStream","writableStream.write() and this._requestAbort is true so return"),this._status=Ks,void this.abort()):"string"!=typeof e?(this._status=qs,this.streamRate&&this.streamRate(e.byteLength),i.dispatch(e)):void this.player.debugWarn("FetchStream",`writableStream.write() and value is "${e}" string so return`),close:()=>{this._status=Ks,i.close(),this.emit(ot.streamEnd,"fetch done")},abort:e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return this.player.debugLog("FetchStream","writableStream.abort() and this.abortController.signal.aborted so return"),void(this._status=Ks);i.close();const t=e.toString();-1===t.indexOf(hs)&&-1===t.indexOf(cs)&&e.name!==us&&(this.abort(),this.emit(lt.fetchError,e))}}),e.body.pipeTo(this.writableStream).catch((e=>{"AbortError"!==e.name&&this.player.debugLog("FetchStream","res.body.pipeTo() error",e.name,e.toString())}));else{this.player.debugLog("FetchStream","not support WritableStream and use getReader() to read stream");const t=e.body.getReader(),s=()=>{t.read().then((e=>{let{done:t,value:r}=e;return t?(this._status=Ks,i.close(),void this.emit(ot.streamEnd,"fetch done")):this.abortController&&this.abortController.signal&&this.abortController.signal.aborted?(this.player.debugLog("FetchStream","reader.read() and this.abortController.signal.aborted so return"),void(this._status=Ks)):ca(this._requestAbort)?(this.player.debugLog("FetchStream","reader.read() and this._requestAbort is true so return"),this._status=Ks,void this.abort()):void("string"!=typeof r?(this._status=qs,this.streamRate&&this.streamRate(r.byteLength),i.dispatch(r),s()):this.player.debugWarn("FetchStream",`reader.read() and value is "${r}" string so return`))})).catch((e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return this.player.debugLog("FetchStream","reader.read().catch() and this.abortController.signal.aborted so return"),void(this._status=Ks);i.close();const t=e.toString();-1===t.indexOf(hs)&&-1===t.indexOf(cs)&&e.name!==us&&(this.abort(),this.emit(lt.fetchError,e))}))};s()}})).catch((e=>{this.abortController&&this.abortController.signal&&this.abortController.signal.aborted||"AbortError"!==e.name&&(i.close(),this.abort(),this.emit(lt.fetchError,e))}))}abort(){if(this._requestAbort=!0,this.abortController)try{this.abortController.abort(),this.abortController=null,this.player.debugLog("FetchStream","abortController.abort() success")}catch(e){this.abortController=null,this.player.debugLog("FetchStream","abortController.abort() error",e)}}getStreamType(){return u}}class An extends Ea{constructor(e){super(),this.TAG_NAME="FetchWorkerLoader",this.player=e,this.playing=!1,this.fetchWorker=null,this.workerClearTimeout=null,this.workerUrl=null,this.destroyResolve=null,this.decoderWorkerCloseTimeout=null,this.abortController=new AbortController,this.streamRate=ro((t=>{e.emit(ot.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,this._initFetchWorker(),e.debugLog(this.TAG_NAME,"init")}destroy(){return new Promise(((e,t)=>{this.fetchWorker?(this.player.debugLog(this.TAG_NAME,"send destroy"),this.fetchWorker.postMessage({cmd:Ze}),this.destroyResolve=e,this.decoderWorkerCloseTimeout=setTimeout((()=>{this.player.debugWarn(this.TAG_NAME,"send close but not response and destroy directly"),this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this._destroy(),setTimeout((()=>{e()}),0)}),2e3)):(this._destroy(),setTimeout((()=>{e()}),0))}))}_destroy(){this.off(),this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this.workerUrl&&(window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this._stopStreamRateInterval(),this.streamRate=null,this.fetchWorker&&(this.fetchWorker.terminate(),this.fetchWorker.onmessage=null,this.fetchWorker=null),this.destroyResolve&&(this.destroyResolve(),this.destroyResolve=null),this.player.debugLog(this.TAG_NAME,"destroy")}_initFetchWorker(){const e=ya(function(){function e(e){return!0===e||"true"===e}const t="The user aborted a request",i="AbortError",s="AbortError",r="fetch",o="destroy",a="destroyEnd",n="buffer",l="fetchError",d="fetchClose",h="fetchSuccess",c="idle",u="buffering",p="complete";let f=new class{constructor(){this._requestAbort=!1,this._status=c,this.writableStream=null,this.isChrome=!1,this.abortController=new AbortController}destroy(){var e;this.abort(),this.writableStream&&(!1===(e=this.writableStream.locked)||"false"===e)&&this.writableStream.close().catch((e=>{})),this.writableStream=null,this._status=c}fetchStream(r){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=Object.assign({signal:this.abortController.signal},{headers:o.headers||{}});fetch(r,a).then((r=>{if(this._requestAbort)return this._status=c,void r.body.cancel();if(!function(e){return e.ok&&e.status>=200&&e.status<=299}(r))return this.abort(),void postMessage({cmd:l,message:`fetch response status is ${r.status} and ok is ${r.ok}`});if(postMessage({cmd:h}),"undefined"!=typeof WritableStream)this.writableStream=new WritableStream({write:t=>{if(!(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted))return e(this._requestAbort)?(this._status=p,void this.abort()):void("string"!=typeof t&&(this._status=u,postMessage({cmd:n,buffer:t},[t.buffer])));this._status=p},close:()=>{this._status=p,postMessage({cmd:d})},abort:e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return void(this._status=p);const r=e.toString();-1===r.indexOf(t)&&-1===r.indexOf(i)&&e.name!==s&&(this.abort(),postMessage({cmd:l,message:e.toString()}))}}),r.body.pipeTo(this.writableStream).catch((e=>{}));else{const o=r.body.getReader(),a=()=>{o.read().then((t=>{let{done:i,value:s}=t;return i?(this._status=p,void postMessage({cmd:d})):this.abortController&&this.abortController.signal&&this.abortController.signal.aborted?void(this._status=p):e(this._requestAbort)?(this._status=p,void this.abort()):void("string"!=typeof s&&(this._status=u,postMessage({cmd:n,buffer:s},[s.buffer]),a()))})).catch((e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return void(this._status=p);const r=e.toString();-1===r.indexOf(t)&&-1===r.indexOf(i)&&e.name!==s&&(this.abort(),postMessage({cmd:l,message:e.toString()}))}))};a()}})).catch((e=>{this.abortController&&this.abortController.signal&&this.abortController.signal.aborted||"AbortError"!==e.name&&(this.abort(),postMessage({cmd:l,message:e.toString()}))}))}abort(){if(this._requestAbort=!0,this.abortController)try{this.abortController.abort(),this.abortController=null}catch(e){this.abortController=null}}};self.onmessage=t=>{const i=t.data;switch(i.cmd){case r:f.isChrome=e(i.isChrome),f.fetchStream(i.url,JSON.parse(i.options));break;case o:f.destroy(),f=null,postMessage({cmd:a})}}}.toString()),t=new Blob([e],{type:"text/javascript"});let i=URL.createObjectURL(t);const s=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((()=>{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),te),s.onmessage=e=>{const{demux:t}=this.player,i=e.data;switch(i.cmd){case tt:this.streamRate&&this.streamRate(i.buffer.byteLength),t.dispatch(i.buffer);break;case rt:this.emit(ot.streamSuccess),this._startStreamRateInterval();break;case st:t.close(),this.emit(ot.streamEnd,"fetch done");break;case it:t.close(),this.emit(lt.fetchError,i.message);break;case et:this._destroy()}},this.fetchWorker=s}_startStreamRateInterval(){this._stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}_stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player._times.streamStart=Zr(),this.fetchWorker.postMessage({cmd:Xe,url:e,isChrome:Ho(),options:JSON.stringify(t)})}getStreamType(){return u}}class bn extends Ea{constructor(e){super(),this.player=e,this.socket=null,this.socketStatus=dt,this.wsUrl=null,this.requestAbort=!1,this.socketDestroyFnList=[],this.streamRate=ro((t=>{e.emit(ot.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,e.debugLog("WebsocketStream","init")}async destroy(){this._closeWebSocket(),this.stopStreamRateInterval(),this.wsUrl=null,this.off(),this.player.debugLog("WebsocketStream","destroy")}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}_createWebSocket(e){const t=this.player,{events:{proxy:i},demux:s}=t,r=e.protocols||[];this.socket=new WebSocket(this.wsUrl,r),this.socket.binaryType="arraybuffer";const o=i(this.socket,"open",(()=>{this.player.debugLog("WebsocketStream","socket open"),this.socketStatus=ht,this.emit(ot.streamSuccess),this.player.emit(ot.websocketOpen),this.startStreamRateInterval()})),a=i(this.socket,"message",(e=>{"string"!=typeof e.data?(this.streamRate&&this.streamRate(e.data.byteLength),this._handleMessage(e.data)):this.player.debugWarn("WebsocketStream",`websocket handle message message is "${e.data}" string so return`)})),n=i(this.socket,"close",(e=>{if(!this.player.isDestroyedOrClosed())if(this.socketStatus!==ut){if(this.player.debugLog("WebsocketStream",`socket close and code is ${e.code}`),1006===e.code&&this.player.debugError("WebsocketStream",`socket close abnormally and code is ${e.code}`),ca(this.requestAbort))return this.requestAbort=!1,void this.player.debugLog("WebsocketStream","socket close and requestAbort is true");s.close(),this.socketStatus=ct,this.player.emit(ot.websocketClose,e.code),this.emit(ot.streamEnd,e.code)}else this.player.debugLog("WebsocketStream","socket close and status is error, so return")})),l=i(this.socket,"error",(e=>{this.player.isDestroyedOrClosed()||(this.player.debugError("WebsocketStream","socket error",e),this.socketStatus=ut,this.emit(lt.websocketError,e),s.close(),this.player.debugLog("WebsocketStream","socket error:",e.isTrusted?"websocket user aborted":"websocket error"))}));this.socketDestroyFnList.push(o,a,n,l)}_closeWebSocket(){this.socketDestroyFnList.forEach((e=>e())),!this.socket||0!==this.socket.readyState&&1!==this.socket.readyState?this.socket&&this.player.debugLog("WebsocketStream",`_closeWebSocket() socket is null or socket status is ${this.socket&&this.socket.readyState}`):(this.requestAbort=!0,this.socket.close(1e3,"Client disconnecting")),this.socket=null,this.socketStatus=dt,this.streamRate=null}_handleMessage(e){const{demux:t}=this.player;t?t.dispatch(e):this.player.debugWarn("WebsocketStream","websocket handle message demux is null so return")}fetchStream(e,t){this.player._times.streamStart=Zr(),this.wsUrl=e,this._createWebSocket(t)}sendMessage(e){this.socket?this.socketStatus===ht?this.socket.send(e):this.player.debugError("WebsocketStream",`websocket send message error and socket status is ${this.socketStatus}`):this.player.debugError("WebsocketStream","websocket send message socket is null")}resetFetchStream(){this._closeWebSocket(),this._createWebSocket()}getStreamType(){return f}}class vn extends Ea{constructor(e){super(),this.player=e,e.debugLog("HlsStream","init")}async destroy(){return this.off(),this.player.debugLog("HlsStream","destroy"),!0}fetchStream(e){const{hlsDecoder:t,debug:i}=this.player;this.player._times.streamStart=Zr(),t.loadSource(e).then((()=>{this.player.debugLog("HlsStream","loadSource success"),this.emit(ot.streamSuccess)})).catch((e=>{this.emit(lt.hlsError,e)}))}getStreamType(){return p}}class _n extends Ea{constructor(e){super(),this.player=e,this.webrctUrl=null,e.debugLog("WebrtcStream","init")}async destroy(){return this.webrctUrl=null,this.off(),this.player.debugLog("WebrtcStream","destroy"),!0}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{webrtc:i,debug:s}=this.player;if(this.player._times.streamStart=Zr(),this.webrctUrl=e.replace("webrtc:",window.location.protocol),this.player.isWebrtcForM7S()&&-1===this.webrctUrl.indexOf("/webrtc/play")){const t=new URL(this.webrctUrl),i="/webrtc/play"+t.pathname;this.webrctUrl=t.origin+i+t.search,this.player.debugLog("WebrtcStream",`original url is ${e}, and new url is: ${this.webrctUrl}`)}i.loadSource(this.webrctUrl,t).then((()=>{this.player.debugLog("WebrtcStream","loadSource success"),this.emit(ot.streamSuccess)})).catch((e=>{this.player.debugError("WebrtcStream","loadSource error",e),this.emit(lt.webrtcError,e)}))}getStreamType(){return m}}class Sn extends Ea{constructor(e){super(),this.player=e,this.transport=null,this.wtUrl=null,this.streamRate=ro((t=>{e.emit(ot.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,e.debugLog("WebTransportLoader","init")}async destroy(){return this.abort(),this.off(),this.player.debugLog("WebTransportLoader","destroy"),!0}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}_createWebTransport(){const e=this.player,{debug:t,events:{proxy:i},demux:s}=e;try{this.transport=new WebTransport(this.wtUrl),this.transport.ready.then((()=>{this.emit(ot.streamSuccess),this.startStreamRateInterval(),this.transport.createBidirectionalStream().then((e=>{e.readable.pipeTo(new WritableStream(s.input))}))})).catch((e=>{this.player.debugWarn("WebTransportLoader","_createWebTransport-ready",e)}))}catch(e){this.player.debugWarn("WebTransportLoader","_createWebTransport",e)}}fetchStream(e){this.player._times.streamStart=Zr(),this.wtUrl=e.replace(/^wt:/,"https:"),this._createWebTransport()}abort(){if(this.transport)try{this.transport.close(),this.transport=null}catch(e){this.transport=null}}getStreamType(){return g}}class En extends Ea{constructor(e){super(),this.player=e,this.workUrl=null,e.debugLog("WorkerStream","init")}async destroy(){return this.workUrl=null,this.off(),this.player.debugLog("WorkerStream","destroy"),!0}sendMessage(e){this.player.decoderWorker.workerSendMessage(e)}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.workUrl=e,this.player._times.streamStart=Zr(),this.player.decoderWorker.workerFetchStream(e,t)}getStreamType(){const e=this.player._opt.protocol;return y+" "+(e===a?u:f)}}class wn extends Ea{constructor(e){super(),this.TAG_NAME="AliyunRtcLoader",this.player=e,e.debugLog(this.TAG_NAME,"init")}async destroy(){return this.off(),this.player.debugLog(this.TAG_NAME,"destroy"),!0}fetchStream(e){const{aliyunRtcDecoder:t}=this.player;this.player._times.streamStart=Zr(),t.loadSource(e).then((()=>{this.player.debugLog(this.TAG_NAME,"loadSource success"),this.emit(ot.streamSuccess)})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource error",e),this.emit(lt.aliyunRtcError,e)}))}getStreamType(){return A}}class Tn{constructor(e){return new(Tn.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){const{protocol:t,useWasm:i,playType:s,useWCS:r,useMSE:c,demuxUseWorker:u,mainThreadFetchUseWorker:p}=e;return t===a?s===v?En:s===b?i&&!Qo(e)||u?En:p?An:yn:r||c?u?En:p?An:yn:En:t===o?s===v?En:s===b?i&&!Qo(e)||u?En:bn:r||c?u?En:bn:En:t===n?vn:t===l?_n:t===d?Sn:t===h?wn:void 0}}var kn=kr((function(e){function t(e,r){if(!e)throw"First parameter is required.";r=new i(e,r=r||{type:"video"});var o=this;function a(t){t&&(r.initCallback=function(){t(),t=r.initCallback=null});var i=new s(e,r);(p=new i(e,r)).record(),u("recording"),r.disableLogs||console.log("Initialized recorderType:",p.constructor.name,"for output-type:",r.type)}function n(e){if(e=e||function(){},p){if("paused"===o.state)return o.resumeRecording(),void setTimeout((function(){n(e)}),1);"recording"===o.state||r.disableLogs||console.warn('Recording state should be: "recording", however current state is: ',o.state),r.disableLogs||console.log("Stopped recording "+r.type+" stream."),"gif"!==r.type?p.stop(t):(p.stop(),t()),u("stopped")}else m();function t(t){if(p){Object.keys(p).forEach((function(e){"function"!=typeof p[e]&&(o[e]=p[e])}));var i=p.blob;if(!i){if(!t)throw"Recording failed.";p.blob=i=t}if(i&&!r.disableLogs&&console.log(i.type,"->",y(i.size)),e){var s;try{s=h.createObjectURL(i)}catch(e){}"function"==typeof e.call?e.call(o,s):e(s)}r.autoWriteToDisk&&d((function(e){var t={};t[r.type+"Blob"]=e,D.Store(t)}))}else"function"==typeof e.call?e.call(o,""):e("")}}function l(e){postMessage((new FileReaderSync).readAsDataURL(e))}function d(e,t){if(!e)throw"Pass a callback function over getDataURL.";var i=t?t.blob:(p||{}).blob;if(!i)return r.disableLogs||console.warn("Blob encoder did not finish its job yet."),void setTimeout((function(){d(e,t)}),1e3);if("undefined"==typeof Worker||navigator.mozGetUserMedia){var s=new FileReader;s.readAsDataURL(i),s.onload=function(t){e(t.target.result)}}else{var o=function(e){try{var t=h.createObjectURL(new Blob([e.toString(),"this.onmessage = function (eee) {"+e.name+"(eee.data);}"],{type:"application/javascript"})),i=new Worker(t);return h.revokeObjectURL(t),i}catch(e){}}(l);o.onmessage=function(t){e(t.data)},o.postMessage(i)}}function c(e){e=e||0,"paused"!==o.state?"stopped"!==o.state&&(e>=o.recordingDuration?n(o.onRecordingStopped):(e+=1e3,setTimeout((function(){c(e)}),1e3))):setTimeout((function(){c(e)}),1e3)}function u(e){o&&(o.state=e,"function"==typeof o.onStateChanged.call?o.onStateChanged.call(o,e):o.onStateChanged(e))}var p,f='It seems that recorder is destroyed or "startRecording" is not invoked for '+r.type+" recorder.";function m(){!0!==r.disableLogs&&console.warn(f)}var g={startRecording:function(t){return r.disableLogs||console.log("RecordRTC version: ",o.version),t&&(r=new i(e,t)),r.disableLogs||console.log("started recording "+r.type+" stream."),p?(p.clearRecordedData(),p.record(),u("recording"),o.recordingDuration&&c(),o):(a((function(){o.recordingDuration&&c()})),o)},stopRecording:n,pauseRecording:function(){p?"recording"===o.state?(u("paused"),p.pause(),r.disableLogs||console.log("Paused recording.")):r.disableLogs||console.warn("Unable to pause the recording. Recording state: ",o.state):m()},resumeRecording:function(){p?"paused"===o.state?(u("recording"),p.resume(),r.disableLogs||console.log("Resumed recording.")):r.disableLogs||console.warn("Unable to resume the recording. Recording state: ",o.state):m()},initRecorder:a,setRecordingDuration:function(e,t){if(void 0===e)throw"recordingDuration is required.";if("number"!=typeof e)throw"recordingDuration must be a number.";return o.recordingDuration=e,o.onRecordingStopped=t||function(){},{onRecordingStopped:function(e){o.onRecordingStopped=e}}},clearRecordedData:function(){p?(p.clearRecordedData(),r.disableLogs||console.log("Cleared old recorded data.")):m()},getBlob:function(){if(p)return p.blob;m()},getDataURL:d,toURL:function(){if(p)return h.createObjectURL(p.blob);m()},getInternalRecorder:function(){return p},save:function(e){p?A(p.blob,e):m()},getFromDisk:function(e){p?t.getFromDisk(r.type,e):m()},setAdvertisementArray:function(e){r.advertisement=[];for(var t=e.length,i=0;i-1&&"netscape"in window&&/ rv:/.test(navigator.userAgent),f=!u&&!c&&!!navigator.webkitGetUserMedia||b()||-1!==navigator.userAgent.toLowerCase().indexOf("chrome/"),m=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);m&&!f&&-1!==navigator.userAgent.indexOf("CriOS")&&(m=!1,f=!0);var g=window.MediaStream;function y(e){if(0===e)return"0 Bytes";var t=parseInt(Math.floor(Math.log(e)/Math.log(1e3)),10);return(e/Math.pow(1e3,t)).toPrecision(3)+" "+["Bytes","KB","MB","GB","TB"][t]}function A(e,t){if(!e)throw"Blob object is required.";if(!e.type)try{e.type="video/webm"}catch(e){}var i=(e.type||"video/webm").split("/")[1];if(-1!==i.indexOf(";")&&(i=i.split(";")[0]),t&&-1!==t.indexOf(".")){var s=t.split(".");t=s[0],i=s[1]}var r=(t||Math.round(9999999999*Math.random())+888888888)+"."+i;if(void 0!==navigator.msSaveOrOpenBlob)return navigator.msSaveOrOpenBlob(e,r);if(void 0!==navigator.msSaveBlob)return navigator.msSaveBlob(e,r);var o=document.createElement("a");o.href=h.createObjectURL(e),o.download=r,o.style="display:none;opacity:0;color:transparent;",(document.body||document.documentElement).appendChild(o),"function"==typeof o.click?o.click():(o.target="_blank",o.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}))),h.revokeObjectURL(o.href)}function b(){return"undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type||(!("undefined"==typeof process||"object"!=typeof process.versions||!process.versions.electron)||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}function v(e,t){return e&&e.getTracks?e.getTracks().filter((function(e){return e.kind===(t||"audio")})):[]}function _(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}void 0===g&&"undefined"!=typeof webkitMediaStream&&(g=webkitMediaStream),void 0!==g&&void 0===g.prototype.stop&&(g.prototype.stop=function(){this.getTracks().forEach((function(e){e.stop()}))}),t.invokeSaveAsDialog=A,t.getTracks=v,t.getSeekableBlob=function(e,t){if("undefined"==typeof EBML)throw new Error("Please link: https://www.webrtc-experiment.com/EBML.js");var i=new EBML.Reader,s=new EBML.Decoder,r=EBML.tools,o=new FileReader;o.onload=function(e){s.decode(this.result).forEach((function(e){i.read(e)})),i.stop();var o=r.makeMetadataSeekable(i.metadatas,i.duration,i.cues),a=this.result.slice(i.metadataSize),n=new Blob([o,a],{type:"video/webm"});t(n)},o.readAsArrayBuffer(e)},t.bytesToSize=y,t.isElectron=b;var S={};function E(){if(p||m||c)return!0;var e,t,i=navigator.userAgent,s=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10);return(f||u)&&(e=i.indexOf("Chrome"),s=i.substring(e+7)),-1!==(t=s.indexOf(";"))&&(s=s.substring(0,t)),-1!==(t=s.indexOf(" "))&&(s=s.substring(0,t)),r=parseInt(""+s,10),isNaN(r)&&(s=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10)),r>=49}function w(e,t){var i=this;if(void 0===e)throw'First argument "MediaStream" is required.';if("undefined"==typeof MediaRecorder)throw"Your browser does not support the Media Recorder API. Please try other modules e.g. WhammyRecorder or StereoAudioRecorder.";if("audio"===(t=t||{mimeType:"video/webm"}).type){var s;if(v(e,"video").length&&v(e,"audio").length)navigator.mozGetUserMedia?(s=new g).addTrack(v(e,"audio")[0]):s=new g(v(e,"audio")),e=s;t.mimeType&&-1!==t.mimeType.toString().toLowerCase().indexOf("audio")||(t.mimeType=f?"audio/webm":"audio/ogg"),t.mimeType&&"audio/ogg"!==t.mimeType.toString().toLowerCase()&&navigator.mozGetUserMedia&&(t.mimeType="audio/ogg")}var r,o=[];function a(){i.timestamps.push((new Date).getTime()),"function"==typeof t.onTimeStamp&&t.onTimeStamp(i.timestamps[i.timestamps.length-1],i.timestamps)}function n(e){return r&&r.mimeType?r.mimeType:e.mimeType||"video/webm"}function l(){o=[],r=null,i.timestamps=[]}this.getArrayOfBlobs=function(){return o},this.record=function(){i.blob=null,i.clearRecordedData(),i.timestamps=[],d=[],o=[];var s=t;t.disableLogs||console.log("Passing following config over MediaRecorder API.",s),r&&(r=null),f&&!E()&&(s="video/vp8"),"function"==typeof MediaRecorder.isTypeSupported&&s.mimeType&&(MediaRecorder.isTypeSupported(s.mimeType)||(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",s.mimeType),s.mimeType="audio"===t.type?"audio/webm":"video/webm"));try{r=new MediaRecorder(e,s),t.mimeType=s.mimeType}catch(t){r=new MediaRecorder(e)}s.mimeType&&!MediaRecorder.isTypeSupported&&"canRecordMimeType"in r&&!1===r.canRecordMimeType(s.mimeType)&&(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",s.mimeType)),r.ondataavailable=function(e){if(e.data&&d.push("ondataavailable: "+y(e.data.size)),"number"!=typeof t.timeSlice)!e.data||!e.data.size||e.data.size<100||i.blob?i.recordingCallback&&(i.recordingCallback(new Blob([],{type:n(s)})),i.recordingCallback=null):(i.blob=t.getNativeBlob?e.data:new Blob([e.data],{type:n(s)}),i.recordingCallback&&(i.recordingCallback(i.blob),i.recordingCallback=null));else if(e.data&&e.data.size&&(o.push(e.data),a(),"function"==typeof t.ondataavailable)){var r=t.getNativeBlob?e.data:new Blob([e.data],{type:n(s)});t.ondataavailable(r)}},r.onstart=function(){d.push("started")},r.onpause=function(){d.push("paused")},r.onresume=function(){d.push("resumed")},r.onstop=function(){d.push("stopped")},r.onerror=function(e){e&&(e.name||(e.name="UnknownError"),d.push("error: "+e),t.disableLogs||(-1!==e.name.toString().toLowerCase().indexOf("invalidstate")?console.error("The MediaRecorder is not in a state in which the proposed operation is allowed to be executed.",e):-1!==e.name.toString().toLowerCase().indexOf("notsupported")?console.error("MIME type (",s.mimeType,") is not supported.",e):-1!==e.name.toString().toLowerCase().indexOf("security")?console.error("MediaRecorder security error",e):"OutOfMemory"===e.name?console.error("The UA has exhaused the available memory. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"IllegalStreamModification"===e.name?console.error("A modification to the stream has occurred that makes it impossible to continue recording. An example would be the addition of a Track while recording is occurring. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"OtherRecordingError"===e.name?console.error("Used for an fatal error other than those listed above. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"GenericError"===e.name?console.error("The UA cannot provide the codec or recording option that has been requested.",e):console.error("MediaRecorder Error",e)),function(e){if(!i.manuallyStopped&&r&&"inactive"===r.state)return delete t.timeslice,void r.start(6e5);setTimeout(void 0,1e3)}(),"inactive"!==r.state&&"stopped"!==r.state&&r.stop())},"number"==typeof t.timeSlice?(a(),r.start(t.timeSlice)):r.start(36e5),t.initCallback&&t.initCallback()},this.timestamps=[],this.stop=function(e){e=e||function(){},i.manuallyStopped=!0,r&&(this.recordingCallback=e,"recording"===r.state&&r.stop(),"number"==typeof t.timeSlice&&setTimeout((function(){i.blob=new Blob(o,{type:n(t)}),i.recordingCallback(i.blob)}),100))},this.pause=function(){r&&"recording"===r.state&&r.pause()},this.resume=function(){r&&"paused"===r.state&&r.resume()},this.clearRecordedData=function(){r&&"recording"===r.state&&i.stop(l),l()},this.getInternalRecorder=function(){return r},this.blob=null,this.getState=function(){return r&&r.state||"inactive"};var d=[];this.getAllStates=function(){return d},void 0===t.checkForInactiveTracks&&(t.checkForInactiveTracks=!1);i=this;!function s(){if(r&&!1!==t.checkForInactiveTracks)return!1===function(){if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}()?(t.disableLogs||console.log("MediaStream seems stopped."),void i.stop()):void setTimeout(s,1e3)}(),this.name="MediaStreamRecorder",this.toString=function(){return this.name}}function T(e,i){if(!v(e,"audio").length)throw"Your stream has no audio tracks.";var s,r=this,o=[],a=[],n=!1,l=0,d=2,c=(i=i||{}).desiredSampRate;function u(){if(!1===i.checkForInactiveTracks)return!0;if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}function p(e,t){function i(e,t){var i,s=e.numberOfAudioChannels,r=e.leftBuffers.slice(0),o=e.rightBuffers.slice(0),a=e.sampleRate,n=e.internalInterleavedLength,l=e.desiredSampRate;function d(e,t,i){var s=Math.round(e.length*(t/i)),r=[],o=Number((e.length-1)/(s-1));r[0]=e[0];for(var a=1;a96e3)&&(i.disableLogs||console.log("sample-rate must be under range 22050 and 96000.")),i.disableLogs||i.desiredSampRate&&console.log("Desired sample-rate: "+i.desiredSampRate);var b=!1;function _(){o=[],a=[],l=0,E=!1,n=!1,b=!1,f=null,r.leftchannel=o,r.rightchannel=a,r.numberOfAudioChannels=d,r.desiredSampRate=c,r.sampleRate=A,r.recordingLength=l,w={left:[],right:[],recordingLength:0}}function S(){s&&(s.onaudioprocess=null,s.disconnect(),s=null),m&&(m.disconnect(),m=null),_()}this.pause=function(){b=!0},this.resume=function(){if(!1===u())throw"Please make sure MediaStream is active.";if(!n)return i.disableLogs||console.log("Seems recording has been restarted."),void this.record();b=!1},this.clearRecordedData=function(){i.checkForInactiveTracks=!1,n&&this.stop(S),S()},this.name="StereoAudioRecorder",this.toString=function(){return this.name};var E=!1;s.onaudioprocess=function(e){if(!b)if(!1===u()&&(i.disableLogs||console.log("MediaStream seems stopped."),s.disconnect(),n=!1),n){E||(E=!0,i.onAudioProcessStarted&&i.onAudioProcessStarted(),i.initCallback&&i.initCallback());var t=e.inputBuffer.getChannelData(0),h=new Float32Array(t);if(o.push(h),2===d){var c=e.inputBuffer.getChannelData(1),p=new Float32Array(c);a.push(p)}l+=y,r.recordingLength=l,void 0!==i.timeSlice&&(w.recordingLength+=y,w.left.push(h),2===d&&w.right.push(p))}else m&&(m.disconnect(),m=null)},f.createMediaStreamDestination?s.connect(f.createMediaStreamDestination()):s.connect(f.destination),this.leftchannel=o,this.rightchannel=a,this.numberOfAudioChannels=d,this.desiredSampRate=c,this.sampleRate=A,r.recordingLength=l;var w={left:[],right:[],recordingLength:0};function T(){n&&"function"==typeof i.ondataavailable&&void 0!==i.timeSlice&&(w.left.length?(p({desiredSampRate:c,sampleRate:A,numberOfAudioChannels:d,internalInterleavedLength:w.recordingLength,leftBuffers:w.left,rightBuffers:1===d?[]:w.right},(function(e,t){var s=new Blob([t],{type:"audio/wav"});i.ondataavailable(s),setTimeout(T,i.timeSlice)})),w={left:[],right:[],recordingLength:0}):setTimeout(T,i.timeSlice))}}function k(e,t){if("undefined"==typeof html2canvas)throw"Please link: https://www.webrtc-experiment.com/screenshot.js";(t=t||{}).frameInterval||(t.frameInterval=10);var i=!1;["captureStream","mozCaptureStream","webkitCaptureStream"].forEach((function(e){e in document.createElement("canvas")&&(i=!0)}));var s,r,o,a=!(!window.webkitRTCPeerConnection&&!window.webkitGetUserMedia||!window.chrome),n=50,l=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);if(a&&l&&l[2]&&(n=parseInt(l[2],10)),a&&n<52&&(i=!1),t.useWhammyRecorder&&(i=!1),i)if(t.disableLogs||console.log("Your browser supports both MediRecorder API and canvas.captureStream!"),e instanceof HTMLCanvasElement)s=e;else{if(!(e instanceof CanvasRenderingContext2D))throw"Please pass either HTMLCanvasElement or CanvasRenderingContext2D.";s=e.canvas}else navigator.mozGetUserMedia&&(t.disableLogs||console.error("Canvas recording is NOT supported in Firefox."));this.record=function(){if(o=!0,i&&!t.useWhammyRecorder){var e;"captureStream"in s?e=s.captureStream(25):"mozCaptureStream"in s?e=s.mozCaptureStream(25):"webkitCaptureStream"in s&&(e=s.webkitCaptureStream(25));try{var a=new g;a.addTrack(v(e,"video")[0]),e=a}catch(e){}if(!e)throw"captureStream API are NOT available.";(r=new w(e,{mimeType:t.mimeType||"video/webm"})).record()}else p.frames=[],u=(new Date).getTime(),c();t.initCallback&&t.initCallback()},this.getWebPImages=function(i){if("canvas"===e.nodeName.toLowerCase()){var s=p.frames.length;p.frames.forEach((function(e,i){var r=s-i;t.disableLogs||console.log(r+"/"+s+" frames remaining"),t.onEncodingCallback&&t.onEncodingCallback(r,s);var o=e.image.toDataURL("image/webp",1);p.frames[i].image=o})),t.disableLogs||console.log("Generating WebM"),i()}else i()},this.stop=function(e){o=!1;var s=this;i&&r?r.stop(e):this.getWebPImages((function(){p.compile((function(i){t.disableLogs||console.log("Recording finished!"),s.blob=i,s.blob.forEach&&(s.blob=new Blob([],{type:"video/webm"})),e&&e(s.blob),p.frames=[]}))}))};var d=!1;function h(){p.frames=[],o=!1,d=!1}function c(){if(d)return u=(new Date).getTime(),setTimeout(c,500);if("canvas"===e.nodeName.toLowerCase()){var i=(new Date).getTime()-u;return u=(new Date).getTime(),p.frames.push({image:(s=document.createElement("canvas"),r=s.getContext("2d"),s.width=e.width,s.height=e.height,r.drawImage(e,0,0),s),duration:i}),void(o&&setTimeout(c,t.frameInterval))}var s,r;html2canvas(e,{grabMouse:void 0===t.showMousePointer||t.showMousePointer,onrendered:function(e){var i=(new Date).getTime()-u;if(!i)return setTimeout(c,t.frameInterval);u=(new Date).getTime(),p.frames.push({image:e.toDataURL("image/webp",1),duration:i}),o&&setTimeout(c,t.frameInterval)}})}this.pause=function(){d=!0,r instanceof w&&r.pause()},this.resume=function(){d=!1,r instanceof w?r.resume():o||this.record()},this.clearRecordedData=function(){o&&this.stop(h),h()},this.name="CanvasRecorder",this.toString=function(){return this.name};var u=(new Date).getTime(),p=new C.Video(100)}function L(e,t){function i(e){e=void 0!==e?e:10;var t=(new Date).getTime()-l;return t?o?(l=(new Date).getTime(),setTimeout(i,100)):(l=(new Date).getTime(),n.paused&&n.play(),c.drawImage(n,0,0,h.width,h.height),d.frames.push({duration:t,image:h.toDataURL("image/webp")}),void(r||setTimeout(i,e,e))):setTimeout(i,e,e)}function s(e,t,i,s,r){var o=document.createElement("canvas");o.width=h.width,o.height=h.height;var a=o.getContext("2d"),n=[],l=-1===t,d=t&&t>0&&t<=e.length?t:e.length,c=0,u=0,p=0,f=Math.sqrt(Math.pow(255,2)+Math.pow(255,2)+Math.pow(255,2)),m=i&&i>=0&&i<=1?i:0,g=s&&s>=0&&s<=1?s:0,y=!1;!function(e){var t=-1,i=e.length;!function s(){++t!==i?setTimeout((function(){e.functionToLoop(s,t)}),1):e.callback()}()}({length:d,functionToLoop:function(t,i){var s,r,o,d=function(){!y&&o-s<=o*g||(l&&(y=!0),n.push(e[i])),t()};if(y)d();else{var A=new Image;A.onload=function(){a.drawImage(A,0,0,h.width,h.height);var e=a.getImageData(0,0,h.width,h.height);s=0,r=e.data.length,o=e.data.length/4;for(var t=0;t127)throw"TrackNumber > 127 not supported";return[128|e.trackNum,e.timecode>>8,255&e.timecode,t].map((function(e){return String.fromCharCode(e)})).join("")+e.frame}({discardable:0,frame:e.data.slice(4),invisible:0,keyframe:1,lacing:0,trackNum:1,timecode:Math.round(t)});return t+=e.duration,{data:i,id:163}})))}function i(e){for(var t=[];e>0;)t.push(255&e),e>>=8;return new Uint8Array(t.reverse())}function s(e){var t=[];e=(e.length%8?new Array(9-e.length%8).join("0"):"")+e;for(var i=0;i1?2*o[0].width:o[0].width;var n=1;3!==e&&4!==e||(n=2),5!==e&&6!==e||(n=3),7!==e&&8!==e||(n=4),9!==e&&10!==e||(n=5),r.height=o[0].height*n}else r.width=a.width||360,r.height=a.height||240;t&&t instanceof HTMLVideoElement&&u(t),o.forEach((function(e,t){u(e,t)})),setTimeout(c,a.frameInterval)}}function u(e,t){if(!s){var i=0,r=0,a=e.width,n=e.height;1===t&&(i=e.width),2===t&&(r=e.height),3===t&&(i=e.width,r=e.height),4===t&&(r=2*e.height),5===t&&(i=e.width,r=2*e.height),6===t&&(r=3*e.height),7===t&&(i=e.width,r=3*e.height),void 0!==e.stream.left&&(i=e.stream.left),void 0!==e.stream.top&&(r=e.stream.top),void 0!==e.stream.width&&(a=e.stream.width),void 0!==e.stream.height&&(n=e.stream.height),o.drawImage(e,i,r,a,n),"function"==typeof e.stream.onRender&&e.stream.onRender(o,i,r,a,n,t)}}function p(e){var i=document.createElement("video");return function(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}(e,i),i.className=t,i.muted=!0,i.volume=0,i.width=e.width||a.width||360,i.height=e.height||a.height||240,i.play(),i}function f(t){i=[],(t=t||e).forEach((function(e){if(e.getTracks().filter((function(e){return"video"===e.kind})).length){var t=p(e);t.stream=e,i.push(t)}}))}void 0!==n?h.AudioContext=n:"undefined"!=typeof webkitAudioContext&&(h.AudioContext=webkitAudioContext),this.startDrawingFrames=function(){c()},this.appendStreams=function(t){if(!t)throw"First parameter is required.";t instanceof Array||(t=[t]),t.forEach((function(t){var s=new d;if(t.getTracks().filter((function(e){return"video"===e.kind})).length){var r=p(t);r.stream=t,i.push(r),s.addTrack(t.getTracks().filter((function(e){return"video"===e.kind}))[0])}if(t.getTracks().filter((function(e){return"audio"===e.kind})).length){var o=a.audioContext.createMediaStreamSource(t);a.audioDestination=a.audioContext.createMediaStreamDestination(),o.connect(a.audioDestination),s.addTrack(a.audioDestination.stream.getTracks().filter((function(e){return"audio"===e.kind}))[0])}e.push(s)}))},this.releaseStreams=function(){i=[],s=!0,a.gainNode&&(a.gainNode.disconnect(),a.gainNode=null),a.audioSources.length&&(a.audioSources.forEach((function(e){e.disconnect()})),a.audioSources=[]),a.audioDestination&&(a.audioDestination.disconnect(),a.audioDestination=null),a.audioContext&&a.audioContext.close(),a.audioContext=null,o.clearRect(0,0,r.width,r.height),r.stream&&(r.stream.stop(),r.stream=null)},this.resetVideoStreams=function(e){!e||e instanceof Array||(e=[e]),f(e)},this.name="MultiStreamsMixer",this.toString=function(){return this.name},this.getMixedStream=function(){s=!1;var t=function(){var e;f(),"captureStream"in r?e=r.captureStream():"mozCaptureStream"in r?e=r.mozCaptureStream():a.disableLogs||console.error("Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features");var t=new d;return e.getTracks().filter((function(e){return"video"===e.kind})).forEach((function(e){t.addTrack(e)})),r.stream=t,t}(),i=function(){h.AudioContextConstructor||(h.AudioContextConstructor=new h.AudioContext);a.audioContext=h.AudioContextConstructor,a.audioSources=[],!0===a.useGainNode&&(a.gainNode=a.audioContext.createGain(),a.gainNode.connect(a.audioContext.destination),a.gainNode.gain.value=0);var t=0;if(e.forEach((function(e){if(e.getTracks().filter((function(e){return"audio"===e.kind})).length){t++;var i=a.audioContext.createMediaStreamSource(e);!0===a.useGainNode&&i.connect(a.gainNode),a.audioSources.push(i)}})),!t)return;return a.audioDestination=a.audioContext.createMediaStreamDestination(),a.audioSources.forEach((function(e){e.connect(a.audioDestination)})),a.audioDestination.stream}();return i&&i.getTracks().filter((function(e){return"audio"===e.kind})).forEach((function(e){t.addTrack(e)})),e.forEach((function(e){e.fullcanvas})),t}}function P(e,t){e=e||[];var i,s,r=this;(t=t||{elementClass:"multi-streams-mixer",mimeType:"video/webm",video:{width:360,height:240}}).frameInterval||(t.frameInterval=10),t.video||(t.video={}),t.video.width||(t.video.width=360),t.video.height||(t.video.height=240),this.record=function(){var r;i=new R(e,t.elementClass||"multi-streams-mixer"),(r=[],e.forEach((function(e){v(e,"video").forEach((function(e){r.push(e)}))})),r).length&&(i.frameInterval=t.frameInterval||10,i.width=t.video.width||360,i.height=t.video.height||240,i.startDrawingFrames()),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()),(s=new w(i.getMixedStream(),t)).record()},this.stop=function(e){s&&s.stop((function(t){r.blob=t,e(t),r.clearRecordedData()}))},this.pause=function(){s&&s.pause()},this.resume=function(){s&&s.resume()},this.clearRecordedData=function(){s&&(s.clearRecordedData(),s=null),i&&(i.releaseStreams(),i=null)},this.addStreams=function(r){if(!r)throw"First parameter is required.";r instanceof Array||(r=[r]),e.concat(r),s&&i&&(i.appendStreams(r),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()))},this.resetVideoStreams=function(e){i&&(!e||e instanceof Array||(e=[e]),i.resetVideoStreams(e))},this.getMixer=function(){return i},this.name="MultiStreamRecorder",this.toString=function(){return this.name}}function B(e,t){var i,s,r;function o(){return new ReadableStream({start:function(s){var r=document.createElement("canvas"),o=document.createElement("video"),a=!0;o.srcObject=e,o.muted=!0,o.height=t.height,o.width=t.width,o.volume=0,o.onplaying=function(){r.width=t.width,r.height=t.height;var e=r.getContext("2d"),n=1e3/t.frameRate,l=setInterval((function(){if(i&&(clearInterval(l),s.close()),a&&(a=!1,t.onVideoProcessStarted&&t.onVideoProcessStarted()),e.drawImage(o,0,0),"closed"!==s._controlledReadableStream.state)try{s.enqueue(e.getImageData(0,0,t.width,t.height))}catch(e){}}),n)},o.play()}})}function a(e,l){if(!t.workerPath&&!l)return i=!1,void fetch("https://unpkg.com/webm-wasm@latest/dist/webm-worker.js").then((function(t){t.arrayBuffer().then((function(t){a(e,t)}))}));if(!t.workerPath&&l instanceof ArrayBuffer){var d=new Blob([l],{type:"text/javascript"});t.workerPath=h.createObjectURL(d)}t.workerPath||console.error("workerPath parameter is missing."),(s=new Worker(t.workerPath)).postMessage(t.webAssemblyPath||"https://unpkg.com/webm-wasm@latest/dist/webm-wasm.wasm"),s.addEventListener("message",(function(e){"READY"===e.data?(s.postMessage({width:t.width,height:t.height,bitrate:t.bitrate||1200,timebaseDen:t.frameRate||30,realtime:t.realtime}),o().pipeTo(new WritableStream({write:function(e){i?console.error("Got image, but recorder is finished!"):s.postMessage(e.data.buffer,[e.data.buffer])}}))):e.data&&(r||n.push(e.data))}))}"undefined"!=typeof ReadableStream&&"undefined"!=typeof WritableStream||console.error("Following polyfill is strongly recommended: https://unpkg.com/@mattiasbuelens/web-streams-polyfill/dist/polyfill.min.js"),(t=t||{}).width=t.width||640,t.height=t.height||480,t.frameRate=t.frameRate||30,t.bitrate=t.bitrate||1200,t.realtime=t.realtime||!0,this.record=function(){n=[],r=!1,this.blob=null,a(e),"function"==typeof t.initCallback&&t.initCallback()},this.pause=function(){r=!0},this.resume=function(){r=!1};var n=[];this.stop=function(e){i=!0;var t=this;!function(e){s?(s.addEventListener("message",(function(t){null===t.data&&(s.terminate(),s=null,e&&e())})),s.postMessage(null)):e&&e()}((function(){t.blob=new Blob(n,{type:"video/webm"}),e(t.blob)}))},this.name="WebAssemblyRecorder",this.toString=function(){return this.name},this.clearRecordedData=function(){n=[],r=!1,this.blob=null},this.blob=null}t.DiskStorage=D,t.GifRecorder=x,t.MultiStreamRecorder=P,t.RecordRTCPromisesHandler=function(e,i){if(!this)throw'Use "new RecordRTCPromisesHandler()"';if(void 0===e)throw'First argument "MediaStream" is required.';var s=this;s.recordRTC=new t(e,i),this.startRecording=function(){return new Promise((function(e,t){try{s.recordRTC.startRecording(),e()}catch(e){t(e)}}))},this.stopRecording=function(){return new Promise((function(e,t){try{s.recordRTC.stopRecording((function(i){s.blob=s.recordRTC.getBlob(),s.blob&&s.blob.size?e(i):t("Empty blob.",s.blob)}))}catch(e){t(e)}}))},this.pauseRecording=function(){return new Promise((function(e,t){try{s.recordRTC.pauseRecording(),e()}catch(e){t(e)}}))},this.resumeRecording=function(){return new Promise((function(e,t){try{s.recordRTC.resumeRecording(),e()}catch(e){t(e)}}))},this.getDataURL=function(e){return new Promise((function(e,t){try{s.recordRTC.getDataURL((function(t){e(t)}))}catch(e){t(e)}}))},this.getBlob=function(){return new Promise((function(e,t){try{e(s.recordRTC.getBlob())}catch(e){t(e)}}))},this.getInternalRecorder=function(){return new Promise((function(e,t){try{e(s.recordRTC.getInternalRecorder())}catch(e){t(e)}}))},this.reset=function(){return new Promise((function(e,t){try{e(s.recordRTC.reset())}catch(e){t(e)}}))},this.destroy=function(){return new Promise((function(e,t){try{e(s.recordRTC.destroy())}catch(e){t(e)}}))},this.getState=function(){return new Promise((function(e,t){try{e(s.recordRTC.getState())}catch(e){t(e)}}))},this.blob=null,this.version="5.6.2"},t.WebAssemblyRecorder=B}));class Ln{static _ebsp2rbsp(e){let t=e,i=t.byteLength,s=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(s[r]=t[e],r++);return new Uint8Array(s.buffer,0,r)}static parseSPS(e){let t=Ln._ebsp2rbsp(e),i=new Cr(t);i.readByte();let s=i.readByte();i.readByte();let r=i.readByte();i.readUEG();let o=Ln.getProfileString(s),a=Ln.getLevelString(r),n=1,l=420,d=[0,420,422,444],h=8;if((100===s||110===s||122===s||244===s||44===s||83===s||86===s||118===s||128===s||138===s||144===s)&&(n=i.readUEG(),3===n&&i.readBits(1),n<=3&&(l=d[n]),h=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool())){let e=3!==n?8:12;for(let t=0;t0&&e<16?(v=t[e-1],_=s[e-1]):255===e&&(v=i.readByte()<<8|i.readByte(),_=i.readByte()<<8|i.readByte())}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool()&&i.readBits(24)),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool()){let e=i.readBits(32),t=i.readBits(32);E=i.readBool(),w=t,T=2*e,S=w/T}}let k=1;1===v&&1===_||(k=v/_);let L=0,C=0;if(0===n)L=1,C=2-m;else{L=3===n?1:2,C=(1===n?2:1)*(2-m)}let D=16*(p+1),x=16*(f+1)*(2-m);D-=(g+y)*L,x-=(A+b)*C;let R=Math.ceil(D*k);return i.destroy(),i=null,{profile_string:o,level_string:a,bit_depth:h,ref_frames:u,chroma_format:l,chroma_format_string:Ln.getChromaFormatString(l),frame_rate:{fixed:E,fps:S,fps_den:T,fps_num:w},sar_ratio:{width:v,height:_},codec_size:{width:D,height:x},present_size:{width:R,height:x}}}static parseSPS$2(e){let t=e.subarray(1,4),i="avc1.";for(let e=0;e<3;e++){let s=t[e].toString(16);s.length<2&&(s="0"+s),i+=s}let s=Ln._ebsp2rbsp(e),r=new Cr(s);r.readByte();let o=r.readByte();r.readByte();let a=r.readByte();r.readUEG();let n=Ln.getProfileString(o),l=Ln.getLevelString(a),d=1,h=420,c=[0,420,422,444],u=8,p=8;if((100===o||110===o||122===o||244===o||44===o||83===o||86===o||118===o||128===o||138===o||144===o)&&(d=r.readUEG(),3===d&&r.readBits(1),d<=3&&(h=c[d]),u=r.readUEG()+8,p=r.readUEG()+8,r.readBits(1),r.readBool())){let e=3!==d?8:12;for(let t=0;t0&&e<16?(E=t[e-1],w=i[e-1]):255===e&&(E=r.readByte()<<8|r.readByte(),w=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);k=r.readBool(),L=t,C=2*e,T=L/C}}let D=1;1===E&&1===w||(D=E/w);let x=0,R=0;if(0===d)x=1,R=2-A;else{x=3===d?1:2,R=(1===d?2:1)*(2-A)}let P=16*(g+1),B=16*(y+1)*(2-A);P-=(b+v)*x,B-=(_+S)*R;let I=Math.ceil(P*D);return r.destroy(),r=null,{codec_mimetype:i,profile_idc:o,level_idc:a,profile_string:n,level_string:l,chroma_format_idc:d,bit_depth:u,bit_depth_luma:u,bit_depth_chroma:p,ref_frames:m,chroma_format:h,chroma_format_string:Ln.getChromaFormatString(h),frame_rate:{fixed:k,fps:T,fps_den:C,fps_num:L},sar_ratio:{width:E,height:w},codec_size:{width:P,height:B},present_size:{width:I,height:B}}}static _skipScalingList(e,t){let i=8,s=8,r=0;for(let o=0;o=this.buflen)return this.iserro=!0,0;this.iserro=!1,i=this.bufoff+e>8?8-this.bufoff:e,t<<=i,t+=this.buffer[this.bufpos]>>8-this.bufoff-i&255>>8-i,this.bufoff+=i,e-=i,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,i=this.bufoff,s=this.read(e);return this.bufpos=t,this.bufoff=i,s}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),s=new Uint8Array(e+4);s.set(i,0),s.set(t.sps,4),t.sps=s}if(t.pps){const e=t.pps.byteLength,i=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),s=new Uint8Array(e+4);s.set(i,0),s.set(t.pps,4),t.pps=s}return t}function xn(e){let{sps:t,pps:i}=e,s=8+t.byteLength+1+2+i.byteLength,r=!1;const o=Ln.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(r=!0,s+=4);let a=new Uint8Array(s);a[0]=1,a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=255,a[5]=225;let n=t.byteLength;a[6]=n>>>8,a[7]=255&n;let l=8;a.set(t,8),l+=n,a[l]=1;let d=i.byteLength;a[l+1]=d>>>8,a[l+2]=255&d,a.set(i,l+3),l+=3+d,r&&(a[l]=252|o.chroma_format_idc,a[l+1]=248|o.bit_depth_luma-8,a[l+2]=248|o.bit_depth_chroma-8,a[l+3]=0,l+=4);const h=[23,0,0,0,0],c=new Uint8Array(h.length+a.byteLength);return c.set(h,0),c.set(a,h.length),c}function Rn(e,t){let i=[];i[0]=t?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}function Pn(e){return 31&e[0]}function Bn(e){return e===Rt}function In(e){return!function(e){return e===kt||e===Lt}(e)&&!Bn(e)}function Mn(e){return e===Ct}class Fn{constructor(e){this.data=e,this.eofFlag=!1,this.currentStartcodeOffset=this.findNextStartCodeOffset(0),this.eofFlag&&console.error("Could not find H264 startcode until payload end!")}findNextStartCodeOffset(e){let t=e,i=this.data;for(;;){if(t+3>=i.byteLength)return this.eofFlag=!0,i.byteLength;let e=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],s=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===e||1===s)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let i=this.currentStartcodeOffset;i+=1===(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3;let s=31&e[i],r=(128&e[i])>>>7,o=this.findNextStartCodeOffset(i);this.currentStartcodeOffset=o,s>=It||0===r&&(t={type:s,data:e.subarray(i,o)})}return t}}class Un{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const On=e=>{let t=e,i=t.byteLength,s=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(s[r]=t[e],r++);return new Uint8Array(s.buffer,0,r)},Nn=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class jn{static _ebsp2rbsp(e){let t=e,i=t.byteLength,s=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(s[r]=t[e],r++);return new Uint8Array(s.buffer,0,r)}static parseVPS(e){let t=jn._ebsp2rbsp(e),i=new Cr(t);return i.readByte(),i.readByte(),i.readBits(4),i.readBits(2),i.readBits(6),{num_temporal_layers:i.readBits(3)+1,temporal_id_nested:i.readBool()}}static parseSPS(e){let t=jn._ebsp2rbsp(e),i=new Cr(t);i.readByte(),i.readByte();let s=0,r=0,o=0,a=0;i.readBits(4);let n=i.readBits(3);i.readBool();let l=i.readBits(2),d=i.readBool(),h=i.readBits(5),c=i.readByte(),u=i.readByte(),p=i.readByte(),f=i.readByte(),m=i.readByte(),g=i.readByte(),y=i.readByte(),A=i.readByte(),b=i.readByte(),v=i.readByte(),_=i.readByte(),S=[],E=[];for(let e=0;e0)for(let e=n;e<8;e++)i.readBits(2);for(let e=0;e1&&i.readSEG();for(let e=0;e0&&e<=16?(I=t[e-1],M=s[e-1]):255===e&&(I=i.readBits(16),M=i.readBits(16))}if(i.readBool()&&i.readBool(),i.readBool()){i.readBits(3),i.readBool(),i.readBool()&&(i.readByte(),i.readByte(),i.readByte())}if(i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool(),i.readBool(),i.readBool(),P=i.readBool(),P&&(i.readUEG(),i.readUEG(),i.readUEG(),i.readUEG()),i.readBool()){if(U=i.readBits(32),O=i.readBits(32),i.readBool()&&i.readUEG(),i.readBool()){let e=!1,t=!1,s=!1;e=i.readBool(),t=i.readBool(),(e||t)&&(s=i.readBool(),s&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),s&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(let r=0;r<=n;r++){let r=i.readBool();F=r;let o=!0,a=1;r||(o=i.readBool());let n=!1;if(o?i.readUEG():n=i.readBool(),n||(a=i.readUEG()+1),e){for(let e=0;e>6&3,i.general_tier_flag=e[1]>>5&1,i.general_profile_idc=31&e[1],i.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],i.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],i.general_constraint_indicator_flags=i.general_constraint_indicator_flags<<16|e[10]<<8|e[11],i.general_level_idc=e[12],i.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],i.parallelismType=3&e[15],i.chromaFormat=3&e[16],i.bitDepthLumaMinus8=7&e[17],i.bitDepthChromaMinus8=7&e[18],i.avgFrameRate=e[19]<<8|e[20],i.constantFrameRate=e[21]>>6&3,i.numTemporalLayers=e[21]>>3&7,i.temporalIdNested=e[21]>>2&1,i.lengthSizeMinusOne=3&e[21];let s=e[22],r=e.slice(23);for(let e=0;e0)for(let t=i;t<8;t++)e.read(2);s.sub_layer_profile_space=[],s.sub_layer_tier_flag=[],s.sub_layer_profile_idc=[],s.sub_layer_profile_compatibility_flag=[],s.sub_layer_progressive_source_flag=[],s.sub_layer_interlaced_source_flag=[],s.sub_layer_non_packed_constraint_flag=[],s.sub_layer_frame_only_constraint_flag=[],s.sub_layer_level_idc=[];for(let t=0;t{let t=On(e),i=new Cr(t);return i.readByte(),i.readByte(),i.readBits(4),i.readBits(2),i.readBits(6),{num_temporal_layers:i.readBits(3)+1,temporal_id_nested:i.readBool()}})(t),a=(e=>{let t=On(e),i=new Cr(t);i.readByte(),i.readByte();let s=0,r=0,o=0,a=0;i.readBits(4);let n=i.readBits(3);i.readBool();let l=i.readBits(2),d=i.readBool(),h=i.readBits(5),c=i.readByte(),u=i.readByte(),p=i.readByte(),f=i.readByte(),m=i.readByte(),g=i.readByte(),y=i.readByte(),A=i.readByte(),b=i.readByte(),v=i.readByte(),_=i.readByte(),S=[],E=[];for(let e=0;e0)for(let e=n;e<8;e++)i.readBits(2);for(let e=0;e1&&i.readSEG();for(let e=0;e0&&e<16?(I=t[e-1],M=s[e-1]):255===e&&(I=i.readBits(16),M=i.readBits(16))}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(3),i.readBool(),i.readBool()&&(i.readByte(),i.readByte(),i.readByte())),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool(),i.readBool(),i.readBool(),P=i.readBool(),P&&(s+=i.readUEG(),r+=i.readUEG(),o+=i.readUEG(),a+=i.readUEG()),i.readBool()&&(U=i.readBits(32),O=i.readBits(32),i.readBool()&&(i.readUEG(),i.readBool()))){let e=!1,t=!1,s=!1;e=i.readBool(),t=i.readBool(),(e||t)&&(s=i.readBool(),s&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),s&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(let r=0;r<=n;r++){let r=i.readBool();F=r;let o=!1,a=1;r||(o=i.readBool());let n=!1;if(o?i.readSEG():n=i.readBool(),n||(cpbcnt=i.readUEG()+1),e)for(let e=0;e{let t=On(e),i=new Cr(t);i.readByte(),i.readByte(),i.readUEG(),i.readUEG(),i.readBool(),i.readBool(),i.readBits(3),i.readBool(),i.readBool(),i.readUEG(),i.readUEG(),i.readSEG(),i.readBool(),i.readBool(),i.readBool()&&i.readUEG(),i.readSEG(),i.readSEG(),i.readBool(),i.readBool(),i.readBool(),i.readBool();let s=i.readBool(),r=i.readBool(),o=1;return r&&s?o=0:r?o=3:s&&(o=2),{parallelismType:o}})(i);r=Object.assign(r,o,a,n);let l=23+(5+t.byteLength)+(5+s.byteLength)+(5+i.byteLength),d=new Uint8Array(l);d[0]=1,d[1]=(3&r.general_profile_space)<<6|(r.general_tier_flag?1:0)<<5|31&r.general_profile_idc,d[2]=r.general_profile_compatibility_flags_1||0,d[3]=r.general_profile_compatibility_flags_2||0,d[4]=r.general_profile_compatibility_flags_3||0,d[5]=r.general_profile_compatibility_flags_4||0,d[6]=r.general_constraint_indicator_flags_1||0,d[7]=r.general_constraint_indicator_flags_2||0,d[8]=r.general_constraint_indicator_flags_3||0,d[9]=r.general_constraint_indicator_flags_4||0,d[10]=r.general_constraint_indicator_flags_5||0,d[11]=r.general_constraint_indicator_flags_6||0,d[12]=60,d[13]=240|(3840&r.min_spatial_segmentation_idc)>>8,d[14]=255&r.min_spatial_segmentation_idc,d[15]=252|3&r.parallelismType,d[16]=252|3&r.chroma_format_idc,d[17]=248|7&r.bit_depth_luma_minus8,d[18]=248|7&r.bit_depth_chroma_minus8,d[19]=0,d[20]=0,d[21]=(3&r.constant_frame_rate)<<6|(7&r.num_temporal_layers)<<3|(r.temporal_id_nested?1:0)<<2|3,d[22]=3,d[23]=128|Gt,d[24]=0,d[25]=1,d[26]=(65280&t.byteLength)>>8,d[27]=(255&t.byteLength)>>0,d.set(t,28),d[23+(5+t.byteLength)+0]=128|Wt,d[23+(5+t.byteLength)+1]=0,d[23+(5+t.byteLength)+2]=1,d[23+(5+t.byteLength)+3]=(65280&s.byteLength)>>8,d[23+(5+t.byteLength)+4]=(255&s.byteLength)>>0,d.set(s,23+(5+t.byteLength)+5),d[23+(5+t.byteLength+5+s.byteLength)+0]=128|Ht,d[23+(5+t.byteLength+5+s.byteLength)+1]=0,d[23+(5+t.byteLength+5+s.byteLength)+2]=1,d[23+(5+t.byteLength+5+s.byteLength)+3]=(65280&i.byteLength)>>8,d[23+(5+t.byteLength+5+s.byteLength)+4]=(255&i.byteLength)>>0,d.set(i,23+(5+t.byteLength+5+s.byteLength)+5);const h=[28,0,0,0,0],c=new Uint8Array(h.length+d.byteLength);return c.set(h,0),c.set(d,h.length),c}function Hn(e,t){let i=[];i[0]=t?28:44,i[1]=1,i[2]=0,i[3]=0,i[4]=0;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}function $n(e){return(126&e[0])>>1}function Jn(e){return!function(e){return e>=32&&e<=40}(e)}function qn(e){return e>=16&&e<=21}class Kn{constructor(e){this.data=e,this.eofFlag=!1,this.currentStartcodeOffset=this.findNextStartCodeOffset(0),this.eofFlag&&console.error("Could not find H265 startcode until payload end!")}findNextStartCodeOffset(e){let t=e,i=this.data;for(;;){if(t+3>=i.byteLength)return this.eofFlag=!0,i.byteLength;let e=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],s=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===e||1===s)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let i=this.currentStartcodeOffset;i+=1===(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3;let s=e[i]>>1&63,r=(128&e[i])>>>7,o=this.findNextStartCodeOffset(i);this.currentStartcodeOffset=o,0===r&&(t={type:s,data:e.subarray(i,o)})}return t}}class Yn{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}class Qn extends Ea{constructor(e){super(),this.TAG_NAME="recorderCommon",this.player=e,this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.recordingInterval=null,this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.audioCodeId=null,this.metaInfo={codecWidth:0,codecHeight:0,presentWidth:0,presentHeight:0,refSampleDuration:0,timescale:1e3,avcc:null,videoType:""},this.audioMetaInfo={timescale:1e3,sampleRate:0,refSampleDuration:0,channelCount:0,codec:"",originalCodec:"",audioType:"",extraData:new Uint8Array(0)}}destroy(){this._reset(),this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.audioCodeId=null,this.metaInfo=null,this.audioMetaInfo=null}get isH264(){return this.codecId===yt}get isH265(){return this.codecId===At}setFileName(e){this.fileName=e}get isRecording(){return this._isRecording}get recording(){return this._isRecording}get recordTime(){return this._recordingTimestamp}startRecord(){}handleAddNaluTrack(e,t,i,s){}handleAddAudioTrack(e,t){}handleAddTrack(e){}stopRecordAndSave(){}startRecordingInterval(){}isWasmMp4(){return!1}stopRecordingInterval(){this.recordingInterval&&clearInterval(this.recordingInterval),this.recordingInterval=null}getToTalByteLength(){return 0}_reset(){this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.stopRecordingInterval()}initMetaData(e,t){let i;const s=e.slice(5);if(this.codecId=t,this.metaInfo.avcc=s,t===yt)i=Dn(s);else if(t===At){i=function(e){let t=23;const i=e[t];if((63&i)!==Gt)return console.warn(`parseHEVCDecoderVPSAndSPSAndPPS and vpsTag is ${i}`),{};t+=2,t+=1;const s=e[t+1]|e[t]<<8;t+=2;const r=e.slice(t,t+s);t+=s;const o=e[t];if((63&o)!==Wt)return console.warn(`parseHEVCDecoderVPSAndSPSAndPPS and sps tag is ${o}`),{};t+=2,t+=1;const a=e[t+1]|e[t]<<8;t+=2;const n=e.slice(t,t+a);t+=a;const l=e[t];if((63&l)!==Ht)return console.warn(`parseHEVCDecoderVPSAndSPSAndPPS and pps tag is ${l}`),{};t+=2,t+=1;const d=e[t+1]|e[t]<<8;t+=2;const h=e.slice(t,t+d),c=new Uint8Array([a>>>24&255,a>>>16&255,a>>>8&255,255&a]),u=new Uint8Array([d>>>24&255,d>>>16&255,d>>>8&255,255&d]),p=new Uint8Array([s>>>24&255,s>>>16&255,s>>>8&255,255&s]),f=new Uint8Array(a+4);f.set(c,0),f.set(n,4);const m=new Uint8Array(d+4);m.set(u,0),m.set(h,4);const g=new Uint8Array(s+4);return g.set(p,0),g.set(r,4),{sps:f,pps:m,vps:g}}(s);const t=Gn(e);i=Object.assign(i,t)}i&&(i.vps&&(this.vps=i.vps),i.pps&&(this.pps=i.pps),i.sps&&(this.sps=i.sps),i.presentWidth&&(this.metaInfo.presentWidth=i.presentWidth),i.presentHeight&&(this.metaInfo.presentHeight=i.presentHeight),i.codecWidth&&(this.metaInfo.codecWidth=i.codecWidth),i.codecHeight&&(this.metaInfo.codecHeight=i.codecHeight),i.timescale&&(this.metaInfo.timescale=i.timescale),i.refSampleDuration&&(this.metaInfo.refSampleDuration=i.refSampleDuration),i.videoType&&(this.metaInfo.videoType=i.videoType))}initAudioMetaData(e,t){this.audioCodeId=t;const i=e[0]>>1&1;let s=null;t===_t?(s=function(e){let t={},i=new Nr(e);return i.read(16),t.object_type=jr(i),t.sample_rate=Gr(i,t),t.chan_config=i.read(4),t.chan_config{r.onload=function(e){i.decode(this.result).forEach((function(e){t.read(e)})),t.stop();const r=s.makeMetadataSeekable(t.metadatas,t.duration,t.cues),a=this.result.slice(t.metadataSize),n=new Blob([r,a],{type:"video/webm"});o(n)},r.readAsArrayBuffer(e)}))}startRecord(){const e={type:"video",mimeType:"video/webm;codecs=h264",timeSlice:1e3,onTimeStamp:e=>{this.player&&this.player.debugLog("RecorderRTC","record timestamp :"+e),null===this._startRecordingTimestamp&&(this._startRecordingTimestamp=e),this._recordingTimestamp=(e-this._startRecordingTimestamp)/1e3},ondataavailable:e=>{this.totalByteLength+=e.size,this.player&&this.player.debugLog("RecorderRTC","ondataavailable",e.size)},disableLogs:!this.player._opt.debug};try{let t=null;if(this.player.getRenderType()===H?t=this.player.video.$videoElement.captureStream(25):this.player.video.mediaStream?t=this.player.video.mediaStream:this.player.isOldHls()||this.player._opt.useMSE||this.player._opt.useWCS?t=this.player.video.$videoElement.captureStream(25):this.player.isWebrtcH264()?t=this.player.webrtc.videoStream:this.player.isAliyunRtc()&&(t=this.player.video.$videoElement.captureStream(25)),!t)return this.player.debugError("RecorderRTC","startRecord error and can not create stream"),void this.player.emitError(ot.recordCreateError,"can not create stream");if(this.player.audio&&this.player.audio.mediaStreamAudioDestinationNode&&this.player.audio.mediaStreamAudioDestinationNode.stream&&!this.player.audio.isStateSuspended()&&this.player.audio.hasAudio&&this.player._opt.hasAudio){const e=this.player.audio.mediaStreamAudioDestinationNode.stream;if(e.getAudioTracks().length>0){const i=e.getAudioTracks()[0];i&&i.enabled&&t.addTrack(i)}}this.recorder=kn(t,e)}catch(e){return this.player.debugError("RecorderRTC","startRecord error",e),void this.player.emitError(ot.recordCreateError,e)}this.recorder&&(this._isRecording=!0,this.player.emit(ot.recording,!0),this.recorder.startRecording(),this.player.debugLog("RecorderRTC","start recording"),this.player.emit(ot.recordStart),this.startRecordingInterval())}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(ot.recordingTimestamp,this._recordingTimestamp)}),1e3)}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ft,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{this.recorder&&this._isRecording||s("recorder is not ready"),t&&this.setFileName(t),this.recorder.stopRecording((()=>{this.player.debugLog("RecorderRTC","stop recording");const t=(this.fileName||Zr())+"."+E;if(this.player._opt.recordWebMSupportSeek);else{if(e===mt){const e=this.recorder.getBlob();i(e),this.player.emit(ot.recordBlob,e)}else i(),this.recorder.save(t);this.player.emit(ot.recordEnd),this._reset(),this.player.emit(ot.recording,!1)}}))}))}cancelRecord(){return new Promise(((e,t)=>{if(this.player.debugLog(this.TAG_NAME,"cancel recording"),!this.recorder||!this._isRecording)return e();this.recorder.stopRecording((()=>{this._reset(),this.player.emit(ot.recording,!1),this.player.emit(ot.recordCancel),e()}))}))}getToTalByteLength(){return this.totalByteLength}getTotalDuration(){return this.recordTime}getType(){return E}initMetaData(){}}class Zn{static init(){Zn.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],free:[],edts:[],elst:[],stss:[]};for(let e in Zn.types)Zn.types.hasOwnProperty(e)&&(Zn.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=Zn.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,50,97,118,99,49,109,112,52,49,0,0,0,0]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,s=Array.prototype.slice.call(arguments,1),r=s.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let o=8;for(let e=0;e=Math.pow(2,32)-1?(o=16,a=new Uint8Array(i+o),a.set(new Uint8Array([0,0,0,1]),0),a.set(Zn.types.mdat,4),a.set(new Uint8Array([i+8>>>56&255,i+8>>>48&255,i+8>>>40&255,i+8>>>32&255,i+8>>>24&255,i+8>>>16&255,i+8>>>8&255,i+8&255]),8)):(a=new Uint8Array(i+o),a[0]=i+8>>>24&255,a[1]=i+8>>>16&255,a[2]=i+8>>>8&255,a[3]=i+8&255,a.set(Zn.types.mdat,4));for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3]))}static trak(e){return Zn.box(Zn.types.trak,Zn.tkhd(e),Zn.mdia(e))}static tkhd(e){let t=e.id,i=e.duration,s=e.presentWidth,r=e.presentHeight;return"video"===e.type?Zn.box(Zn.types.tkhd,new Uint8Array([0,0,0,15,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>>8&255,255&s,0,0,r>>>8&255,255&r,0,0])):"audio"===e.type?Zn.box(Zn.types.tkhd,new Uint8Array([0,0,0,15,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0])):void 0}static edts(e,t){return Zn.box(Zn.types.edts,Zn.elst(e,t))}static elst(e,t){let i=0;for(let s=0;s>>24&255,i>>>16&255,i>>>8&255,255&i,255,255,255,255,0,1,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,0,0,0,0,0,1,0,0]))}static mdia(e){return Zn.box(Zn.types.mdia,Zn.mdhd(e),Zn.hdlr(e),Zn.minf(e))}static mdhd(e){let t=e.timescale/e.refSampleDuration,i=t*e.duration/e.timescale;return Zn.box(Zn.types.mdhd,new Uint8Array([0,0,0,0,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?Zn.constants.HDLR_AUDIO:Zn.constants.HDLR_VIDEO,Zn.box(Zn.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?Zn.box(Zn.types.smhd,Zn.constants.SMHD):Zn.box(Zn.types.vmhd,Zn.constants.VMHD),Zn.box(Zn.types.minf,t,Zn.dinf(),Zn.stbl(e))}static dinf(){return Zn.box(Zn.types.dinf,Zn.box(Zn.types.dref,Zn.constants.DREF))}static stbl(e){let t=e.samples,i=[{No:1,num:0,sampleDelte:1,chunkNo:1,duration:t[0].duration}],s=[t[0].duration],r=t.length;for(let e=0;e>>24&255,t>>>16&255,t>>>8&255,255&t]),s=i.byteLength,r=new Uint8Array(s+8*t);r.set(i,0);for(let i=0;i>>24&255,e[i].num>>>16&255,e[i].num>>>8&255,255&e[i].num,e[i].sampleDelte>>>24&255,e[i].sampleDelte>>>16&255,e[i].sampleDelte>>>8&255,255&e[i].sampleDelte]),s),s+=8;return Zn.box(Zn.types.stts,r)}static stss(e){let t=[],i=e.length;for(let s=0;s>>24&255,s>>>16&255,s>>>8&255,255&s]),o=r.byteLength,a=new Uint8Array(o+4*s);a.set(r,0);for(let e=0;e>>24&255,t[e]>>>16&255,t[e]>>>8&255,255&t[e]]),o),o+=4;return Zn.box(Zn.types.stss,a)}static stsc(e){let t=e.length,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]),s=i.byteLength,r=new Uint8Array(s+12*t);r.set(i,0);for(let i=0;i>>24&255,t>>>16&255,t>>>8&255,255&t,o>>>24&255,o>>>16&255,o>>>8&255,255&o,a>>>24&255,a>>>16&255,a>>>8&255,255&a]),s),s+=12}return Zn.box(Zn.types.stsc,r)}static stsz(e){let t=e.length,i=new Uint8Array([0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]),s=i.byteLength,r=new Uint8Array(s+4*t);r.set(i,0);for(let i=0;i>>24&255,t>>>16&255,t>>>8&255,255&t]),s),s+=4}return Zn.box(Zn.types.stsz,r)}static stco(e,t){let i=t[0].chunkOffset;return Zn.box(Zn.types.stco,new Uint8Array([0,0,0,0,0,0,0,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i]))}static stsd(e){return"audio"===e.type?"mp3"===e.codec?Zn.box(Zn.types.stsd,Zn.constants.STSD_PREFIX,Zn.mp3(e)):Zn.box(Zn.types.stsd,Zn.constants.STSD_PREFIX,Zn.mp4a(e)):"avc"===e.videoType?Zn.box(Zn.types.stsd,Zn.constants.STSD_PREFIX,Zn.avc1(e)):Zn.box(Zn.types.stsd,Zn.constants.STSD_PREFIX,Zn.hvc1(e))}static mp3(e){let t=e.channelCount,i=e.sampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return Zn.box(Zn.types[".mp3"],s)}static mp4a(e){let t=e.channelCount,i=e.sampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return Zn.box(Zn.types.mp4a,s,Zn.esds(e))}static esds(e){let t=e.config||[],i=t.length,s=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return Zn.box(Zn.types.esds,s)}static avc1(e){let t=e.avcc,i=e.codecWidth,s=e.codecHeight,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return Zn.box(Zn.types.avc1,r,Zn.box(Zn.types.avcC,t))}static hvc1(e){let t=e.avcc;const i=e.codecWidth,s=e.codecHeight;let r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return Zn.box(Zn.types.hvc1,r,Zn.box(Zn.types.hvcC,t))}static mvex(e){return Zn.box(Zn.types.mvex,Zn.trex(e))}static trex(e){let t=e.id,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return Zn.box(Zn.types.trex,i)}static moof(e,t){return Zn.box(Zn.types.moof,Zn.mfhd(e.sequenceNumber),Zn.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return Zn.box(Zn.types.mfhd,t)}static traf(e,t){let i=e.id,s=Zn.box(Zn.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),r=Zn.box(Zn.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),o=Zn.sdtp(e),a=Zn.trun(e,o.byteLength+16+16+8+16+8+8);return Zn.box(Zn.types.traf,s,r,a,o)}static sdtp(e){let t=e.samples||[],i=t.length,s=new Uint8Array(4+i);for(let e=0;e>>24&255,s>>>16&255,s>>>8&255,255&s,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);for(let e=0;e>>24&255,t>>>16&255,t>>>8&255,255&t,s>>>24&255,s>>>16&255,s>>>8&255,255&s,r.isLeading<<2|r.dependsOn,r.isDependedOn<<6|r.hasRedundancy<<4|r.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12+16*e)}return Zn.box(Zn.types.trun,o)}static mdat(e){return Zn.box(Zn.types.mdat,e)}}Zn.init();class el extends Qn{constructor(e){super(e),this.TAG_NAME="recorderMP4",this._reset(),e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this._reset(),this.player.debugLog(this.TAG_NAME,"destroy")}_reset(){super._reset(),this.totalDuration=0,this.totalAudioDuration=0,this.totalByteLength=0,this.totalAudioByteLength=0,this.bufferList=[],this.audioBufferList=[],this.cacheTrack={},this.audioCacheTrack={},this.sequenceNumber=0,this.audioSequenceNumber=0}startRecord(){this._isRecording=!0,this.player.emit(ot.recording,!0),this.player.debugLog(this.TAG_NAME,"start recording"),this.player.emit(ot.recordStart),this.startRecordingInterval()}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(ot.recordingTimestamp,this.getTotalDuration())}),1e3)}formatFmp4Track(e,t,i,s){return{id:1,sequenceNumber:++this.sequenceNumber,size:e.byteLength,dts:i,cts:s,isKeyframe:t,data:e,duration:0,flags:{isLeading:0,dependsOn:t?2:1,isDependedOn:t?1:0,hasRedundancy:0,isNonSync:t?0:1}}}formatAudioFmp4Track(e,t){return{id:2,sequenceNumber:++this.audioSequenceNumber,size:e.byteLength,dts:t,pts:t,cts:0,data:new Uint8Array(e),duration:0,originalDts:t,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}}handleAddNaluTrack(e,t,i,s){this.cacheTrack.id&&i>=this.cacheTrack.dts?(this.cacheTrack.duration=i-this.cacheTrack.dts,this.handleAddFmp4Track(this.cacheTrack)):this.cacheTrack={},this.cacheTrack=this.formatFmp4Track(e,t,i,s)}handleAddAudioTrack(e,t){}handleAddFmp4Track(e){if(!this.isRecording)return void this.player.debugError(this.TAG_NAME,"handleAddFmp4Track, isRecording is false ");if((null===this.sps||null===this.pps)&&this.isH264)return void this.player.debugError(this.TAG_NAME,"handleAddFmp4Track, is h264 and this.sps or this.pps is null ");if((null===this.sps||null===this.pps||null===this.vps)&&this.isH265)return void this.player.debugError(this.TAG_NAME,"handleAddFmp4Track, is h265 and this.sps or this.pps or this.vps is null ");const t=Object.assign({},e);t.pts=t.dts+t.cts;const i=t.data;if(t.isKeyframe)if(this.isH264){const e=new Uint8Array(this.sps.byteLength+this.pps.byteLength);e.set(this.sps,0),e.set(this.pps,this.sps.byteLength);const s=new Uint8Array(e.byteLength+i.byteLength);s.set(e,0),s.set(i,e.byteLength),t.data=s}else if(this.isH265){const e=new Uint8Array(this.sps.byteLength+this.pps.byteLength+this.vps.byteLength);e.set(this.vps,0),e.set(this.sps,this.vps.byteLength),e.set(this.pps,this.vps.byteLength+this.sps.byteLength);const s=new Uint8Array(e.byteLength+i.byteLength);s.set(e,0),s.set(i,e.byteLength),t.data=s}t.size=t.data.byteLength,this.totalDuration+=t.duration,this.totalByteLength+=t.data.byteLength,t.duration=0,t.originalDts=t.dts,delete t.id,delete t.sequenceNumber,this.bufferList.push(t)}handleAddFmp4AudioTrack(e){const t=Object.assign({},e);t.pts=t.dts+t.cts,t.size=t.data.byteLength,this.totalAudioDuration+=t.duration,this.totalAudioByteLength+=t.data.byteLength,t.duration=0,t.originalDts=t.dts,delete t.id,delete t.sequenceNumber,this.audioBufferList.push(t)}getTotalDuration(){return this.totalDuration/1e3}getType(){return S}getToTalByteLength(){return this.totalByteLength+this.totalAudioByteLength}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ft,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{if(!this.isRecording)return this.player.debugError(this.TAG_NAME,"stop recording fail, isRecording is false "),s("stop recording fail, isRecording is false ");if(0===this.bufferList.length)return this.player.debugError(this.TAG_NAME,"stop recording fail, this.bufferList.length is 0 "),s("stop recording fail, this.bufferList.length is 0 ");t&&this.setFileName(t);const r={id:1,type:"video",sps:this.sps,pps:this.pps,samples:this.bufferList,sequenceNumber:this.bufferList.length,length:0,addSampleNum:1,duration:0,...this.metaInfo},o={id:2,type:"audio",sequenceNumber:this.audioBufferList.length,samples:this.audioBufferList,...this.audioMetaInfo},a=[r];o.samples.length>0&&a.push(o),this.player.debugLog(this.TAG_NAME,`trackList length is ${a.length}`);const n=Zn.generateInitSegment({timescale:1e3,duration:this.totalDuration},a,this.totalByteLength+this.totalAudioByteLength);this.player.debugLog(this.TAG_NAME,"stop recording");const l=new Blob([n],{type:"application/octet-stream"});if(e===mt)i(l),this.player.emit(ot.recordBlob,l);else{i();ko((this.fileName||Zr())+"."+S,l)}this._reset(),this.player.emit(ot.recording,!1)}))}cancelRecord(){return new Promise(((e,t)=>{if(this.player.debugLog(this.TAG_NAME,"cancel recording"),!this.isRecording)return e();this._reset(),this.player.emit(ot.recording,!1),this.player.emit(ot.recordCancel),e()}))}}function tl(){for(var e=arguments.length,t=new Array(e),i=0;i{const i=new s((0|e.byteLength)+(0|t.byteLength));return i.set(e,0),i.set(t,0|e.byteLength),i}),new s)}function il(e){if((e=e.replace(/\s/g,"")).length%2!=0)return console.error("hexStringToUint8Array: invalid hexString length, must be even and bexString length is: ",e.length),null;const t=new Uint8Array(e.length/2);for(let i=0;i{this.player.emit(ot.recordingTimestamp,this.getTotalDuration())}),1e3)}addMetaData(e){this.flvMetaData=e}addAACSequenceHeader(e){this.aacSequenceHeader=e}addVideoSequenceHeader(e){this.videoSequenceHeader=e}addVideo(e,t){this._setStartTime(t);const i=this._getBufferTs(t);this.hasVideo=!0,this._createBufferItem(e,Ne,i)}addAudio(e,t){this._setStartTime(t);const i=this._getBufferTs(t);this.hasAudio=!0,this._createBufferItem(e,Oe,i)}_setStartTime(e){null===this.startTime&&this._isRecording&&(this.startTime=e,this.player.debugLog(this.TAG_NAME,`_setStartTime is ${e}`))}_getBufferTs(e){e>this.currentTime&&(this.currentTime=e);let t=0;return this.startTime&&e>=this.startTime&&(t=e-this.startTime),t>this.prevTimestamp?this.prevTimestamp=t:t=this.prevTimestamp,t}_createBufferItem(e,t,i){const s=this._createFlvPacket(e,t,i),r=this._createFlvTag(s);this.totalByteLength+=r.byteLength,this.bufferList.push(r)}_createFlvTag(e){let t=11+e.header.length,i=new Uint8Array(t+4);i[0]=e.header.type;let s=new DataView(i.buffer);return i[1]=e.header.length>>16&255,i[2]=e.header.length>>8&255,i[3]=255&e.header.length,i[4]=e.header.timestamp>>16&255,i[5]=e.header.timestamp>>8&255,i[6]=255&e.header.timestamp,i[7]=e.header.timestamp>>24&255,i[8]=0,i[9]=0,i[10]=0,s.setUint32(t,t),i.set(e.payload.subarray(0,e.header.length),11),i}_createFlvPacket(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{header:{length:e?e.length:0,timestamp:i,type:t},payload:e}}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ft,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{if(!this.isRecording)return this.player.debugError(this.TAG_NAME,"stop recording fail, isRecording is false "),s("stop recording fail, isRecording is false ");if(0===this.bufferList.length)return this.player.debugError(this.TAG_NAME,"stop recording fail, this.bufferList.length is 0 "),s("stop recording fail, this.bufferList.length is 0 ");t&&this.setFileName(t);const r=new Uint8Array([70,76,86,1,0,0,0,0,9,0,0,0,0]);this.hasVideo&&(r[4]|=1),this.hasAudio&&(r[4]|=4);let o=[r];if(this.flvMetaData){const e=this._createFlvPacket(this.flvMetaData,je),t=this._createFlvTag(e);o.push(t)}if(this.videoSequenceHeader){const e=this._createFlvPacket(this.videoSequenceHeader,Ne),t=this._createFlvTag(e);o.push(t)}if(this.aacSequenceHeader){const e=this._createFlvPacket(this.aacSequenceHeader,Oe),t=this._createFlvTag(e);o.push(t)}const a=function(e){const t=e[0].constructor;return e.reduce(((e,i)=>{const s=new t((0|e.byteLength)+(0|i.byteLength));return s.set(e,0),s.set(i,0|e.byteLength),s}),new t)}(o.concat(this.bufferList));this.player.debugLog(this.TAG_NAME,"stop recording");const n=new Blob([a],{type:"application/octet-stream"});if(e===mt)i(n),this.player.emit(ot.recordBlob,n);else{i();ko((this.fileName||Zr())+"."+w,n)}this._reset(),this.player.emit(ot.recording,!1)}))}cancelRecord(){return new Promise(((e,t)=>{if(this.player.debugLog(this.TAG_NAME,"cancel recording"),!this.isRecording)return e();this._reset(),this.player.emit(ot.recording,!1),this.player.emit(ot.recordCancel),e()}))}getTotalDuration(){let e=0;return null!==this.startTime&&null!==this.currentTime&&(e=this.currentTime-this.startTime),Math.round(e/1e3)}getType(){return w}getToTalByteLength(){return this.totalByteLength}}const rl={init:0,findFirstStartCode:1,findSecondStartCode:2};class ol extends Ea{constructor(e){super(),this.player=e,this.isDestroyed=!1,this.reset()}destroy(){this.isDestroyed=!1,this.off(),this.reset()}reset(){this.stats=rl.init,this.tempBuffer=new Uint8Array(0),this.parsedOffset=0,this.versionLayer=0}dispatch(e,t){let i=new Uint8Array(this.tempBuffer.length+e.length);for(i.set(this.tempBuffer,0),i.set(e,this.tempBuffer.length),this.tempBuffer=i;!this.isDestroyed;){if(this.state==rl.Init){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=rl.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==rl.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=rl.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==rl.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=rl.findFirstStartCode}}}}class al extends Qn{constructor(e){super(e),this.TAG_NAME="recorderWasmMP4",this._reset(),this.wasmMp4Recorder=null,this.mp3Demuxer=null,e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.mp3Demuxer&&(this.mp3Demuxer.destroy(),this.mp3Demuxer=null),this._reset(),this.player.debugLog(this.TAG_NAME,"destroy")}_reset(){super._reset(),this.cacheTrack={},this.audioCacheTrack={},this.totalDuration=0,this.totalAudioDuration=0,this.totalByteLength=0,this.totalAudioByteLength=0,this.hasAudio=!1,this.hasVideo=!1}getType(){return S}isWasmMp4(){return!0}getTotalDuration(){return this.totalDuration/1e3}getToTalByteLength(){return this.totalByteLength+this.totalAudioByteLength}startRecord(){const e=this.player,t=this.player.getAudioInfo(),i=this.player.getVideoInfo(),s={};if(this.codecId){const e={type:this.codecId,width:i.width,height:i.height,extraData:this.metaInfo.avcc};s.video=e,this.hasVideo=!0}if(t.encTypeCode){const e={type:t.encTypeCode,sampleRate:t.sampleRate,channels:t.channels,extraData:this.audioMetaInfo.extraData,depth:t.depth};this.audioCodeId=t.encTypeCode,s.audio=e,this.hasAudio=!0}this.wasmMp4Recorder=new window.JessibucaProMp4Recorder({debug:e._opt.debug,debugLevel:e._opt.debugLevel,debugUuid:e._opt.debugUuid,decoder:e._opt.wasmMp4RecorderDecoder}),this.wasmMp4Recorder.on("recordingTimestamp",(e=>{this._recordingTimestamp=e/1e3})),this.wasmMp4Recorder.startRecord(s).then((()=>{this._isRecording=!0,this.player.emit(ot.recording,!0),this.player.debugLog(this.TAG_NAME,"start recording"),this.player.emit(ot.recordStart),this.startRecordingInterval()})).catch((e=>{this.player.debugError(this.TAG_NAME,"startRecord error",e),this.player.emitError(ot.recordCreateError,e)}))}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(ot.recordingTimestamp,this.recordTime)}),1e3)}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ft,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>this.isRecording?0===this.totalDuration?(this.player.debugError(this.TAG_NAME,"stop recording fail, totalDuration is 0 "),s("stop recording fail, totalDuration is 0 ")):(t&&this.setFileName(t),void this.wasmMp4Recorder.stopRecord().then((t=>{if(e===mt)i(t),this.player.emit(ot.recordBlob,t);else{i();ko((this.fileName||Zr())+"."+S,t)}})).catch((e=>{this.player.debugError(this.TAG_NAME,"stopRecord error",e),s(e)})).finally((()=>{this._reset(),this.player.emit(ot.recording,!1)}))):(this.player.debugError(this.TAG_NAME,"stop recording fail, isRecording is false "),s("stop recording fail, isRecording is false "))))}cancelRecord(){return new Promise(((e,t)=>{if(this.player.debugLog(this.TAG_NAME,"cancel recording"),!this.isRecording||0===this.totalDuration)return e();this.wasmMp4Recorder.stopRecord().then((t=>{e()})).catch((e=>{this.player.debugError(this.TAG_NAME,"stopRecord error",e),t(e)})).finally((()=>{this._reset(),this.player.emit(ot.recording,!1),this.player.emit(ot.recordCancel)}))}))}handleAddAudioTrack(e,t){this.audioCodeId===Et?(this.mp3Demuxer||(this.mp3Demuxer=new ol(this.player),this.mp3Demuxer.on("data",((e,t)=>{this._handleAddAudioTrack(e,t)}))),this.mp3Demuxer.dispatch(e,t)):this._handleAddAudioTrack(e,t)}_handleAddAudioTrack(e,t){ua(this.hasAudio)||(this.audioCacheTrack.id&&t>=this.audioCacheTrack.dts?(this.audioCacheTrack.duration=t-this.audioCacheTrack.dts,this.totalAudioDuration+=this.audioCacheTrack.duration,this.totalAudioByteLength+=this.audioCacheTrack.payload.byteLength,this.wasmMp4Recorder.sendAudioFrame(this.audioCacheTrack.payload,this.audioCacheTrack.dts)):this.audioCacheTrack={},this.audioCacheTrack={id:2,payload:e,dts:t})}handleAddNaluTrack(e,t,i,s){ua(this.hasVideo)||(this.cacheTrack.id&&i>=this.cacheTrack.dts?(this.cacheTrack.duration=i-this.cacheTrack.dts,this.totalDuration+=this.cacheTrack.duration,this.totalByteLength+=this.cacheTrack.payload.byteLength,this.wasmMp4Recorder.sendVideoFrame(this.cacheTrack.payload,this.cacheTrack.isIFrame,this.cacheTrack.dts,this.cacheTrack.cts)):this.cacheTrack={},this.cacheTrack={id:1,payload:e,isIFrame:t,dts:i,cts:s})}}class nl{constructor(e){return new(nl.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){if(e.recordType===S){if(e.useWasm||e.useMSE||e.useWCS)return window.JessibucaProMp4Recorder&&e.mp4RecordUseWasm?al:el}else if(e.recordType===w)return sl;return Xn}}function ll(e,t,i){let s=e;if(t+i=128){t.push(String.fromCharCode(65535&e)),s+=2;continue}}}else if(i[s]<240){if(ll(i,s,2)){let e=(15&i[s])<<12|(63&i[s+1])<<6|63&i[s+2];if(e>=2048&&55296!=(63488&e)){t.push(String.fromCharCode(65535&e)),s+=3;continue}}}else if(i[s]<248&&ll(i,s,3)){let e=(7&i[s])<<18|(63&i[s+1])<<12|(63&i[s+2])<<6|63&i[s+3];if(e>65536&&e<1114112){e-=65536,t.push(String.fromCharCode(e>>>10|55296)),t.push(String.fromCharCode(1023&e|56320)),s+=4;continue}}t.push(String.fromCharCode(65533)),++s}return t.join("")}let hl=function(){let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256===new Int16Array(e)[0]}();class cl{static parseScriptData(e,t,i){let s={};try{let r=cl.parseValue(e,t,i),o=cl.parseValue(e,t+r.size,i-r.size);s[r.data]=o.data}catch(e){console.error("AMF",e.toString())}return s}static parseObject(e,t,i){let s=cl.parseString(e,t,i),r=cl.parseValue(e,t+s.size,i-s.size),o=r.objectEnd;return{data:{name:s.data,value:r.data},size:s.size+r.size,objectEnd:o}}static parseVariable(e,t,i){return cl.parseObject(e,t,i)}static parseString(e,t,i){let s,r=new DataView(e,t,i).getUint16(0,!hl);return s=r>0?dl(new Uint8Array(e,t+2,r)):"",{data:s,size:2+r}}static parseLongString(e,t,i){let s,r=new DataView(e,t,i).getUint32(0,!hl);return s=r>0?dl(new Uint8Array(e,t+4,r)):"",{data:s,size:4+r}}static parseDate(e,t,i){let s=new DataView(e,t,i),r=s.getFloat64(0,!hl);return r+=60*s.getInt16(8,!hl)*1e3,{data:new Date(r),size:10}}static parseValue(e,t,i){let s,r=new DataView(e,t,i),o=1,a=r.getUint8(0),n=!1;try{switch(a){case 0:s=r.getFloat64(1,!hl),o+=8;break;case 1:s=!!r.getUint8(1),o+=1;break;case 2:{let r=cl.parseString(e,t+1,i-1);s=r.data,o+=r.size;break}case 3:{s={};let a=0;for(9==(16777215&r.getUint32(i-4,!hl))&&(a=3);o{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),te)}this.decoderWorker=new Worker(t),this._initDecoderWorker(),this._listenPlaybackEvents(),e.debugLog("decoderWorker",`init and decoder url is ${t}`),e.on(ot.visibilityChange,(()=>{this.updateWorkConfig({key:"visibility",value:e.visibility})}))}destroy(){return new Promise(((e,t)=>{if(this.player.loaded)if(this.player.debugLog("decoderWorker","has loaded and post message to destroy"),this.decoderWorker){const t={};this.player.isMseDecoderUseWorker()&&(t.isVideoInited=this.player.isMseVideoStateInited()),this.decoderWorker.postMessage({cmd:He,options:t}),this.destroyResolve=e,this.decoderWorkerCloseTimeout=setTimeout((()=>{this.player.debugWarn("decoderWorker","send close but not response and destroy directly"),this._destroy(),setTimeout((()=>{e()}),0)}),2e3)}else this.player.debugWarn("decoderWorker","has loaded but decoderWorker is null and destroy directly"),this._destroy(),setTimeout((()=>{e()}),0);else this.player.debugLog("decoderWorker","has not loaded and destroy directly"),this._destroy(),setTimeout((()=>{e()}),0)}))}_destroy(){this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this.workerUrl&&(window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.decoderWorker&&(this.decoderWorker.terminate(),this.decoderWorker.onerror=null,this.decoderWorker.onmessageerror=null,this.decoderWorker.onmessage=null,this.decoderWorker=null),this.player.debugLog("decoderWorker","destroy"),this.destroyResolve&&(this.destroyResolve(),this.destroyResolve=null),this.isDestroyed=!0}_listenPlaybackEvents(){this.player.isPlaybackPauseNotClearCacheAndCacheBeforeDecodeAndUseFpsRender()&&(this.player.debugLog(this.TAG_NAME,"listenPlaybackEvents"),this.player.on(ot.playbackPause,(e=>{this.updatePlaybackIsPause(e)})))}_initDecoderWorker(){this.player,this.decoderWorker.onerror=e=>{const t=e.filename||"",i=e.message||"",s=t&&(-1!==t.indexOf(".wasm")||-1!==t.indexOf("wasm://"));s&&-1!==i.indexOf(Zs)?this.player.debugLog("decoderWorker",`onerror and ignore filename: ${t},message: ${i}`,e):(this.player.debugError("decoderWorker",`onerror filename: ${t},message: ${i}`,e),s?this.player.emitError(lt.decoderWorkerWasmError,`filename: ${t},message: ${i}`):this.player.emitError(lt.decoderWorkerInitError,`filename: ${t},message: ${i}`))},this.decoderWorker.onmessageerror=e=>{this.player.debugError("decoderWorker","onmessageerror",e)},this.decoderWorker.onmessage=e=>{const t=e.data;switch(t.cmd){case re:this.player.debugLog("decoderWorker","onmessage:",re),this.decoderWorker&&this._initWork(),this.player.loaded||this.player.emit(ot.load),this.player.emit(ot.decoderWorkerInit);break;case ue:this.player.debugLog("decoderWorker","onmessage:",ue,t.code),this.player._times.decodeStart||(this.player._times.decodeStart=Zr()),this.player.video.updateVideoInfo({encTypeCode:t.code});break;case pe:this.player.debugLog("decoderWorker","onmessage:",pe,t.codecId),this.player.recorder&&this.player.recorder.initMetaData(t.buffer,t.codecId),this.player.video.updateVideoInfo({encTypeCode:t.codecId});break;case de:this.player.debugLog("decoderWorker","onmessage:",de,t.code),this.player.audio&&this.player.audio.updateAudioInfo({encTypeCode:t.code});break;case ce:this.player.debugLog("decoderWorker","onmessage:",ce),this.player.recorder&&this.player.recorder.initAudioAacExtraData(t.buffer);break;case oe:if(this.player.debugLog("decoderWorker","onmessage:",oe,`width:${t.w},height:${t.h}`),Lo(t.w)||Lo(t.h))return void this.player.emitError(lt.videoInfoError,`video width ${t.w} or height ${t.h} is empty`);if(this.player.video.bindMediaStream(),this.player.video.updateVideoInfo({width:t.w,height:t.h}),!this.player._opt.openWebglAlignment&&t.w/2%4!=0&&this.player.getRenderType()===H)return void this.player.emitError(lt.webglAlignmentError);this.player.video.initCanvasViewSize(),this.player._opt.playType===_&&(this.player.video.initFps(),this.player.video.initVideoDelay());break;case le:if(this.player.debugLog("decoderWorker","onmessage:",le,`channels:${t.channels},sampleRate:${t.sampleRate}`),t.channels>2)return void this.player.emitError(lt.audioChannelError,`audio channel is ${t.channels}, max is 2`);this.player.audio&&(this.player.audio.updateAudioInfo(t),this.player._opt.playType===b?this.player.audio.initScriptNode():this.player._opt.playType===_&&this.player.audio.initScriptNodeDelay());break;case ae:if(!this.player.video)return void this.player.debugWarn("decoderWorker","onmessage render but video is null");if(this.player.isPlayer()){if(ua(this.player.video.getHasInit()))return void this.player.debugWarn("decoderWorker","onmessage render but video has not init");this.player.video.render(t),this.player.handleRender(),this.player.emit(ot.timeUpdate,t.ts),this.player.updateStats({dfps:!0,buf:t.delay}),this.player._times.videoStart||(this.player._times.videoStart=Zr(),this.player.handlePlayToRenderTimes())}else this.player.isPlayback()&&(this.player.updateStats({dfps:!0}),ua(this.player.playbackPause)?(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this.player.playback.isUseFpsRender?this.player.video.pushData(t):this.player.video.render$2(t)):this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this.player.playback.isUseFpsRender&&this.player.video.pushData(t));break;case fe:this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===S&&this.player.recorder.handleAddNaluTrack(t.buffer,t.isIFrame,t.ts,t.cts);break;case he:this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===S&&this.player.recorder.isWasmMp4()&&this.player.recorder.handleAddAudioTrack(t.buffer,t.ts);break;case me:const{webcodecsDecoder:e,mseDecoder:i}=this.player;this.player.updateStats({buf:t.delay});const s=new Uint8Array(t.payload);this.player._opt.useWCS&&!this.player._opt.useOffscreen?e.decodeVideo(s,t.ts,t.isIFrame,t.cts):this.player._opt.useMSE&&i.decodeVideo(s,t.ts,t.isIFrame,t.cts);break;case ge:if(this.player._opt.useMSE){const e=new Uint8Array(t.payload);this.player.mseDecoder.decodeAudio(e,t.ts,t.cts)}break;case ne:if(!this.player.audio)return void this.player.debugWarn("decoderWorker","onmessage playAudio but audio is null");(this.player.playing&&this.player.audio||!this.player.video)&&(this.player._opt.hasVideo||this.player.handleRender(),(this.player._opt.playType===b||this.player._opt.playType===_&&(ua(this.player.playbackPause)||this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this.player.playback.isUseFpsRender))&&this.player.audio.play(t.buffer,t.ts));break;case ye:if(t.type===ot.streamSuccess)this.player.stream?this.player.stream.emit(ot.streamSuccess):this.player.debugWarn("decoderWorker","onmessage and workerFetch response stream success but stream is null");else if(t.type===ot.streamRate)this.player.emit(ot.kBps,(t.value/1024).toFixed(2));else if(t.type===ot.streamEnd)this.player?(t.value===f&&this.player.emit(ot.websocketClose,t.msg),this.player.stream?this.player.stream.emit(ot.streamEnd,t.msg):this.player.debugWarn("decoderWorker","onmessage and workerFetch response stream end but player.stream is null")):this.player.debugWarn("decoderWorker","onmessage and workerFetch response stream end but player is null");else if(t.type===lt.websocketError)this.player&&this.player.stream?this.player.stream.emit(lt.websocketError,t.value):this.player.debugWarn("decoderWorker","onmessage and workerFetch response websocket error but stream is null");else if(t.type===lt.fetchError)this.player&&this.player.stream?this.player.stream.emit(lt.fetchError,t.value):this.player.debugWarn("decoderWorker","onmessage and workerFetch response fetch error but stream is null");else if(t.type===ot.streamAbps)this.player.updateStats({abps:t.value});else if(t.type===ot.streamVbps)this.player._times.demuxStart||(this.player._times.demuxStart=Zr()),this.player.updateStats({vbps:t.value});else if(t.type===ot.streamDts)this.player.updateStats({dts:t.value});else if(t.type===ot.netBuf)this.player.updateStats({netBuf:t.value});else if(t.type===ot.networkDelayTimeout)this.player.emit(ot.networkDelayTimeout,t.value);else if(t.type===ot.streamStats){const e=JSON.parse(t.value);this.player.updateStats({workerStats:e})}else t.type===ot.websocketOpen&&this.player.emit(ot.websocketOpen);break;case Ae:this.player&&(this.player.videoIframeIntervalTs=t.value);break;case be:this.player&&this.player.updateStats({isDropping:!0});break;case Pe:this.player.decoderCheckFirstIFrame();break;case _e:this.player&&this.player.video&&this.player.video.setStreamFps(t.value);break;case we:this.player.emitError(lt.simdH264DecodeVideoWidthIsTooLarge,t.value);break;case Se:this.player.emitError(lt.wasmWidthOrHeightChange,t.value);break;case Ee:this.player.emitError(lt.simdDecodeError);break;case ve:this.player.debugLog("decoderWorker","onmessage:",ve),this.player.destroy(),console.error("Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),alert("Jb pro 体验结束,请刷新页面再次体验,如需要购买商业授权,可以联系微信:bosswancheng"),window.location.reload();break;case Te:this.player.debugLog("decoderWorker","onmessage:",Te),this._destroy();break;case ke:this.player&&this.player.pushTempStream(t.buffer);break;case Le:this.player&&this.player.emitVideoSei({ts:t.ts,data:new Uint8Array(t.buffer)});break;case Ce:if(this.player){if(this.player.isRecordTypeFlv()){const e=new Uint8Array(t.buffer);this.player.recorder.addMetaData(e)}const e=ul(new Uint8Array(t.buffer));e&&e.onMetaData&&this.player.updateMetaData(e.onMetaData)}break;case De:if(this.player&&this.player.isRecordTypeFlv()){const e=new Uint8Array(t.buffer);this.player.recorder.addAACSequenceHeader(e,t.ts)}break;case xe:if(this.player&&this.player.isRecordTypeFlv()){const e=new Uint8Array(t.buffer);this.player.recorder.addVideoSequenceHeader(e,t.ts)}break;case Re:if(this.player&&this.player.isRecordTypeFlv()&&this.player.recording){const e=new Uint8Array(t.buffer);t.type===Ue?this.player.recorder.addVideo(e,t.ts):t.type===Fe&&this.player.recorder.addAudio(e,t.ts)}break;case Be:this.player&&(this.player.debugLog("decoderWorker","onmessage:",Be),this.player.video.$videoElement.srcObject=t.mseHandle);break;case Ie:this.player&&(this.player.debugLog("decoderWorker","onmessage:",Ie,t.value),this.player._mseWorkerData.firstRenderTime=Number(t.value));break;case Me:this.player&&(this.player.debugLog("decoderWorker","onmessage:",Me,t.value,t.msg),this.player.emitError(t.value,t.msg));break;default:this.player[t.cmd]&&this.player[t.cmd](t)}}}_initWork(){const e={debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid,useOffscreen:this.player._opt.useOffscreen,useWCS:this.player._opt.useWCS,useMSE:this.player._opt.useMSE,videoBuffer:this.player._opt.videoBuffer,videoBufferDelay:this.player._opt.videoBufferDelay,openWebglAlignment:this.player._opt.openWebglAlignment,playType:this.player._opt.playType,hasAudio:this.player._opt.hasAudio,hasVideo:this.player._opt.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:this.player._opt.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:this.player.audio&&this.player.audio.audioContext&&this.player.audio.audioContext.sampleRate||vr,audioBufferSize:this.player.audio&&this.player.audio.getAudioBufferSize()||1024,networkDelay:this.player._opt.networkDelay,visibility:this.player.visibility,useSIMD:this.player._opt.useSIMD,recordType:this.player._opt.recordType,checkFirstIFrame:this.player._opt.checkFirstIFrame,isM7sCrypto:this.player._opt.isM7sCrypto,isXorCrypto:this.player._opt.isXorCrypto,isSm4Crypto:this.player._opt.isSm4Crypto,isSm4CryptoH265V2:this.player._opt.isSm4CryptoH265V2,sm4CryptoKey:this.player._opt.sm4CryptoKey,m7sCryptoAudio:this.player._opt.m7sCryptoAudio,isFlv:this.player._opt.isFlv,isFmp4:this.player._opt.isFmp4,isMpeg4:this.player._opt.isMpeg4,isTs:this.player._opt.isTs,isNakedFlow:this.player._opt.isNakedFlow,isHls265:this.player.isUseHls265(),isFmp4Private:this.player._opt.isFmp4Private,isEmitSEI:this.player._opt.isEmitSEI,isRecordTypeFlv:this.player.isRecordTypeFlv(),isWasmMp4:this.player.recorder&&this.player.recorder.isWasmMp4()||!1,isChrome:Ho(),isFirefox:co(),supportMSEDecodeHevc:So(),isDropSameTimestampGop:this.player._opt.isDropSameTimestampGop,mseDecodeAudio:this.player._opt.mseDecodeAudio,wcsDecodeAudio:this.player._opt.wcsDecodeAudio,nakedFlowH265DemuxUseNew:this.player._opt.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:this.player._opt.mseDecoderUseWorker,mseAutoCleanupMinBackwardDuration:this.player._opt.mseAutoCleanupMinBackwardDuration,mseAutoCleanupMaxBackwardDuration:this.player._opt.mseAutoCleanupMaxBackwardDuration,mseCorrectTimeDuration:this.player._opt.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:this.player._opt.mseCorrectAudioTimeDuration,nakedFlowDemuxUseNew:this.player._opt.nakedFlowDemuxUseNew,nakedFlowFps:this.player._opt.nakedFlowFps};this.decoderWorker.postMessage({cmd:Ge,opt:JSON.stringify(e)}),this.player._opt.cryptoKey&&this.player._opt.cryptoKey.byteLength>0&&this.player._opt.cryptoIV&&this.player._opt.cryptoIV.byteLength>0&&(this.updateWorkConfig({key:"cryptoKey",value:this.player._opt.cryptoKey}),this.updateWorkConfig({key:"cryptoIV",value:this.player._opt.cryptoIV}))}decodeVideo(e,t,i){this.player._opt.playType===b?this.player.isUseHls265()?this._decodeVideoNoDelay(e,t,i):this._decodeVideo(e,t,i):this.player._opt.playType===_&&(this.player.isPlaybackOnlyDecodeIFrame()?i&&(this.player.debugLog("decoderWorker",`current rate is ${this.player.video.rate},only decode i frame`),this._decodeVideoNoDelay(e,t,i)):1===this.player.video.rate?this._decodeVideo(e,t,i):this._decodeVideoNoDelay(e,t,i))}_decodeVideo(e,t,i){const s={type:Ue,ts:Math.max(t,0),isIFrame:i};this.decoderWorker.postMessage({cmd:ze,buffer:e,options:s},[e.buffer])}_decodeVideoNoDelay(e,t,i){this.decoderWorker.postMessage({cmd:Ve,buffer:e,ts:Math.max(t,0),isIFrame:i},[e.buffer])}decodeAudio(e,t){this.player._opt.playType===b?this.player._opt.useWCS||this.player._opt.useMSE||this.player.isUseHls265()?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t):this.player._opt.playType===_&&(this.player.isPlaybackOnlyDecodeIFrame()||(1===this.player.video.rate?this._decodeAudio(e,t):this._decodeAudioNoDelay(e,t)))}_decodeAudio(e,t){const i={type:Fe,ts:Math.max(t,0)};this.decoderWorker.postMessage({cmd:ze,buffer:e,options:i},[e.buffer])}_decodeAudioNoDelay(e,t){this.decoderWorker.postMessage({cmd:We,buffer:e,ts:Math.max(t,0)},[e.buffer])}updateWorkConfig(e){this.decoderWorker&&this.decoderWorker.postMessage({cmd:$e,key:e.key,value:e.value})}workerFetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{_opt:i}=this.player;let s=[];t.protocols&&(s=t.protocols,delete t.protocols);const r={protocol:i.protocol,isFlv:i.isFlv,isFmp4:i.isFmp4,isMpeg4:i.isMpeg4,isNakedFlow:i.isNakedFlow,isTs:i.isTs,options:t};this.decoderWorker.postMessage({cmd:qe,url:e,protocols:s,opt:JSON.stringify(r)})}clearWorkBuffer(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.decoderWorker.postMessage({cmd:Je,needClear:e})}workerSendMessage(e){this.decoderWorker.postMessage({cmd:Ke,message:e})}updateVideoTimestamp(e){this.decoderWorker.postMessage({cmd:Ye,message:e})}updatePlaybackIsPause(e){this.decoderWorker.postMessage({cmd:Qe,isPause:e})}}var fl,ml="application/json, text/javascript",gl="text/html",yl=/^(?:text|application)\/xml/i,Al=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,bl=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,vl=/^\s*$/,_l={},Sl={},El="",wl={type:"GET",beforeSend:Tl,success:Tl,error:Tl,complete:Tl,context:null,xhr:function(){return new window.XMLHttpRequest},accepts:{json:ml,xml:"application/xml, text/xml",html:gl,text:"text/plain","*":"*/".concat("*")},crossDomain:!1,timeout:0,username:null,password:null,processData:!0,promise:Tl,contentType:"application/x-www-form-urlencoded; charset=UTF-8"};function Tl(){}var kl=function(e,t){"object"==typeof e&&(t=e,e=void 0);var i=Il({},t=t||{});for(var s in wl)void 0===i[s]&&(i[s]=wl[s]);try{var r={},o=new Promise((function(e,t){r.resolve=e,r.reject=t}));o.resolve=r.resolve,o.reject=r.reject,i.promise=o}catch(e){i.promise={resolve:Tl,reject:Tl}}var a=bl.exec(window.location.href.toLowerCase())||[];i.url=((e||i.url||window.location.href)+"").replace(/#.*$/,"").replace(/^\/\//,a[1]+"//");var n=i.url;i.crossDomain||(i.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(i.url)&&RegExp.$2!==window.location.href);var l=i.dataType;if("jsonp"===l){if(!/=\?/.test(i.url)){var d=(i.jsonp||"callback")+"=?";i.url=Rl(i.url,d)}return function(e){var t,i=e.jsonpCallback||"jsonp"+Ul(),s=window.document.createElement("script"),r={abort:function(){i in window&&(window[i]=Tl)}},o=window.document.getElementsByTagName("head")[0]||window.document.documentElement;function a(i){window.clearTimeout(t),r.abort(),Dl(i.type,r,i.type,e),n()}s.onerror=function(e){a(e)},window[i]=function(i){window.clearTimeout(t),Ll(i,r,e),n()},Pl(e),s.src=e.url.replace(/=\?/,"="+i),s.src=Rl(s.src,"_="+(new Date).getTime()),s.async=!0,e.scriptCharset&&(s.charset=e.scriptCharset);o.insertBefore(s,o.firstChild),e.timeout>0&&(t=window.setTimeout((function(){r.abort(),Dl("timeout",r,"timeout",e),n()}),e.timeout));function n(){s.clearAttributes?s.clearAttributes():s.onload=s.onreadystatechange=s.onerror=null,s.parentNode&&s.parentNode.removeChild(s),s=null,delete window[i]}return e.promise.abort=function(){r.abort()},e.promise.xhr=r,e.promise}(i)}Pl(i);var h=i.accepts[l]||i.accepts["*"],c={};/^([\w-]+:)\/\//.test(i.url)?RegExp.$1:window.location.protocol;var u,p=wl.xhr();i.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest"),i.ifModified&&(_l[n]&&(c["If-Modified-Since"]=_l[n]),Sl[n]&&(c["If-None-Match"]=Sl[n])),h&&(c.Accept=h,h.indexOf(",")>-1&&(h=h.split(",",2)[0]),p.overrideMimeType&&p.overrideMimeType(h));var f=!/^(?:GET|HEAD)$/.test(i.type.toUpperCase());if((i.data&&f&&!1!==i.contentType||t.contentType)&&(c["Content-Type"]=i.contentType),!1===i.cache&&!f){var m=/([?&])_=[^&]*/;i.url=m.test(n)?n.replace(m,"$1_="+Ul()):n+(/\?/.test(n)?"&":"?")+"_="+Ul()}i.headers=Il(c,i.headers||{}),p.onreadystatechange=function(){if(4===p.readyState){var e;clearTimeout(u);var t=!1;if(p.status>=200&&p.status<300||304===p.status){if(El=p.getAllResponseHeaders(),i.ifModified){var s=xl("Last-Modified");s&&(_l[n]=s),(s=xl("etag"))&&(Sl[n]=s)}l=l||function(e){return e&&(e===gl?"html":e===ml?"json":yl.test(e)&&"xml")||"text"}(p.getResponseHeader("content-type")),e=p.responseText;try{"xml"===l?e=p.responseXML:"json"===l&&(e=vl.test(e)?null:JSON.parse(e))}catch(e){t=e}t?Dl(t,"parseerror",p,i):Ll(e,p,i)}else Dl(null,"error",p,i)}};var g=!("async"in i)||i.async;if(p.open(i.type,i.url,g,i.username,i.password),i.xhrFields)for(var y in i.xhrFields)p[y]=i.xhrFields[y];for(var y in i.mimeType&&p.overrideMimeType&&p.overrideMimeType(i.mimeType),i.headers)void 0!==i.headers[y]&&p.setRequestHeader(y,i.headers[y]+"");return!1===function(e,t){var i=t.context;if(!1===t.beforeSend.call(i,e,t))return!1}(p,i)?(p.abort(),!1):(i.timeout>0&&(u=window.setTimeout((function(){p.onreadystatechange=Tl,p.abort(),Dl(null,"timeout",p,i)}),i.timeout)),p.send(i.data?i.data:null),i.promise.abort=function(){p.abort()},i.promise)};function Ll(e,t,i){var s=i.context,r="success";i.success.call(s,e,r,t),i.promise.resolve(e,r,t),Cl(r,t,i)}function Cl(e,t,i){var s=i.context;i.complete.call(s,t,e)}function Dl(e,t,i,s){var r=s.context;s.error.call(r,i,t,e),s.promise.reject(i,t,e),Cl(t,i,s)}function xl(e){var t;if(!fl){for(fl={};t=Al.exec(El);)fl[t[1].toLowerCase()]=t[2];t=fl[e.toLowerCase()]}return null===t?null:t}function Rl(e,t){return(e+"&"+t).replace(/[&?]{1,2}/,"?")}function Pl(e){!Ml(e)||e.data instanceof FormData||!e.processData||(e.data=function(e,t){var i=[];return i.add=function(e,t){this.push(encodeURIComponent(e)+"="+encodeURIComponent(t))},Bl(i,e,t),i.join("&").replace("%20","+")}(e.data)),!e.data||e.type&&"GET"!==e.type.toUpperCase()||(e.url=Rl(e.url,e.data))}function Bl(e,t,i,s){var r=function(e){return"[object Array]"===Object.prototype.toString.call(e)}(t);for(var o in t){var a=t[o];s&&(o=i?s:s+"["+(r?"":o)+"]"),!s&&r?e.add(a.name,a.value):(i?r(a):Ml(a))?Bl(e,a,i,o):e.add(o,a)}}function Il(e){for(var t=Array.prototype.slice,i=t.call(arguments,1),s=0,r=i.length;s255)return!1;return!0}function jl(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!Nl(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(Ol(e.length)&&Nl(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function Gl(e){return new Uint8Array(e)}function zl(e,t,i,s,r){null==s&&null==r||(e=e.slice?e.slice(s,r):Array.prototype.slice.call(e,s,r)),t.set(e,i)}kl.get=function(e,t,i,s){return Fl(t)&&(s=s||i,i=t,t=void 0),kl({url:e,data:t,success:i,dataType:s})},kl.post=function(e,t,i,s){return Fl(t)&&(s=s||i,i=t,t=void 0),kl({type:"POST",url:e,data:t,success:i,dataType:s})},kl.getJSON=function(e,t,i){return Fl(t)&&(i=t,t=void 0),kl({url:e,data:t,success:i,dataType:"json"})},kl.ajaxSetup=function(e,t){return t?Il(Il(e,wl),t):Il(wl,e)};var Wl={toBytes:function(e){var t=[],i=0;for(e=encodeURI(e);i191&&s<224?(t.push(String.fromCharCode((31&s)<<6|63&e[i+1])),i+=2):(t.push(String.fromCharCode((15&s)<<12|(63&e[i+1])<<6|63&e[i+2])),i+=3)}return t.join("")}},Vl=function(){var e="0123456789abcdef";return{toBytes:function(e){for(var t=[],i=0;i>4]+e[15&r])}return i.join("")}}}(),Hl={16:10,24:12,32:14},$l=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],Jl=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],ql=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],Kl=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],Yl=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],Ql=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],Xl=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],Zl=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],ed=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],td=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],id=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],sd=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],rd=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],od=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],ad=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function nd(e){for(var t=[],i=0;i>2,this._Ke[i][t%4]=o[t],this._Kd[e-i][t%4]=o[t];for(var a,n=0,l=r;l>16&255]<<24^Jl[a>>8&255]<<16^Jl[255&a]<<8^Jl[a>>24&255]^$l[n]<<24,n+=1,8!=r)for(t=1;t>8&255]<<8^Jl[a>>16&255]<<16^Jl[a>>24&255]<<24;for(t=r/2+1;t>2,h=l%4,this._Ke[d][h]=o[t],this._Kd[e-d][h]=o[t++],l++}for(var d=1;d>24&255]^rd[a>>16&255]^od[a>>8&255]^ad[255&a]},ld.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,i=[0,0,0,0],s=nd(e),r=0;r<4;r++)s[r]^=this._Ke[0][r];for(var o=1;o>24&255]^Yl[s[(r+1)%4]>>16&255]^Ql[s[(r+2)%4]>>8&255]^Xl[255&s[(r+3)%4]]^this._Ke[o][r];s=i.slice()}var a,n=Gl(16);for(r=0;r<4;r++)a=this._Ke[t][r],n[4*r]=255&(Jl[s[r]>>24&255]^a>>24),n[4*r+1]=255&(Jl[s[(r+1)%4]>>16&255]^a>>16),n[4*r+2]=255&(Jl[s[(r+2)%4]>>8&255]^a>>8),n[4*r+3]=255&(Jl[255&s[(r+3)%4]]^a);return n},ld.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,i=[0,0,0,0],s=nd(e),r=0;r<4;r++)s[r]^=this._Kd[0][r];for(var o=1;o>24&255]^ed[s[(r+3)%4]>>16&255]^td[s[(r+2)%4]>>8&255]^id[255&s[(r+1)%4]]^this._Kd[o][r];s=i.slice()}var a,n=Gl(16);for(r=0;r<4;r++)a=this._Kd[t][r],n[4*r]=255&(ql[s[r]>>24&255]^a>>24),n[4*r+1]=255&(ql[s[(r+3)%4]>>16&255]^a>>16),n[4*r+2]=255&(ql[s[(r+2)%4]>>8&255]^a>>8),n[4*r+3]=255&(ql[255&s[(r+1)%4]]^a);return n};var dd=function(e){if(!(this instanceof dd))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new ld(e)};dd.prototype.encrypt=function(e){if((e=jl(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=Gl(e.length),i=Gl(16),s=0;sNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},pd.prototype.setBytes=function(e){if(16!=(e=jl(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},pd.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var fd=function(e,t){if(!(this instanceof fd))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof pd||(t=new pd(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new ld(e)};fd.prototype.encrypt=function(e){for(var t=jl(e,!0),i=0;i16)throw new Error("PKCS#7 padding byte out of range");for(var i=e.length-t,s=0;s>>2]>>>24-o%4*8&255;t[s+o>>>2]|=a<<24-(s+o)%4*8}else for(var n=0;n>>2]=i[n>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,i=this.sigBytes;t[i>>>2]&=4294967295<<32-i%4*8,t.length=e.ceil(i/4)},clone:function(){var e=l.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],i=0;i>>2]>>>24-r%4*8&255;s.push((o>>>4).toString(16)),s.push((15&o).toString(16))}return s.join("")},parse:function(e){for(var t=e.length,i=[],s=0;s>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new d.init(i,t/2)}},u=h.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],r=0;r>>2]>>>24-r%4*8&255;s.push(String.fromCharCode(o))}return s.join("")},parse:function(e){for(var t=e.length,i=[],s=0;s>>2]|=(255&e.charCodeAt(s))<<24-s%4*8;return new d.init(i,t)}},p=h.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},f=n.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var i,s=this._data,r=s.words,o=s.sigBytes,a=this.blockSize,n=o/(4*a),l=(n=t?e.ceil(n):e.max((0|n)-this._minBufferSize,0))*a,h=e.min(4*l,o);if(l){for(var c=0;c>>2]|=e[r]<<24-r%4*8;t.call(this,s,i)}else t.apply(this,arguments)};s.prototype=e}}(),i.lib.WordArray)})),kr((function(e,t){var i;e.exports=(i=gd,function(){var e=i,t=e.lib.WordArray,s=e.enc;function r(e){return e<<8&4278255360|e>>>8&16711935}s.Utf16=s.Utf16BE={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],r=0;r>>2]>>>16-r%4*8&65535;s.push(String.fromCharCode(o))}return s.join("")},parse:function(e){for(var i=e.length,s=[],r=0;r>>1]|=e.charCodeAt(r)<<16-r%2*16;return t.create(s,2*i)}},s.Utf16LE={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],o=0;o>>2]>>>16-o%4*8&65535);s.push(String.fromCharCode(a))}return s.join("")},parse:function(e){for(var i=e.length,s=[],o=0;o>>1]|=r(e.charCodeAt(o)<<16-o%2*16);return t.create(s,2*i)}}}(),i.enc.Utf16)})),kr((function(e,t){var i;e.exports=(i=gd,function(){var e=i,t=e.lib.WordArray;function s(e,i,s){for(var r=[],o=0,a=0;a>>6-a%4*2;r[o>>>2]|=n<<24-o%4*8,o++}return t.create(r,o)}e.enc.Base64={stringify:function(e){var t=e.words,i=e.sigBytes,s=this._map;e.clamp();for(var r=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,n=0;n<4&&o+.75*n>>6*(3-n)&63));var l=s.charAt(64);if(l)for(;r.length%4;)r.push(l);return r.join("")},parse:function(e){var t=e.length,i=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o>>6-a%4*2;r[o>>>2]|=n<<24-o%4*8,o++}return t.create(r,o)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var i=e.words,s=e.sigBytes,r=t?this._safe_map:this._map;e.clamp();for(var o=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(i[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|i[a+2>>>2]>>>24-(a+2)%4*8&255,l=0;l<4&&a+.75*l>>6*(3-l)&63));var d=r.charAt(64);if(d)for(;o.length%4;)o.push(d);return o.join("")},parse:function(e,t){void 0===t&&(t=!0);var i=e.length,r=t?this._safe_map:this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var a=0;a>>24)|4278255360&(r<<24|r>>>8)}var o=this._hash.words,a=e[t+0],l=e[t+1],p=e[t+2],f=e[t+3],m=e[t+4],g=e[t+5],y=e[t+6],A=e[t+7],b=e[t+8],v=e[t+9],_=e[t+10],S=e[t+11],E=e[t+12],w=e[t+13],T=e[t+14],k=e[t+15],L=o[0],C=o[1],D=o[2],x=o[3];L=d(L,C,D,x,a,7,n[0]),x=d(x,L,C,D,l,12,n[1]),D=d(D,x,L,C,p,17,n[2]),C=d(C,D,x,L,f,22,n[3]),L=d(L,C,D,x,m,7,n[4]),x=d(x,L,C,D,g,12,n[5]),D=d(D,x,L,C,y,17,n[6]),C=d(C,D,x,L,A,22,n[7]),L=d(L,C,D,x,b,7,n[8]),x=d(x,L,C,D,v,12,n[9]),D=d(D,x,L,C,_,17,n[10]),C=d(C,D,x,L,S,22,n[11]),L=d(L,C,D,x,E,7,n[12]),x=d(x,L,C,D,w,12,n[13]),D=d(D,x,L,C,T,17,n[14]),L=h(L,C=d(C,D,x,L,k,22,n[15]),D,x,l,5,n[16]),x=h(x,L,C,D,y,9,n[17]),D=h(D,x,L,C,S,14,n[18]),C=h(C,D,x,L,a,20,n[19]),L=h(L,C,D,x,g,5,n[20]),x=h(x,L,C,D,_,9,n[21]),D=h(D,x,L,C,k,14,n[22]),C=h(C,D,x,L,m,20,n[23]),L=h(L,C,D,x,v,5,n[24]),x=h(x,L,C,D,T,9,n[25]),D=h(D,x,L,C,f,14,n[26]),C=h(C,D,x,L,b,20,n[27]),L=h(L,C,D,x,w,5,n[28]),x=h(x,L,C,D,p,9,n[29]),D=h(D,x,L,C,A,14,n[30]),L=c(L,C=h(C,D,x,L,E,20,n[31]),D,x,g,4,n[32]),x=c(x,L,C,D,b,11,n[33]),D=c(D,x,L,C,S,16,n[34]),C=c(C,D,x,L,T,23,n[35]),L=c(L,C,D,x,l,4,n[36]),x=c(x,L,C,D,m,11,n[37]),D=c(D,x,L,C,A,16,n[38]),C=c(C,D,x,L,_,23,n[39]),L=c(L,C,D,x,w,4,n[40]),x=c(x,L,C,D,a,11,n[41]),D=c(D,x,L,C,f,16,n[42]),C=c(C,D,x,L,y,23,n[43]),L=c(L,C,D,x,v,4,n[44]),x=c(x,L,C,D,E,11,n[45]),D=c(D,x,L,C,k,16,n[46]),L=u(L,C=c(C,D,x,L,p,23,n[47]),D,x,a,6,n[48]),x=u(x,L,C,D,A,10,n[49]),D=u(D,x,L,C,T,15,n[50]),C=u(C,D,x,L,g,21,n[51]),L=u(L,C,D,x,E,6,n[52]),x=u(x,L,C,D,f,10,n[53]),D=u(D,x,L,C,_,15,n[54]),C=u(C,D,x,L,l,21,n[55]),L=u(L,C,D,x,b,6,n[56]),x=u(x,L,C,D,k,10,n[57]),D=u(D,x,L,C,y,15,n[58]),C=u(C,D,x,L,w,21,n[59]),L=u(L,C,D,x,m,6,n[60]),x=u(x,L,C,D,S,10,n[61]),D=u(D,x,L,C,p,15,n[62]),C=u(C,D,x,L,v,21,n[63]),o[0]=o[0]+L|0,o[1]=o[1]+C|0,o[2]=o[2]+D|0,o[3]=o[3]+x|0},_doFinalize:function(){var t=this._data,i=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;i[r>>>5]|=128<<24-r%32;var o=e.floor(s/4294967296),a=s;i[15+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),i[14+(r+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(i.length+1),this._process();for(var n=this._hash,l=n.words,d=0;d<4;d++){var h=l[d];l[d]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}return n},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function d(e,t,i,s,r,o,a){var n=e+(t&i|~t&s)+r+a;return(n<>>32-o)+t}function h(e,t,i,s,r,o,a){var n=e+(t&s|i&~s)+r+a;return(n<>>32-o)+t}function c(e,t,i,s,r,o,a){var n=e+(t^i^s)+r+a;return(n<>>32-o)+t}function u(e,t,i,s,r,o,a){var n=e+(i^(t|~s))+r+a;return(n<>>32-o)+t}t.MD5=o._createHelper(l),t.HmacMD5=o._createHmacHelper(l)}(Math),i.MD5)})),kr((function(e,t){var i,s,r,o,a,n,l,d;e.exports=(s=(i=d=gd).lib,r=s.WordArray,o=s.Hasher,a=i.algo,n=[],l=a.SHA1=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],r=i[1],o=i[2],a=i[3],l=i[4],d=0;d<80;d++){if(d<16)n[d]=0|e[t+d];else{var h=n[d-3]^n[d-8]^n[d-14]^n[d-16];n[d]=h<<1|h>>>31}var c=(s<<5|s>>>27)+l+n[d];c+=d<20?1518500249+(r&o|~r&a):d<40?1859775393+(r^o^a):d<60?(r&o|r&a|o&a)-1894007588:(r^o^a)-899497514,l=a,a=o,o=r<<30|r>>>2,r=s,s=c}i[0]=i[0]+s|0,i[1]=i[1]+r|0,i[2]=i[2]+o|0,i[3]=i[3]+a|0,i[4]=i[4]+l|0},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;return t[s>>>5]|=128<<24-s%32,t[14+(s+64>>>9<<4)]=Math.floor(i/4294967296),t[15+(s+64>>>9<<4)]=i,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),i.SHA1=o._createHelper(l),i.HmacSHA1=o._createHmacHelper(l),d.SHA1)})),kr((function(e,t){var i;e.exports=(i=gd,function(e){var t=i,s=t.lib,r=s.WordArray,o=s.Hasher,a=t.algo,n=[],l=[];!function(){function t(t){for(var i=e.sqrt(t),s=2;s<=i;s++)if(!(t%s))return!1;return!0}function i(e){return 4294967296*(e-(0|e))|0}for(var s=2,r=0;r<64;)t(s)&&(r<8&&(n[r]=i(e.pow(s,.5))),l[r]=i(e.pow(s,1/3)),r++),s++}();var d=[],h=a.SHA256=o.extend({_doReset:function(){this._hash=new r.init(n.slice(0))},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],r=i[1],o=i[2],a=i[3],n=i[4],h=i[5],c=i[6],u=i[7],p=0;p<64;p++){if(p<16)d[p]=0|e[t+p];else{var f=d[p-15],m=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,g=d[p-2],y=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;d[p]=m+d[p-7]+y+d[p-16]}var A=s&r^s&o^r&o,b=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),v=u+((n<<26|n>>>6)^(n<<21|n>>>11)^(n<<7|n>>>25))+(n&h^~n&c)+l[p]+d[p];u=c,c=h,h=n,n=a+v|0,a=o,o=r,r=s,s=v+(b+A)|0}i[0]=i[0]+s|0,i[1]=i[1]+r|0,i[2]=i[2]+o|0,i[3]=i[3]+a|0,i[4]=i[4]+n|0,i[5]=i[5]+h|0,i[6]=i[6]+c|0,i[7]=i[7]+u|0},_doFinalize:function(){var t=this._data,i=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;return i[r>>>5]|=128<<24-r%32,i[14+(r+64>>>9<<4)]=e.floor(s/4294967296),i[15+(r+64>>>9<<4)]=s,t.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(h),t.HmacSHA256=o._createHmacHelper(h)}(Math),i.SHA256)})),kr((function(e,t){var i,s,r,o,a,n;e.exports=(s=(i=n=gd).lib.WordArray,r=i.algo,o=r.SHA256,a=r.SHA224=o.extend({_doReset:function(){this._hash=new s.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=4,e}}),i.SHA224=o._createHelper(a),i.HmacSHA224=o._createHmacHelper(a),n.SHA224)})),kr((function(e,t){var i;e.exports=(i=gd,function(){var e=i,t=e.lib.Hasher,s=e.x64,r=s.Word,o=s.WordArray,a=e.algo;function n(){return r.create.apply(r,arguments)}var l=[n(1116352408,3609767458),n(1899447441,602891725),n(3049323471,3964484399),n(3921009573,2173295548),n(961987163,4081628472),n(1508970993,3053834265),n(2453635748,2937671579),n(2870763221,3664609560),n(3624381080,2734883394),n(310598401,1164996542),n(607225278,1323610764),n(1426881987,3590304994),n(1925078388,4068182383),n(2162078206,991336113),n(2614888103,633803317),n(3248222580,3479774868),n(3835390401,2666613458),n(4022224774,944711139),n(264347078,2341262773),n(604807628,2007800933),n(770255983,1495990901),n(1249150122,1856431235),n(1555081692,3175218132),n(1996064986,2198950837),n(2554220882,3999719339),n(2821834349,766784016),n(2952996808,2566594879),n(3210313671,3203337956),n(3336571891,1034457026),n(3584528711,2466948901),n(113926993,3758326383),n(338241895,168717936),n(666307205,1188179964),n(773529912,1546045734),n(1294757372,1522805485),n(1396182291,2643833823),n(1695183700,2343527390),n(1986661051,1014477480),n(2177026350,1206759142),n(2456956037,344077627),n(2730485921,1290863460),n(2820302411,3158454273),n(3259730800,3505952657),n(3345764771,106217008),n(3516065817,3606008344),n(3600352804,1432725776),n(4094571909,1467031594),n(275423344,851169720),n(430227734,3100823752),n(506948616,1363258195),n(659060556,3750685593),n(883997877,3785050280),n(958139571,3318307427),n(1322822218,3812723403),n(1537002063,2003034995),n(1747873779,3602036899),n(1955562222,1575990012),n(2024104815,1125592928),n(2227730452,2716904306),n(2361852424,442776044),n(2428436474,593698344),n(2756734187,3733110249),n(3204031479,2999351573),n(3329325298,3815920427),n(3391569614,3928383900),n(3515267271,566280711),n(3940187606,3454069534),n(4118630271,4000239992),n(116418474,1914138554),n(174292421,2731055270),n(289380356,3203993006),n(460393269,320620315),n(685471733,587496836),n(852142971,1086792851),n(1017036298,365543100),n(1126000580,2618297676),n(1288033470,3409855158),n(1501505948,4234509866),n(1607167915,987167468),n(1816402316,1246189591)],d=[];!function(){for(var e=0;e<80;e++)d[e]=n()}();var h=a.SHA512=t.extend({_doReset:function(){this._hash=new o.init([new r.init(1779033703,4089235720),new r.init(3144134277,2227873595),new r.init(1013904242,4271175723),new r.init(2773480762,1595750129),new r.init(1359893119,2917565137),new r.init(2600822924,725511199),new r.init(528734635,4215389547),new r.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],r=i[1],o=i[2],a=i[3],n=i[4],h=i[5],c=i[6],u=i[7],p=s.high,f=s.low,m=r.high,g=r.low,y=o.high,A=o.low,b=a.high,v=a.low,_=n.high,S=n.low,E=h.high,w=h.low,T=c.high,k=c.low,L=u.high,C=u.low,D=p,x=f,R=m,P=g,B=y,I=A,M=b,F=v,U=_,O=S,N=E,j=w,G=T,z=k,W=L,V=C,H=0;H<80;H++){var $,J,q=d[H];if(H<16)J=q.high=0|e[t+2*H],$=q.low=0|e[t+2*H+1];else{var K=d[H-15],Y=K.high,Q=K.low,X=(Y>>>1|Q<<31)^(Y>>>8|Q<<24)^Y>>>7,Z=(Q>>>1|Y<<31)^(Q>>>8|Y<<24)^(Q>>>7|Y<<25),ee=d[H-2],te=ee.high,ie=ee.low,se=(te>>>19|ie<<13)^(te<<3|ie>>>29)^te>>>6,re=(ie>>>19|te<<13)^(ie<<3|te>>>29)^(ie>>>6|te<<26),oe=d[H-7],ae=oe.high,ne=oe.low,le=d[H-16],de=le.high,he=le.low;J=(J=(J=X+ae+(($=Z+ne)>>>0>>0?1:0))+se+(($+=re)>>>0>>0?1:0))+de+(($+=he)>>>0>>0?1:0),q.high=J,q.low=$}var ce,ue=U&N^~U&G,pe=O&j^~O&z,fe=D&R^D&B^R&B,me=x&P^x&I^P&I,ge=(D>>>28|x<<4)^(D<<30|x>>>2)^(D<<25|x>>>7),ye=(x>>>28|D<<4)^(x<<30|D>>>2)^(x<<25|D>>>7),Ae=(U>>>14|O<<18)^(U>>>18|O<<14)^(U<<23|O>>>9),be=(O>>>14|U<<18)^(O>>>18|U<<14)^(O<<23|U>>>9),ve=l[H],_e=ve.high,Se=ve.low,Ee=W+Ae+((ce=V+be)>>>0>>0?1:0),we=ye+me;W=G,V=z,G=N,z=j,N=U,j=O,U=M+(Ee=(Ee=(Ee=Ee+ue+((ce+=pe)>>>0>>0?1:0))+_e+((ce+=Se)>>>0>>0?1:0))+J+((ce+=$)>>>0<$>>>0?1:0))+((O=F+ce|0)>>>0>>0?1:0)|0,M=B,F=I,B=R,I=P,R=D,P=x,D=Ee+(ge+fe+(we>>>0>>0?1:0))+((x=ce+we|0)>>>0>>0?1:0)|0}f=s.low=f+x,s.high=p+D+(f>>>0>>0?1:0),g=r.low=g+P,r.high=m+R+(g>>>0

>>0?1:0),A=o.low=A+I,o.high=y+B+(A>>>0>>0?1:0),v=a.low=v+F,a.high=b+M+(v>>>0>>0?1:0),S=n.low=S+O,n.high=_+U+(S>>>0>>0?1:0),w=h.low=w+j,h.high=E+N+(w>>>0>>0?1:0),k=c.low=k+z,c.high=T+G+(k>>>0>>0?1:0),C=u.low=C+V,u.high=L+W+(C>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;return t[s>>>5]|=128<<24-s%32,t[30+(s+128>>>10<<5)]=Math.floor(i/4294967296),t[31+(s+128>>>10<<5)]=i,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(h),e.HmacSHA512=t._createHmacHelper(h)}(),i.SHA512)})),kr((function(e,t){var i,s,r,o,a,n,l,d;e.exports=(s=(i=d=gd).x64,r=s.Word,o=s.WordArray,a=i.algo,n=a.SHA512,l=a.SHA384=n.extend({_doReset:function(){this._hash=new o.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=16,e}}),i.SHA384=n._createHelper(l),i.HmacSHA384=n._createHmacHelper(l),d.SHA384)})),kr((function(e,t){var i;e.exports=(i=gd,function(e){var t=i,s=t.lib,r=s.WordArray,o=s.Hasher,a=t.x64.Word,n=t.algo,l=[],d=[],h=[];!function(){for(var e=1,t=0,i=0;i<24;i++){l[e+5*t]=(i+1)*(i+2)/2%64;var s=(2*e+3*t)%5;e=t%5,t=s}for(e=0;e<5;e++)for(t=0;t<5;t++)d[e+5*t]=t+(2*e+3*t)%5*5;for(var r=1,o=0;o<24;o++){for(var n=0,c=0,u=0;u<7;u++){if(1&r){var p=(1<>>24)|4278255360&(o<<24|o>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(C=i[r]).high^=a,C.low^=o}for(var n=0;n<24;n++){for(var u=0;u<5;u++){for(var p=0,f=0,m=0;m<5;m++)p^=(C=i[u+5*m]).high,f^=C.low;var g=c[u];g.high=p,g.low=f}for(u=0;u<5;u++){var y=c[(u+4)%5],A=c[(u+1)%5],b=A.high,v=A.low;for(p=y.high^(b<<1|v>>>31),f=y.low^(v<<1|b>>>31),m=0;m<5;m++)(C=i[u+5*m]).high^=p,C.low^=f}for(var _=1;_<25;_++){var S=(C=i[_]).high,E=C.low,w=l[_];w<32?(p=S<>>32-w,f=E<>>32-w):(p=E<>>64-w,f=S<>>64-w);var T=c[d[_]];T.high=p,T.low=f}var k=c[0],L=i[0];for(k.high=L.high,k.low=L.low,u=0;u<5;u++)for(m=0;m<5;m++){var C=i[_=u+5*m],D=c[_],x=c[(u+1)%5+5*m],R=c[(u+2)%5+5*m];C.high=D.high^~x.high&R.high,C.low=D.low^~x.low&R.low}C=i[0];var P=h[n];C.high^=P.high,C.low^=P.low}},_doFinalize:function(){var t=this._data,i=t.words;this._nDataBytes;var s=8*t.sigBytes,o=32*this.blockSize;i[s>>>5]|=1<<24-s%32,i[(e.ceil((s+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*i.length,this._process();for(var a=this._state,n=this.cfg.outputLength/8,l=n/8,d=[],h=0;h>>24)|4278255360&(u<<24|u>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),d.push(p),d.push(u)}return new r.init(d,n)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),i=0;i<25;i++)t[i]=t[i].clone();return e}});t.SHA3=o._createHelper(u),t.HmacSHA3=o._createHmacHelper(u)}(Math),i.SHA3)})),kr((function(e,t){var i;e.exports=(i=gd,function(e){var t=i,s=t.lib,r=s.WordArray,o=s.Hasher,a=t.algo,n=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),l=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),d=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),h=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),c=r.create([0,1518500249,1859775393,2400959708,2840853838]),u=r.create([1352829926,1548603684,1836072691,2053994217,0]),p=a.RIPEMD160=o.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=0;i<16;i++){var s=t+i,r=e[s];e[s]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var o,a,p,v,_,S,E,w,T,k,L,C=this._hash.words,D=c.words,x=u.words,R=n.words,P=l.words,B=d.words,I=h.words;for(S=o=C[0],E=a=C[1],w=p=C[2],T=v=C[3],k=_=C[4],i=0;i<80;i+=1)L=o+e[t+R[i]]|0,L+=i<16?f(a,p,v)+D[0]:i<32?m(a,p,v)+D[1]:i<48?g(a,p,v)+D[2]:i<64?y(a,p,v)+D[3]:A(a,p,v)+D[4],L=(L=b(L|=0,B[i]))+_|0,o=_,_=v,v=b(p,10),p=a,a=L,L=S+e[t+P[i]]|0,L+=i<16?A(E,w,T)+x[0]:i<32?y(E,w,T)+x[1]:i<48?g(E,w,T)+x[2]:i<64?m(E,w,T)+x[3]:f(E,w,T)+x[4],L=(L=b(L|=0,I[i]))+k|0,S=k,k=T,T=b(w,10),w=E,E=L;L=C[1]+p+T|0,C[1]=C[2]+v+k|0,C[2]=C[3]+_+S|0,C[3]=C[4]+o+E|0,C[4]=C[0]+a+w|0,C[0]=L},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;t[s>>>5]|=128<<24-s%32,t[14+(s+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),e.sigBytes=4*(t.length+1),this._process();for(var r=this._hash,o=r.words,a=0;a<5;a++){var n=o[a];o[a]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}return r},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function f(e,t,i){return e^t^i}function m(e,t,i){return e&t|~e&i}function g(e,t,i){return(e|~t)^i}function y(e,t,i){return e&i|t&~i}function A(e,t,i){return e^(t|~i)}function b(e,t){return e<>>32-t}t.RIPEMD160=o._createHelper(p),t.HmacRIPEMD160=o._createHmacHelper(p)}(),i.RIPEMD160)})),kr((function(e,t){var i,s,r;e.exports=(s=(i=gd).lib.Base,r=i.enc.Utf8,void(i.algo.HMAC=s.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var i=e.blockSize,s=4*i;t.sigBytes>s&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),a=this._iKey=t.clone(),n=o.words,l=a.words,d=0;d>>2];e.sigBytes-=t}};s.BlockCipher=h.extend({cfg:h.cfg.extend({mode:p,padding:f}),reset:function(){var e;h.reset.call(this);var t=this.cfg,i=t.iv,s=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=s.createEncryptor:(e=s.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,i&&i.words):(this._mode=e.call(s,this,i&&i.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=s.CipherParams=r.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),g=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,i=e.salt;return(i?o.create([1398893684,1701076831]).concat(i).concat(t):t).toString(l)},parse:function(e){var t,i=l.parse(e),s=i.words;return 1398893684==s[0]&&1701076831==s[1]&&(t=o.create(s.slice(2,4)),s.splice(0,4),i.sigBytes-=16),m.create({ciphertext:i,salt:t})}},y=s.SerializableCipher=r.extend({cfg:r.extend({format:g}),encrypt:function(e,t,i,s){s=this.cfg.extend(s);var r=e.createEncryptor(i,s),o=r.finalize(t),a=r.cfg;return m.create({ciphertext:o,key:i,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:s.format})},decrypt:function(e,t,i,s){return s=this.cfg.extend(s),t=this._parse(t,s.format),e.createDecryptor(i,s).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),A=(t.kdf={}).OpenSSL={execute:function(e,t,i,s,r){if(s||(s=o.random(8)),r)a=d.create({keySize:t+i,hasher:r}).compute(e,s);else var a=d.create({keySize:t+i}).compute(e,s);var n=o.create(a.words.slice(t),4*i);return a.sigBytes=4*t,m.create({key:a,iv:n,salt:s})}},b=s.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:A}),encrypt:function(e,t,i,s){var r=(s=this.cfg.extend(s)).kdf.execute(i,e.keySize,e.ivSize,s.salt,s.hasher);s.iv=r.iv;var o=y.encrypt.call(this,e,t,r.key,s);return o.mixIn(r),o},decrypt:function(e,t,i,s){s=this.cfg.extend(s),t=this._parse(t,s.format);var r=s.kdf.execute(i,e.keySize,e.ivSize,t.salt,s.hasher);return s.iv=r.iv,y.decrypt.call(this,e,t,r.key,s)}})}())})),kr((function(e,t){var i;e.exports=((i=gd).mode.CFB=function(){var e=i.lib.BlockCipherMode.extend();function t(e,t,i,s){var r,o=this._iv;o?(r=o.slice(0),this._iv=void 0):r=this._prevBlock,s.encryptBlock(r,0);for(var a=0;a>24&255)){var t=e>>16&255,i=e>>8&255,s=255&e;255===t?(t=0,255===i?(i=0,255===s?s=0:++s):++i):++t,e=0,e+=t<<16,e+=i<<8,e+=s}else e+=1<<24;return e}function s(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var r=e.Encryptor=e.extend({processBlock:function(e,t){var i=this._cipher,r=i.blockSize,o=this._iv,a=this._counter;o&&(a=this._counter=o.slice(0),this._iv=void 0),s(a);var n=a.slice(0);i.encryptBlock(n,0);for(var l=0;l>>2]|=r<<24-o%4*8,e.sigBytes+=r},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Ansix923)})),kr((function(e,t){var i;e.exports=((i=gd).pad.Iso10126={pad:function(e,t){var s=4*t,r=s-e.sigBytes%s;e.concat(i.lib.WordArray.random(r-1)).concat(i.lib.WordArray.create([r<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Iso10126)})),kr((function(e,t){var i;e.exports=((i=gd).pad.Iso97971={pad:function(e,t){e.concat(i.lib.WordArray.create([2147483648],1)),i.pad.ZeroPadding.pad(e,t)},unpad:function(e){i.pad.ZeroPadding.unpad(e),e.sigBytes--}},i.pad.Iso97971)})),kr((function(e,t){var i;e.exports=((i=gd).pad.ZeroPadding={pad:function(e,t){var i=4*t;e.clamp(),e.sigBytes+=i-(e.sigBytes%i||i)},unpad:function(e){var t=e.words,i=e.sigBytes-1;for(i=e.sigBytes-1;i>=0;i--)if(t[i>>>2]>>>24-i%4*8&255){e.sigBytes=i+1;break}}},i.pad.ZeroPadding)})),kr((function(e,t){var i;e.exports=((i=gd).pad.NoPadding={pad:function(){},unpad:function(){}},i.pad.NoPadding)})),kr((function(e,t){var i;e.exports=(i=gd,function(e){var t=i,s=t.lib.CipherParams,r=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(r)},parse:function(e){var t=r.parse(e);return s.create({ciphertext:t})}}}(),i.format.Hex)})),kr((function(e,t){var i;e.exports=(i=gd,function(){var e=i,t=e.lib.BlockCipher,s=e.algo,r=[],o=[],a=[],n=[],l=[],d=[],h=[],c=[],u=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var i=0,s=0;for(t=0;t<256;t++){var f=s^s<<1^s<<2^s<<3^s<<4;f=f>>>8^255&f^99,r[i]=f,o[f]=i;var m=e[i],g=e[m],y=e[g],A=257*e[f]^16843008*f;a[i]=A<<24|A>>>8,n[i]=A<<16|A>>>16,l[i]=A<<8|A>>>24,d[i]=A,A=16843009*y^65537*g^257*m^16843008*i,h[f]=A<<24|A>>>8,c[f]=A<<16|A>>>16,u[f]=A<<8|A>>>24,p[f]=A,i?(i=m^e[e[e[y^m]]],s^=e[e[s]]):i=s=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],m=s.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,i=e.sigBytes/4,s=4*((this._nRounds=i+6)+1),o=this._keySchedule=[],a=0;a6&&a%i==4&&(d=r[d>>>24]<<24|r[d>>>16&255]<<16|r[d>>>8&255]<<8|r[255&d]):(d=r[(d=d<<8|d>>>24)>>>24]<<24|r[d>>>16&255]<<16|r[d>>>8&255]<<8|r[255&d],d^=f[a/i|0]<<24),o[a]=o[a-i]^d);for(var n=this._invKeySchedule=[],l=0;l>>24]]^c[r[d>>>16&255]]^u[r[d>>>8&255]]^p[r[255&d]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,n,l,d,r)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,h,c,u,p,o),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,s,r,o,a,n){for(var l=this._nRounds,d=e[t]^i[0],h=e[t+1]^i[1],c=e[t+2]^i[2],u=e[t+3]^i[3],p=4,f=1;f>>24]^r[h>>>16&255]^o[c>>>8&255]^a[255&u]^i[p++],g=s[h>>>24]^r[c>>>16&255]^o[u>>>8&255]^a[255&d]^i[p++],y=s[c>>>24]^r[u>>>16&255]^o[d>>>8&255]^a[255&h]^i[p++],A=s[u>>>24]^r[d>>>16&255]^o[h>>>8&255]^a[255&c]^i[p++];d=m,h=g,c=y,u=A}m=(n[d>>>24]<<24|n[h>>>16&255]<<16|n[c>>>8&255]<<8|n[255&u])^i[p++],g=(n[h>>>24]<<24|n[c>>>16&255]<<16|n[u>>>8&255]<<8|n[255&d])^i[p++],y=(n[c>>>24]<<24|n[u>>>16&255]<<16|n[d>>>8&255]<<8|n[255&h])^i[p++],A=(n[u>>>24]<<24|n[d>>>16&255]<<16|n[h>>>8&255]<<8|n[255&c])^i[p++],e[t]=m,e[t+1]=g,e[t+2]=y,e[t+3]=A},keySize:8});e.AES=t._createHelper(m)}(),i.AES)})),kr((function(e,t){var i;e.exports=(i=gd,function(){var e=i,t=e.lib,s=t.WordArray,r=t.BlockCipher,o=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],n=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],d=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],h=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],c=o.DES=r.extend({_doReset:function(){for(var e=this._key.words,t=[],i=0;i<56;i++){var s=a[i]-1;t[i]=e[s>>>5]>>>31-s%32&1}for(var r=this._subKeys=[],o=0;o<16;o++){var d=r[o]=[],h=l[o];for(i=0;i<24;i++)d[i/6|0]|=t[(n[i]-1+h)%28]<<31-i%6,d[4+(i/6|0)]|=t[28+(n[i+24]-1+h)%28]<<31-i%6;for(d[0]=d[0]<<1|d[0]>>>31,i=1;i<7;i++)d[i]=d[i]>>>4*(i-1)+3;d[7]=d[7]<<5|d[7]>>>27}var c=this._invSubKeys=[];for(i=0;i<16;i++)c[i]=r[15-i]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,i){this._lBlock=e[t],this._rBlock=e[t+1],u.call(this,4,252645135),u.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),u.call(this,1,1431655765);for(var s=0;s<16;s++){for(var r=i[s],o=this._lBlock,a=this._rBlock,n=0,l=0;l<8;l++)n|=d[l][((a^r[l])&h[l])>>>0];this._lBlock=a,this._rBlock=o^n}var c=this._lBlock;this._lBlock=this._rBlock,this._rBlock=c,u.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),u.call(this,16,65535),u.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function u(e,t){var i=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=i,this._lBlock^=i<>>e^this._lBlock)&t;this._lBlock^=i,this._rBlock^=i<192.");var t=e.slice(0,2),i=e.length<4?e.slice(0,2):e.slice(2,4),r=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=c.createEncryptor(s.create(t)),this._des2=c.createEncryptor(s.create(i)),this._des3=c.createEncryptor(s.create(r))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=r._createHelper(f)}(),i.TripleDES)})),kr((function(e,t){var i;e.exports=(i=gd,function(){var e=i,t=e.lib.StreamCipher,s=e.algo,r=s.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,i=e.sigBytes,s=this._S=[],r=0;r<256;r++)s[r]=r;r=0;for(var o=0;r<256;r++){var a=r%i,n=t[a>>>2]>>>24-a%4*8&255;o=(o+s[r]+n)%256;var l=s[r];s[r]=s[o],s[o]=l}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,i=this._j,s=0,r=0;r<4;r++){i=(i+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[i],e[i]=o,s|=e[(e[t]+e[i])%256]<<24-8*r}return this._i=t,this._j=i,s}e.RC4=t._createHelper(r);var a=s.RC4Drop=r.extend({cfg:r.cfg.extend({drop:192}),_doReset:function(){r._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});e.RC4Drop=t._createHelper(a)}(),i.RC4)})),kr((function(e,t){var i;e.exports=(i=gd,function(){var e=i,t=e.lib.StreamCipher,s=e.algo,r=[],o=[],a=[],n=s.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,i=0;i<4;i++)e[i]=16711935&(e[i]<<8|e[i]>>>24)|4278255360&(e[i]<<24|e[i]>>>8);var s=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],r=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,i=0;i<4;i++)l.call(this);for(i=0;i<8;i++)r[i]^=s[i+4&7];if(t){var o=t.words,a=o[0],n=o[1],d=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),c=d>>>16|4294901760&h,u=h<<16|65535&d;for(r[0]^=d,r[1]^=c,r[2]^=h,r[3]^=u,r[4]^=d,r[5]^=c,r[6]^=h,r[7]^=u,i=0;i<4;i++)l.call(this)}},_doProcessBlock:function(e,t){var i=this._X;l.call(this),r[0]=i[0]^i[5]>>>16^i[3]<<16,r[1]=i[2]^i[7]>>>16^i[5]<<16,r[2]=i[4]^i[1]>>>16^i[7]<<16,r[3]=i[6]^i[3]>>>16^i[1]<<16;for(var s=0;s<4;s++)r[s]=16711935&(r[s]<<8|r[s]>>>24)|4278255360&(r[s]<<24|r[s]>>>8),e[t+s]^=r[s]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,i=0;i<8;i++)o[i]=t[i];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,i=0;i<8;i++){var s=e[i]+t[i],r=65535&s,n=s>>>16,l=((r*r>>>17)+r*n>>>15)+n*n,d=((4294901760&s)*s|0)+((65535&s)*s|0);a[i]=l^d}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=t._createHelper(n)}(),i.Rabbit)})),kr((function(e,t){var i;e.exports=(i=gd,function(){var e=i,t=e.lib.StreamCipher,s=e.algo,r=[],o=[],a=[],n=s.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],s=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var r=0;r<4;r++)l.call(this);for(r=0;r<8;r++)s[r]^=i[r+4&7];if(t){var o=t.words,a=o[0],n=o[1],d=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),c=d>>>16|4294901760&h,u=h<<16|65535&d;for(s[0]^=d,s[1]^=c,s[2]^=h,s[3]^=u,s[4]^=d,s[5]^=c,s[6]^=h,s[7]^=u,r=0;r<4;r++)l.call(this)}},_doProcessBlock:function(e,t){var i=this._X;l.call(this),r[0]=i[0]^i[5]>>>16^i[3]<<16,r[1]=i[2]^i[7]>>>16^i[5]<<16,r[2]=i[4]^i[1]>>>16^i[7]<<16,r[3]=i[6]^i[3]>>>16^i[1]<<16;for(var s=0;s<4;s++)r[s]=16711935&(r[s]<<8|r[s]>>>24)|4278255360&(r[s]<<24|r[s]>>>8),e[t+s]^=r[s]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,i=0;i<8;i++)o[i]=t[i];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,i=0;i<8;i++){var s=e[i]+t[i],r=65535&s,n=s>>>16,l=((r*r>>>17)+r*n>>>15)+n*n,d=((4294901760&s)*s|0)+((65535&s)*s|0);a[i]=l^d}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=t._createHelper(n)}(),i.RabbitLegacy)})),kr((function(e,t){var i;e.exports=(i=gd,function(){var e=i,t=e.lib.BlockCipher,s=e.algo;const r=16,o=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var n={pbox:[],sbox:[]};function l(e,t){let i=t>>24&255,s=t>>16&255,r=t>>8&255,o=255&t,a=e.sbox[0][i]+e.sbox[1][s];return a^=e.sbox[2][r],a+=e.sbox[3][o],a}function d(e,t,i){let s,o=t,a=i;for(let t=0;t1;--t)o^=e.pbox[t],a=l(e,o)^a,s=o,o=a,a=s;return s=o,o=a,a=s,a^=e.pbox[1],o^=e.pbox[0],{left:o,right:a}}function c(e,t,i){for(let t=0;t<4;t++){e.sbox[t]=[];for(let i=0;i<256;i++)e.sbox[t][i]=a[t][i]}let s=0;for(let a=0;a=i&&(s=0);let n=0,l=0,h=0;for(let t=0;t>>2]|=e[i]<<24-i%4*8;return yd.lib.WordArray.create(t,e.length)}const vd=16,_d=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],Sd=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Ed(e){const t=[];for(let i=0,s=e.length;i1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Td(e){const t=[];for(let i=0,s=e.length;i>>6),t.push(128|63&s);else if(s<=55295||s>=57344&&s<=65535)t.push(224|s>>>12),t.push(128|s>>>6&63),t.push(128|63&s);else{if(!(s>=65536&&s<=1114111))throw t.push(s),new Error("input is not supported");i++,t.push(240|s>>>18&28),t.push(128|s>>>12&63),t.push(128|s>>>6&63),t.push(128|63&s)}}return t}function kd(e){const t=[];for(let i=0,s=e.length;i=240&&e[i]<=247?(t.push(String.fromCodePoint(((7&e[i])<<18)+((63&e[i+1])<<12)+((63&e[i+2])<<6)+(63&e[i+3]))),i+=3):e[i]>=224&&e[i]<=239?(t.push(String.fromCodePoint(((15&e[i])<<12)+((63&e[i+1])<<6)+(63&e[i+2]))),i+=2):e[i]>=192&&e[i]<=223?(t.push(String.fromCodePoint(((31&e[i])<<6)+(63&e[i+1]))),i++):t.push(String.fromCodePoint(e[i]));return t.join("")}function Ld(e,t){const i=31&t;return e<>>32-i}function Cd(e){return(255&_d[e>>>24&255])<<24|(255&_d[e>>>16&255])<<16|(255&_d[e>>>8&255])<<8|255&_d[255&e]}function Dd(e){return e^Ld(e,2)^Ld(e,10)^Ld(e,18)^Ld(e,24)}function xd(e){return e^Ld(e,13)^Ld(e,23)}function Rd(e,t,i){const s=new Array(4),r=new Array(4);for(let t=0;t<4;t++)r[0]=255&e[4*t],r[1]=255&e[4*t+1],r[2]=255&e[4*t+2],r[3]=255&e[4*t+3],s[t]=r[0]<<24|r[1]<<16|r[2]<<8|r[3];for(let e,t=0;t<32;t+=4)e=s[1]^s[2]^s[3]^i[t+0],s[0]^=Dd(Cd(e)),e=s[2]^s[3]^s[0]^i[t+1],s[1]^=Dd(Cd(e)),e=s[3]^s[0]^s[1]^i[t+2],s[2]^=Dd(Cd(e)),e=s[0]^s[1]^s[2]^i[t+3],s[3]^=Dd(Cd(e));for(let e=0;e<16;e+=4)t[e]=s[3-e/4]>>>24&255,t[e+1]=s[3-e/4]>>>16&255,t[e+2]=s[3-e/4]>>>8&255,t[e+3]=255&s[3-e/4]}function Pd(e,t,i){const s=new Array(4),r=new Array(4);for(let t=0;t<4;t++)r[0]=255&e[0+4*t],r[1]=255&e[1+4*t],r[2]=255&e[2+4*t],r[3]=255&e[3+4*t],s[t]=r[0]<<24|r[1]<<16|r[2]<<8|r[3];s[0]^=2746333894,s[1]^=1453994832,s[2]^=1736282519,s[3]^=2993693404;for(let e,i=0;i<32;i+=4)e=s[1]^s[2]^s[3]^Sd[i+0],t[i+0]=s[0]^=xd(Cd(e)),e=s[2]^s[3]^s[0]^Sd[i+1],t[i+1]=s[1]^=xd(Cd(e)),e=s[3]^s[0]^s[1]^Sd[i+2],t[i+2]=s[2]^=xd(Cd(e)),e=s[0]^s[1]^s[2]^Sd[i+3],t[i+3]=s[3]^=xd(Cd(e));if(0===i)for(let e,i=0;i<16;i++)e=t[i],t[i]=t[31-i],t[31-i]=e}function Bd(e,t,i){let{padding:s="pkcs#7",mode:r,iv:o=[],output:a="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===r&&("string"==typeof o&&(o=Ed(o)),16!==o.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=Ed(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==i?Td(e):Ed(e):[...e],("pkcs#5"===s||"pkcs#7"===s)&&0!==i){const t=vd-e.length%vd;for(let i=0;i=vd;){const t=e.slice(c,c+16),s=new Array(16);if("cbc"===r)for(let e=0;ee.length&&s+r<=i.length?e.length-t:s+r>i.length&&t+r<=e.length?i.length-s:t+r<=e.length&&s+r<=i.length?r:i.length>24&255,e>>16&255,e>>8&255,255&e)}function Wd(e,t){return t+3>>19)^(s<<23|s>>>9)}function $d(e,t){var i=new Array(36);i[0]=Wd(t,0),i[1]=Wd(t,4),i[2]=Wd(t,8),i[3]=Wd(t,12);for(var s=0;s<32;s++)i[s+4]=i[s]^Jd(i[s+1]^i[s+2]^i[s+3]^e[s]);var r=new Array(4);for(s=35;s>=32;s--)r[35-s]=i[s];var o=function(e){for(var t=new Array(4*e.length),i=0;i>>30)^(s<<10|s>>>22)^(s<<18|s>>>14)^(s<<24|s>>>8)}function qd(e,t,i){if(null==e||null==e||e.length%16!=0)return console.log("sm4 key is error!"),null;if(null==i||null==i||i.length<=0)return console.log("cipher is error!"),null;if(null==t||null==t||t.length%16!=0)return console.log("iv is error!"),null;for(var s=Vd(e),r=Math.ceil(i.length/16),o=new Array(i.length),a=t.slice(),n=0;ne)return this.preDelayTimestamp-e>1e3&&this.player.debugWarn("CommonDemux",`getDelay() and preDelayTimestamp is ${this.preDelayTimestamp} > timestamp is ${e} more than ${this.preDelayTimestamp-e}ms and return ${this.delay}`),this.preDelayTimestamp=e,this.delay;if(this.firstTimestamp){if(e){const t=Date.now()-this.startTimestamp,i=e-this.firstTimestamp;t>=i?(this.isStreamTsMoreThanLocal=!1,this.delay=t-i):(this.isStreamTsMoreThanLocal=!0,this.delay=i-t)}}else this.firstTimestamp=e,this.startTimestamp=Date.now(),this.delay=-1;return this.preDelayTimestamp=e,this.delay}getDelayNotUpdateDelay(e,t){if(!e||!this.player.isDemuxDecodeFirstIIframeInit())return-1;if(t===Fe)return this.pushLatestDelay;if(this.preDelayTimestamp&&this.preDelayTimestamp-e>1e3)return this.player.debugWarn("CommonDemux",`getDelayNotUpdateDelay() and preDelayTimestamp is ${this.preDelayTimestamp} > timestamp is ${e} more than ${this.preDelayTimestamp-e}ms and return -1`),-1;if(this.firstTimestamp){let t=-1;if(e){const i=Date.now()-this.startTimestamp,s=e-this.firstTimestamp;t=i>=s?i-s:s-i}return t}return-1}resetDelay(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1}resetAllDelay(){this.resetDelay(),this.preDelayTimestamp=null}initInterval(){this.player.isUseHls265()?this.player.debugLog("CommonDemux","initInterval() and is hls and support hls265 so return"):-1===this.player.getStreamType().indexOf(y)?this.player.isPlaybackCacheBeforeDecodeForFpsRender()?this.player.debugLog("CommonDemux","initInterval() and playback and playbackIsCacheBeforeDecodeForFpsRender is true so return"):(this.player.debugLog("CommonDemux","setInterval()"),this._loop(),this.stopId=setInterval((()=>{if(this.player.isDestroyedOrClosed())return;let e=(new Date).getTime();this.preLoopTimestamp||(this.preLoopTimestamp=e);const t=e-this.preLoopTimestamp;this.updateHistoryIntervalDiffTimeList(t),t>100&&this.player.debugWarn("CommonDemux",`loop demux diff time is ${t}`),this._loop(),this.preLoopTimestamp=(new Date).getTime()}),20)):this.player.debugLog("CommonDemux","initInterval() and is worker stream so return")}clearStopInterval(){this.stopId&&(clearInterval(this.stopId),this.stopId=null)}startPlaybackLoopInterval(){this.initPlaybackCacheLoop()}updateHistoryIntervalDiffTimeList(e){this.historyIntervalDiffTimeList.length>5&&this.historyIntervalDiffTimeList.shift(),this.historyIntervalDiffTimeList.push(e)}isHistoryIntervalDiffTimeAllLarge(){if(this.historyIntervalDiffTimeList.length<5)return!1;for(let e=0;e{let e=null;this.bufferList.length&&(e=this.bufferList.shift(),this._doDecoderDecode(e))};e();const t=Math.ceil(1e3/(this.playbackStreamFps*this.player.getPlaybackRate()));this.player.debugLog("CommonDemux",`initPlaybackCacheLoop() and fragDuration is ${t}, playbackStreamFps is ${this.playbackStreamFps}, playbackRate is ${this.player.getPlaybackRate()}`),this.stopId=setInterval(e,t)}_loop(){let e;const t=this.player._opt.videoBuffer,i=this.player._opt.videoBufferDelay,s=this.player._opt.playType===b;if(this.bufferList.length){if(this.isPushDropping)return void this.player.debugWarn("CommonDemux",`_loop isPushDropping is true and bufferList length is ${this.bufferList.length}`);if(this.dropping){for(e=this.bufferList.shift(),this.player.debugWarn("CommonDemux",`_loop is dropping and data.ts is ${e.ts}, data.type is ${e.type}, data.isIFrame is ${e.isIFrame}, delay is ${this.delay} ,buffer list is ${this.bufferList.length}`);!e.isIFrame&&this.bufferList.length;)e=this.bufferList.shift();const t=this.getDelayNotUpdateDelay(e.ts,e.type);e.isIFrame&&t<=this.getNotDroppingDelayTs()&&(this.player.debugLog("CommonDemux",`_loop data isIFrame is true and delay is ${this.delay}`),this.dropping=!1,this._doDecoderDecode(e),this._decodeNext(e))}else if(this.player.isPlayback()||this.player.isPlayUseMSE()||0===t)for(;this.bufferList.length;)e=this.bufferList.shift(),this._doDecoderDecode(e);else if(e=this.bufferList[0],-1===this.getDelay(e.ts,e.type))this.player.debugLog("CommonDemux",`delay is -1 and data.ts is ${e.ts} data.type is ${e.type}`),this.bufferList.shift(),this._doDecoderDecode(e),this._decodeNext(e);else if(this.delay>i+t&&s)this.hasIframeInBufferList()?(this.player.debugWarn("CommonDemux",`_loop delay is ${this.delay}, set dropping is true`),this.resetAllDelay(),this.dropping=!0,this.player.updateStats({isDropping:!0})):(this.bufferList.shift(),this._doDecoderDecode(e),this._decodeNext(e));else for(;this.bufferList.length;){if(e=this.bufferList[0],!(this.getDelay(e.ts,e.type)>t)){this.delay<0&&this.player.debugWarn("CommonDemux",`_loop delay is ${this.delay} bufferList is ${this.bufferList}`);break}this.bufferList.shift(),this._doDecoderDecode(e)}}else-1!==this.delay&&this.player.debugLog("CommonDemux","loop() bufferList is empty and reset delay"),this.resetAllDelay()}_doDecode(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;const o=this.player;let a={ts:i,cts:r,type:t,isIFrame:!1};this.player.isPlayer()?(t===Ue&&o._opt.playType===b&&this.calcNetworkDelay(i),o._opt.useWCS&&!o._opt.useOffscreen||o._opt.useMSE?(t===Ue&&(a.isIFrame=s),this.pushBuffer(e,a)):t===Ue?o.decoderWorker&&o.decoderWorker.decodeVideo(e,i,s):t===Fe&&o._opt.hasAudio&&o.decoderWorker&&o.decoderWorker.decodeAudio(e,i)):this.player.isPlayback()&&(t===Ue&&(a.isIFrame=s),this.player.isPlaybackOnlyDecodeIFrame()?t===Ue&&s&&this.pushBuffer(e,a):this.player.isPlaybackCacheBeforeDecodeForFpsRender()||1===this.player.getPlaybackRate()?this.pushBuffer(e,a):this.pushBuffer(e,a,!1))}_doDecodeByHls(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=!1;if(t===Fe&&Br(e)&&(this.player.debugLog("CommonDemux",`hls pushBuffer audio ts is ${i}, isAacCodecPacket is true`),o=!0,this.player.isRecordTypeFlv())){const t=new Uint8Array(e);this.player.recorder.addAACSequenceHeader(t,i)}let a=!1;if(t===Ue&&s&&ha(e)&&(this.player.debugLog("CommonDemux",`hls pushBuffer video ts is ${i}, isVideoSequenceHeader is true`),a=!0,this.player.isRecordTypeFlv())){const t=new Uint8Array(e);this.player.recorder.addVideoSequenceHeader(t,i)}this.player.recording&&ua(a)&&ua(o)&&this.handleRecording(e,t,i,s,r),t===Ue?this._doDecoderDecode({ts:i,cts:r,payload:e,type:Ue,isIFrame:s}):t===Fe&&this._doDecoderDecode({ts:i,payload:e,type:Fe})}_doDecodeByFmp4(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,i,s,r)}_doDecodeByTs(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,i,s,r)}_doDecodeByPs(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,i,s,r)}_decodeNext(e){const t=e.ts;if(0===this.bufferList.length)return;let i=this.bufferList[0];const s=i.ts-t,r=e.type===Ue&&i.type===Fe,o=e.type===Ue&&ha(e.payload);(s<=20||r||o)&&(this.player.debugLog("CommonDemux",`decode data type is ${e.type} and\n ts is ${t} next data type is ${i.type} ts is ${i.ts}\n diff is ${s} and isVideoAndNextAudio is ${r} and isVideoSqeHeader is ${o}`),this.bufferList.shift(),this._doDecoderDecode(i))}_doDecoderDecode(e){const t=this.player,{webcodecsDecoder:i,mseDecoder:s}=t;this.player.isPlayer()&&this.player.updateStats({buf:this.delay}),e.type===Fe?t._opt.hasAudio&&(t._opt.useMSE&&t._opt.mseDecodeAudio?s.decodeAudio(e.payload,e.ts):t._opt.useWCS&&t._opt.wcsDecodeAudio?i.decodeAudio(e.payload,e.ts):t.decoderWorker&&t.decoderWorker.decodeAudio(e.payload,e.ts)):e.type===Ue&&(t._opt.isEmitSEI&&this.findSei(e.payload,e.ts),t._opt.useWCS&&!t._opt.useOffscreen?i.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):t._opt.useMSE?s.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):t.decoderWorker&&t.decoderWorker.decodeVideo(e.payload,e.ts,e.isIFrame))}pushBuffer(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=this.player._opt.videoBuffer,r=this.player._opt.videoBufferDelay,o=this.player.isPlayer();if(t.type===Fe&&Br(e)){if(this.player.debugLog("CommonDemux",`pushBuffer() audio ts is ${t.ts}, isAacCodecPacket is true`),this.player.isRecordTypeFlv()){const i=new Uint8Array(e);this.player.recorder.addAACSequenceHeader(i,t.ts)}this._doDecoderDecode({ts:t.ts,payload:e,type:Fe})}else if(t.type===Ue&&t.isIFrame&&ha(e)){if(this.player.debugLog("CommonDemux",`pushBuffer() video ts is ${t.ts}, isVideoSequenceHeader is true`),this.player.isRecordTypeFlv()){const i=new Uint8Array(e);this.player.recorder.addVideoSequenceHeader(i,t.ts)}this._doDecoderDecode({ts:t.ts,payload:e,type:Ue,isIFrame:t.isIFrame,cts:t.cts})}else{if(this.player.recording&&this.handleRecording(e,t.type,t.ts,t.isIFrame,t.cts),o){if(t.type===Ue){if(this.preTimestampDuration>0){const e=t.ts-this.preTimestamp,i=this.preTimestampDuration+this.preTimestampDuration/2;e>=i&&this.player.debugLog("CommonDemux",`pushBuffer() video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts}, preTs is ${this.preTimestamp},\n diff is ${e} and preTsDuration is ${this.preTimestampDuration} and maxDiff is ${i}\n maybe trigger black screen or flower screen`)}if(null!==this.preTimestamp&&this.preTimestamp>=t.ts&&(this.player.debugWarn("CommonDemux",`pushBuffer() video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts} less than (or equal) preTs is ${this.preTimestamp} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${this.prevPayloadBufferSize}`),this.preTimestamp-t.ts>X&&(this.player.debugWarn("CommonDemux",`pushBuffer() video\n ts is ${t.ts}, preTimestamp is ${this.preTimestamp},\n diff is ${this.preTimestamp-t.ts} more than 3600000\n and resetAllDelay()`),this.resetAllDelay()),this.player._opt.isDropSameTimestampGop&&ua(t.isIFrame)&&this.player.isDemuxDecodeFirstIIframeInit())){const e=this.hasIframeInBufferList(),t=ua(this.isPushDropping);return this.player.debugLog("CommonDemux",`pushBuffer(), isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next drop buffer`),void(e&&t?this.dropBuffer$2():this.clearBuffer(!0))}this.preTimestamp>0&&(this.preTimestampDuration=t.ts-this.preTimestamp),this.prevPayloadBufferSize=e.byteLength,this.preTimestamp=t.ts}if(this.player.isDemuxDecodeFirstIIframeInit()){let e=this.getDelayNotUpdateDelay(t.ts,t.type);this.pushLatestDelay=e;const i=r+s;this.player._opt.useMSE?this.delay>0&&e>i&&this.delay ${r+s}, bufferList is ${this.bufferList.length}, delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()):this.delay>0&&e>i&&this.delay ${r+s},bufferList is ${this.bufferList.length}, delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()),this.isHistoryIntervalDiffTimeAllLarge()&&ua(this.player.visibility)&&(this.player._opt.useMSE?this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debugWarn("CommonDemux",`useMSE, page visibility is false and\n history interval diff is ${this.historyIntervalDiffTimeList.join(",")} and\n bufferList is ${this.bufferList.length},\n delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()):this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debugWarn("CommonDemux",`useWCS, page visibility is false and\n history interval diff is ${this.historyIntervalDiffTimeList.join(",")} and\n bufferList is ${this.bufferList.length},\n delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()))}}i?t.type===Fe?this.bufferList.push({ts:t.ts,payload:e,type:Fe}):t.type===Ue&&this.bufferList.push({ts:t.ts,cts:t.cts,payload:e,type:Ue,isIFrame:t.isIFrame}):t.type===Ue?this._doDecoderDecode({ts:t.ts,cts:t.cts,payload:e,type:Ue,isIFrame:t.isIFrame}):t.type===Fe&&this._doDecoderDecode({ts:t.ts,payload:e,type:Fe}),this.player.isPlaybackCacheBeforeDecodeForFpsRender()&&this.calcPlaybackStreamFps()}}calcPlaybackStreamFps(){if(Lo(this.playbackStreamVideoFps)||Lo(this.playbackStreamAudioFps)){let e=this.playbackStreamVideoFps,t=this.playbackStreamAudioFps;if(Lo(this.playbackStreamVideoFps)&&(e=sa(this.bufferList,Ue),e>0&&(this.playbackStreamVideoFps=e,this.player.video&&this.player.video.setStreamFps(this.playbackStreamVideoFps),this.playbackStreamFps=t?e+t:e,ua(this.player._opt.hasAudio)&&(this.player.debugLog(this.TAG_NAME,"playbackCacheBeforeDecodeForFpsRender,_opt.hasAudio is false and set streamAudioFps is 0"),this.playbackStreamAudioFps=0),this.initPlaybackCacheLoop())),Lo(this.playbackStreamAudioFps)&&(t=sa(this.bufferList,Fe),t>0&&(this.playbackStreamAudioFps=t,this.playbackStreamFps=e?e+t:t,this.initPlaybackCacheLoop())),Lo(this.playbackStreamVideoFps)&&Lo(this.playbackStreamAudioFps)){const i=this.bufferList.map((e=>({type:e.type,ts:e.ts})));this.player.debugLog("CommonDemux",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${this.bufferList.length} and ts list is ${JSON.stringify(i)}`)}const i=this.getAudioBufferLength()>0,s=i?60:40;this.bufferList.length>=s&&(this.player.debugWarn("CommonDemux",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${this.bufferList.length} more than ${s}, and hasAudio is ${i} an set streamFps is 25`),this.playbackStreamVideoFps=e,this.player.video&&this.player.video.setStreamFps(this.playbackStreamVideoFps),i?(this.playbackStreamAudioFps=25,this.playbackStreamFps=this.playbackStreamVideoFps+this.playbackStreamAudioFps):this.playbackStreamFps=this.playbackStreamVideoFps,this.initPlaybackCacheLoop())}}dropBuffer$2(){if(this.bufferList.length>0){let e=this.bufferList.findIndex((e=>ca(e.isIFrame)&&e.type===Ue));if(this.isAllIframeInBufferList())for(let t=0;t=this.getNotDroppingDelayTs()){this.player.debugLog("CommonDemux",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${s} and notDroppingDelayTs is ${this.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){this.isPushDropping=!0,this.player.updateStats({isDropping:!0});const t=this.bufferList.length;this.bufferList=this.bufferList.slice(e);const i=this.bufferList.shift();this.resetAllDelay(),this.getDelay(i.ts,i.type),this._doDecoderDecode(i),this.isPushDropping=!1,this.player.debugLog("CommonDemux",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,and new bufferList length is ${this.bufferList.length} and new delay is ${this.delay} `)}else this.isPushDropping=!1}0===this.bufferList.length&&(this.isPushDropping=!1)}clearBuffer(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.player.debugLog("CommonDemux",`clearBuffer,buffer length is ${this.bufferList.length}, need clear is ${e} and _opt.checkFirstIFrame is ${this.player._opt.checkFirstIFrame}`),e&&(this.bufferList=[]),this.player.isPlayer()&&(this.resetAllDelay(),ca(this.player._opt.checkFirstIFrame)&&(this.dropping=!0,this.player.updateStats({isDropping:!0}))),this.player.decoderCheckFirstIFrame()}calcNetworkDelay(e){if(!(this.player.isDemuxDecodeFirstIIframeInit()&&e>0))return;null===this.bufferStartDts?(this.bufferStartDts=e,this.bufferStartLocalTs=Zr()):et?i-t:0;s>this.player._opt.networkDelay&&this.player._opt.playType===b&&(this.player.debugWarn("CommonDemux",`delay is more than networkDelay and now dts:${e},start dts is ${this.bufferStartDts}, vs start is ${t},local diff is ${i} ,delay is ${s}, _opt.networkDelay is ${this.player._opt.networkDelay}`),this.player.emit(ot.networkDelayTimeout,s)),this.player.updateStats({netBuf:s})}calcIframeIntervalTimestamp(e){if(null===this.preIframeTs)this.preIframeTs=e;else if(this.preIframeTs{t.type===Ue&&(e+=1)})),e}getAudioBufferLength(){let e=0;return this.bufferList.forEach((t=>{t.type===Fe&&(e+=1)})),e}hasIframeInBufferList(){return this.bufferList.some((e=>e.type===Ue&&e.isIFrame))}isAllIframeInBufferList(){const e=this.getVideoBufferLength();let t=0;return this.bufferList.forEach((e=>{e.type===Ue&&e.isIFrame&&(t+=1)})),e===t}getInputByteLength(){return 0}getIsStreamTsMoreThanLocal(){return this.isStreamTsMoreThanLocal}close(){}reset(){}findSei(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=4;Do(this.nalUnitSize)&&(s=this.nalUnitSize);const r=Jr(e.slice(5),s);if(ua(i)){const e=this.player.getVideoInfo();e&&e.encType&&(i=e.encType===vt)}r.forEach((e=>{const s=i?e[0]>>>1&63:31&e[0];(i&&(s===Kt||s===qt)||ua(i)&&s===Rt)&&this.player.emitVideoSei({ts:t,data:e})}))}handleRecording(e,t,i,s,r){if(this.player.isRecordTypeFlv()){const s=new Uint8Array(e);t===Ue?this.player.recorder.addVideo(s,i):t===Fe&&this.player.recorder.addAudio(s,i)}else if(this.player.isRecordTypeMp4()){const o=new Uint8Array(e);if(this.player.recorder.isWasmMp4()){if(t===Ue)this.player.recorder.handleAddNaluTrack(o.slice(5),s,i,r);else if(t===Fe){const t=new Uint8Array(e);this.player.recorder.handleAddAudioTrack(Ir(t)?t.slice(2):t.slice(1),i)}}else t===Ue&&this.player.recorder.handleAddNaluTrack(o.slice(5),s,i,r)}}updateNalUnitSize(e){const t=15&e[0];this.player.video.updateVideoInfo({encTypeCode:t});const i=t===At;this.nalUnitSize=function(e,t){let i=null;return t?e.length>=28&&(i=1+(3&e[26])):e.length>=12&&(i=1+(3&e[9])),i}(e,i),this.player.debugLog(this.TAG_NAME,`demux() isVideoSequenceHeader is true and isHevc is ${i} and nalUnitSize is ${this.nalUnitSize}`)}cryptoPayload(e,t){let i=this.player,s=e;if(i._opt.isM7sCrypto)if(i._opt.cryptoKey&&i._opt.cryptoKey.byteLength>0&&i._opt.cryptoIV&&i._opt.cryptoIV.byteLength>0){const t=this.player.video.getVideoInfo();t.encTypeCode?s=function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),i=new Uint8Array(i);const r=e.byteLength;let o=5;for(;or)break;let n=e[o+4],l=!1;if(s?(n=n>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(n)):(n&=31,l=1===n||5===n),l){const s=e.slice(o+4+2,o+4+a);let r=new md.ModeOfOperation.ctr(t,new md.Counter(i));const n=r.decrypt(s);r=null,e.set(n,o+4+2)}o=o+4+a}return e}(e,i._opt.cryptoKey,i._opt.cryptoIV,t.encTypeCode===At):i.debugWarn(this.TAG_NAME,`videoInfo.encTypeCode is ${t.encTypeCode}`)}else i.debugError(this.TAG_NAME,`isM7sCrypto cryptoKey.length is ${i._opt.cryptoKey&&i._opt.cryptoKey.byteLength} or cryptoIV.length is ${i._opt.cryptoIV&&i._opt.cryptoIV.byteLength} null`);else if(i._opt.isSm4Crypto)if(i._opt.sm4CryptoKey){const t=this.player.video.getVideoInfo().encTypeCode===At,r=this.player._opt.isSm4CryptoH265V2;s=i._opt.cryptoKey&&i._opt.cryptoKey.byteLength>0&&i._opt.cryptoIV&&i._opt.cryptoIV.byteLength>0?function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t=new Uint8Array(t),i=new Uint8Array(i);const o=e.byteLength;let a=5;for(;ao)break;let l=e[a+4],d=!1,h=2;if(s?(r&&(h=3),l=l>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(l)):(l&=31,d=1===l||5===l),d){const s=qd(t,i,e.slice(a+4+h,a+4+n));e.set(s,a+4+h)}a=a+4+n}return e}(e,i._opt.cryptoKey,i._opt.cryptoIV,t,r):function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=e.byteLength;let o=new Uint8Array(e.slice(0,5)),a=5;for(;ar){const t=new Uint8Array(o.length+e.length-a);t.set(o,0),t.set(e.slice(a),o.length),o=t;break}let d=e[a+4],h=!1,c=2;if(i?(s&&(c=3),d=d>>>1&63,h=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(d)):(d&=31,h=1===d||5===d),h){const i=Bd(e.slice(a+4+c,a+4+l),t,0,{padding:"none",output:"array"});let s=i[i.length-1];if(s>0&&s<16){let e=!0;for(let t=1;t<=s;t++)if(i[i.length-t]!==s){e=!1;break}e&&i.splice(i.length-s,s)}const r=new Uint8Array(c);r.set(e.slice(a+4,a+4+c),0);const n=qr(tl(r,new Uint8Array(i))),d=new Uint8Array(o.length+n.length);d.set(o,0),d.set(n,o.length),o=d}else{const t=e.slice(a+4,a+4+l),i=new Uint8Array(o.length+4+t.length);i.set(o,0),i.set(n,o.length),i.set(t,o.length+4),o=i}a=a+4+l}return o}(e,i._opt.sm4CryptoKey,t,r)}else i._opt.sm4CryptoKey||i.debugError(this.TAG_NAME,"isSm4Crypto opt.sm4CryptoKey is null");else if(i._opt.isXorCrypto)if(i._opt.cryptoKey&&i._opt.cryptoKey.byteLength>0&&i._opt.cryptoIV&&i._opt.cryptoIV.byteLength>0){const t=this.player.video.getVideoInfo();s=function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=e.byteLength;let o=5;for(;or)break;let n=e[o+4],l=!1;if(s?(n=n>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(n)):(n&=31,l=1===n||5===n),l){const s=Md(e.slice(o+4,o+4+a),t,i);e.set(s,o+4)}o=o+4+a}return e}(e,i._opt.cryptoKey,i._opt.cryptoIV,t.encTypeCode===At)}else i.debugError(this.TAG_NAME,"isXorCrypto opt.xorCryptoKey is null");return s}cryptoPayloadAudio(e){let t=this.player;if(ua(t._opt.isCryptoAudio))return e;let i=e;if(t._opt.isM7sCrypto)if(t._opt.cryptoKey&&t._opt.cryptoKey.byteLength>0&&t._opt.cryptoIV&&t._opt.cryptoIV.byteLength>0){e[0]>>4===_t&&(i=function(e,t,i){if(e.byteLength<=30)return e;const s=e.slice(32);let r=new md.ModeOfOperation.ctr(t,new md.Counter(i));const o=r.decrypt(s);return r=null,e.set(o,32),e}(e,t._opt.cryptoKey,t._opt.cryptoIV))}else t.debugError(this.TAG_NAME,`isM7sCrypto cryptoKey.length is ${t._opt.cryptoKey&&t._opt.cryptoKey.byteLength} or cryptoIV.length is ${t._opt.cryptoIV&&t._opt.cryptoIV.byteLength} null`);return i}_decodeEnhancedH265Video(e,t){const i=e[0],s=48&i,r=15&i,o=e.slice(1,5),a=new ArrayBuffer(4),n=new Uint32Array(a),l="a"==String.fromCharCode(o[0]);if(r===ir){if(s===or){const t=e.slice(5);if(l);else{const e=new Uint8Array(5+t.length);e.set([28,0,0,0,0],0),e.set(t,5),this.updateNalUnitSize(e),this.player.debugLog(this.TAG_NAME,`demux() isVideoSequenceHeader(enhancedH265) is true and nalUnitSize is ${this.nalUnitSize}`),this._doDecode(e,Ue,0,!0,0)}}}else if(r===sr){let i=e,r=0;const o=s===or;if(o&&this.calcIframeIntervalTimestamp(t),l);else{n[0]=e[4],n[1]=e[3],n[2]=e[2],n[3]=0,r=n[0];i=Hn(e.slice(8),o),i=this.cryptoPayload(i,o),this._doDecode(i,Ue,t,o,r)}}else if(r===rr){const i=s===or,r=e.slice(5);i&&this.calcIframeIntervalTimestamp(t);let o=Hn(r,i);o=this.cryptoPayload(o,i),this._doDecode(o,Ue,t,i,0)}}_isEnhancedH265Header(e){return 128==(128&e)}handlePlaybackPause(e){ca(e)?this.clearStopInterval():this.startPlaybackLoopInterval()}}var Yd=function(e,t,i,s){return new(i||(i=Promise))((function(r,o){function a(e){try{l(s.next(e))}catch(e){o(e)}}function n(e){try{l(s.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,n)}l((s=s.apply(e,t||[])).next())}))};const Qd=Symbol(32),Xd=Symbol(16),Zd=Symbol(8);class eh{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return Yd(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,i)=>{var s;this.reject=i,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(s=this.pull)||void 0===s||s.call(this,e)}))}))}readU32(){return this.read(Qd)}readU16(){return this.read(Xd)}readU8(){return this.read(Zd)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let i=0;const s=e=>t.length<(i=e);if("number"==typeof this.need){if(s(this.need))return;e=t.subarray(0,i)}else if(this.need===Qd){if(s(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Xd){if(s(2))return;e=t[0]<<8|t[1]}else if(this.need===Zd){if(s(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(s(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,i)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(s(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,i)),e=this.need}return this.consumed+=i,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,i=t+e;if(i<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,i);else{const e=new Uint8Array(i);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,i)}return this.buffer=new Uint8Array(e),this.buffer}}eh.U32=Qd,eh.U16=Xd,eh.U8=Zd;class th extends Kd{constructor(e){super(e),this.TAG_NAME="FlvDemux",this.input=new eh(this.demux()),e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.input&&(this.input.close(),this.input=null),this.player.debugLog(this.TAG_NAME,"destroy")}dispatch(e){this.input?this.input.write(e):this.player&&this.player.debugWarn(this.TAG_NAME,"dispatch() this.input is null")}*demux(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),i=new Uint32Array(e),s=this.player;for(;;){if(!this.input)return;t[3]=0;const e=yield 15,r=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const o=i[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let a=i[0];const n=(yield o).slice();if(!s)return;switch(r){case Oe:if(s._opt.hasAudio&&(s.updateStats({abps:n.byteLength}),n.byteLength>0)){let e=this.cryptoPayloadAudio(n);this._doDecode(e,Fe,a)}break;case Ne:if(s._opt.hasVideo&&n.length>=6){let e=a;s.updateStats({vbps:n.byteLength,dts:e}),s._times.demuxStart||(s._times.demuxStart=Zr());const t=n[0];if(this._isEnhancedH265Header(t))this._decodeEnhancedH265Video(n,e);else{const e=15&t;let s=(t>>4&15)===ws;const r=e===At,o=e===yt;if(ua(r||o))return void this.player.debugWarn(this.TAG_NAME,`demux() codecId is ${e} and ignore`);ua(s)&&ca(va(n,r))&&(this.player.debugLog(this.TAG_NAME,"demux() isIFrame is false and unit type is IDR and update to true"),s=!0),s&&(this.calcIframeIntervalTimestamp(a),null===this.nalUnitSize&&ha(n)&&this.updateNalUnitSize(n)),i[0]=n[4],i[1]=n[3],i[2]=n[2],i[3]=0;let l=i[0],d=this.cryptoPayload(n,s);this._doDecode(d,Ue,a,s,l)}}else n.length<6&&s.debugWarn(this.TAG_NAME,`payload.length is ${n.length} less than 6 and ignore`);break;case je:if(this.player.isRecordTypeFlv()){const e=new Uint8Array(n);this.player.recorder.addMetaData(e)}const e=ul(n);e&&e.onMetaData&&s.updateMetaData(e.onMetaData);break;default:s.debugLog(this.TAG_NAME,`demux() type is ${r}`)}}}close(){this.input&&(this.input.close(),this.input=null)}getInputByteLength(){let e=0;return this.input&&this.input.buffer&&(e=this.input.buffer.byteLength),e}}class ih extends Kd{constructor(e){super(e),this.TAG_NAME="M7sDemux",e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy")}dispatch(e){const t=this.player,i=new DataView(e),s=i.getUint8(0),r=i.getUint32(1,!1),o=new ArrayBuffer(4),a=new Uint32Array(o);switch(s){case Fe:if(t._opt.hasAudio){const i=new Uint8Array(e,5);t.updateStats({abps:i.byteLength}),i.byteLength>0&&this._doDecode(i,s,r)}break;case Ue:if(t._opt.hasVideo)if(t._times.demuxStart||(t._times.demuxStart=Zr()),i.byteLength>=11){const o=new Uint8Array(e,5);let n=r;t.updateStats({vbps:o.byteLength,dts:n});const l=o[0];if(this._isEnhancedH265Header(l))this._decodeEnhancedH265Video(o,r);else{const e=i.getUint8(5)>>4==1;e&&this.calcIframeIntervalTimestamp(r),a[0]=o[4],a[1]=o[3],a[2]=o[2],a[3]=0;let t=a[0],n=this.cryptoPayload(o,e);this._doDecode(n,s,r,e,t)}}else this.player.debugWarn(this.TAG_NAME,"dispatch","dv byteLength is",i.byteLength,"and return")}}}class sh extends th{constructor(e){super(e),e.debugLog("WebTransportDemux","init")}destroy(){this.player.debugLog("WebTransportDemux","destroy"),super.destroy()}}var rh,oh=kr((function(e){e.exports=function(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e},e.exports.__esModule=!0,e.exports.default=e.exports})),ah=(rh=oh)&&rh.__esModule&&Object.prototype.hasOwnProperty.call(rh,"default")?rh.default:rh;class nh{constructor(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}get bitsAvailable(){return this.bitLength-this.index}skipBits(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}getBits(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>s,o=8-s;if(o>=e)return i&&(this.index+=e),r>>o-e;{i&&(this.index+=o);const s=e-o;return r<>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class lh extends Kd{constructor(e){super(e),ah(this,"TAG_NAME","NakedFlowDemux"),this.lastBuf=null,this.vps=null,this.sps=null,this.pps=null,this.streamVideoType=null,this.streamAudioType=null,this.tempNaluBufferList=new Uint8Array(0),this.pendingUnits={},this.localDts=0,this.isSendSeqHeader=!1,this.isSendAACSeqHeader=!1,e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.lastBuf=null,this.vps=null,this.sps=null,this.pps=null,this.streamVideoType=null,this.streamAudioType=null,this.tempNaluBufferList=new Uint8Array(0),this.pendingUnits={},this.localDts=0,this.localAudioDts=0,this.isSendSeqHeader=!1,this.isSendAACSeqHeader=!1,this.player.debugLog(this.TAG_NAME,"destroy")}dispatch(e){this.player;const t=new Uint8Array(e);if(this.player._opt.nakedFlowDemuxUseNew){const e=this.extractNALu$3(t);if(0===e.length)return void this.player.debugLog(this.TAG_NAME,"dispatch naluArray.length === 0");this.handleVideoFrames(e)}else this.extractNALu$2(t)}addNaluToBuffer(e){const t=e.byteLength+this.tempNaluBufferList.byteLength,i=new Uint8Array(t);i.set(this.tempNaluBufferList,0),i.set(e,this.tempNaluBufferList.byteLength),this.tempNaluBufferList=i}downloadNakedFlowFile(){const e=new Blob([this.tempNaluBufferList]);try{const t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".h264",t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadTempNalu",e)}}getNaluDts(){const e=this.player._opt.nakedFlowFps;return this.localDts=this.localDts+parseInt(1e3/e,10),this.localDts}getNaluAudioDts(){const e=this.player.audio.audioContext.sampleRate,t=this.player.audio.audioBufferSize;return this.localDts+parseInt(t/e*1e3)}extractNALu(e){let t,i,s=0,r=e.byteLength,o=0,a=[];for(;s1)for(let e=0;e{const t=Pn(e);t===Lt||t===kt?this.handleVideoH264Nalu(e):In(t)&&s.push(e)})),1===s.length)this.handleVideoH264Nalu(s[0]);else{const e=function(e){if(0===e.length)return!1;const t=Pn(e[0]);for(let i=1;i{this.handleVideoH264Nalu(e)}))}}else if(this.streamVideoType===vt)if(this.player._opt.nakedFlowH265DemuxUseNew){const e=this.handleAddNaluStartCode(t),i=this.extractNALu(e);if(0===i.length)return void this.player.debugWarn(this.TAG_NAME,"handleVideoNalu","h265 naluList.length === 0");const s=[];if(i.forEach((e=>{const t=$n(e);t===Ht||t===Wt||t===Gt?this.handleVideoH265Nalu(e):Jn(t)&&s.push(e)})),1===s.length)this.handleVideoH265Nalu(s[0]);else{const e=function(e){if(0===e.length)return!1;const t=$n(e[0]);for(let i=1;i{this.handleVideoH265Nalu(e)}))}}else{$n(t)===Ht?this.extractH265PPS(t):this.handleVideoH265Nalu(t)}else this.player.debugWarn(this.TAG_NAME," this.streamVideoType is null")}extractH264PPS(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{Bn(Pn(e))?this.extractH264SEI(e):this.handleVideoH264Nalu(e)}))}extractH265PPS(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{const t=$n(e);t===Jt?this.extractH265SEI(e):this.handleVideoH265Nalu(e)}))}extractH264SEI(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{this.handleVideoH264Nalu(e)}))}extractH265SEI(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{this.handleVideoH265Nalu(e)}))}handleAddNaluStartCode(e){const t=[0,0,0,1],i=new Uint8Array(e.length+t.length);return i.set(t),i.set(e,t.length),i}handleAudioAACNalu(e){if(!e||e.byteLength<1)return;this.streamAudioType||(this.streamAudioType=wt.AAC);let t=new Uint8Array(e);const i=t.slice(0,7);if(t=t.slice(7),!this.isSendAACSeqHeader){const e=(192&i[2])>>6,t=(60&i[2])>>2,s=(1&i[2])<<2|(192&i[3])>>6,r=new Uint8Array([175,0,e<<3|(14&t)>>1,(1&t)<<7|s<<3]);this.isSendAACSeqHeader=!0,this._doDecode(r,Fe,0,!1,0)}const s=this.getNaluAudioDts(),r=new Uint8Array(t.length+2);r.set([175,1],0),r.set(t,2),this._doDecode(r,Fe,s,!1,0)}handleAudioG711ANalu(e){if(!e||e.byteLength<1)return;this.streamAudioType||(this.streamAudioType=wt.ALAW);let t=new Uint8Array(e);const i=this.getNaluAudioDts(),s=new Uint8Array(t.length+1);s.set([114],0),s.set(t,1),this._doDecode(s,Fe,i,!1,0)}handleAudioG711UNalu(e){if(!e||e.byteLength<1)return;this.streamAudioType||(this.streamAudioType=wt.MULAW);let t=new Uint8Array(e);const i=this.getNaluAudioDts(),s=new Uint8Array(t.length+1);s.set([130],0),s.set(t,1),this._doDecode(s,Fe,i,!1,0)}handleVideoH264Nalu(e){const t=Pn(e);switch(t){case kt:this.sps=e;break;case Lt:this.pps=e}if(this.isSendSeqHeader){if(this.sps&&this.pps){const e=xn({sps:this.sps,pps:this.pps}),t=this.localDts;this._doDecode(e,Ue,t,!0,0),this.sps=null,this.pps=null}if(In(t)){this.player._times.demuxStart||(this.player._times.demuxStart=Zr());const i=Mn(t),s=this.getNaluDts(),r=function(e,t){let i=[];i[0]=t?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=e.byteLength>>24&255,i[6]=e.byteLength>>16&255,i[7]=e.byteLength>>8&255,i[8]=255&e.byteLength;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}(e,i);this._preDoDecode(r,Ue,s,i,0)}else this.player.debugWarn(this.TAG_NAME,`handleVideoH264Nalu is avc seq head nalType is ${t}`)}else if(this.sps&&this.pps){this.isSendSeqHeader=!0;const e=xn({sps:this.sps,pps:this.pps});this._doDecode(e,Ue,0,!0,0),this.sps=null,this.pps=null}}handleVideoH264NaluList(e,t,i){if(this.isSendSeqHeader){this.player._times.demuxStart||(this.player._times.demuxStart=Zr());const i=this.getNaluDts(),s=Rn(e.reduce(((e,t)=>{const i=qr(e),s=qr(t),r=new Uint8Array(i.byteLength+s.byteLength);return r.set(i,0),r.set(s,i.byteLength),r})),t);this._preDoDecode(s,Ue,i,t,0)}else this.player.debugWarn(this.TAG_NAME,"handleVideoH264NaluList isSendSeqHeader is false")}handleVideoH265Nalu(e){const t=$n(e);switch(t){case Gt:this.vps=e;break;case Wt:this.sps=e;break;case Ht:this.pps=e}if(this.isSendSeqHeader){if(this.vps&&this.sps&&this.pps){const e=Vn({vps:this.vps,sps:this.sps,pps:this.pps}),t=this.localDts;this._doDecode(e,Ue,t,!0,0),this.vps=null,this.sps=null,this.pps=null}if(Jn(t)){this.player._times.demuxStart||(this.player._times.demuxStart=Zr());const i=qn(t),s=this.getNaluDts(),r=function(e,t){let i=[];i[0]=t?28:44,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=e.byteLength>>24&255,i[6]=e.byteLength>>16&255,i[7]=e.byteLength>>8&255,i[8]=255&e.byteLength;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}(e,i);this._preDoDecode(r,Ue,s,i,0)}}else if(this.vps&&this.sps&&this.pps){this.isSendSeqHeader=!0;const e=Vn({vps:this.vps,sps:this.sps,pps:this.pps});this._doDecode(e,Ue,0,!0,0),this.vps=null,this.sps=null,this.pps=null}}handleVideoH265NaluList(e,t,i){if(this.isSendSeqHeader){this.player._times.demuxStart||(this.player._times.demuxStart=Zr());const i=this.getNaluDts(),s=Hn(e.reduce(((e,t)=>{const i=qr(e),s=qr(t),r=new Uint8Array(i.byteLength+s.byteLength);return r.set(i,0),r.set(s,i.byteLength),r})),t);this._preDoDecode(s,Ue,i,t,0)}else this.player.debugWarn(this.TAG_NAME,"handleVideoH265NaluList isSendSeqHeader is false")}_preDoDecode(e,t,i,s,r){this.player.updateStats({vbps:e.byteLength,dts:i}),s&&this.calcIframeIntervalTimestamp(i),this._doDecode(e,Ue,i,s,r)}getInputByteLength(){let e=0;return this.lastBuf&&(e=this.lastBuf.byteLength),e}handleVideoFrames(e){if(!this.streamVideoType)for(let t of e)if(this.streamVideoType=Xo(t),this.streamVideoType)break;this.streamVideoType?this.streamVideoType===bt?this.handleVideoH264Frames(e):this.streamVideoType===vt&&this.handleVideoH265Frames(e):this.player.debugWarn(this.TAG_NAME,"handleVideoFrames streamVideoType is null")}handleVideoH264Frames(e){let t=[],i=[],s=!1,r=!1;this.pendingUnits.units&&(t=this.pendingUnits.units,r=this.pendingUnits.vcl,s=this.pendingUnits.iFrame,this.pendingUnits={});let o={};for(let a of e){if(a.byteLength<4)continue;const e=Pn(a);let n=!1,l=e===xt;e!==Dt&&e!==xt||(o=this.parseVideo264Header(a),n=!0),t.length&&r&&(o.isfms||!n)&&(i.push({units:t,isIFrame:s}),t=[],s=!1,r=!1),t.push(a),s=s||l,r=r||n}t.length&&(this.pendingUnits={units:t,vcl:r,iFrame:s}),i.forEach((e=>{const t=e.units,i=e.isIFrame;let s=null,r=null;if(t.forEach((e=>{const t=31&e[0];switch(t){case Lt:this.pps=e;break;case kt:this.sps=e;break;case Rt:r=e}if(In(t)){const t=qr(e);if(s){const e=new Uint8Array(s.byteLength+t.byteLength);e.set(s,0),e.set(t,s.byteLength),s=e}else s=t}})),!this.isSendSeqHeader&&this.sps&&this.pps){this.isSendSeqHeader=!0;const e=xn({sps:this.sps,pps:this.pps});this._doDecode(e,Ue,0,!0,0),this.sps=null,this.pps=null}if(this.isSendSeqHeader){if(this.sps&&this.pps){const e=xn({sps:this.sps,pps:this.pps}),t=this.localDts;this._doDecode(e,Ue,t,!0,0),this.sps=null,this.pps=null}if(s){this.player._times.demuxStart||(this.player._times.demuxStart=Zr());const e=this.getNaluDts(),t=Rn(s,i);this.player._opt.isEmitSEI&&r&&this.player.emitVideoSei({ts:e,data:r}),this._preDoDecode(t,Ue,e,i,0)}}}))}handleVideoH265Frames(e){let t=[],i=[],s=!1,r=!1;this.pendingUnits.units&&(t=this.pendingUnits.units,r=this.pendingUnits.vcl,s=this.pendingUnits.iFrame,this.pendingUnits={});let o={};for(let a of e){if(a.byteLength<4)continue;const e=$n(a);let n=!1,l=qn(e);Jn(e)&&(o=this.parseVideo265Header(a),n=!0),t.length&&r&&(o.isfms||!n)&&(i.push({units:t,isIFrame:s}),t=[],s=!1,r=!1),t.push(a),s=s||l,r=r||n}t.length&&(this.pendingUnits={units:t,vcl:r,iFrame:s}),i.forEach((e=>{const t=e.units,i=e.isIFrame;let s=null,r=null;if(t.forEach((e=>{const t=e[0]>>>1&63;switch(t){case Ht:this.pps=e;break;case Wt:this.sps=e;break;case Gt:this.vps=e;break;case Kt:case qt:r=e}if(Jn(t)){const t=qr(e);if(s){const e=new Uint8Array(s.byteLength+t.byteLength);e.set(s,0),e.set(t,s.byteLength),s=e}else s=t}})),!this.isSendSeqHeader&&this.sps&&this.pps&&this.vps){this.isSendSeqHeader=!0;const e=Vn({sps:this.sps,pps:this.pps,vps:this.vps});this._doDecode(e,Ue,0,!0,0),this.sps=null,this.pps=null,this.vps=null}if(this.isSendSeqHeader){if(this.sps&&this.pps&&this.vps){const e=Vn({sps:this.sps,pps:this.pps,vps:this.vps}),t=this.localDts;this._doDecode(e,Ue,t,!0,0),this.sps=null,this.pps=null,this.vps=null}if(s){this.player._times.demuxStart||(this.player._times.demuxStart=Zr());const e=this.getNaluDts(),t=Hn(s,i);this.player._opt.isEmitSEI&&r&&this.player.emitVideoSei({ts:e,data:r}),this._preDoDecode(t,Ue,e,i,0)}}}))}handleVideoH265Frames_1(e){e.forEach((e=>{this.handleVideoNalu(e)}))}parseVideo264Header(e){const t=new nh(e);t.readUByte();return{isfms:0===t.readUEG(),sType:t.readUEG()}}parseVideo265Header(e){const t=new nh(e);return t.readUByte(),{nalType:t.readBits(6),isfms:0===t.readBits(1),sType:t.readBits(3)}}}class dh extends Kd{constructor(e){super(e),this.player=e,e.debugLog("EmptyDemux","init")}destroy(){super.destroy(),this.player.debugLog("EmptyDemux","destroy")}}var hh=kr((function(e,t){var s,r,o,a=(s=new Date,r=4,o={setLogLevel:function(e){r=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=r&&console.debug("["+a.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=r&&console.info("["+a.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=r&&console.warn("["+a.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=r&&console.error("["+a.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)}},o);a.getDurationString=function(e,t){var i;function s(e,t){for(var i=(""+e).split(".");i[0].length0){for(var i="",s=0;s0&&(i+=","),i+="["+a.getDurationString(e.start(s))+","+a.getDurationString(e.end(s))+"]";return i}return"(empty)"},t.Log=a;var n=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};n.prototype.getPosition=function(){return this.position},n.prototype.getEndPosition=function(){return this.buffer.byteLength},n.prototype.getLength=function(){return this.buffer.byteLength},n.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},n.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},n.prototype.readAnyInt=function(e,t){var i=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:i=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:i=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";i=this.dataview.getUint8(this.position)<<16,i|=this.dataview.getUint8(this.position+1)<<8,i|=this.dataview.getUint8(this.position+2);break;case 4:i=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";i=this.dataview.getUint32(this.position)<<32,i|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,i}throw"Not enough bytes in buffer"},n.prototype.readUint8=function(){return this.readAnyInt(1,!1)},n.prototype.readUint16=function(){return this.readAnyInt(2,!1)},n.prototype.readUint24=function(){return this.readAnyInt(3,!1)},n.prototype.readUint32=function(){return this.readAnyInt(4,!1)},n.prototype.readUint64=function(){return this.readAnyInt(8,!1)},n.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",i=0;ithis._byteLength&&(this._byteLength=t);else{for(i<1&&(i=1);t>i;)i*=2;var s=new ArrayBuffer(i),r=new Uint8Array(this._buffer);new Uint8Array(s,0,r.length).set(r),this.buffer=s,this._byteLength=t}}},l.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),i=new Uint8Array(this._buffer,0,t.length);t.set(i),this.buffer=e}},l.BIG_ENDIAN=!1,l.LITTLE_ENDIAN=!0,l.prototype._byteLength=0,Object.defineProperty(l.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(l.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(l.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(l.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),l.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},l.prototype.isEof=function(){return this.position>=this._byteLength},l.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},l.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Int32Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Int16Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return l.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},l.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Uint32Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Uint16Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return l.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},l.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var i=new Float64Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Float32Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},l.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},l.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},l.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},l.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},l.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,l.memcpy=function(e,t,i,s,r){var o=new Uint8Array(e,t,r),a=new Uint8Array(i,s,r);o.set(a)},l.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},l.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},l.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i=0;ir;s--,r++){var o=t[r];t[r]=t[s],t[s]=o}return e},l.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],i=0;i>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},l.prototype.adjustUint32=function(e,t){var i=this.position;this.seek(e),this.writeUint32(t),this.seek(i)},l.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var i=new Int32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},l.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var i=new Int16Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},l.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},l.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var i=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},l.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var i=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},l.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var i=new Float64Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=8*e,i},l.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var i=new Float32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i};var h=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(h.prototype=new l(new ArrayBuffer,0,l.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,a.debug("MultiBufferStream","Stream ready for parsing"),!0):(a.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(a.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){a.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(new Uint8Array(e),0),i.set(new Uint8Array(t),e.byteLength),i.buffer},h.prototype.reduceBuffer=function(e,t,i){var s;return(s=new Uint8Array(i)).set(new Uint8Array(e,t,i)),s.buffer.fileStart=e.fileStart+t,s.buffer.usedBytes=0,s.buffer},h.prototype.insertBuffer=function(e){for(var t=!0,i=0;is.byteLength){this.buffers.splice(i,1),i--;continue}a.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=s.fileStart||(e=this.reduceBuffer(e,0,s.fileStart-e.fileStart)),a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(i,0,e),0===i&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,r,o)}}t&&(a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===i&&(this.buffer=e))},h.prototype.logBufferLevel=function(e){var t,i,s,r,o,n=[],l="";for(s=0,r=0,t=0;t0&&(l+=o.end-1+"]");var d=e?a.info:a.debug;0===this.buffers.length?d("MultiBufferStream","No more buffer in memory"):d("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+s+"/"+r+" bytes), continuous ranges: "+l)},h.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},h.prototype.findPosition=function(e,t,i){var s,r=null,o=-1;for(s=!0===e?0:this.bufferIndex;s=t?(a.debug("MultiBufferStream","Found position in existing buffer #"+o),o):-1},h.prototype.findEndContiguousBuf=function(e){var t,i,s,r=void 0!==e?e:this.bufferIndex;if(i=this.buffers[r],this.buffers.length>r+1)for(t=r+1;t>3;return 31===s&&i.data.length>=2&&(s=32+((7&i.data[0])<<3)+((224&i.data[1])>>5)),s}return null},i.DecoderConfigDescriptor=function(e){i.Descriptor.call(this,4,e)},i.DecoderConfigDescriptor.prototype=new i.Descriptor,i.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},i.DecoderSpecificInfo=function(e){i.Descriptor.call(this,5,e)},i.DecoderSpecificInfo.prototype=new i.Descriptor,i.SLConfigDescriptor=function(e){i.Descriptor.call(this,6,e)},i.SLConfigDescriptor.prototype=new i.Descriptor,this};t.MPEG4DescriptorParser=c;var u={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){u.FullBox.prototype=new u.Box,u.ContainerBox.prototype=new u.Box,u.SampleEntry.prototype=new u.Box,u.TrackGroupTypeBox.prototype=new u.FullBox,u.BASIC_BOXES.forEach((function(e){u.createBoxCtor(e)})),u.FULL_BOXES.forEach((function(e){u.createFullBoxCtor(e)})),u.CONTAINER_BOXES.forEach((function(e){u.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,i){this.type=e,this.size=t,this.uuid=i},FullBox:function(e,t,i){u.Box.call(this,e,t,i),this.flags=0,this.version=0},ContainerBox:function(e,t,i){u.Box.call(this,e,t,i),this.boxes=[]},SampleEntry:function(e,t,i,s){u.ContainerBox.call(this,e,t),this.hdr_size=i,this.start=s},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){u.FullBox.call(this,e,t)},createBoxCtor:function(e,t){u.boxCodes.push(e),u[e+"Box"]=function(t){u.Box.call(this,e,t)},u[e+"Box"].prototype=new u.Box,t&&(u[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){u[e+"Box"]=function(t){u.FullBox.call(this,e,t)},u[e+"Box"].prototype=new u.FullBox,u[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,i=0;ii?(a.error("BoxParser","Box of type '"+h+"' has a size "+d+" greater than its container size "+i),{code:u.ERR_NOT_ENOUGH_DATA,type:h,size:d,hdr_size:l,start:n}):0!==d&&n+d>e.getEndPosition()?(e.seek(n),a.info("BoxParser","Not enough data in stream to parse the entire '"+h+"' box"),{code:u.ERR_NOT_ENOUGH_DATA,type:h,size:d,hdr_size:l,start:n}):t?{code:u.OK,type:h,size:d,hdr_size:l,start:n}:(u[h+"Box"]?s=new u[h+"Box"](d):"uuid"!==h?(a.warn("BoxParser","Unknown box type: '"+h+"'"),(s=new u.Box(h,d)).has_unparsed_data=!0):u.UUIDBoxes[o]?s=new u.UUIDBoxes[o](d):(a.warn("BoxParser","Unknown uuid type: '"+o+"'"),(s=new u.Box(h,d)).uuid=o,s.has_unparsed_data=!0),s.hdr_size=l,s.start=n,s.write===u.Box.prototype.write&&"mdat"!==s.type&&(a.info("BoxParser","'"+c+"' box writing not yet implemented, keeping unparsed data in memory for later write"),s.parseDataAndRewind(e)),s.parse(e),(r=e.getPosition()-(s.start+s.size))<0?(a.warn("BoxParser","Parsing of box '"+c+"' did not read the entire indicated box data size (missing "+-r+" bytes), seeking forward"),e.seek(s.start+s.size)):r>0&&(a.error("BoxParser","Parsing of box '"+c+"' read "+r+" more bytes than the indicated box data size, seeking backwards"),0!==s.size&&e.seek(s.start+s.size)),{code:u.OK,box:s,size:s.size})},u.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},u.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},u.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},u.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},u.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},u.ContainerBox.prototype.parse=function(e){for(var t,i;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},u.SAMPLE_ENTRY_TYPE_VISUAL="Visual",u.SAMPLE_ENTRY_TYPE_AUDIO="Audio",u.SAMPLE_ENTRY_TYPE_HINT="Hint",u.SAMPLE_ENTRY_TYPE_METADATA="Metadata",u.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",u.SAMPLE_ENTRY_TYPE_SYSTEM="System",u.SAMPLE_ENTRY_TYPE_TEXT="Text",u.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},u.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},u.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},u.SampleEntry.prototype.parseFooter=function(e){u.ContainerBox.prototype.parse.call(this,e)},u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_HINT),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_METADATA),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SUBTITLE),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SYSTEM),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_TEXT),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_TEXT,"enct"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_METADATA,"encm"),u.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var i=0;i<3;i++)this.layer_size[i]=16==t?e.readUint16():e.readUint32()})),u.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),u.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),u.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)a.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void a.error("av1C reserved_2 parsing problem");var i=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(i)}else a.error("av1C reserved_1 parsing problem");else a.error("av1C version "+this.version+" not supported")})),u.createBoxCtor("avcC",(function(e){var t,i;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),i=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(i))})),u.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),u.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),u.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),u.createFullBoxCtor("co64",(function(e){var t,i;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(i=0;i>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),u.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),u.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),u.createFullBoxCtor("ctts",(function(e){var t,i;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(i=0;i>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|i>>6&3,this.acmod=i>>3&7,this.lfeon=i>>2&1,this.bit_rate_code=3&i|s>>5&7})),u.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var i=0;i>6,s.bsid=r>>1&31,s.bsmod=(1&r)<<4|o>>4&15,s.acmod=o>>1&7,s.lfeon=1&o,s.num_dep_sub=a>>1&15,s.num_dep_sub>0&&(s.chan_loc=(1&a)<<8|e.readUint8())}})),u.createFullBoxCtor("dfLa",(function(e){var t=[],i=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var s=e.readUint8(),r=Math.min(127&s,i.length-1);if(r?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(i[r]),128&s)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),u.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),u.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),u.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),u.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[i]=e.readString(4),t-=4,i++})),u.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),u.createBoxCtor("hvcC",(function(e){var t,i,s,r;this.configurationVersion=e.readUint8(),r=e.readUint8(),this.general_profile_space=r>>6,this.general_tier_flag=(32&r)>>5,this.general_profile_idc=31&r,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),r=e.readUint8(),this.constantFrameRate=r>>6,this.numTemporalLayers=(13&r)>>3,this.temporalIdNested=(4&r)>>2,this.lengthSizeMinusOne=3&r,this.nalu_arrays=[];var o=e.readUint8();for(t=0;t>7,a.nalu_type=63&r;var n=e.readUint16();for(i=0;i>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var i=0;if(this.version<2)i=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";i=e.readUint32()}for(var s=0;s>7,this.axis=1&t})),u.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),a.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),u.createFullBoxCtor("ipma",(function(e){var t,i;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?a.property_index=(127&o)<<8|e.readUint8():a.property_index=127&o}}})),u.createFullBoxCtor("iref",(function(e){var t,i;for(this.references=[];e.getPosition()>7,s.assignment_type=127&r,s.assignment_type){case 0:s.grouping_type=e.readString(4);break;case 1:s.grouping_type=e.readString(4),s.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:s.sub_track_id=e.readUint32();break;default:a.warn("BoxParser","Unknown leva assignement type")}}})),u.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),u.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),p.prototype.toString=function(){return"("+this.x+","+this.y+")"},u.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new p(e.readUint16(),e.readUint16()),this.display_primaries[1]=new p(e.readUint16(),e.readUint16()),this.display_primaries[2]=new p(e.readUint16(),e.readUint16()),this.white_point=new p(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),u.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),u.createFullBoxCtor("mehd",(function(e){1&this.flags&&(a.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),u.createFullBoxCtor("meta",(function(e){this.boxes=[],u.ContainerBox.prototype.parse.call(this,e)})),u.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),u.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),u.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),u.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),u.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),u.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),u.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var i=0;i0){var t=e.readUint32();this.kid=[];for(var i=0;i0&&(this.data=e.readUint8Array(s))})),u.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),u.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),u.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),u.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),u.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),u.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var i=0;i>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var i=e.readUint8(),s=0;s>7,this.num_leading_samples=127&t})),u.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)a.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=u.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),u.createSampleGroupCtor("stsa",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),u.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),u.createSampleGroupCtor("tsas",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createSampleGroupCtor("tscl",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createSampleGroupCtor("vipr",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),i=0;i>6,this.sample_depends_on[s]=t>>4&3,this.sample_is_depended_on[s]=t>>2&3,this.sample_has_redundancy[s]=3&t})),u.createFullBoxCtor("senc"),u.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),a.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),i=0;i>31&1,s.referenced_size=2147483647&r,s.subsegment_duration=e.readUint32(),r=e.readUint32(),s.starts_with_SAP=r>>31&1,s.SAP_type=r>>28&7,s.SAP_delta_time=268435455&r}})),u.SingleItemTypeReferenceBox=function(e,t,i,s){u.Box.call(this,e,t),this.hdr_size=i,this.start=s},u.SingleItemTypeReferenceBox.prototype=new u.Box,u.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var i=0;i>4&15,this.sample_sizes[t+1]=15&s}else if(8===this.field_size)for(t=0;t0)for(i=0;i>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=u.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),u.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),u.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),u.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var i=e.readUint32(),s=0;s>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),u.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),u.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),u.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),u.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),u.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),u.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},u.createTrackGroupCtor("msrc"),u.TrackReferenceTypeBox=function(e,t,i,s){u.Box.call(this,e,t),this.hdr_size=i,this.start=s},u.TrackReferenceTypeBox.prototype=new u.Box,u.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},u.trefBox.prototype.parse=function(e){for(var t,i;e.getPosition()t&&this.flags&u.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&u.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var i=0;i>7&1,this.block_pad_lsb=i>>6&1,this.block_little_endian=i>>5&1,this.block_reversed=i>>4&1,this.pad_unknown=i>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),u.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),u.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),u.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),u.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=u.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),u.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),u.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=u.parseHex16(e)})),u.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),u.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),u.createFullBoxCtor("vvcC",(function(e){var t,i,s={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(s.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,i=this.num_sublayers-2;i>=0;--i){var a=s.extract_bits(1);this.ptl_sublayer_present_mask|=a<1;++i)s.extract_bits(1);for(this.sublayer_level_idc=[],i=this.num_sublayers-2;i>=0;--i)this.ptl_sublayer_present_mask&1<>=1;t+=u.decimalToHex(s,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var r=!1,o="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||r)&&(o="."+u.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+o,r=!0);t+=o}return t},u.vvc1SampleEntry.prototype.getCodec=u.vvi1SampleEntry.prototype.getCodec=function(){var e,t=u.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var i="";if(this.vvcC.general_constraint_info){var s,r=[],o=0;for(o|=this.vvcC.ptl_frame_only_constraint<<7,o|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,r.push(o),o&&(s=e),o=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===s)i=".CA";else{i=".C";var a="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",n=0,l=0;for(e=0;e<=s;++e)for(n=n<<8|r[e],l+=8;l>=5;){i+=a[n>>l-5&31],n&=(1<<(l-=5))-1}l&&(i+=a[31&(n<<=5-l)])}}t+=i}return t},u.mp4aSampleEntry.prototype.getCodec=function(){var e=u.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),i=this.esds.esd.getAudioConfig();return e+"."+u.decimalToHex(t)+(i?"."+i:"")}return e},u.stxtSampleEntry.prototype.getCodec=function(){var e=u.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},u.vp08SampleEntry.prototype.getCodec=u.vp09SampleEntry.prototype.getCodec=function(){var e=u.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var i=this.vpcC.bitDepth;return 8==i&&(i="08"),e+".0"+this.vpcC.profile+"."+t+"."+i},u.av01SampleEntry.prototype.getCodec=function(){var e,t=u.SampleEntry.prototype.getCodec.call(this),i=this.av1C.seq_level_idx_0;return i<10&&(i="0"+i),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+i+(this.av1C.seq_tier_0?"H":"M")+"."+e},u.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>d&&(this.size+=8),"uuid"===this.type&&(this.size+=16),a.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>d?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>d&&e.writeUint64(this.size)},u.FullBox.prototype.writeHeader=function(e){this.size+=4,u.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},u.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},u.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},u.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&u.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&u.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&u.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&u.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&u.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&u.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&u.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&u.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&u.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&u.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},u.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},u.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},u.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&u.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&u.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&u.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&u.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&u.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&u.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&u.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&u.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[i]instanceof u.Box||t[i]instanceof u.Box||void 0===e[i]||void 0===t[i]||"function"==typeof e[i]||"function"==typeof t[i]||e.subBoxNames&&e.subBoxNames.indexOf(i.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(i.slice(0,4))>-1||"data"===i||"start"===i||"size"===i||"creation_time"===i||"modification_time"===i||u.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(i)>-1||e[i]===t[i]))return!1;return!0},u.boxEqual=function(e,t){if(!u.boxEqualFields(e,t))return!1;for(var i=0;i1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},y.prototype.setExtractionOptions=function(e,t,i){var s=this.getTrackById(e);if(s){var r={};this.extractedTracks.push(r),r.id=e,r.user=t,r.trak=s,s.nextSample=0,r.nb_samples=1e3,r.samples=[],i&&i.nbSamples&&(r.nb_samples=i.nbSamples)}},y.prototype.unsetExtractionOptions=function(e){for(var t=-1,i=0;i-1&&this.extractedTracks.splice(t,1)},y.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=u.parseOneBox(this.stream,false)).code===u.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var i;switch(i="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),i){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[i]&&a.warn("ISOFile","Duplicate Box of type: "+i+", overriding previous occurrence"),this[i]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},y.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(a.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(a.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(a.warn("ISOFile","Not ready to start parsing"),!1))},y.prototype.appendBuffer=function(e,t){var i;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(i=this.nextSeekPosition,this.nextSeekPosition=void 0):i=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(i=this.stream.getEndFilePositionAfter(i))):i=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(a.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+i),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),i},y.prototype.getInfo=function(){var e,t,i,s,r,o,a={},n=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(a.hasMoov=!0,a.duration=this.moov.mvhd.duration,a.timescale=this.moov.mvhd.timescale,a.isFragmented=null!=this.moov.mvex,a.isFragmented&&this.moov.mvex.mehd&&(a.fragment_duration=this.moov.mvex.mehd.fragment_duration),a.isProgressive=this.isProgressive,a.hasIOD=null!=this.moov.iods,a.brands=[],a.brands.push(this.ftyp.major_brand),a.brands=a.brands.concat(this.ftyp.compatible_brands),a.created=new Date(n+1e3*this.moov.mvhd.creation_time),a.modified=new Date(n+1e3*this.moov.mvhd.modification_time),a.tracks=[],a.audioTracks=[],a.videoTracks=[],a.subtitleTracks=[],a.metadataTracks=[],a.hintTracks=[],a.otherTracks=[],e=0;e0?a.mime+='video/mp4; codecs="':a.audioTracks&&a.audioTracks.length>0?a.mime+='audio/mp4; codecs="':a.mime+='application/mp4; codecs="',e=0;e=i.samples.length)&&(a.info("ISOFile","Sending fragmented data on track #"+s.id+" for samples ["+Math.max(0,i.nextSample-s.nb_samples)+","+(i.nextSample-1)+"]"),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(s.id,s.user,s.segmentStream.buffer,i.nextSample,e||i.nextSample>=i.samples.length),s.segmentStream=null,s!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=i.samples.length)&&(a.debug("ISOFile","Sending samples on track #"+o.id+" for sample "+i.nextSample),this.onSamples&&this.onSamples(o.id,o.user,o.samples),o.samples=[],o!==this.extractedTracks[t]))break}}}},y.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},y.prototype.getBoxes=function(e,t){var i=[];return y._sweep.call(this,e,i,t),i},y._sweep=function(e,t,i){for(var s in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&i)return;y._sweep.call(this.boxes[s],e,t,i)}},y.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},y.prototype.getTrackSample=function(e,t){var i=this.getTrackById(e);return this.getSample(i,t)},y.prototype.releaseUsedSamples=function(e,t,i){var s=0,r=this.getTrackById(e);r.lastValidSample||(r.lastValidSample=0);for(var o=r.lastValidSample;oe*r.timescale){d=s-1;break}t&&r.is_sync&&(l=s)}for(t&&(d=l),e=i.samples[d].cts,i.nextSample=d;i.samples[d].alreadyRead===i.samples[d].size&&i.samples[d+1];)d++;return o=i.samples[d].offset+i.samples[d].alreadyRead,a.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+i.nextSample+" on track "+i.tkhd.track_id+", time "+a.getDurationString(e,n)+" and offset: "+o),{offset:o,time:e/n}},y.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},y.prototype.seek=function(e,t){var i,s,r,o=this.moov,n={offset:1/0,time:1/0};if(this.moov){for(r=0;rthis.getTrackDuration(i)||((s=this.seekTrack(e,t,i)).offset-1){a=l;break}switch(a){case"Visual":if(r.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),o.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var c=new u.avcCBox;c.parse(new n(t.avcDecoderConfigRecord)),o.addBox(c)}else if(t.hevcDecoderConfigRecord){var p=new u.hvcCBox;p.parse(new n(t.hevcDecoderConfigRecord)),o.addBox(p)}break;case"Audio":r.add("smhd").set("balance",t.balance||0),o.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":r.add("hmhd");break;case"Subtitle":if(r.add("sthd"),"stpp"===t.type)o.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:r.add("nmhd")}t.description&&o.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){o.addBox(e)})),r.add("dinf").add("dref").addEntry((new u["url Box"]).set("flags",1));var f=r.add("stbl");return f.add("stsd").addEntry(o),f.add("stts").set("sample_counts",[]).set("sample_deltas",[]),f.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),f.add("stco").set("chunk_offsets",[]),f.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(i),t.id}},u.Box.prototype.computeSize=function(e){var t=e||new l;t.endianness=l.BIG_ENDIAN,this.write(t)},y.prototype.addSample=function(e,t,i){var s=i||{},r={},o=this.getTrackById(e);if(null!==o){r.number=o.samples.length,r.track_id=o.tkhd.track_id,r.timescale=o.mdia.mdhd.timescale,r.description_index=s.sample_description_index?s.sample_description_index-1:0,r.description=o.mdia.minf.stbl.stsd.entries[r.description_index],r.data=t,r.size=t.byteLength,r.alreadyRead=r.size,r.duration=s.duration||1,r.cts=s.cts||0,r.dts=s.dts||0,r.is_sync=s.is_sync||!1,r.is_leading=s.is_leading||0,r.depends_on=s.depends_on||0,r.is_depended_on=s.is_depended_on||0,r.has_redundancy=s.has_redundancy||0,r.degradation_priority=s.degradation_priority||0,r.offset=0,r.subsamples=s.subsamples,o.samples.push(r),o.samples_size+=r.size,o.samples_duration+=r.duration,void 0===o.first_dts&&(o.first_dts=s.dts),this.processSamples();var a=this.createSingleSampleMoof(r);return this.addBox(a),a.computeSize(),a.trafs[0].truns[0].data_offset=a.size+8,this.add("mdat").data=new Uint8Array(t),r}},y.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var i=new u.moofBox;i.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var s=i.add("traf"),r=this.getTrackById(e.track_id);return s.add("tfhd").set("track_id",e.track_id).set("flags",u.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),s.add("tfdt").set("baseMediaDecodeTime",e.dts-(r.first_dts||0)),s.add("trun").set("flags",u.TRUN_FLAGS_DATA_OFFSET|u.TRUN_FLAGS_DURATION|u.TRUN_FLAGS_SIZE|u.TRUN_FLAGS_FLAGS|u.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),i},y.prototype.lastMoofIndex=0,y.prototype.samplesDataSize=0,y.prototype.resetTables=function(){var e,t,i,s,r,o;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(l=r[a].grouping_type+"/0",(n=new d(r[a].grouping_type,0)).is_fragment=!0,t.sample_groups_info[l]||(t.sample_groups_info[l]=n))}else for(a=0;a=2&&(l=s[a].grouping_type+"/0",n=new d(s[a].grouping_type,0),e.sample_groups_info[l]||(e.sample_groups_info[l]=n))},y.setSampleGroupProperties=function(e,t,i,s){var r,o;for(r in t.sample_groups=[],s){var a;if(t.sample_groups[r]={},t.sample_groups[r].grouping_type=s[r].grouping_type,t.sample_groups[r].grouping_type_parameter=s[r].grouping_type_parameter,i>=s[r].last_sample_in_run&&(s[r].last_sample_in_run<0&&(s[r].last_sample_in_run=0),s[r].entry_index++,s[r].entry_index<=s[r].sbgp.entries.length-1&&(s[r].last_sample_in_run+=s[r].sbgp.entries[s[r].entry_index].sample_count)),s[r].entry_index<=s[r].sbgp.entries.length-1?t.sample_groups[r].group_description_index=s[r].sbgp.entries[s[r].entry_index].group_description_index:t.sample_groups[r].group_description_index=-1,0!==t.sample_groups[r].group_description_index)a=s[r].fragment_description?s[r].fragment_description:s[r].description,t.sample_groups[r].group_description_index>0?(o=t.sample_groups[r].group_description_index>65535?(t.sample_groups[r].group_description_index>>16)-1:t.sample_groups[r].group_description_index-1,a&&o>=0&&(t.sample_groups[r].description=a.entries[o])):a&&a.version>=2&&a.default_group_description_index>0&&(t.sample_groups[r].description=a.entries[a.default_group_description_index-1])}},y.process_sdtp=function(e,t,i){t&&(e?(t.is_leading=e.is_leading[i],t.depends_on=e.sample_depends_on[i],t.is_depended_on=e.sample_is_depended_on[i],t.has_redundancy=e.sample_has_redundancy[i]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},y.prototype.buildSampleLists=function(){var e,t;for(e=0;eb&&(v++,b<0&&(b=0),b+=o.sample_counts[v]),t>0?(e.samples[t-1].duration=o.sample_deltas[v],e.samples_duration+=e.samples[t-1].duration,k.dts=e.samples[t-1].dts+e.samples[t-1].duration):k.dts=0,a?(t>=_&&(S++,_<0&&(_=0),_+=a.sample_counts[S]),k.cts=e.samples[t].dts+a.sample_offsets[S]):k.cts=k.dts,n?(t==n.sample_numbers[E]-1?(k.is_sync=!0,E++):(k.is_sync=!1,k.degradation_priority=0),d&&d.entries[w].sample_delta+T==t+1&&(k.subsamples=d.entries[w].subsamples,T+=d.entries[w].sample_delta,w++)):k.is_sync=!0,y.process_sdtp(e.mdia.minf.stbl.sdtp,k,k.number),k.degradation_priority=u?u.priority[t]:0,d&&d.entries[w].sample_delta+T==t&&(k.subsamples=d.entries[w].subsamples,T+=d.entries[w].sample_delta),(h.length>0||c.length>0)&&y.setSampleGroupProperties(e,k,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},y.prototype.updateSampleLists=function(){var e,t,i,s,r,o,a,n,l,d,h,c,p,f,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&y.initSampleGroups(c,h,h.sbgps,c.mdia.minf.stbl.sgpds,h.sgpds),t=0;t0?f.dts=c.samples[c.samples.length-2].dts+c.samples[c.samples.length-2].duration:(h.tfdt?f.dts=h.tfdt.baseMediaDecodeTime:f.dts=0,c.first_traf_merged=!0),f.cts=f.dts,g.flags&u.TRUN_FLAGS_CTS_OFFSET&&(f.cts=f.dts+g.sample_composition_time_offset[i]),m=a,g.flags&u.TRUN_FLAGS_FLAGS?m=g.sample_flags[i]:0===i&&g.flags&u.TRUN_FLAGS_FIRST_FLAG&&(m=g.first_sample_flags),f.is_sync=!(m>>16&1),f.is_leading=m>>26&3,f.depends_on=m>>24&3,f.is_depended_on=m>>22&3,f.has_redundancy=m>>20&3,f.degradation_priority=65535&m;var A=!!(h.tfhd.flags&u.TFHD_FLAG_BASE_DATA_OFFSET),b=!!(h.tfhd.flags&u.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),v=!!(g.flags&u.TRUN_FLAGS_DATA_OFFSET),_=0;_=A?h.tfhd.base_data_offset:b||0===t?d.start:n,f.offset=0===t&&0===i?v?_+g.data_offset:_:n,n=f.offset+f.size,(h.sbgps.length>0||h.sgpds.length>0||c.mdia.minf.stbl.sbgps.length>0||c.mdia.minf.stbl.sgpds.length>0)&&y.setSampleGroupProperties(c,f,f.number_in_traf,h.sample_groups_info)}}if(h.subs){c.has_fragment_subsamples=!0;var S=h.first_sample_index;for(t=0;t-1))return null;var o=(i=this.stream.buffers[r]).byteLength-(s.offset+s.alreadyRead-i.fileStart);if(s.size-s.alreadyRead<=o)return a.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-i.fileStart)+" read size: "+(s.size-s.alreadyRead)+" full size: "+s.size+")"),l.memcpy(s.data.buffer,s.alreadyRead,i,s.offset+s.alreadyRead-i.fileStart,s.size-s.alreadyRead),i.usedBytes+=s.size-s.alreadyRead,this.stream.logBufferLevel(),s.alreadyRead=s.size,s;if(0===o)return null;a.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-i.fileStart)+" read size: "+o+" full size: "+s.size+")"),l.memcpy(s.data.buffer,s.alreadyRead,i,s.offset+s.alreadyRead-i.fileStart,o),s.alreadyRead+=o,i.usedBytes+=o,this.stream.logBufferLevel()}},y.prototype.releaseSample=function(e,t){var i=e.samples[t];return i.data?(this.samplesDataSize-=i.size,i.data=null,i.description=null,delete i.degradation_priority,delete i.depends_on,delete i.description_index,delete i.has_redundancy,delete i.is_depended_on,delete i.is_leading,delete i.is_sync,delete i.moof_number,delete i.number_in_traf,delete i.timescale,delete i.cts,delete i.dts,delete i.offset,delete i.size,delete i.track_id,delete i.duration,i.alreadyRead=0,i.size):0},y.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},y.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},y.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(i.protection=o.ipro.protections[o.iinf.item_infos[e].protection_index-1]),o.iinf.item_infos[e].item_type?i.type=o.iinf.item_infos[e].item_type:i.type="mime",i.content_type=o.iinf.item_infos[e].content_type,i.content_encoding=o.iinf.item_infos[e].content_encoding;if(o.grpl)for(e=0;e0&&u.property_index-1-1))return null;var n=(t=this.stream.buffers[o]).byteLength-(r.offset+r.alreadyRead-t.fileStart);if(!(r.length-r.alreadyRead<=n))return a.debug("ISOFile","Getting item #"+e+" extent #"+s+" partial data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-t.fileStart)+" read size: "+n+" full extent size: "+r.length+" full item size: "+i.size+")"),l.memcpy(i.data.buffer,i.alreadyRead,t,r.offset+r.alreadyRead-t.fileStart,n),r.alreadyRead+=n,i.alreadyRead+=n,t.usedBytes+=n,this.stream.logBufferLevel(),null;a.debug("ISOFile","Getting item #"+e+" extent #"+s+" data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-t.fileStart)+" read size: "+(r.length-r.alreadyRead)+" full extent size: "+r.length+" full item size: "+i.size+")"),l.memcpy(i.data.buffer,i.alreadyRead,t,r.offset+r.alreadyRead-t.fileStart,r.length-r.alreadyRead),t.usedBytes+=r.length-r.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead+=r.length-r.alreadyRead,r.alreadyRead=r.length}}return i.alreadyRead===i.size?i:null},y.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var i=0;i0?this.moov.traks[e].samples[0].duration:0),t.push(s)}return t},y.prototype.getPerformanceInfo=function(){var e={};return e.moov=this.moov,this.moov&&this.moov.traks&&this.moov.traks.length>1&&(e.moovAudioNum=this.moov.traks[0].samples.length,e.moovVideoNum=this.moov.traks[1].samples.length),e},u.Box.prototype.printHeader=function(e){this.size+=8,this.size>d&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},u.FullBox.prototype.printHeader=function(e){this.size+=4,u.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},u.Box.prototype.print=function(e){this.printHeader(e)},u.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},u.tkhdBox.prototype.print=function(e){u.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var A={createFile:function(e,t){var i=void 0===e||e,s=new y(t);return s.discardMdatData=!i,s}};t.createFile=A.createFile}));function ch(e){return e.reduce(((e,t)=>256*e+t))}function uh(e){const t=[101,103,119,99],i=e.length-28,s=e.slice(i,i+t.length);return t.every(((e,t)=>e===s[t]))}hh.Log,hh.MP4BoxStream,hh.DataStream,hh.MultiBufferStream,hh.MPEG4DescriptorParser,hh.BoxParser,hh.XMLSubtitlein4Parser,hh.Textin4Parser,hh.ISOFile,hh.createFile;class ph{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(i+32,i+32+t))]}return null}(t,this.t);if(!i)return e;const s=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(s instanceof Error)return console.error(s.message),this.d=!0,e;this.A=!0,this.u=i[1],uh(t)&&this.c++,WebAssembly.instantiate(i[2],s).then((e=>{if(!function(e){return"function"==typeof e.parse&&"object"==typeof e.memory}(e.instance.exports))return this.d=!0,void console.error("video_error_3");this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}class fh extends Kd{constructor(e){super(e),this.TAG_NAME="Fmp4Loader",this.player=e,this.mp4Box=hh.createFile(),this.tempFmp4List=[],this.offset=0,this.videoTrackId=null,this.audioTrackId=null,this.isHevc=!1,this.transportDescarmber=null,this.player._opt.isFmp4Private&&(this.transportDescarmber=new ph),this._listenMp4Box(),e.debugLog(this.TAG_NAME,"init")}destroy(){this.mp4Box&&(this.mp4Box.stop(),this.mp4Box.flush(),this.mp4Box.destroy(),this.mp4Box=null),this.transportDescarmber&&(this.transportDescarmber.destroy(),this.transportDescarmber=null),this.tempFmp4List=[],this.offset=0,this.videoTrackId=null,this.audioTrackId=null,this.isHevc=!1,this.player.debugLog(this.TAG_NAME,"destroy")}_listenMp4Box(){this.mp4Box.onReady=this.onReady.bind(this),this.mp4Box.onError=this.onError.bind(this),this.mp4Box.onSamples=this.onSamples.bind(this)}onReady(e){this.player.debugLog(this.TAG_NAME,"onReady",e);const t=e.videoTracks[0],i=e.audioTracks[0];if(t){this.videoTrackId=t.id;const e=this.getSeqHeader(t);e&&(this.player.debugLog(this.TAG_NAME,"seqHeader",e),this._doDecodeByFmp4(e,Ue,0,!0,0)),this.mp4Box.setExtractionOptions(t.id)}if(i&&this.player._opt.hasAudio){this.audioTrackId=i.id;const e=i.audio||{},t=Rr.indexOf(e.sample_rate),s=i.codec.replace("mp4a.40.","");this.mp4Box.setExtractionOptions(i.id);const r={profile:parseInt(s,10),sampleRate:t,channel:e.channel_count},o=Pr(r);this.player.debugLog(this.TAG_NAME,"aacADTSHeader",o,"config",r),this._doDecodeByFmp4(o,Fe,0,!1,0)}this.mp4Box.start()}onError(e){this.player.debugError(this.TAG_NAME,"mp4Box onError",e)}onSamples(e,t,i){if(e===this.videoTrackId){for(const e of i){const t=e.data,i=e.is_sync,s=1e3*e.cts/e.timescale;e.duration,e.timescale,this.player.updateStats({vbps:t.byteLength,dts:s}),i&&this.calcIframeIntervalTimestamp(s);let r=null;r=this.isHevc?Hn(t,i):Rn(t,i);let o=this.cryptoPayload(r,i);this._doDecodeByFmp4(o,Ue,s,i,0)}this.mp4Box.removeUsedSamples(e)}else if(e===this.audioTrackId){if(this.player._opt.hasAudio){for(const e of i){const t=e.data;this.player.updateStats({abps:t.byteLength});const i=1e3*e.cts/e.timescale;e.duration,e.timescale;const s=new Uint8Array(t.byteLength+2);s.set([175,1],0),s.set(t,2),this._doDecodeByFmp4(s,Fe,i,!1,0)}this.mp4Box.removeUsedSamples(e)}}else this.player.debugWarn(this.TAG_NAME,"onSamples() trackId error",e)}getSeqHeader(e){const t=this.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new hh.DataStream(void 0,0,hh.DataStream.BIG_ENDIAN);let i=[];e.avcC?(e.avcC.write(t),i=[23,0,0,0,0]):(this.isHevc=!0,e.hvcC.write(t),i=[28,0,0,0,0]);const s=new Uint8Array(t.buffer,8),r=new Uint8Array(i.length+s.length);return r.set(i,0),r.set(s,i.length),r}return null}dispatch(e){let t=new Uint8Array(e);this.transportDescarmber&&(t=this.transportDescarmber.transport(t)),t.buffer.fileStart=this.offset,this.offset+=t.byteLength,this.mp4Box.appendBuffer(t.buffer)}downloadFmp4File(){const e=new Blob(this.tempFmp4List,{type:'video/mp4; codecs="avc1.640028,mp4a.40.2"'}),t=URL.createObjectURL(e),i=document.createElement("a");i.href=t,i.download=Zr()+".fmp4",i.click(),URL.revokeObjectURL(t)}getInputByteLength(){let e=0;return this.mp4Box&&(e=this.mp4Box.getAllocatedSampleDataSize()),e}}class mh extends Kd{constructor(e){super(e),ah(this,"LOG_NAME","Mpeg4Loader"),this.player=e,this.player.debugLog(this.LOG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.LOG_NAME,"destroy")}}function gh(){for(var e=arguments.length,t=new Array(e),i=0;ie+t.byteLength),0));let r=0;return t.forEach((e=>{s.set(e,r),r+=e.byteLength})),s}const yh=3,Ah=4,bh=6,vh=15,_h=17,Sh=129,Eh=135,wh=21,Th=134,kh=27,Lh=36;class Ch{constructor(){this.slices=[],this.total_length=0,this.expected_length=0,this.random_access_indicator=0}}class Dh{constructor(){this.pid=null,this.data=null,this.stream_type=null,this.random_access_indicator=null}}class xh{constructor(){this.pid=null,this.stream_id=null,this.len=null,this.data=null,this.pts=null,this.nearest_pts=null,this.dts=null}}const Rh=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];class Ph{constructor(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}isComplete(){let e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&null!=this.sarDen;return null!=this.mimeType&&e&&t}isSeekable(){return!0===this.hasKeyframesIndex}getNearestKeyframe(e){if(null==this.keyframesIndex)return null;let t=this.keyframesIndex,i=this._search(t.times,e);return{index:i,milliseconds:t.times[i],fileposition:t.filepositions[i]}}_search(e,t){let i=0,s=e.length-1,r=0,o=0,a=s;for(t=e[r]&&t=6?(s=5,t=new Array(4),a=r-3):(s=2,t=new Array(2),a=r):-1!==n.indexOf("android")?(s=2,t=new Array(2),a=r):(s=5,a=r,t=new Array(4),r>=6?a=r-3:1===o&&(s=2,t=new Array(2),a=r)),t[0]=s<<3,t[0]|=(15&r)>>>1,t[1]=(15&r)<<7,t[1]|=(15&o)<<3,5===s&&(t[1]|=(15&a)>>>1,t[2]=(1&a)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=Rh[r],this.sampling_index=r,this.channel_count=o,this.object_type=s,this.original_object_type=i,this.codec_mimetype="mp4a.40."+s,this.original_codec_mimetype="mp4a.40."+i}}class Ih extends Kd{constructor(e){super(e),this.player=e,this.TAG_NAME="TsLoader",this.first_parse_=!0,this.tsPacketSize=0,this.syncOffset=0,this.pmt_=null,this.config_=null,this.media_info_=new Ph,this.timescale_=90,this.duration_=0,this.pat_={version_number:0,network_pid:0,program_map_pid:{}},this.current_program_=null,this.current_pmt_pid_=-1,this.program_pmt_map_={},this.pes_slice_queues_={},this.section_slice_queues_={},this.video_metadata_={vps:null,sps:null,pps:null,details:null},this.audio_metadata_={codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},this.last_pcr_=null,this.last_pcr_base_=NaN,this.timestamp_offset_=0,this.audio_last_sample_pts_=void 0,this.aac_last_incomplete_data_=null,this.has_video_=!1,this.has_audio_=!1,this.video_init_segment_dispatched_=!1,this.audio_init_segment_dispatched_=!1,this.video_metadata_changed_=!1,this.audio_metadata_changed_=!1,this.loas_previous_frame=null,this.video_track_={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this.audio_track_={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._remainingPacketData=null,this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.media_info_=null,this.pes_slice_queues_=null,this.section_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,this._remainingPacketData=null,super.destroy()}probe(e){let t=new Uint8Array(e),i=-1,s=188;if(t.byteLength<=3*s)return{needMoreData:!0};for(;-1===i;){let e=Math.min(1e3,t.byteLength-3*s);for(let r=0;r=4&&(i-=4),{match:!0,consumed:0,ts_packet_size:s,sync_offset:i})}_initPmt(){return{program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}}dispatch(e){let t=new Uint8Array(e);this._remainingPacketData&&(t=gh(this._remainingPacketData,t),this._remainingPacketData=null);let i=t.buffer;const s=this.parseChunks(i);s?this._remainingPacketData=t.subarray(s):t.length>>6;i[1];let o=(31&i[1])<<8|i[2],a=(48&i[3])>>>4,n=15&i[3],l=!(!this.pmt_||this.pmt_.pcr_pid!==o),d={},h=4;if(2==a||3==a){let e=i[4];if(e>0&&(l||3==a)){if(d.discontinuity_indicator=(128&i[5])>>>7,d.random_access_indicator=(64&i[5])>>>6,d.elementary_stream_priority_indicator=(32&i[5])>>>5,(16&i[5])>>>4){let e=300*this._getPcrBase(i)+((1&i[10])<<8|i[11]);this.last_pcr_=e}}if(2==a||5+e===188){t+=188,204===this.tsPacketSize&&(t+=16);continue}h=5+e}if(1==a||3==a)if(0===o||o===this.current_pmt_pid_||null!=this.pmt_&&this.pmt_.pid_stream_type[o]===Th){let i=188-h;this.handleSectionSlice(e,t+h,i,{pid:o,payload_unit_start_indicator:r,continuity_conunter:n,random_access_indicator:d.random_access_indicator})}else if(null!=this.pmt_&&null!=this.pmt_.pid_stream_type[o]){let i=188-h,s=this.pmt_.pid_stream_type[o];o!==this.pmt_.common_pids.h264&&o!==this.pmt_.common_pids.h265&&o!==this.pmt_.common_pids.adts_aac&&o!==this.pmt_.common_pids.loas_aac&&o!==this.pmt_.common_pids.ac3&&o!==this.pmt_.common_pids.eac3&&o!==this.pmt_.common_pids.opus&&o!==this.pmt_.common_pids.mp3&&!0!==this.pmt_.pes_private_data_pids[o]&&!0!==this.pmt_.timed_id3_pids[o]&&!0!==this.pmt_.synchronous_klv_pids[o]&&!0!==this.pmt_.asynchronous_klv_pids[o]||this.handlePESSlice(e,t+h,i,{pid:o,stream_type:s,payload_unit_start_indicator:r,continuity_conunter:n,random_access_indicator:d.random_access_indicator})}t+=188,204===this.tsPacketSize&&(t+=16)}return this.dispatchAudioVideoMediaSegment(),t}handleSectionSlice(e,t,i,s){let r=new Uint8Array(e,t,i),o=this.section_slice_queues_[s.pid];if(s.payload_unit_start_indicator){let a=r[0];if(null!=o&&0!==o.total_length){let r=new Uint8Array(e,t+1,Math.min(i,a));o.slices.push(r),o.total_length+=r.byteLength,o.total_length===o.expected_length?this.emitSectionSlices(o,s):this.clearSlices(o,s)}for(let n=1+a;n=o.expected_length&&this.clearSlices(o,s),n+=l.byteLength}}else if(null!=o&&0!==o.total_length){let r=new Uint8Array(e,t,Math.min(i,o.expected_length-o.total_length));o.slices.push(r),o.total_length+=r.byteLength,o.total_length===o.expected_length?this.emitSectionSlices(o,s):o.total_length>=o.expected_length&&this.clearSlices(o,s)}}handlePESSlice(e,t,i,s){let r=new Uint8Array(e,t,i),o=r[0]<<16|r[1]<<8|r[2];r[3];let a=r[4]<<8|r[5];if(s.payload_unit_start_indicator){if(1!==o)return void this.player.debugWarn(this.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${o}`);let e=this.pes_slice_queues_[s.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?this.emitPESSlices(e,s):this.clearSlices(e,s)),this.pes_slice_queues_[s.pid]=new Ch,this.pes_slice_queues_[s.pid].random_access_indicator=s.random_access_indicator}if(null==this.pes_slice_queues_[s.pid])return;let n=this.pes_slice_queues_[s.pid];n.slices.push(r),s.payload_unit_start_indicator&&(n.expected_length=0===a?0:a+6),n.total_length+=r.byteLength,n.expected_length>0&&n.expected_length===n.total_length?this.emitPESSlices(n,s):n.expected_length>0&&n.expected_length>>6,n=t[8];2!==a&&3!==a||(i=this._getTimestamp(t,9),o=3===a?this._getTimestamp(t,14):i);let l,d=9+n;if(0!==r){if(r<3+n)return void this.player.debugWarn(this.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");l=r-3-n}else l=t.byteLength-d;let h=t.subarray(d,d+l);switch(e.stream_type){case yh:case Ah:this.parseMP3Payload(h,i);break;case bh:this.pmt_.common_pids.opus===e.pid?this.parseOpusPayload(h,i):this.pmt_.common_pids.ac3===e.pid?this.parseAC3Payload(h,i):this.pmt_.common_pids.eac3===e.pid?this.parseEAC3Payload(h,i):this.pmt_.asynchronous_klv_pids[e.pid]?this.parseAsynchronousKLVMetadataPayload(h,e.pid,s):this.pmt_.smpte2038_pids[e.pid]?this.parseSMPTE2038MetadataPayload(h,i,o,e.pid,s):this.parsePESPrivateDataPayload(h,i,o,e.pid,s);break;case vh:this.parseADTSAACPayload(h,i);break;case _h:this.parseLOASAACPayload(h,i);break;case Sh:this.parseAC3Payload(h,i);break;case Eh:this.parseEAC3Payload(h,i);break;case wh:this.pmt_.timed_id3_pids[e.pid]?this.parseTimedID3MetadataPayload(h,i,o,e.pid,s):this.pmt_.synchronous_klv_pids[e.pid]&&this.parseSynchronousKLVMetadataPayload(h,i,o,e.pid,s);break;case kh:this.parseH264Payload(h,i,o,e.random_access_indicator);break;case Lh:this.parseH265Payload(h,i,o,e.random_access_indicator)}}else if((188===s||191===s||240===s||241===s||255===s||242===s||248===s)&&e.stream_type===bh){let i,o=6;i=0!==r?r:t.byteLength-o;let a=t.subarray(o,o+i);this.parsePESPrivateDataPayload(a,void 0,void 0,e.pid,s)}}else this.player.debugError(this.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${i}`)}parsePAT(e){let t=e[0];if(0!==t)return void Log.e(this.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let i=(15&e[1])<<8|e[2];e[3],e[4];let s=(62&e[5])>>>1,r=1&e[5],o=e[6];e[7];let a=null;if(1===r&&0===o)a={version_number:0,network_pid:0,program_pmt_pid:{}},a.version_number=s;else if(a=this.pat_,null==a)return;let n=i-5-4,l=-1,d=-1;for(let t=8;t<8+n;t+=4){let i=e[t]<<8|e[t+1],s=(31&e[t+2])<<8|e[t+3];0===i?a.network_pid=s:(a.program_pmt_pid[i]=s,-1===l&&(l=i),-1===d&&(d=s))}1===r&&0===o&&(null==this.pat_&&this.player.debugLog(this.TAG_NAME,`Parsed first PAT: ${JSON.stringify(a)}`),this.pat_=a,this.current_program_=l,this.current_pmt_pid_=d)}parsePMT(e){let t=e[0];if(2!==t)return void this.player.debugError(this.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let i,s=(15&e[1])<<8|e[2],r=e[3]<<8|e[4],o=(62&e[5])>>>1,a=1&e[5],n=e[6];if(e[7],1===a&&0===n)i=this._initPmt(),i.program_number=r,i.version_number=o,this.program_pmt_map_[r]=i;else if(i=this.program_pmt_map_[r],null==i)return;i.pcr_pid=(31&e[8])<<8|e[9];let l=(15&e[10])<<8|e[11],d=12+l,h=s-9-l-4;for(let t=d;t0){for(let s=t+5;s0)for(let s=t+5;s1&&(this.player.debugWarn(this.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${s}ms`),s=e)}}let r,o=new Vr(e),a=null,n=s;for(;null!=(a=o.readNextAACFrame());){i=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},this.dispatchAudioInitSegment(e)):this.detectAudioMetadataChange(e)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(e)),r=n;let t=Math.floor(n);const s=new Uint8Array(a.data.length+2);s.set([175,1],0),s.set(a.data,2);let o={payload:s,length:s.byteLength,pts:t,dts:t,type:Fe};this.audio_track_.samples.push(o),this.audio_track_.length+=s.byteLength,n+=i}o.hasIncompleteData()&&(this.aac_last_incomplete_data_=o.getIncompleteData()),r&&(this.audio_last_sample_pts_=r)}parseLOASAACPayload(e,t){if(this.has_video_&&!this.video_init_segment_dispatched_)return;if(this.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);t.set(this.aac_last_incomplete_data_,0),t.set(e,this.aac_last_incomplete_data_.byteLength),e=t}let i,s;if(null!=t&&(s=t/this.timescale_),"aac"===this.audio_metadata_.codec){if(null==t&&null!=this.audio_last_sample_pts_)i=1024/this.audio_metadata_.sampling_frequency*1e3,s=this.audio_last_sample_pts_+i;else if(null==t)return void this.player.debugWarn(this.TAG_NAME,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.audio_last_sample_pts_){i=1024/this.audio_metadata_.sampling_frequency*1e3;let e=this.audio_last_sample_pts_+i;Math.abs(e-s)>1&&(this.player.debugWarn(this.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${s}ms`),s=e)}}let r,o=new Hr(e),a=null,n=s;for(;null!=(a=o.readNextAACFrame(Lo(this.loas_previous_frame)?void 0:this.loas_previous_frame));){this.loas_previous_frame=a,i=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},this.dispatchAudioInitSegment(e)):this.detectAudioMetadataChange(e)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(e)),r=n;let t=Math.floor(n);const s=new Uint8Array(a.data.length+2);s.set([175,1],0),s.set(a.data,2);let o={payload:s,length:s.byteLength,pts:t,dts:t,type:Fe};this.audio_track_.samples.push(o),this.audio_track_.length+=s.byteLength,n+=i}o.hasIncompleteData()&&(this.aac_last_incomplete_data_=o.getIncompleteData()),r&&(this.audio_last_sample_pts_=r)}parseAC3Payload(e,t){}parseEAC3Payload(e,t){}parseOpusPayload(e,t){}parseMP3Payload(e,t){if(this.has_video_&&!this.video_init_segment_dispatched_)return;let i=[44100,48e3,32e3,0],s=[22050,24e3,16e3,0],r=[11025,12e3,8e3,0],o=e[1]>>>3&3,a=(6&e[1])>>1;e[2];let n=(12&e[2])>>>2,l=3!==(e[3]>>>6&3)?2:1,d=0,h=34;switch(o){case 0:d=r[n];break;case 2:d=s[n];break;case 3:d=i[n]}switch(a){case 1:h=34;break;case 2:h=33;break;case 3:h=32}const c={};c.object_type=h,c.sample_rate=d,c.channel_count=l,c.data=e;const u={codec:"mp3",data:c};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"mp3",object_type:h,sample_rate:d,channel_count:l},this.dispatchAudioInitSegment(u)):this.detectAudioMetadataChange(u)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(u));let p={payload:e,length:e.byteLength,pts:t/this.timescale_,dts:t/this.timescale_,type:Fe};this.audio_track_.samples.push(p),this.audio_track_.length+=e.byteLength}detectAudioMetadataChange(e){if(e.codec!==this.audio_metadata_.codec)return this.player.debugLog(this.TAG_NAME,`Audio: Audio Codecs changed from ${this.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===this.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==this.audio_metadata_.audio_object_type)return this.player.debugLog(this.TAG_NAME,`AAC: AudioObjectType changed from ${this.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==this.audio_metadata_.sampling_freq_index)return this.player.debugLog(this.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${this.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==this.audio_metadata_.channel_config)return this.player.debugLog(this.TAG_NAME,`AAC: Channel configuration changed from ${this.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===this.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==this.audio_metadata_.sampling_frequency)return this.player.debugLog(this.TAG_NAME,`AC3: Sampling Frequency changed from ${this.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==this.audio_metadata_.bit_stream_identification)return this.player.debugLog(this.TAG_NAME,`AC3: Bit Stream Identification changed from ${this.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==this.audio_metadata_.bit_stream_mode)return this.player.debugLog(this.TAG_NAME,`AC3: BitStream Mode changed from ${this.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==this.audio_metadata_.channel_mode)return this.player.debugLog(this.TAG_NAME,`AC3: Channel Mode changed from ${this.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==this.audio_metadata_.low_frequency_effects_channel_on)return this.player.debugLog(this.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${this.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===this.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==this.audio_metadata_.sample_rate)return this.player.debugLog(this.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==this.audio_metadata_.channel_count)return this.player.debugLog(this.TAG_NAME,`Opus: Channel count changed from ${this.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===this.audio_metadata_.codec){const t=e.data;if(t.object_type!==this.audio_metadata_.object_type)return this.player.debugLog(this.TAG_NAME,`MP3: AudioObjectType changed from ${this.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==this.audio_metadata_.sample_rate)return this.player.debugLog(this.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==this.audio_metadata_.channel_count)return this.player.debugLog(this.TAG_NAME,`MP3: Channel count changed from ${this.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1}dispatchAudioInitSegment(e){let t={type:"audio"};t.id=this.audio_track_.id,t.timescale=1e3,t.duration=this.duration_;let i="";if("aac"===this.audio_metadata_.codec){let s="aac"===e.codec?e.data:null,r=new Bh(s);t.audioSampleRate=r.sampling_rate,t.audioSampleRateIndex=r.sampling_index,t.channelCount=r.channel_count,t.codec=r.codec_mimetype,t.originalCodec=r.original_codec_mimetype,t.config=r.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale,i=_t;const o=Pr({profile:this.player._opt.mseDecodeAudio?r.object_type:r.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});console.error("aacADTSHeader",`profile: ${r.object_type}, sampleRate: ${t.audioSampleRateIndex}, channel: ${t.channelCount}`),this._doDecodeByTs(o,Fe,0,!1,0)}else"ac-3"===this.audio_metadata_.codec||"ec-3"===this.audio_metadata_.codec||"opus"===this.audio_metadata_.codec||"mp3"===this.audio_metadata_.codec&&(t.audioSampleRate=this.audio_metadata_.sample_rate,t.channelCount=this.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0,i=Et);0==this.audio_init_segment_dispatched_&&this.player.debugLog(this.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;let s=this.media_info_;s.hasAudio=!0,s.audioCodec=t.originalCodec,s.audioSampleRate=t.audioSampleRate,s.audioChannelCount=t.channelCount,s.hasVideo&&s.videoCodec?s.mimeType=`video/mp2t; codecs="${s.videoCodec},${s.audioCodec}"`:s.mimeType=`video/mp2t; codecs="${s.audioCodec}"`,i&&this.player.audio.updateAudioInfo({encTypeCode:i,channels:t.channelCount,sampleRate:t.audioSampleRate})}dispatchPESPrivateDataDescriptor(e,t,i){}parsePESPrivateDataPayload(e,t,i,s,r){let o=new xh;if(o.pid=s,o.stream_id=r,o.len=e.byteLength,o.data=e,null!=t){let e=Math.floor(t/this.timescale_);o.pts=e}else o.nearest_pts=this.getNearestTimestampMilliseconds();if(null!=i){let e=Math.floor(i/this.timescale_);o.dts=e}}parseTimedID3MetadataPayload(e,t,i,s,r){this.player.debugLog(this.TAG_NAME,`Timed ID3 Metadata: pid=${s}, pts=${t}, dts=${i}, stream_id=${r}`)}parseSynchronousKLVMetadataPayload(e,t,i,s,r){this.player.debugLog(this.TAG_NAME,`Synchronous KLV Metadata: pid=${s}, pts=${t}, dts=${i}, stream_id=${r}`)}parseAsynchronousKLVMetadataPayload(e,t,i){this.player.debugLog(this.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${i}`)}parseSMPTE2038MetadataPayload(e,t,i,s,r){this.player.debugLog(this.TAG_NAME,`SMPTE 2038 Metadata: pid=${s}, pts=${t}, dts=${i}, stream_id=${r}`)}getNearestTimestampMilliseconds(){if(null!=this.audio_last_sample_pts_)return Math.floor(this.audio_last_sample_pts_);if(null!=this.last_pcr_){return Math.floor(this.last_pcr_/300/this.timescale_)}}_preDoDecode(){const e=this.video_track_,t=this.audio_track_;let i=e.samples;t.samples.length>0&&(i=e.samples.concat(t.samples),i=i.sort(((e,t)=>e.dts-t.dts))),i.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===Ue?this._doDecodeVideo({...e,payload:t}):e.type===Fe&&this._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0}_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?Hn(t,e.isIFrame):Rn(t,e.isIFrame),this.player.updateStats({dts:e.dts,vbps:i.byteLength}),e.isIFrame&&this.calcIframeIntervalTimestamp(e.dts);let s=this.cryptoPayload(i,e.isIFrame);this._doDecodeByTs(s,Ue,e.dts,e.isIFrame,e.cts)}_doDecodeAudio(e){const t=new Uint8Array(e.payload);this.player.updateStats({abps:t.byteLength});let i=this.cryptoPayloadAudio(t);this._doDecodeByTs(i,Fe,e.dts,!1,0)}getInputByteLength(){return this._remainingPacketData&&this._remainingPacketData.byteLength||0}_getPcrBase(e){let t=33554432*e[6]+131072*e[7]+512*e[8]+2*e[9]+(128&e[10])/128+this.timestamp_offset_;return t+4294967296>>3&3,r=(6&t[1])>>1,o=(240&t[2])>>>4,a=(12&t[2])>>>2,n=3!==(t[3]>>>6&3)?2:1,l=0,d=0;switch(s){case 0:l=Oh[a];break;case 2:l=Uh[a];break;case 3:l=Fh[a]}switch(r){case 1:o{this._clearAudioSourceBufferCheckTimeout(),this.player.emit(lt.webcodecsAudioInitTimeout)}),1e3)),void Zo(e)):void(this.player.isPlayer()?(this.player.updateStats({dfps:!0}),this.player._times.videoStart||(this.player._times.videoStart=Zr(),this.player.handlePlayToRenderTimes()),this.player.video.render({videoFrame:e,ts:e.timestamp}),this.player.handleRender()):this.player.isPlayback()&&(this.player.updateStats({dfps:!0}),ua(this.player.playbackPause)?(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this.player.playback.isUseFpsRender?this.player.video.pushData({videoFrame:e,ts:e.timestamp}):this.player.video.render$2({videoFrame:e,ts:e.timestamp})):this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this.player.playback.isUseFpsRender&&this.player.video.pushData({videoFrame:e,ts:e.timestamp})));Zo(e)}handleError(e){this.player.debugError(this.TAG_NAME,"VideoDecoder handleError:",e.code,e);const t=e.toString();-1!==t.indexOf(os)?this.player.emitError(lt.webcodecsUnsupportedConfigurationError,t):-1!==t.indexOf(as)||-1!==t.indexOf(ns)||-1!==t.indexOf(ls)?this.player.emitError(lt.webcodecsDecodeError,t):-1!==t.indexOf(ds)&&this.player.emitError(lt.webcodecsH265NotSupport,t)}handleDecodeAudio(e){this.player&&(this.player.isDestroyedOrClosed()?this.player.debugWarn(this.TAG_NAME,"decodeVideo() player is destroyed"):this.player.isPlayer()?this.player.audio.play(e,e.timestamp):this.player.isPlayback())}handleErrorAudio(e){this.player.debugError(this.TAG_NAME,"AudioDecoder handleError:",e.code,e)}decodeVideo(e,t,i,s){if(this.player)if(this.player.isDestroyedOrClosed())this.player.debugWarn(this.TAG_NAME,"decodeVideo() player is destroyed");else if(this.hasInit)if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(this.isDecodeStateClosed())return void this.player.debugWarn(this.TAG_NAME,"VideoDecoder isDecodeStateClosed true");if(i&&0===e[1]){const t=15&e[0];let i={};if(t===yt){i=Dn(e.slice(5))}else t===At&&(i=Gn(e));const s=this.player.video.videoInfo;s&&s.width&&s.height&&i&&i.codecWidth&&i.codecHeight&&(i.codecWidth!==s.width||i.codecHeight!==s.height)&&(this.player.debugWarn(this.TAG_NAME,`decodeVideo: video width or height is changed,\n old width is ${s.width}, old height is ${s.height},\n new width is ${i.codecWidth}, new height is ${i.codecHeight},\n and emit change event`),this.isWidthOrHeightChanged=!0,this.player.emitError(lt.wcsWidthOrHeightChange,`width ${s.width}->${s.height} height ${i.codecWidth}->${i.codecHeight}`))}if(this.isWidthOrHeightChanged)return void this.player.debugWarn(this.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(ha(e))return void this.player.debugLog(this.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength<12)return void this.player.debugWarn(this.TAG_NAME,`decodeVideo and payload is too small , payload length is ${e.byteLength}`);let s=!1,r=(new Date).getTime();this.prevTimestamp||(this.prevTimestamp=r,s=!0);const o=r-this.prevTimestamp;this.decodeDiffTimestamp=o,o>500&&!s&&this.player.isPlayer()&&this.player.debugWarn(this.TAG_NAME,"decodeVideo diff time is ",o);const a=e.slice(5),n=new EncodedVideoChunk({data:a,timestamp:t,type:i?di:hi});this.player.emit(ot.timeUpdate,t);try{this.decoder.decode(n)}catch(e){this.player.debugError(this.TAG_NAME,"VideoDecoder",e);const t=e.toString();(-1!==t.indexOf(ss)||-1!==t.indexOf(rs))&&this.player.emitError(lt.webcodecsDecodeError,t)}this.prevTimestamp=(new Date).getTime()}else this.player.debugLog(this.TAG_NAME,"VideoDecoder first frame is not iFrame");else if(i&&e[1]===ys){const t=15&e[0];if(this.player.video.updateVideoInfo({encTypeCode:t}),t===At&&!Eo()){const e=uo();return this.player.debugWarn(this.TAG_NAME,"WebcodecsDecoder not support hevc decode",e.type,e.version),void this.player.emitError(lt.webcodecsH265NotSupport)}this.player._times.decodeStart||(this.player._times.decodeStart=Zr());let i=null,s=null;const r=e.slice(5);if(t===yt?(s=Dn(r),i={codec:s.codec,description:r}):t===At&&(s=zn(r),i={codec:s.codec,description:r}),!i||i&&!i.codec||s&&0===s.codecWidth&&0===s.codecHeight)return this.player.debugWarn(this.TAG_NAME,"decodeVideo and webcodecs configure is",JSON.stringify(i)),void this.player.emitError(lt.webcodecsDecodeConfigureError,"configure or configure.code is null");i.codedHeight=s.codecHeight,i.codedWidth=s.codecWidth,this.isInitInfo||(this.player.debugLog(this.TAG_NAME,`updateVideoInfo: ${s.codecWidth},${s.codecHeight}`),this.player.video.updateVideoInfo({width:s.codecWidth,height:s.codecHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0),this.player.recorder&&this.player._opt.recordType===S&&this.player.recorder.initMetaData(e,t),this.player.video.bindMediaStream(),this.player.debugLog(this.TAG_NAME,`decoder.configure() and codec is ${i.codec}`);try{i.optimizeForLatency=!0,i.hardwareAcceleration="prefer-hardware",this.decoder.configure(i),this.hasInit=!0}catch(e){this.player.debugError(this.TAG_NAME,"configure error",e.code,e);const t=e.toString();-1!==t.indexOf(ds)?this.player.emitError(lt.webcodecsH265NotSupport,t):this.player.emitError(lt.webcodecsDecodeConfigureError,t)}}else this.player.debugWarn(this.TAG_NAME,`decodeVideo has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)}decodeAudio(e,t){if(this.player)if(this.player.isDestroyedOrClosed())this.player.debugWarn(this.TAG_NAME,"decodeAudio() player is destroyed");else if(this.hasAudioInit){if(Br(e))return void this.player.debugLog(this.TAG_NAME,"decodeAudio and has already initialized and payload is aac codec packet so drop this frame");if(this._clearAudioNoDataCheckTimeout(),this.isDecodeFirstIIframe){if(this.isAudioDecodeStateClosed())return void this.player.debugWarn(this.TAG_NAME,"AudioDecoder isDecodeStateClosed true");const i=this.isAAC?e.slice(2):e.slice(1),s=i.length/this.player.audio.audioInfo.sampleRate*1e3,r=new EncodedAudioChunk({type:"key",data:i,timestamp:t,duration:parseInt(s,10)});try{this.decoderAudio.decode(r)}catch(e){this.player.debugError(this.TAG_NAME,"AudioDecoder",e),e.toString()}}}else{const t=e[0]>>4,i=e[0]>>1&1,s=t===Et,r=t===_t,o=t===St;let a="";a=r?i?16:8:0===i?8:16;const n={codec:"",numberOfChannels:"",sampleRate:""};let l=null;if(r||s){let t=null;if(Br(e)){const i=e.slice(2);t=Or(i),t&&(n.codec=t.originalCodec,n.numberOfChannels=t.channelCount,n.sampleRate=t.sampleRate),l=i,this.isAAC=r}else s&&(t=zh(e),t&&(n.codec=br,n.numberOfChannels=t.channelCount,n.sampleRate=t.samplingRate))}else n.codec=o?Ar:yr,n.numberOfChannels=1,n.sampleRate=8e3;if(n.codec&&n.numberOfChannels&&n.sampleRate){this.isAudioInitInfo||(this.player.audio.updateAudioInfo({encTypeCode:t,channels:n.numberOfChannels,sampleRate:n.sampleRate,depth:a}),this.isAudioInitInfo=!0),this.player.recorder&&this.player._opt.recordType===S&&l&&this.player.recorder.initAudioAacExtraData(l),this.player.debugLog(this.TAG_NAME,`decoderAudio.configure() and codec is ${n.codec}`);try{this.decoderAudio.configure(n),this._clearAudioSourceBufferCheckTimeout(),this.hasAudioInit=!0,null===this.audioSourceNoDataCheckTimeout&&(this.audioSourceNoDataCheckTimeout=setTimeout((()=>{this._clearAudioNoDataCheckTimeout(),this.player.emit(lt.webcodecsAudioNoDataTimeout)}),1e3))}catch(e){this.player.debugError(this.TAG_NAME,"configure audio error",e.code,e),e.toString()}}}}_clearAudioSourceBufferCheckTimeout(){this.audioSourceBufferCheckTimeout&&(clearTimeout(this.audioSourceBufferCheckTimeout),this.audioSourceBufferCheckTimeout=null)}_clearAudioNoDataCheckTimeout(){this.audioSourceNoDataCheckTimeout&&(clearTimeout(this.audioSourceNoDataCheckTimeout),this.audioSourceNoDataCheckTimeout=null)}getDecodeDiffTimes(){return this.decodeDiffTimestamp}isDecodeStateClosed(){return"closed"===this.decoder.state}isDecodeStateConfigured(){return"configured"===this.decoder.state}isDecodeStateUnConfigured(){return"unconfigured"===this.decoder.state}isAudioDecodeStateClosed(){return"closed"===this.decoderAudio.state}isAudioDecodeStateConfigured(){return"configured"===this.decoderAudio.state}isAudioDecodeStateUnConfigured(){return"unconfigured"===this.decoderAudio.state}}const Vh={play:"播放",pause:"暂停",audio:"",mute:"",screenshot:"截图",loading:"",fullscreen:"全屏",fullscreenExit:"退出全屏",record:"录制",recordStop:"停止录制",narrow:"缩小",expand:"放大",ptz:"操作盘",ptzActive:"操作盘激活",zoom:"电子放大",zoomStop:"关闭电子放大",close:"关闭",performance:"性能面板",performanceActive:"性能面板激活",face:"人脸识别",faceActive:"人脸识别激活",object:"物品识别",objectActive:"物品识别激活",occlusion:"遮挡物检查",occlusionActive:"遮挡物检查激活",logSave:"保存日志"};var Hh=Object.keys(Vh).reduce(((e,t)=>(e[t]=`\n \n ${Vh[t]?`${Vh[t]}`:""}\n`,e)),{});function $h(e,t){let i=!1;return e.forEach((e=>{i||e.startTimestamp<=t&&e.endTimestamp>t&&(i=!0)})),i}function Jh(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=e.length,r=t.length,o=Math.max(s,r),a=2e3,n=Math.ceil(o/a);let l=0,d=0;function h(){let r="",o="";for(let i=0;i\n ${i.title}\n \n `);const a=t[d];a&&(o+=`\n

\n `),d+=1}r&&i.$playbackTimeListOne.insertAdjacentHTML("beforeend",r),o&&i.$playbackTimeListSecond.insertAdjacentHTML("beforeend",o),l+=1,l0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<1440;s++){const r=s%60==0;let o=!1;i&&(o=$h(e,Oo(i,s))),t.push({title:Fo(s),timestamp:s,dataType:"min",hasRecord:o,isStart:r})}return t}(e);Jh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0})}return e}(),t)}function Kh(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<1440;s++){let r=60*s,o=r%1800==0,a=!1;i&&(a=$h(e,No(i,r))),t.push({title:Uo(r),timestamp:r,dataType:"second",hasRecord:a,isStart:o});let n=60*s+30;o=n%1800==0,i&&(a=$h(e,No(i,n))),t.push({title:Uo(n),timestamp:n,dataType:"second",hasRecord:a,isStart:o})}return t}(e);Jh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00",s=t+":30";t<10&&(i="0"+i,s="0"+s),e.push({title:i,hour:t,min:0,second:0}),e.push({title:s,hour:t,min:30,second:0})}return e}(),t)}function Yh(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<144;s++)for(let r=0;r<60;r++){let o=10*r+600*s,a=o%600==0,n=!1;i&&(n=$h(e,No(i,o))),t.push({title:Uo(o),timestamp:o,dataType:"second",isStart:a,hasRecord:n})}return t}(e);Jh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0});for(let s=1;s<6;s++){let r=s+"0";e.push({title:i.replace(":00",":"+r),hour:t,min:10*s,second:0})}}return e}(),t)}function Qh(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<288;s++)for(let r=0;r<60;r++){let o=5*r+300*s,a=o%300==0,n=!1;i&&(n=$h(e,No(i,o))),t.push({title:Uo(o),timestamp:o,dataType:"second",isStart:a,hasRecord:n})}return t}(e);Jh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0}),e.push({title:i.replace(":00",":05"),hour:t,min:5,second:0});for(let s=1;s<6;s++){let r=s+"0",o=s+"5";e.push({title:i.replace(":00",":"+r),hour:t,min:10*s,second:0}),e.push({title:i.replace(":00",":"+o),hour:t,min:10*s+5,second:0})}}return e}(),t)}function Xh(e){const t=Math.floor(e/3600),i=Math.floor((e-3600*t)/60),s=Math.floor(e-3600*t-60*i);return(t>0?[t,i,s]:[i,s]).map((e=>e<10?`0${e}`:String(e))).join(":")}function Zh(e,t,i){const s=e.$playbackProgress,{left:r}=s.getBoundingClientRect(),o=eo((no()?i.touches[0].clientX:i.pageX)-r,0,s.clientWidth),a=parseInt(o/s.clientWidth*t,10);return{second:a,time:Xh(a),width:o,percentage:eo(o/s.clientWidth,0,1)}}function ec(e,t){return e.classList.add(t)}function tc(e,t){return t instanceof Element?e.appendChild(t):e.insertAdjacentHTML("beforeend",String(t)),e.lastElementChild||e.lastChild}function ic(e,t,i){return e&&e.style&&Do(t)&&(e.style[t]=i),e}function sc(e,t){return e.composedPath&&e.composedPath().indexOf(t)>-1}function rc(e){let t=!1;return e&&e.parentNode&&(e.parentNode.removeChild(e),t=!0),t}var oc=(e,t)=>{const{events:{proxy:i}}=e;let s=null,r=null,o=null,a=null;if(e._opt.listenWindowResizeAuoResize){s=document.createElement("object"),r=`jb-pro-object-${aa()}`,s.setAttribute("aria-hidden","true"),s.setAttribute("tabindex",-1),s.setAttribute("id",r),s.type="text/html",s.data="about:blank",to(s,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"}),o=e.width,a=e.height;const t=bo((()=>{e.width===o&&e.height===a||(o=e.width,a=e.height,e.emit(ot.resize))}),500);i(s,"load",(()=>{i(s.contentDocument.defaultView,"resize",(()=>{t()}))})),e.$container.appendChild(s)}e.on(ot.destroy,(()=>{if(s)try{if(!rc(s)){const t=e.$container.querySelector(`#${r}`);t&&e.$container&&e.$container.removeChild(t)}}catch(e){}d&&(clearInterval(d),d=null),h=null,c=null,u=0,s=null,r=null,o=null,a=null})),e.on(ot.volumechange,(()=>{!function(e){if(0===e)to(t.$volumeOn,"display","none"),to(t.$volumeOff,"display","flex"),to(t.$volumeHandle,"top","48px");else if(t.$volumeHandle&&t.$volumePanel){const i=io(t.$volumePanel,"height")||60,s=io(t.$volumeHandle,"height"),r=i-(i-s)*e-s;to(t.$volumeHandle,"top",`${r}px`),to(t.$volumeOn,"display","flex"),to(t.$volumeOff,"display","none")}t.$volumePanelText&&(t.$volumePanelText.innerHTML=parseInt(100*e))}(e.volume)})),e.on(ot.loading,(i=>{to(t.$loading,"display",i?"flex":"none"),(ua(e._opt.backgroundLoadingShow)&&ca(i)||ua(i))&&to(t.$poster,"display","none"),i&&(to(t.$playBig,"display","none"),to(t.$tipsMessage,"display","none"),t.extendBtnList.forEach((e=>{e.createdMoment===Sr&&(e.$iconWrap&&to(e.$iconWrap,"display","flex"),e.$activeIconWrap&&to(e.$activeIconWrap,"display","none"))}))),i||e._opt.extendDomConfig.showAfterLoading&&t.$extendDom&&to(t.$extendDom,"display","block"),i||e.getRenderType()===H&&ua(e._opt.useMSE)&&n()})),e.on(ot.removeLoadingBgImage,(()=>{n()}));const n=()=>{t.$loadingBgImage&&t.$loadingBg&&t.$loadingBgImage.src&&(e.debugLog("Control","remove loading bg image"),t.$loadingBgImage.width=0,t.$loadingBgImage.height=0,t.$loadingBgImage.src="",to(t.$loadingBg,"display","none"))},l=t=>{$o(t)===e.$container&&(e.fullscreen,f(),e._opt.androidMobileFullscreenRotate&&no()&&(e.fullscreen?(e.$container.classList.add("jb-pro-fullscreen-android-rotate"),e.setRotate(270)):(e.$container.classList.remove("jb-pro-fullscreen-android-rotate"),e.setRotate(0)),p()))};let d=null,h=null,c=null,u=0;const p=()=>{h=e.rect,h.width=parseInt(h.width,10),h.height=parseInt(h.height,10),u=0,d=setInterval((()=>{const t=Lr.isFullscreen;c=e.rect,c.width=parseInt(c.width,10),c.height=parseInt(c.height,10);const i=screen.width,s=screen.height,r=c.width===h.width&&c.height===h.height,o=!t||i-c.width<10&&s-c.height<10;if(r&&o||u>=5)return d&&(clearInterval(d),d=null),void g((()=>{A()}));h=c,u++}),1e3)},f=i=>{if(ua(e.isPlaying()))return;let s=Co(i)?i:e.fullscreen;to(t.$fullscreenExit,"display",s?"flex":"none"),to(t.$fullscreen,"display",s?"none":"flex")},m=()=>e._opt.playType===_&&e._opt.playbackConfig.showControl,g=i=>{no()&&t.$controls&&(e._opt.useWebFullScreen||e._opt.androidMobileFullscreenRotate)&&setTimeout((()=>{if(e.fullscreen){const i=m()?Qt:Yt;let s=e.height/2-e.width+i/2,r=e.height/2-i/2;if(t.$controls.style.transform=`translateX(${-s}px) translateY(-${r}px) rotate(-90deg)`,t.$zoomControls){const i=156,s=30,r=e.width/2+i/2-s/2;t.$zoomControls.style.transform=`translateX(${-r}px) translateY(${e.height/2}px) rotate(-90deg)`}if(t.$recording){const i=101,s=20,r=e.width/2+i/2-s/2;t.$recording.style.transform=`translateX(${-r}px) translateY(${e.height/2}px) rotate(-90deg)`}t.$ptzControl&&(t.$ptzControl.style.transform="rotate(-90deg)")}else t.$controls.style.transform="translateX(0) translateY(0) rotate(0)",t.$zoomControls&&(t.$zoomControls.style.transform="translateX(-50%) translateY(0) rotate(0)"),t.$recording&&(t.$recording.style.transform="translateX(-50%) translateY(0) rotate(0)"),t.$ptzControl&&(t.$ptzControl.style.transform="rotate(0)");i&&i()}),10)};try{Lr.on("change",l),e.events.destroys.push((()=>{Lr.off("change",l)}))}catch(e){}e.on(ot.webFullscreen,(e=>{no()&&(f(e),g((()=>{A()})))})),e.on(ot.recording,(()=>{e.playing&&(to(t.$record,"display",e.recording?"none":"flex"),to(t.$recordStop,"display",e.recording?"flex":"none"),(e._opt.hasControl||e._opt.isShowRecordingUI)&&(to(t.$recording,"display",e.recording?"flex":"none"),ua(e.recording)&&t.$recordingTime&&(t.$recordingTime.innerHTML=Mo(0))))})),e.on(ot.recordingTimestamp,(e=>{t.$recordingTime&&(t.$recordingTime.innerHTML=Mo(e))})),e.on(ot.zooming,(()=>{e.playing&&(to(t.$zoom,"display",e.zooming?"none":"flex"),to(t.$zoomStop,"display",e.zooming?"flex":"none"),(e._opt.hasControl||e._opt.isShowZoomingUI)&&to(t.$zoomControls,"display",e.zooming?"flex":"none"))})),e.on(ot.playing,(e=>{y(e)}));const y=i=>{i||e.isPlayFailedAndPaused&&ua(e._opt.playFailedAndPausedShowPlayBtn)?(to(t.$play,"display","none"),to(t.$playBig,"display","none")):(to(t.$play,"display","flex"),to(t.$playBig,"display","block")),to(t.$pause,"display",i?"flex":"none"),to(t.$screenshot,"display",i?"flex":"none"),to(t.$record,"display",i?"flex":"none"),to(t.$qualityMenu,"display",i?"flex":"none"),to(t.$volume,"display",i?"flex":"none"),to(t.$ptz,"display",i?"flex":"none"),to(t.$zoom,"display",i?"flex":"none"),to(t.$scaleMenu,"display",i?"flex":"none"),to(t.$faceDetect,"display",i?"flex":"none"),to(t.$objectDetect,"display",i?"flex":"none"),to(t.$occlusionDetect,"display",i?"flex":"none"),to(t.$controlHtml,"display",i?"flex":"none"),e.isPlayback()&&to(t.$speedMenu,"display",i?"flex":"none"),f(),t.extendBtnList.forEach((e=>{e.createdMoment===Er&&(e.$iconWrap&&to(e.$iconWrap,"display",i?"flex":"none"),e.$activeIconWrap&&to(e.$activeIconWrap,"display","none"))})),e._opt.showPerformance?to(t.$performanceActive,"display",i?"flex":"none"):(to(t.$performance,"display",i?"flex":"none"),to(t.$performanceActive,"display","none")),to(t.$poster,"display","none"),to(t.$ptzActive,"display","none"),to(t.$recordStop,"display","none"),to(t.$zoomStop,"display","none"),to(t.$faceDetectActive,"display","none"),to(t.$objectDetectActive,"display","none"),i||(t.$speed&&(t.$speed.innerHTML=function(e){if(null==e||""===e)return"0 KB/s";let t=parseFloat(e);return t=t.toFixed(2),t+"KB/s"}("")),to(t.$zoomControls,"display","none"),to(t.$recording,"display","none"),t.$ptzControl&&t.$ptzControl.classList.remove("jb-pro-ptz-controls-show")),A(),i&&b()};e.on(ot.playbackPause,(e=>{y(!e)})),e.on(ot.kBps,(i=>{const s=function(e){if(null==e||""===e||0===parseFloat(e)||"NaN"===e)return"0 KB/s";const t=["KB/s","MB/s","GB/s","TB/s","PB/s","EB/s","ZB/s","YB/s"];let i=0;const s=parseFloat(e/8);i=Math.floor(Math.log(s)/Math.log(1024));let r=s/Math.pow(1024,i);return r=r.toFixed(2),r+(t[i]||t[0])}(i);t.kbpsShow=s,e._opt.showBandwidth&&(t.$speed&&(t.$speed.innerHTML=s),A())}));const A=()=>{if(m()&&e._opt.playbackConfig.controlType===Q.normal){let i=t.controlsInnerRect.width-t.controlsLeftRect.width-t.controlsRightRect.width-t.controlsPlaybackBtnsRect.width;no()&&e.webFullscreen&&(i=t.controlsInnerRect.height-t.controlsLeftRect.height-t.controlsRightRect.height-t.controlsPlaybackBtnsRect.height),t.$playbackTimeInner.style.width=i+"px"}},b=()=>{if(!m()||e._opt.playbackConfig.controlType!==Q.normal)return;const i=t.$playbackCurrentTime.style.left;let s=parseInt(i,10);const r=t.controlsPlaybackTimeInner.width;s=s-r/2>0?parseInt(s-r/2,10):0,t.$playbackTimeInner.scrollLeft=s};if(m()){const i=()=>{if(m()){let i=0;const s=e.playback&&e.playback.playingTimestamp;if(s){const r=new Date(s),o=r.getHours(),a=r.getMinutes(),n=r.getSeconds();e.playback.is60Min?i=60*o+a:e.playback.is30Min?i=2*(60*o+a)+parseInt(n/30,10):e.playback.is10Min?i=6*(60*o+a)+parseInt(n/10,10):e.playback.is5Min?i=12*(60*o+a)+parseInt(n/5,10):e.playback.is1Min&&(i=60*(60*o+a)+parseInt(n,10)),t.$playbackCurrentTime.style.left=i+"px"}}},s=e=>{t.$playbackNarrow.classList.remove("disabled"),t.$playbackExpand.classList.remove("disabled"),e===Ei&&t.$playbackNarrow.classList.add("disabled"),e===ki&&t.$playbackExpand.classList.add("disabled")};e.on(ot.playbackTime,(s=>{if(e._opt.playbackConfig.controlType===Q.normal)t.$playbackCurrentTimeText&&(t.$playbackCurrentTimeText.innerText=mo(s,"{h}:{i}:{s}")),i();else if(e._opt.playbackConfig.controlType===Q.simple){const i=(r=s,o=e.playback.totalDuration,eo(r/o,0,1));t.$playbackProgressPlayed.style.width=100*i+"%",t.$playbackProgressIndicator.style.left=`calc(${100*i}% - 7px)`,t.$playbackProgressTime.innerText=`${Xh(s)} / ${Xh(e.playback.totalDuration)}`}var r,o})),e.on(ot.playbackPrecision,((r,o)=>{m()&&e._opt.playbackConfig.controlType===Q.normal&&(t.$playbackTimeScroll.classList.remove(Li.oneHour,Li.halfHour,Li.fiveMin,Li.tenMin),t.$playbackTimeScroll.classList.add(Li[r]),t.rafId&&(window.cancelAnimationFrame(t.rafId),t.rafId=null),t.changePercisitionInterval&&(clearTimeout(t.changePercisitionInterval),t.changePercisitionInterval=null),t.$playbackTimeListOne.innerHTML="",t.$playbackTimeListSecond.innerHTML="",t.changePercisitionInterval=setTimeout((()=>{switch(t.$playbackTimeListOne.innerHTML="",t.$playbackTimeListSecond.innerHTML="",r){case Ei:qh(o,t);break;case wi:Kh(o,t);break;case Ti:Yh(o,t);break;case ki:Qh(o,t)}i(),e._opt.playbackConfig.showPrecisionBtn&&s(r),b()}),16))})),e.on(ot.resize,(()=>{g((()=>{A()}))})),e.on(ot.playbackTimeScroll,(()=>{b()})),A()}if(e._opt.operateBtns.quality&&e._opt.qualityConfig.length>0){e.on(ot.streamQualityChange,(e=>{i(e)}));const i=e=>{t.$qualityText.innerText=e,t.$qualityMenuItems.forEach((t=>{const i=t.dataset.quality;t.classList.remove("jb-pro-quality-menu-item-active"),i===e&&t.classList.add("jb-pro-quality-menu-item-active")}))};(()=>{const i=e._opt.qualityConfig||[];let s="";i.forEach((e=>{s+=`\n
${e}
\n `})),s&&(t.$qualityMenuList.insertAdjacentHTML("beforeend",s),Object.defineProperty(t,"$qualityMenuItems",{value:e.$container.querySelectorAll(".jb-pro-quality-menu-item")}))})(),e.streamQuality&&i(e.streamQuality)}if(e._opt.operateBtns.scale&&e._opt.scaleConfig.length>0){e.on(ot.viewResizeChange,(e=>{i(e)}));const i=i=>{const s=e._opt.scaleConfig[i];t.$scaleText.innerText=s,t.$scaleMenuItems.forEach((e=>{const t=e.dataset.scale;e.classList.remove("jb-pro-scale-menu-item-active"),yo(t)===yo(i)&&e.classList.add("jb-pro-scale-menu-item-active")}))};(()=>{const i=e._opt.scaleConfig||[];let s="";i.forEach(((e,t)=>{s+=`\n
${e}
\n `})),s&&(t.$scaleMenuList.insertAdjacentHTML("beforeend",s),Object.defineProperty(t,"$scaleMenuItems",{value:e.$container.querySelectorAll(".jb-pro-scale-menu-item")}))})(),i(e.scaleType)}if(e.isPlayback()&&e._opt.playbackConfig.showRateBtn&&e._opt.playbackConfig.rateConfig.length>0){e.on(ot.playbackRateChange,(e=>{i(e)}));const i=i=>{const s=e._opt.playbackConfig.rateConfig.find((e=>yo(e.value)===yo(i)));s&&(t.$speedText.innerText=s.label,t.$speedMenuItems.forEach((e=>{const t=e.dataset.speed;e.classList.remove("jb-pro-speed-menu-item-active"),yo(t)===yo(i)&&e.classList.add("jb-pro-speed-menu-item-active")})))};(()=>{const i=e._opt.playbackConfig.rateConfig;let s="";i.forEach(((e,t)=>{s+=`\n
${e.label}
\n `})),s&&(t.$speedMenuList.insertAdjacentHTML("beforeend",s),Object.defineProperty(t,"$speedMenuItems",{value:e.$container.querySelectorAll(".jb-pro-speed-menu-item")}))})();const s=e.playback?e.playback.playbackRate:1;i(s)}e.on(ot.stats,(function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e._opt.showPerformance){to(t.$performancePanel,"display","block"),t.$performancePanel.innerHTML="";const s=oo,r=ma(),o=e.getCpuLevel(),a=Do(o)&&-1!==o?`${$s[o]}`:"",n=e.video&&e.video.videoInfo||{},l=e.audio&&e.audio.audioInfo||{},d=e._times||{},h=e.getRenderType(),c=e.getCanvasRenderType(),u=e.getDecodeType(),p=e.getDemuxType(),f=e.getStreamType(),m=e.getAudioEngineType();let g=e.getRecordingDuration(),y=e.getRecordingByteLength();const A=e.isAudioPlaybackRateSpeed(),b=e.videoIframeIntervalTs;g=Mo(g),y=vo(y);const v=e.isPlayback()?"录播":"直播";let _=i.isDropping;const S=e._opt.useMSE&&e._opt.mseDecodeAudio,E=e.control?e.control.kbpsShow:"0 KB/s",w=e.getVideoPlaybackQuality(),T=e._serverInfo||"",k=`\n
\n 播放器版本 ${s}\n
\n ${T?`\n
\n 服务器信息 ${T}\n
\n `:""}\n ${e._opt.isMulti?`\n
\n UUid ${e._opt.debugUuid}\n
\n `:""}\n ${e.isInMulti()?`\n
\n 窗口下标 ${e._opt.multiIndex}\n
\n `:""}\n ${r?`\n
\n 内存大小限制 ${vo(r.jsHeapSizeLimit)}\n
\n
\n 可使用的内存 ${vo(r.totalJSHeapSize)}\n
\n
\n 已使用的内存 ${vo(r.usedJSHeapSize)}\n
\n `:""}\n ${a?`\n
\n CPU压力情况 ${a}\n
\n `:""}\n\n ${r&&r.usedJSHeapSize>r.totalJSHeapSize?'\n
\n 可能内存泄漏 是}\n
\n ':""}\n\n
\n 播放模式 ${v}\n
\n ${e.isPlayback()?`\n
\n 播放倍率 ${e.playback.rate}倍\n
\n
\n 播放模式 ${e.playback.isUseFpsRender?"固定FPS":"动态FPS"}\n
\n ${e.playback.isUseFpsRender?`\n
\n 固定FPS ${e.video.getStreamFps()}\n
\n `:""}\n `:""}\n
\n 解封装模式 ${M[p]}\n
\n
\n 解码模式 ${u}\n
\n
\n 渲染组件 ${h}\n
\n ${h===H?`\n
\n 渲染引擎 ${c}\n
\n `:""}\n
\n 网络请求组件 ${f}\n
\n
\n 视频格式 ${n.encType||"-"}\n
\n
\n 视频(宽x高) ${n.width||"-"}x${n.height||"-"}\n
\n ${e.isPlayer()?`\n
\n 视频GOP(ms) ${b||"-"}\n
\n `:""}\n
\n 音频格式 ${wt[l.encType]||"-"}\n
\n
\n 音频引擎 ${m||"-"}\n
\n
\n 音频通道 ${l.channels||"-"}\n
\n
\n 音频采样率 ${l.sampleRate||"-"}\n
\n ${e.isPlayer()?`\n
\n 播放器初始化(ms) ${d.playTimestamp}\n
\n
\n 开始请求地址(ms) ${d.streamTimestamp}\n
\n
\n 请求响应(ms) ${d.streamResponseTimestamp}\n
\n
\n 解封装(ms) ${d.demuxTimestamp}\n
\n
\n 解码(ms) ${d.decodeTimestamp}\n
\n
\n 页面开始渲染(ms) ${d.videoTimestamp}\n
\n
\n 初始化到页面渲染(ms) ${d.allTimestamp}\n
\n ${e.recording?`\n
\n 视频录制时间 ${g}\n
\n
\n 视频录制大小 ${y}\n
\n `:""}\n `:""}\n
\n 音频码率(bit) ${i.abps}\n
\n
\n 视频码率(bit) ${i.vbps}\n
\n
\n 视频帧率(fps) ${i.fps}\n
\n
\n 视频峰值帧率(fps) ${i.maxFps}\n
\n
\n 解码帧率(fps) ${i.dfps}\n
\n
\n 音频缓冲帧 ${i.audioBuffer}\n
\n
\n 音频缓冲时长(ms) ${i.audioBufferDelayTs}\n
\n ${e.isPlayer()?`\n
\n 视频待解码帧 ${i.demuxBuffer}\n
\n `:`\n
\n 缓存时长(ms) ${i.playbackCacheDataDuration}\n
\n
\n 视频待渲染帧 ${i.playbackVideoBuffer}\n
\n
\n 视频待解码帧 ${i.demuxBuffer}\n
\n
\n 音频待解码帧 ${i.audioDemuxBuffer}\n
\n `}\n
\n 待解封装数据(byte) ${i.streamBuffer}\n
\n ${e._opt.useMSE?`\n
\n MSE缓冲时长(ms) ${i.mseDelay}\n
\n
\n MSE待解码帧 ${i.msePendingBuffer}\n
\n
\n MSE缓存时长(s) ${i.mseStore}\n
\n
\n MSE解码时间(ms) ${i.mseTs}\n
\n
\n MSE播放模式 ${i.mseDecodePlaybackRate>1?"加速":"正常"}\n
\n `:""}\n ${e._opt.useWCS?`\n
\n WCS解码间隔(ms) ${i.wcsDecodeDiffTimes}\n
\n `:""}\n ${e.isOldHls()?`
\n HLS缓冲时长(ms) ${i.hlsDelay}\n
\n `:""}\n ${e.isUseHls265()?`
\n HLS缓冲时长(ms) ${i.hlsDelay}\n
\n
\n HLS待解码帧 ${i.hlsDemuxLength}\n
\n
\n HLS待解码视频帧 ${i.hlsDemuxVideoLength}\n
\n
\n HLS待解码音频帧 ${i.hlsDemuxAudioLength}\n
\n `:""}\n ${e.isPlayer()&&w?`\n
\n Video已渲染帧 ${w.renderedVideoFrames}\n
\n
\n Video已丢弃帧 ${w.droppedVideoFrames}\n
\n `:""}\n ${e.isPlayer()?`\n
\n 网络延迟(ms) ${i.netBuf}\n
\n
\n 缓冲时长(ms) ${i.buf}\n
\n
\n 最新缓冲时长(ms) ${i.pushLatestDelay}\n
\n `:""}\n ${e._opt.useMSE||e.isWebrtcH264()||e.isAliyunRtc()?`\n
\n video显示时间(s) ${i.videoCurrentTime}\n
\n
\n video间隔时间(s) ${i.videoCurrentTimeDiff}\n
\n
\n videoBuffer缓存时间(ms) ${i.mseVideoBufferDelayTime}\n
\n `:""}\n
\n 视频显示时间(ms) ${i.currentPts||i.ts}\n
\n ${e._opt.hasAudio&&e.isAudioNotMute()&&ua(S)?`\n
\n 音频显示时间(ms) ${i.audioTs}\n
\n ${e._opt.hasVideo?`\n
\n 音视频同步时间戳(ms) ${i.audioSyncVideo}\n
\n `:""}\n
\n 音频播放模式 ${A?"加速":"正常"}\n
\n `:""}\n
\n 视频解码时间(ms) ${i.dts}\n
\n ${e.isPlayer()?`\n
\n 解码前-解码后延迟(ms) ${i.delayTs}\n
\n
\n 总延迟(网络+解码)(ms) ${i.totalDelayTs}\n
\n `:""}\n ${e.isPlayer()&&i.isStreamTsMoreThanLocal?'
\n 是否超过一倍率推流 是\n
\n ':""}\n ${e.isPlayer()?`\n
\n 是否播放流畅 ${i.videoSmooth}\n
\n `:""}\n ${e.isPlayer()?`\n
\n 是否在丢帧 ${_}\n
\n `:""}\n
\n 网速 ${E}\n
\n
\n 播放时长(s) ${Mo(i.pTs)}\n
\n
\n `;t.$performancePanel.insertAdjacentHTML("beforeend",k)}else t.$performancePanel.innerHTML="",to(t.$performancePanel,"display","none")})),e.on(ot.togglePerformancePanel,(e=>{to(t.$performance,"display",e?"none":"flex"),to(t.$performanceActive,"display",e?"flex":"none")})),e.on(ot.faceDetectActive,(e=>{to(t.$faceDetect,"display",e?"none":"flex"),to(t.$faceDetectActive,"display",e?"flex":"none")})),e.on(ot.objectDetectActive,(e=>{to(t.$objectDetect,"display",e?"none":"flex"),to(t.$objectDetectActive,"display",e?"flex":"none")})),e.on(ot.occlusionDetectActive,(e=>{to(t.$occlusionDetect,"display",e?"none":"flex"),to(t.$occlusionDetectActive,"display",e?"flex":"none")}))};function ac(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var s=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===i&&s.firstChild?s.insertBefore(r,s.firstChild):s.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}ac('@-webkit-keyframes rotation{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes rotation{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@-webkit-keyframes magentaPulse{0%{background-color:#630030;-webkit-box-shadow:0 0 9px #333}50%{background-color:#a9014b;-webkit-box-shadow:0 0 18px #a9014b}to{background-color:#630030;-webkit-box-shadow:0 0 9px #333}}@keyframes magentaPulse{0%{background-color:#630030;-webkit-box-shadow:0 0 9px #333}50%{background-color:#a9014b;-webkit-box-shadow:0 0 18px #a9014b}to{background-color:#630030;-webkit-box-shadow:0 0 9px #333}}.jb-pro-container video::-webkit-media-controls{display:none!important}.jb-pro-container .jb-pro-icon{cursor:pointer;width:16px;height:16px;display:inline-block}.jb-pro-container .jb-pro-ptz-controls{position:absolute;width:156px;height:156px;visibility:hidden;opacity:0;border-radius:78px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE4BAMAAAA9UfJZAAAAMFBMVEUAAABHcEy0tLRZWVmysrKoqKi1tbWvr6+2traBgYG1tbWWlpa1tbW1tbVUVFS1tbVGCHqkAAAAD3RSTlMzAO9U3LSWySp3aZcVRDUDw823AAAJYUlEQVR42u3d32sbVxYH8EPHxgg/lBsa7SBkukmpSbwLI2KbEPpgZ5MQtwmM0wRMmgdhP6RgEuwlSVnYlmGMYaEvMU1KKX4QNq0pocVmm7CYfRBaQguFpbgPKRSC/4V2LGliO+bulWKrkvVrftyZ+WbxeTRG+nDnnnNmRjP3EpMR6tMH18du/0Xj1tGz5+9cf/DUlPKx5PsTkr8s3eZ1cX7ym1zkuI/f1wTFunNt9fP+FIno7/98/tFY+Y8ffBUlLrmkl2Cr96guTv27BM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xe9oUICb49iMDTBwzXCqFuKsG2gycM1wYtaFlrCK3mTgmuJU7UzkA9cUx2bDGjpFH2FucUk9pA57onGNa4lj31uhnJzEtA+ZexxLh3KpkykwL7g4D+GUuJuPe8Kx5RCuJtJbzBuuJ/hyMmCtecSx2aBzIqaNMK+4pBHwtU7WznnGiZwI9Oykq1U2tMWxxSD7hKL3MT84VQ/wwGbzpi8c+47fCsp2kt9g/nDsp6AyNqb1Mb+4pBFQKU7bpm8cS/DjQdg+aXT/wTWOzfLL8m2DfITJwLFFS/oZQHf7CecQpxq25GqnGO0nnEMcS2iSq13WWmCycKLaHZebDDeYPBz7mb8tz3aff8Rk4tiivJQd5H1MLo5NyNIN8t6cbJw6ZV2WYys6tTnHCZ2MsRM2k8nHSdG5srnBMTXNr/qzfcYLLmyucEyd8FdR7vNeNzZ3OJZc5G967mTKu7wvx4LDMfYFtz2efMYM/o7LL3OLY080byVlULNusqBx7AeDX3B9aJWH3P6aBY8rpUX+W3e2t3SXqeAZVzq0/JyLmRe7wt0fUs849t8Jzv/u8Ngq/+K8d42FhxODp/P8VQc85VPxjzc9folXHFO/1Lh1rc3BjT0S//SeycLGCd6Sxvm51abDp8xf4dyaNL1/gw+caBhLuvj6O6v36mWn5scEPe+H5hMn4uP3hUEAr63e6y+PYX//qflHY+U/fvCVzw/3ixPD98vSbV4X5ye/yfn+aP+4MvDpg+tjZ4+K8bKOnr1z/cFTU8rH/g92biFxn2S73AAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;transition:visibility .3s,opacity .3s;right:43px;bottom:135px}.jb-pro-container .jb-pro-ptz-controls.show-vertical{right:43px}.jb-pro-container .jb-pro-ptz-controls.show-vertical .jb-pro-ptz-btns{left:0;top:156px}.jb-pro-container .jb-pro-ptz-controls.show-level{right:163px}.jb-pro-container .jb-pro-ptz-controls.show-level .jb-pro-ptz-btns{min-height:156px;left:144px;top:0;display:flex;flex-direction:column;justify-content:center}.jb-pro-container .jb-pro-ptz-controls.jb-pro-ptz-controls-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-bg-active{visibility:hidden;opacity:0;width:156px;height:156px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE4CAMAAAD4oR9YAAAAM1BMVEX///////////////////////////9HcEz///////////////////////////////////85yRS0AAAAEXRSTlO5DCgVgZBxAK2fQDRkBR5XTPLKM/gAABnnSURBVHja7F0Jkqs6DGQPO9z/tD8Jq6WWbCCvIjKfzAGmulrW3ooedr6ui+M4TdP++SXPr1l/SdL3aRrHhv7ZyA5qb9xe0L3Am+DrkzeCL/BeX908MezTuPsfOArdgl3KsZuhq99fk/Tx3waum+ByAHua5QbYilkzY1aP728YhrH5InrfBa57OLAtVjpRbYaumex04dq4APeC7vnVSfo/45bXLe33jGscMx3f0A1vyg3t69e2dRL/NeA6wrgdcCvjyPM2U25mXDt9xVD3f/qN0yi3Mm6P20S54vlXtGPS/R3GPSbYOsC4ZAvmJtiaGiL3Zlzx/Ht+Y/KXTJXbqmaqe9za1VYn3N7YpX/OVGev2qduOLIiB7xqOzGuWCiXFVmWtU3368A5lkqeOJI21I5XXaORxVRnxmUTdNnY/4U3riNvHMJts9XRtdXVUttipdzrK/4x7UyY6sK4Gbo+nU21T1zKcd9AGJetlMvyLKvj3zXVfeqQElMljINx3MK4xVQ3xj2Ry7N/6CiMOIfYyVUXWxUyBx7HuZRbcHt9bf/Lb9zsHlzKzabauJaK47iVcC7jJujS33/joKkmxDnM4QiJ4xDjZuT+DXQW3jgxV012qcPuiePhCGfchlv1/P0D6Czmqmuq2gPGkbIS8Q4ZsNU3dGP3Y2+cW1RyKpkrbAnwqhi3iXHFHrU3bFVV5c3vBsCsOALjkXErAW85F3rjFvBm5Kos+TngCOXYG7fA1ojFER7GPUHbmer0tfGPANeROM6pjvDMQSkrsWQ1d564Fbr61964TvSqDa6O0ELmAtvGuc2rrpQrn/aa/qCpYq+6mSpOVhnjWBy38u2JXFl9yL8acg6CV3Ur5yxVZfW4As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gjVT+4/EjZvdu9grnq1uVxAB1il1beEzRtBJJQICv1VMeKU93a0OzItbzq5k90RgLhl+XGCqy3ERdYrO0fftXnb2T3VqjfE5aigMbf3YANirN54co93XMjJT20rhWteP5Hrr/NbT+7xjoPMctOzJkqq6/Luk3u84+7vuGUBSzeBweoE3yPTm8Hm444LiA5gyMXuuJU56G3NR07uAXHVwwo5fgBTf1Xo2rjVnzq7r6yK1LwSr5HHHTdt9fy5k5/R7XLcJdX7FbeOy2dP7trPweQ57FRZx7r6+Mndq3ldEzrAY938ysl9uiQ1cJNVa2SO16X6tZP/dj8uDqJW2VfM/O/ftf7FmPkK3OMZ3MAu8G3T6ytiTTU7OK8jxMlfuN1idg/X91/9VUZ81WOVo8P+Bw+0DogP6NDPAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-up{transform:rotate(-90deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left{transform:rotate(180deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-down{transform:rotate(90deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left-up{transform:rotate(-135deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-right-up{transform:rotate(-45deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left-down{transform:rotate(135deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-right-down{transform:rotate(45deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-control{position:absolute;left:53px;top:53px;width:50px;height:50px;background:#fff;border-radius:50%;transition:left .3s,top .3s}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left{left:33px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-up{top:33px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right{left:73px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-down{top:73px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left-up{top:39px;left:39px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left-down{left:39px;top:67px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right-up{top:39px;left:67px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right-down{top:67px;left:67px}.jb-pro-container .jb-pro-ptz-icon{position:relative}.jb-pro-container .jb-pro-ptz-icon:hover .icon-title-tips{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-btns{display:block;position:absolute;left:0;top:156px;width:156px;box-sizing:border-box;padding:0 30px}.jb-pro-container .jb-pro-ptz-btns .jb-pro-ptz-btn{display:flex;justify-content:space-between}.jb-pro-container .jb-pro-ptz-expand .jb-pro-ptz-expand-icon{display:inline-block;width:28px;height:28px;cursor:pointer;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAANlBMVEVfX19fX19fX19fX19fX19fX19fX19HcExfX19fX19fX1/////Pz8+oqKjCwsKhoaHn5+eWlpaOqTaDAAAAC3RSTlP/3CaKxwJiAELtp4ri/s4AAACuSURBVCjPfZPREoUgCERXBdPRyv7/Z6/Z1aQp9oWJMyYLiKUrOIpAJBdGCldgbzBkPM/QEoTI3jBEPBRDhwEvChe08Q1Ge0ImvIq4Qj8ljrLdH77CyQPWlCdHC0Q1e9rmmuC+oQN9Q4LwcQg40L6eyqm0uEpXSUqe3fKpkkqL+Y/o+07SrahNEO0T0LBsvOitf4xsLqiNTB32wtqaVKosGLO2mhUrS93+PZ4D99wPqzMJVcbEyA8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-expand:hover .jb-pro-ptz-expand-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn////i4uLZ2dnIyMjExMS8vLy+iXNeAAAACnRSTlMAYomLxwEm9+NCLo6DKwAAALNJREFUKM99k9kWgyAMRIMmEMLm/39tKaVKFJkXl3sYJ4sAXeQ3ZOcYd0+gRYblFBuFLYoS2ot5lpvYn8zJQ65TO2GVNmdCmQq/qczw4gjpejD14BgmhziEIvCjVRlPioftHW6A7xBB1a8CCUMvsuSqEkPM7eZX6h8GrQ67bYpNIbRL6rb4/k2EfVXKsgmqfQrW9qnGq96a28jGQG1ky2HXpVysyYyeDIhWq7le6ua9P36HD6+2GRi8iBZBAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-narrow .jb-pro-ptz-narrow-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1/9/f2/v7/y8vLUObqxAAAADXRSTlMA3IrE6SZi9wI+y0gNXAn3CgAAAI5JREFUKM+Fk1kOwyAMBQ04bJHT3P+0JVUMNMWv8zvSk1cipfjAKXHwhR7k6KTjYp7dVuWLug1XWB5wz96T/JD2O3Phmv0k5ypL6lVVFIPYpLOka5WKSSFvS0/BloHYlkza5HkMzrvVLo8ZlRr7mtFYWBBsBQ4BjC//GTxcGVw2PpOVHQ6fJj7qS4936OoN2K4e5yE6N1UAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-narrow:hover .jb-pro-ptz-narrow-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcBAMAAACAI8KnAAAAJ1BMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn+/v7X19ckk9ihAAAACnRSTlMA9+NCAsuKJsRiPv/2GwAAAJlJREFUGNNjYAAC5gxFoTYDBijw1FoFBIumQHjsUavAYGkBmGu0CgqUwRqlYNyFIO2Fq+BAnIGBJQrBXerAwLkKCUxgYELmKjBYIXMXM2Qhc5cxdCFzVzBoIXMXMYAcsRsMdgEdgs4FKT4DBqdAitGMQrMIzRkojlRB9wKaB9G8z+CMGjgshjCuMCjoWNxRAxYt2KGRYgJiAQAnZcjElaB/xwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-aperture-far .jb-pro-ptz-aperture-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAASFBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////9fX1+kpKRzc3ODg4PFxcW1tbXW1tbk5OT29vaVlZVmZmZ8vCMFAAAADHRSTlMAxGJ5Mssm9+NCiYtiH91SAAABAklEQVQoz41T7Q6DIAyEJQooUL55/zddhVazzZjdHyqXXo8DhWCYTWqltNyN+MZLuxP69UGti/vAsl6c0e4L+tQ2yv1AEbvecMhO5cXdYhk+6aO3WGrNAMwentlMz/ZAKIlNoRsqY2wtFWu9t8wasc0iYVN0LkQfrG1zbxNyrIBcntOQrH1Ukkb60QcxYF1xMA2dh8zWj6ZDsLCsIrL4Ds5Hm9FMbCEROWUB0COaLXEIZJKV7CKybGO7UuxjxY2C/TkMbxboKBQCxgMN6MCJQ6Ch/QjOZg/B13LGx8FDTe3IFvl+Bc9XBi3UWoex68qeL/vxmdyxyvz3NJ8f9dDef36HN7koIK2LjxB0AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-aperture-far:hover .jb-pro-ptz-aperture-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAOVBMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn+/v6cnJzr6+u/v7+xsbGlpaXNzc3b29vqh7uRAAAAC3RSTlMAyRjKA59J/3PzPhe1wxwAAAD2SURBVCjPjZPrssMgCIR1mkYtisD7P+zBCyZpM5mzv5hs0M8VnZvaok9BlXzc3FXbO5z0vtifFC5Kn8OL4UfxwVvuHm61d5Z0b6ZGZZwZpQAUosWsjVZntVS1sH3ZFo1IRVYfGXgx+VGwNkkIVbhq9/jm3cAhaNv1Uk3IA8mNn7D3kbQeWK3TLH2jCthrDFcTMwUWaKiClc9mJtJWhS3SF5BpJqMQW1b3xwnkDahMoHYomkeJRgSENA/MFsKML7fgoCBVbGvM+Cx4JcKWbWHKK/h1ZYS1Jy/nK3u8bB3KhzG5deMxtfv3aO7/Heq+9ms8h9fxHP4AHzAWU9zlWNgAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-aperture-near .jb-pro-ptz-aperture-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAQlBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////9fX1+FhYWbm5vz8/Nzc3OwsLDi4uLDw8PW1tZmZmYgm6a+AAAAC3RSTlMAYmOLx4kn9+NCIVJiPGAAAAD+SURBVCjPjVPttoMgDMOJAqOU8uH7v+qKFN2c597lF5LTJg1VqQG3aGuM1bNTV0wWDtjpg3pq+IB+npyzcIE9ejsDXzDCrjccs+tOariF3n2OLyw5xko0vh9MDjNb9Q0hp2GK3cixlIApe4/JD9appR8SFxWAUFLg6n63iB1irnY1Jv0mlrok7nUdcZRa1YeshxBA9iijChlxI6iZEaBgSEL2tkRcymPGGJpqlbZ6uDg0WR/F0DwuMpxDkYwiIXA8hO2uMJdGCCK6teB8RQoY8xGfevQjxYQt25qoRwDT25MRBjZ7GtP/P/afa3LHmrflXa+ruf661Hvv+et3eAF6Fh3v+sSUGgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-aperture-near:hover .jb-pro-ptz-aperture-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEWZmZmZmZmZmZmZmZmZmZmZmZmZmZlHcEyZmZmZmZn///+qqqq9vb3z8/PMzMzo6Oja2tpXGg+mAAAACnRSTlP/JomLxwJiAONCr+rW2wAAAOtJREFUKM99U9sWhCAInEpLBS///7WLEWy7p9O8qEzCMBIOQ15DAlLYsoegS9yFMKQ93skl4Adh+ZI54Q8pG5nxgKzkgkcsk4zhmQxRyN1OPHqtncjOu5AuppcJ6s1EHTA1YzC3Wgq3YmzGqpsmlwZAo7F8oLEVKoeE6+TbSxK0JJ/3FLOwFnUxzXuoltYDDMLoAlmYXLAWIrkqbdZKs+q4KBfkNV1uwGaBim9TdLWS3R7iGRvCNTPB7JvGlc5EXK8cKbrxooint73RzXh7Msl6Oj/uT/b62O9j8sj6gMXX0Xwf6jP3Zr9DtNAHTYMMXrXSK0YAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-focus-far .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAPFBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////92dnbs7OyFhYWjo6Pe3t7Ly8uxsbG8vLyG+Q0EAAAAC3RSTlMAiWJjx9wm/0Lti7mfpe0AAADaSURBVCjPfVMJDoQgDERFC/bg8P9/XUSO6CqTqA0TptNDpSrMpC2A1btRT8wrNKzzjdo03KC3zhkLD9imbeAFhd3sG2kvZQ2v0NknfGBJZKkhBM9MxOxDKBV1N4iHi0TRHYjN01Qi7/kK2PtyNDU7DAEJgDAAN0u1jsQEFEkcVVmrqjeXrkWRmC67eqbgG7bJyvkQSQkvUvec7szpek6t9ubWJSK/uJVSm+APzHKCh++DWWuH4plQKNYOpfappcjy2VvJn9744cjGwx6uyXjBxqs5Xuqsvf/9Dj8rLhRg+bQ5VAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-focus-far:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAOVBMVEWZmZmZmZmZmZmZmZmZmZmZmZmZmZlHcEyZmZmZmZmZmZn///+xsbGoqKjt7e309PTExMTQ0NDe3t774OlGAAAAC3RSTlP/itxixwImAELtp8B2gZgAAADmSURBVCjPjZMLjsUgCEVpq60G8Lf/xQ62gvNeOmZuUiWeKHC1cKnC5iJAdFuwJXgmf+xg2g//G54OPuTOCUOEL8WgMMCLwgPP+Abj2aF38CrnBR7whw6Bo4fWUk7MMrQ2OrpAq0GspTLLgKg1wTailNITZA0EaTkZGjIAY5NwlATah5CGRMJYj50tFtlWiapsLvAPRdtL/WOmET7QzZyl5ywzp7NWsjBJ1odsragJqeJ9HGFNZoLaJw71hMTm0O7NeDE1Z6YsU5rGL69sedmXXz0ToW8PzA/oV09T8OJR32fb7+B17Qe3WwtC9PVbHAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-focus-near .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAARVBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1/////t7e2dnZ3W1tbGxsa3t7eDg4Oqqqri4uKTk5NImu/5AAAADXRSTlMAYieJ3MvE/0Lti4oh87zNagAAAOtJREFUKM+NU1sOwyAMY30FtoWS8Lj/UZe2gWpVh2aJH1wcO0mNqbDj4gDc8rLmiscEDdPji3rP8IX5fXLWwQWuaVu4gbKDuyPdsJMz3GLefcIPbJ6PDCEAFDlUAJiORM3NigQFAXAFlqOeRhWJyFFIHxNGvRrN0mp470U++3axGM2RAmXcXqKnkDSN0a9WIk5Sa01MpDXBQAdVtrA8lBhFnnKpsmoo5VBrhszV0KuJ5N2tP92O50iQjpzcctravoihdoi0Q1NrfN56m0VWzFBoje+OrD/s7pr0F0yUr6s5/LvUu/bz+B2ep+IHdMIV2SUZfCsAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-focus-near:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAQlBMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn////c3Nz09PTp6enR0dHFxcW7u7uwsLAUKT0cAAAADXRSTlMA3IrE6WIm9wI+y0gNQZpqdwAAAOdJREFUKM99U9GShCAMQ8BF3Cmlpfz/r15dAe88l8zwQiQkoRrTEa3zIXhno7lhWxcYWNbtN/fa4Q/218VFDzf4of0O8A/h3TQfOGU/ytsOj9gPVyt8warkmYEQQAgABYDxTKROz88koS6AVIB1fRCNbSI1cVUy15Jq27LGjTtyzipPeWw40/IXQkrHyZSRmqw3LaQgctFNKYzYyGACfEXossLMojFEj7J0WfdwJ3dD9uY2X25tL0Hj45mTR87Y66u9IQFsDS1bL57o7JbUDNIofvpk08eej8kTe3Hz0ZwP9UFfv8OgfgBUByCEUZhYtAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-cruise-play .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJWSURBVHgBtZe/b9pAFMefbSYWMjCjdOtmYEYqXVC3umMlBFRiT7qxkexITcdKSDUSYna2iqX+E/DG6LCQgcETUiR+5Pv8I3Kc+McF5ysZ3x2++9x79/zuLFEG9Xq9s/1+r8my/AnVJq4z/2LZfB0Oh1tFUQxd1+208aQ0GAa7kCTpMgRJk4kJXk+nU5NEoe12W8PM/wrAotIx2Z+w3MkE7XQ6Q3S4otNlY5zPUZdL7wiMBUsRIK/fDeWvhQ92XS0HrQia83cCsqoIyMug8gQ9Ho/DpF7FYpEajQa9VTBoyIZxWeEfv6IndSqVSjQYDKhcLtNqtaLtdkuigmGSZVn/XKiqqr9wqyZ1YEtbrRZVKhX3zvX1ei0Eh7Ufa7Xan8C9VRIUg9lyQZfzO19VOOugkBpAgaXRtnq97oLZ5ZvNJm0YQkBZ8m63E7YyKl5ntrrf77vlJCF/qzLlKLZ4NBqRpmmuF2LBlLOyBFYBchDKlIeWyyWNx+PUtS2Qtx+eJA6i2WzmQtMEA+8KnA+73a6N+jkJil1pGAbN5/PMfRBIZsGn3+LFvSABMYiBgpnJgZEeFHQD4EzQrOsWI4N/nrY2uPg/eeefV8WvAKfALOsWJ3jzA++rcqjhB25OXAd244nA62AjV4LGxWLhIBk/oPiF8pc9mUy+BZVnyQEzueEZUb5yjyvhBiX6BCw2YTGvdZNyAkYPZsprT/rgO/K2vDcdQQH7jes7gPcv/kvqyCcKbEVX6PxVAG76QWPGPZAIDcEZqGECTQyokpe9wp8VfNqzyA2L9M+KRzm19l1i6ZQBAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-cruise-play:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJ5SURBVHgBtZe7buJAFIYPjsVFAok3wBUlYcUDLNvQISUSDVVCA0IUYZ8gmzcgBeIiJLwdFau8QToaQKygovI20CJBARKX/Y/jICPAF3B+yRpjZvzNOWfOzLGLLKrZbAaXy+WdKIq32+1WcrlcQe0vZb1e/8XvQT6ff7fyLpdZh0qlEr+5uXne7XZxMpciCIKMSfzGBBSyCwVMAqxpEXYEhzdeAJYtQ2u12h2aJq4gXadSLpf7aQptNBoPm81GJofEsc5ms9/0zwT9j3K5HHUSyEJ4ovV6vXkSyjHEyvxDXyCAHxGy4hEUq+4JjWQ02O/30xV65rTbQ9lKNEWjEYFAgFKpFMViMbpQnOfFPRSKWxnldrtVaDqdpnA4THalefMDinx8sDOYrY7H45RIJOy6PMibjch3F24AJEmSeo3HY+p2u7RYLEzHwNqogOUcpSvFrk4mk5Zcjry9FZCX1+46qj5dzvEOhUKGfQVyWAyPRCLqojsnEYtohpiSE5rP59TpdEhRFMN+Itw7Q3DpGq1WKxqNRurF90YC75+gnXszulBsVbvdpl6vZwpkwasDNWVw9r3BWlu5Op1OVdBkMrEzTD11RO1exmUJytb0+30aDodkV7DyjT2rBpNrG8zg3WwQW9ZqtS4CatASt/sVhAC/GA3glWk1bqcEo+TPwm0P5QeYySt9jRS9UQe54vF4fqEZkMNCdXivrw4PoJlMZoad5IeDYE7F+0KhcPC+syVotVotIQ5PdLm4CD8CGkJZfAIhzlw3SWRdM+T9q9frLbHnTnUwrfBZfPCiecQG8v3MBHj/HvAm4/P55HMwW1C9tG8a/RmsGH1CnNJ/17UakVMOx7kAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-cruise-pause .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHySURBVHgBxZc7bsJAEIbHdprQJAU1ckln3FM4J4jTIkSMRB9uQDhBlBPECIk2yQ1MSeeIxg0KZQoKKpSCR/4xtsXTNmA7v2ThHe/ut7M7O7sIFEOGYdzO5/OSJEn3KGp4ZDy33ucxP6vVqo86H71ez47qT4iCLZfLJ0EQmhuQKNlo89rtdk06FVqtVjV49kZrr86RicG2TdMcx4LWarUWGjzT5Rqjn7tdsJAi8Ch4C4op1TGl75S8GKwCPOWC6FsRNDKAL5SOZER30HcAhbFFEUFTLBapXC5v2fL5/J7tiOCXofHLlVfikRhRrSqVChUKBXIchyaTiWtrNBruYLjM9jB5jlmup4vFQqMYyuVydKE03vsuVBTFR8pIcFD317REGQlRXBJ5PSl+iktCskgZC57eZA5l/Q/Uy4lTykjYq1++p5EHb1LC9rRdKA7dT8pO64yERG/SmVM8m81OqW7yckr8Ztv2r6Io1whnLawF59fhcLiVY0ejkWsfDAYUJfRfB+snOE85J2KRvym9RGF2Op06vwRbhg9YHgmlIz7E235B2vwC1x1VVdl7jZLT3nVF2q0BsJUg+ODFTDpU0wP3PfC5a2wB+BD7CuqLgws/TQQYn7cyxYfxfdc6ViEUujMAHUlER4cKHfhbATvPjBUG8/UH1xXJDxHoYGQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-cruise-pause:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAH/SURBVHgBxVY7bsJAEJ01CAkJKUhUULmiDSnpoKYINyBuQIgi3AA4QZQKIQq4QaChhhuQCxAXSERUSDSIb944axSS+CPA5kn27o7X+2Z2dz6CXKDT6URXq1UqGAw+Hg6HDB4V4qj8rAsh9N1uN9rv971KpTJ2Wk84kW2322csVv1BYr+gEGMo8Foul7uWc6w+NJvNjKIoHXRVOgMg74K8AXLdFWm73a7BujpdDh3rZH8TCw8JLYlPSFutVh7NG10feigUetA0bcEDxZTiDFU0L+QN1M1mc1z7SBoIBGrkcGkSiQQlk8kTWSQS+SP7D3CzJ76c3A/yi61kodOP6XSaYrEYzWYzWi6XhiybzVI8HjfGLLeDNGxoWpohF8C50CXgwMK+r0gNCuQTENnyitQgRT4BQSOlyFvrKsRdCapC/uPuFqR0G1IZExfkH94NSzkHkk+Ap4wNUiTqPvmH74gUDoe7dOYWr9dr13M5sfNxBnjQ7/dXuVwuDGHG7ieOr9Pp9CTGzudzQz6ZTMgJ2FFtMBh8HvMpx0Ro/UEeBQq2slgsatw/uoxMsBp5A64WG+bgxE9LpVIPpUWDrgv7csUE4nEdlWCNPCC0JJXEF5Wg8MchHs11CWpCVvZVkBfckksyrneHVnMEuQRXitiqPBS4lwpEJYmORkc7Qju0IzPxBZ2t+3mW/JtqAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-fog-open .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAKgSURBVHgBtZe/jtpAEMYH28WJioIa+URDF8MTkAalO6cH4YIiFbk8QXS8QO6oUlCAkGjDtTRHJBoa4nQ0KBZdJApoEAV/Mp9jkAF7bXPcJ5ndtdf725nZWdYxiijDMBKr1SqhKIqKNpdms9mcRxkjFqZTsVjMy7J8x1WdL9WjC6D97Xb73G63m0HjxULAvnI1T+FlMfxBBPeEwoW73Q6we7pcViwWe8+utwKhDFQZ+IOrGr1eAH9ksOkLdSz8Rd5xu1RzBmfdFkvupwz8dmUgBENeYNAZtFQqGVwY9DZSnTVi6+Decrn8h0JYWSgUKJfLHdrL5ZKm0ykNBgOazWbCd9nNt3CzgoZjpUohlEqlKJPJHN3DJHRdp16vR51Ox/ddTiVkw70NlSTp7rRDMpmkWq1G4/HYvmANSpHghXg8To1Gw/M5W1oGVEZD07TvXNy4O8Btw+GQFouFbV06nabRaGRbhbaf8AzvTiYTr8c32Wz2p8KrSuMgJ7x6IEa4AIuivau9tNlsNGm9XqsBY9gxhOvCCi728wa7OCHhRzQAZl2pVGyXRZEoBAoFCDGs1+v2QooiUfpIHE+LBEL+VatVezVfDcp/whYJhAWBVHFvCEFCfz8op6cpORuxJRokajz98tSRae+97OJnUS/RanQLkwNQ4FrzsA2yyU0Gf/br2e12A90LlwYAkS5Pdrm/wRs+/rh1ChAshuV7wTqAQoTAarVat6gorll8YWvzXBXmbdTUcY3/sK/L+4ppmnPeF/9SCGsvAXIsH8+gDthkMFyepyuJgS0GHh3w5NNOzO0zeMHVD/R64BMDP53d93vBORW+0GVnpvmpS0NBXXDDSacwR9K5kxaPok+NUJ8VDlzlQucJvKNj63G2/U3/E78fZqx/rk0w4ggu8jUAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-fog-open:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAK2SURBVHgBtVa9jtpAEB58/EqArqCBBqehorgTVDQxPVJOiD5QAEJUeYLjniBcgRACKeQJQsQDBBoqkIigookraC1BwT+ZcQBBsNd7Ovgk2LV3vd/M7PyZgBPlclnc7XZPFovFv91uRZPJdL9fktfr9W987udyuRbPWSajDUgm3d3dPSOhBMaQUaAXu93eSKVSCryVtFQqPaBWXznJNMlR8zo3aa1W+7zZbIo4vYd3QBCEQjqdfjEkrVarzyhlAa4EvOt6JpNJ6ZJWKpUnHH7A9VHMZrNfLkjJO9Ecv3Aqwg2A1osevFs4vCQP5SF0Op3g9XrPflar1egzut9vCNVHzPS3j8EkcCAcDkMgELh4PxqNoNvtwmw20/tUXC6XSRyLqqZ7LS80CgaDqiY8IEESiQSIoqi7B53qE40qqVYsolTgdrshEokAeh9IkgRGIDPTPhJYC8SD4eg3k52RQNQi7XQ66txms+kepEUcjUah2Wxqrq9Wq6h5Pp8/4CUzD1osFuqPFwfnIsE1IBKbyDqANIzFYhCPx+EtYPmCGQxAppJlGQaDAVwLaFlBgRtAx7T/SNGNZWCg1WqpoeP3+4EX0+kUJpOJNiEqKWA49HGusA6gwPd4PMCLXq+nu4bpsK+6LVV9YMDlcqnkPKD7JyF1oFD+PSSHV9ZB4/EYQqEQGGE4HEK73dZdR+Ua6nh4gWXtD3AkfCL3+XzHZ4pfyrekIQnHApr2A2oqn4YM1TvDWkr3xbozPVAxJ0KaH1MRFllSvQG3gYztz7FtOct/mLqorZDhulD2BVzWJKW2kTZckVjBnviM8IKUQBtQ40ck/w7vAIUhnvGYz+cvwpHZbGNHkcQMwtXGnICs9YrCF/Q2GHb4e3IJBxLgo44ACsY6afbT4XDUWd09N+kpqOhTDT55Jf9/Z0b4C/UJLQCcLGi1AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-fog-close .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIjSURBVHgBtZe9UsJAEMc3l1Q0WvAA2NEp1MyInVbGnoE8AVrSqW+gT2CY4QGwpTEFNcaOEqksKKiYcYYP/xsSJoRwx8f5n7nRu9u73+7lbu8waAc5jnM6m81sIcQlqhcoOZTTsHvAZT6fv5um2XZdd6Caz1DBMNm9YRgPMYhKHhx8brVaHu0LrVQqNjx/2wOWlAtnn9MiT4VWq9VHDHii4zXAPFdJsPGPwK1gIwHk7/dC+sXgAsBjroioFZsmpznCuHKLxeIxqqwirdVqvGmcbaOy2SyVSqW1tuFwGJTRaES7CEGd8TJbXOEo4YkjG8BQ27ZT+7rdLrXbbSUcx4+P3oOIVQ4Wr0Cj0aBMJiO1Q6Q1PvsirFzSkeKVqNfrKjM+8xeCybRMbUcrn88HRSasqs2R5kijisWitB+reiKm0+mhaS5VvMwqCdIs1WYKoJZljUmj+NwqobS8D7Wp1+tJ+5EPvkWYD33SIE4S/X5faoOHgCdC+jsdKc5GnJUUGiNIzwrpbjwh76tOpxMAJ5OJyjTwKp7wP/CnvM06LeFzdPwNd4AFihL+Chom/U86/HmiAr4CGOR4M2r0fX9cKBR+8e816deg2WzeRJW15ABPXvgxRXoVPFfiDWbSAhF7iJiXvUyagMmHmZlmGYK/aXn7HPSNAWui3AH4s9EnG8ibiy94DL6l3W8jL3zvetsMpNCEAw4cKGPCc9r8WeGj/YuBMlikP+yn3EGZYjlWAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-fog-close:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAI5SURBVHgBxZZLjtpAEIbLjUFih8QFnBUrJCIOEHOCROIACStALBhOMMwJMlkgBCyYnCDMCUJWrJCQYB+zBwkJFiBe+QvZyEz86IEezSc1dj/w76pyV5dGEnS73cR6vf4SiUQ+HY9HE0MJu5GmaSNcFrvd7hn3vXK5bIU9TwsTw8Oqh8PhzhGRoIf1tSBxX9F2u12FVfVXiL3ksVgs1khWtNVqfcfljm7HgtW5l1Zrbyh4Fo7FYh8LhcLCGRDu2U6nc69YkDG22+0v98DZ0mazaQgh/tLbUUOMHy9E8eH8treDJ8lkkgzDuBibz+c0m81otVqRBAu4+QO7WecerDSDBB3RbDbrOTcej2kwGFAIvNc5dPVTTLHpv9INpNNpyufzBEsC1yF81dOVf8KslCHIEy4SjUYjIxDLDDoGKYAtDrNW13VT7Pf7azOOJ6lUKnAeySLB7jVIIezmMAS9A/igxIIUwns3VBQ+HpFCLMsKnGcjhX0CKLF2MpnQcrkMXIPzuX+KKax9phthtw6Hw7BlVqVSGel25wntqqy02WxOFnLj+xB6/HNTwmdXTqdTGTHmfKA7lhKSxAOCbPr9g90n82X6AcGfTgVxUTngtKlD+J4UAw/2S6VSzulfJAe8SZ3fiNRiQbTgHvgvI0H4Gxb9IAVwTexVmHmmQbiCD1suHy26En7xaDSa86p/A4ttrpuIT3ohpLcTxw/tAWJ9vzUaSWCLm3DXZzS+z7hELFzYjX/i8fiTu9T04x9LgQk+PbvDKQAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-wiper-open .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAALxSURBVHgBtVYrrBpBFJ0FFAqBqCIrUXRBk5QaUleewBBIlwSDoW1CUlzz0CSlaJJHA8FgqMBg4CWIKkpRuEfQCDAYAvSeYYfsLgss6fYkk5ndmXvP/c1HYjaQTqdjbrf7PQ0VarLWgBW1Cdput3tutVrdW7qka5OZTEZ1uVwfaBhj9jDf7/ePzWazwe4hVFVVPhwOT3cQnRFLkvS20WjMzRMuCzKFyH7/AxkAg18oQp/ME24LsgENfcwBkJfvQqHQejqd/jr905HJGpnMHIYW3iHGp5AS2df/QabpfiKHfCdCVCN1qh1hv9/PIpEIi0ajLBgMskAgcDZfKBTMYjJVL8+nh7MeS/8ioFiQbDYbtlgseA/lXq+Xt9lsxrrdLkulUmw8Hp/poLB+JC+rkpa7FysiKEokEpyo3+/zBiIrr2EU1kKmWCxariMvsy46IRJWZFBSLpf5GApgvZUSYLlcstFoxMfwHnKQN4Mi+cYdDoe/IGpmslKpxJV0Oh223W7ZLcTjcb6uVqtxLxFayJtkfSga2Sycy+X4YnhlBzAQhGI9euTRqnhAaNjkKA5Unl0yALlD0SC0Au12m/fIvx5nRxsEYV2lUrHMgxmiYMwGwmiE1qzDrSiKSv0r8QMxF2Wdz+fZer3mhXAJCP9gMOCGAiBJJpM8h6jqXq9nWO+hLfGH9ohiVoTFIEbxwFqECMoQInwLy4V3mEMe0SB7YWtMJJzoVK7fLnkgKg65BVBM8Bj5gjHwDORoGNfrdUMu9SDnfl7d+HqAEArFCYNQYoxtAODfJSIBimTWpV2Swxt8PLwiRAgjGrwXuEVGmBNXw6MxP5KXMWYTCKs4U+2COH6g59tCu6uG7A7AYxteCcypVU+EmgVZbcJxkO4HcmplIEQuMcGOTz8nyT6T7on4Npw0mMBzgDnkqUZWNfyzWujQM/FB79lVQh2xeudbZ0VE36mvipzdRagjjtFtnSBlr9nxuS9uGCidk1HPdFp1xcvsGv4CcbeEIeSIw9MAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-wiper-open:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAM0SURBVHgBtVa/SyNREJ7dBLVQELU4bdwrtFJOUCxsXEG0Ue4OK6tLKhEb/QsO/4LzChVtvGvE0sPOxtiYJuFyJBBICtOlSSAQCEnIj5tvyC676ybZYPLB4y373ptv5puZt6uQB1xeXup+v/9zs9lc4qHxK621VFAUJYbRaDSeDw4O7rvZUroQBXw+3zcm0ckbMkx8enh4+It6IWQijYlueiByI95g4oxzQXW+OD8/X1JV9e87yACNbbxeXV0dOxcUJxnn6okfx6l/OOHcnr0hhIzsFcg06jNa8obwbErKOfs+CDIhUdUbxrhJiGrknAW8HB4bGyNN02h+fp6mp6dpcnLStj46OkpbW1vOY1q5XJZ8iqTX19dPnYpkZmZGSObm5qharVI+n5cZ5ENDQzKy2SxFIhFaW1ujTCZDqVTKaabA+z4qrdy9uhHB0PLyskSTSCRkVCoV16gRLfYODw/T7e2tOOQE5zKocmRf3Mggzd7eHvEtQnd3dxSNRl3JgGKxaEaE6HEO553gOllXuQ3W3ch2d3fFyMvLS1siKxYXF0XWh4cHOYfzUMgKpE1t3Y026LouhxCVF8DBhYUFcz9m5HF7e9u5VUOV2pp8dnaWpqamPJMBKysrEh2kNRAOh2VG/q14c7XhILzb3993zYMT2IOCcTo4MTEhkqKgrPCx1gGePxgv6vW6EKJYNjc3qVQqSSG0A+RPJpPiKACS1dVVaQ9UdSwWs+33c6n+47ZYchqKx+NCvLOzI80NiWAMEkFyeM75lx5FdFhD4SCXIEJluxRbTLm4uDjmcv3RLgIYgrfILZBOpymXy0m+UImIDLLCATyHQiFbLq1gB/90bHwrcNPAILwGAaREcz8+Pso6CNsRGZDGx0eS8xXqRgh5DYkgIwZuFQPdyGACfwJ+PHGhnHKUOnkEetS4U72Co/uNWdoC3yovUVqBiD1EZW4fGRk5MwkBjjKIBRoAarXa12AwWLARIpdY4McC9RcnR0dHZjPabhosMOkG9S9S2/8MMLDfRKhljawjoYU4wNXby79OgavxJwrEyFlPhBZinasYH+pPPOMaNL4wMJphJZ553Bt/Zp3wHwTYnvHjbDCuAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-wiper-close .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANOSURBVHgBtVc9TCJBFB52r7jYyCXWnhcbO1aru8RErjGXWBxX2BijGG1svNhJo56VhQU2ViQsgdDQYEFDc5rQ0BDoaMgRGhoKaMhdCHDve+6QZVhgMfglm9mdn/e9v3kz6xEusL+/79c0bcvj8fjpc8V6gCY9VXqK3W73MZFIpN3I80wj03X9il79wh2q/X7fJAXvTdNszkQaDAZXaHF0BrIRcvLKERE/OQ3qYwh/06shXg8vRPl8PlEqlZ4nktoIV8QcgBxwItbfitBOvL6+XioWi2XZp8kXIryaN6FNdpSM8spvthRWUmPaJ25vb4vV1VVRqVSGBCwtLYm1tTUeW1hY4KfVak2hFe+J+B+5+QkfnL2Hh4fI1KAq/OLiQlxeXorl5WWxsbEhNjc3RbvdFrVajVvMkcTlclmk02nRaDTGETfJ1Z+wlTxWLP84zQoEAkwEodlslh+QqZDWY36hUGByp3m9Xu88Ho+HNaokfidCCAIh2kgkMlYQAOtyuZy4vb1lBW9ubnidCioa37klkw0nQrgWgpLJJMfXDUAOBbEO66GAAkOS+tSRk5MTXgjr4FIAMXULrIObz87O1CHv8fHxR03thXAkDhbahezt7TlpzkA8sc7uUngIQIhUgNRr70AWQsu7u7uBEPTBdaqboQTcCIUgXL4DUBzjTrHVDcP4BmVlR6fTYVLg9PSU9yC2CIghEG7HHIC2GluJOGYyGR6DYiDCGEKD/iErNS2sU238QnH9rGqDopDP5zm+EIJ3aL6zs8NEUAKCQSiVwxp4BFaHQqGRwkJoRqPRkEZ7tCjGAAJQHED28PDAVkirsX1kUcAc7FEXWc5c7+iQTltnpyMgHNYgUSSZBL5BhqTBHkVMAZnxKsijMbQ6Vf+/FFe/mFLs6/X6IJZ20t3dXXb34uIihwFuTqVSI3Mt0nPia3LtpVLot461V0FWLiiBZwzMWCx2xOSy5+DgIEya/BRvA1xfvlKxr+JjUBwola/Fy81u7iDCX5JwiJSPHNJm3sQWoTnUp06a57XFIrxW+0dug8guutM8EvEHpxPIJRDDH6qFA2UmrSSrg0SO5HJLjhDdUxue+bLtQG7QqR8ggVvC4beCFHumRMSxVJxEJvEfnFm91YrgD/sAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-wiper-close:h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OiwMXOvYpvwJA02KOILwS3FoGuoTTlWDKMJJUQ4qwfDmoyAwMDkkiYIBIOsS2iJH7k7MW1JPu3VpbUyYWVw91u4oWtcjyjOSi0tLQU54bvVBnh+vKJry82PnKHAydFDI1UATFwTgHzoIgtZvPW4Cxw1VlX0YtZFhjT6wvOXrgBK+ZnjcqXimHMrbHUZXuSV43kCpE3IUTzvPfjr75s61pYWAgx/Ctndy9/WlxaCsKPzZs+xc8Ww9IvwZT+A8hTw5fcMmXrAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-arrow{cursor:pointer;position:absolute;width:0;height:0}.jb-pro-container .jb-pro-ptz-arrow-up{left:71px;top:15px;border:7px solid transparent;border-bottom:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right{top:71px;right:15px;border:7px solid transparent;border-left:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left{left:15px;top:71px;border:7px solid transparent;border-right:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-down{left:71px;bottom:15px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left-up{transform:rotate(45deg);left:32px;top:33px;border:7px solid transparent;border-right:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right-up{transform:rotate(-45deg);right:32px;top:33px;border:7px solid transparent;border-left:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left-down{transform:rotate(45deg);left:32px;bottom:33px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right-down{transform:rotate(-45deg);right:32px;bottom:33px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-loading-bg{display:none}.jb-pro-container .jb-pro-loading-bg,.jb-pro-container .jb-pro-poster{position:absolute;z-index:10;left:0;top:0;right:0;bottom:0;height:100%;width:100%;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jb-pro-container .jb-pro-play-big{position:absolute;display:none;height:100%;width:100%;z-index:1;background:rgba(0,0,0,.4)}.jb-pro-container .jb-pro-play-big:after{cursor:pointer;content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;width:48px;height:48px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzMzMzMzMzNzc3MzMzPz8/Nzc3MzMzMzMzMzMzMzMzLVn6fAAAACnRSTlMA+duduRUwSGSD8toSsAAAAI9JREFUOMvV07ENgzAQhWG3lLSp6MwCViYIRSpG8AiM4FWMaPymDBKESMF/cQ0S136F353vnLuo3gp1kOYEoCXW4LFKIZAnqAXYICeASoAdzgG+cApwgF4EfwF+oDkCqIwA6gnyAKA8AaizQhsBAjzuqUHofInGIQbjRxXjMrTJuHDestR4Bng4eGrN0929PqNfzC6h06weAAAAAElFTkSuQmCC");background-repeat:no-repeat;background-position:50%}.jb-pro-container .jb-pro-play-big:hover:after{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEz///////////////////////////////////////////8Uel1nAAAAC3RSTlMA+rbVFUecgC7rYhEEz+4AAACbSURBVDjL1dMhDsJAEIXhdeiGpKYWQVKDWc8ReojFc4ReAlPFFQazad7lIGkb0jK/WEPSsZ+YN5mZEP5UrZIP0vgE0Kv3oPlIJlAk8AJM4ASYwAkww2+ABfQg0ImgugPYsfNBVl99kA0AsjOArAPQpRTGHiBB8whxM0y+3skXNltsvMYriIWrpWPA80mFJ5qL3gAfB1/tcAt7rzdiV+HEgs1oBgAAAABJRU5ErkJggg==")}.jb-pro-container .jb-pro-recording{display:none;position:absolute;box-sizing:border-box;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:101px;height:20px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jb-pro-container .jb-pro-recording .jb-pro-recording-red-point{width:8px;height:8px;background:#ff1f1f;border-radius:50%;-webkit-animation:magentaPulse 1s linear infinite;animation:magentaPulse 1s linear infinite}.jb-pro-container .jb-pro-recording .jb-pro-recording-time{font-size:14px;font-weight:500;color:#ddd}.jb-pro-container .jb-pro-recording .jb-pro-recording-stop{height:100%}.jb-pro-container .jb-pro-recording .jb-pro-icon-recordStop{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-zoom-controls{display:none;position:absolute;box-sizing:border-box;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:156px;height:30px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jb-pro-container .jb-pro-zoom-controls .jb-pro-icon{vertical-align:top}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-narrow{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-tips{font-size:14px;font-weight:500;color:#ddd}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-expand,.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-stop2{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-loading{display:none;flex-direction:column;justify-content:center;align-items:center;position:absolute;z-index:20;left:0;top:0;right:0;bottom:0;width:100%;height:100%;pointer-events:none}.jb-pro-container .jb-pro-loading-text{line-height:20px;font-size:13px;color:#fff;margin-top:10px}.jb-pro-container .jb-pro-controls{background-color:#161616;box-sizing:border-box;display:flex;flex-direction:column;justify-content:flex-end;position:absolute;z-index:40;left:0;right:0;bottom:0;height:38px;width:100%;padding-left:13px;padding-right:13px;font-size:14px;color:#fff;opacity:0;visibility:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none}.jb-pro-container .jb-pro-controls .jb-pro-controls-item{position:relative;display:flex;justify-content:center;padding:0 8px}.jb-pro-container .jb-pro-controls .jb-pro-controls-item:hover .icon-title-tips{visibility:visible;opacity:1}.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-face,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-face-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-fullscreen,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-fullscreen-exit,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-icon-audio,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-microphone-close,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-object,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-object-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-occlusion,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-occlusion-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-pause,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-performance,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-performance-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-play,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-ptz,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-ptz-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-quality-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-record,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-record-stop,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-scale-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-screenshot,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-speed-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-template-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-volume,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-zoom,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-zoom-stop{display:none}.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-speed{padding:0}.jb-pro-container .jb-pro-controls .jb-pro-controls-item-html{position:relative;display:none;justify-content:center}.jb-pro-container .jb-pro-controls .jb-pro-playback-control-time{position:relative;justify-content:center;padding:0 8px}.jb-pro-container .jb-pro-controls .jb-pro-icon-audio,.jb-pro-container .jb-pro-controls .jb-pro-icon-mute{z-index:1}.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom{display:flex;justify-content:space-between;height:100%}.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-left,.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-right{display:flex;align-items:center}.jb-pro-container.jb-pro-controls-show .jb-pro-controls{opacity:1;visibility:visible}.jb-pro-container.jb-pro-controls-show-auto-hide .jb-pro-controls{opacity:.8;visibility:visible;display:none}.jb-pro-container.jb-pro-hide-cursor *{cursor:none!important}.jb-pro-container .jb-pro-icon-loading{width:50px;height:50px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8BAMAAADI0sRBAAAAIVBMVEVHcEx4eHh4eHh4eHh4eHh3d3d4eHh4eHh4eHh4eHh4eHiqaCaRAAAACnRSTlMAikwX3CxpwZ7zIGi5xgAAAZ9JREFUOMt9lb9Lw0AUx2Njqm4iGEqmEnBxslKUdhJctFMVcW5wKZ0CLpJJQRw6iVqQbg3FtPdX+l5+XHJ3796bQj557773fe8ujtOI+6jz5p84dHjTkYD4+RhT9CIRZWRPJr1bChnbY532GhT4oUpbI6HEuqvgIH9544dh9J4/rpr0Ms8oV3zMNT7X1MXSmaznzfHjM4n72moe5n8ryYrW9rKRvgf0S93JA7yKa9lbzUg3keJb8OVCtwkrFmoO4MnsAuj5rGqnZg+GZXUXkl9NjEui9n3YA9XgpMgakLXz6ujMTIgrCkPVv0Jil8KgKQN/wRN69hLcb1vrbR2nQkxwiZTGQ5Teb7TO8PUaS8Q03sE+zkjP8qbjzgJtEhRbV4gnlkOFeM7hDYNdxPbiYFvKSHN6L2NmY5WzMYPtplZdTxncRvn2sI+DHIoug22jWMaA12Y7BrXzrG8BX32XPMDKWVzw1bdMOnH1KNqNi8toqn7JGumZnStXLi0e4tcP6R3I635Nc/mzsMxl9aux9b78UVmn2pve8u6eR50j9c0/ywzyVl5+z84AAAAASUVORK5CYII=");background-position:50%;background-repeat:no-repeat;background-size:100% 100%;-webkit-animation-name:rotation;animation-name:rotation;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-timing-function:linear;animation-timing-function:linear;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.jb-pro-container .jb-pro-icon-screenshot{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEzMzMzMzMzMzMzMzMzNzc3MzMzMzMzNzc3Nzc3MzMzMzMwv5ahDAAAAC3RSTlMAW+8S2UGVwyyZnOTRhEMAAAEfSURBVDjLzZKxbsJADIYdBQpsSCyVMlXAdEuQYGKpWFk6dWHJgsQ7sMDSpUv3PgITAQT0f7ly57ucQ45KXRAZot+/89k+X4ju9KzL4XOhlm3pR0enYrWViSRPXQIQSASkRSkIJEFRimYCuQAHSW89IOv6SH5TCsuAj68Ab1wDzqkAzqoC7AUAPtgsABgkBBgkCJiNHehGok//KRVsHqd+3Dj1/vukt3AH/Jj05s5/AmyZhFVWXDls44iVvfQWkCvgxU6g9ZdJfCLvjJbYaT3GvjOY4mQSG3SJGjhr/Y1Xohp+TGKqqzexZ/1GVGdNCitt6R8zVvb9d+JmKdl8o5sPWbtxT6zFuJcDQtk92MNmYiXHquYlZlVt1j4P6cd7fgHFW7Nhqu29TwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-screenshot:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEVHcEz////////////////////////////////////////////////////////NXt0CAAAADnRSTlMAWe+X2TINXUYZvctoYyuS2NgAAAEVSURBVDjLzZKhDsJADIZLCAsEg8WgEGCWGSwCgZxB4MgEAonB8wQEXoBH4BEWXgPJgEBG0mdgR3u77raRYAgnlq+9+/t3TQF+dKbZcJXSYSnzlViT457lRScKmBqILSFA3GoO8S4E+Ex5JiSJ4CbVdyOQdZNomX9D4dl+ko3NC8vFFmhPy8FIsi0ZlwLBW/LY5BxYYreUSgoFAEmhB5Rc9OCbUoXmTmDadQKTn4y6A/XTaoSKdb6KyGU6RJ7eHgpb3ABinAoil303xB6vQnRahNhXvMdre+fzOgxVrokX4jHAnBh8PALU8Eq8BqgTg/vePF8tpuPy9/NFaalSc273RizarYqfkswjifNMQ/TyTGMv4v87L+ks5gqDbc9OAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-play{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzMzMzMzMzNzc3MzMzPz8/Nzc3MzMzMzMzMzMzMzMzLVn6fAAAACnRSTlMA+duduRUwSGSD8toSsAAAAI9JREFUOMvV07ENgzAQhWG3lLSp6MwCViYIRSpG8AiM4FWMaPymDBKESMF/cQ0S136F353vnLuo3gp1kOYEoCXW4LFKIZAnqAXYICeASoAdzgG+cApwgF4EfwF+oDkCqIwA6gnyAKA8AaizQhsBAjzuqUHofInGIQbjRxXjMrTJuHDestR4Bng4eGrN0929PqNfzC6h06weAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-play:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEz///////////////////////////////////////////8Uel1nAAAAC3RSTlMA+rbVFUecgC7rYhEEz+4AAACbSURBVDjL1dMhDsJAEIXhdeiGpKYWQVKDWc8ReojFc4ReAlPFFQazad7lIGkb0jK/WEPSsZ+YN5mZEP5UrZIP0vgE0Kv3oPlIJlAk8AJM4ASYwAkww2+ABfQg0ImgugPYsfNBVl99kA0AsjOArAPQpRTGHiBB8whxM0y+3skXNltsvMYriIWrpWPA80mFJ5qL3gAfB1/tcAt7rzdiV+HEgs1oBgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-pause{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEVHcEzMzMzHx8fMzMzMzMzOzs7MzMz4IlKVAAAABnRSTlMA6xIU1hVqIuOVAAAAMUlEQVQ4y2NgGFYgLS3RAEQziQFZoxKjEqMSaBJpEAkgIw1ZQlBQRAEs4QhkDeIMDgAWx1gMHyIL4wAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-pause:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEVHcEz///////////////////////+3ygHaAAAABnRSTlMA7OgSFBXMmAA4AAAAM0lEQVQ4y2NgGFYgLS3JAUQzi6WlJY5KjEqMSqBJpEEkgIw0ZAklJSUDsISikpLQIM7gAJjhWp6XcaOxAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-record{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAHlBMVEVHcEzGxsbMzMzMzMzLy8vMzMzMzMzNzc3MzMzMzMxEZ/aQAAAACXRSTlMADPKKKeBxlV6neZ4mAAAArUlEQVQ4y2NgGDZgJhpowCURAJeYpIQENJEkCgWRgCeShAGyjfgl2EqwS7BFToZJiLg4ICTEImdOh0pwRM6cDJcIjpw5E6aDFeh8B5gECBCUYAkKCoMbNXNSOlyCgUEQ4apJJmxIEkjOVWFgxi4RgEsikGQJnEYp4pLA6VxUDyJLIAUJcRLIwY7qXKSIQvOHWCQODzKIleBPPjgTHM4kijNR48oGkajiYUMykwMAAfmZhUjBISQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-record:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMA8gyMLeRw1x2DBpWGN2QDAAAAt0lEQVQ4y2NgGDbgDBpIwCVRAJc4KIgEZM4EwCU2KSEBHySJCcg29iBJGCBLgHUs24FdYlnNYZiESksDXKJALebMaagES8yZw3CJypgzZ2A6WIHOd4BJgABMgh2XBEtpaBjcqDMHs+ESDFyLEK46aMGGkEB2rgQDJ3aJAFwSUSRL4DQKp+VHcTkXxYMoEkhBQpwEcrCjSCBHFJo/1GIO408MOJMPzgSHM4niTNS4skENqnjYkMzkAEgzyFpeX6L3AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-recordStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAOVBMVEVHcEz///////////////////////////////////////////////////////////////////////99PJZNAAAAEnRSTlMAMPndsnZj1CSYPcmL6wsdoU80pOJLAAABu0lEQVRIx5VV26KEIAhMA++p9f8fezatFDPr8LSrjMxwiWlqzRuMYKW0ENH46c3WuGyVLXEduuO83UyK59fl1jX5EEUXD9DOaSh43XEP5zUIdZ4pAecTofVnWSt3ip4rx7N61vjnY1D30CpH4QQR8vsP+RA5Rs3KpjfMU/pMim/LgbvH7DF2F8sU0owqapKLqgnhuGWwImUagn2zhUX6WQQoYkXG9WxSAJd700/ygsCpAoliaDsPiG48GM1X5Ft/06sfp8DrDE+3DpekWjxM6366fgEcnklC+AIIWYQmPEeAaUmjFOnhCLDfxZRH+w1gU5b/DYjfNcyJ0p7dxX8B+FwxQVtvAGB5ig0d5gFA5KbzS91hI8CenvlHflfN/XvzJQnxbBEko1gbvVnPii+FadSVRUEaYylQfJtpLB+aRG4LY/80yKdUbCraM0lozGR4ewZ0Wtnj1iC7hjWKNnjYmR62W15cLlL3+2pyMR09jccyuyUrHKsvthc5xsY1iWJ0Xk3t+2XP7AnWwrAQmBH6asXubmL1Z5Lz6o992jWiu9lnMSiQsK27FS9NxhCumZgB2fTBPFsFolhZr5B/D3o9sJAI6skAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-recordStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEVHcEwimP0imPwimP8imPwimP0imPsimP0imfsimPwimP0imPwimf8imPwimPwimPxLmg1rAAAAD3RSTlMA15sisGUvdz3szYwMT8H+hDJEAAABx0lEQVQ4y3WUO08CQRCADxBQchBiMDE24KswFlw0Wtig/oHzUWglJBZWio3GDjUxlhhrEzT+ABMrO2iptLLVRluDggI+xtmdXW73LkxxNzvfzuzszNwZhhDzdOxqaPGgYrgkOgFczh90ezAJQmpL2v6OHYnqk2aWxOTtAnu/O/Y5XNZXmTZjo3ot7aESwLdFeqAM0MoJkMf9ltwVQJ9PcQN0UFIJogvdJgLQVFMsAlxyBaPmVBDCE8W7qd+2SDsx0q4OwhSrCG134W54jDfKLjDNxaL8/9AAMM/solptRnoALBbwEPWYrOEzLnrZsTGoMW+fBHG2SiLPUNI6KMOH8QS/XsCMBYQekIEv7NGZF/Rht2yqmA4i3UG9O0iTqgMfhirDhRdU8XJZqqEO8tDAqje8IIt1r+I5HmBjfD9AxQ1MgJQRpc6GJRALHOAS1WRlhMs4VaSFzwIWzCUF3op71kdNsNs/FDCuA58YqCQl7IhN3WbDnlLtfjnuON515WM17c7w41QPOuBIzDT5wqi0T4ESGV3gjtTjkuPATwHoX9+cPRlmmvJ57YAir2qKy459QL/UhrS/uAu3xf8KiX3DI+b22t6jc9F/qfaum9E1pJ4AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreen{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEVHcEzMzMzOzs7Pz8/MzMzMzMzNzc3MzMzMzMzMzMzMzMzMzMzNzc3MzMzMzMxdHBitAAAADnRSTlMA8AwGYt0aUcg+til5kgmZywUAAAGWSURBVDjL1VM9SwNBEB12IcGkMagxNktQSZFCYimIJAqKpZ3Vco3YBYs0NkKQgBg4ECtLFSFVCGgQrERBsLayPE0Ip7n5De73BdKLTrE3ezPvze6+GYDfsAQKy/Rz0i/OZJjY9XREuohTKulS+ZFGiADfyZXU5uHktI44VH5apDx554aXwJqloiIwiEsStAjCAsRNF1jCmGqa4Vc+BvS4JkjwzyPE6xiwzsxxeTbZxqjkANSWZFkoIj5bQBl4aBDfkPDNpeRRialB+SRAFz8UU1sAaEUjSCDoJ7iukZJ1V+c01bFczM1pWaa+a0Rp7MHn4V8Z1R9vLLCv9WjKdVFfk77JP+bZdz35YAfKXx6KhKp93abUYVbrj49g9aAYSuFCLbPUwzdCsYEWTloXgw1oGwQbENeuKwxzXhxwAADRMFd+zzRc6AAASY6RH8VjUHaXTrlOpDgCUP3gelc01e2d+f16cWbnQ46BGCRNVsWAWQJVw2xGfUXVv2k1OsLfazXqblzS99u1FwKFvBJioXBY2+r82U75Ab7O0ypVV0wKAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreen:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcEz///////////////////////////////////////////////////////////////////+GUsxbAAAAEXRSTlMA3clDHfdfDQbsVG00u4Cqkr04dRsAAAGaSURBVEjH7VXLdsQgCPUBAROdjP//s1UTDUxsz3TRTc+wC94bHsLVmP9hkE8LIdvgupt2tFhcpy2CMZyVxNePEoqDp4hwEGz5PTqWoZNzLrmD9riltBEYzzpZQ8bweXy56Qy6Tivsp5JQYtawuMH3eJlSxIJtdSSa4xer4lMB89pK23mKrwjZVpsRzLq35vEE3+r26h6w5EKppcp3fP2lIpTPWJvoXoobeNI1sM3haHvx56tu2sdElJ54GbnPQ7RZ1sCpl8qPEMXBNQ8vN82jNbzLCPzGSDOZj/2Bqd19R1rELIEbDFrUJfKYdlALbDuDMko/hz7t8DqtCfr8h1Vt4rn7eh/6Ph37ch20aW8McsfGCOXzcr+GOlQG1rJ2HSHUDO/4Mu01qVAqTCpCJfgZ3phTS2pKm5aZOMUbs7Q6nk6L8UzRh6W78jH+gD/VRxHokPuNgUGTaPPR+zDR1mrlvcGgwkAVacSbeoN4Z0rb5/6XLrW/2GTLk2NhXHRKzrqAt9cD4rr4ddvae0NAYgOICdZyvPj4UYRf2BdfbB8iWvnTUwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreenExit{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAG1BMVEVHcEzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxi4XDRAAAACHRSTlMAf3WqJmy+7azWNnMAAADNSURBVDjLxZQ9E4IwDIaLfMzCOTDSOz07OjLir5CR0dmJFVHIzzZtnMzbOzcyZHnuaXpJWmO2ji4GhpAzzZeQzw8FKCj1pMHss9OgpwsGOS0YGOcVUMPsfBVkmJoVCBJW0FFB6SFIaMKAlRGDnEiDkuM00lP3SmL6H5QSh+iIr9ZWVWntUV9Z4qWbHAWrhcUYNLC4Wwm3xb1r2mOQYoVn2EKFAVb81KHiQQq6L3vSUoMBUmSzgCKbVeiL3eTp3Odf8H1sxRAZZNZt/Vt8AHcPQbiQQVF+AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreenExit:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMAe4Fzh7MZbKPtN8gpX19xAAAA3klEQVQ4y8XUIQ7CQBAF0CWhKQHDGtQKQFcURUgqEARBED0Aoqp3IKnoATAEW8MNOACmhQYKcyi6uyjmr+aLqXj56bSbVoh/J3HBxcw0ZfA2c3FiQLGeQcWh1lOVDDJTAeCbCgAR6QqCDj0xCEU5Bl2BIALKMwhdKjGILRUYfCIOEynlvABANk64M5jabJxHfJY2I76yzYu/ZCc0s1WbNYAQ3jxqwMoGHoqWGHpUQajEgcYYcKWFtjLE4FGJQewoxODRDQOqKPPcHl9sfzSXa/0L349tEDsOsp/8+2/xAY+BZBY9KhM5AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-audio{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzKysrMzMzMzMzMzMzMzMzMzMzMzMzMzMzNzc3MzMz8gU00AAAACnRSTlMAL0jMZKt96hGJsSKv1QAAAJ9JREFUOMvN078KQFAYBfCbJEw2q6SUyWxTnsJT2JTJ6D38Gb6n5PpT6BwbuaNfTnz3fEp9fZwAP7czD0MsGCzBYJcEYsGwBEHQQRB0EII1CMAWdAOzyJUvJ4jyDVyZVHKGpj9guEI2IuhaDFadYnCkIm9I+kPgn8t+kI7kOsT72HcwQnJR9Gofy8DrwwtHK8pLzdeALg5fNb6cdJ1fOjOGYrl5CLFcggAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-audio:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMAL0TQf2frEaZYt8E+idL4AAAAnUlEQVQ4y2NgoDdgUcAuzr4Hh4TaGQHsBp3BLsG+BoeE2hnsEkCDsEqADMIqATIImwTYICwSEIPQJFhnBjKInUGSUA2CSPCcOcIwB1ki5xRM4iiDDrKEzQlsEuUF2CVY0jbgkDhjMLQkEkj0IM4gQQ1EHMHOOXMiakRpTiQQtXgTA+7kgzvB4UyiuBM17myAM+Pgzmq4MyfO7EwjAAAEf+BAxqI/agAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-mute{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEVHcEzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMztXryaAAAAD3RSTlMAHd4P7ztyiy1OnKhdx7uY2gyAAAAB8ElEQVQ4y72Uu0vDQBzHE45C3SJFaSGjUEiRpJRCBifXokkpSv0DfOBrEKxUUSoFH9ClFAUfU7c4OARRCs5WjThIsJuDlLo4ldvPe8SYxGyCt1zgw+dev+8vHPcvYybvfCR2OgUv2CoLdI62bUn3gq5UJxOomZofXPUNrIChJRklfcDSiKK2bYQ6PiCaREk0EQoYPFYa3F73F+DGsBJLmAjBAMBKakG15KAxqIhd2KuK5reRccBDNbqGJhfSlnNc/kBh4OY+vaoR5QrRC0afKgxMrKdXNKI8yxRENpyd+i0VA6wMm5IOBmORCwfAFjGwolofevbuPrvpGhRgpVaqiJflrLuUQQFRToS9l894EMDe7q6yL7/G5wMATc5mQCiAvQo3HAbwLtyYHQZgTxhohgGUa/CP12EA16W2/Ou4ZEj1dNG9oPMkZGiwJWQ8j+huPoJy9Z/XHTfUFSbAURveCtE5px5vs7hQDKS25FSDn2KR5Up1/lRmIHne7BvKd82LMRJbSjr5M40lmaYZ5/PRpiCpizjJyk+CwOGOzACLpSdz02QxkiuRhd8dNOwkV7zl2YX1mcySKJrQiPkXY9klSt6rkJPRwIlmzrcWSGyzHuTb11V/N0y/S6SdwdCR4m/47OIN7XOQCfwJwHGp8IcfyRdBLEZK4Uxp6wAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-mute:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAP1BMVEVHcEz///////////////////////////////////////////////////////////////////////////////9KjZoYAAAAFHRSTlMAbk2o8o0P5TsGnVojFi/XHcV9urLaq0oAAAIQSURBVEjH3ZZZkqswDEXxLM8T+1/rkw0BuwM0f131+IvDyZVk6SrL8p88QCHp8UAnWmoWoG8AwQRN4/vOiqwUuwWqiob646MMhEW+KnMLMIXffgiZoODBusb7kCzjByF7OOszkOyp4amJ7fWVPwCN6BpyWRypvANPCvi7u4aTXe13YI+KkYA5bMRTSMlLnSyGwisSH40B0FJOrKVB6iAw2U7sGgPgQ/DTPQjitCOZT4Q6gWCtGwGFbSM34ENUNSpAKTACmC31rnRgJwjDdkFAJpfkAsZcAJvCSVQB2FaWWKdB/ATMAHwIUYL21lRBZRDiC5AnsBHBUqxEyaraFMoz0AnvHNa6xDWS34FGgNf6PYAEZoCt+BroUWFVbeb5HbCqSvB2cToyca+Adjlycdawt0C/HeyScl1W/w3gsU3aAd7JF8AuAN6isr7NAogXAFeq59Ec7ifAm49hF8wCMWfVNXAeCAkjEGuBr6R5ZGJzBrl4gGniBME+w8aMMyCsNZtfaemnmYaAQ6I3Rz0fnDhHJxc93Vrr7sHWjP3XRtTba2L3EkdFVaPC6YmXxKI9DGF1YPLdiwfD2r37cL5nDVw+uKzU5K27hsXCXPtyC2uyyl0D0p2TY7VaIvFYWU0Dm8TdOXmrVp52HG4lU4K/N38PpS/Kw70dbmb/sC0WCcQwNNzzjrzUj7veUyIIyL/4m/EP8V829O8zh5EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptz{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAM1BMVEVHcEzMzMzMzMzMzMzMzMzMzMzNzc3MzMzNzc3MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxDm1AzAAAAEXRSTlMAHqw+E8It/gjxc03jhGDTlgAjE2kAAAI6SURBVEjHpVbZkoQgDBwg3Of/f+12gtfMbK1Yy4NampCju4Ov1y8ruNyyo9fyCibVlNW6vUu29GpWQwTVdPTernqwffHex0WP4Nro3k+PrMKCvew/PcZ95aoNsY9yua+cGxTZsnf2K7ch4CAdGnWwYx/5LgKZCgxGdrhH3BeqNmnwviFXPZbQJmcM25HJ5n7/Pczr2QqksMJfO7BJOHLKLWFdMiL1QXYRwFagMklb4GB1zS7s8Le3fqH7Q28tVLkKdIzeaOJB2OKtY8KfTQCUa4++dNsLbrqpTR7xguHGt8hfg8P+seuaEkNdBjahzOD7g1cHP21SL2LtMNBKMdTRJjffTX1wVgrsEb1ITJU6QknwYJAcQky2cE02NbzPp70KyKggtpu9xM7Ik+CBIqY+8FrYyRUkrs+MEm1TG6tG9LZxNDNFGDue63TYGgIHqUUcuNhvhyZtn5LnlDq3Juxa4noCuX0scErOpNMDCrVcHPCS5rFGuQR9KZpxnB6CQ0ZO+AIBcTPk3UdbTx1L7jLEEHsMW7ZYm8NlIFyxn8+xdL7MURYEhzd5k2N2TabxIAORwC2r00QQfNSgrnqTJfh7cDmDu9ggtV0EZFr7kGu4KAxtNDln406TLwF9iZCIwn9EfjPuncRHYm5x3NfK3cFAS5kWxljSnTFlPHBAUFg5HsCCVOd9cdwXq+027un2QJlMjqISJutCDceRtTTuT4+1Q3HWHR8cu0fh9sGvADTYH9iLah/9nPz5+/MDJnQfoIVoAnQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptz:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAQlBMVEVHcEz////////////////////////////////////////////////////////////////////////////////////1bZCPAAAAFXRSTlMAeVoYDS1pBiPv4/g6lkzO2qSxvoixscijAAACi0lEQVRIx51W2ZLcIAwcLnPf+P9/NS2wp5xkq0ziF3ZRC3R0i/l8fvi04oxx89n+RBi1sqB38TKw7lw7lNzDa3U0e57bHhJ4d567HlqGC08eLAj9Gv8XD4/OwtsdhlfCW2s9LfWtuNrMhG1uLWP17Xh14LF4m8dx1OJ9jkm85YCYch5JzDVy81on3MFYkpTNYGmHHloYI+aqlNhlh5ZSvmH1AyBUwPcMX+u/clW3XYvA2YgRGXyZIZX6PXv0l3GlV9Jp9FKcK7mytJIg8xEeBdaBtV4P8tAixexnp73tY7ZBkrk9WEL8t7ZUDqtIA3jXa8sODSeUVqw5aztT+g4QeNAgM0PGTA0+EmfVeUvU0CEW4hX+lt/zseE7jJKDSmi0EUKBhr7EAMKPvNjOA9Fz4Yk/CFgcGRSdkYOHCLRxQfzKRN5SB/b5Ot8SzzQiKqcb6ipFdCfi1JI84OBdxzarhJ8RkpxHOQszl7bpn0GpmnXq6R4OfTkwwlyUWzeQg7rSLNhNUzEUEqJF3DMHeeXgqRIaYwHimLKipK8hMZOYVfJ5oKtIFSgXk5z4KcNx3GOIPGYfPigh9YGHBNQKVKbZhxMnqq+OHfWBHARZfWm1dnfSXfJuXInplse8wy39zkisdQ5kuLY+Bpc5hwGiH8Mx1rE24DFaLqXkfrNVkjk+8JPTPF0bUw+R9MCVuA8ks/xDyF/9orMqpBQeiob5RbIbmv7/TxvoX1Oqa914TsYg7QUWx8Y7R89JQY8mY6Dat1G5GARuMOgYHY9cbL1vNvc++fk67olLk4nrQSl7457OPqdeKn+vEwm4LPzW87DyXvqIyei9znHS+cZz9SxV+Qf8nNbjn37NkDx4+PmCXzHOLUMtjgmUAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptzActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcEwgmv8imPwimPwhmP8imP8imPwimPwmmf8imPwimPwhmP0imPwimPwimPwimPsimP0imPoLqfILAAAAEnRSTlMADprCJBnU/gXwh3LiUKxAXjJ/ELXKAAACbklEQVRIx5VW2bbjIAwLa1jM9v8/O7Iht+09MwPlpS2VwLZkJ9f1lxVG1joPdZ0u1ZIxurhv8DH6dMpQI5t439GAEc7xYPgTRnAtV7plReRhd5kDP8+fd+wzt70yPhIJzWT7/6DCJCAYLReZPMIuJC4pClSktHqbNpJO1aTmmAme3cvtWs9NSfq52CPhnJNjlbVHwgmWSWGHeQHcKFjj7fygwidf2fa4mbVOuladcnsoDn9/CKKAWf6HEtpANiJvUp9Fgr0SvocPP/sqjOCK9ktpyCAo4Kt/d4n4/6baseNKAt5XrauPN1A4ZLAd30RUI4kNfELVx+yd3lrXYIg1Bp/B/dGs5N8mPsJoVyiwkofQSlm+K9aiwmoQMDoI4wefoK/rhkESrSuV+BR2i6HZH9juLzxCtBmn6rFmB66gNJQwBOSxncT/N3FAlxAoLQfJDy2+6rMLI3aznl9fhOcGSdZzoNhex2K3TXJEVe3M4Zb6QhHuJc5BWakYIqqietcPw6FK+EHofUHRqtLEQ5X8dKVENXXgEpLOpcjwkFI30YFVHE8fyx2ShZJ/ydTKlZwZ4BCOv/af9uMi0DILe4kieynScgPbhai+DRDckTT6N6zJpI3HMghM3BMg+q9pHmwrbR0Q0D5wc0JHPy0E5Ur7Nf3Rk68LnR0NHfO28/T5P4cNr+uLFR7eEdiNxvMRbd5Onlqsis4iIVdme4di3akWOz+3T0aUnFWHa8QZrO51NO69MeLPafrNuBenxel/3d21j8k/jyxf+75OQabFxOtuT94G3Lpjzb0zBn2Dl0ep/waPidQ/p/XB60Dp7e8F/QO7WSJg4zEzdwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptzActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcExru/9ru/9qu/9ru/9ru/9ru/9ru/9svP9ruv9ru/9ru/9ru/9ru/9ru/9ru/9ru/9ru/+3uxEqAAAAEnRSTlMA5q0cR/PC/ggSKtN5OIhaa5izIOiAAAACV0lEQVRIx5VW2ZLjMAiMToNu/f/PboNsJ5PaKWv8kKRkWkDTQF6v/zyUfO+JX9sP1dKKd/v2acQcm992kbo1R4il7iHIif0BRNtCUOozH4cikAdt2YfjRLTnzN15/8I85wFCI2xDzlnyMLO7R0aFoTzbFGB+jIkYLkyePvmW8d2fs2ZfZuv8It9s6zvV5uSr2LmKb9oVh37QvpjYOcf8fcO3Cb1jGqOU0SvTTd6X2KUBLgKdLzaiDtE2n+isTh8/+AX7E6/Vh/NNSyfVm10RXIe1nxXRapmsDQB7SMnkmE0IxgqvUn0jteEf1T2CHXgr0gjZllGk1HoJL7lD7fRpD20CgJcwQ6EdSh3lLK0zVfuqz2WvPlPJh7HqnCQ4MysxoAYQE0vHub/toRuqzRy5pEUvbg62MzlJQn1MHBe1x7WSAddpNDSN1c9wRMhKfi2jrICwAIsQvHkD7Al41bOrBNC1Y7QdmSg15LDokGETJB/imxYJKfmFMDqI3FjUkDS3NSEDjBaxknRYSb+4nj4kC43W2OKrkqGB8jV2Fq03YiWbhHQTpUV1mMHXWYf8HlNX7ZUQRC6iwBAIK0r0ILr1UxqKsPattAkhwSIiMl76bT/Ft/TbTy2jHQoM7Cz9isHVMb6GILl0H4DGivbw7xNc8rAtiJn3O/qvD6JT/wgs7Y370ZSdWmbZWEKiG1lXImldW7Q1jGMbZW9tUVKZmGjjGvf+EXAqzWiX5OfFSHVp/zjbfGPc3whdcbTF67V2N1e79qYMru2/AnzVYFsdWFt/+nOypv8vQvoHou4gOtSrG5EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performance{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTM7OzszMzM3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3NzW8hQDoAAAAMdFJOUwC/gO8ra6tUQNmVEKtAA1gAAAE4SURBVDjLzZMhT8RAEIWnpS3tXcWdQ6wgOJIKfFdUICv6AyruB5w4EuSJCwRXgUBWkGArLsEi6JVuaZkfxawguSWz/p7azLdtdt97C3ASagp+PpeXPDjHVx7McMWDCBc8qPCZB4m44YFIeOBh+ckCf9z+sCCYqi8WvA/5Nwu26cfA+JRBs4h7WmX/tr9AXcQHAPdgzEPZh5idTQBOZ3zyiModISKQGxZ7dd85E0SKfMGjM7vXeI/5AE5LvrwpcK9IOrQYB5BlCsFIvjzgrkaSjsBZbmC9XsGsAxfn8gKXpL9sSlnQFBwFTTuaKWXgI5Ar+sfHTrW6DUDO+2jEEtCNQ9wL6gNujMvvdFS3eugxGT51fBXxTvF1wLLngbT0BGphKalAy0MQ3Z4Ha2V7UoMFJKkFVAWcvH4B0OJfd9YsTl0AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performance:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwD2qdfrViyAwW2XORBGtSCsD6SyAAABN0lEQVRIx+2VzQ7DIAyDYfxToH7/p10CbQ+T2s33Rb1MijM3/qDG/EurolD9zSNRggBU0hFelMABmenfADhGkJDhGUFGgiX6I1AAQlDgZK/td8ELtQORiTmIq42I2bYdCD8NjzPmYQxO+rbn2S5qzEUF6YjkgcJude56X3s0SoL7LRAeylyaVPiFq0Jyx230mpeXmXVOHssRbhackhCq25Sny++xcBW1n6Snqw6BTgrqRP6kzfDcgmRLGonDWSf2OecwB491dOrEVZpNsxiyiHzWJ0Z+BbBwzaoWVb49HrqVfSkxHen7WNznLhzl8xpQlT3E9oHUtYaufB+7NY9g9ctbjFfj/h1DwXUrzDltMn1Ql9M814EQWPLmEBg4R7JSzpFQxTmSBMkLvJKOhFHfKEEnv3L/+qw3DuMPzAFH9pIAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performanceActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAtUExURUdwTBGW2xKV2hKW3BKW2xGW3BKW2xGW3BGW2xKW2xKV3RGW2xGW2xGW3BKW2+P2IvgAAAAOdFJOUwC/gCvzq1RAleURc9VmrA9rXAAAAT9JREFUOMvNkzFLw1AUhU+SxtTahnZyC+IsIeAenDuE/oJQcS/FTYTi6hKcHYpDZ/EXBME95BeURpM0Me39Db4Mgk/u23umcL8kvHfOucBBKEr5eW95xoMjeuBBlyY86NOQBwt654HrPPHAca/YuUHrDQsG9eybBWa1+GLBqvS3LJiNX0vGJw/R0N6LJ+/f6x9I3uwG0D+luRU0FnmdCtBy6ZM7KvQdjgXwJYuNZVNrFfqF8IX+nFm/oBvyS2iZ8OWxgH4u1IZmU4kgfoa5E77c0jwhoTYCbTRFGE7QrXFCveCURkK/2cRBCp2gFYiyWk7Jw4AgXOmQZMAqa9uAeCP+JsViihtb9OKIPtBUuvy8jeqyHRpMhvc5X0W6Lvg60HrPg0DREySOoqQJKRbByRWbExaqlSoVwB0rwCLFwesHquttxhcsa64AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performanceActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTH3G63zE6n3G7H3F633G7H3F633G633F7H3F7HvG7H3G7H3F6xOzy+EAAAAMdFJOUwC/hKbvK0BT2XURZct0z00AAAE3SURBVDjLzZMhU8NAEIX3LiSUNqI1qBMMChFRgYxAd07E4CI6HQwzEUXgKjC4CH5ABAKJyA+oaHqBJO3+KPaYYSZh9nyfyuyXu7l77x3ASSgu+flYX/HgHOc8kC4wwikPMnzhQaTueKAiHvi43bFg0m4OLPBM9sWCjyb9ZsHm8NkwPiUQT8MjfSX/fn+F/C3syJf9YB7oLsDkjIaiHix5QCNbGBmAFPve+3lXi/0viLB3ZnmDz5g2ICry5daAvCbZhSE2oIsFeC35ssJljiQbgZitIY7nIGu4wLG+xBnpL5tClxQhCANR1Q5TSmCCQK7YjftOVbYNUOxot0EsHl0uwHdFfcD14PJLG9W9HfpMho81X0V8MnwdcHvkgS4cBcqVo6QKHQ9B1a6XY1zAcSiIFg6QlXDy+gEd714RcAqEowAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-face{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTL+/v76+vsDAwL+/v7+/v7+/v8DAwL+/v7+/v96T4QgAAAAJdFJOUwBAgSCbs9hZap+hQJoAAADvSURBVDjLY2AYRkAJCAygbEZBQUEBKJtpJhDAOJpA9kSYxESgKphuIaBuhASqyYzESjC2hDRilQBZ64BFgm2qMLPYNCwSkQpAwlMBWYIRzJsKYrKCxZSRncKSDFYzBSNY2MD2MqRhSFgqgClPAwwJBxwSbAk4jGKZDCKZp2JIsEOcOx0ztjQDYL5ENwsYJKrTsMSvGSgepzVg2pE5qSikPRPT8sopBuDod0ATZ54JsbZyBrJgAVAp1Ax2oPXMykjxYQaLA2CMoERUZQDMrgBUCc8CKIdzAvHJhyQJpLQLSu0TCaV2lPwBSu0KQy+LAwBuJj5UbruNggAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-face:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTP///////////////////////////////////////////////w2imYoAAAAMdFJOUwBAgBvfrFmcw4wrbtGliFoAAAD2SURBVDjLY2AYRkAJCAygbEZBQUEBKJvpDBDAODpA9kGYxEGgKphuIaBuhASqyYzESjBu79yIVWIP0NoCLBIsR4WZJY5gkYiZACRqFJAlGMG8EyAmK1hMGdkp7M4gkus4RrCwBIApFwwJmwlgqsYAQ6IAIrEAwygHHEaxngJbfhRDgg0sxHoMM7Z0AmC+RAPsJ4S5NE5gid8VoHg8sgHTDh/PzM60HkzLc44bgKMf3RKuMwoQ+dNIgswJDAycUDPYjhgwMCsjxYcJLA6AMYISUTkBMLsaUCVqEqAcngPEJx+SJJDSLii1HySU2lHyByi1Kwy9LA4AqflRBKNSA88AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-faceActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURUdwTBCT2xKV2hGY2hKW2xGW2xGW2xGW2xKX3BGX3BKW23povfoAAAAKdFJOUwBAgRybs9hZLG6hrV9tAAAA80lEQVQ4y2NgGEZACQgMoGxGQUFBASibaRUQwDhaQPZCmMRCoCqYbiGgboQEqsmMxEowTgmZiFViFtBaBywSbEuFmcWWYZGIUgASXgrIEoxg3lIQkxUspozsFJZkEMmxBCNY2MD2MqRhSFgpgCkvAwwJBxwSbAk4jGJZAbZ8KYYEO8S5yzFjSysA5kt0s5YKc6guwxK/baB4XDYB045Vi4pCyrMwLa9aYgCOfgc0cY5VEGurViIJMhcAlULNYF9mwMCsjBQfZrA4AMYISkRVBcDsCkCV8CqAcrgWEJ98SJJASrug1L6QUGpHyR+g1K4w9LI4ALk0RHtSETFcAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-faceActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURUdwTHzD63zE6n7H7H3F7H3F633G63zF7H3G7H3F7H3F68TinBIAAAAKdFJOUwBAgR+Z31ipwW4yAjb9AAAA+UlEQVQ4y2NgGEZACQgMoGxGQUFBASibaRUQwDhaQPZCmMRCoCqYbiGgboQEqsmMxEowTmmZiFViFtBaBywSrMuFmSWWYpGoUgASXgrIEowgHtsKEJMDLKaM7BSWYLCaJRjBwloAploxJKwUwJSXAYYE2KUMVRgSrAFgKhTDKPbFIJJ5OYYEG1iIfRlmbGkVwHyJBlhWCDNrrMASvxageFw6AdOOqKCklrQuTMuzlhiAo98BTZx5FcTarJXIgglApVBr2ZYaMDArI8WHKSwOgDGCElFZBTC7GlAlvBKgHK4FxCcfkiSQ0i4otS8klNpR8gcotSsMvSwOAIs+RIlIrewIAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-object{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA51JREFUaEPtmT1oFEEUx9/bnRALGxE70btkZjcR7QMiRisRbCzEQvxCLGyEhCDRBC/RoNaWFgYLFUSwUBAUDKKFFqIQ3OzNJpfCyspS8HaejNyG87J7t7N3l03gttydefP/vbcz8+YNwhZ/cIvrhx5A3hFMjEAQBDwMwzOmAi3LWhBCLDTr5/t+ycSubdtLnPOncX1iAfQAlmXdNBmkru2RVgBSSspg+5kQ4lRjv1iAIAgqRFTIMIju0i2AWNvrAKSUowDwLqP4tACm9rWmbABCiFxXKimlhu0BtPFHtdc19wj4vn/Wtu3XnPOfWVByA5BSngCAuwCwryb8Hud8EhGNltANB/B9/5BlWXcA4GCMx/8g4jjn/H7aaGwYgOd5BxhjcwCgPd/0QcRVAJhM2l3rO3cdQEq5GxFvEdH5VsLX7aKIH8MwLLmu+zapb9cAFhcXt/f3988AwJip8Jj2L2zbLg0MDHxr/NY1gCAIpohIJ2V2BwC0iUd9fX2lQqFQ6cQvtJbICSGOxHhlVOdKjuPMl8vlqzrxI6IdWUAQ8Um1Wp0ZGhryiYghYrUtgDQionxJT0al1IwGkVJeBAANvieNDQB4joglzvmilHIXAIwrpX67rmuUamfKcxoTvnoQ3/dP27Z9g4j2J4C81KBCiC9LS0suY2yMiC7rttoZuQBEQhsiopfT6wAwUvv+hjE2XSwWP0kpRxBxgohO1kPmDhAHEgTBUaVU1XGc98vLy8eVUhoqbpPLPwIx6/wqEV2ovX8AALzZ/Ng0EWgQGa1iLQ8xPYCUyx8YHjt7EWjm2I7sAy0it7ERqNWEDkeiklIJg8pFWwC1ZC6SM9NYc1oXgcaiVlxVYmVlZW8YhlMAcCnFvOkEQPqqRBqASLTneTsZY3pjapZSpwF4Y1nW7ODg4Ie202kTgGiwSqWyrVqtXgOA6Zj0OhGAiF4R0azrup87dqDJAlA/eLlcnkDESQCI0us4gOdEdNtxnK+tfkHjA027AJEgKeUVANBROVd7p3fixwAwJ4T43kp4nR2zylynAOoE/JuAiPiDcx6kFb5pAEwF5zKJ2xXZrH9uc6BTUD0AAGh639Xo6bjUI+G/NglS+p3Y87wCY+y/2ozJSGkuRDLekQFjbEexWPxVryfpjuxhllKhNtwtAESc55xHx9M1hsR0WlcOlFLHTLyv26Ypi5hesyql5oeHh3VBeN2T6TxgCtXN9j2Abno3je0tH4G/KbtRT7VUKs8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-object:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAwdJREFUaEPtmTuIFTEUhv8fLSxsFrET3UIQRHtBRNdKBBsLsRBfiIWNoIisD1xfqLWlhYuFCiJYKAgKLqKFFqIgoiBoYWVlKbjwy4HMJXs3M5Nk7tzZCzfdvZPk/F9OHicnxIgXjrh+jAG69mCpByStB3AgQ+AcybmqdpJmEvv9SvJhqE0QwBm4lGikqD4VAaCMvh+R3NffrgzgB4DJDCPWpC2AYN+LACTtAPAqU3wsQGr/pikPgGSnO5Ukgx0DNJhRzZp27gFJBwE8J/k7B6UzAEl7ANwEsNEJvwVgmmTSFjp0AEnbANwAsDUw4v8AnCZ5O9YbQwOQtBnAdQA28nXlp/NG8HT1G7cOIGkNgKsADtepDnx/C2CG5Muytq0BSFoJ4DKAUxnC+5s8cSCf+j+0CXDBjAJYNgAA6+Keg7AwpldyAXqBHMmpwKjYyThJclbSSQBWfyIT5IF5kuQ3SctJzjcCiBHhxUu2GM24gRx1IGtj+gDw2I34Z0mrbXcC8JdkUqidFecEAj4fZD+A8wA2lYA8NVCSHyRtcGvouKtrg9EJQKHVB7Ht9ByALe7jCwAXSb6TZP+dAbC3D7JzgBDITgDzJF9L2u2gQoectV0yAD7IEffjDgC7plaVJQdgYotdLOYSMwaI2gETr51jD1SN6qDOgSobw/WAywltLxRVhBIxi7LxInaxUCHHFvmCpFkorWInoR8LheqsA2DB3LGIRdPIAznBXC1AIVrSKncwVYXUMQB2Sl8h+SYQOCanVaIBPJAVAM5aqBAIr6sAnjnh78s82aoHQkYlWYwz7YXXIQCLRK+R/Fg3BYcO4HnlhPPKIfefTYX7dm8m+aVOuNdP+1OoSow79KzKL5LfY4UvGYBUwZ0s4qYiazzY7RRqCtfZIm4qfGBrAEDle1e/0FDoUTKvUxiT3gfsaWlBbibFUsyDiKSkBK9nf4LkH19P2RvZ3cxUIVoEmCVZXE97DFXPrJY52JUy+lY3Ji2S8cxq4i3jsahk3QdSodqsPwZoc3Rj+h55D/wH5CHfQHNA9EUAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-objectActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA9JJREFUaEPtmU+IE1ccx7+/N7O0BwUn24UeRKOd7LalvS+I6HoSwYsH8SCtLf1jEqWoyLJVMfEP6nlNIgi6eFChCB4UChaU0h7aQ1GQrnFSdw9e/JNs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fdGBvm/bpQPrCvP1eP+RpYrXA5XKgTaBkA0Voqb1eupL4DToFo5YLlVZfadtkHKIqrPrFLIsXL8s0k3LaHuA6pQ7WzfBWjn7Abpe9ln4C11Qo9Pmb2aMgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-objectActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA8hJREFUaEPtmU1oU1kUx//nvthx4cJqX3RgGLsQBNG1tq8Z7axkwM0sxIX4hbhwIygibfPMeyapunY5iymzGAURZjEDAwoVm8SPhSiIKAjtQtAmiooLiyb3yEtNm76+5L37kjQp5C2Te879/+65H+eeS1jlH61y/egCtDuCNSOQyH3cWirNHVIXKO6kYvqdenbxqVlLxS8J8Txp6Ne9bDwBnA5IiIRKJ5W2LDHsB2BmC6zqmxk3UkP6AbedJ4CZfTsNcL9qJ077VgHU8r0MID5V2EsCk2HEBwbIFdT8M/aGBkgaelt3KtOB7QKEnU9NsGt7BMyp2cOa4P8tY3M+DE/bAC7cK+xnxmUwtjvCCXzFHtRHiEhpC11xADOTjwG4BCLDY8S/MvhsyoheDRqNFQMwc292QmppEPb7i6MZgEdqna7V9i0HSNx/95MscRLgo/7CXS0IWS6VrFRs8+1ati0DSEzm18kesgGcURa+3OAfSGklY5ueuP9qGYCZzceZySKC1gQAgPkvXtNjpXatn258CmlYSOSSg/qwW+B8usH9SSM6Ec/lTxM7iR/3hgEh4Jpk2Kkh/UVikiP2MBUbAggiYjFfchajtB0QM/fuOFg64D8H8QHQTQ3CsowNT8cffdLnPn8+KyXPpWKb1FLtYJ0tbbU84asCyRYOEmiMwTtq+P63JJAYH9AfxTOFbUTlNXRyPlmTdpsAKlIXQZyDDJJGGbx7/l++BSHM5EDfg7HMm91CRM6B+fdqyA4AWA5iZd/++hWymDaid+OZ/G8EGgXB65DrhAi4Jw3NsORj5VRC4A8AW+tN2Q6KwKJM54b2HcD3EtMFCLojqVw7uxHwGdVQ992OjkC5JqSJPRXw2qlEsMpFo1OonMx9/7gE211z8iirLC1qeVUlxrLvtwgU4wBO+K2bpgCoVSX8ASqiRx682hgp/jBaL6UOBsC3pMTFdCyaaUI6HRyg0llicnptqWfdeTBMd3pdH4D/kyQupgf7HtaKZIj7gDpAdefxzOw5IjECoJxeewEQ6CZBpmwj+thvCq44QEWQmZ09BYjzLHFk4SQm/C2KIm3/svGZn/AFP+qVucYi4BbmbLnOb5rGr+zB6MugwjsGQFVwWxZxoyLr2bdtDTQLqgsAQt33LvdIe6UenvNaJUQqJ3Hi3ut+KSNLajMqfQV5EAnzRuZoEF8ivfZw74dqPbXeyP4MVSoE0DoAmkgafeXrqS+A08CpHBDTPpXRd9oGKYuoPrNqETlhD/w446Ul1H1AFaqV7bsArRzdIL5XfQS+AaeCtE+rbksUAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusion{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACCVJREFUaEO9Wn2MXFUVP+e96X5oa9UoYpUszrzzZlqLKDYhgAFaaKU2+M2W9Q8TNUQSQEsiRUjFVaHGNmoBMTUmaPwD2iIhqKR8WEBFGkLFUjbtzDtvpjYrVhpCXAtm1867x5zxvnXm9c28mR13b7LpdO65557fveeez0GYp1Gr1d4VRdF7lL3rui/n8/lX5mMr/H8wDcPwIgC4QkQuAwAVWv9eA4BJy/8sAHg7ALysf4i4DwAe9Tzvj/3uP2cA5XL5CsdxNiLi5QBwUkQeQcRHrNB/JaKZZuGYeRAA3gsAZ4nIBkTcAABLROS3xpjdpVLp0bmA6RlApVI5FxE3OY4zGkXRdkTc6/v+c3PZPAiC80Vkveu6Nxlj9ojIjmKx+GIvvLoGcODAgTctXbp0CwBsEpGHEXEbEf25l83a0TLzh0RkMyJ+AgB2TE1N3b5q1ap/dcO7Kw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virXVm1vBoAT9Xr9y2kNjeQtdAVAF9kQW5PseW+zzszMjCcbGe1UsmsAMYOURveTc62nap1TRNYsSKM7eQIaO7mu+zkAWAsArwPA45oXdPNTAxutaillsTqoKIruW7CfGqRdpRaHReSj2lvo8scezyDiY1qc7dda9axC3W64UD+3+Q/fZENVhTDr2gAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusion:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABphJREFUaEO9WmnIVVUUXSuiuahopOLLIqTBBgtCC01Ty8JmS/sRVESBNgiVJVZaaag0WBlGYNEPrSyiQdTKskEjpNKSCBqlzAqJSAsbYMV67vt13/3uffe+93pvw+Mb7rn77HXOPntY5xEdEkkHAjgk1G8k+VMnpuL/oVTSaQDOBnBmGG3DfwHwXeg/DMC+ADbGZwWAZSRXtTt/ywAk2eDLAIwAsAXAkvjY6O9J/pk2TtLOAA4FYDDnxmdPAG8AeJbkslbANA1A0gkAbgJwKYA5AJaS/KCVySWdCmA0gFsAPAfgIZLrmtFVGYCk3QBMDeNfAjCb5MfNTFY0VtJJAG4FcL5BALiX5B9VdFcCEBPMB7ALgPtIPlNFebNjJI0DcDuAbQCuq7JApQBC6SIAiwFMJPlzs4Y1M17SAQAeBTAWwPiyxWoIQNJdAKbZbUjObcaQdsdKujHcaTpJ25ArhQAkDQKwmmTpLrVjrKQdANwJ4FOSL2R1SRKAwSTfz5sn1zhJhwP4BsAokq+3Y2CjdyXtBMDueRGAv32ISS7NhN+RAF4D0I/kt1l9fQCE0lcArCPpyNARkbQrAAeD81IT/ArgQpIrMyBmA3D4HkPyr/SzPAAzIzYPJflbJ6yX5ARm48/J0f+DdySdWyTtBeDtyDlTCgFEkrKvXVV2+lsFJmmfMH5UAx1fAriY5CfJmIiGCwAMSie7uh2Q9KRjPcnxrRpY4vP7hfGumcqkT/SR5POyjeSVycu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+OirH300pALWiLSHAJJnVMK/kusqs9RqSTjptS3C0+S1lrF5TTX266uw0gxf2FTf1McDkUWVapZsAKtEqAcIu4FJhZBkT3S0AwVib4lxCspjYCgC+yLBf+0DXYnuRdBGAI5trK+efuouPInLXodMhtCGt3g0AKZp9YB5f1Yhe923JokaHs0sATK8XXnSUXXAkbWEuzd6oXm83ZkpKaPVpSY7J01l6eZFcdESX5cu3jjDWiXHBRLvpcV1WeLGRjC8FEAfbienx6JZmdZC5tttOBuBkeW3ehUZ2FyoBCBAurWv3ZdEPd/Ka1W5Td5FR5JKVAaS2OHvRbX6mJT41eE5TM52/6M6uQNDxlzvhAdga91gusat81cDVquurPQA4QS3s2lcN8rYyyOGzfLdQ8cseLsiWu7NrN1o17UJVJ+zW123+BfogD+TkdLQFAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusionActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACItJREFUaEO9Wn+MVNUV/s59+wOqyM7bFaxAsDBvFqnWak0MYhBQUEqUVssi/aNJawg7bxaKScFqqKyt0gip4sK8XUKqjX/IL43RlqBSxLZWYqwWdWNh3oIlFClkebMUaXfZefc0983MMjv7Zt7MLrvvn93MPec753v33HPuPfcRhukZt+3YeCndCQpeCO3kmWVTTg+HKbocoKHWjpnEuBfMd4GgnJ7ADAcCJzx8iUlE0AGcBOMkiPYz4c1kNPzXodofNAE9fvheQCyBoLvBOA/wHunSHq7CiXM9+BdWGj39nGuxq8dWYyJdxCSh8UKAFoIwBpL/CMidTmzam4MhUzaBmpYjNwmNVoFEA9jdSEx7zzZFPhiM8dotiduYeAFIWw2Wu6TLm7pW1n9SDlbJBK7d+rev/c8du5aAVQC/Lok2dEWNv5djrJBsTat9s2BeA9AiBjaN1s499eXyW/9bCnZJBNIG0AbQKCb8OhkN7ygFvFyZUGvHQ8R4DOBuSWgs5QUFEki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8fajbKttVBaM7WGD/MwMuL7EUHwBuRoqeGq2PdV1C9TjSvBWh1sYuNrHwgAS+9pi88tgIYx0TPDFfnOhO2jwI4Iym13O9CI38WSiLgKe1qrwp1VjePxDVrsq6nOf8io1BIlk4gg5B/0S01emew/VSvz+ny3BG56M5/A6odz6T9kIB5DHwFxtsssbuUTw1IYDEI8wm4koF9xO7LI/apgd9UquYwS74HzHeU+LHHeyToLdWcHWq2KjuESjU4Up/b/B9u0kgtWdqPkwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusionActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACJpJREFUaEO9WntsW9UZ/33HaZJCX7S5TmhalQ1NaAzGYJUgvk7pe5QKusGa0v0xaZvQkKBbK60BWl/b8XWKaLWtUJg6IcG0P+hrCMHWlcdK2OLrFPFYGdU0ac+q9BHfFPoC2sQ+33SufVPXvfa1kyaWolg+3+t3zznfd87vu4Qx+nQfONc8yF+0KvP1NPHoxjsm9Y+FK7oSRo2+fh0I3AUpFwHUyoxWIv6EiI4o+8w8m5mmE+EowEchxH4g95rZ1myN1v+IAUR6M3eRwCqAFgM4C8ZeZuyFmHDk9OmpH2+7my4UB7fmj9wwderpWZBDs4mwHOoPmAzwn1hiV7I9+NpIwNQMwOjtvwWC1gLUwVJuIfA+s73lnZE4N3pP3M6gZSTEeoB3Q/JWs735w1psVQ0g/t6xq+T5uogkrCXQKyDebIaCf63FWTlZI525FUydDF4hGFtFYzYZnzvz82psVwVAOSCI7QA3MuMJU9d2VmO8VhnDsh8gwuMAnWfIh6p5QL4AlFEAO5ixp45yj8T1lkytgdUiH7dOBLMceIYIKwGs9ntYFQFELDtGQJyJ1yZDwadqCWS0spF05qfEtJWl7Eq2N8fL2SsLwLBOtgEybeqa7yyNJthYjEVucSYqRN1HCX3GS6W2DMtmQIRMfUaflx/P4GJ9x6+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uXNjLKrZOqAbgGShvdLOitkfKpiuckyQvHpdFd+gQUHQ9B3yPGEhDOAfwGS9pT1asGgldCNTgYk5igCtSL4/aqgddUKnIY4G8xc7ialz2IKAXQ64qcHW22qnkJVetwvF63+T9nAHfjRfzL0gAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-logSave{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA1RJREFUaEPtmT1oFEEUx9/bFLFKJzG2WiknZObFxlO8RtFC8SuFWlrYGBtRRNCghV9YmFQWgoVaaAS1ULRRRKvbmYBBQezVYBOIGFMkT0ZuYXPufOxdspuDO7jibmfe/H/z3sy8eYvQ4R/scP3QBSjbg8EemJyc3La4uHgUETcx82YAWNum+N8A8IWZrxLR41ZtBQForUeY+Xarg/j6MfMVIrroa5f13AuglOJWDLfQ56aU8mzefk4ApdR9ADiW12ir7RFxXAgxkqe/FUBrvYeZXzQbY+bh3t7ed5VKZTrPQM2eNHYQ8VGGjTtSypOhtq0AcRyPIeKptCEppTfkbAM3AxhbcRwfyYJg5nEiCvKEVZBS6hUA7EoEIeJ+IcTz0JlpbpcFYNrYIBDxlhDijG88lwd+IGJ/YoCZ1xPRd5/BUA/Mzc31VavVWRcEM18jovOuMV0eWLL7tBM+RoBS6isAbEzERFFUHRwc/JD8dnjishDikg2iSIAJADiU8uhdIjqRFuZYEweI6Gmuc8AWs6EhVK/XR3t6eg4zMyKiEQ/MvOSwQsS3iHhhZmbmY61W++UIp/dSyu2FAmit3zDzTjMoItaFEFuVUt8AYCB0ElLtZqWUfYUCZHlQKXUQAJ60AAC2Nbhia8AWglprAoB7jYQwmGXVACSKzRqJomgLAJjvBh/JqgPwCQ7dRAoPIZ/w5HkXIHQGQlOHvCd56PjdEOpoD6TShT/MfD19OXeFQCPnOYeIaxYWFiaGhoZGQ9Pv5nZthVA6XWjkOsMJRGj+b/IhIURtVQCkIUJvYKUCONLf/+67tjuw+T+rLlTYLmSDCDmwbOIbF6CgC1Vba8B3m3JBuMQXDuC4iGQy+MSXAhAKESK+NAAfRKj4UgFsEHnElw5gBGit9wFAUqy9kbco1vY2Gsfxsha2QrbV1K42gIimAPDvw8zTRLQuy0ZhpcU8AMZ7zPws1ee1lHJ3LoDlLu7mAcioZFuLvYWV130AU1NT/fPz8zuyqtWIuFcI8TKXBxo7QaEvOCyQD6SUx20T4K33F/iKKVOj7yrqBWhsiSv6ki8zNBBPCyHGfKEXBGCMrMBr1mZtPxHxEzN/jqLoYbr07oIIBvDNRFnPuwBlzXwybsd74C95KWhPrxIhsgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-logSave:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAthJREFUaEPtmTuMTUEYx3//TrWdeLRUJCrReISGUBCvLVAqNGiEiASh8IoClUKyBQqPBAWhsREqnYRE9NgoV0T3yci5m9mzc2bmnHvvOXuTO8ktbs7MN//ffPP45hsx4kUjrp8xQNcezPaAmW0EDgFrgLXA0j7F/wG+AlckPW5qKwvAzE4At5p2ktHusqTzGfUWVEkCmJk1MdygzQ1Jp+u2iwKY2X3gcF2jfdS/I8l5O7tUApjZTuBlwNIk8E7STHYvQMCTzs6jgI27ko7l2o4B3AaO+4YkJadcVcdlAGfLzA5WQGR7IgbwGtjuCdoj6UXuyJTrhQBcnQjETUmnUv3FAH4CyzwDKyX9SBnM9QAwIWk2AXFV0tlYnzGAebtPP9OnEPkNWO2J2STpQ+9/xBOXJF2ogmgT4Amw3xNyT9JRX1gEYq+kZyGIoQGY2UXgAPyPt5x4V8qH1TRwDvgk6XdkOr2XtLltgLfA1qLTj5I2mNl3YEWDdTQraaJtgAVryMz2AU8bAFC1Boc5hYKbgJmtB6aKgDCbZdEAeLuOWyPrit+qFMmiA0gJrjr4yu1an0Ip4Z6Hss6hMUBu6FD3JB9PodwRGGkPeOHCX+CafzmPDUAR85wBlrgwQ5LbUueV3AHsaxGbmR8uOAGTPYga8f+0pG2LBWAOosYNrFOAqith6L5bdQee81optG7nHIjE8DlnVlB8EVa3AxCJ4VMAleJbB2gAERXfCUANiKT4zgAyILLEdwoQgcgW3zlAIWA30EvWXq+bFBvESTzQxFZqSyqdAe7i7xIAvTIjaXnIRmupxZoAznvPvTZvJO2oCzDQ5G5NgPKbRGWyt7X0egrAzFwedktFtnqXpFe1PFAsxLYfOEIaH0g6UjUAyXx/i09MQY2pq2gSoPDEsB/5QuJPSnLrMFqyAAqIQT+zloX9Aj4DX4CHfuo9RpANkBqJrr6PAboa+V6/I++Bf0in3kCazcMZAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoom{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAkUExURUdwTMDAwL+/v7+/v7+/v76+vr+/v7+/v7+/v7+/v7+/v7+/vxtcv/AAAAALdFJOUwBVdZCpGdZE7C3B0wnY6AAAAV9JREFUOMt1lDtPwzAQx20ghGwVsHVJhQRDlsywWKqEULsw8FhRJ2iWiglGGJvFCw8xIVVCSEwkKU25L4ftpOHs2Cclsu7v370smxCLecRh+xOH8Ja5kGEs/6dtYf1XONcWZurbwwRCQjYZ9l7uHAPAOBHpI1QC/QSY9g84ldmnAn7Z3htwsfZnvSe54eJd5hlcC7gccxTwSETZEr5+714vLRdfkFraVNtetXLpR7ha+mkHCV1Y/q8ZOW8AgDkecsIaAEIcGbIGyLUq4KcBYl0o7QAB4FZACBMrQKpaJOCZQqyAIhgayYEpgD1DZghXCvBTNJFKmCvgzmhcCEsBwMjSRx6BslYftRX0JLYKrAsLqzDC54EFMwvy58QhMM8hFNq0UpwET+sLC9/4BmEBTytyRCIbDoAEiR1Qp1dbRxfoyv9g3ogaKVuXhVZZbtqX6Ez6H23PxG4CM259QDwt/h8ABfK8nDqSAAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoom:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwCCyreU7KZVRCDaZnETLwj6WaYVAAABUUlEQVRIx5WV2Q6EIAxFoVBWxf7/184AOnGUsvTBqDmXrqRCzNou1kwGtyZIQNuiD0P6evWTURFUMtIoPO+iVoGIZPkMqkdKA0jZgoJ6suQc2EoiGBldOoQ9HSDk5+GTs1Fqo9IlcEpvNv3qv0MBhSalIFSv3+MCJCY8fUaCxasycrMu9dp5VTUhubXZ6CqsAvn66ZAsx+e8fON37oT3bZ4aiRU0kDlavGSrQI95HPBZACt8FuCL16IruBVkzBeBW+CLYHvyfiDQd96IpHpOMqP++fAq9VMQ7rwrM5+6gjwG/3y/D/m8ylPYpvpAeqO7DfvwMPO9D6jnBabG56YFZx77fEjD+9AyLdYEhp8nxoNh5wmJtfY8AS+wzIZZrJNcC4h3wV8IH1p87Iyfnc6XVaAd7ICHAsebw97zgDSxZ/yvViiPuYUfTe650knM2+7Ywz9yOCklzohLOwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoomStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwDjmTC6Y0KBVakX8s8iC3JYR1wyAAABVUlEQVRIx62V2baFIAiGcwJRS97/aU/Zbtht0VzrcJOuvl/AAabpXy1RF0F/m2h2PX5mzucEuO9gMon1MY7KlG8w4LImC1XFQmxDGVkm1DYpXi0qS1gXTEGzKoqNS1ajAxPqJDikFLcFS+aukYJffRfXnAj9kYUXFVi86wzzPjuCFRXBwS3KaC/Pt02Ww7uf1jz3BVYtX/OsyDQFDn7yswPXb+Ovs39eJJWwxrOXV4thgC+//QBf/uMAXwAa4AuRBvgdWR58CB2B+eaRG5e8QO7Jn2sIAvzhbdsDnXzev8q0BengGXv8EciH3y1CY5++yI/BRNx82g/La7lc7b0Am/tUC6n3HoZ4SbDyy5BgzSNivV6wbPXeIPOpHlOU+CjkTQKvQOpXdRdJvn+5xttWQa4EZUOzluonT6+q72X6Zb0+T/lNhQd7hg9vm8LWUhW5gT4iN7c/0ZUo8Q3AttYAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoomStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAqUExURUdwTBKV2hGW2xKW2xKW2xKW2xGV3BGW2xGW3BGX2xKW3BKW2xCX2xKW2yDN61kAAAANdFJOUwCAVKxm3T/DmhrxKw97YQBGAAABaklEQVQ4y2NgIA6wGqCLMCqAqV4HdIm9F0Ek22UMM9hiG4AkVzQDA+cmx+YyJJnDlw8wMNQaNpfevbu0QgxJgrN3JQPD3VvhjU57kESnOZqvvXuJgcEXxVFMEkDt1w11gZYwoVgue3d5SzaQSgCydZG1TMkBU8vBuq9guBcqNBNDgj0GQrMEb0CVYEmA2ViANRQZ795tQPZduADciXcVUNSthGu4hGrAJawagBIXsWoAClzGqgEocRWrBqDIrQNQDTPRXZ8A0cB41wBNQgGiQfbubTQJAagGDB0GIA0OsnevbkCTCADiu4J374ahW34JqAEIbiXMRJOAgkvMKJYgJBx6717AKiF4F4eOu+jxgQCXGHBIKPDgkBC8JYCURJDtQHYWN4oEcvpZiyR+C9lZtkgSKKG1CyGOGrxItleixjrcLFBWRAYcMIkG9NQMiY67N7AlcxAQwMwA6SBxM2xZQ3jtVRPsRQ83sg8ACMIUxzzE8wsAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-close{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTM3Nzc7Ozs7Ozs3Nzc3NzcrKys3Nzc3Nzc3NzePZJxkAAAAJdFJOUwCtKdPBGAmNTt3jdDcAAADfSURBVDjL1dOxDoIwEADQgwR07GTCZtI/IGHgAzBhM9EPkMTB0Y3V0ZXIcn/rtRR6pefgSKeSu3ellyvA9lZ/5F9p/3K7PZY8oPG5BD6MpPUSgIITzdIStifAshjRQV1PCFT8TxaicTzzwEwINOEdHVmDmcTAkRhMhMAp7iQRjcMtDhCp8SA1v0ARGIIK/gnkv0p1OBTS4QRUIpE7DiYYXTBrzcld3JIrAarXrps4AVNwRSZgExoJmIyAaAdsShUMn/JF2fh4YEkpAcgvnuwYCIb6EbbbP4PsDfLD2dD6Av1qTvAQlzUTAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-close:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTP///////////////////////////////////8kBMKEAAAAJdFJOUwCt0igUwJdJePGbgLgAAADcSURBVDjL1ZMxEoIwFESTCaOWFDapqeicnAALTiANnaWlnVewDTMW/7b+aCAb8jkAVIHN2/lsNkrt73lf8M08nnF1pAYFR/dFmAAx7SIoi4iDbRrWDMAuQFzmmxAGbjjJgjj6dCjMCAND/o8RWQMzUgIRKYE/wsC5TJIRR74rBUZaqqXwLZEXT0WTDGwLW1aavJWQir9qadw++NgykWoMNtcykh8Q5EECgr5C+jjpGjHjPGhPU5eVzyfPJitfnUyhPg6ywMKZ7BygcYcsPCj1Kc8uXYPqpeSLs6PnC4w8S+8OJ9MLAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-narrow{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABm1JREFUaEPVWWuIVVUUXmvfYRosHzUZUUqKjkSXSe5Z+5qJhfawLELCR5ohPhKjjB4EWgkpkopRSWEPS1Mqy7Gkd0iPGaKy6ey9Z3z0opwEQytSMiS5NZ4Ve7j3dubMOfecO96buf/cx17rW+vba52919oH4RQfeIr7DxUjoLW+BhHHAsAAZh5gPwGghpl/TKVSHZ7n7T9+/Ph+ANg/atQo+1mRcUIEtNYzAWAiM09ExLPK8KgNADYw8wYp5Z9l6PUQ7RWBvON3AMClJ2Kcmb9DxAKR33qDVRYBrfUNzLwQESf0xliUDjPvR8T1RLSsXNzEBIwxc5l5fYSBnxGxxfO8bQCwN5VKHc7lcofr6+tzR44cGcTMg4UQgxDRfp8IAJdH4KwlooXlkEhEQGv9EAAsDQF+GwDWEdE75Rg1xlwFADcx83QAOCOg29SvX79ZDQ0NuSSYsQS01h8BwBUBsF45HnTIGHMBM9uFmR2Ya0bEWxzHORBHoiQBY8xmZp4RAFlNRIvigMuZN8asYOb7Azq7hBCTMpnMvlJYkQSMMUuYeblf2fO8ZdlsNiyVyvE3VNZ13XFCiGb/JCK+6DjOrLIJ2N0GAN4KKG4hIpuzVRtKqf6I+HvAwAIiWhdlNDQCSqntga3yUyK6rGqe+4Db2tqu8zzv3cJfiPiLfQYdx/k6zH4PAvlD6iWf8B7P8yZls9mO/4KAtaG1fhgAHvCReN1xnClJCXweOGFLhrAapJqamlLDhg372H9eMPNMKeXmoL1uEVBKTUXEJp+QJiJZDSfjMIOZgIibHMcJbrfdq1Gt9WMAcI8P/D9f/YJtpVQfW7n6isSDRHReyQhorXcCwMV5oWN1dXWD0un04bjVqta81to+i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eJaIV/LimJsgkUjCilLrGXToho33mFrmoMod2I+LLneW9KKb8Nk01CotcE/AaVUmOFENcz8zgAGAIA54Y4dAgADiCifejtjcQnSSIWRgIAniIi+5q3cm/q/c40NzfX9e3bd4gQ4kxEPFhbW3sgnU7/lcThJJHwV8kViUBvHStHz0aCme2qe7W1tasbGxu7rkFPGQKR50Q5q/B/lP0HjgOoT/ydvaYAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-narrow:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABS1JREFUaEPVmgmoVVUUhr+fosKC5ogGSsqIpKQwMqjIBpsICdMGQ7ISo4wGApugJCoxLClssElpNEuaI5okKjOI5onKhEQrSiKiaKA/Vu3zOu+8c88593qvj7fgcO99e6/h33udtdda+4khThri9tM1ALaPAQ4Btso9GwNfAyuBb7JHUnzvCq0XANuTgePSs00bFr0L3BuPpF/b4BswtSMAyfDzgYPXRznweQ7ID53IaguA7ROBGcC4TpRV8IRL3SNpVrtyGwOwfVYoaaHgW2AZsBT4CliXnt+BXYBd02d8D5c7rIWc+ZJigRpTIwC2rwauKZH6NLBA0jONNQK2jwJOAU4FtijwPgpMkRTga6kWgO2XgSMKkjoyvGiN7d3SwpxZGHsVOEPSmjoElQBsPwScVhAyR9LMOsHtjNu+Hri8wPMBMF7SqipZLQHYvgq4tsA8S1KZK7Vjb+lc24cDsfJ5ul/SlLYBpGjzVIFxsaTw2Z6R7S2BnwoKpkta0Epp6Q7YfqEQKl+XdGjPLM8Jtn088GzuT9/FOyjpkzL9AwCkQ+qB3OSPki9GOrBByPZ1wBU5ZY9LOrkpgDcLJ2zlFvYCke2NgFcK58VkSRFU+lG/HbA9EYg4nNE7kkb3wsg6mSWesEhSMdz2z0Zt3wRcnBO+wVc/0217WMpesyRxraSd6nbgfWC/NOm3OP4lRVowKGQ73sXIeDMaJ+nFvDF9LmQ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background-size:100% 100%}.jb-pro-container .jb-pro-icon-expand{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABvJJREFUaEPVWWmIXEUQrnqzZseYxGM9QBNF4hrJEDfzqieuAY/gFRXPyMYbzUHwQBQUzx+KeBAJKhrRqEhEQWMU75AYXREPlunu3bjxIDGraIwiuJpFkL26pMK84eXtm3lvZieGFAzsTtf1VVd3V9Ug7OOE+7j/0BAAnZ2d2UmTJl2cyWTaAOBA+TDzgYjYDAB/y4eZ5fNjc3Pze7NmzfqlUYEbFwBr7TUAcAEzXwAA2bROIeKnzrkNALBeKWXTysXx1QXAGHMVANwEACePxzgzjyLi057nrczn81vr0VUTAGOMRPtmRDy7HmOVZBDxL+fcyr6+vgc7OjqGatGdGoC19hZmfrKC8t9LafEWAGzLZDL9g4OD/S0tLYM7d+6cyszTPM+biojy97kAcGoFPV8ODw8vbG9v354WRCoAxpiXAUDyPUrvAcAqIno/rUHhs9aeCQALmflyAJgUlkXEf5xzp6U9G4kAjDHcKMejeqy1xzDz/QBwXYyNViL6ISkwVQEYY74AgLkRJcuJ6M4kxbWsW2sfZua7ozJNTU1HtLW1/VFNV0UAxpjlAHBHWNg590ChUJCINZyKxeLpnud1RhSvmzJlyiWtra2DFS+AuAW5bQDg3cja60QkObvHSGstj588fGVi5heVUktqAqC1Xh+5Kj8nolP2mOchxd3d3ec55z6I2JpPROvj7I9JodIj9UqIebNz7qJCodD3fwAQG8aYhwDgnpC99UQ0Py2ALyMv7DIiWvV/OS921qxZk5k+ffon4fcCEZf4vv9i1I/ddkBrfSUivhpiMkSkanXeWnsFAFwCADNHR0fX1nPwYzJhAxGdkwTgJUQM38l1Rd8Y8yYAXFoytoOIjqo1CFrriQDwCyIeEsh6nndsPp//KayrvANbt25tHhgY+AsA9i8x/JvNZqfmcrn+Wo1bazuZ+fRAjogSH8w4G8YYOYtSOAZ0GxE9EQvAGCMRk8gF9BYRLajV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lEv0oIi4O9xnVQKQCIEZkTuN53uqgZ4iJmMxrPkTEbXL4AECaceldj3POtSLicVKayP9x0UZEGSY/6vv+V9ZaaVHXpAGRGkBgtFgsnpXJZK6Ly9l6Uqkkcy8RlUsY+S4tiJoBBE5qrU9CxKvlZ1YA2G3UkRJIr4wxnXPvKKXGnLG0IOoGEHZSnn5EvIiZTwKAowEgrh39U2orRJRDLxOJz9IAjdsJAHiGiORn3sb8Uh91ZNOmTQeMjIwcjYgHIeJvEyZM2JHL5Wr6+TSsMwoCEVf4vr+re2zIDqSJ5Hh5BAQzS9R/IiJpf3fRPgOg4jsx3sjsbfn/AH37LF5g3/BiAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-expand:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABYZJREFUaEPVmXmoVVUUxn8f0WRzVkJlIWVGUmIJWWADTVaUldFclCnSQBQYNv1RSCWGVFRSlkRh0GBS2YBmJWGJUBHNNJiYWQSZfwTRxBfrce5jv/3Ovefc++4z3oKLD/fea61v7bXXdMQQJw1x/ekKANs7AOcA44Ddkt/2wJbk9z2wTNIP3TLcgADYvhw4q/gFiLq0ClgBLJf0Ud1DZfs6AmD7UuA64JiBCAf+BR4GHpH0TSe82gJgO6x9PXBqJ8JanPktQABzJP3VDu/aAGzfADzYhPnPQLjFUuA7YHPx+xPYHxhZ/Bt/nw4c14TP+8CFkjbWBVELgO2ngfD3nJYBCyW9Wldg7LN9cigKXATsnJ39HTi+7tuoBGDb3VI852P7QOBO4MoSGaMlfVtlmJYAbL8HHJsxmSdpdhXjdtZt3wPcWnJmhKRfWvFqCsD2PODm7PBdksJiXSfbJwDvZIzfAM6VFG+plEoBFNHmlezEc5LCZweNbEcSjMSX0iJJ09sFsDwLlaslTRo0zRPGts8AXstkTZYUOvWjfjdQJKnFyc7PgCmS1m0NACHD9t3AbYm8yNiT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0EQzHr3rwVGSZP+WGTymD3MlrbEdLerzdUDUBtCQaDvSeXyQKPPZTrwpztwuKS1h4tZrgWgbQALkaOCy4hNrn1FHTRTxdmKQ8LKksjdWC0THADK/jtQ/BQhQBwBl7Wi4VNRWoXhMJN6tA7TJTSyQFJ95u/OlPlfEdjzOALI7EIVgzEfb+nyaGSh3p4h+Pd1jV26gjiUHuqe4ibD6eklRqvfQkAHQzABDHsB/7aMVT352GH8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-menu-icon-text,.jb-pro-container .jb-pro-quality-icon-text,.jb-pro-container .jb-pro-scale-icon-text,.jb-pro-container .jb-pro-speed-icon-text{font-size:14px;min-width:30px;height:20px;line-height:20px;cursor:pointer;text-align:center}.jb-pro-container .jb-pro-speed{box-sizing:border-box;text-align:center;font-size:14px;color:#fff;width:90px}.jb-pro-container .jb-pro-menu-list,.jb-pro-container .jb-pro-quality-menu-list,.jb-pro-container .jb-pro-scale-menu-list,.jb-pro-container .jb-pro-speed-menu-list{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;overflow:hidden;width:-webkit-max-content;width:-moz-max-content;width:max-content}.jb-pro-container .jb-pro-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-speed-menu-shown{visibility:visible;opacity:1}.jb-pro-container .icon-title-tips{pointer-events:none;position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:rgba(0,0,0,.5);border-radius:4px}.jb-pro-container .icon-title{display:inline-block;padding:5px 10px;font-size:12px;white-space:nowrap;color:#fff}.jb-pro-container .jb-pro-quality-menu{padding:8px 0}.jb-pro-container .jb-pro-menu-item,.jb-pro-container .jb-pro-quality-menu-item,.jb-pro-container .jb-pro-scale-menu-item,.jb-pro-container .jb-pro-speed-menu-item{display:block;height:25px;line-height:25px;margin:0;padding:0 10px;cursor:pointer;font-size:14px;text-align:center;width:50px;color:hsla(0,0%,100%,.5);transition:color .3s,background-color .3s}.jb-pro-container .jb-pro-menu-item:hover,.jb-pro-container .jb-pro-quality-menu-item:hover,.jb-pro-container .jb-pro-scale-menu-item:hover,.jb-pro-container .jb-pro-speed-menu-item:hover{background-color:hsla(0,0%,100%,.2)}.jb-pro-container .jb-pro-menu-item:focus,.jb-pro-container .jb-pro-quality-menu-item:focus,.jb-pro-container .jb-pro-scale-menu-item:focus,.jb-pro-container .jb-pro-speed-menu-item:focus{outline:none}.jb-pro-container .jb-pro-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-speed-menu-item-active{color:#2298fc}.jb-pro-container .jb-pro-volume-panel-wrap{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%) translateY(22%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;height:120px;width:50px;overflow:hidden}.jb-pro-container .jb-pro-volume-panel-wrap.jb-pro-volume-panel-wrap-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-volume-panel{cursor:pointer;position:absolute;top:21px;height:60px;width:50px;overflow:hidden}.jb-pro-container .jb-pro-volume-panel-text{position:absolute;left:0;top:0;width:50px;height:20px;line-height:20px;text-align:center;color:#fff;font-size:12px}.jb-pro-container .jb-pro-volume-panel-handle{position:absolute;top:48px;left:50%;width:12px;height:12px;border-radius:12px;margin-left:-6px;background:#fff}.jb-pro-container .jb-pro-volume-panel-handle:before{bottom:-54px;background:#fff}.jb-pro-container .jb-pro-volume-panel-handle:after{bottom:6px;background:hsla(0,0%,100%,.2)}.jb-pro-container .jb-pro-volume-panel-handle:after,.jb-pro-container .jb-pro-volume-panel-handle:before{content:"";position:absolute;display:block;left:50%;width:3px;margin-left:-1px;height:60px}.jb-pro-container.jb-pro-fullscreen-android-rotate .jb-pro-controls,.jb-pro-container.jb-pro-fullscreen-web .jb-pro-controls{width:100vh}.jb-pro-container.jb-pro-fullscreen-android-rotate .jb-pro-play-big:after,.jb-pro-container.jb-pro-fullscreen-web .jb-pro-play-big:after{transform:translate(-50%,-50%) rotate(270deg)}.jb-pro-container.jb-pro-fullscreen-android-rotate .jb-pro-loading,.jb-pro-container.jb-pro-fullscreen-web .jb-pro-loading{flex-direction:row}.jb-pro-container.jb-pro-fullscreen-android-rotate .jb-pro-loading-text,.jb-pro-container.jb-pro-fullscreen-web .jb-pro-loading-text{transform:rotate(270deg)}.jb-pro-container .jb-pro-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;left:10px;top:10px;min-width:200px;padding:5px 0;background-color:rgba(0,0,0,.9);border-radius:3px}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu{cursor:pointer;font-size:12px;display:block;color:#fff;padding:10px 15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-shadow:0 0 2px rgba(0,0,0,.5);border-bottom:1px solid hsla(0,0%,100%,.1)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu a{color:#fff;text-decoration:none}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span{display:inline-block;padding:0 7px}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span.art-current,.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span:hover{color:var(--theme)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu:hover{background-color:hsla(0,0%,100%,.1)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu:last-child{border-bottom:none}.jb-pro-container.jb-pro-contextmenus-show .jb-pro-contextmenus{display:flex}.jb-pro-container .jb-pro-extend-dom{position:relative;width:100%;height:100%;display:none}.jb-pro-container-playback .jb-pro-controls{height:48px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center{flex:1;display:flex;box-sizing:border-box;justify-content:space-between;font-size:12px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time{box-sizing:border-box;flex:1;position:relative;height:100%}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-inner{width:300px;height:100%;overflow-y:hidden;overflow-x:auto}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-current-time{position:absolute;left:0;top:0;height:15px;width:1px;background-color:red;text-align:center;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-current-time-text{position:absolute;box-sizing:border-box;padding:0 5px;width:60px;left:-25px;top:15px;border:1px solid red;height:15px;line-height:15px;cursor:move;background-color:#fff;color:#000;-webkit-user-select:none;-moz-user-select:none;user-select:none}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll{position:relative;width:1440px;margin:0 auto}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.one-hour{width:1440px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.half-hour{width:2880px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.ten-min{width:8640px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.five-min{width:17280px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.one-min{width:86400px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-list{position:relative;background-color:#ccc;height:48px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-day{height:100%;overflow:hidden}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-one-wrap{height:8px;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-wrap{height:25px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-btns{display:flex;align-items:center}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one{float:left;width:1px;height:8px;margin:0;cursor:default;position:relative;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one.active,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one.active{background-color:orange;cursor:pointer}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one.start,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one.start{background-color:#999}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one:hover .jb-pro-playback-time-title-tips,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one:hover .jb-pro-playback-time-title-tips{visibility:visible;opacity:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips{pointer-events:none;position:absolute;left:0;top:100%;visibility:hidden;opacity:0;transform:translateX(13%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:#000;border-radius:4px;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips.jb-pro-playback-time-title-tips-left{transform:translateX(-100%)}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips .jb-pro-playback-time-title{display:inline-block;padding:2px 5px;font-size:12px;white-space:nowrap;color:#fff}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute{float:left;position:relative;width:60px;box-sizing:border-box;border-top:1px solid #999;-webkit-user-select:none;-moz-user-select:none;user-select:none;text-align:left;height:25px;line-height:25px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:first-child,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:first-child{border-left:0}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:first-child .jb-pro-playback-time-hour-text,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:first-child .jb-pro-playback-time-hour-text{left:0}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:after,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:after{content:"";position:absolute;left:0;top:-8px;width:1px;height:14px;background-color:#999}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour-text,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-text{position:absolute;left:-13px}.jb-pro-container-playback .jb-pro-playback-expand.disabled .jb-pro-icon-expand,.jb-pro-container-playback .jb-pro-playback-narrow.disabled .jb-pro-icon-narrow{cursor:no-drop}.jb-pro-container-playback .jb-pro-control-progress-simple{position:absolute;box-sizing:border-box;left:0;top:-2px;width:100%;display:flex;flex-direction:row;align-items:center;height:8px;cursor:pointer}.jb-pro-container-playback .jb-pro-control-progress-simple:hover{top:0;align-items:flex-start}.jb-pro-container-playback .jb-pro-control-progress-simple:hover .jb-pro-control-progress-inner{height:100%}.jb-pro-container-playback .jb-pro-control-progress-simple:hover .jb-pro-control-progress-inner .jb-pro-progress-indicator{transform:scale(1);visibility:visible}.jb-pro-container-playback .jb-pro-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:all .2s ease;background:hsla(0,0%,100%,.5)}.jb-pro-container-playback .jb-pro-progress-hover{display:none;width:0}.jb-pro-container-playback .jb-pro-progress-played{position:absolute;left:0;top:0;right:0;bottom:0;height:100%;width:0;background-color:orange}.jb-pro-container-playback .jb-pro-progress-indicator{visibility:hidden;align-items:center;justify-content:center;position:absolute;z-index:40;border-radius:50%;transform:scale(.1);transition:transform .1s ease-in-out}.jb-pro-container-playback .jb-pro-progress-indicator .jb-pro-icon{width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.jb-pro-container-playback .jb-pro-progress-indicator:hover{transform:scale(1.2)!important}.jb-pro-container-playback .jb-pro-progress-tip{display:none;position:absolute;z-index:50;top:-25px;left:0;height:20px;padding:0 5px;line-height:20px;color:#fff;font-size:12px;text-align:center;background:rgba(0,0,0,.7);border-radius:3px;font-weight:700;white-space:nowrap}.jb-pro-container-playback.jb-pro-fullscreen-web .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-playback-time-inner{overflow-y:auto}.jb-pro-zoom-control{cursor:-webkit-grab;cursor:grab}.jb-pro-performance-panel{position:absolute;box-sizing:border-box;z-index:10000;left:0;top:0;padding:5px;font-size:10px;background:rgba(0,0,0,.2);color:#fff;max-height:100%;overflow-y:auto;display:none}.jb-pro-performance-panel .jb-pro-performance-item{display:flex;align-items:center;margin-top:3px;color:#fff}.jb-pro-performance-panel .jb-pro-performance-item-block{height:10px}.jb-pro-tips-message{position:absolute;top:0;left:0;width:100%;height:100%;background:linear-gradient(180deg,rgba(0,0,0,.8),hsla(0,0%,100%,0));overflow:auto;box-sizing:content-box;display:none}.jb-pro-tips-message:before{color:hsla(0,0%,100%,.3);content:"X";font-family:Arial,Helvetica,sans-serif;font-size:40px;left:0;line-height:1;margin-top:-20px;position:absolute;text-shadow:2em 2em 4em #000;text-align:center;top:50%;vertical-align:middle;width:100%}.jb-pro-tips-message .jb-pro-tips-message-close{position:absolute;z-index:99999;right:0;top:0;width:40px;height:40px;display:flex;align-items:center;justify-content:center}.jb-pro-tips-message .jb-pro-tips-message-close .jb-pro-tips-message-close-icon{width:20px;height:20px;border-radius:10px;cursor:pointer;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTM3Nzc7Ozs7Ozs3Nzc3NzcrKys3Nzc3Nzc3NzePZJxkAAAAJdFJOUwCtKdPBGAmNTt3jdDcAAADfSURBVDjL1dOxDoIwEADQgwR07GTCZtI/IGHgAzBhM9EPkMTB0Y3V0ZXIcn/rtRR6pefgSKeSu3ellyvA9lZ/5F9p/3K7PZY8oPG5BD6MpPUSgIITzdIStifAshjRQV1PCFT8TxaicTzzwEwINOEdHVmDmcTAkRhMhMAp7iQRjcMtDhCp8SA1v0ARGIIK/gnkv0p1OBTS4QRUIpE7DiYYXTBrzcld3JIrAarXrps4AVNwRSZgExoJmIyAaAdsShUMn/JF2fh4YEkpAcgvnuwYCIb6EbbbP4PsDfLD2dD6Av1qTvAQlzUTAAAAAElFTkSuQmCC") no-repeat 50%;background-color:#fff;background-size:100% 100%}.jb-pro-tips-message .jb-pro-tips-message-content{overflow:auto;padding:35px;box-sizing:border-box;width:100%;height:100%;z-index:99999}.jb-pro-tips-message .jb-pro-tips-message-content .jb-pro-tips-message-content-item{font-size:14px;color:#fff;text-align:center;line-height:1.5}');class nc{constructor(e){var t;this.player=e,this.TAG_NAME="Control",this.extendBtnList=[],((e,t)=>{e._opt.hasControl&&e._opt.controlAutoHide?e.$container.classList.add("jb-pro-controls-show-auto-hide"):e.$container.classList.add("jb-pro-controls-show");const i=e._opt,s=i.operateBtns,r=`\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
00:00:00
\n
\n
\n
\n
\n ${i.playbackConfig.showPrecisionBtn?`\n
\n
${Hh.narrow}
\n
${Hh.expand}
\n
\n `:""}\n
\n `;e.$container.insertAdjacentHTML("beforeend",`\n ${i.background?`
`:""}\n
\n \n
\n ${i.loadingIcon?`\n
\n ${Hh.loading}\n
${i.loadingText}
\n
\n `:""}\n ${i.hasControl&&s.play?'
':""}\n ${i.hasControl&&s.ptz?`\n
\n
\n
\n
\n
\n
\n ${i.ptzMoreArrowShow?'\n
\n
\n
\n
\n ':""}\n
\n
\n ${i.ptzZoomShow?'\n
\n
\n \n \n 缩放+\n \n
\n
\n \n \n 缩放-\n \n
\n
\n ':""}\n ${i.ptzApertureShow?'\n
\n
\n \n \n 光圈+\n \n
\n
\n \n \n 光圈-\n \n
\n
\n ':""}\n ${i.ptzFocusShow?'\n
\n
\n \n \n 聚焦+\n \n
\n
\n \n \n 聚焦-\n \n
\n
\n ':""}\n ${i.ptzCruiseShow?'\n
\n
\n \n \n 巡航开\n \n
\n
\n \n \n 巡航关\n \n
\n
\n ':""}\n ${i.ptzFogShow?'\n
\n
\n \n \n 透雾开\n \n
\n
\n \n \n 透雾关\n \n
\n
\n ':""}\n\n ${i.ptzWiperShow?'\n
\n
\n \n \n 雨刷开\n \n
\n
\n \n \n 雨刷关\n \n
\n
\n ':""}\n
\n
\n `:""}\n ${i.hasVideo?`\n
\n
${Hh.narrow}
\n
电子放大
\n
${Hh.expand}
\n
${Hh.zoomStop}
\n
\n
\n
\n
00:00:00
\n
${Hh.recordStop}
\n
\n `:""}\n\n ${i.hasControl?`\n
\n
\n
\n ${i.showBandwidth?'
':""}\n
\n
${i.controlHtml}
\n
\n ${i.playType===_&&i.playbackConfig.showControl&&i.playbackConfig.controlType===Q.normal?r:""}\n ${i.playType===_&&i.playbackConfig.showControl&&i.playbackConfig.controlType===Q.simple?'\n
\n
\n
\n
\n
\n
00:00
\n
\n
\n ':""}\n
\n ${i.playType===_&&i.playbackConfig.showRateBtn?'\n
\n
\n
\n
\n
\n
\n ':""}\n ${s.close?`
${Hh.close}
`:""}\n ${s.logSave?`
${Hh.logSave}
`:""}\n ${s.performance?`
${Hh.performance}
${Hh.performanceActive}
`:""}\n ${s.aiFace?`
${Hh.face}
${Hh.faceActive}
`:""}\n ${s.aiObject?`
${Hh.object}
${Hh.objectActive}
`:""}\n ${s.aiOcclusion?`
${Hh.occlusion}
${Hh.occlusionActive}
`:""}\n ${s.quality?'\n
\n
\n
\n
\n
\n
\n ':""}\n ${s.scale?'\n
\n
\n
\n
\n
\n
\n ':""}\n ${s.audio?`\n
\n
\n ${Hh.audio}\n ${Hh.mute}\n
\n
\n
\n
\n
\n
\n
\n
\n `:""}\n ${s.play?`
${Hh.play}
${Hh.pause}
`:""}\n ${s.screenshot?`
${Hh.screenshot}
`:""}\n ${s.record?`
${Hh.record}
${Hh.recordStop}
`:""}\n ${s.ptz?`
${Hh.ptz}
${Hh.ptzActive}
`:""}\n ${s.zoom?`
${Hh.zoom}
${Hh.zoomStop}
`:""}\n ${s.fullscreen?`
${Hh.fullscreen}
${Hh.fullscreenExit}
`:""}\n
\n
\n
\n `:""}\n
\n
\n
\n
\n
\n
\n
\n
\n `),Object.defineProperty(t,"$poster",{value:e.$container.querySelector(".jb-pro-poster"),configurable:!0}),Object.defineProperty(t,"$loadingBg",{value:e.$container.querySelector(".jb-pro-loading-bg"),configurable:!0}),Object.defineProperty(t,"$loadingBgImage",{value:e.$container.querySelector(".jb-pro-loading-bg-image"),configurable:!0}),Object.defineProperty(t,"$loading",{value:e.$container.querySelector(".jb-pro-loading"),configurable:!0}),Object.defineProperty(t,"$loadingText",{value:e.$container.querySelector(".jb-pro-loading-text"),configurable:!0}),Object.defineProperty(t,"$play",{value:e.$container.querySelector(".jb-pro-play"),configurable:!0}),Object.defineProperty(t,"$playBig",{value:e.$container.querySelector(".jb-pro-play-big"),configurable:!0}),Object.defineProperty(t,"$recording",{value:e.$container.querySelector(".jb-pro-recording"),configurable:!0}),Object.defineProperty(t,"$recordingTime",{value:e.$container.querySelector(".jb-pro-recording-time"),configurable:!0}),Object.defineProperty(t,"$recordingStop",{value:e.$container.querySelector(".jb-pro-recording-stop"),configurable:!0}),Object.defineProperty(t,"$pause",{value:e.$container.querySelector(".jb-pro-pause"),configurable:!0}),Object.defineProperty(t,"$controls",{value:e.$container.querySelector(".jb-pro-controls"),configurable:!0}),Object.defineProperty(t,"$controlsInner",{value:e.$container.querySelector(".jb-pro-controls-bottom"),configurable:!0}),Object.defineProperty(t,"$controlsLeft",{value:e.$container.querySelector(".jb-pro-controls-left"),configurable:!0}),Object.defineProperty(t,"$controlsRight",{value:e.$container.querySelector(".jb-pro-controls-right"),configurable:!0}),Object.defineProperty(t,"$volume",{value:e.$container.querySelector(".jb-pro-volume"),configurable:!0}),Object.defineProperty(t,"$volumePanelWrap",{value:e.$container.querySelector(".jb-pro-volume-panel-wrap"),configurable:!0}),Object.defineProperty(t,"$volumePanelText",{value:e.$container.querySelector(".jb-pro-volume-panel-text"),configurable:!0}),Object.defineProperty(t,"$volumePanel",{value:e.$container.querySelector(".jb-pro-volume-panel"),configurable:!0}),Object.defineProperty(t,"$volumeHandle",{value:e.$container.querySelector(".jb-pro-volume-panel-handle"),configurable:!0}),Object.defineProperty(t,"$volumeOn",{value:e.$container.querySelector(".jb-pro-icon-audio"),configurable:!0}),Object.defineProperty(t,"$volumeOff",{value:e.$container.querySelector(".jb-pro-icon-mute"),configurable:!0}),Object.defineProperty(t,"$fullscreen",{value:e.$container.querySelector(".jb-pro-fullscreen"),configurable:!0}),Object.defineProperty(t,"$fullscreenExit",{value:e.$container.querySelector(".jb-pro-fullscreen-exit"),configurable:!0}),Object.defineProperty(t,"$record",{value:e.$container.querySelector(".jb-pro-record"),configurable:!0}),Object.defineProperty(t,"$recordStop",{value:e.$container.querySelector(".jb-pro-record-stop"),configurable:!0}),Object.defineProperty(t,"$screenshot",{value:e.$container.querySelector(".jb-pro-screenshot"),configurable:!0}),Object.defineProperty(t,"$speed",{value:e.$container.querySelector(".jb-pro-speed"),configurable:!0}),Object.defineProperty(t,"$controlHtml",{value:e.$container.querySelector(".jb-pro-controls-item-html"),configurable:!0}),Object.defineProperty(t,"$playbackTime",{value:e.$container.querySelector(".jb-pro-controls-playback-time"),configurable:!0}),Object.defineProperty(t,"$playbackTimeInner",{value:e.$container.querySelector(".jb-pro-controls-playback-time-inner"),configurable:!0}),Object.defineProperty(t,"$playbackTimeScroll",{value:e.$container.querySelector(".jb-pro-controls-playback-time-scroll"),configurable:!0}),Object.defineProperty(t,"$playbackTimeList",{value:e.$container.querySelector(".jb-pro-controls-playback-time-list"),configurable:!0}),Object.defineProperty(t,"$playbackTimeListOne",{value:e.$container.querySelector(".jb-pro-playback-time-one-wrap"),configurable:!0}),Object.defineProperty(t,"$playbackTimeListSecond",{value:e.$container.querySelector(".jb-pro-playback-time-second-wrap"),configurable:!0}),Object.defineProperty(t,"$playbackCurrentTime",{value:e.$container.querySelector(".jb-pro-controls-playback-current-time"),configurable:!0}),Object.defineProperty(t,"$playbackCurrentTimeText",{value:e.$container.querySelector(".jb-pro-controls-playback-current-time-text"),configurable:!0}),Object.defineProperty(t,"$controlsPlaybackBtns",{value:e.$container.querySelector(".jb-pro-controls-playback-btns"),configurable:!0}),Object.defineProperty(t,"$playbackNarrow",{value:e.$container.querySelector(".jb-pro-playback-narrow"),configurable:!0}),Object.defineProperty(t,"$playbackExpand",{value:e.$container.querySelector(".jb-pro-playback-expand"),configurable:!0}),Object.defineProperty(t,"$ptz",{value:e.$container.querySelector(".jb-pro-ptz"),configurable:!0}),Object.defineProperty(t,"$ptzActive",{value:e.$container.querySelector(".jb-pro-ptz-active"),configurable:!0}),Object.defineProperty(t,"$ptzControl",{value:e.$container.querySelector(".jb-pro-ptz-controls"),configurable:!0}),Object.defineProperty(t,"$ptzBgActive",{value:e.$container.querySelector(".jb-pro-ptz-bg-active"),configurable:!0}),Object.defineProperty(t,"$ptzControlCircular",{value:e.$container.querySelector(".jb-pro-ptz-control"),configurable:!0}),Object.defineProperty(t,"$ptzArrows",{value:e.$container.querySelectorAll(".jb-pro-ptz-arrow"),configurable:!0}),Object.defineProperty(t,"$ptzExpand",{value:e.$container.querySelector(".jb-pro-ptz-expand"),configurable:!0}),Object.defineProperty(t,"$ptzNarrow",{value:e.$container.querySelector(".jb-pro-ptz-narrow"),configurable:!0}),Object.defineProperty(t,"$ptzApertureFar",{value:e.$container.querySelector(".jb-pro-ptz-aperture-far"),configurable:!0}),Object.defineProperty(t,"$ptzApertureNear",{value:e.$container.querySelector(".jb-pro-ptz-aperture-near"),configurable:!0}),Object.defineProperty(t,"$ptzFocusFar",{value:e.$container.querySelector(".jb-pro-ptz-focus-far"),configurable:!0}),Object.defineProperty(t,"$ptzFocusNear",{value:e.$container.querySelector(".jb-pro-ptz-focus-near"),configurable:!0}),Object.defineProperty(t,"$ptzCruisePlay",{value:e.$container.querySelector(".jb-pro-ptz-cruise-play"),configurable:!0}),Object.defineProperty(t,"$ptzCruisePause",{value:e.$container.querySelector(".jb-pro-ptz-cruise-pause"),configurable:!0}),Object.defineProperty(t,"$ptzFogOpen",{value:e.$container.querySelector(".jb-pro-ptz-fog-open"),configurable:!0}),Object.defineProperty(t,"$ptzFogClose",{value:e.$container.querySelector(".jb-pro-ptz-fog-close"),configurable:!0}),Object.defineProperty(t,"$ptzWiperOpen",{value:e.$container.querySelector(".jb-pro-ptz-wiper-open"),configurable:!0}),Object.defineProperty(t,"$ptzWiperClose",{value:e.$container.querySelector(".jb-pro-ptz-wiper-close"),configurable:!0}),Object.defineProperty(t,"$qualityText",{value:e.$container.querySelector(".jb-pro-quality-icon-text"),configurable:!0}),Object.defineProperty(t,"$qualityMenu",{value:e.$container.querySelector(".jb-pro-quality-menu"),configurable:!0}),Object.defineProperty(t,"$qualityMenuList",{value:e.$container.querySelector(".jb-pro-quality-menu-list"),configurable:!0}),Object.defineProperty(t,"$scaleText",{value:e.$container.querySelector(".jb-pro-scale-icon-text"),configurable:!0}),Object.defineProperty(t,"$scaleMenu",{value:e.$container.querySelector(".jb-pro-scale-menu"),configurable:!0}),Object.defineProperty(t,"$scaleMenuList",{value:e.$container.querySelector(".jb-pro-scale-menu-list"),configurable:!0}),Object.defineProperty(t,"$zoom",{value:e.$container.querySelector(".jb-pro-zoom"),configurable:!0}),Object.defineProperty(t,"$zoomStop",{value:e.$container.querySelector(".jb-pro-zoom-stop"),configurable:!0}),Object.defineProperty(t,"$zoomNarrow",{value:e.$container.querySelector(".jb-pro-zoom-narrow"),configurable:!0}),Object.defineProperty(t,"$zoomExpand",{value:e.$container.querySelector(".jb-pro-zoom-expand"),configurable:!0}),Object.defineProperty(t,"$zoomStop2",{value:e.$container.querySelector(".jb-pro-zoom-stop2"),configurable:!0}),Object.defineProperty(t,"$close",{value:e.$container.querySelector(".jb-pro-close"),configurable:!0}),Object.defineProperty(t,"$zoomControls",{value:e.$container.querySelector(".jb-pro-zoom-controls"),configurable:!0}),Object.defineProperty(t,"$performancePanel",{value:e.$container.querySelector(".jb-pro-performance-panel"),configurable:!0}),Object.defineProperty(t,"$performance",{value:e.$container.querySelector(".jb-pro-performance"),configurable:!0}),Object.defineProperty(t,"$performanceActive",{value:e.$container.querySelector(".jb-pro-performance-active"),configurable:!0}),Object.defineProperty(t,"$faceDetect",{value:e.$container.querySelector(".jb-pro-face"),configurable:!0}),Object.defineProperty(t,"$faceDetectActive",{value:e.$container.querySelector(".jb-pro-face-active"),configurable:!0}),Object.defineProperty(t,"$objectDetect",{value:e.$container.querySelector(".jb-pro-object"),configurable:!0}),Object.defineProperty(t,"$objectDetectActive",{value:e.$container.querySelector(".jb-pro-object-active"),configurable:!0}),Object.defineProperty(t,"$occlusionDetect",{value:e.$container.querySelector(".jb-pro-occlusion"),configurable:!0}),Object.defineProperty(t,"$occlusionDetectActive",{value:e.$container.querySelector(".jb-pro-occlusion-active"),configurable:!0}),Object.defineProperty(t,"$contextmenus",{value:e.$container.querySelector(".jb-pro-contextmenus"),configurable:!0}),Object.defineProperty(t,"$speedText",{value:e.$container.querySelector(".jb-pro-speed-icon-text"),configurable:!0}),Object.defineProperty(t,"$speedMenu",{value:e.$container.querySelector(".jb-pro-speed-menu"),configurable:!0}),Object.defineProperty(t,"$speedMenuList",{value:e.$container.querySelector(".jb-pro-speed-menu-list"),configurable:!0}),Object.defineProperty(t,"$logSave",{value:e.$container.querySelector(".jb-pro-logSave"),configurable:!0}),Object.defineProperty(t,"$playbackProgress",{value:e.$container.querySelector(".jb-pro-control-progress-simple"),configurable:!0}),Object.defineProperty(t,"$playbackProgressTip",{value:e.$container.querySelector(".jb-pro-progress-tip"),configurable:!0}),Object.defineProperty(t,"$playbackProgressHover",{value:e.$container.querySelector(".jb-pro-progress-hover"),configurable:!0}),Object.defineProperty(t,"$playbackProgressPlayed",{value:e.$container.querySelector(".jb-pro-progress-played"),configurable:!0}),Object.defineProperty(t,"$playbackProgressIndicator",{value:e.$container.querySelector(".jb-pro-progress-indicator"),configurable:!0}),Object.defineProperty(t,"$playbackProgressTime",{value:e.$container.querySelector(".jb-pro-playback-control-time"),configurable:!0}),Object.defineProperty(t,"$tipsMessage",{value:e.$container.querySelector(".jb-pro-tips-message"),configurable:!0}),Object.defineProperty(t,"$tipsMessageClose",{value:e.$container.querySelector(".jb-pro-tips-message-close"),configurable:!0}),Object.defineProperty(t,"$tipsMessageContent",{value:e.$container.querySelector(".jb-pro-tips-message-content"),configurable:!0})})(e,this),e._opt.extendOperateBtns.length>0&&e._opt.extendOperateBtns.forEach((e=>{this.addExtendBtn(e)})),e._opt.extendDomConfig&&e._opt.extendDomConfig.html&&this.addExtendDom(e._opt.extendDomConfig),t=this,Object.defineProperty(t,"controlsRect",{get:()=>t.$controls&&t.$controls.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsInnerRect",{get:()=>t.$controlsInner&&t.$controlsInner.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsLeftRect",{get:()=>t.$controlsLeft&&t.$controlsLeft.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsRightRect",{get:()=>t.$controlsRight&&t.$controlsRight.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsPlaybackTimeInner",{get:()=>t.$playbackTimeInner&&t.$playbackTimeInner.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsPlaybackBtnsRect",{get:()=>t.$controlsPlaybackBtns&&t.$controlsPlaybackBtns.getBoundingClientRect()||{width:0},configurable:!0}),oc(e,this),((e,t)=>{const{events:{proxy:i},debug:s}=e,r=e._opt,o=r.operateBtns;function a(e){const{bottom:i,height:s}=t.$volumePanel.getBoundingClientRect(),{height:r}=t.$volumeHandle.getBoundingClientRect();return eo(i-e.y-r/2,0,s-r/2)/(s-r)}function n(i){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];i.composedPath().indexOf(e.$container)>-1?t.isFocus=!0:t.isFocus=!1,s&&!e.fullscreen&&e._opt.hasControl&&e._opt.controlAutoHide&&(t.isFocus?(to(t.$controls,"display","block"),d()):(h(),to(t.$controls,"display","none")))}if(lo()?i(window,["click","contextmenu"],(e=>{e.stopPropagation(),n(e)})):i(window,"click",(e=>{e.stopPropagation(),n(e,!0)})),i(t.$controls,"click",(e=>{e.stopPropagation()})),o.play&&(i(t.$pause,"click",(t=>{r.playType===_&&r.playbackConfig.uiUsePlaybackPause?e.playbackPause=!0:qo(o.pauseFn)?o.pauseFn():e.pauseForControl()})),i(t.$play,"click",(t=>{r.playType===_&&e.playbackPause?e.playbackPause=!1:qo(o.playFn)?o.playFn():e.playForControl().then((()=>{e.resumeAudioAfterPause()}))}))),i(t.$playBig,"click",(t=>{r.playType===_&&e.playbackPause?e.playbackPause=!1:qo(o.playFn)?o.playFn():e.playForControl().then((()=>{e.resumeAudioAfterPause()}))})),o.screenshot&&i(t.$screenshot,"click",(t=>{t.stopPropagation(),qo(o.screenshotFn)?o.screenshotFn():e.video.screenshot()})),o.audio&&(lo()&&(i(t.$volume,"mouseover",(()=>{t.$volumePanelWrap.classList.add("jb-pro-volume-panel-wrap-show")})),i(t.$volume,"mouseout",(()=>{t.$volumePanelWrap.classList.remove("jb-pro-volume-panel-wrap-show")})),i(t.$volumePanel,"click",(t=>{t.stopPropagation(),e.volume=a(t)})),i(t.$volumeHandle,"mousedown",(e=>{e.stopPropagation(),t.isVolumeDroging=!0})),i(t.$volumeHandle,"mousemove",(i=>{t.isVolumeDroging&&(e.volume=a(i))})),i(document,"mouseup",(()=>{t.isVolumeDroging&&(t.isVolumeDroging=!1)}))),i(t.$volumeOn,"click",(i=>{i.stopPropagation(),to(t.$volumeOn,"display","none"),to(t.$volumeOff,"display","block");const s=e.volume;e.volume=0,e._lastVolume=lo()?s:1})),i(t.$volumeOff,"click",(i=>{i.stopPropagation(),to(t.$volumeOn,"display","block"),to(t.$volumeOff,"display","none"),e.volume=lo()?e.lastVolume||.5:1}))),o.record&&(i(t.$record,"click",(t=>{t.stopPropagation(),qo(o.recordFn)?o.recordFn():e.recording=!0})),i(t.$recordStop,"click",(t=>{t.stopPropagation(),qo(o.recordStopFn)?o.recordStopFn():e.recording=!1}))),i(t.$recordingStop,"click",(t=>{t.stopPropagation(),qo(o.recordStopFn)?o.recordStopFn():e.recording=!1})),o.fullscreen&&(i(t.$fullscreen,"click",(t=>{t.stopPropagation(),qo(o.fullscreenFn)?o.fullscreenFn():e.fullscreen=!0})),i(t.$fullscreenExit,"click",(t=>{t.stopPropagation(),qo(o.fullscreenExitFn)?o.fullscreenExitFn():e.fullscreen=!1}))),o.ptz){i(t.$ptz,"click",(e=>{e.stopPropagation(),to(t.$ptzActive,"display","flex"),to(t.$ptz,"display","none"),t.$ptzControl.classList.add("jb-pro-ptz-controls-show")})),i(t.$ptzActive,"click",(e=>{e.stopPropagation(),to(t.$ptz,"display","flex"),to(t.$ptzActive,"display","none"),t.$ptzControl.classList.remove("jb-pro-ptz-controls-show")}));const c=_a();if(t.$ptzArrows.forEach((s=>{if(r.ptzClickType===K)i(s,"click",(i=>{i.stopPropagation();const s=i.currentTarget.dataset.arrow;t.$ptzBgActive.classList.add("jb-pro-ptz-bg-active-show"),t.$ptzBgActive.classList.add(`jb-pro-ptz-bg-active-${s}`),t.$ptzControlCircular.classList.add(`jb-pro-ptz-control-${s}`),e.emit(ot.ptz,pa(s)),setTimeout((()=>{t.$ptzBgActive.classList.remove("jb-pro-ptz-bg-active-show"),Di.forEach((e=>{t.$ptzBgActive.classList.remove(`jb-pro-ptz-bg-active-${e}`),t.$ptzControlCircular.classList.remove(`jb-pro-ptz-control-${e}`)})),e.emit(ot.ptz,xi)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Y){let r=!1;i(s,c.down,(i=>{i.stopPropagation(),r=!0;const s=i.currentTarget.dataset.arrow;t.$ptzBgActive.classList.add("jb-pro-ptz-bg-active-show"),t.$ptzBgActive.classList.add(`jb-pro-ptz-bg-active-${s}`),t.$ptzControlCircular.classList.add(`jb-pro-ptz-control-${s}`),e.emit(ot.ptz,pa(s))}));const o=()=>{r=!1,t.$ptzBgActive.classList.remove("jb-pro-ptz-bg-active-show"),Di.forEach((e=>{t.$ptzBgActive.classList.remove(`jb-pro-ptz-bg-active-${e}`),t.$ptzControlCircular.classList.remove(`jb-pro-ptz-control-${e}`)})),e.emit(ot.ptz,xi)};i(s,c.up,(e=>{e.stopPropagation(),r&&o()})),i(window,c.up,(e=>{e.stopPropagation(),r&&o()}))}})),r.ptzZoomShow)if(r.ptzClickType===K)i(t.$ptzExpand,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Pi),setTimeout((()=>{e.emit(ot.ptz,xi)}),1e3*r.ptzStopEmitDelay)})),i(t.$ptzNarrow,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Bi),setTimeout((()=>{e.emit(ot.ptz,xi)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Y){let u=!1,p=!1;i(t.$ptzExpand,c.down,(t=>{t.stopPropagation(),u=!0,e.emit(ot.ptz,Pi)})),i(t.$ptzNarrow,c.down,(t=>{t.stopPropagation(),p=!0,e.emit(ot.ptz,Bi)}));const f=()=>{u=!1,p=!1,e.emit(ot.ptz,xi)};i(t.$ptzExpand,c.up,(e=>{e.stopPropagation(),u&&f()})),i(t.$ptzNarrow,c.up,(e=>{e.stopPropagation(),p&&f()})),i(window,c.up,(e=>{e.stopPropagation(),(u||p)&&f()}))}if(r.ptzApertureShow)if(r.ptzClickType===K)i(t.$ptzApertureFar,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Ii),setTimeout((()=>{e.emit(ot.ptz,Ri)}),1e3*r.ptzStopEmitDelay)})),i(t.$ptzApertureNear,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Mi),setTimeout((()=>{e.emit(ot.ptz,Ri)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Y){let m=!1,g=!1;i(t.$ptzApertureFar,c.down,(t=>{t.stopPropagation(),m=!0,e.emit(ot.ptz,Ii)})),i(t.$ptzApertureNear,c.down,(t=>{t.stopPropagation(),g=!0,e.emit(ot.ptz,Mi)}));const y=()=>{m=!1,g=!1,e.emit(ot.ptz,Ri)};i(t.$ptzApertureFar,c.up,(e=>{e.stopPropagation(),m&&y()})),i(t.$ptzApertureNear,c.up,(e=>{e.stopPropagation(),g&&y()})),i(window,c.up,(e=>{e.stopPropagation(),(m||g)&&y()}))}if(r.ptzFocusShow)if(r.ptzClickType===K)i(t.$ptzFocusFar,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Fi),setTimeout((()=>{e.emit(ot.ptz,Ri)}),1e3*r.ptzStopEmitDelay)})),i(t.$ptzFocusNear,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Ui),setTimeout((()=>{e.emit(ot.ptz,Ri)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Y){let A=!1,b=!1;i(t.$ptzFocusFar,c.down,(t=>{t.stopPropagation(),A=!0,e.emit(ot.ptz,Fi)})),i(t.$ptzFocusNear,c.down,(t=>{t.stopPropagation(),b=!0,e.emit(ot.ptz,Ui)}));const v=()=>{A=!1,b=!1,e.emit(ot.ptz,Ri)};i(t.$ptzFocusFar,c.up,(e=>{e.stopPropagation(),A&&v()})),i(t.$ptzFocusNear,c.up,(e=>{e.stopPropagation(),b&&v()})),i(window,c.up,(e=>{e.stopPropagation(),(A||b)&&v()}))}if(r.ptzCruiseShow&&(i(t.$ptzCruisePlay,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Oi)})),i(t.$ptzCruisePause,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Ni)}))),r.ptzFogShow&&(i(t.$ptzFogOpen,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,ji)})),i(t.$ptzFogClose,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Gi)}))),r.ptzWiperShow&&(i(t.$ptzWiperOpen,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,zi)})),i(t.$ptzWiperClose,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Wi)}))),r.ptzSupportDraggable){function S(){t.isPtzControlDroging&&(t.isPtzControlDroging=!1,t.$ptzControl.style.cursor="grab",t.tempPtzPosition={x:0,y:0})}t.isPtzControlDroging=!1,t.tempPtzPosition={x:0,y:0},i(t.$ptzControl,c.down,(e=>{e.stopPropagation(),t.isPtzControlDroging=!0,t.$ptzControl.style.cursor="grabbing";const{posX:i,posY:s}=Ko(e);t.tempPtzPosition={x:i,y:s}})),i(t.$ptzControl,c.move,(e=>{if(t.isPtzControlDroging){e.stopPropagation();const{posX:i,posY:s}=Ko(e),r=t.tempPtzPosition.x-i,o=t.tempPtzPosition.y-s;t.$ptzControl.style.left=t.$ptzControl.offsetLeft-r+"px",t.$ptzControl.style.top=t.$ptzControl.offsetTop-o+"px",t.tempPtzPosition={x:i,y:s}}})),i(t.$ptzControl,c.up,(e=>{e.stopPropagation(),S()})),i(window,c.up,(e=>{e.stopPropagation(),S()}))}}o.performance&&(i(t.$performance,"click",(t=>{t.stopPropagation(),e.togglePerformancePanel(!0)})),i(t.$performanceActive,"click",(t=>{t.stopPropagation(),e.togglePerformancePanel(!1)}))),o.logSave&&i(t.$logSave,"click",(t=>{t.stopPropagation(),e.downloadMemoryLog()})),o.aiFace&&(i(t.$faceDetect,"click",(t=>{t.stopPropagation(),e.faceDetect(!0)})),i(t.$faceDetectActive,"click",(t=>{t.stopPropagation(),e.faceDetect(!1)}))),o.aiObject&&(i(t.$objectDetect,"click",(t=>{t.stopPropagation(),e.objectDetect(!0)})),i(t.$objectDetectActive,"click",(t=>{t.stopPropagation(),e.objectDetect(!1)}))),o.aiOcclusion&&(i(t.$occlusionDetect,"click",(t=>{t.stopPropagation(),e.occlusionDetect(!0)})),i(t.$occlusionDetectActive,"click",(t=>{t.stopPropagation(),e.occlusionDetect(!1)})));let l=null;const d=()=>{h(),l=setTimeout((()=>{to(t.$controls,"display","none")}),1e3*e._opt.controlAutoHideDelayTime)},h=()=>{l&&(clearTimeout(l),l=null)};if(e._opt.hasControl&&e._opt.controlAutoHide&&lo()&&(i(e.$container,"mouseover",(()=>{e.fullscreen||(to(t.$controls,"display","block"),d())})),i(e.$container,"mousemove",(()=>{e.$container&&t.$controls&&(e.fullscreen,"none"===t.$controls.style.display&&(to(t.$controls,"display","block"),d()))})),i(e.$container,"mouseout",(()=>{h(),to(t.$controls,"display","none")}))),e._opt.playType===_){let E=e._opt.playbackConfig.controlType;e._opt.playbackConfig.showRateBtn&&(i(t.$speedMenu,"mouseover",(()=>{t.$speedMenuList.classList.add("jb-pro-speed-menu-shown")})),i(t.$speedMenu,"mouseout",(()=>{t.$speedMenuList.classList.remove("jb-pro-speed-menu-shown")})),i(t.$speedMenuList,"click",(t=>{const i=$o(t);if(i.matches("div.jb-pro-speed-menu-item")){const t=i.dataset;e.emit(ot.playbackPreRateChange,t.speed)}}))),E===Q.normal?(i(t.$playbackNarrow,"click",(t=>{t.stopPropagation(),e.playback&&e.playback.narrowPrecision()})),i(t.$playbackExpand,"click",(t=>{t.stopPropagation(),e.playback&&e.playback.expandPrecision()})),i(t.$playbackTimeList,"click",(t=>{const i=$o(t);i.matches("div.jb-pro-playback-time-minute-one")&&e.playback&&e.playback.seek(i.dataset)})),e._opt.playbackConfig.supportWheel&&i(t.$playbackTimeInner,"wheel",(t=>{t.preventDefault(),(t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3)>0?e.playback&&e.playback.expandPrecision():e.playback&&e.playback.narrowPrecision()}))):E===Q.simple&&(t.isDroging=!1,i(t.$playbackProgress,"click",(i=>{if(i.target!==t.$playbackProgressIndicator){let s=0,r=0;if(e.isInWebFullscreen())s=i.touches[0].clientY/e.height,r=s*e.playback.totalDuration;else{const o=Zh(t,e.playback.totalDuration,i);s=o.percentage,r=o.second}e.playback&&e.playback.seek({time:r})}})),i(t.$playbackProgress,"mousemove",(i=>{to(t.$playbackProgressTip,"display","block");const{width:s,time:r}=Zh(t,e.playback.totalDuration,i);t.$playbackProgressTip.innerHTML=r;const o=t.$playbackProgressTip.clientWidth;s<=o/2?to(t.$playbackProgressTip,"left",0):s>t.$playbackProgress.clientWidth-o/2?to(t.$playbackProgressTip,"left",t.$playbackProgress-o+"px"):to(t.$playbackProgressTip,"left",s-o/2+"px")})),i(t.$playbackProgress,"mouseout",(()=>{to(t.$playbackProgressTip,"display","none")})),i(t.$playbackProgressIndicator,"mousedown",(e=>{t.isDroging=!0})),i(t.$playbackProgress,"mousemove",(i=>{if(t.isDroging){const{second:s,percentage:r}=Zh(t,e.playback.totalDuration,i);e.playback&&e.playback.seek({time:s})}})),i(t.$playbackProgress,"mouseup",(e=>{t.isDroging&&(t.isDroging=!1)})))}o.quality&&(i(t.$qualityMenu,"mouseover",(()=>{t.$qualityMenuList.classList.add("jb-pro-quality-menu-shown")})),i(t.$qualityMenu,"mouseout",(()=>{t.$qualityMenuList.classList.remove("jb-pro-quality-menu-shown")})),i(t.$qualityMenuList,"click",(t=>{const i=$o(t);if(i.matches("div.jb-pro-quality-menu-item")){const t=i.dataset;e.streamQuality=t.quality}}))),o.scale&&(i(t.$scaleMenu,"mouseover",(()=>{t.$scaleMenuList.classList.add("jb-pro-scale-menu-shown")})),i(t.$scaleMenu,"mouseout",(()=>{t.$scaleMenuList.classList.remove("jb-pro-scale-menu-shown")})),i(t.$scaleMenuList,"click",(t=>{const i=$o(t);if(i.matches("div.jb-pro-scale-menu-item")){const t=i.dataset;e.setScaleMode(t.scale)}}))),o.zoom&&(i(t.$zoom,"click",(t=>{t.stopPropagation(),e.zooming=!0})),i(t.$zoomStop,"click",(t=>{t.stopPropagation(),e.zooming=!1}))),i(t.$zoomExpand,"click",(t=>{t.stopPropagation(),e.zoom&&e.zoom.expandPrecision()})),i(t.$zoomNarrow,"click",(t=>{t.stopPropagation(),e.zoom&&e.zoom.narrowPrecision()})),i(t.$zoomStop2,"click",(t=>{t.stopPropagation(),e.zooming=!1})),o.close&&i(t.$close,"click",(t=>{t.stopPropagation(),e.doDestroy()})),i(t.$tipsMessageClose,"click",(e=>{e.stopPropagation(),t.$tipsMessageContent.innerHTML="",to(t.$tipsMessage,"display","none")}))})(e,this),e._opt.hotKey&&lo()&&((e,t)=>{const{events:{proxy:i}}=e;let s={};function r(e,t){s[e]?s[e].push(t):s[e]=[t]}t.keys=s,r(vi,(()=>{e.fullscreen&&(e.fullscreen=!1)})),r(_i,(()=>{e.volume+=.05})),r(Si,(()=>{e.volume-=.05})),i(window,"keydown",(e=>{if(t.isFocus){const t=document.activeElement.tagName.toUpperCase(),i=document.activeElement.getAttribute("contenteditable");if("INPUT"!==t&&"TEXTAREA"!==t&&""!==i&&"true"!==i){const t=s[e.keyCode];t&&(e.preventDefault(),t.forEach((e=>e())))}}}))})(e,this),this.btnIndex=0,this.initLoadingBackground(),zo(e._opt.loadingIconStyle)&&this.initLoadingIconStyle(e._opt.loadingIconStyle),zo(e._opt.ptzPositionConfig)&&this.updatePtzPosition(e._opt.ptzPositionConfig),this.kbpsShow="0 KB/s",this.player.debugLog("Control","init")}destroy(){if(this.$performancePanel){this.$performancePanel.innerHTML="";if(!rc(this.$performancePanel)){const e=this.player.$container.querySelector(".jb-pro-performance-panel");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$performancePanel}if(this.$poster){if(!rc(this.$poster)){const e=this.player.$container.querySelector(".jb-pro-poster");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$poster}if(this.$loading){if(!rc(this.$loading)){const e=this.player.$container.querySelector(".jb-pro-loading");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$loading}if(this.$loadingBg){if(!rc(this.$loadingBg)){const e=this.player.$container.querySelector(".jb-pro-loading-bg");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$loadingBg}if(this.$controls){if(!rc(this.$controls)){const e=this.player.$container.querySelector(".jb-pro-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$controls}if(this.$playBig){if(!rc(this.$playBig)){const e=this.player.$container.querySelector(".jb-pro-play-big");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$playBig}if(this.$recording){if(!rc(this.$recording)){const e=this.player.$container.querySelector(".jb-pro-recording");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$recording}if(this.$ptzControl){if(!rc(this.$ptzControl)){const e=this.player.$container.querySelector(".jb-pro-ptz-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$ptzControl}if(this.$zoomControls){if(!rc(this.$zoomControls)){const e=this.player.$container.querySelector(".jb-pro-zoom-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$zoomControls}if(this.$contextmenus){this.$contextmenus.innerHTML="";if(!rc(this.$contextmenus)){const e=this.player.$container.querySelector(".jb-pro-contextmenus");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$contextmenus}if(this.$tipsMessage){if(!rc(this.$tipsMessage)){const e=this.player.$container.querySelector(".jb-pro-tips-message");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$tipsMessage}if(this.$extendDom){if(!rc(this.$extendDom)){const e=this.player.$container.querySelector(".jb-pro-extend-dom");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$extendDom}try{delete this.$tipsMessageContent,delete this.$tipsMessageClose,delete this.$playbackProgressTime,delete this.$playbackProgressIndicator,delete this.$playbackProgressPlayed,delete this.$playbackProgressHover,delete this.$$playbackProgressTip,delete this.$playbackProgress,delete this.$logSave,delete this.$speedMenuList,delete this.$speedMenu,delete this.$speedText,delete this.$contextmenus,delete this.$occlusionDetectActive,delete this.$occlusionDetect,delete this.$objectDetectActive,delete this.$objectDetect,delete this.$faceDetectActive,delete this.$faceDetect,delete this.$performanceActive,delete this.$performance,delete this.$performancePanel,delete this.$zoomControls,delete this.$close,delete this.$zoomStop2,delete this.$zoomExpand,delete this.$zoomNarrow,delete this.$zoomStop,delete this.$zoom,delete this.$scaleMenuList,delete this.$scaleMenu,delete this.$scaleText,delete this.$qualityMenuList,delete this.$qualityMenu,delete this.$qualityText,delete this.$ptzWiperClose,delete this.$ptzWiperOpen,delete this.$ptzFogClose,delete this.$ptzFogOpen,delete this.$ptzCruisePause,delete this.$ptzCruisePlay,delete this.$ptzFocusNear,delete this.$ptzFocusFar,delete this.$ptzApertureNear,delete this.$ptzApertureFar,delete this.$ptzNarrow,delete this.$ptzExpand,delete this.$ptzArrows,delete this.$ptzControlCircular,delete this.$ptzBgActive,delete this.$ptzControl,delete this.$ptzActive,delete this.$ptz,delete this.$playbackExpand,delete this.$playbackNarrow,delete this.$controlsPlaybackBtns,delete this.$playbackCurrentTimeText,delete this.$playbackCurrentTime,delete this.$playbackTimeListSecond,delete this.$playbackTimeListOne,delete this.$playbackTimeList,delete this.$playbackTimeScroll,delete this.$playbackTimeInner,delete this.$playbackTime,delete this.$controlHtml,delete this.$speed,delete this.$screenshot,delete this.$recordStop,delete this.$record,delete this.$fullscreenExit,delete this.$fullscreen,delete this.$volumeOff,delete this.$volumeOn,delete this.$volumeHandle,delete this.$volumePanel,delete this.$volumePanelText,delete this.$volumePanelWrap,delete this.$volume,delete this.$controlsRight,delete this.$controlsLeft,delete this.$controlsInner,delete this.$controls,delete this.$pause,delete this.$recordingStop,delete this.$recordingTime,delete this.$recording,delete this.$playBig,delete this.$play,delete this.$loadingText,delete this.$loading,delete this.$loadingBgImage,delete this.$loadingBg,delete this.$poster,delete this.$extendDom,delete this.controlsRect,delete this.controlsInnerRect,delete this.controlsLeftRect,delete this.controlsRightRect,delete this.controlsPlaybackTimeInner,delete this.controlsPlaybackBtnsRect}catch(e){}this.keys=null,this.btnIndex=0,this.extendBtnList=[],this.kbpsShow="0 KB/s",this.player.$container&&(this.player.$container.classList.remove("jb-pro-controls-show-auto-hide"),this.player.$container.classList.remove("jb-pro-controls-show")),this.player.debugLog("Control","destroy")}getBtnIndex(){return this.btnIndex++}autoSize(){const e=this.player;e.$container.style.padding="0 0";const t=e.width,i=e.height,s=t/i,r=e.video.$videoElement.width/e.video.$videoElement.height;if(s>r){const s=(t-i*r)/2;e.$container.style.padding=`0 ${s}px`}else{const s=(i-t/r)/2;e.$container.style.padding=`${s}px 0`}}initLoadingBackground(){const e=this.player;e._opt.loadingBackground&&e._opt.loadingBackgroundWidth&&e._opt.loadingBackgroundHeight&&(e.debugLog("Control","initLoadingBackground()"),"default"===this.player._opt.aspectRatio||no()?(e.getRenderType()===H||e.getRenderType()===$)&&this._initLoadingBackground():this._initLoadingBackgroundForRatio(),ic(this.$loadingBg,"display","block"),e._opt.loadingBackground="")}resizeLoadingBackground(){this.$loadingBgImage.src&&this.$loadingBgImage.width>0&&this.$loadingBgImage.height>0&&"none"!==io(this.$loadingBg,"display",!1)&&("default"===this.player._opt.aspectRatio||no()?(this.player.getRenderType()===H||this.player.getRenderType()===$)&&this._resizeLoadingBackground():this._resizeLoadingBackgroundForRatio())}initLoadingIconStyle(e){const t=this.player.$container.querySelector(".jb-pro-icon-loading");t&&(e.width&&ic(t,"width",`${e.width}px`),e.height&&ic(t,"height",`${e.height}px`),e.background&&ic(t,"backgroundImage",`url("${e.background}")`),!1===e.hasAnimation&&(ic(t,"animationName","none"),ic(t,"animationDuration",0),ic(t,"animationTimingFunction","ease"),ic(t,"animationIterationCount",1)))}_initLoadingBackgroundForRatio(){const e=this.player._opt.aspectRatio.split(":").map(Number);let t=this.player.width,i=this.player.height;const s=this.player._opt;let r=0;this.player.isControlBarShow()&&(r=s.playType===_?Qt:Yt,i-=r);const o=this.player._opt.loadingBackgroundWidth,a=this.player._opt.loadingBackgroundHeight,n=o/a,l=e[0]/e[1];if(this.player._opt.loadingBackground&&(this.$loadingBgImage.src=this.player._opt.loadingBackground),n>l){const e=l*a/o;this.$loadingBgImage.style.width=100*e+"%",this.$loadingBgImage.style.height=`calc(100% - ${r}px)`,this.$loadingBgImage.style.padding=`0 ${(t-t*e)/2}px`}else{const e=o/l/a;this.$loadingBgImage.style.width="100%",this.$loadingBgImage.style.height=`calc(${100*e}% - ${r}px)`,this.$loadingBgImage.style.padding=(i-i*e)/2+"px 0"}}_initLoadingBackground(){const e=this.player;let t=e.height;const i=e._opt;if(this.player.isControlBarShow()){t-=i.playType===_?Qt:Yt}let s=e.width,r=t;const o=i.rotate;270!==o&&90!==o||(s=t,r=e.width),this.$loadingBgImage.width=s,this.$loadingBgImage.height=r,e._opt.loadingBackground&&(this.$loadingBgImage.src=e._opt.loadingBackground);let a=(e.width-s)/2,n=(t-r)/2,l="contain";i.isResize||(l="fill"),i.isFullResize&&(l="none");let d="";"none"===i.mirrorRotate&&o&&(d+=" rotate("+o+"deg)"),"level"===i.mirrorRotate?d+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(d+=" rotateX(180deg)"),this.player._opt.videoRenderSupportScale&&(this.$loadingBgImage.style.objectFit=l),this.$loadingBgImage.style.transform=d,this.$loadingBgImage.style.padding="0",this.$loadingBgImage.style.left=a+"px",this.$loadingBgImage.style.top=n+"px"}_resizeLoadingBackground(){this._initLoadingBackground()}_resizeLoadingBackgroundForRatio(){this._initLoadingBackgroundForRatio()}_validateExtendBtn(e){let t=!0;if(e.name||(this.player.debugWarn("Control","extend button name is required"),t=!1),t){-1!==this.extendBtnList.findIndex((t=>t.name===e.name))&&(this.player.debugWarn("Control",`extend button name: ${e.name} is already exist`),t=!1)}return t&&(e.icon||(this.player.debugWarn("Control","extend button icon is required"),t=!1)),t}addExtendBtn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=na(Ss);if(e=Object.assign({},t,e),!this._validateExtendBtn(e))return;const i=e.name||"",s=this.$controlsRight,r=e.createdMoment||Er,o=e.activeIcon&&e.activeClick,a=`\n
\n ${e.icon?`
\n \n ${e.iconTitle?`\n ${e.iconTitle}\n `:""}\n
`:""}\n ${e.activeIcon?`
\n \n ${e.activeIconTitle?`\n ${e.activeIconTitle}\n `:""}\n
`:""}\n
\n `,n=Array.from(s.children)[e.index];n?n.insertAdjacentHTML("beforebegin",a):tc(s,a);const l=s.querySelector(`.jb-pro-controls-item-wrap-${i}`),d=e.icon?s.querySelector(`.jb-pro-icon-extend-${i}`):null,h=e.icon?s.querySelector(`.jb-pro-control-extend-${i}`):null,c=e.activeIcon?s.querySelector(`.jb-pro-icon-extend-${i}-active`):null,u=e.activeIcon?s.querySelector(`.jb-pro-control-extend-${i}-active`):null,{events:{proxy:p},debug:f}=this.player;e.icon&&(ic(d,"background",`url(${e.icon}) no-repeat center`),ic(d,"background-size","100% 100%"),ic(h,"display",r===_r?"flex":"none"),e.iconHover&&(p(d,"mouseover",(()=>{ic(d,"background",`url(${e.iconHover}) no-repeat center`),ic(d,"background-size","100% 100%")})),p(d,"mouseout",(()=>{ic(d,"background",`url(${e.icon}) no-repeat center`),ic(d,"background-size","100% 100%")})))),e.activeIcon&&(ic(c,"background",`url(${e.activeIcon}) no-repeat center`),ic(c,"background-size","100% 100%"),ic(u,"display","none"),e.activeIconHover&&(p(c,"mouseover",(()=>{ic(c,"background",`url(${e.activeIconHover}) no-repeat center`),ic(c,"background-size","100% 100%")})),p(c,"mouseout",(()=>{ic(c,"background",`url(${e.activeIcon}) no-repeat center`),ic(c,"background-size","100% 100%")})))),e.click&&d&&p(d,"click",(t=>{t.preventDefault(),o&&(ic(h,"display","none"),ic(u,"display","flex")),this.player.isInMulti()?e.click.call(this.player,t,this.player._opt.multiIndex):e.click.call(this.player,t)})),e.activeClick&&c&&p(c,"click",(t=>{t.preventDefault(),ic(h,"display","flex"),ic(u,"display","none"),this.player.isInMulti()?e.activeClick.call(this.player,t,this.player._opt.multiIndex):e.activeClick.call(this.player,t)})),this.extendBtnList.push({name:i,createdMoment:r,$iconContainer:l,$iconWrap:h,$activeIconWrap:u})}toggleExtendBtn(e,t){const i=this.extendBtnList.find((t=>t.name===e));i&&i.$activeIconWrap&&i.$iconWrap&&(Co(t)||(t="none"===io(i.$activeIconWrap,"display",!1)),t?(ic(i.$iconWrap,"display","none"),ic(i.$activeIconWrap,"display","flex")):(ic(i.$iconWrap,"display","flex"),ic(i.$activeIconWrap,"display","none")))}getExtendBtnActive(e){const t=this.extendBtnList.find((t=>t.name===e));let i=!1;return t&&t.$activeIconWrap&&(i="none"!==io(t.$activeIconWrap,"display",!1)),i}addExtendDom(e){if(e.html){const t=`\n
\n ${e.html}\n
\n `;this.player.$container.insertAdjacentHTML("beforeend",t),Object.defineProperty(this,"$extendDom",{value:this.player.$container.querySelector(".jb-pro-extend-dom"),configurable:!0}),e.showBeforePlay&&ic(this.$extendDom,"display","block")}}toggleExtendDom(e){this.$extendDom&&(Co(e)||(e="none"===io(this.$extendDom,"display",!1)),ic(this.$extendDom,"display",e?"block":"none"))}updateExtendDom(e){this.$extendDom&&(this.$extendDom.innerHTML=e)}removeExtendDom(){this.$extendDom&&(this.$extendDom.innerHTML="")}updateLoadingText(e){this.$loadingText&&(this.$loadingText.innerText=e)}getExtendBtnList(){return this.extendBtnList}showTipsMessage(e,t){const i=this.$tipsMessage,s=this.$tipsMessageContent;if(i){const r=`\n
${e}
\n ${t?`
Error Type:${t}
`:""}\n `;s.innerHTML=r,ic(i,"display","block")}}hideTipsMessage(){const e=this.$tipsMessage,t=this.$tipsMessageContent;e&&(t.innerHTML="",ic(e,"display","none"))}updatePtzPosition(e){const t=this.$ptzControl;if(zo(e)&&t){let i="auto";e.left&&(i=Number(e.left)===e.left?e.left+"px":e.left),ic(t,"left",i);let s="auto";e.top&&(s=Number(e.top)===e.top?e.top+"px":e.top),ic(t,"top",s);let r="auto";e.bottom&&(r=Number(e.bottom)===e.bottom?e.bottom+"px":e.bottom),ic(t,"bottom",r);let o="auto";e.right&&(o=Number(e.right)===e.right?e.right+"px":e.right),ic(t,"right",o)}}showPlayBtn(){ic(this.$playBig,"display","block")}toggleBar(e){this.$controls&&(Co(e)||(e="none"===io(this.$controls,"display",!1)),ic(this.$controls,"display",e?"flex":"none"))}getBarIsShow(){let e=!1;return this.$controls&&(e="none"!==io(this.$controls,"display",!1)),e}toggleControlHtml(e){this.$controlHtml&&(Co(e)||(e="none"===io(this.$controlHtml,"display",!1)),ic(this.$controlHtml,"display",e?"block":"none"))}getControlHtmlIsShow(){let e=!1;return this.$controlHtml&&(e="none"!==io(this.$controlHtml,"display",!1)),e}getExtendDomIsShow(){let e=!1;return this.$extendDom&&(e="none"!==io(this.$extendDom,"display",!1)),e}getExtendDom(){return this.$extendDom?this.$extendDom:null}getControlHtml(){return this.$controlHtml?this.$controlHtml:null}}ac(".jb-pro-container{position:relative;width:100%;height:100%;overflow:hidden}.jb-pro-container.jb-pro-fullscreen-web{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;width:100vw!important;height:100vh!important;background:#000}.jb-pro-container .jb-pro-loading-bg-for-ios{position:absolute;z-index:100;left:0;top:0;right:0;bottom:0;height:100%;width:100%;opacity:0;visibility:hidden;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jb-pro-container .jb-pro-loading-bg-for-ios.show{opacity:1;visibility:visible}");var lc=e=>{const{_opt:t,events:{proxy:i}}=e;if(t.supportDblclickFullscreen&&i(e.$container,"dblclick",(t=>{const i=$o(t).nodeName.toLowerCase();"canvas"!==i&&"video"!==i||(e.fullscreen=!e.fullscreen)})),i(document,"visibilitychange",(()=>{e.visibility="visible"===document.visibilityState,e.debugLog("visibilitychange",document.visibilityState),t.hiddenAutoPause&&(e.debugLog("visibilitychange","hiddenAutoPause is true ",document.visibilityState,e._isPlayingBeforePageHidden),"visible"===document.visibilityState?e._isPlayingBeforePageHidden&&e.play():(e._isPlayingBeforePageHidden=e.playing,e.playing&&e.pause()))})),lo()&&i(document,["click","contextmenu"],(t=>{sc(t,e.$container)?(ca(e._opt.disableContextmenu)&&"contextmenu"===t.type&&t.preventDefault(),e.isInput="INPUT"===t.target.tagName,e.isFocus=!0,e.emit(ot.focus)):(e.isInput=!1,e.isFocus=!1,e.emit(ot.blur))})),t.isCheckInView){const t=bo((()=>{e.emit(ot.inView,function(e){const t=e.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight,s=window.innerWidth||document.documentElement.clientWidth,r=t.top<=i&&t.top+t.height>=0,o=t.left<=s&&t.left+t.width>=0;return r&&o}(e.$container))}),200);i(window,"scroll",(()=>t()))}if(t.orientationChangeResize){const t=bo((()=>{e.emit(ot.resize)}),500);i(window,"orientationchange",(()=>{t()})),screen&&screen.orientation&&screen.orientation.onchange&&i(screen.orientation,"change",(()=>{t()}))}};class dc{static init(){dc.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in dc.types)dc.types.hasOwnProperty(e)&&(dc.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=dc.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,s=Array.prototype.slice.call(arguments,1),r=s.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let o=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return dc.box(dc.types.trak,dc.tkhd(e),dc.mdia(e))}static tkhd(e){let t=e.id,i=e.duration,s=e.presentWidth,r=e.presentHeight;return dc.box(dc.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>>8&255,255&s,0,0,r>>>8&255,255&r,0,0]))}static mdia(e){return dc.box(dc.types.mdia,dc.mdhd(e),dc.hdlr(e),dc.minf(e))}static mdhd(e){let t=e.timescale,i=e.duration;return dc.box(dc.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?dc.constants.HDLR_AUDIO:dc.constants.HDLR_VIDEO,dc.box(dc.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?dc.box(dc.types.smhd,dc.constants.SMHD):dc.box(dc.types.vmhd,dc.constants.VMHD),dc.box(dc.types.minf,t,dc.dinf(),dc.stbl(e))}static dinf(){return dc.box(dc.types.dinf,dc.box(dc.types.dref,dc.constants.DREF))}static stbl(e){return dc.box(dc.types.stbl,dc.stsd(e),dc.box(dc.types.stts,dc.constants.STTS),dc.box(dc.types.stsc,dc.constants.STSC),dc.box(dc.types.stsz,dc.constants.STSZ),dc.box(dc.types.stco,dc.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?dc.box(dc.types.stsd,dc.constants.STSD_PREFIX,dc.mp3(e)):dc.box(dc.types.stsd,dc.constants.STSD_PREFIX,dc.mp4a(e)):"avc"===e.videoType?dc.box(dc.types.stsd,dc.constants.STSD_PREFIX,dc.avc1(e)):dc.box(dc.types.stsd,dc.constants.STSD_PREFIX,dc.hvc1(e))}static mp3(e){let t=e.channelCount,i=e.audioSampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return dc.box(dc.types[".mp3"],s)}static mp4a(e){let t=e.channelCount,i=e.audioSampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return dc.box(dc.types.mp4a,s,dc.esds(e))}static esds(e){let t=e.config||[],i=t.length,s=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return dc.box(dc.types.esds,s)}static avc1(e){let t=e.avcc;const i=e.codecWidth,s=e.codecHeight;let r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return dc.box(dc.types.avc1,r,dc.box(dc.types.avcC,t))}static hvc1(e){let t=e.avcc;const i=e.codecWidth,s=e.codecHeight;let r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return dc.box(dc.types.hvc1,r,dc.box(dc.types.hvcC,t))}static mvex(e){return dc.box(dc.types.mvex,dc.trex(e))}static trex(e){let t=e.id,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return dc.box(dc.types.trex,i)}static moof(e,t){return dc.box(dc.types.moof,dc.mfhd(e.sequenceNumber),dc.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return dc.box(dc.types.mfhd,t)}static traf(e,t){let i=e.id,s=dc.box(dc.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),r=dc.box(dc.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),o=dc.sdtp(e),a=dc.trun(e,o.byteLength+16+16+8+16+8+8);return dc.box(dc.types.traf,s,r,a,o)}static sdtp(e){let t=new Uint8Array(5),i=e.flags;return t[4]=i.isLeading<<6|i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy,dc.box(dc.types.sdtp,t)}static trun(e,t){let i=new Uint8Array(28);t+=36,i.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let s=e.duration,r=e.size,o=e.flags,a=e.cts;return i.set([s>>>24&255,s>>>16&255,s>>>8&255,255&s,r>>>24&255,r>>>16&255,r>>>8&255,255&r,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12),dc.box(dc.types.trun,i)}static mdat(e){return dc.box(dc.types.mdat,e)}}dc.init();class hc extends Ea{constructor(e){super(),this.TAG_NAME="MediaSource",this.player=e,this._resetInIt(),this._useManagedMediaSource="ManagedMediaSource"in self&&!("MediaSource"in self),this.mediaSource=this._useManagedMediaSource?new self.ManagedMediaSource:new self.MediaSource,this.isDecodeFirstIIframe=!!ua(e._opt.checkFirstIFrame),this.mediaSourceObjectURL=null,this._useManagedMediaSource||(this.mediaSourceObjectURL=window.URL.createObjectURL(this.mediaSource)),this.isSupportVideoFrameCallback=Aa(),this.canvasRenderInterval=null,e._opt.mseUseCanvasRender?(this.$videoElement=document.createElement("video"),this._useManagedMediaSource?(this.$videoElement.disableRemotePlayback=!0,this.$videoElement.srcObject=this.mediaSource):this.$videoElement.src=this.mediaSourceObjectURL,this.initVideoEvents()):(this._useManagedMediaSource?(this.player.video.$videoElement.disableRemotePlayback=!0,this.player.video.$videoElement.srcObject=this.mediaSource):this.player.video.$videoElement.src=this.mediaSourceObjectURL,this.$videoElement=this.player.video.$videoElement),this._bindMediaSourceEvents(),this.audioSourceBufferCheckTimeout=null,this.audioSourceNoDataCheckTimeout=null,this.hasPendingEos=!1,this.player.isPlayback()&&this.player.on(ot.playbackPause,(t=>{ua(t)?(e._opt.isPlaybackPauseClearCache&&(ca(e._opt.checkFirstIFrame)&&(this.player.debugLog(this.TAG_NAME,"playbackPause is false and _opt.checkFirstIFrame is true so set isDecodeFirstIIframe = false"),this.isDecodeFirstIIframe=!1),this.clearUpAllSourceBuffer()),this.$videoElement.play()):(this.$videoElement.pause(),this.cacheTrack={})})),this._useManagedMediaSource?this.player.debugLog(this.TAG_NAME,"init and using ManagedMediaSource"):this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.stop(),this._clearAudioSourceBufferCheckTimeout(),this._clearAudioNoDataCheckTimeout(),this._stopCanvasRender(),this.eventListenList.length&&(this.eventListenList.forEach((e=>e())),this.eventListenList=[]),this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.$videoElement&&(this.player._opt.mseUseCanvasRender&&(this.$videoElement.pause&&(this.$videoElement.pause(),this.$videoElement.muted=!0),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"))),this.$videoElement=null),this.mediaSourceObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceObjectURL),this.mediaSourceObjectURL=null),this._resetInIt(),this.mediaSource=null,this.off(),this.player.debugLog(this.TAG_NAME,"destroy")}needInitAudio(){return this.player._opt.hasAudio&&this.player._opt.mseDecodeAudio}_resetInIt(){this.isAvc=null,this.isAAC=null,this.videoMeta={},this.audioMeta={},this.sourceBuffer=null,this.audioSourceBuffer=null,this.hasInit=!1,this.hasAudioInit=!1,this.isInitInfo=!1,this.isAudioInitInfo=!1,this.audioMimeType="",this.videoMimeType="",this.cacheTrack={},this.cacheAudioTrack={},this.sequenceNumber=0,this.audioSequenceNumber=0,this.firstRenderTime=null,this.firstAudioTime=null,this.$videoElement=null,this.mediaSourceAppendBufferFull=!1,this.mediaSourceAppendBufferError=!1,this.mediaSourceAddSourceBufferError=!1,this.mediaSourceBufferError=!1,this.mediaSourceError=!1,this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.prevAudioDts=null,this.prevPayloadBufferSize=0,this.isWidthOrHeightChanged=!1,this.prevTs=null,this.prevAudioTs=null,this.eventListenList=[],this.pendingRemoveRanges=[],this.pendingSegments=[],this.pendingAudioRemoveRanges=[],this.pendingAudioSegments=[],this.supportVideoFrameCallbackHandle=null}get state(){return this.mediaSource&&this.mediaSource.readyState}get isStateOpen(){return this.state===Ai}get isStateClosed(){return this.state===bi}get isStateEnded(){return this.state===yi}get duration(){return this.mediaSource&&this.mediaSource.duration||-1}set duration(e){this.mediaSource.duration=e}_bindMediaSourceEvents(){const{events:{proxy:e}}=this.player,t=e(this.mediaSource,$i,(()=>{this.player.debugLog(this.TAG_NAME,"sourceOpen"),this._onMediaSourceSourceOpen(),this.player.emit(ot.mseSourceOpen)})),i=e(this.mediaSource,Hi,(()=>{this.player.debugLog(this.TAG_NAME,"sourceClose"),this.player.emit(ot.mseSourceClose)})),s=e(this.mediaSource,Ji,(()=>{this.player.debugLog(this.TAG_NAME,"sourceended"),this.player.emit(ot.mseSourceended)}));this.eventListenList.push(t,i,s);const r=e(this.$videoElement,Zi,(e=>{if(ua(this.isSupportVideoFrameCallback))if(this.player.checkIsInRender())this.player.handleRender();else{const t=parseInt(e.timeStamp,10);this.player.debugLog(this.TAG_NAME,`mseUseCanvasRender is ${this.player._opt.mseUseCanvasRender} and\n $videoElement ts is ${t}, but not in render and vbps is ${this.player._stats.vbps} and fps is ${this.player._stats.fps}`)}}));if(this.eventListenList.push(r),this._useManagedMediaSource){const t=e(this.mediaSource,qi,(()=>{this.player.debugLog(this.TAG_NAME,"ManagedMediaSource startstreaming"),this.player.emit(ot.mseSourceStartStreaming)})),i=e(this.mediaSource,Ki,(()=>{this.player.debugLog(this.TAG_NAME,"ManagedMediaSource endstreaming"),this.player.emit(ot.mseSourceEndStreaming)})),s=e(this.mediaSource,Yi,(()=>{this.player.debugLog(this.TAG_NAME,"ManagedMediaSource qualitychange")}));this.eventListenList.push(t,i,s)}}_onMediaSourceSourceOpen(){this.sourceBuffer||(this.player.debugLog("MediaSource","onMediaSourceSourceOpen() sourceBuffer is null and next init"),this._initSourceBuffer()),this.audioSourceBuffer||(this.player.debugLog("MediaSource","onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),this._initAudioSourceBuffer()),this._hasPendingSegments()&&this._doAppendSegments()}initVideoEvents(){const{proxy:e}=this.player.events;this.player.on(ot.visibilityChange,(e=>{e&&setTimeout((()=>{if(this.player.isPlaying()&&this.$videoElement){const e=this.getVideoBufferLastTime();e-this.$videoElement.currentTime>this.getMseBufferMaxDelayTime()&&(this.player.debugLog(this.TAG_NAME,`visibilityChange is true and lastTime is ${e} and currentTime is ${this.$videoElement.currentTime} so set currentTime to lastTime`),this.$videoElement.currentTime=e)}}),300)}));const t=e(this.$videoElement,Qi,(()=>{this.player.debugLog(this.TAG_NAME,"video canplay"),this.$videoElement.play().then((()=>{this.player.emit(ot.removeLoadingBgImage),Aa()?this.supportVideoFrameCallbackHandle||(this.player.debugLog(this.TAG_NAME,"video canplay and requestVideoFrameCallback and use videoFrameCallback"),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))):this.player.isUseHls265()&&(this.player.debugLog(this.TAG_NAME,"video canplay and use canvas render and fps is 25"),this._stopCanvasRender(),this.canvasRenderInterval=setInterval((()=>{this.player.video.render({$video:this.$videoElement,ts:parseInt(1e3*this.$videoElement.currentTime,10)||0})}),40)),this.player.debugLog(this.TAG_NAME,"video play")})).catch((e=>{this.player.debugError(this.TAG_NAME,"video play error ",e),this.player.emitError(lt.mediaSourceUseCanvasRenderPlayFailed,`code is ${e.code} and message is ${e.message}`)}))})),i=e(this.$videoElement,Xi,(()=>{this.player.debugLog(this.TAG_NAME,"video waiting")})),s=e(this.$videoElement,Zi,(e=>{parseInt(e.timeStamp,10),this.$videoElement.paused&&(this.player.debugWarn(this.TAG_NAME,"video is paused and next try to replay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video is paused and replay success")})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video is paused and replay error ",e)})))})),r=e(this.$videoElement,es,(()=>{this.player.debugLog(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate),this.$videoElement&&this.$videoElement.paused&&this.player.debugWarn(this.TAG_NAME,"ratechange and video is paused")}));this.eventListenList.push(t,i,s,r)}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())return void this.player.debugLog(this.TAG_NAME,"videoFrameCallback() player is destroyed");const i=parseInt(1e3*Math.max(t.mediaTime,this.$videoElement.currentTime),10)||0;this.player.handleRender(),this.player.video.render({$video:this.$videoElement,ts:i}),this.player.isUseHls265()&&this.player.updateStats({fps:!0,ts:i}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}decodeVideo(e,t,i,s){const r=this.player;if(r)if(this.player.isDestroyedOrClosed())this.player.debugWarn(this.TAG_NAME,"decodeVideo() player is destroyed");else if(this.hasInit)if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(i&&0===e[1]){const t=15&e[0];let i={};if(t===yt){i=Dn(e.slice(5))}else t===At&&(i=Gn(e));const s=this.player.video.videoInfo;s&&s.width&&s.height&&i&&i.codecWidth&&i.codecHeight&&(i.codecWidth!==s.width||i.codecHeight!==s.height)&&(this.player.debugWarn(this.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${s.width}, old height is ${s.height},\n new width is ${i.codecWidth}, new height is ${i.codecHeight},\n and emit change event`),this.isWidthOrHeightChanged=!0,this.player.emitError(lt.mseWidthOrHeightChange,`width ${s.width}->${i.codecWidth}, height ${s.height}->${i.codecHeight}`))}if(this.isWidthOrHeightChanged)return void this.player.debugWarn(this.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(ha(e))return void this.player.debugLog(this.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength<12)return void this.player.debugWarn(this.TAG_NAME,`decodeVideo and payload is too small , payload length is ${e.byteLength}`);let r=t;if(this.player.isPlayer()){if(null===this.firstRenderTime&&(this.firstRenderTime=t,this.player.debugLog(this.TAG_NAME,`firstRenderTime is ${this.firstRenderTime}`)),r=t-this.firstRenderTime,r<0&&(this.player.debugWarn(this.TAG_NAME,`decodeVideo\n local dts is < 0 , ts is ${t} and prevTs is ${this.prevTs},\n firstRenderTime is ${this.firstRenderTime} and mseCorrectTimeDuration is ${this.player._opt.mseCorrectTimeDuration}`),r=null===this.prevDts?0:this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(t)))return this.player.debugWarn(this.TAG_NAME,`decodeVideo is max diff , ts is ${t} and prevTs is ${this.prevTs}, diff is ${this.prevTs-t} and emit replay`),void this.player.emitError(lt.mediaSourceTsIsMaxDiff,`decodeVideo is max diff, prevTs is ${this.prevTs} and ts is ${t}`);if(null!==this.prevDts&&r<=this.prevDts){if(this.player.debugWarn(this.TAG_NAME,`\n decodeVideo dts is less than(or equal) prev dts ,\n dts is ${r} and prev dts is ${this.prevDts} ,\n and now ts is ${t} and prev ts is ${this.prevTs} ,\n and diff is ${t-this.prevTs} and firstRenderTime is ${this.firstRenderTime} and isIframe is ${i},\n and mseCorrectTimeDuration is ${this.player._opt.mseCorrectTimeDuration},\n and prevPayloadBufferSize is ${this.prevPayloadBufferSize} and payload size is ${e.byteLength}`),r===this.prevDts&&this.prevPayloadBufferSize===e.byteLength)return void this.player.debugWarn(this.TAG_NAME,"decodeVideo dts is equal to prev dts and payload size is equal to prev payload size so drop this frame");if(r=this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(t))return this.player.debugWarn(this.TAG_NAME,`decodeVideo is max diff , ts is ${t} and prevTs is ${this.prevTs}, diff is ${this.prevTs-t} and emit replay`),void this.emit(lt.mediaSourceTsIsMaxDiff,`decodeVideo is max diff, prevTs is ${this.prevTs} and ts is ${t}`)}}this.player.isPlayer()?this._decodeVideo(e,r,i,s,t):this.player.isPlayback()&&(ua(this.player.playbackPause)?(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this._decodeVideo(e,r,i,s,t)):this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this._decodeVideo(e,r,i,s,t)),this.prevDts=r,this.prevPayloadBufferSize=e.byteLength,this.prevTs=t}else this.player.debugLog(this.TAG_NAME,"decodeVideo first frame is not iFrame");else if(i&&e[1]===ys){const s=15&e[0];if(r.video.updateVideoInfo({encTypeCode:s}),s===At&&ua(So()))return void this.player.emitError(lt.mediaSourceH265NotSupport);r._times.decodeStart||(r._times.decodeStart=Zr()),this.hasInit=this._decodeConfigurationRecord(e,t,i,s)}else this.player.debugWarn(this.TAG_NAME,`decodeVideo has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)}decodeAudio(e,t){if(this.player)if(this.player.isDestroyedOrClosed())this.player.debugWarn(this.TAG_NAME,"decodeAudio() player is destroyed");else if(ua(this.hasAudioInit))this.hasAudioInit=this._decodeAudioConfigurationRecord(e,t);else{let i=t;if(Br(e))return void this.player.debugLog(this.TAG_NAME,"decodeAudio and has already initialized and payload is aac codec packet so drop this frame");if(this._clearAudioNoDataCheckTimeout(),this.isDecodeFirstIIframe){if(this.player.isPlayer()){if(null===this.firstAudioTime&&(this.firstAudioTime=t,this.player.debugLog(this.TAG_NAME,`firstAudioTime is ${this.firstAudioTime}`)),i=t-this.firstAudioTime,i<0&&(this.player.debugWarn(this.TAG_NAME,`decodeAudio\n local dts is < 0 , ts is ${t} and prevTs is ${this.prevAudioTs},\n firstAudioTime is ${this.firstAudioTime}`),i=null===this.prevAudioDts?0:this.prevAudioDts+this.player._opt.mseCorrectAudioTimeDuration,this._checkAudioTsIsMaxDiff(t)))return this.player.debugWarn(this.TAG_NAME,`decodeAudio is max diff , ts is ${t} and prevTs is ${this.prevAudioDts}, diff is ${this.prevAudioDts-t} and emit replay`),void this.player.emitError(lt.mediaSourceTsIsMaxDiff,`decodeAudio is max diff, prevTs is ${this.prevAudioDts} and ts is ${t}`);null!==this.prevAudioTs&&i<=this.prevAudioDts&&(this.player.debugWarn(this.TAG_NAME,`\n decodeAudio dts is less than(or equal) prev dts ,\n dts is ${i} and prev dts is ${this.prevAudioDts} ,\n and now ts is ${t} and prev ts is ${this.prevAudioTs} ,\n and diff is ${t-this.prevAudioTs}`),i=this.prevAudioDts+this.player._opt.mseCorrectAudioTimeDuration)}(this.player.isPlayer()||this.player.isPlayback()&&(ua(this.player.playbackPause)||this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()))&&this._decodeAudio(e,i,t),this.prevAudioTs=t,this.prevAudioDts=i}else this.player.debugLog(this.TAG_NAME,"decodeAudio first frame is not iFrame")}}_checkTsIsMaxDiff(e){return this.prevTs>0&&eX}_checkAudioTsIsMaxDiff(e){return this.prevAudioTs>0&&eX}_decodeConfigurationRecord(e,t,i,s){let r=e.slice(5),o={};if(s===yt?o=Dn(r):s===At&&(o=zn(r)),Go(o)||0===o.codecWidth&&0===o.codecHeight){this.player.debugWarn(this.TAG_NAME,"_decodeConfigurationRecord",o);let e="";return e=Go(o)?"config is empty object":`config is not empty object and codecWidth is ${o.codecWidth} and codecHeight is ${o.codecHeight}`,this.player.emitError(lt.mediaSourceDecoderConfigurationError,e),!1}this.isInitInfo||(this.player.debugLog(this.TAG_NAME,`updateVideoInfo: ${o.codecWidth},${o.codecHeight}`),this.player.video.updateVideoInfo({width:o.codecWidth,height:o.codecHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0),this.player.recorder&&this.player._opt.recordType===S&&this.player.recorder.initMetaData(e,s);const a={id:er,type:"video",timescale:1e3,duration:0,avcc:r,codecWidth:o.codecWidth,codecHeight:o.codecHeight,videoType:o.videoType},n=dc.generateInitSegment(a);this.isAvc=s===yt;let l=o.codec;return this.videoMimeType=l?`video/mp4; codecs="${o.codec}"`:this.isAvc?ci:ui,this._initSourceBuffer(),this.appendBuffer(n.buffer),this.sequenceNumber=0,this.cacheTrack={},!0}_decodeAudioConfigurationRecord(e,t){const i=e[0]>>4,s=e[0]>>1&1,r=i===Et,o=i===_t;let a="";if(a=o?s?16:8:0===s?8:16,ua(o||r))return this.player.debugWarn(this.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${i} ant auto wasm decode`),this.player.emit(lt.mediaSourceAudioG711NotSupport),!1;const n={id:tr,type:"audio",timescale:1e3};let l={};if(Br(e)){if(l=Or(e.slice(2)),!l)return!1;n.audioSampleRate=l.sampleRate,n.channelCount=l.channelCount,n.config=l.config,n.refSampleDuration=1024/n.audioSampleRate*n.timescale}else{if(!r)return!1;if(l=zh(e),!l)return!1;n.audioSampleRate=l.samplingRate,n.channelCount=l.channelCount,n.refSampleDuration=1152/n.audioSampleRate*n.timescale}n.codec=l.codec,n.duration=0;let d="mp4",h=l.codec,c=null;r&&ua(co())?(d="mpeg",h="",c=new Uint8Array):c=dc.generateInitSegment(n);let u=`${n.type}/${d}`;return h&&h.length>0&&(u+=`;codecs=${h}`),ua(this.isAudioInitInfo)&&(this.player.audio.updateAudioInfo({encTypeCode:i,channels:n.channelCount,sampleRate:n.audioSampleRate,depth:a}),this.isAudioInitInfo=!0),this.audioMimeType=u,this.isAAC=o,this._initAudioSourceBuffer(),this.appendAudioBuffer(c.buffer),!0}_initSourceBuffer(){const{events:{proxy:e}}=this.player;if(null===this.sourceBuffer&&null!==this.mediaSource&&this.isStateOpen&&this.videoMimeType){try{this.sourceBuffer=this.mediaSource.addSourceBuffer(this.videoMimeType),this.player.debugLog(this.TAG_NAME,"_initSourceBuffer() this.mediaSource.addSourceBuffer()",this.videoMimeType)}catch(e){return this.player.debugError(this.TAG_NAME,"appendBuffer() this.mediaSource.addSourceBuffer()",e.code,e),this.player.emitError(lt.mseAddSourceBufferError,`code is ${e.code} and message is ${e.message}`),void(this.mediaSourceAddSourceBufferError=!0)}if(this.sourceBuffer){const t=e(this.sourceBuffer,"error",(e=>{this.mediaSourceBufferError=!0,this.player.debugError(this.TAG_NAME,"mseSourceBufferError this.sourceBuffer",e),this.player.emitError(lt.mseSourceBufferError,e.toString())})),i=e(this.sourceBuffer,"updateend",(()=>{this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this.hasPendingEos&&(this.player.debugLog(this.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),this.endOfStream())}));this.eventListenList.push(t,i)}}else this.player.debugLog(this.TAG_NAME,`_initSourceBuffer and this.isStateOpen is ${this.isStateOpen} and this.isAvc === null is ${null===this.isAvc}`)}_initAudioSourceBuffer(){const{events:{proxy:e}}=this.player;if(null===this.audioSourceBuffer&&null!==this.mediaSource&&this.isStateOpen&&this.audioMimeType){try{this.audioSourceBuffer=this.mediaSource.addSourceBuffer(this.audioMimeType),this._clearAudioSourceBufferCheckTimeout(),this.player.debugLog(this.TAG_NAME,"_initAudioSourceBuffer() this.mediaSource.addSourceBuffer()",this.audioMimeType)}catch(e){return this.player.debugError(this.TAG_NAME,"appendAudioBuffer() this.mediaSource.addSourceBuffer()",e.code,e),this.player.emitError(lt.mseAddSourceBufferError,`code is ${e.code} and message is ${e.message}`),void(this.mediaSourceAddSourceBufferError=!0)}if(this.audioSourceBuffer){const t=e(this.audioSourceBuffer,"error",(e=>{this.mediaSourceBufferError=!0,this.player.debugError(this.TAG_NAME,"mseSourceBufferError this.audioSourceBuffer",e),this.player.emitError(lt.mseSourceBufferError,e.toString())})),i=e(this.audioSourceBuffer,"updateend",(()=>{this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this.hasPendingEos&&(this.player.debugLog(this.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),this.endOfStream())}));this.eventListenList.push(t,i),null===this.audioSourceNoDataCheckTimeout&&(this.audioSourceNoDataCheckTimeout=setTimeout((()=>{this._clearAudioNoDataCheckTimeout(),this.player.emit(lt.mediaSourceAudioNoDataTimeout)}),1e3))}}else this.player.debugLog(this.TAG_NAME,`_initAudioSourceBuffer and this.isStateOpen is ${this.isStateOpen} and this.audioMimeType is ${this.audioMimeType}`)}_decodeVideo(e,t,i,s,r){const o=this.player;let a=e.slice(5),n=a.byteLength;if(0===n)return void o.debugWarn(this.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let l=(new Date).getTime(),d=!1;this.prevTimestamp||(this.prevTimestamp=l,d=!0);const h=l-this.prevTimestamp;this.decodeDiffTimestamp=h,h>1e3&&!d&&this.player.isPlayer()&&o.debugLog(this.TAG_NAME,`_decodeVideo now time is ${l} and prev time is ${this.prevTimestamp}, diff time is ${h} ms`);const c=this.$videoElement;if(this.cacheTrack.id&&t>=this.cacheTrack.dts){let e=8+this.cacheTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(dc.types.mdat,4),i.set(this.cacheTrack.data,8),this.cacheTrack.duration=t-this.cacheTrack.dts,this.cacheTrack.duration>1e3&&this.player.debugWarn(this.TAG_NAME,`cacheTrack duration is ${this.cacheTrack.duration} ms`);let s=dc.moof(this.cacheTrack,this.cacheTrack.dts);this.cacheTrack={};let a=new Uint8Array(s.byteLength+i.byteLength);a.set(s,0),a.set(i,s.byteLength),this.appendBuffer(a.buffer),o.emit(ot.timeUpdate,r),o.isPlayer()?o.isUseHls265()?o.updateStats({dfps:!0,mseTs:t}):o.updateStats({fps:!0,dfps:!0,ts:r,mseTs:t}):o.isPlayback()&&o.playback.updateStats({ts:r}),o._times.videoStart||(o._times.videoStart=Zr(),o.handlePlayToRenderTimes())}else o.debugLog(this.TAG_NAME,`cacheTrack = {} now dts is ${t}, and ts is ${r} cacheTrack dts is ${this.cacheTrack&&this.cacheTrack.dts}`),this.cacheTrack={};this.cacheTrack||(this.cacheTrack={}),this.cacheTrack.id=er,this.cacheTrack.sequenceNumber=++this.sequenceNumber,this.cacheTrack.size=n,this.cacheTrack.dts=t,this.cacheTrack.cts=s,this.cacheTrack.isKeyframe=i,this.cacheTrack.data=a,this.cacheTrack.flags={isLeading:0,dependsOn:i?2:1,isDependedOn:i?1:0,hasRedundancy:0,isNonSync:i?0:1},o._opt.mseUseCanvasRender&&ua(this.isSupportVideoFrameCallback)&&ua(o.isUseHls265())&&o.video.render({$video:c,ts:t}),this.prevTimestamp=(new Date).getTime()}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}_decodeAudio(e,t,i){const s=this.player;let r=this.isAAC?e.slice(2):e.slice(1),o=r.byteLength;if(this.cacheAudioTrack.id&&t>=this.cacheAudioTrack.dts){let e=8+this.cacheAudioTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(dc.types.mdat,4),i.set(this.cacheAudioTrack.data,8),this.cacheAudioTrack.duration=t-this.cacheAudioTrack.dts;let s=dc.moof(this.cacheAudioTrack,this.cacheAudioTrack.dts);this.cacheAudioTrack={};let r=new Uint8Array(s.byteLength+i.byteLength);r.set(s,0),r.set(i,s.byteLength),this.appendAudioBuffer(r.buffer)}else s.debugLog(this.TAG_NAME,`cacheAudioTrack = {} now dts is ${t} cacheAudioTrack dts is ${this.cacheAudioTrack&&this.cacheAudioTrack.dts}`),this.cacheAudioTrack={};this.cacheAudioTrack||(this.cacheAudioTrack={}),this.cacheAudioTrack.id=tr,this.cacheAudioTrack.sequenceNumber=++this.audioSequenceNumber,this.cacheAudioTrack.size=o,this.cacheAudioTrack.dts=t,this.cacheAudioTrack.cts=0,this.cacheAudioTrack.data=r,this.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}appendBuffer(e){this.player.isDestroyedOrClosed()?this.player.debugWarn(this.TAG_NAME,"appendBuffer() player is destroyed"):(this.player,this.mediaSourceAddSourceBufferError?this.player.debugWarn(this.TAG_NAME,"appendBuffer() this.mediaSourceAddSourceBufferError is true"):this.mediaSourceAppendBufferFull?this.player.debugWarn(this.TAG_NAME,"appendBuffer() this.mediaSourceAppendBufferFull is true"):this.mediaSourceAppendBufferError?this.player.debugWarn(this.TAG_NAME,"appendBuffer() this.mediaSourceAppendBufferError is true"):this.mediaSourceBufferError?this.player.debugWarn(this.TAG_NAME,"appendBuffer() this.mediaSourceBufferError is true"):(this.pendingSegments.push(e),this.sourceBuffer&&(this.player.isPlayer()&&this._handleUpdatePlaybackRate(),this.player.isPlayback()&&(this._handleUpdateBufferDelayTime(),this._checkVideoPlayCurrentTime()),this.player._opt.mseAutoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanUpSourceBuffer(),ua(this.getSourceBufferUpdating())&&this.isStateOpen&&ua(this._hasPendingRemoveRanges()))?this._doAppendSegments():this.isStateClosed?(this.mediaSourceBufferError=!0,this.player.emitError(lt.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):this.isStateEnded&&(this.mediaSourceBufferError=!0,this.player.emitError(lt.mseSourceBufferError,"mediaSource is end"))))}appendAudioBuffer(e){this.player.isDestroyedOrClosed()?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() player is destroyed"):(this.player,this.mediaSourceAddSourceBufferError?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAddSourceBufferError is true"):this.mediaSourceAppendBufferFull?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAppendBufferFull is true"):this.mediaSourceAppendBufferError?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAppendBufferError is true"):this.mediaSourceBufferError?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceBufferError is true"):(this.pendingAudioSegments.push(e),this.audioSourceBuffer&&(this.player.isPlayer()&&this._handleUpdatePlaybackRate(),this.player.isPlayback()&&(this._handleUpdateBufferDelayTime(),this._checkVideoPlayCurrentTime()),this.player._opt.mseAutoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanUpSourceBuffer(),ua(this.getAudioSourceBufferUpdating())&&this.isStateOpen&&ua(this._hasPendingRemoveRanges()))?this._doAppendSegments():this.isStateClosed?(this.mediaSourceBufferError=!0,this.player.emitError(lt.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):this.isStateEnded&&(this.mediaSourceBufferError=!0,this.player.emitError(lt.mseSourceBufferError,"mediaSource is end"))))}getSourceBufferUpdating(){return this.sourceBuffer&&this.sourceBuffer.updating}getAudioSourceBufferUpdating(){return this.audioSourceBuffer&&this.audioSourceBuffer.updating}stop(){this.abortSourceBuffer(),this.removeSourceBuffer(),this.endOfStream()}checkSourceBufferDelay(){const e=this.$videoElement;let t=0,i=0;return e.buffered.length>0&&(i=e.buffered.end(e.buffered.length-1),t=i-e.currentTime),t<0&&(this.player.debugWarn(this.TAG_NAME,`checkMSESourceBufferDelay ${t} < 0, and buffered is ${i} ,currentTime is ${e.currentTime} , try to seek ${e.currentTime} to ${i}`),e.currentTime=i,e.paused&&(this.player.debugWarn(this.TAG_NAME,"checkSourceBufferDelay and video is paused and sent isMSECurrentMoreThanBufferedPause true"),this.player.isMSECurrentMoreThanBufferedPause=!0),t=0),t}checkSourceBufferStore(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.currentTime-e.buffered.start(0)),t}checkSourceBufferEndLessThanCurrentTime(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.buffered.end(e.buffered.length-1)-e.currentTime),t}getDecodeDiffTimes(){return this.decodeDiffTimestamp}removeBuffer(e,t){const i=Jo();if(this.player.debugLog(this.TAG_NAME,`removeBuffer() start is ${e} and end is ${t} and _isMacOsFirefox is ${i}`),this.isStateOpen&&ua(i)){if(ua(this.getSourceBufferUpdating()))try{this.sourceBuffer.remove(e,t)}catch(e){this.player.debugWarn(this.TAG_NAME,"removeBuffer() sourceBuffer error",e)}if(ua(this.getAudioSourceBufferUpdating()))try{this.audioSourceBuffer.remove(e,t)}catch(e){this.player.debugWarn(this.TAG_NAME,"removeBuffer() audioSourceBuffer error",e)}}}clearUpAllSourceBuffer(){if(this.sourceBuffer){const e=this.sourceBuffer.buffered;for(let t=0;t=1)if(this.getSourceBufferUpdating()||this.getAudioSourceBufferUpdating())this.hasPendingEos=!0;else{this.hasPendingEos=!1;try{this.player.debugLog(this.TAG_NAME,"endOfStream()"),this.mediaSource.endOfStream()}catch(e){this.player.debugWarn(this.TAG_NAME,"endOfStream() error",e)}}}abortSourceBuffer(){if(this.isStateOpen){if(this.sourceBuffer){try{this.player.debugLog(this.TAG_NAME,"abortSourceBuffer() abort sourceBuffer"),this.sourceBuffer.abort()}catch(e){}ua(this.getSourceBufferUpdating())&&this._doRemoveRanges()}if(this.audioSourceBuffer){try{this.player.debugLog(this.TAG_NAME,"abortSourceBuffer() abort audioSourceBuffer"),this.audioSourceBuffer.abort()}catch(e){}ua(this.getAudioSourceBufferUpdating())&&this._doRemoveRanges()}}this.sourceBuffer=null,this.audioSourceBuffer=null}removeSourceBuffer(){if(!this.isStateClosed&&this.mediaSource){if(this.sourceBuffer)try{this.player.debugLog(this.TAG_NAME,"removeSourceBuffer() sourceBuffer"),this.mediaSource.removeSourceBuffer(this.sourceBuffer)}catch(e){this.player.debugError(this.TAG_NAME,"removeSourceBuffer() sourceBuffer error",e)}if(this.audioSourceBuffer)try{this.player.debugLog(this.TAG_NAME,"removeSourceBuffer() audioSourceBuffer"),this.mediaSource.removeSourceBuffer(this.audioSourceBuffer)}catch(e){this.player.debugError(this.TAG_NAME,"removeSourceBuffer() audioSourceBuffer error",e)}}}_hasPendingSegments(){return this.pendingSegments.length>0||this.pendingAudioSegments.length>0}getPendingSegmentsLength(){return this.pendingSegments.length}_handleUpdatePlaybackRate(){if(!this.$videoElement)return;const e=this.$videoElement;this.player._opt.videoBuffer,this.player._opt.videoBufferDelay;const t=e.buffered;t.length&&t.start(0);const i=t.length?t.end(t.length-1):0;let s=e.currentTime;const r=i-s,o=this.getMseBufferMaxDelayTime();if(this.player.updateStats({mseVideoBufferDelayTime:r}),0===this.$videoElement.readyState)return;if(r>o)this.player.debugLog(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current is ${s} , delay buffer is more than ${o} is ${r} and new time is ${i}`),e.currentTime=i,s=e.currentTime;else if(r<0&&0===i)return this.player.debugWarn(this.TAG_NAME,`handleUpdatePlaybackRate and delay buffer is ${i} - current is ${s} = ${r} < 0 and check video is paused : ${e.paused} `),void this.player.emit(lt.mediaSourceBufferedIsZeroError,"video.buffered is empty");const a=this._getPlaybackRate(i-s);e.playbackRate!==a&&(this.player.debugLog(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current time is ${s} and delay is ${i-s} set playbackRate is ${a} `),e.playbackRate=a)}_handleUpdateBufferDelayTime(){const e=this.getVideoBufferDelayTime();this.player.updateStats({mseVideoBufferDelayTime:e})}_checkVideoPlayCurrentTime(){const e=this.checkSourceBufferStore();if(e<0){const t=this.getVideoBufferStartTime();this.player.debugWarn(this.TAG_NAME,`checkVideoPlayCurrentTime store is ${e} < 0 and set currentTime ${this.$videoElement.currentTime} to ${t}`),this.$videoElement.currentTime=t}}_doAppendSegments(){if(this.isStateClosed||this.isStateEnded)this.player.debugLog(this.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==this.sourceBuffer){if(this.needInitAudio()&&null===this.audioSourceBuffer)return this.player.debugLog(this.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===this.audioSourceBufferCheckTimeout&&(this.audioSourceBufferCheckTimeout=setTimeout((()=>{this._clearAudioSourceBufferCheckTimeout(),this.player.emit(lt.mediaSourceAudioInitTimeout)}),1e3)));if(ua(this.getSourceBufferUpdating())&&this.pendingSegments.length>0){const e=this.pendingSegments.shift();try{this.sourceBuffer.appendBuffer(e)}catch(e){this.player.debugError(this.TAG_NAME,"this.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.player.emitError(lt.mediaSourceFull,`code is ${e.code} and message is ${e.message}`)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.player.emitError(lt.mediaSourceAppendBufferError,`code is ${e.code} and message is ${e.message}`)):(this.stop(),this.mediaSourceBufferError=!0,this.player.emitError(ot.mseSourceBufferError,`code is ${e.code} and message is ${e.message}`))}}if(ua(this.getAudioSourceBufferUpdating())&&this.pendingAudioSegments.length>0){const e=this.pendingAudioSegments.shift();try{this.audioSourceBuffer.appendBuffer(e)}catch(e){this.player.debugError(this.TAG_NAME,"this.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.player.emitError(lt.mediaSourceFull,`code is ${e.code} and message is ${e.message}`)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.player.emitError(lt.mediaSourceAppendBufferError,`code is ${e.code} and message is ${e.message}`)):(this.stop(),this.mediaSourceBufferError=!0,this.player.emitError(ot.mseSourceBufferError,`code is ${e.code} and message is ${e.message}`))}}}else this.player.debugLog(this.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")}_doCleanUpSourceBuffer(){if(!this.$videoElement)return;const e=this.$videoElement.currentTime;if(this.sourceBuffer){const t=this.sourceBuffer.buffered;let i=!1;for(let s=0;s=this.player._opt.mseAutoCleanupMaxBackwardDuration){i=!0;let t=e-this.player._opt.mseAutoCleanupMinBackwardDuration;this.pendingRemoveRanges.push({start:r,end:t})}}else o=this.player._opt.mseAutoCleanupMaxBackwardDuration){i=!0;let t=e-this.player._opt.mseAutoCleanupMinBackwardDuration;this.pendingAudioRemoveRanges.push({start:r,end:t})}}else o0||this.pendingAudioRemoveRanges.length>0}_doRemoveRanges(){if(this.sourceBuffer&&ua(this.getSourceBufferUpdating())){let e=this.pendingRemoveRanges;for(;e.length&&ua(this.getSourceBufferUpdating());){let t=e.shift();try{this.sourceBuffer.remove(t.start,t.end)}catch(e){this.player.debugWarn(this.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e)}}}if(this.audioSourceBuffer&&ua(this.getAudioSourceBufferUpdating())){let e=this.pendingAudioRemoveRanges;for(;e.length&&ua(this.getAudioSourceBufferUpdating());){let t=e.shift();try{this.audioSourceBuffer.remove(t.start,t.end)}catch(e){this.player.debugWarn(this.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e)}}}}getDecodePlaybackRate(){let e=0;const t=this.$videoElement;return t&&(e=t.playbackRate),e}_getPlaybackRate(e){const t=this.$videoElement;let i=this.player._opt.videoBufferDelay+this.player._opt.videoBuffer;const s=Math.max(i,1e3),r=s/2;return e*=1e3,1===t.playbackRate?e>s?1.2:1:e<=r?1:t.playbackRate}_needCleanupSourceBuffer(){if(ua(this.player._opt.mseAutoCleanupSourceBuffer)||!this.$videoElement)return!1;const e=this.$videoElement,t=e.buffered,i=e.currentTime;return t.length>=1&&i-t.start(0)>=this.player._opt.mseAutoCleanupMaxBackwardDuration}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}getVideoBufferLastTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;i.length&&i.start(0);t=i.length?i.end(i.length-1):0}return t}getVideoBufferTimeRange(){const e=this.$videoElement;let t=null;if(e){const i=e.buffered,s=i.length?i.start(0):0,r=i.length?i.end(i.length-1):0;t={start:s,end:r,diff:r-s}}return t}getVideoBufferStartTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;t=i.length?i.start(0):0}return t}getVideoBufferEndTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;t=i.length?i.end(i.length-1):0}return t}getVideoBufferDelayTime(){const e=this.$videoElement;const t=this.getVideoBufferLastTime()-e.currentTime;return t>0?t:0}_clearAudioSourceBufferCheckTimeout(){this.audioSourceBufferCheckTimeout&&(clearTimeout(this.audioSourceBufferCheckTimeout),this.audioSourceBufferCheckTimeout=null)}_clearAudioNoDataCheckTimeout(){this.audioSourceNoDataCheckTimeout&&(clearTimeout(this.audioSourceNoDataCheckTimeout),this.audioSourceNoDataCheckTimeout=null)}getMimeType(){return{video:this.videoMimeType,audio:this.audioMimeType}}getMseBufferMaxDelayTime(){let e=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3;return Math.max(5,e+3)}isVideoPlaying(){return this.$videoElement&&ua(this.$videoElement.paused)&&ua(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}}const cc=()=>"wakeLock"in navigator&&-1===window.navigator.userAgent.indexOf("Samsung")&&ua(po());class uc{constructor(e){this.player=e,this.enabled=!1,cc()?(this.player.debugLog("NoSleep","Native Wake Lock API supported."),this._wakeLock=null,this.handleVisibilityChange=()=>{null!==this._wakeLock&&"visible"===document.visibilityState&&this.enable()},document.addEventListener("visibilitychange",this.handleVisibilityChange),document.addEventListener("fullscreenchange",this.handleVisibilityChange)):(this.player.debugLog("NoSleep","Native Wake Lock API not supported. so use video element."),this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQRChYEC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X61yT5xzAAAo4eCAtGA+P/+o4eCAuWA+P/+o4eCAvmA+P/+o4eCAw2A+P/+o4eCAyGA+P/+o56BAycA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IDNYD4//6jh4IDSYD4//6jh4IDXYD4//6jh4IDcYD4//6jh4IDhYD4//6jnoEDiwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggOZgPj//qOHggOtgPj//qOHggPBgPj//qOHggPVgPj//qOHggPpgPj//qOegQPvANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCA/2A+P/+o4eCBBGA+P/+o4eCBCWA+P/+o4eCBDmA+P/+o4eCBE2A+P/+o56BBFMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IEiID4//6jh4IEnID4//6jh4IEsID4//6jnoEEtwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggTEgPj//qOHggTYgPj//qOHggTsgPj//qOHggUAgPj//qOHggUUgPj//qOegQUbANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCBSiA+P/+o4eCBTyA+P/+o4eCBVCA+P/+o4eCBWSA+P/+o4eCBXiA+P/+o56BBX8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IFjID4//6jh4IFoID4//6jh4IFtID4//6jh4IFyID4//6jh4IF3ID4//6jnoEF4wDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggXwgPj//qOHggYEgPj//qOHggYYgPj//qOHggYsgPj//qOHggZAgPj//qOegQZHANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCBlSA+P/+o4eCBmiA+P/+o4eCBnyA+P/+o4eCBpCA+P/+o4eCBqSA+P/+o56BBqsA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IGuID4//6jh4IGzID4//6jh4IG4ID4//6jh4IG9ID4//6jh4IHCID4//6jnoEHDwDRAgAFEBAUYABhYL/QACIAEM1+tck+ccwAAKOHggccgPj//qOHggcwgPj//qOHggdEgPj//qOHggdYgPj//qOHggdsgPj//qOegQdzANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCB4CA+P/+o4eCB5SA+P/+o4eCB6iA+P/+o4eCB7yA+P/+o4eCB9CA+P/+o56BB9cA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IH5ID4//6jh4IH+ID4//6jh4IIDID4//6jh4IIIID4//6jh4IINID4//6jnoEIOwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgghIgPj//qOHgghcgPj//qOHgghwgPj//qOHggiEgPj//qOegQifANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCMCA+P/+o4eCCNSA+P/+o4eCCOiA+P/+o4eCCPyA+P/+o56BCQMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IJEID4//6jh4IJJID4//6jh4IJOID4//6jh4IJTID4//6jh4IJYID4//6jnoEJZwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggl0gPj//qOHggmIgPj//qOHggmcgPj//qOHggmwgPj//qOHggnEgPj//qOegQnLANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCdiA+P/+o4eCCeyA+P/+o4eCCgCA+P/+o4eCChSA+P/+o4eCCiiA+P/+o56BCi8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IKPID4//6jh4IKUID4//6jh4IKZID4//6jh4IKeID4//6jh4IKjID4//6jnoEKkwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggqggPj//qOHggq0gPj//qOHggrIgPj//qOHggrcgPj//qOHggrwgPj//qOegQr3ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCwSA+P/+o4eCCxiA+P/+o4eCCyyA+P/+o4eCC0CA+P/+o4eCC1SA+P/+o56BC1sA0QIABRAQFGAAYWC/0AAiABDNfrXJPnHMAACjh4ILaID4//6jh4ILfID4//6jh4ILkID4//6jh4ILpID4//6jh4ILu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RCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IQGID4//6jh4IQLID4//6jh4IQQID4//6jh4IQVID4//6jh4IQaID4//6jnoEQbwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghB8gPj//qOHghCQgPj//qOHghCkgPj//qOHghC4gPj//qOHghDMgPj//qOegRDTANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEOCA+P/+o4eCEPSA+P/+o4eCEQiA+P/+o56BETcA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IRQ4D4//6jh4IRV4D4//6jh4IRa4D4//6jh4IRf4D4//6jh4IRk4D4//6jnoERmwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghGngPj//qOHghG7gPj//qOHghHPgPj//qOHghHjgPj//qOHghH3gPj//qOegRH/ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEguA+P/+o4eCEh+A+P/+o4eCEjOA+P/+o4eCEkeA+P/+o4eCEluA+P/+o56BEmMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4ISb4D4//6jh4ISg4D4//6jh4ISl4D4//6jh4ISq4D4//6jh4ISv4D4//6jnoESxwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghLTgPj//qOHghLngPj//qOHghL7gPj//qOHghMPgPj//qOHghMjgPj//qOegRMrANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEzeA+P/+o4eCE0uA+P/+o4eCE1+A+P/+o4eCE3OA+P/+oAEAAAAAAAAPoYeCE4cA+P/+daKDB/KBHFO7a5G7j7OBB7eK94EB8YIDX/CBDA=="),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACORtZGF03gIATGF2YzU4LjM1LjEwMAACMEAOAAACcQYF//9t3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MSByMzAyNyA0MTIxMjc3IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAyMCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTAgcmVmPTMgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9NyBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0xIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MSA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0tMiB0aHJlYWRzPTcgbG9va2FoZWFkX3RocmVhZHM9MSBzbGljZWRfdGhyZWFkcz0wIG5yPTAgZGVjaW1hdGU9MSBpbnRlcmxhY2VkPTAgYmx1cmF5X2NvbXBhdD0wIGNvbnN0cmFpbmVkX2ludHJhPTAgYmZyYW1lcz0wIHdlaWdodHA9MCBrZXlpbnQ9MjUwIGtleWludF9taW49MTAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD00MCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIzLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IGlwX3JhdGlvPTEuNDAgYXE9MToxLjAwAIAAAADvZYiED/JigADD7JycnJycnJycnJycnJycnJycnJ11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111114BGCAHARggBwEYIAcBGCAHARggBwAAAAdBmjgf4BLYARggBwEYIAcBGCAHARggBwAAAAdBmlQH+AS2ARggBwEYIAcBGCAHARggBwAAAAdBmmA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZqAP8AlsAEYIAc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AQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAA3HN0Y28AAAAAAAAAMwAAADAAAAOtAAADzAAAA+cAAAQCAAAEIQAABDwAAARXAAAEdgAABJEAAASsAAAEywAABOIAAAT5AAAFGAAABTMAAAVOAAAFbQAABYgAAAWjAAAFwgAABd0AAAX4AAAGDwAABioAAAZFAAAGZAAABn8AAAaaAAAGuQAABtQAAAbvAAAHDgAABykAAAc8AAAHWwAAB3YAAAeRAAAHsAAAB8sAAAfmAAAIBQAACCAAAAg7AAAIWgAACG0AAAiIAAAIpwAACMIAAAjdAAAI/AAAABpzZ3BkAQAAAHJvbGwAAAACAAAAAf//AAAAHHNiZ3AAAAAAcm9sbAAAAAEAAADSAAAAAQAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTguMjAuMTAw"),Object.assign(this.noSleepVideo.style,{position:"absolute",left:"-100%",top:"-100%"}),document.querySelector("body").append(this.noSleepVideo),this.handleNoSleepVideoTimeUpdate=()=>{this.noSleepVideo&&this.noSleepVideo.currentTime>4&&(this.noSleepVideo.currentTime=1)},this.noSleepVideo.addEventListener("timeupdate",this.handleNoSleepVideoTimeUpdate))}destroy(){if(this._wakeLock&&(this._wakeLock.release(),this._wakeLock=null),this.noSleepVideo){this.handleNoSleepVideoTimeUpdate&&this.noSleepVideo.removeEventListener("timeupdate",this.handleNoSleepVideoTimeUpdate);try{this.noSleepVideo.parentNode&&this.noSleepVideo.parentNode.removeChild(this.noSleepVideo)}catch(e){this.player.debugWarn("NoSleep","Failed to remove noSleepVideo element.")}this.noSleepVideo=null}this.handleVisibilityChange&&(document.removeEventListener("visibilitychange",this.handleVisibilityChange),document.removeEventListener("fullscreenchange",this.handleVisibilityChange))}_addSourceToVideo(e,t,i){var s=document.createElement("source");s.src=i,s.type=`video/${t}`,e.appendChild(s)}get isEnabled(){return this.enabled}enable(){if(cc())return navigator.wakeLock.request("screen").then((e=>{this._wakeLock=e,this.enabled=!0,this.player.debugLog("wakeLock","Wake Lock active."),this._wakeLock.addEventListener("release",(()=>{this.player.debugLog("wakeLock","Wake Lock released.")}))})).catch((e=>{throw this.enabled=!1,this.player.debugWarn("wakeLock",`${e.name}, ${e.message}`),e}));return this.noSleepVideo.play().then((e=>(this.player.debugLog("wakeLock","noSleepVideo Wake Lock active."),this.enabled=!0,e))).catch((e=>{throw this.player.debugWarn("wakeLock",`noSleepVideo ${e.name}, ${e.message}`),this.enabled=!1,e}))}disable(){cc()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):this.noSleepVideo&&this.noSleepVideo.pause(),this.enabled=!1,this.player.debugLog("wakeLock","Disabling wake lock.")}}function pc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fc={exports:{}};!function(e,t){var i,s,r,o,a;i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=a.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=a.normalizePath(r.path),a.buildURLFromParts(r)}var o=a.parseURL(t);if(!o)throw new Error("Error trying to parse relative URL.");if(o.scheme)return i.alwaysNormalize?(o.path=a.normalizePath(o.path),a.buildURLFromParts(o)):t;var n=a.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");if(!n.netLoc&&n.path&&"/"!==n.path[0]){var l=s.exec(n.path);n.netLoc=l[1],n.path=l[2]}n.netLoc&&!n.path&&(n.path="/");var d={scheme:n.scheme,netLoc:o.netLoc,path:null,params:o.params,query:o.query,fragment:o.fragment};if(!o.netLoc&&(d.netLoc=n.netLoc,"/"!==o.path[0]))if(o.path){var h=n.path,c=h.substring(0,h.lastIndexOf("/")+1)+o.path;d.path=a.normalizePath(c)}else d.path=n.path,o.params||(d.params=n.params,o.query||(d.query=n.query));return null===d.path&&(d.path=i.alwaysNormalize?a.normalizePath(o.path):o.path),a.buildURLFromParts(d)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");e.length!==(e=e.replace(o,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=a}(fc);var mc=fc.exports;function gc(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function yc(e){for(var t=1;t`):Lc}(t)}))}const Rc=Dc,Pc=/^(\d+)x(\d+)$/,Bc=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Ic{constructor(e){"string"==typeof e&&(e=Ic.parseAttrList(e)),vc(this,e)}get clientAttrs(){return Object.keys(this).filter((e=>"X-"===e.substring(0,2)))}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;const i=new Uint8Array(t.length/2);for(let e=0;eNumber.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}bool(e){return"YES"===this[e]}decimalResolution(e){const t=Pc.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const i={};for(Bc.lastIndex=0;null!==(t=Bc.exec(e));){let e=t[2];0===e.indexOf('"')&&e.lastIndexOf('"')===e.length-1&&(e=e.slice(1,-1));i[t[1].trim()]=e}return i}}function Mc(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e}class Fc{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const i=t.attr;for(const t in i)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==i[t]){Rc.warn(`DATERANGE tag attribute: "${t}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=t;break}e=vc(new Ic({}),i,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const e=new Date(this.attr["END-DATE"]);_c(e.getTime())&&(this._endDate=e)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return null!==e?new Date(this._startDate.getTime()+1e3*e):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(_c(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&_c(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class Uc{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var Oc="audio",Nc="video",jc="audiovideo";class Gc{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[Oc]:null,[Nc]:null,[jc]:null},this.baseurl=e}setByteRange(e,t){const i=e.split("@",2);let s;s=1===i.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(i[1]),this._byteRange=[s,parseInt(i[0])+s]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=mc.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class zc extends Gc{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new Uc,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const e=this.levelkeys.identity;if(e)this._decryptdata=e.getDecryptData(this.sn);else{const e=Object.keys(this.levelkeys);if(1===e.length)return this._decryptdata=this.levelkeys[e[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;if(!_c(this.programDateTime))return null;const e=_c(this.duration)?this.duration:0;return this.programDateTime+1e3*e}get encrypted(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){const e=Object.keys(this.levelkeys),t=e.length;if(t>1||1===t&&this.levelkeys[e[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()}setElementaryStreamInfo(e,t,i,s,r,o=!1){const{elementaryStreams:a}=this,n=a[e];n?(n.startPTS=Math.min(n.startPTS,t),n.endPTS=Math.max(n.endPTS,i),n.startDTS=Math.min(n.startDTS,s),n.endDTS=Math.max(n.endDTS,r)):a[e]={startPTS:t,endPTS:i,startDTS:s,endDTS:r,partial:o}}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Oc]=null,e[Nc]=null,e[jc]=null}}class Wc extends Gc{constructor(e,t,i,s,r){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new Uc,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=s;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}class Vc{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e)return this.advanced=!0,void(this.updated=!0);const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&i>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return!!this.fragments.length&&_c(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){const e=this.driftEndTime-this.driftStartTime;if(e>0){return 1e3*(this.driftEnd-this.driftStart)/e}return 1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function Hc(e){return Uint8Array.from(atob(e),(e=>e.charCodeAt(0)))}function $c(e){const t=e.split(":");let i=null;if("data"===t[0]&&2===t.length){const e=t[1].split(";"),s=e[e.length-1].split(",");if(2===s.length){const t="base64"===s[0],r=s[1];t?(e.splice(-1,1),i=Hc(r)):i=function(e){const t=Jc(e).subarray(0,16),i=new Uint8Array(16);return i.set(t,16-t.length),i}(r)}}return i}function Jc(e){return Uint8Array.from(unescape(encodeURIComponent(e)),(e=>e.charCodeAt(0)))}const qc="undefined"!=typeof self?self:void 0;var Kc={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Yc="org.w3.clearkey",Qc="com.apple.streamingkeydelivery",Xc="com.microsoft.playready",Zc="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function eu(e){switch(e){case Qc:return Kc.FAIRPLAY;case Xc:return Kc.PLAYREADY;case Zc:return Kc.WIDEVINE;case Yc:return Kc.CLEARKEY}}var tu="edef8ba979d64acea3c827dcd51d21ed";function iu(e){switch(e){case Kc.FAIRPLAY:return Qc;case Kc.PLAYREADY:return Xc;case Kc.WIDEVINE:return Zc;case Kc.CLEARKEY:return Yc}}function su(e){const{drmSystems:t,widevineLicenseUrl:i}=e,s=t?[Kc.FAIRPLAY,Kc.WIDEVINE,Kc.PLAYREADY,Kc.CLEARKEY].filter((e=>!!t[e])):[];return!s[Kc.WIDEVINE]&&i&&s.push(Kc.WIDEVINE),s}const ru=null!=qc&&null!=(ou=qc.navigator)&&ou.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;var ou;function au(e,t,i){return Uint8Array.prototype.slice?e.slice(t,i):new Uint8Array(Array.prototype.slice.call(e,t,i))}const nu=(e,t)=>t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128,lu=(e,t)=>t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128,du=(e,t)=>{const i=t;let s=0;for(;nu(e,t);){s+=10;s+=hu(e,t+6),lu(e,t+10)&&(s+=10),t+=s}if(s>0)return e.subarray(i,i+s)},hu=(e,t)=>{let i=0;return i=(127&e[t])<<21,i|=(127&e[t+1])<<14,i|=(127&e[t+2])<<7,i|=127&e[t+3],i},cu=(e,t)=>nu(e,t)&&hu(e,t+6)+10<=e.length-t,uu=e=>{const t=mu(e);for(let e=0;ee&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info,fu=e=>{const t=String.fromCharCode(e[0],e[1],e[2],e[3]),i=hu(e,4);return{type:t,size:i,data:e.subarray(10,10+i)}},mu=e=>{let t=0;const i=[];for(;nu(e,t);){const s=hu(e,t+6);t+=10;const r=t+s;for(;t+8"PRIV"===e.type?yu(e):"W"===e.type[0]?bu(e):Au(e),yu=e=>{if(e.size<2)return;const t=_u(e.data,!0),i=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:i.buffer}},Au=e=>{if(e.size<2)return;if("TXXX"===e.type){let t=1;const i=_u(e.data.subarray(t),!0);t+=i.length+1;const s=_u(e.data.subarray(t));return{key:e.type,info:i,data:s}}const t=_u(e.data.subarray(1));return{key:e.type,data:t}},bu=e=>{if("WXXX"===e.type){if(e.size<2)return;let t=1;const i=_u(e.data.subarray(t),!0);t+=i.length+1;const s=_u(e.data.subarray(t));return{key:e.type,info:i,data:s}}const t=_u(e.data);return{key:e.type,data:t}},vu=e=>{if(8===e.data.byteLength){const t=new Uint8Array(e.data),i=1&t[3];let s=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return s/=45,i&&(s+=47721858.84),Math.round(s)}},_u=(e,t=!1)=>{const i=Eu();if(i){const s=i.decode(e);if(t){const e=s.indexOf("\0");return-1!==e?s.substring(0,e):s}return s.replace(/\0/g,"")}const s=e.length;let r,o,a,n="",l=0;for(;l>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:n+=String.fromCharCode(r);break;case 12:case 13:o=e[l++],n+=String.fromCharCode((31&r)<<6|63&o);break;case 14:o=e[l++],a=e[l++],n+=String.fromCharCode((15&r)<<12|(63&o)<<6|(63&a)<<0)}}return n};let Su;function Eu(){if(!navigator.userAgent.includes("PlayStation 4"))return Su||void 0===self.TextDecoder||(Su=new self.TextDecoder("utf-8")),Su}const wu=function(e){let t="";for(let i=0;i>24,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i}function Iu(e,t){const i=[];if(!t.length)return i;const s=e.byteLength;for(let r=0;r1?r+o:s;if(Cu(e.subarray(r+4,r+8))===t[0])if(1===t.length)i.push(e.subarray(r+8,a));else{const s=Iu(e.subarray(r+8,a),t.slice(1));s.length&&ku.apply(i,s)}r=a}return i}function Mu(e){const t=[],i=e[0];let s=8;const r=xu(e,s);s+=4;let o=0,a=0;0===i?(o=xu(e,s),a=xu(e,s+4),s+=8):(o=Ru(e,s),a=Ru(e,s+8),s+=16),s+=2;let n=e.length+a;const l=Du(e,s);s+=2;for(let i=0;i>>31)return Rc.warn("SIDX has hierarchical references (not supported)"),null;const l=xu(e,i);i+=4,t.push({referenceSize:a,subsegmentDuration:l,info:{duration:l/r,start:n,end:n+a-1}}),n+=a,i+=4,s=i}return{earliestPresentationTime:o,timescale:r,version:i,referencesCount:l,references:t}}function Fu(e){const t=[],i=Iu(e,["moov","trak"]);for(let e=0;e{const i=xu(e,4),s=t[i];s&&(s.default={duration:xu(e,12),flags:xu(e,20)})})),t}function Uu(e){const t=e.subarray(8),i=t.subarray(86),s=Cu(t.subarray(4,8));let r=s;const o="enca"===s||"encv"===s;if(o){const e=Iu(t,[s])[0];Iu(e.subarray("enca"===s?28:78),["sinf"]).forEach((e=>{const t=Iu(e,["schm"])[0];if(t){const i=Cu(t.subarray(4,8));if("cbcs"===i||"cenc"===i){const t=Iu(e,["frma"])[0];t&&(r=Cu(t))}}}))}switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const e=Iu(i,["avcC"])[0];r+="."+Nu(e[1])+Nu(e[2])+Nu(e[3]);break}case"mp4a":{const e=Iu(t,[s])[0],i=Iu(e.subarray(28),["esds"])[0];if(i&&i.length>12){let e=4;if(3!==i[e++])break;e=Ou(i,e),e+=2;const t=i[e++];if(128&t&&(e+=2),64&t&&(e+=i[e++]),4!==i[e++])break;e=Ou(i,e);const s=i[e++];if(64!==s)break;if(r+="."+Nu(s),e+=12,5!==i[e++])break;e=Ou(i,e);const o=i[e++];let a=(248&o)>>3;31===a&&(a+=1+((7&o)<<3)+((224&i[e])>>5)),r+="."+a}break}case"hvc1":case"hev1":{const e=Iu(i,["hvcC"])[0],t=e[1],s=["","A","B","C"][t>>6],o=31&t,a=xu(e,2),n=(32&t)>>5?"H":"L",l=e[12],d=e.subarray(6,12);r+="."+s+o,r+="."+a.toString(16).toUpperCase(),r+="."+n+l;let h="";for(let e=d.length;e--;){const t=d[e];if(t||h){h="."+t.toString(16).toUpperCase()+h}}r+=h;break}case"dvh1":case"dvhe":{const e=Iu(i,["dvcC"])[0],t=e[2]>>1&127,s=e[2]<<5&32|e[3]>>3&31;r+="."+ju(t)+"."+ju(s);break}case"vp09":{const e=Iu(i,["vpcC"])[0],t=e[4],s=e[5],o=e[6]>>4&15;r+="."+ju(t)+"."+ju(s)+"."+ju(o);break}case"av01":{const e=Iu(i,["av1C"])[0],t=e[1]>>>5,s=31&e[1],o=e[2]>>>7?"H":"M",a=(64&e[2])>>6,n=(32&e[2])>>5,l=2===t&&a?n?12:10:a?10:8,d=(16&e[2])>>4,h=(8&e[2])>>3,c=(4&e[2])>>2,u=3&e[2],p=1,f=1,m=1,g=0;r+="."+t+"."+ju(s)+o+"."+ju(l)+"."+d+"."+h+c+u+"."+ju(p)+"."+ju(f)+"."+ju(m)+"."+g;break}}return{codec:r,encrypted:o}}function Ou(e,t){const i=t+5;for(;128&e[t++]&&t{const l=n.byteOffset-8;Iu(n,["traf"]).map((n=>{const d=Iu(n,["tfdt"]).map((e=>{const t=e[0];let i=xu(e,4);return 1===t&&(i*=Math.pow(2,32),i+=xu(e,8)),i/r}))[0];return void 0!==d&&(e=d),Iu(n,["tfhd"]).map((d=>{const h=xu(d,4),c=16777215&xu(d,0);let u=0;const p=0!=(16&c);let f=0;const m=0!=(32&c);let g=8;h===o&&(0!=(1&c)&&(g+=8),0!=(2&c)&&(g+=4),0!=(8&c)&&(u=xu(d,g),g+=4),p&&(f=xu(d,g),g+=4),m&&(g+=4),"video"===t.type&&(a=function(e){if(!e)return!1;const t=e.indexOf("."),i=t<0?e:e.substring(0,t);return"hvc1"===i||"hev1"===i||"dvh1"===i||"dvhe"===i}(t.codec)),Iu(n,["trun"]).map((o=>{const n=o[0],d=16777215&xu(o,0),h=0!=(1&d);let c=0;const p=0!=(4&d),m=0!=(256&d);let g=0;const y=0!=(512&d);let A=0;const b=0!=(1024&d),v=0!=(2048&d);let _=0;const S=xu(o,4);let E=8;h&&(c=xu(o,E),E+=4),p&&(E+=4);let w=c+l;for(let l=0;l>1&63;return 39===e||40===e}return 6===(31&t)}function $u(e,t,i,s){const r=Ju(e);let o=0;o+=t;let a=0,n=0,l=0;for(;o=r.length)break;l=r[o++],a+=l}while(255===l);n=0;do{if(o>=r.length)break;l=r[o++],n+=l}while(255===l);const e=r.length-o;let t=o;if(ne){Rc.error(`Malformed SEI payload. ${n} is too small, only ${e} bytes left to parse.`);break}if(4===a){if(181===r[t++]){const e=Du(r,t);if(t+=2,49===e){const e=xu(r,t);if(t+=4,1195456820===e){const e=r[t++];if(3===e){const o=r[t++],n=31&o,l=64&o,d=l?2+3*n:0,h=new Uint8Array(d);if(l){h[0]=o;for(let e=1;e16){const e=[];for(let i=0;i<16;i++){const s=r[t++].toString(16);e.push(1==s.length?"0"+s:s),3!==i&&5!==i&&7!==i&&9!==i||e.push("-")}const o=n-16,l=new Uint8Array(o);for(let e=0;e0?(o=new Uint8Array(4),t.length>0&&new DataView(o.buffer).setUint32(0,t.length,!1)):o=new Uint8Array;const a=new Uint8Array(4);return i&&i.byteLength>0&&new DataView(a.buffer).setUint32(0,i.byteLength,!1),function(e,...t){const i=t.length;let s=8,r=i;for(;r--;)s+=t[r].byteLength;const o=new Uint8Array(s);for(o[0]=s>>24&255,o[1]=s>>16&255,o[2]=s>>8&255,o[3]=255&s,o.set(e,4),r=0,s=8;r>8*(15-i)&255;return t}(e);return new Yu(this.method,this.uri,"identity",this.keyFormatVersions,t)}const t=$c(this.uri);if(t)switch(this.keyFormat){case Zc:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case Xc:{const e=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=qu(e,null,t);const i=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),s=String.fromCharCode.apply(null,Array.from(i)),r=s.substring(s.indexOf("<"),s.length),o=(new DOMParser).parseFromString(r,"text/xml").getElementsByTagName("KID")[0];if(o){const e=o.childNodes[0]?o.childNodes[0].nodeValue:o.getAttribute("VALUE");if(e){const t=Hc(e).subarray(0,16);!function(e){const t=function(e,t,i){const s=e[t];e[t]=e[i],e[i]=s};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}(t),this.keyId=t}}break}default:{let e=t.subarray(0,16);if(16!==e.length){const t=new Uint8Array(16);t.set(e,16-e.length),e=t}this.keyId=e;break}}if(!this.keyId||16!==this.keyId.byteLength){let e=Ku[this.uri];if(!e){const t=Object.keys(Ku).length%Number.MAX_SAFE_INTEGER;e=new Uint8Array(16);new DataView(e.buffer,12,4).setUint32(0,t),Ku[this.uri]=e}this.keyId=e}return this}}const Qu=/\{\$([a-zA-Z0-9-_]+)\}/g;function Xu(e){return Qu.test(e)}function Zu(e,t,i){if(null!==e.variableList||e.hasVariableRefs)for(let s=i.length;s--;){const r=i[s],o=t[r];o&&(t[r]=ep(e,o))}}function ep(e,t){if(null!==e.variableList||e.hasVariableRefs){const i=e.variableList;return t.replace(Qu,(t=>{const s=t.substring(2,t.length-1),r=null==i?void 0:i[s];return void 0===r?(e.playlistParsingError||(e.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${s}"`)),t):r}))}return t}function tp(e,t,i){let s,r,o=e.variableList;if(o||(e.variableList=o={}),"QUERYPARAM"in t){s=t.QUERYPARAM;try{const e=new self.URL(i).searchParams;if(!e.has(s))throw new Error(`"${s}" does not match any query parameter in URI: "${i}"`);r=e.get(s)}catch(t){e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${t.message}`))}}else s=t.NAME,r=t.VALUE;s in o?e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${s}"`)):o[s]=r||""}function ip(e,t,i){const s=t.IMPORT;if(i&&s in i){let t=e.variableList;t||(e.variableList=t={}),t[s]=i[s]}else e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}function sp(e=!0){if("undefined"==typeof self)return;return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}const rp={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function op(e,t,i=!0){return!e.split(",").some((e=>!ap(e,t,i)))}function ap(e,t,i=!0){var s;const r=sp(i);return null!=(s=null==r?void 0:r.isTypeSupported(np(e,t)))&&s}function np(e,t){return`${t}/mp4;codecs="${e}"`}function lp(e){if(e){const t=e.substring(0,4);return rp.video[t]}return 2}function dp(e){return e.split(",").reduce(((e,t)=>{const i=rp.video[t];return i?(2*i+e)/(e?3:2):(rp.audio[t]+e)/(e?2:1)}),0)}const hp={};const cp=/flac|opus/i;function up(e,t=!0){return e.replace(cp,(e=>function(e,t=!0){if(hp[e])return hp[e];const i={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[e];for(let s=0;s0&&s.length({id:e.attrs.AUDIO,audioCodec:e.audioCodec}))),SUBTITLES:o.map((e=>({id:e.attrs.SUBTITLES,textCodec:e.textCodec}))),"CLOSED-CAPTIONS":[]};let n=0;for(mp.lastIndex=0;null!==(s=mp.exec(e));){const e=new Ic(s[1]),o=e.TYPE;if(o){const s=a[o],l=r[o]||[];r[o]=l,Zu(i,e,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d=e.LANGUAGE,h=e["ASSOC-LANGUAGE"],c=e.CHANNELS,u=e.CHARACTERISTICS,p=e["INSTREAM-ID"],f={attrs:e,bitrate:0,id:n++,groupId:e["GROUP-ID"]||"",name:e.NAME||d||"",type:o,default:e.bool("DEFAULT"),autoselect:e.bool("AUTOSELECT"),forced:e.bool("FORCED"),lang:d,url:e.URI?bp.resolve(e.URI,t):""};if(h&&(f.assocLang=h),c&&(f.channels=c),u&&(f.characteristics=u),p&&(f.instreamId=p),null!=s&&s.length){const e=bp.findGroup(s,f.groupId)||s[0];Ep(f,e,"audioCodec"),Ep(f,e,"textCodec")}l.push(f)}}return r}static parseLevelPlaylist(e,t,i,s,r,o){const a=new Vc(t),n=a.fragments;let l,d,h,c=null,u=0,p=0,f=0,m=0,g=null,y=new zc(s,t),A=-1,b=!1,v=null;for(yp.lastIndex=0,a.m3u8=e,a.hasVariableRefs=Xu(e);null!==(l=yp.exec(e));){b&&(b=!1,y=new zc(s,t),y.start=f,y.sn=u,y.cc=m,y.level=i,c&&(y.initSegment=c,y.rawProgramDateTime=c.rawProgramDateTime,c.rawProgramDateTime=null,v&&(y.setByteRange(v),v=null)));const e=l[1];if(e){y.duration=parseFloat(e);const t=(" "+l[2]).slice(1);y.title=t||null,y.tagList.push(t?["INF",e,t]:["INF",e])}else if(l[3]){if(_c(y.duration)){y.start=f,h&&kp(y,h,a),y.sn=u,y.level=i,y.cc=m,n.push(y);const e=(" "+l[3]).slice(1);y.relurl=ep(a,e),wp(y,g),g=y,f+=y.duration,u++,p=0,b=!0}}else if(l[4]){const e=(" "+l[4]).slice(1);g?y.setByteRange(e,g):y.setByteRange(e)}else if(l[5])y.rawProgramDateTime=(" "+l[5]).slice(1),y.tagList.push(["PROGRAM-DATE-TIME",y.rawProgramDateTime]),-1===A&&(A=n.length);else{if(l=l[0].match(Ap),!l){Rc.warn("No matches on slow regex match for level playlist!");continue}for(d=1;d0&&e.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=e.optionalFloat("PART-HOLD-BACK",0),a.holdBack=e.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const e=new Ic(r);a.partTarget=e.decimalFloatingPoint("PART-TARGET");break}case"PART":{let e=a.partList;e||(e=a.partList=[]);const i=p>0?e[e.length-1]:void 0,s=p++,o=new Ic(r);Zu(a,o,["BYTERANGE","URI"]);const n=new Wc(o,y,t,s,i);e.push(n),y.duration+=n.duration;break}case"PRELOAD-HINT":{const e=new Ic(r);Zu(a,e,["URI"]),a.preloadHint=e;break}case"RENDITION-REPORT":{const e=new Ic(r);Zu(a,e,["URI"]),a.renditionReports=a.renditionReports||[],a.renditionReports.push(e);break}default:Rc.warn(`line parsed but not handled: ${l}`)}}}g&&!g.relurl?(n.pop(),f-=g.duration,a.partList&&(a.fragmentHint=g)):a.partList&&(wp(y,g),y.cc=m,a.fragmentHint=y,h&&kp(y,h,a));const _=n.length,S=n[0],E=n[_-1];if(f+=a.skippedSegments*a.targetduration,f>0&&_&&E){a.averagetargetduration=f/_;const e=E.sn;a.endSN="initSegment"!==e?e:0,a.live||(E.endList=!0),S&&(a.startCC=S.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(f+=a.fragmentHint.duration),a.totalduration=f,a.endCC=m,A>0&&function(e,t){let i=e[t];for(let s=t;s--;){const t=e[s];if(!t)return;t.programDateTime=i.programDateTime-1e3*t.duration,i=t}}(n,A),a}}function vp(e,t,i){var s,r;const o=new Ic(e);Zu(i,o,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const a=null!=(s=o.METHOD)?s:"",n=o.URI,l=o.hexadecimalInteger("IV"),d=o.KEYFORMATVERSIONS,h=null!=(r=o.KEYFORMAT)?r:"identity";n&&o.IV&&!l&&Rc.error(`Invalid IV: ${o.IV}`);const c=n?bp.resolve(n,t):"",u=(d||"1").split("/").map(Number).filter(Number.isFinite);return new Yu(a,c,h,u,l)}function _p(e){const t=new Ic(e).decimalFloatingPoint("TIME-OFFSET");return _c(t)?t:null}function Sp(e,t){let i=(e||"").split(/[ ,]+/).filter((e=>e));["video","audio","text"].forEach((e=>{const s=i.filter((t=>function(e,t){const i=rp[t];return!!i&&!!i[e.slice(0,4)]}(t,e)));s.length&&(t[`${e}Codec`]=s.join(","),i=i.filter((e=>-1===s.indexOf(e))))})),t.unknownCodecs=i}function Ep(e,t,i){const s=t[i];s&&(e[i]=s)}function wp(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),_c(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}function Tp(e,t,i,s){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=i,e.sn="initSegment",s&&(e.levelkeys=s),e.initSegment=null}function kp(e,t,i){e.levelkeys=t;const{encryptedFragments:s}=i;s.length&&s[s.length-1].levelkeys===t||!Object.keys(t).some((e=>t[e].isCommonEncryption))||s.push(e)}var Lp="manifest",Cp="level",Dp="audioTrack",xp="subtitleTrack",Rp="main",Pp="audio",Bp="subtitle";function Ip(e){const{type:t}=e;switch(t){case Dp:return Pp;case xp:return Bp;default:return Rp}}function Mp(e,t){let i=e.url;return void 0!==i&&0!==i.indexOf("data:")||(i=t.url),i}class Fp{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wc.LEVEL_LOADING,this.onLevelLoading,this),e.on(wc.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(wc.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wc.LEVEL_LOADING,this.onLevelLoading,this),e.off(wc.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(wc.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,s=t.loader,r=new(i||s)(t);return this.loaders[e.type]=r,r}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Lp,url:i,deliveryDirectives:null})}onLevelLoading(e,t){const{id:i,level:s,pathwayId:r,url:o,deliveryDirectives:a}=t;this.load({id:i,level:s,pathwayId:r,responseType:"text",type:Cp,url:o,deliveryDirectives:a})}onAudioTrackLoading(e,t){const{id:i,groupId:s,url:r,deliveryDirectives:o}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:Dp,url:r,deliveryDirectives:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:s,url:r,deliveryDirectives:o}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:xp,url:r,deliveryDirectives:o})}load(e){var t;const i=this.hls.config;let s,r=this.getInternalLoader(e);if(r){const t=r.context;if(t&&t.url===e.url&&t.level===e.level)return void Rc.trace("[playlist-loader]: playlist request ongoing");Rc.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}if(s=e.type===Lp?i.manifestLoadPolicy.default:vc({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),_c(null==(t=e.deliveryDirectives)?void 0:t.part)){let t;if(e.type===Cp&&null!==e.level?t=this.hls.levels[e.level].details:e.type===Dp&&null!==e.id?t=this.hls.audioTracks[e.id].details:e.type===xp&&null!==e.id&&(t=this.hls.subtitleTracks[e.id].details),t){const e=t.partTarget,i=t.targetduration;if(e&&i){const t=1e3*Math.max(3*e,.8*i);s=vc({},s,{maxTimeToFirstByteMs:Math.min(t,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(t,s.maxTimeToFirstByteMs)})}}}const o=s.errorRetry||s.timeoutRetry||{},a={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},n={onSuccess:(e,t,i,s)=>{const r=this.getInternalLoader(i);this.resetInternalLoader(i.type);const o=e.data;0===o.indexOf("#EXTM3U")?(t.parsing.start=performance.now(),bp.isMediaPlaylist(o)?this.handleTrackOrLevelPlaylist(e,t,i,s||null,r):this.handleMasterPlaylist(e,t,i,s)):this.handleManifestParsingError(e,i,new Error("no EXTM3U delimiter"),s||null,t)},onError:(e,t,i,s)=>{this.handleNetworkError(t,i,!1,e,s)},onTimeout:(e,t,i)=>{this.handleNetworkError(t,i,!0,void 0,e)}};r.load(e,a,n)}handleMasterPlaylist(e,t,i,s){const r=this.hls,o=e.data,a=Mp(e,i),n=bp.parseMasterPlaylist(o,a);if(n.playlistParsingError)return void this.handleManifestParsingError(e,i,n.playlistParsingError,s,t);const{contentSteering:l,levels:d,sessionData:h,sessionKeys:c,startTimeOffset:u,variableList:p}=n;this.variableList=p;const{AUDIO:f=[],SUBTITLES:m,"CLOSED-CAPTIONS":g}=bp.parseMasterPlaylistMedia(o,a,n);if(f.length){f.some((e=>!e.url))||!d[0].audioCodec||d[0].attrs.AUDIO||(Rc.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),f.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Ic({}),bitrate:0,url:""}))}r.trigger(wc.MANIFEST_LOADED,{levels:d,audioTracks:f,subtitles:m,captions:g,contentSteering:l,url:a,stats:t,networkDetails:s,sessionData:h,sessionKeys:c,startTimeOffset:u,variableList:p})}handleTrackOrLevelPlaylist(e,t,i,s,r){const o=this.hls,{id:a,level:n,type:l}=i,d=Mp(e,i),h=_c(n)?n:_c(a)?a:0,c=Ip(i),u=bp.parseLevelPlaylist(e.data,d,h,c,0,this.variableList);if(l===Lp){const e={attrs:new Ic({}),bitrate:0,details:u,name:"",url:d};o.trigger(wc.MANIFEST_LOADED,{levels:[e],audioTracks:[],url:d,stats:t,networkDetails:s,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=u,this.handlePlaylistLoaded(u,e,t,i,s,r)}handleManifestParsingError(e,t,i,s,r){this.hls.trigger(wc.ERROR,{type:Tc.NETWORK_ERROR,details:kc.MANIFEST_PARSING_ERROR,fatal:t.type===Lp,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:s,stats:r})}handleNetworkError(e,t,i=!1,s,r){let o=`A network ${i?"timeout":"error"+(s?" (status "+s.code+")":"")} occurred while loading ${e.type}`;e.type===Cp?o+=`: ${e.level} id: ${e.id}`:e.type!==Dp&&e.type!==xp||(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);Rc.warn(`[playlist-loader]: ${o}`);let n=kc.UNKNOWN,l=!1;const d=this.getInternalLoader(e);switch(e.type){case Lp:n=i?kc.MANIFEST_LOAD_TIMEOUT:kc.MANIFEST_LOAD_ERROR,l=!0;break;case Cp:n=i?kc.LEVEL_LOAD_TIMEOUT:kc.LEVEL_LOAD_ERROR,l=!1;break;case Dp:n=i?kc.AUDIO_TRACK_LOAD_TIMEOUT:kc.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case xp:n=i?kc.SUBTITLE_TRACK_LOAD_TIMEOUT:kc.SUBTITLE_LOAD_ERROR,l=!1}d&&this.resetInternalLoader(e.type);const h={type:Tc.NETWORK_ERROR,details:n,fatal:l,url:e.url,loader:d,context:e,error:a,networkDetails:t,stats:r};if(s){const i=(null==t?void 0:t.url)||e.url;h.response=yc({url:i,data:void 0},s)}this.hls.trigger(wc.ERROR,h)}handlePlaylistLoaded(e,t,i,s,r,o){const a=this.hls,{type:n,level:l,id:d,groupId:h,deliveryDirectives:c}=s,u=Mp(t,s),p=Ip(s),f="number"==typeof s.level&&p===Rp?l:void 0;if(!e.fragments.length){const e=new Error("No Segments found in Playlist");return void a.trigger(wc.ERROR,{type:Tc.NETWORK_ERROR,details:kc.LEVEL_EMPTY_ERROR,fatal:!1,url:u,error:e,reason:e.message,response:t,context:s,level:f,parent:p,networkDetails:r,stats:i})}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const m=e.playlistParsingError;if(m)a.trigger(wc.ERROR,{type:Tc.NETWORK_ERROR,details:kc.LEVEL_PARSING_ERROR,fatal:!1,url:u,error:m,reason:m.message,response:t,context:s,level:f,parent:p,networkDetails:r,stats:i});else switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),o.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),n){case Lp:case Cp:a.trigger(wc.LEVEL_LOADED,{details:e,level:f||0,id:d||0,stats:i,networkDetails:r,deliveryDirectives:c});break;case Dp:a.trigger(wc.AUDIO_TRACK_LOADED,{details:e,id:d||0,groupId:h||"",stats:i,networkDetails:r,deliveryDirectives:c});break;case xp:a.trigger(wc.SUBTITLE_TRACK_LOADED,{details:e,id:d||0,groupId:h||"",stats:i,networkDetails:r,deliveryDirectives:c})}}}function Up(e,t){let i;try{i=new Event("addtrack")}catch(e){i=document.createEvent("Event"),i.initEvent("addtrack",!1,!1)}i.track=e,t.dispatchEvent(i)}function Op(e,t){const i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error(`addCue is failed for: ${t}`)}catch(i){Rc.debug(`[texttrack-utils]: ${i}`);try{const i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}catch(e){Rc.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${e}`)}}"disabled"===i&&(e.mode=i)}function Np(e){const t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(let t=e.cues.length;t--;)e.removeCue(e.cues[t]);"disabled"===t&&(e.mode=t)}function jp(e,t,i,s){const r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&e.cues.length>0){const r=function(e,t,i){const s=[],r=function(e,t){if(te[i].endTime)return-1;let s=0,r=i;for(;s<=r;){const o=Math.floor((r+s)/2);if(te[o].startTime&&s-1)for(let o=r,a=e.length;o=t&&r.endTime<=i)s.push(r);else if(r.startTime>i)return s}return s}(e.cues,t,i);for(let t=0;t{const e=Hp();try{e&&new e(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function qp(e,t){return e.getTime()/1e3-t}class Kp{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(wc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(wc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wc.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(wc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(wc.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(wc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(wc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wc.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(wc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(wc.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(Np(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;tJp&&(s=Jp);s-i<=0&&(s=i+.25);for(let e=0;ee.type===zp&&n:"video"===s?e=>e.type===Vp&&a:e=>e.type===zp&&n||e.type===Vp&&a,jp(r,t,i,e)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:i,id3Track:s}=this,{dateRanges:r}=t,o=Object.keys(r);if(s){const e=Object.keys(i).filter((e=>!o.includes(e)));for(let t=e.length;t--;){const r=e[t];Object.keys(i[r].cues).forEach((e=>{s.removeCue(i[r].cues[e])})),delete i[r]}}const a=t.fragments[t.fragments.length-1];if(0===o.length||!_c(null==a?void 0:a.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const n=a.programDateTime/1e3-a.start,l=Hp();for(let e=0;e{if(t!==s.id){const i=r[t];if(i.class===s.class&&i.startDate>s.startDate&&(!e||s.startDatethis.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(null===e)return null;const{holdBack:t,partHoldBack:i,targetduration:s}=e,{liveSyncDuration:r,liveSyncDurationCount:o,lowLatencyMode:a}=this.config,n=this.hls.userConfig;let l=a&&i||t;(n.liveSyncDuration||n.liveSyncDurationCount||0===l)&&(l=void 0!==r?r:o*s);const d=s;return l+Math.min(1*this.stallCount,d)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(null===e||null===t||null===i)return null;const s=i.edge,r=e-t-this.edgeStalled,o=s-i.totalduration,a=s-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(o,r),a)}get drift(){const{levelDetails:e}=this;return null===e?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(null===e)return 0;const t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(wc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(wc.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(wc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(wc.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(wc.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(wc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(wc.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(wc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(wc.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(wc.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var i;t.details===kc.BUFFER_STALLED_ERROR&&(this.stallCount++,null!=(i=this.levelDetails)&&i.live&&Rc.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const i=this.computeLatency();if(null===i)return;this._latency=i;const{lowLatencyMode:s,maxLiveSyncPlaybackRate:r}=this.config;if(!s||1===r||!t.live)return;const o=this.targetLatency;if(null===o)return;const a=i-o;if(a.05&&this.forwardBufferLength>1){const t=Math.min(2,Math.max(1,r)),i=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;e.playbackRate=Math.min(t,Math.max(1,i))}else 1!==e.playbackRate&&0!==e.playbackRate&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return null===e?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return null===e?null:e-this.currentTime}}const Qp=["NONE","TYPE-0","TYPE-1",null];const Xp=["SDR","PQ","HLG"];var Zp="",ef="YES",tf="v2";function sf(e){const{canSkipUntil:t,canSkipDateRanges:i,age:s}=e;return t&&s!!e)).map((e=>e.substring(0,4))).join(","),this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return af(this._audioGroups,e)}hasSubtitleGroup(e){return af(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t)if("audio"===e){let e=this._audioGroups;e||(e=this._audioGroups=[]),-1===e.indexOf(t)&&e.push(t)}else if("text"===e){let e=this._subtitleGroups;e||(e=this._subtitleGroups=[]),-1===e.indexOf(t)&&e.push(t)}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return null==(e=this.audioGroups)?void 0:e[0]}get textGroupId(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}addFallback(){}}function af(e,t){return!(!t||!e)&&-1!==e.indexOf(t)}function nf(e,t){const i=t.startPTS;if(_c(i)){let s,r=0;t.sn>e.sn?(r=i-e.start,s=e):(r=e.start-i,s=t),s.duration!==r&&(s.duration=r)}else if(t.sn>e.sn){e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration}else t.start=Math.max(e.start-t.duration,0)}function lf(e,t,i,s,r,o){s-i<=0&&(Rc.warn("Fragment should have a positive duration",t),s=i+t.duration,o=r+t.duration);let a=i,n=s;const l=t.startPTS,d=t.endPTS;if(_c(l)){const e=Math.abs(l-i);_c(t.deltaPTS)?t.deltaPTS=Math.max(e,t.deltaPTS):t.deltaPTS=e,a=Math.max(i,l),i=Math.min(i,l),r=Math.min(r,t.startDTS),n=Math.min(s,d),s=Math.max(s,d),o=Math.max(o,t.endDTS)}const h=i-t.start;0!==t.start&&(t.start=i),t.duration=s-t.start,t.startPTS=i,t.maxStartPTS=a,t.startDTS=r,t.endPTS=s,t.minEndPTS=n,t.endDTS=o;const c=t.sn;if(!e||ce.endSN)return 0;let u;const p=c-e.startSN,f=e.fragments;for(f[p]=t,u=p;u>0;u--)nf(f[u],f[u-1]);for(u=p;u=0;e--){const t=s[e].initSegment;if(t){i=t;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;let r,o=0;if(function(e,t,i){const s=t.skippedSegments,r=Math.max(e.startSN,t.startSN)-t.startSN,o=(e.fragmentHint?1:0)+(s?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,a=t.startSN-e.startSN,n=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;for(let e=r;e<=o;e++){const r=l[a+e];let o=n[e];s&&!o&&e{e.relurl&&(o=e.cc-s.cc),_c(e.startPTS)&&_c(e.endPTS)&&(s.start=s.startPTS=e.startPTS,s.startDTS=e.startDTS,s.maxStartPTS=e.maxStartPTS,s.endPTS=e.endPTS,s.endDTS=e.endDTS,s.minEndPTS=e.minEndPTS,s.duration=e.endPTS-e.startPTS,s.duration&&(r=s),t.PTSKnown=t.alignedSliding=!0),s.elementaryStreams=e.elementaryStreams,s.loader=e.loader,s.stats=e.stats,e.initSegment&&(s.initSegment=e.initSegment,i=e.initSegment)})),i){(t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments).forEach((e=>{var t;!e||e.initSegment&&e.initSegment.relurl!==(null==(t=i)?void 0:t.relurl)||(e.initSegment=i)}))}if(t.skippedSegments)if(t.deltaUpdateFailed=t.fragments.some((e=>!e)),t.deltaUpdateFailed){Rc.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let e=t.skippedSegments;e--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC=t.fragments[0].cc}else t.canSkipDateRanges&&(t.dateRanges=function(e,t,i){const s=vc({},e);i&&i.forEach((e=>{delete s[e]}));return Object.keys(t).forEach((e=>{const i=new Fc(t[e].attr,s[e]);i.isValid?s[e]=i:Rc.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(t[e].attr)}"`)})),s}(e.dateRanges,t.dateRanges,t.recentlyRemovedDateranges));const a=t.fragments;if(o){Rc.warn("discontinuity sliding from playlist, take drift into account");for(let e=0;e{t.elementaryStreams=e.elementaryStreams,t.stats=e.stats})),r?lf(t,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS):hf(e,t),a.length&&(t.totalduration=t.edge-a[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;const n=t.advancedDateTime;if(t.advanced&&n){const e=t.edge;t.driftStart||(t.driftStartTime=n,t.driftStart=e),t.driftEndTime=n,t.driftEnd=e}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime}function hf(e,t){const i=t.startSN+t.skippedSegments-e.startSN,s=e.fragments;i<0||i>=s.length||cf(t,s[i].start)}function cf(e,t){if(t){const i=e.fragments;for(let s=e.skippedSegments;s{const{details:i}=e;null!=i&&i.fragments&&i.fragments.forEach((e=>{e.level=t}))}))}function mf(e){switch(e.details){case kc.FRAG_LOAD_TIMEOUT:case kc.KEY_LOAD_TIMEOUT:case kc.LEVEL_LOAD_TIMEOUT:case kc.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function gf(e,t){const i=mf(t);return e.default[(i?"timeout":"error")+"Retry"]}function yf(e,t){const i="linear"===e.backoff?1:Math.pow(2,t);return Math.min(i*e.retryDelayMs,e.maxRetryDelayMs)}function Af(e){return yc(yc({},e),{errorRetry:null,timeoutRetry:null})}function bf(e,t,i,s){if(!e)return!1;const r=null==s?void 0:s.code,o=t499)}(r)||!!i);return e.shouldRetry?e.shouldRetry(e,t,i,s,o):o}const vf=function(e,t){let i=0,s=e.length-1,r=null,o=null;for(;i<=s;){r=(i+s)/2|0,o=e[r];const a=t(o);if(a>0)i=r+1;else{if(!(a<0))return o;s=r-1}}return null};function _f(e,t,i=0,s=0,r=.005){let o=null;if(e){o=t[e.sn-t[0].sn+1]||null;const s=e.endDTS-i;s>0&&s<15e-7&&(i+=15e-7)}else 0===i&&0===t[0].start&&(o=t[0]);if(o&&((!e||e.level===o.level)&&0===Sf(i,s,o)||function(e,t,i){if(t&&0===t.start&&t.level0){const s=t.tagList.reduce(((e,t)=>("INF"===t[0]&&(e+=parseFloat(t[1])),e)),i);return e.start<=s}return!1}(o,e,Math.min(r,s))))return o;const a=vf(t,Sf.bind(null,i,s));return!a||a===e&&o?o:a}function Sf(e=0,t=0,i){if(i.start<=e&&i.start+i.duration>e)return 0;const s=Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return i.start+i.duration-s<=e?1:i.start-s>e&&i.start?-1:0}function Ef(e,t,i){const s=1e3*Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return(i.endProgramDateTime||0)-s>e}var wf=0,Tf=2,kf=3,Lf=5,Cf=0,Df=1,xf=2;class Rf{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=Rc.log.bind(Rc,`${t}:`),this.warn=Rc.warn.bind(Rc,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const s=null==t?void 0:t.renditionReports;if(s){let r=-1;for(let i=0;i=0&&e>t.partTarget&&(a+=1)}const n=i&&sf(i);return new rf(o,a>=0?a:void 0,n)}}}loadPlaylist(e){-1===this.requestScheduled&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return-1===this.timer&&-1===this.requestScheduled&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,i){const{details:s,stats:r}=t,o=self.performance.now(),a=r.loading.first?Math.max(0,o-r.loading.first):0;if(s.advancedDateTime=Date.now()-a,s.live||null!=i&&i.live){if(s.reloaded(i),i&&this.log(`live playlist ${e} ${s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:s.updated?"UPDATED":"MISSED"}`),i&&s.fragments.length>0&&df(i,s),!this.canLoad||!s.live)return;let a,n,l;if(s.canBlockReload&&s.endSN&&s.advanced){const e=this.hls.config.lowLatencyMode,r=s.lastPartSn,o=s.endSN,d=s.lastPartIndex,h=r===o,c=e?0:d;-1!==d?(n=h?o+1:r,l=h?c:d+1):n=o+1;const u=s.age,p=u+s.ageHeader;let f=Math.min(p-s.partTarget,1.5*s.targetduration);if(f>0){if(i&&f>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${f} with playlist age: ${s.age}`),f=0;else{const e=Math.floor(f/s.targetduration);if(n+=e,void 0!==l){l+=Math.round(f%s.targetduration/s.partTarget)}this.log(`CDN Tune-in age: ${s.ageHeader}s last advanced ${u.toFixed(2)}s goal: ${f} skip sn ${e} to part ${l}`)}s.tuneInGoal=f}if(a=this.getDeliveryDirectives(s,t.deliveryDirectives,n,l),e||!h)return void this.loadPlaylist(a)}else(s.canBlockReload||s.canSkipUntil)&&(a=this.getDeliveryDirectives(s,t.deliveryDirectives,n,l));const d=this.hls.mainForwardBufferInfo,h=d?d.end-d.len:0,c=function(e,t=1/0){let i=1e3*e.targetduration;if(e.updated){const s=e.fragments,r=4;if(s.length&&i*r>t){const e=1e3*s[s.length-1].duration;ethis.requestScheduled+c&&(this.requestScheduled=r.loading.start),void 0!==n&&s.canBlockReload?this.requestScheduled=r.loading.first+c-(1e3*s.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+cthis.loadPlaylist(a)),u)}else this.clearTimer()}getDeliveryDirectives(e,t,i,s){let r=sf(e);return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,s=t.part,r=Zp),new rf(i,s,r)}checkRetry(e){const t=e.details,i=mf(e),s=e.errorAction,{action:r,retryCount:o=0,retryConfig:a}=s||{},n=!!s&&!!a&&(r===Lf||!s.resolved&&r===Tf);if(n){var l;if(this.requestScheduled=-1,o>=a.maxNumRetry)return!1;if(i&&null!=(l=e.context)&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const e=yf(a,o);this.timer=self.setTimeout((()=>this.loadPlaylist()),e),this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" in ${e}ms`)}e.levelRetry=!0,s.resolved=!0}return n}}class Pf{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class Bf{constructor(e,t,i,s=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Pf(e),this.fast_=new Pf(t),this.defaultTTFB_=s,this.ttfb_=new Pf(e)}update(e,t){const{slow_:i,fast_:s,ttfb_:r}=this;i.halfLife!==e&&(this.slow_=new Pf(e,i.getEstimate(),i.getTotalWeight())),s.halfLife!==t&&(this.fast_=new Pf(t,s.getEstimate(),s.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new Pf(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){const i=(e=Math.max(e,this.minDelayMs_))/1e3,s=8*t/i;this.fast_.sample(i,s),this.slow_.sample(i,s)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const If={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},Mf={};function Ff(e,t,i,s,r,o){const a=e.audioCodec?e.audioGroups:null,n=null==o?void 0:o.audioCodec,l=null==o?void 0:o.channels,d=l?parseInt(l):n?1/0:2;let h=null;if(null!=a&&a.length)try{h=1===a.length&&a[0]?t.groups[a[0]].channels:a.reduce(((e,i)=>{if(i){const s=t.groups[i];if(!s)throw new Error(`Audio track group ${i} not found`);Object.keys(s.channels).forEach((t=>{e[t]=(e[t]||0)+s.channels[t]}))}return e}),{2:0})}catch(e){return!0}return void 0!==e.videoCodec&&(e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(s,30)||"SDR"!==e.videoRange&&e.videoRange!==i||e.bitrate>Math.max(r,8e6))||!!h&&_c(d)&&Object.keys(h).some((e=>parseInt(e)>d))}function Uf(e,t,i){const s=e.videoCodec,r=e.audioCodec;if(!s||!r||!i)return Promise.resolve(If);const o={width:e.width,height:e.height,bitrate:Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)),framerate:e.frameRate||30},a=e.videoRange;"SDR"!==a&&(o.transferFunction=a.toLowerCase());const n=s.split(",").map((e=>({type:"media-source",video:yc(yc({},o),{},{contentType:np(e,"video")})})));return r&&e.audioGroups&&e.audioGroups.forEach((e=>{var i;e&&(null==(i=t.groups[e])||i.tracks.forEach((t=>{if(t.groupId===e){const e=t.channels||"",i=parseFloat(e);_c(i)&&i>2&&n.push.apply(n,r.split(",").map((e=>({type:"media-source",audio:{contentType:np(e,"audio"),channels:""+i}}))))}})))})),Promise.all(n.map((e=>{const t=function(e){const{audio:t,video:i}=e,s=i||t;if(s){const e=s.contentType.split('"')[1];if(i)return`r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${e}_${Math.ceil(i.bitrate/1e5)}`;if(t)return`c${t.channels}${t.spatialRendering?"s":"n"}_${e}`}return""}(e);return Mf[t]||(Mf[t]=i.decodingInfo(e))}))).then((e=>({supported:!e.some((e=>!e.supported)),configurations:n,decodingInfoResults:e}))).catch((e=>({supported:!1,configurations:n,decodingInfoResults:[],error:e})))}function Of(e,t){let i=!1,s=[];return e&&(i="SDR"!==e,s=[e]),t&&(s=t.allowedVideoRanges||Xp.slice(0),i=void 0!==t.preferHDR?t.preferHDR:function(){if("function"==typeof matchMedia){const e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}(),s=i?s.filter((e=>"SDR"!==e)):["SDR"]),{preferHDR:i,allowedVideoRanges:s}}function Nf(e,t){Rc.log(`[abr] start candidates with "${e}" ignored because ${t}`)}function jf(e,t,i){if("attrs"in e){const i=t.indexOf(e);if(-1!==i)return i}for(let s=0;s-1===s.indexOf(e)))}(n,t.characteristics))&&(void 0===i||i(e,t))}function zf(e,t){const{audioCodec:i,channels:s}=e;return!(void 0!==i&&(t.audioCodec||"").substring(0,4)!==i.substring(0,4)||void 0!==s&&s!==(t.channels||"2"))}function Wf(e,t,i){for(let s=t;s;s--)if(i(e[s]))return s;for(let s=t+1;s{const o=this.fragments[s];if(!o)return;if(r>=o.body.sn)return;if(!o.buffered&&!o.loaded)return void(o.body.type===i&&this.removeFragment(o.body));const a=o.range[e];a&&a.time.some((e=>{const i=!this.isTimeBuffered(e.startPTS,e.endPTS,t);return i&&this.removeFragment(o.body),i}))}))}detectPartialFragments(e){const t=this.timeRanges,{frag:i,part:s}=e;if(!t||"initSegment"===i.sn)return;const r=Yf(i),o=this.fragments[r];if(!o||o.buffered&&i.gap)return;const a=!i.relurl;if(Object.keys(t).forEach((e=>{const r=i.elementaryStreams[e];if(!r)return;const n=t[e],l=a||!0===r.partial;o.range[e]=this.getBufferedTimes(i,s,l,n)})),o.loaded=null,Object.keys(o.range).length){o.buffered=!0;(o.body.endList=i.endList||o.body.endList)&&(this.endListFragments[o.body.type]=o),Kf(o)||this.removeParts(i.sn-1,i.type)}else this.removeFragment(o.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter((t=>t.fragment.sn>=e)))}fragBuffered(e,t){const i=Yf(e);let s=this.fragments[i];!s&&t&&(s=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),s&&(s.loaded=null,s.buffered=!0)}getBufferedTimes(e,t,i,s){const r={time:[],partial:i},o=e.start,a=e.end,n=e.minEndPTS||a,l=e.maxStartPTS||o;for(let e=0;e=t&&n<=i){r.time.push({startPTS:Math.max(o,s.start(e)),endPTS:Math.min(a,s.end(e))});break}if(ot){const t=Math.max(o,s.start(e)),i=Math.min(a,s.end(e));i>t&&(r.partial=!0,r.time.push({startPTS:t,endPTS:i}))}else if(a<=t)break}return r}getPartialFragment(e){let t,i,s,r=null,o=0;const{bufferPadding:a,fragments:n}=this;return Object.keys(n).forEach((l=>{const d=n[l];d&&Kf(d)&&(i=d.body.start-a,s=d.body.end+a,e>=i&&e<=s&&(t=Math.min(e-i,s-e),o<=t&&(r=d.body,o=t)))})),r}isEndListAppended(e){const t=this.endListFragments[e];return void 0!==t&&(t.buffered||Kf(t))}getState(e){const t=Yf(e),i=this.fragments[t];return i?i.buffered?Kf(i)?$f:Jf:Hf:Vf}isTimeBuffered(e,t,i){let s,r;for(let o=0;o=s&&t<=r)return!0;if(t<=s)return!1}return!1}onFragLoaded(e,t){const{frag:i,part:s}=t;if("initSegment"===i.sn||i.bitrateTest)return;const r=s?null:t,o=Yf(i);this.fragments[o]={body:i,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:s,timeRanges:r}=t;if("initSegment"===i.sn)return;const o=i.type;if(s){let e=this.activePartLists[o];e||(this.activePartLists[o]=e=[]),e.push(s)}this.timeRanges=r,Object.keys(r).forEach((e=>{const t=r[e];this.detectEvictedFragments(e,t,o,s)}))}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Yf(e);return!!this.fragments[t]}hasParts(e){var t;return!(null==(t=this.activePartLists[e])||!t.length)}removeFragmentsInRange(e,t,i,s,r){s&&!this.hasGaps||Object.keys(this.fragments).forEach((o=>{const a=this.fragments[o];if(!a)return;const n=a.body;n.type!==i||s&&!n.gap||n.starte&&(a.buffered||r)&&this.removeFragment(n)}))}removeFragment(e){const t=Yf(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const t=e.sn;this.activePartLists[e.type]=i.filter((e=>e.fragment.sn!==t))}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function Kf(e){var t,i,s;return e.buffered&&(e.body.gap||(null==(t=e.range.video)?void 0:t.partial)||(null==(i=e.range.audio)?void 0:i.partial)||(null==(s=e.range.audiovideo)?void 0:s.partial))}function Yf(e){return`${e.type}_${e.level}_${e.sn}`}const Qf={length:0,start:()=>0,end:()=>0};class Xf{static isBuffered(e,t){try{if(e){const i=Xf.getBuffered(e);for(let e=0;e=i.start(e)&&t<=i.end(e))return!0}}catch(e){}return!1}static bufferInfo(e,t,i){try{if(e){const s=Xf.getBuffered(e),r=[];let o;for(o=0;oo&&(s[r-1].end=e[t].end):s.push(e[t])}else s.push(e[t])}else s=e;let r,o=0,a=t,n=t;for(let e=0;e=l&&ti.startCC||e&&e.cc{if(this.loader&&this.loader.destroy(),e.gap){if(e.tagList.some((e=>"GAP"===e[0])))return void n(lm(e));e.gap=!1}const l=this.loader=e.loader=r?new r(s):new o(s),d=nm(e),h=Af(s.fragLoadPolicy.default),c={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:om};e.stats=l.stats,l.load(d,c,{onSuccess:(t,i,s,r)=>{this.resetLoader(e,l);let o=t.data;s.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(o.slice(0,16)),o=o.slice(16)),a({frag:e,part:null,payload:o,networkDetails:r})},onError:(t,s,r,o)=>{this.resetLoader(e,l),n(new dm({type:Tc.NETWORK_ERROR,details:kc.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:yc({url:i,data:void 0},t),error:new Error(`HTTP Error ${t.code} ${t.text}`),networkDetails:r,stats:o}))},onAbort:(t,i,s)=>{this.resetLoader(e,l),n(new dm({type:Tc.NETWORK_ERROR,details:kc.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:s,stats:t}))},onTimeout:(t,i,s)=>{this.resetLoader(e,l),n(new dm({type:Tc.NETWORK_ERROR,details:kc.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${c.timeout}ms`),networkDetails:s,stats:t}))},onProgress:(i,s,r,o)=>{t&&t({frag:e,part:null,payload:r,networkDetails:o})}})}))}loadPart(e,t,i){this.abort();const s=this.config,r=s.fLoader,o=s.loader;return new Promise(((a,n)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap)return void n(lm(e,t));const l=this.loader=e.loader=r?new r(s):new o(s),d=nm(e,t),h=Af(s.fragLoadPolicy.default),c={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:om};t.stats=l.stats,l.load(d,c,{onSuccess:(s,r,o,n)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const d={frag:e,part:t,payload:s.data,networkDetails:n};i(d),a(d)},onError:(i,s,r,o)=>{this.resetLoader(e,l),n(new dm({type:Tc.NETWORK_ERROR,details:kc.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:yc({url:d.url,data:void 0},i),error:new Error(`HTTP Error ${i.code} ${i.text}`),networkDetails:r,stats:o}))},onAbort:(i,s,r)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),n(new dm({type:Tc.NETWORK_ERROR,details:kc.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:r,stats:i}))},onTimeout:(i,s,r)=>{this.resetLoader(e,l),n(new dm({type:Tc.NETWORK_ERROR,details:kc.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${c.timeout}ms`),networkDetails:r,stats:i}))}})}))}updateStatsFromPart(e,t){const i=e.stats,s=t.stats,r=s.total;if(i.loaded+=s.loaded,r){const s=Math.round(e.duration/t.duration),o=Math.min(Math.round(i.loaded/r),s),a=(s-o)*Math.round(i.loaded/o);i.total=i.loaded+a}else i.total=Math.max(i.loaded,i.total);const o=i.loading,a=s.loading;o.start?o.first+=a.first-a.start:(o.start=a.start,o.first=a.first),o.end=a.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function nm(e,t=null){const i=t||e,s={frag:e,part:t,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},r=i.byteRangeStartOffset,o=i.byteRangeEndOffset;if(_c(r)&&_c(o)){var a;let t=r,i=o;if("initSegment"===e.sn&&"AES-128"===(null==(a=e.decryptdata)?void 0:a.method)){const e=o-r;e%16&&(i=o+(16-e%16)),0!==r&&(s.resetIV=!0,t=r-16)}s.rangeStart=t,s.rangeEnd=i}return s}function lm(e,t){const i=new Error(`GAP ${e.gap?"tag":"attribute"} found`),s={type:Tc.MEDIA_ERROR,details:kc.FRAG_GAP,fatal:!1,frag:e,error:i,networkDetails:null};return t&&(s.part=t),(t||e).stats.aborted=!0,new dm(s)}class dm extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class hm{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class cm{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}class um{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let e=0;e<4;e++)i[e]=t.getUint32(4*e);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,s=i[0],r=i[1],o=i[2],a=i[3],n=this.invSubMix,l=n[0],d=n[1],h=n[2],c=n[3],u=new Uint32Array(256);let p=0,f=0,m=0;for(m=0;m<256;m++)u[m]=m<128?m<<1:m<<1^283;for(m=0;m<256;m++){let i=f^f<<1^f<<2^f<<3^f<<4;i=i>>>8^255&i^99,e[p]=i,t[i]=p;const n=u[p],m=u[n],g=u[m];let y=257*u[i]^16843008*i;s[p]=y<<24|y>>>8,r[p]=y<<16|y>>>16,o[p]=y<<8|y>>>24,a[p]=y,y=16843009*g^65537*m^257*n^16843008*p,l[i]=y<<24|y>>>8,d[i]=y<<16|y>>>16,h[i]=y<<8|y>>>24,c[i]=y,p?(p=n^u[u[u[g^n]]],f^=u[u[f]]):p=f=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,s=0;for(;s{if(!this.subtle)return Promise.reject(new Error("web crypto not initialized"));this.logOnce("WebCrypto AES decrypt");return new hm(this.subtle,new Uint8Array(i)).decrypt(e.buffer,t)})).catch((s=>(Rc.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,t,i))))}onWebCryptoError(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);const s=this.flush();if(s)return s.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%16;return i!==e.length&&(t=au(e,0,i),this.remainderData=au(e,i)),t}logOnce(e){this.logEnabled&&(Rc.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const fm=function(e){let t="";const i=e.length;for(let s=0;s1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}{constructor(e,t,i,s,r){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=mm,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.loadedmetadata=!1,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=r,this.logPrefix=s,this.log=Rc.log.bind(Rc,`${s}:`),this.warn=Rc.warn.bind(Rc,`${s}:`),this.hls=e,this.fragmentLoader=new am(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new pm(e.config),e.on(wc.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;null!=e&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=mm}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const i=t.partList;if(null!=i&&i.length){const e=i[i.length-1];return Xf.isBuffered(this.media,e.start+e.duration/2)}const s=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(s)}getLevelDetails(){var e;if(this.levels&&null!==this.levelLastLoaded)return null==(e=this.levelLastLoaded)?void 0:e.details}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),i.addEventListener("seeking",this.onvseeking),i.addEventListener("ended",this.onvended);const s=this.config;this.levels&&s.autoStartLoad&&this.state===mm&&this.startLoad(s.startPosition)}onMediaDetaching(){const e=this.media;null!=e&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:i,mediaBuffer:s,state:r}=this,o=i?i.currentTime:0,a=Xf.bufferInfo(s||i,o,e.maxBufferHole);if(this.log(`media seeking to ${_c(o)?o.toFixed(3):o}, state: ${r}`),this.state===Em)this.resetLoadingState();else if(t){const i=e.maxFragLookUpTolerance,s=t.start-i,r=t.start+t.duration+i;if(!a.len||ra.end){const e=o>r;(o{if(this.fragContextChanged(e))return this.warn(`Fragment ${e.sn}${t.part?" p: "+t.part.index:""} of level ${e.level} was dropped during download.`),void this.fragmentTracker.removeFragment(e);e.stats.chunkCount++,this._handleFragmentLoadProgress(t)})).then((t=>{if(!t)return;const i=this.state;this.fragContextChanged(e)?(i===Am||!this.fragCurrent&&i===_m)&&(this.fragmentTracker.removeFragment(e),this.state=gm):("payload"in t&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(wc.FRAG_LOADED,t)),this._handleFragmentLoadComplete(t))})).catch((t=>{this.state!==mm&&this.state!==wm&&(this.warn(`Frag error: ${(null==t?void 0:t.message)||t}`),this.resetFragmentLoading(e))}))}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===Hf){const t=e.type,s=this.getFwdBufferInfo(this.mediaBuffer,t),r=Math.max(e.duration,s?s.len:this.config.maxBufferLength),o=this.backtrackFragment;(1===(o?e.sn-o.sn:0)||this.reduceMaxBufferLength(r,e.duration))&&i.removeFragment(e)}else 0===(null==(t=this.mediaBuffer)?void 0:t.buffered.length)?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===$f&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const s={startOffset:e,endOffset:t,type:i};this.hls.trigger(wc.BUFFER_FLUSHING,s)}_loadInitSegment(e,t){this._doFragLoad(e,t).then((t=>{if(!t||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return t})).then((t=>{const{hls:i}=this,{payload:s}=t,r=e.decryptdata;if(s&&s.byteLength>0&&null!=r&&r.key&&r.iv&&"AES-128"===r.method){const o=self.performance.now();return this.decrypter.decrypt(new Uint8Array(s),r.key.buffer,r.iv.buffer).catch((t=>{throw i.trigger(wc.ERROR,{type:Tc.MEDIA_ERROR,details:kc.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t})).then((s=>{const r=self.performance.now();return i.trigger(wc.FRAG_DECRYPTED,{frag:e,payload:s,stats:{tstart:o,tdecrypt:r}}),t.payload=s,this.completeInitSegmentLoad(t)}))}return this.completeInitSegmentLoad(t)})).catch((t=>{this.state!==mm&&this.state!==wm&&(this.warn(t),this.resetFragmentLoading(e))}))}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state=gm,e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var i,s,r,o;const a=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===Rp?"level":"track"} ${e.level} (frag:[${(null!=(i=e.startPTS)?i:NaN).toFixed(3)}-${(null!=(s=e.endPTS)?s:NaN).toFixed(3)}] > buffer:${a?fm(Xf.getBuffered(a)):"(detached)"})`),"initSegment"!==e.sn){var n;if(e.type!==Bp){const t=e.elementaryStreams;if(!Object.keys(t).some((e=>!!t[e])))return void(this.state=gm)}const t=null==(n=this.levels)?void 0:n[e.level];null!=t&&t.fragmentError&&(this.log(`Resetting level fragment error count of ${t.fragmentError} on frag buffered`),t.fragmentError=0)}this.state=gm,a&&(!this.loadedmetadata&&e.type==Rp&&a.buffered.length&&(null==(r=this.fragCurrent)?void 0:r.sn)===(null==(o=this.fragPrevious)?void 0:o.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:s,partsLoaded:r}=e,o=!r||0===r.length||r.some((e=>!e)),a=new Zf(i.level,i.sn,i.stats.chunkCount+1,0,s?s.index:-1,!o);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,s){var r;const o=null==t?void 0:t.details;if(!this.levels||!o)throw new Error(`frag load aborted, missing level${o?"":" detail"}s`);let a=null;if(!e.encrypted||null!=(r=e.decryptdata)&&r.key?!e.encrypted&&o.encryptedFragments.length&&this.keyLoader.loadClear(e,o.encryptedFragments):(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${"[stream-controller]"===this.logPrefix?"level":"track"} ${e.level}`),this.state=ym,this.fragCurrent=e,a=this.keyLoader.load(e).then((e=>{if(!this.fragContextChanged(e.frag))return this.hls.trigger(wc.KEY_LOADED,e),this.state===ym&&(this.state=gm),e})),this.hls.trigger(wc.KEY_LOADING,{frag:e}),null===this.fragCurrent&&(a=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),i=Math.max(e.start,i||0),this.config.lowLatencyMode&&"initSegment"!==e.sn){const r=o.partList;if(r&&s){i>e.end&&o.fragmentHint&&(e=o.fragmentHint);const n=this.getNextPart(r,e,i);if(n>-1){const l=r[n];let d;return this.log(`Loading part sn: ${e.sn} p: ${l.index} cc: ${e.cc} of playlist [${o.startSN}-${o.endSN}] parts [0-${n}-${r.length-1}] ${"[stream-controller]"===this.logPrefix?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=l.start+l.duration,this.state=Am,d=a?a.then((i=>!i||this.fragContextChanged(i.frag)?null:this.doFragPartsLoad(e,l,t,s))).catch((e=>this.handleFragLoadError(e))):this.doFragPartsLoad(e,l,t,s).catch((e=>this.handleFragLoadError(e))),this.hls.trigger(wc.FRAG_LOADING,{frag:e,part:l,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}if(!e.url||this.loadedEndOfParts(r,i))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${o?"of ["+o.startSN+"-"+o.endSN+"] ":""}${"[stream-controller]"===this.logPrefix?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),_c(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Am;const n=this.config.progressive;let l;return l=n&&a?a.then((t=>!t||this.fragContextChanged(null==t?void 0:t.frag)?null:this.fragmentLoader.load(e,s))).catch((e=>this.handleFragLoadError(e))):Promise.all([this.fragmentLoader.load(e,n?s:void 0),a]).then((([e])=>(!n&&e&&s&&s(e),e))).catch((e=>this.handleFragLoadError(e))),this.hls.trigger(wc.FRAG_LOADING,{frag:e,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l}doFragPartsLoad(e,t,i,s){return new Promise(((r,o)=>{var a;const n=[],l=null==(a=i.details)?void 0:a.partList,d=t=>{this.fragmentLoader.loadPart(e,t,s).then((s=>{n[t.index]=s;const o=s.part;this.hls.trigger(wc.FRAG_LOADED,s);const a=uf(i,e.sn,t.index+1)||pf(l,e.sn,t.index+1);if(!a)return r({frag:e,part:o,partsLoaded:n});d(a)})).catch(o)};d(t)}))}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===kc.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(wc.ERROR,t)}else this.hls.trigger(wc.ERROR,{type:Tc.OTHER_ERROR,details:kc.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==_m)return void(this.fragCurrent||this.state===mm||this.state===wm||(this.state=gm));const{frag:i,part:s,level:r}=t,o=self.performance.now();i.stats.parsing.end=o,s&&(s.stats.parsing.end=o),this.updateLevelTiming(i,s,r,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:s,sn:r,part:o}=e;if(null==t||!t[s])return this.warn(`Levels object was unset while buffering fragment ${r} of level ${s}. The current chunk will not be buffered.`),null;const a=t[s],n=o>-1?uf(a,r,o):null,l=n?n.fragment:function(e,t,i){if(null==e||!e.details)return null;const s=e.details;let r=s.fragments[t-s.startSN];return r||(r=s.fragmentHint,r&&r.sn===t?r:to&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){const i=this.getLoadPosition();return _c(i)?this.getFwdBufferInfoAtPos(e,i,t):null}getFwdBufferInfoAtPos(e,t,i){const{config:{maxBufferHole:s}}=this,r=Xf.bufferInfo(e,t,s);if(0===r.len&&void 0!==r.nextStart){const o=this.fragmentTracker.getBufferedFrag(t,i);if(o&&r.nextStart=s&&(i.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0)}getAppendedFrag(e,t=Rp){const i=this.fragmentTracker.getAppendedFrag(e,Rp);return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,s=i.length;if(!s)return null;const{config:r}=this,o=i[0].start;let a;if(t.live){const n=r.initialLiveManifestSize;if(st}getNextFragmentLoopLoading(e,t,i,s,r){const o=e.gap,a=this.getNextFragment(this.nextLoadPosition,t);if(null===a)return a;if(e=a,o&&e&&!e.gap&&i.nextStart){const t=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,s);if(null!==t&&i.len+t.len>=r)return this.log(`buffer full after gaps in "${s}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return null==e||!e.initSegment||null!=e&&e.initSegment.data||this.bitrateTest?e:e.initSegment}getNextPart(e,t,i){let s=-1,r=!1,o=!0;for(let a=0,n=e.length;a-1&&ii.start&&i.loaded}getInitialLiveFragment(e,t){const i=this.fragPrevious;let s=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),s=function(e,t,i){if(null===t||!Array.isArray(e)||!e.length||!_c(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;i=i||0;for(let s=0;s=e.startSN&&r<=e.endSN){const o=t[r-e.startSN];i.cc===o.cc&&(s=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${s.sn}`))}s||(s=function(e,t){return vf(e,(e=>e.cct?-1:0))}(t,i.cc),s&&this.log(`Live playlist, switching playlist, load frag with same CC: ${s.sn}`))}}else{const t=this.hls.liveSyncPosition;null!==t&&(s=this.getFragmentAtPosition(t,this.bitrateTest?e.fragmentEnd:e.edge,e))}return s}getFragmentAtPosition(e,t,i){const{config:s}=this;let{fragPrevious:r}=this,{fragments:o,endSN:a}=i;const{fragmentHint:n}=i,{maxFragLookUpTolerance:l}=s,d=i.partList,h=!!(s.lowLatencyMode&&null!=d&&d.length&&n);let c;if(h&&n&&!this.bitrateTest&&(o=o.concat(n),a=n.sn),et-l?0:l)}else c=o[o.length-1];if(c){const e=c.sn-i.startSN,t=this.fragmentTracker.getState(c);if((t===Jf||t===$f&&c.gap)&&(r=c),r&&c.sn===r.sn&&(!h||d[0].fragment.sn>c.sn)){if(r&&c.level===r.level){const t=o[e+1];c=c.sn=o-t.maxFragLookUpTolerance&&r<=a;if(null!==s&&i.duration>s&&(r${e.startSN} prev-sn: ${r?r.sn:"na"} fragments: ${s}`),o}return r}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)}setStartPosition(e,t){let i=this.startPosition;if(i ${null==(s=this.fragCurrent)?void 0:s.url}`);const r=t.details===kc.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(i,!0);const o=t.errorAction,{action:a,retryCount:n=0,retryConfig:l}=o||{};if(o&&a===Lf&&l){this.resetStartWhenNotLoaded(this.levelLastLoaded);const s=yf(l,n);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${n+1}/${l.maxNumRetry} in ${s}ms`),o.resolved=!0,this.retryDate=self.performance.now()+s,this.state=bm}else if(l&&o){if(this.resetFragmentErrors(e),!(n.5;r&&this.reduceMaxBufferLength(s.len,(null==t?void 0:t.duration)||10);const o=!r;return o&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),o}return!1}resetFragmentErrors(e){e===Pp&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==mm&&(this.state=gm)}afterBufferFlushed(e,t,i){if(!e)return;const s=Xf.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,s,i),this.state===Em&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=gm}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;null!=t&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,s){var r;const o=i.details;if(!o)return void this.warn("level.details undefined");if(!Object.keys(e.elementaryStreams).reduce(((t,r)=>{const a=e.elementaryStreams[r];if(a){const n=a.endPTS-a.startPTS;if(n<=0)return this.warn(`Could not parse fragment ${e.sn} ${r} duration reliably (${n})`),t||!1;const l=s?0:lf(o,e,a.startPTS,a.endPTS,a.startDTS,a.endDTS);return this.hls.trigger(wc.LEVEL_PTS_UPDATED,{details:o,level:i,drift:l,type:r,frag:e,start:a.startPTS,end:a.endPTS}),!0}return t}),!1)&&null===(null==(r=this.transmuxer)?void 0:r.error)){const t=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(0===i.fragmentError&&(i.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(t.message),this.hls.trigger(wc.ERROR,{type:Tc.MEDIA_ERROR,details:kc.FRAG_PARSING_ERROR,fatal:!1,error:t,frag:e,reason:`Found no media in msn ${e.sn} of level "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=Sm,this.hls.trigger(wc.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class Cm{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;return e.length?(i=1===e.length?e[0]:function(e,t){const i=new Uint8Array(t);let s=0;for(let t=0;t0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:zp,duration:Number.POSITIVE_INFINITY});r{if(_c(e))return 90*e;return 9e4*t+(i?9e4*i.baseTime/i.timescale:0)};function Pm(e,t){return 255===e[t]&&240==(246&e[t+1])}function Bm(e,t){return 1&e[t+1]?7:9}function Im(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function Mm(e,t){return t+1=e.length)return!1;const s=Im(e,t);if(s<=i)return!1;const r=t+s;return r===e.length||Mm(e,r)}return!1}function Um(e,t,i,s,r){if(!e.samplerate){const o=function(e,t,i,s){let r,o,a,n;const l=navigator.userAgent.toLowerCase(),d=s,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];r=1+((192&t[i+2])>>>6);const c=(60&t[i+2])>>>2;if(!(c>h.length-1))return a=(1&t[i+2])<<2,a|=(192&t[i+3])>>>6,Rc.log(`manifest codec:${s}, ADTS type:${r}, samplingIndex:${c}`),/firefox/i.test(l)?c>=6?(r=5,n=new Array(4),o=c-3):(r=2,n=new Array(2),o=c):-1!==l.indexOf("android")?(r=2,n=new Array(2),o=c):(r=5,n=new Array(4),s&&(-1!==s.indexOf("mp4a.40.29")||-1!==s.indexOf("mp4a.40.5"))||!s&&c>=6?o=c-3:((s&&-1!==s.indexOf("mp4a.40.2")&&(c>=6&&1===a||/vivaldi/i.test(l))||!s&&1===a)&&(r=2,n=new Array(2)),o=c)),n[0]=r<<3,n[0]|=(14&c)>>1,n[1]|=(1&c)<<7,n[1]|=a<<3,5===r&&(n[1]|=(14&o)>>1,n[2]=(1&o)<<7,n[2]|=8,n[3]=0),{config:n,samplerate:h[c],channelCount:a,codec:"mp4a.40."+r,manifestCodec:d};{const t=new Error(`invalid ADTS sampling index:${c}`);e.emit(wc.ERROR,wc.ERROR,{type:Tc.MEDIA_ERROR,details:kc.FRAG_PARSING_ERROR,fatal:!0,error:t,reason:t.message})}}(t,i,s,r);if(!o)return;e.config=o.config,e.samplerate=o.samplerate,e.channelCount=o.channelCount,e.codec=o.codec,e.manifestCodec=o.manifestCodec,Rc.log(`parsed codec:${e.codec}, rate:${o.samplerate}, channels:${o.channelCount}`)}}function Om(e){return 9216e4/e}function Nm(e,t,i,s,r){const o=s+r*Om(e.samplerate),a=function(e,t){const i=Bm(e,t);if(t+i<=e.length){const s=Im(e,t)-i;if(s>0)return{headerLength:i,frameLength:s}}}(t,i);let n;if(a){const{frameLength:s,headerLength:r}=a,l=r+s,d=Math.max(0,i+l-t.length);d?(n=new Uint8Array(l-r),n.set(t.subarray(i+r,t.length),0)):n=t.subarray(i+r,i+l);const h={unit:n,pts:o};return d||e.samples.push(h),{sample:h,length:l,missing:d}}const l=t.length-i;n=new Uint8Array(l),n.set(t.subarray(i,t.length),0);return{sample:{unit:n,pts:o},length:l,missing:-1}}let jm=null;const Gm=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],zm=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Wm=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Vm=[0,1,1,4];function Hm(e,t,i,s,r){if(i+24>t.length)return;const o=$m(t,i);if(o&&i+o.frameLength<=t.length){const a=s+r*(9e4*o.samplesPerFrame/o.sampleRate),n={unit:t.subarray(i,i+o.frameLength),pts:a,dts:a};return e.config=[],e.channelCount=o.channelCount,e.samplerate=o.sampleRate,e.samples.push(n),{sample:n,length:o.frameLength,missing:0}}}function $m(e,t){const i=e[t+1]>>3&3,s=e[t+1]>>1&3,r=e[t+2]>>4&15,o=e[t+2]>>2&3;if(1!==i&&0!==r&&15!==r&&3!==o){const a=e[t+2]>>1&1,n=e[t+3]>>6,l=1e3*Gm[14*(3===i?3-s:3===s?3:4)+r-1],d=zm[3*(3===i?0:2===i?1:2)+o],h=3===n?1:2,c=Wm[i][s],u=Vm[s],p=8*c*u,f=Math.floor(c*l/d+a)*u;if(null===jm){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);jm=e?parseInt(e[1]):0}return!!jm&&jm<=87&&2===s&&l>=224e3&&0===n&&(e[t+3]=128|e[t+3]),{sampleRate:d,channelCount:h,frameLength:f,samplesPerFrame:p}}}function Jm(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function qm(e,t){return t+1{let i=0,s=5;t+=s;const r=new Uint32Array(1),o=new Uint32Array(1),a=new Uint8Array(1);for(;s>0;){a[0]=e[t];const n=Math.min(s,8),l=8-n;o[0]=4278190080>>>24+l<>l,i=i?i<t.length)return-1;if(11!==t[i]||119!==t[i+1])return-1;const o=t[i+4]>>6;if(o>=3)return-1;const a=[48e3,44100,32e3][o],n=63&t[i+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*n+o];if(i+l>t.length)return-1;const d=t[i+6]>>5;let h=0;2===d?h+=2:(1&d&&1!==d&&(h+=2),4&d&&(h+=2));const c=(t[i+6]<<8|t[i+7])>>12-h&1,u=[2,1,2,3,3,4,4,5][d]+c,p=t[i+5]>>3,f=7&t[i+5],m=new Uint8Array([o<<6|p<<1|f>>2,(3&f)<<6|d<<3|c<<2|n>>4,n<<4&224]),g=s+r*(1536/a*9e4),y=t.subarray(i,i+l);return e.config=m,e.channelCount=u,e.samplerate=a,e.samples.push({unit:y,pts:g}),l}class eg{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,s=new Uint8Array(4),r=Math.min(4,t);if(0===r)throw new Error("no bytes available");s.set(e.subarray(i,i+r)),this.word=new DataView(s.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r}skipBits(e){let t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(t=(e-=this.bitsAvailable)>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&Rc.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return t=e-t,t>0&&this.bitsAvailable?i<>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t,i=8,s=8;for(let r=0;r{var o;switch(s.type){case 1:{let t=!1;a=!0;const r=s.data;if(l&&r.length>4){const e=new eg(r).readSliceType();2!==e&&4!==e&&7!==e&&9!==e||(t=!0)}var d;if(t)null!=(d=n)&&d.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null);n||(n=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),n.frame=!0,n.key=t;break}case 5:a=!0,null!=(o=n)&&o.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null),n||(n=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),n.key=!0,n.frame=!0;break;case 6:a=!0,$u(s.data,1,i.pts,t.samples);break;case 7:{var h,c;a=!0,l=!0;const t=s.data,i=new eg(t).readSPS();if(!e.sps||e.width!==i.width||e.height!==i.height||(null==(h=e.pixelRatio)?void 0:h[0])!==i.pixelRatio[0]||(null==(c=e.pixelRatio)?void 0:c[1])!==i.pixelRatio[1]){e.width=i.width,e.height=i.height,e.pixelRatio=i.pixelRatio,e.sps=[t],e.duration=r;const s=t.subarray(1,4);let o="avc1.";for(let e=0;e<3;e++){let t=s[e].toString(16);t.length<2&&(t="0"+t),o+=t}e.codec=o}break}case 8:a=!0,e.pps=[s.data];break;case 9:a=!0,e.audFound=!0,n&&this.pushAccessUnit(n,e),n=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"");break;case 12:a=!0;break;default:a=!1,n&&(n.debug+="unknown NAL "+s.type+" ")}if(n&&a){n.units.push(s)}})),s&&n&&(this.pushAccessUnit(n,e),this.VideoSample=null)}parseAVCNALu(e,t){const i=t.byteLength;let s=e.naluState||0;const r=s,o=[];let a,n,l,d=0,h=-1,c=0;for(-1===s&&(h=0,c=31&t[0],s=0,d=1);d=0){const e={data:t.subarray(h,n),type:c};o.push(e)}else{const i=this.getLastNalUnit(e.samples);i&&(r&&d<=4-r&&i.state&&(i.data=i.data.subarray(0,i.data.byteLength-r)),n>0&&(i.data=Wu(i.data,t.subarray(0,n)),i.state=0))}d=0&&s>=0){const e={data:t.subarray(h,i),type:c,state:s};o.push(e)}if(0===o.length){const i=this.getLastNalUnit(e.samples);i&&(i.data=Wu(i.data,t))}return e.naluState=s,o}}class ig{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new pm(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,i){const s=e[t].unit;if(s.length<=16)return;const r=s.subarray(16,s.length-s.length%16),o=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(o).then((r=>{const o=new Uint8Array(r);s.set(o,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)}))}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t);let s=0;for(let t=32;t{r.data=this.getAvcDecryptedUnit(o,a),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,s)}))}decryptAvcSamples(e,t,i,s){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void s();const r=e[t].units;for(;!(i>=r.length);i++){const o=r[i];if(!(o.data.length<=48||1!==o.type&&5!==o.type||(this.decryptAvcSample(e,t,i,s,o),this.decrypter.isSync())))return}}}}const sg=188;class rg{constructor(e,t,i){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.videoParser=new tg}static probe(e){const t=rg.syncOffset(e);return t>0&&Rc.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),-1!==t}static syncOffset(e){const t=e.length;let i=Math.min(940,t-sg)+1,s=0;for(;s1&&(0===o&&a>2||n+sg>i))return o}s++}return-1}static createTrack(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:Lu[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}resetInitSegment(e,t,i,s){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=rg.createTrack("video"),this._audioTrack=rg.createTrack("audio",s),this._id3Track=rg.createTrack("id3"),this._txtTrack=rg.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=s}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,s=!1){let r;i||(this.sampleAes=null);const o=this._videoTrack,a=this._audioTrack,n=this._id3Track,l=this._txtTrack;let d=o.pid,h=o.pesData,c=a.pid,u=n.pid,p=a.pesData,f=n.pesData,m=null,g=this.pmtParsed,y=this._pmtId,A=e.length;if(this.remainderData&&(A=(e=Wu(this.remainderData,e)).length,this.remainderData=null),A>4>1){if(v=t+5+e[t+4],v===t+sg)continue}else v=t+4;switch(A){case d:s&&(h&&(r=hg(h))&&this.videoParser.parseAVCPES(o,l,r,!1,this._duration),h={data:[],size:0}),h&&(h.data.push(e.subarray(v,t+sg)),h.size+=t+sg-v);break;case c:if(s){if(p&&(r=hg(p)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,r);break;case"mp3":this.parseMPEGPES(a,r);break;case"ac3":this.parseAC3PES(a,r)}p={data:[],size:0}}p&&(p.data.push(e.subarray(v,t+sg)),p.size+=t+sg-v);break;case u:s&&(f&&(r=hg(f))&&this.parseID3PES(n,r),f={data:[],size:0}),f&&(f.data.push(e.subarray(v,t+sg)),f.size+=t+sg-v);break;case 0:s&&(v+=e[v]+1),y=this._pmtId=ag(e,v);break;case y:{s&&(v+=e[v]+1);const r=ng(e,v,this.typeSupported,i,this.observer);d=r.videoPid,d>0&&(o.pid=d,o.segmentCodec=r.segmentVideoCodec),c=r.audioPid,c>0&&(a.pid=c,a.segmentCodec=r.segmentAudioCodec),u=r.id3Pid,u>0&&(n.pid=u),null===m||g||(Rc.warn(`MPEG-TS PMT found at ${t} after unknown PID '${m}'. Backtracking to sync byte @${b} to parse all TS packets.`),m=null,t=b-188),g=this.pmtParsed=!0;break}case 17:case 8191:break;default:m=A}}else v++;v>0&&lg(this.observer,new Error(`Found ${v} TS packet/s that do not start with 0x47`)),o.pesData=h,a.pesData=p,n.pesData=f;const _={audioTrack:a,videoTrack:o,id3Track:n,textTrack:l};return s&&this.extractRemainingSamples(_),_}flush(){const{remainderData:e}=this;let t;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:s,textTrack:r}=e,o=i.pesData,a=t.pesData,n=s.pesData;let l;if(o&&(l=hg(o))?(this.videoParser.parseAVCPES(i,r,l,!0,this._duration),i.pesData=null):i.pesData=o,a&&(l=hg(a))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break;case"ac3":this.parseAC3PES(t,l)}t.pesData=null}else null!=a&&a.size&&Rc.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;n&&(l=hg(n))?(this.parseID3PES(s,l),s.pesData=null):s.pesData=n}demuxSampleAes(e,t,i){const s=this.demux(e,i,!0,!this.config.progressive),r=this.sampleAes=new ig(this.observer,this.config,t);return this.decrypt(s,r)}decrypt(e,t){return new Promise((i=>{const{audioTrack:s,videoTrack:r}=e;s.samples&&"aac"===s.segmentCodec?t.decryptAacSamples(s.samples,0,(()=>{r.samples?t.decryptAvcSamples(r.samples,0,0,(()=>{i(e)})):i(e)})):r.samples&&t.decryptAvcSamples(r.samples,0,0,(()=>{i(e)}))}))}destroy(){this._duration=0}parseAACPES(e,t){let i=0;const s=this.aacOverFlow;let r,o,a,n=t.data;if(s){this.aacOverFlow=null;const t=s.missing,r=s.sample.unit.byteLength;if(-1===t)n=Wu(s.sample.unit,n);else{const o=r-t;s.sample.unit.set(n.subarray(0,t),o),e.samples.push(s.sample),i=s.missing}}for(r=i,o=n.length;r0;)n+=o}}parseID3PES(e,t){if(void 0===t.pts)return void Rc.warn("[tsdemuxer]: ID3 PES unknown PTS");const i=vc({},t,{type:this._videoTrack?Vp:zp,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function og(e,t){return((31&e[t+1])<<8)+e[t+2]}function ag(e,t){return(31&e[t+10])<<8|e[t+11]}function ng(e,t,i,s,r){const o={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},a=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t0){let s=t+5,r=n;for(;r>2;){if(106===e[s])!0!==i.ac3?Rc.log("AC-3 audio found, not supported in this browser for now"):(o.audioPid=a,o.segmentAudioCodec="ac3");const t=e[s+1]+2;s+=t,r-=t}}break;case 194:case 135:return lg(r,new Error("Unsupported EC-3 in M2TS found")),o;case 36:return lg(r,new Error("Unsupported HEVC in M2TS found")),o}t+=n+5}return o}function lg(e,t,i){Rc.warn(`parsing error: ${t.message}`),e.emit(wc.ERROR,wc.ERROR,{type:Tc.MEDIA_ERROR,details:kc.FRAG_PARSING_ERROR,fatal:!1,levelRetry:i,error:t,reason:t.message})}function dg(e){Rc.log(`${e} with AES-128-CBC encryption found in unencrypted stream`)}function hg(e){let t,i,s,r,o,a=0;const n=e.data;if(!e||0===e.size)return null;for(;n[0].length<19&&n.length>1;)n[0]=Wu(n[0],n[1]),n.splice(1,1);t=n[0];if(1===(t[0]<<16)+(t[1]<<8)+t[2]){if(i=(t[4]<<8)+t[5],i&&i>e.size-6)return null;const l=t[7];192&l&&(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&l?(o=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2,r-o>54e5&&(Rc.warn(`${Math.round((r-o)/9e4)}s delta between PTS and DTS, align them`),r=o)):o=r),s=t[8];let d=s+9;if(e.size<=d)return null;e.size-=d;const h=new Uint8Array(e.size);for(let e=0,i=n.length;ei){d-=i;continue}t=t.subarray(d),i-=d,d=0}h.set(t,a),a+=i}return i&&(i-=s+3),{data:h,pts:r,dts:o,len:i}}return null}class cg{static getSilentFrame(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}const ug=Math.pow(2,32)-1;class pg{static init(){let e;for(e in pg.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},pg.types)pg.types.hasOwnProperty(e)&&(pg.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);pg.HDLR_TYPES={video:t,audio:i};const s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);pg.STTS=pg.STSC=pg.STCO=r,pg.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),pg.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),pg.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),pg.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const o=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),n=new Uint8Array([0,0,0,1]);pg.FTYP=pg.box(pg.types.ftyp,o,n,o,a),pg.DINF=pg.box(pg.types.dinf,pg.box(pg.types.dref,s))}static box(e,...t){let i=8,s=t.length;const r=s;for(;s--;)i+=t[s].byteLength;const o=new Uint8Array(i);for(o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=255&i,o.set(e,4),s=0,i=8;s>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,s>>24,s>>16&255,s>>8&255,255&s,85,196,0,0]))}static mdia(e){return pg.box(pg.types.mdia,pg.mdhd(e.timescale,e.duration),pg.hdlr(e.type),pg.minf(e))}static mfhd(e){return pg.box(pg.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}static minf(e){return"audio"===e.type?pg.box(pg.types.minf,pg.box(pg.types.smhd,pg.SMHD),pg.DINF,pg.stbl(e)):pg.box(pg.types.minf,pg.box(pg.types.vmhd,pg.VMHD),pg.DINF,pg.stbl(e))}static moof(e,t,i){return pg.box(pg.types.moof,pg.mfhd(e),pg.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=pg.trak(e[t]);return pg.box.apply(null,[pg.types.moov,pg.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(pg.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=pg.trex(e[t]);return pg.box.apply(null,[pg.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(ug+1)),s=Math.floor(t%(ug+1)),r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,s>>24,s>>16&255,s>>8&255,255&s,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return pg.box(pg.types.mvhd,r)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let s,r;for(s=0;s>>8&255),r.push(255&s),r=r.concat(Array.prototype.slice.call(i));for(t=0;t>>8&255),o.push(255&s),o=o.concat(Array.prototype.slice.call(i));const a=pg.box(pg.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|e.sps.length].concat(r).concat([e.pps.length]).concat(o))),n=e.width,l=e.height,d=e.pixelRatio[0],h=e.pixelRatio[1];return pg.box(pg.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,n>>8&255,255&n,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),a,pg.box(pg.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),pg.box(pg.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,h>>24,h>>16&255,h>>8&255,255&h])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0])}static mp4a(e){return pg.box(pg.types.mp4a,pg.audioStsd(e),pg.box(pg.types.esds,pg.esds(e)))}static mp3(e){return pg.box(pg.types[".mp3"],pg.audioStsd(e))}static ac3(e){return pg.box(pg.types["ac-3"],pg.audioStsd(e),pg.box(pg.types.dac3,e.config))}static stsd(e){return"audio"===e.type?"mp3"===e.segmentCodec&&"mp3"===e.codec?pg.box(pg.types.stsd,pg.STSD,pg.mp3(e)):"ac3"===e.segmentCodec?pg.box(pg.types.stsd,pg.STSD,pg.ac3(e)):pg.box(pg.types.stsd,pg.STSD,pg.mp4a(e)):pg.box(pg.types.stsd,pg.STSD,pg.avc1(e))}static tkhd(e){const t=e.id,i=e.duration*e.timescale,s=e.width,r=e.height,o=Math.floor(i/(ug+1)),a=Math.floor(i%(ug+1));return pg.box(pg.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,a>>24,a>>16&255,a>>8&255,255&a,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>8&255,255&s,0,0,r>>8&255,255&r,0,0]))}static traf(e,t){const i=pg.sdtp(e),s=e.id,r=Math.floor(t/(ug+1)),o=Math.floor(t%(ug+1));return pg.box(pg.types.traf,pg.box(pg.types.tfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s])),pg.box(pg.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,o>>24,o>>16&255,o>>8&255,255&o])),pg.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,pg.box(pg.types.trak,pg.tkhd(e),pg.mdia(e))}static trex(e){const t=e.id;return pg.box(pg.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],s=i.length,r=12+16*s,o=new Uint8Array(r);let a,n,l,d,h,c;for(t+=8+r,o.set(["video"===e.type?1:0,0,15,1,s>>>24&255,s>>>16&255,s>>>8&255,255&s,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0),a=0;a>>24&255,l>>>16&255,l>>>8&255,255&l,d>>>24&255,d>>>16&255,d>>>8&255,255&d,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|h.isNonSync,61440&h.degradPrio,15&h.degradPrio,c>>>24&255,c>>>16&255,c>>>8&255,255&c],12+16*a);return pg.box(pg.types.trun,o)}static initSegment(e){pg.types||pg.init();const t=pg.moov(e);return Wu(pg.FTYP,t)}}pg.types=void 0,pg.HDLR_TYPES=void 0,pg.STTS=void 0,pg.STSC=void 0,pg.STCO=void 0,pg.STSZ=void 0,pg.VMHD=void 0,pg.SMHD=void 0,pg.STSD=void 0,pg.FTYP=void 0,pg.DINF=void 0;function fg(e,t,i=1,s=!1){const r=e*t*i;return s?Math.round(r):r}function mg(e,t=!1){return fg(e,1e3,1/9e4,t)}let gg,yg=null,Ag=null;class bg{constructor(e,t,i,s=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,null===yg){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);yg=e?parseInt(e[1]):0}if(null===Ag){const e=navigator.userAgent.match(/Safari\/(\d+)/i);Ag=e?parseInt(e[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){Rc.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){Rc.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){Rc.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e.reduce(((e,i)=>{const s=i.pts-e;return s<-4294967296?(t=!0,vg(e,i.pts)):s>0?e:i.pts}),e[0].pts);return t&&Rc.debug("PTS rollover detected"),i}remux(e,t,i,s,r,o,a,n){let l,d,h,c,u,p,f=r,m=r;const g=e.pid>-1,y=t.pid>-1,A=t.samples.length,b=e.samples.length>0,v=a&&A>0||A>1;if((!g||b)&&(!y||v)||this.ISGenerated||a){if(this.ISGenerated){var _,S,E,w;const e=this.videoTrackConfig;!e||t.width===e.width&&t.height===e.height&&(null==(_=t.pixelRatio)?void 0:_[0])===(null==(S=e.pixelRatio)?void 0:S[0])&&(null==(E=t.pixelRatio)?void 0:E[1])===(null==(w=e.pixelRatio)?void 0:w[1])||this.resetInitSegment()}else h=this.generateIS(e,t,r,o);const i=this.isVideoContiguous;let s,a=-1;if(v&&(a=function(e){for(let t=0;t0){Rc.warn(`[mp4-remuxer]: Dropped ${a} out of ${A} video samples due to a missing keyframe`);const e=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(a),t.dropped+=a,m+=(t.samples[0].pts-e)/t.inputTimeScale,s=m}else-1===a&&(Rc.warn(`[mp4-remuxer]: No keyframe found out of ${A} video samples`),p=!1);if(this.ISGenerated){if(b&&v){const i=this.getVideoStartPts(t.samples),s=(vg(e.samples[0].pts,i)-i)/t.inputTimeScale;f+=Math.max(0,s),m+=Math.max(0,-s)}if(b){if(e.samplerate||(Rc.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),h=this.generateIS(e,t,r,o)),d=this.remuxAudio(e,f,this.isAudioContiguous,o,y||v||n===Pp?m:void 0),v){const s=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(Rc.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),h=this.generateIS(e,t,r,o)),l=this.remuxVideo(t,m,i,s)}}else v&&(l=this.remuxVideo(t,m,i,0));l&&(l.firstKeyFrame=a,l.independent=-1!==a,l.firstKeyFramePTS=s)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(u=_g(i,r,this._initPTS,this._initDTS)),s.samples.length&&(c=Sg(s,r,this._initPTS))),{audio:d,video:l,initSegment:h,independent:p,text:c,id3:u}}generateIS(e,t,i,s){const r=e.samples,o=t.samples,a=this.typeSupported,n={},l=this._initPTS;let d,h,c,u=!l||s,p="audio/mp4";if(u&&(d=h=1/0),e.config&&r.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(p="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}n.audio={id:"audio",container:p,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&a.mpeg?new Uint8Array(0):pg.initSegment([e]),metadata:{channelCount:e.channelCount}},u&&(c=e.inputTimeScale,l&&c===l.timescale?u=!1:d=h=r[0].pts-Math.round(c*i))}if(t.sps&&t.pps&&o.length){if(t.timescale=t.inputTimeScale,n.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:pg.initSegment([t]),metadata:{width:t.width,height:t.height}},u)if(c=t.inputTimeScale,l&&c===l.timescale)u=!1;else{const e=this.getVideoStartPts(o),t=Math.round(c*i);h=Math.min(h,vg(o[0].dts,e)-t),d=Math.min(d,e-t)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(n).length)return this.ISGenerated=!0,u?(this._initPTS={baseTime:d,timescale:c},this._initDTS={baseTime:h,timescale:c}):d=c=void 0,{tracks:n,initPTS:d,timescale:c}}remuxVideo(e,t,i,s){const r=e.inputTimeScale,o=e.samples,a=[],n=o.length,l=this._initPTS;let d,h,c=this.nextAvcDts,u=8,p=this.videoSampleDuration,f=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,g=!1;if(!i||null===c){const e=t*r,s=o[0].pts-vg(o[0].dts,o[0].pts);yg&&null!==c&&Math.abs(e-s-c)<15e3?i=!0:c=e-s}const y=l.baseTime*r/l.timescale;for(let e=0;e0?e-1:e].dts&&(g=!0)}g&&o.sort((function(e,t){const i=e.dts-t.dts,s=e.pts-t.pts;return i||s})),d=o[0].dts,h=o[o.length-1].dts;const A=h-d,b=A?Math.round(A/(n-1)):p||e.inputTimeScale/30;if(i){const e=d-c,i=e>b,s=e<-1;if((i||s)&&(i?Rc.warn(`AVC: ${mg(e,!0)} ms (${e}dts) hole between fragments detected at ${t.toFixed(3)}`):Rc.warn(`AVC: ${mg(-e,!0)} ms (${e}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!s||c>=o[0].pts||yg)){d=c;const t=o[0].pts-e;if(i)o[0].dts=d,o[0].pts=t;else for(let i=0;it);i++)o[i].dts-=e,o[i].pts-=e;Rc.log(`Video: Initial PTS/DTS adjusted: ${mg(t,!0)}/${mg(d,!0)}, delta: ${mg(e,!0)} ms`)}}d=Math.max(0,d);let v=0,_=0,S=d;for(let e=0;e0?t.dts-o[e-1].dts:b;if(l=e>0?t.pts-o[e-1].pts:b,i.stretchShortVideoTrack&&null!==this.nextAudioPts){const e=Math.floor(i.maxBufferHole*r),o=(s?f+s*r:this.nextAudioPts)-t.pts;o>e?(p=o-a,p<0?p=a:k=!0,Rc.log(`[mp4-remuxer]: It is approximately ${o/90} ms to the next segment; using duration ${p/90} ms for the last video frame.`)):p=a}else p=a}const h=Math.round(t.pts-t.dts);L=Math.min(L,p),D=Math.max(D,p),C=Math.min(C,l),x=Math.max(x,l),a.push(new Eg(t.key,p,d,h))}if(a.length)if(yg){if(yg<70){const e=a[0].flags;e.dependsOn=2,e.isNonSync=0}}else if(Ag&&x-C0&&(s&&Math.abs(g-m)<9e3||Math.abs(vg(p[0].pts-y,g)-m)<20*l),p.forEach((function(e){e.pts=vg(e.pts-y,g)})),!i||m<0){if(p=p.filter((e=>e.pts>=0)),!p.length)return;m=0===r?0:s&&!u?Math.max(0,g):p[0].pts}if("aac"===e.segmentCodec){const t=this.config.maxAudioFramesDrift;for(let i=0,s=m;i=t*l&&d<1e4&&u){let t=Math.round(n/l);s=a-t*l,s<0&&(t--,s+=l),0===i&&(this.nextAudioPts=m=s),Rc.warn(`[mp4-remuxer]: Injecting ${t} audio frame @ ${(s/o).toFixed(3)}s due to ${Math.round(1e3*n/o)} ms gap.`);for(let o=0;o0))return;_+=f;try{A=new Uint8Array(_)}catch(e){return void this.observer.emit(wc.ERROR,wc.ERROR,{type:Tc.MUX_ERROR,details:kc.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:_,reason:`fail allocating audio mdat ${_}`})}if(!h){new DataView(A.buffer).setUint32(0,_),A.set(pg.types.mdat,4)}}A.set(r,f);const l=r.byteLength;f+=l,c.push(new Eg(!0,n,l,0)),v=o}const E=c.length;if(!E)return;const w=c[c.length-1];this.nextAudioPts=m=v+a*w.duration;const T=h?new Uint8Array(0):pg.moof(e.sequenceNumber++,b/a,vc({},e,{samples:c}));e.samples=[];const k=b/o,L=m/o,C={data1:T,data2:A,startPTS:k,endPTS:L,startDTS:k,endDTS:L,type:"audio",hasAudio:!0,hasVideo:!1,nb:E};return this.isAudioContiguous=!0,C}remuxEmptyAudio(e,t,i,s){const r=e.inputTimeScale,o=r/(e.samplerate?e.samplerate:r),a=this.nextAudioPts,n=this._initDTS,l=9e4*n.baseTime/n.timescale,d=(null!==a?a:s.startDTS*r)+l,h=s.endDTS*r+l,c=1024*o,u=Math.ceil((h-d)/c),p=cg.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(Rc.warn("[mp4-remuxer]: remux empty Audio"),!p)return void Rc.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");const f=[];for(let e=0;e4294967296;)e+=i;return e}function _g(e,t,i,s){const r=e.samples.length;if(!r)return;const o=e.inputTimeScale;for(let a=0;ae.pts-t.pts));const o=e.samples;return e.samples=[],{samples:o}}class Eg{constructor(e,t,i,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=s,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}function wg(e,t){const i=null==e?void 0:e.codec;if(i&&i.length>4)return i;if(t===Oc){if("ec-3"===i||"ac-3"===i||"alac"===i)return i;if("fLaC"===i||"Opus"===i){return up(i,!1)}const e="mp4a.40.5";return Rc.info(`Parsed audio codec "${i}" or audio object type not handled. Using "${e}"`),e}return Rc.warn(`Unhandled video codec "${i}"`),"hvc1"===i||"hev1"===i?"hvc1.1.6.L120.90":"av01"===i?"av01.0.04M.08":"avc1.42e01e"}try{gg=self.performance.now.bind(self.performance)}catch(e){Rc.debug("Unable to use Performance API on this environment"),gg=null==qc?void 0:qc.Date.now}const Tg=[{demux:class{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,s){const r=this.videoTrack=Dm("video",1),o=this.audioTrack=Dm("audio",1),a=this.txtTrack=Dm("text",1);if(this.id3Track=Dm("id3",1),this.timeOffset=0,null==e||!e.byteLength)return;const n=Fu(e);if(n.video){const{id:e,timescale:t,codec:i}=n.video;r.id=e,r.timescale=a.timescale=t,r.codec=i}if(n.audio){const{id:e,timescale:t,codec:i}=n.audio;o.id=e,o.timescale=t,o.codec=i}a.id=Lu.text,r.sampleDuration=0,r.duration=o.duration=s}resetContiguity(){this.remainderData=null}static probe(e){return function(e){const t=e.byteLength;for(let i=0;i8&&109===e[i+4]&&111===e[i+5]&&111===e[i+6]&&102===e[i+7])return!0;i=s>1?i+s:t}return!1}(e)}demux(e,t){this.timeOffset=t;let i=e;const s=this.videoTrack,r=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Wu(this.remainderData,e));const t=function(e){const t={valid:null,remainder:null},i=Iu(e,["moof"]);if(i.length<2)return t.remainder=e,t;const s=i[i.length-1];return t.valid=au(e,0,s.byteOffset-8),t.remainder=au(e,s.byteOffset-8),t}(i);this.remainderData=t.remainder,s.samples=t.valid||new Uint8Array}else s.samples=i;const o=this.extractID3Track(s,t);return r.samples=Vu(t,s),{videoTrack:s,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const s=this.extractID3Track(t,this.timeOffset);return i.samples=Vu(e,t),{videoTrack:t,audioTrack:Dm(),id3Track:s,textTrack:Dm()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const s=Iu(e.samples,["emsg"]);s&&s.forEach((e=>{const s=function(e){const t=e[0];let i="",s="",r=0,o=0,a=0,n=0,l=0,d=0;if(0===t){for(;"\0"!==Cu(e.subarray(d,d+1));)i+=Cu(e.subarray(d,d+1)),d+=1;for(i+=Cu(e.subarray(d,d+1)),d+=1;"\0"!==Cu(e.subarray(d,d+1));)s+=Cu(e.subarray(d,d+1)),d+=1;s+=Cu(e.subarray(d,d+1)),d+=1,r=xu(e,12),o=xu(e,16),n=xu(e,20),l=xu(e,24),d=28}else if(1===t){d+=4,r=xu(e,d),d+=4;const t=xu(e,d);d+=4;const o=xu(e,d);for(d+=4,a=2**32*t+o,Sc(a)||(a=Number.MAX_SAFE_INTEGER,Rc.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),n=xu(e,d),d+=4,l=xu(e,d),d+=4;"\0"!==Cu(e.subarray(d,d+1));)i+=Cu(e.subarray(d,d+1)),d+=1;for(i+=Cu(e.subarray(d,d+1)),d+=1;"\0"!==Cu(e.subarray(d,d+1));)s+=Cu(e.subarray(d,d+1)),d+=1;s+=Cu(e.subarray(d,d+1)),d+=1}return{schemeIdUri:i,value:s,timeScale:r,presentationTime:a,presentationTimeDelta:o,eventDuration:n,id:l,payload:e.subarray(d,e.byteLength)}}(e);if(Ym.test(s.schemeIdUri)){const e=_c(s.presentationTime)?s.presentationTime/s.timeScale:t+s.presentationTimeDelta/s.timeScale;let r=4294967295===s.eventDuration?Number.POSITIVE_INFINITY:s.eventDuration/s.timeScale;r<=.001&&(r=Number.POSITIVE_INFINITY);const o=s.payload;i.samples.push({data:o,len:o.byteLength,dts:e,pts:e,type:Vp,duration:r})}}))}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}},remux:class{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,i,s){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(function(e,t){if(!e||!t)return e;const i=t.keyId;i&&t.isCommonEncryption&&Iu(e,["moov","trak"]).forEach((e=>{const t=Iu(e,["mdia","minf","stbl","stsd"])[0].subarray(8);let s=Iu(t,["enca"]);const r=s.length>0;r||(s=Iu(t,["encv"])),s.forEach((e=>{Iu(r?e.subarray(28):e.subarray(78),["sinf"]).forEach((e=>{const t=Gu(e);if(t){const e=t.subarray(8,24);e.some((e=>0!==e))||(Rc.log(`[eme] Patching keyId in 'enc${r?"a":"v"}>sinf>>tenc' box: ${wu(e)} -> ${wu(i)}`),t.set(i,8))}}))}))}));return e}(e,s)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(null==e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);const s=this.initData=Fu(e);s.audio&&(t=wg(s.audio,Oc)),s.video&&(i=wg(s.video,Nc));const r={};s.audio&&s.video?r.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:s.audio?r.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:s.video?r.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:Rc.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=r}remux(e,t,i,s,r,o){var a,n;let{initPTS:l,lastEndTime:d}=this;const h={audio:void 0,video:void 0,text:s,id3:i,initSegment:void 0};_c(d)||(d=this.lastEndTime=r||0);const c=t.samples;if(null==c||!c.length)return h;const u={initPTS:void 0,timescale:1};let p=this.initData;if(null!=(a=p)&&a.length||(this.generateInitSegment(c),p=this.initData),null==(n=p)||!n.length)return Rc.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),h;this.emitInitSegment&&(u.tracks=this.initTracks,this.emitInitSegment=!1);const f=function(e,t){let i=0,s=0,r=0;const o=Iu(e,["moof","traf"]);for(let e=0;ee+t.info.duration||0),0);i=Math.max(i,e+o.earliestPresentationTime/o.timescale),s=i-t}}if(s&&_c(s))return s}return s||r}(c,p),m=function(e,t){return Iu(t,["moof","traf"]).reduce(((t,i)=>{const s=Iu(i,["tfdt"])[0],r=s[0],o=Iu(i,["tfhd"]).reduce(((t,i)=>{const o=xu(i,4),a=e[o];if(a){let e=xu(s,4);if(1===r){if(e===Tu)return Rc.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),t;e*=Tu+1,e+=xu(s,8)}const i=e/(a.timescale||9e4);if(_c(i)&&(null===t||ir}(l,g,r,f)||u.timescale!==l.timescale&&o)&&(u.initPTS=g-r,l&&1===l.timescale&&Rc.warn("Adjusting initPTS by "+(u.initPTS-l.baseTime)),this.initPTS=l={baseTime:u.initPTS,timescale:1});const y=e?g-l.baseTime/l.timescale:d,A=y+f;!function(e,t,i){Iu(t,["moof","traf"]).forEach((t=>{Iu(t,["tfhd"]).forEach((s=>{const r=xu(s,4),o=e[r];if(!o)return;const a=o.timescale||9e4;Iu(t,["tfdt"]).forEach((e=>{const t=e[0],s=i*a;if(s){let i=xu(e,4);if(0===t)i-=s,i=Math.max(i,0),Bu(e,4,i);else{i*=Math.pow(2,32),i+=xu(e,8),i-=s,i=Math.max(i,0);const t=Math.floor(i/(Tu+1)),r=Math.floor(i%(Tu+1));Bu(e,4,t),Bu(e,8,r)}}}))}))}))}(p,c,l.baseTime/l.timescale),f>0?this.lastEndTime=A:(Rc.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const b=!!p.audio,v=!!p.video;let _="";b&&(_+="audio"),v&&(_+="video");const S={data1:c,startPTS:y,startDTS:y,endPTS:A,endDTS:A,type:_,hasAudio:b,hasVideo:v,nb:1,dropped:0};return h.audio="audio"===S.type?S:void 0,h.video="audio"!==S.type?S:void 0,h.initSegment=u,h.id3=_g(i,r,l,l),s.samples.length&&(h.text=Sg(s,r,l)),h}}},{demux:rg,remux:bg},{demux:class extends xm{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,s){super.resetInitSegment(e,t,i,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=du(e,0);let i=(null==t?void 0:t.length)||0;if(Km(e,i))return!1;for(let t=e.length;i0&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(i=t);return i}(o,t);if(b&&"AES-128"===b.method){const e=this.getDecrypter();if(!e.isSync())return this.decryptionPromise=e.webCryptoDecrypt(o,b.key.buffer,b.iv.buffer).then((e=>{const t=this.push(e,null,i);return this.decryptionPromise=null,t})),this.decryptionPromise;{let t=e.softwareDecrypt(o,b.key.buffer,b.iv.buffer);if(i.part>-1&&(t=e.flush()),!t)return r.executeEnd=gg(),Lg(i);o=new Uint8Array(t)}}const v=this.needsProbing(d,h);if(v){const e=this.configureTransmuxer(o);if(e)return Rc.warn(`[transmuxer] ${e.message}`),this.observer.emit(wc.ERROR,wc.ERROR,{type:Tc.MEDIA_ERROR,details:kc.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message}),r.executeEnd=gg(),Lg(i)}(d||h||p||v)&&this.resetInitSegment(A,f,m,y,t),(d||p||v)&&this.resetInitialTimestamp(g),l||this.resetContiguity();const _=this.transmux(o,b,u,c,i),S=this.currentTransmuxState;return S.contiguous=!0,S.discontinuity=!1,S.trackSwitch=!1,r.executeEnd=gg(),_}flush(e){const t=e.transmuxing;t.executeStart=gg();const{decrypter:i,currentTransmuxState:s,decryptionPromise:r}=this;if(r)return r.then((()=>this.flush(e)));const o=[],{timeOffset:a}=s;if(i){const t=i.flush();t&&o.push(this.push(t,null,e))}const{demuxer:n,remuxer:l}=this;if(!n||!l)return t.executeEnd=gg(),[Lg(e)];const d=n.flush(a);return Cg(d)?d.then((t=>(this.flushRemux(o,t,e),o))):(this.flushRemux(o,d,e),o)}flushRemux(e,t,i){const{audioTrack:s,videoTrack:r,id3Track:o,textTrack:a}=t,{accurateTimeOffset:n,timeOffset:l}=this.currentTransmuxState;Rc.log(`[transmuxer.ts]: Flushed fragment ${i.sn}${i.part>-1?" p: "+i.part:""} of level ${i.level}`);const d=this.remuxer.remux(s,r,o,a,l,n,!0,this.id);e.push({remuxResult:d,chunkMeta:i}),i.transmuxing.executeEnd=gg()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,s,r){const{demuxer:o,remuxer:a}=this;o&&a&&(o.resetInitSegment(e,t,i,s),a.resetInitSegment(e,t,i,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,s,r){let o;return o=t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,i,s,r):this.transmuxUnencrypted(e,i,s,r),o}transmuxUnencrypted(e,t,i,s){const{audioTrack:r,videoTrack:o,id3Track:a,textTrack:n}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,o,a,n,t,i,!1,this.id),chunkMeta:s}}transmuxSampleAes(e,t,i,s,r){return this.demuxer.demuxSampleAes(e,t,i).then((e=>({remuxResult:this.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,i,s,!1,this.id),chunkMeta:r})))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:s,vendor:r}=this;let o;for(let t=0,i=Tg.length;t({remuxResult:{},chunkMeta:e});function Cg(e){return"then"in e&&e.then instanceof Function}class Dg{constructor(e,t,i,s,r){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=s,this.defaultInitPts=r||null}}class xg{constructor(e,t,i,s,r,o){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=s,this.timeOffset=r,this.initSegmentChange=o}}var Rg={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function s(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,s,o,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var n=new r(s,o||e,a),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],n]:e._events[l].push(n):(e._events[l]=n,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new s:delete e._events[t]}function n(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),n.prototype.eventNames=function(){var e,s,r=[];if(0===this._eventsCount)return r;for(s in e=this._events)t.call(e,s)&&r.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},n.prototype.listeners=function(e){var t=i?i+e:e,s=this._events[t];if(!s)return[];if(s.fn)return[s.fn];for(var r=0,o=s.length,a=new Array(o);r{(t=t||{}).frag=this.frag,t.id=this.id,e===wc.ERROR&&(this.error=t.error),this.hls.trigger(e,t)};this.observer=new Pg,this.observer.on(wc.FRAG_DECRYPTED,o),this.observer.on(wc.ERROR,o);const a=sp(r.preferManagedMediaSource)||{isTypeSupported:()=>!1},n={mpeg:a.isTypeSupported("audio/mpeg"),mp3:a.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:a.isTypeSupported('audio/mp4; codecs="ac-3"')};if(this.useWorker&&"undefined"!=typeof Worker){if(r.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{r.workerPath?(Rc.log(`loading Web Worker ${r.workerPath} for "${t}"`),this.workerContext=function(e){const t=new self.URL(e,self.location.href).href;return{worker:new self.Worker(t),scriptURL:t}}(r.workerPath)):(Rc.log(`injecting Web Worker for "${t}"`),this.workerContext=function(){const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e);return{worker:new self.Worker(t),objectURL:t}}()),this.onwmsg=e=>this.onWorkerMessage(e);const{worker:e}=this.workerContext;e.addEventListener("message",this.onwmsg),e.onerror=e=>{const i=new Error(`${e.message} (${e.filename}:${e.lineno})`);r.enableWorker=!1,Rc.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(wc.ERROR,{type:Tc.OTHER_ERROR,details:kc.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:i})},e.postMessage({cmd:"init",typeSupported:n,vendor:"",id:t,config:JSON.stringify(r)})}catch(e){Rc.warn(`Error setting up "${t}" Web Worker, fallback to inline`,e),this.resetWorker(),this.error=null,this.transmuxer=new kg(this.observer,n,r,"",t)}return}}this.transmuxer=new kg(this.observer,n,r,"",t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,i,s,r,o,a,n,l,d){var h,c;l.transmuxing.start=self.performance.now();const{transmuxer:u}=this,p=o?o.start:r.start,f=r.decryptdata,m=this.frag,g=!(m&&r.cc===m.cc),y=!(m&&l.level===m.level),A=m?l.sn-m.sn:-1,b=this.part?l.part-this.part.index:-1,v=0===A&&l.id>1&&l.id===(null==m?void 0:m.stats.chunkCount),_=!y&&(1===A||0===A&&(1===b||v&&b<=0)),S=self.performance.now();(y||A||0===r.stats.parsing.start)&&(r.stats.parsing.start=S),!o||!b&&_||(o.stats.parsing.start=S);const E=!(m&&(null==(h=r.initSegment)?void 0:h.url)===(null==(c=m.initSegment)?void 0:c.url)),w=new xg(g,_,n,y,p,E);if(!_||g||E){Rc.log(`[transmuxer-interface, ${r.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}\n discontinuity: ${g}\n trackSwitch: ${y}\n contiguous: ${_}\n accurateTimeOffset: ${n}\n timeOffset: ${p}\n initSegmentChange: ${E}`);const e=new Dg(i,s,t,a,d);this.configureTransmuxer(e)}if(this.frag=r,this.part=o,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:f,chunkMeta:l,state:w},e instanceof ArrayBuffer?[e]:[]);else if(u){const t=u.push(e,f,l,w);Cg(t)?(u.async=!0,t.then((e=>{this.handleTransmuxComplete(e)})).catch((e=>{this.transmuxerError(e,l,"transmuxer-interface push error")}))):(u.async=!1,this.handleTransmuxComplete(t))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let i=t.flush(e);Cg(i)||t.async?(Cg(i)||(i=Promise.resolve(i)),i.then((t=>{this.handleFlushResult(t,e)})).catch((t=>{this.transmuxerError(t,e,"transmuxer-interface flush error")}))):this.handleFlushResult(i,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(wc.ERROR,{type:Tc.MEDIA_ERROR,details:kc.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach((e=>{this.handleTransmuxComplete(e)})),this.onFlush(t)}onWorkerMessage(e){const t=e.data;if(null==t||!t.event)return void Rc.warn("worker message received with no "+(t?"event name":"data"));const i=this.hls;if(this.hls)switch(t.event){case"init":{var s;const e=null==(s=this.workerContext)?void 0:s.objectURL;e&&self.URL.revokeObjectURL(e);break}case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":Rc[t.data.logType]&&Rc[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data)}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}function Ig(e,t){if(e.length!==t.length)return!1;for(let i=0;ie[i]!==t[i]))}function Fg(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||"").toLowerCase())}class Ug{constructor(e){this.buffered=void 0;const t=(t,i,s)=>{if((i>>>=0)>s-1)throw new DOMException(`Failed to execute '${t}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${s})`);return e[i][t]};this.buffered={get length(){return e.length},end:i=>t("end",i,e.length),start:i=>t("start",i,e.length)}}}class Og{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,i){const s=this.queues[t];s.push(e),1!==s.length||i||this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const i=new Promise((e=>{t=e})),s={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(s,e),i}executeNext(e){const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(t){Rc.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${t}`),i.onError(t);const s=this.buffers[e];null!=s&&s.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const Ng=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;function jg(e){const t=e.querySelectorAll("source");[].slice.call(t).forEach((t=>{e.removeChild(t)}))}const Gg={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},zg=e=>String.fromCharCode(Gg[e]||e),Wg=15,Vg=100,Hg={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},$g={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Jg={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},qg={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Kg=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Yg{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i="function"==typeof t?t():t;Rc.log(`${this.time} [${e}] ${i}`)}}}const Qg=function(e){const t=[];for(let i=0;iVg&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Vg)}moveCursor(e){const t=this.pos+e;if(e>1)for(let e=this.pos+1;e=144&&this.backSpace();const t=zg(e);this.pos>=Vg?this.logger.log(0,(()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!")):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))}clearFromPos(e){let t;for(t=e;t"pacData = "+JSON.stringify(e)));let t=e.row-1;if(this.nrRollUpRows&&t"bkgData = "+JSON.stringify(e))),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,(()=>this.getDisplayText()));const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",s=-1;for(let i=0;i0&&(i=e?"["+t.join(" | ")+"]":t.join("\n")),i}getTextAndFormat(){return this.rows}}class iy{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new ty(i),this.nonDisplayedMemory=new ty(i),this.lastOutputScreen=new ty(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,(()=>"MODE="+e)),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let t=0;tt+": "+this.writeScreen.getDisplayText(!0))),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(1,(()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0))),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,(()=>"DISP: "+this.displayedMemory.getDisplayText()))}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,s=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=s[i]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class sy{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const s=this.logger=new Yg;this.channels=[null,new iy(e,t,s),new iy(e+1,i,s)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let e=0;e"["+Qg([t[e],t[e+1]])+"] -> ("+Qg([i,s])+")"));const a=this.cmdHistory;if(i>=16&&i<=31){if(oy(i,s,a)){ry(null,null,a),this.logger.log(3,(()=>"Repeated command ("+Qg([i,s])+") is dropped"));continue}ry(i,s,this.cmdHistory),r=this.parseCmd(i,s),r||(r=this.parseMidrow(i,s)),r||(r=this.parsePAC(i,s)),r||(r=this.parseBackgroundAttributes(i,s))}else ry(null,null,a);if(!r&&(o=this.parseChars(i,s),o)){const e=this.currentChannel;if(e&&e>0){this.channels[e].insertChars(o)}else this.logger.log(2,"No channel found yet. TEXT-MODE?")}r||o||this.logger.log(2,(()=>"Couldn't parse cleaned data "+Qg([i,s])+" orig: "+Qg([t[e],t[e+1]])))}}parseCmd(e,t){if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=33&&t<=35))return!1;const i=20===e||21===e||23===e?1:2,s=this.channels[i];return 20===e||21===e||28===e||29===e?32===t?s.ccRCL():33===t?s.ccBS():34===t?s.ccAOF():35===t?s.ccAON():36===t?s.ccDER():37===t?s.ccRU(2):38===t?s.ccRU(3):39===t?s.ccRU(4):40===t?s.ccFON():41===t?s.ccRDC():42===t?s.ccTR():43===t?s.ccRTD():44===t?s.ccEDM():45===t?s.ccCR():46===t?s.ccENM():47===t&&s.ccEOC():s.ccTO(t-32),this.currentChannel=i,!0}parseMidrow(e,t){let i=0;if((17===e||25===e)&&t>=32&&t<=47){if(i=17===e?1:2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const s=this.channels[i];return!!s&&(s.ccMIDROW(t),this.logger.log(3,(()=>"MIDROW ("+Qg([e,t])+")")),!0)}return!1}parsePAC(e,t){let i;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127)&&!((16===e||24===e)&&t>=64&&t<=95))return!1;const s=e<=23?1:2;i=t>=64&&t<=95?1===s?Hg[e]:Jg[e]:1===s?$g[e]:qg[e];const r=this.channels[s];return!!r&&(r.setPAC(this.interpretPAC(i,t)),this.currentChannel=s,!0)}interpretPAC(e,t){let i;const s={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,s.underline=1==(1&i),i<=13?s.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(s.italics=!0,s.color="white"):s.indent=4*Math.floor((i-16)/2),s}parseChars(e,t){let i,s=null,r=null;if(e>=25?(i=2,r=e-8):(i=1,r=e),r>=17&&r<=19){let e;e=17===r?t+80:18===r?t+112:t+144,this.logger.log(2,(()=>"Special char '"+zg(e)+"' in channel "+i)),s=[e]}else e>=32&&e<=127&&(s=0===t?[e]:[e,t]);return s&&this.logger.log(3,(()=>"Char codes = "+Qg(s).join(","))),s}parseBackgroundAttributes(e,t){if(!((16===e||24===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=45&&t<=47))return!1;let i;const s={};16===e||24===e?(i=Math.floor((t-32)/2),s.background=Kg[i],t%2==1&&(s.background=s.background+"_semi")):45===t?s.background="transparent":(s.foreground="black",47===t&&(s.underline=!0));const r=e<=23?1:2;return this.channels[r].setBkgData(s),!0}reset(){for(let e=0;ee)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var ny=function(){if(null!=qc&&qc.VTTCue)return self.VTTCue;const e=["","lr","rl"],t=["start","middle","end","left","right"];function i(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;const i=t.toLowerCase();return!!~e.indexOf(i)&&i}function s(e){return i(t,e)}function r(e,...t){let i=1;for(;i100)throw new Error("Position must be between 0 and 100.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(n,"positionAlign",r({},l,{get:function(){return v},set:function(e){const t=s(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");v=t,this.hasBeenReset=!0}})),Object.defineProperty(n,"size",r({},l,{get:function(){return _},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");_=e,this.hasBeenReset=!0}})),Object.defineProperty(n,"align",r({},l,{get:function(){return S},set:function(e){const t=s(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");S=t,this.hasBeenReset=!0}})),n.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class ly{decode(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function dy(e){function t(e,t,i,s){return 3600*(0|e)+60*(0|t)+(0|i)+parseFloat(s||0)}const i=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return i?parseFloat(i[2])>59?t(i[2],i[3],0,i[4]):t(i[1],i[2],i[3],i[4]):null}class hy{constructor(){this.values=Object.create(null)}set(e,t){this.get(e)||""===t||(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let s=0;s=0&&i<=100)return this.set(e,i),!0}return!1}}function cy(e,t,i,s){const r=s?e.split(s):[e];for(const e in r){if("string"!=typeof r[e])continue;const s=r[e].split(i);if(2!==s.length)continue;t(s[0],s[1])}}const uy=new ny(0,0,""),py="middle"===uy.align?"middle":"center";function fy(e,t,i){const s=e;function r(){const t=dy(e);if(null===t)throw new Error("Malformed timestamp: "+s);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function o(){e=e.replace(/^\s+/,"")}if(o(),t.startTime=r(),o(),"--\x3e"!==e.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+s);e=e.slice(3),o(),t.endTime=r(),o(),function(e,t){const s=new hy;cy(e,(function(e,t){let r;switch(e){case"region":for(let r=i.length-1;r>=0;r--)if(i[r].id===t){s.set(e,i[r].region);break}break;case"vertical":s.alt(e,t,["rl","lr"]);break;case"line":r=t.split(","),s.integer(e,r[0]),s.percent(e,r[0])&&s.set("snapToLines",!1),s.alt(e,r[0],["auto"]),2===r.length&&s.alt("lineAlign",r[1],["start",py,"end"]);break;case"position":r=t.split(","),s.percent(e,r[0]),2===r.length&&s.alt("positionAlign",r[1],["start",py,"end","line-left","line-right","auto"]);break;case"size":s.percent(e,t);break;case"align":s.alt(e,t,["start",py,"end","left","right"])}}),/:/,/\s/),t.region=s.get("region",null),t.vertical=s.get("vertical","");let r=s.get("line","auto");"auto"===r&&-1===uy.line&&(r=-1),t.line=r,t.lineAlign=s.get("lineAlign","start"),t.snapToLines=s.get("snapToLines",!0),t.size=s.get("size",100),t.align=s.get("align",py);let o=s.get("position","auto");"auto"===o&&50===uy.position&&(o="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=o}(e,t)}function my(e){return e.replace(//gi,"\n")}class gy{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new ly,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;function i(){let e=t.buffer,i=0;for(e=my(e);i>>0).toString()};function vy(e,t,i){return by(e.toString())+by(t.toString())+by(i)}function _y(e,t,i,s,r,o,a){const n=new gy,l=_u(new Uint8Array(e)).trim().replace(yy,"\n").split("\n"),d=[],h=t?function(e,t=1){return fg(e,9e4,1/t)}(t.baseTime,t.timescale):0;let c,u="00:00.000",p=0,f=0,m=!0;n.oncue=function(e){const o=i[s];let a=i.ccOffset;const n=(p-h)/9e4;if(null!=o&&o.new&&(void 0!==f?a=i.ccOffset=o.start:function(e,t,i){let s=e[t],r=e[s.prevCC];if(!r||!r.new&&s.new)return e.ccOffset=e.presentationOffset=s.start,void(s.new=!1);for(;null!=(o=r)&&o.new;){var o;e.ccOffset+=s.start-r.start,s.new=!1,s=r,r=e[s.prevCC]}e.presentationOffset=i}(i,s,n)),n){if(!t)return void(c=new Error("Missing initPTS for VTT MPEGTS"));a=n-i.presentationOffset}const l=e.endTime-e.startTime,u=vg(9e4*(e.startTime+a-f),9e4*r)/9e4;e.startTime=Math.max(u,0),e.endTime=Math.max(u+l,0);const m=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(m)),e.id||(e.id=vy(e.startTime,e.endTime,m)),e.endTime>0&&d.push(e)},n.onparsingerror=function(e){c=e},n.onflush=function(){c?a(c):o(d)},l.forEach((e=>{if(m){if(Ay(e,"X-TIMESTAMP-MAP=")){m=!1,e.slice(16).split(",").forEach((e=>{Ay(e,"LOCAL:")?u=e.slice(6):Ay(e,"MPEGTS:")&&(p=parseInt(e.slice(7)))}));try{f=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),s=parseInt(e.slice(-9,-7)),r=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!(_c(t)&&_c(i)&&_c(s)&&_c(r)))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=6e4*s,t+=36e5*r,t}(u)/1e3}catch(e){c=e}return}""===e&&(m=!1)}n.parse(e+"\n")})),n.flush()}const Sy="stpp.ttml.im1t",Ey=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,wy=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Ty={left:"start",center:"center",right:"end",start:"start",end:"end"};function ky(e,t,i,s){const r=Iu(new Uint8Array(e),["mdat"]);if(0===r.length)return void s(new Error("Could not parse IMSC1 mdat"));const o=r.map((e=>_u(e))),a=function(e,t,i=1,s=!1){return fg(e,t,1/i,s)}(t.baseTime,1,t.timescale);try{o.forEach((e=>i(function(e,t){const i=new DOMParser,s=i.parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!s)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(r).reduce(((e,t)=>(e[t]=s.getAttribute(`ttp:${t}`)||r[t],e)),{}),a="preserve"!==s.getAttribute("xml:space"),n=Cy(Ly(s,"styling","style")),l=Cy(Ly(s,"layout","region")),d=Ly(s,"body","[begin]");return[].map.call(d,(e=>{const i=Dy(e,a);if(!i||!e.hasAttribute("begin"))return null;const s=Py(e.getAttribute("begin"),o),r=Py(e.getAttribute("dur"),o);let d=Py(e.getAttribute("end"),o);if(null===s)throw Ry(e);if(null===d){if(null===r)throw Ry(e);d=s+r}const h=new ny(s-t,d-t,i);h.id=vy(h.startTime,h.endTime,h.text);const c=function(e,t,i){const s="http://www.w3.org/ns/ttml#styling";let r=null;const o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;a&&i.hasOwnProperty(a)&&(r=i[a]);return o.reduce(((i,o)=>{const a=xy(t,s,o)||xy(e,s,o)||xy(r,s,o);return a&&(i[o]=a),i}),{})}(l[e.getAttribute("region")],n[e.getAttribute("style")],n),{textAlign:u}=c;if(u){const e=Ty[u];e&&(h.lineAlign=e),h.align=u}return vc(h,c),h})).filter((e=>null!==e))}(e,a))))}catch(e){s(e)}}function Ly(e,t,i){const s=e.getElementsByTagName(t)[0];return s?[].slice.call(s.querySelectorAll(i)):[]}function Cy(e){return e.reduce(((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e}),{})}function Dy(e,t){return[].slice.call(e.childNodes).reduce(((e,i,s)=>{var r;return"br"===i.nodeName&&s?e+"\n":null!=(r=i.childNodes)&&r.length?Dy(i,t):t?e+i.textContent.trim().replace(/\s+/g," "):e+i.textContent}),"")}function xy(e,t,i){return e&&e.hasAttributeNS(t,i)?e.getAttributeNS(t,i):null}function Ry(e){return new Error(`Could not parse ttml timestamp ${e}`)}function Py(e,t){if(!e)return null;let i=dy(e);return null===i&&(Ey.test(e)?i=function(e,t){const i=Ey.exec(e),s=(0|i[4])+(0|i[5])/t.subFrameRate;return 3600*(0|i[1])+60*(0|i[2])+(0|i[3])+s/t.frameRate}(e,t):wy.test(e)&&(i=function(e,t){const i=wy.exec(e),s=Number(i[1]);switch(i[2]){case"h":return 3600*s;case"m":return 60*s;case"ms":return 1e3*s;case"f":return s/t.frameRate;case"t":return s/t.tickRate}return s}(e,t))),i}function By(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles"}function Iy(e,t){return!!e&&e.kind===By(t)&&Fg(t,e)}class My{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(wc.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(wc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(wc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(wc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(wc.BUFFER_CODECS,this.onBufferCodecs,this),e.on(wc.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(wc.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(wc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(wc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(wc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(wc.BUFFER_CODECS,this.onBufferCodecs,this),e.off(wc.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&_c(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&Rc.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter(((t,i)=>this.isLevelAllowed(t)&&i<=e));return this.clientRect=null,My.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(e){}return e}isLevelAllowed(e){return!this.restrictedLevels.some((t=>e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height))}static getMaxLevelByMediaSize(e,t,i){if(null==e||!e.length)return-1;let s=e.length-1;const r=Math.max(t,i);for(let t=0;t=r||i.height>=r)&&(o=i,!(a=e[t+1])||o.width!==a.width||o.height!==a.height)){s=t;break}}var o,a;return s}}const Fy="[eme]";class Uy{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=Uy.CDMCleanupPromise?[Uy.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=Rc.debug.bind(Rc,Fy),this.log=Rc.log.bind(Rc,Fy),this.warn=Rc.warn.bind(Rc,Fy),this.error=Rc.error.bind(Rc,Fy),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(wc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(wc.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(wc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(wc.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(wc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(wc.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(wc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(wc.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,s=t[e];if(s)return s.licenseUrl;if(e===Kc.WIDEVINE&&i)return i;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(e,t,i)=>!!e&&i.indexOf(e)===t,s=t.map((e=>e.audioCodec)).filter(i),r=t.map((e=>e.videoCodec)).filter(i);return s.length+r.length===0&&r.push("avc1.42e01e"),new Promise(((t,i)=>{const o=e=>{const a=e.shift();this.getMediaKeysPromise(a,s,r).then((e=>t({keySystem:a,mediaKeys:e}))).catch((t=>{e.length?o(e):i(t instanceof Oy?t:new Oy({type:Tc.KEY_SYSTEM_ERROR,details:kc.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))}))};o(e)}))}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if("function"!=typeof i){let e=`Configured requestMediaKeySystemAccess is not a function ${i}`;return null===ru&&"http:"===self.location.protocol&&(e=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(e))}return i(e,t)}getMediaKeysPromise(e,t,i){const s=function(e,t,i,s){let r;switch(e){case Kc.FAIRPLAY:r=["cenc","sinf"];break;case Kc.WIDEVINE:case Kc.PLAYREADY:r=["cenc"];break;case Kc.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${e}`)}return function(e,t,i,s){return[{initDataTypes:e,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:t.map((e=>({contentType:`audio/mp4; codecs="${e}"`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null}))),videoCapabilities:i.map((e=>({contentType:`video/mp4; codecs="${e}"`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null})))}]}(r,t,i,s)}(e,t,i,this.config.drmSystemOptions),r=this.keySystemAccessPromises[e];let o=null==r?void 0:r.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(s)}`),o=this.requestMediaKeySystemAccess(e,s);const t=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch((t=>{this.log(`Failed to obtain access to key-system "${e}": ${t}`)})),o.then((i=>{this.log(`Access for key-system "${i.keySystem}" obtained`);const s=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),t.mediaKeys=i.createMediaKeys().then((t=>(this.log(`Media-keys created for "${e}"`),s.then((i=>i?this.setMediaKeysServerCertificate(t,e,i):t))))),t.mediaKeys.catch((t=>{this.error(`Failed to create media-keys for "${e}"}: ${t}`)})),t.mediaKeys}))}return o.then((()=>r.mediaKeys))}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${wu(e.keyId||[])}`);const s=i.createSession(),r={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:s,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),s=this.getKeyIdString(t),r="cenc";this.keyIdToKeySessionPromise[s]=this.generateRequestWithPreferredKeySession(i,r,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw new Error("keyId is null");return wu(e.keyId)}updateKeySession(e,t){var i;const s=e.mediaKeysSession;return this.log(`Updating key-session "${s.sessionId}" for keyID ${wu((null==(i=e.decryptdata)?void 0:i.keyId)||[])}\n } (data length: ${t?t.byteLength:t})`),s.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise(((t,i)=>{const s=su(this.config),r=e.map(eu).filter((e=>!!e&&-1!==s.indexOf(e)));return this.getKeySystemSelectionPromise(r).then((({keySystem:e})=>{const s=iu(e);s?t(s):i(new Error(`Unable to find format for key-system "${e}"`))})).catch(i)}))}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),s=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${s}`);let r=this.keyIdToKeySessionPromise[i];return r||(r=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(t).then((({keySystem:i,mediaKeys:r})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${s}`),this.attemptSetMediaKeys(i,r).then((()=>{this.throwIfDestroyed();const e=this.createMediaKeySessionContext({keySystem:i,mediaKeys:r,decryptdata:t});return this.generateRequestWithPreferredKeySession(e,"cenc",t.pssh,"playlist-key")}))))),r.catch((e=>this.handleError(e)))),r}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Oy?this.hls.trigger(wc.ERROR,e.data):this.hls.trigger(wc.ERROR,{type:Tc.KEY_SYSTEM_ERROR,details:kc.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const t=eu(e.keyFormat),i=t?[t]:su(this.config);return this.attemptKeySystemAccess(i)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=su(this.config)),0===e.length)throw new Oy({type:Tc.KEY_SYSTEM_ERROR,details:kc.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:i}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),null===i)return;let s,r;if("sinf"===t&&this.config.drmSystems[Kc.FAIRPLAY]){const e=Cu(new Uint8Array(i));try{const t=Hc(JSON.parse(e).sinf),i=Gu(new Uint8Array(t));if(!i)return;s=i.subarray(8,24),r=Kc.FAIRPLAY}catch(e){return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{const e=function(e){if(!(e instanceof ArrayBuffer)||e.byteLength<32)return null;const t={version:0,systemId:"",kids:null,data:null},i=new DataView(e),s=i.getUint32(0);if(e.byteLength!==s&&s>44)return null;if(1886614376!==i.getUint32(4))return null;if(t.version=i.getUint32(8)>>>24,t.version>1)return null;t.systemId=wu(new Uint8Array(e,12,16));const r=i.getUint32(28);if(0===t.version){if(s-32this.generateRequestWithPreferredKeySession(r,t,i,"encrypted-event-key-match")));break}}l||(l=a[o]=this.getKeySystemSelectionPromise([r]).then((({keySystem:e,mediaKeys:r})=>{var a;this.throwIfDestroyed();const n=new Yu("ISO-23001-7",o,null!=(a=iu(e))?a:"");return n.pssh=new Uint8Array(i),n.keyId=s,this.attemptSetMediaKeys(e,r).then((()=>{this.throwIfDestroyed();const s=this.createMediaKeySessionContext({decryptdata:n,keySystem:e,mediaKeys:r});return this.generateRequestWithPreferredKeySession(s,t,i,"encrypted-event-no-match")}))}))),l.catch((e=>this.handleError(e)))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const s=Promise.all(i).then((()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)}));return this.setMediaKeysQueue.push(s),s.then((()=>{this.log(`Media-keys set for "${e}"`),i.push(s),this.setMediaKeysQueue=this.setMediaKeysQueue.filter((e=>-1===i.indexOf(e)))}))}generateRequestWithPreferredKeySession(e,t,i,s){var r,o;const a=null==(r=this.config.drmSystems)||null==(o=r[e.keySystem])?void 0:o.generateRequest;if(a)try{const s=a.call(this.hls,t,i,e);if(!s)throw new Error("Invalid response from configured generateRequest filter");t=s.initDataType,i=e.decryptdata.pssh=s.initData?new Uint8Array(s.initData):null}catch(e){var n;if(this.warn(e.message),null!=(n=this.hls)&&n.config.debug)throw e}if(null===i)return this.log(`Skipping key-session request for "${s}" (no initData)`),Promise.resolve(e);const l=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${s}": ${l} (init data type: ${t} length: ${i?i.byteLength:null})`);const d=new Pg,h=e._onmessage=t=>{const i=e.mediaKeysSession;if(!i)return void d.emit("error",new Error("invalid state"));const{messageType:s,message:r}=t;this.log(`"${s}" message event for session "${i.sessionId}" message size: ${r.byteLength}`),"license-request"===s||"license-renewal"===s?this.renewLicense(e,r).catch((e=>{this.handleError(e),d.emit("error",e)})):"license-release"===s?e.keySystem===Kc.FAIRPLAY&&(this.updateKeySession(e,Jc("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${s}"`)},c=e._onkeystatuseschange=t=>{if(!e.mediaKeysSession)return void d.emit("error",new Error("invalid state"));this.onKeyStatusChange(e);const i=e.keyStatus;d.emit("keyStatus",i),"expired"===i&&(this.warn(`${e.keySystem} expired for key ${l}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",h),e.mediaKeysSession.addEventListener("keystatuseschange",c);const u=new Promise(((e,t)=>{d.on("error",t),d.on("keyStatus",(i=>{i.startsWith("usable")?e():"output-restricted"===i?t(new Oy({type:Tc.KEY_SYSTEM_ERROR,details:kc.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):"internal-error"===i?t(new Oy({type:Tc.KEY_SYSTEM_ERROR,details:kc.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${i}"`)):"expired"===i?t(new Error("key expired while generating request")):this.warn(`unhandled key status change "${i}"`)}))}));return e.mediaKeysSession.generateRequest(t,i).then((()=>{var t;this.log(`Request generated for key-session "${null==(t=e.mediaKeysSession)?void 0:t.sessionId}" keyId: ${l}`)})).catch((e=>{throw new Oy({type:Tc.KEY_SYSTEM_ERROR,details:kc.KEY_SYSTEM_NO_SESSION,error:e,fatal:!1},`Error generating key-session request: ${e}`)})).then((()=>u)).catch((t=>{throw d.removeAllListeners(),this.removeSession(e),t})).then((()=>(d.removeAllListeners(),e)))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach(((t,i)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${wu("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${wu(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t}))}fetchServerCertificate(e){const t=this.config,i=new(0,t.loader)(t),s=this.getServerCertificateUrl(e);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise(((r,o)=>{const a={responseType:"arraybuffer",url:s},n=t.certLoadPolicy.default,l={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(e,t,i,s)=>{r(e.data)},onError:(t,i,r,n)=>{o(new Oy({type:Tc.KEY_SYSTEM_ERROR,details:kc.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:yc({url:a.url,data:void 0},t)},`"${e}" certificate request failed (${s}). Status: ${t.code} (${t.text})`))},onTimeout:(t,i,r)=>{o(new Oy({type:Tc.KEY_SYSTEM_ERROR,details:kc.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:{url:a.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(e,t,i)=>{o(new Error("aborted"))}};i.load(a,l,d)}))):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise(((s,r)=>{e.setServerCertificate(i).then((r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${null==i?void 0:i.byteLength}) on "${t}"`),s(e)})).catch((e=>{r(new Oy({type:Tc.KEY_SYSTEM_ERROR,details:kc.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))}))}))}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then((t=>this.updateKeySession(e,new Uint8Array(t)).catch((e=>{throw new Oy({type:Tc.KEY_SYSTEM_ERROR,details:kc.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:e,fatal:!0},e.message)}))))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const s=(new DOMParser).parseFromString(i,"application/xml"),r=s.querySelectorAll("HttpHeader");if(r.length>0){let t;for(let i=0,s=r.length;i in key message");return Jc(atob(l))}setupLicenseXHR(e,t,i,s){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then((()=>{if(!i.decryptdata)throw new Error("Key removed");return r.call(this.hls,e,t,i,s)})).catch((o=>{if(!i.decryptdata)throw o;return e.open("POST",t,!0),r.call(this.hls,e,t,i,s)})).then((i=>{e.readyState||e.open("POST",t,!0);return{xhr:e,licenseChallenge:i||s}})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:s}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise(((s,r)=>{const o=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${o}`);const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return r(new Error("invalid state"));if(4===a.readyState)if(200===a.status){this._requestLicenseFailureCount=0;let t=a.response;this.log(`License received ${t instanceof ArrayBuffer?t.byteLength:t}`);const i=this.config.licenseResponseCallback;if(i)try{t=i.call(this.hls,a,o,e)}catch(e){this.error(e)}s(t)}else{const n=i.errorRetry,l=n?n.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||a.status>=400&&a.status<500)r(new Oy({type:Tc.KEY_SYSTEM_ERROR,details:kc.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:o,data:void 0,code:a.status,text:a.statusText}},`License Request XHR failed (${o}). Status: ${a.status} (${a.statusText})`));else{const i=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${i} attempts left`),this.requestLicense(e,t).then(s,r)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then((({xhr:t,licenseChallenge:i})=>{e.keySystem==Kc.PLAYREADY&&(i=this.unpackPlayReadyKeyMessage(t,i)),t.send(i)}))}))}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Yu.clearKeyUriToKeyIdMap();const i=t.length;Uy.CDMCleanupPromise=Promise.all(t.map((e=>this.removeSession(e))).concat(null==e?void 0:e.setMediaKeys(null).catch((e=>{this.log(`Could not clear media keys: ${e}`)})))).then((()=>{i&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)})).catch((e=>{this.log(`Could not close sessions and clear media keys: ${e}`)}))}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(t&&this.config.emeEnabled&&!this.keyFormatPromise){const e=t.reduce(((e,t)=>(-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e)),[]);this.log(`Selecting key-system from session-keys ${e.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(e)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const s=this.mediaKeySessions.indexOf(e);return s>-1&&this.mediaKeySessions.splice(s,1),t.remove().catch((e=>{this.log(`Could not remove session: ${e}`)})).then((()=>t.close())).catch((e=>{this.log(`Could not close session: ${e}`)}))}}}Uy.CDMCleanupPromise=void 0;class Oy extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}var Ny,jy,Gy;!function(e){e.MANIFEST="m",e.AUDIO="a",e.VIDEO="v",e.MUXED="av",e.INIT="i",e.CAPTION="c",e.TIMED_TEXT="tt",e.KEY="k",e.OTHER="o"}(Ny||(Ny={})),function(e){e.DASH="d",e.HLS="h",e.SMOOTH="s",e.OTHER="o"}(jy||(jy={})),function(e){e.OBJECT="CMCD-Object",e.REQUEST="CMCD-Request",e.SESSION="CMCD-Session",e.STATUS="CMCD-Status"}(Gy||(Gy={}));const zy={[Gy.OBJECT]:["br","d","ot","tb"],[Gy.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[Gy.SESSION]:["cid","pr","sf","sid","st","v"],[Gy.STATUS]:["bs","rtp"]};class Wy{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map((e=>e instanceof Wy?e:new Wy(e)))),this.value=e,this.params=t}}class Vy{constructor(e){this.description=void 0,this.description=e}}function Hy(e,t,i,s){return new Error(`failed to ${e} "${r=t,Array.isArray(r)?JSON.stringify(r):r instanceof Map?"Map{}":r instanceof Set?"Set{}":"object"==typeof r?JSON.stringify(r):String(r)}" as ${i}`,{cause:s});var r}const $y="Bare Item";const Jy=/[\x00-\x1f\x7f]+/;function qy(e,t,i){return Hy("serialize",e,t,i)}function Ky(e){if(!1===ArrayBuffer.isView(e))throw qy(e,"Byte Sequence");return`:${t=e,btoa(String.fromCharCode(...t))}:`;var t}function Yy(e){if(function(e){return e<-999999999999999||99999999999999912)throw qy(e,"Decimal");const i=t.toString();return i.includes(".")?i:`${i}.0`}function Zy(e){const t=(i=e).description||i.toString().slice(7,-1);var i;if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t))throw qy(t,"Token");return t}function eA(e){switch(typeof e){case"number":if(!_c(e))throw qy(e,$y);return Number.isInteger(e)?Yy(e):Xy(e);case"string":return function(e){if(Jy.test(e))throw qy(e,"String");return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}(e);case"symbol":return Zy(e);case"boolean":return function(e){if("boolean"!=typeof e)throw qy(e,"Boolean");return e?"?1":"?0"}(e);case"object":if(e instanceof Date)return function(e){return`@${Yy(e.getTime()/1e3)}`}(e);if(e instanceof Uint8Array)return Ky(e);if(e instanceof Vy)return Zy(e);default:throw qy(e,$y)}}function tA(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw qy(e,"Key");return e}function iA(e){return null==e?"":Object.entries(e).map((([e,t])=>!0===t?`;${tA(e)}`:`;${tA(e)}=${eA(t)}`)).join("")}function sA(e){return e instanceof Wy?`${eA(e.value)}${iA(e.params)}`:eA(e)}function rA(e,t={whitespace:!0}){if("object"!=typeof e)throw qy(e,"Dict");const i=e instanceof Map?e.entries():Object.entries(e),s=null!=t&&t.whitespace?" ":"";return Array.from(i).map((([e,t])=>{t instanceof Wy==!1&&(t=new Wy(t));let i=tA(e);var s;return!0===t.value?i+=iA(t.params):(i+="=",Array.isArray(t.value)?i+=`(${(s=t).value.map(sA).join(" ")})${iA(s.params)}`:i+=sA(t)),i})).join(`,${s}`)}const oA=e=>Math.round(e),aA=e=>100*oA(e/100),nA={br:oA,d:oA,bl:aA,dl:aA,mtp:aA,nor:(e,t)=>(null!=t&&t.baseUrl&&(e=function(e,t){const i=new URL(e),s=new URL(t);if(i.origin!==s.origin)return e;const r=i.pathname.split("/").slice(1),o=s.pathname.split("/").slice(1,-1);for(;r[0]===o[0];)r.shift(),o.shift();for(;o.length;)o.shift(),r.unshift("..");return r.join("/")}(e,t.baseUrl)),encodeURIComponent(e)),rtp:aA,tb:oA};function lA(e,t){const i={};if(null==e||"object"!=typeof e)return i;const s=Object.keys(e).sort(),r=vc({},nA,null==t?void 0:t.formatters),o=null==t?void 0:t.filter;return s.forEach((s=>{if(null!=o&&o(s))return;let a=e[s];const n=r[s];n&&(a=n(a,t)),"v"===s&&1===a||"pr"==s&&1===a||(e=>"number"==typeof e?_c(e):null!=e&&""!==e&&!1!==e)(a)&&((e=>"ot"===e||"sf"===e||"st"===e)(s)&&"string"==typeof a&&(a=new Vy(a)),i[s]=a)})),i}function dA(e,t={}){return e?function(e,t){return rA(e,t)}(lA(e,t),vc({whitespace:!1},t)):""}function hA(e,t,i){return vc(e,function(e,t={}){if(!e)return{};const i=Object.entries(e),s=Object.entries(zy).concat(Object.entries((null==t?void 0:t.customHeaderMap)||{})),r=i.reduce(((e,t)=>{var i;const[r,o]=t,a=(null==(i=s.find((e=>e[1].includes(r))))?void 0:i[0])||Gy.REQUEST;return null!=e[a]||(e[a]={}),e[a][r]=o,e}),{});return Object.entries(r).reduce(((e,[i,s])=>(e[i]=dA(s,t),e)),{})}(t,i))}const cA=/CMCD=[^&#]+/;function uA(e,t,i){const s=function(e,t={}){if(!e)return"";const i=dA(e,t);return`CMCD=${encodeURIComponent(i)}`}(t,i);if(!s)return e;if(cA.test(e))return e.replace(cA,s);const r=e.includes("?")?"&":"?";return`${e}${r}${s}`}function pA(e,t,i,s){e&&Object.keys(t).forEach((r=>{const o=e.filter((e=>e.groupId===r)).map((e=>{const o=vc({},e);return o.details=void 0,o.attrs=new Ic(o.attrs),o.url=o.attrs.URI=fA(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",i),o.groupId=o.attrs["GROUP-ID"]=t[r],o.attrs["PATHWAY-ID"]=s,o}));e.push(...o)}))}function fA(e,t,i,s){const{HOST:r,PARAMS:o,[i]:a}=s;let n;t&&(n=null==a?void 0:a[t],n&&(e=n));const l=new self.URL(e);return r&&!n&&(l.host=r),o&&Object.keys(o).sort().forEach((e=>{e&&l.searchParams.set(e,o[e])})),l.href}const mA=/^age:\s*[\d.]+\s*$/im;class gA{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new Uc,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then((()=>{if(this.loader===i&&!this.stats.aborted)return r(i,t.url)})).catch((e=>{if(this.loader===i&&!this.stats.aborted)return i.open("GET",t.url,!0),r(i,t.url)})).then((()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)})).catch((e=>{this.callbacks.onError({code:i.status,text:e.message},t,i,s)})):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const s=t.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:o}=i.loadPolicy;if(s)for(const t in s)e.setRequestHeader(t,s[t]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=r&&_c(r)?r:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const s=t.readyState,r=this.config;if(!i.aborted&&s>=2&&(0===i.loading.first&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),4===s)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const s=t.status,o="text"!==t.responseType;if(s>=200&&s<300&&(o&&t.response||null!==t.responseText)){i.loading.end=Math.max(self.performance.now(),i.loading.first);const r=o?t.response:t.responseText,a="arraybuffer"===t.responseType?r.byteLength:r.length;if(i.loaded=i.total=a,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first),!this.callbacks)return;const n=this.callbacks.onProgress;if(n&&n(i,e,r,t),!this.callbacks)return;const l={url:t.responseURL,data:r,code:s};this.callbacks.onSuccess(l,i,e,t)}else{const o=r.loadPolicy.errorRetry;bf(o,i.retry,!1,{url:e.url,data:void 0,code:s})?this.retry(o):(Rc.error(`${s} while loading ${e.url}`),this.callbacks.onError({code:s,text:t.statusText},e,t,i))}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry;if(bf(e,this.stats.retry,!0))this.retry(e);else{var t;Rc.warn(`timeout while loading ${null==(t=this.context)?void 0:t.url}`);const e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=yf(e,i.retry),i.retry++,Rc.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${null==t?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&mA.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const yA=/(\d+)-(\d+)\/(\d+)/;class AA{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||bA,this.controller=new self.AbortController,this.stats=new Uc}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();const r=function(e,t){const i={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(vc({},e.headers))};e.rangeEnd&&i.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1));return i}(e,this.controller.signal),o=i.onProgress,a="arraybuffer"===e.responseType,n=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:d}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),t.timeout=l&&_c(l)?l:d,this.requestTimeout=self.setTimeout((()=>{this.abortInternal(),i.onTimeout(s,e,this.response)}),t.timeout),self.fetch(this.request).then((r=>{this.response=this.loader=r;const n=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=d,this.requestTimeout=self.setTimeout((()=>{this.abortInternal(),i.onTimeout(s,e,this.response)}),d-(n-s.loading.start)),!r.ok){const{status:e,statusText:t}=r;throw new vA(t||"fetch, bad network response",e,r)}return s.loading.first=n,s.total=function(e){const t=e.get("Content-Range");if(t){const e=function(e){const t=yA.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}(t);if(_c(e))return e}const i=e.get("Content-Length");if(i)return parseInt(i)}(r.headers)||s.total,o&&_c(t.highWaterMark)?this.loadProgressively(r,s,e,t.highWaterMark,o):a?r.arrayBuffer():"json"===e.responseType?r.json():r.text()})).then((r=>{const a=this.response;if(!a)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);const l=r[n];l&&(s.loaded=s.total=l);const d={url:a.url,data:r,code:a.status};o&&!_c(t.highWaterMark)&&o(s,e,r,a),i.onSuccess(d,s,e,a)})).catch((t=>{if(self.clearTimeout(this.requestTimeout),s.aborted)return;const r=t&&t.code||0,o=t?t.message:null;i.onError({code:r,text:o},e,t?t.details:null,s)}))}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,s=0,r){const o=new Cm,a=e.body.getReader(),n=()=>a.read().then((a=>{if(a.done)return o.dataLength&&r(t,i,o.flush(),e),Promise.resolve(new ArrayBuffer(0));const l=a.value,d=l.length;return t.loaded+=d,d=s&&r(t,i,o.flush(),e)):r(t,i,l,e),n()})).catch((()=>Promise.reject()));return n()}}function bA(e,t){return new self.Request(e.url,t)}class vA extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const _A=/\s/,SA={newCue(e,t,i,s){const r=[];let o,a,n,l,d;const h=self.VTTCue||self.TextTrackCue;for(let u=0;u=16?l--:l++;const s=my(d.trim()),p=vy(t,i,s);null!=e&&null!=(c=e.cues)&&c.getCueById(p)||(a=new h(t,i,s),a.id=p,a.line=u+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*l/32)),r.push(a))}return e&&r.length&&(r.sort(((e,t)=>"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line)),r.forEach((t=>Op(e,t)))),r}},EA=yc(yc({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:gA,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:e,partCurrent:t,hls:i}=this,{autoLevelEnabled:s,media:r}=i;if(!e||!r)return;const o=performance.now(),a=t?t.stats:e.stats,n=t?t.duration:e.duration,l=o-a.loading.start,d=i.minAutoLevel;if(a.aborted||a.loaded&&a.loaded===a.total||e.level<=d)return this.clearTimer(),void(this._nextAutoLevel=-1);if(!s||r.paused||!r.playbackRate||!r.readyState)return;const h=i.mainForwardBufferInfo;if(null===h)return;const c=this.bwEstimator.getEstimateTTFB(),u=Math.abs(r.playbackRate);if(l<=Math.max(c,n/(2*u)*1e3))return;const p=h.len/u,f=a.loading.first?a.loading.first-a.loading.start:-1,m=a.loaded&&f>-1,g=this.getBwEstimate(),y=i.levels,A=y[e.level],b=a.total||Math.max(a.loaded,Math.round(n*A.averageBitrate/8));let v=m?l-f:l;v<1&&m&&(v=Math.min(l,8*a.loaded/g));const _=m?1e3*a.loaded/v:0,S=_?(b-a.loaded)/_:8*b/g+c/1e3;if(S<=p)return;const E=_?8*_:g;let w,T=Number.POSITIVE_INFINITY;for(w=e.level-1;w>d;w--){const e=y[w].maxBitrate;if(T=this.getTimeToLoadFrag(c/1e3,E,n*e,!y[w].details),T=S)return;if(T>10*n)return;i.nextLoadLevel=i.nextAutoLevel=w,m?this.bwEstimator.sample(l-Math.min(c,f),a.loaded):this.bwEstimator.sampleTTFB(l);const k=y[w].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>k&&this.resetEstimator(k),this.clearTimer(),Rc.warn(`[abr] Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} is loading too slowly;\n Time to underbuffer: ${p.toFixed(3)} s\n Estimated load time for current fragment: ${S.toFixed(3)} s\n Estimated load time for down switch fragment: ${T.toFixed(3)} s\n TTFB estimate: ${0|f} ms\n Current BW estimate: ${_c(g)?0|g:"Unknown"} bps\n New BW estimate: ${0|this.getBwEstimate()} bps\n Switching to level ${w} @ ${0|k} bps`),i.trigger(wc.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:a})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(Rc.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new Bf(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wc.FRAG_LOADING,this.onFragLoading,this),e.on(wc.FRAG_LOADED,this.onFragLoaded,this),e.on(wc.FRAG_BUFFERED,this.onFragBuffered,this),e.on(wc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(wc.LEVEL_LOADED,this.onLevelLoaded,this),e.on(wc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(wc.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(wc.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wc.FRAG_LOADING,this.onFragLoading,this),e.off(wc.FRAG_LOADED,this.onFragLoaded,this),e.off(wc.FRAG_BUFFERED,this.onFragBuffered,this),e.off(wc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(wc.LEVEL_LOADED,this.onLevelLoaded,this),e.off(wc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(wc.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(wc.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){var s;if(!i.bitrateTest)this.fragCurrent=i,this.partCurrent=null!=(s=t.part)?s:null;this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case kc.BUFFER_ADD_CODEC_ERROR:case kc.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case kc.FRAG_LOAD_TIMEOUT:{const e=t.frag,{fragCurrent:i,partCurrent:s}=this;if(e&&i&&e.sn===i.sn&&e.level===i.level){const t=performance.now(),i=s?s.stats:e.stats,r=t-i.loading.start,o=i.loading.first?i.loading.first-i.loading.start:-1;if(i.loaded&&o>-1){const e=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(r-Math.min(e,o),i.loaded)}else this.bwEstimator.sampleTTFB(r)}break}}}getTimeToLoadFrag(e,t,i,s){return e+i/t+(s?this.lastLevelLoadSec:0)}onLevelLoaded(e,t){const i=this.hls.config,{loading:s}=t.stats,r=s.end-s.start;_c(r)&&(this.lastLevelLoadSec=r/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:i}){const s=i?i.stats:t.stats;if(t.type===Rp&&this.bwEstimator.sampleTTFB(s.loading.first-s.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const e=i?i.duration:t.duration,r=this.hls.levels[t.level],o=(r.loaded?r.loaded.bytes:0)+s.loaded,a=(r.loaded?r.loaded.duration:0)+e;r.loaded={bytes:o,duration:a},r.realBitrate=Math.round(8*o/a)}if(t.bitrateTest){const e={stats:s,frag:t,part:i,id:t.type};this.onFragBuffered(wc.FRAG_BUFFERED,e),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:s}=t,r=null!=s&&s.stats.loaded?s.stats:i.stats;if(r.aborted)return;if(this.ignoreFragment(i))return;const o=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,r.loaded),r.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Rp||"initSegment"===e.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),s=this.hls.config.maxStarvationDelay,r=this.findBestLevel(i,t,e,0,s,1,1);if(r>-1)return r;const o=this.hls.firstLevel,a=Math.min(Math.max(o,t),e);return Rc.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${o} clamped to ${a}`),a}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(!(-1===e||t&&i&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return e;const s=t&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){const t=this.hls.levels;if(t.length>Math.max(e,s)&&t[e].loadError<=t[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this,{maxAutoLevel:s,config:r,minAutoLevel:o}=i,a=t?t.duration:e?e.duration:0,n=this.getBwEstimate(),l=this.getStarvationDelay();let d=r.abrBandWidthFactor,h=r.abrBandWidthUpFactor;if(l){const e=this.findBestLevel(n,o,s,l,0,d,h);if(e>=0)return e}let c=a?Math.min(a,r.maxStarvationDelay):r.maxStarvationDelay;if(!l){const e=this.bitrateTestDelay;if(e){c=(a?Math.min(a,r.maxLoadingDelay):r.maxLoadingDelay)-e,Rc.info(`[abr] bitrate test took ${Math.round(1e3*e)}ms, set first fragment max fetchDuration to ${Math.round(1e3*c)} ms`),d=h=1}}const u=this.findBestLevel(n,o,s,l,c,d,h);if(Rc.info(`[abr] ${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${u}`),u>-1)return u;const p=i.levels[o],f=i.levels[i.loadLevel];return(null==p?void 0:p.bitrate)<(null==f?void 0:f.bitrate)?o:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,s=e.mainForwardBufferInfo;return(s?s.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,s,r,o,a){var n;const l=s+r,d=this.lastLoadedFragLevel,h=-1===d?this.hls.firstLevel:d,{fragCurrent:c,partCurrent:u}=this,{levels:p,allAudioTracks:f,loadLevel:m,config:g}=this.hls;if(1===p.length)return 0;const y=p[h],A=!(null==y||null==(n=y.details)||!n.live),b=-1===m||-1===d;let v,_="SDR",S=(null==y?void 0:y.frameRate)||0;const{audioPreference:E,videoPreference:w}=g,T=this.audioTracksByGroup||(this.audioTracksByGroup=function(e){return e.reduce(((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const s=t.channels||"2";return i.channels[s]=(i.channels[s]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}(f));if(b){if(-1!==this.firstSelection)return this.firstSelection;const s=this.codecTiers||(this.codecTiers=function(e,t,i,s){return e.slice(i,s+1).reduce(((e,i)=>{if(!i.codecSet)return e;const s=i.audioGroups;let r=e[i.codecSet];r||(e[i.codecSet]=r={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!s,fragmentError:0}),r.minBitrate=Math.min(r.minBitrate,i.bitrate);const o=Math.min(i.height,i.width);return r.minHeight=Math.min(r.minHeight,o),r.minFramerate=Math.min(r.minFramerate,i.frameRate),r.maxScore=Math.max(r.maxScore,i.score),r.fragmentError+=i.fragmentError,r.videoRanges[i.videoRange]=(r.videoRanges[i.videoRange]||0)+1,s&&s.forEach((e=>{if(!e)return;const i=t.groups[e];i&&(r.hasDefaultAudio=r.hasDefaultAudio||t.hasDefaultAudio?i.hasDefault:i.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(i.channels).forEach((e=>{r.channels[e]=(r.channels[e]||0)+i.channels[e]})))})),e}),{})}(p,T,t,i)),r=function(e,t,i,s,r){const o=Object.keys(e),a=null==s?void 0:s.channels,n=null==s?void 0:s.audioCodec,l=a&&2===parseInt(a);let d=!0,h=!1,c=1/0,u=1/0,p=1/0,f=0,m=[];const{preferHDR:g,allowedVideoRanges:y}=Of(t,r);for(let t=o.length;t--;){const i=e[o[t]];d=i.channels[2]>0,c=Math.min(c,i.minHeight),u=Math.min(u,i.minFramerate),p=Math.min(p,i.minBitrate);const s=y.filter((e=>i.videoRanges[e]>0));s.length>0&&(h=!0,m=s)}c=_c(c)?c:0,u=_c(u)?u:0;const A=Math.max(1080,c),b=Math.max(30,u);p=_c(p)?p:i,i=Math.max(p,i),h||(t=void 0,m=[]);const v=o.reduce(((t,s)=>{const r=e[s];if(s===t)return t;if(r.minBitrate>i)return Nf(s,`min bitrate of ${r.minBitrate} > current estimate of ${i}`),t;if(!r.hasDefaultAudio)return Nf(s,"no renditions with default or auto-select sound found"),t;if(n&&s.indexOf(n.substring(0,4))%5!=0)return Nf(s,`audio codec preference "${n}" not found`),t;if(a&&!l){if(!r.channels[a])return Nf(s,`no renditions with ${a} channel sound found (channels options: ${Object.keys(r.channels)})`),t}else if((!n||l)&&d&&0===r.channels[2])return Nf(s,"no renditions with stereo sound found"),t;return r.minHeight>A?(Nf(s,`min resolution of ${r.minHeight} > maximum of ${A}`),t):r.minFramerate>b?(Nf(s,`min framerate of ${r.minFramerate} > maximum of ${b}`),t):m.some((e=>r.videoRanges[e]>0))?r.maxScore=dp(t)||r.fragmentError>e[t].fragmentError)?t:(f=r.maxScore,s):(Nf(s,`no variants with VIDEO-RANGE of ${JSON.stringify(m)} found`),t)}),void 0);return{codecSet:v,videoRanges:m,preferHDR:g,minFramerate:u,minBitrate:p}}(s,_,e,E,w),{codecSet:o,videoRanges:a,minFramerate:n,minBitrate:l,preferHDR:d}=r;v=o,_=d?a[a.length-1]:a[0],S=n,e=Math.max(e,l),Rc.log(`[abr] picked start tier ${JSON.stringify(r)}`)}else v=null==y?void 0:y.codecSet,_=null==y?void 0:y.videoRange;const k=u?u.duration:c?c.duration:0,L=this.bwEstimator.getEstimateTTFB()/1e3,C=[];for(let n=i;n>=t;n--){var D;const t=p[n],c=n>h;if(!t)continue;if(g.useMediaCapabilities&&!t.supportedResult&&!t.supportedPromise){const i=navigator.mediaCapabilities;"function"==typeof(null==i?void 0:i.decodingInfo)&&Ff(t,T,_,S,e,E)?(t.supportedPromise=Uf(t,T,i),t.supportedPromise.then((e=>{if(!this.hls)return;t.supportedResult=e;const i=this.hls.levels,s=i.indexOf(t);e.error?Rc.warn(`[abr] MediaCapabilities decodingInfo error: "${e.error}" for level ${s} ${JSON.stringify(e)}`):e.supported||(Rc.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${s} ${JSON.stringify(e)}`),s>-1&&i.length>1&&(Rc.log(`[abr] Removing unsupported level ${s}`),this.hls.removeLevel(s)))}))):t.supportedResult=If}if(v&&t.codecSet!==v||_&&t.videoRange!==_||c&&S>t.frameRate||!c&&S>0&&S=2*k&&0===r?p[n].averageBitrate:p[n].maxBitrate,P=this.getTimeToLoadFrag(L,x,R*w,void 0===f);if(x>=R&&(n===d||0===t.loadError&&0===t.fragmentError)&&(P<=L||!_c(P)||A&&!this.bitrateTestDelay||P${n} adjustedbw(${Math.round(x)})-bitrate=${Math.round(x-R)} ttfb:${L.toFixed(1)} avgDuration:${w.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${P.toFixed(1)} firstSelection:${b} codecSet:${v} videoRange:${_} hls.loadLevel:${m}`)),b&&(this.firstSelection=n),n}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls,s=Math.min(Math.max(e,i),t);this._nextAutoLevel!==s&&(this.nextAutoLevelKey="",this._nextAutoLevel=s)}},bufferController:class{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=e=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=e=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:e,mediaSource:t}=this;this.log("Media source opened"),e&&(e.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(wc.MEDIA_ATTACHED,{media:e,mediaSource:t})),t&&t.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:e,_objectUrl:t}=this;e!==t&&Rc.error(`Media element src was set while attaching MediaSource (${t} > ${e})`)},this.hls=e;const t="[buffer-controller]";var i;this.appendSource=(i=sp(e.config.preferManagedMediaSource),"undefined"!=typeof self&&i===self.ManagedMediaSource),this.log=Rc.log.bind(Rc,t),this.warn=Rc.warn.bind(Rc,t),this.error=Rc.error.bind(Rc,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(wc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(wc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(wc.BUFFER_RESET,this.onBufferReset,this),e.on(wc.BUFFER_APPENDING,this.onBufferAppending,this),e.on(wc.BUFFER_CODECS,this.onBufferCodecs,this),e.on(wc.BUFFER_EOS,this.onBufferEos,this),e.on(wc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(wc.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(wc.FRAG_PARSED,this.onFragParsed,this),e.on(wc.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(wc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(wc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(wc.BUFFER_RESET,this.onBufferReset,this),e.off(wc.BUFFER_APPENDING,this.onBufferAppending,this),e.off(wc.BUFFER_CODECS,this.onBufferCodecs,this),e.off(wc.BUFFER_EOS,this.onBufferEos,this),e.off(wc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(wc.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(wc.FRAG_PARSED,this.onFragParsed,this),e.off(wc.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new Og(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const i=this.media=t.media,s=sp(this.appendSource);if(i&&s){var r;const e=this.mediaSource=new s;this.log(`created media source: ${null==(r=e.constructor)?void 0:r.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming));const t=this._objectUrl=self.URL.createObjectURL(e);if(this.appendSource)try{i.removeAttribute("src");const s=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||s&&e instanceof s,jg(i),function(e,t){const i=self.document.createElement("source");i.type="video/mp4",i.src=t,e.appendChild(i)}(i,t),i.load()}catch(e){i.src=t}else i.src=t;i.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:i}=this;if(t){if(this.log("media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){this.warn(`onMediaDetaching: ${e.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),this.mediaSrc===i?(e.removeAttribute("src"),this.appendSource&&jg(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(wc.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach((e=>{this.resetBuffer(e)})),this._initSourceBuffer()}resetBuffer(e){const t=this.sourceBuffer[e];try{var i;if(t)this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,null!=(i=this.mediaSource)&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}catch(t){this.warn(`onBufferReset ${e}`,t)}}onBufferCodecs(e,t){const i=this.getSourceBufferTypes().length,s=Object.keys(t);if(s.forEach((e=>{if(i){const i=this.tracks[e];if(i&&"function"==typeof i.buffer.changeType){var s;const{id:r,codec:o,levelCodec:a,container:n,metadata:l}=t[e],d=pp(i.codec,i.levelCodec),h=null==d?void 0:d.replace(Ng,"$1");let c=pp(o,a);const u=null==(s=c)?void 0:s.replace(Ng,"$1");if(c&&h!==u){"audio"===e.slice(0,5)&&(c=up(c,this.appendSource));const t=`${n};codecs=${c}`;this.appendChangeType(e,t),this.log(`switching codec ${d} to ${c}`),this.tracks[e]={buffer:i.buffer,codec:o,container:n,levelCodec:a,metadata:l,id:r}}}}else this.pendingTracks[e]=t[e]})),i)return;const r=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==r&&(this.log(`${r} bufferCodec event(s) expected ${s.join(",")}`),this.bufferCodecEventsExpected=r),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:i}=this,s={execute:()=>{const s=this.sourceBuffer[e];s&&(this.log(`changing ${e} sourceBuffer type to ${t}`),s.changeType(t)),i.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:t=>{this.warn(`Failed to change ${e} SourceBuffer type`,t)}};i.append(s,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:i,operationQueue:s,tracks:r}=this,{data:o,type:a,frag:n,part:l,chunkMeta:d}=t,h=d.buffering[a],c=self.performance.now();h.start=c;const u=n.stats.buffering,p=l?l.stats.buffering:null;0===u.start&&(u.start=c),p&&0===p.start&&(p.start=c);const f=r.audio;let m=!1;"audio"===a&&"audio/mpeg"===(null==f?void 0:f.container)&&(m=!this.lastMpegAudioChunk||1===d.id||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const g=n.start,y={execute:()=>{if(h.executeStart=self.performance.now(),m){const e=this.sourceBuffer[a];if(e){const t=g-e.timestampOffset;Math.abs(t)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${g} (delta: ${t}) sn: ${n.sn})`),e.timestampOffset=g)}}this.appendExecutor(o,a)},onStart:()=>{},onComplete:()=>{const e=self.performance.now();h.executeEnd=h.end=e,0===u.first&&(u.first=e),p&&0===p.first&&(p.first=e);const{sourceBuffer:t}=this,i={};for(const e in t)i[e]=Xf.getBuffered(t[e]);this.appendErrors[a]=0,"audio"===a||"video"===a?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(wc.BUFFER_APPENDED,{type:a,frag:n,part:l,chunkMeta:d,parent:n.type,timeRanges:i})},onError:e=>{const t={type:Tc.MEDIA_ERROR,parent:n.type,details:kc.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:n,part:l,chunkMeta:d,error:e,err:e,fatal:!1};if(e.code===DOMException.QUOTA_EXCEEDED_ERR)t.details=kc.BUFFER_FULL_ERROR;else{const e=++this.appendErrors[a];t.details=kc.BUFFER_APPEND_ERROR,this.warn(`Failed ${e}/${i.config.appendErrorMaxRetry} times to append segment in "${a}" sourceBuffer`),e>=i.config.appendErrorMaxRetry&&(t.fatal=!0)}i.trigger(wc.ERROR,t)}};s.append(y,a,!!this.pendingTracks[a])}onBufferFlushing(e,t){const{operationQueue:i}=this,s=e=>({execute:this.removeExecutor.bind(this,e,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(wc.BUFFER_FLUSHED,{type:e})},onError:t=>{this.warn(`Failed to remove from ${e} SourceBuffer`,t)}});t.type?i.append(s(t.type),t.type):this.getSourceBufferTypes().forEach((e=>{i.append(s(e),e)}))}onFragParsed(e,t){const{frag:i,part:s}=t,r=[],o=s?s.elementaryStreams:i.elementaryStreams;o[jc]?r.push("audiovideo"):(o[Oc]&&r.push("audio"),o[Nc]&&r.push("video"));0===r.length&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers((()=>{const e=self.performance.now();i.stats.buffering.end=e,s&&(s.stats.buffering.end=e);const t=s?s.stats:i.stats;this.hls.trigger(wc.FRAG_BUFFERED,{frag:i,part:s,stats:t,id:i.type})}),r)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce(((e,i)=>{const s=this.sourceBuffer[i];return!s||t.type&&t.type!==i||(s.ending=!0,s.ended||(s.ended=!0,this.log(`${i} sourceBuffer now EOS`))),e&&!(s&&!s.ended)}),!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers((()=>{this.getSourceBufferTypes().forEach((e=>{const t=this.sourceBuffer[e];t&&(t.ending=!1)}));const{mediaSource:e}=this;e&&"open"===e.readyState?(this.log("Calling mediaSource.endOfStream()"),e.endOfStream()):e&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${e.readyState}`)})))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||null===t)return;if(!this.getSourceBufferTypes().length)return;const s=e.config,r=i.currentTime,o=t.levelTargetDuration,a=t.live&&null!==s.liveBackBufferLength?s.liveBackBufferLength:s.backBufferLength;if(_c(a)&&a>0){const e=Math.max(a,o),t=Math.floor(r/o)*o-e;this.flushBackBuffer(r,o,t)}if(_c(s.frontBufferFlushThreshold)&&s.frontBufferFlushThreshold>0){const e=Math.max(s.maxBufferLength,s.frontBufferFlushThreshold),t=Math.max(e,o),i=Math.floor(r/o)*o+t;this.flushFrontBuffer(r,o,i)}}flushBackBuffer(e,t,i){const{details:s,sourceBuffer:r}=this;this.getSourceBufferTypes().forEach((o=>{const a=r[o];if(a){const r=Xf.getBuffered(a);if(r.length>0&&i>r.start(0)){if(this.hls.trigger(wc.BACK_BUFFER_REACHED,{bufferEnd:i}),null!=s&&s.live)this.hls.trigger(wc.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(a.ended&&r.end(r.length-1)-e<2*t)return void this.log(`Cannot flush ${o} back buffer while SourceBuffer is in ended state`);this.hls.trigger(wc.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:o})}}}))}flushFrontBuffer(e,t,i){const{sourceBuffer:s}=this;this.getSourceBufferTypes().forEach((r=>{const o=s[r];if(o){const s=Xf.getBuffered(o),a=s.length;if(a<2)return;const n=s.start(a-1),l=s.end(a-1);if(i>n||e>=n&&e<=l)return;if(o.ended&&e-l<2*t)return void this.log(`Cannot flush ${r} front buffer while SourceBuffer is in ended state`);this.hls.trigger(wc.BUFFER_FLUSHING,{startOffset:n,endOffset:1/0,type:r})}}))}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||"open"!==this.mediaSource.readyState)return;const{details:e,hls:t,media:i,mediaSource:s}=this,r=e.fragments[0].start+e.totalduration,o=i.duration,a=_c(s.duration)?s.duration:0;e.live&&t.config.liveDurationInfinity?(s.duration=1/0,this.updateSeekableRange(e)):(r>a&&r>o||!_c(o))&&(this.log(`Updating Media Source duration to ${r.toFixed(3)}`),s.duration=r)}updateSeekableRange(e){const t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&null!=t&&t.setLiveSeekableRange){const s=Math.max(0,i[0].start),r=Math.max(s,s+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${s}-${r}.`),t.setLiveSeekableRange(s,r)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:i}=this,s=Object.keys(i).length;if(s&&(!e||2===s||"audiovideo"in i)){this.createSourceBuffers(i),this.pendingTracks={};const e=this.getSourceBufferTypes();if(e.length)this.hls.trigger(wc.BUFFER_CREATED,{tracks:this.tracks}),e.forEach((e=>{t.executeNext(e)}));else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(wc.ERROR,{type:Tc.MEDIA_ERROR,details:kc.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(const r in e)if(!t[r]){var s;const o=e[r];if(!o)throw Error(`source buffer exists for track ${r}, however track does not`);let a=-1===(null==(s=o.levelCodec)?void 0:s.indexOf(","))?o.levelCodec:o.codec;a&&"audio"===r.slice(0,5)&&(a=up(a,this.appendSource));const n=`${o.container};codecs=${a}`;this.log(`creating sourceBuffer(${n})`);try{const e=t[r]=i.addSourceBuffer(n),s=r;this.addBufferListener(s,"updatestart",this._onSBUpdateStart),this.addBufferListener(s,"updateend",this._onSBUpdateEnd),this.addBufferListener(s,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(s,"bufferedchange",((e,t)=>{const i=t.removedRanges;null!=i&&i.length&&this.hls.trigger(wc.BUFFER_FLUSHED,{type:r})})),this.tracks[r]={buffer:e,codec:a,container:o.container,levelCodec:o.levelCodec,metadata:o.metadata,id:o.id}}catch(e){this.error(`error while trying to add sourceBuffer: ${e.message}`),this.hls.trigger(wc.ERROR,{type:Tc.MEDIA_ERROR,details:kc.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:r,mimeType:n})}}}get mediaSrc(){var e;const t=(null==(e=this.media)?void 0:e.firstChild)||this.media;return null==t?void 0:t.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if("closed"===(null==(t=this.mediaSource)?void 0:t.readyState))return void this.resetBuffer(e);const{operationQueue:i}=this;i.current(e).onComplete(),i.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var i;const s=new Error(`${e} SourceBuffer error. MediaSource readyState: ${null==(i=this.mediaSource)?void 0:i.readyState}`);this.error(`${s}`,t),this.hls.trigger(wc.ERROR,{type:Tc.MEDIA_ERROR,details:kc.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:s,fatal:!1});const r=this.operationQueue.current(e);r&&r.onError(s)}removeExecutor(e,t,i){const{media:s,mediaSource:r,operationQueue:o,sourceBuffer:a}=this,n=a[e];if(!s||!r||!n)return this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),void o.shiftAndExecuteNext(e);const l=_c(s.duration)?s.duration:1/0,d=_c(r.duration)?r.duration:1/0,h=Math.max(0,t),c=Math.min(i,l,d);c>h&&(!n.ending||n.ended)?(n.ended=!1,this.log(`Removing [${h},${c}] from the ${e} SourceBuffer`),n.remove(h,c)):o.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.sourceBuffer[t];if(i)i.ended=!1,i.appendBuffer(e);else if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);const{operationQueue:i}=this,s=t.map((e=>i.appendBlocker(e)));Promise.all(s).then((()=>{e(),t.forEach((e=>{const t=this.sourceBuffer[e];null!=t&&t.updating||i.shiftAndExecuteNext(e)}))}))}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,i){const s=this.sourceBuffer[e];if(!s)return;const r=i.bind(this,e);this.listeners[e].push({event:t,listener:r}),s.addEventListener(t,r)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach((e=>{t.removeEventListener(e.event,e.listener)}))}},capLevelController:My,errorController:class{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=Rc.log.bind(Rc,"[info]:"),this.warn=Rc.warn.bind(Rc,"[warning]:"),this.error=Rc.error.bind(Rc,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(wc.ERROR,this.onError,this),e.on(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wc.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(wc.ERROR,this.onError,this),e.off(wc.ERROR,this.onErrorOut,this),e.off(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wc.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(null==e?void 0:e.type)===Rp?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var i,s;if(t.fatal)return;const r=this.hls,o=t.context;switch(t.details){case kc.FRAG_LOAD_ERROR:case kc.FRAG_LOAD_TIMEOUT:case kc.KEY_LOAD_ERROR:case kc.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case kc.FRAG_PARSING_ERROR:if(null!=(i=t.frag)&&i.gap)return void(t.errorAction={action:wf,flags:Cf});case kc.FRAG_GAP:case kc.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=Tf);case kc.LEVEL_EMPTY_ERROR:case kc.LEVEL_PARSING_ERROR:{var a,n;const e=t.parent===Rp?t.level:r.loadLevel;t.details===kc.LEVEL_EMPTY_ERROR&&null!=(a=t.context)&&null!=(n=a.levelDetails)&&n.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,e):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e))}return;case kc.LEVEL_LOAD_ERROR:case kc.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==o?void 0:o.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level)));case kc.AUDIO_TRACK_LOAD_ERROR:case kc.AUDIO_TRACK_LOAD_TIMEOUT:case kc.SUBTITLE_LOAD_ERROR:case kc.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){const e=r.levels[r.loadLevel];if(e&&(o.type===Dp&&e.hasAudioGroup(o.groupId)||o.type===xp&&e.hasSubtitleGroup(o.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=Tf,void(t.errorAction.flags=Df)}return;case kc.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const e=r.levels[r.loadLevel],i=null==e?void 0:e.attrs["HDCP-LEVEL"];i?t.errorAction={action:Tf,flags:xf,hdcpLevel:i}:this.keySystemError(t)}return;case kc.BUFFER_ADD_CODEC_ERROR:case kc.REMUX_ALLOC_ERROR:case kc.BUFFER_APPEND_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,null!=(s=t.level)?s:r.loadLevel));case kc.INTERNAL_EXCEPTION:case kc.BUFFER_APPENDING_ERROR:case kc.BUFFER_FULL_ERROR:case kc.LEVEL_SWITCH_ERROR:case kc.BUFFER_STALLED_ERROR:case kc.BUFFER_SEEK_OVER_HOLE:case kc.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:wf,flags:Cf})}t.type===Tc.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const i=gf(this.hls.config.playlistLoadPolicy,e),s=this.playlistError++;if(bf(i,s,mf(e),e.response))return{action:Lf,flags:Cf,retryConfig:i,retryCount:s};const r=this.getLevelSwitchAction(e,t);return i&&(r.retryConfig=i,r.retryCount=s),r}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),s=t.levels[i],{fragLoadPolicy:r,keyLoadPolicy:o}=t.config,a=gf(e.details.startsWith("key")?o:r,e),n=t.levels.reduce(((e,t)=>e+t.fragmentError),0);if(s){e.details!==kc.FRAG_GAP&&s.fragmentError++;if(bf(a,n,mf(e),e.response))return{action:Lf,flags:Cf,retryConfig:a,retryCount:n}}const l=this.getLevelSwitchAction(e,i);return a&&(l.retryConfig=a,l.retryCount=n),l}getLevelSwitchAction(e,t){const i=this.hls;null==t&&(t=i.loadLevel);const s=this.hls.levels[t];if(s){var r,o;const t=e.details;s.loadError++,t===kc.BUFFER_APPEND_ERROR&&s.fragmentError++;let l=-1;const{levels:d,loadLevel:h,minAutoLevel:c,maxAutoLevel:u}=i;i.autoLevelEnabled||(i.loadLevel=-1);const p=null==(r=e.frag)?void 0:r.type,f=(p===Pp&&t===kc.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(t===kc.BUFFER_ADD_CODEC_ERROR||t===kc.BUFFER_APPEND_ERROR))&&d.some((({audioCodec:e})=>s.audioCodec!==e)),m="video"===e.sourceBufferName&&(t===kc.BUFFER_ADD_CODEC_ERROR||t===kc.BUFFER_APPEND_ERROR)&&d.some((({codecSet:e,audioCodec:t})=>s.codecSet!==e&&s.audioCodec===t)),{type:g,groupId:y}=null!=(o=e.context)?o:{};for(let i=d.length;i--;){const r=(i+h)%d.length;if(r!==h&&r>=c&&r<=u&&0===d[r].loadError){var a,n;const i=d[r];if(t===kc.FRAG_GAP&&p===Rp&&e.frag){const t=d[r].details;if(t){const i=_f(e.frag,t.fragments,e.frag.start);if(null!=i&&i.gap)continue}}else{if(g===Dp&&i.hasAudioGroup(y)||g===xp&&i.hasSubtitleGroup(y))continue;if(p===Pp&&null!=(a=s.audioGroups)&&a.some((e=>i.hasAudioGroup(e)))||p===Bp&&null!=(n=s.subtitleGroups)&&n.some((e=>i.hasSubtitleGroup(e)))||f&&s.audioCodec===i.audioCodec||!f&&s.audioCodec!==i.audioCodec||m&&s.codecSet===i.codecSet)continue}l=r;break}}if(l>-1&&i.loadLevel!==l)return e.levelRetry=!0,this.playlistError=0,{action:Tf,flags:Cf,nextAutoLevel:l}}return{action:Tf,flags:Df}}onErrorOut(e,t){var i;switch(null==(i=t.errorAction)?void 0:i.action){case wf:break;case Tf:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===kc.FRAG_GAP?/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError()):t.fatal=!0}t.fatal&&this.hls.stopLoad()}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:s,hdcpLevel:r,nextAutoLevel:o}=i;switch(s){case Cf:this.switchLevel(e,o);break;case xf:r&&(t.maxHdcpLevel=Qp[Qp.indexOf(r)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`)}i.resolved||this.switchLevel(e,o)}switchLevel(e,t){void 0!==t&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}},fpsController:class{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(wc.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(wc.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const e=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=e,e&&"function"==typeof e.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,i){const s=performance.now();if(t){if(this.lastTime){const e=s-this.lastTime,r=i-this.lastDroppedFrames,o=t-this.lastDecodedFrames,a=1e3*r/e,n=this.hls;if(n.trigger(wc.FPS_DROP,{currentDropped:r,currentDecoded:o,totalDroppedFrames:i}),a>0&&r>n.config.fpsDroppedMonitoringThreshold*o){let e=n.currentLevel;Rc.warn("drop FPS ratio greater than max allowed value for currentLevel: "+e),e>0&&(-1===n.autoLevelCapping||n.autoLevelCapping>=e)&&(e-=1,n.trigger(wc.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:n.currentLevel}),n.autoLevelCapping=e,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}},stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:ru,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:SA,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:class extends Lm{constructor(e,t,i){super(e,t,i,"[subtitle-stream-controller]",Bp),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(wc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(wc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wc.LEVEL_LOADED,this.onLevelLoaded,this),e.on(wc.ERROR,this.onError,this),e.on(wc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(wc.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(wc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(wc.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(wc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(wc.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(wc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(wc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wc.LEVEL_LOADED,this.onLevelLoaded,this),e.off(wc.ERROR,this.onError,this),e.off(wc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(wc.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(wc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(wc.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(wc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(wc.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=gm,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:s}=t;if(this.fragPrevious=i,this.state=gm,!s)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let o;const a=i.start;for(let e=0;e=r[e].start&&a<=r[e].end){o=r[e];break}const n=i.start+i.duration;o?o.end=n:(o={start:a,end:n},r.push(o)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null)}onBufferFlushing(e,t){const{startOffset:i,endOffset:s}=t;if(0===i&&s!==Number.POSITIVE_INFINITY){const e=s-1;if(e<=0)return;t.endOffsetSubtitles=Math.max(0,e),this.tracksBuffered.forEach((t=>{for(let i=0;inew of(e))):(this.tracksBuffered=[],this.levels=t.map((e=>{const t=new of(e);return this.tracksBuffered[t.id]=[],t})),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Bp),this.fragPrevious=null,this.mediaBuffer=null)}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,null==(i=this.levels)||!i.length||-1===this.currentTrackId)return void this.clearInterval();const s=this.levels[this.currentTrackId];null!=s&&s.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,s&&this.setInterval(500)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:s,levels:r}=this,{details:o,id:a}=t;if(!r)return void this.warn(`Subtitle tracks were reset while loading level ${a}`);const n=r[a];if(a>=r.length||!n)return;this.log(`Subtitle track ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""},duration:${o.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(o.live||null!=(i=n.details)&&i.live){const e=this.mainDetails;if(o.deltaUpdateFailed||!e)return;const t=e.fragments[0];var d;if(n.details)l=this.alignPlaylists(o,n.details,null==(d=this.levelLastLoaded)?void 0:d.details),0===l&&t&&(l=t.start,cf(o,l));else o.hasProgramDateTime&&e.hasProgramDateTime?(rm(o,e),l=o.fragments[0].start):t&&(l=t.start,cf(o,l))}if(n.details=o,this.levelLastLoaded=n,a===s&&(this.startFragRequested||!this.mainDetails&&o.live||this.setStartPosition(this.mainDetails||o,l),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===gm)){_f(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),n.details=void 0)}}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,s=t.decryptdata,r=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&null!=s&&s.key&&s.iv&&"AES-128"===s.method){const e=performance.now();this.decrypter.decrypt(new Uint8Array(i),s.key.buffer,s.iv.buffer).catch((e=>{throw r.trigger(wc.ERROR,{type:Tc.MEDIA_ERROR,details:kc.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e})).then((i=>{const s=performance.now();r.trigger(wc.FRAG_DECRYPTED,{frag:t,payload:i,stats:{tstart:e,tdecrypt:s}})})).catch((e=>{this.warn(`${e.name}: ${e.message}`),this.state=gm}))}}doTick(){if(this.media){if(this.state===gm){const{currentTrackId:e,levels:t}=this,i=null==t?void 0:t[e];if(!i||!t.length||!i.details)return;const{config:s}=this,r=this.getLoadPosition(),o=Xf.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,s.maxBufferHole),{end:a,len:n}=o,l=this.getFwdBufferInfo(this.media,Rp),d=i.details;if(n>this.getMaxBufferLength(null==l?void 0:l.len)+d.levelTargetDuration)return;const h=d.fragments,c=h.length,u=d.edge;let p=null;const f=this.fragPrevious;if(au-e?0:e;p=_f(f,h,Math.max(h[0].start,a),t),!p&&f&&f.startthis.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let e=null;const t=Gp(this.media.textTracks);for(let i=0;i-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(wc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(wc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(wc.LEVEL_LOADING,this.onLevelLoading,this),e.on(wc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(wc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(wc.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(wc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(wc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(wc.LEVEL_LOADING,this.onLevelLoading,this),e.off(wc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(wc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(wc.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);Gp(this.media.textTracks).forEach((e=>{Np(e)})),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:s,details:r}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==s)return void this.warn(`Subtitle track with id:${i} and group:${s} not found in active group ${null==o?void 0:o.groupId}`);const a=o.details;o.details=t.details,this.log(`Subtitle track ${i} "${o.name}" lang:${o.lang} group:${s} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,s=this.groupIds;let r=this.currentTrack;if(!i||(null==s?void 0:s.length)!==(null==i?void 0:i.length)||null!=i&&i.some((e=>-1===(null==s?void 0:s.indexOf(e))))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter((e=>!i||-1!==i.indexOf(e.groupId)));if(e.length)this.selectDefaultTrack&&!e.some((e=>e.default))&&(this.selectDefaultTrack=!1),e.forEach(((e,t)=>{e.id=t}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.subtitlePreference;if(!r&&t){this.selectDefaultTrack=!1;const i=jf(t,e);if(i>-1)r=e[i];else{const e=jf(t,this.tracks);r=this.tracks[e]}}let s=this.findTrackId(r);-1===s&&r&&(s=this.findTrackId(null));const o={subtitleTracks:e};this.log(`Updating subtitle tracks, ${e.length} track(s) found in "${null==i?void 0:i.join(",")}" group-id`),this.hls.trigger(wc.SUBTITLE_TRACKS_UPDATED,o),-1!==s&&-1===this.trackId&&this.setSubtitleTrack(s)}else this.shouldReloadPlaylist(r)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let s=0;s-1){const e=this.tracksInGroup[s];return this.setSubtitleTrack(s),e}if(i)return null;{const i=jf(e,t);if(i>-1)return t[i]}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const i=t.id,s=t.groupId;let r=t.url;if(e)try{r=e.addDirectives(r)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}this.log(`Loading subtitle playlist for id ${i}`),this.hls.trigger(wc.SUBTITLE_TRACK_LOADING,{url:r,id:i,groupId:s,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Gp(e.textTracks),i=this.currentTrack;let s;if(i&&(s=t.filter((e=>Fg(i,e)))[0],s||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach((e=>{"disabled"!==e.mode&&e!==s&&(e.mode="disabled")})),s){const e=this.subtitleDisplay?"showing":"hidden";s.mode!==e&&(s.mode=e)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media)return void(this.queuedDefaultTrack=e);if(e<-1||e>=t.length||!_c(e))return void this.warn(`Invalid subtitle track id: ${e}`);this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,s=t[e]||null;if(this.trackId=e,this.currentTrack=s,this.toggleTrackModes(),!s)return void this.hls.trigger(wc.SUBTITLE_TRACK_SWITCH,{id:e});const r=!!s.details&&!s.details.live;if(e===this.trackId&&s===i&&r)return;this.log(`Switching to subtitle-track ${e}`+(s?` "${s.name}" lang:${s.lang} group:${s.groupId}`:""));const{id:o,groupId:a="",name:n,type:l,url:d}=s;this.hls.trigger(wc.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:n,type:l,url:d});const h=this.switchParams(s.url,null==i?void 0:i.details,s.details);this.loadPlaylist(h)}},timelineController:class{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(wc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(wc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wc.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(wc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(wc.FRAG_LOADING,this.onFragLoading,this),e.on(wc.FRAG_LOADED,this.onFragLoaded,this),e.on(wc.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(wc.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(wc.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(wc.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(wc.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(wc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(wc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wc.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(wc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(wc.FRAG_LOADING,this.onFragLoading,this),e.off(wc.FRAG_LOADED,this.onFragLoaded,this),e.off(wc.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(wc.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(wc.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(wc.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(wc.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const e=new ay(this,"textTrack1"),t=new ay(this,"textTrack2"),i=new ay(this,"textTrack3"),s=new ay(this,"textTrack4");this.cea608Parser1=new sy(1,e,t),this.cea608Parser2=new sy(3,i,s)}}addCues(e,t,i,s,r){let o=!1;for(let e=r.length;e--;){const s=r[e],h=(a=s[0],n=s[1],l=t,d=i,Math.min(n,d)-Math.max(a,l));if(h>=0&&(s[0]=Math.min(s[0],t),s[1]=Math.max(s[1],i),o=!0,h/(i-t)>.5))return}var a,n,l,d;if(o||r.push([t,i]),this.config.renderTextTracksNatively){const r=this.captionsTracks[e];this.Cues.newCue(r,t,i,s)}else{const r=this.Cues.newCue(null,t,i,s);this.hls.trigger(wc.CUES_PARSED,{type:"captions",cues:r,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:s,timescale:r}){const{unparsedVttFrags:o}=this;"main"===i&&(this.initPTS[t.cc]={baseTime:s,timescale:r}),o.length&&(this.unparsedVttFrags=[],o.forEach((e=>{this.onFragLoaded(wc.FRAG_LOADED,e)})))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let s=0;s{Np(e[t]),delete e[t]})),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let e=0;ee.textCodec===Sy));if(this.config.enableWebVTT||s&&this.config.enableIMSC1){if(Ig(this.tracks,i))return void(this.tracks=i);if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const e=this.media,t=e?Gp(e.textTracks):null;if(this.tracks.forEach(((e,i)=>{let s;if(t){let i=null;for(let s=0;snull!==e)).map((e=>e.label));e.length&&Rc.warn(`Media element contains unused subtitle tracks: ${e.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const e=this.tracks.map((e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e})));this.hls.trigger(wc.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach((e=>{const t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;const i=`textTrack${t[1]}`,s=this.captionsProperties[i];s&&(s.label=e.name,e.lang&&(s.languageCode=e.lang),s.media=e)}))}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return null==t?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===Rp){var i,s;const{cea608Parser1:e,cea608Parser2:r,lastSn:o}=this,{cc:a,sn:n}=t.frag,l=null!=(i=null==(s=t.part)?void 0:s.index)?i:-1;e&&r&&(n!==o+1||n===o&&l!==this.lastPartIndex+1||a!==this.lastCc)&&(e.reset(),r.reset()),this.lastCc=a,this.lastSn=n,this.lastPartIndex=l}}onFragLoaded(e,t){const{frag:i,payload:s}=t;if(i.type===Bp)if(s.byteLength){const e=i.decryptdata,r="stats"in t;if(null==e||!e.encrypted||r){const e=this.tracks[i.level],r=this.vttCCs;r[i.cc]||(r[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),e&&e.textCodec===Sy?this._parseIMSC1(i,s):this._parseVTTs(t)}}else this.hls.trigger(wc.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;ky(t,this.initPTS[e.cc],(t=>{this._appendCues(t,e.level),i.trigger(wc.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(t=>{Rc.log(`Failed to parse IMSC1: ${t}`),i.trigger(wc.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})}))}_parseVTTs(e){var t;const{frag:i,payload:s}=e,{initPTS:r,unparsedVttFrags:o}=this,a=r.length-1;if(!r[i.cc]&&-1===a)return void o.push(e);const n=this.hls;_y(null!=(t=i.initSegment)&&t.data?Wu(i.initSegment.data,new Uint8Array(s)):s,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,(e=>{this._appendCues(e,i.level),n.trigger(wc.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})}),(t=>{const r="Missing initPTS for VTT MPEGTS"===t.message;r?o.push(e):this._fallbackToIMSC1(i,s),Rc.log(`Failed to parse VTT cue: ${t}`),r&&a>i.cc||n.trigger(wc.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:t})}))}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||ky(t,this.initPTS[e.cc],(()=>{i.textCodec=Sy,this._parseIMSC1(e,t)}),(()=>{i.textCodec="wvtt"}))}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||"disabled"===i.mode)return;e.forEach((e=>Op(i,e)))}else{const s=this.tracks[t];if(!s)return;const r=s.default?"default":"subtitles"+t;i.trigger(wc.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===Bp&&this.onFragLoaded(wc.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:s}=this;if(!this.enabled||!i||!s)return;const{frag:r,samples:o}=t;if(r.type!==Rp||"NONE"!==this.closedCaptionsForLevel(r))for(let e=0;ejp(e[s],t,i)))}if(this.config.renderTextTracksNatively&&0===t&&void 0!==s){const{textTracks:e}=this;Object.keys(e).forEach((i=>jp(e[i],t,s)))}}}extractCea608Data(e){const t=[[],[]],i=31&e[0];let s=2;for(let r=0;r0&&-1===e?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=gm):(this.loadedmetadata=!1,this.state=vm),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case gm:this.doTickIdle();break;case vm:{var e;const{levels:t,trackId:i}=this,s=null==t||null==(e=t[i])?void 0:e.details;if(s){if(this.waitForCdnTuneIn(s))break;this.state=Tm}break}case bm:{var t;const e=performance.now(),i=this.retryDate;if(!i||e>=i||null!=(t=this.media)&&t.seeking){const{levels:e,trackId:t}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==e?void 0:e[t])||null),this.state=gm}break}case Tm:{const e=this.waitingData;if(e){const{frag:t,part:i,cache:s,complete:r}=e;if(void 0!==this.initPTS[t.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=Am;const e={frag:t,part:i,payload:s.flush(),networkDetails:null};this._handleFragmentLoadProgress(e),r&&super._handleFragmentLoadComplete(e)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${t.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const e=this.getLoadPosition(),i=Xf.bufferInfo(this.mediaBuffer,e,this.config.maxBufferHole);Sf(i.end,this.config.maxFragLookUpTolerance,t)<0&&(this.log(`Waiting fragment cc (${t.cc}) @ ${t.start} cancelled because another fragment at ${i.end} is needed`),this.clearWaitingFragment())}}else this.state=gm}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=gm)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:i,trackId:s}=this,r=e.config;if(!i&&(this.startFragRequested||!r.startFragPrefetch)||null==t||!t[s])return;const o=t[s],a=o.details;if(!a||a.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(a))return void(this.state=vm);const n=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&n&&(this.bufferFlushed=!1,this.afterBufferFlushed(n,Oc,Pp));const l=this.getFwdBufferInfo(n,Pp);if(null===l)return;const{bufferedTrack:d,switchingTrack:h}=this;if(!h&&this._streamEnded(l,a))return e.trigger(wc.BUFFER_EOS,{type:"audio"}),void(this.state=Em);const c=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Rp),u=l.len,p=this.getMaxBufferLength(null==c?void 0:c.len),f=a.fragments,m=f[0].start;let g=this.flushing?this.getLoadPosition():l.end;if(h&&i){const e=this.getLoadPosition();d&&!Mg(h.attrs,d.attrs)&&(g=e),a.PTSKnown&&em||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=m+.05)}if(u>=p&&!h&&gc.end+a.targetduration;if(b||(null==c||!c.len)&&l.len){const e=this.getAppendedFrag(y.start,Rp);if(null===e)return;if(A||(A=!!e.gap||!!b&&0===c.len),b&&!A||A&&l.nextStart&&l.nextStartnew of(e)))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:s}=this;s&&(s.abortRequests(),this.removeUnbufferedFrags(s.start)),this.resetLoadingState(),i?this.setInterval(100):this.resetTransmuxer(),i?(this.switchingTrack=t,this.state=gm,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=mm),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,null!==this.cachedTrackLoadedData&&(this.hls.trigger(wc.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var i;if(null==this.mainDetails)return void(this.cachedTrackLoadedData=t);const{levels:s}=this,{details:r,id:o}=t;if(!s)return void this.warn(`Audio tracks were reset while loading level ${o}`);this.log(`Audio track ${o} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const a=s[o];let n=0;if(r.live||null!=(i=a.details)&&i.live){this.checkLiveUpdate(r);const e=this.mainDetails;if(r.deltaUpdateFailed||!e)return;var l;if(!a.details&&r.hasProgramDateTime&&e.hasProgramDateTime)rm(r,e),n=r.fragments[0].start;else n=this.alignPlaylists(r,a.details,null==(l=this.levelLastLoaded)?void 0:l.details)}a.details=r,this.levelLastLoaded=a,this.startFragRequested||!this.mainDetails&&r.live||this.setStartPosition(this.mainDetails||r,n),this.state!==vm||this.waitForCdnTuneIn(r)||(this.state=gm),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:s,payload:r}=e,{config:o,trackId:a,levels:n}=this;if(!n)return void this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);const l=n[a];if(!l)return void this.warn("Audio track is undefined on fragment load progress");const d=l.details;if(!d)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(i.start);const h=o.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let c=this.transmuxer;c||(c=this.transmuxer=new Bg(this.hls,Pp,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const u=this.initPTS[i.cc],p=null==(t=i.initSegment)?void 0:t.data;if(void 0!==u){const e=!1,t=s?s.index:-1,o=-1!==t,a=new Zf(i.level,i.sn,i.stats.chunkCount,r.byteLength,t,o);c.push(r,p,h,"",i,s,d.totalduration,e,a,u)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${d.startSN} ,${d.endSN}],track ${a}`);const{cache:e}=this.waitingData=this.waitingData||{frag:i,part:s,cache:new Cm,complete:!1};e.push(new Uint8Array(r)),this.waitingVideoCC=this.videoTrackCC,this.state=Tm}}_handleFragmentLoadComplete(e){this.waitingData?this.waitingData.complete=!0:super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:i,part:s}=t;if(i.type===Pp)if(this.fragContextChanged(i))this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);else{if("initSegment"!==i.sn){this.fragPrevious=i;const e=this.switchingTrack;e&&(this.bufferedTrack=e,this.switchingTrack=null,this.hls.trigger(wc.AUDIO_TRACK_SWITCHED,yc({},e)))}this.fragBufferedComplete(i,s)}else if(!this.loadedmetadata&&i.type===Rp){const e=this.videoBuffer||this.media;if(e){Xf.getBuffered(e).length&&(this.loadedmetadata=!0)}}}onError(e,t){var i;if(t.fatal)this.state=wm;else switch(t.details){case kc.FRAG_GAP:case kc.FRAG_PARSING_ERROR:case kc.FRAG_DECRYPT_ERROR:case kc.FRAG_LOAD_ERROR:case kc.FRAG_LOAD_TIMEOUT:case kc.KEY_LOAD_ERROR:case kc.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Pp,t);break;case kc.AUDIO_TRACK_LOAD_ERROR:case kc.AUDIO_TRACK_LOAD_TIMEOUT:case kc.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==vm||(null==(i=t.context)?void 0:i.type)!==Dp||(this.state=gm);break;case kc.BUFFER_APPEND_ERROR:case kc.BUFFER_FULL_ERROR:if(!t.parent||"audio"!==t.parent)return;if(t.details===kc.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case kc.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onBufferFlushing(e,{type:t}){t!==Nc&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Nc){this.flushing=!1,this.bufferFlushed=!0,this.state===Em&&(this.state=gm);const e=this.mediaBuffer||this.media;e&&(this.afterBufferFlushed(e,t,Pp),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:s}=this,{remuxResult:r,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a)return void this.resetWhenMissingContext(o);const{frag:n,part:l,level:d}=a,{details:h}=d,{audio:c,text:u,id3:p,initSegment:f}=r;if(!this.fragContextChanged(n)&&h){if(this.state=_m,this.switchingTrack&&c&&this.completeAudioSwitch(this.switchingTrack),null!=f&&f.tracks){const e=n.initSegment||n;this._bufferInitSegment(d,f.tracks,e,o),s.trigger(wc.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:f.tracks})}if(c){const{startPTS:e,endPTS:t,startDTS:i,endDTS:s}=c;l&&(l.elementaryStreams[Oc]={startPTS:e,endPTS:t,startDTS:i,endDTS:s}),n.setElementaryStreamInfo(Oc,e,t,i,s),this.bufferFragmentData(c,n,l,o)}if(null!=p&&null!=(t=p.samples)&&t.length){const e=vc({id:i,frag:n,details:h},p);s.trigger(wc.FRAG_PARSING_METADATA,e)}if(u){const e=vc({id:i,frag:n,details:h},u);s.trigger(wc.FRAG_PARSING_USERDATA,e)}}else this.fragmentTracker.removeFragment(n)}_bufferInitSegment(e,t,i,s){if(this.state!==_m)return;t.video&&delete t.video;const r=t.audio;if(!r)return;r.id="audio";const o=e.audioCodec;this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${o}/${r.codec}]`),o&&1===o.split(",").length&&(r.levelCodec=o),this.hls.trigger(wc.BUFFER_CODECS,t);const a=r.initSegment;if(null!=a&&a.byteLength){const e={type:"audio",frag:i,part:null,chunkMeta:s,parent:i.type,data:a};this.hls.trigger(wc.BUFFER_APPENDING,e)}this.tickImmediate()}loadFragment(e,t,i){const s=this.fragmentTracker.getState(e);var r;if(this.fragCurrent=e,this.switchingTrack||s===Vf||s===$f)if("initSegment"===e.sn)this._loadInitSegment(e,t);else if(null!=(r=t.details)&&r.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=Tm;const i=this.mainDetails;i&&i.fragments[0].start!==t.details.fragments[0].start&&rm(t.details,i)}else this.startFragRequested=!0,super.loadFragment(e,t,i);else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:i}=this,s=null==i?void 0:i.attrs,r=e.attrs;t&&s&&(s.CHANNELS!==r.CHANNELS||i.name!==e.name||i.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(wc.AUDIO_TRACK_SWITCHED,yc({},e))}},audioTrackController:class extends Rf{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(wc.LEVEL_LOADING,this.onLevelLoading,this),e.on(wc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(wc.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(wc.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(wc.LEVEL_LOADING,this.onLevelLoading,this),e.off(wc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(wc.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(wc.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:s,details:r}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==s)return void this.warn(`Audio track with id:${i} and group:${s} not found in active group ${null==o?void 0:o.groupId}`);const a=o.details;o.details=t.details,this.log(`Audio track ${i} "${o.name}" lang:${o.lang} group:${s} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,s=this.groupIds;let r=this.currentTrack;if(!i||(null==s?void 0:s.length)!==(null==i?void 0:i.length)||null!=i&&i.some((e=>-1===(null==s?void 0:s.indexOf(e))))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter((e=>!i||-1!==i.indexOf(e.groupId)));if(e.length)this.selectDefaultTrack&&!e.some((e=>e.default))&&(this.selectDefaultTrack=!1),e.forEach(((e,t)=>{e.id=t}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.audioPreference;if(!r&&t){const i=jf(t,e,zf);if(i>-1)r=e[i];else{const e=jf(t,this.tracks);r=this.tracks[e]}}let s=this.findTrackId(r);-1===s&&r&&(s=this.findTrackId(null));const a={audioTracks:e};this.log(`Updating audio tracks, ${e.length} track(s) found in group(s): ${null==i?void 0:i.join(",")}`),this.hls.trigger(wc.AUDIO_TRACKS_UPDATED,a);const n=this.trackId;if(-1!==s&&-1===n)this.setAudioTrack(s);else if(e.length&&-1===n){var o;const t=new Error(`No audio track selected for current audio group-ID(s): ${null==(o=this.groupIds)?void 0:o.join(",")} track count: ${e.length}`);this.warn(t.message),this.hls.trigger(wc.ERROR,{type:Tc.MEDIA_ERROR,details:kc.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:t})}}else this.shouldReloadPlaylist(r)&&this.setAudioTrack(this.trackId)}onError(e,t){!t.fatal&&t.context&&(t.context.type!==Dp||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||(this.requestScheduled=-1,this.checkRetry(t)))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const s=this.currentTrack;if(s&&Gf(e,s,zf))return s;const r=jf(e,this.tracksInGroup,zf);if(r>-1){const e=this.tracksInGroup[r];return this.setAudioTrack(r),e}if(s){let s=t.loadLevel;-1===s&&(s=t.firstAutoLevel);const r=function(e,t,i,s,r){const o=t[s],a=t.reduce(((e,t,i)=>{const s=t.uri;return(e[s]||(e[s]=[])).push(i),e}),{})[o.uri];a.length>1&&(s=Math.max.apply(Math,a));const n=o.videoRange,l=o.frameRate,d=o.codecSet.substring(0,4),h=Wf(t,s,(t=>{if(t.videoRange!==n||t.frameRate!==l||t.codecSet.substring(0,4)!==d)return!1;const s=t.audioGroups,o=i.filter((e=>!s||-1!==s.indexOf(e.groupId)));return jf(e,o,r)>-1}));return h>-1?h:Wf(t,s,(t=>{const s=t.audioGroups,o=i.filter((e=>!s||-1!==s.indexOf(e.groupId)));return jf(e,o,r)>-1}))}(e,t.levels,i,s,zf);if(-1===r)return null;t.nextLoadLevel=r}if(e.channels||e.audioCodec){const t=jf(e,i);if(t>-1)return i[t]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length)return void this.warn(`Invalid audio track id: ${e}`);this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,s=t[e],r=s.details&&!s.details.live;if(e===this.trackId&&s===i&&r)return;if(this.log(`Switching to audio-track ${e} "${s.name}" lang:${s.lang} group:${s.groupId} channels:${s.channels}`),this.trackId=e,this.currentTrack=s,this.hls.trigger(wc.AUDIO_TRACK_SWITCHING,yc({},s)),r)return;const o=this.switchParams(s.url,null==i?void 0:i.details,s.details);this.loadPlaylist(o)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=e=>{try{this.apply(e,{ot:Ny.MANIFEST,su:!this.initialized})}catch(e){Rc.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=e=>{try{const t=e.frag,i=this.hls.levels[t.level],s=this.getObjectType(t),r={d:1e3*t.duration,ot:s};s!==Ny.VIDEO&&s!==Ny.AUDIO&&s!=Ny.MUXED||(r.br=i.bitrate/1e3,r.tb=this.getTopBandwidth(s)/1e3,r.bl=this.getBufferLength(s)),this.apply(e,r)}catch(e){Rc.warn("Could not generate segment CMCD data.",e)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;null!=i&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||function(){try{return crypto.randomUUID()}catch(e){try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){let t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?i:3&i|8).toString(16)}))}}}(),this.cid=i.contentId,this.useHeaders=!0===i.useHeaders,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(wc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(wc.MEDIA_DETACHED,this.onMediaDetached,this),e.on(wc.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(wc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(wc.MEDIA_DETACHED,this.onMediaDetached,this),e.off(wc.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,s;this.audioBuffer=null==(i=t.tracks.audio)?void 0:i.buffer,this.videoBuffer=null==(s=t.tracks.video)?void 0:s.buffer}createData(){var e;return{v:1,sf:jy.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){vc(t,this.createData());const i=t.ot===Ny.INIT||t.ot===Ny.VIDEO||t.ot===Ny.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering);const{includeKeys:s}=this;s&&(t=Object.keys(t).reduce(((e,i)=>(s.includes(i)&&(e[i]=t[i]),e)),{})),this.useHeaders?(e.headers||(e.headers={}),hA(e.headers,t)):e.url=uA(e.url,t)}getObjectType(e){const{type:t}=e;return"subtitle"===t?Ny.TIMED_TEXT:"initSegment"===e.sn?Ny.INIT:"audio"===t?Ny.AUDIO:"main"===t?this.hls.audioTracks.length?Ny.VIDEO:Ny.MUXED:void 0}getTopBandwidth(e){let t,i=0;const s=this.hls;if(e===Ny.AUDIO)t=s.audioTracks;else{const e=s.maxAutoLevel,i=e>-1?e+1:s.levels.length;t=s.levels.slice(0,i)}for(const e of t)e.bitrate>i&&(i=e.bitrate);return i>0?i:NaN}getBufferLength(e){const t=this.hls.media,i=e===Ny.AUDIO?this.audioBuffer:this.videoBuffer;if(!i||!t)return NaN;return 1e3*Xf.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,s){t(e),this.loader.load(e,i,s)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,s){t(e),this.loader.load(e,i,s)}}}},contentSteeringController:class{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=Rc.log.bind(Rc,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wc.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(wc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(wc.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wc.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(wc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(wc.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter((t=>t!==e)))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;null!==i&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((null==i?void 0:i.action)===Tf&&i.flags===Df){const e=this.levels;let s=this.pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:i,pathwayId:s,type:o}=t.context;i&&e?r=this.getPathwayForGroupId(i,o,r):s&&(r=s)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!s&&e&&(s=e.reduce(((e,t)=>(-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e)),[])),s&&s.length>1&&(this.updatePathwayPriority(s),i.resolved=this.pathwayId!==r),i.resolved||Rc.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${e?e.length:e} priorities: ${JSON.stringify(s)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return null===this.levels?[]:this.levels.filter((t=>e===t.pathwayId))}updatePathwayPriority(e){let t;this.pathwayPriority=e;const i=this.penalizedPathways,s=performance.now();Object.keys(i).forEach((e=>{s-i[e]>3e5&&delete i[e]}));for(let s=0;s0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,ff(t),this.hls.trigger(wc.LEVELS_UPDATED,{levels:t});const e=this.hls.levels[o];a&&e&&this.levels&&(e.attrs["STABLE-VARIANT-ID"]!==a.attrs["STABLE-VARIANT-ID"]&&e.bitrate!==a.bitrate&&this.log(`Unstable Pathways change from bitrate ${a.bitrate} to ${e.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,i){const s=this.getLevelsForPathway(i).concat(this.levels||[]);for(let i=0;i{const{ID:r,"BASE-ID":o,"URI-REPLACEMENT":a}=e;if(t.some((e=>e.pathwayId===r)))return;const n=this.getLevelsForPathway(o).map((e=>{const t=new Ic(e.attrs);t["PATHWAY-ID"]=r;const o=t.AUDIO&&`${t.AUDIO}_clone_${r}`,n=t.SUBTITLES&&`${t.SUBTITLES}_clone_${r}`;o&&(i[t.AUDIO]=o,t.AUDIO=o),n&&(s[t.SUBTITLES]=n,t.SUBTITLES=n);const l=fA(e.uri,t["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",a),d=new of({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:l,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(let t=1;t{this.log(`Loaded steering manifest: "${s}"`);const o=e.data;if(1!==o.VERSION)return void this.log(`Steering VERSION ${o.VERSION} not supported!`);this.updated=performance.now(),this.timeToLoad=o.TTL;const{"RELOAD-URI":a,"PATHWAY-CLONES":n,"PATHWAY-PRIORITY":l}=o;if(a)try{this.uri=new self.URL(a,s).href}catch(e){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest RELOAD-URI: ${a}`)}this.scheduleRefresh(this.uri||i.url),n&&this.clonePathways(n);const d={steeringManifest:o,url:s.toString()};this.hls.trigger(wc.STEERING_MANIFEST_LOADED,d),l&&this.updatePathwayPriority(l)},onError:(e,t,i,s)=>{if(this.log(`Error loading steering manifest: ${e.code} ${e.text} (${t.url})`),this.stopLoad(),410===e.code)return this.enabled=!1,void this.log(`Steering manifest ${t.url} no longer available`);let r=1e3*this.timeToLoad;if(429!==e.code)this.scheduleRefresh(this.uri||t.url,r);else{const e=this.loader;if("function"==typeof(null==e?void 0:e.getResponseHeader)){const t=e.getResponseHeader("Retry-After");t&&(r=1e3*parseFloat(t))}this.log(`Steering manifest ${t.url} rate limited`)}},onTimeout:(e,t,i)=>{this.log(`Timeout loading steering manifest (${t.url})`),this.scheduleRefresh(this.uri||t.url)}};this.log(`Requesting steering manifest: ${s}`),this.loader.load(r,n,l)}scheduleRefresh(e,t=1e3*this.timeToLoad){this.clearTimeout(),this.reloadTimer=self.setTimeout((()=>{var t;const i=null==(t=this.hls)?void 0:t.media;!i||i.ended?this.scheduleRefresh(e,1e3*this.timeToLoad):this.loadSteeringManifest(e)}),t)}}});function wA(e){return e&&"object"==typeof e?Array.isArray(e)?e.map(wA):Object.keys(e).reduce(((t,i)=>(t[i]=wA(e[i]),t)),{}):e}function TA(e){const t=e.loader;if(t!==AA&&t!==gA)Rc.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1;else{(function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1})()&&(e.loader=AA,e.progressive=!0,e.enableSoftwareAES=!0,Rc.log("[config]: Progressive streaming enabled, using FetchLoader"))}}let kA;class LA extends Rf{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wc.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(wc.LEVEL_LOADED,this.onLevelLoaded,this),e.on(wc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(wc.FRAG_BUFFERED,this.onFragBuffered,this),e.on(wc.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(wc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wc.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(wc.LEVEL_LOADED,this.onLevelLoaded,this),e.off(wc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(wc.FRAG_BUFFERED,this.onFragBuffered,this),e.off(wc.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach((e=>{e.loadError=0,e.fragmentError=0})),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,s=[],r={},o={};let a=!1,n=!1,l=!1;t.levels.forEach((e=>{var t,d;const h=e.attrs;let{audioCodec:c,videoCodec:u}=e;-1!==(null==(t=c)?void 0:t.indexOf("mp4a.40.34"))&&(kA||(kA=/chrome|firefox/i.test(navigator.userAgent)),kA&&(e.audioCodec=c=void 0)),c&&(e.audioCodec=c=up(c,i)),0===(null==(d=u)?void 0:d.indexOf("avc1"))&&(u=e.videoCodec=function(e){const t=e.split(",");for(let e=0;e2){let s=i.shift()+".";s+=parseInt(i.shift()).toString(16),s+=("000"+parseInt(i.shift()).toString(16)).slice(-4),t[e]=s}}return t.join(",")}(u));const{width:p,height:f,unknownCodecs:m}=e;if(a||(a=!(!p||!f)),n||(n=!!u),l||(l=!!c),null!=m&&m.length||c&&!op(c,"audio",i)||u&&!op(u,"video",i))return;const{CODECS:g,"FRAME-RATE":y,"HDCP-LEVEL":A,"PATHWAY-ID":b,RESOLUTION:v,"VIDEO-RANGE":_}=h,S=`${`${b||"."}-`}${e.bitrate}-${v}-${y}-${g}-${_}-${A}`;if(r[S])if(r[S].uri===e.url||e.attrs["PATHWAY-ID"])r[S].addGroupId("audio",h.AUDIO),r[S].addGroupId("text",h.SUBTITLES);else{const t=o[S]+=1;e.attrs["PATHWAY-ID"]=new Array(t+1).join(".");const i=new of(e);r[S]=i,s.push(i)}else{const t=new of(e);r[S]=t,o[S]=1,s.push(t)}})),this.filterAndSortMediaOptions(s,t,a,n,l)}filterAndSortMediaOptions(e,t,i,s,r){let o=[],a=[],n=e;if((i||s)&&r&&(n=n.filter((({videoCodec:e,videoRange:t,width:i,height:s})=>{return(!!e||!(!i||!s))&&(!!(r=t)&&Xp.indexOf(r)>-1);var r}))),0===n.length)return void Promise.resolve().then((()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const e=new Error("no level with compatible codecs found in manifest");this.hls.trigger(wc.ERROR,{type:Tc.MEDIA_ERROR,details:kc.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:e,reason:e.message})}}));if(t.audioTracks){const{preferManagedMediaSource:e}=this.hls.config;o=t.audioTracks.filter((t=>!t.audioCodec||op(t.audioCodec,"audio",e))),CA(o)}t.subtitles&&(a=t.subtitles,CA(a));const l=n.slice(0);n.sort(((e,t)=>{if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return Xp.indexOf(e.videoRange)-Xp.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){const i=lp(e.videoCodec),s=lp(t.videoCodec);if(i!==s)return s-i}if(e.uri===t.uri&&e.codecSet!==t.codecSet){const i=dp(e.codecSet),s=dp(t.codecSet);if(i!==s)return s-i}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0}));let d=l[0];if(this.steering&&(n=this.steering.filterParsedLevels(n),n.length!==l.length))for(let e=0;ei&&i===EA.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=e)}break}const c=r&&!s,u={levels:n,audioTracks:o,subtitleTracks:a,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:s,altAudio:!c&&o.some((e=>!!e.url))};this.hls.trigger(wc.MANIFEST_PARSED,u),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return 0===this._levels.length?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(0===t.length)return;if(e<0||e>=t.length){const i=new Error("invalid level idx"),s=e<0;if(this.hls.trigger(wc.ERROR,{type:Tc.OTHER_ERROR,details:kc.LEVEL_SWITCH_ERROR,level:e,fatal:s,error:i,reason:i.message}),s)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,s=this.currentLevel,r=s?s.attrs["PATHWAY-ID"]:void 0,o=t[e],a=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,i===e&&o.details&&s&&r===a)return;this.log(`Switching to level ${e} (${o.height?o.height+"p ":""}${o.videoRange?o.videoRange+" ":""}${o.codecSet?o.codecSet+" ":""}@${o.bitrate})${a?" with Pathway "+a:""} from level ${i}${r?" with Pathway "+r:""}`);const n={level:e,attrs:o.attrs,details:o.details,bitrate:o.bitrate,averageBitrate:o.averageBitrate,maxBitrate:o.maxBitrate,realBitrate:o.realBitrate,width:o.width,height:o.height,codecSet:o.codecSet,audioCodec:o.audioCodec,videoCodec:o.videoCodec,audioGroups:o.audioGroups,subtitleGroups:o.subtitleGroups,loaded:o.loaded,loadError:o.loadError,fragmentError:o.fragmentError,name:o.name,id:o.id,uri:o.uri,url:o.url,urlId:0,audioGroupIds:o.audioGroupIds,textGroupIds:o.textGroupIds};this.hls.trigger(wc.LEVEL_SWITCHING,n);const l=o.details;if(!l||l.live){const e=this.switchParams(o.uri,null==s?void 0:s.details,l);this.loadPlaylist(e)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(void 0===this._startLevel){const e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){!t.fatal&&t.context&&t.context.type===Cp&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(void 0!==t&&t.type===Rp){const e=t.elementaryStreams;if(!Object.keys(e).some((t=>!!e[t])))return;const i=this._levels[t.level];null!=i&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var i;const{level:s,details:r}=t,o=this._levels[s];var a;if(!o)return this.warn(`Invalid level index ${s}`),void(null!=(a=t.deliveryDirectives)&&a.skip&&(r.deltaUpdateFailed=!0));s===this.currentLevelIndex?(0===o.fragmentError&&(o.loadError=0),this.playlistLoaded(s,t,o.details)):null!=(i=t.deliveryDirectives)&&i.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){let s=i.uri;if(e)try{s=e.addDirectives(s)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}const r=i.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${void 0!==(null==e?void 0:e.msn)?" at sn "+e.msn+" part "+e.part:""} with${r?" Pathway "+r:""} ${s}`),this.clearTimer(),this.hls.trigger(wc.LEVEL_LOADING,{url:s,level:t,pathwayId:i.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const i=this._levels.filter(((t,i)=>i!==e||(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach((e=>e.level=-1))),!1)));ff(i),this._levels=i,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(wc.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(wc.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function CA(e){const t={};e.forEach((e=>{const i=e.groupId||"";e.id=t[i]=t[i]||0,t[i]++}))}class DA{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyUriToKeyInfo){const s=this.keyUriToKeyInfo[i].loader;if(s){var t;if(e&&e!==(null==(t=s.context)?void 0:t.frag.type))return;s.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=kc.KEY_LOAD_ERROR,i,s,r){return new dm({type:Tc.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:i,networkDetails:s})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:s}=e;for(let e=0;e{r.setKeyFormat(e)}));break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then((t=>this.loadInternal(e,t))):this.loadInternal(e)}loadInternal(e,t){var i,s;t&&e.setKeyFormat(t);const r=e.decryptdata;if(!r){const i=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,kc.KEY_LOAD_ERROR,i))}const o=r.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,kc.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));let a=this.keyUriToKeyInfo[o];if(null!=(i=a)&&i.decryptdata.key)return r.key=a.decryptdata.key,Promise.resolve({frag:e,keyInfo:a});var n;if(null!=(s=a)&&s.keyLoadPromise)switch(null==(n=a.mediaKeySessionContext)?void 0:n.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return a.keyLoadPromise.then((t=>(r.key=t.keyInfo.decryptdata.key,{frag:e,keyInfo:a})))}switch(a=this.keyUriToKeyInfo[o]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===r.keyFormat?this.loadKeyHTTP(a,e):this.loadKeyEME(a,e);case"AES-128":return this.loadKeyHTTP(a,e);default:return Promise.reject(this.createKeyLoadError(e,kc.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const t=this.emeController.loadKey(i);if(t)return(e.keyLoadPromise=t.then((t=>(e.mediaKeySessionContext=t,i)))).catch((t=>{throw e.keyLoadPromise=null,t}))}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,s=new(0,i.loader)(i);return t.keyLoader=e.loader=s,e.keyLoadPromise=new Promise(((r,o)=>{const a={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},n=i.keyLoadPolicy.default,l={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(e,t,i,s)=>{const{frag:a,keyInfo:n,url:l}=i;if(!a.decryptdata||n!==this.keyUriToKeyInfo[l])return o(this.createKeyLoadError(a,kc.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),s));n.decryptdata.key=a.decryptdata.key=new Uint8Array(e.data),a.keyLoader=null,n.loader=null,r({frag:a,keyInfo:n})},onError:(e,i,s,r)=>{this.resetLoader(i),o(this.createKeyLoadError(t,kc.KEY_LOAD_ERROR,new Error(`HTTP Error ${e.code} loading key ${e.text}`),s,yc({url:a.url,data:void 0},e)))},onTimeout:(e,i,s)=>{this.resetLoader(i),o(this.createKeyLoadError(t,kc.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),s))},onAbort:(e,i,s)=>{this.resetLoader(i),o(this.createKeyLoadError(t,kc.INTERNAL_ABORTED,new Error("key loading aborted"),s))}};s.load(a,l,d)}))}resetLoader(e){const{frag:t,keyInfo:i,url:s}=e,r=i.loader;t.keyLoader===r&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[s],r&&r.destroy()}}function xA(){return self.SourceBuffer||self.WebKitSourceBuffer}function RA(){if(!sp())return!1;const e=xA();return!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove}class PA{constructor(e,t,i,s){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=s}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:i,media:s,stalled:r}=this;if(null===s)return;const{currentTime:o,seeking:a}=s,n=this.seeking&&!a,l=!this.seeking&&a;if(this.seeking=a,o!==e){if(this.moved=!0,a||(this.nudgeRetry=0),null!==r){if(this.stallReported){const e=self.performance.now()-r;Rc.warn(`playback not stuck anymore @${o}, after ${Math.round(e)}ms`),this.stallReported=!1}this.stalled=null}return}if(l||n)return void(this.stalled=null);if(s.paused&&!a||s.ended||0===s.playbackRate||!Xf.getBuffered(s).length)return void(this.nudgeRetry=0);const d=Xf.bufferInfo(s,o,0),h=d.nextStart||0;if(a){const e=d.len>2,i=!h||t&&t.start<=o||h-o>2&&!this.fragmentTracker.getPartialFragment(o);if(e||i)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var c;if(!(d.len>0)&&!h)return;const e=Math.max(h,d.start||0)-o,t=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,i=(null==t||null==(c=t.details)?void 0:c.live)?2*t.details.targetduration:2,r=this.fragmentTracker.getPartialFragment(o);if(e>0&&(e<=i||r))return void(s.paused||this._trySkipBufferHole(r))}const u=self.performance.now();if(null===r)return void(this.stalled=u);const p=u-r;if(!a&&p>=250&&(this._reportStall(d),!this.media))return;const f=Xf.bufferInfo(s,o,i.maxBufferHole);this._tryFixBufferStall(f,p)}_tryFixBufferStall(e,t){const{config:i,fragmentTracker:s,media:r}=this;if(null===r)return;const o=r.currentTime,a=s.getPartialFragment(o);if(a){if(this._trySkipBufferHole(a)||!this.media)return}(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-o1e3*i.highBufferWatchdogPeriod&&(Rc.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:i,stallReported:s}=this;if(!s&&i){this.stallReported=!0;const s=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${JSON.stringify(e)})`);Rc.warn(s.message),t.trigger(wc.ERROR,{type:Tc.MEDIA_ERROR,details:kc.BUFFER_STALLED_ERROR,fatal:!1,error:s,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:i,media:s}=this;if(null===s)return 0;const r=s.currentTime,o=Xf.bufferInfo(s,r,0),a=r0&&o.len<1&&s.readyState<3,d=a-r;if(d>0&&(n||l)){if(d>t.maxBufferHole){const{fragmentTracker:t}=this;let i=!1;if(0===r){const e=t.getAppendedFrag(0,Rp);e&&a1?(e=0,this.bitrateTest=!0):e=i.firstAutoLevel),i.nextLoadLevel=e,this.level=i.loadLevel,this.loadedmetadata=!1}t>0&&-1===e&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=gm,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=mm}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case km:{const{levels:e,level:t}=this,i=null==e?void 0:e[t],s=null==i?void 0:i.details;if(s&&(!s.live||this.levelLastLoaded===i)){if(this.waitForCdnTuneIn(s))break;this.state=gm;break}if(this.hls.nextLoadLevel!==this.level){this.state=gm;break}break}case bm:{var e;const t=self.performance.now(),i=this.retryDate;if(!i||t>=i||null!=(e=this.media)&&e.seeking){const{levels:e,level:t}=this,i=null==e?void 0:e[t];this.resetStartWhenNotLoaded(i||null),this.state=gm}}}this.state===gm&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:s}=this;if(null===t||!s&&(this.startFragRequested||!e.config.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;const r=e.nextLoadLevel;if(null==i||!i[r])return;const o=i[r],a=this.getMainFwdBufferInfo();if(null===a)return;const n=this.getLevelDetails();if(n&&this._streamEnded(a,n)){const e={};return this.altAudio&&(e.type="video"),this.hls.trigger(wc.BUFFER_EOS,e),void(this.state=Em)}e.loadLevel!==r&&-1===e.manualLevel&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;const l=o.details;if(!l||this.state===km||l.live&&this.levelLastLoaded!==o)return this.level=r,void(this.state=km);const d=a.len,h=this.getMaxBufferLength(o.maxBitrate);if(d>=h)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const c=this.backtrackFragment?this.backtrackFragment.start:a.end;let u=this.getNextFragment(c,l);if(this.couldBacktrack&&!this.fragPrevious&&u&&"initSegment"!==u.sn&&this.fragmentTracker.getState(u)!==Jf){var p;const e=(null!=(p=this.backtrackFragment)?p:u).sn-l.startSN,t=l.fragments[e-1];t&&u.cc===t.cc&&(u=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(u&&this.isLoopLoading(u,c)){if(!u.gap){const e=this.audioOnly&&!this.altAudio?Oc:Nc,t=(e===Nc?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,Rp)}u=this.getNextFragmentLoopLoading(u,l,a,Rp,h)}u&&(!u.initSegment||u.initSegment.data||this.bitrateTest||(u=u.initSegment),this.loadFragment(u,o,c))}loadFragment(e,t,i){const s=this.fragmentTracker.getState(e);this.fragCurrent=e,s===Vf||s===$f?"initSegment"===e.sn?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,i)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Rp)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(null!=t&&t.readyState){let i;const s=this.getAppendedFrag(t.currentTime);s&&s.start>1&&this.flushMainBuffer(0,s.start-1);const r=this.getLevelDetails();if(null!=r&&r.live){const e=this.getMainFwdBufferInfo();if(!e||e.len<2*r.targetduration)return}if(!t.paused&&e){const t=e[this.hls.nextLoadLevel],s=this.fragLastKbps;i=s&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*s)+1:0}else i=0;const o=this.getBufferedFrag(t.currentTime+i);if(o){const e=this.followingBufferedFrag(o);if(e){this.abortCurrentFrag();const t=e.maxStartPTS?e.maxStartPTS:e.start,i=e.duration,s=Math.max(o.end,t+Math.min(Math.max(i-this.config.maxFragLookUpTolerance,i*(this.couldBacktrack?.5:.125)),i*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(s,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case ym:case Am:case bm:case _m:case Sm:this.state=gm}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new PA(this.config,i,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;_c(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const i=this.getMainFwdBufferInfo();null!==i&&0!==i.len?this.tick():this.warn(`Main forward buffer length on "seeked" event ${i?i.len:"empty"})`)}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(wc.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let i=!1,s=!1;t.levels.forEach((e=>{const t=e.audioCodec;t&&(i=i||-1!==t.indexOf("mp4a.40.2"),s=s||-1!==t.indexOf("mp4a.40.5"))})),this.audioCodecSwitch=i&&s&&!function(){var e;const t=xA();return"function"==typeof(null==t||null==(e=t.prototype)?void 0:e.changeType)}(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==gm)return;const s=i[t.level];(!s.details||s.details.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(s.details))&&(this.state=km)}onLevelLoaded(e,t){var i;const{levels:s}=this,r=t.level,o=t.details,a=o.totalduration;if(!s)return void this.warn(`Levels were reset while loading level ${r}`);this.log(`Level ${r} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${a}`);const n=s[r],l=this.fragCurrent;!l||this.state!==Am&&this.state!==bm||l.level!==t.level&&l.loader&&this.abortCurrentFrag();let d=0;if(o.live||null!=(i=n.details)&&i.live){var h;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;d=this.alignPlaylists(o,n.details,null==(h=this.levelLastLoaded)?void 0:h.details)}if(n.details=o,this.levelLastLoaded=n,this.hls.trigger(wc.LEVEL_UPDATED,{details:o,level:r}),this.state===km){if(this.waitForCdnTuneIn(o))return;this.state=gm}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,d),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:s,payload:r}=e,{levels:o}=this;if(!o)return void this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);const a=o[i.level],n=a.details;if(!n)return this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),void this.fragmentTracker.removeFragment(i);const l=a.videoCodec,d=n.PTSKnown||!n.live,h=null==(t=i.initSegment)?void 0:t.data,c=this._getAudioCodec(a),u=this.transmuxer=this.transmuxer||new Bg(this.hls,Rp,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=s?s.index:-1,f=-1!==p,m=new Zf(i.level,i.sn,i.stats.chunkCount,r.byteLength,p,f),g=this.initPTS[i.cc];u.push(r,h,c,l,i,s,n.totalduration,d,m,g)}onAudioTrackSwitching(e,t){const i=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const e=this.fragCurrent;e&&(this.log("Switching to main audio track, cancel main fragment load"),e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const e=this.hls;i&&(e.trigger(wc.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),e.trigger(wc.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=t.id,s=!!this.hls.audioTracks[i].url;if(s){const e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=e)}this.altAudio=s,this.tick()}onBufferCreated(e,t){const i=t.tracks;let s,r,o=!1;for(const e in i){const t=i[e];if("main"===t.id){if(r=e,s=t,"video"===e){const t=i[e];t&&(this.videoBuffer=t.buffer)}}else o=!0}o&&s?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:s}=t;if(i&&i.type!==Rp)return;if(this.fragContextChanged(i))return this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),void(this.state===Sm&&(this.state=gm));const r=s?s.stats:i.stats;this.fragLastKbps=Math.round(8*r.total/(r.buffering.end-r.loading.first)),"initSegment"!==i.sn&&(this.fragPrevious=i),this.fragBufferedComplete(i,s)}onError(e,t){var i;if(t.fatal)this.state=wm;else switch(t.details){case kc.FRAG_GAP:case kc.FRAG_PARSING_ERROR:case kc.FRAG_DECRYPT_ERROR:case kc.FRAG_LOAD_ERROR:case kc.FRAG_LOAD_TIMEOUT:case kc.KEY_LOAD_ERROR:case kc.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Rp,t);break;case kc.LEVEL_LOAD_ERROR:case kc.LEVEL_LOAD_TIMEOUT:case kc.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==km||(null==(i=t.context)?void 0:i.type)!==Cp||(this.state=gm);break;case kc.BUFFER_APPEND_ERROR:case kc.BUFFER_FULL_ERROR:if(!t.parent||"main"!==t.parent)return;if(t.details===kc.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case kc.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}checkBuffer(){const{media:e,gapController:t}=this;if(e&&t&&e.readyState){if(this.loadedmetadata||!Xf.getBuffered(e).length){const e=this.state!==gm?this.fragCurrent:null;t.poll(this.lastCurrentTime,e)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=gm,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Oc||this.audioOnly&&!this.altAudio){const e=(t===Nc?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(e,t,Rp),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t0&&(r{const{hls:s}=this;if(!i||this.fragContextChanged(e))return;t.fragmentError=0,this.state=gm,this.startFragRequested=!1,this.bitrateTest=!1;const r=e.stats;r.parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),s.trigger(wc.FRAG_LOADED,i),e.bitrateTest=!1}))}_handleTransmuxComplete(e){var t;const i="main",{hls:s}=this,{remuxResult:r,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a)return void this.resetWhenMissingContext(o);const{frag:n,part:l,level:d}=a,{video:h,text:c,id3:u,initSegment:p}=r,{details:f}=d,m=this.altAudio?void 0:r.audio;if(this.fragContextChanged(n))this.fragmentTracker.removeFragment(n);else{if(this.state=_m,p){if(null!=p&&p.tracks){const e=n.initSegment||n;this._bufferInitSegment(d,p.tracks,e,o),s.trigger(wc.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:p.tracks})}const e=p.initPTS,t=p.timescale;_c(e)&&(this.initPTS[n.cc]={baseTime:e,timescale:t},s.trigger(wc.INIT_PTS_FOUND,{frag:n,id:i,initPTS:e,timescale:t}))}if(h&&f&&"initSegment"!==n.sn){const e=f.fragments[n.sn-1-f.startSN],t=n.sn===f.startSN,i=!e||n.cc>e.cc;if(!1!==r.independent){const{startPTS:e,endPTS:s,startDTS:r,endDTS:a}=h;if(l)l.elementaryStreams[h.type]={startPTS:e,endPTS:s,startDTS:r,endDTS:a};else if(h.firstKeyFrame&&h.independent&&1===o.id&&!i&&(this.couldBacktrack=!0),h.dropped&&h.independent){const r=this.getMainFwdBufferInfo(),o=(r?r.end:this.getLoadPosition())+this.config.maxBufferHole,l=h.firstKeyFramePTS?h.firstKeyFramePTS:e;if(!t&&o2&&(n.gap=!0);n.setElementaryStreamInfo(h.type,e,s,r,a),this.backtrackFragment&&(this.backtrackFragment=n),this.bufferFragmentData(h,n,l,o,t||i)}else{if(!t&&!i)return void this.backtrack(n);n.gap=!0}}if(m){const{startPTS:e,endPTS:t,startDTS:i,endDTS:s}=m;l&&(l.elementaryStreams[Oc]={startPTS:e,endPTS:t,startDTS:i,endDTS:s}),n.setElementaryStreamInfo(Oc,e,t,i,s),this.bufferFragmentData(m,n,l,o)}if(f&&null!=u&&null!=(t=u.samples)&&t.length){const e={id:i,frag:n,details:f,samples:u.samples};s.trigger(wc.FRAG_PARSING_METADATA,e)}if(f&&c){const e={id:i,frag:n,details:f,samples:c.samples};s.trigger(wc.FRAG_PARSING_USERDATA,e)}}}_bufferInitSegment(e,t,i,s){if(this.state!==_m)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:r,video:o,audiovideo:a}=t;if(r){let t=e.audioCodec;const i=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){t&&(t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");const e=r.metadata;e&&"channelCount"in e&&1!==(e.channelCount||1)&&-1===i.indexOf("firefox")&&(t="mp4a.40.5")}t&&-1!==t.indexOf("mp4a.40.5")&&-1!==i.indexOf("android")&&"audio/mpeg"!==r.container&&(t="mp4a.40.2",this.log(`Android: force audio codec to ${t}`)),e.audioCodec&&e.audioCodec!==t&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${t}"`),r.levelCodec=t,r.id="main",this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${t||""}/${e.audioCodec||""}/${r.codec}]`)}o&&(o.levelCodec=e.videoCodec,o.id="main",this.log(`Init video buffer, container:${o.container}, codecs[level/parsed]=[${e.videoCodec||""}/${o.codec}]`)),a&&this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${e.codecs}/${a.codec}]`),this.hls.trigger(wc.BUFFER_CODECS,t),Object.keys(t).forEach((e=>{const r=t[e].initSegment;null!=r&&r.byteLength&&this.hls.trigger(wc.BUFFER_APPENDING,{type:e,data:r,frag:i,part:null,chunkMeta:s,parent:i.type})})),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,Rp)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=gm}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&!1===e.seeking){const i=e.currentTime;if(Xf.isBuffered(e,i)?t=this.getAppendedFrag(i):Xf.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const e=this.fragPlaying,i=t.level;e&&t.sn===e.sn&&e.level===i||(this.fragPlaying=t,this.hls.trigger(wc.FRAG_CHANGED,{frag:t}),e&&e.level===i||this.hls.trigger(wc.LEVEL_SWITCHED,{level:i}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,i=this.currentFrag;if(i&&_c(t)&&_c(i.programDateTime)){const e=i.programDateTime+1e3*(t-i.start);return new Date(e)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class IA{static get version(){return"1.5.13"}static isMSESupported(){return RA()}static isSupported(){return function(){if(!RA())return!1;const e=sp();return"function"==typeof(null==e?void 0:e.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some((t=>e.isTypeSupported(np(t,"video"))))||["mp4a.40.2","fLaC"].some((t=>e.isTypeSupported(np(t,"audio")))))}()}static getMediaSource(){return sp()}static get Events(){return wc}static get ErrorTypes(){return Tc}static get ErrorDetails(){return kc}static get DefaultConfig(){return IA.defaultConfig?IA.defaultConfig:EA}static set DefaultConfig(e){IA.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new Pg,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,function(e,t){if("object"==typeof console&&!0===e||"object"==typeof e){xc(e,"debug","log","info","warn","error");try{Dc.log(`Debug logs enabled for "${t}" in hls.js version 1.5.13`)}catch(e){Dc=Cc}}else Dc=Cc}(e.debug||!1,"Hls instance");const t=this.config=function(e,t){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=wA(e),s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach((e=>{const r=`${"level"===e?"playlist":e}LoadPolicy`,o=void 0===t[r],a=[];s.forEach((s=>{const n=`${e}Loading${s}`,l=t[n];if(void 0!==l&&o){a.push(n);const e=i[r].default;switch(t[r]={default:e},s){case"TimeOut":e.maxLoadTimeMs=l,e.maxTimeToFirstByteMs=l;break;case"MaxRetry":e.errorRetry.maxNumRetry=l,e.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":e.errorRetry.retryDelayMs=l,e.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":e.errorRetry.maxRetryDelayMs=l,e.timeoutRetry.maxRetryDelayMs=l}}})),a.length&&Rc.warn(`hls.js config: "${a.join('", "')}" setting(s) are deprecated, use "${r}": ${JSON.stringify(t[r])}`)})),yc(yc({},i),t)}(IA.DefaultConfig,e);this.userConfig=e,t.progressive&&TA(t);const{abrController:i,bufferController:s,capLevelController:r,errorController:o,fpsController:a}=t,n=new o(this),l=this.abrController=new i(this),d=this.bufferController=new s(this),h=this.capLevelController=new r(this),c=new a(this),u=new Fp(this),p=new Kp(this),f=t.contentSteeringController,m=f?new f(this):null,g=this.levelController=new LA(this,m),y=new qf(this),A=new DA(this.config),b=this.streamController=new BA(this,y,A);h.setStreamController(b),c.setStreamController(b);const v=[u,g,b];m&&v.splice(1,0,m),this.networkControllers=v;const _=[l,d,h,c,p,y];this.audioTrackController=this.createController(t.audioTrackController,v);const S=t.audioStreamController;S&&v.push(new S(this,y,A)),this.subtitleTrackController=this.createController(t.subtitleTrackController,v);const E=t.subtitleStreamController;E&&v.push(new E(this,y,A)),this.createController(t.timelineController,_),A.emeController=this.emeController=this.createController(t.emeController,_),this.cmcdController=this.createController(t.cmcdController,_),this.latencyController=this.createController(Yp,_),this.coreComponents=_,v.push(n);const w=n.onErrorOut;"function"==typeof w&&this.on(wc.ERROR,w,n)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,s){this._emitter.off(e,t,i,s)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(Rc.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),!this.triggeringException){this.triggeringException=!0;const i=e===wc.ERROR;this.trigger(wc.ERROR,{type:Tc.OTHER_ERROR,details:kc.INTERNAL_EXCEPTION,fatal:i,event:e,error:t}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){Rc.log("destroy"),this.trigger(wc.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach((e=>e.destroy())),this.networkControllers.length=0,this.coreComponents.forEach((e=>e.destroy())),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){Rc.log("attachMedia"),this._media=e,this.trigger(wc.MEDIA_ATTACHING,{media:e})}detachMedia(){Rc.log("detachMedia"),this.trigger(wc.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,i=this.url,s=this.url=mc.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,Rc.log(`loadSource:${s}`),t&&i&&(i!==s||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(wc.MANIFEST_LOADING,{url:e})}startLoad(e=-1){Rc.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach((t=>{t.startLoad(e)}))}stopLoad(){Rc.log("stopLoad"),this.started=!1,this.networkControllers.forEach((e=>{e.stopLoad()}))}resumeBuffering(){this.started&&this.networkControllers.forEach((e=>{"fragmentLoader"in e&&e.startLoad(-1)}))}pauseBuffering(){this.networkControllers.forEach((e=>{"fragmentLoader"in e&&e.stopLoad()}))}swapAudioCodec(){Rc.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){Rc.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){Rc.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){Rc.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){Rc.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){Rc.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return-1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){Rc.log(`set startLevel:${e}`),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(Rc.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){(function(e){return Qp.indexOf(e)>-1})(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return-1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let s=0;s=t)return s;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let s;if(s=-1===t&&null!=e&&e.length?e.length-1:t,i)for(let t=s;t--;){const s=e[t].attrs["HDCP-LEVEL"];if(s&&s<=i)return t}return s}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return null==(t=this.audioTrackController)?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return null==(t=this.subtitleTrackController)||t.setSubtitleOption(e),null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return!!e&&e.subtitleDisplay}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}IA.defaultConfig=void 0;class MA extends Ea{constructor(e){super(),this.player=e,this.TAG_NAME="HlsDecoder",e._opt,this.canVideoPlay=!1,this.$videoElement=null,this.canvasRenderInterval=null,this.bandwidthEstimateInterval=null,this.fpsInterval=null,this.hlsFps=0,this.hlsPrevFrams=0,this.isInitInfo=!1,this.eventsDestroy=[],this.supportVideoFrameCallbackHandle=null,this.player.isHlsCanVideoPlay()?(this.$videoElement=this.player.video.$videoElement,this.canVideoPlay=!0):IA.isSupported()?(this.$videoElement=this.player.video.$videoElement,this.hls=new IA({}),this._initHls(),this._bindEvents()):this.player.debugError(this.TAG_NAME,"init hls error ,not support "),this.player.debugLog(this.TAG_NAME,"init")}destroy(){return new Promise(((e,t)=>{if(this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.hls&&(this.hls.destroy(),this.hls=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this.isInitInfo=!1,this._stopCanvasRender(),this._stopBandwidthEstimateInterval(),this._stopFpsInterval(),this.player._opt.useCanvasRender&&this.$videoElement){this.$videoElement.pause&&(this.$videoElement.pause(),this.$videoElement.muted=!0),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"));try{this.$videoElement.load()}catch(e){}}this.$videoElement=null,this.hlsFps=0,this.player.debugLog(this.TAG_NAME,"destroy"),setTimeout((()=>{e()}),0)}))}checkHlsBufferedDelay(){const e=this.$videoElement;let t=0;const i=e.buffered,s=i.length?i.end(i.length-1):0;return t=s-e.currentTime,t<0&&(this.player.debugWarn(this.TAG_NAME,`checkHlsBufferedDelay ${t} < 0, and buffered is ${s} ,currentTime is ${e.currentTime} , try to seek ${e.currentTime} to ${s}`),e.currentTime=s,t=0),t}getFps(){return this.hlsFps}_startCanvasRender(){Aa()?this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)):(this._stopCanvasRender(),this.canvasRenderInterval=setInterval((()=>{this.player.video.render({$video:this.$videoElement,ts:parseInt(1e3*this.$videoElement.currentTime,10)||0})}),40))}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())return void this.player.debugLog(this.TAG_NAME,"videoFrameCallback() player is destroyed");const i=parseInt(1e3*Math.max(t.mediaTime,this.$videoElement.currentTime),10)||0;this.player.video.render({$video:this.$videoElement,ts:i}),this.player.handleRender(),this.player.updateStats({dts:i}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}_startBandwidthEstimateInterval(){this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((()=>{let e=0;this.hls.bandwidthEstimate&&(e=this.hls.bandwidthEstimate),this.player.emit(ot.kBps,(e/1024/8/10).toFixed(2))}),1e3)}_stopBandwidthEstimateInterval(){this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}_startFpsInterval(){this._stopCanvasRender(),this.fpsInterval=setInterval((()=>{if(this.$videoElement)if(qo(this.$videoElement.getVideoPlaybackQuality)){const e=this.$videoElement.getVideoPlaybackQuality();this.hlsFps=e.totalVideoFrames-this.hlsPrevFrams,this.hlsPrevFrams=e.totalVideoFrames}else{const e=this.$videoElement.webkitDecodedFrameCount||0;this.hlsFps=e-this.hlsPrevFrams,this.hlsPrevFrams=e}}),1e3)}_stopFpsInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_initHls(){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.$videoElement.muted=!0,fo()&&(this.$videoElement.style.position="absolute"),this.initVideoEvents()),this.hls.attachMedia(this.$videoElement)}_bindEvents(){const e=this.player,{proxy:t}=this.player.events;this.hls;const i=this.$videoElement,s=Aa(),r=t(i,Zi,(t=>{if(this.hls){const i=parseInt(t.timeStamp,10);this.player._opt.useCanvasRender&&ua(s)&&e.updateStats({ts:i,dts:i})}}));this.eventsDestroy.push(r),this._startBandwidthEstimateInterval(),this._startFpsInterval(),this.hls.on(IA.Events.ERROR,((e,t)=>{if(t.fatal)switch(t.type){case IA.ErrorTypes.NETWORK_ERROR:this.player.debugWarn(this.TAG_NAME,"fatal network error encountered, try to recover"),this.hls.startLoad();break;case IA.ErrorTypes.MEDIA_ERROR:this.player.debugWarn(this.TAG_NAME,"fatal media error encountered, try to recover"),this.hls.recoverMediaError()}})),this.hls.on(IA.Events.MEDIA_ATTACHING,(()=>{})),this.hls.on(IA.Events.MEDIA_ATTACHED,(()=>{})),this.hls.on(IA.Events.MEDIA_DETACHING,(()=>{})),this.hls.on(IA.Events.MEDIA_DETACHED,(()=>{})),this.hls.on(IA.Events.BUFFER_RESET,(()=>{})),this.hls.on(IA.Events.BUFFER_CODECS,(()=>{})),this.hls.on(IA.Events.BUFFER_CREATED,(()=>{})),this.hls.on(IA.Events.BUFFER_APPENDING,((e,t)=>{this.player.debugLog(this.TAG_NAME,"BUFFER_APPENDING",t.type)})),this.hls.on(IA.Events.BUFFER_APPENDED,(()=>{})),this.hls.on(IA.Events.BUFFER_EOS,(()=>{})),this.hls.on(IA.Events.BUFFER_FLUSHING,(()=>{})),this.hls.on(IA.Events.BUFFER_FLUSHED,(()=>{})),this.hls.on(IA.Events.MANIFEST_LOADING,(()=>{this.player.debugLog(this.TAG_NAME,"MANIFEST_LOADING 开始加载playlist m3u8资源")})),this.hls.on(IA.Events.MANIFEST_LOADED,((e,t)=>{this.player.debugLog(this.TAG_NAME,"MANIFEST_LOADED playlist m3u8文件加载完成",t.url)})),this.hls.on(IA.Events.MANIFEST_PARSED,(()=>{this.player.debugLog(this.TAG_NAME,"MANIFEST_PARSED playlist m3u8解析完成"),e._times.demuxStart||(e._times.demuxStart=Zr())})),this.hls.on(IA.Events.LEVEL_LOADING,(()=>{})),this.hls.on(IA.Events.LEVEL_LOADED,((e,t)=>{})),this.hls.on(IA.Events.FRAG_LOADING,(()=>{})),this.hls.on(IA.Events.FRAG_LOADED,((t,i)=>{e._times.decodeStart||(e._times.decodeStart=Zr())})),this.hls.on(IA.Events.BUFFER_APPENDING,(()=>{e._times.videoStart||(e._times.videoStart=Zr(),e.handlePlayToRenderTimes())})),this.hls.on(IA.Events.FRAG_DECRYPTED,(()=>{})),this.hls.on(IA.Events.KEY_LOADING,(()=>{})),this.hls.on(IA.Events.KEY_LOADING,(()=>{})),this.hls.on(IA.Events.FPS_DROP,(e=>{})),this.hls.on(IA.Events.FPS_DROP_LEVEL_CAPPING,(e=>{})),this.hls.on(IA.Events.FRAG_PARSING_INIT_SEGMENT,((e,t)=>{this.player.debugLog(this.TAG_NAME,"FRAG_PARSING_INIT_SEGMENT",t);const i=!!(t&&t.tracks&&t.tracks.audio),s=!!(t&&t.tracks&&t.tracks.video);if(i&&t.tracks.audio){let e=t.tracks.audio;const i=e.metadata&&e.metadata.channelCount?e.metadata.channelCount:0,s=e.codec;this.player.audio&&this.player.audio.updateAudioInfo({encType:s,channels:i,sampleRate:44100})}if(s&&t.tracks.video){let e=t.tracks.video;const i={encTypeCode:-1!==e.codec.indexOf("avc")?yt:At};e.metadata&&(i.width=e.metadata.width,i.height=e.metadata.height),this.player.video&&this.player.video.updateVideoInfo(i)}}))}initVideoPlay(e){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.initVideoEvents()),this.$videoElement.autoplay=!0,this.$videoElement.muted=!0,this.$videoElement.src=e}_initRenderSize(){this.isInitInfo||(this.player.video.updateVideoInfo({width:this.$videoElement.videoWidth,height:this.$videoElement.videoHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0)}initVideoEvents(){const{proxy:e}=this.player.events,t=e(this.$videoElement,Qi,(()=>{this.player.debugLog(this.TAG_NAME,"video canplay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video play"),this._startCanvasRender(),this._initRenderSize()})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video play error ",e)}))})),i=e(this.$videoElement,Xi,(()=>{this.player.debugLog(this.TAG_NAME,"video waiting")})),s=e(this.$videoElement,Zi,(e=>{const t=parseInt(e.timeStamp,10);this.player.handleRender(),this.player.updateStats({ts:t}),this.$videoElement.paused&&(this.player.debugWarn(this.TAG_NAME,"video is paused and next try to replay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video is paused and replay success")})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video is paused and replay error ",e)})))})),r=e(this.$videoElement,es,(()=>{this.player.debugLog(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate)}));this.eventsDestroy.push(t,i,s,r)}loadSource(e){return new Promise(((t,i)=>{this.canVideoPlay?(this.initVideoPlay(e),t()):this.hls.on(IA.Events.MEDIA_ATTACHED,(()=>{this.hls.loadSource(e),t()}))}))}}const FA=2097152,UA="fetch",OA="xhr",NA="arraybuffer",jA="text",GA="json",zA="real_time_speed",WA=Object.prototype.toString;function VA(e){if("[object Object]"!==WA.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function HA(e){if(!e||null===e[0]||void 0===e[0]||0===e[0]&&(null===e[1]||void 0===e[1]))return;let t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}function $A(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function JA(e,t){if(!e)return;if(!t)return e;let i;const s=Object.keys(t).map((e=>{if(i=t[e],null!=i)return Array.isArray(i)?e+="[]":i=[i],i.map((t=>{var i;return i=t,"[object Date]"===WA.call(i)?t=t.toISOString():function(e){return null!==e&&"object"==typeof e}(t)&&(t=JSON.stringify(t)),`${$A(e)}=${$A(t)}`})).join("&")})).filter(Boolean).join("&");if(s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}function qA(e,t,i,s,r,o,a,n,l,d,h){r=null!=r?parseFloat(r):null,s=parseInt(s||"0",10),Number.isNaN(s)&&(s=0);return{data:e,done:t,option:{range:l,vid:d,index:n,contentLength:s,age:r,startTime:o,firstByteTime:a,endTime:Date.now(),priOptions:h},response:i}}function KA(e,t){return Math.round(8*e*1e3/t/1024)}class YA extends Error{constructor(e,t,i,s){super(s),ah(this,"retryCount",0),ah(this,"isTimeout",!1),ah(this,"loaderType",UA),ah(this,"startTime",0),ah(this,"endTime",0),ah(this,"options",{}),this.url=e,this.request=t,this.response=i}}class QA extends Ea{constructor(e){super(),ah(this,"_abortController",null),ah(this,"_timeoutTimer",null),ah(this,"_reader",null),ah(this,"_response",null),ah(this,"_aborted",!1),ah(this,"_index",-1),ah(this,"_range",null),ah(this,"_receivedLength",0),ah(this,"_running",!1),ah(this,"_logger",null),ah(this,"_vid",""),ah(this,"_onProcessMinLen",0),ah(this,"_onCancel",null),ah(this,"_priOptions",null),ah(this,"TAG_NAME","FetchLoader"),this.player=e}load(e){var t;let{url:i,vid:s,timeout:r,responseType:o,onProgress:a,index:n,onTimeout:l,onCancel:d,range:h,transformResponse:c,request:u,params:p,logger:f,method:m,headers:g,body:y,mode:A,credentials:b,cache:v,redirect:_,referrer:S,referrerPolicy:E,onProcessMinLen:w,priOptions:T}=e;this._aborted=!1,this._onProcessMinLen=w,this._onCancel=d,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=n,this._range=h||[0,0],this._vid=s||i,this._priOptions=T||{};const k={method:m,headers:g,body:y,mode:A,credentials:b,cache:v,redirect:_,referrer:S,referrerPolicy:E,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal};let L=!1;clearTimeout(this._timeoutTimer),i=JA(i,p);const C=HA(h);C&&(g=u?u.headers:k.headers=k.headers||(Headers?new Headers:{}),Headers&&g instanceof Headers?g.append("Range",C):g.Range=C),r&&(this._timeoutTimer=setTimeout((()=>{if(L=!0,this.cancel(),l){const e=new YA(i,k,null,"timeout");e.isTimeout=!0,l(e,{index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions})}}),r));const D=Date.now();return(Do(n)||Do(h))&&this.player.debugLog(this.TAG_NAME,"[fetch load start], index,",n,",range,",h),new Promise(((e,t)=>{fetch(u||i,u?void 0:k).then((async s=>{if(clearTimeout(this._timeoutTimer),this._response=s,this._aborted||!this._running)return;if(c&&(s=c(s,i)||s),!s.ok)throw new YA(i,k,s,"bad network response");const r=Date.now();let l;if(o===jA)l=await s.text(),this._running=!1;else if(o===GA)l=await s.json(),this._running=!1;else{if(a)return this.resolve=e,this.reject=t,void this._loadChunk(s,a,D,r);{l=await s.arrayBuffer(),l=new Uint8Array(l),this._running=!1;const e=Date.now()-D,t=KA(l.byteLength,e);this.emit(zA,{speed:t,len:l.byteLength,time:e,vid:this._vid,index:this._index,range:this._range,priOptions:this._priOptions})}}(Do(n)||Do(h))&&this.player.debugLog(this.TAG_NAME,"[fetch load end], index,",n,",range,",h),e(qA(l,!0,s,s.headers.get("Content-Length"),s.headers.get("age"),D,r,n,h,this._vid,this._priOptions))})).catch((e=>{var s;clearTimeout(this._timeoutTimer),this._running=!1,this._aborted&&!L||((e=e instanceof YA?e:new YA(i,k,null,null===(s=e)||void 0===s?void 0:s.message)).startTime=D,e.endTime=Date.now(),e.isTimeout=L,e.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},t(e))}))}))}async cancel(){if(!this._aborted){if(this._aborted=!0,this._running=!1,this._response){try{this._reader&&await this._reader.cancel()}catch(e){}this._response=this._reader=null}if(this._abortController){try{this._abortController.abort()}catch(e){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions})}}_loadChunk(e,t,i,s){if(!e.body||!e.body.getReader){this._running=!1;const t=new YA(e.url,"",e,"onProgress of bad response.body.getReader");return t.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(t)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(FA),this._writeIdx=0);const r=this._reader=e.body.getReader();let o,a,n;const l=async()=>{var d;a=Date.now();try{o=await r.read(),n=Date.now()}catch(e){return n=Date.now(),void(this._aborted||(this._running=!1,e.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this.reject(e)))}const h=(null===(d=this._range)||void 0===d?void 0:d.length)>0?this._range[0]:0,c=h+this._receivedLength;if(this._aborted)return this._running=!1,void t(void 0,!1,{range:[c,c],vid:this._vid,index:this._index,startTime:a,endTime:n,st:i,firstByteTime:s,priOptions:this._priOptions},e);const u=o.value?o.value.byteLength:0;let p;if(this._receivedLength+=u,this.player.debugLog(this.TAG_NAME,"【fetchLoader,onProgress call】,task,",this._range,", start,",c,", end,",h+this._receivedLength,", done,",o.done),this._onProcessMinLen>0){if(this._writeIdx+u>=this._onProcessMinLen||o.done)p=new Uint8Array(this._writeIdx+u),p.set(this._cache.slice(0,this._writeIdx),0),u>0&&p.set(o.value,this._writeIdx),this._writeIdx=0,this.player.debugLog(this.TAG_NAME,"【fetchLoader,onProgress enough】,done,",o.done,",len,",p.byteLength,", writeIdx,",this._writeIdx);else if(u>0&&this._writeIdx+u0){const e=new Uint8Array(this._writeIdx+u+2048);this.player.debugLog(this.TAG_NAME,"【fetchLoader,onProgress extra start】,size,",this._writeIdx+u+2048,", datalen,",u,", writeIdx,",this._writeIdx),e.set(this._cache.slice(0,this._writeIdx),0),u>0&&e.set(o.value,this._writeIdx),this._writeIdx+=u,delete this._cache,this._cache=e,this.player.debugLog(this.TAG_NAME,"【fetchLoader,onProgress extra end】,len,",u,", writeIdx,",this._writeIdx)}}else p=o.value;if((p&&p.byteLength>0||o.done)&&t(p,o.done,{range:[this._range[0]+this._receivedLength-(p?p.byteLength:0),this._range[0]+this._receivedLength],vid:this._vid,index:this._index,startTime:a,endTime:n,st:i,firstByteTime:s,priOptions:this._priOptions},e),o.done){const t=Date.now()-i,r=KA(this._receivedLength,t);this.emit(zA,{speed:r,len:this._receivedLength,time:t,vid:this._vid,index:this._index,range:this._range,priOptions:this._priOptions}),this._running=!1,this.player.debugLog(this.TAG_NAME,"[fetchLoader onProgress end],task,",this._range,",done,",o.done),this.resolve(qA(o,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),i,s,this._index,this._range,this._vid,this._priOptions))}else l()};l()}get receiveLen(){return this._receivedLength}get running(){return this._running}set running(e){this._running=e}static isSupported(){return!("undefined"==typeof fetch)}}class XA{constructor(e,t,i){ah(this,"TAG_NAME","Task"),this.promise=function(){let e,t;const i=new Promise(((i,s)=>{e=i,t=s}));return i.used=!1,i.resolve=function(){return i.used=!0,e(...arguments)},i.reject=function(){return i.used=!0,t(...arguments)},i}(),this.alive=!!t.onProgress,this._loaderType=e,this.player=i,this._loader=e===UA&&window.fetch?new QA(i):new ZA(i),this._config=t,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=t.retryCheckFunc}exec(){const{retry:e,retryDelay:t,onRetryError:i,transformError:s,...r}=this._config,o=async()=>{try{const e=await this._loader.load(r);this.promise.resolve(e)}catch(a){if(this._loader.running=!1,this.player.debugLog(this.TAG_NAME,"[task request catch err]",a),this._canceled)return;a.loaderType=this._loaderType,a.retryCount=this._retryCount;let n=a;s&&(n=s(n)||n),i&&this._retryCount>0&&i(n,this._retryCount,{index:r.index,vid:r.vid,range:r.range,priOptions:r.priOptions}),this._retryCount++;let l=!0;if(this._retryCheckFunc&&(l=this._retryCheckFunc(a)),l&&this._retryCount<=e)return clearTimeout(this._retryTimer),this.player.debugLog(this.TAG_NAME,"[task request setTimeout],retry",this._retryCount,",retry range,",r.range),void(this._retryTimer=setTimeout(o,t));this.promise.reject(n)}};return o(),this.promise}async cancel(){return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,this._loader.cancel()}get running(){return this._loader&&this._loader.running}get loader(){return this._loader}}class ZA extends Ea{constructor(e){super(),ah(this,"_xhr",null),ah(this,"_aborted",!1),ah(this,"_timeoutTimer",null),ah(this,"_range",null),ah(this,"_receivedLength",0),ah(this,"_url",null),ah(this,"_onProgress",null),ah(this,"_index",-1),ah(this,"_headers",null),ah(this,"_currentChunkSizeKB",384),ah(this,"_timeout",null),ah(this,"_xhr",null),ah(this,"_withCredentials",null),ah(this,"_startTime",-1),ah(this,"_loadCompleteResolve",null),ah(this,"_loadCompleteReject",null),ah(this,"_runing",!1),ah(this,"_logger",!1),ah(this,"_vid",""),ah(this,"_responseType",void 0),ah(this,"_credentials",void 0),ah(this,"_method",void 0),ah(this,"_transformResponse",void 0),ah(this,"_firstRtt",void 0),ah(this,"_onCancel",null),ah(this,"_priOptions",null),ah(this,"TAG_NAME","XhrLoader"),this.player=e}load(e){clearTimeout(this._timeoutTimer),this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this.player.debugLog(this.TAG_NAME,"【xhrLoader task】, range",this._range),this._url=JA(e.url,e.params);const t=Date.now();return new Promise(((e,t)=>{this._loadCompleteResolve=e,this._loadCompleteReject=t,this._startLoad()})).catch((e=>{if(clearTimeout(this._timeoutTimer),this._runing=!1,!this._aborted)throw(e=e instanceof YA?e:new YA(this._url,this._request)).startTime=t,e.endTime=Date.now(),e.options={index:this._index,vid:this._vid,priOptions:this._priOptions},e}))}_startLoad(){let e=null;if(this._responseType===NA&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;const t=1024*this._currentChunkSizeKB,i=this._range[0]+this._receivedLength;let s=this._range[1];t],tast :",this._range,", SubRange, ",e)}else e=this._range,this.player.debugLog(this.TAG_NAME,"[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}_internalOpen(e){try{this._startTime=Date.now();const t=this._xhr=new XMLHttpRequest;t.open(this._method||"GET",this._url,!0),t.responseType=this._responseType,this._timeout&&(t.timeout=this._timeout),t.withCredentials=this._withCredentials,t.onload=this._onLoad.bind(this),t.onreadystatechange=this._onReadyStatechange.bind(this),t.onerror=e=>{var t,i,s;this._running=!1;const r=new YA(this._url,this._request,null==e||null===(t=e.currentTarget)||void 0===t?void 0:t.response,"xhr.onerror.status:"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.status)+",statusText,"+(null==e||null===(s=e.currentTarget)||void 0===s?void 0:s.statusText));r.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(r)},t.ontimeout=e=>{this.cancel();const t=new YA(this._url,this._request,{status:408},"timeout");this._onTimeout&&(t.isTimeout=!0,this._onTimeout(t,{index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions})),t.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)};const i=this._headers||{},s=HA(e);s&&(i.Range=s),i&&Object.keys(i).forEach((e=>{t.setRequestHeader(e,i[e])})),this.player.debugLog(this.TAG_NAME,"[xhr.send->] tast,",this._range,",load sub range, ",e),t.send(this._body)}catch(t){t.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}}_onReadyStatechange(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}_onLoad(e){var t;const i=e.target.status;if(i<200||i>299){const t=new YA(this._url,null,{...e.target.response,status:i},"bad response,status:"+i);return t.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}let s,r=null,o=!1;const a=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===NA){var n;const t=new Uint8Array(e.target.response);if(s=a+this._receivedLength,t&&t.byteLength>0){this._receivedLength+=t.byteLength;const e=Date.now()-this._startTime,i=KA(this._receivedLength,e);this.emit(zA,{speed:i,len:this._receivedLength,time:e,vid:this._vid,index:this._index,range:[s,a+this._receivedLength],priOptions:this._priOptions})}r=t,o=!((null===(n=this._range)||void 0===n?void 0:n.length)>1&&this._range[1]&&this._receivedLength], tast :",this._range,", start",s,"end ",a+this._receivedLength,",dataLen,",t?t.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",o)}else o=!0,r=e.target.response;let l={ok:i>=200&&i<300,status:i,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(l=this._transformResponse(l,this._url)||l),this._onProgress&&this._onProgress(r,o,{index:this._index,vid:this._vid,range:[s,a+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},l),o?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(qA(this._onProgress?null:r,o,l,l.headers["content-length"],l.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}cancel(){if(!this._aborted)return this._aborted=!0,this._runing=!1,super.removeAllListeners(),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}static isSupported(){return"undefined"!=typeof XMLHttpRequest}get receiveLen(){return this._receivedLength}get running(){return this._running}set running(e){this._running=e}_getHeaders(e){const t=e.getAllResponseHeaders().trim().split("\r\n"),i={};for(const e of t){const t=e.split(": ");i[t[0].toLowerCase()]=t.slice(1).join(": ")}return i}}class eb extends Ea{constructor(e,t){super(),ah(this,"type",UA),ah(this,"_queue",[]),ah(this,"_alive",[]),ah(this,"_currentTask",null),ah(this,"_config",void 0),this.player=t,this._config=function(e){return{loaderType:UA,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:jA,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0,...e}}(e),this._config.loaderType!==OA&&QA.isSupported()||(this.type=OA)}destroy(){this._queue=[],this._alive=[],this._currentTask=null}isFetch(){return this.type===UA}static isFetchSupport(){return QA.isSupported()}load(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?t=e:t.url=e||t.url||this._config.url,t=Object.assign({},this._config,t),t.params&&(t.params=Object.assign({},t.params)),t.headers&&VA(t.headers)&&(t.headers=Object.assign({},t.headers)),t.body&&VA(t.body)&&(t.body=Object.assign({},t.body)),t.transformRequest&&(t=t.transformRequest(t)||t);const i=new XA(this.type,t,this.player);return i.loader.on(zA,(e=>{this.emit(zA,e)})),this._queue.push(i),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),i.promise}async cancel(){const e=this._queue.map((e=>e.cancel())).concat(this._alive.map((e=>e.cancel())));this._currentTask&&e.push(this._currentTask.cancel()),this._queue=[],this._alive=[],await Promise.all(e),await function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((t=>setTimeout(t,e)))}()}_processTask(){if(this._currentTask=this._queue.shift(),!this._currentTask)return;this._currentTask.alive&&this._alive.push(this._currentTask);const e=this._currentTask.exec().catch((e=>{}));e&&"function"==typeof e.finally&&e.finally((()=>{var e,t;null!==(e=this._currentTask)&&void 0!==e&&e.alive&&(null===(t=this._alive)||void 0===t?void 0:t.length)>0&&(this._alive=this._alive.filter((e=>e&&e!==this._currentTask))),this._processTask()}))}}const tb="network",ib="network_timeout",sb="other",rb="manifest",ob="hls",ab="demux";class nb extends Error{constructor(e,t,i,s,r){super(r||(null==i?void 0:i.message)),this.errorType=e===ib?tb:e,this.originError=i,this.ext=s,this.errorMessage=this.message}static create(e,t,i,s,r){return e instanceof nb?e:(e instanceof Error&&(i=e,e=""),e||(e=sb),new nb(e,t,i,s,r))}static network(e){var t;return new nb(null!=e&&e.isTimeout?ib:tb,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(t=e.response)||void 0===t?void 0:t.status})}}const lb=/^#(EXT[^:]*)(?::(.*))?$/,db=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g,hb=/^(?:[a-zA-Z0-9+\-.]+:)?\/\//,cb=/^((?:[a-zA-Z0-9+\-.]+:)?\/\/[^/?#]*)?([^?#]*\/)?/;function ub(e){const t=e.match(lb);if(t&&t[1])return[t[1].replace("EXT-X-",""),t[2]]}function pb(e){const t={};let i=db.exec(e);for(;i;)t[i[1]]=i[2]||i[3],i=db.exec(e);return t}function fb(e,t){if(!t||!e||hb.test(e))return e;const i=cb.exec(t);return i?"/"===e[0]?i[1]+e:i[1]+i[2]+e:e}const mb={audio:[/^mp4a/,/^vorbis$/,/^opus$/,/^flac$/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]};function gb(e,t){const i=mb[e];if(i&&t&&t.length)for(let e=0;e>8*(15-t)&255}}}class Lb{static parse(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if(!e.includes("#EXTM3U"))throw new Error("Invalid m3u8 file");const i=function(e){return e.split(/[\r\n]/).map((e=>e.trim())).filter(Boolean)}(e);return Lb.isMediaPlaylist(e)?function(e,t){const i=new wb;i.url=t;let s,r=new Tb,o=null,a=null,n=0,l=0,d=0,h=0,c=!1;for(;(s=e[h++])&&!c;){if("#"!==s[0]){r.sn=l,r.cc=d,r.url=fb(s,t),a&&(r.key=a.clone(l)),o&&(r.initSegment=o),i.segments.push(r),r=new Tb,l++;continue}const e=ub(s);if(!e)continue;const[h,u]=e;switch(h){case"VERSION":i.version=parseInt(u);break;case"PLAYLIST-TYPE":i.type=null==u?void 0:u.toUpperCase();break;case"TARGETDURATION":i.targetDuration=parseFloat(u);break;case"ENDLIST":{const e=i.segments[i.segments.length-1];e&&(e.isLast=!0),i.live=!1,c=!0}break;case"MEDIA-SEQUENCE":l=i.startSN=parseInt(u);break;case"DISCONTINUITY-SEQUENCE":d=i.startCC=parseInt(u);break;case"DISCONTINUITY":d++;break;case"BYTERANGE":r.setByteRange(u,i.segments[i.segments.length-1]);break;case"EXTINF":{const[e,t]=u.split(",");r.start=n,r.duration=parseFloat(e),n+=r.duration,r.title=t}break;case"KEY":{const e=pb(u);if("NONE"===e.METHOD){a=null;break}if("AES-128"!==e.METHOD)throw new Error(`encrypt ${e.METHOD}/${e.KEYFORMAT} is not supported`);if(a=new kb,a.method=e.METHOD,a.url=/^blob:/.test(e.URI)?e.URI:fb(e.URI,t),a.keyFormat=e.KEYFORMAT||"identity",a.keyFormatVersions=e.KEYFORMATVERSIONS,e.IV){let t=e.IV.slice(2);t=(1&t.length?"0":"")+t,a.iv=new Uint8Array(t.length/2);for(let e=0,i=t.length/2;e{e.id=t})),o.length&&(o.forEach(((e,t)=>{e.id=t})),i.streams.forEach((e=>{e.audioGroup&&(e.audioStreams=o.filter((t=>t.group===e.audioGroup)))}))),a.length&&(a.forEach(((e,t)=>{e.id=t})),i.streams.forEach((e=>{e.subtitleGroup&&(e.subtitleStreams=a.filter((t=>t.group===e.subtitleGroup)))}))),i}(i,t)}static isMediaPlaylist(e){return e.includes("#EXTINF:")||e.includes("#EXT-X-TARGETDURATION:")}}class Cb{constructor(e){ah(this,"_onLoaderRetry",((e,t)=>{this.hls.emit(Ps,{error:nb.network(e),retryTime:t})})),this.hls=e,this.player=e.player,this.TAG_NAME="HlsManifestLoader",this._timer=null;const{retryCount:t,retryDelay:i,loadTimeout:s,fetchOptions:r}=this.hls.config;this._loader=new eb({...r,responseType:"text",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._audioLoader=new eb({...r,responseType:"text",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._subtitleLoader=new eb({...r,responseType:"text",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player)}async destroy(){await this.stopPoll(),this._audioLoader&&(this._audioLoader.destroy(),this._audioLoader=null),this._subtitleLoader&&(this._subtitleLoader.destroy(),this._subtitleLoader=null),this._loader&&(this._loader.destroy(),this._loader=null)}async load(e,t,i){this.player.debugLog(this.TAG_NAME,"load()",e,t,i);const s=[this._loader.load(e)];let r,o,a,n,l,d;t&&s.push(this._audioLoader.load(t)),i&&s.push(this._subtitleLoader.load(i));try{const[e,i,n]=await Promise.all(s);if(!e)return[];r=e.data,t?(o=null==i?void 0:i.data,a=null==n?void 0:n.data):a=null==i?void 0:i.data}catch(e){throw nb.network(e)}try{var h;if(n=Lb.parse(r,e),!1===(null===(h=n)||void 0===h?void 0:h.live)&&n.segments&&!n.segments.length)throw new Error("empty segments list");o&&(l=Lb.parse(o,t)),a&&(d=Lb.parse(a,i))}catch(e){throw new nb(rb,ob,e)}return n&&(n.isMaster?this.hls.emit(ks,{playlist:n}):this.hls.emit(Ls,{playlist:n})),[n,l,d]}poll(e,t,i,s,r,o){clearTimeout(this._timer),o=o||3e3;let a=this.hls.config.pollRetryCount;const n=async()=>{clearTimeout(this._timer);try{const r=await this.load(e,t,i);if(!r[0])return;a=this.hls.config.pollRetryCount,s(r[0],r[1],r[2])}catch(e){a--,a<=0&&r(e)}this._timer=setTimeout(n,o)};this._timer=setTimeout(n,o)}stopPoll(){return clearTimeout(this._timer),this.cancel()}cancel(){return Promise.all([this._loader.cancel(),this._audioLoader.cancel()])}}class Db{constructor(){ah(this,"_chunkSpeeds",[]),ah(this,"_speeds",[])}addRecord(e,t){e&&t&&(this._speeds.push(8e3*e/t),this._speeds=this._speeds.slice(-3))}addChunkRecord(e,t){e&&t&&(this._chunkSpeeds.push(8e3*e/t),this._chunkSpeeds=this._chunkSpeeds.slice(-100))}getAvgSpeed(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds.reduce(((e,t)=>e+t))/this._speeds.length:this._chunkSpeeds.reduce(((e,t)=>e+t))/this._chunkSpeeds.length:0}getLatestSpeed(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds[this._speeds.length-1]:this._chunkSpeeds[this._chunkSpeeds.length-1]:0}reset(){this._chunkSpeeds=[],this._speeds=[]}}class xb{constructor(e){ah(this,"_emitOnLoaded",((e,t)=>{const{data:i,response:s,option:r}=e,{firstByteTime:o,startTime:a,endTime:n,contentLength:l}=r||{},d=n-a;this._bandwidthService.addRecord(l||i.byteLength,d),this.hls.emit(Is,{time:d,byteLength:l,url:t}),this.hls.emit(Ms,{url:t,elapsed:d||0}),this.hls.emit(Rs,{url:t,responseUrl:s.url,elapsed:o-a}),this.hls.emit(Fs,{headers:s.headers})})),ah(this,"_onLoaderRetry",((e,t)=>{this.hls.emit(Ps,{error:nb.network(e),retryTime:t})})),this.hls=e,this.player=e.player,this._bandwidthService=new Db;const{retryCount:t,retryDelay:i,loadTimeout:s,fetchOptions:r}=this.hls.config;this._segmentLoader=new eb({...r,responseType:"arraybuffer",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._audioSegmentLoader=new eb({...r,responseType:"arraybuffer",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._keyLoader=new eb({...r,responseType:"arraybuffer",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player)}destroy(){this.reset(),this._keyLoader&&(this._keyLoader.destroy(),this._keyLoader=null),this._audioSegmentLoader&&(this._audioSegmentLoader.destroy(),this._audioSegmentLoader=null),this._segmentLoader&&(this._segmentLoader.destroy(),this._segmentLoader=null)}speedInfo(){return{speed:this._bandwidthService.getLatestSpeed(),avgSpeed:this._bandwidthService.getAvgSpeed()}}resetBandwidth(){this._bandwidthService.reset()}load(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:i;const r=[];return e&&(r[0]=this.loadVideoSegment(e,i)),t&&(r[1]=this.loadAudioSegment(t,s)),Promise.all(r)}loadVideoSegment(e,t){return this._loadSegment(this._segmentLoader,e,t)}loadAudioSegment(e,t){return this._loadSegment(this._audioSegmentLoader,e,t)}async _loadSegment(e,t,i){var s;let r,o,a,n,l;const d=[];if(this.hls.emit(Bs,{url:t.url}),d[0]=e.load(t.url),i&&t.initSegment){var h;const i=t.initSegment.url;r=this._mapCache[i],r||(this.hls.emit(Bs,{url:i}),d[1]=e.load(i).then((e=>{if(e){Object.keys(this._mapCache)>30&&(this._mapCache={}),r=this._mapCache[i]=e.data,this._emitOnLoaded(e,i)}})));const s=null===(h=t.initSegment.key)||void 0===h?void 0:h.url;s&&(l=t.initSegment.key.iv,n=this._keyCache[s],n||(this.hls.emit(Bs,{url:s}),d[2]=this._keyLoader.load(s).then((e=>{e&&(n=this._keyCache[s]=e.data,this._emitOnLoaded(e,s))}))))}const c=null===(s=t.key)||void 0===s?void 0:s.url;c&&(a=t.key.iv,o=this._keyCache[c],o||(this.hls.emit(Bs,{url:c}),d[3]=this._keyLoader.load(c).then((e=>{e&&(o=this._keyCache[c]=e.data,this._emitOnLoaded(e,c))}))));const[u]=await Promise.all(d);if(!u)return;const p=u.data;return this._emitOnLoaded(u,t.url),{data:p,map:r,key:o,mapKey:n,keyIv:a,mapKeyIv:l}}reset(){this.error=null,this._mapCache={},this._keyCache={},this._bandwidthService.reset()}async cancel(){await Promise.all([this._keyLoader.cancel(),this._segmentLoader.cancel(),this._audioSegmentLoader.cancel()])}}class Rb{constructor(e,t,i){this.live=void 0,this.id=0,this.bitrate=0,this.width=0,this.height=0,this.name="",this.url="",this.audioCodec="",this.videoCodec="",this.textCodec="",this.startCC=0,this.endCC=0,this.startSN=0,this.endSN=-1,this.totalDuration=0,this.targetDuration=0,this.snDiff=null,this.segments=[],this.audioStreams=[],this.subtitleStreams=[],this.closedCaptions=[],this.currentAudioStream=null,this.currentSubtitleStream=null,this.TAG_NAME="HlsStream",this.update(e,t,i)}get lastSegment(){return this.segments.length?this.segments[this.segments.length-1]:null}get segmentDuration(){var e;return this.targetDuration||(null===(e=this.segments[0])||void 0===e?void 0:e.duration)||0}get liveEdge(){return this.endTime}get endTime(){var e;return(null===(e=this.lastSegment)||void 0===e?void 0:e.end)||0}get currentSubtitleEndSn(){var e;return(null===(e=this.currentSubtitleStream)||void 0===e?void 0:e.endSN)||0}clearOldSegment(e,t){return this._clearSegments(e,t)}getAudioSegment(e){if(!e||!this.currentAudioStream)return;const t=e.sn-this.snDiff;return this.currentAudioStream.segments.find((e=>e.sn===t))}update(e,t){this.url=e.url,Array.isArray(e.segments)?(null!==this.live&&void 0!==this.live||(this.live=e.live),this._updateSegments(e,this),this.startCC=e.startCC,this.endCC=e.endCC,this.startSN=e.startSN,this.endSN=e.endSN||-1,this.totalDuration=e.totalDuration,this.targetDuration=e.targetDuration,this.live=e.live,t&&this.currentAudioStream&&Array.isArray(t.segments)&&(this._updateSegments(t,this.currentAudioStream),(null===this.snDiff||void 0===this.snDiff)&&e.segments.length&&t.segments.length&&(this.snDiff=e.segments[0].sn-t.segments[0].sn))):(this.id=e.id,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.name=e.name,this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.textCodec=e.textCodec,this.audioStreams=e.audioStreams,this.subtitleStreams=e.subtitleStreams,!this.currentAudioStream&&this.audioStreams.length&&(this.currentAudioStream=this.audioStreams.find((e=>e.default))||this.audioStreams[0]),!this.currentSubtitleStream&&this.subtitleStreams.length&&(this.currentSubtitleStream=this.subtitleStreams.find((e=>e.default))||this.subtitleStreams[0]))}updateSubtitle(e){if(!(e&&this.currentSubtitleStream&&Array.isArray(e.segments)))return;const t=this._updateSegments(e,this.currentSubtitleStream),i=this.currentSubtitleStream.segments;return i.length>100&&(this.currentSubtitleStream.segments=i.slice(100)),t?t.map((e=>({sn:e.sn,url:e.url,duration:e.duration,start:e.start,end:e.end,lang:this.currentSubtitleStream.lang}))):void 0}switchSubtitle(e){const t=this.subtitleStreams.find((t=>t.lang===e)),i=this.currentSubtitleStream;t&&(this.currentSubtitleStream=t,i.segments=[])}_clearSegments(e,t){let i=0;const s=this.segments;for(let t=0,r=s.length;t=e){i=t;break}return i>t&&(i=t),i&&(this.segments=this.segments.slice(i),this.currentAudioStream&&(this.currentAudioStream.segments=this.currentAudioStream.segments.slice(i))),t-i}_updateSegments(e,t){const i=t.segments;if(this.live){const s=i[i.length-1],r=(null==s?void 0:s.sn)||-1;if(re.sn===r)),a=o<0?e.segments:e.segments.slice(o+1);if(i.length&&a.length){let e=s.end;a.forEach((t=>{t.start=e,e=t.end}));const t=(null==s?void 0:s.cc)||-1;t>a[0].cc&&a.forEach((e=>e.cc+=t))}return t.endSN=e.endSN,t.segments=i.concat(a),a}}else t.segments=e.segments}}class Pb{constructor(e){this.hls=e,this.player=e.player,this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1,this.TAG_NAME="HlsPlaylist"}destroy(){this.reset()}get lastSegment(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.lastSegment}get currentSegment(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer]}get nextSegment(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer+1]}get currentSegments(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.segments}get currentSubtitleEndSn(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.currentSubtitleEndSn}get liveEdge(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.liveEdge}get totalDuration(){var e;return(null===(e=this.currentStream)||void 0===e?void 0:e.totalDuration)||0}get seekRange(){const e=this.currentSegments;if(e&&e.length)return[e[0].start,e[e.length-1].end]}get isEmpty(){var e;return!(null!==(e=this.currentSegments)&&void 0!==e&&e.length)}get isLive(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.live}get hasSubtitle(){var e;return!(null===(e=this.currentStream)||void 0===e||!e.currentSubtitleStream)}getAudioSegment(e){var t;return null===(t=this.currentStream)||void 0===t?void 0:t.getAudioSegment(e)}moveSegmentPointer(e){var t;null==e&&(e=this._segmentPointer+1),this._segmentPointer=eo(e,-1,null===(t=this.currentSegments)||void 0===t?void 0:t.length),this.player.debugLog(this.TAG_NAME,`moveSegmentPointer() and param pos is ${e} and clamp result is ${this._segmentPointer}`)}reset(){this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1}getSegmentByIndex(e){var t;return null===(t=this.currentSegments)||void 0===t?void 0:t[e]}setNextSegmentByIndex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._segmentPointer=e-1,this.player.debugLog(this.TAG_NAME,"setNextSegmentByIndex()",e,this._segmentPointer)}findSegmentIndexByTime(e){const t=this.currentSegments;if(t){for(let i,s=0,r=t.length;s=i.start&&ee.url)).forEach(((e,t)=>{this.streams[t]?this.streams[t].update(e):this.streams[t]=new Rb(e)})),this.currentStream=this.streams[0];else if(Array.isArray(e.segments)){const s=this.currentStream;if(s){s.update(e,t,i);const r=s.updateSubtitle(i);r&&this.hls.emit(Ts,{list:r})}else this.reset(),this.currentStream=this.streams[0]=new Rb(e,t,i)}this.currentStream&&this.hls.isLive&&!this.dvrWindow&&(this.dvrWindow=this.currentSegments.reduce(((e,t)=>e+=t.duration),0))}switchSubtitle(e){var t;null===(t=this.currentStream)||void 0===t||t.switchSubtitle(e)}clearOldSegment(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;const t=this.currentStream;if(!this.dvrWindow||!t)return;const i=t.endTime-this.dvrWindow;if(i<=0)return void this.player.debugLog(this.TAG_NAME,`clearOldSegment() stream.endTime:${t.endTime}, this.dvrWindow:${this.dvrWindow} startTime <= 0`);const s=t.segments;if(s.length<=e)return void this.player.debugLog(this.TAG_NAME,`clearOldSegment() segments.length:${s.length} <= maxPlaylistSize:${e}`);const r=this._segmentPointer;this._segmentPointer=t.clearOldSegment(i,r),this.player.debugLog(this.TAG_NAME,"clearOldSegment() update _segmentPointer:",r,this._segmentPointer),this.player.debugLog(this.TAG_NAME,"currentSegments",this.currentSegments)}checkSegmentTrackChange(e,t){const i=this.findSegmentIndexByTime(e),s=this.getSegmentByIndex(i);if(!s)return;if(!s.hasAudio&&!s.hasVideo)return;if(2!==t&&s.hasAudio&&s.hasVideo)return s;if(s.end-e>.3)return;const r=this.getSegmentByIndex(i+1);return r&&(r.hasAudio||r.hasVideo)&&(r.hasAudio!==s.hasAudio||r.hasVideo!==s.hasVideo)?r:void 0}}class Bb{constructor(e,t){this.hls=e,this.player=t;const i=window.crypto||window.msCrypto;this.subtle=i&&(i.subtle||i.webkitSubtle),this.externalDecryptor=null}decrypt(e,t){if(!e&&!t)return;const i=[];return e&&(i[0]=this._decryptSegment(e)),t&&(i[1]=this._decryptSegment(t)),Promise.all(i)}async _decryptSegment(e){let t=e.data;return e.key&&(t=await this._decryptData(e.data,e.key,e.keyIv)),e.map?gh(e.map,t):t}async _decryptData(e,t,i){if(this.externalDecryptor)return await this.externalDecryptor.decrypt(e,t,i);if(this.subtle){const s=await this.subtle.importKey("raw",t,{name:"AES-CBC"},!1,["encrypt","decrypt"]),r=await this.subtle.decrypt({name:"AES-CBC",iv:i},s,e);return new Uint8Array(r)}e=bd(e),t=bd(t),i=bd(i);return function(e){const{words:t}=e,{sigBytes:i}=e,s=new Uint8Array(i);for(let e=0;e>>2]>>>24-e%4*8&255;return s}(yd.AES.decrypt({ciphertext:e},t,{iv:i,mode:yd.mode.CBC}))}}class Ib extends Kd{constructor(e){super(e),this.player=e,this._pmtId=-1,this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[],this._gopId=0,this._videoPid=-1,this._audioPid=-1,this._codecType=yt,this._audioCodecType=_t,this._vps=null,this._sps=null,this._pps=null,this.TAG_NAME="HlsTsLoader",this.videoTrack=Ib.initVideoTrack(),this.audioTrack=Ib.initAudioTrack(),this._baseDts=-1,this._baseDtsInited=!1,this._basefps=25,this._tempSampleTsList=[],this._hasAudio=!1,this._hasVideo=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=!1,this._videoTimestampBreak=!1,this._lastAudioExceptionGapDot=0,this._lastAudioExceptionOverlapDot=0,this._lastAudioExceptionLargeGapDot=0,this._isSendAACSeqHeader=!1,this.workerClearTimeout=null,this.workerUrl=null,this.loopWorker=null,this.tempSampleListInfo={},this._isUseWorker()&&this._initLoopWorker(),this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.workerUrl&&(URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.loopWorker&&(this.loopWorker.postMessage({cmd:"destroy"}),this.loopWorker.terminate(),this.loopWorker=null),this.videoTrack=null,this.audioTrack=null,this.tempSampleListInfo={},this._baseDts=-1,this._baseDtsInited=!1,this._basefps=25,this._hasCalcFps=!1,this._tempSampleTsList=[],this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=!1,this._videoTimestampBreak=!1,this._lastAudioExceptionGapDot=0,this._lastAudioExceptionOverlapDot=0,this._lastAudioExceptionLargeGapDot=0,this._isSendAACSeqHeader=!1,this.player.debugLog(this.TAG_NAME,"destroy")}static initVideoTrack(){return{samples:[]}}static initAudioTrack(){return{samples:[]}}static probe(e){return!!e.length&&(71===e[0]&&71===e[188]&&71===e[376])}_parsePES(e){const t=e[8];if(null==t||e.lengthe.length-6)return;let r,o;const a=e[7];return 192&a&&(r=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&a?(o=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,r-o>54e5&&(r=o)):o=r),{data:e.subarray(9+t),pts:r,dts:o,originalPts:r,originalDts:o}}_demux(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t&&(this._pmtId=-1,this.videoTrack=Ib.initVideoTrack(),this.audioTrack=Ib.initAudioTrack()),!i||t?(this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[]):(this.videoTrack.samples=[],this.audioTrack.samples=[],this._remainingPacketData&&(e=gh(this._remainingPacketData,e),this._remainingPacketData=null));let s=e.length;const r=s%188;r&&(this._remainingPacketData=e.subarray(s-r),s-=r);for(let t=0;t>4>1){if(r=t+5+e[t+4],r===t+188)continue}else r=t+4;switch(s){case 0:i&&(r+=e[r]+1),this._pmtId=(31&e[r+10])<<8|e[r+11];break;case this._pmtId:{i&&(r+=e[r]+1);const t=r+3+((15&e[r+1])<<8|e[r+2])-4;for(r+=12+((15&e[r+10])<<8|e[r+11]);r=t)return[];const r=[];for(;s{const t=s?e[0]>>>1&63:31&e[0];switch(t){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!s&&5!==t||s&&5===t)break;r.isIFrame=!0,this._gopId++;break;case 6:case 39:case 40:if(!s&&6!==t||s&&6===t)break;const o=function(e,t){const i=e.length;let s=t?2:1,r=0,o=0,a="";for(;255===e[s];)r+=255,s++;for(r+=e[s++];255===e[s];)o+=255,s++;if(o+=e[s++],5===r&&i>s+16)for(let t=0;t<16;t++)a+=e[s].toString(16),s++;return{payload:e.subarray(s),type:r,size:o,uuid:a}}(function(e){const t=e.byteLength,i=[];let s=1;for(;s=i)return;const r=s,o=[],a=(60&e[s+2])>>>2,n=Dr[a];if(!n)throw new Error(`Invalid sampling index: ${a}`);const l=1+((192&e[s+2])>>>6),d=(1&e[s+2])<<2|(192&e[s+3])>>>6;let h,c,u=0;const p=Fr(n);for(;s+7>5,i-s=i?void 0:e.subarray(s),frames:o,samplingFrequencyIndex:a,sampleRate:n,objectType:l,channelCount:d,originCodec:`mp4a.40.${l}`}}(e.data,e.originalPts);if(t){if(this.audioTrack.codec=t.codec,this.audioTrack.sampleRate=t.sampleRate,this.audioTrack.channelCount=t.channelCount,!this._isSendAACSeqHeader){const e=Pr({profile:t.objectType,sampleRate:t.samplingFrequencyIndex,channel:t.channelCount});this._isSendAACSeqHeader=!0,this.player.debugLog(this.TAG_NAME,"aac seq header",`profile: ${t.objectType}, sampleRate:${t.sampleRate},sampleRateIndex: ${t.samplingFrequencyIndex}, channel: ${t.channelCount}`),this._doDecodeByHls(e,Fe,0,!1,0)}if(this._isSendAACSeqHeader){const e=[];t.frames.forEach((t=>{const i=t.pts,s=new Uint8Array(t.data.length+2);s.set([175,1],0),s.set(t.data,2);const r={type:Fe,pts:i,dts:i,payload:s};e.push(r)})),this.audioTrack.samples=this.audioTrack.samples.concat(e)}else this.player.debugWarn(this.TAG_NAME,"aac seq header not send")}else this.player.debugWarn(this.TAG_NAME,"aac parseADTS error")}this._audioPesData=[]}else e&&"startPrefixError"===e.code&&(this._audioPesData=[])}_fix(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e=Math.round(9e4*e);const s=this.videoTrack,r=this.audioTrack,o=s.samples,a=r.samples;if(!o.length&&!a.length)return;const n=o[0],l=a[0];let d=0;if(o.length&&a.length&&(d=n.dts-l.pts),this._baseDtsInited||this._calculateBaseDts(),t&&(this._calculateBaseDts(),this._baseDts-=e),!i){this._videoNextDts=d>0?e+d:e,this._audioNextPts=d>0?e:e-d;const t=n?n.dts-this._baseDts-this._videoNextDts:0,i=l?l.pts-this._baseDts-this._audioNextPts:0;Math.abs(t||i)>pr&&(this._calculateBaseDts(this.audioTrack,this.videoTrack),this._baseDts-=e)}this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(r),this._fixVideo(s);let h=s.samples.concat(r.samples);h=h.map((e=>(e.dts=Math.round(e.dts/90),e.pts=Math.round(e.pts/90),e.cts=e.pts-e.dts,e))).sort(((e,t)=>e.dts-t.dts)),h.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,this._isUseWorker()?this.loopWorker.postMessage({...e,payload:t,cmd:"sample"},[t.buffer]):e.type===Ue?this._doDecodeVideo({...e,payload:t}):e.type===Fe&&this._doDecodeAudio({...e,payload:t})})),ua(this._hasCalcFps)&&this._isUseWorker()&&(this._hasCalcFps=this._calcDecodeFps(h))}_calculateBaseDts(){const e=this.audioTrack,t=this.videoTrack,i=e.samples,s=t.samples;if(!i.length&&!s.length)return!1;let r=1/0,o=1/0;i.length&&(e.baseDts=r=i[0].pts),s.length&&(t.baseDts=o=s[0].dts),this._baseDts=Math.min(r,o);const a=o-r;return Number.isFinite(a)&&Math.abs(a)>45e3&&this.player.debugWarn(this.TAG_NAME,`large av first frame gap,\n video pts: ${o},\n audio pts: ${r},\n base dts: ${this._baseDts},\n detect is: ${a}`),this._baseDtsInited=!0,!0}_resetBaseDtsWhenStreamBreaked(){if(this._baseDtsInited&&this._videoTimestampBreak&&this._audioTimestampBreak){if(!this._calculateBaseDts(this.audioTrack,this.videoTrack))return;this._baseDts-=Math.min(this._audioNextPts,this._videoNextDts),this._audioLastSample=null,this._videoLastSample=null,this._videoTimestampBreak=!1,this._audioTimestampBreak=!1}}_fixAudio(e){const t=e.samples;t.length&&(t.forEach((e=>{e.pts-=this._baseDts,e.dts=e.pts})),this._doFixAudioInternal(e,t,9e4))}_fixVideo(e){const t=e.samples;if(!t.length)return;if(t.forEach((e=>{e.dts-=this._baseDts,e.pts-=this._baseDts})),void 0===this._videoNextDts){const e=t[0];this._videoNextDts=e.dts}const i=t.length;let s=0;const r=t[0],o=t[1],a=this._videoNextDts-r.dts;let n;Math.abs(a)>45e3&&(r.dts+=a,r.pts+=a,this.player.debugWarn(this.TAG_NAME,`large video gap between chunk,\n next dts is ${this._videoNextDts},\n first dts is ${r.dts},\n next dts is ${o&&o.dts},\n duration is ${a}`),o&&Math.abs(o.dts-r.dts)>pr&&(this._videoTimestampBreak=!0,t.forEach(((e,t)=>{0!==t&&(e.dts+=a,e.pts+=a)}))));const l=e.samples[0],d=e.samples[i-1];n=1===i?9e3:Math.floor((d.dts-l.dts)/(i-1));for(let r=0;rpr||s<0){this._videoTimestampBreak=!0,s=this._audioTimestampBreak?n:Math.max(s,2700);const i=this._audioNextPts||0;a&&a.dts>i&&(s=n),this.player.debugWarn(this.TAG_NAME,`large video gap between frames,\n time is ${o/e.timescale},\n dts is ${o},\n origin dts is ${t[r].originalDts},\n next dts is ${this._videoNextDts},\n sample Duration is ${s} ,\n ref Sample DurationInt is ${n}`)}t[r].duration=s,this._videoNextDts+=s}}_doFixAudioInternal(e,t,i){e.sampleDuration||(e.sampleDuration=Fr(e.timescale,i));const s=e.sampleDuration;if(void 0===this._audioNextPts){const e=t[0];this._audioNextPts=e.pts}for(let i=0;i=3*s&&a<=cr&&!fo()){Mr(e.codec,e.channelCount)||t[0].data.subarray();const n=Math.floor(a/s);Math.abs(o.pts-this._lastAudioExceptionGapDot)>ur&&(this._lastAudioExceptionGapDot=o.pts),this.player.debugWarn(this.TAG_NAME,`audio gap detected,\n pts is ${t.pts},\n originPts is ${t.originalPts},\n count is ${n},\n nextPts is ${r},\n ref sample duration is ${s}`);for(let e=0;e=-9e4?(Math.abs(o.pts-this._lastAudioExceptionOverlapDot)>ur&&(this._lastAudioExceptionOverlapDot=o.pts,this.player.debugWarn(this.TAG_NAME,`audio overlap detected,\n pts is ${o.pts},\n originPts is ${o.originalPts},\n nextPts is ${r},\n ref sample duration is ${s}`)),t.splice(i,1),i--):(Math.abs(a)>=cr&&(this._audioTimestampBreak=!0,Math.abs(o.pts-this._lastAudioExceptionLargeGapDot)>ur&&(this._lastAudioExceptionLargeGapDot=o.pts,this.player.debugWarn(this.TAG_NAME,`large audio gap detected,\n time is ${o.pts/1e3}\n pts is ${o.pts},\n originPts is ${o.originalPts},\n nextPts is ${r},\n sample duration is ${a}\n ref sample duration is ${s}`))),o.dts=o.pts=r,this._audioNextPts+=s)}}_calcDecodeFps(e){const t=e.map((e=>({ts:e.dts||e.pts,type:e.type})));this._tempSampleTsList=this._tempSampleTsList.concat(t);const i=sa(this._tempSampleTsList,Ue);if(i)this._tempSampleTsList=[],this.player.debugLog(this.TAG_NAME,`_calcDecodeFps() video fps is ${i}, update base fps is ${this._basefps}`),this._basefps=i,this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps});else if(this.player.debugLog(this.TAG_NAME,"_calcDecodeFps() streamVideoFps is null"),this._tempSampleTsList.length>200)return this.player.debugLog(this.TAG_NAME,`_calcDecodeFps() _tempSampleTsList is more than 200, clear and use base fps update ${this._basefps}`),this._tempSampleTsList=[],this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps}),!0;return null!==i}_isUseWorker(){return!this.player.isUseMSE()}_initLoopWorker(){this.player.debugLog(this.TAG_NAME,"_initLoopWorker()");const e=ya(function(){const e=1,t=2;let i=new class{constructor(){this.baseFps=0,this.fpsInterval=null,this.preLoopTimestamp=null,this.startBpsTime=null,this.allSampleList=[]}destroy(){this._clearInterval(),this.baseFps=0,this.allSampleList=[],this.preLoopTimestamp=null,this.startBpsTime=null}updateBaseFps(e){this.baseFps=e,this._clearInterval(),this._startInterval()}pushSample(e){delete e.cmd,this.allSampleList.push(e)}_startInterval(){const e=Math.ceil(1e3/this.baseFps);this.fpsInterval=setInterval((()=>{let t=(new Date).getTime();this.preLoopTimestamp||(this.preLoopTimestamp=t),this.startBpsTime||(this.startBpsTime=t);const i=t-this.preLoopTimestamp;if(i>2*e&&console.warn(`JbPro:[TsLoader LoopWorker] loop interval is ${i}ms, more than ${e} * 2ms`),this._loop(),this.preLoopTimestamp=(new Date).getTime(),this.startBpsTime){t-this.startBpsTime>=1e3&&(this._calcSampleList(),this.startBpsTime=t)}}),e)}_clearInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_calcSampleList(){const i={buferredDuration:0,allListLength:this.allSampleList.length,audioListLength:0,videoListLength:0};this.allSampleList.forEach((s=>{s.type===t?(i.videoListLength++,s.duration&&(i.buferredDuration+=Math.round(s.duration/90))):s.type===e&&i.audioListLength++})),postMessage({cmd:"sampleListInfo",...i})}_loop(){let i=null;if(this.allSampleList.length)if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]);let t=this.allSampleList[0];for(;t&&t.type===e;)i=this.allSampleList.shift(),postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),t=this.allSampleList[0]}else if(i.type===e){postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]);let s=this.allSampleList[0];for(;s;){if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]),s=null;break}i.type===e&&(postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),s=this.allSampleList[0])}}}};self.onmessage=e=>{const t=e.data;switch(t.cmd){case"updateBaseFps":i.updateBaseFps(t.baseFps);break;case"sample":i.pushSample(t);break;case"destroy":i.destroy(),i=null}}}.toString()),t=new Blob([e],{type:"text/javascript"}),i=URL.createObjectURL(t);let s=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((()=>{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),te),s.onmessage=e=>{const t=e.data;switch(t.cmd){case"decodeVideo":this._doDecodeVideo(t);break;case"decodeAudio":this._doDecodeAudio(t);break;case"sampleListInfo":this.tempSampleListInfo=t}},this.loopWorker=s}_postMessageToLoopWorker(e,t){this._isUseWorker()&&(this.loopWorker?this.loopWorker.postMessage({cmd:e,...t}):this.player.debugWarn(this.TAG_NAME,"loop worker is not init, can not post message"))}_doDecodeAudio(e){const t=new Uint8Array(e.payload);this.player.updateStats({abps:t.byteLength});let i=this.cryptoPayloadAudio(t);this._doDecodeByHls(i,Fe,e.dts,!1,0)}_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?Hn(t,e.isIFrame):Rn(t,e.isIFrame),this.player.updateStats({dts:e.dts,vbps:i.byteLength});const s=e.pts-e.dts;let r=this.cryptoPayload(i,e.isIFrame);this._doDecodeByHls(r,Ue,e.dts,e.isIFrame,s)}getBuferredDuration(){return this.tempSampleListInfo.buferredDuration||0}getSampleListLength(){return this.tempSampleListInfo.allListLength||0}getSampleAudioListLength(){return this.tempSampleListInfo.audioListLength||0}getSampleVideoListLength(){return this.tempSampleListInfo.videoListLength||0}getInputByteLength(){return this._remainingPacketData&&this._remainingPacketData.byteLength||0}}function Mb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function Fb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function Ub(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=Math.pow(2,32);return Fb(e,t)*i+Fb(e,t+4)}const Ob="aac",Nb="g7110a",jb="g7110m",Gb="avc",zb="hevc";class Wb{static getFrameDuration(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}static getRateIndexByRate(e){return Wb.FREQ.indexOf(e)}}function Vb(e,t,i,s,r,o){const a=[],n=null==r?void 0:r.entries,l=t.entries,d=s.entries,h=i.entrySizes,c=null==o?void 0:o.entries;let u,p,f;c&&(u={},c.forEach((e=>{u[e-1]=!0}))),n&&(p=[],n.forEach((e=>{let{count:t,offset:i}=e;for(let e=0;e{let{count:t,delta:s}=e;for(let e=0;e=S&&(b++,S=l[b+1]?l[b+1].firstChunk-1:1/0),_+=l[b].samplesPerChunk)})),a}function Hb(e,t){return e.dataReferenceIndex=Mb(t,6),e.width=Mb(t,24),e.height=Mb(t,26),e.horizresolution=Fb(t,28),e.vertresolution=Fb(t,32),e.frameCount=Mb(t,40),e.depth=Mb(t,74),78}function $b(e,t){return e.dataReferenceIndex=Mb(t,6),e.channelCount=Mb(t,16),e.sampleSize=Mb(t,18),e.sampleRate=Fb(t,24)/65536,28}function Jb(e,t,i){if(!e)return;if(e.size!==e.data.length)throw new Error(`box ${e.type} size !== data.length`);const s={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(s.version=e.data[e.headerSize],s.flags=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}(e.data,e.headerSize+1),s.headerSize+=4),i(s,e.data.subarray(s.headerSize),s.start+s.headerSize),s}ah(Wb,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);const qb=function(e,t,i){const s=String(i),r=t>>0;let o=Math.ceil(r/s.length);const a=[],n=String(e);for(;o--;)a.push(s);return a.join("").substring(0,r-n.length)+n},Kb=function(){const e=[];for(var t=arguments.length,i=new Array(t),s=0;s{e.push(qb(Number(t).toString(16),2,0))})),e[0]};class Yb{static probe(e){return!!Yb.findBox(e,["ftyp"])}static findBox(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=[];if(!e)return s;let r=0,o="",a=0;for(;e.length>7;){if(r=Fb(e),o=String.fromCharCode.apply(null,e.subarray(4,8)),a=8,1===r?(r=Ub(e,8),a+=8):r||(r=e.length),!t[0]||o===t[0]){const n=e.subarray(0,r);if(!(t.length<2))return Yb.findBox(n.subarray(a),t.slice(1),i+a);s.push({start:i,size:r,headerSize:a,type:o,data:n})}i+=r,e=e.subarray(r)}return s}static tfhd(e){return Jb(e,!0,((e,t)=>{e.trackId=Fb(t);let i=4;const s=1&e.flags,r=2&e.flags,o=8&e.flags,a=16&e.flags,n=32&e.flags;s&&(i+=4,e.baseDataOffset=Fb(t,i),i+=4),r&&(e.sampleDescriptionIndex=Fb(t,i),i+=4),o&&(e.defaultSampleDuration=Fb(t,i),i+=4),a&&(e.defaultSampleSize=Fb(t,i),i+=4),n&&(e.defaultSampleFlags=Fb(t,i))}))}static sidx(e){return Jb(e,!0,((e,t)=>{let i=0;e.reference_ID=Fb(t,i),i+=4,e.timescale=Fb(t,i),i+=4,0===e.version?(e.earliest_presentation_time=Fb(t,i),i+=4,e.first_offset=Fb(t,i),i+=4):(e.earliest_presentation_time=Ub(t,i),i+=8,e.first_offset=Ub(t,i),i+=8),i+=2,e.references=[];const s=Mb(t,i);i+=2;for(let r=0;r>31&1,s.referenced_size=2147483647&r,s.subsegment_duration=Fb(t,i),i+=4,r=Fb(t,i),i+=4,s.starts_with_SAP=r>>31&1,s.SAP_type=r>>28&7,s.SAP_delta_time=268435455&r}}))}static moov(e){return Jb(e,!1,((e,t,i)=>{e.mvhd=Yb.mvhd(Yb.findBox(t,["mvhd"],i)[0]),e.trak=Yb.findBox(t,["trak"],i).map((e=>Yb.trak(e))),e.pssh=Yb.pssh(Yb.findBox(t,["pssh"],i)[0])}))}static mvhd(e){return Jb(e,!0,((e,t)=>{let i=0;1===e.version?(e.timescale=Fb(t,16),e.duration=Ub(t,20),i+=28):(e.timescale=Fb(t,8),e.duration=Fb(t,12),i+=16),e.nextTrackId=Fb(t,i+76)}))}static trak(e){return Jb(e,!1,((e,t,i)=>{e.tkhd=Yb.tkhd(Yb.findBox(t,["tkhd"],i)[0]),e.mdia=Yb.mdia(Yb.findBox(t,["mdia"],i)[0])}))}static tkhd(e){return Jb(e,!0,((e,t)=>{let i=0;1===e.version?(e.trackId=Fb(t,16),e.duration=Ub(t,24),i+=32):(e.trackId=Fb(t,8),e.duration=Fb(t,16),i+=20),e.width=Fb(t,i+52),e.height=Fb(t,i+56)}))}static mdia(e){return Jb(e,!1,((e,t,i)=>{e.mdhd=Yb.mdhd(Yb.findBox(t,["mdhd"],i)[0]),e.hdlr=Yb.hdlr(Yb.findBox(t,["hdlr"],i)[0]),e.minf=Yb.minf(Yb.findBox(t,["minf"],i)[0])}))}static mdhd(e){return Jb(e,!0,((e,t)=>{let i=0;1===e.version?(e.timescale=Fb(t,16),e.duration=Ub(t,20),i+=28):(e.timescale=Fb(t,8),e.duration=Fb(t,12),i+=16);const s=Mb(t,i);e.language=String.fromCharCode(96+(s>>10&31),96+(s>>5&31),96+(31&s))}))}static hdlr(e){return Jb(e,!0,((e,t)=>{0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}static minf(e){return Jb(e,!1,((e,t,i)=>{e.vmhd=Yb.vmhd(Yb.findBox(t,["vmhd"],i)[0]),e.smhd=Yb.smhd(Yb.findBox(t,["smhd"],i)[0]),e.stbl=Yb.stbl(Yb.findBox(t,["stbl"],i)[0])}))}static vmhd(e){return Jb(e,!0,((e,t)=>{e.graphicsmode=Mb(t),e.opcolor=[Mb(t,2),Mb(t,4),Mb(t,6)]}))}static smhd(e){return Jb(e,!0,((e,t)=>{e.balance=Mb(t)}))}static stbl(e){return Jb(e,!1,((e,t,i)=>{var s,r,o;e.stsd=Yb.stsd(Yb.findBox(t,["stsd"],i)[0]),e.stts=Yb.stts(Yb.findBox(t,["stts"],i)[0]),e.ctts=Yb.ctts(Yb.findBox(t,["ctts"],i)[0]),e.stsc=Yb.stsc(Yb.findBox(t,["stsc"],i)[0]),e.stsz=Yb.stsz(Yb.findBox(t,["stsz"],i)[0]),e.stco=Yb.stco(Yb.findBox(t,["stco"],i)[0]),e.stco||(e.co64=Yb.co64(Yb.findBox(t,["co64"],i)[0]),e.stco=e.co64);const a=null===(s=e.stsd.entries[0])||void 0===s||null===(r=s.sinf)||void 0===r||null===(o=r.schi)||void 0===o?void 0:o.tenc.default_IV_size;e.stss=Yb.stss(Yb.findBox(t,["stss"],i)[0]),e.senc=Yb.senc(Yb.findBox(t,["senc"],i)[0],a)}))}static senc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return Jb(e,!0,((e,i)=>{let s=0;const r=Fb(i,s);s+=4,e.samples=[];for(let o=0;o{const i=[],s=[];let r=0;for(let e=0;e<16;e++)s.push(Kb(t[r+e]));if(r+=16,e.version>0){const e=Fb(t,r);r+=4;for(let s=0;s<(""+e).length;s++)for(let e=0;e<16;e++){const e=t[r];r+=1,i.push(Kb(e))}}const o=Fb(t,r);e.data_size=o,r+=4,e.kid=i,e.system_id=s,e.buffer=t}))}static stsd(e){return Jb(e,!0,((e,t,i)=>{e.entryCount=Fb(t),e.entries=Yb.findBox(t.subarray(4),[],i+4).map((e=>{switch(e.type){case"avc1":case"avc2":case"avc3":case"avc4":return Yb.avc1(e);case"hvc1":case"hev1":return Yb.hvc1(e);case"mp4a":return Yb.mp4a(e);case"alaw":case"ulaw":return Yb.alaw(e);case"enca":return Jb(e,!1,((e,t,i)=>{e.channelCount=Mb(t,16),e.samplesize=Mb(t,18),e.sampleRate=Fb(t,24)/65536,t=t.subarray(28),e.sinf=Yb.sinf(Yb.findBox(t,["sinf"],i)[0]),e.esds=Yb.esds(Yb.findBox(t,["esds"],i)[0])}));case"encv":return Jb(e,!1,((e,t,i)=>{e.width=Mb(t,24),e.height=Mb(t,26),e.horizresolution=Fb(t,28),e.vertresolution=Fb(t,32),t=t.subarray(78),e.sinf=Yb.sinf(Yb.findBox(t,["sinf"],i)[0]),e.avcC=Yb.avcC(Yb.findBox(t,["avcC"],i)[0]),e.hvcC=Yb.hvcC(Yb.findBox(t,["hvcC"],i)[0]),e.pasp=Yb.pasp(Yb.findBox(t,["pasp"],i)[0])}))}})).filter(Boolean)}))}static tenc(e){return Jb(e,!1,((e,t)=>{let i=6;e.default_IsEncrypted=t[i],i+=1,e.default_IV_size=t[i],i+=1,e.default_KID=[];for(let s=0;s<16;s++)e.default_KID.push(Kb(t[i])),i+=1}))}static schi(e){return Jb(e,!1,((e,t,i)=>{e.tenc=Yb.tenc(Yb.findBox(t,["tenc"],i)[0])}))}static sinf(e){return Jb(e,!1,((e,t,i)=>{e.schi=Yb.schi(Yb.findBox(t,["schi"],i)[0]),e.frma=Yb.frma(Yb.findBox(t,["frma"],i)[0])}))}static frma(e){return Jb(e,!1,((e,t)=>{e.data_format="";for(let i=0;i<4;i++)e.data_format+=String.fromCharCode(t[i])}))}static avc1(e){return Jb(e,!1,((e,t,i)=>{const s=Hb(e,t),r=t.subarray(s);i+=s,e.avcC=Yb.avcC(Yb.findBox(r,["avcC"],i)[0]),e.pasp=Yb.pasp(Yb.findBox(r,["pasp"],i)[0])}))}static avcC(e){return Jb(e,!1,((e,t)=>{e.configurationVersion=t[0],e.AVCProfileIndication=t[1],e.profileCompatibility=t[2],e.AVCLevelIndication=t[3],e.codec=function(e){let t,i="avc1.";for(let s=0;s<3;s++)t=e[s].toString(16),t.length<2&&(t=`0${t}`),i+=t;return i}([t[1],t[2],t[3]]),e.lengthSizeMinusOne=3&t[4],e.spsLength=31&t[5],e.sps=[];let i=6;for(let s=0;s{const s=Hb(e,t),r=t.subarray(s);i+=s,e.hvcC=Yb.hvcC(Yb.findBox(r,["hvcC"],i)[0]),e.pasp=Yb.pasp(Yb.findBox(r,["pasp"],i)[0])}))}static hvcC(e){return Jb(e,!1,((t,i)=>{t.data=e.data,t.codec="hev1.1.6.L93.B0",t.configurationVersion=i[0];const s=i[1];t.generalProfileSpace=s>>6,t.generalTierFlag=(32&s)>>5,t.generalProfileIdc=31&s,t.generalProfileCompatibility=Fb(i,2),t.generalConstraintIndicatorFlags=i.subarray(6,12),t.generalLevelIdc=i[12],t.avgFrameRate=Mb(i,19),t.numOfArrays=i[22],t.vps=[],t.sps=[],t.pps=[];let r=23,o=0,a=0,n=0;for(let e=0;e{e.hSpacing=Fb(t),e.vSpacing=Fb(t,4)}))}static mp4a(e){return Jb(e,!1,((e,t,i)=>{const s=$b(e,t);e.esds=Yb.esds(Yb.findBox(t.subarray(s),["esds"],i+s)[0])}))}static esds(e){return Jb(e,!0,((e,t)=>{e.codec="mp4a.";let i=0,s=0,r=0,o=0;for(;t.length;){for(i=0,o=t[i],s=t[i+1],i+=2;128&s;)r=(127&s)<<7,s=t[i],i+=1;if(r+=127&s,3===o)t=t.subarray(i+3);else{if(4!==o){if(5===o){const s=e.config=t.subarray(i,i+r);let o=(248&s[0])>>3;return 31===o&&s.length>=2&&(o=32+((7&s[0])<<3)+((224&s[1])>>5)),e.objectType=o,e.codec+=o.toString(16),void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}return void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}e.codec+=(t[i].toString(16)+".").padStart(3,"0"),t=t.subarray(i+13)}}}))}static alaw(e){return Jb(e,!1,((e,t)=>{$b(e,t)}))}static stts(e){return Jb(e,!0,((e,t)=>{const i=Fb(t),s=[];let r=4;for(let e=0;e{const i=Fb(t),s=[];let r=4;if(1===e.version)for(let e=0;e{const i=Fb(t),s=[];let r=4;for(let e=0;e{const i=Fb(t),s=Fb(t,4),r=[];if(!i){let e=8;for(let i=0;i{const i=Fb(t),s=[];let r=4;for(let e=0;e{const i=Fb(t),s=[];let r=4;for(let e=0;e{const i=Fb(t),s=[];let r=4;for(let e=0;e{e.mfhd=Yb.mfhd(Yb.findBox(t,["mfhd"],i)[0]),e.traf=Yb.findBox(t,["traf"],i).map((e=>Yb.traf(e)))}))}static mfhd(e){return Jb(e,!0,((e,t)=>{e.sequenceNumber=Fb(t)}))}static traf(e){return Jb(e,!1,((e,t,i)=>{e.tfhd=Yb.tfhd(Yb.findBox(t,["tfhd"],i)[0]),e.tfdt=Yb.tfdt(Yb.findBox(t,["tfdt"],i)[0]),e.trun=Yb.trun(Yb.findBox(t,["trun"],i)[0])}))}static trun(e){return Jb(e,!0,((e,t)=>{const{version:i,flags:s}=e,r=t.length,o=e.sampleCount=Fb(t);let a=4;if(r>a&&1&s&&(e.dataOffset=-(1+~Fb(t,a)),a+=4),r>a&&4&s&&(e.firstSampleFlags=Fb(t,a),a+=4),e.samples=[],r>a){let r;for(let n=0;n{1===e.version?e.baseMediaDecodeTime=Ub(t):e.baseMediaDecodeTime=Fb(t)}))}static probe(e){return!!Yb.findBox(e,["ftyp"])}static parseSampleFlags(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}}static moovToTrack(e,t,i){var s,r;const o=e.trak;if(!o||!o.length)return;const a=o.find((e=>{var t,i;return"vide"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)})),n=o.find((e=>{var t,i;return"soun"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)}));if(a&&t){var l,d,h,c,u,p,f;const i=t,s=null===(l=a.tkhd)||void 0===l?void 0:l.trackId;null!=s&&(i.id=a.tkhd.trackId),i.tkhdDuration=a.tkhd.duration,i.mvhdDurtion=e.mvhd.duration,i.mvhdTimecale=e.mvhd.timescale,i.timescale=i.formatTimescale=a.mdia.mdhd.timescale,i.duration=a.mdia.mdhd.duration||i.mvhdDurtion/i.mvhdTimecale*i.timescale;const r=a.mdia.minf.stbl.stsd.entries[0];if(i.width=r.width,i.height=r.height,r.pasp&&(i.sarRatio=[r.pasp.hSpacing,r.pasp.vSpacing]),r.hvcC)i.codecType=zb,i.codec=r.hvcC.codec,i.vps=r.hvcC.vps,i.sps=r.hvcC.sps,i.pps=r.hvcC.pps,i.hvcC=r.hvcC.data;else{if(!r.avcC)throw new Error("unknown video stsd entry");i.codecType=Gb,i.codec=r.avcC.codec,i.sps=r.avcC.sps,i.pps=r.avcC.pps}var m,g,y,A,b,v,_,S;if(i.present=!0,i.ext={},i.ext.stss=null===(d=a.mdia)||void 0===d||null===(h=d.minf)||void 0===h||null===(c=h.stbl)||void 0===c?void 0:c.stss,i.ext.ctts=null===(u=a.mdia)||void 0===u||null===(p=u.minf)||void 0===p||null===(f=p.stbl)||void 0===f?void 0:f.ctts,r&&"encv"===r.type)i.isVideoEncryption=!0,r.default_KID=null===(m=r.sinf)||void 0===m||null===(g=m.schi)||void 0===g?void 0:g.tenc.default_KID,r.default_IsEncrypted=null===(y=r.sinf)||void 0===y||null===(A=y.schi)||void 0===A?void 0:A.tenc.default_IsEncrypted,r.default_IV_size=null===(b=r.sinf)||void 0===b||null===(v=b.schi)||void 0===v?void 0:v.tenc.default_IV_size,i.videoSenc=a.mdia.minf.stbl.senc&&a.mdia.minf.stbl.senc.samples,r.data_format=null===(_=r.sinf)||void 0===_||null===(S=_.frma)||void 0===S?void 0:S.data_format,i.useEME=e.useEME,i.kidValue=e.kidValue,i.pssh=e.pssh,i.encv=r}if(n&&i){var E,w,T,k,L,C,D,x,R;const t=i,o=null===(E=n.tkhd)||void 0===E?void 0:E.trackId;null!=o&&(t.id=n.tkhd.trackId),t.tkhdDuration=n.tkhd.duration,t.mvhdDurtion=e.mvhd.duration,t.mvhdTimecale=e.mvhd.timescale,t.timescale=t.formatTimescale=n.mdia.mdhd.timescale,t.duration=n.mdia.mdhd.duration||t.mvhdDurtion/t.mvhdTimecale*t.timescale;const a=n.mdia.minf.stbl.stsd.entries[0];switch(t.sampleSize=a.sampleSize,t.sampleRate=a.sampleRate,t.channelCount=a.channelCount,t.present=!0,a.type){case"alaw":t.codecType=t.codec=Nb,t.sampleRate=8e3;break;case"ulaw":t.codecType=t.codec=jb,t.sampleRate=8e3;break;default:t.codecType=Ob,t.sampleDuration=Wb.getFrameDuration(t.sampleRate,t.timescale),t.sampleRateIndex=Wb.getRateIndexByRate(t.sampleRate),t.objectType=(null===(s=a.esds)||void 0===s?void 0:s.objectType)||2,a.esds&&(t.config=Array.from(a.esds.config)),t.codec=(null===(r=a.esds)||void 0===r?void 0:r.codec)||"mp4a.40.2"}var P,B,I,M,F,U,O,N;if(t.sampleDuration=Wb.getFrameDuration(t.sampleRate,t.timescale),t.objectType=(null===(w=a.esds)||void 0===w?void 0:w.objectType)||2,a.esds&&(a.esds.config?t.config=Array.from(a.esds.config):console.warn("esds config is null")),t.codec=(null===(T=a.esds)||void 0===T?void 0:T.codec)||"mp4a.40.2",t.sampleRateIndex=Wb.getRateIndexByRate(t.sampleRate),t.ext={},t.ext.stss=null===(k=n.mdia)||void 0===k||null===(L=k.minf)||void 0===L||null===(C=L.stbl)||void 0===C?void 0:C.stss,t.ext.ctts=null===(D=n.mdia)||void 0===D||null===(x=D.minf)||void 0===x||null===(R=x.stbl)||void 0===R?void 0:R.ctts,t.present=!0,a&&"enca"===a.type)t.isAudioEncryption=!0,a.data_format=null===(P=a.sinf)||void 0===P||null===(B=P.frma)||void 0===B?void 0:B.data_format,a.default_KID=null===(I=a.sinf)||void 0===I||null===(M=I.schi)||void 0===M?void 0:M.tenc.default_KID,a.default_IsEncrypted=null===(F=a.sinf)||void 0===F||null===(U=F.schi)||void 0===U?void 0:U.tenc.default_IsEncrypted,a.default_IV_size=null===(O=a.sinf)||void 0===O||null===(N=O.schi)||void 0===N?void 0:N.tenc.default_IV_size,t.audioSenc=n.mdia.minf.stbl.senc&&n.mdia.minf.stbl.senc.samples,t.useEME=e.useEME,t.kidValue=e.kidValue,t.enca=a}if(i&&(i.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!i&&i.isAudioEncryption),null!=t&&t.encv||null!=i&&i.enca){var j,G;const e=null==t||null===(j=t.encv)||void 0===j?void 0:j.default_KID,s=null==i||null===(G=i.enca)||void 0===G?void 0:G.default_KID,r=e||s?(e||s).join(""):null;t&&(t.kid=r),i&&(i.kid=r)}return t&&(t.flags=3841),i&&(i.flags=1793),{videoTrack:t,audioTrack:i}}static evaluateDefaultDuration(e,t,i){var s;const r=null==t||null===(s=t.samples)||void 0===s?void 0:s.length;if(!r)return 1024;return 1024*r/t.timescale*e.timescale/i}static moofToSamples(e,t,i){const s={};return e.mfhd&&(t&&(t.sequenceNumber=e.mfhd.sequenceNumber),i&&(i.sequenceNumber=e.mfhd.sequenceNumber)),e.traf.forEach((e=>{let{tfhd:r,tfdt:o,trun:a}=e;if(!r||!a)return;o&&(t&&t.id===r.trackId&&(t.baseMediaDecodeTime=o.baseMediaDecodeTime),i&&i.id===r.trackId&&(i.baseMediaDecodeTime=o.baseMediaDecodeTime));const n=r.defaultSampleSize||0,l=r.defaultSampleDuration||Yb.evaluateDefaultDuration(t,i,a.samples.length||a.sampleCount);let d=a.dataOffset||0,h=0,c=-1;if(!a.samples.length&&a.sampleCount){s[r.trackId]=[];for(let e=0;e((e={offset:d,dts:h,pts:h+(e.cts||0),duration:e.duration||l,size:e.size||n,gopId:c,keyframe:0===t||null!==e.flags&&void 0!==e.flags&&(65536&e.flags)>>>0!=65536}).keyframe&&(c++,e.gopId=c),h+=e.duration,d+=e.size,e)))})),s}static moovToSamples(e){const t=e.trak;if(!t||!t.length)return;const i=t.find((e=>{var t,i;return"vide"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)})),s=t.find((e=>{var t,i;return"soun"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)}));if(!i&&!s)return;let r,o;if(i){var a,n;const e=null===(a=i.mdia)||void 0===a||null===(n=a.minf)||void 0===n?void 0:n.stbl;if(!e)return;const{stts:t,stsc:s,stsz:o,stco:l,stss:d,ctts:h}=e;if(!(t&&s&&o&&l&&d))return;r=Vb(t,s,o,l,h,d)}if(s){var l,d,h;const e=null===(l=s.mdia)||void 0===l||null===(d=l.minf)||void 0===d?void 0:d.stbl;if(!e)return;const t=null===(h=s.mdia.mdhd)||void 0===h?void 0:h.timescale,{stts:i,stsc:r,stsz:a,stco:n}=e;if(!(t&&i&&r&&a&&n))return;o=Vb(i,r,a,n)}return{videoSamples:r,audioSamples:o}}}class Qb extends Kd{constructor(e){super(e),this.player=e,this.TAG_NAME="HlsFmp4Loader",this.tempSampleListInfo={},this.isInitVideo=!1,this.isInitAudio=!1,this.videoTrack={id:1,samples:[],sps:[],pps:[],vps:[],codec:""},this.audioTrack={id:2,samples:[],sampleRate:0,channelCount:0,codec:"",codecType:""},this.workerClearTimeout=null,this.workerUrl=null,this.loopWorker=null,this._hasCalcFps=!1,this._tempSampleTsList=[],this._basefps=25,this._isUseWorker()&&this._initLoopWorker(),e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.workerUrl&&(URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.loopWorker&&(this.loopWorker.postMessage({cmd:"destroy"}),this.loopWorker.terminate(),this.loopWorker=null),this._hasCalcFps=!1,this._tempSampleTsList=[],this.videoTrack=null,this.audioTrack=null,this.isInitVideo=!1,this.isInitAudio=!1,this._basefps=25,this.player.debugLog(this.TAG_NAME,"destroy")}demux(e,t){let i=this.audioTrack,s=this.videoTrack;if(this.checkInitAudio(),this.checkInitVideo(),i.samples=[],s.samples=[],t){if(this.player.updateStats({abps:t.byteLength}),ua(this.isInitAudio)){const e=Yb.findBox(t,["moov"])[0];if(!e)return void this.player.debugError(this.TAG_NAME,"cannot found moov box");Yb.moovToTrack(Yb.moov(e),null,i),this.checkInitAudio()&&(this.player.debugLog(this.TAG_NAME,"audioData audio init success"),this._sendAccADTSHeader(i))}const e=Yb.findBox(t,["moof"])[0];if(e){const s=Yb.moofToSamples(Yb.moof(e),null,i)[i.id],r=i.baseMediaDecodeTime;if(s){const o=e.start;s.map((e=>{e.offset+=o;const s=t.subarray(e.offset,e.offset+e.size),a=e.dts+r,n=new Uint8Array(s.length+2);n.set([175,1],0),n.set(s,2),i.samples.push({type:Fe,pts:a,dts:a,payload:n,duration:e.duration,size:n.byteLength})}))}}}if(e){if(this.player.updateStats({vbps:e.byteLength}),ua(this.isInitVideo)&&ua(this.isInitAudio)){const t=Yb.findBox(e,["moov"])[0];if(!t)throw new Error("cannot found moov box");if(Yb.moovToTrack(Yb.moov(t),s,i),ua(this.isInitAudio)&&this.checkInitAudio()&&(this.player.debugLog(this.TAG_NAME,"videoData audio init success",i),this._sendAccADTSHeader(i)),this.checkInitVideo()){this.player.debugLog(this.TAG_NAME,"video init success");let e=null;s.codecType===is?s.sps.length&&s.vps.length&&s.pps.length&&(e=Vn({sps:s.sps[0],pps:s.pps[0],vps:s.vps[0]})):s.sps.length&&s.pps.length&&(e=xn({sps:s.sps[0],pps:s.pps[0]})),e&&(this.player.debugLog(this.TAG_NAME,"seqHeader"),this._doDecodeByHls(e,Ue,0,!0,0))}}const t=Yb.findBox(e,["moof"])[0];if(t){const r=Yb.moofToSamples(Yb.moof(t),s,i),o=s.baseMediaDecodeTime,a=i.baseMediaDecodeTime,n=t.start;Object.keys(r).forEach((t=>{s.id==t?r[t].map((t=>{t.offset+=n;const i={type:Ue,pts:(t.pts||t.dts)+o,dts:t.dts+o,units:[],payload:null,isIFrame:!1};i.duration=t.duration,i.gopId=t.gopId,t.keyframe&&(i.isIFrame=!0);const r=e.subarray(t.offset,t.offset+t.size);i.payload=r,s.samples.push(i)})):i.id==t&&r[t].map((t=>{t.offset+=n;const s=e.subarray(t.offset,t.offset+t.size),r=t.dts+a,o=new Uint8Array(s.length+2);o.set([175,1],0),o.set(s,2),i.samples.push({type:Fe,pts:r,dts:r,payload:o,duration:t.duration,size:o.byteLength})}))}))}}const r=s.samples.concat(i.samples);r.sort(((e,t)=>e.dts-t.dts)),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,this._isUseWorker()?this.loopWorker.postMessage({...e,payload:t,cmd:"sample"},[t.buffer]):e.type===Ue?this._doDecodeVideo({...e,payload:t}):e.type===Fe&&this._doDecodeAudio({...e,payload:t})})),ua(this._hasCalcFps)&&this._isUseWorker()&&(this._hasCalcFps=this._calcDecodeFps(r))}checkInitAudio(){return this.isInitAudio=!!(this.audioTrack.sampleRate&&this.audioTrack.channelCount&&this.audioTrack.codec&&"aac"===this.audioTrack.codecType),this.isInitAudio}checkInitVideo(){return this.isInitVideo=!!(this.videoTrack.pps.length&&this.videoTrack.sps.length&&this.videoTrack.codec),this.isInitVideo}_sendAccADTSHeader(e){const t=Pr({profile:e.objectType,sampleRate:e.sampleRateIndex,channel:e.channelCount});this._doDecodeByHls(t,Fe,0,!0,0)}_calcDecodeFps(e){const t=e.map((e=>({ts:e.dts||e.pts,type:e.type})));this._tempSampleTsList=this._tempSampleTsList.concat(t);const i=sa(this._tempSampleTsList,Ue);if(i)this._tempSampleTsList=[],this.player.debugLog(this.TAG_NAME,`_calcDecodeFps() video fps is ${i}, update base fps is ${this._basefps}`),this._basefps=i,this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps});else if(this.player.debugLog(this.TAG_NAME,"_calcDecodeFps() streamVideoFps is null"),this._tempSampleTsList.length>200)return this.player.debugLog(this.TAG_NAME,`_calcDecodeFps() _tempSampleTsList is more than 200, clear and use base fps update ${this._basefps}`),this._tempSampleTsList=[],this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps}),!0;return null!==i}_isUseWorker(){return!this.player.isUseMSE()}_initLoopWorker(){this.player.debugLog(this.TAG_NAME,"_initLoopWorker()");const e=ya(function(){const e=1,t=2;let i=new class{constructor(){this.baseFps=0,this.fpsInterval=null,this.preLoopTimestamp=null,this.startBpsTime=null,this.allSampleList=[]}destroy(){this._clearInterval(),this.baseFps=0,this.allSampleList=[],this.preLoopTimestamp=null,this.startBpsTime=null}updateBaseFps(e){this.baseFps=e,this._clearInterval(),this._startInterval()}pushSample(e){delete e.cmd,this.allSampleList.push(e)}_startInterval(){const e=Math.ceil(1e3/this.baseFps);this.fpsInterval=setInterval((()=>{let t=(new Date).getTime();this.preLoopTimestamp||(this.preLoopTimestamp=t),this.startBpsTime||(this.startBpsTime=t);const i=t-this.preLoopTimestamp;if(i>2*e&&console.warn(`JbPro:[HlsFmp4Loader LoopWorker] loop interval is ${i}ms, more than ${e} * 2ms`),this._loop(),this.preLoopTimestamp=(new Date).getTime(),this.startBpsTime){t-this.startBpsTime>=1e3&&(this._calcSampleList(),this.startBpsTime=t)}}),e)}_clearInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_calcSampleList(){const i={buferredDuration:0,allListLength:this.allSampleList.length,audioListLength:0,videoListLength:0};this.allSampleList.forEach((s=>{s.type===t?(i.videoListLength++,s.duration&&(i.buferredDuration+=s.duration)):s.type===e&&i.audioListLength++})),postMessage({cmd:"sampleListInfo",...i})}_loop(){let i=null;if(this.allSampleList.length)if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]);let t=this.allSampleList[0];for(;t&&t.type===e;)i=this.allSampleList.shift(),postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),t=this.allSampleList[0]}else if(i.type===e){postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]);let s=this.allSampleList[0];for(;s;){if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]),s=null;break}i.type===e&&(postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),s=this.allSampleList[0])}}}};self.onmessage=e=>{const t=e.data;switch(t.cmd){case"updateBaseFps":i.updateBaseFps(t.baseFps);break;case"sample":i.pushSample(t);break;case"destroy":i.destroy(),i=null}}}.toString()),t=new Blob([e],{type:"text/javascript"}),i=URL.createObjectURL(t);let s=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((()=>{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),te),s.onmessage=e=>{const t=e.data;switch(t.cmd){case"decodeVideo":this._doDecodeVideo(t);break;case"decodeAudio":this._doDecodeAudio(t);break;case"sampleListInfo":this.tempSampleListInfo=t}},this.loopWorker=s}_postMessageToLoopWorker(e,t){this._isUseWorker()&&(this.loopWorker?this.loopWorker.postMessage({cmd:e,...t}):this.player.debugWarn(this.TAG_NAME,"loop worker is not init, can not post message"))}_doDecodeAudio(e){const t=new Uint8Array(e.payload);this.player.updateStats({abps:t.byteLength}),this.cryptoPayloadAudio(t),this._doDecodeByHls(t,Fe,e.dts,!1,0)}_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?Hn(t,e.isIFrame):Rn(t,e.isIFrame),this.player.updateStats({dts:e.dts,vbps:i.byteLength});const s=e.pts-e.dts;let r=this.cryptoPayload(i,e.isIFrame);this._doDecodeByHls(r,Ue,e.dts,e.isIFrame,s)}getBuferredDuration(){return this.tempSampleListInfo.buferredDuration||0}getSampleListLength(){return this.tempSampleListInfo.allListLength||0}getSampleAudioListLength(){return this.tempSampleListInfo.audioListLength||0}getSampleVideoListLength(){return this.tempSampleListInfo.videoListLength||0}}class Xb{constructor(e,t){this.hls=e,this.player=this.hls.player,this.isMP4=t,this._initSegmentId="",this.TAG_NAME="HlsTransmuxer",this._demuxer=t?new Qb(this.hls.player):new Ib(this.hls.player),this.player.debugLog(this.TAG_NAME,`init and isMP4 is ${t}`)}destroy(){this._demuxer&&(this._demuxer.destroy(),this._demuxer=null)}transmux(e,t,i,s,r,o){this.player.debugLog(this.TAG_NAME,`transmux videoChunk:${e&&e.byteLength}, audioChunk:${t&&t.byteLength}, discontinuity:${i}, contiguous:${s}, startTime:${r}, needInit:${o}`);const a=this._demuxer;try{this.isMP4?a.demux(e,t):a.demuxAndFix(gh(e,t),i,s,r)}catch(e){throw new nb(ab,ob,e)}}}class Zb{constructor(e){this.hls=e,this.player=e.player,this._decryptor=new Bb(this.hls,this.player),this._transmuxer=null,this._mse=null,this._softVideo=null,this._sourceCreated=!1,this._needInitSegment=!0,this._directAppend=!1,this.TAG_NAME="HlsBufferService"}async destroy(){this._softVideo=null,this._transmuxer&&(this._transmuxer.destroy(),this._transmuxer=null)}get baseDts(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t._baseDts}get nbSb(){return 0}async updateDuration(e){this.player.debugLog(this.TAG_NAME,"updateDuration()",e)}getBuferredDuration(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getBuferredDuration()}getBufferedSegments(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleListLength()}getBufferedAudioSegments(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleAudioListLength()}getBufferedVideoSegments(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleVideoListLength()}createSource(e,t,i,s){if(this._sourceCreated)return;const r=e||t;r&&(Ib.probe(r)?this._transmuxer||(this._transmuxer=new Xb(this.hls,!1)):Yb.probe(r)?this._transmuxer||(this._transmuxer=new Xb(this.hls,!0)):this.player.debugError(this.TAG_NAME,"createSource error: chunk is not ts"))}async appendBuffer(e,t,i,s,r,o,a){if(null!=i&&i.length||null!=s&&s.length)return this._needInitSegment,this._transmuxer.transmux(i,s,r,o,a,this._needInitSegment||r),!0}async clearAllBuffer(){this.player.debugLog(this.TAG_NAME,"clearAllBuffer")}decryptBuffer(e,t){return this._decryptor.decrypt(e,t)}async reset(){this._transmuxer=null,this._needInitSegment=!0,this._directAppend=!1}async endOfStream(){this._softVideo&&this._softVideo.endOfStream()}async setLiveSeekableRange(e,t){}seamlessSwitch(){this._needInitSegment=!0}}class ev{constructor(e){this.emitter=e,this._seiSet=new Set,e.on(Us,(e=>{e&&this._seiSet.add(e)}))}throw(e){if(null==e||!this._seiSet.size)return;const t=e-.2,i=e+.2,s=[];this._seiSet.forEach((e=>{e.time>=t&&e.time<=i&&s.push(e)})),s.forEach((e=>{this._seiSet.delete(e),this.emitter.emit(Os,e)}))}reset(){this._seiSet.clear()}}class tv{constructor(e){this._timescale=e,this.encodeType="",this.audioCodec="",this.videoCodec="",this.domain="",this.fps=0,this.bitrate=0,this.width=0,this.height=0,this.samplerate=0,this.channelCount=0,this.gop=0,this._bitsAccumulateSize=0,this._bitsAccumulateDuration=0}getStats(){return{encodeType:this.encodeType,audioCodec:this.audioCodec,videoCodec:this.videoCodec,domain:this.domain,fps:this.fps,bitrate:this.bitrate,width:this.width,height:this.height,samplerate:this.samplerate,channelCount:this.channelCount,gop:this.gop}}setEncodeType(e){this.encodeType=e}setFpsFromScriptData(e){var t;let{data:i}=e;const s=null==i||null===(t=i.onMetaData)||void 0===t?void 0:t.framerate;s&&s>0&&s<100&&(this.fps=s)}setVideoMeta(e){if(this.width=e.width,this.height=e.height,this.videoCodec=e.codec,this.encodeType=e.codecType,e.fpsNum&&e.fpsDen){const t=e.fpsNum/e.fpsDen;t>0&&t<100&&(this.fps=t)}}setAudioMeta(e){this.audioCodec=e.codec,this.samplerate=e.sampleRate,this.channelCount=e.channelCount}setDomain(e){this.domain=e.split("/").slice(2,3)[0]}updateBitrate(e){if((!this.fps||this.fps>=100)&&e.length){const t=e.reduce(((e,t)=>e+t.duration),0)/e.length;this.fps=Math.round(this._timescale/t)}e.forEach((e=>{1===e.gopId&&this.gop++,this._bitsAccumulateDuration+=e.duration/(this._timescale/1e3),this._bitsAccumulateSize+=e.units.reduce(((e,t)=>e+t.length),0),this._bitsAccumulateDuration>=1e3&&(this.bitrate=8*this._bitsAccumulateSize,this._bitsAccumulateDuration=0,this._bitsAccumulateSize=0)}))}}class iv{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;ah(this,"_core",null),ah(this,"_samples",[]),this._core=e,this._timescale=t,this._stats=new tv(t),this._bindEvents()}getStats(){var e,t,i,s,r,o,a;const{currentTime:n=0,decodeFps:l=0}=(null===(e=this._core)||void 0===e?void 0:e.media)||{};return{...this._stats.getStats(),downloadSpeed:(null===(t=this._core)||void 0===t||null===(i=t.speedInfo)||void 0===i?void 0:i.call(t).speed)||0,avgSpeed:(null===(s=this._core)||void 0===s||null===(r=s.speedInfo)||void 0===r?void 0:r.call(s).avgSpeed)||0,currentTime:n,bufferEnd:(null===(o=this._core)||void 0===o||null===(a=o.bufferInfo())||void 0===a?void 0:a.remaining)||0,decodeFps:l}}_bindEvents(){this._core.on(Cs,(e=>this._stats.updateBitrate(e.samples))),this._core.on(Ds,(e=>{this._stats.setFpsFromScriptData(e)})),this._core.on(xs,(e=>{"video"===e.type?this._stats.setVideoMeta(e.track):this._stats.setAudioMeta(e.track)})),this._core.on(Rs,(e=>{this._stats.setDomain(e.responseUrl)}))}reset(){this._samples=[],this._stats=new tv(this._timescale)}}class sv extends Ea{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),ah(this,"_loadSegment",(async()=>{if(this._segmentProcessing)return void this.player.debugWarn("_loadSegment()","_segmentProcessing is ture and return");if(!this._playlist)return void this.player.debugWarn("_loadSegment()","this._playlist is null and return");const e=this._playlist.currentSegment,t=this._playlist.nextSegment;if(this.player.debugLog(this.TAG_NAME,"_loadSegment()","curSeg",e&&e.url,"nextSeg",t&&t.url),t)return this._loadSegmentDirect();this.player.debugLog(this.TAG_NAME,"nextSeg is null and return")})),this.player=e,this.config=null,this._manifestLoader=null,this._segmentLoader=null,this._playlist=null,this._bufferService=null,this._seiService=null,this._stats=null,this._prevSegSn=null,this._prevSegCc=null,this._tickTimer=null,this._tickInterval=500,this._segmentProcessing=!1,this._reloadOnPlay=!1,this._switchUrlOpts=null,this._disconnectTimer=null,this.TAG_NAME="Hls256",this.canVideoPlay=!1,this.$videoElement=null,this.config=t=function(e){return{isLive:!0,maxPlaylistSize:50,retryCount:3,retryDelay:1e3,pollRetryCount:2,loadTimeout:1e4,preloadTime:30,softDecode:!1,bufferBehind:10,maxJumpDistance:3,startTime:0,targetLatency:10,maxLatency:20,allowedStreamTrackChange:!0,...e}}(t),this._manifestLoader=new Cb(this),this._segmentLoader=new xb(this),this._playlist=new Pb(this),this._bufferService=new Zb(this),this._seiService=new ev(this),this._stats=new iv(this,9e4),this.player.debugLog(this.TAG_NAME,"init")}async destroy(){this.player.debugLog(this.TAG_NAME,"destroy()"),this._playlist.reset(),this._segmentLoader.reset(),this._seiService.reset(),await Promise.all([this._clear(),this._bufferService.destroy()]),this._manifestLoader&&(await this._manifestLoader.destroy(),this._manifestLoader=null),this._segmentLoader&&(this._segmentLoader.destroy(),this._segmentLoader=null),this._playlist&&(this._playlist.destroy(),this._playlist=null),this.player.debugLog(this.TAG_NAME,"destroy end")}_startTick(){this._stopTick(),this._tickTimer=setTimeout((()=>{this._tick()}),this._tickInterval)}_stopTick(){this._tickTimer&&clearTimeout(this._tickTimer),this._tickTimer=null}_tick(){this.player.isDestroyedOrClosed()?this.player.debugLog(this.TAG_NAME,"_tick() player is destroyed"):(this._startTick(),this._loadSegment())}get isLive(){return this._playlist.isLive}get streams(){return this._playlist.streams}get currentStream(){return this._playlist.currentStream}get hasSubtitle(){return this._playlist.hasSubtitle}get baseDts(){var e;return null===(e=this._bufferService)||void 0===e?void 0:e.baseDts}speedInfo(){return this._segmentLoader.speedInfo()}resetBandwidth(){this._segmentLoader.resetBandwidth()}getStats(){return this._stats.getStats()}async loadSource(e){return await this._reset(),await this._loadData(e),this._startTick(),!0}async _loadData(e){try{e&&(e=e.trim())}catch(e){}if(!e)throw this._emitError(new nb(sb,sb,null,null,"m3u8 url is missing"));const t=await this._loadM3U8(e),{currentStream:i}=this._playlist;if(this._urlSwitching){var s,r;if(0===i.bitrate&&null!==(s=this._switchUrlOpts)&&void 0!==s&&s.bitrate)i.bitrate=null===(r=this._switchUrlOpts)||void 0===r?void 0:r.bitrate;const e=this._getSeamlessSwitchPoint();this.config.startTime=e;const t=this._playlist.findSegmentIndexByTime(e),o=this._playlist.getSegmentByIndex(t+1);if(o){const e=o.start;this.player.debugWarn(this.TAG_NAME,`clear buffer from ${e}`)}}t&&(this.isLive?(this.player.debugLog(this.TAG_NAME,"is live"),this._bufferService.setLiveSeekableRange(0,4294967295),this.config.targetLatency{let[t,i,a]=e;t?(this._playlist.upsertPlaylist(t,i,a),this.isLive&&this._pollM3U8(s,r,o)):this.player.debugWarn(this.TAG_NAME,"_refreshM3U8() mediaPlaylist is empty")})).catch((e=>{throw this._emitError(nb.create(e))}))}_pollM3U8(e,t,i){var s;let r=this._playlist.isEmpty;this._manifestLoader.poll(e,t,i,((e,t,i)=>{this._playlist.upsertPlaylist(e,t,i),this._playlist.clearOldSegment(),e&&r&&!this._playlist.isEmpty&&this._loadSegment(),r&&(r=this._playlist.isEmpty)}),(e=>{this._emitError(nb.create(e))}),1e3*((null===(s=this._playlist.lastSegment)||void 0===s?void 0:s.duration)||0))}async _loadSegmentDirect(){const e=this._playlist.nextSegment;if(!e)return void this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect() !seg");let t=!1,i=null;try{this._segmentProcessing=!0,t=await this._reqAndBufferSegment(e,this._playlist.getAudioSegment(e))}catch(e){i=e}finally{this._segmentProcessing=!1}return i?this._emitError(nb.create(i)):(t?(this._urlSwitching&&(this._urlSwitching=!1,this.emit(js,{url:this.config.url})),this._playlist.moveSegmentPointer(),this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect()","seg.isLast",e.isLast),e.isLast?(this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect()","seg.isLast"),this._end()):(this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect()","and next _loadSegment()"),this._loadSegment())):this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect() not appended"),t)}async _reqAndBufferSegment(e,t){this.player.debugLog(this.TAG_NAME,"video seg",e&&e.url,"audio seg",t&&t.url);const i=e?e.cc:t.cc,s=this._prevSegCc!==i;let r=[];try{r=await this._segmentLoader.load(e,t,s)}catch(e){throw e.fatal=!1,this._segmentLoader.error=e,e}if(!r[0])return;const o=await this._bufferService.decryptBuffer(...r);if(!o)return void this.player.debugLog(this.TAG_NAME,"decryptBuffer return null");const a=e?e.sn:t.sn,n=e?e.start:t.start,l=this._playlist.currentStream;return this._bufferService.createSource(o[0],o[1],null==l?void 0:l.videoCodec,null==l?void 0:l.audioCodec),await this._bufferService.appendBuffer(e,t,o[0],o[1],s,this._prevSegSn===a-1,n),this._prevSegCc=i,this._prevSegSn=a,!0}async _clear(){this.player.debugLog(this.TAG_NAME,"_clear()"),clearTimeout(this._disconnectTimer),this._stopTick(),await Promise.all([this._segmentLoader.cancel(),this._manifestLoader.stopPoll()]),this._segmentProcessing=!1}async _reset(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.player.debugLog(this.TAG_NAME,"_reset()"),this._reloadOnPlay=!1,this._prevSegSn=null,this._prevSegCc=null,this._switchUrlOpts=null,this._playlist.reset(),this._segmentLoader.reset(),this._seiService.reset(),this._stats.reset(),await this._clear(),this._bufferService.reset(e)}_end(){this.player.debugLog(this.TAG_NAME,"_end()"),this._clear()}_emitError(e){var t;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;!1===(null===(t=e.originError)||void 0===t?void 0:t.fatal)?console.warn(e):(console.table(e),console.error(e),console.error(null===(s=this.media)||void 0===s?void 0:s.error),this._stopTick(),this._urlSwitching&&(this._urlSwitching=!1,this.emit(Ns,e)),i&&this._end(),this._seiService.reset(),this.emit(Ws,e));return e}_getSeamlessSwitchPoint(){const{media:e}=this;let t=e.currentTime;if(!e.paused){var i;const s=this._playlist.findSegmentIndexByTime(e.currentTime),r=this._playlist.getSegmentByIndex(s),o=null===(i=this._stats)||void 0===i?void 0:i.getStats().downloadSpeed;if(o&&r){t+=r.duration*this._playlist.currentStream.bitrate/o+1}else t+=5}return t}getDemuxBuferredDuration(){return this._bufferService.getBuferredDuration()||0}getDemuxBufferedListLength(){return this._bufferService.getBufferedSegments()||0}getDemuxAudioBufferedListLength(){return this._bufferService.getBufferedAudioSegments()||0}getDemuxVideoBufferedListLength(){return this._bufferService.getBufferedVideoSegments()||0}}class rv extends Ea{constructor(e){super(),ah(this,"TAG_NAME","Hls256Decoder"),this.player=e,this.$videoElement=this.player.video.$videoElement,this.hls=null,this.eventsDestroy=[],this.bandwidthEstimateInterval=null,this.hls=new sv(e),this._bindEvents()}async destroy(){return this._stopBandwidthEstimateInterval(),this.hls&&(await this.hls.destroy(),this.hls=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this.$videoElement=null,this.player.debugLog(this.TAG_NAME,"destroy"),!0}_bindEvents(){this.hls.on(Ws,(e=>{this.player.emitError(lt.hlsError,e)})),this._startBandwidthEstimateInterval()}_startBandwidthEstimateInterval(){this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((()=>{const e=this.hls.speedInfo();this.player.emit(ot.kBps,(e.avgSpeed/1024/8).toFixed(2)),this.hls.resetBandwidth()}),1e3)}_stopBandwidthEstimateInterval(){this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}async loadSource(e){return this.url=e,await this.hls.loadSource(e),!0}checkHlsBufferedDelay(){let e=0;return this.hls&&(e=this.hls.getDemuxBuferredDuration()),e}getDemuxBufferedListLength(){let e=0;return this.hls&&(e=this.hls.getDemuxBufferedListLength()),e}getDemuxAudioBufferedListLength(){let e=0;return this.hls&&(e=this.hls.getDemuxAudioBufferedListLength()),e}getDemuxVideoBufferedListLength(){let e=0;return this.hls&&(e=this.hls.getDemuxVideoBufferedListLength()),e}}class ov extends Ea{constructor(e,t){if(super(),this.player=e,this.player.$container.classList.add("jb-pro-container-playback"),this._showPrecision=null,this._startTime=null,this._playStartTime=null,this._playingTimestamp=null,this._fps=parseInt(t.fps,10)||e._opt.playbackFps,this._isUseFpsRender=!!ca(t.isUseFpsRender),this._rate=1,this._audioTimestamp=0,this._videoTimestamp=0,this.controlType=t.controlType||Q.normal,t.controlType&&-1===[Q.normal,Q.simple].indexOf(t.controlType)&&(this.player.debugWarn("Playback","constructor()","controlType is not in [normal,simple]",t.controlType),this.controlType=Q.normal),this._currentLocalTimestamp=0,this._localOneFrameTimestamp=t.localOneFrameTimestamp||40,this._localCalculateTimeInterval=null,this._isUseLocalCalculateTime=!!ca(t.isUseLocalCalculateTime),this._isPlaybackPauseClearCache=!ua(t.isPlaybackPauseClearCache),this._isCacheBeforeDecodeForFpsRender=!!ca(t.isCacheBeforeDecodeForFpsRender),this._startfpsTime=null,this._startFpsTimestamp=null,this._checkStatsInterval=null,this._playbackTs=0,this._renderFps=0,this._isUseLocalCalculateTime?this._startLocalCalculateTime():this._listen(),this.playbackList=[],this._playbackListStartTimestamp=null,this._totalDuration=0,t.controlType===Q.normal)this.initPlaybackList(t.playList,t.showPrecision,t.startTime);else if(t.controlType===Q.simple){t.duration&&(this._totalDuration=1e3*t.duration);let e=t.startTime||0;e>this.totalDuration&&(e=this.totalDuration),this.setStartTime(e)}this.player.on(ot.playbackPause,(e=>{e?this.pause():this.resume()}));const i={fps:this._fps,isUseFpsRender:this._isUseFpsRender,localOneFrameTimestamp:this._localOneFrameTimestamp,isUseLocalCalculateTime:this._isUseLocalCalculateTime,uiUsePlaybackPause:t.uiUsePlaybackPause,showControl:t.showControl};try{e.debugLog("Playback","init",JSON.stringify(i))}catch(t){e.debugLog("Playback","init",i)}}destroy(){this._startTime=null,this._showPrecision=null,this._playStartTime=null,this._playingTimestamp=null,this._totalDuration=0,this._audioTimestamp=0,this._videoTimestamp=0,this._fps=null,this._isUseFpsRender=!1,this._rate=1,this.playbackList=[],this._playbackListStartTimestamp=null,this._localCalculateTimeInterval=null,this._currentLocalTimestamp=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._renderFps=0,this._playbackTs=0,this._stopLocalCalculateTime(),this.clearStatsInterval(),this.player.$container&&this.player.$container.classList.remove("jb-pro-container-playback"),this.off(),this.player.debugLog("Playback","destroy")}_listen(){this.player.on(ot.stats,(e=>{const t=e.ts;this._playStartTime||(this._playStartTime=t-1e3);let i=t-this._playStartTime;this.setPlayingTimestamp(i)}))}pause(){this.clearStatsInterval()}resume(){this.startCheckStatsInterval()}updateStats(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._startFpsTimestamp||(this._startFpsTimestamp=Zr()),Do(e.ts)&&(this.player.updateStats({fps:!0,ts:e.ts}),this._playbackTs=e.ts,this._startfpsTime||(this._startfpsTime=e.ts),this._renderFps+=1);const t=Zr(),i=t-this._startFpsTimestamp;if(i<1e3)return;let s=null;this._startfpsTime&&(s=this._playbackTs-this._startfpsTime),this.player.emit(ot.playbackStats,{fps:this._renderFps,rate:this.rate,start:this._startfpsTime,end:this._playbackTs,timestamp:i,dataTimestamp:s,audioBufferSize:this.player.audio?this.player.audio.bufferSize:0,videoBufferSize:this.player.video?this.player.video.bufferSize:0,ts:this._playbackTs}),this._renderFps=0,this._startfpsTime=this._playbackTs,this._startFpsTimestamp=t}updateLocalOneFrameTimestamp(e){this._localOneFrameTimestamp=e}_startLocalCalculateTime(){this._stopLocalCalculateTime(),this._localCalculateTimeInterval=setInterval((()=>{const e=this._currentLocalTimestamp;this._playStartTime||(this._playStartTime=e-1e3);let t=e-this._playStartTime;this.setPlayingTimestamp(t)}),1e3)}startCheckStatsInterval(){this.clearStatsInterval(),this._checkStatsInterval=setInterval((()=>{this.updateStats()}),1e3)}_stopLocalCalculateTime(){this._localCalculateTimeInterval&&(clearInterval(this._localCalculateTimeInterval),this._localCalculateTimeInterval=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}increaseLocalTimestamp(){this._isUseLocalCalculateTime&&(this._currentLocalTimestamp+=this._localOneFrameTimestamp)}initPlaybackList(e,t,i){this.playbackList=e||[];let s=0;if(this.playbackList.forEach(((e,t)=>{10===jo(e.start)?(e.startTimestamp=1e3*e.start,e.startTime=mo(e.startTimestamp)):(e.startTimestamp=e.start,e.startTime=mo(e.startTimestamp)),10===jo(e.end)?(e.endTimestamp=1e3*e.end,e.endTime=mo(e.endTimestamp)):(e.endTimestamp=e.end,e.endTime=mo(e.endTimestamp)),e.duration=e.end-e.start,s+=e.duration})),this._totalDuration=s,this.player.debugLog("Playback",this.playbackList),this.playbackList.length>0){const e=this.playbackList[0].startTimestamp;this._playbackListStartTimestamp=e;let t=e;i&&(10===jo(i)&&(i*=1e3),this._isTimeInPlaybackList(i)&&(t=i)),this.setStartTime(t)}const r=t||Ei;this.setShowPrecision(r)}get totalDuration(){return(this._totalDuration||0)/1e3}get startTime(){return this._startTime||0}setStartTime(e){this._startTime=e,this._playingTimestamp=e,this._playStartTime=null}setRate(e){this._rate=e,this.player.emit(ot.playbackRateChange,e)}get fps(){return this._fps}get rate(){return this._rate}get isUseFpsRender(){return this._isUseFpsRender}get isUseLocalCalculateTime(){return this._isUseLocalCalculateTime}get showPrecision(){return this._showPrecision}get is60Min(){return this.showPrecision===Ei}get is30Min(){return this.showPrecision===wi}get is10Min(){return this.showPrecision===Ti}get is5Min(){return this.showPrecision===ki}get is1Min(){return this.showPrecision===ki}get isPlaybackPauseClearCache(){return this._isPlaybackPauseClearCache}get isCacheBeforeDecodeForFpsRender(){return this._isCacheBeforeDecodeForFpsRender}setShowPrecision(e){Ci.includes(e)||(this.player.debugWarn("Playback","setShowPrecision()","type is not in PLAYBACK_CONTROL_TIME_PRECISION_ARRAY",e),e=Ei),this._showPrecision&&this._showPrecision===e||(this._showPrecision=e,this.player.emit(ot.playbackPrecision,this._showPrecision,this.playbackList),this.player.emit(ot.playbackShowPrecisionChange,this._showPrecision))}setPlayingTimestamp(e){let t;if(this.controlType===Q.normal){t=this.startTime+e,this._playingTimestamp=t,this.player.emit(ot.playbackTime,t);const i=new Date(t);this.player.emit(ot.playbackTimestamp,{ts:t,hour:i.getHours(),min:i.getMinutes(),second:i.getSeconds()})}else this.controlType===Q.simple&&(t=this.startTime+Math.round(e/1e3),t>this.totalDuration&&(this.player.debugLog("Playback","setPlayingTimestamp()",`timestamp ${t} > this.totalDuration ${this.totalDuration}`),t=this.totalDuration),this._playingTimestamp=t,this.player.emit(ot.playbackTime,t),this.player.emit(ot.playbackTimestamp,{ts:t}))}get playingTimestamp(){return this._playingTimestamp}narrowPrecision(){const e=Ci.indexOf(this.showPrecision)-1;if(e>=0){const t=Ci[e];this.setShowPrecision(t)}}expandPrecision(){const e=Ci.indexOf(this.showPrecision)+1;if(e<=Ci.length-1){const t=Ci[e];this.setShowPrecision(t)}}seek(e){if(this.player.debugLog("Playback","seek()",e),this.controlType===Q.normal){if("true"===e.hasRecord){let t=e.time;"min"===e.type&&(t=60*e.time);let i=function(e){let t={};e>-1&&(t={hour:Math.floor(e/60/60)%60,min:Math.floor(e/60)%60,second:e%60});return t}(t);if(this._playbackListStartTimestamp){const e=new Date(this._playbackListStartTimestamp).setHours(i.hour,i.min,i.second,0);i.timestamp=e;const t=this._findMoreInfoByTimestamp(e);i&&t.more&&(i.more=t.more)}this.player.emit(ot.playbackSeek,i)}}else if(this.controlType===Q.simple){let t=e.time;this.player.emit(ot.playbackSeek,{ts:t})}}currentTimeScroll(){this.player.emit(ot.playbackTimeScroll)}_findMoreInfoByTimestamp(e){let t=null;return this.playbackList.forEach(((i,s)=>{i.startTimestamp<=e&&i.endTimestamp>=e&&(t=i)})),t}_isTimeInPlaybackList(e){let t=!1;return this.playbackList.forEach(((i,s)=>{i.startTimestamp<=e&&i.endTimestamp>=e&&(t=!0)})),t}getControlType(){return this.controlType}isControlTypeNormal(){return this.controlType===Q.normal}isControlTypeSimple(){return this.controlType===Q.simple}isPlaybackPauseNotClearCacheAndCacheBeforeDecode(){return ua(this.isPlaybackPauseClearCache)&&this.isCacheBeforeDecodeForFpsRender}isPlaybackPauseNotClearCacheAndCacheBeforeDecodeAndUseFpsRender(){return this.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this.isUseFpsRender}}class av extends Ea{constructor(e){super(),this.player=e,this.TAG_NAME="zoom",this.bindEvents=[],this.isDragging=!1,this.isGesturing=!1,this.currentZoom=1,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,this.prevGestureScale=null,this.prevGestureTouches=[],this._isZooming=!1,this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.player,this.player.on(ot.zooming,this._handleZooming.bind(this)),e.debugLog("zoom","init")}destroy(){this._unbindEvents(),this.bindEvents=[],this.isDragging=!1,this.currentZoom=1,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.off(),this.player.debugLog("zoom","destroy")}_handleZooming(e){if(e){this.player.$container.classList.add("jb-pro-zoom-control"),this._bindEvents();const e=this.player.video.$videoElement.style.transform;let t=this.player.video.$videoElement.offsetLeft,i=this.player.video.$videoElement.offsetTop;t=parseFloat(t),i=parseFloat(i),t&&(this.videoPosition.left=t),i&&(this.videoPosition.top=i),this.prevVideoElementStyleTransform=e;let s=e.match(/scale\([0-9., ]*\)/g);if(s&&s[0]){let e=s[0].replace("scale(","").replace(")","");this.prevVideoElementStyleScale=e.split(",")}this._isZooming=!0}else{this.player.$container.classList.remove("jb-pro-zoom-control"),this._unbindEvents(),this._resetVideoPosition(),this.player.$container.style.cursor="auto";let e=this.prevVideoElementStyleTransform;this.player.video.$videoElement.style.transform=e,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,no()&&this.player._opt.useWebFullScreen&&this.player.resize(),this._isZooming=!1}}_bindEvents(){const{events:{proxy:e}}=this.player,t=_a(),i=e(this.player.$container,t.move,this.handleMouseMove.bind(this)),s=e(this.player.$container,t.down,this.handleMouseDown.bind(this)),r=e(window,t.up,this.handleMouseUp.bind(this));if(this.bindEvents.push(i,s,r),no()&&this.player._opt.zoomSupportGestureInMobile)if(ho()){this.handleGestureChangeThrottle=bo(this.handleGestureChangeForAndroid.bind(this),100);const t=e(this.player.$container,"touchstart",this.handleGestureStartForAndroid.bind(this)),i=e(this.player.$container,"touchmove",this.handleGestureChangeThrottle.bind(this)),s=e(this.player.$container,"touchend",this.handleGestureEndForAndroid.bind(this));this.bindEvents.push(t,i,s)}else{this.handleGestureChangeThrottle=bo(this.handleGestureChange.bind(this),100);const t=e(this.player.$container,"gesturestart",this.handleGestureStart.bind(this)),i=e(this.player.$container,"gesturechange",this.handleGestureChangeThrottle.bind(this)),s=e(this.player.$container,"gestureend",this.handleGestureEnd.bind(this));this.bindEvents.push(t,i,s)}}_unbindEvents(){this.bindEvents.forEach((e=>{e&&e()}))}handleMouseMove(e){if(e.stopPropagation(),this.isDragging&&this.player.zooming){e.preventDefault();const{posX:t,posY:i}=Ko(e),s=this.tempPosition.x-t,r=this.tempPosition.y-i;this.videoPosition.left=this.videoPosition.left-s,this.videoPosition.top=this.videoPosition.top-r,this.tempPosition.x=t,this.tempPosition.y=i,this.updateVideoPosition()}}handleMouseDown(e){e.stopPropagation();const t=$o(e);if(this.player.zooming&&(t.matches("video")||t.matches("canvas"))){e.preventDefault();const{posX:t,posY:i}=Ko(e);this.player.$container.style.cursor="grabbing",this.tempPosition.x=t,this.tempPosition.y=i,this.isDragging=!0,this.player.debugLog("zoom","handleMouseDown is dragging true")}}handleMouseUp(e){e.stopPropagation(),this.isDragging&&this.player.zooming&&(e.preventDefault(),this.tempPosition={x:0,y:0},this.isDragging=!1,this.player.$container.style.cursor="grab",this.player.debugLog("zoom","handleMouseUp is dragging false"))}handleGestureStart(e){e.stopPropagation(),this.player.zooming&&(null===this.prevGestureScale&&(this.prevGestureScale=e.scale),this.isGesturing=!0)}handleGestureStartForAndroid(e){e.stopPropagation(),this.player.zooming&&e.touches.length>=2&&(this.isGesturing=!0,this.prevGestureTouches=e.touches)}handleGestureChangeForAndroid(e){if(e.stopPropagation(),e.preventDefault(),this.player.zooming&&this.isGesturing&&e.touches.length>=2){const s=e.touches,r=t(s[0],s[1])/t(this.prevGestureTouches[0],this.prevGestureTouches[1]);i(s[0],s[1]),i(this.prevGestureTouches[0],this.prevGestureTouches[1]),null===this.prevGestureScale&&(this.prevGestureScale=r);const o=r-this.prevGestureScale,a=this.player._opt.zoomSupportGestureInMobileSpeed;o>0?this.expandPrecision(a):o<0&&this.narrowPrecision(a)}function t(e,t){var i=t.pageX-e.pageX,s=t.pageY-e.pageY;return Math.sqrt(i*i+s*s)}function i(e,t){var i=e.pageX-t.pageX,s=e.pageY-t.pageY;return 180*Math.atan2(s,i)/Math.PI}}handleGestureEndForAndroid(e){e.stopPropagation(),this.player.zooming&&(this.prevGestureScale=null,this.isGesturing=!1,this.prevGestureTouches=[])}handleGestureChange(e){if(e.stopPropagation(),this.player.zooming&&this.isGesturing&&null!==this.prevGestureScale){const t=e.scale,i=t-this.prevGestureScale,s=this.player._opt.zoomSupportGestureInMobileSpeed;i>0?this.expandPrecision(s):i<0&&this.narrowPrecision(s),this.prevGestureScale=t}}handleGestureEnd(e){e.stopPropagation(),this.player.zooming&&(this.prevGestureScale=null,this.isGesturing=!1)}updateVideoPosition(){const e=this.player.video.$videoElement;e.style.left=this.videoPosition.left+"px",e.style.top=this.videoPosition.top+"px"}_resetVideoPosition(){this.player.resize(),this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.currentZoom=1,this.isDragging=!1}narrowPrecision(e){this.currentZoom<=1||(this.currentZoom-=1,this.updateVideoElementScale(e))}expandPrecision(e){this.currentZoom>=this.player._opt.zoomMaxScale||(this.currentZoom+=1,this.updateVideoElementScale(e))}updateCurrentZoom(e,t){e<1||e>this.player._opt.zoomMaxScale||(this.currentZoom=e,this.updateVideoElementScale(t))}updatePrevVideoElementStyleScale(e){this.prevVideoElementStyleScale=e}updateVideoElementScale(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5;const t=this.player.video.$videoElement;let i=t.style.transform,s=1,r=1;if(this.prevVideoElementStyleScale){const e=this.prevVideoElementStyleScale[0];void 0!==e&&(s=e,r=e);const t=this.prevVideoElementStyleScale[1];void 0!==t&&(r=t)}r=yo(r),s=yo(s);const o=e*s*(this.currentZoom-1)+s,a=e*r*(this.currentZoom-1)+r;let n;n=-1===i.indexOf("scale(")?i+` scale(${o},${a})`:i.replace(/scale\([0-9., ]*\)/,`scale(${o},${a})`),this.player.debugLog("zoom",`updateVideoElementScale end is X: ${s} -> ${o}, Y: ${r} -> ${a} style is ${n}`),t.style.transform=n}isZooming(){return this._isZooming}}class nv extends Ea{constructor(e){super(),this.player=e,this.faceDetector=null,this.objectDetector=null,this.imageDetector=null,this.occlusionDetector=null,this.initFaceDetector(),this.initObjectDetector(),this.initImageDetector(),this.initOcclusionDetector();let t="init";this.faceDetector&&(t+=" and use faceDetector"),this.objectDetector&&(t+=" and use objectDetector"),this.imageDetector&&(t+=" and use imageDetector"),this.occlusionDetector&&(t+=" and use occlusionDetector"),this.player.debugLog("AiLoader",t)}destroy(){this.off(),this.faceDetector&&(this.faceDetector.destroy(),this.faceDetector=null),this.objectDetector&&(this.objectDetector.destroy(),this.objectDetector=null),this.imageDetector&&(this.imageDetector.destroy(),this.imageDetector=null),this.occlusionDetector&&(this.occlusionDetector.destroy(),this.occlusionDetector=null),this.player.debugLog("AiLoader","destroy")}initFaceDetector(){if(this.player._opt.useFaceDetector&&window.JessibucaProFaceDetector){const e=new JessibucaProFaceDetector({detectWidth:this.player._opt.aiFaceDetectWidth,showRect:!1,debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debugLog("AiLoader","init face detector success"),this.faceDetector=e,this.faceDetector.on("jessibuca-pro-face-detector-info",(e=>{if(this.player.emit(ot.aiFaceDetectorInfo,e),this.player._opt.aiFaceDetectShowRect){const t=this.player._opt.aiFaceDetectRectConfig||{},i=(e.list||[]).map((e=>(e.type="rect",e.color=t.borderColor||"#0000FF",e.lineWidth=t.borderWidth||2,e)));this.player.video&&this.player.video.addAiContentToCanvas(i)}}))}))}}initObjectDetector(){if(this.player._opt.useObjectDetector&&window.JessibucaProObjectDetector){const e=new JessibucaProObjectDetector({detectWidth:this.player._opt.aiObjectDetectWidth,showRect:!1,debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debugLog("AiLoader","init object detector success"),this.objectDetector=e,this.objectDetector.on("jessibuca-pro-object-detector-info",(e=>{if(this.player.emit(ot.aiObjectDetectorInfo,e),this.player._opt.aiObjectDetectShowRect){const t=[],i=this.player._opt.aiObjectDetectRectConfig||{};(e.list||[]).forEach((e=>{const s={type:"rect",color:i.borderColor||"#0000FF",lineWidth:i.borderWidth||2,x:e.rect.x,y:e.rect.y,width:e.rect.width,height:e.rect.height},r={type:"text",color:i.color||"#000",fontSize:i.fontSize||14,text:e.zh,x:e.rect.x,y:e.rect.y-25};t.push(s,r)})),this.player.video&&this.player.video.addAiContentToCanvas(t)}}))}))}}initImageDetector(){if(this.player._opt.useImageDetector&&window.JessibucaProImageDetector){const e=new JessibucaProImageDetector({debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debugLog("AiLoader","init image detector success"),this.imageDetector=e}))}}initOcclusionDetector(){if(this.player._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector){const e=new JessibucaProOcclusionDetector({debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debugLog("AiLoader","init occlusion detector success"),this.occlusionDetector=e}))}}updateFaceDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.faceDetector&&this.faceDetector.updateConfig(e)}updateObjectDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.objectDetector&&this.objectDetector.updateConfig(e)}updateImageDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.imageDetector&&this.imageDetector.updateConfig(e)}updateOcclusionDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.occlusionDetector&&this.occlusionDetector.updateConfig(e)}}class lv extends Ea{constructor(e){super(),this.player=e,this.LOG_NAME="Contextmenu",this.menuList=[],this.$contextmenus=e.control.$contextmenus,no()?this.player.debugWarn(this.LOG_NAME,"not support mobile"):this.init(),e.debugLog(this.LOG_NAME,"init")}destroy(){this.menuList=[],this.player.debugLog(this.LOG_NAME,"destroy")}get isShow(){return e=this.player.$container,t="jb-pro-contextmenus-show",e.classList.contains(t);var e,t}show(){ec(this.player.$container,"jb-pro-contextmenus-show")}hide(){var e,t;e=this.player.$container,t="jb-pro-contextmenus-show",e.classList.remove(t)}init(){const{events:{proxy:e},debug:t}=this.player;this.player._opt.contextmenuBtns.length>0&&this.player._opt.contextmenuBtns.forEach((e=>{this.addMenuItem(e)})),e(this.player.$container,"contextmenu",(e=>{e.preventDefault(),this.show();const t=e.clientX,i=e.clientY,{height:s,width:r,left:o,top:a}=this.player.$container.getBoundingClientRect(),{height:n,width:l}=this.$contextmenus.getBoundingClientRect();let d=t-o,h=i-a;t+l>o+r&&(d=r-l),i+n>a+s&&(h=s-n),to(this.$contextmenus,{left:`${d}px`,top:`${h}px`})})),e(this.player.$container,"click",(e=>{sc(e,this.$contextmenus)||this.hide()})),this.player.on(ot.blur,(()=>{this.hide()}))}_validateMenuItem(e){let t=!0;return e.content||(this.player.debugWarn(this.LOG_NAME,"content is required"),t=!1),t}addMenuItem(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=na(Es);if(e=Object.assign({},t,e),!this._validateMenuItem(e))return;const{events:{proxy:i},debug:s}=this.player,r=Ao(),o=`\n
\n ${e.content}\n
\n `,a=Array.from(this.$contextmenus.children)[e.index];a?a.insertAdjacentHTML("beforebegin",o):tc(this.$contextmenus,o);const n=this.$contextmenus.querySelector(`.jb-pro-contextmenu-${r}`);e.click&&i(n,"click",(t=>{t.preventDefault(),e.click.call(this.player,this,t),this.hide()})),this.menuList.push({uuid:r,$menuItem:n})}}class dv extends Ea{constructor(e){super(),this.player=e,this.TAG_NAME="CommonWebrtc",this.rtcPeerConnection=null,this.videoStream=null,this.isDisconnected=!1,this.isH264=this.player.isWebrtcH264(),this.eventsDestroy=[],this.supportVideoFrameCallbackHandle=null,this.isInitInfo=!1,this.$videoElement=this.player.video.$videoElement,this.bandwidthEstimateInterval=null,this.rtcPeerTrackVideoReceiver=null,this.rtcPeerTrackAudioReceiver=null,this.prevWebrtcVideoStats={},this.prevWebrtcAudioStats={},this.currentWebrtcStats={},this.player._opt.webrtcUseCanvasRender&&this.isH264&&(this.$videoElement=document.createElement("video"),fo()&&(this.$videoElement.style.position="absolute"),this._initVideoEvents()),this.$videoElement.muted=!0,this._initRtcPeerConnection()}destroy(){if(this.isDisconnected=!1,this.isInitInfo=!1,this.prevWebrtcVideoStats={},this.currentWebrtcStats={},this.rtcPeerTrackVideoReceiver=null,this.rtcPeerTrackAudioReceiver=null,this._stopBandwidthEstimateInterval(),this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this.isH264&&(this.videoStream&&(this.videoStream.getTracks().forEach((e=>e.stop())),this.videoStream=null),this.$videoElement))if(this.player._opt.webrtcUseCanvasRender){this.$videoElement.pause&&(this.$videoElement.pause(),this.$videoElement.muted=!0),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"));try{this.$videoElement.load()}catch(e){}}else this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject"));this.$videoElement=null,this.rtcPeerConnection&&(this.rtcPeerConnection.onicecandidate=Kr,this.rtcPeerConnection.ontrack=Kr,this.rtcPeerConnection.onconnectionstatechange=Kr,this.rtcPeerConnection.ondatachannel=Kr,this.rtcPeerConnection.close(),this.rtcPeerConnection=null)}_initVideoEvents(){const{proxy:e}=this.player.events,t=e(this.$videoElement,Qi,(()=>{this.player.debugLog(this.TAG_NAME,"video canplay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video play"),this._startCanvasRender(),this._initRenderSize()})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video play error ",e)}))})),i=e(this.$videoElement,Xi,(()=>{this.player.debugLog(this.TAG_NAME,"video waiting")})),s=e(this.$videoElement,Zi,(e=>{const t=parseInt(e.timeStamp,10);this.player.handleRender(),this.player.updateStats({ts:t}),this.$videoElement.paused&&(this.player.debugWarn(this.TAG_NAME,"video is paused and next try to replay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video is paused and replay success")})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video is paused and replay error ",e)})))})),r=e(this.$videoElement,es,(()=>{this.player.debugLog(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate)}));this.eventsDestroy.push(t,i,s,r)}_initRtcPeerConnection(){const e=new RTCPeerConnection,t=this.player;e.addTransceiver("video",{direction:"recvonly"}),e.addTransceiver("audio",{direction:"recvonly"}),e.onsignalingstatechange=e=>{this.player.debugLog(this.TAG_NAME,"onsignalingstatechange[本地端的信号状态]",e)},e.onicegatheringstatechange=t=>{this.player.debugLog(this.TAG_NAME,"onicegatheringstatechange[ICE收集状态]",t,e.iceGatheringState)},e.onnegotiationneeded=e=>{this.player.debugLog(this.TAG_NAME,"onnegotiationneeded[通信环境发生变化]",e)},e.oniceconnectionstatechange=i=>{this.player.debugLog(this.TAG_NAME,"oniceconnectionstatechange",e.iceConnectionState);const s=e.iceConnectionState;switch(this.player.emit(ot.webrtcOnIceConnectionStateChange,s),this.isDisconnected="disconnected"===s,e.iceConnectionState){case"new":case"checking":case"closed":case"connected":case"completed":break;case"failed":t.emit(ot.webrtcFailed);break;case"disconnected":t.emit(ot.webrtcDisconnect);break;case"closed":t.emit(ot.webrtcClosed)}},e.onicecandidate=e=>{this.player.debugLog(this.TAG_NAME,"onicecandidate",e),e.candidate&&this.player.debugLog(this.TAG_NAME,"Remote ICE candidate: ",e.candidate.candidate)},e.ontrack=t=>{if(this.player.debugLog(this.TAG_NAME,"ontrack",t),"video"===t.track.kind){this.player.debugLog(this.TAG_NAME,"ontrack video"),this.rtcPeerTrackVideoReceiver=e.getReceivers().find((function(e){return e.track===t.track})),this.rtcPeerTrackVideoReceiver&&this._startBandwidthEstimateInterval();let i=t.streams[0];this.$videoElement.autoplay=!0,this.$videoElement.srcObject=i,this.videoStream=i}else"audio"===t.track.kind&&(this.player.debugLog(this.TAG_NAME,"ontrack audio"),this.rtcPeerTrackAudioReceiver=e.getReceivers().find((function(e){return e.track===t.track})),this.rtcPeerTrackAudioReceiver&&this._startBandwidthEstimateInterval())},e.onicecandidateerror=e=>{this.player.debugLog(this.TAG_NAME,"onicecandidateerror[candidate错误]",e),this.player.emitError(lt.webrtcIceCandidateError,e)},e.onconnectionstatechange=i=>{switch(this.player.debugLog(this.TAG_NAME,"onconnectionstatechange[所有ICE 状态总览]",i),this.player.emit(ot.webrtcOnConnectionStateChange,e.connectionState),e.connectionState){case"new":case"connecting":case"connected":case"disconnected":break;case"failed":this.isDisconnected&&t.emit(ot.webrtcFailed)}},this.rtcPeerConnection=e}_startBandwidthEstimateInterval(){this.player.debugLog(this.TAG_NAME,"_startBandwidthEstimateInterval"),this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((()=>{this.rtcPeerTrackVideoReceiver&&this.rtcPeerTrackVideoReceiver.getStats().then((e=>{let t={},i=0;e.forEach((e=>{if(e)switch(e.type){case ar:("succeeded"===e.state||e.bytesReceived)&&(this.currentWebrtcStats.timestamp=e.timestamp,this.currentWebrtcStats.rtt=e.currentRoundTripTime||-1,this.currentWebrtcStats.bytesReceived=e.bytesReceived||0,this.currentWebrtcStats.bytesSent=e.bytesSent||0);break;case dr:this.currentWebrtcStats.remoteCandidate=e||{};break;case lr:this.currentWebrtcStats.localCandidate=e||{};break;case nr:this.currentWebrtcStats.lastTimeStamp=e.timestamp;const s=((e.timestamp||0)-(this.prevWebrtcVideoStats.timestamp||0))/1e3,r=Number(e.bytesReceived||0)-Number(this.prevWebrtcVideoStats.bytesReceived||0),o=Math.floor(r/s);i+=o,t.vbps=o,this.prevWebrtcVideoStats=e;break;case hr:e.frameWidth&&e.frameHeight&&(this.currentWebrtcStats.frameWidth=e.frameWidth||0,this.currentWebrtcStats.frameHeight=e.frameHeight||0)}})),this.rtcPeerTrackAudioReceiver?this.rtcPeerTrackAudioReceiver.getStats().then((e=>{e.forEach((e=>{if(e&&e.type===nr){this.currentWebrtcStats.lastTimeStamp=e.timestamp;const s=((e.timestamp||0)-(this.prevWebrtcAudioStats.timestamp||0))/1e3,r=Number(e.bytesReceived||0)-Number(this.prevWebrtcAudioStats.bytesReceived||0),o=Math.floor(r/s);i+=o,t.abps=o,this.prevWebrtcAudioStats=e}})),this.player.updateStats(t),this.player.emit(ot.kBps,(i/1024).toFixed(2))})):(this.player.updateStats(t),this.player.emit(ot.kBps,(i/1024).toFixed(2)))}))}),1e3)}_stopBandwidthEstimateInterval(){this.player.debugLog(this.TAG_NAME,"_stopBandwidthEstimateInterval"),this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}_startCanvasRender(){Aa()?this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)):(this._stopCanvasRender(),this.canvasRenderInterval=setInterval((()=>{this.player.video.render({$video:this.$videoElement,ts:0})}),40))}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player.isDestroyedOrClosed()?this.player.debugLog(this.TAG_NAME,"videoFrameCallback() player is destroyed"):(this.player.video.render({$video:this.$videoElement,ts:t.mediaTime||0}),this.player.updateStats({dts:t.mediaTime||0}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)))}_initRenderSize(){this.isInitInfo||(this.player.video.updateVideoInfo({width:this.$videoElement.videoWidth,height:this.$videoElement.videoHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0)}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}isVideoPlaying(){return this.$videoElement&&ua(this.$videoElement.paused)&&ua(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}getVideoBufferTimeRange(){const e=this.$videoElement;let t=null;if(e){const i=e.buffered,s=i.length?i.start(0):0,r=i.length?i.end(i.length-1):0;t={start:s,end:r,diff:r-s}}return t}}class hv extends dv{constructor(e){super(e),this.TAG_NAME="WebrtcForSRSDecoder",this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy")}loadSource(e){return new Promise(((t,i)=>{const s=this.rtcPeerConnection;s.createOffer().then((r=>{s.setLocalDescription(r),this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:t})}(e,r.sdp).then((e=>{this.player.debugLog(this.TAG_NAME,`getWebRtcRemoteSdp response and code is ${e.code}`);const r=e;if(r&&0!==r.code)return this.player.debugError(this.TAG_NAME,`response json code ${r.code}`),i(r.msg);r?s.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:r})).then((()=>{t()})).catch((e=>{this.player&&this.player.debugError(this.TAG_NAME,"loadSource setRemoteDescription error",e.toString(),e),i(e)})):(this.player.debugError(this.TAG_NAME,"response sdp is null"),i("response sdp is null"))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e.toString(),e),i(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e.toString(),e),i(e)}))}))}}class cv extends dv{constructor(e){super(e),this.TAG_NAME="WebrtcForOthersDecoder",this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy")}loadSource(e){return new Promise(((t,i)=>{const s=this.rtcPeerConnection;s.createOffer().then((r=>{s.setLocalDescription(r),this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:t})}(e,r.sdp).then((e=>{this.player.debugLog(this.TAG_NAME,`getWebRtcRemoteSdp response and code is ${e.code}`),e.text().then((e=>{this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp response");try{let t=JSON.parse(e);this.player.debugLog(this.TAG_NAME,"this is json sdp response"),0!=t.code&&(this.player.debugError(this.TAG_NAME,`response json code ${t.code}`),i(new Error(`response sdp json code: ${t.code}`))),e=t.sdp}catch(e){this.player.debugLog(this.TAG_NAME,"this is raw sdp response")}e?s.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})).then((()=>{t()})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource setRemoteDescription error",e.toString(),e),i(e)})):(this.player.debugError(this.TAG_NAME,"loadSource sdp is null"),i("sdp is null"))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource response.text() error",e.toString(),e),i(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e.toString(),e),i(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e.toString(),e),i(e)}))}))}}class uv extends dv{constructor(e){super(e),this.rtcPeerConnectionDataChannel=null,this.player.isWebrtcH265()&&(this.streamRate=ro((t=>{e.emit(ot.kBps,(t/1024).toFixed(2))}))),this.TAG_NAME="WebrtcForM7SDecoder",this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.stopStreamRateInterval(),this.rtcPeerConnectionDataChannel&&(this.rtcPeerConnectionDataChannel.onopen=Kr,this.rtcPeerConnectionDataChannel.onclose=Kr,this.rtcPeerConnectionDataChannel.onmessage=Kr,this.rtcPeerConnectionDataChannel.close(),this.rtcPeerConnectionDataChannel=null),this.player.debugLog(this.TAG_NAME,"destroy")}_initRtcPeerConnection(){const e=new RTCPeerConnection,t=this.player;e.addTransceiver("video",{direction:"recvonly"}),e.addTransceiver("audio",{direction:"recvonly"}),e.onsignalingstatechange=e=>{this.player.debugLog(this.TAG_NAME,"onsignalingstatechange[本地端的信号状态]",e)},e.onicegatheringstatechange=t=>{this.player.debugLog(this.TAG_NAME,"onicegatheringstatechange[ICE收集状态]",t,e.iceGatheringState)},e.onnegotiationneeded=e=>{this.player.debugLog(this.TAG_NAME,"onnegotiationneeded[通信环境发生变化]",e)},e.oniceconnectionstatechange=i=>{this.player.debugLog(this.TAG_NAME,"oniceconnectionstatechange",e.iceConnectionState);const s=e.iceConnectionState;switch(this.player.emit(ot.webrtcOnIceConnectionStateChange,s),this.isDisconnected="disconnected"===s,e.iceConnectionState){case"new":case"checking":case"closed":case"connected":case"completed":break;case"failed":t.emit(ot.webrtcFailed);break;case"disconnected":t.emit(ot.webrtcDisconnect);break;case"closed":t.emit(ot.webrtcClosed)}},e.onicecandidate=e=>{this.player.debugLog(this.TAG_NAME,"onicecandidate",e),e.candidate&&this.player.debugLog(this.TAG_NAME,"Remote ICE candidate: ",e.candidate.candidate)},e.ontrack=i=>{this.player.debugLog(this.TAG_NAME,"ontrack",i);const s=t.video.$videoElement;if(t.isWebrtcH264())if("video"===i.track.kind){this.player.debugLog(this.TAG_NAME,"ontrack video"),this.rtcPeerTrackVideoReceiver=e.getReceivers().find((function(e){return e.track===i.track})),this.rtcPeerTrackVideoReceiver&&this._startBandwidthEstimateInterval();let t=i.streams[0];s.autoplay=!0,s.srcObject=t,this.videoStream=t}else"audio"===i.track.kind&&(this.player.debugLog(this.TAG_NAME,"ontrack audio"),this.rtcPeerTrackAudioReceiver=e.getReceivers().find((function(e){return e.track===i.track})),this.rtcPeerTrackAudioReceiver&&this._startBandwidthEstimateInterval())},e.onicecandidateerror=e=>{this.player.debugLog(this.TAG_NAME,"onicecandidateerror[candidate错误]",e),this.player.emitError(lt.webrtcIceCandidateError,e)},e.onconnectionstatechange=i=>{switch(this.player.debugLog(this.TAG_NAME,"onconnectionstatechange[所有ICE 状态总览]",i),this.player.emit(ot.webrtcOnConnectionStateChange,e.connectionState),e.connectionState){case"new":case"connecting":case"connected":case"disconnected":break;case"failed":this.isDisconnected&&t.emit(ot.webrtcFailed)}},e.ondatachannel=e=>{const t=e.channel;this.player.debugLog(this.TAG_NAME,"ondatachannel"),t.onopen=()=>{this.player.debugLog(this.TAG_NAME,"ondatachannel and onopen")},t.onmessage=e=>{const t=e.data;if(this.player.isWebrtcH264())return this.player.debugWarn(this.TAG_NAME,"ondatachannel is H265 but decode is h264 so emit webrtcStreamH265 "),void this.player.emit(ot.webrtcStreamH265);this.player.isDestroyedOrClosed()?this.player.debugWarn(this.TAG_NAME,"ondatachannel and player is destroyed"):(this.streamRate&&this.streamRate(t.byteLength),this.player.demux&&this.player.demux.dispatch(t))},t.onclose=()=>{this.player.debugWarn(this.TAG_NAME,"ondatachannel and onclose")},this.rtcPeerConnectionDataChannel=t};e.createDataChannel("signal").onmessage=e=>{this.player.debugLog(this.TAG_NAME,"signalChannel,onmessage",e);JSON.parse(e.data).type},this.rtcPeerConnection=e}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}loadSource(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{const r=this.rtcPeerConnection;r.createOffer().then((o=>{r.setLocalDescription(o),this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t,i){let s={"Content-Type":"application/sdp"};return i.username&&i.password&&(s.Authorization="Basic "+btoa(i.username+":"+i.password)),fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:s,body:t})}(e,o.sdp,t).then((e=>{e.text().then((e=>{this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp response"),e?r.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})).then((()=>{this.player.isWebrtcH265()&&this.startStreamRateInterval(),i()})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource setRemoteDescription error",e.toString(),e),s(e)})):(this.player.debugError(this.TAG_NAME,"loadSource sdp is null"),s("sdp is null"))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource response.text() error",e.toString(),e),s(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e.toString(),e),s(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e.toString(),e),s(e)}))}))}}class pv extends dv{constructor(e){super(e),this.TAG_NAME="WebrtcForZLMDecoder",this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy")}loadSource(e){return new Promise(((t,i)=>{const s=this.rtcPeerConnection;s.createOffer().then((r=>{s.setLocalDescription(r),this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return kl({url:e,type:"POST",data:t,contentType:"text/plain;charset=utf-8",processData:!1,dataType:"json"})}(e,r.sdp).then((e=>{this.player.debugLog(this.TAG_NAME,`getWebRtcRemoteSdp response and code is ${e.code}`);const r=e;if(r&&0!==r.code)return this.player.debugError(this.TAG_NAME,`response json code ${r.code}`),i(r.msg);r&&r.sdp?s.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:r.sdp})).then((()=>{t()})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource setRemoteDescription error",e.toString(),e),i(e)})):(this.player.debugError(this.TAG_NAME,"response sdp is null"),i("sdp is null"))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e.toString(),e),i(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e.toString(),e),i(e)}))}))}}class fv extends Ea{constructor(e){if(super(),this.TAG_NAME="AliyunRtc",this.player=e,!window.AliRTS)throw new Error("AliyunRtc is not defined");this.aliyunRtc=window.AliRTS.createClient(),this.aliyunRtcRemoteStream=null,this.$videoElement=this.player.video.$videoElement,this.listenEvents(),this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.aliyunRtc&&(this.aliyunRtcRemoteStream&&(this.aliyunRtcRemoteStream=null),this.aliyunRtc.unsubscribe(),this.aliyunRtc=null),this.$videoElement=null,this.off(),this.player.debugLog(this.TAG_NAME,"destroy")}listenEvents(){this.aliyunRtc.on("onError",(e=>{this.player.debugLog(this.TAG_NAME,`onError and code is ${e.errorCode} and message: ${e.message}`),10400!==e.errorCode&&(this.player.debugError(this.TAG_NAME,`onError and code is ${e.errorCode} and message: ${e.message}`),this.player.emitError(lt.aliyunRtcError,e))})),this.aliyunRtc.on("reconnect",(e=>{this.player.debugLog(this.TAG_NAME,"reconnect",e)}));const e="canplay",t="waiting",i="playing",s="media";this.aliyunRtc.on("onPlayEvent",(r=>{if(r.event===e)this.player.debugLog(this.TAG_NAME,"onPlayEvent and canplay");else if(r.event===t)this.player.debugLog(this.TAG_NAME,"onPlayEvent and playing - > waiting");else if(r.event===i)this.player.debugLog(this.TAG_NAME,"onPlayEvent and waiting -> playing");else if(r.event===s){const e=r.data;let t={},i=0;if(e.audio){const s=Math.floor(e.audio.bytesReceivedPerSecond);i+=s,t.abps=s}if(e.video){const s=Math.floor(e.video.bytesReceivedPerSecond);i+=s,t.vbps=s}this.player.updateStats(t),this.player.emit(ot.kBps,(i/1024).toFixed(2))}}))}loadSource(e){return new Promise(((t,i)=>{this.aliyunRtc.isSupport({isReceiveVideo:!0}).then((()=>{this.aliyunRtc.subscribe(e,{}).then((e=>{this.aliyunRtcRemoteStream=e,e.play(this.$videoElement),t()})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource and subscribe is not success: ",e.message),i(e.message)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource and is not support: ",e.message),i(e.message)}))}))}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}isVideoPlaying(){return this.$videoElement&&ua(this.$videoElement.paused)&&ua(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}getVideoBufferTimeRange(){const e=this.$videoElement;let t=null;if(e){const i=e.buffered,s=i.length?i.start(0):0,r=i.length?i.end(i.length-1):0;t={start:s,end:r,diff:r-s}}return t}}class mv{constructor(e){this.player=e,this.TAG_NAME="PressureObserverCpu",this.observer=null,this.latestCpuInfo=null,this.currentLevel=-1,this.observeCpuSuccess=!1,this._init(),this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.observer&&(this.observeCpuSuccess&&this.observer.disconnect(),this.observer=null),this.latestCpuInfo=null,this.currentLevel=-1,this.player.debugLog(this.TAG_NAME,"destroy")}getCurrentCpuState(){return this.currentLevel}_init(){ua(ba())?this.player.debugLog(this.TAG_NAME,"not support PressureObserver"):(this.observer=new PressureObserver((e=>{const t=(e||[]).find((e=>"cpu"===e.source));if(t){switch(this.latestCpuInfo=t,t.state){case"nominal":this.currentLevel=0;break;case"fair":this.currentLevel=1;break;case"serious":this.currentLevel=2;break;case"critical":this.currentLevel=3;break;default:this.currentLevel=-1}this.player.emit(ot.pressureObserverCpu,this.currentLevel)}})),this.observer&&this.observer.observe("cpu",{sampleInterval:1e3}).then((()=>{this.observeCpuSuccess=!0,this.player.debugLog(this.TAG_NAME,"observe cpu success")})).catch((()=>{this.observeCpuSuccess=!1,this.player.debugLog(this.TAG_NAME,"observe cpu fail")})))}}class gv extends Fa{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e),this.TAG_NAME="DynamicWatermark",this.isPauseAnimation=!1,this.isStopAnimation=!1,this.rafID=null,this.speed=t.speed||.2,this.isDynamic=!0,this.shadowRootDynamicDom=null,this.isGhost=!0===t.isGhost,this.ghostConfig={on:t.on||5,off:t.off||5},this.waterMarkWillRemove=!1,this.waterMarkWillAdd=!1,this.player.once(ot.start,(()=>{const e=ua(ao)?decodeURIComponent("JessibucaPro%20%E4%BD%93%E9%AA%8C"):t.content;let i=this.player.getVideoInfo();i||(i={width:200,height:200}),this.update({text:{content:e,fontSize:t.fontSize||18,color:t.color||"white"},left:i.width*Math.random(),top:i.height*Math.random(),opacity:t.opacity||.15}),this.startAnimation()})),this.player.debugLog(this.TAG_NAME,"int")}destroy(){super.destroy(),this.shadowRootDynamicDom=null,this.stopAnimation(),this.rafID&&(cancelAnimationFrame(this.rafID),this.rafID=null)}startAnimation(){if(!this.rafID){let e=1,t=1,i=Math.random(),s={width:0,height:0};const r=()=>{try{if(ua(this.isPauseAnimation)&&this.shadowRootDynamicDom&&this.shadowRootInnerDom){const o=this.shadowRootInnerDom,a=this.shadowRootDynamicDom,n=o.getBoundingClientRect(),l=a.getBoundingClientRect();if(l.width&&l.height&&(s.width=l.width,s.height=l.height),!this.shadowRootInnerDom.contains(this.shadowRootDynamicDom))return this.isGhost?ua(this.waterMarkWillAdd)&&(this.waterMarkWillAdd=!0,setTimeout((()=>{this._addDom(n,s),this.waterMarkWillAdd=!1}),1e3*this.ghostConfig.off)):this._addDom(n,s),void(0!==this.speed&&requestAnimationFrame(r));const d=Math.min(1,0===this.speed?0:this.speed?this.speed:.2);let h=l.left-n.left,c=l.top-n.top;h+=d*t*i,c+=d*e*(1-i),h+s.width>n.width?(t=-1,i=Math.random()):h<0&&(t=1,i=Math.random()),c+s.height>n.height?(e=-1,i=Math.random()):c<0&&(e=1,i=Math.random()),h=Math.min(n.width-s.width,h),c=Math.min(n.height-s.height,c);const u=h/n.width*100,p=c/n.height*100;this.shadowRootDynamicDom.style.left=`${u}%`,this.shadowRootDynamicDom.style.top=`${p}%`,ua(this.waterMarkWillRemove)&&this.isGhost&&(this.waterMarkWillRemove=!0,setTimeout((()=>{this._removeDom(),this.waterMarkWillRemove=!1}),1e3*this.ghostConfig.on))}}catch(e){}if(this.isStopAnimation)return this.isStopAnimation=!1,cancelAnimationFrame(this.rafID),void(this.rafID=null);0!==this.speed&&requestAnimationFrame(r)};this.rafID=requestAnimationFrame(r)}}_addDom(e,t){if(this.shadowRootInnerDom&&this.shadowRootDynamicDom){this.shadowRootInnerDom.appendChild(this.shadowRootDynamicDom);let i=e.width*Math.random(),s=e.height*Math.random();i=Math.min(e.width-2*t.width,i),s=Math.min(e.height-2*t.height,s),this.shadowRootDynamicDom.style.left=`${i}px`,this.shadowRootDynamicDom.style.top=`${s}px`}}resumeAnimation(){this.isPauseAnimation=!1}pauseAnimation(){this.isPauseAnimation=!0}stopAnimation(){this.isStopAnimation=!0}}class yv extends Ea{constructor(e){super(),this.player=e,this.TAG_NAME="DrawRectangle",this.drawingRectangle=!1,this.isDragging=!1,this.bindEvents=[],this.$rectBox=null,this._resetPoint(),this.player.on(ot.drawingRect,this._handleDrawingRect.bind(this)),this.player.debugLog(this.TAG_NAME,"init")}destroy(){this._unbindEvents(),this.drawingRectangle=!1,this.isDragging=!1,this._removeRectBox(),this.off(),this.player.debugLog(this.TAG_NAME,"destroy")}_resetPoint(){this.startPagePoint={x:0,y:0},this.startPoint={x:0,y:0},this.endPoint={x:0,y:0}}_handleDrawingRect(e){this.drawingRectangle=e,e?this._bindEvents():(this._unbindEvents(),this._removeRectBox())}_bindEvents(){const{events:{proxy:e}}=this.player,t=e(this.player.$container,"mousemove",this.handleMouseMove.bind(this)),i=e(this.player.$container,"mousedown",this.handleMouseDown.bind(this)),s=e(window,"mouseup",this.handleMouseUp.bind(this));this.bindEvents.push(t,i,s)}_unbindEvents(){this.bindEvents.forEach((e=>{e&&e()})),this.bindEvents=[]}_removeRectBox(){if(this.$rectBox){if(!rc(this.$rectBox)){const e=this.player.$container.querySelector(".jb-pro-drawing-rect-box");e&&this.player.$container&&this.player.$container.removeChild(e)}this.$rectBox=null}}handleMouseDown(e){if(e.stopPropagation(),!this.drawingRectangle)return;this._removeRectBox();const t=e.offsetX,i=e.offsetY;this.startPoint.x=t,this.startPoint.y=i,this.startPagePoint.x=e.pageX-this.player.$container.offsetLeft,this.startPagePoint.y=e.pageY-this.player.$container.offsetTop,this.$rectBox=document.createElement("div"),this.$rectBox.classList.add("jb-pro-drawing-rect-box"),this.$rectBox.style.border=`${this.player._opt.drawingRectLineWidth}px solid ${this.player._opt.drawingRectColor}`,this.$rectBox.style.position="absolute",this.$rectBox.style.left=`${this.startPoint.x}px`,this.$rectBox.style.top=`${this.startPoint.y}px`,this.player.$container.appendChild(this.$rectBox),this.isDragging=!0}handleMouseMove(e){if(e.stopPropagation(),!this.isDragging)return;if(!this.drawingRectangle)return;if(!this.$rectBox)return;const t=this.player.$container,i=this.player.getControlHeight(),s=e.pageX-t.offsetLeft,r=e.pageY-t.offsetTop;if(sn&&(o=n,this.endPoint.x=this.startPoint.x+o),a>l&&(a=l,this.endPoint.y=this.startPoint.y+a),this.$rectBox.style.width=`${o}px`,this.$rectBox.style.height=`${a}px`}handleMouseUp(e){if(e.stopPropagation(),this.drawingRectangle&&this.isDragging){e.preventDefault(),this.isDragging=!1,this.player._opt.drawingRectEndRemoveDom&&this._removeRectBox();const t={startPoint:this.startPoint,endPoint:this.endPoint,width:Math.abs(this.endPoint.x-this.startPoint.x),height:Math.abs(this.endPoint.y-this.startPoint.y)};this.player._opt.isResize,this.player.emit(ot.drawingRectInfo,t),this._resetPoint()}}}class Av extends Ea{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this._opt={},this.TAG_NAME="Player",this.$container=e;const i=da();if(this._opt=Object.assign({},i,t),this.debug=new wr(this),this.debugLog(this.TAG_NAME,"init and version is",oo),this._opt.forceNoOffscreen=!0,this._canPlayAppleMpegurl=!1,(fo()||po())&&(this._canPlayAppleMpegurl=Yo(),this.debugLog(this.TAG_NAME,"isIOS or isSafari and canPlayAppleMpegurl",this._canPlayAppleMpegurl)),ca(Lr.isEnabled)&&ca(this._opt.useWebFullScreen)&&(this.debugLog(this.TAG_NAME,"screenfull.isEnabled is true and _opt.useWebFullScreen is true , set _opt.useWebFullScreen false"),this._opt.useWebFullScreen=!1),ua(Lr.isEnabled)&&ua(this._opt.useWebFullScreen)&&(this.debugLog(this.TAG_NAME,"screenfull.isEnabled is false and _opt.useWebFullScreen is false , set _opt.useWebFullScreen true"),this._opt.useWebFullScreen=!0),fa()&&(this.debugLog(this.TAG_NAME,"isIphone and set _opt.videoRenderSupportScale false"),this._opt.videoRenderSupportScale=!1,Vo()&&ca(this._opt.isHls)&&ua(this._opt.supportHls265)&&(this.debugLog(this.TAG_NAME,"isIphone and is in wechat and is hls so set supportHls265 true"),this._opt.supportHls265=!0)),ua(this._opt.playFailedAndReplay)&&(this.debugLog(this.TAG_NAME,"_opt.playFailedAndReplay is false and set others replay params false"),this._opt.webglAlignmentErrorReplay=!1,this._opt.webglContextLostErrorReplay=!1,this._opt.autoWasm=!1,this._opt.mseDecodeErrorReplay=!1,this._opt.mediaSourceTsIsMaxDiffReplay=!1,this._opt.wcsDecodeErrorReplay=!1,this._opt.wasmDecodeErrorReplay=!1,this._opt.simdDecodeErrorReplay=!1,this._opt.videoElementPlayingFailedReplay=!1,this._opt.networkDelayTimeoutReplay=!1,this._opt.widthOrHeightChangeReplay=!1,this._opt.simdH264DecodeVideoWidthIsTooLargeReplay=!1,this._opt.mediaSourceUseCanvasRenderPlayFailedReplay=!1,this._opt.heartTimeoutReplay=!1,this._opt.loadingTimeoutReplay=!1,this._opt.websocket1006ErrorReplay=!1,this._opt.streamErrorReplay=!1,this._opt.streamEndReplay=!1,this._opt.mseWaitVideoCanplayAutoWasm=!1),this._opt.hiddenControl&&(this.debugLog(this.TAG_NAME,"_opt.hiddenControl is true and set others show btn to false"),Object.keys(this._opt.operateBtns).forEach((e=>{this._opt.operateBtns[e]&&-1===(""+e).indexOf("Fn")&&(this._opt.operateBtns[e]=!1)})),this._opt.showBandwidth=!1,this._opt.extendOperateBtns=[],this._opt.controlHtml="",this.isPlayback()&&(this._opt.playbackConfig.showControl=!1)),this._opt.watermarkConfig={image:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAS4AAABgCAYAAACjZZ/rAAAK4mlDQ1BJQ0Mg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U9+vzPJXJb4ogeWRes5xi4o8vUVLrKEdBQBA4tRGocOLyuYuoOGsN5cz6N3mPsp1JJSvtsZzEFZOUQZk9f/Yj7tr5PeWtnUzunI16kkT+XF5c9Qspo8NMf3w5EQQEAWsgUOHEpYXFufozyp03lrzObDauu4+TWFmIi4c6MUmVKK5+Z6rUaTQTVOBEac6ygeTau5iLYMc+G6/BOkZccKlIOrMXpbYYzGHlU/21zyPngoAgUDEInFTiUh6RPxVWsGIWf4sxi4p3r6finatLiEUd3qlHVSM7Rjr2Kg0pvkEnsqeeQYln3c58pVliZIKdj73lC7d+wiS5l5z8QVhP4Q6FKG3xaZTS7BFKanC3SSoJEgQEgVMRgZNPXCoqbPTz5rPxL++gEuIpOMhLhrbwcHKXsqNqTEZtcmQ24ZnAkp1LbfGpZE/DFCyYrGwCdwifO4/c/LWfgi1v8Ycz9lHm5YvLlonEFgQEgZOGwKlDXCcNAilYEBAErIYABmAigoAgIAhYCgEhLks1l1RWEBAEgIAQl/QDQUAQsBwCQlyWazKpsCAgCAhxSR8QBAQByyEgxGW5JpMKCwKCgBCX9AFBQBCwHAJCXJZrMqmwICAICHFJHxAEBAHLISDEZbkmkwoLAoKAEJf0AUFAELAcAkJclmsyqbAgIAgIcUkfEAQEAcshIMRluSaTCgsCgoAQl/QBQUAQsBwCQlyWazKpsCAgCAhxSR8QBAQByyEgxGW5JpMKCwKCgBCX9AFBQBCwHAJCXJZrMqmwICAICHFJHxAEBAHLISDEZbkmkwoLAoKAEJf0AUFAELAcAkJclmsyqbAgIAgIcUkfEAQEAcshIMRluSaTCgsCgsD/AFt/MVAlcetCAAAAAElFTkSuQmCC",width:75,height:24},opacity:.1,right:10,top:10},this._opt.forceNoOffscreen||("undefined"==typeof OffscreenCanvas?(this._opt.forceNoOffscreen=!0,this._opt.useOffscreen=!1):this._opt.useOffscreen=!0),this._opt.isMpeg4&&(this.debugLog(this.TAG_NAME,"isMpeg4 is true, so set _opt.useWasm true and others params false"),this._opt.useWCS=!1,this._opt.useMSE=!1,this._opt.isNakedFlow=!1,this._opt.useSIMD=!1,this._opt.isFmp4=!1,this._opt.useWasm=!0),this.isPlayback()&&(ca(this._opt.useMSE)&&ca(this._opt.mseDecoderUseWorker)&&this.debugLog(this.TAG_NAME,"isPlayback and mseDecoderUseWorker is true, so set mseDecoderUseWorker false"),this._opt.mseDecoderUseWorker=!1,ca(this._opt.useWCS)&&ca(this._opt.wcsDecodeAudio)&&this.debugLog(this.TAG_NAME,"isPlayback and wcsDecodeAudio is true, so set wcsDecodeAudio false"),this._opt.wcsDecodeAudio=!1),this._opt.poster&&(this._opt.background=this._opt.poster),ua(this._opt.muted)&&(this._opt.isNotMute=!0),this._opt.mseDecoderUseWorker&&(this._opt.mseDecoderUseWorker=!!(self.Worker&&self.MediaSource&&"canConstructInDedicatedWorker"in self.MediaSource&&!0===self.MediaSource.canConstructInDedicatedWorker),ua(this._opt.mseDecoderUseWorker)&&this.debugLog(this.TAG_NAME,"mseDecoderUseWorker is true but not support so set _opt.mseDecoderUseWorker = false")),(this.isOldHls()||this.isWebrtcH264()||this.isAliyunRtc())&&(this.debugLog(this.TAG_NAME,"isOldHls or isWebrtcH264 or isAliyunRtc is true, so set some params false and set _opt.recordType = webm"),this._opt.useWCS=!1,this._opt.useMSE=!1,this._opt.isNakedFlow=!1,this._opt.useSIMD=!1,this._opt.isFmp4=!1,this._opt.useWasm=!1,this._opt.recordType=E),this._opt.isNakedFlow&&(this.debugLog(this.TAG_NAME,"isNakedFlow is true, so set _opt.mseDecodeAudio false"),this._opt.mseDecodeAudio=!1),co()&&(this.debugLog(this.TAG_NAME,"isFirefox is true, so set _opt.mseDecodeAudio false"),this._opt.mseDecodeAudio=!1),!this.isOldHls()&&!this.isWebrtcH264()){if(this._opt.useWCS){const e="VideoDecoder"in window,t=Eo();this._opt.useWCS=e,this._opt.useWCS&&this._opt.isH265&&(this._opt.useWCS=t),this._opt.useWCS||this.debugWarn(this.TAG_NAME,`\n useWCS is true,\n and supportWCS is ${e}, supportHevcWCS is ${t} , _opt.isH265 is ${this._opt.isH265}\n so set useWCS false`),this._opt.useWCS&&(this._opt.wcsDecodeAudio&&(this._opt.wcsDecodeAudio="AudioDecoder"in window,this._opt.wcsDecodeAudio||this.debugWarn(this.TAG_NAME,"wcsDecodeAudio is true, but not support so set wcsDecodeAudio false")),this._opt.useOffscreen?this._opt.wcsUseVideoRender=!1:this._opt.wcsUseVideoRender&&(this._opt.wcsUseVideoRender=wo()&&To(),this._opt.wcsUseVideoRender||this.debugWarn(this.TAG_NAME,"wcsUseVideoRender is true, but not support so set wcsUseVideoRender false")))}if(this._opt.useMSE){const e=function(){let e=!1;return"MediaSource"in self&&(e=!0),e}()||function(){let e=!1;return!("MediaSource"in self)&&"ManagedMediaSource"in self&&(e=!0),e}(),t=So()||function(){let e=!1;return!("MediaSource"in self)&&"ManagedMediaSource"in self&&(self.ManagedMediaSource.isTypeSupported(ui)||self.ManagedMediaSource.isTypeSupported(pi)||self.ManagedMediaSource.isTypeSupported(fi)||self.ManagedMediaSource.isTypeSupported(mi)||self.ManagedMediaSource.isTypeSupported(gi))&&(e=!0),e}();this._opt.useMSE=e,this._opt.useMSE&&this._opt.isH265&&(this._opt.useMSE=t),this._opt.useMSE||this.debugWarn(this.TAG_NAME,`\n useMSE is true,\n and supportMSE is ${e}, supportHevcMSE is ${t} , _opt.isH265 is ${this._opt.isH265}\n so set useMSE false`)}}if(ua(this._opt.useMSE)&&(this._opt.mseDecodeAudio=!1),ua(this._opt.useWCS)&&(this._opt.wcsDecodeAudio=!1),this._opt.useMSE?(this._opt.useWCS&&this.debugWarn(this.TAG_NAME,"useMSE is true and useWCS is true then useWCS set true->false"),this._opt.forceNoOffscreen||this.debugWarn(this.TAG_NAME,"useMSE is true and forceNoOffscreen is false then forceNoOffscreen set false->true"),this._opt.useWCS=!1,this._opt.forceNoOffscreen=!0):this._opt.useWCS,this._opt.isWebrtc&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"isWebrtc is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this._opt.isHls&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"isHls is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this._opt.isAliyunRtc&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"isAliyunRtc is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this.isStreamWebTransport()&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"is stream use webTransport is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this._opt.wcsDecodeAudio&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"is wcsDecodeAudio true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),ua(this._opt.demuxUseWorker)&&(this._opt.mseDecoderUseWorker=!1),this.isPlayback()&&(this._opt.mseDecoderUseWorker=!1),this._opt.useMThreading&&(this._opt.useMThreading="undefined"!=typeof SharedArrayBuffer,this._opt.useMThreading||this.debugWarn(this.TAG_NAME,"useMThreading is true, but not support so set useMThreading false")),this._opt.useSIMD||-1!==this._opt.decoder.indexOf("-simd")){const e=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),t=fa();this._opt.useSIMD=e&&ua(t),this._opt.useSIMD||this.debugWarn(this.TAG_NAME,`useSIMD is true, but not support(isSupportSimd is ${e} ,isIphone is ${t}) so set useSIMD false`)}var s;if(this._opt.useSIMD?-1===this._opt.decoder.indexOf("-simd")?this._opt.useMThreading?this._opt.decoder=this._opt.decoder.replace("decoder-pro.js","decoder-pro-simd-mt.js"):this._opt.decoder=this._opt.decoder.replace("decoder-pro.js","decoder-pro-simd.js"):this._opt.useMThreading&&(this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-simd-mt.js")):-1!==this._opt.decoder.indexOf("-simd")?this._opt.useMThreading?this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-mt.js"):this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro.js"):this._opt.useMThreading&&(this._opt.decoder=this._opt.decoder.replace("decoder-pro.js","decoder-pro-mt.js")),-1!==this._opt.decoder.indexOf("-simd")?this._opt.useMThreading?(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-hard-not-wasm.js")):(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-hard-not-wasm.js")):this._opt.useMThreading?(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-hard-not-wasm.js")):(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro.js","decoder-pro-hard-not-wasm.js")),ua(this._opt.hasAudio)&&(this._opt.operateBtns.audio=!1),ua(this._opt.hasVideo)&&(this._opt.operateBtns.fullscreen=!1,this._opt.operateBtns.screenshot=!1,this._opt.operateBtns.record=!1,this._opt.operateBtns.ptz=!1,this._opt.operateBtns.quality=!1,this._opt.operateBtns.zoom=!1),this._opt.qualityConfig&&0===this._opt.qualityConfig.length&&this._opt.operateBtns.quality&&(this._opt.operateBtns.quality=!1,this.debugWarn(this.TAG_NAME,"_opt.qualityConfig is empty, so set operateBtns.quality false")),ca(this._opt.useWebGPU)&&(this._opt.useWebGPU=function(){let e=!1;return"gpu"in navigator&&(e=!0),e}(),ua(this._opt.useWebGPU)&&this.debugWarn(this.TAG_NAME,"useWebGPU is true, but not support so set useWebGPU false")),this._opt.hasControl=this._hasControl(),this._loading=!1,this._playing=!1,this._playbackPause=!1,this._hasLoaded=!1,this._zooming=!1,this._drawingRect=!1,this._destroyed=!1,this._destroyLock=!1,this._closed=!1,this._checkHeartTimeout=null,this._checkLoadingTimeout=null,this._checkStatsInterval=null,this._checkVisibleHiddenTimeout=null,this._startBpsTime=null,this._isPlayingBeforePageHidden=!1,this._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,currentPts:0,pTs:0,dts:0,mseVideoBufferDelayTime:0,isDropping:!1},this._tempTsList=[],this._allStatsData={},this._faceDetectActive=!1,this._objectDetectActive=!1,this._occlusionDetectActive=!1,this._imageDetectActive=!1,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this._videoTimestamp=0,this._audioTimestamp=0,this._latestAudioTimestamp=0,this._videoIframeIntervalTs=0,this._streamQuality=this._opt.defaultStreamQuality||"",!this._streamQuality&&this._opt.qualityConfig.length>0&&(this._streamQuality=this._opt.qualityConfig[0]||""),this._visibility=!0,this._lastestVisibilityChangeTimestamp=null,this._tempWorkerStats=null,this._historyFpsList=[],this._historyVideoDiffList=[],this._tempStreamList=[],this._tempInnerPlayBgobj=null,this._flvMetaData=null,this._flvMetaDataFps=null,this._serverInfo=null,this._mseWorkerData={},ua(this._opt.useMSE)&&ua(this._opt.useWCS)&&!this.isWebrtcH264()&&!this.isOldHls()&&(this._opt.useWasm=!0),(this.isOldHls()||this.isWebrtcH264())&&(this._opt.hasVideo=!0,this._opt.hasAudio=!0),this._opt.hasVideo||(this._opt.useMSE=!1,this._opt.useWCS=!1),this._opt.useWasm&&(this._opt.useOffscreen?this._opt.wasmUseVideoRender=!1:this._opt.wasmUseVideoRender&&(this._opt.wasmUseVideoRender=go()&&wo()&&To(),this._opt.wasmUseVideoRender||this.debugWarn(this.TAG_NAME,"use wasm video render, but not support so set wasmUseVideoRender false"),this._opt.wasmUseVideoRender&&this._opt.wasmPlayAudioUseVideoRender&&(this._opt.wasmPlayAudioUseVideoRender="AudioData"in window,this._opt.wasmPlayAudioUseVideoRender||this.debugWarn(this.TAG_NAME,"use wasm video render play audio, but not support so set wasmPlayAudioUseVideoRender false"))),this._opt.useSIMD?this.debugLog(this.TAG_NAME,"use simd wasm"):this.debugLog(this.TAG_NAME,"use wasm")),this._opt.useWasm&&(this._opt.useFaceDetector&&window.JessibucaProFaceDetector||this._opt.useObjectDetector&&window.JessibucaProObjectDetector||this._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector||this._opt.useImageDetector&&window.JessibucaProImageDetector)?(this.ai=new nv(this),this._opt.useFaceDetector&&window.JessibucaProFaceDetector||(this._opt.operateBtns.aiFace=!1),this._opt.useObjectDetector&&window.JessibucaProObjectDetector||(this._opt.operateBtns.aiObject=!1),this._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector||(this._opt.operateBtns.aiOcclusion=!1),this._opt.useImageDetector&&this._opt.aiImageDetectActive&&window.JessibucaProImageDetector&&(this.imageDetectActive=!0)):(this._opt.operateBtns.aiObject=!1,this._opt.operateBtns.aiFace=!1,this._opt.operateBtns.aiOcclusion=!1),this._opt.useFaceDetector&&(this._opt.useWasm&&window.JessibucaProFaceDetector||this.debugWarn(this.TAG_NAME,`use face detector, useWasm is ${this._opt.useWasm} and window.JbProFaceDetector is null`)),this._opt.useObjectDetector&&(this._opt.useWasm&&window.JessibucaProObjectDetector||this.debugWarn(this.TAG_NAME,`use object detector, useWasm is ${this._opt.useWasm} and window.JbProObjectDetector is null`)),this._opt.useOcclusionDetector&&(this._opt.useWasm&&window.JessibucaProOcclusionDetector||this.debugWarn(this.TAG_NAME,`use occlusion detector, useWasm is ${this._opt.useWasm} and window.JessibucaProOcclusionDetector is null`)),this._opt.useImageDetector&&(this._opt.useWasm&&window.JessibucaProImageDetector||this.debugWarn(this.TAG_NAME,`use image detector, useWasm is ${this._opt.useWasm} and window.JessibucaProImageDetector is null`)),this._opt.videoRenderType&&(this.debugLog(this.TAG_NAME,`videoRenderType is ${this._opt.videoRenderType}`),this._opt.videoRenderType===$?(this._opt.useVideoRender=!0,this._opt.useCanvasRender=!1):this._opt.videoRenderType===H&&(this._opt.useVideoRender=!1,this._opt.useCanvasRender=!0)),this._opt.useVideoRender&&(this._opt.useWasm&&!this._opt.useOffscreen?(this._opt.wasmUseVideoRender=go()&&wo()&&To(),this._opt.wasmUseVideoRender||this.debugWarn(this.TAG_NAME,"use wasm video render, but not support so set wasmUseVideoRender false")):this._opt.useWCS&&!this._opt.useOffscreen&&(this._opt.wcsUseVideoRender=wo()&&To(),this._opt.wcsUseVideoRender||this.debugWarn(this.TAG_NAME,"use wcs video render, but not support so set wcsUseVideoRender false"))),this._opt.useCanvasRender&&(this._opt.useMSE&&ua(this._opt.mseDecoderUseWorker)&&(this._opt.mseUseCanvasRender=!0),this._opt.useWasm&&(this._opt.wasmUseVideoRender=!1),this._opt.useWCS&&(this._opt.wcsUseVideoRender=!1),this.isOldHls()&&!fo()&&(this._opt.hlsUseCanvasRender=!0),this.isWebrtcH264()&&(this._opt.webrtcUseCanvasRender=!0)),this._opt.useVideoRender=!1,this._opt.useCanvasRender=!1,this._opt.useWasm?this._opt.wasmUseVideoRender?this._opt.useVideoRender=!0:this._opt.useCanvasRender=!0:this._opt.useWCS?this._opt.wcsUseVideoRender?this._opt.useVideoRender=!0:this._opt.useCanvasRender=!0:this._opt.useMSE?this._opt.mseUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0:this.isOldHls()?this._opt.hlsUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0:this.isWebrtcH264()&&(this._opt.webrtcUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0),this._opt.useCanvasRender&&this.useVideoPlayAudio()&&(this.debugLog(this.TAG_NAME,"useCanvasRender is true and useVideoPlayAudio() return true, so set wcsDecodeAudio false"),this._opt.wcsDecodeAudio=!1,this._opt.wasmPlayAudioUseVideoRender=!1),s=this,Object.defineProperty(s,"rect",{get:()=>{let e={};return s.$container&&(e=s.$container.getBoundingClientRect(),e.width=Math.max(e.width,s.$container.clientWidth),e.height=Math.max(e.height,s.$container.clientHeight)),e}}),["bottom","height","left","right","top","width"].forEach((e=>{Object.defineProperty(s,e,{get:()=>s.rect[e]||0})})),this.events=new Sa(this),this._opt.hasVideo&&(this.video=new Ya(this),this.recorder=new nl(this)),this.isOldHls()?(this.hlsDecoder=new MA(this),this.loaded=!0):this.isWebrtcH264()?(this._opt.isWebrtcForZLM?this.webrtc=new pv(this):this._opt.isWebrtcForSRS?this.webrtc=new hv(this):this._opt.isWebrtcForOthers?this.webrtc=new cv(this):this.webrtc=new uv(this),this.loaded=!0):this.isAliyunRtc()?(this.aliyunRtcDecoder=new fv(this),this.loaded=!0):(this.isUseHls265()&&(this.hlsDecoder=new rv(this)),this.isWebrtcH265()&&(this.webrtc=new uv(this)),ua(Qo(this._opt))?this.decoderWorker=new pl(this):this.loaded=!0),this._opt.hasAudio&&(this.audio=new gn(this)),this.stream=null,this.demux=null,this._lastVolume=null,this._isMute=null,this._isInZoom=!1,this._playingStartTimestamp=null,this.isMSEVideoDecoderInitializationFailedNotSupportHevc=!1,this.isMSEAudioDecoderError=!1,this.isMSEPlaybackRateChangePause=!1,this.isMSECurrentMoreThanBufferedPause=!1,this.isPlayFailedAndPaused=!1,this._seiList=[],this._opt.useWCS&&(this.webcodecsDecoder=new Wh(this),!this._opt.hasAudio&&ua(this._opt.demuxUseWorker)&&(this.loaded=!0)),this._opt.useMSE&&ua(this._opt.mseDecoderUseWorker)&&(this.mseDecoder=new hc(this),!this._opt.hasAudio&&ua(this._opt.demuxUseWorker)&&(this.loaded=!0)),this.control=new nc(this),this._opt.contextmenuBtns.length>0&&ua(this._opt.disableContextmenu)&&lo()?this.contextmenu=new lv(this):ca(this._opt.disableContextmenu)&&this._opt.contextmenuBtns.length>0&&lo()&&this.debugWarn(this.TAG_NAME,"disableContextmenu is true, but contextmenuBtns is not empty, so Contextmenu can not be created,please check"),this.isPlayback()&&(this.playback=new ov(this,this._opt.playbackConfig)),this._opt.operateBtns.zoom&&(this.zoom=new av(this)),/(iphone|ipad|ipod|ios|android)/i.test(window.navigator.userAgent.toLowerCase())&&ua(this._opt.supportLockScreenPlayAudio&&po())&&(this.keepScreenOn=new uc(this)),(e=>{try{const t=t=>{$o(t)===e.$container&&(e.emit(at.fullscreen,e.fullscreen),e.fullscreen?e._opt.useMSE&&e.resize():e.resize())};Lr.on("change",t),e.events.destroys.push((()=>{Lr.off("change",t)}))}catch(e){}if(e.on(ot.decoderWorkerInit,(()=>{e.debugLog("player","listen decoderWorkerInit and set loaded true"),e.loaded=!0})),e.on(ot.play,(()=>{e.loading=!1})),e.on(ot.fullscreen,(t=>{if(t)try{Lr.request(e.$container).then((()=>{})).catch((t=>{e.debugError("player","fullscreen request error",t,t.toString()),e.emitError(lt.fullscreenError,t.toString()),no()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}))}catch(t){no()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}else try{Lr.exit().then((()=>{e.webFullscreen&&(e.webFullscreen=!1)})).catch((t=>{e.debugError("player","fullscreen exit error",t,t.toString()),e.emitError(lt.fullscreenError,t.toString()),e.webFullscreen&&(e.webFullscreen=!1)}))}catch(t){e.webFullscreen&&(e.webFullscreen=!1)}})),no()&&e.on(ot.webFullscreen,(t=>{t?e.$container.classList.add("jb-pro-fullscreen-web"):e.$container.classList.remove("jb-pro-fullscreen-web"),e.emit(at.fullscreen,e.fullscreen)})),e.on(ot.resize,(()=>{e.resize()})),e._opt.debug){const t=[ot.timeUpdate,ot.currentPts,ot.videoSEI,ot.videoSEISyncPts,ot.performance,ot.videoSmooth],i=[ot.stats,ot.playbackStats,ot.playbackTimestamp,ot.flvMetaData,ot.playToRenderTimes,ot.audioInfo,ot.videoInfo];Object.keys(ot).forEach((s=>{e.on(ot[s],(function(r){if(!t.includes(s)){i.includes(s)&&(r=JSON.stringify(r));for(var o=arguments.length,a=new Array(o>1?o-1:0),n=1;n{e.on(lt[t],(function(){for(var i=arguments.length,s=new Array(i),r=0;r{this.updateOption({rotate:e?270:0}),this.resize()}),10)}get webFullscreen(){return this.$container.classList.contains("jb-pro-fullscreen-web")}set loaded(e){this._hasLoaded=e}get loaded(){return this._hasLoaded||this.isOldHls()||this.isWebrtcH264()||this._opt.useMSE&&ua(this._opt.hasAudio)&&ua(this._opt.demuxUseWorker)||this._opt.useWCS&&!this._opt.hasAudio&&ua(this._opt.demuxUseWorker)}set playing(e){this.isClosed()&&e?this.debugLog(this.TAG_NAME,"player is closed, so can not play"):(e&&ca(this.loading)&&(this.loading=!1),this.playing!==e&&(this._playing=e,this.emit(ot.playing,e),this.emit(ot.volumechange,this.volume),e?this.emit(ot.play):this.emit(ot.pause)))}get playing(){return this._playing}get volume(){return this.audio&&this.audio.volume||0}set volume(e){e!==this.volume&&(this.audio?(this.audio.setVolume(e),this._lastVolume=this.volume,this._isMute=0===this.volume):this.debugWarn(this.TAG_NAME,"set volume error, audio is null"))}get lastVolume(){return this._lastVolume}set loading(e){this.loading!==e&&(this._loading=e,this.emit(ot.loading,this._loading))}get loading(){return this._loading}set zooming(e){this.isDestroyedOrClosed()||this.zooming!==e&&(this.zoom||(this.zoom=new av(this)),this._zooming=e,this.emit(ot.zooming,this.zooming))}get zooming(){return this._zooming}set drawingRect(e){this.isDestroyedOrClosed()||this.drawingRect!==e&&(this.drawRectangle||(this.drawRectangle=new yv(this)),this._drawingRect=e,this.emit(ot.drawingRect,this.drawingRect))}get drawingRect(){return this._drawingRect}set recording(e){e?this.playing&&!this.recording&&(this.recorder&&this.recorder.startRecord(),this.isDemuxInWorker()&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!0})):this.recording&&(this.isDemuxInWorker()&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder&&this.recorder.stopRecordAndSave().then((()=>{})).catch((e=>{})))}get recording(){return!!this.recorder&&this.recorder.isRecording}set audioTimestamp(e){null!==e&&(this._audioTimestamp=e)}get audioTimestamp(){return this._audioTimestamp}set latestAudioTimestamp(e){null!==e&&(this._latestAudioTimestamp=e)}get latestAudioTimestamp(){return this._latestAudioTimestamp}get videoTimestamp(){return this._stats.currentPts||this._stats.ts}set streamQuality(e){this.streamQuality!==e&&(this._streamQuality=e,this.emit(ot.streamQualityChange,e))}get streamQuality(){return this._streamQuality}get isDebug(){return ca(this._opt.debug)}get scaleType(){const e=this._opt,t=e.isResize,i=e.isFullResize;let s=Xt;return ua(i)&&ua(t)?s=Xt:ua(i)&&ca(t)?s=Zt:ca(i)&&ca(t)&&(s=ei),s}set visibility(e){this._visibility!==e&&(this._visibility=e,this.emit(ot.visibilityChange,e),this._lastestVisibilityChangeTimestamp=Zr(),e?this.clearVisibilityHiddenTimeout():this.startVisibilityHiddenTimeout())}get visibility(){return this._visibility}set playbackPause(e){this._playbackPause!==e&&(this._playbackPause=e,this.emit(ot.playbackPause,e),this.emit(ot.playbackPauseOrResume,e))}get playbackPause(){return this.isPlayback()&&this._playbackPause}set videoIframeIntervalTs(e){this._videoIframeIntervalTs=e}get videoIframeIntervalTs(){return this._videoIframeIntervalTs}set faceDetectActive(e){this._faceDetectActive!==e&&(this._faceDetectActive=e,this.emit(ot.faceDetectActive,e))}get faceDetectActive(){return this._faceDetectActive}set objectDetectActive(e){this._objectDetectActive!==e&&(this._objectDetectActive=e,this.emit(ot.objectDetectActive,e))}get objectDetectActive(){return this._objectDetectActive}set occlusionDetectActive(e){this._occlusionDetectActive!==e&&(this._occlusionDetectActive=e,this.emit(ot.occlusionDetectActive,e))}get occlusionDetectActive(){return this._occlusionDetectActive}set imageDetectActive(e){this._imageDetectActive!==e&&(this._imageDetectActive=e)}get imageDetectActive(){return this._imageDetectActive}get isUseWorkerDemuxAndDecode(){return this.stream&&this.stream.getStreamType()===y}isDestroyed(){return this._destroyed}isDestroying(){return this._destroyed&&this._destroyLock}isClosed(){return this._closed}isDestroyedOrClosed(){return this.isDestroyed()||this.isClosed()}isLoading(){return this.loading}isPlaying(){let e=!1;return this._opt.playType===b?e=this.playing:this._opt.playType===_&&(e=ua(this.playbackPause)&&this.playing),e}updateOption(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._opt=Object.assign({},this._opt,e),ca(t)&&this.decoderWorker&&Object.keys(e).forEach((t=>{this.decoderWorker.updateWorkConfig({key:t,value:e[t]})}))}init(){return new Promise(((e,t)=>{this.video||this._opt.hasVideo&&(this.video=new Ya(this)),this.audio||this._opt.hasAudio&&(this.audio=new gn(this)),this.stream||(this.stream=new Tn(this)),this.isOldHls()?(this.hlsDecoder||(this.hlsDecoder=new MA(this),this.loaded=!0),e()):this.isWebrtcH264()?(this.webrtc||(this._opt.isWebrtcForZLM?this.webrtc=new pv(this):this._opt.isWebrtcForSRS?this.webrtc=new hv(this):this._opt.isWebrtcForOthers?this.webrtc=new cv(this):this.webrtc=new uv(this),this.loaded=!0),e()):this.isAliyunRtc()?(this.aliyunRtcDecoder||(this.aliyunRtcDecoder=new fv(this),this.loaded=!0),e()):(this.demux||this._opt.hasVideo&&!this.isUseWorkerDemuxAndDecode&&(this.demux=new Mh(this)),this._opt.useWCS&&(this.webcodecsDecoder||(this.webcodecsDecoder=new Wh(this))),this._opt.useMSE&&ua(this._opt.mseDecoderUseWorker)&&(this.mseDecoder||(this.mseDecoder=new hc(this))),this.isUseHls265()&&(this.hlsDecoder||(this.hlsDecoder=new rv(this))),this.isWebrtcH265()&&(this.webrtc||(this.webrtc=new uv(this))),this.decoderWorker?this.loaded?e():this.once(ot.decoderWorkerInit,(()=>{this.isDestroyedOrClosed()?(this.debugError(this.TAG_NAME,"init() failed and player is destroyed"),t("init() failed and player is destroyed")):(this.loaded=!0,e())})):ua(Qo(this._opt))?(this.decoderWorker=new pl(this),this.once(ot.decoderWorkerInit,(()=>{this.isDestroyedOrClosed()?(this.debugError(this.TAG_NAME,"init() failed and player is destroyed"),t("init() failed and player is destroyed")):(this.loaded=!0,e())}))):e())}))}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(!e&&!this._opt.url)return s("url is empty");this._closed=!1,this.loading=!0,this.playing=!1,this._times.playInitStart=Zr(),e||(e=this._opt.url),this._opt.url=e,this.control&&this._opt.loadingBackground&&this.control.initLoadingBackground(),this.init().then((()=>{this.debugLog(this.TAG_NAME,"play() init and next fetch stream"),this._times.playStart=Zr(),this._opt.isNotMute&&this.mute(!1),this.enableWakeLock(),this.checkLoadingTimeout(),this.stream?(this.stream.once(lt.fetchError,(e=>{this.emitError(lt.fetchError,e)})),this.stream.once(lt.websocketError,(e=>{this.emitError(lt.websocketError,e)})),this.stream.once(ot.streamEnd,(e=>{this.emit(ot.streamEnd,e)})),this.stream.once(lt.hlsError,(e=>{this.emitError(lt.hlsError,e)})),this.stream.once(lt.webrtcError,(e=>{this.emitError(lt.webrtcError,e)})),this.stream.once(ot.streamSuccess,(()=>{i(),this._times.streamResponse=Zr(),this.video&&this.video.play(),this.checkStatsInterval(),this.isPlayback()&&this.playback&&this.playback.startCheckStatsInterval();{const e=Number("1")||1;setTimeout((()=>{this.destroy(),console.error("Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码)"),alert("Jb pro 体验结束,请刷新页面再次体验,如需要购买商业授权,可以联系微信:bosswancheng"),window.location.reload()}),60*e*60*1e3)}})),this.stream.fetchStream(e,t)):(this.debugWarn(this.TAG_NAME,`play() this.stream is null and is isDestroyedOrClosed is ${this.isDestroyedOrClosed()}`),s("this.stream is null"))})).catch((e=>{s(e)}))}))}playForControl(){return new Promise(((e,t)=>{this.debugLog(this.TAG_NAME,`playForControl() and pauseAndNextPlayUseLastFrameShow is ${this._opt.pauseAndNextPlayUseLastFrameShow}`),this._opt.pauseAndNextPlayUseLastFrameShow&&this._tempInnerPlayBgobj&&this._tempInnerPlayBgobj.loadingBackground&&this.updateOption({loadingBackground:this._tempInnerPlayBgobj.loadingBackground,loadingBackgroundWidth:this._tempInnerPlayBgobj.loadingBackgroundWidth,loadingBackgroundHeight:this._tempInnerPlayBgobj.loadingBackgroundHeight}),this.play().then((t=>{e(t)})).catch((e=>{t(e)}))}))}close(){return new Promise(((e,t)=>{this._close().then((()=>{this.video&&this.video.clearView(),e()})).catch((e=>{t(e)}))}))}resumeAudioAfterPause(){this.lastVolume&&ua(this._isMute)&&(this.volume=this.lastVolume)}async _close(){this._closed=!0,this.video&&(this.video.resetInit(),this.video.pause(!0)),this.loading=!1,this.recording=!1,this.zooming=!1,this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.isPlayback()&&this.playback&&this.playback.clearStatsInterval(),this.releaseWakeLock(),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.decoderWorker&&(await this.decoderWorker.destroy(),this.decoderWorker=null),this.stream&&(await this.stream.destroy(),this.stream=null),this.demux&&(this.demux.destroy(),this.demux=null),this.webcodecsDecoder&&(await this.webcodecsDecoder.destroy(),this.webcodecsDecoder=null),this.mseDecoder&&(this.mseDecoder.destroy(),this.mseDecoder=null),this.hlsDecoder&&(await this.hlsDecoder.destroy(),this.hlsDecoder=null),this.webrtc&&(this.webrtc.destroy(),this.webrtc=null),this.aliyunRtcDecoder&&(this.aliyunRtcDecoder.destroy(),this.aliyunRtcDecoder=null),this.audio&&(await this.audio.destroy(),this.audio=null),this.playing=!1}pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(((t,i)=>{e?this.close().then((()=>{t()})).catch((e=>{i(e)})):this._close().then((()=>{t()})).catch((e=>{i(e)}))}))}pauseForControl(){return new Promise(((e,t)=>{if(this.debugLog(this.TAG_NAME,"_pauseInner()"),this._opt.pauseAndNextPlayUseLastFrameShow&&this.video){const e=this.video.screenshot("","png",.92,"base64");if(e){const t=this.getVideoInfo();t?(this.debugLog(this.TAG_NAME,`pauseForControl() and loadingBackground width is ${t.width} and height is ${t.height}`),this._tempInnerPlayBgobj={loadingBackground:e,loadingBackgroundWidth:t.width,loadingBackgroundHeight:t.height}):this.debugWarn(this.TAG_NAME,"pauseForControl() and videoInfo is null")}else this.debugWarn(this.TAG_NAME,"pauseForControl() and loadingBackground is null")}this.pause().then((t=>{e(t)})).catch((e=>{t(e)}))}))}isAudioMute(){let e=!0;return this.audio&&(e=this.audio.isMute),e}isAudioNotMute(){return!this.isAudioMute()}mute(e){this.audio&&this.audio.mute(e)}resize(){this.video&&this.video.resize()}startRecord(e,t){this.recording||(this.recorder.setFileName(e,t),this.recording=!0)}cancelRecord(){return new Promise(((e,t)=>{this.recorder||t("recorder is null"),this.recording&&(this._opt.useWasm&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder.cancelRecord().then((()=>{e()})).catch((e=>{t(e)})))}))}stopRecordAndSave(e,t){return new Promise(((i,s)=>{this.recorder||s("recorder is null"),this.recording?(this._opt.useWasm&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder.stopRecordAndSave(e,t).then((e=>{i(e)})).catch((e=>{s(e)}))):s("recorder is not recording")}))}_hasControl(){let e=!1,t=!1;return Object.keys(this._opt.operateBtns).forEach((e=>{this._opt.operateBtns[e]&&-1===(""+e).indexOf("Fn")&&(t=!0)})),(this._opt.showBandwidth||t)&&(e=!0),this._opt.extendOperateBtns&&this._opt.extendOperateBtns.length>0&&(e=!0),this.isPlayback()&&this._opt.playbackConfig.showControl&&(e=!0),this._opt.controlHtml&&(e=!0),e}useWasmDecode(){return ua(this._opt.useMSE)&&ua(this._opt.useWCS)}canVideoTrackWritter(){const e=this._opt;return!this.isOldHls()&&!this.isWebrtcH264()&&ua(e.useMSE)&&!this.isAliyunRtc()&&(e.useWCS&&ua(e.useOffscreen)&&e.wcsUseVideoRender||this.useWasmDecode())}checkHeartTimeout$2(){if(ua(this.playbackPause)&&this.playing){if(this.isDestroyedOrClosed())return void this.debugWarn(this.TAG_NAME,"checkHeartTimeout$2 but player is destroyed");if(ua(this.isHistoryFpsListAllZero()))return void this.debugWarn(this.TAG_NAME,"checkHeartTimeout$2 but fps is not all zero");if(0!==this._stats.fps)return void this.debugWarn(this.TAG_NAME,`checkHeartTimeout$2 but fps is ${this._stats.fps}`);const e=this._historyFpsList.join(",");this.debugWarn(this.TAG_NAME,`checkHeartTimeout$2 and\n pause and emit delayTimeout event and\n current vbps is ${this._stats.vbps} and\n current fps is ${this._stats.fps} and\n history FpsList is ${e} and\n current visibility is ${this.visibility} and`),this.emit(ot.timeout,ot.delayTimeout),this.emit(ot.delayTimeout)}else this.debugLog(this.TAG_NAME,`checkHeartTimeout$2 playbackPause is ${this.playbackPause}, playing is ${this.playing}`)}checkStatsInterval(){this._checkStatsInterval=setInterval((()=>{this.updateStats()}),1e3)}checkLoadingTimeout(){this._checkLoadingTimeout=setTimeout((()=>{this.playing?this.debugWarn(this.TAG_NAME,`checkLoadingTimeout but loading is ${this.loading} and playing is ${this.playing}`):this.isDestroyedOrClosed()?this.debugWarn(this.TAG_NAME,"checkLoadingTimeout but player is destroyed"):(this.debugWarn(this.TAG_NAME,"checkLoadingTimeout and pause and emit loadingTimeout event"),this.emit(ot.timeout,ot.loadingTimeout),this.emit(ot.loadingTimeout))}),1e3*this._opt.loadingTimeout)}clearCheckLoadingTimeout(){this._checkLoadingTimeout&&(this.debugLog(this.TAG_NAME,"clearCheckLoadingTimeout"),clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}handleRender(){this.isDestroyedOrClosed()?this.debugWarn(this.TAG_NAME,"handleRender but player is destroyed"):(this.loading&&(this.clearCheckLoadingTimeout(),this.loading=!1,this.emit(ot.start)),this.playing||(this.playing=!0))}updateStats(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.isDestroyedOrClosed())return void this.debugLog(this.TAG_NAME,"updateStats but player is closed or destroyed");if(this._startBpsTime||(this._startBpsTime=Zr()),Do(e.ts)){const t=parseInt(e.ts,10);this._stats.ts=t,this._tempTsList.push(t),null===this._playingStartTimestamp&&t>0&&(this._playingStartTimestamp=t)}Do(e.dts)&&(this._stats.dts=parseInt(e.dts,10)),Do(e.mseTs)&&(this._stats.mseTs=e.mseTs),Do(e.buf)&&(this._stats.buf=e.buf),Do(e.netBuf)&&(this._stats.netBuf=e.netBuf),Do(e.currentPts)&&(this._stats.currentPts=e.currentPts),e.fps&&(this._stats.fps+=1),e.dfps&&(this._stats.dfps+=1),e.abps&&(this._stats.abps+=e.abps),e.vbps&&(this._stats.vbps+=e.vbps),e.workerStats&&(this._tempWorkerStats=e.workerStats),e.isDropping&&(this._stats.isDropping=e.isDropping),e.mseVideoBufferDelayTime&&(this._stats.mseVideoBufferDelayTime=parseInt(1e3*e.mseVideoBufferDelayTime,10));const t=Zr();if(t-this._startBpsTime<1e3)return;null!==this._playingStartTimestamp&&this._stats.fps>0&&(this._stats.pTs+=1);let i=0,s=0,r=0,o=0,a=0;this._opt.useMSE&&(this.mseDecoder?(i=this.mseDecoder.checkSourceBufferDelay(),i=parseInt(1e3*i,10),s=this.mseDecoder.checkSourceBufferStore(),s=s.toFixed(2),o=this.mseDecoder.getDecodePlaybackRate(),a=this.mseDecoder.getPendingSegmentsLength()):this.isMseDecoderUseWorker()&&(i=this.video.checkSourceBufferDelay(),i=parseInt(1e3*i,10),s=this.video.checkSourceBufferStore(),s=s.toFixed(2),o=this.video.getDecodePlaybackRate())),this._opt.useWCS&&this.webcodecsDecoder&&(r=this.webcodecsDecoder.getDecodeDiffTimes()),this.isOldHls()&&this.hlsDecoder&&(i=this.hlsDecoder.checkHlsBufferedDelay(),i=parseInt(1e3*i,10));let n=0,l=0,d=0;this.isUseHls265()&&this.hlsDecoder&&(i=this.hlsDecoder.checkHlsBufferedDelay(),i=i.toFixed(2),n=this.hlsDecoder.getDemuxBufferedListLength(),d=this.hlsDecoder.getDemuxVideoBufferedListLength(),l=this.hlsDecoder.getDemuxAudioBufferedListLength());let h=0,c=0,u=0,p=!1,f=0,m=0;this._opt.useWasm||this._opt.demuxUseWorker?this._tempWorkerStats&&(c=this._tempWorkerStats.demuxBufferDelay,u=this._tempWorkerStats.audioDemuxBufferDelay,h=this._tempWorkerStats.streamBufferByteLength,this._stats.netBuf=this._tempWorkerStats.netBuf,f=this._tempWorkerStats.pushLatestDelay,p=this._tempWorkerStats.isStreamTsMoreThanLocal,this._stats.buf=this._tempWorkerStats.latestDelay,m=this._tempWorkerStats.wasmDecodeDelay):this.demux&&(h=this.demux.getInputByteLength(),f=this.demux.getPushLatestDelay(),p=this.demux.getIsStreamTsMoreThanLocal(),this.demux.bufferList&&(c=this.demux.bufferList.length));let g=0,y=0;this.audio&&this.audio.bufferList&&(g=this.audio.bufferList.length,y=parseInt(g*this.audio.oneBufferDuration,10));let A=0,b=0;if(this.isPlayback()&&this.video){this._opt.playbackConfig.isUseFpsRender&&(A=this.video.bufferList&&this.video.bufferList.length||0);let e=this.video.getStreamFps();const t=e>0?1e3/e:0;b=parseInt(t*A+t*c,10)}let v=0;this.videoTimestamp>0&&(v=this._stats.dts-this.videoTimestamp);const _=v+this._stats.netBuf;this.isOldHls()&&(this._stats.fps=this.hlsDecoder.getFps()),this._stats.fps>this._stats.maxFps&&(this._stats.maxFps=this._stats.fps);let S=this.getVideoCurrentTime();const E=this._stats.videoCurrentTime;let w=-1;E&&S&&(w=yo((S-E).toFixed(2)),S=S.toFixed(2));let k=0;this.audioTimestamp>0&&(k=this.audioTimestamp-this.getRenderCurrentPts()),this._allStatsData=Object.assign(this._stats,{audioBuffer:g,audioBufferDelayTs:y,audioTs:this.audioTimestamp,latestAudioTs:this.latestAudioTimestamp,playbackVideoBuffer:A,playbackVideoWaitingBuffer:0,playbackAudioWaitingBuffer:0,playbackCacheDataDuration:b,demuxBuffer:c,pushLatestDelay:f,audioDemuxBuffer:u,streamBuffer:h,mseDelay:i,mseStore:s,mseDecodeDiffTimes:r,mseDecodePlaybackRate:o,msePendingBuffer:a,wcsDecodeDiffTimes:r,wasmDecodeDelay:m,hlsDelay:i,hlsDemuxLength:n,hlsDemuxAudioLength:l,hlsDemuxVideoLength:d,delayTs:v,totalDelayTs:_,isStreamTsMoreThanLocal:p,videoCurrentTime:S,videoCurrentTimeDiff:w,audioSyncVideo:k});let L=null,C=null,D="";if(this.isPlayer()&&this._opt.hasVideo&&this.playing){L=function(e,t){let i=3;const s=t||25;return e<=s*(1/4)?i=0:e<=.5*s?i=1:e<=s*(3/4)&&(i=2),i}(this._stats.fps,this._flvMetaDataFps),this._allStatsData.performance=L;const e=this.checkVideoSmooth(this._allStatsData);D=e.reason,C=e.result,this._allStatsData.videoSmooth=C}this.emit(ot.stats,this._allStatsData),this._allStatsData.streamBuffer>this._opt.flvDemuxBufferSizeMaxLarge&&this.getDemuxType()===T&&this.emit(lt.flvDemuxBufferSizeTooLarge,this._allStatsData.streamBuffer),this._opt.hasVideo?(this.updateHistoryFpsList(this._stats.fps,this._allStatsData.videoCurrentTimeDiff),Do(L)&&this.emit(ot.performance,L),Do(C)&&this.emit(ot.videoSmooth,C,D)):this._opt.hasAudio&&this.updateHistoryFpsList(this._stats.abps,0),this._stats.fps=0,this._stats.dfps=0,this._stats.abps=0,this._stats.vbps=0,this._tempTsList=[],this._stats.isDropping=!1,this._startBpsTime=t}resetStats(){this._startBpsTime=null,this._playingStartTimestamp=null,this._historyFpsList=[],this._historyVideoDiffList=[],this._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,currentPts:0,pTs:0,dts:0,mseVideoBufferDelayTime:0,isDropping:!1},this._allStatsData={},this._tempTsList=[]}checkVideoSmooth(e){let t=!0,i="";if(this._opt.videoBuffer,this._opt.videoBufferDelay,this.isWebrtcH264()||this.isOldHls())return{result:t,reason:i};if(0===e.vbps&&ua(this._opt.isHls)&&(i="vbpsIsZero",this.debugLog(this.TAG_NAME,`checkVideoSmooth false because ${i}`),t=!1),t&&e.isDropping&&(i="isDroppingIsTrue",this.debugLog(this.TAG_NAME,`checkVideoSmooth false because ${i}`),t=!1),t&&this.visibility&&this._historyFpsList.length>=this._opt.heartTimeout){const s=function(e){const t=Math.max(...e),i=Math.min(...e);return e.filter((e=>e!==t&&e!==i))}(this._historyFpsList),r=s.reduce(((e,t)=>e+t),0)/s.length,o=.83*r;e.fps=1.5||e.videoCurrentTimeDiff<=.5)&&-1!==e.videoCurrentTimeDiff){if(i="videoCurrentTimeDiffIsNotNormal",this.debugLog(this.TAG_NAME,`checkVideoSmooth false because videoCurrentTimeDiff is ${e.videoCurrentTimeDiff}`),0===Number(e.videoCurrentTimeDiff)){const e=this.isVideoPlaying(),t=this.getVideoCurrentTime(),i=this.getVideoBufferTimeRange();let s=-1,r=-1;i&&(s=i.start,r=i.end),this.debugLog(this.TAG_NAME,`checkVideoSmooth and videoCurrentTimeDiff is 0 so check\n videoCurrentTime is ${t} and isPlaying is ${e}\n bufferStartTime is ${s} and bufferEndTime is ${r}`)}t=!1}return{result:t,reason:i}}enableWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.enable()}releaseWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.disable()}clearBufferDelay(){this._opt.useWasm?this.decoderWorker&&this.decoderWorker.clearWorkBuffer(!0):this.demux&&this.demux.clearBuffer(!0)}doDestroy(){this.emit(ot.beforeDestroy)}handlePlayToRenderTimes(){if(this.isDestroyedOrClosed())return void this.debugLog(this.TAG_NAME,"handlePlayToRenderTimes but player is closed or destroyed");const e=this.getPlayToRenderTimes();this.emit(ot.playToRenderTimes,e)}getPlayToRenderTimes(){const e=this._times;return e.playTimestamp=e.playStart-e.playInitStart,e.streamTimestamp=e.streamStart-e.playStart,e.streamResponseTimestamp=e.streamResponse-e.streamStart>0?e.streamResponse-e.streamStart:0,e.demuxTimestamp=e.demuxStart-e.streamResponse>0?e.demuxStart-e.streamResponse:0,e.decodeTimestamp=e.decodeStart-e.demuxStart>0?e.decodeStart-e.demuxStart:0,e.videoTimestamp=e.videoStart-e.decodeStart,e.allTimestamp=e.videoStart-e.playInitStart,e}getOption(){return this._opt}getPlayType(){return this._opt.playType}isPlayer(){return this._opt.playType===b}isPlayback(){return this._opt.playType===_}isDemuxSetCodecInit(){let e=!0,t=this._opt;return t.useWCS&&!t.useOffscreen?e=!!this.webcodecsDecoder&&this.webcodecsDecoder.hasInit:t.useMSE&&(e=!!this.mseDecoder&&this.mseDecoder.hasInit),e}isDemuxDecodeFirstIIframeInit(){let e=!0,t=this._opt;return t.useWCS&&!t.useOffscreen?e=!!this.webcodecsDecoder&&this.webcodecsDecoder.isDecodeFirstIIframe:t.useMSE&&(e=!!this.mseDecoder&&this.mseDecoder.isDecodeFirstIIframe),e}isAudioPlaybackRateSpeed(){let e=!1;return this.audio&&(e=this.audio.isPlaybackRateSpeed()),e}getPlayingTimestamp(){return this._stats.pTs}getRecordingType(){let e=null;return this.recorder&&(e=this.recorder.getType()),e}getRecordingByteLength(){let e=0;return this.recording&&(e=this.recorder.getToTalByteLength()),e}getRecordingDuration(){let e=0;return this.recording&&(e=this.recorder.getTotalDuration()),e}getDecodeType(){let e="";const t=this.getOption();return this.isWebrtcH264()?z:this.isAliyunRtc()?V:this.isOldHls()?W:(t.useMSE&&(e+=F+" ",t.mseDecoderUseWorker&&(e+="worker")),t.useWCS&&(e+=U+" "),t.useWasm&&(e+=N+" ",t.useSIMD&&(e+=j+" "),t.useMThreading&&(e+=G+" ")),t.useOffscreen&&(e+=O+" "),e)}getDemuxType(){return this._opt.demuxType}getRenderType(){let e="";return this.video&&(e=this.video.getType()),e}getCanvasRenderType(){let e="";return this.video&&(e=this.video.getCanvasType()),e}getAudioEngineType(){let e="";return this.audio&&(e=this.audio.getEngineType()),e}getStreamType(){let e="";return this.stream&&(e=this.stream.getStreamType()),e}getAllStatsData(){return this._allStatsData}isFlvDemux(){return this._opt.demuxType===T}isM7SDemux(){return this._opt.demuxType===k}isNakedFlowDemux(){return this._opt.demuxType===x}isMpeg4Demux(){return this._opt.demuxType===P}isTsDemux(){return this._opt.demuxType===I}isFmp4Demux(){return this._opt.demuxType===R}togglePerformancePanel(e){this.updateOption({showPerformance:e}),this.emit(ot.togglePerformancePanel,e)}setScaleMode(e){let t={isFullResize:!1,isResize:!1,aspectRatio:"default"};switch(e=Number(e)){case Xt:t.isFullResize=!1,t.isResize=!1;break;case Zt:t.isFullResize=!1,t.isResize=!0;break;case ei:t.isFullResize=!0,t.isResize=!0}this.updateOption(t),this.resize(),this.emit(ot.viewResizeChange,e)}startVisibilityHiddenTimeout(){this.clearVisibilityHiddenTimeout(),this._opt.pageVisibilityHiddenTimeout>0&&(this.visibilityHiddenTimeout=setTimeout((()=>{this.emit(ot.visibilityHiddenTimeout)}),1e3*this._opt.pageVisibilityHiddenTimeout))}clearVisibilityHiddenTimeout(){this._checkVisibleHiddenTimeout&&(clearTimeout(this._checkVisibleHiddenTimeout),this._checkVisibleHiddenTimeout=null)}faceDetect(e){this.faceDetectActive=e,ua(e)&&this.video&&this.video.addAiContentToCanvas([])}objectDetect(e){this.objectDetectActive=e,ua(e)&&this.video&&this.video.addAiContentToCanvas([])}occlusionDetect(e){this.occlusionDetectActive=e}downloadNakedFlowFile(){this.demux&&this.demux.downloadNakedFlowFile&&this.demux.downloadNakedFlowFile()}downloadFmp4File(){this.demux&&this.demux.downloadFmp4File&&this.demux.downloadFmp4File()}downloadMpeg4File(){const e=new Blob([this._tempStreamList]);try{const t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".mpeg4",t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadMpeg4File",e)}}hasCacheOnGopBuffer(){const e=this.videoIframeIntervalTs,t=this._allStatsData.demuxBuffer,i=this._allStatsData.maxFps;let s=!1;if(e&&t&&i){s=1e3/i*t>e}return s}addContentToCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.video&&this.video.addContentToCanvas(e)}addContentToContainer(){}sendWebsocketMessage(e){const t=this.getStreamType();t===f||t===y+" "+f?this.stream.sendMessage(e):this.debugWarn(this.TAG_NAME,`sendWebsocketMessage: stream type is not websocket, current stream type is ${this.getStreamType()}`)}checkIsInRender(){const e=this._stats;return e.vbps>0&&e.fps>0}setControlHtml(e){this.control&&this.control.$controlHtml&&(this.control.$controlHtml.innerHTML=e)}clearControlHtml(){this.control&&this.control.$controlHtml&&(this.control.$controlHtml.innerHTML="")}toggleControlHtml(e){this.control&&this.control.toggleControlHtml(e)}getControlHtmlIsShow(){return!!this.control&&this.control.getControlHtmlIsShow()}getControlHtml(){return this.control?this.control.getControlHtml():null}setExtendHtml(e){this.control&&(this.control.$extendDom?this.control.updateExtendDom(e):this.control.addExtendDom({html:e,showBeforePlay:!0}))}clearExtendHtml(){this.control&&this.control.removeExtendDom()}toggleExtendHtml(e){this.control&&this.control.toggleExtendDom(e)}getExtendHtmlIsShow(){return!!this.control&&this.control.getExtendDomIsShow()}getExtendHtml(){return this.control?this.control.getExtendDom():null}updateWatermark(e){this.singleWatermark||(this.singleWatermark=new Fa(this)),this.singleWatermark&&this.singleWatermark.update(e)}removeWatermark(){this.singleWatermark&&this.singleWatermark.remove()}getVideoInfo(){let e=null;return this.video&&(e=this.video.getVideoInfo()),e}getAudioInfo(){let e=null;return this.audio&&(e=this.audio.getAudioInfo()),e}getVideoPlaybackQuality(){let e=null;return this.video&&(e=this.video.getPlaybackQuality()),e}emitError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.emit(ot.error,e,t),this.emit(e,t)}updateHistoryFpsList(e,t){this.playbackPause||ua(this.visibility)||(this._historyFpsList.length>this._opt.heartTimeout&&(this._historyFpsList.shift(),this._historyVideoDiffList.shift()),this._historyFpsList.push(e),this._historyVideoDiffList.push(t),this.isHistoryFpsListAllZero()&&this.checkHeartTimeout$2())}isHistoryFpsListAllZero(){let e=!0;if(this._historyFpsList.length0){e=!1;break}if(e)for(let t=0;t0){e=!1;break}return e}isUseHls265(){return ca(this._opt.isHls)&&ca(this._opt.supportHls265)}isHls(){return ca(this._opt.isHls)}isOldHls(){return ca(this._opt.isHls)&&ua(this._opt.supportHls265)}isWebrtcNotH265(){return ca(this._opt.isWebrtc)&&ua(this._opt.isWebrtcH265)}isWebrtcH264(){return ca(this._opt.isWebrtc)&&ua(this._opt.isWebrtcH265)}isWebrtcH265(){return ca(this._opt.isWebrtc)&&ca(this._opt.isWebrtcH265)}isAliyunRtc(){return ca(this._opt.isAliyunRtc)}isUseHls265UseMse(){return this.isUseHls265()&&this.isUseMSE()}isStreamWebTransport(){return this.getStreamType()===g}isPlaybackCacheBeforeDecodeForFpsRender(){return this.isPlayback()&&ca(this._opt.playbackConfig.isCacheBeforeDecodeForFpsRender)&&ca(this._opt.useWCS)}isPlaybackPauseNotClearCacheAndCacheBeforeDecodeAndUseFpsRender(){return this.isPlayback()&&ua(this._opt.playbackConfig.isPlaybackPauseClearCache)&&ca(this._opt.playbackConfig.isCacheBeforeDecodeForFpsRender)}isPlaybackUseWCS(){return this.isPlayback()&&ca(this._opt.useWCS)}isPlaybackUseMSE(){return this.isPlayback()&&ca(this._opt.useMSE)}isPlaybackUseWASM(){return this.isPlayback()&&ca(this._opt.useWasm)}isPlayUseMSE(){return this.isPlayer()&&ca(this._opt.useMSE)}isMSEDecodeAudio(){return this._opt.useMSE&&this._opt.mseDecodeAudio}isWCSDecodeAudio(){this._opt.useWCS&&this._opt.wcsDecodeAudio}isInWebFullscreen(){return this._opt.useWebFullScreen&&no()&&this.fullscreen}getPlaybackRate(){let e=1;return ca(this.isPlayback())&&this.playback&&(e=this.playback.rate),e}isPlaybackOnlyDecodeIFrame(){return ca(this.isPlayback())&&this.getPlaybackRate()>=this._opt.playbackForwardMaxRateDecodeIFrame&&!this.isMSEDecodeAudio()}pushTempStream(e){const t=new Uint8Array(e);this._tempStreamList.push(t)}updateLoadingText(e){this.loading&&this.control&&this.control.updateLoadingText(e)}getVideoCurrentTime(){let e=0;return this.video&&(this._opt.useMSE?this.mseDecoder?e=this.mseDecoder.getVideoCurrentTime():this.isMseDecoderUseWorker()&&(e=this.video.getVideoCurrentTime()):this.isWebrtcH264()&&this.webrtc?e=this.webrtc.getVideoCurrentTime():this.isAliyunRtc()&&this.aliyunRtcDecoder&&(e=this.aliyunRtcDecoder.getVideoCurrentTime())),e}getVideoBufferTimeRange(){let e=null;return this.video&&(this._opt.useMSE?this.mseDecoder?e=this.mseDecoder.getVideoBufferTimeRange():this.isMseDecoderUseWorker()&&(e=this.video.getVideoBufferTimeRange()):this.isWebrtcH264()&&this.webrtc?e=this.webrtc.getVideoBufferTimeRange():this.isAliyunRtc()&&this.aliyunRtcDecoder&&(e=this.aliyunRtcDecoder.getVideoBufferTimeRange())),e}isVideoPlaying(){let e=!0;return this.video&&(this._opt.useMSE?this.mseDecoder?e=this.mseDecoder.isVideoPlaying():this.isMseDecoderUseWorker()&&(e=this.video.isVideoPlaying()):this.isWebrtcH264()&&this.webrtc?e=this.webrtc.isVideoPlaying():this.isAliyunRtc()&&this.aliyunRtcDecoder&&(e=this.aliyunRtcDecoder.isVideoPlaying())),e}addMemoryLog(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s0){const e=t/1e3;this._flvMetaDataFps=e}}Co(e.hasAudio)&&ua(e.hasAudio)&&(this.debugLog("updateMetaData","hasAudio",e.hasAudio,"and update _opt.hasAudio"),this._opt.hasAudio=e.hasAudio),Co(e.hasVideo)&&ua(e.hasVideo)&&(this.debugLog("updateMetaData","hasVideo",e.hasVideo,"and update _opt.hasVideo"),this._opt.hasVideo=e.hasVideo),e.server&&(this._serverInfo=(e.server+"").substring(0,10)),e.MetaDataCreator&&(this._serverInfo=e.MetaDataCreator)}this.emit(ot.flvMetaData,e)}getMetaData(){return this._flvMetaData}getExtendBtnList(){return this.control.getExtendBtnList().map((e=>({name:e.name,$container:e.$iconContainer,$btn:e.$iconWrap,$activeBtn:e.$activeIconWrap})))}getCpuLevel(){let e=null;return this.pressureObserverCpu&&(e=this.pressureObserverCpu.getCurrentCpuState()),e}isRecordTypeFlv(){return this.recorder&&this._opt.recordType===w}isRecordTypeMp4(){return this.recorder&&this._opt.recordType===S}isRecordTypeWebm(){return this.recorder&&this._opt.recordType===E}isDemuxInWorker(){return this._opt.useWasm||this._opt.demuxUseWorker}isUseMSE(){return ca(this._opt.useMSE)}isUseWCS(){return ca(this._opt.useWCS)}isUseWASM(){return ca(this._opt.useWasm)}isMseDecoderUseWorker(){return this.isUseMSE()&&ca(this._opt.mseDecoderUseWorker)}getAudioSyncVideoDiff(){return this.audioTimestamp-this.getRenderCurrentPts()}getCurrentVideoAndAudio(){return{video:this.getRenderCurrentPts(),audio:this.audioTimestamp}}getMseVideoBufferDelayTime(){let e=0;return this._opt.useMSE&&this.mseDecoder&&(this.mseDecoder?e=this.mseDecoder.getVideoBufferDelayTime():this.isMseDecoderUseWorker()&&(e=this.video.getVideoBufferDelayTime()),e=parseInt(1e3*e,10)),e}updateCurrentPts(e){this.updateStats({currentPts:e}),this.emit(ot.currentPts,e),this.emitVideSeiSyncPts(e)}emitVideoSei(e){this.emit(ot.videoSEI,e),this._seiList.push(e)}emitVideSeiSyncPts(e){if(0===this._seiList.length||ua(this._opt.isEmitSEI))return;const t=1e3*this._opt.videoSEISyncPtsDiff,i=e-t,s=e+t,r=[];this._seiList.forEach((t=>{t.ts>=i&&t.ts<=s&&(t.pts=e,r.push(t))})),r.forEach((e=>{this.emit(ot.videoSEISyncPts,e)})),this._seiList=this._seiList.filter((e=>e.ts>s))}getRenderCurrentPts(){let e=0;return e=this._stats.currentPts?this._stats.currentPts:this.videoTimestamp-this.getMseVideoBufferDelayTime(),e}openSyncAudioAndVideo(){return this._opt.syncAudioAndVideo&&this._opt.hasVideo}showTipsMessageByCode(e){if(this.control){const t=this._opt.showMessageConfig[e]||"未知异常";this.control.showTipsMessage(t,e)}}showTipsMessageByContent(e){this.control&&e&&this.control.showTipsMessage(e)}hideTipsMessage(){this.control&&this.control.hideTipsMessage()}decoderCheckFirstIFrame(){ca(this._opt.checkFirstIFrame)&&(this.mseDecoder?this.mseDecoder.isDecodeFirstIIframe=!1:this.webcodecsDecoder&&(this.webcodecsDecoder.isDecodeFirstIIframe=!1))}isHlsCanVideoPlay(){return this._canPlayAppleMpegurl&&this.isOldHls()}setPtzPosition(e){this.control&&this.control.updatePtzPosition(e)}setRotate(e){this.updateOption({rotate:e}),this.resize()}setPlayFailedAndPaused(){this.isPlayFailedAndPaused=!0}getMseMineType(){let e={};return this.mseDecoder&&(e=this.mseDecoder.getMimeType()),e}getMaxDelayTs(){return this._opt.videoBuffer+this._opt.videoBufferDelay}isMseVideoStateInited(){return!this.video||this.video.getReadyStateInited()}showPlayBtn(){this.control&&this.control.showPlayBtn()}toggleControlExtendBtn(e,t){this.control&&this.control.toggleExtendBtn(e,t)}getControlExtendBtnActive(e){let t=!1;return this.control&&(t=this.control.getExtendBtnActive(e)),t}useVideoPlayAudio(){return this._opt.hasAudio&&(this._opt.useWCS&&this._opt.wcsDecodeAudio||this._opt.useWasm&&this._opt.wasmPlayAudioUseVideoRender)}isControlBarShow(){const e=this._opt.hasControl,t=this._opt.controlAutoHide;let i=e&&!t;return i&&this.control&&(i=this.control.getBarIsShow()),i}getControlBarShow(){let e=!1;return this.control&&(e=this.control.getBarIsShow()),e}toggleControlBar(e){this.control&&(this.control.toggleBar(e),this.resize())}debugLog(e){if(this._opt.debug&&this.debug){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s1?t-1:0),s=1;s1?t-1:0),s=1;s1&&0===e[e.length-1]&&0===e[e.length-2]}}class bv{constructor(e){this.player=e,this.globalSetting=null;const t=Ao();this.defaultSettings={watermark_id:`JbPro_${t}`,watermark_prefix:`JbPro_mask_${t}`,watermark_txt:"JbPro 测试水印",watermark_x:0,watermark_y:0,watermark_rows:0,watermark_cols:0,watermark_x_space:0,watermark_y_space:0,watermark_font:"微软雅黑",watermark_color:"black",watermark_fontsize:"18px",watermark_alpha:.15,watermark_width:150,watermark_height:100,watermark_angle:15,watermark_parent_width:0,watermark_parent_height:0,watermark_parent_node:null},this.load({text:decodeURIComponent("JessibucaPro%20%E4%BD%93%E9%AA%8C"),color:"white"}),this.player.debugLog("Watermark","int")}destroy(){this._removeMark(),this.globalSetting=null,this.defaultSettings=null,this.player.debugLog("Watermark","destroy")}remove(){}load(e){this.globalSetting=e,this._loadMark(e)}resize(){this.player.debugLog("Watermark","resize()"),this.globalSetting&&this._loadMark(this.globalSetting)}_loadMark(){let e=this.defaultSettings;if(1===arguments.length&&"object"==typeof arguments[0]){var t=arguments[0]||{};for(let i in t)t[i]&&e[i]&&t[i]===e[i]||(t[i]||0===t[i])&&(e[i]=t[i])}var i=document.getElementById(e.watermark_id);i&&i.parentNode&&i.parentNode.removeChild(i);var s="string"==typeof e.watermark_parent_node?document.getElementById(e.watermark_parent_node):e.watermark_parent_node,r=s||document.body;const o=r.getBoundingClientRect();var a=Math.max(r.scrollWidth,r.clientWidth,o.width),n=Math.max(r.scrollHeight,r.clientHeight,o.height),l=arguments[0]||{},d=r;(l.watermark_parent_width||l.watermark_parent_height)&&d&&(e.watermark_x=e.watermark_x+0,e.watermark_y=e.watermark_y+0);var h=document.getElementById(e.watermark_id),c=null;if(h)h.shadowRoot&&(c=h.shadowRoot);else{(h=document.createElement("div")).id=e.watermark_id,h.setAttribute("style","pointer-events: none !important; display: block !important"),c="function"==typeof h.attachShadow?h.attachShadow({mode:"open"}):h;var u=r.children,p=Math.floor(Math.random()*(u.length-1))+1;u[p]?r.insertBefore(h,u[p]):r.appendChild(h)}e.watermark_cols=parseInt((a-e.watermark_x)/(e.watermark_width+e.watermark_x_space));var f,m=parseInt((a-e.watermark_x-e.watermark_width*e.watermark_cols)/e.watermark_cols);e.watermark_x_space=m?e.watermark_x_space:m,e.watermark_rows=parseInt((n-e.watermark_y)/(e.watermark_height+e.watermark_y_space));var g,y,A,b=parseInt((n-e.watermark_y-e.watermark_height*e.watermark_rows)/e.watermark_rows);e.watermark_y_space=b?e.watermark_y_space:b,s?(f=e.watermark_x+e.watermark_width*e.watermark_cols+e.watermark_x_space*(e.watermark_cols-1),g=e.watermark_y+e.watermark_height*e.watermark_rows+e.watermark_y_space*(e.watermark_rows-1)):(f=0+e.watermark_x+e.watermark_width*e.watermark_cols+e.watermark_x_space*(e.watermark_cols-1),g=0+e.watermark_y+e.watermark_height*e.watermark_rows+e.watermark_y_space*(e.watermark_rows-1));for(var v=0;v\n \n \n ${m.watermark_txt}\n \n \n ${m.watermark_txt}\n \n \n \n \n `,_=window.btoa(unescape(encodeURIComponent(v)));var S=document.createElement("div");S.style.position="absolute",S.style.left="0px",S.style.top="0px",S.style.overflow="hidden",S.style.zIndex="9999999",S.style.width=a+"px",S.style.height=n+"px",S.style.display="block",S.style["-ms-user-select"]="none",S.style.backgroundImage=`url(data:image/svg+xml;base64,${_})`,c.appendChild(S)}_removeMark(){const e=this.defaultSettings;var t=document.getElementById(e.watermark_id);if(t){var i=t.parentNode;i&&i.removeChild(t)}}_calcTextSize(){const{watermark_txt:e,watermark_font:t,watermark_fontsize:i}=this.globalSetting,s=document.createElement("span");s.innerHTML=e,s.setAttribute("style",`font-family: ${t}; font-size: ${i}px; visibility: hidden; display: inline-block`),document.querySelector("body").appendChild(s);const r={width:s.offsetWidth,height:s.offsetHeight};return s.remove(),r}}const _v="right",Sv="left",Ev="up",wv="down",Tv="leftUp",kv="leftDown",Lv="rightUp",Cv="rightDown",Dv="zoomExpand",xv="zoomNarrow",Rv="apertureFar",Pv="apertureNear",Bv="focusFar",Iv="focusNear",Mv="setPos",Fv="calPos",Uv="delPos",Ov="wiperOpen",Nv="wiperClose",jv="cruiseStart",Gv={stop:0,fiStop:0,right:1,left:2,up:8,down:4,leftUp:10,leftDown:6,rightUp:9,rightDown:5,zoomExpand:16,zoomNarrow:32,apertureFar:72,apertureNear:68,focusFar:66,focusNear:65,setPos:129,calPos:130,delPos:131,wiperOpen:140,wiperClose:141,setCruise:132,decCruise:133,cruiseStart:136,cruiseStop:0},zv=[25,50,75,100,125,150,175,200,225,250],Wv=[1,2,3,4,5,6,7,8,9,16],Vv=[16,48,80,112,144,160,176,192,208,224];function Hv(e){const{type:t,speed:i=5,index:s=0}=e,r=function(e){return zv[(e=e||5)-1]||zv[4]}(i);let o,a,n,l;if(o=Gv[t],!o)return"";switch(t){case Ev:case wv:case Rv:case Pv:n=r;break;case _v:case Sv:case Bv:case Iv:a=r;break;case Tv:case kv:case Lv:case Cv:a=r,n=r;break;case Dv:case xv:l=function(e){return Vv[(e=e||5)-1]||Vv[4]}(i);break;case Fv:case Uv:case Mv:n=$v(s);break;case Nv:case Ov:a=1;break;case jv:a=$v(s)}return function(e,t,i,s){let r=[];r[0]=165,r[1]=15,r[2]=1,r[3]=0,r[4]=0,r[5]=0,r[6]=0,e&&(r[3]=e);t&&(r[4]=t);i&&(r[5]=i);s&&(r[6]=s);return r[7]=(r[0]+r[1]+r[2]+r[3]+r[4]+r[5]+r[6])%256,function(e){let t="";for(let i=0;it)){for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i===t?s[r]=qv(e[r]):"object"==typeof e[r]?s[r]=Kv(e[r],t,i+1):s[r]=e[r]);return s}}function Yv(){return(new Date).toLocaleString()}class Qv{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player=e,this.TAG_NAME="MemoryLogger",this.logMaxSize=(null==t?void 0:t.logMaxSize)||204800,this.logSize=0,this.logTextArray=[],this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.clear(),this.player.debugLog(this.TAG_NAME,"destroy")}clear(){this.logSize=0,this.logTextArray=[]}logCache(){let e="";try{for(var t=arguments.length,i=new Array(t),s=0;sKv(e)));e="[JbPro] "+Yv()+JSON.stringify(r)}catch(e){return}if(this.logSize+=e.length,this.logTextArray.push(e),this.logSize>this.logMaxSize){const e=this.logTextArray.shift();this.logSize-=e.length}}getLog(){return this.logTextArray.join("\n")}getLogBlob(){const e=this.getLog();return new Blob([e],{type:"text/plain"})}download(){const e=this.getLog();this.clear();const t=new Blob([e],{type:"text/plain"});Wa(t,"JbPro-"+Yv()+".log")}}class Xv extends Ea{constructor(e){super(),this.player=e,this.TAG_NAME="Network",this.online=this.isOnline(),this.prevOnline=this.online,this.interval=null,this._initListener(),this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.off(),this._stopCheck(),window.removeEventListener("online",this._updateOnlineStatus),window.removeEventListener("offline",this._updateOfflineStatus),this.player.debugLog(this.TAG_NAME,"destroy")}_initListener(){window.addEventListener("online",this._updateOnlineStatus.bind(this)),window.addEventListener("offline",this._updateOfflineStatus.bind(this))}_stopCheck(){this.interval&&(clearInterval(this.interval),this.interval=null)}_startCheck(){this.interval=setInterval((()=>{this.isOnline()!==this.prevOnline&&(this.isOnline()?this._updateOnlineStatus():this._updateOfflineStatus())}),1e3)}_updateOnlineStatus(){this.prevOnline=this.online,this.online=!0,this.logStatus(),this.emit("online")}_updateOfflineStatus(){this.prevOnline=this.online,this.online=!1,this.logStatus(),this.emit("offline")}logStatus(){const e=this.prevOnline?"online":"offline",t=this.online?"online":"offline";this.player.debugLog(this.TAG_NAME,`prevOnline: ${this.prevOnline}, online: ${this.online}, status: ${e} -> ${t}`)}isOnline(){return void 0===navigator.onLine||navigator.onLine}isOffline(){return!this.isOnline()}}class Zv extends Ea{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this._opt={},this.TAG_NAME="JbPro",this.$container=null,Object.keys(e).forEach((t=>{if(void 0===e[t])throw new Error(`JbPro option "${t}" can not be undefined`)})),this.originalOptions=e;const t=la();let i=Object.assign({},t,e);i.url="",i.isMulti&&(i.debugUuid=aa()),this.debug=new wr(this);let s=e.container;if("string"==typeof e.container&&(s=document.querySelector(e.container)),!s)throw this.debugError("JbPro","JbPro need container option and now container is",e.container),new Error("JbPro need container option");if(ua(i.isLive)){const e=document.createElement("video");return e.muted=!0,e.setAttribute("controlsList","nodownload"),e.disablePictureInPicture="disablePictureInPicture",e.style.position="absolute",e.style.top=0,e.style.left=0,e.style.height="100%",e.style.width="100%",s.appendChild(e),this.$videoElement=e,this.$container=s,void(this._opt=i)}if(i.decoder&&ua(-1!==i.decoder.indexOf("decoder-pro.js")||-1!==i.decoder.indexOf("decoder-pro-simd.js")))throw this.debugError("JbPro",`JbPro decoder ${i.decoder} must be decoder-pro.js or decoder-pro-simd.js`),new Error(`JbPro decoder ${i.decoder} must be decoder-pro.js or decoder-pro-simd.js`);if("CANVAS"===s.nodeName||"VIDEO"===s.nodeName)throw this.debugError("JbPro",`JbPro container type can not be ${s.nodeName} type`),new Error(`JbPro container type can not be ${s.nodeName} type`);if(i.videoBuffer>=i.heartTimeout)throw this.debugError("JbPro",`JbPro videoBuffer ${i.videoBuffer}s must be less than heartTimeout ${i.heartTimeout}s`),new Error(`JbPro videoBuffer ${i.videoBuffer}s must be less than heartTimeout ${i.heartTimeout}s`);if(this._checkHasCreated(s))throw this.debugError("JbPro","JbPro container has been created and can not be created again",s),new Error("JbPro container has been created and can not be created again",s);if(!s.classList)throw this.debugError(this.TAG_NAME,"JbPro container is invalid, must be a DOM Element",s),new Error("JbPro container is invalid, must be a DOM Element",s);var r,o,a;if(s.classList.add("jb-pro-container"),r=s,o=ee,a=Ao(),r&&(r.dataset?r.dataset[o]=a:r.setAttribute("data-"+o,a)),delete i.container,Do(i.videoBuffer)&&(i.videoBuffer=1e3*Number(i.videoBuffer)),Do(i.videoBufferDelay)&&(i.videoBufferDelay=1e3*Number(i.videoBufferDelay)),Do(i.networkDelay)&&(i.networkDelay=1e3*Number(i.networkDelay)),Do(i.aiFaceDetectInterval)&&(i.aiFaceDetectInterval=1e3*Number(i.aiFaceDetectInterval)),Do(i.aiObjectDetectInterval)&&(i.aiObjectDetectInterval=1e3*Number(i.aiObjectDetectInterval)),Do(i.timeout)&&(Lo(i.loadingTimeout)&&(i.loadingTimeout=i.timeout),Lo(i.heartTimeout)&&(i.heartTimeout=i.timeout)),Do(i.autoWasm)&&(Lo(i.decoderErrorAutoWasm)&&(i.decoderErrorAutoWasm=i.autoWasm),Lo(i.hardDecodingNotSupportAutoWasm)&&(i.hardDecodingNotSupportAutoWasm=i.autoWasm),Lo(i.mseWaitVideoCanplayAutoWasm)&&(i.mseWaitVideoCanplayAutoWasm=i.autoWasm)),Do(i.aiFaceDetectLevel)&&Lo(i.aiFaceDetectWidth)){const e=Vs[i.aiFaceDetectLevel];e&&(i.aiFaceDetectWidth=e)}if(Do(i.aiObjectDetectLevel)&&Lo(i.aiObjectDetectWidth)){const e=Hs[i.aiObjectDetectLevel];e&&(i.aiObjectDetectWidth=e)}ca(i.isCrypto)&&(i.isM7sCrypto=!0),this._opt=i,this.debugLog("JbPro","init"),i.videoBuffer>1e4&&this.debugWarn(this.TAG_NAME,`videoBuffer ${i.videoBuffer/1e3}s is too long, will black screen for ${i.videoBuffer/1e3}s , it is recommended to set it to less than 10s`),this._destroyed=!1,this._destroyLock=!1,this.$container=s,this._tempPlayBgObj={},this._tempVideoLastIframeInfo={},this._tempPlayerIsMute=!0,this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this._streamErrorReplayTimes=0,this._streamEndReplayTimes=0,this._websocket1006ErrorReplayTimes=0,this.events=new Sa(this),this._opt.isUseNewFullscreenWatermark?this.watermark=new vv(this):this.watermark=new bv(this),this.memoryLogger=new Qv(this),this.network=new Xv(this),this._websocket1006ErrorRetryLog=[],this._mseDecodeErrorRetryLog=[],this._wcsDecodeErrorRetryLog=[],this._isNetworkOfflinePaused=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this.widthOrHeightChangeReplayDelayTimeout=null,this.streamErrorReplayDelayTimeout=null,this.streamEndReplayDelayTimeout=null,this.playbackPauseTimeout=null,this.playbackResumeTimeout=null,this.initDecoderWorkerTimeout=null,this.$loadingBgImage=null,this.$loadingBg=null,this._initOnLock(),this._initPlayer(s,i),this._initWatermark(),this._initNetwork(),this.debugLog("JbPro",'init success and version is "8-13-2024"'),console.log('JbPro Version is "8-13-2024" '+(ua(ao)?"and is Trial Version[试用版本]":""))}destroy(){return new Promise(((e,t)=>{if(this.debugLog("JbPro","destroy()"),this._destroyLock)return t("JbPro is destroying");this._destroyLock=!0,this._destroyed=!0,this.off(),this._removeTimeout(),this._clearInitDecoderWorkerTimeout(),this._initOnLock(),this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")),this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$container&&this.$container.removeChild(this.$videoElement),this.$videoElement=null),this._removeLoadingBackgroundForIOS(),this.player?this.player.destroy().then((()=>{this.player=null,this._destroy(),this._destroyLock=!1,e()})).catch((e=>{this._destroyLock=!1,t(e)})):(this._destroy(),this._destroyLock=!1,e())}))}_removeTimeout(){this.widthOrHeightChangeReplayDelayTimeout&&(clearTimeout(this.widthOrHeightChangeReplayDelayTimeout),this.widthOrHeightChangeReplayDelayTimeout=null),this.streamErrorReplayDelayTimeout&&(clearTimeout(this.streamErrorReplayDelayTimeout),this.streamErrorReplayDelayTimeout=null),this.streamEndReplayDelayTimeout&&(clearTimeout(this.streamEndReplayDelayTimeout),this.streamEndReplayDelayTimeout=null),this.playbackPauseTimeout&&(clearTimeout(this.playbackPauseTimeout),this.playbackPauseTimeout=null),this.playbackResumeTimeout&&(clearTimeout(this.playbackResumeTimeout),this.playbackResumeTimeout=null)}_destroy(){var e,t;this.events&&(this.events.destroy(),this.events=null),this.watermark&&(this.watermark.destroy(),this.watermark=null),this.network&&(this.network.destroy(),this.network=null),this.memoryLogger&&(this.memoryLogger.destroy(),this.memoryLogger=null),this.$container&&(this.$container.classList.remove("jb-pro-container"),this.$container.classList.remove("jb-pro-fullscreen-web"),e=this.$container,t=ee,e&&(e.dataset?delete e.dataset[t]:e.removeAttribute("data-"+t)),this.$container=null),this._tempPlayBgObj=null,this._tempVideoLastIframeInfo=null,this._isNetworkOfflinePaused=!1,this._playerOnLock=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this._tempPlayerIsMute=!0,this._resetReplayTimes(),this.debugLog("JbPro","destroy end"),this._opt={},this.debug=null}_resetReplayTimes(){this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this._streamErrorReplayTimes=0,this._streamEndReplayTimes=0,this._websocket1006ErrorReplayTimes=0,this._websocket1006ErrorRetryLog=[],this._mseDecodeErrorRetryLog=[],this._wcsDecodeErrorRetryLog=[]}_getOriginalOpt(){const e=la();return Object.assign({},e,this.originalOptions)}_initPlayer(e,t){this.player=new Av(e,t),this._bindEvents()}_resetPlayer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(((t,i)=>{try{this.debugLog(this.TAG_NAME,"_resetPlayer()",JSON.stringify(e))}catch(t){this.debugLog(this.TAG_NAME,"_resetPlayer()",e)}const s=()=>{this._opt.url="",this._opt.playOptions={},this._opt=Object.assign(this._opt,e),this._initPlayer(this.$container,this._opt)};this.player?this.player.destroy().then((()=>{this.player=null,s(),this.debugLog(this.TAG_NAME,"_resetPlayer() end"),t()})).catch((e=>{this.debugError(this.TAG_NAME,"_resetPlayer() error",e),i(e)})):(s(),this.debugLog(this.TAG_NAME,"_resetPlayer() end"),t())}))}_bindEvents(){var e=this;Object.keys(at).forEach((t=>{this.player.on(at[t],(function(){for(var i=arguments.length,s=new Array(i),r=0;r{this.player&&this.player.showTipsMessageByCode(e)})),this.player.once(ot.beforeDestroy,(()=>{this.emit(ot.close),this.destroy().then((()=>{})).catch((e=>{}))})),this.player.on(ot.resize,(()=>{this.watermark&&this.watermark.resize()})),this.player.on(ot.fullscreen,(()=>{this.watermark&&this.watermark.resize()})),this.player.on(ot.videoInfo,(()=>{this.player&&(this.player.singleWatermark&&this.player.singleWatermark.resize(),this.player.ghostWatermark&&this.player.ghostWatermark.resize(),this.player.dynamicWatermark&&this.player.dynamicWatermark.resize())})),this.player.on(ot.memoryLog,(function(){e.memoryLogger.logCache(...arguments)})),this.player.on(ot.downloadMemoryLog,(()=>{this.downloadMemoryLog()}))}_initWatermark(){if(this._opt.fullscreenWatermarkConfig.text=decodeURIComponent("JessibucaPro%20%E4%BD%93%E9%AA%8C"),this._opt.fullscreenWatermarkConfig.color="white",zo(this._opt.fullscreenWatermarkConfig)){const e=Ro(this.$container,this._opt.fullscreenWatermarkConfig);if(!e.watermark_txt)return void this.debugWarn("JbPro","fullscreenWatermarkConfig text is empty");this.watermark.load(e)}}_initNetwork(){this.network.on(ot.online,(()=>{if(this.emit(ot.networkState,ot.online),this.isDestroyed())this.debugLog(this.TAG_NAME,"network online and JbPro is destroyed");else if(this.debugLog(this.TAG_NAME,"network online"),this._isNetworkOfflinePaused&&this._isNetworkOfflinePausedAndNextPlayConfig&&this._isNetworkOfflinePausedAndNextPlayConfig.url){const e=this._isNetworkOfflinePausedAndNextPlayConfig.url,t=this._isNetworkOfflinePausedAndNextPlayConfig.playOptions;this._streamErrorReplayTimes++;const i=this._isNetworkOfflinePausedAndNextPlayConfig.type||"unknown";this._isNetworkOfflinePaused=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this.debugLog(this.TAG_NAME,`${i} and network online and _streamErrorReplayTimes is ${this._streamErrorReplayTimes} and reset player and play`),this.play(e,t).then((()=>{this.debugLog(this.TAG_NAME,`${i} and network online and play success`)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.fetchError,{},e),this.debugError(this.TAG_NAME,`${i} and network online and play error`,e.toString(),e)}))}})),this.network.on(ot.offline,(()=>{this.emit(ot.networkState,ot.offline),this.debugLog(this.TAG_NAME,"network offline")}))}_checkHasCreated(e){if(!e)return!1;const t=function(e,t){return e?e.dataset?e.dataset[t]:e.getAttribute("data-"+t):""}(e,ee);return!!t}_initOnLock(){this.webglAlignmentErrorOnLock=!1,this.webglContextLostErrorOnLock=!1,this.mediaSourceH265NotSupportOnLock=!1,this.mediaSourceFullOnLock=!1,this.mediaSourceAppendBufferErrorOnLock=!1,this.mseSourceBufferErrorOnLock=!1,this.mediaSourceBufferedIsZeroErrorOnLock=!1,this.mseAddSourceBufferErrorOnLock=!1,this.mediaSourceDecoderConfigurationErrorOnLock=!1,this.mediaSourceTsIsMaxDiffOnLock=!1,this.mseWidthOrHeightChangeOnLock=!1,this.mediaSourceAudioG711NotSupportOnLock=!1,this.mediaSourceAudioInitTimeoutOnLock=!1,this.mediaSourceAudioNoDataTimeoutOnLock=!1,this.mseWorkerAddSourceBufferErrorOnLock=!1,this.mediaSourceUseCanvasRenderPlayFailedOnLock=!1,this.webcodecsH265NotSupportOnLock=!1,this.webcodecsUnsupportedConfigurationErrorOnLock=!1,this.webcodecsDecodeConfigureErrorOnLock=!1,this.webcodecsDecodeErrorOnLock=!1,this.wcsWidthOrHeightChangeOnLock=!1,this.webcodecsAudioNoDataTimeoutOnLock=!1,this.webcodecsAudioInitTimeoutOnLock=!1,this.simdDecodeErrorOnLock=!1,this.wasmWidthOrHeightChangeOnLock=!1,this.wasmUseVideoRenderErrorOnLock=!1,this.videoElementPlayingFailedOnLock=!1,this.simdH264DecodeVideoWidthIsTooLargeOnLock=!1,this.networkDelayTimeoutOnLock=!1,this.flvDemuxBufferSizeTooLargeOnLock=!1,this.fetchErrorOnLock=!1,this.streamEndOnLock=!1,this.websocketErrorOnLock=!1,this.webrtcErrorOnLock=!1,this.hlsErrorOnLock=!1,this.aliyunRtcErrorOnLock=!1,this.decoderWorkerInitErrorOnLock=!1,this.decoderWorkerWasmErrorOnLock=!1,this.videoElementPlayingFailedForWebrtcOnLock=!1,this.videoInfoErrorOnLock=!1,this.webrtcStreamH265OnLock=!1,this.mseWaitVideoCanplayTimeoutOnLock=!1}isDestroyed(){return this._destroyed}getOption(){return this.player?this.player.getOption():{}}setDebug(e){this.debugLog("JbPro",`setDebug() ${e}`),this._opt.debug=!!e,this.player?this.player.updateOption({debug:!!e},!0):this.debugWarn("JbPro","player is not init")}getIsDebug(){let e=!1;return this.player&&(e=this.player._opt.debug),e}mute(){this.debugLog("JbPro","mute()"),this.player&&this.player.mute(!0)}cancelMute(){this.debugLog("JbPro","cancelMute() and is mute is ",this.isMute()),this.player&&this.player.isAudioMute()&&this.player.mute(!1)}setVolume(e){this.debugLog("JbPro",`setVolume() ${e}`),this.player&&(this.player.volume=e)}getVolume(){let e=null;return this.player&&(e=this.player.volume,e=parseFloat(e).toFixed(2)),e}audioResume(){this.debugLog("JbPro","audioResume() and call cancelMute()"),this.cancelMute()}setTimeout(e){this.debugLog("JbPro",`setTimeout() ${e}`),e=Number(e),isNaN(e)?this.debugWarn("JbPro",`setTimeout error: ${e} is not a number`):(this._opt.timeout=e,this._opt.loadingTimeout=e,this._opt.heartTimeout=e,this.player&&this.player.updateOption({timeout:e,loadingTimeout:e,heartTimeout:e}))}setScaleMode(e){this.debugLog("JbPro",`setScaleMode() ${e}`),this.player?this.player.setScaleMode(e):this.debugWarn("JbPro","setScaleMode() player is null")}pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(((t,i)=>{this.debugLog("JbPro",`pause() ${e}`),this.isDestroyed()&&i("JbPro is destroyed"),(this._opt.pauseAndNextPlayUseLastFrameShow||this._opt.replayUseLastFrameShow)&&(this._tempPlayBgObj=this._getVideoLastIframeInfo()),this._tempPlayerIsMute=this.isMute(),this._pause(e).then((e=>{t(e)})).catch((e=>{i(e)}))}))}_pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(((t,i)=>{if(this.debugLog("JbPro",`_pause() ${e}`),this.isDestroyed())return i("JbPro is destroyed");this._resetReplayTimes(),this.player?this.player.pause(e).then((e=>{t(e)})).catch((e=>{i(e)})):i("player is null")}))}close(){return new Promise(((e,t)=>{if(this.isDestroyed())return t("JbPro is destroyed");this.debugLog("JbPro","close() and inner destroy()"),this.destroy().then((()=>{e()})).catch((e=>{t(e)}))}))}clearView(){this.debugLog("JbPro","clearView()"),this.player&&this.player.video?this.getRenderType()===H?this.player.video.clearView():this.debugWarn("JbPro","clearView","render type is video, not support clearView, please use canvas render type"):this.debugWarn("JbPro","clearView","player is null")}play(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(this.isDestroyed())return s("JbPro is destroyed");try{this.debugLog("JbPro",`play() ${e}`,JSON.stringify(t))}catch(i){this.debugLog("JbPro",`play() ${e}`,t)}if(!e&&!this._opt.url)return this.emit(ot.error,lt.playError),void s("url is null and this._opt.url is null");if(e&&(e=(""+e).trim(),-1===e.indexOf("http:")&&-1===e.indexOf("https:")&&-1===e.indexOf("webrtc:")&&-1===e.indexOf("ws:")&&-1===e.indexOf("wss:")&&-1===e.indexOf("wt:")&&-1===e.indexOf("artc:")))return s(`url ${e} must be "http:" or "https:" or "webrtc:" or "ws:" or "wss:" or "wt:" or "artc:" protocol`);if(ua(this._opt.isLive))return this.$videoElement.controls="controls",this.$videoElement.muted=!1,this.$videoElement.src=e,this.$videoElement.play(),void i(this.$videoElement);if(this._opt.isM7sCrypto){let r=t.cryptoKey||this._opt.playOptions.cryptoKey,o=t.cryptoIV||this._opt.playOptions.cryptoIV;if(this._opt.m7sCryptoKey&&(!r||!o)){const e=this._opt.m7sCryptoKey.split(".");r=ra(e[0]),o=ra(e[1])}if(!r||!o){const r=e||this._opt.url;return void this._cryptoPlay(r).then((r=>{let{cryptoIV:o,cryptoKey:a}=r;this._opt.playOptions.cryptoKey=a,this._opt.playOptions.cryptoIV=o,t.cryptoIV=o,t.cryptoKey=a,this._playBefore(e,t).then((()=>{i()})).catch((e=>{s(e)}))})).catch((e=>{s(e)}))}this._opt.playOptions.cryptoKey=r,this._opt.playOptions.cryptoIV=o,t.cryptoIV=o,t.cryptoKey=r}else if(this._opt.isXorCrypto){let e=t.cryptoKey||this._opt.playOptions.cryptoKey,i=t.cryptoIV||this._opt.playOptions.cryptoIV;if(this._opt.xorCryptoKey&&(!e||!i)){const t=this._opt.xorCryptoKey.split(".");e=ra(t[0]),i=ra(t[1])}e&&i&&(this._opt.playOptions.cryptoKey=e,this._opt.playOptions.cryptoIV=i,t.cryptoIV=i,t.cryptoKey=e)}else if(this._opt.isSm4Crypto){let e=t.cryptoKey||this._opt.playOptions.cryptoKey,i=t.cryptoIV||this._opt.playOptions.cryptoIV;if(this._opt.sm4CryptoKey&&(!e||!i)){const t=this._opt.sm4CryptoKey.split(".");2===t.length&&(e=il(t[0]),i=il(t[1]))}e&&i&&(this._opt.playOptions.cryptoKey=e,this._opt.playOptions.cryptoIV=i,t.cryptoIV=i,t.cryptoKey=e)}this._playBefore(e,t).then((()=>{i()})).catch((e=>{s(e)}))}))}_playBefore(e,t){return new Promise(((i,s)=>{if(this.player)if(e)if(this._opt.url)if(e===this._opt.url)if(this.player.playing)this.debugLog("JbPro","_playBefore","playing and resolve()"),i();else{this.debugLog("JbPro","_playBefore","this._opt.url === url and pause -> play and destroy play");let e=this._getOriginalOpt();(this._opt.pauseAndNextPlayUseLastFrameShow||this._opt.replayUseLastFrameShow)&&this._tempPlayBgObj&&this._tempPlayBgObj.loadingBackground&&(e=Object.assign(e,this._tempPlayBgObj)),ua(this._tempPlayerIsMute)&&(e.isNotMute=!0,this._tempPlayerIsMute=!0);const t=this._opt.url,r=this._opt.playOptions;this._resetPlayer(e).then((()=>{this._play(t,r).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore this.player.play error",e),this.emit(ot.crashLog,this.getCrashLog("this.player.play 1",e)),s(e)}))})).catch((e=>{this.debugError("JbPro","_resetPlayer error",e),s(e)}))}else{this.debugLog("JbPro","_playBefore",`\n this._url.url is ${this._opt.url}\n and new url is ${e}\n and destroy and play new url`);const r=this._getOriginalOpt();this._resetPlayer(r).then((()=>{this._play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(ot.crashLog,this.getCrashLog("this.player.play 2",e)),s(e)}))})).catch((e=>{this.debugError("JbPro","_resetPlayer error",e)}))}else this._play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(ot.crashLog,this.getCrashLog("this.player.play 3",e)),s(e)}));else{let e=this._getOriginalOpt();(this._opt.pauseAndNextPlayUseLastFrameShow||this._opt.replayUseLastFrameShow)&&this._tempPlayBgObj&&this._tempPlayBgObj.loadingBackground&&(e=Object.assign(e,this._tempPlayBgObj)),ua(this._tempPlayerIsMute)&&(e.isNotMute=!0,this._tempPlayerIsMute=!0);const t=this._opt.url,r=this._opt.playOptions;this._resetPlayer(e).then((()=>{this._play(t,r).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(ot.crashLog,this.getCrashLog("this.player.play 4",e)),s(e)}))})).catch((e=>{this.debugError("JbPro","_resetPlayer error",e)}))}else e?this._play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(ot.crashLog,this.getCrashLog("this.player.play 5",e)),s(e)})):this._play(this._opt.url,this._opt.playOptions).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(ot.crashLog,this.getCrashLog("this.player.play 6",e)),s(e)}))}))}_cryptoPlay(e){return new Promise(((t,i)=>{const s=function(e){const t=(e||document.location.toString()).split("//"),i=t[1].indexOf("/");let s=t[1].substring(i);return-1!=s.indexOf("?")&&(s=s.split("?")[0]),s}(e);let r=this._opt.cryptoKeyUrl,o="";const a=oa(e);if(r){if(o=r,this._opt.isM7sCrypto&&-1===o.indexOf("/crypto/?stream=")){const e=oa(r);o=e.origin+Z+`?stream=${s}`}}else r=a.origin+Z,o=r+`?stream=${s}`;var n;this.player.debugLog("JbPro",`_cryptoPlay() cryptoKeyUrl: ${o} and opt.cryptoKeyUrl: ${this._opt.cryptoKeyUrl}`),(n=o,new Promise(((e,t)=>{kl.get(n).then((t=>{e(t)})).catch((e=>{t(e)}))}))).then((e=>{if(e){const s=e.split("."),r=ra(s[0]),o=ra(s[1]);o&&r?t({cryptoIV:o,cryptoKey:r}):i("get cryptoIV or cryptoKey error")}else i(`cryptoKeyUrl: getM7SCryptoStreamKey ${o} res is null`)})).catch((e=>{i(e)}))}))}playback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(this.isDestroyed())return s("JbPro is destroyed");try{this.debugLog("JbPro",`playback() ${e}, options: `,JSON.stringify(t))}catch(i){this.debugLog("JbPro",`playback() ${e}, options: `,t)}if(ua(this._opt.isLive))return s("this._opt.isLive is false, can not playback");const r=da(),o=Object.assign({},r.playbackConfig,this._opt.playbackConfig,t);ua(o.isUseFpsRender)&&o.isCacheBeforeDecodeForFpsRender&&(o.isCacheBeforeDecodeForFpsRender=!1,this.debugWarn("JbPro","playbackConfig.isUseFpsRender is false, isCacheBeforeDecodeForFpsRender can not be ture, isCacheBeforeDecodeForFpsRender is set to false")),0===o.rateConfig.length&&o.showRateBtn&&(o.showRateBtn=!1,this.debugWarn("JbPro","playbackConfig.rateConfig.length is 0, showRateBtn can not be ture, showRateBtn is set to false")),o.controlType,Q.simple,this._resetPlayer({videoBuffer:0,playbackConfig:o,playType:_,openWebglAlignment:!0,useMSE:o.useMSE,useWCS:o.useWCS,useSIMD:!0}).then((()=>{this.play(e,t).then((()=>{i()})).catch((e=>{s(e)}))})).catch((e=>{s(e)}))}))}playbackPause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.isDestroyed()?Promise.reject("JbPro is destroyed"):(this.debugLog("JbPro",`playbackPause() ${e}`),this._opt.playType===b?Promise.reject("playType is player, can not call playbackPause method"):new Promise(((t,i)=>{if(!this.player)return i("player is null");ca(e)?this._pause().then((()=>{t()})).catch((e=>{i(e)})):(this.player.playbackPause=!0,this.player.recording=!1,this.player.zooming=!1,this.playbackPauseTimeout=setTimeout((()=>{this.playbackPauseTimeout=null,t()}),100))})))}playbackResume(){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):(this.debugLog("JbPro","playbackResume()"),this._opt.playType===b?Promise.reject("playType is player, can not call playbackResume method"):new Promise(((e,t)=>{if(!this.player)return t("player is null");this.player.playbackPause=!1,this.playbackResumeTimeout=setTimeout((()=>{this.playbackResumeTimeout=null,e()}),100)})))}forward(e){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):(this.debugLog("JbPro",`forward() ${e}`),ua(this._opt.isLive)||this._opt.playType===b?Promise.reject("forward() method only just for playback type"):_o(Number(e))?new Promise(((t,i)=>{this.player?(e=eo(Number(e),.1,32),this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"playbackRate",value:e}),this.player.playback.setRate(e),this.player.video&&this.player.video.setRate(e),this.player.audio&&this.player.audio.setRate(e),(this.player.isPlaybackUseWCS()||this.player.isPlaybackUseMSE())&&(this.player.demux&&ua(this.player.isPlaybackPauseNotClearCacheAndCacheBeforeDecodeAndUseFpsRender())&&this.player.demux.dropBuffer$2(),this.player.isPlaybackCacheBeforeDecodeForFpsRender()&&this.player.demux.initPlaybackCacheLoop()),t()):i("player is not playing")})):Promise.reject(`forward() params "rate": ${e} must be number type`))}playbackForward(e){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):new Promise(((t,i)=>{this.forward(e).then((()=>{t()})).catch((e=>{i(e)}))}))}normal(){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):new Promise(((e,t)=>{this.forward(1).then((()=>{e()})).catch((e=>{t(e)}))}))}playbackNormal(){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):new Promise(((e,t)=>{this.normal().then((()=>{e()})).catch((e=>{t(e)}))}))}updatePlaybackForwardMaxRateDecodeIFrame(e){this.isDestroyed()||(this.debugLog("JbPro",`updatePlaybackForwardMaxRateDecodeIFrame() ${e}`),e=Number(e),e=eo(e=parseInt(e,10),1,8),this._opt.playbackForwardMaxRateDecodeIFrame=e,this.player?this.player.updateOption({playbackForwardMaxRateDecodeIFrame:e},!0):this.debugWarn("JbPro","updatePlaybackForwardMaxRateDecodeIFrame() player is null"))}setPlaybackStartTime(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setPlaybackStartTime() ${e}`);const t=jo(e);this.player?this.player.isPlayback()?t<10&&0!==e&&this.player.playback.isControlTypeNormal()?this.debugWarn("JbPro",`setPlaybackStartTime() control type is normal and timestamp: ${e} is not valid`):this.player.playback.isControlTypeSimple()&&e>this.player.playback.totalDuration?this.debugWarn("JbPro",`setPlaybackStartTime() control type is simple and timestamp: ${e} is more than ${this.player.playback.totalDuration}`):this.player.playing&&(this.player.playback.isControlTypeNormal()&&10===t&&(e*=1e3),this.player.playback.setStartTime(e),this.playbackClearCacheBuffer()):this.debugWarn("JbPro","setPlaybackStartTime() playType is not playback"):this.debugWarn("JbPro","setPlaybackStartTime() player is null")}setPlaybackShowPrecision(e){this.isDestroyed()||(this.debugLog("JbPro",`setPlaybackShowPrecision() ${e}`),this.player?this.player.isPlayback()?this.player.playback.isControlTypeNormal()?this.player.playback.setShowPrecision(e):this.debugWarn("JbPro","control type is not normal , not support!"):this.debugWarn("JbPro","playType is not playback"):this.debugWarn("JbPro","player is null"))}playbackCurrentTimeScroll(){this.isDestroyed()||(this.debugLog("JbPro","playbackCurrentTimeScroll()"),this.player?this.player.isPlayback()?this.player.playback.isControlTypeNormal()?this.player.playback.currentTimeScroll():this.debugWarn("JbPro","control type is not normal , not support!"):this.debugWarn("JbPro","playType is not playback"):this.debugWarn("JbPro","player is null"))}playbackClearCacheBuffer(){this.isDestroyed()||(this.debugLog("JbPro","playbackClearCacheBuffer()"),this.player?this.player.isPlayback()?(this.player.video&&this.player.video.clear(),this.player.audio&&this.player.audio.clear(),this.clearBufferDelay()):this.debugWarn("JbPro","playType is not playback"):this.debugWarn("JbPro","player is null"))}getPlaybackCurrentRate(){return this.player?this.player.isPlayback()?this.player.getPlaybackRate():(this.debugWarn("JbPro","playType is not playback"),1):(this.debugWarn("JbPro","player is null"),1)}updatePlaybackLocalOneFrameTimestamp(e){this.isDestroyed()||(this.debugLog("JbPro",`updatePlaybackLocalOneFrameTimestamp() ${e}`),this.player?this.player.isPlayback()?this.player.playback.updateLocalOneFrameTimestamp(e):this.debugWarn("JbPro","playType is not playback"):this.debugWarn("JbPro","player is null"))}setStreamQuality(e){if(this.isDestroyed())return;if(this.debugLog("JbPro",`setStreamQuality() ${e}`),!this.player)return void this.debugWarn("JbPro","player is null");if(!this.player._opt.operateBtns.quality)return void this.debugWarn("JbPro","player._opt.operateBtns.quality is false");(this.player._opt.qualityConfig||[]).includes(e)?this.player.streamQuality=e:this.debugWarn("JbPro",`quality: ${e} is not in qualityList`)}_play(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(!this.player)return s("player is null");let r=!1;this._opt.url&&this._opt.url!==e&&(r=!0),this._opt.url=e,this._opt.playOptions=t;const u=e.split("?")[0],p=u.startsWith("http://")||u.startsWith("https://"),f=u.startsWith("webrtc://"),m=u.startsWith("artc://"),g=u.startsWith("wt://"),y=u.startsWith("ws://")||u.startsWith("wss://"),A=p||y,b=p&&u.endsWith(".m3u8"),v=A&&u.endsWith(".flv"),_=A&&(u.endsWith(".fmp4")||u.endsWith(".mp4")),S=A&&u.endsWith(".mpeg4"),E=A&&(u.endsWith(".h264")||u.endsWith(".h265")),w=A&&u.endsWith(".ts");let M=this._opt.isWebrtcForZLM||!1,F=this._opt.isWebrtcForSRS||!1,U=this._opt.isWebrtcForOthers||!1;f&&(-1!==e.indexOf("/index/api/webrtc")?(M=!0,F=!1,U=!1):-1!==e.indexOf("/rtc/v1/play/")&&(F=!0,M=!1,U=!1));let O=null,N=null;if(v&&ua(this._opt.isFlv)&&this._resetDemuxType("isFlv"),_&&ua(this._opt.isFmp4)&&this._resetDemuxType("isFmp4"),S&&ua(this._opt.isMpeg4)&&this._resetDemuxType("isMpeg4"),E&&ua(this._opt.isNakedFlow)&&this._resetDemuxType("isNakedFlow"),w&&ua(this._opt.isTs)&&this._resetDemuxType("isTs"),p?O=b?n:a:g?O=d:f?O=l:m?O=h:y&&(O=o),this._opt.isNakedFlow?N=x:this._opt.isFmp4?N=R:this._opt.isMpeg4?N=P:this._opt.isFlv?N=T:this._opt.isTs?N=I:b?N=L:f?N=C:m?N=B:g?N=D:y&&(N=k),!O||!N)return this._opt.playFailedAndPausedShowMessage&&this.showErrorMessageTips("url is not support"),s(`play url ${e} is invalid, protocol is ${c[O]}, demuxType is ${N}`);this.debugLog("JbPro",`play url ${e} protocol is ${c[O]}, demuxType is ${N}`);const j=()=>{this.player.on(lt.webglAlignmentError,this._handleWebglAlignmentError.bind(this)),this.player.on(lt.webglContextLostError,this._handleWebglContextLostError.bind(this)),this.player.on(lt.mediaSourceH265NotSupport,this._handleMediaSourceH265NotSupport.bind(this)),this.player.on(lt.mseWaitVideoCanplayTimeout,this._handleMseWaitVideoCanplayTimeout.bind(this)),this.player.on(lt.mediaSourceFull,this._handleMediaSourceFull.bind(this)),this.player.on(lt.mediaSourceAppendBufferError,this._handleMediaSourceAppendBufferError.bind(this)),this.player.on(lt.mseSourceBufferError,this._handleMseSourceBufferError.bind(this)),this.player.on(lt.mediaSourceBufferedIsZeroError,this._handleMediaSourceBufferedIsZeroError.bind(this)),this.player.on(lt.mseAddSourceBufferError,this._handleMseAddSourceBufferError.bind(this)),this.player.on(lt.mediaSourceDecoderConfigurationError,this._handleMediaSourceDecoderConfigurationError.bind(this)),this.player.on(lt.mediaSourceTsIsMaxDiff,this._handleMediaSourceTsIsMaxDiff.bind(this)),this.player.on(lt.mseWidthOrHeightChange,this._handleMseWidthOrHeightChange.bind(this)),this.player.on(lt.mediaSourceAudioG711NotSupport,this._handleMediaSourceAudioG711NotSupport.bind(this)),this.player.on(lt.mediaSourceAudioInitTimeout,this._handleMediaSourceAudioInitTimeout.bind(this)),this.player.once(lt.mediaSourceAudioNoDataTimeout,this._handleMediaSourceAudioNoDataTimeout.bind(this)),this.player.on(lt.mseWorkerAddSourceBufferError,this._handleMseWorkerAddSourceBufferError.bind(this)),this.player.on(lt.mediaSourceUseCanvasRenderPlayFailed,this._handleMediaSourceUseCanvasRenderPlayFailed.bind(this)),this.player.on(lt.webcodecsH265NotSupport,this._handleWebcodecsH265NotSupport.bind(this)),this.player.on(lt.webcodecsUnsupportedConfigurationError,this._handleWebcodecsUnsupportedConfigurationError.bind(this)),this.player.on(lt.webcodecsDecodeConfigureError,this._handleWebcodecsDecodeConfigureError.bind(this)),this.player.on(lt.webcodecsDecodeError,this._handleWebcodecsDecodeError.bind(this)),this.player.on(lt.wcsWidthOrHeightChange,this._handleWcsWidthOrHeightChange.bind(this)),this.player.on(lt.webcodecsAudioNoDataTimeout,this._handleWebcodecsAudioNoDataTimeout.bind(this)),this.player.on(lt.webcodecsAudioInitTimeout,this._handleWebcodecsAudioInitTimeout.bind(this)),this.player.on(lt.simdDecodeError,this._handleSimdDecodeError.bind(this)),this.player.on(lt.wasmWidthOrHeightChange,this._handleWasmWidthOrHeightChange.bind(this)),this.player.on(lt.wasmUseVideoRenderError,this._handleWasmUseVideoRenderError.bind(this)),this.player.on(lt.videoElementPlayingFailed,this._handleVideoElementPlayingFailed.bind(this)),this.player.on(lt.simdH264DecodeVideoWidthIsTooLarge,this._handleSimdH264DecodeVideoWidthIsTooLarge.bind(this)),this.player.on(ot.networkDelayTimeout,this._handleNetworkDelayTimeout.bind(this)),this.player.on(ot.flvDemuxBufferSizeTooLarge,this._handleFlvDemuxBufferSizeTooLarge.bind(this)),this.player.on(lt.fetchError,this._handleFetchError.bind(this)),this.player.on(ot.streamEnd,this._handleStreamEnd.bind(this)),this.player.on(lt.websocketError,this._handleWebsocketError.bind(this)),this.player.on(lt.webrtcError,this._handleWebrtcError.bind(this)),this.player.on(lt.hlsError,this._handleHlsError.bind(this)),this.player.on(lt.aliyunRtcError,this._handleAliyunRtcError.bind(this)),this.player.on(lt.decoderWorkerInitError,this._handleDecoderWorkerInitError.bind(this)),this.player.on(lt.decoderWorkerWasmError,this._handleDecoderWorkerWasmError.bind(this)),this.player.on(lt.videoElementPlayingFailedForWebrtc,this._handleVideoElementPlayingFailedForWebrtc.bind(this)),this.player.on(lt.videoInfoError,this._handleVideoInfoError.bind(this)),this.player.on(ot.webrtcStreamH265,this._handleWebrtcStreamH265.bind(this)),this.player.on(ot.delayTimeout,this._handleDelayTimeout.bind(this)),this.player.on(ot.loadingTimeout,this._handleLoadingTimeout.bind(this)),this._hasLoaded()?(this.debugLog(this.TAG_NAME,"_playNext and _hasLoaded() is true"),this.player.play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_hasLoaded() and play error",e),this.emit(ot.crashLog,this.getCrashLog("_hasLoaded() and play error",e)),this.player&&this.player.pause().then((()=>{s(e)})).catch((e=>{s(e),this.debugError("JbPro","_hasLoaded() and play error and next pause error",e)}))}))):(this.debugLog(this.TAG_NAME,"_playNext and waiting decoderWorkerInit callback"),this._checkInitDecoderWorkerTimeout(),this.player.once(ot.decoderWorkerInit,(()=>{this._clearInitDecoderWorkerTimeout(),this.isDestroyed()?this.debugLog("JbPro","decoderWorkerInit but player is destroyed"):(this.debugLog(this.TAG_NAME,"_playNext and decoderWorkerInit callback and next play"),this.player.play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","decoderWorkerInit and play error",e),this.emit(ot.crashLog,this.getCrashLog("decoderWorkerInit and play error",e)),this.player&&this.player.pause().then((()=>{s(e)})).catch((e=>{s(e),this.debugError("JbPro","decoderWorkerInit and play error and next pause error",e)}))})))})))},G=this.player.getOption(),z=b&&ua(this._opt.supportHls265),W=f&&ua(this._opt.isWebrtcH265),V=b&&!!Yo(),H=b&&G.demuxUseWorker;if(z||W||m||r||S||V||H)this.debugLog("JbPro",`need reset player and\n isOldHls is ${z} and isOldWebrtc is ${W} and\n isAliyunRtc is ${m} and\n needResetPlayer(url change) is ${r} and\n isMpeg4 is ${S} and\n isHlsCanVideoPlay is ${V} and\n isHlsButDemuxUseWorker is ${H}`),this._resetPlayer({protocol:O,demuxType:N,isHls:b,isWebrtc:f,isWebrtcForZLM:M,isWebrtcForSRS:F,isWebrtcForOthers:U,isAliyunRtc:m,cryptoKey:t.cryptoKey||"",cryptoIV:t.cryptoIV||"",url:e,playOptions:t}).then((()=>{j()})).catch((e=>{s("reset player error")}));else{const e={protocol:O,demuxType:N,isHls:b,isWebrtc:f,isAliyunRtc:m,isFlv:this._opt.isFlv,isFmp4:this._opt.isFmp4,isMpeg4:this._opt.isMpeg4,isNakedFlow:this._opt.isNakedFlow,isTs:this._opt.isTs,cryptoKey:t.cryptoKey||"",cryptoIV:t.cryptoIV||""};this._opt.isNakedFlow&&(e.mseDecodeAudio=!1,e.wcsDecodeAudio=!1),this.player.updateOption(e),j()}}))}_resetDemuxType(e){this._opt.isFlv=!1,this._opt.isFmp4=!1,this._opt.isMpeg4=!1,this._opt.isNakedFlow=!1,this._opt.isHls=!1,this._opt.isWebrtc=!1,this._opt.isWebrtcForZLM=!1,this._opt.isWebrtcForSRS=!1,this._opt.isWebrtcForOthers=!1,this._opt.isAliyunRtc=!1,this._opt.isTs=!1,e&&(this._opt[e]=!0),"isFmp4"!==e&&(this._opt.isFmp4Private=!1)}resize(){this.isDestroyed()||(this.debugLog("JbPro","resize()"),this.player&&this.player.resize())}setBufferTime(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setBufferTime() ${e}`),(e=Number(e))>10&&this.debugWarn("JbPro",`setBufferTime() buffer time is ${e} second, is too large, video will show blank screen until cache ${e} second buffer data`);const t=1e3*e;this._opt.videoBuffer=t,this.player?this.player.updateOption({videoBuffer:t},!0):this.debugWarn("JbPro","setBufferTime() player is null")}setBufferDelayTime(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setBufferDelayTime() ${e}`),(e=Number(e))<.2&&this.debugWarn("JbPro",`setBufferDelayTime() buffer time delay is ${e} second, is too small`);const t=1e3*(e=eo(e,.2,100));this._opt.videoBufferDelay=t,this.player?this.player.updateOption({videoBufferDelay:t},!0):this.debugWarn("JbPro","setBufferDelayTime() player is null")}setRotate(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setRotate() ${e}`),e=parseInt(e,10);this._opt.rotate!==e&&-1!==[0,90,180,270].indexOf(e)?(this._opt.rotate=e,this.player?this.player.setRotate(e):this.debugWarn("JbPro","setRotate() player is null")):this.debugWarn("JbPro",`setRotate() rotate is ${e} and this._opt.rotate is ${this._opt.rotate}`)}setMirrorRotate(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setMirrorRotate() ${e}`);e||(e="none"),this._opt.mirrorRotate!==e&&-1!==["none","level","vertical"].indexOf(e)?(this._opt.mirrorRotate=e,this.player?(this.player.updateOption({mirrorRotate:e}),this.resize()):this.debugWarn("JbPro","setMirrorRotate() player is null")):this.debugWarn("JbPro",`setMirrorRotate() mirrorRotate is ${e} and this._opt.mirrorRotate is ${this._opt.mirrorRotate}`)}setAspectRatio(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setAspectRatio() ${e}`);e||(e="default"),this._opt.aspectRatio!==e&&-1!==["default","4:3","16:9"].indexOf(e)?(this._opt.aspectRatio=e,this.player?(this.player.updateOption({aspectRatio:e}),this.resize()):this.debugWarn("JbPro","setAspectRatio() player is null")):this.debugWarn("JbPro",`setAspectRatio() aspectRatio is ${e} and this._opt.aspectRatio is ${this._opt.mirrorRotate}`)}hasLoaded(){return!0}_hasLoaded(){return this.player&&this.player.loaded||!1}setKeepScreenOn(){this.isDestroyed()||(this.debugLog("JbPro","setKeepScreenOn()"),this._opt.keepScreenOn=!0,this.player?this.player.updateOption({keepScreenOn:!0}):this.debugWarn("JbPro","setKeepScreenOn() player is not ready"))}setFullscreen(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setFullscreen() ${e}`);const t=!!e;this.player?this.player.fullscreen!==t?this.player.fullscreen=t:this.debugWarn("JbPro",`setFullscreen() fullscreen is ${t} and this.player.fullscreen is ${this.player.fullscreen}`):this.debugWarn("JbPro","setFullscreen() player is not ready")}setWebFullscreen(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setWebFullscreen() ${e}`);const t=!!e;this.player?this.player.webFullscreen=t:this.debugWarn("JbPro","setWebFullscreen() player is not ready")}screenshot(e,t,i,s){if(!this.isDestroyed())return this.debugLog("JbPro",`screenshot() ${e} ${t} ${i} ${s}`),this.player&&this.player.video?this.player.video.screenshot(e,t,i,s):(this.debugWarn("JbPro","screenshot() player is not ready"),null)}screenshotWatermark(e){return new Promise(((t,i)=>{if(this.isDestroyed())return i("player is destroyed");this.debugLog("JbPro","screenshotWatermark()",e),this.player&&this.player.video?this.player.video.screenshotWatermark(e).then((e=>{t(e)})).catch((e=>{i(e)})):(this.debugWarn("JbPro","screenshotWatermark() player is not ready"),i("player is not ready"))}))}screenshotCopyrightWatermark(e){return new Promise(((t,i)=>{if(this.isDestroyed())return i("player is destroyed");this.debugLog("JbPro","screenshotCopyrightWatermark()",e),this.player&&this.player.video?this.player.video.screenshotCopyrightWatermark(e).then((e=>{t(e)})).catch((e=>{i(e)})):(this.debugWarn("JbPro","screenshotCopyrightWatermark() player is not ready"),i("player is not ready"))}))}startRecord(e,t){return new Promise(((i,s)=>this.isDestroyed()?s("player is destroyed"):(this.debugLog("JbPro",`startRecord() ${e} ${t}`),this.player?void(this.player.playing?(this.player.startRecord(e,t),i()):(this.debugWarn("JbPro","startRecord() player is not playing"),s("not playing"))):(this.debugWarn("JbPro","startRecord() player is not ready"),s("player is not ready")))))}stopRecordAndSave(e,t){return new Promise(((i,s)=>{if(this.isDestroyed())return s("player is destroyed");this.debugLog("JbPro",`stopRecordAndSave() ${e} ${t}`),this.player&&this.player.recording?this.player.stopRecordAndSave(e,t).then((e=>{i(e)})).catch((e=>{s(e)})):s("not recording")}))}cancelRecord(){return new Promise(((e,t)=>this.isDestroyed()?t("player is destroyed"):(this.debugLog("JbPro","cancelRecord()"),this.player?void this.player.cancelRecord().then((()=>{e()})).catch((e=>{t(e)})):(this.debugWarn("JbPro","cancelRecord() player is not ready"),t("player is not ready")))))}isPlaying(){let e=!1;return this.player&&(e=this.player.isPlaying()),e}isLoading(){return!!this.player&&this.player.loading}isPause(){let e=!1;return this._opt.playType===b?e=!this.isPlaying()&&!this.isLoading():this._opt.playType===_&&this.player&&(e=this.player.playbackPause),e}isPaused(){return this.isPause()}isPlaybackPause(){let e=!1;return this._opt.playType===_&&this.player&&(e=this.player.playbackPause),e}isMute(){let e=!0;return this.player&&(e=this.player.isAudioMute()),e}isRecording(){return this.player&&this.player.recorder&&this.player.recorder.recording||!1}isFullscreen(){let e=!1;return this.player&&(e=this.player.fullscreen),e}isWebFullscreen(){let e=!1;return this.player&&(e=this.player.webFullscreen),e}clearBufferDelay(){this.isDestroyed()||(this.debugLog("JbPro","clearBufferDelay()"),this.player?this.player.clearBufferDelay():this.debugWarn("JbPro","clearBufferDelay() player is not init"))}setNetworkDelayTime(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setNetworkDelayTime() ${e}`),(e=Number(e))<1&&this.debugWarn("JbPro",`setNetworkDelayTime() network delay is ${e} second, is too small`);const t=1e3*(e=eo(e,1,100));this._opt.networkDelay=t,this.player?this.player.updateOption({networkDelay:t},!0):this.debugWarn("JbPro","setNetworkDelayTime() player is null")}getDecodeType(){let e="";return this.player&&(e=this.player.getDecodeType()),e}getRenderType(){let e="";return this.player&&(e=this.player.getRenderType()),e}getAudioEngineType(){let e="";return this.player&&(e=this.player.getAudioEngineType()),e}getPlayingTimestamp(){let e=0;return this.player&&(e=this.player.getPlayingTimestamp()),e}getStatus(){let e=gs;return this.player&&(e=this.player.loading?ps:this.player.playing?fs:ms),e}getPlayType(){return this.player?this.player._opt.playType:b}togglePerformancePanel(e){if(this.isDestroyed())return;this.debugLog("JbPro",`togglePerformancePanel() ${e}`);const t=this.player._opt.showPerformance;let i=!t;Co(e)&&(i=e),i!==t?this.player?this.player.togglePerformancePanel(i):this.debugWarn("JbPro","togglePerformancePanel() failed, this.player is not init"):this.debugWarn("JbPro",`togglePerformancePanel() failed, showPerformance is prev: ${t} === now: ${i}`)}openZoom(){if(!this.isDestroyed())if(this.debugLog("JbPro","openZoom()"),this.player){if(this.player.isDestroyedOrClosed())return void this.debugWarn("JbPro","openZoom() failed, this.player is destroyed or paused");this.player.zooming=!0}else this.debugWarn("JbPro","openZoom() failed, this.player is not init")}closeZoom(){if(!this.isDestroyed())if(this.debugLog("JbPro","closeZoom()"),this.player){if(this.player.isDestroyedOrClosed())return void this.debugWarn("JbPro","openZoom() failed, this.player is destroyed or paused");this.player.zooming=!1}else this.debugWarn("JbPro","closeZoom() failed, this.player is not init")}isZoomOpen(){let e=!1;return this.player&&(e=this.player.zooming),e}toggleZoom(e){this.isDestroyed()||(this.debugLog("JbPro",`toggleZoom() ${e}`),Co(e)||(e=!this.isZoomOpen()),ca(e)?this.openZoom():ua(!1)&&this.closeZoom())}expandZoom(){this.isDestroyed()||(this.debugLog("JbPro","expandZoom()"),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.expandPrecision():this.debugWarn("JbPro","expandZoom() failed, zoom is not open or not init"))}narrowZoom(){this.isDestroyed()||(this.debugLog("JbPro","narrowZoom()"),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.narrowPrecision():this.debugWarn("JbPro","narrowZoom failed, zoom is not open or not init"))}updateCurrentZoom(e){this.isDestroyed()||(this.debugLog("JbPro","updateCurrentZoom()",e),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.updateCurrentZoom(e):this.debugWarn("JbPro","narrowZoom failed, zoom is not open or not init"))}getCurrentZoomIndex(){if(this.isDestroyed())return;let e=1;return this.player&&this.player.zoom&&(e=this.player.zoom.currentZoom),e}setNakedFlowFps(e){return new Promise(((t,i)=>{if(this.isDestroyed())return i("player is destroyed");if(this.debugLog("JbPro","setNakedFlowFps()",e),Lo(e))return i("setNakedFlowFps() fps is empty");let s=Number(e);s=eo(s,1,100),this._opt.nakedFlowFps=s,this.player?this.player.updateOption({nakedFlowFps:s}):this.debugWarn("JbPro","setNakedFlowFps() player is null"),t()}))}getCrashLog(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!this.player)return;const i=this.player.getAllStatsData(),s=this.player;let r={url:this._opt.url,playType:s.isPlayback()?"playback":"live",demuxType:s.getDemuxType(),decoderType:s.getDecodeType(),renderType:s.getRenderType(),videoInfo:{encType:"",width:"",height:""},audioInfo:{encType:"",sampleRate:"",channels:""},audioEngine:s.getAudioEngineType(),allTimes:i.pTs,timestamp:Zr(),type:e,error:ia(t)||e};if(s.video){const e=s.video.videoInfo||{};r.videoInfo={encType:e.encType||"",width:e.width||"",height:e.height||""}}if(s.audio){const e=s.audio.audioInfo||{};r.audioInfo={encType:e.encType||"",sampleRate:e.sampleRate||"",channels:e.channels||""}}return r}updateDebugLevel(e){this.isDestroyed()||(this.debugLog("JbPro","updateDebugLevel()",e),e===J||e===q?e!==this.player._opt.debugLevel?(this._opt.debugLevel=e,this.player?this.player.updateOption({debugLevel:e},!0):this.debugWarn("JbPro","updateDebugLevel() player is null")):this.debugWarn("JbPro",`updateDebugLevel() level is same, level: ${e}`):this.debugWarn("JbPro",`updateDebugLevel() level is not valid, level: ${e}`))}updateWatermark(e){this.isDestroyed()||(this.debugLog("JbPro","updateWatermark()",e),this.player?this.player.updateWatermark(e):this.debugWarn("JbPro","updateWatermark() player is not init"))}removeWatermark(){this.isDestroyed()||(this.debugLog("JbPro","removeWatermark()"),this.player?this.player.removeWatermark():this.debugWarn("JbPro","removeWatermark() player is not init"))}updateFullscreenWatermark(e){if(!this.isDestroyed())if(this.debugLog("JbPro","updateFullscreenWatermark()",e),zo(e)){this._opt.fullscreenWatermarkConfig=e;const t=Ro(this.$container,e);if(!t.watermark_txt)return void this.debugWarn("JbPro","fullscreenWatermarkConfig text is empty");this.watermark.load(t)}else this.debugWarn("JbPro",`updateFullscreenWatermark() config is not valid, config: ${e}`)}removeFullscreenWatermark(){this.isDestroyed()||(this.debugLog("JbPro","removeFullscreenWatermark()"),this.watermark?this.watermark.remove():this.debugWarn("JbPro","removeFullscreenWatermark() watermark is not init"))}faceDetectOpen(){this.isDestroyed()||(this.debugLog("JbPro","faceDetectOpen()"),this.player?this.player.faceDetect(!0):this.debugWarn("JbPro","faceDetectOpen() player is not init"))}faceDetectClose(){this.isDestroyed()||(this.debugLog("JbPro","faceDetectClose()"),this.player?this.player.faceDetect(!1):this.debugWarn("JbPro","faceDetectClose() player is not init"))}objectDetectOpen(){this.isDestroyed()||(this.debugLog("JbPro","objectDetectOpen()"),this.player?this.player.objectDetect(!0):this.debugWarn("JbPro","objectDetectOpen() player is not init"))}objectDetectClose(){this.isDestroyed()||(this.debugLog("JbPro","objectDetectClose()"),this.player?this.player.objectDetect(!1):this.debugWarn("JbPro","objectDetectClose() player is not init"))}sendWebsocketMessage(e){this.isDestroyed()||(this.debugLog("JbPro","sendWebsocketMessage()",e),this.player?this.player.sendWebsocketMessage(e):this.debugWarn("JbPro","sendWebsocketMessage() player is not init"))}addContentToCanvas(e){this.isDestroyed()||(this.debugLog("JbPro","addContentToCanvas()"),this.player?this.player.addContentToCanvas(e):this.debugWarn("JbPro","addContentToCanvas() player is not init"))}clearContentToCanvas(){this.isDestroyed()||(this.debugLog("JbPro","clearContentToCanvas()"),this.player?this.player.addContentToCanvas([]):this.debugWarn("JbPro","clearContentToCanvas() player is not init"))}addContentToContainer(e){this.isDestroyed()||(this.debugLog("JbPro","addContentToContainer()"),this.player?this.player.addContentToContainer(e):this.debugWarn("JbPro","addContentToContainer() player is not init"))}clearContentToContainer(){this.isDestroyed()||(this.debugLog("JbPro","clearContentToContainer()"),this.player?this.player.addContentToContainer([]):this.debugWarn("JbPro","clearContentToContainer() player is not init"))}setControlHtml(e){this.isDestroyed()||(this.debugLog("JbPro","setControlHtml()",e),this.player?this.player.setControlHtml(e):this.debugWarn("JbPro","setControlHtml() player is not init"))}clearControlHtml(){this.isDestroyed()||(this.debugLog("JbPro","clearControlHtml()"),this.player?this.player.clearControlHtml():this.debugWarn("JbPro","clearControlHtml() player is not init"))}toggleControlHtml(e){this.isDestroyed()||(this.debugLog("JbPro",`toggleControlHtml() ${e}`),this.player?this.player.toggleControlHtml(e):this.debugWarn("JbPro","toggleControlHtml() player is not init"))}getControlHtmlIsShow(){return!!this.player&&this.player.getControlHtmlIsShow()}getControlHtml(){return this.player?this.player.getControlHtml():null}setExtendHtml(e){this.isDestroyed()||(this.debugLog("JbPro","setExtendHtml()",e),this.player?this.player.setExtendHtml(e):this.debugWarn("JbPro","setExtendHtml() player is not init"))}clearExtendHtml(){this.isDestroyed()||(this.debugLog("JbPro","clearExtendHtml()"),this.player?this.player.clearExtendHtml():this.debugWarn("JbPro","clearExtendHtml() player is not init"))}toggleExtendHtml(e){this.isDestroyed()||(this.debugLog("JbPro",`toggleExtendHtml() ${e}`),this.player?this.player.toggleExtendHtml(e):this.debugWarn("JbPro","toggleExtendHtml() player is not init"))}getExtendHtmlIsShow(){return!!this.player&&this.player.getExtendHtmlIsShow()}getExtendHtml(){return this.player?this.player.getExtendHtml():null}getVideoInfo(){let e=null;return this.player&&(e=this.player.getVideoInfo()),e}getAudioInfo(){let e=null;return this.player&&(e=this.player.getAudioInfo()),e}setSm4CryptoKey(e){if(this.isDestroyed())return;this.debugLog("JbPro","setSm4CryptoKey()",e);const t=(e=""+e).split(".");if(32!==e.length&&2!==t.length)return void this.debugWarn("JbPro",`setSm4CryptoKey() key is invalid and length is ${e.length} !== 32`);if(2===t.length&&(32!==t[0].length||32!==t[1].length))return void this.debugWarn("JbPro",`setSm4CryptoKey() key is invalid and key length is ${t[0].length} !== 32 or iv length ${t[1].length} !== 32`);this._opt.sm4CryptoKey=e;let i=2===t.length;if(i&&(this._opt.playOptions.cryptoKey=il(t[0]),this._opt.playOptions.cryptoIV=il(t[1])),this.player){const t={sm4CryptoKey:e};i&&(t.cryptoKey=this._opt.playOptions.cryptoKey,t.cryptoIV=this._opt.playOptions.cryptoIV),this.player.updateOption(t,!0)}else this.debugWarn("JbPro","setSm4CryptoKey() player is null")}setM7sCryptoKey(e){this.isDestroyed()||(this.debugLog("JbPro","setM7sCryptoKey()",e),e=""+e,this._opt.m7sCryptoKey=e,this.player?this.player.updateOption({m7sCryptoKey:e},!0):this.debugWarn("JbPro","setM7sCryptoKey() player is null"))}setXorCryptoKey(e){this.isDestroyed()||(this.debugLog("JbPro","setXorCryptoKey()",e),e=""+e,this._opt.xorCryptoKey=e,this.player?this.player.updateOption({xorCryptoKey:e},!0):this.debugWarn("JbPro","setXorCryptoKey() player is null"))}updateLoadingText(e){this.isDestroyed()||(this.debugLog("JbPro","updateLoadingText()",e),this.player?this.player.updateLoadingText(e):this.debugWarn("JbPro","updateLoadingText() player is null"))}updateIsEmitSEI(e){this.isDestroyed()||(this.debugLog("JbPro","updateIsEmitSEI()",e),this._opt.isEmitSEI=e,this.player?this.player.updateOption({isEmitSEI:e},!0):this.debugWarn("JbPro","updateIsEmitSEI() player is null"))}getPTZCmd(e,t){return this.debugLog("JbPro","getPTZCmd()",e),e?this.player?Hv({type:e,index:0,speed:t}):(this.debugWarn("JbPro","getPTZCmd() player is null"),null):(this.debugWarn("JbPro","getPTZCmd() ptz is null"),null)}downloadTempNakedFlowFile(){return new Promise(((e,t)=>{this.player?(this.player.downloadNakedFlowFile(),e()):t("player is not init")}))}downloadTempFmp4File(){return new Promise(((e,t)=>{if(this.isDestroyed())return t("player is destroyed");this.player?(this.player.downloadFmp4File(),e()):t("player is not init")}))}downloadTempMpeg4File(){return new Promise(((e,t)=>{if(this.isDestroyed())return t("player is destroyed");this.player?(this.player.downloadMpeg4File(),e()):t("player is not init")}))}downloadMemoryLog(){this.isDestroyed()||this.memoryLogger&&this.memoryLogger.download()}_getVideoLastIframeInfo(){const e=this.getVideoInfo()||{},t={loadingBackground:this.screenshot("","png",.92,"base64"),loadingBackgroundWidth:e.width||0,loadingBackgroundHeight:e.height||0};return t.loadingBackground&&t.loadingBackgroundWidth&&t.loadingBackgroundHeight&&(this._tempVideoLastIframeInfo=t),this._tempVideoLastIframeInfo||{}}getExtendBtnList(){this.debugLog("JbPro","getExtendBtnList()");let e=[];return this.player?e=this.player.getExtendBtnList():this.debugWarn("JbPro","getExtendBtnList() player is null"),e}getFlvMetaData(){this.debugLog("JbPro","getFlvMetaData()");let e=null;return this.player?e=this.player.getMetaData():this.debugWarn("JbPro","getFlvMetaData() player is null"),e}updateAiFaceDetectInterval(e){if(this.isDestroyed())return;this.debugLog("JbPro","updateAiFaceDetectInterval()",e);const t=1e3*(e=Number(e));this._opt.aiFaceDetectInterval=t,this.player?this.player.updateOption({aiFaceDetectInterval:t}):this.debugWarn("JbPro","updateAiFaceDetectInterval() player is null")}updateAiFaceDetectLevel(e){if(this.isDestroyed())return;if(this.debugLog("JbPro","updateAiFaceDetectLevel()",e),!Vs[e])return void this.debugWarn("JbPro",`'updateAiFaceDetectLevel() level ${e} is invalid'`);const t=Vs[e];this._opt.aiFaceDetectWidth=t,this.player?(this.player.updateOption({aiFaceDetectWidth:t}),this.player.ai&&this.player.ai.updateFaceDetectorConfig({detectWidth:t})):this.debugWarn("JbPro","updateAiFaceDetectLevel() player is null")}updateAiObjectDetectInterval(e){if(this.isDestroyed())return;this.debugLog("JbPro","updateAiObjectDetectInterval()",e);const t=1e3*(e=Number(e));this._opt.aiObjectDetectInterval=t,this.player?this.player.updateOption({aiObjectDetectInterval:t}):this.debugWarn("JbPro","updateAiObjectDetectInterval() player is null")}updateAiObjectDetectLevel(e){if(this.isDestroyed())return;if(this.debugLog("JbPro","updateAiObjectDetectLevel()",e),!Hs[e])return void this.debugWarn("JbPro",`'updateAiObjectDetectLevel() level ${e} is invalid'`);const t=Hs[e];this._opt.aiObjectDetectWidth=t,this.player?(this.player.updateOption({aiObjectDetectWidth:t}),this.player.ai&&this.player.ai.updateObjectDetectorConfig({detectWidth:t})):this.debugWarn("JbPro","updateAiObjectDetectLevel() player is null")}setCryptoKeyUrl(e){this.isDestroyed()||(this.debugLog("JbPro","setCryptoKeyUrl()",e),e&&(this._opt.cryptoKeyUrl=e))}showErrorMessageTips(e){this.isDestroyed()||(this.debugLog("JbPro","showErrorMessageTips()",e),e&&(this.player?this.player.showTipsMessageByContent(e):this.debugWarn("JbPro","showErrorMessageTips() player is null")))}setPtzPosition(e){this.debugLog("JbPro","setPtzPosition()",e),e&&!Go(e)&&(this.player?this.player.setPtzPosition(e):this.debugWarn("JbPro","setPtzPosition() player is null"))}hideErrorMessageTips(){this.isDestroyed()||(this.debugLog("JbPro","hideErrorMessageTips()"),this.player?this.player.hideTipsMessage():this.debugWarn("JbPro","hideErrorMessageTips() player is null"))}getContainerRect(){return this._getContainerRect()}proxy(e,t,i,s){return this.events.proxy(e,t,i,s)}getUrl(){return this._opt.url}toggleControlExtendBtn(e,t){this.isDestroyed()||(this.debugLog(this.TAG_NAME,`toggleControlExtendBtn() ${e} ${t}`),this.player?this.player.toggleControlExtendBtn(e,t):this.debugWarn(this.TAG_NAME,"toggleControlExtendBtn() player is null"))}getControlExtendBtnActive(e){if(this.isDestroyed())return;this.debugLog(this.TAG_NAME,`getControlExtendBtnActive() ${e}`);let t=!1;return this.player?t=this.player.getControlExtendBtnActive(e):this.debugWarn(this.TAG_NAME,"getControlExtendBtnActive() player is null"),t}toggleControlBar(e){this.isDestroyed()||(this.debugLog(this.TAG_NAME,`toggleControlBar() ${e}`),this.player?this.player.toggleControlBar(e):this.debugWarn(this.TAG_NAME,"toggleControlBar() player is null"))}getControlBarShow(){if(this.isDestroyed())return!1;this.debugLog(this.TAG_NAME,"getControlBarShow()");let e=!1;return this.player?e=this.player.getControlBarShow():this.debugWarn(this.TAG_NAME,"getControlBarShow() player is null"),e}static getCopyrightWatermarkHash(e){return Bo(e)}static extractScreenshotCopyrightWatermark(e){return function(e){for(var t=e,i=0,s=0,r=0;r<32;r++)s|=(1&t[i])<=5){const s=i[0],r=i[i.length-1],o=r-s;o<=1e4&&(this.debugWarn(this.TAG_NAME,`retry type is ${e}, and retry length is ${i.length}, and start is ${s} and end is ${r} and diff is ${o}`),t=!1)}return t}_initLoadingBackgroundForIOS(e){(po()||fo())&&e.loadingBackground&&e.loadingBackgroundWidth&&e.loadingBackgroundHeight&&(this.debugLog(this.TAG_NAME,"_initLoadingBackgroundForIOS"),this._initLoadingBg(),"default"===this.player._opt.aspectRatio||no()?this._doInitLoadingBackground(e):this._doInitLoadingBackgroundForRatio(e))}_doInitLoadingBackground(e){const t=this._getContainerRect();let i=t.height;const s=this.player._opt;if(this.player.isControlBarShow()){i-=s.playType===_?Qt:Yt}let r=t.width,o=i;const a=s.rotate;270!==a&&90!==a||(r=i,o=t.width),this.$loadingBgImage.width=r,this.$loadingBgImage.height=o,this.$loadingBgImage.src=e.loadingBackground;let n=(t.width-r)/2,l=(i-o)/2,d="contain";s.isResize||(d="fill"),s.isFullResize&&(d="none");let h="";"none"===s.mirrorRotate&&a&&(h+=" rotate("+a+"deg)"),"level"===s.mirrorRotate?h+=" rotateY(180deg)":"vertical"===s.mirrorRotate&&(h+=" rotateX(180deg)"),this._opt.videoRenderSupportScale&&(this.$loadingBgImage.style.objectFit=d),this.$loadingBgImage.style.transform=h,this.$loadingBgImage.style.padding="0",this.$loadingBgImage.style.left=n+"px",this.$loadingBgImage.style.top=l+"px",this.$loadingBgImage.complete?ec(this.$loadingBg,"show"):this.$loadingBgImage.onload=()=>{ec(this.$loadingBg,"show"),this.$loadingBgImage.onload=null}}_doInitLoadingBackgroundForRatio(e){const t=this.player._opt.aspectRatio.split(":").map(Number),i=this._getContainerRect();let s=i.width,r=i.height;const o=this.player._opt;let a=0;this.player.isControlBarShow()&&(a=o.playType===_?Qt:Yt,r-=a);const n=e.loadingBackgroundWidth,l=e.loadingBackgroundHeight,d=n/l,h=t[0]/t[1];if(this.$loadingBgImage.src=e.loadingBackground,d>h){const e=h*l/n;this.$loadingBgImage.style.width=100*e+"%",this.$loadingBgImage.style.height=`calc(100% - ${a}px)`,this.$loadingBgImage.style.padding=`0 ${(s-s*e)/2}px`}else{const e=n/h/l;this.$loadingBgImage.style.width="100%",this.$loadingBgImage.style.height=`calc(${100*e}% - ${a}px)`,this.$loadingBgImage.style.padding=(r-r*e)/2+"px 0"}this.$loadingBgImage.complete?ec(this.$loadingBg,"show"):this.$loadingBgImage.onload=()=>{ec(this.$loadingBg,"show"),this.$loadingBgImage.onload=null}}_initLoadingBg(){if(!this.$loadingBg){const e=document.createElement("div"),t=document.createElement("img");e.className="jb-pro-loading-bg-for-ios",this.$loadingBg=e,this.$loadingBgImage=t,e.appendChild(t),this.$container.appendChild(e)}}_removeLoadingBackgroundForIOS(){if(this.$loadingBg){this.debugLog(this.TAG_NAME,"_removeLoadingBackgroundForIOS()");if(!rc(this.$loadingBg)){const e=this.$container.querySelector(".jb-pro-loading-bg-for-ios");e&&this.$container&&this.$container.removeChild(e)}this.$loadingBg=null,this.$loadingBgImage=null}}_getContainerRect(){let e={};return this.$container&&(e=this.$container.getBoundingClientRect(),e.width=Math.max(e.width,this.$container.clientWidth),e.height=Math.max(e.height,this.$container.clientHeight)),e}_isNeedNetworkDisconnectReplay(){return this._opt.networkDisconnectReplay&&this.network.isOffline()}_handleWebglAlignmentError(e){if(this.isDestroyed())this.debugLog("JbPro","webglAlignmentError but player is destroyed");else if(this.webglAlignmentErrorOnLock)this.debugLog("JbPro","webglAlignmentErrorOnLock is true");else if(this.emit(ot.crashLog,this.getCrashLog(lt.webglAlignmentError,e)),this.webglAlignmentErrorOnLock=!0,this.player&&this.player._opt.webglAlignmentErrorReplay){this.debugLog("JbPro","webglAlignmentError");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({openWebglAlignment:!0}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webglAlignmentError and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.webglAlignmentError,{},e),this.debugError("JbPro","webglAlignmentError and play error",t)})).finally((()=>{this.webglAlignmentErrorOnLock=!1}))})).catch((e=>{this.webglAlignmentErrorOnLock=!1,this.debugError("JbPro","webglAlignmentError and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.webglAlignmentError,{},e),this.debugLog("JbPro","webglAlignmentError and webglAlignmentErrorReplay is false")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.webglAlignmentError,{},e),this.debugError("JbPro","webglAlignmentError and pause error",t)})).finally((()=>{this.webglAlignmentErrorOnLock=!1}))}}_handleWebglContextLostError(e){if(this.isDestroyed())return void this.debugLog("JbPro","webglContextLostError but player is destroyed");if(this.webglContextLostErrorOnLock)return void this.debugLog("JbPro","webglContextLostErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.webglContextLostError,e));const t=this._getVideoLastIframeInfo();if(this.webglContextLostErrorOnLock=!0,this.player&&this.player._opt.webglContextLostErrorReplay){this.debugLog("JbPro","webglContextLostError");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","webglContextLostError and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.webglContextLostError,t,e),this.debugError("JbPro","webglContextLostError and play error",i)})).finally((()=>{this.webglContextLostErrorOnLock=!1}))})).catch((i=>{this.webglContextLostErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.webglContextLostError,t,e),this.debugError("JbPro","webglContextLostError and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.webglContextLostError,t,e),this.debugLog("JbPro","webglContextLostError and webglContextLostErrorReplay is false")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.webglContextLostError,t,e),this.debugError("JbPro","webglAlignmentError and pause error",i)})).finally((()=>{this.webglContextLostErrorOnLock=!1}))}}_handleMediaSourceH265NotSupport(e){if(this.isDestroyed())this.debugLog("JbPro","mediaSourceH265NotSupport but player is destroyed");else if(this.mediaSourceH265NotSupportOnLock)this.debugLog("JbPro","mediaSourceH265NotSupportOnLock is true");else if(this.emit(ot.crashLog,this.getCrashLog(lt.mediaSourceH265NotSupport,e)),this.mediaSourceH265NotSupportOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceH265NotSupport,e),this.debugError("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play error",t)})).finally((()=>{this.mediaSourceH265NotSupportOnLock=!1}))})).catch((t=>{this.mediaSourceH265NotSupportOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceH265NotSupport,{},e),this.debugError("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceH265NotSupport,{},e),this.debugLog("JbPro","mediaSourceH265NotSupport and autoWasm is false")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceH265NotSupport,{},e),this.debugError("JbPro","mediaSourceH265NotSupport and pause error",t)})).finally((()=>{this.mediaSourceH265NotSupportOnLock=!1}))}}_handleMseWaitVideoCanplayTimeout(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","mseWaitVideoCanplayTimeout but player is destroyed");else if(this.mseWaitVideoCanplayTimeoutOnLock)this.debugLog("JbPro","mseWaitVideoCanplayTimeoutOnLock is true");else if(this.emit(ot.crashLog,this.getCrashLog(lt.mseWaitVideoCanplayTimeout,e)),this.mseWaitVideoCanplayTimeoutOnLock=!0,this.player&&this.player._opt.mseWaitVideoCanplayAutoWasm){this.debugLog("JbPro","mseWaitVideoCanplayTimeout auto wasm [mse-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","mseWaitVideoCanplayTimeout auto wasm [mse-> wasm] reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.mseWaitVideoCanplayTimeout,e),this.debugError("JbPro","mseWaitVideoCanplayTimeout auto wasm [mse-> wasm] reset player and play error",t)})).finally((()=>{this.mseWaitVideoCanplayTimeoutOnLock=!1}))})).catch((t=>{this.mseWaitVideoCanplayTimeoutOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mseWaitVideoCanplayTimeout,{},e),this.debugError("JbPro","mseWaitVideoCanplayTimeout auto wasm [mse-> wasm] _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.mseWaitVideoCanplayTimeout,{},e),this.debugLog("JbPro","mseWaitVideoCanplayTimeout and autoWasm is false")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceH265NotSupport,{},e),this.debugError("JbPro","mediaSourceH265NotSupport and pause error",t)})).finally((()=>{this.mseWaitVideoCanplayTimeoutOnLock=!1}))}}_handleMediaSourceFull(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceFull but player is destroyed"));if(this.mediaSourceFullOnLock)return void this.debugLog("JbPro","mediaSourceFullOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.mediaSourceFull,e));const t=this._getVideoLastIframeInfo();if(this.mediaSourceFullOnLock=!0,this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},o=this.player._opt.decoderErrorAutoWasm,a=!0;o?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(mr)?this._mseDecodeErrorRetryLog.push(Zr()):(o=!0,a=!1,r={useMSE:!1,useWCS:!1}),this.debugLog("JbPro",`mediaSourceFull and auto wasm ${ua(a)?" and is not meaningful Retry":""} [mse-> ${o?"wasm":"mse"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mediaSourceFull and reset player and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceFull,t,e),this.debugError("JbPro","mediaSourceFull and reset player and play error",i)})).finally((()=>{this.mediaSourceFullOnLock=!1}))})).catch((i=>{this.mediaSourceFullOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceFull,t,e),this.debugError("JbPro","mediaSourceFull and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceFull,t,e),this.debugLog("JbPro","mediaSourceFull and autoWasm is false")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceFull,t,e),this.debugError("JbPro","mediaSourceFull and pause error",i)})).finally((()=>{this.mediaSourceFullOnLock=!1}))}}_handleMediaSourceAppendBufferError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceAppendBufferError but player is destroyed"));if(this.mediaSourceAppendBufferErrorOnLock)return void this.debugLog("JbPro","mediaSourceAppendBufferErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.mediaSourceAppendBufferError,e));const t=this._getVideoLastIframeInfo();if(this.mediaSourceAppendBufferErrorOnLock=!0,this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},o=this.player._opt.decoderErrorAutoWasm,a=!0;o?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(mr)?this._mseDecodeErrorRetryLog.push(Zr()):(o=!0,a=!1,r={useMSE:!1,useWCS:!1}),this.player.isMSEAudioDecoderError&&(this.player.debugLog("JbPro","mediaSourceAppendBufferError and isMSEAudioDecoderError is true so set mseDecodeAudio = false"),r.mseDecodeAudio=!1),this.debugLog("JbPro",`mediaSourceAppendBufferError and auto wasm ${ua(a)?" and is not meaningful Retry":""} [mse-> ${o?"wasm":"mse"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mediaSourceAppendBufferError and reset player and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAppendBufferError,t,e),this.debugError("JbPro","mediaSourceAppendBufferError and reset player and play error",i)})).finally((()=>{this.mediaSourceAppendBufferErrorOnLock=!1}))})).catch((i=>{this.mediaSourceAppendBufferErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceAppendBufferError,t,e),this.debugError("JbPro","mediaSourceAppendBufferError and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAppendBufferError,t,e),this.debugLog("JbPro","mediaSourceAppendBufferError and autoWasm is false")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAppendBufferError,t,e),this.debugError("JbPro","mediaSourceAppendBufferError and pause error",i)})).finally((()=>{this.mediaSourceAppendBufferErrorOnLock=!1}))}}_handleMseSourceBufferError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mseSourceBufferError but player is destroyed"));if(this.mseSourceBufferErrorOnLock)return void this.debugLog("JbPro","mseSourceBufferErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.mseSourceBufferError,e));const t=this._getVideoLastIframeInfo();if(this.mseSourceBufferErrorOnLock=!0,this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={};if(this.player._opt.mseDecoderUseWorker)r={mseDecoderUseWorker:!1},this.debugLog("JbPro","mseSourceBufferError auto wasm [mse worker -> mse] reset player and play");else{let e=this.player._opt.decoderErrorAutoWasm,t=!0;e?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(mr)?this._mseDecodeErrorRetryLog.push(Zr()):(e=!0,t=!1,r={useMSE:!1,useWCS:!1}),this.player.isMSEVideoDecoderInitializationFailedNotSupportHevc&&(this.debugLog("JbPro","mseSourceBufferError and isMSEVideoDecoderInitializationFailedNotSupportHevc is true so auto wasm"),r={useMSE:!1,useWCS:!1}),this.debugLog("JbPro",`mseSourceBufferError auto wasm ${ua(t)?" and is not meaningful Retry":""} [mse-> ${e?"wasm":"mse"}] reset player and play`)}this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mseSourceBufferError reset player and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mseSourceBufferError,t,e),this.debugError("JbPro","mseSourceBufferError reset player and play error",i)})).finally((()=>{this.mseSourceBufferErrorOnLock=!1}))})).catch((i=>{this.mseSourceBufferErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mseSourceBufferError,t,e),this.debugError("JbPro","mseSourceBufferError _resetPlayer and play error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.mseSourceBufferError,t,e),this.debugLog("JbPro","mseSourceBufferError and autoWasm is false")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mseSourceBufferError,t,e),this.debugError("JbPro","mseSourceBufferError and pause error:",i)})).finally((()=>{this.mseSourceBufferErrorOnLock=!1}))}}_handleMediaSourceBufferedIsZeroError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceBufferedIsZeroError but player is destroyed"));if(this.mediaSourceBufferedIsZeroErrorOnLock)return void this.debugLog("JbPro","mediaSourceBufferedIsZeroErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.mediaSourceBufferedIsZeroError,e));const t=this._getVideoLastIframeInfo();if(this.mediaSourceBufferedIsZeroErrorOnLock=!0,this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},o=this.player._opt.decoderErrorAutoWasm,a=!0;o?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(mr)?this._mseDecodeErrorRetryLog.push(Zr()):(o=!0,a=!1,r={useMSE:!1,useWCS:!1}),this.debugLog("JbPro",`mediaSourceBufferedIsZeroError auto wasm ${ua(a)?" and is not meaningful Retry":""} [mse-> ${o?"wasm":"mse"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mediaSourceBufferedIsZeroError reset player and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceBufferedIsZeroError,t,e),this.debugError("JbPro","mediaSourceBufferedIsZeroError reset player and play error",i)})).finally((()=>{this.mediaSourceBufferedIsZeroErrorOnLock=!1}))})).catch((i=>{this.mediaSourceBufferedIsZeroErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceBufferedIsZeroError,t,e),this.debugError("JbPro","mediaSourceBufferedIsZeroError _resetPlayer and play error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceBufferedIsZeroError,t,e),this.debugLog("JbPro","mediaSourceBufferedIsZeroError and autoWasm is false")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceBufferedIsZeroError,t,e),this.debugError("JbPro","mediaSourceBufferedIsZeroError and pause error:",i)})).finally((()=>{this.mediaSourceBufferedIsZeroErrorOnLock=!1}))}}_handleMseAddSourceBufferError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mseAddSourceBufferError but player is destroyed"));if(this.mseAddSourceBufferErrorOnLock)return void this.debugLog("JbPro","mseAddSourceBufferErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.mseAddSourceBufferError,e));const t=this._getVideoLastIframeInfo();if(this.mseAddSourceBufferErrorOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={useMSE:!1,useWCS:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mseAddSourceBufferError,t,e),this.debugError("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play error",i)})).finally((()=>{this.mseAddSourceBufferErrorOnLock=!1}))})).catch((i=>{this.mseAddSourceBufferErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mseAddSourceBufferError,t,e),this.debugError("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] _resetPlayer and play error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.mseAddSourceBufferError,t,e),this.debugLog("JbPro","mseAddSourceBufferError and autoWasm is false")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mseAddSourceBufferError,t,e),this.debugError("JbPro","mseAddSourceBufferError and pause error",i)})).finally((()=>{this.mseAddSourceBufferErrorOnLock=!1}))}}_handleMediaSourceDecoderConfigurationError(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","mediaSourceDecoderConfigurationError but player is destroyed");else if(this.mediaSourceDecoderConfigurationErrorOnLock)this.debugLog("JbPro","mediaSourceDecoderConfigurationErrorOnLock is true");else if(this.emit(ot.crashLog,this.getCrashLog(lt.mediaSourceDecoderConfigurationError,e)),this.mediaSourceDecoderConfigurationErrorOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;let s={useMSE:!1,useWCS:!1};this._resetPlayer(s).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceDecoderConfigurationError,e),this.debugError("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play error",t)})).finally((()=>{this.mediaSourceDecoderConfigurationErrorOnLock=!1}))})).catch((t=>{this.mediaSourceDecoderConfigurationErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceDecoderConfigurationError,e),this.debugError("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceDecoderConfigurationError,e),this.debugLog("JbPro","mediaSourceDecoderConfigurationError and autoWasm is false")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceDecoderConfigurationError,e),this.debugError("JbPro","mediaSourceDecoderConfigurationError and pause error",t)})).finally((()=>{this.mediaSourceDecoderConfigurationErrorOnLock=!1}))}}_handleMediaSourceTsIsMaxDiff(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceTsIsMaxDiff but player is destroyed"));if(this.mediaSourceTsIsMaxDiffOnLock)return void this.debugLog("JbPro","mediaSourceTsIsMaxDiffOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.mediaSourceTsIsMaxDiff,e));const t=this._getVideoLastIframeInfo();if(this.mediaSourceTsIsMaxDiffOnLock=!0,this.player&&this.player._opt.mediaSourceTsIsMaxDiffReplay){this.debugLog("JbPro","mediaSourceTsIsMaxDiff reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mediaSourceTsIsMaxDiff replay success")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceTsIsMaxDiff,t,e),this.debugError("JbPro","mediaSourceTsIsMaxDiff replay error",i)})).finally((()=>{this.mediaSourceTsIsMaxDiffOnLock=!1}))})).catch((i=>{this.mediaSourceTsIsMaxDiffOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceTsIsMaxDiff,t,e),this.debugError("JbPro","mediaSourceTsIsMaxDiff _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceTsIsMaxDiff,t,e),this.debugLog("JbPro","mediaSourceTsIsMaxDiff and replay is false")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceTsIsMaxDiff,t,e),this.debugError("JbPro","mediaSourceTsIsMaxDiff and pause error",i)})).finally((()=>{this.mediaSourceTsIsMaxDiffOnLock=!1}))}}_handleMseWidthOrHeightChange(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mseWidthOrHeightChange but player is destroyed"));if(this.mseWidthOrHeightChangeOnLock)return void this.debugLog("JbPro","mseWidthOrHeightChangeOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.mseWidthOrHeightChange,t));const i=this._getVideoLastIframeInfo();if(this.mseWidthOrHeightChangeOnLock=!0,this.player&&this.player._opt.widthOrHeightChangeReplay){this.debugLog("JbPro","mseWidthOrHeightChange and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.player._opt.widthOrHeightChangeReplayDelayTime>0?this.widthOrHeightChangeReplayDelayTimeout=setTimeout((()=>{this.widthOrHeightChangeReplayDelayTimeout=null,this.isDestroyed()?this.debug&&this.debugLog("JbPro","mseWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):this.play(e,s).then((()=>{this.debugLog("JbPro","mseWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.mseWidthOrHeightChangeOnLock=!1}))}),1e3*this.player._opt.widthOrHeightChangeReplayDelayTime):this.play(e,s).then((()=>{this.debugLog("JbPro","mseWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.mseWidthOrHeightChangeOnLock=!1}))})).catch((e=>{this.mseWidthOrHeightChangeOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(ot.playFailedAndPaused,lt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange and _resetPlayer error",e)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange error and pause error",e)})).finally((()=>{this.mseWidthOrHeightChangeOnLock=!1}))}}_handleMediaSourceAudioG711NotSupport(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceAudioG711NotSupport but player is destroyed"));if(this.mediaSourceAudioG711NotSupportOnLock)return void this.debugLog("JbPro","mediaSourceAudioG711NotSupportOnLock is true");const i=this._getVideoLastIframeInfo();if(this.mediaSourceAudioG711NotSupportOnLock=!0,this.player&&this.player._opt.mediaSourceAudioG711NotSupportReplay){this.debugLog("JbPro","mediaSourceAudioG711NotSupport and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","mediaSourceAudioG711NotSupport and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioG711NotSupport,i,t),this.debugError("JbPro","mediaSourceAudioG711NotSupport and reset player and play error",e)})).finally((()=>{this.mediaSourceAudioG711NotSupportOnLock=!1}))})).catch((e=>{this.mediaSourceAudioG711NotSupportOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioG711NotSupport,i,t),this.debugError("JbPro","mediaSourceAudioG711NotSupport and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioG711NotSupport,i,t),this.debugError("JbPro","mediaSourceAudioG711NotSupport and _resetPlayer error",e)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioG711NotSupport,i,t),this.debugError("JbPro","mediaSourceAudioG711NotSupport error and pause error",e)})).finally((()=>{this.mediaSourceAudioG711NotSupportOnLock=!1}))}}_handleMediaSourceAudioInitTimeout(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceAudioInitTimeout but player is destroyed"));if(this.mediaSourceAudioInitTimeoutOnLock)return void this.debugLog("JbPro","mediaSourceAudioInitTimeoutOnLock is true");const i=this._getVideoLastIframeInfo();if(this.mediaSourceAudioInitTimeoutOnLock=!0,this.player&&this.player._opt.mediaSourceAudioInitTimeoutReplay){this.debugLog("JbPro","mediaSourceAudioInitTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","mediaSourceAudioInitTimeout and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioInitTimeout,i,t),this.debugError("JbPro","mediaSourceAudioInitTimeout and reset player and play error",e)})).finally((()=>{this.mediaSourceAudioInitTimeoutOnLock=!1}))})).catch((e=>{this.mediaSourceAudioInitTimeoutOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioInitTimeout,i,t),this.debugError("JbPro","mediaSourceAudioInitTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioInitTimeout,i),this.debugError("JbPro","mediaSourceAudioInitTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioInitTimeout,i),this.debugError("JbPro","mediaSourceAudioInitTimeout error and pause error",e)})).finally((()=>{this.mediaSourceAudioInitTimeoutOnLock=!1}))}}_handleMediaSourceAudioNoDataTimeout(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceAudioNoDataTimeout but player is destroyed"));if(this.mediaSourceAudioNoDataTimeoutOnLock)return void this.debugLog("JbPro","mediaSourceAudioNoDataTimeoutOnLock is true");const i=this._getVideoLastIframeInfo();if(this.mediaSourceAudioNoDataTimeoutOnLock=!0,this.player&&this.player._opt.mediaSourceAudioNoDataTimeoutReplay){this.debugLog("JbPro","mediaSourceAudioNoDataTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","mediaSourceAudioNoDataTimeout and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioNoDataTimeout,i,t),this.debugError("JbPro","mediaSourceAudioNoDataTimeout and reset player and play error",e)})).finally((()=>{this.mediaSourceAudioNoDataTimeoutOnLock=!1}))})).catch((e=>{this.mediaSourceAudioNoDataTimeoutOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioNoDataTimeout,i,t),this.debugError("JbPro","mediaSourceAudioNoDataTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioNoDataTimeout,i),this.debugError("JbPro","mediaSourceAudioNoDataTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioNoDataTimeout,i),this.debugError("JbPro","mediaSourceAudioNoDataTimeout error and pause error",e)})).finally((()=>{this.mediaSourceAudioNoDataTimeoutOnLock=!1}))}}_handleMseWorkerAddSourceBufferError(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mseWorkerAddSourceBufferError but player is destroyed"));if(this.mseWorkerAddSourceBufferErrorOnLock)return void this.debugLog("JbPro","mseWorkerAddSourceBufferErrorOnLock is true");const i=this._getVideoLastIframeInfo();if(this.mseWorkerAddSourceBufferErrorOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","mseWorkerAddSourceBufferError and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecoderUseWorker:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","mseWorkerAddSourceBufferError and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mseWorkerAddSourceBufferError,i,t),this.debugError("JbPro","mseWorkerAddSourceBufferError and reset player and play error",e)})).finally((()=>{this.mseWorkerAddSourceBufferErrorOnLock=!1}))})).catch((e=>{this.mseWorkerAddSourceBufferErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mseWorkerAddSourceBufferError,i,t),this.debugError("JbPro","mseWorkerAddSourceBufferError and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.mseWorkerAddSourceBufferError,i),this.debugError("JbPro","mseWorkerAddSourceBufferError and _resetPlayer error",e)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mseWorkerAddSourceBufferError,i),this.debugError("JbPro","mseWorkerAddSourceBufferError error and pause error",e)})).finally((()=>{this.mseWorkerAddSourceBufferErrorOnLock=!1}))}}_handleMediaSourceUseCanvasRenderPlayFailed(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","mediaSourceUseCanvasRenderPlayFailed but player is destroyed");else if(this.mediaSourceUseCanvasRenderPlayFailedOnLock)this.debugLog("JbPro","mediaSourceUseCanvasRenderPlayFailedOnLock is true");else if(this.emit(ot.crashLog,this.getCrashLog(lt.mediaSourceUseCanvasRenderPlayFailed,e)),this.mediaSourceUseCanvasRenderPlayFailedOnLock=!0,this.player&&this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplay&&this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType){this.debugLog("JbPro",`mediaSourceUseCanvasRenderPlayFailed relayType is ${this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType} and reset player and play`);const t=this._opt.url,i=this._opt.playOptions;let s={};const r=this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType;r===H?s={useMSE:!1,useWCS:!1}:r===$&&(s={useVideoRender:!0,useCanvasRender:!1}),this._resetPlayer(s).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","mediaSourceUseCanvasRenderPlayFailed and reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceUseCanvasRenderPlayFailed,e),this.debugError("JbPro","mediaSourceUseCanvasRenderPlayFailed and reset player and play error",t)})).finally((()=>{this.mediaSourceUseCanvasRenderPlayFailedOnLock=!1}))})).catch((t=>{this.mediaSourceUseCanvasRenderPlayFailedOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceUseCanvasRenderPlayFailed,e),this.debugError("JbPro","mediaSourceUseCanvasRenderPlayFailed auto and _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.debugLog("JbPro","mediaSourceUseCanvasRenderPlayFailed and pause player success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceUseCanvasRenderPlayFailed,e),this.debugError("JbPro","mediaSourceUseCanvasRenderPlayFailed and pause",t)})).finally((()=>{this.mediaSourceUseCanvasRenderPlayFailedOnLock=!1}))}}_handleWebcodecsH265NotSupport(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","webcodecsH265NotSupport but player is destroyed");else if(this.webcodecsH265NotSupportOnLock)this.debugLog("JbPro","webcodecsH265NotSupportOnLock is true");else if(this.emit(ot.crashLog,this.getCrashLog(lt.webcodecsH265NotSupport,e)),this.webcodecsH265NotSupportOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.webcodecsH265NotSupport,e),this.debugError("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play error",t)})).finally((()=>{this.webcodecsH265NotSupportOnLock=!1}))})).catch((e=>{this.webcodecsH265NotSupportOnLock=!1,this.debugError("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] _resetPlayer and play error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.webcodecsH265NotSupport,e),this.debugLog("JbPro","webcodecsH265NotSupport and autoWasm is false")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.webcodecsH265NotSupport,e),this.debugError("JbPro","webcodecsH265NotSupport and pause error",t)})).finally((()=>{this.webcodecsH265NotSupportOnLock=!1}))}}_handleWebcodecsUnsupportedConfigurationError(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","webcodecsUnsupportedConfigurationError but player is destroyed");else if(this.webcodecsUnsupportedConfigurationErrorOnLock)this.debugLog("JbPro","webcodecsUnsupportedConfigurationErrorOnLock is true");else if(this.emit(ot.crashLog,this.getCrashLog(lt.webcodecsUnsupportedConfigurationError,e)),this.webcodecsUnsupportedConfigurationErrorOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.webcodecsUnsupportedConfigurationError,e),this.debugError("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play error",t)})).finally((()=>{this.webcodecsUnsupportedConfigurationErrorOnLock=!1}))})).catch((t=>{this.webcodecsUnsupportedConfigurationErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.webcodecsUnsupportedConfigurationError,e),this.debugError("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.webcodecsUnsupportedConfigurationError,e),this.debugLog("JbPro","webcodecsUnsupportedConfigurationError and autoWasm is false")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.webcodecsUnsupportedConfigurationError,e),this.debugError("JbPro","webcodecsUnsupportedConfigurationError and pause error",t)})).finally((()=>{this.webcodecsUnsupportedConfigurationErrorOnLock=!1}))}}_handleWebcodecsDecodeConfigureError(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","webcodecsDecodeConfigureError but player is destroyed");else if(this.webcodecsDecodeConfigureErrorOnLock)this.debugLog("JbPro","webcodecsDecodeConfigureErrorOnLock is true");else if(this.emit(ot.crashLog,this.getCrashLog(lt.webcodecsDecodeConfigureError,e)),this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.webcodecsDecodeConfigureError,e),this.debugError("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play error",t)})).finally((()=>{this.webcodecsDecodeConfigureErrorOnLock=!1}))})).catch((t=>{this.webcodecsDecodeConfigureErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.webcodecsDecodeConfigureError,e),this.debugError("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.webcodecsDecodeConfigureError,e),this.debugLog("JbPro","webcodecsDecodeConfigureError and autoWasm is false")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.webcodecsDecodeConfigureError,e),this.debugError("JbPro","webcodecsDecodeConfigureError and pause error",t)})).finally((()=>{this.webcodecsDecodeConfigureErrorOnLock=!1}))}}_handleWebcodecsDecodeError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webcodecsDecodeError but player is destroyed"));if(this.webcodecsDecodeErrorOnLock)return void this.debugLog("JbPro","webcodecsDecodeErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.webcodecsDecodeError,e));const t=this._getVideoLastIframeInfo();if(this.webcodecsDecodeErrorOnLock=!0,this.player&&this.player._opt.wcsDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},o=this.player._opt.decoderErrorAutoWasm,a=!0;o?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(gr)?this._wcsDecodeErrorRetryLog.push(Zr()):(o=!0,a=!1,r={useMSE:!1,useWCS:!1}),this.debugLog("JbPro",`webcodecs decode error autoWasm ${ua(a)?" and is not meaningful Retry":""} [wcs-> ${o?"wasm":"wcs"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","webcodecs decode error reset player and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.webcodecsDecodeError,t,e),this.debugError("JbPro","webcodecs decode error reset player and play error",i)})).finally((()=>{this.webcodecsDecodeErrorOnLock=!1}))})).catch((()=>{this.webcodecsDecodeErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.webcodecsDecodeError,t,e),this.debugError("JbPro","webcodecs decode error _resetPlayer error")}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.webcodecsDecodeError,t,e),this.debugLog("JbPro","webcodecs decode error and autoWasm is false")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.webcodecsDecodeError,t,e),this.debugError("JbPro","webcodecs decode error and pause error",i)})).finally((()=>{this.webcodecsDecodeErrorOnLock=!1}))}}_handleWcsWidthOrHeightChange(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","wcsWidthOrHeightChange but player is destroyed"));if(this.wcsWidthOrHeightChangeOnLock)return void this.debugLog("JbPro","wcsWidthOrHeightChangeOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.wcsWidthOrHeightChange,t));const i=this._getVideoLastIframeInfo();if(this.wcsWidthOrHeightChangeOnLock=!0,this.player&&this.player._opt.widthOrHeightChangeReplay){this.debugLog("JbPro","wcsWidthOrHeightChange and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._opt.widthOrHeightChangeReplayDelayTime>0?this.widthOrHeightChangeReplayDelayTimeout=setTimeout((()=>{this.widthOrHeightChangeReplayDelayTimeout=null,this.isDestroyed()?this.debug&&this.debugLog("JbPro","wcsWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):this.play(e,s).then((()=>{this.debugLog("JbPro","wcsWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.wcsWidthOrHeightChangeOnLock=!1}))}),1e3*this._opt.widthOrHeightChangeReplayDelayTime):this.play(e,s).then((()=>{this.debugLog("JbPro","wcsWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.wcsWidthOrHeightChangeOnLock=!1}))})).catch((e=>{this.wcsWidthOrHeightChangeOnLock=!1,this.emit(ot.playFailedAndPaused,lt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(ot.playFailedAndPaused,lt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange and _resetPlayer error",e)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange error and pause error",e)})).finally((()=>{this.wcsWidthOrHeightChangeOnLock=!1}))}}_handleWebcodecsAudioNoDataTimeout(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webcodecsAudioNoDataTimeout but player is destroyed"));if(this.webcodecsAudioNoDataTimeoutOnLock)return void this.debugLog("JbPro","webcodecsAudioNoDataTimeoutOnLock is true");const i=this._getVideoLastIframeInfo();if(this.webcodecsAudioNoDataTimeoutOnLock=!0,this.player&&this.player._opt.webcodecsAudioNoDataTimeoutReplay){this.debugLog("JbPro","webcodecsAudioNoDataTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={wcsDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","webcodecsAudioNoDataTimeout and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.webcodecsAudioNoDataTimeout,i,t),this.debugError("JbPro","webcodecsAudioNoDataTimeout and reset player and play error",e)})).finally((()=>{this.webcodecsAudioNoDataTimeoutOnLock=!1}))})).catch((e=>{this.webcodecsAudioNoDataTimeoutOnLock=!1,this.emit(ot.playFailedAndPaused,lt.webcodecsAudioNoDataTimeout,i,t),this.debugError("JbPro","webcodecsAudioNoDataTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.webcodecsAudioNoDataTimeout,i),this.debugError("JbPro","webcodecsAudioNoDataTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.webcodecsAudioNoDataTimeout,i),this.debugError("JbPro","webcodecsAudioNoDataTimeout error and pause error",e)})).finally((()=>{this.webcodecsAudioNoDataTimeoutOnLock=!1}))}}_handleWebcodecsAudioInitTimeout(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webcodecsAudioInitTimeout but player is destroyed"));if(this.webcodecsAudioInitTimeoutOnLock)return void this.debugLog("JbPro","webcodecsAudioInitTimeoutOnLock is true");const i=this._getVideoLastIframeInfo();if(this.webcodecsAudioInitTimeoutOnLock=!0,this.player&&this.player._opt.webcodecsAudioInitTimeoutReplay){this.debugLog("JbPro","webcodecsAudioInitTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={wcsDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","webcodecsAudioInitTimeout and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.webcodecsAudioInitTimeout,i,t),this.debugError("JbPro","webcodecsAudioInitTimeout and reset player and play error",e)})).finally((()=>{this.webcodecsAudioInitTimeoutOnLock=!1}))})).catch((e=>{this.webcodecsAudioInitTimeoutOnLock=!1,this.emit(ot.playFailedAndPaused,lt.webcodecsAudioInitTimeout,i,t),this.debugError("JbPro","webcodecsAudioInitTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.webcodecsAudioInitTimeout,i),this.debugError("JbPro","webcodecsAudioInitTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.webcodecsAudioInitTimeout,i),this.debugError("JbPro","webcodecsAudioInitTimeout error and pause error",e)})).finally((()=>{this.webcodecsAudioInitTimeoutOnLock=!1}))}}_handleSimdDecodeError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","simdDecodeError but player is destroyed"));if(this.simdDecodeErrorOnLock)return void this.debugLog("JbPro","simdDecodeErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.simdDecodeError,e));const t=this._getVideoLastIframeInfo();if(this.simdDecodeErrorOnLock=!0,this.player&&this.player._opt.simdDecodeErrorReplay){this.debugLog("JbPro",`simdDecodeError error simdDecodeErrorReplayType is ${this.player._opt.simdDecodeErrorReplayType} and reset player and play`);const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.simdDecodeErrorReplayType===N&&(r={useSIMD:!1}),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","simdDecodeError and reset player and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.simdDecodeError,t,e),this.debugError("JbPro","simdDecodeError and reset player and play error",i)})).finally((()=>{this.simdDecodeErrorOnLock=!1}))})).catch((i=>{this.simdDecodeErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.simdDecodeError,t,e),this.debugError("JbPro","simdDecodeError and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.simdDecodeError,t,e),this.debugError("JbPro","simdDecodeError and simdDecodeErrorReplay is false")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.simdDecodeError,t,e),this.debugError("JbPro","simdDecodeError error and pause error",i)})).finally((()=>{this.simdDecodeErrorOnLock=!1}))}}_handleWasmWidthOrHeightChange(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","wasmWidthOrHeightChange but player is destroyed"));if(this.wasmWidthOrHeightChangeOnLock)return void this.debugLog("JbPro","wasmWidthOrHeightChangeOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.wasmWidthOrHeightChange,t));const i=this._getVideoLastIframeInfo();if(this.wasmWidthOrHeightChangeOnLock=!0,this.player&&this.player._opt.widthOrHeightChangeReplay){this.debugLog("JbPro","wasmWidthOrHeightChange and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._opt.widthOrHeightChangeReplayDelayTime>0?this.widthOrHeightChangeReplayDelayTimeout=setTimeout((()=>{this.widthOrHeightChangeReplayDelayTimeout=null,this.isDestroyed()?this.debug&&this.debugLog("JbPro","wasmWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):this.play(e,s).then((()=>{this.debugLog("JbPro","wasmWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.wasmWidthOrHeightChange,i,t),this.debugError("JbPro","wasmWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.wasmWidthOrHeightChangeOnLock=!1}))}),1e3*this._opt.widthOrHeightChangeReplayDelayTime):this.play(e,s).then((()=>{this.debugLog("JbPro","wasmWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.wasmWidthOrHeightChange,i,t),this.debugError("JbPro","wasmWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.wasmWidthOrHeightChangeOnLock=!1}))})).catch((e=>{this.wasmWidthOrHeightChangeOnLock=!1,this.emit(ot.playFailedAndPaused,lt.wasmWidthOrHeightChange,i,t),this.debugError("JbPro","wasmWidthOrHeightChange and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(ot.playFailedAndPaused,lt.wasmWidthOrHeightChange,i,t),this.debugError("JbPro","wasmWidthOrHeightChange and _resetPlayer error",e)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.wasmWidthOrHeightChange,i),this.debugError("JbPro","wasmWidthOrHeightChange error and pause error",e)})).finally((()=>{this.wasmWidthOrHeightChangeOnLock=!1}))}}_handleWasmUseVideoRenderError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","wasmUseVideoRenderError but player is destroyed"));if(this.wasmUseVideoRenderErrorOnLock)return void this.debugLog("JbPro","wasmUseVideoRenderErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.wasmUseVideoRenderError,e)),this.debugLog("JbPro","wasmUseVideoRenderError and reset player and play");const t=this._opt.url,i=this._opt.playOptions;this.wasmUseVideoRenderErrorOnLock=!0,this._resetPlayer({useVideoRender:!1,useCanvasRender:!0}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","wasmUseVideoRenderError and reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.wasmUseVideoRenderError,{},e),this.debugError("JbPro","wasmUseVideoRenderError and reset player and play error",t)})).finally((()=>{this.wasmUseVideoRenderErrorOnLock=!1}))})).catch((t=>{this.wasmUseVideoRenderErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.wasmUseVideoRenderError,{},e),this.debugError("JbPro","wasmUseVideoRenderError and _resetPlayer error",t)}))}_handleVideoElementPlayingFailed(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","videoElementPlayingFailed but player is destroyed"));if(this.videoElementPlayingFailedOnLock)return void this.debugLog("JbPro","videoElementPlayingFailedOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.videoElementPlayingFailed,e));const t=this._getVideoLastIframeInfo();if(this.videoElementPlayingFailedOnLock=!0,this.player&&this.player._opt.videoElementPlayingFailedReplay){this.debugLog("JbPro",`videoElementPlayingFailed and useMSE is ${this._opt.useMSE} and reset player and play`);const i=this._opt.url,s=this._opt.playOptions;let r={useMSE:!1,useVideoRender:!1,useCanvasRender:!0};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","videoElementPlayingFailed and reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.videoElementPlayingFailed,{},e),this.debugError("JbPro","videoElementPlayingFailed and reset player and play error",t)})).finally((()=>{this.videoElementPlayingFailedOnLock=!1}))})).catch((t=>{this.videoElementPlayingFailedOnLock=!1,this.emit(ot.playFailedAndPaused,lt.videoElementPlayingFailed,{},e),this.debugError("JbPro","videoElementPlayingFailed and _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.videoElementPlayingFailed,{},e),this.debugError("JbPro","videoElementPlayingFailed and videoElementPlayingFailedReplay is false")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.videoElementPlayingFailed,{},e),this.debugError("JbPro","videoElementPlayingFailed and _pause error",t)})).finally((()=>{this.videoElementPlayingFailedOnLock=!1}))}}_handleSimdH264DecodeVideoWidthIsTooLarge(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","simdH264DecodeVideoWidthIsTooLarge but player is destroyed");else if(this.simdH264DecodeVideoWidthIsTooLargeOnLock)this.debugLog("JbPro","simdH264DecodeVideoWidthIsTooLargeOnLock is true");else if(this.emit(ot.crashLog,this.getCrashLog(lt.simdH264DecodeVideoWidthIsTooLarge,e)),this.simdH264DecodeVideoWidthIsTooLargeOnLock=!0,this.player&&this.player._opt.simdH264DecodeVideoWidthIsTooLargeReplay){this.debugLog("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useSIMD:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debugError("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play error",t)})).finally((()=>{this.simdH264DecodeVideoWidthIsTooLargeOnLock=!1}))})).catch((t=>{this.simdH264DecodeVideoWidthIsTooLargeOnLock=!1,this.emit(ot.playFailedAndPaused,lt.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debugError("JbPro","simdH264DecodeVideoWidthIsTooLarge and _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debugError("JbPro","simdH264DecodeVideoWidthIsTooLarge and simdDecodeErrorReplay is false")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debugError("JbPro","simdH264DecodeVideoWidthIsTooLarge and pause error",t)})).finally((()=>{this.simdH264DecodeVideoWidthIsTooLargeOnLock=!1}))}}_handleNetworkDelayTimeout(e){if(this.player._opt.networkDelayTimeoutReplay){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","networkDelayTimeout but player is destroyed"));if(this.networkDelayTimeoutOnLock)return void this.debugLog("JbPro","networkDelayTimeoutOnLock is true");this.emit(ot.crashLog,this.getCrashLog(ot.networkDelayTimeout,e));const t=this._getVideoLastIframeInfo();this.debugLog("JbPro","network delay time out and reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player&&this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this.networkDelayTimeoutOnLock=!0,this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","wasm decode error and reset player and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,ot.networkDelayTimeout,t,e),this.debugError("JbPro","wasm decode error and reset player and play error",i)})).finally((()=>{this.networkDelayTimeoutOnLock=!1}))})).catch((()=>{this.networkDelayTimeoutOnLock=!1,this.emit(ot.playFailedAndPaused,ot.networkDelayTimeout,t,e),this.debugError("JbPro","wasm decode error and _resetPlayer error")}))}}_handleFlvDemuxBufferSizeTooLarge(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","flvDemuxBufferSizeTooLarge but player is destroyed"));if(this.flvDemuxBufferSizeTooLargeOnLock)return void this.debugLog("JbPro","flvDemuxBufferSizeTooLargeOnLock is true");const t=this._getVideoLastIframeInfo();if(this.flvDemuxBufferSizeTooLargeOnLock=!0,this.player._opt.flvDemuxBufferSizeTooLargeReplay){this.emit(ot.crashLog,this.getCrashLog(ot.flvDemuxBufferSizeTooLarge,e)),this.debugLog("JbPro","flv Demux Buffer Size Too Large and flvDemuxBufferSizeTooLargeReplay = true and reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player&&this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog(this.TAG_NAME,"flv Demux Buffer Size Too Large and reset player and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,ot.flvDemuxBufferSizeTooLarge,t,e),this.debugError(this.TAG_NAME,"flv Demux Buffer Size Too Large and reset player and play error",i)})).finally((()=>{this.flvDemuxBufferSizeTooLargeOnLock=!1}))})).catch((()=>{this.flvDemuxBufferSizeTooLargeOnLock=!1,this.emit(ot.playFailedAndPaused,ot.flvDemuxBufferSizeTooLarge,t,e),this.debugError(this.TAG_NAME,"flv Demux Buffer Size Too Large and _resetPlayer error")}))}else if(this._opt.flvDemuxBufferSizeTooLargeEmitFailed){this.debugLog(this.TAG_NAME,"flv Demux Buffer Size Too Large and flvDemuxBufferSizeTooLargeEmitFailed = true and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.flvDemuxBufferSizeTooLarge,t,e)})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.flvDemuxBufferSizeTooLarge,t,e),this.debugError(this.TAG_NAME,"flv Demux Buffer Size Too Large",i)})).finally((()=>{this.flvDemuxBufferSizeTooLargeOnLock=!1}))}}_handleFetchError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","fetchError but player is destroyed"));if(this.fetchErrorOnLock)return void this.debugLog("JbPro","fetchErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.fetchError,e));const t=this._getVideoLastIframeInfo(),i=this._isNeedNetworkDisconnectReplay();if(this.fetchErrorOnLock=!0,this.player._opt.streamErrorReplay||i){i?this.debugLog("JbPro","fetch error and network is disconnect and reset player and play"):this.debugLog("JbPro",`fetch error and streamErrorReplay is true and _streamErrorReplayTimes is ${this._streamErrorReplayTimes}, streamErrorReplayDelayTime is ${this._opt.streamErrorReplayDelayTime}, next replay`);let s={};this.player._opt.replayUseLastFrameShow&&(s=Object.assign({},s,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(s.isNotMute=!0);const r=this._opt.playOptions,o=this._opt.url,a=i?1:this._opt.streamErrorReplayDelayTime;this._resetPlayer(s).then((()=>{this.streamErrorReplayDelayTimeout=setTimeout((()=>{if(this.streamErrorReplayDelayTimeout=null,this.isDestroyed())this.debug&&this.debugLog("JbPro","fetch error and _resetPlayer but player is destroyed and return");else{if(this._isNeedNetworkDisconnectReplay())return this.debugLog("JbPro","fetch error and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:o,options:r,type:lt.fetchError});this._streamErrorReplayTimes++,this.play(o,r).then((()=>{this.debugLog("JbPro","fetch error and reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.fetchError,{},e),this.debugError("JbPro","fetch error and reset player and play error",t)})).finally((()=>{this.fetchErrorOnLock=!1}))}}),1e3*a)})).catch((t=>{this.fetchErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.fetchError,{},e),this.debugError("JbPro","fetch error and _resetPlayer error",t)}))}else{this.debugLog("JbPro","fetch error and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.fetchError,t,e)})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.fetchError,t,e),this.debugError("JbPro","fetch error and pause",i)})).finally((()=>{this.fetchErrorOnLock=!1}))}}_handleStreamEnd(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","streamEnd but player is destroyed and return"));if(this.streamEndOnLock)return void this.debugLog("JbPro","streamEndOnLock is true");this.emit(ot.crashLog,this.getCrashLog(ot.streamEnd,e));const t=this._getVideoLastIframeInfo(),i=""+e=="1006"&&this.player._opt.websocket1006ErrorReplay,s=!!i&&this._checkIsMeaningfulRetry(fr),r=i&&s,o=this.player._opt.streamEndReplay,a=this._isNeedNetworkDisconnectReplay();if(this.streamEndOnLock=!0,r||o||a){a?this.debugLog("JbPro","streamEnd and network is disconnect and reset player and play"):r?this.debugLog("JbPro",`streamEnd and websocket1006ErrorReplay is true and error is 1006 and _websocket1006ErrorReplayTimes is ${this._websocket1006ErrorReplayTimes} , delay ${this._opt.websocket1006ErrorReplayDelayTime}s reset player and play`):this.debugLog("JbPro",`streamEnd and isStreamEndReplay is true and and _streamEndReplayTimes is ${this._streamEndReplayTimes} , delay ${this._opt.streamEndReplayDelayTime}s reset player and play`);const s=this._opt.playOptions,o=this._opt.url;i&&this._websocket1006ErrorRetryLog.push(Zr());let n={};this.player._opt.replayUseLastFrameShow&&(n=Object.assign({},n,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(n.isNotMute=!0);let l=r?this._opt.websocket1006ErrorReplayDelayTime:this._opt.streamEndReplayDelayTime;a&&(l=1),this._initLoadingBackgroundForIOS(t),this._resetPlayer(n).then((()=>{this.streamEndReplayDelayTimeout=setTimeout((()=>{if(this.streamEndReplayDelayTimeout=null,this._removeLoadingBackgroundForIOS(),this.isDestroyed())a?this.debug&&this.debugLog("JbPro","streamEnd and network is disconnect and _resetPlayer() but player is destroyed and return"):r?this.debug&&this.debugLog("JbPro","streamEnd and 1006 error and _resetPlayer() but player is destroyed and return"):this.debug&&this.debugLog("JbPro","streamEnd and _resetPlayer() but player is destroyed and return");else{if(this._isNeedNetworkDisconnectReplay())return r?this.debugLog("JbPro","streamEnd and 1006 error network is offline and wait network online to play , so return"):this.debugLog("JbPro","streamEnd and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:o,options:s,type:r?lt.websocket1006Error:lt.streamEnd});r?this._websocket1006ErrorReplayTimes++:this._streamEndReplayTimes++,this.play(o,s).then((()=>{r?this.debugLog("JbPro","streamEnd and 1006 error and reset player and play success"):this.debugLog("JbPro","streamEnd and reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.streamEnd,{},e),r?this.debugError("JbPro","streamEnd and 1006 error and reset player and play error",t):this.debugError("JbPro","streamEnd and reset player and play error",t)})).finally((()=>{this.streamEndOnLock=!1}))}}),1e3*l)})).catch((t=>{this.streamEndOnLock=!1,this.emit(ot.playFailedAndPaused,lt.streamEnd,{},e),r?this.debugError("JbPro","streamEnd and 1006 and _resetPlayer error",t):this.debugError("JbPro","streamEnd and _resetPlayer error",t)}))}else{i?this.debugLog("JbPro","streamEnd pause player "+(ua(s)?"and is not meaningful retry":"")):this.debugLog("JbPro","streamEnd pause player");const r=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(r).then((()=>{this.emit(ot.playFailedAndPaused,ot.streamEnd,t,e)})).catch((i=>{this.emit(ot.playFailedAndPaused,ot.streamEnd,t,e),this.debugError("JbPro","streamEnd pause",i)})).finally((()=>{this.streamEndOnLock=!1}))}}_handleWebsocketError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","websocketError but player is destroyed"));if(this.websocketErrorOnLock)return void this.debugLog("JbPro","websocketErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.websocketError,e));const t=this._getVideoLastIframeInfo(),i=this._isNeedNetworkDisconnectReplay();if(this.websocketErrorOnLock=!0,this.player._opt.streamErrorReplay||i){i?this.debugLog("JbPro","websocketError error and network is disconnect and reset player and play"):this.debugLog("JbPro",`websocketError error and streamErrorReplay is true and _streamErrorReplayTimes is ${this._streamErrorReplayTimes} and streamErrorReplayDelayTime is ${this._opt.streamErrorReplayDelayTime}, next replay`);let s={};this.player._opt.replayUseLastFrameShow&&(s=Object.assign({},s,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(s.isNotMute=!0);const r=this._opt.playOptions,o=this._opt.url,a=i?1:this._opt.streamErrorReplayDelayTime;this._resetPlayer(s).then((()=>{this.streamErrorReplayDelayTimeout=setTimeout((()=>{if(this.streamErrorReplayDelayTimeout=null,this.isDestroyed())i?this.debug&&this.debugLog("JbPro","websocketError error and network is disconnect and _resetPlayer() but player is destroyed and return"):this.debug&&this.debugLog("JbPro","websocketError error and _resetPlayer() but player is destroyed and return");else{if(this._isNeedNetworkDisconnectReplay())return this.debugLog("JbPro","websocketError error and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:o,options:r,type:lt.websocketError});this._streamErrorReplayTimes++,this.play(o,r).then((()=>{this.debugLog("JbPro","websocketError error and reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.fetchError,{},e),this.debugError("JbPro","websocketError error and reset player and play error",t)})).finally((()=>{this.websocketErrorOnLock=!1}))}}),1e3*a)})).catch((t=>{this.websocketErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.fetchError,{},e),this.debugError("JbPro","websocketError error and _resetPlayer error",t)}))}else{this.debugLog("JbPro","websocketError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.websocketError,t,e)})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.websocketError,t,e),this.debugError("JbPro","websocketError and pause",i)})).finally((()=>{this.websocketErrorOnLock=!1}))}}_handleWebrtcError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webrtcError but player is destroyed"));if(this.webrtcErrorOnLock)return void this.debugLog("JbPro","webrtcErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.webrtcError,e));const t=this._getVideoLastIframeInfo();if(this._isNeedNetworkDisconnectReplay()){this.debugLog("JbPro","webrtcError error and network is offline and wait network online to play , so _resetPlayer and wait play");const i=this._opt.playOptions,s=this._opt.url;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._isNetworkOfflinePaused=!0,this._isNetworkOfflinePausedAndNextPlayConfig={url:s,options:i,type:lt.webrtcError}})).catch((()=>{this.emit(ot.playFailedAndPaused,lt.webrtcError,t,e),this.debugError("JbPro","webrtcError and _resetPlayer error")})).finally((()=>{this.webrtcErrorOnLock=!1}))}else{this.debugLog("JbPro","webrtcError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.webrtcErrorOnLock=!0,this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.webrtcError,t,e)})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.webrtcError,t,e),this.debugError("JbPro","webrtcError and pause",i)})).finally((()=>{this.webrtcErrorOnLock=!1}))}}_handleHlsError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","hlsError but player is destroyed"));if(this.hlsErrorOnLock)return void this.debugLog("JbPro","hlsErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.hlsError,e));const t=this._getVideoLastIframeInfo();if(this._isNeedNetworkDisconnectReplay()){this.debugLog("JbPro","hlsError error and network is offline and wait network online to play , so _resetPlayer and wait play");const i=this._opt.playOptions,s=this._opt.url;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ua(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._isNetworkOfflinePaused=!0,this._isNetworkOfflinePausedAndNextPlayConfig={url:s,options:i,type:lt.hlsError}})).catch((()=>{this.emit(ot.playFailedAndPaused,lt.hlsError,t,e),this.debugError("JbPro","hlsError and _resetPlayer error")})).finally((()=>{this.hlsErrorOnLock=!1}))}else{this.debugLog("JbPro","hlsError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.hlsErrorOnLock=!0,this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.hlsError,t,e)})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.hlsError,t,e),this.debugError("JbPro","hlsError and pause",i)})).finally((()=>{this.hlsErrorOnLock=!1}))}}_handleAliyunRtcError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","aliyunRtcError but player is destroyed"));if(this.aliyunRtcErrorOnLock)return void this.debugLog("JbPro","aliyunRtcErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.aliyunRtcError,e));const t=this._getVideoLastIframeInfo();this.debugLog("JbPro","aliyunRtcError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.aliyunRtcErrorOnLock=!0,this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.aliyunRtcError,t,e)})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.aliyunRtcError,t,e),this.debugError("JbPro","aliyunRtcError and pause",i)})).finally((()=>{this.aliyunRtcErrorOnLock=!1}))}_handleDecoderWorkerInitError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","decoderWorkerInitError but player is destroyed"));if(this.decoderWorkerInitErrorOnLock)return void this.debugLog("JbPro","decoderWorkerInitErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.decoderWorkerInitError,e));const t=this._getVideoLastIframeInfo();this.debugLog("JbPro","decoderWorkerInitError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.decoderWorkerInitErrorOnLock=!0,this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.decoderWorkerInitError,t,e)})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.decoderWorkerInitError,t,e),this.debugError("JbPro","decoderWorkerInitError and pause",i)})).finally((()=>{this.decoderWorkerInitErrorOnLock=!1}))}_handleDecoderWorkerWasmError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","decoderWorkerWasmError but player is destroyed"));if(this.decoderWorkerWasmErrorOnLock)return void this.debugLog("JbPro","decoderWorkerWasmErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.decoderWorkerWasmError,e)),this.debugLog("JbPro","decoderWorkerWasmError and pause player");const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.decoderWorkerWasmErrorOnLock=!0,this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.decoderWorkerWasmError,{},e)})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.decoderWorkerWasmError,{},e),this.debugError("JbPro","decoderWorkerWasmError and pause",t)})).finally((()=>{this.decoderWorkerWasmErrorOnLock=!1}))}_handleVideoElementPlayingFailedForWebrtc(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","videoElementPlayingFailedForWebrtc but player is destroyed"));if(this.videoElementPlayingFailedForWebrtcOnLock)return void this.debugLog("JbPro","videoElementPlayingFailedForWebrtcOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.videoElementPlayingFailedForWebrtc,e)),this.debugLog("JbPro","videoElementPlayingFailedForWebrtc and pause player");const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.videoElementPlayingFailedForWebrtcOnLock=!0,this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.videoElementPlayingFailedForWebrtc,{},e)})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.videoElementPlayingFailedForWebrtc,{},e),this.debugError("JbPro","videoElementPlayingFailedForWebrtc and pause",t)})).finally((()=>{this.videoElementPlayingFailedForWebrtcOnLock=!1}))}_handleVideoInfoError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","videoInfoError but player is destroyed"));if(this.videoInfoErrorOnLock)return void this.debugLog("JbPro","videoInfoErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.videoInfoError,e)),this.debugLog("JbPro","videoInfoError and pause player");const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.videoInfoErrorOnLock=!0,this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.videoInfoError,{},e)})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.videoInfoError,{},e),this.debugError("JbPro","videoInfoError and pause",t)})).finally((()=>{this.videoInfoErrorOnLock=!1}))}_handleWebrtcStreamH265(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webrtcStreamH265 but player is destroyed"));if(this.webrtcStreamH265OnLock)return void this.debugLog("JbPro","webrtcStreamH265OnLock is true");this.debugLog("JbPro","webrtcStreamH265 and reset player and play");const t=this._opt.url,i=this._opt.playOptions;this.webrtcStreamH265OnLock=!0,this._resetPlayer({isWebrtcH265:!0}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webrtcStreamH265 and reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,ot.webrtcStreamH265,{},e),this.debugError("JbPro","webrtcStreamH265 and reset player and play error",t)})).finally((()=>{this.webrtcStreamH265OnLock=!1}))})).catch((()=>{this.webrtcStreamH265OnLock=!1,this.emit(ot.playFailedAndPaused,ot.webrtcStreamH265,{},e),this.debugError("JbPro","webrtcStreamH265 and _resetPlayer error")}))}_handleDelayTimeout(e){if(this.isDestroyed())return void(this.debug&&this.debugWarn("JbPro","delay timeout replay but player is destroyed"));this.emit(ot.crashLog,this.getCrashLog(ot.delayTimeout,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.heartTimeoutReplay&&(this._heartTimeoutReplayTimes{if(this._isNeedNetworkDisconnectReplay())return this.debugLog("JbPro","delayTimeout and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:i,options:s,type:ot.delayTimeout});this.play(i,s).then((()=>{})).catch((i=>{this.emit(ot.playFailedAndPaused,ot.delayTimeout,t,e),this.debugError("JbPro","delay timeout replay error",i)}))})).catch((i=>{this.emit(ot.playFailedAndPaused,ot.delayTimeout,t,e),this.debugError("JbPro","delay timeout _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,ot.delayTimeout,t,e),this.player&&(this.emit(ot.delayTimeoutRetryEnd),this.emit(ot.playFailedAndPaused,ot.delayTimeoutRetryEnd)),this.debugWarn("JbPro",`delayTimeoutRetryEnd and\n opt.heartTimeout is ${this.player&&this.player._opt.heartTimeout} and\n opt.heartTimeoutReplay is ${this.player&&this.player._opt.heartTimeoutReplay} and\n opt.heartTimeoutReplayTimes is ${this.player&&this.player._opt.heartTimeoutReplayTimes},and\n local._heartTimeoutReplayTimes is ${this._heartTimeoutReplayTimes}`)})).catch((i=>{this.emit(ot.playFailedAndPaused,ot.delayTimeout,t,e),this.debugError("JbPro","delay timeout and pause error",i)}))}}_handleLoadingTimeout(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","loading timeout but player is destroyed"));this.emit(ot.crashLog,this.getCrashLog(ot.loadingTimeout,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.loadingTimeoutReplay&&(this._loadingTimeoutReplayTimes{if(this._isNeedNetworkDisconnectReplay())return this.debugLog("JbPro","loadingTimeout and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:i,options:s,type:ot.loadingTimeout});this.play(i,s).then((()=>{})).catch((i=>{this.emit(ot.playFailedAndPaused,ot.loadingTimeout,t,e),this.debugError("JbPro","loading timeout replay error",i)}))})).catch((i=>{this.emit(ot.playFailedAndPaused,ot.loadingTimeout,t,e),this.debugError("JbPro","loading timeout _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,ot.loadingTimeout,t,e),this.player&&(this.emit(ot.loadingTimeoutRetryEnd),this.emit(ot.playFailedAndPaused,ot.loadingTimeoutRetryEnd,t,e),this._opt.loadingTimeoutRetryEndShowPlayBtn&&this.player.showPlayBtn()),this.debugLog("JbPro",`loadingTimeoutRetryEnd and\n opt.loadingTimeout is ${this.player&&this.player._opt.loadingTimeout} and\n opt.loadingTimeoutReplay is ${this.player&&this.player._opt.loadingTimeoutReplay} and\n local._loadingTimeoutReplayTimes time is ${this._loadingTimeoutReplayTimes} and\n opt.loadingTimeoutReplayTimes is ${this.player&&this.player._opt.loadingTimeoutReplayTimes}`)})).catch((i=>{this.emit(ot.playFailedAndPaused,ot.loadingTimeout,t,e),this.debugError("JbPro","loading timeout and pause error",i)}))}}_handleInitDecoderWorkerTimeout(e){if(this.isDestroyed())return void this.debugLog("JbPro","InitDecoderWorkerTimeout but player is destroyed");this.emit(ot.crashLog,this.getCrashLog(lt.initDecoderWorkerTimeout,e)),this.debugLog("JbPro","InitDecoderWorkerTimeout and pause player");const t=this._getVideoLastIframeInfo(),i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.initDecoderWorkerTimeout,t,e)})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.initDecoderWorkerTimeout,t,e),this.debugError("JbPro","videoInfoError and pause",i)}))}_checkInitDecoderWorkerTimeout(){this._clearInitDecoderWorkerTimeout(),this.initDecoderWorkerTimeout=setTimeout((()=>{this._handleInitDecoderWorkerTimeout(lt.initDecoderWorkerTimeout)}),1e3*this._opt.initDecoderWorkerTimeout)}_clearInitDecoderWorkerTimeout(){this.initDecoderWorkerTimeout&&(clearTimeout(this.initDecoderWorkerTimeout),this.initDecoderWorkerTimeout=null)}debugLog(e){if(this._opt.debug&&this.debug){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s1?t-1:0),s=1;s1?t-1:0),s=1;s1?i-1:0),r=1;r1?i-1:0),r=1;r1?s-1:0),o=1;o32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let i=e-this._current_word_bits_left;this._fillCurrentWord();let s=Math.min(i,this._current_word_bits_left),r=this._current_word>>>32-s;return this._current_word<<=s,this._current_word_bits_left-=s,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const xr=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Rr=xr,Pr=xr;function Br(e){let{profile:t,sampleRate:i,channel:s}=e;return new Uint8Array([175,0,t<<3|(14&i)>>1,(1&i)<<7|s<<3])}function Ir(e){return Mr(e)&&e[1]===ys}function Mr(e){return e[0]>>4===_t}function Fr(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}function Ur(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return 1024*t/e}const Or=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Nr(e){let t=new Uint8Array(e),i=null,s=0,r=0,o=0,a=null;if(s=r=t[0]>>>3,o=(7&t[0])<<1|t[1]>>>7,o<0||o>=Or.length)return void console.error("Flv: AAC invalid sampling frequency index!");let n=Or[o],l=(120&t[1])>>>3;if(l<0||l>=8)return void console.log("Flv: AAC invalid channel configuration");5===s&&(a=(7&t[1])<<1|t[2]>>>7,t[2]);let d=wr.navigator.userAgent.toLowerCase();return-1!==d.indexOf("firefox")?o>=6?(s=5,i=new Array(4),a=o-3):(s=2,i=new Array(2),a=o):-1!==d.indexOf("android")?(s=2,i=new Array(2),a=o):(s=5,a=o,i=new Array(4),o>=6?a=o-3:1===l&&(s=2,i=new Array(2),a=o)),i[0]=s<<3,i[0]|=(15&o)>>>1,i[1]=(15&o)<<7,i[1]|=(15&l)<<3,5===s&&(i[1]|=(15&a)>>>1,i[2]=(1&a)<<7,i[2]|=8,i[3]=0),{audioType:"aac",config:i,sampleRate:n,channelCount:l,objectType:s,codec:"mp4a.40."+s,originalCodec:"mp4a.40."+r}}class jr{constructor(e){this.buffer=e,this.buflen=e.length,this.bufpos=0,this.bufoff=0,this.iserro=!1}read(e){let t=0,i=0;for(;e;){if(e<0||this.bufpos>=this.buflen)return this.iserro=!0,0;this.iserro=!1,i=this.bufoff+e>8?8-this.bufoff:e,t<<=i,t+=this.buffer[this.bufpos]>>8-this.bufoff-i&255>>8-i,this.bufoff+=i,e-=i,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,i=this.bufoff,s=this.read(e);return this.bufpos=t,this.bufoff=i,s}read_golomb(){let e;for(e=0;0==this.read(1)&&!this.iserro;e++);return(1<=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(4095===(i[t+0]<<8|i[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let i=this.current_syncword_offset_,s=(8&e[i+1])>>>3,r=(6&e[i+1])>>>1,o=1&e[i+1],a=(192&e[i+2])>>>6,n=(60&e[i+2])>>>2,l=(1&e[i+2])<<2|(192&e[i+3])>>>6,d=(3&e[i+3])<<11|e[i+4]<<3|(224&e[i+5])>>>5;if(e[i+6],i+d>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let h=1===o?7:9,c=d-h;i+=h;let u=this.findNextSyncwordOffset(i+c);if(this.current_syncword_offset_=u,0!==s&&1!==s||0!==r)continue;let p=e.subarray(i,i+c);t={},t.audio_object_type=a+1,t.sampling_freq_index=n,t.sampling_frequency=Rr[n],t.channel_config=l,t.data=p}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class $r{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,i=this.data_;for(;;){if(t+1>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(695===(i[t+0]<<3|i[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),i=0;for(let s=0;s<=t;s++)i<<=8,i|=e.readByte();return i}readNextAACFrame(e){let t=this.data_,i=null;for(;null==i&&!this.eof_flag_;){let s=this.current_syncword_offset_,r=(31&t[s+1])<<8|t[s+2];if(s+3+r>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let o=new Dr(t.subarray(s+3,s+3+r)),a=null;if(o.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(s+3+r),o.destroy();continue}a=e}else{let e=o.readBool();if(e&&o.readBool()){console.error("audioMuxVersionA is Not Supported"),o.destroy();break}if(e&&this.getLATMValue(o),!o.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),o.destroy();break}if(0!==o.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),o.destroy();break}if(0!==o.readBits(4)){console.error("more than 2 numProgram Not Supported"),o.destroy();break}if(0!==o.readBits(3)){console.error("more than 2 numLayer Not Supported"),o.destroy();break}let t=e?this.getLATMValue(o):0,i=o.readBits(5);t-=5;let s=o.readBits(4);t-=4;let r=o.readBits(4);t-=4,o.readBits(3),t-=3,t>0&&o.readBits(t);let n=o.readBits(3);if(0!==n){console.error(`frameLengthType = ${n}. Only frameLengthType = 0 Supported`),o.destroy();break}o.readByte();let l=o.readBool();if(l)if(e)this.getLATMValue(o);else{let e=0;for(;;){e<<=8;let t=o.readBool();if(e+=o.readByte(),!t)break}console.log(e)}o.readBool()&&o.readByte(),a={},a.audio_object_type=i,a.sampling_freq_index=s,a.sampling_frequency=Rr[a.sampling_freq_index],a.channel_config=r,a.other_data_present=l}let n=0;for(;;){let e=o.readByte();if(n+=e,255!==e)break}let l=new Uint8Array(n);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function qr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return[];const i=e.length,s=[];let r,o=0;for(;o+t>>=8),o+=t,r){if(o+r>i)break;s.push(e.subarray(o,o+r)),o+=r}return s}function Kr(e){const t=e.byteLength,i=new Uint8Array(4);i[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t;const s=new Uint8Array(t+4);return s.set(i,0),s.set(e,4),s}function Yr(){}function Qr(e){let t=null;const i=["webgl","experimental-webgl","moz-webgl","webkit-3d"];let s=0;for(;!t&&s0&&void 0!==arguments[0]?arguments[0]:"";const t=e.split(","),i=atob(t[1]),s=t[0].replace("data:","").replace(";base64","");let r=i.length,o=new Uint8Array(r);for(;r--;)o[r]=i.charCodeAt(r);return new File([o],"file",{type:s})}function eo(){return(new Date).getTime()}function to(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}function io(e,t,i){if(e)return"object"==typeof t&&Object.keys(t).forEach((i=>{io(e,i,t[i])})),e.style[t]=i,e}function so(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return 0;const s=getComputedStyle(e,null).getPropertyValue(t);return i?parseFloat(s):s}function ro(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function oo(e){let t=0,i=ro();return s=>{if(!So(s))return;t+=s;const r=ro(),o=r-i;o>=1e3&&(e(t/o*1e3),i=r,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();const ao='"8-16-2024"',no=!1;function lo(){return/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase())}function ho(){return!(lo()||/ipad|android(?!.*mobile)|tablet|kindle|silk/i.test(window.navigator.userAgent.toLowerCase()))}function co(){const e=window.navigator.userAgent.toLowerCase();return/android/i.test(e)}function uo(){const e=window.navigator.userAgent.toLowerCase();return/firefox/i.test(e)}function po(){const e=window.navigator.userAgent.toLowerCase()||"",t={type:"",version:""},i={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:e.indexOf("chrome")>-1&&e.indexOf("safari")>-1,Firefox:e.indexOf("firefox")>-1,Opera:e.indexOf("opera")>-1,Safari:e.indexOf("safari")>-1&&-1==e.indexOf("chrome"),Edge:e.indexOf("edge")>-1,QQBrowser:/qqbrowser/.test(e),WeixinBrowser:/MicroMessenger/i.test(e)};for(let s in i)if(i[s]){let i="";if("IE"===s){const t=e.match(/(msie\s|trident.*rv:)([\w.]+)/);t&&t.length>2&&(i=e.match(/(msie\s|trident.*rv:)([\w.]+)/)[2])}else if("Chrome"===s){for(let e in navigator.mimeTypes)"application/360softmgrplugin"===navigator.mimeTypes[e].type&&(s="360");const t=e.match(/chrome\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Firefox"===s){const t=e.match(/firefox\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Opera"===s){const t=e.match(/opera\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Safari"===s){const t=e.match(/version\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Edge"===s){const t=e.match(/edge\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("QQBrowser"===s){const t=e.match(/qqbrowser\/([\d.]+)/);t&&t.length>1&&(i=t[1])}t.type=s,t.version=parseInt(i)}return t}function fo(){const e=window.navigator.userAgent.toLowerCase();return e&&/iphone|ipad|ipod|ios/.test(e)}function mo(){const e=window.navigator.userAgent;return!e.match(/Chrome/gi)&&!!e.match(/Safari/gi)}function go(e,t){if(0===arguments.length)return null;var i,s=t||"{y}-{m}-{d} {h}:{i}:{s}";"object"==typeof e?i=e:(10===(""+e).length&&(e=1e3*parseInt(e)),e=+e,i=new Date(e));var r={y:i.getFullYear(),m:i.getMonth()+1,d:i.getDate(),h:i.getHours(),i:i.getMinutes(),s:i.getSeconds(),a:i.getDay()},o=s.replace(/{(y|m|d|h|i|s|a)+}/g,((e,t)=>{var i=r[t];return"a"===t?["一","二","三","四","五","六","日"][i-1]:(e.length>0&&i<10&&(i="0"+i),i||0)}));return o}function yo(){return"VideoFrame"in window}function Ao(e){if("string"!=typeof e)return e;var t=Number(e);return isNaN(t)?e:t}function bo(){return"xxxxxxxxxxxx4xxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}function vo(e,t){let i,s,r=!1;return function o(){for(var a=arguments.length,n=new Array(a),l=0;l{r=!1,i&&(o.apply(s,i),i=null,s=null)}),t)}}function _o(e){if(null==e||""==e)return"0 Bytes";const t=new Array("Bytes","KB","MB","GB","TB","PB","EB","ZB","YB");let i=0;const s=parseFloat(e);i=Math.floor(Math.log(s)/Math.log(1024));var r=s/Math.pow(1024,i);return(r=r.toFixed(2))+t[i]}function So(e){return"[object Number]"===Object.prototype.toString.call(e)}function Eo(){let e=!1;return"MediaSource"in wr&&wr.MediaSource&&(wr.MediaSource.isTypeSupported(ui)||wr.MediaSource.isTypeSupported(pi)||wr.MediaSource.isTypeSupported(fi)||wr.MediaSource.isTypeSupported(mi)||wr.MediaSource.isTypeSupported(gi))&&(e=!0),e}function wo(){const e=po();return"chrome"===e.type.toLowerCase()&&e.version>=107}function To(){let e=!1;return"MediaStreamTrackGenerator"in window&&(e=!0),e}function ko(){let e=!1;return"MediaStream"in window&&(e=!0),e}function Lo(e,t){let i=window.URL.createObjectURL(t),s=window.document.createElement("a");s.download=e,s.href=i;let r=window.document.createEvent("MouseEvents");r.initEvent("click",!0,!0),s.dispatchEvent(r),setTimeout((()=>{window.URL.revokeObjectURL(i)}),fo()?1e3:0)}function Co(e){return null==e}function Do(e){return!0===e||!1===e}function xo(e){return!Co(e)}function Ro(e){let t={left:"",right:"",top:"",bottom:"",opacity:1,backgroundColor:"",image:{src:"",width:"100",height:"60"},text:{content:"",fontSize:"14",color:"#000",width:"",height:""},rect:{color:"green",lineWidth:2,width:"",height:"",fill:"",fillOpacity:.2},line:{x1:"",y1:"",x2:"",y2:"",color:"green",lineWidth:2},polygon:{color:"green",lineWidth:2,list:[],fill:"",fillOpacity:.2},html:""};const i=Object.assign(t.image,e.image||{}),s=Object.assign(t.text,e.text||{}),r=Object.assign(t.rect,e.rect||{}),o=Object.assign(t.line,e.line||{});return t=Object.assign(t,e,{image:i,text:s,rect:r,line:o}),t}function Po(e,t){let i={container:e||"",text:"",opacity:"",angle:"",color:"",fontSize:"",fontFamily:""};return i=Object.assign(i,t),{watermark_parent_node:i.container,watermark_alpha:i.opacity,watermark_angle:i.angle,watermark_fontsize:i.fontSize,watermark_color:i.color,watermark_font:i.fontFamily,watermark_txt:i.text}}function Bo(e,t){return new Promise(((i,s)=>{let r=Ro(t);if(!r.image.src&&!r.text.content)return i(e);let o=document.createElement("canvas");o.width=t.width,o.height=t.height;let a=o.getContext("2d");a.imageSmoothingEnabled=!0,a.imageSmoothingEnabled&&(a.imageSmoothingQuality="high");let n=0,l=0;So(r.left)?n=r.left:So(r.right)&&(n=o.width-r.right),So(r.top)?l=r.top:So(r.bottom)&&(l=o.height-r.bottom);const d=new Image;d.src=e,d.onload=()=>{if(a.drawImage(d,0,0),r.image&&r.image.src){const e=new Image;e.src=r.image.src,e.setAttribute("crossOrigin","Anonymous"),e.onload=()=>{n-=r.image.width,a.drawImage(e,n,l,r.image.width,r.image.height),i(o.toDataURL(t.format,t.quality))},e.onerror=e=>{s()}}else r.text&&r.text.content&&(a.font=r.text.fontSize+"px 宋体",a.fillStyle=r.text.color,a.textAlign="right",a.fillText(r.text.content,n,l),i(o.toDataURL(t.format,t.quality)))},d.onerror=e=>{s(e)}}))}function Io(e){var t,i=0;if(0===e.length)return i;for(t=0;t{if(!t.copyright)return i(e);let r=document.createElement("canvas");r.width=t.width,r.height=t.height;let o=r.getContext("2d");o.imageSmoothingEnabled=!0,o.imageSmoothingEnabled&&(o.imageSmoothingQuality="high");const a=new Image;a.src=e,a.onload=()=>{o.drawImage(a,0,0);const e=Io(t.copyright),s=o.getImageData(0,0,r.width,r.height);!function(e,t){for(var i=e.data,s=0,r=0;r<32;r++){var o=t>>r&1,a=254&i[s]|o;i[s]=a,s+=4}}(s,e),o.putImageData(s,0,0),i(r.toDataURL(t.format,t.quality))},a.onerror=e=>{s(e)}}))}function Fo(e){var t;if(e>-1){var i=Math.floor(e/3600),s=Math.floor(e/60)%60,r=e%60;t=i<10?"0"+i+":":i+":",s<10&&(t+="0"),t+=s+":",(r=Math.round(r))<10&&(t+="0"),t+=r.toFixed(0)}return t}function Uo(e,t){let i="";if(e>-1){const s=Math.floor(e/60)%60;let r=e%60;r=Math.round(r),i=s<10?"0"+s+":":s+":",r<10&&(i+="0"),i+=r,Co(t)||(t<10&&(t="0"+t),i+=":"+t)}return i}function Oo(e){let t="";if(e>-1){const i=Math.floor(e/60/60)%60;let s=Math.floor(e/60)%60,r=e%60;s=Math.round(s),t=i<10?"0"+i+":":i+":",s<10&&(t+="0"),t+=s+":",r<10&&(t+="0"),t+=r}return t}function No(e,t){const i=Math.floor(t/60)%60,s=Math.floor(t%60);return new Date(e).setHours(i,s,0,0)}function jo(e,t){const i=Math.floor(t/60/60)%60,s=Math.floor(t/60)%60,r=t%60;return new Date(e).setHours(i,s,r,0)}function Go(e){return(""+e).length}function zo(e){return e&&0===Object.keys(e).length}function Wo(e){return!zo(e)}function Vo(e){return"string"==typeof e}const Ho=()=>{const e=window.navigator.userAgent;return/MicroMessenger/i.test(e)},$o=()=>{const e=window.navigator.userAgent;return/Chrome/i.test(e)};function Jo(e){const t=e||window.event;return t.target||t.srcElement}function qo(){return uo()&&function(){const e=navigator.userAgent.toLowerCase();return/macintosh|mac os x/i.test(e)}()}function Ko(e){return"function"==typeof e}function Yo(e){if(lo()){let t=0,i=0;if(1===e.touches.length){let s=e.touches[0];t=s.clientX,i=s.clientY}return{posX:t,posY:i}}let t=0,i=0;const s=e||window.event;return s.pageX||s.pageY?(t=s.pageX,i=s.pageY):(s.clientX||s.clientY)&&(t=e.clientX+document.documentElement.scrollLeft+document.body.scrollLeft,i=e.clientY+document.documentElement.scrollTop+document.body.scrollTop),{posX:t,posY:i}}function Qo(){let e=document.createElement("video"),t=e.canPlayType("application/vnd.apple.mpegurl");return e=null,t}function Xo(e){let t=pa(e.hasAudio)&&(e.useMSE||e.useWCS&&!e.useOffscreen)&&pa(e.demuxUseWorker);return!!(pa(t)&&e.useMSE&&e.mseDecodeAudio&&pa(e.demuxUseWorker))||(!!(pa(t)&&e.useWCS&&e.wcsDecodeAudio)||t)}function Zo(e){let t=null,i=31&e[0];return i!==kt&&i!==Lt||(t=bt),t||(i=(126&e[0])>>1,i!==Gt&&i!==Wt&&i!==Ht||(t=vt)),t}function ea(e){e.close()}function ta(e){e.close()}function ia(){return"https:"===window.location.protocol||"localhost"===window.location.hostname}function sa(e){const t=Object.prototype.toString;return function(e){switch(t.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:try{return e instanceof Error}catch(e){return!1}}}(e)?e.message:null==e?"":"object"==typeof e?JSON.stringify(e,null,2):String(e)}function ra(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let i=e[0],s=null,r=1;if(e.length>0){let t=e[1];t&&t.ts-i.ts>1e5&&(i=t,r=2)}if(i)for(let o=r;o=1e3){e[o-1].ts-i.ts<1e3&&(s=o+1)}}}return s}function oa(e){for(var t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),i=window.atob(t),s=new Uint8Array(i.length),r=0;r>4===As&&e[1]===ys}function ua(e){return!0===e||"true"===e}function pa(e){return!0!==e&&"true"!==e}function fa(e){return e.replace(/-([a-z])/g,(function(e,t){return t.toUpperCase()}))}function ma(){return/iphone/i.test(navigator.userAgent)}function ga(){return window.performance&&window.performance.memory?window.performance.memory:null}function ya(){try{var e=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!e.getContext("webgl2"))}catch(e){return!1}}function Aa(e){return e.trim().match(/^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/)[1]}function ba(){let e=!1;return"requestVideoFrameCallback"in HTMLVideoElement.prototype&&(e=!0),e}function va(){let e=!1;return"PressureObserver"in window&&(e=!0),e}function _a(e,t){const i=qr(e.slice(5));let s=!1;return i.forEach((e=>{const i=t?e[0]>>>1&63:31&e[0];(t&&(i===Mt||i===Ut||i===Nt)||pa(t)&&i===Ct)&&(s=!0)})),s}function Sa(){let e={down:"mousedown",move:"mousemove",up:"mouseup",click:"click"};return lo()&&(e={down:"touchstart",move:"touchmove",up:"touchend",click:"click"}),e}class Ea{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,i,s)));e.addEventListener(t,i,s);const r=()=>{Ko(e.removeEventListener)&&e.removeEventListener(t,i,s)};return this.destroys.push(r),r}destroy(){this.master.debugLog("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class wa{on(e,t,i){const s=this.e||(this.e={});return(s[e]||(s[e]=[])).push({fn:t,ctx:i}),this}once(e,t,i){const s=this;function r(){s.off(e,r);for(var o=arguments.length,a=new Array(o),n=0;n1?i-1:0),r=1;r{delete i[e]})),void delete this.e;const s=i[e],r=[];if(s&&t)for(let e=0,i=s.length;e0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=this.gl.createProgram();return this.gl.attachShader(i,e),this.gl.attachShader(i,t),this.gl.linkProgram(i),this.gl.getProgramParameter(i,this.gl.LINK_STATUS)?i:(console.log("Unable to initialize the shader program: "+this.gl.getProgramInfoLog(i)),null)}_loadShader(e,t){const i=this.gl,s=i.createShader(e);return i.shaderSource(s,t),i.compileShader(s),i.getShaderParameter(s,i.COMPILE_STATUS)?s:(console.log("An error occurred compiling the shaders: "+i.getShaderInfoLog(s)),i.deleteShader(s),null)}_initBuffers(){const e=this.gl,t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);const i=[-1,-1,1,-1,1,1,-1,1];e.bufferData(e.ARRAY_BUFFER,new Float32Array(i),e.STATIC_DRAW);var s=[];s=s.concat([0,1],[1,1],[1,0],[0,0]);const r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array(s),e.STATIC_DRAW);const o=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{positions:i,position:t,texPosition:r,indices:o}}_createTexture(){let e=this.gl.createTexture();return this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),e}_drawScene(e,t,i){this.gl.viewport(0,0,e,t),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._buffers.position),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array(this._buffers.positions),this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this._programInfo.attribLocations.vertexPosition,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this._programInfo.attribLocations.vertexPosition),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._buffers.texPosition),this.gl.vertexAttribPointer(this._programInfo.attribLocations.texturePosition,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this._programInfo.attribLocations.texturePosition),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this._buffers.indices);i?(this.gl.activeTexture(this.gl.TEXTURE0+3),this.gl.bindTexture(this.gl.TEXTURE_2D,this._ytexture),this.gl.activeTexture(this.gl.TEXTURE0+4),this.gl.bindTexture(this.gl.TEXTURE_2D,this._utexture),this.gl.activeTexture(this.gl.TEXTURE0+5),this.gl.bindTexture(this.gl.TEXTURE_2D,this._vtexture)):(this.gl.activeTexture(this.gl.TEXTURE0+2),this.gl.bindTexture(this.gl.TEXTURE_2D,this._rgbatexture)),this.gl.useProgram(this._programInfo.program),this.gl.uniform1i(this._programInfo.uniformLocations.rgbatexture,2),this.gl.uniform1i(this._programInfo.uniformLocations.ytexture,3),this.gl.uniform1i(this._programInfo.uniformLocations.utexture,4),this.gl.uniform1i(this._programInfo.uniformLocations.vtexture,5),this.gl.uniform1i(this._programInfo.uniformLocations.isyuv,i?1:0),this.gl.drawElements(this.gl.TRIANGLES,6,this.gl.UNSIGNED_SHORT,0)}_calRect(e,t,i,s,r,o){let a=2*e/r-1,n=2*(o-t-s)/o-1,l=2*(e+i)/r-1,d=2*(o-t)/o-1;return[a,n,l,n,l,d,a,d]}_clear(){this.gl.clearColor(0,0,0,1),this.gl.clearDepth(1),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}render(e,t,i,s,r){const o=this.gl;this._clear(),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,this._ytexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e,t,0,o.LUMINANCE,o.UNSIGNED_BYTE,i),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,this._utexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e/2,t/2,0,o.LUMINANCE,o.UNSIGNED_BYTE,s),o.activeTexture(o.TEXTURE2),o.bindTexture(o.TEXTURE_2D,this._vtexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e/2,t/2,0,o.LUMINANCE,o.UNSIGNED_BYTE,r),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}renderYUV(e,t,i){let s=i.slice(0,e*t),r=i.slice(e*t,e*t*5/4),o=i.slice(e*t*5/4,e*t*3/2);const a=this.gl;this._clear(),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this._ytexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e,t,0,a.LUMINANCE,a.UNSIGNED_BYTE,s),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,this._utexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,r),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,this._vtexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,o),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}drawDom(e,t,i,s,r){const o=this.gl;o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,this._rgbatexture),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,r),this._buffers.positions=this._calRect(i,s,r.width,r.height,e,t),this._drawScene(e,t,!1)}}const Ba=1,Ia=2,Ma=4;class Fa{constructor(e){this.gpu=e,this.pipeline=null,this.matrixGroupInfo=null,this.depthTexture=null,this.textureGroupInfo=null,this.hasInited=!1,this.buffers=this._initBuffer(),this.isDestroyed=!1,this._initPipeline().then((e=>{this.isDestroyed||(this.pipeline=e,this.matrixGroupInfo=this._initMatrixGroupInfo(),this.matrixGroupInfo&&(this.hasInited=!0))}))}destroy(){this.isDestroyed=!1,this.gpu&&(this.gpu.device.destroy(),this.gpu=null),this.hasInited=!1,this.pipeline=null,this.matrixGroupInfo=null,this.depthTexture=null,this.textureGroupInfo=null}_initBuffer(){const e=this.gpu.device,t=new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),i=e.createBuffer({size:t.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST});e.queue.writeBuffer(i,0,t);const s=new Float32Array([0,1,1,1,1,0,0,0]),r=e.createBuffer({size:s.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST});e.queue.writeBuffer(r,0,s);const o=new Uint16Array([0,1,2,0,2,3]),a=e.createBuffer({size:o.byteLength,usage:window.GPUBufferUsage.INDEX|window.GPUBufferUsage.COPY_DST});return e.queue.writeBuffer(a,0,o),{positionBuffer:i,texpositionBuffer:r,indexBuffer:a}}_initPipeline(){return new Promise(((e,t)=>{const i=this.gpu.device,s=this.gpu.format,r={layout:"auto",vertex:{module:i.createShaderModule({code:"\n\n @binding(0) @group(0) var uModelMatrix : mat4x4;\n @binding(1) @group(0) var uViewMatrix : mat4x4;\n @binding(2) @group(0) var uProjectionMatrix : mat4x4;\n\n struct VertexOutput {\n @builtin(position) Position : vec4,\n @location(0) vTexturePosition : vec2,\n }\n\n @vertex\n fn main(\n @location(0) aVertexPosition : vec4,\n @location(1) aTexturePosition : vec2\n ) -> VertexOutput {\n var output : VertexOutput;\n var tmppos : vec4 = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n output.Position = vec4(tmppos.x, tmppos.y, (tmppos.z+1.)/2., tmppos.w); // webgl z [-1, 1], webgpu z [0, 1], 这里z做下调整 z-webgpu = (z-webgl+1)/2\n output.vTexturePosition = aTexturePosition;\n return output;\n }\n\n "}),entryPoint:"main",buffers:[{arrayStride:12,attributes:[{shaderLocation:0,offset:0,format:"float32x3"}]},{arrayStride:8,attributes:[{shaderLocation:1,offset:0,format:"float32x2"}]}]},primitive:{topology:"triangle-list"},fragment:{module:i.createShaderModule({code:"\n @group(1) @binding(0) var mySampler: sampler;\n @group(1) @binding(1) var pixelType: i32;\n @group(1) @binding(2) var yTexture: texture_2d;\n @group(1) @binding(3) var uTexture: texture_2d;\n @group(1) @binding(4) var vTexture: texture_2d;\n @group(1) @binding(5) var uvTexture: texture_2d;\n @group(1) @binding(6) var rgbaTexture: texture_2d;\n\n const YUV2RGB : mat4x4 = mat4x4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n @fragment\n fn main(\n @location(0) vTexturePosition: vec2\n ) -> @location(0) vec4 {\n if(pixelType == 1){\n var y : f32= textureSample(yTexture, mySampler, vTexturePosition).r;\n var u : f32 = textureSample(uTexture, mySampler, vTexturePosition).r;\n var v : f32 = textureSample(vTexture, mySampler, vTexturePosition).r;\n\n return vec4(y, u, v, 1.0)*YUV2RGB;\n } else if (pixelType == 2) {\n\n var y : f32= textureSample(yTexture, mySampler, vTexturePosition).r;\n var u : f32 = textureSample(uvTexture, mySampler, vTexturePosition).r;\n var v : f32 = textureSample(uvTexture, mySampler, vTexturePosition).g;\n\n return vec4(y, u, v, 1.0)*YUV2RGB;\n } else {\n\n return textureSample(rgbaTexture, mySampler, vTexturePosition);\n }\n\n }\n\n "}),entryPoint:"main",targets:[{format:s}]},depthStencil:{depthWriteEnabled:!0,depthCompare:"less",format:"depth24plus"}};i.createRenderPipelineAsync(r).then((t=>{e(t)})).catch((e=>{t(e)}))}))}_initMatrixGroupInfo(){if(!this.gpu)return null;const e=this.gpu.device,t=this.pipeline,i=La();xa(i,-1,1,-1,1,.1,100);const s=La();Ca(s);const r=La();!function(e,t,i,s){var r,o,a,n,l,d,h,c,u,p,f=t[0],m=t[1],g=t[2],y=s[0],A=s[1],b=s[2],v=i[0],_=i[1],S=i[2];Math.abs(f-v)Ro(e)));this.configList=i,this._updateDom()}_resizeDomForVideo(){const e=this.player.width,t=this.player.height,i=this.player.getVideoInfo();if(!(i&&i.height>0&&i.width>0))return;let s=i.width,r=i.height;const o=this.player._opt;let a=t,n=e;if(this.player.isControlBarShow()){const e=o.playType===_?Qt:Yt;lo()&&this.player.fullscreen&&o.useWebFullScreen?n-=e:a-=e}const l=o.rotate;let d=(n-s)/2,h=(a-r)/2;270!==l&&90!==l||(s=i.height,r=i.width);const c=n/s,u=a/r;let p=c>u?u:c;o.isResize||c!==u&&(p=c+","+u),o.isFullResize&&(p=c>u?c:u);let f="scale("+p+")";"none"===o.mirrorRotate&&l&&(f+=" rotate("+l+"deg)"),"level"===o.mirrorRotate?f+=" rotateY(180deg)":"vertical"===o.mirrorRotate&&(f+=" rotateX(180deg)"),this.scale=-1!==(""+p).indexOf(",")?c:p,this.shadowRootInnerDom.style.transform=f,this.shadowRootInnerDom.style.left=d+"px",this.shadowRootInnerDom.style.top=h+"px",this.shadowRootInnerDom.style.width=i.width+"px",this.shadowRootInnerDom.style.height=i.height+"px",this.shadowRootInnerDom.style.display="block"}_resizeDomForCanvas(){const e=this.player.getVideoInfo();if(!(e&&e.height>0&&e.width>0))return;const t=this.player._opt;let i=this.player.width,s=this.player.height;if(this.player.isControlBarShow()){const e=t.playType===_?Qt:Yt;lo()&&this.player.fullscreen&&t.useWebFullScreen?i-=e:s-=e}let r=e.width,o=e.height;const a=t.rotate;let n=(i-r)/2,l=(s-o)/2;270!==a&&90!==a||(r=e.height,o=e.width);const d=i/r,h=s/o;let c=d>h?h:d;t.isResize||d!==h&&(c=d+","+h),t.isFullResize&&(c=d>h?d:h);let u="scale("+c+")";"none"===t.mirrorRotate&&a&&(u+=" rotate("+a+"deg)"),"level"===t.mirrorRotate?u+=" rotateY(180deg)":"vertical"===t.mirrorRotate&&(u+=" rotateX(180deg)"),this.shadowRootInnerDom.style.height=e.height+"px",this.shadowRootInnerDom.style.width=e.width+"px",this.shadowRootInnerDom.style.padding="0",this.shadowRootInnerDom.style.transform=u,this.shadowRootInnerDom.style.left=n+"px",this.shadowRootInnerDom.style.top=l+"px",this.shadowRootInnerDom.style.display="block"}_resizeDomRatio(){const e=this.player.getVideoInfo();if(!(e&&e.height>0&&e.width>0))return;const t=this.player._opt.aspectRatio.split(":").map(Number);let i=this.player.width,s=this.player.height;const r=this.player._opt;let o=0;this.player.isControlBarShow()&&(o=r.playType===_?Qt:Yt,s-=o);const a=e.width/e.height,n=t[0]/t[1];if(a>n){const t=n*e.height/e.width;this.shadowRootInnerDom.style.width=100*t+"%",this.shadowRootInnerDom.style.height=`calc(100% - ${o}px)`,this.shadowRootInnerDom.style.padding=`0 ${(i-i*t)/2}px`}else{const t=e.width/n/e.height;this.shadowRootInnerDom.style.width="100%",this.shadowRootInnerDom.style.height=`calc(${100*t}% - ${o}px)`,this.shadowRootInnerDom.style.padding=(s-s*t)/2+"px 0"}this.shadowRootInnerDom.style.display="block"}_updateDom(){this.shadowRoot&&this.configList.forEach((e=>{const t=document.createElement("div");let i=null;if(e.image&&e.image.src?(i=document.createElement("img"),i.style.height="100%",i.style.width="100%",i.style.objectFit="contain",i.src=e.image.src):e.text&&e.text.content?i=document.createTextNode(e.text.content):(e.rect&&e.rect.color&&e.rect.width||e.html||e.line&&e.line.x1&&e.line.y1&&e.line.x2&&e.line.y2||e.polygon&&e.polygon.list&&e.polygon.list.length>=3)&&(i=document.createElement("div")),i){if(t.appendChild(i),t.style.visibility="",t.style.position="absolute",t.style.display="block",t.style["-ms-user-select"]="none",t.style["-moz-user-select"]="none",t.style["-webkit-user-select"]="none",t.style["-o-user-select"]="none",t.style["user-select"]="none",t.style["-webkit-touch-callout"]="none",t.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",t.style["-webkit-text-size-adjust"]="none",t.style["-webkit-touch-callout"]="none",t.style.opacity=e.opacity,xo(e.left)&&(So(e.left)?t.style.left=e.left+"px":t.style.left=e.left),xo(e.right)&&(So(e.right)?t.style.right=e.right+"px":t.style.right=e.right),xo(e.top)&&(So(e.top)?t.style.top=e.top+"px":t.style.top=e.top),xo(e.bottom)&&(So(e.bottom)?t.style.bottom=e.bottom+"px":t.style.bottom=e.bottom),e.backgroundColor&&(t.style.backgroundColor=e.backgroundColor),t.style.overflow="hidden",t.style.zIndex="9999999",e.image&&e.image.src)t.style.width=e.image.width+"px",t.style.height=e.image.height+"px";else if(e.text&&e.text.content)t.style.fontSize=e.text.fontSize+"px",t.style.color=e.text.color,e.text.width&&(t.style.width=e.text.width+"px"),e.text.height&&(t.style.height=e.text.height+"px");else if(e.rect&&e.rect.color&&e.rect.width){if(t.style.width=e.rect.width+"px",t.style.height=e.rect.height+"px",t.style.borderWidth=e.rect.lineWidth+"px",t.style.borderStyle="solid",t.style.borderColor=e.rect.color,e.rect.fill){const i=document.createElement("div");i.style.position="absolute",i.style.width="100%",i.style.height="100%",i.style.backgroundColor=e.rect.fill,e.rect.fillOpacity&&(i.style.opacity=e.rect.fillOpacity),t.appendChild(i)}}else if(e.html)t.style.width="100%",t.style.height="100%",t.innerHTML=e.html;else if(e.line&&e.line.x1&&e.line.y1&&e.line.x2&&e.line.y2)this.settingLine(t,e.line);else if(e.polygon&&e.polygon.list&&e.polygon.list.length>=3){t.style.width="100%",t.style.height="100%";let i=e.polygon.list;const s=e.polygon.color,r=e.polygon.lineWidth;if(i=i.sort(((e,t)=>(e.index||0)-(t.index||0))),e.polygon.fill){const s=document.createElement("div");s.style.position="absolute",s.style.width="100%",s.style.height="100%";const r="polygon("+i.map((e=>`${e.x}px ${e.y}px`)).join(", ")+")";s.style.clipPath=r,s.style.backgroundColor=e.polygon.fill,e.polygon.fillOpacity&&(s.style.opacity=e.polygon.fillOpacity),t.appendChild(s)}i.forEach(((e,o)=>{const a=document.createElement("div");if(o===i.length-1){const o=i[0],n={x1:e.x,y1:e.y,x2:o.x,y2:o.y,color:s,lineWidth:r};return this.settingLine(a,n),void t.appendChild(a)}const n=i[o+1],l={x1:e.x,y1:e.y,x2:n.x,y2:n.y,color:s,lineWidth:r};this.settingLine(a,l),t.appendChild(a)}))}this.isDynamic&&(this.shadowRootDynamicDom=t),this.shadowRootInnerDom.appendChild(t)}}))}settingLine(e,t){const i=t.x1,s=t.y1,r=t.x2,o=t.y2;var a=Math.sqrt((i-r)**2+(s-o)**2),n=180*Math.atan2(o-s,r-i)/Math.PI;e.style.backgroundColor=t.color,e.style.width=a+"px",e.style.height=t.lineWidth+"px",e.style.position="absolute",e.style.top=s+"px",e.style.left=i+"px",e.style.transform="rotate("+n+"deg)",e.style.transformOrigin="0 0"}remove(){this._removeDom()}_removeDom(){this.shadowRootInnerDom&&(this.shadowRootInnerDom.innerHTML="")}}class Oa extends wa{constructor(){super(),this.videoInfo={width:null,height:null,encType:null,encTypeCode:null},this.init=!1,this.prevAiFaceDetectTime=null,this.prevAiObjectDetectTime=null,this.prevOcclusionDetectTime=null,this.contentWatermark=null,this.aiContentWatermark=null,this.tempContentList=[],this.tempAiContentList=[],this.streamFps=0}destroy(){this.resetInit(),this.contentWatermark&&(this.contentWatermark.destroy(),this.contentWatermark=null),this.tempContentList=[],this.aiContentWatermark&&(this.aiContentWatermark.destroy(),this.aiContentWatermark=null),this.tempAiContentList=[],this.prevAiFaceDetectTime=null,this.prevAiObjectDetectTime=null,this.streamFps=0,this.off()}resetInit(){this.videoInfo={width:null,height:null,encType:null,encTypeCode:null},this.init=!1}getHasInit(){return this.init}updateVideoInfo(e){xo(e.encTypeCode)&&(this.videoInfo.encType=gt[e.encTypeCode],this.videoInfo.encTypeCode=e.encTypeCode),xo(e.encType)&&(this.videoInfo.encType=e.encType),xo(e.width)&&(this.videoInfo.width=e.width),xo(e.height)&&(this.videoInfo.height=e.height),xo(this.videoInfo.encType)&&xo(this.videoInfo.height)&&xo(this.videoInfo.width)&&!this.init&&(this.player.emit(ot.videoInfo,this.videoInfo),this.init=!0)}getVideoInfo(){return this.videoInfo}clearView(){this.tempContentList=[],this.tempAiContentList=[]}resize(){if(this.player.debugLog("CommonVideo","resize()"),"default"===this.player._opt.aspectRatio||lo()?this._resize():this._resizeRatio(),this.contentWatermark&&this.contentWatermark.resize(),this.aiContentWatermark&&this.aiContentWatermark.resize(),this.player.singleWatermark&&this.player.singleWatermark.resize(),this.player.ghostWatermark&&this.player.ghostWatermark.resize(),this.player.dynamicWatermark&&this.player.dynamicWatermark.resize(),this.player.zoom&&this.player.zooming){const e=this._getStyleScale();this.player.zoom.updatePrevVideoElementStyleScale(e),this.player.zoom.updateVideoElementScale()}}_resizeRatio(){this.player.debugLog("CommonVideo","_resizeRatio()");const e=this.player._opt.aspectRatio.split(":").map(Number);let t=this.player.width,i=this.player.height;const s=this.player._opt;let r=0;this.player.isControlBarShow()&&(r=s.playType===_?Qt:Yt,i-=r);const o=this.videoInfo,a=o.width/o.height,n=e[0]/e[1];if(this.getType()===H&&(this.$videoElement.style.left="0",this.$videoElement.style.top="0",this.$videoElement.style.transform="none"),this.getType()===$&&this.player._opt.videoRenderSupportScale&&(this.$videoElement.style.objectFit="fill"),a>n){const e=n*o.height/o.width;this.$videoElement.style.width=100*e+"%",this.$videoElement.style.height=`calc(100% - ${r}px)`,this.$videoElement.style.padding=`0 ${(t-t*e)/2}px`}else{const e=o.width/n/o.height;this.$videoElement.style.width="100%",this.$videoElement.style.height=`calc(${100*e}% - ${r}px)`,this.$videoElement.style.padding=(i-i*e)/2+"px 0"}}play(){}pause(){}setRate(e){}getType(){return""}getCanvasType(){return""}getCurrentTime(){return 0}getStreamFps(){return this.streamFps}isPlaying(){return!0}isVideoPlaying(){return this.isPlaying()}getPlaybackQuality(){return null}setStreamFps(e){this.player.debugLog("CommonVideo","setStreamFps",e),this.streamFps=e}addContentToCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.tempContentList=e}addAiContentToCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.tempAiContentList=e}doAddContentToWatermark(){if(this.tempContentList.length>0){this.contentWatermark||(this.contentWatermark=new Ua(this.player),this.contentWatermark.resize());const e=[];this.tempContentList.forEach((t=>{let i={left:t.x||0,top:t.y||0};"text"===t.type?i.text={content:t.text,fontSize:t.fontSize||"14",color:t.color||"#000"}:"rect"===t.type?i.rect={width:t.width,height:t.height,color:t.color||"green",lineWidth:t.lineWidth||2,fill:t.fill||"",fillOpacity:t.fillOpacity||.2}:"polygon"===t.type?i.polygon={list:t.list,color:t.color||"green",lineWidth:t.lineWidth||2,fill:t.fill,fillOpacity:t.fillOpacity||.2}:"line"===t.type&&(i.line={color:t.color||"green",lineWidth:t.lineWidth||2,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}),e.push(i)})),this.contentWatermark.update(e)}else this.contentWatermark&&this.contentWatermark.remove()}doAddAiContentToWatermark(){if(this.tempAiContentList.length>0){this.aiContentWatermark||(this.aiContentWatermark=new Ua(this.player),this.aiContentWatermark.resize());const e=this.tempAiContentList.map((e=>{let t={left:e.x,top:e.y};return"text"===e.type?t.text={content:e.text,fontSize:e.fontSize,color:e.color}:"rect"===e.type&&(t.rect={width:e.width,height:e.height,color:e.color,lineWidth:e.lineWidth}),t}));this.aiContentWatermark.update(e)}else this.aiContentWatermark&&this.aiContentWatermark.remove()}_getStyleScale(){let e=this.$videoElement.style.transform.match(/scale\([0-9., ]*\)/g),t="";if(e&&e[0]){t=e[0].replace("scale(","").replace(")","").split(",")}return t}getReadyStateInited(){return!0}screenshotByCurrentWatermark(){}initCanvasViewSize(){}bindMediaStream(){}}var Na="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0;function ja(e,t,i){var s=new XMLHttpRequest;s.open("GET",e),s.responseType="blob",s.onload=function(){Va(s.response,t,i)},s.onerror=function(){console.error("could not download file")},s.send()}function Ga(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return t.status>=200&&t.status<=299}function za(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(i){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var Wa=Na.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),Va="object"!=typeof window||window!==Na?function(){}:"download"in HTMLAnchorElement.prototype&&!Wa?function(e,t,i){var s=Na.URL||Na.webkitURL,r=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",r.download=t,r.rel="noopener","string"==typeof e?(r.href=e,r.origin!==location.origin?Ga(r.href)?ja(e,t,i):za(r,r.target="_blank"):za(r)):(r.href=s.createObjectURL(e),setTimeout((function(){s.revokeObjectURL(r.href)}),4e4),setTimeout((function(){za(r)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download","string"==typeof e)if(Ga(e))ja(e,t,i);else{var s=document.createElement("a");s.href=e,s.target="_blank",setTimeout((function(){za(s)}))}else navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e}(e,i),t)}:function(e,t,i,s){if((s=s||open("","_blank"))&&(s.document.title=s.document.body.innerText="downloading..."),"string"==typeof e)return ja(e,t,i);var r="application/octet-stream"===e.type,o=/constructor/i.test(Na.HTMLElement)||Na.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent);if((a||r&&o||Wa)&&"undefined"!=typeof FileReader){var n=new FileReader;n.onloadend=function(){var e=n.result;e=a?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),s?s.location.href=e:location=e,s=null},n.readAsDataURL(e)}else{var l=Na.URL||Na.webkitURL,d=l.createObjectURL(e);s?s.location=d:location.href=d,s=null,setTimeout((function(){l.revokeObjectURL(d)}),4e4)}};function Ha(e){return new Promise(((t,i)=>{navigator.gpu?navigator.gpu.requestAdapter().then((s=>{s?s.requestDevice().then((r=>{if(r){const o=e.getContext("webgpu");if(o){const e=navigator.gpu.getPreferredCanvasFormat();o.configure({device:r,format:e,alphaMode:"opaque"}),t({adapter:s,device:r,context:o,format:e})}else i('WebGPU "context" create fail')}else i('WebGPU "device" request fail')})).catch((e=>{i('WebGPU "adapter.requestDevice()" fail')})):i('WebGPU "adapter" request fail is empty')})).catch((e=>{i('WebGPU "navigator.gpu.requestAdapter()" fail')})):i("WebGPU not support!!")}))}class $a{constructor(e,t){this.canvas=e,this.gl=t;const i=t.createShader(t.VERTEX_SHADER);if(t.shaderSource(i,"\n attribute vec2 xy;\n varying highp vec2 uv;\n void main(void) {\n gl_Position = vec4(xy, 0.0, 1.0);\n // Map vertex coordinates (-1 to +1) to UV coordinates (0 to 1).\n // UV coordinates are Y-flipped relative to vertex coordinates.\n uv = vec2((1.0 + xy.x) / 2.0, (1.0 - xy.y) / 2.0);\n }\n "),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS))throw t.getShaderInfoLog(i);const s=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(s,"\n varying highp vec2 uv;\n uniform sampler2D texture;\n void main(void) {\n gl_FragColor = texture2D(texture, uv);\n }\n "),t.compileShader(s),!t.getShaderParameter(s,t.COMPILE_STATUS))throw t.getShaderInfoLog(s);const r=t.createProgram();if(t.attachShader(r,i),t.attachShader(r,s),t.linkProgram(r),!t.getProgramParameter(r,t.LINK_STATUS))throw t.getProgramInfoLog(r);t.useProgram(r);const o=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),t.STATIC_DRAW);const a=t.getAttribLocation(r,"xy");t.vertexAttribPointer(a,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(a);const n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this.program=r,this.buffer=o,this.vertexShader=i,this.fragmentShader=s,this.texture=n}destroy(){this.gl.deleteProgram(this.program),this.gl.deleteBuffer(this.buffer),this.gl.deleteTexture(this.texture),this.gl.deleteShader(this.vertexShader),this.gl.deleteShader(this.fragmentShader),this.program=null,this.buffer=null,this.vertexShader=null,this.fragmentShader=null,this.texture=null}render(e){this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight;const t=this.gl;t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight),t.clearColor(1,0,0,1),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4)}}class Ja extends Oa{constructor(e){super(),this.player=e;const t=document.createElement("canvas");t.style.position="absolute",t.style.top=0,t.style.left=0,this.$videoElement=t,e.$container.appendChild(this.$videoElement),this.context2D=null,this.contextGl=null,this.webglRender=null,this.webglRectRender=null,this.webGPURender=null,this.isWebglContextLost=!1,this.isWcsWebgl2=!1,this.isWcsWebgpu=!1,this.bitmaprenderer=null,this.renderType=null,this.controlHeight=0,this.proxyDestroyList=[],this._initCanvasRender()}destroy(){super.destroy(),this.proxyDestroyList.length>0&&(this.proxyDestroyList.forEach((e=>{e&&e()})),this.proxyDestroyList=[]),this.contextGl&&(this.contextGl=null),this.context2D&&(this.context2D=null),this.webglRender&&(this.webglRender.destroy(),this.webglRender=null),this.webglRectRender&&(this.webglRectRender.destroy(),this.webglRectRender=null),this.webGPURender&&(this.webGPURender.destroy(),this.webGPURender=null),this.bitmaprenderer&&(this.bitmaprenderer=null),this.renderType=null,this.isWebglContextLost=!1,this.isWcsWebgpu=!1,this.isWcsWebgl2=!1,this.videoInfo={width:"",height:"",encType:""},this.player.$container.removeChild(this.$videoElement),this.init=!1,this.off()}_initContext2D(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.context2D=this.$videoElement.getContext("2d",e)}_initContextGl(){if(this.player.events,this.contextGl=Qr(this.$videoElement),!this.contextGl)throw this.player.debugError("CommonCanvasLoader","_initContextGl() createContextGL error"),new Error("CommonCanvasLoader and _initContextGl createContextGL error");this._bindContextGlEvents(),this.webglRender=new Pa(this.contextGl,this.player._opt.openWebglAlignment)}_initContextGl2(){if(this.contextGl=Xr(this.$videoElement),this.contextGl){this._bindContextGlEvents(2);try{this.webglRender=new $a(this.$videoElement,this.contextGl)}catch(e){this.player.debugError("CommonCanvasLoader",`create webgl2Render error is ${e} and next use context2d.draw render`),this.contextGl=null,this.webglRender=null,this._initContext2D()}}else this.player.debugError("CommonCanvasLoader","_initContextGl2() createContextGL2 error")}_bindContextGlEvents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;const{proxy:t}=this.player.events,i=t(this.$videoElement,"webglcontextlost",(t=>{t.preventDefault(),this.player.debugError("canvasVideo","webglcontextlost error",t),this.isWebglContextLost=!0,this.webglRender&&(this.player.debugLog("CommonCanvasLoader","webglcontextlost error and destroy webglRender"),this.webglRender.destroy(),this.webglRender=null),this.webglRectRender&&(this.player.debugLog("CommonCanvasLoader","webglcontextlost error and destroy webglRectRender"),this.webglRectRender.destroy(),this.webglRectRender=null),this.contextGl=null,setTimeout((()=>{if(this.player.debugLog("CommonCanvasLoader",`createContextGL() version ${e}`),1===e?this.contextGl=Qr(this.$videoElement):2===e&&(this.contextGl=Xr(this.$videoElement)),this.player.debugLog("CommonCanvasLoader","createContextGL success"),this.contextGl&&this.contextGl.getContextAttributes){const t=this.contextGl.getContextAttributes();t&&t.stencil?(1===e?this.webglRender=new Pa(this.contextGl,this.player._opt.openWebglAlignment):2===e&&(this.webglRender=new $a(this.$videoElement,this.contextGl)),this.isWebglContextLost=!1,this.player.debugLog("CommonCanvasLoader","webglcontextlost error reset and getContextAttributes().stencil is true")):(this.player.debugError("CommonCanvasLoader","webglcontextlost error, getContextAttributes().stencil is false"),this.player.emitError(lt.webglContextLostError))}else this.player.debugError("CommonCanvasLoader","webglcontextlost error, getContextAttributes().stencil is false"),this.player.emitError(lt.webglContextLostError)}),500)})),s=t(this.$videoElement,"webglcontextrestored",(e=>{e.preventDefault(),this.player.debugLog("CommonCanvasLoader","webglcontextrestored ",e)}));this.proxyDestroyList.push(i,s)}_initContextGPU(){Ha(this.$videoElement).then((e=>{this.player.isDestroyedOrClosed()||(e?(this.webGPURender=new Fa(e),this.player.debugLog("CommonCanvasLoader","webGPURender init success")):(this.player.debugWarn("CommonCanvasLoader","webGPURender init failed because context is null and next use webgl render"),this.renderType=ii,this._initContextGl()))})).catch((e=>{this.player.isDestroyedOrClosed()||(this.player.debugWarn("CommonCanvasLoader",`createWebGPUContext error is ${e} and next use webgl render`),this.renderType=ii,this._initContextGl())}))}initCanvasViewSize(){this.$videoElement.width=this.videoInfo.width,this.$videoElement.height=this.videoInfo.height,this.resize()}screenshot(e,t,i,s){e=e||eo(),s=s||pt.download;let r=.92;!Vi[t]&&pt[t]&&(s=t,t="png",i=void 0),"string"==typeof i&&(s=i,i=void 0),void 0!==i&&(r=Number(i));const o=Vi[t]||Vi.png,a=this.$videoElement.toDataURL(o,r);if(s===pt.base64)return a;{const t=Zr(a);if(s===pt.blob)return t;if(s===pt.download){const i=o.split("/")[1];Va(t,e+"."+i)}}}screenshotWatermark(e){return new Promise(((t,i)=>{Vo(e)&&(e={filename:e}),(e=e||{}).width=this.videoInfo.width,e.height=this.videoInfo.height,e.filename=e.filename||eo(),e.format=e.format?Vi[e.format]:Vi.png,e.quality=Number(e.quality)||.92,e.type=e.type||pt.download;const s=this.$videoElement.toDataURL(e.format,e.quality);Bo(s,e).then((i=>{if(e.type===pt.base64)t(s);else{const s=Zr(i);if(e.type===pt.blob)t(s);else if(e.type===pt.download){t();const i=e.format.split("/")[1];Va(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}))}screenshotCopyrightWatermark(e){return new Promise(((t,i)=>{if(Vo(e)){(e=(e={filename:e})||{}).width=this.videoInfo.width,e.height=this.videoInfo.height,e.filename=e.filename||eo(),e.format=e.format?Vi[e.format]:Vi.png,e.quality=Number(e.quality)||.92,e.type=e.type||pt.download;const s=this.$videoElement.toDataURL(e.format,e.quality);Mo(s,e).then((i=>{if(e.type===pt.base64)t(s);else{const s=Zr(i);if(e.type===pt.blob)t(s);else if(e.type===pt.download){t();const i=e.format.split("/")[1];Va(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}}))}screenshotByCurrentWatermark(e){}render(){}clearView(){super.clearView()}play(){}pause(){}_resize(){this.player.debugLog("canvasVideo","_resize()");const e=this.player._opt;let t=this.player.width,i=this.player.height;if(this.player.isControlBarShow()){const s=this.controlHeight;lo()&&this.player.fullscreen&&e.useWebFullScreen?t-=s:i-=s}let s=this.$videoElement.width,r=this.$videoElement.height;const o=e.rotate;let a=(t-s)/2,n=(i-r)/2;270!==o&&90!==o||(s=this.$videoElement.height,r=this.$videoElement.width);const l=t/s,d=i/r;let h=l>d?d:l;pa(e.isResize)&&l!==d&&(h=l+","+d),e.isFullResize&&(h=l>d?l:d);let c="scale("+h+")";"none"===e.mirrorRotate&&o&&(c+=" rotate("+o+"deg)"),"level"===e.mirrorRotate?c+=" rotateY(180deg)":"vertical"===e.mirrorRotate&&(c+=" rotateX(180deg)"),this.$videoElement.style.height=this.videoInfo.height+"px",this.$videoElement.style.width=this.videoInfo.width+"px",this.$videoElement.style.padding="0",this.$videoElement.style.transform=c,this.$videoElement.style.left=a+"px",this.$videoElement.style.top=n+"px"}initFps(){}setStreamFps(e){}getStreamFps(){return 25}getType(){return H}getCanvasType(){let e=this.renderType===ri?ri:ii;return this.isWcsWebgl2?e=si:this.isWcsWebgpu&&(e=ri),e}}class qa extends Ja{constructor(e){super(e),this.TAG_NAME="CanvasVideo",this.yuvList=[],this.controlHeight=Yt,this.tempTextCanvas=null,this.tempTextCanvasCtx=null,this.player.debugLog("CanvasVideo","init")}async destroy(){super.destroy(),this.yuvList=[],this.tempTextCanvas&&(this.tempTextCanvasCtx.clearRect(0,0,this.tempTextCanvas.width,this.tempTextCanvas.height),this.tempTextCanvas.width=0,this.tempTextCanvas.height=0,this.tempTextCanvas=null),this.player.debugLog("CanvasVideoLoader","destroy")}_initCanvasRender(){this.player._opt.useWCS&&!this._supportOffscreen()?(this.renderType=ti,this.player._opt.useWebGPU?Ha(this.$videoElement).then((e=>{this.player.isDestroyedOrClosed()||(e?(this.webGPURender=new Fa(e),this.isWcsWebgpu=!0,this.player.debugLog(this.TAG_NAME,"webGPURender init success")):(this.player.debugWarn(this.TAG_NAME,"webGPURender init failed because context is null and next use webgl render"),this._initWebglRenderForWCS()))})).catch((()=>{this.player.isDestroyedOrClosed()||(this.player.debugWarn(this.TAG_NAME,`createWebGPUContext error is ${e} and next use webgl render`),this._initWebglRenderForWCS())})):this._initWebglRenderForWCS()):this.player._opt.useMSE&&this.player._opt.mseUseCanvasRender?(this.renderType=ai,this._initContext2D()):this.player.isOldHls()&&this.player._opt.useCanvasRender?(this.renderType=ni,this._initContext2D()):this.player.isWebrtcH264()&&this.player._opt.webrtcUseCanvasRender?(this.renderType=li,this._initContext2D()):this._supportOffscreen()?(this.renderType=oi,this._bindOffscreen()):this.player._opt.useWebGPU?(this.renderType=ri,this._initContextGPU()):(this.renderType=ii,this._initContextGl())}_initWebglRenderForWCS(){this.player._opt.wcsUseWebgl2Render&&ya()?(this._initContextGl2(),this.webglRender&&(this.isWcsWebgl2=!0)):this._initContext2D()}_supportOffscreen(){return"function"==typeof this.$videoElement.transferControlToOffscreen&&this.player._opt.useOffscreen}_bindOffscreen(){this.bitmaprenderer=this.$videoElement.getContext("bitmaprenderer")}render(e){this.yuvList.push(e),this.startRender()}startRender(){for(;!(this.yuvList.length<=0);){const e=this.yuvList.shift();this.doRender(e)}}doRender(e){if(this.renderType!==ai){const t={ts:e.ts||0,fps:!0};this.player.updateStats(t)}switch(this.renderType){case oi:this.bitmaprenderer.transferFromImageBitmap(e.buffer);break;case ii:case ri:if(this.isWebglContextLost)return void this.player.debugWarn("CanvasVideoLoader","doRender() and webgl context is lost");let t=e.output;if(this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector){null===this.prevAiFaceDetectTime&&(this.prevAiFaceDetectTime=eo());const i=eo();i-this.prevAiFaceDetectTime>=this.player._opt.aiFaceDetectInterval&&(t=this.player.ai.faceDetector.detect({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output,ts:e.ts||0}),this.prevAiFaceDetectTime=i)}if(this.player.objectDetectActive&&this.player.ai&&this.player.ai.objectDetector){null===this.prevAiObjectDetectTime&&(this.prevAiObjectDetectTime=eo());const i=eo();i-this.prevAiObjectDetectTime>=this.player._opt.aiObjectDetectInterval&&(t=this.player.ai.objectDetector.detect({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output,ts:e.ts||0}),this.prevAiObjectDetectTime=i)}if(this.player.occlusionDetectActive&&this.player.ai&&this.player.ai.occlusionDetector){null===this.prevAiOcclusionDetectTime&&(this.prevAiOcclusionDetectTime=eo());const t=eo();if(t-this.prevAiOcclusionDetectTime>=this.player._opt.aiOcclusionDetectInterval){const i=this.player.ai.occlusionDetector.check({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output});this.prevAiOcclusionDetectTime=t,i&&this.player.emit(ot.aiOcclusionDetectResult,{ts:e.ts||0})}}if(this.player.imageDetectActive&&this.player.ai&&this.player.ai.imageDetector){const t=this.player.ai.imageDetector.check({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output});if(t&&t.data&&(this.player.emit(ot.aiImageDetectResult,{type:t.type,ts:e.ts||0}),this.player._opt.aiImageDetectDrop))return void this.player.debugLog("CanvasVideoLoader",`doRender() and ai image detect result type is ${t.type} and drop`)}if(this.renderType===ri)try{if(!this.webGPURender)return void this.player.debugWarn("CanvasVideoLoader","doRender webgpu render is not init");this.webGPURender.renderYUV(this.$videoElement.width,this.$videoElement.height,t)}catch(e){this.player.debugError("CanvasVideoLoader",`doRender webgpu render and error: ${e.toString()}`)}else if(this.renderType===ii)try{this.webglRender.renderYUV(this.$videoElement.width,this.$videoElement.height,t)}catch(e){this.player.debugError("CanvasVideoLoader",`doRender webgl render context is lost ${this.contextGl&&this.contextGl.isContextLost()} and error: ${e.toString()}`)}break;case ti:if(this.webGPURender)this.webGPURender.render(e.videoFrame),ea(e.videoFrame);else if(this.webglRender)this.webglRender.render(e.videoFrame),ea(e.videoFrame);else if(this.context2D)if(Ko(e.videoFrame.createImageBitmap))try{e.videoFrame.createImageBitmap().then((t=>{this.context2D.drawImage(t,0,0,this.$videoElement.width,this.$videoElement.height),ea(e.videoFrame)}))}catch(e){}else this.context2D.drawImage(e.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height),ea(e.videoFrame);else this.player.debugWarn("CanvasVideoLoader","doRender() and webcodecs context is lost");break;case ai:case ni:case li:this.context2D.drawImage(e.$video,0,0,this.$videoElement.width,this.$videoElement.height)}let t=e.ts||0;this.renderType===ai&&(t=parseInt(1e3*e.$video.currentTime,10)+(this.player.mseDecoder.firstRenderTime||0)),this.player.updateCurrentPts(t),this.doAddContentToWatermark(),this.doAddAiContentToWatermark()}clearView(){switch(super.clearView(),this.renderType){case oi:(function(e,t){const i=document.createElement("canvas");i.width=e,i.height=t;const s=window.createImageBitmap(i,0,0,e,t);return i.width=0,i.height=0,s})(this.$videoElement.width,this.$videoElement.height).then((e=>{this.bitmaprenderer.transferFromImageBitmap(e)}));break;case ii:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case ri:this.webGPURender.clear();break;case ti:this.webGPURender?this.webGPURender.clear():this.contextGl?this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT):this.context2D&&this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height);break;case ai:case ni:case li:this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height)}}_initTempTextCanvas(){this.tempTextCanvas=document.createElement("canvas"),this.tempTextCanvasCtx=this.tempTextCanvas.getContext("2d"),this.tempTextCanvas.width=600,this.tempTextCanvas.height=20}doAddContentToCanvas(){this.tempContentList.length>0&&this.context2D&&function(e){let{ctx:t,list:i}=e;t.save(),(i||[]).forEach((e=>{"text"===e.type?(t.font=`${e.fontSize||12}px Arial`,t.fillStyle=e.color||"green",t.fillText(e.text,e.x,e.y)):"rect"===e.type&&(t.strokeStyle=e.color||"green",t.lineWidth=e.lineWidth||2,t.strokeRect(e.x,e.y,e.width,e.height))})),t.restore()}({ctx:this.context2D,list:this.tempContentList})}doAddContentToWebGlCanvas(){this.tempContentList.length>0&&this.contextGl&&this.webglRectRender&&this.tempContentList.forEach((e=>{const t=e.x,i=e.y;if("rect"===e.type){const r=e.width,o=e.height,a=(s=e.color||"#008000",[parseInt(s.substring(1,3),16)/255,parseInt(s.substring(3,5),16)/255,parseInt(s.substring(5,7),16)/255,1]),n=e.lineWidth||4;if(!r||!o)return;this.webglRectRender.drawBox({x:t,y:i,width:r,height:o,lineColor:a,lineWidth:n,canvasWidth:this.$videoElement.width,canvasHeight:this.$videoElement.height})}else if("text"===e.type){const s=e.text||"";if(!s)return;const r=e.fontSize||20,o=e.color||"#008000";this.tempTextCanvas||this._initTempTextCanvas(),this.tempTextCanvasCtx.clearRect(0,0,this.tempTextCanvas.width,this.tempTextCanvas.height),this.tempTextCanvasCtx.font=`${r}px Arial`,this.tempTextCanvasCtx.fillStyle=o,this.tempTextCanvasCtx.textBaseline="top",this.tempTextCanvasCtx.fillText(s,0,0),this.webglRender.drawDom(this.$videoElement.width,this.$videoElement.height,t,i,this.tempTextCanvas)}var s}))}}class Ka extends Oa{constructor(e){super(),this.player=e,this.TAG_NAME="Video";const t=document.createElement("video");t.muted=!0,t.disablePictureInPicture=!0,co()&&(t.poster="noposter"),t.style.position="absolute",t.style.top=0,t.style.left=0,this._delayPlay=!1,e.$container.appendChild(t),this.$videoElement=t,this.$canvasElement=null,this.canvasContext=null,this.mediaStream=null,this.vwriter=null,this.awriter=null,this.trackGenerator=null,this.audioTrackGenerator=null,this.fixChromeVideoFlashBug(),this.fixMobileAutoFullscreen(),this.resize(),this.eventListenList=[],this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes=0,this.isRetryPlaying=!1,this.isRetryPlayingTimes=0,this.canplayReceived=!1,this.progressProxyDestroy=null,this.checkVideoCanplayTimeout=null,this.visibilityChangePlayTimeout=null,this.pauseDelayTimeout=null,this.replayTimeout=null,this.detectAndFixStuckPlaybackStartTime=null;const i=ba();this.supportVideoFrameCallbackHandle=null;const{proxy:s}=this.player.events,r=s(this.$videoElement,"canplay",(()=>{this.player.debugLog("Video","canplay"),this.player.isDestroyedOrClosed()||(this.canplayReceived=!0,this._delayPlay?(this.clearCheckVideoCanplayTimeout(),this._play(),ba()?this.supportVideoFrameCallbackHandle||(this.player.debugLog("Video","support requestVideoFrameCallback and use videoFrameCallback"),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))):this.player.debugWarn("Video","not support requestVideoFrameCallback and use timeupdate event to update stats")):this.$videoElement.paused&&(this.player.isMSEPlaybackRateChangePause?(this.player.debugLog("Video",`canplay and video is paused and isMSEPlaybackRateChangePause is ${this.player.isMSEPlaybackRateChangePause} so next try to play`),this.player.isMSEPlaybackRateChangePause=!1,this._play()):this.player.isMSECurrentMoreThanBufferedPause?(this.player.debugLog("Video",`canplay and video is paused and isMSECurrentMoreThanBufferedPause is ${this.player.isMSECurrentMoreThanBufferedPause} so next try to play`),this.player.isMSECurrentMoreThanBufferedPause=!1,this._play()):(this.player.debugWarn("Video","canplay and video is paused and try to play"),this._play())))})),o=s(this.$videoElement,"waiting",(()=>{this.player.debugLog("Video","waiting")})),a=s(this.$videoElement,"loadedmetadata",(()=>{this.player.debugLog("Video","loadedmetadata")})),n=s(this.$videoElement,"timeupdate",(t=>{if(!this.player.isDestroyedOrClosed()){if(pa(i)){const t=parseInt(1e3*this.getCurrentTime(),10);if(e.isWebrtcH264()||this.player.isOldHls()||this.player.isAliyunRtc())this.player.emit(ot.timeUpdate,t),e.handleRender(),e.updateStats({fps:!0,ts:t,dts:t}),this.player.updateCurrentPts(t);else if(ua(this.player._opt.useMSE)&&pa(this.player._opt.mseUseCanvasRender))if(this.player.mseDecoder){let e=parseInt(1e3*this.getCurrentTime(),10)+(this.player.mseDecoder.firstRenderTime||0);this.player.updateCurrentPts(e)}else if(this.player._opt.mseDecoderUseWorker){let e=parseInt(1e3*this.getCurrentTime(),10)+(this.player._mseWorkerData.firstRenderTime||0);this.player.updateCurrentPts(e)}this.doAddContentToWatermark()}this.player.isMseDecoderUseWorker()&&(this.player.decoderWorker.updateVideoTimestamp(this.getCurrentTime()),this._handleUpdatePlaybackRate())}})),l=s(this.$videoElement,"error",(e=>{if(!this.$videoElement.error)return void this.player.debugError(this.TAG_NAME,"on error",e);let t={};if(this.player.isUseMSE()&&(t=this.player.getMseMineType()),this.player.debugError("Video","Error Code "+this.$videoElement.error.code+" "+Ys[this.$videoElement.error.code]+"; Details: "+this.$videoElement.error.message+"; Video Info: "+JSON.stringify(this.videoInfo)+"; Mse Mine Type: "+t.video+"; "),this.player.isUseMSE()){this.$videoElement.error.code;const e=this.$videoElement.error.message;-1!==e.indexOf(Qs)&&(this.player.isMSEVideoDecoderInitializationFailedNotSupportHevc=!0),-1!==e.indexOf(Xs)&&(this.player.isMSEAudioDecoderError=!0)}this.player.isHlsCanVideoPlay()})),d=s(this.$videoElement,"stalled",(()=>{this._detectAndFixStuckPlayback(!0)}));if(this.progressProxyDestroy=s(this.$videoElement,"progress",(()=>{this._detectAndFixStuckPlayback()})),this.eventListenList.push(r,o,n,l,a,d),this.player.isUseMSE()){const e=s(this.$videoElement,es,(()=>{this.player.debugLog(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate),this.$videoElement&&this.$videoElement.paused&&(this.player.debugWarn(this.TAG_NAME,"ratechange and video is paused and sent isMSEPlaybackRateChangePause true"),this.player.isMSEPlaybackRateChangePause=!0)}));this.eventListenList.push(e),this.player.on(ot.visibilityChange,(e=>{e&&(this.visibilityChangePlayTimeout=setTimeout((()=>{if(this.clearVisibilityChangePlayTimeout(),this.player.isPlaying()&&this.$videoElement){const e=this.getVideoBufferLastTime();e-this.$videoElement.currentTime>this.getBufferMaxDelayTime()&&(this.player.debugLog(this.TAG_NAME,`visibilityChange is true and lastTime is ${e} and currentTime is ${this.$videoElement.currentTime} so set currentTime to lastTime`),this.$videoElement.currentTime=e)}}),300))}))}this.player.debugLog("Video","init")}async destroy(){if(super.destroy(),this.clearCheckVideoCanplayTimeout(),this.clearReplayTimeout(),this.clearVisibilityChangePlayTimeout(),this.clearPauseDelayTimeout(),this._cancelVideoFrameCallback(),this._removeProgressProxyDestroy(),this.eventListenList.length&&(this.eventListenList.forEach((e=>{e()})),this.eventListenList=[]),this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes=0,this.isRetryPlaying=!1,this.isRetryPlayingTimes=0,this.canplayReceived=!1,this.player._opt.videoRenderSupportScale&&this._isNeedAddBackDropFilter()){const e=this.player.$container;e.style.backdropFilter="none",e.style.transform="none"}if(this.$canvasElement&&(this.$canvasElement.height=0,this.$canvasElement.width=0,this.$canvasElement=null),this.canvasContext=null,this.$videoElement){this.$videoElement.pause&&(this.$videoElement.pause(),this.$videoElement.muted=!0),this.$videoElement.currentTime=0,this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")),this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"));try{this.$videoElement.load()}catch(e){}this.player.$container.removeChild(this.$videoElement),this.$videoElement=null}this.trackGenerator&&(this.trackGenerator.stop(),this.trackGenerator=null),this.audioTrackGenerator&&(this.audioTrackGenerator.stop(),this.audioTrackGenerator=null),this.vwriter&&(await this.vwriter.close(),this.vwriter=null),this.awriter&&(await this.awriter.close(),this.awriter=null),this._delayPlay=!1,this.mediaStream&&(this.mediaStream.getTracks().forEach((e=>e.stop())),this.mediaStream=null),this.off(),this.player.debugLog("Video","destroy")}_createScreenShotCanvas(){const e=document.createElement("canvas");this.$canvasElement=e,this.canvasContext=e.getContext("2d"),this.canvasContext.imageSmoothingEnabled=!0,this.canvasContext.imageSmoothingEnabled&&(this.canvasContext.imageSmoothingQuality="high")}bindMediaStream(){if(this.player.canVideoTrackWritter()&&To()&&ko()&&!this.mediaStream){this.player.debugLog(this.TAG_NAME,"bindMediaStream"),this.trackGenerator=new MediaStreamTrackGenerator({kind:"video"}),this.player.useVideoPlayAudio()&&(this.audioTrackGenerator=new MediaStreamTrackGenerator({kind:"audio"}),this.awriter=this.audioTrackGenerator.writable.getWriter());const e=[this.trackGenerator];this.audioTrackGenerator&&e.push(this.audioTrackGenerator),this.mediaStream=new MediaStream(e),this.$videoElement.srcObject=this.mediaStream,this.vwriter=this.trackGenerator.writable.getWriter()}}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())return void this.player.debugLog("Video","videoFrameCallback() and isDestroyedOrClosed and return");this.player.handleRender();const i=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)||0;if(this.player.isUseHls265UseMse())this.player.updateStats({fps:!0,ts:i});else if(this.player.isMseDecoderUseWorker()){this.player._times.videoStart||(this.player._times.videoStart=eo(),this.player.handlePlayToRenderTimes());const e=i+(this.player._mseWorkerData.firstRenderTime||0);if(this.player.updateStats({fps:!0,dfps:!0,ts:e,mseTs:i}),this.player.emit(ot.timeUpdate,e),pa(this.getHasInit())&&t.width&&t.height){const e={width:t.width,height:t.height};this.updateVideoInfo(e),this.initCanvasViewSize()}}if(this.player.isWebrtcH264()||this.player.isOldHls()||this.player.isAliyunRtc()){if(this.player.emit(ot.timeUpdate,i),pa(this.getHasInit())&&t.width&&t.height){const e={width:t.width,height:t.height};this.videoInfo.encTypeCode||this.player.isOldHls()||(e.encTypeCode=yt),this.updateVideoInfo(e)}this.player.updateStats({fps:!0,ts:i,dts:i}),this.player.updateCurrentPts(i),this.doAddContentToWatermark()}else if(ua(this.player._opt.useMSE)&&pa(this.player._opt.mseUseCanvasRender)){if(this.player.mseDecoder){let e=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)+(this.player.mseDecoder.firstRenderTime||0);this.player.updateCurrentPts(e)}else if(this.player._opt.mseDecoderUseWorker){let e=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)+(this.player._mseWorkerData.firstRenderTime||0);this.player.updateCurrentPts(e)}this.doAddContentToWatermark()}this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}fixChromeVideoFlashBug(){if(this.player._opt.videoRenderSupportScale&&this._isNeedAddBackDropFilter()){const e=this.player.$container;e.style.backdropFilter="blur(0px)",e.style.transform="translateZ(0)"}}fixMobileAutoFullscreen(){const e=fo(),t=co();(e||t)&&(this.player.debugLog("Video",`fixMobileAutoFullscreen and isIOS ${e} and isAndroid ${t}`),this.$videoElement.setAttribute("webkit-playsinline","true"),this.$videoElement.setAttribute("playsinline","true"),this.$videoElement.setAttribute("x5-video-player-type","h5-page"))}_detectAndFixStuckPlayback(e){const t=this.$videoElement,i=t.buffered,s=t.readyState;if(this.player.debugLog(this.TAG_NAME,`_detectAndFixStuckPlayback() and isStalled is ${e} ,canplayReceived is ${this.canplayReceived} ,videoReadyState is ${s} and bufferedLength is ${i.length} and startTime is ${i.length>0?i.start(0):"null"} and currentTime is ${t.currentTime}`),e||pa(this.canplayReceived)||s<2){if(i.length>0&&t.currentTime=1e3*this.player._opt.mseWaitVideoCanplayTimeout&&(this.player.debugWarn(this.TAG_NAME,`_detectAndFixStuckPlayback() and video is stuck and currentTime is ${t.currentTime} , diff is ${e} and timeout`),this.player.emit(lt.mseWaitVideoCanplayTimeout,e))}}else this._removeProgressProxyDestroy()}_removeProgressProxyDestroy(){this.progressProxyDestroy&&(this.player.debugLog(this.TAG_NAME,"_removeProgressProxyDestroy()"),this.progressProxyDestroy(),this.progressProxyDestroy=null),this.detectAndFixStuckPlaybackStartTime=null}_isNeedAddBackDropFilter(){const e=po().type.toLowerCase();return"chrome"===e||"edge"===e}isPaused(){let e=!0;return this.$videoElement&&(e=this.$videoElement.paused),e}isPause(){return this.isPaused()}_getVideoReadyState(){let e=0;return this.$videoElement&&(e=this.$videoElement.readyState),e}_getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}play(){if(this.$videoElement){const e=this._getVideoReadyState();if(this.player.debugLog("Video",`play and readyState: ${e}`),0===e)return this.player.debugLog("Video","readyState is 0 and set _delayPlay to true and listen canplay event to play"),this._delayPlay=!0,void(null===this.checkVideoCanplayTimeout&&(this.checkVideoCanplayTimeout=setTimeout((()=>{if(this.clearCheckVideoCanplayTimeout(),!this.player.isDestroyedOrClosed()&&pa(this.isPlaying())){const e=this._getBufferStore();this.player.debugWarn("Video",`checkVideoCanplayTimeout and video is not playing and buffer store is ${e} and retry play`),this.$videoElement.currentTime=e,this._replay()}}),1e3)));this._play()}}_play(){this.$videoElement&&this.$videoElement.play().then((()=>{this._delayPlay=!1,this.player.debugLog("Video","_play success"),this.isPlaying()?(this.player.emit(ot.removeLoadingBgImage),this.isRetryPlayingTimes=0,this.isRetryPlaying=!1):this.replayTimeout=setTimeout((()=>{this.clearReplayTimeout(),this._replay()}),100)})).catch((e=>{this.player.isDestroyedOrClosed()?this.player.debugLog("Video","_play error and player is isDestroyedOrClosed and return"):(this.player.debugLog("Video",`_play error and\n e.name is ${e.name},\n e.message is ${e.message},\n e.toString() is ${e.toString()}`),this.player.debugError("Video","_play error",e),this.isRetryPlaying=!1,this.replayTimeout=setTimeout((()=>{this.clearReplayTimeout(),this._replay()}),100))}))}_replay(){if(!this.isPlaying()&&pa(this.player.isDestroyedOrClosed())&&pa(this.isRetryPlaying)){if(this.isRetryPlaying=!0,this.isRetryPlayingTimes>=3){let e="";return void(this.player.isWebrtcH264()?(e=`_replay(webrtc H264) then but not playing and retry play times is ${this.isRetryPlayingTimes} and emit error`,this.player.debugError("Video",e),this.player.emitError(lt.videoElementPlayingFailedForWebrtc,e)):(e=`_replay then but not playing and retry play times is ${this.isRetryPlayingTimes} and emit error to use canvas render`,this.player.debugError("Video",e),this.player.emitError(lt.videoElementPlayingFailed,e)))}this.player.debugWarn("Video",`_play then but not playing and retry play and isRetryPlayingTimes is ${this.isRetryPlayingTimes}`),this._play(),this.isRetryPlayingTimes++}else this.player.debugLog("Video",`_replay() and isPlaying is ${this.isPlaying()} and isRetryPlaying is ${this.isRetryPlaying} and isDestroyedOrClosed is ${this.player.isDestroyedOrClosed()} and return;`)}pause(e){this.player.debugLog(this.TAG_NAME,"pause and isNow is "+e),this.isPlaying()&&(e?(this.$videoElement&&this.$videoElement.pause(),this._cancelVideoFrameCallback()):this.pauseDelayTimeout=setTimeout((()=>{this.clearPauseDelayTimeout(),this.$videoElement&&this.$videoElement.pause(),this._cancelVideoFrameCallback()}),100))}clearView(){super.clearView(),this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")))}screenshot(e,t,i,s){if(!this._canScreenshot())return this.player.debugWarn("Video",`screenshot failed, video is not ready and stats is ${this._getVideoReadyState()}`),null;e=e||eo(),s=s||pt.download;let r=.92;!Vi[t]&&pt[t]&&(s=t,t="png",i=void 0),"string"==typeof i&&(s=i,i=void 0),void 0!==i&&(r=Number(i));const o=this.$videoElement;this.$canvasElement||this._createScreenShotCanvas();let a=this.$canvasElement;a.width=o.videoWidth,a.height=o.videoHeight,this.canvasContext.drawImage(o,0,0,a.width,a.height);const n=Vi[t]||Vi.png,l=a.toDataURL(n,r);if(this.canvasContext.clearRect(0,0,a.width,a.height),a.width=0,a.height=0,s===pt.base64)return l;{const t=Zr(l);if(s===pt.blob)return t;if(s===pt.download){const i=n.split("/")[1];Va(t,e+"."+i)}}}screenshotWatermark(e){return new Promise(((t,i)=>{if(Vo(e)&&(e={filename:e}),!this._canScreenshot())return this.player.debugWarn("Video","screenshot failed, video is not ready"),i("screenshot failed, video is not ready");const s=this.$videoElement;(e=e||{}).width=s.videoWidth,e.height=s.videoHeight,e.filename=e.filename||eo(),e.format=e.format?Vi[e.format]:Vi.png,e.quality=Number(e.quality)||.92,e.type=e.type||pt.download,this.$canvasElement||this._createScreenShotCanvas();let r=this.$canvasElement;r.width=s.videoWidth,r.height=s.videoHeight,this.canvasContext.drawImage(s,0,0,r.width,r.height);const o=r.toDataURL(e.format,e.quality);this.canvasContext.clearRect(0,0,r.width,r.height),r.width=0,r.height=0,Bo(o,e).then((i=>{if(e.type===pt.base64)t(o);else{const s=Zr(i);if(e.type===pt.blob)t(s);else if(e.type===pt.download){t();const i=e.format.split("/")[1];Va(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}))}screenshotCopyrightWatermark(e){return new Promise(((t,i)=>{if(Vo(e)&&(e={filename:e}),!this._canScreenshot())return this.player.debugWarn("Video","screenshot failed, video is not ready"),i("screenshot failed, video is not ready");const s=this.$videoElement;(e=e||{}).width=s.videoWidth,e.height=s.videoHeight,e.filename=e.filename||eo(),e.format=e.format?Vi[e.format]:Vi.png,e.quality=Number(e.quality)||.92,e.type=e.type||pt.download,this.$canvasElement||this._createScreenShotCanvas();let r=this.$canvasElement;r.width=s.videoWidth,r.height=s.videoHeight,this.canvasContext.drawImage(s,0,0,r.width,r.height);const o=r.toDataURL(e.format,e.quality);this.canvasContext.clearRect(0,0,r.width,r.height),r.width=0,r.height=0,Mo(o,e).then((i=>{if(e.type===pt.base64)t(o);else{const s=Zr(i);if(e.type===pt.blob)t(s);else if(e.type===pt.download){t();const i=e.format.split("/")[1];Va(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}))}screenshotByCurrentWatermark(e){}initCanvasViewSize(){this.resize()}clear(){const e=this.$videoElement,t=e.buffered,i=t.length?t.end(t.length-1):0;e.currentTime=i}render(e){if(this.vwriter){if(this.$videoElement.srcObject||(this.$videoElement.srcObject=this.mediaStream),this.isPaused()){const e=this._getVideoReadyState();if(this.player.debugWarn("Video","render() error, video is paused and readyState is "+e),4===e&&pa(this.isRenderRetryPlaying)){if(this.isRenderRetryPlaying=!0,this.isRenderRetryPlayingTimes>3){const t="render() error, video is paused and readyState is "+e+", retry times is "+this.isRenderRetryPlayingTimes+", emit error and use canvas render";return this.player.debugError("Video",t),void this.player.emitError(lt.videoElementPlayingFailed,t)}this.$videoElement.play().then((()=>{this.isRenderRetryPlayingTimes=0,this.isRenderRetryPlaying=!1,this.player.debugLog("Video","render() video is paused and replay success")})).catch((e=>{this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes++,this.player.debugLog("Video",`_play error render() error, video is paused and replay error and\n e.name is ${e.name},\n e.message is ${e.message},\n e.toString() is ${e.toString()}`),this.player.debugError("Video","render() error, video is paused and replay error ",e)}))}}if(this.player.updateStats({fps:!0,ts:e.ts||0}),e.videoFrame)this.vwriter.write(e.videoFrame),ea(e.videoFrame);else if(e.output){let s=e.output;if(this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector){null===this.prevAiFaceDetectTime&&(this.prevAiFaceDetectTime=eo());const t=eo();t-this.prevAiFaceDetectTime>this.player._opt.aiFaceDetectInterval&&(s=this.player.ai.faceDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0}),this.prevAiFaceDetectTime=t)}if(this.player.objectDetectActive&&this.player.ai&&this.player.ai.objectDetector){null===this.prevAiObjectDetectTime&&(this.prevAiObjectDetectTime=eo());const t=eo();t-this.prevAiObjectDetectTime>this.player._opt.aiObjectDetectInterval&&(s=this.player.ai.objectDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0}),this.prevAiObjectDetectTime=t)}if(this.player.occlusionDetectActive&&this.player.ai&&this.player.ai.occlusionDetector){null===this.prevAiOcclusionDetectTime&&(this.prevAiOcclusionDetectTime=eo());const t=eo();if(t-this.prevAiOcclusionDetectTime>=this.player._opt.aiOcclusionDetectInterval){const i=this.player.ai.occlusionDetector.check({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0});this.prevAiOcclusionDetectTime=t,i&&(this.player.debugLog("Video","render() and ai occlusion detect result is true"),this.player.emit(ot.aiOcclusionDetectResult,{ts:e.ts||0}))}}if(this.player.imageDetectActive&&this.player.ai&&this.player.ai.imageDetector){const t=this.player.ai.imageDetector.check({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0});if(t&&t.data&&(this.player.emit(ot.aiImageDetectResult,{type:t.type,ts:e.ts||0}),this.player._opt.aiImageDetectDrop))return void this.player.debugLog("Video",`render() and ai image detect result type is ${t.type} and drop`)}try{const r=(t=s,i={format:"I420",codedWidth:this.videoInfo.width,codedHeight:this.videoInfo.height,timestamp:1e3*e.ts},new VideoFrame(t,i));this.vwriter.write(r),ea(r)}catch(e){this.player.debugError("Video","render error",e),this.player.emitError(lt.wasmUseVideoRenderError,`code is ${e.code} and message is ${e.message}`)}}this.player.updateCurrentPts(e.ts||0),this.doAddContentToWatermark(),this.doAddAiContentToWatermark()}else this.player.debugWarn("Video","render and this.vwriter is null");var t,i}_resize(){this.player.debugLog("Video","_resize()");let e=this.player.width,t=this.player.height;const i=this.player._opt,s=i.rotate;if(this.player.isControlBarShow()){const s=i.playType===_?Qt:Yt;lo()&&this.player.fullscreen&&i.useWebFullScreen?e-=s:t-=s}this.$videoElement.width=e,this.$videoElement.height=t,this.$videoElement.style.width=e+"px",this.$videoElement.style.height=t+"px",270!==s&&90!==s||(this.$videoElement.width=t,this.$videoElement.height=e,this.$videoElement.style.width=t+"px",this.$videoElement.style.height=e+"px");let r=(e-this.$videoElement.width)/2,o=(t-this.$videoElement.height)/2,a="contain";pa(i.isResize)&&(a="fill"),i.isFullResize&&(a="none");let n="";"none"===i.mirrorRotate&&s&&(n+=" rotate("+s+"deg)"),"level"===i.mirrorRotate?n+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(n+=" rotateX(180deg)"),this.player._opt.videoRenderSupportScale&&(this.$videoElement.style.objectFit=a),this.$videoElement.style.transform=n,this.$videoElement.style.padding="0",this.$videoElement.style.left=r+"px",this.$videoElement.style.top=o+"px"}getType(){return $}getCurrentTime(){return this.$videoElement.currentTime}isPlaying(){return this.$videoElement&&pa(this.$videoElement.paused)&&pa(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}isVideoPlaying(){return this.isPlaying()}_canScreenshot(){return this.$videoElement&&this.$videoElement.readyState>=1}getPlaybackQuality(){let e=null;if(this.$videoElement){if(Ko(this.$videoElement.getVideoPlaybackQuality)){const t=this.$videoElement.getVideoPlaybackQuality();e={droppedVideoFrames:t.droppedVideoFrames||t.corruptedVideoFrames,totalVideoFrames:t.totalVideoFrames,creationTime:t.creationTime}}else e={droppedVideoFrames:this.$videoElement.webkitDroppedFrameCount,totalVideoFrames:this.$videoElement.webkitDecodedFrameCount,creationTime:eo()};e&&(e.renderedVideoFrames=e.totalVideoFrames-e.droppedVideoFrames)}return e}setRate(e){this.$videoElement&&(this.$videoElement.playbackRate=e)}get rate(){let e=1;return this.$videoElement&&(e=this.$videoElement.playbackRate),e}clearCheckVideoCanplayTimeout(){this.checkVideoCanplayTimeout&&(clearTimeout(this.checkVideoCanplayTimeout),this.checkVideoCanplayTimeout=null)}clearReplayTimeout(){this.replayTimeout&&(clearTimeout(this.replayTimeout),this.replayTimeout=null)}clearVisibilityChangePlayTimeout(){this.visibilityChangePlayTimeout&&(clearTimeout(this.visibilityChangePlayTimeout),this.visibilityChangePlayTimeout=null)}clearPauseDelayTimeout(){this.pauseDelayTimeout&&(clearTimeout(this.pauseDelayTimeout),this.pauseDelayTimeout=null)}_cancelVideoFrameCallback(){this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null)}_getBufferStore(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.buffered.start(0)),t}_handleUpdatePlaybackRate(){const e=this.$videoElement,t=e.buffered;t.length&&t.start(0);const i=t.length?t.end(t.length-1):0;let s=e.currentTime;const r=i-s,o=this.getBufferMaxDelayTime();if(this.player.updateStats({mseVideoBufferDelayTime:r}),r>o)this.player.debugLog(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current is ${s} , delay buffer is more than ${o} is ${r} and new time is ${i}`),e.currentTime=i,s=e.currentTime;else if(r<0&&0===i)return this.player.debugWarn(this.TAG_NAME,`handleUpdatePlaybackRate and delay buffer is ${i} - current is ${s} = ${r} < 0 and check video is paused : ${e.paused} `),void this.player.emit(lt.mediaSourceBufferedIsZeroError,"video.buffered is empty");if(s>1){const t=this._getPlaybackRate(i-s);e.playbackRate!==t&&(this.player.debugLog(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current time is ${s} and delay is ${i-s} set playbackRate is ${t} `),e.playbackRate=t)}}_getPlaybackRate(e){const t=this.$videoElement;let i=this.player._opt.videoBufferDelay+this.player._opt.videoBuffer;const s=Math.max(i,1e3),r=s/2;return e*=1e3,1===t.playbackRate?e>s?1.2:1:e<=r?1:t.playbackRate}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}getVideoBufferLastTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;i.length&&i.start(0);t=i.length?i.end(i.length-1):0}return t}getVideoBufferDelayTime(){const e=this.$videoElement;const t=this.getVideoBufferLastTime()-e.currentTime;return t>0?t:0}checkSourceBufferDelay(){const e=this.$videoElement;let t=0,i=0;return e.buffered.length>0&&(i=e.buffered.end(e.buffered.length-1),t=i-e.currentTime),t<0&&(this.player.debugWarn(this.TAG_NAME,`checkVideoSourceBufferDelay ${t} < 0, and buffered is ${i} ,currentTime is ${e.currentTime} , try to seek ${e.currentTime} to ${i}`),e.currentTime=i,e.paused&&(this.player.debugWarn(this.TAG_NAME,"checkSourceBufferDelay and video is paused and sent isMSECurrentMoreThanBufferedPause true"),this.player.isMSECurrentMoreThanBufferedPause=!0),t=0),t}checkSourceBufferStore(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.currentTime-e.buffered.start(0)),t}getVideoBufferTimeRange(){const e=this.$videoElement;let t=null;if(e){const i=e.buffered,s=i.length?i.start(0):0,r=i.length?i.end(i.length-1):0;t={start:s,end:r,diff:r-s}}return t}getDecodePlaybackRate(){let e=0;const t=this.$videoElement;return t&&(e=t.playbackRate),e}getBufferMaxDelayTime(){let e=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3;return Math.max(5,e+3)}getReadyStateInited(){return this._getVideoReadyState()>=1}}class Ya extends Ja{constructor(e){super(e),this.controlHeight=Qt,this.bufferList=[],this.playing=!1,this.playInterval=null,this.fps=1,this.preFps=1,this.streamFps=0,this.playbackRate=1,this._firstTimestamp=null,this._renderFps=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._hasCalcFps=!1,this.player.on(ot.playbackPause,(e=>{e?(this.pause(),this.player.playback.isPlaybackPauseClearCache&&this.clear()):this.resume()})),this.player.debugLog("CanvasPlaybackLoader","init")}async destroy(){this._stopSync(),this.clear(),this._firstTimestamp=null,this.playing=!1,this.playbackRate=1,this.fps=1,this.preFps=1,this._renderFps=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._hasCalcFps=!1,super.destroy(),this.player.debugLog("CanvasPlaybackLoader","destroy")}_initCanvasRender(){this.player._opt.useWCS?(this.renderType=ti,ya()&&this.player._opt.wcsUseWebgl2Render?(this._initContextGl2(),this.webglRender&&(this.isWcsWebgl2=!0)):this._initContext2D()):this.player._opt.useWebGPU?(this.renderType=ri,this._initContextGPU()):(this.renderType=ii,this._initContextGl())}_sync(){this._stopSync(),this._doPlay(),this.playInterval=setInterval((()=>{this._doPlay()}),this.fragDuration)}_doPlay(){if(this.bufferList.length>0&&!this.player.seeking){const e=this.bufferList.shift();e&&e.buffer&&(this._doRender(e.buffer),this.player.handleRender(),this.player.playback.updateStats({ts:e.ts,tfTs:e.tfTs}))}}_stopSync(){this.playInterval&&(clearInterval(this.playInterval),this.playInterval=null)}_doRender(e){if(this.player._opt.useWCS)if(this.webglRender)this.webglRender.render(e),ea(e);else if(Ko(e.createImageBitmap))try{e.createImageBitmap().then((t=>{this.context2D.drawImage(t,0,0,this.$videoElement.width,this.$videoElement.height),ea(e)}))}catch(e){}else this.context2D.drawImage(e,0,0,this.$videoElement.width,this.$videoElement.height),ea(e);else if(this.getCanvasType()===ii)try{this.webglRender.renderYUV(this.$videoElement.width,this.$videoElement.height,e)}catch(e){this.player.debugError("CanvasPlaybackLoader",`doRender webgl render context is lost ${this.contextGl&&this.contextGl.isContextLost()} and error: ${e.toString()}`)}else if(this.getCanvasType()===ri)try{if(!this.webGPURender)return void this.player.debugWarn("CanvasVideoLoader","doRender webgpu render is not init");this.webGPURender.renderYUV(this.$videoElement.width,this.$videoElement.height,e)}catch(e){this.player.debugError("CanvasPlaybackLoader",`doRender webgpu render and error: ${e.toString()}`)}}get rate(){return this.playbackRate}get fragDuration(){return Math.ceil(1e3/(this.fps*this.playbackRate))}get bufferSize(){return this.bufferList.length}getStreamFps(){return this.streamFps}initFps(){this._hasCalcFps?this.player.debugLog("CanvasPlaybackLoader","initFps, has calc fps"):(this.preFps=to(this.player.playback.fps,1,100),this.fps=this.preFps)}setFps(e){e!==this.fps?(e>100&&this.player.debugWarn("CanvasPlaybackLoader","setFps max",e),e<0&&this.player.debugWarn("CanvasPlaybackLoader","setFps min",e),this.fps=to(e,1,100),this.player.debugLog("CanvasPlaybackLoader",`setFps ${this.preFps} -> ${this.fps}`),this.player.playback.isUseFpsRender&&this._sync()):this.player.debugLog("CanvasPlaybackLoader",`setFps, same fps ${e}`)}setStreamFps(e){this.player.debugLog("CanvasPlaybackLoader","setStreamFps",e),this._hasCalcFps=!0,this.streamFps=e,this.preFps=e,this.setFps(e)}setRate(e){e!==this.playbackRate&&(this.playbackRate=e,this.player.playback.isUseFpsRender&&this._sync())}render$2(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);const t={tfTs:e.ts-this._firstTimestamp,ts:e.ts};e.videoFrame?t.buffer=e.videoFrame:t.buffer=e.output,this.bufferList.push(t),this.startRender(),this.player.handleRender(),this.player.playback.updateStats({ts:e.ts,tfTs:t.tfTs})}startRender(){for(;!(this.bufferList.length<=0);){const e=this.bufferList.shift();this._doRender(e.buffer)}}pushData(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);const t={tfTs:e.ts-this._firstTimestamp,ts:e.ts};e.videoFrame?t.buffer=e.videoFrame:t.buffer=e.output;const i=this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender;if(i||this.bufferSize>this.fps*this.playbackRate*2&&(this.player.debugWarn("CanvasPlaybackLoader",`buffer size is ${this.bufferSize}`),this._doPlay()),this.bufferList.push(t),!this._hasCalcFps){const e=ra(this.bufferList);null!==e&&e!==this.preFps&&(this.player.debugLog("CanvasPlaybackLoader",`calc fps is ${e} pre fps is ${this.preFps} and updatePreFps`),this.setStreamFps(e))}if(!i){const e=this.bufferList.length,t=e/(this.fps*this.playbackRate);this.player.debugLog("CanvasPlaybackLoader","rate is",t),t<=1?this.setFps(this.preFps):(this.setFps(this.fps+Math.floor(t*this.playbackRate)),this.player.debugWarn("CanvasPlaybackLoader","rate is",t,"fps is",this.fps,"bufferListLength is",e))}}initVideo(){this.player.playback&&this.player.playback.isUseFpsRender&&this._sync(),this.playing=!0}initVideoDelay(){const e=this.player._opt.playbackDelayTime;e>0?this.delayTimeout=setTimeout((()=>{this.initVideo()}),e):this.initVideo()}clearView(){super.clearView(),this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT)}clear(){this.player._opt.useWCS&&this.bufferList.forEach((e=>{e.buffer&&ea(e.buffer)})),this.bufferList=[]}resume(){this.player.playback.isUseFpsRender&&this._sync(),this.playing=!0}pause(){this.player.playback.isUseFpsRender&&this._stopSync(),this.playing=!1}}class Qa{constructor(e){return new(Qa.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.useMSE?e.mseUseCanvasRender?qa:Ka:e.isHls&&pa(e.supportHls265)||e.isWebrtc&&pa(e.isWebrtcH265)?e.useCanvasRender?qa:Ka:e.isAliyunRtc?Ka:e.useWCS?e.playType===_?Ya:!e.useOffscreen&&e.wcsUseVideoRender?Ka:qa:e.playType===_?Ya:e.wasmUseVideoRender&&!e.useOffscreen?Ka:qa}}class Xa extends wa{constructor(e){super(),this.bufferList=[],this.player=e,this.$audio=null,this.scriptNode=null,this.workletProcessorNode=null,this.workletWorkerCloseTimeout=null,this.hasInitScriptNode=!1,this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:vr}),this.gainNode=this.audioContext.createGain();const t=this.audioContext.createBufferSource();t.buffer=this.audioContext.createBuffer(1,1,22050),t.connect(this.audioContext.destination),t.noteOn?t.noteOn(0):t.start(0),this.audioBufferSourceNode=t,this.mediaStreamAudioDestinationNode=this.audioContext.createMediaStreamDestination(),this.gainNode.gain.value=0,this._prevVolume=null,this.playing=!1,this.audioInfo={encTypeCode:"",encType:"",channels:"",sampleRate:"",depth:""},this.init=!1,this.hasAudio=!1,this.audioResumeStateTimeout=null,this.audioContextContextResumeLock=!1}async destroy(){return this.closeAudio(),this.resetInit(),this.clearAudioResumeStateTimeout(),this.audioContext&&(await this.audioContext.close(),this.audioContext=null),this.gainNode&&(this.gainNode.disconnect(),this.gainNode=null),this.hasAudio=!1,this.playing=!1,this.scriptNode&&(this.scriptNode.disconnect(),this.scriptNode.onaudioprocess=Yr,this.scriptNode=null),await this._destroyWorklet(),this.workletProcessorNode&&(this.workletProcessorNode.disconnect(),this.workletProcessorNode.port.onmessage=Yr,this.workletProcessorNode=null),this.audioBufferSourceNode&&(this.audioBufferSourceNode.stop(),this.audioBufferSourceNode=null),this.mediaStreamAudioDestinationNode&&(this.mediaStreamAudioDestinationNode.disconnect(),this.mediaStreamAudioDestinationNode=null),this.hasInitScriptNode=!1,this._prevVolume=null,this.audioContextContextResumeLock=!1,this.off(),!0}_destroyWorklet(){return new Promise(((e,t)=>{this.workletProcessorNode?(this.workletProcessorNode.port.postMessage({type:"destroy"}),this.workletWorkerCloseTimeout=setTimeout((()=>{this.player.debugLog(this.TAG_NAME,"send close and wait 10ms destroy directly"),this.workletWorkerCloseTimeout&&(clearTimeout(this.workletWorkerCloseTimeout),this.workletWorkerCloseTimeout=null),e()}),10)):e()}))}resetInit(){this.audioInfo={encTypeCode:"",encType:"",channels:"",sampleRate:"",depth:""},this.init=!1}getAudioInfo(){return this.audioInfo}updateAudioInfo(e){e.encTypeCode&&(this.audioInfo.encTypeCode=e.encTypeCode,this.audioInfo.encType=Tt[e.encTypeCode]),e.channels&&(this.audioInfo.channels=e.channels),e.sampleRate&&(this.audioInfo.sampleRate=e.sampleRate),e.depth&&(this.audioInfo.depth=e.depth),this.audioInfo.sampleRate&&this.audioInfo.channels&&this.audioInfo.encType&&!this.init&&(this.player.emit(ot.audioInfo,this.audioInfo),this.init=!0)}get isPlaying(){return this.playing}get isMute(){return 0===this.gainNode.gain.value||this.isStateSuspended()}get volume(){return this.gainNode.gain.value}get bufferSize(){return this.bufferList.length}get audioContextState(){let e=null;return this.audioContext&&(e=this.audioContext.state),e}initScriptNode(){}initMobileScriptNode(){}initWorkletScriptNode(){}getEngineType(){return""}mute(e){e?(this.setVolume(0),this.clear()):this.setVolume(this.player.lastVolume||.5)}setVolume(e){e=parseFloat(e).toFixed(2),isNaN(e)||(this.audioEnabled(!0),e=to(e,0,1),null!==this._prevVolume&&this._prevVolume===e||(null===this._prevVolume?this.player.emit(ot.mute,0===e):0===this._prevVolume&&e>0?this.player.emit(ot.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(ot.mute,!0),this.gainNode.gain.value=e,this.player.emit(ot.volumechange,this.player.volume),this.player.emit(ot.volume,this.player.volume),this._prevVolume=e))}closeAudio(){this.hasInitScriptNode&&(this.scriptNode&&this.scriptNode.disconnect(this.gainNode),this.workletProcessorNode&&this.workletProcessorNode.disconnect(this.gainNode),this.gainNode&&(this.gainNode.disconnect(this.mediaStreamAudioDestinationNode),this.$audio||this.gainNode.disconnect(this.audioContext.destination))),this.clear()}audioEnabled(e){if(e&&this.isStateSuspended()){if(this.audioContextContextResumeLock)return;this.audioContextContextResumeLock=!0,this.audioContext.resume().then((()=>{this.player.emit(ot.audioResumeState,{state:this.audioContextState,isRunning:this.isStateRunning()})})).finally((()=>{this.audioContextContextResumeLock=!1})),this.audioResumeStateTimeout=setTimeout((()=>{this.clearAudioResumeStateTimeout(),this.audioContextContextResumeLock=!1,this.isStateSuspended()&&this.player.emit(ot.audioResumeState,{state:this.audioContextState,isRunning:this.isStateRunning()})}),1e3)}}isStateRunning(){return"running"===this.audioContextState}isStateSuspended(){return"suspended"===this.audioContextState}clearAudioResumeStateTimeout(){this.audioResumeStateTimeout&&(clearTimeout(this.audioResumeStateTimeout),this.audioResumeStateTimeout=null)}clear(){this.bufferList=[]}play(e,t){}pause(){this.playing=!1}resume(){this.playing=!0}setRate(e){}getAudioBufferSize(){return 0}}class Za{constructor(e,t,i,s){this.player=e,this.audio=t,this.channel=i,this.bufferSize=s}destroy(){this.buffer=null,this.channel=null}extract(e,t){let i=this.provide(t);for(let t=0;t=a){try{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:0;const s=2*(t=t||0);i>=0||(i=(e.length-s)/2);const r=2*i;this.ensureCapacity(i+this._frameCount);const o=this.endIndex;this.vector.set(e.subarray(s,s+r),o),this._frameCount+=i}putBuffer(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t=t||0,i>=0||(i=e.frameCount-t),this.putSamples(e.vector,e.position+t,i)}receive(e){e>=0&&!(e>this._frameCount)||(e=this.frameCount),this._frameCount-=e,this._position+=e}receiveSamples(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=2*t,s=this.startIndex;e.set(this._vector.subarray(s,s+i)),this.receive(t)}extract(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.startIndex+2*t,r=2*i;e.set(this._vector.subarray(s,s+r))}ensureCapacity(){const e=parseInt(2*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0));if(this._vector.length0&&void 0!==arguments[0]?arguments[0]:0;this.ensureCapacity(this._frameCount+e)}rewind(){this._position>0&&(this._vector.set(this._vector.subarray(this.startIndex,this.endIndex)),this._position=0)}}class tn{constructor(e){e?(this._inputBuffer=new en,this._outputBuffer=new en):this._inputBuffer=this._outputBuffer=null}destroy(){this.clear(),this._outputBuffer&&(this._outputBuffer.destroy(),this._outputBuffer=null),this._inputBuffer&&(this._inputBuffer.destroy(),this._inputBuffer=null)}get inputBuffer(){return this._inputBuffer}set inputBuffer(e){this._inputBuffer=e}get outputBuffer(){return this._outputBuffer}set outputBuffer(e){this._outputBuffer=e}clear(){this._inputBuffer.clear(),this._outputBuffer.clear()}}class sn extends tn{constructor(e){super(e),this.reset(),this._rate=1}destroy(){super.destroy()}set rate(e){this._rate=e}reset(){this.slopeCount=0,this.prevSampleL=0,this.prevSampleR=0}clone(){const e=new sn;return e.rate=this._rate,e}process(){const e=this._inputBuffer.frameCount;this._outputBuffer.ensureAdditionalCapacity(e/this._rate+1);const t=this.transpose(e);this._inputBuffer.receive(),this._outputBuffer.put(t)}transpose(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(0===e)return 0;const t=this._inputBuffer.vector,i=this._inputBuffer.startIndex,s=this._outputBuffer.vector,r=this._outputBuffer.endIndex;let o=0,a=0;for(;this.slopeCount<1;)s[r+2*a]=(1-this.slopeCount)*this.prevSampleL+this.slopeCount*t[i],s[r+2*a+1]=(1-this.slopeCount)*this.prevSampleR+this.slopeCount*t[i+1],a+=1,this.slopeCount+=this._rate;if(this.slopeCount-=1,1!==e)e:for(;;){for(;this.slopeCount>1;)if(this.slopeCount-=1,o+=1,o>=e-1)break e;const n=i+2*o;s[r+2*a]=(1-this.slopeCount)*t[n]+this.slopeCount*t[n+2],s[r+2*a+1]=(1-this.slopeCount)*t[n+1]+this.slopeCount*t[n+3],a+=1,this.slopeCount+=this._rate}return this.prevSampleL=t[i+2*e-2],this.prevSampleR=t[i+2*e-1],a}}const rn=function(){};class on extends class{constructor(e){this._pipe=e}destroy(){}get pipe(){return this._pipe}get inputBuffer(){return this._pipe.inputBuffer}get outputBuffer(){return this._pipe.outputBuffer}fillInputBuffer(){throw new Error("fillInputBuffer() not overridden")}fillOutputBuffer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;for(;this.outputBuffer.frameCount2&&void 0!==arguments[2]?arguments[2]:rn;super(t),this.callback=i,this.sourceSound=e,this.historyBufferSize=22050,this._sourcePosition=0,this.outputBufferPosition=0,this._position=0}destroy(){this.clear(),this.sourceSound.destroy(),this.sourceSound=null,this._sourcePosition=0,this.outputBufferPosition=0,this._position=0}get position(){return this._position}set position(e){if(e>this._position)throw new RangeError("New position may not be greater than current position");const t=this.outputBufferPosition-(this._position-e);if(t<0)throw new RangeError("New position falls outside of history buffer");this.outputBufferPosition=t,this._position=e}get sourcePosition(){return this._sourcePosition}set sourcePosition(e){this.clear(),this._sourcePosition=e}onEnd(){this.callback()}fillInputBuffer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=new Float32Array(2*e),i=this.sourceSound.extract(t,e,this._sourcePosition);this._sourcePosition+=i,this.inputBuffer.putSamples(t,0,i)}extract(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillOutputBuffer(this.outputBufferPosition+t);const i=Math.min(t,this.outputBuffer.frameCount-this.outputBufferPosition);this.outputBuffer.extract(e,this.outputBufferPosition,i);const s=this.outputBufferPosition+i;return this.outputBufferPosition=Math.min(this.historyBufferSize,s),this.outputBuffer.receive(Math.max(s-this.historyBufferSize,0)),this._position+=i,i}handleSampleData(e){this.extract(e.data,4096)}clear(){super.clear(),this.outputBufferPosition=0}}const an=[[124,186,248,310,372,434,496,558,620,682,744,806,868,930,992,1054,1116,1178,1240,1302,1364,1426,1488,0],[-100,-75,-50,-25,25,50,75,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-20,-15,-10,-5,5,10,15,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-4,-3,-2,-1,1,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],nn=-10/1.5;class ln extends tn{constructor(e){super(e),this._quickSeek=!0,this.midBufferDirty=!1,this.midBuffer=null,this.refMidBuffer=null,this.overlapLength=0,this.autoSeqSetting=!0,this.autoSeekSetting=!0,this._tempo=1,this.setParameters(44100,0,0,8)}destroy(){this.clear(),super.destroy()}clear(){super.clear(),this.clearMidBuffer(),this.refMidBuffer=null}clearMidBuffer(){this.midBufferDirty&&(this.midBufferDirty=!1),this.midBuffer=null}setParameters(e,t,i,s){e>0&&(this.sampleRate=e),s>0&&(this.overlapMs=s),t>0?(this.sequenceMs=t,this.autoSeqSetting=!1):this.autoSeqSetting=!0,i>0?(this.seekWindowMs=i,this.autoSeekSetting=!1):this.autoSeekSetting=!0,this.calculateSequenceParameters(),this.calculateOverlapLength(this.overlapMs),this.tempo=this._tempo}set tempo(e){let t;this._tempo=e,this.calculateSequenceParameters(),this.nominalSkip=this._tempo*(this.seekWindowLength-this.overlapLength),this.skipFract=0,t=Math.floor(this.nominalSkip+.5),this.sampleReq=Math.max(t+this.overlapLength,this.seekWindowLength)+this.seekLength}get tempo(){return this._tempo}get inputChunkSize(){return this.sampleReq}get outputChunkSize(){return this.overlapLength+Math.max(0,this.seekWindowLength-2*this.overlapLength)}calculateOverlapLength(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;e=this.sampleRate*t/1e3,e=e<16?16:e,e-=e%8,this.overlapLength=e,this.refMidBuffer=new Float32Array(2*this.overlapLength),this.midBuffer=new Float32Array(2*this.overlapLength)}checkLimits(e,t,i){return ei?i:e}calculateSequenceParameters(){let e,t;this.autoSeqSetting&&(e=150+-50*this._tempo,e=this.checkLimits(e,50,125),this.sequenceMs=Math.floor(e+.5)),this.autoSeekSetting&&(t=28.333333333333332+nn*this._tempo,t=this.checkLimits(t,15,25),this.seekWindowMs=Math.floor(t+.5)),this.seekWindowLength=Math.floor(this.sampleRate*this.sequenceMs/1e3),this.seekLength=Math.floor(this.sampleRate*this.seekWindowMs/1e3)}set quickSeek(e){this._quickSeek=e}clone(){const e=new ln;return e.tempo=this._tempo,e.setParameters(this.sampleRate,this.sequenceMs,this.seekWindowMs,this.overlapMs),e}seekBestOverlapPosition(){return this._quickSeek?this.seekBestOverlapPositionStereoQuick():this.seekBestOverlapPositionStereo()}seekBestOverlapPositionStereo(){let e,t,i,s=0;for(this.preCalculateCorrelationReferenceStereo(),e=0,t=Number.MIN_VALUE;st&&(t=i,e=s);return e}seekBestOverlapPositionStereoQuick(){let e,t,i,s,r,o=0;for(this.preCalculateCorrelationReferenceStereo(),t=Number.MIN_VALUE,e=0,s=0,r=0;o<4;o+=1){let a=0;for(;an[o][a]&&(r=s+an[o][a],!(r>=this.seekLength));)i=this.calculateCrossCorrelationStereo(2*r,this.refMidBuffer),i>t&&(t=i,e=r),a+=1;s=e}return e}preCalculateCorrelationReferenceStereo(){let e,t,i=0;for(;i=this.sampleReq;){e=this.seekBestOverlapPosition(),this._outputBuffer.ensureAdditionalCapacity(this.overlapLength),this.overlap(Math.floor(e)),this._outputBuffer.put(this.overlapLength),t=this.seekWindowLength-2*this.overlapLength,t>0&&this._outputBuffer.putBuffer(this._inputBuffer,e+this.overlapLength,t);const s=this._inputBuffer.startIndex+2*(e+this.seekWindowLength-this.overlapLength);this.midBuffer.set(this._inputBuffer.vector.subarray(s,s+2*this.overlapLength)),this.skipFract+=this.nominalSkip,i=Math.floor(this.skipFract),this.skipFract-=i,this._inputBuffer.receive(i)}}}const dn=function(e,t){return(e>t?e-t:t-e)>1e-10};class hn{constructor(){this.transposer=new sn(!1),this.stretch=new ln(!1),this._inputBuffer=new en,this._intermediateBuffer=new en,this._outputBuffer=new en,this._rate=0,this._tempo=0,this.virtualPitch=1,this.virtualRate=1,this.virtualTempo=1,this.calculateEffectiveRateAndTempo()}destroy(){this.clear(),this._inputBuffer.destroy(),this._intermediateBuffer.destroy(),this._outputBuffer.destroy(),this._inputBuffer=null,this._intermediateBuffer=null,this._outputBuffer=null}clear(){this.transposer.clear(),this.stretch.clear()}clone(){const e=new hn;return e.rate=this.rate,e.tempo=this.tempo,e}get rate(){return this._rate}set rate(e){this.virtualRate=e,this.calculateEffectiveRateAndTempo()}set rateChange(e){this._rate=1+.01*e}get tempo(){return this._tempo}set tempo(e){this.virtualTempo=e,this.calculateEffectiveRateAndTempo()}set tempoChange(e){this.tempo=1+.01*e}set pitch(e){this.virtualPitch=e,this.calculateEffectiveRateAndTempo()}set pitchOctaves(e){this.pitch=Math.exp(.69314718056*e),this.calculateEffectiveRateAndTempo()}set pitchSemitones(e){this.pitchOctaves=e/12}get inputBuffer(){return this._inputBuffer}get outputBuffer(){return this._outputBuffer}calculateEffectiveRateAndTempo(){const e=this._tempo,t=this._rate;this._tempo=this.virtualTempo/this.virtualPitch,this._rate=this.virtualRate*this.virtualPitch,dn(this._tempo,e)&&(this.stretch.tempo=this._tempo),dn(this._rate,t)&&(this.transposer.rate=this._rate),this._rate>1?this._outputBuffer!=this.transposer.outputBuffer&&(this.stretch.inputBuffer=this._inputBuffer,this.stretch.outputBuffer=this._intermediateBuffer,this.transposer.inputBuffer=this._intermediateBuffer,this.transposer.outputBuffer=this._outputBuffer):this._outputBuffer!=this.stretch.outputBuffer&&(this.transposer.inputBuffer=this._inputBuffer,this.transposer.outputBuffer=this._intermediateBuffer,this.stretch.inputBuffer=this._intermediateBuffer,this.stretch.outputBuffer=this._outputBuffer)}process(){this._rate>1?(this.stretch.process(),this.transposer.process()):(this.transposer.process(),this.stretch.process())}}class cn{constructor(e,t,i){this.player=e,this.audio=t,this.soundTouch=new hn,this.soundTouch.tempo=1,this.soundTouch.rate=1,this.filter=new on(i,this.soundTouch)}destroy(){this.filter&&(this.filter.destroy(),this.filter=null),this.soundTouch&&(this.soundTouch.destroy(),this.soundTouch=null)}setRate(e){e!==this.soundTouch.rate&&(this.soundTouch.tempo=e)}provide(e){let t=new Float32Array(2*e),i=this.filter.extract(t,e),s=new Float32Array(i),r=new Float32Array(i);for(let e=0;e{e()})),this.eventListenList=[]),this.$audio&&(this.$audio.pause(),this.$audio.srcObject=null,this.$audio.parentNode&&this.$audio.parentNode.removeChild(this.$audio),this.$audio=null),this.processor&&(this.processor.destroy(),this.processor=null),this.rateProcessor&&(this.rateProcessor.destroy(),this.rateProcessor=null),this.scriptNodeInterval&&(clearInterval(this.scriptNodeInterval),this.scriptNodeInterval=null),this.defaultPlaybackRate=1,this.playbackRate=1,this.scriptStartTime=0,this.audioBufferSize=0,this.engineType=vs,this.player.debugLog("AudioContext","destroy"),!0}isAudioPlaying(){return this.$audio&&pa(this.$audio.paused)&&pa(this.$audio.ended)&&0!==this.$audio.playbackRate&&0!==this.$audio.readyState}_bindAudioProxy(){const{proxy:e}=this.player.events,t=e(this.$audio,"canplay",(()=>{this.player.debugLog("AudioContext","canplay"),this._delayPlay&&this._audioElementPlay()}));this.eventListenList.push(t)}_getAudioElementReadyState(){let e=0;return this.$audio&&(e=this.$audio.readyState),e}audioElementPlay(){if(this.$audio){const e=this._getAudioElementReadyState();if(this.player.debugLog("AudioContext",`play and readyState: ${e}`),!(0!==e||Ho()&&fo()))return this.player.debugWarn("AudioContext","readyState is 0 and set _delayPlay to true"),void(this._delayPlay=!0);this._audioElementPlay()}}_audioElementPlay(){this.$audio&&this.$audio.play().then((()=>{this._delayPlay=!1,this.player.debugLog("AudioContext","_audioElementPlay success"),setTimeout((()=>{this.isAudioPlaying()||(this.player.debugWarn("AudioContext","play failed and retry play"),this._audioElementPlay())}),100),this.isAudioPlaying()&&(this.player.debugLog("AudioContext","play success and remove document click event listener"),document.removeEventListener("click",this._audioElementPlay.bind(this)))})).catch((e=>{this.player.debugError("AudioContext","_audioElementPlay error",e),document.addEventListener("click",this._audioElementPlay.bind(this))}))}getAudioBufferSize(){return this.audioBufferSize}get oneBufferDuration(){return this.audioBufferSize/this.audioContext.sampleRate*1e3}get isActiveEngineType(){return this.engineType===_s}getBufferListDuration(){return this.bufferList.length*this.oneBufferDuration}isMoreThanMinBufferDuration(){return this.getBufferListDuration()>=100*this.playbackRate}initProcessor(){this.processor=new Za(this.player,this,this.audioInfo.channels,this.audioBufferSize),this.rateProcessor=new cn(this.player,this,this.processor)}getAutoAudioEngineType(){let e=this.player._opt.audioEngine||vs;const t=()=>{e=Ho()&&co()?_s:(fo()&&this.player._opt.supportLockScreenPlayAudio||ia()&&this.supportAudioWorklet(),vs)};return this.player._opt.audioEngine?this.player._opt.audioEngine===bs&&ia()&&this.supportAudioWorklet()?e=vs:this.player._opt.audioEngine===_s?e=_s:this.player._opt.audioEngine===vs?e=vs:t():t(),e}getAudioBufferSizeByType(){const e=this.engineType;this.player._opt.hasVideo;const t=this.player._opt.weiXinInAndroidAudioBufferSize;return e===bs?1024:e===_s?t||4800:1024}supportAudioWorklet(){return this.audioContext&&this.audioContext.audioWorklet&&"function"==typeof this.audioContext.audioWorklet.addModule}initScriptNode(){this.playing=!0,this.hasInitScriptNode||(this.initProcessor(),this.engineType===bs?this.initWorkletScriptNode():this.engineType===_s?this.initIntervalScriptNode():this.engineType===vs&&this.initProcessScriptNode(),this.audioElementPlay())}getEngineType(){return this.engineType}isPlaybackRateSpeed(){return this.playbackRate>this.defaultPlaybackRate}initProcessScriptNode(){const e=this.audioContext.createScriptProcessor(this.audioBufferSize,0,this.audioInfo.channels);e.onaudioprocess=e=>{const t=e.outputBuffer;this.handleScriptNodeCallback(t)},e.connect(this.gainNode),this.scriptNode=e,this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.$audio?this.$audio.srcObject=this.mediaStreamAudioDestinationNode.stream:this.gainNode.connect(this.audioContext.destination),this.hasInitScriptNode=!0}initIntervalScriptNode(){this.scriptStartTime=0;const e=1e3*this.audioBufferSize/this.audioContext.sampleRate;this.scriptNodeInterval=setInterval((()=>{if(0===this.bufferList.length||pa(this.playing)||this.isMute)return void(this.playing&&pa(this.isMute)&&this.player.debugLog("AudioContext",`interval script node and bufferList is ${this.bufferList.length} or playing is ${this.playing}`));const e=this.audioContext.createBufferSource(),t=this.audioContext.createBuffer(this.audioInfo.channels,this.audioBufferSize,this.audioContext.sampleRate);this.handleScriptNodeCallback(t,(()=>{this.scriptStartTime{"init"===e.data.message?(this.audioBufferSize=e.data.audioBufferSize,this.start=e.data.start,this.channels=e.data.channels,this.state=0,this.offset=0,this.samplesArray=[]):"stop"===e.data.message?(this.state=0,this.start=!1,this.offset=0,this.samplesArray=[]):"data"===e.data.message?this.samplesArray.push(e.data.buffer):"zero"===e.data.message&&this.samplesArray.push({left:new Float32Array(this.audioBufferSize).fill(0),right:new Float32Array(this.audioBufferSize).fill(0)})}}process(e,t,i){const s=t[0][0],r=t[0][1];if(0===this.offset&&this.port.postMessage({message:"beep"}),0===this.state)this.state=1;else if(1===this.state&&this.samplesArray.length>=4)this.state=2;else if(2===this.state){const e=this.samplesArray[0];for(let t=0;t{if(this.player.isDestroyedOrClosed())return void this.player.debugLog("AudioContext","initWorkletScriptNode() player is destroyed");if(!this.audioContext)return void this.player.debugWarn("AudioContext","initWorkletScriptNode audioContext is null");let e=[1];2===this.audioInfo.channels&&(e=[1,1]);try{this.workletProcessorNode=new AudioWorkletNode(this.audioContext,"worklet-processor",{numberOfOutputs:this.audioInfo.channels,outputChannelCount:e})}catch(e){this.player.debugError("AudioContext","initWorkletScriptNode error",e),this.workletProcessorNode=null,this.tierDownToProcessScript()}this.workletProcessorNode&&(this.workletProcessorNode.connect(this.gainNode),this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.$audio?this.$audio.srcObject=this.mediaStreamAudioDestinationNode.stream:this.gainNode.connect(this.audioContext.destination),this.hasInitScriptNode=!0,this.workletProcessorNode.port.postMessage({message:"init",audioBufferSize:this.audioBufferSize,start:!0,channels:this.audioInfo.channels}),this.workletProcessorNode.port.onmessage=e=>{this.workletProcessorNode?this.audioContext?this.handleScriptNodeCallback(this.workletProcessorNode,null,!0):this.workletProcessorNode.port.postMessage({message:"zero"}):this.player.debugError("AudioContext","workletProcessorNode is null")})})),this.clearWorkletUrlTimeout=setTimeout((()=>{URL.revokeObjectURL(this.workletUrl),this.workletUrl=null,this.clearWorkletUrlTimeout=null}),te)}tierDownToProcessScript(){this.player.debugLog("AudioContext","tierDownToProcessScript"),this.engineType=vs,this.audioBufferSize=this.getAudioBufferSizeByType(),this.initProcessScriptNode(),this.audioElementPlay()}handleScriptNodeCallback(e,t){let i,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t=t||Yr;let r=e.length;s&&(i=e,r=this.audioBufferSize);const o=this.audioInfo.channels;if(this.playing&&this.isMoreThanMinBufferDuration()){if(this.player._opt,this.player.openSyncAudioAndVideo()&&ua(this.player.visibility)){this.calcPlaybackRateBySync();const r=this.player.getAudioSyncVideoDiff();if(r>this.player._opt.syncAudioAndVideoDiff){const a=this.player.getCurrentVideoAndAudio();return this.player.debugWarn("AudioContext",`audioSyncVideoOption more than diff :${r},\n and video is ${a.video} ,\n and audio is ${a.audio} , waiting and bufferList is ${this.bufferList.length}, fill zero`),s?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,o),void t()}}let a=this._provide(r);if(0===a.size)return pa(this.player.isPlaybackOnlyDecodeIFrame())&&this.player.debugWarn("AudioContext",`bufferList size is ${this.bufferList.length} outputBufferLength is ${r},and bufferItem.size is 0, fill zero`),s?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,o),void t();a&&a.ts&&(this.player.audioTimestamp=a.ts),s?i.port.postMessage({message:"data",buffer:a}):this.fillScriptNodeOutputBuffer(e,o,a),t()}else 0===this.bufferList.length&&this.playing&&pa(this.isMute)&&pa(this.player.isPlaybackOnlyDecodeIFrame())&&this.player.debugWarn("AudioContext",`bufferList size is 0 and outputBufferLength is ${r}, fill zero`),s?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,o),t()}fillScriptNodeOutputBuffer(e,t,i){if(1===t){const t=e.getChannelData(0);i?0===i.size?t.fill(0):t.set(i.left):t.fill(0)}else if(2===t){const t=e.getChannelData(0),s=e.getChannelData(1);i?0===i.size?(t.fill(0),s.fill(0)):(t.set(i.left),s.set(i.right)):(t.fill(0),s.fill(0))}}play(e,t){this.isMute||(this.hasInitScriptNode?(this.hasAudio=!0,this.player.latestAudioTimestamp=t,this.bufferList.push({buffer:e,ts:t}),pa(this.player.openSyncAudioAndVideo())&&this.calcPlaybackRateByBuffer()):this.player.debugWarn("AudioContext","play has not init script node"))}calcPlaybackRateBySync(){if(this.isMute)return;if(!this.playing)return;const e=Math.floor(2e3/this.oneBufferDuration);if(this.bufferList.length>e)return this.player.debugWarn("AudioContext",`bufferList length ${this.bufferList.length} more than ${e}, and drop`),void this.clear();const t=this.player.getAudioSyncVideoDiff();if(this.getEngineType()===_s){if(t<-this.player._opt.syncAudioAndVideoDiff){this.player.debugWarn("AudioContext",`engine active , audioSyncVideoOption ${-this.player._opt.syncAudioAndVideoDiff} less than diff :${t},\n and bufferlist is ${this.bufferList.length}`);const e=this.player.getRenderCurrentPts();for(;this.bufferList.length>0;){const t=this.bufferList[0],i=t.ts-e;if(i>-this.player._opt.syncAudioAndVideoDiff/2){this.player.audioTimestamp=t.ts,this.player.debugLog("AudioContext",`engine active , audioSyncVideoOption\n item.ts is ${t.ts} and currentVideoTimestamp is ${e}, diff is ${i} > -${this.player._opt.syncAudioAndVideoDiff/2} and end`);break}this.bufferList.shift(),this.player.audioTimestamp=t.ts}}}else{let e=this.playbackRate;t<-this.player._opt.syncAudioAndVideoDiff?e===this.defaultPlaybackRate&&(this.player.debugLog("AudioContext",`audioSyncVideoOption ${-this.player._opt.syncAudioAndVideoDiff} less than diff :${t},\n speed up, playbackRate is ${e},\n and bufferList is ${this.bufferList.length}`),e=this.defaultPlaybackRate+.2):t>-this.player._opt.syncAudioAndVideoDiff/2&&e!==this.defaultPlaybackRate&&(this.player.debugLog("AudioContext",`diff is ${t} > -${this.player._opt.syncAudioAndVideoDiff/2} and speed to 1`),e=this.defaultPlaybackRate),this.updatePlaybackRate(e)}}calcPlaybackRateByBuffer(){if(this.isMute)return;if(!this.playing)return;let e=this.playbackRate,t=1e3,i=5e3;this.isAudioPlayer&&(t=this.player._opt.videoBufferDelay,i=this.player._opt.videoBufferMax);const s=Math.floor(t/this.oneBufferDuration),r=Math.floor(i/this.oneBufferDuration);if(this.bufferList.length>r)return this.player.debugWarn("AudioContext",`bufferList length ${this.bufferList.length} more than ${r}, and drop`),void this.clear();this.getEngineType()!==_s&&(this.bufferList.length>s?(e=this.defaultPlaybackRate+.2,this.player.debugLog("AudioContext",`bufferList length ${this.bufferList.length} more than ${s}, speed up, playbackRate is ${e}`)):this.bufferList.length0?this.player.emit(ot.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(ot.mute,!0),this.$video.volume=e,this.player.emit(ot.volumechange,this.player.volume),this.player.emit(ot.volume,this.player.volume),this._prevVolume=e))}clear(){}play(e,t){const i=this.player.video.awriter;if(i)if(e.close)try{i.write(e),ta(e)}catch(e){this.player.debugError("Video","play audio error",e)}else try{const s=function(e,t){const i={...t,format:"f32-planar",data:new Float32Array(0)};if(i.numberOfFrames=e[0].length,1===e.length)i.data=new Float32Array(e[0]);else if(2===e.length){const t=new Float32Array(e[0].length+e[1].length);t.set(e[0],0),t.set(e[1],e[0].length),i.data=t}return new AudioData(i)}(e,{sampleRate:vr,numberOfChannels:this.audioInfo.channels,timestamp:1e3*t});i.write(s),ta(s)}catch(e){this.player.debugError("Video","play audio error",e)}else this.player.debugWarn("Audio","play and this.awriter is null")}pause(){}resume(){}getEngineType(){return"audio"}isPlaybackRateSpeed(){return!1}setRate(){}initScriptNode(){}initScriptNodeDelay(){}audioEnabled(){this.mute(!1)}getAudioBufferSize(){return 2048}}class fn extends un{constructor(e){super(e),this.delayTimeout=null,this.player.on(ot.playbackPause,(e=>{this.listenPlaybackPause(e)})),this.player.debugLog("AudioPlaybackContext","init")}async destroy(){return this.delayTimeout&&(clearTimeout(this.delayTimeout),this.delayTimeout=null),await super.destroy(),this.player.debugLog("AudioPlaybackLoader","destroy"),!0}listenPlaybackPause(e){e?(this.pause(),this.player.playback.isPlaybackPauseClearCache&&this.clear()):this.resume()}initScriptNodeDelay(){const e=this.player._opt.playbackDelayTime;e>0?this.delayTimeout=setTimeout((()=>{this.initScriptNode()}),e):this.initScriptNode()}setRate(e){e!==this.defaultPlaybackRate&&this.rateProcessor&&(this.player.debugLog("AudioPlaybackContext","setRate",e),this.defaultPlaybackRate=e,this.updatePlaybackRate(e))}}class mn extends un{constructor(e){super(e),this.TAG_NAME="AudioPlayerLoader",this.isAudioPlayer=!0,this.player.debugLog(this.TAG_NAME,"init")}async destroy(){return await super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy"),!0}play(e,t){pa(this.playing)||super.play(e,t)}pause(){this.player.debugLog(this.TAG_NAME,"pause"),this.playing=!1,this.clear()}resume(){this.player.debugLog(this.TAG_NAME,"resume"),this.playing=!0}}class gn extends wa{constructor(e){super(),this.TAG_NAME="AudioWebrtcPlayerLoader",this.$video=new Audio,this.player=e,this.init=!1,this._prevVolume=null,this.eventsDestroy=[],this._handleDocumentClickPlay=this._handleClickPlay.bind(this),this._initAudioEvents(),this.player.debugLog(this.TAG_NAME,"init")}async destroy(){return this.resetInit(),this.off(),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this._prevVolume=null,this.$video&&(this.$video.pause(),this.$video.srcObject=null,this.$video=null),this.player.debugLog(this.TAG_NAME,"destroy"),!0}_initAudioEvents(){const{proxy:e}=this.player.events,t=e(this.$video,"timeupdate",(e=>{const t=parseInt(e.timeStamp,10);this.player.handleRender(),this.player.updateStats({ts:t})}));this.eventsDestroy.push(t)}resetInit(){this.init=!1}_handleClickPlay(){this.$video&&(this.$video.play(),document.removeEventListener("click",this._handleDocumentClickPlay))}bindStream(e){this.$video.srcObject=e,this.$video.volume=1,this.$video.play().catch((e=>{this.player.debugWarn(this.TAG_NAME,"audio play error",e),document.addEventListener("click",this._handleDocumentClickPlay)}))}getEngineType(){return"audio"}get isPlaying(){return!0}get volume(){return ua(this.$video.muted)?0:this.$video.volume}get isMute(){return 0===this.$video.volume||ua(this.$video.muted)}mute(e){this.setVolume(e?0:this.player.lastVolume||.5)}setVolume(e){e=parseFloat(e),isNaN(e)||null===this.$video||(this.$video.muted&&(this.$video.muted=!1),e=to(e,0,1),fo()&&(this.$video.muted=0===e),null!==this._prevVolume&&this._prevVolume===e||(null===this._prevVolume?this.player.emit(ot.mute,0===e):0===this._prevVolume&&e>0?this.player.emit(ot.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(ot.mute,!0),this.$video.volume=e,this.player.emit(ot.volumechange,this.player.volume),this.player.emit(ot.volume,this.player.volume),this._prevVolume=e))}pause(){}resume(){}audioEnabled(){this.mute(!1)}}class yn{constructor(e){return new(yn.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.playType===_?e.useMSE&&e.mseDecodeAudio?pn:fn:e.playType===v?e.isWebrtc?gn:mn:e.isHls&&pa(e.supportHls265)||e.isWebrtc&&pa(e.isWebrtcH265)||e.useMSE&&e.mseDecodeAudio||e.isAliyunRtc||e.useWCS&&e.wcsDecodeAudio||e.useWasm&&e.wasmPlayAudioUseVideoRender?pn:un}}class An extends wa{constructor(e){super(),this.player=e,this.playing=!1,this._requestAbort=!1,this._status=Js,this.writableStream=null,this.abortController=new AbortController,this.streamRate=oo((t=>{e.emit(ot.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,e.debugLog("FetchStream","init")}async destroy(){return this.abort(),await this._closeWritableStream(),this.off(),this._status=Js,this.streamRate=null,this.stopStreamRateInterval(),this.player.debugLog("FetchStream","destroy"),!0}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}async _closeWritableStream(){if(this.writableStream&&pa(this.writableStream.locked))try{await this.writableStream.close(),this.writableStream=null,this.player.debugLog("FetchStream","close writableStream success")}catch(e){this.player.debugLog("FetchStream","destroy and writableStream.close()",e)}}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{demux:i}=this.player;this.player._times.streamStart=eo();const s=Object.assign({signal:this.abortController.signal},{headers:t.headers||{}});fetch(e,s).then((e=>{if(this._requestAbort)return this._status=Js,void e.body.cancel();if(!function(e){return e.ok&&e.status>=200&&e.status<=299}(e))return this.player.debugError("FetchStream",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),this.abort(),void this.emit(lt.fetchError,`fetch response status is ${e.status} and ok is ${e.ok}`);if(this.emit(ot.streamSuccess),this.startStreamRateInterval(),"undefined"!=typeof WritableStream)this.player.debugLog("FetchStream","use WritableStream() to read stream"),this.writableStream=new WritableStream({write:e=>this.abortController&&this.abortController.signal&&this.abortController.signal.aborted?(this.player.debugLog("FetchStream","writableStream.write() and this.abortController.signal.aborted so return"),void(this._status=Ks)):ua(this._requestAbort)?(this.player.debugLog("FetchStream","writableStream.write() and this._requestAbort is true so return"),this._status=Ks,void this.abort()):"string"!=typeof e?(this._status=qs,this.streamRate&&this.streamRate(e.byteLength),i.dispatch(e)):void this.player.debugWarn("FetchStream",`writableStream.write() and value is "${e}" string so return`),close:()=>{this._status=Ks,i.close(),this.emit(ot.streamEnd,"fetch done")},abort:e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return this.player.debugLog("FetchStream","writableStream.abort() and this.abortController.signal.aborted so return"),void(this._status=Ks);i.close();const t=e.toString();-1===t.indexOf(hs)&&-1===t.indexOf(cs)&&e.name!==us&&(this.abort(),this.emit(lt.fetchError,e))}}),e.body.pipeTo(this.writableStream).catch((e=>{"AbortError"!==e.name&&this.player.debugLog("FetchStream","res.body.pipeTo() error",e.name,e.toString())}));else{this.player.debugLog("FetchStream","not support WritableStream and use getReader() to read stream");const t=e.body.getReader(),s=()=>{t.read().then((e=>{let{done:t,value:r}=e;return t?(this._status=Ks,i.close(),void this.emit(ot.streamEnd,"fetch done")):this.abortController&&this.abortController.signal&&this.abortController.signal.aborted?(this.player.debugLog("FetchStream","reader.read() and this.abortController.signal.aborted so return"),void(this._status=Ks)):ua(this._requestAbort)?(this.player.debugLog("FetchStream","reader.read() and this._requestAbort is true so return"),this._status=Ks,void this.abort()):void("string"!=typeof r?(this._status=qs,this.streamRate&&this.streamRate(r.byteLength),i.dispatch(r),s()):this.player.debugWarn("FetchStream",`reader.read() and value is "${r}" string so return`))})).catch((e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return this.player.debugLog("FetchStream","reader.read().catch() and this.abortController.signal.aborted so return"),void(this._status=Ks);i.close();const t=e.toString();-1===t.indexOf(hs)&&-1===t.indexOf(cs)&&e.name!==us&&(this.abort(),this.emit(lt.fetchError,e))}))};s()}})).catch((e=>{this.abortController&&this.abortController.signal&&this.abortController.signal.aborted||"AbortError"!==e.name&&(i.close(),this.abort(),this.emit(lt.fetchError,e))}))}abort(){if(this._requestAbort=!0,this.abortController)try{this.abortController.abort(),this.abortController=null,this.player.debugLog("FetchStream","abortController.abort() success")}catch(e){this.abortController=null,this.player.debugLog("FetchStream","abortController.abort() error",e)}}getStreamType(){return u}}class bn extends wa{constructor(e){super(),this.TAG_NAME="FetchWorkerLoader",this.player=e,this.playing=!1,this.fetchWorker=null,this.workerClearTimeout=null,this.workerUrl=null,this.destroyResolve=null,this.decoderWorkerCloseTimeout=null,this.abortController=new AbortController,this.streamRate=oo((t=>{e.emit(ot.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,this._initFetchWorker(),e.debugLog(this.TAG_NAME,"init")}destroy(){return new Promise(((e,t)=>{this.fetchWorker?(this.player.debugLog(this.TAG_NAME,"send destroy"),this.fetchWorker.postMessage({cmd:Ze}),this.destroyResolve=e,this.decoderWorkerCloseTimeout=setTimeout((()=>{this.player.debugWarn(this.TAG_NAME,"send close but not response and destroy directly"),this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this._destroy(),setTimeout((()=>{e()}),0)}),2e3)):(this._destroy(),setTimeout((()=>{e()}),0))}))}_destroy(){this.off(),this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this.workerUrl&&(window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this._stopStreamRateInterval(),this.streamRate=null,this.fetchWorker&&(this.fetchWorker.terminate(),this.fetchWorker.onmessage=null,this.fetchWorker=null),this.destroyResolve&&(this.destroyResolve(),this.destroyResolve=null),this.player.debugLog(this.TAG_NAME,"destroy")}_initFetchWorker(){const e=Aa(function(){function e(e){return!0===e||"true"===e}const t="The user aborted a request",i="AbortError",s="AbortError",r="fetch",o="destroy",a="destroyEnd",n="buffer",l="fetchError",d="fetchClose",h="fetchSuccess",c="idle",u="buffering",p="complete";let f=new class{constructor(){this._requestAbort=!1,this._status=c,this.writableStream=null,this.isChrome=!1,this.abortController=new AbortController}destroy(){var e;this.abort(),this.writableStream&&(!1===(e=this.writableStream.locked)||"false"===e)&&this.writableStream.close().catch((e=>{})),this.writableStream=null,this._status=c}fetchStream(r){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=Object.assign({signal:this.abortController.signal},{headers:o.headers||{}});fetch(r,a).then((r=>{if(this._requestAbort)return this._status=c,void r.body.cancel();if(!function(e){return e.ok&&e.status>=200&&e.status<=299}(r))return this.abort(),void postMessage({cmd:l,message:`fetch response status is ${r.status} and ok is ${r.ok}`});if(postMessage({cmd:h}),"undefined"!=typeof WritableStream)this.writableStream=new WritableStream({write:t=>{if(!(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted))return e(this._requestAbort)?(this._status=p,void this.abort()):void("string"!=typeof t&&(this._status=u,postMessage({cmd:n,buffer:t},[t.buffer])));this._status=p},close:()=>{this._status=p,postMessage({cmd:d})},abort:e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return void(this._status=p);const r=e.toString();-1===r.indexOf(t)&&-1===r.indexOf(i)&&e.name!==s&&(this.abort(),postMessage({cmd:l,message:e.toString()}))}}),r.body.pipeTo(this.writableStream).catch((e=>{}));else{const o=r.body.getReader(),a=()=>{o.read().then((t=>{let{done:i,value:s}=t;return i?(this._status=p,void postMessage({cmd:d})):this.abortController&&this.abortController.signal&&this.abortController.signal.aborted?void(this._status=p):e(this._requestAbort)?(this._status=p,void this.abort()):void("string"!=typeof s&&(this._status=u,postMessage({cmd:n,buffer:s},[s.buffer]),a()))})).catch((e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return void(this._status=p);const r=e.toString();-1===r.indexOf(t)&&-1===r.indexOf(i)&&e.name!==s&&(this.abort(),postMessage({cmd:l,message:e.toString()}))}))};a()}})).catch((e=>{this.abortController&&this.abortController.signal&&this.abortController.signal.aborted||"AbortError"!==e.name&&(this.abort(),postMessage({cmd:l,message:e.toString()}))}))}abort(){if(this._requestAbort=!0,this.abortController)try{this.abortController.abort(),this.abortController=null}catch(e){this.abortController=null}}};self.onmessage=t=>{const i=t.data;switch(i.cmd){case r:f.isChrome=e(i.isChrome),f.fetchStream(i.url,JSON.parse(i.options));break;case o:f.destroy(),f=null,postMessage({cmd:a})}}}.toString()),t=new Blob([e],{type:"text/javascript"});let i=URL.createObjectURL(t);const s=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((()=>{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),te),s.onmessage=e=>{const{demux:t}=this.player,i=e.data;switch(i.cmd){case tt:this.streamRate&&this.streamRate(i.buffer.byteLength),t.dispatch(i.buffer);break;case rt:this.emit(ot.streamSuccess),this._startStreamRateInterval();break;case st:t.close(),this.emit(ot.streamEnd,"fetch done");break;case it:t.close(),this.emit(lt.fetchError,i.message);break;case et:this._destroy()}},this.fetchWorker=s}_startStreamRateInterval(){this._stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}_stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player._times.streamStart=eo(),this.fetchWorker.postMessage({cmd:Xe,url:e,isChrome:$o(),options:JSON.stringify(t)})}getStreamType(){return u}}class vn extends wa{constructor(e){super(),this.player=e,this.socket=null,this.socketStatus=dt,this.wsUrl=null,this.requestAbort=!1,this.socketDestroyFnList=[],this.streamRate=oo((t=>{e.emit(ot.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,e.debugLog("WebsocketStream","init")}async destroy(){this._closeWebSocket(),this.stopStreamRateInterval(),this.wsUrl=null,this.off(),this.player.debugLog("WebsocketStream","destroy")}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}_createWebSocket(e){const t=this.player,{events:{proxy:i},demux:s}=t,r=e.protocols||[];this.socket=new WebSocket(this.wsUrl,r),this.socket.binaryType="arraybuffer";const o=i(this.socket,"open",(()=>{this.player.debugLog("WebsocketStream","socket open"),this.socketStatus=ht,this.emit(ot.streamSuccess),this.player.emit(ot.websocketOpen),this.startStreamRateInterval()})),a=i(this.socket,"message",(e=>{"string"!=typeof e.data?(this.streamRate&&this.streamRate(e.data.byteLength),this._handleMessage(e.data)):this.player.debugWarn("WebsocketStream",`websocket handle message message is "${e.data}" string so return`)})),n=i(this.socket,"close",(e=>{if(!this.player.isDestroyedOrClosed())if(this.socketStatus!==ut){if(this.player.debugLog("WebsocketStream",`socket close and code is ${e.code}`),1006===e.code&&this.player.debugError("WebsocketStream",`socket close abnormally and code is ${e.code}`),ua(this.requestAbort))return this.requestAbort=!1,void this.player.debugLog("WebsocketStream","socket close and requestAbort is true");s.close(),this.socketStatus=ct,this.player.emit(ot.websocketClose,e.code),this.emit(ot.streamEnd,e.code)}else this.player.debugLog("WebsocketStream","socket close and status is error, so return")})),l=i(this.socket,"error",(e=>{this.player.isDestroyedOrClosed()||(this.player.debugError("WebsocketStream","socket error",e),this.socketStatus=ut,this.emit(lt.websocketError,e),s.close(),this.player.debugLog("WebsocketStream","socket error:",e.isTrusted?"websocket user aborted":"websocket error"))}));this.socketDestroyFnList.push(o,a,n,l)}_closeWebSocket(){this.socketDestroyFnList.forEach((e=>e())),!this.socket||0!==this.socket.readyState&&1!==this.socket.readyState?this.socket&&this.player.debugLog("WebsocketStream",`_closeWebSocket() socket is null or socket status is ${this.socket&&this.socket.readyState}`):(this.requestAbort=!0,this.socket.close(1e3,"Client disconnecting")),this.socket=null,this.socketStatus=dt,this.streamRate=null}_handleMessage(e){const{demux:t}=this.player;t?t.dispatch(e):this.player.debugWarn("WebsocketStream","websocket handle message demux is null so return")}fetchStream(e,t){this.player._times.streamStart=eo(),this.wsUrl=e,this._createWebSocket(t)}sendMessage(e){this.socket?this.socketStatus===ht?this.socket.send(e):this.player.debugError("WebsocketStream",`websocket send message error and socket status is ${this.socketStatus}`):this.player.debugError("WebsocketStream","websocket send message socket is null")}resetFetchStream(){this._closeWebSocket(),this._createWebSocket()}getStreamType(){return f}}class _n extends wa{constructor(e){super(),this.player=e,e.debugLog("HlsStream","init")}async destroy(){return this.off(),this.player.debugLog("HlsStream","destroy"),!0}fetchStream(e){const{hlsDecoder:t,debug:i}=this.player;this.player._times.streamStart=eo(),t.loadSource(e).then((()=>{this.player.debugLog("HlsStream","loadSource success"),this.emit(ot.streamSuccess)})).catch((e=>{this.emit(lt.hlsError,e)}))}getStreamType(){return p}}class Sn extends wa{constructor(e){super(),this.player=e,this.webrctUrl=null,e.debugLog("WebrtcStream","init")}async destroy(){return this.webrctUrl=null,this.off(),this.player.debugLog("WebrtcStream","destroy"),!0}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{webrtc:i,debug:s}=this.player;if(this.player._times.streamStart=eo(),this.webrctUrl=e.replace("webrtc:",window.location.protocol),this.player.isWebrtcForM7S()&&-1===this.webrctUrl.indexOf("/webrtc/play")){const t=new URL(this.webrctUrl),i="/webrtc/play"+t.pathname;this.webrctUrl=t.origin+i+t.search,this.player.debugLog("WebrtcStream",`original url is ${e}, and new url is: ${this.webrctUrl}`)}i.loadSource(this.webrctUrl,t).then((()=>{this.player.debugLog("WebrtcStream","loadSource success"),this.emit(ot.streamSuccess)})).catch((e=>{this.player.debugError("WebrtcStream","loadSource error",e),this.emit(lt.webrtcError,e)}))}getStreamType(){return m}}class En extends wa{constructor(e){super(),this.player=e,this.transport=null,this.wtUrl=null,this.streamRate=oo((t=>{e.emit(ot.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,e.debugLog("WebTransportLoader","init")}async destroy(){return this.abort(),this.off(),this.player.debugLog("WebTransportLoader","destroy"),!0}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}_createWebTransport(){const e=this.player,{debug:t,events:{proxy:i},demux:s}=e;try{this.transport=new WebTransport(this.wtUrl),this.transport.ready.then((()=>{this.emit(ot.streamSuccess),this.startStreamRateInterval(),this.transport.createBidirectionalStream().then((e=>{e.readable.pipeTo(new WritableStream(s.input))}))})).catch((e=>{this.player.debugWarn("WebTransportLoader","_createWebTransport-ready",e)}))}catch(e){this.player.debugWarn("WebTransportLoader","_createWebTransport",e)}}fetchStream(e){this.player._times.streamStart=eo(),this.wtUrl=e.replace(/^wt:/,"https:"),this._createWebTransport()}abort(){if(this.transport)try{this.transport.close(),this.transport=null}catch(e){this.transport=null}}getStreamType(){return g}}class wn extends wa{constructor(e){super(),this.player=e,this.workUrl=null,e.debugLog("WorkerStream","init")}async destroy(){return this.workUrl=null,this.off(),this.player.debugLog("WorkerStream","destroy"),!0}sendMessage(e){this.player.decoderWorker.workerSendMessage(e)}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.workUrl=e,this.player._times.streamStart=eo(),this.player.decoderWorker.workerFetchStream(e,t)}getStreamType(){const e=this.player._opt.protocol;return y+" "+(e===a?u:f)}}class Tn extends wa{constructor(e){super(),this.TAG_NAME="AliyunRtcLoader",this.player=e,e.debugLog(this.TAG_NAME,"init")}async destroy(){return this.off(),this.player.debugLog(this.TAG_NAME,"destroy"),!0}fetchStream(e){const{aliyunRtcDecoder:t}=this.player;this.player._times.streamStart=eo(),t.loadSource(e).then((()=>{this.player.debugLog(this.TAG_NAME,"loadSource success"),this.emit(ot.streamSuccess)})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource error",e),this.emit(lt.aliyunRtcError,e)}))}getStreamType(){return A}}class kn{constructor(e){return new(kn.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){const{protocol:t,useWasm:i,playType:s,useWCS:r,useMSE:c,demuxUseWorker:u,mainThreadFetchUseWorker:p}=e;return t===a?s===v?wn:s===b?i&&!Xo(e)||u?wn:p?bn:An:r||c?u?wn:p?bn:An:wn:t===o?s===v?wn:s===b?i&&!Xo(e)||u?wn:vn:r||c?u?wn:vn:wn:t===n?_n:t===l?Sn:t===d?En:t===h?Tn:void 0}}var Ln=Lr((function(e){function t(e,r){if(!e)throw"First parameter is required.";r=new i(e,r=r||{type:"video"});var o=this;function a(t){t&&(r.initCallback=function(){t(),t=r.initCallback=null});var i=new s(e,r);(p=new i(e,r)).record(),u("recording"),r.disableLogs||console.log("Initialized recorderType:",p.constructor.name,"for output-type:",r.type)}function n(e){if(e=e||function(){},p){if("paused"===o.state)return o.resumeRecording(),void setTimeout((function(){n(e)}),1);"recording"===o.state||r.disableLogs||console.warn('Recording state should be: "recording", however current state is: ',o.state),r.disableLogs||console.log("Stopped recording "+r.type+" stream."),"gif"!==r.type?p.stop(t):(p.stop(),t()),u("stopped")}else m();function t(t){if(p){Object.keys(p).forEach((function(e){"function"!=typeof p[e]&&(o[e]=p[e])}));var i=p.blob;if(!i){if(!t)throw"Recording failed.";p.blob=i=t}if(i&&!r.disableLogs&&console.log(i.type,"->",y(i.size)),e){var s;try{s=h.createObjectURL(i)}catch(e){}"function"==typeof e.call?e.call(o,s):e(s)}r.autoWriteToDisk&&d((function(e){var t={};t[r.type+"Blob"]=e,D.Store(t)}))}else"function"==typeof e.call?e.call(o,""):e("")}}function l(e){postMessage((new FileReaderSync).readAsDataURL(e))}function d(e,t){if(!e)throw"Pass a callback function over getDataURL.";var i=t?t.blob:(p||{}).blob;if(!i)return r.disableLogs||console.warn("Blob encoder did not finish its job yet."),void setTimeout((function(){d(e,t)}),1e3);if("undefined"==typeof Worker||navigator.mozGetUserMedia){var s=new FileReader;s.readAsDataURL(i),s.onload=function(t){e(t.target.result)}}else{var o=function(e){try{var t=h.createObjectURL(new Blob([e.toString(),"this.onmessage = function (eee) {"+e.name+"(eee.data);}"],{type:"application/javascript"})),i=new Worker(t);return h.revokeObjectURL(t),i}catch(e){}}(l);o.onmessage=function(t){e(t.data)},o.postMessage(i)}}function c(e){e=e||0,"paused"!==o.state?"stopped"!==o.state&&(e>=o.recordingDuration?n(o.onRecordingStopped):(e+=1e3,setTimeout((function(){c(e)}),1e3))):setTimeout((function(){c(e)}),1e3)}function u(e){o&&(o.state=e,"function"==typeof o.onStateChanged.call?o.onStateChanged.call(o,e):o.onStateChanged(e))}var p,f='It seems that recorder is destroyed or "startRecording" is not invoked for '+r.type+" recorder.";function m(){!0!==r.disableLogs&&console.warn(f)}var g={startRecording:function(t){return r.disableLogs||console.log("RecordRTC version: ",o.version),t&&(r=new i(e,t)),r.disableLogs||console.log("started recording "+r.type+" stream."),p?(p.clearRecordedData(),p.record(),u("recording"),o.recordingDuration&&c(),o):(a((function(){o.recordingDuration&&c()})),o)},stopRecording:n,pauseRecording:function(){p?"recording"===o.state?(u("paused"),p.pause(),r.disableLogs||console.log("Paused recording.")):r.disableLogs||console.warn("Unable to pause the recording. Recording state: ",o.state):m()},resumeRecording:function(){p?"paused"===o.state?(u("recording"),p.resume(),r.disableLogs||console.log("Resumed recording.")):r.disableLogs||console.warn("Unable to resume the recording. Recording state: ",o.state):m()},initRecorder:a,setRecordingDuration:function(e,t){if(void 0===e)throw"recordingDuration is required.";if("number"!=typeof e)throw"recordingDuration must be a number.";return o.recordingDuration=e,o.onRecordingStopped=t||function(){},{onRecordingStopped:function(e){o.onRecordingStopped=e}}},clearRecordedData:function(){p?(p.clearRecordedData(),r.disableLogs||console.log("Cleared old recorded data.")):m()},getBlob:function(){if(p)return p.blob;m()},getDataURL:d,toURL:function(){if(p)return h.createObjectURL(p.blob);m()},getInternalRecorder:function(){return p},save:function(e){p?A(p.blob,e):m()},getFromDisk:function(e){p?t.getFromDisk(r.type,e):m()},setAdvertisementArray:function(e){r.advertisement=[];for(var t=e.length,i=0;i-1&&"netscape"in window&&/ rv:/.test(navigator.userAgent),f=!u&&!c&&!!navigator.webkitGetUserMedia||b()||-1!==navigator.userAgent.toLowerCase().indexOf("chrome/"),m=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);m&&!f&&-1!==navigator.userAgent.indexOf("CriOS")&&(m=!1,f=!0);var g=window.MediaStream;function y(e){if(0===e)return"0 Bytes";var t=parseInt(Math.floor(Math.log(e)/Math.log(1e3)),10);return(e/Math.pow(1e3,t)).toPrecision(3)+" "+["Bytes","KB","MB","GB","TB"][t]}function A(e,t){if(!e)throw"Blob object is required.";if(!e.type)try{e.type="video/webm"}catch(e){}var i=(e.type||"video/webm").split("/")[1];if(-1!==i.indexOf(";")&&(i=i.split(";")[0]),t&&-1!==t.indexOf(".")){var s=t.split(".");t=s[0],i=s[1]}var r=(t||Math.round(9999999999*Math.random())+888888888)+"."+i;if(void 0!==navigator.msSaveOrOpenBlob)return navigator.msSaveOrOpenBlob(e,r);if(void 0!==navigator.msSaveBlob)return navigator.msSaveBlob(e,r);var o=document.createElement("a");o.href=h.createObjectURL(e),o.download=r,o.style="display:none;opacity:0;color:transparent;",(document.body||document.documentElement).appendChild(o),"function"==typeof o.click?o.click():(o.target="_blank",o.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}))),h.revokeObjectURL(o.href)}function b(){return"undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type||(!("undefined"==typeof process||"object"!=typeof process.versions||!process.versions.electron)||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}function v(e,t){return e&&e.getTracks?e.getTracks().filter((function(e){return e.kind===(t||"audio")})):[]}function _(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}void 0===g&&"undefined"!=typeof webkitMediaStream&&(g=webkitMediaStream),void 0!==g&&void 0===g.prototype.stop&&(g.prototype.stop=function(){this.getTracks().forEach((function(e){e.stop()}))}),t.invokeSaveAsDialog=A,t.getTracks=v,t.getSeekableBlob=function(e,t){if("undefined"==typeof EBML)throw new Error("Please link: https://www.webrtc-experiment.com/EBML.js");var i=new EBML.Reader,s=new EBML.Decoder,r=EBML.tools,o=new FileReader;o.onload=function(e){s.decode(this.result).forEach((function(e){i.read(e)})),i.stop();var o=r.makeMetadataSeekable(i.metadatas,i.duration,i.cues),a=this.result.slice(i.metadataSize),n=new Blob([o,a],{type:"video/webm"});t(n)},o.readAsArrayBuffer(e)},t.bytesToSize=y,t.isElectron=b;var S={};function E(){if(p||m||c)return!0;var e,t,i=navigator.userAgent,s=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10);return(f||u)&&(e=i.indexOf("Chrome"),s=i.substring(e+7)),-1!==(t=s.indexOf(";"))&&(s=s.substring(0,t)),-1!==(t=s.indexOf(" "))&&(s=s.substring(0,t)),r=parseInt(""+s,10),isNaN(r)&&(s=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10)),r>=49}function w(e,t){var i=this;if(void 0===e)throw'First argument "MediaStream" is required.';if("undefined"==typeof MediaRecorder)throw"Your browser does not support the Media Recorder API. Please try other modules e.g. WhammyRecorder or StereoAudioRecorder.";if("audio"===(t=t||{mimeType:"video/webm"}).type){var s;if(v(e,"video").length&&v(e,"audio").length)navigator.mozGetUserMedia?(s=new g).addTrack(v(e,"audio")[0]):s=new g(v(e,"audio")),e=s;t.mimeType&&-1!==t.mimeType.toString().toLowerCase().indexOf("audio")||(t.mimeType=f?"audio/webm":"audio/ogg"),t.mimeType&&"audio/ogg"!==t.mimeType.toString().toLowerCase()&&navigator.mozGetUserMedia&&(t.mimeType="audio/ogg")}var r,o=[];function a(){i.timestamps.push((new Date).getTime()),"function"==typeof t.onTimeStamp&&t.onTimeStamp(i.timestamps[i.timestamps.length-1],i.timestamps)}function n(e){return r&&r.mimeType?r.mimeType:e.mimeType||"video/webm"}function l(){o=[],r=null,i.timestamps=[]}this.getArrayOfBlobs=function(){return o},this.record=function(){i.blob=null,i.clearRecordedData(),i.timestamps=[],d=[],o=[];var s=t;t.disableLogs||console.log("Passing following config over MediaRecorder API.",s),r&&(r=null),f&&!E()&&(s="video/vp8"),"function"==typeof MediaRecorder.isTypeSupported&&s.mimeType&&(MediaRecorder.isTypeSupported(s.mimeType)||(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",s.mimeType),s.mimeType="audio"===t.type?"audio/webm":"video/webm"));try{r=new MediaRecorder(e,s),t.mimeType=s.mimeType}catch(t){r=new MediaRecorder(e)}s.mimeType&&!MediaRecorder.isTypeSupported&&"canRecordMimeType"in r&&!1===r.canRecordMimeType(s.mimeType)&&(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",s.mimeType)),r.ondataavailable=function(e){if(e.data&&d.push("ondataavailable: "+y(e.data.size)),"number"!=typeof t.timeSlice)!e.data||!e.data.size||e.data.size<100||i.blob?i.recordingCallback&&(i.recordingCallback(new Blob([],{type:n(s)})),i.recordingCallback=null):(i.blob=t.getNativeBlob?e.data:new Blob([e.data],{type:n(s)}),i.recordingCallback&&(i.recordingCallback(i.blob),i.recordingCallback=null));else if(e.data&&e.data.size&&(o.push(e.data),a(),"function"==typeof t.ondataavailable)){var r=t.getNativeBlob?e.data:new Blob([e.data],{type:n(s)});t.ondataavailable(r)}},r.onstart=function(){d.push("started")},r.onpause=function(){d.push("paused")},r.onresume=function(){d.push("resumed")},r.onstop=function(){d.push("stopped")},r.onerror=function(e){e&&(e.name||(e.name="UnknownError"),d.push("error: "+e),t.disableLogs||(-1!==e.name.toString().toLowerCase().indexOf("invalidstate")?console.error("The MediaRecorder is not in a state in which the proposed operation is allowed to be executed.",e):-1!==e.name.toString().toLowerCase().indexOf("notsupported")?console.error("MIME type (",s.mimeType,") is not supported.",e):-1!==e.name.toString().toLowerCase().indexOf("security")?console.error("MediaRecorder security error",e):"OutOfMemory"===e.name?console.error("The UA has exhaused the available memory. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"IllegalStreamModification"===e.name?console.error("A modification to the stream has occurred that makes it impossible to continue recording. An example would be the addition of a Track while recording is occurring. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"OtherRecordingError"===e.name?console.error("Used for an fatal error other than those listed above. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"GenericError"===e.name?console.error("The UA cannot provide the codec or recording option that has been requested.",e):console.error("MediaRecorder Error",e)),function(e){if(!i.manuallyStopped&&r&&"inactive"===r.state)return delete t.timeslice,void r.start(6e5);setTimeout(void 0,1e3)}(),"inactive"!==r.state&&"stopped"!==r.state&&r.stop())},"number"==typeof t.timeSlice?(a(),r.start(t.timeSlice)):r.start(36e5),t.initCallback&&t.initCallback()},this.timestamps=[],this.stop=function(e){e=e||function(){},i.manuallyStopped=!0,r&&(this.recordingCallback=e,"recording"===r.state&&r.stop(),"number"==typeof t.timeSlice&&setTimeout((function(){i.blob=new Blob(o,{type:n(t)}),i.recordingCallback(i.blob)}),100))},this.pause=function(){r&&"recording"===r.state&&r.pause()},this.resume=function(){r&&"paused"===r.state&&r.resume()},this.clearRecordedData=function(){r&&"recording"===r.state&&i.stop(l),l()},this.getInternalRecorder=function(){return r},this.blob=null,this.getState=function(){return r&&r.state||"inactive"};var d=[];this.getAllStates=function(){return d},void 0===t.checkForInactiveTracks&&(t.checkForInactiveTracks=!1);i=this;!function s(){if(r&&!1!==t.checkForInactiveTracks)return!1===function(){if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}()?(t.disableLogs||console.log("MediaStream seems stopped."),void i.stop()):void setTimeout(s,1e3)}(),this.name="MediaStreamRecorder",this.toString=function(){return this.name}}function T(e,i){if(!v(e,"audio").length)throw"Your stream has no audio tracks.";var s,r=this,o=[],a=[],n=!1,l=0,d=2,c=(i=i||{}).desiredSampRate;function u(){if(!1===i.checkForInactiveTracks)return!0;if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}function p(e,t){function i(e,t){var i,s=e.numberOfAudioChannels,r=e.leftBuffers.slice(0),o=e.rightBuffers.slice(0),a=e.sampleRate,n=e.internalInterleavedLength,l=e.desiredSampRate;function d(e,t,i){var s=Math.round(e.length*(t/i)),r=[],o=Number((e.length-1)/(s-1));r[0]=e[0];for(var a=1;a96e3)&&(i.disableLogs||console.log("sample-rate must be under range 22050 and 96000.")),i.disableLogs||i.desiredSampRate&&console.log("Desired sample-rate: "+i.desiredSampRate);var b=!1;function _(){o=[],a=[],l=0,E=!1,n=!1,b=!1,f=null,r.leftchannel=o,r.rightchannel=a,r.numberOfAudioChannels=d,r.desiredSampRate=c,r.sampleRate=A,r.recordingLength=l,w={left:[],right:[],recordingLength:0}}function S(){s&&(s.onaudioprocess=null,s.disconnect(),s=null),m&&(m.disconnect(),m=null),_()}this.pause=function(){b=!0},this.resume=function(){if(!1===u())throw"Please make sure MediaStream is active.";if(!n)return i.disableLogs||console.log("Seems recording has been restarted."),void this.record();b=!1},this.clearRecordedData=function(){i.checkForInactiveTracks=!1,n&&this.stop(S),S()},this.name="StereoAudioRecorder",this.toString=function(){return this.name};var E=!1;s.onaudioprocess=function(e){if(!b)if(!1===u()&&(i.disableLogs||console.log("MediaStream seems stopped."),s.disconnect(),n=!1),n){E||(E=!0,i.onAudioProcessStarted&&i.onAudioProcessStarted(),i.initCallback&&i.initCallback());var t=e.inputBuffer.getChannelData(0),h=new Float32Array(t);if(o.push(h),2===d){var c=e.inputBuffer.getChannelData(1),p=new Float32Array(c);a.push(p)}l+=y,r.recordingLength=l,void 0!==i.timeSlice&&(w.recordingLength+=y,w.left.push(h),2===d&&w.right.push(p))}else m&&(m.disconnect(),m=null)},f.createMediaStreamDestination?s.connect(f.createMediaStreamDestination()):s.connect(f.destination),this.leftchannel=o,this.rightchannel=a,this.numberOfAudioChannels=d,this.desiredSampRate=c,this.sampleRate=A,r.recordingLength=l;var w={left:[],right:[],recordingLength:0};function T(){n&&"function"==typeof i.ondataavailable&&void 0!==i.timeSlice&&(w.left.length?(p({desiredSampRate:c,sampleRate:A,numberOfAudioChannels:d,internalInterleavedLength:w.recordingLength,leftBuffers:w.left,rightBuffers:1===d?[]:w.right},(function(e,t){var s=new Blob([t],{type:"audio/wav"});i.ondataavailable(s),setTimeout(T,i.timeSlice)})),w={left:[],right:[],recordingLength:0}):setTimeout(T,i.timeSlice))}}function k(e,t){if("undefined"==typeof html2canvas)throw"Please link: https://www.webrtc-experiment.com/screenshot.js";(t=t||{}).frameInterval||(t.frameInterval=10);var i=!1;["captureStream","mozCaptureStream","webkitCaptureStream"].forEach((function(e){e in document.createElement("canvas")&&(i=!0)}));var s,r,o,a=!(!window.webkitRTCPeerConnection&&!window.webkitGetUserMedia||!window.chrome),n=50,l=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);if(a&&l&&l[2]&&(n=parseInt(l[2],10)),a&&n<52&&(i=!1),t.useWhammyRecorder&&(i=!1),i)if(t.disableLogs||console.log("Your browser supports both MediRecorder API and canvas.captureStream!"),e instanceof HTMLCanvasElement)s=e;else{if(!(e instanceof CanvasRenderingContext2D))throw"Please pass either HTMLCanvasElement or CanvasRenderingContext2D.";s=e.canvas}else navigator.mozGetUserMedia&&(t.disableLogs||console.error("Canvas recording is NOT supported in Firefox."));this.record=function(){if(o=!0,i&&!t.useWhammyRecorder){var e;"captureStream"in s?e=s.captureStream(25):"mozCaptureStream"in s?e=s.mozCaptureStream(25):"webkitCaptureStream"in s&&(e=s.webkitCaptureStream(25));try{var a=new g;a.addTrack(v(e,"video")[0]),e=a}catch(e){}if(!e)throw"captureStream API are NOT available.";(r=new w(e,{mimeType:t.mimeType||"video/webm"})).record()}else p.frames=[],u=(new Date).getTime(),c();t.initCallback&&t.initCallback()},this.getWebPImages=function(i){if("canvas"===e.nodeName.toLowerCase()){var s=p.frames.length;p.frames.forEach((function(e,i){var r=s-i;t.disableLogs||console.log(r+"/"+s+" frames remaining"),t.onEncodingCallback&&t.onEncodingCallback(r,s);var o=e.image.toDataURL("image/webp",1);p.frames[i].image=o})),t.disableLogs||console.log("Generating WebM"),i()}else i()},this.stop=function(e){o=!1;var s=this;i&&r?r.stop(e):this.getWebPImages((function(){p.compile((function(i){t.disableLogs||console.log("Recording finished!"),s.blob=i,s.blob.forEach&&(s.blob=new Blob([],{type:"video/webm"})),e&&e(s.blob),p.frames=[]}))}))};var d=!1;function h(){p.frames=[],o=!1,d=!1}function c(){if(d)return u=(new Date).getTime(),setTimeout(c,500);if("canvas"===e.nodeName.toLowerCase()){var i=(new Date).getTime()-u;return u=(new Date).getTime(),p.frames.push({image:(s=document.createElement("canvas"),r=s.getContext("2d"),s.width=e.width,s.height=e.height,r.drawImage(e,0,0),s),duration:i}),void(o&&setTimeout(c,t.frameInterval))}var s,r;html2canvas(e,{grabMouse:void 0===t.showMousePointer||t.showMousePointer,onrendered:function(e){var i=(new Date).getTime()-u;if(!i)return setTimeout(c,t.frameInterval);u=(new Date).getTime(),p.frames.push({image:e.toDataURL("image/webp",1),duration:i}),o&&setTimeout(c,t.frameInterval)}})}this.pause=function(){d=!0,r instanceof w&&r.pause()},this.resume=function(){d=!1,r instanceof w?r.resume():o||this.record()},this.clearRecordedData=function(){o&&this.stop(h),h()},this.name="CanvasRecorder",this.toString=function(){return this.name};var u=(new Date).getTime(),p=new C.Video(100)}function L(e,t){function i(e){e=void 0!==e?e:10;var t=(new Date).getTime()-l;return t?o?(l=(new Date).getTime(),setTimeout(i,100)):(l=(new Date).getTime(),n.paused&&n.play(),c.drawImage(n,0,0,h.width,h.height),d.frames.push({duration:t,image:h.toDataURL("image/webp")}),void(r||setTimeout(i,e,e))):setTimeout(i,e,e)}function s(e,t,i,s,r){var o=document.createElement("canvas");o.width=h.width,o.height=h.height;var a=o.getContext("2d"),n=[],l=-1===t,d=t&&t>0&&t<=e.length?t:e.length,c=0,u=0,p=0,f=Math.sqrt(Math.pow(255,2)+Math.pow(255,2)+Math.pow(255,2)),m=i&&i>=0&&i<=1?i:0,g=s&&s>=0&&s<=1?s:0,y=!1;!function(e){var t=-1,i=e.length;!function s(){++t!==i?setTimeout((function(){e.functionToLoop(s,t)}),1):e.callback()}()}({length:d,functionToLoop:function(t,i){var s,r,o,d=function(){!y&&o-s<=o*g||(l&&(y=!0),n.push(e[i])),t()};if(y)d();else{var A=new Image;A.onload=function(){a.drawImage(A,0,0,h.width,h.height);var e=a.getImageData(0,0,h.width,h.height);s=0,r=e.data.length,o=e.data.length/4;for(var t=0;t127)throw"TrackNumber > 127 not supported";return[128|e.trackNum,e.timecode>>8,255&e.timecode,t].map((function(e){return String.fromCharCode(e)})).join("")+e.frame}({discardable:0,frame:e.data.slice(4),invisible:0,keyframe:1,lacing:0,trackNum:1,timecode:Math.round(t)});return t+=e.duration,{data:i,id:163}})))}function i(e){for(var t=[];e>0;)t.push(255&e),e>>=8;return new Uint8Array(t.reverse())}function s(e){var t=[];e=(e.length%8?new Array(9-e.length%8).join("0"):"")+e;for(var i=0;i1?2*o[0].width:o[0].width;var n=1;3!==e&&4!==e||(n=2),5!==e&&6!==e||(n=3),7!==e&&8!==e||(n=4),9!==e&&10!==e||(n=5),r.height=o[0].height*n}else r.width=a.width||360,r.height=a.height||240;t&&t instanceof HTMLVideoElement&&u(t),o.forEach((function(e,t){u(e,t)})),setTimeout(c,a.frameInterval)}}function u(e,t){if(!s){var i=0,r=0,a=e.width,n=e.height;1===t&&(i=e.width),2===t&&(r=e.height),3===t&&(i=e.width,r=e.height),4===t&&(r=2*e.height),5===t&&(i=e.width,r=2*e.height),6===t&&(r=3*e.height),7===t&&(i=e.width,r=3*e.height),void 0!==e.stream.left&&(i=e.stream.left),void 0!==e.stream.top&&(r=e.stream.top),void 0!==e.stream.width&&(a=e.stream.width),void 0!==e.stream.height&&(n=e.stream.height),o.drawImage(e,i,r,a,n),"function"==typeof e.stream.onRender&&e.stream.onRender(o,i,r,a,n,t)}}function p(e){var i=document.createElement("video");return function(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}(e,i),i.className=t,i.muted=!0,i.volume=0,i.width=e.width||a.width||360,i.height=e.height||a.height||240,i.play(),i}function f(t){i=[],(t=t||e).forEach((function(e){if(e.getTracks().filter((function(e){return"video"===e.kind})).length){var t=p(e);t.stream=e,i.push(t)}}))}void 0!==n?h.AudioContext=n:"undefined"!=typeof webkitAudioContext&&(h.AudioContext=webkitAudioContext),this.startDrawingFrames=function(){c()},this.appendStreams=function(t){if(!t)throw"First parameter is required.";t instanceof Array||(t=[t]),t.forEach((function(t){var s=new d;if(t.getTracks().filter((function(e){return"video"===e.kind})).length){var r=p(t);r.stream=t,i.push(r),s.addTrack(t.getTracks().filter((function(e){return"video"===e.kind}))[0])}if(t.getTracks().filter((function(e){return"audio"===e.kind})).length){var o=a.audioContext.createMediaStreamSource(t);a.audioDestination=a.audioContext.createMediaStreamDestination(),o.connect(a.audioDestination),s.addTrack(a.audioDestination.stream.getTracks().filter((function(e){return"audio"===e.kind}))[0])}e.push(s)}))},this.releaseStreams=function(){i=[],s=!0,a.gainNode&&(a.gainNode.disconnect(),a.gainNode=null),a.audioSources.length&&(a.audioSources.forEach((function(e){e.disconnect()})),a.audioSources=[]),a.audioDestination&&(a.audioDestination.disconnect(),a.audioDestination=null),a.audioContext&&a.audioContext.close(),a.audioContext=null,o.clearRect(0,0,r.width,r.height),r.stream&&(r.stream.stop(),r.stream=null)},this.resetVideoStreams=function(e){!e||e instanceof Array||(e=[e]),f(e)},this.name="MultiStreamsMixer",this.toString=function(){return this.name},this.getMixedStream=function(){s=!1;var t=function(){var e;f(),"captureStream"in r?e=r.captureStream():"mozCaptureStream"in r?e=r.mozCaptureStream():a.disableLogs||console.error("Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features");var t=new d;return e.getTracks().filter((function(e){return"video"===e.kind})).forEach((function(e){t.addTrack(e)})),r.stream=t,t}(),i=function(){h.AudioContextConstructor||(h.AudioContextConstructor=new h.AudioContext);a.audioContext=h.AudioContextConstructor,a.audioSources=[],!0===a.useGainNode&&(a.gainNode=a.audioContext.createGain(),a.gainNode.connect(a.audioContext.destination),a.gainNode.gain.value=0);var t=0;if(e.forEach((function(e){if(e.getTracks().filter((function(e){return"audio"===e.kind})).length){t++;var i=a.audioContext.createMediaStreamSource(e);!0===a.useGainNode&&i.connect(a.gainNode),a.audioSources.push(i)}})),!t)return;return a.audioDestination=a.audioContext.createMediaStreamDestination(),a.audioSources.forEach((function(e){e.connect(a.audioDestination)})),a.audioDestination.stream}();return i&&i.getTracks().filter((function(e){return"audio"===e.kind})).forEach((function(e){t.addTrack(e)})),e.forEach((function(e){e.fullcanvas})),t}}function P(e,t){e=e||[];var i,s,r=this;(t=t||{elementClass:"multi-streams-mixer",mimeType:"video/webm",video:{width:360,height:240}}).frameInterval||(t.frameInterval=10),t.video||(t.video={}),t.video.width||(t.video.width=360),t.video.height||(t.video.height=240),this.record=function(){var r;i=new R(e,t.elementClass||"multi-streams-mixer"),(r=[],e.forEach((function(e){v(e,"video").forEach((function(e){r.push(e)}))})),r).length&&(i.frameInterval=t.frameInterval||10,i.width=t.video.width||360,i.height=t.video.height||240,i.startDrawingFrames()),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()),(s=new w(i.getMixedStream(),t)).record()},this.stop=function(e){s&&s.stop((function(t){r.blob=t,e(t),r.clearRecordedData()}))},this.pause=function(){s&&s.pause()},this.resume=function(){s&&s.resume()},this.clearRecordedData=function(){s&&(s.clearRecordedData(),s=null),i&&(i.releaseStreams(),i=null)},this.addStreams=function(r){if(!r)throw"First parameter is required.";r instanceof Array||(r=[r]),e.concat(r),s&&i&&(i.appendStreams(r),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()))},this.resetVideoStreams=function(e){i&&(!e||e instanceof Array||(e=[e]),i.resetVideoStreams(e))},this.getMixer=function(){return i},this.name="MultiStreamRecorder",this.toString=function(){return this.name}}function B(e,t){var i,s,r;function o(){return new ReadableStream({start:function(s){var r=document.createElement("canvas"),o=document.createElement("video"),a=!0;o.srcObject=e,o.muted=!0,o.height=t.height,o.width=t.width,o.volume=0,o.onplaying=function(){r.width=t.width,r.height=t.height;var e=r.getContext("2d"),n=1e3/t.frameRate,l=setInterval((function(){if(i&&(clearInterval(l),s.close()),a&&(a=!1,t.onVideoProcessStarted&&t.onVideoProcessStarted()),e.drawImage(o,0,0),"closed"!==s._controlledReadableStream.state)try{s.enqueue(e.getImageData(0,0,t.width,t.height))}catch(e){}}),n)},o.play()}})}function a(e,l){if(!t.workerPath&&!l)return i=!1,void fetch("https://unpkg.com/webm-wasm@latest/dist/webm-worker.js").then((function(t){t.arrayBuffer().then((function(t){a(e,t)}))}));if(!t.workerPath&&l instanceof ArrayBuffer){var d=new Blob([l],{type:"text/javascript"});t.workerPath=h.createObjectURL(d)}t.workerPath||console.error("workerPath parameter is missing."),(s=new Worker(t.workerPath)).postMessage(t.webAssemblyPath||"https://unpkg.com/webm-wasm@latest/dist/webm-wasm.wasm"),s.addEventListener("message",(function(e){"READY"===e.data?(s.postMessage({width:t.width,height:t.height,bitrate:t.bitrate||1200,timebaseDen:t.frameRate||30,realtime:t.realtime}),o().pipeTo(new WritableStream({write:function(e){i?console.error("Got image, but recorder is finished!"):s.postMessage(e.data.buffer,[e.data.buffer])}}))):e.data&&(r||n.push(e.data))}))}"undefined"!=typeof ReadableStream&&"undefined"!=typeof WritableStream||console.error("Following polyfill is strongly recommended: https://unpkg.com/@mattiasbuelens/web-streams-polyfill/dist/polyfill.min.js"),(t=t||{}).width=t.width||640,t.height=t.height||480,t.frameRate=t.frameRate||30,t.bitrate=t.bitrate||1200,t.realtime=t.realtime||!0,this.record=function(){n=[],r=!1,this.blob=null,a(e),"function"==typeof t.initCallback&&t.initCallback()},this.pause=function(){r=!0},this.resume=function(){r=!1};var n=[];this.stop=function(e){i=!0;var t=this;!function(e){s?(s.addEventListener("message",(function(t){null===t.data&&(s.terminate(),s=null,e&&e())})),s.postMessage(null)):e&&e()}((function(){t.blob=new Blob(n,{type:"video/webm"}),e(t.blob)}))},this.name="WebAssemblyRecorder",this.toString=function(){return this.name},this.clearRecordedData=function(){n=[],r=!1,this.blob=null},this.blob=null}t.DiskStorage=D,t.GifRecorder=x,t.MultiStreamRecorder=P,t.RecordRTCPromisesHandler=function(e,i){if(!this)throw'Use "new RecordRTCPromisesHandler()"';if(void 0===e)throw'First argument "MediaStream" is required.';var s=this;s.recordRTC=new t(e,i),this.startRecording=function(){return new Promise((function(e,t){try{s.recordRTC.startRecording(),e()}catch(e){t(e)}}))},this.stopRecording=function(){return new Promise((function(e,t){try{s.recordRTC.stopRecording((function(i){s.blob=s.recordRTC.getBlob(),s.blob&&s.blob.size?e(i):t("Empty blob.",s.blob)}))}catch(e){t(e)}}))},this.pauseRecording=function(){return new Promise((function(e,t){try{s.recordRTC.pauseRecording(),e()}catch(e){t(e)}}))},this.resumeRecording=function(){return new Promise((function(e,t){try{s.recordRTC.resumeRecording(),e()}catch(e){t(e)}}))},this.getDataURL=function(e){return new Promise((function(e,t){try{s.recordRTC.getDataURL((function(t){e(t)}))}catch(e){t(e)}}))},this.getBlob=function(){return new Promise((function(e,t){try{e(s.recordRTC.getBlob())}catch(e){t(e)}}))},this.getInternalRecorder=function(){return new Promise((function(e,t){try{e(s.recordRTC.getInternalRecorder())}catch(e){t(e)}}))},this.reset=function(){return new Promise((function(e,t){try{e(s.recordRTC.reset())}catch(e){t(e)}}))},this.destroy=function(){return new Promise((function(e,t){try{e(s.recordRTC.destroy())}catch(e){t(e)}}))},this.getState=function(){return new Promise((function(e,t){try{e(s.recordRTC.getState())}catch(e){t(e)}}))},this.blob=null,this.version="5.6.2"},t.WebAssemblyRecorder=B}));class Cn{static _ebsp2rbsp(e){let t=e,i=t.byteLength,s=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(s[r]=t[e],r++);return new Uint8Array(s.buffer,0,r)}static parseSPS(e){let t=Cn._ebsp2rbsp(e),i=new Dr(t);i.readByte();let s=i.readByte();i.readByte();let r=i.readByte();i.readUEG();let o=Cn.getProfileString(s),a=Cn.getLevelString(r),n=1,l=420,d=[0,420,422,444],h=8;if((100===s||110===s||122===s||244===s||44===s||83===s||86===s||118===s||128===s||138===s||144===s)&&(n=i.readUEG(),3===n&&i.readBits(1),n<=3&&(l=d[n]),h=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool())){let e=3!==n?8:12;for(let t=0;t0&&e<16?(v=t[e-1],_=s[e-1]):255===e&&(v=i.readByte()<<8|i.readByte(),_=i.readByte()<<8|i.readByte())}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool()&&i.readBits(24)),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool()){let e=i.readBits(32),t=i.readBits(32);E=i.readBool(),w=t,T=2*e,S=w/T}}let k=1;1===v&&1===_||(k=v/_);let L=0,C=0;if(0===n)L=1,C=2-m;else{L=3===n?1:2,C=(1===n?2:1)*(2-m)}let D=16*(p+1),x=16*(f+1)*(2-m);D-=(g+y)*L,x-=(A+b)*C;let R=Math.ceil(D*k);return i.destroy(),i=null,{profile_string:o,level_string:a,bit_depth:h,ref_frames:u,chroma_format:l,chroma_format_string:Cn.getChromaFormatString(l),frame_rate:{fixed:E,fps:S,fps_den:T,fps_num:w},sar_ratio:{width:v,height:_},codec_size:{width:D,height:x},present_size:{width:R,height:x}}}static parseSPS$2(e){let t=e.subarray(1,4),i="avc1.";for(let e=0;e<3;e++){let s=t[e].toString(16);s.length<2&&(s="0"+s),i+=s}let s=Cn._ebsp2rbsp(e),r=new Dr(s);r.readByte();let o=r.readByte();r.readByte();let a=r.readByte();r.readUEG();let n=Cn.getProfileString(o),l=Cn.getLevelString(a),d=1,h=420,c=[0,420,422,444],u=8,p=8;if((100===o||110===o||122===o||244===o||44===o||83===o||86===o||118===o||128===o||138===o||144===o)&&(d=r.readUEG(),3===d&&r.readBits(1),d<=3&&(h=c[d]),u=r.readUEG()+8,p=r.readUEG()+8,r.readBits(1),r.readBool())){let e=3!==d?8:12;for(let t=0;t0&&e<16?(E=t[e-1],w=i[e-1]):255===e&&(E=r.readByte()<<8|r.readByte(),w=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);k=r.readBool(),L=t,C=2*e,T=L/C}}let D=1;1===E&&1===w||(D=E/w);let x=0,R=0;if(0===d)x=1,R=2-A;else{x=3===d?1:2,R=(1===d?2:1)*(2-A)}let P=16*(g+1),B=16*(y+1)*(2-A);P-=(b+v)*x,B-=(_+S)*R;let I=Math.ceil(P*D);return r.destroy(),r=null,{codec_mimetype:i,profile_idc:o,level_idc:a,profile_string:n,level_string:l,chroma_format_idc:d,bit_depth:u,bit_depth_luma:u,bit_depth_chroma:p,ref_frames:m,chroma_format:h,chroma_format_string:Cn.getChromaFormatString(h),frame_rate:{fixed:k,fps:T,fps_den:C,fps_num:L},sar_ratio:{width:E,height:w},codec_size:{width:P,height:B},present_size:{width:I,height:B}}}static _skipScalingList(e,t){let i=8,s=8,r=0;for(let o=0;o=this.buflen)return this.iserro=!0,0;this.iserro=!1,i=this.bufoff+e>8?8-this.bufoff:e,t<<=i,t+=this.buffer[this.bufpos]>>8-this.bufoff-i&255>>8-i,this.bufoff+=i,e-=i,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,i=this.bufoff,s=this.read(e);return this.bufpos=t,this.bufoff=i,s}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),s=new Uint8Array(e+4);s.set(i,0),s.set(t.sps,4),t.sps=s}if(t.pps){const e=t.pps.byteLength,i=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),s=new Uint8Array(e+4);s.set(i,0),s.set(t.pps,4),t.pps=s}return t}function Rn(e){let{sps:t,pps:i}=e,s=8+t.byteLength+1+2+i.byteLength,r=!1;const o=Cn.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(r=!0,s+=4);let a=new Uint8Array(s);a[0]=1,a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=255,a[5]=225;let n=t.byteLength;a[6]=n>>>8,a[7]=255&n;let l=8;a.set(t,8),l+=n,a[l]=1;let d=i.byteLength;a[l+1]=d>>>8,a[l+2]=255&d,a.set(i,l+3),l+=3+d,r&&(a[l]=252|o.chroma_format_idc,a[l+1]=248|o.bit_depth_luma-8,a[l+2]=248|o.bit_depth_chroma-8,a[l+3]=0,l+=4);const h=[23,0,0,0,0],c=new Uint8Array(h.length+a.byteLength);return c.set(h,0),c.set(a,h.length),c}function Pn(e,t){let i=[];i[0]=t?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}function Bn(e){return 31&e[0]}function In(e){return e===Rt}function Mn(e){return!function(e){return e===kt||e===Lt}(e)&&!In(e)}function Fn(e){return e===Ct}class Un{constructor(e){this.data=e,this.eofFlag=!1,this.currentStartcodeOffset=this.findNextStartCodeOffset(0),this.eofFlag&&console.error("Could not find H264 startcode until payload end!")}findNextStartCodeOffset(e){let t=e,i=this.data;for(;;){if(t+3>=i.byteLength)return this.eofFlag=!0,i.byteLength;let e=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],s=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===e||1===s)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let i=this.currentStartcodeOffset;i+=1===(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3;let s=31&e[i],r=(128&e[i])>>>7,o=this.findNextStartCodeOffset(i);this.currentStartcodeOffset=o,s>=It||0===r&&(t={type:s,data:e.subarray(i,o)})}return t}}class On{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Nn=e=>{let t=e,i=t.byteLength,s=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(s[r]=t[e],r++);return new Uint8Array(s.buffer,0,r)},jn=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Gn{static _ebsp2rbsp(e){let t=e,i=t.byteLength,s=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(s[r]=t[e],r++);return new Uint8Array(s.buffer,0,r)}static parseVPS(e){let t=Gn._ebsp2rbsp(e),i=new Dr(t);return i.readByte(),i.readByte(),i.readBits(4),i.readBits(2),i.readBits(6),{num_temporal_layers:i.readBits(3)+1,temporal_id_nested:i.readBool()}}static parseSPS(e){let t=Gn._ebsp2rbsp(e),i=new Dr(t);i.readByte(),i.readByte();let s=0,r=0,o=0,a=0;i.readBits(4);let n=i.readBits(3);i.readBool();let l=i.readBits(2),d=i.readBool(),h=i.readBits(5),c=i.readByte(),u=i.readByte(),p=i.readByte(),f=i.readByte(),m=i.readByte(),g=i.readByte(),y=i.readByte(),A=i.readByte(),b=i.readByte(),v=i.readByte(),_=i.readByte(),S=[],E=[];for(let e=0;e0)for(let e=n;e<8;e++)i.readBits(2);for(let e=0;e1&&i.readSEG();for(let e=0;e0&&e<=16?(I=t[e-1],M=s[e-1]):255===e&&(I=i.readBits(16),M=i.readBits(16))}if(i.readBool()&&i.readBool(),i.readBool()){i.readBits(3),i.readBool(),i.readBool()&&(i.readByte(),i.readByte(),i.readByte())}if(i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool(),i.readBool(),i.readBool(),P=i.readBool(),P&&(i.readUEG(),i.readUEG(),i.readUEG(),i.readUEG()),i.readBool()){if(U=i.readBits(32),O=i.readBits(32),i.readBool()&&i.readUEG(),i.readBool()){let e=!1,t=!1,s=!1;e=i.readBool(),t=i.readBool(),(e||t)&&(s=i.readBool(),s&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),s&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(let r=0;r<=n;r++){let r=i.readBool();F=r;let o=!0,a=1;r||(o=i.readBool());let n=!1;if(o?i.readUEG():n=i.readBool(),n||(a=i.readUEG()+1),e){for(let e=0;e>6&3,i.general_tier_flag=e[1]>>5&1,i.general_profile_idc=31&e[1],i.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],i.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],i.general_constraint_indicator_flags=i.general_constraint_indicator_flags<<16|e[10]<<8|e[11],i.general_level_idc=e[12],i.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],i.parallelismType=3&e[15],i.chromaFormat=3&e[16],i.bitDepthLumaMinus8=7&e[17],i.bitDepthChromaMinus8=7&e[18],i.avgFrameRate=e[19]<<8|e[20],i.constantFrameRate=e[21]>>6&3,i.numTemporalLayers=e[21]>>3&7,i.temporalIdNested=e[21]>>2&1,i.lengthSizeMinusOne=3&e[21];let s=e[22],r=e.slice(23);for(let e=0;e0)for(let t=i;t<8;t++)e.read(2);s.sub_layer_profile_space=[],s.sub_layer_tier_flag=[],s.sub_layer_profile_idc=[],s.sub_layer_profile_compatibility_flag=[],s.sub_layer_progressive_source_flag=[],s.sub_layer_interlaced_source_flag=[],s.sub_layer_non_packed_constraint_flag=[],s.sub_layer_frame_only_constraint_flag=[],s.sub_layer_level_idc=[];for(let t=0;t{let t=Nn(e),i=new Dr(t);return i.readByte(),i.readByte(),i.readBits(4),i.readBits(2),i.readBits(6),{num_temporal_layers:i.readBits(3)+1,temporal_id_nested:i.readBool()}})(t),a=(e=>{let t=Nn(e),i=new Dr(t);i.readByte(),i.readByte();let s=0,r=0,o=0,a=0;i.readBits(4);let n=i.readBits(3);i.readBool();let l=i.readBits(2),d=i.readBool(),h=i.readBits(5),c=i.readByte(),u=i.readByte(),p=i.readByte(),f=i.readByte(),m=i.readByte(),g=i.readByte(),y=i.readByte(),A=i.readByte(),b=i.readByte(),v=i.readByte(),_=i.readByte(),S=[],E=[];for(let e=0;e0)for(let e=n;e<8;e++)i.readBits(2);for(let e=0;e1&&i.readSEG();for(let e=0;e0&&e<16?(I=t[e-1],M=s[e-1]):255===e&&(I=i.readBits(16),M=i.readBits(16))}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(3),i.readBool(),i.readBool()&&(i.readByte(),i.readByte(),i.readByte())),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool(),i.readBool(),i.readBool(),P=i.readBool(),P&&(s+=i.readUEG(),r+=i.readUEG(),o+=i.readUEG(),a+=i.readUEG()),i.readBool()&&(U=i.readBits(32),O=i.readBits(32),i.readBool()&&(i.readUEG(),i.readBool()))){let e=!1,t=!1,s=!1;e=i.readBool(),t=i.readBool(),(e||t)&&(s=i.readBool(),s&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),s&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(let r=0;r<=n;r++){let r=i.readBool();F=r;let o=!1,a=1;r||(o=i.readBool());let n=!1;if(o?i.readSEG():n=i.readBool(),n||(cpbcnt=i.readUEG()+1),e)for(let e=0;e{let t=Nn(e),i=new Dr(t);i.readByte(),i.readByte(),i.readUEG(),i.readUEG(),i.readBool(),i.readBool(),i.readBits(3),i.readBool(),i.readBool(),i.readUEG(),i.readUEG(),i.readSEG(),i.readBool(),i.readBool(),i.readBool()&&i.readUEG(),i.readSEG(),i.readSEG(),i.readBool(),i.readBool(),i.readBool(),i.readBool();let s=i.readBool(),r=i.readBool(),o=1;return r&&s?o=0:r?o=3:s&&(o=2),{parallelismType:o}})(i);r=Object.assign(r,o,a,n);let l=23+(5+t.byteLength)+(5+s.byteLength)+(5+i.byteLength),d=new Uint8Array(l);d[0]=1,d[1]=(3&r.general_profile_space)<<6|(r.general_tier_flag?1:0)<<5|31&r.general_profile_idc,d[2]=r.general_profile_compatibility_flags_1||0,d[3]=r.general_profile_compatibility_flags_2||0,d[4]=r.general_profile_compatibility_flags_3||0,d[5]=r.general_profile_compatibility_flags_4||0,d[6]=r.general_constraint_indicator_flags_1||0,d[7]=r.general_constraint_indicator_flags_2||0,d[8]=r.general_constraint_indicator_flags_3||0,d[9]=r.general_constraint_indicator_flags_4||0,d[10]=r.general_constraint_indicator_flags_5||0,d[11]=r.general_constraint_indicator_flags_6||0,d[12]=60,d[13]=240|(3840&r.min_spatial_segmentation_idc)>>8,d[14]=255&r.min_spatial_segmentation_idc,d[15]=252|3&r.parallelismType,d[16]=252|3&r.chroma_format_idc,d[17]=248|7&r.bit_depth_luma_minus8,d[18]=248|7&r.bit_depth_chroma_minus8,d[19]=0,d[20]=0,d[21]=(3&r.constant_frame_rate)<<6|(7&r.num_temporal_layers)<<3|(r.temporal_id_nested?1:0)<<2|3,d[22]=3,d[23]=128|Gt,d[24]=0,d[25]=1,d[26]=(65280&t.byteLength)>>8,d[27]=(255&t.byteLength)>>0,d.set(t,28),d[23+(5+t.byteLength)+0]=128|Wt,d[23+(5+t.byteLength)+1]=0,d[23+(5+t.byteLength)+2]=1,d[23+(5+t.byteLength)+3]=(65280&s.byteLength)>>8,d[23+(5+t.byteLength)+4]=(255&s.byteLength)>>0,d.set(s,23+(5+t.byteLength)+5),d[23+(5+t.byteLength+5+s.byteLength)+0]=128|Ht,d[23+(5+t.byteLength+5+s.byteLength)+1]=0,d[23+(5+t.byteLength+5+s.byteLength)+2]=1,d[23+(5+t.byteLength+5+s.byteLength)+3]=(65280&i.byteLength)>>8,d[23+(5+t.byteLength+5+s.byteLength)+4]=(255&i.byteLength)>>0,d.set(i,23+(5+t.byteLength+5+s.byteLength)+5);const h=[28,0,0,0,0],c=new Uint8Array(h.length+d.byteLength);return c.set(h,0),c.set(d,h.length),c}function $n(e,t){let i=[];i[0]=t?28:44,i[1]=1,i[2]=0,i[3]=0,i[4]=0;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}function Jn(e){return(126&e[0])>>1}function qn(e){return!function(e){return e>=32&&e<=40}(e)}function Kn(e){return e>=16&&e<=21}class Yn{constructor(e){this.data=e,this.eofFlag=!1,this.currentStartcodeOffset=this.findNextStartCodeOffset(0),this.eofFlag&&console.error("Could not find H265 startcode until payload end!")}findNextStartCodeOffset(e){let t=e,i=this.data;for(;;){if(t+3>=i.byteLength)return this.eofFlag=!0,i.byteLength;let e=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],s=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===e||1===s)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let i=this.currentStartcodeOffset;i+=1===(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3;let s=e[i]>>1&63,r=(128&e[i])>>>7,o=this.findNextStartCodeOffset(i);this.currentStartcodeOffset=o,0===r&&(t={type:s,data:e.subarray(i,o)})}return t}}class Qn{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}class Xn extends wa{constructor(e){super(),this.TAG_NAME="recorderCommon",this.player=e,this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.recordingInterval=null,this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.audioCodeId=null,this.metaInfo={codecWidth:0,codecHeight:0,presentWidth:0,presentHeight:0,refSampleDuration:0,timescale:1e3,avcc:null,videoType:""},this.audioMetaInfo={timescale:1e3,sampleRate:0,refSampleDuration:0,channelCount:0,codec:"",originalCodec:"",audioType:"",extraData:new Uint8Array(0)}}destroy(){this._reset(),this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.audioCodeId=null,this.metaInfo=null,this.audioMetaInfo=null}get isH264(){return this.codecId===yt}get isH265(){return this.codecId===At}setFileName(e){this.fileName=e}get isRecording(){return this._isRecording}get recording(){return this._isRecording}get recordTime(){return this._recordingTimestamp}startRecord(){}handleAddNaluTrack(e,t,i,s){}handleAddAudioTrack(e,t){}handleAddTrack(e){}stopRecordAndSave(){}startRecordingInterval(){}isWasmMp4(){return!1}stopRecordingInterval(){this.recordingInterval&&clearInterval(this.recordingInterval),this.recordingInterval=null}getToTalByteLength(){return 0}_reset(){this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.stopRecordingInterval()}initMetaData(e,t){let i;const s=e.slice(5);if(this.codecId=t,this.metaInfo.avcc=s,t===yt)i=xn(s);else if(t===At){i=function(e){let t=23;const i=e[t];if((63&i)!==Gt)return console.warn(`parseHEVCDecoderVPSAndSPSAndPPS and vpsTag is ${i}`),{};t+=2,t+=1;const s=e[t+1]|e[t]<<8;t+=2;const r=e.slice(t,t+s);t+=s;const o=e[t];if((63&o)!==Wt)return console.warn(`parseHEVCDecoderVPSAndSPSAndPPS and sps tag is ${o}`),{};t+=2,t+=1;const a=e[t+1]|e[t]<<8;t+=2;const n=e.slice(t,t+a);t+=a;const l=e[t];if((63&l)!==Ht)return console.warn(`parseHEVCDecoderVPSAndSPSAndPPS and pps tag is ${l}`),{};t+=2,t+=1;const d=e[t+1]|e[t]<<8;t+=2;const h=e.slice(t,t+d),c=new Uint8Array([a>>>24&255,a>>>16&255,a>>>8&255,255&a]),u=new Uint8Array([d>>>24&255,d>>>16&255,d>>>8&255,255&d]),p=new Uint8Array([s>>>24&255,s>>>16&255,s>>>8&255,255&s]),f=new Uint8Array(a+4);f.set(c,0),f.set(n,4);const m=new Uint8Array(d+4);m.set(u,0),m.set(h,4);const g=new Uint8Array(s+4);return g.set(p,0),g.set(r,4),{sps:f,pps:m,vps:g}}(s);const t=zn(e);i=Object.assign(i,t)}i&&(i.vps&&(this.vps=i.vps),i.pps&&(this.pps=i.pps),i.sps&&(this.sps=i.sps),i.presentWidth&&(this.metaInfo.presentWidth=i.presentWidth),i.presentHeight&&(this.metaInfo.presentHeight=i.presentHeight),i.codecWidth&&(this.metaInfo.codecWidth=i.codecWidth),i.codecHeight&&(this.metaInfo.codecHeight=i.codecHeight),i.timescale&&(this.metaInfo.timescale=i.timescale),i.refSampleDuration&&(this.metaInfo.refSampleDuration=i.refSampleDuration),i.videoType&&(this.metaInfo.videoType=i.videoType))}initAudioMetaData(e,t){this.audioCodeId=t;const i=e[0]>>1&1;let s=null;t===_t?(s=function(e){let t={},i=new jr(e);return i.read(16),t.object_type=Gr(i),t.sample_rate=zr(i,t),t.chan_config=i.read(4),t.chan_config{r.onload=function(e){i.decode(this.result).forEach((function(e){t.read(e)})),t.stop();const r=s.makeMetadataSeekable(t.metadatas,t.duration,t.cues),a=this.result.slice(t.metadataSize),n=new Blob([r,a],{type:"video/webm"});o(n)},r.readAsArrayBuffer(e)}))}startRecord(){const e={type:"video",mimeType:"video/webm;codecs=h264",timeSlice:1e3,onTimeStamp:e=>{this.player&&this.player.debugLog("RecorderRTC","record timestamp :"+e),null===this._startRecordingTimestamp&&(this._startRecordingTimestamp=e),this._recordingTimestamp=(e-this._startRecordingTimestamp)/1e3},ondataavailable:e=>{this.totalByteLength+=e.size,this.player&&this.player.debugLog("RecorderRTC","ondataavailable",e.size)},disableLogs:!this.player._opt.debug};try{let t=null;if(this.player.getRenderType()===H?t=this.player.video.$videoElement.captureStream(25):this.player.video.mediaStream?t=this.player.video.mediaStream:this.player.isOldHls()||this.player._opt.useMSE||this.player._opt.useWCS?t=this.player.video.$videoElement.captureStream(25):this.player.isWebrtcH264()?t=this.player.webrtc.videoStream:this.player.isAliyunRtc()&&(t=this.player.video.$videoElement.captureStream(25)),!t)return this.player.debugError("RecorderRTC","startRecord error and can not create stream"),void this.player.emitError(ot.recordCreateError,"can not create stream");if(this.player.audio&&this.player.audio.mediaStreamAudioDestinationNode&&this.player.audio.mediaStreamAudioDestinationNode.stream&&!this.player.audio.isStateSuspended()&&this.player.audio.hasAudio&&this.player._opt.hasAudio){const e=this.player.audio.mediaStreamAudioDestinationNode.stream;if(e.getAudioTracks().length>0){const i=e.getAudioTracks()[0];i&&i.enabled&&t.addTrack(i)}}this.recorder=Ln(t,e)}catch(e){return this.player.debugError("RecorderRTC","startRecord error",e),void this.player.emitError(ot.recordCreateError,e)}this.recorder&&(this._isRecording=!0,this.player.emit(ot.recording,!0),this.recorder.startRecording(),this.player.debugLog("RecorderRTC","start recording"),this.player.emit(ot.recordStart),this.startRecordingInterval())}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(ot.recordingTimestamp,this._recordingTimestamp)}),1e3)}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ft,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{this.recorder&&this._isRecording||s("recorder is not ready"),t&&this.setFileName(t),this.recorder.stopRecording((()=>{this.player.debugLog("RecorderRTC","stop recording");const t=(this.fileName||eo())+"."+E;if(this.player._opt.recordWebMSupportSeek);else{if(e===mt){const e=this.recorder.getBlob();i(e),this.player.emit(ot.recordBlob,e)}else i(),this.recorder.save(t);this.player.emit(ot.recordEnd),this._reset(),this.player.emit(ot.recording,!1)}}))}))}cancelRecord(){return new Promise(((e,t)=>{if(this.player.debugLog(this.TAG_NAME,"cancel recording"),!this.recorder||!this._isRecording)return e();this.recorder.stopRecording((()=>{this._reset(),this.player.emit(ot.recording,!1),this.player.emit(ot.recordCancel),e()}))}))}getToTalByteLength(){return this.totalByteLength}getTotalDuration(){return this.recordTime}getType(){return E}initMetaData(){}}class el{static init(){el.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],free:[],edts:[],elst:[],stss:[]};for(let e in el.types)el.types.hasOwnProperty(e)&&(el.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=el.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,50,97,118,99,49,109,112,52,49,0,0,0,0]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,s=Array.prototype.slice.call(arguments,1),r=s.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let o=8;for(let e=0;e=Math.pow(2,32)-1?(o=16,a=new Uint8Array(i+o),a.set(new Uint8Array([0,0,0,1]),0),a.set(el.types.mdat,4),a.set(new Uint8Array([i+8>>>56&255,i+8>>>48&255,i+8>>>40&255,i+8>>>32&255,i+8>>>24&255,i+8>>>16&255,i+8>>>8&255,i+8&255]),8)):(a=new Uint8Array(i+o),a[0]=i+8>>>24&255,a[1]=i+8>>>16&255,a[2]=i+8>>>8&255,a[3]=i+8&255,a.set(el.types.mdat,4));for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3]))}static trak(e){return el.box(el.types.trak,el.tkhd(e),el.mdia(e))}static tkhd(e){let t=e.id,i=e.duration,s=e.presentWidth,r=e.presentHeight;return"video"===e.type?el.box(el.types.tkhd,new Uint8Array([0,0,0,15,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>>8&255,255&s,0,0,r>>>8&255,255&r,0,0])):"audio"===e.type?el.box(el.types.tkhd,new Uint8Array([0,0,0,15,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0])):void 0}static edts(e,t){return el.box(el.types.edts,el.elst(e,t))}static elst(e,t){let i=0;for(let s=0;s>>24&255,i>>>16&255,i>>>8&255,255&i,255,255,255,255,0,1,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,0,0,0,0,0,1,0,0]))}static mdia(e){return el.box(el.types.mdia,el.mdhd(e),el.hdlr(e),el.minf(e))}static mdhd(e){let t=e.timescale/e.refSampleDuration,i=t*e.duration/e.timescale;return el.box(el.types.mdhd,new Uint8Array([0,0,0,0,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?el.constants.HDLR_AUDIO:el.constants.HDLR_VIDEO,el.box(el.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?el.box(el.types.smhd,el.constants.SMHD):el.box(el.types.vmhd,el.constants.VMHD),el.box(el.types.minf,t,el.dinf(),el.stbl(e))}static dinf(){return el.box(el.types.dinf,el.box(el.types.dref,el.constants.DREF))}static stbl(e){let t=e.samples,i=[{No:1,num:0,sampleDelte:1,chunkNo:1,duration:t[0].duration}],s=[t[0].duration],r=t.length;for(let e=0;e>>24&255,t>>>16&255,t>>>8&255,255&t]),s=i.byteLength,r=new Uint8Array(s+8*t);r.set(i,0);for(let i=0;i>>24&255,e[i].num>>>16&255,e[i].num>>>8&255,255&e[i].num,e[i].sampleDelte>>>24&255,e[i].sampleDelte>>>16&255,e[i].sampleDelte>>>8&255,255&e[i].sampleDelte]),s),s+=8;return el.box(el.types.stts,r)}static stss(e){let t=[],i=e.length;for(let s=0;s>>24&255,s>>>16&255,s>>>8&255,255&s]),o=r.byteLength,a=new Uint8Array(o+4*s);a.set(r,0);for(let e=0;e>>24&255,t[e]>>>16&255,t[e]>>>8&255,255&t[e]]),o),o+=4;return el.box(el.types.stss,a)}static stsc(e){let t=e.length,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]),s=i.byteLength,r=new Uint8Array(s+12*t);r.set(i,0);for(let i=0;i>>24&255,t>>>16&255,t>>>8&255,255&t,o>>>24&255,o>>>16&255,o>>>8&255,255&o,a>>>24&255,a>>>16&255,a>>>8&255,255&a]),s),s+=12}return el.box(el.types.stsc,r)}static stsz(e){let t=e.length,i=new Uint8Array([0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]),s=i.byteLength,r=new Uint8Array(s+4*t);r.set(i,0);for(let i=0;i>>24&255,t>>>16&255,t>>>8&255,255&t]),s),s+=4}return el.box(el.types.stsz,r)}static stco(e,t){let i=t[0].chunkOffset;return el.box(el.types.stco,new Uint8Array([0,0,0,0,0,0,0,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i]))}static stsd(e){return"audio"===e.type?"mp3"===e.codec?el.box(el.types.stsd,el.constants.STSD_PREFIX,el.mp3(e)):el.box(el.types.stsd,el.constants.STSD_PREFIX,el.mp4a(e)):"avc"===e.videoType?el.box(el.types.stsd,el.constants.STSD_PREFIX,el.avc1(e)):el.box(el.types.stsd,el.constants.STSD_PREFIX,el.hvc1(e))}static mp3(e){let t=e.channelCount,i=e.sampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return el.box(el.types[".mp3"],s)}static mp4a(e){let t=e.channelCount,i=e.sampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return el.box(el.types.mp4a,s,el.esds(e))}static esds(e){let t=e.config||[],i=t.length,s=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return el.box(el.types.esds,s)}static avc1(e){let t=e.avcc,i=e.codecWidth,s=e.codecHeight,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return el.box(el.types.avc1,r,el.box(el.types.avcC,t))}static hvc1(e){let t=e.avcc;const i=e.codecWidth,s=e.codecHeight;let r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return el.box(el.types.hvc1,r,el.box(el.types.hvcC,t))}static mvex(e){return el.box(el.types.mvex,el.trex(e))}static trex(e){let t=e.id,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return el.box(el.types.trex,i)}static moof(e,t){return el.box(el.types.moof,el.mfhd(e.sequenceNumber),el.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return el.box(el.types.mfhd,t)}static traf(e,t){let i=e.id,s=el.box(el.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),r=el.box(el.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),o=el.sdtp(e),a=el.trun(e,o.byteLength+16+16+8+16+8+8);return el.box(el.types.traf,s,r,a,o)}static sdtp(e){let t=e.samples||[],i=t.length,s=new Uint8Array(4+i);for(let e=0;e>>24&255,s>>>16&255,s>>>8&255,255&s,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);for(let e=0;e>>24&255,t>>>16&255,t>>>8&255,255&t,s>>>24&255,s>>>16&255,s>>>8&255,255&s,r.isLeading<<2|r.dependsOn,r.isDependedOn<<6|r.hasRedundancy<<4|r.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12+16*e)}return el.box(el.types.trun,o)}static mdat(e){return el.box(el.types.mdat,e)}}el.init();class tl extends Xn{constructor(e){super(e),this.TAG_NAME="recorderMP4",this._reset(),e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this._reset(),this.player.debugLog(this.TAG_NAME,"destroy")}_reset(){super._reset(),this.totalDuration=0,this.totalAudioDuration=0,this.totalByteLength=0,this.totalAudioByteLength=0,this.bufferList=[],this.audioBufferList=[],this.cacheTrack={},this.audioCacheTrack={},this.sequenceNumber=0,this.audioSequenceNumber=0}startRecord(){this._isRecording=!0,this.player.emit(ot.recording,!0),this.player.debugLog(this.TAG_NAME,"start recording"),this.player.emit(ot.recordStart),this.startRecordingInterval()}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(ot.recordingTimestamp,this.getTotalDuration())}),1e3)}formatFmp4Track(e,t,i,s){return{id:1,sequenceNumber:++this.sequenceNumber,size:e.byteLength,dts:i,cts:s,isKeyframe:t,data:e,duration:0,flags:{isLeading:0,dependsOn:t?2:1,isDependedOn:t?1:0,hasRedundancy:0,isNonSync:t?0:1}}}formatAudioFmp4Track(e,t){return{id:2,sequenceNumber:++this.audioSequenceNumber,size:e.byteLength,dts:t,pts:t,cts:0,data:new Uint8Array(e),duration:0,originalDts:t,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}}handleAddNaluTrack(e,t,i,s){this.cacheTrack.id&&i>=this.cacheTrack.dts?(this.cacheTrack.duration=i-this.cacheTrack.dts,this.handleAddFmp4Track(this.cacheTrack)):this.cacheTrack={},this.cacheTrack=this.formatFmp4Track(e,t,i,s)}handleAddAudioTrack(e,t){}handleAddFmp4Track(e){if(!this.isRecording)return void this.player.debugError(this.TAG_NAME,"handleAddFmp4Track, isRecording is false ");if((null===this.sps||null===this.pps)&&this.isH264)return void this.player.debugError(this.TAG_NAME,"handleAddFmp4Track, is h264 and this.sps or this.pps is null ");if((null===this.sps||null===this.pps||null===this.vps)&&this.isH265)return void this.player.debugError(this.TAG_NAME,"handleAddFmp4Track, is h265 and this.sps or this.pps or this.vps is null ");const t=Object.assign({},e);t.pts=t.dts+t.cts;const i=t.data;if(t.isKeyframe)if(this.isH264){const e=new Uint8Array(this.sps.byteLength+this.pps.byteLength);e.set(this.sps,0),e.set(this.pps,this.sps.byteLength);const s=new Uint8Array(e.byteLength+i.byteLength);s.set(e,0),s.set(i,e.byteLength),t.data=s}else if(this.isH265){const e=new Uint8Array(this.sps.byteLength+this.pps.byteLength+this.vps.byteLength);e.set(this.vps,0),e.set(this.sps,this.vps.byteLength),e.set(this.pps,this.vps.byteLength+this.sps.byteLength);const s=new Uint8Array(e.byteLength+i.byteLength);s.set(e,0),s.set(i,e.byteLength),t.data=s}t.size=t.data.byteLength,this.totalDuration+=t.duration,this.totalByteLength+=t.data.byteLength,t.duration=0,t.originalDts=t.dts,delete t.id,delete t.sequenceNumber,this.bufferList.push(t)}handleAddFmp4AudioTrack(e){const t=Object.assign({},e);t.pts=t.dts+t.cts,t.size=t.data.byteLength,this.totalAudioDuration+=t.duration,this.totalAudioByteLength+=t.data.byteLength,t.duration=0,t.originalDts=t.dts,delete t.id,delete t.sequenceNumber,this.audioBufferList.push(t)}getTotalDuration(){return this.totalDuration/1e3}getType(){return S}getToTalByteLength(){return this.totalByteLength+this.totalAudioByteLength}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ft,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{if(!this.isRecording)return this.player.debugError(this.TAG_NAME,"stop recording fail, isRecording is false "),s("stop recording fail, isRecording is false ");if(0===this.bufferList.length)return this.player.debugError(this.TAG_NAME,"stop recording fail, this.bufferList.length is 0 "),s("stop recording fail, this.bufferList.length is 0 ");t&&this.setFileName(t);const r={id:1,type:"video",sps:this.sps,pps:this.pps,samples:this.bufferList,sequenceNumber:this.bufferList.length,length:0,addSampleNum:1,duration:0,...this.metaInfo},o={id:2,type:"audio",sequenceNumber:this.audioBufferList.length,samples:this.audioBufferList,...this.audioMetaInfo},a=[r];o.samples.length>0&&a.push(o),this.player.debugLog(this.TAG_NAME,`trackList length is ${a.length}`);const n=el.generateInitSegment({timescale:1e3,duration:this.totalDuration},a,this.totalByteLength+this.totalAudioByteLength);this.player.debugLog(this.TAG_NAME,"stop recording");const l=new Blob([n],{type:"application/octet-stream"});if(e===mt)i(l),this.player.emit(ot.recordBlob,l);else{i();Lo((this.fileName||eo())+"."+S,l)}this._reset(),this.player.emit(ot.recording,!1)}))}cancelRecord(){return new Promise(((e,t)=>{if(this.player.debugLog(this.TAG_NAME,"cancel recording"),!this.isRecording)return e();this._reset(),this.player.emit(ot.recording,!1),this.player.emit(ot.recordCancel),e()}))}}function il(){for(var e=arguments.length,t=new Array(e),i=0;i{const i=new s((0|e.byteLength)+(0|t.byteLength));return i.set(e,0),i.set(t,0|e.byteLength),i}),new s)}function sl(e){if((e=e.replace(/\s/g,"")).length%2!=0)return console.error("hexStringToUint8Array: invalid hexString length, must be even and bexString length is: ",e.length),null;const t=new Uint8Array(e.length/2);for(let i=0;i{this.player.emit(ot.recordingTimestamp,this.getTotalDuration())}),1e3)}addMetaData(e){this.flvMetaData=e}addAACSequenceHeader(e){this.aacSequenceHeader=e}addVideoSequenceHeader(e){this.videoSequenceHeader=e}addVideo(e,t){this._setStartTime(t);const i=this._getBufferTs(t);this.hasVideo=!0,this._createBufferItem(e,Ne,i)}addAudio(e,t){this._setStartTime(t);const i=this._getBufferTs(t);this.hasAudio=!0,this._createBufferItem(e,Oe,i)}_setStartTime(e){null===this.startTime&&this._isRecording&&(this.startTime=e,this.player.debugLog(this.TAG_NAME,`_setStartTime is ${e}`))}_getBufferTs(e){e>this.currentTime&&(this.currentTime=e);let t=0;return this.startTime&&e>=this.startTime&&(t=e-this.startTime),t>this.prevTimestamp?this.prevTimestamp=t:t=this.prevTimestamp,t}_createBufferItem(e,t,i){const s=this._createFlvPacket(e,t,i),r=this._createFlvTag(s);this.totalByteLength+=r.byteLength,this.bufferList.push(r)}_createFlvTag(e){let t=11+e.header.length,i=new Uint8Array(t+4);i[0]=e.header.type;let s=new DataView(i.buffer);return i[1]=e.header.length>>16&255,i[2]=e.header.length>>8&255,i[3]=255&e.header.length,i[4]=e.header.timestamp>>16&255,i[5]=e.header.timestamp>>8&255,i[6]=255&e.header.timestamp,i[7]=e.header.timestamp>>24&255,i[8]=0,i[9]=0,i[10]=0,s.setUint32(t,t),i.set(e.payload.subarray(0,e.header.length),11),i}_createFlvPacket(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{header:{length:e?e.length:0,timestamp:i,type:t},payload:e}}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ft,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{if(!this.isRecording)return this.player.debugError(this.TAG_NAME,"stop recording fail, isRecording is false "),s("stop recording fail, isRecording is false ");if(0===this.bufferList.length)return this.player.debugError(this.TAG_NAME,"stop recording fail, this.bufferList.length is 0 "),s("stop recording fail, this.bufferList.length is 0 ");t&&this.setFileName(t);const r=new Uint8Array([70,76,86,1,0,0,0,0,9,0,0,0,0]);this.hasVideo&&(r[4]|=1),this.hasAudio&&(r[4]|=4);let o=[r];if(this.flvMetaData){const e=this._createFlvPacket(this.flvMetaData,je),t=this._createFlvTag(e);o.push(t)}if(this.videoSequenceHeader){const e=this._createFlvPacket(this.videoSequenceHeader,Ne),t=this._createFlvTag(e);o.push(t)}if(this.aacSequenceHeader){const e=this._createFlvPacket(this.aacSequenceHeader,Oe),t=this._createFlvTag(e);o.push(t)}const a=function(e){const t=e[0].constructor;return e.reduce(((e,i)=>{const s=new t((0|e.byteLength)+(0|i.byteLength));return s.set(e,0),s.set(i,0|e.byteLength),s}),new t)}(o.concat(this.bufferList));this.player.debugLog(this.TAG_NAME,"stop recording");const n=new Blob([a],{type:"application/octet-stream"});if(e===mt)i(n),this.player.emit(ot.recordBlob,n);else{i();Lo((this.fileName||eo())+"."+w,n)}this._reset(),this.player.emit(ot.recording,!1)}))}cancelRecord(){return new Promise(((e,t)=>{if(this.player.debugLog(this.TAG_NAME,"cancel recording"),!this.isRecording)return e();this._reset(),this.player.emit(ot.recording,!1),this.player.emit(ot.recordCancel),e()}))}getTotalDuration(){let e=0;return null!==this.startTime&&null!==this.currentTime&&(e=this.currentTime-this.startTime),Math.round(e/1e3)}getType(){return w}getToTalByteLength(){return this.totalByteLength}}const ol={init:0,findFirstStartCode:1,findSecondStartCode:2};class al extends wa{constructor(e){super(),this.player=e,this.isDestroyed=!1,this.reset()}destroy(){this.isDestroyed=!1,this.off(),this.reset()}reset(){this.stats=ol.init,this.tempBuffer=new Uint8Array(0),this.parsedOffset=0,this.versionLayer=0}dispatch(e,t){let i=new Uint8Array(this.tempBuffer.length+e.length);for(i.set(this.tempBuffer,0),i.set(e,this.tempBuffer.length),this.tempBuffer=i;!this.isDestroyed;){if(this.state==ol.Init){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=ol.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==ol.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=ol.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==ol.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=ol.findFirstStartCode}}}}class nl extends Xn{constructor(e){super(e),this.TAG_NAME="recorderWasmMP4",this._reset(),this.wasmMp4Recorder=null,this.mp3Demuxer=null,e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.mp3Demuxer&&(this.mp3Demuxer.destroy(),this.mp3Demuxer=null),this._reset(),this.player.debugLog(this.TAG_NAME,"destroy")}_reset(){super._reset(),this.cacheTrack={},this.audioCacheTrack={},this.totalDuration=0,this.totalAudioDuration=0,this.totalByteLength=0,this.totalAudioByteLength=0,this.hasAudio=!1,this.hasVideo=!1}getType(){return S}isWasmMp4(){return!0}getTotalDuration(){return this.totalDuration/1e3}getToTalByteLength(){return this.totalByteLength+this.totalAudioByteLength}startRecord(){const e=this.player,t=this.player.getAudioInfo(),i=this.player.getVideoInfo(),s={};if(this.codecId){const e={type:this.codecId,width:i.width,height:i.height,extraData:this.metaInfo.avcc};s.video=e,this.hasVideo=!0}if(t.encTypeCode){const e={type:t.encTypeCode,sampleRate:t.sampleRate,channels:t.channels,extraData:this.audioMetaInfo.extraData,depth:t.depth};this.audioCodeId=t.encTypeCode,s.audio=e,this.hasAudio=!0}this.wasmMp4Recorder=new window.JessibucaProMp4Recorder({debug:e._opt.debug,debugLevel:e._opt.debugLevel,debugUuid:e._opt.debugUuid,decoder:e._opt.wasmMp4RecorderDecoder}),this.wasmMp4Recorder.on("recordingTimestamp",(e=>{this._recordingTimestamp=e/1e3})),this.wasmMp4Recorder.startRecord(s).then((()=>{this._isRecording=!0,this.player.emit(ot.recording,!0),this.player.debugLog(this.TAG_NAME,"start recording"),this.player.emit(ot.recordStart),this.startRecordingInterval()})).catch((e=>{this.player.debugError(this.TAG_NAME,"startRecord error",e),this.player.emitError(ot.recordCreateError,e)}))}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(ot.recordingTimestamp,this.recordTime)}),1e3)}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ft,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>this.isRecording?0===this.totalDuration?(this.player.debugError(this.TAG_NAME,"stop recording fail, totalDuration is 0 "),s("stop recording fail, totalDuration is 0 ")):(t&&this.setFileName(t),void this.wasmMp4Recorder.stopRecord().then((t=>{if(e===mt)i(t),this.player.emit(ot.recordBlob,t);else{i();Lo((this.fileName||eo())+"."+S,t)}})).catch((e=>{this.player.debugError(this.TAG_NAME,"stopRecord error",e),s(e)})).finally((()=>{this._reset(),this.player.emit(ot.recording,!1)}))):(this.player.debugError(this.TAG_NAME,"stop recording fail, isRecording is false "),s("stop recording fail, isRecording is false "))))}cancelRecord(){return new Promise(((e,t)=>{if(this.player.debugLog(this.TAG_NAME,"cancel recording"),!this.isRecording||0===this.totalDuration)return e();this.wasmMp4Recorder.stopRecord().then((t=>{e()})).catch((e=>{this.player.debugError(this.TAG_NAME,"stopRecord error",e),t(e)})).finally((()=>{this._reset(),this.player.emit(ot.recording,!1),this.player.emit(ot.recordCancel)}))}))}handleAddAudioTrack(e,t){this.audioCodeId===Et?(this.mp3Demuxer||(this.mp3Demuxer=new al(this.player),this.mp3Demuxer.on("data",((e,t)=>{this._handleAddAudioTrack(e,t)}))),this.mp3Demuxer.dispatch(e,t)):this._handleAddAudioTrack(e,t)}_handleAddAudioTrack(e,t){pa(this.hasAudio)||(this.audioCacheTrack.id&&t>=this.audioCacheTrack.dts?(this.audioCacheTrack.duration=t-this.audioCacheTrack.dts,this.totalAudioDuration+=this.audioCacheTrack.duration,this.totalAudioByteLength+=this.audioCacheTrack.payload.byteLength,this.wasmMp4Recorder.sendAudioFrame(this.audioCacheTrack.payload,this.audioCacheTrack.dts)):this.audioCacheTrack={},this.audioCacheTrack={id:2,payload:e,dts:t})}handleAddNaluTrack(e,t,i,s){pa(this.hasVideo)||(this.cacheTrack.id&&i>=this.cacheTrack.dts?(this.cacheTrack.duration=i-this.cacheTrack.dts,this.totalDuration+=this.cacheTrack.duration,this.totalByteLength+=this.cacheTrack.payload.byteLength,this.wasmMp4Recorder.sendVideoFrame(this.cacheTrack.payload,this.cacheTrack.isIFrame,this.cacheTrack.dts,this.cacheTrack.cts)):this.cacheTrack={},this.cacheTrack={id:1,payload:e,isIFrame:t,dts:i,cts:s})}}class ll{constructor(e){return new(ll.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){if(e.recordType===S){if(e.useWasm||e.useMSE||e.useWCS)return window.JessibucaProMp4Recorder&&e.mp4RecordUseWasm?nl:tl}else if(e.recordType===w)return rl;return Zn}}function dl(e,t,i){let s=e;if(t+i=128){t.push(String.fromCharCode(65535&e)),s+=2;continue}}}else if(i[s]<240){if(dl(i,s,2)){let e=(15&i[s])<<12|(63&i[s+1])<<6|63&i[s+2];if(e>=2048&&55296!=(63488&e)){t.push(String.fromCharCode(65535&e)),s+=3;continue}}}else if(i[s]<248&&dl(i,s,3)){let e=(7&i[s])<<18|(63&i[s+1])<<12|(63&i[s+2])<<6|63&i[s+3];if(e>65536&&e<1114112){e-=65536,t.push(String.fromCharCode(e>>>10|55296)),t.push(String.fromCharCode(1023&e|56320)),s+=4;continue}}t.push(String.fromCharCode(65533)),++s}return t.join("")}let cl=function(){let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256===new Int16Array(e)[0]}();class ul{static parseScriptData(e,t,i){let s={};try{let r=ul.parseValue(e,t,i),o=ul.parseValue(e,t+r.size,i-r.size);s[r.data]=o.data}catch(e){console.error("AMF",e.toString())}return s}static parseObject(e,t,i){let s=ul.parseString(e,t,i),r=ul.parseValue(e,t+s.size,i-s.size),o=r.objectEnd;return{data:{name:s.data,value:r.data},size:s.size+r.size,objectEnd:o}}static parseVariable(e,t,i){return ul.parseObject(e,t,i)}static parseString(e,t,i){let s,r=new DataView(e,t,i).getUint16(0,!cl);return s=r>0?hl(new Uint8Array(e,t+2,r)):"",{data:s,size:2+r}}static parseLongString(e,t,i){let s,r=new DataView(e,t,i).getUint32(0,!cl);return s=r>0?hl(new Uint8Array(e,t+4,r)):"",{data:s,size:4+r}}static parseDate(e,t,i){let s=new DataView(e,t,i),r=s.getFloat64(0,!cl);return r+=60*s.getInt16(8,!cl)*1e3,{data:new Date(r),size:10}}static parseValue(e,t,i){let s,r=new DataView(e,t,i),o=1,a=r.getUint8(0),n=!1;try{switch(a){case 0:s=r.getFloat64(1,!cl),o+=8;break;case 1:s=!!r.getUint8(1),o+=1;break;case 2:{let r=ul.parseString(e,t+1,i-1);s=r.data,o+=r.size;break}case 3:{s={};let a=0;for(9==(16777215&r.getUint32(i-4,!cl))&&(a=3);o{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),te)}this.decoderWorker=new Worker(t),this._initDecoderWorker(),this._listenPlaybackEvents(),e.debugLog("decoderWorker",`init and decoder url is ${t}`),e.on(ot.visibilityChange,(()=>{this.updateWorkConfig({key:"visibility",value:e.visibility})}))}destroy(){return new Promise(((e,t)=>{if(this.player.loaded)if(this.player.debugLog("decoderWorker","has loaded and post message to destroy"),this.decoderWorker){const t={};this.player.isMseDecoderUseWorker()&&(t.isVideoInited=this.player.isMseVideoStateInited()),this.decoderWorker.postMessage({cmd:He,options:t}),this.destroyResolve=e,this.decoderWorkerCloseTimeout=setTimeout((()=>{this.player.debugWarn("decoderWorker","send close but not response and destroy directly"),this._destroy(),setTimeout((()=>{e()}),0)}),2e3)}else this.player.debugWarn("decoderWorker","has loaded but decoderWorker is null and destroy directly"),this._destroy(),setTimeout((()=>{e()}),0);else this.player.debugLog("decoderWorker","has not loaded and destroy directly"),this._destroy(),setTimeout((()=>{e()}),0)}))}_destroy(){this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this.workerUrl&&(window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.decoderWorker&&(this.decoderWorker.terminate(),this.decoderWorker.onerror=null,this.decoderWorker.onmessageerror=null,this.decoderWorker.onmessage=null,this.decoderWorker=null),this.player.debugLog("decoderWorker","destroy"),this.destroyResolve&&(this.destroyResolve(),this.destroyResolve=null),this.isDestroyed=!0}_listenPlaybackEvents(){this.player.isPlaybackPauseNotClearCacheAndCacheBeforeDecodeAndUseFpsRender()&&(this.player.debugLog(this.TAG_NAME,"listenPlaybackEvents"),this.player.on(ot.playbackPause,(e=>{this.updatePlaybackIsPause(e)})))}_initDecoderWorker(){this.player,this.decoderWorker.onerror=e=>{const t=e.filename||"",i=e.message||"",s=t&&(-1!==t.indexOf(".wasm")||-1!==t.indexOf("wasm://"));s&&-1!==i.indexOf(Zs)?this.player.debugLog("decoderWorker",`onerror and ignore filename: ${t},message: ${i}`,e):(this.player.debugError("decoderWorker",`onerror filename: ${t},message: ${i}`,e),s?this.player.emitError(lt.decoderWorkerWasmError,`filename: ${t},message: ${i}`):this.player.emitError(lt.decoderWorkerInitError,`filename: ${t},message: ${i}`))},this.decoderWorker.onmessageerror=e=>{this.player.debugError("decoderWorker","onmessageerror",e)},this.decoderWorker.onmessage=e=>{const t=e.data;switch(t.cmd){case re:this.player.debugLog("decoderWorker","onmessage:",re),this.decoderWorker&&this._initWork(),this.player.loaded||this.player.emit(ot.load),this.player.emit(ot.decoderWorkerInit);break;case ue:this.player.debugLog("decoderWorker","onmessage:",ue,t.code),this.player._times.decodeStart||(this.player._times.decodeStart=eo()),this.player.video.updateVideoInfo({encTypeCode:t.code});break;case pe:this.player.debugLog("decoderWorker","onmessage:",pe,t.codecId),this.player.recorder&&this.player.recorder.initMetaData(t.buffer,t.codecId),this.player.video.updateVideoInfo({encTypeCode:t.codecId});break;case de:this.player.debugLog("decoderWorker","onmessage:",de,t.code),this.player.audio&&this.player.audio.updateAudioInfo({encTypeCode:t.code});break;case ce:this.player.debugLog("decoderWorker","onmessage:",ce),this.player.recorder&&this.player.recorder.initAudioAacExtraData(t.buffer);break;case oe:if(this.player.debugLog("decoderWorker","onmessage:",oe,`width:${t.w},height:${t.h}`),Co(t.w)||Co(t.h))return void this.player.emitError(lt.videoInfoError,`video width ${t.w} or height ${t.h} is empty`);if(this.player.video.bindMediaStream(),this.player.video.updateVideoInfo({width:t.w,height:t.h}),!this.player._opt.openWebglAlignment&&t.w/2%4!=0&&this.player.getRenderType()===H)return void this.player.emitError(lt.webglAlignmentError);this.player.video.initCanvasViewSize(),this.player._opt.playType===_&&(this.player.video.initFps(),this.player.video.initVideoDelay());break;case le:if(this.player.debugLog("decoderWorker","onmessage:",le,`channels:${t.channels},sampleRate:${t.sampleRate}`),t.channels>2)return void this.player.emitError(lt.audioChannelError,`audio channel is ${t.channels}, max is 2`);this.player.audio&&(this.player.audio.updateAudioInfo(t),this.player._opt.playType===b?this.player.audio.initScriptNode():this.player._opt.playType===_&&this.player.audio.initScriptNodeDelay());break;case ae:if(!this.player.video)return void this.player.debugWarn("decoderWorker","onmessage render but video is null");if(this.player.isPlayer()){if(pa(this.player.video.getHasInit()))return void this.player.debugWarn("decoderWorker","onmessage render but video has not init");this.player.video.render(t),this.player.handleRender(),this.player.emit(ot.timeUpdate,t.ts),this.player.updateStats({dfps:!0,buf:t.delay}),this.player._times.videoStart||(this.player._times.videoStart=eo(),this.player.handlePlayToRenderTimes())}else this.player.isPlayback()&&(this.player.updateStats({dfps:!0}),pa(this.player.playbackPause)?(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this.player.playback.isUseFpsRender?this.player.video.pushData(t):this.player.video.render$2(t)):this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this.player.playback.isUseFpsRender&&this.player.video.pushData(t));break;case fe:this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===S&&this.player.recorder.handleAddNaluTrack(t.buffer,t.isIFrame,t.ts,t.cts);break;case he:this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===S&&this.player.recorder.isWasmMp4()&&this.player.recorder.handleAddAudioTrack(t.buffer,t.ts);break;case me:const{webcodecsDecoder:e,mseDecoder:i}=this.player;this.player.updateStats({buf:t.delay});const s=new Uint8Array(t.payload);this.player._opt.useWCS&&!this.player._opt.useOffscreen?e.decodeVideo(s,t.ts,t.isIFrame,t.cts):this.player._opt.useMSE&&i.decodeVideo(s,t.ts,t.isIFrame,t.cts);break;case ge:if(this.player._opt.useMSE){const e=new Uint8Array(t.payload);this.player.mseDecoder.decodeAudio(e,t.ts,t.cts)}break;case ne:if(!this.player.audio)return void this.player.debugWarn("decoderWorker","onmessage playAudio but audio is null");(this.player.playing&&this.player.audio||!this.player.video)&&(this.player._opt.hasVideo||this.player.handleRender(),(this.player._opt.playType===b||this.player._opt.playType===_&&(pa(this.player.playbackPause)||this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this.player.playback.isUseFpsRender))&&this.player.audio.play(t.buffer,t.ts));break;case ye:if(t.type===ot.streamSuccess)this.player.stream?this.player.stream.emit(ot.streamSuccess):this.player.debugWarn("decoderWorker","onmessage and workerFetch response stream success but stream is null");else if(t.type===ot.streamRate)this.player.emit(ot.kBps,(t.value/1024).toFixed(2));else if(t.type===ot.streamEnd)this.player?(t.value===f&&this.player.emit(ot.websocketClose,t.msg),this.player.stream?this.player.stream.emit(ot.streamEnd,t.msg):this.player.debugWarn("decoderWorker","onmessage and workerFetch response stream end but player.stream is null")):this.player.debugWarn("decoderWorker","onmessage and workerFetch response stream end but player is null");else if(t.type===lt.websocketError)this.player&&this.player.stream?this.player.stream.emit(lt.websocketError,t.value):this.player.debugWarn("decoderWorker","onmessage and workerFetch response websocket error but stream is null");else if(t.type===lt.fetchError)this.player&&this.player.stream?this.player.stream.emit(lt.fetchError,t.value):this.player.debugWarn("decoderWorker","onmessage and workerFetch response fetch error but stream is null");else if(t.type===ot.streamAbps)this.player.updateStats({abps:t.value});else if(t.type===ot.streamVbps)this.player._times.demuxStart||(this.player._times.demuxStart=eo()),this.player.updateStats({vbps:t.value});else if(t.type===ot.streamDts)this.player.updateStats({dts:t.value});else if(t.type===ot.netBuf)this.player.updateStats({netBuf:t.value});else if(t.type===ot.networkDelayTimeout)this.player.emit(ot.networkDelayTimeout,t.value);else if(t.type===ot.streamStats){const e=JSON.parse(t.value);this.player.updateStats({workerStats:e})}else t.type===ot.websocketOpen&&this.player.emit(ot.websocketOpen);break;case Ae:this.player&&(this.player.videoIframeIntervalTs=t.value);break;case be:this.player&&this.player.updateStats({isDropping:!0});break;case Pe:this.player.decoderCheckFirstIFrame();break;case _e:this.player&&this.player.video&&this.player.video.setStreamFps(t.value);break;case we:this.player.emitError(lt.simdH264DecodeVideoWidthIsTooLarge,t.value);break;case Se:this.player.emitError(lt.wasmWidthOrHeightChange,t.value);break;case Ee:this.player.emitError(lt.simdDecodeError);break;case ve:this.player.debugLog("decoderWorker","onmessage:",ve),this.player.destroy(),console.error("Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),alert("Jb pro 体验结束,请刷新页面再次体验,如需要购买商业授权,可以联系微信:bosswancheng"),window.location.reload();break;case Te:this.player.debugLog("decoderWorker","onmessage:",Te),this._destroy();break;case ke:this.player&&this.player.pushTempStream(t.buffer);break;case Le:this.player&&this.player.emitVideoSei({ts:t.ts,data:new Uint8Array(t.buffer)});break;case Ce:if(this.player){if(this.player.isRecordTypeFlv()){const e=new Uint8Array(t.buffer);this.player.recorder.addMetaData(e)}const e=pl(new Uint8Array(t.buffer));e&&e.onMetaData&&this.player.updateMetaData(e.onMetaData)}break;case De:if(this.player&&this.player.isRecordTypeFlv()){const e=new Uint8Array(t.buffer);this.player.recorder.addAACSequenceHeader(e,t.ts)}break;case xe:if(this.player&&this.player.isRecordTypeFlv()){const e=new Uint8Array(t.buffer);this.player.recorder.addVideoSequenceHeader(e,t.ts)}break;case Re:if(this.player&&this.player.isRecordTypeFlv()&&this.player.recording){const e=new Uint8Array(t.buffer);t.type===Ue?this.player.recorder.addVideo(e,t.ts):t.type===Fe&&this.player.recorder.addAudio(e,t.ts)}break;case Be:this.player&&(this.player.debugLog("decoderWorker","onmessage:",Be),this.player.video.$videoElement.srcObject=t.mseHandle);break;case Ie:this.player&&(this.player.debugLog("decoderWorker","onmessage:",Ie,t.value),this.player._mseWorkerData.firstRenderTime=Number(t.value));break;case Me:this.player&&(this.player.debugLog("decoderWorker","onmessage:",Me,t.value,t.msg),this.player.emitError(t.value,t.msg));break;default:this.player[t.cmd]&&this.player[t.cmd](t)}}}_initWork(){const e={debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid,useOffscreen:this.player._opt.useOffscreen,useWCS:this.player._opt.useWCS,useMSE:this.player._opt.useMSE,videoBuffer:this.player._opt.videoBuffer,videoBufferDelay:this.player._opt.videoBufferDelay,openWebglAlignment:this.player._opt.openWebglAlignment,playType:this.player._opt.playType,hasAudio:this.player._opt.hasAudio,hasVideo:this.player._opt.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:this.player._opt.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:this.player.audio&&this.player.audio.audioContext&&this.player.audio.audioContext.sampleRate||vr,audioBufferSize:this.player.audio&&this.player.audio.getAudioBufferSize()||1024,networkDelay:this.player._opt.networkDelay,visibility:this.player.visibility,useSIMD:this.player._opt.useSIMD,recordType:this.player._opt.recordType,checkFirstIFrame:this.player._opt.checkFirstIFrame,isM7sCrypto:this.player._opt.isM7sCrypto,isXorCrypto:this.player._opt.isXorCrypto,isSm4Crypto:this.player._opt.isSm4Crypto,isSm4CryptoH265V2:this.player._opt.isSm4CryptoH265V2,sm4CryptoKey:this.player._opt.sm4CryptoKey,m7sCryptoAudio:this.player._opt.m7sCryptoAudio,isFlv:this.player._opt.isFlv,isFmp4:this.player._opt.isFmp4,isMpeg4:this.player._opt.isMpeg4,isTs:this.player._opt.isTs,isNakedFlow:this.player._opt.isNakedFlow,isHls265:this.player.isUseHls265(),isFmp4Private:this.player._opt.isFmp4Private,isEmitSEI:this.player._opt.isEmitSEI,isRecordTypeFlv:this.player.isRecordTypeFlv(),isWasmMp4:this.player.recorder&&this.player.recorder.isWasmMp4()||!1,isChrome:$o(),isFirefox:uo(),supportMSEDecodeHevc:Eo(),isDropSameTimestampGop:this.player._opt.isDropSameTimestampGop,mseDecodeAudio:this.player._opt.mseDecodeAudio,wcsDecodeAudio:this.player._opt.wcsDecodeAudio,nakedFlowH265DemuxUseNew:this.player._opt.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:this.player._opt.mseDecoderUseWorker,mseAutoCleanupMinBackwardDuration:this.player._opt.mseAutoCleanupMinBackwardDuration,mseAutoCleanupMaxBackwardDuration:this.player._opt.mseAutoCleanupMaxBackwardDuration,mseCorrectTimeDuration:this.player._opt.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:this.player._opt.mseCorrectAudioTimeDuration,nakedFlowDemuxUseNew:this.player._opt.nakedFlowDemuxUseNew,nakedFlowFps:this.player._opt.nakedFlowFps};this.decoderWorker.postMessage({cmd:Ge,opt:JSON.stringify(e)}),this.player._opt.cryptoKey&&this.player._opt.cryptoKey.byteLength>0&&this.player._opt.cryptoIV&&this.player._opt.cryptoIV.byteLength>0&&(this.updateWorkConfig({key:"cryptoKey",value:this.player._opt.cryptoKey}),this.updateWorkConfig({key:"cryptoIV",value:this.player._opt.cryptoIV}))}decodeVideo(e,t,i){this.player._opt.playType===b?this.player.isUseHls265()?this._decodeVideoNoDelay(e,t,i):this._decodeVideo(e,t,i):this.player._opt.playType===_&&(this.player.isPlaybackOnlyDecodeIFrame()?i&&(this.player.debugLog("decoderWorker",`current rate is ${this.player.video.rate},only decode i frame`),this._decodeVideoNoDelay(e,t,i)):1===this.player.video.rate?this._decodeVideo(e,t,i):this._decodeVideoNoDelay(e,t,i))}_decodeVideo(e,t,i){const s={type:Ue,ts:Math.max(t,0),isIFrame:i};this.decoderWorker.postMessage({cmd:ze,buffer:e,options:s},[e.buffer])}_decodeVideoNoDelay(e,t,i){this.decoderWorker.postMessage({cmd:Ve,buffer:e,ts:Math.max(t,0),isIFrame:i},[e.buffer])}decodeAudio(e,t){this.player._opt.playType===b?this.player._opt.useWCS||this.player._opt.useMSE||this.player.isUseHls265()?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t):this.player._opt.playType===_&&(this.player.isPlaybackOnlyDecodeIFrame()||(1===this.player.video.rate?this._decodeAudio(e,t):this._decodeAudioNoDelay(e,t)))}_decodeAudio(e,t){const i={type:Fe,ts:Math.max(t,0)};this.decoderWorker.postMessage({cmd:ze,buffer:e,options:i},[e.buffer])}_decodeAudioNoDelay(e,t){this.decoderWorker.postMessage({cmd:We,buffer:e,ts:Math.max(t,0)},[e.buffer])}updateWorkConfig(e){this.decoderWorker&&this.decoderWorker.postMessage({cmd:$e,key:e.key,value:e.value})}workerFetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{_opt:i}=this.player;let s=[];t.protocols&&(s=t.protocols,delete t.protocols);const r={protocol:i.protocol,isFlv:i.isFlv,isFmp4:i.isFmp4,isMpeg4:i.isMpeg4,isNakedFlow:i.isNakedFlow,isTs:i.isTs,options:t};this.decoderWorker.postMessage({cmd:qe,url:e,protocols:s,opt:JSON.stringify(r)})}clearWorkBuffer(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.decoderWorker.postMessage({cmd:Je,needClear:e})}workerSendMessage(e){this.decoderWorker.postMessage({cmd:Ke,message:e})}updateVideoTimestamp(e){this.decoderWorker.postMessage({cmd:Ye,message:e})}updatePlaybackIsPause(e){this.decoderWorker.postMessage({cmd:Qe,isPause:e})}}var ml,gl="application/json, text/javascript",yl="text/html",Al=/^(?:text|application)\/xml/i,bl=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,vl=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,_l=/^\s*$/,Sl={},El={},wl="",Tl={type:"GET",beforeSend:kl,success:kl,error:kl,complete:kl,context:null,xhr:function(){return new window.XMLHttpRequest},accepts:{json:gl,xml:"application/xml, text/xml",html:yl,text:"text/plain","*":"*/".concat("*")},crossDomain:!1,timeout:0,username:null,password:null,processData:!0,promise:kl,contentType:"application/x-www-form-urlencoded; charset=UTF-8"};function kl(){}var Ll=function(e,t){"object"==typeof e&&(t=e,e=void 0);var i=Ml({},t=t||{});for(var s in Tl)void 0===i[s]&&(i[s]=Tl[s]);try{var r={},o=new Promise((function(e,t){r.resolve=e,r.reject=t}));o.resolve=r.resolve,o.reject=r.reject,i.promise=o}catch(e){i.promise={resolve:kl,reject:kl}}var a=vl.exec(window.location.href.toLowerCase())||[];i.url=((e||i.url||window.location.href)+"").replace(/#.*$/,"").replace(/^\/\//,a[1]+"//");var n=i.url;i.crossDomain||(i.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(i.url)&&RegExp.$2!==window.location.href);var l=i.dataType;if("jsonp"===l){if(!/=\?/.test(i.url)){var d=(i.jsonp||"callback")+"=?";i.url=Pl(i.url,d)}return function(e){var t,i=e.jsonpCallback||"jsonp"+Ol(),s=window.document.createElement("script"),r={abort:function(){i in window&&(window[i]=kl)}},o=window.document.getElementsByTagName("head")[0]||window.document.documentElement;function a(i){window.clearTimeout(t),r.abort(),xl(i.type,r,i.type,e),n()}s.onerror=function(e){a(e)},window[i]=function(i){window.clearTimeout(t),Cl(i,r,e),n()},Bl(e),s.src=e.url.replace(/=\?/,"="+i),s.src=Pl(s.src,"_="+(new Date).getTime()),s.async=!0,e.scriptCharset&&(s.charset=e.scriptCharset);o.insertBefore(s,o.firstChild),e.timeout>0&&(t=window.setTimeout((function(){r.abort(),xl("timeout",r,"timeout",e),n()}),e.timeout));function n(){s.clearAttributes?s.clearAttributes():s.onload=s.onreadystatechange=s.onerror=null,s.parentNode&&s.parentNode.removeChild(s),s=null,delete window[i]}return e.promise.abort=function(){r.abort()},e.promise.xhr=r,e.promise}(i)}Bl(i);var h=i.accepts[l]||i.accepts["*"],c={};/^([\w-]+:)\/\//.test(i.url)?RegExp.$1:window.location.protocol;var u,p=Tl.xhr();i.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest"),i.ifModified&&(Sl[n]&&(c["If-Modified-Since"]=Sl[n]),El[n]&&(c["If-None-Match"]=El[n])),h&&(c.Accept=h,h.indexOf(",")>-1&&(h=h.split(",",2)[0]),p.overrideMimeType&&p.overrideMimeType(h));var f=!/^(?:GET|HEAD)$/.test(i.type.toUpperCase());if((i.data&&f&&!1!==i.contentType||t.contentType)&&(c["Content-Type"]=i.contentType),!1===i.cache&&!f){var m=/([?&])_=[^&]*/;i.url=m.test(n)?n.replace(m,"$1_="+Ol()):n+(/\?/.test(n)?"&":"?")+"_="+Ol()}i.headers=Ml(c,i.headers||{}),p.onreadystatechange=function(){if(4===p.readyState){var e;clearTimeout(u);var t=!1;if(p.status>=200&&p.status<300||304===p.status){if(wl=p.getAllResponseHeaders(),i.ifModified){var s=Rl("Last-Modified");s&&(Sl[n]=s),(s=Rl("etag"))&&(El[n]=s)}l=l||function(e){return e&&(e===yl?"html":e===gl?"json":Al.test(e)&&"xml")||"text"}(p.getResponseHeader("content-type")),e=p.responseText;try{"xml"===l?e=p.responseXML:"json"===l&&(e=_l.test(e)?null:JSON.parse(e))}catch(e){t=e}t?xl(t,"parseerror",p,i):Cl(e,p,i)}else xl(null,"error",p,i)}};var g=!("async"in i)||i.async;if(p.open(i.type,i.url,g,i.username,i.password),i.xhrFields)for(var y in i.xhrFields)p[y]=i.xhrFields[y];for(var y in i.mimeType&&p.overrideMimeType&&p.overrideMimeType(i.mimeType),i.headers)void 0!==i.headers[y]&&p.setRequestHeader(y,i.headers[y]+"");return!1===function(e,t){var i=t.context;if(!1===t.beforeSend.call(i,e,t))return!1}(p,i)?(p.abort(),!1):(i.timeout>0&&(u=window.setTimeout((function(){p.onreadystatechange=kl,p.abort(),xl(null,"timeout",p,i)}),i.timeout)),p.send(i.data?i.data:null),i.promise.abort=function(){p.abort()},i.promise)};function Cl(e,t,i){var s=i.context,r="success";i.success.call(s,e,r,t),i.promise.resolve(e,r,t),Dl(r,t,i)}function Dl(e,t,i){var s=i.context;i.complete.call(s,t,e)}function xl(e,t,i,s){var r=s.context;s.error.call(r,i,t,e),s.promise.reject(i,t,e),Dl(t,i,s)}function Rl(e){var t;if(!ml){for(ml={};t=bl.exec(wl);)ml[t[1].toLowerCase()]=t[2];t=ml[e.toLowerCase()]}return null===t?null:t}function Pl(e,t){return(e+"&"+t).replace(/[&?]{1,2}/,"?")}function Bl(e){!Fl(e)||e.data instanceof FormData||!e.processData||(e.data=function(e,t){var i=[];return i.add=function(e,t){this.push(encodeURIComponent(e)+"="+encodeURIComponent(t))},Il(i,e,t),i.join("&").replace("%20","+")}(e.data)),!e.data||e.type&&"GET"!==e.type.toUpperCase()||(e.url=Pl(e.url,e.data))}function Il(e,t,i,s){var r=function(e){return"[object Array]"===Object.prototype.toString.call(e)}(t);for(var o in t){var a=t[o];s&&(o=i?s:s+"["+(r?"":o)+"]"),!s&&r?e.add(a.name,a.value):(i?r(a):Fl(a))?Il(e,a,i,o):e.add(o,a)}}function Ml(e){for(var t=Array.prototype.slice,i=t.call(arguments,1),s=0,r=i.length;s255)return!1;return!0}function Gl(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!jl(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(Nl(e.length)&&jl(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function zl(e){return new Uint8Array(e)}function Wl(e,t,i,s,r){null==s&&null==r||(e=e.slice?e.slice(s,r):Array.prototype.slice.call(e,s,r)),t.set(e,i)}Ll.get=function(e,t,i,s){return Ul(t)&&(s=s||i,i=t,t=void 0),Ll({url:e,data:t,success:i,dataType:s})},Ll.post=function(e,t,i,s){return Ul(t)&&(s=s||i,i=t,t=void 0),Ll({type:"POST",url:e,data:t,success:i,dataType:s})},Ll.getJSON=function(e,t,i){return Ul(t)&&(i=t,t=void 0),Ll({url:e,data:t,success:i,dataType:"json"})},Ll.ajaxSetup=function(e,t){return t?Ml(Ml(e,Tl),t):Ml(Tl,e)};var Vl={toBytes:function(e){var t=[],i=0;for(e=encodeURI(e);i191&&s<224?(t.push(String.fromCharCode((31&s)<<6|63&e[i+1])),i+=2):(t.push(String.fromCharCode((15&s)<<12|(63&e[i+1])<<6|63&e[i+2])),i+=3)}return t.join("")}},Hl=function(){var e="0123456789abcdef";return{toBytes:function(e){for(var t=[],i=0;i>4]+e[15&r])}return i.join("")}}}(),$l={16:10,24:12,32:14},Jl=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],ql=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],Kl=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],Yl=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],Ql=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],Xl=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],Zl=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],ed=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],td=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],id=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],sd=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],rd=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],od=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],ad=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],nd=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function ld(e){for(var t=[],i=0;i>2,this._Ke[i][t%4]=o[t],this._Kd[e-i][t%4]=o[t];for(var a,n=0,l=r;l>16&255]<<24^ql[a>>8&255]<<16^ql[255&a]<<8^ql[a>>24&255]^Jl[n]<<24,n+=1,8!=r)for(t=1;t>8&255]<<8^ql[a>>16&255]<<16^ql[a>>24&255]<<24;for(t=r/2+1;t>2,h=l%4,this._Ke[d][h]=o[t],this._Kd[e-d][h]=o[t++],l++}for(var d=1;d>24&255]^od[a>>16&255]^ad[a>>8&255]^nd[255&a]},dd.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,i=[0,0,0,0],s=ld(e),r=0;r<4;r++)s[r]^=this._Ke[0][r];for(var o=1;o>24&255]^Ql[s[(r+1)%4]>>16&255]^Xl[s[(r+2)%4]>>8&255]^Zl[255&s[(r+3)%4]]^this._Ke[o][r];s=i.slice()}var a,n=zl(16);for(r=0;r<4;r++)a=this._Ke[t][r],n[4*r]=255&(ql[s[r]>>24&255]^a>>24),n[4*r+1]=255&(ql[s[(r+1)%4]>>16&255]^a>>16),n[4*r+2]=255&(ql[s[(r+2)%4]>>8&255]^a>>8),n[4*r+3]=255&(ql[255&s[(r+3)%4]]^a);return n},dd.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,i=[0,0,0,0],s=ld(e),r=0;r<4;r++)s[r]^=this._Kd[0][r];for(var o=1;o>24&255]^td[s[(r+3)%4]>>16&255]^id[s[(r+2)%4]>>8&255]^sd[255&s[(r+1)%4]]^this._Kd[o][r];s=i.slice()}var a,n=zl(16);for(r=0;r<4;r++)a=this._Kd[t][r],n[4*r]=255&(Kl[s[r]>>24&255]^a>>24),n[4*r+1]=255&(Kl[s[(r+3)%4]>>16&255]^a>>16),n[4*r+2]=255&(Kl[s[(r+2)%4]>>8&255]^a>>8),n[4*r+3]=255&(Kl[255&s[(r+1)%4]]^a);return n};var hd=function(e){if(!(this instanceof hd))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new dd(e)};hd.prototype.encrypt=function(e){if((e=Gl(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=zl(e.length),i=zl(16),s=0;sNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},fd.prototype.setBytes=function(e){if(16!=(e=Gl(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},fd.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var md=function(e,t){if(!(this instanceof md))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof fd||(t=new fd(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new dd(e)};md.prototype.encrypt=function(e){for(var t=Gl(e,!0),i=0;i16)throw new Error("PKCS#7 padding byte out of range");for(var i=e.length-t,s=0;s>>2]>>>24-o%4*8&255;t[s+o>>>2]|=a<<24-(s+o)%4*8}else for(var n=0;n>>2]=i[n>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,i=this.sigBytes;t[i>>>2]&=4294967295<<32-i%4*8,t.length=e.ceil(i/4)},clone:function(){var e=l.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],i=0;i>>2]>>>24-r%4*8&255;s.push((o>>>4).toString(16)),s.push((15&o).toString(16))}return s.join("")},parse:function(e){for(var t=e.length,i=[],s=0;s>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new d.init(i,t/2)}},u=h.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],r=0;r>>2]>>>24-r%4*8&255;s.push(String.fromCharCode(o))}return s.join("")},parse:function(e){for(var t=e.length,i=[],s=0;s>>2]|=(255&e.charCodeAt(s))<<24-s%4*8;return new d.init(i,t)}},p=h.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},f=n.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var i,s=this._data,r=s.words,o=s.sigBytes,a=this.blockSize,n=o/(4*a),l=(n=t?e.ceil(n):e.max((0|n)-this._minBufferSize,0))*a,h=e.min(4*l,o);if(l){for(var c=0;c>>2]|=e[r]<<24-r%4*8;t.call(this,s,i)}else t.apply(this,arguments)};s.prototype=e}}(),i.lib.WordArray)})),Lr((function(e,t){var i;e.exports=(i=yd,function(){var e=i,t=e.lib.WordArray,s=e.enc;function r(e){return e<<8&4278255360|e>>>8&16711935}s.Utf16=s.Utf16BE={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],r=0;r>>2]>>>16-r%4*8&65535;s.push(String.fromCharCode(o))}return s.join("")},parse:function(e){for(var i=e.length,s=[],r=0;r>>1]|=e.charCodeAt(r)<<16-r%2*16;return t.create(s,2*i)}},s.Utf16LE={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],o=0;o>>2]>>>16-o%4*8&65535);s.push(String.fromCharCode(a))}return s.join("")},parse:function(e){for(var i=e.length,s=[],o=0;o>>1]|=r(e.charCodeAt(o)<<16-o%2*16);return t.create(s,2*i)}}}(),i.enc.Utf16)})),Lr((function(e,t){var i;e.exports=(i=yd,function(){var e=i,t=e.lib.WordArray;function s(e,i,s){for(var r=[],o=0,a=0;a>>6-a%4*2;r[o>>>2]|=n<<24-o%4*8,o++}return t.create(r,o)}e.enc.Base64={stringify:function(e){var t=e.words,i=e.sigBytes,s=this._map;e.clamp();for(var r=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,n=0;n<4&&o+.75*n>>6*(3-n)&63));var l=s.charAt(64);if(l)for(;r.length%4;)r.push(l);return r.join("")},parse:function(e){var t=e.length,i=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o>>6-a%4*2;r[o>>>2]|=n<<24-o%4*8,o++}return t.create(r,o)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var i=e.words,s=e.sigBytes,r=t?this._safe_map:this._map;e.clamp();for(var o=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(i[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|i[a+2>>>2]>>>24-(a+2)%4*8&255,l=0;l<4&&a+.75*l>>6*(3-l)&63));var d=r.charAt(64);if(d)for(;o.length%4;)o.push(d);return o.join("")},parse:function(e,t){void 0===t&&(t=!0);var i=e.length,r=t?this._safe_map:this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var a=0;a>>24)|4278255360&(r<<24|r>>>8)}var o=this._hash.words,a=e[t+0],l=e[t+1],p=e[t+2],f=e[t+3],m=e[t+4],g=e[t+5],y=e[t+6],A=e[t+7],b=e[t+8],v=e[t+9],_=e[t+10],S=e[t+11],E=e[t+12],w=e[t+13],T=e[t+14],k=e[t+15],L=o[0],C=o[1],D=o[2],x=o[3];L=d(L,C,D,x,a,7,n[0]),x=d(x,L,C,D,l,12,n[1]),D=d(D,x,L,C,p,17,n[2]),C=d(C,D,x,L,f,22,n[3]),L=d(L,C,D,x,m,7,n[4]),x=d(x,L,C,D,g,12,n[5]),D=d(D,x,L,C,y,17,n[6]),C=d(C,D,x,L,A,22,n[7]),L=d(L,C,D,x,b,7,n[8]),x=d(x,L,C,D,v,12,n[9]),D=d(D,x,L,C,_,17,n[10]),C=d(C,D,x,L,S,22,n[11]),L=d(L,C,D,x,E,7,n[12]),x=d(x,L,C,D,w,12,n[13]),D=d(D,x,L,C,T,17,n[14]),L=h(L,C=d(C,D,x,L,k,22,n[15]),D,x,l,5,n[16]),x=h(x,L,C,D,y,9,n[17]),D=h(D,x,L,C,S,14,n[18]),C=h(C,D,x,L,a,20,n[19]),L=h(L,C,D,x,g,5,n[20]),x=h(x,L,C,D,_,9,n[21]),D=h(D,x,L,C,k,14,n[22]),C=h(C,D,x,L,m,20,n[23]),L=h(L,C,D,x,v,5,n[24]),x=h(x,L,C,D,T,9,n[25]),D=h(D,x,L,C,f,14,n[26]),C=h(C,D,x,L,b,20,n[27]),L=h(L,C,D,x,w,5,n[28]),x=h(x,L,C,D,p,9,n[29]),D=h(D,x,L,C,A,14,n[30]),L=c(L,C=h(C,D,x,L,E,20,n[31]),D,x,g,4,n[32]),x=c(x,L,C,D,b,11,n[33]),D=c(D,x,L,C,S,16,n[34]),C=c(C,D,x,L,T,23,n[35]),L=c(L,C,D,x,l,4,n[36]),x=c(x,L,C,D,m,11,n[37]),D=c(D,x,L,C,A,16,n[38]),C=c(C,D,x,L,_,23,n[39]),L=c(L,C,D,x,w,4,n[40]),x=c(x,L,C,D,a,11,n[41]),D=c(D,x,L,C,f,16,n[42]),C=c(C,D,x,L,y,23,n[43]),L=c(L,C,D,x,v,4,n[44]),x=c(x,L,C,D,E,11,n[45]),D=c(D,x,L,C,k,16,n[46]),L=u(L,C=c(C,D,x,L,p,23,n[47]),D,x,a,6,n[48]),x=u(x,L,C,D,A,10,n[49]),D=u(D,x,L,C,T,15,n[50]),C=u(C,D,x,L,g,21,n[51]),L=u(L,C,D,x,E,6,n[52]),x=u(x,L,C,D,f,10,n[53]),D=u(D,x,L,C,_,15,n[54]),C=u(C,D,x,L,l,21,n[55]),L=u(L,C,D,x,b,6,n[56]),x=u(x,L,C,D,k,10,n[57]),D=u(D,x,L,C,y,15,n[58]),C=u(C,D,x,L,w,21,n[59]),L=u(L,C,D,x,m,6,n[60]),x=u(x,L,C,D,S,10,n[61]),D=u(D,x,L,C,p,15,n[62]),C=u(C,D,x,L,v,21,n[63]),o[0]=o[0]+L|0,o[1]=o[1]+C|0,o[2]=o[2]+D|0,o[3]=o[3]+x|0},_doFinalize:function(){var t=this._data,i=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;i[r>>>5]|=128<<24-r%32;var o=e.floor(s/4294967296),a=s;i[15+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),i[14+(r+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(i.length+1),this._process();for(var n=this._hash,l=n.words,d=0;d<4;d++){var h=l[d];l[d]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}return n},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function d(e,t,i,s,r,o,a){var n=e+(t&i|~t&s)+r+a;return(n<>>32-o)+t}function h(e,t,i,s,r,o,a){var n=e+(t&s|i&~s)+r+a;return(n<>>32-o)+t}function c(e,t,i,s,r,o,a){var n=e+(t^i^s)+r+a;return(n<>>32-o)+t}function u(e,t,i,s,r,o,a){var n=e+(i^(t|~s))+r+a;return(n<>>32-o)+t}t.MD5=o._createHelper(l),t.HmacMD5=o._createHmacHelper(l)}(Math),i.MD5)})),Lr((function(e,t){var i,s,r,o,a,n,l,d;e.exports=(s=(i=d=yd).lib,r=s.WordArray,o=s.Hasher,a=i.algo,n=[],l=a.SHA1=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],r=i[1],o=i[2],a=i[3],l=i[4],d=0;d<80;d++){if(d<16)n[d]=0|e[t+d];else{var h=n[d-3]^n[d-8]^n[d-14]^n[d-16];n[d]=h<<1|h>>>31}var c=(s<<5|s>>>27)+l+n[d];c+=d<20?1518500249+(r&o|~r&a):d<40?1859775393+(r^o^a):d<60?(r&o|r&a|o&a)-1894007588:(r^o^a)-899497514,l=a,a=o,o=r<<30|r>>>2,r=s,s=c}i[0]=i[0]+s|0,i[1]=i[1]+r|0,i[2]=i[2]+o|0,i[3]=i[3]+a|0,i[4]=i[4]+l|0},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;return t[s>>>5]|=128<<24-s%32,t[14+(s+64>>>9<<4)]=Math.floor(i/4294967296),t[15+(s+64>>>9<<4)]=i,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),i.SHA1=o._createHelper(l),i.HmacSHA1=o._createHmacHelper(l),d.SHA1)})),Lr((function(e,t){var i;e.exports=(i=yd,function(e){var t=i,s=t.lib,r=s.WordArray,o=s.Hasher,a=t.algo,n=[],l=[];!function(){function t(t){for(var i=e.sqrt(t),s=2;s<=i;s++)if(!(t%s))return!1;return!0}function i(e){return 4294967296*(e-(0|e))|0}for(var s=2,r=0;r<64;)t(s)&&(r<8&&(n[r]=i(e.pow(s,.5))),l[r]=i(e.pow(s,1/3)),r++),s++}();var d=[],h=a.SHA256=o.extend({_doReset:function(){this._hash=new r.init(n.slice(0))},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],r=i[1],o=i[2],a=i[3],n=i[4],h=i[5],c=i[6],u=i[7],p=0;p<64;p++){if(p<16)d[p]=0|e[t+p];else{var f=d[p-15],m=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,g=d[p-2],y=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;d[p]=m+d[p-7]+y+d[p-16]}var A=s&r^s&o^r&o,b=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),v=u+((n<<26|n>>>6)^(n<<21|n>>>11)^(n<<7|n>>>25))+(n&h^~n&c)+l[p]+d[p];u=c,c=h,h=n,n=a+v|0,a=o,o=r,r=s,s=v+(b+A)|0}i[0]=i[0]+s|0,i[1]=i[1]+r|0,i[2]=i[2]+o|0,i[3]=i[3]+a|0,i[4]=i[4]+n|0,i[5]=i[5]+h|0,i[6]=i[6]+c|0,i[7]=i[7]+u|0},_doFinalize:function(){var t=this._data,i=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;return i[r>>>5]|=128<<24-r%32,i[14+(r+64>>>9<<4)]=e.floor(s/4294967296),i[15+(r+64>>>9<<4)]=s,t.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(h),t.HmacSHA256=o._createHmacHelper(h)}(Math),i.SHA256)})),Lr((function(e,t){var i,s,r,o,a,n;e.exports=(s=(i=n=yd).lib.WordArray,r=i.algo,o=r.SHA256,a=r.SHA224=o.extend({_doReset:function(){this._hash=new s.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=4,e}}),i.SHA224=o._createHelper(a),i.HmacSHA224=o._createHmacHelper(a),n.SHA224)})),Lr((function(e,t){var i;e.exports=(i=yd,function(){var e=i,t=e.lib.Hasher,s=e.x64,r=s.Word,o=s.WordArray,a=e.algo;function n(){return r.create.apply(r,arguments)}var l=[n(1116352408,3609767458),n(1899447441,602891725),n(3049323471,3964484399),n(3921009573,2173295548),n(961987163,4081628472),n(1508970993,3053834265),n(2453635748,2937671579),n(2870763221,3664609560),n(3624381080,2734883394),n(310598401,1164996542),n(607225278,1323610764),n(1426881987,3590304994),n(1925078388,4068182383),n(2162078206,991336113),n(2614888103,633803317),n(3248222580,3479774868),n(3835390401,2666613458),n(4022224774,944711139),n(264347078,2341262773),n(604807628,2007800933),n(770255983,1495990901),n(1249150122,1856431235),n(1555081692,3175218132),n(1996064986,2198950837),n(2554220882,3999719339),n(2821834349,766784016),n(2952996808,2566594879),n(3210313671,3203337956),n(3336571891,1034457026),n(3584528711,2466948901),n(113926993,3758326383),n(338241895,168717936),n(666307205,1188179964),n(773529912,1546045734),n(1294757372,1522805485),n(1396182291,2643833823),n(1695183700,2343527390),n(1986661051,1014477480),n(2177026350,1206759142),n(2456956037,344077627),n(2730485921,1290863460),n(2820302411,3158454273),n(3259730800,3505952657),n(3345764771,106217008),n(3516065817,3606008344),n(3600352804,1432725776),n(4094571909,1467031594),n(275423344,851169720),n(430227734,3100823752),n(506948616,1363258195),n(659060556,3750685593),n(883997877,3785050280),n(958139571,3318307427),n(1322822218,3812723403),n(1537002063,2003034995),n(1747873779,3602036899),n(1955562222,1575990012),n(2024104815,1125592928),n(2227730452,2716904306),n(2361852424,442776044),n(2428436474,593698344),n(2756734187,3733110249),n(3204031479,2999351573),n(3329325298,3815920427),n(3391569614,3928383900),n(3515267271,566280711),n(3940187606,3454069534),n(4118630271,4000239992),n(116418474,1914138554),n(174292421,2731055270),n(289380356,3203993006),n(460393269,320620315),n(685471733,587496836),n(852142971,1086792851),n(1017036298,365543100),n(1126000580,2618297676),n(1288033470,3409855158),n(1501505948,4234509866),n(1607167915,987167468),n(1816402316,1246189591)],d=[];!function(){for(var e=0;e<80;e++)d[e]=n()}();var h=a.SHA512=t.extend({_doReset:function(){this._hash=new o.init([new r.init(1779033703,4089235720),new r.init(3144134277,2227873595),new r.init(1013904242,4271175723),new r.init(2773480762,1595750129),new r.init(1359893119,2917565137),new r.init(2600822924,725511199),new r.init(528734635,4215389547),new r.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],r=i[1],o=i[2],a=i[3],n=i[4],h=i[5],c=i[6],u=i[7],p=s.high,f=s.low,m=r.high,g=r.low,y=o.high,A=o.low,b=a.high,v=a.low,_=n.high,S=n.low,E=h.high,w=h.low,T=c.high,k=c.low,L=u.high,C=u.low,D=p,x=f,R=m,P=g,B=y,I=A,M=b,F=v,U=_,O=S,N=E,j=w,G=T,z=k,W=L,V=C,H=0;H<80;H++){var $,J,q=d[H];if(H<16)J=q.high=0|e[t+2*H],$=q.low=0|e[t+2*H+1];else{var K=d[H-15],Y=K.high,Q=K.low,X=(Y>>>1|Q<<31)^(Y>>>8|Q<<24)^Y>>>7,Z=(Q>>>1|Y<<31)^(Q>>>8|Y<<24)^(Q>>>7|Y<<25),ee=d[H-2],te=ee.high,ie=ee.low,se=(te>>>19|ie<<13)^(te<<3|ie>>>29)^te>>>6,re=(ie>>>19|te<<13)^(ie<<3|te>>>29)^(ie>>>6|te<<26),oe=d[H-7],ae=oe.high,ne=oe.low,le=d[H-16],de=le.high,he=le.low;J=(J=(J=X+ae+(($=Z+ne)>>>0>>0?1:0))+se+(($+=re)>>>0>>0?1:0))+de+(($+=he)>>>0>>0?1:0),q.high=J,q.low=$}var ce,ue=U&N^~U&G,pe=O&j^~O&z,fe=D&R^D&B^R&B,me=x&P^x&I^P&I,ge=(D>>>28|x<<4)^(D<<30|x>>>2)^(D<<25|x>>>7),ye=(x>>>28|D<<4)^(x<<30|D>>>2)^(x<<25|D>>>7),Ae=(U>>>14|O<<18)^(U>>>18|O<<14)^(U<<23|O>>>9),be=(O>>>14|U<<18)^(O>>>18|U<<14)^(O<<23|U>>>9),ve=l[H],_e=ve.high,Se=ve.low,Ee=W+Ae+((ce=V+be)>>>0>>0?1:0),we=ye+me;W=G,V=z,G=N,z=j,N=U,j=O,U=M+(Ee=(Ee=(Ee=Ee+ue+((ce+=pe)>>>0>>0?1:0))+_e+((ce+=Se)>>>0>>0?1:0))+J+((ce+=$)>>>0<$>>>0?1:0))+((O=F+ce|0)>>>0>>0?1:0)|0,M=B,F=I,B=R,I=P,R=D,P=x,D=Ee+(ge+fe+(we>>>0>>0?1:0))+((x=ce+we|0)>>>0>>0?1:0)|0}f=s.low=f+x,s.high=p+D+(f>>>0>>0?1:0),g=r.low=g+P,r.high=m+R+(g>>>0

>>0?1:0),A=o.low=A+I,o.high=y+B+(A>>>0>>0?1:0),v=a.low=v+F,a.high=b+M+(v>>>0>>0?1:0),S=n.low=S+O,n.high=_+U+(S>>>0>>0?1:0),w=h.low=w+j,h.high=E+N+(w>>>0>>0?1:0),k=c.low=k+z,c.high=T+G+(k>>>0>>0?1:0),C=u.low=C+V,u.high=L+W+(C>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;return t[s>>>5]|=128<<24-s%32,t[30+(s+128>>>10<<5)]=Math.floor(i/4294967296),t[31+(s+128>>>10<<5)]=i,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(h),e.HmacSHA512=t._createHmacHelper(h)}(),i.SHA512)})),Lr((function(e,t){var i,s,r,o,a,n,l,d;e.exports=(s=(i=d=yd).x64,r=s.Word,o=s.WordArray,a=i.algo,n=a.SHA512,l=a.SHA384=n.extend({_doReset:function(){this._hash=new o.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=16,e}}),i.SHA384=n._createHelper(l),i.HmacSHA384=n._createHmacHelper(l),d.SHA384)})),Lr((function(e,t){var i;e.exports=(i=yd,function(e){var t=i,s=t.lib,r=s.WordArray,o=s.Hasher,a=t.x64.Word,n=t.algo,l=[],d=[],h=[];!function(){for(var e=1,t=0,i=0;i<24;i++){l[e+5*t]=(i+1)*(i+2)/2%64;var s=(2*e+3*t)%5;e=t%5,t=s}for(e=0;e<5;e++)for(t=0;t<5;t++)d[e+5*t]=t+(2*e+3*t)%5*5;for(var r=1,o=0;o<24;o++){for(var n=0,c=0,u=0;u<7;u++){if(1&r){var p=(1<>>24)|4278255360&(o<<24|o>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(C=i[r]).high^=a,C.low^=o}for(var n=0;n<24;n++){for(var u=0;u<5;u++){for(var p=0,f=0,m=0;m<5;m++)p^=(C=i[u+5*m]).high,f^=C.low;var g=c[u];g.high=p,g.low=f}for(u=0;u<5;u++){var y=c[(u+4)%5],A=c[(u+1)%5],b=A.high,v=A.low;for(p=y.high^(b<<1|v>>>31),f=y.low^(v<<1|b>>>31),m=0;m<5;m++)(C=i[u+5*m]).high^=p,C.low^=f}for(var _=1;_<25;_++){var S=(C=i[_]).high,E=C.low,w=l[_];w<32?(p=S<>>32-w,f=E<>>32-w):(p=E<>>64-w,f=S<>>64-w);var T=c[d[_]];T.high=p,T.low=f}var k=c[0],L=i[0];for(k.high=L.high,k.low=L.low,u=0;u<5;u++)for(m=0;m<5;m++){var C=i[_=u+5*m],D=c[_],x=c[(u+1)%5+5*m],R=c[(u+2)%5+5*m];C.high=D.high^~x.high&R.high,C.low=D.low^~x.low&R.low}C=i[0];var P=h[n];C.high^=P.high,C.low^=P.low}},_doFinalize:function(){var t=this._data,i=t.words;this._nDataBytes;var s=8*t.sigBytes,o=32*this.blockSize;i[s>>>5]|=1<<24-s%32,i[(e.ceil((s+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*i.length,this._process();for(var a=this._state,n=this.cfg.outputLength/8,l=n/8,d=[],h=0;h>>24)|4278255360&(u<<24|u>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),d.push(p),d.push(u)}return new r.init(d,n)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),i=0;i<25;i++)t[i]=t[i].clone();return e}});t.SHA3=o._createHelper(u),t.HmacSHA3=o._createHmacHelper(u)}(Math),i.SHA3)})),Lr((function(e,t){var i;e.exports=(i=yd,function(e){var t=i,s=t.lib,r=s.WordArray,o=s.Hasher,a=t.algo,n=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),l=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),d=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),h=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),c=r.create([0,1518500249,1859775393,2400959708,2840853838]),u=r.create([1352829926,1548603684,1836072691,2053994217,0]),p=a.RIPEMD160=o.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=0;i<16;i++){var s=t+i,r=e[s];e[s]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var o,a,p,v,_,S,E,w,T,k,L,C=this._hash.words,D=c.words,x=u.words,R=n.words,P=l.words,B=d.words,I=h.words;for(S=o=C[0],E=a=C[1],w=p=C[2],T=v=C[3],k=_=C[4],i=0;i<80;i+=1)L=o+e[t+R[i]]|0,L+=i<16?f(a,p,v)+D[0]:i<32?m(a,p,v)+D[1]:i<48?g(a,p,v)+D[2]:i<64?y(a,p,v)+D[3]:A(a,p,v)+D[4],L=(L=b(L|=0,B[i]))+_|0,o=_,_=v,v=b(p,10),p=a,a=L,L=S+e[t+P[i]]|0,L+=i<16?A(E,w,T)+x[0]:i<32?y(E,w,T)+x[1]:i<48?g(E,w,T)+x[2]:i<64?m(E,w,T)+x[3]:f(E,w,T)+x[4],L=(L=b(L|=0,I[i]))+k|0,S=k,k=T,T=b(w,10),w=E,E=L;L=C[1]+p+T|0,C[1]=C[2]+v+k|0,C[2]=C[3]+_+S|0,C[3]=C[4]+o+E|0,C[4]=C[0]+a+w|0,C[0]=L},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;t[s>>>5]|=128<<24-s%32,t[14+(s+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),e.sigBytes=4*(t.length+1),this._process();for(var r=this._hash,o=r.words,a=0;a<5;a++){var n=o[a];o[a]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}return r},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function f(e,t,i){return e^t^i}function m(e,t,i){return e&t|~e&i}function g(e,t,i){return(e|~t)^i}function y(e,t,i){return e&i|t&~i}function A(e,t,i){return e^(t|~i)}function b(e,t){return e<>>32-t}t.RIPEMD160=o._createHelper(p),t.HmacRIPEMD160=o._createHmacHelper(p)}(),i.RIPEMD160)})),Lr((function(e,t){var i,s,r;e.exports=(s=(i=yd).lib.Base,r=i.enc.Utf8,void(i.algo.HMAC=s.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var i=e.blockSize,s=4*i;t.sigBytes>s&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),a=this._iKey=t.clone(),n=o.words,l=a.words,d=0;d>>2];e.sigBytes-=t}};s.BlockCipher=h.extend({cfg:h.cfg.extend({mode:p,padding:f}),reset:function(){var e;h.reset.call(this);var t=this.cfg,i=t.iv,s=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=s.createEncryptor:(e=s.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,i&&i.words):(this._mode=e.call(s,this,i&&i.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=s.CipherParams=r.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),g=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,i=e.salt;return(i?o.create([1398893684,1701076831]).concat(i).concat(t):t).toString(l)},parse:function(e){var t,i=l.parse(e),s=i.words;return 1398893684==s[0]&&1701076831==s[1]&&(t=o.create(s.slice(2,4)),s.splice(0,4),i.sigBytes-=16),m.create({ciphertext:i,salt:t})}},y=s.SerializableCipher=r.extend({cfg:r.extend({format:g}),encrypt:function(e,t,i,s){s=this.cfg.extend(s);var r=e.createEncryptor(i,s),o=r.finalize(t),a=r.cfg;return m.create({ciphertext:o,key:i,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:s.format})},decrypt:function(e,t,i,s){return s=this.cfg.extend(s),t=this._parse(t,s.format),e.createDecryptor(i,s).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),A=(t.kdf={}).OpenSSL={execute:function(e,t,i,s,r){if(s||(s=o.random(8)),r)a=d.create({keySize:t+i,hasher:r}).compute(e,s);else var a=d.create({keySize:t+i}).compute(e,s);var n=o.create(a.words.slice(t),4*i);return a.sigBytes=4*t,m.create({key:a,iv:n,salt:s})}},b=s.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:A}),encrypt:function(e,t,i,s){var r=(s=this.cfg.extend(s)).kdf.execute(i,e.keySize,e.ivSize,s.salt,s.hasher);s.iv=r.iv;var o=y.encrypt.call(this,e,t,r.key,s);return o.mixIn(r),o},decrypt:function(e,t,i,s){s=this.cfg.extend(s),t=this._parse(t,s.format);var r=s.kdf.execute(i,e.keySize,e.ivSize,t.salt,s.hasher);return s.iv=r.iv,y.decrypt.call(this,e,t,r.key,s)}})}())})),Lr((function(e,t){var i;e.exports=((i=yd).mode.CFB=function(){var e=i.lib.BlockCipherMode.extend();function t(e,t,i,s){var r,o=this._iv;o?(r=o.slice(0),this._iv=void 0):r=this._prevBlock,s.encryptBlock(r,0);for(var a=0;a>24&255)){var t=e>>16&255,i=e>>8&255,s=255&e;255===t?(t=0,255===i?(i=0,255===s?s=0:++s):++i):++t,e=0,e+=t<<16,e+=i<<8,e+=s}else e+=1<<24;return e}function s(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var r=e.Encryptor=e.extend({processBlock:function(e,t){var i=this._cipher,r=i.blockSize,o=this._iv,a=this._counter;o&&(a=this._counter=o.slice(0),this._iv=void 0),s(a);var n=a.slice(0);i.encryptBlock(n,0);for(var l=0;l>>2]|=r<<24-o%4*8,e.sigBytes+=r},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Ansix923)})),Lr((function(e,t){var i;e.exports=((i=yd).pad.Iso10126={pad:function(e,t){var s=4*t,r=s-e.sigBytes%s;e.concat(i.lib.WordArray.random(r-1)).concat(i.lib.WordArray.create([r<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Iso10126)})),Lr((function(e,t){var i;e.exports=((i=yd).pad.Iso97971={pad:function(e,t){e.concat(i.lib.WordArray.create([2147483648],1)),i.pad.ZeroPadding.pad(e,t)},unpad:function(e){i.pad.ZeroPadding.unpad(e),e.sigBytes--}},i.pad.Iso97971)})),Lr((function(e,t){var i;e.exports=((i=yd).pad.ZeroPadding={pad:function(e,t){var i=4*t;e.clamp(),e.sigBytes+=i-(e.sigBytes%i||i)},unpad:function(e){var t=e.words,i=e.sigBytes-1;for(i=e.sigBytes-1;i>=0;i--)if(t[i>>>2]>>>24-i%4*8&255){e.sigBytes=i+1;break}}},i.pad.ZeroPadding)})),Lr((function(e,t){var i;e.exports=((i=yd).pad.NoPadding={pad:function(){},unpad:function(){}},i.pad.NoPadding)})),Lr((function(e,t){var i;e.exports=(i=yd,function(e){var t=i,s=t.lib.CipherParams,r=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(r)},parse:function(e){var t=r.parse(e);return s.create({ciphertext:t})}}}(),i.format.Hex)})),Lr((function(e,t){var i;e.exports=(i=yd,function(){var e=i,t=e.lib.BlockCipher,s=e.algo,r=[],o=[],a=[],n=[],l=[],d=[],h=[],c=[],u=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var i=0,s=0;for(t=0;t<256;t++){var f=s^s<<1^s<<2^s<<3^s<<4;f=f>>>8^255&f^99,r[i]=f,o[f]=i;var m=e[i],g=e[m],y=e[g],A=257*e[f]^16843008*f;a[i]=A<<24|A>>>8,n[i]=A<<16|A>>>16,l[i]=A<<8|A>>>24,d[i]=A,A=16843009*y^65537*g^257*m^16843008*i,h[f]=A<<24|A>>>8,c[f]=A<<16|A>>>16,u[f]=A<<8|A>>>24,p[f]=A,i?(i=m^e[e[e[y^m]]],s^=e[e[s]]):i=s=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],m=s.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,i=e.sigBytes/4,s=4*((this._nRounds=i+6)+1),o=this._keySchedule=[],a=0;a6&&a%i==4&&(d=r[d>>>24]<<24|r[d>>>16&255]<<16|r[d>>>8&255]<<8|r[255&d]):(d=r[(d=d<<8|d>>>24)>>>24]<<24|r[d>>>16&255]<<16|r[d>>>8&255]<<8|r[255&d],d^=f[a/i|0]<<24),o[a]=o[a-i]^d);for(var n=this._invKeySchedule=[],l=0;l>>24]]^c[r[d>>>16&255]]^u[r[d>>>8&255]]^p[r[255&d]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,n,l,d,r)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,h,c,u,p,o),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,s,r,o,a,n){for(var l=this._nRounds,d=e[t]^i[0],h=e[t+1]^i[1],c=e[t+2]^i[2],u=e[t+3]^i[3],p=4,f=1;f>>24]^r[h>>>16&255]^o[c>>>8&255]^a[255&u]^i[p++],g=s[h>>>24]^r[c>>>16&255]^o[u>>>8&255]^a[255&d]^i[p++],y=s[c>>>24]^r[u>>>16&255]^o[d>>>8&255]^a[255&h]^i[p++],A=s[u>>>24]^r[d>>>16&255]^o[h>>>8&255]^a[255&c]^i[p++];d=m,h=g,c=y,u=A}m=(n[d>>>24]<<24|n[h>>>16&255]<<16|n[c>>>8&255]<<8|n[255&u])^i[p++],g=(n[h>>>24]<<24|n[c>>>16&255]<<16|n[u>>>8&255]<<8|n[255&d])^i[p++],y=(n[c>>>24]<<24|n[u>>>16&255]<<16|n[d>>>8&255]<<8|n[255&h])^i[p++],A=(n[u>>>24]<<24|n[d>>>16&255]<<16|n[h>>>8&255]<<8|n[255&c])^i[p++],e[t]=m,e[t+1]=g,e[t+2]=y,e[t+3]=A},keySize:8});e.AES=t._createHelper(m)}(),i.AES)})),Lr((function(e,t){var i;e.exports=(i=yd,function(){var e=i,t=e.lib,s=t.WordArray,r=t.BlockCipher,o=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],n=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],d=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],h=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],c=o.DES=r.extend({_doReset:function(){for(var e=this._key.words,t=[],i=0;i<56;i++){var s=a[i]-1;t[i]=e[s>>>5]>>>31-s%32&1}for(var r=this._subKeys=[],o=0;o<16;o++){var d=r[o]=[],h=l[o];for(i=0;i<24;i++)d[i/6|0]|=t[(n[i]-1+h)%28]<<31-i%6,d[4+(i/6|0)]|=t[28+(n[i+24]-1+h)%28]<<31-i%6;for(d[0]=d[0]<<1|d[0]>>>31,i=1;i<7;i++)d[i]=d[i]>>>4*(i-1)+3;d[7]=d[7]<<5|d[7]>>>27}var c=this._invSubKeys=[];for(i=0;i<16;i++)c[i]=r[15-i]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,i){this._lBlock=e[t],this._rBlock=e[t+1],u.call(this,4,252645135),u.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),u.call(this,1,1431655765);for(var s=0;s<16;s++){for(var r=i[s],o=this._lBlock,a=this._rBlock,n=0,l=0;l<8;l++)n|=d[l][((a^r[l])&h[l])>>>0];this._lBlock=a,this._rBlock=o^n}var c=this._lBlock;this._lBlock=this._rBlock,this._rBlock=c,u.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),u.call(this,16,65535),u.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function u(e,t){var i=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=i,this._lBlock^=i<>>e^this._lBlock)&t;this._lBlock^=i,this._rBlock^=i<192.");var t=e.slice(0,2),i=e.length<4?e.slice(0,2):e.slice(2,4),r=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=c.createEncryptor(s.create(t)),this._des2=c.createEncryptor(s.create(i)),this._des3=c.createEncryptor(s.create(r))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=r._createHelper(f)}(),i.TripleDES)})),Lr((function(e,t){var i;e.exports=(i=yd,function(){var e=i,t=e.lib.StreamCipher,s=e.algo,r=s.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,i=e.sigBytes,s=this._S=[],r=0;r<256;r++)s[r]=r;r=0;for(var o=0;r<256;r++){var a=r%i,n=t[a>>>2]>>>24-a%4*8&255;o=(o+s[r]+n)%256;var l=s[r];s[r]=s[o],s[o]=l}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,i=this._j,s=0,r=0;r<4;r++){i=(i+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[i],e[i]=o,s|=e[(e[t]+e[i])%256]<<24-8*r}return this._i=t,this._j=i,s}e.RC4=t._createHelper(r);var a=s.RC4Drop=r.extend({cfg:r.cfg.extend({drop:192}),_doReset:function(){r._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});e.RC4Drop=t._createHelper(a)}(),i.RC4)})),Lr((function(e,t){var i;e.exports=(i=yd,function(){var e=i,t=e.lib.StreamCipher,s=e.algo,r=[],o=[],a=[],n=s.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,i=0;i<4;i++)e[i]=16711935&(e[i]<<8|e[i]>>>24)|4278255360&(e[i]<<24|e[i]>>>8);var s=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],r=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,i=0;i<4;i++)l.call(this);for(i=0;i<8;i++)r[i]^=s[i+4&7];if(t){var o=t.words,a=o[0],n=o[1],d=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),c=d>>>16|4294901760&h,u=h<<16|65535&d;for(r[0]^=d,r[1]^=c,r[2]^=h,r[3]^=u,r[4]^=d,r[5]^=c,r[6]^=h,r[7]^=u,i=0;i<4;i++)l.call(this)}},_doProcessBlock:function(e,t){var i=this._X;l.call(this),r[0]=i[0]^i[5]>>>16^i[3]<<16,r[1]=i[2]^i[7]>>>16^i[5]<<16,r[2]=i[4]^i[1]>>>16^i[7]<<16,r[3]=i[6]^i[3]>>>16^i[1]<<16;for(var s=0;s<4;s++)r[s]=16711935&(r[s]<<8|r[s]>>>24)|4278255360&(r[s]<<24|r[s]>>>8),e[t+s]^=r[s]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,i=0;i<8;i++)o[i]=t[i];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,i=0;i<8;i++){var s=e[i]+t[i],r=65535&s,n=s>>>16,l=((r*r>>>17)+r*n>>>15)+n*n,d=((4294901760&s)*s|0)+((65535&s)*s|0);a[i]=l^d}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=t._createHelper(n)}(),i.Rabbit)})),Lr((function(e,t){var i;e.exports=(i=yd,function(){var e=i,t=e.lib.StreamCipher,s=e.algo,r=[],o=[],a=[],n=s.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],s=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var r=0;r<4;r++)l.call(this);for(r=0;r<8;r++)s[r]^=i[r+4&7];if(t){var o=t.words,a=o[0],n=o[1],d=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),c=d>>>16|4294901760&h,u=h<<16|65535&d;for(s[0]^=d,s[1]^=c,s[2]^=h,s[3]^=u,s[4]^=d,s[5]^=c,s[6]^=h,s[7]^=u,r=0;r<4;r++)l.call(this)}},_doProcessBlock:function(e,t){var i=this._X;l.call(this),r[0]=i[0]^i[5]>>>16^i[3]<<16,r[1]=i[2]^i[7]>>>16^i[5]<<16,r[2]=i[4]^i[1]>>>16^i[7]<<16,r[3]=i[6]^i[3]>>>16^i[1]<<16;for(var s=0;s<4;s++)r[s]=16711935&(r[s]<<8|r[s]>>>24)|4278255360&(r[s]<<24|r[s]>>>8),e[t+s]^=r[s]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,i=0;i<8;i++)o[i]=t[i];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,i=0;i<8;i++){var s=e[i]+t[i],r=65535&s,n=s>>>16,l=((r*r>>>17)+r*n>>>15)+n*n,d=((4294901760&s)*s|0)+((65535&s)*s|0);a[i]=l^d}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=t._createHelper(n)}(),i.RabbitLegacy)})),Lr((function(e,t){var i;e.exports=(i=yd,function(){var e=i,t=e.lib.BlockCipher,s=e.algo;const r=16,o=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var n={pbox:[],sbox:[]};function l(e,t){let i=t>>24&255,s=t>>16&255,r=t>>8&255,o=255&t,a=e.sbox[0][i]+e.sbox[1][s];return a^=e.sbox[2][r],a+=e.sbox[3][o],a}function d(e,t,i){let s,o=t,a=i;for(let t=0;t1;--t)o^=e.pbox[t],a=l(e,o)^a,s=o,o=a,a=s;return s=o,o=a,a=s,a^=e.pbox[1],o^=e.pbox[0],{left:o,right:a}}function c(e,t,i){for(let t=0;t<4;t++){e.sbox[t]=[];for(let i=0;i<256;i++)e.sbox[t][i]=a[t][i]}let s=0;for(let a=0;a=i&&(s=0);let n=0,l=0,h=0;for(let t=0;t>>2]|=e[i]<<24-i%4*8;return Ad.lib.WordArray.create(t,e.length)}const _d=16,Sd=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],Ed=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function wd(e){const t=[];for(let i=0,s=e.length;i1===(e=e.toString(16)).length?"0"+e:e)).join("")}function kd(e){const t=[];for(let i=0,s=e.length;i>>6),t.push(128|63&s);else if(s<=55295||s>=57344&&s<=65535)t.push(224|s>>>12),t.push(128|s>>>6&63),t.push(128|63&s);else{if(!(s>=65536&&s<=1114111))throw t.push(s),new Error("input is not supported");i++,t.push(240|s>>>18&28),t.push(128|s>>>12&63),t.push(128|s>>>6&63),t.push(128|63&s)}}return t}function Ld(e){const t=[];for(let i=0,s=e.length;i=240&&e[i]<=247?(t.push(String.fromCodePoint(((7&e[i])<<18)+((63&e[i+1])<<12)+((63&e[i+2])<<6)+(63&e[i+3]))),i+=3):e[i]>=224&&e[i]<=239?(t.push(String.fromCodePoint(((15&e[i])<<12)+((63&e[i+1])<<6)+(63&e[i+2]))),i+=2):e[i]>=192&&e[i]<=223?(t.push(String.fromCodePoint(((31&e[i])<<6)+(63&e[i+1]))),i++):t.push(String.fromCodePoint(e[i]));return t.join("")}function Cd(e,t){const i=31&t;return e<>>32-i}function Dd(e){return(255&Sd[e>>>24&255])<<24|(255&Sd[e>>>16&255])<<16|(255&Sd[e>>>8&255])<<8|255&Sd[255&e]}function xd(e){return e^Cd(e,2)^Cd(e,10)^Cd(e,18)^Cd(e,24)}function Rd(e){return e^Cd(e,13)^Cd(e,23)}function Pd(e,t,i){const s=new Array(4),r=new Array(4);for(let t=0;t<4;t++)r[0]=255&e[4*t],r[1]=255&e[4*t+1],r[2]=255&e[4*t+2],r[3]=255&e[4*t+3],s[t]=r[0]<<24|r[1]<<16|r[2]<<8|r[3];for(let e,t=0;t<32;t+=4)e=s[1]^s[2]^s[3]^i[t+0],s[0]^=xd(Dd(e)),e=s[2]^s[3]^s[0]^i[t+1],s[1]^=xd(Dd(e)),e=s[3]^s[0]^s[1]^i[t+2],s[2]^=xd(Dd(e)),e=s[0]^s[1]^s[2]^i[t+3],s[3]^=xd(Dd(e));for(let e=0;e<16;e+=4)t[e]=s[3-e/4]>>>24&255,t[e+1]=s[3-e/4]>>>16&255,t[e+2]=s[3-e/4]>>>8&255,t[e+3]=255&s[3-e/4]}function Bd(e,t,i){const s=new Array(4),r=new Array(4);for(let t=0;t<4;t++)r[0]=255&e[0+4*t],r[1]=255&e[1+4*t],r[2]=255&e[2+4*t],r[3]=255&e[3+4*t],s[t]=r[0]<<24|r[1]<<16|r[2]<<8|r[3];s[0]^=2746333894,s[1]^=1453994832,s[2]^=1736282519,s[3]^=2993693404;for(let e,i=0;i<32;i+=4)e=s[1]^s[2]^s[3]^Ed[i+0],t[i+0]=s[0]^=Rd(Dd(e)),e=s[2]^s[3]^s[0]^Ed[i+1],t[i+1]=s[1]^=Rd(Dd(e)),e=s[3]^s[0]^s[1]^Ed[i+2],t[i+2]=s[2]^=Rd(Dd(e)),e=s[0]^s[1]^s[2]^Ed[i+3],t[i+3]=s[3]^=Rd(Dd(e));if(0===i)for(let e,i=0;i<16;i++)e=t[i],t[i]=t[31-i],t[31-i]=e}function Id(e,t,i){let{padding:s="pkcs#7",mode:r,iv:o=[],output:a="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===r&&("string"==typeof o&&(o=wd(o)),16!==o.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=wd(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==i?kd(e):wd(e):[...e],("pkcs#5"===s||"pkcs#7"===s)&&0!==i){const t=_d-e.length%_d;for(let i=0;i=_d;){const t=e.slice(c,c+16),s=new Array(16);if("cbc"===r)for(let e=0;e<_d;e++)0!==i&&(t[e]^=d[e]);Pd(t,s,n);for(let e=0;e<_d;e++)"cbc"===r&&0===i&&(s[e]^=d[e]),l[c+e]=s[e];"cbc"===r&&(d=0!==i?s:t),h-=_d,c+=_d}if(("pkcs#5"===s||"pkcs#7"===s)&&0===i){const e=l.length,t=l[e-1];for(let i=1;i<=t;i++)if(l[e-i]!==t)throw new Error("padding is invalid");l.splice(e-t,t)}return"array"!==a?0!==i?Td(l):Ld(l):l}function Md(e){return e[3]|e[2]<<8|e[1]<<16|e[0]<<24}function Fd(e,t,i){for(let s=2;se.length&&s+r<=i.length?e.length-t:s+r>i.length&&t+r<=e.length?i.length-s:t+r<=e.length&&s+r<=i.length?r:i.length>24&255,e>>16&255,e>>8&255,255&e)}function Vd(e,t){return t+3>>19)^(s<<23|s>>>9)}function Jd(e,t){var i=new Array(36);i[0]=Vd(t,0),i[1]=Vd(t,4),i[2]=Vd(t,8),i[3]=Vd(t,12);for(var s=0;s<32;s++)i[s+4]=i[s]^qd(i[s+1]^i[s+2]^i[s+3]^e[s]);var r=new Array(4);for(s=35;s>=32;s--)r[35-s]=i[s];var o=function(e){for(var t=new Array(4*e.length),i=0;i>>30)^(s<<10|s>>>22)^(s<<18|s>>>14)^(s<<24|s>>>8)}function Kd(e,t,i){if(null==e||null==e||e.length%16!=0)return console.log("sm4 key is error!"),null;if(null==i||null==i||i.length<=0)return console.log("cipher is error!"),null;if(null==t||null==t||t.length%16!=0)return console.log("iv is error!"),null;for(var s=Hd(e),r=Math.ceil(i.length/16),o=new Array(i.length),a=t.slice(),n=0;ne)return this.preDelayTimestamp-e>1e3&&this.player.debugWarn("CommonDemux",`getDelay() and preDelayTimestamp is ${this.preDelayTimestamp} > timestamp is ${e} more than ${this.preDelayTimestamp-e}ms and return ${this.delay}`),this.preDelayTimestamp=e,this.delay;if(this.firstTimestamp){if(e){const t=Date.now()-this.startTimestamp,i=e-this.firstTimestamp;t>=i?(this.isStreamTsMoreThanLocal=!1,this.delay=t-i):(this.isStreamTsMoreThanLocal=!0,this.delay=i-t)}}else this.firstTimestamp=e,this.startTimestamp=Date.now(),this.delay=-1;return this.preDelayTimestamp=e,this.delay}getDelayNotUpdateDelay(e,t){if(!e||!this.player.isDemuxDecodeFirstIIframeInit())return-1;if(t===Fe)return this.pushLatestDelay;if(this.preDelayTimestamp&&this.preDelayTimestamp-e>1e3)return this.player.debugWarn("CommonDemux",`getDelayNotUpdateDelay() and preDelayTimestamp is ${this.preDelayTimestamp} > timestamp is ${e} more than ${this.preDelayTimestamp-e}ms and return -1`),-1;if(this.firstTimestamp){let t=-1;if(e){const i=Date.now()-this.startTimestamp,s=e-this.firstTimestamp;t=i>=s?i-s:s-i}return t}return-1}resetDelay(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1}resetAllDelay(){this.resetDelay(),this.preDelayTimestamp=null}initInterval(){this.player.isUseHls265()?this.player.debugLog("CommonDemux","initInterval() and is hls and support hls265 so return"):-1===this.player.getStreamType().indexOf(y)?this.player.isPlaybackCacheBeforeDecodeForFpsRender()?this.player.debugLog("CommonDemux","initInterval() and playback and playbackIsCacheBeforeDecodeForFpsRender is true so return"):(this.player.debugLog("CommonDemux","setInterval()"),this._loop(),this.stopId=setInterval((()=>{if(this.player.isDestroyedOrClosed())return;let e=(new Date).getTime();this.preLoopTimestamp||(this.preLoopTimestamp=e);const t=e-this.preLoopTimestamp;this.updateHistoryIntervalDiffTimeList(t),t>100&&this.player.debugWarn("CommonDemux",`loop demux diff time is ${t}`),this._loop(),this.preLoopTimestamp=(new Date).getTime()}),20)):this.player.debugLog("CommonDemux","initInterval() and is worker stream so return")}clearStopInterval(){this.stopId&&(clearInterval(this.stopId),this.stopId=null)}startPlaybackLoopInterval(){this.initPlaybackCacheLoop()}updateHistoryIntervalDiffTimeList(e){this.historyIntervalDiffTimeList.length>5&&this.historyIntervalDiffTimeList.shift(),this.historyIntervalDiffTimeList.push(e)}isHistoryIntervalDiffTimeAllLarge(){if(this.historyIntervalDiffTimeList.length<5)return!1;for(let e=0;e{let e=null;this.bufferList.length&&(e=this.bufferList.shift(),this._doDecoderDecode(e))};e();const t=Math.ceil(1e3/(this.playbackStreamFps*this.player.getPlaybackRate()));this.player.debugLog("CommonDemux",`initPlaybackCacheLoop() and fragDuration is ${t}, playbackStreamFps is ${this.playbackStreamFps}, playbackRate is ${this.player.getPlaybackRate()}`),this.stopId=setInterval(e,t)}_loop(){let e;const t=this.player._opt.videoBuffer,i=this.player._opt.videoBufferDelay,s=this.player._opt.playType===b;if(this.bufferList.length){if(this.isPushDropping)return void this.player.debugWarn("CommonDemux",`_loop isPushDropping is true and bufferList length is ${this.bufferList.length}`);if(this.dropping){for(e=this.bufferList.shift(),this.player.debugWarn("CommonDemux",`_loop is dropping and data.ts is ${e.ts}, data.type is ${e.type}, data.isIFrame is ${e.isIFrame}, delay is ${this.delay} ,buffer list is ${this.bufferList.length}`);!e.isIFrame&&this.bufferList.length;)e=this.bufferList.shift();const t=this.getDelayNotUpdateDelay(e.ts,e.type);e.isIFrame&&t<=this.getNotDroppingDelayTs()&&(this.player.debugLog("CommonDemux",`_loop data isIFrame is true and delay is ${this.delay}`),this.dropping=!1,this._doDecoderDecode(e),this._decodeNext(e))}else if(this.player.isPlayback()||this.player.isPlayUseMSE()||0===t)for(;this.bufferList.length;)e=this.bufferList.shift(),this._doDecoderDecode(e);else if(e=this.bufferList[0],-1===this.getDelay(e.ts,e.type))this.player.debugLog("CommonDemux",`delay is -1 and data.ts is ${e.ts} data.type is ${e.type}`),this.bufferList.shift(),this._doDecoderDecode(e),this._decodeNext(e);else if(this.delay>i+t&&s)this.hasIframeInBufferList()?(this.player.debugWarn("CommonDemux",`_loop delay is ${this.delay}, set dropping is true`),this.resetAllDelay(),this.dropping=!0,this.player.updateStats({isDropping:!0})):(this.bufferList.shift(),this._doDecoderDecode(e),this._decodeNext(e));else for(;this.bufferList.length;){if(e=this.bufferList[0],!(this.getDelay(e.ts,e.type)>t)){this.delay<0&&this.player.debugWarn("CommonDemux",`_loop delay is ${this.delay} bufferList is ${this.bufferList}`);break}this.bufferList.shift(),this._doDecoderDecode(e)}}else-1!==this.delay&&this.player.debugLog("CommonDemux","loop() bufferList is empty and reset delay"),this.resetAllDelay()}_doDecode(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;const o=this.player;let a={ts:i,cts:r,type:t,isIFrame:!1};this.player.isPlayer()?(t===Ue&&o._opt.playType===b&&this.calcNetworkDelay(i),o._opt.useWCS&&!o._opt.useOffscreen||o._opt.useMSE?(t===Ue&&(a.isIFrame=s),this.pushBuffer(e,a)):t===Ue?o.decoderWorker&&o.decoderWorker.decodeVideo(e,i,s):t===Fe&&o._opt.hasAudio&&o.decoderWorker&&o.decoderWorker.decodeAudio(e,i)):this.player.isPlayback()&&(t===Ue&&(a.isIFrame=s),this.player.isPlaybackOnlyDecodeIFrame()?t===Ue&&s&&this.pushBuffer(e,a):this.player.isPlaybackCacheBeforeDecodeForFpsRender()||1===this.player.getPlaybackRate()?this.pushBuffer(e,a):this.pushBuffer(e,a,!1))}_doDecodeByHls(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=!1;if(t===Fe&&Ir(e)&&(this.player.debugLog("CommonDemux",`hls pushBuffer audio ts is ${i}, isAacCodecPacket is true`),o=!0,this.player.isRecordTypeFlv())){const t=new Uint8Array(e);this.player.recorder.addAACSequenceHeader(t,i)}let a=!1;if(t===Ue&&s&&ca(e)&&(this.player.debugLog("CommonDemux",`hls pushBuffer video ts is ${i}, isVideoSequenceHeader is true`),a=!0,this.player.isRecordTypeFlv())){const t=new Uint8Array(e);this.player.recorder.addVideoSequenceHeader(t,i)}this.player.recording&&pa(a)&&pa(o)&&this.handleRecording(e,t,i,s,r),t===Ue?this._doDecoderDecode({ts:i,cts:r,payload:e,type:Ue,isIFrame:s}):t===Fe&&this._doDecoderDecode({ts:i,payload:e,type:Fe})}_doDecodeByFmp4(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,i,s,r)}_doDecodeByTs(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,i,s,r)}_doDecodeByPs(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,i,s,r)}_decodeNext(e){const t=e.ts;if(0===this.bufferList.length)return;let i=this.bufferList[0];const s=i.ts-t,r=e.type===Ue&&i.type===Fe,o=e.type===Ue&&ca(e.payload);(s<=20||r||o)&&(this.player.debugLog("CommonDemux",`decode data type is ${e.type} and\n ts is ${t} next data type is ${i.type} ts is ${i.ts}\n diff is ${s} and isVideoAndNextAudio is ${r} and isVideoSqeHeader is ${o}`),this.bufferList.shift(),this._doDecoderDecode(i))}_doDecoderDecode(e){const t=this.player,{webcodecsDecoder:i,mseDecoder:s}=t;this.player.isPlayer()&&this.player.updateStats({buf:this.delay}),e.type===Fe?t._opt.hasAudio&&(t._opt.useMSE&&t._opt.mseDecodeAudio?s.decodeAudio(e.payload,e.ts):t._opt.useWCS&&t._opt.wcsDecodeAudio?i.decodeAudio(e.payload,e.ts):t.decoderWorker&&t.decoderWorker.decodeAudio(e.payload,e.ts)):e.type===Ue&&(t._opt.isEmitSEI&&this.findSei(e.payload,e.ts),t._opt.useWCS&&!t._opt.useOffscreen?i.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):t._opt.useMSE?s.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):t.decoderWorker&&t.decoderWorker.decodeVideo(e.payload,e.ts,e.isIFrame))}pushBuffer(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=this.player._opt.videoBuffer,r=this.player._opt.videoBufferDelay,o=this.player.isPlayer();if(t.type===Fe&&Ir(e)){if(this.player.debugLog("CommonDemux",`pushBuffer() audio ts is ${t.ts}, isAacCodecPacket is true`),this.player.isRecordTypeFlv()){const i=new Uint8Array(e);this.player.recorder.addAACSequenceHeader(i,t.ts)}this._doDecoderDecode({ts:t.ts,payload:e,type:Fe})}else if(t.type===Ue&&t.isIFrame&&ca(e)){if(this.player.debugLog("CommonDemux",`pushBuffer() video ts is ${t.ts}, isVideoSequenceHeader is true`),this.player.isRecordTypeFlv()){const i=new Uint8Array(e);this.player.recorder.addVideoSequenceHeader(i,t.ts)}this._doDecoderDecode({ts:t.ts,payload:e,type:Ue,isIFrame:t.isIFrame,cts:t.cts})}else{if(this.player.recording&&this.handleRecording(e,t.type,t.ts,t.isIFrame,t.cts),o){if(t.type===Ue){if(this.preTimestampDuration>0){const e=t.ts-this.preTimestamp,i=this.preTimestampDuration+this.preTimestampDuration/2;e>=i&&this.player.debugLog("CommonDemux",`pushBuffer() video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts}, preTs is ${this.preTimestamp},\n diff is ${e} and preTsDuration is ${this.preTimestampDuration} and maxDiff is ${i}\n maybe trigger black screen or flower screen`)}if(null!==this.preTimestamp&&this.preTimestamp>=t.ts&&(this.player.debugWarn("CommonDemux",`pushBuffer() video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts} less than (or equal) preTs is ${this.preTimestamp} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${this.prevPayloadBufferSize}`),this.preTimestamp-t.ts>X&&(this.player.debugWarn("CommonDemux",`pushBuffer() video\n ts is ${t.ts}, preTimestamp is ${this.preTimestamp},\n diff is ${this.preTimestamp-t.ts} more than 3600000\n and resetAllDelay()`),this.resetAllDelay()),this.player._opt.isDropSameTimestampGop&&pa(t.isIFrame)&&this.player.isDemuxDecodeFirstIIframeInit())){const e=this.hasIframeInBufferList(),t=pa(this.isPushDropping);return this.player.debugLog("CommonDemux",`pushBuffer(), isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next drop buffer`),void(e&&t?this.dropBuffer$2():this.clearBuffer(!0))}this.preTimestamp>0&&(this.preTimestampDuration=t.ts-this.preTimestamp),this.prevPayloadBufferSize=e.byteLength,this.preTimestamp=t.ts}if(this.player.isDemuxDecodeFirstIIframeInit()){let e=this.getDelayNotUpdateDelay(t.ts,t.type);this.pushLatestDelay=e;const i=r+s;this.player._opt.useMSE?this.delay>0&&e>i&&this.delay ${r+s}, bufferList is ${this.bufferList.length}, delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()):this.delay>0&&e>i&&this.delay ${r+s},bufferList is ${this.bufferList.length}, delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()),this.isHistoryIntervalDiffTimeAllLarge()&&pa(this.player.visibility)&&(this.player._opt.useMSE?this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debugWarn("CommonDemux",`useMSE, page visibility is false and\n history interval diff is ${this.historyIntervalDiffTimeList.join(",")} and\n bufferList is ${this.bufferList.length},\n delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()):this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debugWarn("CommonDemux",`useWCS, page visibility is false and\n history interval diff is ${this.historyIntervalDiffTimeList.join(",")} and\n bufferList is ${this.bufferList.length},\n delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()))}}i?t.type===Fe?this.bufferList.push({ts:t.ts,payload:e,type:Fe}):t.type===Ue&&this.bufferList.push({ts:t.ts,cts:t.cts,payload:e,type:Ue,isIFrame:t.isIFrame}):t.type===Ue?this._doDecoderDecode({ts:t.ts,cts:t.cts,payload:e,type:Ue,isIFrame:t.isIFrame}):t.type===Fe&&this._doDecoderDecode({ts:t.ts,payload:e,type:Fe}),this.player.isPlaybackCacheBeforeDecodeForFpsRender()&&this.calcPlaybackStreamFps()}}calcPlaybackStreamFps(){if(Co(this.playbackStreamVideoFps)||Co(this.playbackStreamAudioFps)){let e=this.playbackStreamVideoFps,t=this.playbackStreamAudioFps;if(Co(this.playbackStreamVideoFps)&&(e=ra(this.bufferList,Ue),e>0&&(this.playbackStreamVideoFps=e,this.player.video&&this.player.video.setStreamFps(this.playbackStreamVideoFps),this.playbackStreamFps=t?e+t:e,pa(this.player._opt.hasAudio)&&(this.player.debugLog(this.TAG_NAME,"playbackCacheBeforeDecodeForFpsRender,_opt.hasAudio is false and set streamAudioFps is 0"),this.playbackStreamAudioFps=0),this.initPlaybackCacheLoop())),Co(this.playbackStreamAudioFps)&&(t=ra(this.bufferList,Fe),t>0&&(this.playbackStreamAudioFps=t,this.playbackStreamFps=e?e+t:t,this.initPlaybackCacheLoop())),Co(this.playbackStreamVideoFps)&&Co(this.playbackStreamAudioFps)){const i=this.bufferList.map((e=>({type:e.type,ts:e.ts})));this.player.debugLog("CommonDemux",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${this.bufferList.length} and ts list is ${JSON.stringify(i)}`)}const i=this.getAudioBufferLength()>0,s=i?60:40;this.bufferList.length>=s&&(this.player.debugWarn("CommonDemux",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${this.bufferList.length} more than ${s}, and hasAudio is ${i} an set streamFps is 25`),this.playbackStreamVideoFps=e,this.player.video&&this.player.video.setStreamFps(this.playbackStreamVideoFps),i?(this.playbackStreamAudioFps=25,this.playbackStreamFps=this.playbackStreamVideoFps+this.playbackStreamAudioFps):this.playbackStreamFps=this.playbackStreamVideoFps,this.initPlaybackCacheLoop())}}dropBuffer$2(){if(this.bufferList.length>0){let e=this.bufferList.findIndex((e=>ua(e.isIFrame)&&e.type===Ue));if(this.isAllIframeInBufferList())for(let t=0;t=this.getNotDroppingDelayTs()){this.player.debugLog("CommonDemux",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${s} and notDroppingDelayTs is ${this.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){this.isPushDropping=!0,this.player.updateStats({isDropping:!0});const t=this.bufferList.length;this.bufferList=this.bufferList.slice(e);const i=this.bufferList.shift();this.resetAllDelay(),this.getDelay(i.ts,i.type),this._doDecoderDecode(i),this.isPushDropping=!1,this.player.debugLog("CommonDemux",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,and new bufferList length is ${this.bufferList.length} and new delay is ${this.delay} `)}else this.isPushDropping=!1}0===this.bufferList.length&&(this.isPushDropping=!1)}clearBuffer(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.player.debugLog("CommonDemux",`clearBuffer,buffer length is ${this.bufferList.length}, need clear is ${e} and _opt.checkFirstIFrame is ${this.player._opt.checkFirstIFrame}`),e&&(this.bufferList=[]),this.player.isPlayer()&&(this.resetAllDelay(),ua(this.player._opt.checkFirstIFrame)&&(this.dropping=!0,this.player.updateStats({isDropping:!0}))),this.player.decoderCheckFirstIFrame()}calcNetworkDelay(e){if(!(this.player.isDemuxDecodeFirstIIframeInit()&&e>0))return;null===this.bufferStartDts?(this.bufferStartDts=e,this.bufferStartLocalTs=eo()):et?i-t:0;s>this.player._opt.networkDelay&&this.player._opt.playType===b&&(this.player.debugWarn("CommonDemux",`delay is more than networkDelay and now dts:${e},start dts is ${this.bufferStartDts}, vs start is ${t},local diff is ${i} ,delay is ${s}, _opt.networkDelay is ${this.player._opt.networkDelay}`),this.player.emit(ot.networkDelayTimeout,s)),this.player.updateStats({netBuf:s})}calcIframeIntervalTimestamp(e){if(null===this.preIframeTs)this.preIframeTs=e;else if(this.preIframeTs{t.type===Ue&&(e+=1)})),e}getAudioBufferLength(){let e=0;return this.bufferList.forEach((t=>{t.type===Fe&&(e+=1)})),e}hasIframeInBufferList(){return this.bufferList.some((e=>e.type===Ue&&e.isIFrame))}isAllIframeInBufferList(){const e=this.getVideoBufferLength();let t=0;return this.bufferList.forEach((e=>{e.type===Ue&&e.isIFrame&&(t+=1)})),e===t}getInputByteLength(){return 0}getIsStreamTsMoreThanLocal(){return this.isStreamTsMoreThanLocal}close(){}reset(){}findSei(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=4;xo(this.nalUnitSize)&&(s=this.nalUnitSize);const r=qr(e.slice(5),s);if(pa(i)){const e=this.player.getVideoInfo();e&&e.encType&&(i=e.encType===vt)}r.forEach((e=>{const s=i?e[0]>>>1&63:31&e[0],r=i&&(s===Kt||s===qt),o=pa(i)&&s===Rt;(r||o)&&this.player.emitVideoSei({ts:t,data:e})}))}handleRecording(e,t,i,s,r){if(this.player.isRecordTypeFlv()){const s=new Uint8Array(e);t===Ue?this.player.recorder.addVideo(s,i):t===Fe&&this.player.recorder.addAudio(s,i)}else if(this.player.isRecordTypeMp4()){const o=new Uint8Array(e);if(this.player.recorder.isWasmMp4()){if(t===Ue)this.player.recorder.handleAddNaluTrack(o.slice(5),s,i,r);else if(t===Fe){const t=new Uint8Array(e);this.player.recorder.handleAddAudioTrack(Mr(t)?t.slice(2):t.slice(1),i)}}else t===Ue&&this.player.recorder.handleAddNaluTrack(o.slice(5),s,i,r)}}updateNalUnitSize(e){const t=15&e[0];this.player.video.updateVideoInfo({encTypeCode:t});const i=t===At;this.nalUnitSize=function(e,t){let i=null;return t?e.length>=28&&(i=1+(3&e[26])):e.length>=12&&(i=1+(3&e[9])),i}(e,i),this.player.debugLog(this.TAG_NAME,`demux() isVideoSequenceHeader is true and isHevc is ${i} and nalUnitSize is ${this.nalUnitSize}`)}cryptoPayload(e,t){let i=this.player,s=e;if(i._opt.isM7sCrypto)if(i._opt.cryptoKey&&i._opt.cryptoKey.byteLength>0&&i._opt.cryptoIV&&i._opt.cryptoIV.byteLength>0){const t=this.player.video.getVideoInfo();t.encTypeCode?s=function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),i=new Uint8Array(i);const r=e.byteLength;let o=5;for(;or)break;let n=e[o+4],l=!1;if(s?(n=n>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(n)):(n&=31,l=1===n||5===n),l){const s=e.slice(o+4+2,o+4+a);let r=new gd.ModeOfOperation.ctr(t,new gd.Counter(i));const n=r.decrypt(s);r=null,e.set(n,o+4+2)}o=o+4+a}return e}(e,i._opt.cryptoKey,i._opt.cryptoIV,t.encTypeCode===At):i.debugWarn(this.TAG_NAME,`videoInfo.encTypeCode is ${t.encTypeCode}`)}else i.debugError(this.TAG_NAME,`isM7sCrypto cryptoKey.length is ${i._opt.cryptoKey&&i._opt.cryptoKey.byteLength} or cryptoIV.length is ${i._opt.cryptoIV&&i._opt.cryptoIV.byteLength} null`);else if(i._opt.isSm4Crypto)if(i._opt.sm4CryptoKey){const t=this.player.video.getVideoInfo().encTypeCode===At,r=this.player._opt.isSm4CryptoH265V2;s=i._opt.cryptoKey&&i._opt.cryptoKey.byteLength>0&&i._opt.cryptoIV&&i._opt.cryptoIV.byteLength>0?function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t=new Uint8Array(t),i=new Uint8Array(i);const o=e.byteLength;let a=5;for(;ao)break;let l=e[a+4],d=!1,h=2;if(s?(r&&(h=3),l=l>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(l)):(l&=31,d=1===l||5===l),d){const s=Kd(t,i,e.slice(a+4+h,a+4+n));e.set(s,a+4+h)}a=a+4+n}return e}(e,i._opt.cryptoKey,i._opt.cryptoIV,t,r):function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=e.byteLength;let o=new Uint8Array(e.slice(0,5)),a=5;for(;ar){const t=new Uint8Array(o.length+e.length-a);t.set(o,0),t.set(e.slice(a),o.length),o=t;break}let d=e[a+4],h=!1,c=2;if(i?(s&&(c=3),d=d>>>1&63,h=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(d)):(d&=31,h=1===d||5===d),h){const i=Id(e.slice(a+4+c,a+4+l),t,0,{padding:"none",output:"array"});let s=i[i.length-1];if(s>0&&s<16){let e=!0;for(let t=1;t<=s;t++)if(i[i.length-t]!==s){e=!1;break}e&&i.splice(i.length-s,s)}const r=new Uint8Array(c);r.set(e.slice(a+4,a+4+c),0);const n=Kr(il(r,new Uint8Array(i))),d=new Uint8Array(o.length+n.length);d.set(o,0),d.set(n,o.length),o=d}else{const t=e.slice(a+4,a+4+l),i=new Uint8Array(o.length+4+t.length);i.set(o,0),i.set(n,o.length),i.set(t,o.length+4),o=i}a=a+4+l}return o}(e,i._opt.sm4CryptoKey,t,r)}else i._opt.sm4CryptoKey||i.debugError(this.TAG_NAME,"isSm4Crypto opt.sm4CryptoKey is null");else if(i._opt.isXorCrypto)if(i._opt.cryptoKey&&i._opt.cryptoKey.byteLength>0&&i._opt.cryptoIV&&i._opt.cryptoIV.byteLength>0){const t=this.player.video.getVideoInfo();s=function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=e.byteLength;let o=5;for(;or)break;let n=e[o+4],l=!1;if(s?(n=n>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(n)):(n&=31,l=1===n||5===n),l){const s=Fd(e.slice(o+4,o+4+a),t,i);e.set(s,o+4)}o=o+4+a}return e}(e,i._opt.cryptoKey,i._opt.cryptoIV,t.encTypeCode===At)}else i.debugError(this.TAG_NAME,"isXorCrypto opt.xorCryptoKey is null");return s}cryptoPayloadAudio(e){let t=this.player;if(pa(t._opt.isCryptoAudio))return e;let i=e;if(t._opt.isM7sCrypto)if(t._opt.cryptoKey&&t._opt.cryptoKey.byteLength>0&&t._opt.cryptoIV&&t._opt.cryptoIV.byteLength>0){e[0]>>4===_t&&(i=function(e,t,i){if(e.byteLength<=30)return e;const s=e.slice(32);let r=new gd.ModeOfOperation.ctr(t,new gd.Counter(i));const o=r.decrypt(s);return r=null,e.set(o,32),e}(e,t._opt.cryptoKey,t._opt.cryptoIV))}else t.debugError(this.TAG_NAME,`isM7sCrypto cryptoKey.length is ${t._opt.cryptoKey&&t._opt.cryptoKey.byteLength} or cryptoIV.length is ${t._opt.cryptoIV&&t._opt.cryptoIV.byteLength} null`);return i}_decodeEnhancedH265Video(e,t){const i=e[0],s=48&i,r=15&i,o=e.slice(1,5),a=new ArrayBuffer(4),n=new Uint32Array(a),l="a"==String.fromCharCode(o[0]);if(r===ir){if(s===or){const t=e.slice(5);if(l);else{const e=new Uint8Array(5+t.length);e.set([28,0,0,0,0],0),e.set(t,5),this.updateNalUnitSize(e),this.player.debugLog(this.TAG_NAME,`demux() isVideoSequenceHeader(enhancedH265) is true and nalUnitSize is ${this.nalUnitSize}`),this._doDecode(e,Ue,0,!0,0)}}}else if(r===sr){let i=e,r=0;const o=s===or;if(o&&this.calcIframeIntervalTimestamp(t),l);else{n[0]=e[4],n[1]=e[3],n[2]=e[2],n[3]=0,r=n[0];i=$n(e.slice(8),o),i=this.cryptoPayload(i,o),this._doDecode(i,Ue,t,o,r)}}else if(r===rr){const i=s===or,r=e.slice(5);i&&this.calcIframeIntervalTimestamp(t);let o=$n(r,i);o=this.cryptoPayload(o,i),this._doDecode(o,Ue,t,i,0)}}_isEnhancedH265Header(e){return 128==(128&e)}handlePlaybackPause(e){ua(e)?this.clearStopInterval():this.startPlaybackLoopInterval()}}var Qd=function(e,t,i,s){return new(i||(i=Promise))((function(r,o){function a(e){try{l(s.next(e))}catch(e){o(e)}}function n(e){try{l(s.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,n)}l((s=s.apply(e,t||[])).next())}))};const Xd=Symbol(32),Zd=Symbol(16),eh=Symbol(8);class th{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return Qd(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,i)=>{var s;this.reject=i,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(s=this.pull)||void 0===s||s.call(this,e)}))}))}readU32(){return this.read(Xd)}readU16(){return this.read(Zd)}readU8(){return this.read(eh)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let i=0;const s=e=>t.length<(i=e);if("number"==typeof this.need){if(s(this.need))return;e=t.subarray(0,i)}else if(this.need===Xd){if(s(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Zd){if(s(2))return;e=t[0]<<8|t[1]}else if(this.need===eh){if(s(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(s(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,i)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(s(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,i)),e=this.need}return this.consumed+=i,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,i=t+e;if(i<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,i);else{const e=new Uint8Array(i);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,i)}return this.buffer=new Uint8Array(e),this.buffer}}th.U32=Xd,th.U16=Zd,th.U8=eh;class ih extends Yd{constructor(e){super(e),this.TAG_NAME="FlvDemux",this.input=new th(this.demux()),e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.input&&(this.input.close(),this.input=null),this.player.debugLog(this.TAG_NAME,"destroy")}dispatch(e){this.input?this.input.write(e):this.player&&this.player.debugWarn(this.TAG_NAME,"dispatch() this.input is null")}*demux(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),i=new Uint32Array(e),s=this.player;for(;;){if(!this.input)return;t[3]=0;const e=yield 15,r=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const o=i[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let a=i[0];const n=(yield o).slice();if(!s)return;switch(r){case Oe:if(s._opt.hasAudio&&(s.updateStats({abps:n.byteLength}),n.byteLength>0)){let e=this.cryptoPayloadAudio(n);this._doDecode(e,Fe,a)}break;case Ne:if(s._opt.hasVideo&&n.length>=6){let e=a;s.updateStats({vbps:n.byteLength,dts:e}),s._times.demuxStart||(s._times.demuxStart=eo());const t=n[0];if(this._isEnhancedH265Header(t))this._decodeEnhancedH265Video(n,e);else{const e=15&t;let s=(t>>4&15)===ws;const r=e===At,o=e===yt;if(pa(r||o))return void this.player.debugWarn(this.TAG_NAME,`demux() codecId is ${e} and ignore`);pa(s)&&ua(_a(n,r))&&(this.player.debugLog(this.TAG_NAME,"demux() isIFrame is false and unit type is IDR and update to true"),s=!0),s&&(this.calcIframeIntervalTimestamp(a),null===this.nalUnitSize&&ca(n)&&this.updateNalUnitSize(n)),i[0]=n[4],i[1]=n[3],i[2]=n[2],i[3]=0;let l=i[0],d=this.cryptoPayload(n,s);this._doDecode(d,Ue,a,s,l)}}else n.length<6&&s.debugWarn(this.TAG_NAME,`payload.length is ${n.length} less than 6 and ignore`);break;case je:if(this.player.isRecordTypeFlv()){const e=new Uint8Array(n);this.player.recorder.addMetaData(e)}const e=pl(n);e&&e.onMetaData&&s.updateMetaData(e.onMetaData);break;default:s.debugLog(this.TAG_NAME,`demux() type is ${r}`)}}}close(){this.input&&(this.input.close(),this.input=null)}getInputByteLength(){let e=0;return this.input&&this.input.buffer&&(e=this.input.buffer.byteLength),e}}class sh extends Yd{constructor(e){super(e),this.TAG_NAME="M7sDemux",e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy")}dispatch(e){const t=this.player,i=new DataView(e),s=i.getUint8(0),r=i.getUint32(1,!1),o=new ArrayBuffer(4),a=new Uint32Array(o);switch(s){case Fe:if(t._opt.hasAudio){const i=new Uint8Array(e,5);t.updateStats({abps:i.byteLength}),i.byteLength>0&&this._doDecode(i,s,r)}break;case Ue:if(t._opt.hasVideo)if(t._times.demuxStart||(t._times.demuxStart=eo()),i.byteLength>=11){const o=new Uint8Array(e,5);let n=r;t.updateStats({vbps:o.byteLength,dts:n});const l=o[0];if(this._isEnhancedH265Header(l))this._decodeEnhancedH265Video(o,r);else{const e=i.getUint8(5)>>4==1;e&&this.calcIframeIntervalTimestamp(r),a[0]=o[4],a[1]=o[3],a[2]=o[2],a[3]=0;let t=a[0],n=this.cryptoPayload(o,e);this._doDecode(n,s,r,e,t)}}else this.player.debugWarn(this.TAG_NAME,"dispatch","dv byteLength is",i.byteLength,"and return")}}}class rh extends ih{constructor(e){super(e),e.debugLog("WebTransportDemux","init")}destroy(){this.player.debugLog("WebTransportDemux","destroy"),super.destroy()}}var oh,ah=Lr((function(e){e.exports=function(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e},e.exports.__esModule=!0,e.exports.default=e.exports})),nh=(oh=ah)&&oh.__esModule&&Object.prototype.hasOwnProperty.call(oh,"default")?oh.default:oh;class lh{constructor(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}get bitsAvailable(){return this.bitLength-this.index}skipBits(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}getBits(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>s,o=8-s;if(o>=e)return i&&(this.index+=e),r>>o-e;{i&&(this.index+=o);const s=e-o;return r<>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class dh extends Yd{constructor(e){super(e),nh(this,"TAG_NAME","NakedFlowDemux"),this.lastBuf=null,this.vps=null,this.sps=null,this.pps=null,this.streamVideoType=null,this.streamAudioType=null,this.tempNaluBufferList=new Uint8Array(0),this.pendingUnits={},this.localDts=0,this.isSendSeqHeader=!1,this.isSendAACSeqHeader=!1,e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.lastBuf=null,this.vps=null,this.sps=null,this.pps=null,this.streamVideoType=null,this.streamAudioType=null,this.tempNaluBufferList=new Uint8Array(0),this.pendingUnits={},this.localDts=0,this.localAudioDts=0,this.isSendSeqHeader=!1,this.isSendAACSeqHeader=!1,this.player.debugLog(this.TAG_NAME,"destroy")}dispatch(e){this.player;const t=new Uint8Array(e);if(this.player._opt.nakedFlowDemuxUseNew){const e=this.extractNALu$3(t);if(0===e.length)return void this.player.debugLog(this.TAG_NAME,"dispatch naluArray.length === 0");this.handleVideoFrames(e)}else this.extractNALu$2(t)}addNaluToBuffer(e){const t=e.byteLength+this.tempNaluBufferList.byteLength,i=new Uint8Array(t);i.set(this.tempNaluBufferList,0),i.set(e,this.tempNaluBufferList.byteLength),this.tempNaluBufferList=i}downloadNakedFlowFile(){const e=new Blob([this.tempNaluBufferList]);try{const t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".h264",t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadTempNalu",e)}}getNaluDts(){const e=this.player._opt.nakedFlowFps;return this.localDts=this.localDts+parseInt(1e3/e,10),this.localDts}getNaluAudioDts(){const e=this.player.audio.audioContext.sampleRate,t=this.player.audio.audioBufferSize;return this.localDts+parseInt(t/e*1e3)}extractNALu(e){let t,i,s=0,r=e.byteLength,o=0,a=[];for(;s1)for(let e=0;e{const t=Bn(e);t===Lt||t===kt?this.handleVideoH264Nalu(e):Mn(t)&&s.push(e)})),1===s.length)this.handleVideoH264Nalu(s[0]);else{const e=function(e){if(0===e.length)return!1;const t=Bn(e[0]);for(let i=1;i{this.handleVideoH264Nalu(e)}))}}else if(this.streamVideoType===vt)if(this.player._opt.nakedFlowH265DemuxUseNew){const e=this.handleAddNaluStartCode(t),i=this.extractNALu(e);if(0===i.length)return void this.player.debugWarn(this.TAG_NAME,"handleVideoNalu","h265 naluList.length === 0");const s=[];if(i.forEach((e=>{const t=Jn(e);t===Ht||t===Wt||t===Gt?this.handleVideoH265Nalu(e):qn(t)&&s.push(e)})),1===s.length)this.handleVideoH265Nalu(s[0]);else{const e=function(e){if(0===e.length)return!1;const t=Jn(e[0]);for(let i=1;i{this.handleVideoH265Nalu(e)}))}}else{Jn(t)===Ht?this.extractH265PPS(t):this.handleVideoH265Nalu(t)}else this.player.debugWarn(this.TAG_NAME," this.streamVideoType is null")}extractH264PPS(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{In(Bn(e))?this.extractH264SEI(e):this.handleVideoH264Nalu(e)}))}extractH265PPS(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{const t=Jn(e);t===Jt?this.extractH265SEI(e):this.handleVideoH265Nalu(e)}))}extractH264SEI(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{this.handleVideoH264Nalu(e)}))}extractH265SEI(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{this.handleVideoH265Nalu(e)}))}handleAddNaluStartCode(e){const t=[0,0,0,1],i=new Uint8Array(e.length+t.length);return i.set(t),i.set(e,t.length),i}handleAudioAACNalu(e){if(!e||e.byteLength<1)return;this.streamAudioType||(this.streamAudioType=wt.AAC);let t=new Uint8Array(e);const i=t.slice(0,7);if(t=t.slice(7),!this.isSendAACSeqHeader){const e=(192&i[2])>>6,t=(60&i[2])>>2,s=(1&i[2])<<2|(192&i[3])>>6,r=new Uint8Array([175,0,e<<3|(14&t)>>1,(1&t)<<7|s<<3]);this.isSendAACSeqHeader=!0,this._doDecode(r,Fe,0,!1,0)}const s=this.getNaluAudioDts(),r=new Uint8Array(t.length+2);r.set([175,1],0),r.set(t,2),this._doDecode(r,Fe,s,!1,0)}handleAudioG711ANalu(e){if(!e||e.byteLength<1)return;this.streamAudioType||(this.streamAudioType=wt.ALAW);let t=new Uint8Array(e);const i=this.getNaluAudioDts(),s=new Uint8Array(t.length+1);s.set([114],0),s.set(t,1),this._doDecode(s,Fe,i,!1,0)}handleAudioG711UNalu(e){if(!e||e.byteLength<1)return;this.streamAudioType||(this.streamAudioType=wt.MULAW);let t=new Uint8Array(e);const i=this.getNaluAudioDts(),s=new Uint8Array(t.length+1);s.set([130],0),s.set(t,1),this._doDecode(s,Fe,i,!1,0)}handleVideoH264Nalu(e){const t=Bn(e);switch(t){case kt:this.sps=e;break;case Lt:this.pps=e}if(this.isSendSeqHeader){if(this.sps&&this.pps){const e=Rn({sps:this.sps,pps:this.pps}),t=this.localDts;this._doDecode(e,Ue,t,!0,0),this.sps=null,this.pps=null}if(Mn(t)){this.player._times.demuxStart||(this.player._times.demuxStart=eo());const i=Fn(t),s=this.getNaluDts(),r=function(e,t){let i=[];i[0]=t?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=e.byteLength>>24&255,i[6]=e.byteLength>>16&255,i[7]=e.byteLength>>8&255,i[8]=255&e.byteLength;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}(e,i);this._preDoDecode(r,Ue,s,i,0)}else this.player.debugWarn(this.TAG_NAME,`handleVideoH264Nalu is avc seq head nalType is ${t}`)}else if(this.sps&&this.pps){this.isSendSeqHeader=!0;const e=Rn({sps:this.sps,pps:this.pps});this._doDecode(e,Ue,0,!0,0),this.sps=null,this.pps=null}}handleVideoH264NaluList(e,t,i){if(this.isSendSeqHeader){this.player._times.demuxStart||(this.player._times.demuxStart=eo());const i=this.getNaluDts(),s=Pn(e.reduce(((e,t)=>{const i=Kr(e),s=Kr(t),r=new Uint8Array(i.byteLength+s.byteLength);return r.set(i,0),r.set(s,i.byteLength),r})),t);this._preDoDecode(s,Ue,i,t,0)}else this.player.debugWarn(this.TAG_NAME,"handleVideoH264NaluList isSendSeqHeader is false")}handleVideoH265Nalu(e){const t=Jn(e);switch(t){case Gt:this.vps=e;break;case Wt:this.sps=e;break;case Ht:this.pps=e}if(this.isSendSeqHeader){if(this.vps&&this.sps&&this.pps){const e=Hn({vps:this.vps,sps:this.sps,pps:this.pps}),t=this.localDts;this._doDecode(e,Ue,t,!0,0),this.vps=null,this.sps=null,this.pps=null}if(qn(t)){this.player._times.demuxStart||(this.player._times.demuxStart=eo());const i=Kn(t),s=this.getNaluDts(),r=function(e,t){let i=[];i[0]=t?28:44,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=e.byteLength>>24&255,i[6]=e.byteLength>>16&255,i[7]=e.byteLength>>8&255,i[8]=255&e.byteLength;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}(e,i);this._preDoDecode(r,Ue,s,i,0)}}else if(this.vps&&this.sps&&this.pps){this.isSendSeqHeader=!0;const e=Hn({vps:this.vps,sps:this.sps,pps:this.pps});this._doDecode(e,Ue,0,!0,0),this.vps=null,this.sps=null,this.pps=null}}handleVideoH265NaluList(e,t,i){if(this.isSendSeqHeader){this.player._times.demuxStart||(this.player._times.demuxStart=eo());const i=this.getNaluDts(),s=$n(e.reduce(((e,t)=>{const i=Kr(e),s=Kr(t),r=new Uint8Array(i.byteLength+s.byteLength);return r.set(i,0),r.set(s,i.byteLength),r})),t);this._preDoDecode(s,Ue,i,t,0)}else this.player.debugWarn(this.TAG_NAME,"handleVideoH265NaluList isSendSeqHeader is false")}_preDoDecode(e,t,i,s,r){this.player.updateStats({vbps:e.byteLength,dts:i}),s&&this.calcIframeIntervalTimestamp(i),this._doDecode(e,Ue,i,s,r)}getInputByteLength(){let e=0;return this.lastBuf&&(e=this.lastBuf.byteLength),e}handleVideoFrames(e){if(!this.streamVideoType)for(let t of e)if(this.streamVideoType=Zo(t),this.streamVideoType)break;this.streamVideoType?this.streamVideoType===bt?this.handleVideoH264Frames(e):this.streamVideoType===vt&&this.handleVideoH265Frames(e):this.player.debugWarn(this.TAG_NAME,"handleVideoFrames streamVideoType is null")}handleVideoH264Frames(e){let t=[],i=[],s=!1,r=!1;this.pendingUnits.units&&(t=this.pendingUnits.units,r=this.pendingUnits.vcl,s=this.pendingUnits.iFrame,this.pendingUnits={});let o={};for(let a of e){if(a.byteLength<4)continue;const e=Bn(a);let n=!1,l=e===xt;e!==Dt&&e!==xt||(o=this.parseVideo264Header(a),n=!0),t.length&&r&&(o.isfms||!n)&&(i.push({units:t,isIFrame:s}),t=[],s=!1,r=!1),t.push(a),s=s||l,r=r||n}t.length&&(this.pendingUnits={units:t,vcl:r,iFrame:s}),i.forEach((e=>{const t=e.units,i=e.isIFrame;let s=null,r=null;if(t.forEach((e=>{const t=31&e[0];switch(t){case Lt:this.pps=e;break;case kt:this.sps=e;break;case Rt:r=e}if(Mn(t)){const t=Kr(e);if(s){const e=new Uint8Array(s.byteLength+t.byteLength);e.set(s,0),e.set(t,s.byteLength),s=e}else s=t}})),!this.isSendSeqHeader&&this.sps&&this.pps){this.isSendSeqHeader=!0;const e=Rn({sps:this.sps,pps:this.pps});this._doDecode(e,Ue,0,!0,0),this.sps=null,this.pps=null}if(this.isSendSeqHeader){if(this.sps&&this.pps){const e=Rn({sps:this.sps,pps:this.pps}),t=this.localDts;this._doDecode(e,Ue,t,!0,0),this.sps=null,this.pps=null}if(s){this.player._times.demuxStart||(this.player._times.demuxStart=eo());const e=this.getNaluDts(),t=Pn(s,i);this.player._opt.isEmitSEI&&r&&this.player.emitVideoSei({ts:e,data:r}),this._preDoDecode(t,Ue,e,i,0)}}}))}handleVideoH265Frames(e){let t=[],i=[],s=!1,r=!1;this.pendingUnits.units&&(t=this.pendingUnits.units,r=this.pendingUnits.vcl,s=this.pendingUnits.iFrame,this.pendingUnits={});let o={};for(let a of e){if(a.byteLength<4)continue;const e=Jn(a);let n=!1,l=Kn(e);qn(e)&&(o=this.parseVideo265Header(a),n=!0),t.length&&r&&(o.isfms||!n)&&(i.push({units:t,isIFrame:s}),t=[],s=!1,r=!1),t.push(a),s=s||l,r=r||n}t.length&&(this.pendingUnits={units:t,vcl:r,iFrame:s}),i.forEach((e=>{const t=e.units,i=e.isIFrame;let s=null,r=null;if(t.forEach((e=>{const t=e[0]>>>1&63;switch(t){case Ht:this.pps=e;break;case Wt:this.sps=e;break;case Gt:this.vps=e;break;case Kt:case qt:r=e}if(qn(t)){const t=Kr(e);if(s){const e=new Uint8Array(s.byteLength+t.byteLength);e.set(s,0),e.set(t,s.byteLength),s=e}else s=t}})),!this.isSendSeqHeader&&this.sps&&this.pps&&this.vps){this.isSendSeqHeader=!0;const e=Hn({sps:this.sps,pps:this.pps,vps:this.vps});this._doDecode(e,Ue,0,!0,0),this.sps=null,this.pps=null,this.vps=null}if(this.isSendSeqHeader){if(this.sps&&this.pps&&this.vps){const e=Hn({sps:this.sps,pps:this.pps,vps:this.vps}),t=this.localDts;this._doDecode(e,Ue,t,!0,0),this.sps=null,this.pps=null,this.vps=null}if(s){this.player._times.demuxStart||(this.player._times.demuxStart=eo());const e=this.getNaluDts(),t=$n(s,i);this.player._opt.isEmitSEI&&r&&this.player.emitVideoSei({ts:e,data:r}),this._preDoDecode(t,Ue,e,i,0)}}}))}handleVideoH265Frames_1(e){e.forEach((e=>{this.handleVideoNalu(e)}))}parseVideo264Header(e){const t=new lh(e);t.readUByte();return{isfms:0===t.readUEG(),sType:t.readUEG()}}parseVideo265Header(e){const t=new lh(e);return t.readUByte(),{nalType:t.readBits(6),isfms:0===t.readBits(1),sType:t.readBits(3)}}}class hh extends Yd{constructor(e){super(e),this.player=e,e.debugLog("EmptyDemux","init")}destroy(){super.destroy(),this.player.debugLog("EmptyDemux","destroy")}}var ch=Lr((function(e,t){var s,r,o,a=(s=new Date,r=4,o={setLogLevel:function(e){r=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=r&&console.debug("["+a.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=r&&console.info("["+a.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=r&&console.warn("["+a.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=r&&console.error("["+a.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)}},o);a.getDurationString=function(e,t){var i;function s(e,t){for(var i=(""+e).split(".");i[0].length0){for(var i="",s=0;s0&&(i+=","),i+="["+a.getDurationString(e.start(s))+","+a.getDurationString(e.end(s))+"]";return i}return"(empty)"},t.Log=a;var n=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};n.prototype.getPosition=function(){return this.position},n.prototype.getEndPosition=function(){return this.buffer.byteLength},n.prototype.getLength=function(){return this.buffer.byteLength},n.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},n.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},n.prototype.readAnyInt=function(e,t){var i=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:i=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:i=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";i=this.dataview.getUint8(this.position)<<16,i|=this.dataview.getUint8(this.position+1)<<8,i|=this.dataview.getUint8(this.position+2);break;case 4:i=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";i=this.dataview.getUint32(this.position)<<32,i|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,i}throw"Not enough bytes in buffer"},n.prototype.readUint8=function(){return this.readAnyInt(1,!1)},n.prototype.readUint16=function(){return this.readAnyInt(2,!1)},n.prototype.readUint24=function(){return this.readAnyInt(3,!1)},n.prototype.readUint32=function(){return this.readAnyInt(4,!1)},n.prototype.readUint64=function(){return this.readAnyInt(8,!1)},n.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",i=0;ithis._byteLength&&(this._byteLength=t);else{for(i<1&&(i=1);t>i;)i*=2;var s=new ArrayBuffer(i),r=new Uint8Array(this._buffer);new Uint8Array(s,0,r.length).set(r),this.buffer=s,this._byteLength=t}}},l.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),i=new Uint8Array(this._buffer,0,t.length);t.set(i),this.buffer=e}},l.BIG_ENDIAN=!1,l.LITTLE_ENDIAN=!0,l.prototype._byteLength=0,Object.defineProperty(l.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(l.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(l.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(l.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),l.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},l.prototype.isEof=function(){return this.position>=this._byteLength},l.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},l.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Int32Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Int16Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return l.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},l.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Uint32Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Uint16Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return l.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},l.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var i=new Float64Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Float32Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},l.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},l.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},l.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},l.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},l.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,l.memcpy=function(e,t,i,s,r){var o=new Uint8Array(e,t,r),a=new Uint8Array(i,s,r);o.set(a)},l.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},l.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},l.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i=0;ir;s--,r++){var o=t[r];t[r]=t[s],t[s]=o}return e},l.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],i=0;i>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},l.prototype.adjustUint32=function(e,t){var i=this.position;this.seek(e),this.writeUint32(t),this.seek(i)},l.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var i=new Int32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},l.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var i=new Int16Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},l.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},l.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var i=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},l.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var i=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},l.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var i=new Float64Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=8*e,i},l.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var i=new Float32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i};var h=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(h.prototype=new l(new ArrayBuffer,0,l.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,a.debug("MultiBufferStream","Stream ready for parsing"),!0):(a.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(a.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){a.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(new Uint8Array(e),0),i.set(new Uint8Array(t),e.byteLength),i.buffer},h.prototype.reduceBuffer=function(e,t,i){var s;return(s=new Uint8Array(i)).set(new Uint8Array(e,t,i)),s.buffer.fileStart=e.fileStart+t,s.buffer.usedBytes=0,s.buffer},h.prototype.insertBuffer=function(e){for(var t=!0,i=0;is.byteLength){this.buffers.splice(i,1),i--;continue}a.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=s.fileStart||(e=this.reduceBuffer(e,0,s.fileStart-e.fileStart)),a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(i,0,e),0===i&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,r,o)}}t&&(a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===i&&(this.buffer=e))},h.prototype.logBufferLevel=function(e){var t,i,s,r,o,n=[],l="";for(s=0,r=0,t=0;t0&&(l+=o.end-1+"]");var d=e?a.info:a.debug;0===this.buffers.length?d("MultiBufferStream","No more buffer in memory"):d("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+s+"/"+r+" bytes), continuous ranges: "+l)},h.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},h.prototype.findPosition=function(e,t,i){var s,r=null,o=-1;for(s=!0===e?0:this.bufferIndex;s=t?(a.debug("MultiBufferStream","Found position in existing buffer #"+o),o):-1},h.prototype.findEndContiguousBuf=function(e){var t,i,s,r=void 0!==e?e:this.bufferIndex;if(i=this.buffers[r],this.buffers.length>r+1)for(t=r+1;t>3;return 31===s&&i.data.length>=2&&(s=32+((7&i.data[0])<<3)+((224&i.data[1])>>5)),s}return null},i.DecoderConfigDescriptor=function(e){i.Descriptor.call(this,4,e)},i.DecoderConfigDescriptor.prototype=new i.Descriptor,i.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},i.DecoderSpecificInfo=function(e){i.Descriptor.call(this,5,e)},i.DecoderSpecificInfo.prototype=new i.Descriptor,i.SLConfigDescriptor=function(e){i.Descriptor.call(this,6,e)},i.SLConfigDescriptor.prototype=new i.Descriptor,this};t.MPEG4DescriptorParser=c;var u={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){u.FullBox.prototype=new u.Box,u.ContainerBox.prototype=new u.Box,u.SampleEntry.prototype=new u.Box,u.TrackGroupTypeBox.prototype=new u.FullBox,u.BASIC_BOXES.forEach((function(e){u.createBoxCtor(e)})),u.FULL_BOXES.forEach((function(e){u.createFullBoxCtor(e)})),u.CONTAINER_BOXES.forEach((function(e){u.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,i){this.type=e,this.size=t,this.uuid=i},FullBox:function(e,t,i){u.Box.call(this,e,t,i),this.flags=0,this.version=0},ContainerBox:function(e,t,i){u.Box.call(this,e,t,i),this.boxes=[]},SampleEntry:function(e,t,i,s){u.ContainerBox.call(this,e,t),this.hdr_size=i,this.start=s},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){u.FullBox.call(this,e,t)},createBoxCtor:function(e,t){u.boxCodes.push(e),u[e+"Box"]=function(t){u.Box.call(this,e,t)},u[e+"Box"].prototype=new u.Box,t&&(u[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){u[e+"Box"]=function(t){u.FullBox.call(this,e,t)},u[e+"Box"].prototype=new u.FullBox,u[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,i=0;ii?(a.error("BoxParser","Box of type '"+h+"' has a size "+d+" greater than its container size "+i),{code:u.ERR_NOT_ENOUGH_DATA,type:h,size:d,hdr_size:l,start:n}):0!==d&&n+d>e.getEndPosition()?(e.seek(n),a.info("BoxParser","Not enough data in stream to parse the entire '"+h+"' box"),{code:u.ERR_NOT_ENOUGH_DATA,type:h,size:d,hdr_size:l,start:n}):t?{code:u.OK,type:h,size:d,hdr_size:l,start:n}:(u[h+"Box"]?s=new u[h+"Box"](d):"uuid"!==h?(a.warn("BoxParser","Unknown box type: '"+h+"'"),(s=new u.Box(h,d)).has_unparsed_data=!0):u.UUIDBoxes[o]?s=new u.UUIDBoxes[o](d):(a.warn("BoxParser","Unknown uuid type: '"+o+"'"),(s=new u.Box(h,d)).uuid=o,s.has_unparsed_data=!0),s.hdr_size=l,s.start=n,s.write===u.Box.prototype.write&&"mdat"!==s.type&&(a.info("BoxParser","'"+c+"' box writing not yet implemented, keeping unparsed data in memory for later write"),s.parseDataAndRewind(e)),s.parse(e),(r=e.getPosition()-(s.start+s.size))<0?(a.warn("BoxParser","Parsing of box '"+c+"' did not read the entire indicated box data size (missing "+-r+" bytes), seeking forward"),e.seek(s.start+s.size)):r>0&&(a.error("BoxParser","Parsing of box '"+c+"' read "+r+" more bytes than the indicated box data size, seeking backwards"),0!==s.size&&e.seek(s.start+s.size)),{code:u.OK,box:s,size:s.size})},u.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},u.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},u.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},u.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},u.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},u.ContainerBox.prototype.parse=function(e){for(var t,i;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},u.SAMPLE_ENTRY_TYPE_VISUAL="Visual",u.SAMPLE_ENTRY_TYPE_AUDIO="Audio",u.SAMPLE_ENTRY_TYPE_HINT="Hint",u.SAMPLE_ENTRY_TYPE_METADATA="Metadata",u.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",u.SAMPLE_ENTRY_TYPE_SYSTEM="System",u.SAMPLE_ENTRY_TYPE_TEXT="Text",u.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},u.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},u.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},u.SampleEntry.prototype.parseFooter=function(e){u.ContainerBox.prototype.parse.call(this,e)},u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_HINT),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_METADATA),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SUBTITLE),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SYSTEM),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_TEXT),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_TEXT,"enct"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_METADATA,"encm"),u.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var i=0;i<3;i++)this.layer_size[i]=16==t?e.readUint16():e.readUint32()})),u.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),u.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),u.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)a.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void a.error("av1C reserved_2 parsing problem");var i=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(i)}else a.error("av1C reserved_1 parsing problem");else a.error("av1C version "+this.version+" not supported")})),u.createBoxCtor("avcC",(function(e){var t,i;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),i=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(i))})),u.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),u.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),u.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),u.createFullBoxCtor("co64",(function(e){var t,i;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(i=0;i>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),u.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),u.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),u.createFullBoxCtor("ctts",(function(e){var t,i;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(i=0;i>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|i>>6&3,this.acmod=i>>3&7,this.lfeon=i>>2&1,this.bit_rate_code=3&i|s>>5&7})),u.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var i=0;i>6,s.bsid=r>>1&31,s.bsmod=(1&r)<<4|o>>4&15,s.acmod=o>>1&7,s.lfeon=1&o,s.num_dep_sub=a>>1&15,s.num_dep_sub>0&&(s.chan_loc=(1&a)<<8|e.readUint8())}})),u.createFullBoxCtor("dfLa",(function(e){var t=[],i=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var s=e.readUint8(),r=Math.min(127&s,i.length-1);if(r?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(i[r]),128&s)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),u.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),u.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),u.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),u.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[i]=e.readString(4),t-=4,i++})),u.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),u.createBoxCtor("hvcC",(function(e){var t,i,s,r;this.configurationVersion=e.readUint8(),r=e.readUint8(),this.general_profile_space=r>>6,this.general_tier_flag=(32&r)>>5,this.general_profile_idc=31&r,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),r=e.readUint8(),this.constantFrameRate=r>>6,this.numTemporalLayers=(13&r)>>3,this.temporalIdNested=(4&r)>>2,this.lengthSizeMinusOne=3&r,this.nalu_arrays=[];var o=e.readUint8();for(t=0;t>7,a.nalu_type=63&r;var n=e.readUint16();for(i=0;i>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var i=0;if(this.version<2)i=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";i=e.readUint32()}for(var s=0;s>7,this.axis=1&t})),u.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),a.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),u.createFullBoxCtor("ipma",(function(e){var t,i;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?a.property_index=(127&o)<<8|e.readUint8():a.property_index=127&o}}})),u.createFullBoxCtor("iref",(function(e){var t,i;for(this.references=[];e.getPosition()>7,s.assignment_type=127&r,s.assignment_type){case 0:s.grouping_type=e.readString(4);break;case 1:s.grouping_type=e.readString(4),s.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:s.sub_track_id=e.readUint32();break;default:a.warn("BoxParser","Unknown leva assignement type")}}})),u.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),u.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),p.prototype.toString=function(){return"("+this.x+","+this.y+")"},u.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new p(e.readUint16(),e.readUint16()),this.display_primaries[1]=new p(e.readUint16(),e.readUint16()),this.display_primaries[2]=new p(e.readUint16(),e.readUint16()),this.white_point=new p(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),u.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),u.createFullBoxCtor("mehd",(function(e){1&this.flags&&(a.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),u.createFullBoxCtor("meta",(function(e){this.boxes=[],u.ContainerBox.prototype.parse.call(this,e)})),u.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),u.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),u.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),u.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),u.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),u.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),u.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var i=0;i0){var t=e.readUint32();this.kid=[];for(var i=0;i0&&(this.data=e.readUint8Array(s))})),u.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),u.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),u.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),u.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),u.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),u.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var i=0;i>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var i=e.readUint8(),s=0;s>7,this.num_leading_samples=127&t})),u.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)a.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=u.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),u.createSampleGroupCtor("stsa",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),u.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),u.createSampleGroupCtor("tsas",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createSampleGroupCtor("tscl",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createSampleGroupCtor("vipr",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),i=0;i>6,this.sample_depends_on[s]=t>>4&3,this.sample_is_depended_on[s]=t>>2&3,this.sample_has_redundancy[s]=3&t})),u.createFullBoxCtor("senc"),u.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),a.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),i=0;i>31&1,s.referenced_size=2147483647&r,s.subsegment_duration=e.readUint32(),r=e.readUint32(),s.starts_with_SAP=r>>31&1,s.SAP_type=r>>28&7,s.SAP_delta_time=268435455&r}})),u.SingleItemTypeReferenceBox=function(e,t,i,s){u.Box.call(this,e,t),this.hdr_size=i,this.start=s},u.SingleItemTypeReferenceBox.prototype=new u.Box,u.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var i=0;i>4&15,this.sample_sizes[t+1]=15&s}else if(8===this.field_size)for(t=0;t0)for(i=0;i>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=u.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),u.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),u.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),u.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var i=e.readUint32(),s=0;s>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),u.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),u.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),u.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),u.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),u.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),u.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},u.createTrackGroupCtor("msrc"),u.TrackReferenceTypeBox=function(e,t,i,s){u.Box.call(this,e,t),this.hdr_size=i,this.start=s},u.TrackReferenceTypeBox.prototype=new u.Box,u.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},u.trefBox.prototype.parse=function(e){for(var t,i;e.getPosition()t&&this.flags&u.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&u.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var i=0;i>7&1,this.block_pad_lsb=i>>6&1,this.block_little_endian=i>>5&1,this.block_reversed=i>>4&1,this.pad_unknown=i>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),u.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),u.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),u.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),u.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=u.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),u.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),u.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=u.parseHex16(e)})),u.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),u.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),u.createFullBoxCtor("vvcC",(function(e){var t,i,s={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(s.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,i=this.num_sublayers-2;i>=0;--i){var a=s.extract_bits(1);this.ptl_sublayer_present_mask|=a<1;++i)s.extract_bits(1);for(this.sublayer_level_idc=[],i=this.num_sublayers-2;i>=0;--i)this.ptl_sublayer_present_mask&1<>=1;t+=u.decimalToHex(s,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var r=!1,o="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||r)&&(o="."+u.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+o,r=!0);t+=o}return t},u.vvc1SampleEntry.prototype.getCodec=u.vvi1SampleEntry.prototype.getCodec=function(){var e,t=u.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var i="";if(this.vvcC.general_constraint_info){var s,r=[],o=0;for(o|=this.vvcC.ptl_frame_only_constraint<<7,o|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,r.push(o),o&&(s=e),o=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===s)i=".CA";else{i=".C";var a="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",n=0,l=0;for(e=0;e<=s;++e)for(n=n<<8|r[e],l+=8;l>=5;){i+=a[n>>l-5&31],n&=(1<<(l-=5))-1}l&&(i+=a[31&(n<<=5-l)])}}t+=i}return t},u.mp4aSampleEntry.prototype.getCodec=function(){var e=u.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),i=this.esds.esd.getAudioConfig();return e+"."+u.decimalToHex(t)+(i?"."+i:"")}return e},u.stxtSampleEntry.prototype.getCodec=function(){var e=u.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},u.vp08SampleEntry.prototype.getCodec=u.vp09SampleEntry.prototype.getCodec=function(){var e=u.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var i=this.vpcC.bitDepth;return 8==i&&(i="08"),e+".0"+this.vpcC.profile+"."+t+"."+i},u.av01SampleEntry.prototype.getCodec=function(){var e,t=u.SampleEntry.prototype.getCodec.call(this),i=this.av1C.seq_level_idx_0;return i<10&&(i="0"+i),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+i+(this.av1C.seq_tier_0?"H":"M")+"."+e},u.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>d&&(this.size+=8),"uuid"===this.type&&(this.size+=16),a.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>d?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>d&&e.writeUint64(this.size)},u.FullBox.prototype.writeHeader=function(e){this.size+=4,u.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},u.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},u.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},u.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&u.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&u.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&u.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&u.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&u.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&u.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&u.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&u.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&u.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&u.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},u.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},u.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},u.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&u.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&u.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&u.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&u.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&u.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&u.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&u.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&u.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[i]instanceof u.Box||t[i]instanceof u.Box||void 0===e[i]||void 0===t[i]||"function"==typeof e[i]||"function"==typeof t[i]||e.subBoxNames&&e.subBoxNames.indexOf(i.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(i.slice(0,4))>-1||"data"===i||"start"===i||"size"===i||"creation_time"===i||"modification_time"===i||u.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(i)>-1||e[i]===t[i]))return!1;return!0},u.boxEqual=function(e,t){if(!u.boxEqualFields(e,t))return!1;for(var i=0;i1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},y.prototype.setExtractionOptions=function(e,t,i){var s=this.getTrackById(e);if(s){var r={};this.extractedTracks.push(r),r.id=e,r.user=t,r.trak=s,s.nextSample=0,r.nb_samples=1e3,r.samples=[],i&&i.nbSamples&&(r.nb_samples=i.nbSamples)}},y.prototype.unsetExtractionOptions=function(e){for(var t=-1,i=0;i-1&&this.extractedTracks.splice(t,1)},y.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=u.parseOneBox(this.stream,false)).code===u.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var i;switch(i="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),i){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[i]&&a.warn("ISOFile","Duplicate Box of type: "+i+", overriding previous occurrence"),this[i]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},y.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(a.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(a.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(a.warn("ISOFile","Not ready to start parsing"),!1))},y.prototype.appendBuffer=function(e,t){var i;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(i=this.nextSeekPosition,this.nextSeekPosition=void 0):i=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(i=this.stream.getEndFilePositionAfter(i))):i=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(a.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+i),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),i},y.prototype.getInfo=function(){var e,t,i,s,r,o,a={},n=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(a.hasMoov=!0,a.duration=this.moov.mvhd.duration,a.timescale=this.moov.mvhd.timescale,a.isFragmented=null!=this.moov.mvex,a.isFragmented&&this.moov.mvex.mehd&&(a.fragment_duration=this.moov.mvex.mehd.fragment_duration),a.isProgressive=this.isProgressive,a.hasIOD=null!=this.moov.iods,a.brands=[],a.brands.push(this.ftyp.major_brand),a.brands=a.brands.concat(this.ftyp.compatible_brands),a.created=new Date(n+1e3*this.moov.mvhd.creation_time),a.modified=new Date(n+1e3*this.moov.mvhd.modification_time),a.tracks=[],a.audioTracks=[],a.videoTracks=[],a.subtitleTracks=[],a.metadataTracks=[],a.hintTracks=[],a.otherTracks=[],e=0;e0?a.mime+='video/mp4; codecs="':a.audioTracks&&a.audioTracks.length>0?a.mime+='audio/mp4; codecs="':a.mime+='application/mp4; codecs="',e=0;e=i.samples.length)&&(a.info("ISOFile","Sending fragmented data on track #"+s.id+" for samples ["+Math.max(0,i.nextSample-s.nb_samples)+","+(i.nextSample-1)+"]"),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(s.id,s.user,s.segmentStream.buffer,i.nextSample,e||i.nextSample>=i.samples.length),s.segmentStream=null,s!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=i.samples.length)&&(a.debug("ISOFile","Sending samples on track #"+o.id+" for sample "+i.nextSample),this.onSamples&&this.onSamples(o.id,o.user,o.samples),o.samples=[],o!==this.extractedTracks[t]))break}}}},y.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},y.prototype.getBoxes=function(e,t){var i=[];return y._sweep.call(this,e,i,t),i},y._sweep=function(e,t,i){for(var s in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&i)return;y._sweep.call(this.boxes[s],e,t,i)}},y.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},y.prototype.getTrackSample=function(e,t){var i=this.getTrackById(e);return this.getSample(i,t)},y.prototype.releaseUsedSamples=function(e,t,i){var s=0,r=this.getTrackById(e);r.lastValidSample||(r.lastValidSample=0);for(var o=r.lastValidSample;oe*r.timescale){d=s-1;break}t&&r.is_sync&&(l=s)}for(t&&(d=l),e=i.samples[d].cts,i.nextSample=d;i.samples[d].alreadyRead===i.samples[d].size&&i.samples[d+1];)d++;return o=i.samples[d].offset+i.samples[d].alreadyRead,a.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+i.nextSample+" on track "+i.tkhd.track_id+", time "+a.getDurationString(e,n)+" and offset: "+o),{offset:o,time:e/n}},y.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},y.prototype.seek=function(e,t){var i,s,r,o=this.moov,n={offset:1/0,time:1/0};if(this.moov){for(r=0;rthis.getTrackDuration(i)||((s=this.seekTrack(e,t,i)).offset-1){a=l;break}switch(a){case"Visual":if(r.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),o.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var c=new u.avcCBox;c.parse(new n(t.avcDecoderConfigRecord)),o.addBox(c)}else if(t.hevcDecoderConfigRecord){var p=new u.hvcCBox;p.parse(new n(t.hevcDecoderConfigRecord)),o.addBox(p)}break;case"Audio":r.add("smhd").set("balance",t.balance||0),o.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":r.add("hmhd");break;case"Subtitle":if(r.add("sthd"),"stpp"===t.type)o.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:r.add("nmhd")}t.description&&o.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){o.addBox(e)})),r.add("dinf").add("dref").addEntry((new u["url Box"]).set("flags",1));var f=r.add("stbl");return f.add("stsd").addEntry(o),f.add("stts").set("sample_counts",[]).set("sample_deltas",[]),f.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),f.add("stco").set("chunk_offsets",[]),f.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(i),t.id}},u.Box.prototype.computeSize=function(e){var t=e||new l;t.endianness=l.BIG_ENDIAN,this.write(t)},y.prototype.addSample=function(e,t,i){var s=i||{},r={},o=this.getTrackById(e);if(null!==o){r.number=o.samples.length,r.track_id=o.tkhd.track_id,r.timescale=o.mdia.mdhd.timescale,r.description_index=s.sample_description_index?s.sample_description_index-1:0,r.description=o.mdia.minf.stbl.stsd.entries[r.description_index],r.data=t,r.size=t.byteLength,r.alreadyRead=r.size,r.duration=s.duration||1,r.cts=s.cts||0,r.dts=s.dts||0,r.is_sync=s.is_sync||!1,r.is_leading=s.is_leading||0,r.depends_on=s.depends_on||0,r.is_depended_on=s.is_depended_on||0,r.has_redundancy=s.has_redundancy||0,r.degradation_priority=s.degradation_priority||0,r.offset=0,r.subsamples=s.subsamples,o.samples.push(r),o.samples_size+=r.size,o.samples_duration+=r.duration,void 0===o.first_dts&&(o.first_dts=s.dts),this.processSamples();var a=this.createSingleSampleMoof(r);return this.addBox(a),a.computeSize(),a.trafs[0].truns[0].data_offset=a.size+8,this.add("mdat").data=new Uint8Array(t),r}},y.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var i=new u.moofBox;i.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var s=i.add("traf"),r=this.getTrackById(e.track_id);return s.add("tfhd").set("track_id",e.track_id).set("flags",u.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),s.add("tfdt").set("baseMediaDecodeTime",e.dts-(r.first_dts||0)),s.add("trun").set("flags",u.TRUN_FLAGS_DATA_OFFSET|u.TRUN_FLAGS_DURATION|u.TRUN_FLAGS_SIZE|u.TRUN_FLAGS_FLAGS|u.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),i},y.prototype.lastMoofIndex=0,y.prototype.samplesDataSize=0,y.prototype.resetTables=function(){var e,t,i,s,r,o;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(l=r[a].grouping_type+"/0",(n=new d(r[a].grouping_type,0)).is_fragment=!0,t.sample_groups_info[l]||(t.sample_groups_info[l]=n))}else for(a=0;a=2&&(l=s[a].grouping_type+"/0",n=new d(s[a].grouping_type,0),e.sample_groups_info[l]||(e.sample_groups_info[l]=n))},y.setSampleGroupProperties=function(e,t,i,s){var r,o;for(r in t.sample_groups=[],s){var a;if(t.sample_groups[r]={},t.sample_groups[r].grouping_type=s[r].grouping_type,t.sample_groups[r].grouping_type_parameter=s[r].grouping_type_parameter,i>=s[r].last_sample_in_run&&(s[r].last_sample_in_run<0&&(s[r].last_sample_in_run=0),s[r].entry_index++,s[r].entry_index<=s[r].sbgp.entries.length-1&&(s[r].last_sample_in_run+=s[r].sbgp.entries[s[r].entry_index].sample_count)),s[r].entry_index<=s[r].sbgp.entries.length-1?t.sample_groups[r].group_description_index=s[r].sbgp.entries[s[r].entry_index].group_description_index:t.sample_groups[r].group_description_index=-1,0!==t.sample_groups[r].group_description_index)a=s[r].fragment_description?s[r].fragment_description:s[r].description,t.sample_groups[r].group_description_index>0?(o=t.sample_groups[r].group_description_index>65535?(t.sample_groups[r].group_description_index>>16)-1:t.sample_groups[r].group_description_index-1,a&&o>=0&&(t.sample_groups[r].description=a.entries[o])):a&&a.version>=2&&a.default_group_description_index>0&&(t.sample_groups[r].description=a.entries[a.default_group_description_index-1])}},y.process_sdtp=function(e,t,i){t&&(e?(t.is_leading=e.is_leading[i],t.depends_on=e.sample_depends_on[i],t.is_depended_on=e.sample_is_depended_on[i],t.has_redundancy=e.sample_has_redundancy[i]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},y.prototype.buildSampleLists=function(){var e,t;for(e=0;eb&&(v++,b<0&&(b=0),b+=o.sample_counts[v]),t>0?(e.samples[t-1].duration=o.sample_deltas[v],e.samples_duration+=e.samples[t-1].duration,k.dts=e.samples[t-1].dts+e.samples[t-1].duration):k.dts=0,a?(t>=_&&(S++,_<0&&(_=0),_+=a.sample_counts[S]),k.cts=e.samples[t].dts+a.sample_offsets[S]):k.cts=k.dts,n?(t==n.sample_numbers[E]-1?(k.is_sync=!0,E++):(k.is_sync=!1,k.degradation_priority=0),d&&d.entries[w].sample_delta+T==t+1&&(k.subsamples=d.entries[w].subsamples,T+=d.entries[w].sample_delta,w++)):k.is_sync=!0,y.process_sdtp(e.mdia.minf.stbl.sdtp,k,k.number),k.degradation_priority=u?u.priority[t]:0,d&&d.entries[w].sample_delta+T==t&&(k.subsamples=d.entries[w].subsamples,T+=d.entries[w].sample_delta),(h.length>0||c.length>0)&&y.setSampleGroupProperties(e,k,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},y.prototype.updateSampleLists=function(){var e,t,i,s,r,o,a,n,l,d,h,c,p,f,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&y.initSampleGroups(c,h,h.sbgps,c.mdia.minf.stbl.sgpds,h.sgpds),t=0;t0?f.dts=c.samples[c.samples.length-2].dts+c.samples[c.samples.length-2].duration:(h.tfdt?f.dts=h.tfdt.baseMediaDecodeTime:f.dts=0,c.first_traf_merged=!0),f.cts=f.dts,g.flags&u.TRUN_FLAGS_CTS_OFFSET&&(f.cts=f.dts+g.sample_composition_time_offset[i]),m=a,g.flags&u.TRUN_FLAGS_FLAGS?m=g.sample_flags[i]:0===i&&g.flags&u.TRUN_FLAGS_FIRST_FLAG&&(m=g.first_sample_flags),f.is_sync=!(m>>16&1),f.is_leading=m>>26&3,f.depends_on=m>>24&3,f.is_depended_on=m>>22&3,f.has_redundancy=m>>20&3,f.degradation_priority=65535&m;var A=!!(h.tfhd.flags&u.TFHD_FLAG_BASE_DATA_OFFSET),b=!!(h.tfhd.flags&u.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),v=!!(g.flags&u.TRUN_FLAGS_DATA_OFFSET),_=0;_=A?h.tfhd.base_data_offset:b||0===t?d.start:n,f.offset=0===t&&0===i?v?_+g.data_offset:_:n,n=f.offset+f.size,(h.sbgps.length>0||h.sgpds.length>0||c.mdia.minf.stbl.sbgps.length>0||c.mdia.minf.stbl.sgpds.length>0)&&y.setSampleGroupProperties(c,f,f.number_in_traf,h.sample_groups_info)}}if(h.subs){c.has_fragment_subsamples=!0;var S=h.first_sample_index;for(t=0;t-1))return null;var o=(i=this.stream.buffers[r]).byteLength-(s.offset+s.alreadyRead-i.fileStart);if(s.size-s.alreadyRead<=o)return a.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-i.fileStart)+" read size: "+(s.size-s.alreadyRead)+" full size: "+s.size+")"),l.memcpy(s.data.buffer,s.alreadyRead,i,s.offset+s.alreadyRead-i.fileStart,s.size-s.alreadyRead),i.usedBytes+=s.size-s.alreadyRead,this.stream.logBufferLevel(),s.alreadyRead=s.size,s;if(0===o)return null;a.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-i.fileStart)+" read size: "+o+" full size: "+s.size+")"),l.memcpy(s.data.buffer,s.alreadyRead,i,s.offset+s.alreadyRead-i.fileStart,o),s.alreadyRead+=o,i.usedBytes+=o,this.stream.logBufferLevel()}},y.prototype.releaseSample=function(e,t){var i=e.samples[t];return i.data?(this.samplesDataSize-=i.size,i.data=null,i.description=null,delete i.degradation_priority,delete i.depends_on,delete i.description_index,delete i.has_redundancy,delete i.is_depended_on,delete i.is_leading,delete i.is_sync,delete i.moof_number,delete i.number_in_traf,delete i.timescale,delete i.cts,delete i.dts,delete i.offset,delete i.size,delete i.track_id,delete i.duration,i.alreadyRead=0,i.size):0},y.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},y.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},y.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(i.protection=o.ipro.protections[o.iinf.item_infos[e].protection_index-1]),o.iinf.item_infos[e].item_type?i.type=o.iinf.item_infos[e].item_type:i.type="mime",i.content_type=o.iinf.item_infos[e].content_type,i.content_encoding=o.iinf.item_infos[e].content_encoding;if(o.grpl)for(e=0;e0&&u.property_index-1-1))return null;var n=(t=this.stream.buffers[o]).byteLength-(r.offset+r.alreadyRead-t.fileStart);if(!(r.length-r.alreadyRead<=n))return a.debug("ISOFile","Getting item #"+e+" extent #"+s+" partial data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-t.fileStart)+" read size: "+n+" full extent size: "+r.length+" full item size: "+i.size+")"),l.memcpy(i.data.buffer,i.alreadyRead,t,r.offset+r.alreadyRead-t.fileStart,n),r.alreadyRead+=n,i.alreadyRead+=n,t.usedBytes+=n,this.stream.logBufferLevel(),null;a.debug("ISOFile","Getting item #"+e+" extent #"+s+" data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-t.fileStart)+" read size: "+(r.length-r.alreadyRead)+" full extent size: "+r.length+" full item size: "+i.size+")"),l.memcpy(i.data.buffer,i.alreadyRead,t,r.offset+r.alreadyRead-t.fileStart,r.length-r.alreadyRead),t.usedBytes+=r.length-r.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead+=r.length-r.alreadyRead,r.alreadyRead=r.length}}return i.alreadyRead===i.size?i:null},y.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var i=0;i0?this.moov.traks[e].samples[0].duration:0),t.push(s)}return t},y.prototype.getPerformanceInfo=function(){var e={};return e.moov=this.moov,this.moov&&this.moov.traks&&this.moov.traks.length>1&&(e.moovAudioNum=this.moov.traks[0].samples.length,e.moovVideoNum=this.moov.traks[1].samples.length),e},u.Box.prototype.printHeader=function(e){this.size+=8,this.size>d&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},u.FullBox.prototype.printHeader=function(e){this.size+=4,u.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},u.Box.prototype.print=function(e){this.printHeader(e)},u.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},u.tkhdBox.prototype.print=function(e){u.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var A={createFile:function(e,t){var i=void 0===e||e,s=new y(t);return s.discardMdatData=!i,s}};t.createFile=A.createFile}));function uh(e){return e.reduce(((e,t)=>256*e+t))}function ph(e){const t=[101,103,119,99],i=e.length-28,s=e.slice(i,i+t.length);return t.every(((e,t)=>e===s[t]))}ch.Log,ch.MP4BoxStream,ch.DataStream,ch.MultiBufferStream,ch.MPEG4DescriptorParser,ch.BoxParser,ch.XMLSubtitlein4Parser,ch.Textin4Parser,ch.ISOFile,ch.createFile;class fh{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(i+32,i+32+t))]}return null}(t,this.t);if(!i)return e;const s=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(s instanceof Error)return console.error(s.message),this.d=!0,e;this.A=!0,this.u=i[1],ph(t)&&this.c++,WebAssembly.instantiate(i[2],s).then((e=>{if(!function(e){return"function"==typeof e.parse&&"object"==typeof e.memory}(e.instance.exports))return this.d=!0,void console.error("video_error_3");this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}class mh extends Yd{constructor(e){super(e),this.TAG_NAME="Fmp4Loader",this.player=e,this.mp4Box=ch.createFile(),this.tempFmp4List=[],this.offset=0,this.videoTrackId=null,this.audioTrackId=null,this.isHevc=!1,this.transportDescarmber=null,this.player._opt.isFmp4Private&&(this.transportDescarmber=new fh),this._listenMp4Box(),e.debugLog(this.TAG_NAME,"init")}destroy(){this.mp4Box&&(this.mp4Box.stop(),this.mp4Box.flush(),this.mp4Box.destroy(),this.mp4Box=null),this.transportDescarmber&&(this.transportDescarmber.destroy(),this.transportDescarmber=null),this.tempFmp4List=[],this.offset=0,this.videoTrackId=null,this.audioTrackId=null,this.isHevc=!1,this.player.debugLog(this.TAG_NAME,"destroy")}_listenMp4Box(){this.mp4Box.onReady=this.onReady.bind(this),this.mp4Box.onError=this.onError.bind(this),this.mp4Box.onSamples=this.onSamples.bind(this)}onReady(e){this.player.debugLog(this.TAG_NAME,"onReady",e);const t=e.videoTracks[0],i=e.audioTracks[0];if(t){this.videoTrackId=t.id;const e=this.getSeqHeader(t);e&&(this.player.debugLog(this.TAG_NAME,"seqHeader",e),this._doDecodeByFmp4(e,Ue,0,!0,0)),this.mp4Box.setExtractionOptions(t.id)}if(i&&this.player._opt.hasAudio){this.audioTrackId=i.id;const e=i.audio||{},t=Pr.indexOf(e.sample_rate),s=i.codec.replace("mp4a.40.","");this.mp4Box.setExtractionOptions(i.id);const r={profile:parseInt(s,10),sampleRate:t,channel:e.channel_count},o=Br(r);this.player.debugLog(this.TAG_NAME,"aacADTSHeader",o,"config",r),this._doDecodeByFmp4(o,Fe,0,!1,0)}this.mp4Box.start()}onError(e){this.player.debugError(this.TAG_NAME,"mp4Box onError",e)}onSamples(e,t,i){if(e===this.videoTrackId){for(const e of i){const t=e.data,i=e.is_sync,s=1e3*e.cts/e.timescale;e.duration,e.timescale,this.player.updateStats({vbps:t.byteLength,dts:s}),i&&this.calcIframeIntervalTimestamp(s);let r=null;r=this.isHevc?$n(t,i):Pn(t,i);let o=this.cryptoPayload(r,i);this._doDecodeByFmp4(o,Ue,s,i,0)}this.mp4Box.removeUsedSamples(e)}else if(e===this.audioTrackId){if(this.player._opt.hasAudio){for(const e of i){const t=e.data;this.player.updateStats({abps:t.byteLength});const i=1e3*e.cts/e.timescale;e.duration,e.timescale;const s=new Uint8Array(t.byteLength+2);s.set([175,1],0),s.set(t,2),this._doDecodeByFmp4(s,Fe,i,!1,0)}this.mp4Box.removeUsedSamples(e)}}else this.player.debugWarn(this.TAG_NAME,"onSamples() trackId error",e)}getSeqHeader(e){const t=this.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new ch.DataStream(void 0,0,ch.DataStream.BIG_ENDIAN);let i=[];e.avcC?(e.avcC.write(t),i=[23,0,0,0,0]):(this.isHevc=!0,e.hvcC.write(t),i=[28,0,0,0,0]);const s=new Uint8Array(t.buffer,8),r=new Uint8Array(i.length+s.length);return r.set(i,0),r.set(s,i.length),r}return null}dispatch(e){let t=new Uint8Array(e);this.transportDescarmber&&(t=this.transportDescarmber.transport(t)),t.buffer.fileStart=this.offset,this.offset+=t.byteLength,this.mp4Box.appendBuffer(t.buffer)}downloadFmp4File(){const e=new Blob(this.tempFmp4List,{type:'video/mp4; codecs="avc1.640028,mp4a.40.2"'}),t=URL.createObjectURL(e),i=document.createElement("a");i.href=t,i.download=eo()+".fmp4",i.click(),URL.revokeObjectURL(t)}getInputByteLength(){let e=0;return this.mp4Box&&(e=this.mp4Box.getAllocatedSampleDataSize()),e}}class gh extends Yd{constructor(e){super(e),nh(this,"LOG_NAME","Mpeg4Loader"),this.player=e,this.player.debugLog(this.LOG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.LOG_NAME,"destroy")}}function yh(){for(var e=arguments.length,t=new Array(e),i=0;ie+t.byteLength),0));let r=0;return t.forEach((e=>{s.set(e,r),r+=e.byteLength})),s}const Ah=3,bh=4,vh=6,_h=15,Sh=17,Eh=129,wh=135,Th=21,kh=134,Lh=27,Ch=36;class Dh{constructor(){this.slices=[],this.total_length=0,this.expected_length=0,this.random_access_indicator=0}}class xh{constructor(){this.pid=null,this.data=null,this.stream_type=null,this.random_access_indicator=null}}class Rh{constructor(){this.pid=null,this.stream_id=null,this.len=null,this.data=null,this.pts=null,this.nearest_pts=null,this.dts=null}}const Ph=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];class Bh{constructor(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}isComplete(){let e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&null!=this.sarDen;return null!=this.mimeType&&e&&t}isSeekable(){return!0===this.hasKeyframesIndex}getNearestKeyframe(e){if(null==this.keyframesIndex)return null;let t=this.keyframesIndex,i=this._search(t.times,e);return{index:i,milliseconds:t.times[i],fileposition:t.filepositions[i]}}_search(e,t){let i=0,s=e.length-1,r=0,o=0,a=s;for(t=e[r]&&t=6?(s=5,t=new Array(4),a=r-3):(s=2,t=new Array(2),a=r):-1!==n.indexOf("android")?(s=2,t=new Array(2),a=r):(s=5,a=r,t=new Array(4),r>=6?a=r-3:1===o&&(s=2,t=new Array(2),a=r)),t[0]=s<<3,t[0]|=(15&r)>>>1,t[1]=(15&r)<<7,t[1]|=(15&o)<<3,5===s&&(t[1]|=(15&a)>>>1,t[2]=(1&a)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=Ph[r],this.sampling_index=r,this.channel_count=o,this.object_type=s,this.original_object_type=i,this.codec_mimetype="mp4a.40."+s,this.original_codec_mimetype="mp4a.40."+i}}class Mh extends Yd{constructor(e){super(e),this.player=e,this.TAG_NAME="TsLoader",this.first_parse_=!0,this.tsPacketSize=0,this.syncOffset=0,this.pmt_=null,this.config_=null,this.media_info_=new Bh,this.timescale_=90,this.duration_=0,this.pat_={version_number:0,network_pid:0,program_map_pid:{}},this.current_program_=null,this.current_pmt_pid_=-1,this.program_pmt_map_={},this.pes_slice_queues_={},this.section_slice_queues_={},this.video_metadata_={vps:null,sps:null,pps:null,details:null},this.audio_metadata_={codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},this.last_pcr_=null,this.last_pcr_base_=NaN,this.timestamp_offset_=0,this.audio_last_sample_pts_=void 0,this.aac_last_incomplete_data_=null,this.has_video_=!1,this.has_audio_=!1,this.video_init_segment_dispatched_=!1,this.audio_init_segment_dispatched_=!1,this.video_metadata_changed_=!1,this.audio_metadata_changed_=!1,this.loas_previous_frame=null,this.video_track_={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this.audio_track_={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._remainingPacketData=null,this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.media_info_=null,this.pes_slice_queues_=null,this.section_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,this._remainingPacketData=null,super.destroy()}probe(e){let t=new Uint8Array(e),i=-1,s=188;if(t.byteLength<=3*s)return{needMoreData:!0};for(;-1===i;){let e=Math.min(1e3,t.byteLength-3*s);for(let r=0;r=4&&(i-=4),{match:!0,consumed:0,ts_packet_size:s,sync_offset:i})}_initPmt(){return{program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}}dispatch(e){let t=new Uint8Array(e);this._remainingPacketData&&(t=yh(this._remainingPacketData,t),this._remainingPacketData=null);let i=t.buffer;const s=this.parseChunks(i);s?this._remainingPacketData=t.subarray(s):t.length>>6;i[1];let o=(31&i[1])<<8|i[2],a=(48&i[3])>>>4,n=15&i[3],l=!(!this.pmt_||this.pmt_.pcr_pid!==o),d={},h=4;if(2==a||3==a){let e=i[4];if(e>0&&(l||3==a)){if(d.discontinuity_indicator=(128&i[5])>>>7,d.random_access_indicator=(64&i[5])>>>6,d.elementary_stream_priority_indicator=(32&i[5])>>>5,(16&i[5])>>>4){let e=300*this._getPcrBase(i)+((1&i[10])<<8|i[11]);this.last_pcr_=e}}if(2==a||5+e===188){t+=188,204===this.tsPacketSize&&(t+=16);continue}h=5+e}if(1==a||3==a)if(0===o||o===this.current_pmt_pid_||null!=this.pmt_&&this.pmt_.pid_stream_type[o]===kh){let i=188-h;this.handleSectionSlice(e,t+h,i,{pid:o,payload_unit_start_indicator:r,continuity_conunter:n,random_access_indicator:d.random_access_indicator})}else if(null!=this.pmt_&&null!=this.pmt_.pid_stream_type[o]){let i=188-h,s=this.pmt_.pid_stream_type[o];o!==this.pmt_.common_pids.h264&&o!==this.pmt_.common_pids.h265&&o!==this.pmt_.common_pids.adts_aac&&o!==this.pmt_.common_pids.loas_aac&&o!==this.pmt_.common_pids.ac3&&o!==this.pmt_.common_pids.eac3&&o!==this.pmt_.common_pids.opus&&o!==this.pmt_.common_pids.mp3&&!0!==this.pmt_.pes_private_data_pids[o]&&!0!==this.pmt_.timed_id3_pids[o]&&!0!==this.pmt_.synchronous_klv_pids[o]&&!0!==this.pmt_.asynchronous_klv_pids[o]||this.handlePESSlice(e,t+h,i,{pid:o,stream_type:s,payload_unit_start_indicator:r,continuity_conunter:n,random_access_indicator:d.random_access_indicator})}t+=188,204===this.tsPacketSize&&(t+=16)}return this.dispatchAudioVideoMediaSegment(),t}handleSectionSlice(e,t,i,s){let r=new Uint8Array(e,t,i),o=this.section_slice_queues_[s.pid];if(s.payload_unit_start_indicator){let a=r[0];if(null!=o&&0!==o.total_length){let r=new Uint8Array(e,t+1,Math.min(i,a));o.slices.push(r),o.total_length+=r.byteLength,o.total_length===o.expected_length?this.emitSectionSlices(o,s):this.clearSlices(o,s)}for(let n=1+a;n=o.expected_length&&this.clearSlices(o,s),n+=l.byteLength}}else if(null!=o&&0!==o.total_length){let r=new Uint8Array(e,t,Math.min(i,o.expected_length-o.total_length));o.slices.push(r),o.total_length+=r.byteLength,o.total_length===o.expected_length?this.emitSectionSlices(o,s):o.total_length>=o.expected_length&&this.clearSlices(o,s)}}handlePESSlice(e,t,i,s){let r=new Uint8Array(e,t,i),o=r[0]<<16|r[1]<<8|r[2];r[3];let a=r[4]<<8|r[5];if(s.payload_unit_start_indicator){if(1!==o)return void this.player.debugWarn(this.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${o}`);let e=this.pes_slice_queues_[s.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?this.emitPESSlices(e,s):this.clearSlices(e,s)),this.pes_slice_queues_[s.pid]=new Dh,this.pes_slice_queues_[s.pid].random_access_indicator=s.random_access_indicator}if(null==this.pes_slice_queues_[s.pid])return;let n=this.pes_slice_queues_[s.pid];n.slices.push(r),s.payload_unit_start_indicator&&(n.expected_length=0===a?0:a+6),n.total_length+=r.byteLength,n.expected_length>0&&n.expected_length===n.total_length?this.emitPESSlices(n,s):n.expected_length>0&&n.expected_length>>6,n=t[8];2!==a&&3!==a||(i=this._getTimestamp(t,9),o=3===a?this._getTimestamp(t,14):i);let l,d=9+n;if(0!==r){if(r<3+n)return void this.player.debugWarn(this.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");l=r-3-n}else l=t.byteLength-d;let h=t.subarray(d,d+l);switch(e.stream_type){case Ah:case bh:this.parseMP3Payload(h,i);break;case vh:this.pmt_.common_pids.opus===e.pid?this.parseOpusPayload(h,i):this.pmt_.common_pids.ac3===e.pid?this.parseAC3Payload(h,i):this.pmt_.common_pids.eac3===e.pid?this.parseEAC3Payload(h,i):this.pmt_.asynchronous_klv_pids[e.pid]?this.parseAsynchronousKLVMetadataPayload(h,e.pid,s):this.pmt_.smpte2038_pids[e.pid]?this.parseSMPTE2038MetadataPayload(h,i,o,e.pid,s):this.parsePESPrivateDataPayload(h,i,o,e.pid,s);break;case _h:this.parseADTSAACPayload(h,i);break;case Sh:this.parseLOASAACPayload(h,i);break;case Eh:this.parseAC3Payload(h,i);break;case wh:this.parseEAC3Payload(h,i);break;case Th:this.pmt_.timed_id3_pids[e.pid]?this.parseTimedID3MetadataPayload(h,i,o,e.pid,s):this.pmt_.synchronous_klv_pids[e.pid]&&this.parseSynchronousKLVMetadataPayload(h,i,o,e.pid,s);break;case Lh:this.parseH264Payload(h,i,o,e.random_access_indicator);break;case Ch:this.parseH265Payload(h,i,o,e.random_access_indicator)}}else if((188===s||191===s||240===s||241===s||255===s||242===s||248===s)&&e.stream_type===vh){let i,o=6;i=0!==r?r:t.byteLength-o;let a=t.subarray(o,o+i);this.parsePESPrivateDataPayload(a,void 0,void 0,e.pid,s)}}else this.player.debugError(this.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${i}`)}parsePAT(e){let t=e[0];if(0!==t)return void Log.e(this.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let i=(15&e[1])<<8|e[2];e[3],e[4];let s=(62&e[5])>>>1,r=1&e[5],o=e[6];e[7];let a=null;if(1===r&&0===o)a={version_number:0,network_pid:0,program_pmt_pid:{}},a.version_number=s;else if(a=this.pat_,null==a)return;let n=i-5-4,l=-1,d=-1;for(let t=8;t<8+n;t+=4){let i=e[t]<<8|e[t+1],s=(31&e[t+2])<<8|e[t+3];0===i?a.network_pid=s:(a.program_pmt_pid[i]=s,-1===l&&(l=i),-1===d&&(d=s))}1===r&&0===o&&(null==this.pat_&&this.player.debugLog(this.TAG_NAME,`Parsed first PAT: ${JSON.stringify(a)}`),this.pat_=a,this.current_program_=l,this.current_pmt_pid_=d)}parsePMT(e){let t=e[0];if(2!==t)return void this.player.debugError(this.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let i,s=(15&e[1])<<8|e[2],r=e[3]<<8|e[4],o=(62&e[5])>>>1,a=1&e[5],n=e[6];if(e[7],1===a&&0===n)i=this._initPmt(),i.program_number=r,i.version_number=o,this.program_pmt_map_[r]=i;else if(i=this.program_pmt_map_[r],null==i)return;i.pcr_pid=(31&e[8])<<8|e[9];let l=(15&e[10])<<8|e[11],d=12+l,h=s-9-l-4;for(let t=d;t0){for(let s=t+5;s0)for(let s=t+5;s1&&(this.player.debugWarn(this.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${s}ms`),s=e)}}let r,o=new Hr(e),a=null,n=s;for(;null!=(a=o.readNextAACFrame());){i=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},this.dispatchAudioInitSegment(e)):this.detectAudioMetadataChange(e)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(e)),r=n;let t=Math.floor(n);const s=new Uint8Array(a.data.length+2);s.set([175,1],0),s.set(a.data,2);let o={payload:s,length:s.byteLength,pts:t,dts:t,type:Fe};this.audio_track_.samples.push(o),this.audio_track_.length+=s.byteLength,n+=i}o.hasIncompleteData()&&(this.aac_last_incomplete_data_=o.getIncompleteData()),r&&(this.audio_last_sample_pts_=r)}parseLOASAACPayload(e,t){if(this.has_video_&&!this.video_init_segment_dispatched_)return;if(this.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);t.set(this.aac_last_incomplete_data_,0),t.set(e,this.aac_last_incomplete_data_.byteLength),e=t}let i,s;if(null!=t&&(s=t/this.timescale_),"aac"===this.audio_metadata_.codec){if(null==t&&null!=this.audio_last_sample_pts_)i=1024/this.audio_metadata_.sampling_frequency*1e3,s=this.audio_last_sample_pts_+i;else if(null==t)return void this.player.debugWarn(this.TAG_NAME,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.audio_last_sample_pts_){i=1024/this.audio_metadata_.sampling_frequency*1e3;let e=this.audio_last_sample_pts_+i;Math.abs(e-s)>1&&(this.player.debugWarn(this.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${s}ms`),s=e)}}let r,o=new $r(e),a=null,n=s;for(;null!=(a=o.readNextAACFrame(Co(this.loas_previous_frame)?void 0:this.loas_previous_frame));){this.loas_previous_frame=a,i=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},this.dispatchAudioInitSegment(e)):this.detectAudioMetadataChange(e)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(e)),r=n;let t=Math.floor(n);const s=new Uint8Array(a.data.length+2);s.set([175,1],0),s.set(a.data,2);let o={payload:s,length:s.byteLength,pts:t,dts:t,type:Fe};this.audio_track_.samples.push(o),this.audio_track_.length+=s.byteLength,n+=i}o.hasIncompleteData()&&(this.aac_last_incomplete_data_=o.getIncompleteData()),r&&(this.audio_last_sample_pts_=r)}parseAC3Payload(e,t){}parseEAC3Payload(e,t){}parseOpusPayload(e,t){}parseMP3Payload(e,t){if(this.has_video_&&!this.video_init_segment_dispatched_)return;let i=[44100,48e3,32e3,0],s=[22050,24e3,16e3,0],r=[11025,12e3,8e3,0],o=e[1]>>>3&3,a=(6&e[1])>>1;e[2];let n=(12&e[2])>>>2,l=3!==(e[3]>>>6&3)?2:1,d=0,h=34;switch(o){case 0:d=r[n];break;case 2:d=s[n];break;case 3:d=i[n]}switch(a){case 1:h=34;break;case 2:h=33;break;case 3:h=32}const c={};c.object_type=h,c.sample_rate=d,c.channel_count=l,c.data=e;const u={codec:"mp3",data:c};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"mp3",object_type:h,sample_rate:d,channel_count:l},this.dispatchAudioInitSegment(u)):this.detectAudioMetadataChange(u)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(u));let p={payload:e,length:e.byteLength,pts:t/this.timescale_,dts:t/this.timescale_,type:Fe};this.audio_track_.samples.push(p),this.audio_track_.length+=e.byteLength}detectAudioMetadataChange(e){if(e.codec!==this.audio_metadata_.codec)return this.player.debugLog(this.TAG_NAME,`Audio: Audio Codecs changed from ${this.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===this.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==this.audio_metadata_.audio_object_type)return this.player.debugLog(this.TAG_NAME,`AAC: AudioObjectType changed from ${this.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==this.audio_metadata_.sampling_freq_index)return this.player.debugLog(this.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${this.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==this.audio_metadata_.channel_config)return this.player.debugLog(this.TAG_NAME,`AAC: Channel configuration changed from ${this.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===this.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==this.audio_metadata_.sampling_frequency)return this.player.debugLog(this.TAG_NAME,`AC3: Sampling Frequency changed from ${this.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==this.audio_metadata_.bit_stream_identification)return this.player.debugLog(this.TAG_NAME,`AC3: Bit Stream Identification changed from ${this.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==this.audio_metadata_.bit_stream_mode)return this.player.debugLog(this.TAG_NAME,`AC3: BitStream Mode changed from ${this.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==this.audio_metadata_.channel_mode)return this.player.debugLog(this.TAG_NAME,`AC3: Channel Mode changed from ${this.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==this.audio_metadata_.low_frequency_effects_channel_on)return this.player.debugLog(this.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${this.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===this.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==this.audio_metadata_.sample_rate)return this.player.debugLog(this.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==this.audio_metadata_.channel_count)return this.player.debugLog(this.TAG_NAME,`Opus: Channel count changed from ${this.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===this.audio_metadata_.codec){const t=e.data;if(t.object_type!==this.audio_metadata_.object_type)return this.player.debugLog(this.TAG_NAME,`MP3: AudioObjectType changed from ${this.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==this.audio_metadata_.sample_rate)return this.player.debugLog(this.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==this.audio_metadata_.channel_count)return this.player.debugLog(this.TAG_NAME,`MP3: Channel count changed from ${this.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1}dispatchAudioInitSegment(e){let t={type:"audio"};t.id=this.audio_track_.id,t.timescale=1e3,t.duration=this.duration_;let i="";if("aac"===this.audio_metadata_.codec){let s="aac"===e.codec?e.data:null,r=new Ih(s);t.audioSampleRate=r.sampling_rate,t.audioSampleRateIndex=r.sampling_index,t.channelCount=r.channel_count,t.codec=r.codec_mimetype,t.originalCodec=r.original_codec_mimetype,t.config=r.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale,i=_t;const o=Br({profile:this.player._opt.mseDecodeAudio?r.object_type:r.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});console.error("aacADTSHeader",`profile: ${r.object_type}, sampleRate: ${t.audioSampleRateIndex}, channel: ${t.channelCount}`),this._doDecodeByTs(o,Fe,0,!1,0)}else"ac-3"===this.audio_metadata_.codec||"ec-3"===this.audio_metadata_.codec||"opus"===this.audio_metadata_.codec||"mp3"===this.audio_metadata_.codec&&(t.audioSampleRate=this.audio_metadata_.sample_rate,t.channelCount=this.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0,i=Et);0==this.audio_init_segment_dispatched_&&this.player.debugLog(this.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;let s=this.media_info_;s.hasAudio=!0,s.audioCodec=t.originalCodec,s.audioSampleRate=t.audioSampleRate,s.audioChannelCount=t.channelCount,s.hasVideo&&s.videoCodec?s.mimeType=`video/mp2t; codecs="${s.videoCodec},${s.audioCodec}"`:s.mimeType=`video/mp2t; codecs="${s.audioCodec}"`,i&&this.player.audio.updateAudioInfo({encTypeCode:i,channels:t.channelCount,sampleRate:t.audioSampleRate})}dispatchPESPrivateDataDescriptor(e,t,i){}parsePESPrivateDataPayload(e,t,i,s,r){let o=new Rh;if(o.pid=s,o.stream_id=r,o.len=e.byteLength,o.data=e,null!=t){let e=Math.floor(t/this.timescale_);o.pts=e}else o.nearest_pts=this.getNearestTimestampMilliseconds();if(null!=i){let e=Math.floor(i/this.timescale_);o.dts=e}}parseTimedID3MetadataPayload(e,t,i,s,r){this.player.debugLog(this.TAG_NAME,`Timed ID3 Metadata: pid=${s}, pts=${t}, dts=${i}, stream_id=${r}`)}parseSynchronousKLVMetadataPayload(e,t,i,s,r){this.player.debugLog(this.TAG_NAME,`Synchronous KLV Metadata: pid=${s}, pts=${t}, dts=${i}, stream_id=${r}`)}parseAsynchronousKLVMetadataPayload(e,t,i){this.player.debugLog(this.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${i}`)}parseSMPTE2038MetadataPayload(e,t,i,s,r){this.player.debugLog(this.TAG_NAME,`SMPTE 2038 Metadata: pid=${s}, pts=${t}, dts=${i}, stream_id=${r}`)}getNearestTimestampMilliseconds(){if(null!=this.audio_last_sample_pts_)return Math.floor(this.audio_last_sample_pts_);if(null!=this.last_pcr_){return Math.floor(this.last_pcr_/300/this.timescale_)}}_preDoDecode(){const e=this.video_track_,t=this.audio_track_;let i=e.samples;t.samples.length>0&&(i=e.samples.concat(t.samples),i=i.sort(((e,t)=>e.dts-t.dts))),i.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===Ue?this._doDecodeVideo({...e,payload:t}):e.type===Fe&&this._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0}_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?$n(t,e.isIFrame):Pn(t,e.isIFrame),this.player.updateStats({dts:e.dts,vbps:i.byteLength}),e.isIFrame&&this.calcIframeIntervalTimestamp(e.dts);let s=this.cryptoPayload(i,e.isIFrame);this._doDecodeByTs(s,Ue,e.dts,e.isIFrame,e.cts)}_doDecodeAudio(e){const t=new Uint8Array(e.payload);this.player.updateStats({abps:t.byteLength});let i=this.cryptoPayloadAudio(t);this._doDecodeByTs(i,Fe,e.dts,!1,0)}getInputByteLength(){return this._remainingPacketData&&this._remainingPacketData.byteLength||0}_getPcrBase(e){let t=33554432*e[6]+131072*e[7]+512*e[8]+2*e[9]+(128&e[10])/128+this.timestamp_offset_;return t+4294967296>>3&3,r=(6&t[1])>>1,o=(240&t[2])>>>4,a=(12&t[2])>>>2,n=3!==(t[3]>>>6&3)?2:1,l=0,d=0;switch(s){case 0:l=Nh[a];break;case 2:l=Oh[a];break;case 3:l=Uh[a]}switch(r){case 1:o{this._clearAudioSourceBufferCheckTimeout(),this.player.emit(lt.webcodecsAudioInitTimeout)}),1e3)),void ea(e)):void(this.player.isPlayer()?(this.player.updateStats({dfps:!0}),this.player._times.videoStart||(this.player._times.videoStart=eo(),this.player.handlePlayToRenderTimes()),this.player.video.render({videoFrame:e,ts:e.timestamp}),this.player.handleRender()):this.player.isPlayback()&&(this.player.updateStats({dfps:!0}),pa(this.player.playbackPause)?(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this.player.playback.isUseFpsRender?this.player.video.pushData({videoFrame:e,ts:e.timestamp}):this.player.video.render$2({videoFrame:e,ts:e.timestamp})):this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this.player.playback.isUseFpsRender&&this.player.video.pushData({videoFrame:e,ts:e.timestamp})));ea(e)}handleError(e){this.player.debugError(this.TAG_NAME,"VideoDecoder handleError:",e.code,e);const t=e.toString();-1!==t.indexOf(os)?this.player.emitError(lt.webcodecsUnsupportedConfigurationError,t):-1!==t.indexOf(as)||-1!==t.indexOf(ns)||-1!==t.indexOf(ls)?this.player.emitError(lt.webcodecsDecodeError,t):-1!==t.indexOf(ds)&&this.player.emitError(lt.webcodecsH265NotSupport,t)}handleDecodeAudio(e){this.player&&(this.player.isDestroyedOrClosed()?this.player.debugWarn(this.TAG_NAME,"decodeVideo() player is destroyed"):this.player.isPlayer()?this.player.audio.play(e,e.timestamp):this.player.isPlayback())}handleErrorAudio(e){this.player.debugError(this.TAG_NAME,"AudioDecoder handleError:",e.code,e)}decodeVideo(e,t,i,s){if(this.player)if(this.player.isDestroyedOrClosed())this.player.debugWarn(this.TAG_NAME,"decodeVideo() player is destroyed");else if(this.hasInit)if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(this.isDecodeStateClosed())return void this.player.debugWarn(this.TAG_NAME,"VideoDecoder isDecodeStateClosed true");if(i&&0===e[1]){const t=15&e[0];let i={};if(t===yt){i=xn(e.slice(5))}else t===At&&(i=zn(e));const s=this.player.video.videoInfo;s&&s.width&&s.height&&i&&i.codecWidth&&i.codecHeight&&(i.codecWidth!==s.width||i.codecHeight!==s.height)&&(this.player.debugWarn(this.TAG_NAME,`decodeVideo: video width or height is changed,\n old width is ${s.width}, old height is ${s.height},\n new width is ${i.codecWidth}, new height is ${i.codecHeight},\n and emit change event`),this.isWidthOrHeightChanged=!0,this.player.emitError(lt.wcsWidthOrHeightChange,`width ${s.width}->${s.height} height ${i.codecWidth}->${i.codecHeight}`))}if(this.isWidthOrHeightChanged)return void this.player.debugWarn(this.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(ca(e))return void this.player.debugLog(this.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength<12)return void this.player.debugWarn(this.TAG_NAME,`decodeVideo and payload is too small , payload length is ${e.byteLength}`);let s=!1,r=(new Date).getTime();this.prevTimestamp||(this.prevTimestamp=r,s=!0);const o=r-this.prevTimestamp;this.decodeDiffTimestamp=o,o>500&&!s&&this.player.isPlayer()&&this.player.debugWarn(this.TAG_NAME,"decodeVideo diff time is ",o);const a=e.slice(5),n=new EncodedVideoChunk({data:a,timestamp:t,type:i?di:hi});this.player.emit(ot.timeUpdate,t);try{this.decoder.decode(n)}catch(e){this.player.debugError(this.TAG_NAME,"VideoDecoder",e);const t=e.toString();(-1!==t.indexOf(ss)||-1!==t.indexOf(rs))&&this.player.emitError(lt.webcodecsDecodeError,t)}this.prevTimestamp=(new Date).getTime()}else this.player.debugLog(this.TAG_NAME,"VideoDecoder first frame is not iFrame");else if(i&&e[1]===ys){const t=15&e[0];if(this.player.video.updateVideoInfo({encTypeCode:t}),t===At&&!wo()){const e=po();return this.player.debugWarn(this.TAG_NAME,"WebcodecsDecoder not support hevc decode",e.type,e.version),void this.player.emitError(lt.webcodecsH265NotSupport)}this.player._times.decodeStart||(this.player._times.decodeStart=eo());let i=null,s=null;const r=e.slice(5);if(t===yt?(s=xn(r),i={codec:s.codec,description:r}):t===At&&(s=Wn(r),i={codec:s.codec,description:r}),!i||i&&!i.codec||s&&0===s.codecWidth&&0===s.codecHeight)return this.player.debugWarn(this.TAG_NAME,"decodeVideo and webcodecs configure is",JSON.stringify(i)),void this.player.emitError(lt.webcodecsDecodeConfigureError,"configure or configure.code is null");i.codedHeight=s.codecHeight,i.codedWidth=s.codecWidth,this.isInitInfo||(this.player.debugLog(this.TAG_NAME,`updateVideoInfo: ${s.codecWidth},${s.codecHeight}`),this.player.video.updateVideoInfo({width:s.codecWidth,height:s.codecHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0),this.player.recorder&&this.player._opt.recordType===S&&this.player.recorder.initMetaData(e,t),this.player.video.bindMediaStream(),this.player.debugLog(this.TAG_NAME,`decoder.configure() and codec is ${i.codec}`);try{i.optimizeForLatency=!0,i.hardwareAcceleration="prefer-hardware",this.decoder.configure(i),this.hasInit=!0}catch(e){this.player.debugError(this.TAG_NAME,"configure error",e.code,e);const t=e.toString();-1!==t.indexOf(ds)?this.player.emitError(lt.webcodecsH265NotSupport,t):this.player.emitError(lt.webcodecsDecodeConfigureError,t)}}else this.player.debugWarn(this.TAG_NAME,`decodeVideo has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)}decodeAudio(e,t){if(this.player)if(this.player.isDestroyedOrClosed())this.player.debugWarn(this.TAG_NAME,"decodeAudio() player is destroyed");else if(this.hasAudioInit){if(Ir(e))return void this.player.debugLog(this.TAG_NAME,"decodeAudio and has already initialized and payload is aac codec packet so drop this frame");if(this._clearAudioNoDataCheckTimeout(),this.isDecodeFirstIIframe){if(this.isAudioDecodeStateClosed())return void this.player.debugWarn(this.TAG_NAME,"AudioDecoder isDecodeStateClosed true");const i=this.isAAC?e.slice(2):e.slice(1),s=i.length/this.player.audio.audioInfo.sampleRate*1e3,r=new EncodedAudioChunk({type:"key",data:i,timestamp:t,duration:parseInt(s,10)});try{this.decoderAudio.decode(r)}catch(e){this.player.debugError(this.TAG_NAME,"AudioDecoder",e),e.toString()}}}else{const t=e[0]>>4,i=e[0]>>1&1,s=t===Et,r=t===_t,o=t===St;let a="";a=r?i?16:8:0===i?8:16;const n={codec:"",numberOfChannels:"",sampleRate:""};let l=null;if(r||s){let t=null;if(Ir(e)){const i=e.slice(2);t=Nr(i),t&&(n.codec=t.originalCodec,n.numberOfChannels=t.channelCount,n.sampleRate=t.sampleRate),l=i,this.isAAC=r}else s&&(t=Wh(e),t&&(n.codec=br,n.numberOfChannels=t.channelCount,n.sampleRate=t.samplingRate))}else n.codec=o?Ar:yr,n.numberOfChannels=1,n.sampleRate=8e3;if(n.codec&&n.numberOfChannels&&n.sampleRate){this.isAudioInitInfo||(this.player.audio.updateAudioInfo({encTypeCode:t,channels:n.numberOfChannels,sampleRate:n.sampleRate,depth:a}),this.isAudioInitInfo=!0),this.player.recorder&&this.player._opt.recordType===S&&l&&this.player.recorder.initAudioAacExtraData(l),this.player.debugLog(this.TAG_NAME,`decoderAudio.configure() and codec is ${n.codec}`);try{this.decoderAudio.configure(n),this._clearAudioSourceBufferCheckTimeout(),this.hasAudioInit=!0,null===this.audioSourceNoDataCheckTimeout&&(this.audioSourceNoDataCheckTimeout=setTimeout((()=>{this._clearAudioNoDataCheckTimeout(),this.player.emit(lt.webcodecsAudioNoDataTimeout)}),1e3))}catch(e){this.player.debugError(this.TAG_NAME,"configure audio error",e.code,e),e.toString()}}}}_clearAudioSourceBufferCheckTimeout(){this.audioSourceBufferCheckTimeout&&(clearTimeout(this.audioSourceBufferCheckTimeout),this.audioSourceBufferCheckTimeout=null)}_clearAudioNoDataCheckTimeout(){this.audioSourceNoDataCheckTimeout&&(clearTimeout(this.audioSourceNoDataCheckTimeout),this.audioSourceNoDataCheckTimeout=null)}getDecodeDiffTimes(){return this.decodeDiffTimestamp}isDecodeStateClosed(){return"closed"===this.decoder.state}isDecodeStateConfigured(){return"configured"===this.decoder.state}isDecodeStateUnConfigured(){return"unconfigured"===this.decoder.state}isAudioDecodeStateClosed(){return"closed"===this.decoderAudio.state}isAudioDecodeStateConfigured(){return"configured"===this.decoderAudio.state}isAudioDecodeStateUnConfigured(){return"unconfigured"===this.decoderAudio.state}}const Hh={play:"播放",pause:"暂停",audio:"",mute:"",screenshot:"截图",loading:"",fullscreen:"全屏",fullscreenExit:"退出全屏",record:"录制",recordStop:"停止录制",narrow:"缩小",expand:"放大",ptz:"操作盘",ptzActive:"操作盘激活",zoom:"电子放大",zoomStop:"关闭电子放大",close:"关闭",performance:"性能面板",performanceActive:"性能面板激活",face:"人脸识别",faceActive:"人脸识别激活",object:"物品识别",objectActive:"物品识别激活",occlusion:"遮挡物检查",occlusionActive:"遮挡物检查激活",logSave:"保存日志"};var $h=Object.keys(Hh).reduce(((e,t)=>(e[t]=`\n \n ${Hh[t]?`${Hh[t]}`:""}\n`,e)),{});function Jh(e,t){let i=!1;return e.forEach((e=>{i||e.startTimestamp<=t&&e.endTimestamp>t&&(i=!0)})),i}function qh(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=e.length,r=t.length,o=Math.max(s,r),a=2e3,n=Math.ceil(o/a);let l=0,d=0;function h(){let r="",o="";for(let i=0;i\n ${i.title}\n \n `);const a=t[d];a&&(o+=`\n

${a.title}
\n `),d+=1}r&&i.$playbackTimeListOne.insertAdjacentHTML("beforeend",r),o&&i.$playbackTimeListSecond.insertAdjacentHTML("beforeend",o),l+=1,l0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<1440;s++){const r=s%60==0;let o=!1;i&&(o=Jh(e,No(i,s))),t.push({title:Uo(s),timestamp:s,dataType:"min",hasRecord:o,isStart:r})}return t}(e);qh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0})}return e}(),t)}function Yh(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<1440;s++){let r=60*s,o=r%1800==0,a=!1;i&&(a=Jh(e,jo(i,r))),t.push({title:Oo(r),timestamp:r,dataType:"second",hasRecord:a,isStart:o});let n=60*s+30;o=n%1800==0,i&&(a=Jh(e,jo(i,n))),t.push({title:Oo(n),timestamp:n,dataType:"second",hasRecord:a,isStart:o})}return t}(e);qh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00",s=t+":30";t<10&&(i="0"+i,s="0"+s),e.push({title:i,hour:t,min:0,second:0}),e.push({title:s,hour:t,min:30,second:0})}return e}(),t)}function Qh(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<144;s++)for(let r=0;r<60;r++){let o=10*r+600*s,a=o%600==0,n=!1;i&&(n=Jh(e,jo(i,o))),t.push({title:Oo(o),timestamp:o,dataType:"second",isStart:a,hasRecord:n})}return t}(e);qh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0});for(let s=1;s<6;s++){let r=s+"0";e.push({title:i.replace(":00",":"+r),hour:t,min:10*s,second:0})}}return e}(),t)}function Xh(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<288;s++)for(let r=0;r<60;r++){let o=5*r+300*s,a=o%300==0,n=!1;i&&(n=Jh(e,jo(i,o))),t.push({title:Oo(o),timestamp:o,dataType:"second",isStart:a,hasRecord:n})}return t}(e);qh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0}),e.push({title:i.replace(":00",":05"),hour:t,min:5,second:0});for(let s=1;s<6;s++){let r=s+"0",o=s+"5";e.push({title:i.replace(":00",":"+r),hour:t,min:10*s,second:0}),e.push({title:i.replace(":00",":"+o),hour:t,min:10*s+5,second:0})}}return e}(),t)}function Zh(e){const t=Math.floor(e/3600),i=Math.floor((e-3600*t)/60),s=Math.floor(e-3600*t-60*i);return(t>0?[t,i,s]:[i,s]).map((e=>e<10?`0${e}`:String(e))).join(":")}function ec(e,t,i){const s=e.$playbackProgress,{left:r}=s.getBoundingClientRect(),o=to((lo()?i.touches[0].clientX:i.pageX)-r,0,s.clientWidth),a=parseInt(o/s.clientWidth*t,10);return{second:a,time:Zh(a),width:o,percentage:to(o/s.clientWidth,0,1)}}function tc(e,t){return e.classList.add(t)}function ic(e,t){return t instanceof Element?e.appendChild(t):e.insertAdjacentHTML("beforeend",String(t)),e.lastElementChild||e.lastChild}function sc(e,t,i){return e&&e.style&&xo(t)&&(e.style[t]=i),e}function rc(e,t){return e.composedPath&&e.composedPath().indexOf(t)>-1}function oc(e){let t=!1;return e&&e.parentNode&&(e.parentNode.removeChild(e),t=!0),t}var ac=(e,t)=>{const{events:{proxy:i}}=e;let s=null,r=null,o=null,a=null;if(e._opt.listenWindowResizeAuoResize){s=document.createElement("object"),r=`jb-pro-object-${na()}`,s.setAttribute("aria-hidden","true"),s.setAttribute("tabindex",-1),s.setAttribute("id",r),s.type="text/html",s.data="about:blank",io(s,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"}),o=e.width,a=e.height;const t=vo((()=>{e.width===o&&e.height===a||(o=e.width,a=e.height,e.emit(ot.resize))}),500);i(s,"load",(()=>{i(s.contentDocument.defaultView,"resize",(()=>{t()}))})),e.$container.appendChild(s)}e.on(ot.destroy,(()=>{if(s)try{if(!oc(s)){const t=e.$container.querySelector(`#${r}`);t&&e.$container&&e.$container.removeChild(t)}}catch(e){}d&&(clearInterval(d),d=null),h=null,c=null,u=0,s=null,r=null,o=null,a=null})),e.on(ot.volumechange,(()=>{!function(e){if(0===e)io(t.$volumeOn,"display","none"),io(t.$volumeOff,"display","flex"),io(t.$volumeHandle,"top","48px");else if(t.$volumeHandle&&t.$volumePanel){const i=so(t.$volumePanel,"height")||60,s=so(t.$volumeHandle,"height"),r=i-(i-s)*e-s;io(t.$volumeHandle,"top",`${r}px`),io(t.$volumeOn,"display","flex"),io(t.$volumeOff,"display","none")}t.$volumePanelText&&(t.$volumePanelText.innerHTML=parseInt(100*e))}(e.volume)})),e.on(ot.loading,(i=>{io(t.$loading,"display",i?"flex":"none"),(pa(e._opt.backgroundLoadingShow)&&ua(i)||pa(i))&&io(t.$poster,"display","none"),i&&(io(t.$playBig,"display","none"),io(t.$tipsMessage,"display","none"),t.extendBtnList.forEach((e=>{e.createdMoment===Sr&&(e.$iconWrap&&io(e.$iconWrap,"display","flex"),e.$activeIconWrap&&io(e.$activeIconWrap,"display","none"))}))),i||e._opt.extendDomConfig.showAfterLoading&&t.$extendDom&&io(t.$extendDom,"display","block"),i||e.getRenderType()===H&&pa(e._opt.useMSE)&&n()})),e.on(ot.removeLoadingBgImage,(()=>{n()}));const n=()=>{t.$loadingBgImage&&t.$loadingBg&&t.$loadingBgImage.src&&(e.debugLog("Control","remove loading bg image"),t.$loadingBgImage.width=0,t.$loadingBgImage.height=0,t.$loadingBgImage.src="",io(t.$loadingBg,"display","none"))},l=t=>{Jo(t)===e.$container&&(e.fullscreen,f(),e._opt.androidMobileFullscreenRotate&&lo()&&(e.fullscreen?(e.$container.classList.add("jb-pro-fullscreen-android-rotate"),e.setRotate(270)):(e.$container.classList.remove("jb-pro-fullscreen-android-rotate"),e.setRotate(0)),p()))};let d=null,h=null,c=null,u=0;const p=()=>{h=e.rect,h.width=parseInt(h.width,10),h.height=parseInt(h.height,10),u=0,d=setInterval((()=>{const t=Cr.isFullscreen;c=e.rect,c.width=parseInt(c.width,10),c.height=parseInt(c.height,10);const i=screen.width,s=screen.height,r=c.width===h.width&&c.height===h.height,o=!t||i-c.width<10&&s-c.height<10;if(r&&o||u>=5)return d&&(clearInterval(d),d=null),void g((()=>{A()}));h=c,u++}),1e3)},f=i=>{if(pa(e.isPlaying()))return;let s=Do(i)?i:e.fullscreen;io(t.$fullscreenExit,"display",s?"flex":"none"),io(t.$fullscreen,"display",s?"none":"flex")},m=()=>e._opt.playType===_&&e._opt.playbackConfig.showControl,g=i=>{lo()&&t.$controls&&(e._opt.useWebFullScreen||e._opt.androidMobileFullscreenRotate)&&setTimeout((()=>{if(e.fullscreen){const i=m()?Qt:Yt;let s=e.height/2-e.width+i/2,r=e.height/2-i/2;if(t.$controls.style.transform=`translateX(${-s}px) translateY(-${r}px) rotate(-90deg)`,t.$zoomControls){const i=156,s=30,r=e.width/2+i/2-s/2;t.$zoomControls.style.transform=`translateX(${-r}px) translateY(${e.height/2}px) rotate(-90deg)`}if(t.$recording){const i=101,s=20,r=e.width/2+i/2-s/2;t.$recording.style.transform=`translateX(${-r}px) translateY(${e.height/2}px) rotate(-90deg)`}t.$ptzControl&&(t.$ptzControl.style.transform="rotate(-90deg)")}else t.$controls.style.transform="translateX(0) translateY(0) rotate(0)",t.$zoomControls&&(t.$zoomControls.style.transform="translateX(-50%) translateY(0) rotate(0)"),t.$recording&&(t.$recording.style.transform="translateX(-50%) translateY(0) rotate(0)"),t.$ptzControl&&(t.$ptzControl.style.transform="rotate(0)");i&&i()}),10)};try{Cr.on("change",l),e.events.destroys.push((()=>{Cr.off("change",l)}))}catch(e){}e.on(ot.webFullscreen,(e=>{lo()&&(f(e),g((()=>{A()})))})),e.on(ot.recording,(()=>{e.playing&&(io(t.$record,"display",e.recording?"none":"flex"),io(t.$recordStop,"display",e.recording?"flex":"none"),(e._opt.hasControl||e._opt.isShowRecordingUI)&&(io(t.$recording,"display",e.recording?"flex":"none"),pa(e.recording)&&t.$recordingTime&&(t.$recordingTime.innerHTML=Fo(0))))})),e.on(ot.recordingTimestamp,(e=>{t.$recordingTime&&(t.$recordingTime.innerHTML=Fo(e))})),e.on(ot.zooming,(()=>{e.playing&&(io(t.$zoom,"display",e.zooming?"none":"flex"),io(t.$zoomStop,"display",e.zooming?"flex":"none"),(e._opt.hasControl||e._opt.isShowZoomingUI)&&io(t.$zoomControls,"display",e.zooming?"flex":"none"))})),e.on(ot.playing,(e=>{y(e)}));const y=i=>{i||e.isPlayFailedAndPaused&&pa(e._opt.playFailedAndPausedShowPlayBtn)?(io(t.$play,"display","none"),io(t.$playBig,"display","none")):(io(t.$play,"display","flex"),io(t.$playBig,"display","block")),io(t.$pause,"display",i?"flex":"none"),io(t.$screenshot,"display",i?"flex":"none"),io(t.$record,"display",i?"flex":"none"),io(t.$qualityMenu,"display",i?"flex":"none"),io(t.$volume,"display",i?"flex":"none"),io(t.$ptz,"display",i?"flex":"none"),io(t.$zoom,"display",i?"flex":"none"),io(t.$scaleMenu,"display",i?"flex":"none"),io(t.$faceDetect,"display",i?"flex":"none"),io(t.$objectDetect,"display",i?"flex":"none"),io(t.$occlusionDetect,"display",i?"flex":"none"),io(t.$controlHtml,"display",i?"flex":"none"),e.isPlayback()&&io(t.$speedMenu,"display",i?"flex":"none"),f(),t.extendBtnList.forEach((e=>{e.createdMoment===Er&&(e.$iconWrap&&io(e.$iconWrap,"display",i?"flex":"none"),e.$activeIconWrap&&io(e.$activeIconWrap,"display","none"))})),e._opt.showPerformance?io(t.$performanceActive,"display",i?"flex":"none"):(io(t.$performance,"display",i?"flex":"none"),io(t.$performanceActive,"display","none")),io(t.$poster,"display","none"),io(t.$ptzActive,"display","none"),io(t.$recordStop,"display","none"),io(t.$zoomStop,"display","none"),io(t.$faceDetectActive,"display","none"),io(t.$objectDetectActive,"display","none"),i||(t.$speed&&(t.$speed.innerHTML=function(e){if(null==e||""===e)return"0 KB/s";let t=parseFloat(e);return t=t.toFixed(2),t+"KB/s"}("")),io(t.$zoomControls,"display","none"),io(t.$recording,"display","none"),t.$ptzControl&&t.$ptzControl.classList.remove("jb-pro-ptz-controls-show")),A(),i&&b()};e.on(ot.playbackPause,(e=>{y(!e)})),e.on(ot.kBps,(i=>{const s=function(e){if(null==e||""===e||0===parseFloat(e)||"NaN"===e)return"0 KB/s";const t=["KB/s","MB/s","GB/s","TB/s","PB/s","EB/s","ZB/s","YB/s"];let i=0;const s=parseFloat(e/8);i=Math.floor(Math.log(s)/Math.log(1024));let r=s/Math.pow(1024,i);return r=r.toFixed(2),r+(t[i]||t[0])}(i);t.kbpsShow=s,e._opt.showBandwidth&&(t.$speed&&(t.$speed.innerHTML=s),A())}));const A=()=>{if(m()&&e._opt.playbackConfig.controlType===Q.normal){let i=t.controlsInnerRect.width-t.controlsLeftRect.width-t.controlsRightRect.width-t.controlsPlaybackBtnsRect.width;lo()&&e.webFullscreen&&(i=t.controlsInnerRect.height-t.controlsLeftRect.height-t.controlsRightRect.height-t.controlsPlaybackBtnsRect.height),t.$playbackTimeInner.style.width=i+"px"}},b=()=>{if(!m()||e._opt.playbackConfig.controlType!==Q.normal)return;const i=t.$playbackCurrentTime.style.left;let s=parseInt(i,10);const r=t.controlsPlaybackTimeInner.width;s=s-r/2>0?parseInt(s-r/2,10):0,t.$playbackTimeInner.scrollLeft=s};if(m()){const i=()=>{if(m()){let i=0;const s=e.playback&&e.playback.playingTimestamp;if(s){const r=new Date(s),o=r.getHours(),a=r.getMinutes(),n=r.getSeconds();e.playback.is60Min?i=60*o+a:e.playback.is30Min?i=2*(60*o+a)+parseInt(n/30,10):e.playback.is10Min?i=6*(60*o+a)+parseInt(n/10,10):e.playback.is5Min?i=12*(60*o+a)+parseInt(n/5,10):e.playback.is1Min&&(i=60*(60*o+a)+parseInt(n,10)),t.$playbackCurrentTime.style.left=i+"px"}}},s=e=>{t.$playbackNarrow.classList.remove("disabled"),t.$playbackExpand.classList.remove("disabled"),e===Ei&&t.$playbackNarrow.classList.add("disabled"),e===ki&&t.$playbackExpand.classList.add("disabled")};e.on(ot.playbackTime,(s=>{if(e._opt.playbackConfig.controlType===Q.normal)t.$playbackCurrentTimeText&&(t.$playbackCurrentTimeText.innerText=go(s,"{h}:{i}:{s}")),i();else if(e._opt.playbackConfig.controlType===Q.simple){const i=(r=s,o=e.playback.totalDuration,to(r/o,0,1));t.$playbackProgressPlayed.style.width=100*i+"%",t.$playbackProgressIndicator.style.left=`calc(${100*i}% - 7px)`,t.$playbackProgressTime.innerText=`${Zh(s)} / ${Zh(e.playback.totalDuration)}`}var r,o})),e.on(ot.playbackPrecision,((r,o)=>{m()&&e._opt.playbackConfig.controlType===Q.normal&&(t.$playbackTimeScroll.classList.remove(Li.oneHour,Li.halfHour,Li.fiveMin,Li.tenMin),t.$playbackTimeScroll.classList.add(Li[r]),t.rafId&&(window.cancelAnimationFrame(t.rafId),t.rafId=null),t.changePercisitionInterval&&(clearTimeout(t.changePercisitionInterval),t.changePercisitionInterval=null),t.$playbackTimeListOne.innerHTML="",t.$playbackTimeListSecond.innerHTML="",t.changePercisitionInterval=setTimeout((()=>{switch(t.$playbackTimeListOne.innerHTML="",t.$playbackTimeListSecond.innerHTML="",r){case Ei:Kh(o,t);break;case wi:Yh(o,t);break;case Ti:Qh(o,t);break;case ki:Xh(o,t)}i(),e._opt.playbackConfig.showPrecisionBtn&&s(r),b()}),16))})),e.on(ot.resize,(()=>{g((()=>{A()}))})),e.on(ot.playbackTimeScroll,(()=>{b()})),A()}if(e._opt.operateBtns.quality&&e._opt.qualityConfig.length>0){e.on(ot.streamQualityChange,(e=>{i(e)}));const i=e=>{t.$qualityText.innerText=e,t.$qualityMenuItems.forEach((t=>{const i=t.dataset.quality;t.classList.remove("jb-pro-quality-menu-item-active"),i===e&&t.classList.add("jb-pro-quality-menu-item-active")}))};(()=>{const i=e._opt.qualityConfig||[];let s="";i.forEach((e=>{s+=`\n
${e}
\n `})),s&&(t.$qualityMenuList.insertAdjacentHTML("beforeend",s),Object.defineProperty(t,"$qualityMenuItems",{value:e.$container.querySelectorAll(".jb-pro-quality-menu-item")}))})(),e.streamQuality&&i(e.streamQuality)}if(e._opt.operateBtns.scale&&e._opt.scaleConfig.length>0){e.on(ot.viewResizeChange,(e=>{i(e)}));const i=i=>{const s=e._opt.scaleConfig[i];t.$scaleText.innerText=s,t.$scaleMenuItems.forEach((e=>{const t=e.dataset.scale;e.classList.remove("jb-pro-scale-menu-item-active"),Ao(t)===Ao(i)&&e.classList.add("jb-pro-scale-menu-item-active")}))};(()=>{const i=e._opt.scaleConfig||[];let s="";i.forEach(((e,t)=>{s+=`\n
${e}
\n `})),s&&(t.$scaleMenuList.insertAdjacentHTML("beforeend",s),Object.defineProperty(t,"$scaleMenuItems",{value:e.$container.querySelectorAll(".jb-pro-scale-menu-item")}))})(),i(e.scaleType)}if(e.isPlayback()&&e._opt.playbackConfig.showRateBtn&&e._opt.playbackConfig.rateConfig.length>0){e.on(ot.playbackRateChange,(e=>{i(e)}));const i=i=>{const s=e._opt.playbackConfig.rateConfig.find((e=>Ao(e.value)===Ao(i)));s&&(t.$speedText.innerText=s.label,t.$speedMenuItems.forEach((e=>{const t=e.dataset.speed;e.classList.remove("jb-pro-speed-menu-item-active"),Ao(t)===Ao(i)&&e.classList.add("jb-pro-speed-menu-item-active")})))};(()=>{const i=e._opt.playbackConfig.rateConfig;let s="";i.forEach(((e,t)=>{s+=`\n
${e.label}
\n `})),s&&(t.$speedMenuList.insertAdjacentHTML("beforeend",s),Object.defineProperty(t,"$speedMenuItems",{value:e.$container.querySelectorAll(".jb-pro-speed-menu-item")}))})();const s=e.playback?e.playback.playbackRate:1;i(s)}e.on(ot.stats,(function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e._opt.showPerformance){io(t.$performancePanel,"display","block"),t.$performancePanel.innerHTML="";const s=ao,r=ga(),o=e.getCpuLevel(),a=xo(o)&&-1!==o?`${$s[o]}`:"",n=e.video&&e.video.videoInfo||{},l=e.audio&&e.audio.audioInfo||{},d=e._times||{},h=e.getRenderType(),c=e.getCanvasRenderType(),u=e.getDecodeType(),p=e.getDemuxType(),f=e.getStreamType(),m=e.getAudioEngineType();let g=e.getRecordingDuration(),y=e.getRecordingByteLength();const A=e.isAudioPlaybackRateSpeed(),b=e.videoIframeIntervalTs;g=Fo(g),y=_o(y);const v=e.isPlayback()?"录播":"直播";let _=i.isDropping;const S=e._opt.useMSE&&e._opt.mseDecodeAudio,E=e.control?e.control.kbpsShow:"0 KB/s",w=e.getVideoPlaybackQuality(),T=e._serverInfo||"",k=`\n
\n 播放器版本 ${s}\n
\n ${T?`\n
\n 服务器信息 ${T}\n
\n `:""}\n ${e._opt.isMulti?`\n
\n UUid ${e._opt.debugUuid}\n
\n `:""}\n ${e.isInMulti()?`\n
\n 窗口下标 ${e._opt.multiIndex}\n
\n `:""}\n ${r?`\n
\n 内存大小限制 ${_o(r.jsHeapSizeLimit)}\n
\n
\n 可使用的内存 ${_o(r.totalJSHeapSize)}\n
\n
\n 已使用的内存 ${_o(r.usedJSHeapSize)}\n
\n `:""}\n ${a?`\n
\n CPU压力情况 ${a}\n
\n `:""}\n\n ${r&&r.usedJSHeapSize>r.totalJSHeapSize?'\n
\n 可能内存泄漏 是}\n
\n ':""}\n\n
\n 播放模式 ${v}\n
\n ${e.isPlayback()?`\n
\n 播放倍率 ${e.playback.rate}倍\n
\n
\n 播放模式 ${e.playback.isUseFpsRender?"固定FPS":"动态FPS"}\n
\n ${e.playback.isUseFpsRender?`\n
\n 固定FPS ${e.video.getStreamFps()}\n
\n `:""}\n `:""}\n
\n 解封装模式 ${M[p]}\n
\n
\n 解码模式 ${u}\n
\n
\n 渲染组件 ${h}\n
\n ${h===H?`\n
\n 渲染引擎 ${c}\n
\n `:""}\n
\n 网络请求组件 ${f}\n
\n
\n 视频格式 ${n.encType||"-"}\n
\n
\n 视频(宽x高) ${n.width||"-"}x${n.height||"-"}\n
\n ${e.isPlayer()?`\n
\n 视频GOP(ms) ${b||"-"}\n
\n `:""}\n
\n 音频格式 ${wt[l.encType]||"-"}\n
\n
\n 音频引擎 ${m||"-"}\n
\n
\n 音频通道 ${l.channels||"-"}\n
\n
\n 音频采样率 ${l.sampleRate||"-"}\n
\n ${e.isPlayer()?`\n
\n 播放器初始化(ms) ${d.playTimestamp}\n
\n
\n 开始请求地址(ms) ${d.streamTimestamp}\n
\n
\n 请求响应(ms) ${d.streamResponseTimestamp}\n
\n
\n 解封装(ms) ${d.demuxTimestamp}\n
\n
\n 解码(ms) ${d.decodeTimestamp}\n
\n
\n 页面开始渲染(ms) ${d.videoTimestamp}\n
\n
\n 初始化到页面渲染(ms) ${d.allTimestamp}\n
\n ${e.recording?`\n
\n 视频录制时间 ${g}\n
\n
\n 视频录制大小 ${y}\n
\n `:""}\n `:""}\n
\n 音频码率(bit) ${i.abps}\n
\n
\n 视频码率(bit) ${i.vbps}\n
\n
\n 视频帧率(fps) ${i.fps}\n
\n
\n 视频峰值帧率(fps) ${i.maxFps}\n
\n
\n 解码帧率(fps) ${i.dfps}\n
\n
\n 音频缓冲帧 ${i.audioBuffer}\n
\n
\n 音频缓冲时长(ms) ${i.audioBufferDelayTs}\n
\n ${e.isPlayer()?`\n
\n 视频待解码帧 ${i.demuxBuffer}\n
\n `:`\n
\n 缓存时长(ms) ${i.playbackCacheDataDuration}\n
\n
\n 视频待渲染帧 ${i.playbackVideoBuffer}\n
\n
\n 视频待解码帧 ${i.demuxBuffer}\n
\n
\n 音频待解码帧 ${i.audioDemuxBuffer}\n
\n `}\n
\n 待解封装数据(byte) ${i.streamBuffer}\n
\n ${e._opt.useMSE?`\n
\n MSE缓冲时长(ms) ${i.mseDelay}\n
\n
\n MSE待解码帧 ${i.msePendingBuffer}\n
\n
\n MSE缓存时长(s) ${i.mseStore}\n
\n
\n MSE解码时间(ms) ${i.mseTs}\n
\n
\n MSE播放模式 ${i.mseDecodePlaybackRate>1?"加速":"正常"}\n
\n `:""}\n ${e._opt.useWCS?`\n
\n WCS解码间隔(ms) ${i.wcsDecodeDiffTimes}\n
\n `:""}\n ${e.isOldHls()?`
\n HLS缓冲时长(ms) ${i.hlsDelay}\n
\n `:""}\n ${e.isUseHls265()?`
\n HLS缓冲时长(ms) ${i.hlsDelay}\n
\n
\n HLS待解码帧 ${i.hlsDemuxLength}\n
\n
\n HLS待解码视频帧 ${i.hlsDemuxVideoLength}\n
\n
\n HLS待解码音频帧 ${i.hlsDemuxAudioLength}\n
\n `:""}\n ${e.isPlayer()&&w?`\n
\n Video已渲染帧 ${w.renderedVideoFrames}\n
\n
\n Video已丢弃帧 ${w.droppedVideoFrames}\n
\n `:""}\n ${e.isPlayer()?`\n
\n 网络延迟(ms) ${i.netBuf}\n
\n
\n 缓冲时长(ms) ${i.buf}\n
\n
\n 最新缓冲时长(ms) ${i.pushLatestDelay}\n
\n `:""}\n ${e._opt.useMSE||e.isWebrtcH264()||e.isAliyunRtc()?`\n
\n video显示时间(s) ${i.videoCurrentTime}\n
\n
\n video间隔时间(s) ${i.videoCurrentTimeDiff}\n
\n
\n videoBuffer缓存时间(ms) ${i.mseVideoBufferDelayTime}\n
\n `:""}\n
\n 视频显示时间(ms) ${i.currentPts||i.ts}\n
\n ${e._opt.hasAudio&&e.isAudioNotMute()&&pa(S)?`\n
\n 音频显示时间(ms) ${i.audioTs}\n
\n ${e._opt.hasVideo?`\n
\n 音视频同步时间戳(ms) ${i.audioSyncVideo}\n
\n `:""}\n
\n 音频播放模式 ${A?"加速":"正常"}\n
\n `:""}\n
\n 视频解码时间(ms) ${i.dts}\n
\n ${e.isPlayer()?`\n
\n 解码前-解码后延迟(ms) ${i.delayTs}\n
\n
\n 总延迟(网络+解码)(ms) ${i.totalDelayTs}\n
\n `:""}\n ${e.isPlayer()&&i.isStreamTsMoreThanLocal?'
\n 是否超过一倍率推流 是\n
\n ':""}\n ${e.isPlayer()?`\n
\n 是否播放流畅 ${i.videoSmooth}\n
\n `:""}\n ${e.isPlayer()?`\n
\n 是否在丢帧 ${_}\n
\n `:""}\n
\n 网速 ${E}\n
\n
\n 播放时长(s) ${Fo(i.pTs)}\n
\n
\n `;t.$performancePanel.insertAdjacentHTML("beforeend",k)}else t.$performancePanel.innerHTML="",io(t.$performancePanel,"display","none")})),e.on(ot.togglePerformancePanel,(e=>{io(t.$performance,"display",e?"none":"flex"),io(t.$performanceActive,"display",e?"flex":"none")})),e.on(ot.faceDetectActive,(e=>{io(t.$faceDetect,"display",e?"none":"flex"),io(t.$faceDetectActive,"display",e?"flex":"none")})),e.on(ot.objectDetectActive,(e=>{io(t.$objectDetect,"display",e?"none":"flex"),io(t.$objectDetectActive,"display",e?"flex":"none")})),e.on(ot.occlusionDetectActive,(e=>{io(t.$occlusionDetect,"display",e?"none":"flex"),io(t.$occlusionDetectActive,"display",e?"flex":"none")}))};function nc(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var s=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===i&&s.firstChild?s.insertBefore(r,s.firstChild):s.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}nc('@-webkit-keyframes rotation{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes rotation{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@-webkit-keyframes magentaPulse{0%{background-color:#630030;-webkit-box-shadow:0 0 9px #333}50%{background-color:#a9014b;-webkit-box-shadow:0 0 18px #a9014b}to{background-color:#630030;-webkit-box-shadow:0 0 9px #333}}@keyframes magentaPulse{0%{background-color:#630030;-webkit-box-shadow:0 0 9px #333}50%{background-color:#a9014b;-webkit-box-shadow:0 0 18px #a9014b}to{background-color:#630030;-webkit-box-shadow:0 0 9px #333}}.jb-pro-container video::-webkit-media-controls{display:none!important}.jb-pro-container .jb-pro-icon{cursor:pointer;width:16px;height:16px;display:inline-block}.jb-pro-container .jb-pro-ptz-controls{position:absolute;width:156px;height:156px;visibility:hidden;opacity:0;border-radius:78px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE4BAMAAAA9UfJZAAAAMFBMVEUAAABHcEy0tLRZWVmysrKoqKi1tbWvr6+2traBgYG1tbWWlpa1tbW1tbVUVFS1tbVGCHqkAAAAD3RSTlMzAO9U3LSWySp3aZcVRDUDw823AAAJYUlEQVR42u3d32sbVxYH8EPHxgg/lBsa7SBkukmpSbwLI2KbEPpgZ5MQtwmM0wRMmgdhP6RgEuwlSVnYlmGMYaEvMU1KKX4QNq0pocVmm7CYfRBaQguFpbgPKRSC/4V2LGliO+bulWKrkvVrftyZ+WbxeTRG+nDnnnNmRjP3EpMR6tMH18du/0Xj1tGz5+9cf/DUlPKx5PsTkr8s3eZ1cX7ym1zkuI/f1wTFunN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zoc9dPpFx7ikHnIh7sjnHOPYTMj36oxjzDlO1UI9Xe9oUICb49iMDTBwzXCqFuKsG2gycM1wYtaFlrCK3mTgmuJU7UzkA9cUx2bDGjpFH2FucUk9pA57onGNa4lj31uhnJzEtA+ZexxLh3KpkykwL7g4D+GUuJuPe8Kx5RCuJtJbzBuuJ/hyMmCtecSx2aBzIqaNMK+4pBHwtU7WznnGiZwI9Oykq1U2tMWxxSD7hKL3MT84VQ/wwGbzpi8c+47fCsp2kt9g/nDsp6AyNqb1Mb+4pBFQKU7bpm8cS/DjQdg+aXT/wTWOzfLL8m2DfITJwLFFS/oZQHf7CecQpxq25GqnGO0nnEMcS2iSq13WWmCycKLaHZebDDeYPBz7mb8tz3aff8Rk4tiivJQd5H1MLo5NyNIN8t6cbJw6ZV2WYys6tTnHCZ2MsRM2k8nHSdG5srnBMTXNr/qzfcYLLmyucEyd8FdR7vNeNzZ3OJZc5G967mTKu7wvx4LDMfYFtz2efMYM/o7LL3OLY080byVlULNusqBx7AeDX3B9aJWH3P6aBY8rpUX+W3e2t3SXqeAZVzq0/JyLmRe7wt0fUs849t8Jzv/u8Ngq/+K8d42FhxODp/P8VQc85VPxjzc9folXHFO/1Lh1rc3BjT0S//SeycLGCd6Sxvm51abDp8xf4dyaNL1/gw+caBhLuvj6O6v36mWn5scEPe+H5hMn4uP3hUEAr63e6y+PYX//qflHY+U/fvCVzw/3ixPD98vSbV4X5ye/yfn+aP+4MvDpg+tjZ4+K8bKOnr1z/cFTU8rH/g92biFxn2S73AAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;transition:visibility .3s,opacity .3s;right:43px;bottom:135px}.jb-pro-container .jb-pro-ptz-controls.show-vertical{right:43px}.jb-pro-container .jb-pro-ptz-controls.show-vertical .jb-pro-ptz-btns{left:0;top:156px}.jb-pro-container .jb-pro-ptz-controls.show-level{right:163px}.jb-pro-container .jb-pro-ptz-controls.show-level .jb-pro-ptz-btns{min-height:156px;left:144px;top:0;display:flex;flex-direction:column;justify-content:center}.jb-pro-container .jb-pro-ptz-controls.jb-pro-ptz-controls-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-bg-active{visibility:hidden;opacity:0;width:156px;height:156px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE4CAMAAAD4oR9YAAAAM1BMVEX///////////////////////////9HcEz///////////////////////////////////85yRS0AAAAEXRSTlO5DCgVgZBxAK2fQDRkBR5XTPLKM/gAABnnSURBVHja7F0Jkqs6DGQPO9z/tD8Jq6WWbCCvIjKfzAGmulrW3ooedr6ui+M4TdP++SXPr1l/SdL3aRrHhv7ZyA5qb9xe0L3Am+DrkzeCL/BeX908MezTuPsfOArdgl3KsZuhq99fk/Tx3waum+ByAHua5QbYilkzY1aP728YhrH5InrfBa57OLAtVjpRbYaumex04dq4APeC7vnVSfo/45bXLe33jGscMx3f0A1vyg3t69e2dRL/NeA6wrgdcCvjyPM2U25mXDt9xVD3f/qN0yi3Mm6P20S54vlXtGPS/R3GPSbYOsC4ZAvmJtiaGiL3Zlzx/Ht+Y/KXTJXbqmaqe9za1VYn3N7YpX/OVGev2qduOLIiB7xqOzGuWCiXFVmWtU3368A5lkqeOJI21I5XXaORxVRnxmUTdNnY/4U3riNvHMJts9XRtdXVUttipdzrK/4x7UyY6sK4Gbo+nU21T1zKcd9AGJetlMvyLKvj3zXVfeqQElMljINx3MK4xVQ3xj2Ry7N/6CiMOIfYyVUXWxUyBx7HuZRbcHt9bf/Lb9zsHlzKzabauJaK47iVcC7jJujS33/joKkmxDnM4QiJ4xDjZuT+DXQW3jgxV012qcPuiePhCGfchlv1/P0D6Czmqmuq2gPGkbIS8Q4ZsNU3dGP3Y2+cW1RyKpkrbAnwqhi3iXHFHrU3bFVV5c3vBsCsOALjkXErAW85F3rjFvBm5Kos+TngCOXYG7fA1ojFER7GPUHbmer0tfGPANeROM6pjvDMQSkrsWQ1d564Fbr61964TvSqDa6O0ELmAtvGuc2rrpQrn/aa/qCpYq+6m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277h0bvgO24ty6RkQV5OtG5Pn0GIy19S8/OCeKofojlu47gjVT+4/EjZvdu9grnq1uVxAB1il1beEzRtBJJQICv1VMeKU93a0OzItbzq5k90RgLhl+XGCqy3ERdYrO0fftXnb2T3VqjfE5aigMbf3YANirN54co93XMjJT20rhWteP5Hrr/NbT+7xjoPMctOzJkqq6/Luk3u84+7vuGUBSzeBweoE3yPTm8Hm444LiA5gyMXuuJU56G3NR07uAXHVwwo5fgBTf1Xo2rjVnzq7r6yK1LwSr5HHHTdt9fy5k5/R7XLcJdX7FbeOy2dP7trPweQ57FRZx7r6+Mndq3ldEzrAY938ysl9uiQ1cJNVa2SO16X6tZP/dj8uDqJW2VfM/O/ftf7FmPkK3OMZ3MAu8G3T6ytiTTU7OK8jxMlfuN1idg/X91/9VUZ81WOVo8P+Bw+0DogP6NDPAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-up{transform:rotate(-90deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left{transform:rotate(180deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-down{transform:rotate(90deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left-up{transform:rotate(-135deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-right-up{transform:rotate(-45deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left-down{transform:rotate(135deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-right-down{transform:rotate(45deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-control{position:absolute;left:53px;top:53px;width:50px;height:50px;background:#fff;border-radius:50%;transition:left .3s,top .3s}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left{left:33px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-up{top:33px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right{left:73px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-down{top:73px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left-up{top:39px;left:39px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left-down{left:39px;top:67px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right-up{top:39px;left:67px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right-down{top:67px;left:67px}.jb-pro-container .jb-pro-ptz-icon{position:relative}.jb-pro-container .jb-pro-ptz-icon:hover .icon-title-tips{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-btns{display:block;position:absolute;left:0;top:156px;width:156px;box-sizing:border-box;padding:0 30px}.jb-pro-container .jb-pro-ptz-btns .jb-pro-ptz-btn{display:flex;justify-content:space-between}.jb-pro-container .jb-pro-ptz-expand .jb-pro-ptz-expand-icon{display:inline-block;width:28px;height:28px;cursor:pointer;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAANlBMVEVfX19fX19fX19fX19fX19fX19fX19HcExfX19fX19fX1/////Pz8+oqKjCwsKhoaHn5+eWlpaOqTaDAAAAC3RSTlP/3CaKxwJiAELtp4ri/s4AAACuSURBVCjPfZPREoUgCERXBdPRyv7/Z6/Z1aQp9oWJMyYLiKUrOIpAJBdGCldgbzBkPM/QEoTI3jBEPBRDhwEvChe08Q1Ge0ImvIq4Qj8ljrLdH77CyQPWlCdHC0Q1e9rmmuC+oQN9Q4LwcQg40L6eyqm0uEpXSUqe3fKpkkqL+Y/o+07SrahNEO0T0LBsvOitf4xsLqiNTB32wtqaVKosGLO2mhUrS93+PZ4D99wPqzMJVcbEyA8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-expand:hover .jb-pro-ptz-expand-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn////i4uLZ2dnIyMjExMS8vLy+iXNeAAAACnRSTlMAYomLxwEm9+NCLo6DKwAAALNJREFUKM99k9kWgyAMRIMmEMLm/39tKaVKFJkXl3sYJ4sAXeQ3ZOcYd0+gRYblFBuFLYoS2ot5lpvYn8zJQ65TO2GVNmdCmQq/qczw4gjpejD14BgmhziEIvCjVRlPioftHW6A7xBB1a8CCUMvsuSqEkPM7eZX6h8GrQ67bYpNIbRL6rb4/k2EfVXKsgmqfQrW9qnGq96a28jGQG1ky2HXpVysyYyeDIhWq7le6ua9P36HD6+2GRi8iBZBAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-narrow .jb-pro-ptz-narrow-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1/9/f2/v7/y8vLUObqxAAAADXRSTlMA3IrE6SZi9wI+y0gNXAn3CgAAAI5JREFUKM+Fk1kOwyAMBQ04bJHT3P+0JVUMNMWv8zvSk1cipfjAKXHwhR7k6KTjYp7dVuWLug1XWB5wz96T/JD2O3Phmv0k5ypL6lVVFIPYpLOka5WKSSFvS0/BloHYlkza5HkMzrvVLo8ZlRr7mtFYWBBsBQ4BjC//GTxcGVw2PpOVHQ6fJj7qS4936OoN2K4e5yE6N1UAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-narrow:hover .jb-pro-ptz-narrow-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcBAMAAACAI8KnAAAAJ1BMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn+/v7X19ckk9ihAAAACnRSTlMA9+NCAsuKJsRiPv/2GwAAAJlJREFUGNNjYAAC5gxFoTYDBijw1FoFBIumQHjsUavAYGkBmGu0CgqUwRqlYNyFIO2Fq+BAnIGBJQrBXerAwLkKCUxgYELmKjBYIXMXM2Qhc5cxdCFzVzBoIXMXMYAcsRsMdgEdgs4FKT4DBqdAitGMQrMIzRkojlRB9wKaB9G8z+CMGjgshjCuMCjoWNxRAxYt2KGRYgJiAQAnZcjElaB/xwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-aperture-far .jb-pro-ptz-aperture-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAASFBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////9fX1+kpKRzc3ODg4PFxcW1tbXW1tbk5OT29vaVlZVmZmZ8vCMFAAAADHRSTlMAxGJ5Mssm9+NCiYtiH91SAAABAklEQVQoz41T7Q6DIAyEJQooUL55/zddhVazzZjdHyqXXo8DhWCYTWqltNyN+MZLuxP69UGti/vAsl6c0e4L+tQ2yv1AEbvecMhO5cXdYhk+6aO3WGrNAMwentlMz/ZAKIlNoRsqY2wtFWu9t8wasc0iYVN0LkQfrG1zbxNyrIBcntOQrH1Ukkb60QcxYF1xMA2dh8zWj6ZDsLCsIrL4Ds5Hm9FMbCEROWUB0COaLXEIZJKV7CKybGO7UuxjxY2C/TkMbxboKBQCxgMN6MCJQ6Ch/QjOZg/B13LGx8FDTe3IFvl+Bc9XBi3UWoex68qeL/vxmdyxyvz3NJ8f9dDef36HN7koIK2LjxB0AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-aperture-far:hover .jb-pro-ptz-aperture-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAOVBMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn+/v6cnJzr6+u/v7+xsbGlpaXNzc3b29vqh7uRAAAAC3RSTlMAyRjKA59J/3PzPhe1wxwAAAD2SURBVCjPjZPrssMgCIR1mkYtisD7P+zBCyZpM5mzv5hs0M8VnZvaok9BlXzc3FXbO5z0vtifFC5Kn8OL4UfxwVvuHm61d5Z0b6ZGZZwZpQAUosWsjVZntVS1sH3ZFo1IRVYfGXgx+VGwNkkIVbhq9/jm3cAhaNv1Uk3IA8mNn7D3kbQeWK3TLH2jCthrDFcTMwUWaKiClc9mJtJWhS3SF5BpJqMQW1b3xwnkDahMoHYomkeJRgSENA/MFsKML7fgoCBVbGvM+Cx4JcKWbWHKK/h1ZYS1Jy/nK3u8bB3KhzG5deMxtfv3aO7/Heq+9ms8h9fxHP4AHzAWU9zlWNgAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-aperture-near .jb-pro-ptz-aperture-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAQlBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////9fX1+FhYWbm5vz8/Nzc3OwsLDi4uLDw8PW1tZmZmYgm6a+AAAAC3RSTlMAYmOLx4kn9+NCIVJiPGAAAAD+SURBVCjPjVPttoMgDMOJAqOU8uH7v+qKFN2c597lF5LTJg1VqQG3aGuM1bNTV0wWDtjpg3pq+IB+npyzcIE9ejsDXzDCrjccs+tOariF3n2OLyw5xko0vh9MDjNb9Q0hp2GK3cixlIApe4/JD9appR8SFxWAUFLg6n63iB1irnY1Jv0mlrok7nUdcZRa1YeshxBA9iijChlxI6iZEaBgSEL2tkRcymPGGJpqlbZ6uDg0WR/F0DwuMpxDkYwiIXA8hO2uMJdGCCK6teB8RQoY8xGfevQjxYQt25qoRwDT25MRBjZ7GtP/P/afa3LHmrflXa+ruf661Hvv+et3eAF6Fh3v+sSUGgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-aperture-near:hover .jb-pro-ptz-aperture-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEWZmZmZmZmZmZmZmZmZmZmZmZmZmZlHcEyZmZmZmZn///+qqqq9vb3z8/PMzMzo6Oja2tpXGg+mAAAACnRSTlP/JomLxwJiAONCr+rW2wAAAOtJREFUKM99U9sWhCAInEpLBS///7WLEWy7p9O8qEzCMBIOQ15DAlLYsoegS9yFMKQ93skl4Adh+ZI54Q8pG5nxgKzkgkcsk4zhmQxRyN1OPHqtncjOu5AuppcJ6s1EHTA1YzC3Wgq3YmzGqpsmlwZAo7F8oLEVKoeE6+TbSxK0JJ/3FLOwFnUxzXuoltYDDMLoAlmYXLAWIrkqbdZKs+q4KBfkNV1uwGaBim9TdLWS3R7iGRvCNTPB7JvGlc5EXK8cKbrxooint73RzXh7Msl6Oj/uT/b62O9j8sj6gMXX0Xwf6jP3Zr9DtNAHTYMMXrXSK0YAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-focus-far .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAPFBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////92dnbs7OyFhYWjo6Pe3t7Ly8uxsbG8vLyG+Q0EAAAAC3RSTlMAiWJjx9wm/0Lti7mfpe0AAADaSURBVCjPfVMJDoQgDERFC/bg8P9/XUSO6CqTqA0TptNDpSrMpC2A1btRT8wrNKzzjdo03KC3zhkLD9imbeAFhd3sG2kvZQ2v0NknfGBJZKkhBM9MxOxDKBV1N4iHi0TRHYjN01Qi7/kK2PtyNDU7DAEJgDAAN0u1jsQEFEkcVVmrqjeXrkWRmC67eqbgG7bJyvkQSQkvUvec7szpek6t9ubWJSK/uJVSm+APzHKCh++DWWuH4plQKNYOpfappcjy2VvJn9744cjGwx6uyXjBxqs5Xuqsvf/9Dj8rLhRg+bQ5VAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-focus-far:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAOVBMVEWZmZmZmZmZmZmZmZmZmZmZmZmZmZlHcEyZmZmZmZmZmZn///+xsbGoqKjt7e309PTExMTQ0NDe3t774OlGAAAAC3RSTlP/itxixwImAELtp8B2gZgAAADmSURBVCjPjZMLjsUgCEVpq60G8Lf/xQ62gvNeOmZuUiWeKHC1cKnC5iJAdFuwJXgmf+xg2g//G54OPuTOCUOEL8WgMMCLwgPP+Abj2aF38CrnBR7whw6Bo4fWUk7MMrQ2OrpAq0GspTLLgKg1wTailNITZA0EaTkZGjIAY5NwlATah5CGRMJYj50tFtlWiapsLvAPRdtL/WOmET7QzZyl5ywzp7NWsjBJ1odsragJqeJ9HGFNZoLaJw71hMTm0O7NeDE1Z6YsU5rGL69sedmXXz0ToW8PzA/oV09T8OJR32fb7+B17Qe3WwtC9PVbHAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-focus-near .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAARVBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1/////t7e2dnZ3W1tbGxsa3t7eDg4Oqqqri4uKTk5NImu/5AAAADXRSTlMAYieJ3MvE/0Lti4oh87zNagAAAOtJREFUKM+NU1sOwyAMY30FtoWS8Lj/UZe2gWpVh2aJH1wcO0mNqbDj4gDc8rLmiscEDdPji3rP8IX5fXLWwQWuaVu4gbKDuyPdsJMz3GLefcIPbJ6PDCEAFDlUAJiORM3NigQFAXAFlqOeRhWJyFFIHxNGvRrN0mp470U++3axGM2RAmXcXqKnkDSN0a9WIk5Sa01MpDXBQAdVtrA8lBhFnnKpsmoo5VBrhszV0KuJ5N2tP92O50iQjpzcctravoihdoi0Q1NrfN56m0VWzFBoje+OrD/s7pr0F0yUr6s5/LvUu/bz+B2ep+IHdMIV2SUZfCsAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-focus-near:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAQlBMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn////c3Nz09PTp6enR0dHFxcW7u7uwsLAUKT0cAAAADXRSTlMA3IrE6WIm9wI+y0gNQZpqdwAAAOdJREFUKM99U9GShCAMQ8BF3Cmlpfz/r15dAe88l8zwQiQkoRrTEa3zIXhno7lhWxcYWNbtN/fa4Q/218VFDzf4of0O8A/h3TQfOGU/ytsOj9gPVyt8warkmYEQQAgABYDxTKROz88koS6AVIB1fRCNbSI1cVUy15Jq27LGjTtyzipPeWw40/IXQkrHyZSRmqw3LaQgctFNKYzYyGACfEXossLMojFEj7J0WfdwJ3dD9uY2X25tL0Hj45mTR87Y66u9IQFsDS1bL57o7JbUDNIofvpk08eej8kTe3Hz0ZwP9UFfv8OgfgBUByCEUZhYtAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-cruise-play .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJWSURBVHgBtZe/b9pAFMefbSYWMjCjdOtmYEYqXVC3umMlBFRiT7qxkexITcdKSDUSYna2iqX+E/DG6LCQgcETUiR+5Pv8I3Kc+McF5ysZ3x2++9x79/zuLFEG9Xq9s/1+r8my/AnVJq4z/2LZfB0Oh1tFUQxd1+208aQ0GAa7kCTpMgRJk4kJXk+nU5NEoe12W8PM/wrAotIx2Z+w3MkE7XQ6Q3S4otNlY5zPUZdL7wiMBUsRIK/fDeWvhQ92XS0HrQia83cCsqoIyMug8gQ9Ho/DpF7FYpEajQa9VTBoyIZxWeEfv6IndSqVSjQYDKhcLtNqtaLtdkuigmGSZVn/XKiqqr9wqyZ1YEtbrRZVKhX3zvX1ei0Eh7Ufa7Xan8C9VRIUg9lyQZfzO19VOOugkBpAgaXRtnq97oLZ5ZvNJm0YQkBZ8m63E7YyKl5ntrrf77vlJCF/qzLlKLZ4NBqRpmmuF2LBlLOyBFYBchDKlIeWyyWNx+PUtS2Qtx+eJA6i2WzmQtMEA+8KnA+73a6N+jkJil1pGAbN5/PMfRBIZsGn3+LFvSABMYiBgpnJgZEeFHQD4EzQrOsWI4N/nrY2uPg/eeefV8WvAKfALOsWJ3jzA++rcqjhB25OXAd244nA62AjV4LGxWLhIBk/oPiF8pc9mUy+BZVnyQEzueEZUb5yjyvhBiX6BCw2YTGvdZNyAkYPZsprT/rgO/K2vDcdQQH7jes7gPcv/kvqyCcKbEVX6PxVAG76QWPGPZAIDcEZqGECTQyokpe9wp8VfNqzyA2L9M+KRzm19l1i6ZQBAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-cruise-play:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJ5SURBVHgBtZe7buJAFIYPjsVFAok3wBUlYcUDLNvQISUSDVVCA0IUYZ8gmzcgBeIiJLwdFau8QToaQKygovI20CJBARKX/Y/jICPAF3B+yRpjZvzNOWfOzLGLLKrZbAaXy+WdKIq32+1WcrlcQe0vZb1e/8XvQT6ff7fyLpdZh0qlEr+5uXne7XZxMpciCIKMSfzGBBSyCwVMAqxpEXYEhzdeAJYtQ2u12h2aJq4gXadSLpf7aQptNBoPm81GJofEsc5ms9/0zwT9j3K5HHUSyEJ4ovV6vXkSyjHEyvxDXyCAHxGy4hEUq+4JjWQ02O/30xV65rTbQ9lKNEWjEYFAgFKpFMViMbpQnOfFPRSKWxnldrtVaDqdpnA4THalefMDinx8sDOYrY7H45RIJOy6PMibjch3F24AJEmSeo3HY+p2u7RYLEzHwNqogOUcpSvFrk4mk5Zcjry9FZCX1+46qj5dzvEOhUKGfQVyWAyPRCLqojsnEYtohpiSE5rP59TpdEhRFMN+Itw7Q3DpGq1WKxqNRurF90YC75+gnXszulBsVbvdpl6vZwpkwasDNWVw9r3BWlu5Op1OVdBkMrEzTD11RO1exmUJytb0+30aDodkV7DyjT2rBpNrG8zg3WwQW9ZqtS4CatASt/sVhAC/GA3glWk1bqcEo+TPwm0P5QeYySt9jRS9UQe54vF4fqEZkMNCdXivrw4PoJlMZoad5IeDYE7F+0KhcPC+syVotVotIQ5PdLm4CD8CGkJZfAIhzlw3SWRdM+T9q9frLbHnTnUwrfBZfPCiecQG8v3MBHj/HvAm4/P55HMwW1C9tG8a/RmsGH1CnNJ/17UakVMOx7kAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-cruise-pause .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHySURBVHgBxZc7bsJAEIbHdprQJAU1ckln3FM4J4jTIkSMRB9uQDhBlBPECIk2yQ1MSeeIxg0KZQoKKpSCR/4xtsXTNmA7v2ThHe/ut7M7O7sIFEOGYdzO5/OSJEn3KGp4ZDy33ucxP6vVqo86H71ez47qT4iCLZfLJ0EQmhuQKNlo89rtdk06FVqtVjV49kZrr86RicG2TdMcx4LWarUWGjzT5Rqjn7tdsJAi8Ch4C4op1TGl75S8GKwCPOWC6FsRNDKAL5SOZER30HcAhbFFEUFTLBapXC5v2fL5/J7tiOCXofHLlVfikRhRrSqVChUKBXIchyaTiWtrNBruYLjM9jB5jlmup4vFQqMYyuVydKE03vsuVBTFR8pIcFD317REGQlRXBJ5PSl+iktCskgZC57eZA5l/Q/Uy4lTykjYq1++p5EHb1LC9rRdKA7dT8pO64yERG/SmVM8m81OqW7yckr8Ztv2r6Io1whnLawF59fhcLiVY0ejkWsfDAYUJfRfB+snOE85J2KRvym9RGF2Op06vwRbhg9YHgmlIz7E235B2vwC1x1VVdl7jZLT3nVF2q0BsJUg+ODFTDpU0wP3PfC5a2wB+BD7CuqLgws/TQQYn7cyxYfxfdc6ViEUujMAHUlER4cKHfhbATvPjBUG8/UH1xXJDxHoYGQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-cruise-pause:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAH/SURBVHgBxVY7bsJAEJ01CAkJKUhUULmiDSnpoKYINyBuQIgi3AA4QZQKIQq4QaChhhuQCxAXSERUSDSIb944axSS+CPA5kn27o7X+2Z2dz6CXKDT6URXq1UqGAw+Hg6HDB4V4qj8rAsh9N1uN9rv971KpTJ2Wk84kW2322csVv1BYr+gEGMo8Foul7uWc6w+NJvNjKIoHXRVOgMg74K8AXLdFWm73a7BujpdDh3rZH8TCw8JLYlPSFutVh7NG10feigUetA0bcEDxZTiDFU0L+QN1M1mc1z7SBoIBGrkcGkSiQQlk8kTWSQS+SP7D3CzJ76c3A/yi61kodOP6XSaYrEYzWYzWi6XhiybzVI8HjfGLLeDNGxoWpohF8C50CXgwMK+r0gNCuQTENnyitQgRT4BQSOlyFvrKsRdCapC/uPuFqR0G1IZExfkH94NSzkHkk+Ap4wNUiTqPvmH74gUDoe7dOYWr9dr13M5sfNxBnjQ7/dXuVwuDGHG7ieOr9Pp9CTGzudzQz6ZTMgJ2FFtMBh8HvMpx0Ro/UEeBQq2slgsatw/uoxMsBp5A64WG+bgxE9LpVIPpUWDrgv7csUE4nEdlWCNPCC0JJXEF5Wg8MchHs11CWpCVvZVkBfckksyrneHVnMEuQRXitiqPBS4lwpEJYmORkc7Qju0IzPxBZ2t+3mW/JtqAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-fog-open .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAKgSURBVHgBtZe/jtpAEMYH28WJioIa+URDF8MTkAalO6cH4YIiFbk8QXS8QO6oUlCAkGjDtTRHJBoa4nQ0KBZdJApoEAV/Mp9jkAF7bXPcJ5ndtdf725nZWdYxiijDMBKr1SqhKIqKNpdms9mcRxkjFqZTsVjMy7J8x1WdL9WjC6D97Xb73G63m0HjxULAvnI1T+FlMfxBBPeEwoW73Q6we7pcViwWe8+utwKhDFQZ+IOrGr1eAH9ksOkLdSz8Rd5xu1RzBmfdFkvupwz8dmUgBENeYNAZtFQqGVwY9DZSnTVi6+Decrn8h0JYWSgUKJfLHdrL5ZKm0ykNBgOazWbCd9nNt3CzgoZjpUohlEqlKJPJHN3DJHRdp16vR51Ox/ddTiVkw70NlSTp7rRDMpmkWq1G4/HYvmANSpHghXg8To1Gw/M5W1oGVEZD07TvXNy4O8Btw+GQFouFbV06nabRaGRbhbaf8AzvTiYTr8c32Wz2p8KrSuMgJ7x6IEa4AIuivau9tNlsNGm9XqsBY9gxhOvCCi728wa7OCHhRzQAZl2pVGyXRZEoBAoFCDGs1+v2QooiUfpIHE+LBEL+VatVezVfDcp/whYJhAWBVHFvCEFCfz8op6cpORuxJRokajz98tSRae+97OJnUS/RanQLkwNQ4FrzsA2yyU0Gf/br2e12A90LlwYAkS5Pdrm/wRs+/rh1ChAshuV7wTqAQoTAarVat6gorll8YWvzXBXmbdTUcY3/sK/L+4ppmnPeF/9SCGsvAXIsH8+gDthkMFyepyuJgS0GHh3w5NNOzO0zeMHVD/R64BMDP53d93vBORW+0GVnpvmpS0NBXXDDSacwR9K5kxaPok+NUJ8VDlzlQucJvKNj63G2/U3/E78fZqx/rk0w4ggu8jUAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-fog-open:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAK2SURBVHgBtVa9jtpAEB58/EqArqCBBqehorgTVDQxPVJOiD5QAEJUeYLjniBcgRACKeQJQsQDBBoqkIigookraC1BwT+ZcQBBsNd7Ovgk2LV3vd/M7PyZgBPlclnc7XZPFovFv91uRZPJdL9fktfr9W987udyuRbPWSajDUgm3d3dPSOhBMaQUaAXu93eSKVSCryVtFQqPaBWXznJNMlR8zo3aa1W+7zZbIo4vYd3QBCEQjqdfjEkrVarzyhlAa4EvOt6JpNJ6ZJWKpUnHH7A9VHMZrNfLkjJO9Ecv3Aqwg2A1osevFs4vCQP5SF0Op3g9XrPflar1egzut9vCNVHzPS3j8EkcCAcDkMgELh4PxqNoNvtwmw20/tUXC6XSRyLqqZ7LS80CgaDqiY8IEESiQSIoqi7B53qE40qqVYsolTgdrshEokAeh9IkgRGIDPTPhJYC8SD4eg3k52RQNQi7XQ66txms+kepEUcjUah2Wxqrq9Wq6h5Pp8/4CUzD1osFuqPFwfnIsE1IBKbyDqANIzFYhCPx+EtYPmCGQxAppJlGQaDAVwLaFlBgRtAx7T/SNGNZWCg1WqpoeP3+4EX0+kUJpOJNiEqKWA49HGusA6gwPd4PMCLXq+nu4bpsK+6LVV9YMDlcqnkPKD7JyF1oFD+PSSHV9ZB4/EYQqEQGGE4HEK73dZdR+Ua6nh4gWXtD3AkfCL3+XzHZ4pfyrekIQnHApr2A2oqn4YM1TvDWkr3xbozPVAxJ0KaH1MRFllSvQG3gYztz7FtOct/mLqorZDhulD2BVzWJKW2kTZckVjBnviM8IKUQBtQ40ck/w7vAIUhnvGYz+cvwpHZbGNHkcQMwtXGnICs9YrCF/Q2GHb4e3IJBxLgo44ACsY6afbT4XDUWd09N+kpqOhTDT55Jf9/Z0b4C/UJLQCcLGi1AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-fog-close .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIjSURBVHgBtZe9UsJAEMc3l1Q0WvAA2NEp1MyInVbGnoE8AVrSqW+gT2CY4QGwpTEFNcaOEqksKKiYcYYP/xsSJoRwx8f5n7nRu9u73+7lbu8waAc5jnM6m81sIcQlqhcoOZTTsHvAZT6fv5um2XZdd6Caz1DBMNm9YRgPMYhKHhx8brVaHu0LrVQqNjx/2wOWlAtnn9MiT4VWq9VHDHii4zXAPFdJsPGPwK1gIwHk7/dC+sXgAsBjroioFZsmpznCuHKLxeIxqqwirdVqvGmcbaOy2SyVSqW1tuFwGJTRaES7CEGd8TJbXOEo4YkjG8BQ27ZT+7rdLrXbbSUcx4+P3oOIVQ4Wr0Cj0aBMJiO1Q6Q1PvsirFzSkeKVqNfrKjM+8xeCybRMbUcrn88HRSasqs2R5kijisWitB+reiKm0+mhaS5VvMwqCdIs1WYKoJZljUmj+NwqobS8D7Wp1+tJ+5EPvkWYD33SIE4S/X5faoOHgCdC+jsdKc5GnJUUGiNIzwrpbjwh76tOpxMAJ5OJyjTwKp7wP/CnvM06LeFzdPwNd4AFihL+Chom/U86/HmiAr4CGOR4M2r0fX9cKBR+8e816deg2WzeRJW15ABPXvgxRXoVPFfiDWbSAhF7iJiXvUyagMmHmZlmGYK/aXn7HPSNAWui3AH4s9EnG8ibiy94DL6l3W8jL3zvetsMpNCEAw4cKGPCc9r8WeGj/YuBMlikP+yn3EGZYjlWAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-fog-close:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAI5SURBVHgBxZZLjtpAEIbLjUFih8QFnBUrJCIOEHOCROIACStALBhOMMwJMlkgBCyYnCDMCUJWrJCQYB+zBwkJFiBe+QvZyEz86IEezSc1dj/w76pyV5dGEnS73cR6vf4SiUQ+HY9HE0MJu5GmaSNcFrvd7hn3vXK5bIU9TwsTw8Oqh8PhzhGRoIf1tSBxX9F2u12FVfVXiL3ksVgs1khWtNVqfcfljm7HgtW5l1Zrbyh4Fo7FYh8LhcLCGRDu2U6nc69YkDG22+0v98DZ0mazaQgh/tLbUUOMHy9E8eH8treDJ8lkkgzDuBibz+c0m81otVqRBAu4+QO7WecerDSDBB3RbDbrOTcej2kwGFAIvNc5dPVTTLHpv9INpNNpyufzBEsC1yF81dOVf8KslCHIEy4SjUYjIxDLDDoGKYAtDrNW13VT7Pf7azOOJ6lUKnAeySLB7jVIIezmMAS9A/igxIIUwns3VBQ+HpFCLMsKnGcjhX0CKLF2MpnQcrkMXIPzuX+KKax9phthtw6Hw7BlVqVSGel25wntqqy02WxOFnLj+xB6/HNTwmdXTqdTGTHmfKA7lhKSxAOCbPr9g90n82X6AcGfTgVxUTngtKlD+J4UAw/2S6VSzulfJAe8SZ3fiNRiQbTgHvgvI0H4Gxb9IAVwTexVmHmmQbiCD1suHy26En7xaDSa86p/A4ttrpuIT3ohpLcTxw/tAWJ9vzUaSWCLm3DXZzS+z7hELFzYjX/i8fiTu9T04x9LgQk+PbvDKQAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-wiper-open .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAALxSURBVHgBtVYrrBpBFJ0FFAqBqCIrUXRBk5QaUleewBBIlwSDoW1CUlzz0CSlaJJHA8FgqMBg4CWIKkpRuEfQCDAYAvSeYYfsLgss6fYkk5ndmXvP/c1HYjaQTqdjbrf7PQ0VarLWgBW1Cdput3tutVrdW7qka5OZTEZ1uVwfaBhj9jDf7/ePzWazwe4hVFVVPhwOT3cQnRFLkvS20WjMzRMuCzKFyH7/AxkAg18oQp/ME24LsgENfcwBkJfvQqHQejqd/jr905HJGpnMHIYW3iHGp5AS2df/QabpfiKHfCdCVCN1qh1hv9/PIpEIi0ajLBgMskAgcDZfKBTMYjJVL8+nh7MeS/8ioFiQbDYbtlgseA/lXq+Xt9lsxrrdLkulUmw8Hp/poLB+JC+rkpa7FysiKEokEpyo3+/zBiIrr2EU1kKmWCxariMvsy46IRJWZFBSLpf5GApgvZUSYLlcstFoxMfwHnKQN4Mi+cYdDoe/IGpmslKpxJV0Oh223W7ZLcTjcb6uVqtxLxFayJtkfSga2Sycy+X4YnhlBzAQhGI9euTRqnhAaNjkKA5Unl0yALlD0SC0Au12m/fIvx5nRxsEYV2lUrHMgxmiYMwGwmiE1qzDrSiKSv0r8QMxF2Wdz+fZer3mhXAJCP9gMOCGAiBJJpM8h6jqXq9nWO+hLfGH9ohiVoTFIEbxwFqECMoQInwLy4V3mEMe0SB7YWtMJJzoVK7fLnkgKg65BVBM8Bj5gjHwDORoGNfrdUMu9SDnfl7d+HqAEArFCYNQYoxtAODfJSIBimTWpV2Swxt8PLwiRAgjGrwXuEVGmBNXw6MxP5KXMWYTCKs4U+2COH6g59tCu6uG7A7AYxteCcypVU+EmgVZbcJxkO4HcmplIEQuMcGOTz8nyT6T7on4Npw0mMBzgDnkqUZWNfyzWujQM/FB79lVQh2xeudbZ0VE36mvipzdRagjjtFtnSBlr9nxuS9uGCidk1HPdFp1xcvsGv4CcbeEIeSIw9MAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-wiper-open:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAM0SURBVHgBtVa/SyNREJ7dBLVQELU4bdwrtFJOUCxsXEG0Ue4OK6tLKhEb/QsO/4LzChVtvGvE0sPOxtiYJuFyJBBICtOlSSAQCEnIj5tvyC676ybZYPLB4y373ptv5puZt6uQB1xeXup+v/9zs9lc4qHxK621VFAUJYbRaDSeDw4O7rvZUroQBXw+3zcm0ckbMkx8enh4+It6IWQijYlueiByI95g4oxzQXW+OD8/X1JV9e87yACNbbxeXV0dOxcUJxnn6okfx6l/OOHcnr0hhIzsFcg06jNa8obwbErKOfs+CDIhUdUbxrhJiGrknAW8HB4bGyNN02h+fp6mp6dpcnLStj46OkpbW1vOY1q5XJZ8iqTX19dPnYpkZmZGSObm5qharVI+n5cZ5ENDQzKy2SxFIhFaW1ujTCZDqVTKaabA+z4qrdy9uhHB0PLyskSTSCRkVCoV16gRLfYODw/T7e2tOOQE5zKocmRf3Mggzd7eHvEtQnd3dxSNRl3JgGKxaEaE6HEO553gOllXuQ3W3ch2d3fFyMvLS1siKxYXF0XWh4cHOYfzUMgKpE1t3Y026LouhxCVF8DBhYUFcz9m5HF7e9u5VUOV2pp8dnaWpqamPJMBKysrEh2kNRAOh2VG/q14c7XhILzb3993zYMT2IOCcTo4MTEhkqKgrPCx1gGePxgv6vW6EKJYNjc3qVQqSSG0A+RPJpPiKACS1dVVaQ9UdSwWs+33c6n+47ZYchqKx+NCvLOzI80NiWAMEkFyeM75lx5FdFhD4SCXIEJluxRbTLm4uDjmcv3RLgIYgrfILZBOpymXy0m+UImIDLLCATyHQiFbLq1gB/90bHwrcNPAILwGAaREcz8+Pso6CNsRGZDGx0eS8xXqRgh5DYkgIwZuFQPdyGACfwJ+PHGhnHKUOnkEetS4U72Co/uNWdoC3yovUVqBiD1EZW4fGRk5MwkBjjKIBRoAarXa12AwWLARIpdY4McC9RcnR0dHZjPabhosMOkG9S9S2/8MMLDfRKhljawjoYU4wNXby79OgavxJwrEyFlPhBZinasYH+pPPOMaNL4wMJphJZ553Bt/Zp3wHwTYnvHjbDCuAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-wiper-close .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANOSURBVHgBtVc9TCJBFB52r7jYyCXWnhcbO1aru8RErjGXWBxX2BijGG1svNhJo56VhQU2ViQsgdDQYE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100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-wiper-close:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANwSURBVHgBtZa/SyNBFMffboJaKAS10SZ7hXqFegGbCyjmUPTAH3eHlZWmULG6u/Kqi/9BLEQRIdoKigf2l1Q2ChGtBLmtFAQloPgL1HvfRyZuJhuzBvOFzezOj/eZee/NZAzyoMXFxYjf7+99enqK8GNxlZVtyhiGYXOZ5vo/MzMzW17sGaVgPp/vN2DkTbZpmqs8wfloNJqh10AZZjEs8QpYAfzx8TE6Ozub9AQFkGf7l55dWLbYTmxqamruRehbAl8CG5UEOvTNmWSmekHCVAgIJVgB9eHHD1bJSTPp7NXe3k68Hejg4CBvdF1dHTU0NFBVVRVdXl7S/f09nZ+fl2BS4Pb29geXMXyIe5eXlxM6FMaHh4dpY2ODGhsbybIsamlpyUFQog/geE5PT2l3d5eurq6KgTPc7x22kpGN5T+3Xl1dXdTa2ipGDw8P5bm7uyvoB3hTU5P0t22b9vb2ZFIu+smxjSOmEbfW2tpaAcJgMpkUQ25ACG4+Ojqi7e1tqq6uprGxMRmvi8P1BaXJLyE34MjIiBja2dmhzs5O8iLAMUGMw3h4yCkOobDYs+YHfXAkEpGBWJ1KJMTUqzAObh4cHNSbAisrK0FTrw0Gg5I4GKiEBAmHwwUzV2pubpZJOV0KD0EIkS6TlxxwViALMcvx8fGcEdQhKzs6OvIGYxLIcEwIxuFSvEP19fXSjpzQ5RsdHf3M5XtV8fDwIFDs0f7+frq+vpYtAjAMwu3oA/X09MgqEcf9/X1pQ/wBQhuyPZ1O56/SNOO+oaGhMAM+6rM5Ozuj4+NjiS+M4B2ZGQqFBHRyckLd3d2USqWor6+Pbm5uZAySqa2tjdbX1+VbU2Z6evoX3JumIoIBHA6ATUxMyCl1cXEhQOxD1ON9c3NT9qjufl2K5a+pqdliA4liHWEc7kOiwMXOvYpvwJA02KOILwS3FoGuoTTlWDKMJJUQ4qwfDmoyAwMDkkiYIBIOsS2iJH7k7MW1JPu3VpbUyYWVw91u4oWtcjyjOSi0tLQU54bvVBnh+vKJry82PnKHAydFDI1UATFwTgHzoIgtZvPW4Cxw1VlX0YtZFhjT6wvOXrgBK+ZnjcqXimHMrbHUZXuSV43kCpE3IUTzvPfjr75s61pYWAgx/Ctndy9/WlxaCsKPzZs+xc8Ww9IvwZT+A8hTw5fcMmXrAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-arrow{cursor:pointer;position:absolute;width:0;height:0}.jb-pro-container .jb-pro-ptz-arrow-up{left:71px;top:15px;border:7px solid transparent;border-bottom:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right{top:71px;right:15px;border:7px solid transparent;border-left:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left{left:15px;top:71px;border:7px solid transparent;border-right:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-down{left:71px;bottom:15px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left-up{transform:rotate(45deg);left:32px;top:33px;border:7px solid transparent;border-right:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right-up{transform:rotate(-45deg);right:32px;top:33px;border:7px solid transparent;border-left:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left-down{transform:rotate(45deg);left:32px;bottom:33px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right-down{transform:rotate(-45deg);right:32px;bottom:33px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-loading-bg{display:none}.jb-pro-container .jb-pro-loading-bg,.jb-pro-container .jb-pro-poster{position:absolute;z-index:10;left:0;top:0;right:0;bottom:0;height:100%;width:100%;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jb-pro-container .jb-pro-play-big{position:absolute;display:none;height:100%;width:100%;z-index:1;background:rgba(0,0,0,.4)}.jb-pro-container .jb-pro-play-big:after{cursor:pointer;content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;width:48px;height:48px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzMzMzMzMzNzc3MzMzPz8/Nzc3MzMzMzMzMzMzMzMzLVn6fAAAACnRSTlMA+duduRUwSGSD8toSsAAAAI9JREFUOMvV07ENgzAQhWG3lLSp6MwCViYIRSpG8AiM4FWMaPymDBKESMF/cQ0S136F353vnLuo3gp1kOYEoCXW4LFKIZAnqAXYICeASoAdzgG+cApwgF4EfwF+oDkCqIwA6gnyAKA8AaizQhsBAjzuqUHofInGIQbjRxXjMrTJuHDestR4Bng4eGrN0929PqNfzC6h06weAAAAAElFTkSuQmCC");background-repeat:no-repeat;background-position:50%}.jb-pro-container .jb-pro-play-big:hover:after{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEz///////////////////////////////////////////8Uel1nAAAAC3RSTlMA+rbVFUecgC7rYhEEz+4AAACbSURBVDjL1dMhDsJAEIXhdeiGpKYWQVKDWc8ReojFc4ReAlPFFQazad7lIGkb0jK/WEPSsZ+YN5mZEP5UrZIP0vgE0Kv3oPlIJlAk8AJM4ASYwAkww2+ABfQg0ImgugPYsfNBVl99kA0AsjOArAPQpRTGHiBB8whxM0y+3skXNltsvMYriIWrpWPA80mFJ5qL3gAfB1/tcAt7rzdiV+HEgs1oBgAAAABJRU5ErkJggg==")}.jb-pro-container .jb-pro-recording{display:none;position:absolute;box-sizing:border-box;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:101px;height:20px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jb-pro-container .jb-pro-recording .jb-pro-recording-red-point{width:8px;height:8px;background:#ff1f1f;border-radius:50%;-webkit-animation:magentaPulse 1s linear infinite;animation:magentaPulse 1s linear infinite}.jb-pro-container .jb-pro-recording .jb-pro-recording-time{font-size:14px;font-weight:500;color:#ddd}.jb-pro-container .jb-pro-recording .jb-pro-recording-stop{height:100%}.jb-pro-container .jb-pro-recording .jb-pro-icon-recordStop{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-zoom-controls{display:none;position:absolute;box-sizing:border-box;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:156px;height:30px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jb-pro-container .jb-pro-zoom-controls .jb-pro-icon{vertical-align:top}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-narrow{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-tips{font-size:14px;font-weight:500;color:#ddd}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-expand,.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-stop2{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-loading{display:none;flex-direction:column;justify-content:center;align-items:center;position:absolute;z-index:20;left:0;top:0;right:0;bottom:0;width:100%;height:100%;pointer-events:none}.jb-pro-container .jb-pro-loading-text{line-height:20px;font-size:13px;color:#fff;margin-top:10px}.jb-pro-container .jb-pro-controls{background-color:#161616;box-sizing:border-box;display:flex;flex-direction:column;justify-content:flex-end;position:absolute;z-index:40;left:0;right:0;bottom:0;height:38px;width:100%;padding-left:13px;padding-right:13px;font-size:14px;color:#fff;opacity:0;visibility:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none}.jb-pro-container .jb-pro-controls .jb-pro-controls-item{position:relative;display:flex;justify-content:center;padding:0 8px}.jb-pro-container .jb-pro-controls .jb-pro-controls-item:hover .icon-title-tips{visibility:visible;opacity:1}.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-face,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-face-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-fullscreen,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-fullscreen-exit,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-icon-audio,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-microphone-close,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-object,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-object-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-occlusion,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-occlusion-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-pause,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-performance,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-performance-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-play,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-ptz,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-ptz-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-quality-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-record,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-record-stop,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-scale-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-screenshot,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-speed-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-template-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-volume,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-zoom,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-zoom-stop{display:none}.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-speed{padding:0}.jb-pro-container .jb-pro-controls .jb-pro-controls-item-html{position:relative;display:none;justify-content:center}.jb-pro-container .jb-pro-controls .jb-pro-playback-control-time{position:relative;justify-content:center;padding:0 8px}.jb-pro-container .jb-pro-controls .jb-pro-icon-audio,.jb-pro-container .jb-pro-controls .jb-pro-icon-mute{z-index:1}.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom{display:flex;justify-content:space-between;height:100%}.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-left,.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-right{display:flex;align-items:center}.jb-pro-container.jb-pro-controls-show .jb-pro-controls{opacity:1;visibility:visible}.jb-pro-container.jb-pro-controls-show-auto-hide .jb-pro-controls{opacity:.8;visibility:visible;display:none}.jb-pro-container.jb-pro-hide-cursor *{cursor:none!important}.jb-pro-container .jb-pro-icon-loading{width:50px;height:50px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8BAMAAADI0sRBAAAAIVBMVEVHcEx4eHh4eHh4eHh4eHh3d3d4eHh4eHh4eHh4eHh4eHiqaCaRAAAACnRSTlMAikwX3CxpwZ7zIGi5xgAAAZ9JREFUOMt9lb9Lw0AUx2Njqm4iGEqmEnBxslKUdhJctFMVcW5wKZ0CLpJJQRw6iVqQbg3FtPdX+l5+XHJ3796bQj557773fe8ujtOI+6jz5p84dHjTkYD4+RhT9CIRZWRPJr1bChnbY532GhT4oUpbI6HEuqvgIH9544dh9J4/rpr0Ms8oV3zMNT7X1MXSmaznzfHjM4n72moe5n8ryYrW9rKRvgf0S93JA7yKa9lbzUg3keJb8OVCtwkrFmoO4MnsAuj5rGqnZg+GZXUXkl9NjEui9n3YA9XgpMgakLXz6ujMTIgrCkPVv0Jil8KgKQN/wRN69hLcb1vrbR2nQkxwiZTGQ5Teb7TO8PUaS8Q03sE+zkjP8qbjzgJtEhRbV4gnlkOFeM7hDYNdxPbiYFvKSHN6L2NmY5WzMYPtplZdTxncRvn2sI+DHIoug22jWMaA12Y7BrXzrG8BX32XPMDKWVzw1bdMOnH1KNqNi8toqn7JGumZnStXLi0e4tcP6R3I635Nc/mzsMxl9aux9b78UVmn2pve8u6eR50j9c0/ywzyVl5+z84AAAAASUVORK5CYII=");background-position:50%;background-repeat:no-repeat;background-size:100% 100%;-webkit-animation-name:rotation;animation-name:rotation;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-timing-function:linear;animation-timing-function:linear;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.jb-pro-container .jb-pro-icon-screenshot{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEzMzMzMzMzMzMzMzMzNzc3MzMzMzMzNzc3Nzc3MzMzMzMwv5ahDAAAAC3RSTlMAW+8S2UGVwyyZnOTRhEMAAAEfSURBVDjLzZKxbsJADIYdBQpsSCyVMlXAdEuQYGKpWFk6dWHJgsQ7sMDSpUv3PgITAQT0f7ly57ucQ45KXRAZot+/89k+X4ju9KzL4XOhlm3pR0enYrWViSRPXQIQSASkRSkIJEFRimYCuQAHSW89IOv6SH5TCsuAj68Ab1wDzqkAzqoC7AUAPtgsABgkBBgkCJiNHehGok//KRVsHqd+3Dj1/vukt3AH/Jj05s5/AmyZhFVWXDls44iVvfQWkCvgxU6g9ZdJfCLvjJbYaT3GvjOY4mQSG3SJGjhr/Y1Xohp+TGKqqzexZ/1GVGdNCitt6R8zVvb9d+JmKdl8o5sPWbtxT6zFuJcDQtk92MNmYiXHquYlZlVt1j4P6cd7fgHFW7Nhqu29TwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-screenshot:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEVHcEz////////////////////////////////////////////////////////NXt0CAAAADnRSTlMAWe+X2TINXUYZvctoYyuS2NgAAAEVSURBVDjLzZKhDsJADIZLCAsEg8WgEGCWGSwCgZxB4MgEAonB8wQEXoBH4BEWXgPJgEBG0mdgR3u77raRYAgnlq+9+/t3TQF+dKbZcJXSYSnzlViT457lRScKmBqILSFA3GoO8S4E+Ex5JiSJ4CbVdyOQdZNomX9D4dl+ko3NC8vFFmhPy8FIsi0ZlwLBW/LY5BxYYreUSgoFAEmhB5Rc9OCbUoXmTmDadQKTn4y6A/XTaoSKdb6KyGU6RJ7eHgpb3ABinAoil303xB6vQnRahNhXvMdre+fzOgxVrokX4jHAnBh8PALU8Eq8BqgTg/vePF8tpuPy9/NFaalSc273RizarYqfkswjifNMQ/TyTGMv4v87L+ks5gqDbc9OAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-play{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzMzMzMzMzNzc3MzMzPz8/Nzc3MzMzMzMzMzMzMzMzLVn6fAAAACnRSTlMA+duduRUwSGSD8toSsAAAAI9JREFUOMvV07ENgzAQhWG3lLSp6MwCViYIRSpG8AiM4FWMaPymDBKESMF/cQ0S136F353vnLuo3gp1kOYEoCXW4LFKIZAnqAXYICeASoAdzgG+cApwgF4EfwF+oDkCqIwA6gnyAKA8AaizQhsBAjzuqUHofInGIQbjRxXjMrTJuHDestR4Bng4eGrN0929PqNfzC6h06weAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-play:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEz///////////////////////////////////////////8Uel1nAAAAC3RSTlMA+rbVFUecgC7rYhEEz+4AAACbSURBVDjL1dMhDsJAEIXhdeiGpKYWQVKDWc8ReojFc4ReAlPFFQazad7lIGkb0jK/WEPSsZ+YN5mZEP5UrZIP0vgE0Kv3oPlIJlAk8AJM4ASYwAkww2+ABfQg0ImgugPYsfNBVl99kA0AsjOArAPQpRTGHiBB8whxM0y+3skXNltsvMYriIWrpWPA80mFJ5qL3gAfB1/tcAt7rzdiV+HEgs1oBgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-pause{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEVHcEzMzMzHx8fMzMzMzMzOzs7MzMz4IlKVAAAABnRSTlMA6xIU1hVqIuOVAAAAMUlEQVQ4y2NgGFYgLS3RAEQziQFZoxKjEqMSaBJpEAkgIw1ZQlBQRAEs4QhkDeIMDgAWx1gMHyIL4wAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-pause:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEVHcEz///////////////////////+3ygHaAAAABnRSTlMA7OgSFBXMmAA4AAAAM0lEQVQ4y2NgGFYgLS3JAUQzi6WlJY5KjEqMSqBJpEEkgIw0ZAklJSUDsISikpLQIM7gAJjhWp6XcaOxAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-record{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAHlBMVEVHcEzGxsbMzMzMzMzLy8vMzMzMzMzNzc3MzMzMzMxEZ/aQAAAACXRSTlMADPKKKeBxlV6neZ4mAAAArUlEQVQ4y2NgGDZgJhpowCURAJeYpIQENJEkCgWRgCeShAGyjfgl2EqwS7BFToZJiLg4ICTEImdOh0pwRM6cDJcIjpw5E6aDFeh8B5gECBCUYAkKCoMbNXNSOlyCgUEQ4apJJmxIEkjOVWFgxi4RgEsikGQJnEYp4pLA6VxUDyJLIAUJcRLIwY7qXKSIQvOHWCQODzKIleBPPjgTHM4kijNR48oGkajiYUMykwMAAfmZhUjBISQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-record:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMA8gyMLeRw1x2DBpWGN2QDAAAAt0lEQVQ4y2NgGDbgDBpIwCVRAJc4KIgEZM4EwCU2KSEBHySJCcg29iBJGCBLgHUs24FdYlnNYZiESksDXKJALebMaagES8yZw3CJypgzZ2A6WIHOd4BJgABMgh2XBEtpaBjcqDMHs+ESDFyLEK46aMGGkEB2rgQDJ3aJAFwSUSRL4DQKp+VHcTkXxYMoEkhBQpwEcrCjSCBHFJo/1GIO408MOJMPzgSHM4niTNS4skENqnjYkMzkAEgzyFpeX6L3AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-recordStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAOVBMVEVHcEz///////////////////////////////////////////////////////////////////////99PJZNAAAAEnRSTlMAMPndsnZj1CSYPcmL6wsdoU80pOJLAAABu0lEQVRIx5VV26KEIAhMA++p9f8fezatFDPr8LSrjMxwiWlqzRuMYKW0ENH46c3WuGyVLXEduuO83UyK59fl1jX5EEUXD9DOaSh43XEP5zUIdZ4pAecTofVnWSt3ip4rx7N61vjnY1D30CpH4QQR8vsP+RA5Rs3KpjfMU/pMim/LgbvH7DF2F8sU0owqapKLqgnhuGWwImUagn2zhUX6WQQoYkXG9WxSAJd700/ygsCpAoliaDsPiG48GM1X5Ft/06sfp8DrDE+3DpekWjxM6366fgEcnklC+AIIWYQmPEeAaUmjFOnhCLDfxZRH+w1gU5b/DYjfNcyJ0p7dxX8B+FwxQVtvAGB5ig0d5gFA5KbzS91hI8CenvlHflfN/XvzJQnxbBEko1gbvVnPii+FadSVRUEaYylQfJtpLB+aRG4LY/80yKdUbCraM0lozGR4ewZ0Wtnj1iC7hjWKNnjYmR62W15cLlL3+2pyMR09jccyuyUrHKsvthc5xsY1iWJ0Xk3t+2XP7AnWwrAQmBH6asXubmL1Z5Lz6o992jWiu9lnMSiQsK27FS9NxhCumZgB2fTBPFsFolhZr5B/D3o9sJAI6skAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-recordStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEVHcEwimP0imPwimP8imPwimP0imPsimP0imfsimPwimP0imPwimf8imPwimPwimPxLmg1rAAAAD3RSTlMA15sisGUvdz3szYwMT8H+hDJEAAABx0lEQVQ4y3WUO08CQRCADxBQchBiMDE24KswFlw0Wtig/oHzUWglJBZWio3GDjUxlhhrEzT+ABMrO2iptLLVRluDggI+xtmdXW73LkxxNzvfzuzszNwZhhDzdOxqaPGgYrgkOgFczh90ezAJQmpL2v6OHYnqk2aWxOTtAnu/O/Y5XNZXmTZjo3ot7aESwLdFeqAM0MoJkMf9ltwVQJ9PcQN0UFIJogvdJgLQVFMsAlxyBaPmVBDCE8W7qd+2SDsx0q4OwhSrCG134W54jDfKLjDNxaL8/9AAMM/solptRnoALBbwEPWYrOEzLnrZsTGoMW+fBHG2SiLPUNI6KMOH8QS/XsCMBYQekIEv7NGZF/Rht2yqmA4i3UG9O0iTqgMfhirDhRdU8XJZqqEO8tDAqje8IIt1r+I5HmBjfD9AxQ1MgJQRpc6GJRALHOAS1WRlhMs4VaSFzwIWzCUF3op71kdNsNs/FDCuA58YqCQl7IhN3WbDnlLtfjnuON515WM17c7w41QPOuBIzDT5wqi0T4ESGV3gjtTjkuPATwHoX9+cPRlmmvJ57YAir2qKy459QL/UhrS/uAu3xf8KiX3DI+b22t6jc9F/qfaum9E1pJ4AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreen{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEVHcEzMzMzOzs7Pz8/MzMzMzMzNzc3MzMzMzMzMzMzMzMzMzMzNzc3MzMzMzMxdHBitAAAADnRSTlMA8AwGYt0aUcg+til5kgmZywUAAAGWSURBVDjL1VM9SwNBEB12IcGkMagxNktQSZFCYimIJAqKpZ3Vco3YBYs0NkKQgBg4ECtLFSFVCGgQrERBsLayPE0Ip7n5De73BdKLTrE3ezPvze6+GYDfsAQKy/Rz0i/OZJjY9XREuohTKulS+ZFGiADfyZXU5uHktI44VH5apDx554aXwJqloiIwiEsStAjCAsRNF1jCmGqa4Vc+BvS4JkjwzyPE6xiwzsxxeTbZxqjkANSWZFkoIj5bQBl4aBDfkPDNpeRRialB+SRAFz8UU1sAaEUjSCDoJ7iukZJ1V+c01bFczM1pWaa+a0Rp7MHn4V8Z1R9vLLCv9WjKdVFfk77JP+bZdz35YAfKXx6KhKp93abUYVbrj49g9aAYSuFCLbPUwzdCsYEWTloXgw1oGwQbENeuKwxzXhxwAADRMFd+zzRc6AAASY6RH8VjUHaXTrlOpDgCUP3gelc01e2d+f16cWbnQ46BGCRNVsWAWQJVw2xGfUXVv2k1OsLfazXqblzS99u1FwKFvBJioXBY2+r82U75Ab7O0ypVV0wKAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreen:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcEz///////////////////////////////////////////////////////////////////+GUsxbAAAAEXRSTlMA3clDHfdfDQbsVG00u4Cqkr04dRsAAAGaSURBVEjH7VXLdsQgCPUBAROdjP//s1UTDUxsz3TRTc+wC94bHsLVmP9hkE8LIdvgupt2tFhcpy2CMZyVxNePEoqDp4hwEGz5PTqWoZNzLrmD9riltBEYzzpZQ8bweXy56Qy6Tivsp5JQYtawuMH3eJlSxIJtdSSa4xer4lMB89pK23mKrwjZVpsRzLq35vEE3+r26h6w5EKppcp3fP2lIpTPWJvoXoobeNI1sM3haHvx56tu2sdElJ54GbnPQ7RZ1sCpl8qPEMXBNQ8vN82jNbzLCPzGSDOZj/2Bqd19R1rELIEbDFrUJfKYdlALbDuDMko/hz7t8DqtCfr8h1Vt4rn7eh/6Ph37ch20aW8McsfGCOXzcr+GOlQG1rJ2HSHUDO/4Mu01qVAqTCpCJfgZ3phTS2pKm5aZOMUbs7Q6nk6L8UzRh6W78jH+gD/VRxHokPuNgUGTaPPR+zDR1mrlvcGgwkAVacSbeoN4Z0rb5/6XLrW/2GTLk2NhXHRKzrqAt9cD4rr4ddvae0NAYgOICdZyvPj4UYRf2BdfbB8iWvnTUwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreenExit{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAG1BMVEVHcEzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxi4XDRAAAACHRSTlMAf3WqJmy+7azWNnMAAADNSURBVDjLxZQ9E4IwDIaLfMzCOTDSOz07OjLir5CR0dmJFVHIzzZtnMzbOzcyZHnuaXpJWmO2ji4GhpAzzZeQzw8FKCj1pMHss9OgpwsGOS0YGOcVUMPsfBVkmJoVCBJW0FFB6SFIaMKAlRGDnEiDkuM00lP3SmL6H5QSh+iIr9ZWVWntUV9Z4qWbHAWrhcUYNLC4Wwm3xb1r2mOQYoVn2EKFAVb81KHiQQq6L3vSUoMBUmSzgCKbVeiL3eTp3Odf8H1sxRAZZNZt/Vt8AHcPQbiQQVF+AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreenExit:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMAe4Fzh7MZbKPtN8gpX19xAAAA3klEQVQ4y8XUIQ7CQBAF0CWhKQHDGtQKQFcURUgqEARBED0Aoqp3IKnoATAEW8MNOACmhQYKcyi6uyjmr+aLqXj56bSbVoh/J3HBxcw0ZfA2c3FiQLGeQcWh1lOVDDJTAeCbCgAR6QqCDj0xCEU5Bl2BIALKMwhdKjGILRUYfCIOEynlvABANk64M5jabJxHfJY2I76yzYu/ZCc0s1WbNYAQ3jxqwMoGHoqWGHpUQajEgcYYcKWFtjLE4FGJQewoxODRDQOqKPPcHl9sfzSXa/0L349tEDsOsp/8+2/xAY+BZBY9KhM5AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-audio{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzKysrMzMzMzMzMzMzMzMzMzMzMzMzMzMzNzc3MzMz8gU00AAAACnRSTlMAL0jMZKt96hGJsSKv1QAAAJ9JREFUOMvN078KQFAYBfCbJEw2q6SUyWxTnsJT2JTJ6D38Gb6n5PpT6BwbuaNfTnz3fEp9fZwAP7czD0MsGCzBYJcEYsGwBEHQQRB0EII1CMAWdAOzyJUvJ4jyDVyZVHKGpj9guEI2IuhaDFadYnCkIm9I+kPgn8t+kI7kOsT72HcwQnJR9Gofy8DrwwtHK8pLzdeALg5fNb6cdJ1fOjOGYrl5CLFcggAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-audio:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMAL0TQf2frEaZYt8E+idL4AAAAnUlEQVQ4y2NgoDdgUcAuzr4Hh4TaGQHsBp3BLsG+BoeE2hnsEkCDsEqADMIqATIImwTYICwSEIPQJFhnBjKInUGSUA2CSPCcOcIwB1ki5xRM4iiDDrKEzQlsEuUF2CVY0jbgkDhjMLQkEkj0IM4gQQ1EHMHOOXMiakRpTiQQtXgTA+7kgzvB4UyiuBM17myAM+Pgzmq4MyfO7EwjAAAEf+BAxqI/agAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-mute{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEVHcEzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMztXryaAAAAD3RSTlMAHd4P7ztyiy1OnKhdx7uY2gyAAAAB8ElEQVQ4y72Uu0vDQBzHE45C3SJFaSGjUEiRpJRCBifXokkpSv0DfOBrEKxUUSoFH9ClFAUfU7c4OARRCs5WjThIsJuDlLo4ldvPe8SYxGyCt1zgw+dev+8vHPcvYybvfCR2OgUv2CoLdI62bUn3gq5UJxOomZofXPUNrIChJRklfcDSiKK2bYQ6PiCaREk0EQoYPFYa3F73F+DGsBJLmAjBAMBKakG15KAxqIhd2KuK5reRccBDNbqGJhfSlnNc/kBh4OY+vaoR5QrRC0afKgxMrKdXNKI8yxRENpyd+i0VA6wMm5IOBmORCwfAFjGwolofevbuPrvpGhRgpVaqiJflrLuUQQFRToS9l894EMDe7q6yL7/G5wMATc5mQCiAvQo3HAbwLtyYHQZgTxhohgGUa/CP12EA16W2/Ou4ZEj1dNG9oPMkZGiwJWQ8j+huPoJy9Z/XHTfUFSbAURveCtE5px5vs7hQDKS25FSDn2KR5Up1/lRmIHne7BvKd82LMRJbSjr5M40lmaYZ5/PRpiCpizjJyk+CwOGOzACLpSdz02QxkiuRhd8dNOwkV7zl2YX1mcySKJrQiPkXY9klSt6rkJPRwIlmzrcWSGyzHuTb11V/N0y/S6SdwdCR4m/47OIN7XOQCfwJwHGp8IcfyRdBLEZK4Uxp6wAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-mute:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAP1BMVEVHcEz///////////////////////////////////////////////////////////////////////////////9KjZoYAAAAFHRSTlMAbk2o8o0P5TsGnVojFi/XHcV9urLaq0oAAAIQSURBVEjH3ZZZkqswDEXxLM8T+1/rkw0BuwM0f131+IvDyZVk6SrL8p88QCHp8UAnWmoWoG8AwQRN4/vOiqwUuwWqiob646MMhEW+KnMLMIXffgiZoODBusb7kCzjByF7OOszkOyp4amJ7fWVPwCN6BpyWRypvANPCvi7u4aTXe13YI+KkYA5bMRTSMlLnSyGwisSH40B0FJOrKVB6iAw2U7sGgPgQ/DTPQjitCOZT4Q6gWCtGwGFbSM34ENUNSpAKTACmC31rnRgJwjDdkFAJpfkAsZcAJvCSVQB2FaWWKdB/ATMAHwIUYL21lRBZRDiC5AnsBHBUqxEyaraFMoz0AnvHNa6xDWS34FGgNf6PYAEZoCt+BroUWFVbeb5HbCqSvB2cToyca+Adjlycdawt0C/HeyScl1W/w3gsU3aAd7JF8AuAN6isr7NAogXAFeq59Ec7ifAm49hF8wCMWfVNXAeCAkjEGuBr6R5ZGJzBrl4gGniBME+w8aMMyCsNZtfaemnmYaAQ6I3Rz0fnDhHJxc93Vrr7sHWjP3XRtTba2L3EkdFVaPC6YmXxKI9DGF1YPLdiwfD2r37cL5nDVw+uKzU5K27hsXCXPtyC2uyyl0D0p2TY7VaIvFYWU0Dm8TdOXmrVp52HG4lU4K/N38PpS/Kw70dbmb/sC0WCcQwNNzzjrzUj7veUyIIyL/4m/EP8V829O8zh5EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptz{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAM1BMVEVHcEzMzMzMzMzMzMzMzMzMzMzNzc3MzMzNzc3MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxDm1AzAAAAEXRSTlMAHqw+E8It/gjxc03jhGDTlgAjE2kAAAI6SURBVEjHpVbZkoQgDBwg3Of/f+12gtfMbK1Yy4NampCju4Ov1y8ruNyyo9fyCibVlNW6vUu29GpWQwTVdPTernqwffHex0WP4Nro3k+PrMKCvew/PcZ95aoNsY9yua+cGxTZsnf2K7ch4CAdGnWwYx/5LgKZCgxGdrhH3BeqNmnwviFXPZbQJmcM25HJ5n7/Pczr2QqksMJfO7BJOHLKLWFdMiL1QXYRwFagMklb4GB1zS7s8Le3fqH7Q28tVLkKdIzeaOJB2OKtY8KfTQCUa4++dNsLbrqpTR7xguHGt8hfg8P+seuaEkNdBjahzOD7g1cHP21SL2LtMNBKMdTRJjffTX1wVgrsEb1ITJU6QknwYJAcQky2cE02NbzPp70KyKggtpu9xM7Ik+CBIqY+8FrYyRUkrs+MEm1TG6tG9LZxNDNFGDue63TYGgIHqUUcuNhvhyZtn5LnlDq3Juxa4noCuX0scErOpNMDCrVcHPCS5rFGuQR9KZpxnB6CQ0ZO+AIBcTPk3UdbTx1L7jLEEHsMW7ZYm8NlIFyxn8+xdL7MURYEhzd5k2N2TabxIAORwC2r00QQfNSgrnqTJfh7cDmDu9ggtV0EZFr7kGu4KAxtNDln406TLwF9iZCIwn9EfjPuncRHYm5x3NfK3cFAS5kWxljSnTFlPHBAUFg5HsCCVOd9cdwXq+027un2QJlMjqISJutCDceRtTTuT4+1Q3HWHR8cu0fh9sGvADTYH9iLah/9nPz5+/MDJnQfoIVoAnQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptz:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAQlBMVEVHcEz////////////////////////////////////////////////////////////////////////////////////1bZCPAAAAFXRSTlMAeVoYDS1pBiPv4/g6lkzO2qSxvoixscijAAACi0lEQVRIx51W2ZLcIAwcLnPf+P9/NS2wp5xkq0ziF3ZRC3R0i/l8fvi04oxx89n+RBi1sqB38TKw7lw7lNzDa3U0e57bHhJ4d567HlqGC08eLAj9Gv8XD4/OwtsdhlfCW2s9LfWtuNrMhG1uLWP17Xh14LF4m8dx1OJ9jkm85YCYch5JzDVy81on3MFYkpTNYGmHHloYI+aqlNhlh5ZSvmH1AyBUwPcMX+u/clW3XYvA2YgRGXyZIZX6PXv0l3GlV9Jp9FKcK7mytJIg8xEeBdaBtV4P8tAixexnp73tY7ZBkrk9WEL8t7ZUDqtIA3jXa8sODSeUVqw5aztT+g4QeNAgM0PGTA0+EmfVeUvU0CEW4hX+lt/zseE7jJKDSmi0EUKBhr7EAMKPvNjOA9Fz4Yk/CFgcGRSdkYOHCLRxQfzKRN5SB/b5Ot8SzzQiKqcb6ipFdCfi1JI84OBdxzarhJ8RkpxHOQszl7bpn0GpmnXq6R4OfTkwwlyUWzeQg7rSLNhNUzEUEqJF3DMHeeXgqRIaYwHimLKipK8hMZOYVfJ5oKtIFSgXk5z4KcNx3GOIPGYfPigh9YGHBNQKVKbZhxMnqq+OHfWBHARZfWm1dnfSXfJuXInplse8wy39zkisdQ5kuLY+Bpc5hwGiH8Mx1rE24DFaLqXkfrNVkjk+8JPTPF0bUw+R9MCVuA8ks/xDyF/9orMqpBQeiob5RbIbmv7/TxvoX1Oqa914TsYg7QUWx8Y7R89JQY8mY6Dat1G5GARuMOgYHY9cbL1vNvc++fk67olLk4nrQSl7457OPqdeKn+vEwm4LPzW87DyXvqIyei9znHS+cZz9SxV+Qf8nNbjn37NkDx4+PmCXzHOLUMtjgmUAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptzActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcEwgmv8imPwimPwhmP8imP8imPwimPwmmf8imPwimPwhmP0imPwimPwimPwimPsimP0imPoLqfILAAAAEnRSTlMADprCJBnU/gXwh3LiUKxAXjJ/ELXKAAACbklEQVRIx5VW2bbjIAwLa1jM9v8/O7Iht+09MwPlpS2VwLZkJ9f1lxVG1joPdZ0u1ZIxurhv8DH6dMpQI5t439GAEc7xYPgTRnAtV7plReRhd5kDP8+fd+wzt70yPhIJzWT7/6DCJCAYLReZPMIuJC4pClSktHqbNpJO1aTmmAme3cvtWs9NSfq52CPhnJNjlbVHwgmWSWGHeQHcKFjj7fygwidf2fa4mbVOuladcnsoDn9/CKKAWf6HEtpANiJvUp9Fgr0SvocPP/sqjOCK9ktpyCAo4Kt/d4n4/6baseNKAt5XrauPN1A4ZLAd30RUI4kNfELVx+yd3lrXYIg1Bp/B/dGs5N8mPsJoVyiwkofQSlm+K9aiwmoQMDoI4wefoK/rhkESrSuV+BR2i6HZH9juLzxCtBmn6rFmB66gNJQwBOSxncT/N3FAlxAoLQfJDy2+6rMLI3aznl9fhOcGSdZzoNhex2K3TXJEVe3M4Zb6QhHuJc5BWakYIqqietcPw6FK+EHofUHRqtLEQ5X8dKVENXXgEpLOpcjwkFI30YFVHE8fyx2ShZJ/ydTKlZwZ4BCOv/af9uMi0DILe4kieynScgPbhai+DRDckTT6N6zJpI3HMghM3BMg+q9pHmwrbR0Q0D5wc0JHPy0E5Ur7Nf3Rk68LnR0NHfO28/T5P4cNr+uLFR7eEdiNxvMRbd5Onlqsis4iIVdme4di3akWOz+3T0aUnFWHa8QZrO51NO69MeLPafrNuBenxel/3d21j8k/jyxf+75OQabFxOtuT94G3Lpjzb0zBn2Dl0ep/waPidQ/p/XB60Dp7e8F/QO7WSJg4zEzdwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptzActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcExru/9ru/9qu/9ru/9ru/9ru/9ru/9svP9ruv9ru/9ru/9ru/9ru/9ru/9ru/9ru/9ru/+3uxEqAAAAEnRSTlMA5q0cR/PC/ggSKtN5OIhaa5izIOiAAAACV0lEQVRIx5VW2ZLjMAiMToNu/f/PboNsJ5PaKWv8kKRkWkDTQF6v/zyUfO+JX9sP1dKKd/v2acQcm992kbo1R4il7iHIif0BRNtCUOozH4cikAdt2YfjRLTnzN15/8I85wFCI2xDzlnyMLO7R0aFoTzbFGB+jIkYLkyePvmW8d2fs2ZfZuv8It9s6zvV5uSr2LmKb9oVh37QvpjYOcf8fcO3Cb1jGqOU0SvTTd6X2KUBLgKdLzaiDtE2n+isTh8/+AX7E6/Vh/NNSyfVm10RXIe1nxXRapmsDQB7SMnkmE0IxgqvUn0jteEf1T2CHXgr0gjZllGk1HoJL7lD7fRpD20CgJcwQ6EdSh3lLK0zVfuqz2WvPlPJh7HqnCQ4MysxoAYQE0vHub/toRuqzRy5pEUvbg62MzlJQn1MHBe1x7WSAddpNDSN1c9wRMhKfi2jrICwAIsQvHkD7Al41bOrBNC1Y7QdmSg15LDokGETJB/imxYJKfmFMDqI3FjUkDS3NSEDjBaxknRYSb+4nj4kC43W2OKrkqGB8jV2Fq03YiWbhHQTpUV1mMHXWYf8HlNX7ZUQRC6iwBAIK0r0ILr1UxqKsPattAkhwSIiMl76bT/Ft/TbTy2jHQoM7Cz9isHVMb6GILl0H4DGivbw7xNc8rAtiJn3O/qvD6JT/wgs7Y370ZSdWmbZWEKiG1lXImldW7Q1jGMbZW9tUVKZmGjjGvf+EXAqzWiX5OfFSHVp/zjbfGPc3whdcbTF67V2N1e79qYMru2/AnzVYFsdWFt/+nOypv8vQvoHou4gOtSrG5EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performance{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTM7OzszMzM3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3NzW8hQDoAAAAMdFJOUwC/gO8ra6tUQNmVEKtAA1gAAAE4SURBVDjLzZMhT8RAEIWnpS3tXcWdQ6wgOJIKfFdUICv6AyruB5w4EuSJCwRXgUBWkGArLsEi6JVuaZkfxawguSWz/p7azLdtdt97C3ASagp+PpeXPDjHVx7McMWDCBc8qPCZB4m44YFIeOBh+ckCf9z+sCCYqi8WvA/5Nwu26cfA+JRBs4h7WmX/tr9AXcQHAPdgzEPZh5idTQBOZ3zyiModISKQGxZ7dd85E0SKfMGjM7vXeI/5AE5LvrwpcK9IOrQYB5BlCsFIvjzgrkaSjsBZbmC9XsGsAxfn8gKXpL9sSlnQFBwFTTuaKWXgI5Ar+sfHTrW6DUDO+2jEEtCNQ9wL6gNujMvvdFS3eugxGT51fBXxTvF1wLLngbT0BGphKalAy0MQ3Z4Ha2V7UoMFJKkFVAWcvH4B0OJfd9YsTl0AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performance:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwD2qdfrViyAwW2XORBGtSCsD6SyAAABN0lEQVRIx+2VzQ7DIAyDYfxToH7/p10CbQ+T2s33Rb1MijM3/qDG/EurolD9zSNRggBU0hFelMABmenfADhGkJDhGUFGgiX6I1AAQlDgZK/td8ELtQORiTmIq42I2bYdCD8NjzPmYQxO+rbn2S5qzEUF6YjkgcJude56X3s0SoL7LRAeylyaVPiFq0Jyx230mpeXmXVOHssRbhackhCq25Sny++xcBW1n6Snqw6BTgrqRP6kzfDcgmRLGonDWSf2OecwB491dOrEVZpNsxiyiHzWJ0Z+BbBwzaoWVb49HrqVfSkxHen7WNznLhzl8xpQlT3E9oHUtYaufB+7NY9g9ctbjFfj/h1DwXUrzDltMn1Ql9M814EQWPLmEBg4R7JSzpFQxTmSBMkLvJKOhFHfKEEnv3L/+qw3DuMPzAFH9pIAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performanceActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAtUExURUdwTBGW2xKV2hKW3BKW2xGW3BKW2xGW3BGW2xKW2xKV3RGW2xGW2xGW3BKW2+P2IvgAAAAOdFJOUwC/gCvzq1RAleURc9VmrA9rXAAAAT9JREFUOMvNkzFLw1AUhU+SxtTahnZyC+IsIeAenDuE/oJQcS/FTYTi6hKcHYpDZ/EXBME95BeURpM0Me39Db4Mgk/u23umcL8kvHfOucBBKEr5eW95xoMjeuBBlyY86NOQBwt654HrPPHAca/YuUHrDQsG9eybBWa1+GLBqvS3LJiNX0vGJw/R0N6LJ+/f6x9I3uwG0D+luRU0FnmdCtBy6ZM7KvQdjgXwJYuNZVNrFfqF8IX+nFm/oBvyS2iZ8OWxgH4u1IZmU4kgfoa5E77c0jwhoTYCbTRFGE7QrXFCveCURkK/2cRBCp2gFYiyWk7Jw4AgXOmQZMAqa9uAeCP+JsViihtb9OKIPtBUuvy8jeqyHRpMhvc5X0W6Lvg60HrPg0DREySOoqQJKRbByRWbExaqlSoVwB0rwCLFwesHquttxhcsa64AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performanceActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTH3G63zE6n3G7H3F633G7H3F633G633F7H3F7HvG7H3G7H3F6xOzy+EAAAAMdFJOUwC/hKbvK0BT2XURZct0z00AAAE3SURBVDjLzZMhU8NAEIX3LiSUNqI1qBMMChFRgYxAd07E4CI6HQwzEUXgKjC4CH5ABAKJyA+oaHqBJO3+KPaYYSZh9nyfyuyXu7l77x3ASSgu+flYX/HgHOc8kC4wwikPMnzhQaTueKAiHvi43bFg0m4OLPBM9sWCjyb9ZsHm8NkwPiUQT8MjfSX/fn+F/C3syJf9YB7oLsDkjIaiHix5QCNbGBmAFPve+3lXi/0viLB3ZnmDz5g2ICry5daAvCbZhSE2oIsFeC35ssJljiQbgZitIY7nIGu4wLG+xBnpL5tClxQhCANR1Q5TSmCCQK7YjftOVbYNUOxot0EsHl0uwHdFfcD14PJLG9W9HfpMho81X0V8MnwdcHvkgS4cBcqVo6QKHQ9B1a6XY1zAcSiIFg6QlXDy+gEd714RcAqEowAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-face{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTL+/v76+vsDAwL+/v7+/v7+/v8DAwL+/v7+/v96T4QgAAAAJdFJOUwBAgSCbs9hZap+hQJoAAADvSURBVDjLY2AYRkAJCAygbEZBQUEBKJtpJhDAOJpA9kSYxESgKphuIaBuhASqyYzESjC2hDRilQBZ64BFgm2qMLPYNCwSkQpAwlMBWYIRzJsKYrKCxZSRncKSDFYzBSNY2MD2MqRhSFgqgClPAwwJBxwSbAk4jGKZDCKZp2JIsEOcOx0ztjQDYL5ENwsYJKrTsMSvGSgepzVg2pE5qSikPRPT8sopBuDod0ATZ54JsbZyBrJgAVAp1Ax2oPXMykjxYQaLA2CMoERUZQDMrgBUCc8CKIdzAvHJhyQJpLQLSu0TCaV2lPwBSu0KQy+LAwBuJj5UbruNggAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-face:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTP///////////////////////////////////////////////w2imYoAAAAMdFJOUwBAgBvfrFmcw4wrbtGliFoAAAD2SURBVDjLY2AYRkAJCAygbEZBQUEBKJvpDBDAODpA9kGYxEGgKphuIaBuhASqyYzESjBu79yIVWIP0NoCLBIsR4WZJY5gkYiZACRqFJAlGMG8EyAmK1hMGdkp7M4gkus4RrCwBIApFwwJmwlgqsYAQ6IAIrEAwygHHEaxngJbfhRDgg0sxHoMM7Z0AmC+RAPsJ4S5NE5gid8VoHg8sgHTDh/PzM60HkzLc44bgKMf3RKuMwoQ+dNIgswJDAycUDPYjhgwMCsjxYcJLA6AMYISUTkBMLsaUCVqEqAcngPEJx+SJJDSLii1HySU2lHyByi1Kwy9LA4AqflRBKNSA88AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-faceActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURUdwTBCT2xKV2hGY2hKW2xGW2xGW2xGW2xKX3BGX3BKW23povfoAAAAKdFJOUwBAgRybs9hZLG6hrV9tAAAA80lEQVQ4y2NgGEZACQgMoGxGQUFBASibaRUQwDhaQPZCmMRCoCqYbiGgboQEqsmMxEowTgmZiFViFtBaBywSbEuFmcWWYZGIUgASXgrIEoxg3lIQkxUspozsFJZkEMmxBCNY2MD2MqRhSFgpgCkvAwwJBxwSbAk4jGJZAbZ8KYYEO8S5yzFjSysA5kt0s5YKc6guwxK/baB4XDYB045Vi4pCyrMwLa9aYgCOfgc0cY5VEGurViIJMhcAlULNYF9mwMCsjBQfZrA4AMYISkRVBcDsCkCV8CqAcrgWEJ98SJJASrug1L6QUGpHyR+g1K4w9LI4ALk0RHtSETFcAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-faceActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURUdwTHzD63zE6n7H7H3F7H3F633G63zF7H3G7H3F7H3F68TinBIAAAAKdFJOUwBAgR+Z31ipwW4yAjb9AAAA+UlEQVQ4y2NgGEZACQgMoGxGQUFBASibaRUQwDhaQPZCmMRCoCqYbiGgboQEqsmMxEowTmmZiFViFtBaBywSrMuFmSWWYpGoUgASXgrIEowgHtsKEJMDLKaM7BSWYLCaJRjBwloAploxJKwUwJSXAYYE2KUMVRgSrAFgKhTDKPbFIJJ5OYYEG1iIfRlmbGkVwHyJBlhWCDNrrMASvxageFw6AdOOqKCklrQuTMuzlhiAo98BTZx5FcTarJXIgglApVBr2ZYaMDArI8WHKSwOgDGCElFZBTC7GlAlvBKgHK4FxCcfkiSQ0i4otS8klNpR8gcotSsMvSwOAIs+RIlIrewIAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-object{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA51JREFUaEPtmT1oFEEUx9/bnRALGxE70btkZjcR7QMiRisRbCzEQvxCLGyEhCDRBC/RoNaWFgYLFUSwUBAUDKKFFqIQ3OzNJpfCyspS8HaejNyG87J7t7N3l03gttydefP/vbcz8+YNwhZ/cIvrhx5A3hFMjEAQBDwMwzOmAi3LWhBCLDTr5/t+ycSubdtLnPOncX1iAfQAlmXdNBmkru2RVgBSSspg+5kQ4lRjv1iAIAgqRFTIMIju0i2AWNvrAKSUowDwLqP4tACm9rWmbABCiFxXKimlhu0BtPFHtdc19wj4vn/Wtu3XnPOfWVByA5BSngCAuwCwryb8Hud8EhGNltANB/B9/5BlWXcA4GCMx/8g4jjn/H7aaGwYgOd5BxhjcwCgPd/0QcRVAJhM2l3rO3cdQEq5GxFvEdH5VsLX7aKIH8MwLLmu+zapb9cAFhcXt/f3988AwJip8Jj2L2zbLg0MDHxr/NY1gCAIpohIJ2V2BwC0iUd9fX2lQqFQ6cQvtJbICSGOxHhlVOdKjuPMl8vlqzrxI6IdWUAQ8Um1Wp0ZGhryiYghYrUtgDQionxJT0al1IwGkVJeBAANvieNDQB4joglzvmilHIXAIwrpX67rmuUamfKcxoTvnoQ3/dP27Z9g4j2J4C81KBCiC9LS0suY2yMiC7rttoZuQBEQhsiopfT6wAwUvv+hjE2XSwWP0kpRxBxgohO1kPmDhAHEgTBUaVU1XGc98vLy8eVUhoqbpPLPwIx6/wqEV2ovX8AALzZ/Ng0EWgQGa1iLQ8xPYCUyx8YHjt7EWjm2I7sAy0it7ERqNWEDkeiklIJg8pFWwC1ZC6SM9NYc1oXgcaiVlxVYmVlZW8YhlMAcCnFvOkEQPqqRBqASLTneTsZY3pjapZSpwF4Y1nW7ODg4Ie202kTgGiwSqWyrVqtXgOA6Zj0OhGAiF4R0azrup87dqDJAlA/eLlcnkDESQCI0us4gOdEdNtxnK+tfkHjA027AJEgKeUVANBROVd7p3fixwAwJ4T43kp4nR2zylynAOoE/JuAiPiDcx6kFb5pAEwF5zKJ2xXZrH9uc6BTUD0AAGh639Xo6bjUI+G/NglS+p3Y87wCY+y/2ozJSGkuRDLekQFjbEexWPxVryfpjuxhllKhNtwtAESc55xHx9M1hsR0WlcOlFLHTLyv26Ypi5hesyql5oeHh3VBeN2T6TxgCtXN9j2Abno3je0tH4G/KbtRT7VUKs8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-object:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAwdJREFUaEPtmTuIFTEUhv8fLSxsFrET3UIQRHtBRNdKBBsLsRBfiIWNoIisD1xfqLWlhYuFCiJYKAgKLqKFFqIgoiBoYWVlKbjwy4HMJXs3M5Nk7tzZCzfdvZPk/F9OHicnxIgXjrh+jAG69mCpByStB3AgQ+AcybmqdpJmEvv9SvJhqE0QwBm4lGikqD4VAaCMvh+R3NffrgzgB4DJDCPWpC2AYN+LACTtAPAqU3wsQGr/pikPgGSnO5Ukgx0DNJhRzZp27gFJBwE8J/k7B6UzAEl7ANwEsNEJvwVgmmTSFjp0AEnbANwAsDUw4v8AnCZ5O9YbQwOQtBnAdQA28nXlp/NG8HT1G7cOIGkNgKsADtepDnx/C2CG5Muytq0BSFoJ4DKAUxnC+5s8cSCf+j+0CXDBjAJYNgAA6+Keg7AwpldyAXqBHMmpwKjYyThJclbSSQBWfyIT5IF5kuQ3SctJzjcCiBHhxUu2GM24gRx1IGtj+gDw2I34Z0mrbXcC8JdkUqidFecEAj4fZD+A8wA2lYA8NVCSHyRtcGvouKtrg9EJQKHVB7Ht9ByALe7jCwAXSb6TZP+dAbC3D7JzgBDITgDzJF9L2u2gQoectV0yAD7IEffjDgC7plaVJQdgYotdLOYSMwaI2gETr51jD1SN6qDOgSobw/WAywltLxRVhBIxi7LxInaxUCHHFvmCpFkorWInoR8LheqsA2DB3LGIRdPIAznBXC1AIVrSKncwVYXUMQB2Sl8h+SYQOCanVaIBPJAVAM5aqBAIr6sAnjnh78s82aoHQkYlWYwz7YXXIQCLRK+R/Fg3BYcO4HnlhPPKIfefTYX7dm8m+aVOuNdP+1OoSow79KzKL5LfY4UvGYBUwZ0s4qYiazzY7RRqCtfZIm4qfGBrAEDle1e/0FDoUTKvUxiT3gfsaWlBbibFUsyDiKSkBK9nf4LkH19P2RvZ3cxUIVoEmCVZXE97DFXPrJY52JUy+lY3Ji2S8cxq4i3jsahk3QdSodqsPwZoc3Rj+h55D/wH5CHfQHNA9EUAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-objectActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA9JJREFUaEPtmU+IE1ccx7+/N7O0BwUn24UeRKOd7LalvS+I6HoSwYsH8SCtLf1jEqWoyLJVMfE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MNH3vqp9pN+vhtq5VMqT2PpAbjwrW59VmVAYL8iASCfdGBvm/bpQPrCvP1eP+RpYrXA5XKgTaBkA0Voqb1eupL4DToFo5YLlVZfadtkHKIqrPrFLIsXL8s0k3LaHuA6pQ7WzfBWjn7Abpe9ln4C11Qo9Pmb2aMgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-objectActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA8hJREFUaEPtmU1oU1kUx//nvthx4cJqX3RgGLsQBNG1tq8Z7axkwM0sxIX4hbhwIygibfPMeyapunY5iymzGAURZjEDAwoVm8SPhSiIKAjtQtAmiooLiyb3yEtNm76+5L37kjQp5C2Te879/+65H+eeS1jlH61y/egCtDuCNSOQyH3cWirNHVIXKO6kYvqdenbxqVlLxS8J8Txp6Ne9bDwBnA5IiIRKJ5W2LDHsB2BmC6zqmxk3UkP6AbedJ4CZfTsNcL9qJ077VgHU8r0MID5V2EsCk2HEBwbIFdT8M/aGBkgaelt3KtOB7QKEnU9NsGt7BMyp2cOa4P8tY3M+DE/bAC7cK+xnxmUwtjvCCXzFHtRHiEhpC11xADOTjwG4BCLDY8S/MvhsyoheDRqNFQMwc292QmppEPb7i6MZgEdqna7V9i0HSNx/95MscRLgo/7CXS0IWS6VrFRs8+1ati0DSEzm18kesgGcURa+3OAfSGklY5ueuP9qGYCZzceZySKC1gQAgPkvXtNjpXatn258CmlYSOSSg/qwW+B8usH9SSM6Ec/lTxM7iR/3hgEh4Jpk2Kkh/UVikiP2MBUbAggiYjFfchajtB0QM/fuOFg64D8H8QHQTQ3CsowNT8cffdLnPn8+KyXPpWKb1FLtYJ0tbbU84asCyRYOEmiMwTtq+P63JJAYH9AfxTOFbUTlNXRyPlmTdpsAKlIXQZyDDJJGGbx7/l++BSHM5EDfg7HMm91CRM6B+fdqyA4AWA5iZd/++hWymDaid+OZ/G8EGgXB65DrhAi4Jw3NsORj5VRC4A8AW+tN2Q6KwKJM54b2HcD3EtMFCLojqVw7uxHwGdVQ992OjkC5JqSJPRXw2qlEsMpFo1OonMx9/7gE211z8iirLC1qeVUlxrLvtwgU4wBO+K2bpgCoVSX8ASqiRx682hgp/jBaL6UOBsC3pMTFdCyaaUI6HRyg0llicnptqWfdeTBMd3pdH4D/kyQupgf7HtaKZIj7gDpAdefxzOw5IjECoJxeewEQ6CZBpmwj+thvCq44QEWQmZ09BYjzLHFk4SQm/C2KIm3/svGZn/AFP+qVucYi4BbmbLnOb5rGr+zB6MugwjsGQFVwWxZxoyLr2bdtDTQLqgsAQt33LvdIe6UenvNaJUQqJ3Hi3ut+KSNLajMqfQV5EAnzRuZoEF8ivfZw74dqPbXeyP4MVSoE0DoAmkgafeXrqS+A08CpHBDTPpXRd9oGKYuoPrNqETlhD/w446Ul1H1AFaqV7bsArRzdIL5XfQS+AaeCtE+rbksUAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusion{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACCVJREFUaEO9Wn2MXFUVP+e96X5oa9UoYpUszrzzZlqLKDYhgAFaaKU2+M2W9Q8TNUQSQEsiRUjFVaHGNmoBMTUmaPwD2iIhqKR8WEBFGkLFUjbtzDtvpjYrVhpCXAtm1867x5zxvnXm9c28mR13b7LpdO65557fveeez0GYp1Gr1d4VRdF7lL3rui/n8/lX5mMr/H8wDcPwIgC4QkQuAwAVWv9eA4BJy/8sAHg7ALysf4i4DwAe9Tzvj/3uP2cA5XL5CsdxNiLi5QBwUkQeQcRHrNB/JaKZZuGYeRAA3gsAZ4nIBkTcAABLROS3xpjdpVLp0bmA6RlApVI5FxE3OY4zGkXRdkTc6/v+c3PZPAiC80Vkveu6Nxlj9ojIjmKx+GIvvLoGcODAgTctXbp0CwBsEpGHEXEbE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8Vaxj4bQSLSJbEFHjsraNjZg+E4AS2obHTzRb0kxsvirXVm1vBoAT9Xr9y2kNjeQtdAVAF9kQW5PseW+zzszMjCcbGe1UsmsAMYOURveTc62nap1TRNYsSKM7eQIaO7mu+zkAWAsArwPA45oXdPNTAxutaillsTqoKIruW7CfGqRdpRaHReSj2lvo8scezyDiY1qc7dda9axC3W64UD+3+Q/fZENVhTDr2gAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusion:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABphJREFUaEO9WmnIVVUUXSuiuahopOLLIqTBBgtCC01Ty8JmS/sRVESBNgiVJVZaaag0WBlGYNEPrSyiQdTKskEjpNKSCBqlzAqJSAsbYMV67vt13/3uffe+93pvw+Mb7rn77HXOPntY5xEdEkkHAjgk1G8k+VMnpuL/oVTSaQDOBnBmGG3DfwHwXeg/DMC+ADbGZwWAZSRXtTt/ywAk2eDLAIwAsAXAkvjY6O9J/pk2TtLOAA4FYDDnxmdPAG8AeJbkslbANA1A0gkAbgJwKYA5AJaS/KCVySWdCmA0gFsAPAfgIZLrmtFVGYCk3QBMDeNfAjCb5MfNTFY0VtJJAG4FcL5BALiX5B9VdFcCEBPMB7ALgPtIPlNFebNjJI0DcDuAbQCuq7JApQBC6SIAiwFMJPlzs4Y1M17SAQAeBTAWwPiyxWoIQNJdAKbZbUjObcaQdsdKujHcaTpJ25ArhQAkDQKwmmTpLrVjrKQdANwJ4FOSL2R1SRKAwSTfz5sn1zhJhwP4BsAokq+3Y2CjdyXtBMDueRGAv32ISS7NhN+RAF4D0I/kt1l9fQCE0lcArCPpyNARkbQrAAeD81IT/ArgQpIrMyBmA3D4HkPyr/SzPAAzIzYPJflbJ6yX5ARm48/J0f+DdySdWyTtBeDtyDlTCgFEkrKvXVV2+lsFJmmfMH5UAx1fAriY5CfJmIiGCwAMSie7u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kaxlUUjr5JMY6gt3QluX/eYZLlJ6k+KvUUkpyqj8+OirH300pALWiLSHAJJnVMK/kusqs9RqSTjptS3C0+S1lrF5TTX266uw0gxf2FTf1McDkUWVapZsAKtEqAcIu4FJhZBkT3S0AwVib4lxCspjYCgC+yLBf+0DXYnuRdBGAI5trK+efuouPInLXodMhtCGt3g0AKZp9YB5f1Yhe923JokaHs0sATK8XXnSUXXAkbWEuzd6oXm83ZkpKaPVpSY7J01l6eZFcdESX5cu3jjDWiXHBRLvpcV1WeLGRjC8FEAfbienx6JZmdZC5tttOBuBkeW3ehUZ2FyoBCBAurWv3ZdEPd/Ka1W5Td5FR5JKVAaS2OHvRbX6mJT41eE5TM52/6M6uQNDxlzvhAdga91gusat81cDVquurPQA4QS3s2lcN8rYyyOGzfLdQ8cseLsiWu7NrN1o17UJVJ+zW123+BfogD+TkdLQFAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusionActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACItJREFUaEO9Wn+MVNUV/s59+wOqyM7bFaxAsDBvFqnWak0MYhBQUEqUVssi/aNJawg7bxaKScFqqKyt0gip4sK8XUKqjX/IL43RlqBSxLZWYqwWdWNh3oIlFClkebMUaXfZefc0983MMjv7Zt7MLrvvn93MPec753v33HPuPfcRhukZt+3YeCndCQpeCO3kmWVTTg+HKbocoKHWjpnEuBfMd4GgnJ7ADAcCJzx8iUlE0AGcBOMkiPYz4c1kNPzXodofNAE9fvheQCyBoLvBOA/wHunSHq7CiXM9+BdWGj39nGuxq8dWYyJdxCSh8UKAFoIwBpL/CMidTmzam4MhUzaBmpYjNwmNVoFEA9jdSEx7zzZFPhiM8dotiduYeAFIWw2Wu6TLm7pW1n9SDlbJBK7d+rev/c8du5aAVQC/Lok2dEWNv5djrJBsTat9s2BeA9AiBjaN1s499eXyW/9bCnZJBNIG0AbQ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CLX79qoKt8+zFRrH2+ogQsGwudtFR/IIjeyws0GYvtl8fajbKttVBaM7WGD/MwMuL7EUHwBuRoqeGq2PdV1C9TjSvBWh1sYuNrHwgAS+9pi88tgIYx0TPDFfnOhO2jwI4Iym13O9CI38WSiLgKe1qrwp1VjePxDVrsq6nOf8io1BIlk4gg5B/0S01emew/VSvz+ny3BG56M5/A6odz6T9kIB5DHwFxtsssbuUTw1IYDEI8wm4koF9xO7LI/apgd9UquYwS74HzHeU+LHHeyToLdWcHWq2KjuESjU4Up/b/B9u0kgtWdqPkwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusionActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACJpJREFUaEO9WntsW9UZ/33HaZJCX7S5TmhalQ1NaAzGYJUgvk7pe5QKusGa0v0xaZvQkKBbK60BWl/b8XWKaLWtUJg6IcG0P+hrCMHWlcdK2OLrFPFYGdU0ac+q9BHfFPoC2sQ+33SufVPXvfa1kyaWolg+3+t3zznfd87vu4Qx+nQfONc8yF+0KvP1NPHoxjsm9Y+FK7oSRo2+fh0I3AUpFwHUyoxWIv6EiI4o+8w8m5mmE+EowEchxH4g95rZ1myN1v+IAUR6M3eRwCqAFgM4C8ZeZuyFmHDk9OmpH2+7my4UB7fmj9wwderpWZBDs4mwHOoPmAzwn1hiV7I9+NpIwNQMwOjtvwWC1gLUwVJuIfA+s73lnZE4N3pP3M6gZSTEeoB3Q/JWs735w1psVQ0g/t6xq+T5uogkrCXQKyDebIaCf63FWTlZI525FUydDF4hGFtFYzYZnzvz82psVwVAOSCI7QA3MuMJU9d2VmO8VhnDsh8gwuMAnWfIh6p5QL4AlFEAO5ixp45yj8T1lkytgdUiH7dOBLMceIYIKwGs9ntYFQFELDtGQJyJ1yZDwadqCWS0spF05qfEtJWl7Eq2N8fL2SsLwLBOtgEybeqa7yyNJthYjE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VeJTAGSFyP/ZqaJQ+7qoAKCXV+OBTdnw82qw0TYuXNjLKrZOqAbgGShvdLOitkfKpiuckyQvHpdFd+gQUHQ9B3yPGEhDOAfwGS9pT1asGgldCNTgYk5igCtSL4/aqgddUKnIY4G8xc7ialz2IKAXQ64qcHW22qnkJVetwvF63+T9nAHfjRfzL0gAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-logSave{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA1RJREFUaEPtmT1oFEEUx9/bFLFKJzG2WiknZObFxlO8RtFC8SuFWlrYGBtRRNCghV9YmFQWgoVaaAS1ULRRRKvbmYBBQezVYBOIGFMkT0ZuYXPufOxdspuDO7jibmfe/H/z3sy8eYvQ4R/scP3QBSjbg8EemJyc3La4uHgUETcx82YAWNum+N8A8IWZrxLR41ZtBQForUeY+Xarg/j6MfMVIrroa5f13AuglOJWDLfQ56aU8mzefk4ApdR9ADiW12ir7RFxXAgxkqe/FUBrvYeZXzQbY+bh3t7ed5VKZTrPQM2eNHYQ8VGGjTtSypOhtq0AcRyPIeKptCEppTfkbAM3AxhbcRwfyYJg5nEiCvKEVZBS6hUA7EoEIeJ+IcTz0JlpbpcFYNrYIBDxlhDijG88lwd+IGJ/YoCZ1xPRd5/BUA/Mzc31VavVWRcEM18jovOuMV0eWLL7tBM+RoBS6isAbEzERFFUHRwc/JD8dnjishDikg2iSIAJADiU8uhdIjqRFuZYEweI6Gmuc8AWs6EhVK/XR3t6eg4zMyKiEQ/MvOSwQsS3iHhhZmbmY61W++UIp/dSyu2FAmit3zDzTjMoItaFEFuVUt8AYCB0ElLtZqWUfYUCZHlQKXUQAJ60AAC2Nbhia8AWglprAoB7jYQwmGXVACSKzRqJomgLAJjvBh/JqgPwCQ7dRAoPIZ/w5HkXIHQGQlOHvCd56PjdEOpoD6TShT/MfD19OXeFQCPnOYeIaxYWFiaGhoZGQ9Pv5nZthVA6XWjkOsMJRGj+b/IhIURtVQCkIUJvYKUCONLf/+67tjuw+T+rLlTYLmSDCDmwbOIbF6CgC1Vba8B3m3JBuMQXDuC4iGQy+MSXAhAKESK+NAAfRKj4UgFsEHnElw5gBGit9wFAUqy9kbco1vY2Gsfxsha2QrbV1K42gIimAPDvw8zTRLQuy0ZhpcU8AMZ7zPws1ee1lHJ3LoDlLu7mAcioZFuLvYWV130AU1NT/fPz8zuyqtWIuFcI8TKXBxo7QaEvOCyQD6SUx20T4K33F/iKKVOj7yrqBWhsiSv6ki8zNBBPCyHGfKEXBGCMrMBr1mZtPxHxEzN/jqLoYbr07oIIBvDNRFnPuwBlzXwybsd74C95KWhPrxIhsgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-logSave:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAthJREFUaEPtmTuMTUEYx3//TrWdeLRUJCrReISGUBCvLVAqNGiEiASh8IoClUKyBQqPBAWhsREqnYRE9NgoV0T3yci5m9mzc2bmnHvvOXuTO8ktbs7MN//ffPP45hsx4kUjrp8xQNcezPaAmW0EDgFrgLXA0j7F/wG+AlckPW5qKwvAzE4At5p2ktHusqTzGfUWVEkCmJk1MdygzQ1Jp+u2iwKY2X3gcF2jfdS/I8l5O7tUApjZTuBlwNIk8E7STHYvQMCTzs6jgI27ko7l2o4B3AaO+4YkJadcVcdlAGfLzA5WQGR7IgbwGtjuCdoj6UXuyJTrhQBcnQjETUmnUv3FAH4CyzwDKyX9SBnM9QAwIWk2AXFV0tlYnzGAebtPP9OnEPkNWO2J2STpQ+9/xBOXJF2ogmgT4Amw3xNyT9JRX1gEYq+kZyGIoQGY2UXgAPyPt5x4V8qH1TRwDvgk6XdkOr2XtLltgLfA1qLTj5I2mNl3YEWDdTQraaJtgAVryMz2AU8bAFC1Boc5hYKbgJmtB6aKgDCbZdEAeLuOWyPrit+qFMmiA0gJrjr4yu1an0Ip4Z6Hss6hMUBu6FD3JB9PodwRGGkPeOHCX+CafzmPDUAR85wBlrgwQ5LbUueV3AHsaxGbmR8uOAGTPYga8f+0pG2LBWAOosYNrFOAqith6L5bdQee81optG7nHIjE8DlnVlB8EVa3AxCJ4VMAleJbB2gAERXfCUANiKT4zgAyILLEdwoQgcgW3zlAIWA30EvWXq+bFBvESTzQxFZqSyqdAe7i7xIAvTIjaXnIRmupxZoAznvPvTZvJO2oCzDQ5G5NgPKbRGWyt7X0egrAzFwedktFtnqXpFe1PFAsxLYfOEIaH0g6UjUAyXx/i09MQY2pq2gSoPDEsB/5QuJPSnLrMFqyAAqIQT+zloX9Aj4DX4CHfuo9RpANkBqJrr6PAboa+V6/I++Bf0in3kCazcMZAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoom{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAkUExURUdwTMDAwL+/v7+/v7+/v76+vr+/v7+/v7+/v7+/v7+/v7+/vxtcv/AAAAALdFJOUwBVdZCpGdZE7C3B0wnY6AAAAV9JREFUOMt1lDtPwzAQx20ghGwVsHVJhQRDlsywWKqEULsw8FhRJ2iWiglGGJvFCw8xIVVCSEwkKU25L4ftpOHs2Cclsu7v370smxCLecRh+xOH8Ja5kGEs/6dtYf1XONcWZurbwwRCQjYZ9l7uHAPAOBHpI1QC/QSY9g84ldmnAn7Z3htwsfZnvSe54eJd5hlcC7gccxTwSETZEr5+714vLRdfkFraVNtetXLpR7ha+mkHCV1Y/q8ZOW8AgDkecsIaAEIcGbIGyLUq4KcBYl0o7QAB4FZACBMrQKpaJOCZQqyAIhgayYEpgD1DZghXCvBTNJFKmCvgzmhcCEsBwMjSRx6BslYftRX0JLYKrAsLqzDC54EFMwvy58QhMM8hFNq0UpwET+sLC9/4BmEBTytyRCIbDoAEiR1Qp1dbRxfoyv9g3ogaKVuXhVZZbtqX6Ez6H23PxG4CM259QDwt/h8ABfK8nDqSAAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoom:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwCCyreU7KZVRCDaZnETLwj6WaYVAAABUUlEQVRIx5WV2Q6EIAxFoVBWxf7/184AOnGUsvTBqDmXrqRCzNou1kwGtyZIQNuiD0P6evWTURFUMtIoPO+iVoGIZPkMqkdKA0jZgoJ6suQc2EoiGBldOoQ9HSDk5+GTs1Fqo9IlcEpvNv3qv0MBhSalIFSv3+MCJCY8fUaCxasycrMu9dp5VTUhubXZ6CqsAvn66ZAsx+e8fON37oT3bZ4aiRU0kDlavGSrQI95HPBZACt8FuCL16IruBVkzBeBW+CLYHvyfiDQd96IpHpOMqP++fAq9VMQ7rwrM5+6gjwG/3y/D/m8ylPYpvpAeqO7DfvwMPO9D6jnBabG56YFZx77fEjD+9AyLdYEhp8nxoNh5wmJtfY8AS+wzIZZrJNcC4h3wV8IH1p87Iyfnc6XVaAd7ICHAsebw97zgDSxZ/yvViiPuYUfTe650knM2+7Ywz9yOCklzohLOwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoomStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwDjmTC6Y0KBVakX8s8iC3JYR1wyAAABVUlEQVRIx62V2baFIAiGcwJRS97/aU/Zbtht0VzrcJOuvl/AAabpXy1RF0F/m2h2PX5mzucEuO9gMon1MY7KlG8w4LImC1XFQmxDGVkm1DYpXi0qS1gXTEGzKoqNS1ajAxPqJDikFLcFS+aukYJffRfXnAj9kYUXFVi86wzzPjuCFRXBwS3KaC/Pt02Ww7uf1jz3BVYtX/OsyDQFDn7yswPXb+Ovs39eJJWwxrOXV4thgC+//QBf/uMAXwAa4AuRBvgdWR58CB2B+eaRG5e8QO7Jn2sIAvzhbdsDnXzev8q0BengGXv8EciH3y1CY5++yI/BRNx82g/La7lc7b0Am/tUC6n3HoZ4SbDyy5BgzSNivV6wbPXeIPOpHlOU+CjkTQKvQOpXdRdJvn+5xttWQa4EZUOzluonT6+q72X6Zb0+T/lNhQd7hg9vm8LWUhW5gT4iN7c/0ZUo8Q3AttYAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoomStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAqUExURUdwTBKV2hGW2xKW2xKW2xKW2xGV3BGW2xGW3BGX2xKW3BKW2xCX2xKW2yDN61kAAAANdFJOUwCAVKxm3T/DmhrxKw97YQBGAAABaklEQVQ4y2NgIA6wGqCLMCqAqV4HdIm9F0Ek22UMM9hiG4AkVzQDA+cmx+YyJJnDlw8wMNQaNpfevbu0QgxJgrN3JQPD3VvhjU57kESnOZqvvXuJgcEXxVFMEkDt1w11gZYwoVgue3d5SzaQSgCydZG1TMkBU8vBuq9guBcqNBNDgj0GQrMEb0CVYEmA2ViANRQZ795tQPZduADciXcVUNSthGu4hGrAJawagBIXsWoAClzGqgEocRWrBqDIrQNQDTPRXZ8A0cB41wBNQgGiQfbubTQJAagGDB0GIA0OsnevbkCTCADiu4J374ahW34JqAEIbiXMRJOAgkvMKJYgJBx6717AKiF4F4eOu+jxgQCXGHBIKPDgkBC8JYCURJDtQHYWN4oEcvpZiyR+C9lZtkgSKKG1CyGOGrxItleixjrcLFBWRAYcMIkG9NQMiY67N7AlcxAQwMwA6SBxM2xZQ3jtVRPsRQ83sg8ACMIUxzzE8wsAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-close{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTM3Nzc7Ozs7Ozs3Nzc3NzcrKys3Nzc3Nzc3NzePZJxkAAAAJdFJOUwCtKdPBGAmNTt3jdDcAAADfSURBVDjL1dOxDoIwEADQgwR07GTCZtI/IGHgAzBhM9EPkMTB0Y3V0ZXIcn/rtRR6pefgSKeSu3ellyvA9lZ/5F9p/3K7PZY8oPG5BD6MpPUSgIITzdIStifAshjRQV1PCFT8TxaicTzzwEwINOEdHVmDmcTAkRhMhMAp7iQRjcMtDhCp8SA1v0ARGIIK/gnkv0p1OBTS4QRUIpE7DiYYXTBrzcld3JIrAarXrps4AVNwRSZgExoJmIyAaAdsShUMn/JF2fh4YEkpAcgvnuwYCIb6EbbbP4PsDfLD2dD6Av1qTvAQlzUTAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-close:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTP///////////////////////////////////8kBMKEAAAAJdFJOUwCt0igUwJdJePGbgLgAAADcSURBVDjL1ZMxEoIwFESTCaOWFDapqeicnAALTiANnaWlnVewDTMW/7b+aCAb8jkAVIHN2/lsNkrt73lf8M08nnF1pAYFR/dFmAAx7SIoi4iDbRrWDMAuQFzmmxAGbjjJgjj6dCjMCAND/o8RWQMzUgIRKYE/wsC5TJIRR74rBUZaqqXwLZEXT0WTDGwLW1aavJWQir9qadw++NgykW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chxnhzHmIgCw3V6xWYoiURYBa9h13atTqdTssJxNEoEImQeJaIV/LimJsgkUjCilLrGXToho33mFrmoMod2I+LLneW9KKb8Nk01CotcE/AaVUmOFENcz8zgAGAIA54Y4dAgADiCifejtjcQnSSIWRgIAniIi+5q3cm/q/c40NzfX9e3bd4gQ4kxEPFhbW3sgnU7/lcThJJHwV8kViUBvHStHz0aCme2qe7W1tasbGxu7rkFPGQKR50Q5q/B/lP0HjgOoT/ydvaYAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-narrow:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABS1JREFUaEPVmgmoVVUUhr+fosKC5ogGSsqIpKQwMqjIBpsICdMGQ7ISo4wGApugJCoxLClssElpNEuaI5okKjOI5onKhEQrSiKiaKA/Vu3zOu+8c88593qvj7fgcO99e6/h33udtdda+4khThri9tM1ALaPAQ4Btso9GwNfAyuBb7JHUnzvCq0XANuTgePSs00bFr0L3BuPpF/b4BswtSMAyfDzgYPXRznweQ7ID53IaguA7ROBGcC4TpRV8IRL3SNpVrtyGwOwfVYoaaHgW2AZsBT4CliXnt+BXYBd02d8D5c7rIWc+ZJigRpTIwC2rwauKZH6NLBA0jONNQK2jwJOAU4FtijwPgpMkRTga6kWgO2XgSMKkjoyvGiN7d3SwpxZGHsVOEPSmjoElQBsPwScVhAyR9LMOsHtjNu+Hri8wPMBMF7SqipZLQHYvgq4tsA8S1KZK7Vjb+lc24cDsfJ5ul/SlLYBpGjzVIFxsaTw2Z6R7S2BnwoKpkta0Epp6Q7YfqEQKl+XdGjPLM8Jtn088GzuT9/FOyjpkzL9AwCkQ+qB3OSPki9GOrBByPZ1wBU5ZY9LOrkpgDcLJ2zlFvYCke2NgFcK58VkSRFU+lG/HbA9EYg4nNE7kkb3wsg6mSWesEhSMdz2z0Zt3wRcnBO+wVc/0217WMpesyRxraSd6nbg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YIQ/gH99H3EBePlczAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-expand{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABvJJREFUaEPVWWmIXEUQrnqzZseYxGM9QBNF4hrJEDfzqieuAY/gFRXPyMYbzUHwQBQUzx+KeBAJKhrRqEhEQWMU75AYXREPlunu3bjxIDGraIwiuJpFkL26pMK84eXtm3lvZieGFAzsTtf1VVd3V9Ug7OOE+7j/0BAAnZ2d2UmTJl2cyWTaAOBA+TDzgYjYDAB/y4eZ5fNjc3Pze7NmzfqlUYEbFwBr7TUAcAEzXwAA2bROIeKnzrkNALBeKWXTysXx1QXAGHMVANwEACePxzgzjyLi057nrczn81vr0VUTAGOMRPtmRDy7HmOVZBDxL+fcyr6+vgc7OjqGatGdGoC19hZmfrKC8t9LafEWAGzLZDL9g4OD/S0tLYM7d+6cyszTPM+biojy97kAcGoFPV8ODw8vbG9v354WRCoAxpiXAUDyPUrvAcAqIno/rUHhs9aeCQALmflyAJgUlkXEf5xzp6U9G4kAjDHcKMejeqy1xzDz/QBwXYyNViL6ISkwVQEYY74AgLkRJcuJ6M4kxbWsW2sfZua7ozJNTU1HtLW1/VFNV0UAxpjlAHBHWNg590ChUJCINZyKxeLpnud1RhSvmzJlyiWtra2DFS+AuAW5bQDg3cja60QkObvHSGstj588fGVi5heVUktqAqC1Xh+5Kj8nolP2mOchxd3d3ec55z6I2JpPROvj7I9JodIj9UqIebNz7qJCodD3fwAQG8aYhwDgnpC99UQ0Py2ALyMv7DIiWvV/OS921qxZk5k+ffon4fcCEZf4vv9i1I/ddkBrfSUivhpiMkSkanXeWnsFAFwCADNHR0fX1nPwYzJhAxGdkwTgJUQM38l1Rd8Y8yYAXFoytoOIjqo1CFrriQDwCyIeEsh6nndsPp//KayrvANbt25tHhgY+AsA9i8x/JvNZqfmcrn+Wo1bazuZ+fRAjogS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NyS0UHS/KLF+2+NNqeRp2rlgs5jOZjDgtL+wBEcdlEv0oIi4O9xnVQKQCIEZkTuN53uqgZ4iJmMxrPkTEbXL4AECaceldj3POtSLicVKayP9x0UZEGSY/6vv+V9ZaaVHXpAGRGkBgtFgsnpXJZK6Ly9l6Uqkkcy8RlUsY+S4tiJoBBE5qrU9CxKvlZ1YA2G3UkRJIr4wxnXPvKKXGnLG0IOoGEHZSnn5EvIiZTwKAowEgrh39U2orRJRDLxOJz9IAjdsJAHiGiORn3sb8Uh91ZNOmTQeMjIwcjYgHIeJvEyZM2JHL5Wr6+TSsMwoCEVf4vr+re2zIDqSJ5Hh5BAQzS9R/IiJpf3fRPgOg4jsx3sjsbfn/AH37LF5g3/BiAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-expand:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABYZJREFUaEPVmXmoVVUUxn8f0WRzVkJlIWVGUmIJWWADTVaUldFclCnSQBQYNv1RSCWGVFRSlkRh0GBS2YBmJWGJUBHNNJiYWQSZfwTRxBfrce5jv/3Ovefc++4z3oKLD/fea61v7bXXdMQQJw1x/ekKANs7AOcA44Ddkt/2wJbk9z2wTNIP3TLcgADYvhw4q/gFiLq0ClgBLJf0Ud1DZfs6AmD7UuA64JiBCAf+BR4GHpH0TSe82gJgO6x9PXBqJ8JanPktQABzJP3VDu/aAGzfADzYhPnPQLjFUuA7YHPx+xPYHxhZ/Bt/nw4c14TP+8CFkjbWBVELgO2ngfD3nJYBCyW9Wldg7LN9cigKXATsnJ39HTi+7tuoBGDb3VI852P7QOBO4MoSGaMlfVtlmJYAbL8HHJsxmSdpdhXjdtZt3wPcWnJmhKRfWvFqCsD2PODm7PBdksJiXSfbJwDvZIzfAM6VFG+plEoBFNHmlezEc5LCZweNbEcSjMSX0iJJ09sFsDwLlaslTRo0zRPGts8AXstkTZY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K75QpHpPouUAkvrTPaAqiFoACRMxpwuqNniE3WsxrXk++0EQzHr3rwVGSZP+WGTymD3MlrbEdLerzdUDUBtCQaDvSeXyQKPPZTrwpztwuKS1h4tZrgWgbQALkaOCy4hNrn1FHTRTxdmKQ8LKksjdWC0THADK/jtQ/BQhQBwBl7Wi4VNRWoXhMJN6tA7TJTSyQFJ95u/OlPlfEdjzOALI7EIVgzEfb+nyaGSh3p4h+Pd1jV26gjiUHuqe4ibD6eklRqvfQkAHQzABDHsB/7aMVT352GH8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-menu-icon-text,.jb-pro-container .jb-pro-quality-icon-text,.jb-pro-container .jb-pro-scale-icon-text,.jb-pro-container .jb-pro-speed-icon-text{font-size:14px;min-width:30px;height:20px;line-height:20px;cursor:pointer;text-align:center}.jb-pro-container .jb-pro-speed{box-sizing:border-box;text-align:center;font-size:14px;color:#fff;width:90px}.jb-pro-container .jb-pro-menu-list,.jb-pro-container .jb-pro-quality-menu-list,.jb-pro-container .jb-pro-scale-menu-list,.jb-pro-container .jb-pro-speed-menu-list{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;overflow:hidden;width:-webkit-max-content;width:-moz-max-content;width:max-content}.jb-pro-container .jb-pro-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-speed-menu-shown{visibility:visible;opacity:1}.jb-pro-container .icon-title-tips{pointer-events:none;position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:rgba(0,0,0,.5);border-radius:4px}.jb-pro-container .icon-title{display:inline-block;padding:5px 10px;font-size:12px;white-space:nowrap;color:#fff}.jb-pro-container .jb-pro-quality-menu{padding:8px 0}.jb-pro-container .jb-pro-menu-item,.jb-pro-container .jb-pro-quality-menu-item,.jb-pro-container .jb-pro-scale-menu-item,.jb-pro-container .jb-pro-speed-menu-item{display:block;height:25px;line-height:25px;margin:0;padding:0 10px;cursor:pointer;font-size:14px;text-align:center;width:50px;color:hsla(0,0%,100%,.5);transition:color .3s,background-color .3s}.jb-pro-container .jb-pro-menu-item:hover,.jb-pro-container .jb-pro-quality-menu-item:hover,.jb-pro-container .jb-pro-scale-menu-item:hover,.jb-pro-container .jb-pro-speed-menu-item:hover{background-color:hsla(0,0%,100%,.2)}.jb-pro-container .jb-pro-menu-item:focus,.jb-pro-container .jb-pro-quality-menu-item:focus,.jb-pro-container .jb-pro-scale-menu-item:focus,.jb-pro-container .jb-pro-speed-menu-item:focus{outline:none}.jb-pro-container .jb-pro-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-speed-menu-item-active{color:#2298fc}.jb-pro-container .jb-pro-volume-panel-wrap{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%) translateY(22%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;height:120px;width:50px;overflow:hidden}.jb-pro-container .jb-pro-volume-panel-wrap.jb-pro-volume-panel-wrap-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-volume-panel{cursor:pointer;position:absolute;top:21px;height:60px;width:50px;overflow:hidden}.jb-pro-container .jb-pro-volume-panel-text{position:absolute;left:0;top:0;width:50px;height:20px;line-height:20px;text-align:center;color:#fff;font-size:12px}.jb-pro-container .jb-pro-volume-panel-handle{position:absolute;top:48px;left:50%;width:12px;height:12px;border-radius:12px;margin-left:-6px;background:#fff}.jb-pro-container .jb-pro-volume-panel-handle:before{bottom:-54px;background:#fff}.jb-pro-container .jb-pro-volume-panel-handle:after{bottom:6px;background:hsla(0,0%,100%,.2)}.jb-pro-container .jb-pro-volume-panel-handle:after,.jb-pro-container .jb-pro-volume-panel-handle:before{content:"";position:absolute;display:block;left:50%;width:3px;margin-left:-1px;height:60px}.jb-pro-container.jb-pro-fullscreen-android-rotate .jb-pro-controls,.jb-pro-container.jb-pro-fullscreen-web .jb-pro-controls{width:100vh}.jb-pro-container.jb-pro-fullscreen-android-rotate .jb-pro-play-big:after,.jb-pro-container.jb-pro-fullscreen-web .jb-pro-play-big:after{transform:translate(-50%,-50%) rotate(270deg)}.jb-pro-container.jb-pro-fullscreen-android-rotate .jb-pro-loading,.jb-pro-container.jb-pro-fullscreen-web .jb-pro-loading{flex-direction:row}.jb-pro-container.jb-pro-fullscreen-android-rotate .jb-pro-loading-text,.jb-pro-container.jb-pro-fullscreen-web .jb-pro-loading-text{transform:rotate(270deg)}.jb-pro-container .jb-pro-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;left:10px;top:10px;min-width:200px;padding:5px 0;background-color:rgba(0,0,0,.9);border-radius:3px}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu{cursor:pointer;font-size:12px;display:block;color:#fff;padding:10px 15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-shadow:0 0 2px rgba(0,0,0,.5);border-bottom:1px solid hsla(0,0%,100%,.1)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu a{color:#fff;text-decoration:none}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span{display:inline-block;padding:0 7px}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span.art-current,.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span:hover{color:var(--theme)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu:hover{background-color:hsla(0,0%,100%,.1)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu:last-child{border-bottom:none}.jb-pro-container.jb-pro-contextmenus-show .jb-pro-contextmenus{display:flex}.jb-pro-container .jb-pro-extend-dom{position:relative;width:100%;height:100%;display:none}.jb-pro-container-playback .jb-pro-controls{height:48px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center{flex:1;display:flex;box-sizing:border-box;justify-content:space-between;font-size:12px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time{box-sizing:border-box;flex:1;position:relative;height:100%}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-inner{width:300px;height:100%;overflow-y:hidden;overflow-x:auto}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-current-time{position:absolute;left:0;top:0;height:15px;width:1px;background-color:red;text-align:center;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-current-time-text{position:absolute;box-sizing:border-box;padding:0 5px;width:60px;left:-25px;top:15px;border:1px solid red;height:15px;line-height:15px;cursor:move;background-color:#fff;color:#000;-webkit-user-select:none;-moz-user-select:none;user-select:none}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll{position:relative;width:1440px;margin:0 auto}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.one-hour{width:1440px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.half-hour{width:2880px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.ten-min{width:8640px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.five-min{width:17280px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.one-min{width:86400px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-list{position:relative;background-color:#ccc;height:48px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-day{height:100%;overflow:hidden}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-one-wrap{height:8px;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-wrap{height:25px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-btns{display:flex;align-items:center}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one{float:left;width:1px;height:8px;margin:0;cursor:default;position:relative;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one.active,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one.active{background-color:orange;cursor:pointer}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one.start,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one.start{background-color:#999}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one:hover .jb-pro-playback-time-title-tips,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one:hover .jb-pro-playback-time-title-tips{visibility:visible;opacity:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips{pointer-events:none;position:absolute;left:0;top:100%;visibility:hidden;opacity:0;transform:translateX(13%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:#000;border-radius:4px;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips.jb-pro-playback-time-title-tips-left{transform:translateX(-100%)}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips .jb-pro-playback-time-title{display:inline-block;padding:2px 5px;font-size:12px;white-space:nowrap;color:#fff}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute{float:left;position:relative;width:60px;box-sizing:border-box;border-top:1px solid #999;-webkit-user-select:none;-moz-user-select:none;user-select:none;text-align:left;height:25px;line-height:25px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:first-child,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:first-child{border-left:0}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:first-child .jb-pro-playback-time-hour-text,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:first-child .jb-pro-playback-time-hour-text{left:0}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:after,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:after{content:"";position:absolute;left:0;top:-8px;width:1px;height:14px;background-color:#999}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour-text,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-text{position:absolute;left:-13px}.jb-pro-container-playback .jb-pro-playback-expand.disabled .jb-pro-icon-expand,.jb-pro-container-playback .jb-pro-playback-narrow.disabled .jb-pro-icon-narrow{cursor:no-drop}.jb-pro-container-playback .jb-pro-control-progress-simple{position:absolute;box-sizing:border-box;left:0;top:-2px;width:100%;display:flex;flex-direction:row;align-items:center;height:8px;cursor:pointer}.jb-pro-container-playback .jb-pro-control-progress-simple:hover{top:0;align-items:flex-start}.jb-pro-container-playback .jb-pro-control-progress-simple:hover .jb-pro-control-progress-inner{height:100%}.jb-pro-container-playback .jb-pro-control-progress-simple:hover .jb-pro-control-progress-inner .jb-pro-progress-indicator{transform:scale(1);visibility:visible}.jb-pro-container-playback .jb-pro-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:all .2s ease;background:hsla(0,0%,100%,.5)}.jb-pro-container-playback .jb-pro-progress-hover{display:none;width:0}.jb-pro-container-playback .jb-pro-progress-played{position:absolute;left:0;top:0;right:0;bottom:0;height:100%;width:0;background-color:orange}.jb-pro-container-playback .jb-pro-progress-indicator{visibility:hidden;align-items:center;justify-content:center;position:absolute;z-index:40;border-radius:50%;transform:scale(.1);transition:transform .1s ease-in-out}.jb-pro-container-playback .jb-pro-progress-indicator .jb-pro-icon{width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.jb-pro-container-playback .jb-pro-progress-indicator:hover{transform:scale(1.2)!important}.jb-pro-container-playback .jb-pro-progress-tip{display:none;position:absolute;z-index:50;top:-25px;left:0;height:20px;padding:0 5px;line-height:20px;color:#fff;font-size:12px;text-align:center;background:rgba(0,0,0,.7);border-radius:3px;font-weight:700;white-space:nowrap}.jb-pro-container-playback.jb-pro-fullscreen-web .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-playback-time-inner{overflow-y:auto}.jb-pro-zoom-control{cursor:-webkit-grab;cursor:grab}.jb-pro-performance-panel{position:absolute;box-sizing:border-box;z-index:10000;left:0;top:0;padding:5px;font-size:10px;background:rgba(0,0,0,.2);color:#fff;max-height:100%;overflow-y:auto;display:none}.jb-pro-performance-panel .jb-pro-performance-item{display:flex;align-items:center;margin-top:3px;color:#fff}.jb-pro-performance-panel .jb-pro-performance-item-block{height:10px}.jb-pro-tips-message{position:absolute;top:0;left:0;width:100%;height:100%;background:linear-gradient(180deg,rgba(0,0,0,.8),hsla(0,0%,100%,0));overflow:auto;box-sizing:content-box;display:none}.jb-pro-tips-message:before{color:hsla(0,0%,100%,.3);content:"X";font-family:Arial,Helvetica,sans-serif;font-size:40px;left:0;line-height:1;margin-top:-20px;position:absolute;text-shadow:2em 2em 4em #000;text-align:center;top:50%;vertical-align:middle;width:100%}.jb-pro-tips-message .jb-pro-tips-message-close{position:absolute;z-index:99999;right:0;top:0;width:40px;height:40px;display:flex;align-items:center;justify-content:center}.jb-pro-tips-message .jb-pro-tips-message-close .jb-pro-tips-message-close-icon{width:20px;height:20px;border-radius:10px;cursor:pointer;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTM3Nzc7Ozs7Ozs3Nzc3NzcrKys3Nzc3Nzc3NzePZJxkAAAAJdFJOUwCtKdPBGAmNTt3jdDcAAADfSURBVDjL1dOxDoIwEADQgwR07GTCZtI/IGHgAzBhM9EPkMTB0Y3V0ZXIcn/rtRR6pefgSKeSu3ellyvA9lZ/5F9p/3K7PZY8oPG5BD6MpPUSgIITzdIStifAshjRQV1PCFT8TxaicTzzwEwINOEdHVmDmcTAkRhMhMAp7iQRjcMtDhCp8SA1v0ARGIIK/gnkv0p1OBTS4QRUIpE7DiYYXTBrzcld3JIrAarXrps4AVNwRSZgExoJmIyAaAdsShUMn/JF2fh4YEkpAcgvnuwYCIb6EbbbP4PsDfLD2dD6Av1qTvAQlzUTAAAAAElFTkSuQmCC") no-repeat 50%;background-color:#fff;background-size:100% 100%}.jb-pro-tips-message .jb-pro-tips-message-content{overflow:auto;padding:35px;box-sizing:border-box;width:100%;height:100%;z-index:99999}.jb-pro-tips-message .jb-pro-tips-message-content .jb-pro-tips-message-content-item{font-size:14px;color:#fff;text-align:center;line-height:1.5}');class lc{constructor(e){var t;this.player=e,this.TAG_NAME="Control",this.extendBtnList=[],((e,t)=>{e._opt.hasControl&&e._opt.controlAutoHide?e.$container.classList.add("jb-pro-controls-show-auto-hide"):e.$container.classList.add("jb-pro-controls-show");const i=e._opt,s=i.operateBtns,r=`\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
00:00:00
\n
\n
\n
\n
\n ${i.playbackConfig.showPrecisionBtn?`\n
\n
${$h.narrow}
\n
${$h.expand}
\n
\n `:""}\n
\n `;e.$container.insertAdjacentHTML("beforeend",`\n ${i.background?`
`:""}\n
\n \n
\n ${i.loadingIcon?`\n
\n ${$h.loading}\n
${i.loadingText}
\n
\n `:""}\n ${i.hasControl&&s.play?'
':""}\n ${i.hasControl&&s.ptz?`\n
\n
\n
\n
\n
\n
\n ${i.ptzMoreArrowShow?'\n
\n
\n
\n
\n ':""}\n
\n
\n ${i.ptzZoomShow?'\n
\n
\n \n \n 缩放+\n \n
\n
\n \n \n 缩放-\n \n
\n
\n ':""}\n ${i.ptzApertureShow?'\n
\n
\n \n \n 光圈+\n \n
\n
\n \n \n 光圈-\n \n
\n
\n ':""}\n ${i.ptzFocusShow?'\n
\n
\n \n \n 聚焦+\n \n
\n
\n \n \n 聚焦-\n \n
\n
\n ':""}\n ${i.ptzCruiseShow?'\n
\n
\n \n \n 巡航开\n \n
\n
\n \n \n 巡航关\n \n
\n
\n ':""}\n ${i.ptzFogShow?'\n
\n
\n \n \n 透雾开\n \n
\n
\n \n \n 透雾关\n \n
\n
\n ':""}\n\n ${i.ptzWiperShow?'\n
\n
\n \n \n 雨刷开\n \n
\n
\n \n \n 雨刷关\n \n
\n
\n ':""}\n
\n
\n `:""}\n ${i.hasVideo?`\n
\n
${$h.narrow}
\n
电子放大
\n
${$h.expand}
\n
${$h.zoomStop}
\n
\n
\n
\n
00:00:00
\n
${$h.recordStop}
\n
\n `:""}\n\n ${i.hasControl?`\n
\n
\n
\n ${i.showBandwidth?'
':""}\n
\n
${i.controlHtml}
\n
\n ${i.playType===_&&i.playbackConfig.showControl&&i.playbackConfig.controlType===Q.normal?r:""}\n ${i.playType===_&&i.playbackConfig.showControl&&i.playbackConfig.controlType===Q.simple?'\n
\n
\n
\n
\n
\n
00:00
\n
\n
\n ':""}\n
\n ${i.playType===_&&i.playbackConfig.showRateBtn?'\n
\n
\n
\n
\n
\n
\n ':""}\n ${s.close?`
${$h.close}
`:""}\n ${s.logSave?`
${$h.logSave}
`:""}\n ${s.performance?`
${$h.performance}
${$h.performanceActive}
`:""}\n ${s.aiFace?`
${$h.face}
${$h.faceActive}
`:""}\n ${s.aiObject?`
${$h.object}
${$h.objectActive}
`:""}\n ${s.aiOcclusion?`
${$h.occlusion}
${$h.occlusionActive}
`:""}\n ${s.quality?'\n
\n
\n
\n
\n
\n
\n ':""}\n ${s.scale?'\n
\n
\n
\n
\n
\n
\n ':""}\n ${s.audio?`\n
\n
\n ${$h.audio}\n ${$h.mute}\n
\n
\n
\n
\n
\n
\n
\n
\n `:""}\n ${s.play?`
${$h.play}
${$h.pause}
`:""}\n ${s.screenshot?`
${$h.screenshot}
`:""}\n ${s.record?`
${$h.record}
${$h.recordStop}
`:""}\n ${s.ptz?`
${$h.ptz}
${$h.ptzActive}
`:""}\n ${s.zoom?`
${$h.zoom}
${$h.zoomStop}
`:""}\n ${s.fullscreen?`
${$h.fullscreen}
${$h.fullscreenExit}
`:""}\n
\n
\n
\n `:""}\n
\n
\n
\n
\n
\n
\n
\n
\n `),Object.defineProperty(t,"$poster",{value:e.$container.querySelector(".jb-pro-poster"),configurable:!0}),Object.defineProperty(t,"$loadingBg",{value:e.$container.querySelector(".jb-pro-loading-bg"),configurable:!0}),Object.defineProperty(t,"$loadingBgImage",{value:e.$container.querySelector(".jb-pro-loading-bg-image"),configurable:!0}),Object.defineProperty(t,"$loading",{value:e.$container.querySelector(".jb-pro-loading"),configurable:!0}),Object.defineProperty(t,"$loadingText",{value:e.$container.querySelector(".jb-pro-loading-text"),configurable:!0}),Object.defineProperty(t,"$play",{value:e.$container.querySelector(".jb-pro-play"),configurable:!0}),Object.defineProperty(t,"$playBig",{value:e.$container.querySelector(".jb-pro-play-big"),configurable:!0}),Object.defineProperty(t,"$recording",{value:e.$container.querySelector(".jb-pro-recording"),configurable:!0}),Object.defineProperty(t,"$recordingTime",{value:e.$container.querySelector(".jb-pro-recording-time"),configurable:!0}),Object.defineProperty(t,"$recordingStop",{value:e.$container.querySelector(".jb-pro-recording-stop"),configurable:!0}),Object.defineProperty(t,"$pause",{value:e.$container.querySelector(".jb-pro-pause"),configurable:!0}),Object.defineProperty(t,"$controls",{value:e.$container.querySelector(".jb-pro-controls"),configurable:!0}),Object.defineProperty(t,"$controlsInner",{value:e.$container.querySelector(".jb-pro-controls-bottom"),configurable:!0}),Object.defineProperty(t,"$controlsLeft",{value:e.$container.querySelector(".jb-pro-controls-left"),configurable:!0}),Object.defineProperty(t,"$controlsRight",{value:e.$container.querySelector(".jb-pro-controls-right"),configurable:!0}),Object.defineProperty(t,"$volume",{value:e.$container.querySelector(".jb-pro-volume"),configurable:!0}),Object.defineProperty(t,"$volumePanelWrap",{value:e.$container.querySelector(".jb-pro-volume-panel-wrap"),configurable:!0}),Object.defineProperty(t,"$volumePanelText",{value:e.$container.querySelector(".jb-pro-volume-panel-text"),configurable:!0}),Object.defineProperty(t,"$volumePanel",{value:e.$container.querySelector(".jb-pro-volume-panel"),configurable:!0}),Object.defineProperty(t,"$volumeHandle",{value:e.$container.querySelector(".jb-pro-volume-panel-handle"),configurable:!0}),Object.defineProperty(t,"$volumeOn",{value:e.$container.querySelector(".jb-pro-icon-audio"),configurable:!0}),Object.defineProperty(t,"$volumeOff",{value:e.$container.querySelector(".jb-pro-icon-mute"),configurable:!0}),Object.defineProperty(t,"$fullscreen",{value:e.$container.querySelector(".jb-pro-fullscreen"),configurable:!0}),Object.defineProperty(t,"$fullscreenExit",{value:e.$container.querySelector(".jb-pro-fullscreen-exit"),configurable:!0}),Object.defineProperty(t,"$record",{value:e.$container.querySelector(".jb-pro-record"),configurable:!0}),Object.defineProperty(t,"$recordStop",{value:e.$container.querySelector(".jb-pro-record-stop"),configurable:!0}),Object.defineProperty(t,"$screenshot",{value:e.$container.querySelector(".jb-pro-screenshot"),configurable:!0}),Object.defineProperty(t,"$speed",{value:e.$container.querySelector(".jb-pro-speed"),configurable:!0}),Object.defineProperty(t,"$controlHtml",{value:e.$container.querySelector(".jb-pro-controls-item-html"),configurable:!0}),Object.defineProperty(t,"$playbackTime",{value:e.$container.querySelector(".jb-pro-controls-playback-time"),configurable:!0}),Object.defineProperty(t,"$playbackTimeInner",{value:e.$container.querySelector(".jb-pro-controls-playback-time-inner"),configurable:!0}),Object.defineProperty(t,"$playbackTimeScroll",{value:e.$container.querySelector(".jb-pro-controls-playback-time-scroll"),configurable:!0}),Object.defineProperty(t,"$playbackTimeList",{value:e.$container.querySelector(".jb-pro-controls-playback-time-list"),configurable:!0}),Object.defineProperty(t,"$playbackTimeListOne",{value:e.$container.querySelector(".jb-pro-playback-time-one-wrap"),configurable:!0}),Object.defineProperty(t,"$playbackTimeListSecond",{value:e.$container.querySelector(".jb-pro-playback-time-second-wrap"),configurable:!0}),Object.defineProperty(t,"$playbackCurrentTime",{value:e.$container.querySelector(".jb-pro-controls-playback-current-time"),configurable:!0}),Object.defineProperty(t,"$playbackCurrentTimeText",{value:e.$container.querySelector(".jb-pro-controls-playback-current-time-text"),configurable:!0}),Object.defineProperty(t,"$controlsPlaybackBtns",{value:e.$container.querySelector(".jb-pro-controls-playback-btns"),configurable:!0}),Object.defineProperty(t,"$playbackNarrow",{value:e.$container.querySelector(".jb-pro-playback-narrow"),configurable:!0}),Object.defineProperty(t,"$playbackExpand",{value:e.$container.querySelector(".jb-pro-playback-expand"),configurable:!0}),Object.defineProperty(t,"$ptz",{value:e.$container.querySelector(".jb-pro-ptz"),configurable:!0}),Object.defineProperty(t,"$ptzActive",{value:e.$container.querySelector(".jb-pro-ptz-active"),configurable:!0}),Object.defineProperty(t,"$ptzControl",{value:e.$container.querySelector(".jb-pro-ptz-controls"),configurable:!0}),Object.defineProperty(t,"$ptzBgActive",{value:e.$container.querySelector(".jb-pro-ptz-bg-active"),configurable:!0}),Object.defineProperty(t,"$ptzControlCircular",{value:e.$container.querySelector(".jb-pro-ptz-control"),configurable:!0}),Object.defineProperty(t,"$ptzArrows",{value:e.$container.querySelectorAll(".jb-pro-ptz-arrow"),configurable:!0}),Object.defineProperty(t,"$ptzExpand",{value:e.$container.querySelector(".jb-pro-ptz-expand"),configurable:!0}),Object.defineProperty(t,"$ptzNarrow",{value:e.$container.querySelector(".jb-pro-ptz-narrow"),configurable:!0}),Object.defineProperty(t,"$ptzApertureFar",{value:e.$container.querySelector(".jb-pro-ptz-aperture-far"),configurable:!0}),Object.defineProperty(t,"$ptzApertureNear",{value:e.$container.querySelector(".jb-pro-ptz-aperture-near"),configurable:!0}),Object.defineProperty(t,"$ptzFocusFar",{value:e.$container.querySelector(".jb-pro-ptz-focus-far"),configurable:!0}),Object.defineProperty(t,"$ptzFocusNear",{value:e.$container.querySelector(".jb-pro-ptz-focus-near"),configurable:!0}),Object.defineProperty(t,"$ptzCruisePlay",{value:e.$container.querySelector(".jb-pro-ptz-cruise-play"),configurable:!0}),Object.defineProperty(t,"$ptzCruisePause",{value:e.$container.querySelector(".jb-pro-ptz-cruise-pause"),configurable:!0}),Object.defineProperty(t,"$ptzFogOpen",{value:e.$container.querySelector(".jb-pro-ptz-fog-open"),configurable:!0}),Object.defineProperty(t,"$ptzFogClose",{value:e.$container.querySelector(".jb-pro-ptz-fog-close"),configurable:!0}),Object.defineProperty(t,"$ptzWiperOpen",{value:e.$container.querySelector(".jb-pro-ptz-wiper-open"),configurable:!0}),Object.defineProperty(t,"$ptzWiperClose",{value:e.$container.querySelector(".jb-pro-ptz-wiper-close"),configurable:!0}),Object.defineProperty(t,"$qualityText",{value:e.$container.querySelector(".jb-pro-quality-icon-text"),configurable:!0}),Object.defineProperty(t,"$qualityMenu",{value:e.$container.querySelector(".jb-pro-quality-menu"),configurable:!0}),Object.defineProperty(t,"$qualityMenuList",{value:e.$container.querySelector(".jb-pro-quality-menu-list"),configurable:!0}),Object.defineProperty(t,"$scaleText",{value:e.$container.querySelector(".jb-pro-scale-icon-text"),configurable:!0}),Object.defineProperty(t,"$scaleMenu",{value:e.$container.querySelector(".jb-pro-scale-menu"),configurable:!0}),Object.defineProperty(t,"$scaleMenuList",{value:e.$container.querySelector(".jb-pro-scale-menu-list"),configurable:!0}),Object.defineProperty(t,"$zoom",{value:e.$container.querySelector(".jb-pro-zoom"),configurable:!0}),Object.defineProperty(t,"$zoomStop",{value:e.$container.querySelector(".jb-pro-zoom-stop"),configurable:!0}),Object.defineProperty(t,"$zoomNarrow",{value:e.$container.querySelector(".jb-pro-zoom-narrow"),configurable:!0}),Object.defineProperty(t,"$zoomExpand",{value:e.$container.querySelector(".jb-pro-zoom-expand"),configurable:!0}),Object.defineProperty(t,"$zoomStop2",{value:e.$container.querySelector(".jb-pro-zoom-stop2"),configurable:!0}),Object.defineProperty(t,"$close",{value:e.$container.querySelector(".jb-pro-close"),configurable:!0}),Object.defineProperty(t,"$zoomControls",{value:e.$container.querySelector(".jb-pro-zoom-controls"),configurable:!0}),Object.defineProperty(t,"$performancePanel",{value:e.$container.querySelector(".jb-pro-performance-panel"),configurable:!0}),Object.defineProperty(t,"$performance",{value:e.$container.querySelector(".jb-pro-performance"),configurable:!0}),Object.defineProperty(t,"$performanceActive",{value:e.$container.querySelector(".jb-pro-performance-active"),configurable:!0}),Object.defineProperty(t,"$faceDetect",{value:e.$container.querySelector(".jb-pro-face"),configurable:!0}),Object.defineProperty(t,"$faceDetectActive",{value:e.$container.querySelector(".jb-pro-face-active"),configurable:!0}),Object.defineProperty(t,"$objectDetect",{value:e.$container.querySelector(".jb-pro-object"),configurable:!0}),Object.defineProperty(t,"$objectDetectActive",{value:e.$container.querySelector(".jb-pro-object-active"),configurable:!0}),Object.defineProperty(t,"$occlusionDetect",{value:e.$container.querySelector(".jb-pro-occlusion"),configurable:!0}),Object.defineProperty(t,"$occlusionDetectActive",{value:e.$container.querySelector(".jb-pro-occlusion-active"),configurable:!0}),Object.defineProperty(t,"$contextmenus",{value:e.$container.querySelector(".jb-pro-contextmenus"),configurable:!0}),Object.defineProperty(t,"$speedText",{value:e.$container.querySelector(".jb-pro-speed-icon-text"),configurable:!0}),Object.defineProperty(t,"$speedMenu",{value:e.$container.querySelector(".jb-pro-speed-menu"),configurable:!0}),Object.defineProperty(t,"$speedMenuList",{value:e.$container.querySelector(".jb-pro-speed-menu-list"),configurable:!0}),Object.defineProperty(t,"$logSave",{value:e.$container.querySelector(".jb-pro-logSave"),configurable:!0}),Object.defineProperty(t,"$playbackProgress",{value:e.$container.querySelector(".jb-pro-control-progress-simple"),configurable:!0}),Object.defineProperty(t,"$playbackProgressTip",{value:e.$container.querySelector(".jb-pro-progress-tip"),configurable:!0}),Object.defineProperty(t,"$playbackProgressHover",{value:e.$container.querySelector(".jb-pro-progress-hover"),configurable:!0}),Object.defineProperty(t,"$playbackProgressPlayed",{value:e.$container.querySelector(".jb-pro-progress-played"),configurable:!0}),Object.defineProperty(t,"$playbackProgressIndicator",{value:e.$container.querySelector(".jb-pro-progress-indicator"),configurable:!0}),Object.defineProperty(t,"$playbackProgressTime",{value:e.$container.querySelector(".jb-pro-playback-control-time"),configurable:!0}),Object.defineProperty(t,"$tipsMessage",{value:e.$container.querySelector(".jb-pro-tips-message"),configurable:!0}),Object.defineProperty(t,"$tipsMessageClose",{value:e.$container.querySelector(".jb-pro-tips-message-close"),configurable:!0}),Object.defineProperty(t,"$tipsMessageContent",{value:e.$container.querySelector(".jb-pro-tips-message-content"),configurable:!0})})(e,this),e._opt.extendOperateBtns.length>0&&e._opt.extendOperateBtns.forEach((e=>{this.addExtendBtn(e)})),e._opt.extendDomConfig&&e._opt.extendDomConfig.html&&this.addExtendDom(e._opt.extendDomConfig),t=this,Object.defineProperty(t,"controlsRect",{get:()=>t.$controls&&t.$controls.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsInnerRect",{get:()=>t.$controlsInner&&t.$controlsInner.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsLeftRect",{get:()=>t.$controlsLeft&&t.$controlsLeft.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsRightRect",{get:()=>t.$controlsRight&&t.$controlsRight.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsPlaybackTimeInner",{get:()=>t.$playbackTimeInner&&t.$playbackTimeInner.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsPlaybackBtnsRect",{get:()=>t.$controlsPlaybackBtns&&t.$controlsPlaybackBtns.getBoundingClientRect()||{width:0},configurable:!0}),ac(e,this),((e,t)=>{const{events:{proxy:i},debug:s}=e,r=e._opt,o=r.operateBtns;function a(e){const{bottom:i,height:s}=t.$volumePanel.getBoundingClientRect(),{height:r}=t.$volumeHandle.getBoundingClientRect();return to(i-e.y-r/2,0,s-r/2)/(s-r)}function n(i){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];i.composedPath().indexOf(e.$container)>-1?t.isFocus=!0:t.isFocus=!1,s&&!e.fullscreen&&e._opt.hasControl&&e._opt.controlAutoHide&&(t.isFocus?(io(t.$controls,"display","block"),d()):(h(),io(t.$controls,"display","none")))}if(ho()?i(window,["click","contextmenu"],(e=>{e.stopPropagation(),n(e)})):i(window,"click",(e=>{e.stopPropagation(),n(e,!0)})),i(t.$controls,"click",(e=>{e.stopPropagation()})),o.play&&(i(t.$pause,"click",(t=>{r.playType===_&&r.playbackConfig.uiUsePlaybackPause?e.playbackPause=!0:Ko(o.pauseFn)?o.pauseFn():e.pauseForControl()})),i(t.$play,"click",(t=>{r.playType===_&&e.playbackPause?e.playbackPause=!1:Ko(o.playFn)?o.playFn():e.playForControl().then((()=>{e.resumeAudioAfterPause()}))}))),i(t.$playBig,"click",(t=>{r.playType===_&&e.playbackPause?e.playbackPause=!1:Ko(o.playFn)?o.playFn():e.playForControl().then((()=>{e.resumeAudioAfterPause()}))})),o.screenshot&&i(t.$screenshot,"click",(t=>{t.stopPropagation(),Ko(o.screenshotFn)?o.screenshotFn():e.video.screenshot()})),o.audio&&(ho()&&(i(t.$volume,"mouseover",(()=>{t.$volumePanelWrap.classList.add("jb-pro-volume-panel-wrap-show")})),i(t.$volume,"mouseout",(()=>{t.$volumePanelWrap.classList.remove("jb-pro-volume-panel-wrap-show")})),i(t.$volumePanel,"click",(t=>{t.stopPropagation(),e.volume=a(t)})),i(t.$volumeHandle,"mousedown",(e=>{e.stopPropagation(),t.isVolumeDroging=!0})),i(t.$volumeHandle,"mousemove",(i=>{t.isVolumeDroging&&(e.volume=a(i))})),i(document,"mouseup",(()=>{t.isVolumeDroging&&(t.isVolumeDroging=!1)}))),i(t.$volumeOn,"click",(i=>{i.stopPropagation(),io(t.$volumeOn,"display","none"),io(t.$volumeOff,"display","block");const s=e.volume;e.volume=0,e._lastVolume=ho()?s:1})),i(t.$volumeOff,"click",(i=>{i.stopPropagation(),io(t.$volumeOn,"display","block"),io(t.$volumeOff,"display","none"),e.volume=ho()?e.lastVolume||.5:1}))),o.record&&(i(t.$record,"click",(t=>{t.stopPropagation(),Ko(o.recordFn)?o.recordFn():e.recording=!0})),i(t.$recordStop,"click",(t=>{t.stopPropagation(),Ko(o.recordStopFn)?o.recordStopFn():e.recording=!1}))),i(t.$recordingStop,"click",(t=>{t.stopPropagation(),Ko(o.recordStopFn)?o.recordStopFn():e.recording=!1})),o.fullscreen&&(i(t.$fullscreen,"click",(t=>{t.stopPropagation(),Ko(o.fullscreenFn)?o.fullscreenFn():e.fullscreen=!0})),i(t.$fullscreenExit,"click",(t=>{t.stopPropagation(),Ko(o.fullscreenExitFn)?o.fullscreenExitFn():e.fullscreen=!1}))),o.ptz){i(t.$ptz,"click",(e=>{e.stopPropagation(),io(t.$ptzActive,"display","flex"),io(t.$ptz,"display","none"),t.$ptzControl.classList.add("jb-pro-ptz-controls-show")})),i(t.$ptzActive,"click",(e=>{e.stopPropagation(),io(t.$ptz,"display","flex"),io(t.$ptzActive,"display","none"),t.$ptzControl.classList.remove("jb-pro-ptz-controls-show")}));const c=Sa();if(t.$ptzArrows.forEach((s=>{if(r.ptzClickType===K)i(s,"click",(i=>{i.stopPropagation();const s=i.currentTarget.dataset.arrow;t.$ptzBgActive.classList.add("jb-pro-ptz-bg-active-show"),t.$ptzBgActive.classList.add(`jb-pro-ptz-bg-active-${s}`),t.$ptzControlCircular.classList.add(`jb-pro-ptz-control-${s}`),e.emit(ot.ptz,fa(s)),setTimeout((()=>{t.$ptzBgActive.classList.remove("jb-pro-ptz-bg-active-show"),Di.forEach((e=>{t.$ptzBgActive.classList.remove(`jb-pro-ptz-bg-active-${e}`),t.$ptzControlCircular.classList.remove(`jb-pro-ptz-control-${e}`)})),e.emit(ot.ptz,xi)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Y){let r=!1;i(s,c.down,(i=>{i.stopPropagation(),r=!0;const s=i.currentTarget.dataset.arrow;t.$ptzBgActive.classList.add("jb-pro-ptz-bg-active-show"),t.$ptzBgActive.classList.add(`jb-pro-ptz-bg-active-${s}`),t.$ptzControlCircular.classList.add(`jb-pro-ptz-control-${s}`),e.emit(ot.ptz,fa(s))}));const o=()=>{r=!1,t.$ptzBgActive.classList.remove("jb-pro-ptz-bg-active-show"),Di.forEach((e=>{t.$ptzBgActive.classList.remove(`jb-pro-ptz-bg-active-${e}`),t.$ptzControlCircular.classList.remove(`jb-pro-ptz-control-${e}`)})),e.emit(ot.ptz,xi)};i(s,c.up,(e=>{e.stopPropagation(),r&&o()})),i(window,c.up,(e=>{e.stopPropagation(),r&&o()}))}})),r.ptzZoomShow)if(r.ptzClickType===K)i(t.$ptzExpand,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Pi),setTimeout((()=>{e.emit(ot.ptz,xi)}),1e3*r.ptzStopEmitDelay)})),i(t.$ptzNarrow,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Bi),setTimeout((()=>{e.emit(ot.ptz,xi)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Y){let u=!1,p=!1;i(t.$ptzExpand,c.down,(t=>{t.stopPropagation(),u=!0,e.emit(ot.ptz,Pi)})),i(t.$ptzNarrow,c.down,(t=>{t.stopPropagation(),p=!0,e.emit(ot.ptz,Bi)}));const f=()=>{u=!1,p=!1,e.emit(ot.ptz,xi)};i(t.$ptzExpand,c.up,(e=>{e.stopPropagation(),u&&f()})),i(t.$ptzNarrow,c.up,(e=>{e.stopPropagation(),p&&f()})),i(window,c.up,(e=>{e.stopPropagation(),(u||p)&&f()}))}if(r.ptzApertureShow)if(r.ptzClickType===K)i(t.$ptzApertureFar,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Ii),setTimeout((()=>{e.emit(ot.ptz,Ri)}),1e3*r.ptzStopEmitDelay)})),i(t.$ptzApertureNear,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Mi),setTimeout((()=>{e.emit(ot.ptz,Ri)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Y){let m=!1,g=!1;i(t.$ptzApertureFar,c.down,(t=>{t.stopPropagation(),m=!0,e.emit(ot.ptz,Ii)})),i(t.$ptzApertureNear,c.down,(t=>{t.stopPropagation(),g=!0,e.emit(ot.ptz,Mi)}));const y=()=>{m=!1,g=!1,e.emit(ot.ptz,Ri)};i(t.$ptzApertureFar,c.up,(e=>{e.stopPropagation(),m&&y()})),i(t.$ptzApertureNear,c.up,(e=>{e.stopPropagation(),g&&y()})),i(window,c.up,(e=>{e.stopPropagation(),(m||g)&&y()}))}if(r.ptzFocusShow)if(r.ptzClickType===K)i(t.$ptzFocusFar,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Fi),setTimeout((()=>{e.emit(ot.ptz,Ri)}),1e3*r.ptzStopEmitDelay)})),i(t.$ptzFocusNear,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Ui),setTimeout((()=>{e.emit(ot.ptz,Ri)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Y){let A=!1,b=!1;i(t.$ptzFocusFar,c.down,(t=>{t.stopPropagation(),A=!0,e.emit(ot.ptz,Fi)})),i(t.$ptzFocusNear,c.down,(t=>{t.stopPropagation(),b=!0,e.emit(ot.ptz,Ui)}));const v=()=>{A=!1,b=!1,e.emit(ot.ptz,Ri)};i(t.$ptzFocusFar,c.up,(e=>{e.stopPropagation(),A&&v()})),i(t.$ptzFocusNear,c.up,(e=>{e.stopPropagation(),b&&v()})),i(window,c.up,(e=>{e.stopPropagation(),(A||b)&&v()}))}if(r.ptzCruiseShow&&(i(t.$ptzCruisePlay,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Oi)})),i(t.$ptzCruisePause,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Ni)}))),r.ptzFogShow&&(i(t.$ptzFogOpen,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,ji)})),i(t.$ptzFogClose,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Gi)}))),r.ptzWiperShow&&(i(t.$ptzWiperOpen,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,zi)})),i(t.$ptzWiperClose,"click",(t=>{t.stopPropagation(),e.emit(ot.ptz,Wi)}))),r.ptzSupportDraggable){function S(){t.isPtzControlDroging&&(t.isPtzControlDroging=!1,t.$ptzControl.style.cursor="grab",t.tempPtzPosition={x:0,y:0})}t.isPtzControlDroging=!1,t.tempPtzPosition={x:0,y:0},i(t.$ptzControl,c.down,(e=>{e.stopPropagation(),t.isPtzControlDroging=!0,t.$ptzControl.style.cursor="grabbing";const{posX:i,posY:s}=Yo(e);t.tempPtzPosition={x:i,y:s}})),i(t.$ptzControl,c.move,(e=>{if(t.isPtzControlDroging){e.stopPropagation();const{posX:i,posY:s}=Yo(e),r=t.tempPtzPosition.x-i,o=t.tempPtzPosition.y-s;t.$ptzControl.style.left=t.$ptzControl.offsetLeft-r+"px",t.$ptzControl.style.top=t.$ptzControl.offsetTop-o+"px",t.tempPtzPosition={x:i,y:s}}})),i(t.$ptzControl,c.up,(e=>{e.stopPropagation(),S()})),i(window,c.up,(e=>{e.stopPropagation(),S()}))}}o.performance&&(i(t.$performance,"click",(t=>{t.stopPropagation(),e.togglePerformancePanel(!0)})),i(t.$performanceActive,"click",(t=>{t.stopPropagation(),e.togglePerformancePanel(!1)}))),o.logSave&&i(t.$logSave,"click",(t=>{t.stopPropagation(),e.downloadMemoryLog()})),o.aiFace&&(i(t.$faceDetect,"click",(t=>{t.stopPropagation(),e.faceDetect(!0)})),i(t.$faceDetectActive,"click",(t=>{t.stopPropagation(),e.faceDetect(!1)}))),o.aiObject&&(i(t.$objectDetect,"click",(t=>{t.stopPropagation(),e.objectDetect(!0)})),i(t.$objectDetectActive,"click",(t=>{t.stopPropagation(),e.objectDetect(!1)}))),o.aiOcclusion&&(i(t.$occlusionDetect,"click",(t=>{t.stopPropagation(),e.occlusionDetect(!0)})),i(t.$occlusionDetectActive,"click",(t=>{t.stopPropagation(),e.occlusionDetect(!1)})));let l=null;const d=()=>{h(),l=setTimeout((()=>{io(t.$controls,"display","none")}),1e3*e._opt.controlAutoHideDelayTime)},h=()=>{l&&(clearTimeout(l),l=null)};if(e._opt.hasControl&&e._opt.controlAutoHide&&ho()&&(i(e.$container,"mouseover",(()=>{e.fullscreen||(io(t.$controls,"display","block"),d())})),i(e.$container,"mousemove",(()=>{e.$container&&t.$controls&&(e.fullscreen,"none"===t.$controls.style.display&&(io(t.$controls,"display","block"),d()))})),i(e.$container,"mouseout",(()=>{h(),io(t.$controls,"display","none")}))),e._opt.playType===_){let E=e._opt.playbackConfig.controlType;e._opt.playbackConfig.showRateBtn&&(i(t.$speedMenu,"mouseover",(()=>{t.$speedMenuList.classList.add("jb-pro-speed-menu-shown")})),i(t.$speedMenu,"mouseout",(()=>{t.$speedMenuList.classList.remove("jb-pro-speed-menu-shown")})),i(t.$speedMenuList,"click",(t=>{const i=Jo(t);if(i.matches("div.jb-pro-speed-menu-item")){const t=i.dataset;e.emit(ot.playbackPreRateChange,t.speed)}}))),E===Q.normal?(i(t.$playbackNarrow,"click",(t=>{t.stopPropagation(),e.playback&&e.playback.narrowPrecision()})),i(t.$playbackExpand,"click",(t=>{t.stopPropagation(),e.playback&&e.playback.expandPrecision()})),i(t.$playbackTimeList,"click",(t=>{const i=Jo(t);i.matches("div.jb-pro-playback-time-minute-one")&&e.playback&&e.playback.seek(i.dataset)})),e._opt.playbackConfig.supportWheel&&i(t.$playbackTimeInner,"wheel",(t=>{t.preventDefault(),(t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3)>0?e.playback&&e.playback.expandPrecision():e.playback&&e.playback.narrowPrecision()}))):E===Q.simple&&(t.isDroging=!1,i(t.$playbackProgress,"click",(i=>{if(i.target!==t.$playbackProgressIndicator){let s=0,r=0;if(e.isInWebFullscreen())s=i.touches[0].clientY/e.height,r=s*e.playback.totalDuration;else{const o=ec(t,e.playback.totalDuration,i);s=o.percentage,r=o.second}e.playback&&e.playback.seek({time:r})}})),i(t.$playbackProgress,"mousemove",(i=>{io(t.$playbackProgressTip,"display","block");const{width:s,time:r}=ec(t,e.playback.totalDuration,i);t.$playbackProgressTip.innerHTML=r;const o=t.$playbackProgressTip.clientWidth;s<=o/2?io(t.$playbackProgressTip,"left",0):s>t.$playbackProgress.clientWidth-o/2?io(t.$playbackProgressTip,"left",t.$playbackProgress-o+"px"):io(t.$playbackProgressTip,"left",s-o/2+"px")})),i(t.$playbackProgress,"mouseout",(()=>{io(t.$playbackProgressTip,"display","none")})),i(t.$playbackProgressIndicator,"mousedown",(e=>{t.isDroging=!0})),i(t.$playbackProgress,"mousemove",(i=>{if(t.isDroging){const{second:s,percentage:r}=ec(t,e.playback.totalDuration,i);e.playback&&e.playback.seek({time:s})}})),i(t.$playbackProgress,"mouseup",(e=>{t.isDroging&&(t.isDroging=!1)})))}o.quality&&(i(t.$qualityMenu,"mouseover",(()=>{t.$qualityMenuList.classList.add("jb-pro-quality-menu-shown")})),i(t.$qualityMenu,"mouseout",(()=>{t.$qualityMenuList.classList.remove("jb-pro-quality-menu-shown")})),i(t.$qualityMenuList,"click",(t=>{const i=Jo(t);if(i.matches("div.jb-pro-quality-menu-item")){const t=i.dataset;e.streamQuality=t.quality}}))),o.scale&&(i(t.$scaleMenu,"mouseover",(()=>{t.$scaleMenuList.classList.add("jb-pro-scale-menu-shown")})),i(t.$scaleMenu,"mouseout",(()=>{t.$scaleMenuList.classList.remove("jb-pro-scale-menu-shown")})),i(t.$scaleMenuList,"click",(t=>{const i=Jo(t);if(i.matches("div.jb-pro-scale-menu-item")){const t=i.dataset;e.setScaleMode(t.scale)}}))),o.zoom&&(i(t.$zoom,"click",(t=>{t.stopPropagation(),e.zooming=!0})),i(t.$zoomStop,"click",(t=>{t.stopPropagation(),e.zooming=!1}))),i(t.$zoomExpand,"click",(t=>{t.stopPropagation(),e.zoom&&e.zoom.expandPrecision()})),i(t.$zoomNarrow,"click",(t=>{t.stopPropagation(),e.zoom&&e.zoom.narrowPrecision()})),i(t.$zoomStop2,"click",(t=>{t.stopPropagation(),e.zooming=!1})),o.close&&i(t.$close,"click",(t=>{t.stopPropagation(),e.doDestroy()})),i(t.$tipsMessageClose,"click",(e=>{e.stopPropagation(),t.$tipsMessageContent.innerHTML="",io(t.$tipsMessage,"display","none")}))})(e,this),e._opt.hotKey&&ho()&&((e,t)=>{const{events:{proxy:i}}=e;let s={};function r(e,t){s[e]?s[e].push(t):s[e]=[t]}t.keys=s,r(vi,(()=>{e.fullscreen&&(e.fullscreen=!1)})),r(_i,(()=>{e.volume+=.05})),r(Si,(()=>{e.volume-=.05})),i(window,"keydown",(e=>{if(t.isFocus){const t=document.activeElement.tagName.toUpperCase(),i=document.activeElement.getAttribute("contenteditable");if("INPUT"!==t&&"TEXTAREA"!==t&&""!==i&&"true"!==i){const t=s[e.keyCode];t&&(e.preventDefault(),t.forEach((e=>e())))}}}))})(e,this),this.btnIndex=0,this.initLoadingBackground(),Wo(e._opt.loadingIconStyle)&&this.initLoadingIconStyle(e._opt.loadingIconStyle),Wo(e._opt.ptzPositionConfig)&&this.updatePtzPosition(e._opt.ptzPositionConfig),this.kbpsShow="0 KB/s",this.player.debugLog("Control","init")}destroy(){if(this.$performancePanel){this.$performancePanel.innerHTML="";if(!oc(this.$performancePanel)){const e=this.player.$container.querySelector(".jb-pro-performance-panel");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$performancePanel}if(this.$poster){if(!oc(this.$poster)){const e=this.player.$container.querySelector(".jb-pro-poster");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$poster}if(this.$loading){if(!oc(this.$loading)){const e=this.player.$container.querySelector(".jb-pro-loading");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$loading}if(this.$loadingBg){if(!oc(this.$loadingBg)){const e=this.player.$container.querySelector(".jb-pro-loading-bg");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$loadingBg}if(this.$controls){if(!oc(this.$controls)){const e=this.player.$container.querySelector(".jb-pro-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$controls}if(this.$playBig){if(!oc(this.$playBig)){const e=this.player.$container.querySelector(".jb-pro-play-big");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$playBig}if(this.$recording){if(!oc(this.$recording)){const e=this.player.$container.querySelector(".jb-pro-recording");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$recording}if(this.$ptzControl){if(!oc(this.$ptzControl)){const e=this.player.$container.querySelector(".jb-pro-ptz-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$ptzControl}if(this.$zoomControls){if(!oc(this.$zoomControls)){const e=this.player.$container.querySelector(".jb-pro-zoom-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$zoomControls}if(this.$contextmenus){this.$contextmenus.innerHTML="";if(!oc(this.$contextmenus)){const e=this.player.$container.querySelector(".jb-pro-contextmenus");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$contextmenus}if(this.$tipsMessage){if(!oc(this.$tipsMessage)){const e=this.player.$container.querySelector(".jb-pro-tips-message");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$tipsMessage}if(this.$extendDom){if(!oc(this.$extendDom)){const e=this.player.$container.querySelector(".jb-pro-extend-dom");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$extendDom}try{delete this.$tipsMessageContent,delete this.$tipsMessageClose,delete this.$playbackProgressTime,delete this.$playbackProgressIndicator,delete this.$playbackProgressPlayed,delete this.$playbackProgressHover,delete this.$$playbackProgressTip,delete this.$playbackProgress,delete this.$logSave,delete this.$speedMenuList,delete this.$speedMenu,delete this.$speedText,delete this.$contextmenus,delete this.$occlusionDetectActive,delete this.$occlusionDetect,delete this.$objectDetectActive,delete this.$objectDetect,delete this.$faceDetectActive,delete this.$faceDetect,delete this.$performanceActive,delete this.$performance,delete this.$performancePanel,delete this.$zoomControls,delete this.$close,delete this.$zoomStop2,delete this.$zoomExpand,delete this.$zoomNarrow,delete this.$zoomStop,delete this.$zoom,delete this.$scaleMenuList,delete this.$scaleMenu,delete this.$scaleText,delete this.$qualityMenuList,delete this.$qualityMenu,delete this.$qualityText,delete this.$ptzWiperClose,delete this.$ptzWiperOpen,delete this.$ptzFogClose,delete this.$ptzFogOpen,delete this.$ptzCruisePause,delete this.$ptzCruisePlay,delete this.$ptzFocusNear,delete this.$ptzFocusFar,delete this.$ptzApertureNear,delete this.$ptzApertureFar,delete this.$ptzNarrow,delete this.$ptzExpand,delete this.$ptzArrows,delete this.$ptzControlCircular,delete this.$ptzBgActive,delete this.$ptzControl,delete this.$ptzActive,delete this.$ptz,delete this.$playbackExpand,delete this.$playbackNarrow,delete this.$controlsPlaybackBtns,delete this.$playbackCurrentTimeText,delete this.$playbackCurrentTime,delete this.$playbackTimeListSecond,delete this.$playbackTimeListOne,delete this.$playbackTimeList,delete this.$playbackTimeScroll,delete this.$playbackTimeInner,delete this.$playbackTime,delete this.$controlHtml,delete this.$speed,delete this.$screenshot,delete this.$recordStop,delete this.$record,delete this.$fullscreenExit,delete this.$fullscreen,delete this.$volumeOff,delete this.$volumeOn,delete this.$volumeHandle,delete this.$volumePanel,delete this.$volumePanelText,delete this.$volumePanelWrap,delete this.$volume,delete this.$controlsRight,delete this.$controlsLeft,delete this.$controlsInner,delete this.$controls,delete this.$pause,delete this.$recordingStop,delete this.$recordingTime,delete this.$recording,delete this.$playBig,delete this.$play,delete this.$loadingText,delete this.$loading,delete this.$loadingBgImage,delete this.$loadingBg,delete this.$poster,delete this.$extendDom,delete this.controlsRect,delete this.controlsInnerRect,delete this.controlsLeftRect,delete this.controlsRightRect,delete this.controlsPlaybackTimeInner,delete this.controlsPlaybackBtnsRect}catch(e){}this.keys=null,this.btnIndex=0,this.extendBtnList=[],this.kbpsShow="0 KB/s",this.player.$container&&(this.player.$container.classList.remove("jb-pro-controls-show-auto-hide"),this.player.$container.classList.remove("jb-pro-controls-show")),this.player.debugLog("Control","destroy")}getBtnIndex(){return this.btnIndex++}autoSize(){const e=this.player;e.$container.style.padding="0 0";const t=e.width,i=e.height,s=t/i,r=e.video.$videoElement.width/e.video.$videoElement.height;if(s>r){const s=(t-i*r)/2;e.$container.style.padding=`0 ${s}px`}else{const s=(i-t/r)/2;e.$container.style.padding=`${s}px 0`}}initLoadingBackground(){const e=this.player;e._opt.loadingBackground&&e._opt.loadingBackgroundWidth&&e._opt.loadingBackgroundHeight&&(e.debugLog("Control","initLoadingBackground()"),"default"===this.player._opt.aspectRatio||lo()?(e.getRenderType()===H||e.getRenderType()===$)&&this._initLoadingBackground():this._initLoadingBackgroundForRatio(),sc(this.$loadingBg,"display","block"),e._opt.loadingBackground="")}resizeLoadingBackground(){this.$loadingBgImage.src&&this.$loadingBgImage.width>0&&this.$loadingBgImage.height>0&&"none"!==so(this.$loadingBg,"display",!1)&&("default"===this.player._opt.aspectRatio||lo()?(this.player.getRenderType()===H||this.player.getRenderType()===$)&&this._resizeLoadingBackground():this._resizeLoadingBackgroundForRatio())}initLoadingIconStyle(e){const t=this.player.$container.querySelector(".jb-pro-icon-loading");t&&(e.width&&sc(t,"width",`${e.width}px`),e.height&&sc(t,"height",`${e.height}px`),e.background&&sc(t,"backgroundImage",`url("${e.background}")`),!1===e.hasAnimation&&(sc(t,"animationName","none"),sc(t,"animationDuration",0),sc(t,"animationTimingFunction","ease"),sc(t,"animationIterationCount",1)))}_initLoadingBackgroundForRatio(){const e=this.player._opt.aspectRatio.split(":").map(Number);let t=this.player.width,i=this.player.height;const s=this.player._opt;let r=0;this.player.isControlBarShow()&&(r=s.playType===_?Qt:Yt,i-=r);const o=this.player._opt.loadingBackgroundWidth,a=this.player._opt.loadingBackgroundHeight,n=o/a,l=e[0]/e[1];if(this.player._opt.loadingBackground&&(this.$loadingBgImage.src=this.player._opt.loadingBackground),n>l){const e=l*a/o;this.$loadingBgImage.style.width=100*e+"%",this.$loadingBgImage.style.height=`calc(100% - ${r}px)`,this.$loadingBgImage.style.padding=`0 ${(t-t*e)/2}px`}else{const e=o/l/a;this.$loadingBgImage.style.width="100%",this.$loadingBgImage.style.height=`calc(${100*e}% - ${r}px)`,this.$loadingBgImage.style.padding=(i-i*e)/2+"px 0"}}_initLoadingBackground(){const e=this.player;let t=e.height;const i=e._opt;if(this.player.isControlBarShow()){t-=i.playType===_?Qt:Yt}let s=e.width,r=t;const o=i.rotate;270!==o&&90!==o||(s=t,r=e.width),this.$loadingBgImage.width=s,this.$loadingBgImage.height=r,e._opt.loadingBackground&&(this.$loadingBgImage.src=e._opt.loadingBackground);let a=(e.width-s)/2,n=(t-r)/2,l="contain";i.isResize||(l="fill"),i.isFullResize&&(l="none");let d="";"none"===i.mirrorRotate&&o&&(d+=" rotate("+o+"deg)"),"level"===i.mirrorRotate?d+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(d+=" rotateX(180deg)"),this.player._opt.videoRenderSupportScale&&(this.$loadingBgImage.style.objectFit=l),this.$loadingBgImage.style.transform=d,this.$loadingBgImage.style.padding="0",this.$loadingBgImage.style.left=a+"px",this.$loadingBgImage.style.top=n+"px"}_resizeLoadingBackground(){this._initLoadingBackground()}_resizeLoadingBackgroundForRatio(){this._initLoadingBackgroundForRatio()}_validateExtendBtn(e){let t=!0;if(e.name||(this.player.debugWarn("Control","extend button name is required"),t=!1),t){-1!==this.extendBtnList.findIndex((t=>t.name===e.name))&&(this.player.debugWarn("Control",`extend button name: ${e.name} is already exist`),t=!1)}return t&&(e.icon||(this.player.debugWarn("Control","extend button icon is required"),t=!1)),t}addExtendBtn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=la(Ss);if(e=Object.assign({},t,e),!this._validateExtendBtn(e))return;const i=e.name||"",s=this.$controlsRight,r=e.createdMoment||Er,o=e.activeIcon&&e.activeClick,a=`\n
\n ${e.icon?`
\n \n ${e.iconTitle?`\n ${e.iconTitle}\n `:""}\n
`:""}\n ${e.activeIcon?`
\n \n ${e.activeIconTitle?`\n ${e.activeIconTitle}\n `:""}\n
`:""}\n
\n `,n=Array.from(s.children)[e.index];n?n.insertAdjacentHTML("beforebegin",a):ic(s,a);const l=s.querySelector(`.jb-pro-controls-item-wrap-${i}`),d=e.icon?s.querySelector(`.jb-pro-icon-extend-${i}`):null,h=e.icon?s.querySelector(`.jb-pro-control-extend-${i}`):null,c=e.activeIcon?s.querySelector(`.jb-pro-icon-extend-${i}-active`):null,u=e.activeIcon?s.querySelector(`.jb-pro-control-extend-${i}-active`):null,{events:{proxy:p},debug:f}=this.player;e.icon&&(sc(d,"background",`url(${e.icon}) no-repeat center`),sc(d,"background-size","100% 100%"),sc(h,"display",r===_r?"flex":"none"),e.iconHover&&(p(d,"mouseover",(()=>{sc(d,"background",`url(${e.iconHover}) no-repeat center`),sc(d,"background-size","100% 100%")})),p(d,"mouseout",(()=>{sc(d,"background",`url(${e.icon}) no-repeat center`),sc(d,"background-size","100% 100%")})))),e.activeIcon&&(sc(c,"background",`url(${e.activeIcon}) no-repeat center`),sc(c,"background-size","100% 100%"),sc(u,"display","none"),e.activeIconHover&&(p(c,"mouseover",(()=>{sc(c,"background",`url(${e.activeIconHover}) no-repeat center`),sc(c,"background-size","100% 100%")})),p(c,"mouseout",(()=>{sc(c,"background",`url(${e.activeIcon}) no-repeat center`),sc(c,"background-size","100% 100%")})))),e.click&&d&&p(d,"click",(t=>{t.preventDefault(),o&&(sc(h,"display","none"),sc(u,"display","flex")),this.player.isInMulti()?e.click.call(this.player,t,this.player._opt.multiIndex):e.click.call(this.player,t)})),e.activeClick&&c&&p(c,"click",(t=>{t.preventDefault(),sc(h,"display","flex"),sc(u,"display","none"),this.player.isInMulti()?e.activeClick.call(this.player,t,this.player._opt.multiIndex):e.activeClick.call(this.player,t)})),this.extendBtnList.push({name:i,createdMoment:r,$iconContainer:l,$iconWrap:h,$activeIconWrap:u})}toggleExtendBtn(e,t){const i=this.extendBtnList.find((t=>t.name===e));i&&i.$activeIconWrap&&i.$iconWrap&&(Do(t)||(t="none"===so(i.$activeIconWrap,"display",!1)),t?(sc(i.$iconWrap,"display","none"),sc(i.$activeIconWrap,"display","flex")):(sc(i.$iconWrap,"display","flex"),sc(i.$activeIconWrap,"display","none")))}getExtendBtnActive(e){const t=this.extendBtnList.find((t=>t.name===e));let i=!1;return t&&t.$activeIconWrap&&(i="none"!==so(t.$activeIconWrap,"display",!1)),i}addExtendDom(e){if(e.html){const t=`\n
\n ${e.html}\n
\n `;this.player.$container.insertAdjacentHTML("beforeend",t),Object.defineProperty(this,"$extendDom",{value:this.player.$container.querySelector(".jb-pro-extend-dom"),configurable:!0}),e.showBeforePlay&&sc(this.$extendDom,"display","block")}}toggleExtendDom(e){this.$extendDom&&(Do(e)||(e="none"===so(this.$extendDom,"display",!1)),sc(this.$extendDom,"display",e?"block":"none"))}updateExtendDom(e){this.$extendDom&&(this.$extendDom.innerHTML=e)}removeExtendDom(){this.$extendDom&&(this.$extendDom.innerHTML="")}updateLoadingText(e){this.$loadingText&&(this.$loadingText.innerText=e)}getExtendBtnList(){return this.extendBtnList}showTipsMessage(e,t){const i=this.$tipsMessage,s=this.$tipsMessageContent;if(i){const r=`\n
${e}
\n ${t?`
Error Type:${t}
`:""}\n `;s.innerHTML=r,sc(i,"display","block")}}hideTipsMessage(){const e=this.$tipsMessage,t=this.$tipsMessageContent;e&&(t.innerHTML="",sc(e,"display","none"))}updatePtzPosition(e){const t=this.$ptzControl;if(Wo(e)&&t){let i="auto";e.left&&(i=Number(e.left)===e.left?e.left+"px":e.left),sc(t,"left",i);let s="auto";e.top&&(s=Number(e.top)===e.top?e.top+"px":e.top),sc(t,"top",s);let r="auto";e.bottom&&(r=Number(e.bottom)===e.bottom?e.bottom+"px":e.bottom),sc(t,"bottom",r);let o="auto";e.right&&(o=Number(e.right)===e.right?e.right+"px":e.right),sc(t,"right",o)}}showPlayBtn(){sc(this.$playBig,"display","block")}toggleBar(e){this.$controls&&(Do(e)||(e="none"===so(this.$controls,"display",!1)),sc(this.$controls,"display",e?"flex":"none"))}getBarIsShow(){let e=!1;return this.$controls&&(e="none"!==so(this.$controls,"display",!1)),e}toggleControlHtml(e){this.$controlHtml&&(Do(e)||(e="none"===so(this.$controlHtml,"display",!1)),sc(this.$controlHtml,"display",e?"block":"none"))}getControlHtmlIsShow(){let e=!1;return this.$controlHtml&&(e="none"!==so(this.$controlHtml,"display",!1)),e}getExtendDomIsShow(){let e=!1;return this.$extendDom&&(e="none"!==so(this.$extendDom,"display",!1)),e}getExtendDom(){return this.$extendDom?this.$extendDom:null}getControlHtml(){return this.$controlHtml?this.$controlHtml:null}}nc(".jb-pro-container{position:relative;width:100%;height:100%;overflow:hidden}.jb-pro-container.jb-pro-fullscreen-web{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;width:100vw!important;height:100vh!important;background:#000}.jb-pro-container .jb-pro-loading-bg-for-ios{position:absolute;z-index:100;left:0;top:0;right:0;bottom:0;height:100%;width:100%;opacity:0;visibility:hidden;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jb-pro-container .jb-pro-loading-bg-for-ios.show{opacity:1;visibility:visible}");var dc=e=>{const{_opt:t,events:{proxy:i}}=e;if(t.supportDblclickFullscreen&&i(e.$container,"dblclick",(t=>{const i=Jo(t).nodeName.toLowerCase();"canvas"!==i&&"video"!==i||(e.fullscreen=!e.fullscreen)})),i(document,"visibilitychange",(()=>{e.visibility="visible"===document.visibilityState,e.debugLog("visibilitychange",document.visibilityState),t.hiddenAutoPause&&(e.debugLog("visibilitychange","hiddenAutoPause is true ",document.visibilityState,e._isPlayingBeforePageHidden),"visible"===document.visibilityState?e._isPlayingBeforePageHidden&&e.play():(e._isPlayingBeforePageHidden=e.playing,e.playing&&e.pause()))})),ho()&&i(document,["click","contextmenu"],(t=>{rc(t,e.$container)?(ua(e._opt.disableContextmenu)&&"contextmenu"===t.type&&t.preventDefault(),e.isInput="INPUT"===t.target.tagName,e.isFocus=!0,e.emit(ot.focus)):(e.isInput=!1,e.isFocus=!1,e.emit(ot.blur))})),t.isCheckInView){const t=vo((()=>{e.emit(ot.inView,function(e){const t=e.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight,s=window.innerWidth||document.documentElement.clientWidth,r=t.top<=i&&t.top+t.height>=0,o=t.left<=s&&t.left+t.width>=0;return r&&o}(e.$container))}),200);i(window,"scroll",(()=>t()))}if(t.orientationChangeResize){const t=vo((()=>{e.emit(ot.resize)}),500);i(window,"orientationchange",(()=>{t()})),screen&&screen.orientation&&screen.orientation.onchange&&i(screen.orientation,"change",(()=>{t()}))}};class hc{static init(){hc.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in hc.types)hc.types.hasOwnProperty(e)&&(hc.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=hc.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,s=Array.prototype.slice.call(arguments,1),r=s.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let o=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return hc.box(hc.types.trak,hc.tkhd(e),hc.mdia(e))}static tkhd(e){let t=e.id,i=e.duration,s=e.presentWidth,r=e.presentHeight;return hc.box(hc.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>>8&255,255&s,0,0,r>>>8&255,255&r,0,0]))}static mdia(e){return hc.box(hc.types.mdia,hc.mdhd(e),hc.hdlr(e),hc.minf(e))}static mdhd(e){let t=e.timescale,i=e.duration;return hc.box(hc.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?hc.constants.HDLR_AUDIO:hc.constants.HDLR_VIDEO,hc.box(hc.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?hc.box(hc.types.smhd,hc.constants.SMHD):hc.box(hc.types.vmhd,hc.constants.VMHD),hc.box(hc.types.minf,t,hc.dinf(),hc.stbl(e))}static dinf(){return hc.box(hc.types.dinf,hc.box(hc.types.dref,hc.constants.DREF))}static stbl(e){return hc.box(hc.types.stbl,hc.stsd(e),hc.box(hc.types.stts,hc.constants.STTS),hc.box(hc.types.stsc,hc.constants.STSC),hc.box(hc.types.stsz,hc.constants.STSZ),hc.box(hc.types.stco,hc.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?hc.box(hc.types.stsd,hc.constants.STSD_PREFIX,hc.mp3(e)):hc.box(hc.types.stsd,hc.constants.STSD_PREFIX,hc.mp4a(e)):"avc"===e.videoType?hc.box(hc.types.stsd,hc.constants.STSD_PREFIX,hc.avc1(e)):hc.box(hc.types.stsd,hc.constants.STSD_PREFIX,hc.hvc1(e))}static mp3(e){let t=e.channelCount,i=e.audioSampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return hc.box(hc.types[".mp3"],s)}static mp4a(e){let t=e.channelCount,i=e.audioSampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return hc.box(hc.types.mp4a,s,hc.esds(e))}static esds(e){let t=e.config||[],i=t.length,s=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return hc.box(hc.types.esds,s)}static avc1(e){let t=e.avcc;const i=e.codecWidth,s=e.codecHeight;let r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return hc.box(hc.types.avc1,r,hc.box(hc.types.avcC,t))}static hvc1(e){let t=e.avcc;const i=e.codecWidth,s=e.codecHeight;let r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return hc.box(hc.types.hvc1,r,hc.box(hc.types.hvcC,t))}static mvex(e){return hc.box(hc.types.mvex,hc.trex(e))}static trex(e){let t=e.id,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return hc.box(hc.types.trex,i)}static moof(e,t){return hc.box(hc.types.moof,hc.mfhd(e.sequenceNumber),hc.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return hc.box(hc.types.mfhd,t)}static traf(e,t){let i=e.id,s=hc.box(hc.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),r=hc.box(hc.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),o=hc.sdtp(e),a=hc.trun(e,o.byteLength+16+16+8+16+8+8);return hc.box(hc.types.traf,s,r,a,o)}static sdtp(e){let t=new Uint8Array(5),i=e.flags;return t[4]=i.isLeading<<6|i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy,hc.box(hc.types.sdtp,t)}static trun(e,t){let i=new Uint8Array(28);t+=36,i.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let s=e.duration,r=e.size,o=e.flags,a=e.cts;return i.set([s>>>24&255,s>>>16&255,s>>>8&255,255&s,r>>>24&255,r>>>16&255,r>>>8&255,255&r,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12),hc.box(hc.types.trun,i)}static mdat(e){return hc.box(hc.types.mdat,e)}}hc.init();class cc extends wa{constructor(e){super(),this.TAG_NAME="MediaSource",this.player=e,this._resetInIt(),this._useManagedMediaSource="ManagedMediaSource"in wr&&!("MediaSource"in wr),this.mediaSource=this._useManagedMediaSource?new wr.ManagedMediaSource:new wr.MediaSource,this.isDecodeFirstIIframe=!!pa(e._opt.checkFirstIFrame),this.mediaSourceObjectURL=null,this._useManagedMediaSource||(this.mediaSourceObjectURL=wr.URL.createObjectURL(this.mediaSource)),this.isSupportVideoFrameCallback=ba(),this.canvasRenderInterval=null,e._opt.mseUseCanvasRender?(this.$videoElement=document.createElement("video"),this._useManagedMediaSource?(this.$videoElement.disableRemotePlayback=!0,this.$videoElement.srcObject=this.mediaSource):this.$videoElement.src=this.mediaSourceObjectURL,this.initVideoEvents()):(this._useManagedMediaSource?(this.player.video.$videoElement.disableRemotePlayback=!0,this.player.video.$videoElement.srcObject=this.mediaSource):this.player.video.$videoElement.src=this.mediaSourceObjectURL,this.$videoElement=this.player.video.$videoElement),this._bindMediaSourceEvents(),this.audioSourceBufferCheckTimeout=null,this.audioSourceNoDataCheckTimeout=null,this.hasPendingEos=!1,this.player.isPlayback()&&this.player.on(ot.playbackPause,(t=>{pa(t)?(e._opt.isPlaybackPauseClearCache&&(ua(e._opt.checkFirstIFrame)&&(this.player.debugLog(this.TAG_NAME,"playbackPause is false and _opt.checkFirstIFrame is true so set isDecodeFirstIIframe = false"),this.isDecodeFirstIIframe=!1),this.clearUpAllSourceBuffer()),this.$videoElement.play()):(this.$videoElement.pause(),this.cacheTrack={})})),this._useManagedMediaSource?this.player.debugLog(this.TAG_NAME,"init and using ManagedMediaSource"):this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.stop(),this._clearAudioSourceBufferCheckTimeout(),this._clearAudioNoDataCheckTimeout(),this._stopCanvasRender(),this.eventListenList.length&&(this.eventListenList.forEach((e=>e())),this.eventListenList=[]),this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.$videoElement&&(this.player._opt.mseUseCanvasRender&&(this.$videoElement.pause&&(this.$videoElement.pause(),this.$videoElement.muted=!0),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"))),this.$videoElement=null),this.mediaSourceObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceObjectURL),this.mediaSourceObjectURL=null),this._resetInIt(),this.mediaSource=null,this.off(),this.player.debugLog(this.TAG_NAME,"destroy")}needInitAudio(){return this.player._opt.hasAudio&&this.player._opt.mseDecodeAudio}_resetInIt(){this.isAvc=null,this.isAAC=null,this.videoMeta={},this.audioMeta={},this.sourceBuffer=null,this.audioSourceBuffer=null,this.hasInit=!1,this.hasAudioInit=!1,this.isInitInfo=!1,this.isAudioInitInfo=!1,this.audioMimeType="",this.videoMimeType="",this.cacheTrack={},this.cacheAudioTrack={},this.sequenceNumber=0,this.audioSequenceNumber=0,this.firstRenderTime=null,this.firstAudioTime=null,this.$videoElement=null,this.mediaSourceAppendBufferFull=!1,this.mediaSourceAppendBufferError=!1,this.mediaSourceAddSourceBufferError=!1,this.mediaSourceBufferError=!1,this.mediaSourceError=!1,this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.prevAudioDts=null,this.prevPayloadBufferSize=0,this.isWidthOrHeightChanged=!1,this.prevTs=null,this.prevAudioTs=null,this.eventListenList=[],this.pendingRemoveRanges=[],this.pendingSegments=[],this.pendingAudioRemoveRanges=[],this.pendingAudioSegments=[],this.supportVideoFrameCallbackHandle=null}get state(){return this.mediaSource&&this.mediaSource.readyState}get isStateOpen(){return this.state===Ai}get isStateClosed(){return this.state===bi}get isStateEnded(){return this.state===yi}get duration(){return this.mediaSource&&this.mediaSource.duration||-1}set duration(e){this.mediaSource.duration=e}_bindMediaSourceEvents(){const{events:{proxy:e}}=this.player,t=e(this.mediaSource,$i,(()=>{this.player.debugLog(this.TAG_NAME,"sourceOpen"),this._onMediaSourceSourceOpen(),this.player.emit(ot.mseSourceOpen)})),i=e(this.mediaSource,Hi,(()=>{this.player.debugLog(this.TAG_NAME,"sourceClose"),this.player.emit(ot.mseSourceClose)})),s=e(this.mediaSource,Ji,(()=>{this.player.debugLog(this.TAG_NAME,"sourceended"),this.player.emit(ot.mseSourceended)}));this.eventListenList.push(t,i,s);const r=e(this.$videoElement,Zi,(e=>{if(pa(this.isSupportVideoFrameCallback))if(this.player.checkIsInRender())this.player.handleRender();else{const t=parseInt(e.timeStamp,10);this.player.debugLog(this.TAG_NAME,`mseUseCanvasRender is ${this.player._opt.mseUseCanvasRender} and\n $videoElement ts is ${t}, but not in render and vbps is ${this.player._stats.vbps} and fps is ${this.player._stats.fps}`)}}));if(this.eventListenList.push(r),this._useManagedMediaSource){const t=e(this.mediaSource,qi,(()=>{this.player.debugLog(this.TAG_NAME,"ManagedMediaSource startstreaming"),this.player.emit(ot.mseSourceStartStreaming)})),i=e(this.mediaSource,Ki,(()=>{this.player.debugLog(this.TAG_NAME,"ManagedMediaSource endstreaming"),this.player.emit(ot.mseSourceEndStreaming)})),s=e(this.mediaSource,Yi,(()=>{this.player.debugLog(this.TAG_NAME,"ManagedMediaSource qualitychange")}));this.eventListenList.push(t,i,s)}}_onMediaSourceSourceOpen(){this.sourceBuffer||(this.player.debugLog("MediaSource","onMediaSourceSourceOpen() sourceBuffer is null and next init"),this._initSourceBuffer()),this.audioSourceBuffer||(this.player.debugLog("MediaSource","onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),this._initAudioSourceBuffer()),this._hasPendingSegments()&&this._doAppendSegments()}initVideoEvents(){const{proxy:e}=this.player.events;this.player.on(ot.visibilityChange,(e=>{e&&setTimeout((()=>{if(this.player.isPlaying()&&this.$videoElement){const e=this.getVideoBufferLastTime();e-this.$videoElement.currentTime>this.getMseBufferMaxDelayTime()&&(this.player.debugLog(this.TAG_NAME,`visibilityChange is true and lastTime is ${e} and currentTime is ${this.$videoElement.currentTime} so set currentTime to lastTime`),this.$videoElement.currentTime=e)}}),300)}));const t=e(this.$videoElement,Qi,(()=>{this.player.debugLog(this.TAG_NAME,"video canplay"),this.$videoElement.play().then((()=>{this.player.emit(ot.removeLoadingBgImage),ba()?this.supportVideoFrameCallbackHandle||(this.player.debugLog(this.TAG_NAME,"video canplay and requestVideoFrameCallback and use videoFrameCallback"),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))):this.player.isUseHls265()&&(this.player.debugLog(this.TAG_NAME,"video canplay and use canvas render and fps is 25"),this._stopCanvasRender(),this.canvasRenderInterval=setInterval((()=>{this.player.video.render({$video:this.$videoElement,ts:parseInt(1e3*this.$videoElement.currentTime,10)||0})}),40)),this.player.debugLog(this.TAG_NAME,"video play")})).catch((e=>{this.player.debugError(this.TAG_NAME,"video play error ",e),this.player.emitError(lt.mediaSourceUseCanvasRenderPlayFailed,`code is ${e.code} and message is ${e.message}`)}))})),i=e(this.$videoElement,Xi,(()=>{this.player.debugLog(this.TAG_NAME,"video waiting")})),s=e(this.$videoElement,Zi,(e=>{parseInt(e.timeStamp,10),this.$videoElement.paused&&(this.player.debugWarn(this.TAG_NAME,"video is paused and next try to replay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video is paused and replay success")})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video is paused and replay error ",e)})))})),r=e(this.$videoElement,es,(()=>{this.player.debugLog(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate),this.$videoElement&&this.$videoElement.paused&&this.player.debugWarn(this.TAG_NAME,"ratechange and video is paused")}));this.eventListenList.push(t,i,s,r)}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())return void this.player.debugLog(this.TAG_NAME,"videoFrameCallback() player is destroyed");const i=parseInt(1e3*Math.max(t.mediaTime,this.$videoElement.currentTime),10)||0;this.player.handleRender(),this.player.video.render({$video:this.$videoElement,ts:i}),this.player.isUseHls265()&&this.player.updateStats({fps:!0,ts:i}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}decodeVideo(e,t,i,s){const r=this.player;if(r)if(this.player.isDestroyedOrClosed())this.player.debugWarn(this.TAG_NAME,"decodeVideo() player is destroyed");else if(this.hasInit)if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(i&&0===e[1]){const t=15&e[0];let i={};if(t===yt){i=xn(e.slice(5))}else t===At&&(i=zn(e));const s=this.player.video.videoInfo;s&&s.width&&s.height&&i&&i.codecWidth&&i.codecHeight&&(i.codecWidth!==s.width||i.codecHeight!==s.height)&&(this.player.debugWarn(this.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${s.width}, old height is ${s.height},\n new width is ${i.codecWidth}, new height is ${i.codecHeight},\n and emit change event`),this.isWidthOrHeightChanged=!0,this.player.emitError(lt.mseWidthOrHeightChange,`width ${s.width}->${i.codecWidth}, height ${s.height}->${i.codecHeight}`))}if(this.isWidthOrHeightChanged)return void this.player.debugWarn(this.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(ca(e))return void this.player.debugLog(this.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength<12)return void this.player.debugWarn(this.TAG_NAME,`decodeVideo and payload is too small , payload length is ${e.byteLength}`);let r=t;if(this.player.isPlayer()){if(null===this.firstRenderTime&&(this.firstRenderTime=t,this.player.debugLog(this.TAG_NAME,`firstRenderTime is ${this.firstRenderTime}`)),r=t-this.firstRenderTime,r<0&&(this.player.debugWarn(this.TAG_NAME,`decodeVideo\n local dts is < 0 , ts is ${t} and prevTs is ${this.prevTs},\n firstRenderTime is ${this.firstRenderTime} and mseCorrectTimeDuration is ${this.player._opt.mseCorrectTimeDuration}`),r=null===this.prevDts?0:this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(t)))return this.player.debugWarn(this.TAG_NAME,`decodeVideo is max diff , ts is ${t} and prevTs is ${this.prevTs}, diff is ${this.prevTs-t} and emit replay`),void this.player.emitError(lt.mediaSourceTsIsMaxDiff,`decodeVideo is max diff, prevTs is ${this.prevTs} and ts is ${t}`);if(null!==this.prevDts&&r<=this.prevDts){if(this.player.debugWarn(this.TAG_NAME,`\n decodeVideo dts is less than(or equal) prev dts ,\n dts is ${r} and prev dts is ${this.prevDts} ,\n and now ts is ${t} and prev ts is ${this.prevTs} ,\n and diff is ${t-this.prevTs} and firstRenderTime is ${this.firstRenderTime} and isIframe is ${i},\n and mseCorrectTimeDuration is ${this.player._opt.mseCorrectTimeDuration},\n and prevPayloadBufferSize is ${this.prevPayloadBufferSize} and payload size is ${e.byteLength}`),r===this.prevDts&&this.prevPayloadBufferSize===e.byteLength)return void this.player.debugWarn(this.TAG_NAME,"decodeVideo dts is equal to prev dts and payload size is equal to prev payload size so drop this frame");if(r=this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(t))return this.player.debugWarn(this.TAG_NAME,`decodeVideo is max diff , ts is ${t} and prevTs is ${this.prevTs}, diff is ${this.prevTs-t} and emit replay`),void this.emit(lt.mediaSourceTsIsMaxDiff,`decodeVideo is max diff, prevTs is ${this.prevTs} and ts is ${t}`)}}this.player.isPlayer()?this._decodeVideo(e,r,i,s,t):this.player.isPlayback()&&(pa(this.player.playbackPause)?(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this._decodeVideo(e,r,i,s,t)):this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this._decodeVideo(e,r,i,s,t)),this.prevDts=r,this.prevPayloadBufferSize=e.byteLength,this.prevTs=t}else this.player.debugLog(this.TAG_NAME,"decodeVideo first frame is not iFrame");else if(i&&e[1]===ys){const s=15&e[0];if(r.video.updateVideoInfo({encTypeCode:s}),s===At&&pa(Eo()))return void this.player.emitError(lt.mediaSourceH265NotSupport);r._times.decodeStart||(r._times.decodeStart=eo()),this.hasInit=this._decodeConfigurationRecord(e,t,i,s)}else this.player.debugWarn(this.TAG_NAME,`decodeVideo has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)}decodeAudio(e,t){if(this.player)if(this.player.isDestroyedOrClosed())this.player.debugWarn(this.TAG_NAME,"decodeAudio() player is destroyed");else if(pa(this.hasAudioInit))this.hasAudioInit=this._decodeAudioConfigurationRecord(e,t);else{let i=t;if(Ir(e))return void this.player.debugLog(this.TAG_NAME,"decodeAudio and has already initialized and payload is aac codec packet so drop this frame");if(this._clearAudioNoDataCheckTimeout(),this.isDecodeFirstIIframe){if(this.player.isPlayer()){if(null===this.firstAudioTime&&(this.firstAudioTime=t,this.player.debugLog(this.TAG_NAME,`firstAudioTime is ${this.firstAudioTime}`)),i=t-this.firstAudioTime,i<0&&(this.player.debugWarn(this.TAG_NAME,`decodeAudio\n local dts is < 0 , ts is ${t} and prevTs is ${this.prevAudioTs},\n firstAudioTime is ${this.firstAudioTime}`),i=null===this.prevAudioDts?0:this.prevAudioDts+this.player._opt.mseCorrectAudioTimeDuration,this._checkAudioTsIsMaxDiff(t)))return this.player.debugWarn(this.TAG_NAME,`decodeAudio is max diff , ts is ${t} and prevTs is ${this.prevAudioDts}, diff is ${this.prevAudioDts-t} and emit replay`),void this.player.emitError(lt.mediaSourceTsIsMaxDiff,`decodeAudio is max diff, prevTs is ${this.prevAudioDts} and ts is ${t}`);null!==this.prevAudioTs&&i<=this.prevAudioDts&&(this.player.debugWarn(this.TAG_NAME,`\n decodeAudio dts is less than(or equal) prev dts ,\n dts is ${i} and prev dts is ${this.prevAudioDts} ,\n and now ts is ${t} and prev ts is ${this.prevAudioTs} ,\n and diff is ${t-this.prevAudioTs}`),i=this.prevAudioDts+this.player._opt.mseCorrectAudioTimeDuration)}(this.player.isPlayer()||this.player.isPlayback()&&(pa(this.player.playbackPause)||this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()))&&this._decodeAudio(e,i,t),this.prevAudioTs=t,this.prevAudioDts=i}else this.player.debugLog(this.TAG_NAME,"decodeAudio first frame is not iFrame")}}_checkTsIsMaxDiff(e){return this.prevTs>0&&eX}_checkAudioTsIsMaxDiff(e){return this.prevAudioTs>0&&eX}_decodeConfigurationRecord(e,t,i,s){let r=e.slice(5),o={};if(s===yt?o=xn(r):s===At&&(o=Wn(r)),zo(o)||0===o.codecWidth&&0===o.codecHeight){this.player.debugWarn(this.TAG_NAME,"_decodeConfigurationRecord",o);let e="";return e=zo(o)?"config is empty object":`config is not empty object and codecWidth is ${o.codecWidth} and codecHeight is ${o.codecHeight}`,this.player.emitError(lt.mediaSourceDecoderConfigurationError,e),!1}this.isInitInfo||(this.player.debugLog(this.TAG_NAME,`updateVideoInfo: ${o.codecWidth},${o.codecHeight}`),this.player.video.updateVideoInfo({width:o.codecWidth,height:o.codecHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0),this.player.recorder&&this.player._opt.recordType===S&&this.player.recorder.initMetaData(e,s);const a={id:er,type:"video",timescale:1e3,duration:0,avcc:r,codecWidth:o.codecWidth,codecHeight:o.codecHeight,videoType:o.videoType},n=hc.generateInitSegment(a);this.isAvc=s===yt;let l=o.codec;return this.videoMimeType=l?`video/mp4; codecs="${o.codec}"`:this.isAvc?ci:ui,this._initSourceBuffer(),this.appendBuffer(n.buffer),this.sequenceNumber=0,this.cacheTrack={},!0}_decodeAudioConfigurationRecord(e,t){const i=e[0]>>4,s=e[0]>>1&1,r=i===Et,o=i===_t;let a="";if(a=o?s?16:8:0===s?8:16,pa(o||r))return this.player.debugWarn(this.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${i} ant auto wasm decode`),this.player.emit(lt.mediaSourceAudioG711NotSupport),!1;const n={id:tr,type:"audio",timescale:1e3};let l={};if(Ir(e)){if(l=Nr(e.slice(2)),!l)return!1;n.audioSampleRate=l.sampleRate,n.channelCount=l.channelCount,n.config=l.config,n.refSampleDuration=1024/n.audioSampleRate*n.timescale}else{if(!r)return!1;if(l=Wh(e),!l)return!1;n.audioSampleRate=l.samplingRate,n.channelCount=l.channelCount,n.refSampleDuration=1152/n.audioSampleRate*n.timescale}n.codec=l.codec,n.duration=0;let d="mp4",h=l.codec,c=null;r&&pa(uo())?(d="mpeg",h="",c=new Uint8Array):c=hc.generateInitSegment(n);let u=`${n.type}/${d}`;return h&&h.length>0&&(u+=`;codecs=${h}`),pa(this.isAudioInitInfo)&&(this.player.audio.updateAudioInfo({encTypeCode:i,channels:n.channelCount,sampleRate:n.audioSampleRate,depth:a}),this.isAudioInitInfo=!0),this.audioMimeType=u,this.isAAC=o,this._initAudioSourceBuffer(),this.appendAudioBuffer(c.buffer),!0}_initSourceBuffer(){const{events:{proxy:e}}=this.player;if(null===this.sourceBuffer&&null!==this.mediaSource&&this.isStateOpen&&this.videoMimeType){try{this.sourceBuffer=this.mediaSource.addSourceBuffer(this.videoMimeType),this.player.debugLog(this.TAG_NAME,"_initSourceBuffer() this.mediaSource.addSourceBuffer()",this.videoMimeType)}catch(e){return this.player.debugError(this.TAG_NAME,"appendBuffer() this.mediaSource.addSourceBuffer()",e.code,e),this.player.emitError(lt.mseAddSourceBufferError,`code is ${e.code} and message is ${e.message}`),void(this.mediaSourceAddSourceBufferError=!0)}if(this.sourceBuffer){const t=e(this.sourceBuffer,"error",(e=>{this.mediaSourceBufferError=!0,this.player.debugError(this.TAG_NAME,"mseSourceBufferError this.sourceBuffer",e),this.player.emitError(lt.mseSourceBufferError,e.toString())})),i=e(this.sourceBuffer,"updateend",(()=>{this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this.hasPendingEos&&(this.player.debugLog(this.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),this.endOfStream())}));this.eventListenList.push(t,i)}}else this.player.debugLog(this.TAG_NAME,`_initSourceBuffer and this.isStateOpen is ${this.isStateOpen} and this.isAvc === null is ${null===this.isAvc}`)}_initAudioSourceBuffer(){const{events:{proxy:e}}=this.player;if(null===this.audioSourceBuffer&&null!==this.mediaSource&&this.isStateOpen&&this.audioMimeType){try{this.audioSourceBuffer=this.mediaSource.addSourceBuffer(this.audioMimeType),this._clearAudioSourceBufferCheckTimeout(),this.player.debugLog(this.TAG_NAME,"_initAudioSourceBuffer() this.mediaSource.addSourceBuffer()",this.audioMimeType)}catch(e){return this.player.debugError(this.TAG_NAME,"appendAudioBuffer() this.mediaSource.addSourceBuffer()",e.code,e),this.player.emitError(lt.mseAddSourceBufferError,`code is ${e.code} and message is ${e.message}`),void(this.mediaSourceAddSourceBufferError=!0)}if(this.audioSourceBuffer){const t=e(this.audioSourceBuffer,"error",(e=>{this.mediaSourceBufferError=!0,this.player.debugError(this.TAG_NAME,"mseSourceBufferError this.audioSourceBuffer",e),this.player.emitError(lt.mseSourceBufferError,e.toString())})),i=e(this.audioSourceBuffer,"updateend",(()=>{this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this.hasPendingEos&&(this.player.debugLog(this.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),this.endOfStream())}));this.eventListenList.push(t,i),null===this.audioSourceNoDataCheckTimeout&&(this.audioSourceNoDataCheckTimeout=setTimeout((()=>{this._clearAudioNoDataCheckTimeout(),this.player.emit(lt.mediaSourceAudioNoDataTimeout)}),1e3))}}else this.player.debugLog(this.TAG_NAME,`_initAudioSourceBuffer and this.isStateOpen is ${this.isStateOpen} and this.audioMimeType is ${this.audioMimeType}`)}_decodeVideo(e,t,i,s,r){const o=this.player;let a=e.slice(5),n=a.byteLength;if(0===n)return void o.debugWarn(this.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let l=(new Date).getTime(),d=!1;this.prevTimestamp||(this.prevTimestamp=l,d=!0);const h=l-this.prevTimestamp;this.decodeDiffTimestamp=h,h>1e3&&!d&&this.player.isPlayer()&&o.debugLog(this.TAG_NAME,`_decodeVideo now time is ${l} and prev time is ${this.prevTimestamp}, diff time is ${h} ms`);const c=this.$videoElement;if(this.cacheTrack.id&&t>=this.cacheTrack.dts){let e=8+this.cacheTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(hc.types.mdat,4),i.set(this.cacheTrack.data,8),this.cacheTrack.duration=t-this.cacheTrack.dts,this.cacheTrack.duration>1e3&&this.player.debugWarn(this.TAG_NAME,`cacheTrack duration is ${this.cacheTrack.duration} ms`);let s=hc.moof(this.cacheTrack,this.cacheTrack.dts);this.cacheTrack={};let a=new Uint8Array(s.byteLength+i.byteLength);a.set(s,0),a.set(i,s.byteLength),this.appendBuffer(a.buffer),o.emit(ot.timeUpdate,r),o.isPlayer()?o.isUseHls265()?o.updateStats({dfps:!0,mseTs:t}):o.updateStats({fps:!0,dfps:!0,ts:r,mseTs:t}):o.isPlayback()&&o.playback.updateStats({ts:r}),o._times.videoStart||(o._times.videoStart=eo(),o.handlePlayToRenderTimes())}else o.debugLog(this.TAG_NAME,`cacheTrack = {} now dts is ${t}, and ts is ${r} cacheTrack dts is ${this.cacheTrack&&this.cacheTrack.dts}`),this.cacheTrack={};this.cacheTrack||(this.cacheTrack={}),this.cacheTrack.id=er,this.cacheTrack.sequenceNumber=++this.sequenceNumber,this.cacheTrack.size=n,this.cacheTrack.dts=t,this.cacheTrack.cts=s,this.cacheTrack.isKeyframe=i,this.cacheTrack.data=a,this.cacheTrack.flags={isLeading:0,dependsOn:i?2:1,isDependedOn:i?1:0,hasRedundancy:0,isNonSync:i?0:1},o._opt.mseUseCanvasRender&&pa(this.isSupportVideoFrameCallback)&&pa(o.isUseHls265())&&o.video.render({$video:c,ts:t}),this.prevTimestamp=(new Date).getTime()}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}_decodeAudio(e,t,i){const s=this.player;let r=this.isAAC?e.slice(2):e.slice(1),o=r.byteLength;if(this.cacheAudioTrack.id&&t>=this.cacheAudioTrack.dts){let e=8+this.cacheAudioTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(hc.types.mdat,4),i.set(this.cacheAudioTrack.data,8),this.cacheAudioTrack.duration=t-this.cacheAudioTrack.dts;let s=hc.moof(this.cacheAudioTrack,this.cacheAudioTrack.dts);this.cacheAudioTrack={};let r=new Uint8Array(s.byteLength+i.byteLength);r.set(s,0),r.set(i,s.byteLength),this.appendAudioBuffer(r.buffer)}else s.debugLog(this.TAG_NAME,`cacheAudioTrack = {} now dts is ${t} cacheAudioTrack dts is ${this.cacheAudioTrack&&this.cacheAudioTrack.dts}`),this.cacheAudioTrack={};this.cacheAudioTrack||(this.cacheAudioTrack={}),this.cacheAudioTrack.id=tr,this.cacheAudioTrack.sequenceNumber=++this.audioSequenceNumber,this.cacheAudioTrack.size=o,this.cacheAudioTrack.dts=t,this.cacheAudioTrack.cts=0,this.cacheAudioTrack.data=r,this.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}appendBuffer(e){this.player.isDestroyedOrClosed()?this.player.debugWarn(this.TAG_NAME,"appendBuffer() player is destroyed"):(this.player,this.mediaSourceAddSourceBufferError?this.player.debugWarn(this.TAG_NAME,"appendBuffer() this.mediaSourceAddSourceBufferError is true"):this.mediaSourceAppendBufferFull?this.player.debugWarn(this.TAG_NAME,"appendBuffer() this.mediaSourceAppendBufferFull is true"):this.mediaSourceAppendBufferError?this.player.debugWarn(this.TAG_NAME,"appendBuffer() this.mediaSourceAppendBufferError is true"):this.mediaSourceBufferError?this.player.debugWarn(this.TAG_NAME,"appendBuffer() this.mediaSourceBufferError is true"):(this.pendingSegments.push(e),this.sourceBuffer&&(this.player.isPlayer()&&this._handleUpdatePlaybackRate(),this.player.isPlayback()&&(this._handleUpdateBufferDelayTime(),this._checkVideoPlayCurrentTime()),this.player._opt.mseAutoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanUpSourceBuffer(),pa(this.getSourceBufferUpdating())&&this.isStateOpen&&pa(this._hasPendingRemoveRanges()))?this._doAppendSegments():this.isStateClosed?(this.mediaSourceBufferError=!0,this.player.emitError(lt.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):this.isStateEnded&&(this.mediaSourceBufferError=!0,this.player.emitError(lt.mseSourceBufferError,"mediaSource is end"))))}appendAudioBuffer(e){this.player.isDestroyedOrClosed()?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() player is destroyed"):(this.player,this.mediaSourceAddSourceBufferError?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAddSourceBufferError is true"):this.mediaSourceAppendBufferFull?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAppendBufferFull is true"):this.mediaSourceAppendBufferError?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAppendBufferError is true"):this.mediaSourceBufferError?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceBufferError is true"):(this.pendingAudioSegments.push(e),this.audioSourceBuffer&&(this.player.isPlayer()&&this._handleUpdatePlaybackRate(),this.player.isPlayback()&&(this._handleUpdateBufferDelayTime(),this._checkVideoPlayCurrentTime()),this.player._opt.mseAutoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanUpSourceBuffer(),pa(this.getAudioSourceBufferUpdating())&&this.isStateOpen&&pa(this._hasPendingRemoveRanges()))?this._doAppendSegments():this.isStateClosed?(this.mediaSourceBufferError=!0,this.player.emitError(lt.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):this.isStateEnded&&(this.mediaSourceBufferError=!0,this.player.emitError(lt.mseSourceBufferError,"mediaSource is end"))))}getSourceBufferUpdating(){return this.sourceBuffer&&this.sourceBuffer.updating}getAudioSourceBufferUpdating(){return this.audioSourceBuffer&&this.audioSourceBuffer.updating}stop(){this.abortSourceBuffer(),this.removeSourceBuffer(),this.endOfStream()}checkSourceBufferDelay(){const e=this.$videoElement;let t=0,i=0;return e.buffered.length>0&&(i=e.buffered.end(e.buffered.length-1),t=i-e.currentTime),t<0&&(this.player.debugWarn(this.TAG_NAME,`checkMSESourceBufferDelay ${t} < 0, and buffered is ${i} ,currentTime is ${e.currentTime} , try to seek ${e.currentTime} to ${i}`),e.currentTime=i,e.paused&&(this.player.debugWarn(this.TAG_NAME,"checkSourceBufferDelay and video is paused and sent isMSECurrentMoreThanBufferedPause true"),this.player.isMSECurrentMoreThanBufferedPause=!0),t=0),t}checkSourceBufferStore(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.currentTime-e.buffered.start(0)),t}checkSourceBufferEndLessThanCurrentTime(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.buffered.end(e.buffered.length-1)-e.currentTime),t}getDecodeDiffTimes(){return this.decodeDiffTimestamp}removeBuffer(e,t){const i=qo();if(this.player.debugLog(this.TAG_NAME,`removeBuffer() start is ${e} and end is ${t} and _isMacOsFirefox is ${i}`),this.isStateOpen&&pa(i)){if(pa(this.getSourceBufferUpdating()))try{this.sourceBuffer.remove(e,t)}catch(e){this.player.debugWarn(this.TAG_NAME,"removeBuffer() sourceBuffer error",e)}if(pa(this.getAudioSourceBufferUpdating()))try{this.audioSourceBuffer.remove(e,t)}catch(e){this.player.debugWarn(this.TAG_NAME,"removeBuffer() audioSourceBuffer error",e)}}}clearUpAllSourceBuffer(){if(this.sourceBuffer){const e=this.sourceBuffer.buffered;for(let t=0;t=1)if(this.getSourceBufferUpdating()||this.getAudioSourceBufferUpdating())this.hasPendingEos=!0;else{this.hasPendingEos=!1;try{this.player.debugLog(this.TAG_NAME,"endOfStream()"),this.mediaSource.endOfStream()}catch(e){this.player.debugWarn(this.TAG_NAME,"endOfStream() error",e)}}}abortSourceBuffer(){if(this.isStateOpen){if(this.sourceBuffer){try{this.player.debugLog(this.TAG_NAME,"abortSourceBuffer() abort sourceBuffer"),this.sourceBuffer.abort()}catch(e){}pa(this.getSourceBufferUpdating())&&this._doRemoveRanges()}if(this.audioSourceBuffer){try{this.player.debugLog(this.TAG_NAME,"abortSourceBuffer() abort audioSourceBuffer"),this.audioSourceBuffer.abort()}catch(e){}pa(this.getAudioSourceBufferUpdating())&&this._doRemoveRanges()}}this.sourceBuffer=null,this.audioSourceBuffer=null}removeSourceBuffer(){if(!this.isStateClosed&&this.mediaSource){if(this.sourceBuffer)try{this.player.debugLog(this.TAG_NAME,"removeSourceBuffer() sourceBuffer"),this.mediaSource.removeSourceBuffer(this.sourceBuffer)}catch(e){this.player.debugError(this.TAG_NAME,"removeSourceBuffer() sourceBuffer error",e)}if(this.audioSourceBuffer)try{this.player.debugLog(this.TAG_NAME,"removeSourceBuffer() audioSourceBuffer"),this.mediaSource.removeSourceBuffer(this.audioSourceBuffer)}catch(e){this.player.debugError(this.TAG_NAME,"removeSourceBuffer() audioSourceBuffer error",e)}}}_hasPendingSegments(){return this.pendingSegments.length>0||this.pendingAudioSegments.length>0}getPendingSegmentsLength(){return this.pendingSegments.length}_handleUpdatePlaybackRate(){if(!this.$videoElement)return;const e=this.$videoElement;this.player._opt.videoBuffer,this.player._opt.videoBufferDelay;const t=e.buffered;t.length&&t.start(0);const i=t.length?t.end(t.length-1):0;let s=e.currentTime;const r=i-s,o=this.getMseBufferMaxDelayTime();if(this.player.updateStats({mseVideoBufferDelayTime:r}),0===this.$videoElement.readyState)return;if(r>o)this.player.debugLog(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current is ${s} , delay buffer is more than ${o} is ${r} and new time is ${i}`),e.currentTime=i,s=e.currentTime;else if(r<0&&0===i)return this.player.debugWarn(this.TAG_NAME,`handleUpdatePlaybackRate and delay buffer is ${i} - current is ${s} = ${r} < 0 and check video is paused : ${e.paused} `),void this.player.emit(lt.mediaSourceBufferedIsZeroError,"video.buffered is empty");const a=this._getPlaybackRate(i-s);e.playbackRate!==a&&(this.player.debugLog(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current time is ${s} and delay is ${i-s} set playbackRate is ${a} `),e.playbackRate=a)}_handleUpdateBufferDelayTime(){const e=this.getVideoBufferDelayTime();this.player.updateStats({mseVideoBufferDelayTime:e})}_checkVideoPlayCurrentTime(){const e=this.checkSourceBufferStore();if(e<0){const t=this.getVideoBufferStartTime();this.player.debugWarn(this.TAG_NAME,`checkVideoPlayCurrentTime store is ${e} < 0 and set currentTime ${this.$videoElement.currentTime} to ${t}`),this.$videoElement.currentTime=t}}updateVideoCurrentTimeByBufferStart(){if(!this.$videoElement)return;const e=this.$videoElement.currentTime,t=this.getVideoBufferRangeList();let i=null;for(let s=0;s{this._clearAudioSourceBufferCheckTimeout(),this.player.emit(lt.mediaSourceAudioInitTimeout)}),1e3)));if(pa(this.getSourceBufferUpdating())&&this.pendingSegments.length>0){const e=this.pendingSegments.shift();try{this.sourceBuffer.appendBuffer(e)}catch(e){this.player.debugError(this.TAG_NAME,"this.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.player.emitError(lt.mediaSourceFull,`code is ${e.code} and message is ${e.message}`)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.player.emitError(lt.mediaSourceAppendBufferError,`code is ${e.code} and message is ${e.message}`)):(this.stop(),this.mediaSourceBufferError=!0,this.player.emitError(ot.mseSourceBufferError,`code is ${e.code} and message is ${e.message}`))}}if(pa(this.getAudioSourceBufferUpdating())&&this.pendingAudioSegments.length>0){const e=this.pendingAudioSegments.shift();try{this.audioSourceBuffer.appendBuffer(e)}catch(e){this.player.debugError(this.TAG_NAME,"this.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.player.emitError(lt.mediaSourceFull,`code is ${e.code} and message is ${e.message}`)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.player.emitError(lt.mediaSourceAppendBufferError,`code is ${e.code} and message is ${e.message}`)):(this.stop(),this.mediaSourceBufferError=!0,this.player.emitError(ot.mseSourceBufferError,`code is ${e.code} and message is ${e.message}`))}}}else this.player.debugLog(this.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")}_doCleanUpSourceBuffer(){if(!this.$videoElement)return;const e=this.$videoElement.currentTime;if(this.sourceBuffer){const t=this.sourceBuffer.buffered;let i=!1;for(let s=0;s=this.player._opt.mseAutoCleanupMaxBackwardDuration){i=!0;let t=e-this.player._opt.mseAutoCleanupMinBackwardDuration;this.pendingRemoveRanges.push({start:r,end:t})}}else o=this.player._opt.mseAutoCleanupMaxBackwardDuration){i=!0;let t=e-this.player._opt.mseAutoCleanupMinBackwardDuration;this.pendingAudioRemoveRanges.push({start:r,end:t})}}else o0||this.pendingAudioRemoveRanges.length>0}_doRemoveRanges(){if(this.sourceBuffer&&pa(this.getSourceBufferUpdating())){let e=this.pendingRemoveRanges;for(;e.length&&pa(this.getSourceBufferUpdating());){let t=e.shift();try{this.sourceBuffer.remove(t.start,t.end)}catch(e){this.player.debugWarn(this.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e)}}}if(this.audioSourceBuffer&&pa(this.getAudioSourceBufferUpdating())){let e=this.pendingAudioRemoveRanges;for(;e.length&&pa(this.getAudioSourceBufferUpdating());){let t=e.shift();try{this.audioSourceBuffer.remove(t.start,t.end)}catch(e){this.player.debugWarn(this.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e)}}}}getDecodePlaybackRate(){let e=0;const t=this.$videoElement;return t&&(e=t.playbackRate),e}_getPlaybackRate(e){const t=this.$videoElement;let i=this.player._opt.videoBufferDelay+this.player._opt.videoBuffer;const s=Math.max(i,1e3),r=s/2;return e*=1e3,1===t.playbackRate?e>s?1.2:1:e<=r?1:t.playbackRate}_needCleanupSourceBuffer(){if(pa(this.player._opt.mseAutoCleanupSourceBuffer)||!this.$videoElement)return!1;const e=this.$videoElement,t=e.buffered,i=e.currentTime;return t.length>=1&&i-t.start(0)>=this.player._opt.mseAutoCleanupMaxBackwardDuration}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}getVideoBufferLastTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;i.length&&i.start(0);t=i.length?i.end(i.length-1):0}return t}getVideoBufferTimeRange(){const e=this.$videoElement;let t=null;if(e){const i=e.buffered,s=i.length?i.start(0):0,r=i.length?i.end(i.length-1):0;t={start:s,end:r,diff:r-s}}return t}getVideoBufferStartTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;t=i.length?i.start(0):0}return t}getVideoBufferEndTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;t=i.length?i.end(i.length-1):0}return t}getVideoBufferRangeList(){const e=this.$videoElement;let t=[];if(e){const i=e.buffered;for(let e=0;e0?t:0}_clearAudioSourceBufferCheckTimeout(){this.audioSourceBufferCheckTimeout&&(clearTimeout(this.audioSourceBufferCheckTimeout),this.audioSourceBufferCheckTimeout=null)}_clearAudioNoDataCheckTimeout(){this.audioSourceNoDataCheckTimeout&&(clearTimeout(this.audioSourceNoDataCheckTimeout),this.audioSourceNoDataCheckTimeout=null)}getMimeType(){return{video:this.videoMimeType,audio:this.audioMimeType}}getMseBufferMaxDelayTime(){let e=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3;return Math.max(5,e+3)}isVideoPlaying(){return this.$videoElement&&pa(this.$videoElement.paused)&&pa(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}}const uc=()=>"wakeLock"in navigator&&-1===window.navigator.userAgent.indexOf("Samsung")&&pa(fo());class pc{constructor(e){this.player=e,this.enabled=!1,uc()?(this.player.debugLog("NoSleep","Native Wake Lock API supported."),this._wakeLock=null,this.handleVisibilityChange=()=>{null!==this._wakeLock&&"visible"===document.visibilityState&&this.enable()},document.addEventListener("visibilitychange",this.handleVisibilityChange),document.addEventListener("fullscreenchange",this.handleVisibilityChange)):(this.player.debugLog("NoSleep","Native Wake Lock API not supported. so use video element."),this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQRChYECGFOAZwEAAAAAABLfEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHYTbuMU6uEElTDZ1OsggGXTbuMU6uEHFO7a1OsghLJ7AEAAAAAAABZAAAAAA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YD4//6jh4IDSYD4//6jh4IDXYD4//6jh4IDcYD4//6jh4IDhYD4//6jnoEDiwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggOZgPj//qOHggOtgPj//qOHggPBgPj//qOHggPVgPj//qOHggPpgPj//qOegQPvANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCA/2A+P/+o4eCBBGA+P/+o4eCBCWA+P/+o4eCBDmA+P/+o4eCBE2A+P/+o56BBFMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IEiID4//6jh4IEnID4//6jh4IEsID4//6jnoEEtwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggTEgPj//qOHggTYgPj//qOHggTsgPj//qOHggUAgPj//qOHggUUgPj//qOegQUbANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCBSiA+P/+o4eCBTyA+P/+o4eCBVCA+P/+o4eCBWSA+P/+o4eCBXiA+P/+o56BBX8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IFjID4//6jh4IFoID4//6jh4IFtID4//6jh4IFyID4//6jh4IF3ID4//6jnoEF4wDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggXwgPj//qOHggYEgPj//qOHggYYgPj//qOHggYsgPj//qOHggZAgPj//qOegQZHANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCBlSA+P/+o4eCBmiA+P/+o4eCBnyA+P/+o4eCBpCA+P/+o4eCBqSA+P/+o56BBqsA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IGuID4//6jh4IGzID4//6jh4IG4ID4//6jh4IG9ID4//6jh4IHCID4//6jnoEHDwDRAgAFEBAUYABhYL/QACIAEM1+tck+ccwAAKOHggccgPj//qOHggcwgPj//qOHggdEgPj//qOHggdYgPj//qOHggdsgPj//qOegQdzANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCB4CA+P/+o4eCB5SA+P/+o4eCB6iA+P/+o4eCB7yA+P/+o4eCB9CA+P/+o56BB9cA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IH5ID4//6jh4IH+ID4//6jh4IIDID4//6jh4IIIID4//6jh4IINID4//6jnoEIOwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgghIgPj//qOHgghcgPj//qOHgghwgPj//qOHggiEgPj//qOegQifANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCMCA+P/+o4eCCNSA+P/+o4eCCOiA+P/+o4eCCPyA+P/+o56BCQMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IJEID4//6jh4IJJID4//6jh4IJOID4//6jh4IJTID4//6jh4IJYID4//6jnoEJZwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggl0gPj//qOHggmIgPj//qOHggmcgPj//qOHggmwgPj//qOHggnEgPj//qOegQnLANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCdiA+P/+o4eCCeyA+P/+o4eCCgCA+P/+o4eCChSA+P/+o4eCCiiA+P/+o56BCi8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IKPID4//6jh4IKUID4//6jh4IKZID4//6jh4IKeID4//6jh4IKjID4//6jnoEKkwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggqggPj//qOHggq0gPj//qOHggrIgPj//qOHggrcgPj//qOHggrwgPj//qOegQr3ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCwSA+P/+o4eCCxiA+P/+o4eCCyyA+P/+o4eCC0CA+P/+o4eCC1SA+P/+o56BC1sA0QIABRAQFGAAYWC/0AAiABDNfrXJPnHMAACjh4ILaID4//6jh4ILfID4//6jh4ILkID4//6jh4ILpID4//6jh4ILuID4//6jnoELvwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggvMgPj//qOHggvggPj//qOHggv0gPj//qOHggwIgPj//qOHggwcgPj//qOegQwjANECAAUQrAAYABhYL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nHMAAKOHghB8gPj//qOHghCQgPj//qOHghCkgPj//qOHghC4gPj//qOHghDMgPj//qOegRDTANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEOCA+P/+o4eCEPSA+P/+o4eCEQiA+P/+o56BETcA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IRQ4D4//6jh4IRV4D4//6jh4IRa4D4//6jh4IRf4D4//6jh4IRk4D4//6jnoERmwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghGngPj//qOHghG7gPj//qOHghHPgPj//qOHghHjgPj//qOHghH3gPj//qOegRH/ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEguA+P/+o4eCEh+A+P/+o4eCEjOA+P/+o4eCEkeA+P/+o4eCEluA+P/+o56BEmMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4ISb4D4//6jh4ISg4D4//6jh4ISl4D4//6jh4ISq4D4//6jh4ISv4D4//6jnoESxwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghLTgPj//qOHghLngPj//qOHghL7gPj//qOHghMPgPj//qOHghMjgPj//qOegRMrANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEzeA+P/+o4eCE0uA+P/+o4eCE1+A+P/+o4eCE3OA+P/+oAEAAAAAAAAPoYeCE4cA+P/+daKDB/KBHFO7a5G7j7OBB7eK94EB8YIDX/CBDA=="),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACORtZGF03gIATGF2YzU4LjM1LjEwMAACMEAOAAACcQYF//9t3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MSByMzAyNyA0MTIxMjc3IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAyMCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTAgcmVmPTMgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9NyBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0xIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MSA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0tMiB0aHJlYWRzPTcgbG9va2FoZWFkX3RocmVhZHM9MSBzbGljZWRfdGhyZWFkcz0wIG5yPTAgZGVjaW1hdGU9MSBpbnRlcmxhY2VkPTAgYmx1cmF5X2NvbXBhdD0wIGNvbnN0cmFpbmVkX2ludHJhPTAgYmZyYW1lcz0wIHdlaWdodHA9MCBrZXlpbnQ9MjUwIGtleWludF9taW49MTAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD00MCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIzLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IGlwX3JhdGlvPTEuNDAgYXE9MToxLjAwAIAAAADvZYiED/JigADD7JycnJycnJycnJycnJycnJycnJ11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111114BGCAHARggBwEYIAcBGCAHARggBwAAAAdBmjgf4BLYARggBwEYIAcBGCAHARggBwAAAAdBmlQH+AS2ARggBwEYIAcBGCAHARggBwAAAAdBmmA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZqAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZqgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZrAP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0Ga4D/AJbABGCAHARggBwEY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AAEdgAABJEAAASsAAAEywAABOIAAAT5AAAFGAAABTMAAAVOAAAFbQAABYgAAAWjAAAFwgAABd0AAAX4AAAGDwAABioAAAZFAAAGZAAABn8AAAaaAAAGuQAABtQAAAbvAAAHDgAABykAAAc8AAAHWwAAB3YAAAeRAAAHsAAAB8sAAAfmAAAIBQAACCAAAAg7AAAIWgAACG0AAAiIAAAIpwAACMIAAAjdAAAI/AAAABpzZ3BkAQAAAHJvbGwAAAACAAAAAf//AAAAHHNiZ3AAAAAAcm9sbAAAAAEAAADSAAAAAQAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTguMjAuMTAw"),Object.assign(this.noSleepVideo.style,{position:"absolute",left:"-100%",top:"-100%"}),document.querySelector("body").append(this.noSleepVideo),this.handleNoSleepVideoTimeUpdate=()=>{this.noSleepVideo&&this.noSleepVideo.currentTime>4&&(this.noSleepVideo.currentTime=1)},this.noSleepVideo.addEventListener("timeupdate",this.handleNoSleepVideoTimeUpdate))}destroy(){if(this._wakeLock&&(this._wakeLock.release(),this._wakeLock=null),this.noSleepVideo){this.handleNoSleepVideoTimeUpdate&&this.noSleepVideo.removeEventListener("timeupdate",this.handleNoSleepVideoTimeUpdate);try{this.noSleepVideo.parentNode&&this.noSleepVideo.parentNode.removeChild(this.noSleepVideo)}catch(e){this.player.debugWarn("NoSleep","Failed to remove noSleepVideo element.")}this.noSleepVideo=null}this.handleVisibilityChange&&(document.removeEventListener("visibilitychange",this.handleVisibilityChange),document.removeEventListener("fullscreenchange",this.handleVisibilityChange))}_addSourceToVideo(e,t,i){var s=document.createElement("source");s.src=i,s.type=`video/${t}`,e.appendChild(s)}get isEnabled(){return this.enabled}enable(){if(uc())return navigator.wakeLock.request("screen").then((e=>{this._wakeLock=e,this.enabled=!0,this.player.debugLog("wakeLock","Wake Lock active."),this._wakeLock.addEventListener("release",(()=>{this.player.debugLog("wakeLock","Wake Lock released.")}))})).catch((e=>{throw this.enabled=!1,this.player.debugWarn("wakeLock",`${e.name}, ${e.message}`),e}));return this.noSleepVideo.play().then((e=>(this.player.debugLog("wakeLock","noSleepVideo Wake Lock active."),this.enabled=!0,e))).catch((e=>{throw this.player.debugWarn("wakeLock",`noSleepVideo ${e.name}, ${e.message}`),this.enabled=!1,e}))}disable(){uc()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):this.noSleepVideo&&this.noSleepVideo.pause(),this.enabled=!1,this.player.debugLog("wakeLock","Disabling wake lock.")}}function fc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var mc={exports:{}};!function(e,t){var i,s,r,o,a;i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=a.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=a.normalizePath(r.path),a.buildURLFromParts(r)}var o=a.parseURL(t);if(!o)throw new Error("Error trying to parse relative URL.");if(o.scheme)return i.alwaysNormalize?(o.path=a.normalizePath(o.path),a.buildURLFromParts(o)):t;var n=a.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");if(!n.netLoc&&n.path&&"/"!==n.path[0]){var l=s.exec(n.path);n.netLoc=l[1],n.path=l[2]}n.netLoc&&!n.path&&(n.path="/");var d={scheme:n.scheme,netLoc:o.netLoc,path:null,params:o.params,query:o.query,fragment:o.fragment};if(!o.netLoc&&(d.netLoc=n.netLoc,"/"!==o.path[0]))if(o.path){var h=n.path,c=h.substring(0,h.lastIndexOf("/")+1)+o.path;d.path=a.normalizePath(c)}else d.path=n.path,o.params||(d.params=n.params,o.query||(d.query=n.query));return null===d.path&&(d.path=i.alwaysNormalize?a.normalizePath(o.path):o.path),a.buildURLFromParts(d)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");e.length!==(e=e.replace(o,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=a}(mc);var gc=mc.exports;function yc(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function Ac(e){for(var t=1;t`):Cc}(t)}))}const Pc=xc,Bc=/^(\d+)x(\d+)$/,Ic=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Mc{constructor(e){"string"==typeof e&&(e=Mc.parseAttrList(e)),_c(this,e)}get clientAttrs(){return Object.keys(this).filter((e=>"X-"===e.substring(0,2)))}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;const i=new Uint8Array(t.length/2);for(let e=0;eNumber.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}bool(e){return"YES"===this[e]}decimalResolution(e){const t=Bc.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const i={};for(Ic.lastIndex=0;null!==(t=Ic.exec(e));){let e=t[2];0===e.indexOf('"')&&e.lastIndexOf('"')===e.length-1&&(e=e.slice(1,-1));i[t[1].trim()]=e}return i}}function Fc(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e}class Uc{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const i=t.attr;for(const t in i)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==i[t]){Pc.warn(`DATERANGE tag attribute: "${t}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=t;break}e=_c(new Mc({}),i,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const e=new Date(this.attr["END-DATE"]);Sc(e.getTime())&&(this._endDate=e)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return null!==e?new Date(this._startDate.getTime()+1e3*e):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(Sc(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&Sc(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class Oc{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var Nc="audio",jc="video",Gc="audiovideo";class zc{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[Nc]:null,[jc]:null,[Gc]:null},this.baseurl=e}setByteRange(e,t){const i=e.split("@",2);let s;s=1===i.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(i[1]),this._byteRange=[s,parseInt(i[0])+s]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=gc.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class Wc extends zc{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new Oc,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const e=this.levelkeys.identity;if(e)this._decryptdata=e.getDecryptData(this.sn);else{const e=Object.keys(this.levelkeys);if(1===e.length)return this._decryptdata=this.levelkeys[e[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;if(!Sc(this.programDateTime))return null;const e=Sc(this.duration)?this.duration:0;return this.programDateTime+1e3*e}get encrypted(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){const e=Object.keys(this.levelkeys),t=e.length;if(t>1||1===t&&this.levelkeys[e[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()}setElementaryStreamInfo(e,t,i,s,r,o=!1){const{elementaryStreams:a}=this,n=a[e];n?(n.startPTS=Math.min(n.startPTS,t),n.endPTS=Math.max(n.endPTS,i),n.startDTS=Math.min(n.startDTS,s),n.endDTS=Math.max(n.endDTS,r)):a[e]={startPTS:t,endPTS:i,startDTS:s,endDTS:r,partial:o}}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Nc]=null,e[jc]=null,e[Gc]=null}}class Vc extends zc{constructor(e,t,i,s,r){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new Oc,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=s;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}class Hc{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e)return this.advanced=!0,void(this.updated=!0);const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&i>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return!!this.fragments.length&&Sc(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){const e=this.driftEndTime-this.driftStartTime;if(e>0){return 1e3*(this.driftEnd-this.driftStart)/e}return 1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function $c(e){return Uint8Array.from(atob(e),(e=>e.charCodeAt(0)))}function Jc(e){const t=e.split(":");let i=null;if("data"===t[0]&&2===t.length){const e=t[1].split(";"),s=e[e.length-1].split(",");if(2===s.length){const t="base64"===s[0],r=s[1];t?(e.splice(-1,1),i=$c(r)):i=function(e){const t=qc(e).subarray(0,16),i=new Uint8Array(16);return i.set(t,16-t.length),i}(r)}}return i}function qc(e){return Uint8Array.from(unescape(encodeURIComponent(e)),(e=>e.charCodeAt(0)))}const Kc="undefined"!=typeof self?self:void 0;var Yc={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Qc="org.w3.clearkey",Xc="com.apple.streamingkeydelivery",Zc="com.microsoft.playready",eu="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function tu(e){switch(e){case Xc:return Yc.FAIRPLAY;case Zc:return Yc.PLAYREADY;case eu:return Yc.WIDEVINE;case Qc:return Yc.CLEARKEY}}var iu="edef8ba979d64acea3c827dcd51d21ed";function su(e){switch(e){case Yc.FAIRPLAY:return Xc;case Yc.PLAYREADY:return Zc;case Yc.WIDEVINE:return eu;case Yc.CLEARKEY:return Qc}}function ru(e){const{drmSystems:t,widevineLicenseUrl:i}=e,s=t?[Yc.FAIRPLAY,Yc.WIDEVINE,Yc.PLAYREADY,Yc.CLEARKEY].filter((e=>!!t[e])):[];return!s[Yc.WIDEVINE]&&i&&s.push(Yc.WIDEVINE),s}const ou=null!=Kc&&null!=(au=Kc.navigator)&&au.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;var au;function nu(e,t,i){return Uint8Array.prototype.slice?e.slice(t,i):new Uint8Array(Array.prototype.slice.call(e,t,i))}const lu=(e,t)=>t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128,du=(e,t)=>t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128,hu=(e,t)=>{const i=t;let s=0;for(;lu(e,t);){s+=10;s+=cu(e,t+6),du(e,t+10)&&(s+=10),t+=s}if(s>0)return e.subarray(i,i+s)},cu=(e,t)=>{let i=0;return i=(127&e[t])<<21,i|=(127&e[t+1])<<14,i|=(127&e[t+2])<<7,i|=127&e[t+3],i},uu=(e,t)=>lu(e,t)&&cu(e,t+6)+10<=e.length-t,pu=e=>{const t=gu(e);for(let e=0;ee&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info,mu=e=>{const t=String.fromCharCode(e[0],e[1],e[2],e[3]),i=cu(e,4);return{type:t,size:i,data:e.subarray(10,10+i)}},gu=e=>{let t=0;const i=[];for(;lu(e,t);){const s=cu(e,t+6);t+=10;const r=t+s;for(;t+8"PRIV"===e.type?Au(e):"W"===e.type[0]?vu(e):bu(e),Au=e=>{if(e.size<2)return;const t=Su(e.data,!0),i=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:i.buffer}},bu=e=>{if(e.size<2)return;if("TXXX"===e.type){let t=1;const i=Su(e.data.subarray(t),!0);t+=i.length+1;const s=Su(e.data.subarray(t));return{key:e.type,info:i,data:s}}const t=Su(e.data.subarray(1));return{key:e.type,data:t}},vu=e=>{if("WXXX"===e.type){if(e.size<2)return;let t=1;const i=Su(e.data.subarray(t),!0);t+=i.length+1;const s=Su(e.data.subarray(t));return{key:e.type,info:i,data:s}}const t=Su(e.data);return{key:e.type,data:t}},_u=e=>{if(8===e.data.byteLength){const t=new Uint8Array(e.data),i=1&t[3];let s=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return s/=45,i&&(s+=47721858.84),Math.round(s)}},Su=(e,t=!1)=>{const i=wu();if(i){const s=i.decode(e);if(t){const e=s.indexOf("\0");return-1!==e?s.substring(0,e):s}return s.replace(/\0/g,"")}const s=e.length;let r,o,a,n="",l=0;for(;l>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:n+=String.fromCharCode(r);break;case 12:case 13:o=e[l++],n+=String.fromCharCode((31&r)<<6|63&o);break;case 14:o=e[l++],a=e[l++],n+=String.fromCharCode((15&r)<<12|(63&o)<<6|(63&a)<<0)}}return n};let Eu;function wu(){if(!navigator.userAgent.includes("PlayStation 4"))return Eu||void 0===self.TextDecoder||(Eu=new self.TextDecoder("utf-8")),Eu}const Tu=function(e){let t="";for(let i=0;i>24,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i}function Mu(e,t){const i=[];if(!t.length)return i;const s=e.byteLength;for(let r=0;r1?r+o:s;if(Du(e.subarray(r+4,r+8))===t[0])if(1===t.length)i.push(e.subarray(r+8,a));else{const s=Mu(e.subarray(r+8,a),t.slice(1));s.length&&Lu.apply(i,s)}r=a}return i}function Fu(e){const t=[],i=e[0];let s=8;const r=Ru(e,s);s+=4;let o=0,a=0;0===i?(o=Ru(e,s),a=Ru(e,s+4),s+=8):(o=Pu(e,s),a=Pu(e,s+8),s+=16),s+=2;let n=e.length+a;const l=xu(e,s);s+=2;for(let i=0;i>>31)return Pc.warn("SIDX has hierarchical references (not supported)"),null;const l=Ru(e,i);i+=4,t.push({referenceSize:a,subsegmentDuration:l,info:{duration:l/r,start:n,end:n+a-1}}),n+=a,i+=4,s=i}return{earliestPresentationTime:o,timescale:r,version:i,referencesCount:l,references:t}}function Uu(e){const t=[],i=Mu(e,["moov","trak"]);for(let e=0;e{const i=Ru(e,4),s=t[i];s&&(s.default={duration:Ru(e,12),flags:Ru(e,20)})})),t}function Ou(e){const t=e.subarray(8),i=t.subarray(86),s=Du(t.subarray(4,8));let r=s;const o="enca"===s||"encv"===s;if(o){const e=Mu(t,[s])[0];Mu(e.subarray("enca"===s?28:78),["sinf"]).forEach((e=>{const t=Mu(e,["schm"])[0];if(t){const i=Du(t.subarray(4,8));if("cbcs"===i||"cenc"===i){const t=Mu(e,["frma"])[0];t&&(r=Du(t))}}}))}switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const e=Mu(i,["avcC"])[0];r+="."+ju(e[1])+ju(e[2])+ju(e[3]);break}case"mp4a":{const e=Mu(t,[s])[0],i=Mu(e.subarray(28),["esds"])[0];if(i&&i.length>12){let e=4;if(3!==i[e++])break;e=Nu(i,e),e+=2;const t=i[e++];if(128&t&&(e+=2),64&t&&(e+=i[e++]),4!==i[e++])break;e=Nu(i,e);const s=i[e++];if(64!==s)break;if(r+="."+ju(s),e+=12,5!==i[e++])break;e=Nu(i,e);const o=i[e++];let a=(248&o)>>3;31===a&&(a+=1+((7&o)<<3)+((224&i[e])>>5)),r+="."+a}break}case"hvc1":case"hev1":{const e=Mu(i,["hvcC"])[0],t=e[1],s=["","A","B","C"][t>>6],o=31&t,a=Ru(e,2),n=(32&t)>>5?"H":"L",l=e[12],d=e.subarray(6,12);r+="."+s+o,r+="."+a.toString(16).toUpperCase(),r+="."+n+l;let h="";for(let e=d.length;e--;){const t=d[e];if(t||h){h="."+t.toString(16).toUpperCase()+h}}r+=h;break}case"dvh1":case"dvhe":{const e=Mu(i,["dvcC"])[0],t=e[2]>>1&127,s=e[2]<<5&32|e[3]>>3&31;r+="."+Gu(t)+"."+Gu(s);break}case"vp09":{const e=Mu(i,["vpcC"])[0],t=e[4],s=e[5],o=e[6]>>4&15;r+="."+Gu(t)+"."+Gu(s)+"."+Gu(o);break}case"av01":{const e=Mu(i,["av1C"])[0],t=e[1]>>>5,s=31&e[1],o=e[2]>>>7?"H":"M",a=(64&e[2])>>6,n=(32&e[2])>>5,l=2===t&&a?n?12:10:a?10:8,d=(16&e[2])>>4,h=(8&e[2])>>3,c=(4&e[2])>>2,u=3&e[2],p=1,f=1,m=1,g=0;r+="."+t+"."+Gu(s)+o+"."+Gu(l)+"."+d+"."+h+c+u+"."+Gu(p)+"."+Gu(f)+"."+Gu(m)+"."+g;break}}return{codec:r,encrypted:o}}function Nu(e,t){const i=t+5;for(;128&e[t++]&&t{const l=n.byteOffset-8;Mu(n,["traf"]).map((n=>{const d=Mu(n,["tfdt"]).map((e=>{const t=e[0];let i=Ru(e,4);return 1===t&&(i*=Math.pow(2,32),i+=Ru(e,8)),i/r}))[0];return void 0!==d&&(e=d),Mu(n,["tfhd"]).map((d=>{const h=Ru(d,4),c=16777215&Ru(d,0);let u=0;const p=0!=(16&c);let f=0;const m=0!=(32&c);let g=8;h===o&&(0!=(1&c)&&(g+=8),0!=(2&c)&&(g+=4),0!=(8&c)&&(u=Ru(d,g),g+=4),p&&(f=Ru(d,g),g+=4),m&&(g+=4),"video"===t.type&&(a=function(e){if(!e)return!1;const t=e.indexOf("."),i=t<0?e:e.substring(0,t);return"hvc1"===i||"hev1"===i||"dvh1"===i||"dvhe"===i}(t.codec)),Mu(n,["trun"]).map((o=>{const n=o[0],d=16777215&Ru(o,0),h=0!=(1&d);let c=0;const p=0!=(4&d),m=0!=(256&d);let g=0;const y=0!=(512&d);let A=0;const b=0!=(1024&d),v=0!=(2048&d);let _=0;const S=Ru(o,4);let E=8;h&&(c=Ru(o,E),E+=4),p&&(E+=4);let w=c+l;for(let l=0;l>1&63;return 39===e||40===e}return 6===(31&t)}function Ju(e,t,i,s){const r=qu(e);let o=0;o+=t;let a=0,n=0,l=0;for(;o=r.length)break;l=r[o++],a+=l}while(255===l);n=0;do{if(o>=r.length)break;l=r[o++],n+=l}while(255===l);const e=r.length-o;let t=o;if(ne){Pc.error(`Malformed SEI payload. ${n} is too small, only ${e} bytes left to parse.`);break}if(4===a){if(181===r[t++]){const e=xu(r,t);if(t+=2,49===e){const e=Ru(r,t);if(t+=4,1195456820===e){const e=r[t++];if(3===e){const o=r[t++],n=31&o,l=64&o,d=l?2+3*n:0,h=new Uint8Array(d);if(l){h[0]=o;for(let e=1;e16){const e=[];for(let i=0;i<16;i++){const s=r[t++].toString(16);e.push(1==s.length?"0"+s:s),3!==i&&5!==i&&7!==i&&9!==i||e.push("-")}const o=n-16,l=new Uint8Array(o);for(let e=0;e0?(o=new Uint8Array(4),t.length>0&&new DataView(o.buffer).setUint32(0,t.length,!1)):o=new Uint8Array;const a=new Uint8Array(4);return i&&i.byteLength>0&&new DataView(a.buffer).setUint32(0,i.byteLength,!1),function(e,...t){const i=t.length;let s=8,r=i;for(;r--;)s+=t[r].byteLength;const o=new Uint8Array(s);for(o[0]=s>>24&255,o[1]=s>>16&255,o[2]=s>>8&255,o[3]=255&s,o.set(e,4),r=0,s=8;r>8*(15-i)&255;return t}(e);return new Qu(this.method,this.uri,"identity",this.keyFormatVersions,t)}const t=Jc(this.uri);if(t)switch(this.keyFormat){case eu:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case Zc:{const e=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Ku(e,null,t);const i=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),s=String.fromCharCode.apply(null,Array.from(i)),r=s.substring(s.indexOf("<"),s.length),o=(new DOMParser).parseFromString(r,"text/xml").getElementsByTagName("KID")[0];if(o){const e=o.childNodes[0]?o.childNodes[0].nodeValue:o.getAttribute("VALUE");if(e){const t=$c(e).subarray(0,16);!function(e){const t=function(e,t,i){const s=e[t];e[t]=e[i],e[i]=s};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}(t),this.keyId=t}}break}default:{let e=t.subarray(0,16);if(16!==e.length){const t=new Uint8Array(16);t.set(e,16-e.length),e=t}this.keyId=e;break}}if(!this.keyId||16!==this.keyId.byteLength){let e=Yu[this.uri];if(!e){const t=Object.keys(Yu).length%Number.MAX_SAFE_INTEGER;e=new Uint8Array(16);new DataView(e.buffer,12,4).setUint32(0,t),Yu[this.uri]=e}this.keyId=e}return this}}const Xu=/\{\$([a-zA-Z0-9-_]+)\}/g;function Zu(e){return Xu.test(e)}function ep(e,t,i){if(null!==e.variableList||e.hasVariableRefs)for(let s=i.length;s--;){const r=i[s],o=t[r];o&&(t[r]=tp(e,o))}}function tp(e,t){if(null!==e.variableList||e.hasVariableRefs){const i=e.variableList;return t.replace(Xu,(t=>{const s=t.substring(2,t.length-1),r=null==i?void 0:i[s];return void 0===r?(e.playlistParsingError||(e.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${s}"`)),t):r}))}return t}function ip(e,t,i){let s,r,o=e.variableList;if(o||(e.variableList=o={}),"QUERYPARAM"in t){s=t.QUERYPARAM;try{const e=new self.URL(i).searchParams;if(!e.has(s))throw new Error(`"${s}" does not match any query parameter in URI: "${i}"`);r=e.get(s)}catch(t){e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${t.message}`))}}else s=t.NAME,r=t.VALUE;s in o?e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${s}"`)):o[s]=r||""}function sp(e,t,i){const s=t.IMPORT;if(i&&s in i){let t=e.variableList;t||(e.variableList=t={}),t[s]=i[s]}else e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}function rp(e=!0){if("undefined"==typeof self)return;return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}const op={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function ap(e,t,i=!0){return!e.split(",").some((e=>!np(e,t,i)))}function np(e,t,i=!0){var s;const r=rp(i);return null!=(s=null==r?void 0:r.isTypeSupported(lp(e,t)))&&s}function lp(e,t){return`${t}/mp4;codecs="${e}"`}function dp(e){if(e){const t=e.substring(0,4);return op.video[t]}return 2}function hp(e){return e.split(",").reduce(((e,t)=>{const i=op.video[t];return i?(2*i+e)/(e?3:2):(op.audio[t]+e)/(e?2:1)}),0)}const cp={};const up=/flac|opus/i;function pp(e,t=!0){return e.replace(up,(e=>function(e,t=!0){if(cp[e])return cp[e];const i={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[e];for(let s=0;s0&&s.length({id:e.attrs.AUDIO,audioCodec:e.audioCodec}))),SUBTITLES:o.map((e=>({id:e.attrs.SUBTITLES,textCodec:e.textCodec}))),"CLOSED-CAPTIONS":[]};let n=0;for(gp.lastIndex=0;null!==(s=gp.exec(e));){const e=new Mc(s[1]),o=e.TYPE;if(o){const s=a[o],l=r[o]||[];r[o]=l,ep(i,e,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d=e.LANGUAGE,h=e["ASSOC-LANGUAGE"],c=e.CHANNELS,u=e.CHARACTERISTICS,p=e["INSTREAM-ID"],f={attrs:e,bitrate:0,id:n++,groupId:e["GROUP-ID"]||"",name:e.NAME||d||"",type:o,default:e.bool("DEFAULT"),autoselect:e.bool("AUTOSELECT"),forced:e.bool("FORCED"),lang:d,url:e.URI?vp.resolve(e.URI,t):""};if(h&&(f.assocLang=h),c&&(f.channels=c),u&&(f.characteristics=u),p&&(f.instreamId=p),null!=s&&s.length){const e=vp.findGroup(s,f.groupId)||s[0];wp(f,e,"audioCodec"),wp(f,e,"textCodec")}l.push(f)}}return r}static parseLevelPlaylist(e,t,i,s,r,o){const a=new Hc(t),n=a.fragments;let l,d,h,c=null,u=0,p=0,f=0,m=0,g=null,y=new Wc(s,t),A=-1,b=!1,v=null;for(Ap.lastIndex=0,a.m3u8=e,a.hasVariableRefs=Zu(e);null!==(l=Ap.exec(e));){b&&(b=!1,y=new Wc(s,t),y.start=f,y.sn=u,y.cc=m,y.level=i,c&&(y.initSegment=c,y.rawProgramDateTime=c.rawProgramDateTime,c.rawProgramDateTime=null,v&&(y.setByteRange(v),v=null)));const e=l[1];if(e){y.duration=parseFloat(e);const t=(" "+l[2]).slice(1);y.title=t||null,y.tagList.push(t?["INF",e,t]:["INF",e])}else if(l[3]){if(Sc(y.duration)){y.start=f,h&&Lp(y,h,a),y.sn=u,y.level=i,y.cc=m,n.push(y);const e=(" "+l[3]).slice(1);y.relurl=tp(a,e),Tp(y,g),g=y,f+=y.duration,u++,p=0,b=!0}}else if(l[4]){const e=(" "+l[4]).slice(1);g?y.setByteRange(e,g):y.setByteRange(e)}else if(l[5])y.rawProgramDateTime=(" "+l[5]).slice(1),y.tagList.push(["PROGRAM-DATE-TIME",y.rawProgramDateTime]),-1===A&&(A=n.length);else{if(l=l[0].match(bp),!l){Pc.warn("No matches on slow regex match for level playlist!");continue}for(d=1;d0&&e.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=e.optionalFloat("PART-HOLD-BACK",0),a.holdBack=e.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const e=new Mc(r);a.partTarget=e.decimalFloatingPoint("PART-TARGET");break}case"PART":{let e=a.partList;e||(e=a.partList=[]);const i=p>0?e[e.length-1]:void 0,s=p++,o=new Mc(r);ep(a,o,["BYTERANGE","URI"]);const n=new Vc(o,y,t,s,i);e.push(n),y.duration+=n.duration;break}case"PRELOAD-HINT":{const e=new Mc(r);ep(a,e,["URI"]),a.preloadHint=e;break}case"RENDITION-REPORT":{const e=new Mc(r);ep(a,e,["URI"]),a.renditionReports=a.renditionReports||[],a.renditionReports.push(e);break}default:Pc.warn(`line parsed but not handled: ${l}`)}}}g&&!g.relurl?(n.pop(),f-=g.duration,a.partList&&(a.fragmentHint=g)):a.partList&&(Tp(y,g),y.cc=m,a.fragmentHint=y,h&&Lp(y,h,a));const _=n.length,S=n[0],E=n[_-1];if(f+=a.skippedSegments*a.targetduration,f>0&&_&&E){a.averagetargetduration=f/_;const e=E.sn;a.endSN="initSegment"!==e?e:0,a.live||(E.endList=!0),S&&(a.startCC=S.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(f+=a.fragmentHint.duration),a.totalduration=f,a.endCC=m,A>0&&function(e,t){let i=e[t];for(let s=t;s--;){const t=e[s];if(!t)return;t.programDateTime=i.programDateTime-1e3*t.duration,i=t}}(n,A),a}}function _p(e,t,i){var s,r;const o=new Mc(e);ep(i,o,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const a=null!=(s=o.METHOD)?s:"",n=o.URI,l=o.hexadecimalInteger("IV"),d=o.KEYFORMATVERSIONS,h=null!=(r=o.KEYFORMAT)?r:"identity";n&&o.IV&&!l&&Pc.error(`Invalid IV: ${o.IV}`);const c=n?vp.resolve(n,t):"",u=(d||"1").split("/").map(Number).filter(Number.isFinite);return new Qu(a,c,h,u,l)}function Sp(e){const t=new Mc(e).decimalFloatingPoint("TIME-OFFSET");return Sc(t)?t:null}function Ep(e,t){let i=(e||"").split(/[ ,]+/).filter((e=>e));["video","audio","text"].forEach((e=>{const s=i.filter((t=>function(e,t){const i=op[t];return!!i&&!!i[e.slice(0,4)]}(t,e)));s.length&&(t[`${e}Codec`]=s.join(","),i=i.filter((e=>-1===s.indexOf(e))))})),t.unknownCodecs=i}function wp(e,t,i){const s=t[i];s&&(e[i]=s)}function Tp(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),Sc(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}function kp(e,t,i,s){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=i,e.sn="initSegment",s&&(e.levelkeys=s),e.initSegment=null}function Lp(e,t,i){e.levelkeys=t;const{encryptedFragments:s}=i;s.length&&s[s.length-1].levelkeys===t||!Object.keys(t).some((e=>t[e].isCommonEncryption))||s.push(e)}var Cp="manifest",Dp="level",xp="audioTrack",Rp="subtitleTrack",Pp="main",Bp="audio",Ip="subtitle";function Mp(e){const{type:t}=e;switch(t){case xp:return Bp;case Rp:return Ip;default:return Pp}}function Fp(e,t){let i=e.url;return void 0!==i&&0!==i.indexOf("data:")||(i=t.url),i}class Up{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tc.LEVEL_LOADING,this.onLevelLoading,this),e.on(Tc.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(Tc.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tc.LEVEL_LOADING,this.onLevelLoading,this),e.off(Tc.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(Tc.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,s=t.loader,r=new(i||s)(t);return this.loaders[e.type]=r,r}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Cp,url:i,deliveryDirectives:null})}onLevelLoading(e,t){const{id:i,level:s,pathwayId:r,url:o,deliveryDirectives:a}=t;this.load({id:i,level:s,pathwayId:r,responseType:"text",type:Dp,url:o,deliveryDirectives:a})}onAudioTrackLoading(e,t){const{id:i,groupId:s,url:r,deliveryDirectives:o}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:xp,url:r,deliveryDirectives:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:s,url:r,deliveryDirectives:o}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:Rp,url:r,deliveryDirectives:o})}load(e){var t;const i=this.hls.config;let s,r=this.getInternalLoader(e);if(r){const t=r.context;if(t&&t.url===e.url&&t.level===e.level)return void Pc.trace("[playlist-loader]: playlist request ongoing");Pc.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}if(s=e.type===Cp?i.manifestLoadPolicy.default:_c({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),Sc(null==(t=e.deliveryDirectives)?void 0:t.part)){let t;if(e.type===Dp&&null!==e.level?t=this.hls.levels[e.level].details:e.type===xp&&null!==e.id?t=this.hls.audioTracks[e.id].details:e.type===Rp&&null!==e.id&&(t=this.hls.subtitleTracks[e.id].details),t){const e=t.partTarget,i=t.targetduration;if(e&&i){const t=1e3*Math.max(3*e,.8*i);s=_c({},s,{maxTimeToFirstByteMs:Math.min(t,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(t,s.maxTimeToFirstByteMs)})}}}const o=s.errorRetry||s.timeoutRetry||{},a={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},n={onSuccess:(e,t,i,s)=>{const r=this.getInternalLoader(i);this.resetInternalLoader(i.type);const o=e.data;0===o.indexOf("#EXTM3U")?(t.parsing.start=performance.now(),vp.isMediaPlaylist(o)?this.handleTrackOrLevelPlaylist(e,t,i,s||null,r):this.handleMasterPlaylist(e,t,i,s)):this.handleManifestParsingError(e,i,new Error("no EXTM3U delimiter"),s||null,t)},onError:(e,t,i,s)=>{this.handleNetworkError(t,i,!1,e,s)},onTimeout:(e,t,i)=>{this.handleNetworkError(t,i,!0,void 0,e)}};r.load(e,a,n)}handleMasterPlaylist(e,t,i,s){const r=this.hls,o=e.data,a=Fp(e,i),n=vp.parseMasterPlaylist(o,a);if(n.playlistParsingError)return void this.handleManifestParsingError(e,i,n.playlistParsingError,s,t);const{contentSteering:l,levels:d,sessionData:h,sessionKeys:c,startTimeOffset:u,variableList:p}=n;this.variableList=p;const{AUDIO:f=[],SUBTITLES:m,"CLOSED-CAPTIONS":g}=vp.parseMasterPlaylistMedia(o,a,n);if(f.length){f.some((e=>!e.url))||!d[0].audioCodec||d[0].attrs.AUDIO||(Pc.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),f.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Mc({}),bitrate:0,url:""}))}r.trigger(Tc.MANIFEST_LOADED,{levels:d,audioTracks:f,subtitles:m,captions:g,contentSteering:l,url:a,stats:t,networkDetails:s,sessionData:h,sessionKeys:c,startTimeOffset:u,variableList:p})}handleTrackOrLevelPlaylist(e,t,i,s,r){const o=this.hls,{id:a,level:n,type:l}=i,d=Fp(e,i),h=Sc(n)?n:Sc(a)?a:0,c=Mp(i),u=vp.parseLevelPlaylist(e.data,d,h,c,0,this.variableList);if(l===Cp){const e={attrs:new Mc({}),bitrate:0,details:u,name:"",url:d};o.trigger(Tc.MANIFEST_LOADED,{levels:[e],audioTracks:[],url:d,stats:t,networkDetails:s,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=u,this.handlePlaylistLoaded(u,e,t,i,s,r)}handleManifestParsingError(e,t,i,s,r){this.hls.trigger(Tc.ERROR,{type:kc.NETWORK_ERROR,details:Lc.MANIFEST_PARSING_ERROR,fatal:t.type===Cp,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:s,stats:r})}handleNetworkError(e,t,i=!1,s,r){let o=`A network ${i?"timeout":"error"+(s?" (status "+s.code+")":"")} occurred while loading ${e.type}`;e.type===Dp?o+=`: ${e.level} id: ${e.id}`:e.type!==xp&&e.type!==Rp||(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);Pc.warn(`[playlist-loader]: ${o}`);let n=Lc.UNKNOWN,l=!1;const d=this.getInternalLoader(e);switch(e.type){case Cp:n=i?Lc.MANIFEST_LOAD_TIMEOUT:Lc.MANIFEST_LOAD_ERROR,l=!0;break;case Dp:n=i?Lc.LEVEL_LOAD_TIMEOUT:Lc.LEVEL_LOAD_ERROR,l=!1;break;case xp:n=i?Lc.AUDIO_TRACK_LOAD_TIMEOUT:Lc.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case Rp:n=i?Lc.SUBTITLE_TRACK_LOAD_TIMEOUT:Lc.SUBTITLE_LOAD_ERROR,l=!1}d&&this.resetInternalLoader(e.type);const h={type:kc.NETWORK_ERROR,details:n,fatal:l,url:e.url,loader:d,context:e,error:a,networkDetails:t,stats:r};if(s){const i=(null==t?void 0:t.url)||e.url;h.response=Ac({url:i,data:void 0},s)}this.hls.trigger(Tc.ERROR,h)}handlePlaylistLoaded(e,t,i,s,r,o){const a=this.hls,{type:n,level:l,id:d,groupId:h,deliveryDirectives:c}=s,u=Fp(t,s),p=Mp(s),f="number"==typeof s.level&&p===Pp?l:void 0;if(!e.fragments.length){const e=new Error("No Segments found in Playlist");return void a.trigger(Tc.ERROR,{type:kc.NETWORK_ERROR,details:Lc.LEVEL_EMPTY_ERROR,fatal:!1,url:u,error:e,reason:e.message,response:t,context:s,level:f,parent:p,networkDetails:r,stats:i})}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const m=e.playlistParsingError;if(m)a.trigger(Tc.ERROR,{type:kc.NETWORK_ERROR,details:Lc.LEVEL_PARSING_ERROR,fatal:!1,url:u,error:m,reason:m.message,response:t,context:s,level:f,parent:p,networkDetails:r,stats:i});else switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),o.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),n){case Cp:case Dp:a.trigger(Tc.LEVEL_LOADED,{details:e,level:f||0,id:d||0,stats:i,networkDetails:r,deliveryDirectives:c});break;case xp:a.trigger(Tc.AUDIO_TRACK_LOADED,{details:e,id:d||0,groupId:h||"",stats:i,networkDetails:r,deliveryDirectives:c});break;case Rp:a.trigger(Tc.SUBTITLE_TRACK_LOADED,{details:e,id:d||0,groupId:h||"",stats:i,networkDetails:r,deliveryDirectives:c})}}}function Op(e,t){let i;try{i=new Event("addtrack")}catch(e){i=document.createEvent("Event"),i.initEvent("addtrack",!1,!1)}i.track=e,t.dispatchEvent(i)}function Np(e,t){const i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error(`addCue is failed for: ${t}`)}catch(i){Pc.debug(`[texttrack-utils]: ${i}`);try{const i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}catch(e){Pc.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${e}`)}}"disabled"===i&&(e.mode=i)}function jp(e){const t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(let t=e.cues.length;t--;)e.removeCue(e.cues[t]);"disabled"===t&&(e.mode=t)}function Gp(e,t,i,s){const r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&e.cues.length>0){const r=function(e,t,i){const s=[],r=function(e,t){if(te[i].endTime)return-1;let s=0,r=i;for(;s<=r;){const o=Math.floor((r+s)/2);if(te[o].startTime&&s-1)for(let o=r,a=e.length;o=t&&r.endTime<=i)s.push(r);else if(r.startTime>i)return s}return s}(e.cues,t,i);for(let t=0;t{const e=$p();try{e&&new e(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function Kp(e,t){return e.getTime()/1e3-t}class Yp{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(Tc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Tc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tc.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(Tc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Tc.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(Tc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Tc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tc.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(Tc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Tc.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(jp(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;tqp&&(s=qp);s-i<=0&&(s=i+.25);for(let e=0;ee.type===Wp&&n:"video"===s?e=>e.type===Hp&&a:e=>e.type===Wp&&n||e.type===Hp&&a,Gp(r,t,i,e)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:i,id3Track:s}=this,{dateRanges:r}=t,o=Object.keys(r);if(s){const e=Object.keys(i).filter((e=>!o.includes(e)));for(let t=e.length;t--;){const r=e[t];Object.keys(i[r].cues).forEach((e=>{s.removeCue(i[r].cues[e])})),delete i[r]}}const a=t.fragments[t.fragments.length-1];if(0===o.length||!Sc(null==a?void 0:a.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const n=a.programDateTime/1e3-a.start,l=$p();for(let e=0;e{if(t!==s.id){const i=r[t];if(i.class===s.class&&i.startDate>s.startDate&&(!e||s.startDatethis.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(null===e)return null;const{holdBack:t,partHoldBack:i,targetduration:s}=e,{liveSyncDuration:r,liveSyncDurationCount:o,lowLatencyMode:a}=this.config,n=this.hls.userConfig;let l=a&&i||t;(n.liveSyncDuration||n.liveSyncDurationCount||0===l)&&(l=void 0!==r?r:o*s);const d=s;return l+Math.min(1*this.stallCount,d)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(null===e||null===t||null===i)return null;const s=i.edge,r=e-t-this.edgeStalled,o=s-i.totalduration,a=s-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(o,r),a)}get drift(){const{levelDetails:e}=this;return null===e?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(null===e)return 0;const t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(Tc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Tc.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(Tc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(Tc.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(Tc.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(Tc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Tc.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(Tc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(Tc.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(Tc.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var i;t.details===Lc.BUFFER_STALLED_ERROR&&(this.stallCount++,null!=(i=this.levelDetails)&&i.live&&Pc.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const i=this.computeLatency();if(null===i)return;this._latency=i;const{lowLatencyMode:s,maxLiveSyncPlaybackRate:r}=this.config;if(!s||1===r||!t.live)return;const o=this.targetLatency;if(null===o)return;const a=i-o;if(a.05&&this.forwardBufferLength>1){const t=Math.min(2,Math.max(1,r)),i=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;e.playbackRate=Math.min(t,Math.max(1,i))}else 1!==e.playbackRate&&0!==e.playbackRate&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return null===e?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return null===e?null:e-this.currentTime}}const Xp=["NONE","TYPE-0","TYPE-1",null];const Zp=["SDR","PQ","HLG"];var ef="",tf="YES",sf="v2";function rf(e){const{canSkipUntil:t,canSkipDateRanges:i,age:s}=e;return t&&s!!e)).map((e=>e.substring(0,4))).join(","),this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return nf(this._audioGroups,e)}hasSubtitleGroup(e){return nf(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t)if("audio"===e){let e=this._audioGroups;e||(e=this._audioGroups=[]),-1===e.indexOf(t)&&e.push(t)}else if("text"===e){let e=this._subtitleGroups;e||(e=this._subtitleGroups=[]),-1===e.indexOf(t)&&e.push(t)}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return null==(e=this.audioGroups)?void 0:e[0]}get textGroupId(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}addFallback(){}}function nf(e,t){return!(!t||!e)&&-1!==e.indexOf(t)}function lf(e,t){const i=t.startPTS;if(Sc(i)){let s,r=0;t.sn>e.sn?(r=i-e.start,s=e):(r=e.start-i,s=t),s.duration!==r&&(s.duration=r)}else if(t.sn>e.sn){e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration}else t.start=Math.max(e.start-t.duration,0)}function df(e,t,i,s,r,o){s-i<=0&&(Pc.warn("Fragment should have a positive duration",t),s=i+t.duration,o=r+t.duration);let a=i,n=s;const l=t.startPTS,d=t.endPTS;if(Sc(l)){const e=Math.abs(l-i);Sc(t.deltaPTS)?t.deltaPTS=Math.max(e,t.deltaPTS):t.deltaPTS=e,a=Math.max(i,l),i=Math.min(i,l),r=Math.min(r,t.startDTS),n=Math.min(s,d),s=Math.max(s,d),o=Math.max(o,t.endDTS)}const h=i-t.start;0!==t.start&&(t.start=i),t.duration=s-t.start,t.startPTS=i,t.maxStartPTS=a,t.startDTS=r,t.endPTS=s,t.minEndPTS=n,t.endDTS=o;const c=t.sn;if(!e||ce.endSN)return 0;let u;const p=c-e.startSN,f=e.fragments;for(f[p]=t,u=p;u>0;u--)lf(f[u],f[u-1]);for(u=p;u=0;e--){const t=s[e].initSegment;if(t){i=t;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;let r,o=0;if(function(e,t,i){const s=t.skippedSegments,r=Math.max(e.startSN,t.startSN)-t.startSN,o=(e.fragmentHint?1:0)+(s?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,a=t.startSN-e.startSN,n=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;for(let e=r;e<=o;e++){const r=l[a+e];let o=n[e];s&&!o&&e{e.relurl&&(o=e.cc-s.cc),Sc(e.startPTS)&&Sc(e.endPTS)&&(s.start=s.startPTS=e.startPTS,s.startDTS=e.startDTS,s.maxStartPTS=e.maxStartPTS,s.endPTS=e.endPTS,s.endDTS=e.endDTS,s.minEndPTS=e.minEndPTS,s.duration=e.endPTS-e.startPTS,s.duration&&(r=s),t.PTSKnown=t.alignedSliding=!0),s.elementaryStreams=e.elementaryStreams,s.loader=e.loader,s.stats=e.stats,e.initSegment&&(s.initSegment=e.initSegment,i=e.initSegment)})),i){(t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments).forEach((e=>{var t;!e||e.initSegment&&e.initSegment.relurl!==(null==(t=i)?void 0:t.relurl)||(e.initSegment=i)}))}if(t.skippedSegments)if(t.deltaUpdateFailed=t.fragments.some((e=>!e)),t.deltaUpdateFailed){Pc.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let e=t.skippedSegments;e--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC=t.fragments[0].cc}else t.canSkipDateRanges&&(t.dateRanges=function(e,t,i){const s=_c({},e);i&&i.forEach((e=>{delete s[e]}));return Object.keys(t).forEach((e=>{const i=new Uc(t[e].attr,s[e]);i.isValid?s[e]=i:Pc.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(t[e].attr)}"`)})),s}(e.dateRanges,t.dateRanges,t.recentlyRemovedDateranges));const a=t.fragments;if(o){Pc.warn("discontinuity sliding from playlist, take drift into account");for(let e=0;e{t.elementaryStreams=e.elementaryStreams,t.stats=e.stats})),r?df(t,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS):cf(e,t),a.length&&(t.totalduration=t.edge-a[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;const n=t.advancedDateTime;if(t.advanced&&n){const e=t.edge;t.driftStart||(t.driftStartTime=n,t.driftStart=e),t.driftEndTime=n,t.driftEnd=e}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime}function cf(e,t){const i=t.startSN+t.skippedSegments-e.startSN,s=e.fragments;i<0||i>=s.length||uf(t,s[i].start)}function uf(e,t){if(t){const i=e.fragments;for(let s=e.skippedSegments;s{const{details:i}=e;null!=i&&i.fragments&&i.fragments.forEach((e=>{e.level=t}))}))}function gf(e){switch(e.details){case Lc.FRAG_LOAD_TIMEOUT:case Lc.KEY_LOAD_TIMEOUT:case Lc.LEVEL_LOAD_TIMEOUT:case Lc.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function yf(e,t){const i=gf(t);return e.default[(i?"timeout":"error")+"Retry"]}function Af(e,t){const i="linear"===e.backoff?1:Math.pow(2,t);return Math.min(i*e.retryDelayMs,e.maxRetryDelayMs)}function bf(e){return Ac(Ac({},e),{errorRetry:null,timeoutRetry:null})}function vf(e,t,i,s){if(!e)return!1;const r=null==s?void 0:s.code,o=t499)}(r)||!!i);return e.shouldRetry?e.shouldRetry(e,t,i,s,o):o}const _f=function(e,t){let i=0,s=e.length-1,r=null,o=null;for(;i<=s;){r=(i+s)/2|0,o=e[r];const a=t(o);if(a>0)i=r+1;else{if(!(a<0))return o;s=r-1}}return null};function Sf(e,t,i=0,s=0,r=.005){let o=null;if(e){o=t[e.sn-t[0].sn+1]||null;const s=e.endDTS-i;s>0&&s<15e-7&&(i+=15e-7)}else 0===i&&0===t[0].start&&(o=t[0]);if(o&&((!e||e.level===o.level)&&0===Ef(i,s,o)||function(e,t,i){if(t&&0===t.start&&t.level0){const s=t.tagList.reduce(((e,t)=>("INF"===t[0]&&(e+=parseFloat(t[1])),e)),i);return e.start<=s}return!1}(o,e,Math.min(r,s))))return o;const a=_f(t,Ef.bind(null,i,s));return!a||a===e&&o?o:a}function Ef(e=0,t=0,i){if(i.start<=e&&i.start+i.duration>e)return 0;const s=Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return i.start+i.duration-s<=e?1:i.start-s>e&&i.start?-1:0}function wf(e,t,i){const s=1e3*Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return(i.endProgramDateTime||0)-s>e}var Tf=0,kf=2,Lf=3,Cf=5,Df=0,xf=1,Rf=2;class Pf{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=Pc.log.bind(Pc,`${t}:`),this.warn=Pc.warn.bind(Pc,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const s=null==t?void 0:t.renditionReports;if(s){let r=-1;for(let i=0;i=0&&e>t.partTarget&&(a+=1)}const n=i&&rf(i);return new of(o,a>=0?a:void 0,n)}}}loadPlaylist(e){-1===this.requestScheduled&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return-1===this.timer&&-1===this.requestScheduled&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,i){const{details:s,stats:r}=t,o=self.performance.now(),a=r.loading.first?Math.max(0,o-r.loading.first):0;if(s.advancedDateTime=Date.now()-a,s.live||null!=i&&i.live){if(s.reloaded(i),i&&this.log(`live playlist ${e} ${s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:s.updated?"UPDATED":"MISSED"}`),i&&s.fragments.length>0&&hf(i,s),!this.canLoad||!s.live)return;let a,n,l;if(s.canBlockReload&&s.endSN&&s.advanced){const e=this.hls.config.lowLatencyMode,r=s.lastPartSn,o=s.endSN,d=s.lastPartIndex,h=r===o,c=e?0:d;-1!==d?(n=h?o+1:r,l=h?c:d+1):n=o+1;const u=s.age,p=u+s.ageHeader;let f=Math.min(p-s.partTarget,1.5*s.targetduration);if(f>0){if(i&&f>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${f} with playlist age: ${s.age}`),f=0;else{const e=Math.floor(f/s.targetduration);if(n+=e,void 0!==l){l+=Math.round(f%s.targetduration/s.partTarget)}this.log(`CDN Tune-in age: ${s.ageHeader}s last advanced ${u.toFixed(2)}s goal: ${f} skip sn ${e} to part ${l}`)}s.tuneInGoal=f}if(a=this.getDeliveryDirectives(s,t.deliveryDirectives,n,l),e||!h)return void this.loadPlaylist(a)}else(s.canBlockReload||s.canSkipUntil)&&(a=this.getDeliveryDirectives(s,t.deliveryDirectives,n,l));const d=this.hls.mainForwardBufferInfo,h=d?d.end-d.len:0,c=function(e,t=1/0){let i=1e3*e.targetduration;if(e.updated){const s=e.fragments,r=4;if(s.length&&i*r>t){const e=1e3*s[s.length-1].duration;ethis.requestScheduled+c&&(this.requestScheduled=r.loading.start),void 0!==n&&s.canBlockReload?this.requestScheduled=r.loading.first+c-(1e3*s.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+cthis.loadPlaylist(a)),u)}else this.clearTimer()}getDeliveryDirectives(e,t,i,s){let r=rf(e);return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,s=t.part,r=ef),new of(i,s,r)}checkRetry(e){const t=e.details,i=gf(e),s=e.errorAction,{action:r,retryCount:o=0,retryConfig:a}=s||{},n=!!s&&!!a&&(r===Cf||!s.resolved&&r===kf);if(n){var l;if(this.requestScheduled=-1,o>=a.maxNumRetry)return!1;if(i&&null!=(l=e.context)&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const e=Af(a,o);this.timer=self.setTimeout((()=>this.loadPlaylist()),e),this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" in ${e}ms`)}e.levelRetry=!0,s.resolved=!0}return n}}class Bf{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class If{constructor(e,t,i,s=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Bf(e),this.fast_=new Bf(t),this.defaultTTFB_=s,this.ttfb_=new Bf(e)}update(e,t){const{slow_:i,fast_:s,ttfb_:r}=this;i.halfLife!==e&&(this.slow_=new Bf(e,i.getEstimate(),i.getTotalWeight())),s.halfLife!==t&&(this.fast_=new Bf(t,s.getEstimate(),s.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new Bf(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){const i=(e=Math.max(e,this.minDelayMs_))/1e3,s=8*t/i;this.fast_.sample(i,s),this.slow_.sample(i,s)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const Mf={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},Ff={};function Uf(e,t,i,s,r,o){const a=e.audioCodec?e.audioGroups:null,n=null==o?void 0:o.audioCodec,l=null==o?void 0:o.channels,d=l?parseInt(l):n?1/0:2;let h=null;if(null!=a&&a.length)try{h=1===a.length&&a[0]?t.groups[a[0]].channels:a.reduce(((e,i)=>{if(i){const s=t.groups[i];if(!s)throw new Error(`Audio track group ${i} not found`);Object.keys(s.channels).forEach((t=>{e[t]=(e[t]||0)+s.channels[t]}))}return e}),{2:0})}catch(e){return!0}return void 0!==e.videoCodec&&(e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(s,30)||"SDR"!==e.videoRange&&e.videoRange!==i||e.bitrate>Math.max(r,8e6))||!!h&&Sc(d)&&Object.keys(h).some((e=>parseInt(e)>d))}function Of(e,t,i){const s=e.videoCodec,r=e.audioCodec;if(!s||!r||!i)return Promise.resolve(Mf);const o={width:e.width,height:e.height,bitrate:Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)),framerate:e.frameRate||30},a=e.videoRange;"SDR"!==a&&(o.transferFunction=a.toLowerCase());const n=s.split(",").map((e=>({type:"media-source",video:Ac(Ac({},o),{},{contentType:lp(e,"video")})})));return r&&e.audioGroups&&e.audioGroups.forEach((e=>{var i;e&&(null==(i=t.groups[e])||i.tracks.forEach((t=>{if(t.groupId===e){const e=t.channels||"",i=parseFloat(e);Sc(i)&&i>2&&n.push.apply(n,r.split(",").map((e=>({type:"media-source",audio:{contentType:lp(e,"audio"),channels:""+i}}))))}})))})),Promise.all(n.map((e=>{const t=function(e){const{audio:t,video:i}=e,s=i||t;if(s){const e=s.contentType.split('"')[1];if(i)return`r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${e}_${Math.ceil(i.bitrate/1e5)}`;if(t)return`c${t.channels}${t.spatialRendering?"s":"n"}_${e}`}return""}(e);return Ff[t]||(Ff[t]=i.decodingInfo(e))}))).then((e=>({supported:!e.some((e=>!e.supported)),configurations:n,decodingInfoResults:e}))).catch((e=>({supported:!1,configurations:n,decodingInfoResults:[],error:e})))}function Nf(e,t){let i=!1,s=[];return e&&(i="SDR"!==e,s=[e]),t&&(s=t.allowedVideoRanges||Zp.slice(0),i=void 0!==t.preferHDR?t.preferHDR:function(){if("function"==typeof matchMedia){const e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}(),s=i?s.filter((e=>"SDR"!==e)):["SDR"]),{preferHDR:i,allowedVideoRanges:s}}function jf(e,t){Pc.log(`[abr] start candidates with "${e}" ignored because ${t}`)}function Gf(e,t,i){if("attrs"in e){const i=t.indexOf(e);if(-1!==i)return i}for(let s=0;s-1===s.indexOf(e)))}(n,t.characteristics))&&(void 0===i||i(e,t))}function Wf(e,t){const{audioCodec:i,channels:s}=e;return!(void 0!==i&&(t.audioCodec||"").substring(0,4)!==i.substring(0,4)||void 0!==s&&s!==(t.channels||"2"))}function Vf(e,t,i){for(let s=t;s;s--)if(i(e[s]))return s;for(let s=t+1;s{const o=this.fragments[s];if(!o)return;if(r>=o.body.sn)return;if(!o.buffered&&!o.loaded)return void(o.body.type===i&&this.removeFragment(o.body));const a=o.range[e];a&&a.time.some((e=>{const i=!this.isTimeBuffered(e.startPTS,e.endPTS,t);return i&&this.removeFragment(o.body),i}))}))}detectPartialFragments(e){const t=this.timeRanges,{frag:i,part:s}=e;if(!t||"initSegment"===i.sn)return;const r=Qf(i),o=this.fragments[r];if(!o||o.buffered&&i.gap)return;const a=!i.relurl;if(Object.keys(t).forEach((e=>{const r=i.elementaryStreams[e];if(!r)return;const n=t[e],l=a||!0===r.partial;o.range[e]=this.getBufferedTimes(i,s,l,n)})),o.loaded=null,Object.keys(o.range).length){o.buffered=!0;(o.body.endList=i.endList||o.body.endList)&&(this.endListFragments[o.body.type]=o),Yf(o)||this.removeParts(i.sn-1,i.type)}else this.removeFragment(o.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter((t=>t.fragment.sn>=e)))}fragBuffered(e,t){const i=Qf(e);let s=this.fragments[i];!s&&t&&(s=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),s&&(s.loaded=null,s.buffered=!0)}getBufferedTimes(e,t,i,s){const r={time:[],partial:i},o=e.start,a=e.end,n=e.minEndPTS||a,l=e.maxStartPTS||o;for(let e=0;e=t&&n<=i){r.time.push({startPTS:Math.max(o,s.start(e)),endPTS:Math.min(a,s.end(e))});break}if(ot){const t=Math.max(o,s.start(e)),i=Math.min(a,s.end(e));i>t&&(r.partial=!0,r.time.push({startPTS:t,endPTS:i}))}else if(a<=t)break}return r}getPartialFragment(e){let t,i,s,r=null,o=0;const{bufferPadding:a,fragments:n}=this;return Object.keys(n).forEach((l=>{const d=n[l];d&&Yf(d)&&(i=d.body.start-a,s=d.body.end+a,e>=i&&e<=s&&(t=Math.min(e-i,s-e),o<=t&&(r=d.body,o=t)))})),r}isEndListAppended(e){const t=this.endListFragments[e];return void 0!==t&&(t.buffered||Yf(t))}getState(e){const t=Qf(e),i=this.fragments[t];return i?i.buffered?Yf(i)?Jf:qf:$f:Hf}isTimeBuffered(e,t,i){let s,r;for(let o=0;o=s&&t<=r)return!0;if(t<=s)return!1}return!1}onFragLoaded(e,t){const{frag:i,part:s}=t;if("initSegment"===i.sn||i.bitrateTest)return;const r=s?null:t,o=Qf(i);this.fragments[o]={body:i,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:s,timeRanges:r}=t;if("initSegment"===i.sn)return;const o=i.type;if(s){let e=this.activePartLists[o];e||(this.activePartLists[o]=e=[]),e.push(s)}this.timeRanges=r,Object.keys(r).forEach((e=>{const t=r[e];this.detectEvictedFragments(e,t,o,s)}))}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Qf(e);return!!this.fragments[t]}hasParts(e){var t;return!(null==(t=this.activePartLists[e])||!t.length)}removeFragmentsInRange(e,t,i,s,r){s&&!this.hasGaps||Object.keys(this.fragments).forEach((o=>{const a=this.fragments[o];if(!a)return;const n=a.body;n.type!==i||s&&!n.gap||n.starte&&(a.buffered||r)&&this.removeFragment(n)}))}removeFragment(e){const t=Qf(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const t=e.sn;this.activePartLists[e.type]=i.filter((e=>e.fragment.sn!==t))}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function Yf(e){var t,i,s;return e.buffered&&(e.body.gap||(null==(t=e.range.video)?void 0:t.partial)||(null==(i=e.range.audio)?void 0:i.partial)||(null==(s=e.range.audiovideo)?void 0:s.partial))}function Qf(e){return`${e.type}_${e.level}_${e.sn}`}const Xf={length:0,start:()=>0,end:()=>0};class Zf{static isBuffered(e,t){try{if(e){const i=Zf.getBuffered(e);for(let e=0;e=i.start(e)&&t<=i.end(e))return!0}}catch(e){}return!1}static bufferInfo(e,t,i){try{if(e){const s=Zf.getBuffered(e),r=[];let o;for(o=0;oo&&(s[r-1].end=e[t].end):s.push(e[t])}else s.push(e[t])}else s=e;let r,o=0,a=t,n=t;for(let e=0;e=l&&ti.startCC||e&&e.cc{if(this.loader&&this.loader.destroy(),e.gap){if(e.tagList.some((e=>"GAP"===e[0])))return void n(dm(e));e.gap=!1}const l=this.loader=e.loader=r?new r(s):new o(s),d=lm(e),h=bf(s.fragLoadPolicy.default),c={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:am};e.stats=l.stats,l.load(d,c,{onSuccess:(t,i,s,r)=>{this.resetLoader(e,l);let o=t.data;s.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(o.slice(0,16)),o=o.slice(16)),a({frag:e,part:null,payload:o,networkDetails:r})},onError:(t,s,r,o)=>{this.resetLoader(e,l),n(new hm({type:kc.NETWORK_ERROR,details:Lc.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Ac({url:i,data:void 0},t),error:new Error(`HTTP Error ${t.code} ${t.text}`),networkDetails:r,stats:o}))},onAbort:(t,i,s)=>{this.resetLoader(e,l),n(new hm({type:kc.NETWORK_ERROR,details:Lc.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:s,stats:t}))},onTimeout:(t,i,s)=>{this.resetLoader(e,l),n(new hm({type:kc.NETWORK_ERROR,details:Lc.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${c.timeout}ms`),networkDetails:s,stats:t}))},onProgress:(i,s,r,o)=>{t&&t({frag:e,part:null,payload:r,networkDetails:o})}})}))}loadPart(e,t,i){this.abort();const s=this.config,r=s.fLoader,o=s.loader;return new Promise(((a,n)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap)return void n(dm(e,t));const l=this.loader=e.loader=r?new r(s):new o(s),d=lm(e,t),h=bf(s.fragLoadPolicy.default),c={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:am};t.stats=l.stats,l.load(d,c,{onSuccess:(s,r,o,n)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const d={frag:e,part:t,payload:s.data,networkDetails:n};i(d),a(d)},onError:(i,s,r,o)=>{this.resetLoader(e,l),n(new hm({type:kc.NETWORK_ERROR,details:Lc.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Ac({url:d.url,data:void 0},i),error:new Error(`HTTP Error ${i.code} ${i.text}`),networkDetails:r,stats:o}))},onAbort:(i,s,r)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),n(new hm({type:kc.NETWORK_ERROR,details:Lc.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:r,stats:i}))},onTimeout:(i,s,r)=>{this.resetLoader(e,l),n(new hm({type:kc.NETWORK_ERROR,details:Lc.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${c.timeout}ms`),networkDetails:r,stats:i}))}})}))}updateStatsFromPart(e,t){const i=e.stats,s=t.stats,r=s.total;if(i.loaded+=s.loaded,r){const s=Math.round(e.duration/t.duration),o=Math.min(Math.round(i.loaded/r),s),a=(s-o)*Math.round(i.loaded/o);i.total=i.loaded+a}else i.total=Math.max(i.loaded,i.total);const o=i.loading,a=s.loading;o.start?o.first+=a.first-a.start:(o.start=a.start,o.first=a.first),o.end=a.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function lm(e,t=null){const i=t||e,s={frag:e,part:t,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},r=i.byteRangeStartOffset,o=i.byteRangeEndOffset;if(Sc(r)&&Sc(o)){var a;let t=r,i=o;if("initSegment"===e.sn&&"AES-128"===(null==(a=e.decryptdata)?void 0:a.method)){const e=o-r;e%16&&(i=o+(16-e%16)),0!==r&&(s.resetIV=!0,t=r-16)}s.rangeStart=t,s.rangeEnd=i}return s}function dm(e,t){const i=new Error(`GAP ${e.gap?"tag":"attribute"} found`),s={type:kc.MEDIA_ERROR,details:Lc.FRAG_GAP,fatal:!1,frag:e,error:i,networkDetails:null};return t&&(s.part=t),(t||e).stats.aborted=!0,new hm(s)}class hm extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class cm{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class um{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}class pm{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let e=0;e<4;e++)i[e]=t.getUint32(4*e);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,s=i[0],r=i[1],o=i[2],a=i[3],n=this.invSubMix,l=n[0],d=n[1],h=n[2],c=n[3],u=new Uint32Array(256);let p=0,f=0,m=0;for(m=0;m<256;m++)u[m]=m<128?m<<1:m<<1^283;for(m=0;m<256;m++){let i=f^f<<1^f<<2^f<<3^f<<4;i=i>>>8^255&i^99,e[p]=i,t[i]=p;const n=u[p],m=u[n],g=u[m];let y=257*u[i]^16843008*i;s[p]=y<<24|y>>>8,r[p]=y<<16|y>>>16,o[p]=y<<8|y>>>24,a[p]=y,y=16843009*g^65537*m^257*n^16843008*p,l[i]=y<<24|y>>>8,d[i]=y<<16|y>>>16,h[i]=y<<8|y>>>24,c[i]=y,p?(p=n^u[u[u[g^n]]],f^=u[u[f]]):p=f=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,s=0;for(;s{if(!this.subtle)return Promise.reject(new Error("web crypto not initialized"));this.logOnce("WebCrypto AES decrypt");return new cm(this.subtle,new Uint8Array(i)).decrypt(e.buffer,t)})).catch((s=>(Pc.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,t,i))))}onWebCryptoError(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);const s=this.flush();if(s)return s.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%16;return i!==e.length&&(t=nu(e,0,i),this.remainderData=nu(e,i)),t}logOnce(e){this.logEnabled&&(Pc.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const mm=function(e){let t="";const i=e.length;for(let s=0;s1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}{constructor(e,t,i,s,r){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=gm,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.loadedmetadata=!1,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=r,this.logPrefix=s,this.log=Pc.log.bind(Pc,`${s}:`),this.warn=Pc.warn.bind(Pc,`${s}:`),this.hls=e,this.fragmentLoader=new nm(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new fm(e.config),e.on(Tc.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;null!=e&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=gm}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const i=t.partList;if(null!=i&&i.length){const e=i[i.length-1];return Zf.isBuffered(this.media,e.start+e.duration/2)}const s=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(s)}getLevelDetails(){var e;if(this.levels&&null!==this.levelLastLoaded)return null==(e=this.levelLastLoaded)?void 0:e.details}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),i.addEventListener("seeking",this.onvseeking),i.addEventListener("ended",this.onvended);const s=this.config;this.levels&&s.autoStartLoad&&this.state===gm&&this.startLoad(s.startPosition)}onMediaDetaching(){const e=this.media;null!=e&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:i,mediaBuffer:s,state:r}=this,o=i?i.currentTime:0,a=Zf.bufferInfo(s||i,o,e.maxBufferHole);if(this.log(`media seeking to ${Sc(o)?o.toFixed(3):o}, state: ${r}`),this.state===wm)this.resetLoadingState();else if(t){const i=e.maxFragLookUpTolerance,s=t.start-i,r=t.start+t.duration+i;if(!a.len||ra.end){const e=o>r;(o{if(this.fragContextChanged(e))return this.warn(`Fragment ${e.sn}${t.part?" p: "+t.part.index:""} of level ${e.level} was dropped during download.`),void this.fragmentTracker.removeFragment(e);e.stats.chunkCount++,this._handleFragmentLoadProgress(t)})).then((t=>{if(!t)return;const i=this.state;this.fragContextChanged(e)?(i===bm||!this.fragCurrent&&i===Sm)&&(this.fragmentTracker.removeFragment(e),this.state=ym):("payload"in t&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(Tc.FRAG_LOADED,t)),this._handleFragmentLoadComplete(t))})).catch((t=>{this.state!==gm&&this.state!==Tm&&(this.warn(`Frag error: ${(null==t?void 0:t.message)||t}`),this.resetFragmentLoading(e))}))}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===$f){const t=e.type,s=this.getFwdBufferInfo(this.mediaBuffer,t),r=Math.max(e.duration,s?s.len:this.config.maxBufferLength),o=this.backtrackFragment;(1===(o?e.sn-o.sn:0)||this.reduceMaxBufferLength(r,e.duration))&&i.removeFragment(e)}else 0===(null==(t=this.mediaBuffer)?void 0:t.buffered.length)?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===Jf&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const s={startOffset:e,endOffset:t,type:i};this.hls.trigger(Tc.BUFFER_FLUSHING,s)}_loadInitSegment(e,t){this._doFragLoad(e,t).then((t=>{if(!t||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return t})).then((t=>{const{hls:i}=this,{payload:s}=t,r=e.decryptdata;if(s&&s.byteLength>0&&null!=r&&r.key&&r.iv&&"AES-128"===r.method){const o=self.performance.now();return this.decrypter.decrypt(new Uint8Array(s),r.key.buffer,r.iv.buffer).catch((t=>{throw i.trigger(Tc.ERROR,{type:kc.MEDIA_ERROR,details:Lc.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t})).then((s=>{const r=self.performance.now();return i.trigger(Tc.FRAG_DECRYPTED,{frag:e,payload:s,stats:{tstart:o,tdecrypt:r}}),t.payload=s,this.completeInitSegmentLoad(t)}))}return this.completeInitSegmentLoad(t)})).catch((t=>{this.state!==gm&&this.state!==Tm&&(this.warn(t),this.resetFragmentLoading(e))}))}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state=ym,e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var i,s,r,o;const a=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===Pp?"level":"track"} ${e.level} (frag:[${(null!=(i=e.startPTS)?i:NaN).toFixed(3)}-${(null!=(s=e.endPTS)?s:NaN).toFixed(3)}] > buffer:${a?mm(Zf.getBuffered(a)):"(detached)"})`),"initSegment"!==e.sn){var n;if(e.type!==Ip){const t=e.elementaryStreams;if(!Object.keys(t).some((e=>!!t[e])))return void(this.state=ym)}const t=null==(n=this.levels)?void 0:n[e.level];null!=t&&t.fragmentError&&(this.log(`Resetting level fragment error count of ${t.fragmentError} on frag buffered`),t.fragmentError=0)}this.state=ym,a&&(!this.loadedmetadata&&e.type==Pp&&a.buffered.length&&(null==(r=this.fragCurrent)?void 0:r.sn)===(null==(o=this.fragPrevious)?void 0:o.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:s,partsLoaded:r}=e,o=!r||0===r.length||r.some((e=>!e)),a=new em(i.level,i.sn,i.stats.chunkCount+1,0,s?s.index:-1,!o);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,s){var r;const o=null==t?void 0:t.details;if(!this.levels||!o)throw new Error(`frag load aborted, missing level${o?"":" detail"}s`);let a=null;if(!e.encrypted||null!=(r=e.decryptdata)&&r.key?!e.encrypted&&o.encryptedFragments.length&&this.keyLoader.loadClear(e,o.encryptedFragments):(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${"[stream-controller]"===this.logPrefix?"level":"track"} ${e.level}`),this.state=Am,this.fragCurrent=e,a=this.keyLoader.load(e).then((e=>{if(!this.fragContextChanged(e.frag))return this.hls.trigger(Tc.KEY_LOADED,e),this.state===Am&&(this.state=ym),e})),this.hls.trigger(Tc.KEY_LOADING,{frag:e}),null===this.fragCurrent&&(a=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),i=Math.max(e.start,i||0),this.config.lowLatencyMode&&"initSegment"!==e.sn){const r=o.partList;if(r&&s){i>e.end&&o.fragmentHint&&(e=o.fragmentHint);const n=this.getNextPart(r,e,i);if(n>-1){const l=r[n];let d;return this.log(`Loading part sn: ${e.sn} p: ${l.index} cc: ${e.cc} of playlist [${o.startSN}-${o.endSN}] parts [0-${n}-${r.length-1}] ${"[stream-controller]"===this.logPrefix?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=l.start+l.duration,this.state=bm,d=a?a.then((i=>!i||this.fragContextChanged(i.frag)?null:this.doFragPartsLoad(e,l,t,s))).catch((e=>this.handleFragLoadError(e))):this.doFragPartsLoad(e,l,t,s).catch((e=>this.handleFragLoadError(e))),this.hls.trigger(Tc.FRAG_LOADING,{frag:e,part:l,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}if(!e.url||this.loadedEndOfParts(r,i))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${o?"of ["+o.startSN+"-"+o.endSN+"] ":""}${"[stream-controller]"===this.logPrefix?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),Sc(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=bm;const n=this.config.progressive;let l;return l=n&&a?a.then((t=>!t||this.fragContextChanged(null==t?void 0:t.frag)?null:this.fragmentLoader.load(e,s))).catch((e=>this.handleFragLoadError(e))):Promise.all([this.fragmentLoader.load(e,n?s:void 0),a]).then((([e])=>(!n&&e&&s&&s(e),e))).catch((e=>this.handleFragLoadError(e))),this.hls.trigger(Tc.FRAG_LOADING,{frag:e,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l}doFragPartsLoad(e,t,i,s){return new Promise(((r,o)=>{var a;const n=[],l=null==(a=i.details)?void 0:a.partList,d=t=>{this.fragmentLoader.loadPart(e,t,s).then((s=>{n[t.index]=s;const o=s.part;this.hls.trigger(Tc.FRAG_LOADED,s);const a=pf(i,e.sn,t.index+1)||ff(l,e.sn,t.index+1);if(!a)return r({frag:e,part:o,partsLoaded:n});d(a)})).catch(o)};d(t)}))}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===Lc.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(Tc.ERROR,t)}else this.hls.trigger(Tc.ERROR,{type:kc.OTHER_ERROR,details:Lc.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==Sm)return void(this.fragCurrent||this.state===gm||this.state===Tm||(this.state=ym));const{frag:i,part:s,level:r}=t,o=self.performance.now();i.stats.parsing.end=o,s&&(s.stats.parsing.end=o),this.updateLevelTiming(i,s,r,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:s,sn:r,part:o}=e;if(null==t||!t[s])return this.warn(`Levels object was unset while buffering fragment ${r} of level ${s}. The current chunk will not be buffered.`),null;const a=t[s],n=o>-1?pf(a,r,o):null,l=n?n.fragment:function(e,t,i){if(null==e||!e.details)return null;const s=e.details;let r=s.fragments[t-s.startSN];return r||(r=s.fragmentHint,r&&r.sn===t?r:to&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){const i=this.getLoadPosition();return Sc(i)?this.getFwdBufferInfoAtPos(e,i,t):null}getFwdBufferInfoAtPos(e,t,i){const{config:{maxBufferHole:s}}=this,r=Zf.bufferInfo(e,t,s);if(0===r.len&&void 0!==r.nextStart){const o=this.fragmentTracker.getBufferedFrag(t,i);if(o&&r.nextStart=s&&(i.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0)}getAppendedFrag(e,t=Pp){const i=this.fragmentTracker.getAppendedFrag(e,Pp);return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,s=i.length;if(!s)return null;const{config:r}=this,o=i[0].start;let a;if(t.live){const n=r.initialLiveManifestSize;if(st}getNextFragmentLoopLoading(e,t,i,s,r){const o=e.gap,a=this.getNextFragment(this.nextLoadPosition,t);if(null===a)return a;if(e=a,o&&e&&!e.gap&&i.nextStart){const t=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,s);if(null!==t&&i.len+t.len>=r)return this.log(`buffer full after gaps in "${s}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return null==e||!e.initSegment||null!=e&&e.initSegment.data||this.bitrateTest?e:e.initSegment}getNextPart(e,t,i){let s=-1,r=!1,o=!0;for(let a=0,n=e.length;a-1&&ii.start&&i.loaded}getInitialLiveFragment(e,t){const i=this.fragPrevious;let s=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),s=function(e,t,i){if(null===t||!Array.isArray(e)||!e.length||!Sc(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;i=i||0;for(let s=0;s=e.startSN&&r<=e.endSN){const o=t[r-e.startSN];i.cc===o.cc&&(s=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${s.sn}`))}s||(s=function(e,t){return _f(e,(e=>e.cct?-1:0))}(t,i.cc),s&&this.log(`Live playlist, switching playlist, load frag with same CC: ${s.sn}`))}}else{const t=this.hls.liveSyncPosition;null!==t&&(s=this.getFragmentAtPosition(t,this.bitrateTest?e.fragmentEnd:e.edge,e))}return s}getFragmentAtPosition(e,t,i){const{config:s}=this;let{fragPrevious:r}=this,{fragments:o,endSN:a}=i;const{fragmentHint:n}=i,{maxFragLookUpTolerance:l}=s,d=i.partList,h=!!(s.lowLatencyMode&&null!=d&&d.length&&n);let c;if(h&&n&&!this.bitrateTest&&(o=o.concat(n),a=n.sn),et-l?0:l)}else c=o[o.length-1];if(c){const e=c.sn-i.startSN,t=this.fragmentTracker.getState(c);if((t===qf||t===Jf&&c.gap)&&(r=c),r&&c.sn===r.sn&&(!h||d[0].fragment.sn>c.sn)){if(r&&c.level===r.level){const t=o[e+1];c=c.sn=o-t.maxFragLookUpTolerance&&r<=a;if(null!==s&&i.duration>s&&(r${e.startSN} prev-sn: ${r?r.sn:"na"} fragments: ${s}`),o}return r}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)}setStartPosition(e,t){let i=this.startPosition;if(i ${null==(s=this.fragCurrent)?void 0:s.url}`);const r=t.details===Lc.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(i,!0);const o=t.errorAction,{action:a,retryCount:n=0,retryConfig:l}=o||{};if(o&&a===Cf&&l){this.resetStartWhenNotLoaded(this.levelLastLoaded);const s=Af(l,n);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${n+1}/${l.maxNumRetry} in ${s}ms`),o.resolved=!0,this.retryDate=self.performance.now()+s,this.state=vm}else if(l&&o){if(this.resetFragmentErrors(e),!(n.5;r&&this.reduceMaxBufferLength(s.len,(null==t?void 0:t.duration)||10);const o=!r;return o&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),o}return!1}resetFragmentErrors(e){e===Bp&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==gm&&(this.state=ym)}afterBufferFlushed(e,t,i){if(!e)return;const s=Zf.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,s,i),this.state===wm&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=ym}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;null!=t&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,s){var r;const o=i.details;if(!o)return void this.warn("level.details undefined");if(!Object.keys(e.elementaryStreams).reduce(((t,r)=>{const a=e.elementaryStreams[r];if(a){const n=a.endPTS-a.startPTS;if(n<=0)return this.warn(`Could not parse fragment ${e.sn} ${r} duration reliably (${n})`),t||!1;const l=s?0:df(o,e,a.startPTS,a.endPTS,a.startDTS,a.endDTS);return this.hls.trigger(Tc.LEVEL_PTS_UPDATED,{details:o,level:i,drift:l,type:r,frag:e,start:a.startPTS,end:a.endPTS}),!0}return t}),!1)&&null===(null==(r=this.transmuxer)?void 0:r.error)){const t=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(0===i.fragmentError&&(i.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(t.message),this.hls.trigger(Tc.ERROR,{type:kc.MEDIA_ERROR,details:Lc.FRAG_PARSING_ERROR,fatal:!1,error:t,frag:e,reason:`Found no media in msn ${e.sn} of level "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=Em,this.hls.trigger(Tc.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class Dm{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;return e.length?(i=1===e.length?e[0]:function(e,t){const i=new Uint8Array(t);let s=0;for(let t=0;t0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:Wp,duration:Number.POSITIVE_INFINITY});r{if(Sc(e))return 90*e;return 9e4*t+(i?9e4*i.baseTime/i.timescale:0)};function Bm(e,t){return 255===e[t]&&240==(246&e[t+1])}function Im(e,t){return 1&e[t+1]?7:9}function Mm(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function Fm(e,t){return t+1=e.length)return!1;const s=Mm(e,t);if(s<=i)return!1;const r=t+s;return r===e.length||Fm(e,r)}return!1}function Om(e,t,i,s,r){if(!e.samplerate){const o=function(e,t,i,s){let r,o,a,n;const l=navigator.userAgent.toLowerCase(),d=s,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];r=1+((192&t[i+2])>>>6);const c=(60&t[i+2])>>>2;if(!(c>h.length-1))return a=(1&t[i+2])<<2,a|=(192&t[i+3])>>>6,Pc.log(`manifest codec:${s}, ADTS type:${r}, samplingIndex:${c}`),/firefox/i.test(l)?c>=6?(r=5,n=new Array(4),o=c-3):(r=2,n=new Array(2),o=c):-1!==l.indexOf("android")?(r=2,n=new Array(2),o=c):(r=5,n=new Array(4),s&&(-1!==s.indexOf("mp4a.40.29")||-1!==s.indexOf("mp4a.40.5"))||!s&&c>=6?o=c-3:((s&&-1!==s.indexOf("mp4a.40.2")&&(c>=6&&1===a||/vivaldi/i.test(l))||!s&&1===a)&&(r=2,n=new Array(2)),o=c)),n[0]=r<<3,n[0]|=(14&c)>>1,n[1]|=(1&c)<<7,n[1]|=a<<3,5===r&&(n[1]|=(14&o)>>1,n[2]=(1&o)<<7,n[2]|=8,n[3]=0),{config:n,samplerate:h[c],channelCount:a,codec:"mp4a.40."+r,manifestCodec:d};{const t=new Error(`invalid ADTS sampling index:${c}`);e.emit(Tc.ERROR,Tc.ERROR,{type:kc.MEDIA_ERROR,details:Lc.FRAG_PARSING_ERROR,fatal:!0,error:t,reason:t.message})}}(t,i,s,r);if(!o)return;e.config=o.config,e.samplerate=o.samplerate,e.channelCount=o.channelCount,e.codec=o.codec,e.manifestCodec=o.manifestCodec,Pc.log(`parsed codec:${e.codec}, rate:${o.samplerate}, channels:${o.channelCount}`)}}function Nm(e){return 9216e4/e}function jm(e,t,i,s,r){const o=s+r*Nm(e.samplerate),a=function(e,t){const i=Im(e,t);if(t+i<=e.length){const s=Mm(e,t)-i;if(s>0)return{headerLength:i,frameLength:s}}}(t,i);let n;if(a){const{frameLength:s,headerLength:r}=a,l=r+s,d=Math.max(0,i+l-t.length);d?(n=new Uint8Array(l-r),n.set(t.subarray(i+r,t.length),0)):n=t.subarray(i+r,i+l);const h={unit:n,pts:o};return d||e.samples.push(h),{sample:h,length:l,missing:d}}const l=t.length-i;n=new Uint8Array(l),n.set(t.subarray(i,t.length),0);return{sample:{unit:n,pts:o},length:l,missing:-1}}let Gm=null;const zm=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],Wm=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Vm=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Hm=[0,1,1,4];function $m(e,t,i,s,r){if(i+24>t.length)return;const o=Jm(t,i);if(o&&i+o.frameLength<=t.length){const a=s+r*(9e4*o.samplesPerFrame/o.sampleRate),n={unit:t.subarray(i,i+o.frameLength),pts:a,dts:a};return e.config=[],e.channelCount=o.channelCount,e.samplerate=o.sampleRate,e.samples.push(n),{sample:n,length:o.frameLength,missing:0}}}function Jm(e,t){const i=e[t+1]>>3&3,s=e[t+1]>>1&3,r=e[t+2]>>4&15,o=e[t+2]>>2&3;if(1!==i&&0!==r&&15!==r&&3!==o){const a=e[t+2]>>1&1,n=e[t+3]>>6,l=1e3*zm[14*(3===i?3-s:3===s?3:4)+r-1],d=Wm[3*(3===i?0:2===i?1:2)+o],h=3===n?1:2,c=Vm[i][s],u=Hm[s],p=8*c*u,f=Math.floor(c*l/d+a)*u;if(null===Gm){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Gm=e?parseInt(e[1]):0}return!!Gm&&Gm<=87&&2===s&&l>=224e3&&0===n&&(e[t+3]=128|e[t+3]),{sampleRate:d,channelCount:h,frameLength:f,samplesPerFrame:p}}}function qm(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function Km(e,t){return t+1{let i=0,s=5;t+=s;const r=new Uint32Array(1),o=new Uint32Array(1),a=new Uint8Array(1);for(;s>0;){a[0]=e[t];const n=Math.min(s,8),l=8-n;o[0]=4278190080>>>24+l<>l,i=i?i<t.length)return-1;if(11!==t[i]||119!==t[i+1])return-1;const o=t[i+4]>>6;if(o>=3)return-1;const a=[48e3,44100,32e3][o],n=63&t[i+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*n+o];if(i+l>t.length)return-1;const d=t[i+6]>>5;let h=0;2===d?h+=2:(1&d&&1!==d&&(h+=2),4&d&&(h+=2));const c=(t[i+6]<<8|t[i+7])>>12-h&1,u=[2,1,2,3,3,4,4,5][d]+c,p=t[i+5]>>3,f=7&t[i+5],m=new Uint8Array([o<<6|p<<1|f>>2,(3&f)<<6|d<<3|c<<2|n>>4,n<<4&224]),g=s+r*(1536/a*9e4),y=t.subarray(i,i+l);return e.config=m,e.channelCount=u,e.samplerate=a,e.samples.push({unit:y,pts:g}),l}class tg{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,s=new Uint8Array(4),r=Math.min(4,t);if(0===r)throw new Error("no bytes available");s.set(e.subarray(i,i+r)),this.word=new DataView(s.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r}skipBits(e){let t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(t=(e-=this.bitsAvailable)>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&Pc.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return t=e-t,t>0&&this.bitsAvailable?i<>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t,i=8,s=8;for(let r=0;r{var o;switch(s.type){case 1:{let t=!1;a=!0;const r=s.data;if(l&&r.length>4){const e=new tg(r).readSliceType();2!==e&&4!==e&&7!==e&&9!==e||(t=!0)}var d;if(t)null!=(d=n)&&d.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null);n||(n=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),n.frame=!0,n.key=t;break}case 5:a=!0,null!=(o=n)&&o.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null),n||(n=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),n.key=!0,n.frame=!0;break;case 6:a=!0,Ju(s.data,1,i.pts,t.samples);break;case 7:{var h,c;a=!0,l=!0;const t=s.data,i=new tg(t).readSPS();if(!e.sps||e.width!==i.width||e.height!==i.height||(null==(h=e.pixelRatio)?void 0:h[0])!==i.pixelRatio[0]||(null==(c=e.pixelRatio)?void 0:c[1])!==i.pixelRatio[1]){e.width=i.width,e.height=i.height,e.pixelRatio=i.pixelRatio,e.sps=[t],e.duration=r;const s=t.subarray(1,4);let o="avc1.";for(let e=0;e<3;e++){let t=s[e].toString(16);t.length<2&&(t="0"+t),o+=t}e.codec=o}break}case 8:a=!0,e.pps=[s.data];break;case 9:a=!0,e.audFound=!0,n&&this.pushAccessUnit(n,e),n=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"");break;case 12:a=!0;break;default:a=!1,n&&(n.debug+="unknown NAL "+s.type+" ")}if(n&&a){n.units.push(s)}})),s&&n&&(this.pushAccessUnit(n,e),this.VideoSample=null)}parseAVCNALu(e,t){const i=t.byteLength;let s=e.naluState||0;const r=s,o=[];let a,n,l,d=0,h=-1,c=0;for(-1===s&&(h=0,c=31&t[0],s=0,d=1);d=0){const e={data:t.subarray(h,n),type:c};o.push(e)}else{const i=this.getLastNalUnit(e.samples);i&&(r&&d<=4-r&&i.state&&(i.data=i.data.subarray(0,i.data.byteLength-r)),n>0&&(i.data=Vu(i.data,t.subarray(0,n)),i.state=0))}d=0&&s>=0){const e={data:t.subarray(h,i),type:c,state:s};o.push(e)}if(0===o.length){const i=this.getLastNalUnit(e.samples);i&&(i.data=Vu(i.data,t))}return e.naluState=s,o}}class sg{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new fm(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,i){const s=e[t].unit;if(s.length<=16)return;const r=s.subarray(16,s.length-s.length%16),o=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(o).then((r=>{const o=new Uint8Array(r);s.set(o,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)}))}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t);let s=0;for(let t=32;t{r.data=this.getAvcDecryptedUnit(o,a),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,s)}))}decryptAvcSamples(e,t,i,s){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void s();const r=e[t].units;for(;!(i>=r.length);i++){const o=r[i];if(!(o.data.length<=48||1!==o.type&&5!==o.type||(this.decryptAvcSample(e,t,i,s,o),this.decrypter.isSync())))return}}}}const rg=188;class og{constructor(e,t,i){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.videoParser=new ig}static probe(e){const t=og.syncOffset(e);return t>0&&Pc.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),-1!==t}static syncOffset(e){const t=e.length;let i=Math.min(940,t-rg)+1,s=0;for(;s1&&(0===o&&a>2||n+rg>i))return o}s++}return-1}static createTrack(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:Cu[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}resetInitSegment(e,t,i,s){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=og.createTrack("video"),this._audioTrack=og.createTrack("audio",s),this._id3Track=og.createTrack("id3"),this._txtTrack=og.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=s}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,s=!1){let r;i||(this.sampleAes=null);const o=this._videoTrack,a=this._audioTrack,n=this._id3Track,l=this._txtTrack;let d=o.pid,h=o.pesData,c=a.pid,u=n.pid,p=a.pesData,f=n.pesData,m=null,g=this.pmtParsed,y=this._pmtId,A=e.length;if(this.remainderData&&(A=(e=Vu(this.remainderData,e)).length,this.remainderData=null),A>4>1){if(v=t+5+e[t+4],v===t+rg)continue}else v=t+4;switch(A){case d:s&&(h&&(r=cg(h))&&this.videoParser.parseAVCPES(o,l,r,!1,this._duration),h={data:[],size:0}),h&&(h.data.push(e.subarray(v,t+rg)),h.size+=t+rg-v);break;case c:if(s){if(p&&(r=cg(p)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,r);break;case"mp3":this.parseMPEGPES(a,r);break;case"ac3":this.parseAC3PES(a,r)}p={data:[],size:0}}p&&(p.data.push(e.subarray(v,t+rg)),p.size+=t+rg-v);break;case u:s&&(f&&(r=cg(f))&&this.parseID3PES(n,r),f={data:[],size:0}),f&&(f.data.push(e.subarray(v,t+rg)),f.size+=t+rg-v);break;case 0:s&&(v+=e[v]+1),y=this._pmtId=ng(e,v);break;case y:{s&&(v+=e[v]+1);const r=lg(e,v,this.typeSupported,i,this.observer);d=r.videoPid,d>0&&(o.pid=d,o.segmentCodec=r.segmentVideoCodec),c=r.audioPid,c>0&&(a.pid=c,a.segmentCodec=r.segmentAudioCodec),u=r.id3Pid,u>0&&(n.pid=u),null===m||g||(Pc.warn(`MPEG-TS PMT found at ${t} after unknown PID '${m}'. Backtracking to sync byte @${b} to parse all TS packets.`),m=null,t=b-188),g=this.pmtParsed=!0;break}case 17:case 8191:break;default:m=A}}else v++;v>0&&dg(this.observer,new Error(`Found ${v} TS packet/s that do not start with 0x47`)),o.pesData=h,a.pesData=p,n.pesData=f;const _={audioTrack:a,videoTrack:o,id3Track:n,textTrack:l};return s&&this.extractRemainingSamples(_),_}flush(){const{remainderData:e}=this;let t;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:s,textTrack:r}=e,o=i.pesData,a=t.pesData,n=s.pesData;let l;if(o&&(l=cg(o))?(this.videoParser.parseAVCPES(i,r,l,!0,this._duration),i.pesData=null):i.pesData=o,a&&(l=cg(a))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break;case"ac3":this.parseAC3PES(t,l)}t.pesData=null}else null!=a&&a.size&&Pc.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;n&&(l=cg(n))?(this.parseID3PES(s,l),s.pesData=null):s.pesData=n}demuxSampleAes(e,t,i){const s=this.demux(e,i,!0,!this.config.progressive),r=this.sampleAes=new sg(this.observer,this.config,t);return this.decrypt(s,r)}decrypt(e,t){return new Promise((i=>{const{audioTrack:s,videoTrack:r}=e;s.samples&&"aac"===s.segmentCodec?t.decryptAacSamples(s.samples,0,(()=>{r.samples?t.decryptAvcSamples(r.samples,0,0,(()=>{i(e)})):i(e)})):r.samples&&t.decryptAvcSamples(r.samples,0,0,(()=>{i(e)}))}))}destroy(){this._duration=0}parseAACPES(e,t){let i=0;const s=this.aacOverFlow;let r,o,a,n=t.data;if(s){this.aacOverFlow=null;const t=s.missing,r=s.sample.unit.byteLength;if(-1===t)n=Vu(s.sample.unit,n);else{const o=r-t;s.sample.unit.set(n.subarray(0,t),o),e.samples.push(s.sample),i=s.missing}}for(r=i,o=n.length;r0;)n+=o}}parseID3PES(e,t){if(void 0===t.pts)return void Pc.warn("[tsdemuxer]: ID3 PES unknown PTS");const i=_c({},t,{type:this._videoTrack?Hp:Wp,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function ag(e,t){return((31&e[t+1])<<8)+e[t+2]}function ng(e,t){return(31&e[t+10])<<8|e[t+11]}function lg(e,t,i,s,r){const o={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},a=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t0){let s=t+5,r=n;for(;r>2;){if(106===e[s])!0!==i.ac3?Pc.log("AC-3 audio found, not supported in this browser for now"):(o.audioPid=a,o.segmentAudioCodec="ac3");const t=e[s+1]+2;s+=t,r-=t}}break;case 194:case 135:return dg(r,new Error("Unsupported EC-3 in M2TS found")),o;case 36:return dg(r,new Error("Unsupported HEVC in M2TS found")),o}t+=n+5}return o}function dg(e,t,i){Pc.warn(`parsing error: ${t.message}`),e.emit(Tc.ERROR,Tc.ERROR,{type:kc.MEDIA_ERROR,details:Lc.FRAG_PARSING_ERROR,fatal:!1,levelRetry:i,error:t,reason:t.message})}function hg(e){Pc.log(`${e} with AES-128-CBC encryption found in unencrypted stream`)}function cg(e){let t,i,s,r,o,a=0;const n=e.data;if(!e||0===e.size)return null;for(;n[0].length<19&&n.length>1;)n[0]=Vu(n[0],n[1]),n.splice(1,1);t=n[0];if(1===(t[0]<<16)+(t[1]<<8)+t[2]){if(i=(t[4]<<8)+t[5],i&&i>e.size-6)return null;const l=t[7];192&l&&(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&l?(o=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2,r-o>54e5&&(Pc.warn(`${Math.round((r-o)/9e4)}s delta between PTS and DTS, align them`),r=o)):o=r),s=t[8];let d=s+9;if(e.size<=d)return null;e.size-=d;const h=new Uint8Array(e.size);for(let e=0,i=n.length;ei){d-=i;continue}t=t.subarray(d),i-=d,d=0}h.set(t,a),a+=i}return i&&(i-=s+3),{data:h,pts:r,dts:o,len:i}}return null}class ug{static getSilentFrame(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}const pg=Math.pow(2,32)-1;class fg{static init(){let e;for(e in fg.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},fg.types)fg.types.hasOwnProperty(e)&&(fg.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);fg.HDLR_TYPES={video:t,audio:i};const s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);fg.STTS=fg.STSC=fg.STCO=r,fg.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),fg.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),fg.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),fg.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const o=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),n=new Uint8Array([0,0,0,1]);fg.FTYP=fg.box(fg.types.ftyp,o,n,o,a),fg.DINF=fg.box(fg.types.dinf,fg.box(fg.types.dref,s))}static box(e,...t){let i=8,s=t.length;const r=s;for(;s--;)i+=t[s].byteLength;const o=new Uint8Array(i);for(o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=255&i,o.set(e,4),s=0,i=8;s>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,s>>24,s>>16&255,s>>8&255,255&s,85,196,0,0]))}static mdia(e){return fg.box(fg.types.mdia,fg.mdhd(e.timescale,e.duration),fg.hdlr(e.type),fg.minf(e))}static mfhd(e){return fg.box(fg.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}static minf(e){return"audio"===e.type?fg.box(fg.types.minf,fg.box(fg.types.smhd,fg.SMHD),fg.DINF,fg.stbl(e)):fg.box(fg.types.minf,fg.box(fg.types.vmhd,fg.VMHD),fg.DINF,fg.stbl(e))}static moof(e,t,i){return fg.box(fg.types.moof,fg.mfhd(e),fg.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=fg.trak(e[t]);return fg.box.apply(null,[fg.types.moov,fg.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(fg.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=fg.trex(e[t]);return fg.box.apply(null,[fg.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(pg+1)),s=Math.floor(t%(pg+1)),r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,s>>24,s>>16&255,s>>8&255,255&s,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return fg.box(fg.types.mvhd,r)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let s,r;for(s=0;s>>8&255),r.push(255&s),r=r.concat(Array.prototype.slice.call(i));for(t=0;t>>8&255),o.push(255&s),o=o.concat(Array.prototype.slice.call(i));const a=fg.box(fg.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|e.sps.length].concat(r).concat([e.pps.length]).concat(o))),n=e.width,l=e.height,d=e.pixelRatio[0],h=e.pixelRatio[1];return fg.box(fg.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,n>>8&255,255&n,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),a,fg.box(fg.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),fg.box(fg.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,h>>24,h>>16&255,h>>8&255,255&h])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0])}static mp4a(e){return fg.box(fg.types.mp4a,fg.audioStsd(e),fg.box(fg.types.esds,fg.esds(e)))}static mp3(e){return fg.box(fg.types[".mp3"],fg.audioStsd(e))}static ac3(e){return fg.box(fg.types["ac-3"],fg.audioStsd(e),fg.box(fg.types.dac3,e.config))}static stsd(e){return"audio"===e.type?"mp3"===e.segmentCodec&&"mp3"===e.codec?fg.box(fg.types.stsd,fg.STSD,fg.mp3(e)):"ac3"===e.segmentCodec?fg.box(fg.types.stsd,fg.STSD,fg.ac3(e)):fg.box(fg.types.stsd,fg.STSD,fg.mp4a(e)):fg.box(fg.types.stsd,fg.STSD,fg.avc1(e))}static tkhd(e){const t=e.id,i=e.duration*e.timescale,s=e.width,r=e.height,o=Math.floor(i/(pg+1)),a=Math.floor(i%(pg+1));return fg.box(fg.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,a>>24,a>>16&255,a>>8&255,255&a,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>8&255,255&s,0,0,r>>8&255,255&r,0,0]))}static traf(e,t){const i=fg.sdtp(e),s=e.id,r=Math.floor(t/(pg+1)),o=Math.floor(t%(pg+1));return fg.box(fg.types.traf,fg.box(fg.types.tfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s])),fg.box(fg.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,o>>24,o>>16&255,o>>8&255,255&o])),fg.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,fg.box(fg.types.trak,fg.tkhd(e),fg.mdia(e))}static trex(e){const t=e.id;return fg.box(fg.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],s=i.length,r=12+16*s,o=new Uint8Array(r);let a,n,l,d,h,c;for(t+=8+r,o.set(["video"===e.type?1:0,0,15,1,s>>>24&255,s>>>16&255,s>>>8&255,255&s,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0),a=0;a>>24&255,l>>>16&255,l>>>8&255,255&l,d>>>24&255,d>>>16&255,d>>>8&255,255&d,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|h.isNonSync,61440&h.degradPrio,15&h.degradPrio,c>>>24&255,c>>>16&255,c>>>8&255,255&c],12+16*a);return fg.box(fg.types.trun,o)}static initSegment(e){fg.types||fg.init();const t=fg.moov(e);return Vu(fg.FTYP,t)}}fg.types=void 0,fg.HDLR_TYPES=void 0,fg.STTS=void 0,fg.STSC=void 0,fg.STCO=void 0,fg.STSZ=void 0,fg.VMHD=void 0,fg.SMHD=void 0,fg.STSD=void 0,fg.FTYP=void 0,fg.DINF=void 0;function mg(e,t,i=1,s=!1){const r=e*t*i;return s?Math.round(r):r}function gg(e,t=!1){return mg(e,1e3,1/9e4,t)}let yg,Ag=null,bg=null;class vg{constructor(e,t,i,s=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,null===Ag){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ag=e?parseInt(e[1]):0}if(null===bg){const e=navigator.userAgent.match(/Safari\/(\d+)/i);bg=e?parseInt(e[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){Pc.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){Pc.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){Pc.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e.reduce(((e,i)=>{const s=i.pts-e;return s<-4294967296?(t=!0,_g(e,i.pts)):s>0?e:i.pts}),e[0].pts);return t&&Pc.debug("PTS rollover detected"),i}remux(e,t,i,s,r,o,a,n){let l,d,h,c,u,p,f=r,m=r;const g=e.pid>-1,y=t.pid>-1,A=t.samples.length,b=e.samples.length>0,v=a&&A>0||A>1;if((!g||b)&&(!y||v)||this.ISGenerated||a){if(this.ISGenerated){var _,S,E,w;const e=this.videoTrackConfig;!e||t.width===e.width&&t.height===e.height&&(null==(_=t.pixelRatio)?void 0:_[0])===(null==(S=e.pixelRatio)?void 0:S[0])&&(null==(E=t.pixelRatio)?void 0:E[1])===(null==(w=e.pixelRatio)?void 0:w[1])||this.resetInitSegment()}else h=this.generateIS(e,t,r,o);const i=this.isVideoContiguous;let s,a=-1;if(v&&(a=function(e){for(let t=0;t0){Pc.warn(`[mp4-remuxer]: Dropped ${a} out of ${A} video samples due to a missing keyframe`);const e=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(a),t.dropped+=a,m+=(t.samples[0].pts-e)/t.inputTimeScale,s=m}else-1===a&&(Pc.warn(`[mp4-remuxer]: No keyframe found out of ${A} video samples`),p=!1);if(this.ISGenerated){if(b&&v){const i=this.getVideoStartPts(t.samples),s=(_g(e.samples[0].pts,i)-i)/t.inputTimeScale;f+=Math.max(0,s),m+=Math.max(0,-s)}if(b){if(e.samplerate||(Pc.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),h=this.generateIS(e,t,r,o)),d=this.remuxAudio(e,f,this.isAudioContiguous,o,y||v||n===Bp?m:void 0),v){const s=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(Pc.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),h=this.generateIS(e,t,r,o)),l=this.remuxVideo(t,m,i,s)}}else v&&(l=this.remuxVideo(t,m,i,0));l&&(l.firstKeyFrame=a,l.independent=-1!==a,l.firstKeyFramePTS=s)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(u=Sg(i,r,this._initPTS,this._initDTS)),s.samples.length&&(c=Eg(s,r,this._initPTS))),{audio:d,video:l,initSegment:h,independent:p,text:c,id3:u}}generateIS(e,t,i,s){const r=e.samples,o=t.samples,a=this.typeSupported,n={},l=this._initPTS;let d,h,c,u=!l||s,p="audio/mp4";if(u&&(d=h=1/0),e.config&&r.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(p="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}n.audio={id:"audio",container:p,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&a.mpeg?new Uint8Array(0):fg.initSegment([e]),metadata:{channelCount:e.channelCount}},u&&(c=e.inputTimeScale,l&&c===l.timescale?u=!1:d=h=r[0].pts-Math.round(c*i))}if(t.sps&&t.pps&&o.length){if(t.timescale=t.inputTimeScale,n.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:fg.initSegment([t]),metadata:{width:t.width,height:t.height}},u)if(c=t.inputTimeScale,l&&c===l.timescale)u=!1;else{const e=this.getVideoStartPts(o),t=Math.round(c*i);h=Math.min(h,_g(o[0].dts,e)-t),d=Math.min(d,e-t)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(n).length)return this.ISGenerated=!0,u?(this._initPTS={baseTime:d,timescale:c},this._initDTS={baseTime:h,timescale:c}):d=c=void 0,{tracks:n,initPTS:d,timescale:c}}remuxVideo(e,t,i,s){const r=e.inputTimeScale,o=e.samples,a=[],n=o.length,l=this._initPTS;let d,h,c=this.nextAvcDts,u=8,p=this.videoSampleDuration,f=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,g=!1;if(!i||null===c){const e=t*r,s=o[0].pts-_g(o[0].dts,o[0].pts);Ag&&null!==c&&Math.abs(e-s-c)<15e3?i=!0:c=e-s}const y=l.baseTime*r/l.timescale;for(let e=0;e0?e-1:e].dts&&(g=!0)}g&&o.sort((function(e,t){const i=e.dts-t.dts,s=e.pts-t.pts;return i||s})),d=o[0].dts,h=o[o.length-1].dts;const A=h-d,b=A?Math.round(A/(n-1)):p||e.inputTimeScale/30;if(i){const e=d-c,i=e>b,s=e<-1;if((i||s)&&(i?Pc.warn(`AVC: ${gg(e,!0)} ms (${e}dts) hole between fragments detected at ${t.toFixed(3)}`):Pc.warn(`AVC: ${gg(-e,!0)} ms (${e}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!s||c>=o[0].pts||Ag)){d=c;const t=o[0].pts-e;if(i)o[0].dts=d,o[0].pts=t;else for(let i=0;it);i++)o[i].dts-=e,o[i].pts-=e;Pc.log(`Video: Initial PTS/DTS adjusted: ${gg(t,!0)}/${gg(d,!0)}, delta: ${gg(e,!0)} ms`)}}d=Math.max(0,d);let v=0,_=0,S=d;for(let e=0;e0?t.dts-o[e-1].dts:b;if(l=e>0?t.pts-o[e-1].pts:b,i.stretchShortVideoTrack&&null!==this.nextAudioPts){const e=Math.floor(i.maxBufferHole*r),o=(s?f+s*r:this.nextAudioPts)-t.pts;o>e?(p=o-a,p<0?p=a:k=!0,Pc.log(`[mp4-remuxer]: It is approximately ${o/90} ms to the next segment; using duration ${p/90} ms for the last video frame.`)):p=a}else p=a}const h=Math.round(t.pts-t.dts);L=Math.min(L,p),D=Math.max(D,p),C=Math.min(C,l),x=Math.max(x,l),a.push(new wg(t.key,p,d,h))}if(a.length)if(Ag){if(Ag<70){const e=a[0].flags;e.dependsOn=2,e.isNonSync=0}}else if(bg&&x-C0&&(s&&Math.abs(g-m)<9e3||Math.abs(_g(p[0].pts-y,g)-m)<20*l),p.forEach((function(e){e.pts=_g(e.pts-y,g)})),!i||m<0){if(p=p.filter((e=>e.pts>=0)),!p.length)return;m=0===r?0:s&&!u?Math.max(0,g):p[0].pts}if("aac"===e.segmentCodec){const t=this.config.maxAudioFramesDrift;for(let i=0,s=m;i=t*l&&d<1e4&&u){let t=Math.round(n/l);s=a-t*l,s<0&&(t--,s+=l),0===i&&(this.nextAudioPts=m=s),Pc.warn(`[mp4-remuxer]: Injecting ${t} audio frame @ ${(s/o).toFixed(3)}s due to ${Math.round(1e3*n/o)} ms gap.`);for(let o=0;o0))return;_+=f;try{A=new Uint8Array(_)}catch(e){return void this.observer.emit(Tc.ERROR,Tc.ERROR,{type:kc.MUX_ERROR,details:Lc.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:_,reason:`fail allocating audio mdat ${_}`})}if(!h){new DataView(A.buffer).setUint32(0,_),A.set(fg.types.mdat,4)}}A.set(r,f);const l=r.byteLength;f+=l,c.push(new wg(!0,n,l,0)),v=o}const E=c.length;if(!E)return;const w=c[c.length-1];this.nextAudioPts=m=v+a*w.duration;const T=h?new Uint8Array(0):fg.moof(e.sequenceNumber++,b/a,_c({},e,{samples:c}));e.samples=[];const k=b/o,L=m/o,C={data1:T,data2:A,startPTS:k,endPTS:L,startDTS:k,endDTS:L,type:"audio",hasAudio:!0,hasVideo:!1,nb:E};return this.isAudioContiguous=!0,C}remuxEmptyAudio(e,t,i,s){const r=e.inputTimeScale,o=r/(e.samplerate?e.samplerate:r),a=this.nextAudioPts,n=this._initDTS,l=9e4*n.baseTime/n.timescale,d=(null!==a?a:s.startDTS*r)+l,h=s.endDTS*r+l,c=1024*o,u=Math.ceil((h-d)/c),p=ug.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(Pc.warn("[mp4-remuxer]: remux empty Audio"),!p)return void Pc.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");const f=[];for(let e=0;e4294967296;)e+=i;return e}function Sg(e,t,i,s){const r=e.samples.length;if(!r)return;const o=e.inputTimeScale;for(let a=0;ae.pts-t.pts));const o=e.samples;return e.samples=[],{samples:o}}class wg{constructor(e,t,i,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=s,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}function Tg(e,t){const i=null==e?void 0:e.codec;if(i&&i.length>4)return i;if(t===Nc){if("ec-3"===i||"ac-3"===i||"alac"===i)return i;if("fLaC"===i||"Opus"===i){return pp(i,!1)}const e="mp4a.40.5";return Pc.info(`Parsed audio codec "${i}" or audio object type not handled. Using "${e}"`),e}return Pc.warn(`Unhandled video codec "${i}"`),"hvc1"===i||"hev1"===i?"hvc1.1.6.L120.90":"av01"===i?"av01.0.04M.08":"avc1.42e01e"}try{yg=self.performance.now.bind(self.performance)}catch(e){Pc.debug("Unable to use Performance API on this environment"),yg=null==Kc?void 0:Kc.Date.now}const kg=[{demux:class{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,s){const r=this.videoTrack=xm("video",1),o=this.audioTrack=xm("audio",1),a=this.txtTrack=xm("text",1);if(this.id3Track=xm("id3",1),this.timeOffset=0,null==e||!e.byteLength)return;const n=Uu(e);if(n.video){const{id:e,timescale:t,codec:i}=n.video;r.id=e,r.timescale=a.timescale=t,r.codec=i}if(n.audio){const{id:e,timescale:t,codec:i}=n.audio;o.id=e,o.timescale=t,o.codec=i}a.id=Cu.text,r.sampleDuration=0,r.duration=o.duration=s}resetContiguity(){this.remainderData=null}static probe(e){return function(e){const t=e.byteLength;for(let i=0;i8&&109===e[i+4]&&111===e[i+5]&&111===e[i+6]&&102===e[i+7])return!0;i=s>1?i+s:t}return!1}(e)}demux(e,t){this.timeOffset=t;let i=e;const s=this.videoTrack,r=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Vu(this.remainderData,e));const t=function(e){const t={valid:null,remainder:null},i=Mu(e,["moof"]);if(i.length<2)return t.remainder=e,t;const s=i[i.length-1];return t.valid=nu(e,0,s.byteOffset-8),t.remainder=nu(e,s.byteOffset-8),t}(i);this.remainderData=t.remainder,s.samples=t.valid||new Uint8Array}else s.samples=i;const o=this.extractID3Track(s,t);return r.samples=Hu(t,s),{videoTrack:s,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const s=this.extractID3Track(t,this.timeOffset);return i.samples=Hu(e,t),{videoTrack:t,audioTrack:xm(),id3Track:s,textTrack:xm()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const s=Mu(e.samples,["emsg"]);s&&s.forEach((e=>{const s=function(e){const t=e[0];let i="",s="",r=0,o=0,a=0,n=0,l=0,d=0;if(0===t){for(;"\0"!==Du(e.subarray(d,d+1));)i+=Du(e.subarray(d,d+1)),d+=1;for(i+=Du(e.subarray(d,d+1)),d+=1;"\0"!==Du(e.subarray(d,d+1));)s+=Du(e.subarray(d,d+1)),d+=1;s+=Du(e.subarray(d,d+1)),d+=1,r=Ru(e,12),o=Ru(e,16),n=Ru(e,20),l=Ru(e,24),d=28}else if(1===t){d+=4,r=Ru(e,d),d+=4;const t=Ru(e,d);d+=4;const o=Ru(e,d);for(d+=4,a=2**32*t+o,Ec(a)||(a=Number.MAX_SAFE_INTEGER,Pc.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),n=Ru(e,d),d+=4,l=Ru(e,d),d+=4;"\0"!==Du(e.subarray(d,d+1));)i+=Du(e.subarray(d,d+1)),d+=1;for(i+=Du(e.subarray(d,d+1)),d+=1;"\0"!==Du(e.subarray(d,d+1));)s+=Du(e.subarray(d,d+1)),d+=1;s+=Du(e.subarray(d,d+1)),d+=1}return{schemeIdUri:i,value:s,timeScale:r,presentationTime:a,presentationTimeDelta:o,eventDuration:n,id:l,payload:e.subarray(d,e.byteLength)}}(e);if(Qm.test(s.schemeIdUri)){const e=Sc(s.presentationTime)?s.presentationTime/s.timeScale:t+s.presentationTimeDelta/s.timeScale;let r=4294967295===s.eventDuration?Number.POSITIVE_INFINITY:s.eventDuration/s.timeScale;r<=.001&&(r=Number.POSITIVE_INFINITY);const o=s.payload;i.samples.push({data:o,len:o.byteLength,dts:e,pts:e,type:Hp,duration:r})}}))}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}},remux:class{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,i,s){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(function(e,t){if(!e||!t)return e;const i=t.keyId;i&&t.isCommonEncryption&&Mu(e,["moov","trak"]).forEach((e=>{const t=Mu(e,["mdia","minf","stbl","stsd"])[0].subarray(8);let s=Mu(t,["enca"]);const r=s.length>0;r||(s=Mu(t,["encv"])),s.forEach((e=>{Mu(r?e.subarray(28):e.subarray(78),["sinf"]).forEach((e=>{const t=zu(e);if(t){const e=t.subarray(8,24);e.some((e=>0!==e))||(Pc.log(`[eme] Patching keyId in 'enc${r?"a":"v"}>sinf>>tenc' box: ${Tu(e)} -> ${Tu(i)}`),t.set(i,8))}}))}))}));return e}(e,s)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(null==e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);const s=this.initData=Uu(e);s.audio&&(t=Tg(s.audio,Nc)),s.video&&(i=Tg(s.video,jc));const r={};s.audio&&s.video?r.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:s.audio?r.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:s.video?r.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:Pc.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=r}remux(e,t,i,s,r,o){var a,n;let{initPTS:l,lastEndTime:d}=this;const h={audio:void 0,video:void 0,text:s,id3:i,initSegment:void 0};Sc(d)||(d=this.lastEndTime=r||0);const c=t.samples;if(null==c||!c.length)return h;const u={initPTS:void 0,timescale:1};let p=this.initData;if(null!=(a=p)&&a.length||(this.generateInitSegment(c),p=this.initData),null==(n=p)||!n.length)return Pc.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),h;this.emitInitSegment&&(u.tracks=this.initTracks,this.emitInitSegment=!1);const f=function(e,t){let i=0,s=0,r=0;const o=Mu(e,["moof","traf"]);for(let e=0;ee+t.info.duration||0),0);i=Math.max(i,e+o.earliestPresentationTime/o.timescale),s=i-t}}if(s&&Sc(s))return s}return s||r}(c,p),m=function(e,t){return Mu(t,["moof","traf"]).reduce(((t,i)=>{const s=Mu(i,["tfdt"])[0],r=s[0],o=Mu(i,["tfhd"]).reduce(((t,i)=>{const o=Ru(i,4),a=e[o];if(a){let e=Ru(s,4);if(1===r){if(e===ku)return Pc.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),t;e*=ku+1,e+=Ru(s,8)}const i=e/(a.timescale||9e4);if(Sc(i)&&(null===t||ir}(l,g,r,f)||u.timescale!==l.timescale&&o)&&(u.initPTS=g-r,l&&1===l.timescale&&Pc.warn("Adjusting initPTS by "+(u.initPTS-l.baseTime)),this.initPTS=l={baseTime:u.initPTS,timescale:1});const y=e?g-l.baseTime/l.timescale:d,A=y+f;!function(e,t,i){Mu(t,["moof","traf"]).forEach((t=>{Mu(t,["tfhd"]).forEach((s=>{const r=Ru(s,4),o=e[r];if(!o)return;const a=o.timescale||9e4;Mu(t,["tfdt"]).forEach((e=>{const t=e[0],s=i*a;if(s){let i=Ru(e,4);if(0===t)i-=s,i=Math.max(i,0),Iu(e,4,i);else{i*=Math.pow(2,32),i+=Ru(e,8),i-=s,i=Math.max(i,0);const t=Math.floor(i/(ku+1)),r=Math.floor(i%(ku+1));Iu(e,4,t),Iu(e,8,r)}}}))}))}))}(p,c,l.baseTime/l.timescale),f>0?this.lastEndTime=A:(Pc.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const b=!!p.audio,v=!!p.video;let _="";b&&(_+="audio"),v&&(_+="video");const S={data1:c,startPTS:y,startDTS:y,endPTS:A,endDTS:A,type:_,hasAudio:b,hasVideo:v,nb:1,dropped:0};return h.audio="audio"===S.type?S:void 0,h.video="audio"!==S.type?S:void 0,h.initSegment=u,h.id3=Sg(i,r,l,l),s.samples.length&&(h.text=Eg(s,r,l)),h}}},{demux:og,remux:vg},{demux:class extends Rm{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,s){super.resetInitSegment(e,t,i,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=hu(e,0);let i=(null==t?void 0:t.length)||0;if(Ym(e,i))return!1;for(let t=e.length;i0&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(i=t);return i}(o,t);if(b&&"AES-128"===b.method){const e=this.getDecrypter();if(!e.isSync())return this.decryptionPromise=e.webCryptoDecrypt(o,b.key.buffer,b.iv.buffer).then((e=>{const t=this.push(e,null,i);return this.decryptionPromise=null,t})),this.decryptionPromise;{let t=e.softwareDecrypt(o,b.key.buffer,b.iv.buffer);if(i.part>-1&&(t=e.flush()),!t)return r.executeEnd=yg(),Cg(i);o=new Uint8Array(t)}}const v=this.needsProbing(d,h);if(v){const e=this.configureTransmuxer(o);if(e)return Pc.warn(`[transmuxer] ${e.message}`),this.observer.emit(Tc.ERROR,Tc.ERROR,{type:kc.MEDIA_ERROR,details:Lc.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message}),r.executeEnd=yg(),Cg(i)}(d||h||p||v)&&this.resetInitSegment(A,f,m,y,t),(d||p||v)&&this.resetInitialTimestamp(g),l||this.resetContiguity();const _=this.transmux(o,b,u,c,i),S=this.currentTransmuxState;return S.contiguous=!0,S.discontinuity=!1,S.trackSwitch=!1,r.executeEnd=yg(),_}flush(e){const t=e.transmuxing;t.executeStart=yg();const{decrypter:i,currentTransmuxState:s,decryptionPromise:r}=this;if(r)return r.then((()=>this.flush(e)));const o=[],{timeOffset:a}=s;if(i){const t=i.flush();t&&o.push(this.push(t,null,e))}const{demuxer:n,remuxer:l}=this;if(!n||!l)return t.executeEnd=yg(),[Cg(e)];const d=n.flush(a);return Dg(d)?d.then((t=>(this.flushRemux(o,t,e),o))):(this.flushRemux(o,d,e),o)}flushRemux(e,t,i){const{audioTrack:s,videoTrack:r,id3Track:o,textTrack:a}=t,{accurateTimeOffset:n,timeOffset:l}=this.currentTransmuxState;Pc.log(`[transmuxer.ts]: Flushed fragment ${i.sn}${i.part>-1?" p: "+i.part:""} of level ${i.level}`);const d=this.remuxer.remux(s,r,o,a,l,n,!0,this.id);e.push({remuxResult:d,chunkMeta:i}),i.transmuxing.executeEnd=yg()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,s,r){const{demuxer:o,remuxer:a}=this;o&&a&&(o.resetInitSegment(e,t,i,s),a.resetInitSegment(e,t,i,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,s,r){let o;return o=t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,i,s,r):this.transmuxUnencrypted(e,i,s,r),o}transmuxUnencrypted(e,t,i,s){const{audioTrack:r,videoTrack:o,id3Track:a,textTrack:n}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,o,a,n,t,i,!1,this.id),chunkMeta:s}}transmuxSampleAes(e,t,i,s,r){return this.demuxer.demuxSampleAes(e,t,i).then((e=>({remuxResult:this.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,i,s,!1,this.id),chunkMeta:r})))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:s,vendor:r}=this;let o;for(let t=0,i=kg.length;t({remuxResult:{},chunkMeta:e});function Dg(e){return"then"in e&&e.then instanceof Function}class xg{constructor(e,t,i,s,r){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=s,this.defaultInitPts=r||null}}class Rg{constructor(e,t,i,s,r,o){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=s,this.timeOffset=r,this.initSegmentChange=o}}var Pg={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function s(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,s,o,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var n=new r(s,o||e,a),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],n]:e._events[l].push(n):(e._events[l]=n,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new s:delete e._events[t]}function n(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),n.prototype.eventNames=function(){var e,s,r=[];if(0===this._eventsCount)return r;for(s in e=this._events)t.call(e,s)&&r.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},n.prototype.listeners=function(e){var t=i?i+e:e,s=this._events[t];if(!s)return[];if(s.fn)return[s.fn];for(var r=0,o=s.length,a=new Array(o);r{(t=t||{}).frag=this.frag,t.id=this.id,e===Tc.ERROR&&(this.error=t.error),this.hls.trigger(e,t)};this.observer=new Bg,this.observer.on(Tc.FRAG_DECRYPTED,o),this.observer.on(Tc.ERROR,o);const a=rp(r.preferManagedMediaSource)||{isTypeSupported:()=>!1},n={mpeg:a.isTypeSupported("audio/mpeg"),mp3:a.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:a.isTypeSupported('audio/mp4; codecs="ac-3"')};if(this.useWorker&&"undefined"!=typeof Worker){if(r.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{r.workerPath?(Pc.log(`loading Web Worker ${r.workerPath} for "${t}"`),this.workerContext=function(e){const t=new self.URL(e,self.location.href).href;return{worker:new self.Worker(t),scriptURL:t}}(r.workerPath)):(Pc.log(`injecting Web Worker for "${t}"`),this.workerContext=function(){const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e);return{worker:new self.Worker(t),objectURL:t}}()),this.onwmsg=e=>this.onWorkerMessage(e);const{worker:e}=this.workerContext;e.addEventListener("message",this.onwmsg),e.onerror=e=>{const i=new Error(`${e.message} (${e.filename}:${e.lineno})`);r.enableWorker=!1,Pc.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(Tc.ERROR,{type:kc.OTHER_ERROR,details:Lc.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:i})},e.postMessage({cmd:"init",typeSupported:n,vendor:"",id:t,config:JSON.stringify(r)})}catch(e){Pc.warn(`Error setting up "${t}" Web Worker, fallback to inline`,e),this.resetWorker(),this.error=null,this.transmuxer=new Lg(this.observer,n,r,"",t)}return}}this.transmuxer=new Lg(this.observer,n,r,"",t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,i,s,r,o,a,n,l,d){var h,c;l.transmuxing.start=self.performance.now();const{transmuxer:u}=this,p=o?o.start:r.start,f=r.decryptdata,m=this.frag,g=!(m&&r.cc===m.cc),y=!(m&&l.level===m.level),A=m?l.sn-m.sn:-1,b=this.part?l.part-this.part.index:-1,v=0===A&&l.id>1&&l.id===(null==m?void 0:m.stats.chunkCount),_=!y&&(1===A||0===A&&(1===b||v&&b<=0)),S=self.performance.now();(y||A||0===r.stats.parsing.start)&&(r.stats.parsing.start=S),!o||!b&&_||(o.stats.parsing.start=S);const E=!(m&&(null==(h=r.initSegment)?void 0:h.url)===(null==(c=m.initSegment)?void 0:c.url)),w=new Rg(g,_,n,y,p,E);if(!_||g||E){Pc.log(`[transmuxer-interface, ${r.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}\n discontinuity: ${g}\n trackSwitch: ${y}\n contiguous: ${_}\n accurateTimeOffset: ${n}\n timeOffset: ${p}\n initSegmentChange: ${E}`);const e=new xg(i,s,t,a,d);this.configureTransmuxer(e)}if(this.frag=r,this.part=o,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:f,chunkMeta:l,state:w},e instanceof ArrayBuffer?[e]:[]);else if(u){const t=u.push(e,f,l,w);Dg(t)?(u.async=!0,t.then((e=>{this.handleTransmuxComplete(e)})).catch((e=>{this.transmuxerError(e,l,"transmuxer-interface push error")}))):(u.async=!1,this.handleTransmuxComplete(t))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let i=t.flush(e);Dg(i)||t.async?(Dg(i)||(i=Promise.resolve(i)),i.then((t=>{this.handleFlushResult(t,e)})).catch((t=>{this.transmuxerError(t,e,"transmuxer-interface flush error")}))):this.handleFlushResult(i,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(Tc.ERROR,{type:kc.MEDIA_ERROR,details:Lc.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach((e=>{this.handleTransmuxComplete(e)})),this.onFlush(t)}onWorkerMessage(e){const t=e.data;if(null==t||!t.event)return void Pc.warn("worker message received with no "+(t?"event name":"data"));const i=this.hls;if(this.hls)switch(t.event){case"init":{var s;const e=null==(s=this.workerContext)?void 0:s.objectURL;e&&self.URL.revokeObjectURL(e);break}case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":Pc[t.data.logType]&&Pc[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data)}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}function Mg(e,t){if(e.length!==t.length)return!1;for(let i=0;ie[i]!==t[i]))}function Ug(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||"").toLowerCase())}class Og{constructor(e){this.buffered=void 0;const t=(t,i,s)=>{if((i>>>=0)>s-1)throw new DOMException(`Failed to execute '${t}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${s})`);return e[i][t]};this.buffered={get length(){return e.length},end:i=>t("end",i,e.length),start:i=>t("start",i,e.length)}}}class Ng{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,i){const s=this.queues[t];s.push(e),1!==s.length||i||this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const i=new Promise((e=>{t=e})),s={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(s,e),i}executeNext(e){const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(t){Pc.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${t}`),i.onError(t);const s=this.buffers[e];null!=s&&s.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const jg=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;function Gg(e){const t=e.querySelectorAll("source");[].slice.call(t).forEach((t=>{e.removeChild(t)}))}const zg={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},Wg=e=>String.fromCharCode(zg[e]||e),Vg=15,Hg=100,$g={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Jg={17:2,18:4,21:6,22:8,23:10,19:13,20:15},qg={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Kg={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Yg=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Qg{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i="function"==typeof t?t():t;Pc.log(`${this.time} [${e}] ${i}`)}}}const Xg=function(e){const t=[];for(let i=0;iHg&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Hg)}moveCursor(e){const t=this.pos+e;if(e>1)for(let e=this.pos+1;e=144&&this.backSpace();const t=Wg(e);this.pos>=Hg?this.logger.log(0,(()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!")):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))}clearFromPos(e){let t;for(t=e;t"pacData = "+JSON.stringify(e)));let t=e.row-1;if(this.nrRollUpRows&&t"bkgData = "+JSON.stringify(e))),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,(()=>this.getDisplayText()));const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",s=-1;for(let i=0;i0&&(i=e?"["+t.join(" | ")+"]":t.join("\n")),i}getTextAndFormat(){return this.rows}}class sy{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new iy(i),this.nonDisplayedMemory=new iy(i),this.lastOutputScreen=new iy(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,(()=>"MODE="+e)),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let t=0;tt+": "+this.writeScreen.getDisplayText(!0))),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(1,(()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0))),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,(()=>"DISP: "+this.displayedMemory.getDisplayText()))}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,s=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=s[i]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class ry{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const s=this.logger=new Qg;this.channels=[null,new sy(e,t,s),new sy(e+1,i,s)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let e=0;e"["+Xg([t[e],t[e+1]])+"] -> ("+Xg([i,s])+")"));const a=this.cmdHistory;if(i>=16&&i<=31){if(ay(i,s,a)){oy(null,null,a),this.logger.log(3,(()=>"Repeated command ("+Xg([i,s])+") is dropped"));continue}oy(i,s,this.cmdHistory),r=this.parseCmd(i,s),r||(r=this.parseMidrow(i,s)),r||(r=this.parsePAC(i,s)),r||(r=this.parseBackgroundAttributes(i,s))}else oy(null,null,a);if(!r&&(o=this.parseChars(i,s),o)){const e=this.currentChannel;if(e&&e>0){this.channels[e].insertChars(o)}else this.logger.log(2,"No channel found yet. TEXT-MODE?")}r||o||this.logger.log(2,(()=>"Couldn't parse cleaned data "+Xg([i,s])+" orig: "+Xg([t[e],t[e+1]])))}}parseCmd(e,t){if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=33&&t<=35))return!1;const i=20===e||21===e||23===e?1:2,s=this.channels[i];return 20===e||21===e||28===e||29===e?32===t?s.ccRCL():33===t?s.ccBS():34===t?s.ccAOF():35===t?s.ccAON():36===t?s.ccDER():37===t?s.ccRU(2):38===t?s.ccRU(3):39===t?s.ccRU(4):40===t?s.ccFON():41===t?s.ccRDC():42===t?s.ccTR():43===t?s.ccRTD():44===t?s.ccEDM():45===t?s.ccCR():46===t?s.ccENM():47===t&&s.ccEOC():s.ccTO(t-32),this.currentChannel=i,!0}parseMidrow(e,t){let i=0;if((17===e||25===e)&&t>=32&&t<=47){if(i=17===e?1:2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const s=this.channels[i];return!!s&&(s.ccMIDROW(t),this.logger.log(3,(()=>"MIDROW ("+Xg([e,t])+")")),!0)}return!1}parsePAC(e,t){let i;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127)&&!((16===e||24===e)&&t>=64&&t<=95))return!1;const s=e<=23?1:2;i=t>=64&&t<=95?1===s?$g[e]:qg[e]:1===s?Jg[e]:Kg[e];const r=this.channels[s];return!!r&&(r.setPAC(this.interpretPAC(i,t)),this.currentChannel=s,!0)}interpretPAC(e,t){let i;const s={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,s.underline=1==(1&i),i<=13?s.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(s.italics=!0,s.color="white"):s.indent=4*Math.floor((i-16)/2),s}parseChars(e,t){let i,s=null,r=null;if(e>=25?(i=2,r=e-8):(i=1,r=e),r>=17&&r<=19){let e;e=17===r?t+80:18===r?t+112:t+144,this.logger.log(2,(()=>"Special char '"+Wg(e)+"' in channel "+i)),s=[e]}else e>=32&&e<=127&&(s=0===t?[e]:[e,t]);return s&&this.logger.log(3,(()=>"Char codes = "+Xg(s).join(","))),s}parseBackgroundAttributes(e,t){if(!((16===e||24===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=45&&t<=47))return!1;let i;const s={};16===e||24===e?(i=Math.floor((t-32)/2),s.background=Yg[i],t%2==1&&(s.background=s.background+"_semi")):45===t?s.background="transparent":(s.foreground="black",47===t&&(s.underline=!0));const r=e<=23?1:2;return this.channels[r].setBkgData(s),!0}reset(){for(let e=0;ee)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var ly=function(){if(null!=Kc&&Kc.VTTCue)return self.VTTCue;const e=["","lr","rl"],t=["start","middle","end","left","right"];function i(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;const i=t.toLowerCase();return!!~e.indexOf(i)&&i}function s(e){return i(t,e)}function r(e,...t){let i=1;for(;i100)throw new Error("Position must be between 0 and 100.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(n,"positionAlign",r({},l,{get:function(){return v},set:function(e){const t=s(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");v=t,this.hasBeenReset=!0}})),Object.defineProperty(n,"size",r({},l,{get:function(){return _},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");_=e,this.hasBeenReset=!0}})),Object.defineProperty(n,"align",r({},l,{get:function(){return S},set:function(e){const t=s(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");S=t,this.hasBeenReset=!0}})),n.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class dy{decode(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function hy(e){function t(e,t,i,s){return 3600*(0|e)+60*(0|t)+(0|i)+parseFloat(s||0)}const i=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return i?parseFloat(i[2])>59?t(i[2],i[3],0,i[4]):t(i[1],i[2],i[3],i[4]):null}class cy{constructor(){this.values=Object.create(null)}set(e,t){this.get(e)||""===t||(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let s=0;s=0&&i<=100)return this.set(e,i),!0}return!1}}function uy(e,t,i,s){const r=s?e.split(s):[e];for(const e in r){if("string"!=typeof r[e])continue;const s=r[e].split(i);if(2!==s.length)continue;t(s[0],s[1])}}const py=new ly(0,0,""),fy="middle"===py.align?"middle":"center";function my(e,t,i){const s=e;function r(){const t=hy(e);if(null===t)throw new Error("Malformed timestamp: "+s);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function o(){e=e.replace(/^\s+/,"")}if(o(),t.startTime=r(),o(),"--\x3e"!==e.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+s);e=e.slice(3),o(),t.endTime=r(),o(),function(e,t){const s=new cy;uy(e,(function(e,t){let r;switch(e){case"region":for(let r=i.length-1;r>=0;r--)if(i[r].id===t){s.set(e,i[r].region);break}break;case"vertical":s.alt(e,t,["rl","lr"]);break;case"line":r=t.split(","),s.integer(e,r[0]),s.percent(e,r[0])&&s.set("snapToLines",!1),s.alt(e,r[0],["auto"]),2===r.length&&s.alt("lineAlign",r[1],["start",fy,"end"]);break;case"position":r=t.split(","),s.percent(e,r[0]),2===r.length&&s.alt("positionAlign",r[1],["start",fy,"end","line-left","line-right","auto"]);break;case"size":s.percent(e,t);break;case"align":s.alt(e,t,["start",fy,"end","left","right"])}}),/:/,/\s/),t.region=s.get("region",null),t.vertical=s.get("vertical","");let r=s.get("line","auto");"auto"===r&&-1===py.line&&(r=-1),t.line=r,t.lineAlign=s.get("lineAlign","start"),t.snapToLines=s.get("snapToLines",!0),t.size=s.get("size",100),t.align=s.get("align",fy);let o=s.get("position","auto");"auto"===o&&50===py.position&&(o="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=o}(e,t)}function gy(e){return e.replace(//gi,"\n")}class yy{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new dy,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;function i(){let e=t.buffer,i=0;for(e=gy(e);i>>0).toString()};function _y(e,t,i){return vy(e.toString())+vy(t.toString())+vy(i)}function Sy(e,t,i,s,r,o,a){const n=new yy,l=Su(new Uint8Array(e)).trim().replace(Ay,"\n").split("\n"),d=[],h=t?function(e,t=1){return mg(e,9e4,1/t)}(t.baseTime,t.timescale):0;let c,u="00:00.000",p=0,f=0,m=!0;n.oncue=function(e){const o=i[s];let a=i.ccOffset;const n=(p-h)/9e4;if(null!=o&&o.new&&(void 0!==f?a=i.ccOffset=o.start:function(e,t,i){let s=e[t],r=e[s.prevCC];if(!r||!r.new&&s.new)return e.ccOffset=e.presentationOffset=s.start,void(s.new=!1);for(;null!=(o=r)&&o.new;){var o;e.ccOffset+=s.start-r.start,s.new=!1,s=r,r=e[s.prevCC]}e.presentationOffset=i}(i,s,n)),n){if(!t)return void(c=new Error("Missing initPTS for VTT MPEGTS"));a=n-i.presentationOffset}const l=e.endTime-e.startTime,u=_g(9e4*(e.startTime+a-f),9e4*r)/9e4;e.startTime=Math.max(u,0),e.endTime=Math.max(u+l,0);const m=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(m)),e.id||(e.id=_y(e.startTime,e.endTime,m)),e.endTime>0&&d.push(e)},n.onparsingerror=function(e){c=e},n.onflush=function(){c?a(c):o(d)},l.forEach((e=>{if(m){if(by(e,"X-TIMESTAMP-MAP=")){m=!1,e.slice(16).split(",").forEach((e=>{by(e,"LOCAL:")?u=e.slice(6):by(e,"MPEGTS:")&&(p=parseInt(e.slice(7)))}));try{f=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),s=parseInt(e.slice(-9,-7)),r=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!(Sc(t)&&Sc(i)&&Sc(s)&&Sc(r)))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=6e4*s,t+=36e5*r,t}(u)/1e3}catch(e){c=e}return}""===e&&(m=!1)}n.parse(e+"\n")})),n.flush()}const Ey="stpp.ttml.im1t",wy=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Ty=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,ky={left:"start",center:"center",right:"end",start:"start",end:"end"};function Ly(e,t,i,s){const r=Mu(new Uint8Array(e),["mdat"]);if(0===r.length)return void s(new Error("Could not parse IMSC1 mdat"));const o=r.map((e=>Su(e))),a=function(e,t,i=1,s=!1){return mg(e,t,1/i,s)}(t.baseTime,1,t.timescale);try{o.forEach((e=>i(function(e,t){const i=new DOMParser,s=i.parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!s)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(r).reduce(((e,t)=>(e[t]=s.getAttribute(`ttp:${t}`)||r[t],e)),{}),a="preserve"!==s.getAttribute("xml:space"),n=Dy(Cy(s,"styling","style")),l=Dy(Cy(s,"layout","region")),d=Cy(s,"body","[begin]");return[].map.call(d,(e=>{const i=xy(e,a);if(!i||!e.hasAttribute("begin"))return null;const s=By(e.getAttribute("begin"),o),r=By(e.getAttribute("dur"),o);let d=By(e.getAttribute("end"),o);if(null===s)throw Py(e);if(null===d){if(null===r)throw Py(e);d=s+r}const h=new ly(s-t,d-t,i);h.id=_y(h.startTime,h.endTime,h.text);const c=function(e,t,i){const s="http://www.w3.org/ns/ttml#styling";let r=null;const o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;a&&i.hasOwnProperty(a)&&(r=i[a]);return o.reduce(((i,o)=>{const a=Ry(t,s,o)||Ry(e,s,o)||Ry(r,s,o);return a&&(i[o]=a),i}),{})}(l[e.getAttribute("region")],n[e.getAttribute("style")],n),{textAlign:u}=c;if(u){const e=ky[u];e&&(h.lineAlign=e),h.align=u}return _c(h,c),h})).filter((e=>null!==e))}(e,a))))}catch(e){s(e)}}function Cy(e,t,i){const s=e.getElementsByTagName(t)[0];return s?[].slice.call(s.querySelectorAll(i)):[]}function Dy(e){return e.reduce(((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e}),{})}function xy(e,t){return[].slice.call(e.childNodes).reduce(((e,i,s)=>{var r;return"br"===i.nodeName&&s?e+"\n":null!=(r=i.childNodes)&&r.length?xy(i,t):t?e+i.textContent.trim().replace(/\s+/g," "):e+i.textContent}),"")}function Ry(e,t,i){return e&&e.hasAttributeNS(t,i)?e.getAttributeNS(t,i):null}function Py(e){return new Error(`Could not parse ttml timestamp ${e}`)}function By(e,t){if(!e)return null;let i=hy(e);return null===i&&(wy.test(e)?i=function(e,t){const i=wy.exec(e),s=(0|i[4])+(0|i[5])/t.subFrameRate;return 3600*(0|i[1])+60*(0|i[2])+(0|i[3])+s/t.frameRate}(e,t):Ty.test(e)&&(i=function(e,t){const i=Ty.exec(e),s=Number(i[1]);switch(i[2]){case"h":return 3600*s;case"m":return 60*s;case"ms":return 1e3*s;case"f":return s/t.frameRate;case"t":return s/t.tickRate}return s}(e,t))),i}function Iy(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles"}function My(e,t){return!!e&&e.kind===Iy(t)&&Ug(t,e)}class Fy{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(Tc.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(Tc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Tc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Tc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Tc.BUFFER_CODECS,this.onBufferCodecs,this),e.on(Tc.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(Tc.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(Tc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Tc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Tc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Tc.BUFFER_CODECS,this.onBufferCodecs,this),e.off(Tc.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&Sc(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&Pc.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter(((t,i)=>this.isLevelAllowed(t)&&i<=e));return this.clientRect=null,Fy.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(e){}return e}isLevelAllowed(e){return!this.restrictedLevels.some((t=>e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height))}static getMaxLevelByMediaSize(e,t,i){if(null==e||!e.length)return-1;let s=e.length-1;const r=Math.max(t,i);for(let t=0;t=r||i.height>=r)&&(o=i,!(a=e[t+1])||o.width!==a.width||o.height!==a.height)){s=t;break}}var o,a;return s}}const Uy="[eme]";class Oy{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=Oy.CDMCleanupPromise?[Oy.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=Pc.debug.bind(Pc,Uy),this.log=Pc.log.bind(Pc,Uy),this.warn=Pc.warn.bind(Pc,Uy),this.error=Pc.error.bind(Pc,Uy),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(Tc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Tc.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Tc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(Tc.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(Tc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Tc.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Tc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(Tc.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,s=t[e];if(s)return s.licenseUrl;if(e===Yc.WIDEVINE&&i)return i;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(e,t,i)=>!!e&&i.indexOf(e)===t,s=t.map((e=>e.audioCodec)).filter(i),r=t.map((e=>e.videoCodec)).filter(i);return s.length+r.length===0&&r.push("avc1.42e01e"),new Promise(((t,i)=>{const o=e=>{const a=e.shift();this.getMediaKeysPromise(a,s,r).then((e=>t({keySystem:a,mediaKeys:e}))).catch((t=>{e.length?o(e):i(t instanceof Ny?t:new Ny({type:kc.KEY_SYSTEM_ERROR,details:Lc.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))}))};o(e)}))}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if("function"!=typeof i){let e=`Configured requestMediaKeySystemAccess is not a function ${i}`;return null===ou&&"http:"===self.location.protocol&&(e=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(e))}return i(e,t)}getMediaKeysPromise(e,t,i){const s=function(e,t,i,s){let r;switch(e){case Yc.FAIRPLAY:r=["cenc","sinf"];break;case Yc.WIDEVINE:case Yc.PLAYREADY:r=["cenc"];break;case Yc.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${e}`)}return function(e,t,i,s){return[{initDataTypes:e,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:t.map((e=>({contentType:`audio/mp4; codecs="${e}"`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null}))),videoCapabilities:i.map((e=>({contentType:`video/mp4; codecs="${e}"`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null})))}]}(r,t,i,s)}(e,t,i,this.config.drmSystemOptions),r=this.keySystemAccessPromises[e];let o=null==r?void 0:r.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(s)}`),o=this.requestMediaKeySystemAccess(e,s);const t=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch((t=>{this.log(`Failed to obtain access to key-system "${e}": ${t}`)})),o.then((i=>{this.log(`Access for key-system "${i.keySystem}" obtained`);const s=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),t.mediaKeys=i.createMediaKeys().then((t=>(this.log(`Media-keys created for "${e}"`),s.then((i=>i?this.setMediaKeysServerCertificate(t,e,i):t))))),t.mediaKeys.catch((t=>{this.error(`Failed to create media-keys for "${e}"}: ${t}`)})),t.mediaKeys}))}return o.then((()=>r.mediaKeys))}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${Tu(e.keyId||[])}`);const s=i.createSession(),r={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:s,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),s=this.getKeyIdString(t),r="cenc";this.keyIdToKeySessionPromise[s]=this.generateRequestWithPreferredKeySession(i,r,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw new Error("keyId is null");return Tu(e.keyId)}updateKeySession(e,t){var i;const s=e.mediaKeysSession;return this.log(`Updating key-session "${s.sessionId}" for keyID ${Tu((null==(i=e.decryptdata)?void 0:i.keyId)||[])}\n } (data length: ${t?t.byteLength:t})`),s.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise(((t,i)=>{const s=ru(this.config),r=e.map(tu).filter((e=>!!e&&-1!==s.indexOf(e)));return this.getKeySystemSelectionPromise(r).then((({keySystem:e})=>{const s=su(e);s?t(s):i(new Error(`Unable to find format for key-system "${e}"`))})).catch(i)}))}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),s=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${s}`);let r=this.keyIdToKeySessionPromise[i];return r||(r=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(t).then((({keySystem:i,mediaKeys:r})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${s}`),this.attemptSetMediaKeys(i,r).then((()=>{this.throwIfDestroyed();const e=this.createMediaKeySessionContext({keySystem:i,mediaKeys:r,decryptdata:t});return this.generateRequestWithPreferredKeySession(e,"cenc",t.pssh,"playlist-key")}))))),r.catch((e=>this.handleError(e)))),r}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Ny?this.hls.trigger(Tc.ERROR,e.data):this.hls.trigger(Tc.ERROR,{type:kc.KEY_SYSTEM_ERROR,details:Lc.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const t=tu(e.keyFormat),i=t?[t]:ru(this.config);return this.attemptKeySystemAccess(i)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=ru(this.config)),0===e.length)throw new Ny({type:kc.KEY_SYSTEM_ERROR,details:Lc.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:i}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),null===i)return;let s,r;if("sinf"===t&&this.config.drmSystems[Yc.FAIRPLAY]){const e=Du(new Uint8Array(i));try{const t=$c(JSON.parse(e).sinf),i=zu(new Uint8Array(t));if(!i)return;s=i.subarray(8,24),r=Yc.FAIRPLAY}catch(e){return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{const e=function(e){if(!(e instanceof ArrayBuffer)||e.byteLength<32)return null;const t={version:0,systemId:"",kids:null,data:null},i=new DataView(e),s=i.getUint32(0);if(e.byteLength!==s&&s>44)return null;if(1886614376!==i.getUint32(4))return null;if(t.version=i.getUint32(8)>>>24,t.version>1)return null;t.systemId=Tu(new Uint8Array(e,12,16));const r=i.getUint32(28);if(0===t.version){if(s-32this.generateRequestWithPreferredKeySession(r,t,i,"encrypted-event-key-match")));break}}l||(l=a[o]=this.getKeySystemSelectionPromise([r]).then((({keySystem:e,mediaKeys:r})=>{var a;this.throwIfDestroyed();const n=new Qu("ISO-23001-7",o,null!=(a=su(e))?a:"");return n.pssh=new Uint8Array(i),n.keyId=s,this.attemptSetMediaKeys(e,r).then((()=>{this.throwIfDestroyed();const s=this.createMediaKeySessionContext({decryptdata:n,keySystem:e,mediaKeys:r});return this.generateRequestWithPreferredKeySession(s,t,i,"encrypted-event-no-match")}))}))),l.catch((e=>this.handleError(e)))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const s=Promise.all(i).then((()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)}));return this.setMediaKeysQueue.push(s),s.then((()=>{this.log(`Media-keys set for "${e}"`),i.push(s),this.setMediaKeysQueue=this.setMediaKeysQueue.filter((e=>-1===i.indexOf(e)))}))}generateRequestWithPreferredKeySession(e,t,i,s){var r,o;const a=null==(r=this.config.drmSystems)||null==(o=r[e.keySystem])?void 0:o.generateRequest;if(a)try{const s=a.call(this.hls,t,i,e);if(!s)throw new Error("Invalid response from configured generateRequest filter");t=s.initDataType,i=e.decryptdata.pssh=s.initData?new Uint8Array(s.initData):null}catch(e){var n;if(this.warn(e.message),null!=(n=this.hls)&&n.config.debug)throw e}if(null===i)return this.log(`Skipping key-session request for "${s}" (no initData)`),Promise.resolve(e);const l=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${s}": ${l} (init data type: ${t} length: ${i?i.byteLength:null})`);const d=new Bg,h=e._onmessage=t=>{const i=e.mediaKeysSession;if(!i)return void d.emit("error",new Error("invalid state"));const{messageType:s,message:r}=t;this.log(`"${s}" message event for session "${i.sessionId}" message size: ${r.byteLength}`),"license-request"===s||"license-renewal"===s?this.renewLicense(e,r).catch((e=>{this.handleError(e),d.emit("error",e)})):"license-release"===s?e.keySystem===Yc.FAIRPLAY&&(this.updateKeySession(e,qc("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${s}"`)},c=e._onkeystatuseschange=t=>{if(!e.mediaKeysSession)return void d.emit("error",new Error("invalid state"));this.onKeyStatusChange(e);const i=e.keyStatus;d.emit("keyStatus",i),"expired"===i&&(this.warn(`${e.keySystem} expired for key ${l}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",h),e.mediaKeysSession.addEventListener("keystatuseschange",c);const u=new Promise(((e,t)=>{d.on("error",t),d.on("keyStatus",(i=>{i.startsWith("usable")?e():"output-restricted"===i?t(new Ny({type:kc.KEY_SYSTEM_ERROR,details:Lc.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):"internal-error"===i?t(new Ny({type:kc.KEY_SYSTEM_ERROR,details:Lc.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${i}"`)):"expired"===i?t(new Error("key expired while generating request")):this.warn(`unhandled key status change "${i}"`)}))}));return e.mediaKeysSession.generateRequest(t,i).then((()=>{var t;this.log(`Request generated for key-session "${null==(t=e.mediaKeysSession)?void 0:t.sessionId}" keyId: ${l}`)})).catch((e=>{throw new Ny({type:kc.KEY_SYSTEM_ERROR,details:Lc.KEY_SYSTEM_NO_SESSION,error:e,fatal:!1},`Error generating key-session request: ${e}`)})).then((()=>u)).catch((t=>{throw d.removeAllListeners(),this.removeSession(e),t})).then((()=>(d.removeAllListeners(),e)))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach(((t,i)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${Tu("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${Tu(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t}))}fetchServerCertificate(e){const t=this.config,i=new(0,t.loader)(t),s=this.getServerCertificateUrl(e);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise(((r,o)=>{const a={responseType:"arraybuffer",url:s},n=t.certLoadPolicy.default,l={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(e,t,i,s)=>{r(e.data)},onError:(t,i,r,n)=>{o(new Ny({type:kc.KEY_SYSTEM_ERROR,details:Lc.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:Ac({url:a.url,data:void 0},t)},`"${e}" certificate request failed (${s}). Status: ${t.code} (${t.text})`))},onTimeout:(t,i,r)=>{o(new Ny({type:kc.KEY_SYSTEM_ERROR,details:Lc.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:{url:a.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(e,t,i)=>{o(new Error("aborted"))}};i.load(a,l,d)}))):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise(((s,r)=>{e.setServerCertificate(i).then((r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${null==i?void 0:i.byteLength}) on "${t}"`),s(e)})).catch((e=>{r(new Ny({type:kc.KEY_SYSTEM_ERROR,details:Lc.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))}))}))}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then((t=>this.updateKeySession(e,new Uint8Array(t)).catch((e=>{throw new Ny({type:kc.KEY_SYSTEM_ERROR,details:Lc.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:e,fatal:!0},e.message)}))))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const s=(new DOMParser).parseFromString(i,"application/xml"),r=s.querySelectorAll("HttpHeader");if(r.length>0){let t;for(let i=0,s=r.length;i in key message");return qc(atob(l))}setupLicenseXHR(e,t,i,s){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then((()=>{if(!i.decryptdata)throw new Error("Key removed");return r.call(this.hls,e,t,i,s)})).catch((o=>{if(!i.decryptdata)throw o;return e.open("POST",t,!0),r.call(this.hls,e,t,i,s)})).then((i=>{e.readyState||e.open("POST",t,!0);return{xhr:e,licenseChallenge:i||s}})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:s}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise(((s,r)=>{const o=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${o}`);const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return r(new Error("invalid state"));if(4===a.readyState)if(200===a.status){this._requestLicenseFailureCount=0;let t=a.response;this.log(`License received ${t instanceof ArrayBuffer?t.byteLength:t}`);const i=this.config.licenseResponseCallback;if(i)try{t=i.call(this.hls,a,o,e)}catch(e){this.error(e)}s(t)}else{const n=i.errorRetry,l=n?n.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||a.status>=400&&a.status<500)r(new Ny({type:kc.KEY_SYSTEM_ERROR,details:Lc.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:o,data:void 0,code:a.status,text:a.statusText}},`License Request XHR failed (${o}). Status: ${a.status} (${a.statusText})`));else{const i=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${i} attempts left`),this.requestLicense(e,t).then(s,r)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then((({xhr:t,licenseChallenge:i})=>{e.keySystem==Yc.PLAYREADY&&(i=this.unpackPlayReadyKeyMessage(t,i)),t.send(i)}))}))}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Qu.clearKeyUriToKeyIdMap();const i=t.length;Oy.CDMCleanupPromise=Promise.all(t.map((e=>this.removeSession(e))).concat(null==e?void 0:e.setMediaKeys(null).catch((e=>{this.log(`Could not clear media keys: ${e}`)})))).then((()=>{i&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)})).catch((e=>{this.log(`Could not close sessions and clear media keys: ${e}`)}))}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(t&&this.config.emeEnabled&&!this.keyFormatPromise){const e=t.reduce(((e,t)=>(-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e)),[]);this.log(`Selecting key-system from session-keys ${e.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(e)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const s=this.mediaKeySessions.indexOf(e);return s>-1&&this.mediaKeySessions.splice(s,1),t.remove().catch((e=>{this.log(`Could not remove session: ${e}`)})).then((()=>t.close())).catch((e=>{this.log(`Could not close session: ${e}`)}))}}}Oy.CDMCleanupPromise=void 0;class Ny extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}var jy,Gy,zy;!function(e){e.MANIFEST="m",e.AUDIO="a",e.VIDEO="v",e.MUXED="av",e.INIT="i",e.CAPTION="c",e.TIMED_TEXT="tt",e.KEY="k",e.OTHER="o"}(jy||(jy={})),function(e){e.DASH="d",e.HLS="h",e.SMOOTH="s",e.OTHER="o"}(Gy||(Gy={})),function(e){e.OBJECT="CMCD-Object",e.REQUEST="CMCD-Request",e.SESSION="CMCD-Session",e.STATUS="CMCD-Status"}(zy||(zy={}));const Wy={[zy.OBJECT]:["br","d","ot","tb"],[zy.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[zy.SESSION]:["cid","pr","sf","sid","st","v"],[zy.STATUS]:["bs","rtp"]};class Vy{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map((e=>e instanceof Vy?e:new Vy(e)))),this.value=e,this.params=t}}class Hy{constructor(e){this.description=void 0,this.description=e}}function $y(e,t,i,s){return new Error(`failed to ${e} "${r=t,Array.isArray(r)?JSON.stringify(r):r instanceof Map?"Map{}":r instanceof Set?"Set{}":"object"==typeof r?JSON.stringify(r):String(r)}" as ${i}`,{cause:s});var r}const Jy="Bare Item";const qy=/[\x00-\x1f\x7f]+/;function Ky(e,t,i){return $y("serialize",e,t,i)}function Yy(e){if(!1===ArrayBuffer.isView(e))throw Ky(e,"Byte Sequence");return`:${t=e,btoa(String.fromCharCode(...t))}:`;var t}function Qy(e){if(function(e){return e<-999999999999999||99999999999999912)throw Ky(e,"Decimal");const i=t.toString();return i.includes(".")?i:`${i}.0`}function eA(e){const t=(i=e).description||i.toString().slice(7,-1);var i;if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t))throw Ky(t,"Token");return t}function tA(e){switch(typeof e){case"number":if(!Sc(e))throw Ky(e,Jy);return Number.isInteger(e)?Qy(e):Zy(e);case"string":return function(e){if(qy.test(e))throw Ky(e,"String");return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}(e);case"symbol":return eA(e);case"boolean":return function(e){if("boolean"!=typeof e)throw Ky(e,"Boolean");return e?"?1":"?0"}(e);case"object":if(e instanceof Date)return function(e){return`@${Qy(e.getTime()/1e3)}`}(e);if(e instanceof Uint8Array)return Yy(e);if(e instanceof Hy)return eA(e);default:throw Ky(e,Jy)}}function iA(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw Ky(e,"Key");return e}function sA(e){return null==e?"":Object.entries(e).map((([e,t])=>!0===t?`;${iA(e)}`:`;${iA(e)}=${tA(t)}`)).join("")}function rA(e){return e instanceof Vy?`${tA(e.value)}${sA(e.params)}`:tA(e)}function oA(e,t={whitespace:!0}){if("object"!=typeof e)throw Ky(e,"Dict");const i=e instanceof Map?e.entries():Object.entries(e),s=null!=t&&t.whitespace?" ":"";return Array.from(i).map((([e,t])=>{t instanceof Vy==!1&&(t=new Vy(t));let i=iA(e);var s;return!0===t.value?i+=sA(t.params):(i+="=",Array.isArray(t.value)?i+=`(${(s=t).value.map(rA).join(" ")})${sA(s.params)}`:i+=rA(t)),i})).join(`,${s}`)}const aA=e=>Math.round(e),nA=e=>100*aA(e/100),lA={br:aA,d:aA,bl:nA,dl:nA,mtp:nA,nor:(e,t)=>(null!=t&&t.baseUrl&&(e=function(e,t){const i=new URL(e),s=new URL(t);if(i.origin!==s.origin)return e;const r=i.pathname.split("/").slice(1),o=s.pathname.split("/").slice(1,-1);for(;r[0]===o[0];)r.shift(),o.shift();for(;o.length;)o.shift(),r.unshift("..");return r.join("/")}(e,t.baseUrl)),encodeURIComponent(e)),rtp:nA,tb:aA};function dA(e,t){const i={};if(null==e||"object"!=typeof e)return i;const s=Object.keys(e).sort(),r=_c({},lA,null==t?void 0:t.formatters),o=null==t?void 0:t.filter;return s.forEach((s=>{if(null!=o&&o(s))return;let a=e[s];const n=r[s];n&&(a=n(a,t)),"v"===s&&1===a||"pr"==s&&1===a||(e=>"number"==typeof e?Sc(e):null!=e&&""!==e&&!1!==e)(a)&&((e=>"ot"===e||"sf"===e||"st"===e)(s)&&"string"==typeof a&&(a=new Hy(a)),i[s]=a)})),i}function hA(e,t={}){return e?function(e,t){return oA(e,t)}(dA(e,t),_c({whitespace:!1},t)):""}function cA(e,t,i){return _c(e,function(e,t={}){if(!e)return{};const i=Object.entries(e),s=Object.entries(Wy).concat(Object.entries((null==t?void 0:t.customHeaderMap)||{})),r=i.reduce(((e,t)=>{var i;const[r,o]=t,a=(null==(i=s.find((e=>e[1].includes(r))))?void 0:i[0])||zy.REQUEST;return null!=e[a]||(e[a]={}),e[a][r]=o,e}),{});return Object.entries(r).reduce(((e,[i,s])=>(e[i]=hA(s,t),e)),{})}(t,i))}const uA=/CMCD=[^&#]+/;function pA(e,t,i){const s=function(e,t={}){if(!e)return"";const i=hA(e,t);return`CMCD=${encodeURIComponent(i)}`}(t,i);if(!s)return e;if(uA.test(e))return e.replace(uA,s);const r=e.includes("?")?"&":"?";return`${e}${r}${s}`}function fA(e,t,i,s){e&&Object.keys(t).forEach((r=>{const o=e.filter((e=>e.groupId===r)).map((e=>{const o=_c({},e);return o.details=void 0,o.attrs=new Mc(o.attrs),o.url=o.attrs.URI=mA(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",i),o.groupId=o.attrs["GROUP-ID"]=t[r],o.attrs["PATHWAY-ID"]=s,o}));e.push(...o)}))}function mA(e,t,i,s){const{HOST:r,PARAMS:o,[i]:a}=s;let n;t&&(n=null==a?void 0:a[t],n&&(e=n));const l=new self.URL(e);return r&&!n&&(l.host=r),o&&Object.keys(o).sort().forEach((e=>{e&&l.searchParams.set(e,o[e])})),l.href}const gA=/^age:\s*[\d.]+\s*$/im;class yA{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new Oc,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then((()=>{if(this.loader===i&&!this.stats.aborted)return r(i,t.url)})).catch((e=>{if(this.loader===i&&!this.stats.aborted)return i.open("GET",t.url,!0),r(i,t.url)})).then((()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)})).catch((e=>{this.callbacks.onError({code:i.status,text:e.message},t,i,s)})):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const s=t.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:o}=i.loadPolicy;if(s)for(const t in s)e.setRequestHeader(t,s[t]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=r&&Sc(r)?r:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const s=t.readyState,r=this.config;if(!i.aborted&&s>=2&&(0===i.loading.first&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),4===s)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const s=t.status,o="text"!==t.responseType;if(s>=200&&s<300&&(o&&t.response||null!==t.responseText)){i.loading.end=Math.max(self.performance.now(),i.loading.first);const r=o?t.response:t.responseText,a="arraybuffer"===t.responseType?r.byteLength:r.length;if(i.loaded=i.total=a,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first),!this.callbacks)return;const n=this.callbacks.onProgress;if(n&&n(i,e,r,t),!this.callbacks)return;const l={url:t.responseURL,data:r,code:s};this.callbacks.onSuccess(l,i,e,t)}else{const o=r.loadPolicy.errorRetry;vf(o,i.retry,!1,{url:e.url,data:void 0,code:s})?this.retry(o):(Pc.error(`${s} while loading ${e.url}`),this.callbacks.onError({code:s,text:t.statusText},e,t,i))}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry;if(vf(e,this.stats.retry,!0))this.retry(e);else{var t;Pc.warn(`timeout while loading ${null==(t=this.context)?void 0:t.url}`);const e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=Af(e,i.retry),i.retry++,Pc.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${null==t?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&gA.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const AA=/(\d+)-(\d+)\/(\d+)/;class bA{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||vA,this.controller=new self.AbortController,this.stats=new Oc}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();const r=function(e,t){const i={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(_c({},e.headers))};e.rangeEnd&&i.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1));return i}(e,this.controller.signal),o=i.onProgress,a="arraybuffer"===e.responseType,n=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:d}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),t.timeout=l&&Sc(l)?l:d,this.requestTimeout=self.setTimeout((()=>{this.abortInternal(),i.onTimeout(s,e,this.response)}),t.timeout),self.fetch(this.request).then((r=>{this.response=this.loader=r;const n=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=d,this.requestTimeout=self.setTimeout((()=>{this.abortInternal(),i.onTimeout(s,e,this.response)}),d-(n-s.loading.start)),!r.ok){const{status:e,statusText:t}=r;throw new _A(t||"fetch, bad network response",e,r)}return s.loading.first=n,s.total=function(e){const t=e.get("Content-Range");if(t){const e=function(e){const t=AA.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}(t);if(Sc(e))return e}const i=e.get("Content-Length");if(i)return parseInt(i)}(r.headers)||s.total,o&&Sc(t.highWaterMark)?this.loadProgressively(r,s,e,t.highWaterMark,o):a?r.arrayBuffer():"json"===e.responseType?r.json():r.text()})).then((r=>{const a=this.response;if(!a)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);const l=r[n];l&&(s.loaded=s.total=l);const d={url:a.url,data:r,code:a.status};o&&!Sc(t.highWaterMark)&&o(s,e,r,a),i.onSuccess(d,s,e,a)})).catch((t=>{if(self.clearTimeout(this.requestTimeout),s.aborted)return;const r=t&&t.code||0,o=t?t.message:null;i.onError({code:r,text:o},e,t?t.details:null,s)}))}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,s=0,r){const o=new Dm,a=e.body.getReader(),n=()=>a.read().then((a=>{if(a.done)return o.dataLength&&r(t,i,o.flush(),e),Promise.resolve(new ArrayBuffer(0));const l=a.value,d=l.length;return t.loaded+=d,d=s&&r(t,i,o.flush(),e)):r(t,i,l,e),n()})).catch((()=>Promise.reject()));return n()}}function vA(e,t){return new self.Request(e.url,t)}class _A extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const SA=/\s/,EA={newCue(e,t,i,s){const r=[];let o,a,n,l,d;const h=self.VTTCue||self.TextTrackCue;for(let u=0;u=16?l--:l++;const s=gy(d.trim()),p=_y(t,i,s);null!=e&&null!=(c=e.cues)&&c.getCueById(p)||(a=new h(t,i,s),a.id=p,a.line=u+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*l/32)),r.push(a))}return e&&r.length&&(r.sort(((e,t)=>"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line)),r.forEach((t=>Np(e,t)))),r}},wA=Ac(Ac({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:yA,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:e,partCurrent:t,hls:i}=this,{autoLevelEnabled:s,media:r}=i;if(!e||!r)return;const o=performance.now(),a=t?t.stats:e.stats,n=t?t.duration:e.duration,l=o-a.loading.start,d=i.minAutoLevel;if(a.aborted||a.loaded&&a.loaded===a.total||e.level<=d)return this.clearTimer(),void(this._nextAutoLevel=-1);if(!s||r.paused||!r.playbackRate||!r.readyState)return;const h=i.mainForwardBufferInfo;if(null===h)return;const c=this.bwEstimator.getEstimateTTFB(),u=Math.abs(r.playbackRate);if(l<=Math.max(c,n/(2*u)*1e3))return;const p=h.len/u,f=a.loading.first?a.loading.first-a.loading.start:-1,m=a.loaded&&f>-1,g=this.getBwEstimate(),y=i.levels,A=y[e.level],b=a.total||Math.max(a.loaded,Math.round(n*A.averageBitrate/8));let v=m?l-f:l;v<1&&m&&(v=Math.min(l,8*a.loaded/g));const _=m?1e3*a.loaded/v:0,S=_?(b-a.loaded)/_:8*b/g+c/1e3;if(S<=p)return;const E=_?8*_:g;let w,T=Number.POSITIVE_INFINITY;for(w=e.level-1;w>d;w--){const e=y[w].maxBitrate;if(T=this.getTimeToLoadFrag(c/1e3,E,n*e,!y[w].details),T=S)return;if(T>10*n)return;i.nextLoadLevel=i.nextAutoLevel=w,m?this.bwEstimator.sample(l-Math.min(c,f),a.loaded):this.bwEstimator.sampleTTFB(l);const k=y[w].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>k&&this.resetEstimator(k),this.clearTimer(),Pc.warn(`[abr] Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} is loading too slowly;\n Time to underbuffer: ${p.toFixed(3)} s\n Estimated load time for current fragment: ${S.toFixed(3)} s\n Estimated load time for down switch fragment: ${T.toFixed(3)} s\n TTFB estimate: ${0|f} ms\n Current BW estimate: ${Sc(g)?0|g:"Unknown"} bps\n New BW estimate: ${0|this.getBwEstimate()} bps\n Switching to level ${w} @ ${0|k} bps`),i.trigger(Tc.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:a})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(Pc.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new If(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tc.FRAG_LOADING,this.onFragLoading,this),e.on(Tc.FRAG_LOADED,this.onFragLoaded,this),e.on(Tc.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Tc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Tc.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Tc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Tc.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(Tc.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tc.FRAG_LOADING,this.onFragLoading,this),e.off(Tc.FRAG_LOADED,this.onFragLoaded,this),e.off(Tc.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Tc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Tc.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Tc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Tc.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(Tc.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){var s;if(!i.bitrateTest)this.fragCurrent=i,this.partCurrent=null!=(s=t.part)?s:null;this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case Lc.BUFFER_ADD_CODEC_ERROR:case Lc.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case Lc.FRAG_LOAD_TIMEOUT:{const e=t.frag,{fragCurrent:i,partCurrent:s}=this;if(e&&i&&e.sn===i.sn&&e.level===i.level){const t=performance.now(),i=s?s.stats:e.stats,r=t-i.loading.start,o=i.loading.first?i.loading.first-i.loading.start:-1;if(i.loaded&&o>-1){const e=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(r-Math.min(e,o),i.loaded)}else this.bwEstimator.sampleTTFB(r)}break}}}getTimeToLoadFrag(e,t,i,s){return e+i/t+(s?this.lastLevelLoadSec:0)}onLevelLoaded(e,t){const i=this.hls.config,{loading:s}=t.stats,r=s.end-s.start;Sc(r)&&(this.lastLevelLoadSec=r/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:i}){const s=i?i.stats:t.stats;if(t.type===Pp&&this.bwEstimator.sampleTTFB(s.loading.first-s.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const e=i?i.duration:t.duration,r=this.hls.levels[t.level],o=(r.loaded?r.loaded.bytes:0)+s.loaded,a=(r.loaded?r.loaded.duration:0)+e;r.loaded={bytes:o,duration:a},r.realBitrate=Math.round(8*o/a)}if(t.bitrateTest){const e={stats:s,frag:t,part:i,id:t.type};this.onFragBuffered(Tc.FRAG_BUFFERED,e),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:s}=t,r=null!=s&&s.stats.loaded?s.stats:i.stats;if(r.aborted)return;if(this.ignoreFragment(i))return;const o=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,r.loaded),r.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Pp||"initSegment"===e.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),s=this.hls.config.maxStarvationDelay,r=this.findBestLevel(i,t,e,0,s,1,1);if(r>-1)return r;const o=this.hls.firstLevel,a=Math.min(Math.max(o,t),e);return Pc.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${o} clamped to ${a}`),a}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(!(-1===e||t&&i&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return e;const s=t&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){const t=this.hls.levels;if(t.length>Math.max(e,s)&&t[e].loadError<=t[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this,{maxAutoLevel:s,config:r,minAutoLevel:o}=i,a=t?t.duration:e?e.duration:0,n=this.getBwEstimate(),l=this.getStarvationDelay();let d=r.abrBandWidthFactor,h=r.abrBandWidthUpFactor;if(l){const e=this.findBestLevel(n,o,s,l,0,d,h);if(e>=0)return e}let c=a?Math.min(a,r.maxStarvationDelay):r.maxStarvationDelay;if(!l){const e=this.bitrateTestDelay;if(e){c=(a?Math.min(a,r.maxLoadingDelay):r.maxLoadingDelay)-e,Pc.info(`[abr] bitrate test took ${Math.round(1e3*e)}ms, set first fragment max fetchDuration to ${Math.round(1e3*c)} ms`),d=h=1}}const u=this.findBestLevel(n,o,s,l,c,d,h);if(Pc.info(`[abr] ${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${u}`),u>-1)return u;const p=i.levels[o],f=i.levels[i.loadLevel];return(null==p?void 0:p.bitrate)<(null==f?void 0:f.bitrate)?o:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,s=e.mainForwardBufferInfo;return(s?s.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,s,r,o,a){var n;const l=s+r,d=this.lastLoadedFragLevel,h=-1===d?this.hls.firstLevel:d,{fragCurrent:c,partCurrent:u}=this,{levels:p,allAudioTracks:f,loadLevel:m,config:g}=this.hls;if(1===p.length)return 0;const y=p[h],A=!(null==y||null==(n=y.details)||!n.live),b=-1===m||-1===d;let v,_="SDR",S=(null==y?void 0:y.frameRate)||0;const{audioPreference:E,videoPreference:w}=g,T=this.audioTracksByGroup||(this.audioTracksByGroup=function(e){return e.reduce(((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const s=t.channels||"2";return i.channels[s]=(i.channels[s]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}(f));if(b){if(-1!==this.firstSelection)return this.firstSelection;const s=this.codecTiers||(this.codecTiers=function(e,t,i,s){return e.slice(i,s+1).reduce(((e,i)=>{if(!i.codecSet)return e;const s=i.audioGroups;let r=e[i.codecSet];r||(e[i.codecSet]=r={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!s,fragmentError:0}),r.minBitrate=Math.min(r.minBitrate,i.bitrate);const o=Math.min(i.height,i.width);return r.minHeight=Math.min(r.minHeight,o),r.minFramerate=Math.min(r.minFramerate,i.frameRate),r.maxScore=Math.max(r.maxScore,i.score),r.fragmentError+=i.fragmentError,r.videoRanges[i.videoRange]=(r.videoRanges[i.videoRange]||0)+1,s&&s.forEach((e=>{if(!e)return;const i=t.groups[e];i&&(r.hasDefaultAudio=r.hasDefaultAudio||t.hasDefaultAudio?i.hasDefault:i.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(i.channels).forEach((e=>{r.channels[e]=(r.channels[e]||0)+i.channels[e]})))})),e}),{})}(p,T,t,i)),r=function(e,t,i,s,r){const o=Object.keys(e),a=null==s?void 0:s.channels,n=null==s?void 0:s.audioCodec,l=a&&2===parseInt(a);let d=!0,h=!1,c=1/0,u=1/0,p=1/0,f=0,m=[];const{preferHDR:g,allowedVideoRanges:y}=Nf(t,r);for(let t=o.length;t--;){const i=e[o[t]];d=i.channels[2]>0,c=Math.min(c,i.minHeight),u=Math.min(u,i.minFramerate),p=Math.min(p,i.minBitrate);const s=y.filter((e=>i.videoRanges[e]>0));s.length>0&&(h=!0,m=s)}c=Sc(c)?c:0,u=Sc(u)?u:0;const A=Math.max(1080,c),b=Math.max(30,u);p=Sc(p)?p:i,i=Math.max(p,i),h||(t=void 0,m=[]);const v=o.reduce(((t,s)=>{const r=e[s];if(s===t)return t;if(r.minBitrate>i)return jf(s,`min bitrate of ${r.minBitrate} > current estimate of ${i}`),t;if(!r.hasDefaultAudio)return jf(s,"no renditions with default or auto-select sound found"),t;if(n&&s.indexOf(n.substring(0,4))%5!=0)return jf(s,`audio codec preference "${n}" not found`),t;if(a&&!l){if(!r.channels[a])return jf(s,`no renditions with ${a} channel sound found (channels options: ${Object.keys(r.channels)})`),t}else if((!n||l)&&d&&0===r.channels[2])return jf(s,"no renditions with stereo sound found"),t;return r.minHeight>A?(jf(s,`min resolution of ${r.minHeight} > maximum of ${A}`),t):r.minFramerate>b?(jf(s,`min framerate of ${r.minFramerate} > maximum of ${b}`),t):m.some((e=>r.videoRanges[e]>0))?r.maxScore=hp(t)||r.fragmentError>e[t].fragmentError)?t:(f=r.maxScore,s):(jf(s,`no variants with VIDEO-RANGE of ${JSON.stringify(m)} found`),t)}),void 0);return{codecSet:v,videoRanges:m,preferHDR:g,minFramerate:u,minBitrate:p}}(s,_,e,E,w),{codecSet:o,videoRanges:a,minFramerate:n,minBitrate:l,preferHDR:d}=r;v=o,_=d?a[a.length-1]:a[0],S=n,e=Math.max(e,l),Pc.log(`[abr] picked start tier ${JSON.stringify(r)}`)}else v=null==y?void 0:y.codecSet,_=null==y?void 0:y.videoRange;const k=u?u.duration:c?c.duration:0,L=this.bwEstimator.getEstimateTTFB()/1e3,C=[];for(let n=i;n>=t;n--){var D;const t=p[n],c=n>h;if(!t)continue;if(g.useMediaCapabilities&&!t.supportedResult&&!t.supportedPromise){const i=navigator.mediaCapabilities;"function"==typeof(null==i?void 0:i.decodingInfo)&&Uf(t,T,_,S,e,E)?(t.supportedPromise=Of(t,T,i),t.supportedPromise.then((e=>{if(!this.hls)return;t.supportedResult=e;const i=this.hls.levels,s=i.indexOf(t);e.error?Pc.warn(`[abr] MediaCapabilities decodingInfo error: "${e.error}" for level ${s} ${JSON.stringify(e)}`):e.supported||(Pc.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${s} ${JSON.stringify(e)}`),s>-1&&i.length>1&&(Pc.log(`[abr] Removing unsupported level ${s}`),this.hls.removeLevel(s)))}))):t.supportedResult=Mf}if(v&&t.codecSet!==v||_&&t.videoRange!==_||c&&S>t.frameRate||!c&&S>0&&S=2*k&&0===r?p[n].averageBitrate:p[n].maxBitrate,P=this.getTimeToLoadFrag(L,x,R*w,void 0===f);if(x>=R&&(n===d||0===t.loadError&&0===t.fragmentError)&&(P<=L||!Sc(P)||A&&!this.bitrateTestDelay||P${n} adjustedbw(${Math.round(x)})-bitrate=${Math.round(x-R)} ttfb:${L.toFixed(1)} avgDuration:${w.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${P.toFixed(1)} firstSelection:${b} codecSet:${v} videoRange:${_} hls.loadLevel:${m}`)),b&&(this.firstSelection=n),n}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls,s=Math.min(Math.max(e,i),t);this._nextAutoLevel!==s&&(this.nextAutoLevelKey="",this._nextAutoLevel=s)}},bufferController:class{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=e=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=e=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:e,mediaSource:t}=this;this.log("Media source opened"),e&&(e.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(Tc.MEDIA_ATTACHED,{media:e,mediaSource:t})),t&&t.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:e,_objectUrl:t}=this;e!==t&&Pc.error(`Media element src was set while attaching MediaSource (${t} > ${e})`)},this.hls=e;const t="[buffer-controller]";var i;this.appendSource=(i=rp(e.config.preferManagedMediaSource),"undefined"!=typeof self&&i===self.ManagedMediaSource),this.log=Pc.log.bind(Pc,t),this.warn=Pc.warn.bind(Pc,t),this.error=Pc.error.bind(Pc,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(Tc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Tc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Tc.BUFFER_RESET,this.onBufferReset,this),e.on(Tc.BUFFER_APPENDING,this.onBufferAppending,this),e.on(Tc.BUFFER_CODECS,this.onBufferCodecs,this),e.on(Tc.BUFFER_EOS,this.onBufferEos,this),e.on(Tc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Tc.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Tc.FRAG_PARSED,this.onFragParsed,this),e.on(Tc.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(Tc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Tc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Tc.BUFFER_RESET,this.onBufferReset,this),e.off(Tc.BUFFER_APPENDING,this.onBufferAppending,this),e.off(Tc.BUFFER_CODECS,this.onBufferCodecs,this),e.off(Tc.BUFFER_EOS,this.onBufferEos,this),e.off(Tc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Tc.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Tc.FRAG_PARSED,this.onFragParsed,this),e.off(Tc.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new Ng(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const i=this.media=t.media,s=rp(this.appendSource);if(i&&s){var r;const e=this.mediaSource=new s;this.log(`created media source: ${null==(r=e.constructor)?void 0:r.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming));const t=this._objectUrl=self.URL.createObjectURL(e);if(this.appendSource)try{i.removeAttribute("src");const s=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||s&&e instanceof s,Gg(i),function(e,t){const i=self.document.createElement("source");i.type="video/mp4",i.src=t,e.appendChild(i)}(i,t),i.load()}catch(e){i.src=t}else i.src=t;i.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:i}=this;if(t){if(this.log("media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){this.warn(`onMediaDetaching: ${e.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),this.mediaSrc===i?(e.removeAttribute("src"),this.appendSource&&Gg(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(Tc.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach((e=>{this.resetBuffer(e)})),this._initSourceBuffer()}resetBuffer(e){const t=this.sourceBuffer[e];try{var i;if(t)this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,null!=(i=this.mediaSource)&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}catch(t){this.warn(`onBufferReset ${e}`,t)}}onBufferCodecs(e,t){const i=this.getSourceBufferTypes().length,s=Object.keys(t);if(s.forEach((e=>{if(i){const i=this.tracks[e];if(i&&"function"==typeof i.buffer.changeType){var s;const{id:r,codec:o,levelCodec:a,container:n,metadata:l}=t[e],d=fp(i.codec,i.levelCodec),h=null==d?void 0:d.replace(jg,"$1");let c=fp(o,a);const u=null==(s=c)?void 0:s.replace(jg,"$1");if(c&&h!==u){"audio"===e.slice(0,5)&&(c=pp(c,this.appendSource));const t=`${n};codecs=${c}`;this.appendChangeType(e,t),this.log(`switching codec ${d} to ${c}`),this.tracks[e]={buffer:i.buffer,codec:o,container:n,levelCodec:a,metadata:l,id:r}}}}else this.pendingTracks[e]=t[e]})),i)return;const r=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==r&&(this.log(`${r} bufferCodec event(s) expected ${s.join(",")}`),this.bufferCodecEventsExpected=r),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:i}=this,s={execute:()=>{const s=this.sourceBuffer[e];s&&(this.log(`changing ${e} sourceBuffer type to ${t}`),s.changeType(t)),i.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:t=>{this.warn(`Failed to change ${e} SourceBuffer type`,t)}};i.append(s,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:i,operationQueue:s,tracks:r}=this,{data:o,type:a,frag:n,part:l,chunkMeta:d}=t,h=d.buffering[a],c=self.performance.now();h.start=c;const u=n.stats.buffering,p=l?l.stats.buffering:null;0===u.start&&(u.start=c),p&&0===p.start&&(p.start=c);const f=r.audio;let m=!1;"audio"===a&&"audio/mpeg"===(null==f?void 0:f.container)&&(m=!this.lastMpegAudioChunk||1===d.id||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const g=n.start,y={execute:()=>{if(h.executeStart=self.performance.now(),m){const e=this.sourceBuffer[a];if(e){const t=g-e.timestampOffset;Math.abs(t)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${g} (delta: ${t}) sn: ${n.sn})`),e.timestampOffset=g)}}this.appendExecutor(o,a)},onStart:()=>{},onComplete:()=>{const e=self.performance.now();h.executeEnd=h.end=e,0===u.first&&(u.first=e),p&&0===p.first&&(p.first=e);const{sourceBuffer:t}=this,i={};for(const e in t)i[e]=Zf.getBuffered(t[e]);this.appendErrors[a]=0,"audio"===a||"video"===a?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(Tc.BUFFER_APPENDED,{type:a,frag:n,part:l,chunkMeta:d,parent:n.type,timeRanges:i})},onError:e=>{const t={type:kc.MEDIA_ERROR,parent:n.type,details:Lc.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:n,part:l,chunkMeta:d,error:e,err:e,fatal:!1};if(e.code===DOMException.QUOTA_EXCEEDED_ERR)t.details=Lc.BUFFER_FULL_ERROR;else{const e=++this.appendErrors[a];t.details=Lc.BUFFER_APPEND_ERROR,this.warn(`Failed ${e}/${i.config.appendErrorMaxRetry} times to append segment in "${a}" sourceBuffer`),e>=i.config.appendErrorMaxRetry&&(t.fatal=!0)}i.trigger(Tc.ERROR,t)}};s.append(y,a,!!this.pendingTracks[a])}onBufferFlushing(e,t){const{operationQueue:i}=this,s=e=>({execute:this.removeExecutor.bind(this,e,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(Tc.BUFFER_FLUSHED,{type:e})},onError:t=>{this.warn(`Failed to remove from ${e} SourceBuffer`,t)}});t.type?i.append(s(t.type),t.type):this.getSourceBufferTypes().forEach((e=>{i.append(s(e),e)}))}onFragParsed(e,t){const{frag:i,part:s}=t,r=[],o=s?s.elementaryStreams:i.elementaryStreams;o[Gc]?r.push("audiovideo"):(o[Nc]&&r.push("audio"),o[jc]&&r.push("video"));0===r.length&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers((()=>{const e=self.performance.now();i.stats.buffering.end=e,s&&(s.stats.buffering.end=e);const t=s?s.stats:i.stats;this.hls.trigger(Tc.FRAG_BUFFERED,{frag:i,part:s,stats:t,id:i.type})}),r)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce(((e,i)=>{const s=this.sourceBuffer[i];return!s||t.type&&t.type!==i||(s.ending=!0,s.ended||(s.ended=!0,this.log(`${i} sourceBuffer now EOS`))),e&&!(s&&!s.ended)}),!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers((()=>{this.getSourceBufferTypes().forEach((e=>{const t=this.sourceBuffer[e];t&&(t.ending=!1)}));const{mediaSource:e}=this;e&&"open"===e.readyState?(this.log("Calling mediaSource.endOfStream()"),e.endOfStream()):e&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${e.readyState}`)})))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||null===t)return;if(!this.getSourceBufferTypes().length)return;const s=e.config,r=i.currentTime,o=t.levelTargetDuration,a=t.live&&null!==s.liveBackBufferLength?s.liveBackBufferLength:s.backBufferLength;if(Sc(a)&&a>0){const e=Math.max(a,o),t=Math.floor(r/o)*o-e;this.flushBackBuffer(r,o,t)}if(Sc(s.frontBufferFlushThreshold)&&s.frontBufferFlushThreshold>0){const e=Math.max(s.maxBufferLength,s.frontBufferFlushThreshold),t=Math.max(e,o),i=Math.floor(r/o)*o+t;this.flushFrontBuffer(r,o,i)}}flushBackBuffer(e,t,i){const{details:s,sourceBuffer:r}=this;this.getSourceBufferTypes().forEach((o=>{const a=r[o];if(a){const r=Zf.getBuffered(a);if(r.length>0&&i>r.start(0)){if(this.hls.trigger(Tc.BACK_BUFFER_REACHED,{bufferEnd:i}),null!=s&&s.live)this.hls.trigger(Tc.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(a.ended&&r.end(r.length-1)-e<2*t)return void this.log(`Cannot flush ${o} back buffer while SourceBuffer is in ended state`);this.hls.trigger(Tc.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:o})}}}))}flushFrontBuffer(e,t,i){const{sourceBuffer:s}=this;this.getSourceBufferTypes().forEach((r=>{const o=s[r];if(o){const s=Zf.getBuffered(o),a=s.length;if(a<2)return;const n=s.start(a-1),l=s.end(a-1);if(i>n||e>=n&&e<=l)return;if(o.ended&&e-l<2*t)return void this.log(`Cannot flush ${r} front buffer while SourceBuffer is in ended state`);this.hls.trigger(Tc.BUFFER_FLUSHING,{startOffset:n,endOffset:1/0,type:r})}}))}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||"open"!==this.mediaSource.readyState)return;const{details:e,hls:t,media:i,mediaSource:s}=this,r=e.fragments[0].start+e.totalduration,o=i.duration,a=Sc(s.duration)?s.duration:0;e.live&&t.config.liveDurationInfinity?(s.duration=1/0,this.updateSeekableRange(e)):(r>a&&r>o||!Sc(o))&&(this.log(`Updating Media Source duration to ${r.toFixed(3)}`),s.duration=r)}updateSeekableRange(e){const t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&null!=t&&t.setLiveSeekableRange){const s=Math.max(0,i[0].start),r=Math.max(s,s+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${s}-${r}.`),t.setLiveSeekableRange(s,r)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:i}=this,s=Object.keys(i).length;if(s&&(!e||2===s||"audiovideo"in i)){this.createSourceBuffers(i),this.pendingTracks={};const e=this.getSourceBufferTypes();if(e.length)this.hls.trigger(Tc.BUFFER_CREATED,{tracks:this.tracks}),e.forEach((e=>{t.executeNext(e)}));else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(Tc.ERROR,{type:kc.MEDIA_ERROR,details:Lc.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(const r in e)if(!t[r]){var s;const o=e[r];if(!o)throw Error(`source buffer exists for track ${r}, however track does not`);let a=-1===(null==(s=o.levelCodec)?void 0:s.indexOf(","))?o.levelCodec:o.codec;a&&"audio"===r.slice(0,5)&&(a=pp(a,this.appendSource));const n=`${o.container};codecs=${a}`;this.log(`creating sourceBuffer(${n})`);try{const e=t[r]=i.addSourceBuffer(n),s=r;this.addBufferListener(s,"updatestart",this._onSBUpdateStart),this.addBufferListener(s,"updateend",this._onSBUpdateEnd),this.addBufferListener(s,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(s,"bufferedchange",((e,t)=>{const i=t.removedRanges;null!=i&&i.length&&this.hls.trigger(Tc.BUFFER_FLUSHED,{type:r})})),this.tracks[r]={buffer:e,codec:a,container:o.container,levelCodec:o.levelCodec,metadata:o.metadata,id:o.id}}catch(e){this.error(`error while trying to add sourceBuffer: ${e.message}`),this.hls.trigger(Tc.ERROR,{type:kc.MEDIA_ERROR,details:Lc.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:r,mimeType:n})}}}get mediaSrc(){var e;const t=(null==(e=this.media)?void 0:e.firstChild)||this.media;return null==t?void 0:t.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if("closed"===(null==(t=this.mediaSource)?void 0:t.readyState))return void this.resetBuffer(e);const{operationQueue:i}=this;i.current(e).onComplete(),i.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var i;const s=new Error(`${e} SourceBuffer error. MediaSource readyState: ${null==(i=this.mediaSource)?void 0:i.readyState}`);this.error(`${s}`,t),this.hls.trigger(Tc.ERROR,{type:kc.MEDIA_ERROR,details:Lc.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:s,fatal:!1});const r=this.operationQueue.current(e);r&&r.onError(s)}removeExecutor(e,t,i){const{media:s,mediaSource:r,operationQueue:o,sourceBuffer:a}=this,n=a[e];if(!s||!r||!n)return this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),void o.shiftAndExecuteNext(e);const l=Sc(s.duration)?s.duration:1/0,d=Sc(r.duration)?r.duration:1/0,h=Math.max(0,t),c=Math.min(i,l,d);c>h&&(!n.ending||n.ended)?(n.ended=!1,this.log(`Removing [${h},${c}] from the ${e} SourceBuffer`),n.remove(h,c)):o.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.sourceBuffer[t];if(i)i.ended=!1,i.appendBuffer(e);else if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);const{operationQueue:i}=this,s=t.map((e=>i.appendBlocker(e)));Promise.all(s).then((()=>{e(),t.forEach((e=>{const t=this.sourceBuffer[e];null!=t&&t.updating||i.shiftAndExecuteNext(e)}))}))}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,i){const s=this.sourceBuffer[e];if(!s)return;const r=i.bind(this,e);this.listeners[e].push({event:t,listener:r}),s.addEventListener(t,r)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach((e=>{t.removeEventListener(e.event,e.listener)}))}},capLevelController:Fy,errorController:class{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=Pc.log.bind(Pc,"[info]:"),this.warn=Pc.warn.bind(Pc,"[warning]:"),this.error=Pc.error.bind(Pc,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(Tc.ERROR,this.onError,this),e.on(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tc.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(Tc.ERROR,this.onError,this),e.off(Tc.ERROR,this.onErrorOut,this),e.off(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tc.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(null==e?void 0:e.type)===Pp?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var i,s;if(t.fatal)return;const r=this.hls,o=t.context;switch(t.details){case Lc.FRAG_LOAD_ERROR:case Lc.FRAG_LOAD_TIMEOUT:case Lc.KEY_LOAD_ERROR:case Lc.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case Lc.FRAG_PARSING_ERROR:if(null!=(i=t.frag)&&i.gap)return void(t.errorAction={action:Tf,flags:Df});case Lc.FRAG_GAP:case Lc.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=kf);case Lc.LEVEL_EMPTY_ERROR:case Lc.LEVEL_PARSING_ERROR:{var a,n;const e=t.parent===Pp?t.level:r.loadLevel;t.details===Lc.LEVEL_EMPTY_ERROR&&null!=(a=t.context)&&null!=(n=a.levelDetails)&&n.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,e):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e))}return;case Lc.LEVEL_LOAD_ERROR:case Lc.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==o?void 0:o.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level)));case Lc.AUDIO_TRACK_LOAD_ERROR:case Lc.AUDIO_TRACK_LOAD_TIMEOUT:case Lc.SUBTITLE_LOAD_ERROR:case Lc.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){const e=r.levels[r.loadLevel];if(e&&(o.type===xp&&e.hasAudioGroup(o.groupId)||o.type===Rp&&e.hasSubtitleGroup(o.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=kf,void(t.errorAction.flags=xf)}return;case Lc.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const e=r.levels[r.loadLevel],i=null==e?void 0:e.attrs["HDCP-LEVEL"];i?t.errorAction={action:kf,flags:Rf,hdcpLevel:i}:this.keySystemError(t)}return;case Lc.BUFFER_ADD_CODEC_ERROR:case Lc.REMUX_ALLOC_ERROR:case Lc.BUFFER_APPEND_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,null!=(s=t.level)?s:r.loadLevel));case Lc.INTERNAL_EXCEPTION:case Lc.BUFFER_APPENDING_ERROR:case Lc.BUFFER_FULL_ERROR:case Lc.LEVEL_SWITCH_ERROR:case Lc.BUFFER_STALLED_ERROR:case Lc.BUFFER_SEEK_OVER_HOLE:case Lc.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:Tf,flags:Df})}t.type===kc.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const i=yf(this.hls.config.playlistLoadPolicy,e),s=this.playlistError++;if(vf(i,s,gf(e),e.response))return{action:Cf,flags:Df,retryConfig:i,retryCount:s};const r=this.getLevelSwitchAction(e,t);return i&&(r.retryConfig=i,r.retryCount=s),r}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),s=t.levels[i],{fragLoadPolicy:r,keyLoadPolicy:o}=t.config,a=yf(e.details.startsWith("key")?o:r,e),n=t.levels.reduce(((e,t)=>e+t.fragmentError),0);if(s){e.details!==Lc.FRAG_GAP&&s.fragmentError++;if(vf(a,n,gf(e),e.response))return{action:Cf,flags:Df,retryConfig:a,retryCount:n}}const l=this.getLevelSwitchAction(e,i);return a&&(l.retryConfig=a,l.retryCount=n),l}getLevelSwitchAction(e,t){const i=this.hls;null==t&&(t=i.loadLevel);const s=this.hls.levels[t];if(s){var r,o;const t=e.details;s.loadError++,t===Lc.BUFFER_APPEND_ERROR&&s.fragmentError++;let l=-1;const{levels:d,loadLevel:h,minAutoLevel:c,maxAutoLevel:u}=i;i.autoLevelEnabled||(i.loadLevel=-1);const p=null==(r=e.frag)?void 0:r.type,f=(p===Bp&&t===Lc.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(t===Lc.BUFFER_ADD_CODEC_ERROR||t===Lc.BUFFER_APPEND_ERROR))&&d.some((({audioCodec:e})=>s.audioCodec!==e)),m="video"===e.sourceBufferName&&(t===Lc.BUFFER_ADD_CODEC_ERROR||t===Lc.BUFFER_APPEND_ERROR)&&d.some((({codecSet:e,audioCodec:t})=>s.codecSet!==e&&s.audioCodec===t)),{type:g,groupId:y}=null!=(o=e.context)?o:{};for(let i=d.length;i--;){const r=(i+h)%d.length;if(r!==h&&r>=c&&r<=u&&0===d[r].loadError){var a,n;const i=d[r];if(t===Lc.FRAG_GAP&&p===Pp&&e.frag){const t=d[r].details;if(t){const i=Sf(e.frag,t.fragments,e.frag.start);if(null!=i&&i.gap)continue}}else{if(g===xp&&i.hasAudioGroup(y)||g===Rp&&i.hasSubtitleGroup(y))continue;if(p===Bp&&null!=(a=s.audioGroups)&&a.some((e=>i.hasAudioGroup(e)))||p===Ip&&null!=(n=s.subtitleGroups)&&n.some((e=>i.hasSubtitleGroup(e)))||f&&s.audioCodec===i.audioCodec||!f&&s.audioCodec!==i.audioCodec||m&&s.codecSet===i.codecSet)continue}l=r;break}}if(l>-1&&i.loadLevel!==l)return e.levelRetry=!0,this.playlistError=0,{action:kf,flags:Df,nextAutoLevel:l}}return{action:kf,flags:xf}}onErrorOut(e,t){var i;switch(null==(i=t.errorAction)?void 0:i.action){case Tf:break;case kf:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===Lc.FRAG_GAP?/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError()):t.fatal=!0}t.fatal&&this.hls.stopLoad()}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:s,hdcpLevel:r,nextAutoLevel:o}=i;switch(s){case Df:this.switchLevel(e,o);break;case Rf:r&&(t.maxHdcpLevel=Xp[Xp.indexOf(r)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`)}i.resolved||this.switchLevel(e,o)}switchLevel(e,t){void 0!==t&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}},fpsController:class{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(Tc.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(Tc.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const e=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=e,e&&"function"==typeof e.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,i){const s=performance.now();if(t){if(this.lastTime){const e=s-this.lastTime,r=i-this.lastDroppedFrames,o=t-this.lastDecodedFrames,a=1e3*r/e,n=this.hls;if(n.trigger(Tc.FPS_DROP,{currentDropped:r,currentDecoded:o,totalDroppedFrames:i}),a>0&&r>n.config.fpsDroppedMonitoringThreshold*o){let e=n.currentLevel;Pc.warn("drop FPS ratio greater than max allowed value for currentLevel: "+e),e>0&&(-1===n.autoLevelCapping||n.autoLevelCapping>=e)&&(e-=1,n.trigger(Tc.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:n.currentLevel}),n.autoLevelCapping=e,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}},stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:ou,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:EA,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:class extends Cm{constructor(e,t,i){super(e,t,i,"[subtitle-stream-controller]",Ip),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(Tc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Tc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tc.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Tc.ERROR,this.onError,this),e.on(Tc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(Tc.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(Tc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(Tc.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(Tc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Tc.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(Tc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Tc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tc.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Tc.ERROR,this.onError,this),e.off(Tc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(Tc.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(Tc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(Tc.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(Tc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Tc.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=ym,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:s}=t;if(this.fragPrevious=i,this.state=ym,!s)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let o;const a=i.start;for(let e=0;e=r[e].start&&a<=r[e].end){o=r[e];break}const n=i.start+i.duration;o?o.end=n:(o={start:a,end:n},r.push(o)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null)}onBufferFlushing(e,t){const{startOffset:i,endOffset:s}=t;if(0===i&&s!==Number.POSITIVE_INFINITY){const e=s-1;if(e<=0)return;t.endOffsetSubtitles=Math.max(0,e),this.tracksBuffered.forEach((t=>{for(let i=0;inew af(e))):(this.tracksBuffered=[],this.levels=t.map((e=>{const t=new af(e);return this.tracksBuffered[t.id]=[],t})),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Ip),this.fragPrevious=null,this.mediaBuffer=null)}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,null==(i=this.levels)||!i.length||-1===this.currentTrackId)return void this.clearInterval();const s=this.levels[this.currentTrackId];null!=s&&s.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,s&&this.setInterval(500)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:s,levels:r}=this,{details:o,id:a}=t;if(!r)return void this.warn(`Subtitle tracks were reset while loading level ${a}`);const n=r[a];if(a>=r.length||!n)return;this.log(`Subtitle track ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""},duration:${o.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(o.live||null!=(i=n.details)&&i.live){const e=this.mainDetails;if(o.deltaUpdateFailed||!e)return;const t=e.fragments[0];var d;if(n.details)l=this.alignPlaylists(o,n.details,null==(d=this.levelLastLoaded)?void 0:d.details),0===l&&t&&(l=t.start,uf(o,l));else o.hasProgramDateTime&&e.hasProgramDateTime?(om(o,e),l=o.fragments[0].start):t&&(l=t.start,uf(o,l))}if(n.details=o,this.levelLastLoaded=n,a===s&&(this.startFragRequested||!this.mainDetails&&o.live||this.setStartPosition(this.mainDetails||o,l),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===ym)){Sf(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),n.details=void 0)}}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,s=t.decryptdata,r=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&null!=s&&s.key&&s.iv&&"AES-128"===s.method){const e=performance.now();this.decrypter.decrypt(new Uint8Array(i),s.key.buffer,s.iv.buffer).catch((e=>{throw r.trigger(Tc.ERROR,{type:kc.MEDIA_ERROR,details:Lc.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e})).then((i=>{const s=performance.now();r.trigger(Tc.FRAG_DECRYPTED,{frag:t,payload:i,stats:{tstart:e,tdecrypt:s}})})).catch((e=>{this.warn(`${e.name}: ${e.message}`),this.state=ym}))}}doTick(){if(this.media){if(this.state===ym){const{currentTrackId:e,levels:t}=this,i=null==t?void 0:t[e];if(!i||!t.length||!i.details)return;const{config:s}=this,r=this.getLoadPosition(),o=Zf.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,s.maxBufferHole),{end:a,len:n}=o,l=this.getFwdBufferInfo(this.media,Pp),d=i.details;if(n>this.getMaxBufferLength(null==l?void 0:l.len)+d.levelTargetDuration)return;const h=d.fragments,c=h.length,u=d.edge;let p=null;const f=this.fragPrevious;if(au-e?0:e;p=Sf(f,h,Math.max(h[0].start,a),t),!p&&f&&f.startthis.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let e=null;const t=zp(this.media.textTracks);for(let i=0;i-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(Tc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Tc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Tc.LEVEL_LOADING,this.onLevelLoading,this),e.on(Tc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Tc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(Tc.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(Tc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Tc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Tc.LEVEL_LOADING,this.onLevelLoading,this),e.off(Tc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Tc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(Tc.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);zp(this.media.textTracks).forEach((e=>{jp(e)})),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:s,details:r}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==s)return void this.warn(`Subtitle track with id:${i} and group:${s} not found in active group ${null==o?void 0:o.groupId}`);const a=o.details;o.details=t.details,this.log(`Subtitle track ${i} "${o.name}" lang:${o.lang} group:${s} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,s=this.groupIds;let r=this.currentTrack;if(!i||(null==s?void 0:s.length)!==(null==i?void 0:i.length)||null!=i&&i.some((e=>-1===(null==s?void 0:s.indexOf(e))))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter((e=>!i||-1!==i.indexOf(e.groupId)));if(e.length)this.selectDefaultTrack&&!e.some((e=>e.default))&&(this.selectDefaultTrack=!1),e.forEach(((e,t)=>{e.id=t}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.subtitlePreference;if(!r&&t){this.selectDefaultTrack=!1;const i=Gf(t,e);if(i>-1)r=e[i];else{const e=Gf(t,this.tracks);r=this.tracks[e]}}let s=this.findTrackId(r);-1===s&&r&&(s=this.findTrackId(null));const o={subtitleTracks:e};this.log(`Updating subtitle tracks, ${e.length} track(s) found in "${null==i?void 0:i.join(",")}" group-id`),this.hls.trigger(Tc.SUBTITLE_TRACKS_UPDATED,o),-1!==s&&-1===this.trackId&&this.setSubtitleTrack(s)}else this.shouldReloadPlaylist(r)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let s=0;s-1){const e=this.tracksInGroup[s];return this.setSubtitleTrack(s),e}if(i)return null;{const i=Gf(e,t);if(i>-1)return t[i]}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const i=t.id,s=t.groupId;let r=t.url;if(e)try{r=e.addDirectives(r)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}this.log(`Loading subtitle playlist for id ${i}`),this.hls.trigger(Tc.SUBTITLE_TRACK_LOADING,{url:r,id:i,groupId:s,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=zp(e.textTracks),i=this.currentTrack;let s;if(i&&(s=t.filter((e=>Ug(i,e)))[0],s||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach((e=>{"disabled"!==e.mode&&e!==s&&(e.mode="disabled")})),s){const e=this.subtitleDisplay?"showing":"hidden";s.mode!==e&&(s.mode=e)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media)return void(this.queuedDefaultTrack=e);if(e<-1||e>=t.length||!Sc(e))return void this.warn(`Invalid subtitle track id: ${e}`);this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,s=t[e]||null;if(this.trackId=e,this.currentTrack=s,this.toggleTrackModes(),!s)return void this.hls.trigger(Tc.SUBTITLE_TRACK_SWITCH,{id:e});const r=!!s.details&&!s.details.live;if(e===this.trackId&&s===i&&r)return;this.log(`Switching to subtitle-track ${e}`+(s?` "${s.name}" lang:${s.lang} group:${s.groupId}`:""));const{id:o,groupId:a="",name:n,type:l,url:d}=s;this.hls.trigger(Tc.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:n,type:l,url:d});const h=this.switchParams(s.url,null==i?void 0:i.details,s.details);this.loadPlaylist(h)}},timelineController:class{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(Tc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Tc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tc.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Tc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(Tc.FRAG_LOADING,this.onFragLoading,this),e.on(Tc.FRAG_LOADED,this.onFragLoaded,this),e.on(Tc.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(Tc.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(Tc.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(Tc.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(Tc.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(Tc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Tc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tc.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Tc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(Tc.FRAG_LOADING,this.onFragLoading,this),e.off(Tc.FRAG_LOADED,this.onFragLoaded,this),e.off(Tc.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(Tc.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(Tc.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(Tc.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(Tc.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const e=new ny(this,"textTrack1"),t=new ny(this,"textTrack2"),i=new ny(this,"textTrack3"),s=new ny(this,"textTrack4");this.cea608Parser1=new ry(1,e,t),this.cea608Parser2=new ry(3,i,s)}}addCues(e,t,i,s,r){let o=!1;for(let e=r.length;e--;){const s=r[e],h=(a=s[0],n=s[1],l=t,d=i,Math.min(n,d)-Math.max(a,l));if(h>=0&&(s[0]=Math.min(s[0],t),s[1]=Math.max(s[1],i),o=!0,h/(i-t)>.5))return}var a,n,l,d;if(o||r.push([t,i]),this.config.renderTextTracksNatively){const r=this.captionsTracks[e];this.Cues.newCue(r,t,i,s)}else{const r=this.Cues.newCue(null,t,i,s);this.hls.trigger(Tc.CUES_PARSED,{type:"captions",cues:r,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:s,timescale:r}){const{unparsedVttFrags:o}=this;"main"===i&&(this.initPTS[t.cc]={baseTime:s,timescale:r}),o.length&&(this.unparsedVttFrags=[],o.forEach((e=>{this.onFragLoaded(Tc.FRAG_LOADED,e)})))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let s=0;s{jp(e[t]),delete e[t]})),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let e=0;ee.textCodec===Ey));if(this.config.enableWebVTT||s&&this.config.enableIMSC1){if(Mg(this.tracks,i))return void(this.tracks=i);if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const e=this.media,t=e?zp(e.textTracks):null;if(this.tracks.forEach(((e,i)=>{let s;if(t){let i=null;for(let s=0;snull!==e)).map((e=>e.label));e.length&&Pc.warn(`Media element contains unused subtitle tracks: ${e.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const e=this.tracks.map((e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e})));this.hls.trigger(Tc.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach((e=>{const t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;const i=`textTrack${t[1]}`,s=this.captionsProperties[i];s&&(s.label=e.name,e.lang&&(s.languageCode=e.lang),s.media=e)}))}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return null==t?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===Pp){var i,s;const{cea608Parser1:e,cea608Parser2:r,lastSn:o}=this,{cc:a,sn:n}=t.frag,l=null!=(i=null==(s=t.part)?void 0:s.index)?i:-1;e&&r&&(n!==o+1||n===o&&l!==this.lastPartIndex+1||a!==this.lastCc)&&(e.reset(),r.reset()),this.lastCc=a,this.lastSn=n,this.lastPartIndex=l}}onFragLoaded(e,t){const{frag:i,payload:s}=t;if(i.type===Ip)if(s.byteLength){const e=i.decryptdata,r="stats"in t;if(null==e||!e.encrypted||r){const e=this.tracks[i.level],r=this.vttCCs;r[i.cc]||(r[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),e&&e.textCodec===Ey?this._parseIMSC1(i,s):this._parseVTTs(t)}}else this.hls.trigger(Tc.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;Ly(t,this.initPTS[e.cc],(t=>{this._appendCues(t,e.level),i.trigger(Tc.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(t=>{Pc.log(`Failed to parse IMSC1: ${t}`),i.trigger(Tc.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})}))}_parseVTTs(e){var t;const{frag:i,payload:s}=e,{initPTS:r,unparsedVttFrags:o}=this,a=r.length-1;if(!r[i.cc]&&-1===a)return void o.push(e);const n=this.hls;Sy(null!=(t=i.initSegment)&&t.data?Vu(i.initSegment.data,new Uint8Array(s)):s,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,(e=>{this._appendCues(e,i.level),n.trigger(Tc.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})}),(t=>{const r="Missing initPTS for VTT MPEGTS"===t.message;r?o.push(e):this._fallbackToIMSC1(i,s),Pc.log(`Failed to parse VTT cue: ${t}`),r&&a>i.cc||n.trigger(Tc.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:t})}))}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Ly(t,this.initPTS[e.cc],(()=>{i.textCodec=Ey,this._parseIMSC1(e,t)}),(()=>{i.textCodec="wvtt"}))}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||"disabled"===i.mode)return;e.forEach((e=>Np(i,e)))}else{const s=this.tracks[t];if(!s)return;const r=s.default?"default":"subtitles"+t;i.trigger(Tc.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===Ip&&this.onFragLoaded(Tc.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:s}=this;if(!this.enabled||!i||!s)return;const{frag:r,samples:o}=t;if(r.type!==Pp||"NONE"!==this.closedCaptionsForLevel(r))for(let e=0;eGp(e[s],t,i)))}if(this.config.renderTextTracksNatively&&0===t&&void 0!==s){const{textTracks:e}=this;Object.keys(e).forEach((i=>Gp(e[i],t,s)))}}}extractCea608Data(e){const t=[[],[]],i=31&e[0];let s=2;for(let r=0;r0&&-1===e?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=ym):(this.loadedmetadata=!1,this.state=_m),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case ym:this.doTickIdle();break;case _m:{var e;const{levels:t,trackId:i}=this,s=null==t||null==(e=t[i])?void 0:e.details;if(s){if(this.waitForCdnTuneIn(s))break;this.state=km}break}case vm:{var t;const e=performance.now(),i=this.retryDate;if(!i||e>=i||null!=(t=this.media)&&t.seeking){const{levels:e,trackId:t}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==e?void 0:e[t])||null),this.state=ym}break}case km:{const e=this.waitingData;if(e){const{frag:t,part:i,cache:s,complete:r}=e;if(void 0!==this.initPTS[t.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=bm;const e={frag:t,part:i,payload:s.flush(),networkDetails:null};this._handleFragmentLoadProgress(e),r&&super._handleFragmentLoadComplete(e)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${t.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const e=this.getLoadPosition(),i=Zf.bufferInfo(this.mediaBuffer,e,this.config.maxBufferHole);Ef(i.end,this.config.maxFragLookUpTolerance,t)<0&&(this.log(`Waiting fragment cc (${t.cc}) @ ${t.start} cancelled because another fragment at ${i.end} is needed`),this.clearWaitingFragment())}}else this.state=ym}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=ym)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:i,trackId:s}=this,r=e.config;if(!i&&(this.startFragRequested||!r.startFragPrefetch)||null==t||!t[s])return;const o=t[s],a=o.details;if(!a||a.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(a))return void(this.state=_m);const n=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&n&&(this.bufferFlushed=!1,this.afterBufferFlushed(n,Nc,Bp));const l=this.getFwdBufferInfo(n,Bp);if(null===l)return;const{bufferedTrack:d,switchingTrack:h}=this;if(!h&&this._streamEnded(l,a))return e.trigger(Tc.BUFFER_EOS,{type:"audio"}),void(this.state=wm);const c=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Pp),u=l.len,p=this.getMaxBufferLength(null==c?void 0:c.len),f=a.fragments,m=f[0].start;let g=this.flushing?this.getLoadPosition():l.end;if(h&&i){const e=this.getLoadPosition();d&&!Fg(h.attrs,d.attrs)&&(g=e),a.PTSKnown&&em||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=m+.05)}if(u>=p&&!h&&gc.end+a.targetduration;if(b||(null==c||!c.len)&&l.len){const e=this.getAppendedFrag(y.start,Pp);if(null===e)return;if(A||(A=!!e.gap||!!b&&0===c.len),b&&!A||A&&l.nextStart&&l.nextStartnew af(e)))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:s}=this;s&&(s.abortRequests(),this.removeUnbufferedFrags(s.start)),this.resetLoadingState(),i?this.setInterval(100):this.resetTransmuxer(),i?(this.switchingTrack=t,this.state=ym,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=gm),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,null!==this.cachedTrackLoadedData&&(this.hls.trigger(Tc.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var i;if(null==this.mainDetails)return void(this.cachedTrackLoadedData=t);const{levels:s}=this,{details:r,id:o}=t;if(!s)return void this.warn(`Audio tracks were reset while loading level ${o}`);this.log(`Audio track ${o} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const a=s[o];let n=0;if(r.live||null!=(i=a.details)&&i.live){this.checkLiveUpdate(r);const e=this.mainDetails;if(r.deltaUpdateFailed||!e)return;var l;if(!a.details&&r.hasProgramDateTime&&e.hasProgramDateTime)om(r,e),n=r.fragments[0].start;else n=this.alignPlaylists(r,a.details,null==(l=this.levelLastLoaded)?void 0:l.details)}a.details=r,this.levelLastLoaded=a,this.startFragRequested||!this.mainDetails&&r.live||this.setStartPosition(this.mainDetails||r,n),this.state!==_m||this.waitForCdnTuneIn(r)||(this.state=ym),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:s,payload:r}=e,{config:o,trackId:a,levels:n}=this;if(!n)return void this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);const l=n[a];if(!l)return void this.warn("Audio track is undefined on fragment load progress");const d=l.details;if(!d)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(i.start);const h=o.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let c=this.transmuxer;c||(c=this.transmuxer=new Ig(this.hls,Bp,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const u=this.initPTS[i.cc],p=null==(t=i.initSegment)?void 0:t.data;if(void 0!==u){const e=!1,t=s?s.index:-1,o=-1!==t,a=new em(i.level,i.sn,i.stats.chunkCount,r.byteLength,t,o);c.push(r,p,h,"",i,s,d.totalduration,e,a,u)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${d.startSN} ,${d.endSN}],track ${a}`);const{cache:e}=this.waitingData=this.waitingData||{frag:i,part:s,cache:new Dm,complete:!1};e.push(new Uint8Array(r)),this.waitingVideoCC=this.videoTrackCC,this.state=km}}_handleFragmentLoadComplete(e){this.waitingData?this.waitingData.complete=!0:super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:i,part:s}=t;if(i.type===Bp)if(this.fragContextChanged(i))this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);else{if("initSegment"!==i.sn){this.fragPrevious=i;const e=this.switchingTrack;e&&(this.bufferedTrack=e,this.switchingTrack=null,this.hls.trigger(Tc.AUDIO_TRACK_SWITCHED,Ac({},e)))}this.fragBufferedComplete(i,s)}else if(!this.loadedmetadata&&i.type===Pp){const e=this.videoBuffer||this.media;if(e){Zf.getBuffered(e).length&&(this.loadedmetadata=!0)}}}onError(e,t){var i;if(t.fatal)this.state=Tm;else switch(t.details){case Lc.FRAG_GAP:case Lc.FRAG_PARSING_ERROR:case Lc.FRAG_DECRYPT_ERROR:case Lc.FRAG_LOAD_ERROR:case Lc.FRAG_LOAD_TIMEOUT:case Lc.KEY_LOAD_ERROR:case Lc.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Bp,t);break;case Lc.AUDIO_TRACK_LOAD_ERROR:case Lc.AUDIO_TRACK_LOAD_TIMEOUT:case Lc.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==_m||(null==(i=t.context)?void 0:i.type)!==xp||(this.state=ym);break;case Lc.BUFFER_APPEND_ERROR:case Lc.BUFFER_FULL_ERROR:if(!t.parent||"audio"!==t.parent)return;if(t.details===Lc.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case Lc.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onBufferFlushing(e,{type:t}){t!==jc&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==jc){this.flushing=!1,this.bufferFlushed=!0,this.state===wm&&(this.state=ym);const e=this.mediaBuffer||this.media;e&&(this.afterBufferFlushed(e,t,Bp),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:s}=this,{remuxResult:r,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a)return void this.resetWhenMissingContext(o);const{frag:n,part:l,level:d}=a,{details:h}=d,{audio:c,text:u,id3:p,initSegment:f}=r;if(!this.fragContextChanged(n)&&h){if(this.state=Sm,this.switchingTrack&&c&&this.completeAudioSwitch(this.switchingTrack),null!=f&&f.tracks){const e=n.initSegment||n;this._bufferInitSegment(d,f.tracks,e,o),s.trigger(Tc.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:f.tracks})}if(c){const{startPTS:e,endPTS:t,startDTS:i,endDTS:s}=c;l&&(l.elementaryStreams[Nc]={startPTS:e,endPTS:t,startDTS:i,endDTS:s}),n.setElementaryStreamInfo(Nc,e,t,i,s),this.bufferFragmentData(c,n,l,o)}if(null!=p&&null!=(t=p.samples)&&t.length){const e=_c({id:i,frag:n,details:h},p);s.trigger(Tc.FRAG_PARSING_METADATA,e)}if(u){const e=_c({id:i,frag:n,details:h},u);s.trigger(Tc.FRAG_PARSING_USERDATA,e)}}else this.fragmentTracker.removeFragment(n)}_bufferInitSegment(e,t,i,s){if(this.state!==Sm)return;t.video&&delete t.video;const r=t.audio;if(!r)return;r.id="audio";const o=e.audioCodec;this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${o}/${r.codec}]`),o&&1===o.split(",").length&&(r.levelCodec=o),this.hls.trigger(Tc.BUFFER_CODECS,t);const a=r.initSegment;if(null!=a&&a.byteLength){const e={type:"audio",frag:i,part:null,chunkMeta:s,parent:i.type,data:a};this.hls.trigger(Tc.BUFFER_APPENDING,e)}this.tickImmediate()}loadFragment(e,t,i){const s=this.fragmentTracker.getState(e);var r;if(this.fragCurrent=e,this.switchingTrack||s===Hf||s===Jf)if("initSegment"===e.sn)this._loadInitSegment(e,t);else if(null!=(r=t.details)&&r.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=km;const i=this.mainDetails;i&&i.fragments[0].start!==t.details.fragments[0].start&&om(t.details,i)}else this.startFragRequested=!0,super.loadFragment(e,t,i);else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:i}=this,s=null==i?void 0:i.attrs,r=e.attrs;t&&s&&(s.CHANNELS!==r.CHANNELS||i.name!==e.name||i.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(Tc.AUDIO_TRACK_SWITCHED,Ac({},e))}},audioTrackController:class extends Pf{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Tc.LEVEL_LOADING,this.onLevelLoading,this),e.on(Tc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Tc.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(Tc.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Tc.LEVEL_LOADING,this.onLevelLoading,this),e.off(Tc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Tc.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(Tc.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:s,details:r}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==s)return void this.warn(`Audio track with id:${i} and group:${s} not found in active group ${null==o?void 0:o.groupId}`);const a=o.details;o.details=t.details,this.log(`Audio track ${i} "${o.name}" lang:${o.lang} group:${s} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,s=this.groupIds;let r=this.currentTrack;if(!i||(null==s?void 0:s.length)!==(null==i?void 0:i.length)||null!=i&&i.some((e=>-1===(null==s?void 0:s.indexOf(e))))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter((e=>!i||-1!==i.indexOf(e.groupId)));if(e.length)this.selectDefaultTrack&&!e.some((e=>e.default))&&(this.selectDefaultTrack=!1),e.forEach(((e,t)=>{e.id=t}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.audioPreference;if(!r&&t){const i=Gf(t,e,Wf);if(i>-1)r=e[i];else{const e=Gf(t,this.tracks);r=this.tracks[e]}}let s=this.findTrackId(r);-1===s&&r&&(s=this.findTrackId(null));const a={audioTracks:e};this.log(`Updating audio tracks, ${e.length} track(s) found in group(s): ${null==i?void 0:i.join(",")}`),this.hls.trigger(Tc.AUDIO_TRACKS_UPDATED,a);const n=this.trackId;if(-1!==s&&-1===n)this.setAudioTrack(s);else if(e.length&&-1===n){var o;const t=new Error(`No audio track selected for current audio group-ID(s): ${null==(o=this.groupIds)?void 0:o.join(",")} track count: ${e.length}`);this.warn(t.message),this.hls.trigger(Tc.ERROR,{type:kc.MEDIA_ERROR,details:Lc.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:t})}}else this.shouldReloadPlaylist(r)&&this.setAudioTrack(this.trackId)}onError(e,t){!t.fatal&&t.context&&(t.context.type!==xp||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||(this.requestScheduled=-1,this.checkRetry(t)))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const s=this.currentTrack;if(s&&zf(e,s,Wf))return s;const r=Gf(e,this.tracksInGroup,Wf);if(r>-1){const e=this.tracksInGroup[r];return this.setAudioTrack(r),e}if(s){let s=t.loadLevel;-1===s&&(s=t.firstAutoLevel);const r=function(e,t,i,s,r){const o=t[s],a=t.reduce(((e,t,i)=>{const s=t.uri;return(e[s]||(e[s]=[])).push(i),e}),{})[o.uri];a.length>1&&(s=Math.max.apply(Math,a));const n=o.videoRange,l=o.frameRate,d=o.codecSet.substring(0,4),h=Vf(t,s,(t=>{if(t.videoRange!==n||t.frameRate!==l||t.codecSet.substring(0,4)!==d)return!1;const s=t.audioGroups,o=i.filter((e=>!s||-1!==s.indexOf(e.groupId)));return Gf(e,o,r)>-1}));return h>-1?h:Vf(t,s,(t=>{const s=t.audioGroups,o=i.filter((e=>!s||-1!==s.indexOf(e.groupId)));return Gf(e,o,r)>-1}))}(e,t.levels,i,s,Wf);if(-1===r)return null;t.nextLoadLevel=r}if(e.channels||e.audioCodec){const t=Gf(e,i);if(t>-1)return i[t]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length)return void this.warn(`Invalid audio track id: ${e}`);this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,s=t[e],r=s.details&&!s.details.live;if(e===this.trackId&&s===i&&r)return;if(this.log(`Switching to audio-track ${e} "${s.name}" lang:${s.lang} group:${s.groupId} channels:${s.channels}`),this.trackId=e,this.currentTrack=s,this.hls.trigger(Tc.AUDIO_TRACK_SWITCHING,Ac({},s)),r)return;const o=this.switchParams(s.url,null==i?void 0:i.details,s.details);this.loadPlaylist(o)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=e=>{try{this.apply(e,{ot:jy.MANIFEST,su:!this.initialized})}catch(e){Pc.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=e=>{try{const t=e.frag,i=this.hls.levels[t.level],s=this.getObjectType(t),r={d:1e3*t.duration,ot:s};s!==jy.VIDEO&&s!==jy.AUDIO&&s!=jy.MUXED||(r.br=i.bitrate/1e3,r.tb=this.getTopBandwidth(s)/1e3,r.bl=this.getBufferLength(s)),this.apply(e,r)}catch(e){Pc.warn("Could not generate segment CMCD data.",e)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;null!=i&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||function(){try{return crypto.randomUUID()}catch(e){try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){let t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?i:3&i|8).toString(16)}))}}}(),this.cid=i.contentId,this.useHeaders=!0===i.useHeaders,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(Tc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Tc.MEDIA_DETACHED,this.onMediaDetached,this),e.on(Tc.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(Tc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Tc.MEDIA_DETACHED,this.onMediaDetached,this),e.off(Tc.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,s;this.audioBuffer=null==(i=t.tracks.audio)?void 0:i.buffer,this.videoBuffer=null==(s=t.tracks.video)?void 0:s.buffer}createData(){var e;return{v:1,sf:Gy.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){_c(t,this.createData());const i=t.ot===jy.INIT||t.ot===jy.VIDEO||t.ot===jy.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering);const{includeKeys:s}=this;s&&(t=Object.keys(t).reduce(((e,i)=>(s.includes(i)&&(e[i]=t[i]),e)),{})),this.useHeaders?(e.headers||(e.headers={}),cA(e.headers,t)):e.url=pA(e.url,t)}getObjectType(e){const{type:t}=e;return"subtitle"===t?jy.TIMED_TEXT:"initSegment"===e.sn?jy.INIT:"audio"===t?jy.AUDIO:"main"===t?this.hls.audioTracks.length?jy.VIDEO:jy.MUXED:void 0}getTopBandwidth(e){let t,i=0;const s=this.hls;if(e===jy.AUDIO)t=s.audioTracks;else{const e=s.maxAutoLevel,i=e>-1?e+1:s.levels.length;t=s.levels.slice(0,i)}for(const e of t)e.bitrate>i&&(i=e.bitrate);return i>0?i:NaN}getBufferLength(e){const t=this.hls.media,i=e===jy.AUDIO?this.audioBuffer:this.videoBuffer;if(!i||!t)return NaN;return 1e3*Zf.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,s){t(e),this.loader.load(e,i,s)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,s){t(e),this.loader.load(e,i,s)}}}},contentSteeringController:class{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=Pc.log.bind(Pc,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tc.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Tc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Tc.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tc.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Tc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Tc.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter((t=>t!==e)))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;null!==i&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((null==i?void 0:i.action)===kf&&i.flags===xf){const e=this.levels;let s=this.pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:i,pathwayId:s,type:o}=t.context;i&&e?r=this.getPathwayForGroupId(i,o,r):s&&(r=s)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!s&&e&&(s=e.reduce(((e,t)=>(-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e)),[])),s&&s.length>1&&(this.updatePathwayPriority(s),i.resolved=this.pathwayId!==r),i.resolved||Pc.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${e?e.length:e} priorities: ${JSON.stringify(s)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return null===this.levels?[]:this.levels.filter((t=>e===t.pathwayId))}updatePathwayPriority(e){let t;this.pathwayPriority=e;const i=this.penalizedPathways,s=performance.now();Object.keys(i).forEach((e=>{s-i[e]>3e5&&delete i[e]}));for(let s=0;s0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,mf(t),this.hls.trigger(Tc.LEVELS_UPDATED,{levels:t});const e=this.hls.levels[o];a&&e&&this.levels&&(e.attrs["STABLE-VARIANT-ID"]!==a.attrs["STABLE-VARIANT-ID"]&&e.bitrate!==a.bitrate&&this.log(`Unstable Pathways change from bitrate ${a.bitrate} to ${e.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,i){const s=this.getLevelsForPathway(i).concat(this.levels||[]);for(let i=0;i{const{ID:r,"BASE-ID":o,"URI-REPLACEMENT":a}=e;if(t.some((e=>e.pathwayId===r)))return;const n=this.getLevelsForPathway(o).map((e=>{const t=new Mc(e.attrs);t["PATHWAY-ID"]=r;const o=t.AUDIO&&`${t.AUDIO}_clone_${r}`,n=t.SUBTITLES&&`${t.SUBTITLES}_clone_${r}`;o&&(i[t.AUDIO]=o,t.AUDIO=o),n&&(s[t.SUBTITLES]=n,t.SUBTITLES=n);const l=mA(e.uri,t["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",a),d=new af({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:l,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(let t=1;t{this.log(`Loaded steering manifest: "${s}"`);const o=e.data;if(1!==o.VERSION)return void this.log(`Steering VERSION ${o.VERSION} not supported!`);this.updated=performance.now(),this.timeToLoad=o.TTL;const{"RELOAD-URI":a,"PATHWAY-CLONES":n,"PATHWAY-PRIORITY":l}=o;if(a)try{this.uri=new self.URL(a,s).href}catch(e){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest RELOAD-URI: ${a}`)}this.scheduleRefresh(this.uri||i.url),n&&this.clonePathways(n);const d={steeringManifest:o,url:s.toString()};this.hls.trigger(Tc.STEERING_MANIFEST_LOADED,d),l&&this.updatePathwayPriority(l)},onError:(e,t,i,s)=>{if(this.log(`Error loading steering manifest: ${e.code} ${e.text} (${t.url})`),this.stopLoad(),410===e.code)return this.enabled=!1,void this.log(`Steering manifest ${t.url} no longer available`);let r=1e3*this.timeToLoad;if(429!==e.code)this.scheduleRefresh(this.uri||t.url,r);else{const e=this.loader;if("function"==typeof(null==e?void 0:e.getResponseHeader)){const t=e.getResponseHeader("Retry-After");t&&(r=1e3*parseFloat(t))}this.log(`Steering manifest ${t.url} rate limited`)}},onTimeout:(e,t,i)=>{this.log(`Timeout loading steering manifest (${t.url})`),this.scheduleRefresh(this.uri||t.url)}};this.log(`Requesting steering manifest: ${s}`),this.loader.load(r,n,l)}scheduleRefresh(e,t=1e3*this.timeToLoad){this.clearTimeout(),this.reloadTimer=self.setTimeout((()=>{var t;const i=null==(t=this.hls)?void 0:t.media;!i||i.ended?this.scheduleRefresh(e,1e3*this.timeToLoad):this.loadSteeringManifest(e)}),t)}}});function TA(e){return e&&"object"==typeof e?Array.isArray(e)?e.map(TA):Object.keys(e).reduce(((t,i)=>(t[i]=TA(e[i]),t)),{}):e}function kA(e){const t=e.loader;if(t!==bA&&t!==yA)Pc.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1;else{(function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1})()&&(e.loader=bA,e.progressive=!0,e.enableSoftwareAES=!0,Pc.log("[config]: Progressive streaming enabled, using FetchLoader"))}}let LA;class CA extends Pf{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Tc.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Tc.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Tc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Tc.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Tc.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(Tc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Tc.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Tc.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Tc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Tc.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Tc.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach((e=>{e.loadError=0,e.fragmentError=0})),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,s=[],r={},o={};let a=!1,n=!1,l=!1;t.levels.forEach((e=>{var t,d;const h=e.attrs;let{audioCodec:c,videoCodec:u}=e;-1!==(null==(t=c)?void 0:t.indexOf("mp4a.40.34"))&&(LA||(LA=/chrome|firefox/i.test(navigator.userAgent)),LA&&(e.audioCodec=c=void 0)),c&&(e.audioCodec=c=pp(c,i)),0===(null==(d=u)?void 0:d.indexOf("avc1"))&&(u=e.videoCodec=function(e){const t=e.split(",");for(let e=0;e2){let s=i.shift()+".";s+=parseInt(i.shift()).toString(16),s+=("000"+parseInt(i.shift()).toString(16)).slice(-4),t[e]=s}}return t.join(",")}(u));const{width:p,height:f,unknownCodecs:m}=e;if(a||(a=!(!p||!f)),n||(n=!!u),l||(l=!!c),null!=m&&m.length||c&&!ap(c,"audio",i)||u&&!ap(u,"video",i))return;const{CODECS:g,"FRAME-RATE":y,"HDCP-LEVEL":A,"PATHWAY-ID":b,RESOLUTION:v,"VIDEO-RANGE":_}=h,S=`${`${b||"."}-`}${e.bitrate}-${v}-${y}-${g}-${_}-${A}`;if(r[S])if(r[S].uri===e.url||e.attrs["PATHWAY-ID"])r[S].addGroupId("audio",h.AUDIO),r[S].addGroupId("text",h.SUBTITLES);else{const t=o[S]+=1;e.attrs["PATHWAY-ID"]=new Array(t+1).join(".");const i=new af(e);r[S]=i,s.push(i)}else{const t=new af(e);r[S]=t,o[S]=1,s.push(t)}})),this.filterAndSortMediaOptions(s,t,a,n,l)}filterAndSortMediaOptions(e,t,i,s,r){let o=[],a=[],n=e;if((i||s)&&r&&(n=n.filter((({videoCodec:e,videoRange:t,width:i,height:s})=>{return(!!e||!(!i||!s))&&(!!(r=t)&&Zp.indexOf(r)>-1);var r}))),0===n.length)return void Promise.resolve().then((()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const e=new Error("no level with compatible codecs found in manifest");this.hls.trigger(Tc.ERROR,{type:kc.MEDIA_ERROR,details:Lc.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:e,reason:e.message})}}));if(t.audioTracks){const{preferManagedMediaSource:e}=this.hls.config;o=t.audioTracks.filter((t=>!t.audioCodec||ap(t.audioCodec,"audio",e))),DA(o)}t.subtitles&&(a=t.subtitles,DA(a));const l=n.slice(0);n.sort(((e,t)=>{if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return Zp.indexOf(e.videoRange)-Zp.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){const i=dp(e.videoCodec),s=dp(t.videoCodec);if(i!==s)return s-i}if(e.uri===t.uri&&e.codecSet!==t.codecSet){const i=hp(e.codecSet),s=hp(t.codecSet);if(i!==s)return s-i}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0}));let d=l[0];if(this.steering&&(n=this.steering.filterParsedLevels(n),n.length!==l.length))for(let e=0;ei&&i===wA.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=e)}break}const c=r&&!s,u={levels:n,audioTracks:o,subtitleTracks:a,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:s,altAudio:!c&&o.some((e=>!!e.url))};this.hls.trigger(Tc.MANIFEST_PARSED,u),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return 0===this._levels.length?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(0===t.length)return;if(e<0||e>=t.length){const i=new Error("invalid level idx"),s=e<0;if(this.hls.trigger(Tc.ERROR,{type:kc.OTHER_ERROR,details:Lc.LEVEL_SWITCH_ERROR,level:e,fatal:s,error:i,reason:i.message}),s)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,s=this.currentLevel,r=s?s.attrs["PATHWAY-ID"]:void 0,o=t[e],a=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,i===e&&o.details&&s&&r===a)return;this.log(`Switching to level ${e} (${o.height?o.height+"p ":""}${o.videoRange?o.videoRange+" ":""}${o.codecSet?o.codecSet+" ":""}@${o.bitrate})${a?" with Pathway "+a:""} from level ${i}${r?" with Pathway "+r:""}`);const n={level:e,attrs:o.attrs,details:o.details,bitrate:o.bitrate,averageBitrate:o.averageBitrate,maxBitrate:o.maxBitrate,realBitrate:o.realBitrate,width:o.width,height:o.height,codecSet:o.codecSet,audioCodec:o.audioCodec,videoCodec:o.videoCodec,audioGroups:o.audioGroups,subtitleGroups:o.subtitleGroups,loaded:o.loaded,loadError:o.loadError,fragmentError:o.fragmentError,name:o.name,id:o.id,uri:o.uri,url:o.url,urlId:0,audioGroupIds:o.audioGroupIds,textGroupIds:o.textGroupIds};this.hls.trigger(Tc.LEVEL_SWITCHING,n);const l=o.details;if(!l||l.live){const e=this.switchParams(o.uri,null==s?void 0:s.details,l);this.loadPlaylist(e)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(void 0===this._startLevel){const e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){!t.fatal&&t.context&&t.context.type===Dp&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(void 0!==t&&t.type===Pp){const e=t.elementaryStreams;if(!Object.keys(e).some((t=>!!e[t])))return;const i=this._levels[t.level];null!=i&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var i;const{level:s,details:r}=t,o=this._levels[s];var a;if(!o)return this.warn(`Invalid level index ${s}`),void(null!=(a=t.deliveryDirectives)&&a.skip&&(r.deltaUpdateFailed=!0));s===this.currentLevelIndex?(0===o.fragmentError&&(o.loadError=0),this.playlistLoaded(s,t,o.details)):null!=(i=t.deliveryDirectives)&&i.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){let s=i.uri;if(e)try{s=e.addDirectives(s)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}const r=i.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${void 0!==(null==e?void 0:e.msn)?" at sn "+e.msn+" part "+e.part:""} with${r?" Pathway "+r:""} ${s}`),this.clearTimer(),this.hls.trigger(Tc.LEVEL_LOADING,{url:s,level:t,pathwayId:i.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const i=this._levels.filter(((t,i)=>i!==e||(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach((e=>e.level=-1))),!1)));mf(i),this._levels=i,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(Tc.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(Tc.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function DA(e){const t={};e.forEach((e=>{const i=e.groupId||"";e.id=t[i]=t[i]||0,t[i]++}))}class xA{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyUriToKeyInfo){const s=this.keyUriToKeyInfo[i].loader;if(s){var t;if(e&&e!==(null==(t=s.context)?void 0:t.frag.type))return;s.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=Lc.KEY_LOAD_ERROR,i,s,r){return new hm({type:kc.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:i,networkDetails:s})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:s}=e;for(let e=0;e{r.setKeyFormat(e)}));break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then((t=>this.loadInternal(e,t))):this.loadInternal(e)}loadInternal(e,t){var i,s;t&&e.setKeyFormat(t);const r=e.decryptdata;if(!r){const i=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,Lc.KEY_LOAD_ERROR,i))}const o=r.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,Lc.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));let a=this.keyUriToKeyInfo[o];if(null!=(i=a)&&i.decryptdata.key)return r.key=a.decryptdata.key,Promise.resolve({frag:e,keyInfo:a});var n;if(null!=(s=a)&&s.keyLoadPromise)switch(null==(n=a.mediaKeySessionContext)?void 0:n.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return a.keyLoadPromise.then((t=>(r.key=t.keyInfo.decryptdata.key,{frag:e,keyInfo:a})))}switch(a=this.keyUriToKeyInfo[o]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===r.keyFormat?this.loadKeyHTTP(a,e):this.loadKeyEME(a,e);case"AES-128":return this.loadKeyHTTP(a,e);default:return Promise.reject(this.createKeyLoadError(e,Lc.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const t=this.emeController.loadKey(i);if(t)return(e.keyLoadPromise=t.then((t=>(e.mediaKeySessionContext=t,i)))).catch((t=>{throw e.keyLoadPromise=null,t}))}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,s=new(0,i.loader)(i);return t.keyLoader=e.loader=s,e.keyLoadPromise=new Promise(((r,o)=>{const a={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},n=i.keyLoadPolicy.default,l={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(e,t,i,s)=>{const{frag:a,keyInfo:n,url:l}=i;if(!a.decryptdata||n!==this.keyUriToKeyInfo[l])return o(this.createKeyLoadError(a,Lc.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),s));n.decryptdata.key=a.decryptdata.key=new Uint8Array(e.data),a.keyLoader=null,n.loader=null,r({frag:a,keyInfo:n})},onError:(e,i,s,r)=>{this.resetLoader(i),o(this.createKeyLoadError(t,Lc.KEY_LOAD_ERROR,new Error(`HTTP Error ${e.code} loading key ${e.text}`),s,Ac({url:a.url,data:void 0},e)))},onTimeout:(e,i,s)=>{this.resetLoader(i),o(this.createKeyLoadError(t,Lc.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),s))},onAbort:(e,i,s)=>{this.resetLoader(i),o(this.createKeyLoadError(t,Lc.INTERNAL_ABORTED,new Error("key loading aborted"),s))}};s.load(a,l,d)}))}resetLoader(e){const{frag:t,keyInfo:i,url:s}=e,r=i.loader;t.keyLoader===r&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[s],r&&r.destroy()}}function RA(){return self.SourceBuffer||self.WebKitSourceBuffer}function PA(){if(!rp())return!1;const e=RA();return!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove}class BA{constructor(e,t,i,s){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=s}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:i,media:s,stalled:r}=this;if(null===s)return;const{currentTime:o,seeking:a}=s,n=this.seeking&&!a,l=!this.seeking&&a;if(this.seeking=a,o!==e){if(this.moved=!0,a||(this.nudgeRetry=0),null!==r){if(this.stallReported){const e=self.performance.now()-r;Pc.warn(`playback not stuck anymore @${o}, after ${Math.round(e)}ms`),this.stallReported=!1}this.stalled=null}return}if(l||n)return void(this.stalled=null);if(s.paused&&!a||s.ended||0===s.playbackRate||!Zf.getBuffered(s).length)return void(this.nudgeRetry=0);const d=Zf.bufferInfo(s,o,0),h=d.nextStart||0;if(a){const e=d.len>2,i=!h||t&&t.start<=o||h-o>2&&!this.fragmentTracker.getPartialFragment(o);if(e||i)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var c;if(!(d.len>0)&&!h)return;const e=Math.max(h,d.start||0)-o,t=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,i=(null==t||null==(c=t.details)?void 0:c.live)?2*t.details.targetduration:2,r=this.fragmentTracker.getPartialFragment(o);if(e>0&&(e<=i||r))return void(s.paused||this._trySkipBufferHole(r))}const u=self.performance.now();if(null===r)return void(this.stalled=u);const p=u-r;if(!a&&p>=250&&(this._reportStall(d),!this.media))return;const f=Zf.bufferInfo(s,o,i.maxBufferHole);this._tryFixBufferStall(f,p)}_tryFixBufferStall(e,t){const{config:i,fragmentTracker:s,media:r}=this;if(null===r)return;const o=r.currentTime,a=s.getPartialFragment(o);if(a){if(this._trySkipBufferHole(a)||!this.media)return}(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-o1e3*i.highBufferWatchdogPeriod&&(Pc.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:i,stallReported:s}=this;if(!s&&i){this.stallReported=!0;const s=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${JSON.stringify(e)})`);Pc.warn(s.message),t.trigger(Tc.ERROR,{type:kc.MEDIA_ERROR,details:Lc.BUFFER_STALLED_ERROR,fatal:!1,error:s,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:i,media:s}=this;if(null===s)return 0;const r=s.currentTime,o=Zf.bufferInfo(s,r,0),a=r0&&o.len<1&&s.readyState<3,d=a-r;if(d>0&&(n||l)){if(d>t.maxBufferHole){const{fragmentTracker:t}=this;let i=!1;if(0===r){const e=t.getAppendedFrag(0,Pp);e&&a1?(e=0,this.bitrateTest=!0):e=i.firstAutoLevel),i.nextLoadLevel=e,this.level=i.loadLevel,this.loadedmetadata=!1}t>0&&-1===e&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=ym,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=gm}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Lm:{const{levels:e,level:t}=this,i=null==e?void 0:e[t],s=null==i?void 0:i.details;if(s&&(!s.live||this.levelLastLoaded===i)){if(this.waitForCdnTuneIn(s))break;this.state=ym;break}if(this.hls.nextLoadLevel!==this.level){this.state=ym;break}break}case vm:{var e;const t=self.performance.now(),i=this.retryDate;if(!i||t>=i||null!=(e=this.media)&&e.seeking){const{levels:e,level:t}=this,i=null==e?void 0:e[t];this.resetStartWhenNotLoaded(i||null),this.state=ym}}}this.state===ym&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:s}=this;if(null===t||!s&&(this.startFragRequested||!e.config.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;const r=e.nextLoadLevel;if(null==i||!i[r])return;const o=i[r],a=this.getMainFwdBufferInfo();if(null===a)return;const n=this.getLevelDetails();if(n&&this._streamEnded(a,n)){const e={};return this.altAudio&&(e.type="video"),this.hls.trigger(Tc.BUFFER_EOS,e),void(this.state=wm)}e.loadLevel!==r&&-1===e.manualLevel&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;const l=o.details;if(!l||this.state===Lm||l.live&&this.levelLastLoaded!==o)return this.level=r,void(this.state=Lm);const d=a.len,h=this.getMaxBufferLength(o.maxBitrate);if(d>=h)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const c=this.backtrackFragment?this.backtrackFragment.start:a.end;let u=this.getNextFragment(c,l);if(this.couldBacktrack&&!this.fragPrevious&&u&&"initSegment"!==u.sn&&this.fragmentTracker.getState(u)!==qf){var p;const e=(null!=(p=this.backtrackFragment)?p:u).sn-l.startSN,t=l.fragments[e-1];t&&u.cc===t.cc&&(u=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(u&&this.isLoopLoading(u,c)){if(!u.gap){const e=this.audioOnly&&!this.altAudio?Nc:jc,t=(e===jc?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,Pp)}u=this.getNextFragmentLoopLoading(u,l,a,Pp,h)}u&&(!u.initSegment||u.initSegment.data||this.bitrateTest||(u=u.initSegment),this.loadFragment(u,o,c))}loadFragment(e,t,i){const s=this.fragmentTracker.getState(e);this.fragCurrent=e,s===Hf||s===Jf?"initSegment"===e.sn?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,i)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Pp)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(null!=t&&t.readyState){let i;const s=this.getAppendedFrag(t.currentTime);s&&s.start>1&&this.flushMainBuffer(0,s.start-1);const r=this.getLevelDetails();if(null!=r&&r.live){const e=this.getMainFwdBufferInfo();if(!e||e.len<2*r.targetduration)return}if(!t.paused&&e){const t=e[this.hls.nextLoadLevel],s=this.fragLastKbps;i=s&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*s)+1:0}else i=0;const o=this.getBufferedFrag(t.currentTime+i);if(o){const e=this.followingBufferedFrag(o);if(e){this.abortCurrentFrag();const t=e.maxStartPTS?e.maxStartPTS:e.start,i=e.duration,s=Math.max(o.end,t+Math.min(Math.max(i-this.config.maxFragLookUpTolerance,i*(this.couldBacktrack?.5:.125)),i*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(s,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case Am:case bm:case vm:case Sm:case Em:this.state=ym}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new BA(this.config,i,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;Sc(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const i=this.getMainFwdBufferInfo();null!==i&&0!==i.len?this.tick():this.warn(`Main forward buffer length on "seeked" event ${i?i.len:"empty"})`)}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(Tc.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let i=!1,s=!1;t.levels.forEach((e=>{const t=e.audioCodec;t&&(i=i||-1!==t.indexOf("mp4a.40.2"),s=s||-1!==t.indexOf("mp4a.40.5"))})),this.audioCodecSwitch=i&&s&&!function(){var e;const t=RA();return"function"==typeof(null==t||null==(e=t.prototype)?void 0:e.changeType)}(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==ym)return;const s=i[t.level];(!s.details||s.details.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(s.details))&&(this.state=Lm)}onLevelLoaded(e,t){var i;const{levels:s}=this,r=t.level,o=t.details,a=o.totalduration;if(!s)return void this.warn(`Levels were reset while loading level ${r}`);this.log(`Level ${r} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${a}`);const n=s[r],l=this.fragCurrent;!l||this.state!==bm&&this.state!==vm||l.level!==t.level&&l.loader&&this.abortCurrentFrag();let d=0;if(o.live||null!=(i=n.details)&&i.live){var h;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;d=this.alignPlaylists(o,n.details,null==(h=this.levelLastLoaded)?void 0:h.details)}if(n.details=o,this.levelLastLoaded=n,this.hls.trigger(Tc.LEVEL_UPDATED,{details:o,level:r}),this.state===Lm){if(this.waitForCdnTuneIn(o))return;this.state=ym}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,d),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:s,payload:r}=e,{levels:o}=this;if(!o)return void this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);const a=o[i.level],n=a.details;if(!n)return this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),void this.fragmentTracker.removeFragment(i);const l=a.videoCodec,d=n.PTSKnown||!n.live,h=null==(t=i.initSegment)?void 0:t.data,c=this._getAudioCodec(a),u=this.transmuxer=this.transmuxer||new Ig(this.hls,Pp,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=s?s.index:-1,f=-1!==p,m=new em(i.level,i.sn,i.stats.chunkCount,r.byteLength,p,f),g=this.initPTS[i.cc];u.push(r,h,c,l,i,s,n.totalduration,d,m,g)}onAudioTrackSwitching(e,t){const i=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const e=this.fragCurrent;e&&(this.log("Switching to main audio track, cancel main fragment load"),e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const e=this.hls;i&&(e.trigger(Tc.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),e.trigger(Tc.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=t.id,s=!!this.hls.audioTracks[i].url;if(s){const e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=e)}this.altAudio=s,this.tick()}onBufferCreated(e,t){const i=t.tracks;let s,r,o=!1;for(const e in i){const t=i[e];if("main"===t.id){if(r=e,s=t,"video"===e){const t=i[e];t&&(this.videoBuffer=t.buffer)}}else o=!0}o&&s?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:s}=t;if(i&&i.type!==Pp)return;if(this.fragContextChanged(i))return this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),void(this.state===Em&&(this.state=ym));const r=s?s.stats:i.stats;this.fragLastKbps=Math.round(8*r.total/(r.buffering.end-r.loading.first)),"initSegment"!==i.sn&&(this.fragPrevious=i),this.fragBufferedComplete(i,s)}onError(e,t){var i;if(t.fatal)this.state=Tm;else switch(t.details){case Lc.FRAG_GAP:case Lc.FRAG_PARSING_ERROR:case Lc.FRAG_DECRYPT_ERROR:case Lc.FRAG_LOAD_ERROR:case Lc.FRAG_LOAD_TIMEOUT:case Lc.KEY_LOAD_ERROR:case Lc.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Pp,t);break;case Lc.LEVEL_LOAD_ERROR:case Lc.LEVEL_LOAD_TIMEOUT:case Lc.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Lm||(null==(i=t.context)?void 0:i.type)!==Dp||(this.state=ym);break;case Lc.BUFFER_APPEND_ERROR:case Lc.BUFFER_FULL_ERROR:if(!t.parent||"main"!==t.parent)return;if(t.details===Lc.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case Lc.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}checkBuffer(){const{media:e,gapController:t}=this;if(e&&t&&e.readyState){if(this.loadedmetadata||!Zf.getBuffered(e).length){const e=this.state!==ym?this.fragCurrent:null;t.poll(this.lastCurrentTime,e)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=ym,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Nc||this.audioOnly&&!this.altAudio){const e=(t===jc?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(e,t,Pp),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t0&&(r{const{hls:s}=this;if(!i||this.fragContextChanged(e))return;t.fragmentError=0,this.state=ym,this.startFragRequested=!1,this.bitrateTest=!1;const r=e.stats;r.parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),s.trigger(Tc.FRAG_LOADED,i),e.bitrateTest=!1}))}_handleTransmuxComplete(e){var t;const i="main",{hls:s}=this,{remuxResult:r,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a)return void this.resetWhenMissingContext(o);const{frag:n,part:l,level:d}=a,{video:h,text:c,id3:u,initSegment:p}=r,{details:f}=d,m=this.altAudio?void 0:r.audio;if(this.fragContextChanged(n))this.fragmentTracker.removeFragment(n);else{if(this.state=Sm,p){if(null!=p&&p.tracks){const e=n.initSegment||n;this._bufferInitSegment(d,p.tracks,e,o),s.trigger(Tc.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:p.tracks})}const e=p.initPTS,t=p.timescale;Sc(e)&&(this.initPTS[n.cc]={baseTime:e,timescale:t},s.trigger(Tc.INIT_PTS_FOUND,{frag:n,id:i,initPTS:e,timescale:t}))}if(h&&f&&"initSegment"!==n.sn){const e=f.fragments[n.sn-1-f.startSN],t=n.sn===f.startSN,i=!e||n.cc>e.cc;if(!1!==r.independent){const{startPTS:e,endPTS:s,startDTS:r,endDTS:a}=h;if(l)l.elementaryStreams[h.type]={startPTS:e,endPTS:s,startDTS:r,endDTS:a};else if(h.firstKeyFrame&&h.independent&&1===o.id&&!i&&(this.couldBacktrack=!0),h.dropped&&h.independent){const r=this.getMainFwdBufferInfo(),o=(r?r.end:this.getLoadPosition())+this.config.maxBufferHole,l=h.firstKeyFramePTS?h.firstKeyFramePTS:e;if(!t&&o2&&(n.gap=!0);n.setElementaryStreamInfo(h.type,e,s,r,a),this.backtrackFragment&&(this.backtrackFragment=n),this.bufferFragmentData(h,n,l,o,t||i)}else{if(!t&&!i)return void this.backtrack(n);n.gap=!0}}if(m){const{startPTS:e,endPTS:t,startDTS:i,endDTS:s}=m;l&&(l.elementaryStreams[Nc]={startPTS:e,endPTS:t,startDTS:i,endDTS:s}),n.setElementaryStreamInfo(Nc,e,t,i,s),this.bufferFragmentData(m,n,l,o)}if(f&&null!=u&&null!=(t=u.samples)&&t.length){const e={id:i,frag:n,details:f,samples:u.samples};s.trigger(Tc.FRAG_PARSING_METADATA,e)}if(f&&c){const e={id:i,frag:n,details:f,samples:c.samples};s.trigger(Tc.FRAG_PARSING_USERDATA,e)}}}_bufferInitSegment(e,t,i,s){if(this.state!==Sm)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:r,video:o,audiovideo:a}=t;if(r){let t=e.audioCodec;const i=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){t&&(t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");const e=r.metadata;e&&"channelCount"in e&&1!==(e.channelCount||1)&&-1===i.indexOf("firefox")&&(t="mp4a.40.5")}t&&-1!==t.indexOf("mp4a.40.5")&&-1!==i.indexOf("android")&&"audio/mpeg"!==r.container&&(t="mp4a.40.2",this.log(`Android: force audio codec to ${t}`)),e.audioCodec&&e.audioCodec!==t&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${t}"`),r.levelCodec=t,r.id="main",this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${t||""}/${e.audioCodec||""}/${r.codec}]`)}o&&(o.levelCodec=e.videoCodec,o.id="main",this.log(`Init video buffer, container:${o.container}, codecs[level/parsed]=[${e.videoCodec||""}/${o.codec}]`)),a&&this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${e.codecs}/${a.codec}]`),this.hls.trigger(Tc.BUFFER_CODECS,t),Object.keys(t).forEach((e=>{const r=t[e].initSegment;null!=r&&r.byteLength&&this.hls.trigger(Tc.BUFFER_APPENDING,{type:e,data:r,frag:i,part:null,chunkMeta:s,parent:i.type})})),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,Pp)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=ym}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&!1===e.seeking){const i=e.currentTime;if(Zf.isBuffered(e,i)?t=this.getAppendedFrag(i):Zf.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const e=this.fragPlaying,i=t.level;e&&t.sn===e.sn&&e.level===i||(this.fragPlaying=t,this.hls.trigger(Tc.FRAG_CHANGED,{frag:t}),e&&e.level===i||this.hls.trigger(Tc.LEVEL_SWITCHED,{level:i}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,i=this.currentFrag;if(i&&Sc(t)&&Sc(i.programDateTime)){const e=i.programDateTime+1e3*(t-i.start);return new Date(e)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class MA{static get version(){return"1.5.13"}static isMSESupported(){return PA()}static isSupported(){return function(){if(!PA())return!1;const e=rp();return"function"==typeof(null==e?void 0:e.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some((t=>e.isTypeSupported(lp(t,"video"))))||["mp4a.40.2","fLaC"].some((t=>e.isTypeSupported(lp(t,"audio")))))}()}static getMediaSource(){return rp()}static get Events(){return Tc}static get ErrorTypes(){return kc}static get ErrorDetails(){return Lc}static get DefaultConfig(){return MA.defaultConfig?MA.defaultConfig:wA}static set DefaultConfig(e){MA.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new Bg,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,function(e,t){if("object"==typeof console&&!0===e||"object"==typeof e){Rc(e,"debug","log","info","warn","error");try{xc.log(`Debug logs enabled for "${t}" in hls.js version 1.5.13`)}catch(e){xc=Dc}}else xc=Dc}(e.debug||!1,"Hls instance");const t=this.config=function(e,t){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=TA(e),s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach((e=>{const r=`${"level"===e?"playlist":e}LoadPolicy`,o=void 0===t[r],a=[];s.forEach((s=>{const n=`${e}Loading${s}`,l=t[n];if(void 0!==l&&o){a.push(n);const e=i[r].default;switch(t[r]={default:e},s){case"TimeOut":e.maxLoadTimeMs=l,e.maxTimeToFirstByteMs=l;break;case"MaxRetry":e.errorRetry.maxNumRetry=l,e.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":e.errorRetry.retryDelayMs=l,e.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":e.errorRetry.maxRetryDelayMs=l,e.timeoutRetry.maxRetryDelayMs=l}}})),a.length&&Pc.warn(`hls.js config: "${a.join('", "')}" setting(s) are deprecated, use "${r}": ${JSON.stringify(t[r])}`)})),Ac(Ac({},i),t)}(MA.DefaultConfig,e);this.userConfig=e,t.progressive&&kA(t);const{abrController:i,bufferController:s,capLevelController:r,errorController:o,fpsController:a}=t,n=new o(this),l=this.abrController=new i(this),d=this.bufferController=new s(this),h=this.capLevelController=new r(this),c=new a(this),u=new Up(this),p=new Yp(this),f=t.contentSteeringController,m=f?new f(this):null,g=this.levelController=new CA(this,m),y=new Kf(this),A=new xA(this.config),b=this.streamController=new IA(this,y,A);h.setStreamController(b),c.setStreamController(b);const v=[u,g,b];m&&v.splice(1,0,m),this.networkControllers=v;const _=[l,d,h,c,p,y];this.audioTrackController=this.createController(t.audioTrackController,v);const S=t.audioStreamController;S&&v.push(new S(this,y,A)),this.subtitleTrackController=this.createController(t.subtitleTrackController,v);const E=t.subtitleStreamController;E&&v.push(new E(this,y,A)),this.createController(t.timelineController,_),A.emeController=this.emeController=this.createController(t.emeController,_),this.cmcdController=this.createController(t.cmcdController,_),this.latencyController=this.createController(Qp,_),this.coreComponents=_,v.push(n);const w=n.onErrorOut;"function"==typeof w&&this.on(Tc.ERROR,w,n)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,s){this._emitter.off(e,t,i,s)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(Pc.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),!this.triggeringException){this.triggeringException=!0;const i=e===Tc.ERROR;this.trigger(Tc.ERROR,{type:kc.OTHER_ERROR,details:Lc.INTERNAL_EXCEPTION,fatal:i,event:e,error:t}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){Pc.log("destroy"),this.trigger(Tc.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach((e=>e.destroy())),this.networkControllers.length=0,this.coreComponents.forEach((e=>e.destroy())),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){Pc.log("attachMedia"),this._media=e,this.trigger(Tc.MEDIA_ATTACHING,{media:e})}detachMedia(){Pc.log("detachMedia"),this.trigger(Tc.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,i=this.url,s=this.url=gc.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,Pc.log(`loadSource:${s}`),t&&i&&(i!==s||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(Tc.MANIFEST_LOADING,{url:e})}startLoad(e=-1){Pc.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach((t=>{t.startLoad(e)}))}stopLoad(){Pc.log("stopLoad"),this.started=!1,this.networkControllers.forEach((e=>{e.stopLoad()}))}resumeBuffering(){this.started&&this.networkControllers.forEach((e=>{"fragmentLoader"in e&&e.startLoad(-1)}))}pauseBuffering(){this.networkControllers.forEach((e=>{"fragmentLoader"in e&&e.stopLoad()}))}swapAudioCodec(){Pc.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){Pc.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){Pc.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){Pc.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){Pc.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){Pc.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return-1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){Pc.log(`set startLevel:${e}`),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(Pc.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){(function(e){return Xp.indexOf(e)>-1})(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return-1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let s=0;s=t)return s;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let s;if(s=-1===t&&null!=e&&e.length?e.length-1:t,i)for(let t=s;t--;){const s=e[t].attrs["HDCP-LEVEL"];if(s&&s<=i)return t}return s}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return null==(t=this.audioTrackController)?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return null==(t=this.subtitleTrackController)||t.setSubtitleOption(e),null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return!!e&&e.subtitleDisplay}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}MA.defaultConfig=void 0;class FA extends wa{constructor(e){super(),this.player=e,this.TAG_NAME="HlsDecoder",e._opt,this.canVideoPlay=!1,this.$videoElement=null,this.canvasRenderInterval=null,this.bandwidthEstimateInterval=null,this.fpsInterval=null,this.hlsFps=0,this.hlsPrevFrams=0,this.isInitInfo=!1,this.eventsDestroy=[],this.supportVideoFrameCallbackHandle=null,this.player.isHlsCanVideoPlay()?(this.$videoElement=this.player.video.$videoElement,this.canVideoPlay=!0):MA.isSupported()?(this.$videoElement=this.player.video.$videoElement,this.hls=new MA({}),this._initHls(),this._bindEvents()):this.player.debugError(this.TAG_NAME,"init hls error ,not support "),this.player.debugLog(this.TAG_NAME,"init")}destroy(){return new Promise(((e,t)=>{if(this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.hls&&(this.hls.destroy(),this.hls=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this.isInitInfo=!1,this._stopCanvasRender(),this._stopBandwidthEstimateInterval(),this._stopFpsInterval(),this.player._opt.useCanvasRender&&this.$videoElement){this.$videoElement.pause&&(this.$videoElement.pause(),this.$videoElement.muted=!0),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"));try{this.$videoElement.load()}catch(e){}}this.$videoElement=null,this.hlsFps=0,this.player.debugLog(this.TAG_NAME,"destroy"),setTimeout((()=>{e()}),0)}))}checkHlsBufferedDelay(){const e=this.$videoElement;let t=0;const i=e.buffered,s=i.length?i.end(i.length-1):0;return t=s-e.currentTime,t<0&&(this.player.debugWarn(this.TAG_NAME,`checkHlsBufferedDelay ${t} < 0, and buffered is ${s} ,currentTime is ${e.currentTime} , try to seek ${e.currentTime} to ${s}`),e.currentTime=s,t=0),t}getFps(){return this.hlsFps}_startCanvasRender(){ba()?this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)):(this._stopCanvasRender(),this.canvasRenderInterval=setInterval((()=>{this.player.video.render({$video:this.$videoElement,ts:parseInt(1e3*this.$videoElement.currentTime,10)||0})}),40))}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())return void this.player.debugLog(this.TAG_NAME,"videoFrameCallback() player is destroyed");const i=parseInt(1e3*Math.max(t.mediaTime,this.$videoElement.currentTime),10)||0;this.player.video.render({$video:this.$videoElement,ts:i}),this.player.handleRender(),this.player.updateStats({dts:i}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}_startBandwidthEstimateInterval(){this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((()=>{let e=0;this.hls.bandwidthEstimate&&(e=this.hls.bandwidthEstimate),this.player.emit(ot.kBps,(e/1024/8/10).toFixed(2))}),1e3)}_stopBandwidthEstimateInterval(){this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}_startFpsInterval(){this._stopCanvasRender(),this.fpsInterval=setInterval((()=>{if(this.$videoElement)if(Ko(this.$videoElement.getVideoPlaybackQuality)){const e=this.$videoElement.getVideoPlaybackQuality();this.hlsFps=e.totalVideoFrames-this.hlsPrevFrams,this.hlsPrevFrams=e.totalVideoFrames}else{const e=this.$videoElement.webkitDecodedFrameCount||0;this.hlsFps=e-this.hlsPrevFrams,this.hlsPrevFrams=e}}),1e3)}_stopFpsInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_initHls(){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.$videoElement.muted=!0,mo()&&(this.$videoElement.style.position="absolute"),this.initVideoEvents()),this.hls.attachMedia(this.$videoElement)}_bindEvents(){const e=this.player,{proxy:t}=this.player.events;this.hls;const i=this.$videoElement,s=ba(),r=t(i,Zi,(t=>{if(this.hls){const i=parseInt(t.timeStamp,10);this.player._opt.useCanvasRender&&pa(s)&&e.updateStats({ts:i,dts:i})}}));this.eventsDestroy.push(r),this._startBandwidthEstimateInterval(),this._startFpsInterval(),this.hls.on(MA.Events.ERROR,((e,t)=>{if(t.fatal)switch(t.type){case MA.ErrorTypes.NETWORK_ERROR:this.player.debugWarn(this.TAG_NAME,"fatal network error encountered, try to recover"),this.hls.startLoad();break;case MA.ErrorTypes.MEDIA_ERROR:this.player.debugWarn(this.TAG_NAME,"fatal media error encountered, try to recover"),this.hls.recoverMediaError()}})),this.hls.on(MA.Events.MEDIA_ATTACHING,(()=>{})),this.hls.on(MA.Events.MEDIA_ATTACHED,(()=>{})),this.hls.on(MA.Events.MEDIA_DETACHING,(()=>{})),this.hls.on(MA.Events.MEDIA_DETACHED,(()=>{})),this.hls.on(MA.Events.BUFFER_RESET,(()=>{})),this.hls.on(MA.Events.BUFFER_CODECS,(()=>{})),this.hls.on(MA.Events.BUFFER_CREATED,(()=>{})),this.hls.on(MA.Events.BUFFER_APPENDING,((e,t)=>{this.player.debugLog(this.TAG_NAME,"BUFFER_APPENDING",t.type)})),this.hls.on(MA.Events.BUFFER_APPENDED,(()=>{})),this.hls.on(MA.Events.BUFFER_EOS,(()=>{})),this.hls.on(MA.Events.BUFFER_FLUSHING,(()=>{})),this.hls.on(MA.Events.BUFFER_FLUSHED,(()=>{})),this.hls.on(MA.Events.MANIFEST_LOADING,(()=>{this.player.debugLog(this.TAG_NAME,"MANIFEST_LOADING 开始加载playlist m3u8资源")})),this.hls.on(MA.Events.MANIFEST_LOADED,((e,t)=>{this.player.debugLog(this.TAG_NAME,"MANIFEST_LOADED playlist m3u8文件加载完成",t.url)})),this.hls.on(MA.Events.MANIFEST_PARSED,(()=>{this.player.debugLog(this.TAG_NAME,"MANIFEST_PARSED playlist m3u8解析完成"),e._times.demuxStart||(e._times.demuxStart=eo())})),this.hls.on(MA.Events.LEVEL_LOADING,(()=>{})),this.hls.on(MA.Events.LEVEL_LOADED,((e,t)=>{})),this.hls.on(MA.Events.FRAG_LOADING,(()=>{})),this.hls.on(MA.Events.FRAG_LOADED,((t,i)=>{e._times.decodeStart||(e._times.decodeStart=eo())})),this.hls.on(MA.Events.BUFFER_APPENDING,(()=>{e._times.videoStart||(e._times.videoStart=eo(),e.handlePlayToRenderTimes())})),this.hls.on(MA.Events.FRAG_DECRYPTED,(()=>{})),this.hls.on(MA.Events.KEY_LOADING,(()=>{})),this.hls.on(MA.Events.KEY_LOADING,(()=>{})),this.hls.on(MA.Events.FPS_DROP,(e=>{})),this.hls.on(MA.Events.FPS_DROP_LEVEL_CAPPING,(e=>{})),this.hls.on(MA.Events.FRAG_PARSING_INIT_SEGMENT,((e,t)=>{this.player.debugLog(this.TAG_NAME,"FRAG_PARSING_INIT_SEGMENT",t);const i=!!(t&&t.tracks&&t.tracks.audio),s=!!(t&&t.tracks&&t.tracks.video);if(i&&t.tracks.audio){let e=t.tracks.audio;const i=e.metadata&&e.metadata.channelCount?e.metadata.channelCount:0,s=e.codec;this.player.audio&&this.player.audio.updateAudioInfo({encType:s,channels:i,sampleRate:44100})}if(s&&t.tracks.video){let e=t.tracks.video;const i={encTypeCode:-1!==e.codec.indexOf("avc")?yt:At};e.metadata&&(i.width=e.metadata.width,i.height=e.metadata.height),this.player.video&&this.player.video.updateVideoInfo(i)}}))}initVideoPlay(e){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.initVideoEvents()),this.$videoElement.autoplay=!0,this.$videoElement.muted=!0,this.$videoElement.src=e}_initRenderSize(){this.isInitInfo||(this.player.video.updateVideoInfo({width:this.$videoElement.videoWidth,height:this.$videoElement.videoHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0)}initVideoEvents(){const{proxy:e}=this.player.events,t=e(this.$videoElement,Qi,(()=>{this.player.debugLog(this.TAG_NAME,"video canplay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video play"),this._startCanvasRender(),this._initRenderSize()})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video play error ",e)}))})),i=e(this.$videoElement,Xi,(()=>{this.player.debugLog(this.TAG_NAME,"video waiting")})),s=e(this.$videoElement,Zi,(e=>{const t=parseInt(e.timeStamp,10);this.player.handleRender(),this.player.updateStats({ts:t}),this.$videoElement.paused&&(this.player.debugWarn(this.TAG_NAME,"video is paused and next try to replay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video is paused and replay success")})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video is paused and replay error ",e)})))})),r=e(this.$videoElement,es,(()=>{this.player.debugLog(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate)}));this.eventsDestroy.push(t,i,s,r)}loadSource(e){return new Promise(((t,i)=>{this.canVideoPlay?(this.initVideoPlay(e),t()):this.hls.on(MA.Events.MEDIA_ATTACHED,(()=>{this.hls.loadSource(e),t()}))}))}}const UA=2097152,OA="fetch",NA="xhr",jA="arraybuffer",GA="text",zA="json",WA="real_time_speed",VA=Object.prototype.toString;function HA(e){if("[object Object]"!==VA.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function $A(e){if(!e||null===e[0]||void 0===e[0]||0===e[0]&&(null===e[1]||void 0===e[1]))return;let t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}function JA(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function qA(e,t){if(!e)return;if(!t)return e;let i;const s=Object.keys(t).map((e=>{if(i=t[e],null!=i)return Array.isArray(i)?e+="[]":i=[i],i.map((t=>{var i;return i=t,"[object Date]"===VA.call(i)?t=t.toISOString():function(e){return null!==e&&"object"==typeof e}(t)&&(t=JSON.stringify(t)),`${JA(e)}=${JA(t)}`})).join("&")})).filter(Boolean).join("&");if(s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}function KA(e,t,i,s,r,o,a,n,l,d,h){r=null!=r?parseFloat(r):null,s=parseInt(s||"0",10),Number.isNaN(s)&&(s=0);return{data:e,done:t,option:{range:l,vid:d,index:n,contentLength:s,age:r,startTime:o,firstByteTime:a,endTime:Date.now(),priOptions:h},response:i}}function YA(e,t){return Math.round(8*e*1e3/t/1024)}class QA extends Error{constructor(e,t,i,s){super(s),nh(this,"retryCount",0),nh(this,"isTimeout",!1),nh(this,"loaderType",OA),nh(this,"startTime",0),nh(this,"endTime",0),nh(this,"options",{}),this.url=e,this.request=t,this.response=i}}class XA extends wa{constructor(e){super(),nh(this,"_abortController",null),nh(this,"_timeoutTimer",null),nh(this,"_reader",null),nh(this,"_response",null),nh(this,"_aborted",!1),nh(this,"_index",-1),nh(this,"_range",null),nh(this,"_receivedLength",0),nh(this,"_running",!1),nh(this,"_logger",null),nh(this,"_vid",""),nh(this,"_onProcessMinLen",0),nh(this,"_onCancel",null),nh(this,"_priOptions",null),nh(this,"TAG_NAME","FetchLoader"),this.player=e}load(e){var t;let{url:i,vid:s,timeout:r,responseType:o,onProgress:a,index:n,onTimeout:l,onCancel:d,range:h,transformResponse:c,request:u,params:p,logger:f,method:m,headers:g,body:y,mode:A,credentials:b,cache:v,redirect:_,referrer:S,referrerPolicy:E,onProcessMinLen:w,priOptions:T}=e;this._aborted=!1,this._onProcessMinLen=w,this._onCancel=d,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=n,this._range=h||[0,0],this._vid=s||i,this._priOptions=T||{};const k={method:m,headers:g,body:y,mode:A,credentials:b,cache:v,redirect:_,referrer:S,referrerPolicy:E,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal};let L=!1;clearTimeout(this._timeoutTimer),i=qA(i,p);const C=$A(h);C&&(g=u?u.headers:k.headers=k.headers||(Headers?new Headers:{}),Headers&&g instanceof Headers?g.append("Range",C):g.Range=C),r&&(this._timeoutTimer=setTimeout((()=>{if(L=!0,this.cancel(),l){const e=new QA(i,k,null,"timeout");e.isTimeout=!0,l(e,{index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions})}}),r));const D=Date.now();return(xo(n)||xo(h))&&this.player.debugLog(this.TAG_NAME,"[fetch load start], index,",n,",range,",h),new Promise(((e,t)=>{fetch(u||i,u?void 0:k).then((async s=>{if(clearTimeout(this._timeoutTimer),this._response=s,this._aborted||!this._running)return;if(c&&(s=c(s,i)||s),!s.ok)throw new QA(i,k,s,"bad network response");const r=Date.now();let l;if(o===GA)l=await s.text(),this._running=!1;else if(o===zA)l=await s.json(),this._running=!1;else{if(a)return this.resolve=e,this.reject=t,void this._loadChunk(s,a,D,r);{l=await s.arrayBuffer(),l=new Uint8Array(l),this._running=!1;const e=Date.now()-D,t=YA(l.byteLength,e);this.emit(WA,{speed:t,len:l.byteLength,time:e,vid:this._vid,index:this._index,range:this._range,priOptions:this._priOptions})}}(xo(n)||xo(h))&&this.player.debugLog(this.TAG_NAME,"[fetch load end], index,",n,",range,",h),e(KA(l,!0,s,s.headers.get("Content-Length"),s.headers.get("age"),D,r,n,h,this._vid,this._priOptions))})).catch((e=>{var s;clearTimeout(this._timeoutTimer),this._running=!1,this._aborted&&!L||((e=e instanceof QA?e:new QA(i,k,null,null===(s=e)||void 0===s?void 0:s.message)).startTime=D,e.endTime=Date.now(),e.isTimeout=L,e.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},t(e))}))}))}async cancel(){if(!this._aborted){if(this._aborted=!0,this._running=!1,this._response){try{this._reader&&await this._reader.cancel()}catch(e){}this._response=this._reader=null}if(this._abortController){try{this._abortController.abort()}catch(e){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions})}}_loadChunk(e,t,i,s){if(!e.body||!e.body.getReader){this._running=!1;const t=new QA(e.url,"",e,"onProgress of bad response.body.getReader");return t.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(t)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(UA),this._writeIdx=0);const r=this._reader=e.body.getReader();let o,a,n;const l=async()=>{var d;a=Date.now();try{o=await r.read(),n=Date.now()}catch(e){return n=Date.now(),void(this._aborted||(this._running=!1,e.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this.reject(e)))}const h=(null===(d=this._range)||void 0===d?void 0:d.length)>0?this._range[0]:0,c=h+this._receivedLength;if(this._aborted)return this._running=!1,void t(void 0,!1,{range:[c,c],vid:this._vid,index:this._index,startTime:a,endTime:n,st:i,firstByteTime:s,priOptions:this._priOptions},e);const u=o.value?o.value.byteLength:0;let p;if(this._receivedLength+=u,this.player.debugLog(this.TAG_NAME,"【fetchLoader,onProgress call】,task,",this._range,", start,",c,", end,",h+this._receivedLength,", done,",o.done),this._onProcessMinLen>0){if(this._writeIdx+u>=this._onProcessMinLen||o.done)p=new Uint8Array(this._writeIdx+u),p.set(this._cache.slice(0,this._writeIdx),0),u>0&&p.set(o.value,this._writeIdx),this._writeIdx=0,this.player.debugLog(this.TAG_NAME,"【fetchLoader,onProgress enough】,done,",o.done,",len,",p.byteLength,", writeIdx,",this._writeIdx);else if(u>0&&this._writeIdx+u0){const e=new Uint8Array(this._writeIdx+u+2048);this.player.debugLog(this.TAG_NAME,"【fetchLoader,onProgress extra start】,size,",this._writeIdx+u+2048,", datalen,",u,", writeIdx,",this._writeIdx),e.set(this._cache.slice(0,this._writeIdx),0),u>0&&e.set(o.value,this._writeIdx),this._writeIdx+=u,delete this._cache,this._cache=e,this.player.debugLog(this.TAG_NAME,"【fetchLoader,onProgress extra end】,len,",u,", writeIdx,",this._writeIdx)}}else p=o.value;if((p&&p.byteLength>0||o.done)&&t(p,o.done,{range:[this._range[0]+this._receivedLength-(p?p.byteLength:0),this._range[0]+this._receivedLength],vid:this._vid,index:this._index,startTime:a,endTime:n,st:i,firstByteTime:s,priOptions:this._priOptions},e),o.done){const t=Date.now()-i,r=YA(this._receivedLength,t);this.emit(WA,{speed:r,len:this._receivedLength,time:t,vid:this._vid,index:this._index,range:this._range,priOptions:this._priOptions}),this._running=!1,this.player.debugLog(this.TAG_NAME,"[fetchLoader onProgress end],task,",this._range,",done,",o.done),this.resolve(KA(o,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),i,s,this._index,this._range,this._vid,this._priOptions))}else l()};l()}get receiveLen(){return this._receivedLength}get running(){return this._running}set running(e){this._running=e}static isSupported(){return!("undefined"==typeof fetch)}}class ZA{constructor(e,t,i){nh(this,"TAG_NAME","Task"),this.promise=function(){let e,t;const i=new Promise(((i,s)=>{e=i,t=s}));return i.used=!1,i.resolve=function(){return i.used=!0,e(...arguments)},i.reject=function(){return i.used=!0,t(...arguments)},i}(),this.alive=!!t.onProgress,this._loaderType=e,this.player=i,this._loader=e===OA&&window.fetch?new XA(i):new eb(i),this._config=t,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=t.retryCheckFunc}exec(){const{retry:e,retryDelay:t,onRetryError:i,transformError:s,...r}=this._config,o=async()=>{try{const e=await this._loader.load(r);this.promise.resolve(e)}catch(a){if(this._loader.running=!1,this.player.debugLog(this.TAG_NAME,"[task request catch err]",a),this._canceled)return;a.loaderType=this._loaderType,a.retryCount=this._retryCount;let n=a;s&&(n=s(n)||n),i&&this._retryCount>0&&i(n,this._retryCount,{index:r.index,vid:r.vid,range:r.range,priOptions:r.priOptions}),this._retryCount++;let l=!0;if(this._retryCheckFunc&&(l=this._retryCheckFunc(a)),l&&this._retryCount<=e)return clearTimeout(this._retryTimer),this.player.debugLog(this.TAG_NAME,"[task request setTimeout],retry",this._retryCount,",retry range,",r.range),void(this._retryTimer=setTimeout(o,t));this.promise.reject(n)}};return o(),this.promise}async cancel(){return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,this._loader.cancel()}get running(){return this._loader&&this._loader.running}get loader(){return this._loader}}class eb extends wa{constructor(e){super(),nh(this,"_xhr",null),nh(this,"_aborted",!1),nh(this,"_timeoutTimer",null),nh(this,"_range",null),nh(this,"_receivedLength",0),nh(this,"_url",null),nh(this,"_onProgress",null),nh(this,"_index",-1),nh(this,"_headers",null),nh(this,"_currentChunkSizeKB",384),nh(this,"_timeout",null),nh(this,"_xhr",null),nh(this,"_withCredentials",null),nh(this,"_startTime",-1),nh(this,"_loadCompleteResolve",null),nh(this,"_loadCompleteReject",null),nh(this,"_runing",!1),nh(this,"_logger",!1),nh(this,"_vid",""),nh(this,"_responseType",void 0),nh(this,"_credentials",void 0),nh(this,"_method",void 0),nh(this,"_transformResponse",void 0),nh(this,"_firstRtt",void 0),nh(this,"_onCancel",null),nh(this,"_priOptions",null),nh(this,"TAG_NAME","XhrLoader"),this.player=e}load(e){clearTimeout(this._timeoutTimer),this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this.player.debugLog(this.TAG_NAME,"【xhrLoader task】, range",this._range),this._url=qA(e.url,e.params);const t=Date.now();return new Promise(((e,t)=>{this._loadCompleteResolve=e,this._loadCompleteReject=t,this._startLoad()})).catch((e=>{if(clearTimeout(this._timeoutTimer),this._runing=!1,!this._aborted)throw(e=e instanceof QA?e:new QA(this._url,this._request)).startTime=t,e.endTime=Date.now(),e.options={index:this._index,vid:this._vid,priOptions:this._priOptions},e}))}_startLoad(){let e=null;if(this._responseType===jA&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;const t=1024*this._currentChunkSizeKB,i=this._range[0]+this._receivedLength;let s=this._range[1];t],tast :",this._range,", SubRange, ",e)}else e=this._range,this.player.debugLog(this.TAG_NAME,"[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}_internalOpen(e){try{this._startTime=Date.now();const t=this._xhr=new XMLHttpRequest;t.open(this._method||"GET",this._url,!0),t.responseType=this._responseType,this._timeout&&(t.timeout=this._timeout),t.withCredentials=this._withCredentials,t.onload=this._onLoad.bind(this),t.onreadystatechange=this._onReadyStatechange.bind(this),t.onerror=e=>{var t,i,s;this._running=!1;const r=new QA(this._url,this._request,null==e||null===(t=e.currentTarget)||void 0===t?void 0:t.response,"xhr.onerror.status:"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.status)+",statusText,"+(null==e||null===(s=e.currentTarget)||void 0===s?void 0:s.statusText));r.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(r)},t.ontimeout=e=>{this.cancel();const t=new QA(this._url,this._request,{status:408},"timeout");this._onTimeout&&(t.isTimeout=!0,this._onTimeout(t,{index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions})),t.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)};const i=this._headers||{},s=$A(e);s&&(i.Range=s),i&&Object.keys(i).forEach((e=>{t.setRequestHeader(e,i[e])})),this.player.debugLog(this.TAG_NAME,"[xhr.send->] tast,",this._range,",load sub range, ",e),t.send(this._body)}catch(t){t.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}}_onReadyStatechange(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}_onLoad(e){var t;const i=e.target.status;if(i<200||i>299){const t=new QA(this._url,null,{...e.target.response,status:i},"bad response,status:"+i);return t.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}let s,r=null,o=!1;const a=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===jA){var n;const t=new Uint8Array(e.target.response);if(s=a+this._receivedLength,t&&t.byteLength>0){this._receivedLength+=t.byteLength;const e=Date.now()-this._startTime,i=YA(this._receivedLength,e);this.emit(WA,{speed:i,len:this._receivedLength,time:e,vid:this._vid,index:this._index,range:[s,a+this._receivedLength],priOptions:this._priOptions})}r=t,o=!((null===(n=this._range)||void 0===n?void 0:n.length)>1&&this._range[1]&&this._receivedLength], tast :",this._range,", start",s,"end ",a+this._receivedLength,",dataLen,",t?t.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",o)}else o=!0,r=e.target.response;let l={ok:i>=200&&i<300,status:i,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(l=this._transformResponse(l,this._url)||l),this._onProgress&&this._onProgress(r,o,{index:this._index,vid:this._vid,range:[s,a+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},l),o?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(KA(this._onProgress?null:r,o,l,l.headers["content-length"],l.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}cancel(){if(!this._aborted)return this._aborted=!0,this._runing=!1,super.removeAllListeners(),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}static isSupported(){return"undefined"!=typeof XMLHttpRequest}get receiveLen(){return this._receivedLength}get running(){return this._running}set running(e){this._running=e}_getHeaders(e){const t=e.getAllResponseHeaders().trim().split("\r\n"),i={};for(const e of t){const t=e.split(": ");i[t[0].toLowerCase()]=t.slice(1).join(": ")}return i}}class tb extends wa{constructor(e,t){super(),nh(this,"type",OA),nh(this,"_queue",[]),nh(this,"_alive",[]),nh(this,"_currentTask",null),nh(this,"_config",void 0),this.player=t,this._config=function(e){return{loaderType:OA,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:GA,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0,...e}}(e),this._config.loaderType!==NA&&XA.isSupported()||(this.type=NA)}destroy(){this._queue=[],this._alive=[],this._currentTask=null}isFetch(){return this.type===OA}static isFetchSupport(){return XA.isSupported()}load(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?t=e:t.url=e||t.url||this._config.url,t=Object.assign({},this._config,t),t.params&&(t.params=Object.assign({},t.params)),t.headers&&HA(t.headers)&&(t.headers=Object.assign({},t.headers)),t.body&&HA(t.body)&&(t.body=Object.assign({},t.body)),t.transformRequest&&(t=t.transformRequest(t)||t);const i=new ZA(this.type,t,this.player);return i.loader.on(WA,(e=>{this.emit(WA,e)})),this._queue.push(i),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),i.promise}async cancel(){const e=this._queue.map((e=>e.cancel())).concat(this._alive.map((e=>e.cancel())));this._currentTask&&e.push(this._currentTask.cancel()),this._queue=[],this._alive=[],await Promise.all(e),await function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((t=>setTimeout(t,e)))}()}_processTask(){if(this._currentTask=this._queue.shift(),!this._currentTask)return;this._currentTask.alive&&this._alive.push(this._currentTask);const e=this._currentTask.exec().catch((e=>{}));e&&"function"==typeof e.finally&&e.finally((()=>{var e,t;null!==(e=this._currentTask)&&void 0!==e&&e.alive&&(null===(t=this._alive)||void 0===t?void 0:t.length)>0&&(this._alive=this._alive.filter((e=>e&&e!==this._currentTask))),this._processTask()}))}}const ib="network",sb="network_timeout",rb="other",ob="manifest",ab="hls",nb="demux";class lb extends Error{constructor(e,t,i,s,r){super(r||(null==i?void 0:i.message)),this.errorType=e===sb?ib:e,this.originError=i,this.ext=s,this.errorMessage=this.message}static create(e,t,i,s,r){return e instanceof lb?e:(e instanceof Error&&(i=e,e=""),e||(e=rb),new lb(e,t,i,s,r))}static network(e){var t;return new lb(null!=e&&e.isTimeout?sb:ib,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(t=e.response)||void 0===t?void 0:t.status})}}const db=/^#(EXT[^:]*)(?::(.*))?$/,hb=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g,cb=/^(?:[a-zA-Z0-9+\-.]+:)?\/\//,ub=/^((?:[a-zA-Z0-9+\-.]+:)?\/\/[^/?#]*)?([^?#]*\/)?/;function pb(e){const t=e.match(db);if(t&&t[1])return[t[1].replace("EXT-X-",""),t[2]]}function fb(e){const t={};let i=hb.exec(e);for(;i;)t[i[1]]=i[2]||i[3],i=hb.exec(e);return t}function mb(e,t){if(!t||!e||cb.test(e))return e;const i=ub.exec(t);return i?"/"===e[0]?i[1]+e:i[1]+i[2]+e:e}const gb={audio:[/^mp4a/,/^vorbis$/,/^opus$/,/^flac$/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]};function yb(e,t){const i=gb[e];if(i&&t&&t.length)for(let e=0;e>8*(15-t)&255}}}class Cb{static parse(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if(!e.includes("#EXTM3U"))throw new Error("Invalid m3u8 file");const i=function(e){return e.split(/[\r\n]/).map((e=>e.trim())).filter(Boolean)}(e);return Cb.isMediaPlaylist(e)?function(e,t){const i=new Tb;i.url=t;let s,r=new kb,o=null,a=null,n=0,l=0,d=0,h=0,c=!1;for(;(s=e[h++])&&!c;){if("#"!==s[0]){r.sn=l,r.cc=d,r.url=mb(s,t),a&&(r.key=a.clone(l)),o&&(r.initSegment=o),i.segments.push(r),r=new kb,l++;continue}const e=pb(s);if(!e)continue;const[h,u]=e;switch(h){case"VERSION":i.version=parseInt(u);break;case"PLAYLIST-TYPE":i.type=null==u?void 0:u.toUpperCase();break;case"TARGETDURATION":i.targetDuration=parseFloat(u);break;case"ENDLIST":{const e=i.segments[i.segments.length-1];e&&(e.isLast=!0),i.live=!1,c=!0}break;case"MEDIA-SEQUENCE":l=i.startSN=parseInt(u);break;case"DISCONTINUITY-SEQUENCE":d=i.startCC=parseInt(u);break;case"DISCONTINUITY":d++;break;case"BYTERANGE":r.setByteRange(u,i.segments[i.segments.length-1]);break;case"EXTINF":{const[e,t]=u.split(",");r.start=n,r.duration=parseFloat(e),n+=r.duration,r.title=t}break;case"KEY":{const e=fb(u);if("NONE"===e.METHOD){a=null;break}if("AES-128"!==e.METHOD)throw new Error(`encrypt ${e.METHOD}/${e.KEYFORMAT} is not supported`);if(a=new Lb,a.method=e.METHOD,a.url=/^blob:/.test(e.URI)?e.URI:mb(e.URI,t),a.keyFormat=e.KEYFORMAT||"identity",a.keyFormatVersions=e.KEYFORMATVERSIONS,e.IV){let t=e.IV.slice(2);t=(1&t.length?"0":"")+t,a.iv=new Uint8Array(t.length/2);for(let e=0,i=t.length/2;e{e.id=t})),o.length&&(o.forEach(((e,t)=>{e.id=t})),i.streams.forEach((e=>{e.audioGroup&&(e.audioStreams=o.filter((t=>t.group===e.audioGroup)))}))),a.length&&(a.forEach(((e,t)=>{e.id=t})),i.streams.forEach((e=>{e.subtitleGroup&&(e.subtitleStreams=a.filter((t=>t.group===e.subtitleGroup)))}))),i}(i,t)}static isMediaPlaylist(e){return e.includes("#EXTINF:")||e.includes("#EXT-X-TARGETDURATION:")}}class Db{constructor(e){nh(this,"_onLoaderRetry",((e,t)=>{this.hls.emit(Ps,{error:lb.network(e),retryTime:t})})),this.hls=e,this.player=e.player,this.TAG_NAME="HlsManifestLoader",this._timer=null;const{retryCount:t,retryDelay:i,loadTimeout:s,fetchOptions:r}=this.hls.config;this._loader=new tb({...r,responseType:"text",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._audioLoader=new tb({...r,responseType:"text",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._subtitleLoader=new tb({...r,responseType:"text",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player)}async destroy(){await this.stopPoll(),this._audioLoader&&(this._audioLoader.destroy(),this._audioLoader=null),this._subtitleLoader&&(this._subtitleLoader.destroy(),this._subtitleLoader=null),this._loader&&(this._loader.destroy(),this._loader=null)}async load(e,t,i){this.player.debugLog(this.TAG_NAME,"load()",e,t,i);const s=[this._loader.load(e)];let r,o,a,n,l,d;t&&s.push(this._audioLoader.load(t)),i&&s.push(this._subtitleLoader.load(i));try{const[e,i,n]=await Promise.all(s);if(!e)return[];r=e.data,t?(o=null==i?void 0:i.data,a=null==n?void 0:n.data):a=null==i?void 0:i.data}catch(e){throw lb.network(e)}try{var h;if(n=Cb.parse(r,e),!1===(null===(h=n)||void 0===h?void 0:h.live)&&n.segments&&!n.segments.length)throw new Error("empty segments list");o&&(l=Cb.parse(o,t)),a&&(d=Cb.parse(a,i))}catch(e){throw new lb(ob,ab,e)}return n&&(n.isMaster?this.hls.emit(ks,{playlist:n}):this.hls.emit(Ls,{playlist:n})),[n,l,d]}poll(e,t,i,s,r,o){clearTimeout(this._timer),o=o||3e3;let a=this.hls.config.pollRetryCount;const n=async()=>{clearTimeout(this._timer);try{const r=await this.load(e,t,i);if(!r[0])return;a=this.hls.config.pollRetryCount,s(r[0],r[1],r[2])}catch(e){a--,a<=0&&r(e)}this._timer=setTimeout(n,o)};this._timer=setTimeout(n,o)}stopPoll(){return clearTimeout(this._timer),this.cancel()}cancel(){return Promise.all([this._loader.cancel(),this._audioLoader.cancel()])}}class xb{constructor(){nh(this,"_chunkSpeeds",[]),nh(this,"_speeds",[])}addRecord(e,t){e&&t&&(this._speeds.push(8e3*e/t),this._speeds=this._speeds.slice(-3))}addChunkRecord(e,t){e&&t&&(this._chunkSpeeds.push(8e3*e/t),this._chunkSpeeds=this._chunkSpeeds.slice(-100))}getAvgSpeed(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds.reduce(((e,t)=>e+t))/this._speeds.length:this._chunkSpeeds.reduce(((e,t)=>e+t))/this._chunkSpeeds.length:0}getLatestSpeed(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds[this._speeds.length-1]:this._chunkSpeeds[this._chunkSpeeds.length-1]:0}reset(){this._chunkSpeeds=[],this._speeds=[]}}class Rb{constructor(e){nh(this,"_emitOnLoaded",((e,t)=>{const{data:i,response:s,option:r}=e,{firstByteTime:o,startTime:a,endTime:n,contentLength:l}=r||{},d=n-a;this._bandwidthService.addRecord(l||i.byteLength,d),this.hls.emit(Is,{time:d,byteLength:l,url:t}),this.hls.emit(Ms,{url:t,elapsed:d||0}),this.hls.emit(Rs,{url:t,responseUrl:s.url,elapsed:o-a}),this.hls.emit(Fs,{headers:s.headers})})),nh(this,"_onLoaderRetry",((e,t)=>{this.hls.emit(Ps,{error:lb.network(e),retryTime:t})})),this.hls=e,this.player=e.player,this._bandwidthService=new xb;const{retryCount:t,retryDelay:i,loadTimeout:s,fetchOptions:r}=this.hls.config;this._segmentLoader=new tb({...r,responseType:"arraybuffer",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._audioSegmentLoader=new tb({...r,responseType:"arraybuffer",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._keyLoader=new tb({...r,responseType:"arraybuffer",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player)}destroy(){this.reset(),this._keyLoader&&(this._keyLoader.destroy(),this._keyLoader=null),this._audioSegmentLoader&&(this._audioSegmentLoader.destroy(),this._audioSegmentLoader=null),this._segmentLoader&&(this._segmentLoader.destroy(),this._segmentLoader=null)}speedInfo(){return{speed:this._bandwidthService.getLatestSpeed(),avgSpeed:this._bandwidthService.getAvgSpeed()}}resetBandwidth(){this._bandwidthService.reset()}load(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:i;const r=[];return e&&(r[0]=this.loadVideoSegment(e,i)),t&&(r[1]=this.loadAudioSegment(t,s)),Promise.all(r)}loadVideoSegment(e,t){return this._loadSegment(this._segmentLoader,e,t)}loadAudioSegment(e,t){return this._loadSegment(this._audioSegmentLoader,e,t)}async _loadSegment(e,t,i){var s;let r,o,a,n,l;const d=[];if(this.hls.emit(Bs,{url:t.url}),d[0]=e.load(t.url),i&&t.initSegment){var h;const i=t.initSegment.url;r=this._mapCache[i],r||(this.hls.emit(Bs,{url:i}),d[1]=e.load(i).then((e=>{if(e){Object.keys(this._mapCache)>30&&(this._mapCache={}),r=this._mapCache[i]=e.data,this._emitOnLoaded(e,i)}})));const s=null===(h=t.initSegment.key)||void 0===h?void 0:h.url;s&&(l=t.initSegment.key.iv,n=this._keyCache[s],n||(this.hls.emit(Bs,{url:s}),d[2]=this._keyLoader.load(s).then((e=>{e&&(n=this._keyCache[s]=e.data,this._emitOnLoaded(e,s))}))))}const c=null===(s=t.key)||void 0===s?void 0:s.url;c&&(a=t.key.iv,o=this._keyCache[c],o||(this.hls.emit(Bs,{url:c}),d[3]=this._keyLoader.load(c).then((e=>{e&&(o=this._keyCache[c]=e.data,this._emitOnLoaded(e,c))}))));const[u]=await Promise.all(d);if(!u)return;const p=u.data;return this._emitOnLoaded(u,t.url),{data:p,map:r,key:o,mapKey:n,keyIv:a,mapKeyIv:l}}reset(){this.error=null,this._mapCache={},this._keyCache={},this._bandwidthService.reset()}async cancel(){await Promise.all([this._keyLoader.cancel(),this._segmentLoader.cancel(),this._audioSegmentLoader.cancel()])}}class Pb{constructor(e,t,i){this.live=void 0,this.id=0,this.bitrate=0,this.width=0,this.height=0,this.name="",this.url="",this.audioCodec="",this.videoCodec="",this.textCodec="",this.startCC=0,this.endCC=0,this.startSN=0,this.endSN=-1,this.totalDuration=0,this.targetDuration=0,this.snDiff=null,this.segments=[],this.audioStreams=[],this.subtitleStreams=[],this.closedCaptions=[],this.currentAudioStream=null,this.currentSubtitleStream=null,this.TAG_NAME="HlsStream",this.update(e,t,i)}get lastSegment(){return this.segments.length?this.segments[this.segments.length-1]:null}get segmentDuration(){var e;return this.targetDuration||(null===(e=this.segments[0])||void 0===e?void 0:e.duration)||0}get liveEdge(){return this.endTime}get endTime(){var e;return(null===(e=this.lastSegment)||void 0===e?void 0:e.end)||0}get currentSubtitleEndSn(){var e;return(null===(e=this.currentSubtitleStream)||void 0===e?void 0:e.endSN)||0}clearOldSegment(e,t){return this._clearSegments(e,t)}getAudioSegment(e){if(!e||!this.currentAudioStream)return;const t=e.sn-this.snDiff;return this.currentAudioStream.segments.find((e=>e.sn===t))}update(e,t){this.url=e.url,Array.isArray(e.segments)?(null!==this.live&&void 0!==this.live||(this.live=e.live),this._updateSegments(e,this),this.startCC=e.startCC,this.endCC=e.endCC,this.startSN=e.startSN,this.endSN=e.endSN||-1,this.totalDuration=e.totalDuration,this.targetDuration=e.targetDuration,this.live=e.live,t&&this.currentAudioStream&&Array.isArray(t.segments)&&(this._updateSegments(t,this.currentAudioStream),(null===this.snDiff||void 0===this.snDiff)&&e.segments.length&&t.segments.length&&(this.snDiff=e.segments[0].sn-t.segments[0].sn))):(this.id=e.id,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.name=e.name,this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.textCodec=e.textCodec,this.audioStreams=e.audioStreams,this.subtitleStreams=e.subtitleStreams,!this.currentAudioStream&&this.audioStreams.length&&(this.currentAudioStream=this.audioStreams.find((e=>e.default))||this.audioStreams[0]),!this.currentSubtitleStream&&this.subtitleStreams.length&&(this.currentSubtitleStream=this.subtitleStreams.find((e=>e.default))||this.subtitleStreams[0]))}updateSubtitle(e){if(!(e&&this.currentSubtitleStream&&Array.isArray(e.segments)))return;const t=this._updateSegments(e,this.currentSubtitleStream),i=this.currentSubtitleStream.segments;return i.length>100&&(this.currentSubtitleStream.segments=i.slice(100)),t?t.map((e=>({sn:e.sn,url:e.url,duration:e.duration,start:e.start,end:e.end,lang:this.currentSubtitleStream.lang}))):void 0}switchSubtitle(e){const t=this.subtitleStreams.find((t=>t.lang===e)),i=this.currentSubtitleStream;t&&(this.currentSubtitleStream=t,i.segments=[])}_clearSegments(e,t){let i=0;const s=this.segments;for(let t=0,r=s.length;t=e){i=t;break}return i>t&&(i=t),i&&(this.segments=this.segments.slice(i),this.currentAudioStream&&(this.currentAudioStream.segments=this.currentAudioStream.segments.slice(i))),t-i}_updateSegments(e,t){const i=t.segments;if(this.live){const s=i[i.length-1],r=(null==s?void 0:s.sn)||-1;if(re.sn===r)),a=o<0?e.segments:e.segments.slice(o+1);if(i.length&&a.length){let e=s.end;a.forEach((t=>{t.start=e,e=t.end}));const t=(null==s?void 0:s.cc)||-1;t>a[0].cc&&a.forEach((e=>e.cc+=t))}return t.endSN=e.endSN,t.segments=i.concat(a),a}}else t.segments=e.segments}}class Bb{constructor(e){this.hls=e,this.player=e.player,this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1,this.TAG_NAME="HlsPlaylist"}destroy(){this.reset()}get lastSegment(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.lastSegment}get currentSegment(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer]}get nextSegment(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer+1]}get currentSegments(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.segments}get currentSubtitleEndSn(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.currentSubtitleEndSn}get liveEdge(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.liveEdge}get totalDuration(){var e;return(null===(e=this.currentStream)||void 0===e?void 0:e.totalDuration)||0}get seekRange(){const e=this.currentSegments;if(e&&e.length)return[e[0].start,e[e.length-1].end]}get isEmpty(){var e;return!(null!==(e=this.currentSegments)&&void 0!==e&&e.length)}get isLive(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.live}get hasSubtitle(){var e;return!(null===(e=this.currentStream)||void 0===e||!e.currentSubtitleStream)}getAudioSegment(e){var t;return null===(t=this.currentStream)||void 0===t?void 0:t.getAudioSegment(e)}moveSegmentPointer(e){var t;null==e&&(e=this._segmentPointer+1),this._segmentPointer=to(e,-1,null===(t=this.currentSegments)||void 0===t?void 0:t.length),this.player.debugLog(this.TAG_NAME,`moveSegmentPointer() and param pos is ${e} and clamp result is ${this._segmentPointer}`)}reset(){this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1}getSegmentByIndex(e){var t;return null===(t=this.currentSegments)||void 0===t?void 0:t[e]}setNextSegmentByIndex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._segmentPointer=e-1,this.player.debugLog(this.TAG_NAME,"setNextSegmentByIndex()",e,this._segmentPointer)}findSegmentIndexByTime(e){const t=this.currentSegments;if(t){for(let i,s=0,r=t.length;s=i.start&&ee.url)).forEach(((e,t)=>{this.streams[t]?this.streams[t].update(e):this.streams[t]=new Pb(e)})),this.currentStream=this.streams[0];else if(Array.isArray(e.segments)){const s=this.currentStream;if(s){s.update(e,t,i);const r=s.updateSubtitle(i);r&&this.hls.emit(Ts,{list:r})}else this.reset(),this.currentStream=this.streams[0]=new Pb(e,t,i)}this.currentStream&&this.hls.isLive&&!this.dvrWindow&&(this.dvrWindow=this.currentSegments.reduce(((e,t)=>e+=t.duration),0))}switchSubtitle(e){var t;null===(t=this.currentStream)||void 0===t||t.switchSubtitle(e)}clearOldSegment(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;const t=this.currentStream;if(!this.dvrWindow||!t)return;const i=t.endTime-this.dvrWindow;if(i<=0)return void this.player.debugLog(this.TAG_NAME,`clearOldSegment() stream.endTime:${t.endTime}, this.dvrWindow:${this.dvrWindow} startTime <= 0`);const s=t.segments;if(s.length<=e)return void this.player.debugLog(this.TAG_NAME,`clearOldSegment() segments.length:${s.length} <= maxPlaylistSize:${e}`);const r=this._segmentPointer;this._segmentPointer=t.clearOldSegment(i,r),this.player.debugLog(this.TAG_NAME,"clearOldSegment() update _segmentPointer:",r,this._segmentPointer),this.player.debugLog(this.TAG_NAME,"currentSegments",this.currentSegments)}checkSegmentTrackChange(e,t){const i=this.findSegmentIndexByTime(e),s=this.getSegmentByIndex(i);if(!s)return;if(!s.hasAudio&&!s.hasVideo)return;if(2!==t&&s.hasAudio&&s.hasVideo)return s;if(s.end-e>.3)return;const r=this.getSegmentByIndex(i+1);return r&&(r.hasAudio||r.hasVideo)&&(r.hasAudio!==s.hasAudio||r.hasVideo!==s.hasVideo)?r:void 0}}class Ib{constructor(e,t){this.hls=e,this.player=t;const i=window.crypto||window.msCrypto;this.subtle=i&&(i.subtle||i.webkitSubtle),this.externalDecryptor=null}decrypt(e,t){if(!e&&!t)return;const i=[];return e&&(i[0]=this._decryptSegment(e)),t&&(i[1]=this._decryptSegment(t)),Promise.all(i)}async _decryptSegment(e){let t=e.data;return e.key&&(t=await this._decryptData(e.data,e.key,e.keyIv)),e.map?yh(e.map,t):t}async _decryptData(e,t,i){if(this.externalDecryptor)return await this.externalDecryptor.decrypt(e,t,i);if(this.subtle){const s=await this.subtle.importKey("raw",t,{name:"AES-CBC"},!1,["encrypt","decrypt"]),r=await this.subtle.decrypt({name:"AES-CBC",iv:i},s,e);return new Uint8Array(r)}e=vd(e),t=vd(t),i=vd(i);return function(e){const{words:t}=e,{sigBytes:i}=e,s=new Uint8Array(i);for(let e=0;e>>2]>>>24-e%4*8&255;return s}(Ad.AES.decrypt({ciphertext:e},t,{iv:i,mode:Ad.mode.CBC}))}}class Mb extends Yd{constructor(e){super(e),this.player=e,this._pmtId=-1,this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[],this._gopId=0,this._videoPid=-1,this._audioPid=-1,this._codecType=yt,this._audioCodecType=_t,this._vps=null,this._sps=null,this._pps=null,this.TAG_NAME="HlsTsLoader",this.videoTrack=Mb.initVideoTrack(),this.audioTrack=Mb.initAudioTrack(),this._baseDts=-1,this._baseDtsInited=!1,this._basefps=25,this._tempSampleTsList=[],this._hasAudio=!1,this._hasVideo=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=!1,this._videoTimestampBreak=!1,this._lastAudioExceptionGapDot=0,this._lastAudioExceptionOverlapDot=0,this._lastAudioExceptionLargeGapDot=0,this._isSendAACSeqHeader=!1,this.workerClearTimeout=null,this.workerUrl=null,this.loopWorker=null,this.tempSampleListInfo={},this._isUseWorker()&&this._initLoopWorker(),this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.workerUrl&&(URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.loopWorker&&(this.loopWorker.postMessage({cmd:"destroy"}),this.loopWorker.terminate(),this.loopWorker=null),this.videoTrack=null,this.audioTrack=null,this.tempSampleListInfo={},this._baseDts=-1,this._baseDtsInited=!1,this._basefps=25,this._hasCalcFps=!1,this._tempSampleTsList=[],this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=!1,this._videoTimestampBreak=!1,this._lastAudioExceptionGapDot=0,this._lastAudioExceptionOverlapDot=0,this._lastAudioExceptionLargeGapDot=0,this._isSendAACSeqHeader=!1,this.player.debugLog(this.TAG_NAME,"destroy")}static initVideoTrack(){return{samples:[]}}static initAudioTrack(){return{samples:[]}}static probe(e){return!!e.length&&(71===e[0]&&71===e[188]&&71===e[376])}_parsePES(e){const t=e[8];if(null==t||e.lengthe.length-6)return;let r,o;const a=e[7];return 192&a&&(r=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&a?(o=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,r-o>54e5&&(r=o)):o=r),{data:e.subarray(9+t),pts:r,dts:o,originalPts:r,originalDts:o}}_demux(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t&&(this._pmtId=-1,this.videoTrack=Mb.initVideoTrack(),this.audioTrack=Mb.initAudioTrack()),!i||t?(this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[]):(this.videoTrack.samples=[],this.audioTrack.samples=[],this._remainingPacketData&&(e=yh(this._remainingPacketData,e),this._remainingPacketData=null));let s=e.length;const r=s%188;r&&(this._remainingPacketData=e.subarray(s-r),s-=r);for(let t=0;t>4>1){if(r=t+5+e[t+4],r===t+188)continue}else r=t+4;switch(s){case 0:i&&(r+=e[r]+1),this._pmtId=(31&e[r+10])<<8|e[r+11];break;case this._pmtId:{i&&(r+=e[r]+1);const t=r+3+((15&e[r+1])<<8|e[r+2])-4;for(r+=12+((15&e[r+10])<<8|e[r+11]);r=t)return[];const r=[];for(;s{const t=s?e[0]>>>1&63:31&e[0];switch(t){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!s&&5!==t||s&&5===t)break;r.isIFrame=!0,this._gopId++;break;case 6:case 39:case 40:if(!s&&6!==t||s&&6===t)break;const o=function(e,t){const i=e.length;let s=t?2:1,r=0,o=0,a="";for(;255===e[s];)r+=255,s++;for(r+=e[s++];255===e[s];)o+=255,s++;if(o+=e[s++],5===r&&i>s+16)for(let t=0;t<16;t++)a+=e[s].toString(16),s++;return{payload:e.subarray(s),type:r,size:o,uuid:a}}(function(e){const t=e.byteLength,i=[];let s=1;for(;s=i)return;const r=s,o=[],a=(60&e[s+2])>>>2,n=xr[a];if(!n)throw new Error(`Invalid sampling index: ${a}`);const l=1+((192&e[s+2])>>>6),d=(1&e[s+2])<<2|(192&e[s+3])>>>6;let h,c,u=0;const p=Ur(n);for(;s+7>5,i-s=i?void 0:e.subarray(s),frames:o,samplingFrequencyIndex:a,sampleRate:n,objectType:l,channelCount:d,originCodec:`mp4a.40.${l}`}}(e.data,e.originalPts);if(t){if(this.audioTrack.codec=t.codec,this.audioTrack.sampleRate=t.sampleRate,this.audioTrack.channelCount=t.channelCount,!this._isSendAACSeqHeader){const e=Br({profile:t.objectType,sampleRate:t.samplingFrequencyIndex,channel:t.channelCount});this._isSendAACSeqHeader=!0,this.player.debugLog(this.TAG_NAME,"aac seq header",`profile: ${t.objectType}, sampleRate:${t.sampleRate},sampleRateIndex: ${t.samplingFrequencyIndex}, channel: ${t.channelCount}`),this._doDecodeByHls(e,Fe,0,!1,0)}if(this._isSendAACSeqHeader){const e=[];t.frames.forEach((t=>{const i=t.pts,s=new Uint8Array(t.data.length+2);s.set([175,1],0),s.set(t.data,2);const r={type:Fe,pts:i,dts:i,payload:s};e.push(r)})),this.audioTrack.samples=this.audioTrack.samples.concat(e)}else this.player.debugWarn(this.TAG_NAME,"aac seq header not send")}else this.player.debugWarn(this.TAG_NAME,"aac parseADTS error")}this._audioPesData=[]}else e&&"startPrefixError"===e.code&&(this._audioPesData=[])}_fix(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e=Math.round(9e4*e);const s=this.videoTrack,r=this.audioTrack,o=s.samples,a=r.samples;if(!o.length&&!a.length)return;const n=o[0],l=a[0];let d=0;if(o.length&&a.length&&(d=n.dts-l.pts),this._baseDtsInited||this._calculateBaseDts(),t&&(this._calculateBaseDts(),this._baseDts-=e),!i){this._videoNextDts=d>0?e+d:e,this._audioNextPts=d>0?e:e-d;const t=n?n.dts-this._baseDts-this._videoNextDts:0,i=l?l.pts-this._baseDts-this._audioNextPts:0;Math.abs(t||i)>pr&&(this._calculateBaseDts(this.audioTrack,this.videoTrack),this._baseDts-=e)}this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(r),this._fixVideo(s);let h=s.samples.concat(r.samples);h=h.map((e=>(e.dts=Math.round(e.dts/90),e.pts=Math.round(e.pts/90),e.cts=e.pts-e.dts,e))).sort(((e,t)=>e.dts-t.dts)),h.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,this._isUseWorker()?this.loopWorker.postMessage({...e,payload:t,cmd:"sample"},[t.buffer]):e.type===Ue?this._doDecodeVideo({...e,payload:t}):e.type===Fe&&this._doDecodeAudio({...e,payload:t})})),pa(this._hasCalcFps)&&this._isUseWorker()&&(this._hasCalcFps=this._calcDecodeFps(h))}_calculateBaseDts(){const e=this.audioTrack,t=this.videoTrack,i=e.samples,s=t.samples;if(!i.length&&!s.length)return!1;let r=1/0,o=1/0;i.length&&(e.baseDts=r=i[0].pts),s.length&&(t.baseDts=o=s[0].dts),this._baseDts=Math.min(r,o);const a=o-r;return Number.isFinite(a)&&Math.abs(a)>45e3&&this.player.debugWarn(this.TAG_NAME,`large av first frame gap,\n video pts: ${o},\n audio pts: ${r},\n base dts: ${this._baseDts},\n detect is: ${a}`),this._baseDtsInited=!0,!0}_resetBaseDtsWhenStreamBreaked(){if(this._baseDtsInited&&this._videoTimestampBreak&&this._audioTimestampBreak){if(!this._calculateBaseDts(this.audioTrack,this.videoTrack))return;this._baseDts-=Math.min(this._audioNextPts,this._videoNextDts),this._audioLastSample=null,this._videoLastSample=null,this._videoTimestampBreak=!1,this._audioTimestampBreak=!1}}_fixAudio(e){const t=e.samples;t.length&&(t.forEach((e=>{e.pts-=this._baseDts,e.dts=e.pts})),this._doFixAudioInternal(e,t,9e4))}_fixVideo(e){const t=e.samples;if(!t.length)return;if(t.forEach((e=>{e.dts-=this._baseDts,e.pts-=this._baseDts})),void 0===this._videoNextDts){const e=t[0];this._videoNextDts=e.dts}const i=t.length;let s=0;const r=t[0],o=t[1],a=this._videoNextDts-r.dts;let n;Math.abs(a)>45e3&&(r.dts+=a,r.pts+=a,this.player.debugWarn(this.TAG_NAME,`large video gap between chunk,\n next dts is ${this._videoNextDts},\n first dts is ${r.dts},\n next dts is ${o&&o.dts},\n duration is ${a}`),o&&Math.abs(o.dts-r.dts)>pr&&(this._videoTimestampBreak=!0,t.forEach(((e,t)=>{0!==t&&(e.dts+=a,e.pts+=a)}))));const l=e.samples[0],d=e.samples[i-1];n=1===i?9e3:Math.floor((d.dts-l.dts)/(i-1));for(let r=0;rpr||s<0){this._videoTimestampBreak=!0,s=this._audioTimestampBreak?n:Math.max(s,2700);const i=this._audioNextPts||0;a&&a.dts>i&&(s=n),this.player.debugWarn(this.TAG_NAME,`large video gap between frames,\n time is ${o/e.timescale},\n dts is ${o},\n origin dts is ${t[r].originalDts},\n next dts is ${this._videoNextDts},\n sample Duration is ${s} ,\n ref Sample DurationInt is ${n}`)}t[r].duration=s,this._videoNextDts+=s}}_doFixAudioInternal(e,t,i){e.sampleDuration||(e.sampleDuration=Ur(e.timescale,i));const s=e.sampleDuration;if(void 0===this._audioNextPts){const e=t[0];this._audioNextPts=e.pts}for(let i=0;i=3*s&&a<=cr&&!mo()){Fr(e.codec,e.channelCount)||t[0].data.subarray();const n=Math.floor(a/s);Math.abs(o.pts-this._lastAudioExceptionGapDot)>ur&&(this._lastAudioExceptionGapDot=o.pts),this.player.debugWarn(this.TAG_NAME,`audio gap detected,\n pts is ${t.pts},\n originPts is ${t.originalPts},\n count is ${n},\n nextPts is ${r},\n ref sample duration is ${s}`);for(let e=0;e=-9e4?(Math.abs(o.pts-this._lastAudioExceptionOverlapDot)>ur&&(this._lastAudioExceptionOverlapDot=o.pts,this.player.debugWarn(this.TAG_NAME,`audio overlap detected,\n pts is ${o.pts},\n originPts is ${o.originalPts},\n nextPts is ${r},\n ref sample duration is ${s}`)),t.splice(i,1),i--):(Math.abs(a)>=cr&&(this._audioTimestampBreak=!0,Math.abs(o.pts-this._lastAudioExceptionLargeGapDot)>ur&&(this._lastAudioExceptionLargeGapDot=o.pts,this.player.debugWarn(this.TAG_NAME,`large audio gap detected,\n time is ${o.pts/1e3}\n pts is ${o.pts},\n originPts is ${o.originalPts},\n nextPts is ${r},\n sample duration is ${a}\n ref sample duration is ${s}`))),o.dts=o.pts=r,this._audioNextPts+=s)}}_calcDecodeFps(e){const t=e.map((e=>({ts:e.dts||e.pts,type:e.type})));this._tempSampleTsList=this._tempSampleTsList.concat(t);const i=ra(this._tempSampleTsList,Ue);if(i)this._tempSampleTsList=[],this.player.debugLog(this.TAG_NAME,`_calcDecodeFps() video fps is ${i}, update base fps is ${this._basefps}`),this._basefps=i,this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps});else if(this.player.debugLog(this.TAG_NAME,"_calcDecodeFps() streamVideoFps is null"),this._tempSampleTsList.length>200)return this.player.debugLog(this.TAG_NAME,`_calcDecodeFps() _tempSampleTsList is more than 200, clear and use base fps update ${this._basefps}`),this._tempSampleTsList=[],this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps}),!0;return null!==i}_isUseWorker(){return!this.player.isUseMSE()}_initLoopWorker(){this.player.debugLog(this.TAG_NAME,"_initLoopWorker()");const e=Aa(function(){const e=1,t=2;let i=new class{constructor(){this.baseFps=0,this.fpsInterval=null,this.preLoopTimestamp=null,this.startBpsTime=null,this.allSampleList=[]}destroy(){this._clearInterval(),this.baseFps=0,this.allSampleList=[],this.preLoopTimestamp=null,this.startBpsTime=null}updateBaseFps(e){this.baseFps=e,this._clearInterval(),this._startInterval()}pushSample(e){delete e.cmd,this.allSampleList.push(e)}_startInterval(){const e=Math.ceil(1e3/this.baseFps);this.fpsInterval=setInterval((()=>{let t=(new Date).getTime();this.preLoopTimestamp||(this.preLoopTimestamp=t),this.startBpsTime||(this.startBpsTime=t);const i=t-this.preLoopTimestamp;if(i>2*e&&console.warn(`JbPro:[TsLoader LoopWorker] loop interval is ${i}ms, more than ${e} * 2ms`),this._loop(),this.preLoopTimestamp=(new Date).getTime(),this.startBpsTime){t-this.startBpsTime>=1e3&&(this._calcSampleList(),this.startBpsTime=t)}}),e)}_clearInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_calcSampleList(){const i={buferredDuration:0,allListLength:this.allSampleList.length,audioListLength:0,videoListLength:0};this.allSampleList.forEach((s=>{s.type===t?(i.videoListLength++,s.duration&&(i.buferredDuration+=Math.round(s.duration/90))):s.type===e&&i.audioListLength++})),postMessage({cmd:"sampleListInfo",...i})}_loop(){let i=null;if(this.allSampleList.length)if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]);let t=this.allSampleList[0];for(;t&&t.type===e;)i=this.allSampleList.shift(),postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),t=this.allSampleList[0]}else if(i.type===e){postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]);let s=this.allSampleList[0];for(;s;){if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]),s=null;break}i.type===e&&(postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),s=this.allSampleList[0])}}}};self.onmessage=e=>{const t=e.data;switch(t.cmd){case"updateBaseFps":i.updateBaseFps(t.baseFps);break;case"sample":i.pushSample(t);break;case"destroy":i.destroy(),i=null}}}.toString()),t=new Blob([e],{type:"text/javascript"}),i=URL.createObjectURL(t);let s=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((()=>{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),te),s.onmessage=e=>{const t=e.data;switch(t.cmd){case"decodeVideo":this._doDecodeVideo(t);break;case"decodeAudio":this._doDecodeAudio(t);break;case"sampleListInfo":this.tempSampleListInfo=t}},this.loopWorker=s}_postMessageToLoopWorker(e,t){this._isUseWorker()&&(this.loopWorker?this.loopWorker.postMessage({cmd:e,...t}):this.player.debugWarn(this.TAG_NAME,"loop worker is not init, can not post message"))}_doDecodeAudio(e){const t=new Uint8Array(e.payload);this.player.updateStats({abps:t.byteLength});let i=this.cryptoPayloadAudio(t);this._doDecodeByHls(i,Fe,e.dts,!1,0)}_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?$n(t,e.isIFrame):Pn(t,e.isIFrame),this.player.updateStats({dts:e.dts,vbps:i.byteLength});const s=e.pts-e.dts;let r=this.cryptoPayload(i,e.isIFrame);this._doDecodeByHls(r,Ue,e.dts,e.isIFrame,s)}getBuferredDuration(){return this.tempSampleListInfo.buferredDuration||0}getSampleListLength(){return this.tempSampleListInfo.allListLength||0}getSampleAudioListLength(){return this.tempSampleListInfo.audioListLength||0}getSampleVideoListLength(){return this.tempSampleListInfo.videoListLength||0}getInputByteLength(){return this._remainingPacketData&&this._remainingPacketData.byteLength||0}}function Fb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function Ub(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function Ob(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=Math.pow(2,32);return Ub(e,t)*i+Ub(e,t+4)}const Nb="aac",jb="g7110a",Gb="g7110m",zb="avc",Wb="hevc";class Vb{static getFrameDuration(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}static getRateIndexByRate(e){return Vb.FREQ.indexOf(e)}}function Hb(e,t,i,s,r,o){const a=[],n=null==r?void 0:r.entries,l=t.entries,d=s.entries,h=i.entrySizes,c=null==o?void 0:o.entries;let u,p,f;c&&(u={},c.forEach((e=>{u[e-1]=!0}))),n&&(p=[],n.forEach((e=>{let{count:t,offset:i}=e;for(let e=0;e{let{count:t,delta:s}=e;for(let e=0;e=S&&(b++,S=l[b+1]?l[b+1].firstChunk-1:1/0),_+=l[b].samplesPerChunk)})),a}function $b(e,t){return e.dataReferenceIndex=Fb(t,6),e.width=Fb(t,24),e.height=Fb(t,26),e.horizresolution=Ub(t,28),e.vertresolution=Ub(t,32),e.frameCount=Fb(t,40),e.depth=Fb(t,74),78}function Jb(e,t){return e.dataReferenceIndex=Fb(t,6),e.channelCount=Fb(t,16),e.sampleSize=Fb(t,18),e.sampleRate=Ub(t,24)/65536,28}function qb(e,t,i){if(!e)return;if(e.size!==e.data.length)throw new Error(`box ${e.type} size !== data.length`);const s={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(s.version=e.data[e.headerSize],s.flags=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}(e.data,e.headerSize+1),s.headerSize+=4),i(s,e.data.subarray(s.headerSize),s.start+s.headerSize),s}nh(Vb,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);const Kb=function(e,t,i){const s=String(i),r=t>>0;let o=Math.ceil(r/s.length);const a=[],n=String(e);for(;o--;)a.push(s);return a.join("").substring(0,r-n.length)+n},Yb=function(){const e=[];for(var t=arguments.length,i=new Array(t),s=0;s{e.push(Kb(Number(t).toString(16),2,0))})),e[0]};class Qb{static probe(e){return!!Qb.findBox(e,["ftyp"])}static findBox(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=[];if(!e)return s;let r=0,o="",a=0;for(;e.length>7;){if(r=Ub(e),o=String.fromCharCode.apply(null,e.subarray(4,8)),a=8,1===r?(r=Ob(e,8),a+=8):r||(r=e.length),!t[0]||o===t[0]){const n=e.subarray(0,r);if(!(t.length<2))return Qb.findBox(n.subarray(a),t.slice(1),i+a);s.push({start:i,size:r,headerSize:a,type:o,data:n})}i+=r,e=e.subarray(r)}return s}static tfhd(e){return qb(e,!0,((e,t)=>{e.trackId=Ub(t);let i=4;const s=1&e.flags,r=2&e.flags,o=8&e.flags,a=16&e.flags,n=32&e.flags;s&&(i+=4,e.baseDataOffset=Ub(t,i),i+=4),r&&(e.sampleDescriptionIndex=Ub(t,i),i+=4),o&&(e.defaultSampleDuration=Ub(t,i),i+=4),a&&(e.defaultSampleSize=Ub(t,i),i+=4),n&&(e.defaultSampleFlags=Ub(t,i))}))}static sidx(e){return qb(e,!0,((e,t)=>{let i=0;e.reference_ID=Ub(t,i),i+=4,e.timescale=Ub(t,i),i+=4,0===e.version?(e.earliest_presentation_time=Ub(t,i),i+=4,e.first_offset=Ub(t,i),i+=4):(e.earliest_presentation_time=Ob(t,i),i+=8,e.first_offset=Ob(t,i),i+=8),i+=2,e.references=[];const s=Fb(t,i);i+=2;for(let r=0;r>31&1,s.referenced_size=2147483647&r,s.subsegment_duration=Ub(t,i),i+=4,r=Ub(t,i),i+=4,s.starts_with_SAP=r>>31&1,s.SAP_type=r>>28&7,s.SAP_delta_time=268435455&r}}))}static moov(e){return qb(e,!1,((e,t,i)=>{e.mvhd=Qb.mvhd(Qb.findBox(t,["mvhd"],i)[0]),e.trak=Qb.findBox(t,["trak"],i).map((e=>Qb.trak(e))),e.pssh=Qb.pssh(Qb.findBox(t,["pssh"],i)[0])}))}static mvhd(e){return qb(e,!0,((e,t)=>{let i=0;1===e.version?(e.timescale=Ub(t,16),e.duration=Ob(t,20),i+=28):(e.timescale=Ub(t,8),e.duration=Ub(t,12),i+=16),e.nextTrackId=Ub(t,i+76)}))}static trak(e){return qb(e,!1,((e,t,i)=>{e.tkhd=Qb.tkhd(Qb.findBox(t,["tkhd"],i)[0]),e.mdia=Qb.mdia(Qb.findBox(t,["mdia"],i)[0])}))}static tkhd(e){return qb(e,!0,((e,t)=>{let i=0;1===e.version?(e.trackId=Ub(t,16),e.duration=Ob(t,24),i+=32):(e.trackId=Ub(t,8),e.duration=Ub(t,16),i+=20),e.width=Ub(t,i+52),e.height=Ub(t,i+56)}))}static mdia(e){return qb(e,!1,((e,t,i)=>{e.mdhd=Qb.mdhd(Qb.findBox(t,["mdhd"],i)[0]),e.hdlr=Qb.hdlr(Qb.findBox(t,["hdlr"],i)[0]),e.minf=Qb.minf(Qb.findBox(t,["minf"],i)[0])}))}static mdhd(e){return qb(e,!0,((e,t)=>{let i=0;1===e.version?(e.timescale=Ub(t,16),e.duration=Ob(t,20),i+=28):(e.timescale=Ub(t,8),e.duration=Ub(t,12),i+=16);const s=Fb(t,i);e.language=String.fromCharCode(96+(s>>10&31),96+(s>>5&31),96+(31&s))}))}static hdlr(e){return qb(e,!0,((e,t)=>{0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}static minf(e){return qb(e,!1,((e,t,i)=>{e.vmhd=Qb.vmhd(Qb.findBox(t,["vmhd"],i)[0]),e.smhd=Qb.smhd(Qb.findBox(t,["smhd"],i)[0]),e.stbl=Qb.stbl(Qb.findBox(t,["stbl"],i)[0])}))}static vmhd(e){return qb(e,!0,((e,t)=>{e.graphicsmode=Fb(t),e.opcolor=[Fb(t,2),Fb(t,4),Fb(t,6)]}))}static smhd(e){return qb(e,!0,((e,t)=>{e.balance=Fb(t)}))}static stbl(e){return qb(e,!1,((e,t,i)=>{var s,r,o;e.stsd=Qb.stsd(Qb.findBox(t,["stsd"],i)[0]),e.stts=Qb.stts(Qb.findBox(t,["stts"],i)[0]),e.ctts=Qb.ctts(Qb.findBox(t,["ctts"],i)[0]),e.stsc=Qb.stsc(Qb.findBox(t,["stsc"],i)[0]),e.stsz=Qb.stsz(Qb.findBox(t,["stsz"],i)[0]),e.stco=Qb.stco(Qb.findBox(t,["stco"],i)[0]),e.stco||(e.co64=Qb.co64(Qb.findBox(t,["co64"],i)[0]),e.stco=e.co64);const a=null===(s=e.stsd.entries[0])||void 0===s||null===(r=s.sinf)||void 0===r||null===(o=r.schi)||void 0===o?void 0:o.tenc.default_IV_size;e.stss=Qb.stss(Qb.findBox(t,["stss"],i)[0]),e.senc=Qb.senc(Qb.findBox(t,["senc"],i)[0],a)}))}static senc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return qb(e,!0,((e,i)=>{let s=0;const r=Ub(i,s);s+=4,e.samples=[];for(let o=0;o{const i=[],s=[];let r=0;for(let e=0;e<16;e++)s.push(Yb(t[r+e]));if(r+=16,e.version>0){const e=Ub(t,r);r+=4;for(let s=0;s<(""+e).length;s++)for(let e=0;e<16;e++){const e=t[r];r+=1,i.push(Yb(e))}}const o=Ub(t,r);e.data_size=o,r+=4,e.kid=i,e.system_id=s,e.buffer=t}))}static stsd(e){return qb(e,!0,((e,t,i)=>{e.entryCount=Ub(t),e.entries=Qb.findBox(t.subarray(4),[],i+4).map((e=>{switch(e.type){case"avc1":case"avc2":case"avc3":case"avc4":return Qb.avc1(e);case"hvc1":case"hev1":return Qb.hvc1(e);case"mp4a":return Qb.mp4a(e);case"alaw":case"ulaw":return Qb.alaw(e);case"enca":return qb(e,!1,((e,t,i)=>{e.channelCount=Fb(t,16),e.samplesize=Fb(t,18),e.sampleRate=Ub(t,24)/65536,t=t.subarray(28),e.sinf=Qb.sinf(Qb.findBox(t,["sinf"],i)[0]),e.esds=Qb.esds(Qb.findBox(t,["esds"],i)[0])}));case"encv":return qb(e,!1,((e,t,i)=>{e.width=Fb(t,24),e.height=Fb(t,26),e.horizresolution=Ub(t,28),e.vertresolution=Ub(t,32),t=t.subarray(78),e.sinf=Qb.sinf(Qb.findBox(t,["sinf"],i)[0]),e.avcC=Qb.avcC(Qb.findBox(t,["avcC"],i)[0]),e.hvcC=Qb.hvcC(Qb.findBox(t,["hvcC"],i)[0]),e.pasp=Qb.pasp(Qb.findBox(t,["pasp"],i)[0])}))}})).filter(Boolean)}))}static tenc(e){return qb(e,!1,((e,t)=>{let i=6;e.default_IsEncrypted=t[i],i+=1,e.default_IV_size=t[i],i+=1,e.default_KID=[];for(let s=0;s<16;s++)e.default_KID.push(Yb(t[i])),i+=1}))}static schi(e){return qb(e,!1,((e,t,i)=>{e.tenc=Qb.tenc(Qb.findBox(t,["tenc"],i)[0])}))}static sinf(e){return qb(e,!1,((e,t,i)=>{e.schi=Qb.schi(Qb.findBox(t,["schi"],i)[0]),e.frma=Qb.frma(Qb.findBox(t,["frma"],i)[0])}))}static frma(e){return qb(e,!1,((e,t)=>{e.data_format="";for(let i=0;i<4;i++)e.data_format+=String.fromCharCode(t[i])}))}static avc1(e){return qb(e,!1,((e,t,i)=>{const s=$b(e,t),r=t.subarray(s);i+=s,e.avcC=Qb.avcC(Qb.findBox(r,["avcC"],i)[0]),e.pasp=Qb.pasp(Qb.findBox(r,["pasp"],i)[0])}))}static avcC(e){return qb(e,!1,((e,t)=>{e.configurationVersion=t[0],e.AVCProfileIndication=t[1],e.profileCompatibility=t[2],e.AVCLevelIndication=t[3],e.codec=function(e){let t,i="avc1.";for(let s=0;s<3;s++)t=e[s].toString(16),t.length<2&&(t=`0${t}`),i+=t;return i}([t[1],t[2],t[3]]),e.lengthSizeMinusOne=3&t[4],e.spsLength=31&t[5],e.sps=[];let i=6;for(let s=0;s{const s=$b(e,t),r=t.subarray(s);i+=s,e.hvcC=Qb.hvcC(Qb.findBox(r,["hvcC"],i)[0]),e.pasp=Qb.pasp(Qb.findBox(r,["pasp"],i)[0])}))}static hvcC(e){return qb(e,!1,((t,i)=>{t.data=e.data,t.codec="hev1.1.6.L93.B0",t.configurationVersion=i[0];const s=i[1];t.generalProfileSpace=s>>6,t.generalTierFlag=(32&s)>>5,t.generalProfileIdc=31&s,t.generalProfileCompatibility=Ub(i,2),t.generalConstraintIndicatorFlags=i.subarray(6,12),t.generalLevelIdc=i[12],t.avgFrameRate=Fb(i,19),t.numOfArrays=i[22],t.vps=[],t.sps=[],t.pps=[];let r=23,o=0,a=0,n=0;for(let e=0;e{e.hSpacing=Ub(t),e.vSpacing=Ub(t,4)}))}static mp4a(e){return qb(e,!1,((e,t,i)=>{const s=Jb(e,t);e.esds=Qb.esds(Qb.findBox(t.subarray(s),["esds"],i+s)[0])}))}static esds(e){return qb(e,!0,((e,t)=>{e.codec="mp4a.";let i=0,s=0,r=0,o=0;for(;t.length;){for(i=0,o=t[i],s=t[i+1],i+=2;128&s;)r=(127&s)<<7,s=t[i],i+=1;if(r+=127&s,3===o)t=t.subarray(i+3);else{if(4!==o){if(5===o){const s=e.config=t.subarray(i,i+r);let o=(248&s[0])>>3;return 31===o&&s.length>=2&&(o=32+((7&s[0])<<3)+((224&s[1])>>5)),e.objectType=o,e.codec+=o.toString(16),void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}return void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}e.codec+=(t[i].toString(16)+".").padStart(3,"0"),t=t.subarray(i+13)}}}))}static alaw(e){return qb(e,!1,((e,t)=>{Jb(e,t)}))}static stts(e){return qb(e,!0,((e,t)=>{const i=Ub(t),s=[];let r=4;for(let e=0;e{const i=Ub(t),s=[];let r=4;if(1===e.version)for(let e=0;e{const i=Ub(t),s=[];let r=4;for(let e=0;e{const i=Ub(t),s=Ub(t,4),r=[];if(!i){let e=8;for(let i=0;i{const i=Ub(t),s=[];let r=4;for(let e=0;e{const i=Ub(t),s=[];let r=4;for(let e=0;e{const i=Ub(t),s=[];let r=4;for(let e=0;e{e.mfhd=Qb.mfhd(Qb.findBox(t,["mfhd"],i)[0]),e.traf=Qb.findBox(t,["traf"],i).map((e=>Qb.traf(e)))}))}static mfhd(e){return qb(e,!0,((e,t)=>{e.sequenceNumber=Ub(t)}))}static traf(e){return qb(e,!1,((e,t,i)=>{e.tfhd=Qb.tfhd(Qb.findBox(t,["tfhd"],i)[0]),e.tfdt=Qb.tfdt(Qb.findBox(t,["tfdt"],i)[0]),e.trun=Qb.trun(Qb.findBox(t,["trun"],i)[0])}))}static trun(e){return qb(e,!0,((e,t)=>{const{version:i,flags:s}=e,r=t.length,o=e.sampleCount=Ub(t);let a=4;if(r>a&&1&s&&(e.dataOffset=-(1+~Ub(t,a)),a+=4),r>a&&4&s&&(e.firstSampleFlags=Ub(t,a),a+=4),e.samples=[],r>a){let r;for(let n=0;n{1===e.version?e.baseMediaDecodeTime=Ob(t):e.baseMediaDecodeTime=Ub(t)}))}static probe(e){return!!Qb.findBox(e,["ftyp"])}static parseSampleFlags(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}}static moovToTrack(e,t,i){var s,r;const o=e.trak;if(!o||!o.length)return;const a=o.find((e=>{var t,i;return"vide"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)})),n=o.find((e=>{var t,i;return"soun"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)}));if(a&&t){var l,d,h,c,u,p,f;const i=t,s=null===(l=a.tkhd)||void 0===l?void 0:l.trackId;null!=s&&(i.id=a.tkhd.trackId),i.tkhdDuration=a.tkhd.duration,i.mvhdDurtion=e.mvhd.duration,i.mvhdTimecale=e.mvhd.timescale,i.timescale=i.formatTimescale=a.mdia.mdhd.timescale,i.duration=a.mdia.mdhd.duration||i.mvhdDurtion/i.mvhdTimecale*i.timescale;const r=a.mdia.minf.stbl.stsd.entries[0];if(i.width=r.width,i.height=r.height,r.pasp&&(i.sarRatio=[r.pasp.hSpacing,r.pasp.vSpacing]),r.hvcC)i.codecType=Wb,i.codec=r.hvcC.codec,i.vps=r.hvcC.vps,i.sps=r.hvcC.sps,i.pps=r.hvcC.pps,i.hvcC=r.hvcC.data;else{if(!r.avcC)throw new Error("unknown video stsd entry");i.codecType=zb,i.codec=r.avcC.codec,i.sps=r.avcC.sps,i.pps=r.avcC.pps}var m,g,y,A,b,v,_,S;if(i.present=!0,i.ext={},i.ext.stss=null===(d=a.mdia)||void 0===d||null===(h=d.minf)||void 0===h||null===(c=h.stbl)||void 0===c?void 0:c.stss,i.ext.ctts=null===(u=a.mdia)||void 0===u||null===(p=u.minf)||void 0===p||null===(f=p.stbl)||void 0===f?void 0:f.ctts,r&&"encv"===r.type)i.isVideoEncryption=!0,r.default_KID=null===(m=r.sinf)||void 0===m||null===(g=m.schi)||void 0===g?void 0:g.tenc.default_KID,r.default_IsEncrypted=null===(y=r.sinf)||void 0===y||null===(A=y.schi)||void 0===A?void 0:A.tenc.default_IsEncrypted,r.default_IV_size=null===(b=r.sinf)||void 0===b||null===(v=b.schi)||void 0===v?void 0:v.tenc.default_IV_size,i.videoSenc=a.mdia.minf.stbl.senc&&a.mdia.minf.stbl.senc.samples,r.data_format=null===(_=r.sinf)||void 0===_||null===(S=_.frma)||void 0===S?void 0:S.data_format,i.useEME=e.useEME,i.kidValue=e.kidValue,i.pssh=e.pssh,i.encv=r}if(n&&i){var E,w,T,k,L,C,D,x,R;const t=i,o=null===(E=n.tkhd)||void 0===E?void 0:E.trackId;null!=o&&(t.id=n.tkhd.trackId),t.tkhdDuration=n.tkhd.duration,t.mvhdDurtion=e.mvhd.duration,t.mvhdTimecale=e.mvhd.timescale,t.timescale=t.formatTimescale=n.mdia.mdhd.timescale,t.duration=n.mdia.mdhd.duration||t.mvhdDurtion/t.mvhdTimecale*t.timescale;const a=n.mdia.minf.stbl.stsd.entries[0];switch(t.sampleSize=a.sampleSize,t.sampleRate=a.sampleRate,t.channelCount=a.channelCount,t.present=!0,a.type){case"alaw":t.codecType=t.codec=jb,t.sampleRate=8e3;break;case"ulaw":t.codecType=t.codec=Gb,t.sampleRate=8e3;break;default:t.codecType=Nb,t.sampleDuration=Vb.getFrameDuration(t.sampleRate,t.timescale),t.sampleRateIndex=Vb.getRateIndexByRate(t.sampleRate),t.objectType=(null===(s=a.esds)||void 0===s?void 0:s.objectType)||2,a.esds&&(t.config=Array.from(a.esds.config)),t.codec=(null===(r=a.esds)||void 0===r?void 0:r.codec)||"mp4a.40.2"}var P,B,I,M,F,U,O,N;if(t.sampleDuration=Vb.getFrameDuration(t.sampleRate,t.timescale),t.objectType=(null===(w=a.esds)||void 0===w?void 0:w.objectType)||2,a.esds&&(a.esds.config?t.config=Array.from(a.esds.config):console.warn("esds config is null")),t.codec=(null===(T=a.esds)||void 0===T?void 0:T.codec)||"mp4a.40.2",t.sampleRateIndex=Vb.getRateIndexByRate(t.sampleRate),t.ext={},t.ext.stss=null===(k=n.mdia)||void 0===k||null===(L=k.minf)||void 0===L||null===(C=L.stbl)||void 0===C?void 0:C.stss,t.ext.ctts=null===(D=n.mdia)||void 0===D||null===(x=D.minf)||void 0===x||null===(R=x.stbl)||void 0===R?void 0:R.ctts,t.present=!0,a&&"enca"===a.type)t.isAudioEncryption=!0,a.data_format=null===(P=a.sinf)||void 0===P||null===(B=P.frma)||void 0===B?void 0:B.data_format,a.default_KID=null===(I=a.sinf)||void 0===I||null===(M=I.schi)||void 0===M?void 0:M.tenc.default_KID,a.default_IsEncrypted=null===(F=a.sinf)||void 0===F||null===(U=F.schi)||void 0===U?void 0:U.tenc.default_IsEncrypted,a.default_IV_size=null===(O=a.sinf)||void 0===O||null===(N=O.schi)||void 0===N?void 0:N.tenc.default_IV_size,t.audioSenc=n.mdia.minf.stbl.senc&&n.mdia.minf.stbl.senc.samples,t.useEME=e.useEME,t.kidValue=e.kidValue,t.enca=a}if(i&&(i.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!i&&i.isAudioEncryption),null!=t&&t.encv||null!=i&&i.enca){var j,G;const e=null==t||null===(j=t.encv)||void 0===j?void 0:j.default_KID,s=null==i||null===(G=i.enca)||void 0===G?void 0:G.default_KID,r=e||s?(e||s).join(""):null;t&&(t.kid=r),i&&(i.kid=r)}return t&&(t.flags=3841),i&&(i.flags=1793),{videoTrack:t,audioTrack:i}}static evaluateDefaultDuration(e,t,i){var s;const r=null==t||null===(s=t.samples)||void 0===s?void 0:s.length;if(!r)return 1024;return 1024*r/t.timescale*e.timescale/i}static moofToSamples(e,t,i){const s={};return e.mfhd&&(t&&(t.sequenceNumber=e.mfhd.sequenceNumber),i&&(i.sequenceNumber=e.mfhd.sequenceNumber)),e.traf.forEach((e=>{let{tfhd:r,tfdt:o,trun:a}=e;if(!r||!a)return;o&&(t&&t.id===r.trackId&&(t.baseMediaDecodeTime=o.baseMediaDecodeTime),i&&i.id===r.trackId&&(i.baseMediaDecodeTime=o.baseMediaDecodeTime));const n=r.defaultSampleSize||0,l=r.defaultSampleDuration||Qb.evaluateDefaultDuration(t,i,a.samples.length||a.sampleCount);let d=a.dataOffset||0,h=0,c=-1;if(!a.samples.length&&a.sampleCount){s[r.trackId]=[];for(let e=0;e((e={offset:d,dts:h,pts:h+(e.cts||0),duration:e.duration||l,size:e.size||n,gopId:c,keyframe:0===t||null!==e.flags&&void 0!==e.flags&&(65536&e.flags)>>>0!=65536}).keyframe&&(c++,e.gopId=c),h+=e.duration,d+=e.size,e)))})),s}static moovToSamples(e){const t=e.trak;if(!t||!t.length)return;const i=t.find((e=>{var t,i;return"vide"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)})),s=t.find((e=>{var t,i;return"soun"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)}));if(!i&&!s)return;let r,o;if(i){var a,n;const e=null===(a=i.mdia)||void 0===a||null===(n=a.minf)||void 0===n?void 0:n.stbl;if(!e)return;const{stts:t,stsc:s,stsz:o,stco:l,stss:d,ctts:h}=e;if(!(t&&s&&o&&l&&d))return;r=Hb(t,s,o,l,h,d)}if(s){var l,d,h;const e=null===(l=s.mdia)||void 0===l||null===(d=l.minf)||void 0===d?void 0:d.stbl;if(!e)return;const t=null===(h=s.mdia.mdhd)||void 0===h?void 0:h.timescale,{stts:i,stsc:r,stsz:a,stco:n}=e;if(!(t&&i&&r&&a&&n))return;o=Hb(i,r,a,n)}return{videoSamples:r,audioSamples:o}}}class Xb extends Yd{constructor(e){super(e),this.player=e,this.TAG_NAME="HlsFmp4Loader",this.tempSampleListInfo={},this.isInitVideo=!1,this.isInitAudio=!1,this.videoTrack={id:1,samples:[],sps:[],pps:[],vps:[],codec:""},this.audioTrack={id:2,samples:[],sampleRate:0,channelCount:0,codec:"",codecType:""},this.workerClearTimeout=null,this.workerUrl=null,this.loopWorker=null,this._hasCalcFps=!1,this._tempSampleTsList=[],this._basefps=25,this._isUseWorker()&&this._initLoopWorker(),e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.workerUrl&&(URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.loopWorker&&(this.loopWorker.postMessage({cmd:"destroy"}),this.loopWorker.terminate(),this.loopWorker=null),this._hasCalcFps=!1,this._tempSampleTsList=[],this.videoTrack=null,this.audioTrack=null,this.isInitVideo=!1,this.isInitAudio=!1,this._basefps=25,this.player.debugLog(this.TAG_NAME,"destroy")}demux(e,t){let i=this.audioTrack,s=this.videoTrack;if(this.checkInitAudio(),this.checkInitVideo(),i.samples=[],s.samples=[],t){if(this.player.updateStats({abps:t.byteLength}),pa(this.isInitAudio)){const e=Qb.findBox(t,["moov"])[0];if(!e)return void this.player.debugError(this.TAG_NAME,"cannot found moov box");Qb.moovToTrack(Qb.moov(e),null,i),this.checkInitAudio()&&(this.player.debugLog(this.TAG_NAME,"audioData audio init success"),this._sendAccADTSHeader(i))}const e=Qb.findBox(t,["moof"])[0];if(e){const s=Qb.moofToSamples(Qb.moof(e),null,i)[i.id],r=i.baseMediaDecodeTime;if(s){const o=e.start;s.map((e=>{e.offset+=o;const s=t.subarray(e.offset,e.offset+e.size),a=e.dts+r,n=new Uint8Array(s.length+2);n.set([175,1],0),n.set(s,2),i.samples.push({type:Fe,pts:a,dts:a,payload:n,duration:e.duration,size:n.byteLength})}))}}}if(e){if(this.player.updateStats({vbps:e.byteLength}),pa(this.isInitVideo)&&pa(this.isInitAudio)){const t=Qb.findBox(e,["moov"])[0];if(!t)throw new Error("cannot found moov box");if(Qb.moovToTrack(Qb.moov(t),s,i),pa(this.isInitAudio)&&this.checkInitAudio()&&(this.player.debugLog(this.TAG_NAME,"videoData audio init success",i),this._sendAccADTSHeader(i)),this.checkInitVideo()){this.player.debugLog(this.TAG_NAME,"video init success");let e=null;s.codecType===is?s.sps.length&&s.vps.length&&s.pps.length&&(e=Hn({sps:s.sps[0],pps:s.pps[0],vps:s.vps[0]})):s.sps.length&&s.pps.length&&(e=Rn({sps:s.sps[0],pps:s.pps[0]})),e&&(this.player.debugLog(this.TAG_NAME,"seqHeader"),this._doDecodeByHls(e,Ue,0,!0,0))}}const t=Qb.findBox(e,["moof"])[0];if(t){const r=Qb.moofToSamples(Qb.moof(t),s,i),o=s.baseMediaDecodeTime,a=i.baseMediaDecodeTime,n=t.start;Object.keys(r).forEach((t=>{s.id==t?r[t].map((t=>{t.offset+=n;const i={type:Ue,pts:(t.pts||t.dts)+o,dts:t.dts+o,units:[],payload:null,isIFrame:!1};i.duration=t.duration,i.gopId=t.gopId,t.keyframe&&(i.isIFrame=!0);const r=e.subarray(t.offset,t.offset+t.size);i.payload=r,s.samples.push(i)})):i.id==t&&r[t].map((t=>{t.offset+=n;const s=e.subarray(t.offset,t.offset+t.size),r=t.dts+a,o=new Uint8Array(s.length+2);o.set([175,1],0),o.set(s,2),i.samples.push({type:Fe,pts:r,dts:r,payload:o,duration:t.duration,size:o.byteLength})}))}))}}const r=s.samples.concat(i.samples);r.sort(((e,t)=>e.dts-t.dts)),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,this._isUseWorker()?this.loopWorker.postMessage({...e,payload:t,cmd:"sample"},[t.buffer]):e.type===Ue?this._doDecodeVideo({...e,payload:t}):e.type===Fe&&this._doDecodeAudio({...e,payload:t})})),pa(this._hasCalcFps)&&this._isUseWorker()&&(this._hasCalcFps=this._calcDecodeFps(r))}checkInitAudio(){return this.isInitAudio=!!(this.audioTrack.sampleRate&&this.audioTrack.channelCount&&this.audioTrack.codec&&"aac"===this.audioTrack.codecType),this.isInitAudio}checkInitVideo(){return this.isInitVideo=!!(this.videoTrack.pps.length&&this.videoTrack.sps.length&&this.videoTrack.codec),this.isInitVideo}_sendAccADTSHeader(e){const t=Br({profile:e.objectType,sampleRate:e.sampleRateIndex,channel:e.channelCount});this._doDecodeByHls(t,Fe,0,!0,0)}_calcDecodeFps(e){const t=e.map((e=>({ts:e.dts||e.pts,type:e.type})));this._tempSampleTsList=this._tempSampleTsList.concat(t);const i=ra(this._tempSampleTsList,Ue);if(i)this._tempSampleTsList=[],this.player.debugLog(this.TAG_NAME,`_calcDecodeFps() video fps is ${i}, update base fps is ${this._basefps}`),this._basefps=i,this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps});else if(this.player.debugLog(this.TAG_NAME,"_calcDecodeFps() streamVideoFps is null"),this._tempSampleTsList.length>200)return this.player.debugLog(this.TAG_NAME,`_calcDecodeFps() _tempSampleTsList is more than 200, clear and use base fps update ${this._basefps}`),this._tempSampleTsList=[],this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps}),!0;return null!==i}_isUseWorker(){return!this.player.isUseMSE()}_initLoopWorker(){this.player.debugLog(this.TAG_NAME,"_initLoopWorker()");const e=Aa(function(){const e=1,t=2;let i=new class{constructor(){this.baseFps=0,this.fpsInterval=null,this.preLoopTimestamp=null,this.startBpsTime=null,this.allSampleList=[]}destroy(){this._clearInterval(),this.baseFps=0,this.allSampleList=[],this.preLoopTimestamp=null,this.startBpsTime=null}updateBaseFps(e){this.baseFps=e,this._clearInterval(),this._startInterval()}pushSample(e){delete e.cmd,this.allSampleList.push(e)}_startInterval(){const e=Math.ceil(1e3/this.baseFps);this.fpsInterval=setInterval((()=>{let t=(new Date).getTime();this.preLoopTimestamp||(this.preLoopTimestamp=t),this.startBpsTime||(this.startBpsTime=t);const i=t-this.preLoopTimestamp;if(i>2*e&&console.warn(`JbPro:[HlsFmp4Loader LoopWorker] loop interval is ${i}ms, more than ${e} * 2ms`),this._loop(),this.preLoopTimestamp=(new Date).getTime(),this.startBpsTime){t-this.startBpsTime>=1e3&&(this._calcSampleList(),this.startBpsTime=t)}}),e)}_clearInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_calcSampleList(){const i={buferredDuration:0,allListLength:this.allSampleList.length,audioListLength:0,videoListLength:0};this.allSampleList.forEach((s=>{s.type===t?(i.videoListLength++,s.duration&&(i.buferredDuration+=s.duration)):s.type===e&&i.audioListLength++})),postMessage({cmd:"sampleListInfo",...i})}_loop(){let i=null;if(this.allSampleList.length)if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]);let t=this.allSampleList[0];for(;t&&t.type===e;)i=this.allSampleList.shift(),postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),t=this.allSampleList[0]}else if(i.type===e){postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]);let s=this.allSampleList[0];for(;s;){if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]),s=null;break}i.type===e&&(postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),s=this.allSampleList[0])}}}};self.onmessage=e=>{const t=e.data;switch(t.cmd){case"updateBaseFps":i.updateBaseFps(t.baseFps);break;case"sample":i.pushSample(t);break;case"destroy":i.destroy(),i=null}}}.toString()),t=new Blob([e],{type:"text/javascript"}),i=URL.createObjectURL(t);let s=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((()=>{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),te),s.onmessage=e=>{const t=e.data;switch(t.cmd){case"decodeVideo":this._doDecodeVideo(t);break;case"decodeAudio":this._doDecodeAudio(t);break;case"sampleListInfo":this.tempSampleListInfo=t}},this.loopWorker=s}_postMessageToLoopWorker(e,t){this._isUseWorker()&&(this.loopWorker?this.loopWorker.postMessage({cmd:e,...t}):this.player.debugWarn(this.TAG_NAME,"loop worker is not init, can not post message"))}_doDecodeAudio(e){const t=new Uint8Array(e.payload);this.player.updateStats({abps:t.byteLength}),this.cryptoPayloadAudio(t),this._doDecodeByHls(t,Fe,e.dts,!1,0)}_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?$n(t,e.isIFrame):Pn(t,e.isIFrame),this.player.updateStats({dts:e.dts,vbps:i.byteLength});const s=e.pts-e.dts;let r=this.cryptoPayload(i,e.isIFrame);this._doDecodeByHls(r,Ue,e.dts,e.isIFrame,s)}getBuferredDuration(){return this.tempSampleListInfo.buferredDuration||0}getSampleListLength(){return this.tempSampleListInfo.allListLength||0}getSampleAudioListLength(){return this.tempSampleListInfo.audioListLength||0}getSampleVideoListLength(){return this.tempSampleListInfo.videoListLength||0}}class Zb{constructor(e,t){this.hls=e,this.player=this.hls.player,this.isMP4=t,this._initSegmentId="",this.TAG_NAME="HlsTransmuxer",this._demuxer=t?new Xb(this.hls.player):new Mb(this.hls.player),this.player.debugLog(this.TAG_NAME,`init and isMP4 is ${t}`)}destroy(){this._demuxer&&(this._demuxer.destroy(),this._demuxer=null)}transmux(e,t,i,s,r,o){this.player.debugLog(this.TAG_NAME,`transmux videoChunk:${e&&e.byteLength}, audioChunk:${t&&t.byteLength}, discontinuity:${i}, contiguous:${s}, startTime:${r}, needInit:${o}`);const a=this._demuxer;try{this.isMP4?a.demux(e,t):a.demuxAndFix(yh(e,t),i,s,r)}catch(e){throw new lb(nb,ab,e)}}}class ev{constructor(e){this.hls=e,this.player=e.player,this._decryptor=new Ib(this.hls,this.player),this._transmuxer=null,this._mse=null,this._softVideo=null,this._sourceCreated=!1,this._needInitSegment=!0,this._directAppend=!1,this.TAG_NAME="HlsBufferService"}async destroy(){this._softVideo=null,this._transmuxer&&(this._transmuxer.destroy(),this._transmuxer=null)}get baseDts(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t._baseDts}get nbSb(){return 0}async updateDuration(e){this.player.debugLog(this.TAG_NAME,"updateDuration()",e)}getBuferredDuration(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getBuferredDuration()}getBufferedSegments(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleListLength()}getBufferedAudioSegments(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleAudioListLength()}getBufferedVideoSegments(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleVideoListLength()}createSource(e,t,i,s){if(this._sourceCreated)return;const r=e||t;r&&(Mb.probe(r)?this._transmuxer||(this._transmuxer=new Zb(this.hls,!1)):Qb.probe(r)?this._transmuxer||(this._transmuxer=new Zb(this.hls,!0)):this.player.debugError(this.TAG_NAME,"createSource error: chunk is not ts"))}async appendBuffer(e,t,i,s,r,o,a){if(null!=i&&i.length||null!=s&&s.length)return this._needInitSegment,this._transmuxer.transmux(i,s,r,o,a,this._needInitSegment||r),!0}async clearAllBuffer(){this.player.debugLog(this.TAG_NAME,"clearAllBuffer")}decryptBuffer(e,t){return this._decryptor.decrypt(e,t)}async reset(){this._transmuxer=null,this._needInitSegment=!0,this._directAppend=!1}async endOfStream(){this._softVideo&&this._softVideo.endOfStream()}async setLiveSeekableRange(e,t){}seamlessSwitch(){this._needInitSegment=!0}}class tv{constructor(e){this.emitter=e,this._seiSet=new Set,e.on(Us,(e=>{e&&this._seiSet.add(e)}))}throw(e){if(null==e||!this._seiSet.size)return;const t=e-.2,i=e+.2,s=[];this._seiSet.forEach((e=>{e.time>=t&&e.time<=i&&s.push(e)})),s.forEach((e=>{this._seiSet.delete(e),this.emitter.emit(Os,e)}))}reset(){this._seiSet.clear()}}class iv{constructor(e){this._timescale=e,this.encodeType="",this.audioCodec="",this.videoCodec="",this.domain="",this.fps=0,this.bitrate=0,this.width=0,this.height=0,this.samplerate=0,this.channelCount=0,this.gop=0,this._bitsAccumulateSize=0,this._bitsAccumulateDuration=0}getStats(){return{encodeType:this.encodeType,audioCodec:this.audioCodec,videoCodec:this.videoCodec,domain:this.domain,fps:this.fps,bitrate:this.bitrate,width:this.width,height:this.height,samplerate:this.samplerate,channelCount:this.channelCount,gop:this.gop}}setEncodeType(e){this.encodeType=e}setFpsFromScriptData(e){var t;let{data:i}=e;const s=null==i||null===(t=i.onMetaData)||void 0===t?void 0:t.framerate;s&&s>0&&s<100&&(this.fps=s)}setVideoMeta(e){if(this.width=e.width,this.height=e.height,this.videoCodec=e.codec,this.encodeType=e.codecType,e.fpsNum&&e.fpsDen){const t=e.fpsNum/e.fpsDen;t>0&&t<100&&(this.fps=t)}}setAudioMeta(e){this.audioCodec=e.codec,this.samplerate=e.sampleRate,this.channelCount=e.channelCount}setDomain(e){this.domain=e.split("/").slice(2,3)[0]}updateBitrate(e){if((!this.fps||this.fps>=100)&&e.length){const t=e.reduce(((e,t)=>e+t.duration),0)/e.length;this.fps=Math.round(this._timescale/t)}e.forEach((e=>{1===e.gopId&&this.gop++,this._bitsAccumulateDuration+=e.duration/(this._timescale/1e3),this._bitsAccumulateSize+=e.units.reduce(((e,t)=>e+t.length),0),this._bitsAccumulateDuration>=1e3&&(this.bitrate=8*this._bitsAccumulateSize,this._bitsAccumulateDuration=0,this._bitsAccumulateSize=0)}))}}class sv{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;nh(this,"_core",null),nh(this,"_samples",[]),this._core=e,this._timescale=t,this._stats=new iv(t),this._bindEvents()}getStats(){var e,t,i,s,r,o,a;const{currentTime:n=0,decodeFps:l=0}=(null===(e=this._core)||void 0===e?void 0:e.media)||{};return{...this._stats.getStats(),downloadSpeed:(null===(t=this._core)||void 0===t||null===(i=t.speedInfo)||void 0===i?void 0:i.call(t).speed)||0,avgSpeed:(null===(s=this._core)||void 0===s||null===(r=s.speedInfo)||void 0===r?void 0:r.call(s).avgSpeed)||0,currentTime:n,bufferEnd:(null===(o=this._core)||void 0===o||null===(a=o.bufferInfo())||void 0===a?void 0:a.remaining)||0,decodeFps:l}}_bindEvents(){this._core.on(Cs,(e=>this._stats.updateBitrate(e.samples))),this._core.on(Ds,(e=>{this._stats.setFpsFromScriptData(e)})),this._core.on(xs,(e=>{"video"===e.type?this._stats.setVideoMeta(e.track):this._stats.setAudioMeta(e.track)})),this._core.on(Rs,(e=>{this._stats.setDomain(e.responseUrl)}))}reset(){this._samples=[],this._stats=new iv(this._timescale)}}class rv extends wa{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),nh(this,"_loadSegment",(async()=>{if(this._segmentProcessing)return void this.player.debugWarn("_loadSegment()","_segmentProcessing is ture and return");if(!this._playlist)return void this.player.debugWarn("_loadSegment()","this._playlist is null and return");const e=this._playlist.currentSegment,t=this._playlist.nextSegment;if(this.player.debugLog(this.TAG_NAME,"_loadSegment()","curSeg",e&&e.url,"nextSeg",t&&t.url),t)return this._loadSegmentDirect();this.player.debugLog(this.TAG_NAME,"nextSeg is null and return")})),this.player=e,this.config=null,this._manifestLoader=null,this._segmentLoader=null,this._playlist=null,this._bufferService=null,this._seiService=null,this._stats=null,this._prevSegSn=null,this._prevSegCc=null,this._tickTimer=null,this._tickInterval=500,this._segmentProcessing=!1,this._reloadOnPlay=!1,this._switchUrlOpts=null,this._disconnectTimer=null,this.TAG_NAME="Hls256",this.canVideoPlay=!1,this.$videoElement=null,this.config=t=function(e){return{isLive:!0,maxPlaylistSize:50,retryCount:3,retryDelay:1e3,pollRetryCount:2,loadTimeout:1e4,preloadTime:30,softDecode:!1,bufferBehind:10,maxJumpDistance:3,startTime:0,targetLatency:10,maxLatency:20,allowedStreamTrackChange:!0,...e}}(t),this._manifestLoader=new Db(this),this._segmentLoader=new Rb(this),this._playlist=new Bb(this),this._bufferService=new ev(this),this._seiService=new tv(this),this._stats=new sv(this,9e4),this.player.debugLog(this.TAG_NAME,"init")}async destroy(){this.player.debugLog(this.TAG_NAME,"destroy()"),this._playlist.reset(),this._segmentLoader.reset(),this._seiService.reset(),await Promise.all([this._clear(),this._bufferService.destroy()]),this._manifestLoader&&(await this._manifestLoader.destroy(),this._manifestLoader=null),this._segmentLoader&&(this._segmentLoader.destroy(),this._segmentLoader=null),this._playlist&&(this._playlist.destroy(),this._playlist=null),this.player.debugLog(this.TAG_NAME,"destroy end")}_startTick(){this._stopTick(),this._tickTimer=setTimeout((()=>{this._tick()}),this._tickInterval)}_stopTick(){this._tickTimer&&clearTimeout(this._tickTimer),this._tickTimer=null}_tick(){this.player.isDestroyedOrClosed()?this.player.debugLog(this.TAG_NAME,"_tick() player is destroyed"):(this._startTick(),this._loadSegment())}get isLive(){return this._playlist.isLive}get streams(){return this._playlist.streams}get currentStream(){return this._playlist.currentStream}get hasSubtitle(){return this._playlist.hasSubtitle}get baseDts(){var e;return null===(e=this._bufferService)||void 0===e?void 0:e.baseDts}speedInfo(){return this._segmentLoader.speedInfo()}resetBandwidth(){this._segmentLoader.resetBandwidth()}getStats(){return this._stats.getStats()}async loadSource(e){return await this._reset(),await this._loadData(e),this._startTick(),!0}async _loadData(e){try{e&&(e=e.trim())}catch(e){}if(!e)throw this._emitError(new lb(rb,rb,null,null,"m3u8 url is missing"));const t=await this._loadM3U8(e),{currentStream:i}=this._playlist;if(this._urlSwitching){var s,r;if(0===i.bitrate&&null!==(s=this._switchUrlOpts)&&void 0!==s&&s.bitrate)i.bitrate=null===(r=this._switchUrlOpts)||void 0===r?void 0:r.bitrate;const e=this._getSeamlessSwitchPoint();this.config.startTime=e;const t=this._playlist.findSegmentIndexByTime(e),o=this._playlist.getSegmentByIndex(t+1);if(o){const e=o.start;this.player.debugWarn(this.TAG_NAME,`clear buffer from ${e}`)}}t&&(this.isLive?(this.player.debugLog(this.TAG_NAME,"is live"),this._bufferService.setLiveSeekableRange(0,4294967295),this.config.targetLatency{let[t,i,a]=e;t?(this._playlist.upsertPlaylist(t,i,a),this.isLive&&this._pollM3U8(s,r,o)):this.player.debugWarn(this.TAG_NAME,"_refreshM3U8() mediaPlaylist is empty")})).catch((e=>{throw this._emitError(lb.create(e))}))}_pollM3U8(e,t,i){var s;let r=this._playlist.isEmpty;this._manifestLoader.poll(e,t,i,((e,t,i)=>{this._playlist.upsertPlaylist(e,t,i),this._playlist.clearOldSegment(),e&&r&&!this._playlist.isEmpty&&this._loadSegment(),r&&(r=this._playlist.isEmpty)}),(e=>{this._emitError(lb.create(e))}),1e3*((null===(s=this._playlist.lastSegment)||void 0===s?void 0:s.duration)||0))}async _loadSegmentDirect(){const e=this._playlist.nextSegment;if(!e)return void this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect() !seg");let t=!1,i=null;try{this._segmentProcessing=!0,t=await this._reqAndBufferSegment(e,this._playlist.getAudioSegment(e))}catch(e){i=e}finally{this._segmentProcessing=!1}return i?this._emitError(lb.create(i)):(t?(this._urlSwitching&&(this._urlSwitching=!1,this.emit(js,{url:this.config.url})),this._playlist.moveSegmentPointer(),this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect()","seg.isLast",e.isLast),e.isLast?(this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect()","seg.isLast"),this._end()):(this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect()","and next _loadSegment()"),this._loadSegment())):this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect() not appended"),t)}async _reqAndBufferSegment(e,t){this.player.debugLog(this.TAG_NAME,"video seg",e&&e.url,"audio seg",t&&t.url);const i=e?e.cc:t.cc,s=this._prevSegCc!==i;let r=[];try{r=await this._segmentLoader.load(e,t,s)}catch(e){throw e.fatal=!1,this._segmentLoader.error=e,e}if(!r[0])return;const o=await this._bufferService.decryptBuffer(...r);if(!o)return void this.player.debugLog(this.TAG_NAME,"decryptBuffer return null");const a=e?e.sn:t.sn,n=e?e.start:t.start,l=this._playlist.currentStream;return this._bufferService.createSource(o[0],o[1],null==l?void 0:l.videoCodec,null==l?void 0:l.audioCodec),await this._bufferService.appendBuffer(e,t,o[0],o[1],s,this._prevSegSn===a-1,n),this._prevSegCc=i,this._prevSegSn=a,!0}async _clear(){this.player.debugLog(this.TAG_NAME,"_clear()"),clearTimeout(this._disconnectTimer),this._stopTick(),await Promise.all([this._segmentLoader.cancel(),this._manifestLoader.stopPoll()]),this._segmentProcessing=!1}async _reset(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.player.debugLog(this.TAG_NAME,"_reset()"),this._reloadOnPlay=!1,this._prevSegSn=null,this._prevSegCc=null,this._switchUrlOpts=null,this._playlist.reset(),this._segmentLoader.reset(),this._seiService.reset(),this._stats.reset(),await this._clear(),this._bufferService.reset(e)}_end(){this.player.debugLog(this.TAG_NAME,"_end()"),this._clear()}_emitError(e){var t;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;!1===(null===(t=e.originError)||void 0===t?void 0:t.fatal)?console.warn(e):(console.table(e),console.error(e),console.error(null===(s=this.media)||void 0===s?void 0:s.error),this._stopTick(),this._urlSwitching&&(this._urlSwitching=!1,this.emit(Ns,e)),i&&this._end(),this._seiService.reset(),this.emit(Ws,e));return e}_getSeamlessSwitchPoint(){const{media:e}=this;let t=e.currentTime;if(!e.paused){var i;const s=this._playlist.findSegmentIndexByTime(e.currentTime),r=this._playlist.getSegmentByIndex(s),o=null===(i=this._stats)||void 0===i?void 0:i.getStats().downloadSpeed;if(o&&r){t+=r.duration*this._playlist.currentStream.bitrate/o+1}else t+=5}return t}getDemuxBuferredDuration(){return this._bufferService.getBuferredDuration()||0}getDemuxBufferedListLength(){return this._bufferService.getBufferedSegments()||0}getDemuxAudioBufferedListLength(){return this._bufferService.getBufferedAudioSegments()||0}getDemuxVideoBufferedListLength(){return this._bufferService.getBufferedVideoSegments()||0}}class ov extends wa{constructor(e){super(),nh(this,"TAG_NAME","Hls256Decoder"),this.player=e,this.$videoElement=this.player.video.$videoElement,this.hls=null,this.eventsDestroy=[],this.bandwidthEstimateInterval=null,this.hls=new rv(e),this._bindEvents()}async destroy(){return this._stopBandwidthEstimateInterval(),this.hls&&(await this.hls.destroy(),this.hls=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this.$videoElement=null,this.player.debugLog(this.TAG_NAME,"destroy"),!0}_bindEvents(){this.hls.on(Ws,(e=>{this.player.emitError(lt.hlsError,e)})),this._startBandwidthEstimateInterval()}_startBandwidthEstimateInterval(){this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((()=>{const e=this.hls.speedInfo();this.player.emit(ot.kBps,(e.avgSpeed/1024/8).toFixed(2)),this.hls.resetBandwidth()}),1e3)}_stopBandwidthEstimateInterval(){this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}async loadSource(e){return this.url=e,await this.hls.loadSource(e),!0}checkHlsBufferedDelay(){let e=0;return this.hls&&(e=this.hls.getDemuxBuferredDuration()),e}getDemuxBufferedListLength(){let e=0;return this.hls&&(e=this.hls.getDemuxBufferedListLength()),e}getDemuxAudioBufferedListLength(){let e=0;return this.hls&&(e=this.hls.getDemuxAudioBufferedListLength()),e}getDemuxVideoBufferedListLength(){let e=0;return this.hls&&(e=this.hls.getDemuxVideoBufferedListLength()),e}}class av extends wa{constructor(e,t){if(super(),this.player=e,this.player.$container.classList.add("jb-pro-container-playback"),this._showPrecision=null,this._startTime=null,this._playStartTime=null,this._playingTimestamp=null,this._fps=parseInt(t.fps,10)||e._opt.playbackFps,this._isUseFpsRender=!!ua(t.isUseFpsRender),this._rate=1,this._audioTimestamp=0,this._videoTimestamp=0,this.controlType=t.controlType||Q.normal,t.controlType&&-1===[Q.normal,Q.simple].indexOf(t.controlType)&&(this.player.debugWarn("Playback","constructor()","controlType is not in [normal,simple]",t.controlType),this.controlType=Q.normal),this._currentLocalTimestamp=0,this._localOneFrameTimestamp=t.localOneFrameTimestamp||40,this._localCalculateTimeInterval=null,this._isUseLocalCalculateTime=!!ua(t.isUseLocalCalculateTime),this._isPlaybackPauseClearCache=!pa(t.isPlaybackPauseClearCache),this._isCacheBeforeDecodeForFpsRender=!!ua(t.isCacheBeforeDecodeForFpsRender),this._startfpsTime=null,this._startFpsTimestamp=null,this._checkStatsInterval=null,this._playbackTs=0,this._renderFps=0,this._isUseLocalCalculateTime?this._startLocalCalculateTime():this._listen(),this.playbackList=[],this._playbackListStartTimestamp=null,this._totalDuration=0,t.controlType===Q.normal)this.initPlaybackList(t.playList,t.showPrecision,t.startTime);else if(t.controlType===Q.simple){t.duration&&(this._totalDuration=1e3*t.duration);let e=t.startTime||0;e>this.totalDuration&&(e=this.totalDuration),this.setStartTime(e)}this.player.on(ot.playbackPause,(e=>{e?this.pause():this.resume()}));const i={fps:this._fps,isUseFpsRender:this._isUseFpsRender,localOneFrameTimestamp:this._localOneFrameTimestamp,isUseLocalCalculateTime:this._isUseLocalCalculateTime,uiUsePlaybackPause:t.uiUsePlaybackPause,showControl:t.showControl};try{e.debugLog("Playback","init",JSON.stringify(i))}catch(t){e.debugLog("Playback","init",i)}}destroy(){this._startTime=null,this._showPrecision=null,this._playStartTime=null,this._playingTimestamp=null,this._totalDuration=0,this._audioTimestamp=0,this._videoTimestamp=0,this._fps=null,this._isUseFpsRender=!1,this._rate=1,this.playbackList=[],this._playbackListStartTimestamp=null,this._localCalculateTimeInterval=null,this._currentLocalTimestamp=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._renderFps=0,this._playbackTs=0,this._stopLocalCalculateTime(),this.clearStatsInterval(),this.player.$container&&this.player.$container.classList.remove("jb-pro-container-playback"),this.off(),this.player.debugLog("Playback","destroy")}_listen(){this.player.on(ot.stats,(e=>{const t=e.ts;this._playStartTime||(this._playStartTime=t-1e3);let i=t-this._playStartTime;this.setPlayingTimestamp(i)}))}pause(){this.clearStatsInterval()}resume(){this.startCheckStatsInterval()}updateStats(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._startFpsTimestamp||(this._startFpsTimestamp=eo()),xo(e.ts)&&(this.player.updateStats({fps:!0,ts:e.ts}),this._playbackTs=e.ts,this._startfpsTime||(this._startfpsTime=e.ts),this._renderFps+=1);const t=eo(),i=t-this._startFpsTimestamp;if(i<1e3)return;let s=null;this._startfpsTime&&(s=this._playbackTs-this._startfpsTime),this.player.emit(ot.playbackStats,{fps:this._renderFps,rate:this.rate,start:this._startfpsTime,end:this._playbackTs,timestamp:i,dataTimestamp:s,audioBufferSize:this.player.audio?this.player.audio.bufferSize:0,videoBufferSize:this.player.video?this.player.video.bufferSize:0,ts:this._playbackTs}),this._renderFps=0,this._startfpsTime=this._playbackTs,this._startFpsTimestamp=t}updateLocalOneFrameTimestamp(e){this._localOneFrameTimestamp=e}_startLocalCalculateTime(){this._stopLocalCalculateTime(),this._localCalculateTimeInterval=setInterval((()=>{const e=this._currentLocalTimestamp;this._playStartTime||(this._playStartTime=e-1e3);let t=e-this._playStartTime;this.setPlayingTimestamp(t)}),1e3)}startCheckStatsInterval(){this.clearStatsInterval(),this._checkStatsInterval=setInterval((()=>{this.updateStats()}),1e3)}_stopLocalCalculateTime(){this._localCalculateTimeInterval&&(clearInterval(this._localCalculateTimeInterval),this._localCalculateTimeInterval=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}increaseLocalTimestamp(){this._isUseLocalCalculateTime&&(this._currentLocalTimestamp+=this._localOneFrameTimestamp)}initPlaybackList(e,t,i){this.playbackList=e||[];let s=0;if(this.playbackList.forEach(((e,t)=>{10===Go(e.start)?(e.startTimestamp=1e3*e.start,e.startTime=go(e.startTimestamp)):(e.startTimestamp=e.start,e.startTime=go(e.startTimestamp)),10===Go(e.end)?(e.endTimestamp=1e3*e.end,e.endTime=go(e.endTimestamp)):(e.endTimestamp=e.end,e.endTime=go(e.endTimestamp)),e.duration=e.end-e.start,s+=e.duration})),this._totalDuration=s,this.player.debugLog("Playback",this.playbackList),this.playbackList.length>0){const e=this.playbackList[0].startTimestamp;this._playbackListStartTimestamp=e;let t=e;i&&(10===Go(i)&&(i*=1e3),this._isTimeInPlaybackList(i)&&(t=i)),this.setStartTime(t)}const r=t||Ei;this.setShowPrecision(r)}get totalDuration(){return(this._totalDuration||0)/1e3}get startTime(){return this._startTime||0}setStartTime(e){this._startTime=e,this._playingTimestamp=e,this._playStartTime=null}setRate(e){this._rate=e,this.player.emit(ot.playbackRateChange,e)}get fps(){return this._fps}get rate(){return this._rate}get isUseFpsRender(){return this._isUseFpsRender}get isUseLocalCalculateTime(){return this._isUseLocalCalculateTime}get showPrecision(){return this._showPrecision}get is60Min(){return this.showPrecision===Ei}get is30Min(){return this.showPrecision===wi}get is10Min(){return this.showPrecision===Ti}get is5Min(){return this.showPrecision===ki}get is1Min(){return this.showPrecision===ki}get isPlaybackPauseClearCache(){return this._isPlaybackPauseClearCache}get isCacheBeforeDecodeForFpsRender(){return this._isCacheBeforeDecodeForFpsRender}setShowPrecision(e){Ci.includes(e)||(this.player.debugWarn("Playback","setShowPrecision()","type is not in PLAYBACK_CONTROL_TIME_PRECISION_ARRAY",e),e=Ei),this._showPrecision&&this._showPrecision===e||(this._showPrecision=e,this.player.emit(ot.playbackPrecision,this._showPrecision,this.playbackList),this.player.emit(ot.playbackShowPrecisionChange,this._showPrecision))}setPlayingTimestamp(e){let t;if(this.controlType===Q.normal){t=this.startTime+e,this._playingTimestamp=t,this.player.emit(ot.playbackTime,t);const i=new Date(t);this.player.emit(ot.playbackTimestamp,{ts:t,hour:i.getHours(),min:i.getMinutes(),second:i.getSeconds()})}else this.controlType===Q.simple&&(t=this.startTime+Math.round(e/1e3),t>this.totalDuration&&(this.player.debugLog("Playback","setPlayingTimestamp()",`timestamp ${t} > this.totalDuration ${this.totalDuration}`),t=this.totalDuration),this._playingTimestamp=t,this.player.emit(ot.playbackTime,t),this.player.emit(ot.playbackTimestamp,{ts:t}))}get playingTimestamp(){return this._playingTimestamp}narrowPrecision(){const e=Ci.indexOf(this.showPrecision)-1;if(e>=0){const t=Ci[e];this.setShowPrecision(t)}}expandPrecision(){const e=Ci.indexOf(this.showPrecision)+1;if(e<=Ci.length-1){const t=Ci[e];this.setShowPrecision(t)}}seek(e){if(this.player.debugLog("Playback","seek()",e),this.controlType===Q.normal){if("true"===e.hasRecord){let t=e.time;"min"===e.type&&(t=60*e.time);let i=function(e){let t={};e>-1&&(t={hour:Math.floor(e/60/60)%60,min:Math.floor(e/60)%60,second:e%60});return t}(t);if(this._playbackListStartTimestamp){const e=new Date(this._playbackListStartTimestamp).setHours(i.hour,i.min,i.second,0);i.timestamp=e;const t=this._findMoreInfoByTimestamp(e);i&&t.more&&(i.more=t.more)}this.player.emit(ot.playbackSeek,i)}}else if(this.controlType===Q.simple){let t=e.time;this.player.emit(ot.playbackSeek,{ts:t})}}currentTimeScroll(){this.player.emit(ot.playbackTimeScroll)}_findMoreInfoByTimestamp(e){let t=null;return this.playbackList.forEach(((i,s)=>{i.startTimestamp<=e&&i.endTimestamp>=e&&(t=i)})),t}_isTimeInPlaybackList(e){let t=!1;return this.playbackList.forEach(((i,s)=>{i.startTimestamp<=e&&i.endTimestamp>=e&&(t=!0)})),t}getControlType(){return this.controlType}isControlTypeNormal(){return this.controlType===Q.normal}isControlTypeSimple(){return this.controlType===Q.simple}isPlaybackPauseNotClearCacheAndCacheBeforeDecode(){return pa(this.isPlaybackPauseClearCache)&&this.isCacheBeforeDecodeForFpsRender}isPlaybackPauseNotClearCacheAndCacheBeforeDecodeAndUseFpsRender(){return this.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this.isUseFpsRender}}class nv extends wa{constructor(e){super(),this.player=e,this.TAG_NAME="zoom",this.bindEvents=[],this.isDragging=!1,this.isGesturing=!1,this.currentZoom=1,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,this.prevGestureScale=null,this.prevGestureTouches=[],this._isZooming=!1,this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.player,this.player.on(ot.zooming,this._handleZooming.bind(this)),e.debugLog("zoom","init")}destroy(){this._unbindEvents(),this.bindEvents=[],this.isDragging=!1,this.currentZoom=1,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.off(),this.player.debugLog("zoom","destroy")}_handleZooming(e){if(e){this.player.$container.classList.add("jb-pro-zoom-control"),this._bindEvents();const e=this.player.video.$videoElement.style.transform;let t=this.player.video.$videoElement.offsetLeft,i=this.player.video.$videoElement.offsetTop;t=parseFloat(t),i=parseFloat(i),t&&(this.videoPosition.left=t),i&&(this.videoPosition.top=i),this.prevVideoElementStyleTransform=e;let s=e.match(/scale\([0-9., ]*\)/g);if(s&&s[0]){let e=s[0].replace("scale(","").replace(")","");this.prevVideoElementStyleScale=e.split(",")}this._isZooming=!0}else{this.player.$container.classList.remove("jb-pro-zoom-control"),this._unbindEvents(),this._resetVideoPosition(),this.player.$container.style.cursor="auto";let e=this.prevVideoElementStyleTransform;this.player.video.$videoElement.style.transform=e,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,lo()&&this.player._opt.useWebFullScreen&&this.player.resize(),this._isZooming=!1}}_bindEvents(){const{events:{proxy:e}}=this.player,t=Sa(),i=e(this.player.$container,t.move,this.handleMouseMove.bind(this)),s=e(this.player.$container,t.down,this.handleMouseDown.bind(this)),r=e(window,t.up,this.handleMouseUp.bind(this));if(this.bindEvents.push(i,s,r),lo()&&this.player._opt.zoomSupportGestureInMobile)if(co()){this.handleGestureChangeThrottle=vo(this.handleGestureChangeForAndroid.bind(this),100);const t=e(this.player.$container,"touchstart",this.handleGestureStartForAndroid.bind(this)),i=e(this.player.$container,"touchmove",this.handleGestureChangeThrottle.bind(this)),s=e(this.player.$container,"touchend",this.handleGestureEndForAndroid.bind(this));this.bindEvents.push(t,i,s)}else{this.handleGestureChangeThrottle=vo(this.handleGestureChange.bind(this),100);const t=e(this.player.$container,"gesturestart",this.handleGestureStart.bind(this)),i=e(this.player.$container,"gesturechange",this.handleGestureChangeThrottle.bind(this)),s=e(this.player.$container,"gestureend",this.handleGestureEnd.bind(this));this.bindEvents.push(t,i,s)}}_unbindEvents(){this.bindEvents.forEach((e=>{e&&e()}))}handleMouseMove(e){if(e.stopPropagation(),this.isDragging&&this.player.zooming){e.preventDefault();const{posX:t,posY:i}=Yo(e),s=this.tempPosition.x-t,r=this.tempPosition.y-i;this.videoPosition.left=this.videoPosition.left-s,this.videoPosition.top=this.videoPosition.top-r,this.tempPosition.x=t,this.tempPosition.y=i,this.updateVideoPosition()}}handleMouseDown(e){e.stopPropagation();const t=Jo(e);if(this.player.zooming&&(t.matches("video")||t.matches("canvas"))){e.preventDefault();const{posX:t,posY:i}=Yo(e);this.player.$container.style.cursor="grabbing",this.tempPosition.x=t,this.tempPosition.y=i,this.isDragging=!0,this.player.debugLog("zoom","handleMouseDown is dragging true")}}handleMouseUp(e){e.stopPropagation(),this.isDragging&&this.player.zooming&&(e.preventDefault(),this.tempPosition={x:0,y:0},this.isDragging=!1,this.player.$container.style.cursor="grab",this.player.debugLog("zoom","handleMouseUp is dragging false"))}handleGestureStart(e){e.stopPropagation(),this.player.zooming&&(null===this.prevGestureScale&&(this.prevGestureScale=e.scale),this.isGesturing=!0)}handleGestureStartForAndroid(e){e.stopPropagation(),this.player.zooming&&e.touches.length>=2&&(this.isGesturing=!0,this.prevGestureTouches=e.touches)}handleGestureChangeForAndroid(e){if(e.stopPropagation(),e.preventDefault(),this.player.zooming&&this.isGesturing&&e.touches.length>=2){const s=e.touches,r=t(s[0],s[1])/t(this.prevGestureTouches[0],this.prevGestureTouches[1]);i(s[0],s[1]),i(this.prevGestureTouches[0],this.prevGestureTouches[1]),null===this.prevGestureScale&&(this.prevGestureScale=r);const o=r-this.prevGestureScale,a=this.player._opt.zoomSupportGestureInMobileSpeed;o>0?this.expandPrecision(a):o<0&&this.narrowPrecision(a)}function t(e,t){var i=t.pageX-e.pageX,s=t.pageY-e.pageY;return Math.sqrt(i*i+s*s)}function i(e,t){var i=e.pageX-t.pageX,s=e.pageY-t.pageY;return 180*Math.atan2(s,i)/Math.PI}}handleGestureEndForAndroid(e){e.stopPropagation(),this.player.zooming&&(this.prevGestureScale=null,this.isGesturing=!1,this.prevGestureTouches=[])}handleGestureChange(e){if(e.stopPropagation(),this.player.zooming&&this.isGesturing&&null!==this.prevGestureScale){const t=e.scale,i=t-this.prevGestureScale,s=this.player._opt.zoomSupportGestureInMobileSpeed;i>0?this.expandPrecision(s):i<0&&this.narrowPrecision(s),this.prevGestureScale=t}}handleGestureEnd(e){e.stopPropagation(),this.player.zooming&&(this.prevGestureScale=null,this.isGesturing=!1)}updateVideoPosition(){const e=this.player.video.$videoElement;e.style.left=this.videoPosition.left+"px",e.style.top=this.videoPosition.top+"px"}_resetVideoPosition(){this.player.resize(),this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.currentZoom=1,this.isDragging=!1}narrowPrecision(e){this.currentZoom<=1||(this.currentZoom-=1,this.updateVideoElementScale(e))}expandPrecision(e){this.currentZoom>=this.player._opt.zoomMaxScale||(this.currentZoom+=1,this.updateVideoElementScale(e))}updateCurrentZoom(e,t){e<1||e>this.player._opt.zoomMaxScale||(this.currentZoom=e,this.updateVideoElementScale(t))}updatePrevVideoElementStyleScale(e){this.prevVideoElementStyleScale=e}updateVideoElementScale(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5;const t=this.player.video.$videoElement;let i=t.style.transform,s=1,r=1;if(this.prevVideoElementStyleScale){const e=this.prevVideoElementStyleScale[0];void 0!==e&&(s=e,r=e);const t=this.prevVideoElementStyleScale[1];void 0!==t&&(r=t)}r=Ao(r),s=Ao(s);const o=e*s*(this.currentZoom-1)+s,a=e*r*(this.currentZoom-1)+r;let n;n=-1===i.indexOf("scale(")?i+` scale(${o},${a})`:i.replace(/scale\([0-9., ]*\)/,`scale(${o},${a})`),this.player.debugLog("zoom",`updateVideoElementScale end is X: ${s} -> ${o}, Y: ${r} -> ${a} style is ${n}`),t.style.transform=n}isZooming(){return this._isZooming}}class lv extends wa{constructor(e){super(),this.player=e,this.faceDetector=null,this.objectDetector=null,this.imageDetector=null,this.occlusionDetector=null,this.initFaceDetector(),this.initObjectDetector(),this.initImageDetector(),this.initOcclusionDetector();let t="init";this.faceDetector&&(t+=" and use faceDetector"),this.objectDetector&&(t+=" and use objectDetector"),this.imageDetector&&(t+=" and use imageDetector"),this.occlusionDetector&&(t+=" and use occlusionDetector"),this.player.debugLog("AiLoader",t)}destroy(){this.off(),this.faceDetector&&(this.faceDetector.destroy(),this.faceDetector=null),this.objectDetector&&(this.objectDetector.destroy(),this.objectDetector=null),this.imageDetector&&(this.imageDetector.destroy(),this.imageDetector=null),this.occlusionDetector&&(this.occlusionDetector.destroy(),this.occlusionDetector=null),this.player.debugLog("AiLoader","destroy")}initFaceDetector(){if(this.player._opt.useFaceDetector&&window.JessibucaProFaceDetector){const e=new JessibucaProFaceDetector({detectWidth:this.player._opt.aiFaceDetectWidth,showRect:!1,debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debugLog("AiLoader","init face detector success"),this.faceDetector=e,this.faceDetector.on("jessibuca-pro-face-detector-info",(e=>{if(this.player.emit(ot.aiFaceDetectorInfo,e),this.player._opt.aiFaceDetectShowRect){const t=this.player._opt.aiFaceDetectRectConfig||{},i=(e.list||[]).map((e=>(e.type="rect",e.color=t.borderColor||"#0000FF",e.lineWidth=t.borderWidth||2,e)));this.player.video&&this.player.video.addAiContentToCanvas(i)}}))}))}}initObjectDetector(){if(this.player._opt.useObjectDetector&&window.JessibucaProObjectDetector){const e=new JessibucaProObjectDetector({detectWidth:this.player._opt.aiObjectDetectWidth,showRect:!1,debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debugLog("AiLoader","init object detector success"),this.objectDetector=e,this.objectDetector.on("jessibuca-pro-object-detector-info",(e=>{if(this.player.emit(ot.aiObjectDetectorInfo,e),this.player._opt.aiObjectDetectShowRect){const t=[],i=this.player._opt.aiObjectDetectRectConfig||{};(e.list||[]).forEach((e=>{const s={type:"rect",color:i.borderColor||"#0000FF",lineWidth:i.borderWidth||2,x:e.rect.x,y:e.rect.y,width:e.rect.width,height:e.rect.height},r={type:"text",color:i.color||"#000",fontSize:i.fontSize||14,text:e.zh,x:e.rect.x,y:e.rect.y-25};t.push(s,r)})),this.player.video&&this.player.video.addAiContentToCanvas(t)}}))}))}}initImageDetector(){if(this.player._opt.useImageDetector&&window.JessibucaProImageDetector){const e=new JessibucaProImageDetector({debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debugLog("AiLoader","init image detector success"),this.imageDetector=e}))}}initOcclusionDetector(){if(this.player._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector){const e=new JessibucaProOcclusionDetector({debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debugLog("AiLoader","init occlusion detector success"),this.occlusionDetector=e}))}}updateFaceDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.faceDetector&&this.faceDetector.updateConfig(e)}updateObjectDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.objectDetector&&this.objectDetector.updateConfig(e)}updateImageDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.imageDetector&&this.imageDetector.updateConfig(e)}updateOcclusionDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.occlusionDetector&&this.occlusionDetector.updateConfig(e)}}class dv extends wa{constructor(e){super(),this.player=e,this.LOG_NAME="Contextmenu",this.menuList=[],this.$contextmenus=e.control.$contextmenus,lo()?this.player.debugWarn(this.LOG_NAME,"not support mobile"):this.init(),e.debugLog(this.LOG_NAME,"init")}destroy(){this.menuList=[],this.player.debugLog(this.LOG_NAME,"destroy")}get isShow(){return e=this.player.$container,t="jb-pro-contextmenus-show",e.classList.contains(t);var e,t}show(){tc(this.player.$container,"jb-pro-contextmenus-show")}hide(){var e,t;e=this.player.$container,t="jb-pro-contextmenus-show",e.classList.remove(t)}init(){const{events:{proxy:e},debug:t}=this.player;this.player._opt.contextmenuBtns.length>0&&this.player._opt.contextmenuBtns.forEach((e=>{this.addMenuItem(e)})),e(this.player.$container,"contextmenu",(e=>{e.preventDefault(),this.show();const t=e.clientX,i=e.clientY,{height:s,width:r,left:o,top:a}=this.player.$container.getBoundingClientRect(),{height:n,width:l}=this.$contextmenus.getBoundingClientRect();let d=t-o,h=i-a;t+l>o+r&&(d=r-l),i+n>a+s&&(h=s-n),io(this.$contextmenus,{left:`${d}px`,top:`${h}px`})})),e(this.player.$container,"click",(e=>{rc(e,this.$contextmenus)||this.hide()})),this.player.on(ot.blur,(()=>{this.hide()}))}_validateMenuItem(e){let t=!0;return e.content||(this.player.debugWarn(this.LOG_NAME,"content is required"),t=!1),t}addMenuItem(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=la(Es);if(e=Object.assign({},t,e),!this._validateMenuItem(e))return;const{events:{proxy:i},debug:s}=this.player,r=bo(),o=`\n
\n ${e.content}\n
\n `,a=Array.from(this.$contextmenus.children)[e.index];a?a.insertAdjacentHTML("beforebegin",o):ic(this.$contextmenus,o);const n=this.$contextmenus.querySelector(`.jb-pro-contextmenu-${r}`);e.click&&i(n,"click",(t=>{t.preventDefault(),e.click.call(this.player,this,t),this.hide()})),this.menuList.push({uuid:r,$menuItem:n})}}class hv extends wa{constructor(e){super(),this.player=e,this.TAG_NAME="CommonWebrtc",this.rtcPeerConnection=null,this.videoStream=null,this.isDisconnected=!1,this.isH264=this.player.isWebrtcH264(),this.eventsDestroy=[],this.supportVideoFrameCallbackHandle=null,this.isInitInfo=!1,this.$videoElement=this.player.video.$videoElement,this.bandwidthEstimateInterval=null,this.rtcPeerTrackVideoReceiver=null,this.rtcPeerTrackAudioReceiver=null,this.prevWebrtcVideoStats={},this.prevWebrtcAudioStats={},this.currentWebrtcStats={},this.player._opt.webrtcUseCanvasRender&&this.isH264&&(this.$videoElement=document.createElement("video"),mo()&&(this.$videoElement.style.position="absolute"),this._initVideoEvents()),this.$videoElement.muted=!0,this._initRtcPeerConnection()}destroy(){if(this.isDisconnected=!1,this.isInitInfo=!1,this.prevWebrtcVideoStats={},this.currentWebrtcStats={},this.rtcPeerTrackVideoReceiver=null,this.rtcPeerTrackAudioReceiver=null,this._stopBandwidthEstimateInterval(),this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this.isH264&&(this.videoStream&&(this.videoStream.getTracks().forEach((e=>e.stop())),this.videoStream=null),this.$videoElement))if(this.player._opt.webrtcUseCanvasRender){this.$videoElement.pause&&(this.$videoElement.pause(),this.$videoElement.muted=!0),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"));try{this.$videoElement.load()}catch(e){}}else this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject"));this.$videoElement=null,this.rtcPeerConnection&&(this.rtcPeerConnection.onicecandidate=Yr,this.rtcPeerConnection.ontrack=Yr,this.rtcPeerConnection.onconnectionstatechange=Yr,this.rtcPeerConnection.ondatachannel=Yr,this.rtcPeerConnection.close(),this.rtcPeerConnection=null)}_initVideoEvents(){const{proxy:e}=this.player.events,t=e(this.$videoElement,Qi,(()=>{this.player.debugLog(this.TAG_NAME,"video canplay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video play"),this._startCanvasRender(),this._initRenderSize()})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video play error ",e)}))})),i=e(this.$videoElement,Xi,(()=>{this.player.debugLog(this.TAG_NAME,"video waiting")})),s=e(this.$videoElement,Zi,(e=>{const t=parseInt(e.timeStamp,10);this.player.handleRender(),this.player.updateStats({ts:t}),this.$videoElement.paused&&(this.player.debugWarn(this.TAG_NAME,"video is paused and next try to replay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video is paused and replay success")})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video is paused and replay error ",e)})))})),r=e(this.$videoElement,es,(()=>{this.player.debugLog(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate)}));this.eventsDestroy.push(t,i,s,r)}_initRtcPeerConnection(){const e=new RTCPeerConnection,t=this.player;e.addTransceiver("video",{direction:"recvonly"}),e.addTransceiver("audio",{direction:"recvonly"}),e.onsignalingstatechange=e=>{this.player.debugLog(this.TAG_NAME,"onsignalingstatechange[本地端的信号状态]",e)},e.onicegatheringstatechange=t=>{this.player.debugLog(this.TAG_NAME,"onicegatheringstatechange[ICE收集状态]",t,e.iceGatheringState)},e.onnegotiationneeded=e=>{this.player.debugLog(this.TAG_NAME,"onnegotiationneeded[通信环境发生变化]",e)},e.oniceconnectionstatechange=i=>{this.player.debugLog(this.TAG_NAME,"oniceconnectionstatechange",e.iceConnectionState);const s=e.iceConnectionState;switch(this.player.emit(ot.webrtcOnIceConnectionStateChange,s),this.isDisconnected="disconnected"===s,e.iceConnectionState){case"new":case"checking":case"closed":case"connected":case"completed":break;case"failed":t.emit(ot.webrtcFailed);break;case"disconnected":t.emit(ot.webrtcDisconnect);break;case"closed":t.emit(ot.webrtcClosed)}},e.onicecandidate=e=>{this.player.debugLog(this.TAG_NAME,"onicecandidate",e),e.candidate&&this.player.debugLog(this.TAG_NAME,"Remote ICE candidate: ",e.candidate.candidate)},e.ontrack=t=>{if(this.player.debugLog(this.TAG_NAME,"ontrack",t),"video"===t.track.kind){this.player.debugLog(this.TAG_NAME,"ontrack video"),this.rtcPeerTrackVideoReceiver=e.getReceivers().find((function(e){return e.track===t.track})),this.rtcPeerTrackVideoReceiver&&this._startBandwidthEstimateInterval();let i=t.streams[0];this.$videoElement.autoplay=!0,this.$videoElement.srcObject=i,this.videoStream=i}else"audio"===t.track.kind&&(this.player.debugLog(this.TAG_NAME,"ontrack audio"),this.rtcPeerTrackAudioReceiver=e.getReceivers().find((function(e){return e.track===t.track})),this.rtcPeerTrackAudioReceiver&&this._startBandwidthEstimateInterval())},e.onicecandidateerror=e=>{this.player.debugLog(this.TAG_NAME,"onicecandidateerror[candidate错误]",e),this.player.emitError(lt.webrtcIceCandidateError,e)},e.onconnectionstatechange=i=>{switch(this.player.debugLog(this.TAG_NAME,"onconnectionstatechange[所有ICE 状态总览]",i),this.player.emit(ot.webrtcOnConnectionStateChange,e.connectionState),e.connectionState){case"new":case"connecting":case"connected":case"disconnected":break;case"failed":this.isDisconnected&&t.emit(ot.webrtcFailed)}},this.rtcPeerConnection=e}_startBandwidthEstimateInterval(){this.player.debugLog(this.TAG_NAME,"_startBandwidthEstimateInterval"),this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((()=>{this.rtcPeerTrackVideoReceiver&&this.rtcPeerTrackVideoReceiver.getStats().then((e=>{let t={},i=0;e.forEach((e=>{if(e)switch(e.type){case ar:("succeeded"===e.state||e.bytesReceived)&&(this.currentWebrtcStats.timestamp=e.timestamp,this.currentWebrtcStats.rtt=e.currentRoundTripTime||-1,this.currentWebrtcStats.bytesReceived=e.bytesReceived||0,this.currentWebrtcStats.bytesSent=e.bytesSent||0);break;case dr:this.currentWebrtcStats.remoteCandidate=e||{};break;case lr:this.currentWebrtcStats.localCandidate=e||{};break;case nr:this.currentWebrtcStats.lastTimeStamp=e.timestamp;const s=((e.timestamp||0)-(this.prevWebrtcVideoStats.timestamp||0))/1e3,r=Number(e.bytesReceived||0)-Number(this.prevWebrtcVideoStats.bytesReceived||0),o=Math.floor(r/s);i+=o,t.vbps=o,this.prevWebrtcVideoStats=e;break;case hr:e.frameWidth&&e.frameHeight&&(this.currentWebrtcStats.frameWidth=e.frameWidth||0,this.currentWebrtcStats.frameHeight=e.frameHeight||0)}})),this.rtcPeerTrackAudioReceiver?this.rtcPeerTrackAudioReceiver.getStats().then((e=>{e.forEach((e=>{if(e&&e.type===nr){this.currentWebrtcStats.lastTimeStamp=e.timestamp;const s=((e.timestamp||0)-(this.prevWebrtcAudioStats.timestamp||0))/1e3,r=Number(e.bytesReceived||0)-Number(this.prevWebrtcAudioStats.bytesReceived||0),o=Math.floor(r/s);i+=o,t.abps=o,this.prevWebrtcAudioStats=e}})),this.player.updateStats(t),this.player.emit(ot.kBps,(i/1024).toFixed(2))})):(this.player.updateStats(t),this.player.emit(ot.kBps,(i/1024).toFixed(2)))}))}),1e3)}_stopBandwidthEstimateInterval(){this.player.debugLog(this.TAG_NAME,"_stopBandwidthEstimateInterval"),this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}_startCanvasRender(){ba()?this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)):(this._stopCanvasRender(),this.canvasRenderInterval=setInterval((()=>{this.player.video.render({$video:this.$videoElement,ts:0})}),40))}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player.isDestroyedOrClosed()?this.player.debugLog(this.TAG_NAME,"videoFrameCallback() player is destroyed"):(this.player.video.render({$video:this.$videoElement,ts:t.mediaTime||0}),this.player.updateStats({dts:t.mediaTime||0}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)))}_initRenderSize(){this.isInitInfo||(this.player.video.updateVideoInfo({width:this.$videoElement.videoWidth,height:this.$videoElement.videoHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0)}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}isVideoPlaying(){return this.$videoElement&&pa(this.$videoElement.paused)&&pa(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}getVideoBufferTimeRange(){const e=this.$videoElement;let t=null;if(e){const i=e.buffered,s=i.length?i.start(0):0,r=i.length?i.end(i.length-1):0;t={start:s,end:r,diff:r-s}}return t}}class cv extends hv{constructor(e){super(e),this.TAG_NAME="WebrtcForSRSDecoder",this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy")}loadSource(e){return new Promise(((t,i)=>{const s=this.rtcPeerConnection;s.createOffer().then((r=>{s.setLocalDescription(r),this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:t})}(e,r.sdp).then((e=>{this.player.debugLog(this.TAG_NAME,`getWebRtcRemoteSdp response and code is ${e.code}`);const r=e;if(r&&0!==r.code)return this.player.debugError(this.TAG_NAME,`response json code ${r.code}`),i(r.msg);r?s.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:r})).then((()=>{t()})).catch((e=>{this.player&&this.player.debugError(this.TAG_NAME,"loadSource setRemoteDescription error",e.toString(),e),i(e)})):(this.player.debugError(this.TAG_NAME,"response sdp is null"),i("response sdp is null"))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e.toString(),e),i(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e.toString(),e),i(e)}))}))}}class uv extends hv{constructor(e){super(e),this.TAG_NAME="WebrtcForOthersDecoder",this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy")}loadSource(e){return new Promise(((t,i)=>{const s=this.rtcPeerConnection;s.createOffer().then((r=>{s.setLocalDescription(r),this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:t})}(e,r.sdp).then((e=>{this.player.debugLog(this.TAG_NAME,`getWebRtcRemoteSdp response and code is ${e.code}`),e.text().then((e=>{this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp response");try{let t=JSON.parse(e);this.player.debugLog(this.TAG_NAME,"this is json sdp response"),0!=t.code&&(this.player.debugError(this.TAG_NAME,`response json code ${t.code}`),i(new Error(`response sdp json code: ${t.code}`))),e=t.sdp}catch(e){this.player.debugLog(this.TAG_NAME,"this is raw sdp response")}e?s.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})).then((()=>{t()})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource setRemoteDescription error",e.toString(),e),i(e)})):(this.player.debugError(this.TAG_NAME,"loadSource sdp is null"),i("sdp is null"))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource response.text() error",e.toString(),e),i(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e.toString(),e),i(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e.toString(),e),i(e)}))}))}}class pv extends hv{constructor(e){super(e),this.rtcPeerConnectionDataChannel=null,this.player.isWebrtcH265()&&(this.streamRate=oo((t=>{e.emit(ot.kBps,(t/1024).toFixed(2))}))),this.TAG_NAME="WebrtcForM7SDecoder",this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.stopStreamRateInterval(),this.rtcPeerConnectionDataChannel&&(this.rtcPeerConnectionDataChannel.onopen=Yr,this.rtcPeerConnectionDataChannel.onclose=Yr,this.rtcPeerConnectionDataChannel.onmessage=Yr,this.rtcPeerConnectionDataChannel.close(),this.rtcPeerConnectionDataChannel=null),this.player.debugLog(this.TAG_NAME,"destroy")}_initRtcPeerConnection(){const e=new RTCPeerConnection,t=this.player;e.addTransceiver("video",{direction:"recvonly"}),e.addTransceiver("audio",{direction:"recvonly"}),e.onsignalingstatechange=e=>{this.player.debugLog(this.TAG_NAME,"onsignalingstatechange[本地端的信号状态]",e)},e.onicegatheringstatechange=t=>{this.player.debugLog(this.TAG_NAME,"onicegatheringstatechange[ICE收集状态]",t,e.iceGatheringState)},e.onnegotiationneeded=e=>{this.player.debugLog(this.TAG_NAME,"onnegotiationneeded[通信环境发生变化]",e)},e.oniceconnectionstatechange=i=>{this.player.debugLog(this.TAG_NAME,"oniceconnectionstatechange",e.iceConnectionState);const s=e.iceConnectionState;switch(this.player.emit(ot.webrtcOnIceConnectionStateChange,s),this.isDisconnected="disconnected"===s,e.iceConnectionState){case"new":case"checking":case"closed":case"connected":case"completed":break;case"failed":t.emit(ot.webrtcFailed);break;case"disconnected":t.emit(ot.webrtcDisconnect);break;case"closed":t.emit(ot.webrtcClosed)}},e.onicecandidate=e=>{this.player.debugLog(this.TAG_NAME,"onicecandidate",e),e.candidate&&this.player.debugLog(this.TAG_NAME,"Remote ICE candidate: ",e.candidate.candidate)},e.ontrack=i=>{this.player.debugLog(this.TAG_NAME,"ontrack",i);const s=t.video.$videoElement;if(t.isWebrtcH264())if("video"===i.track.kind){this.player.debugLog(this.TAG_NAME,"ontrack video"),this.rtcPeerTrackVideoReceiver=e.getReceivers().find((function(e){return e.track===i.track})),this.rtcPeerTrackVideoReceiver&&this._startBandwidthEstimateInterval();let t=i.streams[0];s.autoplay=!0,s.srcObject=t,this.videoStream=t}else"audio"===i.track.kind&&(this.player.debugLog(this.TAG_NAME,"ontrack audio"),this.rtcPeerTrackAudioReceiver=e.getReceivers().find((function(e){return e.track===i.track})),this.rtcPeerTrackAudioReceiver&&this._startBandwidthEstimateInterval())},e.onicecandidateerror=e=>{this.player.debugLog(this.TAG_NAME,"onicecandidateerror[candidate错误]",e),this.player.emitError(lt.webrtcIceCandidateError,e)},e.onconnectionstatechange=i=>{switch(this.player.debugLog(this.TAG_NAME,"onconnectionstatechange[所有ICE 状态总览]",i),this.player.emit(ot.webrtcOnConnectionStateChange,e.connectionState),e.connectionState){case"new":case"connecting":case"connected":case"disconnected":break;case"failed":this.isDisconnected&&t.emit(ot.webrtcFailed)}},e.ondatachannel=e=>{const t=e.channel;this.player.debugLog(this.TAG_NAME,"ondatachannel"),t.onopen=()=>{this.player.debugLog(this.TAG_NAME,"ondatachannel and onopen")},t.onmessage=e=>{const t=e.data;if(this.player.isWebrtcH264())return this.player.debugWarn(this.TAG_NAME,"ondatachannel is H265 but decode is h264 so emit webrtcStreamH265 "),void this.player.emit(ot.webrtcStreamH265);this.player.isDestroyedOrClosed()?this.player.debugWarn(this.TAG_NAME,"ondatachannel and player is destroyed"):(this.streamRate&&this.streamRate(t.byteLength),this.player.demux&&this.player.demux.dispatch(t))},t.onclose=()=>{this.player.debugWarn(this.TAG_NAME,"ondatachannel and onclose")},this.rtcPeerConnectionDataChannel=t};e.createDataChannel("signal").onmessage=e=>{this.player.debugLog(this.TAG_NAME,"signalChannel,onmessage",e);JSON.parse(e.data).type},this.rtcPeerConnection=e}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}loadSource(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{const r=this.rtcPeerConnection;r.createOffer().then((o=>{r.setLocalDescription(o),this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t,i){let s={"Content-Type":"application/sdp"};return i.username&&i.password&&(s.Authorization="Basic "+btoa(i.username+":"+i.password)),fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:s,body:t})}(e,o.sdp,t).then((e=>{e.text().then((e=>{this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp response"),e?r.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})).then((()=>{this.player.isWebrtcH265()&&this.startStreamRateInterval(),i()})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource setRemoteDescription error",e.toString(),e),s(e)})):(this.player.debugError(this.TAG_NAME,"loadSource sdp is null"),s("sdp is null"))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource response.text() error",e.toString(),e),s(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e.toString(),e),s(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e.toString(),e),s(e)}))}))}}class fv extends hv{constructor(e){super(e),this.TAG_NAME="WebrtcForZLMDecoder",this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy")}loadSource(e){return new Promise(((t,i)=>{const s=this.rtcPeerConnection;s.createOffer().then((r=>{s.setLocalDescription(r),this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return Ll({url:e,type:"POST",data:t,contentType:"text/plain;charset=utf-8",processData:!1,dataType:"json"})}(e,r.sdp).then((e=>{this.player.debugLog(this.TAG_NAME,`getWebRtcRemoteSdp response and code is ${e.code}`);const r=e;if(r&&0!==r.code)return this.player.debugError(this.TAG_NAME,`response json code ${r.code}`),i(r.msg);r&&r.sdp?s.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:r.sdp})).then((()=>{t()})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource setRemoteDescription error",e.toString(),e),i(e)})):(this.player.debugError(this.TAG_NAME,"response sdp is null"),i("sdp is null"))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e.toString(),e),i(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e.toString(),e),i(e)}))}))}}class mv extends wa{constructor(e){if(super(),this.TAG_NAME="AliyunRtc",this.player=e,!window.AliRTS)throw new Error("AliyunRtc is not defined");this.aliyunRtc=window.AliRTS.createClient(),this.aliyunRtcRemoteStream=null,this.$videoElement=this.player.video.$videoElement,this.listenEvents(),this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.aliyunRtc&&(this.aliyunRtcRemoteStream&&(this.aliyunRtcRemoteStream=null),this.aliyunRtc.unsubscribe(),this.aliyunRtc=null),this.$videoElement=null,this.off(),this.player.debugLog(this.TAG_NAME,"destroy")}listenEvents(){this.aliyunRtc.on("onError",(e=>{this.player.debugLog(this.TAG_NAME,`onError and code is ${e.errorCode} and message: ${e.message}`),10400!==e.errorCode&&(this.player.debugError(this.TAG_NAME,`onError and code is ${e.errorCode} and message: ${e.message}`),this.player.emitError(lt.aliyunRtcError,e))})),this.aliyunRtc.on("reconnect",(e=>{this.player.debugLog(this.TAG_NAME,"reconnect",e)}));const e="canplay",t="waiting",i="playing",s="media";this.aliyunRtc.on("onPlayEvent",(r=>{if(r.event===e)this.player.debugLog(this.TAG_NAME,"onPlayEvent and canplay");else if(r.event===t)this.player.debugLog(this.TAG_NAME,"onPlayEvent and playing - > waiting");else if(r.event===i)this.player.debugLog(this.TAG_NAME,"onPlayEvent and waiting -> playing");else if(r.event===s){const e=r.data;let t={},i=0;if(e.audio){const s=Math.floor(e.audio.bytesReceivedPerSecond);i+=s,t.abps=s}if(e.video){const s=Math.floor(e.video.bytesReceivedPerSecond);i+=s,t.vbps=s}this.player.updateStats(t),this.player.emit(ot.kBps,(i/1024).toFixed(2))}}))}loadSource(e){return new Promise(((t,i)=>{this.aliyunRtc.isSupport({isReceiveVideo:!0}).then((()=>{this.aliyunRtc.subscribe(e,{}).then((e=>{this.aliyunRtcRemoteStream=e,e.play(this.$videoElement),t()})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource and subscribe is not success: ",e.message),i(e.message)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource and is not support: ",e.message),i(e.message)}))}))}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}isVideoPlaying(){return this.$videoElement&&pa(this.$videoElement.paused)&&pa(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}getVideoBufferTimeRange(){const e=this.$videoElement;let t=null;if(e){const i=e.buffered,s=i.length?i.start(0):0,r=i.length?i.end(i.length-1):0;t={start:s,end:r,diff:r-s}}return t}}class gv{constructor(e){this.player=e,this.TAG_NAME="PressureObserverCpu",this.observer=null,this.latestCpuInfo=null,this.currentLevel=-1,this.observeCpuSuccess=!1,this._init(),this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.observer&&(this.observeCpuSuccess&&this.observer.disconnect(),this.observer=null),this.latestCpuInfo=null,this.currentLevel=-1,this.player.debugLog(this.TAG_NAME,"destroy")}getCurrentCpuState(){return this.currentLevel}_init(){pa(va())?this.player.debugLog(this.TAG_NAME,"not support PressureObserver"):(this.observer=new PressureObserver((e=>{const t=(e||[]).find((e=>"cpu"===e.source));if(t){switch(this.latestCpuInfo=t,t.state){case"nominal":this.currentLevel=0;break;case"fair":this.currentLevel=1;break;case"serious":this.currentLevel=2;break;case"critical":this.currentLevel=3;break;default:this.currentLevel=-1}this.player.emit(ot.pressureObserverCpu,this.currentLevel)}})),this.observer&&this.observer.observe("cpu",{sampleInterval:1e3}).then((()=>{this.observeCpuSuccess=!0,this.player.debugLog(this.TAG_NAME,"observe cpu success")})).catch((()=>{this.observeCpuSuccess=!1,this.player.debugLog(this.TAG_NAME,"observe cpu fail")})))}}class yv extends Ua{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e),this.TAG_NAME="DynamicWatermark",this.isPauseAnimation=!1,this.isStopAnimation=!1,this.rafID=null,this.speed=t.speed||.2,this.isDynamic=!0,this.shadowRootDynamicDom=null,this.isGhost=!0===t.isGhost,this.ghostConfig={on:t.on||5,off:t.off||5},this.waterMarkWillRemove=!1,this.waterMarkWillAdd=!1,this.player.once(ot.start,(()=>{const e=pa(no)?decodeURIComponent("JessibucaPro%20%E4%BD%93%E9%AA%8C"):t.content;let i=this.player.getVideoInfo();i||(i={width:200,height:200}),this.update({text:{content:e,fontSize:t.fontSize||18,color:t.color||"white"},left:i.width*Math.random(),top:i.height*Math.random(),opacity:t.opacity||.15}),this.startAnimation()})),this.player.debugLog(this.TAG_NAME,"int")}destroy(){super.destroy(),this.shadowRootDynamicDom=null,this.stopAnimation(),this.rafID&&(cancelAnimationFrame(this.rafID),this.rafID=null)}startAnimation(){if(!this.rafID){let e=1,t=1,i=Math.random(),s={width:0,height:0};const r=()=>{try{if(pa(this.isPauseAnimation)&&this.shadowRootDynamicDom&&this.shadowRootInnerDom){const o=this.shadowRootInnerDom,a=this.shadowRootDynamicDom,n=o.getBoundingClientRect(),l=a.getBoundingClientRect();if(l.width&&l.height&&(s.width=l.width,s.height=l.height),!this.shadowRootInnerDom.contains(this.shadowRootDynamicDom))return this.isGhost?pa(this.waterMarkWillAdd)&&(this.waterMarkWillAdd=!0,setTimeout((()=>{this._addDom(n,s),this.waterMarkWillAdd=!1}),1e3*this.ghostConfig.off)):this._addDom(n,s),void(0!==this.speed&&requestAnimationFrame(r));const d=Math.min(1,0===this.speed?0:this.speed?this.speed:.2);let h=l.left-n.left,c=l.top-n.top;h+=d*t*i,c+=d*e*(1-i),h+s.width>n.width?(t=-1,i=Math.random()):h<0&&(t=1,i=Math.random()),c+s.height>n.height?(e=-1,i=Math.random()):c<0&&(e=1,i=Math.random()),h=Math.min(n.width-s.width,h),c=Math.min(n.height-s.height,c);const u=h/n.width*100,p=c/n.height*100;this.shadowRootDynamicDom.style.left=`${u}%`,this.shadowRootDynamicDom.style.top=`${p}%`,pa(this.waterMarkWillRemove)&&this.isGhost&&(this.waterMarkWillRemove=!0,setTimeout((()=>{this._removeDom(),this.waterMarkWillRemove=!1}),1e3*this.ghostConfig.on))}}catch(e){}if(this.isStopAnimation)return this.isStopAnimation=!1,cancelAnimationFrame(this.rafID),void(this.rafID=null);0!==this.speed&&requestAnimationFrame(r)};this.rafID=requestAnimationFrame(r)}}_addDom(e,t){if(this.shadowRootInnerDom&&this.shadowRootDynamicDom){this.shadowRootInnerDom.appendChild(this.shadowRootDynamicDom);let i=e.width*Math.random(),s=e.height*Math.random();i=Math.min(e.width-2*t.width,i),s=Math.min(e.height-2*t.height,s),this.shadowRootDynamicDom.style.left=`${i}px`,this.shadowRootDynamicDom.style.top=`${s}px`}}resumeAnimation(){this.isPauseAnimation=!1}pauseAnimation(){this.isPauseAnimation=!0}stopAnimation(){this.isStopAnimation=!0}}class Av extends wa{constructor(e){super(),this.player=e,this.TAG_NAME="DrawRectangle",this.drawingRectangle=!1,this.isDragging=!1,this.bindEvents=[],this.$rectBox=null,this._resetPoint(),this.player.on(ot.drawingRect,this._handleDrawingRect.bind(this)),this.player.debugLog(this.TAG_NAME,"init")}destroy(){this._unbindEvents(),this.drawingRectangle=!1,this.isDragging=!1,this._removeRectBox(),this.off(),this.player.debugLog(this.TAG_NAME,"destroy")}_resetPoint(){this.startPagePoint={x:0,y:0},this.startPoint={x:0,y:0},this.endPoint={x:0,y:0}}_handleDrawingRect(e){this.drawingRectangle=e,e?this._bindEvents():(this._unbindEvents(),this._removeRectBox())}_bindEvents(){const{events:{proxy:e}}=this.player,t=e(this.player.$container,"mousemove",this.handleMouseMove.bind(this)),i=e(this.player.$container,"mousedown",this.handleMouseDown.bind(this)),s=e(window,"mouseup",this.handleMouseUp.bind(this));this.bindEvents.push(t,i,s)}_unbindEvents(){this.bindEvents.forEach((e=>{e&&e()})),this.bindEvents=[]}_removeRectBox(){if(this.$rectBox){if(!oc(this.$rectBox)){const e=this.player.$container.querySelector(".jb-pro-drawing-rect-box");e&&this.player.$container&&this.player.$container.removeChild(e)}this.$rectBox=null}}handleMouseDown(e){if(e.stopPropagation(),!this.drawingRectangle)return;this._removeRectBox();const t=e.offsetX,i=e.offsetY;this.startPoint.x=t,this.startPoint.y=i,this.startPagePoint.x=e.pageX-this.player.$container.offsetLeft,this.startPagePoint.y=e.pageY-this.player.$container.offsetTop,this.$rectBox=document.createElement("div"),this.$rectBox.classList.add("jb-pro-drawing-rect-box"),this.$rectBox.style.border=`${this.player._opt.drawingRectLineWidth}px solid ${this.player._opt.drawingRectColor}`,this.$rectBox.style.position="absolute",this.$rectBox.style.left=`${this.startPoint.x}px`,this.$rectBox.style.top=`${this.startPoint.y}px`,this.player.$container.appendChild(this.$rectBox),this.isDragging=!0}handleMouseMove(e){if(e.stopPropagation(),!this.isDragging)return;if(!this.drawingRectangle)return;if(!this.$rectBox)return;const t=this.player.$container,i=this.player.getControlHeight(),s=e.pageX-t.offsetLeft,r=e.pageY-t.offsetTop;if(sn&&(o=n,this.endPoint.x=this.startPoint.x+o),a>l&&(a=l,this.endPoint.y=this.startPoint.y+a),this.$rectBox.style.width=`${o}px`,this.$rectBox.style.height=`${a}px`}handleMouseUp(e){if(e.stopPropagation(),this.drawingRectangle&&this.isDragging){e.preventDefault(),this.isDragging=!1,this.player._opt.drawingRectEndRemoveDom&&this._removeRectBox();const t={startPoint:this.startPoint,endPoint:this.endPoint,width:Math.abs(this.endPoint.x-this.startPoint.x),height:Math.abs(this.endPoint.y-this.startPoint.y)};this.player._opt.isResize,this.player.emit(ot.drawingRectInfo,t),this._resetPoint()}}}class bv extends wa{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this._opt={},this.TAG_NAME="Player",this.$container=e;const i=ha();if(this._opt=Object.assign({},i,t),this.debug=new Tr(this),this.debugLog(this.TAG_NAME,"init and version is",ao),this._opt.forceNoOffscreen=!0,this._canPlayAppleMpegurl=!1,(mo()||fo())&&(this._canPlayAppleMpegurl=Qo(),this.debugLog(this.TAG_NAME,"isIOS or isSafari and canPlayAppleMpegurl",this._canPlayAppleMpegurl)),ua(Cr.isEnabled)&&ua(this._opt.useWebFullScreen)&&(this.debugLog(this.TAG_NAME,"screenfull.isEnabled is true and _opt.useWebFullScreen is true , set _opt.useWebFullScreen false"),this._opt.useWebFullScreen=!1),pa(Cr.isEnabled)&&pa(this._opt.useWebFullScreen)&&(this.debugLog(this.TAG_NAME,"screenfull.isEnabled is false and _opt.useWebFullScreen is false , set _opt.useWebFullScreen true"),this._opt.useWebFullScreen=!0),ma()&&(this.debugLog(this.TAG_NAME,"isIphone and set _opt.videoRenderSupportScale false"),this._opt.videoRenderSupportScale=!1,Ho()&&ua(this._opt.isHls)&&pa(this._opt.supportHls265)&&(this.debugLog(this.TAG_NAME,"isIphone and is in wechat and is hls so set supportHls265 true"),this._opt.supportHls265=!0)),pa(this._opt.playFailedAndReplay)&&(this.debugLog(this.TAG_NAME,"_opt.playFailedAndReplay is false and set others replay params false"),this._opt.webglAlignmentErrorReplay=!1,this._opt.webglContextLostErrorReplay=!1,this._opt.autoWasm=!1,this._opt.mseDecodeErrorReplay=!1,this._opt.mediaSourceTsIsMaxDiffReplay=!1,this._opt.wcsDecodeErrorReplay=!1,this._opt.wasmDecodeErrorReplay=!1,this._opt.simdDecodeErrorReplay=!1,this._opt.videoElementPlayingFailedReplay=!1,this._opt.networkDelayTimeoutReplay=!1,this._opt.widthOrHeightChangeReplay=!1,this._opt.simdH264DecodeVideoWidthIsTooLargeReplay=!1,this._opt.mediaSourceUseCanvasRenderPlayFailedReplay=!1,this._opt.heartTimeoutReplay=!1,this._opt.loadingTimeoutReplay=!1,this._opt.websocket1006ErrorReplay=!1,this._opt.streamErrorReplay=!1,this._opt.streamEndReplay=!1,this._opt.mseWaitVideoCanplayAutoWasm=!1),this._opt.hiddenControl&&(this.debugLog(this.TAG_NAME,"_opt.hiddenControl is true and set others show btn to false"),Object.keys(this._opt.operateBtns).forEach((e=>{this._opt.operateBtns[e]&&-1===(""+e).indexOf("Fn")&&(this._opt.operateBtns[e]=!1)})),this._opt.showBandwidth=!1,this._opt.extendOperateBtns=[],this._opt.controlHtml="",this.isPlayback()&&(this._opt.playbackConfig.showControl=!1)),this._opt.watermarkConfig={image:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAS4AAABgCAYAAACjZZ/rAAAK4mlDQ1BJQ0MgUHJvZmlsZQAASImVlwdUU1kagO976SEhkIQISAm9SW8BpIQeivQqKiEJJJQQE4KCDZXBERwVRESwDOCoiIKjIyBjQSxYUWzYB2RQUNbBgg2VfcASZmbP7p7937nvfufPf/9yz705/wOAHMKVSDJhFQCyxDnSyABvZnxCIhP3DOAAA9CBA7Dm8mQSdnh4CEBkev6rvL8LoIn5luWEr3///b8KlS+Q8QCAkhBO4ct4WQi3I2OEJ5HmAIA6jOgNluRIJvg2wnQpkiDCgxOcNsVfJjhlktEqkzbRkT4IGwKAJ3G50jQASDaInpnLS0P8kMIRthHzRWKECxD24Am5fISRuGBOVlb2BA8jbIrYSwAg0xFmpfzJZ9pf/Kco/HO5aQqeqmtS8L4imSSTm/d/bs3/lqxM+XQMY2SQhNLASGRWR/bvXkZ2sILFKfPCplnEn7SfZKE8MGaaeTKfxGnmc32DFWsz54VMc6rIn6Pwk8OJnmaBzC9qmqXZkYpYqVIf9jRzpTNx5RkxCr1QwFH4zxdGx01zrih23jTLMqKCZ2x8FHqpPFKRv0Ac4D0T119Re5bsT/WKOIq1OcLoQEXt3Jn8BWL2jE9ZvCI3vsDXb8YmRmEvyfFWxJJkhivsBZkBCr0sN0qxNgc5nDNrwxV7mM4NCp9m4Av8QAjyMEEMsAPOwBawQAQIzREszZkoxidbkicVpQlzmGz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QlyWazKpsCAgCAhxSR8QBAQByyEgxGW5JpMKCwKCgBCX9AFBQBCwHAJCXJZrMqmwICAICHFJHxAEBAHLISDEZbkmkwoLAoKAEJf0AUFAELAcAkJclmsyqbAgIAgIcUkfEAQEAcshIMRluSaTCgsCgsD/AFt/MVAlcetCAAAAAElFTkSuQmCC",width:75,height:24},opacity:.1,right:10,top:10},this._opt.forceNoOffscreen||("undefined"==typeof OffscreenCanvas?(this._opt.forceNoOffscreen=!0,this._opt.useOffscreen=!1):this._opt.useOffscreen=!0),this._opt.isMpeg4&&(this.debugLog(this.TAG_NAME,"isMpeg4 is true, so set _opt.useWasm true and others params false"),this._opt.useWCS=!1,this._opt.useMSE=!1,this._opt.isNakedFlow=!1,this._opt.useSIMD=!1,this._opt.isFmp4=!1,this._opt.useWasm=!0),this.isPlayback()&&(ua(this._opt.useMSE)&&ua(this._opt.mseDecoderUseWorker)&&this.debugLog(this.TAG_NAME,"isPlayback and mseDecoderUseWorker is true, so set mseDecoderUseWorker false"),this._opt.mseDecoderUseWorker=!1,ua(this._opt.useWCS)&&ua(this._opt.wcsDecodeAudio)&&this.debugLog(this.TAG_NAME,"isPlayback and wcsDecodeAudio is true, so set wcsDecodeAudio false"),this._opt.wcsDecodeAudio=!1),this._opt.poster&&(this._opt.background=this._opt.poster),pa(this._opt.muted)&&(this._opt.isNotMute=!0),this._opt.mseDecoderUseWorker&&(this._opt.mseDecoderUseWorker=!!(wr.Worker&&wr.MediaSource&&"canConstructInDedicatedWorker"in wr.MediaSource&&!0===wr.MediaSource.canConstructInDedicatedWorker),pa(this._opt.mseDecoderUseWorker)&&this.debugLog(this.TAG_NAME,"mseDecoderUseWorker is true but not support so set _opt.mseDecoderUseWorker = false")),(this.isOldHls()||this.isWebrtcH264()||this.isAliyunRtc())&&(this.debugLog(this.TAG_NAME,"isOldHls or isWebrtcH264 or isAliyunRtc is true, so set some params false and set _opt.recordType = webm"),this._opt.useWCS=!1,this._opt.useMSE=!1,this._opt.isNakedFlow=!1,this._opt.useSIMD=!1,this._opt.isFmp4=!1,this._opt.useWasm=!1,this._opt.recordType=E),this._opt.isNakedFlow&&(this.debugLog(this.TAG_NAME,"isNakedFlow is true, so set _opt.mseDecodeAudio false"),this._opt.mseDecodeAudio=!1),uo()&&(this.debugLog(this.TAG_NAME,"isFirefox is true, so set _opt.mseDecodeAudio false"),this._opt.mseDecodeAudio=!1),!this.isOldHls()&&!this.isWebrtcH264()){if(this._opt.useWCS){const e="VideoDecoder"in window,t=wo();this._opt.useWCS=e,this._opt.useWCS&&this._opt.isH265&&(this._opt.useWCS=t),this._opt.useWCS||this.debugWarn(this.TAG_NAME,`\n useWCS is true,\n and supportWCS is ${e}, supportHevcWCS is ${t} , _opt.isH265 is ${this._opt.isH265}\n so set useWCS false`),this._opt.useWCS&&(this._opt.wcsDecodeAudio&&(this._opt.wcsDecodeAudio="AudioDecoder"in window,this._opt.wcsDecodeAudio||this.debugWarn(this.TAG_NAME,"wcsDecodeAudio is true, but not support so set wcsDecodeAudio false")),this._opt.useOffscreen?this._opt.wcsUseVideoRender=!1:this._opt.wcsUseVideoRender&&(this._opt.wcsUseVideoRender=To()&&ko(),this._opt.wcsUseVideoRender||this.debugWarn(this.TAG_NAME,"wcsUseVideoRender is true, but not support so set wcsUseVideoRender false")))}if(this._opt.useMSE){const e=function(){let e=!1;return"MediaSource"in wr&&(e=!0),e}()||function(){let e=!1;return!("MediaSource"in wr)&&"ManagedMediaSource"in wr&&(e=!0),e}(),t=Eo()||function(){let e=!1;return!("MediaSource"in wr)&&"ManagedMediaSource"in wr&&wr.ManagedMediaSource&&(wr.ManagedMediaSource.isTypeSupported(ui)||wr.ManagedMediaSource.isTypeSupported(pi)||wr.ManagedMediaSource.isTypeSupported(fi)||wr.ManagedMediaSource.isTypeSupported(mi)||wr.ManagedMediaSource.isTypeSupported(gi))&&(e=!0),e}();this._opt.useMSE=e,this._opt.useMSE&&this._opt.isH265&&(this._opt.useMSE=t),this._opt.useMSE||this.debugWarn(this.TAG_NAME,`\n useMSE is true,\n and supportMSE is ${e}, supportHevcMSE is ${t} , _opt.isH265 is ${this._opt.isH265}\n so set useMSE false`)}}if(pa(this._opt.useMSE)&&(this._opt.mseDecodeAudio=!1),pa(this._opt.useWCS)&&(this._opt.wcsDecodeAudio=!1),this._opt.useMSE?(this._opt.useWCS&&this.debugWarn(this.TAG_NAME,"useMSE is true and useWCS is true then useWCS set true->false"),this._opt.forceNoOffscreen||this.debugWarn(this.TAG_NAME,"useMSE is true and forceNoOffscreen is false then forceNoOffscreen set false->true"),this._opt.useWCS=!1,this._opt.forceNoOffscreen=!0):this._opt.useWCS,this._opt.isWebrtc&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"isWebrtc is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this._opt.isHls&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"isHls is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this._opt.isAliyunRtc&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"isAliyunRtc is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this.isStreamWebTransport()&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"is stream use webTransport is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this._opt.wcsDecodeAudio&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"is wcsDecodeAudio true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),pa(this._opt.demuxUseWorker)&&(this._opt.mseDecoderUseWorker=!1),this.isPlayback()&&(this._opt.mseDecoderUseWorker=!1),this._opt.useMThreading&&(this._opt.useMThreading="undefined"!=typeof SharedArrayBuffer,this._opt.useMThreading||this.debugWarn(this.TAG_NAME,"useMThreading is true, but not support so set useMThreading false")),this._opt.useSIMD||-1!==this._opt.decoder.indexOf("-simd")){const e=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),t=ma();this._opt.useSIMD=e&&pa(t),this._opt.useSIMD||this.debugWarn(this.TAG_NAME,`useSIMD is true, but not support(isSupportSimd is ${e} ,isIphone is ${t}) so set useSIMD false`)}var s;if(this._opt.useSIMD?-1===this._opt.decoder.indexOf("-simd")?this._opt.useMThreading?this._opt.decoder=this._opt.decoder.replace("decoder-pro.js","decoder-pro-simd-mt.js"):this._opt.decoder=this._opt.decoder.replace("decoder-pro.js","decoder-pro-simd.js"):this._opt.useMThreading&&(this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-simd-mt.js")):-1!==this._opt.decoder.indexOf("-simd")?this._opt.useMThreading?this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-mt.js"):this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro.js"):this._opt.useMThreading&&(this._opt.decoder=this._opt.decoder.replace("decoder-pro.js","decoder-pro-mt.js")),-1!==this._opt.decoder.indexOf("-simd")?this._opt.useMThreading?(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-hard-not-wasm.js")):(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-hard-not-wasm.js")):this._opt.useMThreading?(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-hard-not-wasm.js")):(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro.js","decoder-pro-hard-not-wasm.js")),pa(this._opt.hasAudio)&&(this._opt.operateBtns.audio=!1),pa(this._opt.hasVideo)&&(this._opt.operateBtns.fullscreen=!1,this._opt.operateBtns.screenshot=!1,this._opt.operateBtns.record=!1,this._opt.operateBtns.ptz=!1,this._opt.operateBtns.quality=!1,this._opt.operateBtns.zoom=!1),this._opt.qualityConfig&&0===this._opt.qualityConfig.length&&this._opt.operateBtns.quality&&(this._opt.operateBtns.quality=!1,this.debugWarn(this.TAG_NAME,"_opt.qualityConfig is empty, so set operateBtns.quality false")),ua(this._opt.useWebGPU)&&(this._opt.useWebGPU=function(){let e=!1;return"gpu"in navigator&&(e=!0),e}(),pa(this._opt.useWebGPU)&&this.debugWarn(this.TAG_NAME,"useWebGPU is true, but not support so set useWebGPU false")),this._opt.hasControl=this._hasControl(),this._loading=!1,this._playing=!1,this._playbackPause=!1,this._hasLoaded=!1,this._zooming=!1,this._drawingRect=!1,this._destroyed=!1,this._destroyLock=!1,this._closed=!1,this._checkHeartTimeout=null,this._checkLoadingTimeout=null,this._checkStatsInterval=null,this._checkVisibleHiddenTimeout=null,this._startBpsTime=null,this._isPlayingBeforePageHidden=!1,this._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,currentPts:0,pTs:0,dts:0,mseVideoBufferDelayTime:0,isDropping:!1},this._tempTsList=[],this._allStatsData={},this._faceDetectActive=!1,this._objectDetectActive=!1,this._occlusionDetectActive=!1,this._imageDetectActive=!1,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this._videoTimestamp=0,this._audioTimestamp=0,this._latestAudioTimestamp=0,this._videoIframeIntervalTs=0,this._streamQuality=this._opt.defaultStreamQuality||"",!this._streamQuality&&this._opt.qualityConfig.length>0&&(this._streamQuality=this._opt.qualityConfig[0]||""),this._visibility=!0,this._lastestVisibilityChangeTimestamp=null,this._tempWorkerStats=null,this._historyFpsList=[],this._historyVideoDiffList=[],this._tempStreamList=[],this._tempInnerPlayBgobj=null,this._flvMetaData=null,this._flvMetaDataFps=null,this._serverInfo=null,this._mseWorkerData={},pa(this._opt.useMSE)&&pa(this._opt.useWCS)&&!this.isWebrtcH264()&&!this.isOldHls()&&(this._opt.useWasm=!0),(this.isOldHls()||this.isWebrtcH264())&&(this._opt.hasVideo=!0,this._opt.hasAudio=!0),this._opt.hasVideo||(this._opt.useMSE=!1,this._opt.useWCS=!1),this._opt.useWasm&&(this._opt.useOffscreen?this._opt.wasmUseVideoRender=!1:this._opt.wasmUseVideoRender&&(this._opt.wasmUseVideoRender=yo()&&To()&&ko(),this._opt.wasmUseVideoRender||this.debugWarn(this.TAG_NAME,"use wasm video render, but not support so set wasmUseVideoRender false"),this._opt.wasmUseVideoRender&&this._opt.wasmPlayAudioUseVideoRender&&(this._opt.wasmPlayAudioUseVideoRender="AudioData"in window,this._opt.wasmPlayAudioUseVideoRender||this.debugWarn(this.TAG_NAME,"use wasm video render play audio, but not support so set wasmPlayAudioUseVideoRender false"))),this._opt.useSIMD?this.debugLog(this.TAG_NAME,"use simd wasm"):this.debugLog(this.TAG_NAME,"use wasm")),this._opt.useWasm&&(this._opt.useFaceDetector&&window.JessibucaProFaceDetector||this._opt.useObjectDetector&&window.JessibucaProObjectDetector||this._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector||this._opt.useImageDetector&&window.JessibucaProImageDetector)?(this.ai=new lv(this),this._opt.useFaceDetector&&window.JessibucaProFaceDetector||(this._opt.operateBtns.aiFace=!1),this._opt.useObjectDetector&&window.JessibucaProObjectDetector||(this._opt.operateBtns.aiObject=!1),this._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector||(this._opt.operateBtns.aiOcclusion=!1),this._opt.useImageDetector&&this._opt.aiImageDetectActive&&window.JessibucaProImageDetector&&(this.imageDetectActive=!0)):(this._opt.operateBtns.aiObject=!1,this._opt.operateBtns.aiFace=!1,this._opt.operateBtns.aiOcclusion=!1),this._opt.useFaceDetector&&(this._opt.useWasm&&window.JessibucaProFaceDetector||this.debugWarn(this.TAG_NAME,`use face detector, useWasm is ${this._opt.useWasm} and window.JbProFaceDetector is null`)),this._opt.useObjectDetector&&(this._opt.useWasm&&window.JessibucaProObjectDetector||this.debugWarn(this.TAG_NAME,`use object detector, useWasm is ${this._opt.useWasm} and window.JbProObjectDetector is null`)),this._opt.useOcclusionDetector&&(this._opt.useWasm&&window.JessibucaProOcclusionDetector||this.debugWarn(this.TAG_NAME,`use occlusion detector, useWasm is ${this._opt.useWasm} and window.JessibucaProOcclusionDetector is null`)),this._opt.useImageDetector&&(this._opt.useWasm&&window.JessibucaProImageDetector||this.debugWarn(this.TAG_NAME,`use image detector, useWasm is ${this._opt.useWasm} and window.JessibucaProImageDetector is null`)),this._opt.videoRenderType&&(this.debugLog(this.TAG_NAME,`videoRenderType is ${this._opt.videoRenderType}`),this._opt.videoRenderType===$?(this._opt.useVideoRender=!0,this._opt.useCanvasRender=!1):this._opt.videoRenderType===H&&(this._opt.useVideoRender=!1,this._opt.useCanvasRender=!0)),this._opt.useVideoRender&&(this._opt.useWasm&&!this._opt.useOffscreen?(this._opt.wasmUseVideoRender=yo()&&To()&&ko(),this._opt.wasmUseVideoRender||this.debugWarn(this.TAG_NAME,"use wasm video render, but not support so set wasmUseVideoRender false")):this._opt.useWCS&&!this._opt.useOffscreen&&(this._opt.wcsUseVideoRender=To()&&ko(),this._opt.wcsUseVideoRender||this.debugWarn(this.TAG_NAME,"use wcs video render, but not support so set wcsUseVideoRender false"))),this._opt.useCanvasRender&&(this._opt.useMSE&&pa(this._opt.mseDecoderUseWorker)&&(this._opt.mseUseCanvasRender=!0),this._opt.useWasm&&(this._opt.wasmUseVideoRender=!1),this._opt.useWCS&&(this._opt.wcsUseVideoRender=!1),this.isOldHls()&&!mo()&&(this._opt.hlsUseCanvasRender=!0),this.isWebrtcH264()&&(this._opt.webrtcUseCanvasRender=!0)),this._opt.useVideoRender=!1,this._opt.useCanvasRender=!1,this._opt.useWasm?this._opt.wasmUseVideoRender?this._opt.useVideoRender=!0:this._opt.useCanvasRender=!0:this._opt.useWCS?this._opt.wcsUseVideoRender?this._opt.useVideoRender=!0:this._opt.useCanvasRender=!0:this._opt.useMSE?this._opt.mseUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0:this.isOldHls()?this._opt.hlsUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0:this.isWebrtcH264()&&(this._opt.webrtcUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0),this._opt.useCanvasRender&&this.useVideoPlayAudio()&&(this.debugLog(this.TAG_NAME,"useCanvasRender is true and useVideoPlayAudio() return true, so set wcsDecodeAudio false"),this._opt.wcsDecodeAudio=!1,this._opt.wasmPlayAudioUseVideoRender=!1),s=this,Object.defineProperty(s,"rect",{get:()=>{let e={};return s.$container&&(e=s.$container.getBoundingClientRect(),e.width=Math.max(e.width,s.$container.clientWidth),e.height=Math.max(e.height,s.$container.clientHeight)),e}}),["bottom","height","left","right","top","width"].forEach((e=>{Object.defineProperty(s,e,{get:()=>s.rect[e]||0})})),this.events=new Ea(this),this._opt.hasVideo&&(this.video=new Qa(this),this.recorder=new ll(this)),this.isOldHls()?(this.hlsDecoder=new FA(this),this.loaded=!0):this.isWebrtcH264()?(this._opt.isWebrtcForZLM?this.webrtc=new fv(this):this._opt.isWebrtcForSRS?this.webrtc=new cv(this):this._opt.isWebrtcForOthers?this.webrtc=new uv(this):this.webrtc=new pv(this),this.loaded=!0):this.isAliyunRtc()?(this.aliyunRtcDecoder=new mv(this),this.loaded=!0):(this.isUseHls265()&&(this.hlsDecoder=new ov(this)),this.isWebrtcH265()&&(this.webrtc=new pv(this)),pa(Xo(this._opt))?this.decoderWorker=new fl(this):this.loaded=!0),this._opt.hasAudio&&(this.audio=new yn(this)),this.stream=null,this.demux=null,this._lastVolume=null,this._isMute=null,this._isInZoom=!1,this._playingStartTimestamp=null,this.isMSEVideoDecoderInitializationFailedNotSupportHevc=!1,this.isMSEAudioDecoderError=!1,this.isMSEPlaybackRateChangePause=!1,this.isMSECurrentMoreThanBufferedPause=!1,this.isPlayFailedAndPaused=!1,this._seiList=[],this._opt.useWCS&&(this.webcodecsDecoder=new Vh(this),!this._opt.hasAudio&&pa(this._opt.demuxUseWorker)&&(this.loaded=!0)),this._opt.useMSE&&pa(this._opt.mseDecoderUseWorker)&&(this.mseDecoder=new cc(this),!this._opt.hasAudio&&pa(this._opt.demuxUseWorker)&&(this.loaded=!0)),this.control=new lc(this),this._opt.contextmenuBtns.length>0&&pa(this._opt.disableContextmenu)&&ho()?this.contextmenu=new dv(this):ua(this._opt.disableContextmenu)&&this._opt.contextmenuBtns.length>0&&ho()&&this.debugWarn(this.TAG_NAME,"disableContextmenu is true, but contextmenuBtns is not empty, so Contextmenu can not be created,please check"),this.isPlayback()&&(this.playback=new av(this,this._opt.playbackConfig)),this._opt.operateBtns.zoom&&(this.zoom=new nv(this)),/(iphone|ipad|ipod|ios|android)/i.test(window.navigator.userAgent.toLowerCase())&&pa(this._opt.supportLockScreenPlayAudio&&fo())&&(this.keepScreenOn=new pc(this)),(e=>{try{const t=t=>{Jo(t)===e.$container&&(e.emit(at.fullscreen,e.fullscreen),e.fullscreen?e._opt.useMSE&&e.resize():e.resize())};Cr.on("change",t),e.events.destroys.push((()=>{Cr.off("change",t)}))}catch(e){}if(e.on(ot.decoderWorkerInit,(()=>{e.debugLog("player","listen decoderWorkerInit and set loaded true"),e.loaded=!0})),e.on(ot.play,(()=>{e.loading=!1})),e.on(ot.fullscreen,(t=>{if(t)try{Cr.request(e.$container).then((()=>{})).catch((t=>{e.debugError("player","fullscreen request error",t,t.toString()),e.emitError(lt.fullscreenError,t.toString()),lo()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}))}catch(t){lo()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}else try{Cr.exit().then((()=>{e.webFullscreen&&(e.webFullscreen=!1)})).catch((t=>{e.debugError("player","fullscreen exit error",t,t.toString()),e.emitError(lt.fullscreenError,t.toString()),e.webFullscreen&&(e.webFullscreen=!1)}))}catch(t){e.webFullscreen&&(e.webFullscreen=!1)}})),lo()&&e.on(ot.webFullscreen,(t=>{t?e.$container.classList.add("jb-pro-fullscreen-web"):e.$container.classList.remove("jb-pro-fullscreen-web"),e.emit(at.fullscreen,e.fullscreen)})),e.on(ot.resize,(()=>{e.resize()})),e._opt.debug){const t=[ot.timeUpdate,ot.currentPts,ot.videoSEI,ot.videoSEISyncPts,ot.performance,ot.videoSmooth],i=[ot.stats,ot.playbackStats,ot.playbackTimestamp,ot.flvMetaData,ot.playToRenderTimes,ot.audioInfo,ot.videoInfo];Object.keys(ot).forEach((s=>{e.on(ot[s],(function(r){if(!t.includes(s)){i.includes(s)&&(r=JSON.stringify(r));for(var o=arguments.length,a=new Array(o>1?o-1:0),n=1;n{e.on(lt[t],(function(){for(var i=arguments.length,s=new Array(i),r=0;r{this.updateOption({rotate:e?270:0}),this.resize()}),10)}get webFullscreen(){return this.$container.classList.contains("jb-pro-fullscreen-web")}set loaded(e){this._hasLoaded=e}get loaded(){return this._hasLoaded||this.isOldHls()||this.isWebrtcH264()||this._opt.useMSE&&pa(this._opt.hasAudio)&&pa(this._opt.demuxUseWorker)||this._opt.useWCS&&!this._opt.hasAudio&&pa(this._opt.demuxUseWorker)}set playing(e){this.isClosed()&&e?this.debugLog(this.TAG_NAME,"player is closed, so can not play"):(e&&ua(this.loading)&&(this.loading=!1),this.playing!==e&&(this._playing=e,this.emit(ot.playing,e),this.emit(ot.volumechange,this.volume),e?this.emit(ot.play):this.emit(ot.pause)))}get playing(){return this._playing}get volume(){return this.audio&&this.audio.volume||0}set volume(e){e!==this.volume&&(this.audio?(this.audio.setVolume(e),this._lastVolume=this.volume,this._isMute=0===this.volume):this.debugWarn(this.TAG_NAME,"set volume error, audio is null"))}get lastVolume(){return this._lastVolume}set loading(e){this.loading!==e&&(this._loading=e,this.emit(ot.loading,this._loading))}get loading(){return this._loading}set zooming(e){this.isDestroyedOrClosed()||this.zooming!==e&&(this.zoom||(this.zoom=new nv(this)),this._zooming=e,this.emit(ot.zooming,this.zooming))}get zooming(){return this._zooming}set drawingRect(e){this.isDestroyedOrClosed()||this.drawingRect!==e&&(this.drawRectangle||(this.drawRectangle=new Av(this)),this._drawingRect=e,this.emit(ot.drawingRect,this.drawingRect))}get drawingRect(){return this._drawingRect}set recording(e){e?this.playing&&!this.recording&&(this.recorder&&this.recorder.startRecord(),this.isDemuxInWorker()&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!0})):this.recording&&(this.isDemuxInWorker()&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder&&this.recorder.stopRecordAndSave().then((()=>{})).catch((e=>{})))}get recording(){return!!this.recorder&&this.recorder.isRecording}set audioTimestamp(e){null!==e&&(this._audioTimestamp=e)}get audioTimestamp(){return this._audioTimestamp}set latestAudioTimestamp(e){null!==e&&(this._latestAudioTimestamp=e)}get latestAudioTimestamp(){return this._latestAudioTimestamp}get videoTimestamp(){return this._stats.currentPts||this._stats.ts}set streamQuality(e){this.streamQuality!==e&&(this._streamQuality=e,this.emit(ot.streamQualityChange,e))}get streamQuality(){return this._streamQuality}get isDebug(){return ua(this._opt.debug)}get scaleType(){const e=this._opt,t=e.isResize,i=e.isFullResize;let s=Xt;return pa(i)&&pa(t)?s=Xt:pa(i)&&ua(t)?s=Zt:ua(i)&&ua(t)&&(s=ei),s}set visibility(e){this._visibility!==e&&(this._visibility=e,this.emit(ot.visibilityChange,e),this._lastestVisibilityChangeTimestamp=eo(),e?this.clearVisibilityHiddenTimeout():this.startVisibilityHiddenTimeout())}get visibility(){return this._visibility}set playbackPause(e){this._playbackPause!==e&&(this._playbackPause=e,this.emit(ot.playbackPause,e),this.emit(ot.playbackPauseOrResume,e))}get playbackPause(){return this.isPlayback()&&this._playbackPause}set videoIframeIntervalTs(e){this._videoIframeIntervalTs=e}get videoIframeIntervalTs(){return this._videoIframeIntervalTs}set faceDetectActive(e){this._faceDetectActive!==e&&(this._faceDetectActive=e,this.emit(ot.faceDetectActive,e))}get faceDetectActive(){return this._faceDetectActive}set objectDetectActive(e){this._objectDetectActive!==e&&(this._objectDetectActive=e,this.emit(ot.objectDetectActive,e))}get objectDetectActive(){return this._objectDetectActive}set occlusionDetectActive(e){this._occlusionDetectActive!==e&&(this._occlusionDetectActive=e,this.emit(ot.occlusionDetectActive,e))}get occlusionDetectActive(){return this._occlusionDetectActive}set imageDetectActive(e){this._imageDetectActive!==e&&(this._imageDetectActive=e)}get imageDetectActive(){return this._imageDetectActive}get isUseWorkerDemuxAndDecode(){return this.stream&&this.stream.getStreamType()===y}isDestroyed(){return this._destroyed}isDestroying(){return this._destroyed&&this._destroyLock}isClosed(){return this._closed}isDestroyedOrClosed(){return this.isDestroyed()||this.isClosed()}isLoading(){return this.loading}isPlaying(){let e=!1;return this._opt.playType===b?e=this.playing:this._opt.playType===_&&(e=pa(this.playbackPause)&&this.playing),e}updateOption(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._opt=Object.assign({},this._opt,e),ua(t)&&this.decoderWorker&&Object.keys(e).forEach((t=>{this.decoderWorker.updateWorkConfig({key:t,value:e[t]})}))}init(){return new Promise(((e,t)=>{this.video||this._opt.hasVideo&&(this.video=new Qa(this)),this.audio||this._opt.hasAudio&&(this.audio=new yn(this)),this.stream||(this.stream=new kn(this)),this.isOldHls()?(this.hlsDecoder||(this.hlsDecoder=new FA(this),this.loaded=!0),e()):this.isWebrtcH264()?(this.webrtc||(this._opt.isWebrtcForZLM?this.webrtc=new fv(this):this._opt.isWebrtcForSRS?this.webrtc=new cv(this):this._opt.isWebrtcForOthers?this.webrtc=new uv(this):this.webrtc=new pv(this),this.loaded=!0),e()):this.isAliyunRtc()?(this.aliyunRtcDecoder||(this.aliyunRtcDecoder=new mv(this),this.loaded=!0),e()):(this.demux||this._opt.hasVideo&&!this.isUseWorkerDemuxAndDecode&&(this.demux=new Fh(this)),this._opt.useWCS&&(this.webcodecsDecoder||(this.webcodecsDecoder=new Vh(this))),this._opt.useMSE&&pa(this._opt.mseDecoderUseWorker)&&(this.mseDecoder||(this.mseDecoder=new cc(this))),this.isUseHls265()&&(this.hlsDecoder||(this.hlsDecoder=new ov(this))),this.isWebrtcH265()&&(this.webrtc||(this.webrtc=new pv(this))),this.decoderWorker?this.loaded?e():this.once(ot.decoderWorkerInit,(()=>{this.isDestroyedOrClosed()?(this.debugError(this.TAG_NAME,"init() failed and player is destroyed"),t("init() failed and player is destroyed")):(this.loaded=!0,e())})):pa(Xo(this._opt))?(this.decoderWorker=new fl(this),this.once(ot.decoderWorkerInit,(()=>{this.isDestroyedOrClosed()?(this.debugError(this.TAG_NAME,"init() failed and player is destroyed"),t("init() failed and player is destroyed")):(this.loaded=!0,e())}))):e())}))}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(!e&&!this._opt.url)return s("url is empty");this._closed=!1,this.loading=!0,this.playing=!1,this._times.playInitStart=eo(),e||(e=this._opt.url),this._opt.url=e,this.control&&this._opt.loadingBackground&&this.control.initLoadingBackground(),this.init().then((()=>{this.debugLog(this.TAG_NAME,"play() init and next fetch stream"),this._times.playStart=eo(),this._opt.isNotMute&&this.mute(!1),this.enableWakeLock(),this.checkLoadingTimeout(),this.stream?(this.stream.once(lt.fetchError,(e=>{this.emitError(lt.fetchError,e)})),this.stream.once(lt.websocketError,(e=>{this.emitError(lt.websocketError,e)})),this.stream.once(ot.streamEnd,(e=>{this.emit(ot.streamEnd,e)})),this.stream.once(lt.hlsError,(e=>{this.emitError(lt.hlsError,e)})),this.stream.once(lt.webrtcError,(e=>{this.emitError(lt.webrtcError,e)})),this.stream.once(ot.streamSuccess,(()=>{i(),this._times.streamResponse=eo(),this.video&&this.video.play(),this.checkStatsInterval(),this.isPlayback()&&this.playback&&this.playback.startCheckStatsInterval();{const e=Number("1")||1;setTimeout((()=>{this.destroy(),console.error("Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码)"),alert("Jb pro 体验结束,请刷新页面再次体验,如需要购买商业授权,可以联系微信:bosswancheng"),window.location.reload()}),60*e*60*1e3)}})),this.stream.fetchStream(e,t)):(this.debugWarn(this.TAG_NAME,`play() this.stream is null and is isDestroyedOrClosed is ${this.isDestroyedOrClosed()}`),s("this.stream is null"))})).catch((e=>{s(e)}))}))}playForControl(){return new Promise(((e,t)=>{this.debugLog(this.TAG_NAME,`playForControl() and pauseAndNextPlayUseLastFrameShow is ${this._opt.pauseAndNextPlayUseLastFrameShow}`),this._opt.pauseAndNextPlayUseLastFrameShow&&this._tempInnerPlayBgobj&&this._tempInnerPlayBgobj.loadingBackground&&this.updateOption({loadingBackground:this._tempInnerPlayBgobj.loadingBackground,loadingBackgroundWidth:this._tempInnerPlayBgobj.loadingBackgroundWidth,loadingBackgroundHeight:this._tempInnerPlayBgobj.loadingBackgroundHeight}),this.play().then((t=>{e(t)})).catch((e=>{t(e)}))}))}close(){return new Promise(((e,t)=>{this._close().then((()=>{this.video&&this.video.clearView(),e()})).catch((e=>{t(e)}))}))}resumeAudioAfterPause(){this.lastVolume&&pa(this._isMute)&&(this.volume=this.lastVolume)}async _close(){this._closed=!0,this.video&&(this.video.resetInit(),this.video.pause(!0)),this.loading=!1,this.recording=!1,this.zooming=!1,this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.isPlayback()&&this.playback&&this.playback.clearStatsInterval(),this.releaseWakeLock(),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.decoderWorker&&(await this.decoderWorker.destroy(),this.decoderWorker=null),this.stream&&(await this.stream.destroy(),this.stream=null),this.demux&&(this.demux.destroy(),this.demux=null),this.webcodecsDecoder&&(await this.webcodecsDecoder.destroy(),this.webcodecsDecoder=null),this.mseDecoder&&(this.mseDecoder.destroy(),this.mseDecoder=null),this.hlsDecoder&&(await this.hlsDecoder.destroy(),this.hlsDecoder=null),this.webrtc&&(this.webrtc.destroy(),this.webrtc=null),this.aliyunRtcDecoder&&(this.aliyunRtcDecoder.destroy(),this.aliyunRtcDecoder=null),this.audio&&(await this.audio.destroy(),this.audio=null),this.playing=!1}pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(((t,i)=>{e?this.close().then((()=>{t()})).catch((e=>{i(e)})):this._close().then((()=>{t()})).catch((e=>{i(e)}))}))}pauseForControl(){return new Promise(((e,t)=>{if(this.debugLog(this.TAG_NAME,"_pauseInner()"),this._opt.pauseAndNextPlayUseLastFrameShow&&this.video){const e=this.video.screenshot("","png",.92,"base64");if(e){const t=this.getVideoInfo();t?(this.debugLog(this.TAG_NAME,`pauseForControl() and loadingBackground width is ${t.width} and height is ${t.height}`),this._tempInnerPlayBgobj={loadingBackground:e,loadingBackgroundWidth:t.width,loadingBackgroundHeight:t.height}):this.debugWarn(this.TAG_NAME,"pauseForControl() and videoInfo is null")}else this.debugWarn(this.TAG_NAME,"pauseForControl() and loadingBackground is null")}this.pause().then((t=>{e(t)})).catch((e=>{t(e)}))}))}isAudioMute(){let e=!0;return this.audio&&(e=this.audio.isMute),e}isAudioNotMute(){return!this.isAudioMute()}mute(e){this.audio&&this.audio.mute(e)}resize(){this.video&&this.video.resize()}startRecord(e,t){this.recording||(this.recorder.setFileName(e,t),this.recording=!0)}cancelRecord(){return new Promise(((e,t)=>{this.recorder||t("recorder is null"),this.recording&&(this._opt.useWasm&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder.cancelRecord().then((()=>{e()})).catch((e=>{t(e)})))}))}stopRecordAndSave(e,t){return new Promise(((i,s)=>{this.recorder||s("recorder is null"),this.recording?(this._opt.useWasm&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder.stopRecordAndSave(e,t).then((e=>{i(e)})).catch((e=>{s(e)}))):s("recorder is not recording")}))}_hasControl(){let e=!1,t=!1;return Object.keys(this._opt.operateBtns).forEach((e=>{this._opt.operateBtns[e]&&-1===(""+e).indexOf("Fn")&&(t=!0)})),(this._opt.showBandwidth||t)&&(e=!0),this._opt.extendOperateBtns&&this._opt.extendOperateBtns.length>0&&(e=!0),this.isPlayback()&&this._opt.playbackConfig.showControl&&(e=!0),this._opt.controlHtml&&(e=!0),e}useWasmDecode(){return pa(this._opt.useMSE)&&pa(this._opt.useWCS)}canVideoTrackWritter(){const e=this._opt;return!this.isOldHls()&&!this.isWebrtcH264()&&pa(e.useMSE)&&!this.isAliyunRtc()&&(e.useWCS&&pa(e.useOffscreen)&&e.wcsUseVideoRender||this.useWasmDecode())}checkHeartTimeout$2(){if(pa(this.playbackPause)&&this.playing){if(this.isDestroyedOrClosed())return void this.debugWarn(this.TAG_NAME,"checkHeartTimeout$2 but player is destroyed");if(pa(this.isHistoryFpsListAllZero()))return void this.debugWarn(this.TAG_NAME,"checkHeartTimeout$2 but fps is not all zero");if(0!==this._stats.fps)return void this.debugWarn(this.TAG_NAME,`checkHeartTimeout$2 but fps is ${this._stats.fps}`);const e=this._historyFpsList.join(",");this.debugWarn(this.TAG_NAME,`checkHeartTimeout$2 and\n pause and emit delayTimeout event and\n current vbps is ${this._stats.vbps} and\n current fps is ${this._stats.fps} and\n history FpsList is ${e} and\n current visibility is ${this.visibility} and`),this.emit(ot.timeout,ot.delayTimeout),this.emit(ot.delayTimeout)}else this.debugLog(this.TAG_NAME,`checkHeartTimeout$2 playbackPause is ${this.playbackPause}, playing is ${this.playing}`)}checkStatsInterval(){this._checkStatsInterval=setInterval((()=>{this.updateStats()}),1e3)}checkLoadingTimeout(){this._checkLoadingTimeout=setTimeout((()=>{this.playing?this.debugWarn(this.TAG_NAME,`checkLoadingTimeout but loading is ${this.loading} and playing is ${this.playing}`):this.isDestroyedOrClosed()?this.debugWarn(this.TAG_NAME,"checkLoadingTimeout but player is destroyed"):(this.debugWarn(this.TAG_NAME,"checkLoadingTimeout and pause and emit loadingTimeout event"),this.emit(ot.timeout,ot.loadingTimeout),this.emit(ot.loadingTimeout))}),1e3*this._opt.loadingTimeout)}clearCheckLoadingTimeout(){this._checkLoadingTimeout&&(this.debugLog(this.TAG_NAME,"clearCheckLoadingTimeout"),clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}handleRender(){this.isDestroyedOrClosed()?this.debugWarn(this.TAG_NAME,"handleRender but player is destroyed"):(this.loading&&(this.clearCheckLoadingTimeout(),this.loading=!1,this.emit(ot.start)),this.playing||(this.playing=!0))}updateStats(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.isDestroyedOrClosed())return void this.debugLog(this.TAG_NAME,"updateStats but player is closed or destroyed");if(this._startBpsTime||(this._startBpsTime=eo()),xo(e.ts)){const t=parseInt(e.ts,10);this._stats.ts=t,this._tempTsList.push(t),null===this._playingStartTimestamp&&t>0&&(this._playingStartTimestamp=t)}xo(e.dts)&&(this._stats.dts=parseInt(e.dts,10)),xo(e.mseTs)&&(this._stats.mseTs=e.mseTs),xo(e.buf)&&(this._stats.buf=e.buf),xo(e.netBuf)&&(this._stats.netBuf=e.netBuf),xo(e.currentPts)&&(this._stats.currentPts=e.currentPts),e.fps&&(this._stats.fps+=1),e.dfps&&(this._stats.dfps+=1),e.abps&&(this._stats.abps+=e.abps),e.vbps&&(this._stats.vbps+=e.vbps),e.workerStats&&(this._tempWorkerStats=e.workerStats),e.isDropping&&(this._stats.isDropping=e.isDropping),e.mseVideoBufferDelayTime&&(this._stats.mseVideoBufferDelayTime=parseInt(1e3*e.mseVideoBufferDelayTime,10));const t=eo();if(t-this._startBpsTime<1e3)return;null!==this._playingStartTimestamp&&this._stats.fps>0&&(this._stats.pTs+=1);let i=0,s=0,r=0,o=0,a=0;this._opt.useMSE&&(this.mseDecoder?(i=this.mseDecoder.checkSourceBufferDelay(),i=parseInt(1e3*i,10),s=this.mseDecoder.checkSourceBufferStore(),s=s.toFixed(2),o=this.mseDecoder.getDecodePlaybackRate(),a=this.mseDecoder.getPendingSegmentsLength()):this.isMseDecoderUseWorker()&&(i=this.video.checkSourceBufferDelay(),i=parseInt(1e3*i,10),s=this.video.checkSourceBufferStore(),s=s.toFixed(2),o=this.video.getDecodePlaybackRate())),this._opt.useWCS&&this.webcodecsDecoder&&(r=this.webcodecsDecoder.getDecodeDiffTimes()),this.isOldHls()&&this.hlsDecoder&&(i=this.hlsDecoder.checkHlsBufferedDelay(),i=parseInt(1e3*i,10));let n=0,l=0,d=0;this.isUseHls265()&&this.hlsDecoder&&(i=this.hlsDecoder.checkHlsBufferedDelay(),i=i.toFixed(2),n=this.hlsDecoder.getDemuxBufferedListLength(),d=this.hlsDecoder.getDemuxVideoBufferedListLength(),l=this.hlsDecoder.getDemuxAudioBufferedListLength());let h=0,c=0,u=0,p=!1,f=0,m=0;this._opt.useWasm||this._opt.demuxUseWorker?this._tempWorkerStats&&(c=this._tempWorkerStats.demuxBufferDelay,u=this._tempWorkerStats.audioDemuxBufferDelay,h=this._tempWorkerStats.streamBufferByteLength,this._stats.netBuf=this._tempWorkerStats.netBuf,f=this._tempWorkerStats.pushLatestDelay,p=this._tempWorkerStats.isStreamTsMoreThanLocal,this._stats.buf=this._tempWorkerStats.latestDelay,m=this._tempWorkerStats.wasmDecodeDelay):this.demux&&(h=this.demux.getInputByteLength(),f=this.demux.getPushLatestDelay(),p=this.demux.getIsStreamTsMoreThanLocal(),this.demux.bufferList&&(c=this.demux.bufferList.length));let g=0,y=0;this.audio&&this.audio.bufferList&&(g=this.audio.bufferList.length,y=parseInt(g*this.audio.oneBufferDuration,10));let A=0,b=0;if(this.isPlayback()&&this.video){this._opt.playbackConfig.isUseFpsRender&&(A=this.video.bufferList&&this.video.bufferList.length||0);let e=this.video.getStreamFps();const t=e>0?1e3/e:0;b=parseInt(t*A+t*c,10)}let v=0;this.videoTimestamp>0&&(v=this._stats.dts-this.videoTimestamp);const _=v+this._stats.netBuf;this.isOldHls()&&(this._stats.fps=this.hlsDecoder.getFps()),this._stats.fps>this._stats.maxFps&&(this._stats.maxFps=this._stats.fps);let S=this.getVideoCurrentTime();const E=this._stats.videoCurrentTime;let w=-1;E&&S&&(w=Ao((S-E).toFixed(2)),S=S.toFixed(2));let k=0;this.audioTimestamp>0&&(k=this.audioTimestamp-this.getRenderCurrentPts()),this._allStatsData=Object.assign(this._stats,{audioBuffer:g,audioBufferDelayTs:y,audioTs:this.audioTimestamp,latestAudioTs:this.latestAudioTimestamp,playbackVideoBuffer:A,playbackVideoWaitingBuffer:0,playbackAudioWaitingBuffer:0,playbackCacheDataDuration:b,demuxBuffer:c,pushLatestDelay:f,audioDemuxBuffer:u,streamBuffer:h,mseDelay:i,mseStore:s,mseDecodeDiffTimes:r,mseDecodePlaybackRate:o,msePendingBuffer:a,wcsDecodeDiffTimes:r,wasmDecodeDelay:m,hlsDelay:i,hlsDemuxLength:n,hlsDemuxAudioLength:l,hlsDemuxVideoLength:d,delayTs:v,totalDelayTs:_,isStreamTsMoreThanLocal:p,videoCurrentTime:S,videoCurrentTimeDiff:w,audioSyncVideo:k});let L=null,C=null,D="";if(this.isPlayer()&&this._opt.hasVideo&&this.playing){L=function(e,t){let i=3;const s=t||25;return e<=s*(1/4)?i=0:e<=.5*s?i=1:e<=s*(3/4)&&(i=2),i}(this._stats.fps,this._flvMetaDataFps),this._allStatsData.performance=L;const e=this.checkVideoSmooth(this._allStatsData);D=e.reason,C=e.result,this._allStatsData.videoSmooth=C}this.emit(ot.stats,this._allStatsData),this._allStatsData.streamBuffer>this._opt.flvDemuxBufferSizeMaxLarge&&this.getDemuxType()===T&&this.emit(lt.flvDemuxBufferSizeTooLarge,this._allStatsData.streamBuffer),this._opt.hasVideo?(this.updateHistoryFpsList(this._stats.fps,this._allStatsData.videoCurrentTimeDiff),xo(L)&&this.emit(ot.performance,L),xo(C)&&this.emit(ot.videoSmooth,C,D)):this._opt.hasAudio&&this.updateHistoryFpsList(this._stats.abps,0),this.isPlaybackUseMSE()&&this.isPlaying()&&0===this._allStatsData.videoCurrentTimeDiff&&(this.debugWarn(this.TAG_NAME,`updateStats and videoCurrentTimeDiff is 0 and\n videoCurrentTime is ${this._allStatsData.videoCurrentTime}\n and next update video currentTime`),this.mseDecoder.updateVideoCurrentTimeByBufferStart()),this._stats.fps=0,this._stats.dfps=0,this._stats.abps=0,this._stats.vbps=0,this._tempTsList=[],this._stats.isDropping=!1,this._startBpsTime=t}resetStats(){this._startBpsTime=null,this._playingStartTimestamp=null,this._historyFpsList=[],this._historyVideoDiffList=[],this._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,currentPts:0,pTs:0,dts:0,mseVideoBufferDelayTime:0,isDropping:!1},this._allStatsData={},this._tempTsList=[]}checkVideoSmooth(e){let t=!0,i="";if(this._opt.videoBuffer,this._opt.videoBufferDelay,this.isWebrtcH264()||this.isOldHls())return{result:t,reason:i};if(0===e.vbps&&pa(this._opt.isHls)&&(i="vbpsIsZero",this.debugLog(this.TAG_NAME,`checkVideoSmooth false because ${i}`),t=!1),t&&e.isDropping&&(i="isDroppingIsTrue",this.debugLog(this.TAG_NAME,`checkVideoSmooth false because ${i}`),t=!1),t&&this.visibility&&this._historyFpsList.length>=this._opt.heartTimeout){const s=function(e){const t=Math.max(...e),i=Math.min(...e);return e.filter((e=>e!==t&&e!==i))}(this._historyFpsList),r=s.reduce(((e,t)=>e+t),0)/s.length,o=.83*r;e.fps=1.5||e.videoCurrentTimeDiff<=.5)&&-1!==e.videoCurrentTimeDiff){if(i="videoCurrentTimeDiffIsNotNormal",this.debugLog(this.TAG_NAME,`checkVideoSmooth false because videoCurrentTimeDiff is ${e.videoCurrentTimeDiff}`),0===Number(e.videoCurrentTimeDiff)){const e=this.isVideoPlaying(),t=this.getVideoCurrentTime(),i=this.getVideoBufferTimeRange();let s=-1,r=-1;i&&(s=i.start,r=i.end),this.debugLog(this.TAG_NAME,`checkVideoSmooth and videoCurrentTimeDiff is 0 so check\n videoCurrentTime is ${t} and isPlaying is ${e}\n bufferStartTime is ${s} and bufferEndTime is ${r}`)}t=!1}return{result:t,reason:i}}enableWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.enable()}releaseWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.disable()}clearBufferDelay(){this._opt.useWasm?this.decoderWorker&&this.decoderWorker.clearWorkBuffer(!0):this.demux&&this.demux.clearBuffer(!0)}doDestroy(){this.emit(ot.beforeDestroy)}handlePlayToRenderTimes(){if(this.isDestroyedOrClosed())return void this.debugLog(this.TAG_NAME,"handlePlayToRenderTimes but player is closed or destroyed");const e=this.getPlayToRenderTimes();this.emit(ot.playToRenderTimes,e)}getPlayToRenderTimes(){const e=this._times;return e.playTimestamp=e.playStart-e.playInitStart,e.streamTimestamp=e.streamStart-e.playStart,e.streamResponseTimestamp=e.streamResponse-e.streamStart>0?e.streamResponse-e.streamStart:0,e.demuxTimestamp=e.demuxStart-e.streamResponse>0?e.demuxStart-e.streamResponse:0,e.decodeTimestamp=e.decodeStart-e.demuxStart>0?e.decodeStart-e.demuxStart:0,e.videoTimestamp=e.videoStart-e.decodeStart,e.allTimestamp=e.videoStart-e.playInitStart,e}getOption(){return this._opt}getPlayType(){return this._opt.playType}isPlayer(){return this._opt.playType===b}isPlayback(){return this._opt.playType===_}isDemuxSetCodecInit(){let e=!0,t=this._opt;return t.useWCS&&!t.useOffscreen?e=!!this.webcodecsDecoder&&this.webcodecsDecoder.hasInit:t.useMSE&&(e=!!this.mseDecoder&&this.mseDecoder.hasInit),e}isDemuxDecodeFirstIIframeInit(){let e=!0,t=this._opt;return t.useWCS&&!t.useOffscreen?e=!!this.webcodecsDecoder&&this.webcodecsDecoder.isDecodeFirstIIframe:t.useMSE&&(e=!!this.mseDecoder&&this.mseDecoder.isDecodeFirstIIframe),e}isAudioPlaybackRateSpeed(){let e=!1;return this.audio&&(e=this.audio.isPlaybackRateSpeed()),e}getPlayingTimestamp(){return this._stats.pTs}getRecordingType(){let e=null;return this.recorder&&(e=this.recorder.getType()),e}getRecordingByteLength(){let e=0;return this.recording&&(e=this.recorder.getToTalByteLength()),e}getRecordingDuration(){let e=0;return this.recording&&(e=this.recorder.getTotalDuration()),e}getDecodeType(){let e="";const t=this.getOption();return this.isWebrtcH264()?z:this.isAliyunRtc()?V:this.isOldHls()?W:(t.useMSE&&(e+=F+" ",t.mseDecoderUseWorker&&(e+="worker")),t.useWCS&&(e+=U+" "),t.useWasm&&(e+=N+" ",t.useSIMD&&(e+=j+" "),t.useMThreading&&(e+=G+" ")),t.useOffscreen&&(e+=O+" "),e)}getDemuxType(){return this._opt.demuxType}getRenderType(){let e="";return this.video&&(e=this.video.getType()),e}getCanvasRenderType(){let e="";return this.video&&(e=this.video.getCanvasType()),e}getAudioEngineType(){let e="";return this.audio&&(e=this.audio.getEngineType()),e}getStreamType(){let e="";return this.stream&&(e=this.stream.getStreamType()),e}isStreamTypeNotWorker(){return-1===this.getStreamType().indexOf(y)}getAllStatsData(){return this._allStatsData}isFlvDemux(){return this._opt.demuxType===T}isM7SDemux(){return this._opt.demuxType===k}isNakedFlowDemux(){return this._opt.demuxType===x}isMpeg4Demux(){return this._opt.demuxType===P}isTsDemux(){return this._opt.demuxType===I}isFmp4Demux(){return this._opt.demuxType===R}togglePerformancePanel(e){this.updateOption({showPerformance:e}),this.emit(ot.togglePerformancePanel,e)}setScaleMode(e){let t={isFullResize:!1,isResize:!1,aspectRatio:"default"};switch(e=Number(e)){case Xt:t.isFullResize=!1,t.isResize=!1;break;case Zt:t.isFullResize=!1,t.isResize=!0;break;case ei:t.isFullResize=!0,t.isResize=!0}this.updateOption(t),this.resize(),this.emit(ot.viewResizeChange,e)}startVisibilityHiddenTimeout(){this.clearVisibilityHiddenTimeout(),this._opt.pageVisibilityHiddenTimeout>0&&(this.visibilityHiddenTimeout=setTimeout((()=>{this.emit(ot.visibilityHiddenTimeout)}),1e3*this._opt.pageVisibilityHiddenTimeout))}clearVisibilityHiddenTimeout(){this._checkVisibleHiddenTimeout&&(clearTimeout(this._checkVisibleHiddenTimeout),this._checkVisibleHiddenTimeout=null)}faceDetect(e){this.faceDetectActive=e,pa(e)&&this.video&&this.video.addAiContentToCanvas([])}objectDetect(e){this.objectDetectActive=e,pa(e)&&this.video&&this.video.addAiContentToCanvas([])}occlusionDetect(e){this.occlusionDetectActive=e}downloadNakedFlowFile(){this.demux&&this.demux.downloadNakedFlowFile&&this.demux.downloadNakedFlowFile()}downloadFmp4File(){this.demux&&this.demux.downloadFmp4File&&this.demux.downloadFmp4File()}downloadMpeg4File(){const e=new Blob([this._tempStreamList]);try{const t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".mpeg4",t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadMpeg4File",e)}}hasCacheOnGopBuffer(){const e=this.videoIframeIntervalTs,t=this._allStatsData.demuxBuffer,i=this._allStatsData.maxFps;let s=!1;if(e&&t&&i){s=1e3/i*t>e}return s}addContentToCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.video&&this.video.addContentToCanvas(e)}addContentToContainer(){}sendWebsocketMessage(e){const t=this.getStreamType();t===f||t===y+" "+f?this.stream.sendMessage(e):this.debugWarn(this.TAG_NAME,`sendWebsocketMessage: stream type is not websocket, current stream type is ${this.getStreamType()}`)}checkIsInRender(){const e=this._stats;return e.vbps>0&&e.fps>0}setControlHtml(e){this.control&&this.control.$controlHtml&&(this.control.$controlHtml.innerHTML=e)}clearControlHtml(){this.control&&this.control.$controlHtml&&(this.control.$controlHtml.innerHTML="")}toggleControlHtml(e){this.control&&this.control.toggleControlHtml(e)}getControlHtmlIsShow(){return!!this.control&&this.control.getControlHtmlIsShow()}getControlHtml(){return this.control?this.control.getControlHtml():null}setExtendHtml(e){this.control&&(this.control.$extendDom?this.control.updateExtendDom(e):this.control.addExtendDom({html:e,showBeforePlay:!0}))}clearExtendHtml(){this.control&&this.control.removeExtendDom()}toggleExtendHtml(e){this.control&&this.control.toggleExtendDom(e)}getExtendHtmlIsShow(){return!!this.control&&this.control.getExtendDomIsShow()}getExtendHtml(){return this.control?this.control.getExtendDom():null}updateWatermark(e){this.singleWatermark||(this.singleWatermark=new Ua(this)),this.singleWatermark&&this.singleWatermark.update(e)}removeWatermark(){this.singleWatermark&&this.singleWatermark.remove()}getVideoInfo(){let e=null;return this.video&&(e=this.video.getVideoInfo()),e}getAudioInfo(){let e=null;return this.audio&&(e=this.audio.getAudioInfo()),e}getVideoPlaybackQuality(){let e=null;return this.video&&(e=this.video.getPlaybackQuality()),e}emitError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.emit(ot.error,e,t),this.emit(e,t)}updateHistoryFpsList(e,t){this.playbackPause||pa(this.visibility)||(this._historyFpsList.length>this._opt.heartTimeout&&(this._historyFpsList.shift(),this._historyVideoDiffList.shift()),this._historyFpsList.push(e),this._historyVideoDiffList.push(t),this.isHistoryFpsListAllZero()&&this.checkHeartTimeout$2())}isHistoryFpsListAllZero(){let e=!0;if(this._historyFpsList.length0){e=!1;break}if(e)for(let t=0;t0){e=!1;break}return e}isUseHls265(){return ua(this._opt.isHls)&&ua(this._opt.supportHls265)}isHls(){return ua(this._opt.isHls)}isOldHls(){return ua(this._opt.isHls)&&pa(this._opt.supportHls265)}isWebrtcNotH265(){return ua(this._opt.isWebrtc)&&pa(this._opt.isWebrtcH265)}isWebrtcH264(){return ua(this._opt.isWebrtc)&&pa(this._opt.isWebrtcH265)}isWebrtcH265(){return ua(this._opt.isWebrtc)&&ua(this._opt.isWebrtcH265)}isAliyunRtc(){return ua(this._opt.isAliyunRtc)}isUseHls265UseMse(){return this.isUseHls265()&&this.isUseMSE()}isStreamWebTransport(){return this.getStreamType()===g}isPlaybackCacheBeforeDecodeForFpsRender(){return this.isPlayback()&&ua(this._opt.playbackConfig.isCacheBeforeDecodeForFpsRender)&&ua(this._opt.useWCS)}isPlaybackPauseNotClearCacheAndCacheBeforeDecodeAndUseFpsRender(){return this.isPlayback()&&pa(this._opt.playbackConfig.isPlaybackPauseClearCache)&&ua(this._opt.playbackConfig.isCacheBeforeDecodeForFpsRender)}isPlaybackUseWCS(){return this.isPlayback()&&ua(this._opt.useWCS)}isPlaybackUseMSE(){return this.isPlayback()&&ua(this._opt.useMSE)}isPlaybackUseWASM(){return this.isPlayback()&&ua(this._opt.useWasm)}isPlayUseMSE(){return this.isPlayer()&&ua(this._opt.useMSE)}isMSEDecodeAudio(){return this._opt.useMSE&&this._opt.mseDecodeAudio}isWCSDecodeAudio(){this._opt.useWCS&&this._opt.wcsDecodeAudio}isInWebFullscreen(){return this._opt.useWebFullScreen&&lo()&&this.fullscreen}getPlaybackRate(){let e=1;return ua(this.isPlayback())&&this.playback&&(e=this.playback.rate),e}isPlaybackOnlyDecodeIFrame(){return ua(this.isPlayback())&&this.getPlaybackRate()>=this._opt.playbackForwardMaxRateDecodeIFrame&&!this.isMSEDecodeAudio()}pushTempStream(e){const t=new Uint8Array(e);this._tempStreamList.push(t)}updateLoadingText(e){this.loading&&this.control&&this.control.updateLoadingText(e)}getVideoCurrentTime(){let e=0;return this.video&&(this._opt.useMSE?this.mseDecoder?e=this.mseDecoder.getVideoCurrentTime():this.isMseDecoderUseWorker()&&(e=this.video.getVideoCurrentTime()):this.isWebrtcH264()&&this.webrtc?e=this.webrtc.getVideoCurrentTime():this.isAliyunRtc()&&this.aliyunRtcDecoder&&(e=this.aliyunRtcDecoder.getVideoCurrentTime())),e}getVideoBufferTimeRange(){let e=null;return this.video&&(this._opt.useMSE?this.mseDecoder?e=this.mseDecoder.getVideoBufferTimeRange():this.isMseDecoderUseWorker()&&(e=this.video.getVideoBufferTimeRange()):this.isWebrtcH264()&&this.webrtc?e=this.webrtc.getVideoBufferTimeRange():this.isAliyunRtc()&&this.aliyunRtcDecoder&&(e=this.aliyunRtcDecoder.getVideoBufferTimeRange())),e}isVideoPlaying(){let e=!0;return this.video&&(this._opt.useMSE?this.mseDecoder?e=this.mseDecoder.isVideoPlaying():this.isMseDecoderUseWorker()&&(e=this.video.isVideoPlaying()):this.isWebrtcH264()&&this.webrtc?e=this.webrtc.isVideoPlaying():this.isAliyunRtc()&&this.aliyunRtcDecoder&&(e=this.aliyunRtcDecoder.isVideoPlaying())),e}addMemoryLog(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s0){const e=t/1e3;this._flvMetaDataFps=e}}Do(e.hasAudio)&&pa(e.hasAudio)&&(this.debugLog("updateMetaData","hasAudio",e.hasAudio,"and update _opt.hasAudio"),this._opt.hasAudio=e.hasAudio),Do(e.hasVideo)&&pa(e.hasVideo)&&(this.debugLog("updateMetaData","hasVideo",e.hasVideo,"and update _opt.hasVideo"),this._opt.hasVideo=e.hasVideo),e.server&&(this._serverInfo=(e.server+"").substring(0,10)),e.MetaDataCreator&&(this._serverInfo=e.MetaDataCreator)}this.emit(ot.flvMetaData,e)}getMetaData(){return this._flvMetaData}getExtendBtnList(){return this.control.getExtendBtnList().map((e=>({name:e.name,$container:e.$iconContainer,$btn:e.$iconWrap,$activeBtn:e.$activeIconWrap})))}getCpuLevel(){let e=null;return this.pressureObserverCpu&&(e=this.pressureObserverCpu.getCurrentCpuState()),e}isRecordTypeFlv(){return this.recorder&&this._opt.recordType===w}isRecordTypeMp4(){return this.recorder&&this._opt.recordType===S}isRecordTypeWebm(){return this.recorder&&this._opt.recordType===E}isDemuxInWorker(){return this._opt.useWasm||this._opt.demuxUseWorker}isUseMSE(){return ua(this._opt.useMSE)}isUseWCS(){return ua(this._opt.useWCS)}isUseWASM(){return ua(this._opt.useWasm)}isMseDecoderUseWorker(){return this.isUseMSE()&&ua(this._opt.mseDecoderUseWorker)}getAudioSyncVideoDiff(){return this.audioTimestamp-this.getRenderCurrentPts()}getCurrentVideoAndAudio(){return{video:this.getRenderCurrentPts(),audio:this.audioTimestamp}}getMseVideoBufferDelayTime(){let e=0;return this._opt.useMSE&&this.mseDecoder&&(this.mseDecoder?e=this.mseDecoder.getVideoBufferDelayTime():this.isMseDecoderUseWorker()&&(e=this.video.getVideoBufferDelayTime()),e=parseInt(1e3*e,10)),e}updateCurrentPts(e){this.updateStats({currentPts:e}),this.emit(ot.currentPts,e),this.emitVideSeiSyncPts(e)}emitVideoSei(e){this.emit(ot.videoSEI,e),this._seiList.push(e)}emitVideSeiSyncPts(e){if(0===this._seiList.length||pa(this._opt.isEmitSEI))return;const t=1e3*this._opt.videoSEISyncPtsDiff,i=e-t,s=e+t,r=[];this._seiList.forEach((t=>{t.ts>=i&&t.ts<=s&&(t.pts=e,r.push(t))})),r.forEach((e=>{this.emit(ot.videoSEISyncPts,e)})),this._seiList=this._seiList.filter((e=>e.ts>s))}getRenderCurrentPts(){let e=0;return e=this._stats.currentPts?this._stats.currentPts:this.videoTimestamp-this.getMseVideoBufferDelayTime(),e}openSyncAudioAndVideo(){return this._opt.syncAudioAndVideo&&this._opt.hasVideo}showTipsMessageByCode(e){if(this.control){const t=this._opt.showMessageConfig[e]||"未知异常";this.control.showTipsMessage(t,e)}}showTipsMessageByContent(e){this.control&&e&&this.control.showTipsMessage(e)}hideTipsMessage(){this.control&&this.control.hideTipsMessage()}decoderCheckFirstIFrame(){ua(this._opt.checkFirstIFrame)&&(this.mseDecoder?this.mseDecoder.isDecodeFirstIIframe=!1:this.webcodecsDecoder&&(this.webcodecsDecoder.isDecodeFirstIIframe=!1))}isHlsCanVideoPlay(){return this._canPlayAppleMpegurl&&this.isOldHls()}setPtzPosition(e){this.control&&this.control.updatePtzPosition(e)}setRotate(e){this.updateOption({rotate:e}),this.resize()}setPlayFailedAndPaused(){this.isPlayFailedAndPaused=!0}getMseMineType(){let e={};return this.mseDecoder&&(e=this.mseDecoder.getMimeType()),e}getMaxDelayTs(){return this._opt.videoBuffer+this._opt.videoBufferDelay}isMseVideoStateInited(){return!this.video||this.video.getReadyStateInited()}showPlayBtn(){this.control&&this.control.showPlayBtn()}toggleControlExtendBtn(e,t){this.control&&this.control.toggleExtendBtn(e,t)}getControlExtendBtnActive(e){let t=!1;return this.control&&(t=this.control.getExtendBtnActive(e)),t}useVideoPlayAudio(){return this._opt.hasAudio&&(this._opt.useWCS&&this._opt.wcsDecodeAudio||this._opt.useWasm&&this._opt.wasmPlayAudioUseVideoRender)}isControlBarShow(){const e=this._opt.hasControl,t=this._opt.controlAutoHide;let i=e&&!t;return i&&this.control&&(i=this.control.getBarIsShow()),i}getControlBarShow(){let e=!1;return this.control&&(e=this.control.getBarIsShow()),e}toggleControlBar(e){this.control&&(this.control.toggleBar(e),this.resize())}debugLog(e){if(this._opt.debug&&this.debug){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s1?t-1:0),s=1;s1?t-1:0),s=1;s1&&0===e[e.length-1]&&0===e[e.length-2]}}class vv{constructor(e){this.player=e,this.globalSetting=null;const t=bo();this.defaultSettings={watermark_id:`JbPro_${t}`,watermark_prefix:`JbPro_mask_${t}`,watermark_txt:"JbPro 测试水印",watermark_x:0,watermark_y:0,watermark_rows:0,watermark_cols:0,watermark_x_space:0,watermark_y_space:0,watermark_font:"微软雅黑",watermark_color:"black",watermark_fontsize:"18px",watermark_alpha:.15,watermark_width:150,watermark_height:100,watermark_angle:15,watermark_parent_width:0,watermark_parent_height:0,watermark_parent_node:null},this.load({text:decodeURIComponent("JessibucaPro%20%E4%BD%93%E9%AA%8C"),color:"white"}),this.player.debugLog("Watermark","int")}destroy(){this._removeMark(),this.globalSetting=null,this.defaultSettings=null,this.player.debugLog("Watermark","destroy")}remove(){}load(e){this.globalSetting=e,this._loadMark(e)}resize(){this.player.debugLog("Watermark","resize()"),this.globalSetting&&this._loadMark(this.globalSetting)}_loadMark(){let e=this.defaultSettings;if(1===arguments.length&&"object"==typeof arguments[0]){var t=arguments[0]||{};for(let i in t)t[i]&&e[i]&&t[i]===e[i]||(t[i]||0===t[i])&&(e[i]=t[i])}var i=document.getElementById(e.watermark_id);i&&i.parentNode&&i.parentNode.removeChild(i);var s="string"==typeof e.watermark_parent_node?document.getElementById(e.watermark_parent_node):e.watermark_parent_node,r=s||document.body;const o=r.getBoundingClientRect();var a=Math.max(r.scrollWidth,r.clientWidth,o.width),n=Math.max(r.scrollHeight,r.clientHeight,o.height),l=arguments[0]||{},d=r;(l.watermark_parent_width||l.watermark_parent_height)&&d&&(e.watermark_x=e.watermark_x+0,e.watermark_y=e.watermark_y+0);var h=document.getElementById(e.watermark_id),c=null;if(h)h.shadowRoot&&(c=h.shadowRoot);else{(h=document.createElement("div")).id=e.watermark_id,h.setAttribute("style","pointer-events: none !important; display: block !important"),c="function"==typeof h.attachShadow?h.attachShadow({mode:"open"}):h;var u=r.children,p=Math.floor(Math.random()*(u.length-1))+1;u[p]?r.insertBefore(h,u[p]):r.appendChild(h)}e.watermark_cols=parseInt((a-e.watermark_x)/(e.watermark_width+e.watermark_x_space));var f,m=parseInt((a-e.watermark_x-e.watermark_width*e.watermark_cols)/e.watermark_cols);e.watermark_x_space=m?e.watermark_x_space:m,e.watermark_rows=parseInt((n-e.watermark_y)/(e.watermark_height+e.watermark_y_space));var g,y,A,b=parseInt((n-e.watermark_y-e.watermark_height*e.watermark_rows)/e.watermark_rows);e.watermark_y_space=b?e.watermark_y_space:b,s?(f=e.watermark_x+e.watermark_width*e.watermark_cols+e.watermark_x_space*(e.watermark_cols-1),g=e.watermark_y+e.watermark_height*e.watermark_rows+e.watermark_y_space*(e.watermark_rows-1)):(f=0+e.watermark_x+e.watermark_width*e.watermark_cols+e.watermark_x_space*(e.watermark_cols-1),g=0+e.watermark_y+e.watermark_height*e.watermark_rows+e.watermark_y_space*(e.watermark_rows-1));for(var v=0;v\n \n \n ${m.watermark_txt}\n \n \n ${m.watermark_txt}\n \n \n \n \n `,_=window.btoa(unescape(encodeURIComponent(v)));var S=document.createElement("div");S.style.position="absolute",S.style.left="0px",S.style.top="0px",S.style.overflow="hidden",S.style.zIndex="9999999",S.style.width=a+"px",S.style.height=n+"px",S.style.display="block",S.style["-ms-user-select"]="none",S.style.backgroundImage=`url(data:image/svg+xml;base64,${_})`,c.appendChild(S)}_removeMark(){const e=this.defaultSettings;var t=document.getElementById(e.watermark_id);if(t){var i=t.parentNode;i&&i.removeChild(t)}}_calcTextSize(){const{watermark_txt:e,watermark_font:t,watermark_fontsize:i}=this.globalSetting,s=document.createElement("span");s.innerHTML=e,s.setAttribute("style",`font-family: ${t}; font-size: ${i}px; visibility: hidden; display: inline-block`),document.querySelector("body").appendChild(s);const r={width:s.offsetWidth,height:s.offsetHeight};return s.remove(),r}}const Sv="right",Ev="left",wv="up",Tv="down",kv="leftUp",Lv="leftDown",Cv="rightUp",Dv="rightDown",xv="zoomExpand",Rv="zoomNarrow",Pv="apertureFar",Bv="apertureNear",Iv="focusFar",Mv="focusNear",Fv="setPos",Uv="calPos",Ov="delPos",Nv="wiperOpen",jv="wiperClose",Gv="cruiseStart",zv={stop:0,fiStop:0,right:1,left:2,up:8,down:4,leftUp:10,leftDown:6,rightUp:9,rightDown:5,zoomExpand:16,zoomNarrow:32,apertureFar:72,apertureNear:68,focusFar:66,focusNear:65,setPos:129,calPos:130,delPos:131,wiperOpen:140,wiperClose:141,setCruise:132,decCruise:133,cruiseStart:136,cruiseStop:0},Wv=[25,50,75,100,125,150,175,200,225,250],Vv=[1,2,3,4,5,6,7,8,9,16],Hv=[16,48,80,112,144,160,176,192,208,224];function $v(e){const{type:t,speed:i=5,index:s=0}=e,r=function(e){return Wv[(e=e||5)-1]||Wv[4]}(i);let o,a,n,l;if(o=zv[t],!o)return"";switch(t){case wv:case Tv:case Pv:case Bv:n=r;break;case Sv:case Ev:case Iv:case Mv:a=r;break;case kv:case Lv:case Cv:case Dv:a=r,n=r;break;case xv:case Rv:l=function(e){return Hv[(e=e||5)-1]||Hv[4]}(i);break;case Uv:case Ov:case Fv:n=Jv(s);break;case jv:case Nv:a=1;break;case Gv:a=Jv(s)}return function(e,t,i,s){let r=[];r[0]=165,r[1]=15,r[2]=1,r[3]=0,r[4]=0,r[5]=0,r[6]=0,e&&(r[3]=e);t&&(r[4]=t);i&&(r[5]=i);s&&(r[6]=s);return r[7]=(r[0]+r[1]+r[2]+r[3]+r[4]+r[5]+r[6])%256,function(e){let t="";for(let i=0;it)){for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i===t?s[r]=Kv(e[r]):"object"==typeof e[r]?s[r]=Yv(e[r],t,i+1):s[r]=e[r]);return s}}function Qv(){return(new Date).toLocaleString()}class Xv{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player=e,this.TAG_NAME="MemoryLogger",this.logMaxSize=(null==t?void 0:t.logMaxSize)||204800,this.logSize=0,this.logTextArray=[],this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.clear(),this.player.debugLog(this.TAG_NAME,"destroy")}clear(){this.logSize=0,this.logTextArray=[]}logCache(){let e="";try{for(var t=arguments.length,i=new Array(t),s=0;sYv(e)));e="[JbPro] "+Qv()+JSON.stringify(r)}catch(e){return}if(this.logSize+=e.length,this.logTextArray.push(e),this.logSize>this.logMaxSize){const e=this.logTextArray.shift();this.logSize-=e.length}}getLog(){return this.logTextArray.join("\n")}getLogBlob(){const e=this.getLog();return new Blob([e],{type:"text/plain"})}download(){const e=this.getLog();this.clear();const t=new Blob([e],{type:"text/plain"});Va(t,"JbPro-"+Qv()+".log")}}class Zv extends wa{constructor(e){super(),this.player=e,this.TAG_NAME="Network",this.online=this.isOnline(),this.prevOnline=this.online,this.interval=null,this._initListener(),this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.off(),this._stopCheck(),window.removeEventListener("online",this._updateOnlineStatus),window.removeEventListener("offline",this._updateOfflineStatus),this.player.debugLog(this.TAG_NAME,"destroy")}_initListener(){window.addEventListener("online",this._updateOnlineStatus.bind(this)),window.addEventListener("offline",this._updateOfflineStatus.bind(this))}_stopCheck(){this.interval&&(clearInterval(this.interval),this.interval=null)}_startCheck(){this.interval=setInterval((()=>{this.isOnline()!==this.prevOnline&&(this.isOnline()?this._updateOnlineStatus():this._updateOfflineStatus())}),1e3)}_updateOnlineStatus(){this.prevOnline=this.online,this.online=!0,this.logStatus(),this.emit("online")}_updateOfflineStatus(){this.prevOnline=this.online,this.online=!1,this.logStatus(),this.emit("offline")}logStatus(){const e=this.prevOnline?"online":"offline",t=this.online?"online":"offline";this.player.debugLog(this.TAG_NAME,`prevOnline: ${this.prevOnline}, online: ${this.online}, status: ${e} -> ${t}`)}isOnline(){return void 0===navigator.onLine||navigator.onLine}isOffline(){return!this.isOnline()}}class e_ extends wa{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this._opt={},this.TAG_NAME="JbPro",this.$container=null,Object.keys(e).forEach((t=>{if(void 0===e[t])throw new Error(`JbPro option "${t}" can not be undefined`)})),this.originalOptions=e;const t=da();let i=Object.assign({},t,e);i.url="",i.isMulti&&(i.debugUuid=na()),this.debug=new Tr(this);let s=e.container;if("string"==typeof e.container&&(s=document.querySelector(e.container)),!s)throw this.debugError("JbPro","JbPro need container option and now container is",e.container),new Error("JbPro need container option");if(pa(i.isLive)){const e=document.createElement("video");return e.muted=!0,e.setAttribute("controlsList","nodownload"),e.disablePictureInPicture="disablePictureInPicture",e.style.position="absolute",e.style.top=0,e.style.left=0,e.style.height="100%",e.style.width="100%",s.appendChild(e),this.$videoElement=e,this.$container=s,void(this._opt=i)}if(i.decoder&&pa(-1!==i.decoder.indexOf("decoder-pro.js")||-1!==i.decoder.indexOf("decoder-pro-simd.js")))throw this.debugError("JbPro",`JbPro decoder ${i.decoder} must be decoder-pro.js or decoder-pro-simd.js`),new Error(`JbPro decoder ${i.decoder} must be decoder-pro.js or decoder-pro-simd.js`);if("CANVAS"===s.nodeName||"VIDEO"===s.nodeName)throw this.debugError("JbPro",`JbPro container type can not be ${s.nodeName} type`),new Error(`JbPro container type can not be ${s.nodeName} type`);if(i.videoBuffer>=i.heartTimeout)throw this.debugError("JbPro",`JbPro videoBuffer ${i.videoBuffer}s must be less than heartTimeout ${i.heartTimeout}s`),new Error(`JbPro videoBuffer ${i.videoBuffer}s must be less than heartTimeout ${i.heartTimeout}s`);if(this._checkHasCreated(s))throw this.debugError("JbPro","JbPro container has been created and can not be created again",s),new Error("JbPro container has been created and can not be created again",s);if(!s.classList)throw this.debugError(this.TAG_NAME,"JbPro container is invalid, must be a DOM Element",s),new Error("JbPro container is invalid, must be a DOM Element",s);var r,o,a;if(s.classList.add("jb-pro-container"),r=s,o=ee,a=bo(),r&&(r.dataset?r.dataset[o]=a:r.setAttribute("data-"+o,a)),delete i.container,xo(i.videoBuffer)&&(i.videoBuffer=1e3*Number(i.videoBuffer)),xo(i.videoBufferDelay)&&(i.videoBufferDelay=1e3*Number(i.videoBufferDelay)),xo(i.networkDelay)&&(i.networkDelay=1e3*Number(i.networkDelay)),xo(i.aiFaceDetectInterval)&&(i.aiFaceDetectInterval=1e3*Number(i.aiFaceDetectInterval)),xo(i.aiObjectDetectInterval)&&(i.aiObjectDetectInterval=1e3*Number(i.aiObjectDetectInterval)),xo(i.timeout)&&(Co(i.loadingTimeout)&&(i.loadingTimeout=i.timeout),Co(i.heartTimeout)&&(i.heartTimeout=i.timeout)),xo(i.autoWasm)&&(Co(i.decoderErrorAutoWasm)&&(i.decoderErrorAutoWasm=i.autoWasm),Co(i.hardDecodingNotSupportAutoWasm)&&(i.hardDecodingNotSupportAutoWasm=i.autoWasm),Co(i.mseWaitVideoCanplayAutoWasm)&&(i.mseWaitVideoCanplayAutoWasm=i.autoWasm)),xo(i.aiFaceDetectLevel)&&Co(i.aiFaceDetectWidth)){const e=Vs[i.aiFaceDetectLevel];e&&(i.aiFaceDetectWidth=e)}if(xo(i.aiObjectDetectLevel)&&Co(i.aiObjectDetectWidth)){const e=Hs[i.aiObjectDetectLevel];e&&(i.aiObjectDetectWidth=e)}ua(i.isCrypto)&&(i.isM7sCrypto=!0),this._opt=i,this.debugLog("JbPro","init"),i.videoBuffer>1e4&&this.debugWarn(this.TAG_NAME,`videoBuffer ${i.videoBuffer/1e3}s is too long, will black screen for ${i.videoBuffer/1e3}s , it is recommended to set it to less than 10s`),this._destroyed=!1,this._destroyLock=!1,this.$container=s,this._tempPlayBgObj={},this._tempVideoLastIframeInfo={},this._tempPlayerIsMute=!0,this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this._streamErrorReplayTimes=0,this._streamEndReplayTimes=0,this._websocket1006ErrorReplayTimes=0,this.events=new Ea(this),this._opt.isUseNewFullscreenWatermark?this.watermark=new _v(this):this.watermark=new vv(this),this.memoryLogger=new Xv(this),this.network=new Zv(this),this._websocket1006ErrorRetryLog=[],this._mseDecodeErrorRetryLog=[],this._wcsDecodeErrorRetryLog=[],this._isNetworkOfflinePaused=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this.widthOrHeightChangeReplayDelayTimeout=null,this.streamErrorReplayDelayTimeout=null,this.streamEndReplayDelayTimeout=null,this.playbackPauseTimeout=null,this.playbackResumeTimeout=null,this.initDecoderWorkerTimeout=null,this.$loadingBgImage=null,this.$loadingBg=null,this._initOnLock(),this._initPlayer(s,i),this._initWatermark(),this._initNetwork(),this.debugLog("JbPro",'init success and version is "8-16-2024"'),console.log('JbPro Version is "8-16-2024" '+(pa(no)?"and is Trial Version[试用版本]":""))}destroy(){return new Promise(((e,t)=>{if(this.debugLog("JbPro","destroy()"),this._destroyLock)return t("JbPro is destroying");this._destroyLock=!0,this._destroyed=!0,this.off(),this._removeTimeout(),this._clearInitDecoderWorkerTimeout(),this._initOnLock(),this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")),this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$container&&this.$container.removeChild(this.$videoElement),this.$videoElement=null),this._removeLoadingBackgroundForIOS(),this.player?this.player.destroy().then((()=>{this.player=null,this._destroy(),this._destroyLock=!1,e()})).catch((e=>{this._destroyLock=!1,t(e)})):(this._destroy(),this._destroyLock=!1,e())}))}_removeTimeout(){this.widthOrHeightChangeReplayDelayTimeout&&(clearTimeout(this.widthOrHeightChangeReplayDelayTimeout),this.widthOrHeightChangeReplayDelayTimeout=null),this.streamErrorReplayDelayTimeout&&(clearTimeout(this.streamErrorReplayDelayTimeout),this.streamErrorReplayDelayTimeout=null),this.streamEndReplayDelayTimeout&&(clearTimeout(this.streamEndReplayDelayTimeout),this.streamEndReplayDelayTimeout=null),this.playbackPauseTimeout&&(clearTimeout(this.playbackPauseTimeout),this.playbackPauseTimeout=null),this.playbackResumeTimeout&&(clearTimeout(this.playbackResumeTimeout),this.playbackResumeTimeout=null)}_destroy(){var e,t;this.events&&(this.events.destroy(),this.events=null),this.watermark&&(this.watermark.destroy(),this.watermark=null),this.network&&(this.network.destroy(),this.network=null),this.memoryLogger&&(this.memoryLogger.destroy(),this.memoryLogger=null),this.$container&&(this.$container.classList.remove("jb-pro-container"),this.$container.classList.remove("jb-pro-fullscreen-web"),e=this.$container,t=ee,e&&(e.dataset?delete e.dataset[t]:e.removeAttribute("data-"+t)),this.$container=null),this._tempPlayBgObj=null,this._tempVideoLastIframeInfo=null,this._isNetworkOfflinePaused=!1,this._playerOnLock=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this._tempPlayerIsMute=!0,this._resetReplayTimes(),this.debugLog("JbPro","destroy end"),this._opt={},this.debug=null}_resetReplayTimes(){this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this._streamErrorReplayTimes=0,this._streamEndReplayTimes=0,this._websocket1006ErrorReplayTimes=0,this._websocket1006ErrorRetryLog=[],this._mseDecodeErrorRetryLog=[],this._wcsDecodeErrorRetryLog=[]}_getOriginalOpt(){const e=da();return Object.assign({},e,this.originalOptions)}_initPlayer(e,t){this.player=new bv(e,t),this._bindEvents()}_resetPlayer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(((t,i)=>{try{this.debugLog(this.TAG_NAME,"_resetPlayer()",JSON.stringify(e))}catch(t){this.debugLog(this.TAG_NAME,"_resetPlayer()",e)}const s=()=>{this._opt.url="",this._opt.playOptions={},this._opt=Object.assign(this._opt,e),this._initPlayer(this.$container,this._opt)};this.player?this.player.destroy().then((()=>{this.player=null,s(),this.debugLog(this.TAG_NAME,"_resetPlayer() end"),t()})).catch((e=>{this.debugError(this.TAG_NAME,"_resetPlayer() error",e),i(e)})):(s(),this.debugLog(this.TAG_NAME,"_resetPlayer() end"),t())}))}_bindEvents(){var e=this;Object.keys(at).forEach((t=>{this.player.on(at[t],(function(){for(var i=arguments.length,s=new Array(i),r=0;r{this.player&&this.player.showTipsMessageByCode(e)})),this.player.once(ot.beforeDestroy,(()=>{this.emit(ot.close),this.destroy().then((()=>{})).catch((e=>{}))})),this.player.on(ot.resize,(()=>{this.watermark&&this.watermark.resize()})),this.player.on(ot.fullscreen,(()=>{this.watermark&&this.watermark.resize()})),this.player.on(ot.videoInfo,(()=>{this.player&&(this.player.singleWatermark&&this.player.singleWatermark.resize(),this.player.ghostWatermark&&this.player.ghostWatermark.resize(),this.player.dynamicWatermark&&this.player.dynamicWatermark.resize())})),this.player.on(ot.memoryLog,(function(){e.memoryLogger.logCache(...arguments)})),this.player.on(ot.downloadMemoryLog,(()=>{this.downloadMemoryLog()}))}_initWatermark(){if(this._opt.fullscreenWatermarkConfig.text=decodeURIComponent("JessibucaPro%20%E4%BD%93%E9%AA%8C"),this._opt.fullscreenWatermarkConfig.color="white",Wo(this._opt.fullscreenWatermarkConfig)){const e=Po(this.$container,this._opt.fullscreenWatermarkConfig);if(!e.watermark_txt)return void this.debugWarn("JbPro","fullscreenWatermarkConfig text is empty");this.watermark.load(e)}}_initNetwork(){this.network.on(ot.online,(()=>{if(this.emit(ot.networkState,ot.online),this.isDestroyed())this.debugLog(this.TAG_NAME,"network online and JbPro is destroyed");else if(this.debugLog(this.TAG_NAME,"network online"),this._isNetworkOfflinePaused&&this._isNetworkOfflinePausedAndNextPlayConfig&&this._isNetworkOfflinePausedAndNextPlayConfig.url){const e=this._isNetworkOfflinePausedAndNextPlayConfig.url,t=this._isNetworkOfflinePausedAndNextPlayConfig.playOptions;this._streamErrorReplayTimes++;const i=this._isNetworkOfflinePausedAndNextPlayConfig.type||"unknown";this._isNetworkOfflinePaused=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this.debugLog(this.TAG_NAME,`${i} and network online and _streamErrorReplayTimes is ${this._streamErrorReplayTimes} and reset player and play`),this.play(e,t).then((()=>{this.debugLog(this.TAG_NAME,`${i} and network online and play success`)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.fetchError,{},e),this.debugError(this.TAG_NAME,`${i} and network online and play error`,e.toString(),e)}))}})),this.network.on(ot.offline,(()=>{this.emit(ot.networkState,ot.offline),this.debugLog(this.TAG_NAME,"network offline")}))}_checkHasCreated(e){if(!e)return!1;const t=function(e,t){return e?e.dataset?e.dataset[t]:e.getAttribute("data-"+t):""}(e,ee);return!!t}_initOnLock(){this.webglAlignmentErrorOnLock=!1,this.webglContextLostErrorOnLock=!1,this.mediaSourceH265NotSupportOnLock=!1,this.mediaSourceFullOnLock=!1,this.mediaSourceAppendBufferErrorOnLock=!1,this.mseSourceBufferErrorOnLock=!1,this.mediaSourceBufferedIsZeroErrorOnLock=!1,this.mseAddSourceBufferErrorOnLock=!1,this.mediaSourceDecoderConfigurationErrorOnLock=!1,this.mediaSourceTsIsMaxDiffOnLock=!1,this.mseWidthOrHeightChangeOnLock=!1,this.mediaSourceAudioG711NotSupportOnLock=!1,this.mediaSourceAudioInitTimeoutOnLock=!1,this.mediaSourceAudioNoDataTimeoutOnLock=!1,this.mseWorkerAddSourceBufferErrorOnLock=!1,this.mediaSourceUseCanvasRenderPlayFailedOnLock=!1,this.webcodecsH265NotSupportOnLock=!1,this.webcodecsUnsupportedConfigurationErrorOnLock=!1,this.webcodecsDecodeConfigureErrorOnLock=!1,this.webcodecsDecodeErrorOnLock=!1,this.wcsWidthOrHeightChangeOnLock=!1,this.webcodecsAudioNoDataTimeoutOnLock=!1,this.webcodecsAudioInitTimeoutOnLock=!1,this.simdDecodeErrorOnLock=!1,this.wasmWidthOrHeightChangeOnLock=!1,this.wasmUseVideoRenderErrorOnLock=!1,this.videoElementPlayingFailedOnLock=!1,this.simdH264DecodeVideoWidthIsTooLargeOnLock=!1,this.networkDelayTimeoutOnLock=!1,this.flvDemuxBufferSizeTooLargeOnLock=!1,this.fetchErrorOnLock=!1,this.streamEndOnLock=!1,this.websocketErrorOnLock=!1,this.webrtcErrorOnLock=!1,this.hlsErrorOnLock=!1,this.aliyunRtcErrorOnLock=!1,this.decoderWorkerInitErrorOnLock=!1,this.decoderWorkerWasmErrorOnLock=!1,this.videoElementPlayingFailedForWebrtcOnLock=!1,this.videoInfoErrorOnLock=!1,this.webrtcStreamH265OnLock=!1,this.mseWaitVideoCanplayTimeoutOnLock=!1}isDestroyed(){return this._destroyed}getOption(){return this.player?this.player.getOption():{}}setDebug(e){this.debugLog("JbPro",`setDebug() ${e}`),this._opt.debug=!!e,this.player?this.player.updateOption({debug:!!e},!0):this.debugWarn("JbPro","player is not init")}getIsDebug(){let e=!1;return this.player&&(e=this.player._opt.debug),e}mute(){this.debugLog("JbPro","mute()"),this.player&&this.player.mute(!0)}cancelMute(){this.debugLog("JbPro","cancelMute() and is mute is ",this.isMute()),this.player&&this.player.isAudioMute()&&this.player.mute(!1)}setVolume(e){this.debugLog("JbPro",`setVolume() ${e}`),this.player&&(this.player.volume=e)}getVolume(){let e=null;return this.player&&(e=this.player.volume,e=parseFloat(e).toFixed(2)),e}audioResume(){this.debugLog("JbPro","audioResume() and call cancelMute()"),this.cancelMute()}setTimeout(e){this.debugLog("JbPro",`setTimeout() ${e}`),e=Number(e),isNaN(e)?this.debugWarn("JbPro",`setTimeout error: ${e} is not a number`):(this._opt.timeout=e,this._opt.loadingTimeout=e,this._opt.heartTimeout=e,this.player&&this.player.updateOption({timeout:e,loadingTimeout:e,heartTimeout:e}))}setScaleMode(e){this.debugLog("JbPro",`setScaleMode() ${e}`),this.player?this.player.setScaleMode(e):this.debugWarn("JbPro","setScaleMode() player is null")}pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(((t,i)=>{this.debugLog("JbPro",`pause() ${e}`),this.isDestroyed()&&i("JbPro is destroyed"),(this._opt.pauseAndNextPlayUseLastFrameShow||this._opt.replayUseLastFrameShow)&&(this._tempPlayBgObj=this._getVideoLastIframeInfo()),this._tempPlayerIsMute=this.isMute(),this._pause(e).then((e=>{t(e)})).catch((e=>{i(e)}))}))}_pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(((t,i)=>{if(this.debugLog("JbPro",`_pause() ${e}`),this.isDestroyed())return i("JbPro is destroyed");this._resetReplayTimes(),this.player?this.player.pause(e).then((e=>{t(e)})).catch((e=>{i(e)})):i("player is null")}))}close(){return new Promise(((e,t)=>{if(this.isDestroyed())return t("JbPro is destroyed");this.debugLog("JbPro","close() and inner destroy()"),this.destroy().then((()=>{e()})).catch((e=>{t(e)}))}))}clearView(){this.debugLog("JbPro","clearView()"),this.player&&this.player.video?this.getRenderType()===H?this.player.video.clearView():this.debugWarn("JbPro","clearView","render type is video, not support clearView, please use canvas render type"):this.debugWarn("JbPro","clearView","player is null")}play(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(this.isDestroyed())return s("JbPro is destroyed");try{this.debugLog("JbPro",`play() ${e}`,JSON.stringify(t))}catch(i){this.debugLog("JbPro",`play() ${e}`,t)}if(!e&&!this._opt.url)return this.emit(ot.error,lt.playError),void s("url is null and this._opt.url is null");if(e&&(e=(""+e).trim(),-1===e.indexOf("http:")&&-1===e.indexOf("https:")&&-1===e.indexOf("webrtc:")&&-1===e.indexOf("ws:")&&-1===e.indexOf("wss:")&&-1===e.indexOf("wt:")&&-1===e.indexOf("artc:")))return s(`url ${e} must be "http:" or "https:" or "webrtc:" or "ws:" or "wss:" or "wt:" or "artc:" protocol`);if(pa(this._opt.isLive))return this.$videoElement.controls="controls",this.$videoElement.muted=!1,this.$videoElement.src=e,this.$videoElement.play(),void i(this.$videoElement);if(this._opt.isM7sCrypto){let r=t.cryptoKey||this._opt.playOptions.cryptoKey,o=t.cryptoIV||this._opt.playOptions.cryptoIV;if(this._opt.m7sCryptoKey&&(!r||!o)){const e=this._opt.m7sCryptoKey.split(".");r=oa(e[0]),o=oa(e[1])}if(!r||!o){const r=e||this._opt.url;return void this._cryptoPlay(r).then((r=>{let{cryptoIV:o,cryptoKey:a}=r;this._opt.playOptions.cryptoKey=a,this._opt.playOptions.cryptoIV=o,t.cryptoIV=o,t.cryptoKey=a,this._playBefore(e,t).then((()=>{i()})).catch((e=>{s(e)}))})).catch((e=>{s(e)}))}this._opt.playOptions.cryptoKey=r,this._opt.playOptions.cryptoIV=o,t.cryptoIV=o,t.cryptoKey=r}else if(this._opt.isXorCrypto){let e=t.cryptoKey||this._opt.playOptions.cryptoKey,i=t.cryptoIV||this._opt.playOptions.cryptoIV;if(this._opt.xorCryptoKey&&(!e||!i)){const t=this._opt.xorCryptoKey.split(".");e=oa(t[0]),i=oa(t[1])}e&&i&&(this._opt.playOptions.cryptoKey=e,this._opt.playOptions.cryptoIV=i,t.cryptoIV=i,t.cryptoKey=e)}else if(this._opt.isSm4Crypto){let e=t.cryptoKey||this._opt.playOptions.cryptoKey,i=t.cryptoIV||this._opt.playOptions.cryptoIV;if(this._opt.sm4CryptoKey&&(!e||!i)){const t=this._opt.sm4CryptoKey.split(".");2===t.length&&(e=sl(t[0]),i=sl(t[1]))}e&&i&&(this._opt.playOptions.cryptoKey=e,this._opt.playOptions.cryptoIV=i,t.cryptoIV=i,t.cryptoKey=e)}this._playBefore(e,t).then((()=>{i()})).catch((e=>{s(e)}))}))}_playBefore(e,t){return new Promise(((i,s)=>{if(this.player)if(e)if(this._opt.url)if(e===this._opt.url)if(this.player.playing)this.debugLog("JbPro","_playBefore","playing and resolve()"),i();else{this.debugLog("JbPro","_playBefore","this._opt.url === url and pause -> play and destroy play");let e=this._getOriginalOpt();(this._opt.pauseAndNextPlayUseLastFrameShow||this._opt.replayUseLastFrameShow)&&this._tempPlayBgObj&&this._tempPlayBgObj.loadingBackground&&(e=Object.assign(e,this._tempPlayBgObj)),pa(this._tempPlayerIsMute)&&(e.isNotMute=!0,this._tempPlayerIsMute=!0);const t=this._opt.url,r=this._opt.playOptions;this._resetPlayer(e).then((()=>{this._play(t,r).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore this.player.play error",e),this.emit(ot.crashLog,this.getCrashLog("this.player.play 1",e)),s(e)}))})).catch((e=>{this.debugError("JbPro","_resetPlayer error",e),s(e)}))}else{this.debugLog("JbPro","_playBefore",`\n this._url.url is ${this._opt.url}\n and new url is ${e}\n and destroy and play new url`);const r=this._getOriginalOpt();this._resetPlayer(r).then((()=>{this._play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(ot.crashLog,this.getCrashLog("this.player.play 2",e)),s(e)}))})).catch((e=>{this.debugError("JbPro","_resetPlayer error",e)}))}else this._play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(ot.crashLog,this.getCrashLog("this.player.play 3",e)),s(e)}));else{let e=this._getOriginalOpt();(this._opt.pauseAndNextPlayUseLastFrameShow||this._opt.replayUseLastFrameShow)&&this._tempPlayBgObj&&this._tempPlayBgObj.loadingBackground&&(e=Object.assign(e,this._tempPlayBgObj)),pa(this._tempPlayerIsMute)&&(e.isNotMute=!0,this._tempPlayerIsMute=!0);const t=this._opt.url,r=this._opt.playOptions;this._resetPlayer(e).then((()=>{this._play(t,r).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(ot.crashLog,this.getCrashLog("this.player.play 4",e)),s(e)}))})).catch((e=>{this.debugError("JbPro","_resetPlayer error",e)}))}else e?this._play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(ot.crashLog,this.getCrashLog("this.player.play 5",e)),s(e)})):this._play(this._opt.url,this._opt.playOptions).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(ot.crashLog,this.getCrashLog("this.player.play 6",e)),s(e)}))}))}_cryptoPlay(e){return new Promise(((t,i)=>{const s=function(e){const t=(e||document.location.toString()).split("//"),i=t[1].indexOf("/");let s=t[1].substring(i);return-1!=s.indexOf("?")&&(s=s.split("?")[0]),s}(e);let r=this._opt.cryptoKeyUrl,o="";const a=aa(e);if(r){if(o=r,this._opt.isM7sCrypto&&-1===o.indexOf("/crypto/?stream=")){const e=aa(r);o=e.origin+Z+`?stream=${s}`}}else r=a.origin+Z,o=r+`?stream=${s}`;var n;this.player.debugLog("JbPro",`_cryptoPlay() cryptoKeyUrl: ${o} and opt.cryptoKeyUrl: ${this._opt.cryptoKeyUrl}`),(n=o,new Promise(((e,t)=>{Ll.get(n).then((t=>{e(t)})).catch((e=>{t(e)}))}))).then((e=>{if(e){const s=e.split("."),r=oa(s[0]),o=oa(s[1]);o&&r?t({cryptoIV:o,cryptoKey:r}):i("get cryptoIV or cryptoKey error")}else i(`cryptoKeyUrl: getM7SCryptoStreamKey ${o} res is null`)})).catch((e=>{i(e)}))}))}playback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(this.isDestroyed())return s("JbPro is destroyed");try{this.debugLog("JbPro",`playback() ${e}, options: `,JSON.stringify(t))}catch(i){this.debugLog("JbPro",`playback() ${e}, options: `,t)}if(pa(this._opt.isLive))return s(`this._opt.isLive is ${this._opt.isLive}, can not playback`);const r=ha(),o=Object.assign({},r.playbackConfig,this._opt.playbackConfig,t);pa(o.isUseFpsRender)&&o.isCacheBeforeDecodeForFpsRender&&(o.isCacheBeforeDecodeForFpsRender=!1,this.debugWarn("JbPro","playbackConfig.isUseFpsRender is false, isCacheBeforeDecodeForFpsRender can not be ture, isCacheBeforeDecodeForFpsRender is set to false")),0===o.rateConfig.length&&o.showRateBtn&&(o.showRateBtn=!1,this.debugWarn("JbPro","playbackConfig.rateConfig.length is 0, showRateBtn can not be ture, showRateBtn is set to false")),o.controlType,Q.simple,this._resetPlayer({videoBuffer:0,playbackConfig:o,playType:_,openWebglAlignment:!0,useMSE:o.useMSE,useWCS:o.useWCS,useSIMD:!0}).then((()=>{this.play(e,t).then((()=>{i()})).catch((e=>{s(e)}))})).catch((e=>{s(e)}))}))}playbackPause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.isDestroyed()?Promise.reject("JbPro is destroyed"):(this.debugLog("JbPro",`playbackPause() ${e}`),this._opt.playType===b?Promise.reject("playType is player, can not call playbackPause method"):new Promise(((t,i)=>{if(!this.player)return i("player is null");ua(e)?this._pause().then((()=>{t()})).catch((e=>{i(e)})):(this.player.playbackPause=!0,this.player.recording=!1,this.player.zooming=!1,this.playbackPauseTimeout=setTimeout((()=>{this.playbackPauseTimeout=null,t()}),100))})))}playbackResume(){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):(this.debugLog("JbPro","playbackResume()"),this._opt.playType===b?Promise.reject("playType is player, can not call playbackResume method"):new Promise(((e,t)=>{if(!this.player)return t("player is null");this.player.playbackPause=!1,this.playbackResumeTimeout=setTimeout((()=>{this.playbackResumeTimeout=null,e()}),100)})))}forward(e){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):(this.debugLog("JbPro",`forward() ${e}`),pa(this._opt.isLive)||this._opt.playType===b?(this.debugLog("JbPro",`forward() and this._opt.isLive is ${this._opt.isLive} and this._opt.playType is ${this._opt.playType}`),Promise.reject("forward() method only just for playback type")):So(Number(e))?new Promise(((t,i)=>{this.player?(e=to(Number(e),.1,32),this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"playbackRate",value:e}),this.player.playback.setRate(e),this.player.video&&this.player.video.setRate(e),this.player.audio&&this.player.audio.setRate(e),(this.player.isPlaybackUseWCS()||this.player.isPlaybackUseMSE())&&(this.player.demux&&pa(this.player.isPlaybackPauseNotClearCacheAndCacheBeforeDecodeAndUseFpsRender())&&this.player.demux.dropBuffer$2(),this.player.isPlaybackCacheBeforeDecodeForFpsRender()&&this.player.demux.initPlaybackCacheLoop()),t()):i("player is not playing")})):Promise.reject(`forward() params "rate": ${e} must be number type`))}playbackForward(e){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):new Promise(((t,i)=>{this.forward(e).then((()=>{t()})).catch((e=>{i(e)}))}))}normal(){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):new Promise(((e,t)=>{this.forward(1).then((()=>{e()})).catch((e=>{t(e)}))}))}playbackNormal(){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):new Promise(((e,t)=>{this.normal().then((()=>{e()})).catch((e=>{t(e)}))}))}updatePlaybackForwardMaxRateDecodeIFrame(e){this.isDestroyed()||(this.debugLog("JbPro",`updatePlaybackForwardMaxRateDecodeIFrame() ${e}`),e=Number(e),e=to(e=parseInt(e,10),1,8),this._opt.playbackForwardMaxRateDecodeIFrame=e,this.player?this.player.updateOption({playbackForwardMaxRateDecodeIFrame:e},!0):this.debugWarn("JbPro","updatePlaybackForwardMaxRateDecodeIFrame() player is null"))}setPlaybackStartTime(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setPlaybackStartTime() ${e}`);const t=Go(e);this.player?this.player.isPlayback()?t<10&&0!==e&&this.player.playback.isControlTypeNormal()?this.debugWarn("JbPro",`setPlaybackStartTime() control type is normal and timestamp: ${e} is not valid`):this.player.playback.isControlTypeSimple()&&e>this.player.playback.totalDuration?this.debugWarn("JbPro",`setPlaybackStartTime() control type is simple and timestamp: ${e} is more than ${this.player.playback.totalDuration}`):this.player.playing&&(this.player.playback.isControlTypeNormal()&&10===t&&(e*=1e3),this.player.playback.setStartTime(e),this.playbackClearCacheBuffer()):this.debugWarn("JbPro","setPlaybackStartTime() playType is not playback"):this.debugWarn("JbPro","setPlaybackStartTime() player is null")}setPlaybackShowPrecision(e){this.isDestroyed()||(this.debugLog("JbPro",`setPlaybackShowPrecision() ${e}`),this.player?this.player.isPlayback()?this.player.playback.isControlTypeNormal()?this.player.playback.setShowPrecision(e):this.debugWarn("JbPro","control type is not normal , not support!"):this.debugWarn("JbPro","playType is not playback"):this.debugWarn("JbPro","player is null"))}playbackCurrentTimeScroll(){this.isDestroyed()||(this.debugLog("JbPro","playbackCurrentTimeScroll()"),this.player?this.player.isPlayback()?this.player.playback.isControlTypeNormal()?this.player.playback.currentTimeScroll():this.debugWarn("JbPro","control type is not normal , not support!"):this.debugWarn("JbPro","playType is not playback"):this.debugWarn("JbPro","player is null"))}playbackClearCacheBuffer(){this.isDestroyed()||(this.debugLog("JbPro","playbackClearCacheBuffer()"),this.player?this.player.isPlayback()?(this.player.video&&this.player.video.clear(),this.player.audio&&this.player.audio.clear(),this.clearBufferDelay()):this.debugWarn("JbPro","playType is not playback"):this.debugWarn("JbPro","player is null"))}getPlaybackCurrentRate(){return this.player?this.player.isPlayback()?this.player.getPlaybackRate():(this.debugWarn("JbPro","playType is not playback"),1):(this.debugWarn("JbPro","player is null"),1)}updatePlaybackLocalOneFrameTimestamp(e){this.isDestroyed()||(this.debugLog("JbPro",`updatePlaybackLocalOneFrameTimestamp() ${e}`),this.player?this.player.isPlayback()?this.player.playback.updateLocalOneFrameTimestamp(e):this.debugWarn("JbPro","playType is not playback"):this.debugWarn("JbPro","player is null"))}setStreamQuality(e){if(this.isDestroyed())return;if(this.debugLog("JbPro",`setStreamQuality() ${e}`),!this.player)return void this.debugWarn("JbPro","player is null");if(!this.player._opt.operateBtns.quality)return void this.debugWarn("JbPro","player._opt.operateBtns.quality is false");(this.player._opt.qualityConfig||[]).includes(e)?this.player.streamQuality=e:this.debugWarn("JbPro",`quality: ${e} is not in qualityList`)}_play(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(!this.player)return s("player is null");let r=!1;this._opt.url&&this._opt.url!==e&&(r=!0),this._opt.url=e,this._opt.playOptions=t;const u=e.split("?")[0],p=u.startsWith("http://")||u.startsWith("https://"),f=u.startsWith("webrtc://"),m=u.startsWith("artc://"),g=u.startsWith("wt://"),y=u.startsWith("ws://")||u.startsWith("wss://"),A=p||y,b=p&&u.endsWith(".m3u8"),v=A&&u.endsWith(".flv"),_=A&&(u.endsWith(".fmp4")||u.endsWith(".mp4")),S=A&&u.endsWith(".mpeg4"),E=A&&(u.endsWith(".h264")||u.endsWith(".h265")),w=A&&u.endsWith(".ts");let M=this._opt.isWebrtcForZLM||!1,F=this._opt.isWebrtcForSRS||!1,U=this._opt.isWebrtcForOthers||!1;f&&(-1!==e.indexOf("/index/api/webrtc")?(M=!0,F=!1,U=!1):-1!==e.indexOf("/rtc/v1/play/")&&(F=!0,M=!1,U=!1));let O=null,N=null;if(v&&pa(this._opt.isFlv)&&this._resetDemuxType("isFlv"),_&&pa(this._opt.isFmp4)&&this._resetDemuxType("isFmp4"),S&&pa(this._opt.isMpeg4)&&this._resetDemuxType("isMpeg4"),E&&pa(this._opt.isNakedFlow)&&this._resetDemuxType("isNakedFlow"),w&&pa(this._opt.isTs)&&this._resetDemuxType("isTs"),p?O=b?n:a:g?O=d:f?O=l:m?O=h:y&&(O=o),this._opt.isNakedFlow?N=x:this._opt.isFmp4?N=R:this._opt.isMpeg4?N=P:this._opt.isFlv?N=T:this._opt.isTs?N=I:b?N=L:f?N=C:m?N=B:g?N=D:y&&(N=k),!O||!N)return this._opt.playFailedAndPausedShowMessage&&this.showErrorMessageTips("url is not support"),s(`play url ${e} is invalid, protocol is ${c[O]}, demuxType is ${N}`);this.debugLog("JbPro",`play url ${e} protocol is ${c[O]}, demuxType is ${N}`);const j=()=>{this.player.on(lt.webglAlignmentError,this._handleWebglAlignmentError.bind(this)),this.player.on(lt.webglContextLostError,this._handleWebglContextLostError.bind(this)),this.player.on(lt.mediaSourceH265NotSupport,this._handleMediaSourceH265NotSupport.bind(this)),this.player.on(lt.mseWaitVideoCanplayTimeout,this._handleMseWaitVideoCanplayTimeout.bind(this)),this.player.on(lt.mediaSourceFull,this._handleMediaSourceFull.bind(this)),this.player.on(lt.mediaSourceAppendBufferError,this._handleMediaSourceAppendBufferError.bind(this)),this.player.on(lt.mseSourceBufferError,this._handleMseSourceBufferError.bind(this)),this.player.on(lt.mediaSourceBufferedIsZeroError,this._handleMediaSourceBufferedIsZeroError.bind(this)),this.player.on(lt.mseAddSourceBufferError,this._handleMseAddSourceBufferError.bind(this)),this.player.on(lt.mediaSourceDecoderConfigurationError,this._handleMediaSourceDecoderConfigurationError.bind(this)),this.player.on(lt.mediaSourceTsIsMaxDiff,this._handleMediaSourceTsIsMaxDiff.bind(this)),this.player.on(lt.mseWidthOrHeightChange,this._handleMseWidthOrHeightChange.bind(this)),this.player.on(lt.mediaSourceAudioG711NotSupport,this._handleMediaSourceAudioG711NotSupport.bind(this)),this.player.on(lt.mediaSourceAudioInitTimeout,this._handleMediaSourceAudioInitTimeout.bind(this)),this.player.once(lt.mediaSourceAudioNoDataTimeout,this._handleMediaSourceAudioNoDataTimeout.bind(this)),this.player.on(lt.mseWorkerAddSourceBufferError,this._handleMseWorkerAddSourceBufferError.bind(this)),this.player.on(lt.mediaSourceUseCanvasRenderPlayFailed,this._handleMediaSourceUseCanvasRenderPlayFailed.bind(this)),this.player.on(lt.webcodecsH265NotSupport,this._handleWebcodecsH265NotSupport.bind(this)),this.player.on(lt.webcodecsUnsupportedConfigurationError,this._handleWebcodecsUnsupportedConfigurationError.bind(this)),this.player.on(lt.webcodecsDecodeConfigureError,this._handleWebcodecsDecodeConfigureError.bind(this)),this.player.on(lt.webcodecsDecodeError,this._handleWebcodecsDecodeError.bind(this)),this.player.on(lt.wcsWidthOrHeightChange,this._handleWcsWidthOrHeightChange.bind(this)),this.player.on(lt.webcodecsAudioNoDataTimeout,this._handleWebcodecsAudioNoDataTimeout.bind(this)),this.player.on(lt.webcodecsAudioInitTimeout,this._handleWebcodecsAudioInitTimeout.bind(this)),this.player.on(lt.simdDecodeError,this._handleSimdDecodeError.bind(this)),this.player.on(lt.wasmWidthOrHeightChange,this._handleWasmWidthOrHeightChange.bind(this)),this.player.on(lt.wasmUseVideoRenderError,this._handleWasmUseVideoRenderError.bind(this)),this.player.on(lt.videoElementPlayingFailed,this._handleVideoElementPlayingFailed.bind(this)),this.player.on(lt.simdH264DecodeVideoWidthIsTooLarge,this._handleSimdH264DecodeVideoWidthIsTooLarge.bind(this)),this.player.on(ot.networkDelayTimeout,this._handleNetworkDelayTimeout.bind(this)),this.player.on(ot.flvDemuxBufferSizeTooLarge,this._handleFlvDemuxBufferSizeTooLarge.bind(this)),this.player.on(lt.fetchError,this._handleFetchError.bind(this)),this.player.on(ot.streamEnd,this._handleStreamEnd.bind(this)),this.player.on(lt.websocketError,this._handleWebsocketError.bind(this)),this.player.on(lt.webrtcError,this._handleWebrtcError.bind(this)),this.player.on(lt.hlsError,this._handleHlsError.bind(this)),this.player.on(lt.aliyunRtcError,this._handleAliyunRtcError.bind(this)),this.player.on(lt.decoderWorkerInitError,this._handleDecoderWorkerInitError.bind(this)),this.player.on(lt.decoderWorkerWasmError,this._handleDecoderWorkerWasmError.bind(this)),this.player.on(lt.videoElementPlayingFailedForWebrtc,this._handleVideoElementPlayingFailedForWebrtc.bind(this)),this.player.on(lt.videoInfoError,this._handleVideoInfoError.bind(this)),this.player.on(ot.webrtcStreamH265,this._handleWebrtcStreamH265.bind(this)),this.player.on(ot.delayTimeout,this._handleDelayTimeout.bind(this)),this.player.on(ot.loadingTimeout,this._handleLoadingTimeout.bind(this)),this._hasLoaded()?(this.debugLog(this.TAG_NAME,"_playNext and _hasLoaded() is true"),this.player.play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_hasLoaded() and play error",e),this.emit(ot.crashLog,this.getCrashLog("_hasLoaded() and play error",e)),this.player&&this.player.pause().then((()=>{s(e)})).catch((e=>{s(e),this.debugError("JbPro","_hasLoaded() and play error and next pause error",e)}))}))):(this.debugLog(this.TAG_NAME,"_playNext and waiting decoderWorkerInit callback"),this._checkInitDecoderWorkerTimeout(),this.player.once(ot.decoderWorkerInit,(()=>{this._clearInitDecoderWorkerTimeout(),this.isDestroyed()?this.debugLog("JbPro","decoderWorkerInit but player is destroyed"):(this.debugLog(this.TAG_NAME,"_playNext and decoderWorkerInit callback and next play"),this.player.play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","decoderWorkerInit and play error",e),this.emit(ot.crashLog,this.getCrashLog("decoderWorkerInit and play error",e)),this.player&&this.player.pause().then((()=>{s(e)})).catch((e=>{s(e),this.debugError("JbPro","decoderWorkerInit and play error and next pause error",e)}))})))})))},G=this.player.getOption(),z=b&&pa(this._opt.supportHls265),W=f&&pa(this._opt.isWebrtcH265),V=b&&!!Qo(),H=b&&G.demuxUseWorker;if(z||W||m||r||S||V||H)this.debugLog("JbPro",`need reset player and\n isOldHls is ${z} and isOldWebrtc is ${W} and\n isAliyunRtc is ${m} and\n needResetPlayer(url change) is ${r} and\n isMpeg4 is ${S} and\n isHlsCanVideoPlay is ${V} and\n isHlsButDemuxUseWorker is ${H}`),this._resetPlayer({protocol:O,demuxType:N,isHls:b,isWebrtc:f,isWebrtcForZLM:M,isWebrtcForSRS:F,isWebrtcForOthers:U,isAliyunRtc:m,cryptoKey:t.cryptoKey||"",cryptoIV:t.cryptoIV||"",url:e,playOptions:t}).then((()=>{j()})).catch((e=>{s("reset player error")}));else{const e={protocol:O,demuxType:N,isHls:b,isWebrtc:f,isAliyunRtc:m,isFlv:this._opt.isFlv,isFmp4:this._opt.isFmp4,isMpeg4:this._opt.isMpeg4,isNakedFlow:this._opt.isNakedFlow,isTs:this._opt.isTs,cryptoKey:t.cryptoKey||"",cryptoIV:t.cryptoIV||""};this._opt.isNakedFlow&&(e.mseDecodeAudio=!1,e.wcsDecodeAudio=!1),this.player.updateOption(e),j()}}))}_resetDemuxType(e){this._opt.isFlv=!1,this._opt.isFmp4=!1,this._opt.isMpeg4=!1,this._opt.isNakedFlow=!1,this._opt.isHls=!1,this._opt.isWebrtc=!1,this._opt.isWebrtcForZLM=!1,this._opt.isWebrtcForSRS=!1,this._opt.isWebrtcForOthers=!1,this._opt.isAliyunRtc=!1,this._opt.isTs=!1,e&&(this._opt[e]=!0),"isFmp4"!==e&&(this._opt.isFmp4Private=!1)}resize(){this.isDestroyed()||(this.debugLog("JbPro","resize()"),this.player&&this.player.resize())}setBufferTime(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setBufferTime() ${e}`),(e=Number(e))>10&&this.debugWarn("JbPro",`setBufferTime() buffer time is ${e} second, is too large, video will show blank screen until cache ${e} second buffer data`);const t=1e3*e;this._opt.videoBuffer=t,this.player?this.player.updateOption({videoBuffer:t},!0):this.debugWarn("JbPro","setBufferTime() player is null")}setBufferDelayTime(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setBufferDelayTime() ${e}`),(e=Number(e))<.2&&this.debugWarn("JbPro",`setBufferDelayTime() buffer time delay is ${e} second, is too small`);const t=1e3*(e=to(e,.2,100));this._opt.videoBufferDelay=t,this.player?this.player.updateOption({videoBufferDelay:t},!0):this.debugWarn("JbPro","setBufferDelayTime() player is null")}setRotate(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setRotate() ${e}`),e=parseInt(e,10);this._opt.rotate!==e&&-1!==[0,90,180,270].indexOf(e)?(this._opt.rotate=e,this.player?this.player.setRotate(e):this.debugWarn("JbPro","setRotate() player is null")):this.debugWarn("JbPro",`setRotate() rotate is ${e} and this._opt.rotate is ${this._opt.rotate}`)}setMirrorRotate(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setMirrorRotate() ${e}`);e||(e="none"),this._opt.mirrorRotate!==e&&-1!==["none","level","vertical"].indexOf(e)?(this._opt.mirrorRotate=e,this.player?(this.player.updateOption({mirrorRotate:e}),this.resize()):this.debugWarn("JbPro","setMirrorRotate() player is null")):this.debugWarn("JbPro",`setMirrorRotate() mirrorRotate is ${e} and this._opt.mirrorRotate is ${this._opt.mirrorRotate}`)}setAspectRatio(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setAspectRatio() ${e}`);e||(e="default"),this._opt.aspectRatio!==e&&-1!==["default","4:3","16:9"].indexOf(e)?(this._opt.aspectRatio=e,this.player?(this.player.updateOption({aspectRatio:e}),this.resize()):this.debugWarn("JbPro","setAspectRatio() player is null")):this.debugWarn("JbPro",`setAspectRatio() aspectRatio is ${e} and this._opt.aspectRatio is ${this._opt.mirrorRotate}`)}hasLoaded(){return!0}_hasLoaded(){return this.player&&this.player.loaded||!1}setKeepScreenOn(){this.isDestroyed()||(this.debugLog("JbPro","setKeepScreenOn()"),this._opt.keepScreenOn=!0,this.player?this.player.updateOption({keepScreenOn:!0}):this.debugWarn("JbPro","setKeepScreenOn() player is not ready"))}setFullscreen(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setFullscreen() ${e}`);const t=!!e;this.player?this.player.fullscreen!==t?this.player.fullscreen=t:this.debugWarn("JbPro",`setFullscreen() fullscreen is ${t} and this.player.fullscreen is ${this.player.fullscreen}`):this.debugWarn("JbPro","setFullscreen() player is not ready")}setWebFullscreen(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setWebFullscreen() ${e}`);const t=!!e;this.player?this.player.webFullscreen=t:this.debugWarn("JbPro","setWebFullscreen() player is not ready")}screenshot(e,t,i,s){if(!this.isDestroyed())return this.debugLog("JbPro",`screenshot() ${e} ${t} ${i} ${s}`),this.player&&this.player.video?this.player.video.screenshot(e,t,i,s):(this.debugWarn("JbPro","screenshot() player is not ready"),null)}screenshotWatermark(e){return new Promise(((t,i)=>{if(this.isDestroyed())return i("player is destroyed");this.debugLog("JbPro","screenshotWatermark()",e),this.player&&this.player.video?this.player.video.screenshotWatermark(e).then((e=>{t(e)})).catch((e=>{i(e)})):(this.debugWarn("JbPro","screenshotWatermark() player is not ready"),i("player is not ready"))}))}screenshotCopyrightWatermark(e){return new Promise(((t,i)=>{if(this.isDestroyed())return i("player is destroyed");this.debugLog("JbPro","screenshotCopyrightWatermark()",e),this.player&&this.player.video?this.player.video.screenshotCopyrightWatermark(e).then((e=>{t(e)})).catch((e=>{i(e)})):(this.debugWarn("JbPro","screenshotCopyrightWatermark() player is not ready"),i("player is not ready"))}))}startRecord(e,t){return new Promise(((i,s)=>this.isDestroyed()?s("player is destroyed"):(this.debugLog("JbPro",`startRecord() ${e} ${t}`),this.player?void(this.player.playing?(this.player.startRecord(e,t),i()):(this.debugWarn("JbPro","startRecord() player is not playing"),s("not playing"))):(this.debugWarn("JbPro","startRecord() player is not ready"),s("player is not ready")))))}stopRecordAndSave(e,t){return new Promise(((i,s)=>{if(this.isDestroyed())return s("player is destroyed");this.debugLog("JbPro",`stopRecordAndSave() ${e} ${t}`),this.player&&this.player.recording?this.player.stopRecordAndSave(e,t).then((e=>{i(e)})).catch((e=>{s(e)})):s("not recording")}))}cancelRecord(){return new Promise(((e,t)=>this.isDestroyed()?t("player is destroyed"):(this.debugLog("JbPro","cancelRecord()"),this.player?void this.player.cancelRecord().then((()=>{e()})).catch((e=>{t(e)})):(this.debugWarn("JbPro","cancelRecord() player is not ready"),t("player is not ready")))))}isPlaying(){let e=!1;return this.player&&(e=this.player.isPlaying()),e}isLoading(){return!!this.player&&this.player.loading}isPause(){let e=!1;return this._opt.playType===b?e=!this.isPlaying()&&!this.isLoading():this._opt.playType===_&&this.player&&(e=this.player.playbackPause),e}isPaused(){return this.isPause()}isPlaybackPause(){let e=!1;return this._opt.playType===_&&this.player&&(e=this.player.playbackPause),e}isMute(){let e=!0;return this.player&&(e=this.player.isAudioMute()),e}isRecording(){return this.player&&this.player.recorder&&this.player.recorder.recording||!1}isFullscreen(){let e=!1;return this.player&&(e=this.player.fullscreen),e}isWebFullscreen(){let e=!1;return this.player&&(e=this.player.webFullscreen),e}clearBufferDelay(){this.isDestroyed()||(this.debugLog("JbPro","clearBufferDelay()"),this.player?this.player.clearBufferDelay():this.debugWarn("JbPro","clearBufferDelay() player is not init"))}setNetworkDelayTime(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setNetworkDelayTime() ${e}`),(e=Number(e))<1&&this.debugWarn("JbPro",`setNetworkDelayTime() network delay is ${e} second, is too small`);const t=1e3*(e=to(e,1,100));this._opt.networkDelay=t,this.player?this.player.updateOption({networkDelay:t},!0):this.debugWarn("JbPro","setNetworkDelayTime() player is null")}getDecodeType(){let e="";return this.player&&(e=this.player.getDecodeType()),e}getRenderType(){let e="";return this.player&&(e=this.player.getRenderType()),e}getAudioEngineType(){let e="";return this.player&&(e=this.player.getAudioEngineType()),e}getPlayingTimestamp(){let e=0;return this.player&&(e=this.player.getPlayingTimestamp()),e}getStatus(){let e=gs;return this.player&&(e=this.player.loading?ps:this.player.playing?fs:ms),e}getPlayType(){return this.player?this.player._opt.playType:b}togglePerformancePanel(e){if(this.isDestroyed())return;this.debugLog("JbPro",`togglePerformancePanel() ${e}`);const t=this.player._opt.showPerformance;let i=!t;Do(e)&&(i=e),i!==t?this.player?this.player.togglePerformancePanel(i):this.debugWarn("JbPro","togglePerformancePanel() failed, this.player is not init"):this.debugWarn("JbPro",`togglePerformancePanel() failed, showPerformance is prev: ${t} === now: ${i}`)}openZoom(){if(!this.isDestroyed())if(this.debugLog("JbPro","openZoom()"),this.player){if(this.player.isDestroyedOrClosed())return void this.debugWarn("JbPro","openZoom() failed, this.player is destroyed or paused");this.player.zooming=!0}else this.debugWarn("JbPro","openZoom() failed, this.player is not init")}closeZoom(){if(!this.isDestroyed())if(this.debugLog("JbPro","closeZoom()"),this.player){if(this.player.isDestroyedOrClosed())return void this.debugWarn("JbPro","openZoom() failed, this.player is destroyed or paused");this.player.zooming=!1}else this.debugWarn("JbPro","closeZoom() failed, this.player is not init")}isZoomOpen(){let e=!1;return this.player&&(e=this.player.zooming),e}toggleZoom(e){this.isDestroyed()||(this.debugLog("JbPro",`toggleZoom() ${e}`),Do(e)||(e=!this.isZoomOpen()),ua(e)?this.openZoom():pa(!1)&&this.closeZoom())}expandZoom(){this.isDestroyed()||(this.debugLog("JbPro","expandZoom()"),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.expandPrecision():this.debugWarn("JbPro","expandZoom() failed, zoom is not open or not init"))}narrowZoom(){this.isDestroyed()||(this.debugLog("JbPro","narrowZoom()"),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.narrowPrecision():this.debugWarn("JbPro","narrowZoom failed, zoom is not open or not init"))}updateCurrentZoom(e){this.isDestroyed()||(this.debugLog("JbPro","updateCurrentZoom()",e),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.updateCurrentZoom(e):this.debugWarn("JbPro","narrowZoom failed, zoom is not open or not init"))}getCurrentZoomIndex(){if(this.isDestroyed())return;let e=1;return this.player&&this.player.zoom&&(e=this.player.zoom.currentZoom),e}setNakedFlowFps(e){return new Promise(((t,i)=>{if(this.isDestroyed())return i("player is destroyed");if(this.debugLog("JbPro","setNakedFlowFps()",e),Co(e))return i("setNakedFlowFps() fps is empty");let s=Number(e);s=to(s,1,100),this._opt.nakedFlowFps=s,this.player?this.player.updateOption({nakedFlowFps:s}):this.debugWarn("JbPro","setNakedFlowFps() player is null"),t()}))}getCrashLog(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!this.player)return;const i=this.player.getAllStatsData(),s=this.player;let r={url:this._opt.url,playType:s.isPlayback()?"playback":"live",demuxType:s.getDemuxType(),decoderType:s.getDecodeType(),renderType:s.getRenderType(),videoInfo:{encType:"",width:"",height:""},audioInfo:{encType:"",sampleRate:"",channels:""},audioEngine:s.getAudioEngineType(),allTimes:i.pTs,timestamp:eo(),type:e,error:sa(t)||e};if(s.video){const e=s.video.videoInfo||{};r.videoInfo={encType:e.encType||"",width:e.width||"",height:e.height||""}}if(s.audio){const e=s.audio.audioInfo||{};r.audioInfo={encType:e.encType||"",sampleRate:e.sampleRate||"",channels:e.channels||""}}return r}updateDebugLevel(e){this.isDestroyed()||(this.debugLog("JbPro","updateDebugLevel()",e),e===J||e===q?e!==this.player._opt.debugLevel?(this._opt.debugLevel=e,this.player?this.player.updateOption({debugLevel:e},!0):this.debugWarn("JbPro","updateDebugLevel() player is null")):this.debugWarn("JbPro",`updateDebugLevel() level is same, level: ${e}`):this.debugWarn("JbPro",`updateDebugLevel() level is not valid, level: ${e}`))}updateWatermark(e){this.isDestroyed()||(this.debugLog("JbPro","updateWatermark()",e),this.player?this.player.updateWatermark(e):this.debugWarn("JbPro","updateWatermark() player is not init"))}removeWatermark(){this.isDestroyed()||(this.debugLog("JbPro","removeWatermark()"),this.player?this.player.removeWatermark():this.debugWarn("JbPro","removeWatermark() player is not init"))}updateFullscreenWatermark(e){if(!this.isDestroyed())if(this.debugLog("JbPro","updateFullscreenWatermark()",e),Wo(e)){this._opt.fullscreenWatermarkConfig=e;const t=Po(this.$container,e);if(!t.watermark_txt)return void this.debugWarn("JbPro","fullscreenWatermarkConfig text is empty");this.watermark.load(t)}else this.debugWarn("JbPro",`updateFullscreenWatermark() config is not valid, config: ${e}`)}removeFullscreenWatermark(){this.isDestroyed()||(this.debugLog("JbPro","removeFullscreenWatermark()"),this.watermark?this.watermark.remove():this.debugWarn("JbPro","removeFullscreenWatermark() watermark is not init"))}faceDetectOpen(){this.isDestroyed()||(this.debugLog("JbPro","faceDetectOpen()"),this.player?this.player.faceDetect(!0):this.debugWarn("JbPro","faceDetectOpen() player is not init"))}faceDetectClose(){this.isDestroyed()||(this.debugLog("JbPro","faceDetectClose()"),this.player?this.player.faceDetect(!1):this.debugWarn("JbPro","faceDetectClose() player is not init"))}objectDetectOpen(){this.isDestroyed()||(this.debugLog("JbPro","objectDetectOpen()"),this.player?this.player.objectDetect(!0):this.debugWarn("JbPro","objectDetectOpen() player is not init"))}objectDetectClose(){this.isDestroyed()||(this.debugLog("JbPro","objectDetectClose()"),this.player?this.player.objectDetect(!1):this.debugWarn("JbPro","objectDetectClose() player is not init"))}sendWebsocketMessage(e){this.isDestroyed()||(this.debugLog("JbPro","sendWebsocketMessage()",e),this.player?this.player.sendWebsocketMessage(e):this.debugWarn("JbPro","sendWebsocketMessage() player is not init"))}addContentToCanvas(e){this.isDestroyed()||(this.debugLog("JbPro","addContentToCanvas()"),this.player?this.player.addContentToCanvas(e):this.debugWarn("JbPro","addContentToCanvas() player is not init"))}clearContentToCanvas(){this.isDestroyed()||(this.debugLog("JbPro","clearContentToCanvas()"),this.player?this.player.addContentToCanvas([]):this.debugWarn("JbPro","clearContentToCanvas() player is not init"))}addContentToContainer(e){this.isDestroyed()||(this.debugLog("JbPro","addContentToContainer()"),this.player?this.player.addContentToContainer(e):this.debugWarn("JbPro","addContentToContainer() player is not init"))}clearContentToContainer(){this.isDestroyed()||(this.debugLog("JbPro","clearContentToContainer()"),this.player?this.player.addContentToContainer([]):this.debugWarn("JbPro","clearContentToContainer() player is not init"))}setControlHtml(e){this.isDestroyed()||(this.debugLog("JbPro","setControlHtml()",e),this.player?this.player.setControlHtml(e):this.debugWarn("JbPro","setControlHtml() player is not init"))}clearControlHtml(){this.isDestroyed()||(this.debugLog("JbPro","clearControlHtml()"),this.player?this.player.clearControlHtml():this.debugWarn("JbPro","clearControlHtml() player is not init"))}toggleControlHtml(e){this.isDestroyed()||(this.debugLog("JbPro",`toggleControlHtml() ${e}`),this.player?this.player.toggleControlHtml(e):this.debugWarn("JbPro","toggleControlHtml() player is not init"))}getControlHtmlIsShow(){return!!this.player&&this.player.getControlHtmlIsShow()}getControlHtml(){return this.player?this.player.getControlHtml():null}setExtendHtml(e){this.isDestroyed()||(this.debugLog("JbPro","setExtendHtml()",e),this.player?this.player.setExtendHtml(e):this.debugWarn("JbPro","setExtendHtml() player is not init"))}clearExtendHtml(){this.isDestroyed()||(this.debugLog("JbPro","clearExtendHtml()"),this.player?this.player.clearExtendHtml():this.debugWarn("JbPro","clearExtendHtml() player is not init"))}toggleExtendHtml(e){this.isDestroyed()||(this.debugLog("JbPro",`toggleExtendHtml() ${e}`),this.player?this.player.toggleExtendHtml(e):this.debugWarn("JbPro","toggleExtendHtml() player is not init"))}getExtendHtmlIsShow(){return!!this.player&&this.player.getExtendHtmlIsShow()}getExtendHtml(){return this.player?this.player.getExtendHtml():null}getVideoInfo(){let e=null;return this.player&&(e=this.player.getVideoInfo()),e}getAudioInfo(){let e=null;return this.player&&(e=this.player.getAudioInfo()),e}setSm4CryptoKey(e){if(this.isDestroyed())return;this.debugLog("JbPro","setSm4CryptoKey()",e);const t=(e=""+e).split(".");if(32!==e.length&&2!==t.length)return void this.debugWarn("JbPro",`setSm4CryptoKey() key is invalid and length is ${e.length} !== 32`);if(2===t.length&&(32!==t[0].length||32!==t[1].length))return void this.debugWarn("JbPro",`setSm4CryptoKey() key is invalid and key length is ${t[0].length} !== 32 or iv length ${t[1].length} !== 32`);this._opt.sm4CryptoKey=e;let i=2===t.length;if(i&&(this._opt.playOptions.cryptoKey=sl(t[0]),this._opt.playOptions.cryptoIV=sl(t[1])),this.player){const t={sm4CryptoKey:e};i&&(t.cryptoKey=this._opt.playOptions.cryptoKey,t.cryptoIV=this._opt.playOptions.cryptoIV),this.player.updateOption(t,!0)}else this.debugWarn("JbPro","setSm4CryptoKey() player is null")}setM7sCryptoKey(e){this.isDestroyed()||(this.debugLog("JbPro","setM7sCryptoKey()",e),e=""+e,this._opt.m7sCryptoKey=e,this.player?this.player.updateOption({m7sCryptoKey:e},!0):this.debugWarn("JbPro","setM7sCryptoKey() player is null"))}setXorCryptoKey(e){this.isDestroyed()||(this.debugLog("JbPro","setXorCryptoKey()",e),e=""+e,this._opt.xorCryptoKey=e,this.player?this.player.updateOption({xorCryptoKey:e},!0):this.debugWarn("JbPro","setXorCryptoKey() player is null"))}updateLoadingText(e){this.isDestroyed()||(this.debugLog("JbPro","updateLoadingText()",e),this.player?this.player.updateLoadingText(e):this.debugWarn("JbPro","updateLoadingText() player is null"))}updateIsEmitSEI(e){this.isDestroyed()||(this.debugLog("JbPro","updateIsEmitSEI()",e),this._opt.isEmitSEI=e,this.player?this.player.updateOption({isEmitSEI:e},!0):this.debugWarn("JbPro","updateIsEmitSEI() player is null"))}getPTZCmd(e,t){return this.debugLog("JbPro","getPTZCmd()",e),e?this.player?$v({type:e,index:0,speed:t}):(this.debugWarn("JbPro","getPTZCmd() player is null"),null):(this.debugWarn("JbPro","getPTZCmd() ptz is null"),null)}downloadTempNakedFlowFile(){return new Promise(((e,t)=>{this.player?(this.player.downloadNakedFlowFile(),e()):t("player is not init")}))}downloadTempFmp4File(){return new Promise(((e,t)=>{if(this.isDestroyed())return t("player is destroyed");this.player?(this.player.downloadFmp4File(),e()):t("player is not init")}))}downloadTempMpeg4File(){return new Promise(((e,t)=>{if(this.isDestroyed())return t("player is destroyed");this.player?(this.player.downloadMpeg4File(),e()):t("player is not init")}))}downloadMemoryLog(){this.isDestroyed()||this.memoryLogger&&this.memoryLogger.download()}_getVideoLastIframeInfo(){const e=this.getVideoInfo()||{},t={loadingBackground:this.screenshot("","png",.92,"base64"),loadingBackgroundWidth:e.width||0,loadingBackgroundHeight:e.height||0};return t.loadingBackground&&t.loadingBackgroundWidth&&t.loadingBackgroundHeight&&(this._tempVideoLastIframeInfo=t),this._tempVideoLastIframeInfo||{}}getExtendBtnList(){this.debugLog("JbPro","getExtendBtnList()");let e=[];return this.player?e=this.player.getExtendBtnList():this.debugWarn("JbPro","getExtendBtnList() player is null"),e}getFlvMetaData(){this.debugLog("JbPro","getFlvMetaData()");let e=null;return this.player?e=this.player.getMetaData():this.debugWarn("JbPro","getFlvMetaData() player is null"),e}updateAiFaceDetectInterval(e){if(this.isDestroyed())return;this.debugLog("JbPro","updateAiFaceDetectInterval()",e);const t=1e3*(e=Number(e));this._opt.aiFaceDetectInterval=t,this.player?this.player.updateOption({aiFaceDetectInterval:t}):this.debugWarn("JbPro","updateAiFaceDetectInterval() player is null")}updateAiFaceDetectLevel(e){if(this.isDestroyed())return;if(this.debugLog("JbPro","updateAiFaceDetectLevel()",e),!Vs[e])return void this.debugWarn("JbPro",`'updateAiFaceDetectLevel() level ${e} is invalid'`);const t=Vs[e];this._opt.aiFaceDetectWidth=t,this.player?(this.player.updateOption({aiFaceDetectWidth:t}),this.player.ai&&this.player.ai.updateFaceDetectorConfig({detectWidth:t})):this.debugWarn("JbPro","updateAiFaceDetectLevel() player is null")}updateAiObjectDetectInterval(e){if(this.isDestroyed())return;this.debugLog("JbPro","updateAiObjectDetectInterval()",e);const t=1e3*(e=Number(e));this._opt.aiObjectDetectInterval=t,this.player?this.player.updateOption({aiObjectDetectInterval:t}):this.debugWarn("JbPro","updateAiObjectDetectInterval() player is null")}updateAiObjectDetectLevel(e){if(this.isDestroyed())return;if(this.debugLog("JbPro","updateAiObjectDetectLevel()",e),!Hs[e])return void this.debugWarn("JbPro",`'updateAiObjectDetectLevel() level ${e} is invalid'`);const t=Hs[e];this._opt.aiObjectDetectWidth=t,this.player?(this.player.updateOption({aiObjectDetectWidth:t}),this.player.ai&&this.player.ai.updateObjectDetectorConfig({detectWidth:t})):this.debugWarn("JbPro","updateAiObjectDetectLevel() player is null")}setCryptoKeyUrl(e){this.isDestroyed()||(this.debugLog("JbPro","setCryptoKeyUrl()",e),e&&(this._opt.cryptoKeyUrl=e))}showErrorMessageTips(e){this.isDestroyed()||(this.debugLog("JbPro","showErrorMessageTips()",e),e&&(this.player?this.player.showTipsMessageByContent(e):this.debugWarn("JbPro","showErrorMessageTips() player is null")))}setPtzPosition(e){this.debugLog("JbPro","setPtzPosition()",e),e&&!zo(e)&&(this.player?this.player.setPtzPosition(e):this.debugWarn("JbPro","setPtzPosition() player is null"))}hideErrorMessageTips(){this.isDestroyed()||(this.debugLog("JbPro","hideErrorMessageTips()"),this.player?this.player.hideTipsMessage():this.debugWarn("JbPro","hideErrorMessageTips() player is null"))}getContainerRect(){return this._getContainerRect()}proxy(e,t,i,s){return this.events.proxy(e,t,i,s)}getUrl(){return this._opt.url}toggleControlExtendBtn(e,t){this.isDestroyed()||(this.debugLog(this.TAG_NAME,`toggleControlExtendBtn() ${e} ${t}`),this.player?this.player.toggleControlExtendBtn(e,t):this.debugWarn(this.TAG_NAME,"toggleControlExtendBtn() player is null"))}getControlExtendBtnActive(e){if(this.isDestroyed())return;this.debugLog(this.TAG_NAME,`getControlExtendBtnActive() ${e}`);let t=!1;return this.player?t=this.player.getControlExtendBtnActive(e):this.debugWarn(this.TAG_NAME,"getControlExtendBtnActive() player is null"),t}toggleControlBar(e){this.isDestroyed()||(this.debugLog(this.TAG_NAME,`toggleControlBar() ${e}`),this.player?this.player.toggleControlBar(e):this.debugWarn(this.TAG_NAME,"toggleControlBar() player is null"))}getControlBarShow(){if(this.isDestroyed())return!1;this.debugLog(this.TAG_NAME,"getControlBarShow()");let e=!1;return this.player?e=this.player.getControlBarShow():this.debugWarn(this.TAG_NAME,"getControlBarShow() player is null"),e}static getCopyrightWatermarkHash(e){return Io(e)}static extractScreenshotCopyrightWatermark(e){return function(e){for(var t=e,i=0,s=0,r=0;r<32;r++)s|=(1&t[i])<=5){const s=i[0],r=i[i.length-1],o=r-s;o<=1e4&&(this.debugWarn(this.TAG_NAME,`retry type is ${e}, and retry length is ${i.length}, and start is ${s} and end is ${r} and diff is ${o}`),t=!1)}return t}_initLoadingBackgroundForIOS(e){(fo()||mo())&&e.loadingBackground&&e.loadingBackgroundWidth&&e.loadingBackgroundHeight&&(this.debugLog(this.TAG_NAME,"_initLoadingBackgroundForIOS"),this._initLoadingBg(),"default"===this.player._opt.aspectRatio||lo()?this._doInitLoadingBackground(e):this._doInitLoadingBackgroundForRatio(e))}_doInitLoadingBackground(e){const t=this._getContainerRect();let i=t.height;const s=this.player._opt;if(this.player.isControlBarShow()){i-=s.playType===_?Qt:Yt}let r=t.width,o=i;const a=s.rotate;270!==a&&90!==a||(r=i,o=t.width),this.$loadingBgImage.width=r,this.$loadingBgImage.height=o,this.$loadingBgImage.src=e.loadingBackground;let n=(t.width-r)/2,l=(i-o)/2,d="contain";s.isResize||(d="fill"),s.isFullResize&&(d="none");let h="";"none"===s.mirrorRotate&&a&&(h+=" rotate("+a+"deg)"),"level"===s.mirrorRotate?h+=" rotateY(180deg)":"vertical"===s.mirrorRotate&&(h+=" rotateX(180deg)"),this._opt.videoRenderSupportScale&&(this.$loadingBgImage.style.objectFit=d),this.$loadingBgImage.style.transform=h,this.$loadingBgImage.style.padding="0",this.$loadingBgImage.style.left=n+"px",this.$loadingBgImage.style.top=l+"px",this.$loadingBgImage.complete?tc(this.$loadingBg,"show"):this.$loadingBgImage.onload=()=>{tc(this.$loadingBg,"show"),this.$loadingBgImage.onload=null}}_doInitLoadingBackgroundForRatio(e){const t=this.player._opt.aspectRatio.split(":").map(Number),i=this._getContainerRect();let s=i.width,r=i.height;const o=this.player._opt;let a=0;this.player.isControlBarShow()&&(a=o.playType===_?Qt:Yt,r-=a);const n=e.loadingBackgroundWidth,l=e.loadingBackgroundHeight,d=n/l,h=t[0]/t[1];if(this.$loadingBgImage.src=e.loadingBackground,d>h){const e=h*l/n;this.$loadingBgImage.style.width=100*e+"%",this.$loadingBgImage.style.height=`calc(100% - ${a}px)`,this.$loadingBgImage.style.padding=`0 ${(s-s*e)/2}px`}else{const e=n/h/l;this.$loadingBgImage.style.width="100%",this.$loadingBgImage.style.height=`calc(${100*e}% - ${a}px)`,this.$loadingBgImage.style.padding=(r-r*e)/2+"px 0"}this.$loadingBgImage.complete?tc(this.$loadingBg,"show"):this.$loadingBgImage.onload=()=>{tc(this.$loadingBg,"show"),this.$loadingBgImage.onload=null}}_initLoadingBg(){if(!this.$loadingBg){const e=document.createElement("div"),t=document.createElement("img");e.className="jb-pro-loading-bg-for-ios",this.$loadingBg=e,this.$loadingBgImage=t,e.appendChild(t),this.$container.appendChild(e)}}_removeLoadingBackgroundForIOS(){if(this.$loadingBg){this.debugLog(this.TAG_NAME,"_removeLoadingBackgroundForIOS()");if(!oc(this.$loadingBg)){const e=this.$container.querySelector(".jb-pro-loading-bg-for-ios");e&&this.$container&&this.$container.removeChild(e)}this.$loadingBg=null,this.$loadingBgImage=null}}_getContainerRect(){let e={};return this.$container&&(e=this.$container.getBoundingClientRect(),e.width=Math.max(e.width,this.$container.clientWidth),e.height=Math.max(e.height,this.$container.clientHeight)),e}_isNeedNetworkDisconnectReplay(){return this._opt.networkDisconnectReplay&&this.network.isOffline()}_handleWebglAlignmentError(e){if(this.isDestroyed())this.debugLog("JbPro","webglAlignmentError but player is destroyed");else if(this.webglAlignmentErrorOnLock)this.debugLog("JbPro","webglAlignmentErrorOnLock is true");else if(this.emit(ot.crashLog,this.getCrashLog(lt.webglAlignmentError,e)),this.webglAlignmentErrorOnLock=!0,this.player&&this.player._opt.webglAlignmentErrorReplay){this.debugLog("JbPro","webglAlignmentError");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({openWebglAlignment:!0}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webglAlignmentError and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.webglAlignmentError,{},e),this.debugError("JbPro","webglAlignmentError and play error",t)})).finally((()=>{this.webglAlignmentErrorOnLock=!1}))})).catch((e=>{this.webglAlignmentErrorOnLock=!1,this.debugError("JbPro","webglAlignmentError and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.webglAlignmentError,{},e),this.debugLog("JbPro","webglAlignmentError and webglAlignmentErrorReplay is false")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.webglAlignmentError,{},e),this.debugError("JbPro","webglAlignmentError and pause error",t)})).finally((()=>{this.webglAlignmentErrorOnLock=!1}))}}_handleWebglContextLostError(e){if(this.isDestroyed())return void this.debugLog("JbPro","webglContextLostError but player is destroyed");if(this.webglContextLostErrorOnLock)return void this.debugLog("JbPro","webglContextLostErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.webglContextLostError,e));const t=this._getVideoLastIframeInfo();if(this.webglContextLostErrorOnLock=!0,this.player&&this.player._opt.webglContextLostErrorReplay){this.debugLog("JbPro","webglContextLostError");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","webglContextLostError and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.webglContextLostError,t,e),this.debugError("JbPro","webglContextLostError and play error",i)})).finally((()=>{this.webglContextLostErrorOnLock=!1}))})).catch((i=>{this.webglContextLostErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.webglContextLostError,t,e),this.debugError("JbPro","webglContextLostError and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.webglContextLostError,t,e),this.debugLog("JbPro","webglContextLostError and webglContextLostErrorReplay is false")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.webglContextLostError,t,e),this.debugError("JbPro","webglAlignmentError and pause error",i)})).finally((()=>{this.webglContextLostErrorOnLock=!1}))}}_handleMediaSourceH265NotSupport(e){if(this.isDestroyed())this.debugLog("JbPro","mediaSourceH265NotSupport but player is destroyed");else if(this.mediaSourceH265NotSupportOnLock)this.debugLog("JbPro","mediaSourceH265NotSupportOnLock is true");else if(this.emit(ot.crashLog,this.getCrashLog(lt.mediaSourceH265NotSupport,e)),this.mediaSourceH265NotSupportOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceH265NotSupport,e),this.debugError("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play error",t)})).finally((()=>{this.mediaSourceH265NotSupportOnLock=!1}))})).catch((t=>{this.mediaSourceH265NotSupportOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceH265NotSupport,{},e),this.debugError("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceH265NotSupport,{},e),this.debugLog("JbPro","mediaSourceH265NotSupport and autoWasm is false")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceH265NotSupport,{},e),this.debugError("JbPro","mediaSourceH265NotSupport and pause error",t)})).finally((()=>{this.mediaSourceH265NotSupportOnLock=!1}))}}_handleMseWaitVideoCanplayTimeout(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","mseWaitVideoCanplayTimeout but player is destroyed");else if(this.mseWaitVideoCanplayTimeoutOnLock)this.debugLog("JbPro","mseWaitVideoCanplayTimeoutOnLock is true");else if(this.emit(ot.crashLog,this.getCrashLog(lt.mseWaitVideoCanplayTimeout,e)),this.mseWaitVideoCanplayTimeoutOnLock=!0,this.player&&this.player._opt.mseWaitVideoCanplayAutoWasm){this.debugLog("JbPro","mseWaitVideoCanplayTimeout auto wasm [mse-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","mseWaitVideoCanplayTimeout auto wasm [mse-> wasm] reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.mseWaitVideoCanplayTimeout,e),this.debugError("JbPro","mseWaitVideoCanplayTimeout auto wasm [mse-> wasm] reset player and play error",t)})).finally((()=>{this.mseWaitVideoCanplayTimeoutOnLock=!1}))})).catch((t=>{this.mseWaitVideoCanplayTimeoutOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mseWaitVideoCanplayTimeout,{},e),this.debugError("JbPro","mseWaitVideoCanplayTimeout auto wasm [mse-> wasm] _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.mseWaitVideoCanplayTimeout,{},e),this.debugLog("JbPro","mseWaitVideoCanplayTimeout and autoWasm is false")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceH265NotSupport,{},e),this.debugError("JbPro","mediaSourceH265NotSupport and pause error",t)})).finally((()=>{this.mseWaitVideoCanplayTimeoutOnLock=!1}))}}_handleMediaSourceFull(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceFull but player is destroyed"));if(this.mediaSourceFullOnLock)return void this.debugLog("JbPro","mediaSourceFullOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.mediaSourceFull,e));const t=this._getVideoLastIframeInfo();if(this.mediaSourceFullOnLock=!0,this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},o=this.player._opt.decoderErrorAutoWasm,a=!0;o?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(mr)?this._mseDecodeErrorRetryLog.push(eo()):(o=!0,a=!1,r={useMSE:!1,useWCS:!1}),this.debugLog("JbPro",`mediaSourceFull and auto wasm ${pa(a)?" and is not meaningful Retry":""} [mse-> ${o?"wasm":"mse"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mediaSourceFull and reset player and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceFull,t,e),this.debugError("JbPro","mediaSourceFull and reset player and play error",i)})).finally((()=>{this.mediaSourceFullOnLock=!1}))})).catch((i=>{this.mediaSourceFullOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceFull,t,e),this.debugError("JbPro","mediaSourceFull and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceFull,t,e),this.debugLog("JbPro","mediaSourceFull and autoWasm is false")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceFull,t,e),this.debugError("JbPro","mediaSourceFull and pause error",i)})).finally((()=>{this.mediaSourceFullOnLock=!1}))}}_handleMediaSourceAppendBufferError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceAppendBufferError but player is destroyed"));if(this.mediaSourceAppendBufferErrorOnLock)return void this.debugLog("JbPro","mediaSourceAppendBufferErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.mediaSourceAppendBufferError,e));const t=this._getVideoLastIframeInfo();if(this.mediaSourceAppendBufferErrorOnLock=!0,this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},o=this.player._opt.decoderErrorAutoWasm,a=!0;o?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(mr)?this._mseDecodeErrorRetryLog.push(eo()):(o=!0,a=!1,r={useMSE:!1,useWCS:!1}),this.player.isMSEAudioDecoderError&&(this.player.debugLog("JbPro","mediaSourceAppendBufferError and isMSEAudioDecoderError is true so set mseDecodeAudio = false"),r.mseDecodeAudio=!1),this.debugLog("JbPro",`mediaSourceAppendBufferError and auto wasm ${pa(a)?" and is not meaningful Retry":""} [mse-> ${o?"wasm":"mse"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mediaSourceAppendBufferError and reset player and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAppendBufferError,t,e),this.debugError("JbPro","mediaSourceAppendBufferError and reset player and play error",i)})).finally((()=>{this.mediaSourceAppendBufferErrorOnLock=!1}))})).catch((i=>{this.mediaSourceAppendBufferErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceAppendBufferError,t,e),this.debugError("JbPro","mediaSourceAppendBufferError and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAppendBufferError,t,e),this.debugLog("JbPro","mediaSourceAppendBufferError and autoWasm is false")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAppendBufferError,t,e),this.debugError("JbPro","mediaSourceAppendBufferError and pause error",i)})).finally((()=>{this.mediaSourceAppendBufferErrorOnLock=!1}))}}_handleMseSourceBufferError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mseSourceBufferError but player is destroyed"));if(this.mseSourceBufferErrorOnLock)return void this.debugLog("JbPro","mseSourceBufferErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.mseSourceBufferError,e));const t=this._getVideoLastIframeInfo();if(this.mseSourceBufferErrorOnLock=!0,this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={};if(this.player._opt.mseDecoderUseWorker)r={mseDecoderUseWorker:!1},this.debugLog("JbPro","mseSourceBufferError auto wasm [mse worker -> mse] reset player and play");else{let e=this.player._opt.decoderErrorAutoWasm,t=!0;e?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(mr)?this._mseDecodeErrorRetryLog.push(eo()):(e=!0,t=!1,r={useMSE:!1,useWCS:!1}),this.player.isMSEVideoDecoderInitializationFailedNotSupportHevc&&(this.debugLog("JbPro","mseSourceBufferError and isMSEVideoDecoderInitializationFailedNotSupportHevc is true so auto wasm"),r={useMSE:!1,useWCS:!1}),this.debugLog("JbPro",`mseSourceBufferError auto wasm ${pa(t)?" and is not meaningful Retry":""} [mse-> ${e?"wasm":"mse"}] reset player and play`)}this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mseSourceBufferError reset player and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mseSourceBufferError,t,e),this.debugError("JbPro","mseSourceBufferError reset player and play error",i)})).finally((()=>{this.mseSourceBufferErrorOnLock=!1}))})).catch((i=>{this.mseSourceBufferErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mseSourceBufferError,t,e),this.debugError("JbPro","mseSourceBufferError _resetPlayer and play error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.mseSourceBufferError,t,e),this.debugLog("JbPro","mseSourceBufferError and autoWasm is false")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mseSourceBufferError,t,e),this.debugError("JbPro","mseSourceBufferError and pause error:",i)})).finally((()=>{this.mseSourceBufferErrorOnLock=!1}))}}_handleMediaSourceBufferedIsZeroError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceBufferedIsZeroError but player is destroyed"));if(this.mediaSourceBufferedIsZeroErrorOnLock)return void this.debugLog("JbPro","mediaSourceBufferedIsZeroErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.mediaSourceBufferedIsZeroError,e));const t=this._getVideoLastIframeInfo();if(this.mediaSourceBufferedIsZeroErrorOnLock=!0,this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},o=this.player._opt.decoderErrorAutoWasm,a=!0;o?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(mr)?this._mseDecodeErrorRetryLog.push(eo()):(o=!0,a=!1,r={useMSE:!1,useWCS:!1}),this.debugLog("JbPro",`mediaSourceBufferedIsZeroError auto wasm ${pa(a)?" and is not meaningful Retry":""} [mse-> ${o?"wasm":"mse"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mediaSourceBufferedIsZeroError reset player and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceBufferedIsZeroError,t,e),this.debugError("JbPro","mediaSourceBufferedIsZeroError reset player and play error",i)})).finally((()=>{this.mediaSourceBufferedIsZeroErrorOnLock=!1}))})).catch((i=>{this.mediaSourceBufferedIsZeroErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceBufferedIsZeroError,t,e),this.debugError("JbPro","mediaSourceBufferedIsZeroError _resetPlayer and play error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceBufferedIsZeroError,t,e),this.debugLog("JbPro","mediaSourceBufferedIsZeroError and autoWasm is false")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceBufferedIsZeroError,t,e),this.debugError("JbPro","mediaSourceBufferedIsZeroError and pause error:",i)})).finally((()=>{this.mediaSourceBufferedIsZeroErrorOnLock=!1}))}}_handleMseAddSourceBufferError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mseAddSourceBufferError but player is destroyed"));if(this.mseAddSourceBufferErrorOnLock)return void this.debugLog("JbPro","mseAddSourceBufferErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.mseAddSourceBufferError,e));const t=this._getVideoLastIframeInfo();if(this.mseAddSourceBufferErrorOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={useMSE:!1,useWCS:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mseAddSourceBufferError,t,e),this.debugError("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play error",i)})).finally((()=>{this.mseAddSourceBufferErrorOnLock=!1}))})).catch((i=>{this.mseAddSourceBufferErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mseAddSourceBufferError,t,e),this.debugError("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] _resetPlayer and play error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.mseAddSourceBufferError,t,e),this.debugLog("JbPro","mseAddSourceBufferError and autoWasm is false")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mseAddSourceBufferError,t,e),this.debugError("JbPro","mseAddSourceBufferError and pause error",i)})).finally((()=>{this.mseAddSourceBufferErrorOnLock=!1}))}}_handleMediaSourceDecoderConfigurationError(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","mediaSourceDecoderConfigurationError but player is destroyed");else if(this.mediaSourceDecoderConfigurationErrorOnLock)this.debugLog("JbPro","mediaSourceDecoderConfigurationErrorOnLock is true");else if(this.emit(ot.crashLog,this.getCrashLog(lt.mediaSourceDecoderConfigurationError,e)),this.mediaSourceDecoderConfigurationErrorOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;let s={useMSE:!1,useWCS:!1};this._resetPlayer(s).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceDecoderConfigurationError,e),this.debugError("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play error",t)})).finally((()=>{this.mediaSourceDecoderConfigurationErrorOnLock=!1}))})).catch((t=>{this.mediaSourceDecoderConfigurationErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceDecoderConfigurationError,e),this.debugError("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceDecoderConfigurationError,e),this.debugLog("JbPro","mediaSourceDecoderConfigurationError and autoWasm is false")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceDecoderConfigurationError,e),this.debugError("JbPro","mediaSourceDecoderConfigurationError and pause error",t)})).finally((()=>{this.mediaSourceDecoderConfigurationErrorOnLock=!1}))}}_handleMediaSourceTsIsMaxDiff(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceTsIsMaxDiff but player is destroyed"));if(this.mediaSourceTsIsMaxDiffOnLock)return void this.debugLog("JbPro","mediaSourceTsIsMaxDiffOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.mediaSourceTsIsMaxDiff,e));const t=this._getVideoLastIframeInfo();if(this.mediaSourceTsIsMaxDiffOnLock=!0,this.player&&this.player._opt.mediaSourceTsIsMaxDiffReplay){this.debugLog("JbPro","mediaSourceTsIsMaxDiff reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mediaSourceTsIsMaxDiff replay success")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceTsIsMaxDiff,t,e),this.debugError("JbPro","mediaSourceTsIsMaxDiff replay error",i)})).finally((()=>{this.mediaSourceTsIsMaxDiffOnLock=!1}))})).catch((i=>{this.mediaSourceTsIsMaxDiffOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceTsIsMaxDiff,t,e),this.debugError("JbPro","mediaSourceTsIsMaxDiff _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceTsIsMaxDiff,t,e),this.debugLog("JbPro","mediaSourceTsIsMaxDiff and replay is false")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceTsIsMaxDiff,t,e),this.debugError("JbPro","mediaSourceTsIsMaxDiff and pause error",i)})).finally((()=>{this.mediaSourceTsIsMaxDiffOnLock=!1}))}}_handleMseWidthOrHeightChange(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mseWidthOrHeightChange but player is destroyed"));if(this.mseWidthOrHeightChangeOnLock)return void this.debugLog("JbPro","mseWidthOrHeightChangeOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.mseWidthOrHeightChange,t));const i=this._getVideoLastIframeInfo();if(this.mseWidthOrHeightChangeOnLock=!0,this.player&&this.player._opt.widthOrHeightChangeReplay){this.debugLog("JbPro","mseWidthOrHeightChange and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.player._opt.widthOrHeightChangeReplayDelayTime>0?this.widthOrHeightChangeReplayDelayTimeout=setTimeout((()=>{this.widthOrHeightChangeReplayDelayTimeout=null,this.isDestroyed()?this.debug&&this.debugLog("JbPro","mseWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):this.play(e,s).then((()=>{this.debugLog("JbPro","mseWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.mseWidthOrHeightChangeOnLock=!1}))}),1e3*this.player._opt.widthOrHeightChangeReplayDelayTime):this.play(e,s).then((()=>{this.debugLog("JbPro","mseWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.mseWidthOrHeightChangeOnLock=!1}))})).catch((e=>{this.mseWidthOrHeightChangeOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(ot.playFailedAndPaused,lt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange and _resetPlayer error",e)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange error and pause error",e)})).finally((()=>{this.mseWidthOrHeightChangeOnLock=!1}))}}_handleMediaSourceAudioG711NotSupport(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceAudioG711NotSupport but player is destroyed"));if(this.mediaSourceAudioG711NotSupportOnLock)return void this.debugLog("JbPro","mediaSourceAudioG711NotSupportOnLock is true");const i=this._getVideoLastIframeInfo();if(this.mediaSourceAudioG711NotSupportOnLock=!0,this.player&&this.player._opt.mediaSourceAudioG711NotSupportReplay){this.debugLog("JbPro","mediaSourceAudioG711NotSupport and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","mediaSourceAudioG711NotSupport and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioG711NotSupport,i,t),this.debugError("JbPro","mediaSourceAudioG711NotSupport and reset player and play error",e)})).finally((()=>{this.mediaSourceAudioG711NotSupportOnLock=!1}))})).catch((e=>{this.mediaSourceAudioG711NotSupportOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioG711NotSupport,i,t),this.debugError("JbPro","mediaSourceAudioG711NotSupport and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioG711NotSupport,i,t),this.debugError("JbPro","mediaSourceAudioG711NotSupport and _resetPlayer error",e)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioG711NotSupport,i,t),this.debugError("JbPro","mediaSourceAudioG711NotSupport error and pause error",e)})).finally((()=>{this.mediaSourceAudioG711NotSupportOnLock=!1}))}}_handleMediaSourceAudioInitTimeout(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceAudioInitTimeout but player is destroyed"));if(this.mediaSourceAudioInitTimeoutOnLock)return void this.debugLog("JbPro","mediaSourceAudioInitTimeoutOnLock is true");const i=this._getVideoLastIframeInfo();if(this.mediaSourceAudioInitTimeoutOnLock=!0,this.player&&this.player._opt.mediaSourceAudioInitTimeoutReplay){this.debugLog("JbPro","mediaSourceAudioInitTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","mediaSourceAudioInitTimeout and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioInitTimeout,i,t),this.debugError("JbPro","mediaSourceAudioInitTimeout and reset player and play error",e)})).finally((()=>{this.mediaSourceAudioInitTimeoutOnLock=!1}))})).catch((e=>{this.mediaSourceAudioInitTimeoutOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioInitTimeout,i,t),this.debugError("JbPro","mediaSourceAudioInitTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioInitTimeout,i),this.debugError("JbPro","mediaSourceAudioInitTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioInitTimeout,i),this.debugError("JbPro","mediaSourceAudioInitTimeout error and pause error",e)})).finally((()=>{this.mediaSourceAudioInitTimeoutOnLock=!1}))}}_handleMediaSourceAudioNoDataTimeout(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceAudioNoDataTimeout but player is destroyed"));if(this.mediaSourceAudioNoDataTimeoutOnLock)return void this.debugLog("JbPro","mediaSourceAudioNoDataTimeoutOnLock is true");const i=this._getVideoLastIframeInfo();if(this.mediaSourceAudioNoDataTimeoutOnLock=!0,this.player&&this.player._opt.mediaSourceAudioNoDataTimeoutReplay){this.debugLog("JbPro","mediaSourceAudioNoDataTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","mediaSourceAudioNoDataTimeout and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioNoDataTimeout,i,t),this.debugError("JbPro","mediaSourceAudioNoDataTimeout and reset player and play error",e)})).finally((()=>{this.mediaSourceAudioNoDataTimeoutOnLock=!1}))})).catch((e=>{this.mediaSourceAudioNoDataTimeoutOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioNoDataTimeout,i,t),this.debugError("JbPro","mediaSourceAudioNoDataTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioNoDataTimeout,i),this.debugError("JbPro","mediaSourceAudioNoDataTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceAudioNoDataTimeout,i),this.debugError("JbPro","mediaSourceAudioNoDataTimeout error and pause error",e)})).finally((()=>{this.mediaSourceAudioNoDataTimeoutOnLock=!1}))}}_handleMseWorkerAddSourceBufferError(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mseWorkerAddSourceBufferError but player is destroyed"));if(this.mseWorkerAddSourceBufferErrorOnLock)return void this.debugLog("JbPro","mseWorkerAddSourceBufferErrorOnLock is true");const i=this._getVideoLastIframeInfo();if(this.mseWorkerAddSourceBufferErrorOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","mseWorkerAddSourceBufferError and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecoderUseWorker:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","mseWorkerAddSourceBufferError and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mseWorkerAddSourceBufferError,i,t),this.debugError("JbPro","mseWorkerAddSourceBufferError and reset player and play error",e)})).finally((()=>{this.mseWorkerAddSourceBufferErrorOnLock=!1}))})).catch((e=>{this.mseWorkerAddSourceBufferErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mseWorkerAddSourceBufferError,i,t),this.debugError("JbPro","mseWorkerAddSourceBufferError and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.mseWorkerAddSourceBufferError,i),this.debugError("JbPro","mseWorkerAddSourceBufferError and _resetPlayer error",e)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.mseWorkerAddSourceBufferError,i),this.debugError("JbPro","mseWorkerAddSourceBufferError error and pause error",e)})).finally((()=>{this.mseWorkerAddSourceBufferErrorOnLock=!1}))}}_handleMediaSourceUseCanvasRenderPlayFailed(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","mediaSourceUseCanvasRenderPlayFailed but player is destroyed");else if(this.mediaSourceUseCanvasRenderPlayFailedOnLock)this.debugLog("JbPro","mediaSourceUseCanvasRenderPlayFailedOnLock is true");else if(this.emit(ot.crashLog,this.getCrashLog(lt.mediaSourceUseCanvasRenderPlayFailed,e)),this.mediaSourceUseCanvasRenderPlayFailedOnLock=!0,this.player&&this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplay&&this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType){this.debugLog("JbPro",`mediaSourceUseCanvasRenderPlayFailed relayType is ${this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType} and reset player and play`);const t=this._opt.url,i=this._opt.playOptions;let s={};const r=this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType;r===H?s={useMSE:!1,useWCS:!1}:r===$&&(s={useVideoRender:!0,useCanvasRender:!1}),this._resetPlayer(s).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","mediaSourceUseCanvasRenderPlayFailed and reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceUseCanvasRenderPlayFailed,e),this.debugError("JbPro","mediaSourceUseCanvasRenderPlayFailed and reset player and play error",t)})).finally((()=>{this.mediaSourceUseCanvasRenderPlayFailedOnLock=!1}))})).catch((t=>{this.mediaSourceUseCanvasRenderPlayFailedOnLock=!1,this.emit(ot.playFailedAndPaused,lt.mediaSourceUseCanvasRenderPlayFailed,e),this.debugError("JbPro","mediaSourceUseCanvasRenderPlayFailed auto and _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.debugLog("JbPro","mediaSourceUseCanvasRenderPlayFailed and pause player success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.mediaSourceUseCanvasRenderPlayFailed,e),this.debugError("JbPro","mediaSourceUseCanvasRenderPlayFailed and pause",t)})).finally((()=>{this.mediaSourceUseCanvasRenderPlayFailedOnLock=!1}))}}_handleWebcodecsH265NotSupport(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","webcodecsH265NotSupport but player is destroyed");else if(this.webcodecsH265NotSupportOnLock)this.debugLog("JbPro","webcodecsH265NotSupportOnLock is true");else if(this.emit(ot.crashLog,this.getCrashLog(lt.webcodecsH265NotSupport,e)),this.webcodecsH265NotSupportOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.webcodecsH265NotSupport,e),this.debugError("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play error",t)})).finally((()=>{this.webcodecsH265NotSupportOnLock=!1}))})).catch((e=>{this.webcodecsH265NotSupportOnLock=!1,this.debugError("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] _resetPlayer and play error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.webcodecsH265NotSupport,e),this.debugLog("JbPro","webcodecsH265NotSupport and autoWasm is false")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.webcodecsH265NotSupport,e),this.debugError("JbPro","webcodecsH265NotSupport and pause error",t)})).finally((()=>{this.webcodecsH265NotSupportOnLock=!1}))}}_handleWebcodecsUnsupportedConfigurationError(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","webcodecsUnsupportedConfigurationError but player is destroyed");else if(this.webcodecsUnsupportedConfigurationErrorOnLock)this.debugLog("JbPro","webcodecsUnsupportedConfigurationErrorOnLock is true");else if(this.emit(ot.crashLog,this.getCrashLog(lt.webcodecsUnsupportedConfigurationError,e)),this.webcodecsUnsupportedConfigurationErrorOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.webcodecsUnsupportedConfigurationError,e),this.debugError("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play error",t)})).finally((()=>{this.webcodecsUnsupportedConfigurationErrorOnLock=!1}))})).catch((t=>{this.webcodecsUnsupportedConfigurationErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.webcodecsUnsupportedConfigurationError,e),this.debugError("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.webcodecsUnsupportedConfigurationError,e),this.debugLog("JbPro","webcodecsUnsupportedConfigurationError and autoWasm is false")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.webcodecsUnsupportedConfigurationError,e),this.debugError("JbPro","webcodecsUnsupportedConfigurationError and pause error",t)})).finally((()=>{this.webcodecsUnsupportedConfigurationErrorOnLock=!1}))}}_handleWebcodecsDecodeConfigureError(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","webcodecsDecodeConfigureError but player is destroyed");else if(this.webcodecsDecodeConfigureErrorOnLock)this.debugLog("JbPro","webcodecsDecodeConfigureErrorOnLock is true");else if(this.emit(ot.crashLog,this.getCrashLog(lt.webcodecsDecodeConfigureError,e)),this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.webcodecsDecodeConfigureError,e),this.debugError("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play error",t)})).finally((()=>{this.webcodecsDecodeConfigureErrorOnLock=!1}))})).catch((t=>{this.webcodecsDecodeConfigureErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.webcodecsDecodeConfigureError,e),this.debugError("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.webcodecsDecodeConfigureError,e),this.debugLog("JbPro","webcodecsDecodeConfigureError and autoWasm is false")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.webcodecsDecodeConfigureError,e),this.debugError("JbPro","webcodecsDecodeConfigureError and pause error",t)})).finally((()=>{this.webcodecsDecodeConfigureErrorOnLock=!1}))}}_handleWebcodecsDecodeError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webcodecsDecodeError but player is destroyed"));if(this.webcodecsDecodeErrorOnLock)return void this.debugLog("JbPro","webcodecsDecodeErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.webcodecsDecodeError,e));const t=this._getVideoLastIframeInfo();if(this.webcodecsDecodeErrorOnLock=!0,this.player&&this.player._opt.wcsDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},o=this.player._opt.decoderErrorAutoWasm,a=!0;o?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(gr)?this._wcsDecodeErrorRetryLog.push(eo()):(o=!0,a=!1,r={useMSE:!1,useWCS:!1}),this.debugLog("JbPro",`webcodecs decode error autoWasm ${pa(a)?" and is not meaningful Retry":""} [wcs-> ${o?"wasm":"wcs"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","webcodecs decode error reset player and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.webcodecsDecodeError,t,e),this.debugError("JbPro","webcodecs decode error reset player and play error",i)})).finally((()=>{this.webcodecsDecodeErrorOnLock=!1}))})).catch((()=>{this.webcodecsDecodeErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.webcodecsDecodeError,t,e),this.debugError("JbPro","webcodecs decode error _resetPlayer error")}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.webcodecsDecodeError,t,e),this.debugLog("JbPro","webcodecs decode error and autoWasm is false")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.webcodecsDecodeError,t,e),this.debugError("JbPro","webcodecs decode error and pause error",i)})).finally((()=>{this.webcodecsDecodeErrorOnLock=!1}))}}_handleWcsWidthOrHeightChange(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","wcsWidthOrHeightChange but player is destroyed"));if(this.wcsWidthOrHeightChangeOnLock)return void this.debugLog("JbPro","wcsWidthOrHeightChangeOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.wcsWidthOrHeightChange,t));const i=this._getVideoLastIframeInfo();if(this.wcsWidthOrHeightChangeOnLock=!0,this.player&&this.player._opt.widthOrHeightChangeReplay){this.debugLog("JbPro","wcsWidthOrHeightChange and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._opt.widthOrHeightChangeReplayDelayTime>0?this.widthOrHeightChangeReplayDelayTimeout=setTimeout((()=>{this.widthOrHeightChangeReplayDelayTimeout=null,this.isDestroyed()?this.debug&&this.debugLog("JbPro","wcsWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):this.play(e,s).then((()=>{this.debugLog("JbPro","wcsWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.wcsWidthOrHeightChangeOnLock=!1}))}),1e3*this._opt.widthOrHeightChangeReplayDelayTime):this.play(e,s).then((()=>{this.debugLog("JbPro","wcsWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.wcsWidthOrHeightChangeOnLock=!1}))})).catch((e=>{this.wcsWidthOrHeightChangeOnLock=!1,this.emit(ot.playFailedAndPaused,lt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(ot.playFailedAndPaused,lt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange and _resetPlayer error",e)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange error and pause error",e)})).finally((()=>{this.wcsWidthOrHeightChangeOnLock=!1}))}}_handleWebcodecsAudioNoDataTimeout(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webcodecsAudioNoDataTimeout but player is destroyed"));if(this.webcodecsAudioNoDataTimeoutOnLock)return void this.debugLog("JbPro","webcodecsAudioNoDataTimeoutOnLock is true");const i=this._getVideoLastIframeInfo();if(this.webcodecsAudioNoDataTimeoutOnLock=!0,this.player&&this.player._opt.webcodecsAudioNoDataTimeoutReplay){this.debugLog("JbPro","webcodecsAudioNoDataTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={wcsDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","webcodecsAudioNoDataTimeout and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.webcodecsAudioNoDataTimeout,i,t),this.debugError("JbPro","webcodecsAudioNoDataTimeout and reset player and play error",e)})).finally((()=>{this.webcodecsAudioNoDataTimeoutOnLock=!1}))})).catch((e=>{this.webcodecsAudioNoDataTimeoutOnLock=!1,this.emit(ot.playFailedAndPaused,lt.webcodecsAudioNoDataTimeout,i,t),this.debugError("JbPro","webcodecsAudioNoDataTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.webcodecsAudioNoDataTimeout,i),this.debugError("JbPro","webcodecsAudioNoDataTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.webcodecsAudioNoDataTimeout,i),this.debugError("JbPro","webcodecsAudioNoDataTimeout error and pause error",e)})).finally((()=>{this.webcodecsAudioNoDataTimeoutOnLock=!1}))}}_handleWebcodecsAudioInitTimeout(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webcodecsAudioInitTimeout but player is destroyed"));if(this.webcodecsAudioInitTimeoutOnLock)return void this.debugLog("JbPro","webcodecsAudioInitTimeoutOnLock is true");const i=this._getVideoLastIframeInfo();if(this.webcodecsAudioInitTimeoutOnLock=!0,this.player&&this.player._opt.webcodecsAudioInitTimeoutReplay){this.debugLog("JbPro","webcodecsAudioInitTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={wcsDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","webcodecsAudioInitTimeout and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.webcodecsAudioInitTimeout,i,t),this.debugError("JbPro","webcodecsAudioInitTimeout and reset player and play error",e)})).finally((()=>{this.webcodecsAudioInitTimeoutOnLock=!1}))})).catch((e=>{this.webcodecsAudioInitTimeoutOnLock=!1,this.emit(ot.playFailedAndPaused,lt.webcodecsAudioInitTimeout,i,t),this.debugError("JbPro","webcodecsAudioInitTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.webcodecsAudioInitTimeout,i),this.debugError("JbPro","webcodecsAudioInitTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.webcodecsAudioInitTimeout,i),this.debugError("JbPro","webcodecsAudioInitTimeout error and pause error",e)})).finally((()=>{this.webcodecsAudioInitTimeoutOnLock=!1}))}}_handleSimdDecodeError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","simdDecodeError but player is destroyed"));if(this.simdDecodeErrorOnLock)return void this.debugLog("JbPro","simdDecodeErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.simdDecodeError,e));const t=this._getVideoLastIframeInfo();if(this.simdDecodeErrorOnLock=!0,this.player&&this.player._opt.simdDecodeErrorReplay){this.debugLog("JbPro",`simdDecodeError error simdDecodeErrorReplayType is ${this.player._opt.simdDecodeErrorReplayType} and reset player and play`);const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.simdDecodeErrorReplayType===N&&(r={useSIMD:!1}),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","simdDecodeError and reset player and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.simdDecodeError,t,e),this.debugError("JbPro","simdDecodeError and reset player and play error",i)})).finally((()=>{this.simdDecodeErrorOnLock=!1}))})).catch((i=>{this.simdDecodeErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.simdDecodeError,t,e),this.debugError("JbPro","simdDecodeError and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.simdDecodeError,t,e),this.debugError("JbPro","simdDecodeError and simdDecodeErrorReplay is false")})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.simdDecodeError,t,e),this.debugError("JbPro","simdDecodeError error and pause error",i)})).finally((()=>{this.simdDecodeErrorOnLock=!1}))}}_handleWasmWidthOrHeightChange(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","wasmWidthOrHeightChange but player is destroyed"));if(this.wasmWidthOrHeightChangeOnLock)return void this.debugLog("JbPro","wasmWidthOrHeightChangeOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.wasmWidthOrHeightChange,t));const i=this._getVideoLastIframeInfo();if(this.wasmWidthOrHeightChangeOnLock=!0,this.player&&this.player._opt.widthOrHeightChangeReplay){this.debugLog("JbPro","wasmWidthOrHeightChange and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._opt.widthOrHeightChangeReplayDelayTime>0?this.widthOrHeightChangeReplayDelayTimeout=setTimeout((()=>{this.widthOrHeightChangeReplayDelayTimeout=null,this.isDestroyed()?this.debug&&this.debugLog("JbPro","wasmWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):this.play(e,s).then((()=>{this.debugLog("JbPro","wasmWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.wasmWidthOrHeightChange,i,t),this.debugError("JbPro","wasmWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.wasmWidthOrHeightChangeOnLock=!1}))}),1e3*this._opt.widthOrHeightChangeReplayDelayTime):this.play(e,s).then((()=>{this.debugLog("JbPro","wasmWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.wasmWidthOrHeightChange,i,t),this.debugError("JbPro","wasmWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.wasmWidthOrHeightChangeOnLock=!1}))})).catch((e=>{this.wasmWidthOrHeightChangeOnLock=!1,this.emit(ot.playFailedAndPaused,lt.wasmWidthOrHeightChange,i,t),this.debugError("JbPro","wasmWidthOrHeightChange and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(ot.playFailedAndPaused,lt.wasmWidthOrHeightChange,i,t),this.debugError("JbPro","wasmWidthOrHeightChange and _resetPlayer error",e)})).catch((e=>{this.emit(ot.playFailedAndPaused,lt.wasmWidthOrHeightChange,i),this.debugError("JbPro","wasmWidthOrHeightChange error and pause error",e)})).finally((()=>{this.wasmWidthOrHeightChangeOnLock=!1}))}}_handleWasmUseVideoRenderError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","wasmUseVideoRenderError but player is destroyed"));if(this.wasmUseVideoRenderErrorOnLock)return void this.debugLog("JbPro","wasmUseVideoRenderErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.wasmUseVideoRenderError,e)),this.debugLog("JbPro","wasmUseVideoRenderError and reset player and play");const t=this._opt.url,i=this._opt.playOptions;this.wasmUseVideoRenderErrorOnLock=!0,this._resetPlayer({useVideoRender:!1,useCanvasRender:!0}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","wasmUseVideoRenderError and reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.wasmUseVideoRenderError,{},e),this.debugError("JbPro","wasmUseVideoRenderError and reset player and play error",t)})).finally((()=>{this.wasmUseVideoRenderErrorOnLock=!1}))})).catch((t=>{this.wasmUseVideoRenderErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.wasmUseVideoRenderError,{},e),this.debugError("JbPro","wasmUseVideoRenderError and _resetPlayer error",t)}))}_handleVideoElementPlayingFailed(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","videoElementPlayingFailed but player is destroyed"));if(this.videoElementPlayingFailedOnLock)return void this.debugLog("JbPro","videoElementPlayingFailedOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.videoElementPlayingFailed,e));const t=this._getVideoLastIframeInfo();if(this.videoElementPlayingFailedOnLock=!0,this.player&&this.player._opt.videoElementPlayingFailedReplay){this.debugLog("JbPro",`videoElementPlayingFailed and useMSE is ${this._opt.useMSE} and reset player and play`);const i=this._opt.url,s=this._opt.playOptions;let r={useMSE:!1,useVideoRender:!1,useCanvasRender:!0};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","videoElementPlayingFailed and reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.videoElementPlayingFailed,{},e),this.debugError("JbPro","videoElementPlayingFailed and reset player and play error",t)})).finally((()=>{this.videoElementPlayingFailedOnLock=!1}))})).catch((t=>{this.videoElementPlayingFailedOnLock=!1,this.emit(ot.playFailedAndPaused,lt.videoElementPlayingFailed,{},e),this.debugError("JbPro","videoElementPlayingFailed and _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.videoElementPlayingFailed,{},e),this.debugError("JbPro","videoElementPlayingFailed and videoElementPlayingFailedReplay is false")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.videoElementPlayingFailed,{},e),this.debugError("JbPro","videoElementPlayingFailed and _pause error",t)})).finally((()=>{this.videoElementPlayingFailedOnLock=!1}))}}_handleSimdH264DecodeVideoWidthIsTooLarge(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","simdH264DecodeVideoWidthIsTooLarge but player is destroyed");else if(this.simdH264DecodeVideoWidthIsTooLargeOnLock)this.debugLog("JbPro","simdH264DecodeVideoWidthIsTooLargeOnLock is true");else if(this.emit(ot.crashLog,this.getCrashLog(lt.simdH264DecodeVideoWidthIsTooLarge,e)),this.simdH264DecodeVideoWidthIsTooLargeOnLock=!0,this.player&&this.player._opt.simdH264DecodeVideoWidthIsTooLargeReplay){this.debugLog("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useSIMD:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debugError("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play error",t)})).finally((()=>{this.simdH264DecodeVideoWidthIsTooLargeOnLock=!1}))})).catch((t=>{this.simdH264DecodeVideoWidthIsTooLargeOnLock=!1,this.emit(ot.playFailedAndPaused,lt.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debugError("JbPro","simdH264DecodeVideoWidthIsTooLarge and _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debugError("JbPro","simdH264DecodeVideoWidthIsTooLarge and simdDecodeErrorReplay is false")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debugError("JbPro","simdH264DecodeVideoWidthIsTooLarge and pause error",t)})).finally((()=>{this.simdH264DecodeVideoWidthIsTooLargeOnLock=!1}))}}_handleNetworkDelayTimeout(e){if(this.player._opt.networkDelayTimeoutReplay){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","networkDelayTimeout but player is destroyed"));if(this.networkDelayTimeoutOnLock)return void this.debugLog("JbPro","networkDelayTimeoutOnLock is true");this.emit(ot.crashLog,this.getCrashLog(ot.networkDelayTimeout,e));const t=this._getVideoLastIframeInfo();this.debugLog("JbPro","network delay time out and reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player&&this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this.networkDelayTimeoutOnLock=!0,this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","wasm decode error and reset player and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,ot.networkDelayTimeout,t,e),this.debugError("JbPro","wasm decode error and reset player and play error",i)})).finally((()=>{this.networkDelayTimeoutOnLock=!1}))})).catch((()=>{this.networkDelayTimeoutOnLock=!1,this.emit(ot.playFailedAndPaused,ot.networkDelayTimeout,t,e),this.debugError("JbPro","wasm decode error and _resetPlayer error")}))}}_handleFlvDemuxBufferSizeTooLarge(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","flvDemuxBufferSizeTooLarge but player is destroyed"));if(this.flvDemuxBufferSizeTooLargeOnLock)return void this.debugLog("JbPro","flvDemuxBufferSizeTooLargeOnLock is true");const t=this._getVideoLastIframeInfo();if(this.flvDemuxBufferSizeTooLargeOnLock=!0,this.player._opt.flvDemuxBufferSizeTooLargeReplay){this.emit(ot.crashLog,this.getCrashLog(ot.flvDemuxBufferSizeTooLarge,e)),this.debugLog("JbPro","flv Demux Buffer Size Too Large and flvDemuxBufferSizeTooLargeReplay = true and reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player&&this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog(this.TAG_NAME,"flv Demux Buffer Size Too Large and reset player and play success")})).catch((i=>{this.emit(ot.playFailedAndPaused,ot.flvDemuxBufferSizeTooLarge,t,e),this.debugError(this.TAG_NAME,"flv Demux Buffer Size Too Large and reset player and play error",i)})).finally((()=>{this.flvDemuxBufferSizeTooLargeOnLock=!1}))})).catch((()=>{this.flvDemuxBufferSizeTooLargeOnLock=!1,this.emit(ot.playFailedAndPaused,ot.flvDemuxBufferSizeTooLarge,t,e),this.debugError(this.TAG_NAME,"flv Demux Buffer Size Too Large and _resetPlayer error")}))}else if(this._opt.flvDemuxBufferSizeTooLargeEmitFailed){this.debugLog(this.TAG_NAME,"flv Demux Buffer Size Too Large and flvDemuxBufferSizeTooLargeEmitFailed = true and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.flvDemuxBufferSizeTooLarge,t,e)})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.flvDemuxBufferSizeTooLarge,t,e),this.debugError(this.TAG_NAME,"flv Demux Buffer Size Too Large",i)})).finally((()=>{this.flvDemuxBufferSizeTooLargeOnLock=!1}))}}_handleFetchError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","fetchError but player is destroyed"));if(this.fetchErrorOnLock)return void this.debugLog("JbPro","fetchErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.fetchError,e));const t=this._getVideoLastIframeInfo(),i=this._isNeedNetworkDisconnectReplay();if(this.fetchErrorOnLock=!0,this.player._opt.streamErrorReplay||i){i?this.debugLog("JbPro","fetch error and network is disconnect and reset player and play"):this.debugLog("JbPro",`fetch error and streamErrorReplay is true and _streamErrorReplayTimes is ${this._streamErrorReplayTimes}, streamErrorReplayDelayTime is ${this._opt.streamErrorReplayDelayTime}, next replay`);let s={};this.player._opt.replayUseLastFrameShow&&(s=Object.assign({},s,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(s.isNotMute=!0);const r=this._opt.playOptions,o=this._opt.url,a=i?1:this._opt.streamErrorReplayDelayTime;this._resetPlayer(s).then((()=>{this.streamErrorReplayDelayTimeout=setTimeout((()=>{if(this.streamErrorReplayDelayTimeout=null,this.isDestroyed())this.debug&&this.debugLog("JbPro","fetch error and _resetPlayer but player is destroyed and return");else{if(this._isNeedNetworkDisconnectReplay())return this.debugLog("JbPro","fetch error and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:o,options:r,type:lt.fetchError});this._streamErrorReplayTimes++,this.play(o,r).then((()=>{this.debugLog("JbPro","fetch error and reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.fetchError,{},e),this.debugError("JbPro","fetch error and reset player and play error",t)})).finally((()=>{this.fetchErrorOnLock=!1}))}}),1e3*a)})).catch((t=>{this.fetchErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.fetchError,{},e),this.debugError("JbPro","fetch error and _resetPlayer error",t)}))}else{this.debugLog("JbPro","fetch error and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.fetchError,t,e)})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.fetchError,t,e),this.debugError("JbPro","fetch error and pause",i)})).finally((()=>{this.fetchErrorOnLock=!1}))}}_handleStreamEnd(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","streamEnd but player is destroyed and return"));if(this.streamEndOnLock)return void this.debugLog("JbPro","streamEndOnLock is true");this.emit(ot.crashLog,this.getCrashLog(ot.streamEnd,e));const t=this._getVideoLastIframeInfo(),i=""+e=="1006"&&this.player._opt.websocket1006ErrorReplay,s=!!i&&this._checkIsMeaningfulRetry(fr),r=i&&s,o=this.player._opt.streamEndReplay,a=this._isNeedNetworkDisconnectReplay();if(this.streamEndOnLock=!0,r||o||a){a?this.debugLog("JbPro","streamEnd and network is disconnect and reset player and play"):r?this.debugLog("JbPro",`streamEnd and websocket1006ErrorReplay is true and error is 1006 and _websocket1006ErrorReplayTimes is ${this._websocket1006ErrorReplayTimes} , delay ${this._opt.websocket1006ErrorReplayDelayTime}s reset player and play`):this.debugLog("JbPro",`streamEnd and isStreamEndReplay is true and and _streamEndReplayTimes is ${this._streamEndReplayTimes} , delay ${this._opt.streamEndReplayDelayTime}s reset player and play`);const s=this._opt.playOptions,o=this._opt.url;i&&this._websocket1006ErrorRetryLog.push(eo());let n={};this.player._opt.replayUseLastFrameShow&&(n=Object.assign({},n,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(n.isNotMute=!0);let l=r?this._opt.websocket1006ErrorReplayDelayTime:this._opt.streamEndReplayDelayTime;a&&(l=1),this._initLoadingBackgroundForIOS(t),this._resetPlayer(n).then((()=>{this.streamEndReplayDelayTimeout=setTimeout((()=>{if(this.streamEndReplayDelayTimeout=null,this._removeLoadingBackgroundForIOS(),this.isDestroyed())a?this.debug&&this.debugLog("JbPro","streamEnd and network is disconnect and _resetPlayer() but player is destroyed and return"):r?this.debug&&this.debugLog("JbPro","streamEnd and 1006 error and _resetPlayer() but player is destroyed and return"):this.debug&&this.debugLog("JbPro","streamEnd and _resetPlayer() but player is destroyed and return");else{if(this._isNeedNetworkDisconnectReplay())return r?this.debugLog("JbPro","streamEnd and 1006 error network is offline and wait network online to play , so return"):this.debugLog("JbPro","streamEnd and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:o,options:s,type:r?lt.websocket1006Error:lt.streamEnd});r?this._websocket1006ErrorReplayTimes++:this._streamEndReplayTimes++,this.play(o,s).then((()=>{r?this.debugLog("JbPro","streamEnd and 1006 error and reset player and play success"):this.debugLog("JbPro","streamEnd and reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.streamEnd,{},e),r?this.debugError("JbPro","streamEnd and 1006 error and reset player and play error",t):this.debugError("JbPro","streamEnd and reset player and play error",t)})).finally((()=>{this.streamEndOnLock=!1}))}}),1e3*l)})).catch((t=>{this.streamEndOnLock=!1,this.emit(ot.playFailedAndPaused,lt.streamEnd,{},e),r?this.debugError("JbPro","streamEnd and 1006 and _resetPlayer error",t):this.debugError("JbPro","streamEnd and _resetPlayer error",t)}))}else{i?this.debugLog("JbPro","streamEnd pause player "+(pa(s)?"and is not meaningful retry":"")):this.debugLog("JbPro","streamEnd pause player");const r=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(r).then((()=>{this.emit(ot.playFailedAndPaused,ot.streamEnd,t,e)})).catch((i=>{this.emit(ot.playFailedAndPaused,ot.streamEnd,t,e),this.debugError("JbPro","streamEnd pause",i)})).finally((()=>{this.streamEndOnLock=!1}))}}_handleWebsocketError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","websocketError but player is destroyed"));if(this.websocketErrorOnLock)return void this.debugLog("JbPro","websocketErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.websocketError,e));const t=this._getVideoLastIframeInfo(),i=this._isNeedNetworkDisconnectReplay();if(this.websocketErrorOnLock=!0,this.player._opt.streamErrorReplay||i){i?this.debugLog("JbPro","websocketError error and network is disconnect and reset player and play"):this.debugLog("JbPro",`websocketError error and streamErrorReplay is true and _streamErrorReplayTimes is ${this._streamErrorReplayTimes} and streamErrorReplayDelayTime is ${this._opt.streamErrorReplayDelayTime}, next replay`);let s={};this.player._opt.replayUseLastFrameShow&&(s=Object.assign({},s,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(s.isNotMute=!0);const r=this._opt.playOptions,o=this._opt.url,a=i?1:this._opt.streamErrorReplayDelayTime;this._resetPlayer(s).then((()=>{this.streamErrorReplayDelayTimeout=setTimeout((()=>{if(this.streamErrorReplayDelayTimeout=null,this.isDestroyed())i?this.debug&&this.debugLog("JbPro","websocketError error and network is disconnect and _resetPlayer() but player is destroyed and return"):this.debug&&this.debugLog("JbPro","websocketError error and _resetPlayer() but player is destroyed and return");else{if(this._isNeedNetworkDisconnectReplay())return this.debugLog("JbPro","websocketError error and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:o,options:r,type:lt.websocketError});this._streamErrorReplayTimes++,this.play(o,r).then((()=>{this.debugLog("JbPro","websocketError error and reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.fetchError,{},e),this.debugError("JbPro","websocketError error and reset player and play error",t)})).finally((()=>{this.websocketErrorOnLock=!1}))}}),1e3*a)})).catch((t=>{this.websocketErrorOnLock=!1,this.emit(ot.playFailedAndPaused,lt.fetchError,{},e),this.debugError("JbPro","websocketError error and _resetPlayer error",t)}))}else{this.debugLog("JbPro","websocketError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.websocketError,t,e)})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.websocketError,t,e),this.debugError("JbPro","websocketError and pause",i)})).finally((()=>{this.websocketErrorOnLock=!1}))}}_handleWebrtcError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webrtcError but player is destroyed"));if(this.webrtcErrorOnLock)return void this.debugLog("JbPro","webrtcErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.webrtcError,e));const t=this._getVideoLastIframeInfo();if(this._isNeedNetworkDisconnectReplay()){this.debugLog("JbPro","webrtcError error and network is offline and wait network online to play , so _resetPlayer and wait play");const i=this._opt.playOptions,s=this._opt.url;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._isNetworkOfflinePaused=!0,this._isNetworkOfflinePausedAndNextPlayConfig={url:s,options:i,type:lt.webrtcError}})).catch((()=>{this.emit(ot.playFailedAndPaused,lt.webrtcError,t,e),this.debugError("JbPro","webrtcError and _resetPlayer error")})).finally((()=>{this.webrtcErrorOnLock=!1}))}else{this.debugLog("JbPro","webrtcError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.webrtcErrorOnLock=!0,this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.webrtcError,t,e)})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.webrtcError,t,e),this.debugError("JbPro","webrtcError and pause",i)})).finally((()=>{this.webrtcErrorOnLock=!1}))}}_handleHlsError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","hlsError but player is destroyed"));if(this.hlsErrorOnLock)return void this.debugLog("JbPro","hlsErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.hlsError,e));const t=this._getVideoLastIframeInfo();if(this._isNeedNetworkDisconnectReplay()){this.debugLog("JbPro","hlsError error and network is offline and wait network online to play , so _resetPlayer and wait play");const i=this._opt.playOptions,s=this._opt.url;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),pa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._isNetworkOfflinePaused=!0,this._isNetworkOfflinePausedAndNextPlayConfig={url:s,options:i,type:lt.hlsError}})).catch((()=>{this.emit(ot.playFailedAndPaused,lt.hlsError,t,e),this.debugError("JbPro","hlsError and _resetPlayer error")})).finally((()=>{this.hlsErrorOnLock=!1}))}else{this.debugLog("JbPro","hlsError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.hlsErrorOnLock=!0,this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.hlsError,t,e)})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.hlsError,t,e),this.debugError("JbPro","hlsError and pause",i)})).finally((()=>{this.hlsErrorOnLock=!1}))}}_handleAliyunRtcError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","aliyunRtcError but player is destroyed"));if(this.aliyunRtcErrorOnLock)return void this.debugLog("JbPro","aliyunRtcErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.aliyunRtcError,e));const t=this._getVideoLastIframeInfo();this.debugLog("JbPro","aliyunRtcError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.aliyunRtcErrorOnLock=!0,this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.aliyunRtcError,t,e)})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.aliyunRtcError,t,e),this.debugError("JbPro","aliyunRtcError and pause",i)})).finally((()=>{this.aliyunRtcErrorOnLock=!1}))}_handleDecoderWorkerInitError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","decoderWorkerInitError but player is destroyed"));if(this.decoderWorkerInitErrorOnLock)return void this.debugLog("JbPro","decoderWorkerInitErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.decoderWorkerInitError,e));const t=this._getVideoLastIframeInfo();this.debugLog("JbPro","decoderWorkerInitError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.decoderWorkerInitErrorOnLock=!0,this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.decoderWorkerInitError,t,e)})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.decoderWorkerInitError,t,e),this.debugError("JbPro","decoderWorkerInitError and pause",i)})).finally((()=>{this.decoderWorkerInitErrorOnLock=!1}))}_handleDecoderWorkerWasmError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","decoderWorkerWasmError but player is destroyed"));if(this.decoderWorkerWasmErrorOnLock)return void this.debugLog("JbPro","decoderWorkerWasmErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.decoderWorkerWasmError,e)),this.debugLog("JbPro","decoderWorkerWasmError and pause player");const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.decoderWorkerWasmErrorOnLock=!0,this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.decoderWorkerWasmError,{},e)})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.decoderWorkerWasmError,{},e),this.debugError("JbPro","decoderWorkerWasmError and pause",t)})).finally((()=>{this.decoderWorkerWasmErrorOnLock=!1}))}_handleVideoElementPlayingFailedForWebrtc(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","videoElementPlayingFailedForWebrtc but player is destroyed"));if(this.videoElementPlayingFailedForWebrtcOnLock)return void this.debugLog("JbPro","videoElementPlayingFailedForWebrtcOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.videoElementPlayingFailedForWebrtc,e)),this.debugLog("JbPro","videoElementPlayingFailedForWebrtc and pause player");const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.videoElementPlayingFailedForWebrtcOnLock=!0,this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.videoElementPlayingFailedForWebrtc,{},e)})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.videoElementPlayingFailedForWebrtc,{},e),this.debugError("JbPro","videoElementPlayingFailedForWebrtc and pause",t)})).finally((()=>{this.videoElementPlayingFailedForWebrtcOnLock=!1}))}_handleVideoInfoError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","videoInfoError but player is destroyed"));if(this.videoInfoErrorOnLock)return void this.debugLog("JbPro","videoInfoErrorOnLock is true");this.emit(ot.crashLog,this.getCrashLog(lt.videoInfoError,e)),this.debugLog("JbPro","videoInfoError and pause player");const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.videoInfoErrorOnLock=!0,this._pause(t).then((()=>{this.emit(ot.playFailedAndPaused,lt.videoInfoError,{},e)})).catch((t=>{this.emit(ot.playFailedAndPaused,lt.videoInfoError,{},e),this.debugError("JbPro","videoInfoError and pause",t)})).finally((()=>{this.videoInfoErrorOnLock=!1}))}_handleWebrtcStreamH265(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webrtcStreamH265 but player is destroyed"));if(this.webrtcStreamH265OnLock)return void this.debugLog("JbPro","webrtcStreamH265OnLock is true");this.debugLog("JbPro","webrtcStreamH265 and reset player and play");const t=this._opt.url,i=this._opt.playOptions;this.webrtcStreamH265OnLock=!0,this._resetPlayer({isWebrtcH265:!0}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webrtcStreamH265 and reset player and play success")})).catch((t=>{this.emit(ot.playFailedAndPaused,ot.webrtcStreamH265,{},e),this.debugError("JbPro","webrtcStreamH265 and reset player and play error",t)})).finally((()=>{this.webrtcStreamH265OnLock=!1}))})).catch((()=>{this.webrtcStreamH265OnLock=!1,this.emit(ot.playFailedAndPaused,ot.webrtcStreamH265,{},e),this.debugError("JbPro","webrtcStreamH265 and _resetPlayer error")}))}_handleDelayTimeout(e){if(this.isDestroyed())return void(this.debug&&this.debugWarn("JbPro","delay timeout replay but player is destroyed"));this.emit(ot.crashLog,this.getCrashLog(ot.delayTimeout,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.heartTimeoutReplay&&(this._heartTimeoutReplayTimes{if(this._isNeedNetworkDisconnectReplay())return this.debugLog("JbPro","delayTimeout and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:i,options:s,type:ot.delayTimeout});this.play(i,s).then((()=>{})).catch((i=>{this.emit(ot.playFailedAndPaused,ot.delayTimeout,t,e),this.debugError("JbPro","delay timeout replay error",i)}))})).catch((i=>{this.emit(ot.playFailedAndPaused,ot.delayTimeout,t,e),this.debugError("JbPro","delay timeout _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,ot.delayTimeout,t,e),this.player&&(this.emit(ot.delayTimeoutRetryEnd),this.emit(ot.playFailedAndPaused,ot.delayTimeoutRetryEnd)),this.debugWarn("JbPro",`delayTimeoutRetryEnd and\n opt.heartTimeout is ${this.player&&this.player._opt.heartTimeout} and\n opt.heartTimeoutReplay is ${this.player&&this.player._opt.heartTimeoutReplay} and\n opt.heartTimeoutReplayTimes is ${this.player&&this.player._opt.heartTimeoutReplayTimes},and\n local._heartTimeoutReplayTimes is ${this._heartTimeoutReplayTimes}`)})).catch((i=>{this.emit(ot.playFailedAndPaused,ot.delayTimeout,t,e),this.debugError("JbPro","delay timeout and pause error",i)}))}}_handleLoadingTimeout(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","loading timeout but player is destroyed"));this.emit(ot.crashLog,this.getCrashLog(ot.loadingTimeout,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.loadingTimeoutReplay&&(this._loadingTimeoutReplayTimes{if(this._isNeedNetworkDisconnectReplay())return this.debugLog("JbPro","loadingTimeout and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:i,options:s,type:ot.loadingTimeout});this.play(i,s).then((()=>{})).catch((i=>{this.emit(ot.playFailedAndPaused,ot.loadingTimeout,t,e),this.debugError("JbPro","loading timeout replay error",i)}))})).catch((i=>{this.emit(ot.playFailedAndPaused,ot.loadingTimeout,t,e),this.debugError("JbPro","loading timeout _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,ot.loadingTimeout,t,e),this.player&&(this.emit(ot.loadingTimeoutRetryEnd),this.emit(ot.playFailedAndPaused,ot.loadingTimeoutRetryEnd,t,e),this._opt.loadingTimeoutRetryEndShowPlayBtn&&this.player.showPlayBtn()),this.debugLog("JbPro",`loadingTimeoutRetryEnd and\n opt.loadingTimeout is ${this.player&&this.player._opt.loadingTimeout} and\n opt.loadingTimeoutReplay is ${this.player&&this.player._opt.loadingTimeoutReplay} and\n local._loadingTimeoutReplayTimes time is ${this._loadingTimeoutReplayTimes} and\n opt.loadingTimeoutReplayTimes is ${this.player&&this.player._opt.loadingTimeoutReplayTimes}`)})).catch((i=>{this.emit(ot.playFailedAndPaused,ot.loadingTimeout,t,e),this.debugError("JbPro","loading timeout and pause error",i)}))}}_handleInitDecoderWorkerTimeout(e){if(this.isDestroyed())return void this.debugLog("JbPro","InitDecoderWorkerTimeout but player is destroyed");this.emit(ot.crashLog,this.getCrashLog(lt.initDecoderWorkerTimeout,e)),this.debugLog("JbPro","InitDecoderWorkerTimeout and pause player");const t=this._getVideoLastIframeInfo(),i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(ot.playFailedAndPaused,lt.initDecoderWorkerTimeout,t,e)})).catch((i=>{this.emit(ot.playFailedAndPaused,lt.initDecoderWorkerTimeout,t,e),this.debugError("JbPro","videoInfoError and pause",i)}))}_checkInitDecoderWorkerTimeout(){this._clearInitDecoderWorkerTimeout(),this.initDecoderWorkerTimeout=setTimeout((()=>{this._handleInitDecoderWorkerTimeout(lt.initDecoderWorkerTimeout)}),1e3*this._opt.initDecoderWorkerTimeout)}_clearInitDecoderWorkerTimeout(){this.initDecoderWorkerTimeout&&(clearTimeout(this.initDecoderWorkerTimeout),this.initDecoderWorkerTimeout=null)}debugLog(e){if(this._opt.debug&&this.debug){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s1?t-1:0),s=1;s1?t-1:0),s=1;s1?i-1:0),r=1;r{delete i[e]})),void delete this.e;const s=i[e],r=[];if(s&&t)for(let e=0,i=s.length;e1?i-1:0),r=1;r1?i-1:0),r=1;r1?s-1:0),o=1;o32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let i=e-this._current_word_bits_left;this._fillCurrentWord();let s=Math.min(i,this._current_word_bits_left),r=this._current_word>>>32-s;return this._current_word<<=s,this._current_word_bits_left-=s,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Br=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Mr=Br,Fr=Br;function Ur(e){let{profile:t,sampleRate:i,channel:s}=e;return new Uint8Array([175,0,t<<3|(14&i)>>1,(1&i)<<7|s<<3])}function Or(e){return Nr(e)&&e[1]===As}function Nr(e){return e[0]>>4===wt}function jr(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}function Gr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return 1024*t/e}const Wr=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function zr(e){let t=new Uint8Array(e),i=null,s=0,r=0,o=0,a=null;if(s=r=t[0]>>>3,o=(7&t[0])<<1|t[1]>>>7,o<0||o>=Wr.length)return void console.error("Flv: AAC invalid sampling frequency index!");let n=Wr[o],l=(120&t[1])>>>3;if(l<0||l>=8)return void console.log("Flv: AAC invalid channel configuration");5===s&&(a=(7&t[1])<<1|t[2]>>>7,t[2]);let d=self.navigator.userAgent.toLowerCase();return-1!==d.indexOf("firefox")?o>=6?(s=5,i=new Array(4),a=o-3):(s=2,i=new Array(2),a=o):-1!==d.indexOf("android")?(s=2,i=new Array(2),a=o):(s=5,a=o,i=new Array(4),o>=6?a=o-3:1===l&&(s=2,i=new Array(2),a=o)),i[0]=s<<3,i[0]|=(15&o)>>>1,i[1]=(15&o)<<7,i[1]|=(15&l)<<3,5===s&&(i[1]|=(15&a)>>>1,i[2]=(1&a)<<7,i[2]|=8,i[3]=0),{audioType:"aac",config:i,sampleRate:n,channelCount:l,objectType:s,codec:"mp4a.40."+s,originalCodec:"mp4a.40."+r}}class $r{constructor(e){this.buffer=e,this.buflen=e.length,this.bufpos=0,this.bufoff=0,this.iserro=!1}read(e){let t=0,i=0;for(;e;){if(e<0||this.bufpos>=this.buflen)return this.iserro=!0,0;this.iserro=!1,i=this.bufoff+e>8?8-this.bufoff:e,t<<=i,t+=this.buffer[this.bufpos]>>8-this.bufoff-i&255>>8-i,this.bufoff+=i,e-=i,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,i=this.bufoff,s=this.read(e);return this.bufpos=t,this.bufoff=i,s}read_golomb(){let e;for(e=0;0==this.read(1)&&!this.iserro;e++);return(1<=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(4095===(i[t+0]<<8|i[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let i=this.current_syncword_offset_,s=(8&e[i+1])>>>3,r=(6&e[i+1])>>>1,o=1&e[i+1],a=(192&e[i+2])>>>6,n=(60&e[i+2])>>>2,l=(1&e[i+2])<<2|(192&e[i+3])>>>6,d=(3&e[i+3])<<11|e[i+4]<<3|(224&e[i+5])>>>5;if(e[i+6],i+d>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let h=1===o?7:9,c=d-h;i+=h;let u=this.findNextSyncwordOffset(i+c);if(this.current_syncword_offset_=u,0!==s&&1!==s||0!==r)continue;let p=e.subarray(i,i+c);t={},t.audio_object_type=a+1,t.sampling_freq_index=n,t.sampling_frequency=Mr[n],t.channel_config=l,t.data=p}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Yr{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,i=this.data_;for(;;){if(t+1>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(695===(i[t+0]<<3|i[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),i=0;for(let s=0;s<=t;s++)i<<=8,i|=e.readByte();return i}readNextAACFrame(e){let t=this.data_,i=null;for(;null==i&&!this.eof_flag_;){let s=this.current_syncword_offset_,r=(31&t[s+1])<<8|t[s+2];if(s+3+r>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let o=new Ir(t.subarray(s+3,s+3+r)),a=null;if(o.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(s+3+r),o.destroy();continue}a=e}else{let e=o.readBool();if(e&&o.readBool()){console.error("audioMuxVersionA is Not Supported"),o.destroy();break}if(e&&this.getLATMValue(o),!o.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),o.destroy();break}if(0!==o.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),o.destroy();break}if(0!==o.readBits(4)){console.error("more than 2 numProgram Not Supported"),o.destroy();break}if(0!==o.readBits(3)){console.error("more than 2 numLayer Not Supported"),o.destroy();break}let t=e?this.getLATMValue(o):0,i=o.readBits(5);t-=5;let s=o.readBits(4);t-=4;let r=o.readBits(4);t-=4,o.readBits(3),t-=3,t>0&&o.readBits(t);let n=o.readBits(3);if(0!==n){console.error(`frameLengthType = ${n}. Only frameLengthType = 0 Supported`),o.destroy();break}o.readByte();let l=o.readBool();if(l)if(e)this.getLATMValue(o);else{let e=0;for(;;){e<<=8;let t=o.readBool();if(e+=o.readByte(),!t)break}console.log(e)}o.readBool()&&o.readByte(),a={},a.audio_object_type=i,a.sampling_freq_index=s,a.sampling_frequency=Mr[a.sampling_freq_index],a.channel_config=r,a.other_data_present=l}let n=0;for(;;){let e=o.readByte();if(n+=e,255!==e)break}let l=new Uint8Array(n);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function Xr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return;const i=e.length,s=[];let r,o=0;for(;o+t>>=8),o+=t,r){if(o+r>i)break;s.push(e.subarray(o,o+r)),o+=r}return s}function Zr(e){const t=e.byteLength,i=new Uint8Array(4);i[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t;const s=new Uint8Array(t+4);return s.set(i,0),s.set(e,4),s}function eo(){}function to(e){let t=null;const i=["webgl","experimental-webgl","moz-webgl","webkit-3d"];let s=0;for(;!t&&s0&&void 0!==arguments[0]?arguments[0]:"";const t=e.split(","),i=atob(t[1]),s=t[0].replace("data:","").replace(";base64","");let r=i.length,o=new Uint8Array(r);for(;r--;)o[r]=i.charCodeAt(r);return new File([o],"file",{type:s})}function ro(){return(new Date).getTime()}function oo(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}function ao(e,t,i){if(e)return"object"==typeof t&&Object.keys(t).forEach((i=>{ao(e,i,t[i])})),e.style[t]=i,e}function no(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return 0;const s=getComputedStyle(e,null).getPropertyValue(t);return i?parseFloat(s):s}function lo(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function ho(e){let t=0,i=lo();return s=>{if(!ko(s))return;t+=s;const r=lo(),o=r-i;o>=1e3&&(e(t/o*1e3),i=r,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();const co='"8-13-2024"',uo=!1;function po(){return/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase())}function fo(){return!(po()||/ipad|android(?!.*mobile)|tablet|kindle|silk/i.test(window.navigator.userAgent.toLowerCase()))}function mo(){const e=window.navigator.userAgent.toLowerCase();return/android/i.test(e)}function go(){const e=window.navigator.userAgent.toLowerCase();return/firefox/i.test(e)}function yo(){const e=window.navigator.userAgent.toLowerCase()||"",t={type:"",version:""},i={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:e.indexOf("chrome")>-1&&e.indexOf("safari")>-1,Firefox:e.indexOf("firefox")>-1,Opera:e.indexOf("opera")>-1,Safari:e.indexOf("safari")>-1&&-1==e.indexOf("chrome"),Edge:e.indexOf("edge")>-1,QQBrowser:/qqbrowser/.test(e),WeixinBrowser:/MicroMessenger/i.test(e)};for(let s in i)if(i[s]){let i="";if("IE"===s){const t=e.match(/(msie\s|trident.*rv:)([\w.]+)/);t&&t.length>2&&(i=e.match(/(msie\s|trident.*rv:)([\w.]+)/)[2])}else if("Chrome"===s){for(let e in navigator.mimeTypes)"application/360softmgrplugin"===navigator.mimeTypes[e].type&&(s="360");const t=e.match(/chrome\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Firefox"===s){const t=e.match(/firefox\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Opera"===s){const t=e.match(/opera\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Safari"===s){const t=e.match(/version\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Edge"===s){const t=e.match(/edge\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("QQBrowser"===s){const t=e.match(/qqbrowser\/([\d.]+)/);t&&t.length>1&&(i=t[1])}t.type=s,t.version=parseInt(i)}return t}function Ao(){const e=window.navigator.userAgent.toLowerCase();return e&&/iphone|ipad|ipod|ios/.test(e)}function bo(){const e=window.navigator.userAgent;return!e.match(/Chrome/gi)&&!!e.match(/Safari/gi)}function vo(e,t){if(0===arguments.length)return null;var i,s=t||"{y}-{m}-{d} {h}:{i}:{s}";"object"==typeof e?i=e:(10===(""+e).length&&(e=1e3*parseInt(e)),e=+e,i=new Date(e));var r={y:i.getFullYear(),m:i.getMonth()+1,d:i.getDate(),h:i.getHours(),i:i.getMinutes(),s:i.getSeconds(),a:i.getDay()},o=s.replace(/{(y|m|d|h|i|s|a)+}/g,((e,t)=>{var i=r[t];return"a"===t?["一","二","三","四","五","六","日"][i-1]:(e.length>0&&i<10&&(i="0"+i),i||0)}));return o}function _o(){return"VideoFrame"in window}function wo(e){if("string"!=typeof e)return e;var t=Number(e);return isNaN(t)?e:t}function So(){return"xxxxxxxxxxxx4xxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}function Eo(e,t){let i,s,r=!1;return function o(){for(var a=arguments.length,n=new Array(a),l=0;l{r=!1,i&&(o.apply(s,i),i=null,s=null)}),t)}}function To(e){if(null==e||""==e)return"0 Bytes";const t=new Array("Bytes","KB","MB","GB","TB","PB","EB","ZB","YB");let i=0;const s=parseFloat(e);i=Math.floor(Math.log(s)/Math.log(1024));var r=s/Math.pow(1024,i);return(r=r.toFixed(2))+t[i]}function ko(e){return"[object Number]"===Object.prototype.toString.call(e)}function Lo(){let e=!1;return"MediaSource"in self&&(self.MediaSource.isTypeSupported(pi)||self.MediaSource.isTypeSupported(fi)||self.MediaSource.isTypeSupported(mi)||self.MediaSource.isTypeSupported(gi)||self.MediaSource.isTypeSupported(yi))&&(e=!0),e}function Co(){const e=yo();return"chrome"===e.type.toLowerCase()&&e.version>=107}function xo(){let e=!1;return"MediaStreamTrackGenerator"in window&&(e=!0),e}function Do(){let e=!1;return"MediaStream"in window&&(e=!0),e}function Ro(e,t){let i=window.URL.createObjectURL(t),s=window.document.createElement("a");s.download=e,s.href=i;let r=window.document.createEvent("MouseEvents");r.initEvent("click",!0,!0),s.dispatchEvent(r),setTimeout((()=>{window.URL.revokeObjectURL(i)}),Ao()?1e3:0)}function Po(e){return null==e}function Io(e){return!0===e||!1===e}function Bo(e){return!Po(e)}function Mo(e){let t={left:"",right:"",top:"",bottom:"",opacity:1,backgroundColor:"",image:{src:"",width:"100",height:"60"},text:{content:"",fontSize:"14",color:"#000",width:"",height:""},rect:{color:"green",lineWidth:2,width:"",height:"",fill:"",fillOpacity:.2},line:{x1:"",y1:"",x2:"",y2:"",color:"green",lineWidth:2},polygon:{color:"green",lineWidth:2,list:[],fill:"",fillOpacity:.2},html:""};const i=Object.assign(t.image,e.image||{}),s=Object.assign(t.text,e.text||{}),r=Object.assign(t.rect,e.rect||{}),o=Object.assign(t.line,e.line||{});return t=Object.assign(t,e,{image:i,text:s,rect:r,line:o}),t}function Fo(e,t){let i={container:e||"",text:"",opacity:"",angle:"",color:"",fontSize:"",fontFamily:""};return i=Object.assign(i,t),{watermark_parent_node:i.container,watermark_alpha:i.opacity,watermark_angle:i.angle,watermark_fontsize:i.fontSize,watermark_color:i.color,watermark_font:i.fontFamily,watermark_txt:i.text}}function Uo(e,t){return new Promise(((i,s)=>{let r=Mo(t);if(!r.image.src&&!r.text.content)return i(e);let o=document.createElement("canvas");o.width=t.width,o.height=t.height;let a=o.getContext("2d");a.imageSmoothingEnabled=!0,a.imageSmoothingEnabled&&(a.imageSmoothingQuality="high");let n=0,l=0;ko(r.left)?n=r.left:ko(r.right)&&(n=o.width-r.right),ko(r.top)?l=r.top:ko(r.bottom)&&(l=o.height-r.bottom);const d=new Image;d.src=e,d.onload=()=>{if(a.drawImage(d,0,0),r.image&&r.image.src){const e=new Image;e.src=r.image.src,e.setAttribute("crossOrigin","Anonymous"),e.onload=()=>{n-=r.image.width,a.drawImage(e,n,l,r.image.width,r.image.height),i(o.toDataURL(t.format,t.quality))},e.onerror=e=>{s()}}else r.text&&r.text.content&&(a.font=r.text.fontSize+"px 宋体",a.fillStyle=r.text.color,a.textAlign="right",a.fillText(r.text.content,n,l),i(o.toDataURL(t.format,t.quality)))},d.onerror=e=>{s(e)}}))}function Oo(e){var t,i=0;if(0===e.length)return i;for(t=0;t{if(!t.copyright)return i(e);let r=document.createElement("canvas");r.width=t.width,r.height=t.height;let o=r.getContext("2d");o.imageSmoothingEnabled=!0,o.imageSmoothingEnabled&&(o.imageSmoothingQuality="high");const a=new Image;a.src=e,a.onload=()=>{o.drawImage(a,0,0);const e=Oo(t.copyright),s=o.getImageData(0,0,r.width,r.height);!function(e,t){for(var i=e.data,s=0,r=0;r<32;r++){var o=t>>r&1,a=254&i[s]|o;i[s]=a,s+=4}}(s,e),o.putImageData(s,0,0),i(r.toDataURL(t.format,t.quality))},a.onerror=e=>{s(e)}}))}function jo(e){var t;if(e>-1){var i=Math.floor(e/3600),s=Math.floor(e/60)%60,r=e%60;t=i<10?"0"+i+":":i+":",s<10&&(t+="0"),t+=s+":",(r=Math.round(r))<10&&(t+="0"),t+=r.toFixed(0)}return t}function Go(e,t){let i="";if(e>-1){const s=Math.floor(e/60)%60;let r=e%60;r=Math.round(r),i=s<10?"0"+s+":":s+":",r<10&&(i+="0"),i+=r,Po(t)||(t<10&&(t="0"+t),i+=":"+t)}return i}function Wo(e){let t="";if(e>-1){const i=Math.floor(e/60/60)%60;let s=Math.floor(e/60)%60,r=e%60;s=Math.round(s),t=i<10?"0"+i+":":i+":",s<10&&(t+="0"),t+=s+":",r<10&&(t+="0"),t+=r}return t}function zo(e,t){const i=Math.floor(t/60)%60,s=Math.floor(t%60);return new Date(e).setHours(i,s,0,0)}function $o(e,t){const i=Math.floor(t/60/60)%60,s=Math.floor(t/60)%60,r=t%60;return new Date(e).setHours(i,s,r,0)}function Vo(e){return(""+e).length}function Ho(e){return e&&0===Object.keys(e).length}function Jo(e){return!Ho(e)}function qo(e){return"string"==typeof e}const Ko=()=>{const e=window.navigator.userAgent;return/MicroMessenger/i.test(e)},Yo=()=>{const e=window.navigator.userAgent;return/Chrome/i.test(e)};function Qo(e){const t=e||window.event;return t.target||t.srcElement}function Xo(){return go()&&function(){const e=navigator.userAgent.toLowerCase();return/macintosh|mac os x/i.test(e)}()}function Zo(e){return"function"==typeof e}function ea(e){if(po()){let t=0,i=0;if(1===e.touches.length){let s=e.touches[0];t=s.clientX,i=s.clientY}return{posX:t,posY:i}}let t=0,i=0;const s=e||window.event;return s.pageX||s.pageY?(t=s.pageX,i=s.pageY):(s.clientX||s.clientY)&&(t=e.clientX+document.documentElement.scrollLeft+document.body.scrollLeft,i=e.clientY+document.documentElement.scrollTop+document.body.scrollTop),{posX:t,posY:i}}function ta(){let e=document.createElement("video"),t=e.canPlayType("application/vnd.apple.mpegurl");return e=null,t}function ia(e){let t=ya(e.hasAudio)&&(e.useMSE||e.useWCS&&!e.useOffscreen)&&ya(e.demuxUseWorker);return!!(ya(t)&&e.useMSE&&e.mseDecodeAudio&&ya(e.demuxUseWorker))||(!!(ya(t)&&e.useWCS&&e.wcsDecodeAudio)||t)}function sa(e){let t=null,i=31&e[0];return i!==Lt&&i!==Ct||(t=vt),t||(i=(126&e[0])>>1,i!==Wt&&i!==$t&&i!==Ht||(t=_t)),t}function ra(e){e.close()}function oa(e){e.close()}function aa(){return"https:"===window.location.protocol||"localhost"===window.location.hostname}function na(e){const t=Object.prototype.toString;return function(e){switch(t.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:try{return e instanceof Error}catch(e){return!1}}}(e)?e.message:null==e?"":"object"==typeof e?JSON.stringify(e,null,2):String(e)}function la(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let i=e[0],s=null,r=1;if(e.length>0){let t=e[1];t&&t.ts-i.ts>1e5&&(i=t,r=2)}if(i)for(let o=r;o=1e3){e[o-1].ts-i.ts<1e3&&(s=o+1)}}}return s}function da(e){for(var t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),i=window.atob(t),s=new Uint8Array(i.length),r=0;r>4===bs&&e[1]===As}function ga(e){return!0===e||"true"===e}function ya(e){return!0!==e&&"true"!==e}function Aa(e,t,i){e&&(e.dataset?e.dataset[t]=i:e.setAttribute("data-"+t,i))}function ba(e,t){return e?e.dataset?e.dataset[t]:e.getAttribute("data-"+t):""}function va(e){return e.replace(/-([a-z])/g,(function(e,t){return t.toUpperCase()}))}function _a(){return/iphone/i.test(navigator.userAgent)}function wa(){return window.performance&&window.performance.memory?window.performance.memory:null}function Sa(){try{var e=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!e.getContext("webgl2"))}catch(e){return!1}}function Ea(e){return e.trim().match(/^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/)[1]}function Ta(){let e=!1;return"requestVideoFrameCallback"in HTMLVideoElement.prototype&&(e=!0),e}function ka(){let e=!1;return"PressureObserver"in window&&(e=!0),e}function La(e,t){const i=Xr(e.slice(5));let s=!1;return i.forEach((e=>{const i=t?e[0]>>>1&63:31&e[0];(t&&(i===Ft||i===Ot||i===jt)||ya(t)&&i===xt)&&(s=!0)})),s}function Ca(){let e={down:"mousedown",move:"mousemove",up:"mouseup",click:"click"};return po()&&(e={down:"touchstart",move:"touchmove",up:"touchend",click:"click"}),e}class xa{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,i,s)));e.addEventListener(t,i,s);const r=()=>{Zo(e.removeEventListener)&&e.removeEventListener(t,i,s)};return this.destroys.push(r),r}destroy(){this.master.debugLog("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}var Da=1e-6,Ra="undefined"!=typeof Float32Array?Float32Array:Array;function Pa(){var e=new Ra(16);return Ra!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function Ia(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Ba,Ma=function(e,t,i,s,r,o,a){var n=1/(t-i),l=1/(s-r),d=1/(o-a);return e[0]=-2*n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*d,e[11]=0,e[12]=(t+i)*n,e[13]=(r+s)*l,e[14]=(a+o)*d,e[15]=1,e};function Fa(e,t,i){var s=new Ra(3);return s[0]=e,s[1]=t,s[2]=i,s}Ba=new Ra(3),Ra!=Float32Array&&(Ba[0]=0,Ba[1]=0,Ba[2]=0);class Ua{constructor(e,t){this.gl=e,t&&this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1);const i=this._initShaderProgram();this._programInfo={program:i,attribLocations:{vertexPosition:e.getAttribLocation(i,"aVertexPosition"),texturePosition:e.getAttribLocation(i,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(i,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(i,"uModelMatrix"),viewMatrix:e.getUniformLocation(i,"uViewMatrix"),rgbatexture:e.getUniformLocation(i,"rgbaTexture"),ytexture:e.getUniformLocation(i,"yTexture"),utexture:e.getUniformLocation(i,"uTexture"),vtexture:e.getUniformLocation(i,"vTexture"),isyuv:e.getUniformLocation(i,"isyuv")}},this._buffers=this._initBuffers(),this._rgbatexture=this._createTexture(),this._ytexture=this._createTexture(),this._utexture=this._createTexture(),this._vtexture=this._createTexture()}destroy(){this.gl.deleteProgram(this._programInfo.program),this.gl.deleteBuffer(this._buffers.position),this.gl.deleteBuffer(this._buffers.texPosition),this.gl.deleteBuffer(this._buffers.indices),this.gl.deleteTexture(this._rgbatexture),this.gl.deleteTexture(this._ytexture),this.gl.deleteTexture(this._utexture),this.gl.deleteTexture(this._vtexture),this._programInfo=null,this._buffers=null,this._rgbatexture=null,this._ytexture=null,this._utexture=null,this._vtexture=null}_initShaderProgram(){const e=this._loadShader(this.gl.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),t=this._loadShader(this.gl.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=this.gl.createProgram();return this.gl.attachShader(i,e),this.gl.attachShader(i,t),this.gl.linkProgram(i),this.gl.getProgramParameter(i,this.gl.LINK_STATUS)?i:(console.log("Unable to initialize the shader program: "+this.gl.getProgramInfoLog(i)),null)}_loadShader(e,t){const i=this.gl,s=i.createShader(e);return i.shaderSource(s,t),i.compileShader(s),i.getShaderParameter(s,i.COMPILE_STATUS)?s:(console.log("An error occurred compiling the shaders: "+i.getShaderInfoLog(s)),i.deleteShader(s),null)}_initBuffers(){const e=this.gl,t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);const i=[-1,-1,1,-1,1,1,-1,1];e.bufferData(e.ARRAY_BUFFER,new Float32Array(i),e.STATIC_DRAW);var s=[];s=s.concat([0,1],[1,1],[1,0],[0,0]);const r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array(s),e.STATIC_DRAW);const o=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{positions:i,position:t,texPosition:r,indices:o}}_createTexture(){let e=this.gl.createTexture();return this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),e}_drawScene(e,t,i){this.gl.viewport(0,0,e,t),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._buffers.position),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array(this._buffers.positions),this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this._programInfo.attribLocations.vertexPosition,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this._programInfo.attribLocations.vertexPosition),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._buffers.texPosition),this.gl.vertexAttribPointer(this._programInfo.attribLocations.texturePosition,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this._programInfo.attribLocations.texturePosition),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this._buffers.indices);i?(this.gl.activeTexture(this.gl.TEXTURE0+3),this.gl.bindTexture(this.gl.TEXTURE_2D,this._ytexture),this.gl.activeTexture(this.gl.TEXTURE0+4),this.gl.bindTexture(this.gl.TEXTURE_2D,this._utexture),this.gl.activeTexture(this.gl.TEXTURE0+5),this.gl.bindTexture(this.gl.TEXTURE_2D,this._vtexture)):(this.gl.activeTexture(this.gl.TEXTURE0+2),this.gl.bindTexture(this.gl.TEXTURE_2D,this._rgbatexture)),this.gl.useProgram(this._programInfo.program),this.gl.uniform1i(this._programInfo.uniformLocations.rgbatexture,2),this.gl.uniform1i(this._programInfo.uniformLocations.ytexture,3),this.gl.uniform1i(this._programInfo.uniformLocations.utexture,4),this.gl.uniform1i(this._programInfo.uniformLocations.vtexture,5),this.gl.uniform1i(this._programInfo.uniformLocations.isyuv,i?1:0),this.gl.drawElements(this.gl.TRIANGLES,6,this.gl.UNSIGNED_SHORT,0)}_calRect(e,t,i,s,r,o){let a=2*e/r-1,n=2*(o-t-s)/o-1,l=2*(e+i)/r-1,d=2*(o-t)/o-1;return[a,n,l,n,l,d,a,d]}_clear(){this.gl.clearColor(0,0,0,1),this.gl.clearDepth(1),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}render(e,t,i,s,r){const o=this.gl;this._clear(),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,this._ytexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e,t,0,o.LUMINANCE,o.UNSIGNED_BYTE,i),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,this._utexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e/2,t/2,0,o.LUMINANCE,o.UNSIGNED_BYTE,s),o.activeTexture(o.TEXTURE2),o.bindTexture(o.TEXTURE_2D,this._vtexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e/2,t/2,0,o.LUMINANCE,o.UNSIGNED_BYTE,r),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}renderYUV(e,t,i){let s=i.slice(0,e*t),r=i.slice(e*t,e*t*5/4),o=i.slice(e*t*5/4,e*t*3/2);const a=this.gl;this._clear(),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this._ytexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e,t,0,a.LUMINANCE,a.UNSIGNED_BYTE,s),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,this._utexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,r),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,this._vtexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,o),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}drawDom(e,t,i,s,r){const o=this.gl;o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,this._rgbatexture),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,r),this._buffers.positions=this._calRect(i,s,r.width,r.height,e,t),this._drawScene(e,t,!1)}}const Oa=1,Na=2,ja=4;class Ga{constructor(e){this.gpu=e,this.pipeline=null,this.matrixGroupInfo=null,this.depthTexture=null,this.textureGroupInfo=null,this.hasInited=!1,this.buffers=this._initBuffer(),this.isDestroyed=!1,this._initPipeline().then((e=>{this.isDestroyed||(this.pipeline=e,this.matrixGroupInfo=this._initMatrixGroupInfo(),this.matrixGroupInfo&&(this.hasInited=!0))}))}destroy(){this.isDestroyed=!1,this.gpu&&(this.gpu.device.destroy(),this.gpu=null),this.hasInited=!1,this.pipeline=null,this.matrixGroupInfo=null,this.depthTexture=null,this.textureGroupInfo=null}_initBuffer(){const e=this.gpu.device,t=new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),i=e.createBuffer({size:t.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST});e.queue.writeBuffer(i,0,t);const s=new Float32Array([0,1,1,1,1,0,0,0]),r=e.createBuffer({size:s.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST});e.queue.writeBuffer(r,0,s);const o=new Uint16Array([0,1,2,0,2,3]),a=e.createBuffer({size:o.byteLength,usage:window.GPUBufferUsage.INDEX|window.GPUBufferUsage.COPY_DST});return e.queue.writeBuffer(a,0,o),{positionBuffer:i,texpositionBuffer:r,indexBuffer:a}}_initPipeline(){return new Promise(((e,t)=>{const i=this.gpu.device,s=this.gpu.format,r={layout:"auto",vertex:{module:i.createShaderModule({code:"\n\n @binding(0) @group(0) var uModelMatrix : mat4x4;\n @binding(1) @group(0) var uViewMatrix : mat4x4;\n @binding(2) @group(0) var uProjectionMatrix : mat4x4;\n\n struct VertexOutput {\n @builtin(position) Position : vec4,\n @location(0) vTexturePosition : vec2,\n }\n\n @vertex\n fn main(\n @location(0) aVertexPosition : vec4,\n @location(1) aTexturePosition : vec2\n ) -> VertexOutput {\n var output : VertexOutput;\n var tmppos : vec4 = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n output.Position = vec4(tmppos.x, tmppos.y, (tmppos.z+1.)/2., tmppos.w); // webgl z [-1, 1], webgpu z [0, 1], 这里z做下调整 z-webgpu = (z-webgl+1)/2\n output.vTexturePosition = aTexturePosition;\n return output;\n }\n\n "}),entryPoint:"main",buffers:[{arrayStride:12,attributes:[{shaderLocation:0,offset:0,format:"float32x3"}]},{arrayStride:8,attributes:[{shaderLocation:1,offset:0,format:"float32x2"}]}]},primitive:{topology:"triangle-list"},fragment:{module:i.createShaderModule({code:"\n @group(1) @binding(0) var mySampler: sampler;\n @group(1) @binding(1) var pixelType: i32;\n @group(1) @binding(2) var yTexture: texture_2d;\n @group(1) @binding(3) var uTexture: texture_2d;\n @group(1) @binding(4) var vTexture: texture_2d;\n @group(1) @binding(5) var uvTexture: texture_2d;\n @group(1) @binding(6) var rgbaTexture: texture_2d;\n\n const YUV2RGB : mat4x4 = mat4x4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n @fragment\n fn main(\n @location(0) vTexturePosition: vec2\n ) -> @location(0) vec4 {\n if(pixelType == 1){\n var y : f32= textureSample(yTexture, mySampler, vTexturePosition).r;\n var u : f32 = textureSample(uTexture, mySampler, vTexturePosition).r;\n var v : f32 = textureSample(vTexture, mySampler, vTexturePosition).r;\n\n return vec4(y, u, v, 1.0)*YUV2RGB;\n } else if (pixelType == 2) {\n\n var y : f32= textureSample(yTexture, mySampler, vTexturePosition).r;\n var u : f32 = textureSample(uvTexture, mySampler, vTexturePosition).r;\n var v : f32 = textureSample(uvTexture, mySampler, vTexturePosition).g;\n\n return vec4(y, u, v, 1.0)*YUV2RGB;\n } else {\n\n return textureSample(rgbaTexture, mySampler, vTexturePosition);\n }\n\n }\n\n "}),entryPoint:"main",targets:[{format:s}]},depthStencil:{depthWriteEnabled:!0,depthCompare:"less",format:"depth24plus"}};i.createRenderPipelineAsync(r).then((t=>{e(t)})).catch((e=>{t(e)}))}))}_initMatrixGroupInfo(){if(!this.gpu)return null;const e=this.gpu.device,t=this.pipeline,i=Pa();Ma(i,-1,1,-1,1,.1,100);const s=Pa();Ia(s);const r=Pa();!function(e,t,i,s){var r,o,a,n,l,d,h,c,u,p,f=t[0],m=t[1],g=t[2],y=s[0],A=s[1],b=s[2],v=i[0],_=i[1],w=i[2];Math.abs(f-v)Mo(e)));this.configList=i,this._updateDom()}_resizeDomForVideo(){const e=this.player.width,t=this.player.height,i=this.player.getVideoInfo();if(!(i&&i.height>0&&i.width>0))return;let s=i.width,r=i.height;const o=this.player._opt;let a=t,n=e;if(this.player.isControlBarShow()){const e=o.playType===w?Xt:Qt;po()&&this.player.fullscreen&&o.useWebFullScreen?n-=e:a-=e}const l=o.rotate;let d=(n-s)/2,h=(a-r)/2;270!==l&&90!==l||(s=i.height,r=i.width);const c=n/s,u=a/r;let p=c>u?u:c;o.isResize||c!==u&&(p=c+","+u),o.isFullResize&&(p=c>u?c:u);let f="scale("+p+")";"none"===o.mirrorRotate&&l&&(f+=" rotate("+l+"deg)"),"level"===o.mirrorRotate?f+=" rotateY(180deg)":"vertical"===o.mirrorRotate&&(f+=" rotateX(180deg)"),this.scale=-1!==(""+p).indexOf(",")?c:p,this.shadowRootInnerDom.style.transform=f,this.shadowRootInnerDom.style.left=d+"px",this.shadowRootInnerDom.style.top=h+"px",this.shadowRootInnerDom.style.width=i.width+"px",this.shadowRootInnerDom.style.height=i.height+"px",this.shadowRootInnerDom.style.display="block"}_resizeDomForCanvas(){const e=this.player.getVideoInfo();if(!(e&&e.height>0&&e.width>0))return;const t=this.player._opt;let i=this.player.width,s=this.player.height;if(this.player.isControlBarShow()){const e=t.playType===w?Xt:Qt;po()&&this.player.fullscreen&&t.useWebFullScreen?i-=e:s-=e}let r=e.width,o=e.height;const a=t.rotate;let n=(i-r)/2,l=(s-o)/2;270!==a&&90!==a||(r=e.height,o=e.width);const d=i/r,h=s/o;let c=d>h?h:d;t.isResize||d!==h&&(c=d+","+h),t.isFullResize&&(c=d>h?d:h);let u="scale("+c+")";"none"===t.mirrorRotate&&a&&(u+=" rotate("+a+"deg)"),"level"===t.mirrorRotate?u+=" rotateY(180deg)":"vertical"===t.mirrorRotate&&(u+=" rotateX(180deg)"),this.shadowRootInnerDom.style.height=e.height+"px",this.shadowRootInnerDom.style.width=e.width+"px",this.shadowRootInnerDom.style.padding="0",this.shadowRootInnerDom.style.transform=u,this.shadowRootInnerDom.style.left=n+"px",this.shadowRootInnerDom.style.top=l+"px",this.shadowRootInnerDom.style.display="block"}_resizeDomRatio(){const e=this.player.getVideoInfo();if(!(e&&e.height>0&&e.width>0))return;const t=this.player._opt.aspectRatio.split(":").map(Number);let i=this.player.width,s=this.player.height;const r=this.player._opt;let o=0;this.player.isControlBarShow()&&(o=r.playType===w?Xt:Qt,s-=o);const a=e.width/e.height,n=t[0]/t[1];if(a>n){const t=n*e.height/e.width;this.shadowRootInnerDom.style.width=100*t+"%",this.shadowRootInnerDom.style.height=`calc(100% - ${o}px)`,this.shadowRootInnerDom.style.padding=`0 ${(i-i*t)/2}px`}else{const t=e.width/n/e.height;this.shadowRootInnerDom.style.width="100%",this.shadowRootInnerDom.style.height=`calc(${100*t}% - ${o}px)`,this.shadowRootInnerDom.style.padding=(s-s*t)/2+"px 0"}this.shadowRootInnerDom.style.display="block"}_updateDom(){this.shadowRoot&&this.configList.forEach((e=>{const t=document.createElement("div");let i=null;if(e.image&&e.image.src?(i=document.createElement("img"),i.style.height="100%",i.style.width="100%",i.style.objectFit="contain",i.src=e.image.src):e.text&&e.text.content?i=document.createTextNode(e.text.content):(e.rect&&e.rect.color&&e.rect.width||e.html||e.line&&e.line.x1&&e.line.y1&&e.line.x2&&e.line.y2||e.polygon&&e.polygon.list&&e.polygon.list.length>=3)&&(i=document.createElement("div")),i){if(t.appendChild(i),t.style.visibility="",t.style.position="absolute",t.style.display="block",t.style["-ms-user-select"]="none",t.style["-moz-user-select"]="none",t.style["-webkit-user-select"]="none",t.style["-o-user-select"]="none",t.style["user-select"]="none",t.style["-webkit-touch-callout"]="none",t.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",t.style["-webkit-text-size-adjust"]="none",t.style["-webkit-touch-callout"]="none",t.style.opacity=e.opacity,Bo(e.left)&&(ko(e.left)?t.style.left=e.left+"px":t.style.left=e.left),Bo(e.right)&&(ko(e.right)?t.style.right=e.right+"px":t.style.right=e.right),Bo(e.top)&&(ko(e.top)?t.style.top=e.top+"px":t.style.top=e.top),Bo(e.bottom)&&(ko(e.bottom)?t.style.bottom=e.bottom+"px":t.style.bottom=e.bottom),e.backgroundColor&&(t.style.backgroundColor=e.backgroundColor),t.style.overflow="hidden",t.style.zIndex="9999999",e.image&&e.image.src)t.style.width=e.image.width+"px",t.style.height=e.image.height+"px";else if(e.text&&e.text.content)t.style.fontSize=e.text.fontSize+"px",t.style.color=e.text.color,e.text.width&&(t.style.width=e.text.width+"px"),e.text.height&&(t.style.height=e.text.height+"px");else if(e.rect&&e.rect.color&&e.rect.width){if(t.style.width=e.rect.width+"px",t.style.height=e.rect.height+"px",t.style.borderWidth=e.rect.lineWidth+"px",t.style.borderStyle="solid",t.style.borderColor=e.rect.color,e.rect.fill){const i=document.createElement("div");i.style.position="absolute",i.style.width="100%",i.style.height="100%",i.style.backgroundColor=e.rect.fill,e.rect.fillOpacity&&(i.style.opacity=e.rect.fillOpacity),t.appendChild(i)}}else if(e.html)t.style.width="100%",t.style.height="100%",t.innerHTML=e.html;else if(e.line&&e.line.x1&&e.line.y1&&e.line.x2&&e.line.y2)this.settingLine(t,e.line);else if(e.polygon&&e.polygon.list&&e.polygon.list.length>=3){t.style.width="100%",t.style.height="100%";let i=e.polygon.list;const s=e.polygon.color,r=e.polygon.lineWidth;if(i=i.sort(((e,t)=>(e.index||0)-(t.index||0))),e.polygon.fill){const s=document.createElement("div");s.style.position="absolute",s.style.width="100%",s.style.height="100%";const r="polygon("+i.map((e=>`${e.x}px ${e.y}px`)).join(", ")+")";s.style.clipPath=r,s.style.backgroundColor=e.polygon.fill,e.polygon.fillOpacity&&(s.style.opacity=e.polygon.fillOpacity),t.appendChild(s)}i.forEach(((e,o)=>{const a=document.createElement("div");if(o===i.length-1){const o=i[0],n={x1:e.x,y1:e.y,x2:o.x,y2:o.y,color:s,lineWidth:r};return this.settingLine(a,n),void t.appendChild(a)}const n=i[o+1],l={x1:e.x,y1:e.y,x2:n.x,y2:n.y,color:s,lineWidth:r};this.settingLine(a,l),t.appendChild(a)}))}this.isDynamic&&(this.shadowRootDynamicDom=t),this.shadowRootInnerDom.appendChild(t)}}))}settingLine(e,t){const i=t.x1,s=t.y1,r=t.x2,o=t.y2;var a=Math.sqrt((i-r)**2+(s-o)**2),n=180*Math.atan2(o-s,r-i)/Math.PI;e.style.backgroundColor=t.color,e.style.width=a+"px",e.style.height=t.lineWidth+"px",e.style.position="absolute",e.style.top=s+"px",e.style.left=i+"px",e.style.transform="rotate("+n+"deg)",e.style.transformOrigin="0 0"}remove(){this._removeDom()}_removeDom(){this.shadowRootInnerDom&&(this.shadowRootInnerDom.innerHTML="")}}class za extends o{constructor(){super(),this.videoInfo={width:null,height:null,encType:null,encTypeCode:null},this.init=!1,this.prevAiFaceDetectTime=null,this.prevAiObjectDetectTime=null,this.prevOcclusionDetectTime=null,this.contentWatermark=null,this.aiContentWatermark=null,this.tempContentList=[],this.tempAiContentList=[],this.streamFps=0}destroy(){this.resetInit(),this.contentWatermark&&(this.contentWatermark.destroy(),this.contentWatermark=null),this.tempContentList=[],this.aiContentWatermark&&(this.aiContentWatermark.destroy(),this.aiContentWatermark=null),this.tempAiContentList=[],this.prevAiFaceDetectTime=null,this.prevAiObjectDetectTime=null,this.streamFps=0,this.off()}resetInit(){this.videoInfo={width:null,height:null,encType:null,encTypeCode:null},this.init=!1}getHasInit(){return this.init}updateVideoInfo(e){Bo(e.encTypeCode)&&(this.videoInfo.encType=yt[e.encTypeCode],this.videoInfo.encTypeCode=e.encTypeCode),Bo(e.encType)&&(this.videoInfo.encType=e.encType),Bo(e.width)&&(this.videoInfo.width=e.width),Bo(e.height)&&(this.videoInfo.height=e.height),Bo(this.videoInfo.encType)&&Bo(this.videoInfo.height)&&Bo(this.videoInfo.width)&&!this.init&&(this.player.emit(at.videoInfo,this.videoInfo),this.init=!0)}getVideoInfo(){return this.videoInfo}clearView(){this.tempContentList=[],this.tempAiContentList=[]}resize(){if(this.player.debugLog("CommonVideo","resize()"),"default"===this.player._opt.aspectRatio||po()?this._resize():this._resizeRatio(),this.contentWatermark&&this.contentWatermark.resize(),this.aiContentWatermark&&this.aiContentWatermark.resize(),this.player.singleWatermark&&this.player.singleWatermark.resize(),this.player.ghostWatermark&&this.player.ghostWatermark.resize(),this.player.dynamicWatermark&&this.player.dynamicWatermark.resize(),this.player.zoom&&this.player.zooming){const e=this._getStyleScale();this.player.zoom.updatePrevVideoElementStyleScale(e),this.player.zoom.updateVideoElementScale()}}_resizeRatio(){this.player.debugLog("CommonVideo","_resizeRatio()");const e=this.player._opt.aspectRatio.split(":").map(Number);let t=this.player.width,i=this.player.height;const s=this.player._opt;let r=0;this.player.isControlBarShow()&&(r=s.playType===w?Xt:Qt,i-=r);const o=this.videoInfo,a=o.width/o.height,n=e[0]/e[1];if(this.getType()===H&&(this.$videoElement.style.left="0",this.$videoElement.style.top="0",this.$videoElement.style.transform="none"),this.getType()===J&&this.player._opt.videoRenderSupportScale&&(this.$videoElement.style.objectFit="fill"),a>n){const e=n*o.height/o.width;this.$videoElement.style.width=100*e+"%",this.$videoElement.style.height=`calc(100% - ${r}px)`,this.$videoElement.style.padding=`0 ${(t-t*e)/2}px`}else{const e=o.width/n/o.height;this.$videoElement.style.width="100%",this.$videoElement.style.height=`calc(${100*e}% - ${r}px)`,this.$videoElement.style.padding=(i-i*e)/2+"px 0"}}play(){}pause(){}setRate(e){}getType(){return""}getCanvasType(){return""}getCurrentTime(){return 0}getStreamFps(){return this.streamFps}isPlaying(){return!0}isVideoPlaying(){return this.isPlaying()}getPlaybackQuality(){return null}setStreamFps(e){this.player.debugLog("CommonVideo","setStreamFps",e),this.streamFps=e}addContentToCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.tempContentList=e}addAiContentToCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.tempAiContentList=e}doAddContentToWatermark(){if(this.tempContentList.length>0){this.contentWatermark||(this.contentWatermark=new Wa(this.player),this.contentWatermark.resize());const e=[];this.tempContentList.forEach((t=>{let i={left:t.x||0,top:t.y||0};"text"===t.type?i.text={content:t.text,fontSize:t.fontSize||"14",color:t.color||"#000"}:"rect"===t.type?i.rect={width:t.width,height:t.height,color:t.color||"green",lineWidth:t.lineWidth||2,fill:t.fill||"",fillOpacity:t.fillOpacity||.2}:"polygon"===t.type?i.polygon={list:t.list,color:t.color||"green",lineWidth:t.lineWidth||2,fill:t.fill,fillOpacity:t.fillOpacity||.2}:"line"===t.type&&(i.line={color:t.color||"green",lineWidth:t.lineWidth||2,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}),e.push(i)})),this.contentWatermark.update(e)}else this.contentWatermark&&this.contentWatermark.remove()}doAddAiContentToWatermark(){if(this.tempAiContentList.length>0){this.aiContentWatermark||(this.aiContentWatermark=new Wa(this.player),this.aiContentWatermark.resize());const e=this.tempAiContentList.map((e=>{let t={left:e.x,top:e.y};return"text"===e.type?t.text={content:e.text,fontSize:e.fontSize,color:e.color}:"rect"===e.type&&(t.rect={width:e.width,height:e.height,color:e.color,lineWidth:e.lineWidth}),t}));this.aiContentWatermark.update(e)}else this.aiContentWatermark&&this.aiContentWatermark.remove()}_getStyleScale(){let e=this.$videoElement.style.transform.match(/scale\([0-9., ]*\)/g),t="";if(e&&e[0]){t=e[0].replace("scale(","").replace(")","").split(",")}return t}getReadyStateInited(){return!0}screenshotByCurrentWatermark(){}initCanvasViewSize(){}bindMediaStream(){}}var $a="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0;function Va(e,t,i){var s=new XMLHttpRequest;s.open("GET",e),s.responseType="blob",s.onload=function(){Ka(s.response,t,i)},s.onerror=function(){console.error("could not download file")},s.send()}function Ha(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return t.status>=200&&t.status<=299}function Ja(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(i){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var qa=$a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),Ka="object"!=typeof window||window!==$a?function(){}:"download"in HTMLAnchorElement.prototype&&!qa?function(e,t,i){var s=$a.URL||$a.webkitURL,r=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",r.download=t,r.rel="noopener","string"==typeof e?(r.href=e,r.origin!==location.origin?Ha(r.href)?Va(e,t,i):Ja(r,r.target="_blank"):Ja(r)):(r.href=s.createObjectURL(e),setTimeout((function(){s.revokeObjectURL(r.href)}),4e4),setTimeout((function(){Ja(r)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download","string"==typeof e)if(Ha(e))Va(e,t,i);else{var s=document.createElement("a");s.href=e,s.target="_blank",setTimeout((function(){Ja(s)}))}else navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e}(e,i),t)}:function(e,t,i,s){if((s=s||open("","_blank"))&&(s.document.title=s.document.body.innerText="downloading..."),"string"==typeof e)return Va(e,t,i);var r="application/octet-stream"===e.type,o=/constructor/i.test($a.HTMLElement)||$a.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent);if((a||r&&o||qa)&&"undefined"!=typeof FileReader){var n=new FileReader;n.onloadend=function(){var e=n.result;e=a?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),s?s.location.href=e:location=e,s=null},n.readAsDataURL(e)}else{var l=$a.URL||$a.webkitURL,d=l.createObjectURL(e);s?s.location=d:location.href=d,s=null,setTimeout((function(){l.revokeObjectURL(d)}),4e4)}};function Ya(e){return new Promise(((t,i)=>{navigator.gpu?navigator.gpu.requestAdapter().then((s=>{s?s.requestDevice().then((r=>{if(r){const o=e.getContext("webgpu");if(o){const e=navigator.gpu.getPreferredCanvasFormat();o.configure({device:r,format:e,alphaMode:"opaque"}),t({adapter:s,device:r,context:o,format:e})}else i('WebGPU "context" create fail')}else i('WebGPU "device" request fail')})).catch((e=>{i('WebGPU "adapter.requestDevice()" fail')})):i('WebGPU "adapter" request fail is empty')})).catch((e=>{i('WebGPU "navigator.gpu.requestAdapter()" fail')})):i("WebGPU not support!!")}))}class Qa{constructor(e,t){this.canvas=e,this.gl=t;const i=t.createShader(t.VERTEX_SHADER);if(t.shaderSource(i,"\n attribute vec2 xy;\n varying highp vec2 uv;\n void main(void) {\n gl_Position = vec4(xy, 0.0, 1.0);\n // Map vertex coordinates (-1 to +1) to UV coordinates (0 to 1).\n // UV coordinates are Y-flipped relative to vertex coordinates.\n uv = vec2((1.0 + xy.x) / 2.0, (1.0 - xy.y) / 2.0);\n }\n "),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS))throw t.getShaderInfoLog(i);const s=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(s,"\n varying highp vec2 uv;\n uniform sampler2D texture;\n void main(void) {\n gl_FragColor = texture2D(texture, uv);\n }\n "),t.compileShader(s),!t.getShaderParameter(s,t.COMPILE_STATUS))throw t.getShaderInfoLog(s);const r=t.createProgram();if(t.attachShader(r,i),t.attachShader(r,s),t.linkProgram(r),!t.getProgramParameter(r,t.LINK_STATUS))throw t.getProgramInfoLog(r);t.useProgram(r);const o=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),t.STATIC_DRAW);const a=t.getAttribLocation(r,"xy");t.vertexAttribPointer(a,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(a);const n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this.program=r,this.buffer=o,this.vertexShader=i,this.fragmentShader=s,this.texture=n}destroy(){this.gl.deleteProgram(this.program),this.gl.deleteBuffer(this.buffer),this.gl.deleteTexture(this.texture),this.gl.deleteShader(this.vertexShader),this.gl.deleteShader(this.fragmentShader),this.program=null,this.buffer=null,this.vertexShader=null,this.fragmentShader=null,this.texture=null}render(e){this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight;const t=this.gl;t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight),t.clearColor(1,0,0,1),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4)}}class Xa extends za{constructor(e){super(),this.player=e;const t=document.createElement("canvas");t.style.position="absolute",t.style.top=0,t.style.left=0,this.$videoElement=t,e.$container.appendChild(this.$videoElement),this.context2D=null,this.contextGl=null,this.webglRender=null,this.webglRectRender=null,this.webGPURender=null,this.isWebglContextLost=!1,this.isWcsWebgl2=!1,this.isWcsWebgpu=!1,this.bitmaprenderer=null,this.renderType=null,this.controlHeight=0,this.proxyDestroyList=[],this._initCanvasRender()}destroy(){super.destroy(),this.proxyDestroyList.length>0&&(this.proxyDestroyList.forEach((e=>{e&&e()})),this.proxyDestroyList=[]),this.contextGl&&(this.contextGl=null),this.context2D&&(this.context2D=null),this.webglRender&&(this.webglRender.destroy(),this.webglRender=null),this.webglRectRender&&(this.webglRectRender.destroy(),this.webglRectRender=null),this.webGPURender&&(this.webGPURender.destroy(),this.webGPURender=null),this.bitmaprenderer&&(this.bitmaprenderer=null),this.renderType=null,this.isWebglContextLost=!1,this.isWcsWebgpu=!1,this.isWcsWebgl2=!1,this.videoInfo={width:"",height:"",encType:""},this.player.$container.removeChild(this.$videoElement),this.init=!1,this.off()}_initContext2D(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.context2D=this.$videoElement.getContext("2d",e)}_initContextGl(){if(this.player.events,this.contextGl=to(this.$videoElement),!this.contextGl)throw this.player.debugError("CommonCanvasLoader","_initContextGl() createContextGL error"),new Error("CommonCanvasLoader and _initContextGl createContextGL error");this._bindContextGlEvents(),this.webglRender=new Ua(this.contextGl,this.player._opt.openWebglAlignment)}_initContextGl2(){if(this.contextGl=io(this.$videoElement),this.contextGl){this._bindContextGlEvents(2);try{this.webglRender=new Qa(this.$videoElement,this.contextGl)}catch(e){this.player.debugError("CommonCanvasLoader",`create webgl2Render error is ${e} and next use context2d.draw render`),this.contextGl=null,this.webglRender=null,this._initContext2D()}}else this.player.debugError("CommonCanvasLoader","_initContextGl2() createContextGL2 error")}_bindContextGlEvents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;const{proxy:t}=this.player.events,i=t(this.$videoElement,"webglcontextlost",(t=>{t.preventDefault(),this.player.debugError("canvasVideo","webglcontextlost error",t),this.isWebglContextLost=!0,this.webglRender&&(this.player.debugLog("CommonCanvasLoader","webglcontextlost error and destroy webglRender"),this.webglRender.destroy(),this.webglRender=null),this.webglRectRender&&(this.player.debugLog("CommonCanvasLoader","webglcontextlost error and destroy webglRectRender"),this.webglRectRender.destroy(),this.webglRectRender=null),this.contextGl=null,setTimeout((()=>{if(this.player.debugLog("CommonCanvasLoader",`createContextGL() version ${e}`),1===e?this.contextGl=to(this.$videoElement):2===e&&(this.contextGl=io(this.$videoElement)),this.player.debugLog("CommonCanvasLoader","createContextGL success"),this.contextGl&&this.contextGl.getContextAttributes){const t=this.contextGl.getContextAttributes();t&&t.stencil?(1===e?this.webglRender=new Ua(this.contextGl,this.player._opt.openWebglAlignment):2===e&&(this.webglRender=new Qa(this.$videoElement,this.contextGl)),this.isWebglContextLost=!1,this.player.debugLog("CommonCanvasLoader","webglcontextlost error reset and getContextAttributes().stencil is true")):(this.player.debugError("CommonCanvasLoader","webglcontextlost error, getContextAttributes().stencil is false"),this.player.emitError(dt.webglContextLostError))}else this.player.debugError("CommonCanvasLoader","webglcontextlost error, getContextAttributes().stencil is false"),this.player.emitError(dt.webglContextLostError)}),500)})),s=t(this.$videoElement,"webglcontextrestored",(e=>{e.preventDefault(),this.player.debugLog("CommonCanvasLoader","webglcontextrestored ",e)}));this.proxyDestroyList.push(i,s)}_initContextGPU(){Ya(this.$videoElement).then((e=>{this.player.isDestroyedOrClosed()||(e?(this.webGPURender=new Ga(e),this.player.debugLog("CommonCanvasLoader","webGPURender init success")):(this.player.debugWarn("CommonCanvasLoader","webGPURender init failed because context is null and next use webgl render"),this.renderType=si,this._initContextGl()))})).catch((e=>{this.player.isDestroyedOrClosed()||(this.player.debugWarn("CommonCanvasLoader",`createWebGPUContext error is ${e} and next use webgl render`),this.renderType=si,this._initContextGl())}))}initCanvasViewSize(){this.$videoElement.width=this.videoInfo.width,this.$videoElement.height=this.videoInfo.height,this.resize()}screenshot(e,t,i,s){e=e||ro(),s=s||ft.download;let r=.92;!Vi[t]&&ft[t]&&(s=t,t="png",i=void 0),"string"==typeof i&&(s=i,i=void 0),void 0!==i&&(r=Number(i));const o=Vi[t]||Vi.png,a=this.$videoElement.toDataURL(o,r);if(s===ft.base64)return a;{const t=so(a);if(s===ft.blob)return t;if(s===ft.download){const i=o.split("/")[1];Ka(t,e+"."+i)}}}screenshotWatermark(e){return new Promise(((t,i)=>{qo(e)&&(e={filename:e}),(e=e||{}).width=this.videoInfo.width,e.height=this.videoInfo.height,e.filename=e.filename||ro(),e.format=e.format?Vi[e.format]:Vi.png,e.quality=Number(e.quality)||.92,e.type=e.type||ft.download;const s=this.$videoElement.toDataURL(e.format,e.quality);Uo(s,e).then((i=>{if(e.type===ft.base64)t(s);else{const s=so(i);if(e.type===ft.blob)t(s);else if(e.type===ft.download){t();const i=e.format.split("/")[1];Ka(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}))}screenshotCopyrightWatermark(e){return new Promise(((t,i)=>{if(qo(e)){(e=(e={filename:e})||{}).width=this.videoInfo.width,e.height=this.videoInfo.height,e.filename=e.filename||ro(),e.format=e.format?Vi[e.format]:Vi.png,e.quality=Number(e.quality)||.92,e.type=e.type||ft.download;const s=this.$videoElement.toDataURL(e.format,e.quality);No(s,e).then((i=>{if(e.type===ft.base64)t(s);else{const s=so(i);if(e.type===ft.blob)t(s);else if(e.type===ft.download){t();const i=e.format.split("/")[1];Ka(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}}))}screenshotByCurrentWatermark(e){}render(){}clearView(){super.clearView()}play(){}pause(){}_resize(){this.player.debugLog("canvasVideo","_resize()");const e=this.player._opt;let t=this.player.width,i=this.player.height;if(this.player.isControlBarShow()){const s=this.controlHeight;po()&&this.player.fullscreen&&e.useWebFullScreen?t-=s:i-=s}let s=this.$videoElement.width,r=this.$videoElement.height;const o=e.rotate;let a=(t-s)/2,n=(i-r)/2;270!==o&&90!==o||(s=this.$videoElement.height,r=this.$videoElement.width);const l=t/s,d=i/r;let h=l>d?d:l;ya(e.isResize)&&l!==d&&(h=l+","+d),e.isFullResize&&(h=l>d?l:d);let c="scale("+h+")";"none"===e.mirrorRotate&&o&&(c+=" rotate("+o+"deg)"),"level"===e.mirrorRotate?c+=" rotateY(180deg)":"vertical"===e.mirrorRotate&&(c+=" rotateX(180deg)"),this.$videoElement.style.height=this.videoInfo.height+"px",this.$videoElement.style.width=this.videoInfo.width+"px",this.$videoElement.style.padding="0",this.$videoElement.style.transform=c,this.$videoElement.style.left=a+"px",this.$videoElement.style.top=n+"px"}initFps(){}setStreamFps(e){}getStreamFps(){return 25}getType(){return H}getCanvasType(){let e=this.renderType===oi?oi:si;return this.isWcsWebgl2?e=ri:this.isWcsWebgpu&&(e=oi),e}}class Za extends Xa{constructor(e){super(e),this.TAG_NAME="CanvasVideo",this.yuvList=[],this.controlHeight=Qt,this.tempTextCanvas=null,this.tempTextCanvasCtx=null,this.player.debugLog("CanvasVideo","init")}async destroy(){super.destroy(),this.yuvList=[],this.tempTextCanvas&&(this.tempTextCanvasCtx.clearRect(0,0,this.tempTextCanvas.width,this.tempTextCanvas.height),this.tempTextCanvas.width=0,this.tempTextCanvas.height=0,this.tempTextCanvas=null),this.player.debugLog("CanvasVideoLoader","destroy")}_initCanvasRender(){this.player._opt.useWCS&&!this._supportOffscreen()?(this.renderType=ii,this.player._opt.useWebGPU?Ya(this.$videoElement).then((e=>{this.player.isDestroyedOrClosed()||(e?(this.webGPURender=new Ga(e),this.isWcsWebgpu=!0,this.player.debugLog(this.TAG_NAME,"webGPURender init success")):(this.player.debugWarn(this.TAG_NAME,"webGPURender init failed because context is null and next use webgl render"),this._initWebglRenderForWCS()))})).catch((()=>{this.player.isDestroyedOrClosed()||(this.player.debugWarn(this.TAG_NAME,`createWebGPUContext error is ${e} and next use webgl render`),this._initWebglRenderForWCS())})):this._initWebglRenderForWCS()):this.player._opt.useMSE&&this.player._opt.mseUseCanvasRender?(this.renderType=ni,this._initContext2D()):this.player.isOldHls()&&this.player._opt.useCanvasRender?(this.renderType=li,this._initContext2D()):this.player.isWebrtcH264()&&this.player._opt.webrtcUseCanvasRender?(this.renderType=di,this._initContext2D()):this._supportOffscreen()?(this.renderType=ai,this._bindOffscreen()):this.player._opt.useWebGPU?(this.renderType=oi,this._initContextGPU()):(this.renderType=si,this._initContextGl())}_initWebglRenderForWCS(){this.player._opt.wcsUseWebgl2Render&&Sa()?(this._initContextGl2(),this.webglRender&&(this.isWcsWebgl2=!0)):this._initContext2D()}_supportOffscreen(){return"function"==typeof this.$videoElement.transferControlToOffscreen&&this.player._opt.useOffscreen}_bindOffscreen(){this.bitmaprenderer=this.$videoElement.getContext("bitmaprenderer")}render(e){this.yuvList.push(e),this.startRender()}startRender(){for(;!(this.yuvList.length<=0);){const e=this.yuvList.shift();this.doRender(e)}}doRender(e){if(this.renderType!==ni){const t={ts:e.ts||0,fps:!0};this.player.updateStats(t)}switch(this.renderType){case ai:this.bitmaprenderer.transferFromImageBitmap(e.buffer);break;case si:case oi:if(this.isWebglContextLost)return void this.player.debugWarn("CanvasVideoLoader","doRender() and webgl context is lost");let t=e.output;if(this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector){null===this.prevAiFaceDetectTime&&(this.prevAiFaceDetectTime=ro());const i=ro();i-this.prevAiFaceDetectTime>=this.player._opt.aiFaceDetectInterval&&(t=this.player.ai.faceDetector.detect({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output,ts:e.ts||0}),this.prevAiFaceDetectTime=i)}if(this.player.objectDetectActive&&this.player.ai&&this.player.ai.objectDetector){null===this.prevAiObjectDetectTime&&(this.prevAiObjectDetectTime=ro());const i=ro();i-this.prevAiObjectDetectTime>=this.player._opt.aiObjectDetectInterval&&(t=this.player.ai.objectDetector.detect({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output,ts:e.ts||0}),this.prevAiObjectDetectTime=i)}if(this.player.occlusionDetectActive&&this.player.ai&&this.player.ai.occlusionDetector){null===this.prevAiOcclusionDetectTime&&(this.prevAiOcclusionDetectTime=ro());const t=ro();if(t-this.prevAiOcclusionDetectTime>=this.player._opt.aiOcclusionDetectInterval){const i=this.player.ai.occlusionDetector.check({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output});this.prevAiOcclusionDetectTime=t,i&&this.player.emit(at.aiOcclusionDetectResult,{ts:e.ts||0})}}if(this.player.imageDetectActive&&this.player.ai&&this.player.ai.imageDetector){const t=this.player.ai.imageDetector.check({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output});if(t&&t.data&&(this.player.emit(at.aiImageDetectResult,{type:t.type,ts:e.ts||0}),this.player._opt.aiImageDetectDrop))return void this.player.debugLog("CanvasVideoLoader",`doRender() and ai image detect result type is ${t.type} and drop`)}if(this.renderType===oi)try{if(!this.webGPURender)return void this.player.debugWarn("CanvasVideoLoader","doRender webgpu render is not init");this.webGPURender.renderYUV(this.$videoElement.width,this.$videoElement.height,t)}catch(e){this.player.debugError("CanvasVideoLoader",`doRender webgpu render and error: ${e.toString()}`)}else if(this.renderType===si)try{this.webglRender.renderYUV(this.$videoElement.width,this.$videoElement.height,t)}catch(e){this.player.debugError("CanvasVideoLoader",`doRender webgl render context is lost ${this.contextGl&&this.contextGl.isContextLost()} and error: ${e.toString()}`)}break;case ii:if(this.webGPURender)this.webGPURender.render(e.videoFrame),ra(e.videoFrame);else if(this.webglRender)this.webglRender.render(e.videoFrame),ra(e.videoFrame);else if(this.context2D)if(Zo(e.videoFrame.createImageBitmap))try{e.videoFrame.createImageBitmap().then((t=>{this.context2D.drawImage(t,0,0,this.$videoElement.width,this.$videoElement.height),ra(e.videoFrame)}))}catch(e){}else this.context2D.drawImage(e.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height),ra(e.videoFrame);else this.player.debugWarn("CanvasVideoLoader","doRender() and webcodecs context is lost");break;case ni:case li:case di:this.context2D.drawImage(e.$video,0,0,this.$videoElement.width,this.$videoElement.height)}let t=e.ts||0;this.renderType===ni&&(t=parseInt(1e3*e.$video.currentTime,10)+(this.player.mseDecoder.firstRenderTime||0)),this.player.updateCurrentPts(t),this.doAddContentToWatermark(),this.doAddAiContentToWatermark()}clearView(){switch(super.clearView(),this.renderType){case ai:(function(e,t){const i=document.createElement("canvas");i.width=e,i.height=t;const s=window.createImageBitmap(i,0,0,e,t);return i.width=0,i.height=0,s})(this.$videoElement.width,this.$videoElement.height).then((e=>{this.bitmaprenderer.transferFromImageBitmap(e)}));break;case si:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case oi:this.webGPURender.clear();break;case ii:this.webGPURender?this.webGPURender.clear():this.contextGl?this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT):this.context2D&&this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height);break;case ni:case li:case di:this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height)}}_initTempTextCanvas(){this.tempTextCanvas=document.createElement("canvas"),this.tempTextCanvasCtx=this.tempTextCanvas.getContext("2d"),this.tempTextCanvas.width=600,this.tempTextCanvas.height=20}doAddContentToCanvas(){this.tempContentList.length>0&&this.context2D&&function(e){let{ctx:t,list:i}=e;t.save(),(i||[]).forEach((e=>{"text"===e.type?(t.font=`${e.fontSize||12}px Arial`,t.fillStyle=e.color||"green",t.fillText(e.text,e.x,e.y)):"rect"===e.type&&(t.strokeStyle=e.color||"green",t.lineWidth=e.lineWidth||2,t.strokeRect(e.x,e.y,e.width,e.height))})),t.restore()}({ctx:this.context2D,list:this.tempContentList})}doAddContentToWebGlCanvas(){this.tempContentList.length>0&&this.contextGl&&this.webglRectRender&&this.tempContentList.forEach((e=>{const t=e.x,i=e.y;if("rect"===e.type){const r=e.width,o=e.height,a=(s=e.color||"#008000",[parseInt(s.substring(1,3),16)/255,parseInt(s.substring(3,5),16)/255,parseInt(s.substring(5,7),16)/255,1]),n=e.lineWidth||4;if(!r||!o)return;this.webglRectRender.drawBox({x:t,y:i,width:r,height:o,lineColor:a,lineWidth:n,canvasWidth:this.$videoElement.width,canvasHeight:this.$videoElement.height})}else if("text"===e.type){const s=e.text||"";if(!s)return;const r=e.fontSize||20,o=e.color||"#008000";this.tempTextCanvas||this._initTempTextCanvas(),this.tempTextCanvasCtx.clearRect(0,0,this.tempTextCanvas.width,this.tempTextCanvas.height),this.tempTextCanvasCtx.font=`${r}px Arial`,this.tempTextCanvasCtx.fillStyle=o,this.tempTextCanvasCtx.textBaseline="top",this.tempTextCanvasCtx.fillText(s,0,0),this.webglRender.drawDom(this.$videoElement.width,this.$videoElement.height,t,i,this.tempTextCanvas)}var s}))}}class en extends za{constructor(e){super(),this.player=e,this.TAG_NAME="Video";const t=document.createElement("video");t.muted=!0,t.disablePictureInPicture=!0,mo()&&(t.poster="noposter"),t.style.position="absolute",t.style.top=0,t.style.left=0,this._delayPlay=!1,e.$container.appendChild(t),this.$videoElement=t,this.$canvasElement=null,this.canvasContext=null,this.mediaStream=null,this.vwriter=null,this.awriter=null,this.trackGenerator=null,this.audioTrackGenerator=null,this.fixChromeVideoFlashBug(),this.fixMobileAutoFullscreen(),this.resize(),this.eventListenList=[],this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes=0,this.isRetryPlaying=!1,this.isRetryPlayingTimes=0,this.canplayReceived=!1,this.progressProxyDestroy=null,this.checkVideoCanplayTimeout=null,this.visibilityChangePlayTimeout=null,this.pauseDelayTimeout=null,this.replayTimeout=null,this.detectAndFixStuckPlaybackStartTime=null;const i=Ta();this.supportVideoFrameCallbackHandle=null;const{proxy:s}=this.player.events,r=s(this.$videoElement,"canplay",(()=>{this.player.debugLog("Video","canplay"),this.player.isDestroyedOrClosed()||(this.canplayReceived=!0,this._delayPlay?(this.clearCheckVideoCanplayTimeout(),this._play(),Ta()?this.supportVideoFrameCallbackHandle||(this.player.debugLog("Video","support requestVideoFrameCallback and use videoFrameCallback"),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))):this.player.debugWarn("Video","not support requestVideoFrameCallback and use timeupdate event to update stats")):this.$videoElement.paused&&(this.player.isMSEPlaybackRateChangePause?(this.player.debugLog("Video",`canplay and video is paused and isMSEPlaybackRateChangePause is ${this.player.isMSEPlaybackRateChangePause} so next try to play`),this.player.isMSEPlaybackRateChangePause=!1,this._play()):this.player.isMSECurrentMoreThanBufferedPause?(this.player.debugLog("Video",`canplay and video is paused and isMSECurrentMoreThanBufferedPause is ${this.player.isMSECurrentMoreThanBufferedPause} so next try to play`),this.player.isMSECurrentMoreThanBufferedPause=!1,this._play()):(this.player.debugWarn("Video","canplay and video is paused and try to play"),this._play())))})),o=s(this.$videoElement,"waiting",(()=>{this.player.debugLog("Video","waiting")})),a=s(this.$videoElement,"loadedmetadata",(()=>{this.player.debugLog("Video","loadedmetadata")})),n=s(this.$videoElement,"timeupdate",(t=>{if(!this.player.isDestroyedOrClosed()){if(ya(i)){const t=parseInt(1e3*this.getCurrentTime(),10);if(e.isWebrtcH264()||this.player.isOldHls()||this.player.isAliyunRtc())this.player.emit(at.timeUpdate,t),e.handleRender(),e.updateStats({fps:!0,ts:t,dts:t}),this.player.updateCurrentPts(t);else if(ga(this.player._opt.useMSE)&&ya(this.player._opt.mseUseCanvasRender))if(this.player.mseDecoder){let e=parseInt(1e3*this.getCurrentTime(),10)+(this.player.mseDecoder.firstRenderTime||0);this.player.updateCurrentPts(e)}else if(this.player._opt.mseDecoderUseWorker){let e=parseInt(1e3*this.getCurrentTime(),10)+(this.player._mseWorkerData.firstRenderTime||0);this.player.updateCurrentPts(e)}this.doAddContentToWatermark()}this.player.isMseDecoderUseWorker()&&(this.player.decoderWorker.updateVideoTimestamp(this.getCurrentTime()),this._handleUpdatePlaybackRate())}})),l=s(this.$videoElement,"error",(e=>{if(!this.$videoElement.error)return void this.player.debugError(this.TAG_NAME,"on error",e);let t={};if(this.player.isUseMSE()&&(t=this.player.getMseMineType()),this.player.debugError("Video","Error Code "+this.$videoElement.error.code+" "+tr[this.$videoElement.error.code]+"; Details: "+this.$videoElement.error.message+"; Video Info: "+JSON.stringify(this.videoInfo)+"; Mse Mine Type: "+t.video+"; "),this.player.isUseMSE()){this.$videoElement.error.code;const e=this.$videoElement.error.message;-1!==e.indexOf(ir)&&(this.player.isMSEVideoDecoderInitializationFailedNotSupportHevc=!0),-1!==e.indexOf(sr)&&(this.player.isMSEAudioDecoderError=!0)}this.player.isHlsCanVideoPlay()})),d=s(this.$videoElement,"stalled",(()=>{this._detectAndFixStuckPlayback(!0)}));if(this.progressProxyDestroy=s(this.$videoElement,"progress",(()=>{this._detectAndFixStuckPlayback()})),this.eventListenList.push(r,o,n,l,a,d),this.player.isUseMSE()){const e=s(this.$videoElement,ts,(()=>{this.player.debugLog(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate),this.$videoElement&&this.$videoElement.paused&&(this.player.debugWarn(this.TAG_NAME,"ratechange and video is paused and sent isMSEPlaybackRateChangePause true"),this.player.isMSEPlaybackRateChangePause=!0)}));this.eventListenList.push(e),this.player.on(at.visibilityChange,(e=>{e&&(this.visibilityChangePlayTimeout=setTimeout((()=>{if(this.clearVisibilityChangePlayTimeout(),this.player.isPlaying()&&this.$videoElement){const e=this.getVideoBufferLastTime();e-this.$videoElement.currentTime>this.getBufferMaxDelayTime()&&(this.player.debugLog(this.TAG_NAME,`visibilityChange is true and lastTime is ${e} and currentTime is ${this.$videoElement.currentTime} so set currentTime to lastTime`),this.$videoElement.currentTime=e)}}),300))}))}this.player.debugLog("Video","init")}async destroy(){if(super.destroy(),this.clearCheckVideoCanplayTimeout(),this.clearReplayTimeout(),this.clearVisibilityChangePlayTimeout(),this.clearPauseDelayTimeout(),this._cancelVideoFrameCallback(),this._removeProgressProxyDestroy(),this.eventListenList.length&&(this.eventListenList.forEach((e=>{e()})),this.eventListenList=[]),this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes=0,this.isRetryPlaying=!1,this.isRetryPlayingTimes=0,this.canplayReceived=!1,this.player._opt.videoRenderSupportScale&&this._isNeedAddBackDropFilter()){const e=this.player.$container;e.style.backdropFilter="none",e.style.transform="none"}if(this.$canvasElement&&(this.$canvasElement.height=0,this.$canvasElement.width=0,this.$canvasElement=null),this.canvasContext=null,this.$videoElement){this.$videoElement.pause&&(this.$videoElement.pause(),this.$videoElement.muted=!0),this.$videoElement.currentTime=0,this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")),this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"));try{this.$videoElement.load()}catch(e){}this.player.$container.removeChild(this.$videoElement),this.$videoElement=null}this.trackGenerator&&(this.trackGenerator.stop(),this.trackGenerator=null),this.audioTrackGenerator&&(this.audioTrackGenerator.stop(),this.audioTrackGenerator=null),this.vwriter&&(await this.vwriter.close(),this.vwriter=null),this.awriter&&(await this.awriter.close(),this.awriter=null),this._delayPlay=!1,this.mediaStream&&(this.mediaStream.getTracks().forEach((e=>e.stop())),this.mediaStream=null),this.off(),this.player.debugLog("Video","destroy")}_createScreenShotCanvas(){const e=document.createElement("canvas");this.$canvasElement=e,this.canvasContext=e.getContext("2d"),this.canvasContext.imageSmoothingEnabled=!0,this.canvasContext.imageSmoothingEnabled&&(this.canvasContext.imageSmoothingQuality="high")}bindMediaStream(){if(this.player.canVideoTrackWritter()&&xo()&&Do()&&!this.mediaStream){this.player.debugLog(this.TAG_NAME,"bindMediaStream"),this.trackGenerator=new MediaStreamTrackGenerator({kind:"video"}),this.player.useVideoPlayAudio()&&(this.audioTrackGenerator=new MediaStreamTrackGenerator({kind:"audio"}),this.awriter=this.audioTrackGenerator.writable.getWriter());const e=[this.trackGenerator];this.audioTrackGenerator&&e.push(this.audioTrackGenerator),this.mediaStream=new MediaStream(e),this.$videoElement.srcObject=this.mediaStream,this.vwriter=this.trackGenerator.writable.getWriter()}}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())return void this.player.debugLog("Video","videoFrameCallback() and isDestroyedOrClosed and return");this.player.handleRender();const i=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)||0;if(this.player.isUseHls265UseMse())this.player.updateStats({fps:!0,ts:i});else if(this.player.isMseDecoderUseWorker()){this.player._times.videoStart||(this.player._times.videoStart=ro(),this.player.handlePlayToRenderTimes());const e=i+(this.player._mseWorkerData.firstRenderTime||0);if(this.player.updateStats({fps:!0,dfps:!0,ts:e,mseTs:i}),this.player.emit(at.timeUpdate,e),ya(this.getHasInit())&&t.width&&t.height){const e={width:t.width,height:t.height};this.updateVideoInfo(e),this.initCanvasViewSize()}}if(this.player.isWebrtcH264()||this.player.isOldHls()||this.player.isAliyunRtc()){if(this.player.emit(at.timeUpdate,i),ya(this.getHasInit())&&t.width&&t.height){const e={width:t.width,height:t.height};this.videoInfo.encTypeCode||this.player.isOldHls()||(e.encTypeCode=At),this.updateVideoInfo(e)}this.player.updateStats({fps:!0,ts:i,dts:i}),this.player.updateCurrentPts(i),this.doAddContentToWatermark()}else if(ga(this.player._opt.useMSE)&&ya(this.player._opt.mseUseCanvasRender)){if(this.player.mseDecoder){let e=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)+(this.player.mseDecoder.firstRenderTime||0);this.player.updateCurrentPts(e)}else if(this.player._opt.mseDecoderUseWorker){let e=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)+(this.player._mseWorkerData.firstRenderTime||0);this.player.updateCurrentPts(e)}this.doAddContentToWatermark()}this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}fixChromeVideoFlashBug(){if(this.player._opt.videoRenderSupportScale&&this._isNeedAddBackDropFilter()){const e=this.player.$container;e.style.backdropFilter="blur(0px)",e.style.transform="translateZ(0)"}}fixMobileAutoFullscreen(){const e=Ao(),t=mo();(e||t)&&(this.player.debugLog("Video",`fixMobileAutoFullscreen and isIOS ${e} and isAndroid ${t}`),this.$videoElement.setAttribute("webkit-playsinline","true"),this.$videoElement.setAttribute("playsinline","true"),this.$videoElement.setAttribute("x5-video-player-type","h5-page"))}_detectAndFixStuckPlayback(e){const t=this.$videoElement,i=t.buffered,s=t.readyState;if(this.player.debugLog(this.TAG_NAME,`_detectAndFixStuckPlayback() and isStalled is ${e} ,canplayReceived is ${this.canplayReceived} ,videoReadyState is ${s} and bufferedLength is ${i.length} and startTime is ${i.length>0?i.start(0):"null"} and currentTime is ${t.currentTime}`),e||ya(this.canplayReceived)||s<2){if(i.length>0&&t.currentTime=1e3*this.player._opt.mseWaitVideoCanplayTimeout&&(this.player.debugWarn(this.TAG_NAME,`_detectAndFixStuckPlayback() and video is stuck and currentTime is ${t.currentTime} , diff is ${e} and timeout`),this.player.emit(dt.mseWaitVideoCanplayTimeout,e))}}else this._removeProgressProxyDestroy()}_removeProgressProxyDestroy(){this.progressProxyDestroy&&(this.player.debugLog(this.TAG_NAME,"_removeProgressProxyDestroy()"),this.progressProxyDestroy(),this.progressProxyDestroy=null),this.detectAndFixStuckPlaybackStartTime=null}_isNeedAddBackDropFilter(){const e=yo().type.toLowerCase();return"chrome"===e||"edge"===e}isPaused(){let e=!0;return this.$videoElement&&(e=this.$videoElement.paused),e}isPause(){return this.isPaused()}_getVideoReadyState(){let e=0;return this.$videoElement&&(e=this.$videoElement.readyState),e}_getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}play(){if(this.$videoElement){const e=this._getVideoReadyState();if(this.player.debugLog("Video",`play and readyState: ${e}`),0===e)return this.player.debugLog("Video","readyState is 0 and set _delayPlay to true and listen canplay event to play"),this._delayPlay=!0,void(null===this.checkVideoCanplayTimeout&&(this.checkVideoCanplayTimeout=setTimeout((()=>{if(this.clearCheckVideoCanplayTimeout(),!this.player.isDestroyedOrClosed()&&ya(this.isPlaying())){const e=this._getBufferStore();this.player.debugWarn("Video",`checkVideoCanplayTimeout and video is not playing and buffer store is ${e} and retry play`),this.$videoElement.currentTime=e,this._replay()}}),1e3)));this._play()}}_play(){this.$videoElement&&this.$videoElement.play().then((()=>{this._delayPlay=!1,this.player.debugLog("Video","_play success"),this.isPlaying()?(this.player.emit(at.removeLoadingBgImage),this.isRetryPlayingTimes=0,this.isRetryPlaying=!1):this.replayTimeout=setTimeout((()=>{this.clearReplayTimeout(),this._replay()}),100)})).catch((e=>{this.player.isDestroyedOrClosed()?this.player.debugLog("Video","_play error and player is isDestroyedOrClosed and return"):(this.player.debugLog("Video",`_play error and\n e.name is ${e.name},\n e.message is ${e.message},\n e.toString() is ${e.toString()}`),this.player.debugError("Video","_play error",e),this.isRetryPlaying=!1,this.replayTimeout=setTimeout((()=>{this.clearReplayTimeout(),this._replay()}),100))}))}_replay(){if(!this.isPlaying()&&ya(this.player.isDestroyedOrClosed())&&ya(this.isRetryPlaying)){if(this.isRetryPlaying=!0,this.isRetryPlayingTimes>=3){let e="";return void(this.player.isWebrtcH264()?(e=`_replay(webrtc H264) then but not playing and retry play times is ${this.isRetryPlayingTimes} and emit error`,this.player.debugError("Video",e),this.player.emitError(dt.videoElementPlayingFailedForWebrtc,e)):(e=`_replay then but not playing and retry play times is ${this.isRetryPlayingTimes} and emit error to use canvas render`,this.player.debugError("Video",e),this.player.emitError(dt.videoElementPlayingFailed,e)))}this.player.debugWarn("Video",`_play then but not playing and retry play and isRetryPlayingTimes is ${this.isRetryPlayingTimes}`),this._play(),this.isRetryPlayingTimes++}else this.player.debugLog("Video",`_replay() and isPlaying is ${this.isPlaying()} and isRetryPlaying is ${this.isRetryPlaying} and isDestroyedOrClosed is ${this.player.isDestroyedOrClosed()} and return;`)}pause(e){this.player.debugLog(this.TAG_NAME,"pause and isNow is "+e),this.isPlaying()&&(e?(this.$videoElement&&this.$videoElement.pause(),this._cancelVideoFrameCallback()):this.pauseDelayTimeout=setTimeout((()=>{this.clearPauseDelayTimeout(),this.$videoElement&&this.$videoElement.pause(),this._cancelVideoFrameCallback()}),100))}clearView(){super.clearView(),this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")))}screenshot(e,t,i,s){if(!this._canScreenshot())return this.player.debugWarn("Video",`screenshot failed, video is not ready and stats is ${this._getVideoReadyState()}`),null;e=e||ro(),s=s||ft.download;let r=.92;!Vi[t]&&ft[t]&&(s=t,t="png",i=void 0),"string"==typeof i&&(s=i,i=void 0),void 0!==i&&(r=Number(i));const o=this.$videoElement;this.$canvasElement||this._createScreenShotCanvas();let a=this.$canvasElement;a.width=o.videoWidth,a.height=o.videoHeight,this.canvasContext.drawImage(o,0,0,a.width,a.height);const n=Vi[t]||Vi.png,l=a.toDataURL(n,r);if(this.canvasContext.clearRect(0,0,a.width,a.height),a.width=0,a.height=0,s===ft.base64)return l;{const t=so(l);if(s===ft.blob)return t;if(s===ft.download){const i=n.split("/")[1];Ka(t,e+"."+i)}}}screenshotWatermark(e){return new Promise(((t,i)=>{if(qo(e)&&(e={filename:e}),!this._canScreenshot())return this.player.debugWarn("Video","screenshot failed, video is not ready"),i("screenshot failed, video is not ready");const s=this.$videoElement;(e=e||{}).width=s.videoWidth,e.height=s.videoHeight,e.filename=e.filename||ro(),e.format=e.format?Vi[e.format]:Vi.png,e.quality=Number(e.quality)||.92,e.type=e.type||ft.download,this.$canvasElement||this._createScreenShotCanvas();let r=this.$canvasElement;r.width=s.videoWidth,r.height=s.videoHeight,this.canvasContext.drawImage(s,0,0,r.width,r.height);const o=r.toDataURL(e.format,e.quality);this.canvasContext.clearRect(0,0,r.width,r.height),r.width=0,r.height=0,Uo(o,e).then((i=>{if(e.type===ft.base64)t(o);else{const s=so(i);if(e.type===ft.blob)t(s);else if(e.type===ft.download){t();const i=e.format.split("/")[1];Ka(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}))}screenshotCopyrightWatermark(e){return new Promise(((t,i)=>{if(qo(e)&&(e={filename:e}),!this._canScreenshot())return this.player.debugWarn("Video","screenshot failed, video is not ready"),i("screenshot failed, video is not ready");const s=this.$videoElement;(e=e||{}).width=s.videoWidth,e.height=s.videoHeight,e.filename=e.filename||ro(),e.format=e.format?Vi[e.format]:Vi.png,e.quality=Number(e.quality)||.92,e.type=e.type||ft.download,this.$canvasElement||this._createScreenShotCanvas();let r=this.$canvasElement;r.width=s.videoWidth,r.height=s.videoHeight,this.canvasContext.drawImage(s,0,0,r.width,r.height);const o=r.toDataURL(e.format,e.quality);this.canvasContext.clearRect(0,0,r.width,r.height),r.width=0,r.height=0,No(o,e).then((i=>{if(e.type===ft.base64)t(o);else{const s=so(i);if(e.type===ft.blob)t(s);else if(e.type===ft.download){t();const i=e.format.split("/")[1];Ka(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}))}screenshotByCurrentWatermark(e){}initCanvasViewSize(){this.resize()}clear(){const e=this.$videoElement,t=e.buffered,i=t.length?t.end(t.length-1):0;e.currentTime=i}render(e){if(this.vwriter){if(this.$videoElement.srcObject||(this.$videoElement.srcObject=this.mediaStream),this.isPaused()){const e=this._getVideoReadyState();if(this.player.debugWarn("Video","render() error, video is paused and readyState is "+e),4===e&&ya(this.isRenderRetryPlaying)){if(this.isRenderRetryPlaying=!0,this.isRenderRetryPlayingTimes>3){const t="render() error, video is paused and readyState is "+e+", retry times is "+this.isRenderRetryPlayingTimes+", emit error and use canvas render";return this.player.debugError("Video",t),void this.player.emitError(dt.videoElementPlayingFailed,t)}this.$videoElement.play().then((()=>{this.isRenderRetryPlayingTimes=0,this.isRenderRetryPlaying=!1,this.player.debugLog("Video","render() video is paused and replay success")})).catch((e=>{this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes++,this.player.debugLog("Video",`_play error render() error, video is paused and replay error and\n e.name is ${e.name},\n e.message is ${e.message},\n e.toString() is ${e.toString()}`),this.player.debugError("Video","render() error, video is paused and replay error ",e)}))}}if(this.player.updateStats({fps:!0,ts:e.ts||0}),e.videoFrame)this.vwriter.write(e.videoFrame),ra(e.videoFrame);else if(e.output){let s=e.output;if(this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector){null===this.prevAiFaceDetectTime&&(this.prevAiFaceDetectTime=ro());const t=ro();t-this.prevAiFaceDetectTime>this.player._opt.aiFaceDetectInterval&&(s=this.player.ai.faceDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0}),this.prevAiFaceDetectTime=t)}if(this.player.objectDetectActive&&this.player.ai&&this.player.ai.objectDetector){null===this.prevAiObjectDetectTime&&(this.prevAiObjectDetectTime=ro());const t=ro();t-this.prevAiObjectDetectTime>this.player._opt.aiObjectDetectInterval&&(s=this.player.ai.objectDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0}),this.prevAiObjectDetectTime=t)}if(this.player.occlusionDetectActive&&this.player.ai&&this.player.ai.occlusionDetector){null===this.prevAiOcclusionDetectTime&&(this.prevAiOcclusionDetectTime=ro());const t=ro();if(t-this.prevAiOcclusionDetectTime>=this.player._opt.aiOcclusionDetectInterval){const i=this.player.ai.occlusionDetector.check({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0});this.prevAiOcclusionDetectTime=t,i&&(this.player.debugLog("Video","render() and ai occlusion detect result is true"),this.player.emit(at.aiOcclusionDetectResult,{ts:e.ts||0}))}}if(this.player.imageDetectActive&&this.player.ai&&this.player.ai.imageDetector){const t=this.player.ai.imageDetector.check({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0});if(t&&t.data&&(this.player.emit(at.aiImageDetectResult,{type:t.type,ts:e.ts||0}),this.player._opt.aiImageDetectDrop))return void this.player.debugLog("Video",`render() and ai image detect result type is ${t.type} and drop`)}try{const r=(t=s,i={format:"I420",codedWidth:this.videoInfo.width,codedHeight:this.videoInfo.height,timestamp:e.ts},new VideoFrame(t,i));this.vwriter.write(r),ra(r)}catch(e){this.player.debugError("Video","render error",e),this.player.emitError(dt.wasmUseVideoRenderError,`code is ${e.code} and message is ${e.message}`)}}this.player.updateCurrentPts(e.ts||0),this.doAddContentToWatermark(),this.doAddAiContentToWatermark()}else this.player.debugWarn("Video","render and this.vwriter is null");var t,i}_resize(){this.player.debugLog("Video","_resize()");let e=this.player.width,t=this.player.height;const i=this.player._opt,s=i.rotate;if(this.player.isControlBarShow()){const s=i.playType===w?Xt:Qt;po()&&this.player.fullscreen&&i.useWebFullScreen?e-=s:t-=s}this.$videoElement.width=e,this.$videoElement.height=t,this.$videoElement.style.width=e+"px",this.$videoElement.style.height=t+"px",270!==s&&90!==s||(this.$videoElement.width=t,this.$videoElement.height=e,this.$videoElement.style.width=t+"px",this.$videoElement.style.height=e+"px");let r=(e-this.$videoElement.width)/2,o=(t-this.$videoElement.height)/2,a="contain";ya(i.isResize)&&(a="fill"),i.isFullResize&&(a="none");let n="";"none"===i.mirrorRotate&&s&&(n+=" rotate("+s+"deg)"),"level"===i.mirrorRotate?n+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(n+=" rotateX(180deg)"),this.player._opt.videoRenderSupportScale&&(this.$videoElement.style.objectFit=a),this.$videoElement.style.transform=n,this.$videoElement.style.padding="0",this.$videoElement.style.left=r+"px",this.$videoElement.style.top=o+"px"}getType(){return J}getCurrentTime(){return this.$videoElement.currentTime}isPlaying(){return this.$videoElement&&ya(this.$videoElement.paused)&&ya(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}isVideoPlaying(){return this.isPlaying()}_canScreenshot(){return this.$videoElement&&this.$videoElement.readyState>=1}getPlaybackQuality(){let e=null;if(this.$videoElement){if(Zo(this.$videoElement.getVideoPlaybackQuality)){const t=this.$videoElement.getVideoPlaybackQuality();e={droppedVideoFrames:t.droppedVideoFrames||t.corruptedVideoFrames,totalVideoFrames:t.totalVideoFrames,creationTime:t.creationTime}}else e={droppedVideoFrames:this.$videoElement.webkitDroppedFrameCount,totalVideoFrames:this.$videoElement.webkitDecodedFrameCount,creationTime:ro()};e&&(e.renderedVideoFrames=e.totalVideoFrames-e.droppedVideoFrames)}return e}setRate(e){this.$videoElement&&(this.$videoElement.playbackRate=e)}get rate(){let e=1;return this.$videoElement&&(e=this.$videoElement.playbackRate),e}clearCheckVideoCanplayTimeout(){this.checkVideoCanplayTimeout&&(clearTimeout(this.checkVideoCanplayTimeout),this.checkVideoCanplayTimeout=null)}clearReplayTimeout(){this.replayTimeout&&(clearTimeout(this.replayTimeout),this.replayTimeout=null)}clearVisibilityChangePlayTimeout(){this.visibilityChangePlayTimeout&&(clearTimeout(this.visibilityChangePlayTimeout),this.visibilityChangePlayTimeout=null)}clearPauseDelayTimeout(){this.pauseDelayTimeout&&(clearTimeout(this.pauseDelayTimeout),this.pauseDelayTimeout=null)}_cancelVideoFrameCallback(){this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null)}_getBufferStore(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.buffered.start(0)),t}_handleUpdatePlaybackRate(){const e=this.$videoElement,t=e.buffered;t.length&&t.start(0);const i=t.length?t.end(t.length-1):0;let s=e.currentTime;const r=i-s,o=this.getBufferMaxDelayTime();if(this.player.updateStats({mseVideoBufferDelayTime:r}),r>o)this.player.debugLog(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current is ${s} , delay buffer is more than ${o} is ${r} and new time is ${i}`),e.currentTime=i,s=e.currentTime;else if(r<0&&0===i)return this.player.debugWarn(this.TAG_NAME,`handleUpdatePlaybackRate and delay buffer is ${i} - current is ${s} = ${r} < 0 and check video is paused : ${e.paused} `),void this.player.emit(dt.mediaSourceBufferedIsZeroError,"video.buffered is empty");if(s>1){const t=this._getPlaybackRate(i-s);e.playbackRate!==t&&(this.player.debugLog(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current time is ${s} and delay is ${i-s} set playbackRate is ${t} `),e.playbackRate=t)}}_getPlaybackRate(e){const t=this.$videoElement;let i=this.player._opt.videoBufferDelay+this.player._opt.videoBuffer;const s=Math.max(i,1e3),r=s/2;return e*=1e3,1===t.playbackRate?e>s?1.2:1:e<=r?1:t.playbackRate}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}getVideoBufferLastTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;i.length&&i.start(0);t=i.length?i.end(i.length-1):0}return t}getVideoBufferDelayTime(){const e=this.$videoElement;const t=this.getVideoBufferLastTime()-e.currentTime;return t>0?t:0}checkSourceBufferDelay(){const e=this.$videoElement;let t=0,i=0;return e.buffered.length>0&&(i=e.buffered.end(e.buffered.length-1),t=i-e.currentTime),t<0&&(this.player.debugWarn(this.TAG_NAME,`checkVideoSourceBufferDelay ${t} < 0, and buffered is ${i} ,currentTime is ${e.currentTime} , try to seek ${e.currentTime} to ${i}`),e.currentTime=i,e.paused&&(this.player.debugWarn(this.TAG_NAME,"checkSourceBufferDelay and video is paused and sent isMSECurrentMoreThanBufferedPause true"),this.player.isMSECurrentMoreThanBufferedPause=!0),t=0),t}checkSourceBufferStore(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.currentTime-e.buffered.start(0)),t}getVideoBufferTimeRange(){const e=this.$videoElement;let t=null;if(e){const i=e.buffered,s=i.length?i.start(0):0,r=i.length?i.end(i.length-1):0;t={start:s,end:r,diff:r-s}}return t}getDecodePlaybackRate(){let e=0;const t=this.$videoElement;return t&&(e=t.playbackRate),e}getBufferMaxDelayTime(){let e=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3;return Math.max(5,e+3)}getReadyStateInited(){return this._getVideoReadyState()>=1}}class tn extends Xa{constructor(e){super(e),this.controlHeight=Xt,this.bufferList=[],this.playing=!1,this.playInterval=null,this.fps=1,this.preFps=1,this.streamFps=0,this.playbackRate=1,this._firstTimestamp=null,this._renderFps=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._hasCalcFps=!1,this.player.on(at.playbackPause,(e=>{e?(this.pause(),this.player.playback.isPlaybackPauseClearCache&&this.clear()):this.resume()})),this.player.debugLog("CanvasPlaybackLoader","init")}async destroy(){this._stopSync(),this.clear(),this._firstTimestamp=null,this.playing=!1,this.playbackRate=1,this.fps=1,this.preFps=1,this._renderFps=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._hasCalcFps=!1,super.destroy(),this.player.debugLog("CanvasPlaybackLoader","destroy")}_initCanvasRender(){this.player._opt.useWCS?(this.renderType=ii,Sa()&&this.player._opt.wcsUseWebgl2Render?(this._initContextGl2(),this.webglRender&&(this.isWcsWebgl2=!0)):this._initContext2D()):this.player._opt.useWebGPU?(this.renderType=oi,this._initContextGPU()):(this.renderType=si,this._initContextGl())}_sync(){this._stopSync(),this._doPlay(),this.playInterval=setInterval((()=>{this._doPlay()}),this.fragDuration)}_doPlay(){if(this.bufferList.length>0&&!this.player.seeking){const e=this.bufferList.shift();e&&e.buffer&&(this._doRender(e.buffer),this.player.handleRender(),this.player.playback.updateStats({ts:e.ts,tfTs:e.tfTs}))}}_stopSync(){this.playInterval&&(clearInterval(this.playInterval),this.playInterval=null)}_doRender(e){if(this.player._opt.useWCS)if(this.webglRender)this.webglRender.render(e),ra(e);else if(Zo(e.createImageBitmap))try{e.createImageBitmap().then((t=>{this.context2D.drawImage(t,0,0,this.$videoElement.width,this.$videoElement.height),ra(e)}))}catch(e){}else this.context2D.drawImage(e,0,0,this.$videoElement.width,this.$videoElement.height),ra(e);else if(this.getCanvasType()===si)try{this.webglRender.renderYUV(this.$videoElement.width,this.$videoElement.height,e)}catch(e){this.player.debugError("CanvasPlaybackLoader",`doRender webgl render context is lost ${this.contextGl&&this.contextGl.isContextLost()} and error: ${e.toString()}`)}else if(this.getCanvasType()===oi)try{if(!this.webGPURender)return void this.player.debugWarn("CanvasVideoLoader","doRender webgpu render is not init");this.webGPURender.renderYUV(this.$videoElement.width,this.$videoElement.height,e)}catch(e){this.player.debugError("CanvasPlaybackLoader",`doRender webgpu render and error: ${e.toString()}`)}}get rate(){return this.playbackRate}get fragDuration(){return Math.ceil(1e3/(this.fps*this.playbackRate))}get bufferSize(){return this.bufferList.length}getStreamFps(){return this.streamFps}initFps(){this._hasCalcFps?this.player.debugLog("CanvasPlaybackLoader","initFps, has calc fps"):(this.preFps=oo(this.player.playback.fps,1,100),this.fps=this.preFps)}setFps(e){e!==this.fps?(e>100&&this.player.debugWarn("CanvasPlaybackLoader","setFps max",e),e<0&&this.player.debugWarn("CanvasPlaybackLoader","setFps min",e),this.fps=oo(e,1,100),this.player.debugLog("CanvasPlaybackLoader",`setFps ${this.preFps} -> ${this.fps}`),this.player.playback.isUseFpsRender&&this._sync()):this.player.debugLog("CanvasPlaybackLoader",`setFps, same fps ${e}`)}setStreamFps(e){this.player.debugLog("CanvasPlaybackLoader","setStreamFps",e),this._hasCalcFps=!0,this.streamFps=e,this.preFps=e,this.setFps(e)}setRate(e){e!==this.playbackRate&&(this.playbackRate=e,this.player.playback.isUseFpsRender&&this._sync())}render$2(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);const t={tfTs:e.ts-this._firstTimestamp,ts:e.ts};e.videoFrame?t.buffer=e.videoFrame:t.buffer=e.output,this.bufferList.push(t),this.startRender(),this.player.handleRender(),this.player.playback.updateStats({ts:e.ts,tfTs:t.tfTs})}startRender(){for(;!(this.bufferList.length<=0);){const e=this.bufferList.shift();this._doRender(e.buffer)}}pushData(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);const t={tfTs:e.ts-this._firstTimestamp,ts:e.ts};e.videoFrame?t.buffer=e.videoFrame:t.buffer=e.output;const i=this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender;if(i||this.bufferSize>this.fps*this.playbackRate*2&&(this.player.debugWarn("CanvasPlaybackLoader",`buffer size is ${this.bufferSize}`),this._doPlay()),this.bufferList.push(t),!this._hasCalcFps){const e=la(this.bufferList);null!==e&&e!==this.preFps&&(this.player.debugLog("CanvasPlaybackLoader",`calc fps is ${e} pre fps is ${this.preFps} and updatePreFps`),this.setStreamFps(e))}if(!i){const e=this.bufferList.length,t=e/(this.fps*this.playbackRate);this.player.debugLog("CanvasPlaybackLoader","rate is",t),t<=1?this.setFps(this.preFps):(this.setFps(this.fps+Math.floor(t*this.playbackRate)),this.player.debugWarn("CanvasPlaybackLoader","rate is",t,"fps is",this.fps,"bufferListLength is",e))}}initVideo(){this.player.playback&&this.player.playback.isUseFpsRender&&this._sync(),this.playing=!0}initVideoDelay(){const e=this.player._opt.playbackDelayTime;e>0?this.delayTimeout=setTimeout((()=>{this.initVideo()}),e):this.initVideo()}clearView(){super.clearView(),this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT)}clear(){this.player._opt.useWCS&&this.bufferList.forEach((e=>{e.buffer&&ra(e.buffer)})),this.bufferList=[]}resume(){this.player.playback.isUseFpsRender&&this._sync(),this.playing=!0}pause(){this.player.playback.isUseFpsRender&&this._stopSync(),this.playing=!1}}class sn{constructor(e){return new(sn.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.useMSE?e.mseUseCanvasRender?Za:en:e.isHls&&ya(e.supportHls265)||e.isWebrtc&&ya(e.isWebrtcH265)?e.useCanvasRender?Za:en:e.isAliyunRtc?en:e.useWCS?e.playType===w?tn:!e.useOffscreen&&e.wcsUseVideoRender?en:Za:e.playType===w?tn:e.wasmUseVideoRender&&!e.useOffscreen?en:Za}}class rn extends o{constructor(e){super(),this.bufferList=[],this.player=e,this.$audio=null,this.scriptNode=null,this.workletProcessorNode=null,this.workletWorkerCloseTimeout=null,this.hasInitScriptNode=!1,this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:Tr}),this.gainNode=this.audioContext.createGain();const t=this.audioContext.createBufferSource();t.buffer=this.audioContext.createBuffer(1,1,22050),t.connect(this.audioContext.destination),t.noteOn?t.noteOn(0):t.start(0),this.audioBufferSourceNode=t,this.mediaStreamAudioDestinationNode=this.audioContext.createMediaStreamDestination(),this.gainNode.gain.value=0,this._prevVolume=null,this.playing=!1,this.audioInfo={encTypeCode:"",encType:"",channels:"",sampleRate:"",depth:""},this.init=!1,this.hasAudio=!1,this.audioResumeStateTimeout=null,this.audioContextContextResumeLock=!1}async destroy(){return this.closeAudio(),this.resetInit(),this.clearAudioResumeStateTimeout(),this.audioContext&&(await this.audioContext.close(),this.audioContext=null),this.gainNode&&(this.gainNode.disconnect(),this.gainNode=null),this.hasAudio=!1,this.playing=!1,this.scriptNode&&(this.scriptNode.disconnect(),this.scriptNode.onaudioprocess=eo,this.scriptNode=null),await this._destroyWorklet(),this.workletProcessorNode&&(this.workletProcessorNode.disconnect(),this.workletProcessorNode.port.onmessage=eo,this.workletProcessorNode=null),this.audioBufferSourceNode&&(this.audioBufferSourceNode.stop(),this.audioBufferSourceNode=null),this.mediaStreamAudioDestinationNode&&(this.mediaStreamAudioDestinationNode.disconnect(),this.mediaStreamAudioDestinationNode=null),this.hasInitScriptNode=!1,this._prevVolume=null,this.audioContextContextResumeLock=!1,this.off(),!0}_destroyWorklet(){return new Promise(((e,t)=>{this.workletProcessorNode?(this.workletProcessorNode.port.postMessage({type:"destroy"}),this.workletWorkerCloseTimeout=setTimeout((()=>{this.player.debugLog(this.TAG_NAME,"send close and wait 10ms destroy directly"),this.workletWorkerCloseTimeout&&(clearTimeout(this.workletWorkerCloseTimeout),this.workletWorkerCloseTimeout=null),e()}),10)):e()}))}resetInit(){this.audioInfo={encTypeCode:"",encType:"",channels:"",sampleRate:"",depth:""},this.init=!1}getAudioInfo(){return this.audioInfo}updateAudioInfo(e){e.encTypeCode&&(this.audioInfo.encTypeCode=e.encTypeCode,this.audioInfo.encType=kt[e.encTypeCode]),e.channels&&(this.audioInfo.channels=e.channels),e.sampleRate&&(this.audioInfo.sampleRate=e.sampleRate),e.depth&&(this.audioInfo.depth=e.depth),this.audioInfo.sampleRate&&this.audioInfo.channels&&this.audioInfo.encType&&!this.init&&(this.player.emit(at.audioInfo,this.audioInfo),this.init=!0)}get isPlaying(){return this.playing}get isMute(){return 0===this.gainNode.gain.value||this.isStateSuspended()}get volume(){return this.gainNode.gain.value}get bufferSize(){return this.bufferList.length}get audioContextState(){let e=null;return this.audioContext&&(e=this.audioContext.state),e}initScriptNode(){}initMobileScriptNode(){}initWorkletScriptNode(){}getEngineType(){return""}mute(e){e?(this.setVolume(0),this.clear()):this.setVolume(this.player.lastVolume||.5)}setVolume(e){e=parseFloat(e).toFixed(2),isNaN(e)||(this.audioEnabled(!0),e=oo(e,0,1),null!==this._prevVolume&&this._prevVolume===e||(null===this._prevVolume?this.player.emit(at.mute,0===e):0===this._prevVolume&&e>0?this.player.emit(at.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(at.mute,!0),this.gainNode.gain.value=e,this.player.emit(at.volumechange,this.player.volume),this.player.emit(at.volume,this.player.volume),this._prevVolume=e))}closeAudio(){this.hasInitScriptNode&&(this.scriptNode&&this.scriptNode.disconnect(this.gainNode),this.workletProcessorNode&&this.workletProcessorNode.disconnect(this.gainNode),this.gainNode&&(this.gainNode.disconnect(this.mediaStreamAudioDestinationNode),this.$audio||this.gainNode.disconnect(this.audioContext.destination))),this.clear()}audioEnabled(e){if(e&&this.isStateSuspended()){if(this.audioContextContextResumeLock)return;this.audioContextContextResumeLock=!0,this.audioContext.resume().then((()=>{this.player.emit(at.audioResumeState,{state:this.audioContextState,isRunning:this.isStateRunning()})})).finally((()=>{this.audioContextContextResumeLock=!1})),this.audioResumeStateTimeout=setTimeout((()=>{this.clearAudioResumeStateTimeout(),this.audioContextContextResumeLock=!1,this.isStateSuspended()&&this.player.emit(at.audioResumeState,{state:this.audioContextState,isRunning:this.isStateRunning()})}),1e3)}}isStateRunning(){return"running"===this.audioContextState}isStateSuspended(){return"suspended"===this.audioContextState}clearAudioResumeStateTimeout(){this.audioResumeStateTimeout&&(clearTimeout(this.audioResumeStateTimeout),this.audioResumeStateTimeout=null)}clear(){this.bufferList=[]}play(e,t){}pause(){this.playing=!1}resume(){this.playing=!0}setRate(e){}getAudioBufferSize(){return 0}}class on{constructor(e,t,i,s){this.player=e,this.audio=t,this.channel=i,this.bufferSize=s}destroy(){this.buffer=null,this.channel=null}extract(e,t){let i=this.provide(t);for(let t=0;t=a){try{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:0;const s=2*(t=t||0);i>=0||(i=(e.length-s)/2);const r=2*i;this.ensureCapacity(i+this._frameCount);const o=this.endIndex;this.vector.set(e.subarray(s,s+r),o),this._frameCount+=i}putBuffer(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t=t||0,i>=0||(i=e.frameCount-t),this.putSamples(e.vector,e.position+t,i)}receive(e){e>=0&&!(e>this._frameCount)||(e=this.frameCount),this._frameCount-=e,this._position+=e}receiveSamples(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=2*t,s=this.startIndex;e.set(this._vector.subarray(s,s+i)),this.receive(t)}extract(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.startIndex+2*t,r=2*i;e.set(this._vector.subarray(s,s+r))}ensureCapacity(){const e=parseInt(2*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0));if(this._vector.length0&&void 0!==arguments[0]?arguments[0]:0;this.ensureCapacity(this._frameCount+e)}rewind(){this._position>0&&(this._vector.set(this._vector.subarray(this.startIndex,this.endIndex)),this._position=0)}}class nn{constructor(e){e?(this._inputBuffer=new an,this._outputBuffer=new an):this._inputBuffer=this._outputBuffer=null}destroy(){this.clear(),this._outputBuffer&&(this._outputBuffer.destroy(),this._outputBuffer=null),this._inputBuffer&&(this._inputBuffer.destroy(),this._inputBuffer=null)}get inputBuffer(){return this._inputBuffer}set inputBuffer(e){this._inputBuffer=e}get outputBuffer(){return this._outputBuffer}set outputBuffer(e){this._outputBuffer=e}clear(){this._inputBuffer.clear(),this._outputBuffer.clear()}}class ln extends nn{constructor(e){super(e),this.reset(),this._rate=1}destroy(){super.destroy()}set rate(e){this._rate=e}reset(){this.slopeCount=0,this.prevSampleL=0,this.prevSampleR=0}clone(){const e=new ln;return e.rate=this._rate,e}process(){const e=this._inputBuffer.frameCount;this._outputBuffer.ensureAdditionalCapacity(e/this._rate+1);const t=this.transpose(e);this._inputBuffer.receive(),this._outputBuffer.put(t)}transpose(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(0===e)return 0;const t=this._inputBuffer.vector,i=this._inputBuffer.startIndex,s=this._outputBuffer.vector,r=this._outputBuffer.endIndex;let o=0,a=0;for(;this.slopeCount<1;)s[r+2*a]=(1-this.slopeCount)*this.prevSampleL+this.slopeCount*t[i],s[r+2*a+1]=(1-this.slopeCount)*this.prevSampleR+this.slopeCount*t[i+1],a+=1,this.slopeCount+=this._rate;if(this.slopeCount-=1,1!==e)e:for(;;){for(;this.slopeCount>1;)if(this.slopeCount-=1,o+=1,o>=e-1)break e;const n=i+2*o;s[r+2*a]=(1-this.slopeCount)*t[n]+this.slopeCount*t[n+2],s[r+2*a+1]=(1-this.slopeCount)*t[n+1]+this.slopeCount*t[n+3],a+=1,this.slopeCount+=this._rate}return this.prevSampleL=t[i+2*e-2],this.prevSampleR=t[i+2*e-1],a}}const dn=function(){};class hn extends class{constructor(e){this._pipe=e}destroy(){}get pipe(){return this._pipe}get inputBuffer(){return this._pipe.inputBuffer}get outputBuffer(){return this._pipe.outputBuffer}fillInputBuffer(){throw new Error("fillInputBuffer() not overridden")}fillOutputBuffer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;for(;this.outputBuffer.frameCount2&&void 0!==arguments[2]?arguments[2]:dn;super(t),this.callback=i,this.sourceSound=e,this.historyBufferSize=22050,this._sourcePosition=0,this.outputBufferPosition=0,this._position=0}destroy(){this.clear(),this.sourceSound.destroy(),this.sourceSound=null,this._sourcePosition=0,this.outputBufferPosition=0,this._position=0}get position(){return this._position}set position(e){if(e>this._position)throw new RangeError("New position may not be greater than current position");const t=this.outputBufferPosition-(this._position-e);if(t<0)throw new RangeError("New position falls outside of history buffer");this.outputBufferPosition=t,this._position=e}get sourcePosition(){return this._sourcePosition}set sourcePosition(e){this.clear(),this._sourcePosition=e}onEnd(){this.callback()}fillInputBuffer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=new Float32Array(2*e),i=this.sourceSound.extract(t,e,this._sourcePosition);this._sourcePosition+=i,this.inputBuffer.putSamples(t,0,i)}extract(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillOutputBuffer(this.outputBufferPosition+t);const i=Math.min(t,this.outputBuffer.frameCount-this.outputBufferPosition);this.outputBuffer.extract(e,this.outputBufferPosition,i);const s=this.outputBufferPosition+i;return this.outputBufferPosition=Math.min(this.historyBufferSize,s),this.outputBuffer.receive(Math.max(s-this.historyBufferSize,0)),this._position+=i,i}handleSampleData(e){this.extract(e.data,4096)}clear(){super.clear(),this.outputBufferPosition=0}}const cn=[[124,186,248,310,372,434,496,558,620,682,744,806,868,930,992,1054,1116,1178,1240,1302,1364,1426,1488,0],[-100,-75,-50,-25,25,50,75,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-20,-15,-10,-5,5,10,15,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-4,-3,-2,-1,1,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],un=-10/1.5;class pn extends nn{constructor(e){super(e),this._quickSeek=!0,this.midBufferDirty=!1,this.midBuffer=null,this.refMidBuffer=null,this.overlapLength=0,this.autoSeqSetting=!0,this.autoSeekSetting=!0,this._tempo=1,this.setParameters(44100,0,0,8)}destroy(){this.clear(),super.destroy()}clear(){super.clear(),this.clearMidBuffer(),this.refMidBuffer=null}clearMidBuffer(){this.midBufferDirty&&(this.midBufferDirty=!1),this.midBuffer=null}setParameters(e,t,i,s){e>0&&(this.sampleRate=e),s>0&&(this.overlapMs=s),t>0?(this.sequenceMs=t,this.autoSeqSetting=!1):this.autoSeqSetting=!0,i>0?(this.seekWindowMs=i,this.autoSeekSetting=!1):this.autoSeekSetting=!0,this.calculateSequenceParameters(),this.calculateOverlapLength(this.overlapMs),this.tempo=this._tempo}set tempo(e){let t;this._tempo=e,this.calculateSequenceParameters(),this.nominalSkip=this._tempo*(this.seekWindowLength-this.overlapLength),this.skipFract=0,t=Math.floor(this.nominalSkip+.5),this.sampleReq=Math.max(t+this.overlapLength,this.seekWindowLength)+this.seekLength}get tempo(){return this._tempo}get inputChunkSize(){return this.sampleReq}get outputChunkSize(){return this.overlapLength+Math.max(0,this.seekWindowLength-2*this.overlapLength)}calculateOverlapLength(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;e=this.sampleRate*t/1e3,e=e<16?16:e,e-=e%8,this.overlapLength=e,this.refMidBuffer=new Float32Array(2*this.overlapLength),this.midBuffer=new Float32Array(2*this.overlapLength)}checkLimits(e,t,i){return ei?i:e}calculateSequenceParameters(){let e,t;this.autoSeqSetting&&(e=150+-50*this._tempo,e=this.checkLimits(e,50,125),this.sequenceMs=Math.floor(e+.5)),this.autoSeekSetting&&(t=28.333333333333332+un*this._tempo,t=this.checkLimits(t,15,25),this.seekWindowMs=Math.floor(t+.5)),this.seekWindowLength=Math.floor(this.sampleRate*this.sequenceMs/1e3),this.seekLength=Math.floor(this.sampleRate*this.seekWindowMs/1e3)}set quickSeek(e){this._quickSeek=e}clone(){const e=new pn;return e.tempo=this._tempo,e.setParameters(this.sampleRate,this.sequenceMs,this.seekWindowMs,this.overlapMs),e}seekBestOverlapPosition(){return this._quickSeek?this.seekBestOverlapPositionStereoQuick():this.seekBestOverlapPositionStereo()}seekBestOverlapPositionStereo(){let e,t,i,s=0;for(this.preCalculateCorrelationReferenceStereo(),e=0,t=Number.MIN_VALUE;st&&(t=i,e=s);return e}seekBestOverlapPositionStereoQuick(){let e,t,i,s,r,o=0;for(this.preCalculateCorrelationReferenceStereo(),t=Number.MIN_VALUE,e=0,s=0,r=0;o<4;o+=1){let a=0;for(;cn[o][a]&&(r=s+cn[o][a],!(r>=this.seekLength));)i=this.calculateCrossCorrelationStereo(2*r,this.refMidBuffer),i>t&&(t=i,e=r),a+=1;s=e}return e}preCalculateCorrelationReferenceStereo(){let e,t,i=0;for(;i=this.sampleReq;){e=this.seekBestOverlapPosition(),this._outputBuffer.ensureAdditionalCapacity(this.overlapLength),this.overlap(Math.floor(e)),this._outputBuffer.put(this.overlapLength),t=this.seekWindowLength-2*this.overlapLength,t>0&&this._outputBuffer.putBuffer(this._inputBuffer,e+this.overlapLength,t);const s=this._inputBuffer.startIndex+2*(e+this.seekWindowLength-this.overlapLength);this.midBuffer.set(this._inputBuffer.vector.subarray(s,s+2*this.overlapLength)),this.skipFract+=this.nominalSkip,i=Math.floor(this.skipFract),this.skipFract-=i,this._inputBuffer.receive(i)}}}const fn=function(e,t){return(e>t?e-t:t-e)>1e-10};class mn{constructor(){this.transposer=new ln(!1),this.stretch=new pn(!1),this._inputBuffer=new an,this._intermediateBuffer=new an,this._outputBuffer=new an,this._rate=0,this._tempo=0,this.virtualPitch=1,this.virtualRate=1,this.virtualTempo=1,this.calculateEffectiveRateAndTempo()}destroy(){this.clear(),this._inputBuffer.destroy(),this._intermediateBuffer.destroy(),this._outputBuffer.destroy(),this._inputBuffer=null,this._intermediateBuffer=null,this._outputBuffer=null}clear(){this.transposer.clear(),this.stretch.clear()}clone(){const e=new mn;return e.rate=this.rate,e.tempo=this.tempo,e}get rate(){return this._rate}set rate(e){this.virtualRate=e,this.calculateEffectiveRateAndTempo()}set rateChange(e){this._rate=1+.01*e}get tempo(){return this._tempo}set tempo(e){this.virtualTempo=e,this.calculateEffectiveRateAndTempo()}set tempoChange(e){this.tempo=1+.01*e}set pitch(e){this.virtualPitch=e,this.calculateEffectiveRateAndTempo()}set pitchOctaves(e){this.pitch=Math.exp(.69314718056*e),this.calculateEffectiveRateAndTempo()}set pitchSemitones(e){this.pitchOctaves=e/12}get inputBuffer(){return this._inputBuffer}get outputBuffer(){return this._outputBuffer}calculateEffectiveRateAndTempo(){const e=this._tempo,t=this._rate;this._tempo=this.virtualTempo/this.virtualPitch,this._rate=this.virtualRate*this.virtualPitch,fn(this._tempo,e)&&(this.stretch.tempo=this._tempo),fn(this._rate,t)&&(this.transposer.rate=this._rate),this._rate>1?this._outputBuffer!=this.transposer.outputBuffer&&(this.stretch.inputBuffer=this._inputBuffer,this.stretch.outputBuffer=this._intermediateBuffer,this.transposer.inputBuffer=this._intermediateBuffer,this.transposer.outputBuffer=this._outputBuffer):this._outputBuffer!=this.stretch.outputBuffer&&(this.transposer.inputBuffer=this._inputBuffer,this.transposer.outputBuffer=this._intermediateBuffer,this.stretch.inputBuffer=this._intermediateBuffer,this.stretch.outputBuffer=this._outputBuffer)}process(){this._rate>1?(this.stretch.process(),this.transposer.process()):(this.transposer.process(),this.stretch.process())}}class gn{constructor(e,t,i){this.player=e,this.audio=t,this.soundTouch=new mn,this.soundTouch.tempo=1,this.soundTouch.rate=1,this.filter=new hn(i,this.soundTouch)}destroy(){this.filter&&(this.filter.destroy(),this.filter=null),this.soundTouch&&(this.soundTouch.destroy(),this.soundTouch=null)}setRate(e){e!==this.soundTouch.rate&&(this.soundTouch.tempo=e)}provide(e){let t=new Float32Array(2*e),i=this.filter.extract(t,e),s=new Float32Array(i),r=new Float32Array(i);for(let e=0;e{e()})),this.eventListenList=[]),this.$audio&&(this.$audio.pause(),this.$audio.srcObject=null,this.$audio.parentNode&&this.$audio.parentNode.removeChild(this.$audio),this.$audio=null),this.processor&&(this.processor.destroy(),this.processor=null),this.rateProcessor&&(this.rateProcessor.destroy(),this.rateProcessor=null),this.scriptNodeInterval&&(clearInterval(this.scriptNodeInterval),this.scriptNodeInterval=null),this.defaultPlaybackRate=1,this.playbackRate=1,this.scriptStartTime=0,this.audioBufferSize=0,this.engineType=_s,this.player.debugLog("AudioContext","destroy"),!0}isAudioPlaying(){return this.$audio&&ya(this.$audio.paused)&&ya(this.$audio.ended)&&0!==this.$audio.playbackRate&&0!==this.$audio.readyState}_bindAudioProxy(){const{proxy:e}=this.player.events,t=e(this.$audio,"canplay",(()=>{this.player.debugLog("AudioContext","canplay"),this._delayPlay&&this._audioElementPlay()}));this.eventListenList.push(t)}_getAudioElementReadyState(){let e=0;return this.$audio&&(e=this.$audio.readyState),e}audioElementPlay(){if(this.$audio){const e=this._getAudioElementReadyState();if(this.player.debugLog("AudioContext",`play and readyState: ${e}`),!(0!==e||Ko()&&Ao()))return this.player.debugWarn("AudioContext","readyState is 0 and set _delayPlay to true"),void(this._delayPlay=!0);this._audioElementPlay()}}_audioElementPlay(){this.$audio&&this.$audio.play().then((()=>{this._delayPlay=!1,this.player.debugLog("AudioContext","_audioElementPlay success"),setTimeout((()=>{this.isAudioPlaying()||(this.player.debugWarn("AudioContext","play failed and retry play"),this._audioElementPlay())}),100),this.isAudioPlaying()&&(this.player.debugLog("AudioContext","play success and remove document click event listener"),document.removeEventListener("click",this._audioElementPlay.bind(this)))})).catch((e=>{this.player.debugError("AudioContext","_audioElementPlay error",e),document.addEventListener("click",this._audioElementPlay.bind(this))}))}getAudioBufferSize(){return this.audioBufferSize}get oneBufferDuration(){return this.audioBufferSize/this.audioContext.sampleRate*1e3}get isActiveEngineType(){return this.engineType===ws}getBufferListDuration(){return this.bufferList.length*this.oneBufferDuration}isMoreThanMinBufferDuration(){return this.getBufferListDuration()>=100*this.playbackRate}initProcessor(){this.processor=new on(this.player,this,this.audioInfo.channels,this.audioBufferSize),this.rateProcessor=new gn(this.player,this,this.processor)}getAutoAudioEngineType(){let e=this.player._opt.audioEngine||_s;const t=()=>{e=Ko()&&mo()?ws:(Ao()&&this.player._opt.supportLockScreenPlayAudio||aa()&&this.supportAudioWorklet(),_s)};return this.player._opt.audioEngine?this.player._opt.audioEngine===vs&&aa()&&this.supportAudioWorklet()?e=_s:this.player._opt.audioEngine===ws?e=ws:this.player._opt.audioEngine===_s?e=_s:t():t(),e}getAudioBufferSizeByType(){const e=this.engineType;this.player._opt.hasVideo;const t=this.player._opt.weiXinInAndroidAudioBufferSize;return e===vs?1024:e===ws?t||4800:1024}supportAudioWorklet(){return this.audioContext&&this.audioContext.audioWorklet&&"function"==typeof this.audioContext.audioWorklet.addModule}initScriptNode(){this.playing=!0,this.hasInitScriptNode||(this.initProcessor(),this.engineType===vs?this.initWorkletScriptNode():this.engineType===ws?this.initIntervalScriptNode():this.engineType===_s&&this.initProcessScriptNode(),this.audioElementPlay())}getEngineType(){return this.engineType}isPlaybackRateSpeed(){return this.playbackRate>this.defaultPlaybackRate}initProcessScriptNode(){const e=this.audioContext.createScriptProcessor(this.audioBufferSize,0,this.audioInfo.channels);e.onaudioprocess=e=>{const t=e.outputBuffer;this.handleScriptNodeCallback(t)},e.connect(this.gainNode),this.scriptNode=e,this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.$audio?this.$audio.srcObject=this.mediaStreamAudioDestinationNode.stream:this.gainNode.connect(this.audioContext.destination),this.hasInitScriptNode=!0}initIntervalScriptNode(){this.scriptStartTime=0;const e=1e3*this.audioBufferSize/this.audioContext.sampleRate;this.scriptNodeInterval=setInterval((()=>{if(0===this.bufferList.length||ya(this.playing)||this.isMute)return void(this.playing&&ya(this.isMute)&&this.player.debugLog("AudioContext",`interval script node and bufferList is ${this.bufferList.length} or playing is ${this.playing}`));const e=this.audioContext.createBufferSource(),t=this.audioContext.createBuffer(this.audioInfo.channels,this.audioBufferSize,this.audioContext.sampleRate);this.handleScriptNodeCallback(t,(()=>{this.scriptStartTime{"init"===e.data.message?(this.audioBufferSize=e.data.audioBufferSize,this.start=e.data.start,this.channels=e.data.channels,this.state=0,this.offset=0,this.samplesArray=[]):"stop"===e.data.message?(this.state=0,this.start=!1,this.offset=0,this.samplesArray=[]):"data"===e.data.message?this.samplesArray.push(e.data.buffer):"zero"===e.data.message&&this.samplesArray.push({left:new Float32Array(this.audioBufferSize).fill(0),right:new Float32Array(this.audioBufferSize).fill(0)})}}process(e,t,i){const s=t[0][0],r=t[0][1];if(0===this.offset&&this.port.postMessage({message:"beep"}),0===this.state)this.state=1;else if(1===this.state&&this.samplesArray.length>=4)this.state=2;else if(2===this.state){const e=this.samplesArray[0];for(let t=0;t{if(this.player.isDestroyedOrClosed())return void this.player.debugLog("AudioContext","initWorkletScriptNode() player is destroyed");if(!this.audioContext)return void this.player.debugWarn("AudioContext","initWorkletScriptNode audioContext is null");let e=[1];2===this.audioInfo.channels&&(e=[1,1]);try{this.workletProcessorNode=new AudioWorkletNode(this.audioContext,"worklet-processor",{numberOfOutputs:this.audioInfo.channels,outputChannelCount:e})}catch(e){this.player.debugError("AudioContext","initWorkletScriptNode error",e),this.workletProcessorNode=null,this.tierDownToProcessScript()}this.workletProcessorNode&&(this.workletProcessorNode.connect(this.gainNode),this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.$audio?this.$audio.srcObject=this.mediaStreamAudioDestinationNode.stream:this.gainNode.connect(this.audioContext.destination),this.hasInitScriptNode=!0,this.workletProcessorNode.port.postMessage({message:"init",audioBufferSize:this.audioBufferSize,start:!0,channels:this.audioInfo.channels}),this.workletProcessorNode.port.onmessage=e=>{this.workletProcessorNode?this.audioContext?this.handleScriptNodeCallback(this.workletProcessorNode,null,!0):this.workletProcessorNode.port.postMessage({message:"zero"}):this.player.debugError("AudioContext","workletProcessorNode is null")})})),this.clearWorkletUrlTimeout=setTimeout((()=>{URL.revokeObjectURL(this.workletUrl),this.workletUrl=null,this.clearWorkletUrlTimeout=null}),ie)}tierDownToProcessScript(){this.player.debugLog("AudioContext","tierDownToProcessScript"),this.engineType=_s,this.audioBufferSize=this.getAudioBufferSizeByType(),this.initProcessScriptNode(),this.audioElementPlay()}handleScriptNodeCallback(e,t){let i,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t=t||eo;let r=e.length;s&&(i=e,r=this.audioBufferSize);const o=this.audioInfo.channels;if(this.playing&&this.isMoreThanMinBufferDuration()){if(this.player._opt,this.player.openSyncAudioAndVideo()&&ga(this.player.visibility)){this.calcPlaybackRateBySync();const r=this.player.getAudioSyncVideoDiff();if(r>this.player._opt.syncAudioAndVideoDiff){const a=this.player.getCurrentVideoAndAudio();return this.player.debugWarn("AudioContext",`audioSyncVideoOption more than diff :${r},\n and video is ${a.video} ,\n and audio is ${a.audio} , waiting and bufferList is ${this.bufferList.length}, fill zero`),s?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,o),void t()}}let a=this._provide(r);if(0===a.size)return ya(this.player.isPlaybackOnlyDecodeIFrame())&&this.player.debugWarn("AudioContext",`bufferList size is ${this.bufferList.length} outputBufferLength is ${r},and bufferItem.size is 0, fill zero`),s?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,o),void t();a&&a.ts&&(this.player.audioTimestamp=a.ts),s?i.port.postMessage({message:"data",buffer:a}):this.fillScriptNodeOutputBuffer(e,o,a),t()}else 0===this.bufferList.length&&this.playing&&ya(this.isMute)&&ya(this.player.isPlaybackOnlyDecodeIFrame())&&this.player.debugWarn("AudioContext",`bufferList size is 0 and outputBufferLength is ${r}, fill zero`),s?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,o),t()}fillScriptNodeOutputBuffer(e,t,i){if(1===t){const t=e.getChannelData(0);i?0===i.size?t.fill(0):t.set(i.left):t.fill(0)}else if(2===t){const t=e.getChannelData(0),s=e.getChannelData(1);i?0===i.size?(t.fill(0),s.fill(0)):(t.set(i.left),s.set(i.right)):(t.fill(0),s.fill(0))}}play(e,t){this.isMute||(this.hasInitScriptNode?(this.hasAudio=!0,this.player.latestAudioTimestamp=t,this.bufferList.push({buffer:e,ts:t}),ya(this.player.openSyncAudioAndVideo())&&this.calcPlaybackRateByBuffer()):this.player.debugWarn("AudioContext","play has not init script node"))}calcPlaybackRateBySync(){if(this.isMute)return;if(!this.playing)return;const e=Math.floor(2e3/this.oneBufferDuration);if(this.bufferList.length>e)return this.player.debugWarn("AudioContext",`bufferList length ${this.bufferList.length} more than ${e}, and drop`),void this.clear();const t=this.player.getAudioSyncVideoDiff();if(this.getEngineType()===ws){if(t<-this.player._opt.syncAudioAndVideoDiff){this.player.debugWarn("AudioContext",`engine active , audioSyncVideoOption ${-this.player._opt.syncAudioAndVideoDiff} less than diff :${t},\n and bufferlist is ${this.bufferList.length}`);const e=this.player.getRenderCurrentPts();for(;this.bufferList.length>0;){const t=this.bufferList[0],i=t.ts-e;if(i>-this.player._opt.syncAudioAndVideoDiff/2){this.player.audioTimestamp=t.ts,this.player.debugLog("AudioContext",`engine active , audioSyncVideoOption\n item.ts is ${t.ts} and currentVideoTimestamp is ${e}, diff is ${i} > -${this.player._opt.syncAudioAndVideoDiff/2} and end`);break}this.bufferList.shift(),this.player.audioTimestamp=t.ts}}}else{let e=this.playbackRate;t<-this.player._opt.syncAudioAndVideoDiff?e===this.defaultPlaybackRate&&(this.player.debugLog("AudioContext",`audioSyncVideoOption ${-this.player._opt.syncAudioAndVideoDiff} less than diff :${t},\n speed up, playbackRate is ${e},\n and bufferList is ${this.bufferList.length}`),e=this.defaultPlaybackRate+.2):t>-this.player._opt.syncAudioAndVideoDiff/2&&e!==this.defaultPlaybackRate&&(this.player.debugLog("AudioContext",`diff is ${t} > -${this.player._opt.syncAudioAndVideoDiff/2} and speed to 1`),e=this.defaultPlaybackRate),this.updatePlaybackRate(e)}}calcPlaybackRateByBuffer(){if(this.isMute)return;if(!this.playing)return;let e=this.playbackRate,t=1e3,i=5e3;this.isAudioPlayer&&(t=this.player._opt.videoBufferDelay,i=this.player._opt.videoBufferMax);const s=Math.floor(t/this.oneBufferDuration),r=Math.floor(i/this.oneBufferDuration);if(this.bufferList.length>r)return this.player.debugWarn("AudioContext",`bufferList length ${this.bufferList.length} more than ${r}, and drop`),void this.clear();this.getEngineType()!==ws&&(this.bufferList.length>s?(e=this.defaultPlaybackRate+.2,this.player.debugLog("AudioContext",`bufferList length ${this.bufferList.length} more than ${s}, speed up, playbackRate is ${e}`)):this.bufferList.length0?this.player.emit(at.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(at.mute,!0),this.$video.volume=e,this.player.emit(at.volumechange,this.player.volume),this.player.emit(at.volume,this.player.volume),this._prevVolume=e))}clear(){}play(e,t){const i=this.player.video.awriter;if(i)if(e.close)try{i.write(e),oa(e)}catch(e){this.player.debugError("Video","play audio error",e)}else try{const s=function(e,t){const i={...t,format:"f32-planar",data:new Float32Array(0)};if(i.numberOfFrames=e[0].length/e.length,1===e.length)i.data=new Float32Array(e[0]);else if(2===e.length){const t=new Float32Array(e[0].length+e[1].length);for(let i=0;i{this.listenPlaybackPause(e)})),this.player.debugLog("AudioPlaybackContext","init")}async destroy(){return this.delayTimeout&&(clearTimeout(this.delayTimeout),this.delayTimeout=null),await super.destroy(),this.player.debugLog("AudioPlaybackLoader","destroy"),!0}listenPlaybackPause(e){e?(this.pause(),this.player.playback.isPlaybackPauseClearCache&&this.clear()):this.resume()}initScriptNodeDelay(){const e=this.player._opt.playbackDelayTime;e>0?this.delayTimeout=setTimeout((()=>{this.initScriptNode()}),e):this.initScriptNode()}setRate(e){e!==this.defaultPlaybackRate&&this.rateProcessor&&(this.player.debugLog("AudioPlaybackContext","setRate",e),this.defaultPlaybackRate=e,this.updatePlaybackRate(e))}}class vn extends yn{constructor(e){super(e),this.TAG_NAME="AudioPlayerLoader",this.isAudioPlayer=!0,this.player.debugLog(this.TAG_NAME,"init")}async destroy(){return await super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy"),!0}play(e,t){ya(this.playing)||super.play(e,t)}pause(){this.player.debugLog(this.TAG_NAME,"pause"),this.playing=!1,this.clear()}resume(){this.player.debugLog(this.TAG_NAME,"resume"),this.playing=!0}}class _n extends o{constructor(e){super(),this.TAG_NAME="AudioWebrtcPlayerLoader",this.$video=new Audio,this.player=e,this.init=!1,this._prevVolume=null,this.eventsDestroy=[],this._handleDocumentClickPlay=this._handleClickPlay.bind(this),this._initAudioEvents(),this.player.debugLog(this.TAG_NAME,"init")}async destroy(){return this.resetInit(),this.off(),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this._prevVolume=null,this.$video&&(this.$video.pause(),this.$video.srcObject=null,this.$video=null),this.player.debugLog(this.TAG_NAME,"destroy"),!0}_initAudioEvents(){const{proxy:e}=this.player.events,t=e(this.$video,"timeupdate",(e=>{const t=parseInt(e.timeStamp,10);this.player.handleRender(),this.player.updateStats({ts:t})}));this.eventsDestroy.push(t)}resetInit(){this.init=!1}_handleClickPlay(){this.$video&&(this.$video.play(),document.removeEventListener("click",this._handleDocumentClickPlay))}bindStream(e){this.$video.srcObject=e,this.$video.volume=1,this.$video.play().catch((e=>{this.player.debugWarn(this.TAG_NAME,"audio play error",e),document.addEventListener("click",this._handleDocumentClickPlay)}))}getEngineType(){return"audio"}get isPlaying(){return!0}get volume(){return ga(this.$video.muted)?0:this.$video.volume}get isMute(){return 0===this.$video.volume||ga(this.$video.muted)}mute(e){this.setVolume(e?0:this.player.lastVolume||.5)}setVolume(e){e=parseFloat(e),isNaN(e)||null===this.$video||(this.$video.muted&&(this.$video.muted=!1),e=oo(e,0,1),Ao()&&(this.$video.muted=0===e),null!==this._prevVolume&&this._prevVolume===e||(null===this._prevVolume?this.player.emit(at.mute,0===e):0===this._prevVolume&&e>0?this.player.emit(at.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(at.mute,!0),this.$video.volume=e,this.player.emit(at.volumechange,this.player.volume),this.player.emit(at.volume,this.player.volume),this._prevVolume=e))}pause(){}resume(){}audioEnabled(){this.mute(!1)}}class wn{constructor(e){return new(wn.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.playType===w?e.useMSE&&e.mseDecodeAudio?An:bn:e.playType===_?e.isWebrtc?_n:vn:e.isHls&&ya(e.supportHls265)||e.isWebrtc&&ya(e.isWebrtcH265)||e.useMSE&&e.mseDecodeAudio||e.isAliyunRtc||e.useWCS&&e.wcsDecodeAudio||e.useWasm&&e.wasmPlayAudioUseVideoRender?An:yn}}class Sn extends o{constructor(e){super(),this.player=e,this.playing=!1,this._requestAbort=!1,this._status=Xs,this.writableStream=null,this.abortController=new AbortController,this.streamRate=ho((t=>{e.emit(at.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,e.debugLog("FetchStream","init")}async destroy(){return this.abort(),await this._closeWritableStream(),this.off(),this._status=Xs,this.streamRate=null,this.stopStreamRateInterval(),this.player.debugLog("FetchStream","destroy"),!0}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}async _closeWritableStream(){if(this.writableStream&&ya(this.writableStream.locked))try{await this.writableStream.close(),this.writableStream=null,this.player.debugLog("FetchStream","close writableStream success")}catch(e){this.player.debugLog("FetchStream","destroy and writableStream.close()",e)}}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{demux:i}=this.player;this.player._times.streamStart=ro();const s=Object.assign({signal:this.abortController.signal},{headers:t.headers||{}});fetch(e,s).then((e=>{if(this._requestAbort)return this._status=Xs,void e.body.cancel();if(!function(e){return e.ok&&e.status>=200&&e.status<=299}(e))return this.player.debugError("FetchStream",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),this.abort(),void this.emit(dt.fetchError,`fetch response status is ${e.status} and ok is ${e.ok}`);if(this.emit(at.streamSuccess),this.startStreamRateInterval(),"undefined"!=typeof WritableStream)this.player.debugLog("FetchStream","use WritableStream() to read stream"),this.writableStream=new WritableStream({write:e=>this.abortController&&this.abortController.signal&&this.abortController.signal.aborted?(this.player.debugLog("FetchStream","writableStream.write() and this.abortController.signal.aborted so return"),void(this._status=er)):ga(this._requestAbort)?(this.player.debugLog("FetchStream","writableStream.write() and this._requestAbort is true so return"),this._status=er,void this.abort()):"string"!=typeof e?(this._status=Zs,this.streamRate&&this.streamRate(e.byteLength),i.dispatch(e)):void this.player.debugWarn("FetchStream",`writableStream.write() and value is "${e}" string so return`),close:()=>{this._status=er,i.close(),this.emit(at.streamEnd,"fetch done")},abort:e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return this.player.debugLog("FetchStream","writableStream.abort() and this.abortController.signal.aborted so return"),void(this._status=er);i.close();const t=e.toString();-1===t.indexOf(cs)&&-1===t.indexOf(us)&&e.name!==ps&&(this.abort(),this.emit(dt.fetchError,e))}}),e.body.pipeTo(this.writableStream).catch((e=>{"AbortError"!==e.name&&this.player.debugLog("FetchStream","res.body.pipeTo() error",e.name,e.toString())}));else{this.player.debugLog("FetchStream","not support WritableStream and use getReader() to read stream");const t=e.body.getReader(),s=()=>{t.read().then((e=>{let{done:t,value:r}=e;return t?(this._status=er,i.close(),void this.emit(at.streamEnd,"fetch done")):this.abortController&&this.abortController.signal&&this.abortController.signal.aborted?(this.player.debugLog("FetchStream","reader.read() and this.abortController.signal.aborted so return"),void(this._status=er)):ga(this._requestAbort)?(this.player.debugLog("FetchStream","reader.read() and this._requestAbort is true so return"),this._status=er,void this.abort()):void("string"!=typeof r?(this._status=Zs,this.streamRate&&this.streamRate(r.byteLength),i.dispatch(r),s()):this.player.debugWarn("FetchStream",`reader.read() and value is "${r}" string so return`))})).catch((e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return this.player.debugLog("FetchStream","reader.read().catch() and this.abortController.signal.aborted so return"),void(this._status=er);i.close();const t=e.toString();-1===t.indexOf(cs)&&-1===t.indexOf(us)&&e.name!==ps&&(this.abort(),this.emit(dt.fetchError,e))}))};s()}})).catch((e=>{this.abortController&&this.abortController.signal&&this.abortController.signal.aborted||"AbortError"!==e.name&&(i.close(),this.abort(),this.emit(dt.fetchError,e))}))}abort(){if(this._requestAbort=!0,this.abortController)try{this.abortController.abort(),this.abortController=null,this.player.debugLog("FetchStream","abortController.abort() success")}catch(e){this.abortController=null,this.player.debugLog("FetchStream","abortController.abort() error",e)}}getStreamType(){return p}}class En extends o{constructor(e){super(),this.TAG_NAME="FetchWorkerLoader",this.player=e,this.playing=!1,this.fetchWorker=null,this.workerClearTimeout=null,this.workerUrl=null,this.destroyResolve=null,this.decoderWorkerCloseTimeout=null,this.abortController=new AbortController,this.streamRate=ho((t=>{e.emit(at.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,this._initFetchWorker(),e.debugLog(this.TAG_NAME,"init")}destroy(){return new Promise(((e,t)=>{this.fetchWorker?(this.player.debugLog(this.TAG_NAME,"send destroy"),this.fetchWorker.postMessage({cmd:et}),this.destroyResolve=e,this.decoderWorkerCloseTimeout=setTimeout((()=>{this.player.debugWarn(this.TAG_NAME,"send close but not response and destroy directly"),this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this._destroy(),setTimeout((()=>{e()}),0)}),2e3)):(this._destroy(),setTimeout((()=>{e()}),0))}))}_destroy(){this.off(),this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this.workerUrl&&(window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this._stopStreamRateInterval(),this.streamRate=null,this.fetchWorker&&(this.fetchWorker.terminate(),this.fetchWorker.onmessage=null,this.fetchWorker=null),this.destroyResolve&&(this.destroyResolve(),this.destroyResolve=null),this.player.debugLog(this.TAG_NAME,"destroy")}_initFetchWorker(){const e=Ea(function(){function e(e){return!0===e||"true"===e}const t="The user aborted a request",i="AbortError",s="AbortError",r="fetch",o="destroy",a="destroyEnd",n="buffer",l="fetchError",d="fetchClose",h="fetchSuccess",c="idle",u="buffering",p="complete";let f=new class{constructor(){this._requestAbort=!1,this._status=c,this.writableStream=null,this.isChrome=!1,this.abortController=new AbortController}destroy(){var e;this.abort(),this.writableStream&&(!1===(e=this.writableStream.locked)||"false"===e)&&this.writableStream.close().catch((e=>{})),this.writableStream=null,this._status=c}fetchStream(r){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=Object.assign({signal:this.abortController.signal},{headers:o.headers||{}});fetch(r,a).then((r=>{if(this._requestAbort)return this._status=c,void r.body.cancel();if(!function(e){return e.ok&&e.status>=200&&e.status<=299}(r))return this.abort(),void postMessage({cmd:l,message:`fetch response status is ${r.status} and ok is ${r.ok}`});if(postMessage({cmd:h}),"undefined"!=typeof WritableStream)this.writableStream=new WritableStream({write:t=>{if(!(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted))return e(this._requestAbort)?(this._status=p,void this.abort()):void("string"!=typeof t&&(this._status=u,postMessage({cmd:n,buffer:t},[t.buffer])));this._status=p},close:()=>{this._status=p,postMessage({cmd:d})},abort:e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return void(this._status=p);const r=e.toString();-1===r.indexOf(t)&&-1===r.indexOf(i)&&e.name!==s&&(this.abort(),postMessage({cmd:l,message:e.toString()}))}}),r.body.pipeTo(this.writableStream).catch((e=>{}));else{const o=r.body.getReader(),a=()=>{o.read().then((t=>{let{done:i,value:s}=t;return i?(this._status=p,void postMessage({cmd:d})):this.abortController&&this.abortController.signal&&this.abortController.signal.aborted?void(this._status=p):e(this._requestAbort)?(this._status=p,void this.abort()):void("string"!=typeof s&&(this._status=u,postMessage({cmd:n,buffer:s},[s.buffer]),a()))})).catch((e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return void(this._status=p);const r=e.toString();-1===r.indexOf(t)&&-1===r.indexOf(i)&&e.name!==s&&(this.abort(),postMessage({cmd:l,message:e.toString()}))}))};a()}})).catch((e=>{this.abortController&&this.abortController.signal&&this.abortController.signal.aborted||"AbortError"!==e.name&&(this.abort(),postMessage({cmd:l,message:e.toString()}))}))}abort(){if(this._requestAbort=!0,this.abortController)try{this.abortController.abort(),this.abortController=null}catch(e){this.abortController=null}}};self.onmessage=t=>{const i=t.data;switch(i.cmd){case r:f.isChrome=e(i.isChrome),f.fetchStream(i.url,JSON.parse(i.options));break;case o:f.destroy(),f=null,postMessage({cmd:a})}}}.toString()),t=new Blob([e],{type:"text/javascript"});let i=URL.createObjectURL(t);const s=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((()=>{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),ie),s.onmessage=e=>{const{demux:t}=this.player,i=e.data;switch(i.cmd){case it:this.streamRate&&this.streamRate(i.buffer.byteLength),t.dispatch(i.buffer);break;case ot:this.emit(at.streamSuccess),this._startStreamRateInterval();break;case rt:t.close(),this.emit(at.streamEnd,"fetch done");break;case st:t.close(),this.emit(dt.fetchError,i.message);break;case tt:this._destroy()}},this.fetchWorker=s}_startStreamRateInterval(){this._stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}_stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player._times.streamStart=ro(),this.fetchWorker.postMessage({cmd:Ze,url:e,isChrome:Yo(),options:JSON.stringify(t)})}getStreamType(){return p}}class Tn extends o{constructor(e){super(),this.player=e,this.socket=null,this.socketStatus=ht,this.wsUrl=null,this.requestAbort=!1,this.socketDestroyFnList=[],this.streamRate=ho((t=>{e.emit(at.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,e.debugLog("WebsocketStream","init")}async destroy(){this._closeWebSocket(),this.stopStreamRateInterval(),this.wsUrl=null,this.off(),this.player.debugLog("WebsocketStream","destroy")}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}_createWebSocket(e){const t=this.player,{events:{proxy:i},demux:s}=t,r=e.protocols||[];this.socket=new WebSocket(this.wsUrl,r),this.socket.binaryType="arraybuffer";const o=i(this.socket,"open",(()=>{this.player.debugLog("WebsocketStream","socket open"),this.socketStatus=ct,this.emit(at.streamSuccess),this.player.emit(at.websocketOpen),this.startStreamRateInterval()})),a=i(this.socket,"message",(e=>{"string"!=typeof e.data?(this.streamRate&&this.streamRate(e.data.byteLength),this._handleMessage(e.data)):this.player.debugWarn("WebsocketStream",`websocket handle message message is "${e.data}" string so return`)})),n=i(this.socket,"close",(e=>{if(!this.player.isDestroyedOrClosed())if(this.socketStatus!==pt){if(this.player.debugLog("WebsocketStream",`socket close and code is ${e.code}`),1006===e.code&&this.player.debugError("WebsocketStream",`socket close abnormally and code is ${e.code}`),ga(this.requestAbort))return this.requestAbort=!1,void this.player.debugLog("WebsocketStream","socket close and requestAbort is true");s.close(),this.socketStatus=ut,this.player.emit(at.websocketClose,e.code),this.emit(at.streamEnd,e.code)}else this.player.debugLog("WebsocketStream","socket close and status is error, so return")})),l=i(this.socket,"error",(e=>{this.player.isDestroyedOrClosed()||(this.player.debugError("WebsocketStream","socket error",e),this.socketStatus=pt,this.emit(dt.websocketError,e),s.close(),this.player.debugLog("WebsocketStream","socket error:",e.isTrusted?"websocket user aborted":"websocket error"))}));this.socketDestroyFnList.push(o,a,n,l)}_closeWebSocket(){this.socketDestroyFnList.forEach((e=>e())),!this.socket||0!==this.socket.readyState&&1!==this.socket.readyState?this.socket&&this.player.debugLog("WebsocketStream",`_closeWebSocket() socket is null or socket status is ${this.socket&&this.socket.readyState}`):(this.requestAbort=!0,this.socket.close(1e3,"Client disconnecting")),this.socket=null,this.socketStatus=ht,this.streamRate=null}_handleMessage(e){const{demux:t}=this.player;t?t.dispatch(e):this.player.debugWarn("WebsocketStream","websocket handle message demux is null so return")}fetchStream(e,t){this.player._times.streamStart=ro(),this.wsUrl=e,this._createWebSocket(t)}sendMessage(e){this.socket?this.socketStatus===ct?this.socket.send(e):this.player.debugError("WebsocketStream",`websocket send message error and socket status is ${this.socketStatus}`):this.player.debugError("WebsocketStream","websocket send message socket is null")}resetFetchStream(){this._closeWebSocket(),this._createWebSocket()}getStreamType(){return m}}class kn extends o{constructor(e){super(),this.player=e,e.debugLog("HlsStream","init")}async destroy(){return this.off(),this.player.debugLog("HlsStream","destroy"),!0}fetchStream(e){const{hlsDecoder:t,debug:i}=this.player;this.player._times.streamStart=ro(),t.loadSource(e).then((()=>{this.player.debugLog("HlsStream","loadSource success"),this.emit(at.streamSuccess)})).catch((e=>{this.emit(dt.hlsError,e)}))}getStreamType(){return f}}class Ln extends o{constructor(e){super(),this.player=e,this.webrctUrl=null,e.debugLog("WebrtcStream","init")}async destroy(){return this.webrctUrl=null,this.off(),this.player.debugLog("WebrtcStream","destroy"),!0}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{webrtc:i,debug:s}=this.player;if(this.player._times.streamStart=ro(),this.webrctUrl=e.replace("webrtc:",window.location.protocol),this.player.isWebrtcForM7S()&&-1===this.webrctUrl.indexOf("/webrtc/play")){const t=new URL(this.webrctUrl),i="/webrtc/play"+t.pathname;this.webrctUrl=t.origin+i+t.search,this.player.debugLog("WebrtcStream",`original url is ${e}, and new url is: ${this.webrctUrl}`)}i.loadSource(this.webrctUrl,t).then((()=>{this.player.debugLog("WebrtcStream","loadSource success"),this.emit(at.streamSuccess)})).catch((e=>{this.player.debugError("WebrtcStream","loadSource error",e),this.emit(dt.webrtcError,e)}))}getStreamType(){return g}}class Cn extends o{constructor(e){super(),this.player=e,this.transport=null,this.wtUrl=null,this.streamRate=ho((t=>{e.emit(at.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,e.debugLog("WebTransportLoader","init")}async destroy(){return this.abort(),this.off(),this.player.debugLog("WebTransportLoader","destroy"),!0}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}_createWebTransport(){const e=this.player,{debug:t,events:{proxy:i},demux:s}=e;try{this.transport=new WebTransport(this.wtUrl),this.transport.ready.then((()=>{this.emit(at.streamSuccess),this.startStreamRateInterval(),this.transport.createBidirectionalStream().then((e=>{e.readable.pipeTo(new WritableStream(s.input))}))})).catch((e=>{this.player.debugWarn("WebTransportLoader","_createWebTransport-ready",e)}))}catch(e){this.player.debugWarn("WebTransportLoader","_createWebTransport",e)}}fetchStream(e){this.player._times.streamStart=ro(),this.wtUrl=e.replace(/^wt:/,"https:"),this._createWebTransport()}abort(){if(this.transport)try{this.transport.close(),this.transport=null}catch(e){this.transport=null}}getStreamType(){return y}}class xn extends o{constructor(e){super(),this.player=e,this.workUrl=null,e.debugLog("WorkerStream","init")}async destroy(){return this.workUrl=null,this.off(),this.player.debugLog("WorkerStream","destroy"),!0}sendMessage(e){this.player.decoderWorker.workerSendMessage(e)}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.workUrl=e,this.player._times.streamStart=ro(),this.player.decoderWorker.workerFetchStream(e,t)}getStreamType(){const e=this.player._opt.protocol;return A+" "+(e===n?p:m)}}class Dn extends o{constructor(e){super(),this.TAG_NAME="AliyunRtcLoader",this.player=e,e.debugLog(this.TAG_NAME,"init")}async destroy(){return this.off(),this.player.debugLog(this.TAG_NAME,"destroy"),!0}fetchStream(e){const{aliyunRtcDecoder:t}=this.player;this.player._times.streamStart=ro(),t.loadSource(e).then((()=>{this.player.debugLog(this.TAG_NAME,"loadSource success"),this.emit(at.streamSuccess)})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource error",e),this.emit(dt.aliyunRtcError,e)}))}getStreamType(){return b}}class Rn{constructor(e){return new(Rn.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){const{protocol:t,useWasm:i,playType:s,useWCS:r,useMSE:o,demuxUseWorker:u,mainThreadFetchUseWorker:p}=e;return t===n?s===_?xn:s===v?i&&!ia(e)||u?xn:p?En:Sn:r||o?u?xn:p?En:Sn:xn:t===a?s===_?xn:s===v?i&&!ia(e)||u?xn:Tn:r||o?u?xn:Tn:xn:t===l?kn:t===d?Ln:t===h?Cn:t===c?Dn:void 0}}var Pn=Rr((function(e){function t(e,r){if(!e)throw"First parameter is required.";r=new i(e,r=r||{type:"video"});var o=this;function a(t){t&&(r.initCallback=function(){t(),t=r.initCallback=null});var i=new s(e,r);(p=new i(e,r)).record(),u("recording"),r.disableLogs||console.log("Initialized recorderType:",p.constructor.name,"for output-type:",r.type)}function n(e){if(e=e||function(){},p){if("paused"===o.state)return o.resumeRecording(),void setTimeout((function(){n(e)}),1);"recording"===o.state||r.disableLogs||console.warn('Recording state should be: "recording", however current state is: ',o.state),r.disableLogs||console.log("Stopped recording "+r.type+" stream."),"gif"!==r.type?p.stop(t):(p.stop(),t()),u("stopped")}else m();function t(t){if(p){Object.keys(p).forEach((function(e){"function"!=typeof p[e]&&(o[e]=p[e])}));var i=p.blob;if(!i){if(!t)throw"Recording failed.";p.blob=i=t}if(i&&!r.disableLogs&&console.log(i.type,"->",y(i.size)),e){var s;try{s=h.createObjectURL(i)}catch(e){}"function"==typeof e.call?e.call(o,s):e(s)}r.autoWriteToDisk&&d((function(e){var t={};t[r.type+"Blob"]=e,x.Store(t)}))}else"function"==typeof e.call?e.call(o,""):e("")}}function l(e){postMessage((new FileReaderSync).readAsDataURL(e))}function d(e,t){if(!e)throw"Pass a callback function over getDataURL.";var i=t?t.blob:(p||{}).blob;if(!i)return r.disableLogs||console.warn("Blob encoder did not finish its job yet."),void setTimeout((function(){d(e,t)}),1e3);if("undefined"==typeof Worker||navigator.mozGetUserMedia){var s=new FileReader;s.readAsDataURL(i),s.onload=function(t){e(t.target.result)}}else{var o=function(e){try{var t=h.createObjectURL(new Blob([e.toString(),"this.onmessage = function (eee) {"+e.name+"(eee.data);}"],{type:"application/javascript"})),i=new Worker(t);return h.revokeObjectURL(t),i}catch(e){}}(l);o.onmessage=function(t){e(t.data)},o.postMessage(i)}}function c(e){e=e||0,"paused"!==o.state?"stopped"!==o.state&&(e>=o.recordingDuration?n(o.onRecordingStopped):(e+=1e3,setTimeout((function(){c(e)}),1e3))):setTimeout((function(){c(e)}),1e3)}function u(e){o&&(o.state=e,"function"==typeof o.onStateChanged.call?o.onStateChanged.call(o,e):o.onStateChanged(e))}var p,f='It seems that recorder is destroyed or "startRecording" is not invoked for '+r.type+" recorder.";function m(){!0!==r.disableLogs&&console.warn(f)}var g={startRecording:function(t){return r.disableLogs||console.log("RecordRTC version: ",o.version),t&&(r=new i(e,t)),r.disableLogs||console.log("started recording "+r.type+" stream."),p?(p.clearRecordedData(),p.record(),u("recording"),o.recordingDuration&&c(),o):(a((function(){o.recordingDuration&&c()})),o)},stopRecording:n,pauseRecording:function(){p?"recording"===o.state?(u("paused"),p.pause(),r.disableLogs||console.log("Paused recording.")):r.disableLogs||console.warn("Unable to pause the recording. Recording state: ",o.state):m()},resumeRecording:function(){p?"paused"===o.state?(u("recording"),p.resume(),r.disableLogs||console.log("Resumed recording.")):r.disableLogs||console.warn("Unable to resume the recording. Recording state: ",o.state):m()},initRecorder:a,setRecordingDuration:function(e,t){if(void 0===e)throw"recordingDuration is required.";if("number"!=typeof e)throw"recordingDuration must be a number.";return o.recordingDuration=e,o.onRecordingStopped=t||function(){},{onRecordingStopped:function(e){o.onRecordingStopped=e}}},clearRecordedData:function(){p?(p.clearRecordedData(),r.disableLogs||console.log("Cleared old recorded data.")):m()},getBlob:function(){if(p)return p.blob;m()},getDataURL:d,toURL:function(){if(p)return h.createObjectURL(p.blob);m()},getInternalRecorder:function(){return p},save:function(e){p?A(p.blob,e):m()},getFromDisk:function(e){p?t.getFromDisk(r.type,e):m()},setAdvertisementArray:function(e){r.advertisement=[];for(var t=e.length,i=0;i-1&&"netscape"in window&&/ rv:/.test(navigator.userAgent),f=!u&&!c&&!!navigator.webkitGetUserMedia||b()||-1!==navigator.userAgent.toLowerCase().indexOf("chrome/"),m=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);m&&!f&&-1!==navigator.userAgent.indexOf("CriOS")&&(m=!1,f=!0);var g=window.MediaStream;function y(e){if(0===e)return"0 Bytes";var t=parseInt(Math.floor(Math.log(e)/Math.log(1e3)),10);return(e/Math.pow(1e3,t)).toPrecision(3)+" "+["Bytes","KB","MB","GB","TB"][t]}function A(e,t){if(!e)throw"Blob object is required.";if(!e.type)try{e.type="video/webm"}catch(e){}var i=(e.type||"video/webm").split("/")[1];if(-1!==i.indexOf(";")&&(i=i.split(";")[0]),t&&-1!==t.indexOf(".")){var s=t.split(".");t=s[0],i=s[1]}var r=(t||Math.round(9999999999*Math.random())+888888888)+"."+i;if(void 0!==navigator.msSaveOrOpenBlob)return navigator.msSaveOrOpenBlob(e,r);if(void 0!==navigator.msSaveBlob)return navigator.msSaveBlob(e,r);var o=document.createElement("a");o.href=h.createObjectURL(e),o.download=r,o.style="display:none;opacity:0;color:transparent;",(document.body||document.documentElement).appendChild(o),"function"==typeof o.click?o.click():(o.target="_blank",o.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}))),h.revokeObjectURL(o.href)}function b(){return"undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type||(!("undefined"==typeof process||"object"!=typeof process.versions||!process.versions.electron)||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}function v(e,t){return e&&e.getTracks?e.getTracks().filter((function(e){return e.kind===(t||"audio")})):[]}function _(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}void 0===g&&"undefined"!=typeof webkitMediaStream&&(g=webkitMediaStream),void 0!==g&&void 0===g.prototype.stop&&(g.prototype.stop=function(){this.getTracks().forEach((function(e){e.stop()}))}),t.invokeSaveAsDialog=A,t.getTracks=v,t.getSeekableBlob=function(e,t){if("undefined"==typeof EBML)throw new Error("Please link: https://www.webrtc-experiment.com/EBML.js");var i=new EBML.Reader,s=new EBML.Decoder,r=EBML.tools,o=new FileReader;o.onload=function(e){s.decode(this.result).forEach((function(e){i.read(e)})),i.stop();var o=r.makeMetadataSeekable(i.metadatas,i.duration,i.cues),a=this.result.slice(i.metadataSize),n=new Blob([o,a],{type:"video/webm"});t(n)},o.readAsArrayBuffer(e)},t.bytesToSize=y,t.isElectron=b;var w={};function S(){if(p||m||c)return!0;var e,t,i=navigator.userAgent,s=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10);return(f||u)&&(e=i.indexOf("Chrome"),s=i.substring(e+7)),-1!==(t=s.indexOf(";"))&&(s=s.substring(0,t)),-1!==(t=s.indexOf(" "))&&(s=s.substring(0,t)),r=parseInt(""+s,10),isNaN(r)&&(s=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10)),r>=49}function E(e,t){var i=this;if(void 0===e)throw'First argument "MediaStream" is required.';if("undefined"==typeof MediaRecorder)throw"Your browser does not support the Media Recorder API. Please try other modules e.g. WhammyRecorder or StereoAudioRecorder.";if("audio"===(t=t||{mimeType:"video/webm"}).type){var s;if(v(e,"video").length&&v(e,"audio").length)navigator.mozGetUserMedia?(s=new g).addTrack(v(e,"audio")[0]):s=new g(v(e,"audio")),e=s;t.mimeType&&-1!==t.mimeType.toString().toLowerCase().indexOf("audio")||(t.mimeType=f?"audio/webm":"audio/ogg"),t.mimeType&&"audio/ogg"!==t.mimeType.toString().toLowerCase()&&navigator.mozGetUserMedia&&(t.mimeType="audio/ogg")}var r,o=[];function a(){i.timestamps.push((new Date).getTime()),"function"==typeof t.onTimeStamp&&t.onTimeStamp(i.timestamps[i.timestamps.length-1],i.timestamps)}function n(e){return r&&r.mimeType?r.mimeType:e.mimeType||"video/webm"}function l(){o=[],r=null,i.timestamps=[]}this.getArrayOfBlobs=function(){return o},this.record=function(){i.blob=null,i.clearRecordedData(),i.timestamps=[],d=[],o=[];var s=t;t.disableLogs||console.log("Passing following config over MediaRecorder API.",s),r&&(r=null),f&&!S()&&(s="video/vp8"),"function"==typeof MediaRecorder.isTypeSupported&&s.mimeType&&(MediaRecorder.isTypeSupported(s.mimeType)||(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",s.mimeType),s.mimeType="audio"===t.type?"audio/webm":"video/webm"));try{r=new MediaRecorder(e,s),t.mimeType=s.mimeType}catch(t){r=new MediaRecorder(e)}s.mimeType&&!MediaRecorder.isTypeSupported&&"canRecordMimeType"in r&&!1===r.canRecordMimeType(s.mimeType)&&(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",s.mimeType)),r.ondataavailable=function(e){if(e.data&&d.push("ondataavailable: "+y(e.data.size)),"number"!=typeof t.timeSlice)!e.data||!e.data.size||e.data.size<100||i.blob?i.recordingCallback&&(i.recordingCallback(new Blob([],{type:n(s)})),i.recordingCallback=null):(i.blob=t.getNativeBlob?e.data:new Blob([e.data],{type:n(s)}),i.recordingCallback&&(i.recordingCallback(i.blob),i.recordingCallback=null));else if(e.data&&e.data.size&&(o.push(e.data),a(),"function"==typeof t.ondataavailable)){var r=t.getNativeBlob?e.data:new Blob([e.data],{type:n(s)});t.ondataavailable(r)}},r.onstart=function(){d.push("started")},r.onpause=function(){d.push("paused")},r.onresume=function(){d.push("resumed")},r.onstop=function(){d.push("stopped")},r.onerror=function(e){e&&(e.name||(e.name="UnknownError"),d.push("error: "+e),t.disableLogs||(-1!==e.name.toString().toLowerCase().indexOf("invalidstate")?console.error("The MediaRecorder is not in a state in which the proposed operation is allowed to be executed.",e):-1!==e.name.toString().toLowerCase().indexOf("notsupported")?console.error("MIME type (",s.mimeType,") is not supported.",e):-1!==e.name.toString().toLowerCase().indexOf("security")?console.error("MediaRecorder security error",e):"OutOfMemory"===e.name?console.error("The UA has exhaused the available memory. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"IllegalStreamModification"===e.name?console.error("A modification to the stream has occurred that makes it impossible to continue recording. An example would be the addition of a Track while recording is occurring. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"OtherRecordingError"===e.name?console.error("Used for an fatal error other than those listed above. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"GenericError"===e.name?console.error("The UA cannot provide the codec or recording option that has been requested.",e):console.error("MediaRecorder Error",e)),function(e){if(!i.manuallyStopped&&r&&"inactive"===r.state)return delete t.timeslice,void r.start(6e5);setTimeout(void 0,1e3)}(),"inactive"!==r.state&&"stopped"!==r.state&&r.stop())},"number"==typeof t.timeSlice?(a(),r.start(t.timeSlice)):r.start(36e5),t.initCallback&&t.initCallback()},this.timestamps=[],this.stop=function(e){e=e||function(){},i.manuallyStopped=!0,r&&(this.recordingCallback=e,"recording"===r.state&&r.stop(),"number"==typeof t.timeSlice&&setTimeout((function(){i.blob=new Blob(o,{type:n(t)}),i.recordingCallback(i.blob)}),100))},this.pause=function(){r&&"recording"===r.state&&r.pause()},this.resume=function(){r&&"paused"===r.state&&r.resume()},this.clearRecordedData=function(){r&&"recording"===r.state&&i.stop(l),l()},this.getInternalRecorder=function(){return r},this.blob=null,this.getState=function(){return r&&r.state||"inactive"};var d=[];this.getAllStates=function(){return d},void 0===t.checkForInactiveTracks&&(t.checkForInactiveTracks=!1);i=this;!function s(){if(r&&!1!==t.checkForInactiveTracks)return!1===function(){if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}()?(t.disableLogs||console.log("MediaStream seems stopped."),void i.stop()):void setTimeout(s,1e3)}(),this.name="MediaStreamRecorder",this.toString=function(){return this.name}}function T(e,i){if(!v(e,"audio").length)throw"Your stream has no audio tracks.";var s,r=this,o=[],a=[],n=!1,l=0,d=2,c=(i=i||{}).desiredSampRate;function u(){if(!1===i.checkForInactiveTracks)return!0;if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}function p(e,t){function i(e,t){var i,s=e.numberOfAudioChannels,r=e.leftBuffers.slice(0),o=e.rightBuffers.slice(0),a=e.sampleRate,n=e.internalInterleavedLength,l=e.desiredSampRate;function d(e,t,i){var s=Math.round(e.length*(t/i)),r=[],o=Number((e.length-1)/(s-1));r[0]=e[0];for(var a=1;a96e3)&&(i.disableLogs||console.log("sample-rate must be under range 22050 and 96000.")),i.disableLogs||i.desiredSampRate&&console.log("Desired sample-rate: "+i.desiredSampRate);var b=!1;function _(){o=[],a=[],l=0,S=!1,n=!1,b=!1,f=null,r.leftchannel=o,r.rightchannel=a,r.numberOfAudioChannels=d,r.desiredSampRate=c,r.sampleRate=A,r.recordingLength=l,E={left:[],right:[],recordingLength:0}}function w(){s&&(s.onaudioprocess=null,s.disconnect(),s=null),m&&(m.disconnect(),m=null),_()}this.pause=function(){b=!0},this.resume=function(){if(!1===u())throw"Please make sure MediaStream is active.";if(!n)return i.disableLogs||console.log("Seems recording has been restarted."),void this.record();b=!1},this.clearRecordedData=function(){i.checkForInactiveTracks=!1,n&&this.stop(w),w()},this.name="StereoAudioRecorder",this.toString=function(){return this.name};var S=!1;s.onaudioprocess=function(e){if(!b)if(!1===u()&&(i.disableLogs||console.log("MediaStream seems stopped."),s.disconnect(),n=!1),n){S||(S=!0,i.onAudioProcessStarted&&i.onAudioProcessStarted(),i.initCallback&&i.initCallback());var t=e.inputBuffer.getChannelData(0),h=new Float32Array(t);if(o.push(h),2===d){var c=e.inputBuffer.getChannelData(1),p=new Float32Array(c);a.push(p)}l+=y,r.recordingLength=l,void 0!==i.timeSlice&&(E.recordingLength+=y,E.left.push(h),2===d&&E.right.push(p))}else m&&(m.disconnect(),m=null)},f.createMediaStreamDestination?s.connect(f.createMediaStreamDestination()):s.connect(f.destination),this.leftchannel=o,this.rightchannel=a,this.numberOfAudioChannels=d,this.desiredSampRate=c,this.sampleRate=A,r.recordingLength=l;var E={left:[],right:[],recordingLength:0};function T(){n&&"function"==typeof i.ondataavailable&&void 0!==i.timeSlice&&(E.left.length?(p({desiredSampRate:c,sampleRate:A,numberOfAudioChannels:d,internalInterleavedLength:E.recordingLength,leftBuffers:E.left,rightBuffers:1===d?[]:E.right},(function(e,t){var s=new Blob([t],{type:"audio/wav"});i.ondataavailable(s),setTimeout(T,i.timeSlice)})),E={left:[],right:[],recordingLength:0}):setTimeout(T,i.timeSlice))}}function k(e,t){if("undefined"==typeof html2canvas)throw"Please link: https://www.webrtc-experiment.com/screenshot.js";(t=t||{}).frameInterval||(t.frameInterval=10);var i=!1;["captureStream","mozCaptureStream","webkitCaptureStream"].forEach((function(e){e in document.createElement("canvas")&&(i=!0)}));var s,r,o,a=!(!window.webkitRTCPeerConnection&&!window.webkitGetUserMedia||!window.chrome),n=50,l=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);if(a&&l&&l[2]&&(n=parseInt(l[2],10)),a&&n<52&&(i=!1),t.useWhammyRecorder&&(i=!1),i)if(t.disableLogs||console.log("Your browser supports both MediRecorder API and canvas.captureStream!"),e instanceof HTMLCanvasElement)s=e;else{if(!(e instanceof CanvasRenderingContext2D))throw"Please pass either HTMLCanvasElement or CanvasRenderingContext2D.";s=e.canvas}else navigator.mozGetUserMedia&&(t.disableLogs||console.error("Canvas recording is NOT supported in Firefox."));this.record=function(){if(o=!0,i&&!t.useWhammyRecorder){var e;"captureStream"in s?e=s.captureStream(25):"mozCaptureStream"in s?e=s.mozCaptureStream(25):"webkitCaptureStream"in s&&(e=s.webkitCaptureStream(25));try{var a=new g;a.addTrack(v(e,"video")[0]),e=a}catch(e){}if(!e)throw"captureStream API are NOT available.";(r=new E(e,{mimeType:t.mimeType||"video/webm"})).record()}else p.frames=[],u=(new Date).getTime(),c();t.initCallback&&t.initCallback()},this.getWebPImages=function(i){if("canvas"===e.nodeName.toLowerCase()){var s=p.frames.length;p.frames.forEach((function(e,i){var r=s-i;t.disableLogs||console.log(r+"/"+s+" frames remaining"),t.onEncodingCallback&&t.onEncodingCallback(r,s);var o=e.image.toDataURL("image/webp",1);p.frames[i].image=o})),t.disableLogs||console.log("Generating WebM"),i()}else i()},this.stop=function(e){o=!1;var s=this;i&&r?r.stop(e):this.getWebPImages((function(){p.compile((function(i){t.disableLogs||console.log("Recording finished!"),s.blob=i,s.blob.forEach&&(s.blob=new Blob([],{type:"video/webm"})),e&&e(s.blob),p.frames=[]}))}))};var d=!1;function h(){p.frames=[],o=!1,d=!1}function c(){if(d)return u=(new Date).getTime(),setTimeout(c,500);if("canvas"===e.nodeName.toLowerCase()){var i=(new Date).getTime()-u;return u=(new Date).getTime(),p.frames.push({image:(s=document.createElement("canvas"),r=s.getContext("2d"),s.width=e.width,s.height=e.height,r.drawImage(e,0,0),s),duration:i}),void(o&&setTimeout(c,t.frameInterval))}var s,r;html2canvas(e,{grabMouse:void 0===t.showMousePointer||t.showMousePointer,onrendered:function(e){var i=(new Date).getTime()-u;if(!i)return setTimeout(c,t.frameInterval);u=(new Date).getTime(),p.frames.push({image:e.toDataURL("image/webp",1),duration:i}),o&&setTimeout(c,t.frameInterval)}})}this.pause=function(){d=!0,r instanceof E&&r.pause()},this.resume=function(){d=!1,r instanceof E?r.resume():o||this.record()},this.clearRecordedData=function(){o&&this.stop(h),h()},this.name="CanvasRecorder",this.toString=function(){return this.name};var u=(new Date).getTime(),p=new C.Video(100)}function L(e,t){function i(e){e=void 0!==e?e:10;var t=(new Date).getTime()-l;return t?o?(l=(new Date).getTime(),setTimeout(i,100)):(l=(new Date).getTime(),n.paused&&n.play(),c.drawImage(n,0,0,h.width,h.height),d.frames.push({duration:t,image:h.toDataURL("image/webp")}),void(r||setTimeout(i,e,e))):setTimeout(i,e,e)}function s(e,t,i,s,r){var o=document.createElement("canvas");o.width=h.width,o.height=h.height;var a=o.getContext("2d"),n=[],l=-1===t,d=t&&t>0&&t<=e.length?t:e.length,c=0,u=0,p=0,f=Math.sqrt(Math.pow(255,2)+Math.pow(255,2)+Math.pow(255,2)),m=i&&i>=0&&i<=1?i:0,g=s&&s>=0&&s<=1?s:0,y=!1;!function(e){var t=-1,i=e.length;!function s(){++t!==i?setTimeout((function(){e.functionToLoop(s,t)}),1):e.callback()}()}({length:d,functionToLoop:function(t,i){var s,r,o,d=function(){!y&&o-s<=o*g||(l&&(y=!0),n.push(e[i])),t()};if(y)d();else{var A=new Image;A.onload=function(){a.drawImage(A,0,0,h.width,h.height);var e=a.getImageData(0,0,h.width,h.height);s=0,r=e.data.length,o=e.data.length/4;for(var t=0;t127)throw"TrackNumber > 127 not supported";return[128|e.trackNum,e.timecode>>8,255&e.timecode,t].map((function(e){return String.fromCharCode(e)})).join("")+e.frame}({discardable:0,frame:e.data.slice(4),invisible:0,keyframe:1,lacing:0,trackNum:1,timecode:Math.round(t)});return t+=e.duration,{data:i,id:163}})))}function i(e){for(var t=[];e>0;)t.push(255&e),e>>=8;return new Uint8Array(t.reverse())}function s(e){var t=[];e=(e.length%8?new Array(9-e.length%8).join("0"):"")+e;for(var i=0;i1?2*o[0].width:o[0].width;var n=1;3!==e&&4!==e||(n=2),5!==e&&6!==e||(n=3),7!==e&&8!==e||(n=4),9!==e&&10!==e||(n=5),r.height=o[0].height*n}else r.width=a.width||360,r.height=a.height||240;t&&t instanceof HTMLVideoElement&&u(t),o.forEach((function(e,t){u(e,t)})),setTimeout(c,a.frameInterval)}}function u(e,t){if(!s){var i=0,r=0,a=e.width,n=e.height;1===t&&(i=e.width),2===t&&(r=e.height),3===t&&(i=e.width,r=e.height),4===t&&(r=2*e.height),5===t&&(i=e.width,r=2*e.height),6===t&&(r=3*e.height),7===t&&(i=e.width,r=3*e.height),void 0!==e.stream.left&&(i=e.stream.left),void 0!==e.stream.top&&(r=e.stream.top),void 0!==e.stream.width&&(a=e.stream.width),void 0!==e.stream.height&&(n=e.stream.height),o.drawImage(e,i,r,a,n),"function"==typeof e.stream.onRender&&e.stream.onRender(o,i,r,a,n,t)}}function p(e){var i=document.createElement("video");return function(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}(e,i),i.className=t,i.muted=!0,i.volume=0,i.width=e.width||a.width||360,i.height=e.height||a.height||240,i.play(),i}function f(t){i=[],(t=t||e).forEach((function(e){if(e.getTracks().filter((function(e){return"video"===e.kind})).length){var t=p(e);t.stream=e,i.push(t)}}))}void 0!==n?h.AudioContext=n:"undefined"!=typeof webkitAudioContext&&(h.AudioContext=webkitAudioContext),this.startDrawingFrames=function(){c()},this.appendStreams=function(t){if(!t)throw"First parameter is required.";t instanceof Array||(t=[t]),t.forEach((function(t){var s=new d;if(t.getTracks().filter((function(e){return"video"===e.kind})).length){var r=p(t);r.stream=t,i.push(r),s.addTrack(t.getTracks().filter((function(e){return"video"===e.kind}))[0])}if(t.getTracks().filter((function(e){return"audio"===e.kind})).length){var o=a.audioContext.createMediaStreamSource(t);a.audioDestination=a.audioContext.createMediaStreamDestination(),o.connect(a.audioDestination),s.addTrack(a.audioDestination.stream.getTracks().filter((function(e){return"audio"===e.kind}))[0])}e.push(s)}))},this.releaseStreams=function(){i=[],s=!0,a.gainNode&&(a.gainNode.disconnect(),a.gainNode=null),a.audioSources.length&&(a.audioSources.forEach((function(e){e.disconnect()})),a.audioSources=[]),a.audioDestination&&(a.audioDestination.disconnect(),a.audioDestination=null),a.audioContext&&a.audioContext.close(),a.audioContext=null,o.clearRect(0,0,r.width,r.height),r.stream&&(r.stream.stop(),r.stream=null)},this.resetVideoStreams=function(e){!e||e instanceof Array||(e=[e]),f(e)},this.name="MultiStreamsMixer",this.toString=function(){return this.name},this.getMixedStream=function(){s=!1;var t=function(){var e;f(),"captureStream"in r?e=r.captureStream():"mozCaptureStream"in r?e=r.mozCaptureStream():a.disableLogs||console.error("Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features");var t=new d;return e.getTracks().filter((function(e){return"video"===e.kind})).forEach((function(e){t.addTrack(e)})),r.stream=t,t}(),i=function(){h.AudioContextConstructor||(h.AudioContextConstructor=new h.AudioContext);a.audioContext=h.AudioContextConstructor,a.audioSources=[],!0===a.useGainNode&&(a.gainNode=a.audioContext.createGain(),a.gainNode.connect(a.audioContext.destination),a.gainNode.gain.value=0);var t=0;if(e.forEach((function(e){if(e.getTracks().filter((function(e){return"audio"===e.kind})).length){t++;var i=a.audioContext.createMediaStreamSource(e);!0===a.useGainNode&&i.connect(a.gainNode),a.audioSources.push(i)}})),!t)return;return a.audioDestination=a.audioContext.createMediaStreamDestination(),a.audioSources.forEach((function(e){e.connect(a.audioDestination)})),a.audioDestination.stream}();return i&&i.getTracks().filter((function(e){return"audio"===e.kind})).forEach((function(e){t.addTrack(e)})),e.forEach((function(e){e.fullcanvas})),t}}function P(e,t){e=e||[];var i,s,r=this;(t=t||{elementClass:"multi-streams-mixer",mimeType:"video/webm",video:{width:360,height:240}}).frameInterval||(t.frameInterval=10),t.video||(t.video={}),t.video.width||(t.video.width=360),t.video.height||(t.video.height=240),this.record=function(){var r;i=new R(e,t.elementClass||"multi-streams-mixer"),(r=[],e.forEach((function(e){v(e,"video").forEach((function(e){r.push(e)}))})),r).length&&(i.frameInterval=t.frameInterval||10,i.width=t.video.width||360,i.height=t.video.height||240,i.startDrawingFrames()),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()),(s=new E(i.getMixedStream(),t)).record()},this.stop=function(e){s&&s.stop((function(t){r.blob=t,e(t),r.clearRecordedData()}))},this.pause=function(){s&&s.pause()},this.resume=function(){s&&s.resume()},this.clearRecordedData=function(){s&&(s.clearRecordedData(),s=null),i&&(i.releaseStreams(),i=null)},this.addStreams=function(r){if(!r)throw"First parameter is required.";r instanceof Array||(r=[r]),e.concat(r),s&&i&&(i.appendStreams(r),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()))},this.resetVideoStreams=function(e){i&&(!e||e instanceof Array||(e=[e]),i.resetVideoStreams(e))},this.getMixer=function(){return i},this.name="MultiStreamRecorder",this.toString=function(){return this.name}}function I(e,t){var i,s,r;function o(){return new ReadableStream({start:function(s){var r=document.createElement("canvas"),o=document.createElement("video"),a=!0;o.srcObject=e,o.muted=!0,o.height=t.height,o.width=t.width,o.volume=0,o.onplaying=function(){r.width=t.width,r.height=t.height;var e=r.getContext("2d"),n=1e3/t.frameRate,l=setInterval((function(){if(i&&(clearInterval(l),s.close()),a&&(a=!1,t.onVideoProcessStarted&&t.onVideoProcessStarted()),e.drawImage(o,0,0),"closed"!==s._controlledReadableStream.state)try{s.enqueue(e.getImageData(0,0,t.width,t.height))}catch(e){}}),n)},o.play()}})}function a(e,l){if(!t.workerPath&&!l)return i=!1,void fetch("https://unpkg.com/webm-wasm@latest/dist/webm-worker.js").then((function(t){t.arrayBuffer().then((function(t){a(e,t)}))}));if(!t.workerPath&&l instanceof ArrayBuffer){var d=new Blob([l],{type:"text/javascript"});t.workerPath=h.createObjectURL(d)}t.workerPath||console.error("workerPath parameter is missing."),(s=new Worker(t.workerPath)).postMessage(t.webAssemblyPath||"https://unpkg.com/webm-wasm@latest/dist/webm-wasm.wasm"),s.addEventListener("message",(function(e){"READY"===e.data?(s.postMessage({width:t.width,height:t.height,bitrate:t.bitrate||1200,timebaseDen:t.frameRate||30,realtime:t.realtime}),o().pipeTo(new WritableStream({write:function(e){i?console.error("Got image, but recorder is finished!"):s.postMessage(e.data.buffer,[e.data.buffer])}}))):e.data&&(r||n.push(e.data))}))}"undefined"!=typeof ReadableStream&&"undefined"!=typeof WritableStream||console.error("Following polyfill is strongly recommended: https://unpkg.com/@mattiasbuelens/web-streams-polyfill/dist/polyfill.min.js"),(t=t||{}).width=t.width||640,t.height=t.height||480,t.frameRate=t.frameRate||30,t.bitrate=t.bitrate||1200,t.realtime=t.realtime||!0,this.record=function(){n=[],r=!1,this.blob=null,a(e),"function"==typeof t.initCallback&&t.initCallback()},this.pause=function(){r=!0},this.resume=function(){r=!1};var n=[];this.stop=function(e){i=!0;var t=this;!function(e){s?(s.addEventListener("message",(function(t){null===t.data&&(s.terminate(),s=null,e&&e())})),s.postMessage(null)):e&&e()}((function(){t.blob=new Blob(n,{type:"video/webm"}),e(t.blob)}))},this.name="WebAssemblyRecorder",this.toString=function(){return this.name},this.clearRecordedData=function(){n=[],r=!1,this.blob=null},this.blob=null}t.DiskStorage=x,t.GifRecorder=D,t.MultiStreamRecorder=P,t.RecordRTCPromisesHandler=function(e,i){if(!this)throw'Use "new RecordRTCPromisesHandler()"';if(void 0===e)throw'First argument "MediaStream" is required.';var s=this;s.recordRTC=new t(e,i),this.startRecording=function(){return new Promise((function(e,t){try{s.recordRTC.startRecording(),e()}catch(e){t(e)}}))},this.stopRecording=function(){return new Promise((function(e,t){try{s.recordRTC.stopRecording((function(i){s.blob=s.recordRTC.getBlob(),s.blob&&s.blob.size?e(i):t("Empty blob.",s.blob)}))}catch(e){t(e)}}))},this.pauseRecording=function(){return new Promise((function(e,t){try{s.recordRTC.pauseRecording(),e()}catch(e){t(e)}}))},this.resumeRecording=function(){return new Promise((function(e,t){try{s.recordRTC.resumeRecording(),e()}catch(e){t(e)}}))},this.getDataURL=function(e){return new Promise((function(e,t){try{s.recordRTC.getDataURL((function(t){e(t)}))}catch(e){t(e)}}))},this.getBlob=function(){return new Promise((function(e,t){try{e(s.recordRTC.getBlob())}catch(e){t(e)}}))},this.getInternalRecorder=function(){return new Promise((function(e,t){try{e(s.recordRTC.getInternalRecorder())}catch(e){t(e)}}))},this.reset=function(){return new Promise((function(e,t){try{e(s.recordRTC.reset())}catch(e){t(e)}}))},this.destroy=function(){return new Promise((function(e,t){try{e(s.recordRTC.destroy())}catch(e){t(e)}}))},this.getState=function(){return new Promise((function(e,t){try{e(s.recordRTC.getState())}catch(e){t(e)}}))},this.blob=null,this.version="5.6.2"},t.WebAssemblyRecorder=I}));class In{static _ebsp2rbsp(e){let t=e,i=t.byteLength,s=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(s[r]=t[e],r++);return new Uint8Array(s.buffer,0,r)}static parseSPS(e){let t=In._ebsp2rbsp(e),i=new Ir(t);i.readByte();let s=i.readByte();i.readByte();let r=i.readByte();i.readUEG();let o=In.getProfileString(s),a=In.getLevelString(r),n=1,l=420,d=[0,420,422,444],h=8;if((100===s||110===s||122===s||244===s||44===s||83===s||86===s||118===s||128===s||138===s||144===s)&&(n=i.readUEG(),3===n&&i.readBits(1),n<=3&&(l=d[n]),h=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool())){let e=3!==n?8:12;for(let t=0;t0&&e<16?(v=t[e-1],_=s[e-1]):255===e&&(v=i.readByte()<<8|i.readByte(),_=i.readByte()<<8|i.readByte())}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool()&&i.readBits(24)),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool()){let e=i.readBits(32),t=i.readBits(32);S=i.readBool(),E=t,T=2*e,w=E/T}}let k=1;1===v&&1===_||(k=v/_);let L=0,C=0;if(0===n)L=1,C=2-m;else{L=3===n?1:2,C=(1===n?2:1)*(2-m)}let x=16*(p+1),D=16*(f+1)*(2-m);x-=(g+y)*L,D-=(A+b)*C;let R=Math.ceil(x*k);return i.destroy(),i=null,{profile_string:o,level_string:a,bit_depth:h,ref_frames:u,chroma_format:l,chroma_format_string:In.getChromaFormatString(l),frame_rate:{fixed:S,fps:w,fps_den:T,fps_num:E},sar_ratio:{width:v,height:_},codec_size:{width:x,height:D},present_size:{width:R,height:D}}}static parseSPS$2(e){let t=e.subarray(1,4),i="avc1.";for(let e=0;e<3;e++){let s=t[e].toString(16);s.length<2&&(s="0"+s),i+=s}let s=In._ebsp2rbsp(e),r=new Ir(s);r.readByte();let o=r.readByte();r.readByte();let a=r.readByte();r.readUEG();let n=In.getProfileString(o),l=In.getLevelString(a),d=1,h=420,c=[0,420,422,444],u=8,p=8;if((100===o||110===o||122===o||244===o||44===o||83===o||86===o||118===o||128===o||138===o||144===o)&&(d=r.readUEG(),3===d&&r.readBits(1),d<=3&&(h=c[d]),u=r.readUEG()+8,p=r.readUEG()+8,r.readBits(1),r.readBool())){let e=3!==d?8:12;for(let t=0;t0&&e<16?(S=t[e-1],E=i[e-1]):255===e&&(S=r.readByte()<<8|r.readByte(),E=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);k=r.readBool(),L=t,C=2*e,T=L/C}}let x=1;1===S&&1===E||(x=S/E);let D=0,R=0;if(0===d)D=1,R=2-A;else{D=3===d?1:2,R=(1===d?2:1)*(2-A)}let P=16*(g+1),I=16*(y+1)*(2-A);P-=(b+v)*D,I-=(_+w)*R;let B=Math.ceil(P*x);return r.destroy(),r=null,{codec_mimetype:i,profile_idc:o,level_idc:a,profile_string:n,level_string:l,chroma_format_idc:d,bit_depth:u,bit_depth_luma:u,bit_depth_chroma:p,ref_frames:m,chroma_format:h,chroma_format_string:In.getChromaFormatString(h),frame_rate:{fixed:k,fps:T,fps_den:C,fps_num:L},sar_ratio:{width:S,height:E},codec_size:{width:P,height:I},present_size:{width:B,height:I}}}static _skipScalingList(e,t){let i=8,s=8,r=0;for(let o=0;o=this.buflen)return this.iserro=!0,0;this.iserro=!1,i=this.bufoff+e>8?8-this.bufoff:e,t<<=i,t+=this.buffer[this.bufpos]>>8-this.bufoff-i&255>>8-i,this.bufoff+=i,e-=i,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,i=this.bufoff,s=this.read(e);return this.bufpos=t,this.bufoff=i,s}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),s=new Uint8Array(e+4);s.set(i,0),s.set(t.sps,4),t.sps=s}if(t.pps){const e=t.pps.byteLength,i=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),s=new Uint8Array(e+4);s.set(i,0),s.set(t.pps,4),t.pps=s}return t}function Fn(e){let{sps:t,pps:i}=e,s=8+t.byteLength+1+2+i.byteLength,r=!1;const o=In.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(r=!0,s+=4);let a=new Uint8Array(s);a[0]=1,a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=255,a[5]=225;let n=t.byteLength;a[6]=n>>>8,a[7]=255&n;let l=8;a.set(t,8),l+=n,a[l]=1;let d=i.byteLength;a[l+1]=d>>>8,a[l+2]=255&d,a.set(i,l+3),l+=3+d,r&&(a[l]=252|o.chroma_format_idc,a[l+1]=248|o.bit_depth_luma-8,a[l+2]=248|o.bit_depth_chroma-8,a[l+3]=0,l+=4);const h=[23,0,0,0,0],c=new Uint8Array(h.length+a.byteLength);return c.set(h,0),c.set(a,h.length),c}function Un(e,t){let i=[];i[0]=t?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}function On(e){return 31&e[0]}function Nn(e){return e===Pt}function jn(e){return!function(e){return e===Lt||e===Ct}(e)&&!Nn(e)}function Gn(e){return e===xt}class Wn{constructor(e){this.data=e,this.eofFlag=!1,this.currentStartcodeOffset=this.findNextStartCodeOffset(0),this.eofFlag&&console.error("Could not find H264 startcode until payload end!")}findNextStartCodeOffset(e){let t=e,i=this.data;for(;;){if(t+3>=i.byteLength)return this.eofFlag=!0,i.byteLength;let e=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],s=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===e||1===s)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let i=this.currentStartcodeOffset;i+=1===(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3;let s=31&e[i],r=(128&e[i])>>>7,o=this.findNextStartCodeOffset(i);this.currentStartcodeOffset=o,s>=Mt||0===r&&(t={type:s,data:e.subarray(i,o)})}return t}}class zn{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const $n=e=>{let t=e,i=t.byteLength,s=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(s[r]=t[e],r++);return new Uint8Array(s.buffer,0,r)},Vn=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Hn{static _ebsp2rbsp(e){let t=e,i=t.byteLength,s=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(s[r]=t[e],r++);return new Uint8Array(s.buffer,0,r)}static parseVPS(e){let t=Hn._ebsp2rbsp(e),i=new Ir(t);return i.readByte(),i.readByte(),i.readBits(4),i.readBits(2),i.readBits(6),{num_temporal_layers:i.readBits(3)+1,temporal_id_nested:i.readBool()}}static parseSPS(e){let t=Hn._ebsp2rbsp(e),i=new Ir(t);i.readByte(),i.readByte();let s=0,r=0,o=0,a=0;i.readBits(4);let n=i.readBits(3);i.readBool();let l=i.readBits(2),d=i.readBool(),h=i.readBits(5),c=i.readByte(),u=i.readByte(),p=i.readByte(),f=i.readByte(),m=i.readByte(),g=i.readByte(),y=i.readByte(),A=i.readByte(),b=i.readByte(),v=i.readByte(),_=i.readByte(),w=[],S=[];for(let e=0;e0)for(let e=n;e<8;e++)i.readBits(2);for(let e=0;e1&&i.readSEG();for(let e=0;e0&&e<=16?(B=t[e-1],M=s[e-1]):255===e&&(B=i.readBits(16),M=i.readBits(16))}if(i.readBool()&&i.readBool(),i.readBool()){i.readBits(3),i.readBool(),i.readBool()&&(i.readByte(),i.readByte(),i.readByte())}if(i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool(),i.readBool(),i.readBool(),P=i.readBool(),P&&(i.readUEG(),i.readUEG(),i.readUEG(),i.readUEG()),i.readBool()){if(U=i.readBits(32),O=i.readBits(32),i.readBool()&&i.readUEG(),i.readBool()){let e=!1,t=!1,s=!1;e=i.readBool(),t=i.readBool(),(e||t)&&(s=i.readBool(),s&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),s&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(let r=0;r<=n;r++){let r=i.readBool();F=r;let o=!0,a=1;r||(o=i.readBool());let n=!1;if(o?i.readUEG():n=i.readBool(),n||(a=i.readUEG()+1),e){for(let e=0;e>6&3,i.general_tier_flag=e[1]>>5&1,i.general_profile_idc=31&e[1],i.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],i.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],i.general_constraint_indicator_flags=i.general_constraint_indicator_flags<<16|e[10]<<8|e[11],i.general_level_idc=e[12],i.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],i.parallelismType=3&e[15],i.chromaFormat=3&e[16],i.bitDepthLumaMinus8=7&e[17],i.bitDepthChromaMinus8=7&e[18],i.avgFrameRate=e[19]<<8|e[20],i.constantFrameRate=e[21]>>6&3,i.numTemporalLayers=e[21]>>3&7,i.temporalIdNested=e[21]>>2&1,i.lengthSizeMinusOne=3&e[21];let s=e[22],r=e.slice(23);for(let e=0;e0)for(let t=i;t<8;t++)e.read(2);s.sub_layer_profile_space=[],s.sub_layer_tier_flag=[],s.sub_layer_profile_idc=[],s.sub_layer_profile_compatibility_flag=[],s.sub_layer_progressive_source_flag=[],s.sub_layer_interlaced_source_flag=[],s.sub_layer_non_packed_constraint_flag=[],s.sub_layer_frame_only_constraint_flag=[],s.sub_layer_level_idc=[];for(let t=0;t{let t=$n(e),i=new Ir(t);return i.readByte(),i.readByte(),i.readBits(4),i.readBits(2),i.readBits(6),{num_temporal_layers:i.readBits(3)+1,temporal_id_nested:i.readBool()}})(t),a=(e=>{let t=$n(e),i=new Ir(t);i.readByte(),i.readByte();let s=0,r=0,o=0,a=0;i.readBits(4);let n=i.readBits(3);i.readBool();let l=i.readBits(2),d=i.readBool(),h=i.readBits(5),c=i.readByte(),u=i.readByte(),p=i.readByte(),f=i.readByte(),m=i.readByte(),g=i.readByte(),y=i.readByte(),A=i.readByte(),b=i.readByte(),v=i.readByte(),_=i.readByte(),w=[],S=[];for(let e=0;e0)for(let e=n;e<8;e++)i.readBits(2);for(let e=0;e1&&i.readSEG();for(let e=0;e0&&e<16?(B=t[e-1],M=s[e-1]):255===e&&(B=i.readBits(16),M=i.readBits(16))}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(3),i.readBool(),i.readBool()&&(i.readByte(),i.readByte(),i.readByte())),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool(),i.readBool(),i.readBool(),P=i.readBool(),P&&(s+=i.readUEG(),r+=i.readUEG(),o+=i.readUEG(),a+=i.readUEG()),i.readBool()&&(U=i.readBits(32),O=i.readBits(32),i.readBool()&&(i.readUEG(),i.readBool()))){let e=!1,t=!1,s=!1;e=i.readBool(),t=i.readBool(),(e||t)&&(s=i.readBool(),s&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),s&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(let r=0;r<=n;r++){let r=i.readBool();F=r;let o=!1,a=1;r||(o=i.readBool());let n=!1;if(o?i.readSEG():n=i.readBool(),n||(cpbcnt=i.readUEG()+1),e)for(let e=0;e{let t=$n(e),i=new Ir(t);i.readByte(),i.readByte(),i.readUEG(),i.readUEG(),i.readBool(),i.readBool(),i.readBits(3),i.readBool(),i.readBool(),i.readUEG(),i.readUEG(),i.readSEG(),i.readBool(),i.readBool(),i.readBool()&&i.readUEG(),i.readSEG(),i.readSEG(),i.readBool(),i.readBool(),i.readBool(),i.readBool();let s=i.readBool(),r=i.readBool(),o=1;return r&&s?o=0:r?o=3:s&&(o=2),{parallelismType:o}})(i);r=Object.assign(r,o,a,n);let l=23+(5+t.byteLength)+(5+s.byteLength)+(5+i.byteLength),d=new Uint8Array(l);d[0]=1,d[1]=(3&r.general_profile_space)<<6|(r.general_tier_flag?1:0)<<5|31&r.general_profile_idc,d[2]=r.general_profile_compatibility_flags_1||0,d[3]=r.general_profile_compatibility_flags_2||0,d[4]=r.general_profile_compatibility_flags_3||0,d[5]=r.general_profile_compatibility_flags_4||0,d[6]=r.general_constraint_indicator_flags_1||0,d[7]=r.general_constraint_indicator_flags_2||0,d[8]=r.general_constraint_indicator_flags_3||0,d[9]=r.general_constraint_indicator_flags_4||0,d[10]=r.general_constraint_indicator_flags_5||0,d[11]=r.general_constraint_indicator_flags_6||0,d[12]=60,d[13]=240|(3840&r.min_spatial_segmentation_idc)>>8,d[14]=255&r.min_spatial_segmentation_idc,d[15]=252|3&r.parallelismType,d[16]=252|3&r.chroma_format_idc,d[17]=248|7&r.bit_depth_luma_minus8,d[18]=248|7&r.bit_depth_chroma_minus8,d[19]=0,d[20]=0,d[21]=(3&r.constant_frame_rate)<<6|(7&r.num_temporal_layers)<<3|(r.temporal_id_nested?1:0)<<2|3,d[22]=3,d[23]=128|Wt,d[24]=0,d[25]=1,d[26]=(65280&t.byteLength)>>8,d[27]=(255&t.byteLength)>>0,d.set(t,28),d[23+(5+t.byteLength)+0]=128|$t,d[23+(5+t.byteLength)+1]=0,d[23+(5+t.byteLength)+2]=1,d[23+(5+t.byteLength)+3]=(65280&s.byteLength)>>8,d[23+(5+t.byteLength)+4]=(255&s.byteLength)>>0,d.set(s,23+(5+t.byteLength)+5),d[23+(5+t.byteLength+5+s.byteLength)+0]=128|Ht,d[23+(5+t.byteLength+5+s.byteLength)+1]=0,d[23+(5+t.byteLength+5+s.byteLength)+2]=1,d[23+(5+t.byteLength+5+s.byteLength)+3]=(65280&i.byteLength)>>8,d[23+(5+t.byteLength+5+s.byteLength)+4]=(255&i.byteLength)>>0,d.set(i,23+(5+t.byteLength+5+s.byteLength)+5);const h=[28,0,0,0,0],c=new Uint8Array(h.length+d.byteLength);return c.set(h,0),c.set(d,h.length),c}function Qn(e,t){let i=[];i[0]=t?28:44,i[1]=1,i[2]=0,i[3]=0,i[4]=0;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}function Xn(e){return(126&e[0])>>1}function Zn(e){return!function(e){return e>=32&&e<=40}(e)}function el(e){return e>=16&&e<=21}class tl{constructor(e){this.data=e,this.eofFlag=!1,this.currentStartcodeOffset=this.findNextStartCodeOffset(0),this.eofFlag&&console.error("Could not find H265 startcode until payload end!")}findNextStartCodeOffset(e){let t=e,i=this.data;for(;;){if(t+3>=i.byteLength)return this.eofFlag=!0,i.byteLength;let e=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],s=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===e||1===s)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let i=this.currentStartcodeOffset;i+=1===(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3;let s=e[i]>>1&63,r=(128&e[i])>>>7,o=this.findNextStartCodeOffset(i);this.currentStartcodeOffset=o,0===r&&(t={type:s,data:e.subarray(i,o)})}return t}}class il{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}class sl extends o{constructor(e){super(),this.TAG_NAME="recorderCommon",this.player=e,this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.recordingInterval=null,this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.audioCodeId=null,this.metaInfo={codecWidth:0,codecHeight:0,presentWidth:0,presentHeight:0,refSampleDuration:0,timescale:1e3,avcc:null,videoType:""},this.audioMetaInfo={timescale:1e3,sampleRate:0,refSampleDuration:0,channelCount:0,codec:"",originalCodec:"",audioType:"",extraData:new Uint8Array(0)}}destroy(){this._reset(),this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.audioCodeId=null,this.metaInfo=null,this.audioMetaInfo=null}get isH264(){return this.codecId===At}get isH265(){return this.codecId===bt}setFileName(e){this.fileName=e}get isRecording(){return this._isRecording}get recording(){return this._isRecording}get recordTime(){return this._recordingTimestamp}startRecord(){}handleAddNaluTrack(e,t,i,s){}handleAddAudioTrack(e,t){}handleAddTrack(e){}stopRecordAndSave(){}startRecordingInterval(){}isWasmMp4(){return!1}stopRecordingInterval(){this.recordingInterval&&clearInterval(this.recordingInterval),this.recordingInterval=null}getToTalByteLength(){return 0}_reset(){this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.stopRecordingInterval()}initMetaData(e,t){let i;const s=e.slice(5);if(this.codecId=t,this.metaInfo.avcc=s,t===At)i=Mn(s);else if(t===bt){i=function(e){let t=23;const i=e[t];if((63&i)!==Wt)return console.warn(`parseHEVCDecoderVPSAndSPSAndPPS and vpsTag is ${i}`),{};t+=2,t+=1;const s=e[t+1]|e[t]<<8;t+=2;const r=e.slice(t,t+s);t+=s;const o=e[t];if((63&o)!==$t)return console.warn(`parseHEVCDecoderVPSAndSPSAndPPS and sps tag is ${o}`),{};t+=2,t+=1;const a=e[t+1]|e[t]<<8;t+=2;const n=e.slice(t,t+a);t+=a;const l=e[t];if((63&l)!==Ht)return console.warn(`parseHEVCDecoderVPSAndSPSAndPPS and pps tag is ${l}`),{};t+=2,t+=1;const d=e[t+1]|e[t]<<8;t+=2;const h=e.slice(t,t+d),c=new Uint8Array([a>>>24&255,a>>>16&255,a>>>8&255,255&a]),u=new Uint8Array([d>>>24&255,d>>>16&255,d>>>8&255,255&d]),p=new Uint8Array([s>>>24&255,s>>>16&255,s>>>8&255,255&s]),f=new Uint8Array(a+4);f.set(c,0),f.set(n,4);const m=new Uint8Array(d+4);m.set(u,0),m.set(h,4);const g=new Uint8Array(s+4);return g.set(p,0),g.set(r,4),{sps:f,pps:m,vps:g}}(s);const t=Jn(e);i=Object.assign(i,t)}i&&(i.vps&&(this.vps=i.vps),i.pps&&(this.pps=i.pps),i.sps&&(this.sps=i.sps),i.presentWidth&&(this.metaInfo.presentWidth=i.presentWidth),i.presentHeight&&(this.metaInfo.presentHeight=i.presentHeight),i.codecWidth&&(this.metaInfo.codecWidth=i.codecWidth),i.codecHeight&&(this.metaInfo.codecHeight=i.codecHeight),i.timescale&&(this.metaInfo.timescale=i.timescale),i.refSampleDuration&&(this.metaInfo.refSampleDuration=i.refSampleDuration),i.videoType&&(this.metaInfo.videoType=i.videoType))}initAudioMetaData(e,t){this.audioCodeId=t;const i=e[0]>>1&1;let s=null;t===wt?(s=function(e){let t={},i=new $r(e);return i.read(16),t.object_type=Vr(i),t.sample_rate=Hr(i,t),t.chan_config=i.read(4),t.chan_config{r.onload=function(e){i.decode(this.result).forEach((function(e){t.read(e)})),t.stop();const r=s.makeMetadataSeekable(t.metadatas,t.duration,t.cues),a=this.result.slice(t.metadataSize),n=new Blob([r,a],{type:"video/webm"});o(n)},r.readAsArrayBuffer(e)}))}startRecord(){const e={type:"video",mimeType:"video/webm;codecs=h264",timeSlice:1e3,onTimeStamp:e=>{this.player&&this.player.debugLog("RecorderRTC","record timestamp :"+e),null===this._startRecordingTimestamp&&(this._startRecordingTimestamp=e),this._recordingTimestamp=(e-this._startRecordingTimestamp)/1e3},ondataavailable:e=>{this.totalByteLength+=e.size,this.player&&this.player.debugLog("RecorderRTC","ondataavailable",e.size)},disableLogs:!this.player._opt.debug};try{let t=null;if(this.player.getRenderType()===H?t=this.player.video.$videoElement.captureStream(25):this.player.video.mediaStream?t=this.player.video.mediaStream:this.player.isOldHls()||this.player._opt.useMSE||this.player._opt.useWCS?t=this.player.video.$videoElement.captureStream(25):this.player.isWebrtcH264()?t=this.player.webrtc.videoStream:this.player.isAliyunRtc()&&(t=this.player.video.$videoElement.captureStream(25)),!t)return this.player.debugError("RecorderRTC","startRecord error and can not create stream"),void this.player.emitError(at.recordCreateError,"can not create stream");if(this.player.audio&&this.player.audio.mediaStreamAudioDestinationNode&&this.player.audio.mediaStreamAudioDestinationNode.stream&&!this.player.audio.isStateSuspended()&&this.player.audio.hasAudio&&this.player._opt.hasAudio){const e=this.player.audio.mediaStreamAudioDestinationNode.stream;if(e.getAudioTracks().length>0){const i=e.getAudioTracks()[0];i&&i.enabled&&t.addTrack(i)}}this.recorder=Pn(t,e)}catch(e){return this.player.debugError("RecorderRTC","startRecord error",e),void this.player.emitError(at.recordCreateError,e)}this.recorder&&(this._isRecording=!0,this.player.emit(at.recording,!0),this.recorder.startRecording(),this.player.debugLog("RecorderRTC","start recording"),this.player.emit(at.recordStart),this.startRecordingInterval())}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(at.recordingTimestamp,this._recordingTimestamp)}),1e3)}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:mt,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{this.recorder&&this._isRecording||s("recorder is not ready"),t&&this.setFileName(t),this.recorder.stopRecording((()=>{this.player.debugLog("RecorderRTC","stop recording");const t=(this.fileName||ro())+"."+E;if(this.player._opt.recordWebMSupportSeek);else{if(e===gt){const e=this.recorder.getBlob();i(e),this.player.emit(at.recordBlob,e)}else i(),this.recorder.save(t);this.player.emit(at.recordEnd),this._reset(),this.player.emit(at.recording,!1)}}))}))}cancelRecord(){return new Promise(((e,t)=>{if(this.player.debugLog(this.TAG_NAME,"cancel recording"),!this.recorder||!this._isRecording)return e();this.recorder.stopRecording((()=>{this._reset(),this.player.emit(at.recording,!1),this.player.emit(at.recordCancel),e()}))}))}getToTalByteLength(){return this.totalByteLength}getTotalDuration(){return this.recordTime}getType(){return E}initMetaData(){}}class ol{static init(){ol.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],free:[],edts:[],elst:[],stss:[]};for(let e in ol.types)ol.types.hasOwnProperty(e)&&(ol.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=ol.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,50,97,118,99,49,109,112,52,49,0,0,0,0]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,s=Array.prototype.slice.call(arguments,1),r=s.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let o=8;for(let e=0;e=Math.pow(2,32)-1?(o=16,a=new Uint8Array(i+o),a.set(new Uint8Array([0,0,0,1]),0),a.set(ol.types.mdat,4),a.set(new Uint8Array([i+8>>>56&255,i+8>>>48&255,i+8>>>40&255,i+8>>>32&255,i+8>>>24&255,i+8>>>16&255,i+8>>>8&255,i+8&255]),8)):(a=new Uint8Array(i+o),a[0]=i+8>>>24&255,a[1]=i+8>>>16&255,a[2]=i+8>>>8&255,a[3]=i+8&255,a.set(ol.types.mdat,4));for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3]))}static trak(e){return ol.box(ol.types.trak,ol.tkhd(e),ol.mdia(e))}static tkhd(e){let t=e.id,i=e.duration,s=e.presentWidth,r=e.presentHeight;return"video"===e.type?ol.box(ol.types.tkhd,new Uint8Array([0,0,0,15,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>>8&255,255&s,0,0,r>>>8&255,255&r,0,0])):"audio"===e.type?ol.box(ol.types.tkhd,new Uint8Array([0,0,0,15,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0])):void 0}static edts(e,t){return ol.box(ol.types.edts,ol.elst(e,t))}static elst(e,t){let i=0;for(let s=0;s>>24&255,i>>>16&255,i>>>8&255,255&i,255,255,255,255,0,1,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,0,0,0,0,0,1,0,0]))}static mdia(e){return ol.box(ol.types.mdia,ol.mdhd(e),ol.hdlr(e),ol.minf(e))}static mdhd(e){let t=e.timescale/e.refSampleDuration,i=t*e.duration/e.timescale;return ol.box(ol.types.mdhd,new Uint8Array([0,0,0,0,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?ol.constants.HDLR_AUDIO:ol.constants.HDLR_VIDEO,ol.box(ol.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?ol.box(ol.types.smhd,ol.constants.SMHD):ol.box(ol.types.vmhd,ol.constants.VMHD),ol.box(ol.types.minf,t,ol.dinf(),ol.stbl(e))}static dinf(){return ol.box(ol.types.dinf,ol.box(ol.types.dref,ol.constants.DREF))}static stbl(e){let t=e.samples,i=[{No:1,num:0,sampleDelte:1,chunkNo:1,duration:t[0].duration}],s=[t[0].duration],r=t.length;for(let e=0;e>>24&255,t>>>16&255,t>>>8&255,255&t]),s=i.byteLength,r=new Uint8Array(s+8*t);r.set(i,0);for(let i=0;i>>24&255,e[i].num>>>16&255,e[i].num>>>8&255,255&e[i].num,e[i].sampleDelte>>>24&255,e[i].sampleDelte>>>16&255,e[i].sampleDelte>>>8&255,255&e[i].sampleDelte]),s),s+=8;return ol.box(ol.types.stts,r)}static stss(e){let t=[],i=e.length;for(let s=0;s>>24&255,s>>>16&255,s>>>8&255,255&s]),o=r.byteLength,a=new Uint8Array(o+4*s);a.set(r,0);for(let e=0;e>>24&255,t[e]>>>16&255,t[e]>>>8&255,255&t[e]]),o),o+=4;return ol.box(ol.types.stss,a)}static stsc(e){let t=e.length,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]),s=i.byteLength,r=new Uint8Array(s+12*t);r.set(i,0);for(let i=0;i>>24&255,t>>>16&255,t>>>8&255,255&t,o>>>24&255,o>>>16&255,o>>>8&255,255&o,a>>>24&255,a>>>16&255,a>>>8&255,255&a]),s),s+=12}return ol.box(ol.types.stsc,r)}static stsz(e){let t=e.length,i=new Uint8Array([0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]),s=i.byteLength,r=new Uint8Array(s+4*t);r.set(i,0);for(let i=0;i>>24&255,t>>>16&255,t>>>8&255,255&t]),s),s+=4}return ol.box(ol.types.stsz,r)}static stco(e,t){let i=t[0].chunkOffset;return ol.box(ol.types.stco,new Uint8Array([0,0,0,0,0,0,0,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i]))}static stsd(e){return"audio"===e.type?"mp3"===e.codec?ol.box(ol.types.stsd,ol.constants.STSD_PREFIX,ol.mp3(e)):ol.box(ol.types.stsd,ol.constants.STSD_PREFIX,ol.mp4a(e)):"avc"===e.videoType?ol.box(ol.types.stsd,ol.constants.STSD_PREFIX,ol.avc1(e)):ol.box(ol.types.stsd,ol.constants.STSD_PREFIX,ol.hvc1(e))}static mp3(e){let t=e.channelCount,i=e.sampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return ol.box(ol.types[".mp3"],s)}static mp4a(e){let t=e.channelCount,i=e.sampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return ol.box(ol.types.mp4a,s,ol.esds(e))}static esds(e){let t=e.config||[],i=t.length,s=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return ol.box(ol.types.esds,s)}static avc1(e){let t=e.avcc,i=e.codecWidth,s=e.codecHeight,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return ol.box(ol.types.avc1,r,ol.box(ol.types.avcC,t))}static hvc1(e){let t=e.avcc;const i=e.codecWidth,s=e.codecHeight;let r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return ol.box(ol.types.hvc1,r,ol.box(ol.types.hvcC,t))}static mvex(e){return ol.box(ol.types.mvex,ol.trex(e))}static trex(e){let t=e.id,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return ol.box(ol.types.trex,i)}static moof(e,t){return ol.box(ol.types.moof,ol.mfhd(e.sequenceNumber),ol.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return ol.box(ol.types.mfhd,t)}static traf(e,t){let i=e.id,s=ol.box(ol.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),r=ol.box(ol.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),o=ol.sdtp(e),a=ol.trun(e,o.byteLength+16+16+8+16+8+8);return ol.box(ol.types.traf,s,r,a,o)}static sdtp(e){let t=e.samples||[],i=t.length,s=new Uint8Array(4+i);for(let e=0;e>>24&255,s>>>16&255,s>>>8&255,255&s,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);for(let e=0;e>>24&255,t>>>16&255,t>>>8&255,255&t,s>>>24&255,s>>>16&255,s>>>8&255,255&s,r.isLeading<<2|r.dependsOn,r.isDependedOn<<6|r.hasRedundancy<<4|r.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12+16*e)}return ol.box(ol.types.trun,o)}static mdat(e){return ol.box(ol.types.mdat,e)}}ol.init();class al extends sl{constructor(e){super(e),this.TAG_NAME="recorderMP4",this._reset(),e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this._reset(),this.player.debugLog(this.TAG_NAME,"destroy")}_reset(){super._reset(),this.totalDuration=0,this.totalAudioDuration=0,this.totalByteLength=0,this.totalAudioByteLength=0,this.bufferList=[],this.audioBufferList=[],this.cacheTrack={},this.audioCacheTrack={},this.sequenceNumber=0,this.audioSequenceNumber=0}startRecord(){this._isRecording=!0,this.player.emit(at.recording,!0),this.player.debugLog(this.TAG_NAME,"start recording"),this.player.emit(at.recordStart),this.startRecordingInterval()}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(at.recordingTimestamp,this.getTotalDuration())}),1e3)}formatFmp4Track(e,t,i,s){return{id:1,sequenceNumber:++this.sequenceNumber,size:e.byteLength,dts:i,cts:s,isKeyframe:t,data:e,duration:0,flags:{isLeading:0,dependsOn:t?2:1,isDependedOn:t?1:0,hasRedundancy:0,isNonSync:t?0:1}}}formatAudioFmp4Track(e,t){return{id:2,sequenceNumber:++this.audioSequenceNumber,size:e.byteLength,dts:t,pts:t,cts:0,data:new Uint8Array(e),duration:0,originalDts:t,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}}handleAddNaluTrack(e,t,i,s){this.cacheTrack.id&&i>=this.cacheTrack.dts?(this.cacheTrack.duration=i-this.cacheTrack.dts,this.handleAddFmp4Track(this.cacheTrack)):this.cacheTrack={},this.cacheTrack=this.formatFmp4Track(e,t,i,s)}handleAddAudioTrack(e,t){}handleAddFmp4Track(e){if(!this.isRecording)return void this.player.debugError(this.TAG_NAME,"handleAddFmp4Track, isRecording is false ");if((null===this.sps||null===this.pps)&&this.isH264)return void this.player.debugError(this.TAG_NAME,"handleAddFmp4Track, is h264 and this.sps or this.pps is null ");if((null===this.sps||null===this.pps||null===this.vps)&&this.isH265)return void this.player.debugError(this.TAG_NAME,"handleAddFmp4Track, is h265 and this.sps or this.pps or this.vps is null ");const t=Object.assign({},e);t.pts=t.dts+t.cts;const i=t.data;if(t.isKeyframe)if(this.isH264){const e=new Uint8Array(this.sps.byteLength+this.pps.byteLength);e.set(this.sps,0),e.set(this.pps,this.sps.byteLength);const s=new Uint8Array(e.byteLength+i.byteLength);s.set(e,0),s.set(i,e.byteLength),t.data=s}else if(this.isH265){const e=new Uint8Array(this.sps.byteLength+this.pps.byteLength+this.vps.byteLength);e.set(this.vps,0),e.set(this.sps,this.vps.byteLength),e.set(this.pps,this.vps.byteLength+this.sps.byteLength);const s=new Uint8Array(e.byteLength+i.byteLength);s.set(e,0),s.set(i,e.byteLength),t.data=s}t.size=t.data.byteLength,this.totalDuration+=t.duration,this.totalByteLength+=t.data.byteLength,t.duration=0,t.originalDts=t.dts,delete t.id,delete t.sequenceNumber,this.bufferList.push(t)}handleAddFmp4AudioTrack(e){const t=Object.assign({},e);t.pts=t.dts+t.cts,t.size=t.data.byteLength,this.totalAudioDuration+=t.duration,this.totalAudioByteLength+=t.data.byteLength,t.duration=0,t.originalDts=t.dts,delete t.id,delete t.sequenceNumber,this.audioBufferList.push(t)}getTotalDuration(){return this.totalDuration/1e3}getType(){return S}getToTalByteLength(){return this.totalByteLength+this.totalAudioByteLength}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:mt,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{if(!this.isRecording)return this.player.debugError(this.TAG_NAME,"stop recording fail, isRecording is false "),s("stop recording fail, isRecording is false ");if(0===this.bufferList.length)return this.player.debugError(this.TAG_NAME,"stop recording fail, this.bufferList.length is 0 "),s("stop recording fail, this.bufferList.length is 0 ");t&&this.setFileName(t);const r={id:1,type:"video",sps:this.sps,pps:this.pps,samples:this.bufferList,sequenceNumber:this.bufferList.length,length:0,addSampleNum:1,duration:0,...this.metaInfo},o={id:2,type:"audio",sequenceNumber:this.audioBufferList.length,samples:this.audioBufferList,...this.audioMetaInfo},a=[r];o.samples.length>0&&a.push(o),this.player.debugLog(this.TAG_NAME,`trackList length is ${a.length}`);const n=ol.generateInitSegment({timescale:1e3,duration:this.totalDuration},a,this.totalByteLength+this.totalAudioByteLength);this.player.debugLog(this.TAG_NAME,"stop recording");const l=new Blob([n],{type:"application/octet-stream"});if(e===gt)i(l),this.player.emit(at.recordBlob,l);else{i();Ro((this.fileName||ro())+"."+S,l)}this._reset(),this.player.emit(at.recording,!1)}))}cancelRecord(){return new Promise(((e,t)=>{if(this.player.debugLog(this.TAG_NAME,"cancel recording"),!this.isRecording)return e();this._reset(),this.player.emit(at.recording,!1),this.player.emit(at.recordCancel),e()}))}}function nl(){for(var e=arguments.length,t=new Array(e),i=0;i{const i=new s((0|e.byteLength)+(0|t.byteLength));return i.set(e,0),i.set(t,0|e.byteLength),i}),new s)}function ll(e){if((e=e.replace(/\s/g,"")).length%2!=0)return console.error("hexStringToUint8Array: invalid hexString length, must be even and bexString length is: ",e.length),null;const t=new Uint8Array(e.length/2);for(let i=0;i{this.player.emit(at.recordingTimestamp,this.getTotalDuration())}),1e3)}addMetaData(e){this.flvMetaData=e}addAACSequenceHeader(e){this.aacSequenceHeader=e}addVideoSequenceHeader(e){this.videoSequenceHeader=e}addVideo(e,t){this._setStartTime(t);const i=this._getBufferTs(t);this.hasVideo=!0,this._createBufferItem(e,je,i)}addAudio(e,t){this._setStartTime(t);const i=this._getBufferTs(t);this.hasAudio=!0,this._createBufferItem(e,Ne,i)}_setStartTime(e){null===this.startTime&&this._isRecording&&(this.startTime=e,this.player.debugLog(this.TAG_NAME,`_setStartTime is ${e}`))}_getBufferTs(e){e>this.currentTime&&(this.currentTime=e);let t=0;return this.startTime&&e>=this.startTime&&(t=e-this.startTime),t>this.prevTimestamp?this.prevTimestamp=t:t=this.prevTimestamp,t}_createBufferItem(e,t,i){const s=this._createFlvPacket(e,t,i),r=this._createFlvTag(s);this.totalByteLength+=r.byteLength,this.bufferList.push(r)}_createFlvTag(e){let t=11+e.header.length,i=new Uint8Array(t+4);i[0]=e.header.type;let s=new DataView(i.buffer);return i[1]=e.header.length>>16&255,i[2]=e.header.length>>8&255,i[3]=255&e.header.length,i[4]=e.header.timestamp>>16&255,i[5]=e.header.timestamp>>8&255,i[6]=255&e.header.timestamp,i[7]=e.header.timestamp>>24&255,i[8]=0,i[9]=0,i[10]=0,s.setUint32(t,t),i.set(e.payload.subarray(0,e.header.length),11),i}_createFlvPacket(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{header:{length:e?e.length:0,timestamp:i,type:t},payload:e}}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:mt,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{if(!this.isRecording)return this.player.debugError(this.TAG_NAME,"stop recording fail, isRecording is false "),s("stop recording fail, isRecording is false ");if(0===this.bufferList.length)return this.player.debugError(this.TAG_NAME,"stop recording fail, this.bufferList.length is 0 "),s("stop recording fail, this.bufferList.length is 0 ");t&&this.setFileName(t);const r=new Uint8Array([70,76,86,1,0,0,0,0,9,0,0,0,0]);this.hasVideo&&(r[4]|=1),this.hasAudio&&(r[4]|=4);let o=[r];if(this.flvMetaData){const e=this._createFlvPacket(this.flvMetaData,Ge),t=this._createFlvTag(e);o.push(t)}if(this.videoSequenceHeader){const e=this._createFlvPacket(this.videoSequenceHeader,je),t=this._createFlvTag(e);o.push(t)}if(this.aacSequenceHeader){const e=this._createFlvPacket(this.aacSequenceHeader,Ne),t=this._createFlvTag(e);o.push(t)}const a=function(e){const t=e[0].constructor;return e.reduce(((e,i)=>{const s=new t((0|e.byteLength)+(0|i.byteLength));return s.set(e,0),s.set(i,0|e.byteLength),s}),new t)}(o.concat(this.bufferList));this.player.debugLog(this.TAG_NAME,"stop recording");const n=new Blob([a],{type:"application/octet-stream"});if(e===gt)i(n),this.player.emit(at.recordBlob,n);else{i();Ro((this.fileName||ro())+"."+T,n)}this._reset(),this.player.emit(at.recording,!1)}))}cancelRecord(){return new Promise(((e,t)=>{if(this.player.debugLog(this.TAG_NAME,"cancel recording"),!this.isRecording)return e();this._reset(),this.player.emit(at.recording,!1),this.player.emit(at.recordCancel),e()}))}getTotalDuration(){let e=0;return null!==this.startTime&&null!==this.currentTime&&(e=this.currentTime-this.startTime),Math.round(e/1e3)}getType(){return T}getToTalByteLength(){return this.totalByteLength}}const hl={init:0,findFirstStartCode:1,findSecondStartCode:2};class cl extends o{constructor(e){super(),this.player=e,this.isDestroyed=!1,this.reset()}destroy(){this.isDestroyed=!1,this.off(),this.reset()}reset(){this.stats=hl.init,this.tempBuffer=new Uint8Array(0),this.parsedOffset=0,this.versionLayer=0}dispatch(e,t){let i=new Uint8Array(this.tempBuffer.length+e.length);for(i.set(this.tempBuffer,0),i.set(e,this.tempBuffer.length),this.tempBuffer=i;!this.isDestroyed;){if(this.state==hl.Init){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=hl.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==hl.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=hl.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==hl.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=hl.findFirstStartCode}}}}class ul extends sl{constructor(e){super(e),this.TAG_NAME="recorderWasmMP4",this._reset(),this.wasmMp4Recorder=null,this.mp3Demuxer=null,e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.mp3Demuxer&&(this.mp3Demuxer.destroy(),this.mp3Demuxer=null),this._reset(),this.player.debugLog(this.TAG_NAME,"destroy")}_reset(){super._reset(),this.cacheTrack={},this.audioCacheTrack={},this.totalDuration=0,this.totalAudioDuration=0,this.totalByteLength=0,this.totalAudioByteLength=0,this.hasAudio=!1,this.hasVideo=!1}getType(){return S}isWasmMp4(){return!0}getTotalDuration(){return this.totalDuration/1e3}getToTalByteLength(){return this.totalByteLength+this.totalAudioByteLength}startRecord(){const e=this.player,t=this.player.getAudioInfo(),i=this.player.getVideoInfo(),s={};if(this.codecId){const e={type:this.codecId,width:i.width,height:i.height,extraData:this.metaInfo.avcc};s.video=e,this.hasVideo=!0}if(t.encTypeCode){const e={type:t.encTypeCode,sampleRate:t.sampleRate,channels:t.channels,extraData:this.audioMetaInfo.extraData,depth:t.depth};this.audioCodeId=t.encTypeCode,s.audio=e,this.hasAudio=!0}this.wasmMp4Recorder=new window.JessibucaProMp4Recorder({debug:e._opt.debug,debugLevel:e._opt.debugLevel,debugUuid:e._opt.debugUuid,decoder:e._opt.wasmMp4RecorderDecoder}),this.wasmMp4Recorder.on("recordingTimestamp",(e=>{this._recordingTimestamp=e/1e3})),this.wasmMp4Recorder.startRecord(s).then((()=>{this._isRecording=!0,this.player.emit(at.recording,!0),this.player.debugLog(this.TAG_NAME,"start recording"),this.player.emit(at.recordStart),this.startRecordingInterval()})).catch((e=>{this.player.debugError(this.TAG_NAME,"startRecord error",e),this.player.emitError(at.recordCreateError,e)}))}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(at.recordingTimestamp,this.recordTime)}),1e3)}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:mt,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>this.isRecording?0===this.totalDuration?(this.player.debugError(this.TAG_NAME,"stop recording fail, totalDuration is 0 "),s("stop recording fail, totalDuration is 0 ")):(t&&this.setFileName(t),void this.wasmMp4Recorder.stopRecord().then((t=>{if(e===gt)i(t),this.player.emit(at.recordBlob,t);else{i();Ro((this.fileName||ro())+"."+S,t)}})).catch((e=>{this.player.debugError(this.TAG_NAME,"stopRecord error",e),s(e)})).finally((()=>{this._reset(),this.player.emit(at.recording,!1)}))):(this.player.debugError(this.TAG_NAME,"stop recording fail, isRecording is false "),s("stop recording fail, isRecording is false "))))}cancelRecord(){return new Promise(((e,t)=>{if(this.player.debugLog(this.TAG_NAME,"cancel recording"),!this.isRecording||0===this.totalDuration)return e();this.wasmMp4Recorder.stopRecord().then((t=>{e()})).catch((e=>{this.player.debugError(this.TAG_NAME,"stopRecord error",e),t(e)})).finally((()=>{this._reset(),this.player.emit(at.recording,!1),this.player.emit(at.recordCancel)}))}))}handleAddAudioTrack(e,t){this.audioCodeId===Et?(this.mp3Demuxer||(this.mp3Demuxer=new cl(this.player),this.mp3Demuxer.on("data",((e,t)=>{this._handleAddAudioTrack(e,t)}))),this.mp3Demuxer.dispatch(e,t)):this._handleAddAudioTrack(e,t)}_handleAddAudioTrack(e,t){ya(this.hasAudio)||(this.audioCacheTrack.id&&t>=this.audioCacheTrack.dts?(this.audioCacheTrack.duration=t-this.audioCacheTrack.dts,this.totalAudioDuration+=this.audioCacheTrack.duration,this.totalAudioByteLength+=this.audioCacheTrack.payload.byteLength,this.wasmMp4Recorder.sendAudioFrame(this.audioCacheTrack.payload,this.audioCacheTrack.dts)):this.audioCacheTrack={},this.audioCacheTrack={id:2,payload:e,dts:t})}handleAddNaluTrack(e,t,i,s){ya(this.hasVideo)||(this.cacheTrack.id&&i>=this.cacheTrack.dts?(this.cacheTrack.duration=i-this.cacheTrack.dts,this.totalDuration+=this.cacheTrack.duration,this.totalByteLength+=this.cacheTrack.payload.byteLength,this.wasmMp4Recorder.sendVideoFrame(this.cacheTrack.payload,this.cacheTrack.isIFrame,this.cacheTrack.dts,this.cacheTrack.cts)):this.cacheTrack={},this.cacheTrack={id:1,payload:e,isIFrame:t,dts:i,cts:s})}}class pl{constructor(e){return new(pl.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){if(e.recordType===S){if(e.useWasm||e.useMSE||e.useWCS)return window.JessibucaProMp4Recorder&&e.mp4RecordUseWasm?ul:al}else if(e.recordType===T)return dl;return rl}}function fl(e,t,i){let s=e;if(t+i=128){t.push(String.fromCharCode(65535&e)),s+=2;continue}}}else if(i[s]<240){if(fl(i,s,2)){let e=(15&i[s])<<12|(63&i[s+1])<<6|63&i[s+2];if(e>=2048&&55296!=(63488&e)){t.push(String.fromCharCode(65535&e)),s+=3;continue}}}else if(i[s]<248&&fl(i,s,3)){let e=(7&i[s])<<18|(63&i[s+1])<<12|(63&i[s+2])<<6|63&i[s+3];if(e>65536&&e<1114112){e-=65536,t.push(String.fromCharCode(e>>>10|55296)),t.push(String.fromCharCode(1023&e|56320)),s+=4;continue}}t.push(String.fromCharCode(65533)),++s}return t.join("")}let gl=function(){let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256===new Int16Array(e)[0]}();class yl{static parseScriptData(e,t,i){let s={};try{let r=yl.parseValue(e,t,i),o=yl.parseValue(e,t+r.size,i-r.size);s[r.data]=o.data}catch(e){console.error("AMF",e.toString())}return s}static parseObject(e,t,i){let s=yl.parseString(e,t,i),r=yl.parseValue(e,t+s.size,i-s.size),o=r.objectEnd;return{data:{name:s.data,value:r.data},size:s.size+r.size,objectEnd:o}}static parseVariable(e,t,i){return yl.parseObject(e,t,i)}static parseString(e,t,i){let s,r=new DataView(e,t,i).getUint16(0,!gl);return s=r>0?ml(new Uint8Array(e,t+2,r)):"",{data:s,size:2+r}}static parseLongString(e,t,i){let s,r=new DataView(e,t,i).getUint32(0,!gl);return s=r>0?ml(new Uint8Array(e,t+4,r)):"",{data:s,size:4+r}}static parseDate(e,t,i){let s=new DataView(e,t,i),r=s.getFloat64(0,!gl);return r+=60*s.getInt16(8,!gl)*1e3,{data:new Date(r),size:10}}static parseValue(e,t,i){let s,r=new DataView(e,t,i),o=1,a=r.getUint8(0),n=!1;try{switch(a){case 0:s=r.getFloat64(1,!gl),o+=8;break;case 1:s=!!r.getUint8(1),o+=1;break;case 2:{let r=yl.parseString(e,t+1,i-1);s=r.data,o+=r.size;break}case 3:{s={};let a=0;for(9==(16777215&r.getUint32(i-4,!gl))&&(a=3);o{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),ie)}this.decoderWorker=new Worker(t),this._initDecoderWorker(),this._listenPlaybackEvents(),e.debugLog("decoderWorker",`init and decoder url is ${t}`),e.on(at.visibilityChange,(()=>{this.updateWorkConfig({key:"visibility",value:e.visibility})}))}destroy(){return new Promise(((e,t)=>{if(this.player.loaded)if(this.player.debugLog("decoderWorker","has loaded and post message to destroy"),this.decoderWorker){const t={};this.player.isMseDecoderUseWorker()&&(t.isVideoInited=this.player.isMseVideoStateInited()),this.decoderWorker.postMessage({cmd:He,options:t}),this.destroyResolve=e,this.decoderWorkerCloseTimeout=setTimeout((()=>{this.player.debugWarn("decoderWorker","send close but not response and destroy directly"),this._destroy(),setTimeout((()=>{e()}),0)}),2e3)}else this.player.debugWarn("decoderWorker","has loaded but decoderWorker is null and destroy directly"),this._destroy(),setTimeout((()=>{e()}),0);else this.player.debugLog("decoderWorker","has not loaded and destroy directly"),this._destroy(),setTimeout((()=>{e()}),0)}))}_destroy(){this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this.workerUrl&&(window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.decoderWorker&&(this.decoderWorker.terminate(),this.decoderWorker.onerror=null,this.decoderWorker.onmessageerror=null,this.decoderWorker.onmessage=null,this.decoderWorker=null),this.player.debugLog("decoderWorker","destroy"),this.destroyResolve&&(this.destroyResolve(),this.destroyResolve=null),this.isDestroyed=!0}_listenPlaybackEvents(){this.player.isPlaybackPauseNotClearCacheAndCacheBeforeDecodeAndUseFpsRender()&&(this.player.debugLog(this.TAG_NAME,"listenPlaybackEvents"),this.player.on(at.playbackPause,(e=>{this.updatePlaybackIsPause(e)})))}_initDecoderWorker(){this.player,this.decoderWorker.onerror=e=>{const t=e.filename||"",i=e.message||"",s=t&&(-1!==t.indexOf(".wasm")||-1!==t.indexOf("wasm://"));s&&-1!==i.indexOf(rr)?this.player.debugLog("decoderWorker",`onerror and ignore filename: ${t},message: ${i}`,e):(this.player.debugError("decoderWorker",`onerror filename: ${t},message: ${i}`,e),s?this.player.emitError(dt.decoderWorkerWasmError,`filename: ${t},message: ${i}`):this.player.emitError(dt.decoderWorkerInitError,`filename: ${t},message: ${i}`))},this.decoderWorker.onmessageerror=e=>{this.player.debugError("decoderWorker","onmessageerror",e)},this.decoderWorker.onmessage=e=>{const t=e.data;switch(t.cmd){case oe:this.player.debugLog("decoderWorker","onmessage:",oe),this.decoderWorker&&this._initWork(),this.player.loaded||this.player.emit(at.load),this.player.emit(at.decoderWorkerInit);break;case pe:this.player.debugLog("decoderWorker","onmessage:",pe,t.code),this.player._times.decodeStart||(this.player._times.decodeStart=ro()),this.player.video.updateVideoInfo({encTypeCode:t.code});break;case fe:this.player.debugLog("decoderWorker","onmessage:",fe,t.codecId),this.player.recorder&&this.player.recorder.initMetaData(t.buffer,t.codecId),this.player.video.updateVideoInfo({encTypeCode:t.codecId});break;case he:this.player.debugLog("decoderWorker","onmessage:",he,t.code),this.player.audio&&this.player.audio.updateAudioInfo({encTypeCode:t.code});break;case ue:this.player.debugLog("decoderWorker","onmessage:",ue),this.player.recorder&&this.player.recorder.initAudioAacExtraData(t.buffer);break;case ae:if(this.player.debugLog("decoderWorker","onmessage:",ae,`width:${t.w},height:${t.h}`),Po(t.w)||Po(t.h))return void this.player.emitError(dt.videoInfoError,`video width ${t.w} or height ${t.h} is empty`);if(this.player.video.bindMediaStream(),this.player.video.updateVideoInfo({width:t.w,height:t.h}),!this.player._opt.openWebglAlignment&&t.w/2%4!=0&&this.player.getRenderType()===H)return void this.player.emitError(dt.webglAlignmentError);this.player.video.initCanvasViewSize(),this.player._opt.playType===w&&(this.player.video.initFps(),this.player.video.initVideoDelay());break;case de:if(this.player.debugLog("decoderWorker","onmessage:",de,`channels:${t.channels},sampleRate:${t.sampleRate}`),t.channels>2)return void this.player.emitError(dt.audioChannelError,`audio channel is ${t.channels}, max is 2`);this.player.audio&&(this.player.audio.updateAudioInfo(t),this.player._opt.playType===v?this.player.audio.initScriptNode():this.player._opt.playType===w&&this.player.audio.initScriptNodeDelay());break;case ne:if(!this.player.video)return void this.player.debugWarn("decoderWorker","onmessage render but video is null");if(this.player.isPlayer()){if(ya(this.player.video.getHasInit()))return void this.player.debugWarn("decoderWorker","onmessage render but video has not init");this.player.video.render(t),this.player.handleRender(),this.player.emit(at.timeUpdate,t.ts),this.player.updateStats({dfps:!0,buf:t.delay}),this.player._times.videoStart||(this.player._times.videoStart=ro(),this.player.handlePlayToRenderTimes())}else this.player.isPlayback()&&(this.player.updateStats({dfps:!0}),ya(this.player.playbackPause)?(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this.player.playback.isUseFpsRender?this.player.video.pushData(t):this.player.video.render$2(t)):this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this.player.playback.isUseFpsRender&&this.player.video.pushData(t));break;case me:this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===S&&this.player.recorder.handleAddNaluTrack(t.buffer,t.isIFrame,t.ts,t.cts);break;case ce:this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===S&&this.player.recorder.isWasmMp4()&&this.player.recorder.handleAddAudioTrack(t.buffer,t.ts);break;case ge:const{webcodecsDecoder:e,mseDecoder:i}=this.player;this.player.updateStats({buf:t.delay});const s=new Uint8Array(t.payload);this.player._opt.useWCS&&!this.player._opt.useOffscreen?e.decodeVideo(s,t.ts,t.isIFrame,t.cts):this.player._opt.useMSE&&i.decodeVideo(s,t.ts,t.isIFrame,t.cts);break;case ye:if(this.player._opt.useMSE){const e=new Uint8Array(t.payload);this.player.mseDecoder.decodeAudio(e,t.ts,t.cts)}break;case le:if(!this.player.audio)return void this.player.debugWarn("decoderWorker","onmessage playAudio but audio is null");(this.player.playing&&this.player.audio||!this.player.video)&&(this.player._opt.hasVideo||this.player.handleRender(),(this.player._opt.playType===v||this.player._opt.playType===w&&(ya(this.player.playbackPause)||this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this.player.playback.isUseFpsRender))&&this.player.audio.play(t.buffer,t.ts));break;case Ae:if(t.type===at.streamSuccess)this.player.stream?this.player.stream.emit(at.streamSuccess):this.player.debugWarn("decoderWorker","onmessage and workerFetch response stream success but stream is null");else if(t.type===at.streamRate)this.player.emit(at.kBps,(t.value/1024).toFixed(2));else if(t.type===at.streamEnd)this.player?(t.value===m&&this.player.emit(at.websocketClose,t.msg),this.player.stream?this.player.stream.emit(at.streamEnd,t.msg):this.player.debugWarn("decoderWorker","onmessage and workerFetch response stream end but player.stream is null")):this.player.debugWarn("decoderWorker","onmessage and workerFetch response stream end but player is null");else if(t.type===dt.websocketError)this.player&&this.player.stream?this.player.stream.emit(dt.websocketError,t.value):this.player.debugWarn("decoderWorker","onmessage and workerFetch response websocket error but stream is null");else if(t.type===dt.fetchError)this.player&&this.player.stream?this.player.stream.emit(dt.fetchError,t.value):this.player.debugWarn("decoderWorker","onmessage and workerFetch response fetch error but stream is null");else if(t.type===at.streamAbps)this.player.updateStats({abps:t.value});else if(t.type===at.streamVbps)this.player._times.demuxStart||(this.player._times.demuxStart=ro()),this.player.updateStats({vbps:t.value});else if(t.type===at.streamDts)this.player.updateStats({dts:t.value});else if(t.type===at.netBuf)this.player.updateStats({netBuf:t.value});else if(t.type===at.networkDelayTimeout)this.player.emit(at.networkDelayTimeout,t.value);else if(t.type===at.streamStats){const e=JSON.parse(t.value);this.player.updateStats({workerStats:e})}else t.type===at.websocketOpen&&this.player.emit(at.websocketOpen);break;case be:this.player&&(this.player.videoIframeIntervalTs=t.value);break;case ve:this.player&&this.player.updateStats({isDropping:!0});break;case Ie:this.player.decoderCheckFirstIFrame();break;case we:this.player&&this.player.video&&this.player.video.setStreamFps(t.value);break;case Te:this.player.emitError(dt.simdH264DecodeVideoWidthIsTooLarge,t.value);break;case Se:this.player.emitError(dt.wasmWidthOrHeightChange,t.value);break;case Ee:this.player.emitError(dt.simdDecodeError);break;case _e:this.player.debugLog("decoderWorker","onmessage:",_e),this.player.destroy(),console.error("Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),alert("Jb pro 体验结束,请刷新页面再次体验,如需要购买商业授权,可以联系微信:bosswancheng"),window.location.reload();break;case ke:this.player.debugLog("decoderWorker","onmessage:",ke),this._destroy();break;case Le:this.player&&this.player.pushTempStream(t.buffer);break;case Ce:this.player&&this.player.emitVideoSei({ts:t.ts,data:new Uint8Array(t.buffer)});break;case xe:if(this.player){if(this.player.isRecordTypeFlv()){const e=new Uint8Array(t.buffer);this.player.recorder.addMetaData(e)}const e=Al(new Uint8Array(t.buffer));e&&e.onMetaData&&this.player.updateMetaData(e.onMetaData)}break;case De:if(this.player&&this.player.isRecordTypeFlv()){const e=new Uint8Array(t.buffer);this.player.recorder.addAACSequenceHeader(e,t.ts)}break;case Re:if(this.player&&this.player.isRecordTypeFlv()){const e=new Uint8Array(t.buffer);this.player.recorder.addVideoSequenceHeader(e,t.ts)}break;case Pe:if(this.player&&this.player.isRecordTypeFlv()&&this.player.recording){const e=new Uint8Array(t.buffer);t.type===Oe?this.player.recorder.addVideo(e,t.ts):t.type===Ue&&this.player.recorder.addAudio(e,t.ts)}break;case Be:this.player&&(this.player.debugLog("decoderWorker","onmessage:",Be),this.player.video.$videoElement.srcObject=t.mseHandle);break;case Me:this.player&&(this.player.debugLog("decoderWorker","onmessage:",Me,t.value),this.player._mseWorkerData.firstRenderTime=Number(t.value));break;case Fe:this.player&&(this.player.debugLog("decoderWorker","onmessage:",Fe,t.value,t.msg),this.player.emitError(t.value,t.msg));break;default:this.player[t.cmd]&&this.player[t.cmd](t)}}}_initWork(){const e={debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid,useOffscreen:this.player._opt.useOffscreen,useWCS:this.player._opt.useWCS,useMSE:this.player._opt.useMSE,videoBuffer:this.player._opt.videoBuffer,videoBufferDelay:this.player._opt.videoBufferDelay,openWebglAlignment:this.player._opt.openWebglAlignment,playType:this.player._opt.playType,hasAudio:this.player._opt.hasAudio,hasVideo:this.player._opt.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:this.player._opt.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:this.player.audio&&this.player.audio.audioContext&&this.player.audio.audioContext.sampleRate||Tr,audioBufferSize:this.player.audio&&this.player.audio.getAudioBufferSize()||1024,networkDelay:this.player._opt.networkDelay,visibility:this.player.visibility,useSIMD:this.player._opt.useSIMD,recordType:this.player._opt.recordType,checkFirstIFrame:this.player._opt.checkFirstIFrame,isM7sCrypto:this.player._opt.isM7sCrypto,isXorCrypto:this.player._opt.isXorCrypto,isSm4Crypto:this.player._opt.isSm4Crypto,isSm4CryptoH265V2:this.player._opt.isSm4CryptoH265V2,sm4CryptoKey:this.player._opt.sm4CryptoKey,m7sCryptoAudio:this.player._opt.m7sCryptoAudio,isFlv:this.player._opt.isFlv,isFmp4:this.player._opt.isFmp4,isMpeg4:this.player._opt.isMpeg4,isTs:this.player._opt.isTs,isNakedFlow:this.player._opt.isNakedFlow,isHls265:this.player.isUseHls265(),isFmp4Private:this.player._opt.isFmp4Private,isEmitSEI:this.player._opt.isEmitSEI,isRecordTypeFlv:this.player.isRecordTypeFlv(),isWasmMp4:this.player.recorder&&this.player.recorder.isWasmMp4()||!1,isChrome:Yo(),isFirefox:go(),supportMSEDecodeHevc:Lo(),isDropSameTimestampGop:this.player._opt.isDropSameTimestampGop,mseDecodeAudio:this.player._opt.mseDecodeAudio,wcsDecodeAudio:this.player._opt.wcsDecodeAudio,nakedFlowH265DemuxUseNew:this.player._opt.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:this.player._opt.mseDecoderUseWorker,mseAutoCleanupMinBackwardDuration:this.player._opt.mseAutoCleanupMinBackwardDuration,mseAutoCleanupMaxBackwardDuration:this.player._opt.mseAutoCleanupMaxBackwardDuration,mseCorrectTimeDuration:this.player._opt.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:this.player._opt.mseCorrectAudioTimeDuration,nakedFlowDemuxUseNew:this.player._opt.nakedFlowDemuxUseNew,nakedFlowFps:this.player._opt.nakedFlowFps};this.decoderWorker.postMessage({cmd:We,opt:JSON.stringify(e)}),this.player._opt.cryptoKey&&this.player._opt.cryptoKey.byteLength>0&&this.player._opt.cryptoIV&&this.player._opt.cryptoIV.byteLength>0&&(this.updateWorkConfig({key:"cryptoKey",value:this.player._opt.cryptoKey}),this.updateWorkConfig({key:"cryptoIV",value:this.player._opt.cryptoIV}))}decodeVideo(e,t,i){this.player._opt.playType===v?this.player.isUseHls265()?this._decodeVideoNoDelay(e,t,i):this._decodeVideo(e,t,i):this.player._opt.playType===w&&(this.player.isPlaybackOnlyDecodeIFrame()?i&&(this.player.debugLog("decoderWorker",`current rate is ${this.player.video.rate},only decode i frame`),this._decodeVideoNoDelay(e,t,i)):1===this.player.video.rate?this._decodeVideo(e,t,i):this._decodeVideoNoDelay(e,t,i))}_decodeVideo(e,t,i){const s={type:Oe,ts:Math.max(t,0),isIFrame:i};this.decoderWorker.postMessage({cmd:ze,buffer:e,options:s},[e.buffer])}_decodeVideoNoDelay(e,t,i){this.decoderWorker.postMessage({cmd:Ve,buffer:e,ts:Math.max(t,0),isIFrame:i},[e.buffer])}decodeAudio(e,t){this.player._opt.playType===v?this.player._opt.useWCS||this.player._opt.useMSE||this.player.isUseHls265()?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t):this.player._opt.playType===w&&(this.player.isPlaybackOnlyDecodeIFrame()||(1===this.player.video.rate?this._decodeAudio(e,t):this._decodeAudioNoDelay(e,t)))}_decodeAudio(e,t){const i={type:Ue,ts:Math.max(t,0)};this.decoderWorker.postMessage({cmd:ze,buffer:e,options:i},[e.buffer])}_decodeAudioNoDelay(e,t){this.decoderWorker.postMessage({cmd:$e,buffer:e,ts:Math.max(t,0)},[e.buffer])}updateWorkConfig(e){this.decoderWorker&&this.decoderWorker.postMessage({cmd:Je,key:e.key,value:e.value})}workerFetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{_opt:i}=this.player;let s=[];t.protocols&&(s=t.protocols,delete t.protocols);const r={protocol:i.protocol,isFlv:i.isFlv,isFmp4:i.isFmp4,isMpeg4:i.isMpeg4,isNakedFlow:i.isNakedFlow,isTs:i.isTs,options:t};this.decoderWorker.postMessage({cmd:Ke,url:e,protocols:s,opt:JSON.stringify(r)})}clearWorkBuffer(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.decoderWorker.postMessage({cmd:qe,needClear:e})}workerSendMessage(e){this.decoderWorker.postMessage({cmd:Ye,message:e})}updateVideoTimestamp(e){this.decoderWorker.postMessage({cmd:Qe,message:e})}updatePlaybackIsPause(e){this.decoderWorker.postMessage({cmd:Xe,isPause:e})}}var vl,_l="application/json, text/javascript",wl="text/html",Sl=/^(?:text|application)\/xml/i,El=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Tl=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,kl=/^\s*$/,Ll={},Cl={},xl="",Dl={type:"GET",beforeSend:Rl,success:Rl,error:Rl,complete:Rl,context:null,xhr:function(){return new window.XMLHttpRequest},accepts:{json:_l,xml:"application/xml, text/xml",html:wl,text:"text/plain","*":"*/".concat("*")},crossDomain:!1,timeout:0,username:null,password:null,processData:!0,promise:Rl,contentType:"application/x-www-form-urlencoded; charset=UTF-8"};function Rl(){}var Pl=function(e,t){"object"==typeof e&&(t=e,e=void 0);var i=jl({},t=t||{});for(var s in Dl)void 0===i[s]&&(i[s]=Dl[s]);try{var r={},o=new Promise((function(e,t){r.resolve=e,r.reject=t}));o.resolve=r.resolve,o.reject=r.reject,i.promise=o}catch(e){i.promise={resolve:Rl,reject:Rl}}var a=Tl.exec(window.location.href.toLowerCase())||[];i.url=((e||i.url||window.location.href)+"").replace(/#.*$/,"").replace(/^\/\//,a[1]+"//");var n=i.url;i.crossDomain||(i.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(i.url)&&RegExp.$2!==window.location.href);var l=i.dataType;if("jsonp"===l){if(!/=\?/.test(i.url)){var d=(i.jsonp||"callback")+"=?";i.url=Ul(i.url,d)}return function(e){var t,i=e.jsonpCallback||"jsonp"+zl(),s=window.document.createElement("script"),r={abort:function(){i in window&&(window[i]=Rl)}},o=window.document.getElementsByTagName("head")[0]||window.document.documentElement;function a(i){window.clearTimeout(t),r.abort(),Ml(i.type,r,i.type,e),n()}s.onerror=function(e){a(e)},window[i]=function(i){window.clearTimeout(t),Il(i,r,e),n()},Ol(e),s.src=e.url.replace(/=\?/,"="+i),s.src=Ul(s.src,"_="+(new Date).getTime()),s.async=!0,e.scriptCharset&&(s.charset=e.scriptCharset);o.insertBefore(s,o.firstChild),e.timeout>0&&(t=window.setTimeout((function(){r.abort(),Ml("timeout",r,"timeout",e),n()}),e.timeout));function n(){s.clearAttributes?s.clearAttributes():s.onload=s.onreadystatechange=s.onerror=null,s.parentNode&&s.parentNode.removeChild(s),s=null,delete window[i]}return e.promise.abort=function(){r.abort()},e.promise.xhr=r,e.promise}(i)}Ol(i);var h=i.accepts[l]||i.accepts["*"],c={};/^([\w-]+:)\/\//.test(i.url)?RegExp.$1:window.location.protocol;var u,p=Dl.xhr();i.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest"),i.ifModified&&(Ll[n]&&(c["If-Modified-Since"]=Ll[n]),Cl[n]&&(c["If-None-Match"]=Cl[n])),h&&(c.Accept=h,h.indexOf(",")>-1&&(h=h.split(",",2)[0]),p.overrideMimeType&&p.overrideMimeType(h));var f=!/^(?:GET|HEAD)$/.test(i.type.toUpperCase());if((i.data&&f&&!1!==i.contentType||t.contentType)&&(c["Content-Type"]=i.contentType),!1===i.cache&&!f){var m=/([?&])_=[^&]*/;i.url=m.test(n)?n.replace(m,"$1_="+zl()):n+(/\?/.test(n)?"&":"?")+"_="+zl()}i.headers=jl(c,i.headers||{}),p.onreadystatechange=function(){if(4===p.readyState){var e;clearTimeout(u);var t=!1;if(p.status>=200&&p.status<300||304===p.status){if(xl=p.getAllResponseHeaders(),i.ifModified){var s=Fl("Last-Modified");s&&(Ll[n]=s),(s=Fl("etag"))&&(Cl[n]=s)}l=l||function(e){return e&&(e===wl?"html":e===_l?"json":Sl.test(e)&&"xml")||"text"}(p.getResponseHeader("content-type")),e=p.responseText;try{"xml"===l?e=p.responseXML:"json"===l&&(e=kl.test(e)?null:JSON.parse(e))}catch(e){t=e}t?Ml(t,"parseerror",p,i):Il(e,p,i)}else Ml(null,"error",p,i)}};var g=!("async"in i)||i.async;if(p.open(i.type,i.url,g,i.username,i.password),i.xhrFields)for(var y in i.xhrFields)p[y]=i.xhrFields[y];for(var y in i.mimeType&&p.overrideMimeType&&p.overrideMimeType(i.mimeType),i.headers)void 0!==i.headers[y]&&p.setRequestHeader(y,i.headers[y]+"");return!1===function(e,t){var i=t.context;if(!1===t.beforeSend.call(i,e,t))return!1}(p,i)?(p.abort(),!1):(i.timeout>0&&(u=window.setTimeout((function(){p.onreadystatechange=Rl,p.abort(),Ml(null,"timeout",p,i)}),i.timeout)),p.send(i.data?i.data:null),i.promise.abort=function(){p.abort()},i.promise)};function Il(e,t,i){var s=i.context,r="success";i.success.call(s,e,r,t),i.promise.resolve(e,r,t),Bl(r,t,i)}function Bl(e,t,i){var s=i.context;i.complete.call(s,t,e)}function Ml(e,t,i,s){var r=s.context;s.error.call(r,i,t,e),s.promise.reject(i,t,e),Bl(t,i,s)}function Fl(e){var t;if(!vl){for(vl={};t=El.exec(xl);)vl[t[1].toLowerCase()]=t[2];t=vl[e.toLowerCase()]}return null===t?null:t}function Ul(e,t){return(e+"&"+t).replace(/[&?]{1,2}/,"?")}function Ol(e){!Gl(e)||e.data instanceof FormData||!e.processData||(e.data=function(e,t){var i=[];return i.add=function(e,t){this.push(encodeURIComponent(e)+"="+encodeURIComponent(t))},Nl(i,e,t),i.join("&").replace("%20","+")}(e.data)),!e.data||e.type&&"GET"!==e.type.toUpperCase()||(e.url=Ul(e.url,e.data))}function Nl(e,t,i,s){var r=function(e){return"[object Array]"===Object.prototype.toString.call(e)}(t);for(var o in t){var a=t[o];s&&(o=i?s:s+"["+(r?"":o)+"]"),!s&&r?e.add(a.name,a.value):(i?r(a):Gl(a))?Nl(e,a,i,o):e.add(o,a)}}function jl(e){for(var t=Array.prototype.slice,i=t.call(arguments,1),s=0,r=i.length;s255)return!1;return!0}function Hl(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!Vl(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if($l(e.length)&&Vl(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function Jl(e){return new Uint8Array(e)}function ql(e,t,i,s,r){null==s&&null==r||(e=e.slice?e.slice(s,r):Array.prototype.slice.call(e,s,r)),t.set(e,i)}Pl.get=function(e,t,i,s){return Wl(t)&&(s=s||i,i=t,t=void 0),Pl({url:e,data:t,success:i,dataType:s})},Pl.post=function(e,t,i,s){return Wl(t)&&(s=s||i,i=t,t=void 0),Pl({type:"POST",url:e,data:t,success:i,dataType:s})},Pl.getJSON=function(e,t,i){return Wl(t)&&(i=t,t=void 0),Pl({url:e,data:t,success:i,dataType:"json"})},Pl.ajaxSetup=function(e,t){return t?jl(jl(e,Dl),t):jl(Dl,e)};var Kl={toBytes:function(e){var t=[],i=0;for(e=encodeURI(e);i191&&s<224?(t.push(String.fromCharCode((31&s)<<6|63&e[i+1])),i+=2):(t.push(String.fromCharCode((15&s)<<12|(63&e[i+1])<<6|63&e[i+2])),i+=3)}return t.join("")}},Yl=function(){var e="0123456789abcdef";return{toBytes:function(e){for(var t=[],i=0;i>4]+e[15&r])}return i.join("")}}}(),Ql={16:10,24:12,32:14},Xl=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],Zl=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],ed=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],td=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],id=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],sd=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],rd=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],od=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],ad=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],nd=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],ld=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],dd=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],hd=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],cd=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],ud=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function pd(e){for(var t=[],i=0;i>2,this._Ke[i][t%4]=o[t],this._Kd[e-i][t%4]=o[t];for(var a,n=0,l=r;l>16&255]<<24^Zl[a>>8&255]<<16^Zl[255&a]<<8^Zl[a>>24&255]^Xl[n]<<24,n+=1,8!=r)for(t=1;t>8&255]<<8^Zl[a>>16&255]<<16^Zl[a>>24&255]<<24;for(t=r/2+1;t>2,h=l%4,this._Ke[d][h]=o[t],this._Kd[e-d][h]=o[t++],l++}for(var d=1;d>24&255]^hd[a>>16&255]^cd[a>>8&255]^ud[255&a]},fd.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,i=[0,0,0,0],s=pd(e),r=0;r<4;r++)s[r]^=this._Ke[0][r];for(var o=1;o>24&255]^id[s[(r+1)%4]>>16&255]^sd[s[(r+2)%4]>>8&255]^rd[255&s[(r+3)%4]]^this._Ke[o][r];s=i.slice()}var a,n=Jl(16);for(r=0;r<4;r++)a=this._Ke[t][r],n[4*r]=255&(Zl[s[r]>>24&255]^a>>24),n[4*r+1]=255&(Zl[s[(r+1)%4]>>16&255]^a>>16),n[4*r+2]=255&(Zl[s[(r+2)%4]>>8&255]^a>>8),n[4*r+3]=255&(Zl[255&s[(r+3)%4]]^a);return n},fd.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,i=[0,0,0,0],s=pd(e),r=0;r<4;r++)s[r]^=this._Kd[0][r];for(var o=1;o>24&255]^ad[s[(r+3)%4]>>16&255]^nd[s[(r+2)%4]>>8&255]^ld[255&s[(r+1)%4]]^this._Kd[o][r];s=i.slice()}var a,n=Jl(16);for(r=0;r<4;r++)a=this._Kd[t][r],n[4*r]=255&(ed[s[r]>>24&255]^a>>24),n[4*r+1]=255&(ed[s[(r+3)%4]>>16&255]^a>>16),n[4*r+2]=255&(ed[s[(r+2)%4]>>8&255]^a>>8),n[4*r+3]=255&(ed[255&s[(r+1)%4]]^a);return n};var md=function(e){if(!(this instanceof md))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new fd(e)};md.prototype.encrypt=function(e){if((e=Hl(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=Jl(e.length),i=Jl(16),s=0;sNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},bd.prototype.setBytes=function(e){if(16!=(e=Hl(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},bd.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var vd=function(e,t){if(!(this instanceof vd))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof bd||(t=new bd(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new fd(e)};vd.prototype.encrypt=function(e){for(var t=Hl(e,!0),i=0;i16)throw new Error("PKCS#7 padding byte out of range");for(var i=e.length-t,s=0;s>>2]>>>24-o%4*8&255;t[s+o>>>2]|=a<<24-(s+o)%4*8}else for(var n=0;n>>2]=i[n>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,i=this.sigBytes;t[i>>>2]&=4294967295<<32-i%4*8,t.length=e.ceil(i/4)},clone:function(){var e=l.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],i=0;i>>2]>>>24-r%4*8&255;s.push((o>>>4).toString(16)),s.push((15&o).toString(16))}return s.join("")},parse:function(e){for(var t=e.length,i=[],s=0;s>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new d.init(i,t/2)}},u=h.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],r=0;r>>2]>>>24-r%4*8&255;s.push(String.fromCharCode(o))}return s.join("")},parse:function(e){for(var t=e.length,i=[],s=0;s>>2]|=(255&e.charCodeAt(s))<<24-s%4*8;return new d.init(i,t)}},p=h.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},f=n.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var i,s=this._data,r=s.words,o=s.sigBytes,a=this.blockSize,n=o/(4*a),l=(n=t?e.ceil(n):e.max((0|n)-this._minBufferSize,0))*a,h=e.min(4*l,o);if(l){for(var c=0;c>>2]|=e[r]<<24-r%4*8;t.call(this,s,i)}else t.apply(this,arguments)};s.prototype=e}}(),i.lib.WordArray)})),Rr((function(e,t){var i;e.exports=(i=wd,function(){var e=i,t=e.lib.WordArray,s=e.enc;function r(e){return e<<8&4278255360|e>>>8&16711935}s.Utf16=s.Utf16BE={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],r=0;r>>2]>>>16-r%4*8&65535;s.push(String.fromCharCode(o))}return s.join("")},parse:function(e){for(var i=e.length,s=[],r=0;r>>1]|=e.charCodeAt(r)<<16-r%2*16;return t.create(s,2*i)}},s.Utf16LE={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],o=0;o>>2]>>>16-o%4*8&65535);s.push(String.fromCharCode(a))}return s.join("")},parse:function(e){for(var i=e.length,s=[],o=0;o>>1]|=r(e.charCodeAt(o)<<16-o%2*16);return t.create(s,2*i)}}}(),i.enc.Utf16)})),Rr((function(e,t){var i;e.exports=(i=wd,function(){var e=i,t=e.lib.WordArray;function s(e,i,s){for(var r=[],o=0,a=0;a>>6-a%4*2;r[o>>>2]|=n<<24-o%4*8,o++}return t.create(r,o)}e.enc.Base64={stringify:function(e){var t=e.words,i=e.sigBytes,s=this._map;e.clamp();for(var r=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,n=0;n<4&&o+.75*n>>6*(3-n)&63));var l=s.charAt(64);if(l)for(;r.length%4;)r.push(l);return r.join("")},parse:function(e){var t=e.length,i=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o>>6-a%4*2;r[o>>>2]|=n<<24-o%4*8,o++}return t.create(r,o)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var i=e.words,s=e.sigBytes,r=t?this._safe_map:this._map;e.clamp();for(var o=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(i[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|i[a+2>>>2]>>>24-(a+2)%4*8&255,l=0;l<4&&a+.75*l>>6*(3-l)&63));var d=r.charAt(64);if(d)for(;o.length%4;)o.push(d);return o.join("")},parse:function(e,t){void 0===t&&(t=!0);var i=e.length,r=t?this._safe_map:this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var a=0;a>>24)|4278255360&(r<<24|r>>>8)}var o=this._hash.words,a=e[t+0],l=e[t+1],p=e[t+2],f=e[t+3],m=e[t+4],g=e[t+5],y=e[t+6],A=e[t+7],b=e[t+8],v=e[t+9],_=e[t+10],w=e[t+11],S=e[t+12],E=e[t+13],T=e[t+14],k=e[t+15],L=o[0],C=o[1],x=o[2],D=o[3];L=d(L,C,x,D,a,7,n[0]),D=d(D,L,C,x,l,12,n[1]),x=d(x,D,L,C,p,17,n[2]),C=d(C,x,D,L,f,22,n[3]),L=d(L,C,x,D,m,7,n[4]),D=d(D,L,C,x,g,12,n[5]),x=d(x,D,L,C,y,17,n[6]),C=d(C,x,D,L,A,22,n[7]),L=d(L,C,x,D,b,7,n[8]),D=d(D,L,C,x,v,12,n[9]),x=d(x,D,L,C,_,17,n[10]),C=d(C,x,D,L,w,22,n[11]),L=d(L,C,x,D,S,7,n[12]),D=d(D,L,C,x,E,12,n[13]),x=d(x,D,L,C,T,17,n[14]),L=h(L,C=d(C,x,D,L,k,22,n[15]),x,D,l,5,n[16]),D=h(D,L,C,x,y,9,n[17]),x=h(x,D,L,C,w,14,n[18]),C=h(C,x,D,L,a,20,n[19]),L=h(L,C,x,D,g,5,n[20]),D=h(D,L,C,x,_,9,n[21]),x=h(x,D,L,C,k,14,n[22]),C=h(C,x,D,L,m,20,n[23]),L=h(L,C,x,D,v,5,n[24]),D=h(D,L,C,x,T,9,n[25]),x=h(x,D,L,C,f,14,n[26]),C=h(C,x,D,L,b,20,n[27]),L=h(L,C,x,D,E,5,n[28]),D=h(D,L,C,x,p,9,n[29]),x=h(x,D,L,C,A,14,n[30]),L=c(L,C=h(C,x,D,L,S,20,n[31]),x,D,g,4,n[32]),D=c(D,L,C,x,b,11,n[33]),x=c(x,D,L,C,w,16,n[34]),C=c(C,x,D,L,T,23,n[35]),L=c(L,C,x,D,l,4,n[36]),D=c(D,L,C,x,m,11,n[37]),x=c(x,D,L,C,A,16,n[38]),C=c(C,x,D,L,_,23,n[39]),L=c(L,C,x,D,E,4,n[40]),D=c(D,L,C,x,a,11,n[41]),x=c(x,D,L,C,f,16,n[42]),C=c(C,x,D,L,y,23,n[43]),L=c(L,C,x,D,v,4,n[44]),D=c(D,L,C,x,S,11,n[45]),x=c(x,D,L,C,k,16,n[46]),L=u(L,C=c(C,x,D,L,p,23,n[47]),x,D,a,6,n[48]),D=u(D,L,C,x,A,10,n[49]),x=u(x,D,L,C,T,15,n[50]),C=u(C,x,D,L,g,21,n[51]),L=u(L,C,x,D,S,6,n[52]),D=u(D,L,C,x,f,10,n[53]),x=u(x,D,L,C,_,15,n[54]),C=u(C,x,D,L,l,21,n[55]),L=u(L,C,x,D,b,6,n[56]),D=u(D,L,C,x,k,10,n[57]),x=u(x,D,L,C,y,15,n[58]),C=u(C,x,D,L,E,21,n[59]),L=u(L,C,x,D,m,6,n[60]),D=u(D,L,C,x,w,10,n[61]),x=u(x,D,L,C,p,15,n[62]),C=u(C,x,D,L,v,21,n[63]),o[0]=o[0]+L|0,o[1]=o[1]+C|0,o[2]=o[2]+x|0,o[3]=o[3]+D|0},_doFinalize:function(){var t=this._data,i=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;i[r>>>5]|=128<<24-r%32;var o=e.floor(s/4294967296),a=s;i[15+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),i[14+(r+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(i.length+1),this._process();for(var n=this._hash,l=n.words,d=0;d<4;d++){var h=l[d];l[d]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}return n},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function d(e,t,i,s,r,o,a){var n=e+(t&i|~t&s)+r+a;return(n<>>32-o)+t}function h(e,t,i,s,r,o,a){var n=e+(t&s|i&~s)+r+a;return(n<>>32-o)+t}function c(e,t,i,s,r,o,a){var n=e+(t^i^s)+r+a;return(n<>>32-o)+t}function u(e,t,i,s,r,o,a){var n=e+(i^(t|~s))+r+a;return(n<>>32-o)+t}t.MD5=o._createHelper(l),t.HmacMD5=o._createHmacHelper(l)}(Math),i.MD5)})),Rr((function(e,t){var i,s,r,o,a,n,l,d;e.exports=(s=(i=d=wd).lib,r=s.WordArray,o=s.Hasher,a=i.algo,n=[],l=a.SHA1=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],r=i[1],o=i[2],a=i[3],l=i[4],d=0;d<80;d++){if(d<16)n[d]=0|e[t+d];else{var h=n[d-3]^n[d-8]^n[d-14]^n[d-16];n[d]=h<<1|h>>>31}var c=(s<<5|s>>>27)+l+n[d];c+=d<20?1518500249+(r&o|~r&a):d<40?1859775393+(r^o^a):d<60?(r&o|r&a|o&a)-1894007588:(r^o^a)-899497514,l=a,a=o,o=r<<30|r>>>2,r=s,s=c}i[0]=i[0]+s|0,i[1]=i[1]+r|0,i[2]=i[2]+o|0,i[3]=i[3]+a|0,i[4]=i[4]+l|0},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;return t[s>>>5]|=128<<24-s%32,t[14+(s+64>>>9<<4)]=Math.floor(i/4294967296),t[15+(s+64>>>9<<4)]=i,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),i.SHA1=o._createHelper(l),i.HmacSHA1=o._createHmacHelper(l),d.SHA1)})),Rr((function(e,t){var i;e.exports=(i=wd,function(e){var t=i,s=t.lib,r=s.WordArray,o=s.Hasher,a=t.algo,n=[],l=[];!function(){function t(t){for(var i=e.sqrt(t),s=2;s<=i;s++)if(!(t%s))return!1;return!0}function i(e){return 4294967296*(e-(0|e))|0}for(var s=2,r=0;r<64;)t(s)&&(r<8&&(n[r]=i(e.pow(s,.5))),l[r]=i(e.pow(s,1/3)),r++),s++}();var d=[],h=a.SHA256=o.extend({_doReset:function(){this._hash=new r.init(n.slice(0))},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],r=i[1],o=i[2],a=i[3],n=i[4],h=i[5],c=i[6],u=i[7],p=0;p<64;p++){if(p<16)d[p]=0|e[t+p];else{var f=d[p-15],m=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,g=d[p-2],y=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;d[p]=m+d[p-7]+y+d[p-16]}var A=s&r^s&o^r&o,b=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),v=u+((n<<26|n>>>6)^(n<<21|n>>>11)^(n<<7|n>>>25))+(n&h^~n&c)+l[p]+d[p];u=c,c=h,h=n,n=a+v|0,a=o,o=r,r=s,s=v+(b+A)|0}i[0]=i[0]+s|0,i[1]=i[1]+r|0,i[2]=i[2]+o|0,i[3]=i[3]+a|0,i[4]=i[4]+n|0,i[5]=i[5]+h|0,i[6]=i[6]+c|0,i[7]=i[7]+u|0},_doFinalize:function(){var t=this._data,i=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;return i[r>>>5]|=128<<24-r%32,i[14+(r+64>>>9<<4)]=e.floor(s/4294967296),i[15+(r+64>>>9<<4)]=s,t.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(h),t.HmacSHA256=o._createHmacHelper(h)}(Math),i.SHA256)})),Rr((function(e,t){var i,s,r,o,a,n;e.exports=(s=(i=n=wd).lib.WordArray,r=i.algo,o=r.SHA256,a=r.SHA224=o.extend({_doReset:function(){this._hash=new s.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=4,e}}),i.SHA224=o._createHelper(a),i.HmacSHA224=o._createHmacHelper(a),n.SHA224)})),Rr((function(e,t){var i;e.exports=(i=wd,function(){var e=i,t=e.lib.Hasher,s=e.x64,r=s.Word,o=s.WordArray,a=e.algo;function n(){return r.create.apply(r,arguments)}var l=[n(1116352408,3609767458),n(1899447441,602891725),n(3049323471,3964484399),n(3921009573,2173295548),n(961987163,4081628472),n(1508970993,3053834265),n(2453635748,2937671579),n(2870763221,3664609560),n(3624381080,2734883394),n(310598401,1164996542),n(607225278,1323610764),n(1426881987,3590304994),n(1925078388,4068182383),n(2162078206,991336113),n(2614888103,633803317),n(3248222580,3479774868),n(3835390401,2666613458),n(4022224774,944711139),n(264347078,2341262773),n(604807628,2007800933),n(770255983,1495990901),n(1249150122,1856431235),n(1555081692,3175218132),n(1996064986,2198950837),n(2554220882,3999719339),n(2821834349,766784016),n(2952996808,2566594879),n(3210313671,3203337956),n(3336571891,1034457026),n(3584528711,2466948901),n(113926993,3758326383),n(338241895,168717936),n(666307205,1188179964),n(773529912,1546045734),n(1294757372,1522805485),n(1396182291,2643833823),n(1695183700,2343527390),n(1986661051,1014477480),n(2177026350,1206759142),n(2456956037,344077627),n(2730485921,1290863460),n(2820302411,3158454273),n(3259730800,3505952657),n(3345764771,106217008),n(3516065817,3606008344),n(3600352804,1432725776),n(4094571909,1467031594),n(275423344,851169720),n(430227734,3100823752),n(506948616,1363258195),n(659060556,3750685593),n(883997877,3785050280),n(958139571,3318307427),n(1322822218,3812723403),n(1537002063,2003034995),n(1747873779,3602036899),n(1955562222,1575990012),n(2024104815,1125592928),n(2227730452,2716904306),n(2361852424,442776044),n(2428436474,593698344),n(2756734187,3733110249),n(3204031479,2999351573),n(3329325298,3815920427),n(3391569614,3928383900),n(3515267271,566280711),n(3940187606,3454069534),n(4118630271,4000239992),n(116418474,1914138554),n(174292421,2731055270),n(289380356,3203993006),n(460393269,320620315),n(685471733,587496836),n(852142971,1086792851),n(1017036298,365543100),n(1126000580,2618297676),n(1288033470,3409855158),n(1501505948,4234509866),n(1607167915,987167468),n(1816402316,1246189591)],d=[];!function(){for(var e=0;e<80;e++)d[e]=n()}();var h=a.SHA512=t.extend({_doReset:function(){this._hash=new o.init([new r.init(1779033703,4089235720),new r.init(3144134277,2227873595),new r.init(1013904242,4271175723),new r.init(2773480762,1595750129),new r.init(1359893119,2917565137),new r.init(2600822924,725511199),new r.init(528734635,4215389547),new r.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],r=i[1],o=i[2],a=i[3],n=i[4],h=i[5],c=i[6],u=i[7],p=s.high,f=s.low,m=r.high,g=r.low,y=o.high,A=o.low,b=a.high,v=a.low,_=n.high,w=n.low,S=h.high,E=h.low,T=c.high,k=c.low,L=u.high,C=u.low,x=p,D=f,R=m,P=g,I=y,B=A,M=b,F=v,U=_,O=w,N=S,j=E,G=T,W=k,z=L,$=C,V=0;V<80;V++){var H,J,q=d[V];if(V<16)J=q.high=0|e[t+2*V],H=q.low=0|e[t+2*V+1];else{var K=d[V-15],Y=K.high,Q=K.low,X=(Y>>>1|Q<<31)^(Y>>>8|Q<<24)^Y>>>7,Z=(Q>>>1|Y<<31)^(Q>>>8|Y<<24)^(Q>>>7|Y<<25),ee=d[V-2],te=ee.high,ie=ee.low,se=(te>>>19|ie<<13)^(te<<3|ie>>>29)^te>>>6,re=(ie>>>19|te<<13)^(ie<<3|te>>>29)^(ie>>>6|te<<26),oe=d[V-7],ae=oe.high,ne=oe.low,le=d[V-16],de=le.high,he=le.low;J=(J=(J=X+ae+((H=Z+ne)>>>0>>0?1:0))+se+((H+=re)>>>0>>0?1:0))+de+((H+=he)>>>0>>0?1:0),q.high=J,q.low=H}var ce,ue=U&N^~U&G,pe=O&j^~O&W,fe=x&R^x&I^R&I,me=D&P^D&B^P&B,ge=(x>>>28|D<<4)^(x<<30|D>>>2)^(x<<25|D>>>7),ye=(D>>>28|x<<4)^(D<<30|x>>>2)^(D<<25|x>>>7),Ae=(U>>>14|O<<18)^(U>>>18|O<<14)^(U<<23|O>>>9),be=(O>>>14|U<<18)^(O>>>18|U<<14)^(O<<23|U>>>9),ve=l[V],_e=ve.high,we=ve.low,Se=z+Ae+((ce=$+be)>>>0<$>>>0?1:0),Ee=ye+me;z=G,$=W,G=N,W=j,N=U,j=O,U=M+(Se=(Se=(Se=Se+ue+((ce+=pe)>>>0>>0?1:0))+_e+((ce+=we)>>>0>>0?1:0))+J+((ce+=H)>>>0>>0?1:0))+((O=F+ce|0)>>>0>>0?1:0)|0,M=I,F=B,I=R,B=P,R=x,P=D,x=Se+(ge+fe+(Ee>>>0>>0?1:0))+((D=ce+Ee|0)>>>0>>0?1:0)|0}f=s.low=f+D,s.high=p+x+(f>>>0>>0?1:0),g=r.low=g+P,r.high=m+R+(g>>>0

>>0?1:0),A=o.low=A+B,o.high=y+I+(A>>>0>>0?1:0),v=a.low=v+F,a.high=b+M+(v>>>0>>0?1:0),w=n.low=w+O,n.high=_+U+(w>>>0>>0?1:0),E=h.low=E+j,h.high=S+N+(E>>>0>>0?1:0),k=c.low=k+W,c.high=T+G+(k>>>0>>0?1:0),C=u.low=C+$,u.high=L+z+(C>>>0<$>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;return t[s>>>5]|=128<<24-s%32,t[30+(s+128>>>10<<5)]=Math.floor(i/4294967296),t[31+(s+128>>>10<<5)]=i,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(h),e.HmacSHA512=t._createHmacHelper(h)}(),i.SHA512)})),Rr((function(e,t){var i,s,r,o,a,n,l,d;e.exports=(s=(i=d=wd).x64,r=s.Word,o=s.WordArray,a=i.algo,n=a.SHA512,l=a.SHA384=n.extend({_doReset:function(){this._hash=new o.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=16,e}}),i.SHA384=n._createHelper(l),i.HmacSHA384=n._createHmacHelper(l),d.SHA384)})),Rr((function(e,t){var i;e.exports=(i=wd,function(e){var t=i,s=t.lib,r=s.WordArray,o=s.Hasher,a=t.x64.Word,n=t.algo,l=[],d=[],h=[];!function(){for(var e=1,t=0,i=0;i<24;i++){l[e+5*t]=(i+1)*(i+2)/2%64;var s=(2*e+3*t)%5;e=t%5,t=s}for(e=0;e<5;e++)for(t=0;t<5;t++)d[e+5*t]=t+(2*e+3*t)%5*5;for(var r=1,o=0;o<24;o++){for(var n=0,c=0,u=0;u<7;u++){if(1&r){var p=(1<>>24)|4278255360&(o<<24|o>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(C=i[r]).high^=a,C.low^=o}for(var n=0;n<24;n++){for(var u=0;u<5;u++){for(var p=0,f=0,m=0;m<5;m++)p^=(C=i[u+5*m]).high,f^=C.low;var g=c[u];g.high=p,g.low=f}for(u=0;u<5;u++){var y=c[(u+4)%5],A=c[(u+1)%5],b=A.high,v=A.low;for(p=y.high^(b<<1|v>>>31),f=y.low^(v<<1|b>>>31),m=0;m<5;m++)(C=i[u+5*m]).high^=p,C.low^=f}for(var _=1;_<25;_++){var w=(C=i[_]).high,S=C.low,E=l[_];E<32?(p=w<>>32-E,f=S<>>32-E):(p=S<>>64-E,f=w<>>64-E);var T=c[d[_]];T.high=p,T.low=f}var k=c[0],L=i[0];for(k.high=L.high,k.low=L.low,u=0;u<5;u++)for(m=0;m<5;m++){var C=i[_=u+5*m],x=c[_],D=c[(u+1)%5+5*m],R=c[(u+2)%5+5*m];C.high=x.high^~D.high&R.high,C.low=x.low^~D.low&R.low}C=i[0];var P=h[n];C.high^=P.high,C.low^=P.low}},_doFinalize:function(){var t=this._data,i=t.words;this._nDataBytes;var s=8*t.sigBytes,o=32*this.blockSize;i[s>>>5]|=1<<24-s%32,i[(e.ceil((s+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*i.length,this._process();for(var a=this._state,n=this.cfg.outputLength/8,l=n/8,d=[],h=0;h>>24)|4278255360&(u<<24|u>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),d.push(p),d.push(u)}return new r.init(d,n)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),i=0;i<25;i++)t[i]=t[i].clone();return e}});t.SHA3=o._createHelper(u),t.HmacSHA3=o._createHmacHelper(u)}(Math),i.SHA3)})),Rr((function(e,t){var i;e.exports=(i=wd,function(e){var t=i,s=t.lib,r=s.WordArray,o=s.Hasher,a=t.algo,n=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),l=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),d=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),h=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),c=r.create([0,1518500249,1859775393,2400959708,2840853838]),u=r.create([1352829926,1548603684,1836072691,2053994217,0]),p=a.RIPEMD160=o.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=0;i<16;i++){var s=t+i,r=e[s];e[s]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var o,a,p,v,_,w,S,E,T,k,L,C=this._hash.words,x=c.words,D=u.words,R=n.words,P=l.words,I=d.words,B=h.words;for(w=o=C[0],S=a=C[1],E=p=C[2],T=v=C[3],k=_=C[4],i=0;i<80;i+=1)L=o+e[t+R[i]]|0,L+=i<16?f(a,p,v)+x[0]:i<32?m(a,p,v)+x[1]:i<48?g(a,p,v)+x[2]:i<64?y(a,p,v)+x[3]:A(a,p,v)+x[4],L=(L=b(L|=0,I[i]))+_|0,o=_,_=v,v=b(p,10),p=a,a=L,L=w+e[t+P[i]]|0,L+=i<16?A(S,E,T)+D[0]:i<32?y(S,E,T)+D[1]:i<48?g(S,E,T)+D[2]:i<64?m(S,E,T)+D[3]:f(S,E,T)+D[4],L=(L=b(L|=0,B[i]))+k|0,w=k,k=T,T=b(E,10),E=S,S=L;L=C[1]+p+T|0,C[1]=C[2]+v+k|0,C[2]=C[3]+_+w|0,C[3]=C[4]+o+S|0,C[4]=C[0]+a+E|0,C[0]=L},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;t[s>>>5]|=128<<24-s%32,t[14+(s+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),e.sigBytes=4*(t.length+1),this._process();for(var r=this._hash,o=r.words,a=0;a<5;a++){var n=o[a];o[a]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}return r},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function f(e,t,i){return e^t^i}function m(e,t,i){return e&t|~e&i}function g(e,t,i){return(e|~t)^i}function y(e,t,i){return e&i|t&~i}function A(e,t,i){return e^(t|~i)}function b(e,t){return e<>>32-t}t.RIPEMD160=o._createHelper(p),t.HmacRIPEMD160=o._createHmacHelper(p)}(),i.RIPEMD160)})),Rr((function(e,t){var i,s,r;e.exports=(s=(i=wd).lib.Base,r=i.enc.Utf8,void(i.algo.HMAC=s.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var i=e.blockSize,s=4*i;t.sigBytes>s&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),a=this._iKey=t.clone(),n=o.words,l=a.words,d=0;d>>2];e.sigBytes-=t}};s.BlockCipher=h.extend({cfg:h.cfg.extend({mode:p,padding:f}),reset:function(){var e;h.reset.call(this);var t=this.cfg,i=t.iv,s=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=s.createEncryptor:(e=s.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,i&&i.words):(this._mode=e.call(s,this,i&&i.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=s.CipherParams=r.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),g=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,i=e.salt;return(i?o.create([1398893684,1701076831]).concat(i).concat(t):t).toString(l)},parse:function(e){var t,i=l.parse(e),s=i.words;return 1398893684==s[0]&&1701076831==s[1]&&(t=o.create(s.slice(2,4)),s.splice(0,4),i.sigBytes-=16),m.create({ciphertext:i,salt:t})}},y=s.SerializableCipher=r.extend({cfg:r.extend({format:g}),encrypt:function(e,t,i,s){s=this.cfg.extend(s);var r=e.createEncryptor(i,s),o=r.finalize(t),a=r.cfg;return m.create({ciphertext:o,key:i,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:s.format})},decrypt:function(e,t,i,s){return s=this.cfg.extend(s),t=this._parse(t,s.format),e.createDecryptor(i,s).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),A=(t.kdf={}).OpenSSL={execute:function(e,t,i,s,r){if(s||(s=o.random(8)),r)a=d.create({keySize:t+i,hasher:r}).compute(e,s);else var a=d.create({keySize:t+i}).compute(e,s);var n=o.create(a.words.slice(t),4*i);return a.sigBytes=4*t,m.create({key:a,iv:n,salt:s})}},b=s.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:A}),encrypt:function(e,t,i,s){var r=(s=this.cfg.extend(s)).kdf.execute(i,e.keySize,e.ivSize,s.salt,s.hasher);s.iv=r.iv;var o=y.encrypt.call(this,e,t,r.key,s);return o.mixIn(r),o},decrypt:function(e,t,i,s){s=this.cfg.extend(s),t=this._parse(t,s.format);var r=s.kdf.execute(i,e.keySize,e.ivSize,t.salt,s.hasher);return s.iv=r.iv,y.decrypt.call(this,e,t,r.key,s)}})}())})),Rr((function(e,t){var i;e.exports=((i=wd).mode.CFB=function(){var e=i.lib.BlockCipherMode.extend();function t(e,t,i,s){var r,o=this._iv;o?(r=o.slice(0),this._iv=void 0):r=this._prevBlock,s.encryptBlock(r,0);for(var a=0;a>24&255)){var t=e>>16&255,i=e>>8&255,s=255&e;255===t?(t=0,255===i?(i=0,255===s?s=0:++s):++i):++t,e=0,e+=t<<16,e+=i<<8,e+=s}else e+=1<<24;return e}function s(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var r=e.Encryptor=e.extend({processBlock:function(e,t){var i=this._cipher,r=i.blockSize,o=this._iv,a=this._counter;o&&(a=this._counter=o.slice(0),this._iv=void 0),s(a);var n=a.slice(0);i.encryptBlock(n,0);for(var l=0;l>>2]|=r<<24-o%4*8,e.sigBytes+=r},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Ansix923)})),Rr((function(e,t){var i;e.exports=((i=wd).pad.Iso10126={pad:function(e,t){var s=4*t,r=s-e.sigBytes%s;e.concat(i.lib.WordArray.random(r-1)).concat(i.lib.WordArray.create([r<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Iso10126)})),Rr((function(e,t){var i;e.exports=((i=wd).pad.Iso97971={pad:function(e,t){e.concat(i.lib.WordArray.create([2147483648],1)),i.pad.ZeroPadding.pad(e,t)},unpad:function(e){i.pad.ZeroPadding.unpad(e),e.sigBytes--}},i.pad.Iso97971)})),Rr((function(e,t){var i;e.exports=((i=wd).pad.ZeroPadding={pad:function(e,t){var i=4*t;e.clamp(),e.sigBytes+=i-(e.sigBytes%i||i)},unpad:function(e){var t=e.words,i=e.sigBytes-1;for(i=e.sigBytes-1;i>=0;i--)if(t[i>>>2]>>>24-i%4*8&255){e.sigBytes=i+1;break}}},i.pad.ZeroPadding)})),Rr((function(e,t){var i;e.exports=((i=wd).pad.NoPadding={pad:function(){},unpad:function(){}},i.pad.NoPadding)})),Rr((function(e,t){var i;e.exports=(i=wd,function(e){var t=i,s=t.lib.CipherParams,r=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(r)},parse:function(e){var t=r.parse(e);return s.create({ciphertext:t})}}}(),i.format.Hex)})),Rr((function(e,t){var i;e.exports=(i=wd,function(){var e=i,t=e.lib.BlockCipher,s=e.algo,r=[],o=[],a=[],n=[],l=[],d=[],h=[],c=[],u=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var i=0,s=0;for(t=0;t<256;t++){var f=s^s<<1^s<<2^s<<3^s<<4;f=f>>>8^255&f^99,r[i]=f,o[f]=i;var m=e[i],g=e[m],y=e[g],A=257*e[f]^16843008*f;a[i]=A<<24|A>>>8,n[i]=A<<16|A>>>16,l[i]=A<<8|A>>>24,d[i]=A,A=16843009*y^65537*g^257*m^16843008*i,h[f]=A<<24|A>>>8,c[f]=A<<16|A>>>16,u[f]=A<<8|A>>>24,p[f]=A,i?(i=m^e[e[e[y^m]]],s^=e[e[s]]):i=s=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],m=s.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,i=e.sigBytes/4,s=4*((this._nRounds=i+6)+1),o=this._keySchedule=[],a=0;a6&&a%i==4&&(d=r[d>>>24]<<24|r[d>>>16&255]<<16|r[d>>>8&255]<<8|r[255&d]):(d=r[(d=d<<8|d>>>24)>>>24]<<24|r[d>>>16&255]<<16|r[d>>>8&255]<<8|r[255&d],d^=f[a/i|0]<<24),o[a]=o[a-i]^d);for(var n=this._invKeySchedule=[],l=0;l>>24]]^c[r[d>>>16&255]]^u[r[d>>>8&255]]^p[r[255&d]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,n,l,d,r)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,h,c,u,p,o),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,s,r,o,a,n){for(var l=this._nRounds,d=e[t]^i[0],h=e[t+1]^i[1],c=e[t+2]^i[2],u=e[t+3]^i[3],p=4,f=1;f>>24]^r[h>>>16&255]^o[c>>>8&255]^a[255&u]^i[p++],g=s[h>>>24]^r[c>>>16&255]^o[u>>>8&255]^a[255&d]^i[p++],y=s[c>>>24]^r[u>>>16&255]^o[d>>>8&255]^a[255&h]^i[p++],A=s[u>>>24]^r[d>>>16&255]^o[h>>>8&255]^a[255&c]^i[p++];d=m,h=g,c=y,u=A}m=(n[d>>>24]<<24|n[h>>>16&255]<<16|n[c>>>8&255]<<8|n[255&u])^i[p++],g=(n[h>>>24]<<24|n[c>>>16&255]<<16|n[u>>>8&255]<<8|n[255&d])^i[p++],y=(n[c>>>24]<<24|n[u>>>16&255]<<16|n[d>>>8&255]<<8|n[255&h])^i[p++],A=(n[u>>>24]<<24|n[d>>>16&255]<<16|n[h>>>8&255]<<8|n[255&c])^i[p++],e[t]=m,e[t+1]=g,e[t+2]=y,e[t+3]=A},keySize:8});e.AES=t._createHelper(m)}(),i.AES)})),Rr((function(e,t){var i;e.exports=(i=wd,function(){var e=i,t=e.lib,s=t.WordArray,r=t.BlockCipher,o=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],n=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],d=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],h=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],c=o.DES=r.extend({_doReset:function(){for(var e=this._key.words,t=[],i=0;i<56;i++){var s=a[i]-1;t[i]=e[s>>>5]>>>31-s%32&1}for(var r=this._subKeys=[],o=0;o<16;o++){var d=r[o]=[],h=l[o];for(i=0;i<24;i++)d[i/6|0]|=t[(n[i]-1+h)%28]<<31-i%6,d[4+(i/6|0)]|=t[28+(n[i+24]-1+h)%28]<<31-i%6;for(d[0]=d[0]<<1|d[0]>>>31,i=1;i<7;i++)d[i]=d[i]>>>4*(i-1)+3;d[7]=d[7]<<5|d[7]>>>27}var c=this._invSubKeys=[];for(i=0;i<16;i++)c[i]=r[15-i]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,i){this._lBlock=e[t],this._rBlock=e[t+1],u.call(this,4,252645135),u.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),u.call(this,1,1431655765);for(var s=0;s<16;s++){for(var r=i[s],o=this._lBlock,a=this._rBlock,n=0,l=0;l<8;l++)n|=d[l][((a^r[l])&h[l])>>>0];this._lBlock=a,this._rBlock=o^n}var c=this._lBlock;this._lBlock=this._rBlock,this._rBlock=c,u.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),u.call(this,16,65535),u.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function u(e,t){var i=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=i,this._lBlock^=i<>>e^this._lBlock)&t;this._lBlock^=i,this._rBlock^=i<192.");var t=e.slice(0,2),i=e.length<4?e.slice(0,2):e.slice(2,4),r=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=c.createEncryptor(s.create(t)),this._des2=c.createEncryptor(s.create(i)),this._des3=c.createEncryptor(s.create(r))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=r._createHelper(f)}(),i.TripleDES)})),Rr((function(e,t){var i;e.exports=(i=wd,function(){var e=i,t=e.lib.StreamCipher,s=e.algo,r=s.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,i=e.sigBytes,s=this._S=[],r=0;r<256;r++)s[r]=r;r=0;for(var o=0;r<256;r++){var a=r%i,n=t[a>>>2]>>>24-a%4*8&255;o=(o+s[r]+n)%256;var l=s[r];s[r]=s[o],s[o]=l}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,i=this._j,s=0,r=0;r<4;r++){i=(i+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[i],e[i]=o,s|=e[(e[t]+e[i])%256]<<24-8*r}return this._i=t,this._j=i,s}e.RC4=t._createHelper(r);var a=s.RC4Drop=r.extend({cfg:r.cfg.extend({drop:192}),_doReset:function(){r._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});e.RC4Drop=t._createHelper(a)}(),i.RC4)})),Rr((function(e,t){var i;e.exports=(i=wd,function(){var e=i,t=e.lib.StreamCipher,s=e.algo,r=[],o=[],a=[],n=s.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,i=0;i<4;i++)e[i]=16711935&(e[i]<<8|e[i]>>>24)|4278255360&(e[i]<<24|e[i]>>>8);var s=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],r=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,i=0;i<4;i++)l.call(this);for(i=0;i<8;i++)r[i]^=s[i+4&7];if(t){var o=t.words,a=o[0],n=o[1],d=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),c=d>>>16|4294901760&h,u=h<<16|65535&d;for(r[0]^=d,r[1]^=c,r[2]^=h,r[3]^=u,r[4]^=d,r[5]^=c,r[6]^=h,r[7]^=u,i=0;i<4;i++)l.call(this)}},_doProcessBlock:function(e,t){var i=this._X;l.call(this),r[0]=i[0]^i[5]>>>16^i[3]<<16,r[1]=i[2]^i[7]>>>16^i[5]<<16,r[2]=i[4]^i[1]>>>16^i[7]<<16,r[3]=i[6]^i[3]>>>16^i[1]<<16;for(var s=0;s<4;s++)r[s]=16711935&(r[s]<<8|r[s]>>>24)|4278255360&(r[s]<<24|r[s]>>>8),e[t+s]^=r[s]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,i=0;i<8;i++)o[i]=t[i];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,i=0;i<8;i++){var s=e[i]+t[i],r=65535&s,n=s>>>16,l=((r*r>>>17)+r*n>>>15)+n*n,d=((4294901760&s)*s|0)+((65535&s)*s|0);a[i]=l^d}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=t._createHelper(n)}(),i.Rabbit)})),Rr((function(e,t){var i;e.exports=(i=wd,function(){var e=i,t=e.lib.StreamCipher,s=e.algo,r=[],o=[],a=[],n=s.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],s=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var r=0;r<4;r++)l.call(this);for(r=0;r<8;r++)s[r]^=i[r+4&7];if(t){var o=t.words,a=o[0],n=o[1],d=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),c=d>>>16|4294901760&h,u=h<<16|65535&d;for(s[0]^=d,s[1]^=c,s[2]^=h,s[3]^=u,s[4]^=d,s[5]^=c,s[6]^=h,s[7]^=u,r=0;r<4;r++)l.call(this)}},_doProcessBlock:function(e,t){var i=this._X;l.call(this),r[0]=i[0]^i[5]>>>16^i[3]<<16,r[1]=i[2]^i[7]>>>16^i[5]<<16,r[2]=i[4]^i[1]>>>16^i[7]<<16,r[3]=i[6]^i[3]>>>16^i[1]<<16;for(var s=0;s<4;s++)r[s]=16711935&(r[s]<<8|r[s]>>>24)|4278255360&(r[s]<<24|r[s]>>>8),e[t+s]^=r[s]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,i=0;i<8;i++)o[i]=t[i];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,i=0;i<8;i++){var s=e[i]+t[i],r=65535&s,n=s>>>16,l=((r*r>>>17)+r*n>>>15)+n*n,d=((4294901760&s)*s|0)+((65535&s)*s|0);a[i]=l^d}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=t._createHelper(n)}(),i.RabbitLegacy)})),Rr((function(e,t){var i;e.exports=(i=wd,function(){var e=i,t=e.lib.BlockCipher,s=e.algo;const r=16,o=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var n={pbox:[],sbox:[]};function l(e,t){let i=t>>24&255,s=t>>16&255,r=t>>8&255,o=255&t,a=e.sbox[0][i]+e.sbox[1][s];return a^=e.sbox[2][r],a+=e.sbox[3][o],a}function d(e,t,i){let s,o=t,a=i;for(let t=0;t1;--t)o^=e.pbox[t],a=l(e,o)^a,s=o,o=a,a=s;return s=o,o=a,a=s,a^=e.pbox[1],o^=e.pbox[0],{left:o,right:a}}function c(e,t,i){for(let t=0;t<4;t++){e.sbox[t]=[];for(let i=0;i<256;i++)e.sbox[t][i]=a[t][i]}let s=0;for(let a=0;a=i&&(s=0);let n=0,l=0,h=0;for(let t=0;t>>2]|=e[i]<<24-i%4*8;return Sd.lib.WordArray.create(t,e.length)}const kd=16,Ld=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],Cd=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function xd(e){const t=[];for(let i=0,s=e.length;i1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Rd(e){const t=[];for(let i=0,s=e.length;i>>6),t.push(128|63&s);else if(s<=55295||s>=57344&&s<=65535)t.push(224|s>>>12),t.push(128|s>>>6&63),t.push(128|63&s);else{if(!(s>=65536&&s<=1114111))throw t.push(s),new Error("input is not supported");i++,t.push(240|s>>>18&28),t.push(128|s>>>12&63),t.push(128|s>>>6&63),t.push(128|63&s)}}return t}function Pd(e){const t=[];for(let i=0,s=e.length;i=240&&e[i]<=247?(t.push(String.fromCodePoint(((7&e[i])<<18)+((63&e[i+1])<<12)+((63&e[i+2])<<6)+(63&e[i+3]))),i+=3):e[i]>=224&&e[i]<=239?(t.push(String.fromCodePoint(((15&e[i])<<12)+((63&e[i+1])<<6)+(63&e[i+2]))),i+=2):e[i]>=192&&e[i]<=223?(t.push(String.fromCodePoint(((31&e[i])<<6)+(63&e[i+1]))),i++):t.push(String.fromCodePoint(e[i]));return t.join("")}function Id(e,t){const i=31&t;return e<>>32-i}function Bd(e){return(255&Ld[e>>>24&255])<<24|(255&Ld[e>>>16&255])<<16|(255&Ld[e>>>8&255])<<8|255&Ld[255&e]}function Md(e){return e^Id(e,2)^Id(e,10)^Id(e,18)^Id(e,24)}function Fd(e){return e^Id(e,13)^Id(e,23)}function Ud(e,t,i){const s=new Array(4),r=new Array(4);for(let t=0;t<4;t++)r[0]=255&e[4*t],r[1]=255&e[4*t+1],r[2]=255&e[4*t+2],r[3]=255&e[4*t+3],s[t]=r[0]<<24|r[1]<<16|r[2]<<8|r[3];for(let e,t=0;t<32;t+=4)e=s[1]^s[2]^s[3]^i[t+0],s[0]^=Md(Bd(e)),e=s[2]^s[3]^s[0]^i[t+1],s[1]^=Md(Bd(e)),e=s[3]^s[0]^s[1]^i[t+2],s[2]^=Md(Bd(e)),e=s[0]^s[1]^s[2]^i[t+3],s[3]^=Md(Bd(e));for(let e=0;e<16;e+=4)t[e]=s[3-e/4]>>>24&255,t[e+1]=s[3-e/4]>>>16&255,t[e+2]=s[3-e/4]>>>8&255,t[e+3]=255&s[3-e/4]}function Od(e,t,i){const s=new Array(4),r=new Array(4);for(let t=0;t<4;t++)r[0]=255&e[0+4*t],r[1]=255&e[1+4*t],r[2]=255&e[2+4*t],r[3]=255&e[3+4*t],s[t]=r[0]<<24|r[1]<<16|r[2]<<8|r[3];s[0]^=2746333894,s[1]^=1453994832,s[2]^=1736282519,s[3]^=2993693404;for(let e,i=0;i<32;i+=4)e=s[1]^s[2]^s[3]^Cd[i+0],t[i+0]=s[0]^=Fd(Bd(e)),e=s[2]^s[3]^s[0]^Cd[i+1],t[i+1]=s[1]^=Fd(Bd(e)),e=s[3]^s[0]^s[1]^Cd[i+2],t[i+2]=s[2]^=Fd(Bd(e)),e=s[0]^s[1]^s[2]^Cd[i+3],t[i+3]=s[3]^=Fd(Bd(e));if(0===i)for(let e,i=0;i<16;i++)e=t[i],t[i]=t[31-i],t[31-i]=e}function Nd(e,t,i){let{padding:s="pkcs#7",mode:r,iv:o=[],output:a="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===r&&("string"==typeof o&&(o=xd(o)),16!==o.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=xd(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==i?Rd(e):xd(e):[...e],("pkcs#5"===s||"pkcs#7"===s)&&0!==i){const t=kd-e.length%kd;for(let i=0;i=kd;){const t=e.slice(c,c+16),s=new Array(16);if("cbc"===r)for(let e=0;ee.length&&s+r<=i.length?e.length-t:s+r>i.length&&t+r<=e.length?i.length-s:t+r<=e.length&&s+r<=i.length?r:i.length>24&255,e>>16&255,e>>8&255,255&e)}function Kd(e,t){return t+3>>19)^(s<<23|s>>>9)}function Xd(e,t){var i=new Array(36);i[0]=Kd(t,0),i[1]=Kd(t,4),i[2]=Kd(t,8),i[3]=Kd(t,12);for(var s=0;s<32;s++)i[s+4]=i[s]^Zd(i[s+1]^i[s+2]^i[s+3]^e[s]);var r=new Array(4);for(s=35;s>=32;s--)r[35-s]=i[s];var o=function(e){for(var t=new Array(4*e.length),i=0;i>>30)^(s<<10|s>>>22)^(s<<18|s>>>14)^(s<<24|s>>>8)}function eh(e,t,i){if(null==e||null==e||e.length%16!=0)return console.log("sm4 key is error!"),null;if(null==i||null==i||i.length<=0)return console.log("cipher is error!"),null;if(null==t||null==t||t.length%16!=0)return console.log("iv is error!"),null;for(var s=Yd(e),r=Math.ceil(i.length/16),o=new Array(i.length),a=t.slice(),n=0;ne)return this.preDelayTimestamp-e>1e3&&this.player.debugWarn("CommonDemux",`getDelay() and preDelayTimestamp is ${this.preDelayTimestamp} > timestamp is ${e} more than ${this.preDelayTimestamp-e}ms and return ${this.delay}`),this.preDelayTimestamp=e,this.delay;if(this.firstTimestamp){if(e){const t=Date.now()-this.startTimestamp,i=e-this.firstTimestamp;t>=i?(this.isStreamTsMoreThanLocal=!1,this.delay=t-i):(this.isStreamTsMoreThanLocal=!0,this.delay=i-t)}}else this.firstTimestamp=e,this.startTimestamp=Date.now(),this.delay=-1;return this.preDelayTimestamp=e,this.delay}getDelayNotUpdateDelay(e,t){if(!e||!this.player.isDemuxDecodeFirstIIframeInit())return-1;if(t===Ue)return this.pushLatestDelay;if(this.preDelayTimestamp&&this.preDelayTimestamp-e>1e3)return this.player.debugWarn("CommonDemux",`getDelayNotUpdateDelay() and preDelayTimestamp is ${this.preDelayTimestamp} > timestamp is ${e} more than ${this.preDelayTimestamp-e}ms and return -1`),-1;if(this.firstTimestamp){let t=-1;if(e){const i=Date.now()-this.startTimestamp,s=e-this.firstTimestamp;t=i>=s?i-s:s-i}return t}return-1}resetDelay(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1}resetAllDelay(){this.resetDelay(),this.preDelayTimestamp=null}initInterval(){this.player.isUseHls265()?this.player.debugLog("CommonDemux","initInterval() and is hls and support hls265 so return"):-1===this.player.getStreamType().indexOf(A)?this.player.isPlaybackCacheBeforeDecodeForFpsRender()?this.player.debugLog("CommonDemux","initInterval() and playback and playbackIsCacheBeforeDecodeForFpsRender is true so return"):(this.player.debugLog("CommonDemux","setInterval()"),this._loop(),this.stopId=setInterval((()=>{if(this.player.isDestroyedOrClosed())return;let e=(new Date).getTime();this.preLoopTimestamp||(this.preLoopTimestamp=e);const t=e-this.preLoopTimestamp;this.updateHistoryIntervalDiffTimeList(t),t>100&&this.player.debugWarn("CommonDemux",`loop demux diff time is ${t}`),this._loop(),this.preLoopTimestamp=(new Date).getTime()}),20)):this.player.debugLog("CommonDemux","initInterval() and is worker stream so return")}clearStopInterval(){this.stopId&&(clearInterval(this.stopId),this.stopId=null)}startPlaybackLoopInterval(){this.initPlaybackCacheLoop()}updateHistoryIntervalDiffTimeList(e){this.historyIntervalDiffTimeList.length>5&&this.historyIntervalDiffTimeList.shift(),this.historyIntervalDiffTimeList.push(e)}isHistoryIntervalDiffTimeAllLarge(){if(this.historyIntervalDiffTimeList.length<5)return!1;for(let e=0;e{let e=null;this.bufferList.length&&(e=this.bufferList.shift(),this._doDecoderDecode(e))};e();const t=Math.ceil(1e3/(this.playbackStreamFps*this.player.getPlaybackRate()));this.player.debugLog("CommonDemux",`initPlaybackCacheLoop() and fragDuration is ${t}, playbackStreamFps is ${this.playbackStreamFps}, playbackRate is ${this.player.getPlaybackRate()}`),this.stopId=setInterval(e,t)}_loop(){let e;const t=this.player._opt.videoBuffer,i=this.player._opt.videoBufferDelay,s=this.player._opt.playType===v;if(this.bufferList.length){if(this.isPushDropping)return void this.player.debugWarn("CommonDemux",`_loop isPushDropping is true and bufferList length is ${this.bufferList.length}`);if(this.dropping){for(e=this.bufferList.shift(),this.player.debugWarn("CommonDemux",`_loop is dropping and data.ts is ${e.ts}, data.type is ${e.type}, data.isIFrame is ${e.isIFrame}, delay is ${this.delay} ,buffer list is ${this.bufferList.length}`);!e.isIFrame&&this.bufferList.length;)e=this.bufferList.shift();const t=this.getDelayNotUpdateDelay(e.ts,e.type);e.isIFrame&&t<=this.getNotDroppingDelayTs()&&(this.player.debugLog("CommonDemux",`_loop data isIFrame is true and delay is ${this.delay}`),this.dropping=!1,this._doDecoderDecode(e),this._decodeNext(e))}else if(this.player.isPlayback()||this.player.isPlayUseMSE()||0===t)for(;this.bufferList.length;)e=this.bufferList.shift(),this._doDecoderDecode(e);else if(e=this.bufferList[0],-1===this.getDelay(e.ts,e.type))this.player.debugLog("CommonDemux",`delay is -1 and data.ts is ${e.ts} data.type is ${e.type}`),this.bufferList.shift(),this._doDecoderDecode(e),this._decodeNext(e);else if(this.delay>i+t&&s)this.hasIframeInBufferList()?(this.player.debugWarn("CommonDemux",`_loop delay is ${this.delay}, set dropping is true`),this.resetAllDelay(),this.dropping=!0,this.player.updateStats({isDropping:!0})):(this.bufferList.shift(),this._doDecoderDecode(e),this._decodeNext(e));else for(;this.bufferList.length;){if(e=this.bufferList[0],!(this.getDelay(e.ts,e.type)>t)){this.delay<0&&this.player.debugWarn("CommonDemux",`_loop delay is ${this.delay} bufferList is ${this.bufferList}`);break}this.bufferList.shift(),this._doDecoderDecode(e)}}else-1!==this.delay&&this.player.debugLog("CommonDemux","loop() bufferList is empty and reset delay"),this.resetAllDelay()}_doDecode(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;const o=this.player;let a={ts:i,cts:r,type:t,isIFrame:!1};this.player.isPlayer()?(t===Oe&&o._opt.playType===v&&this.calcNetworkDelay(i),o._opt.useWCS&&!o._opt.useOffscreen||o._opt.useMSE?(t===Oe&&(a.isIFrame=s),this.pushBuffer(e,a)):t===Oe?o.decoderWorker&&o.decoderWorker.decodeVideo(e,i,s):t===Ue&&o._opt.hasAudio&&o.decoderWorker&&o.decoderWorker.decodeAudio(e,i)):this.player.isPlayback()&&(t===Oe&&(a.isIFrame=s),this.player.isPlaybackOnlyDecodeIFrame()?t===Oe&&s&&this.pushBuffer(e,a):this.player.isPlaybackCacheBeforeDecodeForFpsRender()||1===this.player.getPlaybackRate()?this.pushBuffer(e,a):this.pushBuffer(e,a,!1))}_doDecodeByHls(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=!1;if(t===Ue&&Or(e)&&(this.player.debugLog("CommonDemux",`hls pushBuffer audio ts is ${i}, isAacCodecPacket is true`),o=!0,this.player.isRecordTypeFlv())){const t=new Uint8Array(e);this.player.recorder.addAACSequenceHeader(t,i)}let a=!1;if(t===Oe&&s&&ma(e)&&(this.player.debugLog("CommonDemux",`hls pushBuffer video ts is ${i}, isVideoSequenceHeader is true`),a=!0,this.player.isRecordTypeFlv())){const t=new Uint8Array(e);this.player.recorder.addVideoSequenceHeader(t,i)}this.player.recording&&ya(a)&&ya(o)&&this.handleRecording(e,t,i,s,r),t===Oe?this._doDecoderDecode({ts:i,cts:r,payload:e,type:Oe,isIFrame:s}):t===Ue&&this._doDecoderDecode({ts:i,payload:e,type:Ue})}_doDecodeByFmp4(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,i,s,r)}_doDecodeByTs(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,i,s,r)}_doDecodeByPs(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,i,s,r)}_decodeNext(e){const t=e.ts;if(0===this.bufferList.length)return;let i=this.bufferList[0];const s=i.ts-t,r=e.type===Oe&&i.type===Ue,o=e.type===Oe&&ma(e.payload);(s<=20||r||o)&&(this.player.debugLog("CommonDemux",`decode data type is ${e.type} and\n ts is ${t} next data type is ${i.type} ts is ${i.ts}\n diff is ${s} and isVideoAndNextAudio is ${r} and isVideoSqeHeader is ${o}`),this.bufferList.shift(),this._doDecoderDecode(i))}_doDecoderDecode(e){const t=this.player,{webcodecsDecoder:i,mseDecoder:s}=t;this.player.isPlayer()&&this.player.updateStats({buf:this.delay}),e.type===Ue?t._opt.hasAudio&&(t._opt.useMSE&&t._opt.mseDecodeAudio?s.decodeAudio(e.payload,e.ts):t._opt.useWCS&&t._opt.wcsDecodeAudio?i.decodeAudio(e.payload,e.ts):t.decoderWorker&&t.decoderWorker.decodeAudio(e.payload,e.ts)):e.type===Oe&&(t._opt.isEmitSEI&&this.findSei(e.payload,e.ts),t._opt.useWCS&&!t._opt.useOffscreen?i.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):t._opt.useMSE?s.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):t.decoderWorker&&t.decoderWorker.decodeVideo(e.payload,e.ts,e.isIFrame))}pushBuffer(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=this.player._opt.videoBuffer,r=this.player._opt.videoBufferDelay,o=this.player.isPlayer();if(t.type===Ue&&Or(e)){if(this.player.debugLog("CommonDemux",`pushBuffer() audio ts is ${t.ts}, isAacCodecPacket is true`),this.player.isRecordTypeFlv()){const i=new Uint8Array(e);this.player.recorder.addAACSequenceHeader(i,t.ts)}this._doDecoderDecode({ts:t.ts,payload:e,type:Ue})}else if(t.type===Oe&&t.isIFrame&&ma(e)){if(this.player.debugLog("CommonDemux",`pushBuffer() video ts is ${t.ts}, isVideoSequenceHeader is true`),this.player.isRecordTypeFlv()){const i=new Uint8Array(e);this.player.recorder.addVideoSequenceHeader(i,t.ts)}this._doDecoderDecode({ts:t.ts,payload:e,type:Oe,isIFrame:t.isIFrame,cts:t.cts})}else{if(this.player.recording&&this.handleRecording(e,t.type,t.ts,t.isIFrame,t.cts),o){if(t.type===Oe){if(this.preTimestampDuration>0){const e=t.ts-this.preTimestamp,i=this.preTimestampDuration+this.preTimestampDuration/2;e>=i&&this.player.debugLog("CommonDemux",`pushBuffer() video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts}, preTs is ${this.preTimestamp},\n diff is ${e} and preTsDuration is ${this.preTimestampDuration} and maxDiff is ${i}\n maybe trigger black screen or flower screen`)}if(null!==this.preTimestamp&&this.preTimestamp>=t.ts&&(this.player.debugWarn("CommonDemux",`pushBuffer() video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts} less than (or equal) preTs is ${this.preTimestamp} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${this.prevPayloadBufferSize}`),this.preTimestamp-t.ts>Z&&(this.player.debugWarn("CommonDemux",`pushBuffer() video\n ts is ${t.ts}, preTimestamp is ${this.preTimestamp},\n diff is ${this.preTimestamp-t.ts} more than 3600000\n and resetAllDelay()`),this.resetAllDelay()),this.player._opt.isDropSameTimestampGop&&ya(t.isIFrame)&&this.player.isDemuxDecodeFirstIIframeInit())){const e=this.hasIframeInBufferList(),t=ya(this.isPushDropping);return this.player.debugLog("CommonDemux",`pushBuffer(), isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next drop buffer`),void(e&&t?this.dropBuffer$2():this.clearBuffer(!0))}this.preTimestamp>0&&(this.preTimestampDuration=t.ts-this.preTimestamp),this.prevPayloadBufferSize=e.byteLength,this.preTimestamp=t.ts}if(this.player.isDemuxDecodeFirstIIframeInit()){let e=this.getDelayNotUpdateDelay(t.ts,t.type);this.pushLatestDelay=e;const i=r+s;this.player._opt.useMSE?this.delay>0&&e>i&&this.delay ${r+s}, bufferList is ${this.bufferList.length}, delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()):this.delay>0&&e>i&&this.delay ${r+s},bufferList is ${this.bufferList.length}, delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()),this.isHistoryIntervalDiffTimeAllLarge()&&ya(this.player.visibility)&&(this.player._opt.useMSE?this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debugWarn("CommonDemux",`useMSE, page visibility is false and\n history interval diff is ${this.historyIntervalDiffTimeList.join(",")} and\n bufferList is ${this.bufferList.length},\n delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()):this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debugWarn("CommonDemux",`useWCS, page visibility is false and\n history interval diff is ${this.historyIntervalDiffTimeList.join(",")} and\n bufferList is ${this.bufferList.length},\n delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()))}}i?t.type===Ue?this.bufferList.push({ts:t.ts,payload:e,type:Ue}):t.type===Oe&&this.bufferList.push({ts:t.ts,cts:t.cts,payload:e,type:Oe,isIFrame:t.isIFrame}):t.type===Oe?this._doDecoderDecode({ts:t.ts,cts:t.cts,payload:e,type:Oe,isIFrame:t.isIFrame}):t.type===Ue&&this._doDecoderDecode({ts:t.ts,payload:e,type:Ue}),this.player.isPlaybackCacheBeforeDecodeForFpsRender()&&this.calcPlaybackStreamFps()}}calcPlaybackStreamFps(){if(Po(this.playbackStreamVideoFps)||Po(this.playbackStreamAudioFps)){let e=this.playbackStreamVideoFps,t=this.playbackStreamAudioFps;if(Po(this.playbackStreamVideoFps)&&(e=la(this.bufferList,Oe),e>0&&(this.playbackStreamVideoFps=e,this.player.video&&this.player.video.setStreamFps(this.playbackStreamVideoFps),this.playbackStreamFps=t?e+t:e,ya(this.player._opt.hasAudio)&&(this.player.debugLog(this.TAG_NAME,"playbackCacheBeforeDecodeForFpsRender,_opt.hasAudio is false and set streamAudioFps is 0"),this.playbackStreamAudioFps=0),this.initPlaybackCacheLoop())),Po(this.playbackStreamAudioFps)&&(t=la(this.bufferList,Ue),t>0&&(this.playbackStreamAudioFps=t,this.playbackStreamFps=e?e+t:t,this.initPlaybackCacheLoop())),Po(this.playbackStreamVideoFps)&&Po(this.playbackStreamAudioFps)){const i=this.bufferList.map((e=>({type:e.type,ts:e.ts})));this.player.debugLog("CommonDemux",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${this.bufferList.length} and ts list is ${JSON.stringify(i)}`)}const i=this.getAudioBufferLength()>0,s=i?60:40;this.bufferList.length>=s&&(this.player.debugWarn("CommonDemux",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${this.bufferList.length} more than ${s}, and hasAudio is ${i} an set streamFps is 25`),this.playbackStreamVideoFps=e,this.player.video&&this.player.video.setStreamFps(this.playbackStreamVideoFps),i?(this.playbackStreamAudioFps=25,this.playbackStreamFps=this.playbackStreamVideoFps+this.playbackStreamAudioFps):this.playbackStreamFps=this.playbackStreamVideoFps,this.initPlaybackCacheLoop())}}dropBuffer$2(){if(this.bufferList.length>0){let e=this.bufferList.findIndex((e=>ga(e.isIFrame)&&e.type===Oe));if(this.isAllIframeInBufferList())for(let t=0;t=this.getNotDroppingDelayTs()){this.player.debugLog("CommonDemux",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${s} and notDroppingDelayTs is ${this.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){this.isPushDropping=!0,this.player.updateStats({isDropping:!0});const t=this.bufferList.length;this.bufferList=this.bufferList.slice(e);const i=this.bufferList.shift();this.resetAllDelay(),this.getDelay(i.ts,i.type),this._doDecoderDecode(i),this.isPushDropping=!1,this.player.debugLog("CommonDemux",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,and new bufferList length is ${this.bufferList.length} and new delay is ${this.delay} `)}else this.isPushDropping=!1}0===this.bufferList.length&&(this.isPushDropping=!1)}clearBuffer(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.player.debugLog("CommonDemux",`clearBuffer,buffer length is ${this.bufferList.length}, need clear is ${e} and _opt.checkFirstIFrame is ${this.player._opt.checkFirstIFrame}`),e&&(this.bufferList=[]),this.player.isPlayer()&&(this.resetAllDelay(),ga(this.player._opt.checkFirstIFrame)&&(this.dropping=!0,this.player.updateStats({isDropping:!0}))),this.player.decoderCheckFirstIFrame()}calcNetworkDelay(e){if(!(this.player.isDemuxDecodeFirstIIframeInit()&&e>0))return;null===this.bufferStartDts?(this.bufferStartDts=e,this.bufferStartLocalTs=ro()):et?i-t:0;s>this.player._opt.networkDelay&&this.player._opt.playType===v&&(this.player.debugWarn("CommonDemux",`delay is more than networkDelay and now dts:${e},start dts is ${this.bufferStartDts}, vs start is ${t},local diff is ${i} ,delay is ${s}, _opt.networkDelay is ${this.player._opt.networkDelay}`),this.player.emit(at.networkDelayTimeout,s)),this.player.updateStats({netBuf:s})}calcIframeIntervalTimestamp(e){if(null===this.preIframeTs)this.preIframeTs=e;else if(this.preIframeTs{t.type===Oe&&(e+=1)})),e}getAudioBufferLength(){let e=0;return this.bufferList.forEach((t=>{t.type===Ue&&(e+=1)})),e}hasIframeInBufferList(){return this.bufferList.some((e=>e.type===Oe&&e.isIFrame))}isAllIframeInBufferList(){const e=this.getVideoBufferLength();let t=0;return this.bufferList.forEach((e=>{e.type===Oe&&e.isIFrame&&(t+=1)})),e===t}getInputByteLength(){return 0}getIsStreamTsMoreThanLocal(){return this.isStreamTsMoreThanLocal}close(){}reset(){}findSei(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=4;Bo(this.nalUnitSize)&&(s=this.nalUnitSize);const r=Xr(e.slice(5),s);if(ya(i)){const e=this.player.getVideoInfo();e&&e.encType&&(i=e.encType===_t)}r.forEach((e=>{const s=i?e[0]>>>1&63:31&e[0];(i&&(s===Yt||s===Kt)||ya(i)&&s===Pt)&&this.player.emitVideoSei({ts:t,data:e})}))}handleRecording(e,t,i,s,r){if(this.player.isRecordTypeFlv()){const s=new Uint8Array(e);t===Oe?this.player.recorder.addVideo(s,i):t===Ue&&this.player.recorder.addAudio(s,i)}else if(this.player.isRecordTypeMp4()){const o=new Uint8Array(e);if(this.player.recorder.isWasmMp4()){if(t===Oe)this.player.recorder.handleAddNaluTrack(o.slice(5),s,i,r);else if(t===Ue){const t=new Uint8Array(e);this.player.recorder.handleAddAudioTrack(Nr(t)?t.slice(2):t.slice(1),i)}}else t===Oe&&this.player.recorder.handleAddNaluTrack(o.slice(5),s,i,r)}}updateNalUnitSize(e){const t=15&e[0];this.player.video.updateVideoInfo({encTypeCode:t});const i=t===bt;this.nalUnitSize=function(e,t){let i=null;return t?e.length>=28&&(i=1+(3&e[26])):e.length>=12&&(i=1+(3&e[9])),i}(e,i),this.player.debugLog(this.TAG_NAME,`demux() isVideoSequenceHeader is true and isHevc is ${i} and nalUnitSize is ${this.nalUnitSize}`)}cryptoPayload(e,t){let i=this.player,s=e;if(i._opt.isM7sCrypto)if(i._opt.cryptoKey&&i._opt.cryptoKey.byteLength>0&&i._opt.cryptoIV&&i._opt.cryptoIV.byteLength>0){const t=this.player.video.getVideoInfo();t.encTypeCode?s=function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),i=new Uint8Array(i);const r=e.byteLength;let o=5;for(;or)break;let n=e[o+4],l=!1;if(s?(n=n>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(n)):(n&=31,l=1===n||5===n),l){const s=e.slice(o+4+2,o+4+a);let r=new _d.ModeOfOperation.ctr(t,new _d.Counter(i));const n=r.decrypt(s);r=null,e.set(n,o+4+2)}o=o+4+a}return e}(e,i._opt.cryptoKey,i._opt.cryptoIV,t.encTypeCode===bt):i.debugWarn(this.TAG_NAME,`videoInfo.encTypeCode is ${t.encTypeCode}`)}else i.debugError(this.TAG_NAME,`isM7sCrypto cryptoKey.length is ${i._opt.cryptoKey&&i._opt.cryptoKey.byteLength} or cryptoIV.length is ${i._opt.cryptoIV&&i._opt.cryptoIV.byteLength} null`);else if(i._opt.isSm4Crypto)if(i._opt.sm4CryptoKey){const t=this.player.video.getVideoInfo().encTypeCode===bt,r=this.player._opt.isSm4CryptoH265V2;s=i._opt.cryptoKey&&i._opt.cryptoKey.byteLength>0&&i._opt.cryptoIV&&i._opt.cryptoIV.byteLength>0?function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t=new Uint8Array(t),i=new Uint8Array(i);const o=e.byteLength;let a=5;for(;ao)break;let l=e[a+4],d=!1,h=2;if(s?(r&&(h=3),l=l>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(l)):(l&=31,d=1===l||5===l),d){const s=eh(t,i,e.slice(a+4+h,a+4+n));e.set(s,a+4+h)}a=a+4+n}return e}(e,i._opt.cryptoKey,i._opt.cryptoIV,t,r):function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=e.byteLength;let o=new Uint8Array(e.slice(0,5)),a=5;for(;ar){const t=new Uint8Array(o.length+e.length-a);t.set(o,0),t.set(e.slice(a),o.length),o=t;break}let d=e[a+4],h=!1,c=2;if(i?(s&&(c=3),d=d>>>1&63,h=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(d)):(d&=31,h=1===d||5===d),h){const i=Nd(e.slice(a+4+c,a+4+l),t,0,{padding:"none",output:"array"});let s=i[i.length-1];if(s>0&&s<16){let e=!0;for(let t=1;t<=s;t++)if(i[i.length-t]!==s){e=!1;break}e&&i.splice(i.length-s,s)}const r=new Uint8Array(c);r.set(e.slice(a+4,a+4+c),0);const n=Zr(nl(r,new Uint8Array(i))),d=new Uint8Array(o.length+n.length);d.set(o,0),d.set(n,o.length),o=d}else{const t=e.slice(a+4,a+4+l),i=new Uint8Array(o.length+4+t.length);i.set(o,0),i.set(n,o.length),i.set(t,o.length+4),o=i}a=a+4+l}return o}(e,i._opt.sm4CryptoKey,t,r)}else i._opt.sm4CryptoKey||i.debugError(this.TAG_NAME,"isSm4Crypto opt.sm4CryptoKey is null");else if(i._opt.isXorCrypto)if(i._opt.cryptoKey&&i._opt.cryptoKey.byteLength>0&&i._opt.cryptoIV&&i._opt.cryptoIV.byteLength>0){const t=this.player.video.getVideoInfo();s=function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=e.byteLength;let o=5;for(;or)break;let n=e[o+4],l=!1;if(s?(n=n>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(n)):(n&=31,l=1===n||5===n),l){const s=Gd(e.slice(o+4,o+4+a),t,i);e.set(s,o+4)}o=o+4+a}return e}(e,i._opt.cryptoKey,i._opt.cryptoIV,t.encTypeCode===bt)}else i.debugError(this.TAG_NAME,"isXorCrypto opt.xorCryptoKey is null");return s}cryptoPayloadAudio(e){let t=this.player;if(ya(t._opt.isCryptoAudio))return e;let i=e;if(t._opt.isM7sCrypto)if(t._opt.cryptoKey&&t._opt.cryptoKey.byteLength>0&&t._opt.cryptoIV&&t._opt.cryptoIV.byteLength>0){e[0]>>4===wt&&(i=function(e,t,i){if(e.byteLength<=30)return e;const s=e.slice(32);let r=new _d.ModeOfOperation.ctr(t,new _d.Counter(i));const o=r.decrypt(s);return r=null,e.set(o,32),e}(e,t._opt.cryptoKey,t._opt.cryptoIV))}else t.debugError(this.TAG_NAME,`isM7sCrypto cryptoKey.length is ${t._opt.cryptoKey&&t._opt.cryptoKey.byteLength} or cryptoIV.length is ${t._opt.cryptoIV&&t._opt.cryptoIV.byteLength} null`);return i}_decodeEnhancedH265Video(e,t){const i=e[0],s=48&i,r=15&i,o=e.slice(1,5),a=new ArrayBuffer(4),n=new Uint32Array(a),l="a"==String.fromCharCode(o[0]);if(r===nr){if(s===hr){const t=e.slice(5);if(l);else{const e=new Uint8Array(5+t.length);e.set([28,0,0,0,0],0),e.set(t,5),this.updateNalUnitSize(e),this.player.debugLog(this.TAG_NAME,`demux() isVideoSequenceHeader(enhancedH265) is true and nalUnitSize is ${this.nalUnitSize}`),this._doDecode(e,Oe,0,!0,0)}}}else if(r===lr){let i=e,r=0;const o=s===hr;if(o&&this.calcIframeIntervalTimestamp(t),l);else{n[0]=e[4],n[1]=e[3],n[2]=e[2],n[3]=0,r=n[0];i=Qn(e.slice(8),o),i=this.cryptoPayload(i,o),this._doDecode(i,Oe,t,o,r)}}else if(r===dr){const i=s===hr,r=e.slice(5);i&&this.calcIframeIntervalTimestamp(t);let o=Qn(r,i);o=this.cryptoPayload(o,i),this._doDecode(o,Oe,t,i,0)}}_isEnhancedH265Header(e){return 128==(128&e)}handlePlaybackPause(e){ga(e)?this.clearStopInterval():this.startPlaybackLoopInterval()}}var ih=function(e,t,i,s){return new(i||(i=Promise))((function(r,o){function a(e){try{l(s.next(e))}catch(e){o(e)}}function n(e){try{l(s.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,n)}l((s=s.apply(e,t||[])).next())}))};const sh=Symbol(32),rh=Symbol(16),oh=Symbol(8);class ah{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return ih(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,i)=>{var s;this.reject=i,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(s=this.pull)||void 0===s||s.call(this,e)}))}))}readU32(){return this.read(sh)}readU16(){return this.read(rh)}readU8(){return this.read(oh)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let i=0;const s=e=>t.length<(i=e);if("number"==typeof this.need){if(s(this.need))return;e=t.subarray(0,i)}else if(this.need===sh){if(s(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===rh){if(s(2))return;e=t[0]<<8|t[1]}else if(this.need===oh){if(s(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(s(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,i)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(s(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,i)),e=this.need}return this.consumed+=i,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,i=t+e;if(i<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,i);else{const e=new Uint8Array(i);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,i)}return this.buffer=new Uint8Array(e),this.buffer}}ah.U32=sh,ah.U16=rh,ah.U8=oh;class nh extends th{constructor(e){super(e),this.TAG_NAME="FlvDemux",this.input=new ah(this.demux()),e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.input&&(this.input.close(),this.input=null),this.player.debugLog(this.TAG_NAME,"destroy")}dispatch(e){this.input?this.input.write(e):this.player&&this.player.debugWarn(this.TAG_NAME,"dispatch() this.input is null")}*demux(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),i=new Uint32Array(e),s=this.player;for(;;){if(!this.input)return;t[3]=0;const e=yield 15,r=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const o=i[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let a=i[0];const n=(yield o).slice();if(!s)return;switch(r){case Ne:if(s._opt.hasAudio&&(s.updateStats({abps:n.byteLength}),n.byteLength>0)){let e=this.cryptoPayloadAudio(n);this._doDecode(e,Ue,a)}break;case je:if(s._opt.hasVideo&&n.length>=6){let e=a;s.updateStats({vbps:n.byteLength,dts:e}),s._times.demuxStart||(s._times.demuxStart=ro());const t=n[0];if(this._isEnhancedH265Header(t))this._decodeEnhancedH265Video(n,e);else{const e=15&t;let s=(t>>4&15)===xs;const r=e===bt,o=e===At;if(ya(r||o))return void this.player.debugWarn(this.TAG_NAME,`demux() codecId is ${e} and ignore`);ya(s)&&ga(La(n,r))&&(this.player.debugLog(this.TAG_NAME,"demux() isIFrame is false and unit type is IDR and update to true"),s=!0),s&&(this.calcIframeIntervalTimestamp(a),null===this.nalUnitSize&&ma(n)&&this.updateNalUnitSize(n)),i[0]=n[4],i[1]=n[3],i[2]=n[2],i[3]=0;let l=i[0],d=this.cryptoPayload(n,s);this._doDecode(d,Oe,a,s,l)}}else n.length<6&&s.debugWarn(this.TAG_NAME,`payload.length is ${n.length} less than 6 and ignore`);break;case Ge:if(this.player.isRecordTypeFlv()){const e=new Uint8Array(n);this.player.recorder.addMetaData(e)}const e=Al(n);e&&e.onMetaData&&s.updateMetaData(e.onMetaData);break;default:s.debugLog(this.TAG_NAME,`demux() type is ${r}`)}}}close(){this.input&&(this.input.close(),this.input=null)}getInputByteLength(){let e=0;return this.input&&this.input.buffer&&(e=this.input.buffer.byteLength),e}}class lh extends th{constructor(e){super(e),this.TAG_NAME="M7sDemux",e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy")}dispatch(e){const t=this.player,i=new DataView(e),s=i.getUint8(0),r=i.getUint32(1,!1),o=new ArrayBuffer(4),a=new Uint32Array(o);switch(s){case Ue:if(t._opt.hasAudio){const i=new Uint8Array(e,5);t.updateStats({abps:i.byteLength}),i.byteLength>0&&this._doDecode(i,s,r)}break;case Oe:if(t._opt.hasVideo)if(t._times.demuxStart||(t._times.demuxStart=ro()),i.byteLength>=11){const o=new Uint8Array(e,5);let n=r;t.updateStats({vbps:o.byteLength,dts:n});const l=o[0];if(this._isEnhancedH265Header(l))this._decodeEnhancedH265Video(o,r);else{const e=i.getUint8(5)>>4==1;e&&this.calcIframeIntervalTimestamp(r),a[0]=o[4],a[1]=o[3],a[2]=o[2],a[3]=0;let t=a[0],n=this.cryptoPayload(o,e);this._doDecode(n,s,r,e,t)}}else this.player.debugWarn(this.TAG_NAME,"dispatch","dv byteLength is",i.byteLength,"and return")}}}class dh extends nh{constructor(e){super(e),e.debugLog("WebTransportDemux","init")}destroy(){this.player.debugLog("WebTransportDemux","destroy"),super.destroy()}}var hh,ch=Rr((function(e){e.exports=function(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e},e.exports.__esModule=!0,e.exports.default=e.exports})),uh=(hh=ch)&&hh.__esModule&&Object.prototype.hasOwnProperty.call(hh,"default")?hh.default:hh;class ph{constructor(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}get bitsAvailable(){return this.bitLength-this.index}skipBits(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}getBits(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>s,o=8-s;if(o>=e)return i&&(this.index+=e),r>>o-e;{i&&(this.index+=o);const s=e-o;return r<>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class fh extends th{constructor(e){super(e),uh(this,"TAG_NAME","NakedFlowDemux"),this.lastBuf=null,this.vps=null,this.sps=null,this.pps=null,this.streamVideoType=null,this.streamAudioType=null,this.tempNaluBufferList=new Uint8Array(0),this.pendingUnits={},this.localDts=0,this.isSendSeqHeader=!1,this.isSendAACSeqHeader=!1,e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.lastBuf=null,this.vps=null,this.sps=null,this.pps=null,this.streamVideoType=null,this.streamAudioType=null,this.tempNaluBufferList=new Uint8Array(0),this.pendingUnits={},this.localDts=0,this.localAudioDts=0,this.isSendSeqHeader=!1,this.isSendAACSeqHeader=!1,this.player.debugLog(this.TAG_NAME,"destroy")}dispatch(e){this.player;const t=new Uint8Array(e);if(this.player._opt.nakedFlowDemuxUseNew){const e=this.extractNALu$3(t);if(0===e.length)return void this.player.debugLog(this.TAG_NAME,"dispatch naluArray.length === 0");this.handleVideoFrames(e)}else this.extractNALu$2(t)}addNaluToBuffer(e){const t=e.byteLength+this.tempNaluBufferList.byteLength,i=new Uint8Array(t);i.set(this.tempNaluBufferList,0),i.set(e,this.tempNaluBufferList.byteLength),this.tempNaluBufferList=i}downloadNakedFlowFile(){const e=new Blob([this.tempNaluBufferList]);try{const t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".h264",t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadTempNalu",e)}}getNaluDts(){const e=this.player._opt.nakedFlowFps;return this.localDts=this.localDts+parseInt(1e3/e,10),this.localDts}getNaluAudioDts(){const e=this.player.audio.audioContext.sampleRate,t=this.player.audio.audioBufferSize;return this.localDts+parseInt(t/e*1e3)}extractNALu(e){let t,i,s=0,r=e.byteLength,o=0,a=[];for(;s1)for(let e=0;e{const t=On(e);t===Ct||t===Lt?this.handleVideoH264Nalu(e):jn(t)&&s.push(e)})),1===s.length)this.handleVideoH264Nalu(s[0]);else{const e=function(e){if(0===e.length)return!1;const t=On(e[0]);for(let i=1;i{this.handleVideoH264Nalu(e)}))}}else if(this.streamVideoType===_t)if(this.player._opt.nakedFlowH265DemuxUseNew){const e=this.handleAddNaluStartCode(t),i=this.extractNALu(e);if(0===i.length)return void this.player.debugWarn(this.TAG_NAME,"handleVideoNalu","h265 naluList.length === 0");const s=[];if(i.forEach((e=>{const t=Xn(e);t===Ht||t===$t||t===Wt?this.handleVideoH265Nalu(e):Zn(t)&&s.push(e)})),1===s.length)this.handleVideoH265Nalu(s[0]);else{const e=function(e){if(0===e.length)return!1;const t=Xn(e[0]);for(let i=1;i{this.handleVideoH265Nalu(e)}))}}else{Xn(t)===Ht?this.extractH265PPS(t):this.handleVideoH265Nalu(t)}else this.player.debugWarn(this.TAG_NAME," this.streamVideoType is null")}extractH264PPS(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{Nn(On(e))?this.extractH264SEI(e):this.handleVideoH264Nalu(e)}))}extractH265PPS(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{const t=Xn(e);t===qt?this.extractH265SEI(e):this.handleVideoH265Nalu(e)}))}extractH264SEI(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{this.handleVideoH264Nalu(e)}))}extractH265SEI(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{this.handleVideoH265Nalu(e)}))}handleAddNaluStartCode(e){const t=[0,0,0,1],i=new Uint8Array(e.length+t.length);return i.set(t),i.set(e,t.length),i}handleAudioAACNalu(e){if(!e||e.byteLength<1)return;this.streamAudioType||(this.streamAudioType=Tt.AAC);let t=new Uint8Array(e);const i=t.slice(0,7);if(t=t.slice(7),!this.isSendAACSeqHeader){const e=(192&i[2])>>6,t=(60&i[2])>>2,s=(1&i[2])<<2|(192&i[3])>>6,r=new Uint8Array([175,0,e<<3|(14&t)>>1,(1&t)<<7|s<<3]);this.isSendAACSeqHeader=!0,this._doDecode(r,Ue,0,!1,0)}const s=this.getNaluAudioDts(),r=new Uint8Array(t.length+2);r.set([175,1],0),r.set(t,2),this._doDecode(r,Ue,s,!1,0)}handleAudioG711ANalu(e){if(!e||e.byteLength<1)return;this.streamAudioType||(this.streamAudioType=Tt.ALAW);let t=new Uint8Array(e);const i=this.getNaluAudioDts(),s=new Uint8Array(t.length+1);s.set([114],0),s.set(t,1),this._doDecode(s,Ue,i,!1,0)}handleAudioG711UNalu(e){if(!e||e.byteLength<1)return;this.streamAudioType||(this.streamAudioType=Tt.MULAW);let t=new Uint8Array(e);const i=this.getNaluAudioDts(),s=new Uint8Array(t.length+1);s.set([130],0),s.set(t,1),this._doDecode(s,Ue,i,!1,0)}handleVideoH264Nalu(e){const t=On(e);switch(t){case Lt:this.sps=e;break;case Ct:this.pps=e}if(this.isSendSeqHeader){if(this.sps&&this.pps){const e=Fn({sps:this.sps,pps:this.pps}),t=this.localDts;this._doDecode(e,Oe,t,!0,0),this.sps=null,this.pps=null}if(jn(t)){this.player._times.demuxStart||(this.player._times.demuxStart=ro());const i=Gn(t),s=this.getNaluDts(),r=function(e,t){let i=[];i[0]=t?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=e.byteLength>>24&255,i[6]=e.byteLength>>16&255,i[7]=e.byteLength>>8&255,i[8]=255&e.byteLength;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}(e,i);this._preDoDecode(r,Oe,s,i,0)}else this.player.debugWarn(this.TAG_NAME,`handleVideoH264Nalu is avc seq head nalType is ${t}`)}else if(this.sps&&this.pps){this.isSendSeqHeader=!0;const e=Fn({sps:this.sps,pps:this.pps});this._doDecode(e,Oe,0,!0,0),this.sps=null,this.pps=null}}handleVideoH264NaluList(e,t,i){if(this.isSendSeqHeader){this.player._times.demuxStart||(this.player._times.demuxStart=ro());const i=this.getNaluDts(),s=Un(e.reduce(((e,t)=>{const i=Zr(e),s=Zr(t),r=new Uint8Array(i.byteLength+s.byteLength);return r.set(i,0),r.set(s,i.byteLength),r})),t);this._preDoDecode(s,Oe,i,t,0)}else this.player.debugWarn(this.TAG_NAME,"handleVideoH264NaluList isSendSeqHeader is false")}handleVideoH265Nalu(e){const t=Xn(e);switch(t){case Wt:this.vps=e;break;case $t:this.sps=e;break;case Ht:this.pps=e}if(this.isSendSeqHeader){if(this.vps&&this.sps&&this.pps){const e=Yn({vps:this.vps,sps:this.sps,pps:this.pps}),t=this.localDts;this._doDecode(e,Oe,t,!0,0),this.vps=null,this.sps=null,this.pps=null}if(Zn(t)){this.player._times.demuxStart||(this.player._times.demuxStart=ro());const i=el(t),s=this.getNaluDts(),r=function(e,t){let i=[];i[0]=t?28:44,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=e.byteLength>>24&255,i[6]=e.byteLength>>16&255,i[7]=e.byteLength>>8&255,i[8]=255&e.byteLength;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}(e,i);this._preDoDecode(r,Oe,s,i,0)}}else if(this.vps&&this.sps&&this.pps){this.isSendSeqHeader=!0;const e=Yn({vps:this.vps,sps:this.sps,pps:this.pps});this._doDecode(e,Oe,0,!0,0),this.vps=null,this.sps=null,this.pps=null}}handleVideoH265NaluList(e,t,i){if(this.isSendSeqHeader){this.player._times.demuxStart||(this.player._times.demuxStart=ro());const i=this.getNaluDts(),s=Qn(e.reduce(((e,t)=>{const i=Zr(e),s=Zr(t),r=new Uint8Array(i.byteLength+s.byteLength);return r.set(i,0),r.set(s,i.byteLength),r})),t);this._preDoDecode(s,Oe,i,t,0)}else this.player.debugWarn(this.TAG_NAME,"handleVideoH265NaluList isSendSeqHeader is false")}_preDoDecode(e,t,i,s,r){this.player.updateStats({vbps:e.byteLength,dts:i}),s&&this.calcIframeIntervalTimestamp(i),this._doDecode(e,Oe,i,s,r)}getInputByteLength(){let e=0;return this.lastBuf&&(e=this.lastBuf.byteLength),e}handleVideoFrames(e){if(!this.streamVideoType)for(let t of e)if(this.streamVideoType=sa(t),this.streamVideoType)break;this.streamVideoType?this.streamVideoType===vt?this.handleVideoH264Frames(e):this.streamVideoType===_t&&this.handleVideoH265Frames(e):this.player.debugWarn(this.TAG_NAME,"handleVideoFrames streamVideoType is null")}handleVideoH264Frames(e){let t=[],i=[],s=!1,r=!1;this.pendingUnits.units&&(t=this.pendingUnits.units,r=this.pendingUnits.vcl,s=this.pendingUnits.iFrame,this.pendingUnits={});let o={};for(let a of e){if(a.byteLength<4)continue;const e=On(a);let n=!1,l=e===Rt;e!==Dt&&e!==Rt||(o=this.parseVideo264Header(a),n=!0),t.length&&r&&(o.isfms||!n)&&(i.push({units:t,isIFrame:s}),t=[],s=!1,r=!1),t.push(a),s=s||l,r=r||n}t.length&&(this.pendingUnits={units:t,vcl:r,iFrame:s}),i.forEach((e=>{const t=e.units,i=e.isIFrame;let s=null,r=null;if(t.forEach((e=>{const t=31&e[0];switch(t){case Ct:this.pps=e;break;case Lt:this.sps=e;break;case Pt:r=e}if(jn(t)){const t=Zr(e);if(s){const e=new Uint8Array(s.byteLength+t.byteLength);e.set(s,0),e.set(t,s.byteLength),s=e}else s=t}})),!this.isSendSeqHeader&&this.sps&&this.pps){this.isSendSeqHeader=!0;const e=Fn({sps:this.sps,pps:this.pps});this._doDecode(e,Oe,0,!0,0),this.sps=null,this.pps=null}if(this.isSendSeqHeader){if(this.sps&&this.pps){const e=Fn({sps:this.sps,pps:this.pps}),t=this.localDts;this._doDecode(e,Oe,t,!0,0),this.sps=null,this.pps=null}if(s){this.player._times.demuxStart||(this.player._times.demuxStart=ro());const e=this.getNaluDts(),t=Un(s,i);this.player._opt.isEmitSEI&&r&&this.player.emitVideoSei({ts:e,data:r}),this._preDoDecode(t,Oe,e,i,0)}}}))}handleVideoH265Frames(e){let t=[],i=[],s=!1,r=!1;this.pendingUnits.units&&(t=this.pendingUnits.units,r=this.pendingUnits.vcl,s=this.pendingUnits.iFrame,this.pendingUnits={});let o={};for(let a of e){if(a.byteLength<4)continue;const e=Xn(a);let n=!1,l=el(e);Zn(e)&&(o=this.parseVideo265Header(a),n=!0),t.length&&r&&(o.isfms||!n)&&(i.push({units:t,isIFrame:s}),t=[],s=!1,r=!1),t.push(a),s=s||l,r=r||n}t.length&&(this.pendingUnits={units:t,vcl:r,iFrame:s}),i.forEach((e=>{const t=e.units,i=e.isIFrame;let s=null,r=null;if(t.forEach((e=>{const t=e[0]>>>1&63;switch(t){case Ht:this.pps=e;break;case $t:this.sps=e;break;case Wt:this.vps=e;break;case Yt:case Kt:r=e}if(Zn(t)){const t=Zr(e);if(s){const e=new Uint8Array(s.byteLength+t.byteLength);e.set(s,0),e.set(t,s.byteLength),s=e}else s=t}})),!this.isSendSeqHeader&&this.sps&&this.pps&&this.vps){this.isSendSeqHeader=!0;const e=Yn({sps:this.sps,pps:this.pps,vps:this.vps});this._doDecode(e,Oe,0,!0,0),this.sps=null,this.pps=null,this.vps=null}if(this.isSendSeqHeader){if(this.sps&&this.pps&&this.vps){const e=Yn({sps:this.sps,pps:this.pps,vps:this.vps}),t=this.localDts;this._doDecode(e,Oe,t,!0,0),this.sps=null,this.pps=null,this.vps=null}if(s){this.player._times.demuxStart||(this.player._times.demuxStart=ro());const e=this.getNaluDts(),t=Qn(s,i);this.player._opt.isEmitSEI&&r&&this.player.emitVideoSei({ts:e,data:r}),this._preDoDecode(t,Oe,e,i,0)}}}))}handleVideoH265Frames_1(e){e.forEach((e=>{this.handleVideoNalu(e)}))}parseVideo264Header(e){const t=new ph(e);t.readUByte();return{isfms:0===t.readUEG(),sType:t.readUEG()}}parseVideo265Header(e){const t=new ph(e);return t.readUByte(),{nalType:t.readBits(6),isfms:0===t.readBits(1),sType:t.readBits(3)}}}class mh extends th{constructor(e){super(e),this.player=e,e.debugLog("EmptyDemux","init")}destroy(){super.destroy(),this.player.debugLog("EmptyDemux","destroy")}}var gh=Rr((function(e,t){var s,r,o,a=(s=new Date,r=4,o={setLogLevel:function(e){r=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=r&&console.debug("["+a.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=r&&console.info("["+a.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=r&&console.warn("["+a.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=r&&console.error("["+a.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)}},o);a.getDurationString=function(e,t){var i;function s(e,t){for(var i=(""+e).split(".");i[0].length0){for(var i="",s=0;s0&&(i+=","),i+="["+a.getDurationString(e.start(s))+","+a.getDurationString(e.end(s))+"]";return i}return"(empty)"},t.Log=a;var n=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};n.prototype.getPosition=function(){return this.position},n.prototype.getEndPosition=function(){return this.buffer.byteLength},n.prototype.getLength=function(){return this.buffer.byteLength},n.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},n.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},n.prototype.readAnyInt=function(e,t){var i=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:i=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:i=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";i=this.dataview.getUint8(this.position)<<16,i|=this.dataview.getUint8(this.position+1)<<8,i|=this.dataview.getUint8(this.position+2);break;case 4:i=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";i=this.dataview.getUint32(this.position)<<32,i|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,i}throw"Not enough bytes in buffer"},n.prototype.readUint8=function(){return this.readAnyInt(1,!1)},n.prototype.readUint16=function(){return this.readAnyInt(2,!1)},n.prototype.readUint24=function(){return this.readAnyInt(3,!1)},n.prototype.readUint32=function(){return this.readAnyInt(4,!1)},n.prototype.readUint64=function(){return this.readAnyInt(8,!1)},n.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",i=0;ithis._byteLength&&(this._byteLength=t);else{for(i<1&&(i=1);t>i;)i*=2;var s=new ArrayBuffer(i),r=new Uint8Array(this._buffer);new Uint8Array(s,0,r.length).set(r),this.buffer=s,this._byteLength=t}}},l.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),i=new Uint8Array(this._buffer,0,t.length);t.set(i),this.buffer=e}},l.BIG_ENDIAN=!1,l.LITTLE_ENDIAN=!0,l.prototype._byteLength=0,Object.defineProperty(l.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(l.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(l.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(l.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),l.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},l.prototype.isEof=function(){return this.position>=this._byteLength},l.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},l.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Int32Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Int16Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return l.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},l.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Uint32Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Uint16Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return l.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},l.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var i=new Float64Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Float32Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},l.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},l.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},l.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},l.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},l.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,l.memcpy=function(e,t,i,s,r){var o=new Uint8Array(e,t,r),a=new Uint8Array(i,s,r);o.set(a)},l.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},l.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},l.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i=0;ir;s--,r++){var o=t[r];t[r]=t[s],t[s]=o}return e},l.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],i=0;i>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},l.prototype.adjustUint32=function(e,t){var i=this.position;this.seek(e),this.writeUint32(t),this.seek(i)},l.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var i=new Int32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},l.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var i=new Int16Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},l.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},l.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var i=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},l.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var i=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},l.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var i=new Float64Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=8*e,i},l.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var i=new Float32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i};var h=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(h.prototype=new l(new ArrayBuffer,0,l.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,a.debug("MultiBufferStream","Stream ready for parsing"),!0):(a.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(a.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){a.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(new Uint8Array(e),0),i.set(new Uint8Array(t),e.byteLength),i.buffer},h.prototype.reduceBuffer=function(e,t,i){var s;return(s=new Uint8Array(i)).set(new Uint8Array(e,t,i)),s.buffer.fileStart=e.fileStart+t,s.buffer.usedBytes=0,s.buffer},h.prototype.insertBuffer=function(e){for(var t=!0,i=0;is.byteLength){this.buffers.splice(i,1),i--;continue}a.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=s.fileStart||(e=this.reduceBuffer(e,0,s.fileStart-e.fileStart)),a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(i,0,e),0===i&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,r,o)}}t&&(a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===i&&(this.buffer=e))},h.prototype.logBufferLevel=function(e){var t,i,s,r,o,n=[],l="";for(s=0,r=0,t=0;t0&&(l+=o.end-1+"]");var d=e?a.info:a.debug;0===this.buffers.length?d("MultiBufferStream","No more buffer in memory"):d("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+s+"/"+r+" bytes), continuous ranges: "+l)},h.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},h.prototype.findPosition=function(e,t,i){var s,r=null,o=-1;for(s=!0===e?0:this.bufferIndex;s=t?(a.debug("MultiBufferStream","Found position in existing buffer #"+o),o):-1},h.prototype.findEndContiguousBuf=function(e){var t,i,s,r=void 0!==e?e:this.bufferIndex;if(i=this.buffers[r],this.buffers.length>r+1)for(t=r+1;t>3;return 31===s&&i.data.length>=2&&(s=32+((7&i.data[0])<<3)+((224&i.data[1])>>5)),s}return null},i.DecoderConfigDescriptor=function(e){i.Descriptor.call(this,4,e)},i.DecoderConfigDescriptor.prototype=new i.Descriptor,i.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},i.DecoderSpecificInfo=function(e){i.Descriptor.call(this,5,e)},i.DecoderSpecificInfo.prototype=new i.Descriptor,i.SLConfigDescriptor=function(e){i.Descriptor.call(this,6,e)},i.SLConfigDescriptor.prototype=new i.Descriptor,this};t.MPEG4DescriptorParser=c;var u={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){u.FullBox.prototype=new u.Box,u.ContainerBox.prototype=new u.Box,u.SampleEntry.prototype=new u.Box,u.TrackGroupTypeBox.prototype=new u.FullBox,u.BASIC_BOXES.forEach((function(e){u.createBoxCtor(e)})),u.FULL_BOXES.forEach((function(e){u.createFullBoxCtor(e)})),u.CONTAINER_BOXES.forEach((function(e){u.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,i){this.type=e,this.size=t,this.uuid=i},FullBox:function(e,t,i){u.Box.call(this,e,t,i),this.flags=0,this.version=0},ContainerBox:function(e,t,i){u.Box.call(this,e,t,i),this.boxes=[]},SampleEntry:function(e,t,i,s){u.ContainerBox.call(this,e,t),this.hdr_size=i,this.start=s},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){u.FullBox.call(this,e,t)},createBoxCtor:function(e,t){u.boxCodes.push(e),u[e+"Box"]=function(t){u.Box.call(this,e,t)},u[e+"Box"].prototype=new u.Box,t&&(u[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){u[e+"Box"]=function(t){u.FullBox.call(this,e,t)},u[e+"Box"].prototype=new u.FullBox,u[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,i=0;ii?(a.error("BoxParser","Box of type '"+h+"' has a size "+d+" greater than its container size "+i),{code:u.ERR_NOT_ENOUGH_DATA,type:h,size:d,hdr_size:l,start:n}):0!==d&&n+d>e.getEndPosition()?(e.seek(n),a.info("BoxParser","Not enough data in stream to parse the entire '"+h+"' box"),{code:u.ERR_NOT_ENOUGH_DATA,type:h,size:d,hdr_size:l,start:n}):t?{code:u.OK,type:h,size:d,hdr_size:l,start:n}:(u[h+"Box"]?s=new u[h+"Box"](d):"uuid"!==h?(a.warn("BoxParser","Unknown box type: '"+h+"'"),(s=new u.Box(h,d)).has_unparsed_data=!0):u.UUIDBoxes[o]?s=new u.UUIDBoxes[o](d):(a.warn("BoxParser","Unknown uuid type: '"+o+"'"),(s=new u.Box(h,d)).uuid=o,s.has_unparsed_data=!0),s.hdr_size=l,s.start=n,s.write===u.Box.prototype.write&&"mdat"!==s.type&&(a.info("BoxParser","'"+c+"' box writing not yet implemented, keeping unparsed data in memory for later write"),s.parseDataAndRewind(e)),s.parse(e),(r=e.getPosition()-(s.start+s.size))<0?(a.warn("BoxParser","Parsing of box '"+c+"' did not read the entire indicated box data size (missing "+-r+" bytes), seeking forward"),e.seek(s.start+s.size)):r>0&&(a.error("BoxParser","Parsing of box '"+c+"' read "+r+" more bytes than the indicated box data size, seeking backwards"),0!==s.size&&e.seek(s.start+s.size)),{code:u.OK,box:s,size:s.size})},u.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},u.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},u.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},u.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},u.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},u.ContainerBox.prototype.parse=function(e){for(var t,i;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},u.SAMPLE_ENTRY_TYPE_VISUAL="Visual",u.SAMPLE_ENTRY_TYPE_AUDIO="Audio",u.SAMPLE_ENTRY_TYPE_HINT="Hint",u.SAMPLE_ENTRY_TYPE_METADATA="Metadata",u.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",u.SAMPLE_ENTRY_TYPE_SYSTEM="System",u.SAMPLE_ENTRY_TYPE_TEXT="Text",u.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},u.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},u.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},u.SampleEntry.prototype.parseFooter=function(e){u.ContainerBox.prototype.parse.call(this,e)},u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_HINT),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_METADATA),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SUBTITLE),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SYSTEM),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_TEXT),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_TEXT,"enct"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_METADATA,"encm"),u.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var i=0;i<3;i++)this.layer_size[i]=16==t?e.readUint16():e.readUint32()})),u.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),u.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),u.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)a.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void a.error("av1C reserved_2 parsing problem");var i=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(i)}else a.error("av1C reserved_1 parsing problem");else a.error("av1C version "+this.version+" not supported")})),u.createBoxCtor("avcC",(function(e){var t,i;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),i=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(i))})),u.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),u.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),u.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),u.createFullBoxCtor("co64",(function(e){var t,i;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(i=0;i>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),u.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),u.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),u.createFullBoxCtor("ctts",(function(e){var t,i;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(i=0;i>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|i>>6&3,this.acmod=i>>3&7,this.lfeon=i>>2&1,this.bit_rate_code=3&i|s>>5&7})),u.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var i=0;i>6,s.bsid=r>>1&31,s.bsmod=(1&r)<<4|o>>4&15,s.acmod=o>>1&7,s.lfeon=1&o,s.num_dep_sub=a>>1&15,s.num_dep_sub>0&&(s.chan_loc=(1&a)<<8|e.readUint8())}})),u.createFullBoxCtor("dfLa",(function(e){var t=[],i=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var s=e.readUint8(),r=Math.min(127&s,i.length-1);if(r?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(i[r]),128&s)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),u.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),u.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),u.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),u.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[i]=e.readString(4),t-=4,i++})),u.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),u.createBoxCtor("hvcC",(function(e){var t,i,s,r;this.configurationVersion=e.readUint8(),r=e.readUint8(),this.general_profile_space=r>>6,this.general_tier_flag=(32&r)>>5,this.general_profile_idc=31&r,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),r=e.readUint8(),this.constantFrameRate=r>>6,this.numTemporalLayers=(13&r)>>3,this.temporalIdNested=(4&r)>>2,this.lengthSizeMinusOne=3&r,this.nalu_arrays=[];var o=e.readUint8();for(t=0;t>7,a.nalu_type=63&r;var n=e.readUint16();for(i=0;i>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var i=0;if(this.version<2)i=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";i=e.readUint32()}for(var s=0;s>7,this.axis=1&t})),u.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),a.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),u.createFullBoxCtor("ipma",(function(e){var t,i;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?a.property_index=(127&o)<<8|e.readUint8():a.property_index=127&o}}})),u.createFullBoxCtor("iref",(function(e){var t,i;for(this.references=[];e.getPosition()>7,s.assignment_type=127&r,s.assignment_type){case 0:s.grouping_type=e.readString(4);break;case 1:s.grouping_type=e.readString(4),s.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:s.sub_track_id=e.readUint32();break;default:a.warn("BoxParser","Unknown leva assignement type")}}})),u.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),u.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),p.prototype.toString=function(){return"("+this.x+","+this.y+")"},u.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new p(e.readUint16(),e.readUint16()),this.display_primaries[1]=new p(e.readUint16(),e.readUint16()),this.display_primaries[2]=new p(e.readUint16(),e.readUint16()),this.white_point=new p(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),u.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),u.createFullBoxCtor("mehd",(function(e){1&this.flags&&(a.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),u.createFullBoxCtor("meta",(function(e){this.boxes=[],u.ContainerBox.prototype.parse.call(this,e)})),u.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),u.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),u.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),u.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),u.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),u.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),u.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var i=0;i0){var t=e.readUint32();this.kid=[];for(var i=0;i0&&(this.data=e.readUint8Array(s))})),u.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),u.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),u.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),u.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),u.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),u.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var i=0;i>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var i=e.readUint8(),s=0;s>7,this.num_leading_samples=127&t})),u.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)a.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=u.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),u.createSampleGroupCtor("stsa",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),u.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),u.createSampleGroupCtor("tsas",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createSampleGroupCtor("tscl",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createSampleGroupCtor("vipr",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),i=0;i>6,this.sample_depends_on[s]=t>>4&3,this.sample_is_depended_on[s]=t>>2&3,this.sample_has_redundancy[s]=3&t})),u.createFullBoxCtor("senc"),u.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),a.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),i=0;i>31&1,s.referenced_size=2147483647&r,s.subsegment_duration=e.readUint32(),r=e.readUint32(),s.starts_with_SAP=r>>31&1,s.SAP_type=r>>28&7,s.SAP_delta_time=268435455&r}})),u.SingleItemTypeReferenceBox=function(e,t,i,s){u.Box.call(this,e,t),this.hdr_size=i,this.start=s},u.SingleItemTypeReferenceBox.prototype=new u.Box,u.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var i=0;i>4&15,this.sample_sizes[t+1]=15&s}else if(8===this.field_size)for(t=0;t0)for(i=0;i>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=u.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),u.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),u.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),u.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var i=e.readUint32(),s=0;s>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),u.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),u.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),u.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),u.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),u.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),u.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},u.createTrackGroupCtor("msrc"),u.TrackReferenceTypeBox=function(e,t,i,s){u.Box.call(this,e,t),this.hdr_size=i,this.start=s},u.TrackReferenceTypeBox.prototype=new u.Box,u.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},u.trefBox.prototype.parse=function(e){for(var t,i;e.getPosition()t&&this.flags&u.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&u.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var i=0;i>7&1,this.block_pad_lsb=i>>6&1,this.block_little_endian=i>>5&1,this.block_reversed=i>>4&1,this.pad_unknown=i>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),u.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),u.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),u.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),u.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=u.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),u.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),u.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=u.parseHex16(e)})),u.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),u.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),u.createFullBoxCtor("vvcC",(function(e){var t,i,s={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(s.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,i=this.num_sublayers-2;i>=0;--i){var a=s.extract_bits(1);this.ptl_sublayer_present_mask|=a<1;++i)s.extract_bits(1);for(this.sublayer_level_idc=[],i=this.num_sublayers-2;i>=0;--i)this.ptl_sublayer_present_mask&1<>=1;t+=u.decimalToHex(s,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var r=!1,o="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||r)&&(o="."+u.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+o,r=!0);t+=o}return t},u.vvc1SampleEntry.prototype.getCodec=u.vvi1SampleEntry.prototype.getCodec=function(){var e,t=u.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var i="";if(this.vvcC.general_constraint_info){var s,r=[],o=0;for(o|=this.vvcC.ptl_frame_only_constraint<<7,o|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,r.push(o),o&&(s=e),o=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===s)i=".CA";else{i=".C";var a="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",n=0,l=0;for(e=0;e<=s;++e)for(n=n<<8|r[e],l+=8;l>=5;){i+=a[n>>l-5&31],n&=(1<<(l-=5))-1}l&&(i+=a[31&(n<<=5-l)])}}t+=i}return t},u.mp4aSampleEntry.prototype.getCodec=function(){var e=u.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),i=this.esds.esd.getAudioConfig();return e+"."+u.decimalToHex(t)+(i?"."+i:"")}return e},u.stxtSampleEntry.prototype.getCodec=function(){var e=u.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},u.vp08SampleEntry.prototype.getCodec=u.vp09SampleEntry.prototype.getCodec=function(){var e=u.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var i=this.vpcC.bitDepth;return 8==i&&(i="08"),e+".0"+this.vpcC.profile+"."+t+"."+i},u.av01SampleEntry.prototype.getCodec=function(){var e,t=u.SampleEntry.prototype.getCodec.call(this),i=this.av1C.seq_level_idx_0;return i<10&&(i="0"+i),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+i+(this.av1C.seq_tier_0?"H":"M")+"."+e},u.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>d&&(this.size+=8),"uuid"===this.type&&(this.size+=16),a.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>d?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>d&&e.writeUint64(this.size)},u.FullBox.prototype.writeHeader=function(e){this.size+=4,u.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},u.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},u.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},u.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&u.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&u.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&u.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&u.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&u.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&u.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&u.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&u.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&u.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&u.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},u.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},u.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},u.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&u.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&u.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&u.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&u.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&u.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&u.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&u.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&u.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[i]instanceof u.Box||t[i]instanceof u.Box||void 0===e[i]||void 0===t[i]||"function"==typeof e[i]||"function"==typeof t[i]||e.subBoxNames&&e.subBoxNames.indexOf(i.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(i.slice(0,4))>-1||"data"===i||"start"===i||"size"===i||"creation_time"===i||"modification_time"===i||u.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(i)>-1||e[i]===t[i]))return!1;return!0},u.boxEqual=function(e,t){if(!u.boxEqualFields(e,t))return!1;for(var i=0;i1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},y.prototype.setExtractionOptions=function(e,t,i){var s=this.getTrackById(e);if(s){var r={};this.extractedTracks.push(r),r.id=e,r.user=t,r.trak=s,s.nextSample=0,r.nb_samples=1e3,r.samples=[],i&&i.nbSamples&&(r.nb_samples=i.nbSamples)}},y.prototype.unsetExtractionOptions=function(e){for(var t=-1,i=0;i-1&&this.extractedTracks.splice(t,1)},y.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=u.parseOneBox(this.stream,false)).code===u.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var i;switch(i="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),i){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[i]&&a.warn("ISOFile","Duplicate Box of type: "+i+", overriding previous occurrence"),this[i]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},y.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(a.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(a.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(a.warn("ISOFile","Not ready to start parsing"),!1))},y.prototype.appendBuffer=function(e,t){var i;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(i=this.nextSeekPosition,this.nextSeekPosition=void 0):i=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(i=this.stream.getEndFilePositionAfter(i))):i=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(a.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+i),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),i},y.prototype.getInfo=function(){var e,t,i,s,r,o,a={},n=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(a.hasMoov=!0,a.duration=this.moov.mvhd.duration,a.timescale=this.moov.mvhd.timescale,a.isFragmented=null!=this.moov.mvex,a.isFragmented&&this.moov.mvex.mehd&&(a.fragment_duration=this.moov.mvex.mehd.fragment_duration),a.isProgressive=this.isProgressive,a.hasIOD=null!=this.moov.iods,a.brands=[],a.brands.push(this.ftyp.major_brand),a.brands=a.brands.concat(this.ftyp.compatible_brands),a.created=new Date(n+1e3*this.moov.mvhd.creation_time),a.modified=new Date(n+1e3*this.moov.mvhd.modification_time),a.tracks=[],a.audioTracks=[],a.videoTracks=[],a.subtitleTracks=[],a.metadataTracks=[],a.hintTracks=[],a.otherTracks=[],e=0;e0?a.mime+='video/mp4; codecs="':a.audioTracks&&a.audioTracks.length>0?a.mime+='audio/mp4; codecs="':a.mime+='application/mp4; codecs="',e=0;e=i.samples.length)&&(a.info("ISOFile","Sending fragmented data on track #"+s.id+" for samples ["+Math.max(0,i.nextSample-s.nb_samples)+","+(i.nextSample-1)+"]"),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(s.id,s.user,s.segmentStream.buffer,i.nextSample,e||i.nextSample>=i.samples.length),s.segmentStream=null,s!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=i.samples.length)&&(a.debug("ISOFile","Sending samples on track #"+o.id+" for sample "+i.nextSample),this.onSamples&&this.onSamples(o.id,o.user,o.samples),o.samples=[],o!==this.extractedTracks[t]))break}}}},y.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},y.prototype.getBoxes=function(e,t){var i=[];return y._sweep.call(this,e,i,t),i},y._sweep=function(e,t,i){for(var s in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&i)return;y._sweep.call(this.boxes[s],e,t,i)}},y.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},y.prototype.getTrackSample=function(e,t){var i=this.getTrackById(e);return this.getSample(i,t)},y.prototype.releaseUsedSamples=function(e,t,i){var s=0,r=this.getTrackById(e);r.lastValidSample||(r.lastValidSample=0);for(var o=r.lastValidSample;oe*r.timescale){d=s-1;break}t&&r.is_sync&&(l=s)}for(t&&(d=l),e=i.samples[d].cts,i.nextSample=d;i.samples[d].alreadyRead===i.samples[d].size&&i.samples[d+1];)d++;return o=i.samples[d].offset+i.samples[d].alreadyRead,a.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+i.nextSample+" on track "+i.tkhd.track_id+", time "+a.getDurationString(e,n)+" and offset: "+o),{offset:o,time:e/n}},y.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},y.prototype.seek=function(e,t){var i,s,r,o=this.moov,n={offset:1/0,time:1/0};if(this.moov){for(r=0;rthis.getTrackDuration(i)||((s=this.seekTrack(e,t,i)).offset-1){a=l;break}switch(a){case"Visual":if(r.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),o.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var c=new u.avcCBox;c.parse(new n(t.avcDecoderConfigRecord)),o.addBox(c)}else if(t.hevcDecoderConfigRecord){var p=new u.hvcCBox;p.parse(new n(t.hevcDecoderConfigRecord)),o.addBox(p)}break;case"Audio":r.add("smhd").set("balance",t.balance||0),o.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":r.add("hmhd");break;case"Subtitle":if(r.add("sthd"),"stpp"===t.type)o.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:r.add("nmhd")}t.description&&o.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){o.addBox(e)})),r.add("dinf").add("dref").addEntry((new u["url Box"]).set("flags",1));var f=r.add("stbl");return f.add("stsd").addEntry(o),f.add("stts").set("sample_counts",[]).set("sample_deltas",[]),f.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),f.add("stco").set("chunk_offsets",[]),f.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(i),t.id}},u.Box.prototype.computeSize=function(e){var t=e||new l;t.endianness=l.BIG_ENDIAN,this.write(t)},y.prototype.addSample=function(e,t,i){var s=i||{},r={},o=this.getTrackById(e);if(null!==o){r.number=o.samples.length,r.track_id=o.tkhd.track_id,r.timescale=o.mdia.mdhd.timescale,r.description_index=s.sample_description_index?s.sample_description_index-1:0,r.description=o.mdia.minf.stbl.stsd.entries[r.description_index],r.data=t,r.size=t.byteLength,r.alreadyRead=r.size,r.duration=s.duration||1,r.cts=s.cts||0,r.dts=s.dts||0,r.is_sync=s.is_sync||!1,r.is_leading=s.is_leading||0,r.depends_on=s.depends_on||0,r.is_depended_on=s.is_depended_on||0,r.has_redundancy=s.has_redundancy||0,r.degradation_priority=s.degradation_priority||0,r.offset=0,r.subsamples=s.subsamples,o.samples.push(r),o.samples_size+=r.size,o.samples_duration+=r.duration,void 0===o.first_dts&&(o.first_dts=s.dts),this.processSamples();var a=this.createSingleSampleMoof(r);return this.addBox(a),a.computeSize(),a.trafs[0].truns[0].data_offset=a.size+8,this.add("mdat").data=new Uint8Array(t),r}},y.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var i=new u.moofBox;i.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var s=i.add("traf"),r=this.getTrackById(e.track_id);return s.add("tfhd").set("track_id",e.track_id).set("flags",u.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),s.add("tfdt").set("baseMediaDecodeTime",e.dts-(r.first_dts||0)),s.add("trun").set("flags",u.TRUN_FLAGS_DATA_OFFSET|u.TRUN_FLAGS_DURATION|u.TRUN_FLAGS_SIZE|u.TRUN_FLAGS_FLAGS|u.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),i},y.prototype.lastMoofIndex=0,y.prototype.samplesDataSize=0,y.prototype.resetTables=function(){var e,t,i,s,r,o;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(l=r[a].grouping_type+"/0",(n=new d(r[a].grouping_type,0)).is_fragment=!0,t.sample_groups_info[l]||(t.sample_groups_info[l]=n))}else for(a=0;a=2&&(l=s[a].grouping_type+"/0",n=new d(s[a].grouping_type,0),e.sample_groups_info[l]||(e.sample_groups_info[l]=n))},y.setSampleGroupProperties=function(e,t,i,s){var r,o;for(r in t.sample_groups=[],s){var a;if(t.sample_groups[r]={},t.sample_groups[r].grouping_type=s[r].grouping_type,t.sample_groups[r].grouping_type_parameter=s[r].grouping_type_parameter,i>=s[r].last_sample_in_run&&(s[r].last_sample_in_run<0&&(s[r].last_sample_in_run=0),s[r].entry_index++,s[r].entry_index<=s[r].sbgp.entries.length-1&&(s[r].last_sample_in_run+=s[r].sbgp.entries[s[r].entry_index].sample_count)),s[r].entry_index<=s[r].sbgp.entries.length-1?t.sample_groups[r].group_description_index=s[r].sbgp.entries[s[r].entry_index].group_description_index:t.sample_groups[r].group_description_index=-1,0!==t.sample_groups[r].group_description_index)a=s[r].fragment_description?s[r].fragment_description:s[r].description,t.sample_groups[r].group_description_index>0?(o=t.sample_groups[r].group_description_index>65535?(t.sample_groups[r].group_description_index>>16)-1:t.sample_groups[r].group_description_index-1,a&&o>=0&&(t.sample_groups[r].description=a.entries[o])):a&&a.version>=2&&a.default_group_description_index>0&&(t.sample_groups[r].description=a.entries[a.default_group_description_index-1])}},y.process_sdtp=function(e,t,i){t&&(e?(t.is_leading=e.is_leading[i],t.depends_on=e.sample_depends_on[i],t.is_depended_on=e.sample_is_depended_on[i],t.has_redundancy=e.sample_has_redundancy[i]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},y.prototype.buildSampleLists=function(){var e,t;for(e=0;eb&&(v++,b<0&&(b=0),b+=o.sample_counts[v]),t>0?(e.samples[t-1].duration=o.sample_deltas[v],e.samples_duration+=e.samples[t-1].duration,k.dts=e.samples[t-1].dts+e.samples[t-1].duration):k.dts=0,a?(t>=_&&(w++,_<0&&(_=0),_+=a.sample_counts[w]),k.cts=e.samples[t].dts+a.sample_offsets[w]):k.cts=k.dts,n?(t==n.sample_numbers[S]-1?(k.is_sync=!0,S++):(k.is_sync=!1,k.degradation_priority=0),d&&d.entries[E].sample_delta+T==t+1&&(k.subsamples=d.entries[E].subsamples,T+=d.entries[E].sample_delta,E++)):k.is_sync=!0,y.process_sdtp(e.mdia.minf.stbl.sdtp,k,k.number),k.degradation_priority=u?u.priority[t]:0,d&&d.entries[E].sample_delta+T==t&&(k.subsamples=d.entries[E].subsamples,T+=d.entries[E].sample_delta),(h.length>0||c.length>0)&&y.setSampleGroupProperties(e,k,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},y.prototype.updateSampleLists=function(){var e,t,i,s,r,o,a,n,l,d,h,c,p,f,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&y.initSampleGroups(c,h,h.sbgps,c.mdia.minf.stbl.sgpds,h.sgpds),t=0;t0?f.dts=c.samples[c.samples.length-2].dts+c.samples[c.samples.length-2].duration:(h.tfdt?f.dts=h.tfdt.baseMediaDecodeTime:f.dts=0,c.first_traf_merged=!0),f.cts=f.dts,g.flags&u.TRUN_FLAGS_CTS_OFFSET&&(f.cts=f.dts+g.sample_composition_time_offset[i]),m=a,g.flags&u.TRUN_FLAGS_FLAGS?m=g.sample_flags[i]:0===i&&g.flags&u.TRUN_FLAGS_FIRST_FLAG&&(m=g.first_sample_flags),f.is_sync=!(m>>16&1),f.is_leading=m>>26&3,f.depends_on=m>>24&3,f.is_depended_on=m>>22&3,f.has_redundancy=m>>20&3,f.degradation_priority=65535&m;var A=!!(h.tfhd.flags&u.TFHD_FLAG_BASE_DATA_OFFSET),b=!!(h.tfhd.flags&u.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),v=!!(g.flags&u.TRUN_FLAGS_DATA_OFFSET),_=0;_=A?h.tfhd.base_data_offset:b||0===t?d.start:n,f.offset=0===t&&0===i?v?_+g.data_offset:_:n,n=f.offset+f.size,(h.sbgps.length>0||h.sgpds.length>0||c.mdia.minf.stbl.sbgps.length>0||c.mdia.minf.stbl.sgpds.length>0)&&y.setSampleGroupProperties(c,f,f.number_in_traf,h.sample_groups_info)}}if(h.subs){c.has_fragment_subsamples=!0;var w=h.first_sample_index;for(t=0;t-1))return null;var o=(i=this.stream.buffers[r]).byteLength-(s.offset+s.alreadyRead-i.fileStart);if(s.size-s.alreadyRead<=o)return a.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-i.fileStart)+" read size: "+(s.size-s.alreadyRead)+" full size: "+s.size+")"),l.memcpy(s.data.buffer,s.alreadyRead,i,s.offset+s.alreadyRead-i.fileStart,s.size-s.alreadyRead),i.usedBytes+=s.size-s.alreadyRead,this.stream.logBufferLevel(),s.alreadyRead=s.size,s;if(0===o)return null;a.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-i.fileStart)+" read size: "+o+" full size: "+s.size+")"),l.memcpy(s.data.buffer,s.alreadyRead,i,s.offset+s.alreadyRead-i.fileStart,o),s.alreadyRead+=o,i.usedBytes+=o,this.stream.logBufferLevel()}},y.prototype.releaseSample=function(e,t){var i=e.samples[t];return i.data?(this.samplesDataSize-=i.size,i.data=null,i.description=null,delete i.degradation_priority,delete i.depends_on,delete i.description_index,delete i.has_redundancy,delete i.is_depended_on,delete i.is_leading,delete i.is_sync,delete i.moof_number,delete i.number_in_traf,delete i.timescale,delete i.cts,delete i.dts,delete i.offset,delete i.size,delete i.track_id,delete i.duration,i.alreadyRead=0,i.size):0},y.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},y.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},y.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(i.protection=o.ipro.protections[o.iinf.item_infos[e].protection_index-1]),o.iinf.item_infos[e].item_type?i.type=o.iinf.item_infos[e].item_type:i.type="mime",i.content_type=o.iinf.item_infos[e].content_type,i.content_encoding=o.iinf.item_infos[e].content_encoding;if(o.grpl)for(e=0;e0&&u.property_index-1-1))return null;var n=(t=this.stream.buffers[o]).byteLength-(r.offset+r.alreadyRead-t.fileStart);if(!(r.length-r.alreadyRead<=n))return a.debug("ISOFile","Getting item #"+e+" extent #"+s+" partial data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-t.fileStart)+" read size: "+n+" full extent size: "+r.length+" full item size: "+i.size+")"),l.memcpy(i.data.buffer,i.alreadyRead,t,r.offset+r.alreadyRead-t.fileStart,n),r.alreadyRead+=n,i.alreadyRead+=n,t.usedBytes+=n,this.stream.logBufferLevel(),null;a.debug("ISOFile","Getting item #"+e+" extent #"+s+" data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-t.fileStart)+" read size: "+(r.length-r.alreadyRead)+" full extent size: "+r.length+" full item size: "+i.size+")"),l.memcpy(i.data.buffer,i.alreadyRead,t,r.offset+r.alreadyRead-t.fileStart,r.length-r.alreadyRead),t.usedBytes+=r.length-r.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead+=r.length-r.alreadyRead,r.alreadyRead=r.length}}return i.alreadyRead===i.size?i:null},y.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var i=0;i0?this.moov.traks[e].samples[0].duration:0),t.push(s)}return t},y.prototype.getPerformanceInfo=function(){var e={};return e.moov=this.moov,this.moov&&this.moov.traks&&this.moov.traks.length>1&&(e.moovAudioNum=this.moov.traks[0].samples.length,e.moovVideoNum=this.moov.traks[1].samples.length),e},u.Box.prototype.printHeader=function(e){this.size+=8,this.size>d&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},u.FullBox.prototype.printHeader=function(e){this.size+=4,u.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},u.Box.prototype.print=function(e){this.printHeader(e)},u.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},u.tkhdBox.prototype.print=function(e){u.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var A={createFile:function(e,t){var i=void 0===e||e,s=new y(t);return s.discardMdatData=!i,s}};t.createFile=A.createFile}));function yh(e){return e.reduce(((e,t)=>256*e+t))}function Ah(e){const t=[101,103,119,99],i=e.length-28,s=e.slice(i,i+t.length);return t.every(((e,t)=>e===s[t]))}gh.Log,gh.MP4BoxStream,gh.DataStream,gh.MultiBufferStream,gh.MPEG4DescriptorParser,gh.BoxParser,gh.XMLSubtitlein4Parser,gh.Textin4Parser,gh.ISOFile,gh.createFile;class bh{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(i+32,i+32+t))]}return null}(t,this.t);if(!i)return e;const s=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(s instanceof Error)return console.error(s.message),this.d=!0,e;this.A=!0,this.u=i[1],Ah(t)&&this.c++,WebAssembly.instantiate(i[2],s).then((e=>{if(!function(e){return"function"==typeof e.parse&&"object"==typeof e.memory}(e.instance.exports))return this.d=!0,void console.error("video_error_3");this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}class vh extends th{constructor(e){super(e),this.TAG_NAME="Fmp4Loader",this.player=e,this.mp4Box=gh.createFile(),this.tempFmp4List=[],this.offset=0,this.videoTrackId=null,this.audioTrackId=null,this.isHevc=!1,this.transportDescarmber=null,this.player._opt.isFmp4Private&&(this.transportDescarmber=new bh),this._listenMp4Box(),e.debugLog(this.TAG_NAME,"init")}destroy(){this.mp4Box&&(this.mp4Box.stop(),this.mp4Box.flush(),this.mp4Box.destroy(),this.mp4Box=null),this.transportDescarmber&&(this.transportDescarmber.destroy(),this.transportDescarmber=null),this.tempFmp4List=[],this.offset=0,this.videoTrackId=null,this.audioTrackId=null,this.isHevc=!1,this.player.debugLog(this.TAG_NAME,"destroy")}_listenMp4Box(){this.mp4Box.onReady=this.onReady.bind(this),this.mp4Box.onError=this.onError.bind(this),this.mp4Box.onSamples=this.onSamples.bind(this)}onReady(e){this.player.debugLog(this.TAG_NAME,"onReady",e);const t=e.videoTracks[0],i=e.audioTracks[0];if(t){this.videoTrackId=t.id;const e=this.getSeqHeader(t);e&&(this.player.debugLog(this.TAG_NAME,"seqHeader",e),this._doDecodeByFmp4(e,Oe,0,!0,0)),this.mp4Box.setExtractionOptions(t.id)}if(i&&this.player._opt.hasAudio){this.audioTrackId=i.id;const e=i.audio||{},t=Fr.indexOf(e.sample_rate),s=i.codec.replace("mp4a.40.","");this.mp4Box.setExtractionOptions(i.id);const r={profile:parseInt(s,10),sampleRate:t,channel:e.channel_count},o=Ur(r);this.player.debugLog(this.TAG_NAME,"aacADTSHeader",o,"config",r),this._doDecodeByFmp4(o,Ue,0,!1,0)}this.mp4Box.start()}onError(e){this.player.debugError(this.TAG_NAME,"mp4Box onError",e)}onSamples(e,t,i){if(e===this.videoTrackId){for(const e of i){const t=e.data,i=e.is_sync,s=1e3*e.cts/e.timescale;e.duration,e.timescale,this.player.updateStats({vbps:t.byteLength,dts:s}),i&&this.calcIframeIntervalTimestamp(s);let r=null;r=this.isHevc?Qn(t,i):Un(t,i);let o=this.cryptoPayload(r,i);this._doDecodeByFmp4(o,Oe,s,i,0)}this.mp4Box.removeUsedSamples(e)}else if(e===this.audioTrackId){if(this.player._opt.hasAudio){for(const e of i){const t=e.data;this.player.updateStats({abps:t.byteLength});const i=1e3*e.cts/e.timescale;e.duration,e.timescale;const s=new Uint8Array(t.byteLength+2);s.set([175,1],0),s.set(t,2),this._doDecodeByFmp4(s,Ue,i,!1,0)}this.mp4Box.removeUsedSamples(e)}}else this.player.debugWarn(this.TAG_NAME,"onSamples() trackId error",e)}getSeqHeader(e){const t=this.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new gh.DataStream(void 0,0,gh.DataStream.BIG_ENDIAN);let i=[];e.avcC?(e.avcC.write(t),i=[23,0,0,0,0]):(this.isHevc=!0,e.hvcC.write(t),i=[28,0,0,0,0]);const s=new Uint8Array(t.buffer,8),r=new Uint8Array(i.length+s.length);return r.set(i,0),r.set(s,i.length),r}return null}dispatch(e){let t=new Uint8Array(e);this.transportDescarmber&&(t=this.transportDescarmber.transport(t)),t.buffer.fileStart=this.offset,this.offset+=t.byteLength,this.mp4Box.appendBuffer(t.buffer)}downloadFmp4File(){const e=new Blob(this.tempFmp4List,{type:'video/mp4; codecs="avc1.640028,mp4a.40.2"'}),t=URL.createObjectURL(e),i=document.createElement("a");i.href=t,i.download=ro()+".fmp4",i.click(),URL.revokeObjectURL(t)}getInputByteLength(){let e=0;return this.mp4Box&&(e=this.mp4Box.getAllocatedSampleDataSize()),e}}class _h extends th{constructor(e){super(e),uh(this,"LOG_NAME","Mpeg4Loader"),this.player=e,this.player.debugLog(this.LOG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.LOG_NAME,"destroy")}}function wh(){for(var e=arguments.length,t=new Array(e),i=0;ie+t.byteLength),0));let r=0;return t.forEach((e=>{s.set(e,r),r+=e.byteLength})),s}const Sh=3,Eh=4,Th=6,kh=15,Lh=17,Ch=129,xh=135,Dh=21,Rh=134,Ph=27,Ih=36;class Bh{constructor(){this.slices=[],this.total_length=0,this.expected_length=0,this.random_access_indicator=0}}class Mh{constructor(){this.pid=null,this.data=null,this.stream_type=null,this.random_access_indicator=null}}class Fh{constructor(){this.pid=null,this.stream_id=null,this.len=null,this.data=null,this.pts=null,this.nearest_pts=null,this.dts=null}}const Uh=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];class Oh{constructor(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}isComplete(){let e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&null!=this.sarDen;return null!=this.mimeType&&e&&t}isSeekable(){return!0===this.hasKeyframesIndex}getNearestKeyframe(e){if(null==this.keyframesIndex)return null;let t=this.keyframesIndex,i=this._search(t.times,e);return{index:i,milliseconds:t.times[i],fileposition:t.filepositions[i]}}_search(e,t){let i=0,s=e.length-1,r=0,o=0,a=s;for(t=e[r]&&t=6?(s=5,t=new Array(4),a=r-3):(s=2,t=new Array(2),a=r):-1!==n.indexOf("android")?(s=2,t=new Array(2),a=r):(s=5,a=r,t=new Array(4),r>=6?a=r-3:1===o&&(s=2,t=new Array(2),a=r)),t[0]=s<<3,t[0]|=(15&r)>>>1,t[1]=(15&r)<<7,t[1]|=(15&o)<<3,5===s&&(t[1]|=(15&a)>>>1,t[2]=(1&a)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=Uh[r],this.sampling_index=r,this.channel_count=o,this.object_type=s,this.original_object_type=i,this.codec_mimetype="mp4a.40."+s,this.original_codec_mimetype="mp4a.40."+i}}class jh extends th{constructor(e){super(e),this.player=e,this.TAG_NAME="TsLoader",this.first_parse_=!0,this.tsPacketSize=0,this.syncOffset=0,this.pmt_=null,this.config_=null,this.media_info_=new Oh,this.timescale_=90,this.duration_=0,this.pat_={version_number:0,network_pid:0,program_map_pid:{}},this.current_program_=null,this.current_pmt_pid_=-1,this.program_pmt_map_={},this.pes_slice_queues_={},this.section_slice_queues_={},this.video_metadata_={vps:null,sps:null,pps:null,details:null},this.audio_metadata_={codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},this.last_pcr_=null,this.last_pcr_base_=NaN,this.timestamp_offset_=0,this.audio_last_sample_pts_=void 0,this.aac_last_incomplete_data_=null,this.has_video_=!1,this.has_audio_=!1,this.video_init_segment_dispatched_=!1,this.audio_init_segment_dispatched_=!1,this.video_metadata_changed_=!1,this.audio_metadata_changed_=!1,this.loas_previous_frame=null,this.video_track_={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this.audio_track_={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._remainingPacketData=null,this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.media_info_=null,this.pes_slice_queues_=null,this.section_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,this._remainingPacketData=null,super.destroy()}probe(e){let t=new Uint8Array(e),i=-1,s=188;if(t.byteLength<=3*s)return{needMoreData:!0};for(;-1===i;){let e=Math.min(1e3,t.byteLength-3*s);for(let r=0;r=4&&(i-=4),{match:!0,consumed:0,ts_packet_size:s,sync_offset:i})}_initPmt(){return{program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}}dispatch(e){let t=new Uint8Array(e);this._remainingPacketData&&(t=wh(this._remainingPacketData,t),this._remainingPacketData=null);let i=t.buffer;const s=this.parseChunks(i);s?this._remainingPacketData=t.subarray(s):t.length>>6;i[1];let o=(31&i[1])<<8|i[2],a=(48&i[3])>>>4,n=15&i[3],l=!(!this.pmt_||this.pmt_.pcr_pid!==o),d={},h=4;if(2==a||3==a){let e=i[4];if(e>0&&(l||3==a)){if(d.discontinuity_indicator=(128&i[5])>>>7,d.random_access_indicator=(64&i[5])>>>6,d.elementary_stream_priority_indicator=(32&i[5])>>>5,(16&i[5])>>>4){let e=300*this._getPcrBase(i)+((1&i[10])<<8|i[11]);this.last_pcr_=e}}if(2==a||5+e===188){t+=188,204===this.tsPacketSize&&(t+=16);continue}h=5+e}if(1==a||3==a)if(0===o||o===this.current_pmt_pid_||null!=this.pmt_&&this.pmt_.pid_stream_type[o]===Rh){let i=188-h;this.handleSectionSlice(e,t+h,i,{pid:o,payload_unit_start_indicator:r,continuity_conunter:n,random_access_indicator:d.random_access_indicator})}else if(null!=this.pmt_&&null!=this.pmt_.pid_stream_type[o]){let i=188-h,s=this.pmt_.pid_stream_type[o];o!==this.pmt_.common_pids.h264&&o!==this.pmt_.common_pids.h265&&o!==this.pmt_.common_pids.adts_aac&&o!==this.pmt_.common_pids.loas_aac&&o!==this.pmt_.common_pids.ac3&&o!==this.pmt_.common_pids.eac3&&o!==this.pmt_.common_pids.opus&&o!==this.pmt_.common_pids.mp3&&!0!==this.pmt_.pes_private_data_pids[o]&&!0!==this.pmt_.timed_id3_pids[o]&&!0!==this.pmt_.synchronous_klv_pids[o]&&!0!==this.pmt_.asynchronous_klv_pids[o]||this.handlePESSlice(e,t+h,i,{pid:o,stream_type:s,payload_unit_start_indicator:r,continuity_conunter:n,random_access_indicator:d.random_access_indicator})}t+=188,204===this.tsPacketSize&&(t+=16)}return this.dispatchAudioVideoMediaSegment(),t}handleSectionSlice(e,t,i,s){let r=new Uint8Array(e,t,i),o=this.section_slice_queues_[s.pid];if(s.payload_unit_start_indicator){let a=r[0];if(null!=o&&0!==o.total_length){let r=new Uint8Array(e,t+1,Math.min(i,a));o.slices.push(r),o.total_length+=r.byteLength,o.total_length===o.expected_length?this.emitSectionSlices(o,s):this.clearSlices(o,s)}for(let n=1+a;n=o.expected_length&&this.clearSlices(o,s),n+=l.byteLength}}else if(null!=o&&0!==o.total_length){let r=new Uint8Array(e,t,Math.min(i,o.expected_length-o.total_length));o.slices.push(r),o.total_length+=r.byteLength,o.total_length===o.expected_length?this.emitSectionSlices(o,s):o.total_length>=o.expected_length&&this.clearSlices(o,s)}}handlePESSlice(e,t,i,s){let r=new Uint8Array(e,t,i),o=r[0]<<16|r[1]<<8|r[2];r[3];let a=r[4]<<8|r[5];if(s.payload_unit_start_indicator){if(1!==o)return void this.player.debugWarn(this.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${o}`);let e=this.pes_slice_queues_[s.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?this.emitPESSlices(e,s):this.clearSlices(e,s)),this.pes_slice_queues_[s.pid]=new Bh,this.pes_slice_queues_[s.pid].random_access_indicator=s.random_access_indicator}if(null==this.pes_slice_queues_[s.pid])return;let n=this.pes_slice_queues_[s.pid];n.slices.push(r),s.payload_unit_start_indicator&&(n.expected_length=0===a?0:a+6),n.total_length+=r.byteLength,n.expected_length>0&&n.expected_length===n.total_length?this.emitPESSlices(n,s):n.expected_length>0&&n.expected_length>>6,n=t[8];2!==a&&3!==a||(i=this._getTimestamp(t,9),o=3===a?this._getTimestamp(t,14):i);let l,d=9+n;if(0!==r){if(r<3+n)return void this.player.debugWarn(this.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");l=r-3-n}else l=t.byteLength-d;let h=t.subarray(d,d+l);switch(e.stream_type){case Sh:case Eh:this.parseMP3Payload(h,i);break;case Th:this.pmt_.common_pids.opus===e.pid?this.parseOpusPayload(h,i):this.pmt_.common_pids.ac3===e.pid?this.parseAC3Payload(h,i):this.pmt_.common_pids.eac3===e.pid?this.parseEAC3Payload(h,i):this.pmt_.asynchronous_klv_pids[e.pid]?this.parseAsynchronousKLVMetadataPayload(h,e.pid,s):this.pmt_.smpte2038_pids[e.pid]?this.parseSMPTE2038MetadataPayload(h,i,o,e.pid,s):this.parsePESPrivateDataPayload(h,i,o,e.pid,s);break;case kh:this.parseADTSAACPayload(h,i);break;case Lh:this.parseLOASAACPayload(h,i);break;case Ch:this.parseAC3Payload(h,i);break;case xh:this.parseEAC3Payload(h,i);break;case Dh:this.pmt_.timed_id3_pids[e.pid]?this.parseTimedID3MetadataPayload(h,i,o,e.pid,s):this.pmt_.synchronous_klv_pids[e.pid]&&this.parseSynchronousKLVMetadataPayload(h,i,o,e.pid,s);break;case Ph:this.parseH264Payload(h,i,o,e.random_access_indicator);break;case Ih:this.parseH265Payload(h,i,o,e.random_access_indicator)}}else if((188===s||191===s||240===s||241===s||255===s||242===s||248===s)&&e.stream_type===Th){let i,o=6;i=0!==r?r:t.byteLength-o;let a=t.subarray(o,o+i);this.parsePESPrivateDataPayload(a,void 0,void 0,e.pid,s)}}else this.player.debugError(this.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${i}`)}parsePAT(e){let t=e[0];if(0!==t)return void Log.e(this.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let i=(15&e[1])<<8|e[2];e[3],e[4];let s=(62&e[5])>>>1,r=1&e[5],o=e[6];e[7];let a=null;if(1===r&&0===o)a={version_number:0,network_pid:0,program_pmt_pid:{}},a.version_number=s;else if(a=this.pat_,null==a)return;let n=i-5-4,l=-1,d=-1;for(let t=8;t<8+n;t+=4){let i=e[t]<<8|e[t+1],s=(31&e[t+2])<<8|e[t+3];0===i?a.network_pid=s:(a.program_pmt_pid[i]=s,-1===l&&(l=i),-1===d&&(d=s))}1===r&&0===o&&(null==this.pat_&&this.player.debugLog(this.TAG_NAME,`Parsed first PAT: ${JSON.stringify(a)}`),this.pat_=a,this.current_program_=l,this.current_pmt_pid_=d)}parsePMT(e){let t=e[0];if(2!==t)return void this.player.debugError(this.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let i,s=(15&e[1])<<8|e[2],r=e[3]<<8|e[4],o=(62&e[5])>>>1,a=1&e[5],n=e[6];if(e[7],1===a&&0===n)i=this._initPmt(),i.program_number=r,i.version_number=o,this.program_pmt_map_[r]=i;else if(i=this.program_pmt_map_[r],null==i)return;i.pcr_pid=(31&e[8])<<8|e[9];let l=(15&e[10])<<8|e[11],d=12+l,h=s-9-l-4;for(let t=d;t0){for(let s=t+5;s0)for(let s=t+5;s1&&(this.player.debugWarn(this.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${s}ms`),s=e)}}let r,o=new Kr(e),a=null,n=s;for(;null!=(a=o.readNextAACFrame());){i=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},this.dispatchAudioInitSegment(e)):this.detectAudioMetadataChange(e)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(e)),r=n;let t=Math.floor(n);const s=new Uint8Array(a.data.length+2);s.set([175,1],0),s.set(a.data,2);let o={payload:s,length:s.byteLength,pts:t,dts:t,type:Ue};this.audio_track_.samples.push(o),this.audio_track_.length+=s.byteLength,n+=i}o.hasIncompleteData()&&(this.aac_last_incomplete_data_=o.getIncompleteData()),r&&(this.audio_last_sample_pts_=r)}parseLOASAACPayload(e,t){if(this.has_video_&&!this.video_init_segment_dispatched_)return;if(this.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);t.set(this.aac_last_incomplete_data_,0),t.set(e,this.aac_last_incomplete_data_.byteLength),e=t}let i,s;if(null!=t&&(s=t/this.timescale_),"aac"===this.audio_metadata_.codec){if(null==t&&null!=this.audio_last_sample_pts_)i=1024/this.audio_metadata_.sampling_frequency*1e3,s=this.audio_last_sample_pts_+i;else if(null==t)return void this.player.debugWarn(this.TAG_NAME,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.audio_last_sample_pts_){i=1024/this.audio_metadata_.sampling_frequency*1e3;let e=this.audio_last_sample_pts_+i;Math.abs(e-s)>1&&(this.player.debugWarn(this.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${s}ms`),s=e)}}let r,o=new Yr(e),a=null,n=s;for(;null!=(a=o.readNextAACFrame(Po(this.loas_previous_frame)?void 0:this.loas_previous_frame));){this.loas_previous_frame=a,i=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},this.dispatchAudioInitSegment(e)):this.detectAudioMetadataChange(e)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(e)),r=n;let t=Math.floor(n);const s=new Uint8Array(a.data.length+2);s.set([175,1],0),s.set(a.data,2);let o={payload:s,length:s.byteLength,pts:t,dts:t,type:Ue};this.audio_track_.samples.push(o),this.audio_track_.length+=s.byteLength,n+=i}o.hasIncompleteData()&&(this.aac_last_incomplete_data_=o.getIncompleteData()),r&&(this.audio_last_sample_pts_=r)}parseAC3Payload(e,t){}parseEAC3Payload(e,t){}parseOpusPayload(e,t){}parseMP3Payload(e,t){if(this.has_video_&&!this.video_init_segment_dispatched_)return;let i=[44100,48e3,32e3,0],s=[22050,24e3,16e3,0],r=[11025,12e3,8e3,0],o=e[1]>>>3&3,a=(6&e[1])>>1;e[2];let n=(12&e[2])>>>2,l=3!==(e[3]>>>6&3)?2:1,d=0,h=34;switch(o){case 0:d=r[n];break;case 2:d=s[n];break;case 3:d=i[n]}switch(a){case 1:h=34;break;case 2:h=33;break;case 3:h=32}const c={};c.object_type=h,c.sample_rate=d,c.channel_count=l,c.data=e;const u={codec:"mp3",data:c};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"mp3",object_type:h,sample_rate:d,channel_count:l},this.dispatchAudioInitSegment(u)):this.detectAudioMetadataChange(u)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(u));let p={payload:e,length:e.byteLength,pts:t/this.timescale_,dts:t/this.timescale_,type:Ue};this.audio_track_.samples.push(p),this.audio_track_.length+=e.byteLength}detectAudioMetadataChange(e){if(e.codec!==this.audio_metadata_.codec)return this.player.debugLog(this.TAG_NAME,`Audio: Audio Codecs changed from ${this.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===this.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==this.audio_metadata_.audio_object_type)return this.player.debugLog(this.TAG_NAME,`AAC: AudioObjectType changed from ${this.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==this.audio_metadata_.sampling_freq_index)return this.player.debugLog(this.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${this.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==this.audio_metadata_.channel_config)return this.player.debugLog(this.TAG_NAME,`AAC: Channel configuration changed from ${this.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===this.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==this.audio_metadata_.sampling_frequency)return this.player.debugLog(this.TAG_NAME,`AC3: Sampling Frequency changed from ${this.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==this.audio_metadata_.bit_stream_identification)return this.player.debugLog(this.TAG_NAME,`AC3: Bit Stream Identification changed from ${this.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==this.audio_metadata_.bit_stream_mode)return this.player.debugLog(this.TAG_NAME,`AC3: BitStream Mode changed from ${this.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==this.audio_metadata_.channel_mode)return this.player.debugLog(this.TAG_NAME,`AC3: Channel Mode changed from ${this.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==this.audio_metadata_.low_frequency_effects_channel_on)return this.player.debugLog(this.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${this.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===this.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==this.audio_metadata_.sample_rate)return this.player.debugLog(this.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==this.audio_metadata_.channel_count)return this.player.debugLog(this.TAG_NAME,`Opus: Channel count changed from ${this.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===this.audio_metadata_.codec){const t=e.data;if(t.object_type!==this.audio_metadata_.object_type)return this.player.debugLog(this.TAG_NAME,`MP3: AudioObjectType changed from ${this.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==this.audio_metadata_.sample_rate)return this.player.debugLog(this.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==this.audio_metadata_.channel_count)return this.player.debugLog(this.TAG_NAME,`MP3: Channel count changed from ${this.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1}dispatchAudioInitSegment(e){let t={type:"audio"};t.id=this.audio_track_.id,t.timescale=1e3,t.duration=this.duration_;let i="";if("aac"===this.audio_metadata_.codec){let s="aac"===e.codec?e.data:null,r=new Nh(s);t.audioSampleRate=r.sampling_rate,t.audioSampleRateIndex=r.sampling_index,t.channelCount=r.channel_count,t.codec=r.codec_mimetype,t.originalCodec=r.original_codec_mimetype,t.config=r.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale,i=wt;const o=Ur({profile:this.player._opt.mseDecodeAudio?r.object_type:r.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});console.error("aacADTSHeader",`profile: ${r.object_type}, sampleRate: ${t.audioSampleRateIndex}, channel: ${t.channelCount}`),this._doDecodeByTs(o,Ue,0,!1,0)}else"ac-3"===this.audio_metadata_.codec||"ec-3"===this.audio_metadata_.codec||"opus"===this.audio_metadata_.codec||"mp3"===this.audio_metadata_.codec&&(t.audioSampleRate=this.audio_metadata_.sample_rate,t.channelCount=this.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0,i=Et);0==this.audio_init_segment_dispatched_&&this.player.debugLog(this.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;let s=this.media_info_;s.hasAudio=!0,s.audioCodec=t.originalCodec,s.audioSampleRate=t.audioSampleRate,s.audioChannelCount=t.channelCount,s.hasVideo&&s.videoCodec?s.mimeType=`video/mp2t; codecs="${s.videoCodec},${s.audioCodec}"`:s.mimeType=`video/mp2t; codecs="${s.audioCodec}"`,i&&this.player.audio.updateAudioInfo({encTypeCode:i,channels:t.channelCount,sampleRate:t.audioSampleRate})}dispatchPESPrivateDataDescriptor(e,t,i){}parsePESPrivateDataPayload(e,t,i,s,r){let o=new Fh;if(o.pid=s,o.stream_id=r,o.len=e.byteLength,o.data=e,null!=t){let e=Math.floor(t/this.timescale_);o.pts=e}else o.nearest_pts=this.getNearestTimestampMilliseconds();if(null!=i){let e=Math.floor(i/this.timescale_);o.dts=e}}parseTimedID3MetadataPayload(e,t,i,s,r){this.player.debugLog(this.TAG_NAME,`Timed ID3 Metadata: pid=${s}, pts=${t}, dts=${i}, stream_id=${r}`)}parseSynchronousKLVMetadataPayload(e,t,i,s,r){this.player.debugLog(this.TAG_NAME,`Synchronous KLV Metadata: pid=${s}, pts=${t}, dts=${i}, stream_id=${r}`)}parseAsynchronousKLVMetadataPayload(e,t,i){this.player.debugLog(this.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${i}`)}parseSMPTE2038MetadataPayload(e,t,i,s,r){this.player.debugLog(this.TAG_NAME,`SMPTE 2038 Metadata: pid=${s}, pts=${t}, dts=${i}, stream_id=${r}`)}getNearestTimestampMilliseconds(){if(null!=this.audio_last_sample_pts_)return Math.floor(this.audio_last_sample_pts_);if(null!=this.last_pcr_){return Math.floor(this.last_pcr_/300/this.timescale_)}}_preDoDecode(){const e=this.video_track_,t=this.audio_track_;let i=e.samples;t.samples.length>0&&(i=e.samples.concat(t.samples),i=i.sort(((e,t)=>e.dts-t.dts))),i.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===Oe?this._doDecodeVideo({...e,payload:t}):e.type===Ue&&this._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0}_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?Qn(t,e.isIFrame):Un(t,e.isIFrame),this.player.updateStats({dts:e.dts,vbps:i.byteLength}),e.isIFrame&&this.calcIframeIntervalTimestamp(e.dts);let s=this.cryptoPayload(i,e.isIFrame);this._doDecodeByTs(s,Oe,e.dts,e.isIFrame,e.cts)}_doDecodeAudio(e){const t=new Uint8Array(e.payload);this.player.updateStats({abps:t.byteLength});let i=this.cryptoPayloadAudio(t);this._doDecodeByTs(i,Ue,e.dts,!1,0)}getInputByteLength(){return this._remainingPacketData&&this._remainingPacketData.byteLength||0}_getPcrBase(e){let t=33554432*e[6]+131072*e[7]+512*e[8]+2*e[9]+(128&e[10])/128+this.timestamp_offset_;return t+4294967296>>3&3,r=(6&t[1])>>1,o=(240&t[2])>>>4,a=(12&t[2])>>>2,n=3!==(t[3]>>>6&3)?2:1,l=0,d=0;switch(s){case 0:l=$h[a];break;case 2:l=zh[a];break;case 3:l=Wh[a]}switch(r){case 1:o{this._clearAudioSourceBufferCheckTimeout(),this.player.emit(dt.webcodecsAudioInitTimeout)}),1e3)),void ra(e)):void(this.player.isPlayer()?(this.player.updateStats({dfps:!0}),this.player._times.videoStart||(this.player._times.videoStart=ro(),this.player.handlePlayToRenderTimes()),this.player.video.render({videoFrame:e,ts:e.timestamp}),this.player.handleRender()):this.player.isPlayback()&&(this.player.updateStats({dfps:!0}),ya(this.player.playbackPause)?(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this.player.playback.isUseFpsRender?this.player.video.pushData({videoFrame:e,ts:e.timestamp}):this.player.video.render$2({videoFrame:e,ts:e.timestamp})):this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this.player.playback.isUseFpsRender&&this.player.video.pushData({videoFrame:e,ts:e.timestamp})));ra(e)}handleError(e){this.player.debugError(this.TAG_NAME,"VideoDecoder handleError:",e.code,e);const t=e.toString();-1!==t.indexOf(as)?this.player.emitError(dt.webcodecsUnsupportedConfigurationError,t):-1!==t.indexOf(ns)||-1!==t.indexOf(ls)||-1!==t.indexOf(ds)?this.player.emitError(dt.webcodecsDecodeError,t):-1!==t.indexOf(hs)&&this.player.emitError(dt.webcodecsH265NotSupport,t)}handleDecodeAudio(e){this.player&&(this.player.isDestroyedOrClosed()?this.player.debugWarn(this.TAG_NAME,"decodeVideo() player is destroyed"):this.player.isPlayer()?this.player.audio.play(e,e.timestamp):this.player.isPlayback())}handleErrorAudio(e){this.player.debugError(this.TAG_NAME,"AudioDecoder handleError:",e.code,e)}decodeVideo(e,t,i,s){if(this.player)if(this.player.isDestroyedOrClosed())this.player.debugWarn(this.TAG_NAME,"decodeVideo() player is destroyed");else if(this.hasInit)if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(this.isDecodeStateClosed())return void this.player.debugWarn(this.TAG_NAME,"VideoDecoder isDecodeStateClosed true");if(i&&0===e[1]){const t=15&e[0];let i={};if(t===At){i=Mn(e.slice(5))}else t===bt&&(i=Jn(e));const s=this.player.video.videoInfo;s&&s.width&&s.height&&i&&i.codecWidth&&i.codecHeight&&(i.codecWidth!==s.width||i.codecHeight!==s.height)&&(this.player.debugWarn(this.TAG_NAME,`decodeVideo: video width or height is changed,\n old width is ${s.width}, old height is ${s.height},\n new width is ${i.codecWidth}, new height is ${i.codecHeight},\n and emit change event`),this.isWidthOrHeightChanged=!0,this.player.emitError(dt.wcsWidthOrHeightChange,`width ${s.width}->${s.height} height ${i.codecWidth}->${i.codecHeight}`))}if(this.isWidthOrHeightChanged)return void this.player.debugWarn(this.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(ma(e))return void this.player.debugLog(this.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength<12)return void this.player.debugWarn(this.TAG_NAME,`decodeVideo and payload is too small , payload length is ${e.byteLength}`);let s=!1,r=(new Date).getTime();this.prevTimestamp||(this.prevTimestamp=r,s=!0);const o=r-this.prevTimestamp;this.decodeDiffTimestamp=o,o>500&&!s&&this.player.isPlayer()&&this.player.debugWarn(this.TAG_NAME,"decodeVideo diff time is ",o);const a=e.slice(5),n=new EncodedVideoChunk({data:a,timestamp:t,type:i?hi:ci});this.player.emit(at.timeUpdate,t);try{this.decoder.decode(n)}catch(e){this.player.debugError(this.TAG_NAME,"VideoDecoder",e);const t=e.toString();(-1!==t.indexOf(rs)||-1!==t.indexOf(os))&&this.player.emitError(dt.webcodecsDecodeError,t)}this.prevTimestamp=(new Date).getTime()}else this.player.debugLog(this.TAG_NAME,"VideoDecoder first frame is not iFrame");else if(i&&e[1]===As){const t=15&e[0];if(this.player.video.updateVideoInfo({encTypeCode:t}),t===bt&&!Co()){const e=yo();return this.player.debugWarn(this.TAG_NAME,"WebcodecsDecoder not support hevc decode",e.type,e.version),void this.player.emitError(dt.webcodecsH265NotSupport)}this.player._times.decodeStart||(this.player._times.decodeStart=ro());let i=null,s=null;const r=e.slice(5);if(t===At?(s=Mn(r),i={codec:s.codec,description:r}):t===bt&&(s=qn(r),i={codec:s.codec,description:r}),!i||i&&!i.codec||s&&0===s.codecWidth&&0===s.codecHeight)return this.player.debugWarn(this.TAG_NAME,"decodeVideo and webcodecs configure is",JSON.stringify(i)),void this.player.emitError(dt.webcodecsDecodeConfigureError,"configure or configure.code is null");i.codedHeight=s.codecHeight,i.codedWidth=s.codecWidth,this.isInitInfo||(this.player.debugLog(this.TAG_NAME,`updateVideoInfo: ${s.codecWidth},${s.codecHeight}`),this.player.video.updateVideoInfo({width:s.codecWidth,height:s.codecHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0),this.player.recorder&&this.player._opt.recordType===S&&this.player.recorder.initMetaData(e,t),this.player.video.bindMediaStream(),this.player.debugLog(this.TAG_NAME,`decoder.configure() and codec is ${i.codec}`);try{i.optimizeForLatency=!0,i.hardwareAcceleration="prefer-hardware",this.decoder.configure(i),this.hasInit=!0}catch(e){this.player.debugError(this.TAG_NAME,"configure error",e.code,e);const t=e.toString();-1!==t.indexOf(hs)?this.player.emitError(dt.webcodecsH265NotSupport,t):this.player.emitError(dt.webcodecsDecodeConfigureError,t)}}else this.player.debugWarn(this.TAG_NAME,`decodeVideo has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)}decodeAudio(e,t){if(this.player)if(this.player.isDestroyedOrClosed())this.player.debugWarn(this.TAG_NAME,"decodeAudio() player is destroyed");else if(this.hasAudioInit){if(Or(e))return void this.player.debugLog(this.TAG_NAME,"decodeAudio and has already initialized and payload is aac codec packet so drop this frame");if(this._clearAudioNoDataCheckTimeout(),this.isDecodeFirstIIframe){if(this.isAudioDecodeStateClosed())return void this.player.debugWarn(this.TAG_NAME,"AudioDecoder isDecodeStateClosed true");const i=this.isAAC?e.slice(2):e.slice(1),s=i.length/this.player.audio.audioInfo.sampleRate*1e3,r=new EncodedAudioChunk({type:"key",data:i,timestamp:t,duration:parseInt(s,10)});try{this.decoderAudio.decode(r)}catch(e){this.player.debugError(this.TAG_NAME,"AudioDecoder",e),e.toString()}}}else{const t=e[0]>>4,i=e[0]>>1&1,s=t===Et,r=t===wt,o=t===St;let a="";a=r?i?16:8:0===i?8:16;const n={codec:"",numberOfChannels:"",sampleRate:""};let l=null;if(r||s){let t=null;if(Or(e)){const i=e.slice(2);t=zr(i),t&&(n.codec=t.originalCodec,n.numberOfChannels=t.channelCount,n.sampleRate=t.sampleRate),l=i,this.isAAC=r}else s&&(t=qh(e),t&&(n.codec=Er,n.numberOfChannels=t.channelCount,n.sampleRate=t.samplingRate))}else n.codec=o?Sr:wr,n.numberOfChannels=1,n.sampleRate=8e3;if(n.codec&&n.numberOfChannels&&n.sampleRate){this.isAudioInitInfo||(this.player.audio.updateAudioInfo({encTypeCode:t,channels:n.numberOfChannels,sampleRate:n.sampleRate,depth:a}),this.isAudioInitInfo=!0),this.player.recorder&&this.player._opt.recordType===S&&l&&this.player.recorder.initAudioAacExtraData(l),this.player.debugLog(this.TAG_NAME,`decoderAudio.configure() and codec is ${n.codec}`);try{this.decoderAudio.configure(n),this._clearAudioSourceBufferCheckTimeout(),this.hasAudioInit=!0,null===this.audioSourceNoDataCheckTimeout&&(this.audioSourceNoDataCheckTimeout=setTimeout((()=>{this._clearAudioNoDataCheckTimeout(),this.player.emit(dt.webcodecsAudioNoDataTimeout)}),1e3))}catch(e){this.player.debugError(this.TAG_NAME,"configure audio error",e.code,e),e.toString()}}}}_clearAudioSourceBufferCheckTimeout(){this.audioSourceBufferCheckTimeout&&(clearTimeout(this.audioSourceBufferCheckTimeout),this.audioSourceBufferCheckTimeout=null)}_clearAudioNoDataCheckTimeout(){this.audioSourceNoDataCheckTimeout&&(clearTimeout(this.audioSourceNoDataCheckTimeout),this.audioSourceNoDataCheckTimeout=null)}getDecodeDiffTimes(){return this.decodeDiffTimestamp}isDecodeStateClosed(){return"closed"===this.decoder.state}isDecodeStateConfigured(){return"configured"===this.decoder.state}isDecodeStateUnConfigured(){return"unconfigured"===this.decoder.state}isAudioDecodeStateClosed(){return"closed"===this.decoderAudio.state}isAudioDecodeStateConfigured(){return"configured"===this.decoderAudio.state}isAudioDecodeStateUnConfigured(){return"unconfigured"===this.decoderAudio.state}}const Yh={play:"播放",pause:"暂停",audio:"",mute:"",screenshot:"截图",loading:"",fullscreen:"全屏",fullscreenExit:"退出全屏",record:"录制",recordStop:"停止录制",narrow:"缩小",expand:"放大",ptz:"操作盘",ptzActive:"操作盘激活",zoom:"电子放大",zoomStop:"关闭电子放大",close:"关闭",performance:"性能面板",performanceActive:"性能面板激活",face:"人脸识别",faceActive:"人脸识别激活",object:"物品识别",objectActive:"物品识别激活",occlusion:"遮挡物检查",occlusionActive:"遮挡物检查激活",logSave:"保存日志"};var Qh=Object.keys(Yh).reduce(((e,t)=>(e[t]=`\n \n ${Yh[t]?`${Yh[t]}`:""}\n`,e)),{});function Xh(e,t){let i=!1;return e.forEach((e=>{i||e.startTimestamp<=t&&e.endTimestamp>t&&(i=!0)})),i}function Zh(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=e.length,r=t.length,o=Math.max(s,r),a=2e3,n=Math.ceil(o/a);let l=0,d=0;function h(){let r="",o="";for(let i=0;i\n ${i.title}\n \n `);const a=t[d];a&&(o+=`\n

${a.title}
\n `),d+=1}r&&i.$playbackTimeListOne.insertAdjacentHTML("beforeend",r),o&&i.$playbackTimeListSecond.insertAdjacentHTML("beforeend",o),l+=1,l0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<1440;s++){const r=s%60==0;let o=!1;i&&(o=Xh(e,zo(i,s))),t.push({title:Go(s),timestamp:s,dataType:"min",hasRecord:o,isStart:r})}return t}(e);Zh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0})}return e}(),t)}function tc(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<1440;s++){let r=60*s,o=r%1800==0,a=!1;i&&(a=Xh(e,$o(i,r))),t.push({title:Wo(r),timestamp:r,dataType:"second",hasRecord:a,isStart:o});let n=60*s+30;o=n%1800==0,i&&(a=Xh(e,$o(i,n))),t.push({title:Wo(n),timestamp:n,dataType:"second",hasRecord:a,isStart:o})}return t}(e);Zh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00",s=t+":30";t<10&&(i="0"+i,s="0"+s),e.push({title:i,hour:t,min:0,second:0}),e.push({title:s,hour:t,min:30,second:0})}return e}(),t)}function ic(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<144;s++)for(let r=0;r<60;r++){let o=10*r+600*s,a=o%600==0,n=!1;i&&(n=Xh(e,$o(i,o))),t.push({title:Wo(o),timestamp:o,dataType:"second",isStart:a,hasRecord:n})}return t}(e);Zh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0});for(let s=1;s<6;s++){let r=s+"0";e.push({title:i.replace(":00",":"+r),hour:t,min:10*s,second:0})}}return e}(),t)}function sc(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<288;s++)for(let r=0;r<60;r++){let o=5*r+300*s,a=o%300==0,n=!1;i&&(n=Xh(e,$o(i,o))),t.push({title:Wo(o),timestamp:o,dataType:"second",isStart:a,hasRecord:n})}return t}(e);Zh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0}),e.push({title:i.replace(":00",":05"),hour:t,min:5,second:0});for(let s=1;s<6;s++){let r=s+"0",o=s+"5";e.push({title:i.replace(":00",":"+r),hour:t,min:10*s,second:0}),e.push({title:i.replace(":00",":"+o),hour:t,min:10*s+5,second:0})}}return e}(),t)}function rc(e){const t=Math.floor(e/3600),i=Math.floor((e-3600*t)/60),s=Math.floor(e-3600*t-60*i);return(t>0?[t,i,s]:[i,s]).map((e=>e<10?`0${e}`:String(e))).join(":")}function oc(e,t,i){const s=e.$playbackProgress,{left:r}=s.getBoundingClientRect(),o=oo((po()?i.touches[0].clientX:i.pageX)-r,0,s.clientWidth),a=parseInt(o/s.clientWidth*t,10);return{second:a,time:rc(a),width:o,percentage:oo(o/s.clientWidth,0,1)}}function ac(e,t){return e.classList.add(t)}function nc(e,t){return t instanceof Element?e.appendChild(t):e.insertAdjacentHTML("beforeend",String(t)),e.lastElementChild||e.lastChild}function lc(e,t,i){return e&&e.style&&Bo(t)&&(e.style[t]=i),e}function dc(e,t){return e.composedPath&&e.composedPath().indexOf(t)>-1}function hc(e){let t=!1;return e&&e.parentNode&&(e.parentNode.removeChild(e),t=!0),t}var cc=(e,t)=>{const{events:{proxy:i}}=e;let s=null,r=null,o=null,a=null;if(e._opt.listenWindowResizeAuoResize){s=document.createElement("object"),r=`jb-pro-object-${ca()}`,s.setAttribute("aria-hidden","true"),s.setAttribute("tabindex",-1),s.setAttribute("id",r),s.type="text/html",s.data="about:blank",ao(s,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"}),o=e.width,a=e.height;const t=Eo((()=>{e.width===o&&e.height===a||(o=e.width,a=e.height,e.emit(at.resize))}),500);i(s,"load",(()=>{i(s.contentDocument.defaultView,"resize",(()=>{t()}))})),e.$container.appendChild(s)}e.on(at.destroy,(()=>{if(s)try{if(!hc(s)){const t=e.$container.querySelector(`#${r}`);t&&e.$container&&e.$container.removeChild(t)}}catch(e){}d&&(clearInterval(d),d=null),h=null,c=null,u=0,s=null,r=null,o=null,a=null})),e.on(at.volumechange,(()=>{!function(e){if(0===e)ao(t.$volumeOn,"display","none"),ao(t.$volumeOff,"display","flex"),ao(t.$volumeHandle,"top","48px");else if(t.$volumeHandle&&t.$volumePanel){const i=no(t.$volumePanel,"height")||60,s=no(t.$volumeHandle,"height"),r=i-(i-s)*e-s;ao(t.$volumeHandle,"top",`${r}px`),ao(t.$volumeOn,"display","flex"),ao(t.$volumeOff,"display","none")}t.$volumePanelText&&(t.$volumePanelText.innerHTML=parseInt(100*e))}(e.volume)})),e.on(at.loading,(i=>{ao(t.$loading,"display",i?"flex":"none"),(ya(e._opt.backgroundLoadingShow)&&ga(i)||ya(i))&&ao(t.$poster,"display","none"),i&&(ao(t.$playBig,"display","none"),ao(t.$tipsMessage,"display","none"),t.extendBtnList.forEach((e=>{e.createdMoment===Lr&&(e.$iconWrap&&ao(e.$iconWrap,"display","flex"),e.$activeIconWrap&&ao(e.$activeIconWrap,"display","none"))}))),i||e._opt.extendDomConfig.showAfterLoading&&t.$extendDom&&ao(t.$extendDom,"display","block"),i||e.getRenderType()===H&&ya(e._opt.useMSE)&&n()})),e.on(at.removeLoadingBgImage,(()=>{n()}));const n=()=>{t.$loadingBgImage&&t.$loadingBg&&t.$loadingBgImage.src&&(e.debugLog("Control","remove loading bg image"),t.$loadingBgImage.width=0,t.$loadingBgImage.height=0,t.$loadingBgImage.src="",ao(t.$loadingBg,"display","none"))},l=t=>{Qo(t)===e.$container&&(e.fullscreen,f(),e._opt.androidMobileFullscreenRotate&&po()&&(e.fullscreen?(e.$container.classList.add("jb-pro-fullscreen-android-rotate"),e.setRotate(270)):(e.$container.classList.remove("jb-pro-fullscreen-android-rotate"),e.setRotate(0)),p()))};let d=null,h=null,c=null,u=0;const p=()=>{h=e.rect,h.width=parseInt(h.width,10),h.height=parseInt(h.height,10),u=0,d=setInterval((()=>{const t=Pr.isFullscreen;c=e.rect,c.width=parseInt(c.width,10),c.height=parseInt(c.height,10);const i=screen.width,s=screen.height,r=c.width===h.width&&c.height===h.height,o=!t||i-c.width<10&&s-c.height<10;if(r&&o||u>=5)return d&&(clearInterval(d),d=null),void g((()=>{A()}));h=c,u++}),1e3)},f=i=>{if(ya(e.isPlaying()))return;let s=Io(i)?i:e.fullscreen;ao(t.$fullscreenExit,"display",s?"flex":"none"),ao(t.$fullscreen,"display",s?"none":"flex")},m=()=>e._opt.playType===w&&e._opt.playbackConfig.showControl,g=i=>{po()&&t.$controls&&(e._opt.useWebFullScreen||e._opt.androidMobileFullscreenRotate)&&setTimeout((()=>{if(e.fullscreen){const i=m()?Xt:Qt;let s=e.height/2-e.width+i/2,r=e.height/2-i/2;if(t.$controls.style.transform=`translateX(${-s}px) translateY(-${r}px) rotate(-90deg)`,t.$zoomControls){const i=156,s=30,r=e.width/2+i/2-s/2;t.$zoomControls.style.transform=`translateX(${-r}px) translateY(${e.height/2}px) rotate(-90deg)`}if(t.$recording){const i=101,s=20,r=e.width/2+i/2-s/2;t.$recording.style.transform=`translateX(${-r}px) translateY(${e.height/2}px) rotate(-90deg)`}t.$ptzControl&&(t.$ptzControl.style.transform="rotate(-90deg)")}else t.$controls.style.transform="translateX(0) translateY(0) rotate(0)",t.$zoomControls&&(t.$zoomControls.style.transform="translateX(-50%) translateY(0) rotate(0)"),t.$recording&&(t.$recording.style.transform="translateX(-50%) translateY(0) rotate(0)"),t.$ptzControl&&(t.$ptzControl.style.transform="rotate(0)");i&&i()}),10)};try{Pr.on("change",l),e.events.destroys.push((()=>{Pr.off("change",l)}))}catch(e){}e.on(at.webFullscreen,(e=>{po()&&(f(e),g((()=>{A()})))})),e.on(at.recording,(()=>{e.playing&&(ao(t.$record,"display",e.recording?"none":"flex"),ao(t.$recordStop,"display",e.recording?"flex":"none"),(e._opt.hasControl||e._opt.isShowRecordingUI)&&(ao(t.$recording,"display",e.recording?"flex":"none"),ya(e.recording)&&t.$recordingTime&&(t.$recordingTime.innerHTML=jo(0))))})),e.on(at.recordingTimestamp,(e=>{t.$recordingTime&&(t.$recordingTime.innerHTML=jo(e))})),e.on(at.zooming,(()=>{e.playing&&(ao(t.$zoom,"display",e.zooming?"none":"flex"),ao(t.$zoomStop,"display",e.zooming?"flex":"none"),(e._opt.hasControl||e._opt.isShowZoomingUI)&&ao(t.$zoomControls,"display",e.zooming?"flex":"none"))})),e.on(at.playing,(e=>{y(e)}));const y=i=>{i||e.isPlayFailedAndPaused&&ya(e._opt.playFailedAndPausedShowPlayBtn)?(ao(t.$play,"display","none"),ao(t.$playBig,"display","none")):(ao(t.$play,"display","flex"),ao(t.$playBig,"display","block")),ao(t.$pause,"display",i?"flex":"none"),ao(t.$screenshot,"display",i?"flex":"none"),ao(t.$record,"display",i?"flex":"none"),ao(t.$qualityMenu,"display",i?"flex":"none"),ao(t.$volume,"display",i?"flex":"none"),ao(t.$ptz,"display",i?"flex":"none"),ao(t.$zoom,"display",i?"flex":"none"),ao(t.$scaleMenu,"display",i?"flex":"none"),ao(t.$faceDetect,"display",i?"flex":"none"),ao(t.$objectDetect,"display",i?"flex":"none"),ao(t.$occlusionDetect,"display",i?"flex":"none"),ao(t.$controlHtml,"display",i?"flex":"none"),e.isPlayback()&&ao(t.$speedMenu,"display",i?"flex":"none"),f(),t.extendBtnList.forEach((e=>{e.createdMoment===Cr&&(e.$iconWrap&&ao(e.$iconWrap,"display",i?"flex":"none"),e.$activeIconWrap&&ao(e.$activeIconWrap,"display","none"))})),e._opt.showPerformance?ao(t.$performanceActive,"display",i?"flex":"none"):(ao(t.$performance,"display",i?"flex":"none"),ao(t.$performanceActive,"display","none")),ao(t.$poster,"display","none"),ao(t.$ptzActive,"display","none"),ao(t.$recordStop,"display","none"),ao(t.$zoomStop,"display","none"),ao(t.$faceDetectActive,"display","none"),ao(t.$objectDetectActive,"display","none"),i||(t.$speed&&(t.$speed.innerHTML=function(e){if(null==e||""===e)return"0 KB/s";let t=parseFloat(e);return t=t.toFixed(2),t+"KB/s"}("")),ao(t.$zoomControls,"display","none"),ao(t.$recording,"display","none"),t.$ptzControl&&t.$ptzControl.classList.remove("jb-pro-ptz-controls-show")),A(),i&&b()};e.on(at.playbackPause,(e=>{y(!e)})),e.on(at.kBps,(i=>{const s=function(e){if(null==e||""===e||0===parseFloat(e)||"NaN"===e)return"0 KB/s";const t=["KB/s","MB/s","GB/s","TB/s","PB/s","EB/s","ZB/s","YB/s"];let i=0;const s=parseFloat(e/8);i=Math.floor(Math.log(s)/Math.log(1024));let r=s/Math.pow(1024,i);return r=r.toFixed(2),r+(t[i]||t[0])}(i);t.kbpsShow=s,e._opt.showBandwidth&&(t.$speed&&(t.$speed.innerHTML=s),A())}));const A=()=>{if(m()&&e._opt.playbackConfig.controlType===X.normal){let i=t.controlsInnerRect.width-t.controlsLeftRect.width-t.controlsRightRect.width-t.controlsPlaybackBtnsRect.width;po()&&e.webFullscreen&&(i=t.controlsInnerRect.height-t.controlsLeftRect.height-t.controlsRightRect.height-t.controlsPlaybackBtnsRect.height),t.$playbackTimeInner.style.width=i+"px"}},b=()=>{if(!m()||e._opt.playbackConfig.controlType!==X.normal)return;const i=t.$playbackCurrentTime.style.left;let s=parseInt(i,10);const r=t.controlsPlaybackTimeInner.width;s=s-r/2>0?parseInt(s-r/2,10):0,t.$playbackTimeInner.scrollLeft=s};if(m()){const i=()=>{if(m()){let i=0;const s=e.playback&&e.playback.playingTimestamp;if(s){const r=new Date(s),o=r.getHours(),a=r.getMinutes(),n=r.getSeconds();e.playback.is60Min?i=60*o+a:e.playback.is30Min?i=2*(60*o+a)+parseInt(n/30,10):e.playback.is10Min?i=6*(60*o+a)+parseInt(n/10,10):e.playback.is5Min?i=12*(60*o+a)+parseInt(n/5,10):e.playback.is1Min&&(i=60*(60*o+a)+parseInt(n,10)),t.$playbackCurrentTime.style.left=i+"px"}}},s=e=>{t.$playbackNarrow.classList.remove("disabled"),t.$playbackExpand.classList.remove("disabled"),e===Ei&&t.$playbackNarrow.classList.add("disabled"),e===Li&&t.$playbackExpand.classList.add("disabled")};e.on(at.playbackTime,(s=>{if(e._opt.playbackConfig.controlType===X.normal)t.$playbackCurrentTimeText&&(t.$playbackCurrentTimeText.innerText=vo(s,"{h}:{i}:{s}")),i();else if(e._opt.playbackConfig.controlType===X.simple){const i=(r=s,o=e.playback.totalDuration,oo(r/o,0,1));t.$playbackProgressPlayed.style.width=100*i+"%",t.$playbackProgressIndicator.style.left=`calc(${100*i}% - 7px)`,t.$playbackProgressTime.innerText=`${rc(s)} / ${rc(e.playback.totalDuration)}`}var r,o})),e.on(at.playbackPrecision,((r,o)=>{m()&&e._opt.playbackConfig.controlType===X.normal&&(t.$playbackTimeScroll.classList.remove(Ci.oneHour,Ci.halfHour,Ci.fiveMin,Ci.tenMin),t.$playbackTimeScroll.classList.add(Ci[r]),t.rafId&&(window.cancelAnimationFrame(t.rafId),t.rafId=null),t.changePercisitionInterval&&(clearTimeout(t.changePercisitionInterval),t.changePercisitionInterval=null),t.$playbackTimeListOne.innerHTML="",t.$playbackTimeListSecond.innerHTML="",t.changePercisitionInterval=setTimeout((()=>{switch(t.$playbackTimeListOne.innerHTML="",t.$playbackTimeListSecond.innerHTML="",r){case Ei:ec(o,t);break;case Ti:tc(o,t);break;case ki:ic(o,t);break;case Li:sc(o,t)}i(),e._opt.playbackConfig.showPrecisionBtn&&s(r),b()}),16))})),e.on(at.resize,(()=>{g((()=>{A()}))})),e.on(at.playbackTimeScroll,(()=>{b()})),A()}if(e._opt.operateBtns.quality&&e._opt.qualityConfig.length>0){e.on(at.streamQualityChange,(e=>{i(e)}));const i=e=>{t.$qualityText.innerText=e,t.$qualityMenuItems.forEach((t=>{const i=t.dataset.quality;t.classList.remove("jb-pro-quality-menu-item-active"),i===e&&t.classList.add("jb-pro-quality-menu-item-active")}))};(()=>{const i=e._opt.qualityConfig||[];let s="";i.forEach((e=>{s+=`\n
${e}
\n `})),s&&(t.$qualityMenuList.insertAdjacentHTML("beforeend",s),Object.defineProperty(t,"$qualityMenuItems",{value:e.$container.querySelectorAll(".jb-pro-quality-menu-item")}))})(),e.streamQuality&&i(e.streamQuality)}if(e._opt.operateBtns.scale&&e._opt.scaleConfig.length>0){e.on(at.viewResizeChange,(e=>{i(e)}));const i=i=>{const s=e._opt.scaleConfig[i];t.$scaleText.innerText=s,t.$scaleMenuItems.forEach((e=>{const t=e.dataset.scale;e.classList.remove("jb-pro-scale-menu-item-active"),wo(t)===wo(i)&&e.classList.add("jb-pro-scale-menu-item-active")}))};(()=>{const i=e._opt.scaleConfig||[];let s="";i.forEach(((e,t)=>{s+=`\n
${e}
\n `})),s&&(t.$scaleMenuList.insertAdjacentHTML("beforeend",s),Object.defineProperty(t,"$scaleMenuItems",{value:e.$container.querySelectorAll(".jb-pro-scale-menu-item")}))})(),i(e.scaleType)}if(e.isPlayback()&&e._opt.playbackConfig.showRateBtn&&e._opt.playbackConfig.rateConfig.length>0){e.on(at.playbackRateChange,(e=>{i(e)}));const i=i=>{const s=e._opt.playbackConfig.rateConfig.find((e=>wo(e.value)===wo(i)));s&&(t.$speedText.innerText=s.label,t.$speedMenuItems.forEach((e=>{const t=e.dataset.speed;e.classList.remove("jb-pro-speed-menu-item-active"),wo(t)===wo(i)&&e.classList.add("jb-pro-speed-menu-item-active")})))};(()=>{const i=e._opt.playbackConfig.rateConfig;let s="";i.forEach(((e,t)=>{s+=`\n
${e.label}
\n `})),s&&(t.$speedMenuList.insertAdjacentHTML("beforeend",s),Object.defineProperty(t,"$speedMenuItems",{value:e.$container.querySelectorAll(".jb-pro-speed-menu-item")}))})();const s=e.playback?e.playback.playbackRate:1;i(s)}e.on(at.stats,(function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e._opt.showPerformance){ao(t.$performancePanel,"display","block"),t.$performancePanel.innerHTML="";const s=co,r=wa(),o=e.getCpuLevel(),a=Bo(o)&&-1!==o?`${Qs[o]}`:"",n=e.video&&e.video.videoInfo||{},l=e.audio&&e.audio.audioInfo||{},d=e._times||{},h=e.getRenderType(),c=e.getCanvasRenderType(),u=e.getDecodeType(),p=e.getDemuxType(),f=e.getStreamType(),m=e.getAudioEngineType();let g=e.getRecordingDuration(),y=e.getRecordingByteLength();const A=e.isAudioPlaybackRateSpeed(),b=e.videoIframeIntervalTs;g=jo(g),y=To(y);const v=e.isPlayback()?"录播":"直播";let _=i.isDropping;const w=e._opt.useMSE&&e._opt.mseDecodeAudio,S=e.control?e.control.kbpsShow:"0 KB/s",E=e.getVideoPlaybackQuality(),T=e._serverInfo||"",k=`\n
\n 播放器版本 ${s}\n
\n ${T?`\n
\n 服务器信息 ${T}\n
\n `:""}\n ${e._opt.isMulti?`\n
\n UUid ${e._opt.debugUuid}\n
\n `:""}\n ${e.isInMulti()?`\n
\n 窗口下标 ${e._opt.multiIndex}\n
\n `:""}\n ${r?`\n
\n 内存大小限制 ${To(r.jsHeapSizeLimit)}\n
\n
\n 可使用的内存 ${To(r.totalJSHeapSize)}\n
\n
\n 已使用的内存 ${To(r.usedJSHeapSize)}\n
\n `:""}\n ${a?`\n
\n CPU压力情况 ${a}\n
\n `:""}\n\n ${r&&r.usedJSHeapSize>r.totalJSHeapSize?'\n
\n 可能内存泄漏 是}\n
\n ':""}\n\n
\n 播放模式 ${v}\n
\n ${e.isPlayback()?`\n
\n 播放倍率 ${e.playback.rate}倍\n
\n
\n 播放模式 ${e.playback.isUseFpsRender?"固定FPS":"动态FPS"}\n
\n ${e.playback.isUseFpsRender?`\n
\n 固定FPS ${e.video.getStreamFps()}\n
\n `:""}\n `:""}\n
\n 解封装模式 ${F[p]}\n
\n
\n 解码模式 ${u}\n
\n
\n 渲染组件 ${h}\n
\n ${h===H?`\n
\n 渲染引擎 ${c}\n
\n `:""}\n
\n 网络请求组件 ${f}\n
\n
\n 视频格式 ${n.encType||"-"}\n
\n
\n 视频(宽x高) ${n.width||"-"}x${n.height||"-"}\n
\n ${e.isPlayer()?`\n
\n 视频GOP(ms) ${b||"-"}\n
\n `:""}\n
\n 音频格式 ${Tt[l.encType]||"-"}\n
\n
\n 音频引擎 ${m||"-"}\n
\n
\n 音频通道 ${l.channels||"-"}\n
\n
\n 音频采样率 ${l.sampleRate||"-"}\n
\n ${e.isPlayer()?`\n
\n 播放器初始化(ms) ${d.playTimestamp}\n
\n
\n 开始请求地址(ms) ${d.streamTimestamp}\n
\n
\n 请求响应(ms) ${d.streamResponseTimestamp}\n
\n
\n 解封装(ms) ${d.demuxTimestamp}\n
\n
\n 解码(ms) ${d.decodeTimestamp}\n
\n
\n 页面开始渲染(ms) ${d.videoTimestamp}\n
\n
\n 初始化到页面渲染(ms) ${d.allTimestamp}\n
\n ${e.recording?`\n
\n 视频录制时间 ${g}\n
\n
\n 视频录制大小 ${y}\n
\n `:""}\n `:""}\n
\n 音频码率(bit) ${i.abps}\n
\n
\n 视频码率(bit) ${i.vbps}\n
\n
\n 视频帧率(fps) ${i.fps}\n
\n
\n 视频峰值帧率(fps) ${i.maxFps}\n
\n
\n 解码帧率(fps) ${i.dfps}\n
\n
\n 音频缓冲帧 ${i.audioBuffer}\n
\n
\n 音频缓冲时长(ms) ${i.audioBufferDelayTs}\n
\n ${e.isPlayer()?`\n
\n 视频待解码帧 ${i.demuxBuffer}\n
\n `:`\n
\n 缓存时长(ms) ${i.playbackCacheDataDuration}\n
\n
\n 视频待渲染帧 ${i.playbackVideoBuffer}\n
\n
\n 视频待解码帧 ${i.demuxBuffer}\n
\n
\n 音频待解码帧 ${i.audioDemuxBuffer}\n
\n `}\n
\n 待解封装数据(byte) ${i.streamBuffer}\n
\n ${e._opt.useMSE?`\n
\n MSE缓冲时长(ms) ${i.mseDelay}\n
\n
\n MSE待解码帧 ${i.msePendingBuffer}\n
\n
\n MSE缓存时长(s) ${i.mseStore}\n
\n
\n MSE解码时间(ms) ${i.mseTs}\n
\n
\n MSE播放模式 ${i.mseDecodePlaybackRate>1?"加速":"正常"}\n
\n `:""}\n ${e._opt.useWCS?`\n
\n WCS解码间隔(ms) ${i.wcsDecodeDiffTimes}\n
\n `:""}\n ${e.isOldHls()?`
\n HLS缓冲时长(ms) ${i.hlsDelay}\n
\n `:""}\n ${e.isUseHls265()?`
\n HLS缓冲时长(ms) ${i.hlsDelay}\n
\n
\n HLS待解码帧 ${i.hlsDemuxLength}\n
\n
\n HLS待解码视频帧 ${i.hlsDemuxVideoLength}\n
\n
\n HLS待解码音频帧 ${i.hlsDemuxAudioLength}\n
\n `:""}\n ${e.isPlayer()&&E?`\n
\n Video已渲染帧 ${E.renderedVideoFrames}\n
\n
\n Video已丢弃帧 ${E.droppedVideoFrames}\n
\n `:""}\n ${e.isPlayer()?`\n
\n 网络延迟(ms) ${i.netBuf}\n
\n
\n 缓冲时长(ms) ${i.buf}\n
\n
\n 最新缓冲时长(ms) ${i.pushLatestDelay}\n
\n `:""}\n ${e._opt.useMSE||e.isWebrtcH264()||e.isAliyunRtc()?`\n
\n video显示时间(s) ${i.videoCurrentTime}\n
\n
\n video间隔时间(s) ${i.videoCurrentTimeDiff}\n
\n
\n videoBuffer缓存时间(ms) ${i.mseVideoBufferDelayTime}\n
\n `:""}\n
\n 视频显示时间(ms) ${i.currentPts||i.ts}\n
\n ${e._opt.hasAudio&&e.isAudioNotMute()&&ya(w)?`\n
\n 音频显示时间(ms) ${i.audioTs}\n
\n ${e._opt.hasVideo?`\n
\n 音视频同步时间戳(ms) ${i.audioSyncVideo}\n
\n `:""}\n
\n 音频播放模式 ${A?"加速":"正常"}\n
\n `:""}\n
\n 视频解码时间(ms) ${i.dts}\n
\n ${e.isPlayer()?`\n
\n 解码前-解码后延迟(ms) ${i.delayTs}\n
\n
\n 总延迟(网络+解码)(ms) ${i.totalDelayTs}\n
\n `:""}\n ${e.isPlayer()&&i.isStreamTsMoreThanLocal?'
\n 是否超过一倍率推流 是\n
\n ':""}\n ${e.isPlayer()?`\n
\n 是否播放流畅 ${i.videoSmooth}\n
\n `:""}\n ${e.isPlayer()?`\n
\n 是否在丢帧 ${_}\n
\n `:""}\n
\n 网速 ${S}\n
\n
\n 播放时长(s) ${jo(i.pTs)}\n
\n
\n `;t.$performancePanel.insertAdjacentHTML("beforeend",k)}else t.$performancePanel.innerHTML="",ao(t.$performancePanel,"display","none")})),e.on(at.togglePerformancePanel,(e=>{ao(t.$performance,"display",e?"none":"flex"),ao(t.$performanceActive,"display",e?"flex":"none")})),e.on(at.faceDetectActive,(e=>{ao(t.$faceDetect,"display",e?"none":"flex"),ao(t.$faceDetectActive,"display",e?"flex":"none")})),e.on(at.objectDetectActive,(e=>{ao(t.$objectDetect,"display",e?"none":"flex"),ao(t.$objectDetectActive,"display",e?"flex":"none")})),e.on(at.occlusionDetectActive,(e=>{ao(t.$occlusionDetect,"display",e?"none":"flex"),ao(t.$occlusionDetectActive,"display",e?"flex":"none")}))};function uc(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var s=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===i&&s.firstChild?s.insertBefore(r,s.firstChild):s.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}uc('@-webkit-keyframes rotation{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes rotation{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@-webkit-keyframes magentaPulse{0%{background-color:#630030;-webkit-box-shadow:0 0 9px #333}50%{background-color:#a9014b;-webkit-box-shadow:0 0 18px #a9014b}to{background-color:#630030;-webkit-box-shadow:0 0 9px #333}}@keyframes magentaPulse{0%{background-color:#630030;-webkit-box-shadow:0 0 9px #333}50%{background-color:#a9014b;-webkit-box-shadow:0 0 18px #a9014b}to{background-color:#630030;-webkit-box-shadow:0 0 9px #333}}.jb-pro-container video::-webkit-media-controls{display:none!important}.jb-pro-container .jb-pro-icon{cursor:pointer;width:16px;height:16px;display:inline-block}.jb-pro-container .jb-pro-ptz-controls{position:absolute;width:156px;height:156px;visibility:hidden;opacity:0;border-radius:78px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE4BAMAAAA9UfJZAAAAMFBMVEUAAABHcEy0tLRZWVmysrKoqKi1tbWvr6+2traBgYG1tbWWlpa1tbW1tbVUVFS1tbVGCHqkAAAAD3RSTlMzAO9U3LSWySp3aZcVRDUDw823AAAJYUlEQVR42u3d32sbVxYH8EPHxgg/lBsa7SBkukmpSbwLI2KbEPpgZ5MQtwmM0wRMmgdhP6RgEuwlSVnYlmGMYaEvMU1KKX4QNq0pocVmm7CYfRBaQguFpbgPKRSC/4V2LGliO+bulWKrkvVrftyZ+WbxeTRG+nDnnnNmRjP3EpMR6tMH18du/0Xj1tGz5+9cf/DUlPKx5PsTkr8s3eZ1cX7ym1zkuI/f1wTFunNt9fP+FIno7/98/tFY+Y8ffBUlLrmkl2Cr96guTv27BMxP5iLCqUvi68+tpqhJKPNXBH3SjACnfimm/7Wmsl3fI/FP75lh457oPH+1Da3M+1T8481QcT0T7UetevR618LDPdH4hTlyHLGH3LoZEk6d4PlvyVW8pfNeMwzcDwa/kCKXoTzk9tfB455o1mXyEIOa+0PrFvcFt+fIU8QM/k6guOQifzNFHkN5l/flgsOJVHibfMR9l2nhBqem+VXyFZ/xghkMTp3il8lnDPKiGQROhs2lzjEuKcVW1uWk4ybk2Eq63pxk3CK/RZLiJO+Ti/vZXw3ZX1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2DfITJwLFFS/oZQHf7CecQpxq25GqnGO0nnEMcS2iSq13WWmCycKLaHZebDDeYPBz7mb8tz3aff8Rk4tiivJQd5H1MLo5NyNIN8t6cbJw6ZV2WYys6tTnHCZ2MsRM2k8nHSdG5srnBMTXNr/qzfcYLLmyucEyd8FdR7vNeNzZ3OJZc5G967mTKu7wvx4LDMfYFtz2efMYM/o7LL3OLY080byVlULNusqBx7AeDX3B9aJWH3P6aBY8rpUX+W3e2t3SXqeAZVzq0/JyLmRe7wt0fUs849t8Jzv/u8Ngq/+K8d42FhxODp/P8VQc85VPxjzc9folXHFO/1Lh1rc3BjT0S//SeycLGCd6Sxvm51abDp8xf4dyaNL1/gw+caBhLuvj6O6v36mWn5scEPe+H5hMn4uP3hUEAr63e6y+PYX//qflHY+U/fvCVzw/3ixPD98vSbV4X5ye/yfn+aP+4MvDpg+tjZ4+K8bKOnr1z/cFTU8rH/g92biFxn2S73AAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;transition:visibility .3s,opacity .3s;right:43px;bottom:135px}.jb-pro-container .jb-pro-ptz-controls.show-vertical{right:43px}.jb-pro-container .jb-pro-ptz-controls.show-vertical .jb-pro-ptz-btns{left:0;top:156px}.jb-pro-container .jb-pro-ptz-controls.show-level{right:163px}.jb-pro-container .jb-pro-ptz-controls.show-level .jb-pro-ptz-btns{min-height:156px;left:144px;top:0;display:flex;flex-direction:column;justify-content:center}.jb-pro-container .jb-pro-ptz-controls.jb-pro-ptz-controls-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-bg-active{visibility:hidden;opacity:0;width:156px;height:156px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE4CAMAAAD4oR9YAAAAM1BMVEX///////////////////////////9HcEz///////////////////////////////////85yRS0AAAAEXRSTlO5DCgVgZBxAK2fQDRkBR5XTPLKM/gAABnnSURBVHja7F0Jkqs6DGQPO9z/tD8Jq6WWbCCvIjKfzAGmulrW3ooedr6ui+M4TdP++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Mndq3ldEzrAY938ysl9uiQ1cJNVa2SO16X6tZP/dj8uDqJW2VfM/O/ftf7FmPkK3OMZ3MAu8G3T6ytiTTU7OK8jxMlfuN1idg/X91/9VUZ81WOVo8P+Bw+0DogP6NDPAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-up{transform:rotate(-90deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left{transform:rotate(180deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-down{transform:rotate(90deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left-up{transform:rotate(-135deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-right-up{transform:rotate(-45deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left-down{transform:rotate(135deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-right-down{transform:rotate(45deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-control{position:absolute;left:53px;top:53px;width:50px;height:50px;background:#fff;border-radius:50%;transition:left .3s,top .3s}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left{left:33px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-up{top:33px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right{left:73px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-down{top:73px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left-up{top:39px;left:39px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left-down{left:39px;top:67px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right-up{top:39px;left:67px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right-down{top:67px;left:67px}.jb-pro-container .jb-pro-ptz-icon{position:relative}.jb-pro-container .jb-pro-ptz-icon:hover .icon-title-tips{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-btns{display:block;position:absolute;left:0;top:156px;width:156px;box-sizing:border-box;padding:0 30px}.jb-pro-container .jb-pro-ptz-btns .jb-pro-ptz-btn{display:flex;justify-content:space-between}.jb-pro-container .jb-pro-ptz-expand .jb-pro-ptz-expand-icon{display:inline-block;width:28px;height:28px;cursor:pointer;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAANlBMVEVfX19fX19fX19fX19fX19fX19fX19HcExfX19fX19fX1/////Pz8+oqKjCwsKhoaHn5+eWlpaOqTaDAAAAC3RSTlP/3CaKxwJiAELtp4ri/s4AAACuSURBVCjPfZPREoUgCERXBdPRyv7/Z6/Z1aQp9oWJMyYLiKUrOIpAJBdGCldgbzBkPM/QEoTI3jBEPBRDhwEvChe08Q1Ge0ImvIq4Qj8ljrLdH77CyQPWlCdHC0Q1e9rmmuC+oQN9Q4LwcQg40L6eyqm0uEpXSUqe3fKpkkqL+Y/o+07SrahNEO0T0LBsvOitf4xsLqiNTB32wtqaVKosGLO2mhUrS93+PZ4D99wPqzMJVcbEyA8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-expand:hover .jb-pro-ptz-expand-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn////i4uLZ2dnIyMjExMS8vLy+iXNeAAAACnRSTlMAYomLxwEm9+NCLo6DKwAAALNJREFUKM99k9kWgyAMRIMmEMLm/39tKaVKFJkXl3sYJ4sAXeQ3ZOcYd0+gRYblFBuFLYoS2ot5lpvYn8zJQ65TO2GVNmdCmQq/qczw4gjpejD14BgmhziEIvCjVRlPioftHW6A7xBB1a8CCUMvsuSqEkPM7eZX6h8GrQ67bYpNIbRL6rb4/k2EfVXKsgmqfQrW9qnGq96a28jGQG1ky2HXpVysyYyeDIhWq7le6ua9P36HD6+2GRi8iBZBAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-narrow .jb-pro-ptz-narrow-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1/9/f2/v7/y8vLUObqxAAAADXRSTlMA3IrE6SZi9wI+y0gNXAn3CgAAAI5JREFUKM+Fk1kOwyAMBQ04bJHT3P+0JVUMNMWv8zvSk1cipfjAKXHwhR7k6KTjYp7dVuWLug1XWB5wz96T/JD2O3Phmv0k5ypL6lVVFIPYpLOka5WKSSFvS0/BloHYlkza5HkMzrvVLo8ZlRr7mtFYWBBsBQ4BjC//GTxcGVw2PpOVHQ6fJj7qS4936OoN2K4e5yE6N1UAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-narrow:hover .jb-pro-ptz-narrow-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcBAMAAACAI8KnAAAAJ1BMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn+/v7X19ckk9ihAAAACnRSTlMA9+NCAsuKJsRiPv/2GwAAAJlJREFUGNNjYAAC5gxFoTYDBijw1FoFBIumQHjsUavAYGkBmGu0CgqUwRqlYNyFIO2Fq+BAnIGBJQrBXerAwLkKCUxgYELmKjBYIXMXM2Qhc5cxdCFzVzBoIXMXMYAcsRsMdgEdgs4FKT4DBqdAitGMQrMIzRkojlRB9wKaB9G8z+CMGjgshjCuMCjoWNxRAxYt2KGRYgJiAQAnZcjElaB/xwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-aperture-far .jb-pro-ptz-aperture-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAASFBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////9fX1+kpKRzc3ODg4PFxcW1tbXW1tbk5OT29vaVlZVmZmZ8vCMFAAAADHRSTlMAxGJ5Mssm9+NCiYtiH91SAAABAklEQVQoz41T7Q6DIAyEJQooUL55/zddhVazzZjdHyqXXo8DhWCYTWqltNyN+MZLuxP69UGti/vAsl6c0e4L+tQ2yv1AEbvecMhO5cXdYhk+6aO3WGrNAMwentlMz/ZAKIlNoRsqY2wtFWu9t8wasc0iYVN0LkQfrG1zbxNyrIBcntOQrH1Ukkb60QcxYF1xMA2dh8zWj6ZDsLCsIrL4Ds5Hm9FMbCEROWUB0COaLXEIZJKV7CKybGO7UuxjxY2C/TkMbxboKBQCxgMN6MCJQ6Ch/QjOZg/B13LGx8FDTe3IFvl+Bc9XBi3UWoex68qeL/vxmdyxyvz3NJ8f9dDef36HN7koIK2LjxB0AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-aperture-far:hover .jb-pro-ptz-aperture-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAOVBMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn+/v6cnJzr6+u/v7+xsbGlpaXNzc3b29vqh7uRAAAAC3RSTlMAyRjKA59J/3PzPhe1wxwAAAD2SURBVCjPjZPrssMgCIR1mkYtisD7P+zBCyZpM5mzv5hs0M8VnZvaok9BlXzc3FXbO5z0vtifFC5Kn8OL4UfxwVvuHm61d5Z0b6ZGZZwZpQAUosWsjVZntVS1sH3ZFo1IRVYfGXgx+VGwNkkIVbhq9/jm3cAhaNv1Uk3IA8mNn7D3kbQeWK3TLH2jCthrDFcTMwUWaKiClc9mJtJWhS3SF5BpJqMQW1b3xwnkDahMoHYomkeJRgSENA/MFsKML7fgoCBVbGvM+Cx4JcKWbWHKK/h1ZYS1Jy/nK3u8bB3KhzG5deMxtfv3aO7/Heq+9ms8h9fxHP4AHzAWU9zlWNgAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-aperture-near .jb-pro-ptz-aperture-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAQlBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////9fX1+FhYWbm5vz8/Nzc3OwsLDi4uLDw8PW1tZmZmYgm6a+AAAAC3RSTlMAYmOLx4kn9+NCIVJiPGAAAAD+SURBVCjPjVPttoMgDMOJAqOU8uH7v+qKFN2c597lF5LTJg1VqQG3aGuM1bNTV0wWDtjpg3pq+IB+npyzcIE9ejsDXzDCrjccs+tOariF3n2OLyw5xko0vh9MDjNb9Q0hp2GK3cixlIApe4/JD9appR8SFxWAUFLg6n63iB1irnY1Jv0mlrok7nUdcZRa1YeshxBA9iijChlxI6iZEaBgSEL2tkRcymPGGJpqlbZ6uDg0WR/F0DwuMpxDkYwiIXA8hO2uMJdGCCK6teB8RQoY8xGfevQjxYQt25qoRwDT25MRBjZ7GtP/P/afa3LHmrflXa+ruf661Hvv+et3eAF6Fh3v+sSUGgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-aperture-near:hover .jb-pro-ptz-aperture-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEWZmZmZmZmZmZmZmZmZmZmZmZmZmZlHcEyZmZmZmZn///+qqqq9vb3z8/PMzMzo6Oja2tpXGg+mAAAACnRSTlP/JomLxwJiAONCr+rW2wAAAOtJREFUKM99U9sWhCAInEpLBS///7WLEWy7p9O8qEzCMBIOQ15DAlLYsoegS9yFMKQ93skl4Adh+ZI54Q8pG5nxgKzkgkcsk4zhmQxRyN1OPHqtncjOu5AuppcJ6s1EHTA1YzC3Wgq3YmzGqpsmlwZAo7F8oLEVKoeE6+TbSxK0JJ/3FLOwFnUxzXuoltYDDMLoAlmYXLAWIrkqbdZKs+q4KBfkNV1uwGaBim9TdLWS3R7iGRvCNTPB7JvGlc5EXK8cKbrxooint73RzXh7Msl6Oj/uT/b62O9j8sj6gMXX0Xwf6jP3Zr9DtNAHTYMMXrXSK0YAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-focus-far .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAPFBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////92dnbs7OyFhYWjo6Pe3t7Ly8uxsbG8vLyG+Q0EAAAAC3RSTlMAiWJjx9wm/0Lti7mfpe0AAADaSURBVCjPfVMJDoQgDERFC/bg8P9/XUSO6CqTqA0TptNDpSrMpC2A1btRT8wrNKzzjdo03KC3zhkLD9imbeAFhd3sG2kvZQ2v0NknfGBJZKkhBM9MxOxDKBV1N4iHi0TRHYjN01Qi7/kK2PtyNDU7DAEJgDAAN0u1jsQEFEkcVVmrqjeXrkWRmC67eqbgG7bJyvkQSQkvUvec7szpek6t9ubWJSK/uJVSm+APzHKCh++DWWuH4plQKNYOpfappcjy2VvJn9744cjGwx6uyXjBxqs5Xuqsvf/9Dj8rLhRg+bQ5VAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-focus-far:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAOVBMVEWZmZmZmZmZmZmZmZmZmZmZmZmZmZlHcEyZmZmZmZmZmZn///+xsbGoqKjt7e309PTExMTQ0NDe3t774OlGAAAAC3RSTlP/itxixwImAELtp8B2gZgAAADmSURBVCjPjZMLjsUgCEVpq60G8Lf/xQ62gvNeOmZuUiWeKHC1cKnC5iJAdFuwJXgmf+xg2g//G54OPuTOCUOEL8WgMMCLwgPP+Abj2aF38CrnBR7whw6Bo4fWUk7MMrQ2OrpAq0GspTLLgKg1wTailNITZA0EaTkZGjIAY5NwlATah5CGRMJYj50tFtlWiapsLvAPRdtL/WOmET7QzZyl5ywzp7NWsjBJ1odsragJqeJ9HGFNZoLaJw71hMTm0O7NeDE1Z6YsU5rGL69sedmXXz0ToW8PzA/oV09T8OJR32fb7+B17Qe3WwtC9PVbHAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-focus-near .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAARVBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1/////t7e2dnZ3W1tbGxsa3t7eDg4Oqqqri4uKTk5NImu/5AAAADXRSTlMAYieJ3MvE/0Lti4oh87zNagAAAOtJREFUKM+NU1sOwyAMY30FtoWS8Lj/UZe2gWpVh2aJH1wcO0mNqbDj4gDc8rLmiscEDdPji3rP8IX5fXLWwQWuaVu4gbKDuyPdsJMz3GLefcIPbJ6PDCEAFDlUAJiORM3NigQFAXAFlqOeRhWJyFFIHxNGvRrN0mp470U++3axGM2RAmXcXqKnkDSN0a9WIk5Sa01MpDXBQAdVtrA8lBhFnnKpsmoo5VBrhszV0KuJ5N2tP92O50iQjpzcctravoihdoi0Q1NrfN56m0VWzFBoje+OrD/s7pr0F0yUr6s5/LvUu/bz+B2ep+IHdMIV2SUZfCsAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-focus-near:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAQlBMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn////c3Nz09PTp6enR0dHFxcW7u7uwsLAUKT0cAAAADXRSTlMA3IrE6WIm9wI+y0gNQZpqdwAAAOdJREFUKM99U9GShCAMQ8BF3Cmlpfz/r15dAe88l8zwQiQkoRrTEa3zIXhno7lhWxcYWNbtN/fa4Q/218VFDzf4of0O8A/h3TQfOGU/ytsOj9gPVyt8warkmYEQQAgABYDxTKROz88koS6AVIB1fRCNbSI1cVUy15Jq27LGjTtyzipPeWw40/IXQkrHyZSRmqw3LaQgctFNKYzYyGACfEXossLMojFEj7J0WfdwJ3dD9uY2X25tL0Hj45mTR87Y66u9IQFsDS1bL57o7JbUDNIofvpk08eej8kTe3Hz0ZwP9UFfv8OgfgBUByCEUZhYtAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-cruise-play .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJWSURBVHgBtZe/b9pAFMefbSYWMjCjdOtmYEYqXVC3umMlBFRiT7qxkexITcdKSDUSYna2iqX+E/DG6LCQgcETUiR+5Pv8I3Kc+McF5ysZ3x2++9x79/zuLFEG9Xq9s/1+r8my/AnVJq4z/2LZfB0Oh1tFUQxd1+208aQ0GAa7kCTpMgRJk4kJXk+nU5NEoe12W8PM/wrAotIx2Z+w3MkE7XQ6Q3S4otNlY5zPUZdL7wiMBUsRIK/fDeWvhQ92XS0HrQia83cCsqoIyMug8gQ9Ho/DpF7FYpEajQa9VTBoyIZxWeEfv6IndSqVSjQYDKhcLtNqtaLtdkuigmGSZVn/XKiqqr9wqyZ1YEtbrRZVKhX3zvX1ei0Eh7Ufa7Xan8C9VRIUg9lyQZfzO19VOOugkBpAgaXRtnq97oLZ5ZvNJm0YQkBZ8m63E7YyKl5ntrrf77vlJCF/qzLlKLZ4NBqRpmmuF2LBlLOyBFYBchDKlIeWyyWNx+PUtS2Qtx+eJA6i2WzmQtMEA+8KnA+73a6N+jkJil1pGAbN5/PMfRBIZsGn3+LFvSABMYiBgpnJgZEeFHQD4EzQrOsWI4N/nrY2uPg/eeefV8WvAKfALOsWJ3jzA++rcqjhB25OXAd244nA62AjV4LGxWLhIBk/oPiF8pc9mUy+BZVnyQEzueEZUb5yjyvhBiX6BCw2YTGvdZNyAkYPZsprT/rgO/K2vDcdQQH7jes7gPcv/kvqyCcKbEVX6PxVAG76QWPGPZAIDcEZqGECTQyokpe9wp8VfNqzyA2L9M+KRzm19l1i6ZQBAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-cruise-play:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJ5SURBVHgBtZe7buJAFIYPjsVFAok3wBUlYcUDLNvQISUSDVVCA0IUYZ8gmzcgBeIiJLwdFau8QToaQKygovI20CJBARKX/Y/jICPAF3B+yRpjZvzNOWfOzLGLLKrZbAaXy+WdKIq32+1WcrlcQe0vZb1e/8XvQT6ff7fyLpdZh0qlEr+5uXne7XZxMpciCIKMSfzGBBSyCwVMAqxpEXYEhzdeAJYtQ2u12h2aJq4gXadSLpf7aQptNBoPm81GJofEsc5ms9/0zwT9j3K5HHUSyEJ4ovV6vXkSyjHEyvxDXyCAHxGy4hEUq+4JjWQ02O/30xV65rTbQ9lKNEWjEYFAgFKpFMViMbpQnOfFPRSKWxnldrtVaDqdpnA4THalefMDinx8sDOYrY7H45RIJOy6PMibjch3F24AJEmSeo3HY+p2u7RYLEzHwNqogOUcpSvFrk4mk5Zcjry9FZCX1+46qj5dzvEOhUKGfQVyWAyPRCLqojsnEYtohpiSE5rP59TpdEhRFMN+Itw7Q3DpGq1WKxqNRurF90YC75+gnXszulBsVbvdpl6vZwpkwasDNWVw9r3BWlu5Op1OVdBkMrEzTD11RO1exmUJytb0+30aDodkV7DyjT2rBpNrG8zg3WwQW9ZqtS4CatASt/sVhAC/GA3glWk1bqcEo+TPwm0P5QeYySt9jRS9UQe54vF4fqEZkMNCdXivrw4PoJlMZoad5IeDYE7F+0KhcPC+syVotVotIQ5PdLm4CD8CGkJZfAIhzlw3SWRdM+T9q9frLbHnTnUwrfBZfPCiecQG8v3MBHj/HvAm4/P55HMwW1C9tG8a/RmsGH1CnNJ/17UakVMOx7kAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-cruise-pause .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHySURBVHgBxZc7bsJAEIbHdprQJAU1ckln3FM4J4jTIkSMRB9uQDhBlBPECIk2yQ1MSeeIxg0KZQoKKpSCR/4xtsXTNmA7v2ThHe/ut7M7O7sIFEOGYdzO5/OSJEn3KGp4ZDy33ucxP6vVqo86H71ez47qT4iCLZfLJ0EQmhuQKNlo89rtdk06FVqtVjV49kZrr86RicG2TdMcx4LWarUWGjzT5Rqjn7tdsJAi8Ch4C4op1TGl75S8GKwCPOWC6FsRNDKAL5SOZER30HcAhbFFEUFTLBapXC5v2fL5/J7tiOCXofHLlVfikRhRrSqVChUKBXIchyaTiWtrNBruYLjM9jB5jlmup4vFQqMYyuVydKE03vsuVBTFR8pIcFD317REGQlRXBJ5PSl+iktCskgZC57eZA5l/Q/Uy4lTykjYq1++p5EHb1LC9rRdKA7dT8pO64yERG/SmVM8m81OqW7yckr8Ztv2r6Io1whnLawF59fhcLiVY0ejkWsfDAYUJfRfB+snOE85J2KRvym9RGF2Op06vwRbhg9YHgmlIz7E235B2vwC1x1VVdl7jZLT3nVF2q0BsJUg+ODFTDpU0wP3PfC5a2wB+BD7CuqLgws/TQQYn7cyxYfxfdc6ViEUujMAHUlER4cKHfhbATvPjBUG8/UH1xXJDxHoYGQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-cruise-pause:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAH/SURBVHgBxVY7bsJAEJ01CAkJKUhUULmiDSnpoKYINyBuQIgi3AA4QZQKIQq4QaChhhuQCxAXSERUSDSIb944axSS+CPA5kn27o7X+2Z2dz6CXKDT6URXq1UqGAw+Hg6HDB4V4qj8rAsh9N1uN9rv971KpTJ2Wk84kW2322csVv1BYr+gEGMo8Foul7uWc6w+NJvNjKIoHXRVOgMg74K8AXLdFWm73a7BujpdDh3rZH8TCw8JLYlPSFutVh7NG10feigUetA0bcEDxZTiDFU0L+QN1M1mc1z7SBoIBGrkcGkSiQQlk8kTWSQS+SP7D3CzJ76c3A/yi61kodOP6XSaYrEYzWYzWi6XhiybzVI8HjfGLLeDNGxoWpohF8C50CXgwMK+r0gNCuQTENnyitQgRT4BQSOlyFvrKsRdCapC/uPuFqR0G1IZExfkH94NSzkHkk+Ap4wNUiTqPvmH74gUDoe7dOYWr9dr13M5sfNxBnjQ7/dXuVwuDGHG7ieOr9Pp9CTGzudzQz6ZTMgJ2FFtMBh8HvMpx0Ro/UEeBQq2slgsatw/uoxMsBp5A64WG+bgxE9LpVIPpUWDrgv7csUE4nEdlWCNPCC0JJXEF5Wg8MchHs11CWpCVvZVkBfckksyrneHVnMEuQRXitiqPBS4lwpEJYmORkc7Qju0IzPxBZ2t+3mW/JtqAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-fog-open .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAKgSURBVHgBtZe/jtpAEMYH28WJioIa+URDF8MTkAalO6cH4YIiFbk8QXS8QO6oUlCAkGjDtTRHJBoa4nQ0KBZdJApoEAV/Mp9jkAF7bXPcJ5ndtdf725nZWdYxiijDMBKr1SqhKIqKNpdms9mcRxkjFqZTsVjMy7J8x1WdL9WjC6D97Xb73G63m0HjxULAvnI1T+FlMfxBBPeEwoW73Q6we7pcViwWe8+utwKhDFQZ+IOrGr1eAH9ksOkLdSz8Rd5xu1RzBmfdFkvupwz8dmUgBENeYNAZtFQqGVwY9DZSnTVi6+Decrn8h0JYWSgUKJfLHdrL5ZKm0ykNBgOazWbCd9nNt3CzgoZjpUohlEqlKJPJHN3DJHRdp16vR51Ox/ddTiVkw70NlSTp7rRDMpmkWq1G4/HYvmANSpHghXg8To1Gw/M5W1oGVEZD07TvXNy4O8Btw+GQFouFbV06nabRaGRbhbaf8AzvTiYTr8c32Wz2p8KrSuMgJ7x6IEa4AIuivau9tNlsNGm9XqsBY9gxhOvCCi728wa7OCHhRzQAZl2pVGyXRZEoBAoFCDGs1+v2QooiUfpIHE+LBEL+VatVezVfDcp/whYJhAWBVHFvCEFCfz8op6cpORuxJRokajz98tSRae+97OJnUS/RanQLkwNQ4FrzsA2yyU0Gf/br2e12A90LlwYAkS5Pdrm/wRs+/rh1ChAshuV7wTqAQoTAarVat6gorll8YWvzXBXmbdTUcY3/sK/L+4ppmnPeF/9SCGsvAXIsH8+gDthkMFyepyuJgS0GHh3w5NNOzO0zeMHVD/R64BMDP53d93vBORW+0GVnpvmpS0NBXXDDSacwR9K5kxaPok+NUJ8VDlzlQucJvKNj63G2/U3/E78fZqx/rk0w4ggu8jUAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-fog-open:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAK2SURBVHgBtVa9jtpAEB58/EqArqCBBqehorgTVDQxPVJOiD5QAEJUeYLjniBcgRACKeQJQsQDBBoqkIigookraC1BwT+ZcQBBsNd7Ovgk2LV3vd/M7PyZgBPlclnc7XZPFovFv91uRZPJdL9fktfr9W987udyuRbPWSajDUgm3d3dPSOhBMaQUaAXu93eSKVSCryVtFQqPaBWXznJNMlR8zo3aa1W+7zZbIo4vYd3QBCEQjqdfjEkrVarzyhlAa4EvOt6JpNJ6ZJWKpUnHH7A9VHMZrNfLkjJO9Ecv3Aqwg2A1osevFs4vCQP5SF0Op3g9XrPflar1egzut9vCNVHzPS3j8EkcCAcDkMgELh4PxqNoNvtwmw20/tUXC6XSRyLqqZ7LS80CgaDqiY8IEESiQSIoqi7B53qE40qqVYsolTgdrshEokAeh9IkgRGIDPTPhJYC8SD4eg3k52RQNQi7XQ66txms+kepEUcjUah2Wxqrq9Wq6h5Pp8/4CUzD1osFuqPFwfnIsE1IBKbyDqANIzFYhCPx+EtYPmCGQxAppJlGQaDAVwLaFlBgRtAx7T/SNGNZWCg1WqpoeP3+4EX0+kUJpOJNiEqKWA49HGusA6gwPd4PMCLXq+nu4bpsK+6LVV9YMDlcqnkPKD7JyF1oFD+PSSHV9ZB4/EYQqEQGGE4HEK73dZdR+Ua6nh4gWXtD3AkfCL3+XzHZ4pfyrekIQnHApr2A2oqn4YM1TvDWkr3xbozPVAxJ0KaH1MRFllSvQG3gYztz7FtOct/mLqorZDhulD2BVzWJKW2kTZckVjBnviM8IKUQBtQ40ck/w7vAIUhnvGYz+cvwpHZbGNHkcQMwtXGnICs9YrCF/Q2GHb4e3IJBxLgo44ACsY6afbT4XDUWd09N+kpqOhTDT55Jf9/Z0b4C/UJLQCcLGi1AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-fog-close .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIjSURBVHgBtZe9UsJAEMc3l1Q0WvAA2NEp1MyInVbGnoE8AVrSqW+gT2CY4QGwpTEFNcaOEqksKKiYcYYP/xsSJoRwx8f5n7nRu9u73+7lbu8waAc5jnM6m81sIcQlqhcoOZTTsHvAZT6fv5um2XZdd6Caz1DBMNm9YRgPMYhKHhx8brVaHu0LrVQqNjx/2wOWlAtnn9MiT4VWq9VHDHii4zXAPFdJsPGPwK1gIwHk7/dC+sXgAsBjroioFZsmpznCuHKLxeIxqqwirdVqvGmcbaOy2SyVSqW1tuFwGJTRaES7CEGd8TJbXOEo4YkjG8BQ27ZT+7rdLrXbbSUcx4+P3oOIVQ4Wr0Cj0aBMJiO1Q6Q1PvsirFzSkeKVqNfrKjM+8xeCybRMbUcrn88HRSasqs2R5kijisWitB+reiKm0+mhaS5VvMwqCdIs1WYKoJZljUmj+NwqobS8D7Wp1+tJ+5EPvkWYD33SIE4S/X5faoOHgCdC+jsdKc5GnJUUGiNIzwrpbjwh76tOpxMAJ5OJyjTwKp7wP/CnvM06LeFzdPwNd4AFihL+Chom/U86/HmiAr4CGOR4M2r0fX9cKBR+8e816deg2WzeRJW15ABPXvgxRXoVPFfiDWbSAhF7iJiXvUyagMmHmZlmGYK/aXn7HPSNAWui3AH4s9EnG8ibiy94DL6l3W8jL3zvetsMpNCEAw4cKGPCc9r8WeGj/YuBMlikP+yn3EGZYjlWAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-fog-close:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAI5SURBVHgBxZZLjtpAEIbLjUFih8QFnBUrJCIOEHOCROIACStALBhOMMwJMlkgBCyYnCDMCUJWrJCQYB+zBwkJFiBe+QvZyEz86IEezSc1dj/w76pyV5dGEnS73cR6vf4SiUQ+HY9HE0MJu5GmaSNcFrvd7hn3vXK5bIU9TwsTw8Oqh8PhzhGRoIf1tSBxX9F2u12FVfVXiL3ksVgs1khWtNVqfcfljm7HgtW5l1Zrbyh4Fo7FYh8LhcLCGRDu2U6nc69YkDG22+0v98DZ0mazaQgh/tLbUUOMHy9E8eH8treDJ8lkkgzDuBibz+c0m81otVqRBAu4+QO7WecerDSDBB3RbDbrOTcej2kwGFAIvNc5dPVTTLHpv9INpNNpyufzBEsC1yF81dOVf8KslCHIEy4SjUYjIxDLDDoGKYAtDrNW13VT7Pf7azOOJ6lUKnAeySLB7jVIIezmMAS9A/igxIIUwns3VBQ+HpFCLMsKnGcjhX0CKLF2MpnQcrkMXIPzuX+KKax9phthtw6Hw7BlVqVSGel25wntqqy02WxOFnLj+xB6/HNTwmdXTqdTGTHmfKA7lhKSxAOCbPr9g90n82X6AcGfTgVxUTngtKlD+J4UAw/2S6VSzulfJAe8SZ3fiNRiQbTgHvgvI0H4Gxb9IAVwTexVmHmmQbiCD1suHy26En7xaDSa86p/A4ttrpuIT3ohpLcTxw/tAWJ9vzUaSWCLm3DXZzS+z7hELFzYjX/i8fiTu9T04x9LgQk+PbvDKQAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-wiper-open .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAALxSURBVHgBtVYrrBpBFJ0FFAqBqCIrUXRBk5QaUleewBBIlwSDoW1CUlzz0CSlaJJHA8FgqMBg4CWIKkpRuEfQCDAYAvSeYYfsLgss6fYkk5ndmXvP/c1HYjaQTqdjbrf7PQ0VarLWgBW1Cdput3tutVrdW7qka5OZTEZ1uVwfaBhj9jDf7/ePzWazwe4hVFVVPhwOT3cQnRFLkvS20WjMzRMuCzKFyH7/AxkAg18oQp/ME24LsgENfcwBkJfvQqHQejqd/jr905HJGpnMHIYW3iHGp5AS2df/QabpfiKHfCdCVCN1qh1hv9/PIpEIi0ajLBgMskAgcDZfKBTMYjJVL8+nh7MeS/8ioFiQbDYbtlgseA/lXq+Xt9lsxrrdLkulUmw8Hp/poLB+JC+rkpa7FysiKEokEpyo3+/zBiIrr2EU1kKmWCxariMvsy46IRJWZFBSLpf5GApgvZUSYLlcstFoxMfwHnKQN4Mi+cYdDoe/IGpmslKpxJV0Oh223W7ZLcTjcb6uVqtxLxFayJtkfSga2Sycy+X4YnhlBzAQhGI9euTRqnhAaNjkKA5Unl0yALlD0SC0Au12m/fIvx5nRxsEYV2lUrHMgxmiYMwGwmiE1qzDrSiKSv0r8QMxF2Wdz+fZer3mhXAJCP9gMOCGAiBJJpM8h6jqXq9nWO+hLfGH9ohiVoTFIEbxwFqECMoQInwLy4V3mEMe0SB7YWtMJJzoVK7fLnkgKg65BVBM8Bj5gjHwDORoGNfrdUMu9SDnfl7d+HqAEArFCYNQYoxtAODfJSIBimTWpV2Swxt8PLwiRAgjGrwXuEVGmBNXw6MxP5KXMWYTCKs4U+2COH6g59tCu6uG7A7AYxteCcypVU+EmgVZbcJxkO4HcmplIEQuMcGOTz8nyT6T7on4Npw0mMBzgDnkqUZWNfyzWujQM/FB79lVQh2xeudbZ0VE36mvipzdRagjjtFtnSBlr9nxuS9uGCidk1HPdFp1xcvsGv4CcbeEIeSIw9MAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-wiper-open:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAM0SURBVHgBtVa/SyNREJ7dBLVQELU4bdwrtFJOUCxsXEG0Ue4OK6tLKhEb/QsO/4LzChVtvGvE0sPOxtiYJuFyJBBICtOlSSAQCEnIj5tvyC676ybZYPLB4y373ptv5puZt6uQB1xeXup+v/9zs9lc4qHxK621VFAUJYbRaDSeDw4O7rvZUroQBXw+3zcm0ckbMkx8enh4+It6IWQijYlueiByI95g4oxzQXW+OD8/X1JV9e87yACNbbxeXV0dOxcUJxnn6okfx6l/OOHcnr0hhIzsFcg06jNa8obwbErKOfs+CDIhUdUbxrhJiGrknAW8HB4bGyNN02h+fp6mp6dpcnLStj46OkpbW1vOY1q5XJZ8iqTX19dPnYpkZmZGSObm5qharVI+n5cZ5ENDQzKy2SxFIhFaW1ujTCZDqVTKaabA+z4qrdy9uhHB0PLyskSTSCRkVCoV16gRLfYODw/T7e2tOOQE5zKocmRf3Mggzd7eHvEtQnd3dxSNRl3JgGKxaEaE6HEO553gOllXuQ3W3ch2d3fFyMvLS1siKxYXF0XWh4cHOYfzUMgKpE1t3Y026LouhxCVF8DBhYUFcz9m5HF7e9u5VUOV2pp8dnaWpqamPJMBKysrEh2kNRAOh2VG/q14c7XhILzb3993zYMT2IOCcTo4MTEhkqKgrPCx1gGePxgv6vW6EKJYNjc3qVQqSSG0A+RPJpPiKACS1dVVaQ9UdSwWs+33c6n+47ZYchqKx+NCvLOzI80NiWAMEkFyeM75lx5FdFhD4SCXIEJluxRbTLm4uDjmcv3RLgIYgrfILZBOpymXy0m+UImIDLLCATyHQiFbLq1gB/90bHwrcNPAILwGAaREcz8+Pso6CNsRGZDGx0eS8xXqRgh5DYkgIwZuFQPdyGACfwJ+PHGhnHKUOnkEetS4U72Co/uNWdoC3yovUVqBiD1EZW4fGRk5MwkBjjKIBRoAarXa12AwWLARIpdY4McC9RcnR0dHZjPabhosMOkG9S9S2/8MMLDfRKhljawjoYU4wNXby79OgavxJwrEyFlPhBZinasYH+pPPOMaNL4wMJphJZ553Bt/Zp3wHwTYnvHjbDCuAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-wiper-close .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANOSURBVHgBtVc9TCJBFB52r7jYyCXWnhcbO1aru8RErjGXWBxX2BijGG1svNhJo56VhQU2ViQsgdDQYEFDc5rQ0BDoaMgRGhoKaMhdCHDve+6QZVhgMfglm9mdn/e9v3kz6xEusL+/79c0bcvj8fjpc8V6gCY9VXqK3W73MZFIpN3I80wj03X9il79wh2q/X7fJAXvTdNszkQaDAZXaHF0BrIRcvLKERE/OQ3qYwh/06shXg8vRPl8PlEqlZ4nktoIV8QcgBxwItbfitBOvL6+XioWi2XZp8kXIryaN6FNdpSM8spvthRWUmPaJ25vb4vV1VVRqVSGBCwtLYm1tTUeW1hY4KfVak2hFe+J+B+5+QkfnL2Hh4fI1KAq/OLiQlxeXorl5WWxsbEhNjc3RbvdFrVajVvMkcTlclmk02nRaDTGETfJ1Z+wlTxWLP84zQoEAkwEodlslh+QqZDWY36hUGByp3m9Xu88Ho+HNaokfidCCAIh2kgkMlYQAOtyuZy4vb1lBW9ubnidCioa37klkw0nQrgWgpLJJMfXDUAOBbEO66GAAkOS+tSRk5MTXgjr4FIAMXULrIObz87O1CHv8fHxR03thXAkDhbahezt7TlpzkA8sc7uUngIQIhUgNRr70AWQsu7u7uBEPTBdaqboQTcCIUgXL4DUBzjTrHVDcP4BmVlR6fTYVLg9PSU9yC2CIghEG7HHIC2GluJOGYyGR6DYiDCGEKD/iErNS2sU238QnH9rGqDopDP5zm+EIJ3aL6zs8NEUAKCQSiVwxp4BFaHQqGRwkJoRqPRkEZ7tCjGAAJQHED28PDAVkirsX1kUcAc7FEXWc5c7+iQTltnpyMgHNYgUSSZBL5BhqTBHkVMAZnxKsijMbQ6Vf+/FFe/mFLs6/X6IJZ20t3dXXb34uIihwFuTqVSI3Mt0nPia3LtpVLot461V0FWLiiBZwzMWCx2xOSy5+DgIEya/BRvA1xfvlKxr+JjUBwola/Fy81u7iDCX5JwiJSPHNJm3sQWoTnUp06a57XFIrxW+0dug8guutM8EvEHpxPIJRDDH6qFA2UmrSSrg0SO5HJLjhDdUxue+bLtQG7QqR8ggVvC4beCFHumRMSxVJxEJvEfnFm91YrgD/sAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-wiper-close:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANwSURBVHgBtZa/SyNBFMffboJaKAS10SZ7hXqFegGbCyjmUPTAH3eHlZWmULG6u/Kqi/9BLEQRIdoKigf2l1Q2ChGtBLmtFAQloPgL1HvfRyZuJhuzBvOFzezOj/eZee/NZAzyoMX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mCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-arrow{cursor:pointer;position:absolute;width:0;height:0}.jb-pro-container .jb-pro-ptz-arrow-up{left:71px;top:15px;border:7px solid transparent;border-bottom:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right{top:71px;right:15px;border:7px solid transparent;border-left:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left{left:15px;top:71px;border:7px solid transparent;border-right:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-down{left:71px;bottom:15px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left-up{transform:rotate(45deg);left:32px;top:33px;border:7px solid transparent;border-right:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right-up{transform:rotate(-45deg);right:32px;top:33px;border:7px solid transparent;border-left:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left-down{transform:rotate(45deg);left:32px;bottom:33px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right-down{transform:rotate(-45deg);right:32px;bottom:33px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-loading-bg{display:none}.jb-pro-container .jb-pro-loading-bg,.jb-pro-container .jb-pro-poster{position:absolute;z-index:10;left:0;top:0;right:0;bottom:0;height:100%;width:100%;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jb-pro-container .jb-pro-play-big{position:absolute;display:none;height:100%;width:100%;z-index:1;background:rgba(0,0,0,.4)}.jb-pro-container .jb-pro-play-big:after{cursor:pointer;content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;width:48px;height:48px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzMzMzMzMzNzc3MzMzPz8/Nzc3MzMzMzMzMzMzMzMzLVn6fAAAACnRSTlMA+duduRUwSGSD8toSsAAAAI9JREFUOMvV07ENgzAQhWG3lLSp6MwCViYIRSpG8AiM4FWMaPymDBKESMF/cQ0S136F353vnLuo3gp1kOYEoCXW4LFKIZAnqAXYICeASoAdzgG+cApwgF4EfwF+oDkCqIwA6gnyAKA8AaizQhsBAjzuqUHofInGIQbjRxXjMrTJuHDestR4Bng4eGrN0929PqNfzC6h06weAAAAAElFTkSuQmCC");background-repeat:no-repeat;background-position:50%}.jb-pro-container .jb-pro-play-big:hover:after{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEz///////////////////////////////////////////8Uel1nAAAAC3RSTlMA+rbVFUecgC7rYhEEz+4AAACbSURBVDjL1dMhDsJAEIXhdeiGpKYWQVKDWc8ReojFc4ReAlPFFQazad7lIGkb0jK/WEPSsZ+YN5mZEP5UrZIP0vgE0Kv3oPlIJlAk8AJM4ASYwAkww2+ABfQg0ImgugPYsfNBVl99kA0AsjOArAPQpRTGHiBB8whxM0y+3skXNltsvMYriIWrpWPA80mFJ5qL3gAfB1/tcAt7rzdiV+HEgs1oBgAAAABJRU5ErkJggg==")}.jb-pro-container .jb-pro-recording{display:none;position:absolute;box-sizing:border-box;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:101px;height:20px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jb-pro-container .jb-pro-recording .jb-pro-recording-red-point{width:8px;height:8px;background:#ff1f1f;border-radius:50%;-webkit-animation:magentaPulse 1s linear infinite;animation:magentaPulse 1s linear infinite}.jb-pro-container .jb-pro-recording .jb-pro-recording-time{font-size:14px;font-weight:500;color:#ddd}.jb-pro-container .jb-pro-recording .jb-pro-recording-stop{height:100%}.jb-pro-container .jb-pro-recording .jb-pro-icon-recordStop{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-zoom-controls{display:none;position:absolute;box-sizing:border-box;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:156px;height:30px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jb-pro-container .jb-pro-zoom-controls .jb-pro-icon{vertical-align:top}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-narrow{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-tips{font-size:14px;font-weight:500;color:#ddd}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-expand,.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-stop2{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-loading{display:none;flex-direction:column;justify-content:center;align-items:center;position:absolute;z-index:20;left:0;top:0;right:0;bottom:0;width:100%;height:100%;pointer-events:none}.jb-pro-container .jb-pro-loading-text{line-height:20px;font-size:13px;color:#fff;margin-top:10px}.jb-pro-container .jb-pro-controls{background-color:#161616;box-sizing:border-box;display:flex;flex-direction:column;justify-content:flex-end;position:absolute;z-index:40;left:0;right:0;bottom:0;height:38px;width:100%;padding-left:13px;padding-right:13px;font-size:14px;color:#fff;opacity:0;visibility:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none}.jb-pro-container .jb-pro-controls .jb-pro-controls-item{position:relative;display:flex;justify-content:center;padding:0 8px}.jb-pro-container .jb-pro-controls .jb-pro-controls-item:hover .icon-title-tips{visibility:visible;opacity:1}.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-face,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-face-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-fullscreen,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-fullscreen-exit,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-icon-audio,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-microphone-close,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-object,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-object-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-occlusion,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-occlusion-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-pause,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-performance,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-performance-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-play,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-ptz,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-ptz-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-quality-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-record,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-record-stop,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-scale-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-screenshot,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-speed-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-template-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-volume,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-zoom,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-zoom-stop{display:none}.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-speed{padding:0}.jb-pro-container .jb-pro-controls .jb-pro-controls-item-html{position:relative;display:none;justify-content:center}.jb-pro-container .jb-pro-controls .jb-pro-playback-control-time{position:relative;justify-content:center;padding:0 8px}.jb-pro-container .jb-pro-controls .jb-pro-icon-audio,.jb-pro-container .jb-pro-controls .jb-pro-icon-mute{z-index:1}.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom{display:flex;justify-content:space-between;height:100%}.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-left,.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-right{display:flex;align-items:center}.jb-pro-container.jb-pro-controls-show .jb-pro-controls{opacity:1;visibility:visible}.jb-pro-container.jb-pro-controls-show-auto-hide .jb-pro-controls{opacity:.8;visibility:visible;display:none}.jb-pro-container.jb-pro-hide-cursor *{cursor:none!important}.jb-pro-container .jb-pro-icon-loading{width:50px;height:50px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8BAMAAADI0sRBAAAAIVBMVEVHcEx4eHh4eHh4eHh4eHh3d3d4eHh4eHh4eHh4eHh4eHiqaCaRAAAACnRSTlMAikwX3CxpwZ7zIGi5xgAAAZ9JREFUOMt9lb9Lw0AUx2Njqm4iGEqmEnBxslKUdhJctFMVcW5wKZ0CLpJJQRw6iVqQbg3FtPdX+l5+XHJ3796bQj557773fe8ujtOI+6jz5p84dHjTkYD4+RhT9CIRZWRPJr1bChnbY532GhT4oUpbI6HEuqvgIH9544dh9J4/rpr0Ms8oV3zMNT7X1MXSmaznzfHjM4n72moe5n8ryYrW9rKRvgf0S93JA7yKa9lbzUg3keJb8OVCtwkrFmoO4MnsAuj5rGqnZg+GZXUXkl9NjEui9n3YA9XgpMgakLXz6ujMTIgrCkPVv0Jil8KgKQN/wRN69hLcb1vrbR2nQkxwiZTGQ5Teb7TO8PUaS8Q03sE+zkjP8qbjzgJtEhRbV4gnlkOFeM7hDYNdxPbiYFvKSHN6L2NmY5WzMYPtplZdTxncRvn2sI+DHIoug22jWMaA12Y7BrXzrG8BX32XPMDKWVzw1bdMOnH1KNqNi8toqn7JGumZnStXLi0e4tcP6R3I635Nc/mzsMxl9aux9b78UVmn2pve8u6eR50j9c0/ywzyVl5+z84AAAAASUVORK5CYII=");background-position:50%;background-repeat:no-repeat;background-size:100% 100%;-webkit-animation-name:rotation;animation-name:rotation;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-timing-function:linear;animation-timing-function:linear;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.jb-pro-container .jb-pro-icon-screenshot{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEzMzMzMzMzMzMzMzMzNzc3MzMzMzMzNzc3Nzc3MzMzMzMwv5ahDAAAAC3RSTlMAW+8S2UGVwyyZnOTRhEMAAAEfSURBVDjLzZKxbsJADIYdBQpsSCyVMlXAdEuQYGKpWFk6dWHJgsQ7sMDSpUv3PgITAQT0f7ly57ucQ45KXRAZot+/89k+X4ju9KzL4XOhlm3pR0enYrWViSRPXQIQSASkRSkIJEFRimYCuQAHSW89IOv6SH5TCsuAj68Ab1wDzqkAzqoC7AUAPtgsABgkBBgkCJiNHehGok//KRVsHqd+3Dj1/vukt3AH/Jj05s5/AmyZhFVWXDls44iVvfQWkCvgxU6g9ZdJfCLvjJbYaT3GvjOY4mQSG3SJGjhr/Y1Xohp+TGKqqzexZ/1GVGdNCitt6R8zVvb9d+JmKdl8o5sPWbtxT6zFuJcDQtk92MNmYiXHquYlZlVt1j4P6cd7fgHFW7Nhqu29TwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-screenshot:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEVHcEz////////////////////////////////////////////////////////NXt0CAAAADnRSTlMAWe+X2TINXUYZvctoYyuS2NgAAAEVSURBVDjLzZKhDsJADIZLCAsEg8WgEGCWGSwCgZxB4MgEAonB8wQEXoBH4BEWXgPJgEBG0mdgR3u77raRYAgnlq+9+/t3TQF+dKbZcJXSYSnzlViT457lRScKmBqILSFA3GoO8S4E+Ex5JiSJ4CbVdyOQdZNomX9D4dl+ko3NC8vFFmhPy8FIsi0ZlwLBW/LY5BxYYreUSgoFAEmhB5Rc9OCbUoXmTmDadQKTn4y6A/XTaoSKdb6KyGU6RJ7eHgpb3ABinAoil303xB6vQnRahNhXvMdre+fzOgxVrokX4jHAnBh8PALU8Eq8BqgTg/vePF8tpuPy9/NFaalSc273RizarYqfkswjifNMQ/TyTGMv4v87L+ks5gqDbc9OAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-play{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzMzMzMzMzNzc3MzMzPz8/Nzc3MzMzMzMzMzMzMzMzLVn6fAAAACnRSTlMA+duduRUwSGSD8toSsAAAAI9JREFUOMvV07ENgzAQhWG3lLSp6MwCViYIRSpG8AiM4FWMaPymDBKESMF/cQ0S136F353vnLuo3gp1kOYEoCXW4LFKIZAnqAXYICeASoAdzgG+cApwgF4EfwF+oDkCqIwA6gnyAKA8AaizQhsBAjzuqUHofInGIQbjRxXjMrTJuHDestR4Bng4eGrN0929PqNfzC6h06weAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-play:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEz///////////////////////////////////////////8Uel1nAAAAC3RSTlMA+rbVFUecgC7rYhEEz+4AAACbSURBVDjL1dMhDsJAEIXhdeiGpKYWQVKDWc8ReojFc4ReAlPFFQazad7lIGkb0jK/WEPSsZ+YN5mZEP5UrZIP0vgE0Kv3oPlIJlAk8AJM4ASYwAkww2+ABfQg0ImgugPYsfNBVl99kA0AsjOArAPQpRTGHiBB8whxM0y+3skXNltsvMYriIWrpWPA80mFJ5qL3gAfB1/tcAt7rzdiV+HEgs1oBgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-pause{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEVHcEzMzMzHx8fMzMzMzMzOzs7MzMz4IlKVAAAABnRSTlMA6xIU1hVqIuOVAAAAMUlEQVQ4y2NgGFYgLS3RAEQziQFZoxKjEqMSaBJpEAkgIw1ZQlBQRAEs4QhkDeIMDgAWx1gMHyIL4wAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-pause:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEVHcEz///////////////////////+3ygHaAAAABnRSTlMA7OgSFBXMmAA4AAAAM0lEQVQ4y2NgGFYgLS3JAUQzi6WlJY5KjEqMSqBJpEEkgIw0ZAklJSUDsISikpLQIM7gAJjhWp6XcaOxAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-record{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAHlBMVEVHcEzGxsbMzMzMzMzLy8vMzMzMzMzNzc3MzMzMzMxEZ/aQAAAACXRSTlMADPKKKeBxlV6neZ4mAAAArUlEQVQ4y2NgGDZgJhpowCURAJeYpIQENJEkCgWRgCeShAGyjfgl2EqwS7BFToZJiLg4ICTEImdOh0pwRM6cDJcIjpw5E6aDFeh8B5gECBCUYAkKCoMbNXNSOlyCgUEQ4apJJmxIEkjOVWFgxi4RgEsikGQJnEYp4pLA6VxUDyJLIAUJcRLIwY7qXKSIQvOHWCQODzKIleBPPjgTHM4kijNR48oGkajiYUMykwMAAfmZhUjBISQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-record:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMA8gyMLeRw1x2DBpWGN2QDAAAAt0lEQVQ4y2NgGDbgDBpIwCVRAJc4KIgEZM4EwCU2KSEBHySJCcg29iBJGCBLgHUs24FdYlnNYZiESksDXKJALebMaagES8yZw3CJypgzZ2A6WIHOd4BJgABMgh2XBEtpaBjcqDMHs+ESDFyLEK46aMGGkEB2rgQDJ3aJAFwSUSRL4DQKp+VHcTkXxYMoEkhBQpwEcrCjSCBHFJo/1GIO408MOJMPzgSHM4niTNS4skENqnjYkMzkAEgzyFpeX6L3AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-recordStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAOVBMVEVHcEz///////////////////////////////////////////////////////////////////////99PJZNAAAAEnRSTlMAMPndsnZj1CSYPcmL6wsdoU80pOJLAAABu0lEQVRIx5VV26KEIAhMA++p9f8fezatFDPr8LSrjMxwiWlqzRuMYKW0ENH46c3WuGyVLXEduuO83UyK59fl1jX5EEUXD9DOaSh43XEP5zUIdZ4pAecTofVnWSt3ip4rx7N61vjnY1D30CpH4QQR8vsP+RA5Rs3KpjfMU/pMim/LgbvH7DF2F8sU0owqapKLqgnhuGWwImUagn2zhUX6WQQoYkXG9WxSAJd700/ygsCpAoliaDsPiG48GM1X5Ft/06sfp8DrDE+3DpekWjxM6366fgEcnklC+AIIWYQmPEeAaUmjFOnhCLDfxZRH+w1gU5b/DYjfNcyJ0p7dxX8B+FwxQVtvAGB5ig0d5gFA5KbzS91hI8CenvlHflfN/XvzJQnxbBEko1gbvVnPii+FadSVRUEaYylQfJtpLB+aRG4LY/80yKdUbCraM0lozGR4ewZ0Wtnj1iC7hjWKNnjYmR62W15cLlL3+2pyMR09jccyuyUrHKsvthc5xsY1iWJ0Xk3t+2XP7AnWwrAQmBH6asXubmL1Z5Lz6o992jWiu9lnMSiQsK27FS9NxhCumZgB2fTBPFsFolhZr5B/D3o9sJAI6skAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-recordStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEVHcEwimP0imPwimP8imPwimP0imPsimP0imfsimPwimP0imPwimf8imPwimPwimPxLmg1rAAAAD3RSTlMA15sisGUvdz3szYwMT8H+hDJEAAABx0lEQVQ4y3WUO08CQRCADxBQchBiMDE24KswFlw0Wtig/oHzUWglJBZWio3GDjUxlhhrEzT+ABMrO2iptLLVRluDggI+xtmdXW73LkxxNzvfzuzszNwZhhDzdOxqaPGgYrgkOgFczh90ezAJQmpL2v6OHYnqk2aWxOTtAnu/O/Y5XNZXmTZjo3ot7aESwLdFeqAM0MoJkMf9ltwVQJ9PcQN0UFIJogvdJgLQVFMsAlxyBaPmVBDCE8W7qd+2SDsx0q4OwhSrCG134W54jDfKLjDNxaL8/9AAMM/solptRnoALBbwEPWYrOEzLnrZsTGoMW+fBHG2SiLPUNI6KMOH8QS/XsCMBYQekIEv7NGZF/Rht2yqmA4i3UG9O0iTqgMfhirDhRdU8XJZqqEO8tDAqje8IIt1r+I5HmBjfD9AxQ1MgJQRpc6GJRALHOAS1WRlhMs4VaSFzwIWzCUF3op71kdNsNs/FDCuA58YqCQl7IhN3WbDnlLtfjnuON515WM17c7w41QPOuBIzDT5wqi0T4ESGV3gjtTjkuPATwHoX9+cPRlmmvJ57YAir2qKy459QL/UhrS/uAu3xf8KiX3DI+b22t6jc9F/qfaum9E1pJ4AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreen{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEVHcEzMzMzOzs7Pz8/MzMzMzMzNzc3MzMzMzMzMzMzMzMzMzMzNzc3MzMzMzMxdHBitAAAADnRSTlMA8AwGYt0aUcg+til5kgmZywUAAAGWSURBVDjL1VM9SwNBEB12IcGkMagxNktQSZFCYimIJAqKpZ3Vco3YBYs0NkKQgBg4ECtLFSFVCGgQrERBsLayPE0Ip7n5De73BdKLTrE3ezPvze6+GYDfsAQKy/Rz0i/OZJjY9XREuohTKulS+ZFGiADfyZXU5uHktI44VH5apDx554aXwJqloiIwiEsStAjCAsRNF1jCmGqa4Vc+BvS4JkjwzyPE6xiwzsxxeTbZxqjkANSWZFkoIj5bQBl4aBDfkPDNpeRRialB+SRAFz8UU1sAaEUjSCDoJ7iukZJ1V+c01bFczM1pWaa+a0Rp7MHn4V8Z1R9vLLCv9WjKdVFfk77JP+bZdz35YAfKXx6KhKp93abUYVbrj49g9aAYSuFCLbPUwzdCsYEWTloXgw1oGwQbENeuKwxzXhxwAADRMFd+zzRc6AAASY6RH8VjUHaXTrlOpDgCUP3gelc01e2d+f16cWbnQ46BGCRNVsWAWQJVw2xGfUXVv2k1OsLfazXqblzS99u1FwKFvBJioXBY2+r82U75Ab7O0ypVV0wKAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreen:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcEz///////////////////////////////////////////////////////////////////+GUsxbAAAAEXRSTlMA3clDHfdfDQbsVG00u4Cqkr04dRsAAAGaSURBVEjH7VXLdsQgCPUBAROdjP//s1UTDUxsz3TRTc+wC94bHsLVmP9hkE8LIdvgupt2tFhcpy2CMZyVxNePEoqDp4hwEGz5PTqWoZNzLrmD9riltBEYzzpZQ8bweXy56Qy6Tivsp5JQYtawuMH3eJlSxIJtdSSa4xer4lMB89pK23mKrwjZVpsRzLq35vEE3+r26h6w5EKppcp3fP2lIpTPWJvoXoobeNI1sM3haHvx56tu2sdElJ54GbnPQ7RZ1sCpl8qPEMXBNQ8vN82jNbzLCPzGSDOZj/2Bqd19R1rELIEbDFrUJfKYdlALbDuDMko/hz7t8DqtCfr8h1Vt4rn7eh/6Ph37ch20aW8McsfGCOXzcr+GOlQG1rJ2HSHUDO/4Mu01qVAqTCpCJfgZ3phTS2pKm5aZOMUbs7Q6nk6L8UzRh6W78jH+gD/VRxHokPuNgUGTaPPR+zDR1mrlvcGgwkAVacSbeoN4Z0rb5/6XLrW/2GTLk2NhXHRKzrqAt9cD4rr4ddvae0NAYgOICdZyvPj4UYRf2BdfbB8iWvnTUwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreenExit{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAG1BMVEVHcEzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxi4XDRAAAACHRSTlMAf3WqJmy+7azWNnMAAADNSURBVDjLxZQ9E4IwDIaLfMzCOTDSOz07OjLir5CR0dmJFVHIzzZtnMzbOzcyZHnuaXpJWmO2ji4GhpAzzZeQzw8FKCj1pMHss9OgpwsGOS0YGOcVUMPsfBVkmJoVCBJW0FFB6SFIaMKAlRGDnEiDkuM00lP3SmL6H5QSh+iIr9ZWVWntUV9Z4qWbHAWrhcUYNLC4Wwm3xb1r2mOQYoVn2EKFAVb81KHiQQq6L3vSUoMBUmSzgCKbVeiL3eTp3Odf8H1sxRAZZNZt/Vt8AHcPQbiQQVF+AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreenExit:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMAe4Fzh7MZbKPtN8gpX19xAAAA3klEQVQ4y8XUIQ7CQBAF0CWhKQHDGtQKQFcURUgqEARBED0Aoqp3IKnoATAEW8MNOACmhQYKcyi6uyjmr+aLqXj56bSbVoh/J3HBxcw0ZfA2c3FiQLGeQcWh1lOVDDJTAeCbCgAR6QqCDj0xCEU5Bl2BIALKMwhdKjGILRUYfCIOEynlvABANk64M5jabJxHfJY2I76yzYu/ZCc0s1WbNYAQ3jxqwMoGHoqWGHpUQajEgcYYcKWFtjLE4FGJQewoxODRDQOqKPPcHl9sfzSXa/0L349tEDsOsp/8+2/xAY+BZBY9KhM5AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-audio{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzKysrMzMzMzMzMzMzMzMzMzMzMzMzMzMzNzc3MzMz8gU00AAAACnRSTlMAL0jMZKt96hGJsSKv1QAAAJ9JREFUOMvN078KQFAYBfCbJEw2q6SUyWxTnsJT2JTJ6D38Gb6n5PpT6BwbuaNfTnz3fEp9fZwAP7czD0MsGCzBYJcEYsGwBEHQQRB0EII1CMAWdAOzyJUvJ4jyDVyZVHKGpj9guEI2IuhaDFadYnCkIm9I+kPgn8t+kI7kOsT72HcwQnJR9Gofy8DrwwtHK8pLzdeALg5fNb6cdJ1fOjOGYrl5CLFcggAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-audio:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMAL0TQf2frEaZYt8E+idL4AAAAnUlEQVQ4y2NgoDdgUcAuzr4Hh4TaGQHsBp3BLsG+BoeE2hnsEkCDsEqADMIqATIImwTYICwSEIPQJFhnBjKInUGSUA2CSPCcOcIwB1ki5xRM4iiDDrKEzQlsEuUF2CVY0jbgkDhjMLQkEkj0IM4gQQ1EHMHOOXMiakRpTiQQtXgTA+7kgzvB4UyiuBM17myAM+Pgzmq4MyfO7EwjAAAEf+BAxqI/agAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-mute{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEVHcEzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMztXryaAAAAD3RSTlMAHd4P7ztyiy1OnKhdx7uY2gyAAAAB8ElEQVQ4y72Uu0vDQBzHE45C3SJFaSGjUEiRpJRCBifXokkpSv0DfOBrEKxUUSoFH9ClFAUfU7c4OARRCs5WjThIsJuDlLo4ldvPe8SYxGyCt1zgw+dev+8vHPcvYybvfCR2OgUv2CoLdI62bUn3gq5UJxOomZofXPUNrIChJRklfcDSiKK2bYQ6PiCaREk0EQoYPFYa3F73F+DGsBJLmAjBAMBKakG15KAxqIhd2KuK5reRccBDNbqGJhfSlnNc/kBh4OY+vaoR5QrRC0afKgxMrKdXNKI8yxRENpyd+i0VA6wMm5IOBmORCwfAFjGwolofevbuPrvpGhRgpVaqiJflrLuUQQFRToS9l894EMDe7q6yL7/G5wMATc5mQCiAvQo3HAbwLtyYHQZgTxhohgGUa/CP12EA16W2/Ou4ZEj1dNG9oPMkZGiwJWQ8j+huPoJy9Z/XHTfUFSbAURveCtE5px5vs7hQDKS25FSDn2KR5Up1/lRmIHne7BvKd82LMRJbSjr5M40lmaYZ5/PRpiCpizjJyk+CwOGOzACLpSdz02QxkiuRhd8dNOwkV7zl2YX1mcySKJrQiPkXY9klSt6rkJPRwIlmzrcWSGyzHuTb11V/N0y/S6SdwdCR4m/47OIN7XOQCfwJwHGp8IcfyRdBLEZK4Uxp6wAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-mute:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAP1BMVEVHcEz///////////////////////////////////////////////////////////////////////////////9KjZoYAAAAFHRSTlMAbk2o8o0P5TsGnVojFi/XHcV9urLaq0oAAAIQSURBVEjH3ZZZkqswDEXxLM8T+1/rkw0BuwM0f131+IvDyZVk6SrL8p88QCHp8UAnWmoWoG8AwQRN4/vOiqwUuwWqiob646MMhEW+KnMLMIXffgiZoODBusb7kCzjByF7OOszkOyp4amJ7fWVPwCN6BpyWRypvANPCvi7u4aTXe13YI+KkYA5bMRTSMlLnSyGwisSH40B0FJOrKVB6iAw2U7sGgPgQ/DTPQjitCOZT4Q6gWCtGwGFbSM34ENUNSpAKTACmC31rnRgJwjDdkFAJpfkAsZcAJvCSVQB2FaWWKdB/ATMAHwIUYL21lRBZRDiC5AnsBHBUqxEyaraFMoz0AnvHNa6xDWS34FGgNf6PYAEZoCt+BroUWFVbeb5HbCqSvB2cToyca+Adjlycdawt0C/HeyScl1W/w3gsU3aAd7JF8AuAN6isr7NAogXAFeq59Ec7ifAm49hF8wCMWfVNXAeCAkjEGuBr6R5ZGJzBrl4gGniBME+w8aMMyCsNZtfaemnmYaAQ6I3Rz0fnDhHJxc93Vrr7sHWjP3XRtTba2L3EkdFVaPC6YmXxKI9DGF1YPLdiwfD2r37cL5nDVw+uKzU5K27hsXCXPtyC2uyyl0D0p2TY7VaIvFYWU0Dm8TdOXmrVp52HG4lU4K/N38PpS/Kw70dbmb/sC0WCcQwNNzzjrzUj7veUyIIyL/4m/EP8V829O8zh5EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptz{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAM1BMVEVHcEzMzMzMzMzMzMzMzMzMzMzNzc3MzMzNzc3MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxDm1AzAAAAEXRSTlMAHqw+E8It/gjxc03jhGDTlgAjE2kAAAI6SURBVEjHpVbZkoQgDBwg3Of/f+12gtfMbK1Yy4NampCju4Ov1y8ruNyyo9fyCibVlNW6vUu29GpWQwTVdPTernqwffHex0WP4Nro3k+PrMKCvew/PcZ95aoNsY9yua+cGxTZsnf2K7ch4CAdGnWwYx/5LgKZCgxGdrhH3BeqNmnwviFXPZbQJmcM25HJ5n7/Pczr2QqksMJfO7BJOHLKLWFdMiL1QXYRwFagMklb4GB1zS7s8Le3fqH7Q28tVLkKdIzeaOJB2OKtY8KfTQCUa4++dNsLbrqpTR7xguHGt8hfg8P+seuaEkNdBjahzOD7g1cHP21SL2LtMNBKMdTRJjffTX1wVgrsEb1ITJU6QknwYJAcQky2cE02NbzPp70KyKggtpu9xM7Ik+CBIqY+8FrYyRUkrs+MEm1TG6tG9LZxNDNFGDue63TYGgIHqUUcuNhvhyZtn5LnlDq3Juxa4noCuX0scErOpNMDCrVcHPCS5rFGuQR9KZpxnB6CQ0ZO+AIBcTPk3UdbTx1L7jLEEHsMW7ZYm8NlIFyxn8+xdL7MURYEhzd5k2N2TabxIAORwC2r00QQfNSgrnqTJfh7cDmDu9ggtV0EZFr7kGu4KAxtNDln406TLwF9iZCIwn9EfjPuncRHYm5x3NfK3cFAS5kWxljSnTFlPHBAUFg5HsCCVOd9cdwXq+027un2QJlMjqISJutCDceRtTTuT4+1Q3HWHR8cu0fh9sGvADTYH9iLah/9nPz5+/MDJnQfoIVoAnQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptz:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAQlBMVEVHcEz////////////////////////////////////////////////////////////////////////////////////1bZCPAAAAFXRSTlMAeVoYDS1pBiPv4/g6lkzO2qSxvoixscijAAACi0lEQVRIx51W2ZLcIAwcLnPf+P9/NS2wp5xkq0ziF3ZRC3R0i/l8fvi04oxx89n+RBi1sqB38TKw7lw7lNzDa3U0e57bHhJ4d567HlqGC08eLAj9Gv8XD4/OwtsdhlfCW2s9LfWtuNrMhG1uLWP17Xh14LF4m8dx1OJ9jkm85YCYch5JzDVy81on3MFYkpTNYGmHHloYI+aqlNhlh5ZSvmH1AyBUwPcMX+u/clW3XYvA2YgRGXyZIZX6PXv0l3GlV9Jp9FKcK7mytJIg8xEeBdaBtV4P8tAixexnp73tY7ZBkrk9WEL8t7ZUDqtIA3jXa8sODSeUVqw5aztT+g4QeNAgM0PGTA0+EmfVeUvU0CEW4hX+lt/zseE7jJKDSmi0EUKBhr7EAMKPvNjOA9Fz4Yk/CFgcGRSdkYOHCLRxQfzKRN5SB/b5Ot8SzzQiKqcb6ipFdCfi1JI84OBdxzarhJ8RkpxHOQszl7bpn0GpmnXq6R4OfTkwwlyUWzeQg7rSLNhNUzEUEqJF3DMHeeXgqRIaYwHimLKipK8hMZOYVfJ5oKtIFSgXk5z4KcNx3GOIPGYfPigh9YGHBNQKVKbZhxMnqq+OHfWBHARZfWm1dnfSXfJuXInplse8wy39zkisdQ5kuLY+Bpc5hwGiH8Mx1rE24DFaLqXkfrNVkjk+8JPTPF0bUw+R9MCVuA8ks/xDyF/9orMqpBQeiob5RbIbmv7/TxvoX1Oqa914TsYg7QUWx8Y7R89JQY8mY6Dat1G5GARuMOgYHY9cbL1vNvc++fk67olLk4nrQSl7457OPqdeKn+vEwm4LPzW87DyXvqIyei9znHS+cZz9SxV+Qf8nNbjn37NkDx4+PmCXzHOLUMtjgmUAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptzActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcEwgmv8imPwimPwhmP8imP8imPwimPwmmf8imPwimPwhmP0imPwimPwimPwimPsimP0imPoLqfILAAAAEnRSTlMADprCJBnU/gXwh3LiUKxAXjJ/ELXKAAACbklEQVRIx5VW2bbjIAwLa1jM9v8/O7Iht+09MwPlpS2VwLZkJ9f1lxVG1joPdZ0u1ZIxurhv8DH6dMpQI5t439GAEc7xYPgTRnAtV7plReRhd5kDP8+fd+wzt70yPhIJzWT7/6DCJCAYLReZPMIuJC4pClSktHqbNpJO1aTmmAme3cvtWs9NSfq52CPhnJNjlbVHwgmWSWGHeQHcKFjj7fygwidf2fa4mbVOuladcnsoDn9/CKKAWf6HEtpANiJvUp9Fgr0SvocPP/sqjOCK9ktpyCAo4Kt/d4n4/6baseNKAt5XrauPN1A4ZLAd30RUI4kNfELVx+yd3lrXYIg1Bp/B/dGs5N8mPsJoVyiwkofQSlm+K9aiwmoQMDoI4wefoK/rhkESrSuV+BR2i6HZH9juLzxCtBmn6rFmB66gNJQwBOSxncT/N3FAlxAoLQfJDy2+6rMLI3aznl9fhOcGSdZzoNhex2K3TXJEVe3M4Zb6QhHuJc5BWakYIqqietcPw6FK+EHofUHRqtLEQ5X8dKVENXXgEpLOpcjwkFI30YFVHE8fyx2ShZJ/ydTKlZwZ4BCOv/af9uMi0DILe4kieynScgPbhai+DRDckTT6N6zJpI3HMghM3BMg+q9pHmwrbR0Q0D5wc0JHPy0E5Ur7Nf3Rk68LnR0NHfO28/T5P4cNr+uLFR7eEdiNxvMRbd5Onlqsis4iIVdme4di3akWOz+3T0aUnFWHa8QZrO51NO69MeLPafrNuBenxel/3d21j8k/jyxf+75OQabFxOtuT94G3Lpjzb0zBn2Dl0ep/waPidQ/p/XB60Dp7e8F/QO7WSJg4zEzdwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptzActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcExru/9ru/9qu/9ru/9ru/9ru/9ru/9svP9ruv9ru/9ru/9ru/9ru/9ru/9ru/9ru/9ru/+3uxEqAAAAEnRSTlMA5q0cR/PC/ggSKtN5OIhaa5izIOiAAAACV0lEQVRIx5VW2ZLjMAiMToNu/f/PboNsJ5PaKWv8kKRkWkDTQF6v/zyUfO+JX9sP1dKKd/v2acQcm992kbo1R4il7iHIif0BRNtCUOozH4cikAdt2YfjRLTnzN15/8I85wFCI2xDzlnyMLO7R0aFoTzbFGB+jIkYLkyePvmW8d2fs2ZfZuv8It9s6zvV5uSr2LmKb9oVh37QvpjYOcf8fcO3Cb1jGqOU0SvTTd6X2KUBLgKdLzaiDtE2n+isTh8/+AX7E6/Vh/NNSyfVm10RXIe1nxXRapmsDQB7SMnkmE0IxgqvUn0jteEf1T2CHXgr0gjZllGk1HoJL7lD7fRpD20CgJcwQ6EdSh3lLK0zVfuqz2WvPlPJh7HqnCQ4MysxoAYQE0vHub/toRuqzRy5pEUvbg62MzlJQn1MHBe1x7WSAddpNDSN1c9wRMhKfi2jrICwAIsQvHkD7Al41bOrBNC1Y7QdmSg15LDokGETJB/imxYJKfmFMDqI3FjUkDS3NSEDjBaxknRYSb+4nj4kC43W2OKrkqGB8jV2Fq03YiWbhHQTpUV1mMHXWYf8HlNX7ZUQRC6iwBAIK0r0ILr1UxqKsPattAkhwSIiMl76bT/Ft/TbTy2jHQoM7Cz9isHVMb6GILl0H4DGivbw7xNc8rAtiJn3O/qvD6JT/wgs7Y370ZSdWmbZWEKiG1lXImldW7Q1jGMbZW9tUVKZmGjjGvf+EXAqzWiX5OfFSHVp/zjbfGPc3whdcbTF67V2N1e79qYMru2/AnzVYFsdWFt/+nOypv8vQvoHou4gOtSrG5EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performance{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTM7OzszMzM3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3NzW8hQDoAAAAMdFJOUwC/gO8ra6tUQNmVEKtAA1gAAAE4SURBVDjLzZMhT8RAEIWnpS3tXcWdQ6wgOJIKfFdUICv6AyruB5w4EuSJCwRXgUBWkGArLsEi6JVuaZkfxawguSWz/p7azLdtdt97C3ASagp+PpeXPDjHVx7McMWDCBc8qPCZB4m44YFIeOBh+ckCf9z+sCCYqi8WvA/5Nwu26cfA+JRBs4h7WmX/tr9AXcQHAPdgzEPZh5idTQBOZ3zyiModISKQGxZ7dd85E0SKfMGjM7vXeI/5AE5LvrwpcK9IOrQYB5BlCsFIvjzgrkaSjsBZbmC9XsGsAxfn8gKXpL9sSlnQFBwFTTuaKWXgI5Ar+sfHTrW6DUDO+2jEEtCNQ9wL6gNujMvvdFS3eugxGT51fBXxTvF1wLLngbT0BGphKalAy0MQ3Z4Ha2V7UoMFJKkFVAWcvH4B0OJfd9YsTl0AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performance:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwD2qdfrViyAwW2XORBGtSCsD6SyAAABN0lEQVRIx+2VzQ7DIAyDYfxToH7/p10CbQ+T2s33Rb1MijM3/qDG/EurolD9zSNRggBU0hFelMABmenfADhGkJDhGUFGgiX6I1AAQlDgZK/td8ELtQORiTmIq42I2bYdCD8NjzPmYQxO+rbn2S5qzEUF6YjkgcJude56X3s0SoL7LRAeylyaVPiFq0Jyx230mpeXmXVOHssRbhackhCq25Sny++xcBW1n6Snqw6BTgrqRP6kzfDcgmRLGonDWSf2OecwB491dOrEVZpNsxiyiHzWJ0Z+BbBwzaoWVb49HrqVfSkxHen7WNznLhzl8xpQlT3E9oHUtYaufB+7NY9g9ctbjFfj/h1DwXUrzDltMn1Ql9M814EQWPLmEBg4R7JSzpFQxTmSBMkLvJKOhFHfKEEnv3L/+qw3DuMPzAFH9pIAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performanceActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAtUExURUdwTBGW2xKV2hKW3BKW2xGW3BKW2xGW3BGW2xKW2xKV3RGW2xGW2xGW3BKW2+P2IvgAAAAOdFJOUwC/gCvzq1RAleURc9VmrA9rXAAAAT9JREFUOMvNkzFLw1AUhU+SxtTahnZyC+IsIeAenDuE/oJQcS/FTYTi6hKcHYpDZ/EXBME95BeURpM0Me39Db4Mgk/u23umcL8kvHfOucBBKEr5eW95xoMjeuBBlyY86NOQBwt654HrPPHAca/YuUHrDQsG9eybBWa1+GLBqvS3LJiNX0vGJw/R0N6LJ+/f6x9I3uwG0D+luRU0FnmdCtBy6ZM7KvQdjgXwJYuNZVNrFfqF8IX+nFm/oBvyS2iZ8OWxgH4u1IZmU4kgfoa5E77c0jwhoTYCbTRFGE7QrXFCveCURkK/2cRBCp2gFYiyWk7Jw4AgXOmQZMAqa9uAeCP+JsViihtb9OKIPtBUuvy8jeqyHRpMhvc5X0W6Lvg60HrPg0DREySOoqQJKRbByRWbExaqlSoVwB0rwCLFwesHquttxhcsa64AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performanceActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTH3G63zE6n3G7H3F633G7H3F633G633F7H3F7HvG7H3G7H3F6xOzy+EAAAAMdFJOUwC/hKbvK0BT2XURZct0z00AAAE3SURBVDjLzZMhU8NAEIX3LiSUNqI1qBMMChFRgYxAd07E4CI6HQwzEUXgKjC4CH5ABAKJyA+oaHqBJO3+KPaYYSZh9nyfyuyXu7l77x3ASSgu+flYX/HgHOc8kC4wwikPMnzhQaTueKAiHvi43bFg0m4OLPBM9sWCjyb9ZsHm8NkwPiUQT8MjfSX/fn+F/C3syJf9YB7oLsDkjIaiHix5QCNbGBmAFPve+3lXi/0viLB3ZnmDz5g2ICry5daAvCbZhSE2oIsFeC35ssJljiQbgZitIY7nIGu4wLG+xBnpL5tClxQhCANR1Q5TSmCCQK7YjftOVbYNUOxot0EsHl0uwHdFfcD14PJLG9W9HfpMho81X0V8MnwdcHvkgS4cBcqVo6QKHQ9B1a6XY1zAcSiIFg6QlXDy+gEd714RcAqEowAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-face{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTL+/v76+vsDAwL+/v7+/v7+/v8DAwL+/v7+/v96T4QgAAAAJdFJOUwBAgSCbs9hZap+hQJoAAADvSURBVDjLY2AYRkAJCAygbEZBQUEBKJtpJhDAOJpA9kSYxESgKphuIaBuhASqyYzESjC2hDRilQBZ64BFgm2qMLPYNCwSkQpAwlMBWYIRzJsKYrKCxZSRncKSDFYzBSNY2MD2MqRhSFgqgClPAwwJBxwSbAk4jGKZDCKZp2JIsEOcOx0ztjQDYL5ENwsYJKrTsMSvGSgepzVg2pE5qSikPRPT8sopBuDod0ATZ54JsbZyBrJgAVAp1Ax2oPXMykjxYQaLA2CMoERUZQDMrgBUCc8CKIdzAvHJhyQJpLQLSu0TCaV2lPwBSu0KQy+LAwBuJj5UbruNggAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-face:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTP///////////////////////////////////////////////w2imYoAAAAMdFJOUwBAgBvfrFmcw4wrbtGliFoAAAD2SURBVDjLY2AYRkAJCAygbEZBQUEBKJvpDBDAODpA9kGYxEGgKphuIaBuhASqyYzESjBu79yIVWIP0NoCLBIsR4WZJY5gkYiZACRqFJAlGMG8EyAmK1hMGdkp7M4gkus4RrCwBIApFwwJmwlgqsYAQ6IAIrEAwygHHEaxngJbfhRDgg0sxHoMM7Z0AmC+RAPsJ4S5NE5gid8VoHg8sgHTDh/PzM60HkzLc44bgKMf3RKuMwoQ+dNIgswJDAycUDPYjhgwMCsjxYcJLA6AMYISUTkBMLsaUCVqEqAcngPEJx+SJJDSLii1HySU2lHyByi1Kwy9LA4AqflRBKNSA88AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-faceActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURUdwTBCT2xKV2hGY2hKW2xGW2xGW2xGW2xKX3BGX3BKW23povfoAAAAKdFJOUwBAgRybs9hZLG6hrV9tAAAA80lEQVQ4y2NgGEZACQgMoGxGQUFBASibaRUQwDhaQPZCmMRCoCqYbiGgboQEqsmMxEowTgmZiFViFtBaBywSbEuFmcWWYZGIUgASXgrIEoxg3lIQkxUspozsFJZkEMmxBCNY2MD2MqRhSFgpgCkvAwwJBxwSbAk4jGJZAbZ8KYYEO8S5yzFjSysA5kt0s5YKc6guwxK/baB4XDYB045Vi4pCyrMwLa9aYgCOfgc0cY5VEGurViIJMhcAlULNYF9mwMCsjBQfZrA4AMYISkRVBcDsCkCV8CqAcrgWEJ98SJJASrug1L6QUGpHyR+g1K4w9LI4ALk0RHtSETFcAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-faceActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURUdwTHzD63zE6n7H7H3F7H3F633G63zF7H3G7H3F7H3F68TinBIAAAAKdFJOUwBAgR+Z31ipwW4yAjb9AAAA+UlEQVQ4y2NgGEZACQgMoGxGQUFBASibaRUQwDhaQPZCmMRCoCqYbiGgboQEqsmMxEowTmmZiFViFtBaBywSrMuFmSWWYpGoUgASXgrIEowgHtsKEJMDLKaM7BSWYLCaJRjBwloAploxJKwUwJSXAYYE2KUMVRgSrAFgKhTDKPbFIJJ5OYYEG1iIfRlmbGkVwHyJBlhWCDNrrMASvxageFw6AdOOqKCklrQuTMuzlhiAo98BTZx5FcTarJXIgglApVBr2ZYaMDArI8WHKSwOgDGCElFZBTC7GlAlvBKgHK4FxCcfkiSQ0i4otS8klNpR8gcotSsMvSwOAIs+RIlIrewIAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-object{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA51JREFUaEPtmT1oFEEUx9/bnRALGxE70btkZjcR7QMiRisRbCzEQvxCLGyEhCDRBC/RoNaWFgYLFUSwUBAUDKKFFqIQ3OzNJpfCyspS8HaejNyG87J7t7N3l03gttydefP/vbcz8+YNwhZ/cIvrhx5A3hFMjEAQBDwMwzOmAi3LWhBCLDTr5/t+ycSubdtLnPOncX1iAfQAlmXdNBmkru2RVgBSSspg+5kQ4lRjv1iAIAgqRFTIMIju0i2AWNvrAKSUowDwLqP4tACm9rWmbABCiFxXKimlhu0BtPFHtdc19wj4vn/Wtu3XnPOfWVByA5BSngCAuwCwryb8Hud8EhGNltANB/B9/5BlWXcA4GCMx/8g4jjn/H7aaGwYgOd5BxhjcwCgPd/0QcRVAJhM2l3rO3cdQEq5GxFvEdH5VsLX7aKIH8MwLLmu+zapb9cAFhcXt/f3988AwJip8Jj2L2zbLg0MDHxr/NY1gCAIpohIJ2V2BwC0iUd9fX2lQqFQ6cQvtJbICSGOxHhlVOdKjuPMl8vlqzrxI6IdWUAQ8Um1Wp0ZGhryiYghYrUtgDQionxJT0al1IwGkVJeBAANvieNDQB4joglzvmilHIXAIwrpX67rmuUamfKcxoTvnoQ3/dP27Z9g4j2J4C81KBCiC9LS0suY2yMiC7rttoZuQBEQhsiopfT6wAwUvv+hjE2XSwWP0kpRxBxgohO1kPmDhAHEgTBUaVU1XGc98vLy8eVUhoqbpPLPwIx6/wqEV2ovX8AALzZ/Ng0EWgQGa1iLQ8xPYCUyx8YHjt7EWjm2I7sAy0it7ERqNWEDkeiklIJg8pFWwC1ZC6SM9NYc1oXgcaiVlxVYmVlZW8YhlMAcCnFvOkEQPqqRBqASLTneTsZY3pjapZSpwF4Y1nW7ODg4Ie202kTgGiwSqWyrVqtXgOA6Zj0OhGAiF4R0azrup87dqDJAlA/eLlcnkDESQCI0us4gOdEdNtxnK+tfkHjA027AJEgKeUVANBROVd7p3fixwAwJ4T43kp4nR2zylynAOoE/JuAiPiDcx6kFb5pAEwF5zKJ2xXZrH9uc6BTUD0AAGh639Xo6bjUI+G/NglS+p3Y87wCY+y/2ozJSGkuRDLekQFjbEexWPxVryfpjuxhllKhNtwtAESc55xHx9M1hsR0WlcOlFLHTLyv26Ypi5hesyql5oeHh3VBeN2T6TxgCtXN9j2Abno3je0tH4G/KbtRT7VUKs8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-object:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAwdJREFUaEPtmTuIFTEUhv8fLSxsFrET3UIQRHtBRNdKBBsLsRBfiIWNoIisD1xfqLWlhYuFCiJYKAgKLqKFFqIgoiBoYWVlKbjwy4HMJXs3M5Nk7tzZCzfdvZPk/F9OHicnxIgXjrh+jAG69mCpByStB3AgQ+AcybmqdpJmEvv9SvJhqE0QwBm4lGikqD4VAaCMvh+R3NffrgzgB4DJDCPWpC2AYN+LACTtAPAqU3wsQGr/pikPgGSnO5Ukgx0DNJhRzZp27gFJBwE8J/k7B6UzAEl7ANwEsNEJvwVgmmTSFjp0AEnbANwAsDUw4v8AnCZ5O9YbQwOQtBnAdQA28nXlp/NG8HT1G7cOIGkNgKsADtepDnx/C2CG5Muytq0BSFoJ4DKAUxnC+5s8cSCf+j+0CXDBjAJYNgAA6+Keg7AwpldyAXqBHMmpwKjYyThJclbSSQBWfyIT5IF5kuQ3SctJzjcCiBHhxUu2GM24gRx1IGtj+gDw2I34Z0mrbXcC8JdkUqidFecEAj4fZD+A8wA2lYA8NVCSHyRtcGvouKtrg9EJQKHVB7Ht9ByALe7jCwAXSb6TZP+dAbC3D7JzgBDITgDzJF9L2u2gQoectV0yAD7IEffjDgC7plaVJQdgYotdLOYSMwaI2gETr51jD1SN6qDOgSobw/WAywltLxRVhBIxi7LxInaxUCHHFvmCpFkorWInoR8LheqsA2DB3LGIRdPIAznBXC1AIVrSKncwVYXUMQB2Sl8h+SYQOCanVaIBPJAVAM5aqBAIr6sAnjnh78s82aoHQkYlWYwz7YXXIQCLRK+R/Fg3BYcO4HnlhPPKIfefTYX7dm8m+aVOuNdP+1OoSow79KzKL5LfY4UvGYBUwZ0s4qYiazzY7RRqCtfZIm4qfGBrAEDle1e/0FDoUTKvUxiT3gfsaWlBbibFUsyDiKSkBK9nf4LkH19P2RvZ3cxUIVoEmCVZXE97DFXPrJY52JUy+lY3Ji2S8cxq4i3jsahk3QdSodqsPwZoc3Rj+h55D/wH5CHfQHNA9EUAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-objectActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA9JJREFUaEPtmU+IE1ccx7+/N7O0BwUn24UeRKOd7LalvS+I6HoSwYsH8SCtLf1jEqWoyLJVMfEP6nlNIgi6eFChCB4UChaU0h7aQ1GQrnFSdw9e/JNs9LTFzPvJZI27m8xk5k02m13I3sK+33vfz/u9N+/7fo+wzP9ometHF6DTGfTMQF+mYNqwd6sKlFLcK++P3WsWF8nkUyr9stAeTcXN624xrgDVAUgcVxmk1lbaGPIFyFocou9fSonYzvo4d4BsYQLgaIhB0EYA174bAFaNWpuFhrthxDsxQQCMrKXUPwGbvfr2BSglYh39UjmwXYCwy2kh4jqegd5M/itdaL8+i5vPwwB1DMDIWNuJcBbA545wAs4V4+YIiJQ+oYsOYGTzGwniDIANLjP+hkCHiglzNGg2Fg3AGB3/Ugj9NBO2+4ujSSaMeJ2uc+PbDhC5aK1GhU6CeY+/8IZz9E+CnSomBn7zim0bQF/m4QqbPkgDOKgufH4EAzdZaKny3vUP6vtqG0BvtnCUwY4p01oFcOIZuCJ7elKvvo9OtLyESMN7IzeViA3VC3TshiY4Wkz2j0Uyj3+aMX5shAIhuia4kn6Z+DSPu6xjiCotAQQRMeuXaJJYpqsgOetbcBV8TZA+ANxgotRU3Hz48SWr7800DjHL6VJyQMlqh/I5jYZvFsTI5XcRa0cA/sLDv98iieMv98X++Sj7aEBCPwjwD9W2LNMdAqhJnQMyc5D9DGBwRhzukK4fK/647q9I1hoE6DDAO+ZBdh6gEaQ3V9hi27JS3tf/u3Hhv20kpQPldsgthQw0fOcnpc3fVK2EhosEmE33x9LJwKxM54Lj/Ap0SeoCBPz+qVw7uxnwmdQFOge8R1n0DDg1ISaxqSbJy0oE2pTvqhStbOK5FQy2ka6vOTVkoL6o5VaVWHX+yVoh7KMAvvPbNq1mQNmNBgGoiV55fry3R+jOweRpqQMBMO4wxImp5Cd/tGynVQBqg0UvT3z4eroyDMaxenvdHIBvE/GJYnzgb69MtjUDboMa2ceHCTQCoGqvPQBuSOZT5WT/fb8luOgANUFGxkoQYVja+Lq2iQm4ygKnS3tj//oJf9+PamUuzBJqJsY59Jz/9wh6+iJpFoIKXzIAqoI7solbFdksvmN7YKGgugAMNH3vqp9pN+vhtq5VMqT2PpAbjwrW59VmVAYL8iASCfdGBvm/bpQPrCvP1eP+RpYrXA5XKgTaBkA0Voqb1eupL4DToFo5YLlVZfadtkHKIqrPrFLIsXL8s0k3LaHuA6pQ7WzfBWjn7Abpe9ln4C11Qo9Pmb2aMgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-objectActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA8hJREFUaEPtmU1oU1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+zB6MugwjsGQFVwWxZxoyLr2bdtDTQLqgsAQt33LvdIe6UenvNaJUQqJ3Hi3ut+KSNLajMqfQV5EAnzRuZoEF8ivfZw74dqPbXeyP4MVSoE0DoAmkgafeXrqS+A08CpHBDTPpXRd9oGKYuoPrNqETlhD/w446Ul1H1AFaqV7bsArRzdIL5XfQS+AaeCtE+rbksUAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusion{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACCVJREFUaEO9Wn2MXFUVP+e96X5oa9UoYpUszrzzZlqLKDYhgAFaaKU2+M2W9Q8TNUQSQEsiRUjFVaHGNmoBMTUmaPwD2iIhqKR8WEBFGkLFUjbtzDtvpjYrVhpCXAtm1867x5zxvnXm9c28mR13b7LpdO65557fveeez0GYp1Gr1d4VRdF7lL3rui/n8/lX5mMr/H8wDcPwIgC4QkQuAwAVWv9eA4BJy/8sAHg7ALysf4i4DwAe9Tzvj/3uP2cA5XL5CsdxNiLi5QBwUkQeQcRHrNB/JaKZZuGYeRAA3gsAZ4nIBkTcAABLROS3xpjdpVLp0bmA6RlApVI5FxE3OY4zGkXRdkTc6/v+c3PZPAiC80Vkveu6Nxlj9ojIjmKx+GIvvLoGcODAgTctXbp0CwBsEpGHEXEbEf25l83a0TLzh0RkMyJ+AgB2TE1N3b5q1ap/dcO7KwC6AQDsRMQhAPiu53m7umHeK00YhlcDwC0iMg0A13ZzQJkAlKmI3A8ADyDi9Z7nnehVsF7owzA8Q0R+BABXIeJY1mF1BMDM3wSAcRHZ5Pv+nb0I0i9tEARfRcQdxphvFYvF8Xb82gJg5gsA4FkiyrylfoQVEScIgttyudxLhULhwSQvZhYAuJCI9qftkyrckSNHzs7lckdFZJ3v+0/0I2CntRMTEwNDQ0P3i8inAeCUPmLP8/Y2rwmCYC0iPl6v19+3fPnyvyT5nQZAmQ4ODv5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Vu1XZNLpZFbIq0fKIm6yIOhX10K8g4t1E9IDSa84wMDBwHBG1WNU8NIObDReY+RYA0EqDhhJqbQ4SkRYI+hotj9gCaDGj1Wp1lTHm+ZRdvk5EDdVh5h9qiaWZBhHXe57XCLKYWVXoygSPk0SksX1fw3r4FjPa4shsVqanP5DcyRhzebFY3Hf06NG31ut1fWQNT4uIWzzPu0M/d3gjTxPR6r6k/+/htDqyMAy/Y4zRPOCmmLn1zprYJ8eriLja87yJSqXyScdxHtKSi4YCVvgxRLyvjZCpFqhXQEEQbHccZ9rzvG/EsdBFIqKmVK1AYzQJl8Z/NH4PzHxV/NkCuAsRb0hb1C4x7xUAMx9GxGu0ONycD0yKyGcTuegLAJD26K4joh+nbczMe7QolZwTkZt939/Wq7BJeq2nIuIviUgr3v9LaDSdFJFjKR7vtMcYOxXVRWPMpY7jCBE1PGiz84k3F5G7fd//Sr/CW80YR8SROK2cvYFOKSUzr0PED2hGZYw5ISLHrafUx9QI2uICmFY1RORsx3FmEPE5EXne8zz1mn2Pjiml1d+ekvrmqHO+K3hWvvZJvb2ensoqCwmgq7KK1eGttnuyNqsSvVAAtGINAE9oF6hjYUsB2EaG6vWx2La3U96FAmAt28jU1NTqZOMjtbhrGxovZJXVFwJAXGYHgPPS6lVtS+dxY6PT41wIAFpe79To6Fj7j9PCdmX2TvF6vzYzLqtrgyX2MWk8M5sXcaNDRLQjeft8Vaxj4bQSLSJbEFHjsraNjZg+E4AS2obHTzRb0kxsvirXVm1vBoAT9Xr9y2kNjeQtdAVAF9kQW5PseW+zzszMjCcbGe1UsmsAMYOURveTc62nap1TRNYsSKM7eQIaO7mu+zkAWAsArwPA45oXdPNTAxutaillsTqoKIruW7CfGqRdpRaHReSj2lvo8scezyDiY1qc7dda9axC3W64UD+3+Q/fZENVhTDr2gAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusion:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADA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yoBCBAurWv3ZdEPd/Ka1W5Td5FR5JKVAaS2OHvRbX6mJT41eE5TM52/6M6uQNDxlzvhAdga91gusat81cDVquurPQA4QS3s2lcN8rYyyOGzfLdQ8cseLsiWu7NrN1o17UJVJ+zW123+BfogD+TkdLQFAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusionActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACItJREFUaEO9Wn+MVNUV/s59+wOqyM7bFaxAsDBvFqnWak0MYhBQUEqUVssi/aNJawg7bxaKScFqqKyt0gip4sK8XUKqjX/IL43RlqBSxLZWYqwWdWNh3oIlFClkebMUaXfZefc0983MMjv7Zt7MLrvvn93MPec753v33HPuPfcRhukZt+3YeCndCQpeCO3kmWVTTg+HKbocoKHWjpnEuBfMd4GgnJ7ADAcCJzx8iUlE0AGcBOMkiPYz4c1kNPzXodofNAE9fvheQCyBoLvBOA/wHunSHq7CiXM9+BdWGj39nGuxq8dWYyJdxCSh8UKAFoIwBpL/CMidTmzam4MhUzaBmpYjNwmNVoFEA9jdSEx7zzZFPhiM8dotiduYeAFIWw2Wu6TLm7pW1n9SDlbJBK7d+rev/c8du5aAVQC/Lok2dEWNv5djrJBsTat9s2BeA9AiBjaN1s499eXyW/9bCnZJBNIG0AbQKCb8OhkN7ygFvFyZUGvHQ8R4DOBuSWgs5QUFEkiD8nYAuyuJmk5Hw2fKdawc+fGtHeN6mbcAWMxES4NeVlECequ9DoxmMK9yYpHny3FkqLJ6PPFTEG0CyyedWH1zIbyCBPQ2ewYk3ndMI3CWhuTsOhb6uMQTEBWfOdGpr+Zj6ZbNELjdaTQO+tnxda6m9R/XCa74AoLnO42RfUNysJjyuvYqffyo7QA/AKCXQYuSZnhvrorelpgHSW9LSn2jK3r9P/PhBhLY1V6ld1b/HuBPHDOyZricn/jsidEXRnXvIOD+SzaoS7r8/a4Vxrv9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-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusionActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACJpJREFUaEO9WntsW9UZ/33HaZJCX7S5TmhalQ1NaAzGYJUgvk7pe5QKusGa0v0xaZvQkKBbK60BWl/b8XWKaLWtUJg6IcG0P+hrCMHWlcdK2OLrFPFYGdU0ac+q9BHfFPoC2sQ+33SufVPXvfa1kyaWolg+3+t3zznfd87vu4Qx+nQfONc8yF+0KvP1NPHoxjsm9Y+FK7oSRo2+fh0I3AUpFwHUyoxWIv6EiI4o+8w8m5mmE+EowEchxH4g95rZ1myN1v+IAUR6M3eRwCqAFgM4C8ZeZuyFmHDk9OmpH2+7my4UB7fmj9wwderpWZBDs4mwHOoPmAzwn1hiV7I9+NpIwNQMwOjtvwWC1gLUwVJuIfA+s73lnZE4N3pP3M6gZSTEeoB3Q/JWs735w1psVQ0g/t6xq+T5uogkrCXQKyDebIaCf63FWTlZI525FUydDF4hGFtFYzYZnzvz82psVwVAOSCI7QA3MuMJU9d2VmO8VhnDsh8gwuMAnWfIh6p5QL4AlFEAO5ixp45yj8T1lkytgdUiH7dOBLMceIYIKwGs9ntYFQFELDtGQJyJ1yZDwadqCWS0spF05qfEtJWl7Eq2N8fL2SsLwLBOtgEybeqa7yyNJthYjEVucSYqRN1HCX3GS6W2DMtmQIRMfUaflx/P4GJ9x6+Tsu6/xGJpIjzjzdEEWEk3tvtQvZzVsgPM9zEwJJhXJMLBfcU60dTJJUzyDSGyX+pqu/Z/pfYuAxA7xPXytP17YvowEdY6xyr4dekjEydxo0oG9170QadY8neS7drbl4KwNzPxLWKqdk/XTTRYPHYZgGgqs0kSLQsExJ1dd8w4MxYAOlP25AaCCv5uD/vHIHP3FdeW2IGTU3I5+WfBvC8RDm4oC0AVKRbUR6Af+u3+kQJ7rPfwNXVi4k4CLS1vg/+Vy/H9m+Y1/82VUdmQw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pWk0lrLnSsK7pY4Y9FhSb3KWjpG2fwmGk3HcD5NYlgzNcAgqI22/CsY9JTbOmro2ZbQALkujpYWs8IRVSa8vdUa53OLEvJb9sZ5Pp3F9tsettAyKJPWm7vwDKbNHCG+bIW3BqAFcVsj6BkzkuNEMa+td4woUQG0ezgYCCCyI69MPRdL93yYWLyvKJRnWOpy1n7ZXC8aLXkGWy0C1AjJS9hYE6LzZ1mTkK7EiZ6V4ztS1G11jbnCegRB3uPshms6sdL87+8nKPE2gNV565S7mNQOw7L9DyAcVOXzxOG3ZRyBz3y2+ixqW/QEAj01HD5t606+8HEdS9u4CKVUyLB819ebNtQZbKq/4VIjA70xdm63GigBkXmDJhy+reB6b0b3u5fO0nA8hOKlrTgUtLj7Dmxu8LakHfzLa4J0Zdo4oNMe9VlZ1pYyoUk/i62DSAc6wlMfzpf7ioc0lwAqsxnUEugDB7yCLd8127f0rEXzFK2U+e9R2qfcCcCUCLWej4qXeAVAjrTKeAKqiVRQItQQgaLng3BI/Jnq8ACjGWlLgTUjeW5HYUgCcRsZgfY9UG7qQ28tN6XgBUJlNCJoj6gcXlDY+PMndwmb5wI9WHw8ALs0O4tu8+KoK9Hq+sVGJXh8PAHl6vXyjo3KDo3AtLEezVzqvjzYbubQ6A3G3xpQ5nlR25TY6iLGF6kRyrBhrNwrFRHNWRpiwvlJjw5WvqvuSb3gEfs2gIAFPjhVznU+VeJTAGSFyP/ZqaJQ+7qoAKCXV+OBTdnw82qw0TYuXNjLKrZOqAbgGShvdLOitkfKpiuckyQvHpdFd+gQUHQ9B3yPGEhDOAfwGS9pT1asGgldCNTgYk5igCtSL4/aqgddUKnIY4G8xc7ialz2IKAXQ64qcHW22qnkJVetwvF63+T9nAHfjRfzL0gAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-logSave{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA1R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PCyHGfKEXBGCMrMBr1mZtPxHxEzN/jqLoYbr07oIIBvDNRFnPuwBlzXwybsd74C95KWhPrxIhsgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-logSave:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAthJREFUaEPtmTuMTUEYx3//TrWdeLRUJCrReISGUBCvLVAqNGiEiASh8IoClUKyBQqPBAWhsREqnYRE9NgoV0T3yci5m9mzc2bmnHvvOXuTO8ktbs7MN//ffPP45hsx4kUjrp8xQNcezPaAmW0EDgFrgLXA0j7F/wG+AlckPW5qKwvAzE4At5p2ktHusqTzGfUWVEkCmJk1MdygzQ1Jp+u2iwKY2X3gcF2jfdS/I8l5O7tUApjZTuBlwNIk8E7STHYvQMCTzs6jgI27ko7l2o4B3AaO+4YkJadcVcdlAGfLzA5WQGR7IgbwGtjuCdoj6UXuyJTrhQBcnQjETUmnUv3FAH4CyzwDKyX9SBnM9QAwIWk2AXFV0tlYnzGAebtPP9OnEPkNWO2J2STpQ+9/xBOXJF2ogmgT4Amw3xNyT9JRX1gEYq+kZyGIoQGY2UXgAPyPt5x4V8qH1TRwDvgk6XdkOr2XtLltgLfA1qLTj5I2mNl3YEWDdTQraaJtgAVryMz2AU8bAFC1Boc5hYKbgJmtB6aKgDCbZdEAeLuOWyPrit+qFMmiA0gJrjr4yu1an0Ip4Z6Hss6hMUBu6FD3JB9PodwRGGkPeOHCX+CafzmPDUAR85wBlrgwQ5LbUueV3AHsaxGbmR8uOAGTPYga8f+0pG2LBWAOosYNrFOAqith6L5bdQee81optG7nHIjE8DlnVlB8EVa3AxCJ4VMAleJbB2gAERXfCUANiKT4zgAyILLEdwoQgcgW3zlAIWA30EvWXq+bFBvESTzQxFZqSyqdAe7i7xIAvTIjaXnIRmupxZoAznvPvTZvJO2oCzDQ5G5NgPKbRGWyt7X0egrAzFwedktFtnqXpFe1PFAsxLYfOEIaH0g6UjUAyXx/i09MQY2pq2gSoPDEsB/5QuJPSnLrMFqyAAqIQT+zloX9Aj4DX4CHfuo9RpANkBqJrr6PAboa+V6/I++Bf0in3kCazcMZAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoom{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAkUExURUdwTMDAwL+/v7+/v7+/v76+vr+/v7+/v7+/v7+/v7+/v7+/vxtcv/AAAAALdFJOUwBVdZCpGdZE7C3B0wnY6AAAAV9JREFUOMt1lDtPwzAQx20ghGwVsHVJhQRDlsywWKqEULsw8FhRJ2iWiglGGJvFCw8xIVVCSEwkKU25L4ftpOHs2Cclsu7v370smxCLecRh+xOH8Ja5kGEs/6dtYf1XONcWZurbwwRCQjYZ9l7uHAPAOBHpI1QC/QSY9g84ldmnAn7Z3htwsfZnvSe54eJd5hlcC7gccxTwSETZEr5+714vLRdfkFraVNtetXLpR7ha+mkHCV1Y/q8ZOW8AgDkecsIaAEIcGbIGyLUq4KcBYl0o7QAB4FZACBMrQKpaJOCZQqyAIhgayYEpgD1DZghXCvBTNJFKmCvgzmhcCEsBwMjSRx6BslYftRX0JLYKrAsLqzDC54EFMwvy58QhMM8hFNq0UpwET+sLC9/4BmEBTytyRCIbDoAEiR1Qp1dbRxfoyv9g3ogaKVuXhVZZbtqX6Ez6H23PxG4CM259QDwt/h8ABfK8nDqSAAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoom:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwCCyreU7KZVRCDaZnETLwj6WaYVAAABUUlEQVRIx5WV2Q6EIAxFoVBWxf7/184AOnGUsvTBqDmXrqRCzNou1kwGtyZIQNuiD0P6evWTURFUMtIoPO+iVoGIZPkMqkdKA0jZgoJ6suQc2EoiGBldOoQ9HSDk5+GTs1Fqo9IlcEpvNv3qv0MBhSalIFSv3+MCJCY8fUaCxasycrMu9dp5VTUhubXZ6CqsAvn66ZAsx+e8fON37oT3bZ4aiRU0kDlavGSrQI95HPBZACt8FuCL16IruBVkzBeBW+CLYHvyfiDQd96IpHpOMqP++fAq9VMQ7rwrM5+6gjwG/3y/D/m8ylPYpvpAeqO7DfvwMPO9D6jnBabG56YFZx77fEjD+9AyLdYEhp8nxoNh5wmJtfY8AS+wzIZZrJNcC4h3wV8IH1p87Iyfnc6XVaAd7ICHAsebw97zgDSxZ/yvViiPuYUfTe650knM2+7Ywz9yOCklzohLOwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoomStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwDjmTC6Y0KBVakX8s8iC3JYR1wyAAABVUlEQVRIx62V2baFIAiGcwJRS97/aU/Zbtht0VzrcJOuvl/AAabpXy1RF0F/m2h2PX5mzucEuO9gMon1MY7KlG8w4LImC1XFQmxDGVkm1DYpXi0qS1gXTEGzKoqNS1ajAxPqJDikFLcFS+aukYJffRfXnAj9kYUXFVi86wzzPjuCFRXBwS3KaC/Pt02Ww7uf1jz3BVYtX/OsyDQFDn7yswPXb+Ovs39eJJWwxrOXV4thgC+//QBf/uMAXwAa4AuRBvgdWR58CB2B+eaRG5e8QO7Jn2sIAvzhbdsDnXzev8q0BengGXv8EciH3y1CY5++yI/BRNx82g/La7lc7b0Am/tUC6n3HoZ4SbDyy5BgzSNivV6wbPXeIPOpHlOU+CjkTQKvQOpXdRdJvn+5xttWQa4EZUOzluonT6+q72X6Zb0+T/lNhQd7hg9vm8LWUhW5gT4iN7c/0ZUo8Q3AttYAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoomStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAqUExURUdwTBKV2hGW2xKW2xKW2xKW2xGV3BGW2xGW3BGX2xKW3BKW2xCX2xKW2yDN61kAAAANdFJOUwCAVKxm3T/DmhrxKw97YQBGAAABaklEQVQ4y2NgIA6wGqCLMCqAqV4HdIm9F0Ek22UMM9hiG4AkVzQDA+cmx+YyJJnDlw8wMNQaNpfevbu0QgxJgrN3JQPD3VvhjU57kESnOZqvvXuJgcEXxVFMEkDt1w11gZYwoVgue3d5SzaQSgCydZG1TMkBU8vBuq9guBcqNBNDgj0GQrMEb0CVYEmA2ViANRQZ795tQPZduADciXcVUNSthGu4hGrAJawagBIXsWoAClzGqgEocRWrBqDIrQNQDTPRXZ8A0cB41wBNQgGiQfbubTQJAagGDB0GIA0OsnevbkCTCADiu4J374ahW34JqAEIbiXMRJOAgkvMKJYgJBx6717AKiF4F4eOu+jxgQCXGHBIKPDgkBC8JYCURJDtQHYWN4oEcvpZiyR+C9lZtkgSKKG1CyGOGrxItleixjrcLFBWRAYcMIkG9NQMiY67N7AlcxAQwMwA6SBxM2xZQ3jtVRPsRQ83sg8ACMIUxzzE8wsAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-close{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTM3Nzc7Ozs7Ozs3Nzc3NzcrKys3Nzc3Nzc3NzePZJxkAAAAJdFJOUwCtKdPBGAmNTt3jdDcAAADfSURBVDjL1dOxDoIwEADQgwR07GTCZtI/IGHgAzBhM9EPkMTB0Y3V0ZXIcn/rtRR6pefgSKeSu3ellyvA9lZ/5F9p/3K7PZY8oPG5BD6MpPUSgIITzdIStifAshjRQV1PCFT8TxaicTzzwEwINOEdHVmDmcTAkRhMhMAp7iQRjcMtDhCp8SA1v0ARGIIK/gnkv0p1OBTS4QRUIpE7DiYYXTBrzcld3JIrAarXrps4AVNwRSZgExoJmIyAaAdsShUMn/JF2fh4YEkpAcgvnuwYCIb6EbbbP4PsDfLD2dD6Av1qTvAQlzUTAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-close:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTP///////////////////////////////////8kBMKEAAAAJdFJOUwCt0igUwJdJePGbgLgAAADcSURBVDjL1ZMxEoIwFESTCaOWFDapqeicnAALTiANnaWlnVewDTMW/7b+aCAb8jkAVIHN2/lsNkrt73lf8M08nnF1pAYFR/dFmAAx7SIoi4iDbRrWDMAuQFzmmxAGbjjJgjj6dCjMCAND/o8RWQMzUgIRKYE/wsC5TJIRR74rBUZaqqXwLZEXT0WTDGwLW1aavJWQir9qadw++NgykWoMNtcykh8Q5EECgr5C+jjpGjHjPGhPU5eVzyfPJitfnUyhPg6ywMKZ7BygcYcsPCj1Kc8uXYPqpeSLs6PnC4w8S+8OJ9MLAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-narrow{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABm1JREFUaEPVWWuIVVUUXmvfYRosHzUZUUqKjkSXSe5Z+5qJhfawLELCR5ohPhKjjB4EWgkpkopRSWEPS1Mqy7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/g4j6x+lqrZ8EgGKTE0nAGPM0M9+Wj8BhKWV9HLjrukuFEPMBoMf+HKdrm3oimhcnFyy1IwkopRYj4soCYF1dXf3JPAMKfiilNiFisaSOJOC67nQhxCu+h3i0lLI1boWqPW+M6WDmoXk7+4io8L3rr+IuZIwZycztPocWEdHqajtYCl8pdSEifuOT2UhEc/w63fZUrfWvADCwixlii+M4408mAa31AgB4xufDHCLaGElAKbUZEf09cAMR/XCySGit7TXO3IJ9IcTQYI8cLKfvQsQ1BYVq9sBxi9La2jqipqbmMwA4Oy8bWtoHCTiIaBua0/JKB5hZSikPxhms9LxSah0i2i26MHoUct0eYt+2tRIRF5/MKGit7YFqD9auYU9tRBwfls49emJjzEBm3gEAxVKCmadJKbdWepWj8LTWHwLAlb75hUS0Nkw+6lbidkTspoCI6aibgUoSU0otR8QlBUxE3Oo4TleNlpiAFQwWUfa/XC7XZ8yYMccq6bAfS2v9OADcHUidqUT0RdkE8iS+BIBsQHkkEe2qNAml1HOIeGsA914isqQiR5LL3aMAcHoAYTIR2av0Ex7t7e3ne563mplvDoIh4le2xC+VurEE8pGwh1m3/sBec3ie96iUcndvWLS3t4/o7OycK4SYw8znRKZIDIlEBPIk7IrfGDB01JIAgJZsNtuShIjruplUKmWdtidsMLK2lFmFiPP8fUapSCQmYJ2L6cDsNfh7iLiXme1VjG3GOwFguOd5DYg4HAAa7O/Q3QTRXiavchxnhzHmIgCw3V6xWYoiURYBa9h13atTqdTssJxNEoEImQeJaIV/LimJsgkUjCilLrGXToho33mFrmoMod2I+LLneW9KKb8Nk01CotcE/AaVUmOFENcz8zgAGAIA54Y4dAgADiCifejtjcQnSSIWRgIAniIi+5q3cm/q/c40NzfX9e3bd4gQ4kxEPFhbW3sgnU7/lcThJJHwV8kViUBvHStHz0aCme2qe7W1tasbGxu7rkFPGQKR50Q5q/B/lP0HjgOoT/ydvaYAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-narrow:hover{background:url("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GZHbYXhQVWva7CkCkyg/nAIyRtKJuhXo9bjuSyOFJzypJ2ff/XCqHdBTwXs6gmZLm9NrAKvm29wY+zc1ZKGlqnqeYzH0PbJ8mLJM0dpABTAfuyNkwVdLCKgDFGniEpC8HC4TtaONEOyej4cUaubgDFwLzcgw9q4HrFsV2pAxvANuluaWpfRHAAUAUNJsmpmhrjJa0tk5ht8dtRx0cITqjAYlcv5c49zJHKI2QmtEG3wXbcaDGwZrRamBsmTuX1cTxEi8H8qnEJElLur3KreTZfgk4Mjc+Q9L8svmtuhLnAUWGka06A90EZjt6UdGTymiJpCxHG6CqqrHVL4lKnMMkRaXWE7J9M3BRwXUmSnqrlcK61uLbwIEF5lGSou3XVbJ9F3BOQeglkgJUS2rS3P0F2LwgYYKkaKWvN9neGYgT//QSYR9Hil/lurUAQqjtOMyK9UEkWXMlfdgJihTn45CK1GCHChmVIBoBSCBixU8qKIrdmRuXG5LigqOWbO+fjA7jizsbqcxsINLsfJ3REkRjAAlEVQUWbfDncjc0UYz/BewJjCh8lgGNZvJsSctt75MabLUg2gKQQBydSrwyn63dgRYTrpQUdwR91BRE2wAyDbYPSk2nuPOKVW6X4t15EHhS0mdlzE1AdAygsFpxwX0CEJcUuwM7lhgULhW5VRgeHYnXmiBuAeI2SXHN272b+gKgzRKQrYFIBNdI+qOJwQ13oi8/68oOdGpYO3xpJ2LV/45zI/t3hSEDoBXYIQ/gH99H3EBePlczAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-expand{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABvJJREFUaEPVWWmIXEUQrnqzZseYxGM9QBNF4hrJEDfzqieuAY/gFRXPyMYbzUHwQBQUzx+KeBAJKhrRqEhEQWMU75AYXREPlunu3bjxIDGraIwiuJpFkL26pMK84eXtm3lvZieGFAzsTtf1VVd3V9Ug7OOE+7j/0BAAnZ2d2UmT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TSsMwoCEVf4vr+re2zIDqSJ5Hh5BAQzS9R/IiJpf3fRPgOg4jsx3sjsbfn/AH37LF5g3/BiAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-expand:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABYZJREFUaEPVmXmoVVUUxn8f0WRzVkJlIWVGUmIJWWADTVaUldFclCnSQBQYNv1RSCWGVFRSlkRh0GBS2YBmJWGJUBHNNJiYWQSZfwTRxBfrce5jv/3Ovefc++4z3oKLD/fea61v7bXXdMQQJw1x/ekKANs7AOcA44Ddkt/2wJbk9z2wTNIP3TLcgADYvhw4q/gFiLq0ClgBLJf0Ud1DZfs6AmD7UuA64JiBCAf+BR4GHpH0TSe82gJgO6x9PXBqJ8JanPktQABzJP3VDu/aAGzfADzYhPnPQLjFUuA7YHPx+xPYHxhZ/Bt/nw4c14TP+8CFkjbWBVELgO2ngfD3nJYBCyW9Wldg7LN9cigKXATsnJ39HTi+7tuoBGDb3VI852P7QOBO4MoSGaMlfVtlmJYAbL8HHJsxmSdpdhXjdtZt3wPcWnJmhKRfWvFqCsD2PODm7PBdksJiXSfbJwDvZIzfAM6VFG+plEoBFNHmlezEc5LCZweNbEcSjMSX0iJJ09sFsDwLlaslTRo0zRPGts8AXstkTZYUOvWjfjdQJKnFyc7PgCmS1m0NACHD9t3AbYm8yNiT6wKIWJxm2JmSFm4t5QsA2wBvZ/liuqRFuR59bsD2JcAzyaYPJU1oV3nbF8fjAw4DlnTy8Es8YYWk06oAPJnF5I6sb/tF4LxC2CZJ+3VghGFAVK17JmdHSVqf8uq9AdtR+kZNsmOx4Y9I/5KiLGiLbEc4jLDYQ5IqE2aZANvxFqNwbNBNkh5oBiAsFpZr0FJJU9vSvNjcRQBRPKbhfJWkE5sBuBe4JVmcIemJ/xNAyLb9a+JGGyRF+dFLqQstAK5J1g6XFCG0berWDRQ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b-pro-container .jb-pro-menu-icon-text,.jb-pro-container .jb-pro-quality-icon-text,.jb-pro-container .jb-pro-scale-icon-text,.jb-pro-container .jb-pro-speed-icon-text{font-size:14px;min-width:30px;height:20px;line-height:20px;cursor:pointer;text-align:center}.jb-pro-container .jb-pro-speed{box-sizing:border-box;text-align:center;font-size:14px;color:#fff;width:90px}.jb-pro-container .jb-pro-menu-list,.jb-pro-container .jb-pro-quality-menu-list,.jb-pro-container .jb-pro-scale-menu-list,.jb-pro-container .jb-pro-speed-menu-list{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;overflow:hidden;width:-webkit-max-content;width:-moz-max-content;width:max-content}.jb-pro-container .jb-pro-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-speed-menu-shown{visibility:visible;opacity:1}.jb-pro-container .icon-title-tips{pointer-events:none;position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:rgba(0,0,0,.5);border-radius:4px}.jb-pro-container .icon-title{display:inline-block;padding:5px 10px;font-size:12px;white-space:nowrap;color:#fff}.jb-pro-container .jb-pro-quality-menu{padding:8px 0}.jb-pro-container .jb-pro-menu-item,.jb-pro-container .jb-pro-quality-menu-item,.jb-pro-container .jb-pro-scale-menu-item,.jb-pro-container .jb-pro-speed-menu-item{display:block;height:25px;line-height:25px;margin:0;padding:0 10px;cursor:pointer;font-size:14px;text-align:center;width:50px;color:hsla(0,0%,100%,.5);transition:color .3s,background-color .3s}.jb-pro-container .jb-pro-menu-item:hover,.jb-pro-container .jb-pro-quality-menu-item:hover,.jb-pro-container .jb-pro-scale-menu-item:hover,.jb-pro-container .jb-pro-speed-menu-item:hover{background-color:hsla(0,0%,100%,.2)}.jb-pro-container .jb-pro-menu-item:focus,.jb-pro-container .jb-pro-quality-menu-item:focus,.jb-pro-container .jb-pro-scale-menu-item:focus,.jb-pro-container .jb-pro-speed-menu-item:focus{outline:none}.jb-pro-container .jb-pro-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-speed-menu-item-active{color:#2298fc}.jb-pro-container .jb-pro-volume-panel-wrap{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%) translateY(22%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;height:120px;width:50px;overflow:hidden}.jb-pro-container .jb-pro-volume-panel-wrap.jb-pro-volume-panel-wrap-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-volume-panel{cursor:pointer;position:absolute;top:21px;height:60px;width:50px;overflow:hidden}.jb-pro-container .jb-pro-volume-panel-text{position:absolute;left:0;top:0;width:50px;height:20px;line-height:20px;text-align:center;color:#fff;font-size:12px}.jb-pro-container .jb-pro-volume-panel-handle{position:absolute;top:48px;left:50%;width:12px;height:12px;border-radius:12px;margin-left:-6px;background:#fff}.jb-pro-container .jb-pro-volume-panel-handle:before{bottom:-54px;background:#fff}.jb-pro-container .jb-pro-volume-panel-handle:after{bottom:6px;background:hsla(0,0%,100%,.2)}.jb-pro-container .jb-pro-volume-panel-handle:after,.jb-pro-container .jb-pro-volume-panel-handle:before{content:"";position:absolute;display:block;left:50%;width:3px;margin-left:-1px;height:60px}.jb-pro-container.jb-pro-fullscreen-android-rotate .jb-pro-controls,.jb-pro-container.jb-pro-fullscreen-web .jb-pro-controls{width:100vh}.jb-pro-container.jb-pro-fullscreen-android-rotate .jb-pro-play-big:after,.jb-pro-container.jb-pro-fullscreen-web .jb-pro-play-big:after{transform:translate(-50%,-50%) rotate(270deg)}.jb-pro-container.jb-pro-fullscreen-android-rotate .jb-pro-loading,.jb-pro-container.jb-pro-fullscreen-web .jb-pro-loading{flex-direction:row}.jb-pro-container.jb-pro-fullscreen-android-rotate .jb-pro-loading-text,.jb-pro-container.jb-pro-fullscreen-web .jb-pro-loading-text{transform:rotate(270deg)}.jb-pro-container .jb-pro-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;left:10px;top:10px;min-width:200px;padding:5px 0;background-color:rgba(0,0,0,.9);border-radius:3px}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu{cursor:pointer;font-size:12px;display:block;color:#fff;padding:10px 15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-shadow:0 0 2px rgba(0,0,0,.5);border-bottom:1px solid hsla(0,0%,100%,.1)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu a{color:#fff;text-decoration:none}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span{display:inline-block;padding:0 7px}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span.art-current,.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span:hover{color:var(--theme)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu:hover{background-color:hsla(0,0%,100%,.1)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu:last-child{border-bottom:none}.jb-pro-container.jb-pro-contextmenus-show .jb-pro-contextmenus{display:flex}.jb-pro-container .jb-pro-extend-dom{position:relative;width:100%;height:100%;display:none}.jb-pro-container-playback .jb-pro-controls{height:48px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center{flex:1;display:flex;box-sizing:border-box;justify-content:space-between;font-size:12px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time{box-sizing:border-box;flex:1;position:relative;height:100%}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-inner{width:300px;height:100%;overflow-y:hidden;overflow-x:auto}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-current-time{position:absolute;left:0;top:0;height:15px;width:1px;background-color:red;text-align:center;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-current-time-text{position:absolute;box-sizing:border-box;padding:0 5px;width:60px;left:-25px;top:15px;border:1px solid red;height:15px;line-height:15px;cursor:move;background-color:#fff;color:#000;-webkit-user-select:none;-moz-user-select:none;user-select:none}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll{position:relative;width:1440px;margin:0 auto}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.one-hour{width:1440px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.half-hour{width:2880px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.ten-min{width:8640px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.five-min{width:17280px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.one-min{width:86400px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-list{position:relative;background-color:#ccc;height:48px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-day{height:100%;overflow:hidden}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-one-wrap{height:8px;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-wrap{height:25px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-btns{display:flex;align-items:center}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one{float:left;width:1px;height:8px;margin:0;cursor:default;position:relative;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one.active,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one.active{background-color:orange;cursor:pointer}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one.start,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one.start{background-color:#999}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one:hover .jb-pro-playback-time-title-tips,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one:hover .jb-pro-playback-time-title-tips{visibility:visible;opacity:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips{pointer-events:none;position:absolute;left:0;top:100%;visibility:hidden;opacity:0;transform:translateX(13%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:#000;border-radius:4px;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips.jb-pro-playback-time-title-tips-left{transform:translateX(-100%)}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips .jb-pro-playback-time-title{display:inline-block;padding:2px 5px;font-size:12px;white-space:nowrap;color:#fff}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute{float:left;position:relative;width:60px;box-sizing:border-box;border-top:1px solid #999;-webkit-user-select:none;-moz-user-select:none;user-select:none;text-align:left;height:25px;line-height:25px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:first-child,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:first-child{border-left:0}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:first-child .jb-pro-playback-time-hour-text,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:first-child .jb-pro-playback-time-hour-text{left:0}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:after,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:after{content:"";position:absolute;left:0;top:-8px;width:1px;height:14px;background-color:#999}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour-text,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-text{position:absolute;left:-13px}.jb-pro-container-playback .jb-pro-playback-expand.disabled .jb-pro-icon-expand,.jb-pro-container-playback .jb-pro-playback-narrow.disabled .jb-pro-icon-narrow{cursor:no-drop}.jb-pro-container-playback .jb-pro-control-progress-simple{position:absolute;box-sizing:border-box;left:0;top:-2px;width:100%;display:flex;flex-direction:row;align-items:center;height:8px;cursor:pointer}.jb-pro-container-playback .jb-pro-control-progress-simple:hover{top:0;align-items:flex-start}.jb-pro-container-playback .jb-pro-control-progress-simple:hover .jb-pro-control-progress-inner{height:100%}.jb-pro-container-playback .jb-pro-control-progress-simple:hover .jb-pro-control-progress-inner .jb-pro-progress-indicator{transform:scale(1);visibility:visible}.jb-pro-container-playback .jb-pro-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:all .2s ease;background:hsla(0,0%,100%,.5)}.jb-pro-container-playback .jb-pro-progress-hover{display:none;width:0}.jb-pro-container-playback .jb-pro-progress-played{position:absolute;left:0;top:0;right:0;bottom:0;height:100%;width:0;background-color:orange}.jb-pro-container-playback .jb-pro-progress-indicator{visibility:hidden;align-items:center;justify-content:center;position:absolute;z-index:40;border-radius:50%;transform:scale(.1);transition:transform .1s ease-in-out}.jb-pro-container-playback .jb-pro-progress-indicator .jb-pro-icon{width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.jb-pro-container-playback .jb-pro-progress-indicator:hover{transform:scale(1.2)!important}.jb-pro-container-playback .jb-pro-progress-tip{display:none;position:absolute;z-index:50;top:-25px;left:0;height:20px;padding:0 5px;line-height:20px;color:#fff;font-size:12px;text-align:center;background:rgba(0,0,0,.7);border-radius:3px;font-weight:700;white-space:nowrap}.jb-pro-container-playback.jb-pro-fullscreen-web .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-playback-time-inner{overflow-y:auto}.jb-pro-zoom-control{cursor:-webkit-grab;cursor:grab}.jb-pro-performance-panel{position:absolute;box-sizing:border-box;z-index:10000;left:0;top:0;padding:5px;font-size:10px;background:rgba(0,0,0,.2);color:#fff;max-height:100%;overflow-y:auto;display:none}.jb-pro-performance-panel .jb-pro-performance-item{display:flex;align-items:center;margin-top:3px;color:#fff}.jb-pro-performance-panel .jb-pro-performance-item-block{height:10px}.jb-pro-tips-message{position:absolute;top:0;left:0;width:100%;height:100%;background:linear-gradient(180deg,rgba(0,0,0,.8),hsla(0,0%,100%,0));overflow:auto;box-sizing:content-box;display:none}.jb-pro-tips-message:before{color:hsla(0,0%,100%,.3);content:"X";font-family:Arial,Helvetica,sans-serif;font-size:40px;left:0;line-height:1;margin-top:-20px;position:absolute;text-shadow:2em 2em 4em #000;text-align:center;top:50%;vertical-align:middle;width:100%}.jb-pro-tips-message .jb-pro-tips-message-close{position:absolute;z-index:99999;right:0;top:0;width:40px;height:40px;display:flex;align-items:center;justify-content:center}.jb-pro-tips-message .jb-pro-tips-message-close .jb-pro-tips-message-close-icon{width:20px;height:20px;border-radius:10px;cursor:pointer;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTM3Nzc7Ozs7Ozs3Nzc3NzcrKys3Nzc3Nzc3NzePZJxkAAAAJdFJOUwCtKdPBGAmNTt3jdDcAAADfSURBVDjL1dOxDoIwEADQgwR07GTCZtI/IGHgAzBhM9EPkMTB0Y3V0ZXIcn/rtRR6pefgSKeSu3ellyvA9lZ/5F9p/3K7PZY8oPG5BD6MpPUSgIITzdIStifAshjRQV1PCFT8TxaicTzzwEwINOEdHVmDmcTAkRhMhMAp7iQRjcMtDhCp8SA1v0ARGIIK/gnkv0p1OBTS4QRUIpE7DiYYXTBrzcld3JIrAarXrps4AVNwRSZgExoJmIyAaAdsShUMn/JF2fh4YEkpAcgvnuwYCIb6EbbbP4PsDfLD2dD6Av1qTvAQlzUTAAAAAElFTkSuQmCC") no-repeat 50%;background-color:#fff;background-size:100% 100%}.jb-pro-tips-message .jb-pro-tips-message-content{overflow:auto;padding:35px;box-sizing:border-box;width:100%;height:100%;z-index:99999}.jb-pro-tips-message .jb-pro-tips-message-content .jb-pro-tips-message-content-item{font-size:14px;color:#fff;text-align:center;line-height:1.5}');class pc{constructor(e){var t;this.player=e,this.TAG_NAME="Control",this.extendBtnList=[],((e,t)=>{e._opt.hasControl&&e._opt.controlAutoHide?e.$container.classList.add("jb-pro-controls-show-auto-hide"):e.$container.classList.add("jb-pro-controls-show");const i=e._opt,s=i.operateBtns,r=`\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
00:00:00
\n
\n
\n
\n
\n ${i.playbackConfig.showPrecisionBtn?`\n
\n
${Qh.narrow}
\n
${Qh.expand}
\n
\n `:""}\n
\n `;e.$container.insertAdjacentHTML("beforeend",`\n ${i.background?`
`:""}\n
\n \n
\n ${i.loadingIcon?`\n
\n ${Qh.loading}\n
${i.loadingText}
\n
\n `:""}\n ${i.hasControl&&s.play?'
':""}\n ${i.hasControl&&s.ptz?`\n
\n
\n
\n
\n
\n
\n ${i.ptzMoreArrowShow?'\n
\n
\n
\n
\n ':""}\n
\n
\n ${i.ptzZoomShow?'\n
\n
\n \n \n 缩放+\n \n
\n
\n \n \n 缩放-\n \n
\n
\n ':""}\n ${i.ptzApertureShow?'\n
\n
\n \n \n 光圈+\n \n
\n
\n \n \n 光圈-\n \n
\n
\n ':""}\n ${i.ptzFocusShow?'\n
\n
\n \n \n 聚焦+\n \n
\n
\n \n \n 聚焦-\n \n
\n
\n ':""}\n ${i.ptzCruiseShow?'\n
\n
\n \n \n 巡航开\n \n
\n
\n \n \n 巡航关\n \n
\n
\n ':""}\n ${i.ptzFogShow?'\n
\n
\n \n \n 透雾开\n \n
\n
\n \n \n 透雾关\n \n
\n
\n ':""}\n\n ${i.ptzWiperShow?'\n
\n
\n \n \n 雨刷开\n \n
\n
\n \n \n 雨刷关\n \n
\n
\n ':""}\n
\n
\n `:""}\n ${i.hasVideo?`\n
\n
${Qh.narrow}
\n
电子放大
\n
${Qh.expand}
\n
${Qh.zoomStop}
\n
\n
\n
\n
00:00:00
\n
${Qh.recordStop}
\n
\n `:""}\n\n ${i.hasControl?`\n
\n
\n
\n ${i.showBandwidth?'
':""}\n
\n
${i.controlHtml}
\n
\n ${i.playType===w&&i.playbackConfig.showControl&&i.playbackConfig.controlType===X.normal?r:""}\n ${i.playType===w&&i.playbackConfig.showControl&&i.playbackConfig.controlType===X.simple?'\n
\n
\n
\n
\n
\n
00:00
\n
\n
\n ':""}\n
\n ${i.playType===w&&i.playbackConfig.showRateBtn?'\n
\n
\n
\n
\n
\n
\n ':""}\n ${s.close?`
${Qh.close}
`:""}\n ${s.logSave?`
${Qh.logSave}
`:""}\n ${s.performance?`
${Qh.performance}
${Qh.performanceActive}
`:""}\n ${s.aiFace?`
${Qh.face}
${Qh.faceActive}
`:""}\n ${s.aiObject?`
${Qh.object}
${Qh.objectActive}
`:""}\n ${s.aiOcclusion?`
${Qh.occlusion}
${Qh.occlusionActive}
`:""}\n ${s.quality?'\n
\n
\n
\n
\n
\n
\n ':""}\n ${s.scale?'\n
\n
\n
\n
\n
\n
\n ':""}\n ${s.audio?`\n
\n
\n ${Qh.audio}\n ${Qh.mute}\n
\n
\n
\n
\n
\n
\n
\n
\n `:""}\n ${s.play?`
${Qh.play}
${Qh.pause}
`:""}\n ${s.screenshot?`
${Qh.screenshot}
`:""}\n ${s.record?`
${Qh.record}
${Qh.recordStop}
`:""}\n ${s.ptz?`
${Qh.ptz}
${Qh.ptzActive}
`:""}\n ${s.zoom?`
${Qh.zoom}
${Qh.zoomStop}
`:""}\n ${s.fullscreen?`
${Qh.fullscreen}
${Qh.fullscreenExit}
`:""}\n
\n
\n
\n `:""}\n
\n
\n
\n
\n
\n
\n
\n
\n `),Object.defineProperty(t,"$poster",{value:e.$container.querySelector(".jb-pro-poster"),configurable:!0}),Object.defineProperty(t,"$loadingBg",{value:e.$container.querySelector(".jb-pro-loading-bg"),configurable:!0}),Object.defineProperty(t,"$loadingBgImage",{value:e.$container.querySelector(".jb-pro-loading-bg-image"),configurable:!0}),Object.defineProperty(t,"$loading",{value:e.$container.querySelector(".jb-pro-loading"),configurable:!0}),Object.defineProperty(t,"$loadingText",{value:e.$container.querySelector(".jb-pro-loading-text"),configurable:!0}),Object.defineProperty(t,"$play",{value:e.$container.querySelector(".jb-pro-play"),configurable:!0}),Object.defineProperty(t,"$playBig",{value:e.$container.querySelector(".jb-pro-play-big"),configurable:!0}),Object.defineProperty(t,"$recording",{value:e.$container.querySelector(".jb-pro-recording"),configurable:!0}),Object.defineProperty(t,"$recordingTime",{value:e.$container.querySelector(".jb-pro-recording-time"),configurable:!0}),Object.defineProperty(t,"$recordingStop",{value:e.$container.querySelector(".jb-pro-recording-stop"),configurable:!0}),Object.defineProperty(t,"$pause",{value:e.$container.querySelector(".jb-pro-pause"),configurable:!0}),Object.defineProperty(t,"$controls",{value:e.$container.querySelector(".jb-pro-controls"),configurable:!0}),Object.defineProperty(t,"$controlsInner",{value:e.$container.querySelector(".jb-pro-controls-bottom"),configurable:!0}),Object.defineProperty(t,"$controlsLeft",{value:e.$container.querySelector(".jb-pro-controls-left"),configurable:!0}),Object.defineProperty(t,"$controlsRight",{value:e.$container.querySelector(".jb-pro-controls-right"),configurable:!0}),Object.defineProperty(t,"$volume",{value:e.$container.querySelector(".jb-pro-volume"),configurable:!0}),Object.defineProperty(t,"$volumePanelWrap",{value:e.$container.querySelector(".jb-pro-volume-panel-wrap"),configurable:!0}),Object.defineProperty(t,"$volumePanelText",{value:e.$container.querySelector(".jb-pro-volume-panel-text"),configurable:!0}),Object.defineProperty(t,"$volumePanel",{value:e.$container.querySelector(".jb-pro-volume-panel"),configurable:!0}),Object.defineProperty(t,"$volumeHandle",{value:e.$container.querySelector(".jb-pro-volume-panel-handle"),configurable:!0}),Object.defineProperty(t,"$volumeOn",{value:e.$container.querySelector(".jb-pro-icon-audio"),configurable:!0}),Object.defineProperty(t,"$volumeOff",{value:e.$container.querySelector(".jb-pro-icon-mute"),configurable:!0}),Object.defineProperty(t,"$fullscreen",{value:e.$container.querySelector(".jb-pro-fullscreen"),configurable:!0}),Object.defineProperty(t,"$fullscreenExit",{value:e.$container.querySelector(".jb-pro-fullscreen-exit"),configurable:!0}),Object.defineProperty(t,"$record",{value:e.$container.querySelector(".jb-pro-record"),configurable:!0}),Object.defineProperty(t,"$recordStop",{value:e.$container.querySelector(".jb-pro-record-stop"),configurable:!0}),Object.defineProperty(t,"$screenshot",{value:e.$container.querySelector(".jb-pro-screenshot"),configurable:!0}),Object.defineProperty(t,"$speed",{value:e.$container.querySelector(".jb-pro-speed"),configurable:!0}),Object.defineProperty(t,"$controlHtml",{value:e.$container.querySelector(".jb-pro-controls-item-html"),configurable:!0}),Object.defineProperty(t,"$playbackTime",{value:e.$container.querySelector(".jb-pro-controls-playback-time"),configurable:!0}),Object.defineProperty(t,"$playbackTimeInner",{value:e.$container.querySelector(".jb-pro-controls-playback-time-inner"),configurable:!0}),Object.defineProperty(t,"$playbackTimeScroll",{value:e.$container.querySelector(".jb-pro-controls-playback-time-scroll"),configurable:!0}),Object.defineProperty(t,"$playbackTimeList",{value:e.$container.querySelector(".jb-pro-controls-playback-time-list"),configurable:!0}),Object.defineProperty(t,"$playbackTimeListOne",{value:e.$container.querySelector(".jb-pro-playback-time-one-wrap"),configurable:!0}),Object.defineProperty(t,"$playbackTimeListSecond",{value:e.$container.querySelector(".jb-pro-playback-time-second-wrap"),configurable:!0}),Object.defineProperty(t,"$playbackCurrentTime",{value:e.$container.querySelector(".jb-pro-controls-playback-current-time"),configurable:!0}),Object.defineProperty(t,"$playbackCurrentTimeText",{value:e.$container.querySelector(".jb-pro-controls-playback-current-time-text"),configurable:!0}),Object.defineProperty(t,"$controlsPlaybackBtns",{value:e.$container.querySelector(".jb-pro-controls-playback-btns"),configurable:!0}),Object.defineProperty(t,"$playbackNarrow",{value:e.$container.querySelector(".jb-pro-playback-narrow"),configurable:!0}),Object.defineProperty(t,"$playbackExpand",{value:e.$container.querySelector(".jb-pro-playback-expand"),configurable:!0}),Object.defineProperty(t,"$ptz",{value:e.$container.querySelector(".jb-pro-ptz"),configurable:!0}),Object.defineProperty(t,"$ptzActive",{value:e.$container.querySelector(".jb-pro-ptz-active"),configurable:!0}),Object.defineProperty(t,"$ptzControl",{value:e.$container.querySelector(".jb-pro-ptz-controls"),configurable:!0}),Object.defineProperty(t,"$ptzBgActive",{value:e.$container.querySelector(".jb-pro-ptz-bg-active"),configurable:!0}),Object.defineProperty(t,"$ptzControlCircular",{value:e.$container.querySelector(".jb-pro-ptz-control"),configurable:!0}),Object.defineProperty(t,"$ptzArrows",{value:e.$container.querySelectorAll(".jb-pro-ptz-arrow"),configurable:!0}),Object.defineProperty(t,"$ptzExpand",{value:e.$container.querySelector(".jb-pro-ptz-expand"),configurable:!0}),Object.defineProperty(t,"$ptzNarrow",{value:e.$container.querySelector(".jb-pro-ptz-narrow"),configurable:!0}),Object.defineProperty(t,"$ptzApertureFar",{value:e.$container.querySelector(".jb-pro-ptz-aperture-far"),configurable:!0}),Object.defineProperty(t,"$ptzApertureNear",{value:e.$container.querySelector(".jb-pro-ptz-aperture-near"),configurable:!0}),Object.defineProperty(t,"$ptzFocusFar",{value:e.$container.querySelector(".jb-pro-ptz-focus-far"),configurable:!0}),Object.defineProperty(t,"$ptzFocusNear",{value:e.$container.querySelector(".jb-pro-ptz-focus-near"),configurable:!0}),Object.defineProperty(t,"$ptzCruisePlay",{value:e.$container.querySelector(".jb-pro-ptz-cruise-play"),configurable:!0}),Object.defineProperty(t,"$ptzCruisePause",{value:e.$container.querySelector(".jb-pro-ptz-cruise-pause"),configurable:!0}),Object.defineProperty(t,"$ptzFogOpen",{value:e.$container.querySelector(".jb-pro-ptz-fog-open"),configurable:!0}),Object.defineProperty(t,"$ptzFogClose",{value:e.$container.querySelector(".jb-pro-ptz-fog-close"),configurable:!0}),Object.defineProperty(t,"$ptzWiperOpen",{value:e.$container.querySelector(".jb-pro-ptz-wiper-open"),configurable:!0}),Object.defineProperty(t,"$ptzWiperClose",{value:e.$container.querySelector(".jb-pro-ptz-wiper-close"),configurable:!0}),Object.defineProperty(t,"$qualityText",{value:e.$container.querySelector(".jb-pro-quality-icon-text"),configurable:!0}),Object.defineProperty(t,"$qualityMenu",{value:e.$container.querySelector(".jb-pro-quality-menu"),configurable:!0}),Object.defineProperty(t,"$qualityMenuList",{value:e.$container.querySelector(".jb-pro-quality-menu-list"),configurable:!0}),Object.defineProperty(t,"$scaleText",{value:e.$container.querySelector(".jb-pro-scale-icon-text"),configurable:!0}),Object.defineProperty(t,"$scaleMenu",{value:e.$container.querySelector(".jb-pro-scale-menu"),configurable:!0}),Object.defineProperty(t,"$scaleMenuList",{value:e.$container.querySelector(".jb-pro-scale-menu-list"),configurable:!0}),Object.defineProperty(t,"$zoom",{value:e.$container.querySelector(".jb-pro-zoom"),configurable:!0}),Object.defineProperty(t,"$zoomStop",{value:e.$container.querySelector(".jb-pro-zoom-stop"),configurable:!0}),Object.defineProperty(t,"$zoomNarrow",{value:e.$container.querySelector(".jb-pro-zoom-narrow"),configurable:!0}),Object.defineProperty(t,"$zoomExpand",{value:e.$container.querySelector(".jb-pro-zoom-expand"),configurable:!0}),Object.defineProperty(t,"$zoomStop2",{value:e.$container.querySelector(".jb-pro-zoom-stop2"),configurable:!0}),Object.defineProperty(t,"$close",{value:e.$container.querySelector(".jb-pro-close"),configurable:!0}),Object.defineProperty(t,"$zoomControls",{value:e.$container.querySelector(".jb-pro-zoom-controls"),configurable:!0}),Object.defineProperty(t,"$performancePanel",{value:e.$container.querySelector(".jb-pro-performance-panel"),configurable:!0}),Object.defineProperty(t,"$performance",{value:e.$container.querySelector(".jb-pro-performance"),configurable:!0}),Object.defineProperty(t,"$performanceActive",{value:e.$container.querySelector(".jb-pro-performance-active"),configurable:!0}),Object.defineProperty(t,"$faceDetect",{value:e.$container.querySelector(".jb-pro-face"),configurable:!0}),Object.defineProperty(t,"$faceDetectActive",{value:e.$container.querySelector(".jb-pro-face-active"),configurable:!0}),Object.defineProperty(t,"$objectDetect",{value:e.$container.querySelector(".jb-pro-object"),configurable:!0}),Object.defineProperty(t,"$objectDetectActive",{value:e.$container.querySelector(".jb-pro-object-active"),configurable:!0}),Object.defineProperty(t,"$occlusionDetect",{value:e.$container.querySelector(".jb-pro-occlusion"),configurable:!0}),Object.defineProperty(t,"$occlusionDetectActive",{value:e.$container.querySelector(".jb-pro-occlusion-active"),configurable:!0}),Object.defineProperty(t,"$contextmenus",{value:e.$container.querySelector(".jb-pro-contextmenus"),configurable:!0}),Object.defineProperty(t,"$speedText",{value:e.$container.querySelector(".jb-pro-speed-icon-text"),configurable:!0}),Object.defineProperty(t,"$speedMenu",{value:e.$container.querySelector(".jb-pro-speed-menu"),configurable:!0}),Object.defineProperty(t,"$speedMenuList",{value:e.$container.querySelector(".jb-pro-speed-menu-list"),configurable:!0}),Object.defineProperty(t,"$logSave",{value:e.$container.querySelector(".jb-pro-logSave"),configurable:!0}),Object.defineProperty(t,"$playbackProgress",{value:e.$container.querySelector(".jb-pro-control-progress-simple"),configurable:!0}),Object.defineProperty(t,"$playbackProgressTip",{value:e.$container.querySelector(".jb-pro-progress-tip"),configurable:!0}),Object.defineProperty(t,"$playbackProgressHover",{value:e.$container.querySelector(".jb-pro-progress-hover"),configurable:!0}),Object.defineProperty(t,"$playbackProgressPlayed",{value:e.$container.querySelector(".jb-pro-progress-played"),configurable:!0}),Object.defineProperty(t,"$playbackProgressIndicator",{value:e.$container.querySelector(".jb-pro-progress-indicator"),configurable:!0}),Object.defineProperty(t,"$playbackProgressTime",{value:e.$container.querySelector(".jb-pro-playback-control-time"),configurable:!0}),Object.defineProperty(t,"$tipsMessage",{value:e.$container.querySelector(".jb-pro-tips-message"),configurable:!0}),Object.defineProperty(t,"$tipsMessageClose",{value:e.$container.querySelector(".jb-pro-tips-message-close"),configurable:!0}),Object.defineProperty(t,"$tipsMessageContent",{value:e.$container.querySelector(".jb-pro-tips-message-content"),configurable:!0})})(e,this),e._opt.extendOperateBtns.length>0&&e._opt.extendOperateBtns.forEach((e=>{this.addExtendBtn(e)})),e._opt.extendDomConfig&&e._opt.extendDomConfig.html&&this.addExtendDom(e._opt.extendDomConfig),t=this,Object.defineProperty(t,"controlsRect",{get:()=>t.$controls&&t.$controls.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsInnerRect",{get:()=>t.$controlsInner&&t.$controlsInner.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsLeftRect",{get:()=>t.$controlsLeft&&t.$controlsLeft.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsRightRect",{get:()=>t.$controlsRight&&t.$controlsRight.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsPlaybackTimeInner",{get:()=>t.$playbackTimeInner&&t.$playbackTimeInner.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsPlaybackBtnsRect",{get:()=>t.$controlsPlaybackBtns&&t.$controlsPlaybackBtns.getBoundingClientRect()||{width:0},configurable:!0}),cc(e,this),((e,t)=>{const{events:{proxy:i},debug:s}=e,r=e._opt,o=r.operateBtns;function a(e){const{bottom:i,height:s}=t.$volumePanel.getBoundingClientRect(),{height:r}=t.$volumeHandle.getBoundingClientRect();return oo(i-e.y-r/2,0,s-r/2)/(s-r)}function n(i){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];i.composedPath().indexOf(e.$container)>-1?t.isFocus=!0:t.isFocus=!1,s&&!e.fullscreen&&e._opt.hasControl&&e._opt.controlAutoHide&&(t.isFocus?(ao(t.$controls,"display","block"),d()):(h(),ao(t.$controls,"display","none")))}if(fo()?i(window,["click","contextmenu"],(e=>{e.stopPropagation(),n(e)})):i(window,"click",(e=>{e.stopPropagation(),n(e,!0)})),i(t.$controls,"click",(e=>{e.stopPropagation()})),o.play&&(i(t.$pause,"click",(t=>{r.playType===w&&r.playbackConfig.uiUsePlaybackPause?e.playbackPause=!0:Zo(o.pauseFn)?o.pauseFn():e.pauseForControl()})),i(t.$play,"click",(t=>{r.playType===w&&e.playbackPause?e.playbackPause=!1:Zo(o.playFn)?o.playFn():e.playForControl().then((()=>{e.resumeAudioAfterPause()}))}))),i(t.$playBig,"click",(t=>{r.playType===w&&e.playbackPause?e.playbackPause=!1:Zo(o.playFn)?o.playFn():e.playForControl().then((()=>{e.resumeAudioAfterPause()}))})),o.screenshot&&i(t.$screenshot,"click",(t=>{t.stopPropagation(),Zo(o.screenshotFn)?o.screenshotFn():e.video.screenshot()})),o.audio&&(fo()&&(i(t.$volume,"mouseover",(()=>{t.$volumePanelWrap.classList.add("jb-pro-volume-panel-wrap-show")})),i(t.$volume,"mouseout",(()=>{t.$volumePanelWrap.classList.remove("jb-pro-volume-panel-wrap-show")})),i(t.$volumePanel,"click",(t=>{t.stopPropagation(),e.volume=a(t)})),i(t.$volumeHandle,"mousedown",(e=>{e.stopPropagation(),t.isVolumeDroging=!0})),i(t.$volumeHandle,"mousemove",(i=>{t.isVolumeDroging&&(e.volume=a(i))})),i(document,"mouseup",(()=>{t.isVolumeDroging&&(t.isVolumeDroging=!1)}))),i(t.$volumeOn,"click",(i=>{i.stopPropagation(),ao(t.$volumeOn,"display","none"),ao(t.$volumeOff,"display","block");const s=e.volume;e.volume=0,e._lastVolume=fo()?s:1})),i(t.$volumeOff,"click",(i=>{i.stopPropagation(),ao(t.$volumeOn,"display","block"),ao(t.$volumeOff,"display","none"),e.volume=fo()?e.lastVolume||.5:1}))),o.record&&(i(t.$record,"click",(t=>{t.stopPropagation(),Zo(o.recordFn)?o.recordFn():e.recording=!0})),i(t.$recordStop,"click",(t=>{t.stopPropagation(),Zo(o.recordStopFn)?o.recordStopFn():e.recording=!1}))),i(t.$recordingStop,"click",(t=>{t.stopPropagation(),Zo(o.recordStopFn)?o.recordStopFn():e.recording=!1})),o.fullscreen&&(i(t.$fullscreen,"click",(t=>{t.stopPropagation(),Zo(o.fullscreenFn)?o.fullscreenFn():e.fullscreen=!0})),i(t.$fullscreenExit,"click",(t=>{t.stopPropagation(),Zo(o.fullscreenExitFn)?o.fullscreenExitFn():e.fullscreen=!1}))),o.ptz){i(t.$ptz,"click",(e=>{e.stopPropagation(),ao(t.$ptzActive,"display","flex"),ao(t.$ptz,"display","none"),t.$ptzControl.classList.add("jb-pro-ptz-controls-show")})),i(t.$ptzActive,"click",(e=>{e.stopPropagation(),ao(t.$ptz,"display","flex"),ao(t.$ptzActive,"display","none"),t.$ptzControl.classList.remove("jb-pro-ptz-controls-show")}));const c=Ca();if(t.$ptzArrows.forEach((s=>{if(r.ptzClickType===Y)i(s,"click",(i=>{i.stopPropagation();const s=i.currentTarget.dataset.arrow;t.$ptzBgActive.classList.add("jb-pro-ptz-bg-active-show"),t.$ptzBgActive.classList.add(`jb-pro-ptz-bg-active-${s}`),t.$ptzControlCircular.classList.add(`jb-pro-ptz-control-${s}`),e.emit(at.ptz,va(s)),setTimeout((()=>{t.$ptzBgActive.classList.remove("jb-pro-ptz-bg-active-show"),Di.forEach((e=>{t.$ptzBgActive.classList.remove(`jb-pro-ptz-bg-active-${e}`),t.$ptzControlCircular.classList.remove(`jb-pro-ptz-control-${e}`)})),e.emit(at.ptz,Ri)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Q){let r=!1;i(s,c.down,(i=>{i.stopPropagation(),r=!0;const s=i.currentTarget.dataset.arrow;t.$ptzBgActive.classList.add("jb-pro-ptz-bg-active-show"),t.$ptzBgActive.classList.add(`jb-pro-ptz-bg-active-${s}`),t.$ptzControlCircular.classList.add(`jb-pro-ptz-control-${s}`),e.emit(at.ptz,va(s))}));const o=()=>{r=!1,t.$ptzBgActive.classList.remove("jb-pro-ptz-bg-active-show"),Di.forEach((e=>{t.$ptzBgActive.classList.remove(`jb-pro-ptz-bg-active-${e}`),t.$ptzControlCircular.classList.remove(`jb-pro-ptz-control-${e}`)})),e.emit(at.ptz,Ri)};i(s,c.up,(e=>{e.stopPropagation(),r&&o()})),i(window,c.up,(e=>{e.stopPropagation(),r&&o()}))}})),r.ptzZoomShow)if(r.ptzClickType===Y)i(t.$ptzExpand,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,Ii),setTimeout((()=>{e.emit(at.ptz,Ri)}),1e3*r.ptzStopEmitDelay)})),i(t.$ptzNarrow,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,Bi),setTimeout((()=>{e.emit(at.ptz,Ri)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Q){let u=!1,p=!1;i(t.$ptzExpand,c.down,(t=>{t.stopPropagation(),u=!0,e.emit(at.ptz,Ii)})),i(t.$ptzNarrow,c.down,(t=>{t.stopPropagation(),p=!0,e.emit(at.ptz,Bi)}));const f=()=>{u=!1,p=!1,e.emit(at.ptz,Ri)};i(t.$ptzExpand,c.up,(e=>{e.stopPropagation(),u&&f()})),i(t.$ptzNarrow,c.up,(e=>{e.stopPropagation(),p&&f()})),i(window,c.up,(e=>{e.stopPropagation(),(u||p)&&f()}))}if(r.ptzApertureShow)if(r.ptzClickType===Y)i(t.$ptzApertureFar,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,Mi),setTimeout((()=>{e.emit(at.ptz,Pi)}),1e3*r.ptzStopEmitDelay)})),i(t.$ptzApertureNear,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,Fi),setTimeout((()=>{e.emit(at.ptz,Pi)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Q){let m=!1,g=!1;i(t.$ptzApertureFar,c.down,(t=>{t.stopPropagation(),m=!0,e.emit(at.ptz,Mi)})),i(t.$ptzApertureNear,c.down,(t=>{t.stopPropagation(),g=!0,e.emit(at.ptz,Fi)}));const y=()=>{m=!1,g=!1,e.emit(at.ptz,Pi)};i(t.$ptzApertureFar,c.up,(e=>{e.stopPropagation(),m&&y()})),i(t.$ptzApertureNear,c.up,(e=>{e.stopPropagation(),g&&y()})),i(window,c.up,(e=>{e.stopPropagation(),(m||g)&&y()}))}if(r.ptzFocusShow)if(r.ptzClickType===Y)i(t.$ptzFocusFar,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,Ui),setTimeout((()=>{e.emit(at.ptz,Pi)}),1e3*r.ptzStopEmitDelay)})),i(t.$ptzFocusNear,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,Oi),setTimeout((()=>{e.emit(at.ptz,Pi)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Q){let A=!1,b=!1;i(t.$ptzFocusFar,c.down,(t=>{t.stopPropagation(),A=!0,e.emit(at.ptz,Ui)})),i(t.$ptzFocusNear,c.down,(t=>{t.stopPropagation(),b=!0,e.emit(at.ptz,Oi)}));const v=()=>{A=!1,b=!1,e.emit(at.ptz,Pi)};i(t.$ptzFocusFar,c.up,(e=>{e.stopPropagation(),A&&v()})),i(t.$ptzFocusNear,c.up,(e=>{e.stopPropagation(),b&&v()})),i(window,c.up,(e=>{e.stopPropagation(),(A||b)&&v()}))}if(r.ptzCruiseShow&&(i(t.$ptzCruisePlay,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,Ni)})),i(t.$ptzCruisePause,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,ji)}))),r.ptzFogShow&&(i(t.$ptzFogOpen,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,Gi)})),i(t.$ptzFogClose,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,Wi)}))),r.ptzWiperShow&&(i(t.$ptzWiperOpen,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,zi)})),i(t.$ptzWiperClose,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,$i)}))),r.ptzSupportDraggable){function _(){t.isPtzControlDroging&&(t.isPtzControlDroging=!1,t.$ptzControl.style.cursor="grab",t.tempPtzPosition={x:0,y:0})}t.isPtzControlDroging=!1,t.tempPtzPosition={x:0,y:0},i(t.$ptzControl,c.down,(e=>{e.stopPropagation(),t.isPtzControlDroging=!0,t.$ptzControl.style.cursor="grabbing";const{posX:i,posY:s}=ea(e);t.tempPtzPosition={x:i,y:s}})),i(t.$ptzControl,c.move,(e=>{if(t.isPtzControlDroging){e.stopPropagation();const{posX:i,posY:s}=ea(e),r=t.tempPtzPosition.x-i,o=t.tempPtzPosition.y-s;t.$ptzControl.style.left=t.$ptzControl.offsetLeft-r+"px",t.$ptzControl.style.top=t.$ptzControl.offsetTop-o+"px",t.tempPtzPosition={x:i,y:s}}})),i(t.$ptzControl,c.up,(e=>{e.stopPropagation(),_()})),i(window,c.up,(e=>{e.stopPropagation(),_()}))}}o.performance&&(i(t.$performance,"click",(t=>{t.stopPropagation(),e.togglePerformancePanel(!0)})),i(t.$performanceActive,"click",(t=>{t.stopPropagation(),e.togglePerformancePanel(!1)}))),o.logSave&&i(t.$logSave,"click",(t=>{t.stopPropagation(),e.downloadMemoryLog()})),o.aiFace&&(i(t.$faceDetect,"click",(t=>{t.stopPropagation(),e.faceDetect(!0)})),i(t.$faceDetectActive,"click",(t=>{t.stopPropagation(),e.faceDetect(!1)}))),o.aiObject&&(i(t.$objectDetect,"click",(t=>{t.stopPropagation(),e.objectDetect(!0)})),i(t.$objectDetectActive,"click",(t=>{t.stopPropagation(),e.objectDetect(!1)}))),o.aiOcclusion&&(i(t.$occlusionDetect,"click",(t=>{t.stopPropagation(),e.occlusionDetect(!0)})),i(t.$occlusionDetectActive,"click",(t=>{t.stopPropagation(),e.occlusionDetect(!1)})));let l=null;const d=()=>{h(),l=setTimeout((()=>{ao(t.$controls,"display","none")}),1e3*e._opt.controlAutoHideDelayTime)},h=()=>{l&&(clearTimeout(l),l=null)};if(e._opt.hasControl&&e._opt.controlAutoHide&&fo()&&(i(e.$container,"mouseover",(()=>{e.fullscreen||(ao(t.$controls,"display","block"),d())})),i(e.$container,"mousemove",(()=>{e.$container&&t.$controls&&(e.fullscreen,"none"===t.$controls.style.display&&(ao(t.$controls,"display","block"),d()))})),i(e.$container,"mouseout",(()=>{h(),ao(t.$controls,"display","none")}))),e._opt.playType===w){let S=e._opt.playbackConfig.controlType;e._opt.playbackConfig.showRateBtn&&(i(t.$speedMenu,"mouseover",(()=>{t.$speedMenuList.classList.add("jb-pro-speed-menu-shown")})),i(t.$speedMenu,"mouseout",(()=>{t.$speedMenuList.classList.remove("jb-pro-speed-menu-shown")})),i(t.$speedMenuList,"click",(t=>{const i=Qo(t);if(i.matches("div.jb-pro-speed-menu-item")){const t=i.dataset;e.emit(at.playbackPreRateChange,t.speed)}}))),S===X.normal?(i(t.$playbackNarrow,"click",(t=>{t.stopPropagation(),e.playback&&e.playback.narrowPrecision()})),i(t.$playbackExpand,"click",(t=>{t.stopPropagation(),e.playback&&e.playback.expandPrecision()})),i(t.$playbackTimeList,"click",(t=>{const i=Qo(t);i.matches("div.jb-pro-playback-time-minute-one")&&e.playback&&e.playback.seek(i.dataset)})),e._opt.playbackConfig.supportWheel&&i(t.$playbackTimeInner,"wheel",(t=>{t.preventDefault(),(t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3)>0?e.playback&&e.playback.expandPrecision():e.playback&&e.playback.narrowPrecision()}))):S===X.simple&&(t.isDroging=!1,i(t.$playbackProgress,"click",(i=>{if(i.target!==t.$playbackProgressIndicator){let s=0,r=0;if(e.isInWebFullscreen())s=i.touches[0].clientY/e.height,r=s*e.playback.totalDuration;else{const o=oc(t,e.playback.totalDuration,i);s=o.percentage,r=o.second}e.playback&&e.playback.seek({time:r})}})),i(t.$playbackProgress,"mousemove",(i=>{ao(t.$playbackProgressTip,"display","block");const{width:s,time:r}=oc(t,e.playback.totalDuration,i);t.$playbackProgressTip.innerHTML=r;const o=t.$playbackProgressTip.clientWidth;s<=o/2?ao(t.$playbackProgressTip,"left",0):s>t.$playbackProgress.clientWidth-o/2?ao(t.$playbackProgressTip,"left",t.$playbackProgress-o+"px"):ao(t.$playbackProgressTip,"left",s-o/2+"px")})),i(t.$playbackProgress,"mouseout",(()=>{ao(t.$playbackProgressTip,"display","none")})),i(t.$playbackProgressIndicator,"mousedown",(e=>{t.isDroging=!0})),i(t.$playbackProgress,"mousemove",(i=>{if(t.isDroging){const{second:s,percentage:r}=oc(t,e.playback.totalDuration,i);e.playback&&e.playback.seek({time:s})}})),i(t.$playbackProgress,"mouseup",(e=>{t.isDroging&&(t.isDroging=!1)})))}o.quality&&(i(t.$qualityMenu,"mouseover",(()=>{t.$qualityMenuList.classList.add("jb-pro-quality-menu-shown")})),i(t.$qualityMenu,"mouseout",(()=>{t.$qualityMenuList.classList.remove("jb-pro-quality-menu-shown")})),i(t.$qualityMenuList,"click",(t=>{const i=Qo(t);if(i.matches("div.jb-pro-quality-menu-item")){const t=i.dataset;e.streamQuality=t.quality}}))),o.scale&&(i(t.$scaleMenu,"mouseover",(()=>{t.$scaleMenuList.classList.add("jb-pro-scale-menu-shown")})),i(t.$scaleMenu,"mouseout",(()=>{t.$scaleMenuList.classList.remove("jb-pro-scale-menu-shown")})),i(t.$scaleMenuList,"click",(t=>{const i=Qo(t);if(i.matches("div.jb-pro-scale-menu-item")){const t=i.dataset;e.setScaleMode(t.scale)}}))),o.zoom&&(i(t.$zoom,"click",(t=>{t.stopPropagation(),e.zooming=!0})),i(t.$zoomStop,"click",(t=>{t.stopPropagation(),e.zooming=!1}))),i(t.$zoomExpand,"click",(t=>{t.stopPropagation(),e.zoom&&e.zoom.expandPrecision()})),i(t.$zoomNarrow,"click",(t=>{t.stopPropagation(),e.zoom&&e.zoom.narrowPrecision()})),i(t.$zoomStop2,"click",(t=>{t.stopPropagation(),e.zooming=!1})),o.close&&i(t.$close,"click",(t=>{t.stopPropagation(),e.doDestroy()})),i(t.$tipsMessageClose,"click",(e=>{e.stopPropagation(),t.$tipsMessageContent.innerHTML="",ao(t.$tipsMessage,"display","none")}))})(e,this),e._opt.hotKey&&fo()&&((e,t)=>{const{events:{proxy:i}}=e;let s={};function r(e,t){s[e]?s[e].push(t):s[e]=[t]}t.keys=s,r(_i,(()=>{e.fullscreen&&(e.fullscreen=!1)})),r(wi,(()=>{e.volume+=.05})),r(Si,(()=>{e.volume-=.05})),i(window,"keydown",(e=>{if(t.isFocus){const t=document.activeElement.tagName.toUpperCase(),i=document.activeElement.getAttribute("contenteditable");if("INPUT"!==t&&"TEXTAREA"!==t&&""!==i&&"true"!==i){const t=s[e.keyCode];t&&(e.preventDefault(),t.forEach((e=>e())))}}}))})(e,this),this.btnIndex=0,this.initLoadingBackground(),Jo(e._opt.loadingIconStyle)&&this.initLoadingIconStyle(e._opt.loadingIconStyle),Jo(e._opt.ptzPositionConfig)&&this.updatePtzPosition(e._opt.ptzPositionConfig),this.kbpsShow="0 KB/s",this.player.debugLog("Control","init")}destroy(){if(this.$performancePanel){this.$performancePanel.innerHTML="";if(!hc(this.$performancePanel)){const e=this.player.$container.querySelector(".jb-pro-performance-panel");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$performancePanel}if(this.$poster){if(!hc(this.$poster)){const e=this.player.$container.querySelector(".jb-pro-poster");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$poster}if(this.$loading){if(!hc(this.$loading)){const e=this.player.$container.querySelector(".jb-pro-loading");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$loading}if(this.$loadingBg){if(!hc(this.$loadingBg)){const e=this.player.$container.querySelector(".jb-pro-loading-bg");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$loadingBg}if(this.$controls){if(!hc(this.$controls)){const e=this.player.$container.querySelector(".jb-pro-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$controls}if(this.$playBig){if(!hc(this.$playBig)){const e=this.player.$container.querySelector(".jb-pro-play-big");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$playBig}if(this.$recording){if(!hc(this.$recording)){const e=this.player.$container.querySelector(".jb-pro-recording");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$recording}if(this.$ptzControl){if(!hc(this.$ptzControl)){const e=this.player.$container.querySelector(".jb-pro-ptz-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$ptzControl}if(this.$zoomControls){if(!hc(this.$zoomControls)){const e=this.player.$container.querySelector(".jb-pro-zoom-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$zoomControls}if(this.$contextmenus){this.$contextmenus.innerHTML="";if(!hc(this.$contextmenus)){const e=this.player.$container.querySelector(".jb-pro-contextmenus");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$contextmenus}if(this.$tipsMessage){if(!hc(this.$tipsMessage)){const e=this.player.$container.querySelector(".jb-pro-tips-message");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$tipsMessage}if(this.$extendDom){if(!hc(this.$extendDom)){const e=this.player.$container.querySelector(".jb-pro-extend-dom");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$extendDom}try{delete this.$tipsMessageContent,delete this.$tipsMessageClose,delete this.$playbackProgressTime,delete this.$playbackProgressIndicator,delete this.$playbackProgressPlayed,delete this.$playbackProgressHover,delete this.$$playbackProgressTip,delete this.$playbackProgress,delete this.$logSave,delete this.$speedMenuList,delete this.$speedMenu,delete this.$speedText,delete this.$contextmenus,delete this.$occlusionDetectActive,delete this.$occlusionDetect,delete this.$objectDetectActive,delete this.$objectDetect,delete this.$faceDetectActive,delete this.$faceDetect,delete this.$performanceActive,delete this.$performance,delete this.$performancePanel,delete this.$zoomControls,delete this.$close,delete this.$zoomStop2,delete this.$zoomExpand,delete this.$zoomNarrow,delete this.$zoomStop,delete this.$zoom,delete this.$scaleMenuList,delete this.$scaleMenu,delete this.$scaleText,delete this.$qualityMenuList,delete this.$qualityMenu,delete this.$qualityText,delete this.$ptzWiperClose,delete this.$ptzWiperOpen,delete this.$ptzFogClose,delete this.$ptzFogOpen,delete this.$ptzCruisePause,delete this.$ptzCruisePlay,delete this.$ptzFocusNear,delete this.$ptzFocusFar,delete this.$ptzApertureNear,delete this.$ptzApertureFar,delete this.$ptzNarrow,delete this.$ptzExpand,delete this.$ptzArrows,delete this.$ptzControlCircular,delete this.$ptzBgActive,delete this.$ptzControl,delete this.$ptzActive,delete this.$ptz,delete this.$playbackExpand,delete this.$playbackNarrow,delete this.$controlsPlaybackBtns,delete this.$playbackCurrentTimeText,delete this.$playbackCurrentTime,delete this.$playbackTimeListSecond,delete this.$playbackTimeListOne,delete this.$playbackTimeList,delete this.$playbackTimeScroll,delete this.$playbackTimeInner,delete this.$playbackTime,delete this.$controlHtml,delete this.$speed,delete this.$screenshot,delete this.$recordStop,delete this.$record,delete this.$fullscreenExit,delete this.$fullscreen,delete this.$volumeOff,delete this.$volumeOn,delete this.$volumeHandle,delete this.$volumePanel,delete this.$volumePanelText,delete this.$volumePanelWrap,delete this.$volume,delete this.$controlsRight,delete this.$controlsLeft,delete this.$controlsInner,delete this.$controls,delete this.$pause,delete this.$recordingStop,delete this.$recordingTime,delete this.$recording,delete this.$playBig,delete this.$play,delete this.$loadingText,delete this.$loading,delete this.$loadingBgImage,delete this.$loadingBg,delete this.$poster,delete this.$extendDom,delete this.controlsRect,delete this.controlsInnerRect,delete this.controlsLeftRect,delete this.controlsRightRect,delete this.controlsPlaybackTimeInner,delete this.controlsPlaybackBtnsRect}catch(e){}this.keys=null,this.btnIndex=0,this.extendBtnList=[],this.kbpsShow="0 KB/s",this.player.$container&&(this.player.$container.classList.remove("jb-pro-controls-show-auto-hide"),this.player.$container.classList.remove("jb-pro-controls-show")),this.player.debugLog("Control","destroy")}getBtnIndex(){return this.btnIndex++}autoSize(){const e=this.player;e.$container.style.padding="0 0";const t=e.width,i=e.height,s=t/i,r=e.video.$videoElement.width/e.video.$videoElement.height;if(s>r){const s=(t-i*r)/2;e.$container.style.padding=`0 ${s}px`}else{const s=(i-t/r)/2;e.$container.style.padding=`${s}px 0`}}initLoadingBackground(){const e=this.player;e._opt.loadingBackground&&e._opt.loadingBackgroundWidth&&e._opt.loadingBackgroundHeight&&(e.debugLog("Control","initLoadingBackground()"),"default"===this.player._opt.aspectRatio||po()?(e.getRenderType()===H||e.getRenderType()===J)&&this._initLoadingBackground():this._initLoadingBackgroundForRatio(),lc(this.$loadingBg,"display","block"),e._opt.loadingBackground="")}resizeLoadingBackground(){this.$loadingBgImage.src&&this.$loadingBgImage.width>0&&this.$loadingBgImage.height>0&&"none"!==no(this.$loadingBg,"display",!1)&&("default"===this.player._opt.aspectRatio||po()?(this.player.getRenderType()===H||this.player.getRenderType()===J)&&this._resizeLoadingBackground():this._resizeLoadingBackgroundForRatio())}initLoadingIconStyle(e){const t=this.player.$container.querySelector(".jb-pro-icon-loading");t&&(e.width&&lc(t,"width",`${e.width}px`),e.height&&lc(t,"height",`${e.height}px`),e.background&&lc(t,"backgroundImage",`url("${e.background}")`),!1===e.hasAnimation&&(lc(t,"animationName","none"),lc(t,"animationDuration",0),lc(t,"animationTimingFunction","ease"),lc(t,"animationIterationCount",1)))}_initLoadingBackgroundForRatio(){const e=this.player._opt.aspectRatio.split(":").map(Number);let t=this.player.width,i=this.player.height;const s=this.player._opt;let r=0;this.player.isControlBarShow()&&(r=s.playType===w?Xt:Qt,i-=r);const o=this.player._opt.loadingBackgroundWidth,a=this.player._opt.loadingBackgroundHeight,n=o/a,l=e[0]/e[1];if(this.player._opt.loadingBackground&&(this.$loadingBgImage.src=this.player._opt.loadingBackground),n>l){const e=l*a/o;this.$loadingBgImage.style.width=100*e+"%",this.$loadingBgImage.style.height=`calc(100% - ${r}px)`,this.$loadingBgImage.style.padding=`0 ${(t-t*e)/2}px`}else{const e=o/l/a;this.$loadingBgImage.style.width="100%",this.$loadingBgImage.style.height=`calc(${100*e}% - ${r}px)`,this.$loadingBgImage.style.padding=(i-i*e)/2+"px 0"}}_initLoadingBackground(){const e=this.player;let t=e.height;const i=e._opt;if(this.player.isControlBarShow()){t-=i.playType===w?Xt:Qt}let s=e.width,r=t;const o=i.rotate;270!==o&&90!==o||(s=t,r=e.width),this.$loadingBgImage.width=s,this.$loadingBgImage.height=r,e._opt.loadingBackground&&(this.$loadingBgImage.src=e._opt.loadingBackground);let a=(e.width-s)/2,n=(t-r)/2,l="contain";i.isResize||(l="fill"),i.isFullResize&&(l="none");let d="";"none"===i.mirrorRotate&&o&&(d+=" rotate("+o+"deg)"),"level"===i.mirrorRotate?d+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(d+=" rotateX(180deg)"),this.player._opt.videoRenderSupportScale&&(this.$loadingBgImage.style.objectFit=l),this.$loadingBgImage.style.transform=d,this.$loadingBgImage.style.padding="0",this.$loadingBgImage.style.left=a+"px",this.$loadingBgImage.style.top=n+"px"}_resizeLoadingBackground(){this._initLoadingBackground()}_resizeLoadingBackgroundForRatio(){this._initLoadingBackgroundForRatio()}_validateExtendBtn(e){let t=!0;if(e.name||(this.player.debugWarn("Control","extend button name is required"),t=!1),t){-1!==this.extendBtnList.findIndex((t=>t.name===e.name))&&(this.player.debugWarn("Control",`extend button name: ${e.name} is already exist`),t=!1)}return t&&(e.icon||(this.player.debugWarn("Control","extend button icon is required"),t=!1)),t}addExtendBtn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=ua(Ss);if(e=Object.assign({},t,e),!this._validateExtendBtn(e))return;const i=e.name||"",s=this.$controlsRight,r=e.createdMoment||Cr,o=e.activeIcon&&e.activeClick,a=`\n
\n ${e.icon?`
\n \n ${e.iconTitle?`\n ${e.iconTitle}\n `:""}\n
`:""}\n ${e.activeIcon?`
\n \n ${e.activeIconTitle?`\n ${e.activeIconTitle}\n `:""}\n
`:""}\n
\n `,n=Array.from(s.children)[e.index];n?n.insertAdjacentHTML("beforebegin",a):nc(s,a);const l=s.querySelector(`.jb-pro-controls-item-wrap-${i}`),d=e.icon?s.querySelector(`.jb-pro-icon-extend-${i}`):null,h=e.icon?s.querySelector(`.jb-pro-control-extend-${i}`):null,c=e.activeIcon?s.querySelector(`.jb-pro-icon-extend-${i}-active`):null,u=e.activeIcon?s.querySelector(`.jb-pro-control-extend-${i}-active`):null,{events:{proxy:p},debug:f}=this.player;e.icon&&(lc(d,"background",`url(${e.icon}) no-repeat center`),lc(d,"background-size","100% 100%"),lc(h,"display",r===kr?"flex":"none"),e.iconHover&&(p(d,"mouseover",(()=>{lc(d,"background",`url(${e.iconHover}) no-repeat center`),lc(d,"background-size","100% 100%")})),p(d,"mouseout",(()=>{lc(d,"background",`url(${e.icon}) no-repeat center`),lc(d,"background-size","100% 100%")})))),e.activeIcon&&(lc(c,"background",`url(${e.activeIcon}) no-repeat center`),lc(c,"background-size","100% 100%"),lc(u,"display","none"),e.activeIconHover&&(p(c,"mouseover",(()=>{lc(c,"background",`url(${e.activeIconHover}) no-repeat center`),lc(c,"background-size","100% 100%")})),p(c,"mouseout",(()=>{lc(c,"background",`url(${e.activeIcon}) no-repeat center`),lc(c,"background-size","100% 100%")})))),e.click&&d&&p(d,"click",(t=>{t.preventDefault(),o&&(lc(h,"display","none"),lc(u,"display","flex")),this.player.isInMulti()?e.click.call(this.player,t,this.player._opt.multiIndex):e.click.call(this.player,t)})),e.activeClick&&c&&p(c,"click",(t=>{t.preventDefault(),lc(h,"display","flex"),lc(u,"display","none"),this.player.isInMulti()?e.activeClick.call(this.player,t,this.player._opt.multiIndex):e.activeClick.call(this.player,t)})),this.extendBtnList.push({name:i,createdMoment:r,$iconContainer:l,$iconWrap:h,$activeIconWrap:u})}toggleExtendBtn(e,t){const i=this.extendBtnList.find((t=>t.name===e));i&&i.$activeIconWrap&&i.$iconWrap&&(Io(t)||(t="none"===no(i.$activeIconWrap,"display",!1)),t?(lc(i.$iconWrap,"display","none"),lc(i.$activeIconWrap,"display","flex")):(lc(i.$iconWrap,"display","flex"),lc(i.$activeIconWrap,"display","none")))}getExtendBtnActive(e){const t=this.extendBtnList.find((t=>t.name===e));let i=!1;return t&&t.$activeIconWrap&&(i="none"!==no(t.$activeIconWrap,"display",!1)),i}addExtendDom(e){if(e.html){const t=`\n
\n ${e.html}\n
\n `;this.player.$container.insertAdjacentHTML("beforeend",t),Object.defineProperty(this,"$extendDom",{value:this.player.$container.querySelector(".jb-pro-extend-dom"),configurable:!0}),e.showBeforePlay&&lc(this.$extendDom,"display","block")}}toggleExtendDom(e){this.$extendDom&&(Io(e)||(e="none"===no(this.$extendDom,"display",!1)),lc(this.$extendDom,"display",e?"block":"none"))}updateExtendDom(e){this.$extendDom&&(this.$extendDom.innerHTML=e)}removeExtendDom(){this.$extendDom&&(this.$extendDom.innerHTML="")}updateLoadingText(e){this.$loadingText&&(this.$loadingText.innerText=e)}getExtendBtnList(){return this.extendBtnList}showTipsMessage(e,t){const i=this.$tipsMessage,s=this.$tipsMessageContent;if(i){const r=`\n
${e}
\n ${t?`
Error Type:${t}
`:""}\n `;s.innerHTML=r,lc(i,"display","block")}}hideTipsMessage(){const e=this.$tipsMessage,t=this.$tipsMessageContent;e&&(t.innerHTML="",lc(e,"display","none"))}updatePtzPosition(e){const t=this.$ptzControl;if(Jo(e)&&t){let i="auto";e.left&&(i=Number(e.left)===e.left?e.left+"px":e.left),lc(t,"left",i);let s="auto";e.top&&(s=Number(e.top)===e.top?e.top+"px":e.top),lc(t,"top",s);let r="auto";e.bottom&&(r=Number(e.bottom)===e.bottom?e.bottom+"px":e.bottom),lc(t,"bottom",r);let o="auto";e.right&&(o=Number(e.right)===e.right?e.right+"px":e.right),lc(t,"right",o)}}showPlayBtn(){lc(this.$playBig,"display","block")}toggleBar(e){this.$controls&&(Io(e)||(e="none"===no(this.$controls,"display",!1)),lc(this.$controls,"display",e?"flex":"none"))}getBarIsShow(){let e=!1;return this.$controls&&(e="none"!==no(this.$controls,"display",!1)),e}toggleControlHtml(e){this.$controlHtml&&(Io(e)||(e="none"===no(this.$controlHtml,"display",!1)),lc(this.$controlHtml,"display",e?"block":"none"))}getControlHtmlIsShow(){let e=!1;return this.$controlHtml&&(e="none"!==no(this.$controlHtml,"display",!1)),e}getExtendDomIsShow(){let e=!1;return this.$extendDom&&(e="none"!==no(this.$extendDom,"display",!1)),e}getExtendDom(){return this.$extendDom?this.$extendDom:null}getControlHtml(){return this.$controlHtml?this.$controlHtml:null}}uc(".jb-pro-container{position:relative;width:100%;height:100%;overflow:hidden}.jb-pro-container.jb-pro-fullscreen-web{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;width:100vw!important;height:100vh!important;background:#000}.jb-pro-container .jb-pro-loading-bg-for-ios{position:absolute;z-index:100;left:0;top:0;right:0;bottom:0;height:100%;width:100%;opacity:0;visibility:hidden;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jb-pro-container .jb-pro-loading-bg-for-ios.show{opacity:1;visibility:visible}");var fc=e=>{const{_opt:t,events:{proxy:i}}=e;if(t.supportDblclickFullscreen&&i(e.$container,"dblclick",(t=>{const i=Qo(t).nodeName.toLowerCase();"canvas"!==i&&"video"!==i||(e.fullscreen=!e.fullscreen)})),i(document,"visibilitychange",(()=>{e.visibility="visible"===document.visibilityState,e.debugLog("visibilitychange",document.visibilityState),t.hiddenAutoPause&&(e.debugLog("visibilitychange","hiddenAutoPause is true ",document.visibilityState,e._isPlayingBeforePageHidden),"visible"===document.visibilityState?e._isPlayingBeforePageHidden&&e.play():(e._isPlayingBeforePageHidden=e.playing,e.playing&&e.pause()))})),fo()&&i(document,["click","contextmenu"],(t=>{dc(t,e.$container)?(ga(e._opt.disableContextmenu)&&"contextmenu"===t.type&&t.preventDefault(),e.isInput="INPUT"===t.target.tagName,e.isFocus=!0,e.emit(at.focus)):(e.isInput=!1,e.isFocus=!1,e.emit(at.blur))})),t.isCheckInView){const t=Eo((()=>{e.emit(at.inView,function(e){const t=e.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight,s=window.innerWidth||document.documentElement.clientWidth,r=t.top<=i&&t.top+t.height>=0,o=t.left<=s&&t.left+t.width>=0;return r&&o}(e.$container))}),200);i(window,"scroll",(()=>t()))}if(t.orientationChangeResize){const t=Eo((()=>{e.emit(at.resize)}),500);i(window,"orientationchange",(()=>{t()})),screen&&screen.orientation&&screen.orientation.onchange&&i(screen.orientation,"change",(()=>{t()}))}};class mc{static init(){mc.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in mc.types)mc.types.hasOwnProperty(e)&&(mc.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=mc.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,s=Array.prototype.slice.call(arguments,1),r=s.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let o=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return mc.box(mc.types.trak,mc.tkhd(e),mc.mdia(e))}static tkhd(e){let t=e.id,i=e.duration,s=e.presentWidth,r=e.presentHeight;return mc.box(mc.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>>8&255,255&s,0,0,r>>>8&255,255&r,0,0]))}static mdia(e){return mc.box(mc.types.mdia,mc.mdhd(e),mc.hdlr(e),mc.minf(e))}static mdhd(e){let t=e.timescale,i=e.duration;return mc.box(mc.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?mc.constants.HDLR_AUDIO:mc.constants.HDLR_VIDEO,mc.box(mc.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?mc.box(mc.types.smhd,mc.constants.SMHD):mc.box(mc.types.vmhd,mc.constants.VMHD),mc.box(mc.types.minf,t,mc.dinf(),mc.stbl(e))}static dinf(){return mc.box(mc.types.dinf,mc.box(mc.types.dref,mc.constants.DREF))}static stbl(e){return mc.box(mc.types.stbl,mc.stsd(e),mc.box(mc.types.stts,mc.constants.STTS),mc.box(mc.types.stsc,mc.constants.STSC),mc.box(mc.types.stsz,mc.constants.STSZ),mc.box(mc.types.stco,mc.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?mc.box(mc.types.stsd,mc.constants.STSD_PREFIX,mc.mp3(e)):mc.box(mc.types.stsd,mc.constants.STSD_PREFIX,mc.mp4a(e)):"avc"===e.videoType?mc.box(mc.types.stsd,mc.constants.STSD_PREFIX,mc.avc1(e)):mc.box(mc.types.stsd,mc.constants.STSD_PREFIX,mc.hvc1(e))}static mp3(e){let t=e.channelCount,i=e.audioSampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return mc.box(mc.types[".mp3"],s)}static mp4a(e){let t=e.channelCount,i=e.audioSampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return mc.box(mc.types.mp4a,s,mc.esds(e))}static esds(e){let t=e.config||[],i=t.length,s=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return mc.box(mc.types.esds,s)}static avc1(e){let t=e.avcc;const i=e.codecWidth,s=e.codecHeight;let r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return mc.box(mc.types.avc1,r,mc.box(mc.types.avcC,t))}static hvc1(e){let t=e.avcc;const i=e.codecWidth,s=e.codecHeight;let r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return mc.box(mc.types.hvc1,r,mc.box(mc.types.hvcC,t))}static mvex(e){return mc.box(mc.types.mvex,mc.trex(e))}static trex(e){let t=e.id,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return mc.box(mc.types.trex,i)}static moof(e,t){return mc.box(mc.types.moof,mc.mfhd(e.sequenceNumber),mc.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return mc.box(mc.types.mfhd,t)}static traf(e,t){let i=e.id,s=mc.box(mc.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),r=mc.box(mc.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),o=mc.sdtp(e),a=mc.trun(e,o.byteLength+16+16+8+16+8+8);return mc.box(mc.types.traf,s,r,a,o)}static sdtp(e){let t=new Uint8Array(5),i=e.flags;return t[4]=i.isLeading<<6|i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy,mc.box(mc.types.sdtp,t)}static trun(e,t){let i=new Uint8Array(28);t+=36,i.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let s=e.duration,r=e.size,o=e.flags,a=e.cts;return i.set([s>>>24&255,s>>>16&255,s>>>8&255,255&s,r>>>24&255,r>>>16&255,r>>>8&255,255&r,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12),mc.box(mc.types.trun,i)}static mdat(e){return mc.box(mc.types.mdat,e)}}mc.init();class gc extends o{constructor(e){super(),this.TAG_NAME="MediaSource",this.player=e,this._resetInIt(),this._useManagedMediaSource="ManagedMediaSource"in self&&!("MediaSource"in self),this.mediaSource=this._useManagedMediaSource?new self.ManagedMediaSource:new self.MediaSource,this.isDecodeFirstIIframe=!!ya(e._opt.checkFirstIFrame),this.mediaSourceObjectURL=null,this._useManagedMediaSource||(this.mediaSourceObjectURL=window.URL.createObjectURL(this.mediaSource)),this.isSupportVideoFrameCallback=Ta(),this.canvasRenderInterval=null,e._opt.mseUseCanvasRender?(this.$videoElement=document.createElement("video"),this._useManagedMediaSource?(this.$videoElement.disableRemotePlayback=!0,this.$videoElement.srcObject=this.mediaSource):this.$videoElement.src=this.mediaSourceObjectURL,this.initVideoEvents()):(this._useManagedMediaSource?(this.player.video.$videoElement.disableRemotePlayback=!0,this.player.video.$videoElement.srcObject=this.mediaSource):this.player.video.$videoElement.src=this.mediaSourceObjectURL,this.$videoElement=this.player.video.$videoElement),this._bindMediaSourceEvents(),this.audioSourceBufferCheckTimeout=null,this.audioSourceNoDataCheckTimeout=null,this.hasPendingEos=!1,this.player.isPlayback()&&this.player.on(at.playbackPause,(t=>{ya(t)?(e._opt.isPlaybackPauseClearCache&&(ga(e._opt.checkFirstIFrame)&&(this.player.debugLog(this.TAG_NAME,"playbackPause is false and _opt.checkFirstIFrame is true so set isDecodeFirstIIframe = false"),this.isDecodeFirstIIframe=!1),this.clearUpAllSourceBuffer()),this.$videoElement.play()):(this.$videoElement.pause(),this.cacheTrack={})})),this._useManagedMediaSource?this.player.debugLog(this.TAG_NAME,"init and using ManagedMediaSource"):this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.stop(),this._clearAudioSourceBufferCheckTimeout(),this._clearAudioNoDataCheckTimeout(),this._stopCanvasRender(),this.eventListenList.length&&(this.eventListenList.forEach((e=>e())),this.eventListenList=[]),this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.$videoElement&&(this.player._opt.mseUseCanvasRender&&(this.$videoElement.pause&&(this.$videoElement.pause(),this.$videoElement.muted=!0),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"))),this.$videoElement=null),this.mediaSourceObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceObjectURL),this.mediaSourceObjectURL=null),this._resetInIt(),this.mediaSource=null,this.off(),this.player.debugLog(this.TAG_NAME,"destroy")}needInitAudio(){return this.player._opt.hasAudio&&this.player._opt.mseDecodeAudio}_resetInIt(){this.isAvc=null,this.isAAC=null,this.videoMeta={},this.audioMeta={},this.sourceBuffer=null,this.audioSourceBuffer=null,this.hasInit=!1,this.hasAudioInit=!1,this.isInitInfo=!1,this.isAudioInitInfo=!1,this.audioMimeType="",this.videoMimeType="",this.cacheTrack={},this.cacheAudioTrack={},this.sequenceNumber=0,this.audioSequenceNumber=0,this.firstRenderTime=null,this.firstAudioTime=null,this.$videoElement=null,this.mediaSourceAppendBufferFull=!1,this.mediaSourceAppendBufferError=!1,this.mediaSourceAddSourceBufferError=!1,this.mediaSourceBufferError=!1,this.mediaSourceError=!1,this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.prevAudioDts=null,this.prevPayloadBufferSize=0,this.isWidthOrHeightChanged=!1,this.prevTs=null,this.prevAudioTs=null,this.eventListenList=[],this.pendingRemoveRanges=[],this.pendingSegments=[],this.pendingAudioRemoveRanges=[],this.pendingAudioSegments=[],this.supportVideoFrameCallbackHandle=null}get state(){return this.mediaSource&&this.mediaSource.readyState}get isStateOpen(){return this.state===bi}get isStateClosed(){return this.state===vi}get isStateEnded(){return this.state===Ai}get duration(){return this.mediaSource&&this.mediaSource.duration||-1}set duration(e){this.mediaSource.duration=e}_bindMediaSourceEvents(){const{events:{proxy:e}}=this.player,t=e(this.mediaSource,Ji,(()=>{this.player.debugLog(this.TAG_NAME,"sourceOpen"),this._onMediaSourceSourceOpen(),this.player.emit(at.mseSourceOpen)})),i=e(this.mediaSource,Hi,(()=>{this.player.debugLog(this.TAG_NAME,"sourceClose"),this.player.emit(at.mseSourceClose)})),s=e(this.mediaSource,qi,(()=>{this.player.debugLog(this.TAG_NAME,"sourceended"),this.player.emit(at.mseSourceended)}));this.eventListenList.push(t,i,s);const r=e(this.$videoElement,es,(e=>{if(ya(this.isSupportVideoFrameCallback))if(this.player.checkIsInRender())this.player.handleRender();else{const t=parseInt(e.timeStamp,10);this.player.debugLog(this.TAG_NAME,`mseUseCanvasRender is ${this.player._opt.mseUseCanvasRender} and\n $videoElement ts is ${t}, but not in render and vbps is ${this.player._stats.vbps} and fps is ${this.player._stats.fps}`)}}));if(this.eventListenList.push(r),this._useManagedMediaSource){const t=e(this.mediaSource,Ki,(()=>{this.player.debugLog(this.TAG_NAME,"ManagedMediaSource startstreaming"),this.player.emit(at.mseSourceStartStreaming)})),i=e(this.mediaSource,Yi,(()=>{this.player.debugLog(this.TAG_NAME,"ManagedMediaSource endstreaming"),this.player.emit(at.mseSourceEndStreaming)})),s=e(this.mediaSource,Qi,(()=>{this.player.debugLog(this.TAG_NAME,"ManagedMediaSource qualitychange")}));this.eventListenList.push(t,i,s)}}_onMediaSourceSourceOpen(){this.sourceBuffer||(this.player.debugLog("MediaSource","onMediaSourceSourceOpen() sourceBuffer is null and next init"),this._initSourceBuffer()),this.audioSourceBuffer||(this.player.debugLog("MediaSource","onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),this._initAudioSourceBuffer()),this._hasPendingSegments()&&this._doAppendSegments()}initVideoEvents(){const{proxy:e}=this.player.events;this.player.on(at.visibilityChange,(e=>{e&&setTimeout((()=>{if(this.player.isPlaying()&&this.$videoElement){const e=this.getVideoBufferLastTime();e-this.$videoElement.currentTime>this.getMseBufferMaxDelayTime()&&(this.player.debugLog(this.TAG_NAME,`visibilityChange is true and lastTime is ${e} and currentTime is ${this.$videoElement.currentTime} so set currentTime to lastTime`),this.$videoElement.currentTime=e)}}),300)}));const t=e(this.$videoElement,Xi,(()=>{this.player.debugLog(this.TAG_NAME,"video canplay"),this.$videoElement.play().then((()=>{this.player.emit(at.removeLoadingBgImage),Ta()?this.supportVideoFrameCallbackHandle||(this.player.debugLog(this.TAG_NAME,"video canplay and requestVideoFrameCallback and use videoFrameCallback"),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))):this.player.isUseHls265()&&(this.player.debugLog(this.TAG_NAME,"video canplay and use canvas render and fps is 25"),this._stopCanvasRender(),this.canvasRenderInterval=setInterval((()=>{this.player.video.render({$video:this.$videoElement,ts:parseInt(1e3*this.$videoElement.currentTime,10)||0})}),40)),this.player.debugLog(this.TAG_NAME,"video play")})).catch((e=>{this.player.debugError(this.TAG_NAME,"video play error ",e),this.player.emitError(dt.mediaSourceUseCanvasRenderPlayFailed,`code is ${e.code} and message is ${e.message}`)}))})),i=e(this.$videoElement,Zi,(()=>{this.player.debugLog(this.TAG_NAME,"video waiting")})),s=e(this.$videoElement,es,(e=>{parseInt(e.timeStamp,10),this.$videoElement.paused&&(this.player.debugWarn(this.TAG_NAME,"video is paused and next try to replay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video is paused and replay success")})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video is paused and replay error ",e)})))})),r=e(this.$videoElement,ts,(()=>{this.player.debugLog(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate),this.$videoElement&&this.$videoElement.paused&&this.player.debugWarn(this.TAG_NAME,"ratechange and video is paused")}));this.eventListenList.push(t,i,s,r)}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())return void this.player.debugLog(this.TAG_NAME,"videoFrameCallback() player is destroyed");const i=parseInt(1e3*Math.max(t.mediaTime,this.$videoElement.currentTime),10)||0;this.player.handleRender(),this.player.video.render({$video:this.$videoElement,ts:i}),this.player.isUseHls265()&&this.player.updateStats({fps:!0,ts:i}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}decodeVideo(e,t,i,s){const r=this.player;if(r)if(this.player.isDestroyedOrClosed())this.player.debugWarn(this.TAG_NAME,"decodeVideo() player is destroyed");else if(this.hasInit)if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(i&&0===e[1]){const t=15&e[0];let i={};if(t===At){i=Mn(e.slice(5))}else t===bt&&(i=Jn(e));const s=this.player.video.videoInfo;s&&s.width&&s.height&&i&&i.codecWidth&&i.codecHeight&&(i.codecWidth!==s.width||i.codecHeight!==s.height)&&(this.player.debugWarn(this.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${s.width}, old height is ${s.height},\n new width is ${i.codecWidth}, new height is ${i.codecHeight},\n and emit change event`),this.isWidthOrHeightChanged=!0,this.player.emitError(dt.mseWidthOrHeightChange,`width ${s.width}->${i.codecWidth}, height ${s.height}->${i.codecHeight}`))}if(this.isWidthOrHeightChanged)return void this.player.debugWarn(this.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(ma(e))return void this.player.debugLog(this.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength<12)return void this.player.debugWarn(this.TAG_NAME,`decodeVideo and payload is too small , payload length is ${e.byteLength}`);let r=t;if(this.player.isPlayer()){if(null===this.firstRenderTime&&(this.firstRenderTime=t,this.player.debugLog(this.TAG_NAME,`firstRenderTime is ${this.firstRenderTime}`)),r=t-this.firstRenderTime,r<0&&(this.player.debugWarn(this.TAG_NAME,`decodeVideo\n local dts is < 0 , ts is ${t} and prevTs is ${this.prevTs},\n firstRenderTime is ${this.firstRenderTime} and mseCorrectTimeDuration is ${this.player._opt.mseCorrectTimeDuration}`),r=null===this.prevDts?0:this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(t)))return this.player.debugWarn(this.TAG_NAME,`decodeVideo is max diff , ts is ${t} and prevTs is ${this.prevTs}, diff is ${this.prevTs-t} and emit replay`),void this.player.emitError(dt.mediaSourceTsIsMaxDiff,`decodeVideo is max diff, prevTs is ${this.prevTs} and ts is ${t}`);if(null!==this.prevDts&&r<=this.prevDts){if(this.player.debugWarn(this.TAG_NAME,`\n decodeVideo dts is less than(or equal) prev dts ,\n dts is ${r} and prev dts is ${this.prevDts} ,\n and now ts is ${t} and prev ts is ${this.prevTs} ,\n and diff is ${t-this.prevTs} and firstRenderTime is ${this.firstRenderTime} and isIframe is ${i},\n and mseCorrectTimeDuration is ${this.player._opt.mseCorrectTimeDuration},\n and prevPayloadBufferSize is ${this.prevPayloadBufferSize} and payload size is ${e.byteLength}`),r===this.prevDts&&this.prevPayloadBufferSize===e.byteLength)return void this.player.debugWarn(this.TAG_NAME,"decodeVideo dts is equal to prev dts and payload size is equal to prev payload size so drop this frame");if(r=this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(t))return this.player.debugWarn(this.TAG_NAME,`decodeVideo is max diff , ts is ${t} and prevTs is ${this.prevTs}, diff is ${this.prevTs-t} and emit replay`),void this.emit(dt.mediaSourceTsIsMaxDiff,`decodeVideo is max diff, prevTs is ${this.prevTs} and ts is ${t}`)}}this.player.isPlayer()?this._decodeVideo(e,r,i,s,t):this.player.isPlayback()&&(ya(this.player.playbackPause)?(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this._decodeVideo(e,r,i,s,t)):this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this._decodeVideo(e,r,i,s,t)),this.prevDts=r,this.prevPayloadBufferSize=e.byteLength,this.prevTs=t}else this.player.debugLog(this.TAG_NAME,"decodeVideo first frame is not iFrame");else if(i&&e[1]===As){const s=15&e[0];if(r.video.updateVideoInfo({encTypeCode:s}),s===bt&&ya(Lo()))return void this.player.emitError(dt.mediaSourceH265NotSupport);r._times.decodeStart||(r._times.decodeStart=ro()),this.hasInit=this._decodeConfigurationRecord(e,t,i,s)}else this.player.debugWarn(this.TAG_NAME,`decodeVideo has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)}decodeAudio(e,t){if(this.player)if(this.player.isDestroyedOrClosed())this.player.debugWarn(this.TAG_NAME,"decodeAudio() player is destroyed");else if(ya(this.hasAudioInit))this.hasAudioInit=this._decodeAudioConfigurationRecord(e,t);else{let i=t;if(Or(e))return void this.player.debugLog(this.TAG_NAME,"decodeAudio and has already initialized and payload is aac codec packet so drop this frame");if(this._clearAudioNoDataCheckTimeout(),this.isDecodeFirstIIframe){if(this.player.isPlayer()){if(null===this.firstAudioTime&&(this.firstAudioTime=t,this.player.debugLog(this.TAG_NAME,`firstAudioTime is ${this.firstAudioTime}`)),i=t-this.firstAudioTime,i<0&&(this.player.debugWarn(this.TAG_NAME,`decodeAudio\n local dts is < 0 , ts is ${t} and prevTs is ${this.prevAudioTs},\n firstAudioTime is ${this.firstAudioTime}`),i=null===this.prevAudioDts?0:this.prevAudioDts+this.player._opt.mseCorrectAudioTimeDuration,this._checkAudioTsIsMaxDiff(t)))return this.player.debugWarn(this.TAG_NAME,`decodeAudio is max diff , ts is ${t} and prevTs is ${this.prevAudioDts}, diff is ${this.prevAudioDts-t} and emit replay`),void this.player.emitError(dt.mediaSourceTsIsMaxDiff,`decodeAudio is max diff, prevTs is ${this.prevAudioDts} and ts is ${t}`);null!==this.prevAudioTs&&i<=this.prevAudioDts&&(this.player.debugWarn(this.TAG_NAME,`\n decodeAudio dts is less than(or equal) prev dts ,\n dts is ${i} and prev dts is ${this.prevAudioDts} ,\n and now ts is ${t} and prev ts is ${this.prevAudioTs} ,\n and diff is ${t-this.prevAudioTs}`),i=this.prevAudioDts+this.player._opt.mseCorrectAudioTimeDuration)}(this.player.isPlayer()||this.player.isPlayback()&&(ya(this.player.playbackPause)||this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()))&&this._decodeAudio(e,i,t),this.prevAudioTs=t,this.prevAudioDts=i}else this.player.debugLog(this.TAG_NAME,"decodeAudio first frame is not iFrame")}}_checkTsIsMaxDiff(e){return this.prevTs>0&&eZ}_checkAudioTsIsMaxDiff(e){return this.prevAudioTs>0&&eZ}_decodeConfigurationRecord(e,t,i,s){let r=e.slice(5),o={};if(s===At?o=Mn(r):s===bt&&(o=qn(r)),Ho(o)||0===o.codecWidth&&0===o.codecHeight){this.player.debugWarn(this.TAG_NAME,"_decodeConfigurationRecord",o);let e="";return e=Ho(o)?"config is empty object":`config is not empty object and codecWidth is ${o.codecWidth} and codecHeight is ${o.codecHeight}`,this.player.emitError(dt.mediaSourceDecoderConfigurationError,e),!1}this.isInitInfo||(this.player.debugLog(this.TAG_NAME,`updateVideoInfo: ${o.codecWidth},${o.codecHeight}`),this.player.video.updateVideoInfo({width:o.codecWidth,height:o.codecHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0),this.player.recorder&&this.player._opt.recordType===S&&this.player.recorder.initMetaData(e,s);const a={id:or,type:"video",timescale:1e3,duration:0,avcc:r,codecWidth:o.codecWidth,codecHeight:o.codecHeight,videoType:o.videoType},n=mc.generateInitSegment(a);this.isAvc=s===At;let l=o.codec;return this.videoMimeType=l?`video/mp4; codecs="${o.codec}"`:this.isAvc?ui:pi,this._initSourceBuffer(),this.appendBuffer(n.buffer),this.sequenceNumber=0,this.cacheTrack={},!0}_decodeAudioConfigurationRecord(e,t){const i=e[0]>>4,s=e[0]>>1&1,r=i===Et,o=i===wt;let a="";if(a=o?s?16:8:0===s?8:16,ya(o||r))return this.player.debugWarn(this.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${i} ant auto wasm decode`),this.player.emit(dt.mediaSourceAudioG711NotSupport),!1;const n={id:ar,type:"audio",timescale:1e3};let l={};if(Or(e)){if(l=zr(e.slice(2)),!l)return!1;n.audioSampleRate=l.sampleRate,n.channelCount=l.channelCount,n.config=l.config,n.refSampleDuration=1024/n.audioSampleRate*n.timescale}else{if(!r)return!1;if(l=qh(e),!l)return!1;n.audioSampleRate=l.samplingRate,n.channelCount=l.channelCount,n.refSampleDuration=1152/n.audioSampleRate*n.timescale}n.codec=l.codec,n.duration=0;let d="mp4",h=l.codec,c=null;r&&ya(go())?(d="mpeg",h="",c=new Uint8Array):c=mc.generateInitSegment(n);let u=`${n.type}/${d}`;return h&&h.length>0&&(u+=`;codecs=${h}`),ya(this.isAudioInitInfo)&&(this.player.audio.updateAudioInfo({encTypeCode:i,channels:n.channelCount,sampleRate:n.audioSampleRate,depth:a}),this.isAudioInitInfo=!0),this.audioMimeType=u,this.isAAC=o,this._initAudioSourceBuffer(),this.appendAudioBuffer(c.buffer),!0}_initSourceBuffer(){const{events:{proxy:e}}=this.player;if(null===this.sourceBuffer&&null!==this.mediaSource&&this.isStateOpen&&this.videoMimeType){try{this.sourceBuffer=this.mediaSource.addSourceBuffer(this.videoMimeType),this.player.debugLog(this.TAG_NAME,"_initSourceBuffer() this.mediaSource.addSourceBuffer()",this.videoMimeType)}catch(e){return this.player.debugError(this.TAG_NAME,"appendBuffer() this.mediaSource.addSourceBuffer()",e.code,e),this.player.emitError(dt.mseAddSourceBufferError,`code is ${e.code} and message is ${e.message}`),void(this.mediaSourceAddSourceBufferError=!0)}if(this.sourceBuffer){const t=e(this.sourceBuffer,"error",(e=>{this.mediaSourceBufferError=!0,this.player.debugError(this.TAG_NAME,"mseSourceBufferError this.sourceBuffer",e),this.player.emitError(dt.mseSourceBufferError,e.toString())})),i=e(this.sourceBuffer,"updateend",(()=>{this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this.hasPendingEos&&(this.player.debugLog(this.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),this.endOfStream())}));this.eventListenList.push(t,i)}}else this.player.debugLog(this.TAG_NAME,`_initSourceBuffer and this.isStateOpen is ${this.isStateOpen} and this.isAvc === null is ${null===this.isAvc}`)}_initAudioSourceBuffer(){const{events:{proxy:e}}=this.player;if(null===this.audioSourceBuffer&&null!==this.mediaSource&&this.isStateOpen&&this.audioMimeType){try{this.audioSourceBuffer=this.mediaSource.addSourceBuffer(this.audioMimeType),this._clearAudioSourceBufferCheckTimeout(),this.player.debugLog(this.TAG_NAME,"_initAudioSourceBuffer() this.mediaSource.addSourceBuffer()",this.audioMimeType)}catch(e){return this.player.debugError(this.TAG_NAME,"appendAudioBuffer() this.mediaSource.addSourceBuffer()",e.code,e),this.player.emitError(dt.mseAddSourceBufferError,`code is ${e.code} and message is ${e.message}`),void(this.mediaSourceAddSourceBufferError=!0)}if(this.audioSourceBuffer){const t=e(this.audioSourceBuffer,"error",(e=>{this.mediaSourceBufferError=!0,this.player.debugError(this.TAG_NAME,"mseSourceBufferError this.audioSourceBuffer",e),this.player.emitError(dt.mseSourceBufferError,e.toString())})),i=e(this.audioSourceBuffer,"updateend",(()=>{this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this.hasPendingEos&&(this.player.debugLog(this.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),this.endOfStream())}));this.eventListenList.push(t,i),null===this.audioSourceNoDataCheckTimeout&&(this.audioSourceNoDataCheckTimeout=setTimeout((()=>{this._clearAudioNoDataCheckTimeout(),this.player.emit(dt.mediaSourceAudioNoDataTimeout)}),1e3))}}else this.player.debugLog(this.TAG_NAME,`_initAudioSourceBuffer and this.isStateOpen is ${this.isStateOpen} and this.audioMimeType is ${this.audioMimeType}`)}_decodeVideo(e,t,i,s,r){const o=this.player;let a=e.slice(5),n=a.byteLength;if(0===n)return void o.debugWarn(this.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let l=(new Date).getTime(),d=!1;this.prevTimestamp||(this.prevTimestamp=l,d=!0);const h=l-this.prevTimestamp;this.decodeDiffTimestamp=h,h>1e3&&!d&&this.player.isPlayer()&&o.debugLog(this.TAG_NAME,`_decodeVideo now time is ${l} and prev time is ${this.prevTimestamp}, diff time is ${h} ms`);const c=this.$videoElement;if(this.cacheTrack.id&&t>=this.cacheTrack.dts){let e=8+this.cacheTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(mc.types.mdat,4),i.set(this.cacheTrack.data,8),this.cacheTrack.duration=t-this.cacheTrack.dts,this.cacheTrack.duration>1e3&&this.player.debugWarn(this.TAG_NAME,`cacheTrack duration is ${this.cacheTrack.duration} ms`);let s=mc.moof(this.cacheTrack,this.cacheTrack.dts);this.cacheTrack={};let a=new Uint8Array(s.byteLength+i.byteLength);a.set(s,0),a.set(i,s.byteLength),this.appendBuffer(a.buffer),o.emit(at.timeUpdate,r),o.isPlayer()?o.isUseHls265()?o.updateStats({dfps:!0,mseTs:t}):o.updateStats({fps:!0,dfps:!0,ts:r,mseTs:t}):o.isPlayback()&&o.playback.updateStats({ts:r}),o._times.videoStart||(o._times.videoStart=ro(),o.handlePlayToRenderTimes())}else o.debugLog(this.TAG_NAME,`cacheTrack = {} now dts is ${t}, and ts is ${r} cacheTrack dts is ${this.cacheTrack&&this.cacheTrack.dts}`),this.cacheTrack={};this.cacheTrack||(this.cacheTrack={}),this.cacheTrack.id=or,this.cacheTrack.sequenceNumber=++this.sequenceNumber,this.cacheTrack.size=n,this.cacheTrack.dts=t,this.cacheTrack.cts=s,this.cacheTrack.isKeyframe=i,this.cacheTrack.data=a,this.cacheTrack.flags={isLeading:0,dependsOn:i?2:1,isDependedOn:i?1:0,hasRedundancy:0,isNonSync:i?0:1},o._opt.mseUseCanvasRender&&ya(this.isSupportVideoFrameCallback)&&ya(o.isUseHls265())&&o.video.render({$video:c,ts:t}),this.prevTimestamp=(new Date).getTime()}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}_decodeAudio(e,t,i){const s=this.player;let r=this.isAAC?e.slice(2):e.slice(1),o=r.byteLength;if(this.cacheAudioTrack.id&&t>=this.cacheAudioTrack.dts){let e=8+this.cacheAudioTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(mc.types.mdat,4),i.set(this.cacheAudioTrack.data,8),this.cacheAudioTrack.duration=t-this.cacheAudioTrack.dts;let s=mc.moof(this.cacheAudioTrack,this.cacheAudioTrack.dts);this.cacheAudioTrack={};let r=new Uint8Array(s.byteLength+i.byteLength);r.set(s,0),r.set(i,s.byteLength),this.appendAudioBuffer(r.buffer)}else s.debugLog(this.TAG_NAME,`cacheAudioTrack = {} now dts is ${t} cacheAudioTrack dts is ${this.cacheAudioTrack&&this.cacheAudioTrack.dts}`),this.cacheAudioTrack={};this.cacheAudioTrack||(this.cacheAudioTrack={}),this.cacheAudioTrack.id=ar,this.cacheAudioTrack.sequenceNumber=++this.audioSequenceNumber,this.cacheAudioTrack.size=o,this.cacheAudioTrack.dts=t,this.cacheAudioTrack.cts=0,this.cacheAudioTrack.data=r,this.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}appendBuffer(e){this.player.isDestroyedOrClosed()?this.player.debugWarn(this.TAG_NAME,"appendBuffer() player is destroyed"):(this.player,this.mediaSourceAddSourceBufferError?this.player.debugWarn(this.TAG_NAME,"appendBuffer() this.mediaSourceAddSourceBufferError is true"):this.mediaSourceAppendBufferFull?this.player.debugWarn(this.TAG_NAME,"appendBuffer() this.mediaSourceAppendBufferFull is true"):this.mediaSourceAppendBufferError?this.player.debugWarn(this.TAG_NAME,"appendBuffer() this.mediaSourceAppendBufferError is true"):this.mediaSourceBufferError?this.player.debugWarn(this.TAG_NAME,"appendBuffer() this.mediaSourceBufferError is true"):(this.pendingSegments.push(e),this.sourceBuffer&&(this.player.isPlayer()&&this._handleUpdatePlaybackRate(),this.player.isPlayback()&&(this._handleUpdateBufferDelayTime(),this._checkVideoPlayCurrentTime()),this.player._opt.mseAutoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanUpSourceBuffer(),ya(this.getSourceBufferUpdating())&&this.isStateOpen&&ya(this._hasPendingRemoveRanges()))?this._doAppendSegments():this.isStateClosed?(this.mediaSourceBufferError=!0,this.player.emitError(dt.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):this.isStateEnded&&(this.mediaSourceBufferError=!0,this.player.emitError(dt.mseSourceBufferError,"mediaSource is end"))))}appendAudioBuffer(e){this.player.isDestroyedOrClosed()?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() player is destroyed"):(this.player,this.mediaSourceAddSourceBufferError?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAddSourceBufferError is true"):this.mediaSourceAppendBufferFull?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAppendBufferFull is true"):this.mediaSourceAppendBufferError?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAppendBufferError is true"):this.mediaSourceBufferError?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceBufferError is true"):(this.pendingAudioSegments.push(e),this.audioSourceBuffer&&(this.player.isPlayer()&&this._handleUpdatePlaybackRate(),this.player.isPlayback()&&(this._handleUpdateBufferDelayTime(),this._checkVideoPlayCurrentTime()),this.player._opt.mseAutoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanUpSourceBuffer(),ya(this.getAudioSourceBufferUpdating())&&this.isStateOpen&&ya(this._hasPendingRemoveRanges()))?this._doAppendSegments():this.isStateClosed?(this.mediaSourceBufferError=!0,this.player.emitError(dt.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):this.isStateEnded&&(this.mediaSourceBufferError=!0,this.player.emitError(dt.mseSourceBufferError,"mediaSource is end"))))}getSourceBufferUpdating(){return this.sourceBuffer&&this.sourceBuffer.updating}getAudioSourceBufferUpdating(){return this.audioSourceBuffer&&this.audioSourceBuffer.updating}stop(){this.abortSourceBuffer(),this.removeSourceBuffer(),this.endOfStream()}checkSourceBufferDelay(){const e=this.$videoElement;let t=0,i=0;return e.buffered.length>0&&(i=e.buffered.end(e.buffered.length-1),t=i-e.currentTime),t<0&&(this.player.debugWarn(this.TAG_NAME,`checkMSESourceBufferDelay ${t} < 0, and buffered is ${i} ,currentTime is ${e.currentTime} , try to seek ${e.currentTime} to ${i}`),e.currentTime=i,e.paused&&(this.player.debugWarn(this.TAG_NAME,"checkSourceBufferDelay and video is paused and sent isMSECurrentMoreThanBufferedPause true"),this.player.isMSECurrentMoreThanBufferedPause=!0),t=0),t}checkSourceBufferStore(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.currentTime-e.buffered.start(0)),t}checkSourceBufferEndLessThanCurrentTime(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.buffered.end(e.buffered.length-1)-e.currentTime),t}getDecodeDiffTimes(){return this.decodeDiffTimestamp}removeBuffer(e,t){const i=Xo();if(this.player.debugLog(this.TAG_NAME,`removeBuffer() start is ${e} and end is ${t} and _isMacOsFirefox is ${i}`),this.isStateOpen&&ya(i)){if(ya(this.getSourceBufferUpdating()))try{this.sourceBuffer.remove(e,t)}catch(e){this.player.debugWarn(this.TAG_NAME,"removeBuffer() sourceBuffer error",e)}if(ya(this.getAudioSourceBufferUpdating()))try{this.audioSourceBuffer.remove(e,t)}catch(e){this.player.debugWarn(this.TAG_NAME,"removeBuffer() audioSourceBuffer error",e)}}}clearUpAllSourceBuffer(){if(this.sourceBuffer){const e=this.sourceBuffer.buffered;for(let t=0;t=1)if(this.getSourceBufferUpdating()||this.getAudioSourceBufferUpdating())this.hasPendingEos=!0;else{this.hasPendingEos=!1;try{this.player.debugLog(this.TAG_NAME,"endOfStream()"),this.mediaSource.endOfStream()}catch(e){this.player.debugWarn(this.TAG_NAME,"endOfStream() error",e)}}}abortSourceBuffer(){if(this.isStateOpen){if(this.sourceBuffer){try{this.player.debugLog(this.TAG_NAME,"abortSourceBuffer() abort sourceBuffer"),this.sourceBuffer.abort()}catch(e){}ya(this.getSourceBufferUpdating())&&this._doRemoveRanges()}if(this.audioSourceBuffer){try{this.player.debugLog(this.TAG_NAME,"abortSourceBuffer() abort audioSourceBuffer"),this.audioSourceBuffer.abort()}catch(e){}ya(this.getAudioSourceBufferUpdating())&&this._doRemoveRanges()}}this.sourceBuffer=null,this.audioSourceBuffer=null}removeSourceBuffer(){if(!this.isStateClosed&&this.mediaSource){if(this.sourceBuffer)try{this.player.debugLog(this.TAG_NAME,"removeSourceBuffer() sourceBuffer"),this.mediaSource.removeSourceBuffer(this.sourceBuffer)}catch(e){this.player.debugError(this.TAG_NAME,"removeSourceBuffer() sourceBuffer error",e)}if(this.audioSourceBuffer)try{this.player.debugLog(this.TAG_NAME,"removeSourceBuffer() audioSourceBuffer"),this.mediaSource.removeSourceBuffer(this.audioSourceBuffer)}catch(e){this.player.debugError(this.TAG_NAME,"removeSourceBuffer() audioSourceBuffer error",e)}}}_hasPendingSegments(){return this.pendingSegments.length>0||this.pendingAudioSegments.length>0}getPendingSegmentsLength(){return this.pendingSegments.length}_handleUpdatePlaybackRate(){if(!this.$videoElement)return;const e=this.$videoElement;this.player._opt.videoBuffer,this.player._opt.videoBufferDelay;const t=e.buffered;t.length&&t.start(0);const i=t.length?t.end(t.length-1):0;let s=e.currentTime;const r=i-s,o=this.getMseBufferMaxDelayTime();if(this.player.updateStats({mseVideoBufferDelayTime:r}),0===this.$videoElement.readyState)return;if(r>o)this.player.debugLog(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current is ${s} , delay buffer is more than ${o} is ${r} and new time is ${i}`),e.currentTime=i,s=e.currentTime;else if(r<0&&0===i)return this.player.debugWarn(this.TAG_NAME,`handleUpdatePlaybackRate and delay buffer is ${i} - current is ${s} = ${r} < 0 and check video is paused : ${e.paused} `),void this.player.emit(dt.mediaSourceBufferedIsZeroError,"video.buffered is empty");const a=this._getPlaybackRate(i-s);e.playbackRate!==a&&(this.player.debugLog(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current time is ${s} and delay is ${i-s} set playbackRate is ${a} `),e.playbackRate=a)}_handleUpdateBufferDelayTime(){const e=this.getVideoBufferDelayTime();this.player.updateStats({mseVideoBufferDelayTime:e})}_checkVideoPlayCurrentTime(){const e=this.checkSourceBufferStore();if(e<0){const t=this.getVideoBufferStartTime();this.player.debugWarn(this.TAG_NAME,`checkVideoPlayCurrentTime store is ${e} < 0 and set currentTime ${this.$videoElement.currentTime} to ${t}`),this.$videoElement.currentTime=t}}_doAppendSegments(){if(this.isStateClosed||this.isStateEnded)this.player.debugLog(this.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==this.sourceBuffer){if(this.needInitAudio()&&null===this.audioSourceBuffer)return this.player.debugLog(this.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===this.audioSourceBufferCheckTimeout&&(this.audioSourceBufferCheckTimeout=setTimeout((()=>{this._clearAudioSourceBufferCheckTimeout(),this.player.emit(dt.mediaSourceAudioInitTimeout)}),1e3)));if(ya(this.getSourceBufferUpdating())&&this.pendingSegments.length>0){const e=this.pendingSegments.shift();try{this.sourceBuffer.appendBuffer(e)}catch(e){this.player.debugError(this.TAG_NAME,"this.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.player.emitError(dt.mediaSourceFull,`code is ${e.code} and message is ${e.message}`)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.player.emitError(dt.mediaSourceAppendBufferError,`code is ${e.code} and message is ${e.message}`)):(this.stop(),this.mediaSourceBufferError=!0,this.player.emitError(at.mseSourceBufferError,`code is ${e.code} and message is ${e.message}`))}}if(ya(this.getAudioSourceBufferUpdating())&&this.pendingAudioSegments.length>0){const e=this.pendingAudioSegments.shift();try{this.audioSourceBuffer.appendBuffer(e)}catch(e){this.player.debugError(this.TAG_NAME,"this.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.player.emitError(dt.mediaSourceFull,`code is ${e.code} and message is ${e.message}`)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.player.emitError(dt.mediaSourceAppendBufferError,`code is ${e.code} and message is ${e.message}`)):(this.stop(),this.mediaSourceBufferError=!0,this.player.emitError(at.mseSourceBufferError,`code is ${e.code} and message is ${e.message}`))}}}else this.player.debugLog(this.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")}_doCleanUpSourceBuffer(){if(!this.$videoElement)return;const e=this.$videoElement.currentTime;if(this.sourceBuffer){const t=this.sourceBuffer.buffered;let i=!1;for(let s=0;s=this.player._opt.mseAutoCleanupMaxBackwardDuration){i=!0;let t=e-this.player._opt.mseAutoCleanupMinBackwardDuration;this.pendingRemoveRanges.push({start:r,end:t})}}else o=this.player._opt.mseAutoCleanupMaxBackwardDuration){i=!0;let t=e-this.player._opt.mseAutoCleanupMinBackwardDuration;this.pendingAudioRemoveRanges.push({start:r,end:t})}}else o0||this.pendingAudioRemoveRanges.length>0}_doRemoveRanges(){if(this.sourceBuffer&&ya(this.getSourceBufferUpdating())){let e=this.pendingRemoveRanges;for(;e.length&&ya(this.getSourceBufferUpdating());){let t=e.shift();try{this.sourceBuffer.remove(t.start,t.end)}catch(e){this.player.debugWarn(this.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e)}}}if(this.audioSourceBuffer&&ya(this.getAudioSourceBufferUpdating())){let e=this.pendingAudioRemoveRanges;for(;e.length&&ya(this.getAudioSourceBufferUpdating());){let t=e.shift();try{this.audioSourceBuffer.remove(t.start,t.end)}catch(e){this.player.debugWarn(this.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e)}}}}getDecodePlaybackRate(){let e=0;const t=this.$videoElement;return t&&(e=t.playbackRate),e}_getPlaybackRate(e){const t=this.$videoElement;let i=this.player._opt.videoBufferDelay+this.player._opt.videoBuffer;const s=Math.max(i,1e3),r=s/2;return e*=1e3,1===t.playbackRate?e>s?1.2:1:e<=r?1:t.playbackRate}_needCleanupSourceBuffer(){if(ya(this.player._opt.mseAutoCleanupSourceBuffer)||!this.$videoElement)return!1;const e=this.$videoElement,t=e.buffered,i=e.currentTime;return t.length>=1&&i-t.start(0)>=this.player._opt.mseAutoCleanupMaxBackwardDuration}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}getVideoBufferLastTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;i.length&&i.start(0);t=i.length?i.end(i.length-1):0}return t}getVideoBufferTimeRange(){const e=this.$videoElement;let t=null;if(e){const i=e.buffered,s=i.length?i.start(0):0,r=i.length?i.end(i.length-1):0;t={start:s,end:r,diff:r-s}}return t}getVideoBufferStartTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;t=i.length?i.start(0):0}return t}getVideoBufferEndTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;t=i.length?i.end(i.length-1):0}return t}getVideoBufferDelayTime(){const e=this.$videoElement;const t=this.getVideoBufferLastTime()-e.currentTime;return t>0?t:0}_clearAudioSourceBufferCheckTimeout(){this.audioSourceBufferCheckTimeout&&(clearTimeout(this.audioSourceBufferCheckTimeout),this.audioSourceBufferCheckTimeout=null)}_clearAudioNoDataCheckTimeout(){this.audioSourceNoDataCheckTimeout&&(clearTimeout(this.audioSourceNoDataCheckTimeout),this.audioSourceNoDataCheckTimeout=null)}getMimeType(){return{video:this.videoMimeType,audio:this.audioMimeType}}getMseBufferMaxDelayTime(){let e=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3;return Math.max(5,e+3)}isVideoPlaying(){return this.$videoElement&&ya(this.$videoElement.paused)&&ya(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}}const yc=()=>"wakeLock"in navigator&&-1===window.navigator.userAgent.indexOf("Samsung")&&ya(Ao());class Ac{constructor(e){this.player=e,this.enabled=!1,yc()?(this.player.debugLog("NoSleep","Native Wake Lock API supported."),this._wakeLock=null,this.handleVisibilityChange=()=>{null!==this._wakeLock&&"visible"===document.visibilityState&&this.enable()},document.addEventListener("visibilitychange",this.handleVisibilityChange),document.addEventListener("fullscreenchange",this.handleVisibilityChange)):(this.player.debugLog("NoSleep","Native Wake Lock API not supported. so use video element."),this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQRChYECGFOAZwEAAAAAABLfEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHYTbuMU6uEElTDZ1OsggGXTbuMU6uEHFO7a1OsghLJ7AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmsirXsYMPQkBNgI1MYXZmNTguNDUuMTAwV0GNTGF2ZjU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L/QACIAEM1+tck+ccwAAo4eCA/2A+P/+o4eCBBGA+P/+o4eCBCWA+P/+o4eCBDmA+P/+o4eCBE2A+P/+o56BBFMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IEiID4//6jh4IEnID4//6jh4IEsID4//6jnoEEtwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggTEgPj//qOHggTYgPj//qOHggTsgPj//qOHggUAgPj//qOHggUUgPj//qOegQUbANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCBSiA+P/+o4eCBTyA+P/+o4eCBVCA+P/+o4eCBWSA+P/+o4eCBXiA+P/+o56BBX8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IFjID4//6jh4IFoID4//6jh4IFtID4//6jh4IFyID4//6jh4IF3ID4//6jnoEF4wDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggXwgPj//qOHggYEgPj//qOHggYYgPj//qOHggYsgPj//qOHggZAgPj//qOegQZHANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCBlSA+P/+o4eCBmiA+P/+o4eCBnyA+P/+o4eCBpCA+P/+o4eCBqSA+P/+o56BBqsA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IGuID4//6jh4IGzID4//6jh4IG4ID4//6jh4IG9ID4//6jh4IHCID4//6jnoEHDwDRAgAFEBAUYABhYL/QACIAEM1+tck+ccwAAKOHggccgPj//qOHggcwgPj//qOHggdEgPj//qOHggdYgPj//qOHggdsgPj//qOegQdzANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCB4CA+P/+o4eCB5SA+P/+o4eCB6iA+P/+o4eCB7yA+P/+o4eCB9CA+P/+o56BB9cA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IH5ID4//6jh4IH+ID4//6jh4IIDID4//6jh4IIIID4//6jh4IINID4//6jnoEIOwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgghIgPj//qOHgghcgPj//qOHgghwgPj//qOHggiEgPj//qOegQifANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCMCA+P/+o4eCCNSA+P/+o4eCCOiA+P/+o4eCCPyA+P/+o56BCQMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IJEID4//6jh4IJJID4//6jh4IJOID4//6jh4IJTID4//6jh4IJYID4//6jnoEJZwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggl0gPj//qOHggmIgPj//qOHggmcgPj//qOHggmwgPj//qOHggnEgPj//qOegQnLANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCdiA+P/+o4eCCeyA+P/+o4eCCgCA+P/+o4eCChSA+P/+o4eCCiiA+P/+o56BCi8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IKPID4//6jh4IKUID4//6jh4IKZID4//6jh4IKeID4//6jh4IKjID4//6jnoEKkwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggqggPj//qOHggq0gPj//qOHggrIgPj//qOHggrcgPj//qOHggrwgPj//qOegQr3ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCwSA+P/+o4eCCxiA+P/+o4eCCyyA+P/+o4eCC0CA+P/+o4eCC1SA+P/+o56BC1sA0QIABRAQFGAAYWC/0AAiABDNfrXJPnHMAACjh4ILaID4//6jh4ILfID4//6jh4ILkID4//6jh4ILpID4//6jh4ILuID4//6jnoELvwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggvMgPj//qOHggvggPj//qOHggv0gPj//qOHggwIgPj//qOHggwcgPj//qOegQwjANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCDDCA+P/+o4eCDESA+P/+o4eCDFiA+P/+o4eCDGyA+P/+o4eCDICA+P/+o56BDIcA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IMlID4//6jh4IMqID4//6jh4IMvID4//6jh4IM0ID4//6jnoEM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T5xzAACjh4IRQ4D4//6jh4IRV4D4//6jh4IRa4D4//6jh4IRf4D4//6jh4IRk4D4//6jnoERmwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghGngPj//qOHghG7gPj//qOHghHPgPj//qOHghHjgPj//qOHghH3gPj//qOegRH/ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEguA+P/+o4eCEh+A+P/+o4eCEjOA+P/+o4eCEkeA+P/+o4eCEluA+P/+o56BEmMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4ISb4D4//6jh4ISg4D4//6jh4ISl4D4//6jh4ISq4D4//6jh4ISv4D4//6jnoESxwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghLTgPj//qOHghLngPj//qOHghL7gPj//qOHghMPgPj//qOHghMjgPj//qOegRMrANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEzeA+P/+o4eCE0uA+P/+o4eCE1+A+P/+o4eCE3OA+P/+oAEAAAAAAAAPoYeCE4cA+P/+daKDB/KBHFO7a5G7j7OBB7eK94EB8YIDX/CBDA=="),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACORtZGF03gIATGF2YzU4LjM1LjEwMAACMEAOAAACcQYF//9t3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MSByMzAyNyA0MTIxMjc3IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAyMCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTAgcmVmPTMgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9NyBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0xIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MSA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0tMiB0aHJlYWRzPTcgbG9va2FoZWFkX3RocmVhZHM9MSBzbGljZWRfdGhyZWFkcz0wIG5yPTAgZGVjaW1hdGU9MSBpbnRlcmxhY2VkPTAgYmx1cmF5X2NvbXBhdD0wIGNvbnN0cmFpbmVkX2ludHJhPTAgYmZyYW1lcz0wIHdlaWdodHA9MCBrZXlpbnQ9MjUwIGtleWludF9taW49MTAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD00MCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIzLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IGlwX3JhdGlvPTEuNDAgYXE9MToxLjAwAIAAAADvZYiED/JigADD7JycnJycnJycnJycnJycnJycnJ11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111114BGCAHARggBwEYIAcBGCAHARggBwAAAAdBmjgf4BLYARggBwEYIAcBGCAHARggBwAAAAdBmlQH+AS2ARggBwEYIAcBGCAHARggBwAAAAdBmmA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZqAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZqgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZrAP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0Ga4D/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbAD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbID/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBm0A/wCWwARggBwEYIAcBGCAHAAAAB0GbYD/AJbABGCAHARggBwEYIAcAAAAHQZuAP8AlsAEYIAcBGCAHAR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AfmAAAIBQAACCAAAAg7AAAIWgAACG0AAAiIAAAIpwAACMIAAAjdAAAI/AAAABpzZ3BkAQAAAHJvbGwAAAACAAAAAf//AAAAHHNiZ3AAAAAAcm9sbAAAAAEAAADSAAAAAQAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTguMjAuMTAw"),Object.assign(this.noSleepVideo.style,{position:"absolute",left:"-100%",top:"-100%"}),document.querySelector("body").append(this.noSleepVideo),this.handleNoSleepVideoTimeUpdate=()=>{this.noSleepVideo&&this.noSleepVideo.currentTime>4&&(this.noSleepVideo.currentTime=1)},this.noSleepVideo.addEventListener("timeupdate",this.handleNoSleepVideoTimeUpdate))}destroy(){if(this._wakeLock&&(this._wakeLock.release(),this._wakeLock=null),this.noSleepVideo){this.handleNoSleepVideoTimeUpdate&&this.noSleepVideo.removeEventListener("timeupdate",this.handleNoSleepVideoTimeUpdate);try{this.noSleepVideo.parentNode&&this.noSleepVideo.parentNode.removeChild(this.noSleepVideo)}catch(e){this.player.debugWarn("NoSleep","Failed to remove noSleepVideo element.")}this.noSleepVideo=null}this.handleVisibilityChange&&(document.removeEventListener("visibilitychange",this.handleVisibilityChange),document.removeEventListener("fullscreenchange",this.handleVisibilityChange))}_addSourceToVideo(e,t,i){var s=document.createElement("source");s.src=i,s.type=`video/${t}`,e.appendChild(s)}get isEnabled(){return this.enabled}enable(){if(yc())return navigator.wakeLock.request("screen").then((e=>{this._wakeLock=e,this.enabled=!0,this.player.debugLog("wakeLock","Wake Lock active."),this._wakeLock.addEventListener("release",(()=>{this.player.debugLog("wakeLock","Wake Lock released.")}))})).catch((e=>{throw this.enabled=!1,this.player.debugWarn("wakeLock",`${e.name}, ${e.message}`),e}));return this.noSleepVideo.play().then((e=>(this.player.debugLog("wakeLock","noSleepVideo Wake Lock active."),this.enabled=!0,e))).catch((e=>{throw this.player.debugWarn("wakeLock",`noSleepVideo ${e.name}, ${e.message}`),this.enabled=!1,e}))}disable(){yc()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):this.noSleepVideo&&this.noSleepVideo.pause(),this.enabled=!1,this.player.debugLog("wakeLock","Disabling wake lock.")}}function bc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vc={exports:{}};!function(e,t){var i,s,r,o,a;i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=a.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=a.normalizePath(r.path),a.buildURLFromParts(r)}var o=a.parseURL(t);if(!o)throw new Error("Error trying to parse relative URL.");if(o.scheme)return i.alwaysNormalize?(o.path=a.normalizePath(o.path),a.buildURLFromParts(o)):t;var n=a.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");if(!n.netLoc&&n.path&&"/"!==n.path[0]){var l=s.exec(n.path);n.netLoc=l[1],n.path=l[2]}n.netLoc&&!n.path&&(n.path="/");var d={scheme:n.scheme,netLoc:o.netLoc,path:null,params:o.params,query:o.query,fragment:o.fragment};if(!o.netLoc&&(d.netLoc=n.netLoc,"/"!==o.path[0]))if(o.path){var h=n.path,c=h.substring(0,h.lastIndexOf("/")+1)+o.path;d.path=a.normalizePath(c)}else d.path=n.path,o.params||(d.params=n.params,o.query||(d.query=n.query));return null===d.path&&(d.path=i.alwaysNormalize?a.normalizePath(o.path):o.path),a.buildURLFromParts(d)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");e.length!==(e=e.replace(o,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=a}(vc);var _c=vc.exports;function wc(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function Sc(e){for(var t=1;t`):Ic}(t)}))}const Uc=Mc,Oc=/^(\d+)x(\d+)$/,Nc=/(.+?)=(".*?"|.*?)(?:,|$)/g;class jc{constructor(e){"string"==typeof e&&(e=jc.parseAttrList(e)),kc(this,e)}get clientAttrs(){return Object.keys(this).filter((e=>"X-"===e.substring(0,2)))}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;const i=new Uint8Array(t.length/2);for(let e=0;eNumber.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}bool(e){return"YES"===this[e]}decimalResolution(e){const t=Oc.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const i={};for(Nc.lastIndex=0;null!==(t=Nc.exec(e));){let e=t[2];0===e.indexOf('"')&&e.lastIndexOf('"')===e.length-1&&(e=e.slice(1,-1));i[t[1].trim()]=e}return i}}function Gc(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e}class Wc{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const i=t.attr;for(const t in i)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==i[t]){Uc.warn(`DATERANGE tag attribute: "${t}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=t;break}e=kc(new jc({}),i,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const e=new Date(this.attr["END-DATE"]);Lc(e.getTime())&&(this._endDate=e)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return null!==e?new Date(this._startDate.getTime()+1e3*e):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(Lc(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&Lc(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class zc{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var $c="audio",Vc="video",Hc="audiovideo";class Jc{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[$c]:null,[Vc]:null,[Hc]:null},this.baseurl=e}setByteRange(e,t){const i=e.split("@",2);let s;s=1===i.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(i[1]),this._byteRange=[s,parseInt(i[0])+s]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=_c.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class qc extends Jc{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new zc,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const e=this.levelkeys.identity;if(e)this._decryptdata=e.getDecryptData(this.sn);else{const e=Object.keys(this.levelkeys);if(1===e.length)return this._decryptdata=this.levelkeys[e[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;if(!Lc(this.programDateTime))return null;const e=Lc(this.duration)?this.duration:0;return this.programDateTime+1e3*e}get encrypted(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){const e=Object.keys(this.levelkeys),t=e.length;if(t>1||1===t&&this.levelkeys[e[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()}setElementaryStreamInfo(e,t,i,s,r,o=!1){const{elementaryStreams:a}=this,n=a[e];n?(n.startPTS=Math.min(n.startPTS,t),n.endPTS=Math.max(n.endPTS,i),n.startDTS=Math.min(n.startDTS,s),n.endDTS=Math.max(n.endDTS,r)):a[e]={startPTS:t,endPTS:i,startDTS:s,endDTS:r,partial:o}}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[$c]=null,e[Vc]=null,e[Hc]=null}}class Kc extends Jc{constructor(e,t,i,s,r){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new zc,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=s;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}class Yc{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e)return this.advanced=!0,void(this.updated=!0);const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&i>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return!!this.fragments.length&&Lc(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){const e=this.driftEndTime-this.driftStartTime;if(e>0){return 1e3*(this.driftEnd-this.driftStart)/e}return 1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function Qc(e){return Uint8Array.from(atob(e),(e=>e.charCodeAt(0)))}function Xc(e){const t=e.split(":");let i=null;if("data"===t[0]&&2===t.length){const e=t[1].split(";"),s=e[e.length-1].split(",");if(2===s.length){const t="base64"===s[0],r=s[1];t?(e.splice(-1,1),i=Qc(r)):i=function(e){const t=Zc(e).subarray(0,16),i=new Uint8Array(16);return i.set(t,16-t.length),i}(r)}}return i}function Zc(e){return Uint8Array.from(unescape(encodeURIComponent(e)),(e=>e.charCodeAt(0)))}const eu="undefined"!=typeof self?self:void 0;var tu={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},iu="org.w3.clearkey",su="com.apple.streamingkeydelivery",ru="com.microsoft.playready",ou="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function au(e){switch(e){case su:return tu.FAIRPLAY;case ru:return tu.PLAYREADY;case ou:return tu.WIDEVINE;case iu:return tu.CLEARKEY}}var nu="edef8ba979d64acea3c827dcd51d21ed";function lu(e){switch(e){case tu.FAIRPLAY:return su;case tu.PLAYREADY:return ru;case tu.WIDEVINE:return ou;case tu.CLEARKEY:return iu}}function du(e){const{drmSystems:t,widevineLicenseUrl:i}=e,s=t?[tu.FAIRPLAY,tu.WIDEVINE,tu.PLAYREADY,tu.CLEARKEY].filter((e=>!!t[e])):[];return!s[tu.WIDEVINE]&&i&&s.push(tu.WIDEVINE),s}const hu=null!=eu&&null!=(cu=eu.navigator)&&cu.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;var cu;function uu(e,t,i){return Uint8Array.prototype.slice?e.slice(t,i):new Uint8Array(Array.prototype.slice.call(e,t,i))}const pu=(e,t)=>t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128,fu=(e,t)=>t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128,mu=(e,t)=>{const i=t;let s=0;for(;pu(e,t);){s+=10;s+=gu(e,t+6),fu(e,t+10)&&(s+=10),t+=s}if(s>0)return e.subarray(i,i+s)},gu=(e,t)=>{let i=0;return i=(127&e[t])<<21,i|=(127&e[t+1])<<14,i|=(127&e[t+2])<<7,i|=127&e[t+3],i},yu=(e,t)=>pu(e,t)&&gu(e,t+6)+10<=e.length-t,Au=e=>{const t=_u(e);for(let e=0;ee&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info,vu=e=>{const t=String.fromCharCode(e[0],e[1],e[2],e[3]),i=gu(e,4);return{type:t,size:i,data:e.subarray(10,10+i)}},_u=e=>{let t=0;const i=[];for(;pu(e,t);){const s=gu(e,t+6);t+=10;const r=t+s;for(;t+8"PRIV"===e.type?Su(e):"W"===e.type[0]?Tu(e):Eu(e),Su=e=>{if(e.size<2)return;const t=Lu(e.data,!0),i=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:i.buffer}},Eu=e=>{if(e.size<2)return;if("TXXX"===e.type){let t=1;const i=Lu(e.data.subarray(t),!0);t+=i.length+1;const s=Lu(e.data.subarray(t));return{key:e.type,info:i,data:s}}const t=Lu(e.data.subarray(1));return{key:e.type,data:t}},Tu=e=>{if("WXXX"===e.type){if(e.size<2)return;let t=1;const i=Lu(e.data.subarray(t),!0);t+=i.length+1;const s=Lu(e.data.subarray(t));return{key:e.type,info:i,data:s}}const t=Lu(e.data);return{key:e.type,data:t}},ku=e=>{if(8===e.data.byteLength){const t=new Uint8Array(e.data),i=1&t[3];let s=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return s/=45,i&&(s+=47721858.84),Math.round(s)}},Lu=(e,t=!1)=>{const i=xu();if(i){const s=i.decode(e);if(t){const e=s.indexOf("\0");return-1!==e?s.substring(0,e):s}return s.replace(/\0/g,"")}const s=e.length;let r,o,a,n="",l=0;for(;l>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:n+=String.fromCharCode(r);break;case 12:case 13:o=e[l++],n+=String.fromCharCode((31&r)<<6|63&o);break;case 14:o=e[l++],a=e[l++],n+=String.fromCharCode((15&r)<<12|(63&o)<<6|(63&a)<<0)}}return n};let Cu;function xu(){if(!navigator.userAgent.includes("PlayStation 4"))return Cu||void 0===self.TextDecoder||(Cu=new self.TextDecoder("utf-8")),Cu}const Du=function(e){let t="";for(let i=0;i>24,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i}function ju(e,t){const i=[];if(!t.length)return i;const s=e.byteLength;for(let r=0;r1?r+o:s;if(Bu(e.subarray(r+4,r+8))===t[0])if(1===t.length)i.push(e.subarray(r+8,a));else{const s=ju(e.subarray(r+8,a),t.slice(1));s.length&&Pu.apply(i,s)}r=a}return i}function Gu(e){const t=[],i=e[0];let s=8;const r=Fu(e,s);s+=4;let o=0,a=0;0===i?(o=Fu(e,s),a=Fu(e,s+4),s+=8):(o=Uu(e,s),a=Uu(e,s+8),s+=16),s+=2;let n=e.length+a;const l=Mu(e,s);s+=2;for(let i=0;i>>31)return Uc.warn("SIDX has hierarchical references (not supported)"),null;const l=Fu(e,i);i+=4,t.push({referenceSize:a,subsegmentDuration:l,info:{duration:l/r,start:n,end:n+a-1}}),n+=a,i+=4,s=i}return{earliestPresentationTime:o,timescale:r,version:i,referencesCount:l,references:t}}function Wu(e){const t=[],i=ju(e,["moov","trak"]);for(let e=0;e{const i=Fu(e,4),s=t[i];s&&(s.default={duration:Fu(e,12),flags:Fu(e,20)})})),t}function zu(e){const t=e.subarray(8),i=t.subarray(86),s=Bu(t.subarray(4,8));let r=s;const o="enca"===s||"encv"===s;if(o){const e=ju(t,[s])[0];ju(e.subarray("enca"===s?28:78),["sinf"]).forEach((e=>{const t=ju(e,["schm"])[0];if(t){const i=Bu(t.subarray(4,8));if("cbcs"===i||"cenc"===i){const t=ju(e,["frma"])[0];t&&(r=Bu(t))}}}))}switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const e=ju(i,["avcC"])[0];r+="."+Vu(e[1])+Vu(e[2])+Vu(e[3]);break}case"mp4a":{const e=ju(t,[s])[0],i=ju(e.subarray(28),["esds"])[0];if(i&&i.length>12){let e=4;if(3!==i[e++])break;e=$u(i,e),e+=2;const t=i[e++];if(128&t&&(e+=2),64&t&&(e+=i[e++]),4!==i[e++])break;e=$u(i,e);const s=i[e++];if(64!==s)break;if(r+="."+Vu(s),e+=12,5!==i[e++])break;e=$u(i,e);const o=i[e++];let a=(248&o)>>3;31===a&&(a+=1+((7&o)<<3)+((224&i[e])>>5)),r+="."+a}break}case"hvc1":case"hev1":{const e=ju(i,["hvcC"])[0],t=e[1],s=["","A","B","C"][t>>6],o=31&t,a=Fu(e,2),n=(32&t)>>5?"H":"L",l=e[12],d=e.subarray(6,12);r+="."+s+o,r+="."+a.toString(16).toUpperCase(),r+="."+n+l;let h="";for(let e=d.length;e--;){const t=d[e];if(t||h){h="."+t.toString(16).toUpperCase()+h}}r+=h;break}case"dvh1":case"dvhe":{const e=ju(i,["dvcC"])[0],t=e[2]>>1&127,s=e[2]<<5&32|e[3]>>3&31;r+="."+Hu(t)+"."+Hu(s);break}case"vp09":{const e=ju(i,["vpcC"])[0],t=e[4],s=e[5],o=e[6]>>4&15;r+="."+Hu(t)+"."+Hu(s)+"."+Hu(o);break}case"av01":{const e=ju(i,["av1C"])[0],t=e[1]>>>5,s=31&e[1],o=e[2]>>>7?"H":"M",a=(64&e[2])>>6,n=(32&e[2])>>5,l=2===t&&a?n?12:10:a?10:8,d=(16&e[2])>>4,h=(8&e[2])>>3,c=(4&e[2])>>2,u=3&e[2],p=1,f=1,m=1,g=0;r+="."+t+"."+Hu(s)+o+"."+Hu(l)+"."+d+"."+h+c+u+"."+Hu(p)+"."+Hu(f)+"."+Hu(m)+"."+g;break}}return{codec:r,encrypted:o}}function $u(e,t){const i=t+5;for(;128&e[t++]&&t{const l=n.byteOffset-8;ju(n,["traf"]).map((n=>{const d=ju(n,["tfdt"]).map((e=>{const t=e[0];let i=Fu(e,4);return 1===t&&(i*=Math.pow(2,32),i+=Fu(e,8)),i/r}))[0];return void 0!==d&&(e=d),ju(n,["tfhd"]).map((d=>{const h=Fu(d,4),c=16777215&Fu(d,0);let u=0;const p=0!=(16&c);let f=0;const m=0!=(32&c);let g=8;h===o&&(0!=(1&c)&&(g+=8),0!=(2&c)&&(g+=4),0!=(8&c)&&(u=Fu(d,g),g+=4),p&&(f=Fu(d,g),g+=4),m&&(g+=4),"video"===t.type&&(a=function(e){if(!e)return!1;const t=e.indexOf("."),i=t<0?e:e.substring(0,t);return"hvc1"===i||"hev1"===i||"dvh1"===i||"dvhe"===i}(t.codec)),ju(n,["trun"]).map((o=>{const n=o[0],d=16777215&Fu(o,0),h=0!=(1&d);let c=0;const p=0!=(4&d),m=0!=(256&d);let g=0;const y=0!=(512&d);let A=0;const b=0!=(1024&d),v=0!=(2048&d);let _=0;const w=Fu(o,4);let S=8;h&&(c=Fu(o,S),S+=4),p&&(S+=4);let E=c+l;for(let l=0;l>1&63;return 39===e||40===e}return 6===(31&t)}function Xu(e,t,i,s){const r=Zu(e);let o=0;o+=t;let a=0,n=0,l=0;for(;o=r.length)break;l=r[o++],a+=l}while(255===l);n=0;do{if(o>=r.length)break;l=r[o++],n+=l}while(255===l);const e=r.length-o;let t=o;if(ne){Uc.error(`Malformed SEI payload. ${n} is too small, only ${e} bytes left to parse.`);break}if(4===a){if(181===r[t++]){const e=Mu(r,t);if(t+=2,49===e){const e=Fu(r,t);if(t+=4,1195456820===e){const e=r[t++];if(3===e){const o=r[t++],n=31&o,l=64&o,d=l?2+3*n:0,h=new Uint8Array(d);if(l){h[0]=o;for(let e=1;e16){const e=[];for(let i=0;i<16;i++){const s=r[t++].toString(16);e.push(1==s.length?"0"+s:s),3!==i&&5!==i&&7!==i&&9!==i||e.push("-")}const o=n-16,l=new Uint8Array(o);for(let e=0;e0?(o=new Uint8Array(4),t.length>0&&new DataView(o.buffer).setUint32(0,t.length,!1)):o=new Uint8Array;const a=new Uint8Array(4);return i&&i.byteLength>0&&new DataView(a.buffer).setUint32(0,i.byteLength,!1),function(e,...t){const i=t.length;let s=8,r=i;for(;r--;)s+=t[r].byteLength;const o=new Uint8Array(s);for(o[0]=s>>24&255,o[1]=s>>16&255,o[2]=s>>8&255,o[3]=255&s,o.set(e,4),r=0,s=8;r>8*(15-i)&255;return t}(e);return new ip(this.method,this.uri,"identity",this.keyFormatVersions,t)}const t=Xc(this.uri);if(t)switch(this.keyFormat){case ou:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case ru:{const e=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=ep(e,null,t);const i=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),s=String.fromCharCode.apply(null,Array.from(i)),r=s.substring(s.indexOf("<"),s.length),o=(new DOMParser).parseFromString(r,"text/xml").getElementsByTagName("KID")[0];if(o){const e=o.childNodes[0]?o.childNodes[0].nodeValue:o.getAttribute("VALUE");if(e){const t=Qc(e).subarray(0,16);!function(e){const t=function(e,t,i){const s=e[t];e[t]=e[i],e[i]=s};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}(t),this.keyId=t}}break}default:{let e=t.subarray(0,16);if(16!==e.length){const t=new Uint8Array(16);t.set(e,16-e.length),e=t}this.keyId=e;break}}if(!this.keyId||16!==this.keyId.byteLength){let e=tp[this.uri];if(!e){const t=Object.keys(tp).length%Number.MAX_SAFE_INTEGER;e=new Uint8Array(16);new DataView(e.buffer,12,4).setUint32(0,t),tp[this.uri]=e}this.keyId=e}return this}}const sp=/\{\$([a-zA-Z0-9-_]+)\}/g;function rp(e){return sp.test(e)}function op(e,t,i){if(null!==e.variableList||e.hasVariableRefs)for(let s=i.length;s--;){const r=i[s],o=t[r];o&&(t[r]=ap(e,o))}}function ap(e,t){if(null!==e.variableList||e.hasVariableRefs){const i=e.variableList;return t.replace(sp,(t=>{const s=t.substring(2,t.length-1),r=null==i?void 0:i[s];return void 0===r?(e.playlistParsingError||(e.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${s}"`)),t):r}))}return t}function np(e,t,i){let s,r,o=e.variableList;if(o||(e.variableList=o={}),"QUERYPARAM"in t){s=t.QUERYPARAM;try{const e=new self.URL(i).searchParams;if(!e.has(s))throw new Error(`"${s}" does not match any query parameter in URI: "${i}"`);r=e.get(s)}catch(t){e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${t.message}`))}}else s=t.NAME,r=t.VALUE;s in o?e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${s}"`)):o[s]=r||""}function lp(e,t,i){const s=t.IMPORT;if(i&&s in i){let t=e.variableList;t||(e.variableList=t={}),t[s]=i[s]}else e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}function dp(e=!0){if("undefined"==typeof self)return;return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}const hp={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function cp(e,t,i=!0){return!e.split(",").some((e=>!up(e,t,i)))}function up(e,t,i=!0){var s;const r=dp(i);return null!=(s=null==r?void 0:r.isTypeSupported(pp(e,t)))&&s}function pp(e,t){return`${t}/mp4;codecs="${e}"`}function fp(e){if(e){const t=e.substring(0,4);return hp.video[t]}return 2}function mp(e){return e.split(",").reduce(((e,t)=>{const i=hp.video[t];return i?(2*i+e)/(e?3:2):(hp.audio[t]+e)/(e?2:1)}),0)}const gp={};const yp=/flac|opus/i;function Ap(e,t=!0){return e.replace(yp,(e=>function(e,t=!0){if(gp[e])return gp[e];const i={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[e];for(let s=0;s0&&s.length({id:e.attrs.AUDIO,audioCodec:e.audioCodec}))),SUBTITLES:o.map((e=>({id:e.attrs.SUBTITLES,textCodec:e.textCodec}))),"CLOSED-CAPTIONS":[]};let n=0;for(_p.lastIndex=0;null!==(s=_p.exec(e));){const e=new jc(s[1]),o=e.TYPE;if(o){const s=a[o],l=r[o]||[];r[o]=l,op(i,e,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d=e.LANGUAGE,h=e["ASSOC-LANGUAGE"],c=e.CHANNELS,u=e.CHARACTERISTICS,p=e["INSTREAM-ID"],f={attrs:e,bitrate:0,id:n++,groupId:e["GROUP-ID"]||"",name:e.NAME||d||"",type:o,default:e.bool("DEFAULT"),autoselect:e.bool("AUTOSELECT"),forced:e.bool("FORCED"),lang:d,url:e.URI?Tp.resolve(e.URI,t):""};if(h&&(f.assocLang=h),c&&(f.channels=c),u&&(f.characteristics=u),p&&(f.instreamId=p),null!=s&&s.length){const e=Tp.findGroup(s,f.groupId)||s[0];xp(f,e,"audioCodec"),xp(f,e,"textCodec")}l.push(f)}}return r}static parseLevelPlaylist(e,t,i,s,r,o){const a=new Yc(t),n=a.fragments;let l,d,h,c=null,u=0,p=0,f=0,m=0,g=null,y=new qc(s,t),A=-1,b=!1,v=null;for(Sp.lastIndex=0,a.m3u8=e,a.hasVariableRefs=rp(e);null!==(l=Sp.exec(e));){b&&(b=!1,y=new qc(s,t),y.start=f,y.sn=u,y.cc=m,y.level=i,c&&(y.initSegment=c,y.rawProgramDateTime=c.rawProgramDateTime,c.rawProgramDateTime=null,v&&(y.setByteRange(v),v=null)));const e=l[1];if(e){y.duration=parseFloat(e);const t=(" "+l[2]).slice(1);y.title=t||null,y.tagList.push(t?["INF",e,t]:["INF",e])}else if(l[3]){if(Lc(y.duration)){y.start=f,h&&Pp(y,h,a),y.sn=u,y.level=i,y.cc=m,n.push(y);const e=(" "+l[3]).slice(1);y.relurl=ap(a,e),Dp(y,g),g=y,f+=y.duration,u++,p=0,b=!0}}else if(l[4]){const e=(" "+l[4]).slice(1);g?y.setByteRange(e,g):y.setByteRange(e)}else if(l[5])y.rawProgramDateTime=(" "+l[5]).slice(1),y.tagList.push(["PROGRAM-DATE-TIME",y.rawProgramDateTime]),-1===A&&(A=n.length);else{if(l=l[0].match(Ep),!l){Uc.warn("No matches on slow regex match for level playlist!");continue}for(d=1;d0&&e.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=e.optionalFloat("PART-HOLD-BACK",0),a.holdBack=e.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const e=new jc(r);a.partTarget=e.decimalFloatingPoint("PART-TARGET");break}case"PART":{let e=a.partList;e||(e=a.partList=[]);const i=p>0?e[e.length-1]:void 0,s=p++,o=new jc(r);op(a,o,["BYTERANGE","URI"]);const n=new Kc(o,y,t,s,i);e.push(n),y.duration+=n.duration;break}case"PRELOAD-HINT":{const e=new jc(r);op(a,e,["URI"]),a.preloadHint=e;break}case"RENDITION-REPORT":{const e=new jc(r);op(a,e,["URI"]),a.renditionReports=a.renditionReports||[],a.renditionReports.push(e);break}default:Uc.warn(`line parsed but not handled: ${l}`)}}}g&&!g.relurl?(n.pop(),f-=g.duration,a.partList&&(a.fragmentHint=g)):a.partList&&(Dp(y,g),y.cc=m,a.fragmentHint=y,h&&Pp(y,h,a));const _=n.length,w=n[0],S=n[_-1];if(f+=a.skippedSegments*a.targetduration,f>0&&_&&S){a.averagetargetduration=f/_;const e=S.sn;a.endSN="initSegment"!==e?e:0,a.live||(S.endList=!0),w&&(a.startCC=w.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(f+=a.fragmentHint.duration),a.totalduration=f,a.endCC=m,A>0&&function(e,t){let i=e[t];for(let s=t;s--;){const t=e[s];if(!t)return;t.programDateTime=i.programDateTime-1e3*t.duration,i=t}}(n,A),a}}function kp(e,t,i){var s,r;const o=new jc(e);op(i,o,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const a=null!=(s=o.METHOD)?s:"",n=o.URI,l=o.hexadecimalInteger("IV"),d=o.KEYFORMATVERSIONS,h=null!=(r=o.KEYFORMAT)?r:"identity";n&&o.IV&&!l&&Uc.error(`Invalid IV: ${o.IV}`);const c=n?Tp.resolve(n,t):"",u=(d||"1").split("/").map(Number).filter(Number.isFinite);return new ip(a,c,h,u,l)}function Lp(e){const t=new jc(e).decimalFloatingPoint("TIME-OFFSET");return Lc(t)?t:null}function Cp(e,t){let i=(e||"").split(/[ ,]+/).filter((e=>e));["video","audio","text"].forEach((e=>{const s=i.filter((t=>function(e,t){const i=hp[t];return!!i&&!!i[e.slice(0,4)]}(t,e)));s.length&&(t[`${e}Codec`]=s.join(","),i=i.filter((e=>-1===s.indexOf(e))))})),t.unknownCodecs=i}function xp(e,t,i){const s=t[i];s&&(e[i]=s)}function Dp(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),Lc(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}function Rp(e,t,i,s){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=i,e.sn="initSegment",s&&(e.levelkeys=s),e.initSegment=null}function Pp(e,t,i){e.levelkeys=t;const{encryptedFragments:s}=i;s.length&&s[s.length-1].levelkeys===t||!Object.keys(t).some((e=>t[e].isCommonEncryption))||s.push(e)}var Ip="manifest",Bp="level",Mp="audioTrack",Fp="subtitleTrack",Up="main",Op="audio",Np="subtitle";function jp(e){const{type:t}=e;switch(t){case Mp:return Op;case Fp:return Np;default:return Up}}function Gp(e,t){let i=e.url;return void 0!==i&&0!==i.indexOf("data:")||(i=t.url),i}class Wp{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Dc.LEVEL_LOADING,this.onLevelLoading,this),e.on(Dc.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(Dc.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Dc.LEVEL_LOADING,this.onLevelLoading,this),e.off(Dc.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(Dc.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,s=t.loader,r=new(i||s)(t);return this.loaders[e.type]=r,r}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Ip,url:i,deliveryDirectives:null})}onLevelLoading(e,t){const{id:i,level:s,pathwayId:r,url:o,deliveryDirectives:a}=t;this.load({id:i,level:s,pathwayId:r,responseType:"text",type:Bp,url:o,deliveryDirectives:a})}onAudioTrackLoading(e,t){const{id:i,groupId:s,url:r,deliveryDirectives:o}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:Mp,url:r,deliveryDirectives:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:s,url:r,deliveryDirectives:o}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:Fp,url:r,deliveryDirectives:o})}load(e){var t;const i=this.hls.config;let s,r=this.getInternalLoader(e);if(r){const t=r.context;if(t&&t.url===e.url&&t.level===e.level)return void Uc.trace("[playlist-loader]: playlist request ongoing");Uc.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}if(s=e.type===Ip?i.manifestLoadPolicy.default:kc({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),Lc(null==(t=e.deliveryDirectives)?void 0:t.part)){let t;if(e.type===Bp&&null!==e.level?t=this.hls.levels[e.level].details:e.type===Mp&&null!==e.id?t=this.hls.audioTracks[e.id].details:e.type===Fp&&null!==e.id&&(t=this.hls.subtitleTracks[e.id].details),t){const e=t.partTarget,i=t.targetduration;if(e&&i){const t=1e3*Math.max(3*e,.8*i);s=kc({},s,{maxTimeToFirstByteMs:Math.min(t,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(t,s.maxTimeToFirstByteMs)})}}}const o=s.errorRetry||s.timeoutRetry||{},a={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},n={onSuccess:(e,t,i,s)=>{const r=this.getInternalLoader(i);this.resetInternalLoader(i.type);const o=e.data;0===o.indexOf("#EXTM3U")?(t.parsing.start=performance.now(),Tp.isMediaPlaylist(o)?this.handleTrackOrLevelPlaylist(e,t,i,s||null,r):this.handleMasterPlaylist(e,t,i,s)):this.handleManifestParsingError(e,i,new Error("no EXTM3U delimiter"),s||null,t)},onError:(e,t,i,s)=>{this.handleNetworkError(t,i,!1,e,s)},onTimeout:(e,t,i)=>{this.handleNetworkError(t,i,!0,void 0,e)}};r.load(e,a,n)}handleMasterPlaylist(e,t,i,s){const r=this.hls,o=e.data,a=Gp(e,i),n=Tp.parseMasterPlaylist(o,a);if(n.playlistParsingError)return void this.handleManifestParsingError(e,i,n.playlistParsingError,s,t);const{contentSteering:l,levels:d,sessionData:h,sessionKeys:c,startTimeOffset:u,variableList:p}=n;this.variableList=p;const{AUDIO:f=[],SUBTITLES:m,"CLOSED-CAPTIONS":g}=Tp.parseMasterPlaylistMedia(o,a,n);if(f.length){f.some((e=>!e.url))||!d[0].audioCodec||d[0].attrs.AUDIO||(Uc.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),f.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new jc({}),bitrate:0,url:""}))}r.trigger(Dc.MANIFEST_LOADED,{levels:d,audioTracks:f,subtitles:m,captions:g,contentSteering:l,url:a,stats:t,networkDetails:s,sessionData:h,sessionKeys:c,startTimeOffset:u,variableList:p})}handleTrackOrLevelPlaylist(e,t,i,s,r){const o=this.hls,{id:a,level:n,type:l}=i,d=Gp(e,i),h=Lc(n)?n:Lc(a)?a:0,c=jp(i),u=Tp.parseLevelPlaylist(e.data,d,h,c,0,this.variableList);if(l===Ip){const e={attrs:new jc({}),bitrate:0,details:u,name:"",url:d};o.trigger(Dc.MANIFEST_LOADED,{levels:[e],audioTracks:[],url:d,stats:t,networkDetails:s,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=u,this.handlePlaylistLoaded(u,e,t,i,s,r)}handleManifestParsingError(e,t,i,s,r){this.hls.trigger(Dc.ERROR,{type:Rc.NETWORK_ERROR,details:Pc.MANIFEST_PARSING_ERROR,fatal:t.type===Ip,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:s,stats:r})}handleNetworkError(e,t,i=!1,s,r){let o=`A network ${i?"timeout":"error"+(s?" (status "+s.code+")":"")} occurred while loading ${e.type}`;e.type===Bp?o+=`: ${e.level} id: ${e.id}`:e.type!==Mp&&e.type!==Fp||(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);Uc.warn(`[playlist-loader]: ${o}`);let n=Pc.UNKNOWN,l=!1;const d=this.getInternalLoader(e);switch(e.type){case Ip:n=i?Pc.MANIFEST_LOAD_TIMEOUT:Pc.MANIFEST_LOAD_ERROR,l=!0;break;case Bp:n=i?Pc.LEVEL_LOAD_TIMEOUT:Pc.LEVEL_LOAD_ERROR,l=!1;break;case Mp:n=i?Pc.AUDIO_TRACK_LOAD_TIMEOUT:Pc.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case Fp:n=i?Pc.SUBTITLE_TRACK_LOAD_TIMEOUT:Pc.SUBTITLE_LOAD_ERROR,l=!1}d&&this.resetInternalLoader(e.type);const h={type:Rc.NETWORK_ERROR,details:n,fatal:l,url:e.url,loader:d,context:e,error:a,networkDetails:t,stats:r};if(s){const i=(null==t?void 0:t.url)||e.url;h.response=Sc({url:i,data:void 0},s)}this.hls.trigger(Dc.ERROR,h)}handlePlaylistLoaded(e,t,i,s,r,o){const a=this.hls,{type:n,level:l,id:d,groupId:h,deliveryDirectives:c}=s,u=Gp(t,s),p=jp(s),f="number"==typeof s.level&&p===Up?l:void 0;if(!e.fragments.length){const e=new Error("No Segments found in Playlist");return void a.trigger(Dc.ERROR,{type:Rc.NETWORK_ERROR,details:Pc.LEVEL_EMPTY_ERROR,fatal:!1,url:u,error:e,reason:e.message,response:t,context:s,level:f,parent:p,networkDetails:r,stats:i})}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const m=e.playlistParsingError;if(m)a.trigger(Dc.ERROR,{type:Rc.NETWORK_ERROR,details:Pc.LEVEL_PARSING_ERROR,fatal:!1,url:u,error:m,reason:m.message,response:t,context:s,level:f,parent:p,networkDetails:r,stats:i});else switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),o.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),n){case Ip:case Bp:a.trigger(Dc.LEVEL_LOADED,{details:e,level:f||0,id:d||0,stats:i,networkDetails:r,deliveryDirectives:c});break;case Mp:a.trigger(Dc.AUDIO_TRACK_LOADED,{details:e,id:d||0,groupId:h||"",stats:i,networkDetails:r,deliveryDirectives:c});break;case Fp:a.trigger(Dc.SUBTITLE_TRACK_LOADED,{details:e,id:d||0,groupId:h||"",stats:i,networkDetails:r,deliveryDirectives:c})}}}function zp(e,t){let i;try{i=new Event("addtrack")}catch(e){i=document.createEvent("Event"),i.initEvent("addtrack",!1,!1)}i.track=e,t.dispatchEvent(i)}function $p(e,t){const i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error(`addCue is failed for: ${t}`)}catch(i){Uc.debug(`[texttrack-utils]: ${i}`);try{const i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}catch(e){Uc.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${e}`)}}"disabled"===i&&(e.mode=i)}function Vp(e){const t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(let t=e.cues.length;t--;)e.removeCue(e.cues[t]);"disabled"===t&&(e.mode=t)}function Hp(e,t,i,s){const r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&e.cues.length>0){const r=function(e,t,i){const s=[],r=function(e,t){if(te[i].endTime)return-1;let s=0,r=i;for(;s<=r;){const o=Math.floor((r+s)/2);if(te[o].startTime&&s-1)for(let o=r,a=e.length;o=t&&r.endTime<=i)s.push(r);else if(r.startTime>i)return s}return s}(e.cues,t,i);for(let t=0;t{const e=Qp();try{e&&new e(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function ef(e,t){return e.getTime()/1e3-t}class tf{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(Dc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Dc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Dc.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(Dc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Dc.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(Dc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Dc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Dc.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(Dc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Dc.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(Vp(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;tZp&&(s=Zp);s-i<=0&&(s=i+.25);for(let e=0;ee.type===qp&&n:"video"===s?e=>e.type===Yp&&a:e=>e.type===qp&&n||e.type===Yp&&a,Hp(r,t,i,e)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:i,id3Track:s}=this,{dateRanges:r}=t,o=Object.keys(r);if(s){const e=Object.keys(i).filter((e=>!o.includes(e)));for(let t=e.length;t--;){const r=e[t];Object.keys(i[r].cues).forEach((e=>{s.removeCue(i[r].cues[e])})),delete i[r]}}const a=t.fragments[t.fragments.length-1];if(0===o.length||!Lc(null==a?void 0:a.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const n=a.programDateTime/1e3-a.start,l=Qp();for(let e=0;e{if(t!==s.id){const i=r[t];if(i.class===s.class&&i.startDate>s.startDate&&(!e||s.startDatethis.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(null===e)return null;const{holdBack:t,partHoldBack:i,targetduration:s}=e,{liveSyncDuration:r,liveSyncDurationCount:o,lowLatencyMode:a}=this.config,n=this.hls.userConfig;let l=a&&i||t;(n.liveSyncDuration||n.liveSyncDurationCount||0===l)&&(l=void 0!==r?r:o*s);const d=s;return l+Math.min(1*this.stallCount,d)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(null===e||null===t||null===i)return null;const s=i.edge,r=e-t-this.edgeStalled,o=s-i.totalduration,a=s-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(o,r),a)}get drift(){const{levelDetails:e}=this;return null===e?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(null===e)return 0;const t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(Dc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Dc.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(Dc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(Dc.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(Dc.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(Dc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Dc.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(Dc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(Dc.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(Dc.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var i;t.details===Pc.BUFFER_STALLED_ERROR&&(this.stallCount++,null!=(i=this.levelDetails)&&i.live&&Uc.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const i=this.computeLatency();if(null===i)return;this._latency=i;const{lowLatencyMode:s,maxLiveSyncPlaybackRate:r}=this.config;if(!s||1===r||!t.live)return;const o=this.targetLatency;if(null===o)return;const a=i-o;if(a.05&&this.forwardBufferLength>1){const t=Math.min(2,Math.max(1,r)),i=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;e.playbackRate=Math.min(t,Math.max(1,i))}else 1!==e.playbackRate&&0!==e.playbackRate&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return null===e?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return null===e?null:e-this.currentTime}}const rf=["NONE","TYPE-0","TYPE-1",null];const of=["SDR","PQ","HLG"];var af="",nf="YES",lf="v2";function df(e){const{canSkipUntil:t,canSkipDateRanges:i,age:s}=e;return t&&s!!e)).map((e=>e.substring(0,4))).join(","),this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return uf(this._audioGroups,e)}hasSubtitleGroup(e){return uf(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t)if("audio"===e){let e=this._audioGroups;e||(e=this._audioGroups=[]),-1===e.indexOf(t)&&e.push(t)}else if("text"===e){let e=this._subtitleGroups;e||(e=this._subtitleGroups=[]),-1===e.indexOf(t)&&e.push(t)}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return null==(e=this.audioGroups)?void 0:e[0]}get textGroupId(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}addFallback(){}}function uf(e,t){return!(!t||!e)&&-1!==e.indexOf(t)}function pf(e,t){const i=t.startPTS;if(Lc(i)){let s,r=0;t.sn>e.sn?(r=i-e.start,s=e):(r=e.start-i,s=t),s.duration!==r&&(s.duration=r)}else if(t.sn>e.sn){e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration}else t.start=Math.max(e.start-t.duration,0)}function ff(e,t,i,s,r,o){s-i<=0&&(Uc.warn("Fragment should have a positive duration",t),s=i+t.duration,o=r+t.duration);let a=i,n=s;const l=t.startPTS,d=t.endPTS;if(Lc(l)){const e=Math.abs(l-i);Lc(t.deltaPTS)?t.deltaPTS=Math.max(e,t.deltaPTS):t.deltaPTS=e,a=Math.max(i,l),i=Math.min(i,l),r=Math.min(r,t.startDTS),n=Math.min(s,d),s=Math.max(s,d),o=Math.max(o,t.endDTS)}const h=i-t.start;0!==t.start&&(t.start=i),t.duration=s-t.start,t.startPTS=i,t.maxStartPTS=a,t.startDTS=r,t.endPTS=s,t.minEndPTS=n,t.endDTS=o;const c=t.sn;if(!e||ce.endSN)return 0;let u;const p=c-e.startSN,f=e.fragments;for(f[p]=t,u=p;u>0;u--)pf(f[u],f[u-1]);for(u=p;u=0;e--){const t=s[e].initSegment;if(t){i=t;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;let r,o=0;if(function(e,t,i){const s=t.skippedSegments,r=Math.max(e.startSN,t.startSN)-t.startSN,o=(e.fragmentHint?1:0)+(s?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,a=t.startSN-e.startSN,n=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;for(let e=r;e<=o;e++){const r=l[a+e];let o=n[e];s&&!o&&e{e.relurl&&(o=e.cc-s.cc),Lc(e.startPTS)&&Lc(e.endPTS)&&(s.start=s.startPTS=e.startPTS,s.startDTS=e.startDTS,s.maxStartPTS=e.maxStartPTS,s.endPTS=e.endPTS,s.endDTS=e.endDTS,s.minEndPTS=e.minEndPTS,s.duration=e.endPTS-e.startPTS,s.duration&&(r=s),t.PTSKnown=t.alignedSliding=!0),s.elementaryStreams=e.elementaryStreams,s.loader=e.loader,s.stats=e.stats,e.initSegment&&(s.initSegment=e.initSegment,i=e.initSegment)})),i){(t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments).forEach((e=>{var t;!e||e.initSegment&&e.initSegment.relurl!==(null==(t=i)?void 0:t.relurl)||(e.initSegment=i)}))}if(t.skippedSegments)if(t.deltaUpdateFailed=t.fragments.some((e=>!e)),t.deltaUpdateFailed){Uc.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let e=t.skippedSegments;e--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC=t.fragments[0].cc}else t.canSkipDateRanges&&(t.dateRanges=function(e,t,i){const s=kc({},e);i&&i.forEach((e=>{delete s[e]}));return Object.keys(t).forEach((e=>{const i=new Wc(t[e].attr,s[e]);i.isValid?s[e]=i:Uc.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(t[e].attr)}"`)})),s}(e.dateRanges,t.dateRanges,t.recentlyRemovedDateranges));const a=t.fragments;if(o){Uc.warn("discontinuity sliding from playlist, take drift into account");for(let e=0;e{t.elementaryStreams=e.elementaryStreams,t.stats=e.stats})),r?ff(t,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS):gf(e,t),a.length&&(t.totalduration=t.edge-a[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;const n=t.advancedDateTime;if(t.advanced&&n){const e=t.edge;t.driftStart||(t.driftStartTime=n,t.driftStart=e),t.driftEndTime=n,t.driftEnd=e}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime}function gf(e,t){const i=t.startSN+t.skippedSegments-e.startSN,s=e.fragments;i<0||i>=s.length||yf(t,s[i].start)}function yf(e,t){if(t){const i=e.fragments;for(let s=e.skippedSegments;s{const{details:i}=e;null!=i&&i.fragments&&i.fragments.forEach((e=>{e.level=t}))}))}function _f(e){switch(e.details){case Pc.FRAG_LOAD_TIMEOUT:case Pc.KEY_LOAD_TIMEOUT:case Pc.LEVEL_LOAD_TIMEOUT:case Pc.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function wf(e,t){const i=_f(t);return e.default[(i?"timeout":"error")+"Retry"]}function Sf(e,t){const i="linear"===e.backoff?1:Math.pow(2,t);return Math.min(i*e.retryDelayMs,e.maxRetryDelayMs)}function Ef(e){return Sc(Sc({},e),{errorRetry:null,timeoutRetry:null})}function Tf(e,t,i,s){if(!e)return!1;const r=null==s?void 0:s.code,o=t499)}(r)||!!i);return e.shouldRetry?e.shouldRetry(e,t,i,s,o):o}const kf=function(e,t){let i=0,s=e.length-1,r=null,o=null;for(;i<=s;){r=(i+s)/2|0,o=e[r];const a=t(o);if(a>0)i=r+1;else{if(!(a<0))return o;s=r-1}}return null};function Lf(e,t,i=0,s=0,r=.005){let o=null;if(e){o=t[e.sn-t[0].sn+1]||null;const s=e.endDTS-i;s>0&&s<15e-7&&(i+=15e-7)}else 0===i&&0===t[0].start&&(o=t[0]);if(o&&((!e||e.level===o.level)&&0===Cf(i,s,o)||function(e,t,i){if(t&&0===t.start&&t.level0){const s=t.tagList.reduce(((e,t)=>("INF"===t[0]&&(e+=parseFloat(t[1])),e)),i);return e.start<=s}return!1}(o,e,Math.min(r,s))))return o;const a=kf(t,Cf.bind(null,i,s));return!a||a===e&&o?o:a}function Cf(e=0,t=0,i){if(i.start<=e&&i.start+i.duration>e)return 0;const s=Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return i.start+i.duration-s<=e?1:i.start-s>e&&i.start?-1:0}function xf(e,t,i){const s=1e3*Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return(i.endProgramDateTime||0)-s>e}var Df=0,Rf=2,Pf=3,If=5,Bf=0,Mf=1,Ff=2;class Uf{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=Uc.log.bind(Uc,`${t}:`),this.warn=Uc.warn.bind(Uc,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const s=null==t?void 0:t.renditionReports;if(s){let r=-1;for(let i=0;i=0&&e>t.partTarget&&(a+=1)}const n=i&&df(i);return new hf(o,a>=0?a:void 0,n)}}}loadPlaylist(e){-1===this.requestScheduled&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return-1===this.timer&&-1===this.requestScheduled&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,i){const{details:s,stats:r}=t,o=self.performance.now(),a=r.loading.first?Math.max(0,o-r.loading.first):0;if(s.advancedDateTime=Date.now()-a,s.live||null!=i&&i.live){if(s.reloaded(i),i&&this.log(`live playlist ${e} ${s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:s.updated?"UPDATED":"MISSED"}`),i&&s.fragments.length>0&&mf(i,s),!this.canLoad||!s.live)return;let a,n,l;if(s.canBlockReload&&s.endSN&&s.advanced){const e=this.hls.config.lowLatencyMode,r=s.lastPartSn,o=s.endSN,d=s.lastPartIndex,h=r===o,c=e?0:d;-1!==d?(n=h?o+1:r,l=h?c:d+1):n=o+1;const u=s.age,p=u+s.ageHeader;let f=Math.min(p-s.partTarget,1.5*s.targetduration);if(f>0){if(i&&f>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${f} with playlist age: ${s.age}`),f=0;else{const e=Math.floor(f/s.targetduration);if(n+=e,void 0!==l){l+=Math.round(f%s.targetduration/s.partTarget)}this.log(`CDN Tune-in age: ${s.ageHeader}s last advanced ${u.toFixed(2)}s goal: ${f} skip sn ${e} to part ${l}`)}s.tuneInGoal=f}if(a=this.getDeliveryDirectives(s,t.deliveryDirectives,n,l),e||!h)return void this.loadPlaylist(a)}else(s.canBlockReload||s.canSkipUntil)&&(a=this.getDeliveryDirectives(s,t.deliveryDirectives,n,l));const d=this.hls.mainForwardBufferInfo,h=d?d.end-d.len:0,c=function(e,t=1/0){let i=1e3*e.targetduration;if(e.updated){const s=e.fragments,r=4;if(s.length&&i*r>t){const e=1e3*s[s.length-1].duration;ethis.requestScheduled+c&&(this.requestScheduled=r.loading.start),void 0!==n&&s.canBlockReload?this.requestScheduled=r.loading.first+c-(1e3*s.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+cthis.loadPlaylist(a)),u)}else this.clearTimer()}getDeliveryDirectives(e,t,i,s){let r=df(e);return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,s=t.part,r=af),new hf(i,s,r)}checkRetry(e){const t=e.details,i=_f(e),s=e.errorAction,{action:r,retryCount:o=0,retryConfig:a}=s||{},n=!!s&&!!a&&(r===If||!s.resolved&&r===Rf);if(n){var l;if(this.requestScheduled=-1,o>=a.maxNumRetry)return!1;if(i&&null!=(l=e.context)&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const e=Sf(a,o);this.timer=self.setTimeout((()=>this.loadPlaylist()),e),this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" in ${e}ms`)}e.levelRetry=!0,s.resolved=!0}return n}}class Of{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class Nf{constructor(e,t,i,s=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Of(e),this.fast_=new Of(t),this.defaultTTFB_=s,this.ttfb_=new Of(e)}update(e,t){const{slow_:i,fast_:s,ttfb_:r}=this;i.halfLife!==e&&(this.slow_=new Of(e,i.getEstimate(),i.getTotalWeight())),s.halfLife!==t&&(this.fast_=new Of(t,s.getEstimate(),s.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new Of(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){const i=(e=Math.max(e,this.minDelayMs_))/1e3,s=8*t/i;this.fast_.sample(i,s),this.slow_.sample(i,s)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const jf={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},Gf={};function Wf(e,t,i,s,r,o){const a=e.audioCodec?e.audioGroups:null,n=null==o?void 0:o.audioCodec,l=null==o?void 0:o.channels,d=l?parseInt(l):n?1/0:2;let h=null;if(null!=a&&a.length)try{h=1===a.length&&a[0]?t.groups[a[0]].channels:a.reduce(((e,i)=>{if(i){const s=t.groups[i];if(!s)throw new Error(`Audio track group ${i} not found`);Object.keys(s.channels).forEach((t=>{e[t]=(e[t]||0)+s.channels[t]}))}return e}),{2:0})}catch(e){return!0}return void 0!==e.videoCodec&&(e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(s,30)||"SDR"!==e.videoRange&&e.videoRange!==i||e.bitrate>Math.max(r,8e6))||!!h&&Lc(d)&&Object.keys(h).some((e=>parseInt(e)>d))}function zf(e,t,i){const s=e.videoCodec,r=e.audioCodec;if(!s||!r||!i)return Promise.resolve(jf);const o={width:e.width,height:e.height,bitrate:Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)),framerate:e.frameRate||30},a=e.videoRange;"SDR"!==a&&(o.transferFunction=a.toLowerCase());const n=s.split(",").map((e=>({type:"media-source",video:Sc(Sc({},o),{},{contentType:pp(e,"video")})})));return r&&e.audioGroups&&e.audioGroups.forEach((e=>{var i;e&&(null==(i=t.groups[e])||i.tracks.forEach((t=>{if(t.groupId===e){const e=t.channels||"",i=parseFloat(e);Lc(i)&&i>2&&n.push.apply(n,r.split(",").map((e=>({type:"media-source",audio:{contentType:pp(e,"audio"),channels:""+i}}))))}})))})),Promise.all(n.map((e=>{const t=function(e){const{audio:t,video:i}=e,s=i||t;if(s){const e=s.contentType.split('"')[1];if(i)return`r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${e}_${Math.ceil(i.bitrate/1e5)}`;if(t)return`c${t.channels}${t.spatialRendering?"s":"n"}_${e}`}return""}(e);return Gf[t]||(Gf[t]=i.decodingInfo(e))}))).then((e=>({supported:!e.some((e=>!e.supported)),configurations:n,decodingInfoResults:e}))).catch((e=>({supported:!1,configurations:n,decodingInfoResults:[],error:e})))}function $f(e,t){let i=!1,s=[];return e&&(i="SDR"!==e,s=[e]),t&&(s=t.allowedVideoRanges||of.slice(0),i=void 0!==t.preferHDR?t.preferHDR:function(){if("function"==typeof matchMedia){const e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}(),s=i?s.filter((e=>"SDR"!==e)):["SDR"]),{preferHDR:i,allowedVideoRanges:s}}function Vf(e,t){Uc.log(`[abr] start candidates with "${e}" ignored because ${t}`)}function Hf(e,t,i){if("attrs"in e){const i=t.indexOf(e);if(-1!==i)return i}for(let s=0;s-1===s.indexOf(e)))}(n,t.characteristics))&&(void 0===i||i(e,t))}function qf(e,t){const{audioCodec:i,channels:s}=e;return!(void 0!==i&&(t.audioCodec||"").substring(0,4)!==i.substring(0,4)||void 0!==s&&s!==(t.channels||"2"))}function Kf(e,t,i){for(let s=t;s;s--)if(i(e[s]))return s;for(let s=t+1;s{const o=this.fragments[s];if(!o)return;if(r>=o.body.sn)return;if(!o.buffered&&!o.loaded)return void(o.body.type===i&&this.removeFragment(o.body));const a=o.range[e];a&&a.time.some((e=>{const i=!this.isTimeBuffered(e.startPTS,e.endPTS,t);return i&&this.removeFragment(o.body),i}))}))}detectPartialFragments(e){const t=this.timeRanges,{frag:i,part:s}=e;if(!t||"initSegment"===i.sn)return;const r=im(i),o=this.fragments[r];if(!o||o.buffered&&i.gap)return;const a=!i.relurl;if(Object.keys(t).forEach((e=>{const r=i.elementaryStreams[e];if(!r)return;const n=t[e],l=a||!0===r.partial;o.range[e]=this.getBufferedTimes(i,s,l,n)})),o.loaded=null,Object.keys(o.range).length){o.buffered=!0;(o.body.endList=i.endList||o.body.endList)&&(this.endListFragments[o.body.type]=o),tm(o)||this.removeParts(i.sn-1,i.type)}else this.removeFragment(o.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter((t=>t.fragment.sn>=e)))}fragBuffered(e,t){const i=im(e);let s=this.fragments[i];!s&&t&&(s=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),s&&(s.loaded=null,s.buffered=!0)}getBufferedTimes(e,t,i,s){const r={time:[],partial:i},o=e.start,a=e.end,n=e.minEndPTS||a,l=e.maxStartPTS||o;for(let e=0;e=t&&n<=i){r.time.push({startPTS:Math.max(o,s.start(e)),endPTS:Math.min(a,s.end(e))});break}if(ot){const t=Math.max(o,s.start(e)),i=Math.min(a,s.end(e));i>t&&(r.partial=!0,r.time.push({startPTS:t,endPTS:i}))}else if(a<=t)break}return r}getPartialFragment(e){let t,i,s,r=null,o=0;const{bufferPadding:a,fragments:n}=this;return Object.keys(n).forEach((l=>{const d=n[l];d&&tm(d)&&(i=d.body.start-a,s=d.body.end+a,e>=i&&e<=s&&(t=Math.min(e-i,s-e),o<=t&&(r=d.body,o=t)))})),r}isEndListAppended(e){const t=this.endListFragments[e];return void 0!==t&&(t.buffered||tm(t))}getState(e){const t=im(e),i=this.fragments[t];return i?i.buffered?tm(i)?Xf:Zf:Qf:Yf}isTimeBuffered(e,t,i){let s,r;for(let o=0;o=s&&t<=r)return!0;if(t<=s)return!1}return!1}onFragLoaded(e,t){const{frag:i,part:s}=t;if("initSegment"===i.sn||i.bitrateTest)return;const r=s?null:t,o=im(i);this.fragments[o]={body:i,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:s,timeRanges:r}=t;if("initSegment"===i.sn)return;const o=i.type;if(s){let e=this.activePartLists[o];e||(this.activePartLists[o]=e=[]),e.push(s)}this.timeRanges=r,Object.keys(r).forEach((e=>{const t=r[e];this.detectEvictedFragments(e,t,o,s)}))}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=im(e);return!!this.fragments[t]}hasParts(e){var t;return!(null==(t=this.activePartLists[e])||!t.length)}removeFragmentsInRange(e,t,i,s,r){s&&!this.hasGaps||Object.keys(this.fragments).forEach((o=>{const a=this.fragments[o];if(!a)return;const n=a.body;n.type!==i||s&&!n.gap||n.starte&&(a.buffered||r)&&this.removeFragment(n)}))}removeFragment(e){const t=im(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const t=e.sn;this.activePartLists[e.type]=i.filter((e=>e.fragment.sn!==t))}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function tm(e){var t,i,s;return e.buffered&&(e.body.gap||(null==(t=e.range.video)?void 0:t.partial)||(null==(i=e.range.audio)?void 0:i.partial)||(null==(s=e.range.audiovideo)?void 0:s.partial))}function im(e){return`${e.type}_${e.level}_${e.sn}`}const sm={length:0,start:()=>0,end:()=>0};class rm{static isBuffered(e,t){try{if(e){const i=rm.getBuffered(e);for(let e=0;e=i.start(e)&&t<=i.end(e))return!0}}catch(e){}return!1}static bufferInfo(e,t,i){try{if(e){const s=rm.getBuffered(e),r=[];let o;for(o=0;oo&&(s[r-1].end=e[t].end):s.push(e[t])}else s.push(e[t])}else s=e;let r,o=0,a=t,n=t;for(let e=0;e=l&&ti.startCC||e&&e.cc{if(this.loader&&this.loader.destroy(),e.gap){if(e.tagList.some((e=>"GAP"===e[0])))return void n(fm(e));e.gap=!1}const l=this.loader=e.loader=r?new r(s):new o(s),d=pm(e),h=Ef(s.fragLoadPolicy.default),c={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:cm};e.stats=l.stats,l.load(d,c,{onSuccess:(t,i,s,r)=>{this.resetLoader(e,l);let o=t.data;s.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(o.slice(0,16)),o=o.slice(16)),a({frag:e,part:null,payload:o,networkDetails:r})},onError:(t,s,r,o)=>{this.resetLoader(e,l),n(new mm({type:Rc.NETWORK_ERROR,details:Pc.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Sc({url:i,data:void 0},t),error:new Error(`HTTP Error ${t.code} ${t.text}`),networkDetails:r,stats:o}))},onAbort:(t,i,s)=>{this.resetLoader(e,l),n(new mm({type:Rc.NETWORK_ERROR,details:Pc.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:s,stats:t}))},onTimeout:(t,i,s)=>{this.resetLoader(e,l),n(new mm({type:Rc.NETWORK_ERROR,details:Pc.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${c.timeout}ms`),networkDetails:s,stats:t}))},onProgress:(i,s,r,o)=>{t&&t({frag:e,part:null,payload:r,networkDetails:o})}})}))}loadPart(e,t,i){this.abort();const s=this.config,r=s.fLoader,o=s.loader;return new Promise(((a,n)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap)return void n(fm(e,t));const l=this.loader=e.loader=r?new r(s):new o(s),d=pm(e,t),h=Ef(s.fragLoadPolicy.default),c={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:cm};t.stats=l.stats,l.load(d,c,{onSuccess:(s,r,o,n)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const d={frag:e,part:t,payload:s.data,networkDetails:n};i(d),a(d)},onError:(i,s,r,o)=>{this.resetLoader(e,l),n(new mm({type:Rc.NETWORK_ERROR,details:Pc.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Sc({url:d.url,data:void 0},i),error:new Error(`HTTP Error ${i.code} ${i.text}`),networkDetails:r,stats:o}))},onAbort:(i,s,r)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),n(new mm({type:Rc.NETWORK_ERROR,details:Pc.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:r,stats:i}))},onTimeout:(i,s,r)=>{this.resetLoader(e,l),n(new mm({type:Rc.NETWORK_ERROR,details:Pc.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${c.timeout}ms`),networkDetails:r,stats:i}))}})}))}updateStatsFromPart(e,t){const i=e.stats,s=t.stats,r=s.total;if(i.loaded+=s.loaded,r){const s=Math.round(e.duration/t.duration),o=Math.min(Math.round(i.loaded/r),s),a=(s-o)*Math.round(i.loaded/o);i.total=i.loaded+a}else i.total=Math.max(i.loaded,i.total);const o=i.loading,a=s.loading;o.start?o.first+=a.first-a.start:(o.start=a.start,o.first=a.first),o.end=a.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function pm(e,t=null){const i=t||e,s={frag:e,part:t,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},r=i.byteRangeStartOffset,o=i.byteRangeEndOffset;if(Lc(r)&&Lc(o)){var a;let t=r,i=o;if("initSegment"===e.sn&&"AES-128"===(null==(a=e.decryptdata)?void 0:a.method)){const e=o-r;e%16&&(i=o+(16-e%16)),0!==r&&(s.resetIV=!0,t=r-16)}s.rangeStart=t,s.rangeEnd=i}return s}function fm(e,t){const i=new Error(`GAP ${e.gap?"tag":"attribute"} found`),s={type:Rc.MEDIA_ERROR,details:Pc.FRAG_GAP,fatal:!1,frag:e,error:i,networkDetails:null};return t&&(s.part=t),(t||e).stats.aborted=!0,new mm(s)}class mm extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class gm{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class ym{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}class Am{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let e=0;e<4;e++)i[e]=t.getUint32(4*e);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,s=i[0],r=i[1],o=i[2],a=i[3],n=this.invSubMix,l=n[0],d=n[1],h=n[2],c=n[3],u=new Uint32Array(256);let p=0,f=0,m=0;for(m=0;m<256;m++)u[m]=m<128?m<<1:m<<1^283;for(m=0;m<256;m++){let i=f^f<<1^f<<2^f<<3^f<<4;i=i>>>8^255&i^99,e[p]=i,t[i]=p;const n=u[p],m=u[n],g=u[m];let y=257*u[i]^16843008*i;s[p]=y<<24|y>>>8,r[p]=y<<16|y>>>16,o[p]=y<<8|y>>>24,a[p]=y,y=16843009*g^65537*m^257*n^16843008*p,l[i]=y<<24|y>>>8,d[i]=y<<16|y>>>16,h[i]=y<<8|y>>>24,c[i]=y,p?(p=n^u[u[u[g^n]]],f^=u[u[f]]):p=f=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,s=0;for(;s{if(!this.subtle)return Promise.reject(new Error("web crypto not initialized"));this.logOnce("WebCrypto AES decrypt");return new gm(this.subtle,new Uint8Array(i)).decrypt(e.buffer,t)})).catch((s=>(Uc.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,t,i))))}onWebCryptoError(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);const s=this.flush();if(s)return s.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%16;return i!==e.length&&(t=uu(e,0,i),this.remainderData=uu(e,i)),t}logOnce(e){this.logEnabled&&(Uc.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const vm=function(e){let t="";const i=e.length;for(let s=0;s1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}{constructor(e,t,i,s,r){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=_m,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.loadedmetadata=!1,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=r,this.logPrefix=s,this.log=Uc.log.bind(Uc,`${s}:`),this.warn=Uc.warn.bind(Uc,`${s}:`),this.hls=e,this.fragmentLoader=new um(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new bm(e.config),e.on(Dc.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;null!=e&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=_m}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const i=t.partList;if(null!=i&&i.length){const e=i[i.length-1];return rm.isBuffered(this.media,e.start+e.duration/2)}const s=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(s)}getLevelDetails(){var e;if(this.levels&&null!==this.levelLastLoaded)return null==(e=this.levelLastLoaded)?void 0:e.details}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),i.addEventListener("seeking",this.onvseeking),i.addEventListener("ended",this.onvended);const s=this.config;this.levels&&s.autoStartLoad&&this.state===_m&&this.startLoad(s.startPosition)}onMediaDetaching(){const e=this.media;null!=e&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:i,mediaBuffer:s,state:r}=this,o=i?i.currentTime:0,a=rm.bufferInfo(s||i,o,e.maxBufferHole);if(this.log(`media seeking to ${Lc(o)?o.toFixed(3):o}, state: ${r}`),this.state===xm)this.resetLoadingState();else if(t){const i=e.maxFragLookUpTolerance,s=t.start-i,r=t.start+t.duration+i;if(!a.len||ra.end){const e=o>r;(o{if(this.fragContextChanged(e))return this.warn(`Fragment ${e.sn}${t.part?" p: "+t.part.index:""} of level ${e.level} was dropped during download.`),void this.fragmentTracker.removeFragment(e);e.stats.chunkCount++,this._handleFragmentLoadProgress(t)})).then((t=>{if(!t)return;const i=this.state;this.fragContextChanged(e)?(i===Em||!this.fragCurrent&&i===Lm)&&(this.fragmentTracker.removeFragment(e),this.state=wm):("payload"in t&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(Dc.FRAG_LOADED,t)),this._handleFragmentLoadComplete(t))})).catch((t=>{this.state!==_m&&this.state!==Dm&&(this.warn(`Frag error: ${(null==t?void 0:t.message)||t}`),this.resetFragmentLoading(e))}))}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===Qf){const t=e.type,s=this.getFwdBufferInfo(this.mediaBuffer,t),r=Math.max(e.duration,s?s.len:this.config.maxBufferLength),o=this.backtrackFragment;(1===(o?e.sn-o.sn:0)||this.reduceMaxBufferLength(r,e.duration))&&i.removeFragment(e)}else 0===(null==(t=this.mediaBuffer)?void 0:t.buffered.length)?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===Xf&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const s={startOffset:e,endOffset:t,type:i};this.hls.trigger(Dc.BUFFER_FLUSHING,s)}_loadInitSegment(e,t){this._doFragLoad(e,t).then((t=>{if(!t||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return t})).then((t=>{const{hls:i}=this,{payload:s}=t,r=e.decryptdata;if(s&&s.byteLength>0&&null!=r&&r.key&&r.iv&&"AES-128"===r.method){const o=self.performance.now();return this.decrypter.decrypt(new Uint8Array(s),r.key.buffer,r.iv.buffer).catch((t=>{throw i.trigger(Dc.ERROR,{type:Rc.MEDIA_ERROR,details:Pc.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t})).then((s=>{const r=self.performance.now();return i.trigger(Dc.FRAG_DECRYPTED,{frag:e,payload:s,stats:{tstart:o,tdecrypt:r}}),t.payload=s,this.completeInitSegmentLoad(t)}))}return this.completeInitSegmentLoad(t)})).catch((t=>{this.state!==_m&&this.state!==Dm&&(this.warn(t),this.resetFragmentLoading(e))}))}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state=wm,e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var i,s,r,o;const a=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===Up?"level":"track"} ${e.level} (frag:[${(null!=(i=e.startPTS)?i:NaN).toFixed(3)}-${(null!=(s=e.endPTS)?s:NaN).toFixed(3)}] > buffer:${a?vm(rm.getBuffered(a)):"(detached)"})`),"initSegment"!==e.sn){var n;if(e.type!==Np){const t=e.elementaryStreams;if(!Object.keys(t).some((e=>!!t[e])))return void(this.state=wm)}const t=null==(n=this.levels)?void 0:n[e.level];null!=t&&t.fragmentError&&(this.log(`Resetting level fragment error count of ${t.fragmentError} on frag buffered`),t.fragmentError=0)}this.state=wm,a&&(!this.loadedmetadata&&e.type==Up&&a.buffered.length&&(null==(r=this.fragCurrent)?void 0:r.sn)===(null==(o=this.fragPrevious)?void 0:o.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:s,partsLoaded:r}=e,o=!r||0===r.length||r.some((e=>!e)),a=new om(i.level,i.sn,i.stats.chunkCount+1,0,s?s.index:-1,!o);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,s){var r;const o=null==t?void 0:t.details;if(!this.levels||!o)throw new Error(`frag load aborted, missing level${o?"":" detail"}s`);let a=null;if(!e.encrypted||null!=(r=e.decryptdata)&&r.key?!e.encrypted&&o.encryptedFragments.length&&this.keyLoader.loadClear(e,o.encryptedFragments):(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${"[stream-controller]"===this.logPrefix?"level":"track"} ${e.level}`),this.state=Sm,this.fragCurrent=e,a=this.keyLoader.load(e).then((e=>{if(!this.fragContextChanged(e.frag))return this.hls.trigger(Dc.KEY_LOADED,e),this.state===Sm&&(this.state=wm),e})),this.hls.trigger(Dc.KEY_LOADING,{frag:e}),null===this.fragCurrent&&(a=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),i=Math.max(e.start,i||0),this.config.lowLatencyMode&&"initSegment"!==e.sn){const r=o.partList;if(r&&s){i>e.end&&o.fragmentHint&&(e=o.fragmentHint);const n=this.getNextPart(r,e,i);if(n>-1){const l=r[n];let d;return this.log(`Loading part sn: ${e.sn} p: ${l.index} cc: ${e.cc} of playlist [${o.startSN}-${o.endSN}] parts [0-${n}-${r.length-1}] ${"[stream-controller]"===this.logPrefix?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=l.start+l.duration,this.state=Em,d=a?a.then((i=>!i||this.fragContextChanged(i.frag)?null:this.doFragPartsLoad(e,l,t,s))).catch((e=>this.handleFragLoadError(e))):this.doFragPartsLoad(e,l,t,s).catch((e=>this.handleFragLoadError(e))),this.hls.trigger(Dc.FRAG_LOADING,{frag:e,part:l,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}if(!e.url||this.loadedEndOfParts(r,i))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${o?"of ["+o.startSN+"-"+o.endSN+"] ":""}${"[stream-controller]"===this.logPrefix?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),Lc(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Em;const n=this.config.progressive;let l;return l=n&&a?a.then((t=>!t||this.fragContextChanged(null==t?void 0:t.frag)?null:this.fragmentLoader.load(e,s))).catch((e=>this.handleFragLoadError(e))):Promise.all([this.fragmentLoader.load(e,n?s:void 0),a]).then((([e])=>(!n&&e&&s&&s(e),e))).catch((e=>this.handleFragLoadError(e))),this.hls.trigger(Dc.FRAG_LOADING,{frag:e,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l}doFragPartsLoad(e,t,i,s){return new Promise(((r,o)=>{var a;const n=[],l=null==(a=i.details)?void 0:a.partList,d=t=>{this.fragmentLoader.loadPart(e,t,s).then((s=>{n[t.index]=s;const o=s.part;this.hls.trigger(Dc.FRAG_LOADED,s);const a=Af(i,e.sn,t.index+1)||bf(l,e.sn,t.index+1);if(!a)return r({frag:e,part:o,partsLoaded:n});d(a)})).catch(o)};d(t)}))}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===Pc.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(Dc.ERROR,t)}else this.hls.trigger(Dc.ERROR,{type:Rc.OTHER_ERROR,details:Pc.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==Lm)return void(this.fragCurrent||this.state===_m||this.state===Dm||(this.state=wm));const{frag:i,part:s,level:r}=t,o=self.performance.now();i.stats.parsing.end=o,s&&(s.stats.parsing.end=o),this.updateLevelTiming(i,s,r,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:s,sn:r,part:o}=e;if(null==t||!t[s])return this.warn(`Levels object was unset while buffering fragment ${r} of level ${s}. The current chunk will not be buffered.`),null;const a=t[s],n=o>-1?Af(a,r,o):null,l=n?n.fragment:function(e,t,i){if(null==e||!e.details)return null;const s=e.details;let r=s.fragments[t-s.startSN];return r||(r=s.fragmentHint,r&&r.sn===t?r:to&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){const i=this.getLoadPosition();return Lc(i)?this.getFwdBufferInfoAtPos(e,i,t):null}getFwdBufferInfoAtPos(e,t,i){const{config:{maxBufferHole:s}}=this,r=rm.bufferInfo(e,t,s);if(0===r.len&&void 0!==r.nextStart){const o=this.fragmentTracker.getBufferedFrag(t,i);if(o&&r.nextStart=s&&(i.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0)}getAppendedFrag(e,t=Up){const i=this.fragmentTracker.getAppendedFrag(e,Up);return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,s=i.length;if(!s)return null;const{config:r}=this,o=i[0].start;let a;if(t.live){const n=r.initialLiveManifestSize;if(st}getNextFragmentLoopLoading(e,t,i,s,r){const o=e.gap,a=this.getNextFragment(this.nextLoadPosition,t);if(null===a)return a;if(e=a,o&&e&&!e.gap&&i.nextStart){const t=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,s);if(null!==t&&i.len+t.len>=r)return this.log(`buffer full after gaps in "${s}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return null==e||!e.initSegment||null!=e&&e.initSegment.data||this.bitrateTest?e:e.initSegment}getNextPart(e,t,i){let s=-1,r=!1,o=!0;for(let a=0,n=e.length;a-1&&ii.start&&i.loaded}getInitialLiveFragment(e,t){const i=this.fragPrevious;let s=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),s=function(e,t,i){if(null===t||!Array.isArray(e)||!e.length||!Lc(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;i=i||0;for(let s=0;s=e.startSN&&r<=e.endSN){const o=t[r-e.startSN];i.cc===o.cc&&(s=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${s.sn}`))}s||(s=function(e,t){return kf(e,(e=>e.cct?-1:0))}(t,i.cc),s&&this.log(`Live playlist, switching playlist, load frag with same CC: ${s.sn}`))}}else{const t=this.hls.liveSyncPosition;null!==t&&(s=this.getFragmentAtPosition(t,this.bitrateTest?e.fragmentEnd:e.edge,e))}return s}getFragmentAtPosition(e,t,i){const{config:s}=this;let{fragPrevious:r}=this,{fragments:o,endSN:a}=i;const{fragmentHint:n}=i,{maxFragLookUpTolerance:l}=s,d=i.partList,h=!!(s.lowLatencyMode&&null!=d&&d.length&&n);let c;if(h&&n&&!this.bitrateTest&&(o=o.concat(n),a=n.sn),et-l?0:l)}else c=o[o.length-1];if(c){const e=c.sn-i.startSN,t=this.fragmentTracker.getState(c);if((t===Zf||t===Xf&&c.gap)&&(r=c),r&&c.sn===r.sn&&(!h||d[0].fragment.sn>c.sn)){if(r&&c.level===r.level){const t=o[e+1];c=c.sn=o-t.maxFragLookUpTolerance&&r<=a;if(null!==s&&i.duration>s&&(r${e.startSN} prev-sn: ${r?r.sn:"na"} fragments: ${s}`),o}return r}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)}setStartPosition(e,t){let i=this.startPosition;if(i ${null==(s=this.fragCurrent)?void 0:s.url}`);const r=t.details===Pc.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(i,!0);const o=t.errorAction,{action:a,retryCount:n=0,retryConfig:l}=o||{};if(o&&a===If&&l){this.resetStartWhenNotLoaded(this.levelLastLoaded);const s=Sf(l,n);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${n+1}/${l.maxNumRetry} in ${s}ms`),o.resolved=!0,this.retryDate=self.performance.now()+s,this.state=Tm}else if(l&&o){if(this.resetFragmentErrors(e),!(n.5;r&&this.reduceMaxBufferLength(s.len,(null==t?void 0:t.duration)||10);const o=!r;return o&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),o}return!1}resetFragmentErrors(e){e===Op&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==_m&&(this.state=wm)}afterBufferFlushed(e,t,i){if(!e)return;const s=rm.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,s,i),this.state===xm&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=wm}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;null!=t&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,s){var r;const o=i.details;if(!o)return void this.warn("level.details undefined");if(!Object.keys(e.elementaryStreams).reduce(((t,r)=>{const a=e.elementaryStreams[r];if(a){const n=a.endPTS-a.startPTS;if(n<=0)return this.warn(`Could not parse fragment ${e.sn} ${r} duration reliably (${n})`),t||!1;const l=s?0:ff(o,e,a.startPTS,a.endPTS,a.startDTS,a.endDTS);return this.hls.trigger(Dc.LEVEL_PTS_UPDATED,{details:o,level:i,drift:l,type:r,frag:e,start:a.startPTS,end:a.endPTS}),!0}return t}),!1)&&null===(null==(r=this.transmuxer)?void 0:r.error)){const t=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(0===i.fragmentError&&(i.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(t.message),this.hls.trigger(Dc.ERROR,{type:Rc.MEDIA_ERROR,details:Pc.FRAG_PARSING_ERROR,fatal:!1,error:t,frag:e,reason:`Found no media in msn ${e.sn} of level "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=Cm,this.hls.trigger(Dc.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class Bm{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;return e.length?(i=1===e.length?e[0]:function(e,t){const i=new Uint8Array(t);let s=0;for(let t=0;t0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:qp,duration:Number.POSITIVE_INFINITY});r{if(Lc(e))return 90*e;return 9e4*t+(i?9e4*i.baseTime/i.timescale:0)};function Om(e,t){return 255===e[t]&&240==(246&e[t+1])}function Nm(e,t){return 1&e[t+1]?7:9}function jm(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function Gm(e,t){return t+1=e.length)return!1;const s=jm(e,t);if(s<=i)return!1;const r=t+s;return r===e.length||Gm(e,r)}return!1}function zm(e,t,i,s,r){if(!e.samplerate){const o=function(e,t,i,s){let r,o,a,n;const l=navigator.userAgent.toLowerCase(),d=s,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];r=1+((192&t[i+2])>>>6);const c=(60&t[i+2])>>>2;if(!(c>h.length-1))return a=(1&t[i+2])<<2,a|=(192&t[i+3])>>>6,Uc.log(`manifest codec:${s}, ADTS type:${r}, samplingIndex:${c}`),/firefox/i.test(l)?c>=6?(r=5,n=new Array(4),o=c-3):(r=2,n=new Array(2),o=c):-1!==l.indexOf("android")?(r=2,n=new Array(2),o=c):(r=5,n=new Array(4),s&&(-1!==s.indexOf("mp4a.40.29")||-1!==s.indexOf("mp4a.40.5"))||!s&&c>=6?o=c-3:((s&&-1!==s.indexOf("mp4a.40.2")&&(c>=6&&1===a||/vivaldi/i.test(l))||!s&&1===a)&&(r=2,n=new Array(2)),o=c)),n[0]=r<<3,n[0]|=(14&c)>>1,n[1]|=(1&c)<<7,n[1]|=a<<3,5===r&&(n[1]|=(14&o)>>1,n[2]=(1&o)<<7,n[2]|=8,n[3]=0),{config:n,samplerate:h[c],channelCount:a,codec:"mp4a.40."+r,manifestCodec:d};{const t=new Error(`invalid ADTS sampling index:${c}`);e.emit(Dc.ERROR,Dc.ERROR,{type:Rc.MEDIA_ERROR,details:Pc.FRAG_PARSING_ERROR,fatal:!0,error:t,reason:t.message})}}(t,i,s,r);if(!o)return;e.config=o.config,e.samplerate=o.samplerate,e.channelCount=o.channelCount,e.codec=o.codec,e.manifestCodec=o.manifestCodec,Uc.log(`parsed codec:${e.codec}, rate:${o.samplerate}, channels:${o.channelCount}`)}}function $m(e){return 9216e4/e}function Vm(e,t,i,s,r){const o=s+r*$m(e.samplerate),a=function(e,t){const i=Nm(e,t);if(t+i<=e.length){const s=jm(e,t)-i;if(s>0)return{headerLength:i,frameLength:s}}}(t,i);let n;if(a){const{frameLength:s,headerLength:r}=a,l=r+s,d=Math.max(0,i+l-t.length);d?(n=new Uint8Array(l-r),n.set(t.subarray(i+r,t.length),0)):n=t.subarray(i+r,i+l);const h={unit:n,pts:o};return d||e.samples.push(h),{sample:h,length:l,missing:d}}const l=t.length-i;n=new Uint8Array(l),n.set(t.subarray(i,t.length),0);return{sample:{unit:n,pts:o},length:l,missing:-1}}let Hm=null;const Jm=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],qm=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Km=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Ym=[0,1,1,4];function Qm(e,t,i,s,r){if(i+24>t.length)return;const o=Xm(t,i);if(o&&i+o.frameLength<=t.length){const a=s+r*(9e4*o.samplesPerFrame/o.sampleRate),n={unit:t.subarray(i,i+o.frameLength),pts:a,dts:a};return e.config=[],e.channelCount=o.channelCount,e.samplerate=o.sampleRate,e.samples.push(n),{sample:n,length:o.frameLength,missing:0}}}function Xm(e,t){const i=e[t+1]>>3&3,s=e[t+1]>>1&3,r=e[t+2]>>4&15,o=e[t+2]>>2&3;if(1!==i&&0!==r&&15!==r&&3!==o){const a=e[t+2]>>1&1,n=e[t+3]>>6,l=1e3*Jm[14*(3===i?3-s:3===s?3:4)+r-1],d=qm[3*(3===i?0:2===i?1:2)+o],h=3===n?1:2,c=Km[i][s],u=Ym[s],p=8*c*u,f=Math.floor(c*l/d+a)*u;if(null===Hm){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Hm=e?parseInt(e[1]):0}return!!Hm&&Hm<=87&&2===s&&l>=224e3&&0===n&&(e[t+3]=128|e[t+3]),{sampleRate:d,channelCount:h,frameLength:f,samplesPerFrame:p}}}function Zm(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function eg(e,t){return t+1{let i=0,s=5;t+=s;const r=new Uint32Array(1),o=new Uint32Array(1),a=new Uint8Array(1);for(;s>0;){a[0]=e[t];const n=Math.min(s,8),l=8-n;o[0]=4278190080>>>24+l<>l,i=i?i<t.length)return-1;if(11!==t[i]||119!==t[i+1])return-1;const o=t[i+4]>>6;if(o>=3)return-1;const a=[48e3,44100,32e3][o],n=63&t[i+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*n+o];if(i+l>t.length)return-1;const d=t[i+6]>>5;let h=0;2===d?h+=2:(1&d&&1!==d&&(h+=2),4&d&&(h+=2));const c=(t[i+6]<<8|t[i+7])>>12-h&1,u=[2,1,2,3,3,4,4,5][d]+c,p=t[i+5]>>3,f=7&t[i+5],m=new Uint8Array([o<<6|p<<1|f>>2,(3&f)<<6|d<<3|c<<2|n>>4,n<<4&224]),g=s+r*(1536/a*9e4),y=t.subarray(i,i+l);return e.config=m,e.channelCount=u,e.samplerate=a,e.samples.push({unit:y,pts:g}),l}class ag{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,s=new Uint8Array(4),r=Math.min(4,t);if(0===r)throw new Error("no bytes available");s.set(e.subarray(i,i+r)),this.word=new DataView(s.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r}skipBits(e){let t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(t=(e-=this.bitsAvailable)>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&Uc.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return t=e-t,t>0&&this.bitsAvailable?i<>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t,i=8,s=8;for(let r=0;r{var o;switch(s.type){case 1:{let t=!1;a=!0;const r=s.data;if(l&&r.length>4){const e=new ag(r).readSliceType();2!==e&&4!==e&&7!==e&&9!==e||(t=!0)}var d;if(t)null!=(d=n)&&d.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null);n||(n=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),n.frame=!0,n.key=t;break}case 5:a=!0,null!=(o=n)&&o.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null),n||(n=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),n.key=!0,n.frame=!0;break;case 6:a=!0,Xu(s.data,1,i.pts,t.samples);break;case 7:{var h,c;a=!0,l=!0;const t=s.data,i=new ag(t).readSPS();if(!e.sps||e.width!==i.width||e.height!==i.height||(null==(h=e.pixelRatio)?void 0:h[0])!==i.pixelRatio[0]||(null==(c=e.pixelRatio)?void 0:c[1])!==i.pixelRatio[1]){e.width=i.width,e.height=i.height,e.pixelRatio=i.pixelRatio,e.sps=[t],e.duration=r;const s=t.subarray(1,4);let o="avc1.";for(let e=0;e<3;e++){let t=s[e].toString(16);t.length<2&&(t="0"+t),o+=t}e.codec=o}break}case 8:a=!0,e.pps=[s.data];break;case 9:a=!0,e.audFound=!0,n&&this.pushAccessUnit(n,e),n=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"");break;case 12:a=!0;break;default:a=!1,n&&(n.debug+="unknown NAL "+s.type+" ")}if(n&&a){n.units.push(s)}})),s&&n&&(this.pushAccessUnit(n,e),this.VideoSample=null)}parseAVCNALu(e,t){const i=t.byteLength;let s=e.naluState||0;const r=s,o=[];let a,n,l,d=0,h=-1,c=0;for(-1===s&&(h=0,c=31&t[0],s=0,d=1);d=0){const e={data:t.subarray(h,n),type:c};o.push(e)}else{const i=this.getLastNalUnit(e.samples);i&&(r&&d<=4-r&&i.state&&(i.data=i.data.subarray(0,i.data.byteLength-r)),n>0&&(i.data=Ku(i.data,t.subarray(0,n)),i.state=0))}d=0&&s>=0){const e={data:t.subarray(h,i),type:c,state:s};o.push(e)}if(0===o.length){const i=this.getLastNalUnit(e.samples);i&&(i.data=Ku(i.data,t))}return e.naluState=s,o}}class lg{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new bm(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,i){const s=e[t].unit;if(s.length<=16)return;const r=s.subarray(16,s.length-s.length%16),o=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(o).then((r=>{const o=new Uint8Array(r);s.set(o,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)}))}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t);let s=0;for(let t=32;t{r.data=this.getAvcDecryptedUnit(o,a),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,s)}))}decryptAvcSamples(e,t,i,s){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void s();const r=e[t].units;for(;!(i>=r.length);i++){const o=r[i];if(!(o.data.length<=48||1!==o.type&&5!==o.type||(this.decryptAvcSample(e,t,i,s,o),this.decrypter.isSync())))return}}}}const dg=188;class hg{constructor(e,t,i){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.videoParser=new ng}static probe(e){const t=hg.syncOffset(e);return t>0&&Uc.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),-1!==t}static syncOffset(e){const t=e.length;let i=Math.min(940,t-dg)+1,s=0;for(;s1&&(0===o&&a>2||n+dg>i))return o}s++}return-1}static createTrack(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:Iu[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}resetInitSegment(e,t,i,s){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=hg.createTrack("video"),this._audioTrack=hg.createTrack("audio",s),this._id3Track=hg.createTrack("id3"),this._txtTrack=hg.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=s}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,s=!1){let r;i||(this.sampleAes=null);const o=this._videoTrack,a=this._audioTrack,n=this._id3Track,l=this._txtTrack;let d=o.pid,h=o.pesData,c=a.pid,u=n.pid,p=a.pesData,f=n.pesData,m=null,g=this.pmtParsed,y=this._pmtId,A=e.length;if(this.remainderData&&(A=(e=Ku(this.remainderData,e)).length,this.remainderData=null),A>4>1){if(v=t+5+e[t+4],v===t+dg)continue}else v=t+4;switch(A){case d:s&&(h&&(r=gg(h))&&this.videoParser.parseAVCPES(o,l,r,!1,this._duration),h={data:[],size:0}),h&&(h.data.push(e.subarray(v,t+dg)),h.size+=t+dg-v);break;case c:if(s){if(p&&(r=gg(p)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,r);break;case"mp3":this.parseMPEGPES(a,r);break;case"ac3":this.parseAC3PES(a,r)}p={data:[],size:0}}p&&(p.data.push(e.subarray(v,t+dg)),p.size+=t+dg-v);break;case u:s&&(f&&(r=gg(f))&&this.parseID3PES(n,r),f={data:[],size:0}),f&&(f.data.push(e.subarray(v,t+dg)),f.size+=t+dg-v);break;case 0:s&&(v+=e[v]+1),y=this._pmtId=ug(e,v);break;case y:{s&&(v+=e[v]+1);const r=pg(e,v,this.typeSupported,i,this.observer);d=r.videoPid,d>0&&(o.pid=d,o.segmentCodec=r.segmentVideoCodec),c=r.audioPid,c>0&&(a.pid=c,a.segmentCodec=r.segmentAudioCodec),u=r.id3Pid,u>0&&(n.pid=u),null===m||g||(Uc.warn(`MPEG-TS PMT found at ${t} after unknown PID '${m}'. Backtracking to sync byte @${b} to parse all TS packets.`),m=null,t=b-188),g=this.pmtParsed=!0;break}case 17:case 8191:break;default:m=A}}else v++;v>0&&fg(this.observer,new Error(`Found ${v} TS packet/s that do not start with 0x47`)),o.pesData=h,a.pesData=p,n.pesData=f;const _={audioTrack:a,videoTrack:o,id3Track:n,textTrack:l};return s&&this.extractRemainingSamples(_),_}flush(){const{remainderData:e}=this;let t;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:s,textTrack:r}=e,o=i.pesData,a=t.pesData,n=s.pesData;let l;if(o&&(l=gg(o))?(this.videoParser.parseAVCPES(i,r,l,!0,this._duration),i.pesData=null):i.pesData=o,a&&(l=gg(a))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break;case"ac3":this.parseAC3PES(t,l)}t.pesData=null}else null!=a&&a.size&&Uc.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;n&&(l=gg(n))?(this.parseID3PES(s,l),s.pesData=null):s.pesData=n}demuxSampleAes(e,t,i){const s=this.demux(e,i,!0,!this.config.progressive),r=this.sampleAes=new lg(this.observer,this.config,t);return this.decrypt(s,r)}decrypt(e,t){return new Promise((i=>{const{audioTrack:s,videoTrack:r}=e;s.samples&&"aac"===s.segmentCodec?t.decryptAacSamples(s.samples,0,(()=>{r.samples?t.decryptAvcSamples(r.samples,0,0,(()=>{i(e)})):i(e)})):r.samples&&t.decryptAvcSamples(r.samples,0,0,(()=>{i(e)}))}))}destroy(){this._duration=0}parseAACPES(e,t){let i=0;const s=this.aacOverFlow;let r,o,a,n=t.data;if(s){this.aacOverFlow=null;const t=s.missing,r=s.sample.unit.byteLength;if(-1===t)n=Ku(s.sample.unit,n);else{const o=r-t;s.sample.unit.set(n.subarray(0,t),o),e.samples.push(s.sample),i=s.missing}}for(r=i,o=n.length;r0;)n+=o}}parseID3PES(e,t){if(void 0===t.pts)return void Uc.warn("[tsdemuxer]: ID3 PES unknown PTS");const i=kc({},t,{type:this._videoTrack?Yp:qp,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function cg(e,t){return((31&e[t+1])<<8)+e[t+2]}function ug(e,t){return(31&e[t+10])<<8|e[t+11]}function pg(e,t,i,s,r){const o={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},a=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t0){let s=t+5,r=n;for(;r>2;){if(106===e[s])!0!==i.ac3?Uc.log("AC-3 audio found, not supported in this browser for now"):(o.audioPid=a,o.segmentAudioCodec="ac3");const t=e[s+1]+2;s+=t,r-=t}}break;case 194:case 135:return fg(r,new Error("Unsupported EC-3 in M2TS found")),o;case 36:return fg(r,new Error("Unsupported HEVC in M2TS found")),o}t+=n+5}return o}function fg(e,t,i){Uc.warn(`parsing error: ${t.message}`),e.emit(Dc.ERROR,Dc.ERROR,{type:Rc.MEDIA_ERROR,details:Pc.FRAG_PARSING_ERROR,fatal:!1,levelRetry:i,error:t,reason:t.message})}function mg(e){Uc.log(`${e} with AES-128-CBC encryption found in unencrypted stream`)}function gg(e){let t,i,s,r,o,a=0;const n=e.data;if(!e||0===e.size)return null;for(;n[0].length<19&&n.length>1;)n[0]=Ku(n[0],n[1]),n.splice(1,1);t=n[0];if(1===(t[0]<<16)+(t[1]<<8)+t[2]){if(i=(t[4]<<8)+t[5],i&&i>e.size-6)return null;const l=t[7];192&l&&(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&l?(o=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2,r-o>54e5&&(Uc.warn(`${Math.round((r-o)/9e4)}s delta between PTS and DTS, align them`),r=o)):o=r),s=t[8];let d=s+9;if(e.size<=d)return null;e.size-=d;const h=new Uint8Array(e.size);for(let e=0,i=n.length;ei){d-=i;continue}t=t.subarray(d),i-=d,d=0}h.set(t,a),a+=i}return i&&(i-=s+3),{data:h,pts:r,dts:o,len:i}}return null}class yg{static getSilentFrame(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}const Ag=Math.pow(2,32)-1;class bg{static init(){let e;for(e in bg.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},bg.types)bg.types.hasOwnProperty(e)&&(bg.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);bg.HDLR_TYPES={video:t,audio:i};const s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);bg.STTS=bg.STSC=bg.STCO=r,bg.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),bg.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),bg.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),bg.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const o=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),n=new Uint8Array([0,0,0,1]);bg.FTYP=bg.box(bg.types.ftyp,o,n,o,a),bg.DINF=bg.box(bg.types.dinf,bg.box(bg.types.dref,s))}static box(e,...t){let i=8,s=t.length;const r=s;for(;s--;)i+=t[s].byteLength;const o=new Uint8Array(i);for(o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=255&i,o.set(e,4),s=0,i=8;s>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,s>>24,s>>16&255,s>>8&255,255&s,85,196,0,0]))}static mdia(e){return bg.box(bg.types.mdia,bg.mdhd(e.timescale,e.duration),bg.hdlr(e.type),bg.minf(e))}static mfhd(e){return bg.box(bg.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}static minf(e){return"audio"===e.type?bg.box(bg.types.minf,bg.box(bg.types.smhd,bg.SMHD),bg.DINF,bg.stbl(e)):bg.box(bg.types.minf,bg.box(bg.types.vmhd,bg.VMHD),bg.DINF,bg.stbl(e))}static moof(e,t,i){return bg.box(bg.types.moof,bg.mfhd(e),bg.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=bg.trak(e[t]);return bg.box.apply(null,[bg.types.moov,bg.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(bg.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=bg.trex(e[t]);return bg.box.apply(null,[bg.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(Ag+1)),s=Math.floor(t%(Ag+1)),r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,s>>24,s>>16&255,s>>8&255,255&s,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return bg.box(bg.types.mvhd,r)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let s,r;for(s=0;s>>8&255),r.push(255&s),r=r.concat(Array.prototype.slice.call(i));for(t=0;t>>8&255),o.push(255&s),o=o.concat(Array.prototype.slice.call(i));const a=bg.box(bg.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|e.sps.length].concat(r).concat([e.pps.length]).concat(o))),n=e.width,l=e.height,d=e.pixelRatio[0],h=e.pixelRatio[1];return bg.box(bg.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,n>>8&255,255&n,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),a,bg.box(bg.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),bg.box(bg.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,h>>24,h>>16&255,h>>8&255,255&h])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0])}static mp4a(e){return bg.box(bg.types.mp4a,bg.audioStsd(e),bg.box(bg.types.esds,bg.esds(e)))}static mp3(e){return bg.box(bg.types[".mp3"],bg.audioStsd(e))}static ac3(e){return bg.box(bg.types["ac-3"],bg.audioStsd(e),bg.box(bg.types.dac3,e.config))}static stsd(e){return"audio"===e.type?"mp3"===e.segmentCodec&&"mp3"===e.codec?bg.box(bg.types.stsd,bg.STSD,bg.mp3(e)):"ac3"===e.segmentCodec?bg.box(bg.types.stsd,bg.STSD,bg.ac3(e)):bg.box(bg.types.stsd,bg.STSD,bg.mp4a(e)):bg.box(bg.types.stsd,bg.STSD,bg.avc1(e))}static tkhd(e){const t=e.id,i=e.duration*e.timescale,s=e.width,r=e.height,o=Math.floor(i/(Ag+1)),a=Math.floor(i%(Ag+1));return bg.box(bg.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,a>>24,a>>16&255,a>>8&255,255&a,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>8&255,255&s,0,0,r>>8&255,255&r,0,0]))}static traf(e,t){const i=bg.sdtp(e),s=e.id,r=Math.floor(t/(Ag+1)),o=Math.floor(t%(Ag+1));return bg.box(bg.types.traf,bg.box(bg.types.tfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s])),bg.box(bg.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,o>>24,o>>16&255,o>>8&255,255&o])),bg.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,bg.box(bg.types.trak,bg.tkhd(e),bg.mdia(e))}static trex(e){const t=e.id;return bg.box(bg.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],s=i.length,r=12+16*s,o=new Uint8Array(r);let a,n,l,d,h,c;for(t+=8+r,o.set(["video"===e.type?1:0,0,15,1,s>>>24&255,s>>>16&255,s>>>8&255,255&s,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0),a=0;a>>24&255,l>>>16&255,l>>>8&255,255&l,d>>>24&255,d>>>16&255,d>>>8&255,255&d,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|h.isNonSync,61440&h.degradPrio,15&h.degradPrio,c>>>24&255,c>>>16&255,c>>>8&255,255&c],12+16*a);return bg.box(bg.types.trun,o)}static initSegment(e){bg.types||bg.init();const t=bg.moov(e);return Ku(bg.FTYP,t)}}bg.types=void 0,bg.HDLR_TYPES=void 0,bg.STTS=void 0,bg.STSC=void 0,bg.STCO=void 0,bg.STSZ=void 0,bg.VMHD=void 0,bg.SMHD=void 0,bg.STSD=void 0,bg.FTYP=void 0,bg.DINF=void 0;function vg(e,t,i=1,s=!1){const r=e*t*i;return s?Math.round(r):r}function _g(e,t=!1){return vg(e,1e3,1/9e4,t)}let wg,Sg=null,Eg=null;class Tg{constructor(e,t,i,s=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,null===Sg){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Sg=e?parseInt(e[1]):0}if(null===Eg){const e=navigator.userAgent.match(/Safari\/(\d+)/i);Eg=e?parseInt(e[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){Uc.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){Uc.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){Uc.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e.reduce(((e,i)=>{const s=i.pts-e;return s<-4294967296?(t=!0,kg(e,i.pts)):s>0?e:i.pts}),e[0].pts);return t&&Uc.debug("PTS rollover detected"),i}remux(e,t,i,s,r,o,a,n){let l,d,h,c,u,p,f=r,m=r;const g=e.pid>-1,y=t.pid>-1,A=t.samples.length,b=e.samples.length>0,v=a&&A>0||A>1;if((!g||b)&&(!y||v)||this.ISGenerated||a){if(this.ISGenerated){var _,w,S,E;const e=this.videoTrackConfig;!e||t.width===e.width&&t.height===e.height&&(null==(_=t.pixelRatio)?void 0:_[0])===(null==(w=e.pixelRatio)?void 0:w[0])&&(null==(S=t.pixelRatio)?void 0:S[1])===(null==(E=e.pixelRatio)?void 0:E[1])||this.resetInitSegment()}else h=this.generateIS(e,t,r,o);const i=this.isVideoContiguous;let s,a=-1;if(v&&(a=function(e){for(let t=0;t0){Uc.warn(`[mp4-remuxer]: Dropped ${a} out of ${A} video samples due to a missing keyframe`);const e=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(a),t.dropped+=a,m+=(t.samples[0].pts-e)/t.inputTimeScale,s=m}else-1===a&&(Uc.warn(`[mp4-remuxer]: No keyframe found out of ${A} video samples`),p=!1);if(this.ISGenerated){if(b&&v){const i=this.getVideoStartPts(t.samples),s=(kg(e.samples[0].pts,i)-i)/t.inputTimeScale;f+=Math.max(0,s),m+=Math.max(0,-s)}if(b){if(e.samplerate||(Uc.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),h=this.generateIS(e,t,r,o)),d=this.remuxAudio(e,f,this.isAudioContiguous,o,y||v||n===Op?m:void 0),v){const s=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(Uc.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),h=this.generateIS(e,t,r,o)),l=this.remuxVideo(t,m,i,s)}}else v&&(l=this.remuxVideo(t,m,i,0));l&&(l.firstKeyFrame=a,l.independent=-1!==a,l.firstKeyFramePTS=s)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(u=Lg(i,r,this._initPTS,this._initDTS)),s.samples.length&&(c=Cg(s,r,this._initPTS))),{audio:d,video:l,initSegment:h,independent:p,text:c,id3:u}}generateIS(e,t,i,s){const r=e.samples,o=t.samples,a=this.typeSupported,n={},l=this._initPTS;let d,h,c,u=!l||s,p="audio/mp4";if(u&&(d=h=1/0),e.config&&r.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(p="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}n.audio={id:"audio",container:p,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&a.mpeg?new Uint8Array(0):bg.initSegment([e]),metadata:{channelCount:e.channelCount}},u&&(c=e.inputTimeScale,l&&c===l.timescale?u=!1:d=h=r[0].pts-Math.round(c*i))}if(t.sps&&t.pps&&o.length){if(t.timescale=t.inputTimeScale,n.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:bg.initSegment([t]),metadata:{width:t.width,height:t.height}},u)if(c=t.inputTimeScale,l&&c===l.timescale)u=!1;else{const e=this.getVideoStartPts(o),t=Math.round(c*i);h=Math.min(h,kg(o[0].dts,e)-t),d=Math.min(d,e-t)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(n).length)return this.ISGenerated=!0,u?(this._initPTS={baseTime:d,timescale:c},this._initDTS={baseTime:h,timescale:c}):d=c=void 0,{tracks:n,initPTS:d,timescale:c}}remuxVideo(e,t,i,s){const r=e.inputTimeScale,o=e.samples,a=[],n=o.length,l=this._initPTS;let d,h,c=this.nextAvcDts,u=8,p=this.videoSampleDuration,f=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,g=!1;if(!i||null===c){const e=t*r,s=o[0].pts-kg(o[0].dts,o[0].pts);Sg&&null!==c&&Math.abs(e-s-c)<15e3?i=!0:c=e-s}const y=l.baseTime*r/l.timescale;for(let e=0;e0?e-1:e].dts&&(g=!0)}g&&o.sort((function(e,t){const i=e.dts-t.dts,s=e.pts-t.pts;return i||s})),d=o[0].dts,h=o[o.length-1].dts;const A=h-d,b=A?Math.round(A/(n-1)):p||e.inputTimeScale/30;if(i){const e=d-c,i=e>b,s=e<-1;if((i||s)&&(i?Uc.warn(`AVC: ${_g(e,!0)} ms (${e}dts) hole between fragments detected at ${t.toFixed(3)}`):Uc.warn(`AVC: ${_g(-e,!0)} ms (${e}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!s||c>=o[0].pts||Sg)){d=c;const t=o[0].pts-e;if(i)o[0].dts=d,o[0].pts=t;else for(let i=0;it);i++)o[i].dts-=e,o[i].pts-=e;Uc.log(`Video: Initial PTS/DTS adjusted: ${_g(t,!0)}/${_g(d,!0)}, delta: ${_g(e,!0)} ms`)}}d=Math.max(0,d);let v=0,_=0,w=d;for(let e=0;e0?t.dts-o[e-1].dts:b;if(l=e>0?t.pts-o[e-1].pts:b,i.stretchShortVideoTrack&&null!==this.nextAudioPts){const e=Math.floor(i.maxBufferHole*r),o=(s?f+s*r:this.nextAudioPts)-t.pts;o>e?(p=o-a,p<0?p=a:k=!0,Uc.log(`[mp4-remuxer]: It is approximately ${o/90} ms to the next segment; using duration ${p/90} ms for the last video frame.`)):p=a}else p=a}const h=Math.round(t.pts-t.dts);L=Math.min(L,p),x=Math.max(x,p),C=Math.min(C,l),D=Math.max(D,l),a.push(new xg(t.key,p,d,h))}if(a.length)if(Sg){if(Sg<70){const e=a[0].flags;e.dependsOn=2,e.isNonSync=0}}else if(Eg&&D-C0&&(s&&Math.abs(g-m)<9e3||Math.abs(kg(p[0].pts-y,g)-m)<20*l),p.forEach((function(e){e.pts=kg(e.pts-y,g)})),!i||m<0){if(p=p.filter((e=>e.pts>=0)),!p.length)return;m=0===r?0:s&&!u?Math.max(0,g):p[0].pts}if("aac"===e.segmentCodec){const t=this.config.maxAudioFramesDrift;for(let i=0,s=m;i=t*l&&d<1e4&&u){let t=Math.round(n/l);s=a-t*l,s<0&&(t--,s+=l),0===i&&(this.nextAudioPts=m=s),Uc.warn(`[mp4-remuxer]: Injecting ${t} audio frame @ ${(s/o).toFixed(3)}s due to ${Math.round(1e3*n/o)} ms gap.`);for(let o=0;o0))return;_+=f;try{A=new Uint8Array(_)}catch(e){return void this.observer.emit(Dc.ERROR,Dc.ERROR,{type:Rc.MUX_ERROR,details:Pc.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:_,reason:`fail allocating audio mdat ${_}`})}if(!h){new DataView(A.buffer).setUint32(0,_),A.set(bg.types.mdat,4)}}A.set(r,f);const l=r.byteLength;f+=l,c.push(new xg(!0,n,l,0)),v=o}const S=c.length;if(!S)return;const E=c[c.length-1];this.nextAudioPts=m=v+a*E.duration;const T=h?new Uint8Array(0):bg.moof(e.sequenceNumber++,b/a,kc({},e,{samples:c}));e.samples=[];const k=b/o,L=m/o,C={data1:T,data2:A,startPTS:k,endPTS:L,startDTS:k,endDTS:L,type:"audio",hasAudio:!0,hasVideo:!1,nb:S};return this.isAudioContiguous=!0,C}remuxEmptyAudio(e,t,i,s){const r=e.inputTimeScale,o=r/(e.samplerate?e.samplerate:r),a=this.nextAudioPts,n=this._initDTS,l=9e4*n.baseTime/n.timescale,d=(null!==a?a:s.startDTS*r)+l,h=s.endDTS*r+l,c=1024*o,u=Math.ceil((h-d)/c),p=yg.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(Uc.warn("[mp4-remuxer]: remux empty Audio"),!p)return void Uc.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");const f=[];for(let e=0;e4294967296;)e+=i;return e}function Lg(e,t,i,s){const r=e.samples.length;if(!r)return;const o=e.inputTimeScale;for(let a=0;ae.pts-t.pts));const o=e.samples;return e.samples=[],{samples:o}}class xg{constructor(e,t,i,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=s,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}function Dg(e,t){const i=null==e?void 0:e.codec;if(i&&i.length>4)return i;if(t===$c){if("ec-3"===i||"ac-3"===i||"alac"===i)return i;if("fLaC"===i||"Opus"===i){return Ap(i,!1)}const e="mp4a.40.5";return Uc.info(`Parsed audio codec "${i}" or audio object type not handled. Using "${e}"`),e}return Uc.warn(`Unhandled video codec "${i}"`),"hvc1"===i||"hev1"===i?"hvc1.1.6.L120.90":"av01"===i?"av01.0.04M.08":"avc1.42e01e"}try{wg=self.performance.now.bind(self.performance)}catch(e){Uc.debug("Unable to use Performance API on this environment"),wg=null==eu?void 0:eu.Date.now}const Rg=[{demux:class{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,s){const r=this.videoTrack=Mm("video",1),o=this.audioTrack=Mm("audio",1),a=this.txtTrack=Mm("text",1);if(this.id3Track=Mm("id3",1),this.timeOffset=0,null==e||!e.byteLength)return;const n=Wu(e);if(n.video){const{id:e,timescale:t,codec:i}=n.video;r.id=e,r.timescale=a.timescale=t,r.codec=i}if(n.audio){const{id:e,timescale:t,codec:i}=n.audio;o.id=e,o.timescale=t,o.codec=i}a.id=Iu.text,r.sampleDuration=0,r.duration=o.duration=s}resetContiguity(){this.remainderData=null}static probe(e){return function(e){const t=e.byteLength;for(let i=0;i8&&109===e[i+4]&&111===e[i+5]&&111===e[i+6]&&102===e[i+7])return!0;i=s>1?i+s:t}return!1}(e)}demux(e,t){this.timeOffset=t;let i=e;const s=this.videoTrack,r=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Ku(this.remainderData,e));const t=function(e){const t={valid:null,remainder:null},i=ju(e,["moof"]);if(i.length<2)return t.remainder=e,t;const s=i[i.length-1];return t.valid=uu(e,0,s.byteOffset-8),t.remainder=uu(e,s.byteOffset-8),t}(i);this.remainderData=t.remainder,s.samples=t.valid||new Uint8Array}else s.samples=i;const o=this.extractID3Track(s,t);return r.samples=Yu(t,s),{videoTrack:s,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const s=this.extractID3Track(t,this.timeOffset);return i.samples=Yu(e,t),{videoTrack:t,audioTrack:Mm(),id3Track:s,textTrack:Mm()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const s=ju(e.samples,["emsg"]);s&&s.forEach((e=>{const s=function(e){const t=e[0];let i="",s="",r=0,o=0,a=0,n=0,l=0,d=0;if(0===t){for(;"\0"!==Bu(e.subarray(d,d+1));)i+=Bu(e.subarray(d,d+1)),d+=1;for(i+=Bu(e.subarray(d,d+1)),d+=1;"\0"!==Bu(e.subarray(d,d+1));)s+=Bu(e.subarray(d,d+1)),d+=1;s+=Bu(e.subarray(d,d+1)),d+=1,r=Fu(e,12),o=Fu(e,16),n=Fu(e,20),l=Fu(e,24),d=28}else if(1===t){d+=4,r=Fu(e,d),d+=4;const t=Fu(e,d);d+=4;const o=Fu(e,d);for(d+=4,a=2**32*t+o,Cc(a)||(a=Number.MAX_SAFE_INTEGER,Uc.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),n=Fu(e,d),d+=4,l=Fu(e,d),d+=4;"\0"!==Bu(e.subarray(d,d+1));)i+=Bu(e.subarray(d,d+1)),d+=1;for(i+=Bu(e.subarray(d,d+1)),d+=1;"\0"!==Bu(e.subarray(d,d+1));)s+=Bu(e.subarray(d,d+1)),d+=1;s+=Bu(e.subarray(d,d+1)),d+=1}return{schemeIdUri:i,value:s,timeScale:r,presentationTime:a,presentationTimeDelta:o,eventDuration:n,id:l,payload:e.subarray(d,e.byteLength)}}(e);if(ig.test(s.schemeIdUri)){const e=Lc(s.presentationTime)?s.presentationTime/s.timeScale:t+s.presentationTimeDelta/s.timeScale;let r=4294967295===s.eventDuration?Number.POSITIVE_INFINITY:s.eventDuration/s.timeScale;r<=.001&&(r=Number.POSITIVE_INFINITY);const o=s.payload;i.samples.push({data:o,len:o.byteLength,dts:e,pts:e,type:Yp,duration:r})}}))}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}},remux:class{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,i,s){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(function(e,t){if(!e||!t)return e;const i=t.keyId;i&&t.isCommonEncryption&&ju(e,["moov","trak"]).forEach((e=>{const t=ju(e,["mdia","minf","stbl","stsd"])[0].subarray(8);let s=ju(t,["enca"]);const r=s.length>0;r||(s=ju(t,["encv"])),s.forEach((e=>{ju(r?e.subarray(28):e.subarray(78),["sinf"]).forEach((e=>{const t=Ju(e);if(t){const e=t.subarray(8,24);e.some((e=>0!==e))||(Uc.log(`[eme] Patching keyId in 'enc${r?"a":"v"}>sinf>>tenc' box: ${Du(e)} -> ${Du(i)}`),t.set(i,8))}}))}))}));return e}(e,s)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(null==e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);const s=this.initData=Wu(e);s.audio&&(t=Dg(s.audio,$c)),s.video&&(i=Dg(s.video,Vc));const r={};s.audio&&s.video?r.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:s.audio?r.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:s.video?r.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:Uc.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=r}remux(e,t,i,s,r,o){var a,n;let{initPTS:l,lastEndTime:d}=this;const h={audio:void 0,video:void 0,text:s,id3:i,initSegment:void 0};Lc(d)||(d=this.lastEndTime=r||0);const c=t.samples;if(null==c||!c.length)return h;const u={initPTS:void 0,timescale:1};let p=this.initData;if(null!=(a=p)&&a.length||(this.generateInitSegment(c),p=this.initData),null==(n=p)||!n.length)return Uc.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),h;this.emitInitSegment&&(u.tracks=this.initTracks,this.emitInitSegment=!1);const f=function(e,t){let i=0,s=0,r=0;const o=ju(e,["moof","traf"]);for(let e=0;ee+t.info.duration||0),0);i=Math.max(i,e+o.earliestPresentationTime/o.timescale),s=i-t}}if(s&&Lc(s))return s}return s||r}(c,p),m=function(e,t){return ju(t,["moof","traf"]).reduce(((t,i)=>{const s=ju(i,["tfdt"])[0],r=s[0],o=ju(i,["tfhd"]).reduce(((t,i)=>{const o=Fu(i,4),a=e[o];if(a){let e=Fu(s,4);if(1===r){if(e===Ru)return Uc.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),t;e*=Ru+1,e+=Fu(s,8)}const i=e/(a.timescale||9e4);if(Lc(i)&&(null===t||ir}(l,g,r,f)||u.timescale!==l.timescale&&o)&&(u.initPTS=g-r,l&&1===l.timescale&&Uc.warn("Adjusting initPTS by "+(u.initPTS-l.baseTime)),this.initPTS=l={baseTime:u.initPTS,timescale:1});const y=e?g-l.baseTime/l.timescale:d,A=y+f;!function(e,t,i){ju(t,["moof","traf"]).forEach((t=>{ju(t,["tfhd"]).forEach((s=>{const r=Fu(s,4),o=e[r];if(!o)return;const a=o.timescale||9e4;ju(t,["tfdt"]).forEach((e=>{const t=e[0],s=i*a;if(s){let i=Fu(e,4);if(0===t)i-=s,i=Math.max(i,0),Nu(e,4,i);else{i*=Math.pow(2,32),i+=Fu(e,8),i-=s,i=Math.max(i,0);const t=Math.floor(i/(Ru+1)),r=Math.floor(i%(Ru+1));Nu(e,4,t),Nu(e,8,r)}}}))}))}))}(p,c,l.baseTime/l.timescale),f>0?this.lastEndTime=A:(Uc.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const b=!!p.audio,v=!!p.video;let _="";b&&(_+="audio"),v&&(_+="video");const w={data1:c,startPTS:y,startDTS:y,endPTS:A,endDTS:A,type:_,hasAudio:b,hasVideo:v,nb:1,dropped:0};return h.audio="audio"===w.type?w:void 0,h.video="audio"!==w.type?w:void 0,h.initSegment=u,h.id3=Lg(i,r,l,l),s.samples.length&&(h.text=Cg(s,r,l)),h}}},{demux:hg,remux:Tg},{demux:class extends Fm{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,s){super.resetInitSegment(e,t,i,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=mu(e,0);let i=(null==t?void 0:t.length)||0;if(tg(e,i))return!1;for(let t=e.length;i0&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(i=t);return i}(o,t);if(b&&"AES-128"===b.method){const e=this.getDecrypter();if(!e.isSync())return this.decryptionPromise=e.webCryptoDecrypt(o,b.key.buffer,b.iv.buffer).then((e=>{const t=this.push(e,null,i);return this.decryptionPromise=null,t})),this.decryptionPromise;{let t=e.softwareDecrypt(o,b.key.buffer,b.iv.buffer);if(i.part>-1&&(t=e.flush()),!t)return r.executeEnd=wg(),Ig(i);o=new Uint8Array(t)}}const v=this.needsProbing(d,h);if(v){const e=this.configureTransmuxer(o);if(e)return Uc.warn(`[transmuxer] ${e.message}`),this.observer.emit(Dc.ERROR,Dc.ERROR,{type:Rc.MEDIA_ERROR,details:Pc.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message}),r.executeEnd=wg(),Ig(i)}(d||h||p||v)&&this.resetInitSegment(A,f,m,y,t),(d||p||v)&&this.resetInitialTimestamp(g),l||this.resetContiguity();const _=this.transmux(o,b,u,c,i),w=this.currentTransmuxState;return w.contiguous=!0,w.discontinuity=!1,w.trackSwitch=!1,r.executeEnd=wg(),_}flush(e){const t=e.transmuxing;t.executeStart=wg();const{decrypter:i,currentTransmuxState:s,decryptionPromise:r}=this;if(r)return r.then((()=>this.flush(e)));const o=[],{timeOffset:a}=s;if(i){const t=i.flush();t&&o.push(this.push(t,null,e))}const{demuxer:n,remuxer:l}=this;if(!n||!l)return t.executeEnd=wg(),[Ig(e)];const d=n.flush(a);return Bg(d)?d.then((t=>(this.flushRemux(o,t,e),o))):(this.flushRemux(o,d,e),o)}flushRemux(e,t,i){const{audioTrack:s,videoTrack:r,id3Track:o,textTrack:a}=t,{accurateTimeOffset:n,timeOffset:l}=this.currentTransmuxState;Uc.log(`[transmuxer.ts]: Flushed fragment ${i.sn}${i.part>-1?" p: "+i.part:""} of level ${i.level}`);const d=this.remuxer.remux(s,r,o,a,l,n,!0,this.id);e.push({remuxResult:d,chunkMeta:i}),i.transmuxing.executeEnd=wg()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,s,r){const{demuxer:o,remuxer:a}=this;o&&a&&(o.resetInitSegment(e,t,i,s),a.resetInitSegment(e,t,i,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,s,r){let o;return o=t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,i,s,r):this.transmuxUnencrypted(e,i,s,r),o}transmuxUnencrypted(e,t,i,s){const{audioTrack:r,videoTrack:o,id3Track:a,textTrack:n}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,o,a,n,t,i,!1,this.id),chunkMeta:s}}transmuxSampleAes(e,t,i,s,r){return this.demuxer.demuxSampleAes(e,t,i).then((e=>({remuxResult:this.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,i,s,!1,this.id),chunkMeta:r})))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:s,vendor:r}=this;let o;for(let t=0,i=Rg.length;t({remuxResult:{},chunkMeta:e});function Bg(e){return"then"in e&&e.then instanceof Function}class Mg{constructor(e,t,i,s,r){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=s,this.defaultInitPts=r||null}}class Fg{constructor(e,t,i,s,r,o){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=s,this.timeOffset=r,this.initSegmentChange=o}}var Ug={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function s(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,s,o,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var n=new r(s,o||e,a),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],n]:e._events[l].push(n):(e._events[l]=n,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new s:delete e._events[t]}function n(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),n.prototype.eventNames=function(){var e,s,r=[];if(0===this._eventsCount)return r;for(s in e=this._events)t.call(e,s)&&r.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},n.prototype.listeners=function(e){var t=i?i+e:e,s=this._events[t];if(!s)return[];if(s.fn)return[s.fn];for(var r=0,o=s.length,a=new Array(o);r{(t=t||{}).frag=this.frag,t.id=this.id,e===Dc.ERROR&&(this.error=t.error),this.hls.trigger(e,t)};this.observer=new Og,this.observer.on(Dc.FRAG_DECRYPTED,o),this.observer.on(Dc.ERROR,o);const a=dp(r.preferManagedMediaSource)||{isTypeSupported:()=>!1},n={mpeg:a.isTypeSupported("audio/mpeg"),mp3:a.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:a.isTypeSupported('audio/mp4; codecs="ac-3"')};if(this.useWorker&&"undefined"!=typeof Worker){if(r.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{r.workerPath?(Uc.log(`loading Web Worker ${r.workerPath} for "${t}"`),this.workerContext=function(e){const t=new self.URL(e,self.location.href).href;return{worker:new self.Worker(t),scriptURL:t}}(r.workerPath)):(Uc.log(`injecting Web Worker for "${t}"`),this.workerContext=function(){const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e);return{worker:new self.Worker(t),objectURL:t}}()),this.onwmsg=e=>this.onWorkerMessage(e);const{worker:e}=this.workerContext;e.addEventListener("message",this.onwmsg),e.onerror=e=>{const i=new Error(`${e.message} (${e.filename}:${e.lineno})`);r.enableWorker=!1,Uc.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(Dc.ERROR,{type:Rc.OTHER_ERROR,details:Pc.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:i})},e.postMessage({cmd:"init",typeSupported:n,vendor:"",id:t,config:JSON.stringify(r)})}catch(e){Uc.warn(`Error setting up "${t}" Web Worker, fallback to inline`,e),this.resetWorker(),this.error=null,this.transmuxer=new Pg(this.observer,n,r,"",t)}return}}this.transmuxer=new Pg(this.observer,n,r,"",t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,i,s,r,o,a,n,l,d){var h,c;l.transmuxing.start=self.performance.now();const{transmuxer:u}=this,p=o?o.start:r.start,f=r.decryptdata,m=this.frag,g=!(m&&r.cc===m.cc),y=!(m&&l.level===m.level),A=m?l.sn-m.sn:-1,b=this.part?l.part-this.part.index:-1,v=0===A&&l.id>1&&l.id===(null==m?void 0:m.stats.chunkCount),_=!y&&(1===A||0===A&&(1===b||v&&b<=0)),w=self.performance.now();(y||A||0===r.stats.parsing.start)&&(r.stats.parsing.start=w),!o||!b&&_||(o.stats.parsing.start=w);const S=!(m&&(null==(h=r.initSegment)?void 0:h.url)===(null==(c=m.initSegment)?void 0:c.url)),E=new Fg(g,_,n,y,p,S);if(!_||g||S){Uc.log(`[transmuxer-interface, ${r.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}\n discontinuity: ${g}\n trackSwitch: ${y}\n contiguous: ${_}\n accurateTimeOffset: ${n}\n timeOffset: ${p}\n initSegmentChange: ${S}`);const e=new Mg(i,s,t,a,d);this.configureTransmuxer(e)}if(this.frag=r,this.part=o,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:f,chunkMeta:l,state:E},e instanceof ArrayBuffer?[e]:[]);else if(u){const t=u.push(e,f,l,E);Bg(t)?(u.async=!0,t.then((e=>{this.handleTransmuxComplete(e)})).catch((e=>{this.transmuxerError(e,l,"transmuxer-interface push error")}))):(u.async=!1,this.handleTransmuxComplete(t))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let i=t.flush(e);Bg(i)||t.async?(Bg(i)||(i=Promise.resolve(i)),i.then((t=>{this.handleFlushResult(t,e)})).catch((t=>{this.transmuxerError(t,e,"transmuxer-interface flush error")}))):this.handleFlushResult(i,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(Dc.ERROR,{type:Rc.MEDIA_ERROR,details:Pc.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach((e=>{this.handleTransmuxComplete(e)})),this.onFlush(t)}onWorkerMessage(e){const t=e.data;if(null==t||!t.event)return void Uc.warn("worker message received with no "+(t?"event name":"data"));const i=this.hls;if(this.hls)switch(t.event){case"init":{var s;const e=null==(s=this.workerContext)?void 0:s.objectURL;e&&self.URL.revokeObjectURL(e);break}case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":Uc[t.data.logType]&&Uc[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data)}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}function jg(e,t){if(e.length!==t.length)return!1;for(let i=0;ie[i]!==t[i]))}function Wg(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||"").toLowerCase())}class zg{constructor(e){this.buffered=void 0;const t=(t,i,s)=>{if((i>>>=0)>s-1)throw new DOMException(`Failed to execute '${t}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${s})`);return e[i][t]};this.buffered={get length(){return e.length},end:i=>t("end",i,e.length),start:i=>t("start",i,e.length)}}}class $g{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,i){const s=this.queues[t];s.push(e),1!==s.length||i||this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const i=new Promise((e=>{t=e})),s={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(s,e),i}executeNext(e){const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(t){Uc.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${t}`),i.onError(t);const s=this.buffers[e];null!=s&&s.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const Vg=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;function Hg(e){const t=e.querySelectorAll("source");[].slice.call(t).forEach((t=>{e.removeChild(t)}))}const Jg={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},qg=e=>String.fromCharCode(Jg[e]||e),Kg=15,Yg=100,Qg={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Xg={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Zg={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},ey={25:2,26:4,29:6,30:8,31:10,27:13,28:15},ty=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class iy{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i="function"==typeof t?t():t;Uc.log(`${this.time} [${e}] ${i}`)}}}const sy=function(e){const t=[];for(let i=0;iYg&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Yg)}moveCursor(e){const t=this.pos+e;if(e>1)for(let e=this.pos+1;e=144&&this.backSpace();const t=qg(e);this.pos>=Yg?this.logger.log(0,(()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!")):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))}clearFromPos(e){let t;for(t=e;t"pacData = "+JSON.stringify(e)));let t=e.row-1;if(this.nrRollUpRows&&t"bkgData = "+JSON.stringify(e))),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,(()=>this.getDisplayText()));const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",s=-1;for(let i=0;i0&&(i=e?"["+t.join(" | ")+"]":t.join("\n")),i}getTextAndFormat(){return this.rows}}class ly{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new ny(i),this.nonDisplayedMemory=new ny(i),this.lastOutputScreen=new ny(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,(()=>"MODE="+e)),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let t=0;tt+": "+this.writeScreen.getDisplayText(!0))),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(1,(()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0))),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,(()=>"DISP: "+this.displayedMemory.getDisplayText()))}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,s=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=s[i]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class dy{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const s=this.logger=new iy;this.channels=[null,new ly(e,t,s),new ly(e+1,i,s)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let e=0;e"["+sy([t[e],t[e+1]])+"] -> ("+sy([i,s])+")"));const a=this.cmdHistory;if(i>=16&&i<=31){if(cy(i,s,a)){hy(null,null,a),this.logger.log(3,(()=>"Repeated command ("+sy([i,s])+") is dropped"));continue}hy(i,s,this.cmdHistory),r=this.parseCmd(i,s),r||(r=this.parseMidrow(i,s)),r||(r=this.parsePAC(i,s)),r||(r=this.parseBackgroundAttributes(i,s))}else hy(null,null,a);if(!r&&(o=this.parseChars(i,s),o)){const e=this.currentChannel;if(e&&e>0){this.channels[e].insertChars(o)}else this.logger.log(2,"No channel found yet. TEXT-MODE?")}r||o||this.logger.log(2,(()=>"Couldn't parse cleaned data "+sy([i,s])+" orig: "+sy([t[e],t[e+1]])))}}parseCmd(e,t){if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=33&&t<=35))return!1;const i=20===e||21===e||23===e?1:2,s=this.channels[i];return 20===e||21===e||28===e||29===e?32===t?s.ccRCL():33===t?s.ccBS():34===t?s.ccAOF():35===t?s.ccAON():36===t?s.ccDER():37===t?s.ccRU(2):38===t?s.ccRU(3):39===t?s.ccRU(4):40===t?s.ccFON():41===t?s.ccRDC():42===t?s.ccTR():43===t?s.ccRTD():44===t?s.ccEDM():45===t?s.ccCR():46===t?s.ccENM():47===t&&s.ccEOC():s.ccTO(t-32),this.currentChannel=i,!0}parseMidrow(e,t){let i=0;if((17===e||25===e)&&t>=32&&t<=47){if(i=17===e?1:2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const s=this.channels[i];return!!s&&(s.ccMIDROW(t),this.logger.log(3,(()=>"MIDROW ("+sy([e,t])+")")),!0)}return!1}parsePAC(e,t){let i;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127)&&!((16===e||24===e)&&t>=64&&t<=95))return!1;const s=e<=23?1:2;i=t>=64&&t<=95?1===s?Qg[e]:Zg[e]:1===s?Xg[e]:ey[e];const r=this.channels[s];return!!r&&(r.setPAC(this.interpretPAC(i,t)),this.currentChannel=s,!0)}interpretPAC(e,t){let i;const s={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,s.underline=1==(1&i),i<=13?s.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(s.italics=!0,s.color="white"):s.indent=4*Math.floor((i-16)/2),s}parseChars(e,t){let i,s=null,r=null;if(e>=25?(i=2,r=e-8):(i=1,r=e),r>=17&&r<=19){let e;e=17===r?t+80:18===r?t+112:t+144,this.logger.log(2,(()=>"Special char '"+qg(e)+"' in channel "+i)),s=[e]}else e>=32&&e<=127&&(s=0===t?[e]:[e,t]);return s&&this.logger.log(3,(()=>"Char codes = "+sy(s).join(","))),s}parseBackgroundAttributes(e,t){if(!((16===e||24===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=45&&t<=47))return!1;let i;const s={};16===e||24===e?(i=Math.floor((t-32)/2),s.background=ty[i],t%2==1&&(s.background=s.background+"_semi")):45===t?s.background="transparent":(s.foreground="black",47===t&&(s.underline=!0));const r=e<=23?1:2;return this.channels[r].setBkgData(s),!0}reset(){for(let e=0;ee)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var py=function(){if(null!=eu&&eu.VTTCue)return self.VTTCue;const e=["","lr","rl"],t=["start","middle","end","left","right"];function i(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;const i=t.toLowerCase();return!!~e.indexOf(i)&&i}function s(e){return i(t,e)}function r(e,...t){let i=1;for(;i100)throw new Error("Position must be between 0 and 100.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(n,"positionAlign",r({},l,{get:function(){return v},set:function(e){const t=s(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");v=t,this.hasBeenReset=!0}})),Object.defineProperty(n,"size",r({},l,{get:function(){return _},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");_=e,this.hasBeenReset=!0}})),Object.defineProperty(n,"align",r({},l,{get:function(){return w},set:function(e){const t=s(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");w=t,this.hasBeenReset=!0}})),n.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class fy{decode(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function my(e){function t(e,t,i,s){return 3600*(0|e)+60*(0|t)+(0|i)+parseFloat(s||0)}const i=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return i?parseFloat(i[2])>59?t(i[2],i[3],0,i[4]):t(i[1],i[2],i[3],i[4]):null}class gy{constructor(){this.values=Object.create(null)}set(e,t){this.get(e)||""===t||(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let s=0;s=0&&i<=100)return this.set(e,i),!0}return!1}}function yy(e,t,i,s){const r=s?e.split(s):[e];for(const e in r){if("string"!=typeof r[e])continue;const s=r[e].split(i);if(2!==s.length)continue;t(s[0],s[1])}}const Ay=new py(0,0,""),by="middle"===Ay.align?"middle":"center";function vy(e,t,i){const s=e;function r(){const t=my(e);if(null===t)throw new Error("Malformed timestamp: "+s);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function o(){e=e.replace(/^\s+/,"")}if(o(),t.startTime=r(),o(),"--\x3e"!==e.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+s);e=e.slice(3),o(),t.endTime=r(),o(),function(e,t){const s=new gy;yy(e,(function(e,t){let r;switch(e){case"region":for(let r=i.length-1;r>=0;r--)if(i[r].id===t){s.set(e,i[r].region);break}break;case"vertical":s.alt(e,t,["rl","lr"]);break;case"line":r=t.split(","),s.integer(e,r[0]),s.percent(e,r[0])&&s.set("snapToLines",!1),s.alt(e,r[0],["auto"]),2===r.length&&s.alt("lineAlign",r[1],["start",by,"end"]);break;case"position":r=t.split(","),s.percent(e,r[0]),2===r.length&&s.alt("positionAlign",r[1],["start",by,"end","line-left","line-right","auto"]);break;case"size":s.percent(e,t);break;case"align":s.alt(e,t,["start",by,"end","left","right"])}}),/:/,/\s/),t.region=s.get("region",null),t.vertical=s.get("vertical","");let r=s.get("line","auto");"auto"===r&&-1===Ay.line&&(r=-1),t.line=r,t.lineAlign=s.get("lineAlign","start"),t.snapToLines=s.get("snapToLines",!0),t.size=s.get("size",100),t.align=s.get("align",by);let o=s.get("position","auto");"auto"===o&&50===Ay.position&&(o="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=o}(e,t)}function _y(e){return e.replace(//gi,"\n")}class wy{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new fy,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;function i(){let e=t.buffer,i=0;for(e=_y(e);i>>0).toString()};function ky(e,t,i){return Ty(e.toString())+Ty(t.toString())+Ty(i)}function Ly(e,t,i,s,r,o,a){const n=new wy,l=Lu(new Uint8Array(e)).trim().replace(Sy,"\n").split("\n"),d=[],h=t?function(e,t=1){return vg(e,9e4,1/t)}(t.baseTime,t.timescale):0;let c,u="00:00.000",p=0,f=0,m=!0;n.oncue=function(e){const o=i[s];let a=i.ccOffset;const n=(p-h)/9e4;if(null!=o&&o.new&&(void 0!==f?a=i.ccOffset=o.start:function(e,t,i){let s=e[t],r=e[s.prevCC];if(!r||!r.new&&s.new)return e.ccOffset=e.presentationOffset=s.start,void(s.new=!1);for(;null!=(o=r)&&o.new;){var o;e.ccOffset+=s.start-r.start,s.new=!1,s=r,r=e[s.prevCC]}e.presentationOffset=i}(i,s,n)),n){if(!t)return void(c=new Error("Missing initPTS for VTT MPEGTS"));a=n-i.presentationOffset}const l=e.endTime-e.startTime,u=kg(9e4*(e.startTime+a-f),9e4*r)/9e4;e.startTime=Math.max(u,0),e.endTime=Math.max(u+l,0);const m=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(m)),e.id||(e.id=ky(e.startTime,e.endTime,m)),e.endTime>0&&d.push(e)},n.onparsingerror=function(e){c=e},n.onflush=function(){c?a(c):o(d)},l.forEach((e=>{if(m){if(Ey(e,"X-TIMESTAMP-MAP=")){m=!1,e.slice(16).split(",").forEach((e=>{Ey(e,"LOCAL:")?u=e.slice(6):Ey(e,"MPEGTS:")&&(p=parseInt(e.slice(7)))}));try{f=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),s=parseInt(e.slice(-9,-7)),r=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!(Lc(t)&&Lc(i)&&Lc(s)&&Lc(r)))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=6e4*s,t+=36e5*r,t}(u)/1e3}catch(e){c=e}return}""===e&&(m=!1)}n.parse(e+"\n")})),n.flush()}const Cy="stpp.ttml.im1t",xy=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Dy=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Ry={left:"start",center:"center",right:"end",start:"start",end:"end"};function Py(e,t,i,s){const r=ju(new Uint8Array(e),["mdat"]);if(0===r.length)return void s(new Error("Could not parse IMSC1 mdat"));const o=r.map((e=>Lu(e))),a=function(e,t,i=1,s=!1){return vg(e,t,1/i,s)}(t.baseTime,1,t.timescale);try{o.forEach((e=>i(function(e,t){const i=new DOMParser,s=i.parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!s)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(r).reduce(((e,t)=>(e[t]=s.getAttribute(`ttp:${t}`)||r[t],e)),{}),a="preserve"!==s.getAttribute("xml:space"),n=By(Iy(s,"styling","style")),l=By(Iy(s,"layout","region")),d=Iy(s,"body","[begin]");return[].map.call(d,(e=>{const i=My(e,a);if(!i||!e.hasAttribute("begin"))return null;const s=Oy(e.getAttribute("begin"),o),r=Oy(e.getAttribute("dur"),o);let d=Oy(e.getAttribute("end"),o);if(null===s)throw Uy(e);if(null===d){if(null===r)throw Uy(e);d=s+r}const h=new py(s-t,d-t,i);h.id=ky(h.startTime,h.endTime,h.text);const c=function(e,t,i){const s="http://www.w3.org/ns/ttml#styling";let r=null;const o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;a&&i.hasOwnProperty(a)&&(r=i[a]);return o.reduce(((i,o)=>{const a=Fy(t,s,o)||Fy(e,s,o)||Fy(r,s,o);return a&&(i[o]=a),i}),{})}(l[e.getAttribute("region")],n[e.getAttribute("style")],n),{textAlign:u}=c;if(u){const e=Ry[u];e&&(h.lineAlign=e),h.align=u}return kc(h,c),h})).filter((e=>null!==e))}(e,a))))}catch(e){s(e)}}function Iy(e,t,i){const s=e.getElementsByTagName(t)[0];return s?[].slice.call(s.querySelectorAll(i)):[]}function By(e){return e.reduce(((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e}),{})}function My(e,t){return[].slice.call(e.childNodes).reduce(((e,i,s)=>{var r;return"br"===i.nodeName&&s?e+"\n":null!=(r=i.childNodes)&&r.length?My(i,t):t?e+i.textContent.trim().replace(/\s+/g," "):e+i.textContent}),"")}function Fy(e,t,i){return e&&e.hasAttributeNS(t,i)?e.getAttributeNS(t,i):null}function Uy(e){return new Error(`Could not parse ttml timestamp ${e}`)}function Oy(e,t){if(!e)return null;let i=my(e);return null===i&&(xy.test(e)?i=function(e,t){const i=xy.exec(e),s=(0|i[4])+(0|i[5])/t.subFrameRate;return 3600*(0|i[1])+60*(0|i[2])+(0|i[3])+s/t.frameRate}(e,t):Dy.test(e)&&(i=function(e,t){const i=Dy.exec(e),s=Number(i[1]);switch(i[2]){case"h":return 3600*s;case"m":return 60*s;case"ms":return 1e3*s;case"f":return s/t.frameRate;case"t":return s/t.tickRate}return s}(e,t))),i}function Ny(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles"}function jy(e,t){return!!e&&e.kind===Ny(t)&&Wg(t,e)}class Gy{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(Dc.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(Dc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Dc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Dc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Dc.BUFFER_CODECS,this.onBufferCodecs,this),e.on(Dc.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(Dc.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(Dc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Dc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Dc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Dc.BUFFER_CODECS,this.onBufferCodecs,this),e.off(Dc.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&Lc(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&Uc.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter(((t,i)=>this.isLevelAllowed(t)&&i<=e));return this.clientRect=null,Gy.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(e){}return e}isLevelAllowed(e){return!this.restrictedLevels.some((t=>e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height))}static getMaxLevelByMediaSize(e,t,i){if(null==e||!e.length)return-1;let s=e.length-1;const r=Math.max(t,i);for(let t=0;t=r||i.height>=r)&&(o=i,!(a=e[t+1])||o.width!==a.width||o.height!==a.height)){s=t;break}}var o,a;return s}}const Wy="[eme]";class zy{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=zy.CDMCleanupPromise?[zy.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=Uc.debug.bind(Uc,Wy),this.log=Uc.log.bind(Uc,Wy),this.warn=Uc.warn.bind(Uc,Wy),this.error=Uc.error.bind(Uc,Wy),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(Dc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Dc.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Dc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(Dc.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(Dc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Dc.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Dc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(Dc.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,s=t[e];if(s)return s.licenseUrl;if(e===tu.WIDEVINE&&i)return i;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(e,t,i)=>!!e&&i.indexOf(e)===t,s=t.map((e=>e.audioCodec)).filter(i),r=t.map((e=>e.videoCodec)).filter(i);return s.length+r.length===0&&r.push("avc1.42e01e"),new Promise(((t,i)=>{const o=e=>{const a=e.shift();this.getMediaKeysPromise(a,s,r).then((e=>t({keySystem:a,mediaKeys:e}))).catch((t=>{e.length?o(e):i(t instanceof $y?t:new $y({type:Rc.KEY_SYSTEM_ERROR,details:Pc.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))}))};o(e)}))}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if("function"!=typeof i){let e=`Configured requestMediaKeySystemAccess is not a function ${i}`;return null===hu&&"http:"===self.location.protocol&&(e=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(e))}return i(e,t)}getMediaKeysPromise(e,t,i){const s=function(e,t,i,s){let r;switch(e){case tu.FAIRPLAY:r=["cenc","sinf"];break;case tu.WIDEVINE:case tu.PLAYREADY:r=["cenc"];break;case tu.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${e}`)}return function(e,t,i,s){return[{initDataTypes:e,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:t.map((e=>({contentType:`audio/mp4; codecs="${e}"`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null}))),videoCapabilities:i.map((e=>({contentType:`video/mp4; codecs="${e}"`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null})))}]}(r,t,i,s)}(e,t,i,this.config.drmSystemOptions),r=this.keySystemAccessPromises[e];let o=null==r?void 0:r.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(s)}`),o=this.requestMediaKeySystemAccess(e,s);const t=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch((t=>{this.log(`Failed to obtain access to key-system "${e}": ${t}`)})),o.then((i=>{this.log(`Access for key-system "${i.keySystem}" obtained`);const s=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),t.mediaKeys=i.createMediaKeys().then((t=>(this.log(`Media-keys created for "${e}"`),s.then((i=>i?this.setMediaKeysServerCertificate(t,e,i):t))))),t.mediaKeys.catch((t=>{this.error(`Failed to create media-keys for "${e}"}: ${t}`)})),t.mediaKeys}))}return o.then((()=>r.mediaKeys))}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${Du(e.keyId||[])}`);const s=i.createSession(),r={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:s,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),s=this.getKeyIdString(t),r="cenc";this.keyIdToKeySessionPromise[s]=this.generateRequestWithPreferredKeySession(i,r,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw new Error("keyId is null");return Du(e.keyId)}updateKeySession(e,t){var i;const s=e.mediaKeysSession;return this.log(`Updating key-session "${s.sessionId}" for keyID ${Du((null==(i=e.decryptdata)?void 0:i.keyId)||[])}\n } (data length: ${t?t.byteLength:t})`),s.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise(((t,i)=>{const s=du(this.config),r=e.map(au).filter((e=>!!e&&-1!==s.indexOf(e)));return this.getKeySystemSelectionPromise(r).then((({keySystem:e})=>{const s=lu(e);s?t(s):i(new Error(`Unable to find format for key-system "${e}"`))})).catch(i)}))}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),s=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${s}`);let r=this.keyIdToKeySessionPromise[i];return r||(r=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(t).then((({keySystem:i,mediaKeys:r})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${s}`),this.attemptSetMediaKeys(i,r).then((()=>{this.throwIfDestroyed();const e=this.createMediaKeySessionContext({keySystem:i,mediaKeys:r,decryptdata:t});return this.generateRequestWithPreferredKeySession(e,"cenc",t.pssh,"playlist-key")}))))),r.catch((e=>this.handleError(e)))),r}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof $y?this.hls.trigger(Dc.ERROR,e.data):this.hls.trigger(Dc.ERROR,{type:Rc.KEY_SYSTEM_ERROR,details:Pc.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const t=au(e.keyFormat),i=t?[t]:du(this.config);return this.attemptKeySystemAccess(i)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=du(this.config)),0===e.length)throw new $y({type:Rc.KEY_SYSTEM_ERROR,details:Pc.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:i}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),null===i)return;let s,r;if("sinf"===t&&this.config.drmSystems[tu.FAIRPLAY]){const e=Bu(new Uint8Array(i));try{const t=Qc(JSON.parse(e).sinf),i=Ju(new Uint8Array(t));if(!i)return;s=i.subarray(8,24),r=tu.FAIRPLAY}catch(e){return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{const e=function(e){if(!(e instanceof ArrayBuffer)||e.byteLength<32)return null;const t={version:0,systemId:"",kids:null,data:null},i=new DataView(e),s=i.getUint32(0);if(e.byteLength!==s&&s>44)return null;if(1886614376!==i.getUint32(4))return null;if(t.version=i.getUint32(8)>>>24,t.version>1)return null;t.systemId=Du(new Uint8Array(e,12,16));const r=i.getUint32(28);if(0===t.version){if(s-32this.generateRequestWithPreferredKeySession(r,t,i,"encrypted-event-key-match")));break}}l||(l=a[o]=this.getKeySystemSelectionPromise([r]).then((({keySystem:e,mediaKeys:r})=>{var a;this.throwIfDestroyed();const n=new ip("ISO-23001-7",o,null!=(a=lu(e))?a:"");return n.pssh=new Uint8Array(i),n.keyId=s,this.attemptSetMediaKeys(e,r).then((()=>{this.throwIfDestroyed();const s=this.createMediaKeySessionContext({decryptdata:n,keySystem:e,mediaKeys:r});return this.generateRequestWithPreferredKeySession(s,t,i,"encrypted-event-no-match")}))}))),l.catch((e=>this.handleError(e)))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const s=Promise.all(i).then((()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)}));return this.setMediaKeysQueue.push(s),s.then((()=>{this.log(`Media-keys set for "${e}"`),i.push(s),this.setMediaKeysQueue=this.setMediaKeysQueue.filter((e=>-1===i.indexOf(e)))}))}generateRequestWithPreferredKeySession(e,t,i,s){var r,o;const a=null==(r=this.config.drmSystems)||null==(o=r[e.keySystem])?void 0:o.generateRequest;if(a)try{const s=a.call(this.hls,t,i,e);if(!s)throw new Error("Invalid response from configured generateRequest filter");t=s.initDataType,i=e.decryptdata.pssh=s.initData?new Uint8Array(s.initData):null}catch(e){var n;if(this.warn(e.message),null!=(n=this.hls)&&n.config.debug)throw e}if(null===i)return this.log(`Skipping key-session request for "${s}" (no initData)`),Promise.resolve(e);const l=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${s}": ${l} (init data type: ${t} length: ${i?i.byteLength:null})`);const d=new Og,h=e._onmessage=t=>{const i=e.mediaKeysSession;if(!i)return void d.emit("error",new Error("invalid state"));const{messageType:s,message:r}=t;this.log(`"${s}" message event for session "${i.sessionId}" message size: ${r.byteLength}`),"license-request"===s||"license-renewal"===s?this.renewLicense(e,r).catch((e=>{this.handleError(e),d.emit("error",e)})):"license-release"===s?e.keySystem===tu.FAIRPLAY&&(this.updateKeySession(e,Zc("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${s}"`)},c=e._onkeystatuseschange=t=>{if(!e.mediaKeysSession)return void d.emit("error",new Error("invalid state"));this.onKeyStatusChange(e);const i=e.keyStatus;d.emit("keyStatus",i),"expired"===i&&(this.warn(`${e.keySystem} expired for key ${l}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",h),e.mediaKeysSession.addEventListener("keystatuseschange",c);const u=new Promise(((e,t)=>{d.on("error",t),d.on("keyStatus",(i=>{i.startsWith("usable")?e():"output-restricted"===i?t(new $y({type:Rc.KEY_SYSTEM_ERROR,details:Pc.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):"internal-error"===i?t(new $y({type:Rc.KEY_SYSTEM_ERROR,details:Pc.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${i}"`)):"expired"===i?t(new Error("key expired while generating request")):this.warn(`unhandled key status change "${i}"`)}))}));return e.mediaKeysSession.generateRequest(t,i).then((()=>{var t;this.log(`Request generated for key-session "${null==(t=e.mediaKeysSession)?void 0:t.sessionId}" keyId: ${l}`)})).catch((e=>{throw new $y({type:Rc.KEY_SYSTEM_ERROR,details:Pc.KEY_SYSTEM_NO_SESSION,error:e,fatal:!1},`Error generating key-session request: ${e}`)})).then((()=>u)).catch((t=>{throw d.removeAllListeners(),this.removeSession(e),t})).then((()=>(d.removeAllListeners(),e)))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach(((t,i)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${Du("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${Du(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t}))}fetchServerCertificate(e){const t=this.config,i=new(0,t.loader)(t),s=this.getServerCertificateUrl(e);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise(((r,o)=>{const a={responseType:"arraybuffer",url:s},n=t.certLoadPolicy.default,l={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(e,t,i,s)=>{r(e.data)},onError:(t,i,r,n)=>{o(new $y({type:Rc.KEY_SYSTEM_ERROR,details:Pc.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:Sc({url:a.url,data:void 0},t)},`"${e}" certificate request failed (${s}). Status: ${t.code} (${t.text})`))},onTimeout:(t,i,r)=>{o(new $y({type:Rc.KEY_SYSTEM_ERROR,details:Pc.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:{url:a.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(e,t,i)=>{o(new Error("aborted"))}};i.load(a,l,d)}))):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise(((s,r)=>{e.setServerCertificate(i).then((r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${null==i?void 0:i.byteLength}) on "${t}"`),s(e)})).catch((e=>{r(new $y({type:Rc.KEY_SYSTEM_ERROR,details:Pc.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))}))}))}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then((t=>this.updateKeySession(e,new Uint8Array(t)).catch((e=>{throw new $y({type:Rc.KEY_SYSTEM_ERROR,details:Pc.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:e,fatal:!0},e.message)}))))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const s=(new DOMParser).parseFromString(i,"application/xml"),r=s.querySelectorAll("HttpHeader");if(r.length>0){let t;for(let i=0,s=r.length;i in key message");return Zc(atob(l))}setupLicenseXHR(e,t,i,s){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then((()=>{if(!i.decryptdata)throw new Error("Key removed");return r.call(this.hls,e,t,i,s)})).catch((o=>{if(!i.decryptdata)throw o;return e.open("POST",t,!0),r.call(this.hls,e,t,i,s)})).then((i=>{e.readyState||e.open("POST",t,!0);return{xhr:e,licenseChallenge:i||s}})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:s}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise(((s,r)=>{const o=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${o}`);const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return r(new Error("invalid state"));if(4===a.readyState)if(200===a.status){this._requestLicenseFailureCount=0;let t=a.response;this.log(`License received ${t instanceof ArrayBuffer?t.byteLength:t}`);const i=this.config.licenseResponseCallback;if(i)try{t=i.call(this.hls,a,o,e)}catch(e){this.error(e)}s(t)}else{const n=i.errorRetry,l=n?n.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||a.status>=400&&a.status<500)r(new $y({type:Rc.KEY_SYSTEM_ERROR,details:Pc.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:o,data:void 0,code:a.status,text:a.statusText}},`License Request XHR failed (${o}). Status: ${a.status} (${a.statusText})`));else{const i=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${i} attempts left`),this.requestLicense(e,t).then(s,r)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then((({xhr:t,licenseChallenge:i})=>{e.keySystem==tu.PLAYREADY&&(i=this.unpackPlayReadyKeyMessage(t,i)),t.send(i)}))}))}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},ip.clearKeyUriToKeyIdMap();const i=t.length;zy.CDMCleanupPromise=Promise.all(t.map((e=>this.removeSession(e))).concat(null==e?void 0:e.setMediaKeys(null).catch((e=>{this.log(`Could not clear media keys: ${e}`)})))).then((()=>{i&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)})).catch((e=>{this.log(`Could not close sessions and clear media keys: ${e}`)}))}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(t&&this.config.emeEnabled&&!this.keyFormatPromise){const e=t.reduce(((e,t)=>(-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e)),[]);this.log(`Selecting key-system from session-keys ${e.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(e)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const s=this.mediaKeySessions.indexOf(e);return s>-1&&this.mediaKeySessions.splice(s,1),t.remove().catch((e=>{this.log(`Could not remove session: ${e}`)})).then((()=>t.close())).catch((e=>{this.log(`Could not close session: ${e}`)}))}}}zy.CDMCleanupPromise=void 0;class $y extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}var Vy,Hy,Jy;!function(e){e.MANIFEST="m",e.AUDIO="a",e.VIDEO="v",e.MUXED="av",e.INIT="i",e.CAPTION="c",e.TIMED_TEXT="tt",e.KEY="k",e.OTHER="o"}(Vy||(Vy={})),function(e){e.DASH="d",e.HLS="h",e.SMOOTH="s",e.OTHER="o"}(Hy||(Hy={})),function(e){e.OBJECT="CMCD-Object",e.REQUEST="CMCD-Request",e.SESSION="CMCD-Session",e.STATUS="CMCD-Status"}(Jy||(Jy={}));const qy={[Jy.OBJECT]:["br","d","ot","tb"],[Jy.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[Jy.SESSION]:["cid","pr","sf","sid","st","v"],[Jy.STATUS]:["bs","rtp"]};class Ky{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map((e=>e instanceof Ky?e:new Ky(e)))),this.value=e,this.params=t}}class Yy{constructor(e){this.description=void 0,this.description=e}}function Qy(e,t,i,s){return new Error(`failed to ${e} "${r=t,Array.isArray(r)?JSON.stringify(r):r instanceof Map?"Map{}":r instanceof Set?"Set{}":"object"==typeof r?JSON.stringify(r):String(r)}" as ${i}`,{cause:s});var r}const Xy="Bare Item";const Zy=/[\x00-\x1f\x7f]+/;function eA(e,t,i){return Qy("serialize",e,t,i)}function tA(e){if(!1===ArrayBuffer.isView(e))throw eA(e,"Byte Sequence");return`:${t=e,btoa(String.fromCharCode(...t))}:`;var t}function iA(e){if(function(e){return e<-999999999999999||99999999999999912)throw eA(e,"Decimal");const i=t.toString();return i.includes(".")?i:`${i}.0`}function oA(e){const t=(i=e).description||i.toString().slice(7,-1);var i;if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t))throw eA(t,"Token");return t}function aA(e){switch(typeof e){case"number":if(!Lc(e))throw eA(e,Xy);return Number.isInteger(e)?iA(e):rA(e);case"string":return function(e){if(Zy.test(e))throw eA(e,"String");return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}(e);case"symbol":return oA(e);case"boolean":return function(e){if("boolean"!=typeof e)throw eA(e,"Boolean");return e?"?1":"?0"}(e);case"object":if(e instanceof Date)return function(e){return`@${iA(e.getTime()/1e3)}`}(e);if(e instanceof Uint8Array)return tA(e);if(e instanceof Yy)return oA(e);default:throw eA(e,Xy)}}function nA(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw eA(e,"Key");return e}function lA(e){return null==e?"":Object.entries(e).map((([e,t])=>!0===t?`;${nA(e)}`:`;${nA(e)}=${aA(t)}`)).join("")}function dA(e){return e instanceof Ky?`${aA(e.value)}${lA(e.params)}`:aA(e)}function hA(e,t={whitespace:!0}){if("object"!=typeof e)throw eA(e,"Dict");const i=e instanceof Map?e.entries():Object.entries(e),s=null!=t&&t.whitespace?" ":"";return Array.from(i).map((([e,t])=>{t instanceof Ky==!1&&(t=new Ky(t));let i=nA(e);var s;return!0===t.value?i+=lA(t.params):(i+="=",Array.isArray(t.value)?i+=`(${(s=t).value.map(dA).join(" ")})${lA(s.params)}`:i+=dA(t)),i})).join(`,${s}`)}const cA=e=>Math.round(e),uA=e=>100*cA(e/100),pA={br:cA,d:cA,bl:uA,dl:uA,mtp:uA,nor:(e,t)=>(null!=t&&t.baseUrl&&(e=function(e,t){const i=new URL(e),s=new URL(t);if(i.origin!==s.origin)return e;const r=i.pathname.split("/").slice(1),o=s.pathname.split("/").slice(1,-1);for(;r[0]===o[0];)r.shift(),o.shift();for(;o.length;)o.shift(),r.unshift("..");return r.join("/")}(e,t.baseUrl)),encodeURIComponent(e)),rtp:uA,tb:cA};function fA(e,t){const i={};if(null==e||"object"!=typeof e)return i;const s=Object.keys(e).sort(),r=kc({},pA,null==t?void 0:t.formatters),o=null==t?void 0:t.filter;return s.forEach((s=>{if(null!=o&&o(s))return;let a=e[s];const n=r[s];n&&(a=n(a,t)),"v"===s&&1===a||"pr"==s&&1===a||(e=>"number"==typeof e?Lc(e):null!=e&&""!==e&&!1!==e)(a)&&((e=>"ot"===e||"sf"===e||"st"===e)(s)&&"string"==typeof a&&(a=new Yy(a)),i[s]=a)})),i}function mA(e,t={}){return e?function(e,t){return hA(e,t)}(fA(e,t),kc({whitespace:!1},t)):""}function gA(e,t,i){return kc(e,function(e,t={}){if(!e)return{};const i=Object.entries(e),s=Object.entries(qy).concat(Object.entries((null==t?void 0:t.customHeaderMap)||{})),r=i.reduce(((e,t)=>{var i;const[r,o]=t,a=(null==(i=s.find((e=>e[1].includes(r))))?void 0:i[0])||Jy.REQUEST;return null!=e[a]||(e[a]={}),e[a][r]=o,e}),{});return Object.entries(r).reduce(((e,[i,s])=>(e[i]=mA(s,t),e)),{})}(t,i))}const yA=/CMCD=[^&#]+/;function AA(e,t,i){const s=function(e,t={}){if(!e)return"";const i=mA(e,t);return`CMCD=${encodeURIComponent(i)}`}(t,i);if(!s)return e;if(yA.test(e))return e.replace(yA,s);const r=e.includes("?")?"&":"?";return`${e}${r}${s}`}function bA(e,t,i,s){e&&Object.keys(t).forEach((r=>{const o=e.filter((e=>e.groupId===r)).map((e=>{const o=kc({},e);return o.details=void 0,o.attrs=new jc(o.attrs),o.url=o.attrs.URI=vA(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",i),o.groupId=o.attrs["GROUP-ID"]=t[r],o.attrs["PATHWAY-ID"]=s,o}));e.push(...o)}))}function vA(e,t,i,s){const{HOST:r,PARAMS:o,[i]:a}=s;let n;t&&(n=null==a?void 0:a[t],n&&(e=n));const l=new self.URL(e);return r&&!n&&(l.host=r),o&&Object.keys(o).sort().forEach((e=>{e&&l.searchParams.set(e,o[e])})),l.href}const _A=/^age:\s*[\d.]+\s*$/im;class wA{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new zc,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then((()=>{if(this.loader===i&&!this.stats.aborted)return r(i,t.url)})).catch((e=>{if(this.loader===i&&!this.stats.aborted)return i.open("GET",t.url,!0),r(i,t.url)})).then((()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)})).catch((e=>{this.callbacks.onError({code:i.status,text:e.message},t,i,s)})):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const s=t.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:o}=i.loadPolicy;if(s)for(const t in s)e.setRequestHeader(t,s[t]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=r&&Lc(r)?r:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const s=t.readyState,r=this.config;if(!i.aborted&&s>=2&&(0===i.loading.first&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),4===s)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const s=t.status,o="text"!==t.responseType;if(s>=200&&s<300&&(o&&t.response||null!==t.responseText)){i.loading.end=Math.max(self.performance.now(),i.loading.first);const r=o?t.response:t.responseText,a="arraybuffer"===t.responseType?r.byteLength:r.length;if(i.loaded=i.total=a,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first),!this.callbacks)return;const n=this.callbacks.onProgress;if(n&&n(i,e,r,t),!this.callbacks)return;const l={url:t.responseURL,data:r,code:s};this.callbacks.onSuccess(l,i,e,t)}else{const o=r.loadPolicy.errorRetry;Tf(o,i.retry,!1,{url:e.url,data:void 0,code:s})?this.retry(o):(Uc.error(`${s} while loading ${e.url}`),this.callbacks.onError({code:s,text:t.statusText},e,t,i))}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry;if(Tf(e,this.stats.retry,!0))this.retry(e);else{var t;Uc.warn(`timeout while loading ${null==(t=this.context)?void 0:t.url}`);const e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=Sf(e,i.retry),i.retry++,Uc.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${null==t?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&_A.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const SA=/(\d+)-(\d+)\/(\d+)/;class EA{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||TA,this.controller=new self.AbortController,this.stats=new zc}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();const r=function(e,t){const i={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(kc({},e.headers))};e.rangeEnd&&i.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1));return i}(e,this.controller.signal),o=i.onProgress,a="arraybuffer"===e.responseType,n=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:d}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),t.timeout=l&&Lc(l)?l:d,this.requestTimeout=self.setTimeout((()=>{this.abortInternal(),i.onTimeout(s,e,this.response)}),t.timeout),self.fetch(this.request).then((r=>{this.response=this.loader=r;const n=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=d,this.requestTimeout=self.setTimeout((()=>{this.abortInternal(),i.onTimeout(s,e,this.response)}),d-(n-s.loading.start)),!r.ok){const{status:e,statusText:t}=r;throw new kA(t||"fetch, bad network response",e,r)}return s.loading.first=n,s.total=function(e){const t=e.get("Content-Range");if(t){const e=function(e){const t=SA.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}(t);if(Lc(e))return e}const i=e.get("Content-Length");if(i)return parseInt(i)}(r.headers)||s.total,o&&Lc(t.highWaterMark)?this.loadProgressively(r,s,e,t.highWaterMark,o):a?r.arrayBuffer():"json"===e.responseType?r.json():r.text()})).then((r=>{const a=this.response;if(!a)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);const l=r[n];l&&(s.loaded=s.total=l);const d={url:a.url,data:r,code:a.status};o&&!Lc(t.highWaterMark)&&o(s,e,r,a),i.onSuccess(d,s,e,a)})).catch((t=>{if(self.clearTimeout(this.requestTimeout),s.aborted)return;const r=t&&t.code||0,o=t?t.message:null;i.onError({code:r,text:o},e,t?t.details:null,s)}))}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,s=0,r){const o=new Bm,a=e.body.getReader(),n=()=>a.read().then((a=>{if(a.done)return o.dataLength&&r(t,i,o.flush(),e),Promise.resolve(new ArrayBuffer(0));const l=a.value,d=l.length;return t.loaded+=d,d=s&&r(t,i,o.flush(),e)):r(t,i,l,e),n()})).catch((()=>Promise.reject()));return n()}}function TA(e,t){return new self.Request(e.url,t)}class kA extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const LA=/\s/,CA={newCue(e,t,i,s){const r=[];let o,a,n,l,d;const h=self.VTTCue||self.TextTrackCue;for(let u=0;u=16?l--:l++;const s=_y(d.trim()),p=ky(t,i,s);null!=e&&null!=(c=e.cues)&&c.getCueById(p)||(a=new h(t,i,s),a.id=p,a.line=u+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*l/32)),r.push(a))}return e&&r.length&&(r.sort(((e,t)=>"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line)),r.forEach((t=>$p(e,t)))),r}},xA=Sc(Sc({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:wA,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:e,partCurrent:t,hls:i}=this,{autoLevelEnabled:s,media:r}=i;if(!e||!r)return;const o=performance.now(),a=t?t.stats:e.stats,n=t?t.duration:e.duration,l=o-a.loading.start,d=i.minAutoLevel;if(a.aborted||a.loaded&&a.loaded===a.total||e.level<=d)return this.clearTimer(),void(this._nextAutoLevel=-1);if(!s||r.paused||!r.playbackRate||!r.readyState)return;const h=i.mainForwardBufferInfo;if(null===h)return;const c=this.bwEstimator.getEstimateTTFB(),u=Math.abs(r.playbackRate);if(l<=Math.max(c,n/(2*u)*1e3))return;const p=h.len/u,f=a.loading.first?a.loading.first-a.loading.start:-1,m=a.loaded&&f>-1,g=this.getBwEstimate(),y=i.levels,A=y[e.level],b=a.total||Math.max(a.loaded,Math.round(n*A.averageBitrate/8));let v=m?l-f:l;v<1&&m&&(v=Math.min(l,8*a.loaded/g));const _=m?1e3*a.loaded/v:0,w=_?(b-a.loaded)/_:8*b/g+c/1e3;if(w<=p)return;const S=_?8*_:g;let E,T=Number.POSITIVE_INFINITY;for(E=e.level-1;E>d;E--){const e=y[E].maxBitrate;if(T=this.getTimeToLoadFrag(c/1e3,S,n*e,!y[E].details),T=w)return;if(T>10*n)return;i.nextLoadLevel=i.nextAutoLevel=E,m?this.bwEstimator.sample(l-Math.min(c,f),a.loaded):this.bwEstimator.sampleTTFB(l);const k=y[E].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>k&&this.resetEstimator(k),this.clearTimer(),Uc.warn(`[abr] Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} is loading too slowly;\n Time to underbuffer: ${p.toFixed(3)} s\n Estimated load time for current fragment: ${w.toFixed(3)} s\n Estimated load time for down switch fragment: ${T.toFixed(3)} s\n TTFB estimate: ${0|f} ms\n Current BW estimate: ${Lc(g)?0|g:"Unknown"} bps\n New BW estimate: ${0|this.getBwEstimate()} bps\n Switching to level ${E} @ ${0|k} bps`),i.trigger(Dc.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:a})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(Uc.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new Nf(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Dc.FRAG_LOADING,this.onFragLoading,this),e.on(Dc.FRAG_LOADED,this.onFragLoaded,this),e.on(Dc.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Dc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Dc.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Dc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Dc.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(Dc.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Dc.FRAG_LOADING,this.onFragLoading,this),e.off(Dc.FRAG_LOADED,this.onFragLoaded,this),e.off(Dc.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Dc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Dc.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Dc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Dc.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(Dc.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){var s;if(!i.bitrateTest)this.fragCurrent=i,this.partCurrent=null!=(s=t.part)?s:null;this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case Pc.BUFFER_ADD_CODEC_ERROR:case Pc.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case Pc.FRAG_LOAD_TIMEOUT:{const e=t.frag,{fragCurrent:i,partCurrent:s}=this;if(e&&i&&e.sn===i.sn&&e.level===i.level){const t=performance.now(),i=s?s.stats:e.stats,r=t-i.loading.start,o=i.loading.first?i.loading.first-i.loading.start:-1;if(i.loaded&&o>-1){const e=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(r-Math.min(e,o),i.loaded)}else this.bwEstimator.sampleTTFB(r)}break}}}getTimeToLoadFrag(e,t,i,s){return e+i/t+(s?this.lastLevelLoadSec:0)}onLevelLoaded(e,t){const i=this.hls.config,{loading:s}=t.stats,r=s.end-s.start;Lc(r)&&(this.lastLevelLoadSec=r/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:i}){const s=i?i.stats:t.stats;if(t.type===Up&&this.bwEstimator.sampleTTFB(s.loading.first-s.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const e=i?i.duration:t.duration,r=this.hls.levels[t.level],o=(r.loaded?r.loaded.bytes:0)+s.loaded,a=(r.loaded?r.loaded.duration:0)+e;r.loaded={bytes:o,duration:a},r.realBitrate=Math.round(8*o/a)}if(t.bitrateTest){const e={stats:s,frag:t,part:i,id:t.type};this.onFragBuffered(Dc.FRAG_BUFFERED,e),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:s}=t,r=null!=s&&s.stats.loaded?s.stats:i.stats;if(r.aborted)return;if(this.ignoreFragment(i))return;const o=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,r.loaded),r.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Up||"initSegment"===e.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),s=this.hls.config.maxStarvationDelay,r=this.findBestLevel(i,t,e,0,s,1,1);if(r>-1)return r;const o=this.hls.firstLevel,a=Math.min(Math.max(o,t),e);return Uc.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${o} clamped to ${a}`),a}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(!(-1===e||t&&i&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return e;const s=t&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){const t=this.hls.levels;if(t.length>Math.max(e,s)&&t[e].loadError<=t[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this,{maxAutoLevel:s,config:r,minAutoLevel:o}=i,a=t?t.duration:e?e.duration:0,n=this.getBwEstimate(),l=this.getStarvationDelay();let d=r.abrBandWidthFactor,h=r.abrBandWidthUpFactor;if(l){const e=this.findBestLevel(n,o,s,l,0,d,h);if(e>=0)return e}let c=a?Math.min(a,r.maxStarvationDelay):r.maxStarvationDelay;if(!l){const e=this.bitrateTestDelay;if(e){c=(a?Math.min(a,r.maxLoadingDelay):r.maxLoadingDelay)-e,Uc.info(`[abr] bitrate test took ${Math.round(1e3*e)}ms, set first fragment max fetchDuration to ${Math.round(1e3*c)} ms`),d=h=1}}const u=this.findBestLevel(n,o,s,l,c,d,h);if(Uc.info(`[abr] ${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${u}`),u>-1)return u;const p=i.levels[o],f=i.levels[i.loadLevel];return(null==p?void 0:p.bitrate)<(null==f?void 0:f.bitrate)?o:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,s=e.mainForwardBufferInfo;return(s?s.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,s,r,o,a){var n;const l=s+r,d=this.lastLoadedFragLevel,h=-1===d?this.hls.firstLevel:d,{fragCurrent:c,partCurrent:u}=this,{levels:p,allAudioTracks:f,loadLevel:m,config:g}=this.hls;if(1===p.length)return 0;const y=p[h],A=!(null==y||null==(n=y.details)||!n.live),b=-1===m||-1===d;let v,_="SDR",w=(null==y?void 0:y.frameRate)||0;const{audioPreference:S,videoPreference:E}=g,T=this.audioTracksByGroup||(this.audioTracksByGroup=function(e){return e.reduce(((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const s=t.channels||"2";return i.channels[s]=(i.channels[s]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}(f));if(b){if(-1!==this.firstSelection)return this.firstSelection;const s=this.codecTiers||(this.codecTiers=function(e,t,i,s){return e.slice(i,s+1).reduce(((e,i)=>{if(!i.codecSet)return e;const s=i.audioGroups;let r=e[i.codecSet];r||(e[i.codecSet]=r={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!s,fragmentError:0}),r.minBitrate=Math.min(r.minBitrate,i.bitrate);const o=Math.min(i.height,i.width);return r.minHeight=Math.min(r.minHeight,o),r.minFramerate=Math.min(r.minFramerate,i.frameRate),r.maxScore=Math.max(r.maxScore,i.score),r.fragmentError+=i.fragmentError,r.videoRanges[i.videoRange]=(r.videoRanges[i.videoRange]||0)+1,s&&s.forEach((e=>{if(!e)return;const i=t.groups[e];i&&(r.hasDefaultAudio=r.hasDefaultAudio||t.hasDefaultAudio?i.hasDefault:i.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(i.channels).forEach((e=>{r.channels[e]=(r.channels[e]||0)+i.channels[e]})))})),e}),{})}(p,T,t,i)),r=function(e,t,i,s,r){const o=Object.keys(e),a=null==s?void 0:s.channels,n=null==s?void 0:s.audioCodec,l=a&&2===parseInt(a);let d=!0,h=!1,c=1/0,u=1/0,p=1/0,f=0,m=[];const{preferHDR:g,allowedVideoRanges:y}=$f(t,r);for(let t=o.length;t--;){const i=e[o[t]];d=i.channels[2]>0,c=Math.min(c,i.minHeight),u=Math.min(u,i.minFramerate),p=Math.min(p,i.minBitrate);const s=y.filter((e=>i.videoRanges[e]>0));s.length>0&&(h=!0,m=s)}c=Lc(c)?c:0,u=Lc(u)?u:0;const A=Math.max(1080,c),b=Math.max(30,u);p=Lc(p)?p:i,i=Math.max(p,i),h||(t=void 0,m=[]);const v=o.reduce(((t,s)=>{const r=e[s];if(s===t)return t;if(r.minBitrate>i)return Vf(s,`min bitrate of ${r.minBitrate} > current estimate of ${i}`),t;if(!r.hasDefaultAudio)return Vf(s,"no renditions with default or auto-select sound found"),t;if(n&&s.indexOf(n.substring(0,4))%5!=0)return Vf(s,`audio codec preference "${n}" not found`),t;if(a&&!l){if(!r.channels[a])return Vf(s,`no renditions with ${a} channel sound found (channels options: ${Object.keys(r.channels)})`),t}else if((!n||l)&&d&&0===r.channels[2])return Vf(s,"no renditions with stereo sound found"),t;return r.minHeight>A?(Vf(s,`min resolution of ${r.minHeight} > maximum of ${A}`),t):r.minFramerate>b?(Vf(s,`min framerate of ${r.minFramerate} > maximum of ${b}`),t):m.some((e=>r.videoRanges[e]>0))?r.maxScore=mp(t)||r.fragmentError>e[t].fragmentError)?t:(f=r.maxScore,s):(Vf(s,`no variants with VIDEO-RANGE of ${JSON.stringify(m)} found`),t)}),void 0);return{codecSet:v,videoRanges:m,preferHDR:g,minFramerate:u,minBitrate:p}}(s,_,e,S,E),{codecSet:o,videoRanges:a,minFramerate:n,minBitrate:l,preferHDR:d}=r;v=o,_=d?a[a.length-1]:a[0],w=n,e=Math.max(e,l),Uc.log(`[abr] picked start tier ${JSON.stringify(r)}`)}else v=null==y?void 0:y.codecSet,_=null==y?void 0:y.videoRange;const k=u?u.duration:c?c.duration:0,L=this.bwEstimator.getEstimateTTFB()/1e3,C=[];for(let n=i;n>=t;n--){var x;const t=p[n],c=n>h;if(!t)continue;if(g.useMediaCapabilities&&!t.supportedResult&&!t.supportedPromise){const i=navigator.mediaCapabilities;"function"==typeof(null==i?void 0:i.decodingInfo)&&Wf(t,T,_,w,e,S)?(t.supportedPromise=zf(t,T,i),t.supportedPromise.then((e=>{if(!this.hls)return;t.supportedResult=e;const i=this.hls.levels,s=i.indexOf(t);e.error?Uc.warn(`[abr] MediaCapabilities decodingInfo error: "${e.error}" for level ${s} ${JSON.stringify(e)}`):e.supported||(Uc.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${s} ${JSON.stringify(e)}`),s>-1&&i.length>1&&(Uc.log(`[abr] Removing unsupported level ${s}`),this.hls.removeLevel(s)))}))):t.supportedResult=jf}if(v&&t.codecSet!==v||_&&t.videoRange!==_||c&&w>t.frameRate||!c&&w>0&&w=2*k&&0===r?p[n].averageBitrate:p[n].maxBitrate,P=this.getTimeToLoadFrag(L,D,R*E,void 0===f);if(D>=R&&(n===d||0===t.loadError&&0===t.fragmentError)&&(P<=L||!Lc(P)||A&&!this.bitrateTestDelay||P${n} adjustedbw(${Math.round(D)})-bitrate=${Math.round(D-R)} ttfb:${L.toFixed(1)} avgDuration:${E.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${P.toFixed(1)} firstSelection:${b} codecSet:${v} videoRange:${_} hls.loadLevel:${m}`)),b&&(this.firstSelection=n),n}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls,s=Math.min(Math.max(e,i),t);this._nextAutoLevel!==s&&(this.nextAutoLevelKey="",this._nextAutoLevel=s)}},bufferController:class{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=e=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=e=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:e,mediaSource:t}=this;this.log("Media source opened"),e&&(e.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(Dc.MEDIA_ATTACHED,{media:e,mediaSource:t})),t&&t.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:e,_objectUrl:t}=this;e!==t&&Uc.error(`Media element src was set while attaching MediaSource (${t} > ${e})`)},this.hls=e;const t="[buffer-controller]";var i;this.appendSource=(i=dp(e.config.preferManagedMediaSource),"undefined"!=typeof self&&i===self.ManagedMediaSource),this.log=Uc.log.bind(Uc,t),this.warn=Uc.warn.bind(Uc,t),this.error=Uc.error.bind(Uc,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(Dc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Dc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Dc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Dc.BUFFER_RESET,this.onBufferReset,this),e.on(Dc.BUFFER_APPENDING,this.onBufferAppending,this),e.on(Dc.BUFFER_CODECS,this.onBufferCodecs,this),e.on(Dc.BUFFER_EOS,this.onBufferEos,this),e.on(Dc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Dc.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Dc.FRAG_PARSED,this.onFragParsed,this),e.on(Dc.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(Dc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Dc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Dc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Dc.BUFFER_RESET,this.onBufferReset,this),e.off(Dc.BUFFER_APPENDING,this.onBufferAppending,this),e.off(Dc.BUFFER_CODECS,this.onBufferCodecs,this),e.off(Dc.BUFFER_EOS,this.onBufferEos,this),e.off(Dc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Dc.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Dc.FRAG_PARSED,this.onFragParsed,this),e.off(Dc.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new $g(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const i=this.media=t.media,s=dp(this.appendSource);if(i&&s){var r;const e=this.mediaSource=new s;this.log(`created media source: ${null==(r=e.constructor)?void 0:r.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming));const t=this._objectUrl=self.URL.createObjectURL(e);if(this.appendSource)try{i.removeAttribute("src");const s=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||s&&e instanceof s,Hg(i),function(e,t){const i=self.document.createElement("source");i.type="video/mp4",i.src=t,e.appendChild(i)}(i,t),i.load()}catch(e){i.src=t}else i.src=t;i.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:i}=this;if(t){if(this.log("media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){this.warn(`onMediaDetaching: ${e.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),this.mediaSrc===i?(e.removeAttribute("src"),this.appendSource&&Hg(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(Dc.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach((e=>{this.resetBuffer(e)})),this._initSourceBuffer()}resetBuffer(e){const t=this.sourceBuffer[e];try{var i;if(t)this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,null!=(i=this.mediaSource)&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}catch(t){this.warn(`onBufferReset ${e}`,t)}}onBufferCodecs(e,t){const i=this.getSourceBufferTypes().length,s=Object.keys(t);if(s.forEach((e=>{if(i){const i=this.tracks[e];if(i&&"function"==typeof i.buffer.changeType){var s;const{id:r,codec:o,levelCodec:a,container:n,metadata:l}=t[e],d=bp(i.codec,i.levelCodec),h=null==d?void 0:d.replace(Vg,"$1");let c=bp(o,a);const u=null==(s=c)?void 0:s.replace(Vg,"$1");if(c&&h!==u){"audio"===e.slice(0,5)&&(c=Ap(c,this.appendSource));const t=`${n};codecs=${c}`;this.appendChangeType(e,t),this.log(`switching codec ${d} to ${c}`),this.tracks[e]={buffer:i.buffer,codec:o,container:n,levelCodec:a,metadata:l,id:r}}}}else this.pendingTracks[e]=t[e]})),i)return;const r=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==r&&(this.log(`${r} bufferCodec event(s) expected ${s.join(",")}`),this.bufferCodecEventsExpected=r),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:i}=this,s={execute:()=>{const s=this.sourceBuffer[e];s&&(this.log(`changing ${e} sourceBuffer type to ${t}`),s.changeType(t)),i.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:t=>{this.warn(`Failed to change ${e} SourceBuffer type`,t)}};i.append(s,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:i,operationQueue:s,tracks:r}=this,{data:o,type:a,frag:n,part:l,chunkMeta:d}=t,h=d.buffering[a],c=self.performance.now();h.start=c;const u=n.stats.buffering,p=l?l.stats.buffering:null;0===u.start&&(u.start=c),p&&0===p.start&&(p.start=c);const f=r.audio;let m=!1;"audio"===a&&"audio/mpeg"===(null==f?void 0:f.container)&&(m=!this.lastMpegAudioChunk||1===d.id||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const g=n.start,y={execute:()=>{if(h.executeStart=self.performance.now(),m){const e=this.sourceBuffer[a];if(e){const t=g-e.timestampOffset;Math.abs(t)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${g} (delta: ${t}) sn: ${n.sn})`),e.timestampOffset=g)}}this.appendExecutor(o,a)},onStart:()=>{},onComplete:()=>{const e=self.performance.now();h.executeEnd=h.end=e,0===u.first&&(u.first=e),p&&0===p.first&&(p.first=e);const{sourceBuffer:t}=this,i={};for(const e in t)i[e]=rm.getBuffered(t[e]);this.appendErrors[a]=0,"audio"===a||"video"===a?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(Dc.BUFFER_APPENDED,{type:a,frag:n,part:l,chunkMeta:d,parent:n.type,timeRanges:i})},onError:e=>{const t={type:Rc.MEDIA_ERROR,parent:n.type,details:Pc.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:n,part:l,chunkMeta:d,error:e,err:e,fatal:!1};if(e.code===DOMException.QUOTA_EXCEEDED_ERR)t.details=Pc.BUFFER_FULL_ERROR;else{const e=++this.appendErrors[a];t.details=Pc.BUFFER_APPEND_ERROR,this.warn(`Failed ${e}/${i.config.appendErrorMaxRetry} times to append segment in "${a}" sourceBuffer`),e>=i.config.appendErrorMaxRetry&&(t.fatal=!0)}i.trigger(Dc.ERROR,t)}};s.append(y,a,!!this.pendingTracks[a])}onBufferFlushing(e,t){const{operationQueue:i}=this,s=e=>({execute:this.removeExecutor.bind(this,e,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(Dc.BUFFER_FLUSHED,{type:e})},onError:t=>{this.warn(`Failed to remove from ${e} SourceBuffer`,t)}});t.type?i.append(s(t.type),t.type):this.getSourceBufferTypes().forEach((e=>{i.append(s(e),e)}))}onFragParsed(e,t){const{frag:i,part:s}=t,r=[],o=s?s.elementaryStreams:i.elementaryStreams;o[Hc]?r.push("audiovideo"):(o[$c]&&r.push("audio"),o[Vc]&&r.push("video"));0===r.length&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers((()=>{const e=self.performance.now();i.stats.buffering.end=e,s&&(s.stats.buffering.end=e);const t=s?s.stats:i.stats;this.hls.trigger(Dc.FRAG_BUFFERED,{frag:i,part:s,stats:t,id:i.type})}),r)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce(((e,i)=>{const s=this.sourceBuffer[i];return!s||t.type&&t.type!==i||(s.ending=!0,s.ended||(s.ended=!0,this.log(`${i} sourceBuffer now EOS`))),e&&!(s&&!s.ended)}),!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers((()=>{this.getSourceBufferTypes().forEach((e=>{const t=this.sourceBuffer[e];t&&(t.ending=!1)}));const{mediaSource:e}=this;e&&"open"===e.readyState?(this.log("Calling mediaSource.endOfStream()"),e.endOfStream()):e&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${e.readyState}`)})))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||null===t)return;if(!this.getSourceBufferTypes().length)return;const s=e.config,r=i.currentTime,o=t.levelTargetDuration,a=t.live&&null!==s.liveBackBufferLength?s.liveBackBufferLength:s.backBufferLength;if(Lc(a)&&a>0){const e=Math.max(a,o),t=Math.floor(r/o)*o-e;this.flushBackBuffer(r,o,t)}if(Lc(s.frontBufferFlushThreshold)&&s.frontBufferFlushThreshold>0){const e=Math.max(s.maxBufferLength,s.frontBufferFlushThreshold),t=Math.max(e,o),i=Math.floor(r/o)*o+t;this.flushFrontBuffer(r,o,i)}}flushBackBuffer(e,t,i){const{details:s,sourceBuffer:r}=this;this.getSourceBufferTypes().forEach((o=>{const a=r[o];if(a){const r=rm.getBuffered(a);if(r.length>0&&i>r.start(0)){if(this.hls.trigger(Dc.BACK_BUFFER_REACHED,{bufferEnd:i}),null!=s&&s.live)this.hls.trigger(Dc.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(a.ended&&r.end(r.length-1)-e<2*t)return void this.log(`Cannot flush ${o} back buffer while SourceBuffer is in ended state`);this.hls.trigger(Dc.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:o})}}}))}flushFrontBuffer(e,t,i){const{sourceBuffer:s}=this;this.getSourceBufferTypes().forEach((r=>{const o=s[r];if(o){const s=rm.getBuffered(o),a=s.length;if(a<2)return;const n=s.start(a-1),l=s.end(a-1);if(i>n||e>=n&&e<=l)return;if(o.ended&&e-l<2*t)return void this.log(`Cannot flush ${r} front buffer while SourceBuffer is in ended state`);this.hls.trigger(Dc.BUFFER_FLUSHING,{startOffset:n,endOffset:1/0,type:r})}}))}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||"open"!==this.mediaSource.readyState)return;const{details:e,hls:t,media:i,mediaSource:s}=this,r=e.fragments[0].start+e.totalduration,o=i.duration,a=Lc(s.duration)?s.duration:0;e.live&&t.config.liveDurationInfinity?(s.duration=1/0,this.updateSeekableRange(e)):(r>a&&r>o||!Lc(o))&&(this.log(`Updating Media Source duration to ${r.toFixed(3)}`),s.duration=r)}updateSeekableRange(e){const t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&null!=t&&t.setLiveSeekableRange){const s=Math.max(0,i[0].start),r=Math.max(s,s+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${s}-${r}.`),t.setLiveSeekableRange(s,r)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:i}=this,s=Object.keys(i).length;if(s&&(!e||2===s||"audiovideo"in i)){this.createSourceBuffers(i),this.pendingTracks={};const e=this.getSourceBufferTypes();if(e.length)this.hls.trigger(Dc.BUFFER_CREATED,{tracks:this.tracks}),e.forEach((e=>{t.executeNext(e)}));else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(Dc.ERROR,{type:Rc.MEDIA_ERROR,details:Pc.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(const r in e)if(!t[r]){var s;const o=e[r];if(!o)throw Error(`source buffer exists for track ${r}, however track does not`);let a=-1===(null==(s=o.levelCodec)?void 0:s.indexOf(","))?o.levelCodec:o.codec;a&&"audio"===r.slice(0,5)&&(a=Ap(a,this.appendSource));const n=`${o.container};codecs=${a}`;this.log(`creating sourceBuffer(${n})`);try{const e=t[r]=i.addSourceBuffer(n),s=r;this.addBufferListener(s,"updatestart",this._onSBUpdateStart),this.addBufferListener(s,"updateend",this._onSBUpdateEnd),this.addBufferListener(s,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(s,"bufferedchange",((e,t)=>{const i=t.removedRanges;null!=i&&i.length&&this.hls.trigger(Dc.BUFFER_FLUSHED,{type:r})})),this.tracks[r]={buffer:e,codec:a,container:o.container,levelCodec:o.levelCodec,metadata:o.metadata,id:o.id}}catch(e){this.error(`error while trying to add sourceBuffer: ${e.message}`),this.hls.trigger(Dc.ERROR,{type:Rc.MEDIA_ERROR,details:Pc.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:r,mimeType:n})}}}get mediaSrc(){var e;const t=(null==(e=this.media)?void 0:e.firstChild)||this.media;return null==t?void 0:t.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if("closed"===(null==(t=this.mediaSource)?void 0:t.readyState))return void this.resetBuffer(e);const{operationQueue:i}=this;i.current(e).onComplete(),i.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var i;const s=new Error(`${e} SourceBuffer error. MediaSource readyState: ${null==(i=this.mediaSource)?void 0:i.readyState}`);this.error(`${s}`,t),this.hls.trigger(Dc.ERROR,{type:Rc.MEDIA_ERROR,details:Pc.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:s,fatal:!1});const r=this.operationQueue.current(e);r&&r.onError(s)}removeExecutor(e,t,i){const{media:s,mediaSource:r,operationQueue:o,sourceBuffer:a}=this,n=a[e];if(!s||!r||!n)return this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),void o.shiftAndExecuteNext(e);const l=Lc(s.duration)?s.duration:1/0,d=Lc(r.duration)?r.duration:1/0,h=Math.max(0,t),c=Math.min(i,l,d);c>h&&(!n.ending||n.ended)?(n.ended=!1,this.log(`Removing [${h},${c}] from the ${e} SourceBuffer`),n.remove(h,c)):o.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.sourceBuffer[t];if(i)i.ended=!1,i.appendBuffer(e);else if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);const{operationQueue:i}=this,s=t.map((e=>i.appendBlocker(e)));Promise.all(s).then((()=>{e(),t.forEach((e=>{const t=this.sourceBuffer[e];null!=t&&t.updating||i.shiftAndExecuteNext(e)}))}))}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,i){const s=this.sourceBuffer[e];if(!s)return;const r=i.bind(this,e);this.listeners[e].push({event:t,listener:r}),s.addEventListener(t,r)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach((e=>{t.removeEventListener(e.event,e.listener)}))}},capLevelController:Gy,errorController:class{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=Uc.log.bind(Uc,"[info]:"),this.warn=Uc.warn.bind(Uc,"[warning]:"),this.error=Uc.error.bind(Uc,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(Dc.ERROR,this.onError,this),e.on(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Dc.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(Dc.ERROR,this.onError,this),e.off(Dc.ERROR,this.onErrorOut,this),e.off(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Dc.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(null==e?void 0:e.type)===Up?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var i,s;if(t.fatal)return;const r=this.hls,o=t.context;switch(t.details){case Pc.FRAG_LOAD_ERROR:case Pc.FRAG_LOAD_TIMEOUT:case Pc.KEY_LOAD_ERROR:case Pc.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case Pc.FRAG_PARSING_ERROR:if(null!=(i=t.frag)&&i.gap)return void(t.errorAction={action:Df,flags:Bf});case Pc.FRAG_GAP:case Pc.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=Rf);case Pc.LEVEL_EMPTY_ERROR:case Pc.LEVEL_PARSING_ERROR:{var a,n;const e=t.parent===Up?t.level:r.loadLevel;t.details===Pc.LEVEL_EMPTY_ERROR&&null!=(a=t.context)&&null!=(n=a.levelDetails)&&n.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,e):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e))}return;case Pc.LEVEL_LOAD_ERROR:case Pc.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==o?void 0:o.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level)));case Pc.AUDIO_TRACK_LOAD_ERROR:case Pc.AUDIO_TRACK_LOAD_TIMEOUT:case Pc.SUBTITLE_LOAD_ERROR:case Pc.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){const e=r.levels[r.loadLevel];if(e&&(o.type===Mp&&e.hasAudioGroup(o.groupId)||o.type===Fp&&e.hasSubtitleGroup(o.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=Rf,void(t.errorAction.flags=Mf)}return;case Pc.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const e=r.levels[r.loadLevel],i=null==e?void 0:e.attrs["HDCP-LEVEL"];i?t.errorAction={action:Rf,flags:Ff,hdcpLevel:i}:this.keySystemError(t)}return;case Pc.BUFFER_ADD_CODEC_ERROR:case Pc.REMUX_ALLOC_ERROR:case Pc.BUFFER_APPEND_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,null!=(s=t.level)?s:r.loadLevel));case Pc.INTERNAL_EXCEPTION:case Pc.BUFFER_APPENDING_ERROR:case Pc.BUFFER_FULL_ERROR:case Pc.LEVEL_SWITCH_ERROR:case Pc.BUFFER_STALLED_ERROR:case Pc.BUFFER_SEEK_OVER_HOLE:case Pc.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:Df,flags:Bf})}t.type===Rc.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const i=wf(this.hls.config.playlistLoadPolicy,e),s=this.playlistError++;if(Tf(i,s,_f(e),e.response))return{action:If,flags:Bf,retryConfig:i,retryCount:s};const r=this.getLevelSwitchAction(e,t);return i&&(r.retryConfig=i,r.retryCount=s),r}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),s=t.levels[i],{fragLoadPolicy:r,keyLoadPolicy:o}=t.config,a=wf(e.details.startsWith("key")?o:r,e),n=t.levels.reduce(((e,t)=>e+t.fragmentError),0);if(s){e.details!==Pc.FRAG_GAP&&s.fragmentError++;if(Tf(a,n,_f(e),e.response))return{action:If,flags:Bf,retryConfig:a,retryCount:n}}const l=this.getLevelSwitchAction(e,i);return a&&(l.retryConfig=a,l.retryCount=n),l}getLevelSwitchAction(e,t){const i=this.hls;null==t&&(t=i.loadLevel);const s=this.hls.levels[t];if(s){var r,o;const t=e.details;s.loadError++,t===Pc.BUFFER_APPEND_ERROR&&s.fragmentError++;let l=-1;const{levels:d,loadLevel:h,minAutoLevel:c,maxAutoLevel:u}=i;i.autoLevelEnabled||(i.loadLevel=-1);const p=null==(r=e.frag)?void 0:r.type,f=(p===Op&&t===Pc.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(t===Pc.BUFFER_ADD_CODEC_ERROR||t===Pc.BUFFER_APPEND_ERROR))&&d.some((({audioCodec:e})=>s.audioCodec!==e)),m="video"===e.sourceBufferName&&(t===Pc.BUFFER_ADD_CODEC_ERROR||t===Pc.BUFFER_APPEND_ERROR)&&d.some((({codecSet:e,audioCodec:t})=>s.codecSet!==e&&s.audioCodec===t)),{type:g,groupId:y}=null!=(o=e.context)?o:{};for(let i=d.length;i--;){const r=(i+h)%d.length;if(r!==h&&r>=c&&r<=u&&0===d[r].loadError){var a,n;const i=d[r];if(t===Pc.FRAG_GAP&&p===Up&&e.frag){const t=d[r].details;if(t){const i=Lf(e.frag,t.fragments,e.frag.start);if(null!=i&&i.gap)continue}}else{if(g===Mp&&i.hasAudioGroup(y)||g===Fp&&i.hasSubtitleGroup(y))continue;if(p===Op&&null!=(a=s.audioGroups)&&a.some((e=>i.hasAudioGroup(e)))||p===Np&&null!=(n=s.subtitleGroups)&&n.some((e=>i.hasSubtitleGroup(e)))||f&&s.audioCodec===i.audioCodec||!f&&s.audioCodec!==i.audioCodec||m&&s.codecSet===i.codecSet)continue}l=r;break}}if(l>-1&&i.loadLevel!==l)return e.levelRetry=!0,this.playlistError=0,{action:Rf,flags:Bf,nextAutoLevel:l}}return{action:Rf,flags:Mf}}onErrorOut(e,t){var i;switch(null==(i=t.errorAction)?void 0:i.action){case Df:break;case Rf:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===Pc.FRAG_GAP?/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError()):t.fatal=!0}t.fatal&&this.hls.stopLoad()}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:s,hdcpLevel:r,nextAutoLevel:o}=i;switch(s){case Bf:this.switchLevel(e,o);break;case Ff:r&&(t.maxHdcpLevel=rf[rf.indexOf(r)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`)}i.resolved||this.switchLevel(e,o)}switchLevel(e,t){void 0!==t&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}},fpsController:class{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(Dc.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(Dc.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const e=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=e,e&&"function"==typeof e.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,i){const s=performance.now();if(t){if(this.lastTime){const e=s-this.lastTime,r=i-this.lastDroppedFrames,o=t-this.lastDecodedFrames,a=1e3*r/e,n=this.hls;if(n.trigger(Dc.FPS_DROP,{currentDropped:r,currentDecoded:o,totalDroppedFrames:i}),a>0&&r>n.config.fpsDroppedMonitoringThreshold*o){let e=n.currentLevel;Uc.warn("drop FPS ratio greater than max allowed value for currentLevel: "+e),e>0&&(-1===n.autoLevelCapping||n.autoLevelCapping>=e)&&(e-=1,n.trigger(Dc.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:n.currentLevel}),n.autoLevelCapping=e,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}},stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:hu,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:CA,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:class extends Im{constructor(e,t,i){super(e,t,i,"[subtitle-stream-controller]",Np),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(Dc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Dc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Dc.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Dc.ERROR,this.onError,this),e.on(Dc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(Dc.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(Dc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(Dc.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(Dc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Dc.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(Dc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Dc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Dc.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Dc.ERROR,this.onError,this),e.off(Dc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(Dc.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(Dc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(Dc.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(Dc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Dc.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=wm,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:s}=t;if(this.fragPrevious=i,this.state=wm,!s)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let o;const a=i.start;for(let e=0;e=r[e].start&&a<=r[e].end){o=r[e];break}const n=i.start+i.duration;o?o.end=n:(o={start:a,end:n},r.push(o)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null)}onBufferFlushing(e,t){const{startOffset:i,endOffset:s}=t;if(0===i&&s!==Number.POSITIVE_INFINITY){const e=s-1;if(e<=0)return;t.endOffsetSubtitles=Math.max(0,e),this.tracksBuffered.forEach((t=>{for(let i=0;inew cf(e))):(this.tracksBuffered=[],this.levels=t.map((e=>{const t=new cf(e);return this.tracksBuffered[t.id]=[],t})),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Np),this.fragPrevious=null,this.mediaBuffer=null)}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,null==(i=this.levels)||!i.length||-1===this.currentTrackId)return void this.clearInterval();const s=this.levels[this.currentTrackId];null!=s&&s.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,s&&this.setInterval(500)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:s,levels:r}=this,{details:o,id:a}=t;if(!r)return void this.warn(`Subtitle tracks were reset while loading level ${a}`);const n=r[a];if(a>=r.length||!n)return;this.log(`Subtitle track ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""},duration:${o.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(o.live||null!=(i=n.details)&&i.live){const e=this.mainDetails;if(o.deltaUpdateFailed||!e)return;const t=e.fragments[0];var d;if(n.details)l=this.alignPlaylists(o,n.details,null==(d=this.levelLastLoaded)?void 0:d.details),0===l&&t&&(l=t.start,yf(o,l));else o.hasProgramDateTime&&e.hasProgramDateTime?(hm(o,e),l=o.fragments[0].start):t&&(l=t.start,yf(o,l))}if(n.details=o,this.levelLastLoaded=n,a===s&&(this.startFragRequested||!this.mainDetails&&o.live||this.setStartPosition(this.mainDetails||o,l),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===wm)){Lf(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),n.details=void 0)}}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,s=t.decryptdata,r=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&null!=s&&s.key&&s.iv&&"AES-128"===s.method){const e=performance.now();this.decrypter.decrypt(new Uint8Array(i),s.key.buffer,s.iv.buffer).catch((e=>{throw r.trigger(Dc.ERROR,{type:Rc.MEDIA_ERROR,details:Pc.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e})).then((i=>{const s=performance.now();r.trigger(Dc.FRAG_DECRYPTED,{frag:t,payload:i,stats:{tstart:e,tdecrypt:s}})})).catch((e=>{this.warn(`${e.name}: ${e.message}`),this.state=wm}))}}doTick(){if(this.media){if(this.state===wm){const{currentTrackId:e,levels:t}=this,i=null==t?void 0:t[e];if(!i||!t.length||!i.details)return;const{config:s}=this,r=this.getLoadPosition(),o=rm.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,s.maxBufferHole),{end:a,len:n}=o,l=this.getFwdBufferInfo(this.media,Up),d=i.details;if(n>this.getMaxBufferLength(null==l?void 0:l.len)+d.levelTargetDuration)return;const h=d.fragments,c=h.length,u=d.edge;let p=null;const f=this.fragPrevious;if(au-e?0:e;p=Lf(f,h,Math.max(h[0].start,a),t),!p&&f&&f.startthis.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let e=null;const t=Jp(this.media.textTracks);for(let i=0;i-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(Dc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Dc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Dc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Dc.LEVEL_LOADING,this.onLevelLoading,this),e.on(Dc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Dc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(Dc.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(Dc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Dc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Dc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Dc.LEVEL_LOADING,this.onLevelLoading,this),e.off(Dc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Dc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(Dc.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);Jp(this.media.textTracks).forEach((e=>{Vp(e)})),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:s,details:r}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==s)return void this.warn(`Subtitle track with id:${i} and group:${s} not found in active group ${null==o?void 0:o.groupId}`);const a=o.details;o.details=t.details,this.log(`Subtitle track ${i} "${o.name}" lang:${o.lang} group:${s} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,s=this.groupIds;let r=this.currentTrack;if(!i||(null==s?void 0:s.length)!==(null==i?void 0:i.length)||null!=i&&i.some((e=>-1===(null==s?void 0:s.indexOf(e))))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter((e=>!i||-1!==i.indexOf(e.groupId)));if(e.length)this.selectDefaultTrack&&!e.some((e=>e.default))&&(this.selectDefaultTrack=!1),e.forEach(((e,t)=>{e.id=t}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.subtitlePreference;if(!r&&t){this.selectDefaultTrack=!1;const i=Hf(t,e);if(i>-1)r=e[i];else{const e=Hf(t,this.tracks);r=this.tracks[e]}}let s=this.findTrackId(r);-1===s&&r&&(s=this.findTrackId(null));const o={subtitleTracks:e};this.log(`Updating subtitle tracks, ${e.length} track(s) found in "${null==i?void 0:i.join(",")}" group-id`),this.hls.trigger(Dc.SUBTITLE_TRACKS_UPDATED,o),-1!==s&&-1===this.trackId&&this.setSubtitleTrack(s)}else this.shouldReloadPlaylist(r)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let s=0;s-1){const e=this.tracksInGroup[s];return this.setSubtitleTrack(s),e}if(i)return null;{const i=Hf(e,t);if(i>-1)return t[i]}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const i=t.id,s=t.groupId;let r=t.url;if(e)try{r=e.addDirectives(r)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}this.log(`Loading subtitle playlist for id ${i}`),this.hls.trigger(Dc.SUBTITLE_TRACK_LOADING,{url:r,id:i,groupId:s,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Jp(e.textTracks),i=this.currentTrack;let s;if(i&&(s=t.filter((e=>Wg(i,e)))[0],s||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach((e=>{"disabled"!==e.mode&&e!==s&&(e.mode="disabled")})),s){const e=this.subtitleDisplay?"showing":"hidden";s.mode!==e&&(s.mode=e)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media)return void(this.queuedDefaultTrack=e);if(e<-1||e>=t.length||!Lc(e))return void this.warn(`Invalid subtitle track id: ${e}`);this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,s=t[e]||null;if(this.trackId=e,this.currentTrack=s,this.toggleTrackModes(),!s)return void this.hls.trigger(Dc.SUBTITLE_TRACK_SWITCH,{id:e});const r=!!s.details&&!s.details.live;if(e===this.trackId&&s===i&&r)return;this.log(`Switching to subtitle-track ${e}`+(s?` "${s.name}" lang:${s.lang} group:${s.groupId}`:""));const{id:o,groupId:a="",name:n,type:l,url:d}=s;this.hls.trigger(Dc.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:n,type:l,url:d});const h=this.switchParams(s.url,null==i?void 0:i.details,s.details);this.loadPlaylist(h)}},timelineController:class{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(Dc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Dc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Dc.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Dc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(Dc.FRAG_LOADING,this.onFragLoading,this),e.on(Dc.FRAG_LOADED,this.onFragLoaded,this),e.on(Dc.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(Dc.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(Dc.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(Dc.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(Dc.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(Dc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Dc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Dc.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Dc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(Dc.FRAG_LOADING,this.onFragLoading,this),e.off(Dc.FRAG_LOADED,this.onFragLoaded,this),e.off(Dc.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(Dc.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(Dc.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(Dc.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(Dc.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const e=new uy(this,"textTrack1"),t=new uy(this,"textTrack2"),i=new uy(this,"textTrack3"),s=new uy(this,"textTrack4");this.cea608Parser1=new dy(1,e,t),this.cea608Parser2=new dy(3,i,s)}}addCues(e,t,i,s,r){let o=!1;for(let e=r.length;e--;){const s=r[e],h=(a=s[0],n=s[1],l=t,d=i,Math.min(n,d)-Math.max(a,l));if(h>=0&&(s[0]=Math.min(s[0],t),s[1]=Math.max(s[1],i),o=!0,h/(i-t)>.5))return}var a,n,l,d;if(o||r.push([t,i]),this.config.renderTextTracksNatively){const r=this.captionsTracks[e];this.Cues.newCue(r,t,i,s)}else{const r=this.Cues.newCue(null,t,i,s);this.hls.trigger(Dc.CUES_PARSED,{type:"captions",cues:r,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:s,timescale:r}){const{unparsedVttFrags:o}=this;"main"===i&&(this.initPTS[t.cc]={baseTime:s,timescale:r}),o.length&&(this.unparsedVttFrags=[],o.forEach((e=>{this.onFragLoaded(Dc.FRAG_LOADED,e)})))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let s=0;s{Vp(e[t]),delete e[t]})),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let e=0;ee.textCodec===Cy));if(this.config.enableWebVTT||s&&this.config.enableIMSC1){if(jg(this.tracks,i))return void(this.tracks=i);if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const e=this.media,t=e?Jp(e.textTracks):null;if(this.tracks.forEach(((e,i)=>{let s;if(t){let i=null;for(let s=0;snull!==e)).map((e=>e.label));e.length&&Uc.warn(`Media element contains unused subtitle tracks: ${e.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const e=this.tracks.map((e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e})));this.hls.trigger(Dc.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach((e=>{const t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;const i=`textTrack${t[1]}`,s=this.captionsProperties[i];s&&(s.label=e.name,e.lang&&(s.languageCode=e.lang),s.media=e)}))}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return null==t?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===Up){var i,s;const{cea608Parser1:e,cea608Parser2:r,lastSn:o}=this,{cc:a,sn:n}=t.frag,l=null!=(i=null==(s=t.part)?void 0:s.index)?i:-1;e&&r&&(n!==o+1||n===o&&l!==this.lastPartIndex+1||a!==this.lastCc)&&(e.reset(),r.reset()),this.lastCc=a,this.lastSn=n,this.lastPartIndex=l}}onFragLoaded(e,t){const{frag:i,payload:s}=t;if(i.type===Np)if(s.byteLength){const e=i.decryptdata,r="stats"in t;if(null==e||!e.encrypted||r){const e=this.tracks[i.level],r=this.vttCCs;r[i.cc]||(r[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),e&&e.textCodec===Cy?this._parseIMSC1(i,s):this._parseVTTs(t)}}else this.hls.trigger(Dc.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;Py(t,this.initPTS[e.cc],(t=>{this._appendCues(t,e.level),i.trigger(Dc.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(t=>{Uc.log(`Failed to parse IMSC1: ${t}`),i.trigger(Dc.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})}))}_parseVTTs(e){var t;const{frag:i,payload:s}=e,{initPTS:r,unparsedVttFrags:o}=this,a=r.length-1;if(!r[i.cc]&&-1===a)return void o.push(e);const n=this.hls;Ly(null!=(t=i.initSegment)&&t.data?Ku(i.initSegment.data,new Uint8Array(s)):s,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,(e=>{this._appendCues(e,i.level),n.trigger(Dc.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})}),(t=>{const r="Missing initPTS for VTT MPEGTS"===t.message;r?o.push(e):this._fallbackToIMSC1(i,s),Uc.log(`Failed to parse VTT cue: ${t}`),r&&a>i.cc||n.trigger(Dc.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:t})}))}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Py(t,this.initPTS[e.cc],(()=>{i.textCodec=Cy,this._parseIMSC1(e,t)}),(()=>{i.textCodec="wvtt"}))}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||"disabled"===i.mode)return;e.forEach((e=>$p(i,e)))}else{const s=this.tracks[t];if(!s)return;const r=s.default?"default":"subtitles"+t;i.trigger(Dc.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===Np&&this.onFragLoaded(Dc.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:s}=this;if(!this.enabled||!i||!s)return;const{frag:r,samples:o}=t;if(r.type!==Up||"NONE"!==this.closedCaptionsForLevel(r))for(let e=0;eHp(e[s],t,i)))}if(this.config.renderTextTracksNatively&&0===t&&void 0!==s){const{textTracks:e}=this;Object.keys(e).forEach((i=>Hp(e[i],t,s)))}}}extractCea608Data(e){const t=[[],[]],i=31&e[0];let s=2;for(let r=0;r0&&-1===e?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=wm):(this.loadedmetadata=!1,this.state=km),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case wm:this.doTickIdle();break;case km:{var e;const{levels:t,trackId:i}=this,s=null==t||null==(e=t[i])?void 0:e.details;if(s){if(this.waitForCdnTuneIn(s))break;this.state=Rm}break}case Tm:{var t;const e=performance.now(),i=this.retryDate;if(!i||e>=i||null!=(t=this.media)&&t.seeking){const{levels:e,trackId:t}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==e?void 0:e[t])||null),this.state=wm}break}case Rm:{const e=this.waitingData;if(e){const{frag:t,part:i,cache:s,complete:r}=e;if(void 0!==this.initPTS[t.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=Em;const e={frag:t,part:i,payload:s.flush(),networkDetails:null};this._handleFragmentLoadProgress(e),r&&super._handleFragmentLoadComplete(e)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${t.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const e=this.getLoadPosition(),i=rm.bufferInfo(this.mediaBuffer,e,this.config.maxBufferHole);Cf(i.end,this.config.maxFragLookUpTolerance,t)<0&&(this.log(`Waiting fragment cc (${t.cc}) @ ${t.start} cancelled because another fragment at ${i.end} is needed`),this.clearWaitingFragment())}}else this.state=wm}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=wm)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:i,trackId:s}=this,r=e.config;if(!i&&(this.startFragRequested||!r.startFragPrefetch)||null==t||!t[s])return;const o=t[s],a=o.details;if(!a||a.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(a))return void(this.state=km);const n=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&n&&(this.bufferFlushed=!1,this.afterBufferFlushed(n,$c,Op));const l=this.getFwdBufferInfo(n,Op);if(null===l)return;const{bufferedTrack:d,switchingTrack:h}=this;if(!h&&this._streamEnded(l,a))return e.trigger(Dc.BUFFER_EOS,{type:"audio"}),void(this.state=xm);const c=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Up),u=l.len,p=this.getMaxBufferLength(null==c?void 0:c.len),f=a.fragments,m=f[0].start;let g=this.flushing?this.getLoadPosition():l.end;if(h&&i){const e=this.getLoadPosition();d&&!Gg(h.attrs,d.attrs)&&(g=e),a.PTSKnown&&em||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=m+.05)}if(u>=p&&!h&&gc.end+a.targetduration;if(b||(null==c||!c.len)&&l.len){const e=this.getAppendedFrag(y.start,Up);if(null===e)return;if(A||(A=!!e.gap||!!b&&0===c.len),b&&!A||A&&l.nextStart&&l.nextStartnew cf(e)))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:s}=this;s&&(s.abortRequests(),this.removeUnbufferedFrags(s.start)),this.resetLoadingState(),i?this.setInterval(100):this.resetTransmuxer(),i?(this.switchingTrack=t,this.state=wm,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=_m),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,null!==this.cachedTrackLoadedData&&(this.hls.trigger(Dc.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var i;if(null==this.mainDetails)return void(this.cachedTrackLoadedData=t);const{levels:s}=this,{details:r,id:o}=t;if(!s)return void this.warn(`Audio tracks were reset while loading level ${o}`);this.log(`Audio track ${o} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const a=s[o];let n=0;if(r.live||null!=(i=a.details)&&i.live){this.checkLiveUpdate(r);const e=this.mainDetails;if(r.deltaUpdateFailed||!e)return;var l;if(!a.details&&r.hasProgramDateTime&&e.hasProgramDateTime)hm(r,e),n=r.fragments[0].start;else n=this.alignPlaylists(r,a.details,null==(l=this.levelLastLoaded)?void 0:l.details)}a.details=r,this.levelLastLoaded=a,this.startFragRequested||!this.mainDetails&&r.live||this.setStartPosition(this.mainDetails||r,n),this.state!==km||this.waitForCdnTuneIn(r)||(this.state=wm),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:s,payload:r}=e,{config:o,trackId:a,levels:n}=this;if(!n)return void this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);const l=n[a];if(!l)return void this.warn("Audio track is undefined on fragment load progress");const d=l.details;if(!d)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(i.start);const h=o.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let c=this.transmuxer;c||(c=this.transmuxer=new Ng(this.hls,Op,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const u=this.initPTS[i.cc],p=null==(t=i.initSegment)?void 0:t.data;if(void 0!==u){const e=!1,t=s?s.index:-1,o=-1!==t,a=new om(i.level,i.sn,i.stats.chunkCount,r.byteLength,t,o);c.push(r,p,h,"",i,s,d.totalduration,e,a,u)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${d.startSN} ,${d.endSN}],track ${a}`);const{cache:e}=this.waitingData=this.waitingData||{frag:i,part:s,cache:new Bm,complete:!1};e.push(new Uint8Array(r)),this.waitingVideoCC=this.videoTrackCC,this.state=Rm}}_handleFragmentLoadComplete(e){this.waitingData?this.waitingData.complete=!0:super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:i,part:s}=t;if(i.type===Op)if(this.fragContextChanged(i))this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);else{if("initSegment"!==i.sn){this.fragPrevious=i;const e=this.switchingTrack;e&&(this.bufferedTrack=e,this.switchingTrack=null,this.hls.trigger(Dc.AUDIO_TRACK_SWITCHED,Sc({},e)))}this.fragBufferedComplete(i,s)}else if(!this.loadedmetadata&&i.type===Up){const e=this.videoBuffer||this.media;if(e){rm.getBuffered(e).length&&(this.loadedmetadata=!0)}}}onError(e,t){var i;if(t.fatal)this.state=Dm;else switch(t.details){case Pc.FRAG_GAP:case Pc.FRAG_PARSING_ERROR:case Pc.FRAG_DECRYPT_ERROR:case Pc.FRAG_LOAD_ERROR:case Pc.FRAG_LOAD_TIMEOUT:case Pc.KEY_LOAD_ERROR:case Pc.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Op,t);break;case Pc.AUDIO_TRACK_LOAD_ERROR:case Pc.AUDIO_TRACK_LOAD_TIMEOUT:case Pc.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==km||(null==(i=t.context)?void 0:i.type)!==Mp||(this.state=wm);break;case Pc.BUFFER_APPEND_ERROR:case Pc.BUFFER_FULL_ERROR:if(!t.parent||"audio"!==t.parent)return;if(t.details===Pc.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case Pc.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onBufferFlushing(e,{type:t}){t!==Vc&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Vc){this.flushing=!1,this.bufferFlushed=!0,this.state===xm&&(this.state=wm);const e=this.mediaBuffer||this.media;e&&(this.afterBufferFlushed(e,t,Op),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:s}=this,{remuxResult:r,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a)return void this.resetWhenMissingContext(o);const{frag:n,part:l,level:d}=a,{details:h}=d,{audio:c,text:u,id3:p,initSegment:f}=r;if(!this.fragContextChanged(n)&&h){if(this.state=Lm,this.switchingTrack&&c&&this.completeAudioSwitch(this.switchingTrack),null!=f&&f.tracks){const e=n.initSegment||n;this._bufferInitSegment(d,f.tracks,e,o),s.trigger(Dc.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:f.tracks})}if(c){const{startPTS:e,endPTS:t,startDTS:i,endDTS:s}=c;l&&(l.elementaryStreams[$c]={startPTS:e,endPTS:t,startDTS:i,endDTS:s}),n.setElementaryStreamInfo($c,e,t,i,s),this.bufferFragmentData(c,n,l,o)}if(null!=p&&null!=(t=p.samples)&&t.length){const e=kc({id:i,frag:n,details:h},p);s.trigger(Dc.FRAG_PARSING_METADATA,e)}if(u){const e=kc({id:i,frag:n,details:h},u);s.trigger(Dc.FRAG_PARSING_USERDATA,e)}}else this.fragmentTracker.removeFragment(n)}_bufferInitSegment(e,t,i,s){if(this.state!==Lm)return;t.video&&delete t.video;const r=t.audio;if(!r)return;r.id="audio";const o=e.audioCodec;this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${o}/${r.codec}]`),o&&1===o.split(",").length&&(r.levelCodec=o),this.hls.trigger(Dc.BUFFER_CODECS,t);const a=r.initSegment;if(null!=a&&a.byteLength){const e={type:"audio",frag:i,part:null,chunkMeta:s,parent:i.type,data:a};this.hls.trigger(Dc.BUFFER_APPENDING,e)}this.tickImmediate()}loadFragment(e,t,i){const s=this.fragmentTracker.getState(e);var r;if(this.fragCurrent=e,this.switchingTrack||s===Yf||s===Xf)if("initSegment"===e.sn)this._loadInitSegment(e,t);else if(null!=(r=t.details)&&r.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=Rm;const i=this.mainDetails;i&&i.fragments[0].start!==t.details.fragments[0].start&&hm(t.details,i)}else this.startFragRequested=!0,super.loadFragment(e,t,i);else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:i}=this,s=null==i?void 0:i.attrs,r=e.attrs;t&&s&&(s.CHANNELS!==r.CHANNELS||i.name!==e.name||i.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(Dc.AUDIO_TRACK_SWITCHED,Sc({},e))}},audioTrackController:class extends Uf{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Dc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Dc.LEVEL_LOADING,this.onLevelLoading,this),e.on(Dc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Dc.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(Dc.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Dc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Dc.LEVEL_LOADING,this.onLevelLoading,this),e.off(Dc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Dc.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(Dc.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:s,details:r}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==s)return void this.warn(`Audio track with id:${i} and group:${s} not found in active group ${null==o?void 0:o.groupId}`);const a=o.details;o.details=t.details,this.log(`Audio track ${i} "${o.name}" lang:${o.lang} group:${s} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,s=this.groupIds;let r=this.currentTrack;if(!i||(null==s?void 0:s.length)!==(null==i?void 0:i.length)||null!=i&&i.some((e=>-1===(null==s?void 0:s.indexOf(e))))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter((e=>!i||-1!==i.indexOf(e.groupId)));if(e.length)this.selectDefaultTrack&&!e.some((e=>e.default))&&(this.selectDefaultTrack=!1),e.forEach(((e,t)=>{e.id=t}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.audioPreference;if(!r&&t){const i=Hf(t,e,qf);if(i>-1)r=e[i];else{const e=Hf(t,this.tracks);r=this.tracks[e]}}let s=this.findTrackId(r);-1===s&&r&&(s=this.findTrackId(null));const a={audioTracks:e};this.log(`Updating audio tracks, ${e.length} track(s) found in group(s): ${null==i?void 0:i.join(",")}`),this.hls.trigger(Dc.AUDIO_TRACKS_UPDATED,a);const n=this.trackId;if(-1!==s&&-1===n)this.setAudioTrack(s);else if(e.length&&-1===n){var o;const t=new Error(`No audio track selected for current audio group-ID(s): ${null==(o=this.groupIds)?void 0:o.join(",")} track count: ${e.length}`);this.warn(t.message),this.hls.trigger(Dc.ERROR,{type:Rc.MEDIA_ERROR,details:Pc.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:t})}}else this.shouldReloadPlaylist(r)&&this.setAudioTrack(this.trackId)}onError(e,t){!t.fatal&&t.context&&(t.context.type!==Mp||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||(this.requestScheduled=-1,this.checkRetry(t)))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const s=this.currentTrack;if(s&&Jf(e,s,qf))return s;const r=Hf(e,this.tracksInGroup,qf);if(r>-1){const e=this.tracksInGroup[r];return this.setAudioTrack(r),e}if(s){let s=t.loadLevel;-1===s&&(s=t.firstAutoLevel);const r=function(e,t,i,s,r){const o=t[s],a=t.reduce(((e,t,i)=>{const s=t.uri;return(e[s]||(e[s]=[])).push(i),e}),{})[o.uri];a.length>1&&(s=Math.max.apply(Math,a));const n=o.videoRange,l=o.frameRate,d=o.codecSet.substring(0,4),h=Kf(t,s,(t=>{if(t.videoRange!==n||t.frameRate!==l||t.codecSet.substring(0,4)!==d)return!1;const s=t.audioGroups,o=i.filter((e=>!s||-1!==s.indexOf(e.groupId)));return Hf(e,o,r)>-1}));return h>-1?h:Kf(t,s,(t=>{const s=t.audioGroups,o=i.filter((e=>!s||-1!==s.indexOf(e.groupId)));return Hf(e,o,r)>-1}))}(e,t.levels,i,s,qf);if(-1===r)return null;t.nextLoadLevel=r}if(e.channels||e.audioCodec){const t=Hf(e,i);if(t>-1)return i[t]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length)return void this.warn(`Invalid audio track id: ${e}`);this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,s=t[e],r=s.details&&!s.details.live;if(e===this.trackId&&s===i&&r)return;if(this.log(`Switching to audio-track ${e} "${s.name}" lang:${s.lang} group:${s.groupId} channels:${s.channels}`),this.trackId=e,this.currentTrack=s,this.hls.trigger(Dc.AUDIO_TRACK_SWITCHING,Sc({},s)),r)return;const o=this.switchParams(s.url,null==i?void 0:i.details,s.details);this.loadPlaylist(o)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=e=>{try{this.apply(e,{ot:Vy.MANIFEST,su:!this.initialized})}catch(e){Uc.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=e=>{try{const t=e.frag,i=this.hls.levels[t.level],s=this.getObjectType(t),r={d:1e3*t.duration,ot:s};s!==Vy.VIDEO&&s!==Vy.AUDIO&&s!=Vy.MUXED||(r.br=i.bitrate/1e3,r.tb=this.getTopBandwidth(s)/1e3,r.bl=this.getBufferLength(s)),this.apply(e,r)}catch(e){Uc.warn("Could not generate segment CMCD data.",e)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;null!=i&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||function(){try{return crypto.randomUUID()}catch(e){try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){let t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?i:3&i|8).toString(16)}))}}}(),this.cid=i.contentId,this.useHeaders=!0===i.useHeaders,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(Dc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Dc.MEDIA_DETACHED,this.onMediaDetached,this),e.on(Dc.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(Dc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Dc.MEDIA_DETACHED,this.onMediaDetached,this),e.off(Dc.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,s;this.audioBuffer=null==(i=t.tracks.audio)?void 0:i.buffer,this.videoBuffer=null==(s=t.tracks.video)?void 0:s.buffer}createData(){var e;return{v:1,sf:Hy.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){kc(t,this.createData());const i=t.ot===Vy.INIT||t.ot===Vy.VIDEO||t.ot===Vy.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering);const{includeKeys:s}=this;s&&(t=Object.keys(t).reduce(((e,i)=>(s.includes(i)&&(e[i]=t[i]),e)),{})),this.useHeaders?(e.headers||(e.headers={}),gA(e.headers,t)):e.url=AA(e.url,t)}getObjectType(e){const{type:t}=e;return"subtitle"===t?Vy.TIMED_TEXT:"initSegment"===e.sn?Vy.INIT:"audio"===t?Vy.AUDIO:"main"===t?this.hls.audioTracks.length?Vy.VIDEO:Vy.MUXED:void 0}getTopBandwidth(e){let t,i=0;const s=this.hls;if(e===Vy.AUDIO)t=s.audioTracks;else{const e=s.maxAutoLevel,i=e>-1?e+1:s.levels.length;t=s.levels.slice(0,i)}for(const e of t)e.bitrate>i&&(i=e.bitrate);return i>0?i:NaN}getBufferLength(e){const t=this.hls.media,i=e===Vy.AUDIO?this.audioBuffer:this.videoBuffer;if(!i||!t)return NaN;return 1e3*rm.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,s){t(e),this.loader.load(e,i,s)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,s){t(e),this.loader.load(e,i,s)}}}},contentSteeringController:class{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=Uc.log.bind(Uc,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Dc.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Dc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Dc.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Dc.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Dc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Dc.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter((t=>t!==e)))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;null!==i&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((null==i?void 0:i.action)===Rf&&i.flags===Mf){const e=this.levels;let s=this.pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:i,pathwayId:s,type:o}=t.context;i&&e?r=this.getPathwayForGroupId(i,o,r):s&&(r=s)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!s&&e&&(s=e.reduce(((e,t)=>(-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e)),[])),s&&s.length>1&&(this.updatePathwayPriority(s),i.resolved=this.pathwayId!==r),i.resolved||Uc.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${e?e.length:e} priorities: ${JSON.stringify(s)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return null===this.levels?[]:this.levels.filter((t=>e===t.pathwayId))}updatePathwayPriority(e){let t;this.pathwayPriority=e;const i=this.penalizedPathways,s=performance.now();Object.keys(i).forEach((e=>{s-i[e]>3e5&&delete i[e]}));for(let s=0;s0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,vf(t),this.hls.trigger(Dc.LEVELS_UPDATED,{levels:t});const e=this.hls.levels[o];a&&e&&this.levels&&(e.attrs["STABLE-VARIANT-ID"]!==a.attrs["STABLE-VARIANT-ID"]&&e.bitrate!==a.bitrate&&this.log(`Unstable Pathways change from bitrate ${a.bitrate} to ${e.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,i){const s=this.getLevelsForPathway(i).concat(this.levels||[]);for(let i=0;i{const{ID:r,"BASE-ID":o,"URI-REPLACEMENT":a}=e;if(t.some((e=>e.pathwayId===r)))return;const n=this.getLevelsForPathway(o).map((e=>{const t=new jc(e.attrs);t["PATHWAY-ID"]=r;const o=t.AUDIO&&`${t.AUDIO}_clone_${r}`,n=t.SUBTITLES&&`${t.SUBTITLES}_clone_${r}`;o&&(i[t.AUDIO]=o,t.AUDIO=o),n&&(s[t.SUBTITLES]=n,t.SUBTITLES=n);const l=vA(e.uri,t["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",a),d=new cf({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:l,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(let t=1;t{this.log(`Loaded steering manifest: "${s}"`);const o=e.data;if(1!==o.VERSION)return void this.log(`Steering VERSION ${o.VERSION} not supported!`);this.updated=performance.now(),this.timeToLoad=o.TTL;const{"RELOAD-URI":a,"PATHWAY-CLONES":n,"PATHWAY-PRIORITY":l}=o;if(a)try{this.uri=new self.URL(a,s).href}catch(e){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest RELOAD-URI: ${a}`)}this.scheduleRefresh(this.uri||i.url),n&&this.clonePathways(n);const d={steeringManifest:o,url:s.toString()};this.hls.trigger(Dc.STEERING_MANIFEST_LOADED,d),l&&this.updatePathwayPriority(l)},onError:(e,t,i,s)=>{if(this.log(`Error loading steering manifest: ${e.code} ${e.text} (${t.url})`),this.stopLoad(),410===e.code)return this.enabled=!1,void this.log(`Steering manifest ${t.url} no longer available`);let r=1e3*this.timeToLoad;if(429!==e.code)this.scheduleRefresh(this.uri||t.url,r);else{const e=this.loader;if("function"==typeof(null==e?void 0:e.getResponseHeader)){const t=e.getResponseHeader("Retry-After");t&&(r=1e3*parseFloat(t))}this.log(`Steering manifest ${t.url} rate limited`)}},onTimeout:(e,t,i)=>{this.log(`Timeout loading steering manifest (${t.url})`),this.scheduleRefresh(this.uri||t.url)}};this.log(`Requesting steering manifest: ${s}`),this.loader.load(r,n,l)}scheduleRefresh(e,t=1e3*this.timeToLoad){this.clearTimeout(),this.reloadTimer=self.setTimeout((()=>{var t;const i=null==(t=this.hls)?void 0:t.media;!i||i.ended?this.scheduleRefresh(e,1e3*this.timeToLoad):this.loadSteeringManifest(e)}),t)}}});function DA(e){return e&&"object"==typeof e?Array.isArray(e)?e.map(DA):Object.keys(e).reduce(((t,i)=>(t[i]=DA(e[i]),t)),{}):e}function RA(e){const t=e.loader;if(t!==EA&&t!==wA)Uc.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1;else{(function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1})()&&(e.loader=EA,e.progressive=!0,e.enableSoftwareAES=!0,Uc.log("[config]: Progressive streaming enabled, using FetchLoader"))}}let PA;class IA extends Uf{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Dc.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Dc.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Dc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Dc.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Dc.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(Dc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Dc.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Dc.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Dc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Dc.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Dc.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach((e=>{e.loadError=0,e.fragmentError=0})),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,s=[],r={},o={};let a=!1,n=!1,l=!1;t.levels.forEach((e=>{var t,d;const h=e.attrs;let{audioCodec:c,videoCodec:u}=e;-1!==(null==(t=c)?void 0:t.indexOf("mp4a.40.34"))&&(PA||(PA=/chrome|firefox/i.test(navigator.userAgent)),PA&&(e.audioCodec=c=void 0)),c&&(e.audioCodec=c=Ap(c,i)),0===(null==(d=u)?void 0:d.indexOf("avc1"))&&(u=e.videoCodec=function(e){const t=e.split(",");for(let e=0;e2){let s=i.shift()+".";s+=parseInt(i.shift()).toString(16),s+=("000"+parseInt(i.shift()).toString(16)).slice(-4),t[e]=s}}return t.join(",")}(u));const{width:p,height:f,unknownCodecs:m}=e;if(a||(a=!(!p||!f)),n||(n=!!u),l||(l=!!c),null!=m&&m.length||c&&!cp(c,"audio",i)||u&&!cp(u,"video",i))return;const{CODECS:g,"FRAME-RATE":y,"HDCP-LEVEL":A,"PATHWAY-ID":b,RESOLUTION:v,"VIDEO-RANGE":_}=h,w=`${`${b||"."}-`}${e.bitrate}-${v}-${y}-${g}-${_}-${A}`;if(r[w])if(r[w].uri===e.url||e.attrs["PATHWAY-ID"])r[w].addGroupId("audio",h.AUDIO),r[w].addGroupId("text",h.SUBTITLES);else{const t=o[w]+=1;e.attrs["PATHWAY-ID"]=new Array(t+1).join(".");const i=new cf(e);r[w]=i,s.push(i)}else{const t=new cf(e);r[w]=t,o[w]=1,s.push(t)}})),this.filterAndSortMediaOptions(s,t,a,n,l)}filterAndSortMediaOptions(e,t,i,s,r){let o=[],a=[],n=e;if((i||s)&&r&&(n=n.filter((({videoCodec:e,videoRange:t,width:i,height:s})=>{return(!!e||!(!i||!s))&&(!!(r=t)&&of.indexOf(r)>-1);var r}))),0===n.length)return void Promise.resolve().then((()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const e=new Error("no level with compatible codecs found in manifest");this.hls.trigger(Dc.ERROR,{type:Rc.MEDIA_ERROR,details:Pc.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:e,reason:e.message})}}));if(t.audioTracks){const{preferManagedMediaSource:e}=this.hls.config;o=t.audioTracks.filter((t=>!t.audioCodec||cp(t.audioCodec,"audio",e))),BA(o)}t.subtitles&&(a=t.subtitles,BA(a));const l=n.slice(0);n.sort(((e,t)=>{if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return of.indexOf(e.videoRange)-of.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){const i=fp(e.videoCodec),s=fp(t.videoCodec);if(i!==s)return s-i}if(e.uri===t.uri&&e.codecSet!==t.codecSet){const i=mp(e.codecSet),s=mp(t.codecSet);if(i!==s)return s-i}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0}));let d=l[0];if(this.steering&&(n=this.steering.filterParsedLevels(n),n.length!==l.length))for(let e=0;ei&&i===xA.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=e)}break}const c=r&&!s,u={levels:n,audioTracks:o,subtitleTracks:a,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:s,altAudio:!c&&o.some((e=>!!e.url))};this.hls.trigger(Dc.MANIFEST_PARSED,u),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return 0===this._levels.length?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(0===t.length)return;if(e<0||e>=t.length){const i=new Error("invalid level idx"),s=e<0;if(this.hls.trigger(Dc.ERROR,{type:Rc.OTHER_ERROR,details:Pc.LEVEL_SWITCH_ERROR,level:e,fatal:s,error:i,reason:i.message}),s)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,s=this.currentLevel,r=s?s.attrs["PATHWAY-ID"]:void 0,o=t[e],a=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,i===e&&o.details&&s&&r===a)return;this.log(`Switching to level ${e} (${o.height?o.height+"p ":""}${o.videoRange?o.videoRange+" ":""}${o.codecSet?o.codecSet+" ":""}@${o.bitrate})${a?" with Pathway "+a:""} from level ${i}${r?" with Pathway "+r:""}`);const n={level:e,attrs:o.attrs,details:o.details,bitrate:o.bitrate,averageBitrate:o.averageBitrate,maxBitrate:o.maxBitrate,realBitrate:o.realBitrate,width:o.width,height:o.height,codecSet:o.codecSet,audioCodec:o.audioCodec,videoCodec:o.videoCodec,audioGroups:o.audioGroups,subtitleGroups:o.subtitleGroups,loaded:o.loaded,loadError:o.loadError,fragmentError:o.fragmentError,name:o.name,id:o.id,uri:o.uri,url:o.url,urlId:0,audioGroupIds:o.audioGroupIds,textGroupIds:o.textGroupIds};this.hls.trigger(Dc.LEVEL_SWITCHING,n);const l=o.details;if(!l||l.live){const e=this.switchParams(o.uri,null==s?void 0:s.details,l);this.loadPlaylist(e)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(void 0===this._startLevel){const e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){!t.fatal&&t.context&&t.context.type===Bp&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(void 0!==t&&t.type===Up){const e=t.elementaryStreams;if(!Object.keys(e).some((t=>!!e[t])))return;const i=this._levels[t.level];null!=i&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var i;const{level:s,details:r}=t,o=this._levels[s];var a;if(!o)return this.warn(`Invalid level index ${s}`),void(null!=(a=t.deliveryDirectives)&&a.skip&&(r.deltaUpdateFailed=!0));s===this.currentLevelIndex?(0===o.fragmentError&&(o.loadError=0),this.playlistLoaded(s,t,o.details)):null!=(i=t.deliveryDirectives)&&i.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){let s=i.uri;if(e)try{s=e.addDirectives(s)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}const r=i.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${void 0!==(null==e?void 0:e.msn)?" at sn "+e.msn+" part "+e.part:""} with${r?" Pathway "+r:""} ${s}`),this.clearTimer(),this.hls.trigger(Dc.LEVEL_LOADING,{url:s,level:t,pathwayId:i.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const i=this._levels.filter(((t,i)=>i!==e||(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach((e=>e.level=-1))),!1)));vf(i),this._levels=i,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(Dc.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(Dc.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function BA(e){const t={};e.forEach((e=>{const i=e.groupId||"";e.id=t[i]=t[i]||0,t[i]++}))}class MA{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyUriToKeyInfo){const s=this.keyUriToKeyInfo[i].loader;if(s){var t;if(e&&e!==(null==(t=s.context)?void 0:t.frag.type))return;s.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=Pc.KEY_LOAD_ERROR,i,s,r){return new mm({type:Rc.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:i,networkDetails:s})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:s}=e;for(let e=0;e{r.setKeyFormat(e)}));break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then((t=>this.loadInternal(e,t))):this.loadInternal(e)}loadInternal(e,t){var i,s;t&&e.setKeyFormat(t);const r=e.decryptdata;if(!r){const i=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,Pc.KEY_LOAD_ERROR,i))}const o=r.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,Pc.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));let a=this.keyUriToKeyInfo[o];if(null!=(i=a)&&i.decryptdata.key)return r.key=a.decryptdata.key,Promise.resolve({frag:e,keyInfo:a});var n;if(null!=(s=a)&&s.keyLoadPromise)switch(null==(n=a.mediaKeySessionContext)?void 0:n.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return a.keyLoadPromise.then((t=>(r.key=t.keyInfo.decryptdata.key,{frag:e,keyInfo:a})))}switch(a=this.keyUriToKeyInfo[o]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===r.keyFormat?this.loadKeyHTTP(a,e):this.loadKeyEME(a,e);case"AES-128":return this.loadKeyHTTP(a,e);default:return Promise.reject(this.createKeyLoadError(e,Pc.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const t=this.emeController.loadKey(i);if(t)return(e.keyLoadPromise=t.then((t=>(e.mediaKeySessionContext=t,i)))).catch((t=>{throw e.keyLoadPromise=null,t}))}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,s=new(0,i.loader)(i);return t.keyLoader=e.loader=s,e.keyLoadPromise=new Promise(((r,o)=>{const a={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},n=i.keyLoadPolicy.default,l={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(e,t,i,s)=>{const{frag:a,keyInfo:n,url:l}=i;if(!a.decryptdata||n!==this.keyUriToKeyInfo[l])return o(this.createKeyLoadError(a,Pc.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),s));n.decryptdata.key=a.decryptdata.key=new Uint8Array(e.data),a.keyLoader=null,n.loader=null,r({frag:a,keyInfo:n})},onError:(e,i,s,r)=>{this.resetLoader(i),o(this.createKeyLoadError(t,Pc.KEY_LOAD_ERROR,new Error(`HTTP Error ${e.code} loading key ${e.text}`),s,Sc({url:a.url,data:void 0},e)))},onTimeout:(e,i,s)=>{this.resetLoader(i),o(this.createKeyLoadError(t,Pc.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),s))},onAbort:(e,i,s)=>{this.resetLoader(i),o(this.createKeyLoadError(t,Pc.INTERNAL_ABORTED,new Error("key loading aborted"),s))}};s.load(a,l,d)}))}resetLoader(e){const{frag:t,keyInfo:i,url:s}=e,r=i.loader;t.keyLoader===r&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[s],r&&r.destroy()}}function FA(){return self.SourceBuffer||self.WebKitSourceBuffer}function UA(){if(!dp())return!1;const e=FA();return!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove}class OA{constructor(e,t,i,s){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=s}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:i,media:s,stalled:r}=this;if(null===s)return;const{currentTime:o,seeking:a}=s,n=this.seeking&&!a,l=!this.seeking&&a;if(this.seeking=a,o!==e){if(this.moved=!0,a||(this.nudgeRetry=0),null!==r){if(this.stallReported){const e=self.performance.now()-r;Uc.warn(`playback not stuck anymore @${o}, after ${Math.round(e)}ms`),this.stallReported=!1}this.stalled=null}return}if(l||n)return void(this.stalled=null);if(s.paused&&!a||s.ended||0===s.playbackRate||!rm.getBuffered(s).length)return void(this.nudgeRetry=0);const d=rm.bufferInfo(s,o,0),h=d.nextStart||0;if(a){const e=d.len>2,i=!h||t&&t.start<=o||h-o>2&&!this.fragmentTracker.getPartialFragment(o);if(e||i)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var c;if(!(d.len>0)&&!h)return;const e=Math.max(h,d.start||0)-o,t=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,i=(null==t||null==(c=t.details)?void 0:c.live)?2*t.details.targetduration:2,r=this.fragmentTracker.getPartialFragment(o);if(e>0&&(e<=i||r))return void(s.paused||this._trySkipBufferHole(r))}const u=self.performance.now();if(null===r)return void(this.stalled=u);const p=u-r;if(!a&&p>=250&&(this._reportStall(d),!this.media))return;const f=rm.bufferInfo(s,o,i.maxBufferHole);this._tryFixBufferStall(f,p)}_tryFixBufferStall(e,t){const{config:i,fragmentTracker:s,media:r}=this;if(null===r)return;const o=r.currentTime,a=s.getPartialFragment(o);if(a){if(this._trySkipBufferHole(a)||!this.media)return}(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-o1e3*i.highBufferWatchdogPeriod&&(Uc.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:i,stallReported:s}=this;if(!s&&i){this.stallReported=!0;const s=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${JSON.stringify(e)})`);Uc.warn(s.message),t.trigger(Dc.ERROR,{type:Rc.MEDIA_ERROR,details:Pc.BUFFER_STALLED_ERROR,fatal:!1,error:s,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:i,media:s}=this;if(null===s)return 0;const r=s.currentTime,o=rm.bufferInfo(s,r,0),a=r0&&o.len<1&&s.readyState<3,d=a-r;if(d>0&&(n||l)){if(d>t.maxBufferHole){const{fragmentTracker:t}=this;let i=!1;if(0===r){const e=t.getAppendedFrag(0,Up);e&&a1?(e=0,this.bitrateTest=!0):e=i.firstAutoLevel),i.nextLoadLevel=e,this.level=i.loadLevel,this.loadedmetadata=!1}t>0&&-1===e&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=wm,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=_m}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Pm:{const{levels:e,level:t}=this,i=null==e?void 0:e[t],s=null==i?void 0:i.details;if(s&&(!s.live||this.levelLastLoaded===i)){if(this.waitForCdnTuneIn(s))break;this.state=wm;break}if(this.hls.nextLoadLevel!==this.level){this.state=wm;break}break}case Tm:{var e;const t=self.performance.now(),i=this.retryDate;if(!i||t>=i||null!=(e=this.media)&&e.seeking){const{levels:e,level:t}=this,i=null==e?void 0:e[t];this.resetStartWhenNotLoaded(i||null),this.state=wm}}}this.state===wm&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:s}=this;if(null===t||!s&&(this.startFragRequested||!e.config.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;const r=e.nextLoadLevel;if(null==i||!i[r])return;const o=i[r],a=this.getMainFwdBufferInfo();if(null===a)return;const n=this.getLevelDetails();if(n&&this._streamEnded(a,n)){const e={};return this.altAudio&&(e.type="video"),this.hls.trigger(Dc.BUFFER_EOS,e),void(this.state=xm)}e.loadLevel!==r&&-1===e.manualLevel&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;const l=o.details;if(!l||this.state===Pm||l.live&&this.levelLastLoaded!==o)return this.level=r,void(this.state=Pm);const d=a.len,h=this.getMaxBufferLength(o.maxBitrate);if(d>=h)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const c=this.backtrackFragment?this.backtrackFragment.start:a.end;let u=this.getNextFragment(c,l);if(this.couldBacktrack&&!this.fragPrevious&&u&&"initSegment"!==u.sn&&this.fragmentTracker.getState(u)!==Zf){var p;const e=(null!=(p=this.backtrackFragment)?p:u).sn-l.startSN,t=l.fragments[e-1];t&&u.cc===t.cc&&(u=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(u&&this.isLoopLoading(u,c)){if(!u.gap){const e=this.audioOnly&&!this.altAudio?$c:Vc,t=(e===Vc?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,Up)}u=this.getNextFragmentLoopLoading(u,l,a,Up,h)}u&&(!u.initSegment||u.initSegment.data||this.bitrateTest||(u=u.initSegment),this.loadFragment(u,o,c))}loadFragment(e,t,i){const s=this.fragmentTracker.getState(e);this.fragCurrent=e,s===Yf||s===Xf?"initSegment"===e.sn?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,i)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Up)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(null!=t&&t.readyState){let i;const s=this.getAppendedFrag(t.currentTime);s&&s.start>1&&this.flushMainBuffer(0,s.start-1);const r=this.getLevelDetails();if(null!=r&&r.live){const e=this.getMainFwdBufferInfo();if(!e||e.len<2*r.targetduration)return}if(!t.paused&&e){const t=e[this.hls.nextLoadLevel],s=this.fragLastKbps;i=s&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*s)+1:0}else i=0;const o=this.getBufferedFrag(t.currentTime+i);if(o){const e=this.followingBufferedFrag(o);if(e){this.abortCurrentFrag();const t=e.maxStartPTS?e.maxStartPTS:e.start,i=e.duration,s=Math.max(o.end,t+Math.min(Math.max(i-this.config.maxFragLookUpTolerance,i*(this.couldBacktrack?.5:.125)),i*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(s,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case Sm:case Em:case Tm:case Lm:case Cm:this.state=wm}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new OA(this.config,i,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;Lc(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const i=this.getMainFwdBufferInfo();null!==i&&0!==i.len?this.tick():this.warn(`Main forward buffer length on "seeked" event ${i?i.len:"empty"})`)}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(Dc.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let i=!1,s=!1;t.levels.forEach((e=>{const t=e.audioCodec;t&&(i=i||-1!==t.indexOf("mp4a.40.2"),s=s||-1!==t.indexOf("mp4a.40.5"))})),this.audioCodecSwitch=i&&s&&!function(){var e;const t=FA();return"function"==typeof(null==t||null==(e=t.prototype)?void 0:e.changeType)}(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==wm)return;const s=i[t.level];(!s.details||s.details.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(s.details))&&(this.state=Pm)}onLevelLoaded(e,t){var i;const{levels:s}=this,r=t.level,o=t.details,a=o.totalduration;if(!s)return void this.warn(`Levels were reset while loading level ${r}`);this.log(`Level ${r} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${a}`);const n=s[r],l=this.fragCurrent;!l||this.state!==Em&&this.state!==Tm||l.level!==t.level&&l.loader&&this.abortCurrentFrag();let d=0;if(o.live||null!=(i=n.details)&&i.live){var h;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;d=this.alignPlaylists(o,n.details,null==(h=this.levelLastLoaded)?void 0:h.details)}if(n.details=o,this.levelLastLoaded=n,this.hls.trigger(Dc.LEVEL_UPDATED,{details:o,level:r}),this.state===Pm){if(this.waitForCdnTuneIn(o))return;this.state=wm}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,d),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:s,payload:r}=e,{levels:o}=this;if(!o)return void this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);const a=o[i.level],n=a.details;if(!n)return this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),void this.fragmentTracker.removeFragment(i);const l=a.videoCodec,d=n.PTSKnown||!n.live,h=null==(t=i.initSegment)?void 0:t.data,c=this._getAudioCodec(a),u=this.transmuxer=this.transmuxer||new Ng(this.hls,Up,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=s?s.index:-1,f=-1!==p,m=new om(i.level,i.sn,i.stats.chunkCount,r.byteLength,p,f),g=this.initPTS[i.cc];u.push(r,h,c,l,i,s,n.totalduration,d,m,g)}onAudioTrackSwitching(e,t){const i=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const e=this.fragCurrent;e&&(this.log("Switching to main audio track, cancel main fragment load"),e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const e=this.hls;i&&(e.trigger(Dc.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),e.trigger(Dc.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=t.id,s=!!this.hls.audioTracks[i].url;if(s){const e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=e)}this.altAudio=s,this.tick()}onBufferCreated(e,t){const i=t.tracks;let s,r,o=!1;for(const e in i){const t=i[e];if("main"===t.id){if(r=e,s=t,"video"===e){const t=i[e];t&&(this.videoBuffer=t.buffer)}}else o=!0}o&&s?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:s}=t;if(i&&i.type!==Up)return;if(this.fragContextChanged(i))return this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),void(this.state===Cm&&(this.state=wm));const r=s?s.stats:i.stats;this.fragLastKbps=Math.round(8*r.total/(r.buffering.end-r.loading.first)),"initSegment"!==i.sn&&(this.fragPrevious=i),this.fragBufferedComplete(i,s)}onError(e,t){var i;if(t.fatal)this.state=Dm;else switch(t.details){case Pc.FRAG_GAP:case Pc.FRAG_PARSING_ERROR:case Pc.FRAG_DECRYPT_ERROR:case Pc.FRAG_LOAD_ERROR:case Pc.FRAG_LOAD_TIMEOUT:case Pc.KEY_LOAD_ERROR:case Pc.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Up,t);break;case Pc.LEVEL_LOAD_ERROR:case Pc.LEVEL_LOAD_TIMEOUT:case Pc.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Pm||(null==(i=t.context)?void 0:i.type)!==Bp||(this.state=wm);break;case Pc.BUFFER_APPEND_ERROR:case Pc.BUFFER_FULL_ERROR:if(!t.parent||"main"!==t.parent)return;if(t.details===Pc.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case Pc.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}checkBuffer(){const{media:e,gapController:t}=this;if(e&&t&&e.readyState){if(this.loadedmetadata||!rm.getBuffered(e).length){const e=this.state!==wm?this.fragCurrent:null;t.poll(this.lastCurrentTime,e)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=wm,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==$c||this.audioOnly&&!this.altAudio){const e=(t===Vc?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(e,t,Up),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t0&&(r{const{hls:s}=this;if(!i||this.fragContextChanged(e))return;t.fragmentError=0,this.state=wm,this.startFragRequested=!1,this.bitrateTest=!1;const r=e.stats;r.parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),s.trigger(Dc.FRAG_LOADED,i),e.bitrateTest=!1}))}_handleTransmuxComplete(e){var t;const i="main",{hls:s}=this,{remuxResult:r,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a)return void this.resetWhenMissingContext(o);const{frag:n,part:l,level:d}=a,{video:h,text:c,id3:u,initSegment:p}=r,{details:f}=d,m=this.altAudio?void 0:r.audio;if(this.fragContextChanged(n))this.fragmentTracker.removeFragment(n);else{if(this.state=Lm,p){if(null!=p&&p.tracks){const e=n.initSegment||n;this._bufferInitSegment(d,p.tracks,e,o),s.trigger(Dc.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:p.tracks})}const e=p.initPTS,t=p.timescale;Lc(e)&&(this.initPTS[n.cc]={baseTime:e,timescale:t},s.trigger(Dc.INIT_PTS_FOUND,{frag:n,id:i,initPTS:e,timescale:t}))}if(h&&f&&"initSegment"!==n.sn){const e=f.fragments[n.sn-1-f.startSN],t=n.sn===f.startSN,i=!e||n.cc>e.cc;if(!1!==r.independent){const{startPTS:e,endPTS:s,startDTS:r,endDTS:a}=h;if(l)l.elementaryStreams[h.type]={startPTS:e,endPTS:s,startDTS:r,endDTS:a};else if(h.firstKeyFrame&&h.independent&&1===o.id&&!i&&(this.couldBacktrack=!0),h.dropped&&h.independent){const r=this.getMainFwdBufferInfo(),o=(r?r.end:this.getLoadPosition())+this.config.maxBufferHole,l=h.firstKeyFramePTS?h.firstKeyFramePTS:e;if(!t&&o2&&(n.gap=!0);n.setElementaryStreamInfo(h.type,e,s,r,a),this.backtrackFragment&&(this.backtrackFragment=n),this.bufferFragmentData(h,n,l,o,t||i)}else{if(!t&&!i)return void this.backtrack(n);n.gap=!0}}if(m){const{startPTS:e,endPTS:t,startDTS:i,endDTS:s}=m;l&&(l.elementaryStreams[$c]={startPTS:e,endPTS:t,startDTS:i,endDTS:s}),n.setElementaryStreamInfo($c,e,t,i,s),this.bufferFragmentData(m,n,l,o)}if(f&&null!=u&&null!=(t=u.samples)&&t.length){const e={id:i,frag:n,details:f,samples:u.samples};s.trigger(Dc.FRAG_PARSING_METADATA,e)}if(f&&c){const e={id:i,frag:n,details:f,samples:c.samples};s.trigger(Dc.FRAG_PARSING_USERDATA,e)}}}_bufferInitSegment(e,t,i,s){if(this.state!==Lm)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:r,video:o,audiovideo:a}=t;if(r){let t=e.audioCodec;const i=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){t&&(t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");const e=r.metadata;e&&"channelCount"in e&&1!==(e.channelCount||1)&&-1===i.indexOf("firefox")&&(t="mp4a.40.5")}t&&-1!==t.indexOf("mp4a.40.5")&&-1!==i.indexOf("android")&&"audio/mpeg"!==r.container&&(t="mp4a.40.2",this.log(`Android: force audio codec to ${t}`)),e.audioCodec&&e.audioCodec!==t&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${t}"`),r.levelCodec=t,r.id="main",this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${t||""}/${e.audioCodec||""}/${r.codec}]`)}o&&(o.levelCodec=e.videoCodec,o.id="main",this.log(`Init video buffer, container:${o.container}, codecs[level/parsed]=[${e.videoCodec||""}/${o.codec}]`)),a&&this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${e.codecs}/${a.codec}]`),this.hls.trigger(Dc.BUFFER_CODECS,t),Object.keys(t).forEach((e=>{const r=t[e].initSegment;null!=r&&r.byteLength&&this.hls.trigger(Dc.BUFFER_APPENDING,{type:e,data:r,frag:i,part:null,chunkMeta:s,parent:i.type})})),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,Up)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=wm}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&!1===e.seeking){const i=e.currentTime;if(rm.isBuffered(e,i)?t=this.getAppendedFrag(i):rm.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const e=this.fragPlaying,i=t.level;e&&t.sn===e.sn&&e.level===i||(this.fragPlaying=t,this.hls.trigger(Dc.FRAG_CHANGED,{frag:t}),e&&e.level===i||this.hls.trigger(Dc.LEVEL_SWITCHED,{level:i}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,i=this.currentFrag;if(i&&Lc(t)&&Lc(i.programDateTime)){const e=i.programDateTime+1e3*(t-i.start);return new Date(e)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class jA{static get version(){return"1.5.13"}static isMSESupported(){return UA()}static isSupported(){return function(){if(!UA())return!1;const e=dp();return"function"==typeof(null==e?void 0:e.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some((t=>e.isTypeSupported(pp(t,"video"))))||["mp4a.40.2","fLaC"].some((t=>e.isTypeSupported(pp(t,"audio")))))}()}static getMediaSource(){return dp()}static get Events(){return Dc}static get ErrorTypes(){return Rc}static get ErrorDetails(){return Pc}static get DefaultConfig(){return jA.defaultConfig?jA.defaultConfig:xA}static set DefaultConfig(e){jA.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new Og,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,function(e,t){if("object"==typeof console&&!0===e||"object"==typeof e){Fc(e,"debug","log","info","warn","error");try{Mc.log(`Debug logs enabled for "${t}" in hls.js version 1.5.13`)}catch(e){Mc=Bc}}else Mc=Bc}(e.debug||!1,"Hls instance");const t=this.config=function(e,t){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=DA(e),s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach((e=>{const r=`${"level"===e?"playlist":e}LoadPolicy`,o=void 0===t[r],a=[];s.forEach((s=>{const n=`${e}Loading${s}`,l=t[n];if(void 0!==l&&o){a.push(n);const e=i[r].default;switch(t[r]={default:e},s){case"TimeOut":e.maxLoadTimeMs=l,e.maxTimeToFirstByteMs=l;break;case"MaxRetry":e.errorRetry.maxNumRetry=l,e.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":e.errorRetry.retryDelayMs=l,e.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":e.errorRetry.maxRetryDelayMs=l,e.timeoutRetry.maxRetryDelayMs=l}}})),a.length&&Uc.warn(`hls.js config: "${a.join('", "')}" setting(s) are deprecated, use "${r}": ${JSON.stringify(t[r])}`)})),Sc(Sc({},i),t)}(jA.DefaultConfig,e);this.userConfig=e,t.progressive&&RA(t);const{abrController:i,bufferController:s,capLevelController:r,errorController:o,fpsController:a}=t,n=new o(this),l=this.abrController=new i(this),d=this.bufferController=new s(this),h=this.capLevelController=new r(this),c=new a(this),u=new Wp(this),p=new tf(this),f=t.contentSteeringController,m=f?new f(this):null,g=this.levelController=new IA(this,m),y=new em(this),A=new MA(this.config),b=this.streamController=new NA(this,y,A);h.setStreamController(b),c.setStreamController(b);const v=[u,g,b];m&&v.splice(1,0,m),this.networkControllers=v;const _=[l,d,h,c,p,y];this.audioTrackController=this.createController(t.audioTrackController,v);const w=t.audioStreamController;w&&v.push(new w(this,y,A)),this.subtitleTrackController=this.createController(t.subtitleTrackController,v);const S=t.subtitleStreamController;S&&v.push(new S(this,y,A)),this.createController(t.timelineController,_),A.emeController=this.emeController=this.createController(t.emeController,_),this.cmcdController=this.createController(t.cmcdController,_),this.latencyController=this.createController(sf,_),this.coreComponents=_,v.push(n);const E=n.onErrorOut;"function"==typeof E&&this.on(Dc.ERROR,E,n)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,s){this._emitter.off(e,t,i,s)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(Uc.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),!this.triggeringException){this.triggeringException=!0;const i=e===Dc.ERROR;this.trigger(Dc.ERROR,{type:Rc.OTHER_ERROR,details:Pc.INTERNAL_EXCEPTION,fatal:i,event:e,error:t}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){Uc.log("destroy"),this.trigger(Dc.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach((e=>e.destroy())),this.networkControllers.length=0,this.coreComponents.forEach((e=>e.destroy())),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){Uc.log("attachMedia"),this._media=e,this.trigger(Dc.MEDIA_ATTACHING,{media:e})}detachMedia(){Uc.log("detachMedia"),this.trigger(Dc.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,i=this.url,s=this.url=_c.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,Uc.log(`loadSource:${s}`),t&&i&&(i!==s||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(Dc.MANIFEST_LOADING,{url:e})}startLoad(e=-1){Uc.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach((t=>{t.startLoad(e)}))}stopLoad(){Uc.log("stopLoad"),this.started=!1,this.networkControllers.forEach((e=>{e.stopLoad()}))}resumeBuffering(){this.started&&this.networkControllers.forEach((e=>{"fragmentLoader"in e&&e.startLoad(-1)}))}pauseBuffering(){this.networkControllers.forEach((e=>{"fragmentLoader"in e&&e.stopLoad()}))}swapAudioCodec(){Uc.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){Uc.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){Uc.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){Uc.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){Uc.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){Uc.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return-1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){Uc.log(`set startLevel:${e}`),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(Uc.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){(function(e){return rf.indexOf(e)>-1})(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return-1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let s=0;s=t)return s;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let s;if(s=-1===t&&null!=e&&e.length?e.length-1:t,i)for(let t=s;t--;){const s=e[t].attrs["HDCP-LEVEL"];if(s&&s<=i)return t}return s}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return null==(t=this.audioTrackController)?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return null==(t=this.subtitleTrackController)||t.setSubtitleOption(e),null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return!!e&&e.subtitleDisplay}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}jA.defaultConfig=void 0;class GA extends o{constructor(e){super(),this.player=e,this.TAG_NAME="HlsDecoder",e._opt,this.canVideoPlay=!1,this.$videoElement=null,this.canvasRenderInterval=null,this.bandwidthEstimateInterval=null,this.fpsInterval=null,this.hlsFps=0,this.hlsPrevFrams=0,this.isInitInfo=!1,this.eventsDestroy=[],this.supportVideoFrameCallbackHandle=null,this.player.isHlsCanVideoPlay()?(this.$videoElement=this.player.video.$videoElement,this.canVideoPlay=!0):jA.isSupported()?(this.$videoElement=this.player.video.$videoElement,this.hls=new jA({}),this._initHls(),this._bindEvents()):this.player.debugError(this.TAG_NAME,"init hls error ,not support "),this.player.debugLog(this.TAG_NAME,"init")}destroy(){return new Promise(((e,t)=>{if(this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.hls&&(this.hls.destroy(),this.hls=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this.isInitInfo=!1,this._stopCanvasRender(),this._stopBandwidthEstimateInterval(),this._stopFpsInterval(),this.player._opt.useCanvasRender&&this.$videoElement){this.$videoElement.pause&&(this.$videoElement.pause(),this.$videoElement.muted=!0),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"));try{this.$videoElement.load()}catch(e){}}this.$videoElement=null,this.hlsFps=0,this.player.debugLog(this.TAG_NAME,"destroy"),setTimeout((()=>{e()}),0)}))}checkHlsBufferedDelay(){const e=this.$videoElement;let t=0;const i=e.buffered,s=i.length?i.end(i.length-1):0;return t=s-e.currentTime,t<0&&(this.player.debugWarn(this.TAG_NAME,`checkHlsBufferedDelay ${t} < 0, and buffered is ${s} ,currentTime is ${e.currentTime} , try to seek ${e.currentTime} to ${s}`),e.currentTime=s,t=0),t}getFps(){return this.hlsFps}_startCanvasRender(){Ta()?this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)):(this._stopCanvasRender(),this.canvasRenderInterval=setInterval((()=>{this.player.video.render({$video:this.$videoElement,ts:parseInt(1e3*this.$videoElement.currentTime,10)||0})}),40))}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())return void this.player.debugLog(this.TAG_NAME,"videoFrameCallback() player is destroyed");const i=parseInt(1e3*Math.max(t.mediaTime,this.$videoElement.currentTime),10)||0;this.player.video.render({$video:this.$videoElement,ts:i}),this.player.handleRender(),this.player.updateStats({dts:i}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}_startBandwidthEstimateInterval(){this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((()=>{let e=0;this.hls.bandwidthEstimate&&(e=this.hls.bandwidthEstimate),this.player.emit(at.kBps,(e/1024/8/10).toFixed(2))}),1e3)}_stopBandwidthEstimateInterval(){this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}_startFpsInterval(){this._stopCanvasRender(),this.fpsInterval=setInterval((()=>{if(this.$videoElement)if(Zo(this.$videoElement.getVideoPlaybackQuality)){const e=this.$videoElement.getVideoPlaybackQuality();this.hlsFps=e.totalVideoFrames-this.hlsPrevFrams,this.hlsPrevFrams=e.totalVideoFrames}else{const e=this.$videoElement.webkitDecodedFrameCount||0;this.hlsFps=e-this.hlsPrevFrams,this.hlsPrevFrams=e}}),1e3)}_stopFpsInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_initHls(){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.$videoElement.muted=!0,bo()&&(this.$videoElement.style.position="absolute"),this.initVideoEvents()),this.hls.attachMedia(this.$videoElement)}_bindEvents(){const e=this.player,{proxy:t}=this.player.events;this.hls;const i=this.$videoElement,s=Ta(),r=t(i,es,(t=>{if(this.hls){const i=parseInt(t.timeStamp,10);this.player._opt.useCanvasRender&&ya(s)&&e.updateStats({ts:i,dts:i})}}));this.eventsDestroy.push(r),this._startBandwidthEstimateInterval(),this._startFpsInterval(),this.hls.on(jA.Events.ERROR,((e,t)=>{if(t.fatal)switch(t.type){case jA.ErrorTypes.NETWORK_ERROR:this.player.debugWarn(this.TAG_NAME,"fatal network error encountered, try to recover"),this.hls.startLoad();break;case jA.ErrorTypes.MEDIA_ERROR:this.player.debugWarn(this.TAG_NAME,"fatal media error encountered, try to recover"),this.hls.recoverMediaError()}})),this.hls.on(jA.Events.MEDIA_ATTACHING,(()=>{})),this.hls.on(jA.Events.MEDIA_ATTACHED,(()=>{})),this.hls.on(jA.Events.MEDIA_DETACHING,(()=>{})),this.hls.on(jA.Events.MEDIA_DETACHED,(()=>{})),this.hls.on(jA.Events.BUFFER_RESET,(()=>{})),this.hls.on(jA.Events.BUFFER_CODECS,(()=>{})),this.hls.on(jA.Events.BUFFER_CREATED,(()=>{})),this.hls.on(jA.Events.BUFFER_APPENDING,((e,t)=>{this.player.debugLog(this.TAG_NAME,"BUFFER_APPENDING",t.type)})),this.hls.on(jA.Events.BUFFER_APPENDED,(()=>{})),this.hls.on(jA.Events.BUFFER_EOS,(()=>{})),this.hls.on(jA.Events.BUFFER_FLUSHING,(()=>{})),this.hls.on(jA.Events.BUFFER_FLUSHED,(()=>{})),this.hls.on(jA.Events.MANIFEST_LOADING,(()=>{this.player.debugLog(this.TAG_NAME,"MANIFEST_LOADING 开始加载playlist m3u8资源")})),this.hls.on(jA.Events.MANIFEST_LOADED,((e,t)=>{this.player.debugLog(this.TAG_NAME,"MANIFEST_LOADED playlist m3u8文件加载完成",t.url)})),this.hls.on(jA.Events.MANIFEST_PARSED,(()=>{this.player.debugLog(this.TAG_NAME,"MANIFEST_PARSED playlist m3u8解析完成"),e._times.demuxStart||(e._times.demuxStart=ro())})),this.hls.on(jA.Events.LEVEL_LOADING,(()=>{})),this.hls.on(jA.Events.LEVEL_LOADED,((e,t)=>{})),this.hls.on(jA.Events.FRAG_LOADING,(()=>{})),this.hls.on(jA.Events.FRAG_LOADED,((t,i)=>{e._times.decodeStart||(e._times.decodeStart=ro())})),this.hls.on(jA.Events.BUFFER_APPENDING,(()=>{e._times.videoStart||(e._times.videoStart=ro(),e.handlePlayToRenderTimes())})),this.hls.on(jA.Events.FRAG_DECRYPTED,(()=>{})),this.hls.on(jA.Events.KEY_LOADING,(()=>{})),this.hls.on(jA.Events.KEY_LOADING,(()=>{})),this.hls.on(jA.Events.FPS_DROP,(e=>{})),this.hls.on(jA.Events.FPS_DROP_LEVEL_CAPPING,(e=>{})),this.hls.on(jA.Events.FRAG_PARSING_INIT_SEGMENT,((e,t)=>{this.player.debugLog(this.TAG_NAME,"FRAG_PARSING_INIT_SEGMENT",t);const i=!!(t&&t.tracks&&t.tracks.audio),s=!!(t&&t.tracks&&t.tracks.video);if(i&&t.tracks.audio){let e=t.tracks.audio;const i=e.metadata&&e.metadata.channelCount?e.metadata.channelCount:0,s=e.codec;this.player.audio&&this.player.audio.updateAudioInfo({encType:s,channels:i,sampleRate:44100})}if(s&&t.tracks.video){let e=t.tracks.video;const i={encTypeCode:-1!==e.codec.indexOf("avc")?At:bt};e.metadata&&(i.width=e.metadata.width,i.height=e.metadata.height),this.player.video&&this.player.video.updateVideoInfo(i)}}))}initVideoPlay(e){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.initVideoEvents()),this.$videoElement.autoplay=!0,this.$videoElement.muted=!0,this.$videoElement.src=e}_initRenderSize(){this.isInitInfo||(this.player.video.updateVideoInfo({width:this.$videoElement.videoWidth,height:this.$videoElement.videoHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0)}initVideoEvents(){const{proxy:e}=this.player.events,t=e(this.$videoElement,Xi,(()=>{this.player.debugLog(this.TAG_NAME,"video canplay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video play"),this._startCanvasRender(),this._initRenderSize()})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video play error ",e)}))})),i=e(this.$videoElement,Zi,(()=>{this.player.debugLog(this.TAG_NAME,"video waiting")})),s=e(this.$videoElement,es,(e=>{const t=parseInt(e.timeStamp,10);this.player.handleRender(),this.player.updateStats({ts:t}),this.$videoElement.paused&&(this.player.debugWarn(this.TAG_NAME,"video is paused and next try to replay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video is paused and replay success")})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video is paused and replay error ",e)})))})),r=e(this.$videoElement,ts,(()=>{this.player.debugLog(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate)}));this.eventsDestroy.push(t,i,s,r)}loadSource(e){return new Promise(((t,i)=>{this.canVideoPlay?(this.initVideoPlay(e),t()):this.hls.on(jA.Events.MEDIA_ATTACHED,(()=>{this.hls.loadSource(e),t()}))}))}}const WA=2097152,zA="fetch",$A="xhr",VA="arraybuffer",HA="text",JA="json",qA="real_time_speed",KA=Object.prototype.toString;function YA(e){if("[object Object]"!==KA.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function QA(e){if(!e||null===e[0]||void 0===e[0]||0===e[0]&&(null===e[1]||void 0===e[1]))return;let t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}function XA(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ZA(e,t){if(!e)return;if(!t)return e;let i;const s=Object.keys(t).map((e=>{if(i=t[e],null!=i)return Array.isArray(i)?e+="[]":i=[i],i.map((t=>{var i;return i=t,"[object Date]"===KA.call(i)?t=t.toISOString():function(e){return null!==e&&"object"==typeof e}(t)&&(t=JSON.stringify(t)),`${XA(e)}=${XA(t)}`})).join("&")})).filter(Boolean).join("&");if(s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}function eb(e,t,i,s,r,o,a,n,l,d,h){r=null!=r?parseFloat(r):null,s=parseInt(s||"0",10),Number.isNaN(s)&&(s=0);return{data:e,done:t,option:{range:l,vid:d,index:n,contentLength:s,age:r,startTime:o,firstByteTime:a,endTime:Date.now(),priOptions:h},response:i}}function tb(e,t){return Math.round(8*e*1e3/t/1024)}class ib extends Error{constructor(e,t,i,s){super(s),uh(this,"retryCount",0),uh(this,"isTimeout",!1),uh(this,"loaderType",zA),uh(this,"startTime",0),uh(this,"endTime",0),uh(this,"options",{}),this.url=e,this.request=t,this.response=i}}class sb extends o{constructor(e){super(),uh(this,"_abortController",null),uh(this,"_timeoutTimer",null),uh(this,"_reader",null),uh(this,"_response",null),uh(this,"_aborted",!1),uh(this,"_index",-1),uh(this,"_range",null),uh(this,"_receivedLength",0),uh(this,"_running",!1),uh(this,"_logger",null),uh(this,"_vid",""),uh(this,"_onProcessMinLen",0),uh(this,"_onCancel",null),uh(this,"_priOptions",null),uh(this,"TAG_NAME","FetchLoader"),this.player=e}load(e){var t;let{url:i,vid:s,timeout:r,responseType:o,onProgress:a,index:n,onTimeout:l,onCancel:d,range:h,transformResponse:c,request:u,params:p,logger:f,method:m,headers:g,body:y,mode:A,credentials:b,cache:v,redirect:_,referrer:w,referrerPolicy:S,onProcessMinLen:E,priOptions:T}=e;this._aborted=!1,this._onProcessMinLen=E,this._onCancel=d,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=n,this._range=h||[0,0],this._vid=s||i,this._priOptions=T||{};const k={method:m,headers:g,body:y,mode:A,credentials:b,cache:v,redirect:_,referrer:w,referrerPolicy:S,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal};let L=!1;clearTimeout(this._timeoutTimer),i=ZA(i,p);const C=QA(h);C&&(g=u?u.headers:k.headers=k.headers||(Headers?new Headers:{}),Headers&&g instanceof Headers?g.append("Range",C):g.Range=C),r&&(this._timeoutTimer=setTimeout((()=>{if(L=!0,this.cancel(),l){const e=new ib(i,k,null,"timeout");e.isTimeout=!0,l(e,{index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions})}}),r));const x=Date.now();return(Bo(n)||Bo(h))&&this.player.debugLog(this.TAG_NAME,"[fetch load start], index,",n,",range,",h),new Promise(((e,t)=>{fetch(u||i,u?void 0:k).then((async s=>{if(clearTimeout(this._timeoutTimer),this._response=s,this._aborted||!this._running)return;if(c&&(s=c(s,i)||s),!s.ok)throw new ib(i,k,s,"bad network response");const r=Date.now();let l;if(o===HA)l=await s.text(),this._running=!1;else if(o===JA)l=await s.json(),this._running=!1;else{if(a)return this.resolve=e,this.reject=t,void this._loadChunk(s,a,x,r);{l=await s.arrayBuffer(),l=new Uint8Array(l),this._running=!1;const e=Date.now()-x,t=tb(l.byteLength,e);this.emit(qA,{speed:t,len:l.byteLength,time:e,vid:this._vid,index:this._index,range:this._range,priOptions:this._priOptions})}}(Bo(n)||Bo(h))&&this.player.debugLog(this.TAG_NAME,"[fetch load end], index,",n,",range,",h),e(eb(l,!0,s,s.headers.get("Content-Length"),s.headers.get("age"),x,r,n,h,this._vid,this._priOptions))})).catch((e=>{var s;clearTimeout(this._timeoutTimer),this._running=!1,this._aborted&&!L||((e=e instanceof ib?e:new ib(i,k,null,null===(s=e)||void 0===s?void 0:s.message)).startTime=x,e.endTime=Date.now(),e.isTimeout=L,e.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},t(e))}))}))}async cancel(){if(!this._aborted){if(this._aborted=!0,this._running=!1,this._response){try{this._reader&&await this._reader.cancel()}catch(e){}this._response=this._reader=null}if(this._abortController){try{this._abortController.abort()}catch(e){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions})}}_loadChunk(e,t,i,s){if(!e.body||!e.body.getReader){this._running=!1;const t=new ib(e.url,"",e,"onProgress of bad response.body.getReader");return t.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(t)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(WA),this._writeIdx=0);const r=this._reader=e.body.getReader();let o,a,n;const l=async()=>{var d;a=Date.now();try{o=await r.read(),n=Date.now()}catch(e){return n=Date.now(),void(this._aborted||(this._running=!1,e.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this.reject(e)))}const h=(null===(d=this._range)||void 0===d?void 0:d.length)>0?this._range[0]:0,c=h+this._receivedLength;if(this._aborted)return this._running=!1,void t(void 0,!1,{range:[c,c],vid:this._vid,index:this._index,startTime:a,endTime:n,st:i,firstByteTime:s,priOptions:this._priOptions},e);const u=o.value?o.value.byteLength:0;let p;if(this._receivedLength+=u,this.player.debugLog(this.TAG_NAME,"【fetchLoader,onProgress call】,task,",this._range,", start,",c,", end,",h+this._receivedLength,", done,",o.done),this._onProcessMinLen>0){if(this._writeIdx+u>=this._onProcessMinLen||o.done)p=new Uint8Array(this._writeIdx+u),p.set(this._cache.slice(0,this._writeIdx),0),u>0&&p.set(o.value,this._writeIdx),this._writeIdx=0,this.player.debugLog(this.TAG_NAME,"【fetchLoader,onProgress enough】,done,",o.done,",len,",p.byteLength,", writeIdx,",this._writeIdx);else if(u>0&&this._writeIdx+u0){const e=new Uint8Array(this._writeIdx+u+2048);this.player.debugLog(this.TAG_NAME,"【fetchLoader,onProgress extra start】,size,",this._writeIdx+u+2048,", datalen,",u,", writeIdx,",this._writeIdx),e.set(this._cache.slice(0,this._writeIdx),0),u>0&&e.set(o.value,this._writeIdx),this._writeIdx+=u,delete this._cache,this._cache=e,this.player.debugLog(this.TAG_NAME,"【fetchLoader,onProgress extra end】,len,",u,", writeIdx,",this._writeIdx)}}else p=o.value;if((p&&p.byteLength>0||o.done)&&t(p,o.done,{range:[this._range[0]+this._receivedLength-(p?p.byteLength:0),this._range[0]+this._receivedLength],vid:this._vid,index:this._index,startTime:a,endTime:n,st:i,firstByteTime:s,priOptions:this._priOptions},e),o.done){const t=Date.now()-i,r=tb(this._receivedLength,t);this.emit(qA,{speed:r,len:this._receivedLength,time:t,vid:this._vid,index:this._index,range:this._range,priOptions:this._priOptions}),this._running=!1,this.player.debugLog(this.TAG_NAME,"[fetchLoader onProgress end],task,",this._range,",done,",o.done),this.resolve(eb(o,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),i,s,this._index,this._range,this._vid,this._priOptions))}else l()};l()}get receiveLen(){return this._receivedLength}get running(){return this._running}set running(e){this._running=e}static isSupported(){return!("undefined"==typeof fetch)}}class rb{constructor(e,t,i){uh(this,"TAG_NAME","Task"),this.promise=function(){let e,t;const i=new Promise(((i,s)=>{e=i,t=s}));return i.used=!1,i.resolve=function(){return i.used=!0,e(...arguments)},i.reject=function(){return i.used=!0,t(...arguments)},i}(),this.alive=!!t.onProgress,this._loaderType=e,this.player=i,this._loader=e===zA&&window.fetch?new sb(i):new ob(i),this._config=t,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=t.retryCheckFunc}exec(){const{retry:e,retryDelay:t,onRetryError:i,transformError:s,...r}=this._config,o=async()=>{try{const e=await this._loader.load(r);this.promise.resolve(e)}catch(a){if(this._loader.running=!1,this.player.debugLog(this.TAG_NAME,"[task request catch err]",a),this._canceled)return;a.loaderType=this._loaderType,a.retryCount=this._retryCount;let n=a;s&&(n=s(n)||n),i&&this._retryCount>0&&i(n,this._retryCount,{index:r.index,vid:r.vid,range:r.range,priOptions:r.priOptions}),this._retryCount++;let l=!0;if(this._retryCheckFunc&&(l=this._retryCheckFunc(a)),l&&this._retryCount<=e)return clearTimeout(this._retryTimer),this.player.debugLog(this.TAG_NAME,"[task request setTimeout],retry",this._retryCount,",retry range,",r.range),void(this._retryTimer=setTimeout(o,t));this.promise.reject(n)}};return o(),this.promise}async cancel(){return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,this._loader.cancel()}get running(){return this._loader&&this._loader.running}get loader(){return this._loader}}class ob extends o{constructor(e){super(),uh(this,"_xhr",null),uh(this,"_aborted",!1),uh(this,"_timeoutTimer",null),uh(this,"_range",null),uh(this,"_receivedLength",0),uh(this,"_url",null),uh(this,"_onProgress",null),uh(this,"_index",-1),uh(this,"_headers",null),uh(this,"_currentChunkSizeKB",384),uh(this,"_timeout",null),uh(this,"_xhr",null),uh(this,"_withCredentials",null),uh(this,"_startTime",-1),uh(this,"_loadCompleteResolve",null),uh(this,"_loadCompleteReject",null),uh(this,"_runing",!1),uh(this,"_logger",!1),uh(this,"_vid",""),uh(this,"_responseType",void 0),uh(this,"_credentials",void 0),uh(this,"_method",void 0),uh(this,"_transformResponse",void 0),uh(this,"_firstRtt",void 0),uh(this,"_onCancel",null),uh(this,"_priOptions",null),uh(this,"TAG_NAME","XhrLoader"),this.player=e}load(e){clearTimeout(this._timeoutTimer),this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this.player.debugLog(this.TAG_NAME,"【xhrLoader task】, range",this._range),this._url=ZA(e.url,e.params);const t=Date.now();return new Promise(((e,t)=>{this._loadCompleteResolve=e,this._loadCompleteReject=t,this._startLoad()})).catch((e=>{if(clearTimeout(this._timeoutTimer),this._runing=!1,!this._aborted)throw(e=e instanceof ib?e:new ib(this._url,this._request)).startTime=t,e.endTime=Date.now(),e.options={index:this._index,vid:this._vid,priOptions:this._priOptions},e}))}_startLoad(){let e=null;if(this._responseType===VA&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;const t=1024*this._currentChunkSizeKB,i=this._range[0]+this._receivedLength;let s=this._range[1];t],tast :",this._range,", SubRange, ",e)}else e=this._range,this.player.debugLog(this.TAG_NAME,"[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}_internalOpen(e){try{this._startTime=Date.now();const t=this._xhr=new XMLHttpRequest;t.open(this._method||"GET",this._url,!0),t.responseType=this._responseType,this._timeout&&(t.timeout=this._timeout),t.withCredentials=this._withCredentials,t.onload=this._onLoad.bind(this),t.onreadystatechange=this._onReadyStatechange.bind(this),t.onerror=e=>{var t,i,s;this._running=!1;const r=new ib(this._url,this._request,null==e||null===(t=e.currentTarget)||void 0===t?void 0:t.response,"xhr.onerror.status:"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.status)+",statusText,"+(null==e||null===(s=e.currentTarget)||void 0===s?void 0:s.statusText));r.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(r)},t.ontimeout=e=>{this.cancel();const t=new ib(this._url,this._request,{status:408},"timeout");this._onTimeout&&(t.isTimeout=!0,this._onTimeout(t,{index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions})),t.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)};const i=this._headers||{},s=QA(e);s&&(i.Range=s),i&&Object.keys(i).forEach((e=>{t.setRequestHeader(e,i[e])})),this.player.debugLog(this.TAG_NAME,"[xhr.send->] tast,",this._range,",load sub range, ",e),t.send(this._body)}catch(t){t.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}}_onReadyStatechange(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}_onLoad(e){var t;const i=e.target.status;if(i<200||i>299){const t=new ib(this._url,null,{...e.target.response,status:i},"bad response,status:"+i);return t.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}let s,r=null,o=!1;const a=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===VA){var n;const t=new Uint8Array(e.target.response);if(s=a+this._receivedLength,t&&t.byteLength>0){this._receivedLength+=t.byteLength;const e=Date.now()-this._startTime,i=tb(this._receivedLength,e);this.emit(qA,{speed:i,len:this._receivedLength,time:e,vid:this._vid,index:this._index,range:[s,a+this._receivedLength],priOptions:this._priOptions})}r=t,o=!((null===(n=this._range)||void 0===n?void 0:n.length)>1&&this._range[1]&&this._receivedLength], tast :",this._range,", start",s,"end ",a+this._receivedLength,",dataLen,",t?t.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",o)}else o=!0,r=e.target.response;let l={ok:i>=200&&i<300,status:i,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(l=this._transformResponse(l,this._url)||l),this._onProgress&&this._onProgress(r,o,{index:this._index,vid:this._vid,range:[s,a+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},l),o?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(eb(this._onProgress?null:r,o,l,l.headers["content-length"],l.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}cancel(){if(!this._aborted)return this._aborted=!0,this._runing=!1,super.removeAllListeners(),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}static isSupported(){return"undefined"!=typeof XMLHttpRequest}get receiveLen(){return this._receivedLength}get running(){return this._running}set running(e){this._running=e}_getHeaders(e){const t=e.getAllResponseHeaders().trim().split("\r\n"),i={};for(const e of t){const t=e.split(": ");i[t[0].toLowerCase()]=t.slice(1).join(": ")}return i}}class ab extends o{constructor(e,t){super(),uh(this,"type",zA),uh(this,"_queue",[]),uh(this,"_alive",[]),uh(this,"_currentTask",null),uh(this,"_config",void 0),this.player=t,this._config=function(e){return{loaderType:zA,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:HA,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0,...e}}(e),this._config.loaderType!==$A&&sb.isSupported()||(this.type=$A)}destroy(){this._queue=[],this._alive=[],this._currentTask=null}isFetch(){return this.type===zA}static isFetchSupport(){return sb.isSupported()}load(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?t=e:t.url=e||t.url||this._config.url,t=Object.assign({},this._config,t),t.params&&(t.params=Object.assign({},t.params)),t.headers&&YA(t.headers)&&(t.headers=Object.assign({},t.headers)),t.body&&YA(t.body)&&(t.body=Object.assign({},t.body)),t.transformRequest&&(t=t.transformRequest(t)||t);const i=new rb(this.type,t,this.player);return i.loader.on(qA,(e=>{this.emit(qA,e)})),this._queue.push(i),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),i.promise}async cancel(){const e=this._queue.map((e=>e.cancel())).concat(this._alive.map((e=>e.cancel())));this._currentTask&&e.push(this._currentTask.cancel()),this._queue=[],this._alive=[],await Promise.all(e),await function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((t=>setTimeout(t,e)))}()}_processTask(){if(this._currentTask=this._queue.shift(),!this._currentTask)return;this._currentTask.alive&&this._alive.push(this._currentTask);const e=this._currentTask.exec().catch((e=>{}));e&&"function"==typeof e.finally&&e.finally((()=>{var e,t;null!==(e=this._currentTask)&&void 0!==e&&e.alive&&(null===(t=this._alive)||void 0===t?void 0:t.length)>0&&(this._alive=this._alive.filter((e=>e&&e!==this._currentTask))),this._processTask()}))}}const nb="network",lb="network_timeout",db="other",hb="manifest",cb="hls",ub="demux";class pb extends Error{constructor(e,t,i,s,r){super(r||(null==i?void 0:i.message)),this.errorType=e===lb?nb:e,this.originError=i,this.ext=s,this.errorMessage=this.message}static create(e,t,i,s,r){return e instanceof pb?e:(e instanceof Error&&(i=e,e=""),e||(e=db),new pb(e,t,i,s,r))}static network(e){var t;return new pb(null!=e&&e.isTimeout?lb:nb,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(t=e.response)||void 0===t?void 0:t.status})}}const fb=/^#(EXT[^:]*)(?::(.*))?$/,mb=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g,gb=/^(?:[a-zA-Z0-9+\-.]+:)?\/\//,yb=/^((?:[a-zA-Z0-9+\-.]+:)?\/\/[^/?#]*)?([^?#]*\/)?/;function Ab(e){const t=e.match(fb);if(t&&t[1])return[t[1].replace("EXT-X-",""),t[2]]}function bb(e){const t={};let i=mb.exec(e);for(;i;)t[i[1]]=i[2]||i[3],i=mb.exec(e);return t}function vb(e,t){if(!t||!e||gb.test(e))return e;const i=yb.exec(t);return i?"/"===e[0]?i[1]+e:i[1]+i[2]+e:e}const _b={audio:[/^mp4a/,/^vorbis$/,/^opus$/,/^flac$/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]};function wb(e,t){const i=_b[e];if(i&&t&&t.length)for(let e=0;e>8*(15-t)&255}}}class Ib{static parse(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if(!e.includes("#EXTM3U"))throw new Error("Invalid m3u8 file");const i=function(e){return e.split(/[\r\n]/).map((e=>e.trim())).filter(Boolean)}(e);return Ib.isMediaPlaylist(e)?function(e,t){const i=new Db;i.url=t;let s,r=new Rb,o=null,a=null,n=0,l=0,d=0,h=0,c=!1;for(;(s=e[h++])&&!c;){if("#"!==s[0]){r.sn=l,r.cc=d,r.url=vb(s,t),a&&(r.key=a.clone(l)),o&&(r.initSegment=o),i.segments.push(r),r=new Rb,l++;continue}const e=Ab(s);if(!e)continue;const[h,u]=e;switch(h){case"VERSION":i.version=parseInt(u);break;case"PLAYLIST-TYPE":i.type=null==u?void 0:u.toUpperCase();break;case"TARGETDURATION":i.targetDuration=parseFloat(u);break;case"ENDLIST":{const e=i.segments[i.segments.length-1];e&&(e.isLast=!0),i.live=!1,c=!0}break;case"MEDIA-SEQUENCE":l=i.startSN=parseInt(u);break;case"DISCONTINUITY-SEQUENCE":d=i.startCC=parseInt(u);break;case"DISCONTINUITY":d++;break;case"BYTERANGE":r.setByteRange(u,i.segments[i.segments.length-1]);break;case"EXTINF":{const[e,t]=u.split(",");r.start=n,r.duration=parseFloat(e),n+=r.duration,r.title=t}break;case"KEY":{const e=bb(u);if("NONE"===e.METHOD){a=null;break}if("AES-128"!==e.METHOD)throw new Error(`encrypt ${e.METHOD}/${e.KEYFORMAT} is not supported`);if(a=new Pb,a.method=e.METHOD,a.url=/^blob:/.test(e.URI)?e.URI:vb(e.URI,t),a.keyFormat=e.KEYFORMAT||"identity",a.keyFormatVersions=e.KEYFORMATVERSIONS,e.IV){let t=e.IV.slice(2);t=(1&t.length?"0":"")+t,a.iv=new Uint8Array(t.length/2);for(let e=0,i=t.length/2;e{e.id=t})),o.length&&(o.forEach(((e,t)=>{e.id=t})),i.streams.forEach((e=>{e.audioGroup&&(e.audioStreams=o.filter((t=>t.group===e.audioGroup)))}))),a.length&&(a.forEach(((e,t)=>{e.id=t})),i.streams.forEach((e=>{e.subtitleGroup&&(e.subtitleStreams=a.filter((t=>t.group===e.subtitleGroup)))}))),i}(i,t)}static isMediaPlaylist(e){return e.includes("#EXTINF:")||e.includes("#EXT-X-TARGETDURATION:")}}class Bb{constructor(e){uh(this,"_onLoaderRetry",((e,t)=>{this.hls.emit(Us,{error:pb.network(e),retryTime:t})})),this.hls=e,this.player=e.player,this.TAG_NAME="HlsManifestLoader",this._timer=null;const{retryCount:t,retryDelay:i,loadTimeout:s,fetchOptions:r}=this.hls.config;this._loader=new ab({...r,responseType:"text",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._audioLoader=new ab({...r,responseType:"text",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._subtitleLoader=new ab({...r,responseType:"text",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player)}async destroy(){await this.stopPoll(),this._audioLoader&&(this._audioLoader.destroy(),this._audioLoader=null),this._subtitleLoader&&(this._subtitleLoader.destroy(),this._subtitleLoader=null),this._loader&&(this._loader.destroy(),this._loader=null)}async load(e,t,i){this.player.debugLog(this.TAG_NAME,"load()",e,t,i);const s=[this._loader.load(e)];let r,o,a,n,l,d;t&&s.push(this._audioLoader.load(t)),i&&s.push(this._subtitleLoader.load(i));try{const[e,i,n]=await Promise.all(s);if(!e)return[];r=e.data,t?(o=null==i?void 0:i.data,a=null==n?void 0:n.data):a=null==i?void 0:i.data}catch(e){throw pb.network(e)}try{var h;if(n=Ib.parse(r,e),!1===(null===(h=n)||void 0===h?void 0:h.live)&&n.segments&&!n.segments.length)throw new Error("empty segments list");o&&(l=Ib.parse(o,t)),a&&(d=Ib.parse(a,i))}catch(e){throw new pb(hb,cb,e)}return n&&(n.isMaster?this.hls.emit(Rs,{playlist:n}):this.hls.emit(Ps,{playlist:n})),[n,l,d]}poll(e,t,i,s,r,o){clearTimeout(this._timer),o=o||3e3;let a=this.hls.config.pollRetryCount;const n=async()=>{clearTimeout(this._timer);try{const r=await this.load(e,t,i);if(!r[0])return;a=this.hls.config.pollRetryCount,s(r[0],r[1],r[2])}catch(e){a--,a<=0&&r(e)}this._timer=setTimeout(n,o)};this._timer=setTimeout(n,o)}stopPoll(){return clearTimeout(this._timer),this.cancel()}cancel(){return Promise.all([this._loader.cancel(),this._audioLoader.cancel()])}}class Mb{constructor(){uh(this,"_chunkSpeeds",[]),uh(this,"_speeds",[])}addRecord(e,t){e&&t&&(this._speeds.push(8e3*e/t),this._speeds=this._speeds.slice(-3))}addChunkRecord(e,t){e&&t&&(this._chunkSpeeds.push(8e3*e/t),this._chunkSpeeds=this._chunkSpeeds.slice(-100))}getAvgSpeed(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds.reduce(((e,t)=>e+t))/this._speeds.length:this._chunkSpeeds.reduce(((e,t)=>e+t))/this._chunkSpeeds.length:0}getLatestSpeed(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds[this._speeds.length-1]:this._chunkSpeeds[this._chunkSpeeds.length-1]:0}reset(){this._chunkSpeeds=[],this._speeds=[]}}class Fb{constructor(e){uh(this,"_emitOnLoaded",((e,t)=>{const{data:i,response:s,option:r}=e,{firstByteTime:o,startTime:a,endTime:n,contentLength:l}=r||{},d=n-a;this._bandwidthService.addRecord(l||i.byteLength,d),this.hls.emit(Ns,{time:d,byteLength:l,url:t}),this.hls.emit(js,{url:t,elapsed:d||0}),this.hls.emit(Fs,{url:t,responseUrl:s.url,elapsed:o-a}),this.hls.emit(Gs,{headers:s.headers})})),uh(this,"_onLoaderRetry",((e,t)=>{this.hls.emit(Us,{error:pb.network(e),retryTime:t})})),this.hls=e,this.player=e.player,this._bandwidthService=new Mb;const{retryCount:t,retryDelay:i,loadTimeout:s,fetchOptions:r}=this.hls.config;this._segmentLoader=new ab({...r,responseType:"arraybuffer",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._audioSegmentLoader=new ab({...r,responseType:"arraybuffer",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._keyLoader=new ab({...r,responseType:"arraybuffer",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player)}destroy(){this.reset(),this._keyLoader&&(this._keyLoader.destroy(),this._keyLoader=null),this._audioSegmentLoader&&(this._audioSegmentLoader.destroy(),this._audioSegmentLoader=null),this._segmentLoader&&(this._segmentLoader.destroy(),this._segmentLoader=null)}speedInfo(){return{speed:this._bandwidthService.getLatestSpeed(),avgSpeed:this._bandwidthService.getAvgSpeed()}}resetBandwidth(){this._bandwidthService.reset()}load(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:i;const r=[];return e&&(r[0]=this.loadVideoSegment(e,i)),t&&(r[1]=this.loadAudioSegment(t,s)),Promise.all(r)}loadVideoSegment(e,t){return this._loadSegment(this._segmentLoader,e,t)}loadAudioSegment(e,t){return this._loadSegment(this._audioSegmentLoader,e,t)}async _loadSegment(e,t,i){var s;let r,o,a,n,l;const d=[];if(this.hls.emit(Os,{url:t.url}),d[0]=e.load(t.url),i&&t.initSegment){var h;const i=t.initSegment.url;r=this._mapCache[i],r||(this.hls.emit(Os,{url:i}),d[1]=e.load(i).then((e=>{if(e){Object.keys(this._mapCache)>30&&(this._mapCache={}),r=this._mapCache[i]=e.data,this._emitOnLoaded(e,i)}})));const s=null===(h=t.initSegment.key)||void 0===h?void 0:h.url;s&&(l=t.initSegment.key.iv,n=this._keyCache[s],n||(this.hls.emit(Os,{url:s}),d[2]=this._keyLoader.load(s).then((e=>{e&&(n=this._keyCache[s]=e.data,this._emitOnLoaded(e,s))}))))}const c=null===(s=t.key)||void 0===s?void 0:s.url;c&&(a=t.key.iv,o=this._keyCache[c],o||(this.hls.emit(Os,{url:c}),d[3]=this._keyLoader.load(c).then((e=>{e&&(o=this._keyCache[c]=e.data,this._emitOnLoaded(e,c))}))));const[u]=await Promise.all(d);if(!u)return;const p=u.data;return this._emitOnLoaded(u,t.url),{data:p,map:r,key:o,mapKey:n,keyIv:a,mapKeyIv:l}}reset(){this.error=null,this._mapCache={},this._keyCache={},this._bandwidthService.reset()}async cancel(){await Promise.all([this._keyLoader.cancel(),this._segmentLoader.cancel(),this._audioSegmentLoader.cancel()])}}class Ub{constructor(e,t,i){this.live=void 0,this.id=0,this.bitrate=0,this.width=0,this.height=0,this.name="",this.url="",this.audioCodec="",this.videoCodec="",this.textCodec="",this.startCC=0,this.endCC=0,this.startSN=0,this.endSN=-1,this.totalDuration=0,this.targetDuration=0,this.snDiff=null,this.segments=[],this.audioStreams=[],this.subtitleStreams=[],this.closedCaptions=[],this.currentAudioStream=null,this.currentSubtitleStream=null,this.TAG_NAME="HlsStream",this.update(e,t,i)}get lastSegment(){return this.segments.length?this.segments[this.segments.length-1]:null}get segmentDuration(){var e;return this.targetDuration||(null===(e=this.segments[0])||void 0===e?void 0:e.duration)||0}get liveEdge(){return this.endTime}get endTime(){var e;return(null===(e=this.lastSegment)||void 0===e?void 0:e.end)||0}get currentSubtitleEndSn(){var e;return(null===(e=this.currentSubtitleStream)||void 0===e?void 0:e.endSN)||0}clearOldSegment(e,t){return this._clearSegments(e,t)}getAudioSegment(e){if(!e||!this.currentAudioStream)return;const t=e.sn-this.snDiff;return this.currentAudioStream.segments.find((e=>e.sn===t))}update(e,t){this.url=e.url,Array.isArray(e.segments)?(null!==this.live&&void 0!==this.live||(this.live=e.live),this._updateSegments(e,this),this.startCC=e.startCC,this.endCC=e.endCC,this.startSN=e.startSN,this.endSN=e.endSN||-1,this.totalDuration=e.totalDuration,this.targetDuration=e.targetDuration,this.live=e.live,t&&this.currentAudioStream&&Array.isArray(t.segments)&&(this._updateSegments(t,this.currentAudioStream),(null===this.snDiff||void 0===this.snDiff)&&e.segments.length&&t.segments.length&&(this.snDiff=e.segments[0].sn-t.segments[0].sn))):(this.id=e.id,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.name=e.name,this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.textCodec=e.textCodec,this.audioStreams=e.audioStreams,this.subtitleStreams=e.subtitleStreams,!this.currentAudioStream&&this.audioStreams.length&&(this.currentAudioStream=this.audioStreams.find((e=>e.default))||this.audioStreams[0]),!this.currentSubtitleStream&&this.subtitleStreams.length&&(this.currentSubtitleStream=this.subtitleStreams.find((e=>e.default))||this.subtitleStreams[0]))}updateSubtitle(e){if(!(e&&this.currentSubtitleStream&&Array.isArray(e.segments)))return;const t=this._updateSegments(e,this.currentSubtitleStream),i=this.currentSubtitleStream.segments;return i.length>100&&(this.currentSubtitleStream.segments=i.slice(100)),t?t.map((e=>({sn:e.sn,url:e.url,duration:e.duration,start:e.start,end:e.end,lang:this.currentSubtitleStream.lang}))):void 0}switchSubtitle(e){const t=this.subtitleStreams.find((t=>t.lang===e)),i=this.currentSubtitleStream;t&&(this.currentSubtitleStream=t,i.segments=[])}_clearSegments(e,t){let i=0;const s=this.segments;for(let t=0,r=s.length;t=e){i=t;break}return i>t&&(i=t),i&&(this.segments=this.segments.slice(i),this.currentAudioStream&&(this.currentAudioStream.segments=this.currentAudioStream.segments.slice(i))),t-i}_updateSegments(e,t){const i=t.segments;if(this.live){const s=i[i.length-1],r=(null==s?void 0:s.sn)||-1;if(re.sn===r)),a=o<0?e.segments:e.segments.slice(o+1);if(i.length&&a.length){let e=s.end;a.forEach((t=>{t.start=e,e=t.end}));const t=(null==s?void 0:s.cc)||-1;t>a[0].cc&&a.forEach((e=>e.cc+=t))}return t.endSN=e.endSN,t.segments=i.concat(a),a}}else t.segments=e.segments}}class Ob{constructor(e){this.hls=e,this.player=e.player,this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1,this.TAG_NAME="HlsPlaylist"}destroy(){this.reset()}get lastSegment(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.lastSegment}get currentSegment(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer]}get nextSegment(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer+1]}get currentSegments(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.segments}get currentSubtitleEndSn(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.currentSubtitleEndSn}get liveEdge(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.liveEdge}get totalDuration(){var e;return(null===(e=this.currentStream)||void 0===e?void 0:e.totalDuration)||0}get seekRange(){const e=this.currentSegments;if(e&&e.length)return[e[0].start,e[e.length-1].end]}get isEmpty(){var e;return!(null!==(e=this.currentSegments)&&void 0!==e&&e.length)}get isLive(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.live}get hasSubtitle(){var e;return!(null===(e=this.currentStream)||void 0===e||!e.currentSubtitleStream)}getAudioSegment(e){var t;return null===(t=this.currentStream)||void 0===t?void 0:t.getAudioSegment(e)}moveSegmentPointer(e){var t;null==e&&(e=this._segmentPointer+1),this._segmentPointer=oo(e,-1,null===(t=this.currentSegments)||void 0===t?void 0:t.length),this.player.debugLog(this.TAG_NAME,`moveSegmentPointer() and param pos is ${e} and clamp result is ${this._segmentPointer}`)}reset(){this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1}getSegmentByIndex(e){var t;return null===(t=this.currentSegments)||void 0===t?void 0:t[e]}setNextSegmentByIndex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._segmentPointer=e-1,this.player.debugLog(this.TAG_NAME,"setNextSegmentByIndex()",e,this._segmentPointer)}findSegmentIndexByTime(e){const t=this.currentSegments;if(t){for(let i,s=0,r=t.length;s=i.start&&ee.url)).forEach(((e,t)=>{this.streams[t]?this.streams[t].update(e):this.streams[t]=new Ub(e)})),this.currentStream=this.streams[0];else if(Array.isArray(e.segments)){const s=this.currentStream;if(s){s.update(e,t,i);const r=s.updateSubtitle(i);r&&this.hls.emit(Ds,{list:r})}else this.reset(),this.currentStream=this.streams[0]=new Ub(e,t,i)}this.currentStream&&this.hls.isLive&&!this.dvrWindow&&(this.dvrWindow=this.currentSegments.reduce(((e,t)=>e+=t.duration),0))}switchSubtitle(e){var t;null===(t=this.currentStream)||void 0===t||t.switchSubtitle(e)}clearOldSegment(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;const t=this.currentStream;if(!this.dvrWindow||!t)return;const i=t.endTime-this.dvrWindow;if(i<=0)return void this.player.debugLog(this.TAG_NAME,`clearOldSegment() stream.endTime:${t.endTime}, this.dvrWindow:${this.dvrWindow} startTime <= 0`);const s=t.segments;if(s.length<=e)return void this.player.debugLog(this.TAG_NAME,`clearOldSegment() segments.length:${s.length} <= maxPlaylistSize:${e}`);const r=this._segmentPointer;this._segmentPointer=t.clearOldSegment(i,r),this.player.debugLog(this.TAG_NAME,"clearOldSegment() update _segmentPointer:",r,this._segmentPointer),this.player.debugLog(this.TAG_NAME,"currentSegments",this.currentSegments)}checkSegmentTrackChange(e,t){const i=this.findSegmentIndexByTime(e),s=this.getSegmentByIndex(i);if(!s)return;if(!s.hasAudio&&!s.hasVideo)return;if(2!==t&&s.hasAudio&&s.hasVideo)return s;if(s.end-e>.3)return;const r=this.getSegmentByIndex(i+1);return r&&(r.hasAudio||r.hasVideo)&&(r.hasAudio!==s.hasAudio||r.hasVideo!==s.hasVideo)?r:void 0}}class Nb{constructor(e,t){this.hls=e,this.player=t;const i=window.crypto||window.msCrypto;this.subtle=i&&(i.subtle||i.webkitSubtle),this.externalDecryptor=null}decrypt(e,t){if(!e&&!t)return;const i=[];return e&&(i[0]=this._decryptSegment(e)),t&&(i[1]=this._decryptSegment(t)),Promise.all(i)}async _decryptSegment(e){let t=e.data;return e.key&&(t=await this._decryptData(e.data,e.key,e.keyIv)),e.map?wh(e.map,t):t}async _decryptData(e,t,i){if(this.externalDecryptor)return await this.externalDecryptor.decrypt(e,t,i);if(this.subtle){const s=await this.subtle.importKey("raw",t,{name:"AES-CBC"},!1,["encrypt","decrypt"]),r=await this.subtle.decrypt({name:"AES-CBC",iv:i},s,e);return new Uint8Array(r)}e=Td(e),t=Td(t),i=Td(i);return function(e){const{words:t}=e,{sigBytes:i}=e,s=new Uint8Array(i);for(let e=0;e>>2]>>>24-e%4*8&255;return s}(Sd.AES.decrypt({ciphertext:e},t,{iv:i,mode:Sd.mode.CBC}))}}class jb extends th{constructor(e){super(e),this.player=e,this._pmtId=-1,this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[],this._gopId=0,this._videoPid=-1,this._audioPid=-1,this._codecType=At,this._audioCodecType=wt,this._vps=null,this._sps=null,this._pps=null,this.TAG_NAME="HlsTsLoader",this.videoTrack=jb.initVideoTrack(),this.audioTrack=jb.initAudioTrack(),this._baseDts=-1,this._baseDtsInited=!1,this._basefps=25,this._tempSampleTsList=[],this._hasAudio=!1,this._hasVideo=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=!1,this._videoTimestampBreak=!1,this._lastAudioExceptionGapDot=0,this._lastAudioExceptionOverlapDot=0,this._lastAudioExceptionLargeGapDot=0,this._isSendAACSeqHeader=!1,this.workerClearTimeout=null,this.workerUrl=null,this.loopWorker=null,this.tempSampleListInfo={},this._isUseWorker()&&this._initLoopWorker(),this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.workerUrl&&(URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.loopWorker&&(this.loopWorker.postMessage({cmd:"destroy"}),this.loopWorker.terminate(),this.loopWorker=null),this.videoTrack=null,this.audioTrack=null,this.tempSampleListInfo={},this._baseDts=-1,this._baseDtsInited=!1,this._basefps=25,this._hasCalcFps=!1,this._tempSampleTsList=[],this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=!1,this._videoTimestampBreak=!1,this._lastAudioExceptionGapDot=0,this._lastAudioExceptionOverlapDot=0,this._lastAudioExceptionLargeGapDot=0,this._isSendAACSeqHeader=!1,this.player.debugLog(this.TAG_NAME,"destroy")}static initVideoTrack(){return{samples:[]}}static initAudioTrack(){return{samples:[]}}static probe(e){return!!e.length&&(71===e[0]&&71===e[188]&&71===e[376])}_parsePES(e){const t=e[8];if(null==t||e.lengthe.length-6)return;let r,o;const a=e[7];return 192&a&&(r=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&a?(o=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,r-o>54e5&&(r=o)):o=r),{data:e.subarray(9+t),pts:r,dts:o,originalPts:r,originalDts:o}}_demux(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t&&(this._pmtId=-1,this.videoTrack=jb.initVideoTrack(),this.audioTrack=jb.initAudioTrack()),!i||t?(this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[]):(this.videoTrack.samples=[],this.audioTrack.samples=[],this._remainingPacketData&&(e=wh(this._remainingPacketData,e),this._remainingPacketData=null));let s=e.length;const r=s%188;r&&(this._remainingPacketData=e.subarray(s-r),s-=r);for(let t=0;t>4>1){if(r=t+5+e[t+4],r===t+188)continue}else r=t+4;switch(s){case 0:i&&(r+=e[r]+1),this._pmtId=(31&e[r+10])<<8|e[r+11];break;case this._pmtId:{i&&(r+=e[r]+1);const t=r+3+((15&e[r+1])<<8|e[r+2])-4;for(r+=12+((15&e[r+10])<<8|e[r+11]);r=t)return[];const r=[];for(;s{const t=s?e[0]>>>1&63:31&e[0];switch(t){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!s&&5!==t||s&&5===t)break;r.isIFrame=!0,this._gopId++;break;case 6:case 39:case 40:if(!s&&6!==t||s&&6===t)break;const o=function(e,t){const i=e.length;let s=t?2:1,r=0,o=0,a="";for(;255===e[s];)r+=255,s++;for(r+=e[s++];255===e[s];)o+=255,s++;if(o+=e[s++],5===r&&i>s+16)for(let t=0;t<16;t++)a+=e[s].toString(16),s++;return{payload:e.subarray(s),type:r,size:o,uuid:a}}(function(e){const t=e.byteLength,i=[];let s=1;for(;s=i)return;const r=s,o=[],a=(60&e[s+2])>>>2,n=Br[a];if(!n)throw new Error(`Invalid sampling index: ${a}`);const l=1+((192&e[s+2])>>>6),d=(1&e[s+2])<<2|(192&e[s+3])>>>6;let h,c,u=0;const p=Gr(n);for(;s+7>5,i-s=i?void 0:e.subarray(s),frames:o,samplingFrequencyIndex:a,sampleRate:n,objectType:l,channelCount:d,originCodec:`mp4a.40.${l}`}}(e.data,e.originalPts);if(t){if(this.audioTrack.codec=t.codec,this.audioTrack.sampleRate=t.sampleRate,this.audioTrack.channelCount=t.channelCount,!this._isSendAACSeqHeader){const e=Ur({profile:t.objectType,sampleRate:t.samplingFrequencyIndex,channel:t.channelCount});this._isSendAACSeqHeader=!0,this.player.debugLog(this.TAG_NAME,"aac seq header",`profile: ${t.objectType}, sampleRate:${t.sampleRate},sampleRateIndex: ${t.samplingFrequencyIndex}, channel: ${t.channelCount}`),this._doDecodeByHls(e,Ue,0,!1,0)}if(this._isSendAACSeqHeader){const e=[];t.frames.forEach((t=>{const i=t.pts,s=new Uint8Array(t.data.length+2);s.set([175,1],0),s.set(t.data,2);const r={type:Ue,pts:i,dts:i,payload:s};e.push(r)})),this.audioTrack.samples=this.audioTrack.samples.concat(e)}else this.player.debugWarn(this.TAG_NAME,"aac seq header not send")}else this.player.debugWarn(this.TAG_NAME,"aac parseADTS error")}this._audioPesData=[]}else e&&"startPrefixError"===e.code&&(this._audioPesData=[])}_fix(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e=Math.round(9e4*e);const s=this.videoTrack,r=this.audioTrack,o=s.samples,a=r.samples;if(!o.length&&!a.length)return;const n=o[0],l=a[0];let d=0;if(o.length&&a.length&&(d=n.dts-l.pts),this._baseDtsInited||this._calculateBaseDts(),t&&(this._calculateBaseDts(),this._baseDts-=e),!i){this._videoNextDts=d>0?e+d:e,this._audioNextPts=d>0?e:e-d;const t=n?n.dts-this._baseDts-this._videoNextDts:0,i=l?l.pts-this._baseDts-this._audioNextPts:0;Math.abs(t||i)>Ar&&(this._calculateBaseDts(this.audioTrack,this.videoTrack),this._baseDts-=e)}this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(r),this._fixVideo(s);let h=s.samples.concat(r.samples);h=h.map((e=>(e.dts=Math.round(e.dts/90),e.pts=Math.round(e.pts/90),e.cts=e.pts-e.dts,e))).sort(((e,t)=>e.dts-t.dts)),h.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,this._isUseWorker()?this.loopWorker.postMessage({...e,payload:t,cmd:"sample"},[t.buffer]):e.type===Oe?this._doDecodeVideo({...e,payload:t}):e.type===Ue&&this._doDecodeAudio({...e,payload:t})})),ya(this._hasCalcFps)&&this._isUseWorker()&&(this._hasCalcFps=this._calcDecodeFps(h))}_calculateBaseDts(){const e=this.audioTrack,t=this.videoTrack,i=e.samples,s=t.samples;if(!i.length&&!s.length)return!1;let r=1/0,o=1/0;i.length&&(e.baseDts=r=i[0].pts),s.length&&(t.baseDts=o=s[0].dts),this._baseDts=Math.min(r,o);const a=o-r;return Number.isFinite(a)&&Math.abs(a)>45e3&&this.player.debugWarn(this.TAG_NAME,`large av first frame gap,\n video pts: ${o},\n audio pts: ${r},\n base dts: ${this._baseDts},\n detect is: ${a}`),this._baseDtsInited=!0,!0}_resetBaseDtsWhenStreamBreaked(){if(this._baseDtsInited&&this._videoTimestampBreak&&this._audioTimestampBreak){if(!this._calculateBaseDts(this.audioTrack,this.videoTrack))return;this._baseDts-=Math.min(this._audioNextPts,this._videoNextDts),this._audioLastSample=null,this._videoLastSample=null,this._videoTimestampBreak=!1,this._audioTimestampBreak=!1}}_fixAudio(e){const t=e.samples;t.length&&(t.forEach((e=>{e.pts-=this._baseDts,e.dts=e.pts})),this._doFixAudioInternal(e,t,9e4))}_fixVideo(e){const t=e.samples;if(!t.length)return;if(t.forEach((e=>{e.dts-=this._baseDts,e.pts-=this._baseDts})),void 0===this._videoNextDts){const e=t[0];this._videoNextDts=e.dts}const i=t.length;let s=0;const r=t[0],o=t[1],a=this._videoNextDts-r.dts;let n;Math.abs(a)>45e3&&(r.dts+=a,r.pts+=a,this.player.debugWarn(this.TAG_NAME,`large video gap between chunk,\n next dts is ${this._videoNextDts},\n first dts is ${r.dts},\n next dts is ${o&&o.dts},\n duration is ${a}`),o&&Math.abs(o.dts-r.dts)>Ar&&(this._videoTimestampBreak=!0,t.forEach(((e,t)=>{0!==t&&(e.dts+=a,e.pts+=a)}))));const l=e.samples[0],d=e.samples[i-1];n=1===i?9e3:Math.floor((d.dts-l.dts)/(i-1));for(let r=0;rAr||s<0){this._videoTimestampBreak=!0,s=this._audioTimestampBreak?n:Math.max(s,2700);const i=this._audioNextPts||0;a&&a.dts>i&&(s=n),this.player.debugWarn(this.TAG_NAME,`large video gap between frames,\n time is ${o/e.timescale},\n dts is ${o},\n origin dts is ${t[r].originalDts},\n next dts is ${this._videoNextDts},\n sample Duration is ${s} ,\n ref Sample DurationInt is ${n}`)}t[r].duration=s,this._videoNextDts+=s}}_doFixAudioInternal(e,t,i){e.sampleDuration||(e.sampleDuration=Gr(e.timescale,i));const s=e.sampleDuration;if(void 0===this._audioNextPts){const e=t[0];this._audioNextPts=e.pts}for(let i=0;i=3*s&&a<=gr&&!bo()){jr(e.codec,e.channelCount)||t[0].data.subarray();const n=Math.floor(a/s);Math.abs(o.pts-this._lastAudioExceptionGapDot)>yr&&(this._lastAudioExceptionGapDot=o.pts),this.player.debugWarn(this.TAG_NAME,`audio gap detected,\n pts is ${t.pts},\n originPts is ${t.originalPts},\n count is ${n},\n nextPts is ${r},\n ref sample duration is ${s}`);for(let e=0;e=-9e4?(Math.abs(o.pts-this._lastAudioExceptionOverlapDot)>yr&&(this._lastAudioExceptionOverlapDot=o.pts,this.player.debugWarn(this.TAG_NAME,`audio overlap detected,\n pts is ${o.pts},\n originPts is ${o.originalPts},\n nextPts is ${r},\n ref sample duration is ${s}`)),t.splice(i,1),i--):(Math.abs(a)>=gr&&(this._audioTimestampBreak=!0,Math.abs(o.pts-this._lastAudioExceptionLargeGapDot)>yr&&(this._lastAudioExceptionLargeGapDot=o.pts,this.player.debugWarn(this.TAG_NAME,`large audio gap detected,\n time is ${o.pts/1e3}\n pts is ${o.pts},\n originPts is ${o.originalPts},\n nextPts is ${r},\n sample duration is ${a}\n ref sample duration is ${s}`))),o.dts=o.pts=r,this._audioNextPts+=s)}}_calcDecodeFps(e){const t=e.map((e=>({ts:e.dts||e.pts,type:e.type})));this._tempSampleTsList=this._tempSampleTsList.concat(t);const i=la(this._tempSampleTsList,Oe);if(i)this._tempSampleTsList=[],this.player.debugLog(this.TAG_NAME,`_calcDecodeFps() video fps is ${i}, update base fps is ${this._basefps}`),this._basefps=i,this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps});else if(this.player.debugLog(this.TAG_NAME,"_calcDecodeFps() streamVideoFps is null"),this._tempSampleTsList.length>200)return this.player.debugLog(this.TAG_NAME,`_calcDecodeFps() _tempSampleTsList is more than 200, clear and use base fps update ${this._basefps}`),this._tempSampleTsList=[],this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps}),!0;return null!==i}_isUseWorker(){return!this.player.isUseMSE()}_initLoopWorker(){this.player.debugLog(this.TAG_NAME,"_initLoopWorker()");const e=Ea(function(){const e=1,t=2;let i=new class{constructor(){this.baseFps=0,this.fpsInterval=null,this.preLoopTimestamp=null,this.startBpsTime=null,this.allSampleList=[]}destroy(){this._clearInterval(),this.baseFps=0,this.allSampleList=[],this.preLoopTimestamp=null,this.startBpsTime=null}updateBaseFps(e){this.baseFps=e,this._clearInterval(),this._startInterval()}pushSample(e){delete e.cmd,this.allSampleList.push(e)}_startInterval(){const e=Math.ceil(1e3/this.baseFps);this.fpsInterval=setInterval((()=>{let t=(new Date).getTime();this.preLoopTimestamp||(this.preLoopTimestamp=t),this.startBpsTime||(this.startBpsTime=t);const i=t-this.preLoopTimestamp;if(i>2*e&&console.warn(`JbPro:[TsLoader LoopWorker] loop interval is ${i}ms, more than ${e} * 2ms`),this._loop(),this.preLoopTimestamp=(new Date).getTime(),this.startBpsTime){t-this.startBpsTime>=1e3&&(this._calcSampleList(),this.startBpsTime=t)}}),e)}_clearInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_calcSampleList(){const i={buferredDuration:0,allListLength:this.allSampleList.length,audioListLength:0,videoListLength:0};this.allSampleList.forEach((s=>{s.type===t?(i.videoListLength++,s.duration&&(i.buferredDuration+=Math.round(s.duration/90))):s.type===e&&i.audioListLength++})),postMessage({cmd:"sampleListInfo",...i})}_loop(){let i=null;if(this.allSampleList.length)if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]);let t=this.allSampleList[0];for(;t&&t.type===e;)i=this.allSampleList.shift(),postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),t=this.allSampleList[0]}else if(i.type===e){postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]);let s=this.allSampleList[0];for(;s;){if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]),s=null;break}i.type===e&&(postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),s=this.allSampleList[0])}}}};self.onmessage=e=>{const t=e.data;switch(t.cmd){case"updateBaseFps":i.updateBaseFps(t.baseFps);break;case"sample":i.pushSample(t);break;case"destroy":i.destroy(),i=null}}}.toString()),t=new Blob([e],{type:"text/javascript"}),i=URL.createObjectURL(t);let s=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((()=>{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),ie),s.onmessage=e=>{const t=e.data;switch(t.cmd){case"decodeVideo":this._doDecodeVideo(t);break;case"decodeAudio":this._doDecodeAudio(t);break;case"sampleListInfo":this.tempSampleListInfo=t}},this.loopWorker=s}_postMessageToLoopWorker(e,t){this._isUseWorker()&&(this.loopWorker?this.loopWorker.postMessage({cmd:e,...t}):this.player.debugWarn(this.TAG_NAME,"loop worker is not init, can not post message"))}_doDecodeAudio(e){const t=new Uint8Array(e.payload);this.player.updateStats({abps:t.byteLength});let i=this.cryptoPayloadAudio(t);this._doDecodeByHls(i,Ue,e.dts,!1,0)}_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?Qn(t,e.isIFrame):Un(t,e.isIFrame),this.player.updateStats({dts:e.dts,vbps:i.byteLength});const s=e.pts-e.dts;let r=this.cryptoPayload(i,e.isIFrame);this._doDecodeByHls(r,Oe,e.dts,e.isIFrame,s)}getBuferredDuration(){return this.tempSampleListInfo.buferredDuration||0}getSampleListLength(){return this.tempSampleListInfo.allListLength||0}getSampleAudioListLength(){return this.tempSampleListInfo.audioListLength||0}getSampleVideoListLength(){return this.tempSampleListInfo.videoListLength||0}getInputByteLength(){return this._remainingPacketData&&this._remainingPacketData.byteLength||0}}function Gb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function Wb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function zb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=Math.pow(2,32);return Wb(e,t)*i+Wb(e,t+4)}const $b="aac",Vb="g7110a",Hb="g7110m",Jb="avc",qb="hevc";class Kb{static getFrameDuration(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}static getRateIndexByRate(e){return Kb.FREQ.indexOf(e)}}function Yb(e,t,i,s,r,o){const a=[],n=null==r?void 0:r.entries,l=t.entries,d=s.entries,h=i.entrySizes,c=null==o?void 0:o.entries;let u,p,f;c&&(u={},c.forEach((e=>{u[e-1]=!0}))),n&&(p=[],n.forEach((e=>{let{count:t,offset:i}=e;for(let e=0;e{let{count:t,delta:s}=e;for(let e=0;e=w&&(b++,w=l[b+1]?l[b+1].firstChunk-1:1/0),_+=l[b].samplesPerChunk)})),a}function Qb(e,t){return e.dataReferenceIndex=Gb(t,6),e.width=Gb(t,24),e.height=Gb(t,26),e.horizresolution=Wb(t,28),e.vertresolution=Wb(t,32),e.frameCount=Gb(t,40),e.depth=Gb(t,74),78}function Xb(e,t){return e.dataReferenceIndex=Gb(t,6),e.channelCount=Gb(t,16),e.sampleSize=Gb(t,18),e.sampleRate=Wb(t,24)/65536,28}function Zb(e,t,i){if(!e)return;if(e.size!==e.data.length)throw new Error(`box ${e.type} size !== data.length`);const s={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(s.version=e.data[e.headerSize],s.flags=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}(e.data,e.headerSize+1),s.headerSize+=4),i(s,e.data.subarray(s.headerSize),s.start+s.headerSize),s}uh(Kb,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);const ev=function(e,t,i){const s=String(i),r=t>>0;let o=Math.ceil(r/s.length);const a=[],n=String(e);for(;o--;)a.push(s);return a.join("").substring(0,r-n.length)+n},tv=function(){const e=[];for(var t=arguments.length,i=new Array(t),s=0;s{e.push(ev(Number(t).toString(16),2,0))})),e[0]};class iv{static probe(e){return!!iv.findBox(e,["ftyp"])}static findBox(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=[];if(!e)return s;let r=0,o="",a=0;for(;e.length>7;){if(r=Wb(e),o=String.fromCharCode.apply(null,e.subarray(4,8)),a=8,1===r?(r=zb(e,8),a+=8):r||(r=e.length),!t[0]||o===t[0]){const n=e.subarray(0,r);if(!(t.length<2))return iv.findBox(n.subarray(a),t.slice(1),i+a);s.push({start:i,size:r,headerSize:a,type:o,data:n})}i+=r,e=e.subarray(r)}return s}static tfhd(e){return Zb(e,!0,((e,t)=>{e.trackId=Wb(t);let i=4;const s=1&e.flags,r=2&e.flags,o=8&e.flags,a=16&e.flags,n=32&e.flags;s&&(i+=4,e.baseDataOffset=Wb(t,i),i+=4),r&&(e.sampleDescriptionIndex=Wb(t,i),i+=4),o&&(e.defaultSampleDuration=Wb(t,i),i+=4),a&&(e.defaultSampleSize=Wb(t,i),i+=4),n&&(e.defaultSampleFlags=Wb(t,i))}))}static sidx(e){return Zb(e,!0,((e,t)=>{let i=0;e.reference_ID=Wb(t,i),i+=4,e.timescale=Wb(t,i),i+=4,0===e.version?(e.earliest_presentation_time=Wb(t,i),i+=4,e.first_offset=Wb(t,i),i+=4):(e.earliest_presentation_time=zb(t,i),i+=8,e.first_offset=zb(t,i),i+=8),i+=2,e.references=[];const s=Gb(t,i);i+=2;for(let r=0;r>31&1,s.referenced_size=2147483647&r,s.subsegment_duration=Wb(t,i),i+=4,r=Wb(t,i),i+=4,s.starts_with_SAP=r>>31&1,s.SAP_type=r>>28&7,s.SAP_delta_time=268435455&r}}))}static moov(e){return Zb(e,!1,((e,t,i)=>{e.mvhd=iv.mvhd(iv.findBox(t,["mvhd"],i)[0]),e.trak=iv.findBox(t,["trak"],i).map((e=>iv.trak(e))),e.pssh=iv.pssh(iv.findBox(t,["pssh"],i)[0])}))}static mvhd(e){return Zb(e,!0,((e,t)=>{let i=0;1===e.version?(e.timescale=Wb(t,16),e.duration=zb(t,20),i+=28):(e.timescale=Wb(t,8),e.duration=Wb(t,12),i+=16),e.nextTrackId=Wb(t,i+76)}))}static trak(e){return Zb(e,!1,((e,t,i)=>{e.tkhd=iv.tkhd(iv.findBox(t,["tkhd"],i)[0]),e.mdia=iv.mdia(iv.findBox(t,["mdia"],i)[0])}))}static tkhd(e){return Zb(e,!0,((e,t)=>{let i=0;1===e.version?(e.trackId=Wb(t,16),e.duration=zb(t,24),i+=32):(e.trackId=Wb(t,8),e.duration=Wb(t,16),i+=20),e.width=Wb(t,i+52),e.height=Wb(t,i+56)}))}static mdia(e){return Zb(e,!1,((e,t,i)=>{e.mdhd=iv.mdhd(iv.findBox(t,["mdhd"],i)[0]),e.hdlr=iv.hdlr(iv.findBox(t,["hdlr"],i)[0]),e.minf=iv.minf(iv.findBox(t,["minf"],i)[0])}))}static mdhd(e){return Zb(e,!0,((e,t)=>{let i=0;1===e.version?(e.timescale=Wb(t,16),e.duration=zb(t,20),i+=28):(e.timescale=Wb(t,8),e.duration=Wb(t,12),i+=16);const s=Gb(t,i);e.language=String.fromCharCode(96+(s>>10&31),96+(s>>5&31),96+(31&s))}))}static hdlr(e){return Zb(e,!0,((e,t)=>{0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}static minf(e){return Zb(e,!1,((e,t,i)=>{e.vmhd=iv.vmhd(iv.findBox(t,["vmhd"],i)[0]),e.smhd=iv.smhd(iv.findBox(t,["smhd"],i)[0]),e.stbl=iv.stbl(iv.findBox(t,["stbl"],i)[0])}))}static vmhd(e){return Zb(e,!0,((e,t)=>{e.graphicsmode=Gb(t),e.opcolor=[Gb(t,2),Gb(t,4),Gb(t,6)]}))}static smhd(e){return Zb(e,!0,((e,t)=>{e.balance=Gb(t)}))}static stbl(e){return Zb(e,!1,((e,t,i)=>{var s,r,o;e.stsd=iv.stsd(iv.findBox(t,["stsd"],i)[0]),e.stts=iv.stts(iv.findBox(t,["stts"],i)[0]),e.ctts=iv.ctts(iv.findBox(t,["ctts"],i)[0]),e.stsc=iv.stsc(iv.findBox(t,["stsc"],i)[0]),e.stsz=iv.stsz(iv.findBox(t,["stsz"],i)[0]),e.stco=iv.stco(iv.findBox(t,["stco"],i)[0]),e.stco||(e.co64=iv.co64(iv.findBox(t,["co64"],i)[0]),e.stco=e.co64);const a=null===(s=e.stsd.entries[0])||void 0===s||null===(r=s.sinf)||void 0===r||null===(o=r.schi)||void 0===o?void 0:o.tenc.default_IV_size;e.stss=iv.stss(iv.findBox(t,["stss"],i)[0]),e.senc=iv.senc(iv.findBox(t,["senc"],i)[0],a)}))}static senc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return Zb(e,!0,((e,i)=>{let s=0;const r=Wb(i,s);s+=4,e.samples=[];for(let o=0;o{const i=[],s=[];let r=0;for(let e=0;e<16;e++)s.push(tv(t[r+e]));if(r+=16,e.version>0){const e=Wb(t,r);r+=4;for(let s=0;s<(""+e).length;s++)for(let e=0;e<16;e++){const e=t[r];r+=1,i.push(tv(e))}}const o=Wb(t,r);e.data_size=o,r+=4,e.kid=i,e.system_id=s,e.buffer=t}))}static stsd(e){return Zb(e,!0,((e,t,i)=>{e.entryCount=Wb(t),e.entries=iv.findBox(t.subarray(4),[],i+4).map((e=>{switch(e.type){case"avc1":case"avc2":case"avc3":case"avc4":return iv.avc1(e);case"hvc1":case"hev1":return iv.hvc1(e);case"mp4a":return iv.mp4a(e);case"alaw":case"ulaw":return iv.alaw(e);case"enca":return Zb(e,!1,((e,t,i)=>{e.channelCount=Gb(t,16),e.samplesize=Gb(t,18),e.sampleRate=Wb(t,24)/65536,t=t.subarray(28),e.sinf=iv.sinf(iv.findBox(t,["sinf"],i)[0]),e.esds=iv.esds(iv.findBox(t,["esds"],i)[0])}));case"encv":return Zb(e,!1,((e,t,i)=>{e.width=Gb(t,24),e.height=Gb(t,26),e.horizresolution=Wb(t,28),e.vertresolution=Wb(t,32),t=t.subarray(78),e.sinf=iv.sinf(iv.findBox(t,["sinf"],i)[0]),e.avcC=iv.avcC(iv.findBox(t,["avcC"],i)[0]),e.hvcC=iv.hvcC(iv.findBox(t,["hvcC"],i)[0]),e.pasp=iv.pasp(iv.findBox(t,["pasp"],i)[0])}))}})).filter(Boolean)}))}static tenc(e){return Zb(e,!1,((e,t)=>{let i=6;e.default_IsEncrypted=t[i],i+=1,e.default_IV_size=t[i],i+=1,e.default_KID=[];for(let s=0;s<16;s++)e.default_KID.push(tv(t[i])),i+=1}))}static schi(e){return Zb(e,!1,((e,t,i)=>{e.tenc=iv.tenc(iv.findBox(t,["tenc"],i)[0])}))}static sinf(e){return Zb(e,!1,((e,t,i)=>{e.schi=iv.schi(iv.findBox(t,["schi"],i)[0]),e.frma=iv.frma(iv.findBox(t,["frma"],i)[0])}))}static frma(e){return Zb(e,!1,((e,t)=>{e.data_format="";for(let i=0;i<4;i++)e.data_format+=String.fromCharCode(t[i])}))}static avc1(e){return Zb(e,!1,((e,t,i)=>{const s=Qb(e,t),r=t.subarray(s);i+=s,e.avcC=iv.avcC(iv.findBox(r,["avcC"],i)[0]),e.pasp=iv.pasp(iv.findBox(r,["pasp"],i)[0])}))}static avcC(e){return Zb(e,!1,((e,t)=>{e.configurationVersion=t[0],e.AVCProfileIndication=t[1],e.profileCompatibility=t[2],e.AVCLevelIndication=t[3],e.codec=function(e){let t,i="avc1.";for(let s=0;s<3;s++)t=e[s].toString(16),t.length<2&&(t=`0${t}`),i+=t;return i}([t[1],t[2],t[3]]),e.lengthSizeMinusOne=3&t[4],e.spsLength=31&t[5],e.sps=[];let i=6;for(let s=0;s{const s=Qb(e,t),r=t.subarray(s);i+=s,e.hvcC=iv.hvcC(iv.findBox(r,["hvcC"],i)[0]),e.pasp=iv.pasp(iv.findBox(r,["pasp"],i)[0])}))}static hvcC(e){return Zb(e,!1,((t,i)=>{t.data=e.data,t.codec="hev1.1.6.L93.B0",t.configurationVersion=i[0];const s=i[1];t.generalProfileSpace=s>>6,t.generalTierFlag=(32&s)>>5,t.generalProfileIdc=31&s,t.generalProfileCompatibility=Wb(i,2),t.generalConstraintIndicatorFlags=i.subarray(6,12),t.generalLevelIdc=i[12],t.avgFrameRate=Gb(i,19),t.numOfArrays=i[22],t.vps=[],t.sps=[],t.pps=[];let r=23,o=0,a=0,n=0;for(let e=0;e{e.hSpacing=Wb(t),e.vSpacing=Wb(t,4)}))}static mp4a(e){return Zb(e,!1,((e,t,i)=>{const s=Xb(e,t);e.esds=iv.esds(iv.findBox(t.subarray(s),["esds"],i+s)[0])}))}static esds(e){return Zb(e,!0,((e,t)=>{e.codec="mp4a.";let i=0,s=0,r=0,o=0;for(;t.length;){for(i=0,o=t[i],s=t[i+1],i+=2;128&s;)r=(127&s)<<7,s=t[i],i+=1;if(r+=127&s,3===o)t=t.subarray(i+3);else{if(4!==o){if(5===o){const s=e.config=t.subarray(i,i+r);let o=(248&s[0])>>3;return 31===o&&s.length>=2&&(o=32+((7&s[0])<<3)+((224&s[1])>>5)),e.objectType=o,e.codec+=o.toString(16),void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}return void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}e.codec+=(t[i].toString(16)+".").padStart(3,"0"),t=t.subarray(i+13)}}}))}static alaw(e){return Zb(e,!1,((e,t)=>{Xb(e,t)}))}static stts(e){return Zb(e,!0,((e,t)=>{const i=Wb(t),s=[];let r=4;for(let e=0;e{const i=Wb(t),s=[];let r=4;if(1===e.version)for(let e=0;e{const i=Wb(t),s=[];let r=4;for(let e=0;e{const i=Wb(t),s=Wb(t,4),r=[];if(!i){let e=8;for(let i=0;i{const i=Wb(t),s=[];let r=4;for(let e=0;e{const i=Wb(t),s=[];let r=4;for(let e=0;e{const i=Wb(t),s=[];let r=4;for(let e=0;e{e.mfhd=iv.mfhd(iv.findBox(t,["mfhd"],i)[0]),e.traf=iv.findBox(t,["traf"],i).map((e=>iv.traf(e)))}))}static mfhd(e){return Zb(e,!0,((e,t)=>{e.sequenceNumber=Wb(t)}))}static traf(e){return Zb(e,!1,((e,t,i)=>{e.tfhd=iv.tfhd(iv.findBox(t,["tfhd"],i)[0]),e.tfdt=iv.tfdt(iv.findBox(t,["tfdt"],i)[0]),e.trun=iv.trun(iv.findBox(t,["trun"],i)[0])}))}static trun(e){return Zb(e,!0,((e,t)=>{const{version:i,flags:s}=e,r=t.length,o=e.sampleCount=Wb(t);let a=4;if(r>a&&1&s&&(e.dataOffset=-(1+~Wb(t,a)),a+=4),r>a&&4&s&&(e.firstSampleFlags=Wb(t,a),a+=4),e.samples=[],r>a){let r;for(let n=0;n{1===e.version?e.baseMediaDecodeTime=zb(t):e.baseMediaDecodeTime=Wb(t)}))}static probe(e){return!!iv.findBox(e,["ftyp"])}static parseSampleFlags(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}}static moovToTrack(e,t,i){var s,r;const o=e.trak;if(!o||!o.length)return;const a=o.find((e=>{var t,i;return"vide"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)})),n=o.find((e=>{var t,i;return"soun"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)}));if(a&&t){var l,d,h,c,u,p,f;const i=t,s=null===(l=a.tkhd)||void 0===l?void 0:l.trackId;null!=s&&(i.id=a.tkhd.trackId),i.tkhdDuration=a.tkhd.duration,i.mvhdDurtion=e.mvhd.duration,i.mvhdTimecale=e.mvhd.timescale,i.timescale=i.formatTimescale=a.mdia.mdhd.timescale,i.duration=a.mdia.mdhd.duration||i.mvhdDurtion/i.mvhdTimecale*i.timescale;const r=a.mdia.minf.stbl.stsd.entries[0];if(i.width=r.width,i.height=r.height,r.pasp&&(i.sarRatio=[r.pasp.hSpacing,r.pasp.vSpacing]),r.hvcC)i.codecType=qb,i.codec=r.hvcC.codec,i.vps=r.hvcC.vps,i.sps=r.hvcC.sps,i.pps=r.hvcC.pps,i.hvcC=r.hvcC.data;else{if(!r.avcC)throw new Error("unknown video stsd entry");i.codecType=Jb,i.codec=r.avcC.codec,i.sps=r.avcC.sps,i.pps=r.avcC.pps}var m,g,y,A,b,v,_,w;if(i.present=!0,i.ext={},i.ext.stss=null===(d=a.mdia)||void 0===d||null===(h=d.minf)||void 0===h||null===(c=h.stbl)||void 0===c?void 0:c.stss,i.ext.ctts=null===(u=a.mdia)||void 0===u||null===(p=u.minf)||void 0===p||null===(f=p.stbl)||void 0===f?void 0:f.ctts,r&&"encv"===r.type)i.isVideoEncryption=!0,r.default_KID=null===(m=r.sinf)||void 0===m||null===(g=m.schi)||void 0===g?void 0:g.tenc.default_KID,r.default_IsEncrypted=null===(y=r.sinf)||void 0===y||null===(A=y.schi)||void 0===A?void 0:A.tenc.default_IsEncrypted,r.default_IV_size=null===(b=r.sinf)||void 0===b||null===(v=b.schi)||void 0===v?void 0:v.tenc.default_IV_size,i.videoSenc=a.mdia.minf.stbl.senc&&a.mdia.minf.stbl.senc.samples,r.data_format=null===(_=r.sinf)||void 0===_||null===(w=_.frma)||void 0===w?void 0:w.data_format,i.useEME=e.useEME,i.kidValue=e.kidValue,i.pssh=e.pssh,i.encv=r}if(n&&i){var S,E,T,k,L,C,x,D,R;const t=i,o=null===(S=n.tkhd)||void 0===S?void 0:S.trackId;null!=o&&(t.id=n.tkhd.trackId),t.tkhdDuration=n.tkhd.duration,t.mvhdDurtion=e.mvhd.duration,t.mvhdTimecale=e.mvhd.timescale,t.timescale=t.formatTimescale=n.mdia.mdhd.timescale,t.duration=n.mdia.mdhd.duration||t.mvhdDurtion/t.mvhdTimecale*t.timescale;const a=n.mdia.minf.stbl.stsd.entries[0];switch(t.sampleSize=a.sampleSize,t.sampleRate=a.sampleRate,t.channelCount=a.channelCount,t.present=!0,a.type){case"alaw":t.codecType=t.codec=Vb,t.sampleRate=8e3;break;case"ulaw":t.codecType=t.codec=Hb,t.sampleRate=8e3;break;default:t.codecType=$b,t.sampleDuration=Kb.getFrameDuration(t.sampleRate,t.timescale),t.sampleRateIndex=Kb.getRateIndexByRate(t.sampleRate),t.objectType=(null===(s=a.esds)||void 0===s?void 0:s.objectType)||2,a.esds&&(t.config=Array.from(a.esds.config)),t.codec=(null===(r=a.esds)||void 0===r?void 0:r.codec)||"mp4a.40.2"}var P,I,B,M,F,U,O,N;if(t.sampleDuration=Kb.getFrameDuration(t.sampleRate,t.timescale),t.objectType=(null===(E=a.esds)||void 0===E?void 0:E.objectType)||2,a.esds&&(a.esds.config?t.config=Array.from(a.esds.config):console.warn("esds config is null")),t.codec=(null===(T=a.esds)||void 0===T?void 0:T.codec)||"mp4a.40.2",t.sampleRateIndex=Kb.getRateIndexByRate(t.sampleRate),t.ext={},t.ext.stss=null===(k=n.mdia)||void 0===k||null===(L=k.minf)||void 0===L||null===(C=L.stbl)||void 0===C?void 0:C.stss,t.ext.ctts=null===(x=n.mdia)||void 0===x||null===(D=x.minf)||void 0===D||null===(R=D.stbl)||void 0===R?void 0:R.ctts,t.present=!0,a&&"enca"===a.type)t.isAudioEncryption=!0,a.data_format=null===(P=a.sinf)||void 0===P||null===(I=P.frma)||void 0===I?void 0:I.data_format,a.default_KID=null===(B=a.sinf)||void 0===B||null===(M=B.schi)||void 0===M?void 0:M.tenc.default_KID,a.default_IsEncrypted=null===(F=a.sinf)||void 0===F||null===(U=F.schi)||void 0===U?void 0:U.tenc.default_IsEncrypted,a.default_IV_size=null===(O=a.sinf)||void 0===O||null===(N=O.schi)||void 0===N?void 0:N.tenc.default_IV_size,t.audioSenc=n.mdia.minf.stbl.senc&&n.mdia.minf.stbl.senc.samples,t.useEME=e.useEME,t.kidValue=e.kidValue,t.enca=a}if(i&&(i.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!i&&i.isAudioEncryption),null!=t&&t.encv||null!=i&&i.enca){var j,G;const e=null==t||null===(j=t.encv)||void 0===j?void 0:j.default_KID,s=null==i||null===(G=i.enca)||void 0===G?void 0:G.default_KID,r=e||s?(e||s).join(""):null;t&&(t.kid=r),i&&(i.kid=r)}return t&&(t.flags=3841),i&&(i.flags=1793),{videoTrack:t,audioTrack:i}}static evaluateDefaultDuration(e,t,i){var s;const r=null==t||null===(s=t.samples)||void 0===s?void 0:s.length;if(!r)return 1024;return 1024*r/t.timescale*e.timescale/i}static moofToSamples(e,t,i){const s={};return e.mfhd&&(t&&(t.sequenceNumber=e.mfhd.sequenceNumber),i&&(i.sequenceNumber=e.mfhd.sequenceNumber)),e.traf.forEach((e=>{let{tfhd:r,tfdt:o,trun:a}=e;if(!r||!a)return;o&&(t&&t.id===r.trackId&&(t.baseMediaDecodeTime=o.baseMediaDecodeTime),i&&i.id===r.trackId&&(i.baseMediaDecodeTime=o.baseMediaDecodeTime));const n=r.defaultSampleSize||0,l=r.defaultSampleDuration||iv.evaluateDefaultDuration(t,i,a.samples.length||a.sampleCount);let d=a.dataOffset||0,h=0,c=-1;if(!a.samples.length&&a.sampleCount){s[r.trackId]=[];for(let e=0;e((e={offset:d,dts:h,pts:h+(e.cts||0),duration:e.duration||l,size:e.size||n,gopId:c,keyframe:0===t||null!==e.flags&&void 0!==e.flags&&(65536&e.flags)>>>0!=65536}).keyframe&&(c++,e.gopId=c),h+=e.duration,d+=e.size,e)))})),s}static moovToSamples(e){const t=e.trak;if(!t||!t.length)return;const i=t.find((e=>{var t,i;return"vide"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)})),s=t.find((e=>{var t,i;return"soun"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)}));if(!i&&!s)return;let r,o;if(i){var a,n;const e=null===(a=i.mdia)||void 0===a||null===(n=a.minf)||void 0===n?void 0:n.stbl;if(!e)return;const{stts:t,stsc:s,stsz:o,stco:l,stss:d,ctts:h}=e;if(!(t&&s&&o&&l&&d))return;r=Yb(t,s,o,l,h,d)}if(s){var l,d,h;const e=null===(l=s.mdia)||void 0===l||null===(d=l.minf)||void 0===d?void 0:d.stbl;if(!e)return;const t=null===(h=s.mdia.mdhd)||void 0===h?void 0:h.timescale,{stts:i,stsc:r,stsz:a,stco:n}=e;if(!(t&&i&&r&&a&&n))return;o=Yb(i,r,a,n)}return{videoSamples:r,audioSamples:o}}}class sv extends th{constructor(e){super(e),this.player=e,this.TAG_NAME="HlsFmp4Loader",this.tempSampleListInfo={},this.isInitVideo=!1,this.isInitAudio=!1,this.videoTrack={id:1,samples:[],sps:[],pps:[],vps:[],codec:""},this.audioTrack={id:2,samples:[],sampleRate:0,channelCount:0,codec:"",codecType:""},this.workerClearTimeout=null,this.workerUrl=null,this.loopWorker=null,this._hasCalcFps=!1,this._tempSampleTsList=[],this._basefps=25,this._isUseWorker()&&this._initLoopWorker(),e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.workerUrl&&(URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.loopWorker&&(this.loopWorker.postMessage({cmd:"destroy"}),this.loopWorker.terminate(),this.loopWorker=null),this._hasCalcFps=!1,this._tempSampleTsList=[],this.videoTrack=null,this.audioTrack=null,this.isInitVideo=!1,this.isInitAudio=!1,this._basefps=25,this.player.debugLog(this.TAG_NAME,"destroy")}demux(e,t){let i=this.audioTrack,s=this.videoTrack;if(this.checkInitAudio(),this.checkInitVideo(),i.samples=[],s.samples=[],t){if(this.player.updateStats({abps:t.byteLength}),ya(this.isInitAudio)){const e=iv.findBox(t,["moov"])[0];if(!e)return void this.player.debugError(this.TAG_NAME,"cannot found moov box");iv.moovToTrack(iv.moov(e),null,i),this.checkInitAudio()&&(this.player.debugLog(this.TAG_NAME,"audioData audio init success"),this._sendAccADTSHeader(i))}const e=iv.findBox(t,["moof"])[0];if(e){const s=iv.moofToSamples(iv.moof(e),null,i)[i.id],r=i.baseMediaDecodeTime;if(s){const o=e.start;s.map((e=>{e.offset+=o;const s=t.subarray(e.offset,e.offset+e.size),a=e.dts+r,n=new Uint8Array(s.length+2);n.set([175,1],0),n.set(s,2),i.samples.push({type:Ue,pts:a,dts:a,payload:n,duration:e.duration,size:n.byteLength})}))}}}if(e){if(this.player.updateStats({vbps:e.byteLength}),ya(this.isInitVideo)&&ya(this.isInitAudio)){const t=iv.findBox(e,["moov"])[0];if(!t)throw new Error("cannot found moov box");if(iv.moovToTrack(iv.moov(t),s,i),ya(this.isInitAudio)&&this.checkInitAudio()&&(this.player.debugLog(this.TAG_NAME,"videoData audio init success",i),this._sendAccADTSHeader(i)),this.checkInitVideo()){this.player.debugLog(this.TAG_NAME,"video init success");let e=null;s.codecType===ss?s.sps.length&&s.vps.length&&s.pps.length&&(e=Yn({sps:s.sps[0],pps:s.pps[0],vps:s.vps[0]})):s.sps.length&&s.pps.length&&(e=Fn({sps:s.sps[0],pps:s.pps[0]})),e&&(this.player.debugLog(this.TAG_NAME,"seqHeader"),this._doDecodeByHls(e,Oe,0,!0,0))}}const t=iv.findBox(e,["moof"])[0];if(t){const r=iv.moofToSamples(iv.moof(t),s,i),o=s.baseMediaDecodeTime,a=i.baseMediaDecodeTime,n=t.start;Object.keys(r).forEach((t=>{s.id==t?r[t].map((t=>{t.offset+=n;const i={type:Oe,pts:(t.pts||t.dts)+o,dts:t.dts+o,units:[],payload:null,isIFrame:!1};i.duration=t.duration,i.gopId=t.gopId,t.keyframe&&(i.isIFrame=!0);const r=e.subarray(t.offset,t.offset+t.size);i.payload=r,s.samples.push(i)})):i.id==t&&r[t].map((t=>{t.offset+=n;const s=e.subarray(t.offset,t.offset+t.size),r=t.dts+a,o=new Uint8Array(s.length+2);o.set([175,1],0),o.set(s,2),i.samples.push({type:Ue,pts:r,dts:r,payload:o,duration:t.duration,size:o.byteLength})}))}))}}const r=s.samples.concat(i.samples);r.sort(((e,t)=>e.dts-t.dts)),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,this._isUseWorker()?this.loopWorker.postMessage({...e,payload:t,cmd:"sample"},[t.buffer]):e.type===Oe?this._doDecodeVideo({...e,payload:t}):e.type===Ue&&this._doDecodeAudio({...e,payload:t})})),ya(this._hasCalcFps)&&this._isUseWorker()&&(this._hasCalcFps=this._calcDecodeFps(r))}checkInitAudio(){return this.isInitAudio=!!(this.audioTrack.sampleRate&&this.audioTrack.channelCount&&this.audioTrack.codec&&"aac"===this.audioTrack.codecType),this.isInitAudio}checkInitVideo(){return this.isInitVideo=!!(this.videoTrack.pps.length&&this.videoTrack.sps.length&&this.videoTrack.codec),this.isInitVideo}_sendAccADTSHeader(e){const t=Ur({profile:e.objectType,sampleRate:e.sampleRateIndex,channel:e.channelCount});this._doDecodeByHls(t,Ue,0,!0,0)}_calcDecodeFps(e){const t=e.map((e=>({ts:e.dts||e.pts,type:e.type})));this._tempSampleTsList=this._tempSampleTsList.concat(t);const i=la(this._tempSampleTsList,Oe);if(i)this._tempSampleTsList=[],this.player.debugLog(this.TAG_NAME,`_calcDecodeFps() video fps is ${i}, update base fps is ${this._basefps}`),this._basefps=i,this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps});else if(this.player.debugLog(this.TAG_NAME,"_calcDecodeFps() streamVideoFps is null"),this._tempSampleTsList.length>200)return this.player.debugLog(this.TAG_NAME,`_calcDecodeFps() _tempSampleTsList is more than 200, clear and use base fps update ${this._basefps}`),this._tempSampleTsList=[],this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps}),!0;return null!==i}_isUseWorker(){return!this.player.isUseMSE()}_initLoopWorker(){this.player.debugLog(this.TAG_NAME,"_initLoopWorker()");const e=Ea(function(){const e=1,t=2;let i=new class{constructor(){this.baseFps=0,this.fpsInterval=null,this.preLoopTimestamp=null,this.startBpsTime=null,this.allSampleList=[]}destroy(){this._clearInterval(),this.baseFps=0,this.allSampleList=[],this.preLoopTimestamp=null,this.startBpsTime=null}updateBaseFps(e){this.baseFps=e,this._clearInterval(),this._startInterval()}pushSample(e){delete e.cmd,this.allSampleList.push(e)}_startInterval(){const e=Math.ceil(1e3/this.baseFps);this.fpsInterval=setInterval((()=>{let t=(new Date).getTime();this.preLoopTimestamp||(this.preLoopTimestamp=t),this.startBpsTime||(this.startBpsTime=t);const i=t-this.preLoopTimestamp;if(i>2*e&&console.warn(`JbPro:[HlsFmp4Loader LoopWorker] loop interval is ${i}ms, more than ${e} * 2ms`),this._loop(),this.preLoopTimestamp=(new Date).getTime(),this.startBpsTime){t-this.startBpsTime>=1e3&&(this._calcSampleList(),this.startBpsTime=t)}}),e)}_clearInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_calcSampleList(){const i={buferredDuration:0,allListLength:this.allSampleList.length,audioListLength:0,videoListLength:0};this.allSampleList.forEach((s=>{s.type===t?(i.videoListLength++,s.duration&&(i.buferredDuration+=s.duration)):s.type===e&&i.audioListLength++})),postMessage({cmd:"sampleListInfo",...i})}_loop(){let i=null;if(this.allSampleList.length)if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]);let t=this.allSampleList[0];for(;t&&t.type===e;)i=this.allSampleList.shift(),postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),t=this.allSampleList[0]}else if(i.type===e){postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]);let s=this.allSampleList[0];for(;s;){if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]),s=null;break}i.type===e&&(postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),s=this.allSampleList[0])}}}};self.onmessage=e=>{const t=e.data;switch(t.cmd){case"updateBaseFps":i.updateBaseFps(t.baseFps);break;case"sample":i.pushSample(t);break;case"destroy":i.destroy(),i=null}}}.toString()),t=new Blob([e],{type:"text/javascript"}),i=URL.createObjectURL(t);let s=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((()=>{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),ie),s.onmessage=e=>{const t=e.data;switch(t.cmd){case"decodeVideo":this._doDecodeVideo(t);break;case"decodeAudio":this._doDecodeAudio(t);break;case"sampleListInfo":this.tempSampleListInfo=t}},this.loopWorker=s}_postMessageToLoopWorker(e,t){this._isUseWorker()&&(this.loopWorker?this.loopWorker.postMessage({cmd:e,...t}):this.player.debugWarn(this.TAG_NAME,"loop worker is not init, can not post message"))}_doDecodeAudio(e){const t=new Uint8Array(e.payload);this.player.updateStats({abps:t.byteLength}),this.cryptoPayloadAudio(t),this._doDecodeByHls(t,Ue,e.dts,!1,0)}_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?Qn(t,e.isIFrame):Un(t,e.isIFrame),this.player.updateStats({dts:e.dts,vbps:i.byteLength});const s=e.pts-e.dts;let r=this.cryptoPayload(i,e.isIFrame);this._doDecodeByHls(r,Oe,e.dts,e.isIFrame,s)}getBuferredDuration(){return this.tempSampleListInfo.buferredDuration||0}getSampleListLength(){return this.tempSampleListInfo.allListLength||0}getSampleAudioListLength(){return this.tempSampleListInfo.audioListLength||0}getSampleVideoListLength(){return this.tempSampleListInfo.videoListLength||0}}class rv{constructor(e,t){this.hls=e,this.player=this.hls.player,this.isMP4=t,this._initSegmentId="",this.TAG_NAME="HlsTransmuxer",this._demuxer=t?new sv(this.hls.player):new jb(this.hls.player),this.player.debugLog(this.TAG_NAME,`init and isMP4 is ${t}`)}destroy(){this._demuxer&&(this._demuxer.destroy(),this._demuxer=null)}transmux(e,t,i,s,r,o){this.player.debugLog(this.TAG_NAME,`transmux videoChunk:${e&&e.byteLength}, audioChunk:${t&&t.byteLength}, discontinuity:${i}, contiguous:${s}, startTime:${r}, needInit:${o}`);const a=this._demuxer;try{this.isMP4?a.demux(e,t):a.demuxAndFix(wh(e,t),i,s,r)}catch(e){throw new pb(ub,cb,e)}}}class ov{constructor(e){this.hls=e,this.player=e.player,this._decryptor=new Nb(this.hls,this.player),this._transmuxer=null,this._mse=null,this._softVideo=null,this._sourceCreated=!1,this._needInitSegment=!0,this._directAppend=!1,this.TAG_NAME="HlsBufferService"}async destroy(){this._softVideo=null,this._transmuxer&&(this._transmuxer.destroy(),this._transmuxer=null)}get baseDts(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t._baseDts}get nbSb(){return 0}async updateDuration(e){this.player.debugLog(this.TAG_NAME,"updateDuration()",e)}getBuferredDuration(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getBuferredDuration()}getBufferedSegments(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleListLength()}getBufferedAudioSegments(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleAudioListLength()}getBufferedVideoSegments(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleVideoListLength()}createSource(e,t,i,s){if(this._sourceCreated)return;const r=e||t;r&&(jb.probe(r)?this._transmuxer||(this._transmuxer=new rv(this.hls,!1)):iv.probe(r)?this._transmuxer||(this._transmuxer=new rv(this.hls,!0)):this.player.debugError(this.TAG_NAME,"createSource error: chunk is not ts"))}async appendBuffer(e,t,i,s,r,o,a){if(null!=i&&i.length||null!=s&&s.length)return this._needInitSegment,this._transmuxer.transmux(i,s,r,o,a,this._needInitSegment||r),!0}async clearAllBuffer(){this.player.debugLog(this.TAG_NAME,"clearAllBuffer")}decryptBuffer(e,t){return this._decryptor.decrypt(e,t)}async reset(){this._transmuxer=null,this._needInitSegment=!0,this._directAppend=!1}async endOfStream(){this._softVideo&&this._softVideo.endOfStream()}async setLiveSeekableRange(e,t){}seamlessSwitch(){this._needInitSegment=!0}}class av{constructor(e){this.emitter=e,this._seiSet=new Set,e.on(Ws,(e=>{e&&this._seiSet.add(e)}))}throw(e){if(null==e||!this._seiSet.size)return;const t=e-.2,i=e+.2,s=[];this._seiSet.forEach((e=>{e.time>=t&&e.time<=i&&s.push(e)})),s.forEach((e=>{this._seiSet.delete(e),this.emitter.emit(zs,e)}))}reset(){this._seiSet.clear()}}class nv{constructor(e){this._timescale=e,this.encodeType="",this.audioCodec="",this.videoCodec="",this.domain="",this.fps=0,this.bitrate=0,this.width=0,this.height=0,this.samplerate=0,this.channelCount=0,this.gop=0,this._bitsAccumulateSize=0,this._bitsAccumulateDuration=0}getStats(){return{encodeType:this.encodeType,audioCodec:this.audioCodec,videoCodec:this.videoCodec,domain:this.domain,fps:this.fps,bitrate:this.bitrate,width:this.width,height:this.height,samplerate:this.samplerate,channelCount:this.channelCount,gop:this.gop}}setEncodeType(e){this.encodeType=e}setFpsFromScriptData(e){var t;let{data:i}=e;const s=null==i||null===(t=i.onMetaData)||void 0===t?void 0:t.framerate;s&&s>0&&s<100&&(this.fps=s)}setVideoMeta(e){if(this.width=e.width,this.height=e.height,this.videoCodec=e.codec,this.encodeType=e.codecType,e.fpsNum&&e.fpsDen){const t=e.fpsNum/e.fpsDen;t>0&&t<100&&(this.fps=t)}}setAudioMeta(e){this.audioCodec=e.codec,this.samplerate=e.sampleRate,this.channelCount=e.channelCount}setDomain(e){this.domain=e.split("/").slice(2,3)[0]}updateBitrate(e){if((!this.fps||this.fps>=100)&&e.length){const t=e.reduce(((e,t)=>e+t.duration),0)/e.length;this.fps=Math.round(this._timescale/t)}e.forEach((e=>{1===e.gopId&&this.gop++,this._bitsAccumulateDuration+=e.duration/(this._timescale/1e3),this._bitsAccumulateSize+=e.units.reduce(((e,t)=>e+t.length),0),this._bitsAccumulateDuration>=1e3&&(this.bitrate=8*this._bitsAccumulateSize,this._bitsAccumulateDuration=0,this._bitsAccumulateSize=0)}))}}class lv{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;uh(this,"_core",null),uh(this,"_samples",[]),this._core=e,this._timescale=t,this._stats=new nv(t),this._bindEvents()}getStats(){var e,t,i,s,r,o,a;const{currentTime:n=0,decodeFps:l=0}=(null===(e=this._core)||void 0===e?void 0:e.media)||{};return{...this._stats.getStats(),downloadSpeed:(null===(t=this._core)||void 0===t||null===(i=t.speedInfo)||void 0===i?void 0:i.call(t).speed)||0,avgSpeed:(null===(s=this._core)||void 0===s||null===(r=s.speedInfo)||void 0===r?void 0:r.call(s).avgSpeed)||0,currentTime:n,bufferEnd:(null===(o=this._core)||void 0===o||null===(a=o.bufferInfo())||void 0===a?void 0:a.remaining)||0,decodeFps:l}}_bindEvents(){this._core.on(Is,(e=>this._stats.updateBitrate(e.samples))),this._core.on(Bs,(e=>{this._stats.setFpsFromScriptData(e)})),this._core.on(Ms,(e=>{"video"===e.type?this._stats.setVideoMeta(e.track):this._stats.setAudioMeta(e.track)})),this._core.on(Fs,(e=>{this._stats.setDomain(e.responseUrl)}))}reset(){this._samples=[],this._stats=new nv(this._timescale)}}class dv extends o{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),uh(this,"_loadSegment",(async()=>{if(this._segmentProcessing)return void this.player.debugWarn("_loadSegment()","_segmentProcessing is ture and return");if(!this._playlist)return void this.player.debugWarn("_loadSegment()","this._playlist is null and return");const e=this._playlist.currentSegment,t=this._playlist.nextSegment;if(this.player.debugLog(this.TAG_NAME,"_loadSegment()","curSeg",e&&e.url,"nextSeg",t&&t.url),t)return this._loadSegmentDirect();this.player.debugLog(this.TAG_NAME,"nextSeg is null and return")})),this.player=e,this.config=null,this._manifestLoader=null,this._segmentLoader=null,this._playlist=null,this._bufferService=null,this._seiService=null,this._stats=null,this._prevSegSn=null,this._prevSegCc=null,this._tickTimer=null,this._tickInterval=500,this._segmentProcessing=!1,this._reloadOnPlay=!1,this._switchUrlOpts=null,this._disconnectTimer=null,this.TAG_NAME="Hls256",this.canVideoPlay=!1,this.$videoElement=null,this.config=t=function(e){return{isLive:!0,maxPlaylistSize:50,retryCount:3,retryDelay:1e3,pollRetryCount:2,loadTimeout:1e4,preloadTime:30,softDecode:!1,bufferBehind:10,maxJumpDistance:3,startTime:0,targetLatency:10,maxLatency:20,allowedStreamTrackChange:!0,...e}}(t),this._manifestLoader=new Bb(this),this._segmentLoader=new Fb(this),this._playlist=new Ob(this),this._bufferService=new ov(this),this._seiService=new av(this),this._stats=new lv(this,9e4),this.player.debugLog(this.TAG_NAME,"init")}async destroy(){this.player.debugLog(this.TAG_NAME,"destroy()"),this._playlist.reset(),this._segmentLoader.reset(),this._seiService.reset(),await Promise.all([this._clear(),this._bufferService.destroy()]),this._manifestLoader&&(await this._manifestLoader.destroy(),this._manifestLoader=null),this._segmentLoader&&(this._segmentLoader.destroy(),this._segmentLoader=null),this._playlist&&(this._playlist.destroy(),this._playlist=null),this.player.debugLog(this.TAG_NAME,"destroy end")}_startTick(){this._stopTick(),this._tickTimer=setTimeout((()=>{this._tick()}),this._tickInterval)}_stopTick(){this._tickTimer&&clearTimeout(this._tickTimer),this._tickTimer=null}_tick(){this.player.isDestroyedOrClosed()?this.player.debugLog(this.TAG_NAME,"_tick() player is destroyed"):(this._startTick(),this._loadSegment())}get isLive(){return this._playlist.isLive}get streams(){return this._playlist.streams}get currentStream(){return this._playlist.currentStream}get hasSubtitle(){return this._playlist.hasSubtitle}get baseDts(){var e;return null===(e=this._bufferService)||void 0===e?void 0:e.baseDts}speedInfo(){return this._segmentLoader.speedInfo()}resetBandwidth(){this._segmentLoader.resetBandwidth()}getStats(){return this._stats.getStats()}async loadSource(e){return await this._reset(),await this._loadData(e),this._startTick(),!0}async _loadData(e){try{e&&(e=e.trim())}catch(e){}if(!e)throw this._emitError(new pb(db,db,null,null,"m3u8 url is missing"));const t=await this._loadM3U8(e),{currentStream:i}=this._playlist;if(this._urlSwitching){var s,r;if(0===i.bitrate&&null!==(s=this._switchUrlOpts)&&void 0!==s&&s.bitrate)i.bitrate=null===(r=this._switchUrlOpts)||void 0===r?void 0:r.bitrate;const e=this._getSeamlessSwitchPoint();this.config.startTime=e;const t=this._playlist.findSegmentIndexByTime(e),o=this._playlist.getSegmentByIndex(t+1);if(o){const e=o.start;this.player.debugWarn(this.TAG_NAME,`clear buffer from ${e}`)}}t&&(this.isLive?(this.player.debugLog(this.TAG_NAME,"is live"),this._bufferService.setLiveSeekableRange(0,4294967295),this.config.targetLatency{let[t,i,a]=e;t?(this._playlist.upsertPlaylist(t,i,a),this.isLive&&this._pollM3U8(s,r,o)):this.player.debugWarn(this.TAG_NAME,"_refreshM3U8() mediaPlaylist is empty")})).catch((e=>{throw this._emitError(pb.create(e))}))}_pollM3U8(e,t,i){var s;let r=this._playlist.isEmpty;this._manifestLoader.poll(e,t,i,((e,t,i)=>{this._playlist.upsertPlaylist(e,t,i),this._playlist.clearOldSegment(),e&&r&&!this._playlist.isEmpty&&this._loadSegment(),r&&(r=this._playlist.isEmpty)}),(e=>{this._emitError(pb.create(e))}),1e3*((null===(s=this._playlist.lastSegment)||void 0===s?void 0:s.duration)||0))}async _loadSegmentDirect(){const e=this._playlist.nextSegment;if(!e)return void this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect() !seg");let t=!1,i=null;try{this._segmentProcessing=!0,t=await this._reqAndBufferSegment(e,this._playlist.getAudioSegment(e))}catch(e){i=e}finally{this._segmentProcessing=!1}return i?this._emitError(pb.create(i)):(t?(this._urlSwitching&&(this._urlSwitching=!1,this.emit(Vs,{url:this.config.url})),this._playlist.moveSegmentPointer(),this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect()","seg.isLast",e.isLast),e.isLast?(this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect()","seg.isLast"),this._end()):(this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect()","and next _loadSegment()"),this._loadSegment())):this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect() not appended"),t)}async _reqAndBufferSegment(e,t){this.player.debugLog(this.TAG_NAME,"video seg",e&&e.url,"audio seg",t&&t.url);const i=e?e.cc:t.cc,s=this._prevSegCc!==i;let r=[];try{r=await this._segmentLoader.load(e,t,s)}catch(e){throw e.fatal=!1,this._segmentLoader.error=e,e}if(!r[0])return;const o=await this._bufferService.decryptBuffer(...r);if(!o)return void this.player.debugLog(this.TAG_NAME,"decryptBuffer return null");const a=e?e.sn:t.sn,n=e?e.start:t.start,l=this._playlist.currentStream;return this._bufferService.createSource(o[0],o[1],null==l?void 0:l.videoCodec,null==l?void 0:l.audioCodec),await this._bufferService.appendBuffer(e,t,o[0],o[1],s,this._prevSegSn===a-1,n),this._prevSegCc=i,this._prevSegSn=a,!0}async _clear(){this.player.debugLog(this.TAG_NAME,"_clear()"),clearTimeout(this._disconnectTimer),this._stopTick(),await Promise.all([this._segmentLoader.cancel(),this._manifestLoader.stopPoll()]),this._segmentProcessing=!1}async _reset(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.player.debugLog(this.TAG_NAME,"_reset()"),this._reloadOnPlay=!1,this._prevSegSn=null,this._prevSegCc=null,this._switchUrlOpts=null,this._playlist.reset(),this._segmentLoader.reset(),this._seiService.reset(),this._stats.reset(),await this._clear(),this._bufferService.reset(e)}_end(){this.player.debugLog(this.TAG_NAME,"_end()"),this._clear()}_emitError(e){var t;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;!1===(null===(t=e.originError)||void 0===t?void 0:t.fatal)?console.warn(e):(console.table(e),console.error(e),console.error(null===(s=this.media)||void 0===s?void 0:s.error),this._stopTick(),this._urlSwitching&&(this._urlSwitching=!1,this.emit($s,e)),i&&this._end(),this._seiService.reset(),this.emit(qs,e));return e}_getSeamlessSwitchPoint(){const{media:e}=this;let t=e.currentTime;if(!e.paused){var i;const s=this._playlist.findSegmentIndexByTime(e.currentTime),r=this._playlist.getSegmentByIndex(s),o=null===(i=this._stats)||void 0===i?void 0:i.getStats().downloadSpeed;if(o&&r){t+=r.duration*this._playlist.currentStream.bitrate/o+1}else t+=5}return t}getDemuxBuferredDuration(){return this._bufferService.getBuferredDuration()||0}getDemuxBufferedListLength(){return this._bufferService.getBufferedSegments()||0}getDemuxAudioBufferedListLength(){return this._bufferService.getBufferedAudioSegments()||0}getDemuxVideoBufferedListLength(){return this._bufferService.getBufferedVideoSegments()||0}}class hv extends o{constructor(e){super(),uh(this,"TAG_NAME","Hls256Decoder"),this.player=e,this.$videoElement=this.player.video.$videoElement,this.hls=null,this.eventsDestroy=[],this.bandwidthEstimateInterval=null,this.hls=new dv(e),this._bindEvents()}async destroy(){return this._stopBandwidthEstimateInterval(),this.hls&&(await this.hls.destroy(),this.hls=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this.$videoElement=null,this.player.debugLog(this.TAG_NAME,"destroy"),!0}_bindEvents(){this.hls.on(qs,(e=>{this.player.emitError(dt.hlsError,e)})),this._startBandwidthEstimateInterval()}_startBandwidthEstimateInterval(){this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((()=>{const e=this.hls.speedInfo();this.player.emit(at.kBps,(e.avgSpeed/1024/8).toFixed(2)),this.hls.resetBandwidth()}),1e3)}_stopBandwidthEstimateInterval(){this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}async loadSource(e){return this.url=e,await this.hls.loadSource(e),!0}checkHlsBufferedDelay(){let e=0;return this.hls&&(e=this.hls.getDemuxBuferredDuration()),e}getDemuxBufferedListLength(){let e=0;return this.hls&&(e=this.hls.getDemuxBufferedListLength()),e}getDemuxAudioBufferedListLength(){let e=0;return this.hls&&(e=this.hls.getDemuxAudioBufferedListLength()),e}getDemuxVideoBufferedListLength(){let e=0;return this.hls&&(e=this.hls.getDemuxVideoBufferedListLength()),e}}class cv extends o{constructor(e,t){if(super(),this.player=e,this.player.$container.classList.add("jb-pro-container-playback"),this._showPrecision=null,this._startTime=null,this._playStartTime=null,this._playingTimestamp=null,this._fps=parseInt(t.fps,10)||e._opt.playbackFps,this._isUseFpsRender=!!ga(t.isUseFpsRender),this._rate=1,this._audioTimestamp=0,this._videoTimestamp=0,this.controlType=t.controlType||X.normal,t.controlType&&-1===[X.normal,X.simple].indexOf(t.controlType)&&(this.player.debugWarn("Playback","constructor()","controlType is not in [normal,simple]",t.controlType),this.controlType=X.normal),this._currentLocalTimestamp=0,this._localOneFrameTimestamp=t.localOneFrameTimestamp||40,this._localCalculateTimeInterval=null,this._isUseLocalCalculateTime=!!ga(t.isUseLocalCalculateTime),this._isPlaybackPauseClearCache=!ya(t.isPlaybackPauseClearCache),this._isCacheBeforeDecodeForFpsRender=!!ga(t.isCacheBeforeDecodeForFpsRender),this._startfpsTime=null,this._startFpsTimestamp=null,this._checkStatsInterval=null,this._playbackTs=0,this._renderFps=0,this._isUseLocalCalculateTime?this._startLocalCalculateTime():this._listen(),this.playbackList=[],this._playbackListStartTimestamp=null,this._totalDuration=0,t.controlType===X.normal)this.initPlaybackList(t.playList,t.showPrecision,t.startTime);else if(t.controlType===X.simple){t.duration&&(this._totalDuration=1e3*t.duration);let e=t.startTime||0;e>this.totalDuration&&(e=this.totalDuration),this.setStartTime(e)}this.player.on(at.playbackPause,(e=>{e?this.pause():this.resume()}));const i={fps:this._fps,isUseFpsRender:this._isUseFpsRender,localOneFrameTimestamp:this._localOneFrameTimestamp,isUseLocalCalculateTime:this._isUseLocalCalculateTime,uiUsePlaybackPause:t.uiUsePlaybackPause,showControl:t.showControl};try{e.debugLog("Playback","init",JSON.stringify(i))}catch(t){e.debugLog("Playback","init",i)}}destroy(){this._startTime=null,this._showPrecision=null,this._playStartTime=null,this._playingTimestamp=null,this._totalDuration=0,this._audioTimestamp=0,this._videoTimestamp=0,this._fps=null,this._isUseFpsRender=!1,this._rate=1,this.playbackList=[],this._playbackListStartTimestamp=null,this._localCalculateTimeInterval=null,this._currentLocalTimestamp=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._renderFps=0,this._playbackTs=0,this._stopLocalCalculateTime(),this.clearStatsInterval(),this.player.$container&&this.player.$container.classList.remove("jb-pro-container-playback"),this.off(),this.player.debugLog("Playback","destroy")}_listen(){this.player.on(at.stats,(e=>{const t=e.ts;this._playStartTime||(this._playStartTime=t-1e3);let i=t-this._playStartTime;this.setPlayingTimestamp(i)}))}pause(){this.clearStatsInterval()}resume(){this.startCheckStatsInterval()}updateStats(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._startFpsTimestamp||(this._startFpsTimestamp=ro()),Bo(e.ts)&&(this.player.updateStats({fps:!0,ts:e.ts}),this._playbackTs=e.ts,this._startfpsTime||(this._startfpsTime=e.ts),this._renderFps+=1);const t=ro(),i=t-this._startFpsTimestamp;if(i<1e3)return;let s=null;this._startfpsTime&&(s=this._playbackTs-this._startfpsTime),this.player.emit(at.playbackStats,{fps:this._renderFps,rate:this.rate,start:this._startfpsTime,end:this._playbackTs,timestamp:i,dataTimestamp:s,audioBufferSize:this.player.audio?this.player.audio.bufferSize:0,videoBufferSize:this.player.video?this.player.video.bufferSize:0,ts:this._playbackTs}),this._renderFps=0,this._startfpsTime=this._playbackTs,this._startFpsTimestamp=t}updateLocalOneFrameTimestamp(e){this._localOneFrameTimestamp=e}_startLocalCalculateTime(){this._stopLocalCalculateTime(),this._localCalculateTimeInterval=setInterval((()=>{const e=this._currentLocalTimestamp;this._playStartTime||(this._playStartTime=e-1e3);let t=e-this._playStartTime;this.setPlayingTimestamp(t)}),1e3)}startCheckStatsInterval(){this.clearStatsInterval(),this._checkStatsInterval=setInterval((()=>{this.updateStats()}),1e3)}_stopLocalCalculateTime(){this._localCalculateTimeInterval&&(clearInterval(this._localCalculateTimeInterval),this._localCalculateTimeInterval=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}increaseLocalTimestamp(){this._isUseLocalCalculateTime&&(this._currentLocalTimestamp+=this._localOneFrameTimestamp)}initPlaybackList(e,t,i){this.playbackList=e||[];let s=0;if(this.playbackList.forEach(((e,t)=>{10===Vo(e.start)?(e.startTimestamp=1e3*e.start,e.startTime=vo(e.startTimestamp)):(e.startTimestamp=e.start,e.startTime=vo(e.startTimestamp)),10===Vo(e.end)?(e.endTimestamp=1e3*e.end,e.endTime=vo(e.endTimestamp)):(e.endTimestamp=e.end,e.endTime=vo(e.endTimestamp)),e.duration=e.end-e.start,s+=e.duration})),this._totalDuration=s,this.player.debugLog("Playback",this.playbackList),this.playbackList.length>0){const e=this.playbackList[0].startTimestamp;this._playbackListStartTimestamp=e;let t=e;i&&(10===Vo(i)&&(i*=1e3),this._isTimeInPlaybackList(i)&&(t=i)),this.setStartTime(t)}const r=t||Ei;this.setShowPrecision(r)}get totalDuration(){return(this._totalDuration||0)/1e3}get startTime(){return this._startTime||0}setStartTime(e){this._startTime=e,this._playingTimestamp=e,this._playStartTime=null}setRate(e){this._rate=e,this.player.emit(at.playbackRateChange,e)}get fps(){return this._fps}get rate(){return this._rate}get isUseFpsRender(){return this._isUseFpsRender}get isUseLocalCalculateTime(){return this._isUseLocalCalculateTime}get showPrecision(){return this._showPrecision}get is60Min(){return this.showPrecision===Ei}get is30Min(){return this.showPrecision===Ti}get is10Min(){return this.showPrecision===ki}get is5Min(){return this.showPrecision===Li}get is1Min(){return this.showPrecision===Li}get isPlaybackPauseClearCache(){return this._isPlaybackPauseClearCache}get isCacheBeforeDecodeForFpsRender(){return this._isCacheBeforeDecodeForFpsRender}setShowPrecision(e){xi.includes(e)||(this.player.debugWarn("Playback","setShowPrecision()","type is not in PLAYBACK_CONTROL_TIME_PRECISION_ARRAY",e),e=Ei),this._showPrecision&&this._showPrecision===e||(this._showPrecision=e,this.player.emit(at.playbackPrecision,this._showPrecision,this.playbackList),this.player.emit(at.playbackShowPrecisionChange,this._showPrecision))}setPlayingTimestamp(e){let t;if(this.controlType===X.normal){t=this.startTime+e,this._playingTimestamp=t,this.player.emit(at.playbackTime,t);const i=new Date(t);this.player.emit(at.playbackTimestamp,{ts:t,hour:i.getHours(),min:i.getMinutes(),second:i.getSeconds()})}else this.controlType===X.simple&&(t=this.startTime+Math.round(e/1e3),t>this.totalDuration&&(this.player.debugLog("Playback","setPlayingTimestamp()",`timestamp ${t} > this.totalDuration ${this.totalDuration}`),t=this.totalDuration),this._playingTimestamp=t,this.player.emit(at.playbackTime,t),this.player.emit(at.playbackTimestamp,{ts:t}))}get playingTimestamp(){return this._playingTimestamp}narrowPrecision(){const e=xi.indexOf(this.showPrecision)-1;if(e>=0){const t=xi[e];this.setShowPrecision(t)}}expandPrecision(){const e=xi.indexOf(this.showPrecision)+1;if(e<=xi.length-1){const t=xi[e];this.setShowPrecision(t)}}seek(e){if(this.player.debugLog("Playback","seek()",e),this.controlType===X.normal){if("true"===e.hasRecord){let t=e.time;"min"===e.type&&(t=60*e.time);let i=function(e){let t={};e>-1&&(t={hour:Math.floor(e/60/60)%60,min:Math.floor(e/60)%60,second:e%60});return t}(t);if(this._playbackListStartTimestamp){const e=new Date(this._playbackListStartTimestamp).setHours(i.hour,i.min,i.second,0);i.timestamp=e;const t=this._findMoreInfoByTimestamp(e);i&&t.more&&(i.more=t.more)}this.player.emit(at.playbackSeek,i)}}else if(this.controlType===X.simple){let t=e.time;this.player.emit(at.playbackSeek,{ts:t})}}currentTimeScroll(){this.player.emit(at.playbackTimeScroll)}_findMoreInfoByTimestamp(e){let t=null;return this.playbackList.forEach(((i,s)=>{i.startTimestamp<=e&&i.endTimestamp>=e&&(t=i)})),t}_isTimeInPlaybackList(e){let t=!1;return this.playbackList.forEach(((i,s)=>{i.startTimestamp<=e&&i.endTimestamp>=e&&(t=!0)})),t}getControlType(){return this.controlType}isControlTypeNormal(){return this.controlType===X.normal}isControlTypeSimple(){return this.controlType===X.simple}isPlaybackPauseNotClearCacheAndCacheBeforeDecode(){return ya(this.isPlaybackPauseClearCache)&&this.isCacheBeforeDecodeForFpsRender}isPlaybackPauseNotClearCacheAndCacheBeforeDecodeAndUseFpsRender(){return this.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this.isUseFpsRender}}class uv extends o{constructor(e){super(),this.player=e,this.TAG_NAME="zoom",this.bindEvents=[],this.isDragging=!1,this.isGesturing=!1,this.currentZoom=1,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,this.prevGestureScale=null,this.prevGestureTouches=[],this._isZooming=!1,this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.player,this.player.on(at.zooming,this._handleZooming.bind(this)),e.debugLog("zoom","init")}destroy(){this._unbindEvents(),this.bindEvents=[],this.isDragging=!1,this.currentZoom=1,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.off(),this.player.debugLog("zoom","destroy")}_handleZooming(e){if(e){this.player.$container.classList.add("jb-pro-zoom-control"),this._bindEvents();const e=this.player.video.$videoElement.style.transform;let t=this.player.video.$videoElement.offsetLeft,i=this.player.video.$videoElement.offsetTop;t=parseFloat(t),i=parseFloat(i),t&&(this.videoPosition.left=t),i&&(this.videoPosition.top=i),this.prevVideoElementStyleTransform=e;let s=e.match(/scale\([0-9., ]*\)/g);if(s&&s[0]){let e=s[0].replace("scale(","").replace(")","");this.prevVideoElementStyleScale=e.split(",")}this._isZooming=!0}else{this.player.$container.classList.remove("jb-pro-zoom-control"),this._unbindEvents(),this._resetVideoPosition(),this.player.$container.style.cursor="auto";let e=this.prevVideoElementStyleTransform;this.player.video.$videoElement.style.transform=e,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,po()&&this.player._opt.useWebFullScreen&&this.player.resize(),this._isZooming=!1}}_bindEvents(){const{events:{proxy:e}}=this.player,t=Ca(),i=e(this.player.$container,t.move,this.handleMouseMove.bind(this)),s=e(this.player.$container,t.down,this.handleMouseDown.bind(this)),r=e(window,t.up,this.handleMouseUp.bind(this));if(this.bindEvents.push(i,s,r),po()&&this.player._opt.zoomSupportGestureInMobile)if(mo()){this.handleGestureChangeThrottle=Eo(this.handleGestureChangeForAndroid.bind(this),100);const t=e(this.player.$container,"touchstart",this.handleGestureStartForAndroid.bind(this)),i=e(this.player.$container,"touchmove",this.handleGestureChangeThrottle.bind(this)),s=e(this.player.$container,"touchend",this.handleGestureEndForAndroid.bind(this));this.bindEvents.push(t,i,s)}else{this.handleGestureChangeThrottle=Eo(this.handleGestureChange.bind(this),100);const t=e(this.player.$container,"gesturestart",this.handleGestureStart.bind(this)),i=e(this.player.$container,"gesturechange",this.handleGestureChangeThrottle.bind(this)),s=e(this.player.$container,"gestureend",this.handleGestureEnd.bind(this));this.bindEvents.push(t,i,s)}}_unbindEvents(){this.bindEvents.forEach((e=>{e&&e()}))}handleMouseMove(e){if(e.stopPropagation(),this.isDragging&&this.player.zooming){e.preventDefault();const{posX:t,posY:i}=ea(e),s=this.tempPosition.x-t,r=this.tempPosition.y-i;this.videoPosition.left=this.videoPosition.left-s,this.videoPosition.top=this.videoPosition.top-r,this.tempPosition.x=t,this.tempPosition.y=i,this.updateVideoPosition()}}handleMouseDown(e){e.stopPropagation();const t=Qo(e);if(this.player.zooming&&(t.matches("video")||t.matches("canvas"))){e.preventDefault();const{posX:t,posY:i}=ea(e);this.player.$container.style.cursor="grabbing",this.tempPosition.x=t,this.tempPosition.y=i,this.isDragging=!0,this.player.debugLog("zoom","handleMouseDown is dragging true")}}handleMouseUp(e){e.stopPropagation(),this.isDragging&&this.player.zooming&&(e.preventDefault(),this.tempPosition={x:0,y:0},this.isDragging=!1,this.player.$container.style.cursor="grab",this.player.debugLog("zoom","handleMouseUp is dragging false"))}handleGestureStart(e){e.stopPropagation(),this.player.zooming&&(null===this.prevGestureScale&&(this.prevGestureScale=e.scale),this.isGesturing=!0)}handleGestureStartForAndroid(e){e.stopPropagation(),this.player.zooming&&e.touches.length>=2&&(this.isGesturing=!0,this.prevGestureTouches=e.touches)}handleGestureChangeForAndroid(e){if(e.stopPropagation(),e.preventDefault(),this.player.zooming&&this.isGesturing&&e.touches.length>=2){const s=e.touches,r=t(s[0],s[1])/t(this.prevGestureTouches[0],this.prevGestureTouches[1]);i(s[0],s[1]),i(this.prevGestureTouches[0],this.prevGestureTouches[1]),null===this.prevGestureScale&&(this.prevGestureScale=r);const o=r-this.prevGestureScale,a=this.player._opt.zoomSupportGestureInMobileSpeed;o>0?this.expandPrecision(a):o<0&&this.narrowPrecision(a)}function t(e,t){var i=t.pageX-e.pageX,s=t.pageY-e.pageY;return Math.sqrt(i*i+s*s)}function i(e,t){var i=e.pageX-t.pageX,s=e.pageY-t.pageY;return 180*Math.atan2(s,i)/Math.PI}}handleGestureEndForAndroid(e){e.stopPropagation(),this.player.zooming&&(this.prevGestureScale=null,this.isGesturing=!1,this.prevGestureTouches=[])}handleGestureChange(e){if(e.stopPropagation(),this.player.zooming&&this.isGesturing&&null!==this.prevGestureScale){const t=e.scale,i=t-this.prevGestureScale,s=this.player._opt.zoomSupportGestureInMobileSpeed;i>0?this.expandPrecision(s):i<0&&this.narrowPrecision(s),this.prevGestureScale=t}}handleGestureEnd(e){e.stopPropagation(),this.player.zooming&&(this.prevGestureScale=null,this.isGesturing=!1)}updateVideoPosition(){const e=this.player.video.$videoElement;e.style.left=this.videoPosition.left+"px",e.style.top=this.videoPosition.top+"px"}_resetVideoPosition(){this.player.resize(),this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.currentZoom=1,this.isDragging=!1}narrowPrecision(e){this.currentZoom<=1||(this.currentZoom-=1,this.updateVideoElementScale(e))}expandPrecision(e){this.currentZoom>=this.player._opt.zoomMaxScale||(this.currentZoom+=1,this.updateVideoElementScale(e))}updateCurrentZoom(e,t){e<1||e>this.player._opt.zoomMaxScale||(this.currentZoom=e,this.updateVideoElementScale(t))}updatePrevVideoElementStyleScale(e){this.prevVideoElementStyleScale=e}updateVideoElementScale(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5;const t=this.player.video.$videoElement;let i=t.style.transform,s=1,r=1;if(this.prevVideoElementStyleScale){const e=this.prevVideoElementStyleScale[0];void 0!==e&&(s=e,r=e);const t=this.prevVideoElementStyleScale[1];void 0!==t&&(r=t)}r=wo(r),s=wo(s);const o=e*s*(this.currentZoom-1)+s,a=e*r*(this.currentZoom-1)+r;let n;n=-1===i.indexOf("scale(")?i+` scale(${o},${a})`:i.replace(/scale\([0-9., ]*\)/,`scale(${o},${a})`),this.player.debugLog("zoom",`updateVideoElementScale end is X: ${s} -> ${o}, Y: ${r} -> ${a} style is ${n}`),t.style.transform=n}isZooming(){return this._isZooming}}class pv extends o{constructor(e){super(),this.player=e,this.faceDetector=null,this.objectDetector=null,this.imageDetector=null,this.occlusionDetector=null,this.initFaceDetector(),this.initObjectDetector(),this.initImageDetector(),this.initOcclusionDetector();let t="init";this.faceDetector&&(t+=" and use faceDetector"),this.objectDetector&&(t+=" and use objectDetector"),this.imageDetector&&(t+=" and use imageDetector"),this.occlusionDetector&&(t+=" and use occlusionDetector"),this.player.debugLog("AiLoader",t)}destroy(){this.off(),this.faceDetector&&(this.faceDetector.destroy(),this.faceDetector=null),this.objectDetector&&(this.objectDetector.destroy(),this.objectDetector=null),this.imageDetector&&(this.imageDetector.destroy(),this.imageDetector=null),this.occlusionDetector&&(this.occlusionDetector.destroy(),this.occlusionDetector=null),this.player.debugLog("AiLoader","destroy")}initFaceDetector(){if(this.player._opt.useFaceDetector&&window.JessibucaProFaceDetector){const e=new JessibucaProFaceDetector({detectWidth:this.player._opt.aiFaceDetectWidth,showRect:!1,debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debugLog("AiLoader","init face detector success"),this.faceDetector=e,this.faceDetector.on("jessibuca-pro-face-detector-info",(e=>{if(this.player.emit(at.aiFaceDetectorInfo,e),this.player._opt.aiFaceDetectShowRect){const t=this.player._opt.aiFaceDetectRectConfig||{},i=(e.list||[]).map((e=>(e.type="rect",e.color=t.borderColor||"#0000FF",e.lineWidth=t.borderWidth||2,e)));this.player.video&&this.player.video.addAiContentToCanvas(i)}}))}))}}initObjectDetector(){if(this.player._opt.useObjectDetector&&window.JessibucaProObjectDetector){const e=new JessibucaProObjectDetector({detectWidth:this.player._opt.aiObjectDetectWidth,showRect:!1,debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debugLog("AiLoader","init object detector success"),this.objectDetector=e,this.objectDetector.on("jessibuca-pro-object-detector-info",(e=>{if(this.player.emit(at.aiObjectDetectorInfo,e),this.player._opt.aiObjectDetectShowRect){const t=[],i=this.player._opt.aiObjectDetectRectConfig||{};(e.list||[]).forEach((e=>{const s={type:"rect",color:i.borderColor||"#0000FF",lineWidth:i.borderWidth||2,x:e.rect.x,y:e.rect.y,width:e.rect.width,height:e.rect.height},r={type:"text",color:i.color||"#000",fontSize:i.fontSize||14,text:e.zh,x:e.rect.x,y:e.rect.y-25};t.push(s,r)})),this.player.video&&this.player.video.addAiContentToCanvas(t)}}))}))}}initImageDetector(){if(this.player._opt.useImageDetector&&window.JessibucaProImageDetector){const e=new JessibucaProImageDetector({debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debugLog("AiLoader","init image detector success"),this.imageDetector=e}))}}initOcclusionDetector(){if(this.player._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector){const e=new JessibucaProOcclusionDetector({debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debugLog("AiLoader","init occlusion detector success"),this.occlusionDetector=e}))}}updateFaceDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.faceDetector&&this.faceDetector.updateConfig(e)}updateObjectDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.objectDetector&&this.objectDetector.updateConfig(e)}updateImageDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.imageDetector&&this.imageDetector.updateConfig(e)}updateOcclusionDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.occlusionDetector&&this.occlusionDetector.updateConfig(e)}}class fv extends o{constructor(e){super(),this.player=e,this.LOG_NAME="Contextmenu",this.menuList=[],this.$contextmenus=e.control.$contextmenus,po()?this.player.debugWarn(this.LOG_NAME,"not support mobile"):this.init(),e.debugLog(this.LOG_NAME,"init")}destroy(){this.menuList=[],this.player.debugLog(this.LOG_NAME,"destroy")}get isShow(){return e=this.player.$container,t="jb-pro-contextmenus-show",e.classList.contains(t);var e,t}show(){ac(this.player.$container,"jb-pro-contextmenus-show")}hide(){var e,t;e=this.player.$container,t="jb-pro-contextmenus-show",e.classList.remove(t)}init(){const{events:{proxy:e},debug:t}=this.player;this.player._opt.contextmenuBtns.length>0&&this.player._opt.contextmenuBtns.forEach((e=>{this.addMenuItem(e)})),e(this.player.$container,"contextmenu",(e=>{e.preventDefault(),this.show();const t=e.clientX,i=e.clientY,{height:s,width:r,left:o,top:a}=this.player.$container.getBoundingClientRect(),{height:n,width:l}=this.$contextmenus.getBoundingClientRect();let d=t-o,h=i-a;t+l>o+r&&(d=r-l),i+n>a+s&&(h=s-n),ao(this.$contextmenus,{left:`${d}px`,top:`${h}px`})})),e(this.player.$container,"click",(e=>{dc(e,this.$contextmenus)||this.hide()})),this.player.on(at.blur,(()=>{this.hide()}))}_validateMenuItem(e){let t=!0;return e.content||(this.player.debugWarn(this.LOG_NAME,"content is required"),t=!1),t}addMenuItem(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=ua(Es);if(e=Object.assign({},t,e),!this._validateMenuItem(e))return;const{events:{proxy:i},debug:s}=this.player,r=So(),o=`\n
\n ${e.content}\n
\n `,a=Array.from(this.$contextmenus.children)[e.index];a?a.insertAdjacentHTML("beforebegin",o):nc(this.$contextmenus,o);const n=this.$contextmenus.querySelector(`.jb-pro-contextmenu-${r}`);e.click&&i(n,"click",(t=>{t.preventDefault(),e.click.call(this.player,this,t),this.hide()})),this.menuList.push({uuid:r,$menuItem:n})}}class mv extends o{constructor(e){super(),this.player=e,this.TAG_NAME="CommonWebrtc",this.rtcPeerConnection=null,this.videoStream=null,this.isDisconnected=!1,this.isH264=this.player.isWebrtcH264(),this.eventsDestroy=[],this.supportVideoFrameCallbackHandle=null,this.isInitInfo=!1,this.$videoElement=this.player.video.$videoElement,this.bandwidthEstimateInterval=null,this.rtcPeerTrackVideoReceiver=null,this.rtcPeerTrackAudioReceiver=null,this.prevWebrtcVideoStats={},this.prevWebrtcAudioStats={},this.currentWebrtcStats={},this.player._opt.webrtcUseCanvasRender&&this.isH264&&(this.$videoElement=document.createElement("video"),bo()&&(this.$videoElement.style.position="absolute"),this._initVideoEvents()),this.$videoElement.muted=!0,this._initRtcPeerConnection()}destroy(){if(this.isDisconnected=!1,this.isInitInfo=!1,this.prevWebrtcVideoStats={},this.currentWebrtcStats={},this.rtcPeerTrackVideoReceiver=null,this.rtcPeerTrackAudioReceiver=null,this._stopBandwidthEstimateInterval(),this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this.isH264&&(this.videoStream&&(this.videoStream.getTracks().forEach((e=>e.stop())),this.videoStream=null),this.$videoElement))if(this.player._opt.webrtcUseCanvasRender){this.$videoElement.pause&&(this.$videoElement.pause(),this.$videoElement.muted=!0),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"));try{this.$videoElement.load()}catch(e){}}else this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject"));this.$videoElement=null,this.rtcPeerConnection&&(this.rtcPeerConnection.onicecandidate=eo,this.rtcPeerConnection.ontrack=eo,this.rtcPeerConnection.onconnectionstatechange=eo,this.rtcPeerConnection.ondatachannel=eo,this.rtcPeerConnection.close(),this.rtcPeerConnection=null)}_initVideoEvents(){const{proxy:e}=this.player.events,t=e(this.$videoElement,Xi,(()=>{this.player.debugLog(this.TAG_NAME,"video canplay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video play"),this._startCanvasRender(),this._initRenderSize()})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video play error ",e)}))})),i=e(this.$videoElement,Zi,(()=>{this.player.debugLog(this.TAG_NAME,"video waiting")})),s=e(this.$videoElement,es,(e=>{const t=parseInt(e.timeStamp,10);this.player.handleRender(),this.player.updateStats({ts:t}),this.$videoElement.paused&&(this.player.debugWarn(this.TAG_NAME,"video is paused and next try to replay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video is paused and replay success")})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video is paused and replay error ",e)})))})),r=e(this.$videoElement,ts,(()=>{this.player.debugLog(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate)}));this.eventsDestroy.push(t,i,s,r)}_initRtcPeerConnection(){const e=new RTCPeerConnection,t=this.player;e.addTransceiver("video",{direction:"recvonly"}),e.addTransceiver("audio",{direction:"recvonly"}),e.onsignalingstatechange=e=>{this.player.debugLog(this.TAG_NAME,"onsignalingstatechange[本地端的信号状态]",e)},e.onicegatheringstatechange=t=>{this.player.debugLog(this.TAG_NAME,"onicegatheringstatechange[ICE收集状态]",t,e.iceGatheringState)},e.onnegotiationneeded=e=>{this.player.debugLog(this.TAG_NAME,"onnegotiationneeded[通信环境发生变化]",e)},e.oniceconnectionstatechange=i=>{this.player.debugLog(this.TAG_NAME,"oniceconnectionstatechange",e.iceConnectionState);const s=e.iceConnectionState;switch(this.player.emit(at.webrtcOnIceConnectionStateChange,s),this.isDisconnected="disconnected"===s,e.iceConnectionState){case"new":case"checking":case"closed":case"connected":case"completed":break;case"failed":t.emit(at.webrtcFailed);break;case"disconnected":t.emit(at.webrtcDisconnect);break;case"closed":t.emit(at.webrtcClosed)}},e.onicecandidate=e=>{this.player.debugLog(this.TAG_NAME,"onicecandidate",e),e.candidate&&this.player.debugLog(this.TAG_NAME,"Remote ICE candidate: ",e.candidate.candidate)},e.ontrack=t=>{if(this.player.debugLog(this.TAG_NAME,"ontrack",t),"video"===t.track.kind){this.player.debugLog(this.TAG_NAME,"ontrack video"),this.rtcPeerTrackVideoReceiver=e.getReceivers().find((function(e){return e.track===t.track})),this.rtcPeerTrackVideoReceiver&&this._startBandwidthEstimateInterval();let i=t.streams[0];this.$videoElement.autoplay=!0,this.$videoElement.srcObject=i,this.videoStream=i}else"audio"===t.track.kind&&(this.player.debugLog(this.TAG_NAME,"ontrack audio"),this.rtcPeerTrackAudioReceiver=e.getReceivers().find((function(e){return e.track===t.track})),this.rtcPeerTrackAudioReceiver&&this._startBandwidthEstimateInterval())},e.onicecandidateerror=e=>{this.player.debugLog(this.TAG_NAME,"onicecandidateerror[candidate错误]",e),this.player.emitError(dt.webrtcIceCandidateError,e)},e.onconnectionstatechange=i=>{switch(this.player.debugLog(this.TAG_NAME,"onconnectionstatechange[所有ICE 状态总览]",i),this.player.emit(at.webrtcOnConnectionStateChange,e.connectionState),e.connectionState){case"new":case"connecting":case"connected":case"disconnected":break;case"failed":this.isDisconnected&&t.emit(at.webrtcFailed)}},this.rtcPeerConnection=e}_startBandwidthEstimateInterval(){this.player.debugLog(this.TAG_NAME,"_startBandwidthEstimateInterval"),this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((()=>{this.rtcPeerTrackVideoReceiver&&this.rtcPeerTrackVideoReceiver.getStats().then((e=>{let t={},i=0;e.forEach((e=>{if(e)switch(e.type){case cr:("succeeded"===e.state||e.bytesReceived)&&(this.currentWebrtcStats.timestamp=e.timestamp,this.currentWebrtcStats.rtt=e.currentRoundTripTime||-1,this.currentWebrtcStats.bytesReceived=e.bytesReceived||0,this.currentWebrtcStats.bytesSent=e.bytesSent||0);break;case fr:this.currentWebrtcStats.remoteCandidate=e||{};break;case pr:this.currentWebrtcStats.localCandidate=e||{};break;case ur:this.currentWebrtcStats.lastTimeStamp=e.timestamp;const s=((e.timestamp||0)-(this.prevWebrtcVideoStats.timestamp||0))/1e3,r=Number(e.bytesReceived||0)-Number(this.prevWebrtcVideoStats.bytesReceived||0),o=Math.floor(r/s);i+=o,t.vbps=o,this.prevWebrtcVideoStats=e;break;case mr:e.frameWidth&&e.frameHeight&&(this.currentWebrtcStats.frameWidth=e.frameWidth||0,this.currentWebrtcStats.frameHeight=e.frameHeight||0)}})),this.rtcPeerTrackAudioReceiver?this.rtcPeerTrackAudioReceiver.getStats().then((e=>{e.forEach((e=>{if(e&&e.type===ur){this.currentWebrtcStats.lastTimeStamp=e.timestamp;const s=((e.timestamp||0)-(this.prevWebrtcAudioStats.timestamp||0))/1e3,r=Number(e.bytesReceived||0)-Number(this.prevWebrtcAudioStats.bytesReceived||0),o=Math.floor(r/s);i+=o,t.abps=o,this.prevWebrtcAudioStats=e}})),this.player.updateStats(t),this.player.emit(at.kBps,(i/1024).toFixed(2))})):(this.player.updateStats(t),this.player.emit(at.kBps,(i/1024).toFixed(2)))}))}),1e3)}_stopBandwidthEstimateInterval(){this.player.debugLog(this.TAG_NAME,"_stopBandwidthEstimateInterval"),this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}_startCanvasRender(){Ta()?this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)):(this._stopCanvasRender(),this.canvasRenderInterval=setInterval((()=>{this.player.video.render({$video:this.$videoElement,ts:0})}),40))}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player.isDestroyedOrClosed()?this.player.debugLog(this.TAG_NAME,"videoFrameCallback() player is destroyed"):(this.player.video.render({$video:this.$videoElement,ts:t.mediaTime||0}),this.player.updateStats({dts:t.mediaTime||0}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)))}_initRenderSize(){this.isInitInfo||(this.player.video.updateVideoInfo({width:this.$videoElement.videoWidth,height:this.$videoElement.videoHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0)}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}isVideoPlaying(){return this.$videoElement&&ya(this.$videoElement.paused)&&ya(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}getVideoBufferTimeRange(){const e=this.$videoElement;let t=null;if(e){const i=e.buffered,s=i.length?i.start(0):0,r=i.length?i.end(i.length-1):0;t={start:s,end:r,diff:r-s}}return t}}class gv extends mv{constructor(e){super(e),this.TAG_NAME="WebrtcForSRSDecoder",this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy")}loadSource(e){return new Promise(((t,i)=>{const s=this.rtcPeerConnection;s.createOffer().then((r=>{s.setLocalDescription(r),this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:t})}(e,r.sdp).then((e=>{this.player.debugLog(this.TAG_NAME,`getWebRtcRemoteSdp response and code is ${e.code}`);const r=e;if(r&&0!==r.code)return this.player.debugError(this.TAG_NAME,`response json code ${r.code}`),i(r.msg);r?s.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:r})).then((()=>{t()})).catch((e=>{this.player&&this.player.debugError(this.TAG_NAME,"loadSource setRemoteDescription error",e.toString(),e),i(e)})):(this.player.debugError(this.TAG_NAME,"response sdp is null"),i("response sdp is null"))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e.toString(),e),i(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e.toString(),e),i(e)}))}))}}class yv extends mv{constructor(e){super(e),this.TAG_NAME="WebrtcForOthersDecoder",this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy")}loadSource(e){return new Promise(((t,i)=>{const s=this.rtcPeerConnection;s.createOffer().then((r=>{s.setLocalDescription(r),this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:t})}(e,r.sdp).then((e=>{this.player.debugLog(this.TAG_NAME,`getWebRtcRemoteSdp response and code is ${e.code}`),e.text().then((e=>{this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp response");try{let t=JSON.parse(e);this.player.debugLog(this.TAG_NAME,"this is json sdp response"),0!=t.code&&(this.player.debugError(this.TAG_NAME,`response json code ${t.code}`),i(new Error(`response sdp json code: ${t.code}`))),e=t.sdp}catch(e){this.player.debugLog(this.TAG_NAME,"this is raw sdp response")}e?s.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})).then((()=>{t()})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource setRemoteDescription error",e.toString(),e),i(e)})):(this.player.debugError(this.TAG_NAME,"loadSource sdp is null"),i("sdp is null"))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource response.text() error",e.toString(),e),i(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e.toString(),e),i(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e.toString(),e),i(e)}))}))}}class Av extends mv{constructor(e){super(e),this.rtcPeerConnectionDataChannel=null,this.player.isWebrtcH265()&&(this.streamRate=ho((t=>{e.emit(at.kBps,(t/1024).toFixed(2))}))),this.TAG_NAME="WebrtcForM7SDecoder",this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.stopStreamRateInterval(),this.rtcPeerConnectionDataChannel&&(this.rtcPeerConnectionDataChannel.onopen=eo,this.rtcPeerConnectionDataChannel.onclose=eo,this.rtcPeerConnectionDataChannel.onmessage=eo,this.rtcPeerConnectionDataChannel.close(),this.rtcPeerConnectionDataChannel=null),this.player.debugLog(this.TAG_NAME,"destroy")}_initRtcPeerConnection(){const e=new RTCPeerConnection,t=this.player;e.addTransceiver("video",{direction:"recvonly"}),e.addTransceiver("audio",{direction:"recvonly"}),e.onsignalingstatechange=e=>{this.player.debugLog(this.TAG_NAME,"onsignalingstatechange[本地端的信号状态]",e)},e.onicegatheringstatechange=t=>{this.player.debugLog(this.TAG_NAME,"onicegatheringstatechange[ICE收集状态]",t,e.iceGatheringState)},e.onnegotiationneeded=e=>{this.player.debugLog(this.TAG_NAME,"onnegotiationneeded[通信环境发生变化]",e)},e.oniceconnectionstatechange=i=>{this.player.debugLog(this.TAG_NAME,"oniceconnectionstatechange",e.iceConnectionState);const s=e.iceConnectionState;switch(this.player.emit(at.webrtcOnIceConnectionStateChange,s),this.isDisconnected="disconnected"===s,e.iceConnectionState){case"new":case"checking":case"closed":case"connected":case"completed":break;case"failed":t.emit(at.webrtcFailed);break;case"disconnected":t.emit(at.webrtcDisconnect);break;case"closed":t.emit(at.webrtcClosed)}},e.onicecandidate=e=>{this.player.debugLog(this.TAG_NAME,"onicecandidate",e),e.candidate&&this.player.debugLog(this.TAG_NAME,"Remote ICE candidate: ",e.candidate.candidate)},e.ontrack=i=>{this.player.debugLog(this.TAG_NAME,"ontrack",i);const s=t.video.$videoElement;if(t.isWebrtcH264())if("video"===i.track.kind){this.player.debugLog(this.TAG_NAME,"ontrack video"),this.rtcPeerTrackVideoReceiver=e.getReceivers().find((function(e){return e.track===i.track})),this.rtcPeerTrackVideoReceiver&&this._startBandwidthEstimateInterval();let t=i.streams[0];s.autoplay=!0,s.srcObject=t,this.videoStream=t}else"audio"===i.track.kind&&(this.player.debugLog(this.TAG_NAME,"ontrack audio"),this.rtcPeerTrackAudioReceiver=e.getReceivers().find((function(e){return e.track===i.track})),this.rtcPeerTrackAudioReceiver&&this._startBandwidthEstimateInterval())},e.onicecandidateerror=e=>{this.player.debugLog(this.TAG_NAME,"onicecandidateerror[candidate错误]",e),this.player.emitError(dt.webrtcIceCandidateError,e)},e.onconnectionstatechange=i=>{switch(this.player.debugLog(this.TAG_NAME,"onconnectionstatechange[所有ICE 状态总览]",i),this.player.emit(at.webrtcOnConnectionStateChange,e.connectionState),e.connectionState){case"new":case"connecting":case"connected":case"disconnected":break;case"failed":this.isDisconnected&&t.emit(at.webrtcFailed)}},e.ondatachannel=e=>{const t=e.channel;this.player.debugLog(this.TAG_NAME,"ondatachannel"),t.onopen=()=>{this.player.debugLog(this.TAG_NAME,"ondatachannel and onopen")},t.onmessage=e=>{const t=e.data;if(this.player.isWebrtcH264())return this.player.debugWarn(this.TAG_NAME,"ondatachannel is H265 but decode is h264 so emit webrtcStreamH265 "),void this.player.emit(at.webrtcStreamH265);this.player.isDestroyedOrClosed()?this.player.debugWarn(this.TAG_NAME,"ondatachannel and player is destroyed"):(this.streamRate&&this.streamRate(t.byteLength),this.player.demux&&this.player.demux.dispatch(t))},t.onclose=()=>{this.player.debugWarn(this.TAG_NAME,"ondatachannel and onclose")},this.rtcPeerConnectionDataChannel=t};e.createDataChannel("signal").onmessage=e=>{this.player.debugLog(this.TAG_NAME,"signalChannel,onmessage",e);JSON.parse(e.data).type},this.rtcPeerConnection=e}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}loadSource(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{const r=this.rtcPeerConnection;r.createOffer().then((o=>{r.setLocalDescription(o),this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t,i){let s={"Content-Type":"application/sdp"};return i.username&&i.password&&(s.Authorization="Basic "+btoa(i.username+":"+i.password)),fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:s,body:t})}(e,o.sdp,t).then((e=>{e.text().then((e=>{this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp response"),e?r.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})).then((()=>{this.player.isWebrtcH265()&&this.startStreamRateInterval(),i()})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource setRemoteDescription error",e.toString(),e),s(e)})):(this.player.debugError(this.TAG_NAME,"loadSource sdp is null"),s("sdp is null"))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource response.text() error",e.toString(),e),s(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e.toString(),e),s(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e.toString(),e),s(e)}))}))}}class bv extends mv{constructor(e){super(e),this.TAG_NAME="WebrtcForZLMDecoder",this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy")}loadSource(e){return new Promise(((t,i)=>{const s=this.rtcPeerConnection;s.createOffer().then((r=>{s.setLocalDescription(r),this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return Pl({url:e,type:"POST",data:t,contentType:"text/plain;charset=utf-8",processData:!1,dataType:"json"})}(e,r.sdp).then((e=>{this.player.debugLog(this.TAG_NAME,`getWebRtcRemoteSdp response and code is ${e.code}`);const r=e;if(r&&0!==r.code)return this.player.debugError(this.TAG_NAME,`response json code ${r.code}`),i(r.msg);r&&r.sdp?s.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:r.sdp})).then((()=>{t()})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource setRemoteDescription error",e.toString(),e),i(e)})):(this.player.debugError(this.TAG_NAME,"response sdp is null"),i("sdp is null"))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e.toString(),e),i(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e.toString(),e),i(e)}))}))}}class vv extends o{constructor(e){if(super(),this.TAG_NAME="AliyunRtc",this.player=e,!window.AliRTS)throw new Error("AliyunRtc is not defined");this.aliyunRtc=window.AliRTS.createClient(),this.aliyunRtcRemoteStream=null,this.$videoElement=this.player.video.$videoElement,this.listenEvents(),this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.aliyunRtc&&(this.aliyunRtcRemoteStream&&(this.aliyunRtcRemoteStream=null),this.aliyunRtc.unsubscribe(),this.aliyunRtc=null),this.$videoElement=null,this.off(),this.player.debugLog(this.TAG_NAME,"destroy")}listenEvents(){this.aliyunRtc.on("onError",(e=>{this.player.debugLog(this.TAG_NAME,`onError and code is ${e.errorCode} and message: ${e.message}`),10400!==e.errorCode&&(this.player.debugError(this.TAG_NAME,`onError and code is ${e.errorCode} and message: ${e.message}`),this.player.emitError(dt.aliyunRtcError,e))})),this.aliyunRtc.on("reconnect",(e=>{this.player.debugLog(this.TAG_NAME,"reconnect",e)}));const e="canplay",t="waiting",i="playing",s="media";this.aliyunRtc.on("onPlayEvent",(r=>{if(r.event===e)this.player.debugLog(this.TAG_NAME,"onPlayEvent and canplay");else if(r.event===t)this.player.debugLog(this.TAG_NAME,"onPlayEvent and playing - > waiting");else if(r.event===i)this.player.debugLog(this.TAG_NAME,"onPlayEvent and waiting -> playing");else if(r.event===s){const e=r.data;let t={},i=0;if(e.audio){const s=Math.floor(e.audio.bytesReceivedPerSecond);i+=s,t.abps=s}if(e.video){const s=Math.floor(e.video.bytesReceivedPerSecond);i+=s,t.vbps=s}this.player.updateStats(t),this.player.emit(at.kBps,(i/1024).toFixed(2))}}))}loadSource(e){return new Promise(((t,i)=>{this.aliyunRtc.isSupport({isReceiveVideo:!0}).then((()=>{this.aliyunRtc.subscribe(e,{}).then((e=>{this.aliyunRtcRemoteStream=e,e.play(this.$videoElement),t()})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource and subscribe is not success: ",e.message),i(e.message)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource and is not support: ",e.message),i(e.message)}))}))}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}isVideoPlaying(){return this.$videoElement&&ya(this.$videoElement.paused)&&ya(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}getVideoBufferTimeRange(){const e=this.$videoElement;let t=null;if(e){const i=e.buffered,s=i.length?i.start(0):0,r=i.length?i.end(i.length-1):0;t={start:s,end:r,diff:r-s}}return t}}class _v{constructor(e){this.player=e,this.TAG_NAME="PressureObserverCpu",this.observer=null,this.latestCpuInfo=null,this.currentLevel=-1,this.observeCpuSuccess=!1,this._init(),this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.observer&&(this.observeCpuSuccess&&this.observer.disconnect(),this.observer=null),this.latestCpuInfo=null,this.currentLevel=-1,this.player.debugLog(this.TAG_NAME,"destroy")}getCurrentCpuState(){return this.currentLevel}_init(){ya(ka())?this.player.debugLog(this.TAG_NAME,"not support PressureObserver"):(this.observer=new PressureObserver((e=>{const t=(e||[]).find((e=>"cpu"===e.source));if(t){switch(this.latestCpuInfo=t,t.state){case"nominal":this.currentLevel=0;break;case"fair":this.currentLevel=1;break;case"serious":this.currentLevel=2;break;case"critical":this.currentLevel=3;break;default:this.currentLevel=-1}this.player.emit(at.pressureObserverCpu,this.currentLevel)}})),this.observer&&this.observer.observe("cpu",{sampleInterval:1e3}).then((()=>{this.observeCpuSuccess=!0,this.player.debugLog(this.TAG_NAME,"observe cpu success")})).catch((()=>{this.observeCpuSuccess=!1,this.player.debugLog(this.TAG_NAME,"observe cpu fail")})))}}class wv extends Wa{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e),this.TAG_NAME="DynamicWatermark",this.isPauseAnimation=!1,this.isStopAnimation=!1,this.rafID=null,this.speed=t.speed||.2,this.isDynamic=!0,this.shadowRootDynamicDom=null,this.isGhost=!0===t.isGhost,this.ghostConfig={on:t.on||5,off:t.off||5},this.waterMarkWillRemove=!1,this.waterMarkWillAdd=!1,this.player.once(at.start,(()=>{const e=ya(uo)?decodeURIComponent("JessibucaPro%20%E4%BD%93%E9%AA%8C"):t.content;let i=this.player.getVideoInfo();i||(i={width:200,height:200}),this.update({text:{content:e,fontSize:t.fontSize||18,color:t.color||"white"},left:i.width*Math.random(),top:i.height*Math.random(),opacity:t.opacity||.15}),this.startAnimation()})),this.player.debugLog(this.TAG_NAME,"int")}destroy(){super.destroy(),this.shadowRootDynamicDom=null,this.stopAnimation(),this.rafID&&(cancelAnimationFrame(this.rafID),this.rafID=null)}startAnimation(){if(!this.rafID){let e=1,t=1,i=Math.random(),s={width:0,height:0};const r=()=>{try{if(ya(this.isPauseAnimation)&&this.shadowRootDynamicDom&&this.shadowRootInnerDom){const o=this.shadowRootInnerDom,a=this.shadowRootDynamicDom,n=o.getBoundingClientRect(),l=a.getBoundingClientRect();if(l.width&&l.height&&(s.width=l.width,s.height=l.height),!this.shadowRootInnerDom.contains(this.shadowRootDynamicDom))return this.isGhost?ya(this.waterMarkWillAdd)&&(this.waterMarkWillAdd=!0,setTimeout((()=>{this._addDom(n,s),this.waterMarkWillAdd=!1}),1e3*this.ghostConfig.off)):this._addDom(n,s),void(0!==this.speed&&requestAnimationFrame(r));const d=Math.min(1,0===this.speed?0:this.speed?this.speed:.2);let h=l.left-n.left,c=l.top-n.top;h+=d*t*i,c+=d*e*(1-i),h+s.width>n.width?(t=-1,i=Math.random()):h<0&&(t=1,i=Math.random()),c+s.height>n.height?(e=-1,i=Math.random()):c<0&&(e=1,i=Math.random()),h=Math.min(n.width-s.width,h),c=Math.min(n.height-s.height,c);const u=h/n.width*100,p=c/n.height*100;this.shadowRootDynamicDom.style.left=`${u}%`,this.shadowRootDynamicDom.style.top=`${p}%`,ya(this.waterMarkWillRemove)&&this.isGhost&&(this.waterMarkWillRemove=!0,setTimeout((()=>{this._removeDom(),this.waterMarkWillRemove=!1}),1e3*this.ghostConfig.on))}}catch(e){}if(this.isStopAnimation)return this.isStopAnimation=!1,cancelAnimationFrame(this.rafID),void(this.rafID=null);0!==this.speed&&requestAnimationFrame(r)};this.rafID=requestAnimationFrame(r)}}_addDom(e,t){if(this.shadowRootInnerDom&&this.shadowRootDynamicDom){this.shadowRootInnerDom.appendChild(this.shadowRootDynamicDom);let i=e.width*Math.random(),s=e.height*Math.random();i=Math.min(e.width-2*t.width,i),s=Math.min(e.height-2*t.height,s),this.shadowRootDynamicDom.style.left=`${i}px`,this.shadowRootDynamicDom.style.top=`${s}px`}}resumeAnimation(){this.isPauseAnimation=!1}pauseAnimation(){this.isPauseAnimation=!0}stopAnimation(){this.isStopAnimation=!0}}class Sv extends o{constructor(e){super(),this.player=e,this.TAG_NAME="DrawRectangle",this.drawingRectangle=!1,this.isDragging=!1,this.bindEvents=[],this.$rectBox=null,this._resetPoint(),this.player.on(at.drawingRect,this._handleDrawingRect.bind(this)),this.player.debugLog(this.TAG_NAME,"init")}destroy(){this._unbindEvents(),this.drawingRectangle=!1,this.isDragging=!1,this._removeRectBox(),this.off(),this.player.debugLog(this.TAG_NAME,"destroy")}_resetPoint(){this.startPagePoint={x:0,y:0},this.startPoint={x:0,y:0},this.endPoint={x:0,y:0}}_handleDrawingRect(e){this.drawingRectangle=e,e?this._bindEvents():(this._unbindEvents(),this._removeRectBox())}_bindEvents(){const{events:{proxy:e}}=this.player,t=e(this.player.$container,"mousemove",this.handleMouseMove.bind(this)),i=e(this.player.$container,"mousedown",this.handleMouseDown.bind(this)),s=e(window,"mouseup",this.handleMouseUp.bind(this));this.bindEvents.push(t,i,s)}_unbindEvents(){this.bindEvents.forEach((e=>{e&&e()})),this.bindEvents=[]}_removeRectBox(){if(this.$rectBox){if(!hc(this.$rectBox)){const e=this.player.$container.querySelector(".jb-pro-drawing-rect-box");e&&this.player.$container&&this.player.$container.removeChild(e)}this.$rectBox=null}}handleMouseDown(e){if(e.stopPropagation(),!this.drawingRectangle)return;this._removeRectBox();const t=e.offsetX,i=e.offsetY;this.startPoint.x=t,this.startPoint.y=i,this.startPagePoint.x=e.pageX-this.player.$container.offsetLeft,this.startPagePoint.y=e.pageY-this.player.$container.offsetTop,this.$rectBox=document.createElement("div"),this.$rectBox.classList.add("jb-pro-drawing-rect-box"),this.$rectBox.style.border=`${this.player._opt.drawingRectLineWidth}px solid ${this.player._opt.drawingRectColor}`,this.$rectBox.style.position="absolute",this.$rectBox.style.left=`${this.startPoint.x}px`,this.$rectBox.style.top=`${this.startPoint.y}px`,this.player.$container.appendChild(this.$rectBox),this.isDragging=!0}handleMouseMove(e){if(e.stopPropagation(),!this.isDragging)return;if(!this.drawingRectangle)return;if(!this.$rectBox)return;const t=this.player.$container,i=this.player.getControlHeight(),s=e.pageX-t.offsetLeft,r=e.pageY-t.offsetTop;if(sn&&(o=n,this.endPoint.x=this.startPoint.x+o),a>l&&(a=l,this.endPoint.y=this.startPoint.y+a),this.$rectBox.style.width=`${o}px`,this.$rectBox.style.height=`${a}px`}handleMouseUp(e){if(e.stopPropagation(),this.drawingRectangle&&this.isDragging){e.preventDefault(),this.isDragging=!1,this.player._opt.drawingRectEndRemoveDom&&this._removeRectBox();const t={startPoint:this.startPoint,endPoint:this.endPoint,width:Math.abs(this.endPoint.x-this.startPoint.x),height:Math.abs(this.endPoint.y-this.startPoint.y)};this.player._opt.isResize,this.player.emit(at.drawingRectInfo,t),this._resetPoint()}}}class Ev extends o{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this._opt={},this.TAG_NAME="Player",this.$container=e;const i=fa();if(this._opt=Object.assign({},i,t),this.debug=new xr(this),this.debugLog(this.TAG_NAME,"init and version is",co),this._opt.forceNoOffscreen=!0,this._canPlayAppleMpegurl=!1,(bo()||Ao())&&(this._canPlayAppleMpegurl=ta(),this.debugLog(this.TAG_NAME,"isIOS or isSafari and canPlayAppleMpegurl",this._canPlayAppleMpegurl)),ga(Pr.isEnabled)&&ga(this._opt.useWebFullScreen)&&(this.debugLog(this.TAG_NAME,"screenfull.isEnabled is true and _opt.useWebFullScreen is true , set _opt.useWebFullScreen false"),this._opt.useWebFullScreen=!1),ya(Pr.isEnabled)&&ya(this._opt.useWebFullScreen)&&(this.debugLog(this.TAG_NAME,"screenfull.isEnabled is false and _opt.useWebFullScreen is false , set _opt.useWebFullScreen true"),this._opt.useWebFullScreen=!0),_a()&&(this.debugLog(this.TAG_NAME,"isIphone and set _opt.videoRenderSupportScale false"),this._opt.videoRenderSupportScale=!1,Ko()&&ga(this._opt.isHls)&&ya(this._opt.supportHls265)&&(this.debugLog(this.TAG_NAME,"isIphone and is in wechat and is hls so set supportHls265 true"),this._opt.supportHls265=!0)),ya(this._opt.playFailedAndReplay)&&(this.debugLog(this.TAG_NAME,"_opt.playFailedAndReplay is false and set others replay params false"),this._opt.webglAlignmentErrorReplay=!1,this._opt.webglContextLostErrorReplay=!1,this._opt.autoWasm=!1,this._opt.mseDecodeErrorReplay=!1,this._opt.mediaSourceTsIsMaxDiffReplay=!1,this._opt.wcsDecodeErrorReplay=!1,this._opt.wasmDecodeErrorReplay=!1,this._opt.simdDecodeErrorReplay=!1,this._opt.videoElementPlayingFailedReplay=!1,this._opt.networkDelayTimeoutReplay=!1,this._opt.widthOrHeightChangeReplay=!1,this._opt.simdH264DecodeVideoWidthIsTooLargeReplay=!1,this._opt.mediaSourceUseCanvasRenderPlayFailedReplay=!1,this._opt.heartTimeoutReplay=!1,this._opt.loadingTimeoutReplay=!1,this._opt.websocket1006ErrorReplay=!1,this._opt.streamErrorReplay=!1,this._opt.streamEndReplay=!1,this._opt.mseWaitVideoCanplayAutoWasm=!1),this._opt.hiddenControl&&(this.debugLog(this.TAG_NAME,"_opt.hiddenControl is true and set others show btn to false"),Object.keys(this._opt.operateBtns).forEach((e=>{this._opt.operateBtns[e]&&-1===(""+e).indexOf("Fn")&&(this._opt.operateBtns[e]=!1)})),this._opt.showBandwidth=!1,this._opt.extendOperateBtns=[],this._opt.controlHtml="",this.isPlayback()&&(this._opt.playbackConfig.showControl=!1)),this._opt.watermarkConfig={image:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAS4AAABgCAYAAACjZZ/rAAAK4mlDQ1BJQ0MgUHJvZmlsZQAASImVlwdUU1kagO976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UVLrKEdBQBA4tRGocOLyuYuoOGsN5cz6N3mPsp1JJSvtsZzEFZOUQZk9f/Yj7tr5PeWtnUzunI16kkT+XF5c9Qspo8NMf3w5EQQEAWsgUOHEpYXFufozyp03lrzObDauu4+TWFmIi4c6MUmVKK5+Z6rUaTQTVOBEac6ygeTau5iLYMc+G6/BOkZccKlIOrMXpbYYzGHlU/21zyPngoAgUDEInFTiUh6RPxVWsGIWf4sxi4p3r6finatLiEUd3qlHVSM7Rjr2Kg0pvkEnsqeeQYln3c58pVliZIKdj73lC7d+wiS5l5z8QVhP4Q6FKG3xaZTS7BFKanC3SSoJEgQEgVMRgZNPXCoqbPTz5rPxL++gEuIpOMhLhrbwcHKXsqNqTEZtcmQ24ZnAkp1LbfGpZE/DFCyYrGwCdwifO4/c/LWfgi1v8Ycz9lHm5YvLlonEFgQEgZOGwKlDXCcNAilYEBAErIYABmAigoAgIAhYCgEhLks1l1RWEBAEgIAQl/QDQUAQsBwCQlyWazKpsCAgCAhxSR8QBAQByyEgxGW5JpMKCwKCgBCX9AFBQBCwHAJCXJZrMqmwICAICHFJHxAEBAHLISDEZbkmkwoLAoKAEJf0AUFAELAcAkJclmsyqbAgIAgIcUkfEAQEAcshIMRluSaTCgsCgoAQl/QBQUAQsBwCQlyWazKpsCAgCAhxSR8QBAQByyEgxGW5JpMKCwKCgBCX9AFBQBCwHAJCXJZrMqmwICAICHFJHxAEBAHLISDEZbkmkwoLAoKAEJf0AUFAELAcAkJclmsyqbAgIAgIcUkfEAQEAcshIMRluSaTCgsCgsD/AFt/MVAlcetCAAAAAElFTkSuQmCC",width:75,height:24},opacity:.1,right:10,top:10},this._opt.forceNoOffscreen||("undefined"==typeof OffscreenCanvas?(this._opt.forceNoOffscreen=!0,this._opt.useOffscreen=!1):this._opt.useOffscreen=!0),this._opt.isMpeg4&&(this.debugLog(this.TAG_NAME,"isMpeg4 is true, so set _opt.useWasm true and others params false"),this._opt.useWCS=!1,this._opt.useMSE=!1,this._opt.isNakedFlow=!1,this._opt.useSIMD=!1,this._opt.isFmp4=!1,this._opt.useWasm=!0),this.isPlayback()&&(ga(this._opt.useMSE)&&ga(this._opt.mseDecoderUseWorker)&&this.debugLog(this.TAG_NAME,"isPlayback and mseDecoderUseWorker is true, so set mseDecoderUseWorker false"),this._opt.mseDecoderUseWorker=!1,ga(this._opt.useWCS)&&ga(this._opt.wcsDecodeAudio)&&this.debugLog(this.TAG_NAME,"isPlayback and wcsDecodeAudio is true, so set wcsDecodeAudio false"),this._opt.wcsDecodeAudio=!1),this._opt.poster&&(this._opt.background=this._opt.poster),ya(this._opt.muted)&&(this._opt.isNotMute=!0),this._opt.mseDecoderUseWorker&&(this._opt.mseDecoderUseWorker=!!(self.Worker&&self.MediaSource&&"canConstructInDedicatedWorker"in self.MediaSource&&!0===self.MediaSource.canConstructInDedicatedWorker),ya(this._opt.mseDecoderUseWorker)&&this.debugLog(this.TAG_NAME,"mseDecoderUseWorker is true but not support so set _opt.mseDecoderUseWorker = false")),(this.isOldHls()||this.isWebrtcH264()||this.isAliyunRtc())&&(this.debugLog(this.TAG_NAME,"isOldHls or isWebrtcH264 or isAliyunRtc is true, so set some params false and set _opt.recordType = webm"),this._opt.useWCS=!1,this._opt.useMSE=!1,this._opt.isNakedFlow=!1,this._opt.useSIMD=!1,this._opt.isFmp4=!1,this._opt.useWasm=!1,this._opt.recordType=E),this._opt.isNakedFlow&&(this.debugLog(this.TAG_NAME,"isNakedFlow is true, so set _opt.mseDecodeAudio false"),this._opt.mseDecodeAudio=!1),go()&&(this.debugLog(this.TAG_NAME,"isFirefox is true, so set _opt.mseDecodeAudio false"),this._opt.mseDecodeAudio=!1),!this.isOldHls()&&!this.isWebrtcH264()){if(this._opt.useWCS){const e="VideoDecoder"in window,t=Co();this._opt.useWCS=e,this._opt.useWCS&&this._opt.isH265&&(this._opt.useWCS=t),this._opt.useWCS||this.debugWarn(this.TAG_NAME,`\n useWCS is true,\n and supportWCS is ${e}, supportHevcWCS is ${t} , _opt.isH265 is ${this._opt.isH265}\n so set useWCS false`),this._opt.useWCS&&(this._opt.wcsDecodeAudio&&(this._opt.wcsDecodeAudio="AudioDecoder"in window,this._opt.wcsDecodeAudio||this.debugWarn(this.TAG_NAME,"wcsDecodeAudio is true, but not support so set wcsDecodeAudio false")),this._opt.useOffscreen?this._opt.wcsUseVideoRender=!1:this._opt.wcsUseVideoRender&&(this._opt.wcsUseVideoRender=xo()&&Do(),this._opt.wcsUseVideoRender||this.debugWarn(this.TAG_NAME,"wcsUseVideoRender is true, but not support so set wcsUseVideoRender false")))}if(this._opt.useMSE){const e=function(){let e=!1;return"MediaSource"in self&&(e=!0),e}()||function(){let e=!1;return!("MediaSource"in self)&&"ManagedMediaSource"in self&&(e=!0),e}(),t=Lo()||function(){let e=!1;return!("MediaSource"in self)&&"ManagedMediaSource"in self&&(self.ManagedMediaSource.isTypeSupported(pi)||self.ManagedMediaSource.isTypeSupported(fi)||self.ManagedMediaSource.isTypeSupported(mi)||self.ManagedMediaSource.isTypeSupported(gi)||self.ManagedMediaSource.isTypeSupported(yi))&&(e=!0),e}();this._opt.useMSE=e,this._opt.useMSE&&this._opt.isH265&&(this._opt.useMSE=t),this._opt.useMSE||this.debugWarn(this.TAG_NAME,`\n useMSE is true,\n and supportMSE is ${e}, supportHevcMSE is ${t} , _opt.isH265 is ${this._opt.isH265}\n so set useMSE false`)}}if(ya(this._opt.useMSE)&&(this._opt.mseDecodeAudio=!1),ya(this._opt.useWCS)&&(this._opt.wcsDecodeAudio=!1),this._opt.useMSE?(this._opt.useWCS&&this.debugWarn(this.TAG_NAME,"useMSE is true and useWCS is true then useWCS set true->false"),this._opt.forceNoOffscreen||this.debugWarn(this.TAG_NAME,"useMSE is true and forceNoOffscreen is false then forceNoOffscreen set false->true"),this._opt.useWCS=!1,this._opt.forceNoOffscreen=!0):this._opt.useWCS,this._opt.isWebrtc&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"isWebrtc is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this._opt.isHls&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"isHls is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this._opt.isAliyunRtc&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"isAliyunRtc is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this.isStreamWebTransport()&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"is stream use webTransport is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this._opt.wcsDecodeAudio&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"is wcsDecodeAudio true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),ya(this._opt.demuxUseWorker)&&(this._opt.mseDecoderUseWorker=!1),this.isPlayback()&&(this._opt.mseDecoderUseWorker=!1),this._opt.useMThreading&&(this._opt.useMThreading="undefined"!=typeof SharedArrayBuffer,this._opt.useMThreading||this.debugWarn(this.TAG_NAME,"useMThreading is true, but not support so set useMThreading false")),this._opt.useSIMD||-1!==this._opt.decoder.indexOf("-simd")){const e=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),t=_a();this._opt.useSIMD=e&&ya(t),this._opt.useSIMD||this.debugWarn(this.TAG_NAME,`useSIMD is true, but not support(isSupportSimd is ${e} ,isIphone is ${t}) so set useSIMD false`)}var s;if(this._opt.useSIMD?-1===this._opt.decoder.indexOf("-simd")?this._opt.useMThreading?this._opt.decoder=this._opt.decoder.replace("decoder-pro.js","decoder-pro-simd-mt.js"):this._opt.decoder=this._opt.decoder.replace("decoder-pro.js","decoder-pro-simd.js"):this._opt.useMThreading&&(this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-simd-mt.js")):-1!==this._opt.decoder.indexOf("-simd")?this._opt.useMThreading?this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-mt.js"):this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro.js"):this._opt.useMThreading&&(this._opt.decoder=this._opt.decoder.replace("decoder-pro.js","decoder-pro-mt.js")),-1!==this._opt.decoder.indexOf("-simd")?this._opt.useMThreading?(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-hard-not-wasm.js")):(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-hard-not-wasm.js")):this._opt.useMThreading?(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-hard-not-wasm.js")):(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro.js","decoder-pro-hard-not-wasm.js")),ya(this._opt.hasAudio)&&(this._opt.operateBtns.audio=!1),ya(this._opt.hasVideo)&&(this._opt.operateBtns.fullscreen=!1,this._opt.operateBtns.screenshot=!1,this._opt.operateBtns.record=!1,this._opt.operateBtns.ptz=!1,this._opt.operateBtns.quality=!1,this._opt.operateBtns.zoom=!1),this._opt.qualityConfig&&0===this._opt.qualityConfig.length&&this._opt.operateBtns.quality&&(this._opt.operateBtns.quality=!1,this.debugWarn(this.TAG_NAME,"_opt.qualityConfig is empty, so set operateBtns.quality false")),ga(this._opt.useWebGPU)&&(this._opt.useWebGPU=function(){let e=!1;return"gpu"in navigator&&(e=!0),e}(),ya(this._opt.useWebGPU)&&this.debugWarn(this.TAG_NAME,"useWebGPU is true, but not support so set useWebGPU false")),this._opt.hasControl=this._hasControl(),this._loading=!1,this._playing=!1,this._playbackPause=!1,this._hasLoaded=!1,this._zooming=!1,this._drawingRect=!1,this._destroyed=!1,this._destroyLock=!1,this._closed=!1,this._checkHeartTimeout=null,this._checkLoadingTimeout=null,this._checkStatsInterval=null,this._checkVisibleHiddenTimeout=null,this._startBpsTime=null,this._isPlayingBeforePageHidden=!1,this._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,currentPts:0,pTs:0,dts:0,mseVideoBufferDelayTime:0,isDropping:!1},this._tempTsList=[],this._allStatsData={},this._faceDetectActive=!1,this._objectDetectActive=!1,this._occlusionDetectActive=!1,this._imageDetectActive=!1,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this._videoTimestamp=0,this._audioTimestamp=0,this._latestAudioTimestamp=0,this._videoIframeIntervalTs=0,this._streamQuality=this._opt.defaultStreamQuality||"",!this._streamQuality&&this._opt.qualityConfig.length>0&&(this._streamQuality=this._opt.qualityConfig[0]||""),this._visibility=!0,this._lastestVisibilityChangeTimestamp=null,this._tempWorkerStats=null,this._historyFpsList=[],this._historyVideoDiffList=[],this._tempStreamList=[],this._tempInnerPlayBgobj=null,this._flvMetaData=null,this._flvMetaDataFps=null,this._serverInfo=null,this._mseWorkerData={},ya(this._opt.useMSE)&&ya(this._opt.useWCS)&&!this.isWebrtcH264()&&!this.isOldHls()&&(this._opt.useWasm=!0),(this.isOldHls()||this.isWebrtcH264())&&(this._opt.hasVideo=!0,this._opt.hasAudio=!0),this._opt.hasVideo||(this._opt.useMSE=!1,this._opt.useWCS=!1),this._opt.useWasm&&(this._opt.useOffscreen?this._opt.wasmUseVideoRender=!1:this._opt.wasmUseVideoRender&&(this._opt.wasmUseVideoRender=_o()&&xo()&&Do(),this._opt.wasmUseVideoRender||this.debugWarn(this.TAG_NAME,"use wasm video render, but not support so set wasmUseVideoRender false"),this._opt.wasmUseVideoRender&&this._opt.wasmPlayAudioUseVideoRender&&(this._opt.wasmPlayAudioUseVideoRender="AudioData"in window,this._opt.wasmPlayAudioUseVideoRender||this.debugWarn(this.TAG_NAME,"use wasm video render play audio, but not support so set wasmPlayAudioUseVideoRender false"))),this._opt.useSIMD?this.debugLog(this.TAG_NAME,"use simd wasm"):this.debugLog(this.TAG_NAME,"use wasm")),this._opt.useWasm&&(this._opt.useFaceDetector&&window.JessibucaProFaceDetector||this._opt.useObjectDetector&&window.JessibucaProObjectDetector||this._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector||this._opt.useImageDetector&&window.JessibucaProImageDetector)?(this.ai=new pv(this),this._opt.useFaceDetector&&window.JessibucaProFaceDetector||(this._opt.operateBtns.aiFace=!1),this._opt.useObjectDetector&&window.JessibucaProObjectDetector||(this._opt.operateBtns.aiObject=!1),this._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector||(this._opt.operateBtns.aiOcclusion=!1),this._opt.useImageDetector&&this._opt.aiImageDetectActive&&window.JessibucaProImageDetector&&(this.imageDetectActive=!0)):(this._opt.operateBtns.aiObject=!1,this._opt.operateBtns.aiFace=!1,this._opt.operateBtns.aiOcclusion=!1),this._opt.useFaceDetector&&(this._opt.useWasm&&window.JessibucaProFaceDetector||this.debugWarn(this.TAG_NAME,`use face detector, useWasm is ${this._opt.useWasm} and window.JbProFaceDetector is null`)),this._opt.useObjectDetector&&(this._opt.useWasm&&window.JessibucaProObjectDetector||this.debugWarn(this.TAG_NAME,`use object detector, useWasm is ${this._opt.useWasm} and window.JbProObjectDetector is null`)),this._opt.useOcclusionDetector&&(this._opt.useWasm&&window.JessibucaProOcclusionDetector||this.debugWarn(this.TAG_NAME,`use occlusion detector, useWasm is ${this._opt.useWasm} and window.JessibucaProOcclusionDetector is null`)),this._opt.useImageDetector&&(this._opt.useWasm&&window.JessibucaProImageDetector||this.debugWarn(this.TAG_NAME,`use image detector, useWasm is ${this._opt.useWasm} and window.JessibucaProImageDetector is null`)),this._opt.videoRenderType&&(this.debugLog(this.TAG_NAME,`videoRenderType is ${this._opt.videoRenderType}`),this._opt.videoRenderType===J?(this._opt.useVideoRender=!0,this._opt.useCanvasRender=!1):this._opt.videoRenderType===H&&(this._opt.useVideoRender=!1,this._opt.useCanvasRender=!0)),this._opt.useVideoRender&&(this._opt.useWasm&&!this._opt.useOffscreen?(this._opt.wasmUseVideoRender=_o()&&xo()&&Do(),this._opt.wasmUseVideoRender||this.debugWarn(this.TAG_NAME,"use wasm video render, but not support so set wasmUseVideoRender false")):this._opt.useWCS&&!this._opt.useOffscreen&&(this._opt.wcsUseVideoRender=xo()&&Do(),this._opt.wcsUseVideoRender||this.debugWarn(this.TAG_NAME,"use wcs video render, but not support so set wcsUseVideoRender false"))),this._opt.useCanvasRender&&(this._opt.useMSE&&ya(this._opt.mseDecoderUseWorker)&&(this._opt.mseUseCanvasRender=!0),this._opt.useWasm&&(this._opt.wasmUseVideoRender=!1),this._opt.useWCS&&(this._opt.wcsUseVideoRender=!1),this.isOldHls()&&!bo()&&(this._opt.hlsUseCanvasRender=!0),this.isWebrtcH264()&&(this._opt.webrtcUseCanvasRender=!0)),this._opt.useVideoRender=!1,this._opt.useCanvasRender=!1,this._opt.useWasm?this._opt.wasmUseVideoRender?this._opt.useVideoRender=!0:this._opt.useCanvasRender=!0:this._opt.useWCS?this._opt.wcsUseVideoRender?this._opt.useVideoRender=!0:this._opt.useCanvasRender=!0:this._opt.useMSE?this._opt.mseUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0:this.isOldHls()?this._opt.hlsUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0:this.isWebrtcH264()&&(this._opt.webrtcUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0),this._opt.useCanvasRender&&this.useVideoPlayAudio()&&(this.debugLog(this.TAG_NAME,"useCanvasRender is true and useVideoPlayAudio() return true, so set wcsDecodeAudio false"),this._opt.wcsDecodeAudio=!1,this._opt.wasmPlayAudioUseVideoRender=!1),s=this,Object.defineProperty(s,"rect",{get:()=>{let e={};return s.$container&&(e=s.$container.getBoundingClientRect(),e.width=Math.max(e.width,s.$container.clientWidth),e.height=Math.max(e.height,s.$container.clientHeight)),e}}),["bottom","height","left","right","top","width"].forEach((e=>{Object.defineProperty(s,e,{get:()=>s.rect[e]||0})})),this.events=new xa(this),this._opt.hasVideo&&(this.video=new sn(this),this.recorder=new pl(this)),this.isOldHls()?(this.hlsDecoder=new GA(this),this.loaded=!0):this.isWebrtcH264()?(this._opt.isWebrtcForZLM?this.webrtc=new bv(this):this._opt.isWebrtcForSRS?this.webrtc=new gv(this):this._opt.isWebrtcForOthers?this.webrtc=new yv(this):this.webrtc=new Av(this),this.loaded=!0):this.isAliyunRtc()?(this.aliyunRtcDecoder=new vv(this),this.loaded=!0):(this.isUseHls265()&&(this.hlsDecoder=new hv(this)),this.isWebrtcH265()&&(this.webrtc=new Av(this)),ya(ia(this._opt))?this.decoderWorker=new bl(this):this.loaded=!0),this._opt.hasAudio&&(this.audio=new wn(this)),this.stream=null,this.demux=null,this._lastVolume=null,this._isMute=null,this._isInZoom=!1,this._playingStartTimestamp=null,this.isMSEVideoDecoderInitializationFailedNotSupportHevc=!1,this.isMSEAudioDecoderError=!1,this.isMSEPlaybackRateChangePause=!1,this.isMSECurrentMoreThanBufferedPause=!1,this.isPlayFailedAndPaused=!1,this._seiList=[],this._opt.useWCS&&(this.webcodecsDecoder=new Kh(this),!this._opt.hasAudio&&ya(this._opt.demuxUseWorker)&&(this.loaded=!0)),this._opt.useMSE&&ya(this._opt.mseDecoderUseWorker)&&(this.mseDecoder=new gc(this),!this._opt.hasAudio&&ya(this._opt.demuxUseWorker)&&(this.loaded=!0)),this.control=new pc(this),this._opt.contextmenuBtns.length>0&&ya(this._opt.disableContextmenu)&&fo()?this.contextmenu=new fv(this):ga(this._opt.disableContextmenu)&&this._opt.contextmenuBtns.length>0&&fo()&&this.debugWarn(this.TAG_NAME,"disableContextmenu is true, but contextmenuBtns is not empty, so Contextmenu can not be created,please check"),this.isPlayback()&&(this.playback=new cv(this,this._opt.playbackConfig)),this._opt.operateBtns.zoom&&(this.zoom=new uv(this)),/(iphone|ipad|ipod|ios|android)/i.test(window.navigator.userAgent.toLowerCase())&&ya(this._opt.supportLockScreenPlayAudio&&Ao())&&(this.keepScreenOn=new Ac(this)),(e=>{try{const t=t=>{Qo(t)===e.$container&&(e.emit(nt.fullscreen,e.fullscreen),e.fullscreen?e._opt.useMSE&&e.resize():e.resize())};Pr.on("change",t),e.events.destroys.push((()=>{Pr.off("change",t)}))}catch(e){}if(e.on(at.decoderWorkerInit,(()=>{e.debugLog("player","listen decoderWorkerInit and set loaded true"),e.loaded=!0})),e.on(at.play,(()=>{e.loading=!1})),e.on(at.fullscreen,(t=>{if(t)try{Pr.request(e.$container).then((()=>{})).catch((t=>{e.debugError("player","fullscreen request error",t,t.toString()),e.emitError(dt.fullscreenError,t.toString()),po()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}))}catch(t){po()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}else try{Pr.exit().then((()=>{e.webFullscreen&&(e.webFullscreen=!1)})).catch((t=>{e.debugError("player","fullscreen exit error",t,t.toString()),e.emitError(dt.fullscreenError,t.toString()),e.webFullscreen&&(e.webFullscreen=!1)}))}catch(t){e.webFullscreen&&(e.webFullscreen=!1)}})),po()&&e.on(at.webFullscreen,(t=>{t?e.$container.classList.add("jb-pro-fullscreen-web"):e.$container.classList.remove("jb-pro-fullscreen-web"),e.emit(nt.fullscreen,e.fullscreen)})),e.on(at.resize,(()=>{e.resize()})),e._opt.debug){const t=[at.timeUpdate,at.currentPts,at.videoSEI,at.videoSEISyncPts,at.performance,at.videoSmooth],i=[at.stats,at.playbackStats,at.playbackTimestamp,at.flvMetaData,at.playToRenderTimes,at.audioInfo,at.videoInfo];Object.keys(at).forEach((s=>{e.on(at[s],(function(r){if(!t.includes(s)){i.includes(s)&&(r=JSON.stringify(r));for(var o=arguments.length,a=new Array(o>1?o-1:0),n=1;n{e.on(dt[t],(function(){for(var i=arguments.length,s=new Array(i),r=0;r{this.updateOption({rotate:e?270:0}),this.resize()}),10)}get webFullscreen(){return this.$container.classList.contains("jb-pro-fullscreen-web")}set loaded(e){this._hasLoaded=e}get loaded(){return this._hasLoaded||this.isOldHls()||this.isWebrtcH264()||this._opt.useMSE&&ya(this._opt.hasAudio)&&ya(this._opt.demuxUseWorker)||this._opt.useWCS&&!this._opt.hasAudio&&ya(this._opt.demuxUseWorker)}set playing(e){this.isClosed()&&e?this.debugLog(this.TAG_NAME,"player is closed, so can not play"):(e&&ga(this.loading)&&(this.loading=!1),this.playing!==e&&(this._playing=e,this.emit(at.playing,e),this.emit(at.volumechange,this.volume),e?this.emit(at.play):this.emit(at.pause)))}get playing(){return this._playing}get volume(){return this.audio&&this.audio.volume||0}set volume(e){e!==this.volume&&(this.audio?(this.audio.setVolume(e),this._lastVolume=this.volume,this._isMute=0===this.volume):this.debugWarn(this.TAG_NAME,"set volume error, audio is null"))}get lastVolume(){return this._lastVolume}set loading(e){this.loading!==e&&(this._loading=e,this.emit(at.loading,this._loading))}get loading(){return this._loading}set zooming(e){this.isDestroyedOrClosed()||this.zooming!==e&&(this.zoom||(this.zoom=new uv(this)),this._zooming=e,this.emit(at.zooming,this.zooming))}get zooming(){return this._zooming}set drawingRect(e){this.isDestroyedOrClosed()||this.drawingRect!==e&&(this.drawRectangle||(this.drawRectangle=new Sv(this)),this._drawingRect=e,this.emit(at.drawingRect,this.drawingRect))}get drawingRect(){return this._drawingRect}set recording(e){e?this.playing&&!this.recording&&(this.recorder&&this.recorder.startRecord(),this.isDemuxInWorker()&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!0})):this.recording&&(this.isDemuxInWorker()&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder&&this.recorder.stopRecordAndSave().then((()=>{})).catch((e=>{})))}get recording(){return!!this.recorder&&this.recorder.isRecording}set audioTimestamp(e){null!==e&&(this._audioTimestamp=e)}get audioTimestamp(){return this._audioTimestamp}set latestAudioTimestamp(e){null!==e&&(this._latestAudioTimestamp=e)}get latestAudioTimestamp(){return this._latestAudioTimestamp}get videoTimestamp(){return this._stats.currentPts||this._stats.ts}set streamQuality(e){this.streamQuality!==e&&(this._streamQuality=e,this.emit(at.streamQualityChange,e))}get streamQuality(){return this._streamQuality}get isDebug(){return ga(this._opt.debug)}get scaleType(){const e=this._opt,t=e.isResize,i=e.isFullResize;let s=Zt;return ya(i)&&ya(t)?s=Zt:ya(i)&&ga(t)?s=ei:ga(i)&&ga(t)&&(s=ti),s}set visibility(e){this._visibility!==e&&(this._visibility=e,this.emit(at.visibilityChange,e),this._lastestVisibilityChangeTimestamp=ro(),e?this.clearVisibilityHiddenTimeout():this.startVisibilityHiddenTimeout())}get visibility(){return this._visibility}set playbackPause(e){this._playbackPause!==e&&(this._playbackPause=e,this.emit(at.playbackPause,e),this.emit(at.playbackPauseOrResume,e))}get playbackPause(){return this.isPlayback()&&this._playbackPause}set videoIframeIntervalTs(e){this._videoIframeIntervalTs=e}get videoIframeIntervalTs(){return this._videoIframeIntervalTs}set faceDetectActive(e){this._faceDetectActive!==e&&(this._faceDetectActive=e,this.emit(at.faceDetectActive,e))}get faceDetectActive(){return this._faceDetectActive}set objectDetectActive(e){this._objectDetectActive!==e&&(this._objectDetectActive=e,this.emit(at.objectDetectActive,e))}get objectDetectActive(){return this._objectDetectActive}set occlusionDetectActive(e){this._occlusionDetectActive!==e&&(this._occlusionDetectActive=e,this.emit(at.occlusionDetectActive,e))}get occlusionDetectActive(){return this._occlusionDetectActive}set imageDetectActive(e){this._imageDetectActive!==e&&(this._imageDetectActive=e)}get imageDetectActive(){return this._imageDetectActive}get isUseWorkerDemuxAndDecode(){return this.stream&&this.stream.getStreamType()===A}isDestroyed(){return this._destroyed}isDestroying(){return this._destroyed&&this._destroyLock}isClosed(){return this._closed}isDestroyedOrClosed(){return this.isDestroyed()||this.isClosed()}isLoading(){return this.loading}isPlaying(){let e=!1;return this._opt.playType===v?e=this.playing:this._opt.playType===w&&(e=ya(this.playbackPause)&&this.playing),e}updateOption(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._opt=Object.assign({},this._opt,e),ga(t)&&this.decoderWorker&&Object.keys(e).forEach((t=>{this.decoderWorker.updateWorkConfig({key:t,value:e[t]})}))}init(){return new Promise(((e,t)=>{this.video||this._opt.hasVideo&&(this.video=new sn(this)),this.audio||this._opt.hasAudio&&(this.audio=new wn(this)),this.stream||(this.stream=new Rn(this)),this.isOldHls()?(this.hlsDecoder||(this.hlsDecoder=new GA(this),this.loaded=!0),e()):this.isWebrtcH264()?(this.webrtc||(this._opt.isWebrtcForZLM?this.webrtc=new bv(this):this._opt.isWebrtcForSRS?this.webrtc=new gv(this):this._opt.isWebrtcForOthers?this.webrtc=new yv(this):this.webrtc=new Av(this),this.loaded=!0),e()):this.isAliyunRtc()?(this.aliyunRtcDecoder||(this.aliyunRtcDecoder=new vv(this),this.loaded=!0),e()):(this.demux||this._opt.hasVideo&&!this.isUseWorkerDemuxAndDecode&&(this.demux=new Gh(this)),this._opt.useWCS&&(this.webcodecsDecoder||(this.webcodecsDecoder=new Kh(this))),this._opt.useMSE&&ya(this._opt.mseDecoderUseWorker)&&(this.mseDecoder||(this.mseDecoder=new gc(this))),this.isUseHls265()&&(this.hlsDecoder||(this.hlsDecoder=new hv(this))),this.isWebrtcH265()&&(this.webrtc||(this.webrtc=new Av(this))),this.decoderWorker?this.loaded?e():this.once(at.decoderWorkerInit,(()=>{this.isDestroyedOrClosed()?(this.debugError(this.TAG_NAME,"init() failed and player is destroyed"),t("init() failed and player is destroyed")):(this.loaded=!0,e())})):ya(ia(this._opt))?(this.decoderWorker=new bl(this),this.once(at.decoderWorkerInit,(()=>{this.isDestroyedOrClosed()?(this.debugError(this.TAG_NAME,"init() failed and player is destroyed"),t("init() failed and player is destroyed")):(this.loaded=!0,e())}))):e())}))}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(!e&&!this._opt.url)return s("url is empty");this._closed=!1,this.loading=!0,this.playing=!1,this._times.playInitStart=ro(),e||(e=this._opt.url),this._opt.url=e,this.control&&this._opt.loadingBackground&&this.control.initLoadingBackground(),this.init().then((()=>{this.debugLog(this.TAG_NAME,"play() init and next fetch stream"),this._times.playStart=ro(),this._opt.isNotMute&&this.mute(!1),this.enableWakeLock(),this.checkLoadingTimeout(),this.stream?(this.stream.once(dt.fetchError,(e=>{this.emitError(dt.fetchError,e)})),this.stream.once(dt.websocketError,(e=>{this.emitError(dt.websocketError,e)})),this.stream.once(at.streamEnd,(e=>{this.emit(at.streamEnd,e)})),this.stream.once(dt.hlsError,(e=>{this.emitError(dt.hlsError,e)})),this.stream.once(dt.webrtcError,(e=>{this.emitError(dt.webrtcError,e)})),this.stream.once(at.streamSuccess,(()=>{i(),this._times.streamResponse=ro(),this.video&&this.video.play(),this.checkStatsInterval(),this.isPlayback()&&this.playback&&this.playback.startCheckStatsInterval();{const e=Number("1")||1;setTimeout((()=>{this.destroy(),console.error("Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码)"),alert("Jb pro 体验结束,请刷新页面再次体验,如需要购买商业授权,可以联系微信:bosswancheng"),window.location.reload()}),60*e*60*1e3)}})),this.stream.fetchStream(e,t)):(this.debugWarn(this.TAG_NAME,`play() this.stream is null and is isDestroyedOrClosed is ${this.isDestroyedOrClosed()}`),s("this.stream is null"))})).catch((e=>{s(e)}))}))}playForControl(){return new Promise(((e,t)=>{this.debugLog(this.TAG_NAME,`playForControl() and pauseAndNextPlayUseLastFrameShow is ${this._opt.pauseAndNextPlayUseLastFrameShow}`),this._opt.pauseAndNextPlayUseLastFrameShow&&this._tempInnerPlayBgobj&&this._tempInnerPlayBgobj.loadingBackground&&this.updateOption({loadingBackground:this._tempInnerPlayBgobj.loadingBackground,loadingBackgroundWidth:this._tempInnerPlayBgobj.loadingBackgroundWidth,loadingBackgroundHeight:this._tempInnerPlayBgobj.loadingBackgroundHeight}),this.play().then((t=>{e(t)})).catch((e=>{t(e)}))}))}close(){return new Promise(((e,t)=>{this._close().then((()=>{this.video&&this.video.clearView(),e()})).catch((e=>{t(e)}))}))}resumeAudioAfterPause(){this.lastVolume&&ya(this._isMute)&&(this.volume=this.lastVolume)}async _close(){this._closed=!0,this.video&&(this.video.resetInit(),this.video.pause(!0)),this.loading=!1,this.recording=!1,this.zooming=!1,this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.isPlayback()&&this.playback&&this.playback.clearStatsInterval(),this.releaseWakeLock(),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.decoderWorker&&(await this.decoderWorker.destroy(),this.decoderWorker=null),this.stream&&(await this.stream.destroy(),this.stream=null),this.demux&&(this.demux.destroy(),this.demux=null),this.webcodecsDecoder&&(await this.webcodecsDecoder.destroy(),this.webcodecsDecoder=null),this.mseDecoder&&(this.mseDecoder.destroy(),this.mseDecoder=null),this.hlsDecoder&&(await this.hlsDecoder.destroy(),this.hlsDecoder=null),this.webrtc&&(this.webrtc.destroy(),this.webrtc=null),this.aliyunRtcDecoder&&(this.aliyunRtcDecoder.destroy(),this.aliyunRtcDecoder=null),this.audio&&(await this.audio.destroy(),this.audio=null),this.playing=!1}pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(((t,i)=>{e?this.close().then((()=>{t()})).catch((e=>{i(e)})):this._close().then((()=>{t()})).catch((e=>{i(e)}))}))}pauseForControl(){return new Promise(((e,t)=>{if(this.debugLog(this.TAG_NAME,"_pauseInner()"),this._opt.pauseAndNextPlayUseLastFrameShow&&this.video){const e=this.video.screenshot("","png",.92,"base64");if(e){const t=this.getVideoInfo();t?(this.debugLog(this.TAG_NAME,`pauseForControl() and loadingBackground width is ${t.width} and height is ${t.height}`),this._tempInnerPlayBgobj={loadingBackground:e,loadingBackgroundWidth:t.width,loadingBackgroundHeight:t.height}):this.debugWarn(this.TAG_NAME,"pauseForControl() and videoInfo is null")}else this.debugWarn(this.TAG_NAME,"pauseForControl() and loadingBackground is null")}this.pause().then((t=>{e(t)})).catch((e=>{t(e)}))}))}isAudioMute(){let e=!0;return this.audio&&(e=this.audio.isMute),e}isAudioNotMute(){return!this.isAudioMute()}mute(e){this.audio&&this.audio.mute(e)}resize(){this.video&&this.video.resize()}startRecord(e,t){this.recording||(this.recorder.setFileName(e,t),this.recording=!0)}cancelRecord(){return new Promise(((e,t)=>{this.recorder||t("recorder is null"),this.recording&&(this._opt.useWasm&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder.cancelRecord().then((()=>{e()})).catch((e=>{t(e)})))}))}stopRecordAndSave(e,t){return new Promise(((i,s)=>{this.recorder||s("recorder is null"),this.recording?(this._opt.useWasm&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder.stopRecordAndSave(e,t).then((e=>{i(e)})).catch((e=>{s(e)}))):s("recorder is not recording")}))}_hasControl(){let e=!1,t=!1;return Object.keys(this._opt.operateBtns).forEach((e=>{this._opt.operateBtns[e]&&-1===(""+e).indexOf("Fn")&&(t=!0)})),(this._opt.showBandwidth||t)&&(e=!0),this._opt.extendOperateBtns&&this._opt.extendOperateBtns.length>0&&(e=!0),this.isPlayback()&&this._opt.playbackConfig.showControl&&(e=!0),this._opt.controlHtml&&(e=!0),e}useWasmDecode(){return ya(this._opt.useMSE)&&ya(this._opt.useWCS)}canVideoTrackWritter(){const e=this._opt;return!this.isOldHls()&&!this.isWebrtcH264()&&ya(e.useMSE)&&!this.isAliyunRtc()&&(e.useWCS&&ya(e.useOffscreen)&&e.wcsUseVideoRender||this.useWasmDecode())}checkHeartTimeout$2(){if(ya(this.playbackPause)&&this.playing){if(this.isDestroyedOrClosed())return void this.debugWarn(this.TAG_NAME,"checkHeartTimeout$2 but player is destroyed");if(ya(this.isHistoryFpsListAllZero()))return void this.debugWarn(this.TAG_NAME,"checkHeartTimeout$2 but fps is not all zero");if(0!==this._stats.fps)return void this.debugWarn(this.TAG_NAME,`checkHeartTimeout$2 but fps is ${this._stats.fps}`);const e=this._historyFpsList.join(",");this.debugWarn(this.TAG_NAME,`checkHeartTimeout$2 and\n pause and emit delayTimeout event and\n current vbps is ${this._stats.vbps} and\n current fps is ${this._stats.fps} and\n history FpsList is ${e} and\n current visibility is ${this.visibility} and`),this.emit(at.timeout,at.delayTimeout),this.emit(at.delayTimeout)}else this.debugLog(this.TAG_NAME,`checkHeartTimeout$2 playbackPause is ${this.playbackPause}, playing is ${this.playing}`)}checkStatsInterval(){this._checkStatsInterval=setInterval((()=>{this.updateStats()}),1e3)}checkLoadingTimeout(){this._checkLoadingTimeout=setTimeout((()=>{this.playing?this.debugWarn(this.TAG_NAME,`checkLoadingTimeout but loading is ${this.loading} and playing is ${this.playing}`):this.isDestroyedOrClosed()?this.debugWarn(this.TAG_NAME,"checkLoadingTimeout but player is destroyed"):(this.debugWarn(this.TAG_NAME,"checkLoadingTimeout and pause and emit loadingTimeout event"),this.emit(at.timeout,at.loadingTimeout),this.emit(at.loadingTimeout))}),1e3*this._opt.loadingTimeout)}clearCheckLoadingTimeout(){this._checkLoadingTimeout&&(this.debugLog(this.TAG_NAME,"clearCheckLoadingTimeout"),clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}handleRender(){this.isDestroyedOrClosed()?this.debugWarn(this.TAG_NAME,"handleRender but player is destroyed"):(this.loading&&(this.clearCheckLoadingTimeout(),this.loading=!1,this.emit(at.start)),this.playing||(this.playing=!0))}updateStats(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.isDestroyedOrClosed())return void this.debugLog(this.TAG_NAME,"updateStats but player is closed or destroyed");if(this._startBpsTime||(this._startBpsTime=ro()),Bo(e.ts)){const t=parseInt(e.ts,10);this._stats.ts=t,this._tempTsList.push(t),null===this._playingStartTimestamp&&t>0&&(this._playingStartTimestamp=t)}Bo(e.dts)&&(this._stats.dts=parseInt(e.dts,10)),Bo(e.mseTs)&&(this._stats.mseTs=e.mseTs),Bo(e.buf)&&(this._stats.buf=e.buf),Bo(e.netBuf)&&(this._stats.netBuf=e.netBuf),Bo(e.currentPts)&&(this._stats.currentPts=e.currentPts),e.fps&&(this._stats.fps+=1),e.dfps&&(this._stats.dfps+=1),e.abps&&(this._stats.abps+=e.abps),e.vbps&&(this._stats.vbps+=e.vbps),e.workerStats&&(this._tempWorkerStats=e.workerStats),e.isDropping&&(this._stats.isDropping=e.isDropping),e.mseVideoBufferDelayTime&&(this._stats.mseVideoBufferDelayTime=parseInt(1e3*e.mseVideoBufferDelayTime,10));const t=ro();if(t-this._startBpsTime<1e3)return;null!==this._playingStartTimestamp&&this._stats.fps>0&&(this._stats.pTs+=1);let i=0,s=0,r=0,o=0,a=0;this._opt.useMSE&&(this.mseDecoder?(i=this.mseDecoder.checkSourceBufferDelay(),i=parseInt(1e3*i,10),s=this.mseDecoder.checkSourceBufferStore(),s=s.toFixed(2),o=this.mseDecoder.getDecodePlaybackRate(),a=this.mseDecoder.getPendingSegmentsLength()):this.isMseDecoderUseWorker()&&(i=this.video.checkSourceBufferDelay(),i=parseInt(1e3*i,10),s=this.video.checkSourceBufferStore(),s=s.toFixed(2),o=this.video.getDecodePlaybackRate())),this._opt.useWCS&&this.webcodecsDecoder&&(r=this.webcodecsDecoder.getDecodeDiffTimes()),this.isOldHls()&&this.hlsDecoder&&(i=this.hlsDecoder.checkHlsBufferedDelay(),i=parseInt(1e3*i,10));let n=0,l=0,d=0;this.isUseHls265()&&this.hlsDecoder&&(i=this.hlsDecoder.checkHlsBufferedDelay(),i=i.toFixed(2),n=this.hlsDecoder.getDemuxBufferedListLength(),d=this.hlsDecoder.getDemuxVideoBufferedListLength(),l=this.hlsDecoder.getDemuxAudioBufferedListLength());let h=0,c=0,u=0,p=!1,f=0,m=0;this._opt.useWasm||this._opt.demuxUseWorker?this._tempWorkerStats&&(c=this._tempWorkerStats.demuxBufferDelay,u=this._tempWorkerStats.audioDemuxBufferDelay,h=this._tempWorkerStats.streamBufferByteLength,this._stats.netBuf=this._tempWorkerStats.netBuf,f=this._tempWorkerStats.pushLatestDelay,p=this._tempWorkerStats.isStreamTsMoreThanLocal,this._stats.buf=this._tempWorkerStats.latestDelay,m=this._tempWorkerStats.wasmDecodeDelay):this.demux&&(h=this.demux.getInputByteLength(),f=this.demux.getPushLatestDelay(),p=this.demux.getIsStreamTsMoreThanLocal(),this.demux.bufferList&&(c=this.demux.bufferList.length));let g=0,y=0;this.audio&&this.audio.bufferList&&(g=this.audio.bufferList.length,y=parseInt(g*this.audio.oneBufferDuration,10));let A=0,b=0;if(this.isPlayback()&&this.video){this._opt.playbackConfig.isUseFpsRender&&(A=this.video.bufferList&&this.video.bufferList.length||0);let e=this.video.getStreamFps();const t=e>0?1e3/e:0;b=parseInt(t*A+t*c,10)}let v=0;this.videoTimestamp>0&&(v=this._stats.dts-this.videoTimestamp);const _=v+this._stats.netBuf;this.isOldHls()&&(this._stats.fps=this.hlsDecoder.getFps()),this._stats.fps>this._stats.maxFps&&(this._stats.maxFps=this._stats.fps);let w=this.getVideoCurrentTime();const S=this._stats.videoCurrentTime;let E=-1;S&&w&&(E=wo((w-S).toFixed(2)),w=w.toFixed(2));let T=0;this.audioTimestamp>0&&(T=this.audioTimestamp-this.getRenderCurrentPts()),this._allStatsData=Object.assign(this._stats,{audioBuffer:g,audioBufferDelayTs:y,audioTs:this.audioTimestamp,latestAudioTs:this.latestAudioTimestamp,playbackVideoBuffer:A,playbackVideoWaitingBuffer:0,playbackAudioWaitingBuffer:0,playbackCacheDataDuration:b,demuxBuffer:c,pushLatestDelay:f,audioDemuxBuffer:u,streamBuffer:h,mseDelay:i,mseStore:s,mseDecodeDiffTimes:r,mseDecodePlaybackRate:o,msePendingBuffer:a,wcsDecodeDiffTimes:r,wasmDecodeDelay:m,hlsDelay:i,hlsDemuxLength:n,hlsDemuxAudioLength:l,hlsDemuxVideoLength:d,delayTs:v,totalDelayTs:_,isStreamTsMoreThanLocal:p,videoCurrentTime:w,videoCurrentTimeDiff:E,audioSyncVideo:T});let L=null,C=null,x="";if(this.isPlayer()&&this._opt.hasVideo&&this.playing){L=function(e,t){let i=3;const s=t||25;return e<=s*(1/4)?i=0:e<=.5*s?i=1:e<=s*(3/4)&&(i=2),i}(this._stats.fps,this._flvMetaDataFps),this._allStatsData.performance=L;const e=this.checkVideoSmooth(this._allStatsData);x=e.reason,C=e.result,this._allStatsData.videoSmooth=C}this.emit(at.stats,this._allStatsData),this._allStatsData.streamBuffer>this._opt.flvDemuxBufferSizeMaxLarge&&this.getDemuxType()===k&&this.emit(dt.flvDemuxBufferSizeTooLarge,this._allStatsData.streamBuffer),this._opt.hasVideo?(this.updateHistoryFpsList(this._stats.fps,this._allStatsData.videoCurrentTimeDiff),Bo(L)&&this.emit(at.performance,L),Bo(C)&&this.emit(at.videoSmooth,C,x)):this._opt.hasAudio&&this.updateHistoryFpsList(this._stats.abps,0),this._stats.fps=0,this._stats.dfps=0,this._stats.abps=0,this._stats.vbps=0,this._tempTsList=[],this._stats.isDropping=!1,this._startBpsTime=t}resetStats(){this._startBpsTime=null,this._playingStartTimestamp=null,this._historyFpsList=[],this._historyVideoDiffList=[],this._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,currentPts:0,pTs:0,dts:0,mseVideoBufferDelayTime:0,isDropping:!1},this._allStatsData={},this._tempTsList=[]}checkVideoSmooth(e){let t=!0,i="";if(this._opt.videoBuffer,this._opt.videoBufferDelay,this.isWebrtcH264()||this.isOldHls())return{result:t,reason:i};if(0===e.vbps&&ya(this._opt.isHls)&&(i="vbpsIsZero",this.debugLog(this.TAG_NAME,`checkVideoSmooth false because ${i}`),t=!1),t&&e.isDropping&&(i="isDroppingIsTrue",this.debugLog(this.TAG_NAME,`checkVideoSmooth false because ${i}`),t=!1),t&&this.visibility&&this._historyFpsList.length>=this._opt.heartTimeout){const s=function(e){const t=Math.max(...e),i=Math.min(...e);return e.filter((e=>e!==t&&e!==i))}(this._historyFpsList),r=s.reduce(((e,t)=>e+t),0)/s.length,o=.83*r;e.fps=1.5||e.videoCurrentTimeDiff<=.5)&&-1!==e.videoCurrentTimeDiff){if(i="videoCurrentTimeDiffIsNotNormal",this.debugLog(this.TAG_NAME,`checkVideoSmooth false because videoCurrentTimeDiff is ${e.videoCurrentTimeDiff}`),0===Number(e.videoCurrentTimeDiff)){const e=this.isVideoPlaying(),t=this.getVideoCurrentTime(),i=this.getVideoBufferTimeRange();let s=-1,r=-1;i&&(s=i.start,r=i.end),this.debugLog(this.TAG_NAME,`checkVideoSmooth and videoCurrentTimeDiff is 0 so check\n videoCurrentTime is ${t} and isPlaying is ${e}\n bufferStartTime is ${s} and bufferEndTime is ${r}`)}t=!1}return{result:t,reason:i}}enableWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.enable()}releaseWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.disable()}clearBufferDelay(){this._opt.useWasm?this.decoderWorker&&this.decoderWorker.clearWorkBuffer(!0):this.demux&&this.demux.clearBuffer(!0)}doDestroy(){this.emit(at.beforeDestroy)}handlePlayToRenderTimes(){if(this.isDestroyedOrClosed())return void this.debugLog(this.TAG_NAME,"handlePlayToRenderTimes but player is closed or destroyed");const e=this.getPlayToRenderTimes();this.emit(at.playToRenderTimes,e)}getPlayToRenderTimes(){const e=this._times;return e.playTimestamp=e.playStart-e.playInitStart,e.streamTimestamp=e.streamStart-e.playStart,e.streamResponseTimestamp=e.streamResponse-e.streamStart>0?e.streamResponse-e.streamStart:0,e.demuxTimestamp=e.demuxStart-e.streamResponse>0?e.demuxStart-e.streamResponse:0,e.decodeTimestamp=e.decodeStart-e.demuxStart>0?e.decodeStart-e.demuxStart:0,e.videoTimestamp=e.videoStart-e.decodeStart,e.allTimestamp=e.videoStart-e.playInitStart,e}getOption(){return this._opt}getPlayType(){return this._opt.playType}isPlayer(){return this._opt.playType===v}isPlayback(){return this._opt.playType===w}isDemuxSetCodecInit(){let e=!0,t=this._opt;return t.useWCS&&!t.useOffscreen?e=!!this.webcodecsDecoder&&this.webcodecsDecoder.hasInit:t.useMSE&&(e=!!this.mseDecoder&&this.mseDecoder.hasInit),e}isDemuxDecodeFirstIIframeInit(){let e=!0,t=this._opt;return t.useWCS&&!t.useOffscreen?e=!!this.webcodecsDecoder&&this.webcodecsDecoder.isDecodeFirstIIframe:t.useMSE&&(e=!!this.mseDecoder&&this.mseDecoder.isDecodeFirstIIframe),e}isAudioPlaybackRateSpeed(){let e=!1;return this.audio&&(e=this.audio.isPlaybackRateSpeed()),e}getPlayingTimestamp(){return this._stats.pTs}getRecordingType(){let e=null;return this.recorder&&(e=this.recorder.getType()),e}getRecordingByteLength(){let e=0;return this.recording&&(e=this.recorder.getToTalByteLength()),e}getRecordingDuration(){let e=0;return this.recording&&(e=this.recorder.getTotalDuration()),e}getDecodeType(){let e="";const t=this.getOption();return this.isWebrtcH264()?z:this.isAliyunRtc()?V:this.isOldHls()?$:(t.useMSE&&(e+=U+" ",t.mseDecoderUseWorker&&(e+="worker")),t.useWCS&&(e+=O+" "),t.useWasm&&(e+=j+" ",t.useSIMD&&(e+=G+" "),t.useMThreading&&(e+=W+" ")),t.useOffscreen&&(e+=N+" "),e)}getDemuxType(){return this._opt.demuxType}getRenderType(){let e="";return this.video&&(e=this.video.getType()),e}getCanvasRenderType(){let e="";return this.video&&(e=this.video.getCanvasType()),e}getAudioEngineType(){let e="";return this.audio&&(e=this.audio.getEngineType()),e}getStreamType(){let e="";return this.stream&&(e=this.stream.getStreamType()),e}getAllStatsData(){return this._allStatsData}isFlvDemux(){return this._opt.demuxType===k}isM7SDemux(){return this._opt.demuxType===L}isNakedFlowDemux(){return this._opt.demuxType===R}isMpeg4Demux(){return this._opt.demuxType===I}isTsDemux(){return this._opt.demuxType===M}isFmp4Demux(){return this._opt.demuxType===P}togglePerformancePanel(e){this.updateOption({showPerformance:e}),this.emit(at.togglePerformancePanel,e)}setScaleMode(e){let t={isFullResize:!1,isResize:!1,aspectRatio:"default"};switch(e=Number(e)){case Zt:t.isFullResize=!1,t.isResize=!1;break;case ei:t.isFullResize=!1,t.isResize=!0;break;case ti:t.isFullResize=!0,t.isResize=!0}this.updateOption(t),this.resize(),this.emit(at.viewResizeChange,e)}startVisibilityHiddenTimeout(){this.clearVisibilityHiddenTimeout(),this._opt.pageVisibilityHiddenTimeout>0&&(this.visibilityHiddenTimeout=setTimeout((()=>{this.emit(at.visibilityHiddenTimeout)}),1e3*this._opt.pageVisibilityHiddenTimeout))}clearVisibilityHiddenTimeout(){this._checkVisibleHiddenTimeout&&(clearTimeout(this._checkVisibleHiddenTimeout),this._checkVisibleHiddenTimeout=null)}faceDetect(e){this.faceDetectActive=e,ya(e)&&this.video&&this.video.addAiContentToCanvas([])}objectDetect(e){this.objectDetectActive=e,ya(e)&&this.video&&this.video.addAiContentToCanvas([])}occlusionDetect(e){this.occlusionDetectActive=e}downloadNakedFlowFile(){this.demux&&this.demux.downloadNakedFlowFile&&this.demux.downloadNakedFlowFile()}downloadFmp4File(){this.demux&&this.demux.downloadFmp4File&&this.demux.downloadFmp4File()}downloadMpeg4File(){const e=new Blob([this._tempStreamList]);try{const t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".mpeg4",t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadMpeg4File",e)}}hasCacheOnGopBuffer(){const e=this.videoIframeIntervalTs,t=this._allStatsData.demuxBuffer,i=this._allStatsData.maxFps;let s=!1;if(e&&t&&i){s=1e3/i*t>e}return s}addContentToCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.video&&this.video.addContentToCanvas(e)}addContentToContainer(){}sendWebsocketMessage(e){const t=this.getStreamType();t===m||t===A+" "+m?this.stream.sendMessage(e):this.debugWarn(this.TAG_NAME,`sendWebsocketMessage: stream type is not websocket, current stream type is ${this.getStreamType()}`)}checkIsInRender(){const e=this._stats;return e.vbps>0&&e.fps>0}setControlHtml(e){this.control&&this.control.$controlHtml&&(this.control.$controlHtml.innerHTML=e)}clearControlHtml(){this.control&&this.control.$controlHtml&&(this.control.$controlHtml.innerHTML="")}toggleControlHtml(e){this.control&&this.control.toggleControlHtml(e)}getControlHtmlIsShow(){return!!this.control&&this.control.getControlHtmlIsShow()}getControlHtml(){return this.control?this.control.getControlHtml():null}setExtendHtml(e){this.control&&(this.control.$extendDom?this.control.updateExtendDom(e):this.control.addExtendDom({html:e,showBeforePlay:!0}))}clearExtendHtml(){this.control&&this.control.removeExtendDom()}toggleExtendHtml(e){this.control&&this.control.toggleExtendDom(e)}getExtendHtmlIsShow(){return!!this.control&&this.control.getExtendDomIsShow()}getExtendHtml(){return this.control?this.control.getExtendDom():null}updateWatermark(e){this.singleWatermark||(this.singleWatermark=new Wa(this)),this.singleWatermark&&this.singleWatermark.update(e)}removeWatermark(){this.singleWatermark&&this.singleWatermark.remove()}getVideoInfo(){let e=null;return this.video&&(e=this.video.getVideoInfo()),e}getAudioInfo(){let e=null;return this.audio&&(e=this.audio.getAudioInfo()),e}getVideoPlaybackQuality(){let e=null;return this.video&&(e=this.video.getPlaybackQuality()),e}emitError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.emit(at.error,e,t),this.emit(e,t)}updateHistoryFpsList(e,t){this.playbackPause||ya(this.visibility)||(this._historyFpsList.length>this._opt.heartTimeout&&(this._historyFpsList.shift(),this._historyVideoDiffList.shift()),this._historyFpsList.push(e),this._historyVideoDiffList.push(t),this.isHistoryFpsListAllZero()&&this.checkHeartTimeout$2())}isHistoryFpsListAllZero(){let e=!0;if(this._historyFpsList.length0){e=!1;break}if(e)for(let t=0;t0){e=!1;break}return e}isUseHls265(){return ga(this._opt.isHls)&&ga(this._opt.supportHls265)}isHls(){return ga(this._opt.isHls)}isOldHls(){return ga(this._opt.isHls)&&ya(this._opt.supportHls265)}isWebrtcNotH265(){return ga(this._opt.isWebrtc)&&ya(this._opt.isWebrtcH265)}isWebrtcH264(){return ga(this._opt.isWebrtc)&&ya(this._opt.isWebrtcH265)}isWebrtcH265(){return ga(this._opt.isWebrtc)&&ga(this._opt.isWebrtcH265)}isAliyunRtc(){return ga(this._opt.isAliyunRtc)}isUseHls265UseMse(){return this.isUseHls265()&&this.isUseMSE()}isStreamWebTransport(){return this.getStreamType()===y}isPlaybackCacheBeforeDecodeForFpsRender(){return this.isPlayback()&&ga(this._opt.playbackConfig.isCacheBeforeDecodeForFpsRender)&&ga(this._opt.useWCS)}isPlaybackPauseNotClearCacheAndCacheBeforeDecodeAndUseFpsRender(){return this.isPlayback()&&ya(this._opt.playbackConfig.isPlaybackPauseClearCache)&&ga(this._opt.playbackConfig.isCacheBeforeDecodeForFpsRender)}isPlaybackUseWCS(){return this.isPlayback()&&ga(this._opt.useWCS)}isPlaybackUseMSE(){return this.isPlayback()&&ga(this._opt.useMSE)}isPlaybackUseWASM(){return this.isPlayback()&&ga(this._opt.useWasm)}isPlayUseMSE(){return this.isPlayer()&&ga(this._opt.useMSE)}isMSEDecodeAudio(){return this._opt.useMSE&&this._opt.mseDecodeAudio}isWCSDecodeAudio(){this._opt.useWCS&&this._opt.wcsDecodeAudio}isInWebFullscreen(){return this._opt.useWebFullScreen&&po()&&this.fullscreen}getPlaybackRate(){let e=1;return ga(this.isPlayback())&&this.playback&&(e=this.playback.rate),e}isPlaybackOnlyDecodeIFrame(){return ga(this.isPlayback())&&this.getPlaybackRate()>=this._opt.playbackForwardMaxRateDecodeIFrame&&!this.isMSEDecodeAudio()}pushTempStream(e){const t=new Uint8Array(e);this._tempStreamList.push(t)}updateLoadingText(e){this.loading&&this.control&&this.control.updateLoadingText(e)}getVideoCurrentTime(){let e=0;return this.video&&(this._opt.useMSE?this.mseDecoder?e=this.mseDecoder.getVideoCurrentTime():this.isMseDecoderUseWorker()&&(e=this.video.getVideoCurrentTime()):this.isWebrtcH264()&&this.webrtc?e=this.webrtc.getVideoCurrentTime():this.isAliyunRtc()&&this.aliyunRtcDecoder&&(e=this.aliyunRtcDecoder.getVideoCurrentTime())),e}getVideoBufferTimeRange(){let e=null;return this.video&&(this._opt.useMSE?this.mseDecoder?e=this.mseDecoder.getVideoBufferTimeRange():this.isMseDecoderUseWorker()&&(e=this.video.getVideoBufferTimeRange()):this.isWebrtcH264()&&this.webrtc?e=this.webrtc.getVideoBufferTimeRange():this.isAliyunRtc()&&this.aliyunRtcDecoder&&(e=this.aliyunRtcDecoder.getVideoBufferTimeRange())),e}isVideoPlaying(){let e=!0;return this.video&&(this._opt.useMSE?this.mseDecoder?e=this.mseDecoder.isVideoPlaying():this.isMseDecoderUseWorker()&&(e=this.video.isVideoPlaying()):this.isWebrtcH264()&&this.webrtc?e=this.webrtc.isVideoPlaying():this.isAliyunRtc()&&this.aliyunRtcDecoder&&(e=this.aliyunRtcDecoder.isVideoPlaying())),e}addMemoryLog(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s0){const e=t/1e3;this._flvMetaDataFps=e}}Io(e.hasAudio)&&ya(e.hasAudio)&&(this.debugLog("updateMetaData","hasAudio",e.hasAudio,"and update _opt.hasAudio"),this._opt.hasAudio=e.hasAudio),Io(e.hasVideo)&&ya(e.hasVideo)&&(this.debugLog("updateMetaData","hasVideo",e.hasVideo,"and update _opt.hasVideo"),this._opt.hasVideo=e.hasVideo),e.server&&(this._serverInfo=(e.server+"").substring(0,10)),e.MetaDataCreator&&(this._serverInfo=e.MetaDataCreator)}this.emit(at.flvMetaData,e)}getMetaData(){return this._flvMetaData}getExtendBtnList(){return this.control.getExtendBtnList().map((e=>({name:e.name,$container:e.$iconContainer,$btn:e.$iconWrap,$activeBtn:e.$activeIconWrap})))}getCpuLevel(){let e=null;return this.pressureObserverCpu&&(e=this.pressureObserverCpu.getCurrentCpuState()),e}isRecordTypeFlv(){return this.recorder&&this._opt.recordType===T}isRecordTypeMp4(){return this.recorder&&this._opt.recordType===S}isRecordTypeWebm(){return this.recorder&&this._opt.recordType===E}isDemuxInWorker(){return this._opt.useWasm||this._opt.demuxUseWorker}isUseMSE(){return ga(this._opt.useMSE)}isUseWCS(){return ga(this._opt.useWCS)}isUseWASM(){return ga(this._opt.useWasm)}isMseDecoderUseWorker(){return this.isUseMSE()&&ga(this._opt.mseDecoderUseWorker)}getAudioSyncVideoDiff(){return this.audioTimestamp-this.getRenderCurrentPts()}getCurrentVideoAndAudio(){return{video:this.getRenderCurrentPts(),audio:this.audioTimestamp}}getMseVideoBufferDelayTime(){let e=0;return this._opt.useMSE&&this.mseDecoder&&(this.mseDecoder?e=this.mseDecoder.getVideoBufferDelayTime():this.isMseDecoderUseWorker()&&(e=this.video.getVideoBufferDelayTime()),e=parseInt(1e3*e,10)),e}updateCurrentPts(e){this.updateStats({currentPts:e}),this.emit(at.currentPts,e),this.emitVideSeiSyncPts(e)}emitVideoSei(e){this.emit(at.videoSEI,e),this._seiList.push(e)}emitVideSeiSyncPts(e){if(0===this._seiList.length||ya(this._opt.isEmitSEI))return;const t=1e3*this._opt.videoSEISyncPtsDiff,i=e-t,s=e+t,r=[];this._seiList.forEach((t=>{t.ts>=i&&t.ts<=s&&(t.pts=e,r.push(t))})),r.forEach((e=>{this.emit(at.videoSEISyncPts,e)})),this._seiList=this._seiList.filter((e=>e.ts>s))}getRenderCurrentPts(){let e=0;return e=this._stats.currentPts?this._stats.currentPts:this.videoTimestamp-this.getMseVideoBufferDelayTime(),e}openSyncAudioAndVideo(){return this._opt.syncAudioAndVideo&&this._opt.hasVideo}showTipsMessageByCode(e){if(this.control){const t=this._opt.showMessageConfig[e]||"未知异常";this.control.showTipsMessage(t,e)}}showTipsMessageByContent(e){this.control&&e&&this.control.showTipsMessage(e)}hideTipsMessage(){this.control&&this.control.hideTipsMessage()}decoderCheckFirstIFrame(){ga(this._opt.checkFirstIFrame)&&(this.mseDecoder?this.mseDecoder.isDecodeFirstIIframe=!1:this.webcodecsDecoder&&(this.webcodecsDecoder.isDecodeFirstIIframe=!1))}isHlsCanVideoPlay(){return this._canPlayAppleMpegurl&&this.isOldHls()}setPtzPosition(e){this.control&&this.control.updatePtzPosition(e)}setRotate(e){this.updateOption({rotate:e}),this.resize()}setPlayFailedAndPaused(){this.isPlayFailedAndPaused=!0}getMseMineType(){let e={};return this.mseDecoder&&(e=this.mseDecoder.getMimeType()),e}getMaxDelayTs(){return this._opt.videoBuffer+this._opt.videoBufferDelay}isMseVideoStateInited(){return!this.video||this.video.getReadyStateInited()}showPlayBtn(){this.control&&this.control.showPlayBtn()}toggleControlExtendBtn(e,t){this.control&&this.control.toggleExtendBtn(e,t)}getControlExtendBtnActive(e){let t=!1;return this.control&&(t=this.control.getExtendBtnActive(e)),t}useVideoPlayAudio(){return this._opt.hasAudio&&(this._opt.useWCS&&this._opt.wcsDecodeAudio||this._opt.useWasm&&this._opt.wasmPlayAudioUseVideoRender)}isControlBarShow(){const e=this._opt.hasControl,t=this._opt.controlAutoHide;let i=e&&!t;return i&&this.control&&(i=this.control.getBarIsShow()),i}getControlBarShow(){let e=!1;return this.control&&(e=this.control.getBarIsShow()),e}toggleControlBar(e){this.control&&(this.control.toggleBar(e),this.resize())}debugLog(e){if(this._opt.debug&&this.debug){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s1?t-1:0),s=1;s1?t-1:0),s=1;s1&&0===e[e.length-1]&&0===e[e.length-2]}}class Tv{constructor(e){this.player=e,this.globalSetting=null;const t=So();this.defaultSettings={watermark_id:`JbPro_${t}`,watermark_prefix:`JbPro_mask_${t}`,watermark_txt:"JbPro 测试水印",watermark_x:0,watermark_y:0,watermark_rows:0,watermark_cols:0,watermark_x_space:0,watermark_y_space:0,watermark_font:"微软雅黑",watermark_color:"black",watermark_fontsize:"18px",watermark_alpha:.15,watermark_width:150,watermark_height:100,watermark_angle:15,watermark_parent_width:0,watermark_parent_height:0,watermark_parent_node:null},this.load({text:decodeURIComponent("JessibucaPro%20%E4%BD%93%E9%AA%8C"),color:"white"}),this.player.debugLog("Watermark","int")}destroy(){this._removeMark(),this.globalSetting=null,this.defaultSettings=null,this.player.debugLog("Watermark","destroy")}remove(){}load(e){this.globalSetting=e,this._loadMark(e)}resize(){this.player.debugLog("Watermark","resize()"),this.globalSetting&&this._loadMark(this.globalSetting)}_loadMark(){let e=this.defaultSettings;if(1===arguments.length&&"object"==typeof arguments[0]){var t=arguments[0]||{};for(let i in t)t[i]&&e[i]&&t[i]===e[i]||(t[i]||0===t[i])&&(e[i]=t[i])}var i=document.getElementById(e.watermark_id);i&&i.parentNode&&i.parentNode.removeChild(i);var s="string"==typeof e.watermark_parent_node?document.getElementById(e.watermark_parent_node):e.watermark_parent_node,r=s||document.body;const o=r.getBoundingClientRect();var a=Math.max(r.scrollWidth,r.clientWidth,o.width),n=Math.max(r.scrollHeight,r.clientHeight,o.height),l=arguments[0]||{},d=r;(l.watermark_parent_width||l.watermark_parent_height)&&d&&(e.watermark_x=e.watermark_x+0,e.watermark_y=e.watermark_y+0);var h=document.getElementById(e.watermark_id),c=null;if(h)h.shadowRoot&&(c=h.shadowRoot);else{(h=document.createElement("div")).id=e.watermark_id,h.setAttribute("style","pointer-events: none !important; display: block !important"),c="function"==typeof h.attachShadow?h.attachShadow({mode:"open"}):h;var u=r.children,p=Math.floor(Math.random()*(u.length-1))+1;u[p]?r.insertBefore(h,u[p]):r.appendChild(h)}e.watermark_cols=parseInt((a-e.watermark_x)/(e.watermark_width+e.watermark_x_space));var f,m=parseInt((a-e.watermark_x-e.watermark_width*e.watermark_cols)/e.watermark_cols);e.watermark_x_space=m?e.watermark_x_space:m,e.watermark_rows=parseInt((n-e.watermark_y)/(e.watermark_height+e.watermark_y_space));var g,y,A,b=parseInt((n-e.watermark_y-e.watermark_height*e.watermark_rows)/e.watermark_rows);e.watermark_y_space=b?e.watermark_y_space:b,s?(f=e.watermark_x+e.watermark_width*e.watermark_cols+e.watermark_x_space*(e.watermark_cols-1),g=e.watermark_y+e.watermark_height*e.watermark_rows+e.watermark_y_space*(e.watermark_rows-1)):(f=0+e.watermark_x+e.watermark_width*e.watermark_cols+e.watermark_x_space*(e.watermark_cols-1),g=0+e.watermark_y+e.watermark_height*e.watermark_rows+e.watermark_y_space*(e.watermark_rows-1));for(var v=0;v\n \n \n ${m.watermark_txt}\n \n \n ${m.watermark_txt}\n \n \n \n \n `,_=window.btoa(unescape(encodeURIComponent(v)));var w=document.createElement("div");w.style.position="absolute",w.style.left="0px",w.style.top="0px",w.style.overflow="hidden",w.style.zIndex="9999999",w.style.width=a+"px",w.style.height=n+"px",w.style.display="block",w.style["-ms-user-select"]="none",w.style.backgroundImage=`url(data:image/svg+xml;base64,${_})`,c.appendChild(w)}_removeMark(){const e=this.defaultSettings;var t=document.getElementById(e.watermark_id);if(t){var i=t.parentNode;i&&i.removeChild(t)}}_calcTextSize(){const{watermark_txt:e,watermark_font:t,watermark_fontsize:i}=this.globalSetting,s=document.createElement("span");s.innerHTML=e,s.setAttribute("style",`font-family: ${t}; font-size: ${i}px; visibility: hidden; display: inline-block`),document.querySelector("body").appendChild(s);const r={width:s.offsetWidth,height:s.offsetHeight};return s.remove(),r}}const Lv="right",Cv="left",xv="up",Dv="down",Rv="leftUp",Pv="leftDown",Iv="rightUp",Bv="rightDown",Mv="zoomExpand",Fv="zoomNarrow",Uv="apertureFar",Ov="apertureNear",Nv="focusFar",jv="focusNear",Gv="setPos",Wv="calPos",zv="delPos",$v="wiperOpen",Vv="wiperClose",Hv="cruiseStart",Jv={stop:0,fiStop:0,right:1,left:2,up:8,down:4,leftUp:10,leftDown:6,rightUp:9,rightDown:5,zoomExpand:16,zoomNarrow:32,apertureFar:72,apertureNear:68,focusFar:66,focusNear:65,setPos:129,calPos:130,delPos:131,wiperOpen:140,wiperClose:141,setCruise:132,decCruise:133,cruiseStart:136,cruiseStop:0},qv=[25,50,75,100,125,150,175,200,225,250],Kv=[1,2,3,4,5,6,7,8,9,16],Yv=[16,48,80,112,144,160,176,192,208,224];function Qv(e){const{type:t,speed:i=5,index:s=0}=e,r=function(e){return qv[(e=e||5)-1]||qv[4]}(i);let o,a,n,l;if(o=Jv[t],!o)return"";switch(t){case xv:case Dv:case Uv:case Ov:n=r;break;case Lv:case Cv:case Nv:case jv:a=r;break;case Rv:case Pv:case Iv:case Bv:a=r,n=r;break;case Mv:case Fv:l=function(e){return Yv[(e=e||5)-1]||Yv[4]}(i);break;case Wv:case zv:case Gv:n=Xv(s);break;case Vv:case $v:a=1;break;case Hv:a=Xv(s)}return function(e,t,i,s){let r=[];r[0]=165,r[1]=15,r[2]=1,r[3]=0,r[4]=0,r[5]=0,r[6]=0,e&&(r[3]=e);t&&(r[4]=t);i&&(r[5]=i);s&&(r[6]=s);return r[7]=(r[0]+r[1]+r[2]+r[3]+r[4]+r[5]+r[6])%256,function(e){let t="";for(let i=0;it)){for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i===t?s[r]=e_(e[r]):"object"==typeof e[r]?s[r]=t_(e[r],t,i+1):s[r]=e[r]);return s}}function i_(){return(new Date).toLocaleString()}class s_{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player=e,this.TAG_NAME="MemoryLogger",this.logMaxSize=(null==t?void 0:t.logMaxSize)||204800,this.logSize=0,this.logTextArray=[],this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.clear(),this.player.debugLog(this.TAG_NAME,"destroy")}clear(){this.logSize=0,this.logTextArray=[]}logCache(){let e="";try{for(var t=arguments.length,i=new Array(t),s=0;st_(e)));e="[JbPro] "+i_()+JSON.stringify(r)}catch(e){return}if(this.logSize+=e.length,this.logTextArray.push(e),this.logSize>this.logMaxSize){const e=this.logTextArray.shift();this.logSize-=e.length}}getLog(){return this.logTextArray.join("\n")}getLogBlob(){const e=this.getLog();return new Blob([e],{type:"text/plain"})}download(){const e=this.getLog();this.clear();const t=new Blob([e],{type:"text/plain"});Ka(t,"JbPro-"+i_()+".log")}}class r_ extends o{constructor(e){super(),this.player=e,this.TAG_NAME="Network",this.online=this.isOnline(),this.prevOnline=this.online,this.interval=null,this._initListener(),this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.off(),this._stopCheck(),window.removeEventListener("online",this._updateOnlineStatus),window.removeEventListener("offline",this._updateOfflineStatus),this.player.debugLog(this.TAG_NAME,"destroy")}_initListener(){window.addEventListener("online",this._updateOnlineStatus.bind(this)),window.addEventListener("offline",this._updateOfflineStatus.bind(this))}_stopCheck(){this.interval&&(clearInterval(this.interval),this.interval=null)}_startCheck(){this.interval=setInterval((()=>{this.isOnline()!==this.prevOnline&&(this.isOnline()?this._updateOnlineStatus():this._updateOfflineStatus())}),1e3)}_updateOnlineStatus(){this.prevOnline=this.online,this.online=!0,this.logStatus(),this.emit("online")}_updateOfflineStatus(){this.prevOnline=this.online,this.online=!1,this.logStatus(),this.emit("offline")}logStatus(){const e=this.prevOnline?"online":"offline",t=this.online?"online":"offline";this.player.debugLog(this.TAG_NAME,`prevOnline: ${this.prevOnline}, online: ${this.online}, status: ${e} -> ${t}`)}isOnline(){return void 0===navigator.onLine||navigator.onLine}isOffline(){return!this.isOnline()}}class o_ extends o{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this._opt={},this.TAG_NAME="JbPro",this.$container=null,Object.keys(e).forEach((t=>{if(void 0===e[t])throw new Error(`JbPro option "${t}" can not be undefined`)})),this.originalOptions=e;const t=pa();let i=Object.assign({},t,e);i.url="",i.isMulti&&(i.debugUuid=ca()),this.debug=new xr(this);let s=e.container;if("string"==typeof e.container&&(s=document.querySelector(e.container)),!s)throw this.debugError("JbPro","JbPro need container option and now container is",e.container),new Error("JbPro need container option");if(ya(i.isLive)){const e=document.createElement("video");return e.muted=!0,e.setAttribute("controlsList","nodownload"),e.disablePictureInPicture="disablePictureInPicture",e.style.position="absolute",e.style.top=0,e.style.left=0,e.style.height="100%",e.style.width="100%",s.appendChild(e),this.$videoElement=e,this.$container=s,void(this._opt=i)}if(i.decoder&&ya(-1!==i.decoder.indexOf("decoder-pro.js")||-1!==i.decoder.indexOf("decoder-pro-simd.js")))throw this.debugError("JbPro",`JbPro decoder ${i.decoder} must be decoder-pro.js or decoder-pro-simd.js`),new Error(`JbPro decoder ${i.decoder} must be decoder-pro.js or decoder-pro-simd.js`);if("CANVAS"===s.nodeName||"VIDEO"===s.nodeName)throw this.debugError("JbPro",`JbPro container type can not be ${s.nodeName} type`),new Error(`JbPro container type can not be ${s.nodeName} type`);if(i.videoBuffer>=i.heartTimeout)throw this.debugError("JbPro",`JbPro videoBuffer ${i.videoBuffer}s must be less than heartTimeout ${i.heartTimeout}s`),new Error(`JbPro videoBuffer ${i.videoBuffer}s must be less than heartTimeout ${i.heartTimeout}s`);if(this._checkHasCreated(s))throw this.debugError("JbPro","JbPro container has been created and can not be created again",s),new Error("JbPro container has been created and can not be created again",s);if(!s.classList)throw this.debugError(this.TAG_NAME,"JbPro container is invalid, must be a DOM Element",s),new Error("JbPro container is invalid, must be a DOM Element",s);if(s.classList.add("jb-pro-container"),Aa(s,te,So()),delete i.container,Bo(i.videoBuffer)&&(i.videoBuffer=1e3*Number(i.videoBuffer)),Bo(i.videoBufferDelay)&&(i.videoBufferDelay=1e3*Number(i.videoBufferDelay)),Bo(i.networkDelay)&&(i.networkDelay=1e3*Number(i.networkDelay)),Bo(i.aiFaceDetectInterval)&&(i.aiFaceDetectInterval=1e3*Number(i.aiFaceDetectInterval)),Bo(i.aiObjectDetectInterval)&&(i.aiObjectDetectInterval=1e3*Number(i.aiObjectDetectInterval)),Bo(i.timeout)&&(Po(i.loadingTimeout)&&(i.loadingTimeout=i.timeout),Po(i.heartTimeout)&&(i.heartTimeout=i.timeout)),Bo(i.autoWasm)&&(Po(i.decoderErrorAutoWasm)&&(i.decoderErrorAutoWasm=i.autoWasm),Po(i.hardDecodingNotSupportAutoWasm)&&(i.hardDecodingNotSupportAutoWasm=i.autoWasm),Po(i.mseWaitVideoCanplayAutoWasm)&&(i.mseWaitVideoCanplayAutoWasm=i.autoWasm)),Bo(i.aiFaceDetectLevel)&&Po(i.aiFaceDetectWidth)){const e=Ks[i.aiFaceDetectLevel];e&&(i.aiFaceDetectWidth=e)}if(Bo(i.aiObjectDetectLevel)&&Po(i.aiObjectDetectWidth)){const e=Ys[i.aiObjectDetectLevel];e&&(i.aiObjectDetectWidth=e)}ga(i.isCrypto)&&(i.isM7sCrypto=!0),this._opt=i,this.debugLog("JbPro","init"),i.videoBuffer>1e4&&this.debugWarn(this.TAG_NAME,`videoBuffer ${i.videoBuffer/1e3}s is too long, will black screen for ${i.videoBuffer/1e3}s , it is recommended to set it to less than 10s`),this._destroyed=!1,this._destroyLock=!1,this.$container=s,this._tempPlayBgObj={},this._tempVideoLastIframeInfo={},this._tempPlayerIsMute=!0,this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this._streamErrorReplayTimes=0,this._streamEndReplayTimes=0,this._websocket1006ErrorReplayTimes=0,this.events=new xa(this),this._opt.isUseNewFullscreenWatermark?this.watermark=new kv(this):this.watermark=new Tv(this),this.memoryLogger=new s_(this),this.network=new r_(this),this._websocket1006ErrorRetryLog=[],this._mseDecodeErrorRetryLog=[],this._wcsDecodeErrorRetryLog=[],this._isNetworkOfflinePaused=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this.widthOrHeightChangeReplayDelayTimeout=null,this.streamErrorReplayDelayTimeout=null,this.streamEndReplayDelayTimeout=null,this.playbackPauseTimeout=null,this.playbackResumeTimeout=null,this.initDecoderWorkerTimeout=null,this.$loadingBgImage=null,this.$loadingBg=null,this._initOnLock(),this._initPlayer(s,i),this._initWatermark(),this._initNetwork(),this.debugLog("JbPro",'init success and version is "8-13-2024"'),console.log('JbPro Version is "8-13-2024" '+(ya(uo)?"and is Trial Version[试用版本]":""))}destroy(){return new Promise(((e,t)=>{if(this.debugLog("JbPro","destroy()"),this._destroyLock)return t("JbPro is destroying");this._destroyLock=!0,this._destroyed=!0,this.off(),this._removeTimeout(),this._clearInitDecoderWorkerTimeout(),this._initOnLock(),this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")),this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$container&&this.$container.removeChild(this.$videoElement),this.$videoElement=null),this._removeLoadingBackgroundForIOS(),this.player?this.player.destroy().then((()=>{this.player=null,this._destroy(),this._destroyLock=!1,e()})).catch((e=>{this._destroyLock=!1,t(e)})):(this._destroy(),this._destroyLock=!1,e())}))}_removeTimeout(){this.widthOrHeightChangeReplayDelayTimeout&&(clearTimeout(this.widthOrHeightChangeReplayDelayTimeout),this.widthOrHeightChangeReplayDelayTimeout=null),this.streamErrorReplayDelayTimeout&&(clearTimeout(this.streamErrorReplayDelayTimeout),this.streamErrorReplayDelayTimeout=null),this.streamEndReplayDelayTimeout&&(clearTimeout(this.streamEndReplayDelayTimeout),this.streamEndReplayDelayTimeout=null),this.playbackPauseTimeout&&(clearTimeout(this.playbackPauseTimeout),this.playbackPauseTimeout=null),this.playbackResumeTimeout&&(clearTimeout(this.playbackResumeTimeout),this.playbackResumeTimeout=null)}_destroy(){var e,t;this.events&&(this.events.destroy(),this.events=null),this.watermark&&(this.watermark.destroy(),this.watermark=null),this.network&&(this.network.destroy(),this.network=null),this.memoryLogger&&(this.memoryLogger.destroy(),this.memoryLogger=null),this.$container&&(this.$container.classList.remove("jb-pro-container"),this.$container.classList.remove("jb-pro-fullscreen-web"),e=this.$container,t=te,e&&(e.dataset?delete e.dataset[t]:e.removeAttribute("data-"+t)),this.$container=null),this._tempPlayBgObj=null,this._tempVideoLastIframeInfo=null,this._isNetworkOfflinePaused=!1,this._playerOnLock=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this._tempPlayerIsMute=!0,this._resetReplayTimes(),this.debugLog("JbPro","destroy end"),this._opt={},this.debug=null}_resetReplayTimes(){this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this._streamErrorReplayTimes=0,this._streamEndReplayTimes=0,this._websocket1006ErrorReplayTimes=0,this._websocket1006ErrorRetryLog=[],this._mseDecodeErrorRetryLog=[],this._wcsDecodeErrorRetryLog=[]}_getOriginalOpt(){const e=pa();return Object.assign({},e,this.originalOptions)}_initPlayer(e,t){this.player=new Ev(e,t),this._bindEvents()}_resetPlayer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(((t,i)=>{try{this.debugLog(this.TAG_NAME,"_resetPlayer()",JSON.stringify(e))}catch(t){this.debugLog(this.TAG_NAME,"_resetPlayer()",e)}const s=()=>{this._opt.url="",this._opt.playOptions={},this._opt=Object.assign(this._opt,e),this._initPlayer(this.$container,this._opt)};this.player?this.player.destroy().then((()=>{this.player=null,s(),this.debugLog(this.TAG_NAME,"_resetPlayer() end"),t()})).catch((e=>{this.debugError(this.TAG_NAME,"_resetPlayer() error",e),i(e)})):(s(),this.debugLog(this.TAG_NAME,"_resetPlayer() end"),t())}))}_bindEvents(){var e=this;Object.keys(nt).forEach((t=>{this.player.on(nt[t],(function(){for(var i=arguments.length,s=new Array(i),r=0;r{this.player&&this.player.showTipsMessageByCode(e)})),this.player.once(at.beforeDestroy,(()=>{this.emit(at.close),this.destroy().then((()=>{})).catch((e=>{}))})),this.player.on(at.resize,(()=>{this.watermark&&this.watermark.resize()})),this.player.on(at.fullscreen,(()=>{this.watermark&&this.watermark.resize()})),this.player.on(at.videoInfo,(()=>{this.player&&(this.player.singleWatermark&&this.player.singleWatermark.resize(),this.player.ghostWatermark&&this.player.ghostWatermark.resize(),this.player.dynamicWatermark&&this.player.dynamicWatermark.resize())})),this.player.on(at.memoryLog,(function(){e.memoryLogger.logCache(...arguments)})),this.player.on(at.downloadMemoryLog,(()=>{this.downloadMemoryLog()}))}_initWatermark(){if(this._opt.fullscreenWatermarkConfig.text=decodeURIComponent("JessibucaPro%20%E4%BD%93%E9%AA%8C"),this._opt.fullscreenWatermarkConfig.color="white",Jo(this._opt.fullscreenWatermarkConfig)){const e=Fo(this.$container,this._opt.fullscreenWatermarkConfig);if(!e.watermark_txt)return void this.debugWarn("JbPro","fullscreenWatermarkConfig text is empty");this.watermark.load(e)}}_initNetwork(){this.network.on(at.online,(()=>{if(this.emit(at.networkState,at.online),this.isDestroyed())this.debugLog(this.TAG_NAME,"network online and JbPro is destroyed");else if(this.debugLog(this.TAG_NAME,"network online"),this._isNetworkOfflinePaused&&this._isNetworkOfflinePausedAndNextPlayConfig&&this._isNetworkOfflinePausedAndNextPlayConfig.url){const e=this._isNetworkOfflinePausedAndNextPlayConfig.url,t=this._isNetworkOfflinePausedAndNextPlayConfig.playOptions;this._streamErrorReplayTimes++;const i=this._isNetworkOfflinePausedAndNextPlayConfig.type||"unknown";this._isNetworkOfflinePaused=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this.debugLog(this.TAG_NAME,`${i} and network online and _streamErrorReplayTimes is ${this._streamErrorReplayTimes} and reset player and play`),this.play(e,t).then((()=>{this.debugLog(this.TAG_NAME,`${i} and network online and play success`)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.fetchError,{},e),this.debugError(this.TAG_NAME,`${i} and network online and play error`,e.toString(),e)}))}})),this.network.on(at.offline,(()=>{this.emit(at.networkState,at.offline),this.debugLog(this.TAG_NAME,"network offline")}))}_checkHasCreated(e){if(!e)return!1;return!!ba(e,te)}_initOnLock(){this.webglAlignmentErrorOnLock=!1,this.webglContextLostErrorOnLock=!1,this.mediaSourceH265NotSupportOnLock=!1,this.mediaSourceFullOnLock=!1,this.mediaSourceAppendBufferErrorOnLock=!1,this.mseSourceBufferErrorOnLock=!1,this.mediaSourceBufferedIsZeroErrorOnLock=!1,this.mseAddSourceBufferErrorOnLock=!1,this.mediaSourceDecoderConfigurationErrorOnLock=!1,this.mediaSourceTsIsMaxDiffOnLock=!1,this.mseWidthOrHeightChangeOnLock=!1,this.mediaSourceAudioG711NotSupportOnLock=!1,this.mediaSourceAudioInitTimeoutOnLock=!1,this.mediaSourceAudioNoDataTimeoutOnLock=!1,this.mseWorkerAddSourceBufferErrorOnLock=!1,this.mediaSourceUseCanvasRenderPlayFailedOnLock=!1,this.webcodecsH265NotSupportOnLock=!1,this.webcodecsUnsupportedConfigurationErrorOnLock=!1,this.webcodecsDecodeConfigureErrorOnLock=!1,this.webcodecsDecodeErrorOnLock=!1,this.wcsWidthOrHeightChangeOnLock=!1,this.webcodecsAudioNoDataTimeoutOnLock=!1,this.webcodecsAudioInitTimeoutOnLock=!1,this.simdDecodeErrorOnLock=!1,this.wasmWidthOrHeightChangeOnLock=!1,this.wasmUseVideoRenderErrorOnLock=!1,this.videoElementPlayingFailedOnLock=!1,this.simdH264DecodeVideoWidthIsTooLargeOnLock=!1,this.networkDelayTimeoutOnLock=!1,this.flvDemuxBufferSizeTooLargeOnLock=!1,this.fetchErrorOnLock=!1,this.streamEndOnLock=!1,this.websocketErrorOnLock=!1,this.webrtcErrorOnLock=!1,this.hlsErrorOnLock=!1,this.aliyunRtcErrorOnLock=!1,this.decoderWorkerInitErrorOnLock=!1,this.decoderWorkerWasmErrorOnLock=!1,this.videoElementPlayingFailedForWebrtcOnLock=!1,this.videoInfoErrorOnLock=!1,this.webrtcStreamH265OnLock=!1,this.mseWaitVideoCanplayTimeoutOnLock=!1}isDestroyed(){return this._destroyed}getOption(){return this.player?this.player.getOption():{}}setDebug(e){this.debugLog("JbPro",`setDebug() ${e}`),this._opt.debug=!!e,this.player?this.player.updateOption({debug:!!e},!0):this.debugWarn("JbPro","player is not init")}getIsDebug(){let e=!1;return this.player&&(e=this.player._opt.debug),e}mute(){this.debugLog("JbPro","mute()"),this.player&&this.player.mute(!0)}cancelMute(){this.debugLog("JbPro","cancelMute() and is mute is ",this.isMute()),this.player&&this.player.isAudioMute()&&this.player.mute(!1)}setVolume(e){this.debugLog("JbPro",`setVolume() ${e}`),this.player&&(this.player.volume=e)}getVolume(){let e=null;return this.player&&(e=this.player.volume,e=parseFloat(e).toFixed(2)),e}audioResume(){this.debugLog("JbPro","audioResume() and call cancelMute()"),this.cancelMute()}setTimeout(e){this.debugLog("JbPro",`setTimeout() ${e}`),e=Number(e),isNaN(e)?this.debugWarn("JbPro",`setTimeout error: ${e} is not a number`):(this._opt.timeout=e,this._opt.loadingTimeout=e,this._opt.heartTimeout=e,this.player&&this.player.updateOption({timeout:e,loadingTimeout:e,heartTimeout:e}))}setScaleMode(e){this.debugLog("JbPro",`setScaleMode() ${e}`),this.player?this.player.setScaleMode(e):this.debugWarn("JbPro","setScaleMode() player is null")}pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(((t,i)=>{this.debugLog("JbPro",`pause() ${e}`),this.isDestroyed()&&i("JbPro is destroyed"),(this._opt.pauseAndNextPlayUseLastFrameShow||this._opt.replayUseLastFrameShow)&&(this._tempPlayBgObj=this._getVideoLastIframeInfo()),this._tempPlayerIsMute=this.isMute(),this._pause(e).then((e=>{t(e)})).catch((e=>{i(e)}))}))}_pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(((t,i)=>{if(this.debugLog("JbPro",`_pause() ${e}`),this.isDestroyed())return i("JbPro is destroyed");this._resetReplayTimes(),this.player?this.player.pause(e).then((e=>{t(e)})).catch((e=>{i(e)})):i("player is null")}))}close(){return new Promise(((e,t)=>{if(this.isDestroyed())return t("JbPro is destroyed");this.debugLog("JbPro","close() and inner destroy()"),this.destroy().then((()=>{e()})).catch((e=>{t(e)}))}))}clearView(){this.debugLog("JbPro","clearView()"),this.player&&this.player.video?this.getRenderType()===H?this.player.video.clearView():this.debugWarn("JbPro","clearView","render type is video, not support clearView, please use canvas render type"):this.debugWarn("JbPro","clearView","player is null")}play(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(this.isDestroyed())return s("JbPro is destroyed");try{this.debugLog("JbPro",`play() ${e}`,JSON.stringify(t))}catch(i){this.debugLog("JbPro",`play() ${e}`,t)}if(!e&&!this._opt.url)return this.emit(at.error,dt.playError),void s("url is null and this._opt.url is null");if(e&&(e=(""+e).trim(),-1===e.indexOf("http:")&&-1===e.indexOf("https:")&&-1===e.indexOf("webrtc:")&&-1===e.indexOf("ws:")&&-1===e.indexOf("wss:")&&-1===e.indexOf("wt:")&&-1===e.indexOf("artc:")))return s(`url ${e} must be "http:" or "https:" or "webrtc:" or "ws:" or "wss:" or "wt:" or "artc:" protocol`);if(ya(this._opt.isLive))return this.$videoElement.controls="controls",this.$videoElement.muted=!1,this.$videoElement.src=e,this.$videoElement.play(),void i(this.$videoElement);if(this._opt.isM7sCrypto){let r=t.cryptoKey||this._opt.playOptions.cryptoKey,o=t.cryptoIV||this._opt.playOptions.cryptoIV;if(this._opt.m7sCryptoKey&&(!r||!o)){const e=this._opt.m7sCryptoKey.split(".");r=da(e[0]),o=da(e[1])}if(!r||!o){const r=e||this._opt.url;return void this._cryptoPlay(r).then((r=>{let{cryptoIV:o,cryptoKey:a}=r;this._opt.playOptions.cryptoKey=a,this._opt.playOptions.cryptoIV=o,t.cryptoIV=o,t.cryptoKey=a,this._playBefore(e,t).then((()=>{i()})).catch((e=>{s(e)}))})).catch((e=>{s(e)}))}this._opt.playOptions.cryptoKey=r,this._opt.playOptions.cryptoIV=o,t.cryptoIV=o,t.cryptoKey=r}else if(this._opt.isXorCrypto){let e=t.cryptoKey||this._opt.playOptions.cryptoKey,i=t.cryptoIV||this._opt.playOptions.cryptoIV;if(this._opt.xorCryptoKey&&(!e||!i)){const t=this._opt.xorCryptoKey.split(".");e=da(t[0]),i=da(t[1])}e&&i&&(this._opt.playOptions.cryptoKey=e,this._opt.playOptions.cryptoIV=i,t.cryptoIV=i,t.cryptoKey=e)}else if(this._opt.isSm4Crypto){let e=t.cryptoKey||this._opt.playOptions.cryptoKey,i=t.cryptoIV||this._opt.playOptions.cryptoIV;if(this._opt.sm4CryptoKey&&(!e||!i)){const t=this._opt.sm4CryptoKey.split(".");2===t.length&&(e=ll(t[0]),i=ll(t[1]))}e&&i&&(this._opt.playOptions.cryptoKey=e,this._opt.playOptions.cryptoIV=i,t.cryptoIV=i,t.cryptoKey=e)}this._playBefore(e,t).then((()=>{i()})).catch((e=>{s(e)}))}))}_playBefore(e,t){return new Promise(((i,s)=>{if(this.player)if(e)if(this._opt.url)if(e===this._opt.url)if(this.player.playing)this.debugLog("JbPro","_playBefore","playing and resolve()"),i();else{this.debugLog("JbPro","_playBefore","this._opt.url === url and pause -> play and destroy play");let e=this._getOriginalOpt();(this._opt.pauseAndNextPlayUseLastFrameShow||this._opt.replayUseLastFrameShow)&&this._tempPlayBgObj&&this._tempPlayBgObj.loadingBackground&&(e=Object.assign(e,this._tempPlayBgObj)),ya(this._tempPlayerIsMute)&&(e.isNotMute=!0,this._tempPlayerIsMute=!0);const t=this._opt.url,r=this._opt.playOptions;this._resetPlayer(e).then((()=>{this._play(t,r).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore this.player.play error",e),this.emit(at.crashLog,this.getCrashLog("this.player.play 1",e)),s(e)}))})).catch((e=>{this.debugError("JbPro","_resetPlayer error",e),s(e)}))}else{this.debugLog("JbPro","_playBefore",`\n this._url.url is ${this._opt.url}\n and new url is ${e}\n and destroy and play new url`);const r=this._getOriginalOpt();this._resetPlayer(r).then((()=>{this._play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(at.crashLog,this.getCrashLog("this.player.play 2",e)),s(e)}))})).catch((e=>{this.debugError("JbPro","_resetPlayer error",e)}))}else this._play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(at.crashLog,this.getCrashLog("this.player.play 3",e)),s(e)}));else{let e=this._getOriginalOpt();(this._opt.pauseAndNextPlayUseLastFrameShow||this._opt.replayUseLastFrameShow)&&this._tempPlayBgObj&&this._tempPlayBgObj.loadingBackground&&(e=Object.assign(e,this._tempPlayBgObj)),ya(this._tempPlayerIsMute)&&(e.isNotMute=!0,this._tempPlayerIsMute=!0);const t=this._opt.url,r=this._opt.playOptions;this._resetPlayer(e).then((()=>{this._play(t,r).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(at.crashLog,this.getCrashLog("this.player.play 4",e)),s(e)}))})).catch((e=>{this.debugError("JbPro","_resetPlayer error",e)}))}else e?this._play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(at.crashLog,this.getCrashLog("this.player.play 5",e)),s(e)})):this._play(this._opt.url,this._opt.playOptions).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(at.crashLog,this.getCrashLog("this.player.play 6",e)),s(e)}))}))}_cryptoPlay(e){return new Promise(((t,i)=>{const s=function(e){const t=(e||document.location.toString()).split("//"),i=t[1].indexOf("/");let s=t[1].substring(i);return-1!=s.indexOf("?")&&(s=s.split("?")[0]),s}(e);let r=this._opt.cryptoKeyUrl,o="";const a=ha(e);if(r){if(o=r,this._opt.isM7sCrypto&&-1===o.indexOf("/crypto/?stream=")){const e=ha(r);o=e.origin+ee+`?stream=${s}`}}else r=a.origin+ee,o=r+`?stream=${s}`;var n;this.player.debugLog("JbPro",`_cryptoPlay() cryptoKeyUrl: ${o} and opt.cryptoKeyUrl: ${this._opt.cryptoKeyUrl}`),(n=o,new Promise(((e,t)=>{Pl.get(n).then((t=>{e(t)})).catch((e=>{t(e)}))}))).then((e=>{if(e){const s=e.split("."),r=da(s[0]),o=da(s[1]);o&&r?t({cryptoIV:o,cryptoKey:r}):i("get cryptoIV or cryptoKey error")}else i(`cryptoKeyUrl: getM7SCryptoStreamKey ${o} res is null`)})).catch((e=>{i(e)}))}))}playback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(this.isDestroyed())return s("JbPro is destroyed");try{this.debugLog("JbPro",`playback() ${e}, options: `,JSON.stringify(t))}catch(i){this.debugLog("JbPro",`playback() ${e}, options: `,t)}if(ya(this._opt.isLive))return s("this._opt.isLive is false, can not playback");const r=fa(),o=Object.assign({},r.playbackConfig,this._opt.playbackConfig,t);ya(o.isUseFpsRender)&&o.isCacheBeforeDecodeForFpsRender&&(o.isCacheBeforeDecodeForFpsRender=!1,this.debugWarn("JbPro","playbackConfig.isUseFpsRender is false, isCacheBeforeDecodeForFpsRender can not be ture, isCacheBeforeDecodeForFpsRender is set to false")),0===o.rateConfig.length&&o.showRateBtn&&(o.showRateBtn=!1,this.debugWarn("JbPro","playbackConfig.rateConfig.length is 0, showRateBtn can not be ture, showRateBtn is set to false")),o.controlType,X.simple,this._resetPlayer({videoBuffer:0,playbackConfig:o,playType:w,openWebglAlignment:!0,useMSE:o.useMSE,useWCS:o.useWCS,useSIMD:!0}).then((()=>{this.play(e,t).then((()=>{i()})).catch((e=>{s(e)}))})).catch((e=>{s(e)}))}))}playbackPause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.isDestroyed()?Promise.reject("JbPro is destroyed"):(this.debugLog("JbPro",`playbackPause() ${e}`),this._opt.playType===v?Promise.reject("playType is player, can not call playbackPause method"):new Promise(((t,i)=>{if(!this.player)return i("player is null");ga(e)?this._pause().then((()=>{t()})).catch((e=>{i(e)})):(this.player.playbackPause=!0,this.player.recording=!1,this.player.zooming=!1,this.playbackPauseTimeout=setTimeout((()=>{this.playbackPauseTimeout=null,t()}),100))})))}playbackResume(){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):(this.debugLog("JbPro","playbackResume()"),this._opt.playType===v?Promise.reject("playType is player, can not call playbackResume method"):new Promise(((e,t)=>{if(!this.player)return t("player is null");this.player.playbackPause=!1,this.playbackResumeTimeout=setTimeout((()=>{this.playbackResumeTimeout=null,e()}),100)})))}forward(e){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):(this.debugLog("JbPro",`forward() ${e}`),ya(this._opt.isLive)||this._opt.playType===v?Promise.reject("forward() method only just for playback type"):ko(Number(e))?new Promise(((t,i)=>{this.player?(e=oo(Number(e),.1,32),this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"playbackRate",value:e}),this.player.playback.setRate(e),this.player.video&&this.player.video.setRate(e),this.player.audio&&this.player.audio.setRate(e),(this.player.isPlaybackUseWCS()||this.player.isPlaybackUseMSE())&&(this.player.demux&&ya(this.player.isPlaybackPauseNotClearCacheAndCacheBeforeDecodeAndUseFpsRender())&&this.player.demux.dropBuffer$2(),this.player.isPlaybackCacheBeforeDecodeForFpsRender()&&this.player.demux.initPlaybackCacheLoop()),t()):i("player is not playing")})):Promise.reject(`forward() params "rate": ${e} must be number type`))}playbackForward(e){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):new Promise(((t,i)=>{this.forward(e).then((()=>{t()})).catch((e=>{i(e)}))}))}normal(){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):new Promise(((e,t)=>{this.forward(1).then((()=>{e()})).catch((e=>{t(e)}))}))}playbackNormal(){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):new Promise(((e,t)=>{this.normal().then((()=>{e()})).catch((e=>{t(e)}))}))}updatePlaybackForwardMaxRateDecodeIFrame(e){this.isDestroyed()||(this.debugLog("JbPro",`updatePlaybackForwardMaxRateDecodeIFrame() ${e}`),e=Number(e),e=oo(e=parseInt(e,10),1,8),this._opt.playbackForwardMaxRateDecodeIFrame=e,this.player?this.player.updateOption({playbackForwardMaxRateDecodeIFrame:e},!0):this.debugWarn("JbPro","updatePlaybackForwardMaxRateDecodeIFrame() player is null"))}setPlaybackStartTime(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setPlaybackStartTime() ${e}`);const t=Vo(e);this.player?this.player.isPlayback()?t<10&&0!==e&&this.player.playback.isControlTypeNormal()?this.debugWarn("JbPro",`setPlaybackStartTime() control type is normal and timestamp: ${e} is not valid`):this.player.playback.isControlTypeSimple()&&e>this.player.playback.totalDuration?this.debugWarn("JbPro",`setPlaybackStartTime() control type is simple and timestamp: ${e} is more than ${this.player.playback.totalDuration}`):this.player.playing&&(this.player.playback.isControlTypeNormal()&&10===t&&(e*=1e3),this.player.playback.setStartTime(e),this.playbackClearCacheBuffer()):this.debugWarn("JbPro","setPlaybackStartTime() playType is not playback"):this.debugWarn("JbPro","setPlaybackStartTime() player is null")}setPlaybackShowPrecision(e){this.isDestroyed()||(this.debugLog("JbPro",`setPlaybackShowPrecision() ${e}`),this.player?this.player.isPlayback()?this.player.playback.isControlTypeNormal()?this.player.playback.setShowPrecision(e):this.debugWarn("JbPro","control type is not normal , not support!"):this.debugWarn("JbPro","playType is not playback"):this.debugWarn("JbPro","player is null"))}playbackCurrentTimeScroll(){this.isDestroyed()||(this.debugLog("JbPro","playbackCurrentTimeScroll()"),this.player?this.player.isPlayback()?this.player.playback.isControlTypeNormal()?this.player.playback.currentTimeScroll():this.debugWarn("JbPro","control type is not normal , not support!"):this.debugWarn("JbPro","playType is not playback"):this.debugWarn("JbPro","player is null"))}playbackClearCacheBuffer(){this.isDestroyed()||(this.debugLog("JbPro","playbackClearCacheBuffer()"),this.player?this.player.isPlayback()?(this.player.video&&this.player.video.clear(),this.player.audio&&this.player.audio.clear(),this.clearBufferDelay()):this.debugWarn("JbPro","playType is not playback"):this.debugWarn("JbPro","player is null"))}getPlaybackCurrentRate(){return this.player?this.player.isPlayback()?this.player.getPlaybackRate():(this.debugWarn("JbPro","playType is not playback"),1):(this.debugWarn("JbPro","player is null"),1)}updatePlaybackLocalOneFrameTimestamp(e){this.isDestroyed()||(this.debugLog("JbPro",`updatePlaybackLocalOneFrameTimestamp() ${e}`),this.player?this.player.isPlayback()?this.player.playback.updateLocalOneFrameTimestamp(e):this.debugWarn("JbPro","playType is not playback"):this.debugWarn("JbPro","player is null"))}setStreamQuality(e){if(this.isDestroyed())return;if(this.debugLog("JbPro",`setStreamQuality() ${e}`),!this.player)return void this.debugWarn("JbPro","player is null");if(!this.player._opt.operateBtns.quality)return void this.debugWarn("JbPro","player._opt.operateBtns.quality is false");(this.player._opt.qualityConfig||[]).includes(e)?this.player.streamQuality=e:this.debugWarn("JbPro",`quality: ${e} is not in qualityList`)}_play(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(!this.player)return s("player is null");let r=!1;this._opt.url&&this._opt.url!==e&&(r=!0),this._opt.url=e,this._opt.playOptions=t;const o=e.split("?")[0],p=o.startsWith("http://")||o.startsWith("https://"),f=o.startsWith("webrtc://"),m=o.startsWith("artc://"),g=o.startsWith("wt://"),y=o.startsWith("ws://")||o.startsWith("wss://"),A=p||y,b=p&&o.endsWith(".m3u8"),v=A&&o.endsWith(".flv"),_=A&&(o.endsWith(".fmp4")||o.endsWith(".mp4")),w=A&&o.endsWith(".mpeg4"),S=A&&(o.endsWith(".h264")||o.endsWith(".h265")),E=A&&o.endsWith(".ts");let T=this._opt.isWebrtcForZLM||!1,F=this._opt.isWebrtcForSRS||!1,U=this._opt.isWebrtcForOthers||!1;f&&(-1!==e.indexOf("/index/api/webrtc")?(T=!0,F=!1,U=!1):-1!==e.indexOf("/rtc/v1/play/")&&(F=!0,T=!1,U=!1));let O=null,N=null;if(v&&ya(this._opt.isFlv)&&this._resetDemuxType("isFlv"),_&&ya(this._opt.isFmp4)&&this._resetDemuxType("isFmp4"),w&&ya(this._opt.isMpeg4)&&this._resetDemuxType("isMpeg4"),S&&ya(this._opt.isNakedFlow)&&this._resetDemuxType("isNakedFlow"),E&&ya(this._opt.isTs)&&this._resetDemuxType("isTs"),p?O=b?l:n:g?O=h:f?O=d:m?O=c:y&&(O=a),this._opt.isNakedFlow?N=R:this._opt.isFmp4?N=P:this._opt.isMpeg4?N=I:this._opt.isFlv?N=k:this._opt.isTs?N=M:b?N=C:f?N=x:m?N=B:g?N=D:y&&(N=L),!O||!N)return this._opt.playFailedAndPausedShowMessage&&this.showErrorMessageTips("url is not support"),s(`play url ${e} is invalid, protocol is ${u[O]}, demuxType is ${N}`);this.debugLog("JbPro",`play url ${e} protocol is ${u[O]}, demuxType is ${N}`);const j=()=>{this.player.on(dt.webglAlignmentError,this._handleWebglAlignmentError.bind(this)),this.player.on(dt.webglContextLostError,this._handleWebglContextLostError.bind(this)),this.player.on(dt.mediaSourceH265NotSupport,this._handleMediaSourceH265NotSupport.bind(this)),this.player.on(dt.mseWaitVideoCanplayTimeout,this._handleMseWaitVideoCanplayTimeout.bind(this)),this.player.on(dt.mediaSourceFull,this._handleMediaSourceFull.bind(this)),this.player.on(dt.mediaSourceAppendBufferError,this._handleMediaSourceAppendBufferError.bind(this)),this.player.on(dt.mseSourceBufferError,this._handleMseSourceBufferError.bind(this)),this.player.on(dt.mediaSourceBufferedIsZeroError,this._handleMediaSourceBufferedIsZeroError.bind(this)),this.player.on(dt.mseAddSourceBufferError,this._handleMseAddSourceBufferError.bind(this)),this.player.on(dt.mediaSourceDecoderConfigurationError,this._handleMediaSourceDecoderConfigurationError.bind(this)),this.player.on(dt.mediaSourceTsIsMaxDiff,this._handleMediaSourceTsIsMaxDiff.bind(this)),this.player.on(dt.mseWidthOrHeightChange,this._handleMseWidthOrHeightChange.bind(this)),this.player.on(dt.mediaSourceAudioG711NotSupport,this._handleMediaSourceAudioG711NotSupport.bind(this)),this.player.on(dt.mediaSourceAudioInitTimeout,this._handleMediaSourceAudioInitTimeout.bind(this)),this.player.once(dt.mediaSourceAudioNoDataTimeout,this._handleMediaSourceAudioNoDataTimeout.bind(this)),this.player.on(dt.mseWorkerAddSourceBufferError,this._handleMseWorkerAddSourceBufferError.bind(this)),this.player.on(dt.mediaSourceUseCanvasRenderPlayFailed,this._handleMediaSourceUseCanvasRenderPlayFailed.bind(this)),this.player.on(dt.webcodecsH265NotSupport,this._handleWebcodecsH265NotSupport.bind(this)),this.player.on(dt.webcodecsUnsupportedConfigurationError,this._handleWebcodecsUnsupportedConfigurationError.bind(this)),this.player.on(dt.webcodecsDecodeConfigureError,this._handleWebcodecsDecodeConfigureError.bind(this)),this.player.on(dt.webcodecsDecodeError,this._handleWebcodecsDecodeError.bind(this)),this.player.on(dt.wcsWidthOrHeightChange,this._handleWcsWidthOrHeightChange.bind(this)),this.player.on(dt.webcodecsAudioNoDataTimeout,this._handleWebcodecsAudioNoDataTimeout.bind(this)),this.player.on(dt.webcodecsAudioInitTimeout,this._handleWebcodecsAudioInitTimeout.bind(this)),this.player.on(dt.simdDecodeError,this._handleSimdDecodeError.bind(this)),this.player.on(dt.wasmWidthOrHeightChange,this._handleWasmWidthOrHeightChange.bind(this)),this.player.on(dt.wasmUseVideoRenderError,this._handleWasmUseVideoRenderError.bind(this)),this.player.on(dt.videoElementPlayingFailed,this._handleVideoElementPlayingFailed.bind(this)),this.player.on(dt.simdH264DecodeVideoWidthIsTooLarge,this._handleSimdH264DecodeVideoWidthIsTooLarge.bind(this)),this.player.on(at.networkDelayTimeout,this._handleNetworkDelayTimeout.bind(this)),this.player.on(at.flvDemuxBufferSizeTooLarge,this._handleFlvDemuxBufferSizeTooLarge.bind(this)),this.player.on(dt.fetchError,this._handleFetchError.bind(this)),this.player.on(at.streamEnd,this._handleStreamEnd.bind(this)),this.player.on(dt.websocketError,this._handleWebsocketError.bind(this)),this.player.on(dt.webrtcError,this._handleWebrtcError.bind(this)),this.player.on(dt.hlsError,this._handleHlsError.bind(this)),this.player.on(dt.aliyunRtcError,this._handleAliyunRtcError.bind(this)),this.player.on(dt.decoderWorkerInitError,this._handleDecoderWorkerInitError.bind(this)),this.player.on(dt.decoderWorkerWasmError,this._handleDecoderWorkerWasmError.bind(this)),this.player.on(dt.videoElementPlayingFailedForWebrtc,this._handleVideoElementPlayingFailedForWebrtc.bind(this)),this.player.on(dt.videoInfoError,this._handleVideoInfoError.bind(this)),this.player.on(at.webrtcStreamH265,this._handleWebrtcStreamH265.bind(this)),this.player.on(at.delayTimeout,this._handleDelayTimeout.bind(this)),this.player.on(at.loadingTimeout,this._handleLoadingTimeout.bind(this)),this._hasLoaded()?(this.debugLog(this.TAG_NAME,"_playNext and _hasLoaded() is true"),this.player.play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_hasLoaded() and play error",e),this.emit(at.crashLog,this.getCrashLog("_hasLoaded() and play error",e)),this.player&&this.player.pause().then((()=>{s(e)})).catch((e=>{s(e),this.debugError("JbPro","_hasLoaded() and play error and next pause error",e)}))}))):(this.debugLog(this.TAG_NAME,"_playNext and waiting decoderWorkerInit callback"),this._checkInitDecoderWorkerTimeout(),this.player.once(at.decoderWorkerInit,(()=>{this._clearInitDecoderWorkerTimeout(),this.isDestroyed()?this.debugLog("JbPro","decoderWorkerInit but player is destroyed"):(this.debugLog(this.TAG_NAME,"_playNext and decoderWorkerInit callback and next play"),this.player.play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","decoderWorkerInit and play error",e),this.emit(at.crashLog,this.getCrashLog("decoderWorkerInit and play error",e)),this.player&&this.player.pause().then((()=>{s(e)})).catch((e=>{s(e),this.debugError("JbPro","decoderWorkerInit and play error and next pause error",e)}))})))})))},G=this.player.getOption(),W=b&&ya(this._opt.supportHls265),z=f&&ya(this._opt.isWebrtcH265),$=b&&!!ta(),V=b&&G.demuxUseWorker;if(W||z||m||r||w||$||V)this.debugLog("JbPro",`need reset player and\n isOldHls is ${W} and isOldWebrtc is ${z} and\n isAliyunRtc is ${m} and\n needResetPlayer(url change) is ${r} and\n isMpeg4 is ${w} and\n isHlsCanVideoPlay is ${$} and\n isHlsButDemuxUseWorker is ${V}`),this._resetPlayer({protocol:O,demuxType:N,isHls:b,isWebrtc:f,isWebrtcForZLM:T,isWebrtcForSRS:F,isWebrtcForOthers:U,isAliyunRtc:m,cryptoKey:t.cryptoKey||"",cryptoIV:t.cryptoIV||"",url:e,playOptions:t}).then((()=>{j()})).catch((e=>{s("reset player error")}));else{const e={protocol:O,demuxType:N,isHls:b,isWebrtc:f,isAliyunRtc:m,isFlv:this._opt.isFlv,isFmp4:this._opt.isFmp4,isMpeg4:this._opt.isMpeg4,isNakedFlow:this._opt.isNakedFlow,isTs:this._opt.isTs,cryptoKey:t.cryptoKey||"",cryptoIV:t.cryptoIV||""};this._opt.isNakedFlow&&(e.mseDecodeAudio=!1,e.wcsDecodeAudio=!1),this.player.updateOption(e),j()}}))}_resetDemuxType(e){this._opt.isFlv=!1,this._opt.isFmp4=!1,this._opt.isMpeg4=!1,this._opt.isNakedFlow=!1,this._opt.isHls=!1,this._opt.isWebrtc=!1,this._opt.isWebrtcForZLM=!1,this._opt.isWebrtcForSRS=!1,this._opt.isWebrtcForOthers=!1,this._opt.isAliyunRtc=!1,this._opt.isTs=!1,e&&(this._opt[e]=!0),"isFmp4"!==e&&(this._opt.isFmp4Private=!1)}resize(){this.isDestroyed()||(this.debugLog("JbPro","resize()"),this.player&&this.player.resize())}setBufferTime(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setBufferTime() ${e}`),(e=Number(e))>10&&this.debugWarn("JbPro",`setBufferTime() buffer time is ${e} second, is too large, video will show blank screen until cache ${e} second buffer data`);const t=1e3*e;this._opt.videoBuffer=t,this.player?this.player.updateOption({videoBuffer:t},!0):this.debugWarn("JbPro","setBufferTime() player is null")}setBufferDelayTime(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setBufferDelayTime() ${e}`),(e=Number(e))<.2&&this.debugWarn("JbPro",`setBufferDelayTime() buffer time delay is ${e} second, is too small`);const t=1e3*(e=oo(e,.2,100));this._opt.videoBufferDelay=t,this.player?this.player.updateOption({videoBufferDelay:t},!0):this.debugWarn("JbPro","setBufferDelayTime() player is null")}setRotate(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setRotate() ${e}`),e=parseInt(e,10);this._opt.rotate!==e&&-1!==[0,90,180,270].indexOf(e)?(this._opt.rotate=e,this.player?this.player.setRotate(e):this.debugWarn("JbPro","setRotate() player is null")):this.debugWarn("JbPro",`setRotate() rotate is ${e} and this._opt.rotate is ${this._opt.rotate}`)}setMirrorRotate(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setMirrorRotate() ${e}`);e||(e="none"),this._opt.mirrorRotate!==e&&-1!==["none","level","vertical"].indexOf(e)?(this._opt.mirrorRotate=e,this.player?(this.player.updateOption({mirrorRotate:e}),this.resize()):this.debugWarn("JbPro","setMirrorRotate() player is null")):this.debugWarn("JbPro",`setMirrorRotate() mirrorRotate is ${e} and this._opt.mirrorRotate is ${this._opt.mirrorRotate}`)}setAspectRatio(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setAspectRatio() ${e}`);e||(e="default"),this._opt.aspectRatio!==e&&-1!==["default","4:3","16:9"].indexOf(e)?(this._opt.aspectRatio=e,this.player?(this.player.updateOption({aspectRatio:e}),this.resize()):this.debugWarn("JbPro","setAspectRatio() player is null")):this.debugWarn("JbPro",`setAspectRatio() aspectRatio is ${e} and this._opt.aspectRatio is ${this._opt.mirrorRotate}`)}hasLoaded(){return!0}_hasLoaded(){return this.player&&this.player.loaded||!1}setKeepScreenOn(){this.isDestroyed()||(this.debugLog("JbPro","setKeepScreenOn()"),this._opt.keepScreenOn=!0,this.player?this.player.updateOption({keepScreenOn:!0}):this.debugWarn("JbPro","setKeepScreenOn() player is not ready"))}setFullscreen(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setFullscreen() ${e}`);const t=!!e;this.player?this.player.fullscreen!==t?this.player.fullscreen=t:this.debugWarn("JbPro",`setFullscreen() fullscreen is ${t} and this.player.fullscreen is ${this.player.fullscreen}`):this.debugWarn("JbPro","setFullscreen() player is not ready")}setWebFullscreen(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setWebFullscreen() ${e}`);const t=!!e;this.player?this.player.webFullscreen=t:this.debugWarn("JbPro","setWebFullscreen() player is not ready")}screenshot(e,t,i,s){if(!this.isDestroyed())return this.debugLog("JbPro",`screenshot() ${e} ${t} ${i} ${s}`),this.player&&this.player.video?this.player.video.screenshot(e,t,i,s):(this.debugWarn("JbPro","screenshot() player is not ready"),null)}screenshotWatermark(e){return new Promise(((t,i)=>{if(this.isDestroyed())return i("player is destroyed");this.debugLog("JbPro","screenshotWatermark()",e),this.player&&this.player.video?this.player.video.screenshotWatermark(e).then((e=>{t(e)})).catch((e=>{i(e)})):(this.debugWarn("JbPro","screenshotWatermark() player is not ready"),i("player is not ready"))}))}screenshotCopyrightWatermark(e){return new Promise(((t,i)=>{if(this.isDestroyed())return i("player is destroyed");this.debugLog("JbPro","screenshotCopyrightWatermark()",e),this.player&&this.player.video?this.player.video.screenshotCopyrightWatermark(e).then((e=>{t(e)})).catch((e=>{i(e)})):(this.debugWarn("JbPro","screenshotCopyrightWatermark() player is not ready"),i("player is not ready"))}))}startRecord(e,t){return new Promise(((i,s)=>this.isDestroyed()?s("player is destroyed"):(this.debugLog("JbPro",`startRecord() ${e} ${t}`),this.player?void(this.player.playing?(this.player.startRecord(e,t),i()):(this.debugWarn("JbPro","startRecord() player is not playing"),s("not playing"))):(this.debugWarn("JbPro","startRecord() player is not ready"),s("player is not ready")))))}stopRecordAndSave(e,t){return new Promise(((i,s)=>{if(this.isDestroyed())return s("player is destroyed");this.debugLog("JbPro",`stopRecordAndSave() ${e} ${t}`),this.player&&this.player.recording?this.player.stopRecordAndSave(e,t).then((e=>{i(e)})).catch((e=>{s(e)})):s("not recording")}))}cancelRecord(){return new Promise(((e,t)=>this.isDestroyed()?t("player is destroyed"):(this.debugLog("JbPro","cancelRecord()"),this.player?void this.player.cancelRecord().then((()=>{e()})).catch((e=>{t(e)})):(this.debugWarn("JbPro","cancelRecord() player is not ready"),t("player is not ready")))))}isPlaying(){let e=!1;return this.player&&(e=this.player.isPlaying()),e}isLoading(){return!!this.player&&this.player.loading}isPause(){let e=!1;return this._opt.playType===v?e=!this.isPlaying()&&!this.isLoading():this._opt.playType===w&&this.player&&(e=this.player.playbackPause),e}isPaused(){return this.isPause()}isPlaybackPause(){let e=!1;return this._opt.playType===w&&this.player&&(e=this.player.playbackPause),e}isMute(){let e=!0;return this.player&&(e=this.player.isAudioMute()),e}isRecording(){return this.player&&this.player.recorder&&this.player.recorder.recording||!1}isFullscreen(){let e=!1;return this.player&&(e=this.player.fullscreen),e}isWebFullscreen(){let e=!1;return this.player&&(e=this.player.webFullscreen),e}clearBufferDelay(){this.isDestroyed()||(this.debugLog("JbPro","clearBufferDelay()"),this.player?this.player.clearBufferDelay():this.debugWarn("JbPro","clearBufferDelay() player is not init"))}setNetworkDelayTime(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setNetworkDelayTime() ${e}`),(e=Number(e))<1&&this.debugWarn("JbPro",`setNetworkDelayTime() network delay is ${e} second, is too small`);const t=1e3*(e=oo(e,1,100));this._opt.networkDelay=t,this.player?this.player.updateOption({networkDelay:t},!0):this.debugWarn("JbPro","setNetworkDelayTime() player is null")}getDecodeType(){let e="";return this.player&&(e=this.player.getDecodeType()),e}getRenderType(){let e="";return this.player&&(e=this.player.getRenderType()),e}getAudioEngineType(){let e="";return this.player&&(e=this.player.getAudioEngineType()),e}getPlayingTimestamp(){let e=0;return this.player&&(e=this.player.getPlayingTimestamp()),e}getStatus(){let e=ys;return this.player&&(e=this.player.loading?fs:this.player.playing?ms:gs),e}getPlayType(){return this.player?this.player._opt.playType:v}togglePerformancePanel(e){if(this.isDestroyed())return;this.debugLog("JbPro",`togglePerformancePanel() ${e}`);const t=this.player._opt.showPerformance;let i=!t;Io(e)&&(i=e),i!==t?this.player?this.player.togglePerformancePanel(i):this.debugWarn("JbPro","togglePerformancePanel() failed, this.player is not init"):this.debugWarn("JbPro",`togglePerformancePanel() failed, showPerformance is prev: ${t} === now: ${i}`)}openZoom(){if(!this.isDestroyed())if(this.debugLog("JbPro","openZoom()"),this.player){if(this.player.isDestroyedOrClosed())return void this.debugWarn("JbPro","openZoom() failed, this.player is destroyed or paused");this.player.zooming=!0}else this.debugWarn("JbPro","openZoom() failed, this.player is not init")}closeZoom(){if(!this.isDestroyed())if(this.debugLog("JbPro","closeZoom()"),this.player){if(this.player.isDestroyedOrClosed())return void this.debugWarn("JbPro","openZoom() failed, this.player is destroyed or paused");this.player.zooming=!1}else this.debugWarn("JbPro","closeZoom() failed, this.player is not init")}isZoomOpen(){let e=!1;return this.player&&(e=this.player.zooming),e}toggleZoom(e){this.isDestroyed()||(this.debugLog("JbPro",`toggleZoom() ${e}`),Io(e)||(e=!this.isZoomOpen()),ga(e)?this.openZoom():ya(!1)&&this.closeZoom())}expandZoom(){this.isDestroyed()||(this.debugLog("JbPro","expandZoom()"),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.expandPrecision():this.debugWarn("JbPro","expandZoom() failed, zoom is not open or not init"))}narrowZoom(){this.isDestroyed()||(this.debugLog("JbPro","narrowZoom()"),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.narrowPrecision():this.debugWarn("JbPro","narrowZoom failed, zoom is not open or not init"))}updateCurrentZoom(e){this.isDestroyed()||(this.debugLog("JbPro","updateCurrentZoom()",e),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.updateCurrentZoom(e):this.debugWarn("JbPro","narrowZoom failed, zoom is not open or not init"))}getCurrentZoomIndex(){if(this.isDestroyed())return;let e=1;return this.player&&this.player.zoom&&(e=this.player.zoom.currentZoom),e}setNakedFlowFps(e){return new Promise(((t,i)=>{if(this.isDestroyed())return i("player is destroyed");if(this.debugLog("JbPro","setNakedFlowFps()",e),Po(e))return i("setNakedFlowFps() fps is empty");let s=Number(e);s=oo(s,1,100),this._opt.nakedFlowFps=s,this.player?this.player.updateOption({nakedFlowFps:s}):this.debugWarn("JbPro","setNakedFlowFps() player is null"),t()}))}getCrashLog(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!this.player)return;const i=this.player.getAllStatsData(),s=this.player;let r={url:this._opt.url,playType:s.isPlayback()?"playback":"live",demuxType:s.getDemuxType(),decoderType:s.getDecodeType(),renderType:s.getRenderType(),videoInfo:{encType:"",width:"",height:""},audioInfo:{encType:"",sampleRate:"",channels:""},audioEngine:s.getAudioEngineType(),allTimes:i.pTs,timestamp:ro(),type:e,error:na(t)||e};if(s.video){const e=s.video.videoInfo||{};r.videoInfo={encType:e.encType||"",width:e.width||"",height:e.height||""}}if(s.audio){const e=s.audio.audioInfo||{};r.audioInfo={encType:e.encType||"",sampleRate:e.sampleRate||"",channels:e.channels||""}}return r}updateDebugLevel(e){this.isDestroyed()||(this.debugLog("JbPro","updateDebugLevel()",e),e===q||e===K?e!==this.player._opt.debugLevel?(this._opt.debugLevel=e,this.player?this.player.updateOption({debugLevel:e},!0):this.debugWarn("JbPro","updateDebugLevel() player is null")):this.debugWarn("JbPro",`updateDebugLevel() level is same, level: ${e}`):this.debugWarn("JbPro",`updateDebugLevel() level is not valid, level: ${e}`))}updateWatermark(e){this.isDestroyed()||(this.debugLog("JbPro","updateWatermark()",e),this.player?this.player.updateWatermark(e):this.debugWarn("JbPro","updateWatermark() player is not init"))}removeWatermark(){this.isDestroyed()||(this.debugLog("JbPro","removeWatermark()"),this.player?this.player.removeWatermark():this.debugWarn("JbPro","removeWatermark() player is not init"))}updateFullscreenWatermark(e){if(!this.isDestroyed())if(this.debugLog("JbPro","updateFullscreenWatermark()",e),Jo(e)){this._opt.fullscreenWatermarkConfig=e;const t=Fo(this.$container,e);if(!t.watermark_txt)return void this.debugWarn("JbPro","fullscreenWatermarkConfig text is empty");this.watermark.load(t)}else this.debugWarn("JbPro",`updateFullscreenWatermark() config is not valid, config: ${e}`)}removeFullscreenWatermark(){this.isDestroyed()||(this.debugLog("JbPro","removeFullscreenWatermark()"),this.watermark?this.watermark.remove():this.debugWarn("JbPro","removeFullscreenWatermark() watermark is not init"))}faceDetectOpen(){this.isDestroyed()||(this.debugLog("JbPro","faceDetectOpen()"),this.player?this.player.faceDetect(!0):this.debugWarn("JbPro","faceDetectOpen() player is not init"))}faceDetectClose(){this.isDestroyed()||(this.debugLog("JbPro","faceDetectClose()"),this.player?this.player.faceDetect(!1):this.debugWarn("JbPro","faceDetectClose() player is not init"))}objectDetectOpen(){this.isDestroyed()||(this.debugLog("JbPro","objectDetectOpen()"),this.player?this.player.objectDetect(!0):this.debugWarn("JbPro","objectDetectOpen() player is not init"))}objectDetectClose(){this.isDestroyed()||(this.debugLog("JbPro","objectDetectClose()"),this.player?this.player.objectDetect(!1):this.debugWarn("JbPro","objectDetectClose() player is not init"))}sendWebsocketMessage(e){this.isDestroyed()||(this.debugLog("JbPro","sendWebsocketMessage()",e),this.player?this.player.sendWebsocketMessage(e):this.debugWarn("JbPro","sendWebsocketMessage() player is not init"))}addContentToCanvas(e){this.isDestroyed()||(this.debugLog("JbPro","addContentToCanvas()"),this.player?this.player.addContentToCanvas(e):this.debugWarn("JbPro","addContentToCanvas() player is not init"))}clearContentToCanvas(){this.isDestroyed()||(this.debugLog("JbPro","clearContentToCanvas()"),this.player?this.player.addContentToCanvas([]):this.debugWarn("JbPro","clearContentToCanvas() player is not init"))}addContentToContainer(e){this.isDestroyed()||(this.debugLog("JbPro","addContentToContainer()"),this.player?this.player.addContentToContainer(e):this.debugWarn("JbPro","addContentToContainer() player is not init"))}clearContentToContainer(){this.isDestroyed()||(this.debugLog("JbPro","clearContentToContainer()"),this.player?this.player.addContentToContainer([]):this.debugWarn("JbPro","clearContentToContainer() player is not init"))}setControlHtml(e){this.isDestroyed()||(this.debugLog("JbPro","setControlHtml()",e),this.player?this.player.setControlHtml(e):this.debugWarn("JbPro","setControlHtml() player is not init"))}clearControlHtml(){this.isDestroyed()||(this.debugLog("JbPro","clearControlHtml()"),this.player?this.player.clearControlHtml():this.debugWarn("JbPro","clearControlHtml() player is not init"))}toggleControlHtml(e){this.isDestroyed()||(this.debugLog("JbPro",`toggleControlHtml() ${e}`),this.player?this.player.toggleControlHtml(e):this.debugWarn("JbPro","toggleControlHtml() player is not init"))}getControlHtmlIsShow(){return!!this.player&&this.player.getControlHtmlIsShow()}getControlHtml(){return this.player?this.player.getControlHtml():null}setExtendHtml(e){this.isDestroyed()||(this.debugLog("JbPro","setExtendHtml()",e),this.player?this.player.setExtendHtml(e):this.debugWarn("JbPro","setExtendHtml() player is not init"))}clearExtendHtml(){this.isDestroyed()||(this.debugLog("JbPro","clearExtendHtml()"),this.player?this.player.clearExtendHtml():this.debugWarn("JbPro","clearExtendHtml() player is not init"))}toggleExtendHtml(e){this.isDestroyed()||(this.debugLog("JbPro",`toggleExtendHtml() ${e}`),this.player?this.player.toggleExtendHtml(e):this.debugWarn("JbPro","toggleExtendHtml() player is not init"))}getExtendHtmlIsShow(){return!!this.player&&this.player.getExtendHtmlIsShow()}getExtendHtml(){return this.player?this.player.getExtendHtml():null}getVideoInfo(){let e=null;return this.player&&(e=this.player.getVideoInfo()),e}getAudioInfo(){let e=null;return this.player&&(e=this.player.getAudioInfo()),e}setSm4CryptoKey(e){if(this.isDestroyed())return;this.debugLog("JbPro","setSm4CryptoKey()",e);const t=(e=""+e).split(".");if(32!==e.length&&2!==t.length)return void this.debugWarn("JbPro",`setSm4CryptoKey() key is invalid and length is ${e.length} !== 32`);if(2===t.length&&(32!==t[0].length||32!==t[1].length))return void this.debugWarn("JbPro",`setSm4CryptoKey() key is invalid and key length is ${t[0].length} !== 32 or iv length ${t[1].length} !== 32`);this._opt.sm4CryptoKey=e;let i=2===t.length;if(i&&(this._opt.playOptions.cryptoKey=ll(t[0]),this._opt.playOptions.cryptoIV=ll(t[1])),this.player){const t={sm4CryptoKey:e};i&&(t.cryptoKey=this._opt.playOptions.cryptoKey,t.cryptoIV=this._opt.playOptions.cryptoIV),this.player.updateOption(t,!0)}else this.debugWarn("JbPro","setSm4CryptoKey() player is null")}setM7sCryptoKey(e){this.isDestroyed()||(this.debugLog("JbPro","setM7sCryptoKey()",e),e=""+e,this._opt.m7sCryptoKey=e,this.player?this.player.updateOption({m7sCryptoKey:e},!0):this.debugWarn("JbPro","setM7sCryptoKey() player is null"))}setXorCryptoKey(e){this.isDestroyed()||(this.debugLog("JbPro","setXorCryptoKey()",e),e=""+e,this._opt.xorCryptoKey=e,this.player?this.player.updateOption({xorCryptoKey:e},!0):this.debugWarn("JbPro","setXorCryptoKey() player is null"))}updateLoadingText(e){this.isDestroyed()||(this.debugLog("JbPro","updateLoadingText()",e),this.player?this.player.updateLoadingText(e):this.debugWarn("JbPro","updateLoadingText() player is null"))}updateIsEmitSEI(e){this.isDestroyed()||(this.debugLog("JbPro","updateIsEmitSEI()",e),this._opt.isEmitSEI=e,this.player?this.player.updateOption({isEmitSEI:e},!0):this.debugWarn("JbPro","updateIsEmitSEI() player is null"))}getPTZCmd(e,t){return this.debugLog("JbPro","getPTZCmd()",e),e?this.player?Qv({type:e,index:0,speed:t}):(this.debugWarn("JbPro","getPTZCmd() player is null"),null):(this.debugWarn("JbPro","getPTZCmd() ptz is null"),null)}downloadTempNakedFlowFile(){return new Promise(((e,t)=>{this.player?(this.player.downloadNakedFlowFile(),e()):t("player is not init")}))}downloadTempFmp4File(){return new Promise(((e,t)=>{if(this.isDestroyed())return t("player is destroyed");this.player?(this.player.downloadFmp4File(),e()):t("player is not init")}))}downloadTempMpeg4File(){return new Promise(((e,t)=>{if(this.isDestroyed())return t("player is destroyed");this.player?(this.player.downloadMpeg4File(),e()):t("player is not init")}))}downloadMemoryLog(){this.isDestroyed()||this.memoryLogger&&this.memoryLogger.download()}_getVideoLastIframeInfo(){const e=this.getVideoInfo()||{},t={loadingBackground:this.screenshot("","png",.92,"base64"),loadingBackgroundWidth:e.width||0,loadingBackgroundHeight:e.height||0};return t.loadingBackground&&t.loadingBackgroundWidth&&t.loadingBackgroundHeight&&(this._tempVideoLastIframeInfo=t),this._tempVideoLastIframeInfo||{}}getExtendBtnList(){this.debugLog("JbPro","getExtendBtnList()");let e=[];return this.player?e=this.player.getExtendBtnList():this.debugWarn("JbPro","getExtendBtnList() player is null"),e}getFlvMetaData(){this.debugLog("JbPro","getFlvMetaData()");let e=null;return this.player?e=this.player.getMetaData():this.debugWarn("JbPro","getFlvMetaData() player is null"),e}updateAiFaceDetectInterval(e){if(this.isDestroyed())return;this.debugLog("JbPro","updateAiFaceDetectInterval()",e);const t=1e3*(e=Number(e));this._opt.aiFaceDetectInterval=t,this.player?this.player.updateOption({aiFaceDetectInterval:t}):this.debugWarn("JbPro","updateAiFaceDetectInterval() player is null")}updateAiFaceDetectLevel(e){if(this.isDestroyed())return;if(this.debugLog("JbPro","updateAiFaceDetectLevel()",e),!Ks[e])return void this.debugWarn("JbPro",`'updateAiFaceDetectLevel() level ${e} is invalid'`);const t=Ks[e];this._opt.aiFaceDetectWidth=t,this.player?(this.player.updateOption({aiFaceDetectWidth:t}),this.player.ai&&this.player.ai.updateFaceDetectorConfig({detectWidth:t})):this.debugWarn("JbPro","updateAiFaceDetectLevel() player is null")}updateAiObjectDetectInterval(e){if(this.isDestroyed())return;this.debugLog("JbPro","updateAiObjectDetectInterval()",e);const t=1e3*(e=Number(e));this._opt.aiObjectDetectInterval=t,this.player?this.player.updateOption({aiObjectDetectInterval:t}):this.debugWarn("JbPro","updateAiObjectDetectInterval() player is null")}updateAiObjectDetectLevel(e){if(this.isDestroyed())return;if(this.debugLog("JbPro","updateAiObjectDetectLevel()",e),!Ys[e])return void this.debugWarn("JbPro",`'updateAiObjectDetectLevel() level ${e} is invalid'`);const t=Ys[e];this._opt.aiObjectDetectWidth=t,this.player?(this.player.updateOption({aiObjectDetectWidth:t}),this.player.ai&&this.player.ai.updateObjectDetectorConfig({detectWidth:t})):this.debugWarn("JbPro","updateAiObjectDetectLevel() player is null")}setCryptoKeyUrl(e){this.isDestroyed()||(this.debugLog("JbPro","setCryptoKeyUrl()",e),e&&(this._opt.cryptoKeyUrl=e))}showErrorMessageTips(e){this.isDestroyed()||(this.debugLog("JbPro","showErrorMessageTips()",e),e&&(this.player?this.player.showTipsMessageByContent(e):this.debugWarn("JbPro","showErrorMessageTips() player is null")))}setPtzPosition(e){this.debugLog("JbPro","setPtzPosition()",e),e&&!Ho(e)&&(this.player?this.player.setPtzPosition(e):this.debugWarn("JbPro","setPtzPosition() player is null"))}hideErrorMessageTips(){this.isDestroyed()||(this.debugLog("JbPro","hideErrorMessageTips()"),this.player?this.player.hideTipsMessage():this.debugWarn("JbPro","hideErrorMessageTips() player is null"))}getContainerRect(){return this._getContainerRect()}proxy(e,t,i,s){return this.events.proxy(e,t,i,s)}getUrl(){return this._opt.url}toggleControlExtendBtn(e,t){this.isDestroyed()||(this.debugLog(this.TAG_NAME,`toggleControlExtendBtn() ${e} ${t}`),this.player?this.player.toggleControlExtendBtn(e,t):this.debugWarn(this.TAG_NAME,"toggleControlExtendBtn() player is null"))}getControlExtendBtnActive(e){if(this.isDestroyed())return;this.debugLog(this.TAG_NAME,`getControlExtendBtnActive() ${e}`);let t=!1;return this.player?t=this.player.getControlExtendBtnActive(e):this.debugWarn(this.TAG_NAME,"getControlExtendBtnActive() player is null"),t}toggleControlBar(e){this.isDestroyed()||(this.debugLog(this.TAG_NAME,`toggleControlBar() ${e}`),this.player?this.player.toggleControlBar(e):this.debugWarn(this.TAG_NAME,"toggleControlBar() player is null"))}getControlBarShow(){if(this.isDestroyed())return!1;this.debugLog(this.TAG_NAME,"getControlBarShow()");let e=!1;return this.player?e=this.player.getControlBarShow():this.debugWarn(this.TAG_NAME,"getControlBarShow() player is null"),e}static getCopyrightWatermarkHash(e){return Oo(e)}static extractScreenshotCopyrightWatermark(e){return function(e){for(var t=e,i=0,s=0,r=0;r<32;r++)s|=(1&t[i])<=5){const s=i[0],r=i[i.length-1],o=r-s;o<=1e4&&(this.debugWarn(this.TAG_NAME,`retry type is ${e}, and retry length is ${i.length}, and start is ${s} and end is ${r} and diff is ${o}`),t=!1)}return t}_initLoadingBackgroundForIOS(e){(Ao()||bo())&&e.loadingBackground&&e.loadingBackgroundWidth&&e.loadingBackgroundHeight&&(this.debugLog(this.TAG_NAME,"_initLoadingBackgroundForIOS"),this._initLoadingBg(),"default"===this.player._opt.aspectRatio||po()?this._doInitLoadingBackground(e):this._doInitLoadingBackgroundForRatio(e))}_doInitLoadingBackground(e){const t=this._getContainerRect();let i=t.height;const s=this.player._opt;if(this.player.isControlBarShow()){i-=s.playType===w?Xt:Qt}let r=t.width,o=i;const a=s.rotate;270!==a&&90!==a||(r=i,o=t.width),this.$loadingBgImage.width=r,this.$loadingBgImage.height=o,this.$loadingBgImage.src=e.loadingBackground;let n=(t.width-r)/2,l=(i-o)/2,d="contain";s.isResize||(d="fill"),s.isFullResize&&(d="none");let h="";"none"===s.mirrorRotate&&a&&(h+=" rotate("+a+"deg)"),"level"===s.mirrorRotate?h+=" rotateY(180deg)":"vertical"===s.mirrorRotate&&(h+=" rotateX(180deg)"),this._opt.videoRenderSupportScale&&(this.$loadingBgImage.style.objectFit=d),this.$loadingBgImage.style.transform=h,this.$loadingBgImage.style.padding="0",this.$loadingBgImage.style.left=n+"px",this.$loadingBgImage.style.top=l+"px",this.$loadingBgImage.complete?ac(this.$loadingBg,"show"):this.$loadingBgImage.onload=()=>{ac(this.$loadingBg,"show"),this.$loadingBgImage.onload=null}}_doInitLoadingBackgroundForRatio(e){const t=this.player._opt.aspectRatio.split(":").map(Number),i=this._getContainerRect();let s=i.width,r=i.height;const o=this.player._opt;let a=0;this.player.isControlBarShow()&&(a=o.playType===w?Xt:Qt,r-=a);const n=e.loadingBackgroundWidth,l=e.loadingBackgroundHeight,d=n/l,h=t[0]/t[1];if(this.$loadingBgImage.src=e.loadingBackground,d>h){const e=h*l/n;this.$loadingBgImage.style.width=100*e+"%",this.$loadingBgImage.style.height=`calc(100% - ${a}px)`,this.$loadingBgImage.style.padding=`0 ${(s-s*e)/2}px`}else{const e=n/h/l;this.$loadingBgImage.style.width="100%",this.$loadingBgImage.style.height=`calc(${100*e}% - ${a}px)`,this.$loadingBgImage.style.padding=(r-r*e)/2+"px 0"}this.$loadingBgImage.complete?ac(this.$loadingBg,"show"):this.$loadingBgImage.onload=()=>{ac(this.$loadingBg,"show"),this.$loadingBgImage.onload=null}}_initLoadingBg(){if(!this.$loadingBg){const e=document.createElement("div"),t=document.createElement("img");e.className="jb-pro-loading-bg-for-ios",this.$loadingBg=e,this.$loadingBgImage=t,e.appendChild(t),this.$container.appendChild(e)}}_removeLoadingBackgroundForIOS(){if(this.$loadingBg){this.debugLog(this.TAG_NAME,"_removeLoadingBackgroundForIOS()");if(!hc(this.$loadingBg)){const e=this.$container.querySelector(".jb-pro-loading-bg-for-ios");e&&this.$container&&this.$container.removeChild(e)}this.$loadingBg=null,this.$loadingBgImage=null}}_getContainerRect(){let e={};return this.$container&&(e=this.$container.getBoundingClientRect(),e.width=Math.max(e.width,this.$container.clientWidth),e.height=Math.max(e.height,this.$container.clientHeight)),e}_isNeedNetworkDisconnectReplay(){return this._opt.networkDisconnectReplay&&this.network.isOffline()}_handleWebglAlignmentError(e){if(this.isDestroyed())this.debugLog("JbPro","webglAlignmentError but player is destroyed");else if(this.webglAlignmentErrorOnLock)this.debugLog("JbPro","webglAlignmentErrorOnLock is true");else if(this.emit(at.crashLog,this.getCrashLog(dt.webglAlignmentError,e)),this.webglAlignmentErrorOnLock=!0,this.player&&this.player._opt.webglAlignmentErrorReplay){this.debugLog("JbPro","webglAlignmentError");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({openWebglAlignment:!0}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webglAlignmentError and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.webglAlignmentError,{},e),this.debugError("JbPro","webglAlignmentError and play error",t)})).finally((()=>{this.webglAlignmentErrorOnLock=!1}))})).catch((e=>{this.webglAlignmentErrorOnLock=!1,this.debugError("JbPro","webglAlignmentError and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.webglAlignmentError,{},e),this.debugLog("JbPro","webglAlignmentError and webglAlignmentErrorReplay is false")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.webglAlignmentError,{},e),this.debugError("JbPro","webglAlignmentError and pause error",t)})).finally((()=>{this.webglAlignmentErrorOnLock=!1}))}}_handleWebglContextLostError(e){if(this.isDestroyed())return void this.debugLog("JbPro","webglContextLostError but player is destroyed");if(this.webglContextLostErrorOnLock)return void this.debugLog("JbPro","webglContextLostErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.webglContextLostError,e));const t=this._getVideoLastIframeInfo();if(this.webglContextLostErrorOnLock=!0,this.player&&this.player._opt.webglContextLostErrorReplay){this.debugLog("JbPro","webglContextLostError");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","webglContextLostError and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.webglContextLostError,t,e),this.debugError("JbPro","webglContextLostError and play error",i)})).finally((()=>{this.webglContextLostErrorOnLock=!1}))})).catch((i=>{this.webglContextLostErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.webglContextLostError,t,e),this.debugError("JbPro","webglContextLostError and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.webglContextLostError,t,e),this.debugLog("JbPro","webglContextLostError and webglContextLostErrorReplay is false")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.webglContextLostError,t,e),this.debugError("JbPro","webglAlignmentError and pause error",i)})).finally((()=>{this.webglContextLostErrorOnLock=!1}))}}_handleMediaSourceH265NotSupport(e){if(this.isDestroyed())this.debugLog("JbPro","mediaSourceH265NotSupport but player is destroyed");else if(this.mediaSourceH265NotSupportOnLock)this.debugLog("JbPro","mediaSourceH265NotSupportOnLock is true");else if(this.emit(at.crashLog,this.getCrashLog(dt.mediaSourceH265NotSupport,e)),this.mediaSourceH265NotSupportOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.mediaSourceH265NotSupport,e),this.debugError("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play error",t)})).finally((()=>{this.mediaSourceH265NotSupportOnLock=!1}))})).catch((t=>{this.mediaSourceH265NotSupportOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceH265NotSupport,{},e),this.debugError("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.mediaSourceH265NotSupport,{},e),this.debugLog("JbPro","mediaSourceH265NotSupport and autoWasm is false")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.mediaSourceH265NotSupport,{},e),this.debugError("JbPro","mediaSourceH265NotSupport and pause error",t)})).finally((()=>{this.mediaSourceH265NotSupportOnLock=!1}))}}_handleMseWaitVideoCanplayTimeout(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","mseWaitVideoCanplayTimeout but player is destroyed");else if(this.mseWaitVideoCanplayTimeoutOnLock)this.debugLog("JbPro","mseWaitVideoCanplayTimeoutOnLock is true");else if(this.emit(at.crashLog,this.getCrashLog(dt.mseWaitVideoCanplayTimeout,e)),this.mseWaitVideoCanplayTimeoutOnLock=!0,this.player&&this.player._opt.mseWaitVideoCanplayAutoWasm){this.debugLog("JbPro","mseWaitVideoCanplayTimeout auto wasm [mse-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","mseWaitVideoCanplayTimeout auto wasm [mse-> wasm] reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.mseWaitVideoCanplayTimeout,e),this.debugError("JbPro","mseWaitVideoCanplayTimeout auto wasm [mse-> wasm] reset player and play error",t)})).finally((()=>{this.mseWaitVideoCanplayTimeoutOnLock=!1}))})).catch((t=>{this.mseWaitVideoCanplayTimeoutOnLock=!1,this.emit(at.playFailedAndPaused,dt.mseWaitVideoCanplayTimeout,{},e),this.debugError("JbPro","mseWaitVideoCanplayTimeout auto wasm [mse-> wasm] _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.mseWaitVideoCanplayTimeout,{},e),this.debugLog("JbPro","mseWaitVideoCanplayTimeout and autoWasm is false")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.mediaSourceH265NotSupport,{},e),this.debugError("JbPro","mediaSourceH265NotSupport and pause error",t)})).finally((()=>{this.mseWaitVideoCanplayTimeoutOnLock=!1}))}}_handleMediaSourceFull(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceFull but player is destroyed"));if(this.mediaSourceFullOnLock)return void this.debugLog("JbPro","mediaSourceFullOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.mediaSourceFull,e));const t=this._getVideoLastIframeInfo();if(this.mediaSourceFullOnLock=!0,this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},o=this.player._opt.decoderErrorAutoWasm,a=!0;o?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(vr)?this._mseDecodeErrorRetryLog.push(ro()):(o=!0,a=!1,r={useMSE:!1,useWCS:!1}),this.debugLog("JbPro",`mediaSourceFull and auto wasm ${ya(a)?" and is not meaningful Retry":""} [mse-> ${o?"wasm":"mse"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mediaSourceFull and reset player and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mediaSourceFull,t,e),this.debugError("JbPro","mediaSourceFull and reset player and play error",i)})).finally((()=>{this.mediaSourceFullOnLock=!1}))})).catch((i=>{this.mediaSourceFullOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceFull,t,e),this.debugError("JbPro","mediaSourceFull and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.mediaSourceFull,t,e),this.debugLog("JbPro","mediaSourceFull and autoWasm is false")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mediaSourceFull,t,e),this.debugError("JbPro","mediaSourceFull and pause error",i)})).finally((()=>{this.mediaSourceFullOnLock=!1}))}}_handleMediaSourceAppendBufferError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceAppendBufferError but player is destroyed"));if(this.mediaSourceAppendBufferErrorOnLock)return void this.debugLog("JbPro","mediaSourceAppendBufferErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.mediaSourceAppendBufferError,e));const t=this._getVideoLastIframeInfo();if(this.mediaSourceAppendBufferErrorOnLock=!0,this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},o=this.player._opt.decoderErrorAutoWasm,a=!0;o?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(vr)?this._mseDecodeErrorRetryLog.push(ro()):(o=!0,a=!1,r={useMSE:!1,useWCS:!1}),this.player.isMSEAudioDecoderError&&(this.player.debugLog("JbPro","mediaSourceAppendBufferError and isMSEAudioDecoderError is true so set mseDecodeAudio = false"),r.mseDecodeAudio=!1),this.debugLog("JbPro",`mediaSourceAppendBufferError and auto wasm ${ya(a)?" and is not meaningful Retry":""} [mse-> ${o?"wasm":"mse"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mediaSourceAppendBufferError and reset player and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAppendBufferError,t,e),this.debugError("JbPro","mediaSourceAppendBufferError and reset player and play error",i)})).finally((()=>{this.mediaSourceAppendBufferErrorOnLock=!1}))})).catch((i=>{this.mediaSourceAppendBufferErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceAppendBufferError,t,e),this.debugError("JbPro","mediaSourceAppendBufferError and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAppendBufferError,t,e),this.debugLog("JbPro","mediaSourceAppendBufferError and autoWasm is false")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAppendBufferError,t,e),this.debugError("JbPro","mediaSourceAppendBufferError and pause error",i)})).finally((()=>{this.mediaSourceAppendBufferErrorOnLock=!1}))}}_handleMseSourceBufferError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mseSourceBufferError but player is destroyed"));if(this.mseSourceBufferErrorOnLock)return void this.debugLog("JbPro","mseSourceBufferErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.mseSourceBufferError,e));const t=this._getVideoLastIframeInfo();if(this.mseSourceBufferErrorOnLock=!0,this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={};if(this.player._opt.mseDecoderUseWorker)r={mseDecoderUseWorker:!1},this.debugLog("JbPro","mseSourceBufferError auto wasm [mse worker -> mse] reset player and play");else{let e=this.player._opt.decoderErrorAutoWasm,t=!0;e?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(vr)?this._mseDecodeErrorRetryLog.push(ro()):(e=!0,t=!1,r={useMSE:!1,useWCS:!1}),this.player.isMSEVideoDecoderInitializationFailedNotSupportHevc&&(this.debugLog("JbPro","mseSourceBufferError and isMSEVideoDecoderInitializationFailedNotSupportHevc is true so auto wasm"),r={useMSE:!1,useWCS:!1}),this.debugLog("JbPro",`mseSourceBufferError auto wasm ${ya(t)?" and is not meaningful Retry":""} [mse-> ${e?"wasm":"mse"}] reset player and play`)}this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mseSourceBufferError reset player and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mseSourceBufferError,t,e),this.debugError("JbPro","mseSourceBufferError reset player and play error",i)})).finally((()=>{this.mseSourceBufferErrorOnLock=!1}))})).catch((i=>{this.mseSourceBufferErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.mseSourceBufferError,t,e),this.debugError("JbPro","mseSourceBufferError _resetPlayer and play error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.mseSourceBufferError,t,e),this.debugLog("JbPro","mseSourceBufferError and autoWasm is false")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mseSourceBufferError,t,e),this.debugError("JbPro","mseSourceBufferError and pause error:",i)})).finally((()=>{this.mseSourceBufferErrorOnLock=!1}))}}_handleMediaSourceBufferedIsZeroError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceBufferedIsZeroError but player is destroyed"));if(this.mediaSourceBufferedIsZeroErrorOnLock)return void this.debugLog("JbPro","mediaSourceBufferedIsZeroErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.mediaSourceBufferedIsZeroError,e));const t=this._getVideoLastIframeInfo();if(this.mediaSourceBufferedIsZeroErrorOnLock=!0,this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},o=this.player._opt.decoderErrorAutoWasm,a=!0;o?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(vr)?this._mseDecodeErrorRetryLog.push(ro()):(o=!0,a=!1,r={useMSE:!1,useWCS:!1}),this.debugLog("JbPro",`mediaSourceBufferedIsZeroError auto wasm ${ya(a)?" and is not meaningful Retry":""} [mse-> ${o?"wasm":"mse"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mediaSourceBufferedIsZeroError reset player and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mediaSourceBufferedIsZeroError,t,e),this.debugError("JbPro","mediaSourceBufferedIsZeroError reset player and play error",i)})).finally((()=>{this.mediaSourceBufferedIsZeroErrorOnLock=!1}))})).catch((i=>{this.mediaSourceBufferedIsZeroErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceBufferedIsZeroError,t,e),this.debugError("JbPro","mediaSourceBufferedIsZeroError _resetPlayer and play error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.mediaSourceBufferedIsZeroError,t,e),this.debugLog("JbPro","mediaSourceBufferedIsZeroError and autoWasm is false")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mediaSourceBufferedIsZeroError,t,e),this.debugError("JbPro","mediaSourceBufferedIsZeroError and pause error:",i)})).finally((()=>{this.mediaSourceBufferedIsZeroErrorOnLock=!1}))}}_handleMseAddSourceBufferError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mseAddSourceBufferError but player is destroyed"));if(this.mseAddSourceBufferErrorOnLock)return void this.debugLog("JbPro","mseAddSourceBufferErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.mseAddSourceBufferError,e));const t=this._getVideoLastIframeInfo();if(this.mseAddSourceBufferErrorOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={useMSE:!1,useWCS:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mseAddSourceBufferError,t,e),this.debugError("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play error",i)})).finally((()=>{this.mseAddSourceBufferErrorOnLock=!1}))})).catch((i=>{this.mseAddSourceBufferErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.mseAddSourceBufferError,t,e),this.debugError("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] _resetPlayer and play error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.mseAddSourceBufferError,t,e),this.debugLog("JbPro","mseAddSourceBufferError and autoWasm is false")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mseAddSourceBufferError,t,e),this.debugError("JbPro","mseAddSourceBufferError and pause error",i)})).finally((()=>{this.mseAddSourceBufferErrorOnLock=!1}))}}_handleMediaSourceDecoderConfigurationError(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","mediaSourceDecoderConfigurationError but player is destroyed");else if(this.mediaSourceDecoderConfigurationErrorOnLock)this.debugLog("JbPro","mediaSourceDecoderConfigurationErrorOnLock is true");else if(this.emit(at.crashLog,this.getCrashLog(dt.mediaSourceDecoderConfigurationError,e)),this.mediaSourceDecoderConfigurationErrorOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;let s={useMSE:!1,useWCS:!1};this._resetPlayer(s).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.mediaSourceDecoderConfigurationError,e),this.debugError("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play error",t)})).finally((()=>{this.mediaSourceDecoderConfigurationErrorOnLock=!1}))})).catch((t=>{this.mediaSourceDecoderConfigurationErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceDecoderConfigurationError,e),this.debugError("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.mediaSourceDecoderConfigurationError,e),this.debugLog("JbPro","mediaSourceDecoderConfigurationError and autoWasm is false")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.mediaSourceDecoderConfigurationError,e),this.debugError("JbPro","mediaSourceDecoderConfigurationError and pause error",t)})).finally((()=>{this.mediaSourceDecoderConfigurationErrorOnLock=!1}))}}_handleMediaSourceTsIsMaxDiff(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceTsIsMaxDiff but player is destroyed"));if(this.mediaSourceTsIsMaxDiffOnLock)return void this.debugLog("JbPro","mediaSourceTsIsMaxDiffOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.mediaSourceTsIsMaxDiff,e));const t=this._getVideoLastIframeInfo();if(this.mediaSourceTsIsMaxDiffOnLock=!0,this.player&&this.player._opt.mediaSourceTsIsMaxDiffReplay){this.debugLog("JbPro","mediaSourceTsIsMaxDiff reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mediaSourceTsIsMaxDiff replay success")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mediaSourceTsIsMaxDiff,t,e),this.debugError("JbPro","mediaSourceTsIsMaxDiff replay error",i)})).finally((()=>{this.mediaSourceTsIsMaxDiffOnLock=!1}))})).catch((i=>{this.mediaSourceTsIsMaxDiffOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceTsIsMaxDiff,t,e),this.debugError("JbPro","mediaSourceTsIsMaxDiff _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.mediaSourceTsIsMaxDiff,t,e),this.debugLog("JbPro","mediaSourceTsIsMaxDiff and replay is false")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mediaSourceTsIsMaxDiff,t,e),this.debugError("JbPro","mediaSourceTsIsMaxDiff and pause error",i)})).finally((()=>{this.mediaSourceTsIsMaxDiffOnLock=!1}))}}_handleMseWidthOrHeightChange(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mseWidthOrHeightChange but player is destroyed"));if(this.mseWidthOrHeightChangeOnLock)return void this.debugLog("JbPro","mseWidthOrHeightChangeOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.mseWidthOrHeightChange,t));const i=this._getVideoLastIframeInfo();if(this.mseWidthOrHeightChangeOnLock=!0,this.player&&this.player._opt.widthOrHeightChangeReplay){this.debugLog("JbPro","mseWidthOrHeightChange and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.player._opt.widthOrHeightChangeReplayDelayTime>0?this.widthOrHeightChangeReplayDelayTimeout=setTimeout((()=>{this.widthOrHeightChangeReplayDelayTimeout=null,this.isDestroyed()?this.debug&&this.debugLog("JbPro","mseWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):this.play(e,s).then((()=>{this.debugLog("JbPro","mseWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.mseWidthOrHeightChangeOnLock=!1}))}),1e3*this.player._opt.widthOrHeightChangeReplayDelayTime):this.play(e,s).then((()=>{this.debugLog("JbPro","mseWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.mseWidthOrHeightChangeOnLock=!1}))})).catch((e=>{this.mseWidthOrHeightChangeOnLock=!1,this.emit(at.playFailedAndPaused,dt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(at.playFailedAndPaused,dt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange and _resetPlayer error",e)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange error and pause error",e)})).finally((()=>{this.mseWidthOrHeightChangeOnLock=!1}))}}_handleMediaSourceAudioG711NotSupport(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceAudioG711NotSupport but player is destroyed"));if(this.mediaSourceAudioG711NotSupportOnLock)return void this.debugLog("JbPro","mediaSourceAudioG711NotSupportOnLock is true");const i=this._getVideoLastIframeInfo();if(this.mediaSourceAudioG711NotSupportOnLock=!0,this.player&&this.player._opt.mediaSourceAudioG711NotSupportReplay){this.debugLog("JbPro","mediaSourceAudioG711NotSupport and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","mediaSourceAudioG711NotSupport and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAudioG711NotSupport,i,t),this.debugError("JbPro","mediaSourceAudioG711NotSupport and reset player and play error",e)})).finally((()=>{this.mediaSourceAudioG711NotSupportOnLock=!1}))})).catch((e=>{this.mediaSourceAudioG711NotSupportOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceAudioG711NotSupport,i,t),this.debugError("JbPro","mediaSourceAudioG711NotSupport and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAudioG711NotSupport,i,t),this.debugError("JbPro","mediaSourceAudioG711NotSupport and _resetPlayer error",e)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAudioG711NotSupport,i,t),this.debugError("JbPro","mediaSourceAudioG711NotSupport error and pause error",e)})).finally((()=>{this.mediaSourceAudioG711NotSupportOnLock=!1}))}}_handleMediaSourceAudioInitTimeout(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceAudioInitTimeout but player is destroyed"));if(this.mediaSourceAudioInitTimeoutOnLock)return void this.debugLog("JbPro","mediaSourceAudioInitTimeoutOnLock is true");const i=this._getVideoLastIframeInfo();if(this.mediaSourceAudioInitTimeoutOnLock=!0,this.player&&this.player._opt.mediaSourceAudioInitTimeoutReplay){this.debugLog("JbPro","mediaSourceAudioInitTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","mediaSourceAudioInitTimeout and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAudioInitTimeout,i,t),this.debugError("JbPro","mediaSourceAudioInitTimeout and reset player and play error",e)})).finally((()=>{this.mediaSourceAudioInitTimeoutOnLock=!1}))})).catch((e=>{this.mediaSourceAudioInitTimeoutOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceAudioInitTimeout,i,t),this.debugError("JbPro","mediaSourceAudioInitTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAudioInitTimeout,i),this.debugError("JbPro","mediaSourceAudioInitTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAudioInitTimeout,i),this.debugError("JbPro","mediaSourceAudioInitTimeout error and pause error",e)})).finally((()=>{this.mediaSourceAudioInitTimeoutOnLock=!1}))}}_handleMediaSourceAudioNoDataTimeout(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceAudioNoDataTimeout but player is destroyed"));if(this.mediaSourceAudioNoDataTimeoutOnLock)return void this.debugLog("JbPro","mediaSourceAudioNoDataTimeoutOnLock is true");const i=this._getVideoLastIframeInfo();if(this.mediaSourceAudioNoDataTimeoutOnLock=!0,this.player&&this.player._opt.mediaSourceAudioNoDataTimeoutReplay){this.debugLog("JbPro","mediaSourceAudioNoDataTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","mediaSourceAudioNoDataTimeout and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAudioNoDataTimeout,i,t),this.debugError("JbPro","mediaSourceAudioNoDataTimeout and reset player and play error",e)})).finally((()=>{this.mediaSourceAudioNoDataTimeoutOnLock=!1}))})).catch((e=>{this.mediaSourceAudioNoDataTimeoutOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceAudioNoDataTimeout,i,t),this.debugError("JbPro","mediaSourceAudioNoDataTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAudioNoDataTimeout,i),this.debugError("JbPro","mediaSourceAudioNoDataTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAudioNoDataTimeout,i),this.debugError("JbPro","mediaSourceAudioNoDataTimeout error and pause error",e)})).finally((()=>{this.mediaSourceAudioNoDataTimeoutOnLock=!1}))}}_handleMseWorkerAddSourceBufferError(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mseWorkerAddSourceBufferError but player is destroyed"));if(this.mseWorkerAddSourceBufferErrorOnLock)return void this.debugLog("JbPro","mseWorkerAddSourceBufferErrorOnLock is true");const i=this._getVideoLastIframeInfo();if(this.mseWorkerAddSourceBufferErrorOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","mseWorkerAddSourceBufferError and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecoderUseWorker:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","mseWorkerAddSourceBufferError and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mseWorkerAddSourceBufferError,i,t),this.debugError("JbPro","mseWorkerAddSourceBufferError and reset player and play error",e)})).finally((()=>{this.mseWorkerAddSourceBufferErrorOnLock=!1}))})).catch((e=>{this.mseWorkerAddSourceBufferErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.mseWorkerAddSourceBufferError,i,t),this.debugError("JbPro","mseWorkerAddSourceBufferError and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.mseWorkerAddSourceBufferError,i),this.debugError("JbPro","mseWorkerAddSourceBufferError and _resetPlayer error",e)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mseWorkerAddSourceBufferError,i),this.debugError("JbPro","mseWorkerAddSourceBufferError error and pause error",e)})).finally((()=>{this.mseWorkerAddSourceBufferErrorOnLock=!1}))}}_handleMediaSourceUseCanvasRenderPlayFailed(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","mediaSourceUseCanvasRenderPlayFailed but player is destroyed");else if(this.mediaSourceUseCanvasRenderPlayFailedOnLock)this.debugLog("JbPro","mediaSourceUseCanvasRenderPlayFailedOnLock is true");else if(this.emit(at.crashLog,this.getCrashLog(dt.mediaSourceUseCanvasRenderPlayFailed,e)),this.mediaSourceUseCanvasRenderPlayFailedOnLock=!0,this.player&&this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplay&&this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType){this.debugLog("JbPro",`mediaSourceUseCanvasRenderPlayFailed relayType is ${this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType} and reset player and play`);const t=this._opt.url,i=this._opt.playOptions;let s={};const r=this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType;r===H?s={useMSE:!1,useWCS:!1}:r===J&&(s={useVideoRender:!0,useCanvasRender:!1}),this._resetPlayer(s).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","mediaSourceUseCanvasRenderPlayFailed and reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.mediaSourceUseCanvasRenderPlayFailed,e),this.debugError("JbPro","mediaSourceUseCanvasRenderPlayFailed and reset player and play error",t)})).finally((()=>{this.mediaSourceUseCanvasRenderPlayFailedOnLock=!1}))})).catch((t=>{this.mediaSourceUseCanvasRenderPlayFailedOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceUseCanvasRenderPlayFailed,e),this.debugError("JbPro","mediaSourceUseCanvasRenderPlayFailed auto and _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.debugLog("JbPro","mediaSourceUseCanvasRenderPlayFailed and pause player success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.mediaSourceUseCanvasRenderPlayFailed,e),this.debugError("JbPro","mediaSourceUseCanvasRenderPlayFailed and pause",t)})).finally((()=>{this.mediaSourceUseCanvasRenderPlayFailedOnLock=!1}))}}_handleWebcodecsH265NotSupport(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","webcodecsH265NotSupport but player is destroyed");else if(this.webcodecsH265NotSupportOnLock)this.debugLog("JbPro","webcodecsH265NotSupportOnLock is true");else if(this.emit(at.crashLog,this.getCrashLog(dt.webcodecsH265NotSupport,e)),this.webcodecsH265NotSupportOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.webcodecsH265NotSupport,e),this.debugError("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play error",t)})).finally((()=>{this.webcodecsH265NotSupportOnLock=!1}))})).catch((e=>{this.webcodecsH265NotSupportOnLock=!1,this.debugError("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] _resetPlayer and play error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.webcodecsH265NotSupport,e),this.debugLog("JbPro","webcodecsH265NotSupport and autoWasm is false")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.webcodecsH265NotSupport,e),this.debugError("JbPro","webcodecsH265NotSupport and pause error",t)})).finally((()=>{this.webcodecsH265NotSupportOnLock=!1}))}}_handleWebcodecsUnsupportedConfigurationError(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","webcodecsUnsupportedConfigurationError but player is destroyed");else if(this.webcodecsUnsupportedConfigurationErrorOnLock)this.debugLog("JbPro","webcodecsUnsupportedConfigurationErrorOnLock is true");else if(this.emit(at.crashLog,this.getCrashLog(dt.webcodecsUnsupportedConfigurationError,e)),this.webcodecsUnsupportedConfigurationErrorOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.webcodecsUnsupportedConfigurationError,e),this.debugError("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play error",t)})).finally((()=>{this.webcodecsUnsupportedConfigurationErrorOnLock=!1}))})).catch((t=>{this.webcodecsUnsupportedConfigurationErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.webcodecsUnsupportedConfigurationError,e),this.debugError("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.webcodecsUnsupportedConfigurationError,e),this.debugLog("JbPro","webcodecsUnsupportedConfigurationError and autoWasm is false")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.webcodecsUnsupportedConfigurationError,e),this.debugError("JbPro","webcodecsUnsupportedConfigurationError and pause error",t)})).finally((()=>{this.webcodecsUnsupportedConfigurationErrorOnLock=!1}))}}_handleWebcodecsDecodeConfigureError(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","webcodecsDecodeConfigureError but player is destroyed");else if(this.webcodecsDecodeConfigureErrorOnLock)this.debugLog("JbPro","webcodecsDecodeConfigureErrorOnLock is true");else if(this.emit(at.crashLog,this.getCrashLog(dt.webcodecsDecodeConfigureError,e)),this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.webcodecsDecodeConfigureError,e),this.debugError("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play error",t)})).finally((()=>{this.webcodecsDecodeConfigureErrorOnLock=!1}))})).catch((t=>{this.webcodecsDecodeConfigureErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.webcodecsDecodeConfigureError,e),this.debugError("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.webcodecsDecodeConfigureError,e),this.debugLog("JbPro","webcodecsDecodeConfigureError and autoWasm is false")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.webcodecsDecodeConfigureError,e),this.debugError("JbPro","webcodecsDecodeConfigureError and pause error",t)})).finally((()=>{this.webcodecsDecodeConfigureErrorOnLock=!1}))}}_handleWebcodecsDecodeError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webcodecsDecodeError but player is destroyed"));if(this.webcodecsDecodeErrorOnLock)return void this.debugLog("JbPro","webcodecsDecodeErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.webcodecsDecodeError,e));const t=this._getVideoLastIframeInfo();if(this.webcodecsDecodeErrorOnLock=!0,this.player&&this.player._opt.wcsDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},o=this.player._opt.decoderErrorAutoWasm,a=!0;o?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(_r)?this._wcsDecodeErrorRetryLog.push(ro()):(o=!0,a=!1,r={useMSE:!1,useWCS:!1}),this.debugLog("JbPro",`webcodecs decode error autoWasm ${ya(a)?" and is not meaningful Retry":""} [wcs-> ${o?"wasm":"wcs"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","webcodecs decode error reset player and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.webcodecsDecodeError,t,e),this.debugError("JbPro","webcodecs decode error reset player and play error",i)})).finally((()=>{this.webcodecsDecodeErrorOnLock=!1}))})).catch((()=>{this.webcodecsDecodeErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.webcodecsDecodeError,t,e),this.debugError("JbPro","webcodecs decode error _resetPlayer error")}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.webcodecsDecodeError,t,e),this.debugLog("JbPro","webcodecs decode error and autoWasm is false")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.webcodecsDecodeError,t,e),this.debugError("JbPro","webcodecs decode error and pause error",i)})).finally((()=>{this.webcodecsDecodeErrorOnLock=!1}))}}_handleWcsWidthOrHeightChange(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","wcsWidthOrHeightChange but player is destroyed"));if(this.wcsWidthOrHeightChangeOnLock)return void this.debugLog("JbPro","wcsWidthOrHeightChangeOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.wcsWidthOrHeightChange,t));const i=this._getVideoLastIframeInfo();if(this.wcsWidthOrHeightChangeOnLock=!0,this.player&&this.player._opt.widthOrHeightChangeReplay){this.debugLog("JbPro","wcsWidthOrHeightChange and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._opt.widthOrHeightChangeReplayDelayTime>0?this.widthOrHeightChangeReplayDelayTimeout=setTimeout((()=>{this.widthOrHeightChangeReplayDelayTimeout=null,this.isDestroyed()?this.debug&&this.debugLog("JbPro","wcsWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):this.play(e,s).then((()=>{this.debugLog("JbPro","wcsWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.wcsWidthOrHeightChangeOnLock=!1}))}),1e3*this._opt.widthOrHeightChangeReplayDelayTime):this.play(e,s).then((()=>{this.debugLog("JbPro","wcsWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.wcsWidthOrHeightChangeOnLock=!1}))})).catch((e=>{this.wcsWidthOrHeightChangeOnLock=!1,this.emit(at.playFailedAndPaused,dt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(at.playFailedAndPaused,dt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange and _resetPlayer error",e)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange error and pause error",e)})).finally((()=>{this.wcsWidthOrHeightChangeOnLock=!1}))}}_handleWebcodecsAudioNoDataTimeout(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webcodecsAudioNoDataTimeout but player is destroyed"));if(this.webcodecsAudioNoDataTimeoutOnLock)return void this.debugLog("JbPro","webcodecsAudioNoDataTimeoutOnLock is true");const i=this._getVideoLastIframeInfo();if(this.webcodecsAudioNoDataTimeoutOnLock=!0,this.player&&this.player._opt.webcodecsAudioNoDataTimeoutReplay){this.debugLog("JbPro","webcodecsAudioNoDataTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={wcsDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","webcodecsAudioNoDataTimeout and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.webcodecsAudioNoDataTimeout,i,t),this.debugError("JbPro","webcodecsAudioNoDataTimeout and reset player and play error",e)})).finally((()=>{this.webcodecsAudioNoDataTimeoutOnLock=!1}))})).catch((e=>{this.webcodecsAudioNoDataTimeoutOnLock=!1,this.emit(at.playFailedAndPaused,dt.webcodecsAudioNoDataTimeout,i,t),this.debugError("JbPro","webcodecsAudioNoDataTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.webcodecsAudioNoDataTimeout,i),this.debugError("JbPro","webcodecsAudioNoDataTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.webcodecsAudioNoDataTimeout,i),this.debugError("JbPro","webcodecsAudioNoDataTimeout error and pause error",e)})).finally((()=>{this.webcodecsAudioNoDataTimeoutOnLock=!1}))}}_handleWebcodecsAudioInitTimeout(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webcodecsAudioInitTimeout but player is destroyed"));if(this.webcodecsAudioInitTimeoutOnLock)return void this.debugLog("JbPro","webcodecsAudioInitTimeoutOnLock is true");const i=this._getVideoLastIframeInfo();if(this.webcodecsAudioInitTimeoutOnLock=!0,this.player&&this.player._opt.webcodecsAudioInitTimeoutReplay){this.debugLog("JbPro","webcodecsAudioInitTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={wcsDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","webcodecsAudioInitTimeout and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.webcodecsAudioInitTimeout,i,t),this.debugError("JbPro","webcodecsAudioInitTimeout and reset player and play error",e)})).finally((()=>{this.webcodecsAudioInitTimeoutOnLock=!1}))})).catch((e=>{this.webcodecsAudioInitTimeoutOnLock=!1,this.emit(at.playFailedAndPaused,dt.webcodecsAudioInitTimeout,i,t),this.debugError("JbPro","webcodecsAudioInitTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.webcodecsAudioInitTimeout,i),this.debugError("JbPro","webcodecsAudioInitTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.webcodecsAudioInitTimeout,i),this.debugError("JbPro","webcodecsAudioInitTimeout error and pause error",e)})).finally((()=>{this.webcodecsAudioInitTimeoutOnLock=!1}))}}_handleSimdDecodeError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","simdDecodeError but player is destroyed"));if(this.simdDecodeErrorOnLock)return void this.debugLog("JbPro","simdDecodeErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.simdDecodeError,e));const t=this._getVideoLastIframeInfo();if(this.simdDecodeErrorOnLock=!0,this.player&&this.player._opt.simdDecodeErrorReplay){this.debugLog("JbPro",`simdDecodeError error simdDecodeErrorReplayType is ${this.player._opt.simdDecodeErrorReplayType} and reset player and play`);const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.simdDecodeErrorReplayType===j&&(r={useSIMD:!1}),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","simdDecodeError and reset player and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.simdDecodeError,t,e),this.debugError("JbPro","simdDecodeError and reset player and play error",i)})).finally((()=>{this.simdDecodeErrorOnLock=!1}))})).catch((i=>{this.simdDecodeErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.simdDecodeError,t,e),this.debugError("JbPro","simdDecodeError and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.simdDecodeError,t,e),this.debugError("JbPro","simdDecodeError and simdDecodeErrorReplay is false")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.simdDecodeError,t,e),this.debugError("JbPro","simdDecodeError error and pause error",i)})).finally((()=>{this.simdDecodeErrorOnLock=!1}))}}_handleWasmWidthOrHeightChange(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","wasmWidthOrHeightChange but player is destroyed"));if(this.wasmWidthOrHeightChangeOnLock)return void this.debugLog("JbPro","wasmWidthOrHeightChangeOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.wasmWidthOrHeightChange,t));const i=this._getVideoLastIframeInfo();if(this.wasmWidthOrHeightChangeOnLock=!0,this.player&&this.player._opt.widthOrHeightChangeReplay){this.debugLog("JbPro","wasmWidthOrHeightChange and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._opt.widthOrHeightChangeReplayDelayTime>0?this.widthOrHeightChangeReplayDelayTimeout=setTimeout((()=>{this.widthOrHeightChangeReplayDelayTimeout=null,this.isDestroyed()?this.debug&&this.debugLog("JbPro","wasmWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):this.play(e,s).then((()=>{this.debugLog("JbPro","wasmWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.wasmWidthOrHeightChange,i,t),this.debugError("JbPro","wasmWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.wasmWidthOrHeightChangeOnLock=!1}))}),1e3*this._opt.widthOrHeightChangeReplayDelayTime):this.play(e,s).then((()=>{this.debugLog("JbPro","wasmWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.wasmWidthOrHeightChange,i,t),this.debugError("JbPro","wasmWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.wasmWidthOrHeightChangeOnLock=!1}))})).catch((e=>{this.wasmWidthOrHeightChangeOnLock=!1,this.emit(at.playFailedAndPaused,dt.wasmWidthOrHeightChange,i,t),this.debugError("JbPro","wasmWidthOrHeightChange and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(at.playFailedAndPaused,dt.wasmWidthOrHeightChange,i,t),this.debugError("JbPro","wasmWidthOrHeightChange and _resetPlayer error",e)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.wasmWidthOrHeightChange,i),this.debugError("JbPro","wasmWidthOrHeightChange error and pause error",e)})).finally((()=>{this.wasmWidthOrHeightChangeOnLock=!1}))}}_handleWasmUseVideoRenderError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","wasmUseVideoRenderError but player is destroyed"));if(this.wasmUseVideoRenderErrorOnLock)return void this.debugLog("JbPro","wasmUseVideoRenderErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.wasmUseVideoRenderError,e)),this.debugLog("JbPro","wasmUseVideoRenderError and reset player and play");const t=this._opt.url,i=this._opt.playOptions;this.wasmUseVideoRenderErrorOnLock=!0,this._resetPlayer({useVideoRender:!1,useCanvasRender:!0}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","wasmUseVideoRenderError and reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.wasmUseVideoRenderError,{},e),this.debugError("JbPro","wasmUseVideoRenderError and reset player and play error",t)})).finally((()=>{this.wasmUseVideoRenderErrorOnLock=!1}))})).catch((t=>{this.wasmUseVideoRenderErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.wasmUseVideoRenderError,{},e),this.debugError("JbPro","wasmUseVideoRenderError and _resetPlayer error",t)}))}_handleVideoElementPlayingFailed(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","videoElementPlayingFailed but player is destroyed"));if(this.videoElementPlayingFailedOnLock)return void this.debugLog("JbPro","videoElementPlayingFailedOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.videoElementPlayingFailed,e));const t=this._getVideoLastIframeInfo();if(this.videoElementPlayingFailedOnLock=!0,this.player&&this.player._opt.videoElementPlayingFailedReplay){this.debugLog("JbPro",`videoElementPlayingFailed and useMSE is ${this._opt.useMSE} and reset player and play`);const i=this._opt.url,s=this._opt.playOptions;let r={useMSE:!1,useVideoRender:!1,useCanvasRender:!0};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","videoElementPlayingFailed and reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.videoElementPlayingFailed,{},e),this.debugError("JbPro","videoElementPlayingFailed and reset player and play error",t)})).finally((()=>{this.videoElementPlayingFailedOnLock=!1}))})).catch((t=>{this.videoElementPlayingFailedOnLock=!1,this.emit(at.playFailedAndPaused,dt.videoElementPlayingFailed,{},e),this.debugError("JbPro","videoElementPlayingFailed and _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.videoElementPlayingFailed,{},e),this.debugError("JbPro","videoElementPlayingFailed and videoElementPlayingFailedReplay is false")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.videoElementPlayingFailed,{},e),this.debugError("JbPro","videoElementPlayingFailed and _pause error",t)})).finally((()=>{this.videoElementPlayingFailedOnLock=!1}))}}_handleSimdH264DecodeVideoWidthIsTooLarge(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","simdH264DecodeVideoWidthIsTooLarge but player is destroyed");else if(this.simdH264DecodeVideoWidthIsTooLargeOnLock)this.debugLog("JbPro","simdH264DecodeVideoWidthIsTooLargeOnLock is true");else if(this.emit(at.crashLog,this.getCrashLog(dt.simdH264DecodeVideoWidthIsTooLarge,e)),this.simdH264DecodeVideoWidthIsTooLargeOnLock=!0,this.player&&this.player._opt.simdH264DecodeVideoWidthIsTooLargeReplay){this.debugLog("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useSIMD:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debugError("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play error",t)})).finally((()=>{this.simdH264DecodeVideoWidthIsTooLargeOnLock=!1}))})).catch((t=>{this.simdH264DecodeVideoWidthIsTooLargeOnLock=!1,this.emit(at.playFailedAndPaused,dt.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debugError("JbPro","simdH264DecodeVideoWidthIsTooLarge and _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debugError("JbPro","simdH264DecodeVideoWidthIsTooLarge and simdDecodeErrorReplay is false")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debugError("JbPro","simdH264DecodeVideoWidthIsTooLarge and pause error",t)})).finally((()=>{this.simdH264DecodeVideoWidthIsTooLargeOnLock=!1}))}}_handleNetworkDelayTimeout(e){if(this.player._opt.networkDelayTimeoutReplay){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","networkDelayTimeout but player is destroyed"));if(this.networkDelayTimeoutOnLock)return void this.debugLog("JbPro","networkDelayTimeoutOnLock is true");this.emit(at.crashLog,this.getCrashLog(at.networkDelayTimeout,e));const t=this._getVideoLastIframeInfo();this.debugLog("JbPro","network delay time out and reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player&&this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this.networkDelayTimeoutOnLock=!0,this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","wasm decode error and reset player and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,at.networkDelayTimeout,t,e),this.debugError("JbPro","wasm decode error and reset player and play error",i)})).finally((()=>{this.networkDelayTimeoutOnLock=!1}))})).catch((()=>{this.networkDelayTimeoutOnLock=!1,this.emit(at.playFailedAndPaused,at.networkDelayTimeout,t,e),this.debugError("JbPro","wasm decode error and _resetPlayer error")}))}}_handleFlvDemuxBufferSizeTooLarge(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","flvDemuxBufferSizeTooLarge but player is destroyed"));if(this.flvDemuxBufferSizeTooLargeOnLock)return void this.debugLog("JbPro","flvDemuxBufferSizeTooLargeOnLock is true");const t=this._getVideoLastIframeInfo();if(this.flvDemuxBufferSizeTooLargeOnLock=!0,this.player._opt.flvDemuxBufferSizeTooLargeReplay){this.emit(at.crashLog,this.getCrashLog(at.flvDemuxBufferSizeTooLarge,e)),this.debugLog("JbPro","flv Demux Buffer Size Too Large and flvDemuxBufferSizeTooLargeReplay = true and reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player&&this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog(this.TAG_NAME,"flv Demux Buffer Size Too Large and reset player and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,at.flvDemuxBufferSizeTooLarge,t,e),this.debugError(this.TAG_NAME,"flv Demux Buffer Size Too Large and reset player and play error",i)})).finally((()=>{this.flvDemuxBufferSizeTooLargeOnLock=!1}))})).catch((()=>{this.flvDemuxBufferSizeTooLargeOnLock=!1,this.emit(at.playFailedAndPaused,at.flvDemuxBufferSizeTooLarge,t,e),this.debugError(this.TAG_NAME,"flv Demux Buffer Size Too Large and _resetPlayer error")}))}else if(this._opt.flvDemuxBufferSizeTooLargeEmitFailed){this.debugLog(this.TAG_NAME,"flv Demux Buffer Size Too Large and flvDemuxBufferSizeTooLargeEmitFailed = true and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.flvDemuxBufferSizeTooLarge,t,e)})).catch((i=>{this.emit(at.playFailedAndPaused,dt.flvDemuxBufferSizeTooLarge,t,e),this.debugError(this.TAG_NAME,"flv Demux Buffer Size Too Large",i)})).finally((()=>{this.flvDemuxBufferSizeTooLargeOnLock=!1}))}}_handleFetchError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","fetchError but player is destroyed"));if(this.fetchErrorOnLock)return void this.debugLog("JbPro","fetchErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.fetchError,e));const t=this._getVideoLastIframeInfo(),i=this._isNeedNetworkDisconnectReplay();if(this.fetchErrorOnLock=!0,this.player._opt.streamErrorReplay||i){i?this.debugLog("JbPro","fetch error and network is disconnect and reset player and play"):this.debugLog("JbPro",`fetch error and streamErrorReplay is true and _streamErrorReplayTimes is ${this._streamErrorReplayTimes}, streamErrorReplayDelayTime is ${this._opt.streamErrorReplayDelayTime}, next replay`);let s={};this.player._opt.replayUseLastFrameShow&&(s=Object.assign({},s,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(s.isNotMute=!0);const r=this._opt.playOptions,o=this._opt.url,a=i?1:this._opt.streamErrorReplayDelayTime;this._resetPlayer(s).then((()=>{this.streamErrorReplayDelayTimeout=setTimeout((()=>{if(this.streamErrorReplayDelayTimeout=null,this.isDestroyed())this.debug&&this.debugLog("JbPro","fetch error and _resetPlayer but player is destroyed and return");else{if(this._isNeedNetworkDisconnectReplay())return this.debugLog("JbPro","fetch error and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:o,options:r,type:dt.fetchError});this._streamErrorReplayTimes++,this.play(o,r).then((()=>{this.debugLog("JbPro","fetch error and reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.fetchError,{},e),this.debugError("JbPro","fetch error and reset player and play error",t)})).finally((()=>{this.fetchErrorOnLock=!1}))}}),1e3*a)})).catch((t=>{this.fetchErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.fetchError,{},e),this.debugError("JbPro","fetch error and _resetPlayer error",t)}))}else{this.debugLog("JbPro","fetch error and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.fetchError,t,e)})).catch((i=>{this.emit(at.playFailedAndPaused,dt.fetchError,t,e),this.debugError("JbPro","fetch error and pause",i)})).finally((()=>{this.fetchErrorOnLock=!1}))}}_handleStreamEnd(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","streamEnd but player is destroyed and return"));if(this.streamEndOnLock)return void this.debugLog("JbPro","streamEndOnLock is true");this.emit(at.crashLog,this.getCrashLog(at.streamEnd,e));const t=this._getVideoLastIframeInfo(),i=""+e=="1006"&&this.player._opt.websocket1006ErrorReplay,s=!!i&&this._checkIsMeaningfulRetry(br),r=i&&s,o=this.player._opt.streamEndReplay,a=this._isNeedNetworkDisconnectReplay();if(this.streamEndOnLock=!0,r||o||a){a?this.debugLog("JbPro","streamEnd and network is disconnect and reset player and play"):r?this.debugLog("JbPro",`streamEnd and websocket1006ErrorReplay is true and error is 1006 and _websocket1006ErrorReplayTimes is ${this._websocket1006ErrorReplayTimes} , delay ${this._opt.websocket1006ErrorReplayDelayTime}s reset player and play`):this.debugLog("JbPro",`streamEnd and isStreamEndReplay is true and and _streamEndReplayTimes is ${this._streamEndReplayTimes} , delay ${this._opt.streamEndReplayDelayTime}s reset player and play`);const s=this._opt.playOptions,o=this._opt.url;i&&this._websocket1006ErrorRetryLog.push(ro());let n={};this.player._opt.replayUseLastFrameShow&&(n=Object.assign({},n,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(n.isNotMute=!0);let l=r?this._opt.websocket1006ErrorReplayDelayTime:this._opt.streamEndReplayDelayTime;a&&(l=1),this._initLoadingBackgroundForIOS(t),this._resetPlayer(n).then((()=>{this.streamEndReplayDelayTimeout=setTimeout((()=>{if(this.streamEndReplayDelayTimeout=null,this._removeLoadingBackgroundForIOS(),this.isDestroyed())a?this.debug&&this.debugLog("JbPro","streamEnd and network is disconnect and _resetPlayer() but player is destroyed and return"):r?this.debug&&this.debugLog("JbPro","streamEnd and 1006 error and _resetPlayer() but player is destroyed and return"):this.debug&&this.debugLog("JbPro","streamEnd and _resetPlayer() but player is destroyed and return");else{if(this._isNeedNetworkDisconnectReplay())return r?this.debugLog("JbPro","streamEnd and 1006 error network is offline and wait network online to play , so return"):this.debugLog("JbPro","streamEnd and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:o,options:s,type:r?dt.websocket1006Error:dt.streamEnd});r?this._websocket1006ErrorReplayTimes++:this._streamEndReplayTimes++,this.play(o,s).then((()=>{r?this.debugLog("JbPro","streamEnd and 1006 error and reset player and play success"):this.debugLog("JbPro","streamEnd and reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.streamEnd,{},e),r?this.debugError("JbPro","streamEnd and 1006 error and reset player and play error",t):this.debugError("JbPro","streamEnd and reset player and play error",t)})).finally((()=>{this.streamEndOnLock=!1}))}}),1e3*l)})).catch((t=>{this.streamEndOnLock=!1,this.emit(at.playFailedAndPaused,dt.streamEnd,{},e),r?this.debugError("JbPro","streamEnd and 1006 and _resetPlayer error",t):this.debugError("JbPro","streamEnd and _resetPlayer error",t)}))}else{i?this.debugLog("JbPro","streamEnd pause player "+(ya(s)?"and is not meaningful retry":"")):this.debugLog("JbPro","streamEnd pause player");const r=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(r).then((()=>{this.emit(at.playFailedAndPaused,at.streamEnd,t,e)})).catch((i=>{this.emit(at.playFailedAndPaused,at.streamEnd,t,e),this.debugError("JbPro","streamEnd pause",i)})).finally((()=>{this.streamEndOnLock=!1}))}}_handleWebsocketError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","websocketError but player is destroyed"));if(this.websocketErrorOnLock)return void this.debugLog("JbPro","websocketErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.websocketError,e));const t=this._getVideoLastIframeInfo(),i=this._isNeedNetworkDisconnectReplay();if(this.websocketErrorOnLock=!0,this.player._opt.streamErrorReplay||i){i?this.debugLog("JbPro","websocketError error and network is disconnect and reset player and play"):this.debugLog("JbPro",`websocketError error and streamErrorReplay is true and _streamErrorReplayTimes is ${this._streamErrorReplayTimes} and streamErrorReplayDelayTime is ${this._opt.streamErrorReplayDelayTime}, next replay`);let s={};this.player._opt.replayUseLastFrameShow&&(s=Object.assign({},s,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(s.isNotMute=!0);const r=this._opt.playOptions,o=this._opt.url,a=i?1:this._opt.streamErrorReplayDelayTime;this._resetPlayer(s).then((()=>{this.streamErrorReplayDelayTimeout=setTimeout((()=>{if(this.streamErrorReplayDelayTimeout=null,this.isDestroyed())i?this.debug&&this.debugLog("JbPro","websocketError error and network is disconnect and _resetPlayer() but player is destroyed and return"):this.debug&&this.debugLog("JbPro","websocketError error and _resetPlayer() but player is destroyed and return");else{if(this._isNeedNetworkDisconnectReplay())return this.debugLog("JbPro","websocketError error and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:o,options:r,type:dt.websocketError});this._streamErrorReplayTimes++,this.play(o,r).then((()=>{this.debugLog("JbPro","websocketError error and reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.fetchError,{},e),this.debugError("JbPro","websocketError error and reset player and play error",t)})).finally((()=>{this.websocketErrorOnLock=!1}))}}),1e3*a)})).catch((t=>{this.websocketErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.fetchError,{},e),this.debugError("JbPro","websocketError error and _resetPlayer error",t)}))}else{this.debugLog("JbPro","websocketError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.websocketError,t,e)})).catch((i=>{this.emit(at.playFailedAndPaused,dt.websocketError,t,e),this.debugError("JbPro","websocketError and pause",i)})).finally((()=>{this.websocketErrorOnLock=!1}))}}_handleWebrtcError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webrtcError but player is destroyed"));if(this.webrtcErrorOnLock)return void this.debugLog("JbPro","webrtcErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.webrtcError,e));const t=this._getVideoLastIframeInfo();if(this._isNeedNetworkDisconnectReplay()){this.debugLog("JbPro","webrtcError error and network is offline and wait network online to play , so _resetPlayer and wait play");const i=this._opt.playOptions,s=this._opt.url;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._isNetworkOfflinePaused=!0,this._isNetworkOfflinePausedAndNextPlayConfig={url:s,options:i,type:dt.webrtcError}})).catch((()=>{this.emit(at.playFailedAndPaused,dt.webrtcError,t,e),this.debugError("JbPro","webrtcError and _resetPlayer error")})).finally((()=>{this.webrtcErrorOnLock=!1}))}else{this.debugLog("JbPro","webrtcError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.webrtcErrorOnLock=!0,this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.webrtcError,t,e)})).catch((i=>{this.emit(at.playFailedAndPaused,dt.webrtcError,t,e),this.debugError("JbPro","webrtcError and pause",i)})).finally((()=>{this.webrtcErrorOnLock=!1}))}}_handleHlsError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","hlsError but player is destroyed"));if(this.hlsErrorOnLock)return void this.debugLog("JbPro","hlsErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.hlsError,e));const t=this._getVideoLastIframeInfo();if(this._isNeedNetworkDisconnectReplay()){this.debugLog("JbPro","hlsError error and network is offline and wait network online to play , so _resetPlayer and wait play");const i=this._opt.playOptions,s=this._opt.url;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),ya(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._isNetworkOfflinePaused=!0,this._isNetworkOfflinePausedAndNextPlayConfig={url:s,options:i,type:dt.hlsError}})).catch((()=>{this.emit(at.playFailedAndPaused,dt.hlsError,t,e),this.debugError("JbPro","hlsError and _resetPlayer error")})).finally((()=>{this.hlsErrorOnLock=!1}))}else{this.debugLog("JbPro","hlsError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.hlsErrorOnLock=!0,this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.hlsError,t,e)})).catch((i=>{this.emit(at.playFailedAndPaused,dt.hlsError,t,e),this.debugError("JbPro","hlsError and pause",i)})).finally((()=>{this.hlsErrorOnLock=!1}))}}_handleAliyunRtcError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","aliyunRtcError but player is destroyed"));if(this.aliyunRtcErrorOnLock)return void this.debugLog("JbPro","aliyunRtcErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.aliyunRtcError,e));const t=this._getVideoLastIframeInfo();this.debugLog("JbPro","aliyunRtcError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.aliyunRtcErrorOnLock=!0,this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.aliyunRtcError,t,e)})).catch((i=>{this.emit(at.playFailedAndPaused,dt.aliyunRtcError,t,e),this.debugError("JbPro","aliyunRtcError and pause",i)})).finally((()=>{this.aliyunRtcErrorOnLock=!1}))}_handleDecoderWorkerInitError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","decoderWorkerInitError but player is destroyed"));if(this.decoderWorkerInitErrorOnLock)return void this.debugLog("JbPro","decoderWorkerInitErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.decoderWorkerInitError,e));const t=this._getVideoLastIframeInfo();this.debugLog("JbPro","decoderWorkerInitError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.decoderWorkerInitErrorOnLock=!0,this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.decoderWorkerInitError,t,e)})).catch((i=>{this.emit(at.playFailedAndPaused,dt.decoderWorkerInitError,t,e),this.debugError("JbPro","decoderWorkerInitError and pause",i)})).finally((()=>{this.decoderWorkerInitErrorOnLock=!1}))}_handleDecoderWorkerWasmError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","decoderWorkerWasmError but player is destroyed"));if(this.decoderWorkerWasmErrorOnLock)return void this.debugLog("JbPro","decoderWorkerWasmErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.decoderWorkerWasmError,e)),this.debugLog("JbPro","decoderWorkerWasmError and pause player");const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.decoderWorkerWasmErrorOnLock=!0,this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.decoderWorkerWasmError,{},e)})).catch((t=>{this.emit(at.playFailedAndPaused,dt.decoderWorkerWasmError,{},e),this.debugError("JbPro","decoderWorkerWasmError and pause",t)})).finally((()=>{this.decoderWorkerWasmErrorOnLock=!1}))}_handleVideoElementPlayingFailedForWebrtc(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","videoElementPlayingFailedForWebrtc but player is destroyed"));if(this.videoElementPlayingFailedForWebrtcOnLock)return void this.debugLog("JbPro","videoElementPlayingFailedForWebrtcOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.videoElementPlayingFailedForWebrtc,e)),this.debugLog("JbPro","videoElementPlayingFailedForWebrtc and pause player");const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.videoElementPlayingFailedForWebrtcOnLock=!0,this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.videoElementPlayingFailedForWebrtc,{},e)})).catch((t=>{this.emit(at.playFailedAndPaused,dt.videoElementPlayingFailedForWebrtc,{},e),this.debugError("JbPro","videoElementPlayingFailedForWebrtc and pause",t)})).finally((()=>{this.videoElementPlayingFailedForWebrtcOnLock=!1}))}_handleVideoInfoError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","videoInfoError but player is destroyed"));if(this.videoInfoErrorOnLock)return void this.debugLog("JbPro","videoInfoErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.videoInfoError,e)),this.debugLog("JbPro","videoInfoError and pause player");const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.videoInfoErrorOnLock=!0,this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.videoInfoError,{},e)})).catch((t=>{this.emit(at.playFailedAndPaused,dt.videoInfoError,{},e),this.debugError("JbPro","videoInfoError and pause",t)})).finally((()=>{this.videoInfoErrorOnLock=!1}))}_handleWebrtcStreamH265(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webrtcStreamH265 but player is destroyed"));if(this.webrtcStreamH265OnLock)return void this.debugLog("JbPro","webrtcStreamH265OnLock is true");this.debugLog("JbPro","webrtcStreamH265 and reset player and play");const t=this._opt.url,i=this._opt.playOptions;this.webrtcStreamH265OnLock=!0,this._resetPlayer({isWebrtcH265:!0}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webrtcStreamH265 and reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,at.webrtcStreamH265,{},e),this.debugError("JbPro","webrtcStreamH265 and reset player and play error",t)})).finally((()=>{this.webrtcStreamH265OnLock=!1}))})).catch((()=>{this.webrtcStreamH265OnLock=!1,this.emit(at.playFailedAndPaused,at.webrtcStreamH265,{},e),this.debugError("JbPro","webrtcStreamH265 and _resetPlayer error")}))}_handleDelayTimeout(e){if(this.isDestroyed())return void(this.debug&&this.debugWarn("JbPro","delay timeout replay but player is destroyed"));this.emit(at.crashLog,this.getCrashLog(at.delayTimeout,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.heartTimeoutReplay&&(this._heartTimeoutReplayTimes{if(this._isNeedNetworkDisconnectReplay())return this.debugLog("JbPro","delayTimeout and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:i,options:s,type:at.delayTimeout});this.play(i,s).then((()=>{})).catch((i=>{this.emit(at.playFailedAndPaused,at.delayTimeout,t,e),this.debugError("JbPro","delay timeout replay error",i)}))})).catch((i=>{this.emit(at.playFailedAndPaused,at.delayTimeout,t,e),this.debugError("JbPro","delay timeout _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,at.delayTimeout,t,e),this.player&&(this.emit(at.delayTimeoutRetryEnd),this.emit(at.playFailedAndPaused,at.delayTimeoutRetryEnd)),this.debugWarn("JbPro",`delayTimeoutRetryEnd and\n opt.heartTimeout is ${this.player&&this.player._opt.heartTimeout} and\n opt.heartTimeoutReplay is ${this.player&&this.player._opt.heartTimeoutReplay} and\n opt.heartTimeoutReplayTimes is ${this.player&&this.player._opt.heartTimeoutReplayTimes},and\n local._heartTimeoutReplayTimes is ${this._heartTimeoutReplayTimes}`)})).catch((i=>{this.emit(at.playFailedAndPaused,at.delayTimeout,t,e),this.debugError("JbPro","delay timeout and pause error",i)}))}}_handleLoadingTimeout(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","loading timeout but player is destroyed"));this.emit(at.crashLog,this.getCrashLog(at.loadingTimeout,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.loadingTimeoutReplay&&(this._loadingTimeoutReplayTimes{if(this._isNeedNetworkDisconnectReplay())return this.debugLog("JbPro","loadingTimeout and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:i,options:s,type:at.loadingTimeout});this.play(i,s).then((()=>{})).catch((i=>{this.emit(at.playFailedAndPaused,at.loadingTimeout,t,e),this.debugError("JbPro","loading timeout replay error",i)}))})).catch((i=>{this.emit(at.playFailedAndPaused,at.loadingTimeout,t,e),this.debugError("JbPro","loading timeout _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,at.loadingTimeout,t,e),this.player&&(this.emit(at.loadingTimeoutRetryEnd),this.emit(at.playFailedAndPaused,at.loadingTimeoutRetryEnd,t,e),this._opt.loadingTimeoutRetryEndShowPlayBtn&&this.player.showPlayBtn()),this.debugLog("JbPro",`loadingTimeoutRetryEnd and\n opt.loadingTimeout is ${this.player&&this.player._opt.loadingTimeout} and\n opt.loadingTimeoutReplay is ${this.player&&this.player._opt.loadingTimeoutReplay} and\n local._loadingTimeoutReplayTimes time is ${this._loadingTimeoutReplayTimes} and\n opt.loadingTimeoutReplayTimes is ${this.player&&this.player._opt.loadingTimeoutReplayTimes}`)})).catch((i=>{this.emit(at.playFailedAndPaused,at.loadingTimeout,t,e),this.debugError("JbPro","loading timeout and pause error",i)}))}}_handleInitDecoderWorkerTimeout(e){if(this.isDestroyed())return void this.debugLog("JbPro","InitDecoderWorkerTimeout but player is destroyed");this.emit(at.crashLog,this.getCrashLog(dt.initDecoderWorkerTimeout,e)),this.debugLog("JbPro","InitDecoderWorkerTimeout and pause player");const t=this._getVideoLastIframeInfo(),i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.initDecoderWorkerTimeout,t,e)})).catch((i=>{this.emit(at.playFailedAndPaused,dt.initDecoderWorkerTimeout,t,e),this.debugError("JbPro","videoInfoError and pause",i)}))}_checkInitDecoderWorkerTimeout(){this._clearInitDecoderWorkerTimeout(),this.initDecoderWorkerTimeout=setTimeout((()=>{this._handleInitDecoderWorkerTimeout(dt.initDecoderWorkerTimeout)}),1e3*this._opt.initDecoderWorkerTimeout)}_clearInitDecoderWorkerTimeout(){this.initDecoderWorkerTimeout&&(clearTimeout(this.initDecoderWorkerTimeout),this.initDecoderWorkerTimeout=null)}debugLog(e){if(this._opt.debug&&this.debug){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s1?t-1:0),s=1;s1?t-1:0),s=1;s0&&void 0!==arguments[0]?arguments[0]:{};super(),this._opt={},Object.keys(e).forEach((t=>{if(void 0===e[t])throw new Error(`jb-pro-multi option "${t}" can not be undefined`)}));const t=ua(Ts);this._opt=Object.assign({},t,e),this.LOG_TAG="jbProMulti";let i=e.container;if("string"==typeof e.container&&(i=document.querySelector(e.container)),!i)throw new Error("Jb-pro-multi need container option");if("CANVAS"===i.nodeName||"VIDEO"===i.nodeName)throw new Error(`Jb-pro-multi container type can not be ${i.nodeName} type`);i.classList.add("jb-pro-multi-container"),delete this._opt.container,this.maxWindowSize=this._opt.maxSplit*this._opt.maxSplit,this.currentWindowIndex=-1,this.currentWindowUuid=null,this.specialLayoutType=null,this.startDragWindowItem=null,this.checkRectInterval=null,this.windowList=[],this.$container=i,this.debug=new xr(this),this.events=new xa(this),this._opt.split||(this._opt.split=1),ga(this._opt.draggable)?this._initWindows$2():this._initWindows(),this._innerArrangeWindow(this._opt.split,!0),this._initEvents(),this._handleWindowSelect(0),this._listenFullscreenChange()}destroy(){return new Promise(((e,t)=>{if(this.debugLog(this.LOG_TAG,"destroy()"),this.off(),this.events&&(this.events.destroy(),this.events=null),this.checkRectInterval&&(clearInterval(this.checkRectInterval),this.checkRectInterval=null),this.specialLayoutType=null,this.startDragWindowItem=null,this.currentWindowUuid=null,this.currentWindowIndex=-1,this.$container&&(this.$container.classList.remove("jb-pro-multi-container"),this.$container=null),this.windowList){const i=[];this.windowList.forEach((e=>{e.$playerContainerEvents.forEach((e=>{e()})),e.player&&i.push(e.player.destroy())})),Promise.all(i).then((()=>{this.windowList.forEach((e=>{e.player=null})),this.windowList=[],e()})).catch((e=>{t(e)}))}else e();this.debugLog(this.LOG_TAG,"destroy")}))}_createPlayer(e){var t=this;const i=this._findWindowItemIndex(e),s=e.uuid,r=this._opt;r.supportDblclickContainerFullscreen&&(r.supportDblclickFullscreen=!1);const o=new o_({...r,isMulti:!0,multiIndex:i,multiUuid:s,container:e.$player});return Object.keys(nt).forEach((e=>{o.on(nt[e],(function(){for(var i=arguments.length,s=new Array(i),r=0;r{this.emit(at.close,i),e.player=null})),o}_initWindows(){let e="";for(let t=0;t\n
\n
\n \n `;const t=`
${e}
`;this.$container.innerHTML=t;const i=this.$container.querySelectorAll(".jb-pro-multi-player");for(let e=0;e\n
\n
\n \n `;const i=`
\n ${e}\n
`;this.$container.innerHTML=i,this.$multiContainer=this.$container.querySelector(".jb-pro-multi-player-container-v2");const s=this.$container.querySelectorAll(".jb-pro-multi-player");for(let e=0;e{const s=t.$playerContainer,r=e(s,"click",(e=>{e.preventDefault();const t=ba(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerClickDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);if(this.emit(ks.selected,i,e),this.getSelectedWindowUuid()===t){if(this._getWindowItem(t).isContainerFullscreen)return}1!==this._opt.split&&this._handleWindowSelect(i)})),o=e(s,"dblclick",(e=>{e.preventDefault();const t=ba(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"dblclickDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);this.emit(ks.dblSelected,i,e),this._opt.supportDblclickContainerFullscreen&&1!==this._opt.split&&this._handleWindowContainerFullscreen(i)})),a=e(s,"mouseup",(e=>{const t=ba(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerMouseupDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);this.emit(ks.mouseup,i,e)})),n=e(s,"mouseover",(e=>{const t=ba(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerMouseoverDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);this.emit(ks.mouseover,i,e)})),l=e(s,"mouseout",(e=>{const t=ba(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerMouseoutDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);this.emit(ks.mouseout,i,e)})),d=e(s,"mousedown",(e=>{const t=ba(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerMousedownDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);this.emit(ks.mousedown,i,e)})),h=e(s,"dragover",(e=>{e.preventDefault()})),c=e(s,"dragenter",(e=>{const t=ba(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerDragEnterDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);this._getWindowItem(t),this.emit(ks.dragenter,i,e,{uuid:t})})),u=e(s,"dragleave",(e=>{const t=ba(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerDragLeaveDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);this._getWindowItem(t),this.emit(ks.dragleave,i,e,{uuid:t})})),p=e(s,"drop",(e=>{e.preventDefault();const t=ba(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerDropDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t),r={};if(this._opt.draggable&&this.startDragWindowItem){const e=this.startDragWindowItem.$playerContainer,i=this.startDragWindowItem.player,o=this.startDragWindowItem.uuid,a=e.style.order;e.style.order=s.style.order,e.setAttribute("order",e.style.order),s.style.order=a,s.setAttribute("order",a);const n=this.getWindowItem(t);this.debugLog(this.LOG_TAG,`player Drop ${a} -> ${e.style.order}`),this._sortWindows(),r.fromUuid=o,r.toUuid=t,r.fromOrderIndex=wo(a),r.toOrderIndex=wo(e.style.order),i&&i._updateMultiIndex(wo(e.style.order)),n.player&&n.player._updateMultiIndex(wo(a))}this.emit(ks.drop,i,e,r)}));if(t.$playerContainerEvents=[r,a,n,l,d,o,h,c,u,p],this._opt.draggable){const i=e(s,"dragstart",(e=>{const t=ba(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerDragStartDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);this._handleWindowSelect(i),this.startDragWindowItem=this._getWindowItem(i),this.emit(ks.dragstart,i,e,{uuid:t})}));t.$playerContainerEvents.push(i)}if(this._opt.supportMousemoveEvent){const i=e(s,"mousemove",(e=>{const t=ba(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerMousemoveDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);this.emit(ks.mousemove,i,e)}));t.$playerContainerEvents.push(i)}}))}_getContainerRect(){const e=this.$container.getBoundingClientRect();return{width:parseInt(e.width),height:parseInt(e.height)}}_updateWindows(){const e=this._getContainerRect(),t=e.width,i=e.height,s=this._opt.split,r=t%s,o=i%s,a=(t-r-2*s)/s,n=(i-o-2*s)/s,l=(t-r)/s,d=(i-o)/s;let h=this._getCurrentMaxSplit();for(let e=0;e=Math.pow(s,2)?o:0),f=l+(e%s==s-1?r:0),m=d+(e+s>=Math.pow(s,2)?o:0);i.style.width=f+"px",i.style.height=m+"px",i.style.display="block",c.style.width=u+"px",c.style.height=p+"px",c.style.display="block",h.style.width=u+"px",h.style.height=p+"px",h.style.display="block",t.player&&t.player.resize()}if(this.specialLayoutType){const e=this.windowList[0],t=e.$playerContainer,i=e.$player,s=e.$playerBorder,r=t.style.width.replace("px",""),o=t.style.height.replace("px",""),a=i.style.width.replace("px",""),n=i.style.height.replace("px","");let l,d,c,u;this.specialLayoutType===Ls?(l=2*r,d=2*o,c=2*a+2,u=2*n+2):this.specialLayoutType===Cs&&(l=3*r,d=3*o,c=3*a+4,u=3*n+4),t.style.width=l+"px",t.style.height=d+"px",i.style.width=c+"px",i.style.height=u+"px",s.style.width=c+"px",s.style.height=u+"px",e.player&&e.player.resize(),h=this._getSpecialMaxSplit()}for(let e=h;e{0===t&&ao(e.$playerContainer,"display","block"),e.$playerContainer.setAttribute("fullscreen","0"),e.$playerContainer.style.fullscreen="0",e.$playerContainer.draggable=this._opt.split>1}))}_sortWindows(){const e=[];for(let t=0;t1&&(this.windowList.forEach((e=>{t.$playerBorder.style.display="block",e.$playerBorder.style.border=`1px solid ${this._opt.style.border}`})),this._opt.showSelectedBorder&&(t.$playerBorder.style.border=`1px solid ${this._opt.style.borderSelect}`))):this.debugWarn(this.LOG_TAG,`_handleWindowSelect() ${e} is not exist`),1===this._opt.split&&(t.$playerBorder.style.display="none")}_handleWindowContainerFullscreen(e,t){const i=this._getWindowItem(e);if(i){if(Io(t)&&t===i.isContainerFullscreen)return;if(this._opt.draggable){if(i.isContainerFullscreen){if(i.$playerContainer.setAttribute("fullscreen","0"),i.$playerContainer.style.fullscreen="0",this.specialLayoutType){ao(this.windowList[0].$playerContainer,"display","block")}}else if(i.$playerContainer.setAttribute("fullscreen","1"),i.$playerContainer.style.fullscreen="1",this.specialLayoutType){if(0!==this._findWindowItemIndexByUuid(i.uuid)){ao(this.windowList[0].$playerContainer,"display","none")}}}else if(i.isContainerFullscreen)i.$playerContainer.style.position="relative",i.$playerContainer.style.left="auto",i.$playerContainer.style.top="auto",i.$playerContainer.style.zIndex="auto",i.$playerContainer.style.width=i.prevInfo.playerContainerWidth,i.$playerContainer.style.height=i.prevInfo.playerContainerHeight,i.$player.style.width=i.prevInfo.playerWidth,i.$player.style.height=i.prevInfo.playerHeight,this.getSelectedWindowUuid()===i.uuid&&(i.$playerBorder.style.display="block");else{const e=this._getContainerRect(),t=e.width,s=e.height;i.prevInfo={playerContainerWidth:i.$playerContainer.style.width,playerContainerHeight:i.$playerContainer.style.height,playerWidth:i.$player.style.width,playerHeight:i.$player.style.height},i.$playerContainer.style.position="absolute",i.$playerContainer.style.top="0",i.$playerContainer.style.left="0",i.$playerContainer.style.zIndex="10",i.$playerContainer.style.width=t+"px",i.$playerContainer.style.height=s+"px",i.$player.style.width=t+"px",i.$player.style.height=s+"px",i.$playerBorder.style.display="none"}i.isContainerFullscreen=!i.isContainerFullscreen,i.player&&i.player.resize()}else this.debugWarn(this.LOG_TAG,`handleWindowContainerFullscreen() ${e} is not exist`)}_handleFullscreenResize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=this._getContainerRect(),i=0;this.checkRectInterval=setInterval((()=>{const s=Pr.isFullscreen,r=this._getContainerRect(),o={width:screen.width,height:screen.height};this.debugLog(this.LOG_TAG,`isInFullscreen ${s} , checkRectInterval times : ${i} nowRect:${JSON.stringify(r)}, prevRect:${JSON.stringify(t)} ,window screen rect:${JSON.stringify(o)}`);const a=r.width===t.width&&r.height===t.height,n=!s||o.width-r.width<10&&o.height-r.height<10;if(a&&n||i>=e)return this.checkRectInterval&&(clearInterval(this.checkRectInterval),this.checkRectInterval=null),void this.resize();t=r,i++}),1e3)}_listenFullscreenChange(){try{const e=e=>{Qo(e)===this.$container&&(this.emit(ks.multiFullscreen,Pr.isFullscreen),Pr.isFullscreen||-1!==window.navigator.userAgent.indexOf("Edg")?this._handleFullscreenResize():this.resize())};Pr.on("change",e),this.events.destroys.push((()=>{Pr.off("change",e)}))}catch(e){}}play(e,t,i){return new Promise(((s,r)=>{(ko(t)||qo(t))&&(i=t,t={});const o=this._getWindowItem(i);if(o)if(o.player)o.player.play(e,t).then((()=>{s()})).catch((e=>{r(e)}));else{const i=this._createPlayer(o);o.player=i,i.play(e,t).then((()=>{s()})).catch((e=>{r(e)}))}else r(`play() windowIndex ${i} is not exist`)}))}getOption(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getOption():(this.debugWarn(this.LOG_TAG,`getOption() windowIndex ${e} is not exist`),{})}setDebug(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setDebug(e):this.debugWarn(this.LOG_TAG,`setDebug() windowIndex ${t} is not exist`)}mute(e){const t=this._getWindowItem(e);t&&t.player?t.player.mute():this.debugWarn(this.LOG_TAG,`mute() windowIndex ${e} is not exist`)}cancelMute(e){const t=this._getWindowItem(e);t&&t.player?t.player.cancelMute():this.debugWarn(this.LOG_TAG,`cancelMute() windowIndex ${e} is not exist`)}setVolume(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setVolume(e):this.debugWarn(this.LOG_TAG,`setVolume() windowIndex ${t} is not exist`)}audioResume(e){const t=this._getWindowItem(e);t&&t.player?t.player.audioResume():this.debugWarn(this.LOG_TAG,`audioResume() windowIndex ${e} is not exist`)}setTimeout(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setTimeout(e):this.debugWarn(this.LOG_TAG,`setTimeout() windowIndex ${t} is not exist`)}setScaleMode(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setScaleMode(e):this.debugWarn(this.LOG_TAG,`setScaleMode() windowIndex ${t} is not exist`)}pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{const r=this._getWindowItem(t);r&&r.player?r.player.pause(e).then((()=>{i()})).catch((e=>{s(e)})):s(`pause() windowIndex ${t} is not exist`)}))}close(e){return new Promise(((t,i)=>{const s=this._getWindowItem(e);s&&s.player?s.player.close().then((()=>{t()})).catch((e=>{i(e)})):i(`close() windowIndex ${e} is not exist`)}))}clearView(e){const t=this._getWindowItem(e);t&&t.player?t.player.clearView():this.debugWarn(this.LOG_TAG,`clearView() windowIndex ${e} is not exist`)}setStreamQuality(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setStreamQuality(e):this.debugWarn(this.LOG_TAG,`setStreamQuality() windowIndex ${t} is not exist`)}resize(){this._opt.draggable?this._updateWindows$2():this._updateWindows()}setBufferTime(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setBufferTime(e):this.debugWarn(this.LOG_TAG,`setBufferTime() windowIndex ${t} is not exist`)}setBufferDelayTime(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setBufferDelayTime(e):this.debugWarn(this.LOG_TAG,`setBufferDelayTime() windowIndex ${t} is not exist`)}setRotate(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setRotate(e):this.debugWarn(this.LOG_TAG,`setRotate() windowIndex ${t} is not exist`)}setMirrorRotate(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setMirrorRotate(e):this.debugWarn(this.LOG_TAG,`setMirrorRotate() windowIndex ${t} is not exist`)}updateIsEmitSEI(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.updateIsEmitSEI(e):this.debugWarn(this.LOG_TAG,`updateIsEmitSEI() windowIndex ${t} is not exist`)}setAspectRatio(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setAspectRatio(e):this.debugWarn(this.LOG_TAG,`setAspectRatio() windowIndex ${t} is not exist`)}hasLoaded(e){const t=this._getWindowItem(e);return!(!t||!t.player)&&t.player.hasLoaded()}setKeepScreenOn(e){const t=this._getWindowItem(e);t&&t.player?t.player.setKeepScreenOn():this.debugWarn(this.LOG_TAG,`setKeepScreenOn() windowIndex ${e} is not exist`)}setFullscreen(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setFullscreen(e):this.debugWarn(this.LOG_TAG,`setFullscreen() windowIndex ${t} is not exist`)}screenshot(e,t){const i=this._getWindowItem(t);return i&&i.player?i.player.screenshot(e.filename,e.format,e.quality,e.type):null}screenshotWatermark(e,t){const i=this._getWindowItem(t);return i&&i.player?i.player.screenshotWatermark(e):null}startRecord(e,t,i){return new Promise(((s,r)=>{const o=this._getWindowItem(i);o&&o.player?o.player.startRecord(e,t).then((()=>{s()})).catch((e=>{r(e)})):(this.debugWarn(this.LOG_TAG,`startRecord() windowIndex ${i} is not exist`),r(`windowIndex ${i} is not exist`))}))}stopRecordAndSave(e,t,i){return new Promise(((s,r)=>{const o=this._getWindowItem(i);o&&o.player?o.player.stopRecordAndSave(e,t).then((e=>{s(e)})).catch((e=>{r(e)})):(this.debugWarn(this.LOG_TAG,`stopRecordAndSave() windowIndex ${i} is not exist`),r(`windowIndex ${i} is not exist`))}))}isPlaying(e){const t=this._getWindowItem(e);return t&&t.player?t.player.isPlaying():(this.debugWarn(this.LOG_TAG,`isPlaying() windowIndex ${e} is not exist`),!1)}isLoading(e){const t=this._getWindowItem(e);return t&&t.player?t.player.isLoading():(this.debugWarn(this.LOG_TAG,`isLoading() windowIndex ${e} is not exist`),!1)}isPaused(e){const t=this._getWindowItem(e);return t&&t.player?t.player.isPaused():(this.debugWarn(this.LOG_TAG,`windowIndex ${e} is not exist`),!1)}isMute(e){const t=this._getWindowItem(e);return t&&t.player?t.player.isMute():(this.debugWarn(this.LOG_TAG,`isMute() windowIndex ${e} is not exist`),!1)}isRecording(e){const t=this._getWindowItem(e);return t&&t.player?t.player.isRecording():(this.debugWarn(this.LOG_TAG,`isRecording() windowIndex ${e} is not exist`),!1)}clearBufferDelay(e){const t=this._getWindowItem(e);t&&t.player?t.player.clearBufferDelay():this.debugWarn(this.LOG_TAG,`clearBufferDelay() windowIndex ${e} is not exist`)}setNetworkDelayTime(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setNetworkDelayTime(e):this.debugWarn(this.LOG_TAG,`setNetworkDelayTime() windowIndex ${t} is not exist`)}getDecodeType(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getDecodeType():(this.debugWarn(this.LOG_TAG,`getDecodeType() windowIndex ${e} is not exist`),null)}getRenderType(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getRenderType():(this.debugWarn(this.LOG_TAG,`windowIndex ${e} is not exist`),null)}getAudioEngineType(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getAudioEngineType():(this.debugWarn(this.LOG_TAG,`windowIndex ${e} is not exist`),null)}getPlayingTimestamp(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getPlayingTimestamp():(this.debugWarn(this.LOG_TAG,`windowIndex ${e} is not exist`),null)}getStatus(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getStatus():(this.debugWarn(this.LOG_TAG,`getStatus() windowIndex ${e} is not exist`),null)}getPlayType(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getPlayType():(this.debugWarn(this.LOG_TAG,`getPlayType() windowIndex ${e} is not exist`),null)}togglePerformancePanel(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.togglePerformancePanel(e):this.debugWarn(this.LOG_TAG,`togglePerformancePanel() windowIndex ${t} is not exist`)}openZoom(e){const t=this._getWindowItem(e);t&&t.player?t.player.openZoom():this.debugWarn(this.LOG_TAG,`openZoom() windowIndex ${e} is not exist`)}closeZoom(e){const t=this._getWindowItem(e);t&&t.player?t.player.closeZoom():this.debugWarn(this.LOG_TAG,`closeZoom() windowIndex ${e} is not exist`)}isZoomOpen(e){const t=this._getWindowItem(e);return t&&t.player?t.player.isZoomOpen():(this.debugWarn(this.LOG_TAG,`isZoomOpen() windowIndex ${e} is not exist`),!1)}expandZoom(e){const t=this._getWindowItem(e);t&&t.player?t.player.expandZoom():this.debugWarn(this.LOG_TAG,`expandZoom() windowIndex ${e} is not exist`)}narrowZoom(e){const t=this._getWindowItem(e);t&&t.player?t.player.narrowZoom():this.debugWarn(this.LOG_TAG,`narrowZoom() windowIndex ${e} is not exist`)}getCurrentZoomIndex(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getCurrentZoomIndex():(this.debugWarn(this.LOG_TAG,`getCurrentZoomIndex() windowIndex ${e} is not exist`),0)}setNakedFlowFps(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setNakedFlowFps(e):this.debugWarn(this.LOG_TAG,`setNakedFlowFps() windowIndex ${t} is not exist`)}updateDebugLevel(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.updateDebugLevel(e):this.debugWarn(this.LOG_TAG,`updateDebugLevel() windowIndex ${t} is not exist`)}updateWatermark(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.updateWatermark(e):this.debugWarn(this.LOG_TAG,`updateWatermark() windowIndex ${t} is not exist`)}removeWatermark(e){const t=this._getWindowItem(e);t&&t.player?t.player.removeWatermark():this.debugWarn(this.LOG_TAG,`removeWatermark() windowIndex ${e} is not exist`)}updateFullscreenWatermark(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.updateFullscreenWatermark(e):this.debugWarn(this.LOG_TAG,`updateFullscreenWatermark() windowIndex ${t} is not exist`)}removeFullscreenWatermark(e){const t=this._getWindowItem(e);t&&t.player?t.player.removeFullscreenWatermark():this.debugWarn(this.LOG_TAG,`removeFullscreenWatermark() windowIndex ${e} is not exist`)}faceDetectOpen(e){const t=this._getWindowItem(e);t&&t.player?t.player.faceDetectOpen():this.debugWarn(this.LOG_TAG,`faceDetectOpen() windowIndex ${e} is not exist`)}faceDetectClose(e){const t=this._getWindowItem(e);t&&t.player?t.player.faceDetectClose():this.debugWarn(this.LOG_TAG,`faceDetectClose() windowIndex ${e} is not exist`)}objectDetectOpen(e){const t=this._getWindowItem(e);t&&t.player?t.player.objectDetectOpen():this.debugWarn(this.LOG_TAG,`objectDetectOpen() windowIndex ${e} is not exist`)}objectDetectClose(e){const t=this._getWindowItem(e);t&&t.player?t.player.objectDetectClose():this.debugWarn(this.LOG_TAG,`objectDetectClose() windowIndex ${e} is not exist`)}sendWebsocketMessage(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.sendWebsocketMessage(e):this.debugWarn(this.LOG_TAG,`sendWebsocketMessage() windowIndex ${t} is not exist`)}addContentToCanvas(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.addContentToCanvas(e):this.debugWarn(this.LOG_TAG,`addContentToCanvas() windowIndex ${t} is not exist`)}clearContentToCanvas(e){const t=this._getWindowItem(e);t&&t.player?t.player.clearContentToCanvas():this.debugWarn(this.LOG_TAG,`clearContentToCanvas() windowIndex ${e} is not exist`)}setControlHtml(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setControlHtml(e):this.debugWarn(this.LOG_TAG,`setControlHtml() windowIndex ${t} is not exist`)}clearControlHtml(e){const t=this._getWindowItem(e);t&&t.player?t.player.clearControlHtml():this.debugWarn(this.LOG_TAG,`clearControlHtml() windowIndex ${e} is not exist`)}getFlvMetaData(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getFlvMetaData():(this.debugWarn(this.LOG_TAG,`getFlvMetaData() windowIndex ${e} is not exist`),null)}getExtendBtnList(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getExtendBtnList():(this.debugWarn(this.LOG_TAG,`getExtendBtnList() windowIndex ${e} is not exist`),null)}updateAiFaceDetectInterval(e,t){const i=this._getWindowItem(t);if(!i||!i.player)return this.debugWarn(this.LOG_TAG,`updateAiFaceDetectInterval() windowIndex ${t} is not exist`),null;i.player.updateAiFaceDetectInterval(e)}updateAiFaceDetectLevel(e,t){const i=this._getWindowItem(t);if(!i||!i.player)return this.debugWarn(this.LOG_TAG,`updateAiFaceDetectLevel() windowIndex ${t} is not exist`),null;i.player.updateAiFaceDetectLevel(e)}updateAiObjectDetectInterval(e,t){const i=this._getWindowItem(t);if(!i||!i.player)return this.debugWarn(this.LOG_TAG,`updateAiObjectDetectInterval() windowIndex ${t} is not exist`),null;i.player.updateAiObjectDetectInterval(e)}updateAiObjectDetectLevel(e,t){const i=this._getWindowItem(t);if(!i||!i.player)return this.debugWarn(this.LOG_TAG,`updateAiObjectDetectLevel() windowIndex ${t} is not exist`),null;i.player.updateAiObjectDetectLevel(e)}setCryptoKeyUrl(e,t){const i=this._getWindowItem(t);if(!i||!i.player)return this.debugWarn(this.LOG_TAG,`setCryptoKeyUrl() windowIndex ${t} is not exist`),null;i.player.setCryptoKeyUrl(e)}showErrorMessageTips(e,t){const i=this._getWindowItem(t);if(!i||!i.player)return this.debugWarn(this.LOG_TAG,`showErrorMessageTips() windowIndex ${t} is not exist`),null;i.player.showErrorMessageTips(e)}hideErrorMessageTips(e){const t=this._getWindowItem(e);if(!t||!t.player)return this.debugWarn(this.LOG_TAG,`hideErrorMessageTips() windowIndex ${e} is not exist`),null;t.player.hideErrorMessageTips()}destroySingle(e){return new Promise(((t,i)=>{const s=this._getWindowItem(e);s?s.player&&s.player.destroy().then((()=>{s.player=null,t()})).catch((e=>{i(e)})):(i("windowIndex is not exist"),this.debugWarn(this.LOG_TAG,`destroySingle() windowIndex ${e} is not exist`))}))}initSingle(e){return new Promise(((t,i)=>{const s=this._getWindowItem(e);if(s)if(s.player)s.player.destroy().then((()=>{s.player=null;const e=this._createPlayer(s);s.player=e,t()})).catch((e=>{i(e)}));else{const e=this._createPlayer(s);s.player=e,t()}else i("windowIndex is not exist"),this.debugWarn(this.LOG_TAG,`destroySingle() windowIndex ${e} is not exist`)}))}setFullscreenMulti(e){return new Promise(((t,i)=>{if(this.debugLog(this.LOG_TAG,"setFullscreenMulti",e),e)try{Pr.request(this.$container).then((()=>{t()})).catch((e=>{this.debugError(this.LOG_TAG,"fullscreen request inner error",e),i(e)}))}catch(e){this.debugError(this.LOG_TAG,"fullscreen request error",e),i(e)}else try{Pr.exit().then((()=>{t()})).catch((e=>{this.debugError(this.LOG_TAG,"fullscreen exit inner error",e),i(e)}))}catch(e){this.debugError(this.LOG_TAG,"fullscreen exit error",e),i(e)}}))}toggleSingleWindowContainerFullscreen(e,t){this.debugLog(this.LOG_TAG,"setSingleWindowContainerFullscreen",t);const i=this._getWindowItem(t);this.windowList.forEach((e=>{e.uuid!==i.uuid&&this._handleWindowContainerFullscreen(e.uuid,!1)})),this._handleWindowContainerFullscreen(i.uuid,e)}selectWindow(e){this.debugLog(this.LOG_TAG,"selectWindow",e),this._handleWindowSelect(e)}arrangeWindow(e){this.debugLog(this.LOG_TAG,"arrangeWindow",e),this._innerArrangeWindow(e)}_innerArrangeWindow(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return void this.debugWarn(this.LOG_TAG,`arrangeWindow() split ${e} is not valid`);if([Ls,Cs].includes(e))this._arrangeSpecialWindow(e);else{if(this._opt.split===e&&null===this.specialLayoutType&&ya(t))return void this.debugWarn(this.LOG_TAG,`arrangeWindow() split ${e} is not changed`);this.specialLayoutType=null,this._arrangeWindow(e)}}_arrangeWindow(e){(e=wo(e))<1||!ko(e)?this.debugWarn(this.LOG_TAG,`arrangeWindow() split ${e} is not valid`):(e>this._opt.maxSplit&&(e=this._opt.maxSplit),this._opt.split=e,this.currentWindowIndex=0,this._opt.draggable?this._updateWindows$2():this._updateWindows(),this._handleWindowSelect(this.currentWindowIndex))}_arrangeSpecialWindow(e){this._opt.maxSplit<=3&&e===Cs||this._opt.maxSplit<=2&&e===Ls?this.debugWarn(this.LOG_TAG,`_arrangeSpecialWindow() type ${e} is not valid because maxSplit is ${this._opt.maxSplit}`):this.specialLayoutType&&this.specialLayoutType===e?this.debugWarn(this.LOG_TAG,`_arrangeSpecialWindow() type ${e} is not changed`):(this.specialLayoutType=e,e===Ls?this._arrangeWindow(3):e===Cs?this._arrangeWindow(4):this.debugWarn(this.LOG_TAG,`_arrangeSpecialWindow() type ${e} is not valid`))}getCurrentSplit(){return this.specialLayoutType?this.specialLayoutType:this._opt.split}_getCurrentMaxSplit(){if(this.specialLayoutType){let e=0;return this.specialLayoutType===Ls?e=9:this.specialLayoutType===Cs&&(e=16),e}return this._opt.split*this._opt.split}_getCurrentMaxSplitV2(){return this.specialLayoutType?this._getSpecialMaxSplit():this._opt.split*this._opt.split}_getSpecialMaxSplit(){let e=0;return this.specialLayoutType===Ls?e=6:this.specialLayoutType===Cs&&(e=8),e}getSelectedWindowIndex(){return this.currentWindowIndex}getSelectedWindowUuid(){return this.currentWindowUuid}getWindowItem(e){let t=this._getWindowItem(e),i=this._findWindowItemIndexByUuid(t.uuid),s=null;return t&&(s={index:i,$player:t.$player,$playerContainer:t.$playerContainer,player:t.player,uuid:t.uuid}),s}getNextWindowItem(e){this.debugLog(this.LOG_TAG,"getNextWindowItem",e);let t=null,i=this._getWindowItem(e);if(i){const e=this._getWindowUuidList()||[],s=e.findIndex((e=>e===i.uuid));if(se===i.uuid));if(s>0){const i=s-1,r=this._findWindowItemByUuid(e[i]);if(r){t={index:this._findWindowItemIndexByUuid(r.uuid),$player:r.$player,$playerContainer:r.$playerContainer,player:r.player,uuid:r.uuid}}}}return t}getWindowUuidList(){return this._getWindowUuidList()||[]}isWindowItemHasInitPlayer(e){let t=!1,i=this._getWindowItem(e);return i&&i.player&&(t=!0),t}_getWindowItem(e){let t=null;const i=qo(e)&&16===e.length;return t=i||!ko(e)?this._findWindowItemByUuid(i?e:this.currentWindowUuid):this.windowList[e]||this.windowList[this.currentWindowIndex],t}_getWindowUuidList(){return this.windowList.filter(((e,t)=>te.uuid))}_findWindowItemIndex(e){return e&&e.uuid?this._findWindowItemIndexByUuid(e.uuid):null}_findWindowItemIndexByUuid(e){return this.windowList.findIndex((t=>t.uuid===e))}_findWindowItemByUuid(e){return this.windowList.find((t=>t.uuid===e))}debugLog(e){if(this._opt.debug&&this.debug){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s1?t-1:0),s=1;s1?t-1:0),s=1;s1?i-1:0),r=1;r{delete i[e]})),void delete this.e;const s=i[e],r=[];if(s&&t)for(let e=0,i=s.length;e1?i-1:0),r=1;r1?i-1:0),r=1;r1?s-1:0),o=1;o32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let i=e-this._current_word_bits_left;this._fillCurrentWord();let s=Math.min(i,this._current_word_bits_left),r=this._current_word>>>32-s;return this._current_word<<=s,this._current_word_bits_left-=s,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Mr=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Fr=Mr,Ur=Mr;function Or(e){let{profile:t,sampleRate:i,channel:s}=e;return new Uint8Array([175,0,t<<3|(14&i)>>1,(1&i)<<7|s<<3])}function Nr(e){return jr(e)&&e[1]===As}function jr(e){return e[0]>>4===wt}function Gr(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}function Wr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return 1024*t/e}const zr=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function $r(e){let t=new Uint8Array(e),i=null,s=0,r=0,o=0,a=null;if(s=r=t[0]>>>3,o=(7&t[0])<<1|t[1]>>>7,o<0||o>=zr.length)return void console.error("Flv: AAC invalid sampling frequency index!");let n=zr[o],l=(120&t[1])>>>3;if(l<0||l>=8)return void console.log("Flv: AAC invalid channel configuration");5===s&&(a=(7&t[1])<<1|t[2]>>>7,t[2]);let d=xr.navigator.userAgent.toLowerCase();return-1!==d.indexOf("firefox")?o>=6?(s=5,i=new Array(4),a=o-3):(s=2,i=new Array(2),a=o):-1!==d.indexOf("android")?(s=2,i=new Array(2),a=o):(s=5,a=o,i=new Array(4),o>=6?a=o-3:1===l&&(s=2,i=new Array(2),a=o)),i[0]=s<<3,i[0]|=(15&o)>>>1,i[1]=(15&o)<<7,i[1]|=(15&l)<<3,5===s&&(i[1]|=(15&a)>>>1,i[2]=(1&a)<<7,i[2]|=8,i[3]=0),{audioType:"aac",config:i,sampleRate:n,channelCount:l,objectType:s,codec:"mp4a.40."+s,originalCodec:"mp4a.40."+r}}class Vr{constructor(e){this.buffer=e,this.buflen=e.length,this.bufpos=0,this.bufoff=0,this.iserro=!1}read(e){let t=0,i=0;for(;e;){if(e<0||this.bufpos>=this.buflen)return this.iserro=!0,0;this.iserro=!1,i=this.bufoff+e>8?8-this.bufoff:e,t<<=i,t+=this.buffer[this.bufpos]>>8-this.bufoff-i&255>>8-i,this.bufoff+=i,e-=i,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,i=this.bufoff,s=this.read(e);return this.bufpos=t,this.bufoff=i,s}read_golomb(){let e;for(e=0;0==this.read(1)&&!this.iserro;e++);return(1<=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(4095===(i[t+0]<<8|i[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let i=this.current_syncword_offset_,s=(8&e[i+1])>>>3,r=(6&e[i+1])>>>1,o=1&e[i+1],a=(192&e[i+2])>>>6,n=(60&e[i+2])>>>2,l=(1&e[i+2])<<2|(192&e[i+3])>>>6,d=(3&e[i+3])<<11|e[i+4]<<3|(224&e[i+5])>>>5;if(e[i+6],i+d>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let h=1===o?7:9,c=d-h;i+=h;let u=this.findNextSyncwordOffset(i+c);if(this.current_syncword_offset_=u,0!==s&&1!==s||0!==r)continue;let p=e.subarray(i,i+c);t={},t.audio_object_type=a+1,t.sampling_freq_index=n,t.sampling_frequency=Fr[n],t.channel_config=l,t.data=p}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Qr{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,i=this.data_;for(;;){if(t+1>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(695===(i[t+0]<<3|i[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),i=0;for(let s=0;s<=t;s++)i<<=8,i|=e.readByte();return i}readNextAACFrame(e){let t=this.data_,i=null;for(;null==i&&!this.eof_flag_;){let s=this.current_syncword_offset_,r=(31&t[s+1])<<8|t[s+2];if(s+3+r>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let o=new Br(t.subarray(s+3,s+3+r)),a=null;if(o.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(s+3+r),o.destroy();continue}a=e}else{let e=o.readBool();if(e&&o.readBool()){console.error("audioMuxVersionA is Not Supported"),o.destroy();break}if(e&&this.getLATMValue(o),!o.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),o.destroy();break}if(0!==o.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),o.destroy();break}if(0!==o.readBits(4)){console.error("more than 2 numProgram Not Supported"),o.destroy();break}if(0!==o.readBits(3)){console.error("more than 2 numLayer Not Supported"),o.destroy();break}let t=e?this.getLATMValue(o):0,i=o.readBits(5);t-=5;let s=o.readBits(4);t-=4;let r=o.readBits(4);t-=4,o.readBits(3),t-=3,t>0&&o.readBits(t);let n=o.readBits(3);if(0!==n){console.error(`frameLengthType = ${n}. Only frameLengthType = 0 Supported`),o.destroy();break}o.readByte();let l=o.readBool();if(l)if(e)this.getLATMValue(o);else{let e=0;for(;;){e<<=8;let t=o.readBool();if(e+=o.readByte(),!t)break}console.log(e)}o.readBool()&&o.readByte(),a={},a.audio_object_type=i,a.sampling_freq_index=s,a.sampling_frequency=Fr[a.sampling_freq_index],a.channel_config=r,a.other_data_present=l}let n=0;for(;;){let e=o.readByte();if(n+=e,255!==e)break}let l=new Uint8Array(n);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function Zr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return[];const i=e.length,s=[];let r,o=0;for(;o+t>>=8),o+=t,r){if(o+r>i)break;s.push(e.subarray(o,o+r)),o+=r}return s}function eo(e){const t=e.byteLength,i=new Uint8Array(4);i[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t;const s=new Uint8Array(t+4);return s.set(i,0),s.set(e,4),s}function to(){}function io(e){let t=null;const i=["webgl","experimental-webgl","moz-webgl","webkit-3d"];let s=0;for(;!t&&s0&&void 0!==arguments[0]?arguments[0]:"";const t=e.split(","),i=atob(t[1]),s=t[0].replace("data:","").replace(";base64","");let r=i.length,o=new Uint8Array(r);for(;r--;)o[r]=i.charCodeAt(r);return new File([o],"file",{type:s})}function oo(){return(new Date).getTime()}function ao(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}function no(e,t,i){if(e)return"object"==typeof t&&Object.keys(t).forEach((i=>{no(e,i,t[i])})),e.style[t]=i,e}function lo(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return 0;const s=getComputedStyle(e,null).getPropertyValue(t);return i?parseFloat(s):s}function ho(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function co(e){let t=0,i=ho();return s=>{if(!Lo(s))return;t+=s;const r=ho(),o=r-i;o>=1e3&&(e(t/o*1e3),i=r,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();const uo='"8-16-2024"',po=!1;function fo(){return/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase())}function mo(){return!(fo()||/ipad|android(?!.*mobile)|tablet|kindle|silk/i.test(window.navigator.userAgent.toLowerCase()))}function go(){const e=window.navigator.userAgent.toLowerCase();return/android/i.test(e)}function yo(){const e=window.navigator.userAgent.toLowerCase();return/firefox/i.test(e)}function Ao(){const e=window.navigator.userAgent.toLowerCase()||"",t={type:"",version:""},i={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:e.indexOf("chrome")>-1&&e.indexOf("safari")>-1,Firefox:e.indexOf("firefox")>-1,Opera:e.indexOf("opera")>-1,Safari:e.indexOf("safari")>-1&&-1==e.indexOf("chrome"),Edge:e.indexOf("edge")>-1,QQBrowser:/qqbrowser/.test(e),WeixinBrowser:/MicroMessenger/i.test(e)};for(let s in i)if(i[s]){let i="";if("IE"===s){const t=e.match(/(msie\s|trident.*rv:)([\w.]+)/);t&&t.length>2&&(i=e.match(/(msie\s|trident.*rv:)([\w.]+)/)[2])}else if("Chrome"===s){for(let e in navigator.mimeTypes)"application/360softmgrplugin"===navigator.mimeTypes[e].type&&(s="360");const t=e.match(/chrome\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Firefox"===s){const t=e.match(/firefox\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Opera"===s){const t=e.match(/opera\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Safari"===s){const t=e.match(/version\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Edge"===s){const t=e.match(/edge\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("QQBrowser"===s){const t=e.match(/qqbrowser\/([\d.]+)/);t&&t.length>1&&(i=t[1])}t.type=s,t.version=parseInt(i)}return t}function bo(){const e=window.navigator.userAgent.toLowerCase();return e&&/iphone|ipad|ipod|ios/.test(e)}function vo(){const e=window.navigator.userAgent;return!e.match(/Chrome/gi)&&!!e.match(/Safari/gi)}function _o(e,t){if(0===arguments.length)return null;var i,s=t||"{y}-{m}-{d} {h}:{i}:{s}";"object"==typeof e?i=e:(10===(""+e).length&&(e=1e3*parseInt(e)),e=+e,i=new Date(e));var r={y:i.getFullYear(),m:i.getMonth()+1,d:i.getDate(),h:i.getHours(),i:i.getMinutes(),s:i.getSeconds(),a:i.getDay()},o=s.replace(/{(y|m|d|h|i|s|a)+}/g,((e,t)=>{var i=r[t];return"a"===t?["一","二","三","四","五","六","日"][i-1]:(e.length>0&&i<10&&(i="0"+i),i||0)}));return o}function wo(){return"VideoFrame"in window}function So(e){if("string"!=typeof e)return e;var t=Number(e);return isNaN(t)?e:t}function Eo(){return"xxxxxxxxxxxx4xxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}function To(e,t){let i,s,r=!1;return function o(){for(var a=arguments.length,n=new Array(a),l=0;l{r=!1,i&&(o.apply(s,i),i=null,s=null)}),t)}}function ko(e){if(null==e||""==e)return"0 Bytes";const t=new Array("Bytes","KB","MB","GB","TB","PB","EB","ZB","YB");let i=0;const s=parseFloat(e);i=Math.floor(Math.log(s)/Math.log(1024));var r=s/Math.pow(1024,i);return(r=r.toFixed(2))+t[i]}function Lo(e){return"[object Number]"===Object.prototype.toString.call(e)}function Co(){let e=!1;return"MediaSource"in xr&&xr.MediaSource&&(xr.MediaSource.isTypeSupported(pi)||xr.MediaSource.isTypeSupported(fi)||xr.MediaSource.isTypeSupported(mi)||xr.MediaSource.isTypeSupported(gi)||xr.MediaSource.isTypeSupported(yi))&&(e=!0),e}function xo(){const e=Ao();return"chrome"===e.type.toLowerCase()&&e.version>=107}function Do(){let e=!1;return"MediaStreamTrackGenerator"in window&&(e=!0),e}function Ro(){let e=!1;return"MediaStream"in window&&(e=!0),e}function Po(e,t){let i=window.URL.createObjectURL(t),s=window.document.createElement("a");s.download=e,s.href=i;let r=window.document.createEvent("MouseEvents");r.initEvent("click",!0,!0),s.dispatchEvent(r),setTimeout((()=>{window.URL.revokeObjectURL(i)}),bo()?1e3:0)}function Io(e){return null==e}function Bo(e){return!0===e||!1===e}function Mo(e){return!Io(e)}function Fo(e){let t={left:"",right:"",top:"",bottom:"",opacity:1,backgroundColor:"",image:{src:"",width:"100",height:"60"},text:{content:"",fontSize:"14",color:"#000",width:"",height:""},rect:{color:"green",lineWidth:2,width:"",height:"",fill:"",fillOpacity:.2},line:{x1:"",y1:"",x2:"",y2:"",color:"green",lineWidth:2},polygon:{color:"green",lineWidth:2,list:[],fill:"",fillOpacity:.2},html:""};const i=Object.assign(t.image,e.image||{}),s=Object.assign(t.text,e.text||{}),r=Object.assign(t.rect,e.rect||{}),o=Object.assign(t.line,e.line||{});return t=Object.assign(t,e,{image:i,text:s,rect:r,line:o}),t}function Uo(e,t){let i={container:e||"",text:"",opacity:"",angle:"",color:"",fontSize:"",fontFamily:""};return i=Object.assign(i,t),{watermark_parent_node:i.container,watermark_alpha:i.opacity,watermark_angle:i.angle,watermark_fontsize:i.fontSize,watermark_color:i.color,watermark_font:i.fontFamily,watermark_txt:i.text}}function Oo(e,t){return new Promise(((i,s)=>{let r=Fo(t);if(!r.image.src&&!r.text.content)return i(e);let o=document.createElement("canvas");o.width=t.width,o.height=t.height;let a=o.getContext("2d");a.imageSmoothingEnabled=!0,a.imageSmoothingEnabled&&(a.imageSmoothingQuality="high");let n=0,l=0;Lo(r.left)?n=r.left:Lo(r.right)&&(n=o.width-r.right),Lo(r.top)?l=r.top:Lo(r.bottom)&&(l=o.height-r.bottom);const d=new Image;d.src=e,d.onload=()=>{if(a.drawImage(d,0,0),r.image&&r.image.src){const e=new Image;e.src=r.image.src,e.setAttribute("crossOrigin","Anonymous"),e.onload=()=>{n-=r.image.width,a.drawImage(e,n,l,r.image.width,r.image.height),i(o.toDataURL(t.format,t.quality))},e.onerror=e=>{s()}}else r.text&&r.text.content&&(a.font=r.text.fontSize+"px 宋体",a.fillStyle=r.text.color,a.textAlign="right",a.fillText(r.text.content,n,l),i(o.toDataURL(t.format,t.quality)))},d.onerror=e=>{s(e)}}))}function No(e){var t,i=0;if(0===e.length)return i;for(t=0;t{if(!t.copyright)return i(e);let r=document.createElement("canvas");r.width=t.width,r.height=t.height;let o=r.getContext("2d");o.imageSmoothingEnabled=!0,o.imageSmoothingEnabled&&(o.imageSmoothingQuality="high");const a=new Image;a.src=e,a.onload=()=>{o.drawImage(a,0,0);const e=No(t.copyright),s=o.getImageData(0,0,r.width,r.height);!function(e,t){for(var i=e.data,s=0,r=0;r<32;r++){var o=t>>r&1,a=254&i[s]|o;i[s]=a,s+=4}}(s,e),o.putImageData(s,0,0),i(r.toDataURL(t.format,t.quality))},a.onerror=e=>{s(e)}}))}function Go(e){var t;if(e>-1){var i=Math.floor(e/3600),s=Math.floor(e/60)%60,r=e%60;t=i<10?"0"+i+":":i+":",s<10&&(t+="0"),t+=s+":",(r=Math.round(r))<10&&(t+="0"),t+=r.toFixed(0)}return t}function Wo(e,t){let i="";if(e>-1){const s=Math.floor(e/60)%60;let r=e%60;r=Math.round(r),i=s<10?"0"+s+":":s+":",r<10&&(i+="0"),i+=r,Io(t)||(t<10&&(t="0"+t),i+=":"+t)}return i}function zo(e){let t="";if(e>-1){const i=Math.floor(e/60/60)%60;let s=Math.floor(e/60)%60,r=e%60;s=Math.round(s),t=i<10?"0"+i+":":i+":",s<10&&(t+="0"),t+=s+":",r<10&&(t+="0"),t+=r}return t}function $o(e,t){const i=Math.floor(t/60)%60,s=Math.floor(t%60);return new Date(e).setHours(i,s,0,0)}function Vo(e,t){const i=Math.floor(t/60/60)%60,s=Math.floor(t/60)%60,r=t%60;return new Date(e).setHours(i,s,r,0)}function Ho(e){return(""+e).length}function Jo(e){return e&&0===Object.keys(e).length}function qo(e){return!Jo(e)}function Ko(e){return"string"==typeof e}const Yo=()=>{const e=window.navigator.userAgent;return/MicroMessenger/i.test(e)},Qo=()=>{const e=window.navigator.userAgent;return/Chrome/i.test(e)};function Xo(e){const t=e||window.event;return t.target||t.srcElement}function Zo(){return yo()&&function(){const e=navigator.userAgent.toLowerCase();return/macintosh|mac os x/i.test(e)}()}function ea(e){return"function"==typeof e}function ta(e){if(fo()){let t=0,i=0;if(1===e.touches.length){let s=e.touches[0];t=s.clientX,i=s.clientY}return{posX:t,posY:i}}let t=0,i=0;const s=e||window.event;return s.pageX||s.pageY?(t=s.pageX,i=s.pageY):(s.clientX||s.clientY)&&(t=e.clientX+document.documentElement.scrollLeft+document.body.scrollLeft,i=e.clientY+document.documentElement.scrollTop+document.body.scrollTop),{posX:t,posY:i}}function ia(){let e=document.createElement("video"),t=e.canPlayType("application/vnd.apple.mpegurl");return e=null,t}function sa(e){let t=Aa(e.hasAudio)&&(e.useMSE||e.useWCS&&!e.useOffscreen)&&Aa(e.demuxUseWorker);return!!(Aa(t)&&e.useMSE&&e.mseDecodeAudio&&Aa(e.demuxUseWorker))||(!!(Aa(t)&&e.useWCS&&e.wcsDecodeAudio)||t)}function ra(e){let t=null,i=31&e[0];return i!==Lt&&i!==Ct||(t=vt),t||(i=(126&e[0])>>1,i!==Wt&&i!==$t&&i!==Ht||(t=_t)),t}function oa(e){e.close()}function aa(e){e.close()}function na(){return"https:"===window.location.protocol||"localhost"===window.location.hostname}function la(e){const t=Object.prototype.toString;return function(e){switch(t.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:try{return e instanceof Error}catch(e){return!1}}}(e)?e.message:null==e?"":"object"==typeof e?JSON.stringify(e,null,2):String(e)}function da(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let i=e[0],s=null,r=1;if(e.length>0){let t=e[1];t&&t.ts-i.ts>1e5&&(i=t,r=2)}if(i)for(let o=r;o=1e3){e[o-1].ts-i.ts<1e3&&(s=o+1)}}}return s}function ha(e){for(var t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),i=window.atob(t),s=new Uint8Array(i.length),r=0;r>4===bs&&e[1]===As}function ya(e){return!0===e||"true"===e}function Aa(e){return!0!==e&&"true"!==e}function ba(e,t,i){e&&(e.dataset?e.dataset[t]=i:e.setAttribute("data-"+t,i))}function va(e,t){return e?e.dataset?e.dataset[t]:e.getAttribute("data-"+t):""}function _a(e){return e.replace(/-([a-z])/g,(function(e,t){return t.toUpperCase()}))}function wa(){return/iphone/i.test(navigator.userAgent)}function Sa(){return window.performance&&window.performance.memory?window.performance.memory:null}function Ea(){try{var e=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!e.getContext("webgl2"))}catch(e){return!1}}function Ta(e){return e.trim().match(/^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/)[1]}function ka(){let e=!1;return"requestVideoFrameCallback"in HTMLVideoElement.prototype&&(e=!0),e}function La(){let e=!1;return"PressureObserver"in window&&(e=!0),e}function Ca(e,t){const i=Zr(e.slice(5));let s=!1;return i.forEach((e=>{const i=t?e[0]>>>1&63:31&e[0];(t&&(i===Ft||i===Ot||i===jt)||Aa(t)&&i===xt)&&(s=!0)})),s}function xa(){let e={down:"mousedown",move:"mousemove",up:"mouseup",click:"click"};return fo()&&(e={down:"touchstart",move:"touchmove",up:"touchend",click:"click"}),e}class Da{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,i,s)));e.addEventListener(t,i,s);const r=()=>{ea(e.removeEventListener)&&e.removeEventListener(t,i,s)};return this.destroys.push(r),r}destroy(){this.master.debugLog("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}var Ra=1e-6,Pa="undefined"!=typeof Float32Array?Float32Array:Array;function Ia(){var e=new Pa(16);return Pa!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function Ba(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Ma,Fa=function(e,t,i,s,r,o,a){var n=1/(t-i),l=1/(s-r),d=1/(o-a);return e[0]=-2*n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*d,e[11]=0,e[12]=(t+i)*n,e[13]=(r+s)*l,e[14]=(a+o)*d,e[15]=1,e};function Ua(e,t,i){var s=new Pa(3);return s[0]=e,s[1]=t,s[2]=i,s}Ma=new Pa(3),Pa!=Float32Array&&(Ma[0]=0,Ma[1]=0,Ma[2]=0);class Oa{constructor(e,t){this.gl=e,t&&this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1);const i=this._initShaderProgram();this._programInfo={program:i,attribLocations:{vertexPosition:e.getAttribLocation(i,"aVertexPosition"),texturePosition:e.getAttribLocation(i,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(i,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(i,"uModelMatrix"),viewMatrix:e.getUniformLocation(i,"uViewMatrix"),rgbatexture:e.getUniformLocation(i,"rgbaTexture"),ytexture:e.getUniformLocation(i,"yTexture"),utexture:e.getUniformLocation(i,"uTexture"),vtexture:e.getUniformLocation(i,"vTexture"),isyuv:e.getUniformLocation(i,"isyuv")}},this._buffers=this._initBuffers(),this._rgbatexture=this._createTexture(),this._ytexture=this._createTexture(),this._utexture=this._createTexture(),this._vtexture=this._createTexture()}destroy(){this.gl.deleteProgram(this._programInfo.program),this.gl.deleteBuffer(this._buffers.position),this.gl.deleteBuffer(this._buffers.texPosition),this.gl.deleteBuffer(this._buffers.indices),this.gl.deleteTexture(this._rgbatexture),this.gl.deleteTexture(this._ytexture),this.gl.deleteTexture(this._utexture),this.gl.deleteTexture(this._vtexture),this._programInfo=null,this._buffers=null,this._rgbatexture=null,this._ytexture=null,this._utexture=null,this._vtexture=null}_initShaderProgram(){const e=this._loadShader(this.gl.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),t=this._loadShader(this.gl.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=this.gl.createProgram();return this.gl.attachShader(i,e),this.gl.attachShader(i,t),this.gl.linkProgram(i),this.gl.getProgramParameter(i,this.gl.LINK_STATUS)?i:(console.log("Unable to initialize the shader program: "+this.gl.getProgramInfoLog(i)),null)}_loadShader(e,t){const i=this.gl,s=i.createShader(e);return i.shaderSource(s,t),i.compileShader(s),i.getShaderParameter(s,i.COMPILE_STATUS)?s:(console.log("An error occurred compiling the shaders: "+i.getShaderInfoLog(s)),i.deleteShader(s),null)}_initBuffers(){const e=this.gl,t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);const i=[-1,-1,1,-1,1,1,-1,1];e.bufferData(e.ARRAY_BUFFER,new Float32Array(i),e.STATIC_DRAW);var s=[];s=s.concat([0,1],[1,1],[1,0],[0,0]);const r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array(s),e.STATIC_DRAW);const o=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{positions:i,position:t,texPosition:r,indices:o}}_createTexture(){let e=this.gl.createTexture();return this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),e}_drawScene(e,t,i){this.gl.viewport(0,0,e,t),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._buffers.position),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array(this._buffers.positions),this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this._programInfo.attribLocations.vertexPosition,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this._programInfo.attribLocations.vertexPosition),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._buffers.texPosition),this.gl.vertexAttribPointer(this._programInfo.attribLocations.texturePosition,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this._programInfo.attribLocations.texturePosition),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this._buffers.indices);i?(this.gl.activeTexture(this.gl.TEXTURE0+3),this.gl.bindTexture(this.gl.TEXTURE_2D,this._ytexture),this.gl.activeTexture(this.gl.TEXTURE0+4),this.gl.bindTexture(this.gl.TEXTURE_2D,this._utexture),this.gl.activeTexture(this.gl.TEXTURE0+5),this.gl.bindTexture(this.gl.TEXTURE_2D,this._vtexture)):(this.gl.activeTexture(this.gl.TEXTURE0+2),this.gl.bindTexture(this.gl.TEXTURE_2D,this._rgbatexture)),this.gl.useProgram(this._programInfo.program),this.gl.uniform1i(this._programInfo.uniformLocations.rgbatexture,2),this.gl.uniform1i(this._programInfo.uniformLocations.ytexture,3),this.gl.uniform1i(this._programInfo.uniformLocations.utexture,4),this.gl.uniform1i(this._programInfo.uniformLocations.vtexture,5),this.gl.uniform1i(this._programInfo.uniformLocations.isyuv,i?1:0),this.gl.drawElements(this.gl.TRIANGLES,6,this.gl.UNSIGNED_SHORT,0)}_calRect(e,t,i,s,r,o){let a=2*e/r-1,n=2*(o-t-s)/o-1,l=2*(e+i)/r-1,d=2*(o-t)/o-1;return[a,n,l,n,l,d,a,d]}_clear(){this.gl.clearColor(0,0,0,1),this.gl.clearDepth(1),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}render(e,t,i,s,r){const o=this.gl;this._clear(),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,this._ytexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e,t,0,o.LUMINANCE,o.UNSIGNED_BYTE,i),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,this._utexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e/2,t/2,0,o.LUMINANCE,o.UNSIGNED_BYTE,s),o.activeTexture(o.TEXTURE2),o.bindTexture(o.TEXTURE_2D,this._vtexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e/2,t/2,0,o.LUMINANCE,o.UNSIGNED_BYTE,r),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}renderYUV(e,t,i){let s=i.slice(0,e*t),r=i.slice(e*t,e*t*5/4),o=i.slice(e*t*5/4,e*t*3/2);const a=this.gl;this._clear(),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this._ytexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e,t,0,a.LUMINANCE,a.UNSIGNED_BYTE,s),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,this._utexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,r),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,this._vtexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,o),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}drawDom(e,t,i,s,r){const o=this.gl;o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,this._rgbatexture),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,r),this._buffers.positions=this._calRect(i,s,r.width,r.height,e,t),this._drawScene(e,t,!1)}}const Na=1,ja=2,Ga=4;class Wa{constructor(e){this.gpu=e,this.pipeline=null,this.matrixGroupInfo=null,this.depthTexture=null,this.textureGroupInfo=null,this.hasInited=!1,this.buffers=this._initBuffer(),this.isDestroyed=!1,this._initPipeline().then((e=>{this.isDestroyed||(this.pipeline=e,this.matrixGroupInfo=this._initMatrixGroupInfo(),this.matrixGroupInfo&&(this.hasInited=!0))}))}destroy(){this.isDestroyed=!1,this.gpu&&(this.gpu.device.destroy(),this.gpu=null),this.hasInited=!1,this.pipeline=null,this.matrixGroupInfo=null,this.depthTexture=null,this.textureGroupInfo=null}_initBuffer(){const e=this.gpu.device,t=new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),i=e.createBuffer({size:t.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST});e.queue.writeBuffer(i,0,t);const s=new Float32Array([0,1,1,1,1,0,0,0]),r=e.createBuffer({size:s.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST});e.queue.writeBuffer(r,0,s);const o=new Uint16Array([0,1,2,0,2,3]),a=e.createBuffer({size:o.byteLength,usage:window.GPUBufferUsage.INDEX|window.GPUBufferUsage.COPY_DST});return e.queue.writeBuffer(a,0,o),{positionBuffer:i,texpositionBuffer:r,indexBuffer:a}}_initPipeline(){return new Promise(((e,t)=>{const i=this.gpu.device,s=this.gpu.format,r={layout:"auto",vertex:{module:i.createShaderModule({code:"\n\n @binding(0) @group(0) var uModelMatrix : mat4x4;\n @binding(1) @group(0) var uViewMatrix : mat4x4;\n @binding(2) @group(0) var uProjectionMatrix : mat4x4;\n\n struct VertexOutput {\n @builtin(position) Position : vec4,\n @location(0) vTexturePosition : vec2,\n }\n\n @vertex\n fn main(\n @location(0) aVertexPosition : vec4,\n @location(1) aTexturePosition : vec2\n ) -> VertexOutput {\n var output : VertexOutput;\n var tmppos : vec4 = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n output.Position = vec4(tmppos.x, tmppos.y, (tmppos.z+1.)/2., tmppos.w); // webgl z [-1, 1], webgpu z [0, 1], 这里z做下调整 z-webgpu = (z-webgl+1)/2\n output.vTexturePosition = aTexturePosition;\n return output;\n }\n\n "}),entryPoint:"main",buffers:[{arrayStride:12,attributes:[{shaderLocation:0,offset:0,format:"float32x3"}]},{arrayStride:8,attributes:[{shaderLocation:1,offset:0,format:"float32x2"}]}]},primitive:{topology:"triangle-list"},fragment:{module:i.createShaderModule({code:"\n @group(1) @binding(0) var mySampler: sampler;\n @group(1) @binding(1) var pixelType: i32;\n @group(1) @binding(2) var yTexture: texture_2d;\n @group(1) @binding(3) var uTexture: texture_2d;\n @group(1) @binding(4) var vTexture: texture_2d;\n @group(1) @binding(5) var uvTexture: texture_2d;\n @group(1) @binding(6) var rgbaTexture: texture_2d;\n\n const YUV2RGB : mat4x4 = mat4x4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n @fragment\n fn main(\n @location(0) vTexturePosition: vec2\n ) -> @location(0) vec4 {\n if(pixelType == 1){\n var y : f32= textureSample(yTexture, mySampler, vTexturePosition).r;\n var u : f32 = textureSample(uTexture, mySampler, vTexturePosition).r;\n var v : f32 = textureSample(vTexture, mySampler, vTexturePosition).r;\n\n return vec4(y, u, v, 1.0)*YUV2RGB;\n } else if (pixelType == 2) {\n\n var y : f32= textureSample(yTexture, mySampler, vTexturePosition).r;\n var u : f32 = textureSample(uvTexture, mySampler, vTexturePosition).r;\n var v : f32 = textureSample(uvTexture, mySampler, vTexturePosition).g;\n\n return vec4(y, u, v, 1.0)*YUV2RGB;\n } else {\n\n return textureSample(rgbaTexture, mySampler, vTexturePosition);\n }\n\n }\n\n "}),entryPoint:"main",targets:[{format:s}]},depthStencil:{depthWriteEnabled:!0,depthCompare:"less",format:"depth24plus"}};i.createRenderPipelineAsync(r).then((t=>{e(t)})).catch((e=>{t(e)}))}))}_initMatrixGroupInfo(){if(!this.gpu)return null;const e=this.gpu.device,t=this.pipeline,i=Ia();Fa(i,-1,1,-1,1,.1,100);const s=Ia();Ba(s);const r=Ia();!function(e,t,i,s){var r,o,a,n,l,d,h,c,u,p,f=t[0],m=t[1],g=t[2],y=s[0],A=s[1],b=s[2],v=i[0],_=i[1],w=i[2];Math.abs(f-v)Fo(e)));this.configList=i,this._updateDom()}_resizeDomForVideo(){const e=this.player.width,t=this.player.height,i=this.player.getVideoInfo();if(!(i&&i.height>0&&i.width>0))return;let s=i.width,r=i.height;const o=this.player._opt;let a=t,n=e;if(this.player.isControlBarShow()){const e=o.playType===w?Xt:Qt;fo()&&this.player.fullscreen&&o.useWebFullScreen?n-=e:a-=e}const l=o.rotate;let d=(n-s)/2,h=(a-r)/2;270!==l&&90!==l||(s=i.height,r=i.width);const c=n/s,u=a/r;let p=c>u?u:c;o.isResize||c!==u&&(p=c+","+u),o.isFullResize&&(p=c>u?c:u);let f="scale("+p+")";"none"===o.mirrorRotate&&l&&(f+=" rotate("+l+"deg)"),"level"===o.mirrorRotate?f+=" rotateY(180deg)":"vertical"===o.mirrorRotate&&(f+=" rotateX(180deg)"),this.scale=-1!==(""+p).indexOf(",")?c:p,this.shadowRootInnerDom.style.transform=f,this.shadowRootInnerDom.style.left=d+"px",this.shadowRootInnerDom.style.top=h+"px",this.shadowRootInnerDom.style.width=i.width+"px",this.shadowRootInnerDom.style.height=i.height+"px",this.shadowRootInnerDom.style.display="block"}_resizeDomForCanvas(){const e=this.player.getVideoInfo();if(!(e&&e.height>0&&e.width>0))return;const t=this.player._opt;let i=this.player.width,s=this.player.height;if(this.player.isControlBarShow()){const e=t.playType===w?Xt:Qt;fo()&&this.player.fullscreen&&t.useWebFullScreen?i-=e:s-=e}let r=e.width,o=e.height;const a=t.rotate;let n=(i-r)/2,l=(s-o)/2;270!==a&&90!==a||(r=e.height,o=e.width);const d=i/r,h=s/o;let c=d>h?h:d;t.isResize||d!==h&&(c=d+","+h),t.isFullResize&&(c=d>h?d:h);let u="scale("+c+")";"none"===t.mirrorRotate&&a&&(u+=" rotate("+a+"deg)"),"level"===t.mirrorRotate?u+=" rotateY(180deg)":"vertical"===t.mirrorRotate&&(u+=" rotateX(180deg)"),this.shadowRootInnerDom.style.height=e.height+"px",this.shadowRootInnerDom.style.width=e.width+"px",this.shadowRootInnerDom.style.padding="0",this.shadowRootInnerDom.style.transform=u,this.shadowRootInnerDom.style.left=n+"px",this.shadowRootInnerDom.style.top=l+"px",this.shadowRootInnerDom.style.display="block"}_resizeDomRatio(){const e=this.player.getVideoInfo();if(!(e&&e.height>0&&e.width>0))return;const t=this.player._opt.aspectRatio.split(":").map(Number);let i=this.player.width,s=this.player.height;const r=this.player._opt;let o=0;this.player.isControlBarShow()&&(o=r.playType===w?Xt:Qt,s-=o);const a=e.width/e.height,n=t[0]/t[1];if(a>n){const t=n*e.height/e.width;this.shadowRootInnerDom.style.width=100*t+"%",this.shadowRootInnerDom.style.height=`calc(100% - ${o}px)`,this.shadowRootInnerDom.style.padding=`0 ${(i-i*t)/2}px`}else{const t=e.width/n/e.height;this.shadowRootInnerDom.style.width="100%",this.shadowRootInnerDom.style.height=`calc(${100*t}% - ${o}px)`,this.shadowRootInnerDom.style.padding=(s-s*t)/2+"px 0"}this.shadowRootInnerDom.style.display="block"}_updateDom(){this.shadowRoot&&this.configList.forEach((e=>{const t=document.createElement("div");let i=null;if(e.image&&e.image.src?(i=document.createElement("img"),i.style.height="100%",i.style.width="100%",i.style.objectFit="contain",i.src=e.image.src):e.text&&e.text.content?i=document.createTextNode(e.text.content):(e.rect&&e.rect.color&&e.rect.width||e.html||e.line&&e.line.x1&&e.line.y1&&e.line.x2&&e.line.y2||e.polygon&&e.polygon.list&&e.polygon.list.length>=3)&&(i=document.createElement("div")),i){if(t.appendChild(i),t.style.visibility="",t.style.position="absolute",t.style.display="block",t.style["-ms-user-select"]="none",t.style["-moz-user-select"]="none",t.style["-webkit-user-select"]="none",t.style["-o-user-select"]="none",t.style["user-select"]="none",t.style["-webkit-touch-callout"]="none",t.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",t.style["-webkit-text-size-adjust"]="none",t.style["-webkit-touch-callout"]="none",t.style.opacity=e.opacity,Mo(e.left)&&(Lo(e.left)?t.style.left=e.left+"px":t.style.left=e.left),Mo(e.right)&&(Lo(e.right)?t.style.right=e.right+"px":t.style.right=e.right),Mo(e.top)&&(Lo(e.top)?t.style.top=e.top+"px":t.style.top=e.top),Mo(e.bottom)&&(Lo(e.bottom)?t.style.bottom=e.bottom+"px":t.style.bottom=e.bottom),e.backgroundColor&&(t.style.backgroundColor=e.backgroundColor),t.style.overflow="hidden",t.style.zIndex="9999999",e.image&&e.image.src)t.style.width=e.image.width+"px",t.style.height=e.image.height+"px";else if(e.text&&e.text.content)t.style.fontSize=e.text.fontSize+"px",t.style.color=e.text.color,e.text.width&&(t.style.width=e.text.width+"px"),e.text.height&&(t.style.height=e.text.height+"px");else if(e.rect&&e.rect.color&&e.rect.width){if(t.style.width=e.rect.width+"px",t.style.height=e.rect.height+"px",t.style.borderWidth=e.rect.lineWidth+"px",t.style.borderStyle="solid",t.style.borderColor=e.rect.color,e.rect.fill){const i=document.createElement("div");i.style.position="absolute",i.style.width="100%",i.style.height="100%",i.style.backgroundColor=e.rect.fill,e.rect.fillOpacity&&(i.style.opacity=e.rect.fillOpacity),t.appendChild(i)}}else if(e.html)t.style.width="100%",t.style.height="100%",t.innerHTML=e.html;else if(e.line&&e.line.x1&&e.line.y1&&e.line.x2&&e.line.y2)this.settingLine(t,e.line);else if(e.polygon&&e.polygon.list&&e.polygon.list.length>=3){t.style.width="100%",t.style.height="100%";let i=e.polygon.list;const s=e.polygon.color,r=e.polygon.lineWidth;if(i=i.sort(((e,t)=>(e.index||0)-(t.index||0))),e.polygon.fill){const s=document.createElement("div");s.style.position="absolute",s.style.width="100%",s.style.height="100%";const r="polygon("+i.map((e=>`${e.x}px ${e.y}px`)).join(", ")+")";s.style.clipPath=r,s.style.backgroundColor=e.polygon.fill,e.polygon.fillOpacity&&(s.style.opacity=e.polygon.fillOpacity),t.appendChild(s)}i.forEach(((e,o)=>{const a=document.createElement("div");if(o===i.length-1){const o=i[0],n={x1:e.x,y1:e.y,x2:o.x,y2:o.y,color:s,lineWidth:r};return this.settingLine(a,n),void t.appendChild(a)}const n=i[o+1],l={x1:e.x,y1:e.y,x2:n.x,y2:n.y,color:s,lineWidth:r};this.settingLine(a,l),t.appendChild(a)}))}this.isDynamic&&(this.shadowRootDynamicDom=t),this.shadowRootInnerDom.appendChild(t)}}))}settingLine(e,t){const i=t.x1,s=t.y1,r=t.x2,o=t.y2;var a=Math.sqrt((i-r)**2+(s-o)**2),n=180*Math.atan2(o-s,r-i)/Math.PI;e.style.backgroundColor=t.color,e.style.width=a+"px",e.style.height=t.lineWidth+"px",e.style.position="absolute",e.style.top=s+"px",e.style.left=i+"px",e.style.transform="rotate("+n+"deg)",e.style.transformOrigin="0 0"}remove(){this._removeDom()}_removeDom(){this.shadowRootInnerDom&&(this.shadowRootInnerDom.innerHTML="")}}class $a extends o{constructor(){super(),this.videoInfo={width:null,height:null,encType:null,encTypeCode:null},this.init=!1,this.prevAiFaceDetectTime=null,this.prevAiObjectDetectTime=null,this.prevOcclusionDetectTime=null,this.contentWatermark=null,this.aiContentWatermark=null,this.tempContentList=[],this.tempAiContentList=[],this.streamFps=0}destroy(){this.resetInit(),this.contentWatermark&&(this.contentWatermark.destroy(),this.contentWatermark=null),this.tempContentList=[],this.aiContentWatermark&&(this.aiContentWatermark.destroy(),this.aiContentWatermark=null),this.tempAiContentList=[],this.prevAiFaceDetectTime=null,this.prevAiObjectDetectTime=null,this.streamFps=0,this.off()}resetInit(){this.videoInfo={width:null,height:null,encType:null,encTypeCode:null},this.init=!1}getHasInit(){return this.init}updateVideoInfo(e){Mo(e.encTypeCode)&&(this.videoInfo.encType=yt[e.encTypeCode],this.videoInfo.encTypeCode=e.encTypeCode),Mo(e.encType)&&(this.videoInfo.encType=e.encType),Mo(e.width)&&(this.videoInfo.width=e.width),Mo(e.height)&&(this.videoInfo.height=e.height),Mo(this.videoInfo.encType)&&Mo(this.videoInfo.height)&&Mo(this.videoInfo.width)&&!this.init&&(this.player.emit(at.videoInfo,this.videoInfo),this.init=!0)}getVideoInfo(){return this.videoInfo}clearView(){this.tempContentList=[],this.tempAiContentList=[]}resize(){if(this.player.debugLog("CommonVideo","resize()"),"default"===this.player._opt.aspectRatio||fo()?this._resize():this._resizeRatio(),this.contentWatermark&&this.contentWatermark.resize(),this.aiContentWatermark&&this.aiContentWatermark.resize(),this.player.singleWatermark&&this.player.singleWatermark.resize(),this.player.ghostWatermark&&this.player.ghostWatermark.resize(),this.player.dynamicWatermark&&this.player.dynamicWatermark.resize(),this.player.zoom&&this.player.zooming){const e=this._getStyleScale();this.player.zoom.updatePrevVideoElementStyleScale(e),this.player.zoom.updateVideoElementScale()}}_resizeRatio(){this.player.debugLog("CommonVideo","_resizeRatio()");const e=this.player._opt.aspectRatio.split(":").map(Number);let t=this.player.width,i=this.player.height;const s=this.player._opt;let r=0;this.player.isControlBarShow()&&(r=s.playType===w?Xt:Qt,i-=r);const o=this.videoInfo,a=o.width/o.height,n=e[0]/e[1];if(this.getType()===H&&(this.$videoElement.style.left="0",this.$videoElement.style.top="0",this.$videoElement.style.transform="none"),this.getType()===J&&this.player._opt.videoRenderSupportScale&&(this.$videoElement.style.objectFit="fill"),a>n){const e=n*o.height/o.width;this.$videoElement.style.width=100*e+"%",this.$videoElement.style.height=`calc(100% - ${r}px)`,this.$videoElement.style.padding=`0 ${(t-t*e)/2}px`}else{const e=o.width/n/o.height;this.$videoElement.style.width="100%",this.$videoElement.style.height=`calc(${100*e}% - ${r}px)`,this.$videoElement.style.padding=(i-i*e)/2+"px 0"}}play(){}pause(){}setRate(e){}getType(){return""}getCanvasType(){return""}getCurrentTime(){return 0}getStreamFps(){return this.streamFps}isPlaying(){return!0}isVideoPlaying(){return this.isPlaying()}getPlaybackQuality(){return null}setStreamFps(e){this.player.debugLog("CommonVideo","setStreamFps",e),this.streamFps=e}addContentToCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.tempContentList=e}addAiContentToCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.tempAiContentList=e}doAddContentToWatermark(){if(this.tempContentList.length>0){this.contentWatermark||(this.contentWatermark=new za(this.player),this.contentWatermark.resize());const e=[];this.tempContentList.forEach((t=>{let i={left:t.x||0,top:t.y||0};"text"===t.type?i.text={content:t.text,fontSize:t.fontSize||"14",color:t.color||"#000"}:"rect"===t.type?i.rect={width:t.width,height:t.height,color:t.color||"green",lineWidth:t.lineWidth||2,fill:t.fill||"",fillOpacity:t.fillOpacity||.2}:"polygon"===t.type?i.polygon={list:t.list,color:t.color||"green",lineWidth:t.lineWidth||2,fill:t.fill,fillOpacity:t.fillOpacity||.2}:"line"===t.type&&(i.line={color:t.color||"green",lineWidth:t.lineWidth||2,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}),e.push(i)})),this.contentWatermark.update(e)}else this.contentWatermark&&this.contentWatermark.remove()}doAddAiContentToWatermark(){if(this.tempAiContentList.length>0){this.aiContentWatermark||(this.aiContentWatermark=new za(this.player),this.aiContentWatermark.resize());const e=this.tempAiContentList.map((e=>{let t={left:e.x,top:e.y};return"text"===e.type?t.text={content:e.text,fontSize:e.fontSize,color:e.color}:"rect"===e.type&&(t.rect={width:e.width,height:e.height,color:e.color,lineWidth:e.lineWidth}),t}));this.aiContentWatermark.update(e)}else this.aiContentWatermark&&this.aiContentWatermark.remove()}_getStyleScale(){let e=this.$videoElement.style.transform.match(/scale\([0-9., ]*\)/g),t="";if(e&&e[0]){t=e[0].replace("scale(","").replace(")","").split(",")}return t}getReadyStateInited(){return!0}screenshotByCurrentWatermark(){}initCanvasViewSize(){}bindMediaStream(){}}var Va="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0;function Ha(e,t,i){var s=new XMLHttpRequest;s.open("GET",e),s.responseType="blob",s.onload=function(){Ya(s.response,t,i)},s.onerror=function(){console.error("could not download file")},s.send()}function Ja(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return t.status>=200&&t.status<=299}function qa(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(i){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var Ka=Va.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),Ya="object"!=typeof window||window!==Va?function(){}:"download"in HTMLAnchorElement.prototype&&!Ka?function(e,t,i){var s=Va.URL||Va.webkitURL,r=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",r.download=t,r.rel="noopener","string"==typeof e?(r.href=e,r.origin!==location.origin?Ja(r.href)?Ha(e,t,i):qa(r,r.target="_blank"):qa(r)):(r.href=s.createObjectURL(e),setTimeout((function(){s.revokeObjectURL(r.href)}),4e4),setTimeout((function(){qa(r)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download","string"==typeof e)if(Ja(e))Ha(e,t,i);else{var s=document.createElement("a");s.href=e,s.target="_blank",setTimeout((function(){qa(s)}))}else navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e}(e,i),t)}:function(e,t,i,s){if((s=s||open("","_blank"))&&(s.document.title=s.document.body.innerText="downloading..."),"string"==typeof e)return Ha(e,t,i);var r="application/octet-stream"===e.type,o=/constructor/i.test(Va.HTMLElement)||Va.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent);if((a||r&&o||Ka)&&"undefined"!=typeof FileReader){var n=new FileReader;n.onloadend=function(){var e=n.result;e=a?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),s?s.location.href=e:location=e,s=null},n.readAsDataURL(e)}else{var l=Va.URL||Va.webkitURL,d=l.createObjectURL(e);s?s.location=d:location.href=d,s=null,setTimeout((function(){l.revokeObjectURL(d)}),4e4)}};function Qa(e){return new Promise(((t,i)=>{navigator.gpu?navigator.gpu.requestAdapter().then((s=>{s?s.requestDevice().then((r=>{if(r){const o=e.getContext("webgpu");if(o){const e=navigator.gpu.getPreferredCanvasFormat();o.configure({device:r,format:e,alphaMode:"opaque"}),t({adapter:s,device:r,context:o,format:e})}else i('WebGPU "context" create fail')}else i('WebGPU "device" request fail')})).catch((e=>{i('WebGPU "adapter.requestDevice()" fail')})):i('WebGPU "adapter" request fail is empty')})).catch((e=>{i('WebGPU "navigator.gpu.requestAdapter()" fail')})):i("WebGPU not support!!")}))}class Xa{constructor(e,t){this.canvas=e,this.gl=t;const i=t.createShader(t.VERTEX_SHADER);if(t.shaderSource(i,"\n attribute vec2 xy;\n varying highp vec2 uv;\n void main(void) {\n gl_Position = vec4(xy, 0.0, 1.0);\n // Map vertex coordinates (-1 to +1) to UV coordinates (0 to 1).\n // UV coordinates are Y-flipped relative to vertex coordinates.\n uv = vec2((1.0 + xy.x) / 2.0, (1.0 - xy.y) / 2.0);\n }\n "),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS))throw t.getShaderInfoLog(i);const s=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(s,"\n varying highp vec2 uv;\n uniform sampler2D texture;\n void main(void) {\n gl_FragColor = texture2D(texture, uv);\n }\n "),t.compileShader(s),!t.getShaderParameter(s,t.COMPILE_STATUS))throw t.getShaderInfoLog(s);const r=t.createProgram();if(t.attachShader(r,i),t.attachShader(r,s),t.linkProgram(r),!t.getProgramParameter(r,t.LINK_STATUS))throw t.getProgramInfoLog(r);t.useProgram(r);const o=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),t.STATIC_DRAW);const a=t.getAttribLocation(r,"xy");t.vertexAttribPointer(a,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(a);const n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this.program=r,this.buffer=o,this.vertexShader=i,this.fragmentShader=s,this.texture=n}destroy(){this.gl.deleteProgram(this.program),this.gl.deleteBuffer(this.buffer),this.gl.deleteTexture(this.texture),this.gl.deleteShader(this.vertexShader),this.gl.deleteShader(this.fragmentShader),this.program=null,this.buffer=null,this.vertexShader=null,this.fragmentShader=null,this.texture=null}render(e){this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight;const t=this.gl;t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight),t.clearColor(1,0,0,1),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4)}}class Za extends $a{constructor(e){super(),this.player=e;const t=document.createElement("canvas");t.style.position="absolute",t.style.top=0,t.style.left=0,this.$videoElement=t,e.$container.appendChild(this.$videoElement),this.context2D=null,this.contextGl=null,this.webglRender=null,this.webglRectRender=null,this.webGPURender=null,this.isWebglContextLost=!1,this.isWcsWebgl2=!1,this.isWcsWebgpu=!1,this.bitmaprenderer=null,this.renderType=null,this.controlHeight=0,this.proxyDestroyList=[],this._initCanvasRender()}destroy(){super.destroy(),this.proxyDestroyList.length>0&&(this.proxyDestroyList.forEach((e=>{e&&e()})),this.proxyDestroyList=[]),this.contextGl&&(this.contextGl=null),this.context2D&&(this.context2D=null),this.webglRender&&(this.webglRender.destroy(),this.webglRender=null),this.webglRectRender&&(this.webglRectRender.destroy(),this.webglRectRender=null),this.webGPURender&&(this.webGPURender.destroy(),this.webGPURender=null),this.bitmaprenderer&&(this.bitmaprenderer=null),this.renderType=null,this.isWebglContextLost=!1,this.isWcsWebgpu=!1,this.isWcsWebgl2=!1,this.videoInfo={width:"",height:"",encType:""},this.player.$container.removeChild(this.$videoElement),this.init=!1,this.off()}_initContext2D(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.context2D=this.$videoElement.getContext("2d",e)}_initContextGl(){if(this.player.events,this.contextGl=io(this.$videoElement),!this.contextGl)throw this.player.debugError("CommonCanvasLoader","_initContextGl() createContextGL error"),new Error("CommonCanvasLoader and _initContextGl createContextGL error");this._bindContextGlEvents(),this.webglRender=new Oa(this.contextGl,this.player._opt.openWebglAlignment)}_initContextGl2(){if(this.contextGl=so(this.$videoElement),this.contextGl){this._bindContextGlEvents(2);try{this.webglRender=new Xa(this.$videoElement,this.contextGl)}catch(e){this.player.debugError("CommonCanvasLoader",`create webgl2Render error is ${e} and next use context2d.draw render`),this.contextGl=null,this.webglRender=null,this._initContext2D()}}else this.player.debugError("CommonCanvasLoader","_initContextGl2() createContextGL2 error")}_bindContextGlEvents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;const{proxy:t}=this.player.events,i=t(this.$videoElement,"webglcontextlost",(t=>{t.preventDefault(),this.player.debugError("canvasVideo","webglcontextlost error",t),this.isWebglContextLost=!0,this.webglRender&&(this.player.debugLog("CommonCanvasLoader","webglcontextlost error and destroy webglRender"),this.webglRender.destroy(),this.webglRender=null),this.webglRectRender&&(this.player.debugLog("CommonCanvasLoader","webglcontextlost error and destroy webglRectRender"),this.webglRectRender.destroy(),this.webglRectRender=null),this.contextGl=null,setTimeout((()=>{if(this.player.debugLog("CommonCanvasLoader",`createContextGL() version ${e}`),1===e?this.contextGl=io(this.$videoElement):2===e&&(this.contextGl=so(this.$videoElement)),this.player.debugLog("CommonCanvasLoader","createContextGL success"),this.contextGl&&this.contextGl.getContextAttributes){const t=this.contextGl.getContextAttributes();t&&t.stencil?(1===e?this.webglRender=new Oa(this.contextGl,this.player._opt.openWebglAlignment):2===e&&(this.webglRender=new Xa(this.$videoElement,this.contextGl)),this.isWebglContextLost=!1,this.player.debugLog("CommonCanvasLoader","webglcontextlost error reset and getContextAttributes().stencil is true")):(this.player.debugError("CommonCanvasLoader","webglcontextlost error, getContextAttributes().stencil is false"),this.player.emitError(dt.webglContextLostError))}else this.player.debugError("CommonCanvasLoader","webglcontextlost error, getContextAttributes().stencil is false"),this.player.emitError(dt.webglContextLostError)}),500)})),s=t(this.$videoElement,"webglcontextrestored",(e=>{e.preventDefault(),this.player.debugLog("CommonCanvasLoader","webglcontextrestored ",e)}));this.proxyDestroyList.push(i,s)}_initContextGPU(){Qa(this.$videoElement).then((e=>{this.player.isDestroyedOrClosed()||(e?(this.webGPURender=new Wa(e),this.player.debugLog("CommonCanvasLoader","webGPURender init success")):(this.player.debugWarn("CommonCanvasLoader","webGPURender init failed because context is null and next use webgl render"),this.renderType=si,this._initContextGl()))})).catch((e=>{this.player.isDestroyedOrClosed()||(this.player.debugWarn("CommonCanvasLoader",`createWebGPUContext error is ${e} and next use webgl render`),this.renderType=si,this._initContextGl())}))}initCanvasViewSize(){this.$videoElement.width=this.videoInfo.width,this.$videoElement.height=this.videoInfo.height,this.resize()}screenshot(e,t,i,s){e=e||oo(),s=s||ft.download;let r=.92;!Vi[t]&&ft[t]&&(s=t,t="png",i=void 0),"string"==typeof i&&(s=i,i=void 0),void 0!==i&&(r=Number(i));const o=Vi[t]||Vi.png,a=this.$videoElement.toDataURL(o,r);if(s===ft.base64)return a;{const t=ro(a);if(s===ft.blob)return t;if(s===ft.download){const i=o.split("/")[1];Ya(t,e+"."+i)}}}screenshotWatermark(e){return new Promise(((t,i)=>{Ko(e)&&(e={filename:e}),(e=e||{}).width=this.videoInfo.width,e.height=this.videoInfo.height,e.filename=e.filename||oo(),e.format=e.format?Vi[e.format]:Vi.png,e.quality=Number(e.quality)||.92,e.type=e.type||ft.download;const s=this.$videoElement.toDataURL(e.format,e.quality);Oo(s,e).then((i=>{if(e.type===ft.base64)t(s);else{const s=ro(i);if(e.type===ft.blob)t(s);else if(e.type===ft.download){t();const i=e.format.split("/")[1];Ya(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}))}screenshotCopyrightWatermark(e){return new Promise(((t,i)=>{if(Ko(e)){(e=(e={filename:e})||{}).width=this.videoInfo.width,e.height=this.videoInfo.height,e.filename=e.filename||oo(),e.format=e.format?Vi[e.format]:Vi.png,e.quality=Number(e.quality)||.92,e.type=e.type||ft.download;const s=this.$videoElement.toDataURL(e.format,e.quality);jo(s,e).then((i=>{if(e.type===ft.base64)t(s);else{const s=ro(i);if(e.type===ft.blob)t(s);else if(e.type===ft.download){t();const i=e.format.split("/")[1];Ya(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}}))}screenshotByCurrentWatermark(e){}render(){}clearView(){super.clearView()}play(){}pause(){}_resize(){this.player.debugLog("canvasVideo","_resize()");const e=this.player._opt;let t=this.player.width,i=this.player.height;if(this.player.isControlBarShow()){const s=this.controlHeight;fo()&&this.player.fullscreen&&e.useWebFullScreen?t-=s:i-=s}let s=this.$videoElement.width,r=this.$videoElement.height;const o=e.rotate;let a=(t-s)/2,n=(i-r)/2;270!==o&&90!==o||(s=this.$videoElement.height,r=this.$videoElement.width);const l=t/s,d=i/r;let h=l>d?d:l;Aa(e.isResize)&&l!==d&&(h=l+","+d),e.isFullResize&&(h=l>d?l:d);let c="scale("+h+")";"none"===e.mirrorRotate&&o&&(c+=" rotate("+o+"deg)"),"level"===e.mirrorRotate?c+=" rotateY(180deg)":"vertical"===e.mirrorRotate&&(c+=" rotateX(180deg)"),this.$videoElement.style.height=this.videoInfo.height+"px",this.$videoElement.style.width=this.videoInfo.width+"px",this.$videoElement.style.padding="0",this.$videoElement.style.transform=c,this.$videoElement.style.left=a+"px",this.$videoElement.style.top=n+"px"}initFps(){}setStreamFps(e){}getStreamFps(){return 25}getType(){return H}getCanvasType(){let e=this.renderType===oi?oi:si;return this.isWcsWebgl2?e=ri:this.isWcsWebgpu&&(e=oi),e}}class en extends Za{constructor(e){super(e),this.TAG_NAME="CanvasVideo",this.yuvList=[],this.controlHeight=Qt,this.tempTextCanvas=null,this.tempTextCanvasCtx=null,this.player.debugLog("CanvasVideo","init")}async destroy(){super.destroy(),this.yuvList=[],this.tempTextCanvas&&(this.tempTextCanvasCtx.clearRect(0,0,this.tempTextCanvas.width,this.tempTextCanvas.height),this.tempTextCanvas.width=0,this.tempTextCanvas.height=0,this.tempTextCanvas=null),this.player.debugLog("CanvasVideoLoader","destroy")}_initCanvasRender(){this.player._opt.useWCS&&!this._supportOffscreen()?(this.renderType=ii,this.player._opt.useWebGPU?Qa(this.$videoElement).then((e=>{this.player.isDestroyedOrClosed()||(e?(this.webGPURender=new Wa(e),this.isWcsWebgpu=!0,this.player.debugLog(this.TAG_NAME,"webGPURender init success")):(this.player.debugWarn(this.TAG_NAME,"webGPURender init failed because context is null and next use webgl render"),this._initWebglRenderForWCS()))})).catch((()=>{this.player.isDestroyedOrClosed()||(this.player.debugWarn(this.TAG_NAME,`createWebGPUContext error is ${e} and next use webgl render`),this._initWebglRenderForWCS())})):this._initWebglRenderForWCS()):this.player._opt.useMSE&&this.player._opt.mseUseCanvasRender?(this.renderType=ni,this._initContext2D()):this.player.isOldHls()&&this.player._opt.useCanvasRender?(this.renderType=li,this._initContext2D()):this.player.isWebrtcH264()&&this.player._opt.webrtcUseCanvasRender?(this.renderType=di,this._initContext2D()):this._supportOffscreen()?(this.renderType=ai,this._bindOffscreen()):this.player._opt.useWebGPU?(this.renderType=oi,this._initContextGPU()):(this.renderType=si,this._initContextGl())}_initWebglRenderForWCS(){this.player._opt.wcsUseWebgl2Render&&Ea()?(this._initContextGl2(),this.webglRender&&(this.isWcsWebgl2=!0)):this._initContext2D()}_supportOffscreen(){return"function"==typeof this.$videoElement.transferControlToOffscreen&&this.player._opt.useOffscreen}_bindOffscreen(){this.bitmaprenderer=this.$videoElement.getContext("bitmaprenderer")}render(e){this.yuvList.push(e),this.startRender()}startRender(){for(;!(this.yuvList.length<=0);){const e=this.yuvList.shift();this.doRender(e)}}doRender(e){if(this.renderType!==ni){const t={ts:e.ts||0,fps:!0};this.player.updateStats(t)}switch(this.renderType){case ai:this.bitmaprenderer.transferFromImageBitmap(e.buffer);break;case si:case oi:if(this.isWebglContextLost)return void this.player.debugWarn("CanvasVideoLoader","doRender() and webgl context is lost");let t=e.output;if(this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector){null===this.prevAiFaceDetectTime&&(this.prevAiFaceDetectTime=oo());const i=oo();i-this.prevAiFaceDetectTime>=this.player._opt.aiFaceDetectInterval&&(t=this.player.ai.faceDetector.detect({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output,ts:e.ts||0}),this.prevAiFaceDetectTime=i)}if(this.player.objectDetectActive&&this.player.ai&&this.player.ai.objectDetector){null===this.prevAiObjectDetectTime&&(this.prevAiObjectDetectTime=oo());const i=oo();i-this.prevAiObjectDetectTime>=this.player._opt.aiObjectDetectInterval&&(t=this.player.ai.objectDetector.detect({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output,ts:e.ts||0}),this.prevAiObjectDetectTime=i)}if(this.player.occlusionDetectActive&&this.player.ai&&this.player.ai.occlusionDetector){null===this.prevAiOcclusionDetectTime&&(this.prevAiOcclusionDetectTime=oo());const t=oo();if(t-this.prevAiOcclusionDetectTime>=this.player._opt.aiOcclusionDetectInterval){const i=this.player.ai.occlusionDetector.check({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output});this.prevAiOcclusionDetectTime=t,i&&this.player.emit(at.aiOcclusionDetectResult,{ts:e.ts||0})}}if(this.player.imageDetectActive&&this.player.ai&&this.player.ai.imageDetector){const t=this.player.ai.imageDetector.check({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output});if(t&&t.data&&(this.player.emit(at.aiImageDetectResult,{type:t.type,ts:e.ts||0}),this.player._opt.aiImageDetectDrop))return void this.player.debugLog("CanvasVideoLoader",`doRender() and ai image detect result type is ${t.type} and drop`)}if(this.renderType===oi)try{if(!this.webGPURender)return void this.player.debugWarn("CanvasVideoLoader","doRender webgpu render is not init");this.webGPURender.renderYUV(this.$videoElement.width,this.$videoElement.height,t)}catch(e){this.player.debugError("CanvasVideoLoader",`doRender webgpu render and error: ${e.toString()}`)}else if(this.renderType===si)try{this.webglRender.renderYUV(this.$videoElement.width,this.$videoElement.height,t)}catch(e){this.player.debugError("CanvasVideoLoader",`doRender webgl render context is lost ${this.contextGl&&this.contextGl.isContextLost()} and error: ${e.toString()}`)}break;case ii:if(this.webGPURender)this.webGPURender.render(e.videoFrame),oa(e.videoFrame);else if(this.webglRender)this.webglRender.render(e.videoFrame),oa(e.videoFrame);else if(this.context2D)if(ea(e.videoFrame.createImageBitmap))try{e.videoFrame.createImageBitmap().then((t=>{this.context2D.drawImage(t,0,0,this.$videoElement.width,this.$videoElement.height),oa(e.videoFrame)}))}catch(e){}else this.context2D.drawImage(e.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height),oa(e.videoFrame);else this.player.debugWarn("CanvasVideoLoader","doRender() and webcodecs context is lost");break;case ni:case li:case di:this.context2D.drawImage(e.$video,0,0,this.$videoElement.width,this.$videoElement.height)}let t=e.ts||0;this.renderType===ni&&(t=parseInt(1e3*e.$video.currentTime,10)+(this.player.mseDecoder.firstRenderTime||0)),this.player.updateCurrentPts(t),this.doAddContentToWatermark(),this.doAddAiContentToWatermark()}clearView(){switch(super.clearView(),this.renderType){case ai:(function(e,t){const i=document.createElement("canvas");i.width=e,i.height=t;const s=window.createImageBitmap(i,0,0,e,t);return i.width=0,i.height=0,s})(this.$videoElement.width,this.$videoElement.height).then((e=>{this.bitmaprenderer.transferFromImageBitmap(e)}));break;case si:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case oi:this.webGPURender.clear();break;case ii:this.webGPURender?this.webGPURender.clear():this.contextGl?this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT):this.context2D&&this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height);break;case ni:case li:case di:this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height)}}_initTempTextCanvas(){this.tempTextCanvas=document.createElement("canvas"),this.tempTextCanvasCtx=this.tempTextCanvas.getContext("2d"),this.tempTextCanvas.width=600,this.tempTextCanvas.height=20}doAddContentToCanvas(){this.tempContentList.length>0&&this.context2D&&function(e){let{ctx:t,list:i}=e;t.save(),(i||[]).forEach((e=>{"text"===e.type?(t.font=`${e.fontSize||12}px Arial`,t.fillStyle=e.color||"green",t.fillText(e.text,e.x,e.y)):"rect"===e.type&&(t.strokeStyle=e.color||"green",t.lineWidth=e.lineWidth||2,t.strokeRect(e.x,e.y,e.width,e.height))})),t.restore()}({ctx:this.context2D,list:this.tempContentList})}doAddContentToWebGlCanvas(){this.tempContentList.length>0&&this.contextGl&&this.webglRectRender&&this.tempContentList.forEach((e=>{const t=e.x,i=e.y;if("rect"===e.type){const r=e.width,o=e.height,a=(s=e.color||"#008000",[parseInt(s.substring(1,3),16)/255,parseInt(s.substring(3,5),16)/255,parseInt(s.substring(5,7),16)/255,1]),n=e.lineWidth||4;if(!r||!o)return;this.webglRectRender.drawBox({x:t,y:i,width:r,height:o,lineColor:a,lineWidth:n,canvasWidth:this.$videoElement.width,canvasHeight:this.$videoElement.height})}else if("text"===e.type){const s=e.text||"";if(!s)return;const r=e.fontSize||20,o=e.color||"#008000";this.tempTextCanvas||this._initTempTextCanvas(),this.tempTextCanvasCtx.clearRect(0,0,this.tempTextCanvas.width,this.tempTextCanvas.height),this.tempTextCanvasCtx.font=`${r}px Arial`,this.tempTextCanvasCtx.fillStyle=o,this.tempTextCanvasCtx.textBaseline="top",this.tempTextCanvasCtx.fillText(s,0,0),this.webglRender.drawDom(this.$videoElement.width,this.$videoElement.height,t,i,this.tempTextCanvas)}var s}))}}class tn extends $a{constructor(e){super(),this.player=e,this.TAG_NAME="Video";const t=document.createElement("video");t.muted=!0,t.disablePictureInPicture=!0,go()&&(t.poster="noposter"),t.style.position="absolute",t.style.top=0,t.style.left=0,this._delayPlay=!1,e.$container.appendChild(t),this.$videoElement=t,this.$canvasElement=null,this.canvasContext=null,this.mediaStream=null,this.vwriter=null,this.awriter=null,this.trackGenerator=null,this.audioTrackGenerator=null,this.fixChromeVideoFlashBug(),this.fixMobileAutoFullscreen(),this.resize(),this.eventListenList=[],this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes=0,this.isRetryPlaying=!1,this.isRetryPlayingTimes=0,this.canplayReceived=!1,this.progressProxyDestroy=null,this.checkVideoCanplayTimeout=null,this.visibilityChangePlayTimeout=null,this.pauseDelayTimeout=null,this.replayTimeout=null,this.detectAndFixStuckPlaybackStartTime=null;const i=ka();this.supportVideoFrameCallbackHandle=null;const{proxy:s}=this.player.events,r=s(this.$videoElement,"canplay",(()=>{this.player.debugLog("Video","canplay"),this.player.isDestroyedOrClosed()||(this.canplayReceived=!0,this._delayPlay?(this.clearCheckVideoCanplayTimeout(),this._play(),ka()?this.supportVideoFrameCallbackHandle||(this.player.debugLog("Video","support requestVideoFrameCallback and use videoFrameCallback"),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))):this.player.debugWarn("Video","not support requestVideoFrameCallback and use timeupdate event to update stats")):this.$videoElement.paused&&(this.player.isMSEPlaybackRateChangePause?(this.player.debugLog("Video",`canplay and video is paused and isMSEPlaybackRateChangePause is ${this.player.isMSEPlaybackRateChangePause} so next try to play`),this.player.isMSEPlaybackRateChangePause=!1,this._play()):this.player.isMSECurrentMoreThanBufferedPause?(this.player.debugLog("Video",`canplay and video is paused and isMSECurrentMoreThanBufferedPause is ${this.player.isMSECurrentMoreThanBufferedPause} so next try to play`),this.player.isMSECurrentMoreThanBufferedPause=!1,this._play()):(this.player.debugWarn("Video","canplay and video is paused and try to play"),this._play())))})),o=s(this.$videoElement,"waiting",(()=>{this.player.debugLog("Video","waiting")})),a=s(this.$videoElement,"loadedmetadata",(()=>{this.player.debugLog("Video","loadedmetadata")})),n=s(this.$videoElement,"timeupdate",(t=>{if(!this.player.isDestroyedOrClosed()){if(Aa(i)){const t=parseInt(1e3*this.getCurrentTime(),10);if(e.isWebrtcH264()||this.player.isOldHls()||this.player.isAliyunRtc())this.player.emit(at.timeUpdate,t),e.handleRender(),e.updateStats({fps:!0,ts:t,dts:t}),this.player.updateCurrentPts(t);else if(ya(this.player._opt.useMSE)&&Aa(this.player._opt.mseUseCanvasRender))if(this.player.mseDecoder){let e=parseInt(1e3*this.getCurrentTime(),10)+(this.player.mseDecoder.firstRenderTime||0);this.player.updateCurrentPts(e)}else if(this.player._opt.mseDecoderUseWorker){let e=parseInt(1e3*this.getCurrentTime(),10)+(this.player._mseWorkerData.firstRenderTime||0);this.player.updateCurrentPts(e)}this.doAddContentToWatermark()}this.player.isMseDecoderUseWorker()&&(this.player.decoderWorker.updateVideoTimestamp(this.getCurrentTime()),this._handleUpdatePlaybackRate())}})),l=s(this.$videoElement,"error",(e=>{if(!this.$videoElement.error)return void this.player.debugError(this.TAG_NAME,"on error",e);let t={};if(this.player.isUseMSE()&&(t=this.player.getMseMineType()),this.player.debugError("Video","Error Code "+this.$videoElement.error.code+" "+tr[this.$videoElement.error.code]+"; Details: "+this.$videoElement.error.message+"; Video Info: "+JSON.stringify(this.videoInfo)+"; Mse Mine Type: "+t.video+"; "),this.player.isUseMSE()){this.$videoElement.error.code;const e=this.$videoElement.error.message;-1!==e.indexOf(ir)&&(this.player.isMSEVideoDecoderInitializationFailedNotSupportHevc=!0),-1!==e.indexOf(sr)&&(this.player.isMSEAudioDecoderError=!0)}this.player.isHlsCanVideoPlay()})),d=s(this.$videoElement,"stalled",(()=>{this._detectAndFixStuckPlayback(!0)}));if(this.progressProxyDestroy=s(this.$videoElement,"progress",(()=>{this._detectAndFixStuckPlayback()})),this.eventListenList.push(r,o,n,l,a,d),this.player.isUseMSE()){const e=s(this.$videoElement,ts,(()=>{this.player.debugLog(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate),this.$videoElement&&this.$videoElement.paused&&(this.player.debugWarn(this.TAG_NAME,"ratechange and video is paused and sent isMSEPlaybackRateChangePause true"),this.player.isMSEPlaybackRateChangePause=!0)}));this.eventListenList.push(e),this.player.on(at.visibilityChange,(e=>{e&&(this.visibilityChangePlayTimeout=setTimeout((()=>{if(this.clearVisibilityChangePlayTimeout(),this.player.isPlaying()&&this.$videoElement){const e=this.getVideoBufferLastTime();e-this.$videoElement.currentTime>this.getBufferMaxDelayTime()&&(this.player.debugLog(this.TAG_NAME,`visibilityChange is true and lastTime is ${e} and currentTime is ${this.$videoElement.currentTime} so set currentTime to lastTime`),this.$videoElement.currentTime=e)}}),300))}))}this.player.debugLog("Video","init")}async destroy(){if(super.destroy(),this.clearCheckVideoCanplayTimeout(),this.clearReplayTimeout(),this.clearVisibilityChangePlayTimeout(),this.clearPauseDelayTimeout(),this._cancelVideoFrameCallback(),this._removeProgressProxyDestroy(),this.eventListenList.length&&(this.eventListenList.forEach((e=>{e()})),this.eventListenList=[]),this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes=0,this.isRetryPlaying=!1,this.isRetryPlayingTimes=0,this.canplayReceived=!1,this.player._opt.videoRenderSupportScale&&this._isNeedAddBackDropFilter()){const e=this.player.$container;e.style.backdropFilter="none",e.style.transform="none"}if(this.$canvasElement&&(this.$canvasElement.height=0,this.$canvasElement.width=0,this.$canvasElement=null),this.canvasContext=null,this.$videoElement){this.$videoElement.pause&&(this.$videoElement.pause(),this.$videoElement.muted=!0),this.$videoElement.currentTime=0,this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")),this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"));try{this.$videoElement.load()}catch(e){}this.player.$container.removeChild(this.$videoElement),this.$videoElement=null}this.trackGenerator&&(this.trackGenerator.stop(),this.trackGenerator=null),this.audioTrackGenerator&&(this.audioTrackGenerator.stop(),this.audioTrackGenerator=null),this.vwriter&&(await this.vwriter.close(),this.vwriter=null),this.awriter&&(await this.awriter.close(),this.awriter=null),this._delayPlay=!1,this.mediaStream&&(this.mediaStream.getTracks().forEach((e=>e.stop())),this.mediaStream=null),this.off(),this.player.debugLog("Video","destroy")}_createScreenShotCanvas(){const e=document.createElement("canvas");this.$canvasElement=e,this.canvasContext=e.getContext("2d"),this.canvasContext.imageSmoothingEnabled=!0,this.canvasContext.imageSmoothingEnabled&&(this.canvasContext.imageSmoothingQuality="high")}bindMediaStream(){if(this.player.canVideoTrackWritter()&&Do()&&Ro()&&!this.mediaStream){this.player.debugLog(this.TAG_NAME,"bindMediaStream"),this.trackGenerator=new MediaStreamTrackGenerator({kind:"video"}),this.player.useVideoPlayAudio()&&(this.audioTrackGenerator=new MediaStreamTrackGenerator({kind:"audio"}),this.awriter=this.audioTrackGenerator.writable.getWriter());const e=[this.trackGenerator];this.audioTrackGenerator&&e.push(this.audioTrackGenerator),this.mediaStream=new MediaStream(e),this.$videoElement.srcObject=this.mediaStream,this.vwriter=this.trackGenerator.writable.getWriter()}}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())return void this.player.debugLog("Video","videoFrameCallback() and isDestroyedOrClosed and return");this.player.handleRender();const i=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)||0;if(this.player.isUseHls265UseMse())this.player.updateStats({fps:!0,ts:i});else if(this.player.isMseDecoderUseWorker()){this.player._times.videoStart||(this.player._times.videoStart=oo(),this.player.handlePlayToRenderTimes());const e=i+(this.player._mseWorkerData.firstRenderTime||0);if(this.player.updateStats({fps:!0,dfps:!0,ts:e,mseTs:i}),this.player.emit(at.timeUpdate,e),Aa(this.getHasInit())&&t.width&&t.height){const e={width:t.width,height:t.height};this.updateVideoInfo(e),this.initCanvasViewSize()}}if(this.player.isWebrtcH264()||this.player.isOldHls()||this.player.isAliyunRtc()){if(this.player.emit(at.timeUpdate,i),Aa(this.getHasInit())&&t.width&&t.height){const e={width:t.width,height:t.height};this.videoInfo.encTypeCode||this.player.isOldHls()||(e.encTypeCode=At),this.updateVideoInfo(e)}this.player.updateStats({fps:!0,ts:i,dts:i}),this.player.updateCurrentPts(i),this.doAddContentToWatermark()}else if(ya(this.player._opt.useMSE)&&Aa(this.player._opt.mseUseCanvasRender)){if(this.player.mseDecoder){let e=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)+(this.player.mseDecoder.firstRenderTime||0);this.player.updateCurrentPts(e)}else if(this.player._opt.mseDecoderUseWorker){let e=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)+(this.player._mseWorkerData.firstRenderTime||0);this.player.updateCurrentPts(e)}this.doAddContentToWatermark()}this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}fixChromeVideoFlashBug(){if(this.player._opt.videoRenderSupportScale&&this._isNeedAddBackDropFilter()){const e=this.player.$container;e.style.backdropFilter="blur(0px)",e.style.transform="translateZ(0)"}}fixMobileAutoFullscreen(){const e=bo(),t=go();(e||t)&&(this.player.debugLog("Video",`fixMobileAutoFullscreen and isIOS ${e} and isAndroid ${t}`),this.$videoElement.setAttribute("webkit-playsinline","true"),this.$videoElement.setAttribute("playsinline","true"),this.$videoElement.setAttribute("x5-video-player-type","h5-page"))}_detectAndFixStuckPlayback(e){const t=this.$videoElement,i=t.buffered,s=t.readyState;if(this.player.debugLog(this.TAG_NAME,`_detectAndFixStuckPlayback() and isStalled is ${e} ,canplayReceived is ${this.canplayReceived} ,videoReadyState is ${s} and bufferedLength is ${i.length} and startTime is ${i.length>0?i.start(0):"null"} and currentTime is ${t.currentTime}`),e||Aa(this.canplayReceived)||s<2){if(i.length>0&&t.currentTime=1e3*this.player._opt.mseWaitVideoCanplayTimeout&&(this.player.debugWarn(this.TAG_NAME,`_detectAndFixStuckPlayback() and video is stuck and currentTime is ${t.currentTime} , diff is ${e} and timeout`),this.player.emit(dt.mseWaitVideoCanplayTimeout,e))}}else this._removeProgressProxyDestroy()}_removeProgressProxyDestroy(){this.progressProxyDestroy&&(this.player.debugLog(this.TAG_NAME,"_removeProgressProxyDestroy()"),this.progressProxyDestroy(),this.progressProxyDestroy=null),this.detectAndFixStuckPlaybackStartTime=null}_isNeedAddBackDropFilter(){const e=Ao().type.toLowerCase();return"chrome"===e||"edge"===e}isPaused(){let e=!0;return this.$videoElement&&(e=this.$videoElement.paused),e}isPause(){return this.isPaused()}_getVideoReadyState(){let e=0;return this.$videoElement&&(e=this.$videoElement.readyState),e}_getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}play(){if(this.$videoElement){const e=this._getVideoReadyState();if(this.player.debugLog("Video",`play and readyState: ${e}`),0===e)return this.player.debugLog("Video","readyState is 0 and set _delayPlay to true and listen canplay event to play"),this._delayPlay=!0,void(null===this.checkVideoCanplayTimeout&&(this.checkVideoCanplayTimeout=setTimeout((()=>{if(this.clearCheckVideoCanplayTimeout(),!this.player.isDestroyedOrClosed()&&Aa(this.isPlaying())){const e=this._getBufferStore();this.player.debugWarn("Video",`checkVideoCanplayTimeout and video is not playing and buffer store is ${e} and retry play`),this.$videoElement.currentTime=e,this._replay()}}),1e3)));this._play()}}_play(){this.$videoElement&&this.$videoElement.play().then((()=>{this._delayPlay=!1,this.player.debugLog("Video","_play success"),this.isPlaying()?(this.player.emit(at.removeLoadingBgImage),this.isRetryPlayingTimes=0,this.isRetryPlaying=!1):this.replayTimeout=setTimeout((()=>{this.clearReplayTimeout(),this._replay()}),100)})).catch((e=>{this.player.isDestroyedOrClosed()?this.player.debugLog("Video","_play error and player is isDestroyedOrClosed and return"):(this.player.debugLog("Video",`_play error and\n e.name is ${e.name},\n e.message is ${e.message},\n e.toString() is ${e.toString()}`),this.player.debugError("Video","_play error",e),this.isRetryPlaying=!1,this.replayTimeout=setTimeout((()=>{this.clearReplayTimeout(),this._replay()}),100))}))}_replay(){if(!this.isPlaying()&&Aa(this.player.isDestroyedOrClosed())&&Aa(this.isRetryPlaying)){if(this.isRetryPlaying=!0,this.isRetryPlayingTimes>=3){let e="";return void(this.player.isWebrtcH264()?(e=`_replay(webrtc H264) then but not playing and retry play times is ${this.isRetryPlayingTimes} and emit error`,this.player.debugError("Video",e),this.player.emitError(dt.videoElementPlayingFailedForWebrtc,e)):(e=`_replay then but not playing and retry play times is ${this.isRetryPlayingTimes} and emit error to use canvas render`,this.player.debugError("Video",e),this.player.emitError(dt.videoElementPlayingFailed,e)))}this.player.debugWarn("Video",`_play then but not playing and retry play and isRetryPlayingTimes is ${this.isRetryPlayingTimes}`),this._play(),this.isRetryPlayingTimes++}else this.player.debugLog("Video",`_replay() and isPlaying is ${this.isPlaying()} and isRetryPlaying is ${this.isRetryPlaying} and isDestroyedOrClosed is ${this.player.isDestroyedOrClosed()} and return;`)}pause(e){this.player.debugLog(this.TAG_NAME,"pause and isNow is "+e),this.isPlaying()&&(e?(this.$videoElement&&this.$videoElement.pause(),this._cancelVideoFrameCallback()):this.pauseDelayTimeout=setTimeout((()=>{this.clearPauseDelayTimeout(),this.$videoElement&&this.$videoElement.pause(),this._cancelVideoFrameCallback()}),100))}clearView(){super.clearView(),this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")))}screenshot(e,t,i,s){if(!this._canScreenshot())return this.player.debugWarn("Video",`screenshot failed, video is not ready and stats is ${this._getVideoReadyState()}`),null;e=e||oo(),s=s||ft.download;let r=.92;!Vi[t]&&ft[t]&&(s=t,t="png",i=void 0),"string"==typeof i&&(s=i,i=void 0),void 0!==i&&(r=Number(i));const o=this.$videoElement;this.$canvasElement||this._createScreenShotCanvas();let a=this.$canvasElement;a.width=o.videoWidth,a.height=o.videoHeight,this.canvasContext.drawImage(o,0,0,a.width,a.height);const n=Vi[t]||Vi.png,l=a.toDataURL(n,r);if(this.canvasContext.clearRect(0,0,a.width,a.height),a.width=0,a.height=0,s===ft.base64)return l;{const t=ro(l);if(s===ft.blob)return t;if(s===ft.download){const i=n.split("/")[1];Ya(t,e+"."+i)}}}screenshotWatermark(e){return new Promise(((t,i)=>{if(Ko(e)&&(e={filename:e}),!this._canScreenshot())return this.player.debugWarn("Video","screenshot failed, video is not ready"),i("screenshot failed, video is not ready");const s=this.$videoElement;(e=e||{}).width=s.videoWidth,e.height=s.videoHeight,e.filename=e.filename||oo(),e.format=e.format?Vi[e.format]:Vi.png,e.quality=Number(e.quality)||.92,e.type=e.type||ft.download,this.$canvasElement||this._createScreenShotCanvas();let r=this.$canvasElement;r.width=s.videoWidth,r.height=s.videoHeight,this.canvasContext.drawImage(s,0,0,r.width,r.height);const o=r.toDataURL(e.format,e.quality);this.canvasContext.clearRect(0,0,r.width,r.height),r.width=0,r.height=0,Oo(o,e).then((i=>{if(e.type===ft.base64)t(o);else{const s=ro(i);if(e.type===ft.blob)t(s);else if(e.type===ft.download){t();const i=e.format.split("/")[1];Ya(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}))}screenshotCopyrightWatermark(e){return new Promise(((t,i)=>{if(Ko(e)&&(e={filename:e}),!this._canScreenshot())return this.player.debugWarn("Video","screenshot failed, video is not ready"),i("screenshot failed, video is not ready");const s=this.$videoElement;(e=e||{}).width=s.videoWidth,e.height=s.videoHeight,e.filename=e.filename||oo(),e.format=e.format?Vi[e.format]:Vi.png,e.quality=Number(e.quality)||.92,e.type=e.type||ft.download,this.$canvasElement||this._createScreenShotCanvas();let r=this.$canvasElement;r.width=s.videoWidth,r.height=s.videoHeight,this.canvasContext.drawImage(s,0,0,r.width,r.height);const o=r.toDataURL(e.format,e.quality);this.canvasContext.clearRect(0,0,r.width,r.height),r.width=0,r.height=0,jo(o,e).then((i=>{if(e.type===ft.base64)t(o);else{const s=ro(i);if(e.type===ft.blob)t(s);else if(e.type===ft.download){t();const i=e.format.split("/")[1];Ya(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}))}screenshotByCurrentWatermark(e){}initCanvasViewSize(){this.resize()}clear(){const e=this.$videoElement,t=e.buffered,i=t.length?t.end(t.length-1):0;e.currentTime=i}render(e){if(this.vwriter){if(this.$videoElement.srcObject||(this.$videoElement.srcObject=this.mediaStream),this.isPaused()){const e=this._getVideoReadyState();if(this.player.debugWarn("Video","render() error, video is paused and readyState is "+e),4===e&&Aa(this.isRenderRetryPlaying)){if(this.isRenderRetryPlaying=!0,this.isRenderRetryPlayingTimes>3){const t="render() error, video is paused and readyState is "+e+", retry times is "+this.isRenderRetryPlayingTimes+", emit error and use canvas render";return this.player.debugError("Video",t),void this.player.emitError(dt.videoElementPlayingFailed,t)}this.$videoElement.play().then((()=>{this.isRenderRetryPlayingTimes=0,this.isRenderRetryPlaying=!1,this.player.debugLog("Video","render() video is paused and replay success")})).catch((e=>{this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes++,this.player.debugLog("Video",`_play error render() error, video is paused and replay error and\n e.name is ${e.name},\n e.message is ${e.message},\n e.toString() is ${e.toString()}`),this.player.debugError("Video","render() error, video is paused and replay error ",e)}))}}if(this.player.updateStats({fps:!0,ts:e.ts||0}),e.videoFrame)this.vwriter.write(e.videoFrame),oa(e.videoFrame);else if(e.output){let s=e.output;if(this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector){null===this.prevAiFaceDetectTime&&(this.prevAiFaceDetectTime=oo());const t=oo();t-this.prevAiFaceDetectTime>this.player._opt.aiFaceDetectInterval&&(s=this.player.ai.faceDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0}),this.prevAiFaceDetectTime=t)}if(this.player.objectDetectActive&&this.player.ai&&this.player.ai.objectDetector){null===this.prevAiObjectDetectTime&&(this.prevAiObjectDetectTime=oo());const t=oo();t-this.prevAiObjectDetectTime>this.player._opt.aiObjectDetectInterval&&(s=this.player.ai.objectDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0}),this.prevAiObjectDetectTime=t)}if(this.player.occlusionDetectActive&&this.player.ai&&this.player.ai.occlusionDetector){null===this.prevAiOcclusionDetectTime&&(this.prevAiOcclusionDetectTime=oo());const t=oo();if(t-this.prevAiOcclusionDetectTime>=this.player._opt.aiOcclusionDetectInterval){const i=this.player.ai.occlusionDetector.check({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0});this.prevAiOcclusionDetectTime=t,i&&(this.player.debugLog("Video","render() and ai occlusion detect result is true"),this.player.emit(at.aiOcclusionDetectResult,{ts:e.ts||0}))}}if(this.player.imageDetectActive&&this.player.ai&&this.player.ai.imageDetector){const t=this.player.ai.imageDetector.check({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0});if(t&&t.data&&(this.player.emit(at.aiImageDetectResult,{type:t.type,ts:e.ts||0}),this.player._opt.aiImageDetectDrop))return void this.player.debugLog("Video",`render() and ai image detect result type is ${t.type} and drop`)}try{const r=(t=s,i={format:"I420",codedWidth:this.videoInfo.width,codedHeight:this.videoInfo.height,timestamp:1e3*e.ts},new VideoFrame(t,i));this.vwriter.write(r),oa(r)}catch(e){this.player.debugError("Video","render error",e),this.player.emitError(dt.wasmUseVideoRenderError,`code is ${e.code} and message is ${e.message}`)}}this.player.updateCurrentPts(e.ts||0),this.doAddContentToWatermark(),this.doAddAiContentToWatermark()}else this.player.debugWarn("Video","render and this.vwriter is null");var t,i}_resize(){this.player.debugLog("Video","_resize()");let e=this.player.width,t=this.player.height;const i=this.player._opt,s=i.rotate;if(this.player.isControlBarShow()){const s=i.playType===w?Xt:Qt;fo()&&this.player.fullscreen&&i.useWebFullScreen?e-=s:t-=s}this.$videoElement.width=e,this.$videoElement.height=t,this.$videoElement.style.width=e+"px",this.$videoElement.style.height=t+"px",270!==s&&90!==s||(this.$videoElement.width=t,this.$videoElement.height=e,this.$videoElement.style.width=t+"px",this.$videoElement.style.height=e+"px");let r=(e-this.$videoElement.width)/2,o=(t-this.$videoElement.height)/2,a="contain";Aa(i.isResize)&&(a="fill"),i.isFullResize&&(a="none");let n="";"none"===i.mirrorRotate&&s&&(n+=" rotate("+s+"deg)"),"level"===i.mirrorRotate?n+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(n+=" rotateX(180deg)"),this.player._opt.videoRenderSupportScale&&(this.$videoElement.style.objectFit=a),this.$videoElement.style.transform=n,this.$videoElement.style.padding="0",this.$videoElement.style.left=r+"px",this.$videoElement.style.top=o+"px"}getType(){return J}getCurrentTime(){return this.$videoElement.currentTime}isPlaying(){return this.$videoElement&&Aa(this.$videoElement.paused)&&Aa(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}isVideoPlaying(){return this.isPlaying()}_canScreenshot(){return this.$videoElement&&this.$videoElement.readyState>=1}getPlaybackQuality(){let e=null;if(this.$videoElement){if(ea(this.$videoElement.getVideoPlaybackQuality)){const t=this.$videoElement.getVideoPlaybackQuality();e={droppedVideoFrames:t.droppedVideoFrames||t.corruptedVideoFrames,totalVideoFrames:t.totalVideoFrames,creationTime:t.creationTime}}else e={droppedVideoFrames:this.$videoElement.webkitDroppedFrameCount,totalVideoFrames:this.$videoElement.webkitDecodedFrameCount,creationTime:oo()};e&&(e.renderedVideoFrames=e.totalVideoFrames-e.droppedVideoFrames)}return e}setRate(e){this.$videoElement&&(this.$videoElement.playbackRate=e)}get rate(){let e=1;return this.$videoElement&&(e=this.$videoElement.playbackRate),e}clearCheckVideoCanplayTimeout(){this.checkVideoCanplayTimeout&&(clearTimeout(this.checkVideoCanplayTimeout),this.checkVideoCanplayTimeout=null)}clearReplayTimeout(){this.replayTimeout&&(clearTimeout(this.replayTimeout),this.replayTimeout=null)}clearVisibilityChangePlayTimeout(){this.visibilityChangePlayTimeout&&(clearTimeout(this.visibilityChangePlayTimeout),this.visibilityChangePlayTimeout=null)}clearPauseDelayTimeout(){this.pauseDelayTimeout&&(clearTimeout(this.pauseDelayTimeout),this.pauseDelayTimeout=null)}_cancelVideoFrameCallback(){this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null)}_getBufferStore(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.buffered.start(0)),t}_handleUpdatePlaybackRate(){const e=this.$videoElement,t=e.buffered;t.length&&t.start(0);const i=t.length?t.end(t.length-1):0;let s=e.currentTime;const r=i-s,o=this.getBufferMaxDelayTime();if(this.player.updateStats({mseVideoBufferDelayTime:r}),r>o)this.player.debugLog(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current is ${s} , delay buffer is more than ${o} is ${r} and new time is ${i}`),e.currentTime=i,s=e.currentTime;else if(r<0&&0===i)return this.player.debugWarn(this.TAG_NAME,`handleUpdatePlaybackRate and delay buffer is ${i} - current is ${s} = ${r} < 0 and check video is paused : ${e.paused} `),void this.player.emit(dt.mediaSourceBufferedIsZeroError,"video.buffered is empty");if(s>1){const t=this._getPlaybackRate(i-s);e.playbackRate!==t&&(this.player.debugLog(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current time is ${s} and delay is ${i-s} set playbackRate is ${t} `),e.playbackRate=t)}}_getPlaybackRate(e){const t=this.$videoElement;let i=this.player._opt.videoBufferDelay+this.player._opt.videoBuffer;const s=Math.max(i,1e3),r=s/2;return e*=1e3,1===t.playbackRate?e>s?1.2:1:e<=r?1:t.playbackRate}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}getVideoBufferLastTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;i.length&&i.start(0);t=i.length?i.end(i.length-1):0}return t}getVideoBufferDelayTime(){const e=this.$videoElement;const t=this.getVideoBufferLastTime()-e.currentTime;return t>0?t:0}checkSourceBufferDelay(){const e=this.$videoElement;let t=0,i=0;return e.buffered.length>0&&(i=e.buffered.end(e.buffered.length-1),t=i-e.currentTime),t<0&&(this.player.debugWarn(this.TAG_NAME,`checkVideoSourceBufferDelay ${t} < 0, and buffered is ${i} ,currentTime is ${e.currentTime} , try to seek ${e.currentTime} to ${i}`),e.currentTime=i,e.paused&&(this.player.debugWarn(this.TAG_NAME,"checkSourceBufferDelay and video is paused and sent isMSECurrentMoreThanBufferedPause true"),this.player.isMSECurrentMoreThanBufferedPause=!0),t=0),t}checkSourceBufferStore(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.currentTime-e.buffered.start(0)),t}getVideoBufferTimeRange(){const e=this.$videoElement;let t=null;if(e){const i=e.buffered,s=i.length?i.start(0):0,r=i.length?i.end(i.length-1):0;t={start:s,end:r,diff:r-s}}return t}getDecodePlaybackRate(){let e=0;const t=this.$videoElement;return t&&(e=t.playbackRate),e}getBufferMaxDelayTime(){let e=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3;return Math.max(5,e+3)}getReadyStateInited(){return this._getVideoReadyState()>=1}}class sn extends Za{constructor(e){super(e),this.controlHeight=Xt,this.bufferList=[],this.playing=!1,this.playInterval=null,this.fps=1,this.preFps=1,this.streamFps=0,this.playbackRate=1,this._firstTimestamp=null,this._renderFps=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._hasCalcFps=!1,this.player.on(at.playbackPause,(e=>{e?(this.pause(),this.player.playback.isPlaybackPauseClearCache&&this.clear()):this.resume()})),this.player.debugLog("CanvasPlaybackLoader","init")}async destroy(){this._stopSync(),this.clear(),this._firstTimestamp=null,this.playing=!1,this.playbackRate=1,this.fps=1,this.preFps=1,this._renderFps=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._hasCalcFps=!1,super.destroy(),this.player.debugLog("CanvasPlaybackLoader","destroy")}_initCanvasRender(){this.player._opt.useWCS?(this.renderType=ii,Ea()&&this.player._opt.wcsUseWebgl2Render?(this._initContextGl2(),this.webglRender&&(this.isWcsWebgl2=!0)):this._initContext2D()):this.player._opt.useWebGPU?(this.renderType=oi,this._initContextGPU()):(this.renderType=si,this._initContextGl())}_sync(){this._stopSync(),this._doPlay(),this.playInterval=setInterval((()=>{this._doPlay()}),this.fragDuration)}_doPlay(){if(this.bufferList.length>0&&!this.player.seeking){const e=this.bufferList.shift();e&&e.buffer&&(this._doRender(e.buffer),this.player.handleRender(),this.player.playback.updateStats({ts:e.ts,tfTs:e.tfTs}))}}_stopSync(){this.playInterval&&(clearInterval(this.playInterval),this.playInterval=null)}_doRender(e){if(this.player._opt.useWCS)if(this.webglRender)this.webglRender.render(e),oa(e);else if(ea(e.createImageBitmap))try{e.createImageBitmap().then((t=>{this.context2D.drawImage(t,0,0,this.$videoElement.width,this.$videoElement.height),oa(e)}))}catch(e){}else this.context2D.drawImage(e,0,0,this.$videoElement.width,this.$videoElement.height),oa(e);else if(this.getCanvasType()===si)try{this.webglRender.renderYUV(this.$videoElement.width,this.$videoElement.height,e)}catch(e){this.player.debugError("CanvasPlaybackLoader",`doRender webgl render context is lost ${this.contextGl&&this.contextGl.isContextLost()} and error: ${e.toString()}`)}else if(this.getCanvasType()===oi)try{if(!this.webGPURender)return void this.player.debugWarn("CanvasVideoLoader","doRender webgpu render is not init");this.webGPURender.renderYUV(this.$videoElement.width,this.$videoElement.height,e)}catch(e){this.player.debugError("CanvasPlaybackLoader",`doRender webgpu render and error: ${e.toString()}`)}}get rate(){return this.playbackRate}get fragDuration(){return Math.ceil(1e3/(this.fps*this.playbackRate))}get bufferSize(){return this.bufferList.length}getStreamFps(){return this.streamFps}initFps(){this._hasCalcFps?this.player.debugLog("CanvasPlaybackLoader","initFps, has calc fps"):(this.preFps=ao(this.player.playback.fps,1,100),this.fps=this.preFps)}setFps(e){e!==this.fps?(e>100&&this.player.debugWarn("CanvasPlaybackLoader","setFps max",e),e<0&&this.player.debugWarn("CanvasPlaybackLoader","setFps min",e),this.fps=ao(e,1,100),this.player.debugLog("CanvasPlaybackLoader",`setFps ${this.preFps} -> ${this.fps}`),this.player.playback.isUseFpsRender&&this._sync()):this.player.debugLog("CanvasPlaybackLoader",`setFps, same fps ${e}`)}setStreamFps(e){this.player.debugLog("CanvasPlaybackLoader","setStreamFps",e),this._hasCalcFps=!0,this.streamFps=e,this.preFps=e,this.setFps(e)}setRate(e){e!==this.playbackRate&&(this.playbackRate=e,this.player.playback.isUseFpsRender&&this._sync())}render$2(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);const t={tfTs:e.ts-this._firstTimestamp,ts:e.ts};e.videoFrame?t.buffer=e.videoFrame:t.buffer=e.output,this.bufferList.push(t),this.startRender(),this.player.handleRender(),this.player.playback.updateStats({ts:e.ts,tfTs:t.tfTs})}startRender(){for(;!(this.bufferList.length<=0);){const e=this.bufferList.shift();this._doRender(e.buffer)}}pushData(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);const t={tfTs:e.ts-this._firstTimestamp,ts:e.ts};e.videoFrame?t.buffer=e.videoFrame:t.buffer=e.output;const i=this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender;if(i||this.bufferSize>this.fps*this.playbackRate*2&&(this.player.debugWarn("CanvasPlaybackLoader",`buffer size is ${this.bufferSize}`),this._doPlay()),this.bufferList.push(t),!this._hasCalcFps){const e=da(this.bufferList);null!==e&&e!==this.preFps&&(this.player.debugLog("CanvasPlaybackLoader",`calc fps is ${e} pre fps is ${this.preFps} and updatePreFps`),this.setStreamFps(e))}if(!i){const e=this.bufferList.length,t=e/(this.fps*this.playbackRate);this.player.debugLog("CanvasPlaybackLoader","rate is",t),t<=1?this.setFps(this.preFps):(this.setFps(this.fps+Math.floor(t*this.playbackRate)),this.player.debugWarn("CanvasPlaybackLoader","rate is",t,"fps is",this.fps,"bufferListLength is",e))}}initVideo(){this.player.playback&&this.player.playback.isUseFpsRender&&this._sync(),this.playing=!0}initVideoDelay(){const e=this.player._opt.playbackDelayTime;e>0?this.delayTimeout=setTimeout((()=>{this.initVideo()}),e):this.initVideo()}clearView(){super.clearView(),this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT)}clear(){this.player._opt.useWCS&&this.bufferList.forEach((e=>{e.buffer&&oa(e.buffer)})),this.bufferList=[]}resume(){this.player.playback.isUseFpsRender&&this._sync(),this.playing=!0}pause(){this.player.playback.isUseFpsRender&&this._stopSync(),this.playing=!1}}class rn{constructor(e){return new(rn.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.useMSE?e.mseUseCanvasRender?en:tn:e.isHls&&Aa(e.supportHls265)||e.isWebrtc&&Aa(e.isWebrtcH265)?e.useCanvasRender?en:tn:e.isAliyunRtc?tn:e.useWCS?e.playType===w?sn:!e.useOffscreen&&e.wcsUseVideoRender?tn:en:e.playType===w?sn:e.wasmUseVideoRender&&!e.useOffscreen?tn:en}}class on extends o{constructor(e){super(),this.bufferList=[],this.player=e,this.$audio=null,this.scriptNode=null,this.workletProcessorNode=null,this.workletWorkerCloseTimeout=null,this.hasInitScriptNode=!1,this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:Tr}),this.gainNode=this.audioContext.createGain();const t=this.audioContext.createBufferSource();t.buffer=this.audioContext.createBuffer(1,1,22050),t.connect(this.audioContext.destination),t.noteOn?t.noteOn(0):t.start(0),this.audioBufferSourceNode=t,this.mediaStreamAudioDestinationNode=this.audioContext.createMediaStreamDestination(),this.gainNode.gain.value=0,this._prevVolume=null,this.playing=!1,this.audioInfo={encTypeCode:"",encType:"",channels:"",sampleRate:"",depth:""},this.init=!1,this.hasAudio=!1,this.audioResumeStateTimeout=null,this.audioContextContextResumeLock=!1}async destroy(){return this.closeAudio(),this.resetInit(),this.clearAudioResumeStateTimeout(),this.audioContext&&(await this.audioContext.close(),this.audioContext=null),this.gainNode&&(this.gainNode.disconnect(),this.gainNode=null),this.hasAudio=!1,this.playing=!1,this.scriptNode&&(this.scriptNode.disconnect(),this.scriptNode.onaudioprocess=to,this.scriptNode=null),await this._destroyWorklet(),this.workletProcessorNode&&(this.workletProcessorNode.disconnect(),this.workletProcessorNode.port.onmessage=to,this.workletProcessorNode=null),this.audioBufferSourceNode&&(this.audioBufferSourceNode.stop(),this.audioBufferSourceNode=null),this.mediaStreamAudioDestinationNode&&(this.mediaStreamAudioDestinationNode.disconnect(),this.mediaStreamAudioDestinationNode=null),this.hasInitScriptNode=!1,this._prevVolume=null,this.audioContextContextResumeLock=!1,this.off(),!0}_destroyWorklet(){return new Promise(((e,t)=>{this.workletProcessorNode?(this.workletProcessorNode.port.postMessage({type:"destroy"}),this.workletWorkerCloseTimeout=setTimeout((()=>{this.player.debugLog(this.TAG_NAME,"send close and wait 10ms destroy directly"),this.workletWorkerCloseTimeout&&(clearTimeout(this.workletWorkerCloseTimeout),this.workletWorkerCloseTimeout=null),e()}),10)):e()}))}resetInit(){this.audioInfo={encTypeCode:"",encType:"",channels:"",sampleRate:"",depth:""},this.init=!1}getAudioInfo(){return this.audioInfo}updateAudioInfo(e){e.encTypeCode&&(this.audioInfo.encTypeCode=e.encTypeCode,this.audioInfo.encType=kt[e.encTypeCode]),e.channels&&(this.audioInfo.channels=e.channels),e.sampleRate&&(this.audioInfo.sampleRate=e.sampleRate),e.depth&&(this.audioInfo.depth=e.depth),this.audioInfo.sampleRate&&this.audioInfo.channels&&this.audioInfo.encType&&!this.init&&(this.player.emit(at.audioInfo,this.audioInfo),this.init=!0)}get isPlaying(){return this.playing}get isMute(){return 0===this.gainNode.gain.value||this.isStateSuspended()}get volume(){return this.gainNode.gain.value}get bufferSize(){return this.bufferList.length}get audioContextState(){let e=null;return this.audioContext&&(e=this.audioContext.state),e}initScriptNode(){}initMobileScriptNode(){}initWorkletScriptNode(){}getEngineType(){return""}mute(e){e?(this.setVolume(0),this.clear()):this.setVolume(this.player.lastVolume||.5)}setVolume(e){e=parseFloat(e).toFixed(2),isNaN(e)||(this.audioEnabled(!0),e=ao(e,0,1),null!==this._prevVolume&&this._prevVolume===e||(null===this._prevVolume?this.player.emit(at.mute,0===e):0===this._prevVolume&&e>0?this.player.emit(at.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(at.mute,!0),this.gainNode.gain.value=e,this.player.emit(at.volumechange,this.player.volume),this.player.emit(at.volume,this.player.volume),this._prevVolume=e))}closeAudio(){this.hasInitScriptNode&&(this.scriptNode&&this.scriptNode.disconnect(this.gainNode),this.workletProcessorNode&&this.workletProcessorNode.disconnect(this.gainNode),this.gainNode&&(this.gainNode.disconnect(this.mediaStreamAudioDestinationNode),this.$audio||this.gainNode.disconnect(this.audioContext.destination))),this.clear()}audioEnabled(e){if(e&&this.isStateSuspended()){if(this.audioContextContextResumeLock)return;this.audioContextContextResumeLock=!0,this.audioContext.resume().then((()=>{this.player.emit(at.audioResumeState,{state:this.audioContextState,isRunning:this.isStateRunning()})})).finally((()=>{this.audioContextContextResumeLock=!1})),this.audioResumeStateTimeout=setTimeout((()=>{this.clearAudioResumeStateTimeout(),this.audioContextContextResumeLock=!1,this.isStateSuspended()&&this.player.emit(at.audioResumeState,{state:this.audioContextState,isRunning:this.isStateRunning()})}),1e3)}}isStateRunning(){return"running"===this.audioContextState}isStateSuspended(){return"suspended"===this.audioContextState}clearAudioResumeStateTimeout(){this.audioResumeStateTimeout&&(clearTimeout(this.audioResumeStateTimeout),this.audioResumeStateTimeout=null)}clear(){this.bufferList=[]}play(e,t){}pause(){this.playing=!1}resume(){this.playing=!0}setRate(e){}getAudioBufferSize(){return 0}}class an{constructor(e,t,i,s){this.player=e,this.audio=t,this.channel=i,this.bufferSize=s}destroy(){this.buffer=null,this.channel=null}extract(e,t){let i=this.provide(t);for(let t=0;t=a){try{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:0;const s=2*(t=t||0);i>=0||(i=(e.length-s)/2);const r=2*i;this.ensureCapacity(i+this._frameCount);const o=this.endIndex;this.vector.set(e.subarray(s,s+r),o),this._frameCount+=i}putBuffer(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t=t||0,i>=0||(i=e.frameCount-t),this.putSamples(e.vector,e.position+t,i)}receive(e){e>=0&&!(e>this._frameCount)||(e=this.frameCount),this._frameCount-=e,this._position+=e}receiveSamples(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=2*t,s=this.startIndex;e.set(this._vector.subarray(s,s+i)),this.receive(t)}extract(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.startIndex+2*t,r=2*i;e.set(this._vector.subarray(s,s+r))}ensureCapacity(){const e=parseInt(2*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0));if(this._vector.length0&&void 0!==arguments[0]?arguments[0]:0;this.ensureCapacity(this._frameCount+e)}rewind(){this._position>0&&(this._vector.set(this._vector.subarray(this.startIndex,this.endIndex)),this._position=0)}}class ln{constructor(e){e?(this._inputBuffer=new nn,this._outputBuffer=new nn):this._inputBuffer=this._outputBuffer=null}destroy(){this.clear(),this._outputBuffer&&(this._outputBuffer.destroy(),this._outputBuffer=null),this._inputBuffer&&(this._inputBuffer.destroy(),this._inputBuffer=null)}get inputBuffer(){return this._inputBuffer}set inputBuffer(e){this._inputBuffer=e}get outputBuffer(){return this._outputBuffer}set outputBuffer(e){this._outputBuffer=e}clear(){this._inputBuffer.clear(),this._outputBuffer.clear()}}class dn extends ln{constructor(e){super(e),this.reset(),this._rate=1}destroy(){super.destroy()}set rate(e){this._rate=e}reset(){this.slopeCount=0,this.prevSampleL=0,this.prevSampleR=0}clone(){const e=new dn;return e.rate=this._rate,e}process(){const e=this._inputBuffer.frameCount;this._outputBuffer.ensureAdditionalCapacity(e/this._rate+1);const t=this.transpose(e);this._inputBuffer.receive(),this._outputBuffer.put(t)}transpose(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(0===e)return 0;const t=this._inputBuffer.vector,i=this._inputBuffer.startIndex,s=this._outputBuffer.vector,r=this._outputBuffer.endIndex;let o=0,a=0;for(;this.slopeCount<1;)s[r+2*a]=(1-this.slopeCount)*this.prevSampleL+this.slopeCount*t[i],s[r+2*a+1]=(1-this.slopeCount)*this.prevSampleR+this.slopeCount*t[i+1],a+=1,this.slopeCount+=this._rate;if(this.slopeCount-=1,1!==e)e:for(;;){for(;this.slopeCount>1;)if(this.slopeCount-=1,o+=1,o>=e-1)break e;const n=i+2*o;s[r+2*a]=(1-this.slopeCount)*t[n]+this.slopeCount*t[n+2],s[r+2*a+1]=(1-this.slopeCount)*t[n+1]+this.slopeCount*t[n+3],a+=1,this.slopeCount+=this._rate}return this.prevSampleL=t[i+2*e-2],this.prevSampleR=t[i+2*e-1],a}}const hn=function(){};class cn extends class{constructor(e){this._pipe=e}destroy(){}get pipe(){return this._pipe}get inputBuffer(){return this._pipe.inputBuffer}get outputBuffer(){return this._pipe.outputBuffer}fillInputBuffer(){throw new Error("fillInputBuffer() not overridden")}fillOutputBuffer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;for(;this.outputBuffer.frameCount2&&void 0!==arguments[2]?arguments[2]:hn;super(t),this.callback=i,this.sourceSound=e,this.historyBufferSize=22050,this._sourcePosition=0,this.outputBufferPosition=0,this._position=0}destroy(){this.clear(),this.sourceSound.destroy(),this.sourceSound=null,this._sourcePosition=0,this.outputBufferPosition=0,this._position=0}get position(){return this._position}set position(e){if(e>this._position)throw new RangeError("New position may not be greater than current position");const t=this.outputBufferPosition-(this._position-e);if(t<0)throw new RangeError("New position falls outside of history buffer");this.outputBufferPosition=t,this._position=e}get sourcePosition(){return this._sourcePosition}set sourcePosition(e){this.clear(),this._sourcePosition=e}onEnd(){this.callback()}fillInputBuffer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=new Float32Array(2*e),i=this.sourceSound.extract(t,e,this._sourcePosition);this._sourcePosition+=i,this.inputBuffer.putSamples(t,0,i)}extract(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillOutputBuffer(this.outputBufferPosition+t);const i=Math.min(t,this.outputBuffer.frameCount-this.outputBufferPosition);this.outputBuffer.extract(e,this.outputBufferPosition,i);const s=this.outputBufferPosition+i;return this.outputBufferPosition=Math.min(this.historyBufferSize,s),this.outputBuffer.receive(Math.max(s-this.historyBufferSize,0)),this._position+=i,i}handleSampleData(e){this.extract(e.data,4096)}clear(){super.clear(),this.outputBufferPosition=0}}const un=[[124,186,248,310,372,434,496,558,620,682,744,806,868,930,992,1054,1116,1178,1240,1302,1364,1426,1488,0],[-100,-75,-50,-25,25,50,75,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-20,-15,-10,-5,5,10,15,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-4,-3,-2,-1,1,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],pn=-10/1.5;class fn extends ln{constructor(e){super(e),this._quickSeek=!0,this.midBufferDirty=!1,this.midBuffer=null,this.refMidBuffer=null,this.overlapLength=0,this.autoSeqSetting=!0,this.autoSeekSetting=!0,this._tempo=1,this.setParameters(44100,0,0,8)}destroy(){this.clear(),super.destroy()}clear(){super.clear(),this.clearMidBuffer(),this.refMidBuffer=null}clearMidBuffer(){this.midBufferDirty&&(this.midBufferDirty=!1),this.midBuffer=null}setParameters(e,t,i,s){e>0&&(this.sampleRate=e),s>0&&(this.overlapMs=s),t>0?(this.sequenceMs=t,this.autoSeqSetting=!1):this.autoSeqSetting=!0,i>0?(this.seekWindowMs=i,this.autoSeekSetting=!1):this.autoSeekSetting=!0,this.calculateSequenceParameters(),this.calculateOverlapLength(this.overlapMs),this.tempo=this._tempo}set tempo(e){let t;this._tempo=e,this.calculateSequenceParameters(),this.nominalSkip=this._tempo*(this.seekWindowLength-this.overlapLength),this.skipFract=0,t=Math.floor(this.nominalSkip+.5),this.sampleReq=Math.max(t+this.overlapLength,this.seekWindowLength)+this.seekLength}get tempo(){return this._tempo}get inputChunkSize(){return this.sampleReq}get outputChunkSize(){return this.overlapLength+Math.max(0,this.seekWindowLength-2*this.overlapLength)}calculateOverlapLength(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;e=this.sampleRate*t/1e3,e=e<16?16:e,e-=e%8,this.overlapLength=e,this.refMidBuffer=new Float32Array(2*this.overlapLength),this.midBuffer=new Float32Array(2*this.overlapLength)}checkLimits(e,t,i){return ei?i:e}calculateSequenceParameters(){let e,t;this.autoSeqSetting&&(e=150+-50*this._tempo,e=this.checkLimits(e,50,125),this.sequenceMs=Math.floor(e+.5)),this.autoSeekSetting&&(t=28.333333333333332+pn*this._tempo,t=this.checkLimits(t,15,25),this.seekWindowMs=Math.floor(t+.5)),this.seekWindowLength=Math.floor(this.sampleRate*this.sequenceMs/1e3),this.seekLength=Math.floor(this.sampleRate*this.seekWindowMs/1e3)}set quickSeek(e){this._quickSeek=e}clone(){const e=new fn;return e.tempo=this._tempo,e.setParameters(this.sampleRate,this.sequenceMs,this.seekWindowMs,this.overlapMs),e}seekBestOverlapPosition(){return this._quickSeek?this.seekBestOverlapPositionStereoQuick():this.seekBestOverlapPositionStereo()}seekBestOverlapPositionStereo(){let e,t,i,s=0;for(this.preCalculateCorrelationReferenceStereo(),e=0,t=Number.MIN_VALUE;st&&(t=i,e=s);return e}seekBestOverlapPositionStereoQuick(){let e,t,i,s,r,o=0;for(this.preCalculateCorrelationReferenceStereo(),t=Number.MIN_VALUE,e=0,s=0,r=0;o<4;o+=1){let a=0;for(;un[o][a]&&(r=s+un[o][a],!(r>=this.seekLength));)i=this.calculateCrossCorrelationStereo(2*r,this.refMidBuffer),i>t&&(t=i,e=r),a+=1;s=e}return e}preCalculateCorrelationReferenceStereo(){let e,t,i=0;for(;i=this.sampleReq;){e=this.seekBestOverlapPosition(),this._outputBuffer.ensureAdditionalCapacity(this.overlapLength),this.overlap(Math.floor(e)),this._outputBuffer.put(this.overlapLength),t=this.seekWindowLength-2*this.overlapLength,t>0&&this._outputBuffer.putBuffer(this._inputBuffer,e+this.overlapLength,t);const s=this._inputBuffer.startIndex+2*(e+this.seekWindowLength-this.overlapLength);this.midBuffer.set(this._inputBuffer.vector.subarray(s,s+2*this.overlapLength)),this.skipFract+=this.nominalSkip,i=Math.floor(this.skipFract),this.skipFract-=i,this._inputBuffer.receive(i)}}}const mn=function(e,t){return(e>t?e-t:t-e)>1e-10};class gn{constructor(){this.transposer=new dn(!1),this.stretch=new fn(!1),this._inputBuffer=new nn,this._intermediateBuffer=new nn,this._outputBuffer=new nn,this._rate=0,this._tempo=0,this.virtualPitch=1,this.virtualRate=1,this.virtualTempo=1,this.calculateEffectiveRateAndTempo()}destroy(){this.clear(),this._inputBuffer.destroy(),this._intermediateBuffer.destroy(),this._outputBuffer.destroy(),this._inputBuffer=null,this._intermediateBuffer=null,this._outputBuffer=null}clear(){this.transposer.clear(),this.stretch.clear()}clone(){const e=new gn;return e.rate=this.rate,e.tempo=this.tempo,e}get rate(){return this._rate}set rate(e){this.virtualRate=e,this.calculateEffectiveRateAndTempo()}set rateChange(e){this._rate=1+.01*e}get tempo(){return this._tempo}set tempo(e){this.virtualTempo=e,this.calculateEffectiveRateAndTempo()}set tempoChange(e){this.tempo=1+.01*e}set pitch(e){this.virtualPitch=e,this.calculateEffectiveRateAndTempo()}set pitchOctaves(e){this.pitch=Math.exp(.69314718056*e),this.calculateEffectiveRateAndTempo()}set pitchSemitones(e){this.pitchOctaves=e/12}get inputBuffer(){return this._inputBuffer}get outputBuffer(){return this._outputBuffer}calculateEffectiveRateAndTempo(){const e=this._tempo,t=this._rate;this._tempo=this.virtualTempo/this.virtualPitch,this._rate=this.virtualRate*this.virtualPitch,mn(this._tempo,e)&&(this.stretch.tempo=this._tempo),mn(this._rate,t)&&(this.transposer.rate=this._rate),this._rate>1?this._outputBuffer!=this.transposer.outputBuffer&&(this.stretch.inputBuffer=this._inputBuffer,this.stretch.outputBuffer=this._intermediateBuffer,this.transposer.inputBuffer=this._intermediateBuffer,this.transposer.outputBuffer=this._outputBuffer):this._outputBuffer!=this.stretch.outputBuffer&&(this.transposer.inputBuffer=this._inputBuffer,this.transposer.outputBuffer=this._intermediateBuffer,this.stretch.inputBuffer=this._intermediateBuffer,this.stretch.outputBuffer=this._outputBuffer)}process(){this._rate>1?(this.stretch.process(),this.transposer.process()):(this.transposer.process(),this.stretch.process())}}class yn{constructor(e,t,i){this.player=e,this.audio=t,this.soundTouch=new gn,this.soundTouch.tempo=1,this.soundTouch.rate=1,this.filter=new cn(i,this.soundTouch)}destroy(){this.filter&&(this.filter.destroy(),this.filter=null),this.soundTouch&&(this.soundTouch.destroy(),this.soundTouch=null)}setRate(e){e!==this.soundTouch.rate&&(this.soundTouch.tempo=e)}provide(e){let t=new Float32Array(2*e),i=this.filter.extract(t,e),s=new Float32Array(i),r=new Float32Array(i);for(let e=0;e{e()})),this.eventListenList=[]),this.$audio&&(this.$audio.pause(),this.$audio.srcObject=null,this.$audio.parentNode&&this.$audio.parentNode.removeChild(this.$audio),this.$audio=null),this.processor&&(this.processor.destroy(),this.processor=null),this.rateProcessor&&(this.rateProcessor.destroy(),this.rateProcessor=null),this.scriptNodeInterval&&(clearInterval(this.scriptNodeInterval),this.scriptNodeInterval=null),this.defaultPlaybackRate=1,this.playbackRate=1,this.scriptStartTime=0,this.audioBufferSize=0,this.engineType=_s,this.player.debugLog("AudioContext","destroy"),!0}isAudioPlaying(){return this.$audio&&Aa(this.$audio.paused)&&Aa(this.$audio.ended)&&0!==this.$audio.playbackRate&&0!==this.$audio.readyState}_bindAudioProxy(){const{proxy:e}=this.player.events,t=e(this.$audio,"canplay",(()=>{this.player.debugLog("AudioContext","canplay"),this._delayPlay&&this._audioElementPlay()}));this.eventListenList.push(t)}_getAudioElementReadyState(){let e=0;return this.$audio&&(e=this.$audio.readyState),e}audioElementPlay(){if(this.$audio){const e=this._getAudioElementReadyState();if(this.player.debugLog("AudioContext",`play and readyState: ${e}`),!(0!==e||Yo()&&bo()))return this.player.debugWarn("AudioContext","readyState is 0 and set _delayPlay to true"),void(this._delayPlay=!0);this._audioElementPlay()}}_audioElementPlay(){this.$audio&&this.$audio.play().then((()=>{this._delayPlay=!1,this.player.debugLog("AudioContext","_audioElementPlay success"),setTimeout((()=>{this.isAudioPlaying()||(this.player.debugWarn("AudioContext","play failed and retry play"),this._audioElementPlay())}),100),this.isAudioPlaying()&&(this.player.debugLog("AudioContext","play success and remove document click event listener"),document.removeEventListener("click",this._audioElementPlay.bind(this)))})).catch((e=>{this.player.debugError("AudioContext","_audioElementPlay error",e),document.addEventListener("click",this._audioElementPlay.bind(this))}))}getAudioBufferSize(){return this.audioBufferSize}get oneBufferDuration(){return this.audioBufferSize/this.audioContext.sampleRate*1e3}get isActiveEngineType(){return this.engineType===ws}getBufferListDuration(){return this.bufferList.length*this.oneBufferDuration}isMoreThanMinBufferDuration(){return this.getBufferListDuration()>=100*this.playbackRate}initProcessor(){this.processor=new an(this.player,this,this.audioInfo.channels,this.audioBufferSize),this.rateProcessor=new yn(this.player,this,this.processor)}getAutoAudioEngineType(){let e=this.player._opt.audioEngine||_s;const t=()=>{e=Yo()&&go()?ws:(bo()&&this.player._opt.supportLockScreenPlayAudio||na()&&this.supportAudioWorklet(),_s)};return this.player._opt.audioEngine?this.player._opt.audioEngine===vs&&na()&&this.supportAudioWorklet()?e=_s:this.player._opt.audioEngine===ws?e=ws:this.player._opt.audioEngine===_s?e=_s:t():t(),e}getAudioBufferSizeByType(){const e=this.engineType;this.player._opt.hasVideo;const t=this.player._opt.weiXinInAndroidAudioBufferSize;return e===vs?1024:e===ws?t||4800:1024}supportAudioWorklet(){return this.audioContext&&this.audioContext.audioWorklet&&"function"==typeof this.audioContext.audioWorklet.addModule}initScriptNode(){this.playing=!0,this.hasInitScriptNode||(this.initProcessor(),this.engineType===vs?this.initWorkletScriptNode():this.engineType===ws?this.initIntervalScriptNode():this.engineType===_s&&this.initProcessScriptNode(),this.audioElementPlay())}getEngineType(){return this.engineType}isPlaybackRateSpeed(){return this.playbackRate>this.defaultPlaybackRate}initProcessScriptNode(){const e=this.audioContext.createScriptProcessor(this.audioBufferSize,0,this.audioInfo.channels);e.onaudioprocess=e=>{const t=e.outputBuffer;this.handleScriptNodeCallback(t)},e.connect(this.gainNode),this.scriptNode=e,this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.$audio?this.$audio.srcObject=this.mediaStreamAudioDestinationNode.stream:this.gainNode.connect(this.audioContext.destination),this.hasInitScriptNode=!0}initIntervalScriptNode(){this.scriptStartTime=0;const e=1e3*this.audioBufferSize/this.audioContext.sampleRate;this.scriptNodeInterval=setInterval((()=>{if(0===this.bufferList.length||Aa(this.playing)||this.isMute)return void(this.playing&&Aa(this.isMute)&&this.player.debugLog("AudioContext",`interval script node and bufferList is ${this.bufferList.length} or playing is ${this.playing}`));const e=this.audioContext.createBufferSource(),t=this.audioContext.createBuffer(this.audioInfo.channels,this.audioBufferSize,this.audioContext.sampleRate);this.handleScriptNodeCallback(t,(()=>{this.scriptStartTime{"init"===e.data.message?(this.audioBufferSize=e.data.audioBufferSize,this.start=e.data.start,this.channels=e.data.channels,this.state=0,this.offset=0,this.samplesArray=[]):"stop"===e.data.message?(this.state=0,this.start=!1,this.offset=0,this.samplesArray=[]):"data"===e.data.message?this.samplesArray.push(e.data.buffer):"zero"===e.data.message&&this.samplesArray.push({left:new Float32Array(this.audioBufferSize).fill(0),right:new Float32Array(this.audioBufferSize).fill(0)})}}process(e,t,i){const s=t[0][0],r=t[0][1];if(0===this.offset&&this.port.postMessage({message:"beep"}),0===this.state)this.state=1;else if(1===this.state&&this.samplesArray.length>=4)this.state=2;else if(2===this.state){const e=this.samplesArray[0];for(let t=0;t{if(this.player.isDestroyedOrClosed())return void this.player.debugLog("AudioContext","initWorkletScriptNode() player is destroyed");if(!this.audioContext)return void this.player.debugWarn("AudioContext","initWorkletScriptNode audioContext is null");let e=[1];2===this.audioInfo.channels&&(e=[1,1]);try{this.workletProcessorNode=new AudioWorkletNode(this.audioContext,"worklet-processor",{numberOfOutputs:this.audioInfo.channels,outputChannelCount:e})}catch(e){this.player.debugError("AudioContext","initWorkletScriptNode error",e),this.workletProcessorNode=null,this.tierDownToProcessScript()}this.workletProcessorNode&&(this.workletProcessorNode.connect(this.gainNode),this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.$audio?this.$audio.srcObject=this.mediaStreamAudioDestinationNode.stream:this.gainNode.connect(this.audioContext.destination),this.hasInitScriptNode=!0,this.workletProcessorNode.port.postMessage({message:"init",audioBufferSize:this.audioBufferSize,start:!0,channels:this.audioInfo.channels}),this.workletProcessorNode.port.onmessage=e=>{this.workletProcessorNode?this.audioContext?this.handleScriptNodeCallback(this.workletProcessorNode,null,!0):this.workletProcessorNode.port.postMessage({message:"zero"}):this.player.debugError("AudioContext","workletProcessorNode is null")})})),this.clearWorkletUrlTimeout=setTimeout((()=>{URL.revokeObjectURL(this.workletUrl),this.workletUrl=null,this.clearWorkletUrlTimeout=null}),ie)}tierDownToProcessScript(){this.player.debugLog("AudioContext","tierDownToProcessScript"),this.engineType=_s,this.audioBufferSize=this.getAudioBufferSizeByType(),this.initProcessScriptNode(),this.audioElementPlay()}handleScriptNodeCallback(e,t){let i,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t=t||to;let r=e.length;s&&(i=e,r=this.audioBufferSize);const o=this.audioInfo.channels;if(this.playing&&this.isMoreThanMinBufferDuration()){if(this.player._opt,this.player.openSyncAudioAndVideo()&&ya(this.player.visibility)){this.calcPlaybackRateBySync();const r=this.player.getAudioSyncVideoDiff();if(r>this.player._opt.syncAudioAndVideoDiff){const a=this.player.getCurrentVideoAndAudio();return this.player.debugWarn("AudioContext",`audioSyncVideoOption more than diff :${r},\n and video is ${a.video} ,\n and audio is ${a.audio} , waiting and bufferList is ${this.bufferList.length}, fill zero`),s?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,o),void t()}}let a=this._provide(r);if(0===a.size)return Aa(this.player.isPlaybackOnlyDecodeIFrame())&&this.player.debugWarn("AudioContext",`bufferList size is ${this.bufferList.length} outputBufferLength is ${r},and bufferItem.size is 0, fill zero`),s?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,o),void t();a&&a.ts&&(this.player.audioTimestamp=a.ts),s?i.port.postMessage({message:"data",buffer:a}):this.fillScriptNodeOutputBuffer(e,o,a),t()}else 0===this.bufferList.length&&this.playing&&Aa(this.isMute)&&Aa(this.player.isPlaybackOnlyDecodeIFrame())&&this.player.debugWarn("AudioContext",`bufferList size is 0 and outputBufferLength is ${r}, fill zero`),s?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,o),t()}fillScriptNodeOutputBuffer(e,t,i){if(1===t){const t=e.getChannelData(0);i?0===i.size?t.fill(0):t.set(i.left):t.fill(0)}else if(2===t){const t=e.getChannelData(0),s=e.getChannelData(1);i?0===i.size?(t.fill(0),s.fill(0)):(t.set(i.left),s.set(i.right)):(t.fill(0),s.fill(0))}}play(e,t){this.isMute||(this.hasInitScriptNode?(this.hasAudio=!0,this.player.latestAudioTimestamp=t,this.bufferList.push({buffer:e,ts:t}),Aa(this.player.openSyncAudioAndVideo())&&this.calcPlaybackRateByBuffer()):this.player.debugWarn("AudioContext","play has not init script node"))}calcPlaybackRateBySync(){if(this.isMute)return;if(!this.playing)return;const e=Math.floor(2e3/this.oneBufferDuration);if(this.bufferList.length>e)return this.player.debugWarn("AudioContext",`bufferList length ${this.bufferList.length} more than ${e}, and drop`),void this.clear();const t=this.player.getAudioSyncVideoDiff();if(this.getEngineType()===ws){if(t<-this.player._opt.syncAudioAndVideoDiff){this.player.debugWarn("AudioContext",`engine active , audioSyncVideoOption ${-this.player._opt.syncAudioAndVideoDiff} less than diff :${t},\n and bufferlist is ${this.bufferList.length}`);const e=this.player.getRenderCurrentPts();for(;this.bufferList.length>0;){const t=this.bufferList[0],i=t.ts-e;if(i>-this.player._opt.syncAudioAndVideoDiff/2){this.player.audioTimestamp=t.ts,this.player.debugLog("AudioContext",`engine active , audioSyncVideoOption\n item.ts is ${t.ts} and currentVideoTimestamp is ${e}, diff is ${i} > -${this.player._opt.syncAudioAndVideoDiff/2} and end`);break}this.bufferList.shift(),this.player.audioTimestamp=t.ts}}}else{let e=this.playbackRate;t<-this.player._opt.syncAudioAndVideoDiff?e===this.defaultPlaybackRate&&(this.player.debugLog("AudioContext",`audioSyncVideoOption ${-this.player._opt.syncAudioAndVideoDiff} less than diff :${t},\n speed up, playbackRate is ${e},\n and bufferList is ${this.bufferList.length}`),e=this.defaultPlaybackRate+.2):t>-this.player._opt.syncAudioAndVideoDiff/2&&e!==this.defaultPlaybackRate&&(this.player.debugLog("AudioContext",`diff is ${t} > -${this.player._opt.syncAudioAndVideoDiff/2} and speed to 1`),e=this.defaultPlaybackRate),this.updatePlaybackRate(e)}}calcPlaybackRateByBuffer(){if(this.isMute)return;if(!this.playing)return;let e=this.playbackRate,t=1e3,i=5e3;this.isAudioPlayer&&(t=this.player._opt.videoBufferDelay,i=this.player._opt.videoBufferMax);const s=Math.floor(t/this.oneBufferDuration),r=Math.floor(i/this.oneBufferDuration);if(this.bufferList.length>r)return this.player.debugWarn("AudioContext",`bufferList length ${this.bufferList.length} more than ${r}, and drop`),void this.clear();this.getEngineType()!==ws&&(this.bufferList.length>s?(e=this.defaultPlaybackRate+.2,this.player.debugLog("AudioContext",`bufferList length ${this.bufferList.length} more than ${s}, speed up, playbackRate is ${e}`)):this.bufferList.length0?this.player.emit(at.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(at.mute,!0),this.$video.volume=e,this.player.emit(at.volumechange,this.player.volume),this.player.emit(at.volume,this.player.volume),this._prevVolume=e))}clear(){}play(e,t){const i=this.player.video.awriter;if(i)if(e.close)try{i.write(e),aa(e)}catch(e){this.player.debugError("Video","play audio error",e)}else try{const s=function(e,t){const i={...t,format:"f32-planar",data:new Float32Array(0)};if(i.numberOfFrames=e[0].length,1===e.length)i.data=new Float32Array(e[0]);else if(2===e.length){const t=new Float32Array(e[0].length+e[1].length);t.set(e[0],0),t.set(e[1],e[0].length),i.data=t}return new AudioData(i)}(e,{sampleRate:Tr,numberOfChannels:this.audioInfo.channels,timestamp:1e3*t});i.write(s),aa(s)}catch(e){this.player.debugError("Video","play audio error",e)}else this.player.debugWarn("Audio","play and this.awriter is null")}pause(){}resume(){}getEngineType(){return"audio"}isPlaybackRateSpeed(){return!1}setRate(){}initScriptNode(){}initScriptNodeDelay(){}audioEnabled(){this.mute(!1)}getAudioBufferSize(){return 2048}}class vn extends An{constructor(e){super(e),this.delayTimeout=null,this.player.on(at.playbackPause,(e=>{this.listenPlaybackPause(e)})),this.player.debugLog("AudioPlaybackContext","init")}async destroy(){return this.delayTimeout&&(clearTimeout(this.delayTimeout),this.delayTimeout=null),await super.destroy(),this.player.debugLog("AudioPlaybackLoader","destroy"),!0}listenPlaybackPause(e){e?(this.pause(),this.player.playback.isPlaybackPauseClearCache&&this.clear()):this.resume()}initScriptNodeDelay(){const e=this.player._opt.playbackDelayTime;e>0?this.delayTimeout=setTimeout((()=>{this.initScriptNode()}),e):this.initScriptNode()}setRate(e){e!==this.defaultPlaybackRate&&this.rateProcessor&&(this.player.debugLog("AudioPlaybackContext","setRate",e),this.defaultPlaybackRate=e,this.updatePlaybackRate(e))}}class _n extends An{constructor(e){super(e),this.TAG_NAME="AudioPlayerLoader",this.isAudioPlayer=!0,this.player.debugLog(this.TAG_NAME,"init")}async destroy(){return await super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy"),!0}play(e,t){Aa(this.playing)||super.play(e,t)}pause(){this.player.debugLog(this.TAG_NAME,"pause"),this.playing=!1,this.clear()}resume(){this.player.debugLog(this.TAG_NAME,"resume"),this.playing=!0}}class wn extends o{constructor(e){super(),this.TAG_NAME="AudioWebrtcPlayerLoader",this.$video=new Audio,this.player=e,this.init=!1,this._prevVolume=null,this.eventsDestroy=[],this._handleDocumentClickPlay=this._handleClickPlay.bind(this),this._initAudioEvents(),this.player.debugLog(this.TAG_NAME,"init")}async destroy(){return this.resetInit(),this.off(),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this._prevVolume=null,this.$video&&(this.$video.pause(),this.$video.srcObject=null,this.$video=null),this.player.debugLog(this.TAG_NAME,"destroy"),!0}_initAudioEvents(){const{proxy:e}=this.player.events,t=e(this.$video,"timeupdate",(e=>{const t=parseInt(e.timeStamp,10);this.player.handleRender(),this.player.updateStats({ts:t})}));this.eventsDestroy.push(t)}resetInit(){this.init=!1}_handleClickPlay(){this.$video&&(this.$video.play(),document.removeEventListener("click",this._handleDocumentClickPlay))}bindStream(e){this.$video.srcObject=e,this.$video.volume=1,this.$video.play().catch((e=>{this.player.debugWarn(this.TAG_NAME,"audio play error",e),document.addEventListener("click",this._handleDocumentClickPlay)}))}getEngineType(){return"audio"}get isPlaying(){return!0}get volume(){return ya(this.$video.muted)?0:this.$video.volume}get isMute(){return 0===this.$video.volume||ya(this.$video.muted)}mute(e){this.setVolume(e?0:this.player.lastVolume||.5)}setVolume(e){e=parseFloat(e),isNaN(e)||null===this.$video||(this.$video.muted&&(this.$video.muted=!1),e=ao(e,0,1),bo()&&(this.$video.muted=0===e),null!==this._prevVolume&&this._prevVolume===e||(null===this._prevVolume?this.player.emit(at.mute,0===e):0===this._prevVolume&&e>0?this.player.emit(at.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(at.mute,!0),this.$video.volume=e,this.player.emit(at.volumechange,this.player.volume),this.player.emit(at.volume,this.player.volume),this._prevVolume=e))}pause(){}resume(){}audioEnabled(){this.mute(!1)}}class Sn{constructor(e){return new(Sn.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.playType===w?e.useMSE&&e.mseDecodeAudio?bn:vn:e.playType===_?e.isWebrtc?wn:_n:e.isHls&&Aa(e.supportHls265)||e.isWebrtc&&Aa(e.isWebrtcH265)||e.useMSE&&e.mseDecodeAudio||e.isAliyunRtc||e.useWCS&&e.wcsDecodeAudio||e.useWasm&&e.wasmPlayAudioUseVideoRender?bn:An}}class En extends o{constructor(e){super(),this.player=e,this.playing=!1,this._requestAbort=!1,this._status=Xs,this.writableStream=null,this.abortController=new AbortController,this.streamRate=co((t=>{e.emit(at.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,e.debugLog("FetchStream","init")}async destroy(){return this.abort(),await this._closeWritableStream(),this.off(),this._status=Xs,this.streamRate=null,this.stopStreamRateInterval(),this.player.debugLog("FetchStream","destroy"),!0}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}async _closeWritableStream(){if(this.writableStream&&Aa(this.writableStream.locked))try{await this.writableStream.close(),this.writableStream=null,this.player.debugLog("FetchStream","close writableStream success")}catch(e){this.player.debugLog("FetchStream","destroy and writableStream.close()",e)}}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{demux:i}=this.player;this.player._times.streamStart=oo();const s=Object.assign({signal:this.abortController.signal},{headers:t.headers||{}});fetch(e,s).then((e=>{if(this._requestAbort)return this._status=Xs,void e.body.cancel();if(!function(e){return e.ok&&e.status>=200&&e.status<=299}(e))return this.player.debugError("FetchStream",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),this.abort(),void this.emit(dt.fetchError,`fetch response status is ${e.status} and ok is ${e.ok}`);if(this.emit(at.streamSuccess),this.startStreamRateInterval(),"undefined"!=typeof WritableStream)this.player.debugLog("FetchStream","use WritableStream() to read stream"),this.writableStream=new WritableStream({write:e=>this.abortController&&this.abortController.signal&&this.abortController.signal.aborted?(this.player.debugLog("FetchStream","writableStream.write() and this.abortController.signal.aborted so return"),void(this._status=er)):ya(this._requestAbort)?(this.player.debugLog("FetchStream","writableStream.write() and this._requestAbort is true so return"),this._status=er,void this.abort()):"string"!=typeof e?(this._status=Zs,this.streamRate&&this.streamRate(e.byteLength),i.dispatch(e)):void this.player.debugWarn("FetchStream",`writableStream.write() and value is "${e}" string so return`),close:()=>{this._status=er,i.close(),this.emit(at.streamEnd,"fetch done")},abort:e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return this.player.debugLog("FetchStream","writableStream.abort() and this.abortController.signal.aborted so return"),void(this._status=er);i.close();const t=e.toString();-1===t.indexOf(cs)&&-1===t.indexOf(us)&&e.name!==ps&&(this.abort(),this.emit(dt.fetchError,e))}}),e.body.pipeTo(this.writableStream).catch((e=>{"AbortError"!==e.name&&this.player.debugLog("FetchStream","res.body.pipeTo() error",e.name,e.toString())}));else{this.player.debugLog("FetchStream","not support WritableStream and use getReader() to read stream");const t=e.body.getReader(),s=()=>{t.read().then((e=>{let{done:t,value:r}=e;return t?(this._status=er,i.close(),void this.emit(at.streamEnd,"fetch done")):this.abortController&&this.abortController.signal&&this.abortController.signal.aborted?(this.player.debugLog("FetchStream","reader.read() and this.abortController.signal.aborted so return"),void(this._status=er)):ya(this._requestAbort)?(this.player.debugLog("FetchStream","reader.read() and this._requestAbort is true so return"),this._status=er,void this.abort()):void("string"!=typeof r?(this._status=Zs,this.streamRate&&this.streamRate(r.byteLength),i.dispatch(r),s()):this.player.debugWarn("FetchStream",`reader.read() and value is "${r}" string so return`))})).catch((e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return this.player.debugLog("FetchStream","reader.read().catch() and this.abortController.signal.aborted so return"),void(this._status=er);i.close();const t=e.toString();-1===t.indexOf(cs)&&-1===t.indexOf(us)&&e.name!==ps&&(this.abort(),this.emit(dt.fetchError,e))}))};s()}})).catch((e=>{this.abortController&&this.abortController.signal&&this.abortController.signal.aborted||"AbortError"!==e.name&&(i.close(),this.abort(),this.emit(dt.fetchError,e))}))}abort(){if(this._requestAbort=!0,this.abortController)try{this.abortController.abort(),this.abortController=null,this.player.debugLog("FetchStream","abortController.abort() success")}catch(e){this.abortController=null,this.player.debugLog("FetchStream","abortController.abort() error",e)}}getStreamType(){return p}}class Tn extends o{constructor(e){super(),this.TAG_NAME="FetchWorkerLoader",this.player=e,this.playing=!1,this.fetchWorker=null,this.workerClearTimeout=null,this.workerUrl=null,this.destroyResolve=null,this.decoderWorkerCloseTimeout=null,this.abortController=new AbortController,this.streamRate=co((t=>{e.emit(at.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,this._initFetchWorker(),e.debugLog(this.TAG_NAME,"init")}destroy(){return new Promise(((e,t)=>{this.fetchWorker?(this.player.debugLog(this.TAG_NAME,"send destroy"),this.fetchWorker.postMessage({cmd:et}),this.destroyResolve=e,this.decoderWorkerCloseTimeout=setTimeout((()=>{this.player.debugWarn(this.TAG_NAME,"send close but not response and destroy directly"),this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this._destroy(),setTimeout((()=>{e()}),0)}),2e3)):(this._destroy(),setTimeout((()=>{e()}),0))}))}_destroy(){this.off(),this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this.workerUrl&&(window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this._stopStreamRateInterval(),this.streamRate=null,this.fetchWorker&&(this.fetchWorker.terminate(),this.fetchWorker.onmessage=null,this.fetchWorker=null),this.destroyResolve&&(this.destroyResolve(),this.destroyResolve=null),this.player.debugLog(this.TAG_NAME,"destroy")}_initFetchWorker(){const e=Ta(function(){function e(e){return!0===e||"true"===e}const t="The user aborted a request",i="AbortError",s="AbortError",r="fetch",o="destroy",a="destroyEnd",n="buffer",l="fetchError",d="fetchClose",h="fetchSuccess",c="idle",u="buffering",p="complete";let f=new class{constructor(){this._requestAbort=!1,this._status=c,this.writableStream=null,this.isChrome=!1,this.abortController=new AbortController}destroy(){var e;this.abort(),this.writableStream&&(!1===(e=this.writableStream.locked)||"false"===e)&&this.writableStream.close().catch((e=>{})),this.writableStream=null,this._status=c}fetchStream(r){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=Object.assign({signal:this.abortController.signal},{headers:o.headers||{}});fetch(r,a).then((r=>{if(this._requestAbort)return this._status=c,void r.body.cancel();if(!function(e){return e.ok&&e.status>=200&&e.status<=299}(r))return this.abort(),void postMessage({cmd:l,message:`fetch response status is ${r.status} and ok is ${r.ok}`});if(postMessage({cmd:h}),"undefined"!=typeof WritableStream)this.writableStream=new WritableStream({write:t=>{if(!(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted))return e(this._requestAbort)?(this._status=p,void this.abort()):void("string"!=typeof t&&(this._status=u,postMessage({cmd:n,buffer:t},[t.buffer])));this._status=p},close:()=>{this._status=p,postMessage({cmd:d})},abort:e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return void(this._status=p);const r=e.toString();-1===r.indexOf(t)&&-1===r.indexOf(i)&&e.name!==s&&(this.abort(),postMessage({cmd:l,message:e.toString()}))}}),r.body.pipeTo(this.writableStream).catch((e=>{}));else{const o=r.body.getReader(),a=()=>{o.read().then((t=>{let{done:i,value:s}=t;return i?(this._status=p,void postMessage({cmd:d})):this.abortController&&this.abortController.signal&&this.abortController.signal.aborted?void(this._status=p):e(this._requestAbort)?(this._status=p,void this.abort()):void("string"!=typeof s&&(this._status=u,postMessage({cmd:n,buffer:s},[s.buffer]),a()))})).catch((e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return void(this._status=p);const r=e.toString();-1===r.indexOf(t)&&-1===r.indexOf(i)&&e.name!==s&&(this.abort(),postMessage({cmd:l,message:e.toString()}))}))};a()}})).catch((e=>{this.abortController&&this.abortController.signal&&this.abortController.signal.aborted||"AbortError"!==e.name&&(this.abort(),postMessage({cmd:l,message:e.toString()}))}))}abort(){if(this._requestAbort=!0,this.abortController)try{this.abortController.abort(),this.abortController=null}catch(e){this.abortController=null}}};self.onmessage=t=>{const i=t.data;switch(i.cmd){case r:f.isChrome=e(i.isChrome),f.fetchStream(i.url,JSON.parse(i.options));break;case o:f.destroy(),f=null,postMessage({cmd:a})}}}.toString()),t=new Blob([e],{type:"text/javascript"});let i=URL.createObjectURL(t);const s=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((()=>{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),ie),s.onmessage=e=>{const{demux:t}=this.player,i=e.data;switch(i.cmd){case it:this.streamRate&&this.streamRate(i.buffer.byteLength),t.dispatch(i.buffer);break;case ot:this.emit(at.streamSuccess),this._startStreamRateInterval();break;case rt:t.close(),this.emit(at.streamEnd,"fetch done");break;case st:t.close(),this.emit(dt.fetchError,i.message);break;case tt:this._destroy()}},this.fetchWorker=s}_startStreamRateInterval(){this._stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}_stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player._times.streamStart=oo(),this.fetchWorker.postMessage({cmd:Ze,url:e,isChrome:Qo(),options:JSON.stringify(t)})}getStreamType(){return p}}class kn extends o{constructor(e){super(),this.player=e,this.socket=null,this.socketStatus=ht,this.wsUrl=null,this.requestAbort=!1,this.socketDestroyFnList=[],this.streamRate=co((t=>{e.emit(at.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,e.debugLog("WebsocketStream","init")}async destroy(){this._closeWebSocket(),this.stopStreamRateInterval(),this.wsUrl=null,this.off(),this.player.debugLog("WebsocketStream","destroy")}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}_createWebSocket(e){const t=this.player,{events:{proxy:i},demux:s}=t,r=e.protocols||[];this.socket=new WebSocket(this.wsUrl,r),this.socket.binaryType="arraybuffer";const o=i(this.socket,"open",(()=>{this.player.debugLog("WebsocketStream","socket open"),this.socketStatus=ct,this.emit(at.streamSuccess),this.player.emit(at.websocketOpen),this.startStreamRateInterval()})),a=i(this.socket,"message",(e=>{"string"!=typeof e.data?(this.streamRate&&this.streamRate(e.data.byteLength),this._handleMessage(e.data)):this.player.debugWarn("WebsocketStream",`websocket handle message message is "${e.data}" string so return`)})),n=i(this.socket,"close",(e=>{if(!this.player.isDestroyedOrClosed())if(this.socketStatus!==pt){if(this.player.debugLog("WebsocketStream",`socket close and code is ${e.code}`),1006===e.code&&this.player.debugError("WebsocketStream",`socket close abnormally and code is ${e.code}`),ya(this.requestAbort))return this.requestAbort=!1,void this.player.debugLog("WebsocketStream","socket close and requestAbort is true");s.close(),this.socketStatus=ut,this.player.emit(at.websocketClose,e.code),this.emit(at.streamEnd,e.code)}else this.player.debugLog("WebsocketStream","socket close and status is error, so return")})),l=i(this.socket,"error",(e=>{this.player.isDestroyedOrClosed()||(this.player.debugError("WebsocketStream","socket error",e),this.socketStatus=pt,this.emit(dt.websocketError,e),s.close(),this.player.debugLog("WebsocketStream","socket error:",e.isTrusted?"websocket user aborted":"websocket error"))}));this.socketDestroyFnList.push(o,a,n,l)}_closeWebSocket(){this.socketDestroyFnList.forEach((e=>e())),!this.socket||0!==this.socket.readyState&&1!==this.socket.readyState?this.socket&&this.player.debugLog("WebsocketStream",`_closeWebSocket() socket is null or socket status is ${this.socket&&this.socket.readyState}`):(this.requestAbort=!0,this.socket.close(1e3,"Client disconnecting")),this.socket=null,this.socketStatus=ht,this.streamRate=null}_handleMessage(e){const{demux:t}=this.player;t?t.dispatch(e):this.player.debugWarn("WebsocketStream","websocket handle message demux is null so return")}fetchStream(e,t){this.player._times.streamStart=oo(),this.wsUrl=e,this._createWebSocket(t)}sendMessage(e){this.socket?this.socketStatus===ct?this.socket.send(e):this.player.debugError("WebsocketStream",`websocket send message error and socket status is ${this.socketStatus}`):this.player.debugError("WebsocketStream","websocket send message socket is null")}resetFetchStream(){this._closeWebSocket(),this._createWebSocket()}getStreamType(){return m}}class Ln extends o{constructor(e){super(),this.player=e,e.debugLog("HlsStream","init")}async destroy(){return this.off(),this.player.debugLog("HlsStream","destroy"),!0}fetchStream(e){const{hlsDecoder:t,debug:i}=this.player;this.player._times.streamStart=oo(),t.loadSource(e).then((()=>{this.player.debugLog("HlsStream","loadSource success"),this.emit(at.streamSuccess)})).catch((e=>{this.emit(dt.hlsError,e)}))}getStreamType(){return f}}class Cn extends o{constructor(e){super(),this.player=e,this.webrctUrl=null,e.debugLog("WebrtcStream","init")}async destroy(){return this.webrctUrl=null,this.off(),this.player.debugLog("WebrtcStream","destroy"),!0}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{webrtc:i,debug:s}=this.player;if(this.player._times.streamStart=oo(),this.webrctUrl=e.replace("webrtc:",window.location.protocol),this.player.isWebrtcForM7S()&&-1===this.webrctUrl.indexOf("/webrtc/play")){const t=new URL(this.webrctUrl),i="/webrtc/play"+t.pathname;this.webrctUrl=t.origin+i+t.search,this.player.debugLog("WebrtcStream",`original url is ${e}, and new url is: ${this.webrctUrl}`)}i.loadSource(this.webrctUrl,t).then((()=>{this.player.debugLog("WebrtcStream","loadSource success"),this.emit(at.streamSuccess)})).catch((e=>{this.player.debugError("WebrtcStream","loadSource error",e),this.emit(dt.webrtcError,e)}))}getStreamType(){return g}}class xn extends o{constructor(e){super(),this.player=e,this.transport=null,this.wtUrl=null,this.streamRate=co((t=>{e.emit(at.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,e.debugLog("WebTransportLoader","init")}async destroy(){return this.abort(),this.off(),this.player.debugLog("WebTransportLoader","destroy"),!0}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}_createWebTransport(){const e=this.player,{debug:t,events:{proxy:i},demux:s}=e;try{this.transport=new WebTransport(this.wtUrl),this.transport.ready.then((()=>{this.emit(at.streamSuccess),this.startStreamRateInterval(),this.transport.createBidirectionalStream().then((e=>{e.readable.pipeTo(new WritableStream(s.input))}))})).catch((e=>{this.player.debugWarn("WebTransportLoader","_createWebTransport-ready",e)}))}catch(e){this.player.debugWarn("WebTransportLoader","_createWebTransport",e)}}fetchStream(e){this.player._times.streamStart=oo(),this.wtUrl=e.replace(/^wt:/,"https:"),this._createWebTransport()}abort(){if(this.transport)try{this.transport.close(),this.transport=null}catch(e){this.transport=null}}getStreamType(){return y}}class Dn extends o{constructor(e){super(),this.player=e,this.workUrl=null,e.debugLog("WorkerStream","init")}async destroy(){return this.workUrl=null,this.off(),this.player.debugLog("WorkerStream","destroy"),!0}sendMessage(e){this.player.decoderWorker.workerSendMessage(e)}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.workUrl=e,this.player._times.streamStart=oo(),this.player.decoderWorker.workerFetchStream(e,t)}getStreamType(){const e=this.player._opt.protocol;return A+" "+(e===n?p:m)}}class Rn extends o{constructor(e){super(),this.TAG_NAME="AliyunRtcLoader",this.player=e,e.debugLog(this.TAG_NAME,"init")}async destroy(){return this.off(),this.player.debugLog(this.TAG_NAME,"destroy"),!0}fetchStream(e){const{aliyunRtcDecoder:t}=this.player;this.player._times.streamStart=oo(),t.loadSource(e).then((()=>{this.player.debugLog(this.TAG_NAME,"loadSource success"),this.emit(at.streamSuccess)})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource error",e),this.emit(dt.aliyunRtcError,e)}))}getStreamType(){return b}}class Pn{constructor(e){return new(Pn.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){const{protocol:t,useWasm:i,playType:s,useWCS:r,useMSE:o,demuxUseWorker:u,mainThreadFetchUseWorker:p}=e;return t===n?s===_?Dn:s===v?i&&!sa(e)||u?Dn:p?Tn:En:r||o?u?Dn:p?Tn:En:Dn:t===a?s===_?Dn:s===v?i&&!sa(e)||u?Dn:kn:r||o?u?Dn:kn:Dn:t===l?Ln:t===d?Cn:t===h?xn:t===c?Rn:void 0}}var In=Pr((function(e){function t(e,r){if(!e)throw"First parameter is required.";r=new i(e,r=r||{type:"video"});var o=this;function a(t){t&&(r.initCallback=function(){t(),t=r.initCallback=null});var i=new s(e,r);(p=new i(e,r)).record(),u("recording"),r.disableLogs||console.log("Initialized recorderType:",p.constructor.name,"for output-type:",r.type)}function n(e){if(e=e||function(){},p){if("paused"===o.state)return o.resumeRecording(),void setTimeout((function(){n(e)}),1);"recording"===o.state||r.disableLogs||console.warn('Recording state should be: "recording", however current state is: ',o.state),r.disableLogs||console.log("Stopped recording "+r.type+" stream."),"gif"!==r.type?p.stop(t):(p.stop(),t()),u("stopped")}else m();function t(t){if(p){Object.keys(p).forEach((function(e){"function"!=typeof p[e]&&(o[e]=p[e])}));var i=p.blob;if(!i){if(!t)throw"Recording failed.";p.blob=i=t}if(i&&!r.disableLogs&&console.log(i.type,"->",y(i.size)),e){var s;try{s=h.createObjectURL(i)}catch(e){}"function"==typeof e.call?e.call(o,s):e(s)}r.autoWriteToDisk&&d((function(e){var t={};t[r.type+"Blob"]=e,x.Store(t)}))}else"function"==typeof e.call?e.call(o,""):e("")}}function l(e){postMessage((new FileReaderSync).readAsDataURL(e))}function d(e,t){if(!e)throw"Pass a callback function over getDataURL.";var i=t?t.blob:(p||{}).blob;if(!i)return r.disableLogs||console.warn("Blob encoder did not finish its job yet."),void setTimeout((function(){d(e,t)}),1e3);if("undefined"==typeof Worker||navigator.mozGetUserMedia){var s=new FileReader;s.readAsDataURL(i),s.onload=function(t){e(t.target.result)}}else{var o=function(e){try{var t=h.createObjectURL(new Blob([e.toString(),"this.onmessage = function (eee) {"+e.name+"(eee.data);}"],{type:"application/javascript"})),i=new Worker(t);return h.revokeObjectURL(t),i}catch(e){}}(l);o.onmessage=function(t){e(t.data)},o.postMessage(i)}}function c(e){e=e||0,"paused"!==o.state?"stopped"!==o.state&&(e>=o.recordingDuration?n(o.onRecordingStopped):(e+=1e3,setTimeout((function(){c(e)}),1e3))):setTimeout((function(){c(e)}),1e3)}function u(e){o&&(o.state=e,"function"==typeof o.onStateChanged.call?o.onStateChanged.call(o,e):o.onStateChanged(e))}var p,f='It seems that recorder is destroyed or "startRecording" is not invoked for '+r.type+" recorder.";function m(){!0!==r.disableLogs&&console.warn(f)}var g={startRecording:function(t){return r.disableLogs||console.log("RecordRTC version: ",o.version),t&&(r=new i(e,t)),r.disableLogs||console.log("started recording "+r.type+" stream."),p?(p.clearRecordedData(),p.record(),u("recording"),o.recordingDuration&&c(),o):(a((function(){o.recordingDuration&&c()})),o)},stopRecording:n,pauseRecording:function(){p?"recording"===o.state?(u("paused"),p.pause(),r.disableLogs||console.log("Paused recording.")):r.disableLogs||console.warn("Unable to pause the recording. Recording state: ",o.state):m()},resumeRecording:function(){p?"paused"===o.state?(u("recording"),p.resume(),r.disableLogs||console.log("Resumed recording.")):r.disableLogs||console.warn("Unable to resume the recording. Recording state: ",o.state):m()},initRecorder:a,setRecordingDuration:function(e,t){if(void 0===e)throw"recordingDuration is required.";if("number"!=typeof e)throw"recordingDuration must be a number.";return o.recordingDuration=e,o.onRecordingStopped=t||function(){},{onRecordingStopped:function(e){o.onRecordingStopped=e}}},clearRecordedData:function(){p?(p.clearRecordedData(),r.disableLogs||console.log("Cleared old recorded data.")):m()},getBlob:function(){if(p)return p.blob;m()},getDataURL:d,toURL:function(){if(p)return h.createObjectURL(p.blob);m()},getInternalRecorder:function(){return p},save:function(e){p?A(p.blob,e):m()},getFromDisk:function(e){p?t.getFromDisk(r.type,e):m()},setAdvertisementArray:function(e){r.advertisement=[];for(var t=e.length,i=0;i-1&&"netscape"in window&&/ rv:/.test(navigator.userAgent),f=!u&&!c&&!!navigator.webkitGetUserMedia||b()||-1!==navigator.userAgent.toLowerCase().indexOf("chrome/"),m=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);m&&!f&&-1!==navigator.userAgent.indexOf("CriOS")&&(m=!1,f=!0);var g=window.MediaStream;function y(e){if(0===e)return"0 Bytes";var t=parseInt(Math.floor(Math.log(e)/Math.log(1e3)),10);return(e/Math.pow(1e3,t)).toPrecision(3)+" "+["Bytes","KB","MB","GB","TB"][t]}function A(e,t){if(!e)throw"Blob object is required.";if(!e.type)try{e.type="video/webm"}catch(e){}var i=(e.type||"video/webm").split("/")[1];if(-1!==i.indexOf(";")&&(i=i.split(";")[0]),t&&-1!==t.indexOf(".")){var s=t.split(".");t=s[0],i=s[1]}var r=(t||Math.round(9999999999*Math.random())+888888888)+"."+i;if(void 0!==navigator.msSaveOrOpenBlob)return navigator.msSaveOrOpenBlob(e,r);if(void 0!==navigator.msSaveBlob)return navigator.msSaveBlob(e,r);var o=document.createElement("a");o.href=h.createObjectURL(e),o.download=r,o.style="display:none;opacity:0;color:transparent;",(document.body||document.documentElement).appendChild(o),"function"==typeof o.click?o.click():(o.target="_blank",o.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}))),h.revokeObjectURL(o.href)}function b(){return"undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type||(!("undefined"==typeof process||"object"!=typeof process.versions||!process.versions.electron)||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}function v(e,t){return e&&e.getTracks?e.getTracks().filter((function(e){return e.kind===(t||"audio")})):[]}function _(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}void 0===g&&"undefined"!=typeof webkitMediaStream&&(g=webkitMediaStream),void 0!==g&&void 0===g.prototype.stop&&(g.prototype.stop=function(){this.getTracks().forEach((function(e){e.stop()}))}),t.invokeSaveAsDialog=A,t.getTracks=v,t.getSeekableBlob=function(e,t){if("undefined"==typeof EBML)throw new Error("Please link: https://www.webrtc-experiment.com/EBML.js");var i=new EBML.Reader,s=new EBML.Decoder,r=EBML.tools,o=new FileReader;o.onload=function(e){s.decode(this.result).forEach((function(e){i.read(e)})),i.stop();var o=r.makeMetadataSeekable(i.metadatas,i.duration,i.cues),a=this.result.slice(i.metadataSize),n=new Blob([o,a],{type:"video/webm"});t(n)},o.readAsArrayBuffer(e)},t.bytesToSize=y,t.isElectron=b;var w={};function S(){if(p||m||c)return!0;var e,t,i=navigator.userAgent,s=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10);return(f||u)&&(e=i.indexOf("Chrome"),s=i.substring(e+7)),-1!==(t=s.indexOf(";"))&&(s=s.substring(0,t)),-1!==(t=s.indexOf(" "))&&(s=s.substring(0,t)),r=parseInt(""+s,10),isNaN(r)&&(s=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10)),r>=49}function E(e,t){var i=this;if(void 0===e)throw'First argument "MediaStream" is required.';if("undefined"==typeof MediaRecorder)throw"Your browser does not support the Media Recorder API. Please try other modules e.g. WhammyRecorder or StereoAudioRecorder.";if("audio"===(t=t||{mimeType:"video/webm"}).type){var s;if(v(e,"video").length&&v(e,"audio").length)navigator.mozGetUserMedia?(s=new g).addTrack(v(e,"audio")[0]):s=new g(v(e,"audio")),e=s;t.mimeType&&-1!==t.mimeType.toString().toLowerCase().indexOf("audio")||(t.mimeType=f?"audio/webm":"audio/ogg"),t.mimeType&&"audio/ogg"!==t.mimeType.toString().toLowerCase()&&navigator.mozGetUserMedia&&(t.mimeType="audio/ogg")}var r,o=[];function a(){i.timestamps.push((new Date).getTime()),"function"==typeof t.onTimeStamp&&t.onTimeStamp(i.timestamps[i.timestamps.length-1],i.timestamps)}function n(e){return r&&r.mimeType?r.mimeType:e.mimeType||"video/webm"}function l(){o=[],r=null,i.timestamps=[]}this.getArrayOfBlobs=function(){return o},this.record=function(){i.blob=null,i.clearRecordedData(),i.timestamps=[],d=[],o=[];var s=t;t.disableLogs||console.log("Passing following config over MediaRecorder API.",s),r&&(r=null),f&&!S()&&(s="video/vp8"),"function"==typeof MediaRecorder.isTypeSupported&&s.mimeType&&(MediaRecorder.isTypeSupported(s.mimeType)||(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",s.mimeType),s.mimeType="audio"===t.type?"audio/webm":"video/webm"));try{r=new MediaRecorder(e,s),t.mimeType=s.mimeType}catch(t){r=new MediaRecorder(e)}s.mimeType&&!MediaRecorder.isTypeSupported&&"canRecordMimeType"in r&&!1===r.canRecordMimeType(s.mimeType)&&(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",s.mimeType)),r.ondataavailable=function(e){if(e.data&&d.push("ondataavailable: "+y(e.data.size)),"number"!=typeof t.timeSlice)!e.data||!e.data.size||e.data.size<100||i.blob?i.recordingCallback&&(i.recordingCallback(new Blob([],{type:n(s)})),i.recordingCallback=null):(i.blob=t.getNativeBlob?e.data:new Blob([e.data],{type:n(s)}),i.recordingCallback&&(i.recordingCallback(i.blob),i.recordingCallback=null));else if(e.data&&e.data.size&&(o.push(e.data),a(),"function"==typeof t.ondataavailable)){var r=t.getNativeBlob?e.data:new Blob([e.data],{type:n(s)});t.ondataavailable(r)}},r.onstart=function(){d.push("started")},r.onpause=function(){d.push("paused")},r.onresume=function(){d.push("resumed")},r.onstop=function(){d.push("stopped")},r.onerror=function(e){e&&(e.name||(e.name="UnknownError"),d.push("error: "+e),t.disableLogs||(-1!==e.name.toString().toLowerCase().indexOf("invalidstate")?console.error("The MediaRecorder is not in a state in which the proposed operation is allowed to be executed.",e):-1!==e.name.toString().toLowerCase().indexOf("notsupported")?console.error("MIME type (",s.mimeType,") is not supported.",e):-1!==e.name.toString().toLowerCase().indexOf("security")?console.error("MediaRecorder security error",e):"OutOfMemory"===e.name?console.error("The UA has exhaused the available memory. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"IllegalStreamModification"===e.name?console.error("A modification to the stream has occurred that makes it impossible to continue recording. An example would be the addition of a Track while recording is occurring. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"OtherRecordingError"===e.name?console.error("Used for an fatal error other than those listed above. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"GenericError"===e.name?console.error("The UA cannot provide the codec or recording option that has been requested.",e):console.error("MediaRecorder Error",e)),function(e){if(!i.manuallyStopped&&r&&"inactive"===r.state)return delete t.timeslice,void r.start(6e5);setTimeout(void 0,1e3)}(),"inactive"!==r.state&&"stopped"!==r.state&&r.stop())},"number"==typeof t.timeSlice?(a(),r.start(t.timeSlice)):r.start(36e5),t.initCallback&&t.initCallback()},this.timestamps=[],this.stop=function(e){e=e||function(){},i.manuallyStopped=!0,r&&(this.recordingCallback=e,"recording"===r.state&&r.stop(),"number"==typeof t.timeSlice&&setTimeout((function(){i.blob=new Blob(o,{type:n(t)}),i.recordingCallback(i.blob)}),100))},this.pause=function(){r&&"recording"===r.state&&r.pause()},this.resume=function(){r&&"paused"===r.state&&r.resume()},this.clearRecordedData=function(){r&&"recording"===r.state&&i.stop(l),l()},this.getInternalRecorder=function(){return r},this.blob=null,this.getState=function(){return r&&r.state||"inactive"};var d=[];this.getAllStates=function(){return d},void 0===t.checkForInactiveTracks&&(t.checkForInactiveTracks=!1);i=this;!function s(){if(r&&!1!==t.checkForInactiveTracks)return!1===function(){if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}()?(t.disableLogs||console.log("MediaStream seems stopped."),void i.stop()):void setTimeout(s,1e3)}(),this.name="MediaStreamRecorder",this.toString=function(){return this.name}}function T(e,i){if(!v(e,"audio").length)throw"Your stream has no audio tracks.";var s,r=this,o=[],a=[],n=!1,l=0,d=2,c=(i=i||{}).desiredSampRate;function u(){if(!1===i.checkForInactiveTracks)return!0;if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}function p(e,t){function i(e,t){var i,s=e.numberOfAudioChannels,r=e.leftBuffers.slice(0),o=e.rightBuffers.slice(0),a=e.sampleRate,n=e.internalInterleavedLength,l=e.desiredSampRate;function d(e,t,i){var s=Math.round(e.length*(t/i)),r=[],o=Number((e.length-1)/(s-1));r[0]=e[0];for(var a=1;a96e3)&&(i.disableLogs||console.log("sample-rate must be under range 22050 and 96000.")),i.disableLogs||i.desiredSampRate&&console.log("Desired sample-rate: "+i.desiredSampRate);var b=!1;function _(){o=[],a=[],l=0,S=!1,n=!1,b=!1,f=null,r.leftchannel=o,r.rightchannel=a,r.numberOfAudioChannels=d,r.desiredSampRate=c,r.sampleRate=A,r.recordingLength=l,E={left:[],right:[],recordingLength:0}}function w(){s&&(s.onaudioprocess=null,s.disconnect(),s=null),m&&(m.disconnect(),m=null),_()}this.pause=function(){b=!0},this.resume=function(){if(!1===u())throw"Please make sure MediaStream is active.";if(!n)return i.disableLogs||console.log("Seems recording has been restarted."),void this.record();b=!1},this.clearRecordedData=function(){i.checkForInactiveTracks=!1,n&&this.stop(w),w()},this.name="StereoAudioRecorder",this.toString=function(){return this.name};var S=!1;s.onaudioprocess=function(e){if(!b)if(!1===u()&&(i.disableLogs||console.log("MediaStream seems stopped."),s.disconnect(),n=!1),n){S||(S=!0,i.onAudioProcessStarted&&i.onAudioProcessStarted(),i.initCallback&&i.initCallback());var t=e.inputBuffer.getChannelData(0),h=new Float32Array(t);if(o.push(h),2===d){var c=e.inputBuffer.getChannelData(1),p=new Float32Array(c);a.push(p)}l+=y,r.recordingLength=l,void 0!==i.timeSlice&&(E.recordingLength+=y,E.left.push(h),2===d&&E.right.push(p))}else m&&(m.disconnect(),m=null)},f.createMediaStreamDestination?s.connect(f.createMediaStreamDestination()):s.connect(f.destination),this.leftchannel=o,this.rightchannel=a,this.numberOfAudioChannels=d,this.desiredSampRate=c,this.sampleRate=A,r.recordingLength=l;var E={left:[],right:[],recordingLength:0};function T(){n&&"function"==typeof i.ondataavailable&&void 0!==i.timeSlice&&(E.left.length?(p({desiredSampRate:c,sampleRate:A,numberOfAudioChannels:d,internalInterleavedLength:E.recordingLength,leftBuffers:E.left,rightBuffers:1===d?[]:E.right},(function(e,t){var s=new Blob([t],{type:"audio/wav"});i.ondataavailable(s),setTimeout(T,i.timeSlice)})),E={left:[],right:[],recordingLength:0}):setTimeout(T,i.timeSlice))}}function k(e,t){if("undefined"==typeof html2canvas)throw"Please link: https://www.webrtc-experiment.com/screenshot.js";(t=t||{}).frameInterval||(t.frameInterval=10);var i=!1;["captureStream","mozCaptureStream","webkitCaptureStream"].forEach((function(e){e in document.createElement("canvas")&&(i=!0)}));var s,r,o,a=!(!window.webkitRTCPeerConnection&&!window.webkitGetUserMedia||!window.chrome),n=50,l=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);if(a&&l&&l[2]&&(n=parseInt(l[2],10)),a&&n<52&&(i=!1),t.useWhammyRecorder&&(i=!1),i)if(t.disableLogs||console.log("Your browser supports both MediRecorder API and canvas.captureStream!"),e instanceof HTMLCanvasElement)s=e;else{if(!(e instanceof CanvasRenderingContext2D))throw"Please pass either HTMLCanvasElement or CanvasRenderingContext2D.";s=e.canvas}else navigator.mozGetUserMedia&&(t.disableLogs||console.error("Canvas recording is NOT supported in Firefox."));this.record=function(){if(o=!0,i&&!t.useWhammyRecorder){var e;"captureStream"in s?e=s.captureStream(25):"mozCaptureStream"in s?e=s.mozCaptureStream(25):"webkitCaptureStream"in s&&(e=s.webkitCaptureStream(25));try{var a=new g;a.addTrack(v(e,"video")[0]),e=a}catch(e){}if(!e)throw"captureStream API are NOT available.";(r=new E(e,{mimeType:t.mimeType||"video/webm"})).record()}else p.frames=[],u=(new Date).getTime(),c();t.initCallback&&t.initCallback()},this.getWebPImages=function(i){if("canvas"===e.nodeName.toLowerCase()){var s=p.frames.length;p.frames.forEach((function(e,i){var r=s-i;t.disableLogs||console.log(r+"/"+s+" frames remaining"),t.onEncodingCallback&&t.onEncodingCallback(r,s);var o=e.image.toDataURL("image/webp",1);p.frames[i].image=o})),t.disableLogs||console.log("Generating WebM"),i()}else i()},this.stop=function(e){o=!1;var s=this;i&&r?r.stop(e):this.getWebPImages((function(){p.compile((function(i){t.disableLogs||console.log("Recording finished!"),s.blob=i,s.blob.forEach&&(s.blob=new Blob([],{type:"video/webm"})),e&&e(s.blob),p.frames=[]}))}))};var d=!1;function h(){p.frames=[],o=!1,d=!1}function c(){if(d)return u=(new Date).getTime(),setTimeout(c,500);if("canvas"===e.nodeName.toLowerCase()){var i=(new Date).getTime()-u;return u=(new Date).getTime(),p.frames.push({image:(s=document.createElement("canvas"),r=s.getContext("2d"),s.width=e.width,s.height=e.height,r.drawImage(e,0,0),s),duration:i}),void(o&&setTimeout(c,t.frameInterval))}var s,r;html2canvas(e,{grabMouse:void 0===t.showMousePointer||t.showMousePointer,onrendered:function(e){var i=(new Date).getTime()-u;if(!i)return setTimeout(c,t.frameInterval);u=(new Date).getTime(),p.frames.push({image:e.toDataURL("image/webp",1),duration:i}),o&&setTimeout(c,t.frameInterval)}})}this.pause=function(){d=!0,r instanceof E&&r.pause()},this.resume=function(){d=!1,r instanceof E?r.resume():o||this.record()},this.clearRecordedData=function(){o&&this.stop(h),h()},this.name="CanvasRecorder",this.toString=function(){return this.name};var u=(new Date).getTime(),p=new C.Video(100)}function L(e,t){function i(e){e=void 0!==e?e:10;var t=(new Date).getTime()-l;return t?o?(l=(new Date).getTime(),setTimeout(i,100)):(l=(new Date).getTime(),n.paused&&n.play(),c.drawImage(n,0,0,h.width,h.height),d.frames.push({duration:t,image:h.toDataURL("image/webp")}),void(r||setTimeout(i,e,e))):setTimeout(i,e,e)}function s(e,t,i,s,r){var o=document.createElement("canvas");o.width=h.width,o.height=h.height;var a=o.getContext("2d"),n=[],l=-1===t,d=t&&t>0&&t<=e.length?t:e.length,c=0,u=0,p=0,f=Math.sqrt(Math.pow(255,2)+Math.pow(255,2)+Math.pow(255,2)),m=i&&i>=0&&i<=1?i:0,g=s&&s>=0&&s<=1?s:0,y=!1;!function(e){var t=-1,i=e.length;!function s(){++t!==i?setTimeout((function(){e.functionToLoop(s,t)}),1):e.callback()}()}({length:d,functionToLoop:function(t,i){var s,r,o,d=function(){!y&&o-s<=o*g||(l&&(y=!0),n.push(e[i])),t()};if(y)d();else{var A=new Image;A.onload=function(){a.drawImage(A,0,0,h.width,h.height);var e=a.getImageData(0,0,h.width,h.height);s=0,r=e.data.length,o=e.data.length/4;for(var t=0;t127)throw"TrackNumber > 127 not supported";return[128|e.trackNum,e.timecode>>8,255&e.timecode,t].map((function(e){return String.fromCharCode(e)})).join("")+e.frame}({discardable:0,frame:e.data.slice(4),invisible:0,keyframe:1,lacing:0,trackNum:1,timecode:Math.round(t)});return t+=e.duration,{data:i,id:163}})))}function i(e){for(var t=[];e>0;)t.push(255&e),e>>=8;return new Uint8Array(t.reverse())}function s(e){var t=[];e=(e.length%8?new Array(9-e.length%8).join("0"):"")+e;for(var i=0;i1?2*o[0].width:o[0].width;var n=1;3!==e&&4!==e||(n=2),5!==e&&6!==e||(n=3),7!==e&&8!==e||(n=4),9!==e&&10!==e||(n=5),r.height=o[0].height*n}else r.width=a.width||360,r.height=a.height||240;t&&t instanceof HTMLVideoElement&&u(t),o.forEach((function(e,t){u(e,t)})),setTimeout(c,a.frameInterval)}}function u(e,t){if(!s){var i=0,r=0,a=e.width,n=e.height;1===t&&(i=e.width),2===t&&(r=e.height),3===t&&(i=e.width,r=e.height),4===t&&(r=2*e.height),5===t&&(i=e.width,r=2*e.height),6===t&&(r=3*e.height),7===t&&(i=e.width,r=3*e.height),void 0!==e.stream.left&&(i=e.stream.left),void 0!==e.stream.top&&(r=e.stream.top),void 0!==e.stream.width&&(a=e.stream.width),void 0!==e.stream.height&&(n=e.stream.height),o.drawImage(e,i,r,a,n),"function"==typeof e.stream.onRender&&e.stream.onRender(o,i,r,a,n,t)}}function p(e){var i=document.createElement("video");return function(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}(e,i),i.className=t,i.muted=!0,i.volume=0,i.width=e.width||a.width||360,i.height=e.height||a.height||240,i.play(),i}function f(t){i=[],(t=t||e).forEach((function(e){if(e.getTracks().filter((function(e){return"video"===e.kind})).length){var t=p(e);t.stream=e,i.push(t)}}))}void 0!==n?h.AudioContext=n:"undefined"!=typeof webkitAudioContext&&(h.AudioContext=webkitAudioContext),this.startDrawingFrames=function(){c()},this.appendStreams=function(t){if(!t)throw"First parameter is required.";t instanceof Array||(t=[t]),t.forEach((function(t){var s=new d;if(t.getTracks().filter((function(e){return"video"===e.kind})).length){var r=p(t);r.stream=t,i.push(r),s.addTrack(t.getTracks().filter((function(e){return"video"===e.kind}))[0])}if(t.getTracks().filter((function(e){return"audio"===e.kind})).length){var o=a.audioContext.createMediaStreamSource(t);a.audioDestination=a.audioContext.createMediaStreamDestination(),o.connect(a.audioDestination),s.addTrack(a.audioDestination.stream.getTracks().filter((function(e){return"audio"===e.kind}))[0])}e.push(s)}))},this.releaseStreams=function(){i=[],s=!0,a.gainNode&&(a.gainNode.disconnect(),a.gainNode=null),a.audioSources.length&&(a.audioSources.forEach((function(e){e.disconnect()})),a.audioSources=[]),a.audioDestination&&(a.audioDestination.disconnect(),a.audioDestination=null),a.audioContext&&a.audioContext.close(),a.audioContext=null,o.clearRect(0,0,r.width,r.height),r.stream&&(r.stream.stop(),r.stream=null)},this.resetVideoStreams=function(e){!e||e instanceof Array||(e=[e]),f(e)},this.name="MultiStreamsMixer",this.toString=function(){return this.name},this.getMixedStream=function(){s=!1;var t=function(){var e;f(),"captureStream"in r?e=r.captureStream():"mozCaptureStream"in r?e=r.mozCaptureStream():a.disableLogs||console.error("Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features");var t=new d;return e.getTracks().filter((function(e){return"video"===e.kind})).forEach((function(e){t.addTrack(e)})),r.stream=t,t}(),i=function(){h.AudioContextConstructor||(h.AudioContextConstructor=new h.AudioContext);a.audioContext=h.AudioContextConstructor,a.audioSources=[],!0===a.useGainNode&&(a.gainNode=a.audioContext.createGain(),a.gainNode.connect(a.audioContext.destination),a.gainNode.gain.value=0);var t=0;if(e.forEach((function(e){if(e.getTracks().filter((function(e){return"audio"===e.kind})).length){t++;var i=a.audioContext.createMediaStreamSource(e);!0===a.useGainNode&&i.connect(a.gainNode),a.audioSources.push(i)}})),!t)return;return a.audioDestination=a.audioContext.createMediaStreamDestination(),a.audioSources.forEach((function(e){e.connect(a.audioDestination)})),a.audioDestination.stream}();return i&&i.getTracks().filter((function(e){return"audio"===e.kind})).forEach((function(e){t.addTrack(e)})),e.forEach((function(e){e.fullcanvas})),t}}function P(e,t){e=e||[];var i,s,r=this;(t=t||{elementClass:"multi-streams-mixer",mimeType:"video/webm",video:{width:360,height:240}}).frameInterval||(t.frameInterval=10),t.video||(t.video={}),t.video.width||(t.video.width=360),t.video.height||(t.video.height=240),this.record=function(){var r;i=new R(e,t.elementClass||"multi-streams-mixer"),(r=[],e.forEach((function(e){v(e,"video").forEach((function(e){r.push(e)}))})),r).length&&(i.frameInterval=t.frameInterval||10,i.width=t.video.width||360,i.height=t.video.height||240,i.startDrawingFrames()),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()),(s=new E(i.getMixedStream(),t)).record()},this.stop=function(e){s&&s.stop((function(t){r.blob=t,e(t),r.clearRecordedData()}))},this.pause=function(){s&&s.pause()},this.resume=function(){s&&s.resume()},this.clearRecordedData=function(){s&&(s.clearRecordedData(),s=null),i&&(i.releaseStreams(),i=null)},this.addStreams=function(r){if(!r)throw"First parameter is required.";r instanceof Array||(r=[r]),e.concat(r),s&&i&&(i.appendStreams(r),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()))},this.resetVideoStreams=function(e){i&&(!e||e instanceof Array||(e=[e]),i.resetVideoStreams(e))},this.getMixer=function(){return i},this.name="MultiStreamRecorder",this.toString=function(){return this.name}}function I(e,t){var i,s,r;function o(){return new ReadableStream({start:function(s){var r=document.createElement("canvas"),o=document.createElement("video"),a=!0;o.srcObject=e,o.muted=!0,o.height=t.height,o.width=t.width,o.volume=0,o.onplaying=function(){r.width=t.width,r.height=t.height;var e=r.getContext("2d"),n=1e3/t.frameRate,l=setInterval((function(){if(i&&(clearInterval(l),s.close()),a&&(a=!1,t.onVideoProcessStarted&&t.onVideoProcessStarted()),e.drawImage(o,0,0),"closed"!==s._controlledReadableStream.state)try{s.enqueue(e.getImageData(0,0,t.width,t.height))}catch(e){}}),n)},o.play()}})}function a(e,l){if(!t.workerPath&&!l)return i=!1,void fetch("https://unpkg.com/webm-wasm@latest/dist/webm-worker.js").then((function(t){t.arrayBuffer().then((function(t){a(e,t)}))}));if(!t.workerPath&&l instanceof ArrayBuffer){var d=new Blob([l],{type:"text/javascript"});t.workerPath=h.createObjectURL(d)}t.workerPath||console.error("workerPath parameter is missing."),(s=new Worker(t.workerPath)).postMessage(t.webAssemblyPath||"https://unpkg.com/webm-wasm@latest/dist/webm-wasm.wasm"),s.addEventListener("message",(function(e){"READY"===e.data?(s.postMessage({width:t.width,height:t.height,bitrate:t.bitrate||1200,timebaseDen:t.frameRate||30,realtime:t.realtime}),o().pipeTo(new WritableStream({write:function(e){i?console.error("Got image, but recorder is finished!"):s.postMessage(e.data.buffer,[e.data.buffer])}}))):e.data&&(r||n.push(e.data))}))}"undefined"!=typeof ReadableStream&&"undefined"!=typeof WritableStream||console.error("Following polyfill is strongly recommended: https://unpkg.com/@mattiasbuelens/web-streams-polyfill/dist/polyfill.min.js"),(t=t||{}).width=t.width||640,t.height=t.height||480,t.frameRate=t.frameRate||30,t.bitrate=t.bitrate||1200,t.realtime=t.realtime||!0,this.record=function(){n=[],r=!1,this.blob=null,a(e),"function"==typeof t.initCallback&&t.initCallback()},this.pause=function(){r=!0},this.resume=function(){r=!1};var n=[];this.stop=function(e){i=!0;var t=this;!function(e){s?(s.addEventListener("message",(function(t){null===t.data&&(s.terminate(),s=null,e&&e())})),s.postMessage(null)):e&&e()}((function(){t.blob=new Blob(n,{type:"video/webm"}),e(t.blob)}))},this.name="WebAssemblyRecorder",this.toString=function(){return this.name},this.clearRecordedData=function(){n=[],r=!1,this.blob=null},this.blob=null}t.DiskStorage=x,t.GifRecorder=D,t.MultiStreamRecorder=P,t.RecordRTCPromisesHandler=function(e,i){if(!this)throw'Use "new RecordRTCPromisesHandler()"';if(void 0===e)throw'First argument "MediaStream" is required.';var s=this;s.recordRTC=new t(e,i),this.startRecording=function(){return new Promise((function(e,t){try{s.recordRTC.startRecording(),e()}catch(e){t(e)}}))},this.stopRecording=function(){return new Promise((function(e,t){try{s.recordRTC.stopRecording((function(i){s.blob=s.recordRTC.getBlob(),s.blob&&s.blob.size?e(i):t("Empty blob.",s.blob)}))}catch(e){t(e)}}))},this.pauseRecording=function(){return new Promise((function(e,t){try{s.recordRTC.pauseRecording(),e()}catch(e){t(e)}}))},this.resumeRecording=function(){return new Promise((function(e,t){try{s.recordRTC.resumeRecording(),e()}catch(e){t(e)}}))},this.getDataURL=function(e){return new Promise((function(e,t){try{s.recordRTC.getDataURL((function(t){e(t)}))}catch(e){t(e)}}))},this.getBlob=function(){return new Promise((function(e,t){try{e(s.recordRTC.getBlob())}catch(e){t(e)}}))},this.getInternalRecorder=function(){return new Promise((function(e,t){try{e(s.recordRTC.getInternalRecorder())}catch(e){t(e)}}))},this.reset=function(){return new Promise((function(e,t){try{e(s.recordRTC.reset())}catch(e){t(e)}}))},this.destroy=function(){return new Promise((function(e,t){try{e(s.recordRTC.destroy())}catch(e){t(e)}}))},this.getState=function(){return new Promise((function(e,t){try{e(s.recordRTC.getState())}catch(e){t(e)}}))},this.blob=null,this.version="5.6.2"},t.WebAssemblyRecorder=I}));class Bn{static _ebsp2rbsp(e){let t=e,i=t.byteLength,s=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(s[r]=t[e],r++);return new Uint8Array(s.buffer,0,r)}static parseSPS(e){let t=Bn._ebsp2rbsp(e),i=new Br(t);i.readByte();let s=i.readByte();i.readByte();let r=i.readByte();i.readUEG();let o=Bn.getProfileString(s),a=Bn.getLevelString(r),n=1,l=420,d=[0,420,422,444],h=8;if((100===s||110===s||122===s||244===s||44===s||83===s||86===s||118===s||128===s||138===s||144===s)&&(n=i.readUEG(),3===n&&i.readBits(1),n<=3&&(l=d[n]),h=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool())){let e=3!==n?8:12;for(let t=0;t0&&e<16?(v=t[e-1],_=s[e-1]):255===e&&(v=i.readByte()<<8|i.readByte(),_=i.readByte()<<8|i.readByte())}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool()&&i.readBits(24)),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool()){let e=i.readBits(32),t=i.readBits(32);S=i.readBool(),E=t,T=2*e,w=E/T}}let k=1;1===v&&1===_||(k=v/_);let L=0,C=0;if(0===n)L=1,C=2-m;else{L=3===n?1:2,C=(1===n?2:1)*(2-m)}let x=16*(p+1),D=16*(f+1)*(2-m);x-=(g+y)*L,D-=(A+b)*C;let R=Math.ceil(x*k);return i.destroy(),i=null,{profile_string:o,level_string:a,bit_depth:h,ref_frames:u,chroma_format:l,chroma_format_string:Bn.getChromaFormatString(l),frame_rate:{fixed:S,fps:w,fps_den:T,fps_num:E},sar_ratio:{width:v,height:_},codec_size:{width:x,height:D},present_size:{width:R,height:D}}}static parseSPS$2(e){let t=e.subarray(1,4),i="avc1.";for(let e=0;e<3;e++){let s=t[e].toString(16);s.length<2&&(s="0"+s),i+=s}let s=Bn._ebsp2rbsp(e),r=new Br(s);r.readByte();let o=r.readByte();r.readByte();let a=r.readByte();r.readUEG();let n=Bn.getProfileString(o),l=Bn.getLevelString(a),d=1,h=420,c=[0,420,422,444],u=8,p=8;if((100===o||110===o||122===o||244===o||44===o||83===o||86===o||118===o||128===o||138===o||144===o)&&(d=r.readUEG(),3===d&&r.readBits(1),d<=3&&(h=c[d]),u=r.readUEG()+8,p=r.readUEG()+8,r.readBits(1),r.readBool())){let e=3!==d?8:12;for(let t=0;t0&&e<16?(S=t[e-1],E=i[e-1]):255===e&&(S=r.readByte()<<8|r.readByte(),E=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);k=r.readBool(),L=t,C=2*e,T=L/C}}let x=1;1===S&&1===E||(x=S/E);let D=0,R=0;if(0===d)D=1,R=2-A;else{D=3===d?1:2,R=(1===d?2:1)*(2-A)}let P=16*(g+1),I=16*(y+1)*(2-A);P-=(b+v)*D,I-=(_+w)*R;let B=Math.ceil(P*x);return r.destroy(),r=null,{codec_mimetype:i,profile_idc:o,level_idc:a,profile_string:n,level_string:l,chroma_format_idc:d,bit_depth:u,bit_depth_luma:u,bit_depth_chroma:p,ref_frames:m,chroma_format:h,chroma_format_string:Bn.getChromaFormatString(h),frame_rate:{fixed:k,fps:T,fps_den:C,fps_num:L},sar_ratio:{width:S,height:E},codec_size:{width:P,height:I},present_size:{width:B,height:I}}}static _skipScalingList(e,t){let i=8,s=8,r=0;for(let o=0;o=this.buflen)return this.iserro=!0,0;this.iserro=!1,i=this.bufoff+e>8?8-this.bufoff:e,t<<=i,t+=this.buffer[this.bufpos]>>8-this.bufoff-i&255>>8-i,this.bufoff+=i,e-=i,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,i=this.bufoff,s=this.read(e);return this.bufpos=t,this.bufoff=i,s}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),s=new Uint8Array(e+4);s.set(i,0),s.set(t.sps,4),t.sps=s}if(t.pps){const e=t.pps.byteLength,i=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),s=new Uint8Array(e+4);s.set(i,0),s.set(t.pps,4),t.pps=s}return t}function Un(e){let{sps:t,pps:i}=e,s=8+t.byteLength+1+2+i.byteLength,r=!1;const o=Bn.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(r=!0,s+=4);let a=new Uint8Array(s);a[0]=1,a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=255,a[5]=225;let n=t.byteLength;a[6]=n>>>8,a[7]=255&n;let l=8;a.set(t,8),l+=n,a[l]=1;let d=i.byteLength;a[l+1]=d>>>8,a[l+2]=255&d,a.set(i,l+3),l+=3+d,r&&(a[l]=252|o.chroma_format_idc,a[l+1]=248|o.bit_depth_luma-8,a[l+2]=248|o.bit_depth_chroma-8,a[l+3]=0,l+=4);const h=[23,0,0,0,0],c=new Uint8Array(h.length+a.byteLength);return c.set(h,0),c.set(a,h.length),c}function On(e,t){let i=[];i[0]=t?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}function Nn(e){return 31&e[0]}function jn(e){return e===Pt}function Gn(e){return!function(e){return e===Lt||e===Ct}(e)&&!jn(e)}function Wn(e){return e===xt}class zn{constructor(e){this.data=e,this.eofFlag=!1,this.currentStartcodeOffset=this.findNextStartCodeOffset(0),this.eofFlag&&console.error("Could not find H264 startcode until payload end!")}findNextStartCodeOffset(e){let t=e,i=this.data;for(;;){if(t+3>=i.byteLength)return this.eofFlag=!0,i.byteLength;let e=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],s=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===e||1===s)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let i=this.currentStartcodeOffset;i+=1===(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3;let s=31&e[i],r=(128&e[i])>>>7,o=this.findNextStartCodeOffset(i);this.currentStartcodeOffset=o,s>=Mt||0===r&&(t={type:s,data:e.subarray(i,o)})}return t}}class $n{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Vn=e=>{let t=e,i=t.byteLength,s=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(s[r]=t[e],r++);return new Uint8Array(s.buffer,0,r)},Hn=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Jn{static _ebsp2rbsp(e){let t=e,i=t.byteLength,s=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(s[r]=t[e],r++);return new Uint8Array(s.buffer,0,r)}static parseVPS(e){let t=Jn._ebsp2rbsp(e),i=new Br(t);return i.readByte(),i.readByte(),i.readBits(4),i.readBits(2),i.readBits(6),{num_temporal_layers:i.readBits(3)+1,temporal_id_nested:i.readBool()}}static parseSPS(e){let t=Jn._ebsp2rbsp(e),i=new Br(t);i.readByte(),i.readByte();let s=0,r=0,o=0,a=0;i.readBits(4);let n=i.readBits(3);i.readBool();let l=i.readBits(2),d=i.readBool(),h=i.readBits(5),c=i.readByte(),u=i.readByte(),p=i.readByte(),f=i.readByte(),m=i.readByte(),g=i.readByte(),y=i.readByte(),A=i.readByte(),b=i.readByte(),v=i.readByte(),_=i.readByte(),w=[],S=[];for(let e=0;e0)for(let e=n;e<8;e++)i.readBits(2);for(let e=0;e1&&i.readSEG();for(let e=0;e0&&e<=16?(B=t[e-1],M=s[e-1]):255===e&&(B=i.readBits(16),M=i.readBits(16))}if(i.readBool()&&i.readBool(),i.readBool()){i.readBits(3),i.readBool(),i.readBool()&&(i.readByte(),i.readByte(),i.readByte())}if(i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool(),i.readBool(),i.readBool(),P=i.readBool(),P&&(i.readUEG(),i.readUEG(),i.readUEG(),i.readUEG()),i.readBool()){if(U=i.readBits(32),O=i.readBits(32),i.readBool()&&i.readUEG(),i.readBool()){let e=!1,t=!1,s=!1;e=i.readBool(),t=i.readBool(),(e||t)&&(s=i.readBool(),s&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),s&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(let r=0;r<=n;r++){let r=i.readBool();F=r;let o=!0,a=1;r||(o=i.readBool());let n=!1;if(o?i.readUEG():n=i.readBool(),n||(a=i.readUEG()+1),e){for(let e=0;e>6&3,i.general_tier_flag=e[1]>>5&1,i.general_profile_idc=31&e[1],i.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],i.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],i.general_constraint_indicator_flags=i.general_constraint_indicator_flags<<16|e[10]<<8|e[11],i.general_level_idc=e[12],i.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],i.parallelismType=3&e[15],i.chromaFormat=3&e[16],i.bitDepthLumaMinus8=7&e[17],i.bitDepthChromaMinus8=7&e[18],i.avgFrameRate=e[19]<<8|e[20],i.constantFrameRate=e[21]>>6&3,i.numTemporalLayers=e[21]>>3&7,i.temporalIdNested=e[21]>>2&1,i.lengthSizeMinusOne=3&e[21];let s=e[22],r=e.slice(23);for(let e=0;e0)for(let t=i;t<8;t++)e.read(2);s.sub_layer_profile_space=[],s.sub_layer_tier_flag=[],s.sub_layer_profile_idc=[],s.sub_layer_profile_compatibility_flag=[],s.sub_layer_progressive_source_flag=[],s.sub_layer_interlaced_source_flag=[],s.sub_layer_non_packed_constraint_flag=[],s.sub_layer_frame_only_constraint_flag=[],s.sub_layer_level_idc=[];for(let t=0;t{let t=Vn(e),i=new Br(t);return i.readByte(),i.readByte(),i.readBits(4),i.readBits(2),i.readBits(6),{num_temporal_layers:i.readBits(3)+1,temporal_id_nested:i.readBool()}})(t),a=(e=>{let t=Vn(e),i=new Br(t);i.readByte(),i.readByte();let s=0,r=0,o=0,a=0;i.readBits(4);let n=i.readBits(3);i.readBool();let l=i.readBits(2),d=i.readBool(),h=i.readBits(5),c=i.readByte(),u=i.readByte(),p=i.readByte(),f=i.readByte(),m=i.readByte(),g=i.readByte(),y=i.readByte(),A=i.readByte(),b=i.readByte(),v=i.readByte(),_=i.readByte(),w=[],S=[];for(let e=0;e0)for(let e=n;e<8;e++)i.readBits(2);for(let e=0;e1&&i.readSEG();for(let e=0;e0&&e<16?(B=t[e-1],M=s[e-1]):255===e&&(B=i.readBits(16),M=i.readBits(16))}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(3),i.readBool(),i.readBool()&&(i.readByte(),i.readByte(),i.readByte())),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool(),i.readBool(),i.readBool(),P=i.readBool(),P&&(s+=i.readUEG(),r+=i.readUEG(),o+=i.readUEG(),a+=i.readUEG()),i.readBool()&&(U=i.readBits(32),O=i.readBits(32),i.readBool()&&(i.readUEG(),i.readBool()))){let e=!1,t=!1,s=!1;e=i.readBool(),t=i.readBool(),(e||t)&&(s=i.readBool(),s&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),s&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(let r=0;r<=n;r++){let r=i.readBool();F=r;let o=!1,a=1;r||(o=i.readBool());let n=!1;if(o?i.readSEG():n=i.readBool(),n||(cpbcnt=i.readUEG()+1),e)for(let e=0;e{let t=Vn(e),i=new Br(t);i.readByte(),i.readByte(),i.readUEG(),i.readUEG(),i.readBool(),i.readBool(),i.readBits(3),i.readBool(),i.readBool(),i.readUEG(),i.readUEG(),i.readSEG(),i.readBool(),i.readBool(),i.readBool()&&i.readUEG(),i.readSEG(),i.readSEG(),i.readBool(),i.readBool(),i.readBool(),i.readBool();let s=i.readBool(),r=i.readBool(),o=1;return r&&s?o=0:r?o=3:s&&(o=2),{parallelismType:o}})(i);r=Object.assign(r,o,a,n);let l=23+(5+t.byteLength)+(5+s.byteLength)+(5+i.byteLength),d=new Uint8Array(l);d[0]=1,d[1]=(3&r.general_profile_space)<<6|(r.general_tier_flag?1:0)<<5|31&r.general_profile_idc,d[2]=r.general_profile_compatibility_flags_1||0,d[3]=r.general_profile_compatibility_flags_2||0,d[4]=r.general_profile_compatibility_flags_3||0,d[5]=r.general_profile_compatibility_flags_4||0,d[6]=r.general_constraint_indicator_flags_1||0,d[7]=r.general_constraint_indicator_flags_2||0,d[8]=r.general_constraint_indicator_flags_3||0,d[9]=r.general_constraint_indicator_flags_4||0,d[10]=r.general_constraint_indicator_flags_5||0,d[11]=r.general_constraint_indicator_flags_6||0,d[12]=60,d[13]=240|(3840&r.min_spatial_segmentation_idc)>>8,d[14]=255&r.min_spatial_segmentation_idc,d[15]=252|3&r.parallelismType,d[16]=252|3&r.chroma_format_idc,d[17]=248|7&r.bit_depth_luma_minus8,d[18]=248|7&r.bit_depth_chroma_minus8,d[19]=0,d[20]=0,d[21]=(3&r.constant_frame_rate)<<6|(7&r.num_temporal_layers)<<3|(r.temporal_id_nested?1:0)<<2|3,d[22]=3,d[23]=128|Wt,d[24]=0,d[25]=1,d[26]=(65280&t.byteLength)>>8,d[27]=(255&t.byteLength)>>0,d.set(t,28),d[23+(5+t.byteLength)+0]=128|$t,d[23+(5+t.byteLength)+1]=0,d[23+(5+t.byteLength)+2]=1,d[23+(5+t.byteLength)+3]=(65280&s.byteLength)>>8,d[23+(5+t.byteLength)+4]=(255&s.byteLength)>>0,d.set(s,23+(5+t.byteLength)+5),d[23+(5+t.byteLength+5+s.byteLength)+0]=128|Ht,d[23+(5+t.byteLength+5+s.byteLength)+1]=0,d[23+(5+t.byteLength+5+s.byteLength)+2]=1,d[23+(5+t.byteLength+5+s.byteLength)+3]=(65280&i.byteLength)>>8,d[23+(5+t.byteLength+5+s.byteLength)+4]=(255&i.byteLength)>>0,d.set(i,23+(5+t.byteLength+5+s.byteLength)+5);const h=[28,0,0,0,0],c=new Uint8Array(h.length+d.byteLength);return c.set(h,0),c.set(d,h.length),c}function Xn(e,t){let i=[];i[0]=t?28:44,i[1]=1,i[2]=0,i[3]=0,i[4]=0;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}function Zn(e){return(126&e[0])>>1}function el(e){return!function(e){return e>=32&&e<=40}(e)}function tl(e){return e>=16&&e<=21}class il{constructor(e){this.data=e,this.eofFlag=!1,this.currentStartcodeOffset=this.findNextStartCodeOffset(0),this.eofFlag&&console.error("Could not find H265 startcode until payload end!")}findNextStartCodeOffset(e){let t=e,i=this.data;for(;;){if(t+3>=i.byteLength)return this.eofFlag=!0,i.byteLength;let e=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],s=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===e||1===s)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let i=this.currentStartcodeOffset;i+=1===(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3;let s=e[i]>>1&63,r=(128&e[i])>>>7,o=this.findNextStartCodeOffset(i);this.currentStartcodeOffset=o,0===r&&(t={type:s,data:e.subarray(i,o)})}return t}}class sl{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}class rl extends o{constructor(e){super(),this.TAG_NAME="recorderCommon",this.player=e,this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.recordingInterval=null,this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.audioCodeId=null,this.metaInfo={codecWidth:0,codecHeight:0,presentWidth:0,presentHeight:0,refSampleDuration:0,timescale:1e3,avcc:null,videoType:""},this.audioMetaInfo={timescale:1e3,sampleRate:0,refSampleDuration:0,channelCount:0,codec:"",originalCodec:"",audioType:"",extraData:new Uint8Array(0)}}destroy(){this._reset(),this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.audioCodeId=null,this.metaInfo=null,this.audioMetaInfo=null}get isH264(){return this.codecId===At}get isH265(){return this.codecId===bt}setFileName(e){this.fileName=e}get isRecording(){return this._isRecording}get recording(){return this._isRecording}get recordTime(){return this._recordingTimestamp}startRecord(){}handleAddNaluTrack(e,t,i,s){}handleAddAudioTrack(e,t){}handleAddTrack(e){}stopRecordAndSave(){}startRecordingInterval(){}isWasmMp4(){return!1}stopRecordingInterval(){this.recordingInterval&&clearInterval(this.recordingInterval),this.recordingInterval=null}getToTalByteLength(){return 0}_reset(){this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.stopRecordingInterval()}initMetaData(e,t){let i;const s=e.slice(5);if(this.codecId=t,this.metaInfo.avcc=s,t===At)i=Fn(s);else if(t===bt){i=function(e){let t=23;const i=e[t];if((63&i)!==Wt)return console.warn(`parseHEVCDecoderVPSAndSPSAndPPS and vpsTag is ${i}`),{};t+=2,t+=1;const s=e[t+1]|e[t]<<8;t+=2;const r=e.slice(t,t+s);t+=s;const o=e[t];if((63&o)!==$t)return console.warn(`parseHEVCDecoderVPSAndSPSAndPPS and sps tag is ${o}`),{};t+=2,t+=1;const a=e[t+1]|e[t]<<8;t+=2;const n=e.slice(t,t+a);t+=a;const l=e[t];if((63&l)!==Ht)return console.warn(`parseHEVCDecoderVPSAndSPSAndPPS and pps tag is ${l}`),{};t+=2,t+=1;const d=e[t+1]|e[t]<<8;t+=2;const h=e.slice(t,t+d),c=new Uint8Array([a>>>24&255,a>>>16&255,a>>>8&255,255&a]),u=new Uint8Array([d>>>24&255,d>>>16&255,d>>>8&255,255&d]),p=new Uint8Array([s>>>24&255,s>>>16&255,s>>>8&255,255&s]),f=new Uint8Array(a+4);f.set(c,0),f.set(n,4);const m=new Uint8Array(d+4);m.set(u,0),m.set(h,4);const g=new Uint8Array(s+4);return g.set(p,0),g.set(r,4),{sps:f,pps:m,vps:g}}(s);const t=qn(e);i=Object.assign(i,t)}i&&(i.vps&&(this.vps=i.vps),i.pps&&(this.pps=i.pps),i.sps&&(this.sps=i.sps),i.presentWidth&&(this.metaInfo.presentWidth=i.presentWidth),i.presentHeight&&(this.metaInfo.presentHeight=i.presentHeight),i.codecWidth&&(this.metaInfo.codecWidth=i.codecWidth),i.codecHeight&&(this.metaInfo.codecHeight=i.codecHeight),i.timescale&&(this.metaInfo.timescale=i.timescale),i.refSampleDuration&&(this.metaInfo.refSampleDuration=i.refSampleDuration),i.videoType&&(this.metaInfo.videoType=i.videoType))}initAudioMetaData(e,t){this.audioCodeId=t;const i=e[0]>>1&1;let s=null;t===wt?(s=function(e){let t={},i=new Vr(e);return i.read(16),t.object_type=Hr(i),t.sample_rate=Jr(i,t),t.chan_config=i.read(4),t.chan_config{r.onload=function(e){i.decode(this.result).forEach((function(e){t.read(e)})),t.stop();const r=s.makeMetadataSeekable(t.metadatas,t.duration,t.cues),a=this.result.slice(t.metadataSize),n=new Blob([r,a],{type:"video/webm"});o(n)},r.readAsArrayBuffer(e)}))}startRecord(){const e={type:"video",mimeType:"video/webm;codecs=h264",timeSlice:1e3,onTimeStamp:e=>{this.player&&this.player.debugLog("RecorderRTC","record timestamp :"+e),null===this._startRecordingTimestamp&&(this._startRecordingTimestamp=e),this._recordingTimestamp=(e-this._startRecordingTimestamp)/1e3},ondataavailable:e=>{this.totalByteLength+=e.size,this.player&&this.player.debugLog("RecorderRTC","ondataavailable",e.size)},disableLogs:!this.player._opt.debug};try{let t=null;if(this.player.getRenderType()===H?t=this.player.video.$videoElement.captureStream(25):this.player.video.mediaStream?t=this.player.video.mediaStream:this.player.isOldHls()||this.player._opt.useMSE||this.player._opt.useWCS?t=this.player.video.$videoElement.captureStream(25):this.player.isWebrtcH264()?t=this.player.webrtc.videoStream:this.player.isAliyunRtc()&&(t=this.player.video.$videoElement.captureStream(25)),!t)return this.player.debugError("RecorderRTC","startRecord error and can not create stream"),void this.player.emitError(at.recordCreateError,"can not create stream");if(this.player.audio&&this.player.audio.mediaStreamAudioDestinationNode&&this.player.audio.mediaStreamAudioDestinationNode.stream&&!this.player.audio.isStateSuspended()&&this.player.audio.hasAudio&&this.player._opt.hasAudio){const e=this.player.audio.mediaStreamAudioDestinationNode.stream;if(e.getAudioTracks().length>0){const i=e.getAudioTracks()[0];i&&i.enabled&&t.addTrack(i)}}this.recorder=In(t,e)}catch(e){return this.player.debugError("RecorderRTC","startRecord error",e),void this.player.emitError(at.recordCreateError,e)}this.recorder&&(this._isRecording=!0,this.player.emit(at.recording,!0),this.recorder.startRecording(),this.player.debugLog("RecorderRTC","start recording"),this.player.emit(at.recordStart),this.startRecordingInterval())}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(at.recordingTimestamp,this._recordingTimestamp)}),1e3)}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:mt,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{this.recorder&&this._isRecording||s("recorder is not ready"),t&&this.setFileName(t),this.recorder.stopRecording((()=>{this.player.debugLog("RecorderRTC","stop recording");const t=(this.fileName||oo())+"."+E;if(this.player._opt.recordWebMSupportSeek);else{if(e===gt){const e=this.recorder.getBlob();i(e),this.player.emit(at.recordBlob,e)}else i(),this.recorder.save(t);this.player.emit(at.recordEnd),this._reset(),this.player.emit(at.recording,!1)}}))}))}cancelRecord(){return new Promise(((e,t)=>{if(this.player.debugLog(this.TAG_NAME,"cancel recording"),!this.recorder||!this._isRecording)return e();this.recorder.stopRecording((()=>{this._reset(),this.player.emit(at.recording,!1),this.player.emit(at.recordCancel),e()}))}))}getToTalByteLength(){return this.totalByteLength}getTotalDuration(){return this.recordTime}getType(){return E}initMetaData(){}}class al{static init(){al.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],free:[],edts:[],elst:[],stss:[]};for(let e in al.types)al.types.hasOwnProperty(e)&&(al.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=al.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,50,97,118,99,49,109,112,52,49,0,0,0,0]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,s=Array.prototype.slice.call(arguments,1),r=s.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let o=8;for(let e=0;e=Math.pow(2,32)-1?(o=16,a=new Uint8Array(i+o),a.set(new Uint8Array([0,0,0,1]),0),a.set(al.types.mdat,4),a.set(new Uint8Array([i+8>>>56&255,i+8>>>48&255,i+8>>>40&255,i+8>>>32&255,i+8>>>24&255,i+8>>>16&255,i+8>>>8&255,i+8&255]),8)):(a=new Uint8Array(i+o),a[0]=i+8>>>24&255,a[1]=i+8>>>16&255,a[2]=i+8>>>8&255,a[3]=i+8&255,a.set(al.types.mdat,4));for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3]))}static trak(e){return al.box(al.types.trak,al.tkhd(e),al.mdia(e))}static tkhd(e){let t=e.id,i=e.duration,s=e.presentWidth,r=e.presentHeight;return"video"===e.type?al.box(al.types.tkhd,new Uint8Array([0,0,0,15,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>>8&255,255&s,0,0,r>>>8&255,255&r,0,0])):"audio"===e.type?al.box(al.types.tkhd,new Uint8Array([0,0,0,15,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0])):void 0}static edts(e,t){return al.box(al.types.edts,al.elst(e,t))}static elst(e,t){let i=0;for(let s=0;s>>24&255,i>>>16&255,i>>>8&255,255&i,255,255,255,255,0,1,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,0,0,0,0,0,1,0,0]))}static mdia(e){return al.box(al.types.mdia,al.mdhd(e),al.hdlr(e),al.minf(e))}static mdhd(e){let t=e.timescale/e.refSampleDuration,i=t*e.duration/e.timescale;return al.box(al.types.mdhd,new Uint8Array([0,0,0,0,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?al.constants.HDLR_AUDIO:al.constants.HDLR_VIDEO,al.box(al.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?al.box(al.types.smhd,al.constants.SMHD):al.box(al.types.vmhd,al.constants.VMHD),al.box(al.types.minf,t,al.dinf(),al.stbl(e))}static dinf(){return al.box(al.types.dinf,al.box(al.types.dref,al.constants.DREF))}static stbl(e){let t=e.samples,i=[{No:1,num:0,sampleDelte:1,chunkNo:1,duration:t[0].duration}],s=[t[0].duration],r=t.length;for(let e=0;e>>24&255,t>>>16&255,t>>>8&255,255&t]),s=i.byteLength,r=new Uint8Array(s+8*t);r.set(i,0);for(let i=0;i>>24&255,e[i].num>>>16&255,e[i].num>>>8&255,255&e[i].num,e[i].sampleDelte>>>24&255,e[i].sampleDelte>>>16&255,e[i].sampleDelte>>>8&255,255&e[i].sampleDelte]),s),s+=8;return al.box(al.types.stts,r)}static stss(e){let t=[],i=e.length;for(let s=0;s>>24&255,s>>>16&255,s>>>8&255,255&s]),o=r.byteLength,a=new Uint8Array(o+4*s);a.set(r,0);for(let e=0;e>>24&255,t[e]>>>16&255,t[e]>>>8&255,255&t[e]]),o),o+=4;return al.box(al.types.stss,a)}static stsc(e){let t=e.length,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]),s=i.byteLength,r=new Uint8Array(s+12*t);r.set(i,0);for(let i=0;i>>24&255,t>>>16&255,t>>>8&255,255&t,o>>>24&255,o>>>16&255,o>>>8&255,255&o,a>>>24&255,a>>>16&255,a>>>8&255,255&a]),s),s+=12}return al.box(al.types.stsc,r)}static stsz(e){let t=e.length,i=new Uint8Array([0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]),s=i.byteLength,r=new Uint8Array(s+4*t);r.set(i,0);for(let i=0;i>>24&255,t>>>16&255,t>>>8&255,255&t]),s),s+=4}return al.box(al.types.stsz,r)}static stco(e,t){let i=t[0].chunkOffset;return al.box(al.types.stco,new Uint8Array([0,0,0,0,0,0,0,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i]))}static stsd(e){return"audio"===e.type?"mp3"===e.codec?al.box(al.types.stsd,al.constants.STSD_PREFIX,al.mp3(e)):al.box(al.types.stsd,al.constants.STSD_PREFIX,al.mp4a(e)):"avc"===e.videoType?al.box(al.types.stsd,al.constants.STSD_PREFIX,al.avc1(e)):al.box(al.types.stsd,al.constants.STSD_PREFIX,al.hvc1(e))}static mp3(e){let t=e.channelCount,i=e.sampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return al.box(al.types[".mp3"],s)}static mp4a(e){let t=e.channelCount,i=e.sampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return al.box(al.types.mp4a,s,al.esds(e))}static esds(e){let t=e.config||[],i=t.length,s=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return al.box(al.types.esds,s)}static avc1(e){let t=e.avcc,i=e.codecWidth,s=e.codecHeight,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return al.box(al.types.avc1,r,al.box(al.types.avcC,t))}static hvc1(e){let t=e.avcc;const i=e.codecWidth,s=e.codecHeight;let r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return al.box(al.types.hvc1,r,al.box(al.types.hvcC,t))}static mvex(e){return al.box(al.types.mvex,al.trex(e))}static trex(e){let t=e.id,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return al.box(al.types.trex,i)}static moof(e,t){return al.box(al.types.moof,al.mfhd(e.sequenceNumber),al.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return al.box(al.types.mfhd,t)}static traf(e,t){let i=e.id,s=al.box(al.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),r=al.box(al.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),o=al.sdtp(e),a=al.trun(e,o.byteLength+16+16+8+16+8+8);return al.box(al.types.traf,s,r,a,o)}static sdtp(e){let t=e.samples||[],i=t.length,s=new Uint8Array(4+i);for(let e=0;e>>24&255,s>>>16&255,s>>>8&255,255&s,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);for(let e=0;e>>24&255,t>>>16&255,t>>>8&255,255&t,s>>>24&255,s>>>16&255,s>>>8&255,255&s,r.isLeading<<2|r.dependsOn,r.isDependedOn<<6|r.hasRedundancy<<4|r.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12+16*e)}return al.box(al.types.trun,o)}static mdat(e){return al.box(al.types.mdat,e)}}al.init();class nl extends rl{constructor(e){super(e),this.TAG_NAME="recorderMP4",this._reset(),e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this._reset(),this.player.debugLog(this.TAG_NAME,"destroy")}_reset(){super._reset(),this.totalDuration=0,this.totalAudioDuration=0,this.totalByteLength=0,this.totalAudioByteLength=0,this.bufferList=[],this.audioBufferList=[],this.cacheTrack={},this.audioCacheTrack={},this.sequenceNumber=0,this.audioSequenceNumber=0}startRecord(){this._isRecording=!0,this.player.emit(at.recording,!0),this.player.debugLog(this.TAG_NAME,"start recording"),this.player.emit(at.recordStart),this.startRecordingInterval()}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(at.recordingTimestamp,this.getTotalDuration())}),1e3)}formatFmp4Track(e,t,i,s){return{id:1,sequenceNumber:++this.sequenceNumber,size:e.byteLength,dts:i,cts:s,isKeyframe:t,data:e,duration:0,flags:{isLeading:0,dependsOn:t?2:1,isDependedOn:t?1:0,hasRedundancy:0,isNonSync:t?0:1}}}formatAudioFmp4Track(e,t){return{id:2,sequenceNumber:++this.audioSequenceNumber,size:e.byteLength,dts:t,pts:t,cts:0,data:new Uint8Array(e),duration:0,originalDts:t,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}}handleAddNaluTrack(e,t,i,s){this.cacheTrack.id&&i>=this.cacheTrack.dts?(this.cacheTrack.duration=i-this.cacheTrack.dts,this.handleAddFmp4Track(this.cacheTrack)):this.cacheTrack={},this.cacheTrack=this.formatFmp4Track(e,t,i,s)}handleAddAudioTrack(e,t){}handleAddFmp4Track(e){if(!this.isRecording)return void this.player.debugError(this.TAG_NAME,"handleAddFmp4Track, isRecording is false ");if((null===this.sps||null===this.pps)&&this.isH264)return void this.player.debugError(this.TAG_NAME,"handleAddFmp4Track, is h264 and this.sps or this.pps is null ");if((null===this.sps||null===this.pps||null===this.vps)&&this.isH265)return void this.player.debugError(this.TAG_NAME,"handleAddFmp4Track, is h265 and this.sps or this.pps or this.vps is null ");const t=Object.assign({},e);t.pts=t.dts+t.cts;const i=t.data;if(t.isKeyframe)if(this.isH264){const e=new Uint8Array(this.sps.byteLength+this.pps.byteLength);e.set(this.sps,0),e.set(this.pps,this.sps.byteLength);const s=new Uint8Array(e.byteLength+i.byteLength);s.set(e,0),s.set(i,e.byteLength),t.data=s}else if(this.isH265){const e=new Uint8Array(this.sps.byteLength+this.pps.byteLength+this.vps.byteLength);e.set(this.vps,0),e.set(this.sps,this.vps.byteLength),e.set(this.pps,this.vps.byteLength+this.sps.byteLength);const s=new Uint8Array(e.byteLength+i.byteLength);s.set(e,0),s.set(i,e.byteLength),t.data=s}t.size=t.data.byteLength,this.totalDuration+=t.duration,this.totalByteLength+=t.data.byteLength,t.duration=0,t.originalDts=t.dts,delete t.id,delete t.sequenceNumber,this.bufferList.push(t)}handleAddFmp4AudioTrack(e){const t=Object.assign({},e);t.pts=t.dts+t.cts,t.size=t.data.byteLength,this.totalAudioDuration+=t.duration,this.totalAudioByteLength+=t.data.byteLength,t.duration=0,t.originalDts=t.dts,delete t.id,delete t.sequenceNumber,this.audioBufferList.push(t)}getTotalDuration(){return this.totalDuration/1e3}getType(){return S}getToTalByteLength(){return this.totalByteLength+this.totalAudioByteLength}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:mt,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{if(!this.isRecording)return this.player.debugError(this.TAG_NAME,"stop recording fail, isRecording is false "),s("stop recording fail, isRecording is false ");if(0===this.bufferList.length)return this.player.debugError(this.TAG_NAME,"stop recording fail, this.bufferList.length is 0 "),s("stop recording fail, this.bufferList.length is 0 ");t&&this.setFileName(t);const r={id:1,type:"video",sps:this.sps,pps:this.pps,samples:this.bufferList,sequenceNumber:this.bufferList.length,length:0,addSampleNum:1,duration:0,...this.metaInfo},o={id:2,type:"audio",sequenceNumber:this.audioBufferList.length,samples:this.audioBufferList,...this.audioMetaInfo},a=[r];o.samples.length>0&&a.push(o),this.player.debugLog(this.TAG_NAME,`trackList length is ${a.length}`);const n=al.generateInitSegment({timescale:1e3,duration:this.totalDuration},a,this.totalByteLength+this.totalAudioByteLength);this.player.debugLog(this.TAG_NAME,"stop recording");const l=new Blob([n],{type:"application/octet-stream"});if(e===gt)i(l),this.player.emit(at.recordBlob,l);else{i();Po((this.fileName||oo())+"."+S,l)}this._reset(),this.player.emit(at.recording,!1)}))}cancelRecord(){return new Promise(((e,t)=>{if(this.player.debugLog(this.TAG_NAME,"cancel recording"),!this.isRecording)return e();this._reset(),this.player.emit(at.recording,!1),this.player.emit(at.recordCancel),e()}))}}function ll(){for(var e=arguments.length,t=new Array(e),i=0;i{const i=new s((0|e.byteLength)+(0|t.byteLength));return i.set(e,0),i.set(t,0|e.byteLength),i}),new s)}function dl(e){if((e=e.replace(/\s/g,"")).length%2!=0)return console.error("hexStringToUint8Array: invalid hexString length, must be even and bexString length is: ",e.length),null;const t=new Uint8Array(e.length/2);for(let i=0;i{this.player.emit(at.recordingTimestamp,this.getTotalDuration())}),1e3)}addMetaData(e){this.flvMetaData=e}addAACSequenceHeader(e){this.aacSequenceHeader=e}addVideoSequenceHeader(e){this.videoSequenceHeader=e}addVideo(e,t){this._setStartTime(t);const i=this._getBufferTs(t);this.hasVideo=!0,this._createBufferItem(e,je,i)}addAudio(e,t){this._setStartTime(t);const i=this._getBufferTs(t);this.hasAudio=!0,this._createBufferItem(e,Ne,i)}_setStartTime(e){null===this.startTime&&this._isRecording&&(this.startTime=e,this.player.debugLog(this.TAG_NAME,`_setStartTime is ${e}`))}_getBufferTs(e){e>this.currentTime&&(this.currentTime=e);let t=0;return this.startTime&&e>=this.startTime&&(t=e-this.startTime),t>this.prevTimestamp?this.prevTimestamp=t:t=this.prevTimestamp,t}_createBufferItem(e,t,i){const s=this._createFlvPacket(e,t,i),r=this._createFlvTag(s);this.totalByteLength+=r.byteLength,this.bufferList.push(r)}_createFlvTag(e){let t=11+e.header.length,i=new Uint8Array(t+4);i[0]=e.header.type;let s=new DataView(i.buffer);return i[1]=e.header.length>>16&255,i[2]=e.header.length>>8&255,i[3]=255&e.header.length,i[4]=e.header.timestamp>>16&255,i[5]=e.header.timestamp>>8&255,i[6]=255&e.header.timestamp,i[7]=e.header.timestamp>>24&255,i[8]=0,i[9]=0,i[10]=0,s.setUint32(t,t),i.set(e.payload.subarray(0,e.header.length),11),i}_createFlvPacket(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{header:{length:e?e.length:0,timestamp:i,type:t},payload:e}}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:mt,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{if(!this.isRecording)return this.player.debugError(this.TAG_NAME,"stop recording fail, isRecording is false "),s("stop recording fail, isRecording is false ");if(0===this.bufferList.length)return this.player.debugError(this.TAG_NAME,"stop recording fail, this.bufferList.length is 0 "),s("stop recording fail, this.bufferList.length is 0 ");t&&this.setFileName(t);const r=new Uint8Array([70,76,86,1,0,0,0,0,9,0,0,0,0]);this.hasVideo&&(r[4]|=1),this.hasAudio&&(r[4]|=4);let o=[r];if(this.flvMetaData){const e=this._createFlvPacket(this.flvMetaData,Ge),t=this._createFlvTag(e);o.push(t)}if(this.videoSequenceHeader){const e=this._createFlvPacket(this.videoSequenceHeader,je),t=this._createFlvTag(e);o.push(t)}if(this.aacSequenceHeader){const e=this._createFlvPacket(this.aacSequenceHeader,Ne),t=this._createFlvTag(e);o.push(t)}const a=function(e){const t=e[0].constructor;return e.reduce(((e,i)=>{const s=new t((0|e.byteLength)+(0|i.byteLength));return s.set(e,0),s.set(i,0|e.byteLength),s}),new t)}(o.concat(this.bufferList));this.player.debugLog(this.TAG_NAME,"stop recording");const n=new Blob([a],{type:"application/octet-stream"});if(e===gt)i(n),this.player.emit(at.recordBlob,n);else{i();Po((this.fileName||oo())+"."+T,n)}this._reset(),this.player.emit(at.recording,!1)}))}cancelRecord(){return new Promise(((e,t)=>{if(this.player.debugLog(this.TAG_NAME,"cancel recording"),!this.isRecording)return e();this._reset(),this.player.emit(at.recording,!1),this.player.emit(at.recordCancel),e()}))}getTotalDuration(){let e=0;return null!==this.startTime&&null!==this.currentTime&&(e=this.currentTime-this.startTime),Math.round(e/1e3)}getType(){return T}getToTalByteLength(){return this.totalByteLength}}const cl={init:0,findFirstStartCode:1,findSecondStartCode:2};class ul extends o{constructor(e){super(),this.player=e,this.isDestroyed=!1,this.reset()}destroy(){this.isDestroyed=!1,this.off(),this.reset()}reset(){this.stats=cl.init,this.tempBuffer=new Uint8Array(0),this.parsedOffset=0,this.versionLayer=0}dispatch(e,t){let i=new Uint8Array(this.tempBuffer.length+e.length);for(i.set(this.tempBuffer,0),i.set(e,this.tempBuffer.length),this.tempBuffer=i;!this.isDestroyed;){if(this.state==cl.Init){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=cl.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==cl.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=cl.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==cl.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=cl.findFirstStartCode}}}}class pl extends rl{constructor(e){super(e),this.TAG_NAME="recorderWasmMP4",this._reset(),this.wasmMp4Recorder=null,this.mp3Demuxer=null,e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.mp3Demuxer&&(this.mp3Demuxer.destroy(),this.mp3Demuxer=null),this._reset(),this.player.debugLog(this.TAG_NAME,"destroy")}_reset(){super._reset(),this.cacheTrack={},this.audioCacheTrack={},this.totalDuration=0,this.totalAudioDuration=0,this.totalByteLength=0,this.totalAudioByteLength=0,this.hasAudio=!1,this.hasVideo=!1}getType(){return S}isWasmMp4(){return!0}getTotalDuration(){return this.totalDuration/1e3}getToTalByteLength(){return this.totalByteLength+this.totalAudioByteLength}startRecord(){const e=this.player,t=this.player.getAudioInfo(),i=this.player.getVideoInfo(),s={};if(this.codecId){const e={type:this.codecId,width:i.width,height:i.height,extraData:this.metaInfo.avcc};s.video=e,this.hasVideo=!0}if(t.encTypeCode){const e={type:t.encTypeCode,sampleRate:t.sampleRate,channels:t.channels,extraData:this.audioMetaInfo.extraData,depth:t.depth};this.audioCodeId=t.encTypeCode,s.audio=e,this.hasAudio=!0}this.wasmMp4Recorder=new window.JessibucaProMp4Recorder({debug:e._opt.debug,debugLevel:e._opt.debugLevel,debugUuid:e._opt.debugUuid,decoder:e._opt.wasmMp4RecorderDecoder}),this.wasmMp4Recorder.on("recordingTimestamp",(e=>{this._recordingTimestamp=e/1e3})),this.wasmMp4Recorder.startRecord(s).then((()=>{this._isRecording=!0,this.player.emit(at.recording,!0),this.player.debugLog(this.TAG_NAME,"start recording"),this.player.emit(at.recordStart),this.startRecordingInterval()})).catch((e=>{this.player.debugError(this.TAG_NAME,"startRecord error",e),this.player.emitError(at.recordCreateError,e)}))}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(at.recordingTimestamp,this.recordTime)}),1e3)}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:mt,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>this.isRecording?0===this.totalDuration?(this.player.debugError(this.TAG_NAME,"stop recording fail, totalDuration is 0 "),s("stop recording fail, totalDuration is 0 ")):(t&&this.setFileName(t),void this.wasmMp4Recorder.stopRecord().then((t=>{if(e===gt)i(t),this.player.emit(at.recordBlob,t);else{i();Po((this.fileName||oo())+"."+S,t)}})).catch((e=>{this.player.debugError(this.TAG_NAME,"stopRecord error",e),s(e)})).finally((()=>{this._reset(),this.player.emit(at.recording,!1)}))):(this.player.debugError(this.TAG_NAME,"stop recording fail, isRecording is false "),s("stop recording fail, isRecording is false "))))}cancelRecord(){return new Promise(((e,t)=>{if(this.player.debugLog(this.TAG_NAME,"cancel recording"),!this.isRecording||0===this.totalDuration)return e();this.wasmMp4Recorder.stopRecord().then((t=>{e()})).catch((e=>{this.player.debugError(this.TAG_NAME,"stopRecord error",e),t(e)})).finally((()=>{this._reset(),this.player.emit(at.recording,!1),this.player.emit(at.recordCancel)}))}))}handleAddAudioTrack(e,t){this.audioCodeId===Et?(this.mp3Demuxer||(this.mp3Demuxer=new ul(this.player),this.mp3Demuxer.on("data",((e,t)=>{this._handleAddAudioTrack(e,t)}))),this.mp3Demuxer.dispatch(e,t)):this._handleAddAudioTrack(e,t)}_handleAddAudioTrack(e,t){Aa(this.hasAudio)||(this.audioCacheTrack.id&&t>=this.audioCacheTrack.dts?(this.audioCacheTrack.duration=t-this.audioCacheTrack.dts,this.totalAudioDuration+=this.audioCacheTrack.duration,this.totalAudioByteLength+=this.audioCacheTrack.payload.byteLength,this.wasmMp4Recorder.sendAudioFrame(this.audioCacheTrack.payload,this.audioCacheTrack.dts)):this.audioCacheTrack={},this.audioCacheTrack={id:2,payload:e,dts:t})}handleAddNaluTrack(e,t,i,s){Aa(this.hasVideo)||(this.cacheTrack.id&&i>=this.cacheTrack.dts?(this.cacheTrack.duration=i-this.cacheTrack.dts,this.totalDuration+=this.cacheTrack.duration,this.totalByteLength+=this.cacheTrack.payload.byteLength,this.wasmMp4Recorder.sendVideoFrame(this.cacheTrack.payload,this.cacheTrack.isIFrame,this.cacheTrack.dts,this.cacheTrack.cts)):this.cacheTrack={},this.cacheTrack={id:1,payload:e,isIFrame:t,dts:i,cts:s})}}class fl{constructor(e){return new(fl.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){if(e.recordType===S){if(e.useWasm||e.useMSE||e.useWCS)return window.JessibucaProMp4Recorder&&e.mp4RecordUseWasm?pl:nl}else if(e.recordType===T)return hl;return ol}}function ml(e,t,i){let s=e;if(t+i=128){t.push(String.fromCharCode(65535&e)),s+=2;continue}}}else if(i[s]<240){if(ml(i,s,2)){let e=(15&i[s])<<12|(63&i[s+1])<<6|63&i[s+2];if(e>=2048&&55296!=(63488&e)){t.push(String.fromCharCode(65535&e)),s+=3;continue}}}else if(i[s]<248&&ml(i,s,3)){let e=(7&i[s])<<18|(63&i[s+1])<<12|(63&i[s+2])<<6|63&i[s+3];if(e>65536&&e<1114112){e-=65536,t.push(String.fromCharCode(e>>>10|55296)),t.push(String.fromCharCode(1023&e|56320)),s+=4;continue}}t.push(String.fromCharCode(65533)),++s}return t.join("")}let yl=function(){let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256===new Int16Array(e)[0]}();class Al{static parseScriptData(e,t,i){let s={};try{let r=Al.parseValue(e,t,i),o=Al.parseValue(e,t+r.size,i-r.size);s[r.data]=o.data}catch(e){console.error("AMF",e.toString())}return s}static parseObject(e,t,i){let s=Al.parseString(e,t,i),r=Al.parseValue(e,t+s.size,i-s.size),o=r.objectEnd;return{data:{name:s.data,value:r.data},size:s.size+r.size,objectEnd:o}}static parseVariable(e,t,i){return Al.parseObject(e,t,i)}static parseString(e,t,i){let s,r=new DataView(e,t,i).getUint16(0,!yl);return s=r>0?gl(new Uint8Array(e,t+2,r)):"",{data:s,size:2+r}}static parseLongString(e,t,i){let s,r=new DataView(e,t,i).getUint32(0,!yl);return s=r>0?gl(new Uint8Array(e,t+4,r)):"",{data:s,size:4+r}}static parseDate(e,t,i){let s=new DataView(e,t,i),r=s.getFloat64(0,!yl);return r+=60*s.getInt16(8,!yl)*1e3,{data:new Date(r),size:10}}static parseValue(e,t,i){let s,r=new DataView(e,t,i),o=1,a=r.getUint8(0),n=!1;try{switch(a){case 0:s=r.getFloat64(1,!yl),o+=8;break;case 1:s=!!r.getUint8(1),o+=1;break;case 2:{let r=Al.parseString(e,t+1,i-1);s=r.data,o+=r.size;break}case 3:{s={};let a=0;for(9==(16777215&r.getUint32(i-4,!yl))&&(a=3);o{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),ie)}this.decoderWorker=new Worker(t),this._initDecoderWorker(),this._listenPlaybackEvents(),e.debugLog("decoderWorker",`init and decoder url is ${t}`),e.on(at.visibilityChange,(()=>{this.updateWorkConfig({key:"visibility",value:e.visibility})}))}destroy(){return new Promise(((e,t)=>{if(this.player.loaded)if(this.player.debugLog("decoderWorker","has loaded and post message to destroy"),this.decoderWorker){const t={};this.player.isMseDecoderUseWorker()&&(t.isVideoInited=this.player.isMseVideoStateInited()),this.decoderWorker.postMessage({cmd:He,options:t}),this.destroyResolve=e,this.decoderWorkerCloseTimeout=setTimeout((()=>{this.player.debugWarn("decoderWorker","send close but not response and destroy directly"),this._destroy(),setTimeout((()=>{e()}),0)}),2e3)}else this.player.debugWarn("decoderWorker","has loaded but decoderWorker is null and destroy directly"),this._destroy(),setTimeout((()=>{e()}),0);else this.player.debugLog("decoderWorker","has not loaded and destroy directly"),this._destroy(),setTimeout((()=>{e()}),0)}))}_destroy(){this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this.workerUrl&&(window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.decoderWorker&&(this.decoderWorker.terminate(),this.decoderWorker.onerror=null,this.decoderWorker.onmessageerror=null,this.decoderWorker.onmessage=null,this.decoderWorker=null),this.player.debugLog("decoderWorker","destroy"),this.destroyResolve&&(this.destroyResolve(),this.destroyResolve=null),this.isDestroyed=!0}_listenPlaybackEvents(){this.player.isPlaybackPauseNotClearCacheAndCacheBeforeDecodeAndUseFpsRender()&&(this.player.debugLog(this.TAG_NAME,"listenPlaybackEvents"),this.player.on(at.playbackPause,(e=>{this.updatePlaybackIsPause(e)})))}_initDecoderWorker(){this.player,this.decoderWorker.onerror=e=>{const t=e.filename||"",i=e.message||"",s=t&&(-1!==t.indexOf(".wasm")||-1!==t.indexOf("wasm://"));s&&-1!==i.indexOf(rr)?this.player.debugLog("decoderWorker",`onerror and ignore filename: ${t},message: ${i}`,e):(this.player.debugError("decoderWorker",`onerror filename: ${t},message: ${i}`,e),s?this.player.emitError(dt.decoderWorkerWasmError,`filename: ${t},message: ${i}`):this.player.emitError(dt.decoderWorkerInitError,`filename: ${t},message: ${i}`))},this.decoderWorker.onmessageerror=e=>{this.player.debugError("decoderWorker","onmessageerror",e)},this.decoderWorker.onmessage=e=>{const t=e.data;switch(t.cmd){case oe:this.player.debugLog("decoderWorker","onmessage:",oe),this.decoderWorker&&this._initWork(),this.player.loaded||this.player.emit(at.load),this.player.emit(at.decoderWorkerInit);break;case pe:this.player.debugLog("decoderWorker","onmessage:",pe,t.code),this.player._times.decodeStart||(this.player._times.decodeStart=oo()),this.player.video.updateVideoInfo({encTypeCode:t.code});break;case fe:this.player.debugLog("decoderWorker","onmessage:",fe,t.codecId),this.player.recorder&&this.player.recorder.initMetaData(t.buffer,t.codecId),this.player.video.updateVideoInfo({encTypeCode:t.codecId});break;case he:this.player.debugLog("decoderWorker","onmessage:",he,t.code),this.player.audio&&this.player.audio.updateAudioInfo({encTypeCode:t.code});break;case ue:this.player.debugLog("decoderWorker","onmessage:",ue),this.player.recorder&&this.player.recorder.initAudioAacExtraData(t.buffer);break;case ae:if(this.player.debugLog("decoderWorker","onmessage:",ae,`width:${t.w},height:${t.h}`),Io(t.w)||Io(t.h))return void this.player.emitError(dt.videoInfoError,`video width ${t.w} or height ${t.h} is empty`);if(this.player.video.bindMediaStream(),this.player.video.updateVideoInfo({width:t.w,height:t.h}),!this.player._opt.openWebglAlignment&&t.w/2%4!=0&&this.player.getRenderType()===H)return void this.player.emitError(dt.webglAlignmentError);this.player.video.initCanvasViewSize(),this.player._opt.playType===w&&(this.player.video.initFps(),this.player.video.initVideoDelay());break;case de:if(this.player.debugLog("decoderWorker","onmessage:",de,`channels:${t.channels},sampleRate:${t.sampleRate}`),t.channels>2)return void this.player.emitError(dt.audioChannelError,`audio channel is ${t.channels}, max is 2`);this.player.audio&&(this.player.audio.updateAudioInfo(t),this.player._opt.playType===v?this.player.audio.initScriptNode():this.player._opt.playType===w&&this.player.audio.initScriptNodeDelay());break;case ne:if(!this.player.video)return void this.player.debugWarn("decoderWorker","onmessage render but video is null");if(this.player.isPlayer()){if(Aa(this.player.video.getHasInit()))return void this.player.debugWarn("decoderWorker","onmessage render but video has not init");this.player.video.render(t),this.player.handleRender(),this.player.emit(at.timeUpdate,t.ts),this.player.updateStats({dfps:!0,buf:t.delay}),this.player._times.videoStart||(this.player._times.videoStart=oo(),this.player.handlePlayToRenderTimes())}else this.player.isPlayback()&&(this.player.updateStats({dfps:!0}),Aa(this.player.playbackPause)?(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this.player.playback.isUseFpsRender?this.player.video.pushData(t):this.player.video.render$2(t)):this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this.player.playback.isUseFpsRender&&this.player.video.pushData(t));break;case me:this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===S&&this.player.recorder.handleAddNaluTrack(t.buffer,t.isIFrame,t.ts,t.cts);break;case ce:this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===S&&this.player.recorder.isWasmMp4()&&this.player.recorder.handleAddAudioTrack(t.buffer,t.ts);break;case ge:const{webcodecsDecoder:e,mseDecoder:i}=this.player;this.player.updateStats({buf:t.delay});const s=new Uint8Array(t.payload);this.player._opt.useWCS&&!this.player._opt.useOffscreen?e.decodeVideo(s,t.ts,t.isIFrame,t.cts):this.player._opt.useMSE&&i.decodeVideo(s,t.ts,t.isIFrame,t.cts);break;case ye:if(this.player._opt.useMSE){const e=new Uint8Array(t.payload);this.player.mseDecoder.decodeAudio(e,t.ts,t.cts)}break;case le:if(!this.player.audio)return void this.player.debugWarn("decoderWorker","onmessage playAudio but audio is null");(this.player.playing&&this.player.audio||!this.player.video)&&(this.player._opt.hasVideo||this.player.handleRender(),(this.player._opt.playType===v||this.player._opt.playType===w&&(Aa(this.player.playbackPause)||this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this.player.playback.isUseFpsRender))&&this.player.audio.play(t.buffer,t.ts));break;case Ae:if(t.type===at.streamSuccess)this.player.stream?this.player.stream.emit(at.streamSuccess):this.player.debugWarn("decoderWorker","onmessage and workerFetch response stream success but stream is null");else if(t.type===at.streamRate)this.player.emit(at.kBps,(t.value/1024).toFixed(2));else if(t.type===at.streamEnd)this.player?(t.value===m&&this.player.emit(at.websocketClose,t.msg),this.player.stream?this.player.stream.emit(at.streamEnd,t.msg):this.player.debugWarn("decoderWorker","onmessage and workerFetch response stream end but player.stream is null")):this.player.debugWarn("decoderWorker","onmessage and workerFetch response stream end but player is null");else if(t.type===dt.websocketError)this.player&&this.player.stream?this.player.stream.emit(dt.websocketError,t.value):this.player.debugWarn("decoderWorker","onmessage and workerFetch response websocket error but stream is null");else if(t.type===dt.fetchError)this.player&&this.player.stream?this.player.stream.emit(dt.fetchError,t.value):this.player.debugWarn("decoderWorker","onmessage and workerFetch response fetch error but stream is null");else if(t.type===at.streamAbps)this.player.updateStats({abps:t.value});else if(t.type===at.streamVbps)this.player._times.demuxStart||(this.player._times.demuxStart=oo()),this.player.updateStats({vbps:t.value});else if(t.type===at.streamDts)this.player.updateStats({dts:t.value});else if(t.type===at.netBuf)this.player.updateStats({netBuf:t.value});else if(t.type===at.networkDelayTimeout)this.player.emit(at.networkDelayTimeout,t.value);else if(t.type===at.streamStats){const e=JSON.parse(t.value);this.player.updateStats({workerStats:e})}else t.type===at.websocketOpen&&this.player.emit(at.websocketOpen);break;case be:this.player&&(this.player.videoIframeIntervalTs=t.value);break;case ve:this.player&&this.player.updateStats({isDropping:!0});break;case Ie:this.player.decoderCheckFirstIFrame();break;case we:this.player&&this.player.video&&this.player.video.setStreamFps(t.value);break;case Te:this.player.emitError(dt.simdH264DecodeVideoWidthIsTooLarge,t.value);break;case Se:this.player.emitError(dt.wasmWidthOrHeightChange,t.value);break;case Ee:this.player.emitError(dt.simdDecodeError);break;case _e:this.player.debugLog("decoderWorker","onmessage:",_e),this.player.destroy(),console.error("Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码),如需要购买商业授权,可以联系微信:bosswancheng"),alert("Jb pro 体验结束,请刷新页面再次体验,如需要购买商业授权,可以联系微信:bosswancheng"),window.location.reload();break;case ke:this.player.debugLog("decoderWorker","onmessage:",ke),this._destroy();break;case Le:this.player&&this.player.pushTempStream(t.buffer);break;case Ce:this.player&&this.player.emitVideoSei({ts:t.ts,data:new Uint8Array(t.buffer)});break;case xe:if(this.player){if(this.player.isRecordTypeFlv()){const e=new Uint8Array(t.buffer);this.player.recorder.addMetaData(e)}const e=bl(new Uint8Array(t.buffer));e&&e.onMetaData&&this.player.updateMetaData(e.onMetaData)}break;case De:if(this.player&&this.player.isRecordTypeFlv()){const e=new Uint8Array(t.buffer);this.player.recorder.addAACSequenceHeader(e,t.ts)}break;case Re:if(this.player&&this.player.isRecordTypeFlv()){const e=new Uint8Array(t.buffer);this.player.recorder.addVideoSequenceHeader(e,t.ts)}break;case Pe:if(this.player&&this.player.isRecordTypeFlv()&&this.player.recording){const e=new Uint8Array(t.buffer);t.type===Oe?this.player.recorder.addVideo(e,t.ts):t.type===Ue&&this.player.recorder.addAudio(e,t.ts)}break;case Be:this.player&&(this.player.debugLog("decoderWorker","onmessage:",Be),this.player.video.$videoElement.srcObject=t.mseHandle);break;case Me:this.player&&(this.player.debugLog("decoderWorker","onmessage:",Me,t.value),this.player._mseWorkerData.firstRenderTime=Number(t.value));break;case Fe:this.player&&(this.player.debugLog("decoderWorker","onmessage:",Fe,t.value,t.msg),this.player.emitError(t.value,t.msg));break;default:this.player[t.cmd]&&this.player[t.cmd](t)}}}_initWork(){const e={debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid,useOffscreen:this.player._opt.useOffscreen,useWCS:this.player._opt.useWCS,useMSE:this.player._opt.useMSE,videoBuffer:this.player._opt.videoBuffer,videoBufferDelay:this.player._opt.videoBufferDelay,openWebglAlignment:this.player._opt.openWebglAlignment,playType:this.player._opt.playType,hasAudio:this.player._opt.hasAudio,hasVideo:this.player._opt.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:this.player._opt.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:this.player.audio&&this.player.audio.audioContext&&this.player.audio.audioContext.sampleRate||Tr,audioBufferSize:this.player.audio&&this.player.audio.getAudioBufferSize()||1024,networkDelay:this.player._opt.networkDelay,visibility:this.player.visibility,useSIMD:this.player._opt.useSIMD,recordType:this.player._opt.recordType,checkFirstIFrame:this.player._opt.checkFirstIFrame,isM7sCrypto:this.player._opt.isM7sCrypto,isXorCrypto:this.player._opt.isXorCrypto,isSm4Crypto:this.player._opt.isSm4Crypto,isSm4CryptoH265V2:this.player._opt.isSm4CryptoH265V2,sm4CryptoKey:this.player._opt.sm4CryptoKey,m7sCryptoAudio:this.player._opt.m7sCryptoAudio,isFlv:this.player._opt.isFlv,isFmp4:this.player._opt.isFmp4,isMpeg4:this.player._opt.isMpeg4,isTs:this.player._opt.isTs,isNakedFlow:this.player._opt.isNakedFlow,isHls265:this.player.isUseHls265(),isFmp4Private:this.player._opt.isFmp4Private,isEmitSEI:this.player._opt.isEmitSEI,isRecordTypeFlv:this.player.isRecordTypeFlv(),isWasmMp4:this.player.recorder&&this.player.recorder.isWasmMp4()||!1,isChrome:Qo(),isFirefox:yo(),supportMSEDecodeHevc:Co(),isDropSameTimestampGop:this.player._opt.isDropSameTimestampGop,mseDecodeAudio:this.player._opt.mseDecodeAudio,wcsDecodeAudio:this.player._opt.wcsDecodeAudio,nakedFlowH265DemuxUseNew:this.player._opt.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:this.player._opt.mseDecoderUseWorker,mseAutoCleanupMinBackwardDuration:this.player._opt.mseAutoCleanupMinBackwardDuration,mseAutoCleanupMaxBackwardDuration:this.player._opt.mseAutoCleanupMaxBackwardDuration,mseCorrectTimeDuration:this.player._opt.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:this.player._opt.mseCorrectAudioTimeDuration,nakedFlowDemuxUseNew:this.player._opt.nakedFlowDemuxUseNew,nakedFlowFps:this.player._opt.nakedFlowFps};this.decoderWorker.postMessage({cmd:We,opt:JSON.stringify(e)}),this.player._opt.cryptoKey&&this.player._opt.cryptoKey.byteLength>0&&this.player._opt.cryptoIV&&this.player._opt.cryptoIV.byteLength>0&&(this.updateWorkConfig({key:"cryptoKey",value:this.player._opt.cryptoKey}),this.updateWorkConfig({key:"cryptoIV",value:this.player._opt.cryptoIV}))}decodeVideo(e,t,i){this.player._opt.playType===v?this.player.isUseHls265()?this._decodeVideoNoDelay(e,t,i):this._decodeVideo(e,t,i):this.player._opt.playType===w&&(this.player.isPlaybackOnlyDecodeIFrame()?i&&(this.player.debugLog("decoderWorker",`current rate is ${this.player.video.rate},only decode i frame`),this._decodeVideoNoDelay(e,t,i)):1===this.player.video.rate?this._decodeVideo(e,t,i):this._decodeVideoNoDelay(e,t,i))}_decodeVideo(e,t,i){const s={type:Oe,ts:Math.max(t,0),isIFrame:i};this.decoderWorker.postMessage({cmd:ze,buffer:e,options:s},[e.buffer])}_decodeVideoNoDelay(e,t,i){this.decoderWorker.postMessage({cmd:Ve,buffer:e,ts:Math.max(t,0),isIFrame:i},[e.buffer])}decodeAudio(e,t){this.player._opt.playType===v?this.player._opt.useWCS||this.player._opt.useMSE||this.player.isUseHls265()?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t):this.player._opt.playType===w&&(this.player.isPlaybackOnlyDecodeIFrame()||(1===this.player.video.rate?this._decodeAudio(e,t):this._decodeAudioNoDelay(e,t)))}_decodeAudio(e,t){const i={type:Ue,ts:Math.max(t,0)};this.decoderWorker.postMessage({cmd:ze,buffer:e,options:i},[e.buffer])}_decodeAudioNoDelay(e,t){this.decoderWorker.postMessage({cmd:$e,buffer:e,ts:Math.max(t,0)},[e.buffer])}updateWorkConfig(e){this.decoderWorker&&this.decoderWorker.postMessage({cmd:Je,key:e.key,value:e.value})}workerFetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{_opt:i}=this.player;let s=[];t.protocols&&(s=t.protocols,delete t.protocols);const r={protocol:i.protocol,isFlv:i.isFlv,isFmp4:i.isFmp4,isMpeg4:i.isMpeg4,isNakedFlow:i.isNakedFlow,isTs:i.isTs,options:t};this.decoderWorker.postMessage({cmd:Ke,url:e,protocols:s,opt:JSON.stringify(r)})}clearWorkBuffer(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.decoderWorker.postMessage({cmd:qe,needClear:e})}workerSendMessage(e){this.decoderWorker.postMessage({cmd:Ye,message:e})}updateVideoTimestamp(e){this.decoderWorker.postMessage({cmd:Qe,message:e})}updatePlaybackIsPause(e){this.decoderWorker.postMessage({cmd:Xe,isPause:e})}}var _l,wl="application/json, text/javascript",Sl="text/html",El=/^(?:text|application)\/xml/i,Tl=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,kl=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Ll=/^\s*$/,Cl={},xl={},Dl="",Rl={type:"GET",beforeSend:Pl,success:Pl,error:Pl,complete:Pl,context:null,xhr:function(){return new window.XMLHttpRequest},accepts:{json:wl,xml:"application/xml, text/xml",html:Sl,text:"text/plain","*":"*/".concat("*")},crossDomain:!1,timeout:0,username:null,password:null,processData:!0,promise:Pl,contentType:"application/x-www-form-urlencoded; charset=UTF-8"};function Pl(){}var Il=function(e,t){"object"==typeof e&&(t=e,e=void 0);var i=Gl({},t=t||{});for(var s in Rl)void 0===i[s]&&(i[s]=Rl[s]);try{var r={},o=new Promise((function(e,t){r.resolve=e,r.reject=t}));o.resolve=r.resolve,o.reject=r.reject,i.promise=o}catch(e){i.promise={resolve:Pl,reject:Pl}}var a=kl.exec(window.location.href.toLowerCase())||[];i.url=((e||i.url||window.location.href)+"").replace(/#.*$/,"").replace(/^\/\//,a[1]+"//");var n=i.url;i.crossDomain||(i.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(i.url)&&RegExp.$2!==window.location.href);var l=i.dataType;if("jsonp"===l){if(!/=\?/.test(i.url)){var d=(i.jsonp||"callback")+"=?";i.url=Ol(i.url,d)}return function(e){var t,i=e.jsonpCallback||"jsonp"+$l(),s=window.document.createElement("script"),r={abort:function(){i in window&&(window[i]=Pl)}},o=window.document.getElementsByTagName("head")[0]||window.document.documentElement;function a(i){window.clearTimeout(t),r.abort(),Fl(i.type,r,i.type,e),n()}s.onerror=function(e){a(e)},window[i]=function(i){window.clearTimeout(t),Bl(i,r,e),n()},Nl(e),s.src=e.url.replace(/=\?/,"="+i),s.src=Ol(s.src,"_="+(new Date).getTime()),s.async=!0,e.scriptCharset&&(s.charset=e.scriptCharset);o.insertBefore(s,o.firstChild),e.timeout>0&&(t=window.setTimeout((function(){r.abort(),Fl("timeout",r,"timeout",e),n()}),e.timeout));function n(){s.clearAttributes?s.clearAttributes():s.onload=s.onreadystatechange=s.onerror=null,s.parentNode&&s.parentNode.removeChild(s),s=null,delete window[i]}return e.promise.abort=function(){r.abort()},e.promise.xhr=r,e.promise}(i)}Nl(i);var h=i.accepts[l]||i.accepts["*"],c={};/^([\w-]+:)\/\//.test(i.url)?RegExp.$1:window.location.protocol;var u,p=Rl.xhr();i.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest"),i.ifModified&&(Cl[n]&&(c["If-Modified-Since"]=Cl[n]),xl[n]&&(c["If-None-Match"]=xl[n])),h&&(c.Accept=h,h.indexOf(",")>-1&&(h=h.split(",",2)[0]),p.overrideMimeType&&p.overrideMimeType(h));var f=!/^(?:GET|HEAD)$/.test(i.type.toUpperCase());if((i.data&&f&&!1!==i.contentType||t.contentType)&&(c["Content-Type"]=i.contentType),!1===i.cache&&!f){var m=/([?&])_=[^&]*/;i.url=m.test(n)?n.replace(m,"$1_="+$l()):n+(/\?/.test(n)?"&":"?")+"_="+$l()}i.headers=Gl(c,i.headers||{}),p.onreadystatechange=function(){if(4===p.readyState){var e;clearTimeout(u);var t=!1;if(p.status>=200&&p.status<300||304===p.status){if(Dl=p.getAllResponseHeaders(),i.ifModified){var s=Ul("Last-Modified");s&&(Cl[n]=s),(s=Ul("etag"))&&(xl[n]=s)}l=l||function(e){return e&&(e===Sl?"html":e===wl?"json":El.test(e)&&"xml")||"text"}(p.getResponseHeader("content-type")),e=p.responseText;try{"xml"===l?e=p.responseXML:"json"===l&&(e=Ll.test(e)?null:JSON.parse(e))}catch(e){t=e}t?Fl(t,"parseerror",p,i):Bl(e,p,i)}else Fl(null,"error",p,i)}};var g=!("async"in i)||i.async;if(p.open(i.type,i.url,g,i.username,i.password),i.xhrFields)for(var y in i.xhrFields)p[y]=i.xhrFields[y];for(var y in i.mimeType&&p.overrideMimeType&&p.overrideMimeType(i.mimeType),i.headers)void 0!==i.headers[y]&&p.setRequestHeader(y,i.headers[y]+"");return!1===function(e,t){var i=t.context;if(!1===t.beforeSend.call(i,e,t))return!1}(p,i)?(p.abort(),!1):(i.timeout>0&&(u=window.setTimeout((function(){p.onreadystatechange=Pl,p.abort(),Fl(null,"timeout",p,i)}),i.timeout)),p.send(i.data?i.data:null),i.promise.abort=function(){p.abort()},i.promise)};function Bl(e,t,i){var s=i.context,r="success";i.success.call(s,e,r,t),i.promise.resolve(e,r,t),Ml(r,t,i)}function Ml(e,t,i){var s=i.context;i.complete.call(s,t,e)}function Fl(e,t,i,s){var r=s.context;s.error.call(r,i,t,e),s.promise.reject(i,t,e),Ml(t,i,s)}function Ul(e){var t;if(!_l){for(_l={};t=Tl.exec(Dl);)_l[t[1].toLowerCase()]=t[2];t=_l[e.toLowerCase()]}return null===t?null:t}function Ol(e,t){return(e+"&"+t).replace(/[&?]{1,2}/,"?")}function Nl(e){!Wl(e)||e.data instanceof FormData||!e.processData||(e.data=function(e,t){var i=[];return i.add=function(e,t){this.push(encodeURIComponent(e)+"="+encodeURIComponent(t))},jl(i,e,t),i.join("&").replace("%20","+")}(e.data)),!e.data||e.type&&"GET"!==e.type.toUpperCase()||(e.url=Ol(e.url,e.data))}function jl(e,t,i,s){var r=function(e){return"[object Array]"===Object.prototype.toString.call(e)}(t);for(var o in t){var a=t[o];s&&(o=i?s:s+"["+(r?"":o)+"]"),!s&&r?e.add(a.name,a.value):(i?r(a):Wl(a))?jl(e,a,i,o):e.add(o,a)}}function Gl(e){for(var t=Array.prototype.slice,i=t.call(arguments,1),s=0,r=i.length;s255)return!1;return!0}function Jl(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!Hl(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(Vl(e.length)&&Hl(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function ql(e){return new Uint8Array(e)}function Kl(e,t,i,s,r){null==s&&null==r||(e=e.slice?e.slice(s,r):Array.prototype.slice.call(e,s,r)),t.set(e,i)}Il.get=function(e,t,i,s){return zl(t)&&(s=s||i,i=t,t=void 0),Il({url:e,data:t,success:i,dataType:s})},Il.post=function(e,t,i,s){return zl(t)&&(s=s||i,i=t,t=void 0),Il({type:"POST",url:e,data:t,success:i,dataType:s})},Il.getJSON=function(e,t,i){return zl(t)&&(i=t,t=void 0),Il({url:e,data:t,success:i,dataType:"json"})},Il.ajaxSetup=function(e,t){return t?Gl(Gl(e,Rl),t):Gl(Rl,e)};var Yl={toBytes:function(e){var t=[],i=0;for(e=encodeURI(e);i191&&s<224?(t.push(String.fromCharCode((31&s)<<6|63&e[i+1])),i+=2):(t.push(String.fromCharCode((15&s)<<12|(63&e[i+1])<<6|63&e[i+2])),i+=3)}return t.join("")}},Ql=function(){var e="0123456789abcdef";return{toBytes:function(e){for(var t=[],i=0;i>4]+e[15&r])}return i.join("")}}}(),Xl={16:10,24:12,32:14},Zl=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],ed=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],td=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],id=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],sd=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],rd=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],od=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],ad=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],nd=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],ld=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],dd=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],hd=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],cd=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],ud=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],pd=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function fd(e){for(var t=[],i=0;i>2,this._Ke[i][t%4]=o[t],this._Kd[e-i][t%4]=o[t];for(var a,n=0,l=r;l>16&255]<<24^ed[a>>8&255]<<16^ed[255&a]<<8^ed[a>>24&255]^Zl[n]<<24,n+=1,8!=r)for(t=1;t>8&255]<<8^ed[a>>16&255]<<16^ed[a>>24&255]<<24;for(t=r/2+1;t>2,h=l%4,this._Ke[d][h]=o[t],this._Kd[e-d][h]=o[t++],l++}for(var d=1;d>24&255]^cd[a>>16&255]^ud[a>>8&255]^pd[255&a]},md.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,i=[0,0,0,0],s=fd(e),r=0;r<4;r++)s[r]^=this._Ke[0][r];for(var o=1;o>24&255]^sd[s[(r+1)%4]>>16&255]^rd[s[(r+2)%4]>>8&255]^od[255&s[(r+3)%4]]^this._Ke[o][r];s=i.slice()}var a,n=ql(16);for(r=0;r<4;r++)a=this._Ke[t][r],n[4*r]=255&(ed[s[r]>>24&255]^a>>24),n[4*r+1]=255&(ed[s[(r+1)%4]>>16&255]^a>>16),n[4*r+2]=255&(ed[s[(r+2)%4]>>8&255]^a>>8),n[4*r+3]=255&(ed[255&s[(r+3)%4]]^a);return n},md.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,i=[0,0,0,0],s=fd(e),r=0;r<4;r++)s[r]^=this._Kd[0][r];for(var o=1;o>24&255]^nd[s[(r+3)%4]>>16&255]^ld[s[(r+2)%4]>>8&255]^dd[255&s[(r+1)%4]]^this._Kd[o][r];s=i.slice()}var a,n=ql(16);for(r=0;r<4;r++)a=this._Kd[t][r],n[4*r]=255&(td[s[r]>>24&255]^a>>24),n[4*r+1]=255&(td[s[(r+3)%4]>>16&255]^a>>16),n[4*r+2]=255&(td[s[(r+2)%4]>>8&255]^a>>8),n[4*r+3]=255&(td[255&s[(r+1)%4]]^a);return n};var gd=function(e){if(!(this instanceof gd))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new md(e)};gd.prototype.encrypt=function(e){if((e=Jl(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=ql(e.length),i=ql(16),s=0;sNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},vd.prototype.setBytes=function(e){if(16!=(e=Jl(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},vd.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var _d=function(e,t){if(!(this instanceof _d))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof vd||(t=new vd(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new md(e)};_d.prototype.encrypt=function(e){for(var t=Jl(e,!0),i=0;i16)throw new Error("PKCS#7 padding byte out of range");for(var i=e.length-t,s=0;s>>2]>>>24-o%4*8&255;t[s+o>>>2]|=a<<24-(s+o)%4*8}else for(var n=0;n>>2]=i[n>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,i=this.sigBytes;t[i>>>2]&=4294967295<<32-i%4*8,t.length=e.ceil(i/4)},clone:function(){var e=l.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],i=0;i>>2]>>>24-r%4*8&255;s.push((o>>>4).toString(16)),s.push((15&o).toString(16))}return s.join("")},parse:function(e){for(var t=e.length,i=[],s=0;s>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new d.init(i,t/2)}},u=h.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],r=0;r>>2]>>>24-r%4*8&255;s.push(String.fromCharCode(o))}return s.join("")},parse:function(e){for(var t=e.length,i=[],s=0;s>>2]|=(255&e.charCodeAt(s))<<24-s%4*8;return new d.init(i,t)}},p=h.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},f=n.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var i,s=this._data,r=s.words,o=s.sigBytes,a=this.blockSize,n=o/(4*a),l=(n=t?e.ceil(n):e.max((0|n)-this._minBufferSize,0))*a,h=e.min(4*l,o);if(l){for(var c=0;c>>2]|=e[r]<<24-r%4*8;t.call(this,s,i)}else t.apply(this,arguments)};s.prototype=e}}(),i.lib.WordArray)})),Pr((function(e,t){var i;e.exports=(i=Sd,function(){var e=i,t=e.lib.WordArray,s=e.enc;function r(e){return e<<8&4278255360|e>>>8&16711935}s.Utf16=s.Utf16BE={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],r=0;r>>2]>>>16-r%4*8&65535;s.push(String.fromCharCode(o))}return s.join("")},parse:function(e){for(var i=e.length,s=[],r=0;r>>1]|=e.charCodeAt(r)<<16-r%2*16;return t.create(s,2*i)}},s.Utf16LE={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],o=0;o>>2]>>>16-o%4*8&65535);s.push(String.fromCharCode(a))}return s.join("")},parse:function(e){for(var i=e.length,s=[],o=0;o>>1]|=r(e.charCodeAt(o)<<16-o%2*16);return t.create(s,2*i)}}}(),i.enc.Utf16)})),Pr((function(e,t){var i;e.exports=(i=Sd,function(){var e=i,t=e.lib.WordArray;function s(e,i,s){for(var r=[],o=0,a=0;a>>6-a%4*2;r[o>>>2]|=n<<24-o%4*8,o++}return t.create(r,o)}e.enc.Base64={stringify:function(e){var t=e.words,i=e.sigBytes,s=this._map;e.clamp();for(var r=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,n=0;n<4&&o+.75*n>>6*(3-n)&63));var l=s.charAt(64);if(l)for(;r.length%4;)r.push(l);return r.join("")},parse:function(e){var t=e.length,i=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o>>6-a%4*2;r[o>>>2]|=n<<24-o%4*8,o++}return t.create(r,o)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var i=e.words,s=e.sigBytes,r=t?this._safe_map:this._map;e.clamp();for(var o=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(i[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|i[a+2>>>2]>>>24-(a+2)%4*8&255,l=0;l<4&&a+.75*l>>6*(3-l)&63));var d=r.charAt(64);if(d)for(;o.length%4;)o.push(d);return o.join("")},parse:function(e,t){void 0===t&&(t=!0);var i=e.length,r=t?this._safe_map:this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var a=0;a>>24)|4278255360&(r<<24|r>>>8)}var o=this._hash.words,a=e[t+0],l=e[t+1],p=e[t+2],f=e[t+3],m=e[t+4],g=e[t+5],y=e[t+6],A=e[t+7],b=e[t+8],v=e[t+9],_=e[t+10],w=e[t+11],S=e[t+12],E=e[t+13],T=e[t+14],k=e[t+15],L=o[0],C=o[1],x=o[2],D=o[3];L=d(L,C,x,D,a,7,n[0]),D=d(D,L,C,x,l,12,n[1]),x=d(x,D,L,C,p,17,n[2]),C=d(C,x,D,L,f,22,n[3]),L=d(L,C,x,D,m,7,n[4]),D=d(D,L,C,x,g,12,n[5]),x=d(x,D,L,C,y,17,n[6]),C=d(C,x,D,L,A,22,n[7]),L=d(L,C,x,D,b,7,n[8]),D=d(D,L,C,x,v,12,n[9]),x=d(x,D,L,C,_,17,n[10]),C=d(C,x,D,L,w,22,n[11]),L=d(L,C,x,D,S,7,n[12]),D=d(D,L,C,x,E,12,n[13]),x=d(x,D,L,C,T,17,n[14]),L=h(L,C=d(C,x,D,L,k,22,n[15]),x,D,l,5,n[16]),D=h(D,L,C,x,y,9,n[17]),x=h(x,D,L,C,w,14,n[18]),C=h(C,x,D,L,a,20,n[19]),L=h(L,C,x,D,g,5,n[20]),D=h(D,L,C,x,_,9,n[21]),x=h(x,D,L,C,k,14,n[22]),C=h(C,x,D,L,m,20,n[23]),L=h(L,C,x,D,v,5,n[24]),D=h(D,L,C,x,T,9,n[25]),x=h(x,D,L,C,f,14,n[26]),C=h(C,x,D,L,b,20,n[27]),L=h(L,C,x,D,E,5,n[28]),D=h(D,L,C,x,p,9,n[29]),x=h(x,D,L,C,A,14,n[30]),L=c(L,C=h(C,x,D,L,S,20,n[31]),x,D,g,4,n[32]),D=c(D,L,C,x,b,11,n[33]),x=c(x,D,L,C,w,16,n[34]),C=c(C,x,D,L,T,23,n[35]),L=c(L,C,x,D,l,4,n[36]),D=c(D,L,C,x,m,11,n[37]),x=c(x,D,L,C,A,16,n[38]),C=c(C,x,D,L,_,23,n[39]),L=c(L,C,x,D,E,4,n[40]),D=c(D,L,C,x,a,11,n[41]),x=c(x,D,L,C,f,16,n[42]),C=c(C,x,D,L,y,23,n[43]),L=c(L,C,x,D,v,4,n[44]),D=c(D,L,C,x,S,11,n[45]),x=c(x,D,L,C,k,16,n[46]),L=u(L,C=c(C,x,D,L,p,23,n[47]),x,D,a,6,n[48]),D=u(D,L,C,x,A,10,n[49]),x=u(x,D,L,C,T,15,n[50]),C=u(C,x,D,L,g,21,n[51]),L=u(L,C,x,D,S,6,n[52]),D=u(D,L,C,x,f,10,n[53]),x=u(x,D,L,C,_,15,n[54]),C=u(C,x,D,L,l,21,n[55]),L=u(L,C,x,D,b,6,n[56]),D=u(D,L,C,x,k,10,n[57]),x=u(x,D,L,C,y,15,n[58]),C=u(C,x,D,L,E,21,n[59]),L=u(L,C,x,D,m,6,n[60]),D=u(D,L,C,x,w,10,n[61]),x=u(x,D,L,C,p,15,n[62]),C=u(C,x,D,L,v,21,n[63]),o[0]=o[0]+L|0,o[1]=o[1]+C|0,o[2]=o[2]+x|0,o[3]=o[3]+D|0},_doFinalize:function(){var t=this._data,i=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;i[r>>>5]|=128<<24-r%32;var o=e.floor(s/4294967296),a=s;i[15+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),i[14+(r+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(i.length+1),this._process();for(var n=this._hash,l=n.words,d=0;d<4;d++){var h=l[d];l[d]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}return n},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function d(e,t,i,s,r,o,a){var n=e+(t&i|~t&s)+r+a;return(n<>>32-o)+t}function h(e,t,i,s,r,o,a){var n=e+(t&s|i&~s)+r+a;return(n<>>32-o)+t}function c(e,t,i,s,r,o,a){var n=e+(t^i^s)+r+a;return(n<>>32-o)+t}function u(e,t,i,s,r,o,a){var n=e+(i^(t|~s))+r+a;return(n<>>32-o)+t}t.MD5=o._createHelper(l),t.HmacMD5=o._createHmacHelper(l)}(Math),i.MD5)})),Pr((function(e,t){var i,s,r,o,a,n,l,d;e.exports=(s=(i=d=Sd).lib,r=s.WordArray,o=s.Hasher,a=i.algo,n=[],l=a.SHA1=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],r=i[1],o=i[2],a=i[3],l=i[4],d=0;d<80;d++){if(d<16)n[d]=0|e[t+d];else{var h=n[d-3]^n[d-8]^n[d-14]^n[d-16];n[d]=h<<1|h>>>31}var c=(s<<5|s>>>27)+l+n[d];c+=d<20?1518500249+(r&o|~r&a):d<40?1859775393+(r^o^a):d<60?(r&o|r&a|o&a)-1894007588:(r^o^a)-899497514,l=a,a=o,o=r<<30|r>>>2,r=s,s=c}i[0]=i[0]+s|0,i[1]=i[1]+r|0,i[2]=i[2]+o|0,i[3]=i[3]+a|0,i[4]=i[4]+l|0},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;return t[s>>>5]|=128<<24-s%32,t[14+(s+64>>>9<<4)]=Math.floor(i/4294967296),t[15+(s+64>>>9<<4)]=i,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),i.SHA1=o._createHelper(l),i.HmacSHA1=o._createHmacHelper(l),d.SHA1)})),Pr((function(e,t){var i;e.exports=(i=Sd,function(e){var t=i,s=t.lib,r=s.WordArray,o=s.Hasher,a=t.algo,n=[],l=[];!function(){function t(t){for(var i=e.sqrt(t),s=2;s<=i;s++)if(!(t%s))return!1;return!0}function i(e){return 4294967296*(e-(0|e))|0}for(var s=2,r=0;r<64;)t(s)&&(r<8&&(n[r]=i(e.pow(s,.5))),l[r]=i(e.pow(s,1/3)),r++),s++}();var d=[],h=a.SHA256=o.extend({_doReset:function(){this._hash=new r.init(n.slice(0))},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],r=i[1],o=i[2],a=i[3],n=i[4],h=i[5],c=i[6],u=i[7],p=0;p<64;p++){if(p<16)d[p]=0|e[t+p];else{var f=d[p-15],m=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,g=d[p-2],y=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;d[p]=m+d[p-7]+y+d[p-16]}var A=s&r^s&o^r&o,b=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),v=u+((n<<26|n>>>6)^(n<<21|n>>>11)^(n<<7|n>>>25))+(n&h^~n&c)+l[p]+d[p];u=c,c=h,h=n,n=a+v|0,a=o,o=r,r=s,s=v+(b+A)|0}i[0]=i[0]+s|0,i[1]=i[1]+r|0,i[2]=i[2]+o|0,i[3]=i[3]+a|0,i[4]=i[4]+n|0,i[5]=i[5]+h|0,i[6]=i[6]+c|0,i[7]=i[7]+u|0},_doFinalize:function(){var t=this._data,i=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;return i[r>>>5]|=128<<24-r%32,i[14+(r+64>>>9<<4)]=e.floor(s/4294967296),i[15+(r+64>>>9<<4)]=s,t.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(h),t.HmacSHA256=o._createHmacHelper(h)}(Math),i.SHA256)})),Pr((function(e,t){var i,s,r,o,a,n;e.exports=(s=(i=n=Sd).lib.WordArray,r=i.algo,o=r.SHA256,a=r.SHA224=o.extend({_doReset:function(){this._hash=new s.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=4,e}}),i.SHA224=o._createHelper(a),i.HmacSHA224=o._createHmacHelper(a),n.SHA224)})),Pr((function(e,t){var i;e.exports=(i=Sd,function(){var e=i,t=e.lib.Hasher,s=e.x64,r=s.Word,o=s.WordArray,a=e.algo;function n(){return r.create.apply(r,arguments)}var l=[n(1116352408,3609767458),n(1899447441,602891725),n(3049323471,3964484399),n(3921009573,2173295548),n(961987163,4081628472),n(1508970993,3053834265),n(2453635748,2937671579),n(2870763221,3664609560),n(3624381080,2734883394),n(310598401,1164996542),n(607225278,1323610764),n(1426881987,3590304994),n(1925078388,4068182383),n(2162078206,991336113),n(2614888103,633803317),n(3248222580,3479774868),n(3835390401,2666613458),n(4022224774,944711139),n(264347078,2341262773),n(604807628,2007800933),n(770255983,1495990901),n(1249150122,1856431235),n(1555081692,3175218132),n(1996064986,2198950837),n(2554220882,3999719339),n(2821834349,766784016),n(2952996808,2566594879),n(3210313671,3203337956),n(3336571891,1034457026),n(3584528711,2466948901),n(113926993,3758326383),n(338241895,168717936),n(666307205,1188179964),n(773529912,1546045734),n(1294757372,1522805485),n(1396182291,2643833823),n(1695183700,2343527390),n(1986661051,1014477480),n(2177026350,1206759142),n(2456956037,344077627),n(2730485921,1290863460),n(2820302411,3158454273),n(3259730800,3505952657),n(3345764771,106217008),n(3516065817,3606008344),n(3600352804,1432725776),n(4094571909,1467031594),n(275423344,851169720),n(430227734,3100823752),n(506948616,1363258195),n(659060556,3750685593),n(883997877,3785050280),n(958139571,3318307427),n(1322822218,3812723403),n(1537002063,2003034995),n(1747873779,3602036899),n(1955562222,1575990012),n(2024104815,1125592928),n(2227730452,2716904306),n(2361852424,442776044),n(2428436474,593698344),n(2756734187,3733110249),n(3204031479,2999351573),n(3329325298,3815920427),n(3391569614,3928383900),n(3515267271,566280711),n(3940187606,3454069534),n(4118630271,4000239992),n(116418474,1914138554),n(174292421,2731055270),n(289380356,3203993006),n(460393269,320620315),n(685471733,587496836),n(852142971,1086792851),n(1017036298,365543100),n(1126000580,2618297676),n(1288033470,3409855158),n(1501505948,4234509866),n(1607167915,987167468),n(1816402316,1246189591)],d=[];!function(){for(var e=0;e<80;e++)d[e]=n()}();var h=a.SHA512=t.extend({_doReset:function(){this._hash=new o.init([new r.init(1779033703,4089235720),new r.init(3144134277,2227873595),new r.init(1013904242,4271175723),new r.init(2773480762,1595750129),new r.init(1359893119,2917565137),new r.init(2600822924,725511199),new r.init(528734635,4215389547),new r.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],r=i[1],o=i[2],a=i[3],n=i[4],h=i[5],c=i[6],u=i[7],p=s.high,f=s.low,m=r.high,g=r.low,y=o.high,A=o.low,b=a.high,v=a.low,_=n.high,w=n.low,S=h.high,E=h.low,T=c.high,k=c.low,L=u.high,C=u.low,x=p,D=f,R=m,P=g,I=y,B=A,M=b,F=v,U=_,O=w,N=S,j=E,G=T,W=k,z=L,$=C,V=0;V<80;V++){var H,J,q=d[V];if(V<16)J=q.high=0|e[t+2*V],H=q.low=0|e[t+2*V+1];else{var K=d[V-15],Y=K.high,Q=K.low,X=(Y>>>1|Q<<31)^(Y>>>8|Q<<24)^Y>>>7,Z=(Q>>>1|Y<<31)^(Q>>>8|Y<<24)^(Q>>>7|Y<<25),ee=d[V-2],te=ee.high,ie=ee.low,se=(te>>>19|ie<<13)^(te<<3|ie>>>29)^te>>>6,re=(ie>>>19|te<<13)^(ie<<3|te>>>29)^(ie>>>6|te<<26),oe=d[V-7],ae=oe.high,ne=oe.low,le=d[V-16],de=le.high,he=le.low;J=(J=(J=X+ae+((H=Z+ne)>>>0>>0?1:0))+se+((H+=re)>>>0>>0?1:0))+de+((H+=he)>>>0>>0?1:0),q.high=J,q.low=H}var ce,ue=U&N^~U&G,pe=O&j^~O&W,fe=x&R^x&I^R&I,me=D&P^D&B^P&B,ge=(x>>>28|D<<4)^(x<<30|D>>>2)^(x<<25|D>>>7),ye=(D>>>28|x<<4)^(D<<30|x>>>2)^(D<<25|x>>>7),Ae=(U>>>14|O<<18)^(U>>>18|O<<14)^(U<<23|O>>>9),be=(O>>>14|U<<18)^(O>>>18|U<<14)^(O<<23|U>>>9),ve=l[V],_e=ve.high,we=ve.low,Se=z+Ae+((ce=$+be)>>>0<$>>>0?1:0),Ee=ye+me;z=G,$=W,G=N,W=j,N=U,j=O,U=M+(Se=(Se=(Se=Se+ue+((ce+=pe)>>>0>>0?1:0))+_e+((ce+=we)>>>0>>0?1:0))+J+((ce+=H)>>>0>>0?1:0))+((O=F+ce|0)>>>0>>0?1:0)|0,M=I,F=B,I=R,B=P,R=x,P=D,x=Se+(ge+fe+(Ee>>>0>>0?1:0))+((D=ce+Ee|0)>>>0>>0?1:0)|0}f=s.low=f+D,s.high=p+x+(f>>>0>>0?1:0),g=r.low=g+P,r.high=m+R+(g>>>0

>>0?1:0),A=o.low=A+B,o.high=y+I+(A>>>0>>0?1:0),v=a.low=v+F,a.high=b+M+(v>>>0>>0?1:0),w=n.low=w+O,n.high=_+U+(w>>>0>>0?1:0),E=h.low=E+j,h.high=S+N+(E>>>0>>0?1:0),k=c.low=k+W,c.high=T+G+(k>>>0>>0?1:0),C=u.low=C+$,u.high=L+z+(C>>>0<$>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;return t[s>>>5]|=128<<24-s%32,t[30+(s+128>>>10<<5)]=Math.floor(i/4294967296),t[31+(s+128>>>10<<5)]=i,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(h),e.HmacSHA512=t._createHmacHelper(h)}(),i.SHA512)})),Pr((function(e,t){var i,s,r,o,a,n,l,d;e.exports=(s=(i=d=Sd).x64,r=s.Word,o=s.WordArray,a=i.algo,n=a.SHA512,l=a.SHA384=n.extend({_doReset:function(){this._hash=new o.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=16,e}}),i.SHA384=n._createHelper(l),i.HmacSHA384=n._createHmacHelper(l),d.SHA384)})),Pr((function(e,t){var i;e.exports=(i=Sd,function(e){var t=i,s=t.lib,r=s.WordArray,o=s.Hasher,a=t.x64.Word,n=t.algo,l=[],d=[],h=[];!function(){for(var e=1,t=0,i=0;i<24;i++){l[e+5*t]=(i+1)*(i+2)/2%64;var s=(2*e+3*t)%5;e=t%5,t=s}for(e=0;e<5;e++)for(t=0;t<5;t++)d[e+5*t]=t+(2*e+3*t)%5*5;for(var r=1,o=0;o<24;o++){for(var n=0,c=0,u=0;u<7;u++){if(1&r){var p=(1<>>24)|4278255360&(o<<24|o>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(C=i[r]).high^=a,C.low^=o}for(var n=0;n<24;n++){for(var u=0;u<5;u++){for(var p=0,f=0,m=0;m<5;m++)p^=(C=i[u+5*m]).high,f^=C.low;var g=c[u];g.high=p,g.low=f}for(u=0;u<5;u++){var y=c[(u+4)%5],A=c[(u+1)%5],b=A.high,v=A.low;for(p=y.high^(b<<1|v>>>31),f=y.low^(v<<1|b>>>31),m=0;m<5;m++)(C=i[u+5*m]).high^=p,C.low^=f}for(var _=1;_<25;_++){var w=(C=i[_]).high,S=C.low,E=l[_];E<32?(p=w<>>32-E,f=S<>>32-E):(p=S<>>64-E,f=w<>>64-E);var T=c[d[_]];T.high=p,T.low=f}var k=c[0],L=i[0];for(k.high=L.high,k.low=L.low,u=0;u<5;u++)for(m=0;m<5;m++){var C=i[_=u+5*m],x=c[_],D=c[(u+1)%5+5*m],R=c[(u+2)%5+5*m];C.high=x.high^~D.high&R.high,C.low=x.low^~D.low&R.low}C=i[0];var P=h[n];C.high^=P.high,C.low^=P.low}},_doFinalize:function(){var t=this._data,i=t.words;this._nDataBytes;var s=8*t.sigBytes,o=32*this.blockSize;i[s>>>5]|=1<<24-s%32,i[(e.ceil((s+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*i.length,this._process();for(var a=this._state,n=this.cfg.outputLength/8,l=n/8,d=[],h=0;h>>24)|4278255360&(u<<24|u>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),d.push(p),d.push(u)}return new r.init(d,n)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),i=0;i<25;i++)t[i]=t[i].clone();return e}});t.SHA3=o._createHelper(u),t.HmacSHA3=o._createHmacHelper(u)}(Math),i.SHA3)})),Pr((function(e,t){var i;e.exports=(i=Sd,function(e){var t=i,s=t.lib,r=s.WordArray,o=s.Hasher,a=t.algo,n=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),l=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),d=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),h=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),c=r.create([0,1518500249,1859775393,2400959708,2840853838]),u=r.create([1352829926,1548603684,1836072691,2053994217,0]),p=a.RIPEMD160=o.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=0;i<16;i++){var s=t+i,r=e[s];e[s]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var o,a,p,v,_,w,S,E,T,k,L,C=this._hash.words,x=c.words,D=u.words,R=n.words,P=l.words,I=d.words,B=h.words;for(w=o=C[0],S=a=C[1],E=p=C[2],T=v=C[3],k=_=C[4],i=0;i<80;i+=1)L=o+e[t+R[i]]|0,L+=i<16?f(a,p,v)+x[0]:i<32?m(a,p,v)+x[1]:i<48?g(a,p,v)+x[2]:i<64?y(a,p,v)+x[3]:A(a,p,v)+x[4],L=(L=b(L|=0,I[i]))+_|0,o=_,_=v,v=b(p,10),p=a,a=L,L=w+e[t+P[i]]|0,L+=i<16?A(S,E,T)+D[0]:i<32?y(S,E,T)+D[1]:i<48?g(S,E,T)+D[2]:i<64?m(S,E,T)+D[3]:f(S,E,T)+D[4],L=(L=b(L|=0,B[i]))+k|0,w=k,k=T,T=b(E,10),E=S,S=L;L=C[1]+p+T|0,C[1]=C[2]+v+k|0,C[2]=C[3]+_+w|0,C[3]=C[4]+o+S|0,C[4]=C[0]+a+E|0,C[0]=L},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;t[s>>>5]|=128<<24-s%32,t[14+(s+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),e.sigBytes=4*(t.length+1),this._process();for(var r=this._hash,o=r.words,a=0;a<5;a++){var n=o[a];o[a]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}return r},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function f(e,t,i){return e^t^i}function m(e,t,i){return e&t|~e&i}function g(e,t,i){return(e|~t)^i}function y(e,t,i){return e&i|t&~i}function A(e,t,i){return e^(t|~i)}function b(e,t){return e<>>32-t}t.RIPEMD160=o._createHelper(p),t.HmacRIPEMD160=o._createHmacHelper(p)}(),i.RIPEMD160)})),Pr((function(e,t){var i,s,r;e.exports=(s=(i=Sd).lib.Base,r=i.enc.Utf8,void(i.algo.HMAC=s.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var i=e.blockSize,s=4*i;t.sigBytes>s&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),a=this._iKey=t.clone(),n=o.words,l=a.words,d=0;d>>2];e.sigBytes-=t}};s.BlockCipher=h.extend({cfg:h.cfg.extend({mode:p,padding:f}),reset:function(){var e;h.reset.call(this);var t=this.cfg,i=t.iv,s=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=s.createEncryptor:(e=s.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,i&&i.words):(this._mode=e.call(s,this,i&&i.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=s.CipherParams=r.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),g=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,i=e.salt;return(i?o.create([1398893684,1701076831]).concat(i).concat(t):t).toString(l)},parse:function(e){var t,i=l.parse(e),s=i.words;return 1398893684==s[0]&&1701076831==s[1]&&(t=o.create(s.slice(2,4)),s.splice(0,4),i.sigBytes-=16),m.create({ciphertext:i,salt:t})}},y=s.SerializableCipher=r.extend({cfg:r.extend({format:g}),encrypt:function(e,t,i,s){s=this.cfg.extend(s);var r=e.createEncryptor(i,s),o=r.finalize(t),a=r.cfg;return m.create({ciphertext:o,key:i,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:s.format})},decrypt:function(e,t,i,s){return s=this.cfg.extend(s),t=this._parse(t,s.format),e.createDecryptor(i,s).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),A=(t.kdf={}).OpenSSL={execute:function(e,t,i,s,r){if(s||(s=o.random(8)),r)a=d.create({keySize:t+i,hasher:r}).compute(e,s);else var a=d.create({keySize:t+i}).compute(e,s);var n=o.create(a.words.slice(t),4*i);return a.sigBytes=4*t,m.create({key:a,iv:n,salt:s})}},b=s.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:A}),encrypt:function(e,t,i,s){var r=(s=this.cfg.extend(s)).kdf.execute(i,e.keySize,e.ivSize,s.salt,s.hasher);s.iv=r.iv;var o=y.encrypt.call(this,e,t,r.key,s);return o.mixIn(r),o},decrypt:function(e,t,i,s){s=this.cfg.extend(s),t=this._parse(t,s.format);var r=s.kdf.execute(i,e.keySize,e.ivSize,t.salt,s.hasher);return s.iv=r.iv,y.decrypt.call(this,e,t,r.key,s)}})}())})),Pr((function(e,t){var i;e.exports=((i=Sd).mode.CFB=function(){var e=i.lib.BlockCipherMode.extend();function t(e,t,i,s){var r,o=this._iv;o?(r=o.slice(0),this._iv=void 0):r=this._prevBlock,s.encryptBlock(r,0);for(var a=0;a>24&255)){var t=e>>16&255,i=e>>8&255,s=255&e;255===t?(t=0,255===i?(i=0,255===s?s=0:++s):++i):++t,e=0,e+=t<<16,e+=i<<8,e+=s}else e+=1<<24;return e}function s(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var r=e.Encryptor=e.extend({processBlock:function(e,t){var i=this._cipher,r=i.blockSize,o=this._iv,a=this._counter;o&&(a=this._counter=o.slice(0),this._iv=void 0),s(a);var n=a.slice(0);i.encryptBlock(n,0);for(var l=0;l>>2]|=r<<24-o%4*8,e.sigBytes+=r},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Ansix923)})),Pr((function(e,t){var i;e.exports=((i=Sd).pad.Iso10126={pad:function(e,t){var s=4*t,r=s-e.sigBytes%s;e.concat(i.lib.WordArray.random(r-1)).concat(i.lib.WordArray.create([r<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Iso10126)})),Pr((function(e,t){var i;e.exports=((i=Sd).pad.Iso97971={pad:function(e,t){e.concat(i.lib.WordArray.create([2147483648],1)),i.pad.ZeroPadding.pad(e,t)},unpad:function(e){i.pad.ZeroPadding.unpad(e),e.sigBytes--}},i.pad.Iso97971)})),Pr((function(e,t){var i;e.exports=((i=Sd).pad.ZeroPadding={pad:function(e,t){var i=4*t;e.clamp(),e.sigBytes+=i-(e.sigBytes%i||i)},unpad:function(e){var t=e.words,i=e.sigBytes-1;for(i=e.sigBytes-1;i>=0;i--)if(t[i>>>2]>>>24-i%4*8&255){e.sigBytes=i+1;break}}},i.pad.ZeroPadding)})),Pr((function(e,t){var i;e.exports=((i=Sd).pad.NoPadding={pad:function(){},unpad:function(){}},i.pad.NoPadding)})),Pr((function(e,t){var i;e.exports=(i=Sd,function(e){var t=i,s=t.lib.CipherParams,r=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(r)},parse:function(e){var t=r.parse(e);return s.create({ciphertext:t})}}}(),i.format.Hex)})),Pr((function(e,t){var i;e.exports=(i=Sd,function(){var e=i,t=e.lib.BlockCipher,s=e.algo,r=[],o=[],a=[],n=[],l=[],d=[],h=[],c=[],u=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var i=0,s=0;for(t=0;t<256;t++){var f=s^s<<1^s<<2^s<<3^s<<4;f=f>>>8^255&f^99,r[i]=f,o[f]=i;var m=e[i],g=e[m],y=e[g],A=257*e[f]^16843008*f;a[i]=A<<24|A>>>8,n[i]=A<<16|A>>>16,l[i]=A<<8|A>>>24,d[i]=A,A=16843009*y^65537*g^257*m^16843008*i,h[f]=A<<24|A>>>8,c[f]=A<<16|A>>>16,u[f]=A<<8|A>>>24,p[f]=A,i?(i=m^e[e[e[y^m]]],s^=e[e[s]]):i=s=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],m=s.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,i=e.sigBytes/4,s=4*((this._nRounds=i+6)+1),o=this._keySchedule=[],a=0;a6&&a%i==4&&(d=r[d>>>24]<<24|r[d>>>16&255]<<16|r[d>>>8&255]<<8|r[255&d]):(d=r[(d=d<<8|d>>>24)>>>24]<<24|r[d>>>16&255]<<16|r[d>>>8&255]<<8|r[255&d],d^=f[a/i|0]<<24),o[a]=o[a-i]^d);for(var n=this._invKeySchedule=[],l=0;l>>24]]^c[r[d>>>16&255]]^u[r[d>>>8&255]]^p[r[255&d]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,n,l,d,r)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,h,c,u,p,o),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,s,r,o,a,n){for(var l=this._nRounds,d=e[t]^i[0],h=e[t+1]^i[1],c=e[t+2]^i[2],u=e[t+3]^i[3],p=4,f=1;f>>24]^r[h>>>16&255]^o[c>>>8&255]^a[255&u]^i[p++],g=s[h>>>24]^r[c>>>16&255]^o[u>>>8&255]^a[255&d]^i[p++],y=s[c>>>24]^r[u>>>16&255]^o[d>>>8&255]^a[255&h]^i[p++],A=s[u>>>24]^r[d>>>16&255]^o[h>>>8&255]^a[255&c]^i[p++];d=m,h=g,c=y,u=A}m=(n[d>>>24]<<24|n[h>>>16&255]<<16|n[c>>>8&255]<<8|n[255&u])^i[p++],g=(n[h>>>24]<<24|n[c>>>16&255]<<16|n[u>>>8&255]<<8|n[255&d])^i[p++],y=(n[c>>>24]<<24|n[u>>>16&255]<<16|n[d>>>8&255]<<8|n[255&h])^i[p++],A=(n[u>>>24]<<24|n[d>>>16&255]<<16|n[h>>>8&255]<<8|n[255&c])^i[p++],e[t]=m,e[t+1]=g,e[t+2]=y,e[t+3]=A},keySize:8});e.AES=t._createHelper(m)}(),i.AES)})),Pr((function(e,t){var i;e.exports=(i=Sd,function(){var e=i,t=e.lib,s=t.WordArray,r=t.BlockCipher,o=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],n=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],d=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],h=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],c=o.DES=r.extend({_doReset:function(){for(var e=this._key.words,t=[],i=0;i<56;i++){var s=a[i]-1;t[i]=e[s>>>5]>>>31-s%32&1}for(var r=this._subKeys=[],o=0;o<16;o++){var d=r[o]=[],h=l[o];for(i=0;i<24;i++)d[i/6|0]|=t[(n[i]-1+h)%28]<<31-i%6,d[4+(i/6|0)]|=t[28+(n[i+24]-1+h)%28]<<31-i%6;for(d[0]=d[0]<<1|d[0]>>>31,i=1;i<7;i++)d[i]=d[i]>>>4*(i-1)+3;d[7]=d[7]<<5|d[7]>>>27}var c=this._invSubKeys=[];for(i=0;i<16;i++)c[i]=r[15-i]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,i){this._lBlock=e[t],this._rBlock=e[t+1],u.call(this,4,252645135),u.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),u.call(this,1,1431655765);for(var s=0;s<16;s++){for(var r=i[s],o=this._lBlock,a=this._rBlock,n=0,l=0;l<8;l++)n|=d[l][((a^r[l])&h[l])>>>0];this._lBlock=a,this._rBlock=o^n}var c=this._lBlock;this._lBlock=this._rBlock,this._rBlock=c,u.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),u.call(this,16,65535),u.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function u(e,t){var i=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=i,this._lBlock^=i<>>e^this._lBlock)&t;this._lBlock^=i,this._rBlock^=i<192.");var t=e.slice(0,2),i=e.length<4?e.slice(0,2):e.slice(2,4),r=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=c.createEncryptor(s.create(t)),this._des2=c.createEncryptor(s.create(i)),this._des3=c.createEncryptor(s.create(r))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=r._createHelper(f)}(),i.TripleDES)})),Pr((function(e,t){var i;e.exports=(i=Sd,function(){var e=i,t=e.lib.StreamCipher,s=e.algo,r=s.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,i=e.sigBytes,s=this._S=[],r=0;r<256;r++)s[r]=r;r=0;for(var o=0;r<256;r++){var a=r%i,n=t[a>>>2]>>>24-a%4*8&255;o=(o+s[r]+n)%256;var l=s[r];s[r]=s[o],s[o]=l}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,i=this._j,s=0,r=0;r<4;r++){i=(i+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[i],e[i]=o,s|=e[(e[t]+e[i])%256]<<24-8*r}return this._i=t,this._j=i,s}e.RC4=t._createHelper(r);var a=s.RC4Drop=r.extend({cfg:r.cfg.extend({drop:192}),_doReset:function(){r._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});e.RC4Drop=t._createHelper(a)}(),i.RC4)})),Pr((function(e,t){var i;e.exports=(i=Sd,function(){var e=i,t=e.lib.StreamCipher,s=e.algo,r=[],o=[],a=[],n=s.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,i=0;i<4;i++)e[i]=16711935&(e[i]<<8|e[i]>>>24)|4278255360&(e[i]<<24|e[i]>>>8);var s=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],r=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,i=0;i<4;i++)l.call(this);for(i=0;i<8;i++)r[i]^=s[i+4&7];if(t){var o=t.words,a=o[0],n=o[1],d=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),c=d>>>16|4294901760&h,u=h<<16|65535&d;for(r[0]^=d,r[1]^=c,r[2]^=h,r[3]^=u,r[4]^=d,r[5]^=c,r[6]^=h,r[7]^=u,i=0;i<4;i++)l.call(this)}},_doProcessBlock:function(e,t){var i=this._X;l.call(this),r[0]=i[0]^i[5]>>>16^i[3]<<16,r[1]=i[2]^i[7]>>>16^i[5]<<16,r[2]=i[4]^i[1]>>>16^i[7]<<16,r[3]=i[6]^i[3]>>>16^i[1]<<16;for(var s=0;s<4;s++)r[s]=16711935&(r[s]<<8|r[s]>>>24)|4278255360&(r[s]<<24|r[s]>>>8),e[t+s]^=r[s]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,i=0;i<8;i++)o[i]=t[i];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,i=0;i<8;i++){var s=e[i]+t[i],r=65535&s,n=s>>>16,l=((r*r>>>17)+r*n>>>15)+n*n,d=((4294901760&s)*s|0)+((65535&s)*s|0);a[i]=l^d}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=t._createHelper(n)}(),i.Rabbit)})),Pr((function(e,t){var i;e.exports=(i=Sd,function(){var e=i,t=e.lib.StreamCipher,s=e.algo,r=[],o=[],a=[],n=s.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],s=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var r=0;r<4;r++)l.call(this);for(r=0;r<8;r++)s[r]^=i[r+4&7];if(t){var o=t.words,a=o[0],n=o[1],d=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),c=d>>>16|4294901760&h,u=h<<16|65535&d;for(s[0]^=d,s[1]^=c,s[2]^=h,s[3]^=u,s[4]^=d,s[5]^=c,s[6]^=h,s[7]^=u,r=0;r<4;r++)l.call(this)}},_doProcessBlock:function(e,t){var i=this._X;l.call(this),r[0]=i[0]^i[5]>>>16^i[3]<<16,r[1]=i[2]^i[7]>>>16^i[5]<<16,r[2]=i[4]^i[1]>>>16^i[7]<<16,r[3]=i[6]^i[3]>>>16^i[1]<<16;for(var s=0;s<4;s++)r[s]=16711935&(r[s]<<8|r[s]>>>24)|4278255360&(r[s]<<24|r[s]>>>8),e[t+s]^=r[s]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,i=0;i<8;i++)o[i]=t[i];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,i=0;i<8;i++){var s=e[i]+t[i],r=65535&s,n=s>>>16,l=((r*r>>>17)+r*n>>>15)+n*n,d=((4294901760&s)*s|0)+((65535&s)*s|0);a[i]=l^d}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=t._createHelper(n)}(),i.RabbitLegacy)})),Pr((function(e,t){var i;e.exports=(i=Sd,function(){var e=i,t=e.lib.BlockCipher,s=e.algo;const r=16,o=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var n={pbox:[],sbox:[]};function l(e,t){let i=t>>24&255,s=t>>16&255,r=t>>8&255,o=255&t,a=e.sbox[0][i]+e.sbox[1][s];return a^=e.sbox[2][r],a+=e.sbox[3][o],a}function d(e,t,i){let s,o=t,a=i;for(let t=0;t1;--t)o^=e.pbox[t],a=l(e,o)^a,s=o,o=a,a=s;return s=o,o=a,a=s,a^=e.pbox[1],o^=e.pbox[0],{left:o,right:a}}function c(e,t,i){for(let t=0;t<4;t++){e.sbox[t]=[];for(let i=0;i<256;i++)e.sbox[t][i]=a[t][i]}let s=0;for(let a=0;a=i&&(s=0);let n=0,l=0,h=0;for(let t=0;t>>2]|=e[i]<<24-i%4*8;return Ed.lib.WordArray.create(t,e.length)}const Ld=16,Cd=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],xd=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Dd(e){const t=[];for(let i=0,s=e.length;i1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Pd(e){const t=[];for(let i=0,s=e.length;i>>6),t.push(128|63&s);else if(s<=55295||s>=57344&&s<=65535)t.push(224|s>>>12),t.push(128|s>>>6&63),t.push(128|63&s);else{if(!(s>=65536&&s<=1114111))throw t.push(s),new Error("input is not supported");i++,t.push(240|s>>>18&28),t.push(128|s>>>12&63),t.push(128|s>>>6&63),t.push(128|63&s)}}return t}function Id(e){const t=[];for(let i=0,s=e.length;i=240&&e[i]<=247?(t.push(String.fromCodePoint(((7&e[i])<<18)+((63&e[i+1])<<12)+((63&e[i+2])<<6)+(63&e[i+3]))),i+=3):e[i]>=224&&e[i]<=239?(t.push(String.fromCodePoint(((15&e[i])<<12)+((63&e[i+1])<<6)+(63&e[i+2]))),i+=2):e[i]>=192&&e[i]<=223?(t.push(String.fromCodePoint(((31&e[i])<<6)+(63&e[i+1]))),i++):t.push(String.fromCodePoint(e[i]));return t.join("")}function Bd(e,t){const i=31&t;return e<>>32-i}function Md(e){return(255&Cd[e>>>24&255])<<24|(255&Cd[e>>>16&255])<<16|(255&Cd[e>>>8&255])<<8|255&Cd[255&e]}function Fd(e){return e^Bd(e,2)^Bd(e,10)^Bd(e,18)^Bd(e,24)}function Ud(e){return e^Bd(e,13)^Bd(e,23)}function Od(e,t,i){const s=new Array(4),r=new Array(4);for(let t=0;t<4;t++)r[0]=255&e[4*t],r[1]=255&e[4*t+1],r[2]=255&e[4*t+2],r[3]=255&e[4*t+3],s[t]=r[0]<<24|r[1]<<16|r[2]<<8|r[3];for(let e,t=0;t<32;t+=4)e=s[1]^s[2]^s[3]^i[t+0],s[0]^=Fd(Md(e)),e=s[2]^s[3]^s[0]^i[t+1],s[1]^=Fd(Md(e)),e=s[3]^s[0]^s[1]^i[t+2],s[2]^=Fd(Md(e)),e=s[0]^s[1]^s[2]^i[t+3],s[3]^=Fd(Md(e));for(let e=0;e<16;e+=4)t[e]=s[3-e/4]>>>24&255,t[e+1]=s[3-e/4]>>>16&255,t[e+2]=s[3-e/4]>>>8&255,t[e+3]=255&s[3-e/4]}function Nd(e,t,i){const s=new Array(4),r=new Array(4);for(let t=0;t<4;t++)r[0]=255&e[0+4*t],r[1]=255&e[1+4*t],r[2]=255&e[2+4*t],r[3]=255&e[3+4*t],s[t]=r[0]<<24|r[1]<<16|r[2]<<8|r[3];s[0]^=2746333894,s[1]^=1453994832,s[2]^=1736282519,s[3]^=2993693404;for(let e,i=0;i<32;i+=4)e=s[1]^s[2]^s[3]^xd[i+0],t[i+0]=s[0]^=Ud(Md(e)),e=s[2]^s[3]^s[0]^xd[i+1],t[i+1]=s[1]^=Ud(Md(e)),e=s[3]^s[0]^s[1]^xd[i+2],t[i+2]=s[2]^=Ud(Md(e)),e=s[0]^s[1]^s[2]^xd[i+3],t[i+3]=s[3]^=Ud(Md(e));if(0===i)for(let e,i=0;i<16;i++)e=t[i],t[i]=t[31-i],t[31-i]=e}function jd(e,t,i){let{padding:s="pkcs#7",mode:r,iv:o=[],output:a="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===r&&("string"==typeof o&&(o=Dd(o)),16!==o.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=Dd(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==i?Pd(e):Dd(e):[...e],("pkcs#5"===s||"pkcs#7"===s)&&0!==i){const t=Ld-e.length%Ld;for(let i=0;i=Ld;){const t=e.slice(c,c+16),s=new Array(16);if("cbc"===r)for(let e=0;ee.length&&s+r<=i.length?e.length-t:s+r>i.length&&t+r<=e.length?i.length-s:t+r<=e.length&&s+r<=i.length?r:i.length>24&255,e>>16&255,e>>8&255,255&e)}function Yd(e,t){return t+3>>19)^(s<<23|s>>>9)}function Zd(e,t){var i=new Array(36);i[0]=Yd(t,0),i[1]=Yd(t,4),i[2]=Yd(t,8),i[3]=Yd(t,12);for(var s=0;s<32;s++)i[s+4]=i[s]^eh(i[s+1]^i[s+2]^i[s+3]^e[s]);var r=new Array(4);for(s=35;s>=32;s--)r[35-s]=i[s];var o=function(e){for(var t=new Array(4*e.length),i=0;i>>30)^(s<<10|s>>>22)^(s<<18|s>>>14)^(s<<24|s>>>8)}function th(e,t,i){if(null==e||null==e||e.length%16!=0)return console.log("sm4 key is error!"),null;if(null==i||null==i||i.length<=0)return console.log("cipher is error!"),null;if(null==t||null==t||t.length%16!=0)return console.log("iv is error!"),null;for(var s=Qd(e),r=Math.ceil(i.length/16),o=new Array(i.length),a=t.slice(),n=0;ne)return this.preDelayTimestamp-e>1e3&&this.player.debugWarn("CommonDemux",`getDelay() and preDelayTimestamp is ${this.preDelayTimestamp} > timestamp is ${e} more than ${this.preDelayTimestamp-e}ms and return ${this.delay}`),this.preDelayTimestamp=e,this.delay;if(this.firstTimestamp){if(e){const t=Date.now()-this.startTimestamp,i=e-this.firstTimestamp;t>=i?(this.isStreamTsMoreThanLocal=!1,this.delay=t-i):(this.isStreamTsMoreThanLocal=!0,this.delay=i-t)}}else this.firstTimestamp=e,this.startTimestamp=Date.now(),this.delay=-1;return this.preDelayTimestamp=e,this.delay}getDelayNotUpdateDelay(e,t){if(!e||!this.player.isDemuxDecodeFirstIIframeInit())return-1;if(t===Ue)return this.pushLatestDelay;if(this.preDelayTimestamp&&this.preDelayTimestamp-e>1e3)return this.player.debugWarn("CommonDemux",`getDelayNotUpdateDelay() and preDelayTimestamp is ${this.preDelayTimestamp} > timestamp is ${e} more than ${this.preDelayTimestamp-e}ms and return -1`),-1;if(this.firstTimestamp){let t=-1;if(e){const i=Date.now()-this.startTimestamp,s=e-this.firstTimestamp;t=i>=s?i-s:s-i}return t}return-1}resetDelay(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1}resetAllDelay(){this.resetDelay(),this.preDelayTimestamp=null}initInterval(){this.player.isUseHls265()?this.player.debugLog("CommonDemux","initInterval() and is hls and support hls265 so return"):-1===this.player.getStreamType().indexOf(A)?this.player.isPlaybackCacheBeforeDecodeForFpsRender()?this.player.debugLog("CommonDemux","initInterval() and playback and playbackIsCacheBeforeDecodeForFpsRender is true so return"):(this.player.debugLog("CommonDemux","setInterval()"),this._loop(),this.stopId=setInterval((()=>{if(this.player.isDestroyedOrClosed())return;let e=(new Date).getTime();this.preLoopTimestamp||(this.preLoopTimestamp=e);const t=e-this.preLoopTimestamp;this.updateHistoryIntervalDiffTimeList(t),t>100&&this.player.debugWarn("CommonDemux",`loop demux diff time is ${t}`),this._loop(),this.preLoopTimestamp=(new Date).getTime()}),20)):this.player.debugLog("CommonDemux","initInterval() and is worker stream so return")}clearStopInterval(){this.stopId&&(clearInterval(this.stopId),this.stopId=null)}startPlaybackLoopInterval(){this.initPlaybackCacheLoop()}updateHistoryIntervalDiffTimeList(e){this.historyIntervalDiffTimeList.length>5&&this.historyIntervalDiffTimeList.shift(),this.historyIntervalDiffTimeList.push(e)}isHistoryIntervalDiffTimeAllLarge(){if(this.historyIntervalDiffTimeList.length<5)return!1;for(let e=0;e{let e=null;this.bufferList.length&&(e=this.bufferList.shift(),this._doDecoderDecode(e))};e();const t=Math.ceil(1e3/(this.playbackStreamFps*this.player.getPlaybackRate()));this.player.debugLog("CommonDemux",`initPlaybackCacheLoop() and fragDuration is ${t}, playbackStreamFps is ${this.playbackStreamFps}, playbackRate is ${this.player.getPlaybackRate()}`),this.stopId=setInterval(e,t)}_loop(){let e;const t=this.player._opt.videoBuffer,i=this.player._opt.videoBufferDelay,s=this.player._opt.playType===v;if(this.bufferList.length){if(this.isPushDropping)return void this.player.debugWarn("CommonDemux",`_loop isPushDropping is true and bufferList length is ${this.bufferList.length}`);if(this.dropping){for(e=this.bufferList.shift(),this.player.debugWarn("CommonDemux",`_loop is dropping and data.ts is ${e.ts}, data.type is ${e.type}, data.isIFrame is ${e.isIFrame}, delay is ${this.delay} ,buffer list is ${this.bufferList.length}`);!e.isIFrame&&this.bufferList.length;)e=this.bufferList.shift();const t=this.getDelayNotUpdateDelay(e.ts,e.type);e.isIFrame&&t<=this.getNotDroppingDelayTs()&&(this.player.debugLog("CommonDemux",`_loop data isIFrame is true and delay is ${this.delay}`),this.dropping=!1,this._doDecoderDecode(e),this._decodeNext(e))}else if(this.player.isPlayback()||this.player.isPlayUseMSE()||0===t)for(;this.bufferList.length;)e=this.bufferList.shift(),this._doDecoderDecode(e);else if(e=this.bufferList[0],-1===this.getDelay(e.ts,e.type))this.player.debugLog("CommonDemux",`delay is -1 and data.ts is ${e.ts} data.type is ${e.type}`),this.bufferList.shift(),this._doDecoderDecode(e),this._decodeNext(e);else if(this.delay>i+t&&s)this.hasIframeInBufferList()?(this.player.debugWarn("CommonDemux",`_loop delay is ${this.delay}, set dropping is true`),this.resetAllDelay(),this.dropping=!0,this.player.updateStats({isDropping:!0})):(this.bufferList.shift(),this._doDecoderDecode(e),this._decodeNext(e));else for(;this.bufferList.length;){if(e=this.bufferList[0],!(this.getDelay(e.ts,e.type)>t)){this.delay<0&&this.player.debugWarn("CommonDemux",`_loop delay is ${this.delay} bufferList is ${this.bufferList}`);break}this.bufferList.shift(),this._doDecoderDecode(e)}}else-1!==this.delay&&this.player.debugLog("CommonDemux","loop() bufferList is empty and reset delay"),this.resetAllDelay()}_doDecode(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;const o=this.player;let a={ts:i,cts:r,type:t,isIFrame:!1};this.player.isPlayer()?(t===Oe&&o._opt.playType===v&&this.calcNetworkDelay(i),o._opt.useWCS&&!o._opt.useOffscreen||o._opt.useMSE?(t===Oe&&(a.isIFrame=s),this.pushBuffer(e,a)):t===Oe?o.decoderWorker&&o.decoderWorker.decodeVideo(e,i,s):t===Ue&&o._opt.hasAudio&&o.decoderWorker&&o.decoderWorker.decodeAudio(e,i)):this.player.isPlayback()&&(t===Oe&&(a.isIFrame=s),this.player.isPlaybackOnlyDecodeIFrame()?t===Oe&&s&&this.pushBuffer(e,a):this.player.isPlaybackCacheBeforeDecodeForFpsRender()||1===this.player.getPlaybackRate()?this.pushBuffer(e,a):this.pushBuffer(e,a,!1))}_doDecodeByHls(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=!1;if(t===Ue&&Nr(e)&&(this.player.debugLog("CommonDemux",`hls pushBuffer audio ts is ${i}, isAacCodecPacket is true`),o=!0,this.player.isRecordTypeFlv())){const t=new Uint8Array(e);this.player.recorder.addAACSequenceHeader(t,i)}let a=!1;if(t===Oe&&s&&ga(e)&&(this.player.debugLog("CommonDemux",`hls pushBuffer video ts is ${i}, isVideoSequenceHeader is true`),a=!0,this.player.isRecordTypeFlv())){const t=new Uint8Array(e);this.player.recorder.addVideoSequenceHeader(t,i)}this.player.recording&&Aa(a)&&Aa(o)&&this.handleRecording(e,t,i,s,r),t===Oe?this._doDecoderDecode({ts:i,cts:r,payload:e,type:Oe,isIFrame:s}):t===Ue&&this._doDecoderDecode({ts:i,payload:e,type:Ue})}_doDecodeByFmp4(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,i,s,r)}_doDecodeByTs(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,i,s,r)}_doDecodeByPs(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,i,s,r)}_decodeNext(e){const t=e.ts;if(0===this.bufferList.length)return;let i=this.bufferList[0];const s=i.ts-t,r=e.type===Oe&&i.type===Ue,o=e.type===Oe&&ga(e.payload);(s<=20||r||o)&&(this.player.debugLog("CommonDemux",`decode data type is ${e.type} and\n ts is ${t} next data type is ${i.type} ts is ${i.ts}\n diff is ${s} and isVideoAndNextAudio is ${r} and isVideoSqeHeader is ${o}`),this.bufferList.shift(),this._doDecoderDecode(i))}_doDecoderDecode(e){const t=this.player,{webcodecsDecoder:i,mseDecoder:s}=t;this.player.isPlayer()&&this.player.updateStats({buf:this.delay}),e.type===Ue?t._opt.hasAudio&&(t._opt.useMSE&&t._opt.mseDecodeAudio?s.decodeAudio(e.payload,e.ts):t._opt.useWCS&&t._opt.wcsDecodeAudio?i.decodeAudio(e.payload,e.ts):t.decoderWorker&&t.decoderWorker.decodeAudio(e.payload,e.ts)):e.type===Oe&&(t._opt.isEmitSEI&&this.findSei(e.payload,e.ts),t._opt.useWCS&&!t._opt.useOffscreen?i.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):t._opt.useMSE?s.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):t.decoderWorker&&t.decoderWorker.decodeVideo(e.payload,e.ts,e.isIFrame))}pushBuffer(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=this.player._opt.videoBuffer,r=this.player._opt.videoBufferDelay,o=this.player.isPlayer();if(t.type===Ue&&Nr(e)){if(this.player.debugLog("CommonDemux",`pushBuffer() audio ts is ${t.ts}, isAacCodecPacket is true`),this.player.isRecordTypeFlv()){const i=new Uint8Array(e);this.player.recorder.addAACSequenceHeader(i,t.ts)}this._doDecoderDecode({ts:t.ts,payload:e,type:Ue})}else if(t.type===Oe&&t.isIFrame&&ga(e)){if(this.player.debugLog("CommonDemux",`pushBuffer() video ts is ${t.ts}, isVideoSequenceHeader is true`),this.player.isRecordTypeFlv()){const i=new Uint8Array(e);this.player.recorder.addVideoSequenceHeader(i,t.ts)}this._doDecoderDecode({ts:t.ts,payload:e,type:Oe,isIFrame:t.isIFrame,cts:t.cts})}else{if(this.player.recording&&this.handleRecording(e,t.type,t.ts,t.isIFrame,t.cts),o){if(t.type===Oe){if(this.preTimestampDuration>0){const e=t.ts-this.preTimestamp,i=this.preTimestampDuration+this.preTimestampDuration/2;e>=i&&this.player.debugLog("CommonDemux",`pushBuffer() video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts}, preTs is ${this.preTimestamp},\n diff is ${e} and preTsDuration is ${this.preTimestampDuration} and maxDiff is ${i}\n maybe trigger black screen or flower screen`)}if(null!==this.preTimestamp&&this.preTimestamp>=t.ts&&(this.player.debugWarn("CommonDemux",`pushBuffer() video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts} less than (or equal) preTs is ${this.preTimestamp} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${this.prevPayloadBufferSize}`),this.preTimestamp-t.ts>Z&&(this.player.debugWarn("CommonDemux",`pushBuffer() video\n ts is ${t.ts}, preTimestamp is ${this.preTimestamp},\n diff is ${this.preTimestamp-t.ts} more than 3600000\n and resetAllDelay()`),this.resetAllDelay()),this.player._opt.isDropSameTimestampGop&&Aa(t.isIFrame)&&this.player.isDemuxDecodeFirstIIframeInit())){const e=this.hasIframeInBufferList(),t=Aa(this.isPushDropping);return this.player.debugLog("CommonDemux",`pushBuffer(), isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next drop buffer`),void(e&&t?this.dropBuffer$2():this.clearBuffer(!0))}this.preTimestamp>0&&(this.preTimestampDuration=t.ts-this.preTimestamp),this.prevPayloadBufferSize=e.byteLength,this.preTimestamp=t.ts}if(this.player.isDemuxDecodeFirstIIframeInit()){let e=this.getDelayNotUpdateDelay(t.ts,t.type);this.pushLatestDelay=e;const i=r+s;this.player._opt.useMSE?this.delay>0&&e>i&&this.delay ${r+s}, bufferList is ${this.bufferList.length}, delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()):this.delay>0&&e>i&&this.delay ${r+s},bufferList is ${this.bufferList.length}, delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()),this.isHistoryIntervalDiffTimeAllLarge()&&Aa(this.player.visibility)&&(this.player._opt.useMSE?this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debugWarn("CommonDemux",`useMSE, page visibility is false and\n history interval diff is ${this.historyIntervalDiffTimeList.join(",")} and\n bufferList is ${this.bufferList.length},\n delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()):this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debugWarn("CommonDemux",`useWCS, page visibility is false and\n history interval diff is ${this.historyIntervalDiffTimeList.join(",")} and\n bufferList is ${this.bufferList.length},\n delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()))}}i?t.type===Ue?this.bufferList.push({ts:t.ts,payload:e,type:Ue}):t.type===Oe&&this.bufferList.push({ts:t.ts,cts:t.cts,payload:e,type:Oe,isIFrame:t.isIFrame}):t.type===Oe?this._doDecoderDecode({ts:t.ts,cts:t.cts,payload:e,type:Oe,isIFrame:t.isIFrame}):t.type===Ue&&this._doDecoderDecode({ts:t.ts,payload:e,type:Ue}),this.player.isPlaybackCacheBeforeDecodeForFpsRender()&&this.calcPlaybackStreamFps()}}calcPlaybackStreamFps(){if(Io(this.playbackStreamVideoFps)||Io(this.playbackStreamAudioFps)){let e=this.playbackStreamVideoFps,t=this.playbackStreamAudioFps;if(Io(this.playbackStreamVideoFps)&&(e=da(this.bufferList,Oe),e>0&&(this.playbackStreamVideoFps=e,this.player.video&&this.player.video.setStreamFps(this.playbackStreamVideoFps),this.playbackStreamFps=t?e+t:e,Aa(this.player._opt.hasAudio)&&(this.player.debugLog(this.TAG_NAME,"playbackCacheBeforeDecodeForFpsRender,_opt.hasAudio is false and set streamAudioFps is 0"),this.playbackStreamAudioFps=0),this.initPlaybackCacheLoop())),Io(this.playbackStreamAudioFps)&&(t=da(this.bufferList,Ue),t>0&&(this.playbackStreamAudioFps=t,this.playbackStreamFps=e?e+t:t,this.initPlaybackCacheLoop())),Io(this.playbackStreamVideoFps)&&Io(this.playbackStreamAudioFps)){const i=this.bufferList.map((e=>({type:e.type,ts:e.ts})));this.player.debugLog("CommonDemux",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${this.bufferList.length} and ts list is ${JSON.stringify(i)}`)}const i=this.getAudioBufferLength()>0,s=i?60:40;this.bufferList.length>=s&&(this.player.debugWarn("CommonDemux",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${this.bufferList.length} more than ${s}, and hasAudio is ${i} an set streamFps is 25`),this.playbackStreamVideoFps=e,this.player.video&&this.player.video.setStreamFps(this.playbackStreamVideoFps),i?(this.playbackStreamAudioFps=25,this.playbackStreamFps=this.playbackStreamVideoFps+this.playbackStreamAudioFps):this.playbackStreamFps=this.playbackStreamVideoFps,this.initPlaybackCacheLoop())}}dropBuffer$2(){if(this.bufferList.length>0){let e=this.bufferList.findIndex((e=>ya(e.isIFrame)&&e.type===Oe));if(this.isAllIframeInBufferList())for(let t=0;t=this.getNotDroppingDelayTs()){this.player.debugLog("CommonDemux",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${s} and notDroppingDelayTs is ${this.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){this.isPushDropping=!0,this.player.updateStats({isDropping:!0});const t=this.bufferList.length;this.bufferList=this.bufferList.slice(e);const i=this.bufferList.shift();this.resetAllDelay(),this.getDelay(i.ts,i.type),this._doDecoderDecode(i),this.isPushDropping=!1,this.player.debugLog("CommonDemux",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,and new bufferList length is ${this.bufferList.length} and new delay is ${this.delay} `)}else this.isPushDropping=!1}0===this.bufferList.length&&(this.isPushDropping=!1)}clearBuffer(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.player.debugLog("CommonDemux",`clearBuffer,buffer length is ${this.bufferList.length}, need clear is ${e} and _opt.checkFirstIFrame is ${this.player._opt.checkFirstIFrame}`),e&&(this.bufferList=[]),this.player.isPlayer()&&(this.resetAllDelay(),ya(this.player._opt.checkFirstIFrame)&&(this.dropping=!0,this.player.updateStats({isDropping:!0}))),this.player.decoderCheckFirstIFrame()}calcNetworkDelay(e){if(!(this.player.isDemuxDecodeFirstIIframeInit()&&e>0))return;null===this.bufferStartDts?(this.bufferStartDts=e,this.bufferStartLocalTs=oo()):et?i-t:0;s>this.player._opt.networkDelay&&this.player._opt.playType===v&&(this.player.debugWarn("CommonDemux",`delay is more than networkDelay and now dts:${e},start dts is ${this.bufferStartDts}, vs start is ${t},local diff is ${i} ,delay is ${s}, _opt.networkDelay is ${this.player._opt.networkDelay}`),this.player.emit(at.networkDelayTimeout,s)),this.player.updateStats({netBuf:s})}calcIframeIntervalTimestamp(e){if(null===this.preIframeTs)this.preIframeTs=e;else if(this.preIframeTs{t.type===Oe&&(e+=1)})),e}getAudioBufferLength(){let e=0;return this.bufferList.forEach((t=>{t.type===Ue&&(e+=1)})),e}hasIframeInBufferList(){return this.bufferList.some((e=>e.type===Oe&&e.isIFrame))}isAllIframeInBufferList(){const e=this.getVideoBufferLength();let t=0;return this.bufferList.forEach((e=>{e.type===Oe&&e.isIFrame&&(t+=1)})),e===t}getInputByteLength(){return 0}getIsStreamTsMoreThanLocal(){return this.isStreamTsMoreThanLocal}close(){}reset(){}findSei(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=4;Mo(this.nalUnitSize)&&(s=this.nalUnitSize);const r=Zr(e.slice(5),s);if(Aa(i)){const e=this.player.getVideoInfo();e&&e.encType&&(i=e.encType===_t)}r.forEach((e=>{const s=i?e[0]>>>1&63:31&e[0],r=i&&(s===Yt||s===Kt),o=Aa(i)&&s===Pt;(r||o)&&this.player.emitVideoSei({ts:t,data:e})}))}handleRecording(e,t,i,s,r){if(this.player.isRecordTypeFlv()){const s=new Uint8Array(e);t===Oe?this.player.recorder.addVideo(s,i):t===Ue&&this.player.recorder.addAudio(s,i)}else if(this.player.isRecordTypeMp4()){const o=new Uint8Array(e);if(this.player.recorder.isWasmMp4()){if(t===Oe)this.player.recorder.handleAddNaluTrack(o.slice(5),s,i,r);else if(t===Ue){const t=new Uint8Array(e);this.player.recorder.handleAddAudioTrack(jr(t)?t.slice(2):t.slice(1),i)}}else t===Oe&&this.player.recorder.handleAddNaluTrack(o.slice(5),s,i,r)}}updateNalUnitSize(e){const t=15&e[0];this.player.video.updateVideoInfo({encTypeCode:t});const i=t===bt;this.nalUnitSize=function(e,t){let i=null;return t?e.length>=28&&(i=1+(3&e[26])):e.length>=12&&(i=1+(3&e[9])),i}(e,i),this.player.debugLog(this.TAG_NAME,`demux() isVideoSequenceHeader is true and isHevc is ${i} and nalUnitSize is ${this.nalUnitSize}`)}cryptoPayload(e,t){let i=this.player,s=e;if(i._opt.isM7sCrypto)if(i._opt.cryptoKey&&i._opt.cryptoKey.byteLength>0&&i._opt.cryptoIV&&i._opt.cryptoIV.byteLength>0){const t=this.player.video.getVideoInfo();t.encTypeCode?s=function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),i=new Uint8Array(i);const r=e.byteLength;let o=5;for(;or)break;let n=e[o+4],l=!1;if(s?(n=n>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(n)):(n&=31,l=1===n||5===n),l){const s=e.slice(o+4+2,o+4+a);let r=new wd.ModeOfOperation.ctr(t,new wd.Counter(i));const n=r.decrypt(s);r=null,e.set(n,o+4+2)}o=o+4+a}return e}(e,i._opt.cryptoKey,i._opt.cryptoIV,t.encTypeCode===bt):i.debugWarn(this.TAG_NAME,`videoInfo.encTypeCode is ${t.encTypeCode}`)}else i.debugError(this.TAG_NAME,`isM7sCrypto cryptoKey.length is ${i._opt.cryptoKey&&i._opt.cryptoKey.byteLength} or cryptoIV.length is ${i._opt.cryptoIV&&i._opt.cryptoIV.byteLength} null`);else if(i._opt.isSm4Crypto)if(i._opt.sm4CryptoKey){const t=this.player.video.getVideoInfo().encTypeCode===bt,r=this.player._opt.isSm4CryptoH265V2;s=i._opt.cryptoKey&&i._opt.cryptoKey.byteLength>0&&i._opt.cryptoIV&&i._opt.cryptoIV.byteLength>0?function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];t=new Uint8Array(t),i=new Uint8Array(i);const o=e.byteLength;let a=5;for(;ao)break;let l=e[a+4],d=!1,h=2;if(s?(r&&(h=3),l=l>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(l)):(l&=31,d=1===l||5===l),d){const s=th(t,i,e.slice(a+4+h,a+4+n));e.set(s,a+4+h)}a=a+4+n}return e}(e,i._opt.cryptoKey,i._opt.cryptoIV,t,r):function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=e.byteLength;let o=new Uint8Array(e.slice(0,5)),a=5;for(;ar){const t=new Uint8Array(o.length+e.length-a);t.set(o,0),t.set(e.slice(a),o.length),o=t;break}let d=e[a+4],h=!1,c=2;if(i?(s&&(c=3),d=d>>>1&63,h=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(d)):(d&=31,h=1===d||5===d),h){const i=jd(e.slice(a+4+c,a+4+l),t,0,{padding:"none",output:"array"});let s=i[i.length-1];if(s>0&&s<16){let e=!0;for(let t=1;t<=s;t++)if(i[i.length-t]!==s){e=!1;break}e&&i.splice(i.length-s,s)}const r=new Uint8Array(c);r.set(e.slice(a+4,a+4+c),0);const n=eo(ll(r,new Uint8Array(i))),d=new Uint8Array(o.length+n.length);d.set(o,0),d.set(n,o.length),o=d}else{const t=e.slice(a+4,a+4+l),i=new Uint8Array(o.length+4+t.length);i.set(o,0),i.set(n,o.length),i.set(t,o.length+4),o=i}a=a+4+l}return o}(e,i._opt.sm4CryptoKey,t,r)}else i._opt.sm4CryptoKey||i.debugError(this.TAG_NAME,"isSm4Crypto opt.sm4CryptoKey is null");else if(i._opt.isXorCrypto)if(i._opt.cryptoKey&&i._opt.cryptoKey.byteLength>0&&i._opt.cryptoIV&&i._opt.cryptoIV.byteLength>0){const t=this.player.video.getVideoInfo();s=function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=e.byteLength;let o=5;for(;or)break;let n=e[o+4],l=!1;if(s?(n=n>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(n)):(n&=31,l=1===n||5===n),l){const s=Wd(e.slice(o+4,o+4+a),t,i);e.set(s,o+4)}o=o+4+a}return e}(e,i._opt.cryptoKey,i._opt.cryptoIV,t.encTypeCode===bt)}else i.debugError(this.TAG_NAME,"isXorCrypto opt.xorCryptoKey is null");return s}cryptoPayloadAudio(e){let t=this.player;if(Aa(t._opt.isCryptoAudio))return e;let i=e;if(t._opt.isM7sCrypto)if(t._opt.cryptoKey&&t._opt.cryptoKey.byteLength>0&&t._opt.cryptoIV&&t._opt.cryptoIV.byteLength>0){e[0]>>4===wt&&(i=function(e,t,i){if(e.byteLength<=30)return e;const s=e.slice(32);let r=new wd.ModeOfOperation.ctr(t,new wd.Counter(i));const o=r.decrypt(s);return r=null,e.set(o,32),e}(e,t._opt.cryptoKey,t._opt.cryptoIV))}else t.debugError(this.TAG_NAME,`isM7sCrypto cryptoKey.length is ${t._opt.cryptoKey&&t._opt.cryptoKey.byteLength} or cryptoIV.length is ${t._opt.cryptoIV&&t._opt.cryptoIV.byteLength} null`);return i}_decodeEnhancedH265Video(e,t){const i=e[0],s=48&i,r=15&i,o=e.slice(1,5),a=new ArrayBuffer(4),n=new Uint32Array(a),l="a"==String.fromCharCode(o[0]);if(r===nr){if(s===hr){const t=e.slice(5);if(l);else{const e=new Uint8Array(5+t.length);e.set([28,0,0,0,0],0),e.set(t,5),this.updateNalUnitSize(e),this.player.debugLog(this.TAG_NAME,`demux() isVideoSequenceHeader(enhancedH265) is true and nalUnitSize is ${this.nalUnitSize}`),this._doDecode(e,Oe,0,!0,0)}}}else if(r===lr){let i=e,r=0;const o=s===hr;if(o&&this.calcIframeIntervalTimestamp(t),l);else{n[0]=e[4],n[1]=e[3],n[2]=e[2],n[3]=0,r=n[0];i=Xn(e.slice(8),o),i=this.cryptoPayload(i,o),this._doDecode(i,Oe,t,o,r)}}else if(r===dr){const i=s===hr,r=e.slice(5);i&&this.calcIframeIntervalTimestamp(t);let o=Xn(r,i);o=this.cryptoPayload(o,i),this._doDecode(o,Oe,t,i,0)}}_isEnhancedH265Header(e){return 128==(128&e)}handlePlaybackPause(e){ya(e)?this.clearStopInterval():this.startPlaybackLoopInterval()}}var sh=function(e,t,i,s){return new(i||(i=Promise))((function(r,o){function a(e){try{l(s.next(e))}catch(e){o(e)}}function n(e){try{l(s.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,n)}l((s=s.apply(e,t||[])).next())}))};const rh=Symbol(32),oh=Symbol(16),ah=Symbol(8);class nh{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return sh(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,i)=>{var s;this.reject=i,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(s=this.pull)||void 0===s||s.call(this,e)}))}))}readU32(){return this.read(rh)}readU16(){return this.read(oh)}readU8(){return this.read(ah)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let i=0;const s=e=>t.length<(i=e);if("number"==typeof this.need){if(s(this.need))return;e=t.subarray(0,i)}else if(this.need===rh){if(s(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===oh){if(s(2))return;e=t[0]<<8|t[1]}else if(this.need===ah){if(s(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(s(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,i)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(s(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,i)),e=this.need}return this.consumed+=i,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,i=t+e;if(i<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,i);else{const e=new Uint8Array(i);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,i)}return this.buffer=new Uint8Array(e),this.buffer}}nh.U32=rh,nh.U16=oh,nh.U8=ah;class lh extends ih{constructor(e){super(e),this.TAG_NAME="FlvDemux",this.input=new nh(this.demux()),e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.input&&(this.input.close(),this.input=null),this.player.debugLog(this.TAG_NAME,"destroy")}dispatch(e){this.input?this.input.write(e):this.player&&this.player.debugWarn(this.TAG_NAME,"dispatch() this.input is null")}*demux(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),i=new Uint32Array(e),s=this.player;for(;;){if(!this.input)return;t[3]=0;const e=yield 15,r=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const o=i[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let a=i[0];const n=(yield o).slice();if(!s)return;switch(r){case Ne:if(s._opt.hasAudio&&(s.updateStats({abps:n.byteLength}),n.byteLength>0)){let e=this.cryptoPayloadAudio(n);this._doDecode(e,Ue,a)}break;case je:if(s._opt.hasVideo&&n.length>=6){let e=a;s.updateStats({vbps:n.byteLength,dts:e}),s._times.demuxStart||(s._times.demuxStart=oo());const t=n[0];if(this._isEnhancedH265Header(t))this._decodeEnhancedH265Video(n,e);else{const e=15&t;let s=(t>>4&15)===xs;const r=e===bt,o=e===At;if(Aa(r||o))return void this.player.debugWarn(this.TAG_NAME,`demux() codecId is ${e} and ignore`);Aa(s)&&ya(Ca(n,r))&&(this.player.debugLog(this.TAG_NAME,"demux() isIFrame is false and unit type is IDR and update to true"),s=!0),s&&(this.calcIframeIntervalTimestamp(a),null===this.nalUnitSize&&ga(n)&&this.updateNalUnitSize(n)),i[0]=n[4],i[1]=n[3],i[2]=n[2],i[3]=0;let l=i[0],d=this.cryptoPayload(n,s);this._doDecode(d,Oe,a,s,l)}}else n.length<6&&s.debugWarn(this.TAG_NAME,`payload.length is ${n.length} less than 6 and ignore`);break;case Ge:if(this.player.isRecordTypeFlv()){const e=new Uint8Array(n);this.player.recorder.addMetaData(e)}const e=bl(n);e&&e.onMetaData&&s.updateMetaData(e.onMetaData);break;default:s.debugLog(this.TAG_NAME,`demux() type is ${r}`)}}}close(){this.input&&(this.input.close(),this.input=null)}getInputByteLength(){let e=0;return this.input&&this.input.buffer&&(e=this.input.buffer.byteLength),e}}class dh extends ih{constructor(e){super(e),this.TAG_NAME="M7sDemux",e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy")}dispatch(e){const t=this.player,i=new DataView(e),s=i.getUint8(0),r=i.getUint32(1,!1),o=new ArrayBuffer(4),a=new Uint32Array(o);switch(s){case Ue:if(t._opt.hasAudio){const i=new Uint8Array(e,5);t.updateStats({abps:i.byteLength}),i.byteLength>0&&this._doDecode(i,s,r)}break;case Oe:if(t._opt.hasVideo)if(t._times.demuxStart||(t._times.demuxStart=oo()),i.byteLength>=11){const o=new Uint8Array(e,5);let n=r;t.updateStats({vbps:o.byteLength,dts:n});const l=o[0];if(this._isEnhancedH265Header(l))this._decodeEnhancedH265Video(o,r);else{const e=i.getUint8(5)>>4==1;e&&this.calcIframeIntervalTimestamp(r),a[0]=o[4],a[1]=o[3],a[2]=o[2],a[3]=0;let t=a[0],n=this.cryptoPayload(o,e);this._doDecode(n,s,r,e,t)}}else this.player.debugWarn(this.TAG_NAME,"dispatch","dv byteLength is",i.byteLength,"and return")}}}class hh extends lh{constructor(e){super(e),e.debugLog("WebTransportDemux","init")}destroy(){this.player.debugLog("WebTransportDemux","destroy"),super.destroy()}}var ch,uh=Pr((function(e){e.exports=function(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e},e.exports.__esModule=!0,e.exports.default=e.exports})),ph=(ch=uh)&&ch.__esModule&&Object.prototype.hasOwnProperty.call(ch,"default")?ch.default:ch;class fh{constructor(e){this.data=e,this.index=0,this.bitLength=8*e.byteLength}get bitsAvailable(){return this.bitLength-this.index}skipBits(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1];return this.getBits(e,this.index,t)}getBits(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>s,o=8-s;if(o>=e)return i&&(this.index+=e),r>>o-e;{i&&(this.index+=o);const s=e-o;return r<>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class mh extends ih{constructor(e){super(e),ph(this,"TAG_NAME","NakedFlowDemux"),this.lastBuf=null,this.vps=null,this.sps=null,this.pps=null,this.streamVideoType=null,this.streamAudioType=null,this.tempNaluBufferList=new Uint8Array(0),this.pendingUnits={},this.localDts=0,this.isSendSeqHeader=!1,this.isSendAACSeqHeader=!1,e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.lastBuf=null,this.vps=null,this.sps=null,this.pps=null,this.streamVideoType=null,this.streamAudioType=null,this.tempNaluBufferList=new Uint8Array(0),this.pendingUnits={},this.localDts=0,this.localAudioDts=0,this.isSendSeqHeader=!1,this.isSendAACSeqHeader=!1,this.player.debugLog(this.TAG_NAME,"destroy")}dispatch(e){this.player;const t=new Uint8Array(e);if(this.player._opt.nakedFlowDemuxUseNew){const e=this.extractNALu$3(t);if(0===e.length)return void this.player.debugLog(this.TAG_NAME,"dispatch naluArray.length === 0");this.handleVideoFrames(e)}else this.extractNALu$2(t)}addNaluToBuffer(e){const t=e.byteLength+this.tempNaluBufferList.byteLength,i=new Uint8Array(t);i.set(this.tempNaluBufferList,0),i.set(e,this.tempNaluBufferList.byteLength),this.tempNaluBufferList=i}downloadNakedFlowFile(){const e=new Blob([this.tempNaluBufferList]);try{const t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".h264",t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadTempNalu",e)}}getNaluDts(){const e=this.player._opt.nakedFlowFps;return this.localDts=this.localDts+parseInt(1e3/e,10),this.localDts}getNaluAudioDts(){const e=this.player.audio.audioContext.sampleRate,t=this.player.audio.audioBufferSize;return this.localDts+parseInt(t/e*1e3)}extractNALu(e){let t,i,s=0,r=e.byteLength,o=0,a=[];for(;s1)for(let e=0;e{const t=Nn(e);t===Ct||t===Lt?this.handleVideoH264Nalu(e):Gn(t)&&s.push(e)})),1===s.length)this.handleVideoH264Nalu(s[0]);else{const e=function(e){if(0===e.length)return!1;const t=Nn(e[0]);for(let i=1;i{this.handleVideoH264Nalu(e)}))}}else if(this.streamVideoType===_t)if(this.player._opt.nakedFlowH265DemuxUseNew){const e=this.handleAddNaluStartCode(t),i=this.extractNALu(e);if(0===i.length)return void this.player.debugWarn(this.TAG_NAME,"handleVideoNalu","h265 naluList.length === 0");const s=[];if(i.forEach((e=>{const t=Zn(e);t===Ht||t===$t||t===Wt?this.handleVideoH265Nalu(e):el(t)&&s.push(e)})),1===s.length)this.handleVideoH265Nalu(s[0]);else{const e=function(e){if(0===e.length)return!1;const t=Zn(e[0]);for(let i=1;i{this.handleVideoH265Nalu(e)}))}}else{Zn(t)===Ht?this.extractH265PPS(t):this.handleVideoH265Nalu(t)}else this.player.debugWarn(this.TAG_NAME," this.streamVideoType is null")}extractH264PPS(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{jn(Nn(e))?this.extractH264SEI(e):this.handleVideoH264Nalu(e)}))}extractH265PPS(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{const t=Zn(e);t===qt?this.extractH265SEI(e):this.handleVideoH265Nalu(e)}))}extractH264SEI(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{this.handleVideoH264Nalu(e)}))}extractH265SEI(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{this.handleVideoH265Nalu(e)}))}handleAddNaluStartCode(e){const t=[0,0,0,1],i=new Uint8Array(e.length+t.length);return i.set(t),i.set(e,t.length),i}handleAudioAACNalu(e){if(!e||e.byteLength<1)return;this.streamAudioType||(this.streamAudioType=Tt.AAC);let t=new Uint8Array(e);const i=t.slice(0,7);if(t=t.slice(7),!this.isSendAACSeqHeader){const e=(192&i[2])>>6,t=(60&i[2])>>2,s=(1&i[2])<<2|(192&i[3])>>6,r=new Uint8Array([175,0,e<<3|(14&t)>>1,(1&t)<<7|s<<3]);this.isSendAACSeqHeader=!0,this._doDecode(r,Ue,0,!1,0)}const s=this.getNaluAudioDts(),r=new Uint8Array(t.length+2);r.set([175,1],0),r.set(t,2),this._doDecode(r,Ue,s,!1,0)}handleAudioG711ANalu(e){if(!e||e.byteLength<1)return;this.streamAudioType||(this.streamAudioType=Tt.ALAW);let t=new Uint8Array(e);const i=this.getNaluAudioDts(),s=new Uint8Array(t.length+1);s.set([114],0),s.set(t,1),this._doDecode(s,Ue,i,!1,0)}handleAudioG711UNalu(e){if(!e||e.byteLength<1)return;this.streamAudioType||(this.streamAudioType=Tt.MULAW);let t=new Uint8Array(e);const i=this.getNaluAudioDts(),s=new Uint8Array(t.length+1);s.set([130],0),s.set(t,1),this._doDecode(s,Ue,i,!1,0)}handleVideoH264Nalu(e){const t=Nn(e);switch(t){case Lt:this.sps=e;break;case Ct:this.pps=e}if(this.isSendSeqHeader){if(this.sps&&this.pps){const e=Un({sps:this.sps,pps:this.pps}),t=this.localDts;this._doDecode(e,Oe,t,!0,0),this.sps=null,this.pps=null}if(Gn(t)){this.player._times.demuxStart||(this.player._times.demuxStart=oo());const i=Wn(t),s=this.getNaluDts(),r=function(e,t){let i=[];i[0]=t?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=e.byteLength>>24&255,i[6]=e.byteLength>>16&255,i[7]=e.byteLength>>8&255,i[8]=255&e.byteLength;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}(e,i);this._preDoDecode(r,Oe,s,i,0)}else this.player.debugWarn(this.TAG_NAME,`handleVideoH264Nalu is avc seq head nalType is ${t}`)}else if(this.sps&&this.pps){this.isSendSeqHeader=!0;const e=Un({sps:this.sps,pps:this.pps});this._doDecode(e,Oe,0,!0,0),this.sps=null,this.pps=null}}handleVideoH264NaluList(e,t,i){if(this.isSendSeqHeader){this.player._times.demuxStart||(this.player._times.demuxStart=oo());const i=this.getNaluDts(),s=On(e.reduce(((e,t)=>{const i=eo(e),s=eo(t),r=new Uint8Array(i.byteLength+s.byteLength);return r.set(i,0),r.set(s,i.byteLength),r})),t);this._preDoDecode(s,Oe,i,t,0)}else this.player.debugWarn(this.TAG_NAME,"handleVideoH264NaluList isSendSeqHeader is false")}handleVideoH265Nalu(e){const t=Zn(e);switch(t){case Wt:this.vps=e;break;case $t:this.sps=e;break;case Ht:this.pps=e}if(this.isSendSeqHeader){if(this.vps&&this.sps&&this.pps){const e=Qn({vps:this.vps,sps:this.sps,pps:this.pps}),t=this.localDts;this._doDecode(e,Oe,t,!0,0),this.vps=null,this.sps=null,this.pps=null}if(el(t)){this.player._times.demuxStart||(this.player._times.demuxStart=oo());const i=tl(t),s=this.getNaluDts(),r=function(e,t){let i=[];i[0]=t?28:44,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=e.byteLength>>24&255,i[6]=e.byteLength>>16&255,i[7]=e.byteLength>>8&255,i[8]=255&e.byteLength;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}(e,i);this._preDoDecode(r,Oe,s,i,0)}}else if(this.vps&&this.sps&&this.pps){this.isSendSeqHeader=!0;const e=Qn({vps:this.vps,sps:this.sps,pps:this.pps});this._doDecode(e,Oe,0,!0,0),this.vps=null,this.sps=null,this.pps=null}}handleVideoH265NaluList(e,t,i){if(this.isSendSeqHeader){this.player._times.demuxStart||(this.player._times.demuxStart=oo());const i=this.getNaluDts(),s=Xn(e.reduce(((e,t)=>{const i=eo(e),s=eo(t),r=new Uint8Array(i.byteLength+s.byteLength);return r.set(i,0),r.set(s,i.byteLength),r})),t);this._preDoDecode(s,Oe,i,t,0)}else this.player.debugWarn(this.TAG_NAME,"handleVideoH265NaluList isSendSeqHeader is false")}_preDoDecode(e,t,i,s,r){this.player.updateStats({vbps:e.byteLength,dts:i}),s&&this.calcIframeIntervalTimestamp(i),this._doDecode(e,Oe,i,s,r)}getInputByteLength(){let e=0;return this.lastBuf&&(e=this.lastBuf.byteLength),e}handleVideoFrames(e){if(!this.streamVideoType)for(let t of e)if(this.streamVideoType=ra(t),this.streamVideoType)break;this.streamVideoType?this.streamVideoType===vt?this.handleVideoH264Frames(e):this.streamVideoType===_t&&this.handleVideoH265Frames(e):this.player.debugWarn(this.TAG_NAME,"handleVideoFrames streamVideoType is null")}handleVideoH264Frames(e){let t=[],i=[],s=!1,r=!1;this.pendingUnits.units&&(t=this.pendingUnits.units,r=this.pendingUnits.vcl,s=this.pendingUnits.iFrame,this.pendingUnits={});let o={};for(let a of e){if(a.byteLength<4)continue;const e=Nn(a);let n=!1,l=e===Rt;e!==Dt&&e!==Rt||(o=this.parseVideo264Header(a),n=!0),t.length&&r&&(o.isfms||!n)&&(i.push({units:t,isIFrame:s}),t=[],s=!1,r=!1),t.push(a),s=s||l,r=r||n}t.length&&(this.pendingUnits={units:t,vcl:r,iFrame:s}),i.forEach((e=>{const t=e.units,i=e.isIFrame;let s=null,r=null;if(t.forEach((e=>{const t=31&e[0];switch(t){case Ct:this.pps=e;break;case Lt:this.sps=e;break;case Pt:r=e}if(Gn(t)){const t=eo(e);if(s){const e=new Uint8Array(s.byteLength+t.byteLength);e.set(s,0),e.set(t,s.byteLength),s=e}else s=t}})),!this.isSendSeqHeader&&this.sps&&this.pps){this.isSendSeqHeader=!0;const e=Un({sps:this.sps,pps:this.pps});this._doDecode(e,Oe,0,!0,0),this.sps=null,this.pps=null}if(this.isSendSeqHeader){if(this.sps&&this.pps){const e=Un({sps:this.sps,pps:this.pps}),t=this.localDts;this._doDecode(e,Oe,t,!0,0),this.sps=null,this.pps=null}if(s){this.player._times.demuxStart||(this.player._times.demuxStart=oo());const e=this.getNaluDts(),t=On(s,i);this.player._opt.isEmitSEI&&r&&this.player.emitVideoSei({ts:e,data:r}),this._preDoDecode(t,Oe,e,i,0)}}}))}handleVideoH265Frames(e){let t=[],i=[],s=!1,r=!1;this.pendingUnits.units&&(t=this.pendingUnits.units,r=this.pendingUnits.vcl,s=this.pendingUnits.iFrame,this.pendingUnits={});let o={};for(let a of e){if(a.byteLength<4)continue;const e=Zn(a);let n=!1,l=tl(e);el(e)&&(o=this.parseVideo265Header(a),n=!0),t.length&&r&&(o.isfms||!n)&&(i.push({units:t,isIFrame:s}),t=[],s=!1,r=!1),t.push(a),s=s||l,r=r||n}t.length&&(this.pendingUnits={units:t,vcl:r,iFrame:s}),i.forEach((e=>{const t=e.units,i=e.isIFrame;let s=null,r=null;if(t.forEach((e=>{const t=e[0]>>>1&63;switch(t){case Ht:this.pps=e;break;case $t:this.sps=e;break;case Wt:this.vps=e;break;case Yt:case Kt:r=e}if(el(t)){const t=eo(e);if(s){const e=new Uint8Array(s.byteLength+t.byteLength);e.set(s,0),e.set(t,s.byteLength),s=e}else s=t}})),!this.isSendSeqHeader&&this.sps&&this.pps&&this.vps){this.isSendSeqHeader=!0;const e=Qn({sps:this.sps,pps:this.pps,vps:this.vps});this._doDecode(e,Oe,0,!0,0),this.sps=null,this.pps=null,this.vps=null}if(this.isSendSeqHeader){if(this.sps&&this.pps&&this.vps){const e=Qn({sps:this.sps,pps:this.pps,vps:this.vps}),t=this.localDts;this._doDecode(e,Oe,t,!0,0),this.sps=null,this.pps=null,this.vps=null}if(s){this.player._times.demuxStart||(this.player._times.demuxStart=oo());const e=this.getNaluDts(),t=Xn(s,i);this.player._opt.isEmitSEI&&r&&this.player.emitVideoSei({ts:e,data:r}),this._preDoDecode(t,Oe,e,i,0)}}}))}handleVideoH265Frames_1(e){e.forEach((e=>{this.handleVideoNalu(e)}))}parseVideo264Header(e){const t=new fh(e);t.readUByte();return{isfms:0===t.readUEG(),sType:t.readUEG()}}parseVideo265Header(e){const t=new fh(e);return t.readUByte(),{nalType:t.readBits(6),isfms:0===t.readBits(1),sType:t.readBits(3)}}}class gh extends ih{constructor(e){super(e),this.player=e,e.debugLog("EmptyDemux","init")}destroy(){super.destroy(),this.player.debugLog("EmptyDemux","destroy")}}var yh=Pr((function(e,t){var s,r,o,a=(s=new Date,r=4,o={setLogLevel:function(e){r=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=r&&console.debug("["+a.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=r&&console.info("["+a.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=r&&console.warn("["+a.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=r&&console.error("["+a.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)}},o);a.getDurationString=function(e,t){var i;function s(e,t){for(var i=(""+e).split(".");i[0].length0){for(var i="",s=0;s0&&(i+=","),i+="["+a.getDurationString(e.start(s))+","+a.getDurationString(e.end(s))+"]";return i}return"(empty)"},t.Log=a;var n=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};n.prototype.getPosition=function(){return this.position},n.prototype.getEndPosition=function(){return this.buffer.byteLength},n.prototype.getLength=function(){return this.buffer.byteLength},n.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},n.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},n.prototype.readAnyInt=function(e,t){var i=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:i=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:i=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";i=this.dataview.getUint8(this.position)<<16,i|=this.dataview.getUint8(this.position+1)<<8,i|=this.dataview.getUint8(this.position+2);break;case 4:i=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";i=this.dataview.getUint32(this.position)<<32,i|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,i}throw"Not enough bytes in buffer"},n.prototype.readUint8=function(){return this.readAnyInt(1,!1)},n.prototype.readUint16=function(){return this.readAnyInt(2,!1)},n.prototype.readUint24=function(){return this.readAnyInt(3,!1)},n.prototype.readUint32=function(){return this.readAnyInt(4,!1)},n.prototype.readUint64=function(){return this.readAnyInt(8,!1)},n.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",i=0;ithis._byteLength&&(this._byteLength=t);else{for(i<1&&(i=1);t>i;)i*=2;var s=new ArrayBuffer(i),r=new Uint8Array(this._buffer);new Uint8Array(s,0,r.length).set(r),this.buffer=s,this._byteLength=t}}},l.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),i=new Uint8Array(this._buffer,0,t.length);t.set(i),this.buffer=e}},l.BIG_ENDIAN=!1,l.LITTLE_ENDIAN=!0,l.prototype._byteLength=0,Object.defineProperty(l.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(l.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(l.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(l.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),l.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},l.prototype.isEof=function(){return this.position>=this._byteLength},l.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},l.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Int32Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Int16Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return l.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},l.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Uint32Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Uint16Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return l.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},l.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var i=new Float64Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Float32Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},l.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},l.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},l.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},l.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},l.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,l.memcpy=function(e,t,i,s,r){var o=new Uint8Array(e,t,r),a=new Uint8Array(i,s,r);o.set(a)},l.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},l.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},l.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i=0;ir;s--,r++){var o=t[r];t[r]=t[s],t[s]=o}return e},l.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],i=0;i>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},l.prototype.adjustUint32=function(e,t){var i=this.position;this.seek(e),this.writeUint32(t),this.seek(i)},l.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var i=new Int32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},l.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var i=new Int16Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},l.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},l.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var i=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},l.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var i=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},l.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var i=new Float64Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=8*e,i},l.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var i=new Float32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i};var h=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(h.prototype=new l(new ArrayBuffer,0,l.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,a.debug("MultiBufferStream","Stream ready for parsing"),!0):(a.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(a.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){a.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(new Uint8Array(e),0),i.set(new Uint8Array(t),e.byteLength),i.buffer},h.prototype.reduceBuffer=function(e,t,i){var s;return(s=new Uint8Array(i)).set(new Uint8Array(e,t,i)),s.buffer.fileStart=e.fileStart+t,s.buffer.usedBytes=0,s.buffer},h.prototype.insertBuffer=function(e){for(var t=!0,i=0;is.byteLength){this.buffers.splice(i,1),i--;continue}a.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=s.fileStart||(e=this.reduceBuffer(e,0,s.fileStart-e.fileStart)),a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(i,0,e),0===i&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,r,o)}}t&&(a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===i&&(this.buffer=e))},h.prototype.logBufferLevel=function(e){var t,i,s,r,o,n=[],l="";for(s=0,r=0,t=0;t0&&(l+=o.end-1+"]");var d=e?a.info:a.debug;0===this.buffers.length?d("MultiBufferStream","No more buffer in memory"):d("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+s+"/"+r+" bytes), continuous ranges: "+l)},h.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},h.prototype.findPosition=function(e,t,i){var s,r=null,o=-1;for(s=!0===e?0:this.bufferIndex;s=t?(a.debug("MultiBufferStream","Found position in existing buffer #"+o),o):-1},h.prototype.findEndContiguousBuf=function(e){var t,i,s,r=void 0!==e?e:this.bufferIndex;if(i=this.buffers[r],this.buffers.length>r+1)for(t=r+1;t>3;return 31===s&&i.data.length>=2&&(s=32+((7&i.data[0])<<3)+((224&i.data[1])>>5)),s}return null},i.DecoderConfigDescriptor=function(e){i.Descriptor.call(this,4,e)},i.DecoderConfigDescriptor.prototype=new i.Descriptor,i.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},i.DecoderSpecificInfo=function(e){i.Descriptor.call(this,5,e)},i.DecoderSpecificInfo.prototype=new i.Descriptor,i.SLConfigDescriptor=function(e){i.Descriptor.call(this,6,e)},i.SLConfigDescriptor.prototype=new i.Descriptor,this};t.MPEG4DescriptorParser=c;var u={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){u.FullBox.prototype=new u.Box,u.ContainerBox.prototype=new u.Box,u.SampleEntry.prototype=new u.Box,u.TrackGroupTypeBox.prototype=new u.FullBox,u.BASIC_BOXES.forEach((function(e){u.createBoxCtor(e)})),u.FULL_BOXES.forEach((function(e){u.createFullBoxCtor(e)})),u.CONTAINER_BOXES.forEach((function(e){u.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,i){this.type=e,this.size=t,this.uuid=i},FullBox:function(e,t,i){u.Box.call(this,e,t,i),this.flags=0,this.version=0},ContainerBox:function(e,t,i){u.Box.call(this,e,t,i),this.boxes=[]},SampleEntry:function(e,t,i,s){u.ContainerBox.call(this,e,t),this.hdr_size=i,this.start=s},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){u.FullBox.call(this,e,t)},createBoxCtor:function(e,t){u.boxCodes.push(e),u[e+"Box"]=function(t){u.Box.call(this,e,t)},u[e+"Box"].prototype=new u.Box,t&&(u[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){u[e+"Box"]=function(t){u.FullBox.call(this,e,t)},u[e+"Box"].prototype=new u.FullBox,u[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,i=0;ii?(a.error("BoxParser","Box of type '"+h+"' has a size "+d+" greater than its container size "+i),{code:u.ERR_NOT_ENOUGH_DATA,type:h,size:d,hdr_size:l,start:n}):0!==d&&n+d>e.getEndPosition()?(e.seek(n),a.info("BoxParser","Not enough data in stream to parse the entire '"+h+"' box"),{code:u.ERR_NOT_ENOUGH_DATA,type:h,size:d,hdr_size:l,start:n}):t?{code:u.OK,type:h,size:d,hdr_size:l,start:n}:(u[h+"Box"]?s=new u[h+"Box"](d):"uuid"!==h?(a.warn("BoxParser","Unknown box type: '"+h+"'"),(s=new u.Box(h,d)).has_unparsed_data=!0):u.UUIDBoxes[o]?s=new u.UUIDBoxes[o](d):(a.warn("BoxParser","Unknown uuid type: '"+o+"'"),(s=new u.Box(h,d)).uuid=o,s.has_unparsed_data=!0),s.hdr_size=l,s.start=n,s.write===u.Box.prototype.write&&"mdat"!==s.type&&(a.info("BoxParser","'"+c+"' box writing not yet implemented, keeping unparsed data in memory for later write"),s.parseDataAndRewind(e)),s.parse(e),(r=e.getPosition()-(s.start+s.size))<0?(a.warn("BoxParser","Parsing of box '"+c+"' did not read the entire indicated box data size (missing "+-r+" bytes), seeking forward"),e.seek(s.start+s.size)):r>0&&(a.error("BoxParser","Parsing of box '"+c+"' read "+r+" more bytes than the indicated box data size, seeking backwards"),0!==s.size&&e.seek(s.start+s.size)),{code:u.OK,box:s,size:s.size})},u.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},u.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},u.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},u.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},u.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},u.ContainerBox.prototype.parse=function(e){for(var t,i;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},u.SAMPLE_ENTRY_TYPE_VISUAL="Visual",u.SAMPLE_ENTRY_TYPE_AUDIO="Audio",u.SAMPLE_ENTRY_TYPE_HINT="Hint",u.SAMPLE_ENTRY_TYPE_METADATA="Metadata",u.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",u.SAMPLE_ENTRY_TYPE_SYSTEM="System",u.SAMPLE_ENTRY_TYPE_TEXT="Text",u.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},u.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},u.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},u.SampleEntry.prototype.parseFooter=function(e){u.ContainerBox.prototype.parse.call(this,e)},u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_HINT),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_METADATA),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SUBTITLE),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SYSTEM),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_TEXT),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_TEXT,"enct"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_METADATA,"encm"),u.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var i=0;i<3;i++)this.layer_size[i]=16==t?e.readUint16():e.readUint32()})),u.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),u.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),u.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)a.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void a.error("av1C reserved_2 parsing problem");var i=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(i)}else a.error("av1C reserved_1 parsing problem");else a.error("av1C version "+this.version+" not supported")})),u.createBoxCtor("avcC",(function(e){var t,i;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),i=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(i))})),u.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),u.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),u.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),u.createFullBoxCtor("co64",(function(e){var t,i;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(i=0;i>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),u.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),u.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),u.createFullBoxCtor("ctts",(function(e){var t,i;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(i=0;i>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|i>>6&3,this.acmod=i>>3&7,this.lfeon=i>>2&1,this.bit_rate_code=3&i|s>>5&7})),u.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var i=0;i>6,s.bsid=r>>1&31,s.bsmod=(1&r)<<4|o>>4&15,s.acmod=o>>1&7,s.lfeon=1&o,s.num_dep_sub=a>>1&15,s.num_dep_sub>0&&(s.chan_loc=(1&a)<<8|e.readUint8())}})),u.createFullBoxCtor("dfLa",(function(e){var t=[],i=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var s=e.readUint8(),r=Math.min(127&s,i.length-1);if(r?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(i[r]),128&s)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),u.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),u.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),u.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),u.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[i]=e.readString(4),t-=4,i++})),u.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),u.createBoxCtor("hvcC",(function(e){var t,i,s,r;this.configurationVersion=e.readUint8(),r=e.readUint8(),this.general_profile_space=r>>6,this.general_tier_flag=(32&r)>>5,this.general_profile_idc=31&r,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),r=e.readUint8(),this.constantFrameRate=r>>6,this.numTemporalLayers=(13&r)>>3,this.temporalIdNested=(4&r)>>2,this.lengthSizeMinusOne=3&r,this.nalu_arrays=[];var o=e.readUint8();for(t=0;t>7,a.nalu_type=63&r;var n=e.readUint16();for(i=0;i>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var i=0;if(this.version<2)i=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";i=e.readUint32()}for(var s=0;s>7,this.axis=1&t})),u.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),a.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),u.createFullBoxCtor("ipma",(function(e){var t,i;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?a.property_index=(127&o)<<8|e.readUint8():a.property_index=127&o}}})),u.createFullBoxCtor("iref",(function(e){var t,i;for(this.references=[];e.getPosition()>7,s.assignment_type=127&r,s.assignment_type){case 0:s.grouping_type=e.readString(4);break;case 1:s.grouping_type=e.readString(4),s.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:s.sub_track_id=e.readUint32();break;default:a.warn("BoxParser","Unknown leva assignement type")}}})),u.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),u.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),p.prototype.toString=function(){return"("+this.x+","+this.y+")"},u.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new p(e.readUint16(),e.readUint16()),this.display_primaries[1]=new p(e.readUint16(),e.readUint16()),this.display_primaries[2]=new p(e.readUint16(),e.readUint16()),this.white_point=new p(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),u.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),u.createFullBoxCtor("mehd",(function(e){1&this.flags&&(a.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),u.createFullBoxCtor("meta",(function(e){this.boxes=[],u.ContainerBox.prototype.parse.call(this,e)})),u.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),u.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),u.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),u.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),u.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),u.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),u.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var i=0;i0){var t=e.readUint32();this.kid=[];for(var i=0;i0&&(this.data=e.readUint8Array(s))})),u.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),u.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),u.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),u.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),u.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),u.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var i=0;i>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var i=e.readUint8(),s=0;s>7,this.num_leading_samples=127&t})),u.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)a.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=u.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),u.createSampleGroupCtor("stsa",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),u.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),u.createSampleGroupCtor("tsas",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createSampleGroupCtor("tscl",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createSampleGroupCtor("vipr",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),i=0;i>6,this.sample_depends_on[s]=t>>4&3,this.sample_is_depended_on[s]=t>>2&3,this.sample_has_redundancy[s]=3&t})),u.createFullBoxCtor("senc"),u.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),a.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),i=0;i>31&1,s.referenced_size=2147483647&r,s.subsegment_duration=e.readUint32(),r=e.readUint32(),s.starts_with_SAP=r>>31&1,s.SAP_type=r>>28&7,s.SAP_delta_time=268435455&r}})),u.SingleItemTypeReferenceBox=function(e,t,i,s){u.Box.call(this,e,t),this.hdr_size=i,this.start=s},u.SingleItemTypeReferenceBox.prototype=new u.Box,u.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var i=0;i>4&15,this.sample_sizes[t+1]=15&s}else if(8===this.field_size)for(t=0;t0)for(i=0;i>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=u.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),u.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),u.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),u.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var i=e.readUint32(),s=0;s>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),u.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),u.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),u.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),u.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),u.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),u.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},u.createTrackGroupCtor("msrc"),u.TrackReferenceTypeBox=function(e,t,i,s){u.Box.call(this,e,t),this.hdr_size=i,this.start=s},u.TrackReferenceTypeBox.prototype=new u.Box,u.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},u.trefBox.prototype.parse=function(e){for(var t,i;e.getPosition()t&&this.flags&u.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&u.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var i=0;i>7&1,this.block_pad_lsb=i>>6&1,this.block_little_endian=i>>5&1,this.block_reversed=i>>4&1,this.pad_unknown=i>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),u.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),u.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),u.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),u.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=u.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),u.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),u.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=u.parseHex16(e)})),u.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),u.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),u.createFullBoxCtor("vvcC",(function(e){var t,i,s={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(s.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,i=this.num_sublayers-2;i>=0;--i){var a=s.extract_bits(1);this.ptl_sublayer_present_mask|=a<1;++i)s.extract_bits(1);for(this.sublayer_level_idc=[],i=this.num_sublayers-2;i>=0;--i)this.ptl_sublayer_present_mask&1<>=1;t+=u.decimalToHex(s,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var r=!1,o="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||r)&&(o="."+u.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+o,r=!0);t+=o}return t},u.vvc1SampleEntry.prototype.getCodec=u.vvi1SampleEntry.prototype.getCodec=function(){var e,t=u.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var i="";if(this.vvcC.general_constraint_info){var s,r=[],o=0;for(o|=this.vvcC.ptl_frame_only_constraint<<7,o|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,r.push(o),o&&(s=e),o=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===s)i=".CA";else{i=".C";var a="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",n=0,l=0;for(e=0;e<=s;++e)for(n=n<<8|r[e],l+=8;l>=5;){i+=a[n>>l-5&31],n&=(1<<(l-=5))-1}l&&(i+=a[31&(n<<=5-l)])}}t+=i}return t},u.mp4aSampleEntry.prototype.getCodec=function(){var e=u.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),i=this.esds.esd.getAudioConfig();return e+"."+u.decimalToHex(t)+(i?"."+i:"")}return e},u.stxtSampleEntry.prototype.getCodec=function(){var e=u.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},u.vp08SampleEntry.prototype.getCodec=u.vp09SampleEntry.prototype.getCodec=function(){var e=u.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var i=this.vpcC.bitDepth;return 8==i&&(i="08"),e+".0"+this.vpcC.profile+"."+t+"."+i},u.av01SampleEntry.prototype.getCodec=function(){var e,t=u.SampleEntry.prototype.getCodec.call(this),i=this.av1C.seq_level_idx_0;return i<10&&(i="0"+i),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+i+(this.av1C.seq_tier_0?"H":"M")+"."+e},u.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>d&&(this.size+=8),"uuid"===this.type&&(this.size+=16),a.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>d?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>d&&e.writeUint64(this.size)},u.FullBox.prototype.writeHeader=function(e){this.size+=4,u.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},u.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},u.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},u.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&u.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&u.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&u.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&u.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&u.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&u.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&u.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&u.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&u.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&u.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},u.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},u.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},u.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&u.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&u.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&u.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&u.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&u.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&u.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&u.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&u.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[i]instanceof u.Box||t[i]instanceof u.Box||void 0===e[i]||void 0===t[i]||"function"==typeof e[i]||"function"==typeof t[i]||e.subBoxNames&&e.subBoxNames.indexOf(i.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(i.slice(0,4))>-1||"data"===i||"start"===i||"size"===i||"creation_time"===i||"modification_time"===i||u.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(i)>-1||e[i]===t[i]))return!1;return!0},u.boxEqual=function(e,t){if(!u.boxEqualFields(e,t))return!1;for(var i=0;i1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},y.prototype.setExtractionOptions=function(e,t,i){var s=this.getTrackById(e);if(s){var r={};this.extractedTracks.push(r),r.id=e,r.user=t,r.trak=s,s.nextSample=0,r.nb_samples=1e3,r.samples=[],i&&i.nbSamples&&(r.nb_samples=i.nbSamples)}},y.prototype.unsetExtractionOptions=function(e){for(var t=-1,i=0;i-1&&this.extractedTracks.splice(t,1)},y.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=u.parseOneBox(this.stream,false)).code===u.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var i;switch(i="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),i){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[i]&&a.warn("ISOFile","Duplicate Box of type: "+i+", overriding previous occurrence"),this[i]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},y.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(a.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(a.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(a.warn("ISOFile","Not ready to start parsing"),!1))},y.prototype.appendBuffer=function(e,t){var i;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(i=this.nextSeekPosition,this.nextSeekPosition=void 0):i=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(i=this.stream.getEndFilePositionAfter(i))):i=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(a.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+i),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),i},y.prototype.getInfo=function(){var e,t,i,s,r,o,a={},n=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(a.hasMoov=!0,a.duration=this.moov.mvhd.duration,a.timescale=this.moov.mvhd.timescale,a.isFragmented=null!=this.moov.mvex,a.isFragmented&&this.moov.mvex.mehd&&(a.fragment_duration=this.moov.mvex.mehd.fragment_duration),a.isProgressive=this.isProgressive,a.hasIOD=null!=this.moov.iods,a.brands=[],a.brands.push(this.ftyp.major_brand),a.brands=a.brands.concat(this.ftyp.compatible_brands),a.created=new Date(n+1e3*this.moov.mvhd.creation_time),a.modified=new Date(n+1e3*this.moov.mvhd.modification_time),a.tracks=[],a.audioTracks=[],a.videoTracks=[],a.subtitleTracks=[],a.metadataTracks=[],a.hintTracks=[],a.otherTracks=[],e=0;e0?a.mime+='video/mp4; codecs="':a.audioTracks&&a.audioTracks.length>0?a.mime+='audio/mp4; codecs="':a.mime+='application/mp4; codecs="',e=0;e=i.samples.length)&&(a.info("ISOFile","Sending fragmented data on track #"+s.id+" for samples ["+Math.max(0,i.nextSample-s.nb_samples)+","+(i.nextSample-1)+"]"),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(s.id,s.user,s.segmentStream.buffer,i.nextSample,e||i.nextSample>=i.samples.length),s.segmentStream=null,s!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=i.samples.length)&&(a.debug("ISOFile","Sending samples on track #"+o.id+" for sample "+i.nextSample),this.onSamples&&this.onSamples(o.id,o.user,o.samples),o.samples=[],o!==this.extractedTracks[t]))break}}}},y.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},y.prototype.getBoxes=function(e,t){var i=[];return y._sweep.call(this,e,i,t),i},y._sweep=function(e,t,i){for(var s in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&i)return;y._sweep.call(this.boxes[s],e,t,i)}},y.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},y.prototype.getTrackSample=function(e,t){var i=this.getTrackById(e);return this.getSample(i,t)},y.prototype.releaseUsedSamples=function(e,t,i){var s=0,r=this.getTrackById(e);r.lastValidSample||(r.lastValidSample=0);for(var o=r.lastValidSample;oe*r.timescale){d=s-1;break}t&&r.is_sync&&(l=s)}for(t&&(d=l),e=i.samples[d].cts,i.nextSample=d;i.samples[d].alreadyRead===i.samples[d].size&&i.samples[d+1];)d++;return o=i.samples[d].offset+i.samples[d].alreadyRead,a.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+i.nextSample+" on track "+i.tkhd.track_id+", time "+a.getDurationString(e,n)+" and offset: "+o),{offset:o,time:e/n}},y.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},y.prototype.seek=function(e,t){var i,s,r,o=this.moov,n={offset:1/0,time:1/0};if(this.moov){for(r=0;rthis.getTrackDuration(i)||((s=this.seekTrack(e,t,i)).offset-1){a=l;break}switch(a){case"Visual":if(r.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),o.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var c=new u.avcCBox;c.parse(new n(t.avcDecoderConfigRecord)),o.addBox(c)}else if(t.hevcDecoderConfigRecord){var p=new u.hvcCBox;p.parse(new n(t.hevcDecoderConfigRecord)),o.addBox(p)}break;case"Audio":r.add("smhd").set("balance",t.balance||0),o.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":r.add("hmhd");break;case"Subtitle":if(r.add("sthd"),"stpp"===t.type)o.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:r.add("nmhd")}t.description&&o.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){o.addBox(e)})),r.add("dinf").add("dref").addEntry((new u["url Box"]).set("flags",1));var f=r.add("stbl");return f.add("stsd").addEntry(o),f.add("stts").set("sample_counts",[]).set("sample_deltas",[]),f.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),f.add("stco").set("chunk_offsets",[]),f.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(i),t.id}},u.Box.prototype.computeSize=function(e){var t=e||new l;t.endianness=l.BIG_ENDIAN,this.write(t)},y.prototype.addSample=function(e,t,i){var s=i||{},r={},o=this.getTrackById(e);if(null!==o){r.number=o.samples.length,r.track_id=o.tkhd.track_id,r.timescale=o.mdia.mdhd.timescale,r.description_index=s.sample_description_index?s.sample_description_index-1:0,r.description=o.mdia.minf.stbl.stsd.entries[r.description_index],r.data=t,r.size=t.byteLength,r.alreadyRead=r.size,r.duration=s.duration||1,r.cts=s.cts||0,r.dts=s.dts||0,r.is_sync=s.is_sync||!1,r.is_leading=s.is_leading||0,r.depends_on=s.depends_on||0,r.is_depended_on=s.is_depended_on||0,r.has_redundancy=s.has_redundancy||0,r.degradation_priority=s.degradation_priority||0,r.offset=0,r.subsamples=s.subsamples,o.samples.push(r),o.samples_size+=r.size,o.samples_duration+=r.duration,void 0===o.first_dts&&(o.first_dts=s.dts),this.processSamples();var a=this.createSingleSampleMoof(r);return this.addBox(a),a.computeSize(),a.trafs[0].truns[0].data_offset=a.size+8,this.add("mdat").data=new Uint8Array(t),r}},y.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var i=new u.moofBox;i.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var s=i.add("traf"),r=this.getTrackById(e.track_id);return s.add("tfhd").set("track_id",e.track_id).set("flags",u.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),s.add("tfdt").set("baseMediaDecodeTime",e.dts-(r.first_dts||0)),s.add("trun").set("flags",u.TRUN_FLAGS_DATA_OFFSET|u.TRUN_FLAGS_DURATION|u.TRUN_FLAGS_SIZE|u.TRUN_FLAGS_FLAGS|u.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),i},y.prototype.lastMoofIndex=0,y.prototype.samplesDataSize=0,y.prototype.resetTables=function(){var e,t,i,s,r,o;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(l=r[a].grouping_type+"/0",(n=new d(r[a].grouping_type,0)).is_fragment=!0,t.sample_groups_info[l]||(t.sample_groups_info[l]=n))}else for(a=0;a=2&&(l=s[a].grouping_type+"/0",n=new d(s[a].grouping_type,0),e.sample_groups_info[l]||(e.sample_groups_info[l]=n))},y.setSampleGroupProperties=function(e,t,i,s){var r,o;for(r in t.sample_groups=[],s){var a;if(t.sample_groups[r]={},t.sample_groups[r].grouping_type=s[r].grouping_type,t.sample_groups[r].grouping_type_parameter=s[r].grouping_type_parameter,i>=s[r].last_sample_in_run&&(s[r].last_sample_in_run<0&&(s[r].last_sample_in_run=0),s[r].entry_index++,s[r].entry_index<=s[r].sbgp.entries.length-1&&(s[r].last_sample_in_run+=s[r].sbgp.entries[s[r].entry_index].sample_count)),s[r].entry_index<=s[r].sbgp.entries.length-1?t.sample_groups[r].group_description_index=s[r].sbgp.entries[s[r].entry_index].group_description_index:t.sample_groups[r].group_description_index=-1,0!==t.sample_groups[r].group_description_index)a=s[r].fragment_description?s[r].fragment_description:s[r].description,t.sample_groups[r].group_description_index>0?(o=t.sample_groups[r].group_description_index>65535?(t.sample_groups[r].group_description_index>>16)-1:t.sample_groups[r].group_description_index-1,a&&o>=0&&(t.sample_groups[r].description=a.entries[o])):a&&a.version>=2&&a.default_group_description_index>0&&(t.sample_groups[r].description=a.entries[a.default_group_description_index-1])}},y.process_sdtp=function(e,t,i){t&&(e?(t.is_leading=e.is_leading[i],t.depends_on=e.sample_depends_on[i],t.is_depended_on=e.sample_is_depended_on[i],t.has_redundancy=e.sample_has_redundancy[i]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},y.prototype.buildSampleLists=function(){var e,t;for(e=0;eb&&(v++,b<0&&(b=0),b+=o.sample_counts[v]),t>0?(e.samples[t-1].duration=o.sample_deltas[v],e.samples_duration+=e.samples[t-1].duration,k.dts=e.samples[t-1].dts+e.samples[t-1].duration):k.dts=0,a?(t>=_&&(w++,_<0&&(_=0),_+=a.sample_counts[w]),k.cts=e.samples[t].dts+a.sample_offsets[w]):k.cts=k.dts,n?(t==n.sample_numbers[S]-1?(k.is_sync=!0,S++):(k.is_sync=!1,k.degradation_priority=0),d&&d.entries[E].sample_delta+T==t+1&&(k.subsamples=d.entries[E].subsamples,T+=d.entries[E].sample_delta,E++)):k.is_sync=!0,y.process_sdtp(e.mdia.minf.stbl.sdtp,k,k.number),k.degradation_priority=u?u.priority[t]:0,d&&d.entries[E].sample_delta+T==t&&(k.subsamples=d.entries[E].subsamples,T+=d.entries[E].sample_delta),(h.length>0||c.length>0)&&y.setSampleGroupProperties(e,k,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},y.prototype.updateSampleLists=function(){var e,t,i,s,r,o,a,n,l,d,h,c,p,f,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&y.initSampleGroups(c,h,h.sbgps,c.mdia.minf.stbl.sgpds,h.sgpds),t=0;t0?f.dts=c.samples[c.samples.length-2].dts+c.samples[c.samples.length-2].duration:(h.tfdt?f.dts=h.tfdt.baseMediaDecodeTime:f.dts=0,c.first_traf_merged=!0),f.cts=f.dts,g.flags&u.TRUN_FLAGS_CTS_OFFSET&&(f.cts=f.dts+g.sample_composition_time_offset[i]),m=a,g.flags&u.TRUN_FLAGS_FLAGS?m=g.sample_flags[i]:0===i&&g.flags&u.TRUN_FLAGS_FIRST_FLAG&&(m=g.first_sample_flags),f.is_sync=!(m>>16&1),f.is_leading=m>>26&3,f.depends_on=m>>24&3,f.is_depended_on=m>>22&3,f.has_redundancy=m>>20&3,f.degradation_priority=65535&m;var A=!!(h.tfhd.flags&u.TFHD_FLAG_BASE_DATA_OFFSET),b=!!(h.tfhd.flags&u.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),v=!!(g.flags&u.TRUN_FLAGS_DATA_OFFSET),_=0;_=A?h.tfhd.base_data_offset:b||0===t?d.start:n,f.offset=0===t&&0===i?v?_+g.data_offset:_:n,n=f.offset+f.size,(h.sbgps.length>0||h.sgpds.length>0||c.mdia.minf.stbl.sbgps.length>0||c.mdia.minf.stbl.sgpds.length>0)&&y.setSampleGroupProperties(c,f,f.number_in_traf,h.sample_groups_info)}}if(h.subs){c.has_fragment_subsamples=!0;var w=h.first_sample_index;for(t=0;t-1))return null;var o=(i=this.stream.buffers[r]).byteLength-(s.offset+s.alreadyRead-i.fileStart);if(s.size-s.alreadyRead<=o)return a.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-i.fileStart)+" read size: "+(s.size-s.alreadyRead)+" full size: "+s.size+")"),l.memcpy(s.data.buffer,s.alreadyRead,i,s.offset+s.alreadyRead-i.fileStart,s.size-s.alreadyRead),i.usedBytes+=s.size-s.alreadyRead,this.stream.logBufferLevel(),s.alreadyRead=s.size,s;if(0===o)return null;a.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-i.fileStart)+" read size: "+o+" full size: "+s.size+")"),l.memcpy(s.data.buffer,s.alreadyRead,i,s.offset+s.alreadyRead-i.fileStart,o),s.alreadyRead+=o,i.usedBytes+=o,this.stream.logBufferLevel()}},y.prototype.releaseSample=function(e,t){var i=e.samples[t];return i.data?(this.samplesDataSize-=i.size,i.data=null,i.description=null,delete i.degradation_priority,delete i.depends_on,delete i.description_index,delete i.has_redundancy,delete i.is_depended_on,delete i.is_leading,delete i.is_sync,delete i.moof_number,delete i.number_in_traf,delete i.timescale,delete i.cts,delete i.dts,delete i.offset,delete i.size,delete i.track_id,delete i.duration,i.alreadyRead=0,i.size):0},y.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},y.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},y.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(i.protection=o.ipro.protections[o.iinf.item_infos[e].protection_index-1]),o.iinf.item_infos[e].item_type?i.type=o.iinf.item_infos[e].item_type:i.type="mime",i.content_type=o.iinf.item_infos[e].content_type,i.content_encoding=o.iinf.item_infos[e].content_encoding;if(o.grpl)for(e=0;e0&&u.property_index-1-1))return null;var n=(t=this.stream.buffers[o]).byteLength-(r.offset+r.alreadyRead-t.fileStart);if(!(r.length-r.alreadyRead<=n))return a.debug("ISOFile","Getting item #"+e+" extent #"+s+" partial data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-t.fileStart)+" read size: "+n+" full extent size: "+r.length+" full item size: "+i.size+")"),l.memcpy(i.data.buffer,i.alreadyRead,t,r.offset+r.alreadyRead-t.fileStart,n),r.alreadyRead+=n,i.alreadyRead+=n,t.usedBytes+=n,this.stream.logBufferLevel(),null;a.debug("ISOFile","Getting item #"+e+" extent #"+s+" data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-t.fileStart)+" read size: "+(r.length-r.alreadyRead)+" full extent size: "+r.length+" full item size: "+i.size+")"),l.memcpy(i.data.buffer,i.alreadyRead,t,r.offset+r.alreadyRead-t.fileStart,r.length-r.alreadyRead),t.usedBytes+=r.length-r.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead+=r.length-r.alreadyRead,r.alreadyRead=r.length}}return i.alreadyRead===i.size?i:null},y.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var i=0;i0?this.moov.traks[e].samples[0].duration:0),t.push(s)}return t},y.prototype.getPerformanceInfo=function(){var e={};return e.moov=this.moov,this.moov&&this.moov.traks&&this.moov.traks.length>1&&(e.moovAudioNum=this.moov.traks[0].samples.length,e.moovVideoNum=this.moov.traks[1].samples.length),e},u.Box.prototype.printHeader=function(e){this.size+=8,this.size>d&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},u.FullBox.prototype.printHeader=function(e){this.size+=4,u.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},u.Box.prototype.print=function(e){this.printHeader(e)},u.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},u.tkhdBox.prototype.print=function(e){u.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var A={createFile:function(e,t){var i=void 0===e||e,s=new y(t);return s.discardMdatData=!i,s}};t.createFile=A.createFile}));function Ah(e){return e.reduce(((e,t)=>256*e+t))}function bh(e){const t=[101,103,119,99],i=e.length-28,s=e.slice(i,i+t.length);return t.every(((e,t)=>e===s[t]))}yh.Log,yh.MP4BoxStream,yh.DataStream,yh.MultiBufferStream,yh.MPEG4DescriptorParser,yh.BoxParser,yh.XMLSubtitlein4Parser,yh.Textin4Parser,yh.ISOFile,yh.createFile;class vh{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(i+32,i+32+t))]}return null}(t,this.t);if(!i)return e;const s=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(s instanceof Error)return console.error(s.message),this.d=!0,e;this.A=!0,this.u=i[1],bh(t)&&this.c++,WebAssembly.instantiate(i[2],s).then((e=>{if(!function(e){return"function"==typeof e.parse&&"object"==typeof e.memory}(e.instance.exports))return this.d=!0,void console.error("video_error_3");this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}class _h extends ih{constructor(e){super(e),this.TAG_NAME="Fmp4Loader",this.player=e,this.mp4Box=yh.createFile(),this.tempFmp4List=[],this.offset=0,this.videoTrackId=null,this.audioTrackId=null,this.isHevc=!1,this.transportDescarmber=null,this.player._opt.isFmp4Private&&(this.transportDescarmber=new vh),this._listenMp4Box(),e.debugLog(this.TAG_NAME,"init")}destroy(){this.mp4Box&&(this.mp4Box.stop(),this.mp4Box.flush(),this.mp4Box.destroy(),this.mp4Box=null),this.transportDescarmber&&(this.transportDescarmber.destroy(),this.transportDescarmber=null),this.tempFmp4List=[],this.offset=0,this.videoTrackId=null,this.audioTrackId=null,this.isHevc=!1,this.player.debugLog(this.TAG_NAME,"destroy")}_listenMp4Box(){this.mp4Box.onReady=this.onReady.bind(this),this.mp4Box.onError=this.onError.bind(this),this.mp4Box.onSamples=this.onSamples.bind(this)}onReady(e){this.player.debugLog(this.TAG_NAME,"onReady",e);const t=e.videoTracks[0],i=e.audioTracks[0];if(t){this.videoTrackId=t.id;const e=this.getSeqHeader(t);e&&(this.player.debugLog(this.TAG_NAME,"seqHeader",e),this._doDecodeByFmp4(e,Oe,0,!0,0)),this.mp4Box.setExtractionOptions(t.id)}if(i&&this.player._opt.hasAudio){this.audioTrackId=i.id;const e=i.audio||{},t=Ur.indexOf(e.sample_rate),s=i.codec.replace("mp4a.40.","");this.mp4Box.setExtractionOptions(i.id);const r={profile:parseInt(s,10),sampleRate:t,channel:e.channel_count},o=Or(r);this.player.debugLog(this.TAG_NAME,"aacADTSHeader",o,"config",r),this._doDecodeByFmp4(o,Ue,0,!1,0)}this.mp4Box.start()}onError(e){this.player.debugError(this.TAG_NAME,"mp4Box onError",e)}onSamples(e,t,i){if(e===this.videoTrackId){for(const e of i){const t=e.data,i=e.is_sync,s=1e3*e.cts/e.timescale;e.duration,e.timescale,this.player.updateStats({vbps:t.byteLength,dts:s}),i&&this.calcIframeIntervalTimestamp(s);let r=null;r=this.isHevc?Xn(t,i):On(t,i);let o=this.cryptoPayload(r,i);this._doDecodeByFmp4(o,Oe,s,i,0)}this.mp4Box.removeUsedSamples(e)}else if(e===this.audioTrackId){if(this.player._opt.hasAudio){for(const e of i){const t=e.data;this.player.updateStats({abps:t.byteLength});const i=1e3*e.cts/e.timescale;e.duration,e.timescale;const s=new Uint8Array(t.byteLength+2);s.set([175,1],0),s.set(t,2),this._doDecodeByFmp4(s,Ue,i,!1,0)}this.mp4Box.removeUsedSamples(e)}}else this.player.debugWarn(this.TAG_NAME,"onSamples() trackId error",e)}getSeqHeader(e){const t=this.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new yh.DataStream(void 0,0,yh.DataStream.BIG_ENDIAN);let i=[];e.avcC?(e.avcC.write(t),i=[23,0,0,0,0]):(this.isHevc=!0,e.hvcC.write(t),i=[28,0,0,0,0]);const s=new Uint8Array(t.buffer,8),r=new Uint8Array(i.length+s.length);return r.set(i,0),r.set(s,i.length),r}return null}dispatch(e){let t=new Uint8Array(e);this.transportDescarmber&&(t=this.transportDescarmber.transport(t)),t.buffer.fileStart=this.offset,this.offset+=t.byteLength,this.mp4Box.appendBuffer(t.buffer)}downloadFmp4File(){const e=new Blob(this.tempFmp4List,{type:'video/mp4; codecs="avc1.640028,mp4a.40.2"'}),t=URL.createObjectURL(e),i=document.createElement("a");i.href=t,i.download=oo()+".fmp4",i.click(),URL.revokeObjectURL(t)}getInputByteLength(){let e=0;return this.mp4Box&&(e=this.mp4Box.getAllocatedSampleDataSize()),e}}class wh extends ih{constructor(e){super(e),ph(this,"LOG_NAME","Mpeg4Loader"),this.player=e,this.player.debugLog(this.LOG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.LOG_NAME,"destroy")}}function Sh(){for(var e=arguments.length,t=new Array(e),i=0;ie+t.byteLength),0));let r=0;return t.forEach((e=>{s.set(e,r),r+=e.byteLength})),s}const Eh=3,Th=4,kh=6,Lh=15,Ch=17,xh=129,Dh=135,Rh=21,Ph=134,Ih=27,Bh=36;class Mh{constructor(){this.slices=[],this.total_length=0,this.expected_length=0,this.random_access_indicator=0}}class Fh{constructor(){this.pid=null,this.data=null,this.stream_type=null,this.random_access_indicator=null}}class Uh{constructor(){this.pid=null,this.stream_id=null,this.len=null,this.data=null,this.pts=null,this.nearest_pts=null,this.dts=null}}const Oh=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];class Nh{constructor(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}isComplete(){let e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&null!=this.sarDen;return null!=this.mimeType&&e&&t}isSeekable(){return!0===this.hasKeyframesIndex}getNearestKeyframe(e){if(null==this.keyframesIndex)return null;let t=this.keyframesIndex,i=this._search(t.times,e);return{index:i,milliseconds:t.times[i],fileposition:t.filepositions[i]}}_search(e,t){let i=0,s=e.length-1,r=0,o=0,a=s;for(t=e[r]&&t=6?(s=5,t=new Array(4),a=r-3):(s=2,t=new Array(2),a=r):-1!==n.indexOf("android")?(s=2,t=new Array(2),a=r):(s=5,a=r,t=new Array(4),r>=6?a=r-3:1===o&&(s=2,t=new Array(2),a=r)),t[0]=s<<3,t[0]|=(15&r)>>>1,t[1]=(15&r)<<7,t[1]|=(15&o)<<3,5===s&&(t[1]|=(15&a)>>>1,t[2]=(1&a)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=Oh[r],this.sampling_index=r,this.channel_count=o,this.object_type=s,this.original_object_type=i,this.codec_mimetype="mp4a.40."+s,this.original_codec_mimetype="mp4a.40."+i}}class Gh extends ih{constructor(e){super(e),this.player=e,this.TAG_NAME="TsLoader",this.first_parse_=!0,this.tsPacketSize=0,this.syncOffset=0,this.pmt_=null,this.config_=null,this.media_info_=new Nh,this.timescale_=90,this.duration_=0,this.pat_={version_number:0,network_pid:0,program_map_pid:{}},this.current_program_=null,this.current_pmt_pid_=-1,this.program_pmt_map_={},this.pes_slice_queues_={},this.section_slice_queues_={},this.video_metadata_={vps:null,sps:null,pps:null,details:null},this.audio_metadata_={codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},this.last_pcr_=null,this.last_pcr_base_=NaN,this.timestamp_offset_=0,this.audio_last_sample_pts_=void 0,this.aac_last_incomplete_data_=null,this.has_video_=!1,this.has_audio_=!1,this.video_init_segment_dispatched_=!1,this.audio_init_segment_dispatched_=!1,this.video_metadata_changed_=!1,this.audio_metadata_changed_=!1,this.loas_previous_frame=null,this.video_track_={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this.audio_track_={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._remainingPacketData=null,this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.media_info_=null,this.pes_slice_queues_=null,this.section_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,this._remainingPacketData=null,super.destroy()}probe(e){let t=new Uint8Array(e),i=-1,s=188;if(t.byteLength<=3*s)return{needMoreData:!0};for(;-1===i;){let e=Math.min(1e3,t.byteLength-3*s);for(let r=0;r=4&&(i-=4),{match:!0,consumed:0,ts_packet_size:s,sync_offset:i})}_initPmt(){return{program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}}dispatch(e){let t=new Uint8Array(e);this._remainingPacketData&&(t=Sh(this._remainingPacketData,t),this._remainingPacketData=null);let i=t.buffer;const s=this.parseChunks(i);s?this._remainingPacketData=t.subarray(s):t.length>>6;i[1];let o=(31&i[1])<<8|i[2],a=(48&i[3])>>>4,n=15&i[3],l=!(!this.pmt_||this.pmt_.pcr_pid!==o),d={},h=4;if(2==a||3==a){let e=i[4];if(e>0&&(l||3==a)){if(d.discontinuity_indicator=(128&i[5])>>>7,d.random_access_indicator=(64&i[5])>>>6,d.elementary_stream_priority_indicator=(32&i[5])>>>5,(16&i[5])>>>4){let e=300*this._getPcrBase(i)+((1&i[10])<<8|i[11]);this.last_pcr_=e}}if(2==a||5+e===188){t+=188,204===this.tsPacketSize&&(t+=16);continue}h=5+e}if(1==a||3==a)if(0===o||o===this.current_pmt_pid_||null!=this.pmt_&&this.pmt_.pid_stream_type[o]===Ph){let i=188-h;this.handleSectionSlice(e,t+h,i,{pid:o,payload_unit_start_indicator:r,continuity_conunter:n,random_access_indicator:d.random_access_indicator})}else if(null!=this.pmt_&&null!=this.pmt_.pid_stream_type[o]){let i=188-h,s=this.pmt_.pid_stream_type[o];o!==this.pmt_.common_pids.h264&&o!==this.pmt_.common_pids.h265&&o!==this.pmt_.common_pids.adts_aac&&o!==this.pmt_.common_pids.loas_aac&&o!==this.pmt_.common_pids.ac3&&o!==this.pmt_.common_pids.eac3&&o!==this.pmt_.common_pids.opus&&o!==this.pmt_.common_pids.mp3&&!0!==this.pmt_.pes_private_data_pids[o]&&!0!==this.pmt_.timed_id3_pids[o]&&!0!==this.pmt_.synchronous_klv_pids[o]&&!0!==this.pmt_.asynchronous_klv_pids[o]||this.handlePESSlice(e,t+h,i,{pid:o,stream_type:s,payload_unit_start_indicator:r,continuity_conunter:n,random_access_indicator:d.random_access_indicator})}t+=188,204===this.tsPacketSize&&(t+=16)}return this.dispatchAudioVideoMediaSegment(),t}handleSectionSlice(e,t,i,s){let r=new Uint8Array(e,t,i),o=this.section_slice_queues_[s.pid];if(s.payload_unit_start_indicator){let a=r[0];if(null!=o&&0!==o.total_length){let r=new Uint8Array(e,t+1,Math.min(i,a));o.slices.push(r),o.total_length+=r.byteLength,o.total_length===o.expected_length?this.emitSectionSlices(o,s):this.clearSlices(o,s)}for(let n=1+a;n=o.expected_length&&this.clearSlices(o,s),n+=l.byteLength}}else if(null!=o&&0!==o.total_length){let r=new Uint8Array(e,t,Math.min(i,o.expected_length-o.total_length));o.slices.push(r),o.total_length+=r.byteLength,o.total_length===o.expected_length?this.emitSectionSlices(o,s):o.total_length>=o.expected_length&&this.clearSlices(o,s)}}handlePESSlice(e,t,i,s){let r=new Uint8Array(e,t,i),o=r[0]<<16|r[1]<<8|r[2];r[3];let a=r[4]<<8|r[5];if(s.payload_unit_start_indicator){if(1!==o)return void this.player.debugWarn(this.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${o}`);let e=this.pes_slice_queues_[s.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?this.emitPESSlices(e,s):this.clearSlices(e,s)),this.pes_slice_queues_[s.pid]=new Mh,this.pes_slice_queues_[s.pid].random_access_indicator=s.random_access_indicator}if(null==this.pes_slice_queues_[s.pid])return;let n=this.pes_slice_queues_[s.pid];n.slices.push(r),s.payload_unit_start_indicator&&(n.expected_length=0===a?0:a+6),n.total_length+=r.byteLength,n.expected_length>0&&n.expected_length===n.total_length?this.emitPESSlices(n,s):n.expected_length>0&&n.expected_length>>6,n=t[8];2!==a&&3!==a||(i=this._getTimestamp(t,9),o=3===a?this._getTimestamp(t,14):i);let l,d=9+n;if(0!==r){if(r<3+n)return void this.player.debugWarn(this.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");l=r-3-n}else l=t.byteLength-d;let h=t.subarray(d,d+l);switch(e.stream_type){case Eh:case Th:this.parseMP3Payload(h,i);break;case kh:this.pmt_.common_pids.opus===e.pid?this.parseOpusPayload(h,i):this.pmt_.common_pids.ac3===e.pid?this.parseAC3Payload(h,i):this.pmt_.common_pids.eac3===e.pid?this.parseEAC3Payload(h,i):this.pmt_.asynchronous_klv_pids[e.pid]?this.parseAsynchronousKLVMetadataPayload(h,e.pid,s):this.pmt_.smpte2038_pids[e.pid]?this.parseSMPTE2038MetadataPayload(h,i,o,e.pid,s):this.parsePESPrivateDataPayload(h,i,o,e.pid,s);break;case Lh:this.parseADTSAACPayload(h,i);break;case Ch:this.parseLOASAACPayload(h,i);break;case xh:this.parseAC3Payload(h,i);break;case Dh:this.parseEAC3Payload(h,i);break;case Rh:this.pmt_.timed_id3_pids[e.pid]?this.parseTimedID3MetadataPayload(h,i,o,e.pid,s):this.pmt_.synchronous_klv_pids[e.pid]&&this.parseSynchronousKLVMetadataPayload(h,i,o,e.pid,s);break;case Ih:this.parseH264Payload(h,i,o,e.random_access_indicator);break;case Bh:this.parseH265Payload(h,i,o,e.random_access_indicator)}}else if((188===s||191===s||240===s||241===s||255===s||242===s||248===s)&&e.stream_type===kh){let i,o=6;i=0!==r?r:t.byteLength-o;let a=t.subarray(o,o+i);this.parsePESPrivateDataPayload(a,void 0,void 0,e.pid,s)}}else this.player.debugError(this.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${i}`)}parsePAT(e){let t=e[0];if(0!==t)return void Log.e(this.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let i=(15&e[1])<<8|e[2];e[3],e[4];let s=(62&e[5])>>>1,r=1&e[5],o=e[6];e[7];let a=null;if(1===r&&0===o)a={version_number:0,network_pid:0,program_pmt_pid:{}},a.version_number=s;else if(a=this.pat_,null==a)return;let n=i-5-4,l=-1,d=-1;for(let t=8;t<8+n;t+=4){let i=e[t]<<8|e[t+1],s=(31&e[t+2])<<8|e[t+3];0===i?a.network_pid=s:(a.program_pmt_pid[i]=s,-1===l&&(l=i),-1===d&&(d=s))}1===r&&0===o&&(null==this.pat_&&this.player.debugLog(this.TAG_NAME,`Parsed first PAT: ${JSON.stringify(a)}`),this.pat_=a,this.current_program_=l,this.current_pmt_pid_=d)}parsePMT(e){let t=e[0];if(2!==t)return void this.player.debugError(this.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let i,s=(15&e[1])<<8|e[2],r=e[3]<<8|e[4],o=(62&e[5])>>>1,a=1&e[5],n=e[6];if(e[7],1===a&&0===n)i=this._initPmt(),i.program_number=r,i.version_number=o,this.program_pmt_map_[r]=i;else if(i=this.program_pmt_map_[r],null==i)return;i.pcr_pid=(31&e[8])<<8|e[9];let l=(15&e[10])<<8|e[11],d=12+l,h=s-9-l-4;for(let t=d;t0){for(let s=t+5;s0)for(let s=t+5;s1&&(this.player.debugWarn(this.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${s}ms`),s=e)}}let r,o=new Yr(e),a=null,n=s;for(;null!=(a=o.readNextAACFrame());){i=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},this.dispatchAudioInitSegment(e)):this.detectAudioMetadataChange(e)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(e)),r=n;let t=Math.floor(n);const s=new Uint8Array(a.data.length+2);s.set([175,1],0),s.set(a.data,2);let o={payload:s,length:s.byteLength,pts:t,dts:t,type:Ue};this.audio_track_.samples.push(o),this.audio_track_.length+=s.byteLength,n+=i}o.hasIncompleteData()&&(this.aac_last_incomplete_data_=o.getIncompleteData()),r&&(this.audio_last_sample_pts_=r)}parseLOASAACPayload(e,t){if(this.has_video_&&!this.video_init_segment_dispatched_)return;if(this.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);t.set(this.aac_last_incomplete_data_,0),t.set(e,this.aac_last_incomplete_data_.byteLength),e=t}let i,s;if(null!=t&&(s=t/this.timescale_),"aac"===this.audio_metadata_.codec){if(null==t&&null!=this.audio_last_sample_pts_)i=1024/this.audio_metadata_.sampling_frequency*1e3,s=this.audio_last_sample_pts_+i;else if(null==t)return void this.player.debugWarn(this.TAG_NAME,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.audio_last_sample_pts_){i=1024/this.audio_metadata_.sampling_frequency*1e3;let e=this.audio_last_sample_pts_+i;Math.abs(e-s)>1&&(this.player.debugWarn(this.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${s}ms`),s=e)}}let r,o=new Qr(e),a=null,n=s;for(;null!=(a=o.readNextAACFrame(Io(this.loas_previous_frame)?void 0:this.loas_previous_frame));){this.loas_previous_frame=a,i=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},this.dispatchAudioInitSegment(e)):this.detectAudioMetadataChange(e)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(e)),r=n;let t=Math.floor(n);const s=new Uint8Array(a.data.length+2);s.set([175,1],0),s.set(a.data,2);let o={payload:s,length:s.byteLength,pts:t,dts:t,type:Ue};this.audio_track_.samples.push(o),this.audio_track_.length+=s.byteLength,n+=i}o.hasIncompleteData()&&(this.aac_last_incomplete_data_=o.getIncompleteData()),r&&(this.audio_last_sample_pts_=r)}parseAC3Payload(e,t){}parseEAC3Payload(e,t){}parseOpusPayload(e,t){}parseMP3Payload(e,t){if(this.has_video_&&!this.video_init_segment_dispatched_)return;let i=[44100,48e3,32e3,0],s=[22050,24e3,16e3,0],r=[11025,12e3,8e3,0],o=e[1]>>>3&3,a=(6&e[1])>>1;e[2];let n=(12&e[2])>>>2,l=3!==(e[3]>>>6&3)?2:1,d=0,h=34;switch(o){case 0:d=r[n];break;case 2:d=s[n];break;case 3:d=i[n]}switch(a){case 1:h=34;break;case 2:h=33;break;case 3:h=32}const c={};c.object_type=h,c.sample_rate=d,c.channel_count=l,c.data=e;const u={codec:"mp3",data:c};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"mp3",object_type:h,sample_rate:d,channel_count:l},this.dispatchAudioInitSegment(u)):this.detectAudioMetadataChange(u)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(u));let p={payload:e,length:e.byteLength,pts:t/this.timescale_,dts:t/this.timescale_,type:Ue};this.audio_track_.samples.push(p),this.audio_track_.length+=e.byteLength}detectAudioMetadataChange(e){if(e.codec!==this.audio_metadata_.codec)return this.player.debugLog(this.TAG_NAME,`Audio: Audio Codecs changed from ${this.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===this.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==this.audio_metadata_.audio_object_type)return this.player.debugLog(this.TAG_NAME,`AAC: AudioObjectType changed from ${this.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==this.audio_metadata_.sampling_freq_index)return this.player.debugLog(this.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${this.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==this.audio_metadata_.channel_config)return this.player.debugLog(this.TAG_NAME,`AAC: Channel configuration changed from ${this.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===this.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==this.audio_metadata_.sampling_frequency)return this.player.debugLog(this.TAG_NAME,`AC3: Sampling Frequency changed from ${this.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==this.audio_metadata_.bit_stream_identification)return this.player.debugLog(this.TAG_NAME,`AC3: Bit Stream Identification changed from ${this.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==this.audio_metadata_.bit_stream_mode)return this.player.debugLog(this.TAG_NAME,`AC3: BitStream Mode changed from ${this.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==this.audio_metadata_.channel_mode)return this.player.debugLog(this.TAG_NAME,`AC3: Channel Mode changed from ${this.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==this.audio_metadata_.low_frequency_effects_channel_on)return this.player.debugLog(this.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${this.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===this.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==this.audio_metadata_.sample_rate)return this.player.debugLog(this.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==this.audio_metadata_.channel_count)return this.player.debugLog(this.TAG_NAME,`Opus: Channel count changed from ${this.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===this.audio_metadata_.codec){const t=e.data;if(t.object_type!==this.audio_metadata_.object_type)return this.player.debugLog(this.TAG_NAME,`MP3: AudioObjectType changed from ${this.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==this.audio_metadata_.sample_rate)return this.player.debugLog(this.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==this.audio_metadata_.channel_count)return this.player.debugLog(this.TAG_NAME,`MP3: Channel count changed from ${this.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1}dispatchAudioInitSegment(e){let t={type:"audio"};t.id=this.audio_track_.id,t.timescale=1e3,t.duration=this.duration_;let i="";if("aac"===this.audio_metadata_.codec){let s="aac"===e.codec?e.data:null,r=new jh(s);t.audioSampleRate=r.sampling_rate,t.audioSampleRateIndex=r.sampling_index,t.channelCount=r.channel_count,t.codec=r.codec_mimetype,t.originalCodec=r.original_codec_mimetype,t.config=r.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale,i=wt;const o=Or({profile:this.player._opt.mseDecodeAudio?r.object_type:r.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});console.error("aacADTSHeader",`profile: ${r.object_type}, sampleRate: ${t.audioSampleRateIndex}, channel: ${t.channelCount}`),this._doDecodeByTs(o,Ue,0,!1,0)}else"ac-3"===this.audio_metadata_.codec||"ec-3"===this.audio_metadata_.codec||"opus"===this.audio_metadata_.codec||"mp3"===this.audio_metadata_.codec&&(t.audioSampleRate=this.audio_metadata_.sample_rate,t.channelCount=this.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0,i=Et);0==this.audio_init_segment_dispatched_&&this.player.debugLog(this.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;let s=this.media_info_;s.hasAudio=!0,s.audioCodec=t.originalCodec,s.audioSampleRate=t.audioSampleRate,s.audioChannelCount=t.channelCount,s.hasVideo&&s.videoCodec?s.mimeType=`video/mp2t; codecs="${s.videoCodec},${s.audioCodec}"`:s.mimeType=`video/mp2t; codecs="${s.audioCodec}"`,i&&this.player.audio.updateAudioInfo({encTypeCode:i,channels:t.channelCount,sampleRate:t.audioSampleRate})}dispatchPESPrivateDataDescriptor(e,t,i){}parsePESPrivateDataPayload(e,t,i,s,r){let o=new Uh;if(o.pid=s,o.stream_id=r,o.len=e.byteLength,o.data=e,null!=t){let e=Math.floor(t/this.timescale_);o.pts=e}else o.nearest_pts=this.getNearestTimestampMilliseconds();if(null!=i){let e=Math.floor(i/this.timescale_);o.dts=e}}parseTimedID3MetadataPayload(e,t,i,s,r){this.player.debugLog(this.TAG_NAME,`Timed ID3 Metadata: pid=${s}, pts=${t}, dts=${i}, stream_id=${r}`)}parseSynchronousKLVMetadataPayload(e,t,i,s,r){this.player.debugLog(this.TAG_NAME,`Synchronous KLV Metadata: pid=${s}, pts=${t}, dts=${i}, stream_id=${r}`)}parseAsynchronousKLVMetadataPayload(e,t,i){this.player.debugLog(this.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${i}`)}parseSMPTE2038MetadataPayload(e,t,i,s,r){this.player.debugLog(this.TAG_NAME,`SMPTE 2038 Metadata: pid=${s}, pts=${t}, dts=${i}, stream_id=${r}`)}getNearestTimestampMilliseconds(){if(null!=this.audio_last_sample_pts_)return Math.floor(this.audio_last_sample_pts_);if(null!=this.last_pcr_){return Math.floor(this.last_pcr_/300/this.timescale_)}}_preDoDecode(){const e=this.video_track_,t=this.audio_track_;let i=e.samples;t.samples.length>0&&(i=e.samples.concat(t.samples),i=i.sort(((e,t)=>e.dts-t.dts))),i.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===Oe?this._doDecodeVideo({...e,payload:t}):e.type===Ue&&this._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0}_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?Xn(t,e.isIFrame):On(t,e.isIFrame),this.player.updateStats({dts:e.dts,vbps:i.byteLength}),e.isIFrame&&this.calcIframeIntervalTimestamp(e.dts);let s=this.cryptoPayload(i,e.isIFrame);this._doDecodeByTs(s,Oe,e.dts,e.isIFrame,e.cts)}_doDecodeAudio(e){const t=new Uint8Array(e.payload);this.player.updateStats({abps:t.byteLength});let i=this.cryptoPayloadAudio(t);this._doDecodeByTs(i,Ue,e.dts,!1,0)}getInputByteLength(){return this._remainingPacketData&&this._remainingPacketData.byteLength||0}_getPcrBase(e){let t=33554432*e[6]+131072*e[7]+512*e[8]+2*e[9]+(128&e[10])/128+this.timestamp_offset_;return t+4294967296>>3&3,r=(6&t[1])>>1,o=(240&t[2])>>>4,a=(12&t[2])>>>2,n=3!==(t[3]>>>6&3)?2:1,l=0,d=0;switch(s){case 0:l=Vh[a];break;case 2:l=$h[a];break;case 3:l=zh[a]}switch(r){case 1:o{this._clearAudioSourceBufferCheckTimeout(),this.player.emit(dt.webcodecsAudioInitTimeout)}),1e3)),void oa(e)):void(this.player.isPlayer()?(this.player.updateStats({dfps:!0}),this.player._times.videoStart||(this.player._times.videoStart=oo(),this.player.handlePlayToRenderTimes()),this.player.video.render({videoFrame:e,ts:e.timestamp}),this.player.handleRender()):this.player.isPlayback()&&(this.player.updateStats({dfps:!0}),Aa(this.player.playbackPause)?(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this.player.playback.isUseFpsRender?this.player.video.pushData({videoFrame:e,ts:e.timestamp}):this.player.video.render$2({videoFrame:e,ts:e.timestamp})):this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this.player.playback.isUseFpsRender&&this.player.video.pushData({videoFrame:e,ts:e.timestamp})));oa(e)}handleError(e){this.player.debugError(this.TAG_NAME,"VideoDecoder handleError:",e.code,e);const t=e.toString();-1!==t.indexOf(as)?this.player.emitError(dt.webcodecsUnsupportedConfigurationError,t):-1!==t.indexOf(ns)||-1!==t.indexOf(ls)||-1!==t.indexOf(ds)?this.player.emitError(dt.webcodecsDecodeError,t):-1!==t.indexOf(hs)&&this.player.emitError(dt.webcodecsH265NotSupport,t)}handleDecodeAudio(e){this.player&&(this.player.isDestroyedOrClosed()?this.player.debugWarn(this.TAG_NAME,"decodeVideo() player is destroyed"):this.player.isPlayer()?this.player.audio.play(e,e.timestamp):this.player.isPlayback())}handleErrorAudio(e){this.player.debugError(this.TAG_NAME,"AudioDecoder handleError:",e.code,e)}decodeVideo(e,t,i,s){if(this.player)if(this.player.isDestroyedOrClosed())this.player.debugWarn(this.TAG_NAME,"decodeVideo() player is destroyed");else if(this.hasInit)if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(this.isDecodeStateClosed())return void this.player.debugWarn(this.TAG_NAME,"VideoDecoder isDecodeStateClosed true");if(i&&0===e[1]){const t=15&e[0];let i={};if(t===At){i=Fn(e.slice(5))}else t===bt&&(i=qn(e));const s=this.player.video.videoInfo;s&&s.width&&s.height&&i&&i.codecWidth&&i.codecHeight&&(i.codecWidth!==s.width||i.codecHeight!==s.height)&&(this.player.debugWarn(this.TAG_NAME,`decodeVideo: video width or height is changed,\n old width is ${s.width}, old height is ${s.height},\n new width is ${i.codecWidth}, new height is ${i.codecHeight},\n and emit change event`),this.isWidthOrHeightChanged=!0,this.player.emitError(dt.wcsWidthOrHeightChange,`width ${s.width}->${s.height} height ${i.codecWidth}->${i.codecHeight}`))}if(this.isWidthOrHeightChanged)return void this.player.debugWarn(this.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(ga(e))return void this.player.debugLog(this.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength<12)return void this.player.debugWarn(this.TAG_NAME,`decodeVideo and payload is too small , payload length is ${e.byteLength}`);let s=!1,r=(new Date).getTime();this.prevTimestamp||(this.prevTimestamp=r,s=!0);const o=r-this.prevTimestamp;this.decodeDiffTimestamp=o,o>500&&!s&&this.player.isPlayer()&&this.player.debugWarn(this.TAG_NAME,"decodeVideo diff time is ",o);const a=e.slice(5),n=new EncodedVideoChunk({data:a,timestamp:t,type:i?hi:ci});this.player.emit(at.timeUpdate,t);try{this.decoder.decode(n)}catch(e){this.player.debugError(this.TAG_NAME,"VideoDecoder",e);const t=e.toString();(-1!==t.indexOf(rs)||-1!==t.indexOf(os))&&this.player.emitError(dt.webcodecsDecodeError,t)}this.prevTimestamp=(new Date).getTime()}else this.player.debugLog(this.TAG_NAME,"VideoDecoder first frame is not iFrame");else if(i&&e[1]===As){const t=15&e[0];if(this.player.video.updateVideoInfo({encTypeCode:t}),t===bt&&!xo()){const e=Ao();return this.player.debugWarn(this.TAG_NAME,"WebcodecsDecoder not support hevc decode",e.type,e.version),void this.player.emitError(dt.webcodecsH265NotSupport)}this.player._times.decodeStart||(this.player._times.decodeStart=oo());let i=null,s=null;const r=e.slice(5);if(t===At?(s=Fn(r),i={codec:s.codec,description:r}):t===bt&&(s=Kn(r),i={codec:s.codec,description:r}),!i||i&&!i.codec||s&&0===s.codecWidth&&0===s.codecHeight)return this.player.debugWarn(this.TAG_NAME,"decodeVideo and webcodecs configure is",JSON.stringify(i)),void this.player.emitError(dt.webcodecsDecodeConfigureError,"configure or configure.code is null");i.codedHeight=s.codecHeight,i.codedWidth=s.codecWidth,this.isInitInfo||(this.player.debugLog(this.TAG_NAME,`updateVideoInfo: ${s.codecWidth},${s.codecHeight}`),this.player.video.updateVideoInfo({width:s.codecWidth,height:s.codecHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0),this.player.recorder&&this.player._opt.recordType===S&&this.player.recorder.initMetaData(e,t),this.player.video.bindMediaStream(),this.player.debugLog(this.TAG_NAME,`decoder.configure() and codec is ${i.codec}`);try{i.optimizeForLatency=!0,i.hardwareAcceleration="prefer-hardware",this.decoder.configure(i),this.hasInit=!0}catch(e){this.player.debugError(this.TAG_NAME,"configure error",e.code,e);const t=e.toString();-1!==t.indexOf(hs)?this.player.emitError(dt.webcodecsH265NotSupport,t):this.player.emitError(dt.webcodecsDecodeConfigureError,t)}}else this.player.debugWarn(this.TAG_NAME,`decodeVideo has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)}decodeAudio(e,t){if(this.player)if(this.player.isDestroyedOrClosed())this.player.debugWarn(this.TAG_NAME,"decodeAudio() player is destroyed");else if(this.hasAudioInit){if(Nr(e))return void this.player.debugLog(this.TAG_NAME,"decodeAudio and has already initialized and payload is aac codec packet so drop this frame");if(this._clearAudioNoDataCheckTimeout(),this.isDecodeFirstIIframe){if(this.isAudioDecodeStateClosed())return void this.player.debugWarn(this.TAG_NAME,"AudioDecoder isDecodeStateClosed true");const i=this.isAAC?e.slice(2):e.slice(1),s=i.length/this.player.audio.audioInfo.sampleRate*1e3,r=new EncodedAudioChunk({type:"key",data:i,timestamp:t,duration:parseInt(s,10)});try{this.decoderAudio.decode(r)}catch(e){this.player.debugError(this.TAG_NAME,"AudioDecoder",e),e.toString()}}}else{const t=e[0]>>4,i=e[0]>>1&1,s=t===Et,r=t===wt,o=t===St;let a="";a=r?i?16:8:0===i?8:16;const n={codec:"",numberOfChannels:"",sampleRate:""};let l=null;if(r||s){let t=null;if(Nr(e)){const i=e.slice(2);t=$r(i),t&&(n.codec=t.originalCodec,n.numberOfChannels=t.channelCount,n.sampleRate=t.sampleRate),l=i,this.isAAC=r}else s&&(t=Kh(e),t&&(n.codec=Er,n.numberOfChannels=t.channelCount,n.sampleRate=t.samplingRate))}else n.codec=o?Sr:wr,n.numberOfChannels=1,n.sampleRate=8e3;if(n.codec&&n.numberOfChannels&&n.sampleRate){this.isAudioInitInfo||(this.player.audio.updateAudioInfo({encTypeCode:t,channels:n.numberOfChannels,sampleRate:n.sampleRate,depth:a}),this.isAudioInitInfo=!0),this.player.recorder&&this.player._opt.recordType===S&&l&&this.player.recorder.initAudioAacExtraData(l),this.player.debugLog(this.TAG_NAME,`decoderAudio.configure() and codec is ${n.codec}`);try{this.decoderAudio.configure(n),this._clearAudioSourceBufferCheckTimeout(),this.hasAudioInit=!0,null===this.audioSourceNoDataCheckTimeout&&(this.audioSourceNoDataCheckTimeout=setTimeout((()=>{this._clearAudioNoDataCheckTimeout(),this.player.emit(dt.webcodecsAudioNoDataTimeout)}),1e3))}catch(e){this.player.debugError(this.TAG_NAME,"configure audio error",e.code,e),e.toString()}}}}_clearAudioSourceBufferCheckTimeout(){this.audioSourceBufferCheckTimeout&&(clearTimeout(this.audioSourceBufferCheckTimeout),this.audioSourceBufferCheckTimeout=null)}_clearAudioNoDataCheckTimeout(){this.audioSourceNoDataCheckTimeout&&(clearTimeout(this.audioSourceNoDataCheckTimeout),this.audioSourceNoDataCheckTimeout=null)}getDecodeDiffTimes(){return this.decodeDiffTimestamp}isDecodeStateClosed(){return"closed"===this.decoder.state}isDecodeStateConfigured(){return"configured"===this.decoder.state}isDecodeStateUnConfigured(){return"unconfigured"===this.decoder.state}isAudioDecodeStateClosed(){return"closed"===this.decoderAudio.state}isAudioDecodeStateConfigured(){return"configured"===this.decoderAudio.state}isAudioDecodeStateUnConfigured(){return"unconfigured"===this.decoderAudio.state}}const Qh={play:"播放",pause:"暂停",audio:"",mute:"",screenshot:"截图",loading:"",fullscreen:"全屏",fullscreenExit:"退出全屏",record:"录制",recordStop:"停止录制",narrow:"缩小",expand:"放大",ptz:"操作盘",ptzActive:"操作盘激活",zoom:"电子放大",zoomStop:"关闭电子放大",close:"关闭",performance:"性能面板",performanceActive:"性能面板激活",face:"人脸识别",faceActive:"人脸识别激活",object:"物品识别",objectActive:"物品识别激活",occlusion:"遮挡物检查",occlusionActive:"遮挡物检查激活",logSave:"保存日志"};var Xh=Object.keys(Qh).reduce(((e,t)=>(e[t]=`\n \n ${Qh[t]?`${Qh[t]}`:""}\n`,e)),{});function Zh(e,t){let i=!1;return e.forEach((e=>{i||e.startTimestamp<=t&&e.endTimestamp>t&&(i=!0)})),i}function ec(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=e.length,r=t.length,o=Math.max(s,r),a=2e3,n=Math.ceil(o/a);let l=0,d=0;function h(){let r="",o="";for(let i=0;i\n ${i.title}\n \n `);const a=t[d];a&&(o+=`\n

${a.title}
\n `),d+=1}r&&i.$playbackTimeListOne.insertAdjacentHTML("beforeend",r),o&&i.$playbackTimeListSecond.insertAdjacentHTML("beforeend",o),l+=1,l0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<1440;s++){const r=s%60==0;let o=!1;i&&(o=Zh(e,$o(i,s))),t.push({title:Wo(s),timestamp:s,dataType:"min",hasRecord:o,isStart:r})}return t}(e);ec(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0})}return e}(),t)}function ic(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<1440;s++){let r=60*s,o=r%1800==0,a=!1;i&&(a=Zh(e,Vo(i,r))),t.push({title:zo(r),timestamp:r,dataType:"second",hasRecord:a,isStart:o});let n=60*s+30;o=n%1800==0,i&&(a=Zh(e,Vo(i,n))),t.push({title:zo(n),timestamp:n,dataType:"second",hasRecord:a,isStart:o})}return t}(e);ec(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00",s=t+":30";t<10&&(i="0"+i,s="0"+s),e.push({title:i,hour:t,min:0,second:0}),e.push({title:s,hour:t,min:30,second:0})}return e}(),t)}function sc(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<144;s++)for(let r=0;r<60;r++){let o=10*r+600*s,a=o%600==0,n=!1;i&&(n=Zh(e,Vo(i,o))),t.push({title:zo(o),timestamp:o,dataType:"second",isStart:a,hasRecord:n})}return t}(e);ec(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0});for(let s=1;s<6;s++){let r=s+"0";e.push({title:i.replace(":00",":"+r),hour:t,min:10*s,second:0})}}return e}(),t)}function rc(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<288;s++)for(let r=0;r<60;r++){let o=5*r+300*s,a=o%300==0,n=!1;i&&(n=Zh(e,Vo(i,o))),t.push({title:zo(o),timestamp:o,dataType:"second",isStart:a,hasRecord:n})}return t}(e);ec(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0}),e.push({title:i.replace(":00",":05"),hour:t,min:5,second:0});for(let s=1;s<6;s++){let r=s+"0",o=s+"5";e.push({title:i.replace(":00",":"+r),hour:t,min:10*s,second:0}),e.push({title:i.replace(":00",":"+o),hour:t,min:10*s+5,second:0})}}return e}(),t)}function oc(e){const t=Math.floor(e/3600),i=Math.floor((e-3600*t)/60),s=Math.floor(e-3600*t-60*i);return(t>0?[t,i,s]:[i,s]).map((e=>e<10?`0${e}`:String(e))).join(":")}function ac(e,t,i){const s=e.$playbackProgress,{left:r}=s.getBoundingClientRect(),o=ao((fo()?i.touches[0].clientX:i.pageX)-r,0,s.clientWidth),a=parseInt(o/s.clientWidth*t,10);return{second:a,time:oc(a),width:o,percentage:ao(o/s.clientWidth,0,1)}}function nc(e,t){return e.classList.add(t)}function lc(e,t){return t instanceof Element?e.appendChild(t):e.insertAdjacentHTML("beforeend",String(t)),e.lastElementChild||e.lastChild}function dc(e,t,i){return e&&e.style&&Mo(t)&&(e.style[t]=i),e}function hc(e,t){return e.composedPath&&e.composedPath().indexOf(t)>-1}function cc(e){let t=!1;return e&&e.parentNode&&(e.parentNode.removeChild(e),t=!0),t}var uc=(e,t)=>{const{events:{proxy:i}}=e;let s=null,r=null,o=null,a=null;if(e._opt.listenWindowResizeAuoResize){s=document.createElement("object"),r=`jb-pro-object-${ua()}`,s.setAttribute("aria-hidden","true"),s.setAttribute("tabindex",-1),s.setAttribute("id",r),s.type="text/html",s.data="about:blank",no(s,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"}),o=e.width,a=e.height;const t=To((()=>{e.width===o&&e.height===a||(o=e.width,a=e.height,e.emit(at.resize))}),500);i(s,"load",(()=>{i(s.contentDocument.defaultView,"resize",(()=>{t()}))})),e.$container.appendChild(s)}e.on(at.destroy,(()=>{if(s)try{if(!cc(s)){const t=e.$container.querySelector(`#${r}`);t&&e.$container&&e.$container.removeChild(t)}}catch(e){}d&&(clearInterval(d),d=null),h=null,c=null,u=0,s=null,r=null,o=null,a=null})),e.on(at.volumechange,(()=>{!function(e){if(0===e)no(t.$volumeOn,"display","none"),no(t.$volumeOff,"display","flex"),no(t.$volumeHandle,"top","48px");else if(t.$volumeHandle&&t.$volumePanel){const i=lo(t.$volumePanel,"height")||60,s=lo(t.$volumeHandle,"height"),r=i-(i-s)*e-s;no(t.$volumeHandle,"top",`${r}px`),no(t.$volumeOn,"display","flex"),no(t.$volumeOff,"display","none")}t.$volumePanelText&&(t.$volumePanelText.innerHTML=parseInt(100*e))}(e.volume)})),e.on(at.loading,(i=>{no(t.$loading,"display",i?"flex":"none"),(Aa(e._opt.backgroundLoadingShow)&&ya(i)||Aa(i))&&no(t.$poster,"display","none"),i&&(no(t.$playBig,"display","none"),no(t.$tipsMessage,"display","none"),t.extendBtnList.forEach((e=>{e.createdMoment===Lr&&(e.$iconWrap&&no(e.$iconWrap,"display","flex"),e.$activeIconWrap&&no(e.$activeIconWrap,"display","none"))}))),i||e._opt.extendDomConfig.showAfterLoading&&t.$extendDom&&no(t.$extendDom,"display","block"),i||e.getRenderType()===H&&Aa(e._opt.useMSE)&&n()})),e.on(at.removeLoadingBgImage,(()=>{n()}));const n=()=>{t.$loadingBgImage&&t.$loadingBg&&t.$loadingBgImage.src&&(e.debugLog("Control","remove loading bg image"),t.$loadingBgImage.width=0,t.$loadingBgImage.height=0,t.$loadingBgImage.src="",no(t.$loadingBg,"display","none"))},l=t=>{Xo(t)===e.$container&&(e.fullscreen,f(),e._opt.androidMobileFullscreenRotate&&fo()&&(e.fullscreen?(e.$container.classList.add("jb-pro-fullscreen-android-rotate"),e.setRotate(270)):(e.$container.classList.remove("jb-pro-fullscreen-android-rotate"),e.setRotate(0)),p()))};let d=null,h=null,c=null,u=0;const p=()=>{h=e.rect,h.width=parseInt(h.width,10),h.height=parseInt(h.height,10),u=0,d=setInterval((()=>{const t=Ir.isFullscreen;c=e.rect,c.width=parseInt(c.width,10),c.height=parseInt(c.height,10);const i=screen.width,s=screen.height,r=c.width===h.width&&c.height===h.height,o=!t||i-c.width<10&&s-c.height<10;if(r&&o||u>=5)return d&&(clearInterval(d),d=null),void g((()=>{A()}));h=c,u++}),1e3)},f=i=>{if(Aa(e.isPlaying()))return;let s=Bo(i)?i:e.fullscreen;no(t.$fullscreenExit,"display",s?"flex":"none"),no(t.$fullscreen,"display",s?"none":"flex")},m=()=>e._opt.playType===w&&e._opt.playbackConfig.showControl,g=i=>{fo()&&t.$controls&&(e._opt.useWebFullScreen||e._opt.androidMobileFullscreenRotate)&&setTimeout((()=>{if(e.fullscreen){const i=m()?Xt:Qt;let s=e.height/2-e.width+i/2,r=e.height/2-i/2;if(t.$controls.style.transform=`translateX(${-s}px) translateY(-${r}px) rotate(-90deg)`,t.$zoomControls){const i=156,s=30,r=e.width/2+i/2-s/2;t.$zoomControls.style.transform=`translateX(${-r}px) translateY(${e.height/2}px) rotate(-90deg)`}if(t.$recording){const i=101,s=20,r=e.width/2+i/2-s/2;t.$recording.style.transform=`translateX(${-r}px) translateY(${e.height/2}px) rotate(-90deg)`}t.$ptzControl&&(t.$ptzControl.style.transform="rotate(-90deg)")}else t.$controls.style.transform="translateX(0) translateY(0) rotate(0)",t.$zoomControls&&(t.$zoomControls.style.transform="translateX(-50%) translateY(0) rotate(0)"),t.$recording&&(t.$recording.style.transform="translateX(-50%) translateY(0) rotate(0)"),t.$ptzControl&&(t.$ptzControl.style.transform="rotate(0)");i&&i()}),10)};try{Ir.on("change",l),e.events.destroys.push((()=>{Ir.off("change",l)}))}catch(e){}e.on(at.webFullscreen,(e=>{fo()&&(f(e),g((()=>{A()})))})),e.on(at.recording,(()=>{e.playing&&(no(t.$record,"display",e.recording?"none":"flex"),no(t.$recordStop,"display",e.recording?"flex":"none"),(e._opt.hasControl||e._opt.isShowRecordingUI)&&(no(t.$recording,"display",e.recording?"flex":"none"),Aa(e.recording)&&t.$recordingTime&&(t.$recordingTime.innerHTML=Go(0))))})),e.on(at.recordingTimestamp,(e=>{t.$recordingTime&&(t.$recordingTime.innerHTML=Go(e))})),e.on(at.zooming,(()=>{e.playing&&(no(t.$zoom,"display",e.zooming?"none":"flex"),no(t.$zoomStop,"display",e.zooming?"flex":"none"),(e._opt.hasControl||e._opt.isShowZoomingUI)&&no(t.$zoomControls,"display",e.zooming?"flex":"none"))})),e.on(at.playing,(e=>{y(e)}));const y=i=>{i||e.isPlayFailedAndPaused&&Aa(e._opt.playFailedAndPausedShowPlayBtn)?(no(t.$play,"display","none"),no(t.$playBig,"display","none")):(no(t.$play,"display","flex"),no(t.$playBig,"display","block")),no(t.$pause,"display",i?"flex":"none"),no(t.$screenshot,"display",i?"flex":"none"),no(t.$record,"display",i?"flex":"none"),no(t.$qualityMenu,"display",i?"flex":"none"),no(t.$volume,"display",i?"flex":"none"),no(t.$ptz,"display",i?"flex":"none"),no(t.$zoom,"display",i?"flex":"none"),no(t.$scaleMenu,"display",i?"flex":"none"),no(t.$faceDetect,"display",i?"flex":"none"),no(t.$objectDetect,"display",i?"flex":"none"),no(t.$occlusionDetect,"display",i?"flex":"none"),no(t.$controlHtml,"display",i?"flex":"none"),e.isPlayback()&&no(t.$speedMenu,"display",i?"flex":"none"),f(),t.extendBtnList.forEach((e=>{e.createdMoment===Cr&&(e.$iconWrap&&no(e.$iconWrap,"display",i?"flex":"none"),e.$activeIconWrap&&no(e.$activeIconWrap,"display","none"))})),e._opt.showPerformance?no(t.$performanceActive,"display",i?"flex":"none"):(no(t.$performance,"display",i?"flex":"none"),no(t.$performanceActive,"display","none")),no(t.$poster,"display","none"),no(t.$ptzActive,"display","none"),no(t.$recordStop,"display","none"),no(t.$zoomStop,"display","none"),no(t.$faceDetectActive,"display","none"),no(t.$objectDetectActive,"display","none"),i||(t.$speed&&(t.$speed.innerHTML=function(e){if(null==e||""===e)return"0 KB/s";let t=parseFloat(e);return t=t.toFixed(2),t+"KB/s"}("")),no(t.$zoomControls,"display","none"),no(t.$recording,"display","none"),t.$ptzControl&&t.$ptzControl.classList.remove("jb-pro-ptz-controls-show")),A(),i&&b()};e.on(at.playbackPause,(e=>{y(!e)})),e.on(at.kBps,(i=>{const s=function(e){if(null==e||""===e||0===parseFloat(e)||"NaN"===e)return"0 KB/s";const t=["KB/s","MB/s","GB/s","TB/s","PB/s","EB/s","ZB/s","YB/s"];let i=0;const s=parseFloat(e/8);i=Math.floor(Math.log(s)/Math.log(1024));let r=s/Math.pow(1024,i);return r=r.toFixed(2),r+(t[i]||t[0])}(i);t.kbpsShow=s,e._opt.showBandwidth&&(t.$speed&&(t.$speed.innerHTML=s),A())}));const A=()=>{if(m()&&e._opt.playbackConfig.controlType===X.normal){let i=t.controlsInnerRect.width-t.controlsLeftRect.width-t.controlsRightRect.width-t.controlsPlaybackBtnsRect.width;fo()&&e.webFullscreen&&(i=t.controlsInnerRect.height-t.controlsLeftRect.height-t.controlsRightRect.height-t.controlsPlaybackBtnsRect.height),t.$playbackTimeInner.style.width=i+"px"}},b=()=>{if(!m()||e._opt.playbackConfig.controlType!==X.normal)return;const i=t.$playbackCurrentTime.style.left;let s=parseInt(i,10);const r=t.controlsPlaybackTimeInner.width;s=s-r/2>0?parseInt(s-r/2,10):0,t.$playbackTimeInner.scrollLeft=s};if(m()){const i=()=>{if(m()){let i=0;const s=e.playback&&e.playback.playingTimestamp;if(s){const r=new Date(s),o=r.getHours(),a=r.getMinutes(),n=r.getSeconds();e.playback.is60Min?i=60*o+a:e.playback.is30Min?i=2*(60*o+a)+parseInt(n/30,10):e.playback.is10Min?i=6*(60*o+a)+parseInt(n/10,10):e.playback.is5Min?i=12*(60*o+a)+parseInt(n/5,10):e.playback.is1Min&&(i=60*(60*o+a)+parseInt(n,10)),t.$playbackCurrentTime.style.left=i+"px"}}},s=e=>{t.$playbackNarrow.classList.remove("disabled"),t.$playbackExpand.classList.remove("disabled"),e===Ei&&t.$playbackNarrow.classList.add("disabled"),e===Li&&t.$playbackExpand.classList.add("disabled")};e.on(at.playbackTime,(s=>{if(e._opt.playbackConfig.controlType===X.normal)t.$playbackCurrentTimeText&&(t.$playbackCurrentTimeText.innerText=_o(s,"{h}:{i}:{s}")),i();else if(e._opt.playbackConfig.controlType===X.simple){const i=(r=s,o=e.playback.totalDuration,ao(r/o,0,1));t.$playbackProgressPlayed.style.width=100*i+"%",t.$playbackProgressIndicator.style.left=`calc(${100*i}% - 7px)`,t.$playbackProgressTime.innerText=`${oc(s)} / ${oc(e.playback.totalDuration)}`}var r,o})),e.on(at.playbackPrecision,((r,o)=>{m()&&e._opt.playbackConfig.controlType===X.normal&&(t.$playbackTimeScroll.classList.remove(Ci.oneHour,Ci.halfHour,Ci.fiveMin,Ci.tenMin),t.$playbackTimeScroll.classList.add(Ci[r]),t.rafId&&(window.cancelAnimationFrame(t.rafId),t.rafId=null),t.changePercisitionInterval&&(clearTimeout(t.changePercisitionInterval),t.changePercisitionInterval=null),t.$playbackTimeListOne.innerHTML="",t.$playbackTimeListSecond.innerHTML="",t.changePercisitionInterval=setTimeout((()=>{switch(t.$playbackTimeListOne.innerHTML="",t.$playbackTimeListSecond.innerHTML="",r){case Ei:tc(o,t);break;case Ti:ic(o,t);break;case ki:sc(o,t);break;case Li:rc(o,t)}i(),e._opt.playbackConfig.showPrecisionBtn&&s(r),b()}),16))})),e.on(at.resize,(()=>{g((()=>{A()}))})),e.on(at.playbackTimeScroll,(()=>{b()})),A()}if(e._opt.operateBtns.quality&&e._opt.qualityConfig.length>0){e.on(at.streamQualityChange,(e=>{i(e)}));const i=e=>{t.$qualityText.innerText=e,t.$qualityMenuItems.forEach((t=>{const i=t.dataset.quality;t.classList.remove("jb-pro-quality-menu-item-active"),i===e&&t.classList.add("jb-pro-quality-menu-item-active")}))};(()=>{const i=e._opt.qualityConfig||[];let s="";i.forEach((e=>{s+=`\n
${e}
\n `})),s&&(t.$qualityMenuList.insertAdjacentHTML("beforeend",s),Object.defineProperty(t,"$qualityMenuItems",{value:e.$container.querySelectorAll(".jb-pro-quality-menu-item")}))})(),e.streamQuality&&i(e.streamQuality)}if(e._opt.operateBtns.scale&&e._opt.scaleConfig.length>0){e.on(at.viewResizeChange,(e=>{i(e)}));const i=i=>{const s=e._opt.scaleConfig[i];t.$scaleText.innerText=s,t.$scaleMenuItems.forEach((e=>{const t=e.dataset.scale;e.classList.remove("jb-pro-scale-menu-item-active"),So(t)===So(i)&&e.classList.add("jb-pro-scale-menu-item-active")}))};(()=>{const i=e._opt.scaleConfig||[];let s="";i.forEach(((e,t)=>{s+=`\n
${e}
\n `})),s&&(t.$scaleMenuList.insertAdjacentHTML("beforeend",s),Object.defineProperty(t,"$scaleMenuItems",{value:e.$container.querySelectorAll(".jb-pro-scale-menu-item")}))})(),i(e.scaleType)}if(e.isPlayback()&&e._opt.playbackConfig.showRateBtn&&e._opt.playbackConfig.rateConfig.length>0){e.on(at.playbackRateChange,(e=>{i(e)}));const i=i=>{const s=e._opt.playbackConfig.rateConfig.find((e=>So(e.value)===So(i)));s&&(t.$speedText.innerText=s.label,t.$speedMenuItems.forEach((e=>{const t=e.dataset.speed;e.classList.remove("jb-pro-speed-menu-item-active"),So(t)===So(i)&&e.classList.add("jb-pro-speed-menu-item-active")})))};(()=>{const i=e._opt.playbackConfig.rateConfig;let s="";i.forEach(((e,t)=>{s+=`\n
${e.label}
\n `})),s&&(t.$speedMenuList.insertAdjacentHTML("beforeend",s),Object.defineProperty(t,"$speedMenuItems",{value:e.$container.querySelectorAll(".jb-pro-speed-menu-item")}))})();const s=e.playback?e.playback.playbackRate:1;i(s)}e.on(at.stats,(function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e._opt.showPerformance){no(t.$performancePanel,"display","block"),t.$performancePanel.innerHTML="";const s=uo,r=Sa(),o=e.getCpuLevel(),a=Mo(o)&&-1!==o?`${Qs[o]}`:"",n=e.video&&e.video.videoInfo||{},l=e.audio&&e.audio.audioInfo||{},d=e._times||{},h=e.getRenderType(),c=e.getCanvasRenderType(),u=e.getDecodeType(),p=e.getDemuxType(),f=e.getStreamType(),m=e.getAudioEngineType();let g=e.getRecordingDuration(),y=e.getRecordingByteLength();const A=e.isAudioPlaybackRateSpeed(),b=e.videoIframeIntervalTs;g=Go(g),y=ko(y);const v=e.isPlayback()?"录播":"直播";let _=i.isDropping;const w=e._opt.useMSE&&e._opt.mseDecodeAudio,S=e.control?e.control.kbpsShow:"0 KB/s",E=e.getVideoPlaybackQuality(),T=e._serverInfo||"",k=`\n
\n 播放器版本 ${s}\n
\n ${T?`\n
\n 服务器信息 ${T}\n
\n `:""}\n ${e._opt.isMulti?`\n
\n UUid ${e._opt.debugUuid}\n
\n `:""}\n ${e.isInMulti()?`\n
\n 窗口下标 ${e._opt.multiIndex}\n
\n `:""}\n ${r?`\n
\n 内存大小限制 ${ko(r.jsHeapSizeLimit)}\n
\n
\n 可使用的内存 ${ko(r.totalJSHeapSize)}\n
\n
\n 已使用的内存 ${ko(r.usedJSHeapSize)}\n
\n `:""}\n ${a?`\n
\n CPU压力情况 ${a}\n
\n `:""}\n\n ${r&&r.usedJSHeapSize>r.totalJSHeapSize?'\n
\n 可能内存泄漏 是}\n
\n ':""}\n\n
\n 播放模式 ${v}\n
\n ${e.isPlayback()?`\n
\n 播放倍率 ${e.playback.rate}倍\n
\n
\n 播放模式 ${e.playback.isUseFpsRender?"固定FPS":"动态FPS"}\n
\n ${e.playback.isUseFpsRender?`\n
\n 固定FPS ${e.video.getStreamFps()}\n
\n `:""}\n `:""}\n
\n 解封装模式 ${F[p]}\n
\n
\n 解码模式 ${u}\n
\n
\n 渲染组件 ${h}\n
\n ${h===H?`\n
\n 渲染引擎 ${c}\n
\n `:""}\n
\n 网络请求组件 ${f}\n
\n
\n 视频格式 ${n.encType||"-"}\n
\n
\n 视频(宽x高) ${n.width||"-"}x${n.height||"-"}\n
\n ${e.isPlayer()?`\n
\n 视频GOP(ms) ${b||"-"}\n
\n `:""}\n
\n 音频格式 ${Tt[l.encType]||"-"}\n
\n
\n 音频引擎 ${m||"-"}\n
\n
\n 音频通道 ${l.channels||"-"}\n
\n
\n 音频采样率 ${l.sampleRate||"-"}\n
\n ${e.isPlayer()?`\n
\n 播放器初始化(ms) ${d.playTimestamp}\n
\n
\n 开始请求地址(ms) ${d.streamTimestamp}\n
\n
\n 请求响应(ms) ${d.streamResponseTimestamp}\n
\n
\n 解封装(ms) ${d.demuxTimestamp}\n
\n
\n 解码(ms) ${d.decodeTimestamp}\n
\n
\n 页面开始渲染(ms) ${d.videoTimestamp}\n
\n
\n 初始化到页面渲染(ms) ${d.allTimestamp}\n
\n ${e.recording?`\n
\n 视频录制时间 ${g}\n
\n
\n 视频录制大小 ${y}\n
\n `:""}\n `:""}\n
\n 音频码率(bit) ${i.abps}\n
\n
\n 视频码率(bit) ${i.vbps}\n
\n
\n 视频帧率(fps) ${i.fps}\n
\n
\n 视频峰值帧率(fps) ${i.maxFps}\n
\n
\n 解码帧率(fps) ${i.dfps}\n
\n
\n 音频缓冲帧 ${i.audioBuffer}\n
\n
\n 音频缓冲时长(ms) ${i.audioBufferDelayTs}\n
\n ${e.isPlayer()?`\n
\n 视频待解码帧 ${i.demuxBuffer}\n
\n `:`\n
\n 缓存时长(ms) ${i.playbackCacheDataDuration}\n
\n
\n 视频待渲染帧 ${i.playbackVideoBuffer}\n
\n
\n 视频待解码帧 ${i.demuxBuffer}\n
\n
\n 音频待解码帧 ${i.audioDemuxBuffer}\n
\n `}\n
\n 待解封装数据(byte) ${i.streamBuffer}\n
\n ${e._opt.useMSE?`\n
\n MSE缓冲时长(ms) ${i.mseDelay}\n
\n
\n MSE待解码帧 ${i.msePendingBuffer}\n
\n
\n MSE缓存时长(s) ${i.mseStore}\n
\n
\n MSE解码时间(ms) ${i.mseTs}\n
\n
\n MSE播放模式 ${i.mseDecodePlaybackRate>1?"加速":"正常"}\n
\n `:""}\n ${e._opt.useWCS?`\n
\n WCS解码间隔(ms) ${i.wcsDecodeDiffTimes}\n
\n `:""}\n ${e.isOldHls()?`
\n HLS缓冲时长(ms) ${i.hlsDelay}\n
\n `:""}\n ${e.isUseHls265()?`
\n HLS缓冲时长(ms) ${i.hlsDelay}\n
\n
\n HLS待解码帧 ${i.hlsDemuxLength}\n
\n
\n HLS待解码视频帧 ${i.hlsDemuxVideoLength}\n
\n
\n HLS待解码音频帧 ${i.hlsDemuxAudioLength}\n
\n `:""}\n ${e.isPlayer()&&E?`\n
\n Video已渲染帧 ${E.renderedVideoFrames}\n
\n
\n Video已丢弃帧 ${E.droppedVideoFrames}\n
\n `:""}\n ${e.isPlayer()?`\n
\n 网络延迟(ms) ${i.netBuf}\n
\n
\n 缓冲时长(ms) ${i.buf}\n
\n
\n 最新缓冲时长(ms) ${i.pushLatestDelay}\n
\n `:""}\n ${e._opt.useMSE||e.isWebrtcH264()||e.isAliyunRtc()?`\n
\n video显示时间(s) ${i.videoCurrentTime}\n
\n
\n video间隔时间(s) ${i.videoCurrentTimeDiff}\n
\n
\n videoBuffer缓存时间(ms) ${i.mseVideoBufferDelayTime}\n
\n `:""}\n
\n 视频显示时间(ms) ${i.currentPts||i.ts}\n
\n ${e._opt.hasAudio&&e.isAudioNotMute()&&Aa(w)?`\n
\n 音频显示时间(ms) ${i.audioTs}\n
\n ${e._opt.hasVideo?`\n
\n 音视频同步时间戳(ms) ${i.audioSyncVideo}\n
\n `:""}\n
\n 音频播放模式 ${A?"加速":"正常"}\n
\n `:""}\n
\n 视频解码时间(ms) ${i.dts}\n
\n ${e.isPlayer()?`\n
\n 解码前-解码后延迟(ms) ${i.delayTs}\n
\n
\n 总延迟(网络+解码)(ms) ${i.totalDelayTs}\n
\n `:""}\n ${e.isPlayer()&&i.isStreamTsMoreThanLocal?'
\n 是否超过一倍率推流 是\n
\n ':""}\n ${e.isPlayer()?`\n
\n 是否播放流畅 ${i.videoSmooth}\n
\n `:""}\n ${e.isPlayer()?`\n
\n 是否在丢帧 ${_}\n
\n `:""}\n
\n 网速 ${S}\n
\n
\n 播放时长(s) ${Go(i.pTs)}\n
\n
\n `;t.$performancePanel.insertAdjacentHTML("beforeend",k)}else t.$performancePanel.innerHTML="",no(t.$performancePanel,"display","none")})),e.on(at.togglePerformancePanel,(e=>{no(t.$performance,"display",e?"none":"flex"),no(t.$performanceActive,"display",e?"flex":"none")})),e.on(at.faceDetectActive,(e=>{no(t.$faceDetect,"display",e?"none":"flex"),no(t.$faceDetectActive,"display",e?"flex":"none")})),e.on(at.objectDetectActive,(e=>{no(t.$objectDetect,"display",e?"none":"flex"),no(t.$objectDetectActive,"display",e?"flex":"none")})),e.on(at.occlusionDetectActive,(e=>{no(t.$occlusionDetect,"display",e?"none":"flex"),no(t.$occlusionDetectActive,"display",e?"flex":"none")}))};function pc(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var s=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===i&&s.firstChild?s.insertBefore(r,s.firstChild):s.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}pc('@-webkit-keyframes rotation{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes rotation{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@-webkit-keyframes magentaPulse{0%{background-color:#630030;-webkit-box-shadow:0 0 9px #333}50%{background-color:#a9014b;-webkit-box-shadow:0 0 18px #a9014b}to{background-color:#630030;-webkit-box-shadow:0 0 9px #333}}@keyframes magentaPulse{0%{background-color:#630030;-webkit-box-shadow:0 0 9px #333}50%{background-color:#a9014b;-webkit-box-shadow:0 0 18px #a9014b}to{background-color:#630030;-webkit-box-shadow:0 0 9px #333}}.jb-pro-container video::-webkit-media-controls{display:none!important}.jb-pro-container .jb-pro-icon{cursor:pointer;width:16px;height:16px;display:inline-block}.jb-pro-container .jb-pro-ptz-controls{position:absolute;width:156px;height:156px;visibility:hidden;opacity:0;border-radius:78px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE4BAMAAAA9UfJZAAAAMFBMVE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e6y+PYX//qflHY+U/fvCVzw/3ixPD98vSbV4X5ye/yfn+aP+4MvDpg+tjZ4+K8bKOnr1z/cFTU8rH/g92biFxn2S73AAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;transition:visibility .3s,opacity .3s;right:43px;bottom:135px}.jb-pro-container .jb-pro-ptz-controls.show-vertical{right:43px}.jb-pro-container .jb-pro-ptz-controls.show-vertical .jb-pro-ptz-btns{left:0;top:156px}.jb-pro-container .jb-pro-ptz-controls.show-level{right:163px}.jb-pro-container .jb-pro-ptz-controls.show-level .jb-pro-ptz-btns{min-height:156px;left:144px;top:0;display:flex;flex-direction:column;justify-content:center}.jb-pro-container .jb-pro-ptz-controls.jb-pro-ptz-controls-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-bg-active{visibility:hidden;opacity:0;width:156px;height:156px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE4CAMAAAD4oR9YAAAAM1BMVEX///////////////////////////9HcEz///////////////////////////////////85yRS0AAAAEXRSTlO5DCgVgZBxAK2fQDRkBR5XTPLKM/gAABnnSURBVHja7F0Jkqs6DGQPO9z/tD8Jq6WWbCCvIjKfzAGmulrW3ooedr6ui+M4TdP++SXPr1l/SdL3aRrHhv7ZyA5qb9xe0L3Am+DrkzeCL/BeX908MezTuPsfOArdgl3KsZuhq99fk/Tx3waum+ByAHua5QbYilkzY1aP728YhrH5InrfBa57OLAtVjpRbYaumex04dq4APeC7vnVSfo/45bXLe33jGscMx3f0A1vyg3t69e2dRL/NeA6wrgdcCvjyPM2U25mXDt9xVD3f/qN0yi3Mm6P20S54vlXtGPS/R3GPSbYOsC4ZAvmJtiaGiL3Zlzx/Ht+Y/KXTJXbqmaqe9za1VYn3N7YpX/OVGev2qduOLIiB7xqOzGuWCiXFVmWtU3368A5lkqeOJI21I5XXaORxVRnxmUTdNnY/4U3riNvHMJts9XRtdXVUttipdzrK/4x7UyY6sK4Gbo+nU21T1zKcd9AGJetlMvyL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Bx4e7IA3DjMwf3eMfhh9xovH/73dZ5n9cBHrpFzhs4hbhgB5iqeaH5IGDWtCazZuhnOXHg5jmdVX9mDte0u9TjAQz9HB6Iu4zPHt2v7kgNe+cb3FbqeVa9qBfw39C1jZw9cMBDmr7jwqHDylzL+5Sfw2V9wcn9Iy5qZFoTaZRV9b7+k1nB55Sr2gEOaysFiFO+tCSrhqsj2yzyjyAu3lYCHnojyap85gAdfV9wu3l+x2V0R36INSvWAUbvuMvzydRprWogTmfVO+AI4uB+XF/JvxK4UHekMZRucHdkQhsQvdqPuwGurV95cl+LhUR3hPfjTN5lkFa78bUH97StdEdcOJC277h0bvgO24ty6RkQV5OtG5Pn0GIy19S8/OCeKofojlu47gjVT+4/EjZvdu9grnq1uVxAB1il1beEzRtBJJQICv1VMeKU93a0OzItbzq5k90RgLhl+XGCqy3ERdYrO0fftXnb2T3VqjfE5aigMbf3YANirN54co93XMjJT20rhWteP5Hrr/NbT+7xjoPMctOzJkqq6/Luk3u84+7vuGUBSzeBweoE3yPTm8Hm444LiA5gyMXuuJU56G3NR07uAXHVwwo5fgBTf1Xo2rjVnzq7r6yK1LwSr5HHHTdt9fy5k5/R7XLcJdX7FbeOy2dP7trPweQ57FRZx7r6+Mndq3ldEzrAY938ysl9uiQ1cJNVa2SO16X6tZP/dj8uDqJW2VfM/O/ftf7FmPkK3OMZ3MAu8G3T6ytiTTU7OK8jxMlfuN1idg/X91/9VUZ81WOVo8P+Bw+0DogP6NDPAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-up{transform:rotate(-90deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left{transform:rotate(180deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-down{transform:rotate(90deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left-up{transform:rotate(-135deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-right-up{transform:rotate(-45deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left-down{transform:rotate(135deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-right-down{transform:rotate(45deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-control{position:absolute;left:53px;top:53px;width:50px;height:50px;background:#fff;border-radius:50%;transition:left .3s,top .3s}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left{left:33px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-up{top:33px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right{left:73px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-down{top:73px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left-up{top:39px;left:39px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left-down{left:39px;top:67px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right-up{top:39px;left:67px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right-down{top:67px;left:67px}.jb-pro-container .jb-pro-ptz-icon{position:relative}.jb-pro-container .jb-pro-ptz-icon:hover .icon-title-tips{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-btns{display:block;position:absolute;left:0;top:156px;width:156px;box-sizing:border-box;padding:0 30px}.jb-pro-container .jb-pro-ptz-btns .jb-pro-ptz-btn{display:flex;justify-content:space-between}.jb-pro-container .jb-pro-ptz-expand .jb-pro-ptz-expand-icon{display:inline-block;width:28px;height:28px;cursor:pointer;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAANlBMVEVfX19fX19fX19fX19fX19fX19fX19HcExfX19fX19fX1/////Pz8+oqKjCwsKhoaHn5+eWlpaOqTaDAAAAC3RSTlP/3CaKxwJiAELtp4ri/s4AAACuSURBVCjPfZPREoUgCERXBdPRyv7/Z6/Z1aQp9oWJMyYLiKUrOIpAJBdGCldgbzBkPM/QEoTI3jBEPBRDhwEvChe08Q1Ge0ImvIq4Qj8ljrLdH77CyQPWlCdHC0Q1e9rmmuC+oQN9Q4LwcQg40L6eyqm0uEpXSUqe3fKpkkqL+Y/o+07SrahNEO0T0LBsvOitf4xsLqiNTB32wtqaVKosGLO2mhUrS93+PZ4D99wPqzMJVcbEyA8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-expand:hover .jb-pro-ptz-expand-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn////i4uLZ2dnIyMjExMS8vLy+iXNeAAAACnRSTlMAYomLxwEm9+NCLo6DKwAAALNJREFUKM99k9kWgyAMRIMmEMLm/39tKaVKFJkXl3sYJ4sAXeQ3ZOcYd0+gRYblFBuFLYoS2ot5lpvYn8zJQ65TO2GVNmdCmQq/qczw4gjpejD14BgmhziEIvCjVRlPioftHW6A7xBB1a8CCUMvsuSqEkPM7eZX6h8GrQ67bYpNIbRL6rb4/k2EfVXKsgmqfQrW9qnGq96a28jGQG1ky2HXpVysyYyeDIhWq7le6ua9P36HD6+2GRi8iBZBAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-narrow .jb-pro-ptz-narrow-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1/9/f2/v7/y8vLUObqxAAAADXRSTlMA3IrE6SZi9wI+y0gNXAn3CgAAAI5JREFUKM+Fk1kOwyAMBQ04bJHT3P+0JVUMNMWv8zvSk1cipfjAKXHwhR7k6KTjYp7dVuWLug1XWB5wz96T/JD2O3Phmv0k5ypL6lVVFIPYpLOka5WKSSFvS0/BloHYlkza5HkMzrvVLo8ZlRr7mtFYWBBsBQ4BjC//GTxcGVw2PpOVHQ6fJj7qS4936OoN2K4e5yE6N1UAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-narrow:hover .jb-pro-ptz-narrow-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcBAMAAACAI8KnAAAAJ1BMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn+/v7X19ckk9ihAAAACnRSTlMA9+NCAsuKJsRiPv/2GwAAAJlJREFUGNNjYAAC5gxFoTYDBijw1FoFBIumQHjsUavAYGkBmGu0CgqUwRqlYNyFIO2Fq+BAnIGBJQrBXerAwLkKCUxgYELmKjBYIXMXM2Qhc5cxdCFzVzBoIXMXMYAcsRsMdgEdgs4FKT4DBqdAitGMQrMIzRkojlRB9wKaB9G8z+CMGjgshjCuMCjoWNxRAxYt2KGRYgJiAQAnZcjElaB/xwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-aperture-far .jb-pro-ptz-aperture-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAASFBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////9fX1+kpKRzc3ODg4PFxcW1tbXW1tbk5OT29vaVlZVmZmZ8vCMFAAAADHRSTlMAxGJ5Mssm9+NCiYtiH91SAAABAklEQVQoz41T7Q6DIAyEJQooUL55/zddhVazzZjdHyqXXo8DhWCYTWqltNyN+MZLuxP69UGti/vAsl6c0e4L+tQ2yv1AEbvecMhO5cXdYhk+6aO3WGrNAMwentlMz/ZAKIlNoRsqY2wtFWu9t8wasc0iYVN0LkQfrG1zbxNyrIBcntOQrH1Ukkb60QcxYF1xMA2dh8zWj6ZDsLCsIrL4Ds5Hm9FMbCEROWUB0COaLXEIZJKV7CKybGO7UuxjxY2C/TkMbxboKBQCxgMN6MCJQ6Ch/QjOZg/B13LGx8FDTe3IFvl+Bc9XBi3UWoex68qeL/vxmdyxyvz3NJ8f9dDef36HN7koIK2LjxB0AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-aperture-far:hover .jb-pro-ptz-aperture-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAOVBMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn+/v6cnJzr6+u/v7+xsbGlpaXNzc3b29vqh7uRAAAAC3RSTlMAyRjKA59J/3PzPhe1wxwAAAD2SURBVCjPjZPrssMgCIR1mkYtisD7P+zBCyZpM5mzv5hs0M8VnZvaok9BlXzc3FXbO5z0vtifFC5Kn8OL4UfxwVvuHm61d5Z0b6ZGZZwZpQAUosWsjVZntVS1sH3ZFo1IRVYfGXgx+VGwNkkIVbhq9/jm3cAhaNv1Uk3IA8mNn7D3kbQeWK3TLH2jCthrDFcTMwUWaKiClc9mJtJWhS3SF5BpJqMQW1b3xwnkDahMoHYomkeJRgSENA/MFsKML7fgoCBVbGvM+Cx4JcKWbWHKK/h1ZYS1Jy/nK3u8bB3KhzG5deMxtfv3aO7/Heq+9ms8h9fxHP4AHzAWU9zlWNgAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-aperture-near .jb-pro-ptz-aperture-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAQlBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////9fX1+FhYWbm5vz8/Nzc3OwsLDi4uLDw8PW1tZmZmYgm6a+AAAAC3RSTlMAYmOLx4kn9+NCIVJiPGAAAAD+SURBVCjPjVPttoMgDMOJAqOU8uH7v+qKFN2c597lF5LTJg1VqQG3aGuM1bNTV0wWDtjpg3pq+IB+npyzcIE9ejsDXzDCrjccs+tOariF3n2OLyw5xko0vh9MDjNb9Q0hp2GK3cixlIApe4/JD9appR8SFxWAUFLg6n63iB1irnY1Jv0mlrok7nUdcZRa1YeshxBA9iijChlxI6iZEaBgSEL2tkRcymPGGJpqlbZ6uDg0WR/F0DwuMpxDkYwiIXA8hO2uMJdGCCK6teB8RQoY8xGfevQjxYQt25qoRwDT25MRBjZ7GtP/P/afa3LHmrflXa+ruf661Hvv+et3eAF6Fh3v+sSUGgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-aperture-near:hover .jb-pro-ptz-aperture-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEWZmZmZmZmZmZmZmZmZmZmZmZmZmZlHcEyZmZmZmZn///+qqqq9vb3z8/PMzMzo6Oja2tpXGg+mAAAACnRSTlP/JomLxwJiAONCr+rW2wAAAOtJREFUKM99U9sWhCAInEpLBS///7WLEWy7p9O8qEzCMBIOQ15DAlLYsoegS9yFMKQ93skl4Adh+ZI54Q8pG5nxgKzkgkcsk4zhmQxRyN1OPHqtncjOu5AuppcJ6s1EHTA1YzC3Wgq3YmzGqpsmlwZAo7F8oLEVKoeE6+TbSxK0JJ/3FLOwFnUxzXuoltYDDMLoAlmYXLAWIrkqbdZKs+q4KBfkNV1uwGaBim9TdLWS3R7iGRvCNTPB7JvGlc5EXK8cKbrxooint73RzXh7Msl6Oj/uT/b62O9j8sj6gMXX0Xwf6jP3Zr9DtNAHTYMMXrXSK0YAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-focus-far .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAPFBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////92dnbs7OyFhYWjo6Pe3t7Ly8uxsbG8vLyG+Q0EAAAAC3RSTlMAiWJjx9wm/0Lti7mfpe0AAADaSURBVCjPfVMJDoQgDERFC/bg8P9/XUSO6CqTqA0TptNDpSrMpC2A1btRT8wrNKzzjdo03KC3zhkLD9imbeAFhd3sG2kvZQ2v0NknfGBJZKkhBM9MxOxDKBV1N4iHi0TRHYjN01Qi7/kK2PtyNDU7DAEJgDAAN0u1jsQEFEkcVVmrqjeXrkWRmC67eqbgG7bJyvkQSQkvUvec7szpek6t9ubWJSK/uJVSm+APzHKCh++DWWuH4plQKNYOpfappcjy2VvJn9744cjGwx6uyXjBxqs5Xuqsvf/9Dj8rLhRg+bQ5VAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-focus-far:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAOVBMVEWZmZmZmZmZmZmZmZmZmZmZmZmZmZlHcEyZmZmZmZmZmZn///+xsbGoqKjt7e309PTExMTQ0NDe3t774OlGAAAAC3RSTlP/itxixwImAELtp8B2gZgAAADmSURBVCjPjZMLjsUgCEVpq60G8Lf/xQ62gvNeOmZuUiWeKHC1cKnC5iJAdFuwJXgmf+xg2g//G54OPuTOCUOEL8WgMMCLwgPP+Abj2aF38CrnBR7whw6Bo4fWUk7MMrQ2OrpAq0GspTLLgKg1wTailNITZA0EaTkZGjIAY5NwlATah5CGRMJYj50tFtlWiapsLvAPRdtL/WOmET7QzZyl5ywzp7NWsjBJ1odsragJqeJ9HGFNZoLaJw71hMTm0O7NeDE1Z6YsU5rGL69sedmXXz0ToW8PzA/oV09T8OJR32fb7+B17Qe3WwtC9PVbHAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-focus-near .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAARVBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1/////t7e2dnZ3W1tbGxsa3t7eDg4Oqqqri4uKTk5NImu/5AAAADXRSTlMAYieJ3MvE/0Lti4oh87zNagAAAOtJREFUKM+NU1sOwyAMY30FtoWS8Lj/UZe2gWpVh2aJH1wcO0mNqbDj4gDc8rLmiscEDdPji3rP8IX5fXLWwQWuaVu4gbKDuyPdsJMz3GLefcIPbJ6PDCEAFDlUAJiORM3NigQFAXAFlqOeRhWJyFFIHxNGvRrN0mp470U++3axGM2RAmXcXqKnkDSN0a9WIk5Sa01MpDXBQAdVtrA8lBhFnnKpsmoo5VBrhszV0KuJ5N2tP92O50iQjpzcctravoihdoi0Q1NrfN56m0VWzFBoje+OrD/s7pr0F0yUr6s5/LvUu/bz+B2ep+IHdMIV2SUZfCsAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-focus-near:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAQlBMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn////c3Nz09PTp6enR0dHFxcW7u7uwsLAUKT0cAAAADXRSTlMA3IrE6WIm9wI+y0gNQZpqdwAAAOdJREFUKM99U9GShCAMQ8BF3Cmlpfz/r15dAe88l8zwQiQkoRrTEa3zIXhno7lhWxcYWNbtN/fa4Q/218VFDzf4of0O8A/h3TQfOGU/ytsOj9gPVyt8warkmYEQQAgABYDxTKROz88koS6AVIB1fRCNbSI1cVUy15Jq27LGjTtyzipPeWw40/IXQkrHyZSRmqw3LaQgctFNKYzYyGACfEXossLMojFEj7J0WfdwJ3dD9uY2X25tL0Hj45mTR87Y66u9IQFsDS1bL57o7JbUDNIofvpk08eej8kTe3Hz0ZwP9UFfv8OgfgBUByCEUZhYtAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-cruise-play .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJWSURBVHgBtZe/b9pAFMefbSYWMjCjdOtmYEYqXVC3umMlBFRiT7qxkexITcdKSDUSYna2iqX+E/DG6LCQgcETUiR+5Pv8I3Kc+McF5ysZ3x2++9x79/zuLFEG9Xq9s/1+r8my/AnVJq4z/2LZfB0Oh1tFUQxd1+208aQ0GAa7kCTpMgRJk4kJXk+nU5NEoe12W8PM/wrAotIx2Z+w3MkE7XQ6Q3S4otNlY5zPUZdL7wiMBUsRIK/fDeWvhQ92XS0HrQia83cCsqoIyMug8gQ9Ho/DpF7FYpEajQa9VTBoyIZxWeEfv6IndSqVSjQYDKhcLtNqtaLtdkuigmGSZVn/XKiqqr9wqyZ1YEtbrRZVKhX3zvX1ei0Eh7Ufa7Xan8C9VRIUg9lyQZfzO19VOOugkBpAgaXRtnq97oLZ5ZvNJm0YQkBZ8m63E7YyKl5ntrrf77vlJCF/qzLlKLZ4NBqRpmmuF2LBlLOyBFYBchDKlIeWyyWNx+PUtS2Qtx+eJA6i2WzmQtMEA+8KnA+73a6N+jkJil1pGAbN5/PMfRBIZsGn3+LFvSABMYiBgpnJgZEeFHQD4EzQrOsWI4N/nrY2uPg/eeefV8WvAKfALOsWJ3jzA++rcqjhB25OXAd244nA62AjV4LGxWLhIBk/oPiF8pc9mUy+BZVnyQEzueEZUb5yjyvhBiX6BCw2YTGvdZNyAkYPZsprT/rgO/K2vDcdQQH7jes7gPcv/kvqyCcKbEVX6PxVAG76QWPGPZAIDcEZqGECTQyokpe9wp8VfNqzyA2L9M+KRzm19l1i6ZQBAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-cruise-play:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJ5SURBVHgBtZe7buJAFIYPjsVFAok3wBUlYcUDLNvQISUSDVVCA0IUYZ8gmzcgBeIiJLwdFau8QToaQKygovI20CJBARKX/Y/jICPAF3B+yRpjZvzNOWfOzLGLLKrZbAaXy+WdKIq32+1WcrlcQe0vZb1e/8XvQT6ff7fyLpdZh0qlEr+5uXne7XZxMpciCIKMSfzGBBSyCwVMAqxpEXYEhzdeAJYtQ2u12h2aJq4gXadSLpf7aQptNBoPm81GJofEsc5ms9/0zwT9j3K5HHUSyEJ4ovV6vXkSyjHEyvxDXyCAHxGy4hEUq+4JjWQ02O/30xV65rTbQ9lKNEWjEYFAgFKpFMViMbpQnOfFPRSKWxnldrtVaDqdpnA4THalefMDinx8sDOYrY7H45RIJOy6PMibjch3F24AJEmSeo3HY+p2u7RYLEzHwNqogOUcpSvFrk4mk5Zcjry9FZCX1+46qj5dzvEOhUKGfQVyWAyPRCLqojsnEYtohpiSE5rP59TpdEhRFMN+Itw7Q3DpGq1WKxqNRurF90YC75+gnXszulBsVbvdpl6vZwpkwasDNWVw9r3BWlu5Op1OVdBkMrEzTD11RO1exmUJytb0+30aDodkV7DyjT2rBpNrG8zg3WwQW9ZqtS4CatASt/sVhAC/GA3glWk1bqcEo+TPwm0P5QeYySt9jRS9UQe54vF4fqEZkMNCdXivrw4PoJlMZoad5IeDYE7F+0KhcPC+syVotVotIQ5PdLm4CD8CGkJZfAIhzlw3SWRdM+T9q9frLbHnTnUwrfBZfPCiecQG8v3MBHj/HvAm4/P55HMwW1C9tG8a/RmsGH1CnNJ/17UakVMOx7kAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-cruise-pause .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHySURBVHgBxZc7bsJAEIbHdprQJAU1ckln3FM4J4jTIkSMRB9uQDhBlBPECIk2yQ1MSeeIxg0KZQoKKpSCR/4xtsXTNmA7v2ThHe/ut7M7O7sIFEOGYdzO5/OSJEn3KGp4ZDy33ucxP6vVqo86H71ez47qT4iCLZfLJ0EQmhuQKNlo89rtdk06FVqtVjV49kZrr86RicG2TdMcx4LWarUWGjzT5Rqjn7tdsJAi8Ch4C4op1TGl75S8GKwCPOWC6FsRNDKAL5SOZER30HcAhbFFEUFTLBapXC5v2fL5/J7tiOCXofHLlVfikRhRrSqVChUKBXIchyaTiWtrNBruYLjM9jB5jlmup4vFQqMYyuVydKE03vsuVBTFR8pIcFD317REGQlRXBJ5PSl+iktCskgZC57eZA5l/Q/Uy4lTykjYq1++p5EHb1LC9rRdKA7dT8pO64yERG/SmVM8m81OqW7yckr8Ztv2r6Io1whnLawF59fhcLiVY0ejkWsfDAYUJfRfB+snOE85J2KRvym9RGF2Op06vwRbhg9YHgmlIz7E235B2vwC1x1VVdl7jZLT3nVF2q0BsJUg+ODFTDpU0wP3PfC5a2wB+BD7CuqLgws/TQQYn7cyxYfxfdc6ViEUujMAHUlER4cKHfhbATvPjBUG8/UH1xXJDxHoYGQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-cruise-pause:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAH/SURBVHgBxVY7bsJAEJ01CAkJKUhUULmiDSnpoKYINyBuQIgi3AA4QZQKIQq4QaChhhuQCxAXSERUSDSIb944axSS+CPA5kn27o7X+2Z2dz6CXKDT6URXq1UqGAw+Hg6HDB4V4qj8rAsh9N1uN9rv971KpTJ2Wk84kW2322csVv1BYr+gEGMo8Foul7uWc6w+NJvNjKIoHXRVOgMg74K8AXLdFWm73a7BujpdDh3rZH8TCw8JLYlPSFutVh7NG10feigUetA0bcEDxZTiDFU0L+QN1M1mc1z7SBoIBGrkcGkSiQQlk8kTWSQS+SP7D3CzJ76c3A/yi61kodOP6XSaYrEYzWYzWi6XhiybzVI8HjfGLLeDNGxoWpohF8C50CXgwMK+r0gNCuQTENnyitQgRT4BQSOlyFvrKsRdCapC/uPuFqR0G1IZExfkH94NSzkHkk+Ap4wNUiTqPvmH74gUDoe7dOYWr9dr13M5sfNxBnjQ7/dXuVwuDGHG7ieOr9Pp9CTGzudzQz6ZTMgJ2FFtMBh8HvMpx0Ro/UEeBQq2slgsatw/uoxMsBp5A64WG+bgxE9LpVIPpUWDrgv7csUE4nEdlWCNPCC0JJXEF5Wg8MchHs11CWpCVvZVkBfckksyrneHVnMEuQRXitiqPBS4lwpEJYmORkc7Qju0IzPxBZ2t+3mW/JtqAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-fog-open .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAKgSURBVHgBtZe/jtpAEMYH28WJioIa+URDF8MTkAalO6cH4YIiFbk8QXS8QO6oUlCAkGjDtTRHJBoa4nQ0KBZdJApoEAV/Mp9jkAF7bXPcJ5ndtdf725nZWdYxiijDMBKr1SqhKIqKNpdms9mcRxkjFqZTsVjMy7J8x1WdL9WjC6D97Xb73G63m0HjxULAvnI1T+FlMfxBBPeEwoW73Q6we7pcViwWe8+utwKhDFQZ+IOrGr1eAH9ksOkLdSz8Rd5xu1RzBmfdFkvupwz8dmUgBENeYNAZtFQqGVwY9DZSnTVi6+Decrn8h0JYWSgUKJfLHdrL5ZKm0ykNBgOazWbCd9nNt3CzgoZjpUohlEqlKJPJHN3DJHRdp16vR51Ox/ddTiVkw70NlSTp7rRDMpmkWq1G4/HYvmANSpHghXg8To1Gw/M5W1oGVEZD07TvXNy4O8Btw+GQFouFbV06nabRaGRbhbaf8AzvTiYTr8c32Wz2p8KrSuMgJ7x6IEa4AIuivau9tNlsNGm9XqsBY9gxhOvCCi728wa7OCHhRzQAZl2pVGyXRZEoBAoFCDGs1+v2QooiUfpIHE+LBEL+VatVezVfDcp/whYJhAWBVHFvCEFCfz8op6cpORuxJRokajz98tSRae+97OJnUS/RanQLkwNQ4FrzsA2yyU0Gf/br2e12A90LlwYAkS5Pdrm/wRs+/rh1ChAshuV7wTqAQoTAarVat6gorll8YWvzXBXmbdTUcY3/sK/L+4ppmnPeF/9SCGsvAXIsH8+gDthkMFyepyuJgS0GHh3w5NNOzO0zeMHVD/R64BMDP53d93vBORW+0GVnpvmpS0NBXXDDSacwR9K5kxaPok+NUJ8VDlzlQucJvKNj63G2/U3/E78fZqx/rk0w4ggu8jUAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-fog-open:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAK2SURBVHgBtVa9jtpAEB58/EqArqCBBqehorgTVDQxPVJOiD5QAEJUeYLjniBcgRACKeQJQsQDBBoqkIigookraC1BwT+ZcQBBsNd7Ovgk2LV3vd/M7PyZgBPlclnc7XZPFovFv91uRZPJdL9fktfr9W987udyuRbPWSajDUgm3d3dPSOhBMaQUaAXu93eSKVSCryVtFQqPaBWXznJNMlR8zo3aa1W+7zZbIo4vYd3QBCEQjqdfjEkrVarzyhlAa4EvOt6JpNJ6ZJWKpUnHH7A9VHMZrNfLkjJO9Ecv3Aqwg2A1osevFs4vCQP5SF0Op3g9XrPflar1egzut9vCNVHzPS3j8EkcCAcDkMgELh4PxqNoNvtwmw20/tUXC6XSRyLqqZ7LS80CgaDqiY8IEESiQSIoqi7B53qE40qqVYsolTgdrshEokAeh9IkgRGIDPTPhJYC8SD4eg3k52RQNQi7XQ66txms+kepEUcjUah2Wxqrq9Wq6h5Pp8/4CUzD1osFuqPFwfnIsE1IBKbyDqANIzFYhCPx+EtYPmCGQxAppJlGQaDAVwLaFlBgRtAx7T/SNGNZWCg1WqpoeP3+4EX0+kUJpOJNiEqKWA49HGusA6gwPd4PMCLXq+nu4bpsK+6LVV9YMDlcqnkPKD7JyF1oFD+PSSHV9ZB4/EYQqEQGGE4HEK73dZdR+Ua6nh4gWXtD3AkfCL3+XzHZ4pfyrekIQnHApr2A2oqn4YM1TvDWkr3xbozPVAxJ0KaH1MRFllSvQG3gYztz7FtOct/mLqorZDhulD2BVzWJKW2kTZckVjBnviM8IKUQBtQ40ck/w7vAIUhnvGYz+cvwpHZbGNHkcQMwtXGnICs9YrCF/Q2GHb4e3IJBxLgo44ACsY6afbT4XDUWd09N+kpqOhTDT55Jf9/Z0b4C/UJLQCcLGi1AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-fog-close .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIjSURBVHgBtZe9UsJAEMc3l1Q0WvAA2NEp1MyInVbGnoE8AVrSqW+gT2CY4QGwpTEFNcaOEqksKKiYcYYP/xsSJoRwx8f5n7nRu9u73+7lbu8waAc5jnM6m81sIcQlqhcoOZTTsHvAZT6fv5um2XZdd6Caz1DBMNm9YRgPMYhKHhx8brVaHu0LrVQqNjx/2wOWlAtnn9MiT4VWq9VHDHii4zXAPFdJsPGPwK1gIwHk7/dC+sXgAsBjroioFZsmpznCuHKLxeIxqqwirdVqvGmcbaOy2SyVSqW1tuFwGJTRaES7CEGd8TJbXOEo4YkjG8BQ27ZT+7rdLrXbbSUcx4+P3oOIVQ4Wr0Cj0aBMJiO1Q6Q1PvsirFzSkeKVqNfrKjM+8xeCybRMbUcrn88HRSasqs2R5kijisWitB+reiKm0+mhaS5VvMwqCdIs1WYKoJZljUmj+NwqobS8D7Wp1+tJ+5EPvkWYD33SIE4S/X5faoOHgCdC+jsdKc5GnJUUGiNIzwrpbjwh76tOpxMAJ5OJyjTwKp7wP/CnvM06LeFzdPwNd4AFihL+Chom/U86/HmiAr4CGOR4M2r0fX9cKBR+8e816deg2WzeRJW15ABPXvgxRXoVPFfiDWbSAhF7iJiXvUyagMmHmZlmGYK/aXn7HPSNAWui3AH4s9EnG8ibiy94DL6l3W8jL3zvetsMpNCEAw4cKGPCc9r8WeGj/YuBMlikP+yn3EGZYjlWAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-fog-close:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAI5SURBVHgBxZZLjtpAEIbLjUFih8QFnBUrJCIOEHOCROIACStALBhOMMwJMlkgBCyYnCDMCUJWrJCQYB+zBwkJFiBe+QvZyEz86IEezSc1dj/w76pyV5dGEnS73cR6vf4SiUQ+HY9HE0MJu5GmaSNcFrvd7hn3vXK5bIU9TwsTw8Oqh8PhzhGRoIf1tSBxX9F2u12FVfVXiL3ksVgs1khWtNVqfcfljm7HgtW5l1Zrbyh4Fo7FYh8LhcLCGRDu2U6nc69YkDG22+0v98DZ0mazaQgh/tLbUUOMHy9E8eH8treDJ8lkkgzDuBibz+c0m81otVqRBAu4+QO7WecerDSDBB3RbDbrOTcej2kwGFAIvNc5dPVTTLHpv9INpNNpyufzBEsC1yF81dOVf8KslCHIEy4SjUYjIxDLDDoGKYAtDrNW13VT7Pf7azOOJ6lUKnAeySLB7jVIIezmMAS9A/igxIIUwns3VBQ+HpFCLMsKnGcjhX0CKLF2MpnQcrkMXIPzuX+KKax9phthtw6Hw7BlVqVSGel25wntqqy02WxOFnLj+xB6/HNTwmdXTqdTGTHmfKA7lhKSxAOCbPr9g90n82X6AcGfTgVxUTngtKlD+J4UAw/2S6VSzulfJAe8SZ3fiNRiQbTgHvgvI0H4Gxb9IAVwTexVmHmmQbiCD1suHy26En7xaDSa86p/A4ttrpuIT3ohpLcTxw/tAWJ9vzUaSWCLm3DXZzS+z7hELFzYjX/i8fiTu9T04x9LgQk+PbvDKQAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-wiper-open .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAALxSURBVHgBtVYrrBpBFJ0FFAqBqCIrUXRBk5QaUleewBBIlwSDoW1CUlzz0CSlaJJHA8FgqMBg4CWIKkpRuEfQCDAYAvSeYYfsLgss6fYkk5ndmXvP/c1HYjaQTqdjbrf7PQ0VarLWgBW1Cdput3tutVrdW7qka5OZTEZ1uVwfaBhj9jDf7/ePzWazwe4hVFVVPhwOT3cQnRFLkvS20WjMzRMuCzKFyH7/AxkAg18oQp/ME24LsgENfcwBkJfvQqHQejqd/jr905HJGpnMHIYW3iHGp5AS2df/QabpfiKHfCdCVCN1qh1hv9/PIpEIi0ajLBgMskAgcDZfKBTMYjJVL8+nh7MeS/8ioFiQbDYbtlgseA/lXq+Xt9lsxrrdLkulUmw8Hp/poLB+JC+rkpa7FysiKEokEpyo3+/zBiIrr2EU1kKmWCxariMvsy46IRJWZFBSLpf5GApgvZUSYLlcstFoxMfwHnKQN4Mi+cYdDoe/IGpmslKpxJV0Oh223W7ZLcTjcb6uVqtxLxFayJtkfSga2Sycy+X4YnhlBzAQhGI9euTRqnhAaNjkKA5Unl0yALlD0SC0Au12m/fIvx5nRxsEYV2lUrHMgxmiYMwGwmiE1qzDrSiKSv0r8QMxF2Wdz+fZer3mhXAJCP9gMOCGAiBJJpM8h6jqXq9nWO+hLfGH9ohiVoTFIEbxwFqECMoQInwLy4V3mEMe0SB7YWtMJJzoVK7fLnkgKg65BVBM8Bj5gjHwDORoGNfrdUMu9SDnfl7d+HqAEArFCYNQYoxtAODfJSIBimTWpV2Swxt8PLwiRAgjGrwXuEVGmBNXw6MxP5KXMWYTCKs4U+2COH6g59tCu6uG7A7AYxteCcypVU+EmgVZbcJxkO4HcmplIEQuMcGOTz8nyT6T7on4Npw0mMBzgDnkqUZWNfyzWujQM/FB79lVQh2xeudbZ0VE36mvipzdRagjjtFtnSBlr9nxuS9uGCidk1HPdFp1xcvsGv4CcbeEIeSIw9MAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-wiper-open:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAAAsTAAALEwEAmpwYAAA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inasYH+pPPOMaNL4wMJphJZ553Bt/Zp3wHwTYnvHjbDCuAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-wiper-close .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANOSURBVHgBtVc9TCJBFB52r7jYyCXWnhcbO1aru8RErjGXWBxX2BijGG1svNhJo56VhQU2ViQsgdDQYEFDc5rQ0BDoaMgRGhoKaMhdCHDve+6QZVhgMfglm9mdn/e9v3kz6xEusL+/79c0bcvj8fjpc8V6gCY9VXqK3W73MZFIpN3I80wj03X9il79wh2q/X7fJAXvTdNszkQaDAZXaHF0BrIRcvLKERE/OQ3qYwh/06shXg8vRPl8PlEqlZ4nktoIV8QcgBxwItbfitBOvL6+XioWi2XZp8kXIryaN6FNdpSM8spvthRWUmPaJ25vb4vV1VVRqVSGBCwtLYm1tTUeW1hY4KfVak2hFe+J+B+5+QkfnL2Hh4fI1KAq/OLiQlxeXorl5WWxsbEhNjc3RbvdFrVajVvMkcTlclmk02nRaDTGETfJ1Z+wlTxWLP84zQoEAkwEodlslh+QqZDWY36hUGByp3m9Xu88Ho+HNaokfidCCAIh2kgkMlYQAOtyuZy4vb1lBW9ubnidCioa37klkw0nQrgWgpLJJMfXDUAOBbEO66GAAkOS+tSRk5MTXgjr4FIAMXULrIObz87O1CHv8fHxR03thXAkDhbahezt7TlpzkA8sc7uUngIQIhUgNRr70AWQsu7u7uBEPTBdaqboQTcCIUgXL4DUBzjTrHVDcP4BmVlR6fTYVLg9PSU9yC2CIghEG7HHIC2GluJOGYyGR6DYiDCGEKD/iErNS2sU238QnH9rGqDopDP5zm+EIJ3aL6zs8NEUAKCQSiVwxp4BFaHQqGRwkJoRqPRkEZ7tCjGAAJQHED28PDAVkirsX1kUcAc7FEXWc5c7+iQTltnpyMgHNYgUSSZBL5BhqTBHkVMAZnxKsijMbQ6Vf+/FFe/mFLs6/X6IJZ20t3dXXb34uIihwFuTqVSI3Mt0nPia3LtpVLot461V0FWLiiBZwzMWCx2xOSy5+DgIEya/BRvA1xfvlKxr+JjUBwola/Fy81u7iDCX5JwiJSPHNJm3sQWoTnUp06a57XFIrxW+0dug8guutM8EvEHpxPIJRDDH6qFA2UmrSSrg0SO5HJLjhDdUxue+bLtQG7QqR8ggVvC4beCFHumRMSxVJxEJvEfnFm91YrgD/sAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-wiper-close:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANwSURBVHgBtZa/SyNBFMffboJaKAS10SZ7hXqFegGbCyjmUPTAH3eHlZWmULG6u/Kqi/9BLEQRIdoKigf2l1Q2ChGtBLmtFAQloPgL1HvfRyZuJhuzBvOFzezOj/eZee/NZAzyoMXFxYjf7+99enqK8GNxlZVtyhiGYXOZ5vo/MzMzW17sGaVgPp/vN2DkTbZpmqs8wfloNJqh10AZZjEs8QpYAfzx8TE6Ozub9AQFkGf7l55dWLbYTmxqamruRehbAl8CG5UEOvTNmWSmekHCVAgIJVgB9eHHD1bJSTPp7NXe3k68Hejg4CBvdF1dHTU0NFBVVRVdXl7S/f09nZ+fl2BS4Pb29geXMXyIe5eXlxM6FMaHh4dpY2ODGhsbybIsamlpyUFQog/geE5PT2l3d5eurq6KgTPc7x22kpGN5T+3Xl1dXdTa2ipGDw8P5bm7uyvoB3hTU5P0t22b9vb2ZFIu+smxjSOmEbfW2tpaAcJgMpkUQ25ACG4+Ojqi7e1tqq6uprGxMRmvi8P1BaXJLyE34MjIiBja2dmhzs5O8iLAMUGMw3h4yCkOobDYs+YHfXAkEpGBWJ1KJMTUqzAObh4cHNSbAisrK0FTrw0Gg5I4GKiEBAmHwwUzV2pubpZJOV0KD0EIkS6TlxxwViALMcvx8fGcEdQhKzs6OvIGYxLIcEwIxuFSvEP19fXSjpzQ5RsdHf3M5XtV8fDwIFDs0f7+frq+vpYtAjAMwu3oA/X09MgqEcf9/X1pQ/wBQhuyPZ1O56/SNOO+oaGhMAM+6rM5Ozuj4+NjiS+M4B2ZGQqFBHRyckLd3d2USqWor6+Pbm5uZAySqa2tjdbX1+VbU2Z6evoX3JumIoIBHA6ATUxMyCl1cXEhQOxD1ON9c3NT9qjufl2K5a+pqdliA4liHWEc7kOiwMXOvYpvwJA02KOILwS3FoGuoTTlWDKMJJUQ4qwfDmoyAwMDkkiYIBIOsS2iJH7k7MW1JPu3VpbUyYWVw91u4oWtcjyjOSi0tLQU54bvVBnh+vKJry82PnKHAydFDI1UATFwTgHzoIgtZvPW4Cxw1VlX0YtZFhjT6wvOXrgBK+ZnjcqXimHMrbHUZXuSV43kCpE3IUTzvPfjr75s61pYWAgx/Ctndy9/WlxaCsKPzZs+xc8Ww9IvwZT+A8hTw5fcMmXrAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-arrow{cursor:pointer;position:absolute;width:0;height:0}.jb-pro-container .jb-pro-ptz-arrow-up{left:71px;top:15px;border:7px solid transparent;border-bottom:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right{top:71px;right:15px;border:7px solid transparent;border-left:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left{left:15px;top:71px;border:7px solid transparent;border-right:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-down{left:71px;bottom:15px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left-up{transform:rotate(45deg);left:32px;top:33px;border:7px solid transparent;border-right:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right-up{transform:rotate(-45deg);right:32px;top:33px;border:7px solid transparent;border-left:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left-down{transform:rotate(45deg);left:32px;bottom:33px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right-down{transform:rotate(-45deg);right:32px;bottom:33px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-loading-bg{display:none}.jb-pro-container .jb-pro-loading-bg,.jb-pro-container .jb-pro-poster{position:absolute;z-index:10;left:0;top:0;right:0;bottom:0;height:100%;width:100%;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jb-pro-container .jb-pro-play-big{position:absolute;display:none;height:100%;width:100%;z-index:1;background:rgba(0,0,0,.4)}.jb-pro-container .jb-pro-play-big:after{cursor:pointer;content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;width:48px;height:48px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzMzMzMzMzNzc3MzMzPz8/Nzc3MzMzMzMzMzMzMzMzLVn6fAAAACnRSTlMA+duduRUwSGSD8toSsAAAAI9JREFUOMvV07ENgzAQhWG3lLSp6MwCViYIRSpG8AiM4FWMaPymDBKESMF/cQ0S136F353vnLuo3gp1kOYEoCXW4LFKIZAnqAXYICeASoAdzgG+cApwgF4EfwF+oDkCqIwA6gnyAKA8AaizQhsBAjzuqUHofInGIQbjRxXjMrTJuHDestR4Bng4eGrN0929PqNfzC6h06weAAAAAElFTkSuQmCC");background-repeat:no-repeat;background-position:50%}.jb-pro-container .jb-pro-play-big:hover:after{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEz///////////////////////////////////////////8Uel1nAAAAC3RSTlMA+rbVFUecgC7rYhEEz+4AAACbSURBVDjL1dMhDsJAEIXhdeiGpKYWQVKDWc8ReojFc4ReAlPFFQazad7lIGkb0jK/WEPSsZ+YN5mZEP5UrZIP0vgE0Kv3oPlIJlAk8AJM4ASYwAkww2+ABfQg0ImgugPYsfNBVl99kA0AsjOArAPQpRTGHiBB8whxM0y+3skXNltsvMYriIWrpWPA80mFJ5qL3gAfB1/tcAt7rzdiV+HEgs1oBgAAAABJRU5ErkJggg==")}.jb-pro-container .jb-pro-recording{display:none;position:absolute;box-sizing:border-box;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:101px;height:20px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jb-pro-container .jb-pro-recording .jb-pro-recording-red-point{width:8px;height:8px;background:#ff1f1f;border-radius:50%;-webkit-animation:magentaPulse 1s linear infinite;animation:magentaPulse 1s linear infinite}.jb-pro-container .jb-pro-recording .jb-pro-recording-time{font-size:14px;font-weight:500;color:#ddd}.jb-pro-container .jb-pro-recording .jb-pro-recording-stop{height:100%}.jb-pro-container .jb-pro-recording .jb-pro-icon-recordStop{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-zoom-controls{display:none;position:absolute;box-sizing:border-box;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:156px;height:30px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jb-pro-container .jb-pro-zoom-controls .jb-pro-icon{vertical-align:top}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-narrow{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-tips{font-size:14px;font-weight:500;color:#ddd}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-expand,.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-stop2{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-loading{display:none;flex-direction:column;justify-content:center;align-items:center;position:absolute;z-index:20;left:0;top:0;right:0;bottom:0;width:100%;height:100%;pointer-events:none}.jb-pro-container .jb-pro-loading-text{line-height:20px;font-size:13px;color:#fff;margin-top:10px}.jb-pro-container .jb-pro-controls{background-color:#161616;box-sizing:border-box;display:flex;flex-direction:column;justify-content:flex-end;position:absolute;z-index:40;left:0;right:0;bottom:0;height:38px;width:100%;padding-left:13px;padding-right:13px;font-size:14px;color:#fff;opacity:0;visibility:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none}.jb-pro-container .jb-pro-controls .jb-pro-controls-item{position:relative;display:flex;justify-content:center;padding:0 8px}.jb-pro-container .jb-pro-controls .jb-pro-controls-item:hover .icon-title-tips{visibility:visible;opacity:1}.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-face,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-face-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-fullscreen,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-fullscreen-exit,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-icon-audio,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-microphone-close,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-object,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-object-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-occlusion,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-occlusion-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-pause,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-performance,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-performance-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-play,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-ptz,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-ptz-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-quality-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-record,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-record-stop,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-scale-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-screenshot,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-speed-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-template-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-volume,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-zoom,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-zoom-stop{display:none}.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-speed{padding:0}.jb-pro-container .jb-pro-controls .jb-pro-controls-item-html{position:relative;display:none;justify-content:center}.jb-pro-container .jb-pro-controls .jb-pro-playback-control-time{position:relative;justify-content:center;padding:0 8px}.jb-pro-container .jb-pro-controls .jb-pro-icon-audio,.jb-pro-container .jb-pro-controls .jb-pro-icon-mute{z-index:1}.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom{display:flex;justify-content:space-between;height:100%}.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-left,.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-right{display:flex;align-items:center}.jb-pro-container.jb-pro-controls-show .jb-pro-controls{opacity:1;visibility:visible}.jb-pro-container.jb-pro-controls-show-auto-hide .jb-pro-controls{opacity:.8;visibility:visible;display:none}.jb-pro-container.jb-pro-hide-cursor *{cursor:none!important}.jb-pro-container .jb-pro-icon-loading{width:50px;height:50px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8BAMAAADI0sRBAAAAIVBMVEVHcEx4eHh4eHh4eHh4eHh3d3d4eHh4eHh4eHh4eHh4eHiqaCaRAAAACnRSTlMAikwX3CxpwZ7zIGi5xgAAAZ9JREFUOMt9lb9Lw0AUx2Njqm4iGEqmEnBxslKUdhJctFMVcW5wKZ0CLpJJQRw6iVqQbg3FtPdX+l5+XHJ3796bQj557773fe8ujtOI+6jz5p84dHjTkYD4+RhT9CIRZWRPJr1bChnbY532GhT4oUpbI6HEuqvgIH9544dh9J4/rpr0Ms8oV3zMNT7X1MXSmaznzfHjM4n72moe5n8ryYrW9rKRvgf0S93JA7yKa9lbzUg3keJb8OVCtwkrFmoO4MnsAuj5rGqnZg+GZXUXkl9NjEui9n3YA9XgpMgakLXz6ujMTIgrCkPVv0Jil8KgKQN/wRN69hLcb1vrbR2nQkxwiZTGQ5Teb7TO8PUaS8Q03sE+zkjP8qbjzgJtEhRbV4gnlkOFeM7hDYNdxPbiYFvKSHN6L2NmY5WzMYPtplZdTxncRvn2sI+DHIoug22jWMaA12Y7BrXzrG8BX32XPMDKWVzw1bdMOnH1KNqNi8toqn7JGumZnStXLi0e4tcP6R3I635Nc/mzsMxl9aux9b78UVmn2pve8u6eR50j9c0/ywzyVl5+z84AAAAASUVORK5CYII=");background-position:50%;background-repeat:no-repeat;background-size:100% 100%;-webkit-animation-name:rotation;animation-name:rotation;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-timing-function:linear;animation-timing-function:linear;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.jb-pro-container .jb-pro-icon-screenshot{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEzMzMzMzMzMzMzMzMzNzc3MzMzMzMzNzc3Nzc3MzMzMzMwv5ahDAAAAC3RSTlMAW+8S2UGVwyyZnOTRhEMAAAEfSURBVDjLzZKxbsJADIYdBQpsSCyVMlXAdEuQYGKpWFk6dWHJgsQ7sMDSpUv3PgITAQT0f7ly57ucQ45KXRAZot+/89k+X4ju9KzL4XOhlm3pR0enYrWViSRPXQIQSASkRSkIJEFRimYCuQAHSW89IOv6SH5TCsuAj68Ab1wDzqkAzqoC7AUAPtgsABgkBBgkCJiNHehGok//KRVsHqd+3Dj1/vukt3AH/Jj05s5/AmyZhFVWXDls44iVvfQWkCvgxU6g9ZdJfCLvjJbYaT3GvjOY4mQSG3SJGjhr/Y1Xohp+TGKqqzexZ/1GVGdNCitt6R8zVvb9d+JmKdl8o5sPWbtxT6zFuJcDQtk92MNmYiXHquYlZlVt1j4P6cd7fgHFW7Nhqu29TwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-screenshot:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEVHcEz////////////////////////////////////////////////////////NXt0CAAAADnRSTlMAWe+X2TINXUYZvctoYyuS2NgAAAEVSURBVDjLzZKhDsJADIZLCAsEg8WgEGCWGSwCgZxB4MgEAonB8wQEXoBH4BEWXgPJgEBG0mdgR3u77raRYAgnlq+9+/t3TQF+dKbZcJXSYSnzlViT457lRScKmBqILSFA3GoO8S4E+Ex5JiSJ4CbVdyOQdZNomX9D4dl+ko3NC8vFFmhPy8FIsi0ZlwLBW/LY5BxYYreUSgoFAEmhB5Rc9OCbUoXmTmDadQKTn4y6A/XTaoSKdb6KyGU6RJ7eHgpb3ABinAoil303xB6vQnRahNhXvMdre+fzOgxVrokX4jHAnBh8PALU8Eq8BqgTg/vePF8tpuPy9/NFaalSc273RizarYqfkswjifNMQ/TyTGMv4v87L+ks5gqDbc9OAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-play{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzMzMzMzMzNzc3MzMzPz8/Nzc3MzMzMzMzMzMzMzMzLVn6fAAAACnRSTlMA+duduRUwSGSD8toSsAAAAI9JREFUOMvV07ENgzAQhWG3lLSp6MwCViYIRSpG8AiM4FWMaPymDBKESMF/cQ0S136F353vnLuo3gp1kOYEoCXW4LFKIZAnqAXYICeASoAdzgG+cApwgF4EfwF+oDkCqIwA6gnyAKA8AaizQhsBAjzuqUHofInGIQbjRxXjMrTJuHDestR4Bng4eGrN0929PqNfzC6h06weAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-play:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEz///////////////////////////////////////////8Uel1nAAAAC3RSTlMA+rbVFUecgC7rYhEEz+4AAACbSURBVDjL1dMhDsJAEIXhdeiGpKYWQVKDWc8ReojFc4ReAlPFFQazad7lIGkb0jK/WEPSsZ+YN5mZEP5UrZIP0vgE0Kv3oPlIJlAk8AJM4ASYwAkww2+ABfQg0ImgugPYsfNBVl99kA0AsjOArAPQpRTGHiBB8whxM0y+3skXNltsvMYriIWrpWPA80mFJ5qL3gAfB1/tcAt7rzdiV+HEgs1oBgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-pause{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEVHcEzMzMzHx8fMzMzMzMzOzs7MzMz4IlKVAAAABnRSTlMA6xIU1hVqIuOVAAAAMUlEQVQ4y2NgGFYgLS3RAEQziQFZoxKjEqMSaBJpEAkgIw1ZQlBQRAEs4QhkDeIMDgAWx1gMHyIL4wAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-pause:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEVHcEz///////////////////////+3ygHaAAAABnRSTlMA7OgSFBXMmAA4AAAAM0lEQVQ4y2NgGFYgLS3JAUQzi6WlJY5KjEqMSqBJpEEkgIw0ZAklJSUDsISikpLQIM7gAJjhWp6XcaOxAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-record{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAHlBMVEVHcEzGxsbMzMzMzMzLy8vMzMzMzMzNzc3MzMzMzMxEZ/aQAAAACXRSTlMADPKKKeBxlV6neZ4mAAAArUlEQVQ4y2NgGDZgJhpowCURAJeYpIQENJEkCgWRgCeShAGyjfgl2EqwS7BFToZJiLg4ICTEImdOh0pwRM6cDJcIjpw5E6aDFeh8B5gECBCUYAkKCoMbNXNSOlyCgUEQ4apJJmxIEkjOVWFgxi4RgEsikGQJnEYp4pLA6VxUDyJLIAUJcRLIwY7qXKSIQvOHWCQODzKIleBPPjgTHM4kijNR48oGkajiYUMykwMAAfmZhUjBISQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-record:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMA8gyMLeRw1x2DBpWGN2QDAAAAt0lEQVQ4y2NgGDbgDBpIwCVRAJc4KIgEZM4EwCU2KSEBHySJCcg29iBJGCBLgHUs24FdYlnNYZiESksDXKJALebMaagES8yZw3CJypgzZ2A6WIHOd4BJgABMgh2XBEtpaBjcqDMHs+ESDFyLEK46aMGGkEB2rgQDJ3aJAFwSUSRL4DQKp+VHcTkXxYMoEkhBQpwEcrCjSCBHFJo/1GIO408MOJMPzgSHM4niTNS4skENqnjYkMzkAEgzyFpeX6L3AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-recordStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAOVBMVEVHcEz///////////////////////////////////////////////////////////////////////99PJZNAAAAEnRSTlMAMPndsnZj1CSYPcmL6wsdoU80pOJLAAABu0lEQVRIx5VV26KEIAhMA++p9f8fezatFDPr8LSrjMxwiWlqzRuMYKW0ENH46c3WuGyVLXEduuO83UyK59fl1jX5EEUXD9DOaSh43XEP5zUIdZ4pAecTofVnWSt3ip4rx7N61vjnY1D30CpH4QQR8vsP+RA5Rs3KpjfMU/pMim/LgbvH7DF2F8sU0owqapKLqgnhuGWwImUagn2zhUX6WQQoYkXG9WxSAJd700/ygsCpAoliaDsPiG48GM1X5Ft/06sfp8DrDE+3DpekWjxM6366fgEcnklC+AIIWYQmPEeAaUmjFOnhCLDfxZRH+w1gU5b/DYjfNcyJ0p7dxX8B+FwxQVtvAGB5ig0d5gFA5KbzS91hI8CenvlHflfN/XvzJQnxbBEko1gbvVnPii+FadSVRUEaYylQfJtpLB+aRG4LY/80yKdUbCraM0lozGR4ewZ0Wtnj1iC7hjWKNnjYmR62W15cLlL3+2pyMR09jccyuyUrHKsvthc5xsY1iWJ0Xk3t+2XP7AnWwrAQmBH6asXubmL1Z5Lz6o992jWiu9lnMSiQsK27FS9NxhCumZgB2fTBPFsFolhZr5B/D3o9sJAI6skAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-recordStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEVHcEwimP0imPwimP8imPwimP0imPsimP0imfsimPwimP0imPwimf8imPwimPwimPxLmg1rAAAAD3RSTlMA15sisGUvdz3szYwMT8H+hDJEAAABx0lEQVQ4y3WUO08CQRCADxBQchBiMDE24KswFlw0Wtig/oHzUWglJBZWio3GDjUxlhhrEzT+ABMrO2iptLLVRluDggI+xtmdXW73LkxxNzvfzuzszNwZhhDzdOxqaPGgYrgkOgFczh90ezAJQmpL2v6OHYnqk2aWxOTtAnu/O/Y5XNZXmTZjo3ot7aESwLdFeqAM0MoJkMf9ltwVQJ9PcQN0UFIJogvdJgLQVFMsAlxyBaPmVBDCE8W7qd+2SDsx0q4OwhSrCG134W54jDfKLjDNxaL8/9AAMM/solptRnoALBbwEPWYrOEzLnrZsTGoMW+fBHG2SiLPUNI6KMOH8QS/XsCMBYQekIEv7NGZF/Rht2yqmA4i3UG9O0iTqgMfhirDhRdU8XJZqqEO8tDAqje8IIt1r+I5HmBjfD9AxQ1MgJQRpc6GJRALHOAS1WRlhMs4VaSFzwIWzCUF3op71kdNsNs/FDCuA58YqCQl7IhN3WbDnlLtfjnuON515WM17c7w41QPOuBIzDT5wqi0T4ESGV3gjtTjkuPATwHoX9+cPRlmmvJ57YAir2qKy459QL/UhrS/uAu3xf8KiX3DI+b22t6jc9F/qfaum9E1pJ4AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreen{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEVHcEzMzMzOzs7Pz8/MzMzMzMzNzc3MzMzMzMzMzMzMzMzMzMzNzc3MzMzMzMxdHBitAAAADnRSTlMA8AwGYt0aUcg+til5kgmZywUAAAGWSURBVDjL1VM9SwNBEB12IcGkMagxNktQSZFCYimIJAqKpZ3Vco3YBYs0NkKQgBg4ECtLFSFVCGgQrERBsLayPE0Ip7n5De73BdKLTrE3ezPvze6+GYDfsAQKy/Rz0i/OZJjY9XREuohTKulS+ZFGiADfyZXU5uHktI44VH5apDx554aXwJqloiIwiEsStAjCAsRNF1jCmGqa4Vc+BvS4JkjwzyPE6xiwzsxxeTbZxqjkANSWZFkoIj5bQBl4aBDfkPDNpeRRialB+SRAFz8UU1sAaEUjSCDoJ7iukZJ1V+c01bFczM1pWaa+a0Rp7MHn4V8Z1R9vLLCv9WjKdVFfk77JP+bZdz35YAfKXx6KhKp93abUYVbrj49g9aAYSuFCLbPUwzdCsYEWTloXgw1oGwQbENeuKwxzXhxwAADRMFd+zzRc6AAASY6RH8VjUHaXTrlOpDgCUP3gelc01e2d+f16cWbnQ46BGCRNVsWAWQJVw2xGfUXVv2k1OsLfazXqblzS99u1FwKFvBJioXBY2+r82U75Ab7O0ypVV0wKAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreen:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcEz///////////////////////////////////////////////////////////////////+GUsxbAAAAEXRSTlMA3clDHfdfDQbsVG00u4Cqkr04dRsAAAGaSURBVEjH7VXLdsQgCPUBAROdjP//s1UTDUxsz3TRTc+wC94bHsLVmP9hkE8LIdvgupt2tFhcpy2CMZyVxNePEoqDp4hwEGz5PTqWoZNzLrmD9riltBEYzzpZQ8bweXy56Qy6Tivsp5JQYtawuMH3eJlSxIJtdSSa4xer4lMB89pK23mKrwjZVpsRzLq35vEE3+r26h6w5EKppcp3fP2lIpTPWJvoXoobeNI1sM3haHvx56tu2sdElJ54GbnPQ7RZ1sCpl8qPEMXBNQ8vN82jNbzLCPzGSDOZj/2Bqd19R1rELIEbDFrUJfKYdlALbDuDMko/hz7t8DqtCfr8h1Vt4rn7eh/6Ph37ch20aW8McsfGCOXzcr+GOlQG1rJ2HSHUDO/4Mu01qVAqTCpCJfgZ3phTS2pKm5aZOMUbs7Q6nk6L8UzRh6W78jH+gD/VRxHokPuNgUGTaPPR+zDR1mrlvcGgwkAVacSbeoN4Z0rb5/6XLrW/2GTLk2NhXHRKzrqAt9cD4rr4ddvae0NAYgOICdZyvPj4UYRf2BdfbB8iWvnTUwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreenExit{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAG1BMVEVHcEzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxi4XDRAAAACHRSTlMAf3WqJmy+7azWNnMAAADNSURBVDjLxZQ9E4IwDIaLfMzCOTDSOz07OjLir5CR0dmJFVHIzzZtnMzbOzcyZHnuaXpJWmO2ji4GhpAzzZeQzw8FKCj1pMHss9OgpwsGOS0YGOcVUMPsfBVkmJoVCBJW0FFB6SFIaMKAlRGDnEiDkuM00lP3SmL6H5QSh+iIr9ZWVWntUV9Z4qWbHAWrhcUYNLC4Wwm3xb1r2mOQYoVn2EKFAVb81KHiQQq6L3vSUoMBUmSzgCKbVeiL3eTp3Odf8H1sxRAZZNZt/Vt8AHcPQbiQQVF+AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreenExit:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMAe4Fzh7MZbKPtN8gpX19xAAAA3klEQVQ4y8XUIQ7CQBAF0CWhKQHDGtQKQFcURUgqEARBED0Aoqp3IKnoATAEW8MNOACmhQYKcyi6uyjmr+aLqXj56bSbVoh/J3HBxcw0ZfA2c3FiQLGeQcWh1lOVDDJTAeCbCgAR6QqCDj0xCEU5Bl2BIALKMwhdKjGILRUYfCIOEynlvABANk64M5jabJxHfJY2I76yzYu/ZCc0s1WbNYAQ3jxqwMoGHoqWGHpUQajEgcYYcKWFtjLE4FGJQewoxODRDQOqKPPcHl9sfzSXa/0L349tEDsOsp/8+2/xAY+BZBY9KhM5AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-audio{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzKysrMzMzMzMzMzMzMzMzMzMzMzMzMzMzNzc3MzMz8gU00AAAACnRSTlMAL0jMZKt96hGJsSKv1QAAAJ9JREFUOMvN078KQFAYBfCbJEw2q6SUyWxTnsJT2JTJ6D38Gb6n5PpT6BwbuaNfTnz3fEp9fZwAP7czD0MsGCzBYJcEYsGwBEHQQRB0EII1CMAWdAOzyJUvJ4jyDVyZVHKGpj9guEI2IuhaDFadYnCkIm9I+kPgn8t+kI7kOsT72HcwQnJR9Gofy8DrwwtHK8pLzdeALg5fNb6cdJ1fOjOGYrl5CLFcggAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-audio:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMAL0TQf2frEaZYt8E+idL4AAAAnUlEQVQ4y2NgoDdgUcAuzr4Hh4TaGQHsBp3BLsG+BoeE2hnsEkCDsEqADMIqATIImwTYICwSEIPQJFhnBjKInUGSUA2CSPCcOcIwB1ki5xRM4iiDDrKEzQlsEuUF2CVY0jbgkDhjMLQkEkj0IM4gQQ1EHMHOOXMiakRpTiQQtXgTA+7kgzvB4UyiuBM17myAM+Pgzmq4MyfO7EwjAAAEf+BAxqI/agAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-mute{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEVHcEzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMztXryaAAAAD3RSTlMAHd4P7ztyiy1OnKhdx7uY2gyAAAAB8ElEQVQ4y72Uu0vDQBzHE45C3SJFaSGjUEiRpJRCBifXokkpSv0DfOBrEKxUUSoFH9ClFAUfU7c4OARRCs5WjThIsJuDlLo4ldvPe8SYxGyCt1zgw+dev+8vHPcvYybvfCR2OgUv2CoLdI62bUn3gq5UJxOomZofXPUNrIChJRklfcDSiKK2bYQ6PiCaREk0EQoYPFYa3F73F+DGsBJLmAjBAMBKakG15KAxqIhd2KuK5reRccBDNbqGJhfSlnNc/kBh4OY+vaoR5QrRC0afKgxMrKdXNKI8yxRENpyd+i0VA6wMm5IOBmORCwfAFjGwolofevbuPrvpGhRgpVaqiJflrLuUQQFRToS9l894EMDe7q6yL7/G5wMATc5mQCiAvQo3HAbwLtyYHQZgTxhohgGUa/CP12EA16W2/Ou4ZEj1dNG9oPMkZGiwJWQ8j+huPoJy9Z/XHTfUFSbAURveCtE5px5vs7hQDKS25FSDn2KR5Up1/lRmIHne7BvKd82LMRJbSjr5M40lmaYZ5/PRpiCpizjJyk+CwOGOzACLpSdz02QxkiuRhd8dNOwkV7zl2YX1mcySKJrQiPkXY9klSt6rkJPRwIlmzrcWSGyzHuTb11V/N0y/S6SdwdCR4m/47OIN7XOQCfwJwHGp8IcfyRdBLEZK4Uxp6wAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-mute:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAP1BMVEVHcEz///////////////////////////////////////////////////////////////////////////////9KjZoYAAAAFHRSTlMAbk2o8o0P5TsGnVojFi/XHcV9urLaq0oAAAIQSURBVEjH3ZZZkqswDEXxLM8T+1/rkw0BuwM0f131+IvDyZVk6SrL8p88QCHp8UAnWmoWoG8AwQRN4/vOiqwUuwWqiob646MMhEW+KnMLMIXffgiZoODBusb7kCzjByF7OOszkOyp4amJ7fWVPwCN6BpyWRypvANPCvi7u4aTXe13YI+KkYA5bMRTSMlLnSyGwisSH40B0FJOrKVB6iAw2U7sGgPgQ/DTPQjitCOZT4Q6gWCtGwGFbSM34ENUNSpAKTACmC31rnRgJwjDdkFAJpfkAsZcAJvCSVQB2FaWWKdB/ATMAHwIUYL21lRBZRDiC5AnsBHBUqxEyaraFMoz0AnvHNa6xDWS34FGgNf6PYAEZoCt+BroUWFVbeb5HbCqSvB2cToyca+Adjlycdawt0C/HeyScl1W/w3gsU3aAd7JF8AuAN6isr7NAogXAFeq59Ec7ifAm49hF8wCMWfVNXAeCAkjEGuBr6R5ZGJzBrl4gGniBME+w8aMMyCsNZtfaemnmYaAQ6I3Rz0fnDhHJxc93Vrr7sHWjP3XRtTba2L3EkdFVaPC6YmXxKI9DGF1YPLdiwfD2r37cL5nDVw+uKzU5K27hsXCXPtyC2uyyl0D0p2TY7VaIvFYWU0Dm8TdOXmrVp52HG4lU4K/N38PpS/Kw70dbmb/sC0WCcQwNNzzjrzUj7veUyIIyL/4m/EP8V829O8zh5EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptz{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAM1BMVEVHcEzMzMzMzMzMzMzMzMzMzMzNzc3MzMzNzc3MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxDm1AzAAAAEXRSTlMAHqw+E8It/gjxc03jhGDTlgAjE2kAAAI6SURBVEjHpVbZkoQgDBwg3Of/f+12gtfMbK1Yy4NampCju4Ov1y8ruNyyo9fyCibVlNW6vUu29GpWQwTVdPTernqwffHex0WP4Nro3k+PrMKCvew/PcZ95aoNsY9yua+cGxTZsnf2K7ch4CAdGnWwYx/5LgKZCgxGdrhH3BeqNmnwviFXPZbQJmcM25HJ5n7/Pczr2QqksMJfO7BJOHLKLWFdMiL1QXYRwFagMklb4GB1zS7s8Le3fqH7Q28tVLkKdIzeaOJB2OKtY8KfTQCUa4++dNsLbrqpTR7xguHGt8hfg8P+seuaEkNdBjahzOD7g1cHP21SL2LtMNBKMdTRJjffTX1wVgrsEb1ITJU6QknwYJAcQky2cE02NbzPp70KyKggtpu9xM7Ik+CBIqY+8FrYyRUkrs+MEm1TG6tG9LZxNDNFGDue63TYGgIHqUUcuNhvhyZtn5LnlDq3Juxa4noCuX0scErOpNMDCrVcHPCS5rFGuQR9KZpxnB6CQ0ZO+AIBcTPk3UdbTx1L7jLEEHsMW7ZYm8NlIFyxn8+xdL7MURYEhzd5k2N2TabxIAORwC2r00QQfNSgrnqTJfh7cDmDu9ggtV0EZFr7kGu4KAxtNDln406TLwF9iZCIwn9EfjPuncRHYm5x3NfK3cFAS5kWxljSnTFlPHBAUFg5HsCCVOd9cdwXq+027un2QJlMjqISJutCDceRtTTuT4+1Q3HWHR8cu0fh9sGvADTYH9iLah/9nPz5+/MDJnQfoIVoAnQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptz:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAQlBMVEVHcEz////////////////////////////////////////////////////////////////////////////////////1bZCPAAAAFXRSTlMAeVoYDS1pBiPv4/g6lkzO2qSxvoixscijAAACi0lEQVRIx51W2ZLcIAwcLnPf+P9/NS2wp5xkq0ziF3ZRC3R0i/l8fvi04oxx89n+RBi1sqB38TKw7lw7lNzDa3U0e57bHhJ4d567HlqGC08eLAj9Gv8XD4/OwtsdhlfCW2s9LfWtuNrMhG1uLWP17Xh14LF4m8dx1OJ9jkm85YCYch5JzDVy81on3MFYkpTNYGmHHloYI+aqlNhlh5ZSvmH1AyBUwPcMX+u/clW3XYvA2YgRGXyZIZX6PXv0l3GlV9Jp9FKcK7mytJIg8xEeBdaBtV4P8tAixexnp73tY7ZBkrk9WEL8t7ZUDqtIA3jXa8sODSeUVqw5aztT+g4QeNAgM0PGTA0+EmfVeUvU0CEW4hX+lt/zseE7jJKDSmi0EUKBhr7EAMKPvNjOA9Fz4Yk/CFgcGRSdkYOHCLRxQfzKRN5SB/b5Ot8SzzQiKqcb6ipFdCfi1JI84OBdxzarhJ8RkpxHOQszl7bpn0GpmnXq6R4OfTkwwlyUWzeQg7rSLNhNUzEUEqJF3DMHeeXgqRIaYwHimLKipK8hMZOYVfJ5oKtIFSgXk5z4KcNx3GOIPGYfPigh9YGHBNQKVKbZhxMnqq+OHfWBHARZfWm1dnfSXfJuXInplse8wy39zkisdQ5kuLY+Bpc5hwGiH8Mx1rE24DFaLqXkfrNVkjk+8JPTPF0bUw+R9MCVuA8ks/xDyF/9orMqpBQeiob5RbIbmv7/TxvoX1Oqa914TsYg7QUWx8Y7R89JQY8mY6Dat1G5GARuMOgYHY9cbL1vNvc++fk67olLk4nrQSl7457OPqdeKn+vEwm4LPzW87DyXvqIyei9znHS+cZz9SxV+Qf8nNbjn37NkDx4+PmCXzHOLUMtjgmUAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptzActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcEwgmv8imPwimPwhmP8imP8imPwimPwmmf8imPwimPwhmP0imPwimPwimPwimPsimP0imPoLqfILAAAAEnRSTlMADprCJBnU/gXwh3LiUKxAXjJ/ELXKAAACbklEQVRIx5VW2bbjIAwLa1jM9v8/O7Iht+09MwPlpS2VwLZkJ9f1lxVG1joPdZ0u1ZIxurhv8DH6dMpQI5t439GAEc7xYPgTRnAtV7plReRhd5kDP8+fd+wzt70yPhIJzWT7/6DCJCAYLReZPMIuJC4pClSktHqbNpJO1aTmmAme3cvtWs9NSfq52CPhnJNjlbVHwgmWSWGHeQHcKFjj7fygwidf2fa4mbVOuladcnsoDn9/CKKAWf6HEtpANiJvUp9Fgr0SvocPP/sqjOCK9ktpyCAo4Kt/d4n4/6baseNKAt5XrauPN1A4ZLAd30RUI4kNfELVx+yd3lrXYIg1Bp/B/dGs5N8mPsJoVyiwkofQSlm+K9aiwmoQMDoI4wefoK/rhkESrSuV+BR2i6HZH9juLzxCtBmn6rFmB66gNJQwBOSxncT/N3FAlxAoLQfJDy2+6rMLI3aznl9fhOcGSdZzoNhex2K3TXJEVe3M4Zb6QhHuJc5BWakYIqqietcPw6FK+EHofUHRqtLEQ5X8dKVENXXgEpLOpcjwkFI30YFVHE8fyx2ShZJ/ydTKlZwZ4BCOv/af9uMi0DILe4kieynScgPbhai+DRDckTT6N6zJpI3HMghM3BMg+q9pHmwrbR0Q0D5wc0JHPy0E5Ur7Nf3Rk68LnR0NHfO28/T5P4cNr+uLFR7eEdiNxvMRbd5Onlqsis4iIVdme4di3akWOz+3T0aUnFWHa8QZrO51NO69MeLPafrNuBenxel/3d21j8k/jyxf+75OQabFxOtuT94G3Lpjzb0zBn2Dl0ep/waPidQ/p/XB60Dp7e8F/QO7WSJg4zEzdwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptzActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcExru/9ru/9qu/9ru/9ru/9ru/9ru/9svP9ruv9ru/9ru/9ru/9ru/9ru/9ru/9ru/9ru/+3uxEqAAAAEnRSTlMA5q0cR/PC/ggSKtN5OIhaa5izIOiAAAACV0lEQVRIx5VW2ZLjMAiMToNu/f/PboNsJ5PaKWv8kKRkWkDTQF6v/zyUfO+JX9sP1dKKd/v2acQcm992kbo1R4il7iHIif0BRNtCUOozH4cikAdt2YfjRLTnzN15/8I85wFCI2xDzlnyMLO7R0aFoTzbFGB+jIkYLkyePvmW8d2fs2ZfZuv8It9s6zvV5uSr2LmKb9oVh37QvpjYOcf8fcO3Cb1jGqOU0SvTTd6X2KUBLgKdLzaiDtE2n+isTh8/+AX7E6/Vh/NNSyfVm10RXIe1nxXRapmsDQB7SMnkmE0IxgqvUn0jteEf1T2CHXgr0gjZllGk1HoJL7lD7fRpD20CgJcwQ6EdSh3lLK0zVfuqz2WvPlPJh7HqnCQ4MysxoAYQE0vHub/toRuqzRy5pEUvbg62MzlJQn1MHBe1x7WSAddpNDSN1c9wRMhKfi2jrICwAIsQvHkD7Al41bOrBNC1Y7QdmSg15LDokGETJB/imxYJKfmFMDqI3FjUkDS3NSEDjBaxknRYSb+4nj4kC43W2OKrkqGB8jV2Fq03YiWbhHQTpUV1mMHXWYf8HlNX7ZUQRC6iwBAIK0r0ILr1UxqKsPattAkhwSIiMl76bT/Ft/TbTy2jHQoM7Cz9isHVMb6GILl0H4DGivbw7xNc8rAtiJn3O/qvD6JT/wgs7Y370ZSdWmbZWEKiG1lXImldW7Q1jGMbZW9tUVKZmGjjGvf+EXAqzWiX5OfFSHVp/zjbfGPc3whdcbTF67V2N1e79qYMru2/AnzVYFsdWFt/+nOypv8vQvoHou4gOtSrG5EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performance{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTM7OzszMzM3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3NzW8hQDoAAAAMdFJOUwC/gO8ra6tUQNmVEKtAA1gAAAE4SURBVDjLzZMhT8RAEIWnpS3tXcWdQ6wgOJIKfFdUICv6AyruB5w4EuSJCwRXgUBWkGArLsEi6JVuaZkfxawguSWz/p7azLdtdt97C3ASagp+PpeXPDjHVx7McMWDCBc8qPCZB4m44YFIeOBh+ckCf9z+sCCYqi8WvA/5Nwu26cfA+JRBs4h7WmX/tr9AXcQHAPdgzEPZh5idTQBOZ3zyiModISKQGxZ7dd85E0SKfMGjM7vXeI/5AE5LvrwpcK9IOrQYB5BlCsFIvjzgrkaSjsBZbmC9XsGsAxfn8gKXpL9sSlnQFBwFTTuaKWXgI5Ar+sfHTrW6DUDO+2jEEtCNQ9wL6gNujMvvdFS3eugxGT51fBXxTvF1wLLngbT0BGphKalAy0MQ3Z4Ha2V7UoMFJKkFVAWcvH4B0OJfd9YsTl0AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performance:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwD2qdfrViyAwW2XORBGtSCsD6SyAAABN0lEQVRIx+2VzQ7DIAyDYfxToH7/p10CbQ+T2s33Rb1MijM3/qDG/EurolD9zSNRggBU0hFelMABmenfADhGkJDhGUFGgiX6I1AAQlDgZK/td8ELtQORiTmIq42I2bYdCD8NjzPmYQxO+rbn2S5qzEUF6YjkgcJude56X3s0SoL7LRAeylyaVPiFq0Jyx230mpeXmXVOHssRbhackhCq25Sny++xcBW1n6Snqw6BTgrqRP6kzfDcgmRLGonDWSf2OecwB491dOrEVZpNsxiyiHzWJ0Z+BbBwzaoWVb49HrqVfSkxHen7WNznLhzl8xpQlT3E9oHUtYaufB+7NY9g9ctbjFfj/h1DwXUrzDltMn1Ql9M814EQWPLmEBg4R7JSzpFQxTmSBMkLvJKOhFHfKEEnv3L/+qw3DuMPzAFH9pIAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performanceActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAtUExURUdwTBGW2xKV2hKW3BKW2xGW3BKW2xGW3BGW2xKW2xKV3RGW2xGW2xGW3BKW2+P2IvgAAAAOdFJOUwC/gCvzq1RAleURc9VmrA9rXAAAAT9JREFUOMvNkzFLw1AUhU+SxtTahnZyC+IsIeAenDuE/oJQcS/FTYTi6hKcHYpDZ/EXBME95BeURpM0Me39Db4Mgk/u23umcL8kvHfOucBBKEr5eW95xoMjeuBBlyY86NOQBwt654HrPPHAca/YuUHrDQsG9eybBWa1+GLBqvS3LJiNX0vGJw/R0N6LJ+/f6x9I3uwG0D+luRU0FnmdCtBy6ZM7KvQdjgXwJYuNZVNrFfqF8IX+nFm/oBvyS2iZ8OWxgH4u1IZmU4kgfoa5E77c0jwhoTYCbTRFGE7QrXFCveCURkK/2cRBCp2gFYiyWk7Jw4AgXOmQZMAqa9uAeCP+JsViihtb9OKIPtBUuvy8jeqyHRpMhvc5X0W6Lvg60HrPg0DREySOoqQJKRbByRWbExaqlSoVwB0rwCLFwesHquttxhcsa64AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performanceActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTH3G63zE6n3G7H3F633G7H3F633G633F7H3F7HvG7H3G7H3F6xOzy+EAAAAMdFJOUwC/hKbvK0BT2XURZct0z00AAAE3SURBVDjLzZMhU8NAEIX3LiSUNqI1qBMMChFRgYxAd07E4CI6HQwzEUXgKjC4CH5ABAKJyA+oaHqBJO3+KPaYYSZh9nyfyuyXu7l77x3ASSgu+flYX/HgHOc8kC4wwikPMnzhQaTueKAiHvi43bFg0m4OLPBM9sWCjyb9ZsHm8NkwPiUQT8MjfSX/fn+F/C3syJf9YB7oLsDkjIaiHix5QCNbGBmAFPve+3lXi/0viLB3ZnmDz5g2ICry5daAvCbZhSE2oIsFeC35ssJljiQbgZitIY7nIGu4wLG+xBnpL5tClxQhCANR1Q5TSmCCQK7YjftOVbYNUOxot0EsHl0uwHdFfcD14PJLG9W9HfpMho81X0V8MnwdcHvkgS4cBcqVo6QKHQ9B1a6XY1zAcSiIFg6QlXDy+gEd714RcAqEowAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-face{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTL+/v76+vsDAwL+/v7+/v7+/v8DAwL+/v7+/v96T4QgAAAAJdFJOUwBAgSCbs9hZap+hQJoAAADvSURBVDjLY2AYRkAJCAygbEZBQUEBKJtpJhDAOJpA9kSYxESgKphuIaBuhASqyYzESjC2hDRilQBZ64BFgm2qMLPYNCwSkQpAwlMBWYIRzJsKYrKCxZSRncKSDFYzBSNY2MD2MqRhSFgqgClPAwwJBxwSbAk4jGKZDCKZp2JIsEOcOx0ztjQDYL5ENwsYJKrTsMSvGSgepzVg2pE5qSikPRPT8sopBuDod0ATZ54JsbZyBrJgAVAp1Ax2oPXMykjxYQaLA2CMoERUZQDMrgBUCc8CKIdzAvHJhyQJpLQLSu0TCaV2lPwBSu0KQy+LAwBuJj5UbruNggAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-face:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTP///////////////////////////////////////////////w2imYoAAAAMdFJOUwBAgBvfrFmcw4wrbtGliFoAAAD2SURBVDjLY2AYRkAJCAygbEZBQUEBKJvpDBDAODpA9kGYxEGgKphuIaBuhASqyYzESjBu79yIVWIP0NoCLBIsR4WZJY5gkYiZACRqFJAlGMG8EyAmK1hMGdkp7M4gkus4RrCwBIApFwwJmwlgqsYAQ6IAIrEAwygHHEaxngJbfhRDgg0sxHoMM7Z0AmC+RAPsJ4S5NE5gid8VoHg8sgHTDh/PzM60HkzLc44bgKMf3RKuMwoQ+dNIgswJDAycUDPYjhgwMCsjxYcJLA6AMYISUTkBMLsaUCVqEqAcngPEJx+SJJDSLii1HySU2lHyByi1Kwy9LA4AqflRBKNSA88AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-faceActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURUdwTBCT2xKV2hGY2hKW2xGW2xGW2xGW2xKX3BGX3BKW23povfoAAAAKdFJOUwBAgRybs9hZLG6hrV9tAAAA80lEQVQ4y2NgGEZACQgMoGxGQUFBASibaRUQwDhaQPZCmMRCoCqYbiGgboQEqsmMxEowTgmZiFViFtBaBywSbEuFmcWWYZGIUgASXgrIEoxg3lIQkxUspozsFJZkEMmxBCNY2MD2MqRhSFgpgCkvAwwJBxwSbAk4jGJZAbZ8KYYEO8S5yzFjSysA5kt0s5YKc6guwxK/baB4XDYB045Vi4pCyrMwLa9aYgCOfgc0cY5VEGurViIJMhcAlULNYF9mwMCsjBQfZrA4AMYISkRVBcDsCkCV8CqAcrgWEJ98SJJASrug1L6QUGpHyR+g1K4w9LI4ALk0RHtSETFcAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-faceActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURUdwTHzD63zE6n7H7H3F7H3F633G63zF7H3G7H3F7H3F68TinBIAAAAKdFJOUwBAgR+Z31ipwW4yAjb9AAAA+UlEQVQ4y2NgGEZACQgMoGxGQUFBASibaRUQwDhaQPZCmMRCoCqYbiGgboQEqsmMxEowTmmZiFViFtBaBywSrMuFmSWWYpGoUgASXgrIEowgHtsKEJMDLKaM7BSWYLCaJRjBwloAploxJKwUwJSXAYYE2KUMVRgSrAFgKhTDKPbFIJJ5OYYEG1iIfRlmbGkVwHyJBlhWCDNrrMASvxageFw6AdOOqKCklrQuTMuzlhiAo98BTZx5FcTarJXIgglApVBr2ZYaMDArI8WHKSwOgDGCElFZBTC7GlAlvBKgHK4FxCcfkiSQ0i4otS8klNpR8gcotSsMvSwOAIs+RIlIrewIAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-object{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA51JREFUaEPtmT1oFEEUx9/bnRALGxE70btkZjcR7QMiRisRbCzEQvxCLGyEhCDRBC/RoNaWFgYLFUSwUBAUDKKFFqIQ3OzNJpfCyspS8HaejNyG87J7t7N3l03gttydefP/vbcz8+YNwhZ/cIvrh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no3je0tH4G/KbtRT7VUKs8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-object:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAwdJREFUaEPtmTuIFTEUhv8fLSxsFrET3UIQRHtBRNdKBBsLsRBfiIWNoIisD1xfqLWlhYuFCiJYKAgKLqKFFqIgoiBoYWVlKbjwy4HMJXs3M5Nk7tzZCzfdvZPk/F9OHicnxIgXjrh+jAG69mCpByStB3AgQ+AcybmqdpJmEvv9SvJhqE0QwBm4lGikqD4VAaCMvh+R3NffrgzgB4DJDCPWpC2AYN+LACTtAPAqU3wsQGr/pikPgGSnO5Ukgx0DNJhRzZp27gFJBwE8J/k7B6UzAEl7ANwEsNEJvwVgmmTSFjp0AEnbANwAsDUw4v8AnCZ5O9YbQwOQtBnAdQA28nXlp/NG8HT1G7cOIGkNgKsADtepDnx/C2CG5Muytq0BSFoJ4DKAUxnC+5s8cSCf+j+0CXDBjAJYNgAA6+Keg7AwpldyAXqBHMmpwKjYyThJclbSSQBWfyIT5IF5kuQ3SctJzjcCiBHhxUu2GM24gRx1IGtj+gDw2I34Z0mrbXcC8JdkUqidFecEAj4fZD+A8wA2lYA8NVCSHyRtcGvouKtrg9EJQKHVB7Ht9ByALe7jCwAXSb6TZP+dAbC3D7JzgBDITgDzJF9L2u2gQoectV0yAD7IEffjDgC7plaVJQdgYotdLOYSMwaI2gETr51jD1SN6qDOgSobw/WAywltLxRVhBIxi7LxInaxUCHHFvmCpFkorWInoR8LheqsA2DB3LGIRdPIAznBXC1AIVrSKncwVYXUMQB2Sl8h+SYQOCanVaIBPJAVAM5aqBAIr6sAnjnh78s82aoHQkYlWYwz7YXXIQCLRK+R/Fg3BYcO4HnlhPPKIfefTYX7dm8m+aVOuNdP+1OoSow79KzKL5LfY4UvGYBUwZ0s4qYiazzY7RRqCtfZIm4qfGBrAEDle1e/0FDoUTKvUxiT3gfsaWlBbibFUsyDiKSkBK9nf4LkH19P2RvZ3cxUIVoEmCVZXE97DFXPrJY52JUy+lY3Ji2S8cxq4i3jsahk3QdSodqsPwZoc3Rj+h55D/wH5CHfQHNA9EUAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-objectActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA9JJREFUaEPtmU+IE1ccx7+/N7O0BwUn24UeRKOd7LalvS+I6HoSwYsH8SCtLf1jEqWoyLJVMfEP6nlNIgi6eFChCB4UChaU0h7aQ1GQrnFSdw9e/JNs9LTFzPvJZI27m8xk5k02m13I3sK+33vfz/u9N+/7fo+wzP9ometHF6DTGfTMQF+mYNqwd6sKlFLcK++P3WsWF8nkUyr9stAeTcXN624xrgDVAUgcVxmk1lbaGPIFyFocou9fSonYzvo4d4BsYQLgaIhB0EYA174bAFaNWpuFhrthxDsxQQCMrKXUPwGbvfr2BSglYh39UjmwXYCwy2kh4jqegd5M/itdaL8+i5vPwwB1DMDIWNuJcBbA545wAs4V4+YIiJQ+oYsOYGTzGwniDIANLjP+hkCHiglzNGg2Fg3AGB3/Ugj9NBO2+4ujSSaMeJ2uc+PbDhC5aK1GhU6CeY+/8IZz9E+CnSomBn7zim0bQF/m4QqbPkgDOKgufH4EAzdZaKny3vUP6vtqG0BvtnCUwY4p01oFcOIZuCJ7elKvvo9OtLyESMN7IzeViA3VC3TshiY4Wkz2j0Uyj3+aMX5shAIhuia4kn6Z+DSPu6xjiCotAQQRMeuXaJJYpqsgOetbcBV8TZA+ANxgotRU3Hz48SWr7800DjHL6VJyQMlqh/I5jYZvFsTI5XcRa0cA/sLDv98iieMv98X++Sj7aEBCPwjwD9W2LNMdAqhJnQMyc5D9DGBwRhzukK4fK/647q9I1hoE6DDAO+ZBdh6gEaQ3V9hi27JS3tf/u3Hhv20kpQPldsgthQw0fOcnpc3fVK2EhosEmE33x9LJwKxM54Lj/Ap0SeoCBPz+qVw7uxnwmdQFOge8R1n0DDg1ISaxqSbJy0oE2pTvqhStbOK5FQy2ka6vOTVkoL6o5VaVWHX+yVoh7KMAvvPbNq1mQNmNBgGoiV55fry3R+jOweRpqQMBMO4wxImp5Cd/tGynVQBqg0UvT3z4eroyDMaxenvdHIBvE/GJYnzgb69MtjUDboMa2ceHCTQCoGqvPQBuSOZT5WT/fb8luOgANUFGxkoQYVja+Lq2iQm4ygKnS3tj//oJf9+PamUuzBJqJsY59Jz/9wh6+iJpFoIKXzIAqoI7solbFdksvmN7YKGgugAMNH3vqp9pN+vhtq5VMqT2PpAbjwrW59VmVAYL8iASCfdGBvm/bpQPrCvP1eP+RpYrXA5XKgTaBkA0Voqb1eupL4DToFo5YLlVZfadtkHKIqrPrFLIsXL8s0k3LaHuA6pQ7WzfBWjn7Abpe9ln4C11Qo9Pmb2aMgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-objectActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA8hJREFUaEPtmU1oU1kUx//nvthx4cJqX3RgGLsQBNG1tq8Z7axkwM0sxIX4hbhwIygibfPMeyapunY5iymzGAURZjEDAwoVm8SPhSiIKAjtQtAmiooLiyb3yEtNm76+5L37kjQp5C2Te879/+65H+eeS1jlH61y/egCtDuCNSOQyH3cWirNHVIXKO6kYvqdenbxqVlLxS8J8Txp6Ne9bDwBnA5IiIRKJ5W2LDHsB2BmC6zqmxk3UkP6AbedJ4CZfTsNcL9qJ077VgHU8r0MID5V2EsCk2HEBwbIFdT8M/aGBkgaelt3KtOB7QKEnU9NsGt7BMyp2cOa4P8tY3M+DE/bAC7cK+xnxmUwtjvCCXzFHtRHiEhpC11xADOTjwG4BCLDY8S/MvhsyoheDRqNFQMwc292QmppEPb7i6MZgEdqna7V9i0HSNx/95MscRLgo/7CXS0IWS6VrFRs8+1ati0DSEzm18kesgGcURa+3OAfSGklY5ueuP9qGYCZzceZySKC1gQAgPkvXtNjpXatn258CmlYSOSSg/qwW+B8usH9SSM6Ec/lTxM7iR/3hgEh4Jpk2Kkh/UVikiP2MBUbAggiYjFfchajtB0QM/fuOFg64D8H8QHQTQ3CsowNT8cffdLnPn8+KyXPpWKb1FLtYJ0tbbU84asCyRYOEmiMwTtq+P63JJAYH9AfxTOFbUTlNXRyPlmTdpsAKlIXQZyDDJJGGbx7/l++BSHM5EDfg7HMm91CRM6B+fdqyA4AWA5iZd/++hWymDaid+OZ/G8EGgXB65DrhAi4Jw3NsORj5VRC4A8AW+tN2Q6KwKJM54b2HcD3EtMFCLojqVw7uxHwGdVQ992OjkC5JqSJPRXw2qlEsMpFo1OonMx9/7gE211z8iirLC1qeVUlxrLvtwgU4wBO+K2bpgCoVSX8ASqiRx682hgp/jBaL6UOBsC3pMTFdCyaaUI6HRyg0llicnptqWfdeTBMd3pdH4D/kyQupgf7HtaKZIj7gDpAdefxzOw5IjECoJxeewEQ6CZBpmwj+thvCq44QEWQmZ09BYjzLHFk4SQm/C2KIm3/svGZn/AFP+qVucYi4BbmbLnOb5rGr+zB6MugwjsGQFVwWxZxoyLr2bdtDTQLqgsAQt33LvdIe6UenvNaJUQqJ3Hi3ut+KSNLajMqfQV5EAnzRuZoEF8ivfZw74dqPbXeyP4MVSoE0DoAmkgafeXrqS+A08CpHBDTPpXRd9oGKYuoPrNqETlhD/w446Ul1H1AFaqV7bsArRzdIL5XfQS+AaeCtE+rbksUAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusion{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACCVJREFUaEO9Wn2MXFUVP+e96X5oa9UoYpUszrzzZlqLKDYhgAFaaKU2+M2W9Q8TNUQSQEsiRUjFV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7BJeq2nIuIviUgr3v9LaDSdFJFjKR7vtMcYOxXVRWPMpY7jCBE1PGiz84k3F5G7fd//Sr/CW80YR8SROK2cvYFOKSUzr0PED2hGZYw5ISLHrafUx9QI2uICmFY1RORsx3FmEPE5EXne8zz1mn2Pjiml1d+ekvrmqHO+K3hWvvZJvb2ensoqCwmgq7KK1eGttnuyNqsSvVAAtGINAE9oF6hjYUsB2EaG6vWx2La3U96FAmAt28jU1NTqZOMjtbhrGxovZJXVFwJAXGYHgPPS6lVtS+dxY6PT41wIAFpe79To6Fj7j9PCdmX2TvF6vzYzLqtrgyX2MWk8M5sXcaNDRLQjeft8Vaxj4bQSLSJbEFHjsraNjZg+E4AS2obHTzRb0kxsvirXVm1vBoAT9Xr9y2kNjeQtdAVAF9kQW5PseW+zzszMjCcbGe1UsmsAMYOURveTc62nap1TRNYsSKM7eQIaO7mu+zkAWAsArwPA45oXdPNTAxutaillsTqoKIruW7CfGqRdpRaHReSj2lvo8scezyDiY1qc7dda9axC3W64UD+3+Q/fZENVhTDr2gAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusion:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABphJREFUaEO9WmnIVVUUXSuiuahopOLLIqTBBgtCC01Ty8JmS/sRVESBNgiVJVZaaag0WBlGYNEPrSyiQdTKskEjpNKSCBqlzAqJSAsbYMV67vt13/3uffe+93pvw+Mb7rn77HXOPntY5xEdEkkHAjgk1G8k+VMnpuL/oVTSaQDOBnBmGG3DfwHwXeg/DMC+ADbGZwWAZSRXtTt/ywAk2eDLAIwAsAXAkvjY6O9J/pk2TtLOAA4FYDDnxmdPAG8AeJbkslbANA1A0gkAbgJwKYA5AJaS/KCVySWdCmA0gFsAPAfgIZLrmtFVGYCk3QBMDeNfAjCb5MfNTFY0VtJJAG4FcL5BALiX5B9VdFcCEBPMB7ALgPtIP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iG+dGxP83WZUWd3C95YIkN+hmGlxKONqsJel6pi2pO8RhUF0YlXQKgDU5s9xGsuY6kh4MiiU9bHRCUEmyC43J6NhC0rV9W5IXRusSWaywV98rnZURJFdI2huAD1mSaaeSnBHgis7ISpLD2rJ+++L1SWT3RB9ghqwmkgzKjX1WNgMYRnK9pAsAuAxYTNLRxu+5l1hYYGRuBGoWkCQzgu4L7kjOgP3WodRRIAGQGJen33VLch7GJr8HAIdCh8Q8yW3MWwDwWS2EkqvS/YBJ2UsyvehHAPIO3QSSj+VNLMkJzKRUViaTdNHYlgSf+jxJk8R1DY3byQ05GS/vMNaSSvii/VEkaxlUUjr5JMY6gt3QluX/eYZLlJ6k+KvUUkpyqj8+OirH300pALWiLSHAJJnVMK/kusqs9RqSTjptS3C0+S1lrF5TTX266uw0gxf2FTf1McDkUWVapZsAKtEqAcIu4FJhZBkT3S0AwVib4lxCspjYCgC+yLBf+0DXYnuRdBGAI5trK+efuouPInLXodMhtCGt3g0AKZp9YB5f1Yhe923JokaHs0sATK8XXnSUXXAkbWEuzd6oXm83ZkpKaPVpSY7J01l6eZFcdESX5cu3jjDWiXHBRLvpcV1WeLGRjC8FEAfbienx6JZmdZC5tttOBuBkeW3ehUZ2FyoBCBAurWv3ZdEPd/Ka1W5Td5FR5JKVAaS2OHvRbX6mJT41eE5TM52/6M6uQNDxlzvhAdga91gusat81cDVquurPQA4QS3s2lcN8rYyyOGzfLdQ8cseLsiWu7NrN1o17UJVJ+zW123+BfogD+TkdLQFAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusionActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACItJREFUaEO9Wn+MVNUV/s59+wOqyM7bFaxAsDBvFqnWak0MYhBQUEqUVssi/aNJawg7bxaKScFqqKyt0gip4sK8XUKqjX/IL43RlqBSxLZWYqwWdWNh3oIlFClkebMUaX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A/pyJlqnm8KXtdKt9glz+Qe5ZtNayP2ZgwKJjRiwZMyw/w7pl71JNqQHrh/nRZCyyoVxn8+W9fqpGrzhRY5IXupdCJvEiwMfzK57vYswc99KxKGdDCHaihldB+xWfDDiDNyfNyMqhOu8lD6860+TssbKkI6WuSj3oW0yYSZBnwHxKEc3dtGUbYF5Xg/k6CNHDTB9o4A87zfBHl8P5okfKNLvyDvV+BC6Ho4Uwih7qlVK5bZWRJFBSWyUTw+sJtLCSMC+oEz1SBNIda+xj8J6ijS1FQF1kdLtjVYE6ns3thaZ0pAhkMtvkUdq5OfkXHwWau96FxsdBbfWRIJBts0vCLX79qoKt8+zFRrH2+ogQsGwudtFR/IIjeyws0GYvtl8fajbKttVBaM7WGD/MwMuL7EUHwBuRoqeGq2PdV1C9TjSvBWh1sYuNrHwgAS+9pi88tgIYx0TPDFfnOhO2jwI4Iym13O9CI38WSiLgKe1qrwp1VjePxDVrsq6nOf8io1BIlk4gg5B/0S01emew/VSvz+ny3BG56M5/A6odz6T9kIB5DHwFxtsssbuUTw1IYDEI8wm4koF9xO7LI/apgd9UquYwS74HzHeU+LHHeyToLdWcHWq2KjuESjU4Up/b/B9u0kgtWdqPkwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusionActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACJpJREFUaEO9WntsW9UZ/33HaZJCX7S5TmhalQ1NaAzGYJUgvk7pe5QKusGa0v0xaZvQkKBbK60BWl/b8XWKaLWtUJg6IcG0P+hrCMHWlcdK2OLrFPFYGdU0ac+q9BHfFPoC2sQ+33SufVPXvfa1kyaWolg+3+t3zznfd87vu4Qx+nQfONc8yF+0KvP1NPHoxjsm9Y+FK7oSRo2+fh0I3AUpFwHUyoxWIv6EiI4o+8w8m5mmE+EowEchxH4g95rZ1myN1v+IAUR6M3eRwCqAFgM4C8Z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akHfzLa4J0Zdo4oNMe9VlZ1pYyoUk/i62DSAc6wlMfzpf7ioc0lwAqsxnUEugDB7yCLd8127f0rEXzFK2U+e9R2qfcCcCUCLWej4qXeAVAjrTKeAKqiVRQItQQgaLng3BI/Jnq8ACjGWlLgTUjeW5HYUgCcRsZgfY9UG7qQ28tN6XgBUJlNCJoj6gcXlDY+PMndwmb5wI9WHw8ALs0O4tu8+KoK9Hq+sVGJXh8PAHl6vXyjo3KDo3AtLEezVzqvjzYbubQ6A3G3xpQ5nlR25TY6iLGF6kRyrBhrNwrFRHNWRpiwvlJjw5WvqvuSb3gEfs2gIAFPjhVznU+VeJTAGSFyP/ZqaJQ+7qoAKCXV+OBTdnw82qw0TYuXNjLKrZOqAbgGShvdLOitkfKpiuckyQvHpdFd+gQUHQ9B3yPGEhDOAfwGS9pT1asGgldCNTgYk5igCtSL4/aqgddUKnIY4G8xc7ialz2IKAXQ64qcHW22qnkJVetwvF63+T9nAHfjRfzL0gAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-logSave{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA1RJREFUaEPtmT1oFEEUx9/bFLFKJzG2WiknZObFxlO8RtFC8SuFWlrYGBtRRNCghV9YmFQWgoVaaAS1ULRRRKvbmYBBQezVYBOIGFMkT0ZuYXPufOxdspuDO7jibmfe/H/z3sy8eYvQ4R/scP3QBSjbg8EemJyc3La4uHgUETcx82YAWNum+N8A8IWZrxLR41ZtBQForUeY+Xarg/j6MfMVIrroa5f13AuglOJWDLfQ56aU8mzefk4ApdR9ADiW12ir7RFxXAgxkqe/FUBrvYeZXzQbY+bh3t7ed5VKZTrPQM2eNHYQ8VGGjTtSypOhtq0AcRyPIeKptCEppTfkbAM3AxhbcRwfyYJg5nEiCvKEVZBS6hUA7EoEIeJ+IcTz0JlpbpcFYNrYIBDxlhDijG88lwd+IGJ/YoCZ1xPRd5/BUA/Mzc31VavVWRcEM18jovOuMV0eWLL7tBM+RoBS6isAbEzERFFUHRwc/JD8dnjishDikg2iSIAJADiU8uhdIjqRFuZYEweI6Gmuc8AWs6EhVK/XR3t6eg4zMyKiEQ/MvOSwQsS3iHhhZmbmY61W++UIp/dSyu2FAmit3zDzTjMoItaFEFuVUt8AYCB0ElLtZqWUfYUCZHlQKXUQAJ60AAC2Nbhia8AWglprAoB7jYQwmGXVACSKzRqJomgLAJjvBh/JqgPwCQ7dRAoPIZ/w5HkXIHQGQlOHvCd56PjdEOpoD6TShT/MfD19OXeFQCPnOYeIaxYWFiaGhoZGQ9Pv5nZthVA6XWjkOsMJRGj+b/IhIURtVQCkIUJvYKUCONLf/+67tjuw+T+rLlTYLmSDCDmwbOIbF6CgC1Vba8B3m3JBuMQXDuC4iGQy+MSXAhAKESK+NAAfRKj4UgFsEHnElw5gBGit9wFAUqy9kbco1vY2Gsfxsha2QrbV1K42gIimAPDvw8zTRLQuy0ZhpcU8AMZ7zPws1ee1lHJ3LoDlLu7mAcioZFuLvYWV130AU1NT/fPz8zuyqtWIuFcI8TKXBxo7QaEvOCyQD6SUx20T4K33F/iKKVOj7yrqBWhsiSv6ki8zNBBPCyHGfKEXBGCMrMBr1mZtPxHxEzN/jqLoYbr07oIIBvDNRFnPuwBlzXwybsd74C95KWhPrxIhsgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-logSave:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAthJREFUaEPtmTuMTUEYx3//TrWdeLRUJCrReISGUBCvLVAqNGiEiASh8IoClUKyBQqPBAWhsREqnYRE9NgoV0T3yci5m9mzc2bmnHvvOXuTO8ktbs7MN//ffPP45hsx4kUjrp8xQNcezPaAmW0EDgFrgLXA0j7F/wG+AlckPW5qKwvAzE4At5p2ktHusqTzGfUWVEkCmJk1MdygzQ1Jp+u2iwKY2X3gcF2jfdS/I8l5O7tUApjZTuBlwNIk8E7STHYvQMCTzs6jgI27ko7l2o4B3AaO+4YkJadcVcdlAGfLzA5WQGR7IgbwGtjuCdoj6UXuyJTrhQBcnQjETUmnUv3FAH4CyzwDKyX9SBnM9QAwIWk2AXFV0tlYnzGAebtPP9OnEPkNWO2J2STpQ+9/xBOXJF2ogmgT4Amw3xNyT9JRX1gEYq+kZyGIoQGY2UXgAPyPt5x4V8qH1TRwDvgk6XdkOr2XtLltgLfA1qLTj5I2mNl3YEWDdTQraaJtgAVryMz2AU8bAFC1Boc5hYKbgJmtB6aKgDCbZdEAeLuOWyPrit+qFMmiA0gJrjr4yu1an0Ip4Z6Hss6hMUBu6FD3JB9PodwRGGkPeOHCX+CafzmPDUAR85wBlrgwQ5LbUueV3AHsaxGbmR8uOAGTPYga8f+0pG2LBWAOosYNrFOAqith6L5bdQee81optG7nHIjE8DlnVlB8EVa3AxCJ4VMAleJbB2gAERXfCUANiKT4zgAyILLEdwoQgcgW3zlAIWA30EvWXq+bFBvESTzQxFZqSyqdAe7i7xIAvTIjaXnIRmupxZoAznvPvTZvJO2oCzDQ5G5NgPKbRGWyt7X0egrAzFwedktFtnqXpFe1PFAsxLYfOEIaH0g6UjUAyXx/i09MQY2pq2gSoPDEsB/5QuJPSnLrMFqyAAqIQT+zloX9Aj4DX4CHfuo9RpANkBqJrr6PAboa+V6/I++Bf0in3kCazcMZAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoom{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAkUExURUdwTMDAwL+/v7+/v7+/v76+vr+/v7+/v7+/v7+/v7+/v7+/vxtcv/AAAAALdFJOUwBVdZCpGdZE7C3B0wnY6AAAAV9JREFUOMt1lDtPwzAQx20ghGwVsHVJhQRDlsywWKqEULsw8FhRJ2iWiglGGJvFCw8xIVVCSEwkKU25L4ftpOHs2Cclsu7v370smxCLecRh+xOH8Ja5kGEs/6dtYf1XONcWZurbwwRCQjYZ9l7uHAPAOBHpI1QC/QSY9g84ldmnAn7Z3htwsfZnvSe54eJd5hlcC7gccxTwSETZEr5+714vLRdfkFraVNtetXLpR7ha+mkHCV1Y/q8ZOW8AgDkecsIaAEIcGbIGyLUq4KcBYl0o7QAB4FZACBMrQKpaJOCZQqyAIhgayYEpgD1DZghXCvBTNJFKmCvgzmhcCEsBwMjSRx6BslYftRX0JLYKrAsLqzDC54EFMwvy58QhMM8hFNq0UpwET+sLC9/4BmEBTytyRCIbDoAEiR1Qp1dbRxfoyv9g3ogaKVuXhVZZbtqX6Ez6H23PxG4CM259QDwt/h8ABfK8nDqSAAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoom:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwCCyreU7KZVRCDaZnETLwj6WaYVAAABUUlEQVRIx5WV2Q6EIAxFoVBWxf7/184AOnGUsvTBqDmXrqRCzNou1kwGtyZIQNuiD0P6evWTURFUMtIoPO+iVoGIZPkMqkdKA0jZgoJ6suQc2EoiGBldOoQ9HSDk5+GTs1Fqo9IlcEpvNv3qv0MBhSalIFSv3+MCJCY8fUaCxasycrMu9dp5VTUhubXZ6CqsAvn66ZAsx+e8fON37oT3bZ4aiRU0kDlavGSrQI95HPBZACt8FuCL16IruBVkzBeBW+CLYHvyfiDQd96IpHpOMqP++fAq9VMQ7rwrM5+6gjwG/3y/D/m8ylPYpvpAeqO7DfvwMPO9D6jnBabG56YFZx77fEjD+9AyLdYEhp8nxoNh5wmJtfY8AS+wzIZZrJNcC4h3wV8IH1p87Iyfnc6XVaAd7ICHAsebw97zgDSxZ/yvViiPuYUfTe650knM2+7Ywz9yOCklzohLOwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoomStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwDjmTC6Y0KBVakX8s8iC3JYR1wyAAABVUlEQVRIx62V2baFIAiGcwJRS97/aU/Zbtht0VzrcJOuvl/AAabpXy1RF0F/m2h2PX5mzucEuO9gMon1MY7KlG8w4LImC1XFQmxDGVkm1DYpXi0qS1gXTEGzKoqNS1ajAxPqJDikFLcFS+aukYJffRfXnAj9kYUXFVi86wzzPjuCFRXBwS3KaC/Pt02Ww7uf1jz3BVYtX/OsyDQFDn7yswPXb+Ovs39eJJWwxrOXV4thgC+//QBf/uMAXwAa4AuRBvgdWR58CB2B+eaRG5e8QO7Jn2sIAvzhbdsDnXzev8q0BengGXv8EciH3y1CY5++yI/BRNx82g/La7lc7b0Am/tUC6n3HoZ4SbDyy5BgzSNivV6wbPXeIPOpHlOU+CjkTQKvQOpXdRdJvn+5xttWQa4EZUOzluonT6+q72X6Zb0+T/lNhQd7hg9vm8LWUhW5gT4iN7c/0ZUo8Q3AttYAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoomStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAqUExURUdwTBKV2hGW2xKW2xKW2xKW2xGV3BGW2xGW3BGX2xKW3BKW2xCX2xKW2yDN61kAAAANdFJOUwCAVKxm3T/DmhrxKw97YQBGAAABaklEQVQ4y2NgIA6wGqCLMCqAqV4HdIm9F0Ek22UMM9hiG4AkVzQDA+cmx+YyJJnDlw8wMNQaNpfevbu0QgxJgrN3JQPD3VvhjU57kESnOZqvvXuJgcEXxVFMEkDt1w11gZYwoVgue3d5SzaQSgCydZG1TMkBU8vBuq9guBcqNBNDgj0GQrMEb0CVYEmA2ViANRQZ795tQPZduADciXcVUNSthGu4hGrAJawagBIXsWoAClzGqgEocRWrBqDIrQNQDTPRXZ8A0cB41wBNQgGiQfbubTQJAagGDB0GIA0OsnevbkCTCADiu4J374ahW34JqAEIbiXMRJOAgkvMKJYgJBx6717AKiF4F4eOu+jxgQCXGHBIKPDgkBC8JYCURJDtQHYWN4oEcvpZiyR+C9lZtkgSKKG1CyGOGrxItleixjrcLFBWRAYcMIkG9NQMiY67N7AlcxAQwMwA6SBxM2xZQ3jtVRPsRQ83sg8ACMIUxzzE8wsAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-close{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTM3Nzc7Ozs7Ozs3Nzc3NzcrKys3Nzc3Nzc3NzePZJxkAAAAJdFJOUwCtKdPBGAmNTt3jdDcAAADfSURBVDjL1dOxDoIwEADQgwR07GTCZtI/IGHgAzBhM9EPkMTB0Y3V0ZXIcn/rtRR6pefgSKeSu3ellyvA9lZ/5F9p/3K7PZY8oPG5BD6MpPUSgIITzdIStifAshjRQV1PCFT8TxaicTzzwEwINOEdHVmDmcTAkRhMhMAp7iQRjcMtDhCp8SA1v0ARGIIK/gnkv0p1OBTS4QRUIpE7DiYYXTBrzcld3JIrAarXrps4AVNwRSZgExoJmIyAaAdsShUMn/JF2fh4YEkpAcgvnuwYCIb6EbbbP4PsDfLD2dD6Av1qTvAQlzUTAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-close:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTP///////////////////////////////////8kBMKEAAAAJdFJOUwCt0igUwJdJePGbgLgAAADcSURBVDjL1ZMxEoIwFESTCaOWFDapqeicnAALTiANnaWlnVewDTMW/7b+aCAb8jkAVIHN2/lsNkrt73lf8M08nnF1pAYFR/dFmAAx7SIoi4iDbRrWDMAuQFzmmxAGbjjJgjj6dCjMCAND/o8RWQMzUgIRKYE/wsC5TJIRR74rBUZaqqXwLZEXT0WTDGwLW1aavJWQir9qadw++NgykWoMNtcykh8Q5EECgr5C+jjpGjHjPGhPU5eVzyfPJitfnUyhPg6ywMKZ7BygcYcsPCj1Kc8uXYPqpeSLs6PnC4w8S+8OJ9MLAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-narrow{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABm1JREFUaEPVWWuIVVUUXmvfYRosHzUZUUqKjkSXSe5Z+5qJhfawLELCR5ohPhKjjB4EWgkpkopRSWEPS1Mqy7Gkd0iPGaKy6ey9Z3z0opwEQytSMiS5NZ4Ve7j3dubMOfecO96buf/cx17rW+vba52919oH4RQfeIr7DxUjoLW+BhHHAsAAZh5gPwGghpl/TKVSHZ7n7T9+/Ph+ANg/atQo+1mRcUIEtNYzAWAiM09ExLPK8KgNADYw8wYp5Z9l6PUQ7RWBvON3AMClJ2Kcmb9DxAKR33qDVRYBrfUNzLwQESf0xliUDjPvR8T1RLSsXNzEBIwxc5l5fYSBnxGxxfO8bQCwN5VKHc7lcofr6+tzR44cGcTMg4UQgxDRfp8IAJdH4KwlooXlkEhEQGv9EAAsDQF+GwDWEdE75Rg1xlwFADcx83QAOCOg29SvX79ZDQ0NuSSYsQS01h8BwBUBsF45HnTIGHMBM9uFmR2Ya0bEWx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LAlb75hUS0Nkw+6lbidkTspoCI6aibgUoSU0otR8QlBUxE3Oo4TleNlpiAFQwWUfa/XC7XZ8yYMccq6bAfS2v9OADcHUidqUT0RdkE8iS+BIBsQHkkEe2qNAml1HOIeGsA914isqQiR5LL3aMAcHoAYTIR2av0Ex7t7e3ne563mplvDoIh4le2xC+VurEE8pGwh1m3/sBec3ie96iUcndvWLS3t4/o7OycK4SYw8znRKZIDIlEBPIk7IrfGDB01JIAgJZsNtuShIjruplUKmWdtidsMLK2lFmFiPP8fUapSCQmYJ2L6cDsNfh7iLiXme1VjG3GOwFguOd5DYg4HAAa7O/Q3QTRXiavchxnhzHmIgCw3V6xWYoiURYBa9h13atTqdTssJxNEoEImQeJaIV/LimJsgkUjCilLrGXToho33mFrmoMod2I+LLneW9KKb8Nk01CotcE/AaVUmOFENcz8zgAGAIA54Y4dAgADiCifejtjcQnSSIWRgIAniIi+5q3cm/q/c40NzfX9e3bd4gQ4kxEPFhbW3sgnU7/lcThJJHwV8kViUBvHStHz0aCme2qe7W1tasbGxu7rkFPGQKR50Q5q/B/lP0HjgOoT/ydvaYAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-narrow:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABS1JREFUaEPVmgmoVVUUhr+fosKC5ogGSsqIpKQwMqjIBpsICdMGQ7ISo4wGApugJCoxLClssElpNEuaI5okKjOI5onKhEQrSiKiaKA/Vu3zOu+8c88593qvj7fgcO99e6/h33udtdda+4khThri9tM1ALaPAQ4Btso9GwNfAyuBb7JHUnzvCq0XANuTgePSs00bFr0L3BuPpF/b4BswtSMAyfDzgYPXRznweQ7ID53IaguA7ROBGcC4TpRV8IRL3SNpVrtyGwOwfVYoaaHgW2AZsBT4CliXnt+BXYBd02d8D5c7rIWc+ZJigRpTIwC2rwauKZH6NLBA0jONNQK2jwJOAU4FtijwPg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YYKkaKWvN9neGYgT//QSYR9Hil/lurUAQqjtOMyK9UEkWXMlfdgJihTn45CK1GCHChmVIBoBSCBixU8qKIrdmRuXG5LigqOWbO+fjA7jizsbqcxsINLsfJ3REkRjAAlEVQUWbfDncjc0UYz/BewJjCh8lgGNZvJsSctt75MabLUg2gKQQBydSrwyn63dgRYTrpQUdwR91BRE2wAyDbYPSk2nuPOKVW6X4t15EHhS0mdlzE1AdAygsFpxwX0CEJcUuwM7lhgULhW5VRgeHYnXmiBuAeI2SXHN272b+gKgzRKQrYFIBNdI+qOJwQ13oi8/68oOdGpYO3xpJ2LV/45zI/t3hSEDoBXYIQ/gH99H3EBePlczAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-expand{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABvJJREFUaEPVWWmIXEUQrnqzZseYxGM9QBNF4hrJEDfzqieuAY/gFRXPyMYbzUHwQBQUzx+KeBAJKhrRqEhEQWMU75AYXREPlunu3bjxIDGraIwiuJpFkL26pMK84eXtm3lvZieGFAzsTtf1VVd3V9Ug7OOE+7j/0BAAnZ2d2UmTJl2cyWTaAOBA+TDzgYjYDAB/y4eZ5fNjc3Pze7NmzfqlUYEbFwBr7TUAcAEzXwAA2bROIeKnzrkNALBeKWXTysXx1QXAGHMVANwEACePxzgzjyLi057nrczn81vr0VUTAGOMRPtmRDy7HmOVZBDxL+fcyr6+vgc7OjqGatGdGoC19hZmfrKC8t9LafEWAGzLZDL9g4OD/S0tLYM7d+6cyszTPM+biojy97kAcGoFPV8ODw8vbG9v354WRCoAxpiXAUDyPUrvAcAqIno/rUHhs9aeCQALmflyAJgUlkXEf5xzp6U9G4kAjDHcKMejeqy1xzDz/QBwXYyNViL6ISkwVQEYY74AgLkRJcuJ6M4kxbWsW2sfZua7ozJNTU1HtLW1/VFNV0UAxpjlAHBHWNg590ChUJCINZyKxe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LBX8X8rJZ2S88n7gSOBaGiiMg3aBEyQ9FO7Cgx0v+1ooiJEN2iapEhqfaispcyLuo5uYSAAbEf7GBOJBkXpcETZdKIMwN7AGiAtJS6QFIluq5DtlcBJdVy52VglD6nBa6ykLwYbge05wB2JnLckNUqcfuJbDbbS0qJxcJik6NQGhWzfD9yYMI9ucKqkGByXUtVo8ceSOmecpE+6jcB2XsqEiFmS5reSVQVgNNBbeyeMwioxSh8w2Y6GPzJ+2os0+H4OxPtr6rqVzbbtMcBXJZpGkTVf0qedoCjifCSpq4B9WvBoCaISQDC2PQKIN5GPF6MqjCuOsqOpn6bK2R5fKB3K75QpHpPouUAkvrTPaAqiFoACRMxpwuqNniE3WsxrXk++0EQzHr3rwVGSZP+WGTymD3MlrbEdLerzdUDUBtCQaDvSeXyQKPPZTrwpztwuKS1h4tZrgWgbQALkaOCy4hNrn1FHTRTxdmKQ8LKksjdWC0THADK/jtQ/BQhQBwBl7Wi4VNRWoXhMJN6tA7TJTSyQFJ95u/OlPlfEdjzOALI7EIVgzEfb+nyaGSh3p4h+Pd1jV26gjiUHuqe4ibD6eklRqvfQkAHQzABDHsB/7aMVT352GH8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-menu-icon-text,.jb-pro-container .jb-pro-quality-icon-text,.jb-pro-container .jb-pro-scale-icon-text,.jb-pro-container .jb-pro-speed-icon-text{font-size:14px;min-width:30px;height:20px;line-height:20px;cursor:pointer;text-align:center}.jb-pro-container .jb-pro-speed{box-sizing:border-box;text-align:center;font-size:14px;color:#fff;width:90px}.jb-pro-container .jb-pro-menu-list,.jb-pro-container .jb-pro-quality-menu-list,.jb-pro-container .jb-pro-scale-menu-list,.jb-pro-container .jb-pro-speed-menu-list{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;overflow:hidden;width:-webkit-max-content;width:-moz-max-content;width:max-content}.jb-pro-container .jb-pro-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-speed-menu-shown{visibility:visible;opacity:1}.jb-pro-container .icon-title-tips{pointer-events:none;position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:rgba(0,0,0,.5);border-radius:4px}.jb-pro-container .icon-title{display:inline-block;padding:5px 10px;font-size:12px;white-space:nowrap;color:#fff}.jb-pro-container .jb-pro-quality-menu{padding:8px 0}.jb-pro-container .jb-pro-menu-item,.jb-pro-container .jb-pro-quality-menu-item,.jb-pro-container .jb-pro-scale-menu-item,.jb-pro-container .jb-pro-speed-menu-item{display:block;height:25px;line-height:25px;margin:0;padding:0 10px;cursor:pointer;font-size:14px;text-align:center;width:50px;color:hsla(0,0%,100%,.5);transition:color .3s,background-color .3s}.jb-pro-container .jb-pro-menu-item:hover,.jb-pro-container .jb-pro-quality-menu-item:hover,.jb-pro-container .jb-pro-scale-menu-item:hover,.jb-pro-container .jb-pro-speed-menu-item:hover{background-color:hsla(0,0%,100%,.2)}.jb-pro-container .jb-pro-menu-item:focus,.jb-pro-container .jb-pro-quality-menu-item:focus,.jb-pro-container .jb-pro-scale-menu-item:focus,.jb-pro-container .jb-pro-speed-menu-item:focus{outline:none}.jb-pro-container .jb-pro-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-speed-menu-item-active{color:#2298fc}.jb-pro-container .jb-pro-volume-panel-wrap{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%) translateY(22%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;height:120px;width:50px;overflow:hidden}.jb-pro-container .jb-pro-volume-panel-wrap.jb-pro-volume-panel-wrap-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-volume-panel{cursor:pointer;position:absolute;top:21px;height:60px;width:50px;overflow:hidden}.jb-pro-container .jb-pro-volume-panel-text{position:absolute;left:0;top:0;width:50px;height:20px;line-height:20px;text-align:center;color:#fff;font-size:12px}.jb-pro-container .jb-pro-volume-panel-handle{position:absolute;top:48px;left:50%;width:12px;height:12px;border-radius:12px;margin-left:-6px;background:#fff}.jb-pro-container .jb-pro-volume-panel-handle:before{bottom:-54px;background:#fff}.jb-pro-container .jb-pro-volume-panel-handle:after{bottom:6px;background:hsla(0,0%,100%,.2)}.jb-pro-container .jb-pro-volume-panel-handle:after,.jb-pro-container .jb-pro-volume-panel-handle:before{content:"";position:absolute;display:block;left:50%;width:3px;margin-left:-1px;height:60px}.jb-pro-container.jb-pro-fullscreen-android-rotate .jb-pro-controls,.jb-pro-container.jb-pro-fullscreen-web .jb-pro-controls{width:100vh}.jb-pro-container.jb-pro-fullscreen-android-rotate .jb-pro-play-big:after,.jb-pro-container.jb-pro-fullscreen-web .jb-pro-play-big:after{transform:translate(-50%,-50%) rotate(270deg)}.jb-pro-container.jb-pro-fullscreen-android-rotate .jb-pro-loading,.jb-pro-container.jb-pro-fullscreen-web .jb-pro-loading{flex-direction:row}.jb-pro-container.jb-pro-fullscreen-android-rotate .jb-pro-loading-text,.jb-pro-container.jb-pro-fullscreen-web .jb-pro-loading-text{transform:rotate(270deg)}.jb-pro-container .jb-pro-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;left:10px;top:10px;min-width:200px;padding:5px 0;background-color:rgba(0,0,0,.9);border-radius:3px}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu{cursor:pointer;font-size:12px;display:block;color:#fff;padding:10px 15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-shadow:0 0 2px rgba(0,0,0,.5);border-bottom:1px solid hsla(0,0%,100%,.1)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu a{color:#fff;text-decoration:none}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span{display:inline-block;padding:0 7px}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span.art-current,.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span:hover{color:var(--theme)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu:hover{background-color:hsla(0,0%,100%,.1)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu:last-child{border-bottom:none}.jb-pro-container.jb-pro-contextmenus-show .jb-pro-contextmenus{display:flex}.jb-pro-container .jb-pro-extend-dom{position:relative;width:100%;height:100%;display:none}.jb-pro-container-playback .jb-pro-controls{height:48px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center{flex:1;display:flex;box-sizing:border-box;justify-content:space-between;font-size:12px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time{box-sizing:border-box;flex:1;position:relative;height:100%}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-inner{width:300px;height:100%;overflow-y:hidden;overflow-x:auto}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-current-time{position:absolute;left:0;top:0;height:15px;width:1px;background-color:red;text-align:center;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-current-time-text{position:absolute;box-sizing:border-box;padding:0 5px;width:60px;left:-25px;top:15px;border:1px solid red;height:15px;line-height:15px;cursor:move;background-color:#fff;color:#000;-webkit-user-select:none;-moz-user-select:none;user-select:none}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll{position:relative;width:1440px;margin:0 auto}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.one-hour{width:1440px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.half-hour{width:2880px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.ten-min{width:8640px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.five-min{width:17280px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.one-min{width:86400px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-list{position:relative;background-color:#ccc;height:48px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-day{height:100%;overflow:hidden}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-one-wrap{height:8px;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-wrap{height:25px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-btns{display:flex;align-items:center}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one{float:left;width:1px;height:8px;margin:0;cursor:default;position:relative;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one.active,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one.active{background-color:orange;cursor:pointer}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one.start,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one.start{background-color:#999}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one:hover .jb-pro-playback-time-title-tips,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one:hover .jb-pro-playback-time-title-tips{visibility:visible;opacity:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips{pointer-events:none;position:absolute;left:0;top:100%;visibility:hidden;opacity:0;transform:translateX(13%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:#000;border-radius:4px;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips.jb-pro-playback-time-title-tips-left{transform:translateX(-100%)}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips .jb-pro-playback-time-title{display:inline-block;padding:2px 5px;font-size:12px;white-space:nowrap;color:#fff}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute{float:left;position:relative;width:60px;box-sizing:border-box;border-top:1px solid #999;-webkit-user-select:none;-moz-user-select:none;user-select:none;text-align:left;height:25px;line-height:25px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:first-child,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:first-child{border-left:0}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:first-child .jb-pro-playback-time-hour-text,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:first-child .jb-pro-playback-time-hour-text{left:0}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:after,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:after{content:"";position:absolute;left:0;top:-8px;width:1px;height:14px;background-color:#999}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour-text,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-text{position:absolute;left:-13px}.jb-pro-container-playback .jb-pro-playback-expand.disabled .jb-pro-icon-expand,.jb-pro-container-playback .jb-pro-playback-narrow.disabled .jb-pro-icon-narrow{cursor:no-drop}.jb-pro-container-playback .jb-pro-control-progress-simple{position:absolute;box-sizing:border-box;left:0;top:-2px;width:100%;display:flex;flex-direction:row;align-items:center;height:8px;cursor:pointer}.jb-pro-container-playback .jb-pro-control-progress-simple:hover{top:0;align-items:flex-start}.jb-pro-container-playback .jb-pro-control-progress-simple:hover .jb-pro-control-progress-inner{height:100%}.jb-pro-container-playback .jb-pro-control-progress-simple:hover .jb-pro-control-progress-inner .jb-pro-progress-indicator{transform:scale(1);visibility:visible}.jb-pro-container-playback .jb-pro-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:all .2s ease;background:hsla(0,0%,100%,.5)}.jb-pro-container-playback .jb-pro-progress-hover{display:none;width:0}.jb-pro-container-playback .jb-pro-progress-played{position:absolute;left:0;top:0;right:0;bottom:0;height:100%;width:0;background-color:orange}.jb-pro-container-playback .jb-pro-progress-indicator{visibility:hidden;align-items:center;justify-content:center;position:absolute;z-index:40;border-radius:50%;transform:scale(.1);transition:transform .1s ease-in-out}.jb-pro-container-playback .jb-pro-progress-indicator .jb-pro-icon{width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.jb-pro-container-playback .jb-pro-progress-indicator:hover{transform:scale(1.2)!important}.jb-pro-container-playback .jb-pro-progress-tip{display:none;position:absolute;z-index:50;top:-25px;left:0;height:20px;padding:0 5px;line-height:20px;color:#fff;font-size:12px;text-align:center;background:rgba(0,0,0,.7);border-radius:3px;font-weight:700;white-space:nowrap}.jb-pro-container-playback.jb-pro-fullscreen-web .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-playback-time-inner{overflow-y:auto}.jb-pro-zoom-control{cursor:-webkit-grab;cursor:grab}.jb-pro-performance-panel{position:absolute;box-sizing:border-box;z-index:10000;left:0;top:0;padding:5px;font-size:10px;background:rgba(0,0,0,.2);color:#fff;max-height:100%;overflow-y:auto;display:none}.jb-pro-performance-panel .jb-pro-performance-item{display:flex;align-items:center;margin-top:3px;color:#fff}.jb-pro-performance-panel .jb-pro-performance-item-block{height:10px}.jb-pro-tips-message{position:absolute;top:0;left:0;width:100%;height:100%;background:linear-gradient(180deg,rgba(0,0,0,.8),hsla(0,0%,100%,0));overflow:auto;box-sizing:content-box;display:none}.jb-pro-tips-message:before{color:hsla(0,0%,100%,.3);content:"X";font-family:Arial,Helvetica,sans-serif;font-size:40px;left:0;line-height:1;margin-top:-20px;position:absolute;text-shadow:2em 2em 4em #000;text-align:center;top:50%;vertical-align:middle;width:100%}.jb-pro-tips-message .jb-pro-tips-message-close{position:absolute;z-index:99999;right:0;top:0;width:40px;height:40px;display:flex;align-items:center;justify-content:center}.jb-pro-tips-message .jb-pro-tips-message-close .jb-pro-tips-message-close-icon{width:20px;height:20px;border-radius:10px;cursor:pointer;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTM3Nzc7Ozs7Ozs3Nzc3NzcrKys3Nzc3Nzc3NzePZJxkAAAAJdFJOUwCtKdPBGAmNTt3jdDcAAADfSURBVDjL1dOxDoIwEADQgwR07GTCZtI/IGHgAzBhM9EPkMTB0Y3V0ZXIcn/rtRR6pefgSKeSu3ellyvA9lZ/5F9p/3K7PZY8oPG5BD6MpPUSgIITzdIStifAshjRQV1PCFT8TxaicTzzwEwINOEdHVmDmcTAkRhMhMAp7iQRjcMtDhCp8SA1v0ARGIIK/gnkv0p1OBTS4QRUIpE7DiYYXTBrzcld3JIrAarXrps4AVNwRSZgExoJmIyAaAdsShUMn/JF2fh4YEkpAcgvnuwYCIb6EbbbP4PsDfLD2dD6Av1qTvAQlzUTAAAAAElFTkSuQmCC") no-repeat 50%;background-color:#fff;background-size:100% 100%}.jb-pro-tips-message .jb-pro-tips-message-content{overflow:auto;padding:35px;box-sizing:border-box;width:100%;height:100%;z-index:99999}.jb-pro-tips-message .jb-pro-tips-message-content .jb-pro-tips-message-content-item{font-size:14px;color:#fff;text-align:center;line-height:1.5}');class fc{constructor(e){var t;this.player=e,this.TAG_NAME="Control",this.extendBtnList=[],((e,t)=>{e._opt.hasControl&&e._opt.controlAutoHide?e.$container.classList.add("jb-pro-controls-show-auto-hide"):e.$container.classList.add("jb-pro-controls-show");const i=e._opt,s=i.operateBtns,r=`\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
00:00:00
\n
\n
\n
\n
\n ${i.playbackConfig.showPrecisionBtn?`\n
\n
${Xh.narrow}
\n
${Xh.expand}
\n
\n `:""}\n
\n `;e.$container.insertAdjacentHTML("beforeend",`\n ${i.background?`
`:""}\n
\n \n
\n ${i.loadingIcon?`\n
\n ${Xh.loading}\n
${i.loadingText}
\n
\n `:""}\n ${i.hasControl&&s.play?'
':""}\n ${i.hasControl&&s.ptz?`\n
\n
\n
\n
\n
\n
\n ${i.ptzMoreArrowShow?'\n
\n
\n
\n
\n ':""}\n
\n
\n ${i.ptzZoomShow?'\n
\n
\n \n \n 缩放+\n \n
\n
\n \n \n 缩放-\n \n
\n
\n ':""}\n ${i.ptzApertureShow?'\n
\n
\n \n \n 光圈+\n \n
\n
\n \n \n 光圈-\n \n
\n
\n ':""}\n ${i.ptzFocusShow?'\n
\n
\n \n \n 聚焦+\n \n
\n
\n \n \n 聚焦-\n \n
\n
\n ':""}\n ${i.ptzCruiseShow?'\n
\n
\n \n \n 巡航开\n \n
\n
\n \n \n 巡航关\n \n
\n
\n ':""}\n ${i.ptzFogShow?'\n
\n
\n \n \n 透雾开\n \n
\n
\n \n \n 透雾关\n \n
\n
\n ':""}\n\n ${i.ptzWiperShow?'\n
\n
\n \n \n 雨刷开\n \n
\n
\n \n \n 雨刷关\n \n
\n
\n ':""}\n
\n
\n `:""}\n ${i.hasVideo?`\n
\n
${Xh.narrow}
\n
电子放大
\n
${Xh.expand}
\n
${Xh.zoomStop}
\n
\n
\n
\n
00:00:00
\n
${Xh.recordStop}
\n
\n `:""}\n\n ${i.hasControl?`\n
\n
\n
\n ${i.showBandwidth?'
':""}\n
\n
${i.controlHtml}
\n
\n ${i.playType===w&&i.playbackConfig.showControl&&i.playbackConfig.controlType===X.normal?r:""}\n ${i.playType===w&&i.playbackConfig.showControl&&i.playbackConfig.controlType===X.simple?'\n
\n
\n
\n
\n
\n
00:00
\n
\n
\n ':""}\n
\n ${i.playType===w&&i.playbackConfig.showRateBtn?'\n
\n
\n
\n
\n
\n
\n ':""}\n ${s.close?`
${Xh.close}
`:""}\n ${s.logSave?`
${Xh.logSave}
`:""}\n ${s.performance?`
${Xh.performance}
${Xh.performanceActive}
`:""}\n ${s.aiFace?`
${Xh.face}
${Xh.faceActive}
`:""}\n ${s.aiObject?`
${Xh.object}
${Xh.objectActive}
`:""}\n ${s.aiOcclusion?`
${Xh.occlusion}
${Xh.occlusionActive}
`:""}\n ${s.quality?'\n
\n
\n
\n
\n
\n
\n ':""}\n ${s.scale?'\n
\n
\n
\n
\n
\n
\n ':""}\n ${s.audio?`\n
\n
\n ${Xh.audio}\n ${Xh.mute}\n
\n
\n
\n
\n
\n
\n
\n
\n `:""}\n ${s.play?`
${Xh.play}
${Xh.pause}
`:""}\n ${s.screenshot?`
${Xh.screenshot}
`:""}\n ${s.record?`
${Xh.record}
${Xh.recordStop}
`:""}\n ${s.ptz?`
${Xh.ptz}
${Xh.ptzActive}
`:""}\n ${s.zoom?`
${Xh.zoom}
${Xh.zoomStop}
`:""}\n ${s.fullscreen?`
${Xh.fullscreen}
${Xh.fullscreenExit}
`:""}\n
\n
\n
\n `:""}\n
\n
\n
\n
\n
\n
\n
\n
\n `),Object.defineProperty(t,"$poster",{value:e.$container.querySelector(".jb-pro-poster"),configurable:!0}),Object.defineProperty(t,"$loadingBg",{value:e.$container.querySelector(".jb-pro-loading-bg"),configurable:!0}),Object.defineProperty(t,"$loadingBgImage",{value:e.$container.querySelector(".jb-pro-loading-bg-image"),configurable:!0}),Object.defineProperty(t,"$loading",{value:e.$container.querySelector(".jb-pro-loading"),configurable:!0}),Object.defineProperty(t,"$loadingText",{value:e.$container.querySelector(".jb-pro-loading-text"),configurable:!0}),Object.defineProperty(t,"$play",{value:e.$container.querySelector(".jb-pro-play"),configurable:!0}),Object.defineProperty(t,"$playBig",{value:e.$container.querySelector(".jb-pro-play-big"),configurable:!0}),Object.defineProperty(t,"$recording",{value:e.$container.querySelector(".jb-pro-recording"),configurable:!0}),Object.defineProperty(t,"$recordingTime",{value:e.$container.querySelector(".jb-pro-recording-time"),configurable:!0}),Object.defineProperty(t,"$recordingStop",{value:e.$container.querySelector(".jb-pro-recording-stop"),configurable:!0}),Object.defineProperty(t,"$pause",{value:e.$container.querySelector(".jb-pro-pause"),configurable:!0}),Object.defineProperty(t,"$controls",{value:e.$container.querySelector(".jb-pro-controls"),configurable:!0}),Object.defineProperty(t,"$controlsInner",{value:e.$container.querySelector(".jb-pro-controls-bottom"),configurable:!0}),Object.defineProperty(t,"$controlsLeft",{value:e.$container.querySelector(".jb-pro-controls-left"),configurable:!0}),Object.defineProperty(t,"$controlsRight",{value:e.$container.querySelector(".jb-pro-controls-right"),configurable:!0}),Object.defineProperty(t,"$volume",{value:e.$container.querySelector(".jb-pro-volume"),configurable:!0}),Object.defineProperty(t,"$volumePanelWrap",{value:e.$container.querySelector(".jb-pro-volume-panel-wrap"),configurable:!0}),Object.defineProperty(t,"$volumePanelText",{value:e.$container.querySelector(".jb-pro-volume-panel-text"),configurable:!0}),Object.defineProperty(t,"$volumePanel",{value:e.$container.querySelector(".jb-pro-volume-panel"),configurable:!0}),Object.defineProperty(t,"$volumeHandle",{value:e.$container.querySelector(".jb-pro-volume-panel-handle"),configurable:!0}),Object.defineProperty(t,"$volumeOn",{value:e.$container.querySelector(".jb-pro-icon-audio"),configurable:!0}),Object.defineProperty(t,"$volumeOff",{value:e.$container.querySelector(".jb-pro-icon-mute"),configurable:!0}),Object.defineProperty(t,"$fullscreen",{value:e.$container.querySelector(".jb-pro-fullscreen"),configurable:!0}),Object.defineProperty(t,"$fullscreenExit",{value:e.$container.querySelector(".jb-pro-fullscreen-exit"),configurable:!0}),Object.defineProperty(t,"$record",{value:e.$container.querySelector(".jb-pro-record"),configurable:!0}),Object.defineProperty(t,"$recordStop",{value:e.$container.querySelector(".jb-pro-record-stop"),configurable:!0}),Object.defineProperty(t,"$screenshot",{value:e.$container.querySelector(".jb-pro-screenshot"),configurable:!0}),Object.defineProperty(t,"$speed",{value:e.$container.querySelector(".jb-pro-speed"),configurable:!0}),Object.defineProperty(t,"$controlHtml",{value:e.$container.querySelector(".jb-pro-controls-item-html"),configurable:!0}),Object.defineProperty(t,"$playbackTime",{value:e.$container.querySelector(".jb-pro-controls-playback-time"),configurable:!0}),Object.defineProperty(t,"$playbackTimeInner",{value:e.$container.querySelector(".jb-pro-controls-playback-time-inner"),configurable:!0}),Object.defineProperty(t,"$playbackTimeScroll",{value:e.$container.querySelector(".jb-pro-controls-playback-time-scroll"),configurable:!0}),Object.defineProperty(t,"$playbackTimeList",{value:e.$container.querySelector(".jb-pro-controls-playback-time-list"),configurable:!0}),Object.defineProperty(t,"$playbackTimeListOne",{value:e.$container.querySelector(".jb-pro-playback-time-one-wrap"),configurable:!0}),Object.defineProperty(t,"$playbackTimeListSecond",{value:e.$container.querySelector(".jb-pro-playback-time-second-wrap"),configurable:!0}),Object.defineProperty(t,"$playbackCurrentTime",{value:e.$container.querySelector(".jb-pro-controls-playback-current-time"),configurable:!0}),Object.defineProperty(t,"$playbackCurrentTimeText",{value:e.$container.querySelector(".jb-pro-controls-playback-current-time-text"),configurable:!0}),Object.defineProperty(t,"$controlsPlaybackBtns",{value:e.$container.querySelector(".jb-pro-controls-playback-btns"),configurable:!0}),Object.defineProperty(t,"$playbackNarrow",{value:e.$container.querySelector(".jb-pro-playback-narrow"),configurable:!0}),Object.defineProperty(t,"$playbackExpand",{value:e.$container.querySelector(".jb-pro-playback-expand"),configurable:!0}),Object.defineProperty(t,"$ptz",{value:e.$container.querySelector(".jb-pro-ptz"),configurable:!0}),Object.defineProperty(t,"$ptzActive",{value:e.$container.querySelector(".jb-pro-ptz-active"),configurable:!0}),Object.defineProperty(t,"$ptzControl",{value:e.$container.querySelector(".jb-pro-ptz-controls"),configurable:!0}),Object.defineProperty(t,"$ptzBgActive",{value:e.$container.querySelector(".jb-pro-ptz-bg-active"),configurable:!0}),Object.defineProperty(t,"$ptzControlCircular",{value:e.$container.querySelector(".jb-pro-ptz-control"),configurable:!0}),Object.defineProperty(t,"$ptzArrows",{value:e.$container.querySelectorAll(".jb-pro-ptz-arrow"),configurable:!0}),Object.defineProperty(t,"$ptzExpand",{value:e.$container.querySelector(".jb-pro-ptz-expand"),configurable:!0}),Object.defineProperty(t,"$ptzNarrow",{value:e.$container.querySelector(".jb-pro-ptz-narrow"),configurable:!0}),Object.defineProperty(t,"$ptzApertureFar",{value:e.$container.querySelector(".jb-pro-ptz-aperture-far"),configurable:!0}),Object.defineProperty(t,"$ptzApertureNear",{value:e.$container.querySelector(".jb-pro-ptz-aperture-near"),configurable:!0}),Object.defineProperty(t,"$ptzFocusFar",{value:e.$container.querySelector(".jb-pro-ptz-focus-far"),configurable:!0}),Object.defineProperty(t,"$ptzFocusNear",{value:e.$container.querySelector(".jb-pro-ptz-focus-near"),configurable:!0}),Object.defineProperty(t,"$ptzCruisePlay",{value:e.$container.querySelector(".jb-pro-ptz-cruise-play"),configurable:!0}),Object.defineProperty(t,"$ptzCruisePause",{value:e.$container.querySelector(".jb-pro-ptz-cruise-pause"),configurable:!0}),Object.defineProperty(t,"$ptzFogOpen",{value:e.$container.querySelector(".jb-pro-ptz-fog-open"),configurable:!0}),Object.defineProperty(t,"$ptzFogClose",{value:e.$container.querySelector(".jb-pro-ptz-fog-close"),configurable:!0}),Object.defineProperty(t,"$ptzWiperOpen",{value:e.$container.querySelector(".jb-pro-ptz-wiper-open"),configurable:!0}),Object.defineProperty(t,"$ptzWiperClose",{value:e.$container.querySelector(".jb-pro-ptz-wiper-close"),configurable:!0}),Object.defineProperty(t,"$qualityText",{value:e.$container.querySelector(".jb-pro-quality-icon-text"),configurable:!0}),Object.defineProperty(t,"$qualityMenu",{value:e.$container.querySelector(".jb-pro-quality-menu"),configurable:!0}),Object.defineProperty(t,"$qualityMenuList",{value:e.$container.querySelector(".jb-pro-quality-menu-list"),configurable:!0}),Object.defineProperty(t,"$scaleText",{value:e.$container.querySelector(".jb-pro-scale-icon-text"),configurable:!0}),Object.defineProperty(t,"$scaleMenu",{value:e.$container.querySelector(".jb-pro-scale-menu"),configurable:!0}),Object.defineProperty(t,"$scaleMenuList",{value:e.$container.querySelector(".jb-pro-scale-menu-list"),configurable:!0}),Object.defineProperty(t,"$zoom",{value:e.$container.querySelector(".jb-pro-zoom"),configurable:!0}),Object.defineProperty(t,"$zoomStop",{value:e.$container.querySelector(".jb-pro-zoom-stop"),configurable:!0}),Object.defineProperty(t,"$zoomNarrow",{value:e.$container.querySelector(".jb-pro-zoom-narrow"),configurable:!0}),Object.defineProperty(t,"$zoomExpand",{value:e.$container.querySelector(".jb-pro-zoom-expand"),configurable:!0}),Object.defineProperty(t,"$zoomStop2",{value:e.$container.querySelector(".jb-pro-zoom-stop2"),configurable:!0}),Object.defineProperty(t,"$close",{value:e.$container.querySelector(".jb-pro-close"),configurable:!0}),Object.defineProperty(t,"$zoomControls",{value:e.$container.querySelector(".jb-pro-zoom-controls"),configurable:!0}),Object.defineProperty(t,"$performancePanel",{value:e.$container.querySelector(".jb-pro-performance-panel"),configurable:!0}),Object.defineProperty(t,"$performance",{value:e.$container.querySelector(".jb-pro-performance"),configurable:!0}),Object.defineProperty(t,"$performanceActive",{value:e.$container.querySelector(".jb-pro-performance-active"),configurable:!0}),Object.defineProperty(t,"$faceDetect",{value:e.$container.querySelector(".jb-pro-face"),configurable:!0}),Object.defineProperty(t,"$faceDetectActive",{value:e.$container.querySelector(".jb-pro-face-active"),configurable:!0}),Object.defineProperty(t,"$objectDetect",{value:e.$container.querySelector(".jb-pro-object"),configurable:!0}),Object.defineProperty(t,"$objectDetectActive",{value:e.$container.querySelector(".jb-pro-object-active"),configurable:!0}),Object.defineProperty(t,"$occlusionDetect",{value:e.$container.querySelector(".jb-pro-occlusion"),configurable:!0}),Object.defineProperty(t,"$occlusionDetectActive",{value:e.$container.querySelector(".jb-pro-occlusion-active"),configurable:!0}),Object.defineProperty(t,"$contextmenus",{value:e.$container.querySelector(".jb-pro-contextmenus"),configurable:!0}),Object.defineProperty(t,"$speedText",{value:e.$container.querySelector(".jb-pro-speed-icon-text"),configurable:!0}),Object.defineProperty(t,"$speedMenu",{value:e.$container.querySelector(".jb-pro-speed-menu"),configurable:!0}),Object.defineProperty(t,"$speedMenuList",{value:e.$container.querySelector(".jb-pro-speed-menu-list"),configurable:!0}),Object.defineProperty(t,"$logSave",{value:e.$container.querySelector(".jb-pro-logSave"),configurable:!0}),Object.defineProperty(t,"$playbackProgress",{value:e.$container.querySelector(".jb-pro-control-progress-simple"),configurable:!0}),Object.defineProperty(t,"$playbackProgressTip",{value:e.$container.querySelector(".jb-pro-progress-tip"),configurable:!0}),Object.defineProperty(t,"$playbackProgressHover",{value:e.$container.querySelector(".jb-pro-progress-hover"),configurable:!0}),Object.defineProperty(t,"$playbackProgressPlayed",{value:e.$container.querySelector(".jb-pro-progress-played"),configurable:!0}),Object.defineProperty(t,"$playbackProgressIndicator",{value:e.$container.querySelector(".jb-pro-progress-indicator"),configurable:!0}),Object.defineProperty(t,"$playbackProgressTime",{value:e.$container.querySelector(".jb-pro-playback-control-time"),configurable:!0}),Object.defineProperty(t,"$tipsMessage",{value:e.$container.querySelector(".jb-pro-tips-message"),configurable:!0}),Object.defineProperty(t,"$tipsMessageClose",{value:e.$container.querySelector(".jb-pro-tips-message-close"),configurable:!0}),Object.defineProperty(t,"$tipsMessageContent",{value:e.$container.querySelector(".jb-pro-tips-message-content"),configurable:!0})})(e,this),e._opt.extendOperateBtns.length>0&&e._opt.extendOperateBtns.forEach((e=>{this.addExtendBtn(e)})),e._opt.extendDomConfig&&e._opt.extendDomConfig.html&&this.addExtendDom(e._opt.extendDomConfig),t=this,Object.defineProperty(t,"controlsRect",{get:()=>t.$controls&&t.$controls.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsInnerRect",{get:()=>t.$controlsInner&&t.$controlsInner.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsLeftRect",{get:()=>t.$controlsLeft&&t.$controlsLeft.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsRightRect",{get:()=>t.$controlsRight&&t.$controlsRight.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsPlaybackTimeInner",{get:()=>t.$playbackTimeInner&&t.$playbackTimeInner.getBoundingClientRect()||{},configurable:!0}),Object.defineProperty(t,"controlsPlaybackBtnsRect",{get:()=>t.$controlsPlaybackBtns&&t.$controlsPlaybackBtns.getBoundingClientRect()||{width:0},configurable:!0}),uc(e,this),((e,t)=>{const{events:{proxy:i},debug:s}=e,r=e._opt,o=r.operateBtns;function a(e){const{bottom:i,height:s}=t.$volumePanel.getBoundingClientRect(),{height:r}=t.$volumeHandle.getBoundingClientRect();return ao(i-e.y-r/2,0,s-r/2)/(s-r)}function n(i){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];i.composedPath().indexOf(e.$container)>-1?t.isFocus=!0:t.isFocus=!1,s&&!e.fullscreen&&e._opt.hasControl&&e._opt.controlAutoHide&&(t.isFocus?(no(t.$controls,"display","block"),d()):(h(),no(t.$controls,"display","none")))}if(mo()?i(window,["click","contextmenu"],(e=>{e.stopPropagation(),n(e)})):i(window,"click",(e=>{e.stopPropagation(),n(e,!0)})),i(t.$controls,"click",(e=>{e.stopPropagation()})),o.play&&(i(t.$pause,"click",(t=>{r.playType===w&&r.playbackConfig.uiUsePlaybackPause?e.playbackPause=!0:ea(o.pauseFn)?o.pauseFn():e.pauseForControl()})),i(t.$play,"click",(t=>{r.playType===w&&e.playbackPause?e.playbackPause=!1:ea(o.playFn)?o.playFn():e.playForControl().then((()=>{e.resumeAudioAfterPause()}))}))),i(t.$playBig,"click",(t=>{r.playType===w&&e.playbackPause?e.playbackPause=!1:ea(o.playFn)?o.playFn():e.playForControl().then((()=>{e.resumeAudioAfterPause()}))})),o.screenshot&&i(t.$screenshot,"click",(t=>{t.stopPropagation(),ea(o.screenshotFn)?o.screenshotFn():e.video.screenshot()})),o.audio&&(mo()&&(i(t.$volume,"mouseover",(()=>{t.$volumePanelWrap.classList.add("jb-pro-volume-panel-wrap-show")})),i(t.$volume,"mouseout",(()=>{t.$volumePanelWrap.classList.remove("jb-pro-volume-panel-wrap-show")})),i(t.$volumePanel,"click",(t=>{t.stopPropagation(),e.volume=a(t)})),i(t.$volumeHandle,"mousedown",(e=>{e.stopPropagation(),t.isVolumeDroging=!0})),i(t.$volumeHandle,"mousemove",(i=>{t.isVolumeDroging&&(e.volume=a(i))})),i(document,"mouseup",(()=>{t.isVolumeDroging&&(t.isVolumeDroging=!1)}))),i(t.$volumeOn,"click",(i=>{i.stopPropagation(),no(t.$volumeOn,"display","none"),no(t.$volumeOff,"display","block");const s=e.volume;e.volume=0,e._lastVolume=mo()?s:1})),i(t.$volumeOff,"click",(i=>{i.stopPropagation(),no(t.$volumeOn,"display","block"),no(t.$volumeOff,"display","none"),e.volume=mo()?e.lastVolume||.5:1}))),o.record&&(i(t.$record,"click",(t=>{t.stopPropagation(),ea(o.recordFn)?o.recordFn():e.recording=!0})),i(t.$recordStop,"click",(t=>{t.stopPropagation(),ea(o.recordStopFn)?o.recordStopFn():e.recording=!1}))),i(t.$recordingStop,"click",(t=>{t.stopPropagation(),ea(o.recordStopFn)?o.recordStopFn():e.recording=!1})),o.fullscreen&&(i(t.$fullscreen,"click",(t=>{t.stopPropagation(),ea(o.fullscreenFn)?o.fullscreenFn():e.fullscreen=!0})),i(t.$fullscreenExit,"click",(t=>{t.stopPropagation(),ea(o.fullscreenExitFn)?o.fullscreenExitFn():e.fullscreen=!1}))),o.ptz){i(t.$ptz,"click",(e=>{e.stopPropagation(),no(t.$ptzActive,"display","flex"),no(t.$ptz,"display","none"),t.$ptzControl.classList.add("jb-pro-ptz-controls-show")})),i(t.$ptzActive,"click",(e=>{e.stopPropagation(),no(t.$ptz,"display","flex"),no(t.$ptzActive,"display","none"),t.$ptzControl.classList.remove("jb-pro-ptz-controls-show")}));const c=xa();if(t.$ptzArrows.forEach((s=>{if(r.ptzClickType===Y)i(s,"click",(i=>{i.stopPropagation();const s=i.currentTarget.dataset.arrow;t.$ptzBgActive.classList.add("jb-pro-ptz-bg-active-show"),t.$ptzBgActive.classList.add(`jb-pro-ptz-bg-active-${s}`),t.$ptzControlCircular.classList.add(`jb-pro-ptz-control-${s}`),e.emit(at.ptz,_a(s)),setTimeout((()=>{t.$ptzBgActive.classList.remove("jb-pro-ptz-bg-active-show"),Di.forEach((e=>{t.$ptzBgActive.classList.remove(`jb-pro-ptz-bg-active-${e}`),t.$ptzControlCircular.classList.remove(`jb-pro-ptz-control-${e}`)})),e.emit(at.ptz,Ri)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Q){let r=!1;i(s,c.down,(i=>{i.stopPropagation(),r=!0;const s=i.currentTarget.dataset.arrow;t.$ptzBgActive.classList.add("jb-pro-ptz-bg-active-show"),t.$ptzBgActive.classList.add(`jb-pro-ptz-bg-active-${s}`),t.$ptzControlCircular.classList.add(`jb-pro-ptz-control-${s}`),e.emit(at.ptz,_a(s))}));const o=()=>{r=!1,t.$ptzBgActive.classList.remove("jb-pro-ptz-bg-active-show"),Di.forEach((e=>{t.$ptzBgActive.classList.remove(`jb-pro-ptz-bg-active-${e}`),t.$ptzControlCircular.classList.remove(`jb-pro-ptz-control-${e}`)})),e.emit(at.ptz,Ri)};i(s,c.up,(e=>{e.stopPropagation(),r&&o()})),i(window,c.up,(e=>{e.stopPropagation(),r&&o()}))}})),r.ptzZoomShow)if(r.ptzClickType===Y)i(t.$ptzExpand,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,Ii),setTimeout((()=>{e.emit(at.ptz,Ri)}),1e3*r.ptzStopEmitDelay)})),i(t.$ptzNarrow,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,Bi),setTimeout((()=>{e.emit(at.ptz,Ri)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Q){let u=!1,p=!1;i(t.$ptzExpand,c.down,(t=>{t.stopPropagation(),u=!0,e.emit(at.ptz,Ii)})),i(t.$ptzNarrow,c.down,(t=>{t.stopPropagation(),p=!0,e.emit(at.ptz,Bi)}));const f=()=>{u=!1,p=!1,e.emit(at.ptz,Ri)};i(t.$ptzExpand,c.up,(e=>{e.stopPropagation(),u&&f()})),i(t.$ptzNarrow,c.up,(e=>{e.stopPropagation(),p&&f()})),i(window,c.up,(e=>{e.stopPropagation(),(u||p)&&f()}))}if(r.ptzApertureShow)if(r.ptzClickType===Y)i(t.$ptzApertureFar,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,Mi),setTimeout((()=>{e.emit(at.ptz,Pi)}),1e3*r.ptzStopEmitDelay)})),i(t.$ptzApertureNear,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,Fi),setTimeout((()=>{e.emit(at.ptz,Pi)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Q){let m=!1,g=!1;i(t.$ptzApertureFar,c.down,(t=>{t.stopPropagation(),m=!0,e.emit(at.ptz,Mi)})),i(t.$ptzApertureNear,c.down,(t=>{t.stopPropagation(),g=!0,e.emit(at.ptz,Fi)}));const y=()=>{m=!1,g=!1,e.emit(at.ptz,Pi)};i(t.$ptzApertureFar,c.up,(e=>{e.stopPropagation(),m&&y()})),i(t.$ptzApertureNear,c.up,(e=>{e.stopPropagation(),g&&y()})),i(window,c.up,(e=>{e.stopPropagation(),(m||g)&&y()}))}if(r.ptzFocusShow)if(r.ptzClickType===Y)i(t.$ptzFocusFar,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,Ui),setTimeout((()=>{e.emit(at.ptz,Pi)}),1e3*r.ptzStopEmitDelay)})),i(t.$ptzFocusNear,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,Oi),setTimeout((()=>{e.emit(at.ptz,Pi)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Q){let A=!1,b=!1;i(t.$ptzFocusFar,c.down,(t=>{t.stopPropagation(),A=!0,e.emit(at.ptz,Ui)})),i(t.$ptzFocusNear,c.down,(t=>{t.stopPropagation(),b=!0,e.emit(at.ptz,Oi)}));const v=()=>{A=!1,b=!1,e.emit(at.ptz,Pi)};i(t.$ptzFocusFar,c.up,(e=>{e.stopPropagation(),A&&v()})),i(t.$ptzFocusNear,c.up,(e=>{e.stopPropagation(),b&&v()})),i(window,c.up,(e=>{e.stopPropagation(),(A||b)&&v()}))}if(r.ptzCruiseShow&&(i(t.$ptzCruisePlay,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,Ni)})),i(t.$ptzCruisePause,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,ji)}))),r.ptzFogShow&&(i(t.$ptzFogOpen,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,Gi)})),i(t.$ptzFogClose,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,Wi)}))),r.ptzWiperShow&&(i(t.$ptzWiperOpen,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,zi)})),i(t.$ptzWiperClose,"click",(t=>{t.stopPropagation(),e.emit(at.ptz,$i)}))),r.ptzSupportDraggable){function _(){t.isPtzControlDroging&&(t.isPtzControlDroging=!1,t.$ptzControl.style.cursor="grab",t.tempPtzPosition={x:0,y:0})}t.isPtzControlDroging=!1,t.tempPtzPosition={x:0,y:0},i(t.$ptzControl,c.down,(e=>{e.stopPropagation(),t.isPtzControlDroging=!0,t.$ptzControl.style.cursor="grabbing";const{posX:i,posY:s}=ta(e);t.tempPtzPosition={x:i,y:s}})),i(t.$ptzControl,c.move,(e=>{if(t.isPtzControlDroging){e.stopPropagation();const{posX:i,posY:s}=ta(e),r=t.tempPtzPosition.x-i,o=t.tempPtzPosition.y-s;t.$ptzControl.style.left=t.$ptzControl.offsetLeft-r+"px",t.$ptzControl.style.top=t.$ptzControl.offsetTop-o+"px",t.tempPtzPosition={x:i,y:s}}})),i(t.$ptzControl,c.up,(e=>{e.stopPropagation(),_()})),i(window,c.up,(e=>{e.stopPropagation(),_()}))}}o.performance&&(i(t.$performance,"click",(t=>{t.stopPropagation(),e.togglePerformancePanel(!0)})),i(t.$performanceActive,"click",(t=>{t.stopPropagation(),e.togglePerformancePanel(!1)}))),o.logSave&&i(t.$logSave,"click",(t=>{t.stopPropagation(),e.downloadMemoryLog()})),o.aiFace&&(i(t.$faceDetect,"click",(t=>{t.stopPropagation(),e.faceDetect(!0)})),i(t.$faceDetectActive,"click",(t=>{t.stopPropagation(),e.faceDetect(!1)}))),o.aiObject&&(i(t.$objectDetect,"click",(t=>{t.stopPropagation(),e.objectDetect(!0)})),i(t.$objectDetectActive,"click",(t=>{t.stopPropagation(),e.objectDetect(!1)}))),o.aiOcclusion&&(i(t.$occlusionDetect,"click",(t=>{t.stopPropagation(),e.occlusionDetect(!0)})),i(t.$occlusionDetectActive,"click",(t=>{t.stopPropagation(),e.occlusionDetect(!1)})));let l=null;const d=()=>{h(),l=setTimeout((()=>{no(t.$controls,"display","none")}),1e3*e._opt.controlAutoHideDelayTime)},h=()=>{l&&(clearTimeout(l),l=null)};if(e._opt.hasControl&&e._opt.controlAutoHide&&mo()&&(i(e.$container,"mouseover",(()=>{e.fullscreen||(no(t.$controls,"display","block"),d())})),i(e.$container,"mousemove",(()=>{e.$container&&t.$controls&&(e.fullscreen,"none"===t.$controls.style.display&&(no(t.$controls,"display","block"),d()))})),i(e.$container,"mouseout",(()=>{h(),no(t.$controls,"display","none")}))),e._opt.playType===w){let S=e._opt.playbackConfig.controlType;e._opt.playbackConfig.showRateBtn&&(i(t.$speedMenu,"mouseover",(()=>{t.$speedMenuList.classList.add("jb-pro-speed-menu-shown")})),i(t.$speedMenu,"mouseout",(()=>{t.$speedMenuList.classList.remove("jb-pro-speed-menu-shown")})),i(t.$speedMenuList,"click",(t=>{const i=Xo(t);if(i.matches("div.jb-pro-speed-menu-item")){const t=i.dataset;e.emit(at.playbackPreRateChange,t.speed)}}))),S===X.normal?(i(t.$playbackNarrow,"click",(t=>{t.stopPropagation(),e.playback&&e.playback.narrowPrecision()})),i(t.$playbackExpand,"click",(t=>{t.stopPropagation(),e.playback&&e.playback.expandPrecision()})),i(t.$playbackTimeList,"click",(t=>{const i=Xo(t);i.matches("div.jb-pro-playback-time-minute-one")&&e.playback&&e.playback.seek(i.dataset)})),e._opt.playbackConfig.supportWheel&&i(t.$playbackTimeInner,"wheel",(t=>{t.preventDefault(),(t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3)>0?e.playback&&e.playback.expandPrecision():e.playback&&e.playback.narrowPrecision()}))):S===X.simple&&(t.isDroging=!1,i(t.$playbackProgress,"click",(i=>{if(i.target!==t.$playbackProgressIndicator){let s=0,r=0;if(e.isInWebFullscreen())s=i.touches[0].clientY/e.height,r=s*e.playback.totalDuration;else{const o=ac(t,e.playback.totalDuration,i);s=o.percentage,r=o.second}e.playback&&e.playback.seek({time:r})}})),i(t.$playbackProgress,"mousemove",(i=>{no(t.$playbackProgressTip,"display","block");const{width:s,time:r}=ac(t,e.playback.totalDuration,i);t.$playbackProgressTip.innerHTML=r;const o=t.$playbackProgressTip.clientWidth;s<=o/2?no(t.$playbackProgressTip,"left",0):s>t.$playbackProgress.clientWidth-o/2?no(t.$playbackProgressTip,"left",t.$playbackProgress-o+"px"):no(t.$playbackProgressTip,"left",s-o/2+"px")})),i(t.$playbackProgress,"mouseout",(()=>{no(t.$playbackProgressTip,"display","none")})),i(t.$playbackProgressIndicator,"mousedown",(e=>{t.isDroging=!0})),i(t.$playbackProgress,"mousemove",(i=>{if(t.isDroging){const{second:s,percentage:r}=ac(t,e.playback.totalDuration,i);e.playback&&e.playback.seek({time:s})}})),i(t.$playbackProgress,"mouseup",(e=>{t.isDroging&&(t.isDroging=!1)})))}o.quality&&(i(t.$qualityMenu,"mouseover",(()=>{t.$qualityMenuList.classList.add("jb-pro-quality-menu-shown")})),i(t.$qualityMenu,"mouseout",(()=>{t.$qualityMenuList.classList.remove("jb-pro-quality-menu-shown")})),i(t.$qualityMenuList,"click",(t=>{const i=Xo(t);if(i.matches("div.jb-pro-quality-menu-item")){const t=i.dataset;e.streamQuality=t.quality}}))),o.scale&&(i(t.$scaleMenu,"mouseover",(()=>{t.$scaleMenuList.classList.add("jb-pro-scale-menu-shown")})),i(t.$scaleMenu,"mouseout",(()=>{t.$scaleMenuList.classList.remove("jb-pro-scale-menu-shown")})),i(t.$scaleMenuList,"click",(t=>{const i=Xo(t);if(i.matches("div.jb-pro-scale-menu-item")){const t=i.dataset;e.setScaleMode(t.scale)}}))),o.zoom&&(i(t.$zoom,"click",(t=>{t.stopPropagation(),e.zooming=!0})),i(t.$zoomStop,"click",(t=>{t.stopPropagation(),e.zooming=!1}))),i(t.$zoomExpand,"click",(t=>{t.stopPropagation(),e.zoom&&e.zoom.expandPrecision()})),i(t.$zoomNarrow,"click",(t=>{t.stopPropagation(),e.zoom&&e.zoom.narrowPrecision()})),i(t.$zoomStop2,"click",(t=>{t.stopPropagation(),e.zooming=!1})),o.close&&i(t.$close,"click",(t=>{t.stopPropagation(),e.doDestroy()})),i(t.$tipsMessageClose,"click",(e=>{e.stopPropagation(),t.$tipsMessageContent.innerHTML="",no(t.$tipsMessage,"display","none")}))})(e,this),e._opt.hotKey&&mo()&&((e,t)=>{const{events:{proxy:i}}=e;let s={};function r(e,t){s[e]?s[e].push(t):s[e]=[t]}t.keys=s,r(_i,(()=>{e.fullscreen&&(e.fullscreen=!1)})),r(wi,(()=>{e.volume+=.05})),r(Si,(()=>{e.volume-=.05})),i(window,"keydown",(e=>{if(t.isFocus){const t=document.activeElement.tagName.toUpperCase(),i=document.activeElement.getAttribute("contenteditable");if("INPUT"!==t&&"TEXTAREA"!==t&&""!==i&&"true"!==i){const t=s[e.keyCode];t&&(e.preventDefault(),t.forEach((e=>e())))}}}))})(e,this),this.btnIndex=0,this.initLoadingBackground(),qo(e._opt.loadingIconStyle)&&this.initLoadingIconStyle(e._opt.loadingIconStyle),qo(e._opt.ptzPositionConfig)&&this.updatePtzPosition(e._opt.ptzPositionConfig),this.kbpsShow="0 KB/s",this.player.debugLog("Control","init")}destroy(){if(this.$performancePanel){this.$performancePanel.innerHTML="";if(!cc(this.$performancePanel)){const e=this.player.$container.querySelector(".jb-pro-performance-panel");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$performancePanel}if(this.$poster){if(!cc(this.$poster)){const e=this.player.$container.querySelector(".jb-pro-poster");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$poster}if(this.$loading){if(!cc(this.$loading)){const e=this.player.$container.querySelector(".jb-pro-loading");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$loading}if(this.$loadingBg){if(!cc(this.$loadingBg)){const e=this.player.$container.querySelector(".jb-pro-loading-bg");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$loadingBg}if(this.$controls){if(!cc(this.$controls)){const e=this.player.$container.querySelector(".jb-pro-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$controls}if(this.$playBig){if(!cc(this.$playBig)){const e=this.player.$container.querySelector(".jb-pro-play-big");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$playBig}if(this.$recording){if(!cc(this.$recording)){const e=this.player.$container.querySelector(".jb-pro-recording");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$recording}if(this.$ptzControl){if(!cc(this.$ptzControl)){const e=this.player.$container.querySelector(".jb-pro-ptz-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$ptzControl}if(this.$zoomControls){if(!cc(this.$zoomControls)){const e=this.player.$container.querySelector(".jb-pro-zoom-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$zoomControls}if(this.$contextmenus){this.$contextmenus.innerHTML="";if(!cc(this.$contextmenus)){const e=this.player.$container.querySelector(".jb-pro-contextmenus");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$contextmenus}if(this.$tipsMessage){if(!cc(this.$tipsMessage)){const e=this.player.$container.querySelector(".jb-pro-tips-message");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$tipsMessage}if(this.$extendDom){if(!cc(this.$extendDom)){const e=this.player.$container.querySelector(".jb-pro-extend-dom");e&&this.player.$container&&this.player.$container.removeChild(e)}delete this.$extendDom}try{delete this.$tipsMessageContent,delete this.$tipsMessageClose,delete this.$playbackProgressTime,delete this.$playbackProgressIndicator,delete this.$playbackProgressPlayed,delete this.$playbackProgressHover,delete this.$$playbackProgressTip,delete this.$playbackProgress,delete this.$logSave,delete this.$speedMenuList,delete this.$speedMenu,delete this.$speedText,delete this.$contextmenus,delete this.$occlusionDetectActive,delete this.$occlusionDetect,delete this.$objectDetectActive,delete this.$objectDetect,delete this.$faceDetectActive,delete this.$faceDetect,delete this.$performanceActive,delete this.$performance,delete this.$performancePanel,delete this.$zoomControls,delete this.$close,delete this.$zoomStop2,delete this.$zoomExpand,delete this.$zoomNarrow,delete this.$zoomStop,delete this.$zoom,delete this.$scaleMenuList,delete this.$scaleMenu,delete this.$scaleText,delete this.$qualityMenuList,delete this.$qualityMenu,delete this.$qualityText,delete this.$ptzWiperClose,delete this.$ptzWiperOpen,delete this.$ptzFogClose,delete this.$ptzFogOpen,delete this.$ptzCruisePause,delete this.$ptzCruisePlay,delete this.$ptzFocusNear,delete this.$ptzFocusFar,delete this.$ptzApertureNear,delete this.$ptzApertureFar,delete this.$ptzNarrow,delete this.$ptzExpand,delete this.$ptzArrows,delete this.$ptzControlCircular,delete this.$ptzBgActive,delete this.$ptzControl,delete this.$ptzActive,delete this.$ptz,delete this.$playbackExpand,delete this.$playbackNarrow,delete this.$controlsPlaybackBtns,delete this.$playbackCurrentTimeText,delete this.$playbackCurrentTime,delete this.$playbackTimeListSecond,delete this.$playbackTimeListOne,delete this.$playbackTimeList,delete this.$playbackTimeScroll,delete this.$playbackTimeInner,delete this.$playbackTime,delete this.$controlHtml,delete this.$speed,delete this.$screenshot,delete this.$recordStop,delete this.$record,delete this.$fullscreenExit,delete this.$fullscreen,delete this.$volumeOff,delete this.$volumeOn,delete this.$volumeHandle,delete this.$volumePanel,delete this.$volumePanelText,delete this.$volumePanelWrap,delete this.$volume,delete this.$controlsRight,delete this.$controlsLeft,delete this.$controlsInner,delete this.$controls,delete this.$pause,delete this.$recordingStop,delete this.$recordingTime,delete this.$recording,delete this.$playBig,delete this.$play,delete this.$loadingText,delete this.$loading,delete this.$loadingBgImage,delete this.$loadingBg,delete this.$poster,delete this.$extendDom,delete this.controlsRect,delete this.controlsInnerRect,delete this.controlsLeftRect,delete this.controlsRightRect,delete this.controlsPlaybackTimeInner,delete this.controlsPlaybackBtnsRect}catch(e){}this.keys=null,this.btnIndex=0,this.extendBtnList=[],this.kbpsShow="0 KB/s",this.player.$container&&(this.player.$container.classList.remove("jb-pro-controls-show-auto-hide"),this.player.$container.classList.remove("jb-pro-controls-show")),this.player.debugLog("Control","destroy")}getBtnIndex(){return this.btnIndex++}autoSize(){const e=this.player;e.$container.style.padding="0 0";const t=e.width,i=e.height,s=t/i,r=e.video.$videoElement.width/e.video.$videoElement.height;if(s>r){const s=(t-i*r)/2;e.$container.style.padding=`0 ${s}px`}else{const s=(i-t/r)/2;e.$container.style.padding=`${s}px 0`}}initLoadingBackground(){const e=this.player;e._opt.loadingBackground&&e._opt.loadingBackgroundWidth&&e._opt.loadingBackgroundHeight&&(e.debugLog("Control","initLoadingBackground()"),"default"===this.player._opt.aspectRatio||fo()?(e.getRenderType()===H||e.getRenderType()===J)&&this._initLoadingBackground():this._initLoadingBackgroundForRatio(),dc(this.$loadingBg,"display","block"),e._opt.loadingBackground="")}resizeLoadingBackground(){this.$loadingBgImage.src&&this.$loadingBgImage.width>0&&this.$loadingBgImage.height>0&&"none"!==lo(this.$loadingBg,"display",!1)&&("default"===this.player._opt.aspectRatio||fo()?(this.player.getRenderType()===H||this.player.getRenderType()===J)&&this._resizeLoadingBackground():this._resizeLoadingBackgroundForRatio())}initLoadingIconStyle(e){const t=this.player.$container.querySelector(".jb-pro-icon-loading");t&&(e.width&&dc(t,"width",`${e.width}px`),e.height&&dc(t,"height",`${e.height}px`),e.background&&dc(t,"backgroundImage",`url("${e.background}")`),!1===e.hasAnimation&&(dc(t,"animationName","none"),dc(t,"animationDuration",0),dc(t,"animationTimingFunction","ease"),dc(t,"animationIterationCount",1)))}_initLoadingBackgroundForRatio(){const e=this.player._opt.aspectRatio.split(":").map(Number);let t=this.player.width,i=this.player.height;const s=this.player._opt;let r=0;this.player.isControlBarShow()&&(r=s.playType===w?Xt:Qt,i-=r);const o=this.player._opt.loadingBackgroundWidth,a=this.player._opt.loadingBackgroundHeight,n=o/a,l=e[0]/e[1];if(this.player._opt.loadingBackground&&(this.$loadingBgImage.src=this.player._opt.loadingBackground),n>l){const e=l*a/o;this.$loadingBgImage.style.width=100*e+"%",this.$loadingBgImage.style.height=`calc(100% - ${r}px)`,this.$loadingBgImage.style.padding=`0 ${(t-t*e)/2}px`}else{const e=o/l/a;this.$loadingBgImage.style.width="100%",this.$loadingBgImage.style.height=`calc(${100*e}% - ${r}px)`,this.$loadingBgImage.style.padding=(i-i*e)/2+"px 0"}}_initLoadingBackground(){const e=this.player;let t=e.height;const i=e._opt;if(this.player.isControlBarShow()){t-=i.playType===w?Xt:Qt}let s=e.width,r=t;const o=i.rotate;270!==o&&90!==o||(s=t,r=e.width),this.$loadingBgImage.width=s,this.$loadingBgImage.height=r,e._opt.loadingBackground&&(this.$loadingBgImage.src=e._opt.loadingBackground);let a=(e.width-s)/2,n=(t-r)/2,l="contain";i.isResize||(l="fill"),i.isFullResize&&(l="none");let d="";"none"===i.mirrorRotate&&o&&(d+=" rotate("+o+"deg)"),"level"===i.mirrorRotate?d+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(d+=" rotateX(180deg)"),this.player._opt.videoRenderSupportScale&&(this.$loadingBgImage.style.objectFit=l),this.$loadingBgImage.style.transform=d,this.$loadingBgImage.style.padding="0",this.$loadingBgImage.style.left=a+"px",this.$loadingBgImage.style.top=n+"px"}_resizeLoadingBackground(){this._initLoadingBackground()}_resizeLoadingBackgroundForRatio(){this._initLoadingBackgroundForRatio()}_validateExtendBtn(e){let t=!0;if(e.name||(this.player.debugWarn("Control","extend button name is required"),t=!1),t){-1!==this.extendBtnList.findIndex((t=>t.name===e.name))&&(this.player.debugWarn("Control",`extend button name: ${e.name} is already exist`),t=!1)}return t&&(e.icon||(this.player.debugWarn("Control","extend button icon is required"),t=!1)),t}addExtendBtn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=pa(Ss);if(e=Object.assign({},t,e),!this._validateExtendBtn(e))return;const i=e.name||"",s=this.$controlsRight,r=e.createdMoment||Cr,o=e.activeIcon&&e.activeClick,a=`\n
\n ${e.icon?`
\n \n ${e.iconTitle?`\n ${e.iconTitle}\n `:""}\n
`:""}\n ${e.activeIcon?`
\n \n ${e.activeIconTitle?`\n ${e.activeIconTitle}\n `:""}\n
`:""}\n
\n `,n=Array.from(s.children)[e.index];n?n.insertAdjacentHTML("beforebegin",a):lc(s,a);const l=s.querySelector(`.jb-pro-controls-item-wrap-${i}`),d=e.icon?s.querySelector(`.jb-pro-icon-extend-${i}`):null,h=e.icon?s.querySelector(`.jb-pro-control-extend-${i}`):null,c=e.activeIcon?s.querySelector(`.jb-pro-icon-extend-${i}-active`):null,u=e.activeIcon?s.querySelector(`.jb-pro-control-extend-${i}-active`):null,{events:{proxy:p},debug:f}=this.player;e.icon&&(dc(d,"background",`url(${e.icon}) no-repeat center`),dc(d,"background-size","100% 100%"),dc(h,"display",r===kr?"flex":"none"),e.iconHover&&(p(d,"mouseover",(()=>{dc(d,"background",`url(${e.iconHover}) no-repeat center`),dc(d,"background-size","100% 100%")})),p(d,"mouseout",(()=>{dc(d,"background",`url(${e.icon}) no-repeat center`),dc(d,"background-size","100% 100%")})))),e.activeIcon&&(dc(c,"background",`url(${e.activeIcon}) no-repeat center`),dc(c,"background-size","100% 100%"),dc(u,"display","none"),e.activeIconHover&&(p(c,"mouseover",(()=>{dc(c,"background",`url(${e.activeIconHover}) no-repeat center`),dc(c,"background-size","100% 100%")})),p(c,"mouseout",(()=>{dc(c,"background",`url(${e.activeIcon}) no-repeat center`),dc(c,"background-size","100% 100%")})))),e.click&&d&&p(d,"click",(t=>{t.preventDefault(),o&&(dc(h,"display","none"),dc(u,"display","flex")),this.player.isInMulti()?e.click.call(this.player,t,this.player._opt.multiIndex):e.click.call(this.player,t)})),e.activeClick&&c&&p(c,"click",(t=>{t.preventDefault(),dc(h,"display","flex"),dc(u,"display","none"),this.player.isInMulti()?e.activeClick.call(this.player,t,this.player._opt.multiIndex):e.activeClick.call(this.player,t)})),this.extendBtnList.push({name:i,createdMoment:r,$iconContainer:l,$iconWrap:h,$activeIconWrap:u})}toggleExtendBtn(e,t){const i=this.extendBtnList.find((t=>t.name===e));i&&i.$activeIconWrap&&i.$iconWrap&&(Bo(t)||(t="none"===lo(i.$activeIconWrap,"display",!1)),t?(dc(i.$iconWrap,"display","none"),dc(i.$activeIconWrap,"display","flex")):(dc(i.$iconWrap,"display","flex"),dc(i.$activeIconWrap,"display","none")))}getExtendBtnActive(e){const t=this.extendBtnList.find((t=>t.name===e));let i=!1;return t&&t.$activeIconWrap&&(i="none"!==lo(t.$activeIconWrap,"display",!1)),i}addExtendDom(e){if(e.html){const t=`\n
\n ${e.html}\n
\n `;this.player.$container.insertAdjacentHTML("beforeend",t),Object.defineProperty(this,"$extendDom",{value:this.player.$container.querySelector(".jb-pro-extend-dom"),configurable:!0}),e.showBeforePlay&&dc(this.$extendDom,"display","block")}}toggleExtendDom(e){this.$extendDom&&(Bo(e)||(e="none"===lo(this.$extendDom,"display",!1)),dc(this.$extendDom,"display",e?"block":"none"))}updateExtendDom(e){this.$extendDom&&(this.$extendDom.innerHTML=e)}removeExtendDom(){this.$extendDom&&(this.$extendDom.innerHTML="")}updateLoadingText(e){this.$loadingText&&(this.$loadingText.innerText=e)}getExtendBtnList(){return this.extendBtnList}showTipsMessage(e,t){const i=this.$tipsMessage,s=this.$tipsMessageContent;if(i){const r=`\n
${e}
\n ${t?`
Error Type:${t}
`:""}\n `;s.innerHTML=r,dc(i,"display","block")}}hideTipsMessage(){const e=this.$tipsMessage,t=this.$tipsMessageContent;e&&(t.innerHTML="",dc(e,"display","none"))}updatePtzPosition(e){const t=this.$ptzControl;if(qo(e)&&t){let i="auto";e.left&&(i=Number(e.left)===e.left?e.left+"px":e.left),dc(t,"left",i);let s="auto";e.top&&(s=Number(e.top)===e.top?e.top+"px":e.top),dc(t,"top",s);let r="auto";e.bottom&&(r=Number(e.bottom)===e.bottom?e.bottom+"px":e.bottom),dc(t,"bottom",r);let o="auto";e.right&&(o=Number(e.right)===e.right?e.right+"px":e.right),dc(t,"right",o)}}showPlayBtn(){dc(this.$playBig,"display","block")}toggleBar(e){this.$controls&&(Bo(e)||(e="none"===lo(this.$controls,"display",!1)),dc(this.$controls,"display",e?"flex":"none"))}getBarIsShow(){let e=!1;return this.$controls&&(e="none"!==lo(this.$controls,"display",!1)),e}toggleControlHtml(e){this.$controlHtml&&(Bo(e)||(e="none"===lo(this.$controlHtml,"display",!1)),dc(this.$controlHtml,"display",e?"block":"none"))}getControlHtmlIsShow(){let e=!1;return this.$controlHtml&&(e="none"!==lo(this.$controlHtml,"display",!1)),e}getExtendDomIsShow(){let e=!1;return this.$extendDom&&(e="none"!==lo(this.$extendDom,"display",!1)),e}getExtendDom(){return this.$extendDom?this.$extendDom:null}getControlHtml(){return this.$controlHtml?this.$controlHtml:null}}pc(".jb-pro-container{position:relative;width:100%;height:100%;overflow:hidden}.jb-pro-container.jb-pro-fullscreen-web{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;width:100vw!important;height:100vh!important;background:#000}.jb-pro-container .jb-pro-loading-bg-for-ios{position:absolute;z-index:100;left:0;top:0;right:0;bottom:0;height:100%;width:100%;opacity:0;visibility:hidden;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jb-pro-container .jb-pro-loading-bg-for-ios.show{opacity:1;visibility:visible}");var mc=e=>{const{_opt:t,events:{proxy:i}}=e;if(t.supportDblclickFullscreen&&i(e.$container,"dblclick",(t=>{const i=Xo(t).nodeName.toLowerCase();"canvas"!==i&&"video"!==i||(e.fullscreen=!e.fullscreen)})),i(document,"visibilitychange",(()=>{e.visibility="visible"===document.visibilityState,e.debugLog("visibilitychange",document.visibilityState),t.hiddenAutoPause&&(e.debugLog("visibilitychange","hiddenAutoPause is true ",document.visibilityState,e._isPlayingBeforePageHidden),"visible"===document.visibilityState?e._isPlayingBeforePageHidden&&e.play():(e._isPlayingBeforePageHidden=e.playing,e.playing&&e.pause()))})),mo()&&i(document,["click","contextmenu"],(t=>{hc(t,e.$container)?(ya(e._opt.disableContextmenu)&&"contextmenu"===t.type&&t.preventDefault(),e.isInput="INPUT"===t.target.tagName,e.isFocus=!0,e.emit(at.focus)):(e.isInput=!1,e.isFocus=!1,e.emit(at.blur))})),t.isCheckInView){const t=To((()=>{e.emit(at.inView,function(e){const t=e.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight,s=window.innerWidth||document.documentElement.clientWidth,r=t.top<=i&&t.top+t.height>=0,o=t.left<=s&&t.left+t.width>=0;return r&&o}(e.$container))}),200);i(window,"scroll",(()=>t()))}if(t.orientationChangeResize){const t=To((()=>{e.emit(at.resize)}),500);i(window,"orientationchange",(()=>{t()})),screen&&screen.orientation&&screen.orientation.onchange&&i(screen.orientation,"change",(()=>{t()}))}};class gc{static init(){gc.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in gc.types)gc.types.hasOwnProperty(e)&&(gc.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=gc.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,s=Array.prototype.slice.call(arguments,1),r=s.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let o=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return gc.box(gc.types.trak,gc.tkhd(e),gc.mdia(e))}static tkhd(e){let t=e.id,i=e.duration,s=e.presentWidth,r=e.presentHeight;return gc.box(gc.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>>8&255,255&s,0,0,r>>>8&255,255&r,0,0]))}static mdia(e){return gc.box(gc.types.mdia,gc.mdhd(e),gc.hdlr(e),gc.minf(e))}static mdhd(e){let t=e.timescale,i=e.duration;return gc.box(gc.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?gc.constants.HDLR_AUDIO:gc.constants.HDLR_VIDEO,gc.box(gc.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?gc.box(gc.types.smhd,gc.constants.SMHD):gc.box(gc.types.vmhd,gc.constants.VMHD),gc.box(gc.types.minf,t,gc.dinf(),gc.stbl(e))}static dinf(){return gc.box(gc.types.dinf,gc.box(gc.types.dref,gc.constants.DREF))}static stbl(e){return gc.box(gc.types.stbl,gc.stsd(e),gc.box(gc.types.stts,gc.constants.STTS),gc.box(gc.types.stsc,gc.constants.STSC),gc.box(gc.types.stsz,gc.constants.STSZ),gc.box(gc.types.stco,gc.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?gc.box(gc.types.stsd,gc.constants.STSD_PREFIX,gc.mp3(e)):gc.box(gc.types.stsd,gc.constants.STSD_PREFIX,gc.mp4a(e)):"avc"===e.videoType?gc.box(gc.types.stsd,gc.constants.STSD_PREFIX,gc.avc1(e)):gc.box(gc.types.stsd,gc.constants.STSD_PREFIX,gc.hvc1(e))}static mp3(e){let t=e.channelCount,i=e.audioSampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return gc.box(gc.types[".mp3"],s)}static mp4a(e){let t=e.channelCount,i=e.audioSampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return gc.box(gc.types.mp4a,s,gc.esds(e))}static esds(e){let t=e.config||[],i=t.length,s=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return gc.box(gc.types.esds,s)}static avc1(e){let t=e.avcc;const i=e.codecWidth,s=e.codecHeight;let r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return gc.box(gc.types.avc1,r,gc.box(gc.types.avcC,t))}static hvc1(e){let t=e.avcc;const i=e.codecWidth,s=e.codecHeight;let r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return gc.box(gc.types.hvc1,r,gc.box(gc.types.hvcC,t))}static mvex(e){return gc.box(gc.types.mvex,gc.trex(e))}static trex(e){let t=e.id,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return gc.box(gc.types.trex,i)}static moof(e,t){return gc.box(gc.types.moof,gc.mfhd(e.sequenceNumber),gc.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return gc.box(gc.types.mfhd,t)}static traf(e,t){let i=e.id,s=gc.box(gc.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),r=gc.box(gc.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),o=gc.sdtp(e),a=gc.trun(e,o.byteLength+16+16+8+16+8+8);return gc.box(gc.types.traf,s,r,a,o)}static sdtp(e){let t=new Uint8Array(5),i=e.flags;return t[4]=i.isLeading<<6|i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy,gc.box(gc.types.sdtp,t)}static trun(e,t){let i=new Uint8Array(28);t+=36,i.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let s=e.duration,r=e.size,o=e.flags,a=e.cts;return i.set([s>>>24&255,s>>>16&255,s>>>8&255,255&s,r>>>24&255,r>>>16&255,r>>>8&255,255&r,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12),gc.box(gc.types.trun,i)}static mdat(e){return gc.box(gc.types.mdat,e)}}gc.init();class yc extends o{constructor(e){super(),this.TAG_NAME="MediaSource",this.player=e,this._resetInIt(),this._useManagedMediaSource="ManagedMediaSource"in xr&&!("MediaSource"in xr),this.mediaSource=this._useManagedMediaSource?new xr.ManagedMediaSource:new xr.MediaSource,this.isDecodeFirstIIframe=!!Aa(e._opt.checkFirstIFrame),this.mediaSourceObjectURL=null,this._useManagedMediaSource||(this.mediaSourceObjectURL=xr.URL.createObjectURL(this.mediaSource)),this.isSupportVideoFrameCallback=ka(),this.canvasRenderInterval=null,e._opt.mseUseCanvasRender?(this.$videoElement=document.createElement("video"),this._useManagedMediaSource?(this.$videoElement.disableRemotePlayback=!0,this.$videoElement.srcObject=this.mediaSource):this.$videoElement.src=this.mediaSourceObjectURL,this.initVideoEvents()):(this._useManagedMediaSource?(this.player.video.$videoElement.disableRemotePlayback=!0,this.player.video.$videoElement.srcObject=this.mediaSource):this.player.video.$videoElement.src=this.mediaSourceObjectURL,this.$videoElement=this.player.video.$videoElement),this._bindMediaSourceEvents(),this.audioSourceBufferCheckTimeout=null,this.audioSourceNoDataCheckTimeout=null,this.hasPendingEos=!1,this.player.isPlayback()&&this.player.on(at.playbackPause,(t=>{Aa(t)?(e._opt.isPlaybackPauseClearCache&&(ya(e._opt.checkFirstIFrame)&&(this.player.debugLog(this.TAG_NAME,"playbackPause is false and _opt.checkFirstIFrame is true so set isDecodeFirstIIframe = false"),this.isDecodeFirstIIframe=!1),this.clearUpAllSourceBuffer()),this.$videoElement.play()):(this.$videoElement.pause(),this.cacheTrack={})})),this._useManagedMediaSource?this.player.debugLog(this.TAG_NAME,"init and using ManagedMediaSource"):this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.stop(),this._clearAudioSourceBufferCheckTimeout(),this._clearAudioNoDataCheckTimeout(),this._stopCanvasRender(),this.eventListenList.length&&(this.eventListenList.forEach((e=>e())),this.eventListenList=[]),this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.$videoElement&&(this.player._opt.mseUseCanvasRender&&(this.$videoElement.pause&&(this.$videoElement.pause(),this.$videoElement.muted=!0),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"))),this.$videoElement=null),this.mediaSourceObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceObjectURL),this.mediaSourceObjectURL=null),this._resetInIt(),this.mediaSource=null,this.off(),this.player.debugLog(this.TAG_NAME,"destroy")}needInitAudio(){return this.player._opt.hasAudio&&this.player._opt.mseDecodeAudio}_resetInIt(){this.isAvc=null,this.isAAC=null,this.videoMeta={},this.audioMeta={},this.sourceBuffer=null,this.audioSourceBuffer=null,this.hasInit=!1,this.hasAudioInit=!1,this.isInitInfo=!1,this.isAudioInitInfo=!1,this.audioMimeType="",this.videoMimeType="",this.cacheTrack={},this.cacheAudioTrack={},this.sequenceNumber=0,this.audioSequenceNumber=0,this.firstRenderTime=null,this.firstAudioTime=null,this.$videoElement=null,this.mediaSourceAppendBufferFull=!1,this.mediaSourceAppendBufferError=!1,this.mediaSourceAddSourceBufferError=!1,this.mediaSourceBufferError=!1,this.mediaSourceError=!1,this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.prevAudioDts=null,this.prevPayloadBufferSize=0,this.isWidthOrHeightChanged=!1,this.prevTs=null,this.prevAudioTs=null,this.eventListenList=[],this.pendingRemoveRanges=[],this.pendingSegments=[],this.pendingAudioRemoveRanges=[],this.pendingAudioSegments=[],this.supportVideoFrameCallbackHandle=null}get state(){return this.mediaSource&&this.mediaSource.readyState}get isStateOpen(){return this.state===bi}get isStateClosed(){return this.state===vi}get isStateEnded(){return this.state===Ai}get duration(){return this.mediaSource&&this.mediaSource.duration||-1}set duration(e){this.mediaSource.duration=e}_bindMediaSourceEvents(){const{events:{proxy:e}}=this.player,t=e(this.mediaSource,Ji,(()=>{this.player.debugLog(this.TAG_NAME,"sourceOpen"),this._onMediaSourceSourceOpen(),this.player.emit(at.mseSourceOpen)})),i=e(this.mediaSource,Hi,(()=>{this.player.debugLog(this.TAG_NAME,"sourceClose"),this.player.emit(at.mseSourceClose)})),s=e(this.mediaSource,qi,(()=>{this.player.debugLog(this.TAG_NAME,"sourceended"),this.player.emit(at.mseSourceended)}));this.eventListenList.push(t,i,s);const r=e(this.$videoElement,es,(e=>{if(Aa(this.isSupportVideoFrameCallback))if(this.player.checkIsInRender())this.player.handleRender();else{const t=parseInt(e.timeStamp,10);this.player.debugLog(this.TAG_NAME,`mseUseCanvasRender is ${this.player._opt.mseUseCanvasRender} and\n $videoElement ts is ${t}, but not in render and vbps is ${this.player._stats.vbps} and fps is ${this.player._stats.fps}`)}}));if(this.eventListenList.push(r),this._useManagedMediaSource){const t=e(this.mediaSource,Ki,(()=>{this.player.debugLog(this.TAG_NAME,"ManagedMediaSource startstreaming"),this.player.emit(at.mseSourceStartStreaming)})),i=e(this.mediaSource,Yi,(()=>{this.player.debugLog(this.TAG_NAME,"ManagedMediaSource endstreaming"),this.player.emit(at.mseSourceEndStreaming)})),s=e(this.mediaSource,Qi,(()=>{this.player.debugLog(this.TAG_NAME,"ManagedMediaSource qualitychange")}));this.eventListenList.push(t,i,s)}}_onMediaSourceSourceOpen(){this.sourceBuffer||(this.player.debugLog("MediaSource","onMediaSourceSourceOpen() sourceBuffer is null and next init"),this._initSourceBuffer()),this.audioSourceBuffer||(this.player.debugLog("MediaSource","onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),this._initAudioSourceBuffer()),this._hasPendingSegments()&&this._doAppendSegments()}initVideoEvents(){const{proxy:e}=this.player.events;this.player.on(at.visibilityChange,(e=>{e&&setTimeout((()=>{if(this.player.isPlaying()&&this.$videoElement){const e=this.getVideoBufferLastTime();e-this.$videoElement.currentTime>this.getMseBufferMaxDelayTime()&&(this.player.debugLog(this.TAG_NAME,`visibilityChange is true and lastTime is ${e} and currentTime is ${this.$videoElement.currentTime} so set currentTime to lastTime`),this.$videoElement.currentTime=e)}}),300)}));const t=e(this.$videoElement,Xi,(()=>{this.player.debugLog(this.TAG_NAME,"video canplay"),this.$videoElement.play().then((()=>{this.player.emit(at.removeLoadingBgImage),ka()?this.supportVideoFrameCallbackHandle||(this.player.debugLog(this.TAG_NAME,"video canplay and requestVideoFrameCallback and use videoFrameCallback"),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))):this.player.isUseHls265()&&(this.player.debugLog(this.TAG_NAME,"video canplay and use canvas render and fps is 25"),this._stopCanvasRender(),this.canvasRenderInterval=setInterval((()=>{this.player.video.render({$video:this.$videoElement,ts:parseInt(1e3*this.$videoElement.currentTime,10)||0})}),40)),this.player.debugLog(this.TAG_NAME,"video play")})).catch((e=>{this.player.debugError(this.TAG_NAME,"video play error ",e),this.player.emitError(dt.mediaSourceUseCanvasRenderPlayFailed,`code is ${e.code} and message is ${e.message}`)}))})),i=e(this.$videoElement,Zi,(()=>{this.player.debugLog(this.TAG_NAME,"video waiting")})),s=e(this.$videoElement,es,(e=>{parseInt(e.timeStamp,10),this.$videoElement.paused&&(this.player.debugWarn(this.TAG_NAME,"video is paused and next try to replay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video is paused and replay success")})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video is paused and replay error ",e)})))})),r=e(this.$videoElement,ts,(()=>{this.player.debugLog(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate),this.$videoElement&&this.$videoElement.paused&&this.player.debugWarn(this.TAG_NAME,"ratechange and video is paused")}));this.eventListenList.push(t,i,s,r)}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())return void this.player.debugLog(this.TAG_NAME,"videoFrameCallback() player is destroyed");const i=parseInt(1e3*Math.max(t.mediaTime,this.$videoElement.currentTime),10)||0;this.player.handleRender(),this.player.video.render({$video:this.$videoElement,ts:i}),this.player.isUseHls265()&&this.player.updateStats({fps:!0,ts:i}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}decodeVideo(e,t,i,s){const r=this.player;if(r)if(this.player.isDestroyedOrClosed())this.player.debugWarn(this.TAG_NAME,"decodeVideo() player is destroyed");else if(this.hasInit)if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(i&&0===e[1]){const t=15&e[0];let i={};if(t===At){i=Fn(e.slice(5))}else t===bt&&(i=qn(e));const s=this.player.video.videoInfo;s&&s.width&&s.height&&i&&i.codecWidth&&i.codecHeight&&(i.codecWidth!==s.width||i.codecHeight!==s.height)&&(this.player.debugWarn(this.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${s.width}, old height is ${s.height},\n new width is ${i.codecWidth}, new height is ${i.codecHeight},\n and emit change event`),this.isWidthOrHeightChanged=!0,this.player.emitError(dt.mseWidthOrHeightChange,`width ${s.width}->${i.codecWidth}, height ${s.height}->${i.codecHeight}`))}if(this.isWidthOrHeightChanged)return void this.player.debugWarn(this.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(ga(e))return void this.player.debugLog(this.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength<12)return void this.player.debugWarn(this.TAG_NAME,`decodeVideo and payload is too small , payload length is ${e.byteLength}`);let r=t;if(this.player.isPlayer()){if(null===this.firstRenderTime&&(this.firstRenderTime=t,this.player.debugLog(this.TAG_NAME,`firstRenderTime is ${this.firstRenderTime}`)),r=t-this.firstRenderTime,r<0&&(this.player.debugWarn(this.TAG_NAME,`decodeVideo\n local dts is < 0 , ts is ${t} and prevTs is ${this.prevTs},\n firstRenderTime is ${this.firstRenderTime} and mseCorrectTimeDuration is ${this.player._opt.mseCorrectTimeDuration}`),r=null===this.prevDts?0:this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(t)))return this.player.debugWarn(this.TAG_NAME,`decodeVideo is max diff , ts is ${t} and prevTs is ${this.prevTs}, diff is ${this.prevTs-t} and emit replay`),void this.player.emitError(dt.mediaSourceTsIsMaxDiff,`decodeVideo is max diff, prevTs is ${this.prevTs} and ts is ${t}`);if(null!==this.prevDts&&r<=this.prevDts){if(this.player.debugWarn(this.TAG_NAME,`\n decodeVideo dts is less than(or equal) prev dts ,\n dts is ${r} and prev dts is ${this.prevDts} ,\n and now ts is ${t} and prev ts is ${this.prevTs} ,\n and diff is ${t-this.prevTs} and firstRenderTime is ${this.firstRenderTime} and isIframe is ${i},\n and mseCorrectTimeDuration is ${this.player._opt.mseCorrectTimeDuration},\n and prevPayloadBufferSize is ${this.prevPayloadBufferSize} and payload size is ${e.byteLength}`),r===this.prevDts&&this.prevPayloadBufferSize===e.byteLength)return void this.player.debugWarn(this.TAG_NAME,"decodeVideo dts is equal to prev dts and payload size is equal to prev payload size so drop this frame");if(r=this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(t))return this.player.debugWarn(this.TAG_NAME,`decodeVideo is max diff , ts is ${t} and prevTs is ${this.prevTs}, diff is ${this.prevTs-t} and emit replay`),void this.emit(dt.mediaSourceTsIsMaxDiff,`decodeVideo is max diff, prevTs is ${this.prevTs} and ts is ${t}`)}}this.player.isPlayer()?this._decodeVideo(e,r,i,s,t):this.player.isPlayback()&&(Aa(this.player.playbackPause)?(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this._decodeVideo(e,r,i,s,t)):this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this._decodeVideo(e,r,i,s,t)),this.prevDts=r,this.prevPayloadBufferSize=e.byteLength,this.prevTs=t}else this.player.debugLog(this.TAG_NAME,"decodeVideo first frame is not iFrame");else if(i&&e[1]===As){const s=15&e[0];if(r.video.updateVideoInfo({encTypeCode:s}),s===bt&&Aa(Co()))return void this.player.emitError(dt.mediaSourceH265NotSupport);r._times.decodeStart||(r._times.decodeStart=oo()),this.hasInit=this._decodeConfigurationRecord(e,t,i,s)}else this.player.debugWarn(this.TAG_NAME,`decodeVideo has not init , isIframe is ${i} , payload is ${e[1]} so drop this frame`)}decodeAudio(e,t){if(this.player)if(this.player.isDestroyedOrClosed())this.player.debugWarn(this.TAG_NAME,"decodeAudio() player is destroyed");else if(Aa(this.hasAudioInit))this.hasAudioInit=this._decodeAudioConfigurationRecord(e,t);else{let i=t;if(Nr(e))return void this.player.debugLog(this.TAG_NAME,"decodeAudio and has already initialized and payload is aac codec packet so drop this frame");if(this._clearAudioNoDataCheckTimeout(),this.isDecodeFirstIIframe){if(this.player.isPlayer()){if(null===this.firstAudioTime&&(this.firstAudioTime=t,this.player.debugLog(this.TAG_NAME,`firstAudioTime is ${this.firstAudioTime}`)),i=t-this.firstAudioTime,i<0&&(this.player.debugWarn(this.TAG_NAME,`decodeAudio\n local dts is < 0 , ts is ${t} and prevTs is ${this.prevAudioTs},\n firstAudioTime is ${this.firstAudioTime}`),i=null===this.prevAudioDts?0:this.prevAudioDts+this.player._opt.mseCorrectAudioTimeDuration,this._checkAudioTsIsMaxDiff(t)))return this.player.debugWarn(this.TAG_NAME,`decodeAudio is max diff , ts is ${t} and prevTs is ${this.prevAudioDts}, diff is ${this.prevAudioDts-t} and emit replay`),void this.player.emitError(dt.mediaSourceTsIsMaxDiff,`decodeAudio is max diff, prevTs is ${this.prevAudioDts} and ts is ${t}`);null!==this.prevAudioTs&&i<=this.prevAudioDts&&(this.player.debugWarn(this.TAG_NAME,`\n decodeAudio dts is less than(or equal) prev dts ,\n dts is ${i} and prev dts is ${this.prevAudioDts} ,\n and now ts is ${t} and prev ts is ${this.prevAudioTs} ,\n and diff is ${t-this.prevAudioTs}`),i=this.prevAudioDts+this.player._opt.mseCorrectAudioTimeDuration)}(this.player.isPlayer()||this.player.isPlayback()&&(Aa(this.player.playbackPause)||this.player.playback.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()))&&this._decodeAudio(e,i,t),this.prevAudioTs=t,this.prevAudioDts=i}else this.player.debugLog(this.TAG_NAME,"decodeAudio first frame is not iFrame")}}_checkTsIsMaxDiff(e){return this.prevTs>0&&eZ}_checkAudioTsIsMaxDiff(e){return this.prevAudioTs>0&&eZ}_decodeConfigurationRecord(e,t,i,s){let r=e.slice(5),o={};if(s===At?o=Fn(r):s===bt&&(o=Kn(r)),Jo(o)||0===o.codecWidth&&0===o.codecHeight){this.player.debugWarn(this.TAG_NAME,"_decodeConfigurationRecord",o);let e="";return e=Jo(o)?"config is empty object":`config is not empty object and codecWidth is ${o.codecWidth} and codecHeight is ${o.codecHeight}`,this.player.emitError(dt.mediaSourceDecoderConfigurationError,e),!1}this.isInitInfo||(this.player.debugLog(this.TAG_NAME,`updateVideoInfo: ${o.codecWidth},${o.codecHeight}`),this.player.video.updateVideoInfo({width:o.codecWidth,height:o.codecHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0),this.player.recorder&&this.player._opt.recordType===S&&this.player.recorder.initMetaData(e,s);const a={id:or,type:"video",timescale:1e3,duration:0,avcc:r,codecWidth:o.codecWidth,codecHeight:o.codecHeight,videoType:o.videoType},n=gc.generateInitSegment(a);this.isAvc=s===At;let l=o.codec;return this.videoMimeType=l?`video/mp4; codecs="${o.codec}"`:this.isAvc?ui:pi,this._initSourceBuffer(),this.appendBuffer(n.buffer),this.sequenceNumber=0,this.cacheTrack={},!0}_decodeAudioConfigurationRecord(e,t){const i=e[0]>>4,s=e[0]>>1&1,r=i===Et,o=i===wt;let a="";if(a=o?s?16:8:0===s?8:16,Aa(o||r))return this.player.debugWarn(this.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${i} ant auto wasm decode`),this.player.emit(dt.mediaSourceAudioG711NotSupport),!1;const n={id:ar,type:"audio",timescale:1e3};let l={};if(Nr(e)){if(l=$r(e.slice(2)),!l)return!1;n.audioSampleRate=l.sampleRate,n.channelCount=l.channelCount,n.config=l.config,n.refSampleDuration=1024/n.audioSampleRate*n.timescale}else{if(!r)return!1;if(l=Kh(e),!l)return!1;n.audioSampleRate=l.samplingRate,n.channelCount=l.channelCount,n.refSampleDuration=1152/n.audioSampleRate*n.timescale}n.codec=l.codec,n.duration=0;let d="mp4",h=l.codec,c=null;r&&Aa(yo())?(d="mpeg",h="",c=new Uint8Array):c=gc.generateInitSegment(n);let u=`${n.type}/${d}`;return h&&h.length>0&&(u+=`;codecs=${h}`),Aa(this.isAudioInitInfo)&&(this.player.audio.updateAudioInfo({encTypeCode:i,channels:n.channelCount,sampleRate:n.audioSampleRate,depth:a}),this.isAudioInitInfo=!0),this.audioMimeType=u,this.isAAC=o,this._initAudioSourceBuffer(),this.appendAudioBuffer(c.buffer),!0}_initSourceBuffer(){const{events:{proxy:e}}=this.player;if(null===this.sourceBuffer&&null!==this.mediaSource&&this.isStateOpen&&this.videoMimeType){try{this.sourceBuffer=this.mediaSource.addSourceBuffer(this.videoMimeType),this.player.debugLog(this.TAG_NAME,"_initSourceBuffer() this.mediaSource.addSourceBuffer()",this.videoMimeType)}catch(e){return this.player.debugError(this.TAG_NAME,"appendBuffer() this.mediaSource.addSourceBuffer()",e.code,e),this.player.emitError(dt.mseAddSourceBufferError,`code is ${e.code} and message is ${e.message}`),void(this.mediaSourceAddSourceBufferError=!0)}if(this.sourceBuffer){const t=e(this.sourceBuffer,"error",(e=>{this.mediaSourceBufferError=!0,this.player.debugError(this.TAG_NAME,"mseSourceBufferError this.sourceBuffer",e),this.player.emitError(dt.mseSourceBufferError,e.toString())})),i=e(this.sourceBuffer,"updateend",(()=>{this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this.hasPendingEos&&(this.player.debugLog(this.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),this.endOfStream())}));this.eventListenList.push(t,i)}}else this.player.debugLog(this.TAG_NAME,`_initSourceBuffer and this.isStateOpen is ${this.isStateOpen} and this.isAvc === null is ${null===this.isAvc}`)}_initAudioSourceBuffer(){const{events:{proxy:e}}=this.player;if(null===this.audioSourceBuffer&&null!==this.mediaSource&&this.isStateOpen&&this.audioMimeType){try{this.audioSourceBuffer=this.mediaSource.addSourceBuffer(this.audioMimeType),this._clearAudioSourceBufferCheckTimeout(),this.player.debugLog(this.TAG_NAME,"_initAudioSourceBuffer() this.mediaSource.addSourceBuffer()",this.audioMimeType)}catch(e){return this.player.debugError(this.TAG_NAME,"appendAudioBuffer() this.mediaSource.addSourceBuffer()",e.code,e),this.player.emitError(dt.mseAddSourceBufferError,`code is ${e.code} and message is ${e.message}`),void(this.mediaSourceAddSourceBufferError=!0)}if(this.audioSourceBuffer){const t=e(this.audioSourceBuffer,"error",(e=>{this.mediaSourceBufferError=!0,this.player.debugError(this.TAG_NAME,"mseSourceBufferError this.audioSourceBuffer",e),this.player.emitError(dt.mseSourceBufferError,e.toString())})),i=e(this.audioSourceBuffer,"updateend",(()=>{this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this.hasPendingEos&&(this.player.debugLog(this.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),this.endOfStream())}));this.eventListenList.push(t,i),null===this.audioSourceNoDataCheckTimeout&&(this.audioSourceNoDataCheckTimeout=setTimeout((()=>{this._clearAudioNoDataCheckTimeout(),this.player.emit(dt.mediaSourceAudioNoDataTimeout)}),1e3))}}else this.player.debugLog(this.TAG_NAME,`_initAudioSourceBuffer and this.isStateOpen is ${this.isStateOpen} and this.audioMimeType is ${this.audioMimeType}`)}_decodeVideo(e,t,i,s,r){const o=this.player;let a=e.slice(5),n=a.byteLength;if(0===n)return void o.debugWarn(this.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let l=(new Date).getTime(),d=!1;this.prevTimestamp||(this.prevTimestamp=l,d=!0);const h=l-this.prevTimestamp;this.decodeDiffTimestamp=h,h>1e3&&!d&&this.player.isPlayer()&&o.debugLog(this.TAG_NAME,`_decodeVideo now time is ${l} and prev time is ${this.prevTimestamp}, diff time is ${h} ms`);const c=this.$videoElement;if(this.cacheTrack.id&&t>=this.cacheTrack.dts){let e=8+this.cacheTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(gc.types.mdat,4),i.set(this.cacheTrack.data,8),this.cacheTrack.duration=t-this.cacheTrack.dts,this.cacheTrack.duration>1e3&&this.player.debugWarn(this.TAG_NAME,`cacheTrack duration is ${this.cacheTrack.duration} ms`);let s=gc.moof(this.cacheTrack,this.cacheTrack.dts);this.cacheTrack={};let a=new Uint8Array(s.byteLength+i.byteLength);a.set(s,0),a.set(i,s.byteLength),this.appendBuffer(a.buffer),o.emit(at.timeUpdate,r),o.isPlayer()?o.isUseHls265()?o.updateStats({dfps:!0,mseTs:t}):o.updateStats({fps:!0,dfps:!0,ts:r,mseTs:t}):o.isPlayback()&&o.playback.updateStats({ts:r}),o._times.videoStart||(o._times.videoStart=oo(),o.handlePlayToRenderTimes())}else o.debugLog(this.TAG_NAME,`cacheTrack = {} now dts is ${t}, and ts is ${r} cacheTrack dts is ${this.cacheTrack&&this.cacheTrack.dts}`),this.cacheTrack={};this.cacheTrack||(this.cacheTrack={}),this.cacheTrack.id=or,this.cacheTrack.sequenceNumber=++this.sequenceNumber,this.cacheTrack.size=n,this.cacheTrack.dts=t,this.cacheTrack.cts=s,this.cacheTrack.isKeyframe=i,this.cacheTrack.data=a,this.cacheTrack.flags={isLeading:0,dependsOn:i?2:1,isDependedOn:i?1:0,hasRedundancy:0,isNonSync:i?0:1},o._opt.mseUseCanvasRender&&Aa(this.isSupportVideoFrameCallback)&&Aa(o.isUseHls265())&&o.video.render({$video:c,ts:t}),this.prevTimestamp=(new Date).getTime()}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}_decodeAudio(e,t,i){const s=this.player;let r=this.isAAC?e.slice(2):e.slice(1),o=r.byteLength;if(this.cacheAudioTrack.id&&t>=this.cacheAudioTrack.dts){let e=8+this.cacheAudioTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(gc.types.mdat,4),i.set(this.cacheAudioTrack.data,8),this.cacheAudioTrack.duration=t-this.cacheAudioTrack.dts;let s=gc.moof(this.cacheAudioTrack,this.cacheAudioTrack.dts);this.cacheAudioTrack={};let r=new Uint8Array(s.byteLength+i.byteLength);r.set(s,0),r.set(i,s.byteLength),this.appendAudioBuffer(r.buffer)}else s.debugLog(this.TAG_NAME,`cacheAudioTrack = {} now dts is ${t} cacheAudioTrack dts is ${this.cacheAudioTrack&&this.cacheAudioTrack.dts}`),this.cacheAudioTrack={};this.cacheAudioTrack||(this.cacheAudioTrack={}),this.cacheAudioTrack.id=ar,this.cacheAudioTrack.sequenceNumber=++this.audioSequenceNumber,this.cacheAudioTrack.size=o,this.cacheAudioTrack.dts=t,this.cacheAudioTrack.cts=0,this.cacheAudioTrack.data=r,this.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}appendBuffer(e){this.player.isDestroyedOrClosed()?this.player.debugWarn(this.TAG_NAME,"appendBuffer() player is destroyed"):(this.player,this.mediaSourceAddSourceBufferError?this.player.debugWarn(this.TAG_NAME,"appendBuffer() this.mediaSourceAddSourceBufferError is true"):this.mediaSourceAppendBufferFull?this.player.debugWarn(this.TAG_NAME,"appendBuffer() this.mediaSourceAppendBufferFull is true"):this.mediaSourceAppendBufferError?this.player.debugWarn(this.TAG_NAME,"appendBuffer() this.mediaSourceAppendBufferError is true"):this.mediaSourceBufferError?this.player.debugWarn(this.TAG_NAME,"appendBuffer() this.mediaSourceBufferError is true"):(this.pendingSegments.push(e),this.sourceBuffer&&(this.player.isPlayer()&&this._handleUpdatePlaybackRate(),this.player.isPlayback()&&(this._handleUpdateBufferDelayTime(),this._checkVideoPlayCurrentTime()),this.player._opt.mseAutoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanUpSourceBuffer(),Aa(this.getSourceBufferUpdating())&&this.isStateOpen&&Aa(this._hasPendingRemoveRanges()))?this._doAppendSegments():this.isStateClosed?(this.mediaSourceBufferError=!0,this.player.emitError(dt.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):this.isStateEnded&&(this.mediaSourceBufferError=!0,this.player.emitError(dt.mseSourceBufferError,"mediaSource is end"))))}appendAudioBuffer(e){this.player.isDestroyedOrClosed()?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() player is destroyed"):(this.player,this.mediaSourceAddSourceBufferError?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAddSourceBufferError is true"):this.mediaSourceAppendBufferFull?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAppendBufferFull is true"):this.mediaSourceAppendBufferError?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAppendBufferError is true"):this.mediaSourceBufferError?this.player.debugWarn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceBufferError is true"):(this.pendingAudioSegments.push(e),this.audioSourceBuffer&&(this.player.isPlayer()&&this._handleUpdatePlaybackRate(),this.player.isPlayback()&&(this._handleUpdateBufferDelayTime(),this._checkVideoPlayCurrentTime()),this.player._opt.mseAutoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanUpSourceBuffer(),Aa(this.getAudioSourceBufferUpdating())&&this.isStateOpen&&Aa(this._hasPendingRemoveRanges()))?this._doAppendSegments():this.isStateClosed?(this.mediaSourceBufferError=!0,this.player.emitError(dt.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):this.isStateEnded&&(this.mediaSourceBufferError=!0,this.player.emitError(dt.mseSourceBufferError,"mediaSource is end"))))}getSourceBufferUpdating(){return this.sourceBuffer&&this.sourceBuffer.updating}getAudioSourceBufferUpdating(){return this.audioSourceBuffer&&this.audioSourceBuffer.updating}stop(){this.abortSourceBuffer(),this.removeSourceBuffer(),this.endOfStream()}checkSourceBufferDelay(){const e=this.$videoElement;let t=0,i=0;return e.buffered.length>0&&(i=e.buffered.end(e.buffered.length-1),t=i-e.currentTime),t<0&&(this.player.debugWarn(this.TAG_NAME,`checkMSESourceBufferDelay ${t} < 0, and buffered is ${i} ,currentTime is ${e.currentTime} , try to seek ${e.currentTime} to ${i}`),e.currentTime=i,e.paused&&(this.player.debugWarn(this.TAG_NAME,"checkSourceBufferDelay and video is paused and sent isMSECurrentMoreThanBufferedPause true"),this.player.isMSECurrentMoreThanBufferedPause=!0),t=0),t}checkSourceBufferStore(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.currentTime-e.buffered.start(0)),t}checkSourceBufferEndLessThanCurrentTime(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.buffered.end(e.buffered.length-1)-e.currentTime),t}getDecodeDiffTimes(){return this.decodeDiffTimestamp}removeBuffer(e,t){const i=Zo();if(this.player.debugLog(this.TAG_NAME,`removeBuffer() start is ${e} and end is ${t} and _isMacOsFirefox is ${i}`),this.isStateOpen&&Aa(i)){if(Aa(this.getSourceBufferUpdating()))try{this.sourceBuffer.remove(e,t)}catch(e){this.player.debugWarn(this.TAG_NAME,"removeBuffer() sourceBuffer error",e)}if(Aa(this.getAudioSourceBufferUpdating()))try{this.audioSourceBuffer.remove(e,t)}catch(e){this.player.debugWarn(this.TAG_NAME,"removeBuffer() audioSourceBuffer error",e)}}}clearUpAllSourceBuffer(){if(this.sourceBuffer){const e=this.sourceBuffer.buffered;for(let t=0;t=1)if(this.getSourceBufferUpdating()||this.getAudioSourceBufferUpdating())this.hasPendingEos=!0;else{this.hasPendingEos=!1;try{this.player.debugLog(this.TAG_NAME,"endOfStream()"),this.mediaSource.endOfStream()}catch(e){this.player.debugWarn(this.TAG_NAME,"endOfStream() error",e)}}}abortSourceBuffer(){if(this.isStateOpen){if(this.sourceBuffer){try{this.player.debugLog(this.TAG_NAME,"abortSourceBuffer() abort sourceBuffer"),this.sourceBuffer.abort()}catch(e){}Aa(this.getSourceBufferUpdating())&&this._doRemoveRanges()}if(this.audioSourceBuffer){try{this.player.debugLog(this.TAG_NAME,"abortSourceBuffer() abort audioSourceBuffer"),this.audioSourceBuffer.abort()}catch(e){}Aa(this.getAudioSourceBufferUpdating())&&this._doRemoveRanges()}}this.sourceBuffer=null,this.audioSourceBuffer=null}removeSourceBuffer(){if(!this.isStateClosed&&this.mediaSource){if(this.sourceBuffer)try{this.player.debugLog(this.TAG_NAME,"removeSourceBuffer() sourceBuffer"),this.mediaSource.removeSourceBuffer(this.sourceBuffer)}catch(e){this.player.debugError(this.TAG_NAME,"removeSourceBuffer() sourceBuffer error",e)}if(this.audioSourceBuffer)try{this.player.debugLog(this.TAG_NAME,"removeSourceBuffer() audioSourceBuffer"),this.mediaSource.removeSourceBuffer(this.audioSourceBuffer)}catch(e){this.player.debugError(this.TAG_NAME,"removeSourceBuffer() audioSourceBuffer error",e)}}}_hasPendingSegments(){return this.pendingSegments.length>0||this.pendingAudioSegments.length>0}getPendingSegmentsLength(){return this.pendingSegments.length}_handleUpdatePlaybackRate(){if(!this.$videoElement)return;const e=this.$videoElement;this.player._opt.videoBuffer,this.player._opt.videoBufferDelay;const t=e.buffered;t.length&&t.start(0);const i=t.length?t.end(t.length-1):0;let s=e.currentTime;const r=i-s,o=this.getMseBufferMaxDelayTime();if(this.player.updateStats({mseVideoBufferDelayTime:r}),0===this.$videoElement.readyState)return;if(r>o)this.player.debugLog(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current is ${s} , delay buffer is more than ${o} is ${r} and new time is ${i}`),e.currentTime=i,s=e.currentTime;else if(r<0&&0===i)return this.player.debugWarn(this.TAG_NAME,`handleUpdatePlaybackRate and delay buffer is ${i} - current is ${s} = ${r} < 0 and check video is paused : ${e.paused} `),void this.player.emit(dt.mediaSourceBufferedIsZeroError,"video.buffered is empty");const a=this._getPlaybackRate(i-s);e.playbackRate!==a&&(this.player.debugLog(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current time is ${s} and delay is ${i-s} set playbackRate is ${a} `),e.playbackRate=a)}_handleUpdateBufferDelayTime(){const e=this.getVideoBufferDelayTime();this.player.updateStats({mseVideoBufferDelayTime:e})}_checkVideoPlayCurrentTime(){const e=this.checkSourceBufferStore();if(e<0){const t=this.getVideoBufferStartTime();this.player.debugWarn(this.TAG_NAME,`checkVideoPlayCurrentTime store is ${e} < 0 and set currentTime ${this.$videoElement.currentTime} to ${t}`),this.$videoElement.currentTime=t}}updateVideoCurrentTimeByBufferStart(){if(!this.$videoElement)return;const e=this.$videoElement.currentTime,t=this.getVideoBufferRangeList();let i=null;for(let s=0;s{this._clearAudioSourceBufferCheckTimeout(),this.player.emit(dt.mediaSourceAudioInitTimeout)}),1e3)));if(Aa(this.getSourceBufferUpdating())&&this.pendingSegments.length>0){const e=this.pendingSegments.shift();try{this.sourceBuffer.appendBuffer(e)}catch(e){this.player.debugError(this.TAG_NAME,"this.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.player.emitError(dt.mediaSourceFull,`code is ${e.code} and message is ${e.message}`)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.player.emitError(dt.mediaSourceAppendBufferError,`code is ${e.code} and message is ${e.message}`)):(this.stop(),this.mediaSourceBufferError=!0,this.player.emitError(at.mseSourceBufferError,`code is ${e.code} and message is ${e.message}`))}}if(Aa(this.getAudioSourceBufferUpdating())&&this.pendingAudioSegments.length>0){const e=this.pendingAudioSegments.shift();try{this.audioSourceBuffer.appendBuffer(e)}catch(e){this.player.debugError(this.TAG_NAME,"this.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.player.emitError(dt.mediaSourceFull,`code is ${e.code} and message is ${e.message}`)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.player.emitError(dt.mediaSourceAppendBufferError,`code is ${e.code} and message is ${e.message}`)):(this.stop(),this.mediaSourceBufferError=!0,this.player.emitError(at.mseSourceBufferError,`code is ${e.code} and message is ${e.message}`))}}}else this.player.debugLog(this.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")}_doCleanUpSourceBuffer(){if(!this.$videoElement)return;const e=this.$videoElement.currentTime;if(this.sourceBuffer){const t=this.sourceBuffer.buffered;let i=!1;for(let s=0;s=this.player._opt.mseAutoCleanupMaxBackwardDuration){i=!0;let t=e-this.player._opt.mseAutoCleanupMinBackwardDuration;this.pendingRemoveRanges.push({start:r,end:t})}}else o=this.player._opt.mseAutoCleanupMaxBackwardDuration){i=!0;let t=e-this.player._opt.mseAutoCleanupMinBackwardDuration;this.pendingAudioRemoveRanges.push({start:r,end:t})}}else o0||this.pendingAudioRemoveRanges.length>0}_doRemoveRanges(){if(this.sourceBuffer&&Aa(this.getSourceBufferUpdating())){let e=this.pendingRemoveRanges;for(;e.length&&Aa(this.getSourceBufferUpdating());){let t=e.shift();try{this.sourceBuffer.remove(t.start,t.end)}catch(e){this.player.debugWarn(this.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e)}}}if(this.audioSourceBuffer&&Aa(this.getAudioSourceBufferUpdating())){let e=this.pendingAudioRemoveRanges;for(;e.length&&Aa(this.getAudioSourceBufferUpdating());){let t=e.shift();try{this.audioSourceBuffer.remove(t.start,t.end)}catch(e){this.player.debugWarn(this.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e)}}}}getDecodePlaybackRate(){let e=0;const t=this.$videoElement;return t&&(e=t.playbackRate),e}_getPlaybackRate(e){const t=this.$videoElement;let i=this.player._opt.videoBufferDelay+this.player._opt.videoBuffer;const s=Math.max(i,1e3),r=s/2;return e*=1e3,1===t.playbackRate?e>s?1.2:1:e<=r?1:t.playbackRate}_needCleanupSourceBuffer(){if(Aa(this.player._opt.mseAutoCleanupSourceBuffer)||!this.$videoElement)return!1;const e=this.$videoElement,t=e.buffered,i=e.currentTime;return t.length>=1&&i-t.start(0)>=this.player._opt.mseAutoCleanupMaxBackwardDuration}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}getVideoBufferLastTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;i.length&&i.start(0);t=i.length?i.end(i.length-1):0}return t}getVideoBufferTimeRange(){const e=this.$videoElement;let t=null;if(e){const i=e.buffered,s=i.length?i.start(0):0,r=i.length?i.end(i.length-1):0;t={start:s,end:r,diff:r-s}}return t}getVideoBufferStartTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;t=i.length?i.start(0):0}return t}getVideoBufferEndTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;t=i.length?i.end(i.length-1):0}return t}getVideoBufferRangeList(){const e=this.$videoElement;let t=[];if(e){const i=e.buffered;for(let e=0;e0?t:0}_clearAudioSourceBufferCheckTimeout(){this.audioSourceBufferCheckTimeout&&(clearTimeout(this.audioSourceBufferCheckTimeout),this.audioSourceBufferCheckTimeout=null)}_clearAudioNoDataCheckTimeout(){this.audioSourceNoDataCheckTimeout&&(clearTimeout(this.audioSourceNoDataCheckTimeout),this.audioSourceNoDataCheckTimeout=null)}getMimeType(){return{video:this.videoMimeType,audio:this.audioMimeType}}getMseBufferMaxDelayTime(){let e=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3;return Math.max(5,e+3)}isVideoPlaying(){return this.$videoElement&&Aa(this.$videoElement.paused)&&Aa(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}}const Ac=()=>"wakeLock"in navigator&&-1===window.navigator.userAgent.indexOf("Samsung")&&Aa(bo());class bc{constructor(e){this.player=e,this.enabled=!1,Ac()?(this.player.debugLog("NoSleep","Native Wake Lock API supported."),this._wakeLock=null,this.handleVisibilityChange=()=>{null!==this._wakeLock&&"visible"===document.visibilityState&&this.enable()},document.addEventListener("visibilitychange",this.handleVisibilityChange),document.addEventListener("fullscreenchange",this.handleVisibilityChange)):(this.player.debugLog("NoSleep","Native Wake Lock API not supported. so use video element."),this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQRChYECGFOAZwEAAAAAABLfEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHYTbuMU6uEElTDZ1OsggGXTbuMU6uEHFO7a1OsghLJ7AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmsirXsYMPQkBNgI1MYXZmNTguNDUuMTAwV0GNTGF2ZjU4LjQ1LjEwMESJiECzmgAAAAAAFlSua0C5rgEAAAAAAABO14EBc8WI9UhIq9EDJPCcgQAitZyDdW5khoVWX1ZQOIOBASPjg4QF9eEA4AEAAAAAAAAbsIIBQLqB8FSwggElVLqB8FWwiFW3gQFVuIECrgEAAAAAAABZ14ECc8WIUEWPA9J/iJ6cgQAitZyDdW5khoZBX09QVVNWqoNjLqBWu4QExLQAg4EC4ZGfgQG1iEDncAAAAAAAYmSBIGOik09wdXNIZWFkAQE4AYC7AAAAAAASVMNnQcJzcwEAAAAAAACXY8CAZ8gBAAAAAAAAFUWji01BSk9SX0JSQU5ERIeEaXNvbWfIAQAAAAAAABZFo41NSU5PUl9WRVJTSU9ORIeDNTEyZ8gBAAAAAAAAJ0WjkUNPTVBBVElCTEVfQlJBTkRTRIeQaXNvbWlzbzJhdmMxbXA0MWfIAQAAAAAAABpFo4dFTkNPREVSRIeNTGF2ZjU4LjQ1LjEwMHNzAQAAAAAAAIZjwItjxYj1SEir0QMk8GfIAQ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eCAeGA+P/+o4eCAfWA+P/+o56BAfsA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4ICCYD4//6jh4ICHYD4//6jh4ICMYD4//6jh4ICRYD4//6jh4ICWYD4//6jnoECXwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggJtgPj//qOHggKBgPj//qOHggKVgPj//qOHggKpgPj//qOHggK9gPj//qOegQLDANECAAUQEBRgAGFgv9AAIgAQzX61yT5xzAAAo4eCAtGA+P/+o4eCAuWA+P/+o4eCAvmA+P/+o4eCAw2A+P/+o4eCAyGA+P/+o56BAycA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IDNYD4//6jh4IDSYD4//6jh4IDXYD4//6jh4IDcYD4//6jh4IDhYD4//6jnoEDiwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggOZgPj//qOHggOtgPj//qOHggPBgPj//qOHggPVgPj//qOHggPpgPj//qOegQPvANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCA/2A+P/+o4eCBBGA+P/+o4eCBCWA+P/+o4eCBDmA+P/+o4eCBE2A+P/+o56BBFMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IEiID4//6jh4IEnID4//6jh4IEsID4//6jnoEEtwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggTEgPj//qOHggTYgPj//qOHggTsgPj//qOHggUAgPj//qOHggUUgPj//qOegQUbANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCBSiA+P/+o4eCBTyA+P/+o4eCBVCA+P/+o4eCBWSA+P/+o4eCBXiA+P/+o56BBX8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IFjID4//6jh4IFoID4//6jh4IFtID4//6jh4IFyID4//6jh4IF3ID4//6jnoEF4wDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggXwgPj//qOHggYEgPj//qOHggYYgPj//qOHggYsgPj//qOHggZAgPj//qOegQZHANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCBlSA+P/+o4eCBmiA+P/+o4eCBnyA+P/+o4eCBpCA+P/+o4eCBqSA+P/+o56BBqsA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IGuID4//6jh4IGzID4//6jh4IG4ID4//6jh4IG9ID4//6jh4IHCID4//6jnoEHDwDRAgAFEBAUYABhYL/QACIAEM1+tck+ccwAAKOHggccgPj//qOHggcwgPj//qOHggdEgPj//qOHggdYgPj//qOHggdsgPj//qOegQdzANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCB4CA+P/+o4eCB5SA+P/+o4eCB6iA+P/+o4eCB7yA+P/+o4eCB9CA+P/+o56BB9cA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IH5ID4//6jh4IH+ID4//6jh4IIDID4//6jh4IIIID4//6jh4IINID4//6jnoEIOwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgghIgPj//qOHgghcgPj//qOHgghwgPj//qOHggiEgPj//qOegQifANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCMCA+P/+o4eCCNSA+P/+o4eCCOiA+P/+o4eCCPyA+P/+o56BCQMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IJEID4//6jh4IJJID4//6jh4IJOID4//6jh4IJTID4//6jh4IJYID4//6jnoEJZwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggl0gPj//qOHggmIgPj//qOHggmcgPj//qOHggmwgPj//qOHggnEgPj//qOegQnLANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCdiA+P/+o4eCCeyA+P/+o4eCCgCA+P/+o4eCChSA+P/+o4eCCiiA+P/+o56BCi8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IKPID4//6jh4IKUID4//6jh4IKZID4//6jh4IKeID4//6jh4IKjID4//6jnoEKkwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggqggPj//qOHggq0gPj//qOHggrIgPj//qOHggrcgPj//qOHggrwgPj//qOegQr3ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCwSA+P/+o4eCCxiA+P/+o4eCCyyA+P/+o4eCC0CA+P/+o4eCC1SA+P/+o56BC1sA0QIABRAQFGAAYWC/0AAiABDNfrXJPnHMAACjh4ILaID4//6jh4ILfID4//6jh4ILkID4//6jh4ILpID4//6jh4ILuID4//6jnoELvwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggvMgPj//qOHggvggPj//qOHggv0gPj//qOHggwIgPj//qOHggwcgPj//qOegQwjANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCDDCA+P/+o4eCDESA+P/+o4eCDFiA+P/+o4eCDGyA+P/+o4eCDICA+P/+o56BDIcA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IMlID4//6jh4IMqID4//6jh4IMvID4//6jh4IM0ID4//6jnoEM6wDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgg0MgPj//qOHgg0ggPj//qOHgg00gPj//qOHgg1IgPj//qOegQ1PANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCDVyA+P/+o4eCDXCA+P/+o4eCDYSA+P/+o4eCDZiA+P/+o4eCDayA+P/+o56BDbMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4INwID4//6jh4IN1ID4//6jh4IN6ID4//6jh4IN/ID4//6jh4IOEID4//6jnoEOFwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgg4kgPj//qOHgg44gPj//qOHgg5MgPj//qOHgg5ggPj//qOHgg50gPj//qOegQ57ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCDoiA+P/+o4eCDpyA+P/+o4eCDrCA+P/+o4eCDsSA+P/+o4eCDtiA+P/+o56BDt8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IO7ID4//6jh4IPAID4//6jh4IPFID4//6jh4IPKID4//6jh4IPPID4//6jnoEPQwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgg9QgPj//qOHgg9kgPj//qOHgg94gPj//qOHgg+MgPj//qOHgg+ggPj//qOegQ+nANECAAUQEBRgAGFgv9AAIgAQzX61yT5xzAAAo4eCD7SA+P/+o4eCD8iA+P/+o4eCD9yA+P/+o4eCD/CA+P/+o4eCEASA+P/+o56BEAsA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IQGID4//6jh4IQLID4//6jh4IQQID4//6jh4IQVID4//6jh4IQaID4//6jnoEQbwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghB8gPj//qOHghCQgPj//qOHghCkgPj//qOHghC4gPj//qOHghDMgPj//qOegRDTANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEOCA+P/+o4eCEPSA+P/+o4eCEQiA+P/+o56BETcA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IRQ4D4//6jh4IRV4D4//6jh4IRa4D4//6jh4IRf4D4//6jh4IRk4D4//6jnoERmwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghGngPj//qOHghG7gPj//qOHghHPgPj//qOHghHjgPj//qOHghH3gPj//qOegRH/ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEguA+P/+o4eCEh+A+P/+o4eCEjOA+P/+o4eCEkeA+P/+o4eCEluA+P/+o56BEmMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4ISb4D4//6jh4ISg4D4//6jh4ISl4D4//6jh4ISq4D4//6jh4ISv4D4//6jnoESxwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghLTgPj//qOHghLngPj//qOHghL7gPj//qOHghMPgPj//qOHghMjgPj//qOegRMrANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEzeA+P/+o4eCE0uA+P/+o4eCE1+A+P/+o4eCE3OA+P/+oAEA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111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111114BGCAHARggBwEYIAcBGCAHARggBwAAAAdBmjgf4BLYARggBwEYIAcBGCAHARggBwAAAAdBmlQH+AS2ARggBwEYIAcBGCAHARggBwAAAAdBmmA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZqAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZqgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZrAP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0Ga4D/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbAD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbID/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBm0A/wCWwARggBwEYIAcBGCAHAAAAB0GbYD/AJbABGCAHARggBwEYIAcAAAAHQZuAP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GboD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbwD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0Gb4D/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBmgA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmiA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmkA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZpgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZqAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZqgP8AlsAEYIAcBGCAHARggBwAAAAdBmsA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmuA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmwA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZsgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZtAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZtgP8AlsAEYIAcBGCAHARggBwEYIAcB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EAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAA3HN0Y28AAAAAAAAAMwAAADAAAAOtAAADzAAAA+cAAAQCAAAEIQAABDwAAARXAAAEdgAABJEAAASsAAAEywAABOIAAAT5AAAFGAAABTMAAAVOAAAFbQAABYgAAAWjAAAFwgAABd0AAAX4AAAGDwAABioAAAZFAAAGZAAABn8AAAaaAAAGuQAABtQAAAbvAAAHDgAABykAAAc8AAAHWwAAB3YAAAeRAAAHsAAAB8sAAAfmAAAIBQAACCAAAAg7AAAIWgAACG0AAAiIAAAIpwAACMIAAAjdAAAI/AAAABpzZ3BkAQAAAHJvbGwAAAACAAAAAf//AAAAHHNiZ3AAAAAAcm9sbAAAAAEAAADSAAAAAQAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTguMjAuMTAw"),Object.assign(this.noSleepVideo.style,{position:"absolute",left:"-100%",top:"-100%"}),document.querySelector("body").append(this.noSleepVideo),this.handleNoSleepVideoTimeUpdate=()=>{this.noSleepVideo&&this.noSleepVideo.currentTime>4&&(this.noSleepVideo.currentTime=1)},this.noSleepVideo.addEventListener("timeupdate",this.handleNoSleepVideoTimeUpdate))}destroy(){if(this._wakeLock&&(this._wakeLock.release(),this._wakeLock=null),this.noSleepVideo){this.handleNoSleepVideoTimeUpdate&&this.noSleepVideo.removeEventListener("timeupdate",this.handleNoSleepVideoTimeUpdate);try{this.noSleepVideo.parentNode&&this.noSleepVideo.parentNode.removeChild(this.noSleepVideo)}catch(e){this.player.debugWarn("NoSleep","Failed to remove noSleepVideo element.")}this.noSleepVideo=null}this.handleVisibilityChange&&(document.removeEventListener("visibilitychange",this.handleVisibilityChange),document.removeEventListener("fullscreenchange",this.handleVisibilityChange))}_addSourceToVideo(e,t,i){var s=document.createElement("source");s.src=i,s.type=`video/${t}`,e.appendChild(s)}get isEnabled(){return this.enabled}enable(){if(Ac())return navigator.wakeLock.request("screen").then((e=>{this._wakeLock=e,this.enabled=!0,this.player.debugLog("wakeLock","Wake Lock active."),this._wakeLock.addEventListener("release",(()=>{this.player.debugLog("wakeLock","Wake Lock released.")}))})).catch((e=>{throw this.enabled=!1,this.player.debugWarn("wakeLock",`${e.name}, ${e.message}`),e}));return this.noSleepVideo.play().then((e=>(this.player.debugLog("wakeLock","noSleepVideo Wake Lock active."),this.enabled=!0,e))).catch((e=>{throw this.player.debugWarn("wakeLock",`noSleepVideo ${e.name}, ${e.message}`),this.enabled=!1,e}))}disable(){Ac()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):this.noSleepVideo&&this.noSleepVideo.pause(),this.enabled=!1,this.player.debugLog("wakeLock","Disabling wake lock.")}}function vc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _c={exports:{}};!function(e,t){var i,s,r,o,a;i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=a.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=a.normalizePath(r.path),a.buildURLFromParts(r)}var o=a.parseURL(t);if(!o)throw new Error("Error trying to parse relative URL.");if(o.scheme)return i.alwaysNormalize?(o.path=a.normalizePath(o.path),a.buildURLFromParts(o)):t;var n=a.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");if(!n.netLoc&&n.path&&"/"!==n.path[0]){var l=s.exec(n.path);n.netLoc=l[1],n.path=l[2]}n.netLoc&&!n.path&&(n.path="/");var d={scheme:n.scheme,netLoc:o.netLoc,path:null,params:o.params,query:o.query,fragment:o.fragment};if(!o.netLoc&&(d.netLoc=n.netLoc,"/"!==o.path[0]))if(o.path){var h=n.path,c=h.substring(0,h.lastIndexOf("/")+1)+o.path;d.path=a.normalizePath(c)}else d.path=n.path,o.params||(d.params=n.params,o.query||(d.query=n.query));return null===d.path&&(d.path=i.alwaysNormalize?a.normalizePath(o.path):o.path),a.buildURLFromParts(d)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");e.length!==(e=e.replace(o,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=a}(_c);var wc=_c.exports;function Sc(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function Ec(e){for(var t=1;t`):Bc}(t)}))}const Oc=Fc,Nc=/^(\d+)x(\d+)$/,jc=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Gc{constructor(e){"string"==typeof e&&(e=Gc.parseAttrList(e)),Lc(this,e)}get clientAttrs(){return Object.keys(this).filter((e=>"X-"===e.substring(0,2)))}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;const i=new Uint8Array(t.length/2);for(let e=0;eNumber.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}bool(e){return"YES"===this[e]}decimalResolution(e){const t=Nc.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const i={};for(jc.lastIndex=0;null!==(t=jc.exec(e));){let e=t[2];0===e.indexOf('"')&&e.lastIndexOf('"')===e.length-1&&(e=e.slice(1,-1));i[t[1].trim()]=e}return i}}function Wc(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e}class zc{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const i=t.attr;for(const t in i)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==i[t]){Oc.warn(`DATERANGE tag attribute: "${t}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=t;break}e=Lc(new Gc({}),i,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const e=new Date(this.attr["END-DATE"]);Cc(e.getTime())&&(this._endDate=e)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return null!==e?new Date(this._startDate.getTime()+1e3*e):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(Cc(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&Cc(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class $c{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var Vc="audio",Hc="video",Jc="audiovideo";class qc{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[Vc]:null,[Hc]:null,[Jc]:null},this.baseurl=e}setByteRange(e,t){const i=e.split("@",2);let s;s=1===i.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(i[1]),this._byteRange=[s,parseInt(i[0])+s]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=wc.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class Kc extends qc{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new $c,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const e=this.levelkeys.identity;if(e)this._decryptdata=e.getDecryptData(this.sn);else{const e=Object.keys(this.levelkeys);if(1===e.length)return this._decryptdata=this.levelkeys[e[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;if(!Cc(this.programDateTime))return null;const e=Cc(this.duration)?this.duration:0;return this.programDateTime+1e3*e}get encrypted(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){const e=Object.keys(this.levelkeys),t=e.length;if(t>1||1===t&&this.levelkeys[e[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()}setElementaryStreamInfo(e,t,i,s,r,o=!1){const{elementaryStreams:a}=this,n=a[e];n?(n.startPTS=Math.min(n.startPTS,t),n.endPTS=Math.max(n.endPTS,i),n.startDTS=Math.min(n.startDTS,s),n.endDTS=Math.max(n.endDTS,r)):a[e]={startPTS:t,endPTS:i,startDTS:s,endDTS:r,partial:o}}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Vc]=null,e[Hc]=null,e[Jc]=null}}class Yc extends qc{constructor(e,t,i,s,r){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new $c,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=s;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}class Qc{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e)return this.advanced=!0,void(this.updated=!0);const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&i>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return!!this.fragments.length&&Cc(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){const e=this.driftEndTime-this.driftStartTime;if(e>0){return 1e3*(this.driftEnd-this.driftStart)/e}return 1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function Xc(e){return Uint8Array.from(atob(e),(e=>e.charCodeAt(0)))}function Zc(e){const t=e.split(":");let i=null;if("data"===t[0]&&2===t.length){const e=t[1].split(";"),s=e[e.length-1].split(",");if(2===s.length){const t="base64"===s[0],r=s[1];t?(e.splice(-1,1),i=Xc(r)):i=function(e){const t=eu(e).subarray(0,16),i=new Uint8Array(16);return i.set(t,16-t.length),i}(r)}}return i}function eu(e){return Uint8Array.from(unescape(encodeURIComponent(e)),(e=>e.charCodeAt(0)))}const tu="undefined"!=typeof self?self:void 0;var iu={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},su="org.w3.clearkey",ru="com.apple.streamingkeydelivery",ou="com.microsoft.playready",au="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function nu(e){switch(e){case ru:return iu.FAIRPLAY;case ou:return iu.PLAYREADY;case au:return iu.WIDEVINE;case su:return iu.CLEARKEY}}var lu="edef8ba979d64acea3c827dcd51d21ed";function du(e){switch(e){case iu.FAIRPLAY:return ru;case iu.PLAYREADY:return ou;case iu.WIDEVINE:return au;case iu.CLEARKEY:return su}}function hu(e){const{drmSystems:t,widevineLicenseUrl:i}=e,s=t?[iu.FAIRPLAY,iu.WIDEVINE,iu.PLAYREADY,iu.CLEARKEY].filter((e=>!!t[e])):[];return!s[iu.WIDEVINE]&&i&&s.push(iu.WIDEVINE),s}const cu=null!=tu&&null!=(uu=tu.navigator)&&uu.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;var uu;function pu(e,t,i){return Uint8Array.prototype.slice?e.slice(t,i):new Uint8Array(Array.prototype.slice.call(e,t,i))}const fu=(e,t)=>t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128,mu=(e,t)=>t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128,gu=(e,t)=>{const i=t;let s=0;for(;fu(e,t);){s+=10;s+=yu(e,t+6),mu(e,t+10)&&(s+=10),t+=s}if(s>0)return e.subarray(i,i+s)},yu=(e,t)=>{let i=0;return i=(127&e[t])<<21,i|=(127&e[t+1])<<14,i|=(127&e[t+2])<<7,i|=127&e[t+3],i},Au=(e,t)=>fu(e,t)&&yu(e,t+6)+10<=e.length-t,bu=e=>{const t=wu(e);for(let e=0;ee&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info,_u=e=>{const t=String.fromCharCode(e[0],e[1],e[2],e[3]),i=yu(e,4);return{type:t,size:i,data:e.subarray(10,10+i)}},wu=e=>{let t=0;const i=[];for(;fu(e,t);){const s=yu(e,t+6);t+=10;const r=t+s;for(;t+8"PRIV"===e.type?Eu(e):"W"===e.type[0]?ku(e):Tu(e),Eu=e=>{if(e.size<2)return;const t=Cu(e.data,!0),i=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:i.buffer}},Tu=e=>{if(e.size<2)return;if("TXXX"===e.type){let t=1;const i=Cu(e.data.subarray(t),!0);t+=i.length+1;const s=Cu(e.data.subarray(t));return{key:e.type,info:i,data:s}}const t=Cu(e.data.subarray(1));return{key:e.type,data:t}},ku=e=>{if("WXXX"===e.type){if(e.size<2)return;let t=1;const i=Cu(e.data.subarray(t),!0);t+=i.length+1;const s=Cu(e.data.subarray(t));return{key:e.type,info:i,data:s}}const t=Cu(e.data);return{key:e.type,data:t}},Lu=e=>{if(8===e.data.byteLength){const t=new Uint8Array(e.data),i=1&t[3];let s=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return s/=45,i&&(s+=47721858.84),Math.round(s)}},Cu=(e,t=!1)=>{const i=Du();if(i){const s=i.decode(e);if(t){const e=s.indexOf("\0");return-1!==e?s.substring(0,e):s}return s.replace(/\0/g,"")}const s=e.length;let r,o,a,n="",l=0;for(;l>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:n+=String.fromCharCode(r);break;case 12:case 13:o=e[l++],n+=String.fromCharCode((31&r)<<6|63&o);break;case 14:o=e[l++],a=e[l++],n+=String.fromCharCode((15&r)<<12|(63&o)<<6|(63&a)<<0)}}return n};let xu;function Du(){if(!navigator.userAgent.includes("PlayStation 4"))return xu||void 0===self.TextDecoder||(xu=new self.TextDecoder("utf-8")),xu}const Ru=function(e){let t="";for(let i=0;i>24,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i}function Gu(e,t){const i=[];if(!t.length)return i;const s=e.byteLength;for(let r=0;r1?r+o:s;if(Mu(e.subarray(r+4,r+8))===t[0])if(1===t.length)i.push(e.subarray(r+8,a));else{const s=Gu(e.subarray(r+8,a),t.slice(1));s.length&&Iu.apply(i,s)}r=a}return i}function Wu(e){const t=[],i=e[0];let s=8;const r=Uu(e,s);s+=4;let o=0,a=0;0===i?(o=Uu(e,s),a=Uu(e,s+4),s+=8):(o=Ou(e,s),a=Ou(e,s+8),s+=16),s+=2;let n=e.length+a;const l=Fu(e,s);s+=2;for(let i=0;i>>31)return Oc.warn("SIDX has hierarchical references (not supported)"),null;const l=Uu(e,i);i+=4,t.push({referenceSize:a,subsegmentDuration:l,info:{duration:l/r,start:n,end:n+a-1}}),n+=a,i+=4,s=i}return{earliestPresentationTime:o,timescale:r,version:i,referencesCount:l,references:t}}function zu(e){const t=[],i=Gu(e,["moov","trak"]);for(let e=0;e{const i=Uu(e,4),s=t[i];s&&(s.default={duration:Uu(e,12),flags:Uu(e,20)})})),t}function $u(e){const t=e.subarray(8),i=t.subarray(86),s=Mu(t.subarray(4,8));let r=s;const o="enca"===s||"encv"===s;if(o){const e=Gu(t,[s])[0];Gu(e.subarray("enca"===s?28:78),["sinf"]).forEach((e=>{const t=Gu(e,["schm"])[0];if(t){const i=Mu(t.subarray(4,8));if("cbcs"===i||"cenc"===i){const t=Gu(e,["frma"])[0];t&&(r=Mu(t))}}}))}switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const e=Gu(i,["avcC"])[0];r+="."+Hu(e[1])+Hu(e[2])+Hu(e[3]);break}case"mp4a":{const e=Gu(t,[s])[0],i=Gu(e.subarray(28),["esds"])[0];if(i&&i.length>12){let e=4;if(3!==i[e++])break;e=Vu(i,e),e+=2;const t=i[e++];if(128&t&&(e+=2),64&t&&(e+=i[e++]),4!==i[e++])break;e=Vu(i,e);const s=i[e++];if(64!==s)break;if(r+="."+Hu(s),e+=12,5!==i[e++])break;e=Vu(i,e);const o=i[e++];let a=(248&o)>>3;31===a&&(a+=1+((7&o)<<3)+((224&i[e])>>5)),r+="."+a}break}case"hvc1":case"hev1":{const e=Gu(i,["hvcC"])[0],t=e[1],s=["","A","B","C"][t>>6],o=31&t,a=Uu(e,2),n=(32&t)>>5?"H":"L",l=e[12],d=e.subarray(6,12);r+="."+s+o,r+="."+a.toString(16).toUpperCase(),r+="."+n+l;let h="";for(let e=d.length;e--;){const t=d[e];if(t||h){h="."+t.toString(16).toUpperCase()+h}}r+=h;break}case"dvh1":case"dvhe":{const e=Gu(i,["dvcC"])[0],t=e[2]>>1&127,s=e[2]<<5&32|e[3]>>3&31;r+="."+Ju(t)+"."+Ju(s);break}case"vp09":{const e=Gu(i,["vpcC"])[0],t=e[4],s=e[5],o=e[6]>>4&15;r+="."+Ju(t)+"."+Ju(s)+"."+Ju(o);break}case"av01":{const e=Gu(i,["av1C"])[0],t=e[1]>>>5,s=31&e[1],o=e[2]>>>7?"H":"M",a=(64&e[2])>>6,n=(32&e[2])>>5,l=2===t&&a?n?12:10:a?10:8,d=(16&e[2])>>4,h=(8&e[2])>>3,c=(4&e[2])>>2,u=3&e[2],p=1,f=1,m=1,g=0;r+="."+t+"."+Ju(s)+o+"."+Ju(l)+"."+d+"."+h+c+u+"."+Ju(p)+"."+Ju(f)+"."+Ju(m)+"."+g;break}}return{codec:r,encrypted:o}}function Vu(e,t){const i=t+5;for(;128&e[t++]&&t{const l=n.byteOffset-8;Gu(n,["traf"]).map((n=>{const d=Gu(n,["tfdt"]).map((e=>{const t=e[0];let i=Uu(e,4);return 1===t&&(i*=Math.pow(2,32),i+=Uu(e,8)),i/r}))[0];return void 0!==d&&(e=d),Gu(n,["tfhd"]).map((d=>{const h=Uu(d,4),c=16777215&Uu(d,0);let u=0;const p=0!=(16&c);let f=0;const m=0!=(32&c);let g=8;h===o&&(0!=(1&c)&&(g+=8),0!=(2&c)&&(g+=4),0!=(8&c)&&(u=Uu(d,g),g+=4),p&&(f=Uu(d,g),g+=4),m&&(g+=4),"video"===t.type&&(a=function(e){if(!e)return!1;const t=e.indexOf("."),i=t<0?e:e.substring(0,t);return"hvc1"===i||"hev1"===i||"dvh1"===i||"dvhe"===i}(t.codec)),Gu(n,["trun"]).map((o=>{const n=o[0],d=16777215&Uu(o,0),h=0!=(1&d);let c=0;const p=0!=(4&d),m=0!=(256&d);let g=0;const y=0!=(512&d);let A=0;const b=0!=(1024&d),v=0!=(2048&d);let _=0;const w=Uu(o,4);let S=8;h&&(c=Uu(o,S),S+=4),p&&(S+=4);let E=c+l;for(let l=0;l>1&63;return 39===e||40===e}return 6===(31&t)}function Zu(e,t,i,s){const r=ep(e);let o=0;o+=t;let a=0,n=0,l=0;for(;o=r.length)break;l=r[o++],a+=l}while(255===l);n=0;do{if(o>=r.length)break;l=r[o++],n+=l}while(255===l);const e=r.length-o;let t=o;if(ne){Oc.error(`Malformed SEI payload. ${n} is too small, only ${e} bytes left to parse.`);break}if(4===a){if(181===r[t++]){const e=Fu(r,t);if(t+=2,49===e){const e=Uu(r,t);if(t+=4,1195456820===e){const e=r[t++];if(3===e){const o=r[t++],n=31&o,l=64&o,d=l?2+3*n:0,h=new Uint8Array(d);if(l){h[0]=o;for(let e=1;e16){const e=[];for(let i=0;i<16;i++){const s=r[t++].toString(16);e.push(1==s.length?"0"+s:s),3!==i&&5!==i&&7!==i&&9!==i||e.push("-")}const o=n-16,l=new Uint8Array(o);for(let e=0;e0?(o=new Uint8Array(4),t.length>0&&new DataView(o.buffer).setUint32(0,t.length,!1)):o=new Uint8Array;const a=new Uint8Array(4);return i&&i.byteLength>0&&new DataView(a.buffer).setUint32(0,i.byteLength,!1),function(e,...t){const i=t.length;let s=8,r=i;for(;r--;)s+=t[r].byteLength;const o=new Uint8Array(s);for(o[0]=s>>24&255,o[1]=s>>16&255,o[2]=s>>8&255,o[3]=255&s,o.set(e,4),r=0,s=8;r>8*(15-i)&255;return t}(e);return new sp(this.method,this.uri,"identity",this.keyFormatVersions,t)}const t=Zc(this.uri);if(t)switch(this.keyFormat){case au:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case ou:{const e=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=tp(e,null,t);const i=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),s=String.fromCharCode.apply(null,Array.from(i)),r=s.substring(s.indexOf("<"),s.length),o=(new DOMParser).parseFromString(r,"text/xml").getElementsByTagName("KID")[0];if(o){const e=o.childNodes[0]?o.childNodes[0].nodeValue:o.getAttribute("VALUE");if(e){const t=Xc(e).subarray(0,16);!function(e){const t=function(e,t,i){const s=e[t];e[t]=e[i],e[i]=s};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}(t),this.keyId=t}}break}default:{let e=t.subarray(0,16);if(16!==e.length){const t=new Uint8Array(16);t.set(e,16-e.length),e=t}this.keyId=e;break}}if(!this.keyId||16!==this.keyId.byteLength){let e=ip[this.uri];if(!e){const t=Object.keys(ip).length%Number.MAX_SAFE_INTEGER;e=new Uint8Array(16);new DataView(e.buffer,12,4).setUint32(0,t),ip[this.uri]=e}this.keyId=e}return this}}const rp=/\{\$([a-zA-Z0-9-_]+)\}/g;function op(e){return rp.test(e)}function ap(e,t,i){if(null!==e.variableList||e.hasVariableRefs)for(let s=i.length;s--;){const r=i[s],o=t[r];o&&(t[r]=np(e,o))}}function np(e,t){if(null!==e.variableList||e.hasVariableRefs){const i=e.variableList;return t.replace(rp,(t=>{const s=t.substring(2,t.length-1),r=null==i?void 0:i[s];return void 0===r?(e.playlistParsingError||(e.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${s}"`)),t):r}))}return t}function lp(e,t,i){let s,r,o=e.variableList;if(o||(e.variableList=o={}),"QUERYPARAM"in t){s=t.QUERYPARAM;try{const e=new self.URL(i).searchParams;if(!e.has(s))throw new Error(`"${s}" does not match any query parameter in URI: "${i}"`);r=e.get(s)}catch(t){e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${t.message}`))}}else s=t.NAME,r=t.VALUE;s in o?e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${s}"`)):o[s]=r||""}function dp(e,t,i){const s=t.IMPORT;if(i&&s in i){let t=e.variableList;t||(e.variableList=t={}),t[s]=i[s]}else e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}function hp(e=!0){if("undefined"==typeof self)return;return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}const cp={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function up(e,t,i=!0){return!e.split(",").some((e=>!pp(e,t,i)))}function pp(e,t,i=!0){var s;const r=hp(i);return null!=(s=null==r?void 0:r.isTypeSupported(fp(e,t)))&&s}function fp(e,t){return`${t}/mp4;codecs="${e}"`}function mp(e){if(e){const t=e.substring(0,4);return cp.video[t]}return 2}function gp(e){return e.split(",").reduce(((e,t)=>{const i=cp.video[t];return i?(2*i+e)/(e?3:2):(cp.audio[t]+e)/(e?2:1)}),0)}const yp={};const Ap=/flac|opus/i;function bp(e,t=!0){return e.replace(Ap,(e=>function(e,t=!0){if(yp[e])return yp[e];const i={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[e];for(let s=0;s0&&s.length({id:e.attrs.AUDIO,audioCodec:e.audioCodec}))),SUBTITLES:o.map((e=>({id:e.attrs.SUBTITLES,textCodec:e.textCodec}))),"CLOSED-CAPTIONS":[]};let n=0;for(wp.lastIndex=0;null!==(s=wp.exec(e));){const e=new Gc(s[1]),o=e.TYPE;if(o){const s=a[o],l=r[o]||[];r[o]=l,ap(i,e,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d=e.LANGUAGE,h=e["ASSOC-LANGUAGE"],c=e.CHANNELS,u=e.CHARACTERISTICS,p=e["INSTREAM-ID"],f={attrs:e,bitrate:0,id:n++,groupId:e["GROUP-ID"]||"",name:e.NAME||d||"",type:o,default:e.bool("DEFAULT"),autoselect:e.bool("AUTOSELECT"),forced:e.bool("FORCED"),lang:d,url:e.URI?kp.resolve(e.URI,t):""};if(h&&(f.assocLang=h),c&&(f.channels=c),u&&(f.characteristics=u),p&&(f.instreamId=p),null!=s&&s.length){const e=kp.findGroup(s,f.groupId)||s[0];Dp(f,e,"audioCodec"),Dp(f,e,"textCodec")}l.push(f)}}return r}static parseLevelPlaylist(e,t,i,s,r,o){const a=new Qc(t),n=a.fragments;let l,d,h,c=null,u=0,p=0,f=0,m=0,g=null,y=new Kc(s,t),A=-1,b=!1,v=null;for(Ep.lastIndex=0,a.m3u8=e,a.hasVariableRefs=op(e);null!==(l=Ep.exec(e));){b&&(b=!1,y=new Kc(s,t),y.start=f,y.sn=u,y.cc=m,y.level=i,c&&(y.initSegment=c,y.rawProgramDateTime=c.rawProgramDateTime,c.rawProgramDateTime=null,v&&(y.setByteRange(v),v=null)));const e=l[1];if(e){y.duration=parseFloat(e);const t=(" "+l[2]).slice(1);y.title=t||null,y.tagList.push(t?["INF",e,t]:["INF",e])}else if(l[3]){if(Cc(y.duration)){y.start=f,h&&Ip(y,h,a),y.sn=u,y.level=i,y.cc=m,n.push(y);const e=(" "+l[3]).slice(1);y.relurl=np(a,e),Rp(y,g),g=y,f+=y.duration,u++,p=0,b=!0}}else if(l[4]){const e=(" "+l[4]).slice(1);g?y.setByteRange(e,g):y.setByteRange(e)}else if(l[5])y.rawProgramDateTime=(" "+l[5]).slice(1),y.tagList.push(["PROGRAM-DATE-TIME",y.rawProgramDateTime]),-1===A&&(A=n.length);else{if(l=l[0].match(Tp),!l){Oc.warn("No matches on slow regex match for level playlist!");continue}for(d=1;d0&&e.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=e.optionalFloat("PART-HOLD-BACK",0),a.holdBack=e.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const e=new Gc(r);a.partTarget=e.decimalFloatingPoint("PART-TARGET");break}case"PART":{let e=a.partList;e||(e=a.partList=[]);const i=p>0?e[e.length-1]:void 0,s=p++,o=new Gc(r);ap(a,o,["BYTERANGE","URI"]);const n=new Yc(o,y,t,s,i);e.push(n),y.duration+=n.duration;break}case"PRELOAD-HINT":{const e=new Gc(r);ap(a,e,["URI"]),a.preloadHint=e;break}case"RENDITION-REPORT":{const e=new Gc(r);ap(a,e,["URI"]),a.renditionReports=a.renditionReports||[],a.renditionReports.push(e);break}default:Oc.warn(`line parsed but not handled: ${l}`)}}}g&&!g.relurl?(n.pop(),f-=g.duration,a.partList&&(a.fragmentHint=g)):a.partList&&(Rp(y,g),y.cc=m,a.fragmentHint=y,h&&Ip(y,h,a));const _=n.length,w=n[0],S=n[_-1];if(f+=a.skippedSegments*a.targetduration,f>0&&_&&S){a.averagetargetduration=f/_;const e=S.sn;a.endSN="initSegment"!==e?e:0,a.live||(S.endList=!0),w&&(a.startCC=w.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(f+=a.fragmentHint.duration),a.totalduration=f,a.endCC=m,A>0&&function(e,t){let i=e[t];for(let s=t;s--;){const t=e[s];if(!t)return;t.programDateTime=i.programDateTime-1e3*t.duration,i=t}}(n,A),a}}function Lp(e,t,i){var s,r;const o=new Gc(e);ap(i,o,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const a=null!=(s=o.METHOD)?s:"",n=o.URI,l=o.hexadecimalInteger("IV"),d=o.KEYFORMATVERSIONS,h=null!=(r=o.KEYFORMAT)?r:"identity";n&&o.IV&&!l&&Oc.error(`Invalid IV: ${o.IV}`);const c=n?kp.resolve(n,t):"",u=(d||"1").split("/").map(Number).filter(Number.isFinite);return new sp(a,c,h,u,l)}function Cp(e){const t=new Gc(e).decimalFloatingPoint("TIME-OFFSET");return Cc(t)?t:null}function xp(e,t){let i=(e||"").split(/[ ,]+/).filter((e=>e));["video","audio","text"].forEach((e=>{const s=i.filter((t=>function(e,t){const i=cp[t];return!!i&&!!i[e.slice(0,4)]}(t,e)));s.length&&(t[`${e}Codec`]=s.join(","),i=i.filter((e=>-1===s.indexOf(e))))})),t.unknownCodecs=i}function Dp(e,t,i){const s=t[i];s&&(e[i]=s)}function Rp(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),Cc(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}function Pp(e,t,i,s){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=i,e.sn="initSegment",s&&(e.levelkeys=s),e.initSegment=null}function Ip(e,t,i){e.levelkeys=t;const{encryptedFragments:s}=i;s.length&&s[s.length-1].levelkeys===t||!Object.keys(t).some((e=>t[e].isCommonEncryption))||s.push(e)}var Bp="manifest",Mp="level",Fp="audioTrack",Up="subtitleTrack",Op="main",Np="audio",jp="subtitle";function Gp(e){const{type:t}=e;switch(t){case Fp:return Np;case Up:return jp;default:return Op}}function Wp(e,t){let i=e.url;return void 0!==i&&0!==i.indexOf("data:")||(i=t.url),i}class zp{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Rc.LEVEL_LOADING,this.onLevelLoading,this),e.on(Rc.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(Rc.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Rc.LEVEL_LOADING,this.onLevelLoading,this),e.off(Rc.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(Rc.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,s=t.loader,r=new(i||s)(t);return this.loaders[e.type]=r,r}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Bp,url:i,deliveryDirectives:null})}onLevelLoading(e,t){const{id:i,level:s,pathwayId:r,url:o,deliveryDirectives:a}=t;this.load({id:i,level:s,pathwayId:r,responseType:"text",type:Mp,url:o,deliveryDirectives:a})}onAudioTrackLoading(e,t){const{id:i,groupId:s,url:r,deliveryDirectives:o}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:Fp,url:r,deliveryDirectives:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:s,url:r,deliveryDirectives:o}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:Up,url:r,deliveryDirectives:o})}load(e){var t;const i=this.hls.config;let s,r=this.getInternalLoader(e);if(r){const t=r.context;if(t&&t.url===e.url&&t.level===e.level)return void Oc.trace("[playlist-loader]: playlist request ongoing");Oc.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}if(s=e.type===Bp?i.manifestLoadPolicy.default:Lc({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),Cc(null==(t=e.deliveryDirectives)?void 0:t.part)){let t;if(e.type===Mp&&null!==e.level?t=this.hls.levels[e.level].details:e.type===Fp&&null!==e.id?t=this.hls.audioTracks[e.id].details:e.type===Up&&null!==e.id&&(t=this.hls.subtitleTracks[e.id].details),t){const e=t.partTarget,i=t.targetduration;if(e&&i){const t=1e3*Math.max(3*e,.8*i);s=Lc({},s,{maxTimeToFirstByteMs:Math.min(t,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(t,s.maxTimeToFirstByteMs)})}}}const o=s.errorRetry||s.timeoutRetry||{},a={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},n={onSuccess:(e,t,i,s)=>{const r=this.getInternalLoader(i);this.resetInternalLoader(i.type);const o=e.data;0===o.indexOf("#EXTM3U")?(t.parsing.start=performance.now(),kp.isMediaPlaylist(o)?this.handleTrackOrLevelPlaylist(e,t,i,s||null,r):this.handleMasterPlaylist(e,t,i,s)):this.handleManifestParsingError(e,i,new Error("no EXTM3U delimiter"),s||null,t)},onError:(e,t,i,s)=>{this.handleNetworkError(t,i,!1,e,s)},onTimeout:(e,t,i)=>{this.handleNetworkError(t,i,!0,void 0,e)}};r.load(e,a,n)}handleMasterPlaylist(e,t,i,s){const r=this.hls,o=e.data,a=Wp(e,i),n=kp.parseMasterPlaylist(o,a);if(n.playlistParsingError)return void this.handleManifestParsingError(e,i,n.playlistParsingError,s,t);const{contentSteering:l,levels:d,sessionData:h,sessionKeys:c,startTimeOffset:u,variableList:p}=n;this.variableList=p;const{AUDIO:f=[],SUBTITLES:m,"CLOSED-CAPTIONS":g}=kp.parseMasterPlaylistMedia(o,a,n);if(f.length){f.some((e=>!e.url))||!d[0].audioCodec||d[0].attrs.AUDIO||(Oc.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),f.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Gc({}),bitrate:0,url:""}))}r.trigger(Rc.MANIFEST_LOADED,{levels:d,audioTracks:f,subtitles:m,captions:g,contentSteering:l,url:a,stats:t,networkDetails:s,sessionData:h,sessionKeys:c,startTimeOffset:u,variableList:p})}handleTrackOrLevelPlaylist(e,t,i,s,r){const o=this.hls,{id:a,level:n,type:l}=i,d=Wp(e,i),h=Cc(n)?n:Cc(a)?a:0,c=Gp(i),u=kp.parseLevelPlaylist(e.data,d,h,c,0,this.variableList);if(l===Bp){const e={attrs:new Gc({}),bitrate:0,details:u,name:"",url:d};o.trigger(Rc.MANIFEST_LOADED,{levels:[e],audioTracks:[],url:d,stats:t,networkDetails:s,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=u,this.handlePlaylistLoaded(u,e,t,i,s,r)}handleManifestParsingError(e,t,i,s,r){this.hls.trigger(Rc.ERROR,{type:Pc.NETWORK_ERROR,details:Ic.MANIFEST_PARSING_ERROR,fatal:t.type===Bp,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:s,stats:r})}handleNetworkError(e,t,i=!1,s,r){let o=`A network ${i?"timeout":"error"+(s?" (status "+s.code+")":"")} occurred while loading ${e.type}`;e.type===Mp?o+=`: ${e.level} id: ${e.id}`:e.type!==Fp&&e.type!==Up||(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);Oc.warn(`[playlist-loader]: ${o}`);let n=Ic.UNKNOWN,l=!1;const d=this.getInternalLoader(e);switch(e.type){case Bp:n=i?Ic.MANIFEST_LOAD_TIMEOUT:Ic.MANIFEST_LOAD_ERROR,l=!0;break;case Mp:n=i?Ic.LEVEL_LOAD_TIMEOUT:Ic.LEVEL_LOAD_ERROR,l=!1;break;case Fp:n=i?Ic.AUDIO_TRACK_LOAD_TIMEOUT:Ic.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case Up:n=i?Ic.SUBTITLE_TRACK_LOAD_TIMEOUT:Ic.SUBTITLE_LOAD_ERROR,l=!1}d&&this.resetInternalLoader(e.type);const h={type:Pc.NETWORK_ERROR,details:n,fatal:l,url:e.url,loader:d,context:e,error:a,networkDetails:t,stats:r};if(s){const i=(null==t?void 0:t.url)||e.url;h.response=Ec({url:i,data:void 0},s)}this.hls.trigger(Rc.ERROR,h)}handlePlaylistLoaded(e,t,i,s,r,o){const a=this.hls,{type:n,level:l,id:d,groupId:h,deliveryDirectives:c}=s,u=Wp(t,s),p=Gp(s),f="number"==typeof s.level&&p===Op?l:void 0;if(!e.fragments.length){const e=new Error("No Segments found in Playlist");return void a.trigger(Rc.ERROR,{type:Pc.NETWORK_ERROR,details:Ic.LEVEL_EMPTY_ERROR,fatal:!1,url:u,error:e,reason:e.message,response:t,context:s,level:f,parent:p,networkDetails:r,stats:i})}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const m=e.playlistParsingError;if(m)a.trigger(Rc.ERROR,{type:Pc.NETWORK_ERROR,details:Ic.LEVEL_PARSING_ERROR,fatal:!1,url:u,error:m,reason:m.message,response:t,context:s,level:f,parent:p,networkDetails:r,stats:i});else switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),o.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),n){case Bp:case Mp:a.trigger(Rc.LEVEL_LOADED,{details:e,level:f||0,id:d||0,stats:i,networkDetails:r,deliveryDirectives:c});break;case Fp:a.trigger(Rc.AUDIO_TRACK_LOADED,{details:e,id:d||0,groupId:h||"",stats:i,networkDetails:r,deliveryDirectives:c});break;case Up:a.trigger(Rc.SUBTITLE_TRACK_LOADED,{details:e,id:d||0,groupId:h||"",stats:i,networkDetails:r,deliveryDirectives:c})}}}function $p(e,t){let i;try{i=new Event("addtrack")}catch(e){i=document.createEvent("Event"),i.initEvent("addtrack",!1,!1)}i.track=e,t.dispatchEvent(i)}function Vp(e,t){const i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error(`addCue is failed for: ${t}`)}catch(i){Oc.debug(`[texttrack-utils]: ${i}`);try{const i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}catch(e){Oc.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${e}`)}}"disabled"===i&&(e.mode=i)}function Hp(e){const t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(let t=e.cues.length;t--;)e.removeCue(e.cues[t]);"disabled"===t&&(e.mode=t)}function Jp(e,t,i,s){const r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&e.cues.length>0){const r=function(e,t,i){const s=[],r=function(e,t){if(te[i].endTime)return-1;let s=0,r=i;for(;s<=r;){const o=Math.floor((r+s)/2);if(te[o].startTime&&s-1)for(let o=r,a=e.length;o=t&&r.endTime<=i)s.push(r);else if(r.startTime>i)return s}return s}(e.cues,t,i);for(let t=0;t{const e=Xp();try{e&&new e(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function tf(e,t){return e.getTime()/1e3-t}class sf{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(Rc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Rc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Rc.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(Rc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Rc.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(Rc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Rc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Rc.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(Rc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Rc.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(Hp(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;tef&&(s=ef);s-i<=0&&(s=i+.25);for(let e=0;ee.type===Kp&&n:"video"===s?e=>e.type===Qp&&a:e=>e.type===Kp&&n||e.type===Qp&&a,Jp(r,t,i,e)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:i,id3Track:s}=this,{dateRanges:r}=t,o=Object.keys(r);if(s){const e=Object.keys(i).filter((e=>!o.includes(e)));for(let t=e.length;t--;){const r=e[t];Object.keys(i[r].cues).forEach((e=>{s.removeCue(i[r].cues[e])})),delete i[r]}}const a=t.fragments[t.fragments.length-1];if(0===o.length||!Cc(null==a?void 0:a.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const n=a.programDateTime/1e3-a.start,l=Xp();for(let e=0;e{if(t!==s.id){const i=r[t];if(i.class===s.class&&i.startDate>s.startDate&&(!e||s.startDatethis.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(null===e)return null;const{holdBack:t,partHoldBack:i,targetduration:s}=e,{liveSyncDuration:r,liveSyncDurationCount:o,lowLatencyMode:a}=this.config,n=this.hls.userConfig;let l=a&&i||t;(n.liveSyncDuration||n.liveSyncDurationCount||0===l)&&(l=void 0!==r?r:o*s);const d=s;return l+Math.min(1*this.stallCount,d)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(null===e||null===t||null===i)return null;const s=i.edge,r=e-t-this.edgeStalled,o=s-i.totalduration,a=s-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(o,r),a)}get drift(){const{levelDetails:e}=this;return null===e?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(null===e)return 0;const t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(Rc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Rc.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(Rc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(Rc.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(Rc.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(Rc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Rc.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(Rc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(Rc.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(Rc.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var i;t.details===Ic.BUFFER_STALLED_ERROR&&(this.stallCount++,null!=(i=this.levelDetails)&&i.live&&Oc.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const i=this.computeLatency();if(null===i)return;this._latency=i;const{lowLatencyMode:s,maxLiveSyncPlaybackRate:r}=this.config;if(!s||1===r||!t.live)return;const o=this.targetLatency;if(null===o)return;const a=i-o;if(a.05&&this.forwardBufferLength>1){const t=Math.min(2,Math.max(1,r)),i=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;e.playbackRate=Math.min(t,Math.max(1,i))}else 1!==e.playbackRate&&0!==e.playbackRate&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return null===e?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return null===e?null:e-this.currentTime}}const of=["NONE","TYPE-0","TYPE-1",null];const af=["SDR","PQ","HLG"];var nf="",lf="YES",df="v2";function hf(e){const{canSkipUntil:t,canSkipDateRanges:i,age:s}=e;return t&&s!!e)).map((e=>e.substring(0,4))).join(","),this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return pf(this._audioGroups,e)}hasSubtitleGroup(e){return pf(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t)if("audio"===e){let e=this._audioGroups;e||(e=this._audioGroups=[]),-1===e.indexOf(t)&&e.push(t)}else if("text"===e){let e=this._subtitleGroups;e||(e=this._subtitleGroups=[]),-1===e.indexOf(t)&&e.push(t)}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return null==(e=this.audioGroups)?void 0:e[0]}get textGroupId(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}addFallback(){}}function pf(e,t){return!(!t||!e)&&-1!==e.indexOf(t)}function ff(e,t){const i=t.startPTS;if(Cc(i)){let s,r=0;t.sn>e.sn?(r=i-e.start,s=e):(r=e.start-i,s=t),s.duration!==r&&(s.duration=r)}else if(t.sn>e.sn){e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration}else t.start=Math.max(e.start-t.duration,0)}function mf(e,t,i,s,r,o){s-i<=0&&(Oc.warn("Fragment should have a positive duration",t),s=i+t.duration,o=r+t.duration);let a=i,n=s;const l=t.startPTS,d=t.endPTS;if(Cc(l)){const e=Math.abs(l-i);Cc(t.deltaPTS)?t.deltaPTS=Math.max(e,t.deltaPTS):t.deltaPTS=e,a=Math.max(i,l),i=Math.min(i,l),r=Math.min(r,t.startDTS),n=Math.min(s,d),s=Math.max(s,d),o=Math.max(o,t.endDTS)}const h=i-t.start;0!==t.start&&(t.start=i),t.duration=s-t.start,t.startPTS=i,t.maxStartPTS=a,t.startDTS=r,t.endPTS=s,t.minEndPTS=n,t.endDTS=o;const c=t.sn;if(!e||ce.endSN)return 0;let u;const p=c-e.startSN,f=e.fragments;for(f[p]=t,u=p;u>0;u--)ff(f[u],f[u-1]);for(u=p;u=0;e--){const t=s[e].initSegment;if(t){i=t;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;let r,o=0;if(function(e,t,i){const s=t.skippedSegments,r=Math.max(e.startSN,t.startSN)-t.startSN,o=(e.fragmentHint?1:0)+(s?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,a=t.startSN-e.startSN,n=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;for(let e=r;e<=o;e++){const r=l[a+e];let o=n[e];s&&!o&&e{e.relurl&&(o=e.cc-s.cc),Cc(e.startPTS)&&Cc(e.endPTS)&&(s.start=s.startPTS=e.startPTS,s.startDTS=e.startDTS,s.maxStartPTS=e.maxStartPTS,s.endPTS=e.endPTS,s.endDTS=e.endDTS,s.minEndPTS=e.minEndPTS,s.duration=e.endPTS-e.startPTS,s.duration&&(r=s),t.PTSKnown=t.alignedSliding=!0),s.elementaryStreams=e.elementaryStreams,s.loader=e.loader,s.stats=e.stats,e.initSegment&&(s.initSegment=e.initSegment,i=e.initSegment)})),i){(t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments).forEach((e=>{var t;!e||e.initSegment&&e.initSegment.relurl!==(null==(t=i)?void 0:t.relurl)||(e.initSegment=i)}))}if(t.skippedSegments)if(t.deltaUpdateFailed=t.fragments.some((e=>!e)),t.deltaUpdateFailed){Oc.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let e=t.skippedSegments;e--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC=t.fragments[0].cc}else t.canSkipDateRanges&&(t.dateRanges=function(e,t,i){const s=Lc({},e);i&&i.forEach((e=>{delete s[e]}));return Object.keys(t).forEach((e=>{const i=new zc(t[e].attr,s[e]);i.isValid?s[e]=i:Oc.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(t[e].attr)}"`)})),s}(e.dateRanges,t.dateRanges,t.recentlyRemovedDateranges));const a=t.fragments;if(o){Oc.warn("discontinuity sliding from playlist, take drift into account");for(let e=0;e{t.elementaryStreams=e.elementaryStreams,t.stats=e.stats})),r?mf(t,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS):yf(e,t),a.length&&(t.totalduration=t.edge-a[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;const n=t.advancedDateTime;if(t.advanced&&n){const e=t.edge;t.driftStart||(t.driftStartTime=n,t.driftStart=e),t.driftEndTime=n,t.driftEnd=e}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime}function yf(e,t){const i=t.startSN+t.skippedSegments-e.startSN,s=e.fragments;i<0||i>=s.length||Af(t,s[i].start)}function Af(e,t){if(t){const i=e.fragments;for(let s=e.skippedSegments;s{const{details:i}=e;null!=i&&i.fragments&&i.fragments.forEach((e=>{e.level=t}))}))}function wf(e){switch(e.details){case Ic.FRAG_LOAD_TIMEOUT:case Ic.KEY_LOAD_TIMEOUT:case Ic.LEVEL_LOAD_TIMEOUT:case Ic.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Sf(e,t){const i=wf(t);return e.default[(i?"timeout":"error")+"Retry"]}function Ef(e,t){const i="linear"===e.backoff?1:Math.pow(2,t);return Math.min(i*e.retryDelayMs,e.maxRetryDelayMs)}function Tf(e){return Ec(Ec({},e),{errorRetry:null,timeoutRetry:null})}function kf(e,t,i,s){if(!e)return!1;const r=null==s?void 0:s.code,o=t499)}(r)||!!i);return e.shouldRetry?e.shouldRetry(e,t,i,s,o):o}const Lf=function(e,t){let i=0,s=e.length-1,r=null,o=null;for(;i<=s;){r=(i+s)/2|0,o=e[r];const a=t(o);if(a>0)i=r+1;else{if(!(a<0))return o;s=r-1}}return null};function Cf(e,t,i=0,s=0,r=.005){let o=null;if(e){o=t[e.sn-t[0].sn+1]||null;const s=e.endDTS-i;s>0&&s<15e-7&&(i+=15e-7)}else 0===i&&0===t[0].start&&(o=t[0]);if(o&&((!e||e.level===o.level)&&0===xf(i,s,o)||function(e,t,i){if(t&&0===t.start&&t.level0){const s=t.tagList.reduce(((e,t)=>("INF"===t[0]&&(e+=parseFloat(t[1])),e)),i);return e.start<=s}return!1}(o,e,Math.min(r,s))))return o;const a=Lf(t,xf.bind(null,i,s));return!a||a===e&&o?o:a}function xf(e=0,t=0,i){if(i.start<=e&&i.start+i.duration>e)return 0;const s=Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return i.start+i.duration-s<=e?1:i.start-s>e&&i.start?-1:0}function Df(e,t,i){const s=1e3*Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return(i.endProgramDateTime||0)-s>e}var Rf=0,Pf=2,If=3,Bf=5,Mf=0,Ff=1,Uf=2;class Of{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=Oc.log.bind(Oc,`${t}:`),this.warn=Oc.warn.bind(Oc,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const s=null==t?void 0:t.renditionReports;if(s){let r=-1;for(let i=0;i=0&&e>t.partTarget&&(a+=1)}const n=i&&hf(i);return new cf(o,a>=0?a:void 0,n)}}}loadPlaylist(e){-1===this.requestScheduled&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return-1===this.timer&&-1===this.requestScheduled&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,i){const{details:s,stats:r}=t,o=self.performance.now(),a=r.loading.first?Math.max(0,o-r.loading.first):0;if(s.advancedDateTime=Date.now()-a,s.live||null!=i&&i.live){if(s.reloaded(i),i&&this.log(`live playlist ${e} ${s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:s.updated?"UPDATED":"MISSED"}`),i&&s.fragments.length>0&&gf(i,s),!this.canLoad||!s.live)return;let a,n,l;if(s.canBlockReload&&s.endSN&&s.advanced){const e=this.hls.config.lowLatencyMode,r=s.lastPartSn,o=s.endSN,d=s.lastPartIndex,h=r===o,c=e?0:d;-1!==d?(n=h?o+1:r,l=h?c:d+1):n=o+1;const u=s.age,p=u+s.ageHeader;let f=Math.min(p-s.partTarget,1.5*s.targetduration);if(f>0){if(i&&f>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${f} with playlist age: ${s.age}`),f=0;else{const e=Math.floor(f/s.targetduration);if(n+=e,void 0!==l){l+=Math.round(f%s.targetduration/s.partTarget)}this.log(`CDN Tune-in age: ${s.ageHeader}s last advanced ${u.toFixed(2)}s goal: ${f} skip sn ${e} to part ${l}`)}s.tuneInGoal=f}if(a=this.getDeliveryDirectives(s,t.deliveryDirectives,n,l),e||!h)return void this.loadPlaylist(a)}else(s.canBlockReload||s.canSkipUntil)&&(a=this.getDeliveryDirectives(s,t.deliveryDirectives,n,l));const d=this.hls.mainForwardBufferInfo,h=d?d.end-d.len:0,c=function(e,t=1/0){let i=1e3*e.targetduration;if(e.updated){const s=e.fragments,r=4;if(s.length&&i*r>t){const e=1e3*s[s.length-1].duration;ethis.requestScheduled+c&&(this.requestScheduled=r.loading.start),void 0!==n&&s.canBlockReload?this.requestScheduled=r.loading.first+c-(1e3*s.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+cthis.loadPlaylist(a)),u)}else this.clearTimer()}getDeliveryDirectives(e,t,i,s){let r=hf(e);return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,s=t.part,r=nf),new cf(i,s,r)}checkRetry(e){const t=e.details,i=wf(e),s=e.errorAction,{action:r,retryCount:o=0,retryConfig:a}=s||{},n=!!s&&!!a&&(r===Bf||!s.resolved&&r===Pf);if(n){var l;if(this.requestScheduled=-1,o>=a.maxNumRetry)return!1;if(i&&null!=(l=e.context)&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const e=Ef(a,o);this.timer=self.setTimeout((()=>this.loadPlaylist()),e),this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" in ${e}ms`)}e.levelRetry=!0,s.resolved=!0}return n}}class Nf{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class jf{constructor(e,t,i,s=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Nf(e),this.fast_=new Nf(t),this.defaultTTFB_=s,this.ttfb_=new Nf(e)}update(e,t){const{slow_:i,fast_:s,ttfb_:r}=this;i.halfLife!==e&&(this.slow_=new Nf(e,i.getEstimate(),i.getTotalWeight())),s.halfLife!==t&&(this.fast_=new Nf(t,s.getEstimate(),s.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new Nf(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){const i=(e=Math.max(e,this.minDelayMs_))/1e3,s=8*t/i;this.fast_.sample(i,s),this.slow_.sample(i,s)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const Gf={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},Wf={};function zf(e,t,i,s,r,o){const a=e.audioCodec?e.audioGroups:null,n=null==o?void 0:o.audioCodec,l=null==o?void 0:o.channels,d=l?parseInt(l):n?1/0:2;let h=null;if(null!=a&&a.length)try{h=1===a.length&&a[0]?t.groups[a[0]].channels:a.reduce(((e,i)=>{if(i){const s=t.groups[i];if(!s)throw new Error(`Audio track group ${i} not found`);Object.keys(s.channels).forEach((t=>{e[t]=(e[t]||0)+s.channels[t]}))}return e}),{2:0})}catch(e){return!0}return void 0!==e.videoCodec&&(e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(s,30)||"SDR"!==e.videoRange&&e.videoRange!==i||e.bitrate>Math.max(r,8e6))||!!h&&Cc(d)&&Object.keys(h).some((e=>parseInt(e)>d))}function $f(e,t,i){const s=e.videoCodec,r=e.audioCodec;if(!s||!r||!i)return Promise.resolve(Gf);const o={width:e.width,height:e.height,bitrate:Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)),framerate:e.frameRate||30},a=e.videoRange;"SDR"!==a&&(o.transferFunction=a.toLowerCase());const n=s.split(",").map((e=>({type:"media-source",video:Ec(Ec({},o),{},{contentType:fp(e,"video")})})));return r&&e.audioGroups&&e.audioGroups.forEach((e=>{var i;e&&(null==(i=t.groups[e])||i.tracks.forEach((t=>{if(t.groupId===e){const e=t.channels||"",i=parseFloat(e);Cc(i)&&i>2&&n.push.apply(n,r.split(",").map((e=>({type:"media-source",audio:{contentType:fp(e,"audio"),channels:""+i}}))))}})))})),Promise.all(n.map((e=>{const t=function(e){const{audio:t,video:i}=e,s=i||t;if(s){const e=s.contentType.split('"')[1];if(i)return`r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${e}_${Math.ceil(i.bitrate/1e5)}`;if(t)return`c${t.channels}${t.spatialRendering?"s":"n"}_${e}`}return""}(e);return Wf[t]||(Wf[t]=i.decodingInfo(e))}))).then((e=>({supported:!e.some((e=>!e.supported)),configurations:n,decodingInfoResults:e}))).catch((e=>({supported:!1,configurations:n,decodingInfoResults:[],error:e})))}function Vf(e,t){let i=!1,s=[];return e&&(i="SDR"!==e,s=[e]),t&&(s=t.allowedVideoRanges||af.slice(0),i=void 0!==t.preferHDR?t.preferHDR:function(){if("function"==typeof matchMedia){const e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}(),s=i?s.filter((e=>"SDR"!==e)):["SDR"]),{preferHDR:i,allowedVideoRanges:s}}function Hf(e,t){Oc.log(`[abr] start candidates with "${e}" ignored because ${t}`)}function Jf(e,t,i){if("attrs"in e){const i=t.indexOf(e);if(-1!==i)return i}for(let s=0;s-1===s.indexOf(e)))}(n,t.characteristics))&&(void 0===i||i(e,t))}function Kf(e,t){const{audioCodec:i,channels:s}=e;return!(void 0!==i&&(t.audioCodec||"").substring(0,4)!==i.substring(0,4)||void 0!==s&&s!==(t.channels||"2"))}function Yf(e,t,i){for(let s=t;s;s--)if(i(e[s]))return s;for(let s=t+1;s{const o=this.fragments[s];if(!o)return;if(r>=o.body.sn)return;if(!o.buffered&&!o.loaded)return void(o.body.type===i&&this.removeFragment(o.body));const a=o.range[e];a&&a.time.some((e=>{const i=!this.isTimeBuffered(e.startPTS,e.endPTS,t);return i&&this.removeFragment(o.body),i}))}))}detectPartialFragments(e){const t=this.timeRanges,{frag:i,part:s}=e;if(!t||"initSegment"===i.sn)return;const r=sm(i),o=this.fragments[r];if(!o||o.buffered&&i.gap)return;const a=!i.relurl;if(Object.keys(t).forEach((e=>{const r=i.elementaryStreams[e];if(!r)return;const n=t[e],l=a||!0===r.partial;o.range[e]=this.getBufferedTimes(i,s,l,n)})),o.loaded=null,Object.keys(o.range).length){o.buffered=!0;(o.body.endList=i.endList||o.body.endList)&&(this.endListFragments[o.body.type]=o),im(o)||this.removeParts(i.sn-1,i.type)}else this.removeFragment(o.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter((t=>t.fragment.sn>=e)))}fragBuffered(e,t){const i=sm(e);let s=this.fragments[i];!s&&t&&(s=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),s&&(s.loaded=null,s.buffered=!0)}getBufferedTimes(e,t,i,s){const r={time:[],partial:i},o=e.start,a=e.end,n=e.minEndPTS||a,l=e.maxStartPTS||o;for(let e=0;e=t&&n<=i){r.time.push({startPTS:Math.max(o,s.start(e)),endPTS:Math.min(a,s.end(e))});break}if(ot){const t=Math.max(o,s.start(e)),i=Math.min(a,s.end(e));i>t&&(r.partial=!0,r.time.push({startPTS:t,endPTS:i}))}else if(a<=t)break}return r}getPartialFragment(e){let t,i,s,r=null,o=0;const{bufferPadding:a,fragments:n}=this;return Object.keys(n).forEach((l=>{const d=n[l];d&&im(d)&&(i=d.body.start-a,s=d.body.end+a,e>=i&&e<=s&&(t=Math.min(e-i,s-e),o<=t&&(r=d.body,o=t)))})),r}isEndListAppended(e){const t=this.endListFragments[e];return void 0!==t&&(t.buffered||im(t))}getState(e){const t=sm(e),i=this.fragments[t];return i?i.buffered?im(i)?Zf:em:Xf:Qf}isTimeBuffered(e,t,i){let s,r;for(let o=0;o=s&&t<=r)return!0;if(t<=s)return!1}return!1}onFragLoaded(e,t){const{frag:i,part:s}=t;if("initSegment"===i.sn||i.bitrateTest)return;const r=s?null:t,o=sm(i);this.fragments[o]={body:i,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:s,timeRanges:r}=t;if("initSegment"===i.sn)return;const o=i.type;if(s){let e=this.activePartLists[o];e||(this.activePartLists[o]=e=[]),e.push(s)}this.timeRanges=r,Object.keys(r).forEach((e=>{const t=r[e];this.detectEvictedFragments(e,t,o,s)}))}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=sm(e);return!!this.fragments[t]}hasParts(e){var t;return!(null==(t=this.activePartLists[e])||!t.length)}removeFragmentsInRange(e,t,i,s,r){s&&!this.hasGaps||Object.keys(this.fragments).forEach((o=>{const a=this.fragments[o];if(!a)return;const n=a.body;n.type!==i||s&&!n.gap||n.starte&&(a.buffered||r)&&this.removeFragment(n)}))}removeFragment(e){const t=sm(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const t=e.sn;this.activePartLists[e.type]=i.filter((e=>e.fragment.sn!==t))}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function im(e){var t,i,s;return e.buffered&&(e.body.gap||(null==(t=e.range.video)?void 0:t.partial)||(null==(i=e.range.audio)?void 0:i.partial)||(null==(s=e.range.audiovideo)?void 0:s.partial))}function sm(e){return`${e.type}_${e.level}_${e.sn}`}const rm={length:0,start:()=>0,end:()=>0};class om{static isBuffered(e,t){try{if(e){const i=om.getBuffered(e);for(let e=0;e=i.start(e)&&t<=i.end(e))return!0}}catch(e){}return!1}static bufferInfo(e,t,i){try{if(e){const s=om.getBuffered(e),r=[];let o;for(o=0;oo&&(s[r-1].end=e[t].end):s.push(e[t])}else s.push(e[t])}else s=e;let r,o=0,a=t,n=t;for(let e=0;e=l&&ti.startCC||e&&e.cc{if(this.loader&&this.loader.destroy(),e.gap){if(e.tagList.some((e=>"GAP"===e[0])))return void n(mm(e));e.gap=!1}const l=this.loader=e.loader=r?new r(s):new o(s),d=fm(e),h=Tf(s.fragLoadPolicy.default),c={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:um};e.stats=l.stats,l.load(d,c,{onSuccess:(t,i,s,r)=>{this.resetLoader(e,l);let o=t.data;s.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(o.slice(0,16)),o=o.slice(16)),a({frag:e,part:null,payload:o,networkDetails:r})},onError:(t,s,r,o)=>{this.resetLoader(e,l),n(new gm({type:Pc.NETWORK_ERROR,details:Ic.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Ec({url:i,data:void 0},t),error:new Error(`HTTP Error ${t.code} ${t.text}`),networkDetails:r,stats:o}))},onAbort:(t,i,s)=>{this.resetLoader(e,l),n(new gm({type:Pc.NETWORK_ERROR,details:Ic.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:s,stats:t}))},onTimeout:(t,i,s)=>{this.resetLoader(e,l),n(new gm({type:Pc.NETWORK_ERROR,details:Ic.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${c.timeout}ms`),networkDetails:s,stats:t}))},onProgress:(i,s,r,o)=>{t&&t({frag:e,part:null,payload:r,networkDetails:o})}})}))}loadPart(e,t,i){this.abort();const s=this.config,r=s.fLoader,o=s.loader;return new Promise(((a,n)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap)return void n(mm(e,t));const l=this.loader=e.loader=r?new r(s):new o(s),d=fm(e,t),h=Tf(s.fragLoadPolicy.default),c={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:um};t.stats=l.stats,l.load(d,c,{onSuccess:(s,r,o,n)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const d={frag:e,part:t,payload:s.data,networkDetails:n};i(d),a(d)},onError:(i,s,r,o)=>{this.resetLoader(e,l),n(new gm({type:Pc.NETWORK_ERROR,details:Ic.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Ec({url:d.url,data:void 0},i),error:new Error(`HTTP Error ${i.code} ${i.text}`),networkDetails:r,stats:o}))},onAbort:(i,s,r)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),n(new gm({type:Pc.NETWORK_ERROR,details:Ic.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:r,stats:i}))},onTimeout:(i,s,r)=>{this.resetLoader(e,l),n(new gm({type:Pc.NETWORK_ERROR,details:Ic.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${c.timeout}ms`),networkDetails:r,stats:i}))}})}))}updateStatsFromPart(e,t){const i=e.stats,s=t.stats,r=s.total;if(i.loaded+=s.loaded,r){const s=Math.round(e.duration/t.duration),o=Math.min(Math.round(i.loaded/r),s),a=(s-o)*Math.round(i.loaded/o);i.total=i.loaded+a}else i.total=Math.max(i.loaded,i.total);const o=i.loading,a=s.loading;o.start?o.first+=a.first-a.start:(o.start=a.start,o.first=a.first),o.end=a.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function fm(e,t=null){const i=t||e,s={frag:e,part:t,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},r=i.byteRangeStartOffset,o=i.byteRangeEndOffset;if(Cc(r)&&Cc(o)){var a;let t=r,i=o;if("initSegment"===e.sn&&"AES-128"===(null==(a=e.decryptdata)?void 0:a.method)){const e=o-r;e%16&&(i=o+(16-e%16)),0!==r&&(s.resetIV=!0,t=r-16)}s.rangeStart=t,s.rangeEnd=i}return s}function mm(e,t){const i=new Error(`GAP ${e.gap?"tag":"attribute"} found`),s={type:Pc.MEDIA_ERROR,details:Ic.FRAG_GAP,fatal:!1,frag:e,error:i,networkDetails:null};return t&&(s.part=t),(t||e).stats.aborted=!0,new gm(s)}class gm extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class ym{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class Am{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}class bm{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let e=0;e<4;e++)i[e]=t.getUint32(4*e);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,s=i[0],r=i[1],o=i[2],a=i[3],n=this.invSubMix,l=n[0],d=n[1],h=n[2],c=n[3],u=new Uint32Array(256);let p=0,f=0,m=0;for(m=0;m<256;m++)u[m]=m<128?m<<1:m<<1^283;for(m=0;m<256;m++){let i=f^f<<1^f<<2^f<<3^f<<4;i=i>>>8^255&i^99,e[p]=i,t[i]=p;const n=u[p],m=u[n],g=u[m];let y=257*u[i]^16843008*i;s[p]=y<<24|y>>>8,r[p]=y<<16|y>>>16,o[p]=y<<8|y>>>24,a[p]=y,y=16843009*g^65537*m^257*n^16843008*p,l[i]=y<<24|y>>>8,d[i]=y<<16|y>>>16,h[i]=y<<8|y>>>24,c[i]=y,p?(p=n^u[u[u[g^n]]],f^=u[u[f]]):p=f=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,s=0;for(;s{if(!this.subtle)return Promise.reject(new Error("web crypto not initialized"));this.logOnce("WebCrypto AES decrypt");return new ym(this.subtle,new Uint8Array(i)).decrypt(e.buffer,t)})).catch((s=>(Oc.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,t,i))))}onWebCryptoError(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);const s=this.flush();if(s)return s.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%16;return i!==e.length&&(t=pu(e,0,i),this.remainderData=pu(e,i)),t}logOnce(e){this.logEnabled&&(Oc.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const _m=function(e){let t="";const i=e.length;for(let s=0;s1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}{constructor(e,t,i,s,r){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=wm,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.loadedmetadata=!1,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=r,this.logPrefix=s,this.log=Oc.log.bind(Oc,`${s}:`),this.warn=Oc.warn.bind(Oc,`${s}:`),this.hls=e,this.fragmentLoader=new pm(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new vm(e.config),e.on(Rc.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;null!=e&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=wm}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const i=t.partList;if(null!=i&&i.length){const e=i[i.length-1];return om.isBuffered(this.media,e.start+e.duration/2)}const s=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(s)}getLevelDetails(){var e;if(this.levels&&null!==this.levelLastLoaded)return null==(e=this.levelLastLoaded)?void 0:e.details}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),i.addEventListener("seeking",this.onvseeking),i.addEventListener("ended",this.onvended);const s=this.config;this.levels&&s.autoStartLoad&&this.state===wm&&this.startLoad(s.startPosition)}onMediaDetaching(){const e=this.media;null!=e&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:i,mediaBuffer:s,state:r}=this,o=i?i.currentTime:0,a=om.bufferInfo(s||i,o,e.maxBufferHole);if(this.log(`media seeking to ${Cc(o)?o.toFixed(3):o}, state: ${r}`),this.state===Dm)this.resetLoadingState();else if(t){const i=e.maxFragLookUpTolerance,s=t.start-i,r=t.start+t.duration+i;if(!a.len||ra.end){const e=o>r;(o{if(this.fragContextChanged(e))return this.warn(`Fragment ${e.sn}${t.part?" p: "+t.part.index:""} of level ${e.level} was dropped during download.`),void this.fragmentTracker.removeFragment(e);e.stats.chunkCount++,this._handleFragmentLoadProgress(t)})).then((t=>{if(!t)return;const i=this.state;this.fragContextChanged(e)?(i===Tm||!this.fragCurrent&&i===Cm)&&(this.fragmentTracker.removeFragment(e),this.state=Sm):("payload"in t&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(Rc.FRAG_LOADED,t)),this._handleFragmentLoadComplete(t))})).catch((t=>{this.state!==wm&&this.state!==Rm&&(this.warn(`Frag error: ${(null==t?void 0:t.message)||t}`),this.resetFragmentLoading(e))}))}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===Xf){const t=e.type,s=this.getFwdBufferInfo(this.mediaBuffer,t),r=Math.max(e.duration,s?s.len:this.config.maxBufferLength),o=this.backtrackFragment;(1===(o?e.sn-o.sn:0)||this.reduceMaxBufferLength(r,e.duration))&&i.removeFragment(e)}else 0===(null==(t=this.mediaBuffer)?void 0:t.buffered.length)?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===Zf&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const s={startOffset:e,endOffset:t,type:i};this.hls.trigger(Rc.BUFFER_FLUSHING,s)}_loadInitSegment(e,t){this._doFragLoad(e,t).then((t=>{if(!t||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return t})).then((t=>{const{hls:i}=this,{payload:s}=t,r=e.decryptdata;if(s&&s.byteLength>0&&null!=r&&r.key&&r.iv&&"AES-128"===r.method){const o=self.performance.now();return this.decrypter.decrypt(new Uint8Array(s),r.key.buffer,r.iv.buffer).catch((t=>{throw i.trigger(Rc.ERROR,{type:Pc.MEDIA_ERROR,details:Ic.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t})).then((s=>{const r=self.performance.now();return i.trigger(Rc.FRAG_DECRYPTED,{frag:e,payload:s,stats:{tstart:o,tdecrypt:r}}),t.payload=s,this.completeInitSegmentLoad(t)}))}return this.completeInitSegmentLoad(t)})).catch((t=>{this.state!==wm&&this.state!==Rm&&(this.warn(t),this.resetFragmentLoading(e))}))}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state=Sm,e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var i,s,r,o;const a=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===Op?"level":"track"} ${e.level} (frag:[${(null!=(i=e.startPTS)?i:NaN).toFixed(3)}-${(null!=(s=e.endPTS)?s:NaN).toFixed(3)}] > buffer:${a?_m(om.getBuffered(a)):"(detached)"})`),"initSegment"!==e.sn){var n;if(e.type!==jp){const t=e.elementaryStreams;if(!Object.keys(t).some((e=>!!t[e])))return void(this.state=Sm)}const t=null==(n=this.levels)?void 0:n[e.level];null!=t&&t.fragmentError&&(this.log(`Resetting level fragment error count of ${t.fragmentError} on frag buffered`),t.fragmentError=0)}this.state=Sm,a&&(!this.loadedmetadata&&e.type==Op&&a.buffered.length&&(null==(r=this.fragCurrent)?void 0:r.sn)===(null==(o=this.fragPrevious)?void 0:o.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:s,partsLoaded:r}=e,o=!r||0===r.length||r.some((e=>!e)),a=new am(i.level,i.sn,i.stats.chunkCount+1,0,s?s.index:-1,!o);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,s){var r;const o=null==t?void 0:t.details;if(!this.levels||!o)throw new Error(`frag load aborted, missing level${o?"":" detail"}s`);let a=null;if(!e.encrypted||null!=(r=e.decryptdata)&&r.key?!e.encrypted&&o.encryptedFragments.length&&this.keyLoader.loadClear(e,o.encryptedFragments):(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${"[stream-controller]"===this.logPrefix?"level":"track"} ${e.level}`),this.state=Em,this.fragCurrent=e,a=this.keyLoader.load(e).then((e=>{if(!this.fragContextChanged(e.frag))return this.hls.trigger(Rc.KEY_LOADED,e),this.state===Em&&(this.state=Sm),e})),this.hls.trigger(Rc.KEY_LOADING,{frag:e}),null===this.fragCurrent&&(a=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),i=Math.max(e.start,i||0),this.config.lowLatencyMode&&"initSegment"!==e.sn){const r=o.partList;if(r&&s){i>e.end&&o.fragmentHint&&(e=o.fragmentHint);const n=this.getNextPart(r,e,i);if(n>-1){const l=r[n];let d;return this.log(`Loading part sn: ${e.sn} p: ${l.index} cc: ${e.cc} of playlist [${o.startSN}-${o.endSN}] parts [0-${n}-${r.length-1}] ${"[stream-controller]"===this.logPrefix?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=l.start+l.duration,this.state=Tm,d=a?a.then((i=>!i||this.fragContextChanged(i.frag)?null:this.doFragPartsLoad(e,l,t,s))).catch((e=>this.handleFragLoadError(e))):this.doFragPartsLoad(e,l,t,s).catch((e=>this.handleFragLoadError(e))),this.hls.trigger(Rc.FRAG_LOADING,{frag:e,part:l,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}if(!e.url||this.loadedEndOfParts(r,i))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${o?"of ["+o.startSN+"-"+o.endSN+"] ":""}${"[stream-controller]"===this.logPrefix?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),Cc(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Tm;const n=this.config.progressive;let l;return l=n&&a?a.then((t=>!t||this.fragContextChanged(null==t?void 0:t.frag)?null:this.fragmentLoader.load(e,s))).catch((e=>this.handleFragLoadError(e))):Promise.all([this.fragmentLoader.load(e,n?s:void 0),a]).then((([e])=>(!n&&e&&s&&s(e),e))).catch((e=>this.handleFragLoadError(e))),this.hls.trigger(Rc.FRAG_LOADING,{frag:e,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l}doFragPartsLoad(e,t,i,s){return new Promise(((r,o)=>{var a;const n=[],l=null==(a=i.details)?void 0:a.partList,d=t=>{this.fragmentLoader.loadPart(e,t,s).then((s=>{n[t.index]=s;const o=s.part;this.hls.trigger(Rc.FRAG_LOADED,s);const a=bf(i,e.sn,t.index+1)||vf(l,e.sn,t.index+1);if(!a)return r({frag:e,part:o,partsLoaded:n});d(a)})).catch(o)};d(t)}))}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===Ic.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(Rc.ERROR,t)}else this.hls.trigger(Rc.ERROR,{type:Pc.OTHER_ERROR,details:Ic.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==Cm)return void(this.fragCurrent||this.state===wm||this.state===Rm||(this.state=Sm));const{frag:i,part:s,level:r}=t,o=self.performance.now();i.stats.parsing.end=o,s&&(s.stats.parsing.end=o),this.updateLevelTiming(i,s,r,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:s,sn:r,part:o}=e;if(null==t||!t[s])return this.warn(`Levels object was unset while buffering fragment ${r} of level ${s}. The current chunk will not be buffered.`),null;const a=t[s],n=o>-1?bf(a,r,o):null,l=n?n.fragment:function(e,t,i){if(null==e||!e.details)return null;const s=e.details;let r=s.fragments[t-s.startSN];return r||(r=s.fragmentHint,r&&r.sn===t?r:to&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){const i=this.getLoadPosition();return Cc(i)?this.getFwdBufferInfoAtPos(e,i,t):null}getFwdBufferInfoAtPos(e,t,i){const{config:{maxBufferHole:s}}=this,r=om.bufferInfo(e,t,s);if(0===r.len&&void 0!==r.nextStart){const o=this.fragmentTracker.getBufferedFrag(t,i);if(o&&r.nextStart=s&&(i.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0)}getAppendedFrag(e,t=Op){const i=this.fragmentTracker.getAppendedFrag(e,Op);return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,s=i.length;if(!s)return null;const{config:r}=this,o=i[0].start;let a;if(t.live){const n=r.initialLiveManifestSize;if(st}getNextFragmentLoopLoading(e,t,i,s,r){const o=e.gap,a=this.getNextFragment(this.nextLoadPosition,t);if(null===a)return a;if(e=a,o&&e&&!e.gap&&i.nextStart){const t=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,s);if(null!==t&&i.len+t.len>=r)return this.log(`buffer full after gaps in "${s}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return null==e||!e.initSegment||null!=e&&e.initSegment.data||this.bitrateTest?e:e.initSegment}getNextPart(e,t,i){let s=-1,r=!1,o=!0;for(let a=0,n=e.length;a-1&&ii.start&&i.loaded}getInitialLiveFragment(e,t){const i=this.fragPrevious;let s=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),s=function(e,t,i){if(null===t||!Array.isArray(e)||!e.length||!Cc(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;i=i||0;for(let s=0;s=e.startSN&&r<=e.endSN){const o=t[r-e.startSN];i.cc===o.cc&&(s=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${s.sn}`))}s||(s=function(e,t){return Lf(e,(e=>e.cct?-1:0))}(t,i.cc),s&&this.log(`Live playlist, switching playlist, load frag with same CC: ${s.sn}`))}}else{const t=this.hls.liveSyncPosition;null!==t&&(s=this.getFragmentAtPosition(t,this.bitrateTest?e.fragmentEnd:e.edge,e))}return s}getFragmentAtPosition(e,t,i){const{config:s}=this;let{fragPrevious:r}=this,{fragments:o,endSN:a}=i;const{fragmentHint:n}=i,{maxFragLookUpTolerance:l}=s,d=i.partList,h=!!(s.lowLatencyMode&&null!=d&&d.length&&n);let c;if(h&&n&&!this.bitrateTest&&(o=o.concat(n),a=n.sn),et-l?0:l)}else c=o[o.length-1];if(c){const e=c.sn-i.startSN,t=this.fragmentTracker.getState(c);if((t===em||t===Zf&&c.gap)&&(r=c),r&&c.sn===r.sn&&(!h||d[0].fragment.sn>c.sn)){if(r&&c.level===r.level){const t=o[e+1];c=c.sn=o-t.maxFragLookUpTolerance&&r<=a;if(null!==s&&i.duration>s&&(r${e.startSN} prev-sn: ${r?r.sn:"na"} fragments: ${s}`),o}return r}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)}setStartPosition(e,t){let i=this.startPosition;if(i ${null==(s=this.fragCurrent)?void 0:s.url}`);const r=t.details===Ic.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(i,!0);const o=t.errorAction,{action:a,retryCount:n=0,retryConfig:l}=o||{};if(o&&a===Bf&&l){this.resetStartWhenNotLoaded(this.levelLastLoaded);const s=Ef(l,n);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${n+1}/${l.maxNumRetry} in ${s}ms`),o.resolved=!0,this.retryDate=self.performance.now()+s,this.state=km}else if(l&&o){if(this.resetFragmentErrors(e),!(n.5;r&&this.reduceMaxBufferLength(s.len,(null==t?void 0:t.duration)||10);const o=!r;return o&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),o}return!1}resetFragmentErrors(e){e===Np&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==wm&&(this.state=Sm)}afterBufferFlushed(e,t,i){if(!e)return;const s=om.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,s,i),this.state===Dm&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=Sm}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;null!=t&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,s){var r;const o=i.details;if(!o)return void this.warn("level.details undefined");if(!Object.keys(e.elementaryStreams).reduce(((t,r)=>{const a=e.elementaryStreams[r];if(a){const n=a.endPTS-a.startPTS;if(n<=0)return this.warn(`Could not parse fragment ${e.sn} ${r} duration reliably (${n})`),t||!1;const l=s?0:mf(o,e,a.startPTS,a.endPTS,a.startDTS,a.endDTS);return this.hls.trigger(Rc.LEVEL_PTS_UPDATED,{details:o,level:i,drift:l,type:r,frag:e,start:a.startPTS,end:a.endPTS}),!0}return t}),!1)&&null===(null==(r=this.transmuxer)?void 0:r.error)){const t=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(0===i.fragmentError&&(i.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(t.message),this.hls.trigger(Rc.ERROR,{type:Pc.MEDIA_ERROR,details:Ic.FRAG_PARSING_ERROR,fatal:!1,error:t,frag:e,reason:`Found no media in msn ${e.sn} of level "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=xm,this.hls.trigger(Rc.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class Mm{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;return e.length?(i=1===e.length?e[0]:function(e,t){const i=new Uint8Array(t);let s=0;for(let t=0;t0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:Kp,duration:Number.POSITIVE_INFINITY});r{if(Cc(e))return 90*e;return 9e4*t+(i?9e4*i.baseTime/i.timescale:0)};function Nm(e,t){return 255===e[t]&&240==(246&e[t+1])}function jm(e,t){return 1&e[t+1]?7:9}function Gm(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function Wm(e,t){return t+1=e.length)return!1;const s=Gm(e,t);if(s<=i)return!1;const r=t+s;return r===e.length||Wm(e,r)}return!1}function $m(e,t,i,s,r){if(!e.samplerate){const o=function(e,t,i,s){let r,o,a,n;const l=navigator.userAgent.toLowerCase(),d=s,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];r=1+((192&t[i+2])>>>6);const c=(60&t[i+2])>>>2;if(!(c>h.length-1))return a=(1&t[i+2])<<2,a|=(192&t[i+3])>>>6,Oc.log(`manifest codec:${s}, ADTS type:${r}, samplingIndex:${c}`),/firefox/i.test(l)?c>=6?(r=5,n=new Array(4),o=c-3):(r=2,n=new Array(2),o=c):-1!==l.indexOf("android")?(r=2,n=new Array(2),o=c):(r=5,n=new Array(4),s&&(-1!==s.indexOf("mp4a.40.29")||-1!==s.indexOf("mp4a.40.5"))||!s&&c>=6?o=c-3:((s&&-1!==s.indexOf("mp4a.40.2")&&(c>=6&&1===a||/vivaldi/i.test(l))||!s&&1===a)&&(r=2,n=new Array(2)),o=c)),n[0]=r<<3,n[0]|=(14&c)>>1,n[1]|=(1&c)<<7,n[1]|=a<<3,5===r&&(n[1]|=(14&o)>>1,n[2]=(1&o)<<7,n[2]|=8,n[3]=0),{config:n,samplerate:h[c],channelCount:a,codec:"mp4a.40."+r,manifestCodec:d};{const t=new Error(`invalid ADTS sampling index:${c}`);e.emit(Rc.ERROR,Rc.ERROR,{type:Pc.MEDIA_ERROR,details:Ic.FRAG_PARSING_ERROR,fatal:!0,error:t,reason:t.message})}}(t,i,s,r);if(!o)return;e.config=o.config,e.samplerate=o.samplerate,e.channelCount=o.channelCount,e.codec=o.codec,e.manifestCodec=o.manifestCodec,Oc.log(`parsed codec:${e.codec}, rate:${o.samplerate}, channels:${o.channelCount}`)}}function Vm(e){return 9216e4/e}function Hm(e,t,i,s,r){const o=s+r*Vm(e.samplerate),a=function(e,t){const i=jm(e,t);if(t+i<=e.length){const s=Gm(e,t)-i;if(s>0)return{headerLength:i,frameLength:s}}}(t,i);let n;if(a){const{frameLength:s,headerLength:r}=a,l=r+s,d=Math.max(0,i+l-t.length);d?(n=new Uint8Array(l-r),n.set(t.subarray(i+r,t.length),0)):n=t.subarray(i+r,i+l);const h={unit:n,pts:o};return d||e.samples.push(h),{sample:h,length:l,missing:d}}const l=t.length-i;n=new Uint8Array(l),n.set(t.subarray(i,t.length),0);return{sample:{unit:n,pts:o},length:l,missing:-1}}let Jm=null;const qm=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],Km=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Ym=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Qm=[0,1,1,4];function Xm(e,t,i,s,r){if(i+24>t.length)return;const o=Zm(t,i);if(o&&i+o.frameLength<=t.length){const a=s+r*(9e4*o.samplesPerFrame/o.sampleRate),n={unit:t.subarray(i,i+o.frameLength),pts:a,dts:a};return e.config=[],e.channelCount=o.channelCount,e.samplerate=o.sampleRate,e.samples.push(n),{sample:n,length:o.frameLength,missing:0}}}function Zm(e,t){const i=e[t+1]>>3&3,s=e[t+1]>>1&3,r=e[t+2]>>4&15,o=e[t+2]>>2&3;if(1!==i&&0!==r&&15!==r&&3!==o){const a=e[t+2]>>1&1,n=e[t+3]>>6,l=1e3*qm[14*(3===i?3-s:3===s?3:4)+r-1],d=Km[3*(3===i?0:2===i?1:2)+o],h=3===n?1:2,c=Ym[i][s],u=Qm[s],p=8*c*u,f=Math.floor(c*l/d+a)*u;if(null===Jm){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Jm=e?parseInt(e[1]):0}return!!Jm&&Jm<=87&&2===s&&l>=224e3&&0===n&&(e[t+3]=128|e[t+3]),{sampleRate:d,channelCount:h,frameLength:f,samplesPerFrame:p}}}function eg(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function tg(e,t){return t+1{let i=0,s=5;t+=s;const r=new Uint32Array(1),o=new Uint32Array(1),a=new Uint8Array(1);for(;s>0;){a[0]=e[t];const n=Math.min(s,8),l=8-n;o[0]=4278190080>>>24+l<>l,i=i?i<t.length)return-1;if(11!==t[i]||119!==t[i+1])return-1;const o=t[i+4]>>6;if(o>=3)return-1;const a=[48e3,44100,32e3][o],n=63&t[i+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*n+o];if(i+l>t.length)return-1;const d=t[i+6]>>5;let h=0;2===d?h+=2:(1&d&&1!==d&&(h+=2),4&d&&(h+=2));const c=(t[i+6]<<8|t[i+7])>>12-h&1,u=[2,1,2,3,3,4,4,5][d]+c,p=t[i+5]>>3,f=7&t[i+5],m=new Uint8Array([o<<6|p<<1|f>>2,(3&f)<<6|d<<3|c<<2|n>>4,n<<4&224]),g=s+r*(1536/a*9e4),y=t.subarray(i,i+l);return e.config=m,e.channelCount=u,e.samplerate=a,e.samples.push({unit:y,pts:g}),l}class ng{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,s=new Uint8Array(4),r=Math.min(4,t);if(0===r)throw new Error("no bytes available");s.set(e.subarray(i,i+r)),this.word=new DataView(s.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r}skipBits(e){let t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(t=(e-=this.bitsAvailable)>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&Oc.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return t=e-t,t>0&&this.bitsAvailable?i<>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t,i=8,s=8;for(let r=0;r{var o;switch(s.type){case 1:{let t=!1;a=!0;const r=s.data;if(l&&r.length>4){const e=new ng(r).readSliceType();2!==e&&4!==e&&7!==e&&9!==e||(t=!0)}var d;if(t)null!=(d=n)&&d.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null);n||(n=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),n.frame=!0,n.key=t;break}case 5:a=!0,null!=(o=n)&&o.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null),n||(n=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),n.key=!0,n.frame=!0;break;case 6:a=!0,Zu(s.data,1,i.pts,t.samples);break;case 7:{var h,c;a=!0,l=!0;const t=s.data,i=new ng(t).readSPS();if(!e.sps||e.width!==i.width||e.height!==i.height||(null==(h=e.pixelRatio)?void 0:h[0])!==i.pixelRatio[0]||(null==(c=e.pixelRatio)?void 0:c[1])!==i.pixelRatio[1]){e.width=i.width,e.height=i.height,e.pixelRatio=i.pixelRatio,e.sps=[t],e.duration=r;const s=t.subarray(1,4);let o="avc1.";for(let e=0;e<3;e++){let t=s[e].toString(16);t.length<2&&(t="0"+t),o+=t}e.codec=o}break}case 8:a=!0,e.pps=[s.data];break;case 9:a=!0,e.audFound=!0,n&&this.pushAccessUnit(n,e),n=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"");break;case 12:a=!0;break;default:a=!1,n&&(n.debug+="unknown NAL "+s.type+" ")}if(n&&a){n.units.push(s)}})),s&&n&&(this.pushAccessUnit(n,e),this.VideoSample=null)}parseAVCNALu(e,t){const i=t.byteLength;let s=e.naluState||0;const r=s,o=[];let a,n,l,d=0,h=-1,c=0;for(-1===s&&(h=0,c=31&t[0],s=0,d=1);d=0){const e={data:t.subarray(h,n),type:c};o.push(e)}else{const i=this.getLastNalUnit(e.samples);i&&(r&&d<=4-r&&i.state&&(i.data=i.data.subarray(0,i.data.byteLength-r)),n>0&&(i.data=Yu(i.data,t.subarray(0,n)),i.state=0))}d=0&&s>=0){const e={data:t.subarray(h,i),type:c,state:s};o.push(e)}if(0===o.length){const i=this.getLastNalUnit(e.samples);i&&(i.data=Yu(i.data,t))}return e.naluState=s,o}}class dg{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new vm(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,i){const s=e[t].unit;if(s.length<=16)return;const r=s.subarray(16,s.length-s.length%16),o=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(o).then((r=>{const o=new Uint8Array(r);s.set(o,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)}))}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t);let s=0;for(let t=32;t{r.data=this.getAvcDecryptedUnit(o,a),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,s)}))}decryptAvcSamples(e,t,i,s){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void s();const r=e[t].units;for(;!(i>=r.length);i++){const o=r[i];if(!(o.data.length<=48||1!==o.type&&5!==o.type||(this.decryptAvcSample(e,t,i,s,o),this.decrypter.isSync())))return}}}}const hg=188;class cg{constructor(e,t,i){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.videoParser=new lg}static probe(e){const t=cg.syncOffset(e);return t>0&&Oc.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),-1!==t}static syncOffset(e){const t=e.length;let i=Math.min(940,t-hg)+1,s=0;for(;s1&&(0===o&&a>2||n+hg>i))return o}s++}return-1}static createTrack(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:Bu[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}resetInitSegment(e,t,i,s){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=cg.createTrack("video"),this._audioTrack=cg.createTrack("audio",s),this._id3Track=cg.createTrack("id3"),this._txtTrack=cg.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=s}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,s=!1){let r;i||(this.sampleAes=null);const o=this._videoTrack,a=this._audioTrack,n=this._id3Track,l=this._txtTrack;let d=o.pid,h=o.pesData,c=a.pid,u=n.pid,p=a.pesData,f=n.pesData,m=null,g=this.pmtParsed,y=this._pmtId,A=e.length;if(this.remainderData&&(A=(e=Yu(this.remainderData,e)).length,this.remainderData=null),A>4>1){if(v=t+5+e[t+4],v===t+hg)continue}else v=t+4;switch(A){case d:s&&(h&&(r=yg(h))&&this.videoParser.parseAVCPES(o,l,r,!1,this._duration),h={data:[],size:0}),h&&(h.data.push(e.subarray(v,t+hg)),h.size+=t+hg-v);break;case c:if(s){if(p&&(r=yg(p)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,r);break;case"mp3":this.parseMPEGPES(a,r);break;case"ac3":this.parseAC3PES(a,r)}p={data:[],size:0}}p&&(p.data.push(e.subarray(v,t+hg)),p.size+=t+hg-v);break;case u:s&&(f&&(r=yg(f))&&this.parseID3PES(n,r),f={data:[],size:0}),f&&(f.data.push(e.subarray(v,t+hg)),f.size+=t+hg-v);break;case 0:s&&(v+=e[v]+1),y=this._pmtId=pg(e,v);break;case y:{s&&(v+=e[v]+1);const r=fg(e,v,this.typeSupported,i,this.observer);d=r.videoPid,d>0&&(o.pid=d,o.segmentCodec=r.segmentVideoCodec),c=r.audioPid,c>0&&(a.pid=c,a.segmentCodec=r.segmentAudioCodec),u=r.id3Pid,u>0&&(n.pid=u),null===m||g||(Oc.warn(`MPEG-TS PMT found at ${t} after unknown PID '${m}'. Backtracking to sync byte @${b} to parse all TS packets.`),m=null,t=b-188),g=this.pmtParsed=!0;break}case 17:case 8191:break;default:m=A}}else v++;v>0&&mg(this.observer,new Error(`Found ${v} TS packet/s that do not start with 0x47`)),o.pesData=h,a.pesData=p,n.pesData=f;const _={audioTrack:a,videoTrack:o,id3Track:n,textTrack:l};return s&&this.extractRemainingSamples(_),_}flush(){const{remainderData:e}=this;let t;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:s,textTrack:r}=e,o=i.pesData,a=t.pesData,n=s.pesData;let l;if(o&&(l=yg(o))?(this.videoParser.parseAVCPES(i,r,l,!0,this._duration),i.pesData=null):i.pesData=o,a&&(l=yg(a))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break;case"ac3":this.parseAC3PES(t,l)}t.pesData=null}else null!=a&&a.size&&Oc.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;n&&(l=yg(n))?(this.parseID3PES(s,l),s.pesData=null):s.pesData=n}demuxSampleAes(e,t,i){const s=this.demux(e,i,!0,!this.config.progressive),r=this.sampleAes=new dg(this.observer,this.config,t);return this.decrypt(s,r)}decrypt(e,t){return new Promise((i=>{const{audioTrack:s,videoTrack:r}=e;s.samples&&"aac"===s.segmentCodec?t.decryptAacSamples(s.samples,0,(()=>{r.samples?t.decryptAvcSamples(r.samples,0,0,(()=>{i(e)})):i(e)})):r.samples&&t.decryptAvcSamples(r.samples,0,0,(()=>{i(e)}))}))}destroy(){this._duration=0}parseAACPES(e,t){let i=0;const s=this.aacOverFlow;let r,o,a,n=t.data;if(s){this.aacOverFlow=null;const t=s.missing,r=s.sample.unit.byteLength;if(-1===t)n=Yu(s.sample.unit,n);else{const o=r-t;s.sample.unit.set(n.subarray(0,t),o),e.samples.push(s.sample),i=s.missing}}for(r=i,o=n.length;r0;)n+=o}}parseID3PES(e,t){if(void 0===t.pts)return void Oc.warn("[tsdemuxer]: ID3 PES unknown PTS");const i=Lc({},t,{type:this._videoTrack?Qp:Kp,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function ug(e,t){return((31&e[t+1])<<8)+e[t+2]}function pg(e,t){return(31&e[t+10])<<8|e[t+11]}function fg(e,t,i,s,r){const o={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},a=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t0){let s=t+5,r=n;for(;r>2;){if(106===e[s])!0!==i.ac3?Oc.log("AC-3 audio found, not supported in this browser for now"):(o.audioPid=a,o.segmentAudioCodec="ac3");const t=e[s+1]+2;s+=t,r-=t}}break;case 194:case 135:return mg(r,new Error("Unsupported EC-3 in M2TS found")),o;case 36:return mg(r,new Error("Unsupported HEVC in M2TS found")),o}t+=n+5}return o}function mg(e,t,i){Oc.warn(`parsing error: ${t.message}`),e.emit(Rc.ERROR,Rc.ERROR,{type:Pc.MEDIA_ERROR,details:Ic.FRAG_PARSING_ERROR,fatal:!1,levelRetry:i,error:t,reason:t.message})}function gg(e){Oc.log(`${e} with AES-128-CBC encryption found in unencrypted stream`)}function yg(e){let t,i,s,r,o,a=0;const n=e.data;if(!e||0===e.size)return null;for(;n[0].length<19&&n.length>1;)n[0]=Yu(n[0],n[1]),n.splice(1,1);t=n[0];if(1===(t[0]<<16)+(t[1]<<8)+t[2]){if(i=(t[4]<<8)+t[5],i&&i>e.size-6)return null;const l=t[7];192&l&&(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&l?(o=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2,r-o>54e5&&(Oc.warn(`${Math.round((r-o)/9e4)}s delta between PTS and DTS, align them`),r=o)):o=r),s=t[8];let d=s+9;if(e.size<=d)return null;e.size-=d;const h=new Uint8Array(e.size);for(let e=0,i=n.length;ei){d-=i;continue}t=t.subarray(d),i-=d,d=0}h.set(t,a),a+=i}return i&&(i-=s+3),{data:h,pts:r,dts:o,len:i}}return null}class Ag{static getSilentFrame(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}const bg=Math.pow(2,32)-1;class vg{static init(){let e;for(e in vg.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},vg.types)vg.types.hasOwnProperty(e)&&(vg.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);vg.HDLR_TYPES={video:t,audio:i};const s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);vg.STTS=vg.STSC=vg.STCO=r,vg.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),vg.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),vg.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),vg.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const o=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),n=new Uint8Array([0,0,0,1]);vg.FTYP=vg.box(vg.types.ftyp,o,n,o,a),vg.DINF=vg.box(vg.types.dinf,vg.box(vg.types.dref,s))}static box(e,...t){let i=8,s=t.length;const r=s;for(;s--;)i+=t[s].byteLength;const o=new Uint8Array(i);for(o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=255&i,o.set(e,4),s=0,i=8;s>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,s>>24,s>>16&255,s>>8&255,255&s,85,196,0,0]))}static mdia(e){return vg.box(vg.types.mdia,vg.mdhd(e.timescale,e.duration),vg.hdlr(e.type),vg.minf(e))}static mfhd(e){return vg.box(vg.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}static minf(e){return"audio"===e.type?vg.box(vg.types.minf,vg.box(vg.types.smhd,vg.SMHD),vg.DINF,vg.stbl(e)):vg.box(vg.types.minf,vg.box(vg.types.vmhd,vg.VMHD),vg.DINF,vg.stbl(e))}static moof(e,t,i){return vg.box(vg.types.moof,vg.mfhd(e),vg.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=vg.trak(e[t]);return vg.box.apply(null,[vg.types.moov,vg.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(vg.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=vg.trex(e[t]);return vg.box.apply(null,[vg.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(bg+1)),s=Math.floor(t%(bg+1)),r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,s>>24,s>>16&255,s>>8&255,255&s,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return vg.box(vg.types.mvhd,r)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let s,r;for(s=0;s>>8&255),r.push(255&s),r=r.concat(Array.prototype.slice.call(i));for(t=0;t>>8&255),o.push(255&s),o=o.concat(Array.prototype.slice.call(i));const a=vg.box(vg.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|e.sps.length].concat(r).concat([e.pps.length]).concat(o))),n=e.width,l=e.height,d=e.pixelRatio[0],h=e.pixelRatio[1];return vg.box(vg.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,n>>8&255,255&n,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),a,vg.box(vg.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),vg.box(vg.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,h>>24,h>>16&255,h>>8&255,255&h])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0])}static mp4a(e){return vg.box(vg.types.mp4a,vg.audioStsd(e),vg.box(vg.types.esds,vg.esds(e)))}static mp3(e){return vg.box(vg.types[".mp3"],vg.audioStsd(e))}static ac3(e){return vg.box(vg.types["ac-3"],vg.audioStsd(e),vg.box(vg.types.dac3,e.config))}static stsd(e){return"audio"===e.type?"mp3"===e.segmentCodec&&"mp3"===e.codec?vg.box(vg.types.stsd,vg.STSD,vg.mp3(e)):"ac3"===e.segmentCodec?vg.box(vg.types.stsd,vg.STSD,vg.ac3(e)):vg.box(vg.types.stsd,vg.STSD,vg.mp4a(e)):vg.box(vg.types.stsd,vg.STSD,vg.avc1(e))}static tkhd(e){const t=e.id,i=e.duration*e.timescale,s=e.width,r=e.height,o=Math.floor(i/(bg+1)),a=Math.floor(i%(bg+1));return vg.box(vg.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,a>>24,a>>16&255,a>>8&255,255&a,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>8&255,255&s,0,0,r>>8&255,255&r,0,0]))}static traf(e,t){const i=vg.sdtp(e),s=e.id,r=Math.floor(t/(bg+1)),o=Math.floor(t%(bg+1));return vg.box(vg.types.traf,vg.box(vg.types.tfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s])),vg.box(vg.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,o>>24,o>>16&255,o>>8&255,255&o])),vg.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,vg.box(vg.types.trak,vg.tkhd(e),vg.mdia(e))}static trex(e){const t=e.id;return vg.box(vg.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],s=i.length,r=12+16*s,o=new Uint8Array(r);let a,n,l,d,h,c;for(t+=8+r,o.set(["video"===e.type?1:0,0,15,1,s>>>24&255,s>>>16&255,s>>>8&255,255&s,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0),a=0;a>>24&255,l>>>16&255,l>>>8&255,255&l,d>>>24&255,d>>>16&255,d>>>8&255,255&d,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|h.isNonSync,61440&h.degradPrio,15&h.degradPrio,c>>>24&255,c>>>16&255,c>>>8&255,255&c],12+16*a);return vg.box(vg.types.trun,o)}static initSegment(e){vg.types||vg.init();const t=vg.moov(e);return Yu(vg.FTYP,t)}}vg.types=void 0,vg.HDLR_TYPES=void 0,vg.STTS=void 0,vg.STSC=void 0,vg.STCO=void 0,vg.STSZ=void 0,vg.VMHD=void 0,vg.SMHD=void 0,vg.STSD=void 0,vg.FTYP=void 0,vg.DINF=void 0;function _g(e,t,i=1,s=!1){const r=e*t*i;return s?Math.round(r):r}function wg(e,t=!1){return _g(e,1e3,1/9e4,t)}let Sg,Eg=null,Tg=null;class kg{constructor(e,t,i,s=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,null===Eg){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Eg=e?parseInt(e[1]):0}if(null===Tg){const e=navigator.userAgent.match(/Safari\/(\d+)/i);Tg=e?parseInt(e[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){Oc.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){Oc.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){Oc.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e.reduce(((e,i)=>{const s=i.pts-e;return s<-4294967296?(t=!0,Lg(e,i.pts)):s>0?e:i.pts}),e[0].pts);return t&&Oc.debug("PTS rollover detected"),i}remux(e,t,i,s,r,o,a,n){let l,d,h,c,u,p,f=r,m=r;const g=e.pid>-1,y=t.pid>-1,A=t.samples.length,b=e.samples.length>0,v=a&&A>0||A>1;if((!g||b)&&(!y||v)||this.ISGenerated||a){if(this.ISGenerated){var _,w,S,E;const e=this.videoTrackConfig;!e||t.width===e.width&&t.height===e.height&&(null==(_=t.pixelRatio)?void 0:_[0])===(null==(w=e.pixelRatio)?void 0:w[0])&&(null==(S=t.pixelRatio)?void 0:S[1])===(null==(E=e.pixelRatio)?void 0:E[1])||this.resetInitSegment()}else h=this.generateIS(e,t,r,o);const i=this.isVideoContiguous;let s,a=-1;if(v&&(a=function(e){for(let t=0;t0){Oc.warn(`[mp4-remuxer]: Dropped ${a} out of ${A} video samples due to a missing keyframe`);const e=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(a),t.dropped+=a,m+=(t.samples[0].pts-e)/t.inputTimeScale,s=m}else-1===a&&(Oc.warn(`[mp4-remuxer]: No keyframe found out of ${A} video samples`),p=!1);if(this.ISGenerated){if(b&&v){const i=this.getVideoStartPts(t.samples),s=(Lg(e.samples[0].pts,i)-i)/t.inputTimeScale;f+=Math.max(0,s),m+=Math.max(0,-s)}if(b){if(e.samplerate||(Oc.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),h=this.generateIS(e,t,r,o)),d=this.remuxAudio(e,f,this.isAudioContiguous,o,y||v||n===Np?m:void 0),v){const s=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(Oc.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),h=this.generateIS(e,t,r,o)),l=this.remuxVideo(t,m,i,s)}}else v&&(l=this.remuxVideo(t,m,i,0));l&&(l.firstKeyFrame=a,l.independent=-1!==a,l.firstKeyFramePTS=s)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(u=Cg(i,r,this._initPTS,this._initDTS)),s.samples.length&&(c=xg(s,r,this._initPTS))),{audio:d,video:l,initSegment:h,independent:p,text:c,id3:u}}generateIS(e,t,i,s){const r=e.samples,o=t.samples,a=this.typeSupported,n={},l=this._initPTS;let d,h,c,u=!l||s,p="audio/mp4";if(u&&(d=h=1/0),e.config&&r.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(p="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}n.audio={id:"audio",container:p,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&a.mpeg?new Uint8Array(0):vg.initSegment([e]),metadata:{channelCount:e.channelCount}},u&&(c=e.inputTimeScale,l&&c===l.timescale?u=!1:d=h=r[0].pts-Math.round(c*i))}if(t.sps&&t.pps&&o.length){if(t.timescale=t.inputTimeScale,n.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:vg.initSegment([t]),metadata:{width:t.width,height:t.height}},u)if(c=t.inputTimeScale,l&&c===l.timescale)u=!1;else{const e=this.getVideoStartPts(o),t=Math.round(c*i);h=Math.min(h,Lg(o[0].dts,e)-t),d=Math.min(d,e-t)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(n).length)return this.ISGenerated=!0,u?(this._initPTS={baseTime:d,timescale:c},this._initDTS={baseTime:h,timescale:c}):d=c=void 0,{tracks:n,initPTS:d,timescale:c}}remuxVideo(e,t,i,s){const r=e.inputTimeScale,o=e.samples,a=[],n=o.length,l=this._initPTS;let d,h,c=this.nextAvcDts,u=8,p=this.videoSampleDuration,f=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,g=!1;if(!i||null===c){const e=t*r,s=o[0].pts-Lg(o[0].dts,o[0].pts);Eg&&null!==c&&Math.abs(e-s-c)<15e3?i=!0:c=e-s}const y=l.baseTime*r/l.timescale;for(let e=0;e0?e-1:e].dts&&(g=!0)}g&&o.sort((function(e,t){const i=e.dts-t.dts,s=e.pts-t.pts;return i||s})),d=o[0].dts,h=o[o.length-1].dts;const A=h-d,b=A?Math.round(A/(n-1)):p||e.inputTimeScale/30;if(i){const e=d-c,i=e>b,s=e<-1;if((i||s)&&(i?Oc.warn(`AVC: ${wg(e,!0)} ms (${e}dts) hole between fragments detected at ${t.toFixed(3)}`):Oc.warn(`AVC: ${wg(-e,!0)} ms (${e}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!s||c>=o[0].pts||Eg)){d=c;const t=o[0].pts-e;if(i)o[0].dts=d,o[0].pts=t;else for(let i=0;it);i++)o[i].dts-=e,o[i].pts-=e;Oc.log(`Video: Initial PTS/DTS adjusted: ${wg(t,!0)}/${wg(d,!0)}, delta: ${wg(e,!0)} ms`)}}d=Math.max(0,d);let v=0,_=0,w=d;for(let e=0;e0?t.dts-o[e-1].dts:b;if(l=e>0?t.pts-o[e-1].pts:b,i.stretchShortVideoTrack&&null!==this.nextAudioPts){const e=Math.floor(i.maxBufferHole*r),o=(s?f+s*r:this.nextAudioPts)-t.pts;o>e?(p=o-a,p<0?p=a:k=!0,Oc.log(`[mp4-remuxer]: It is approximately ${o/90} ms to the next segment; using duration ${p/90} ms for the last video frame.`)):p=a}else p=a}const h=Math.round(t.pts-t.dts);L=Math.min(L,p),x=Math.max(x,p),C=Math.min(C,l),D=Math.max(D,l),a.push(new Dg(t.key,p,d,h))}if(a.length)if(Eg){if(Eg<70){const e=a[0].flags;e.dependsOn=2,e.isNonSync=0}}else if(Tg&&D-C0&&(s&&Math.abs(g-m)<9e3||Math.abs(Lg(p[0].pts-y,g)-m)<20*l),p.forEach((function(e){e.pts=Lg(e.pts-y,g)})),!i||m<0){if(p=p.filter((e=>e.pts>=0)),!p.length)return;m=0===r?0:s&&!u?Math.max(0,g):p[0].pts}if("aac"===e.segmentCodec){const t=this.config.maxAudioFramesDrift;for(let i=0,s=m;i=t*l&&d<1e4&&u){let t=Math.round(n/l);s=a-t*l,s<0&&(t--,s+=l),0===i&&(this.nextAudioPts=m=s),Oc.warn(`[mp4-remuxer]: Injecting ${t} audio frame @ ${(s/o).toFixed(3)}s due to ${Math.round(1e3*n/o)} ms gap.`);for(let o=0;o0))return;_+=f;try{A=new Uint8Array(_)}catch(e){return void this.observer.emit(Rc.ERROR,Rc.ERROR,{type:Pc.MUX_ERROR,details:Ic.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:_,reason:`fail allocating audio mdat ${_}`})}if(!h){new DataView(A.buffer).setUint32(0,_),A.set(vg.types.mdat,4)}}A.set(r,f);const l=r.byteLength;f+=l,c.push(new Dg(!0,n,l,0)),v=o}const S=c.length;if(!S)return;const E=c[c.length-1];this.nextAudioPts=m=v+a*E.duration;const T=h?new Uint8Array(0):vg.moof(e.sequenceNumber++,b/a,Lc({},e,{samples:c}));e.samples=[];const k=b/o,L=m/o,C={data1:T,data2:A,startPTS:k,endPTS:L,startDTS:k,endDTS:L,type:"audio",hasAudio:!0,hasVideo:!1,nb:S};return this.isAudioContiguous=!0,C}remuxEmptyAudio(e,t,i,s){const r=e.inputTimeScale,o=r/(e.samplerate?e.samplerate:r),a=this.nextAudioPts,n=this._initDTS,l=9e4*n.baseTime/n.timescale,d=(null!==a?a:s.startDTS*r)+l,h=s.endDTS*r+l,c=1024*o,u=Math.ceil((h-d)/c),p=Ag.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(Oc.warn("[mp4-remuxer]: remux empty Audio"),!p)return void Oc.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");const f=[];for(let e=0;e4294967296;)e+=i;return e}function Cg(e,t,i,s){const r=e.samples.length;if(!r)return;const o=e.inputTimeScale;for(let a=0;ae.pts-t.pts));const o=e.samples;return e.samples=[],{samples:o}}class Dg{constructor(e,t,i,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=s,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}function Rg(e,t){const i=null==e?void 0:e.codec;if(i&&i.length>4)return i;if(t===Vc){if("ec-3"===i||"ac-3"===i||"alac"===i)return i;if("fLaC"===i||"Opus"===i){return bp(i,!1)}const e="mp4a.40.5";return Oc.info(`Parsed audio codec "${i}" or audio object type not handled. Using "${e}"`),e}return Oc.warn(`Unhandled video codec "${i}"`),"hvc1"===i||"hev1"===i?"hvc1.1.6.L120.90":"av01"===i?"av01.0.04M.08":"avc1.42e01e"}try{Sg=self.performance.now.bind(self.performance)}catch(e){Oc.debug("Unable to use Performance API on this environment"),Sg=null==tu?void 0:tu.Date.now}const Pg=[{demux:class{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,s){const r=this.videoTrack=Fm("video",1),o=this.audioTrack=Fm("audio",1),a=this.txtTrack=Fm("text",1);if(this.id3Track=Fm("id3",1),this.timeOffset=0,null==e||!e.byteLength)return;const n=zu(e);if(n.video){const{id:e,timescale:t,codec:i}=n.video;r.id=e,r.timescale=a.timescale=t,r.codec=i}if(n.audio){const{id:e,timescale:t,codec:i}=n.audio;o.id=e,o.timescale=t,o.codec=i}a.id=Bu.text,r.sampleDuration=0,r.duration=o.duration=s}resetContiguity(){this.remainderData=null}static probe(e){return function(e){const t=e.byteLength;for(let i=0;i8&&109===e[i+4]&&111===e[i+5]&&111===e[i+6]&&102===e[i+7])return!0;i=s>1?i+s:t}return!1}(e)}demux(e,t){this.timeOffset=t;let i=e;const s=this.videoTrack,r=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Yu(this.remainderData,e));const t=function(e){const t={valid:null,remainder:null},i=Gu(e,["moof"]);if(i.length<2)return t.remainder=e,t;const s=i[i.length-1];return t.valid=pu(e,0,s.byteOffset-8),t.remainder=pu(e,s.byteOffset-8),t}(i);this.remainderData=t.remainder,s.samples=t.valid||new Uint8Array}else s.samples=i;const o=this.extractID3Track(s,t);return r.samples=Qu(t,s),{videoTrack:s,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const s=this.extractID3Track(t,this.timeOffset);return i.samples=Qu(e,t),{videoTrack:t,audioTrack:Fm(),id3Track:s,textTrack:Fm()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const s=Gu(e.samples,["emsg"]);s&&s.forEach((e=>{const s=function(e){const t=e[0];let i="",s="",r=0,o=0,a=0,n=0,l=0,d=0;if(0===t){for(;"\0"!==Mu(e.subarray(d,d+1));)i+=Mu(e.subarray(d,d+1)),d+=1;for(i+=Mu(e.subarray(d,d+1)),d+=1;"\0"!==Mu(e.subarray(d,d+1));)s+=Mu(e.subarray(d,d+1)),d+=1;s+=Mu(e.subarray(d,d+1)),d+=1,r=Uu(e,12),o=Uu(e,16),n=Uu(e,20),l=Uu(e,24),d=28}else if(1===t){d+=4,r=Uu(e,d),d+=4;const t=Uu(e,d);d+=4;const o=Uu(e,d);for(d+=4,a=2**32*t+o,xc(a)||(a=Number.MAX_SAFE_INTEGER,Oc.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),n=Uu(e,d),d+=4,l=Uu(e,d),d+=4;"\0"!==Mu(e.subarray(d,d+1));)i+=Mu(e.subarray(d,d+1)),d+=1;for(i+=Mu(e.subarray(d,d+1)),d+=1;"\0"!==Mu(e.subarray(d,d+1));)s+=Mu(e.subarray(d,d+1)),d+=1;s+=Mu(e.subarray(d,d+1)),d+=1}return{schemeIdUri:i,value:s,timeScale:r,presentationTime:a,presentationTimeDelta:o,eventDuration:n,id:l,payload:e.subarray(d,e.byteLength)}}(e);if(sg.test(s.schemeIdUri)){const e=Cc(s.presentationTime)?s.presentationTime/s.timeScale:t+s.presentationTimeDelta/s.timeScale;let r=4294967295===s.eventDuration?Number.POSITIVE_INFINITY:s.eventDuration/s.timeScale;r<=.001&&(r=Number.POSITIVE_INFINITY);const o=s.payload;i.samples.push({data:o,len:o.byteLength,dts:e,pts:e,type:Qp,duration:r})}}))}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}},remux:class{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,i,s){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(function(e,t){if(!e||!t)return e;const i=t.keyId;i&&t.isCommonEncryption&&Gu(e,["moov","trak"]).forEach((e=>{const t=Gu(e,["mdia","minf","stbl","stsd"])[0].subarray(8);let s=Gu(t,["enca"]);const r=s.length>0;r||(s=Gu(t,["encv"])),s.forEach((e=>{Gu(r?e.subarray(28):e.subarray(78),["sinf"]).forEach((e=>{const t=qu(e);if(t){const e=t.subarray(8,24);e.some((e=>0!==e))||(Oc.log(`[eme] Patching keyId in 'enc${r?"a":"v"}>sinf>>tenc' box: ${Ru(e)} -> ${Ru(i)}`),t.set(i,8))}}))}))}));return e}(e,s)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(null==e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);const s=this.initData=zu(e);s.audio&&(t=Rg(s.audio,Vc)),s.video&&(i=Rg(s.video,Hc));const r={};s.audio&&s.video?r.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:s.audio?r.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:s.video?r.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:Oc.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=r}remux(e,t,i,s,r,o){var a,n;let{initPTS:l,lastEndTime:d}=this;const h={audio:void 0,video:void 0,text:s,id3:i,initSegment:void 0};Cc(d)||(d=this.lastEndTime=r||0);const c=t.samples;if(null==c||!c.length)return h;const u={initPTS:void 0,timescale:1};let p=this.initData;if(null!=(a=p)&&a.length||(this.generateInitSegment(c),p=this.initData),null==(n=p)||!n.length)return Oc.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),h;this.emitInitSegment&&(u.tracks=this.initTracks,this.emitInitSegment=!1);const f=function(e,t){let i=0,s=0,r=0;const o=Gu(e,["moof","traf"]);for(let e=0;ee+t.info.duration||0),0);i=Math.max(i,e+o.earliestPresentationTime/o.timescale),s=i-t}}if(s&&Cc(s))return s}return s||r}(c,p),m=function(e,t){return Gu(t,["moof","traf"]).reduce(((t,i)=>{const s=Gu(i,["tfdt"])[0],r=s[0],o=Gu(i,["tfhd"]).reduce(((t,i)=>{const o=Uu(i,4),a=e[o];if(a){let e=Uu(s,4);if(1===r){if(e===Pu)return Oc.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),t;e*=Pu+1,e+=Uu(s,8)}const i=e/(a.timescale||9e4);if(Cc(i)&&(null===t||ir}(l,g,r,f)||u.timescale!==l.timescale&&o)&&(u.initPTS=g-r,l&&1===l.timescale&&Oc.warn("Adjusting initPTS by "+(u.initPTS-l.baseTime)),this.initPTS=l={baseTime:u.initPTS,timescale:1});const y=e?g-l.baseTime/l.timescale:d,A=y+f;!function(e,t,i){Gu(t,["moof","traf"]).forEach((t=>{Gu(t,["tfhd"]).forEach((s=>{const r=Uu(s,4),o=e[r];if(!o)return;const a=o.timescale||9e4;Gu(t,["tfdt"]).forEach((e=>{const t=e[0],s=i*a;if(s){let i=Uu(e,4);if(0===t)i-=s,i=Math.max(i,0),ju(e,4,i);else{i*=Math.pow(2,32),i+=Uu(e,8),i-=s,i=Math.max(i,0);const t=Math.floor(i/(Pu+1)),r=Math.floor(i%(Pu+1));ju(e,4,t),ju(e,8,r)}}}))}))}))}(p,c,l.baseTime/l.timescale),f>0?this.lastEndTime=A:(Oc.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const b=!!p.audio,v=!!p.video;let _="";b&&(_+="audio"),v&&(_+="video");const w={data1:c,startPTS:y,startDTS:y,endPTS:A,endDTS:A,type:_,hasAudio:b,hasVideo:v,nb:1,dropped:0};return h.audio="audio"===w.type?w:void 0,h.video="audio"!==w.type?w:void 0,h.initSegment=u,h.id3=Cg(i,r,l,l),s.samples.length&&(h.text=xg(s,r,l)),h}}},{demux:cg,remux:kg},{demux:class extends Um{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,s){super.resetInitSegment(e,t,i,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=gu(e,0);let i=(null==t?void 0:t.length)||0;if(ig(e,i))return!1;for(let t=e.length;i0&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(i=t);return i}(o,t);if(b&&"AES-128"===b.method){const e=this.getDecrypter();if(!e.isSync())return this.decryptionPromise=e.webCryptoDecrypt(o,b.key.buffer,b.iv.buffer).then((e=>{const t=this.push(e,null,i);return this.decryptionPromise=null,t})),this.decryptionPromise;{let t=e.softwareDecrypt(o,b.key.buffer,b.iv.buffer);if(i.part>-1&&(t=e.flush()),!t)return r.executeEnd=Sg(),Bg(i);o=new Uint8Array(t)}}const v=this.needsProbing(d,h);if(v){const e=this.configureTransmuxer(o);if(e)return Oc.warn(`[transmuxer] ${e.message}`),this.observer.emit(Rc.ERROR,Rc.ERROR,{type:Pc.MEDIA_ERROR,details:Ic.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message}),r.executeEnd=Sg(),Bg(i)}(d||h||p||v)&&this.resetInitSegment(A,f,m,y,t),(d||p||v)&&this.resetInitialTimestamp(g),l||this.resetContiguity();const _=this.transmux(o,b,u,c,i),w=this.currentTransmuxState;return w.contiguous=!0,w.discontinuity=!1,w.trackSwitch=!1,r.executeEnd=Sg(),_}flush(e){const t=e.transmuxing;t.executeStart=Sg();const{decrypter:i,currentTransmuxState:s,decryptionPromise:r}=this;if(r)return r.then((()=>this.flush(e)));const o=[],{timeOffset:a}=s;if(i){const t=i.flush();t&&o.push(this.push(t,null,e))}const{demuxer:n,remuxer:l}=this;if(!n||!l)return t.executeEnd=Sg(),[Bg(e)];const d=n.flush(a);return Mg(d)?d.then((t=>(this.flushRemux(o,t,e),o))):(this.flushRemux(o,d,e),o)}flushRemux(e,t,i){const{audioTrack:s,videoTrack:r,id3Track:o,textTrack:a}=t,{accurateTimeOffset:n,timeOffset:l}=this.currentTransmuxState;Oc.log(`[transmuxer.ts]: Flushed fragment ${i.sn}${i.part>-1?" p: "+i.part:""} of level ${i.level}`);const d=this.remuxer.remux(s,r,o,a,l,n,!0,this.id);e.push({remuxResult:d,chunkMeta:i}),i.transmuxing.executeEnd=Sg()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,s,r){const{demuxer:o,remuxer:a}=this;o&&a&&(o.resetInitSegment(e,t,i,s),a.resetInitSegment(e,t,i,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,s,r){let o;return o=t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,i,s,r):this.transmuxUnencrypted(e,i,s,r),o}transmuxUnencrypted(e,t,i,s){const{audioTrack:r,videoTrack:o,id3Track:a,textTrack:n}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,o,a,n,t,i,!1,this.id),chunkMeta:s}}transmuxSampleAes(e,t,i,s,r){return this.demuxer.demuxSampleAes(e,t,i).then((e=>({remuxResult:this.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,i,s,!1,this.id),chunkMeta:r})))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:s,vendor:r}=this;let o;for(let t=0,i=Pg.length;t({remuxResult:{},chunkMeta:e});function Mg(e){return"then"in e&&e.then instanceof Function}class Fg{constructor(e,t,i,s,r){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=s,this.defaultInitPts=r||null}}class Ug{constructor(e,t,i,s,r,o){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=s,this.timeOffset=r,this.initSegmentChange=o}}var Og={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function s(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,s,o,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var n=new r(s,o||e,a),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],n]:e._events[l].push(n):(e._events[l]=n,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new s:delete e._events[t]}function n(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),n.prototype.eventNames=function(){var e,s,r=[];if(0===this._eventsCount)return r;for(s in e=this._events)t.call(e,s)&&r.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},n.prototype.listeners=function(e){var t=i?i+e:e,s=this._events[t];if(!s)return[];if(s.fn)return[s.fn];for(var r=0,o=s.length,a=new Array(o);r{(t=t||{}).frag=this.frag,t.id=this.id,e===Rc.ERROR&&(this.error=t.error),this.hls.trigger(e,t)};this.observer=new Ng,this.observer.on(Rc.FRAG_DECRYPTED,o),this.observer.on(Rc.ERROR,o);const a=hp(r.preferManagedMediaSource)||{isTypeSupported:()=>!1},n={mpeg:a.isTypeSupported("audio/mpeg"),mp3:a.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:a.isTypeSupported('audio/mp4; codecs="ac-3"')};if(this.useWorker&&"undefined"!=typeof Worker){if(r.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{r.workerPath?(Oc.log(`loading Web Worker ${r.workerPath} for "${t}"`),this.workerContext=function(e){const t=new self.URL(e,self.location.href).href;return{worker:new self.Worker(t),scriptURL:t}}(r.workerPath)):(Oc.log(`injecting Web Worker for "${t}"`),this.workerContext=function(){const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e);return{worker:new self.Worker(t),objectURL:t}}()),this.onwmsg=e=>this.onWorkerMessage(e);const{worker:e}=this.workerContext;e.addEventListener("message",this.onwmsg),e.onerror=e=>{const i=new Error(`${e.message} (${e.filename}:${e.lineno})`);r.enableWorker=!1,Oc.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(Rc.ERROR,{type:Pc.OTHER_ERROR,details:Ic.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:i})},e.postMessage({cmd:"init",typeSupported:n,vendor:"",id:t,config:JSON.stringify(r)})}catch(e){Oc.warn(`Error setting up "${t}" Web Worker, fallback to inline`,e),this.resetWorker(),this.error=null,this.transmuxer=new Ig(this.observer,n,r,"",t)}return}}this.transmuxer=new Ig(this.observer,n,r,"",t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,i,s,r,o,a,n,l,d){var h,c;l.transmuxing.start=self.performance.now();const{transmuxer:u}=this,p=o?o.start:r.start,f=r.decryptdata,m=this.frag,g=!(m&&r.cc===m.cc),y=!(m&&l.level===m.level),A=m?l.sn-m.sn:-1,b=this.part?l.part-this.part.index:-1,v=0===A&&l.id>1&&l.id===(null==m?void 0:m.stats.chunkCount),_=!y&&(1===A||0===A&&(1===b||v&&b<=0)),w=self.performance.now();(y||A||0===r.stats.parsing.start)&&(r.stats.parsing.start=w),!o||!b&&_||(o.stats.parsing.start=w);const S=!(m&&(null==(h=r.initSegment)?void 0:h.url)===(null==(c=m.initSegment)?void 0:c.url)),E=new Ug(g,_,n,y,p,S);if(!_||g||S){Oc.log(`[transmuxer-interface, ${r.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}\n discontinuity: ${g}\n trackSwitch: ${y}\n contiguous: ${_}\n accurateTimeOffset: ${n}\n timeOffset: ${p}\n initSegmentChange: ${S}`);const e=new Fg(i,s,t,a,d);this.configureTransmuxer(e)}if(this.frag=r,this.part=o,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:f,chunkMeta:l,state:E},e instanceof ArrayBuffer?[e]:[]);else if(u){const t=u.push(e,f,l,E);Mg(t)?(u.async=!0,t.then((e=>{this.handleTransmuxComplete(e)})).catch((e=>{this.transmuxerError(e,l,"transmuxer-interface push error")}))):(u.async=!1,this.handleTransmuxComplete(t))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let i=t.flush(e);Mg(i)||t.async?(Mg(i)||(i=Promise.resolve(i)),i.then((t=>{this.handleFlushResult(t,e)})).catch((t=>{this.transmuxerError(t,e,"transmuxer-interface flush error")}))):this.handleFlushResult(i,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(Rc.ERROR,{type:Pc.MEDIA_ERROR,details:Ic.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach((e=>{this.handleTransmuxComplete(e)})),this.onFlush(t)}onWorkerMessage(e){const t=e.data;if(null==t||!t.event)return void Oc.warn("worker message received with no "+(t?"event name":"data"));const i=this.hls;if(this.hls)switch(t.event){case"init":{var s;const e=null==(s=this.workerContext)?void 0:s.objectURL;e&&self.URL.revokeObjectURL(e);break}case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":Oc[t.data.logType]&&Oc[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data)}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}function Gg(e,t){if(e.length!==t.length)return!1;for(let i=0;ie[i]!==t[i]))}function zg(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||"").toLowerCase())}class $g{constructor(e){this.buffered=void 0;const t=(t,i,s)=>{if((i>>>=0)>s-1)throw new DOMException(`Failed to execute '${t}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${s})`);return e[i][t]};this.buffered={get length(){return e.length},end:i=>t("end",i,e.length),start:i=>t("start",i,e.length)}}}class Vg{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,i){const s=this.queues[t];s.push(e),1!==s.length||i||this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const i=new Promise((e=>{t=e})),s={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(s,e),i}executeNext(e){const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(t){Oc.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${t}`),i.onError(t);const s=this.buffers[e];null!=s&&s.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const Hg=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;function Jg(e){const t=e.querySelectorAll("source");[].slice.call(t).forEach((t=>{e.removeChild(t)}))}const qg={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},Kg=e=>String.fromCharCode(qg[e]||e),Yg=15,Qg=100,Xg={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Zg={17:2,18:4,21:6,22:8,23:10,19:13,20:15},ey={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},ty={25:2,26:4,29:6,30:8,31:10,27:13,28:15},iy=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class sy{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i="function"==typeof t?t():t;Oc.log(`${this.time} [${e}] ${i}`)}}}const ry=function(e){const t=[];for(let i=0;iQg&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Qg)}moveCursor(e){const t=this.pos+e;if(e>1)for(let e=this.pos+1;e=144&&this.backSpace();const t=Kg(e);this.pos>=Qg?this.logger.log(0,(()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!")):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))}clearFromPos(e){let t;for(t=e;t"pacData = "+JSON.stringify(e)));let t=e.row-1;if(this.nrRollUpRows&&t"bkgData = "+JSON.stringify(e))),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,(()=>this.getDisplayText()));const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",s=-1;for(let i=0;i0&&(i=e?"["+t.join(" | ")+"]":t.join("\n")),i}getTextAndFormat(){return this.rows}}class dy{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new ly(i),this.nonDisplayedMemory=new ly(i),this.lastOutputScreen=new ly(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,(()=>"MODE="+e)),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let t=0;tt+": "+this.writeScreen.getDisplayText(!0))),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(1,(()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0))),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,(()=>"DISP: "+this.displayedMemory.getDisplayText()))}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,s=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=s[i]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class hy{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const s=this.logger=new sy;this.channels=[null,new dy(e,t,s),new dy(e+1,i,s)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let e=0;e"["+ry([t[e],t[e+1]])+"] -> ("+ry([i,s])+")"));const a=this.cmdHistory;if(i>=16&&i<=31){if(uy(i,s,a)){cy(null,null,a),this.logger.log(3,(()=>"Repeated command ("+ry([i,s])+") is dropped"));continue}cy(i,s,this.cmdHistory),r=this.parseCmd(i,s),r||(r=this.parseMidrow(i,s)),r||(r=this.parsePAC(i,s)),r||(r=this.parseBackgroundAttributes(i,s))}else cy(null,null,a);if(!r&&(o=this.parseChars(i,s),o)){const e=this.currentChannel;if(e&&e>0){this.channels[e].insertChars(o)}else this.logger.log(2,"No channel found yet. TEXT-MODE?")}r||o||this.logger.log(2,(()=>"Couldn't parse cleaned data "+ry([i,s])+" orig: "+ry([t[e],t[e+1]])))}}parseCmd(e,t){if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=33&&t<=35))return!1;const i=20===e||21===e||23===e?1:2,s=this.channels[i];return 20===e||21===e||28===e||29===e?32===t?s.ccRCL():33===t?s.ccBS():34===t?s.ccAOF():35===t?s.ccAON():36===t?s.ccDER():37===t?s.ccRU(2):38===t?s.ccRU(3):39===t?s.ccRU(4):40===t?s.ccFON():41===t?s.ccRDC():42===t?s.ccTR():43===t?s.ccRTD():44===t?s.ccEDM():45===t?s.ccCR():46===t?s.ccENM():47===t&&s.ccEOC():s.ccTO(t-32),this.currentChannel=i,!0}parseMidrow(e,t){let i=0;if((17===e||25===e)&&t>=32&&t<=47){if(i=17===e?1:2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const s=this.channels[i];return!!s&&(s.ccMIDROW(t),this.logger.log(3,(()=>"MIDROW ("+ry([e,t])+")")),!0)}return!1}parsePAC(e,t){let i;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127)&&!((16===e||24===e)&&t>=64&&t<=95))return!1;const s=e<=23?1:2;i=t>=64&&t<=95?1===s?Xg[e]:ey[e]:1===s?Zg[e]:ty[e];const r=this.channels[s];return!!r&&(r.setPAC(this.interpretPAC(i,t)),this.currentChannel=s,!0)}interpretPAC(e,t){let i;const s={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,s.underline=1==(1&i),i<=13?s.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(s.italics=!0,s.color="white"):s.indent=4*Math.floor((i-16)/2),s}parseChars(e,t){let i,s=null,r=null;if(e>=25?(i=2,r=e-8):(i=1,r=e),r>=17&&r<=19){let e;e=17===r?t+80:18===r?t+112:t+144,this.logger.log(2,(()=>"Special char '"+Kg(e)+"' in channel "+i)),s=[e]}else e>=32&&e<=127&&(s=0===t?[e]:[e,t]);return s&&this.logger.log(3,(()=>"Char codes = "+ry(s).join(","))),s}parseBackgroundAttributes(e,t){if(!((16===e||24===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=45&&t<=47))return!1;let i;const s={};16===e||24===e?(i=Math.floor((t-32)/2),s.background=iy[i],t%2==1&&(s.background=s.background+"_semi")):45===t?s.background="transparent":(s.foreground="black",47===t&&(s.underline=!0));const r=e<=23?1:2;return this.channels[r].setBkgData(s),!0}reset(){for(let e=0;ee)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var fy=function(){if(null!=tu&&tu.VTTCue)return self.VTTCue;const e=["","lr","rl"],t=["start","middle","end","left","right"];function i(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;const i=t.toLowerCase();return!!~e.indexOf(i)&&i}function s(e){return i(t,e)}function r(e,...t){let i=1;for(;i100)throw new Error("Position must be between 0 and 100.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(n,"positionAlign",r({},l,{get:function(){return v},set:function(e){const t=s(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");v=t,this.hasBeenReset=!0}})),Object.defineProperty(n,"size",r({},l,{get:function(){return _},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");_=e,this.hasBeenReset=!0}})),Object.defineProperty(n,"align",r({},l,{get:function(){return w},set:function(e){const t=s(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");w=t,this.hasBeenReset=!0}})),n.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class my{decode(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function gy(e){function t(e,t,i,s){return 3600*(0|e)+60*(0|t)+(0|i)+parseFloat(s||0)}const i=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return i?parseFloat(i[2])>59?t(i[2],i[3],0,i[4]):t(i[1],i[2],i[3],i[4]):null}class yy{constructor(){this.values=Object.create(null)}set(e,t){this.get(e)||""===t||(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let s=0;s=0&&i<=100)return this.set(e,i),!0}return!1}}function Ay(e,t,i,s){const r=s?e.split(s):[e];for(const e in r){if("string"!=typeof r[e])continue;const s=r[e].split(i);if(2!==s.length)continue;t(s[0],s[1])}}const by=new fy(0,0,""),vy="middle"===by.align?"middle":"center";function _y(e,t,i){const s=e;function r(){const t=gy(e);if(null===t)throw new Error("Malformed timestamp: "+s);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function o(){e=e.replace(/^\s+/,"")}if(o(),t.startTime=r(),o(),"--\x3e"!==e.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+s);e=e.slice(3),o(),t.endTime=r(),o(),function(e,t){const s=new yy;Ay(e,(function(e,t){let r;switch(e){case"region":for(let r=i.length-1;r>=0;r--)if(i[r].id===t){s.set(e,i[r].region);break}break;case"vertical":s.alt(e,t,["rl","lr"]);break;case"line":r=t.split(","),s.integer(e,r[0]),s.percent(e,r[0])&&s.set("snapToLines",!1),s.alt(e,r[0],["auto"]),2===r.length&&s.alt("lineAlign",r[1],["start",vy,"end"]);break;case"position":r=t.split(","),s.percent(e,r[0]),2===r.length&&s.alt("positionAlign",r[1],["start",vy,"end","line-left","line-right","auto"]);break;case"size":s.percent(e,t);break;case"align":s.alt(e,t,["start",vy,"end","left","right"])}}),/:/,/\s/),t.region=s.get("region",null),t.vertical=s.get("vertical","");let r=s.get("line","auto");"auto"===r&&-1===by.line&&(r=-1),t.line=r,t.lineAlign=s.get("lineAlign","start"),t.snapToLines=s.get("snapToLines",!0),t.size=s.get("size",100),t.align=s.get("align",vy);let o=s.get("position","auto");"auto"===o&&50===by.position&&(o="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=o}(e,t)}function wy(e){return e.replace(//gi,"\n")}class Sy{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new my,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;function i(){let e=t.buffer,i=0;for(e=wy(e);i>>0).toString()};function Ly(e,t,i){return ky(e.toString())+ky(t.toString())+ky(i)}function Cy(e,t,i,s,r,o,a){const n=new Sy,l=Cu(new Uint8Array(e)).trim().replace(Ey,"\n").split("\n"),d=[],h=t?function(e,t=1){return _g(e,9e4,1/t)}(t.baseTime,t.timescale):0;let c,u="00:00.000",p=0,f=0,m=!0;n.oncue=function(e){const o=i[s];let a=i.ccOffset;const n=(p-h)/9e4;if(null!=o&&o.new&&(void 0!==f?a=i.ccOffset=o.start:function(e,t,i){let s=e[t],r=e[s.prevCC];if(!r||!r.new&&s.new)return e.ccOffset=e.presentationOffset=s.start,void(s.new=!1);for(;null!=(o=r)&&o.new;){var o;e.ccOffset+=s.start-r.start,s.new=!1,s=r,r=e[s.prevCC]}e.presentationOffset=i}(i,s,n)),n){if(!t)return void(c=new Error("Missing initPTS for VTT MPEGTS"));a=n-i.presentationOffset}const l=e.endTime-e.startTime,u=Lg(9e4*(e.startTime+a-f),9e4*r)/9e4;e.startTime=Math.max(u,0),e.endTime=Math.max(u+l,0);const m=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(m)),e.id||(e.id=Ly(e.startTime,e.endTime,m)),e.endTime>0&&d.push(e)},n.onparsingerror=function(e){c=e},n.onflush=function(){c?a(c):o(d)},l.forEach((e=>{if(m){if(Ty(e,"X-TIMESTAMP-MAP=")){m=!1,e.slice(16).split(",").forEach((e=>{Ty(e,"LOCAL:")?u=e.slice(6):Ty(e,"MPEGTS:")&&(p=parseInt(e.slice(7)))}));try{f=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),s=parseInt(e.slice(-9,-7)),r=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!(Cc(t)&&Cc(i)&&Cc(s)&&Cc(r)))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=6e4*s,t+=36e5*r,t}(u)/1e3}catch(e){c=e}return}""===e&&(m=!1)}n.parse(e+"\n")})),n.flush()}const xy="stpp.ttml.im1t",Dy=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Ry=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Py={left:"start",center:"center",right:"end",start:"start",end:"end"};function Iy(e,t,i,s){const r=Gu(new Uint8Array(e),["mdat"]);if(0===r.length)return void s(new Error("Could not parse IMSC1 mdat"));const o=r.map((e=>Cu(e))),a=function(e,t,i=1,s=!1){return _g(e,t,1/i,s)}(t.baseTime,1,t.timescale);try{o.forEach((e=>i(function(e,t){const i=new DOMParser,s=i.parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!s)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(r).reduce(((e,t)=>(e[t]=s.getAttribute(`ttp:${t}`)||r[t],e)),{}),a="preserve"!==s.getAttribute("xml:space"),n=My(By(s,"styling","style")),l=My(By(s,"layout","region")),d=By(s,"body","[begin]");return[].map.call(d,(e=>{const i=Fy(e,a);if(!i||!e.hasAttribute("begin"))return null;const s=Ny(e.getAttribute("begin"),o),r=Ny(e.getAttribute("dur"),o);let d=Ny(e.getAttribute("end"),o);if(null===s)throw Oy(e);if(null===d){if(null===r)throw Oy(e);d=s+r}const h=new fy(s-t,d-t,i);h.id=Ly(h.startTime,h.endTime,h.text);const c=function(e,t,i){const s="http://www.w3.org/ns/ttml#styling";let r=null;const o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;a&&i.hasOwnProperty(a)&&(r=i[a]);return o.reduce(((i,o)=>{const a=Uy(t,s,o)||Uy(e,s,o)||Uy(r,s,o);return a&&(i[o]=a),i}),{})}(l[e.getAttribute("region")],n[e.getAttribute("style")],n),{textAlign:u}=c;if(u){const e=Py[u];e&&(h.lineAlign=e),h.align=u}return Lc(h,c),h})).filter((e=>null!==e))}(e,a))))}catch(e){s(e)}}function By(e,t,i){const s=e.getElementsByTagName(t)[0];return s?[].slice.call(s.querySelectorAll(i)):[]}function My(e){return e.reduce(((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e}),{})}function Fy(e,t){return[].slice.call(e.childNodes).reduce(((e,i,s)=>{var r;return"br"===i.nodeName&&s?e+"\n":null!=(r=i.childNodes)&&r.length?Fy(i,t):t?e+i.textContent.trim().replace(/\s+/g," "):e+i.textContent}),"")}function Uy(e,t,i){return e&&e.hasAttributeNS(t,i)?e.getAttributeNS(t,i):null}function Oy(e){return new Error(`Could not parse ttml timestamp ${e}`)}function Ny(e,t){if(!e)return null;let i=gy(e);return null===i&&(Dy.test(e)?i=function(e,t){const i=Dy.exec(e),s=(0|i[4])+(0|i[5])/t.subFrameRate;return 3600*(0|i[1])+60*(0|i[2])+(0|i[3])+s/t.frameRate}(e,t):Ry.test(e)&&(i=function(e,t){const i=Ry.exec(e),s=Number(i[1]);switch(i[2]){case"h":return 3600*s;case"m":return 60*s;case"ms":return 1e3*s;case"f":return s/t.frameRate;case"t":return s/t.tickRate}return s}(e,t))),i}function jy(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles"}function Gy(e,t){return!!e&&e.kind===jy(t)&&zg(t,e)}class Wy{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(Rc.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(Rc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Rc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Rc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Rc.BUFFER_CODECS,this.onBufferCodecs,this),e.on(Rc.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(Rc.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(Rc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Rc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Rc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Rc.BUFFER_CODECS,this.onBufferCodecs,this),e.off(Rc.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&Cc(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&Oc.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter(((t,i)=>this.isLevelAllowed(t)&&i<=e));return this.clientRect=null,Wy.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(e){}return e}isLevelAllowed(e){return!this.restrictedLevels.some((t=>e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height))}static getMaxLevelByMediaSize(e,t,i){if(null==e||!e.length)return-1;let s=e.length-1;const r=Math.max(t,i);for(let t=0;t=r||i.height>=r)&&(o=i,!(a=e[t+1])||o.width!==a.width||o.height!==a.height)){s=t;break}}var o,a;return s}}const zy="[eme]";class $y{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=$y.CDMCleanupPromise?[$y.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=Oc.debug.bind(Oc,zy),this.log=Oc.log.bind(Oc,zy),this.warn=Oc.warn.bind(Oc,zy),this.error=Oc.error.bind(Oc,zy),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(Rc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Rc.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Rc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(Rc.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(Rc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Rc.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Rc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(Rc.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,s=t[e];if(s)return s.licenseUrl;if(e===iu.WIDEVINE&&i)return i;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(e,t,i)=>!!e&&i.indexOf(e)===t,s=t.map((e=>e.audioCodec)).filter(i),r=t.map((e=>e.videoCodec)).filter(i);return s.length+r.length===0&&r.push("avc1.42e01e"),new Promise(((t,i)=>{const o=e=>{const a=e.shift();this.getMediaKeysPromise(a,s,r).then((e=>t({keySystem:a,mediaKeys:e}))).catch((t=>{e.length?o(e):i(t instanceof Vy?t:new Vy({type:Pc.KEY_SYSTEM_ERROR,details:Ic.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))}))};o(e)}))}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if("function"!=typeof i){let e=`Configured requestMediaKeySystemAccess is not a function ${i}`;return null===cu&&"http:"===self.location.protocol&&(e=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(e))}return i(e,t)}getMediaKeysPromise(e,t,i){const s=function(e,t,i,s){let r;switch(e){case iu.FAIRPLAY:r=["cenc","sinf"];break;case iu.WIDEVINE:case iu.PLAYREADY:r=["cenc"];break;case iu.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${e}`)}return function(e,t,i,s){return[{initDataTypes:e,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:t.map((e=>({contentType:`audio/mp4; codecs="${e}"`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null}))),videoCapabilities:i.map((e=>({contentType:`video/mp4; codecs="${e}"`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null})))}]}(r,t,i,s)}(e,t,i,this.config.drmSystemOptions),r=this.keySystemAccessPromises[e];let o=null==r?void 0:r.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(s)}`),o=this.requestMediaKeySystemAccess(e,s);const t=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch((t=>{this.log(`Failed to obtain access to key-system "${e}": ${t}`)})),o.then((i=>{this.log(`Access for key-system "${i.keySystem}" obtained`);const s=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),t.mediaKeys=i.createMediaKeys().then((t=>(this.log(`Media-keys created for "${e}"`),s.then((i=>i?this.setMediaKeysServerCertificate(t,e,i):t))))),t.mediaKeys.catch((t=>{this.error(`Failed to create media-keys for "${e}"}: ${t}`)})),t.mediaKeys}))}return o.then((()=>r.mediaKeys))}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${Ru(e.keyId||[])}`);const s=i.createSession(),r={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:s,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),s=this.getKeyIdString(t),r="cenc";this.keyIdToKeySessionPromise[s]=this.generateRequestWithPreferredKeySession(i,r,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw new Error("keyId is null");return Ru(e.keyId)}updateKeySession(e,t){var i;const s=e.mediaKeysSession;return this.log(`Updating key-session "${s.sessionId}" for keyID ${Ru((null==(i=e.decryptdata)?void 0:i.keyId)||[])}\n } (data length: ${t?t.byteLength:t})`),s.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise(((t,i)=>{const s=hu(this.config),r=e.map(nu).filter((e=>!!e&&-1!==s.indexOf(e)));return this.getKeySystemSelectionPromise(r).then((({keySystem:e})=>{const s=du(e);s?t(s):i(new Error(`Unable to find format for key-system "${e}"`))})).catch(i)}))}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),s=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${s}`);let r=this.keyIdToKeySessionPromise[i];return r||(r=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(t).then((({keySystem:i,mediaKeys:r})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${s}`),this.attemptSetMediaKeys(i,r).then((()=>{this.throwIfDestroyed();const e=this.createMediaKeySessionContext({keySystem:i,mediaKeys:r,decryptdata:t});return this.generateRequestWithPreferredKeySession(e,"cenc",t.pssh,"playlist-key")}))))),r.catch((e=>this.handleError(e)))),r}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Vy?this.hls.trigger(Rc.ERROR,e.data):this.hls.trigger(Rc.ERROR,{type:Pc.KEY_SYSTEM_ERROR,details:Ic.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const t=nu(e.keyFormat),i=t?[t]:hu(this.config);return this.attemptKeySystemAccess(i)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=hu(this.config)),0===e.length)throw new Vy({type:Pc.KEY_SYSTEM_ERROR,details:Ic.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:i}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),null===i)return;let s,r;if("sinf"===t&&this.config.drmSystems[iu.FAIRPLAY]){const e=Mu(new Uint8Array(i));try{const t=Xc(JSON.parse(e).sinf),i=qu(new Uint8Array(t));if(!i)return;s=i.subarray(8,24),r=iu.FAIRPLAY}catch(e){return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{const e=function(e){if(!(e instanceof ArrayBuffer)||e.byteLength<32)return null;const t={version:0,systemId:"",kids:null,data:null},i=new DataView(e),s=i.getUint32(0);if(e.byteLength!==s&&s>44)return null;if(1886614376!==i.getUint32(4))return null;if(t.version=i.getUint32(8)>>>24,t.version>1)return null;t.systemId=Ru(new Uint8Array(e,12,16));const r=i.getUint32(28);if(0===t.version){if(s-32this.generateRequestWithPreferredKeySession(r,t,i,"encrypted-event-key-match")));break}}l||(l=a[o]=this.getKeySystemSelectionPromise([r]).then((({keySystem:e,mediaKeys:r})=>{var a;this.throwIfDestroyed();const n=new sp("ISO-23001-7",o,null!=(a=du(e))?a:"");return n.pssh=new Uint8Array(i),n.keyId=s,this.attemptSetMediaKeys(e,r).then((()=>{this.throwIfDestroyed();const s=this.createMediaKeySessionContext({decryptdata:n,keySystem:e,mediaKeys:r});return this.generateRequestWithPreferredKeySession(s,t,i,"encrypted-event-no-match")}))}))),l.catch((e=>this.handleError(e)))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const s=Promise.all(i).then((()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)}));return this.setMediaKeysQueue.push(s),s.then((()=>{this.log(`Media-keys set for "${e}"`),i.push(s),this.setMediaKeysQueue=this.setMediaKeysQueue.filter((e=>-1===i.indexOf(e)))}))}generateRequestWithPreferredKeySession(e,t,i,s){var r,o;const a=null==(r=this.config.drmSystems)||null==(o=r[e.keySystem])?void 0:o.generateRequest;if(a)try{const s=a.call(this.hls,t,i,e);if(!s)throw new Error("Invalid response from configured generateRequest filter");t=s.initDataType,i=e.decryptdata.pssh=s.initData?new Uint8Array(s.initData):null}catch(e){var n;if(this.warn(e.message),null!=(n=this.hls)&&n.config.debug)throw e}if(null===i)return this.log(`Skipping key-session request for "${s}" (no initData)`),Promise.resolve(e);const l=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${s}": ${l} (init data type: ${t} length: ${i?i.byteLength:null})`);const d=new Ng,h=e._onmessage=t=>{const i=e.mediaKeysSession;if(!i)return void d.emit("error",new Error("invalid state"));const{messageType:s,message:r}=t;this.log(`"${s}" message event for session "${i.sessionId}" message size: ${r.byteLength}`),"license-request"===s||"license-renewal"===s?this.renewLicense(e,r).catch((e=>{this.handleError(e),d.emit("error",e)})):"license-release"===s?e.keySystem===iu.FAIRPLAY&&(this.updateKeySession(e,eu("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${s}"`)},c=e._onkeystatuseschange=t=>{if(!e.mediaKeysSession)return void d.emit("error",new Error("invalid state"));this.onKeyStatusChange(e);const i=e.keyStatus;d.emit("keyStatus",i),"expired"===i&&(this.warn(`${e.keySystem} expired for key ${l}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",h),e.mediaKeysSession.addEventListener("keystatuseschange",c);const u=new Promise(((e,t)=>{d.on("error",t),d.on("keyStatus",(i=>{i.startsWith("usable")?e():"output-restricted"===i?t(new Vy({type:Pc.KEY_SYSTEM_ERROR,details:Ic.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):"internal-error"===i?t(new Vy({type:Pc.KEY_SYSTEM_ERROR,details:Ic.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${i}"`)):"expired"===i?t(new Error("key expired while generating request")):this.warn(`unhandled key status change "${i}"`)}))}));return e.mediaKeysSession.generateRequest(t,i).then((()=>{var t;this.log(`Request generated for key-session "${null==(t=e.mediaKeysSession)?void 0:t.sessionId}" keyId: ${l}`)})).catch((e=>{throw new Vy({type:Pc.KEY_SYSTEM_ERROR,details:Ic.KEY_SYSTEM_NO_SESSION,error:e,fatal:!1},`Error generating key-session request: ${e}`)})).then((()=>u)).catch((t=>{throw d.removeAllListeners(),this.removeSession(e),t})).then((()=>(d.removeAllListeners(),e)))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach(((t,i)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${Ru("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${Ru(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t}))}fetchServerCertificate(e){const t=this.config,i=new(0,t.loader)(t),s=this.getServerCertificateUrl(e);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise(((r,o)=>{const a={responseType:"arraybuffer",url:s},n=t.certLoadPolicy.default,l={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(e,t,i,s)=>{r(e.data)},onError:(t,i,r,n)=>{o(new Vy({type:Pc.KEY_SYSTEM_ERROR,details:Ic.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:Ec({url:a.url,data:void 0},t)},`"${e}" certificate request failed (${s}). Status: ${t.code} (${t.text})`))},onTimeout:(t,i,r)=>{o(new Vy({type:Pc.KEY_SYSTEM_ERROR,details:Ic.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:{url:a.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(e,t,i)=>{o(new Error("aborted"))}};i.load(a,l,d)}))):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise(((s,r)=>{e.setServerCertificate(i).then((r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${null==i?void 0:i.byteLength}) on "${t}"`),s(e)})).catch((e=>{r(new Vy({type:Pc.KEY_SYSTEM_ERROR,details:Ic.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))}))}))}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then((t=>this.updateKeySession(e,new Uint8Array(t)).catch((e=>{throw new Vy({type:Pc.KEY_SYSTEM_ERROR,details:Ic.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:e,fatal:!0},e.message)}))))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const s=(new DOMParser).parseFromString(i,"application/xml"),r=s.querySelectorAll("HttpHeader");if(r.length>0){let t;for(let i=0,s=r.length;i in key message");return eu(atob(l))}setupLicenseXHR(e,t,i,s){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then((()=>{if(!i.decryptdata)throw new Error("Key removed");return r.call(this.hls,e,t,i,s)})).catch((o=>{if(!i.decryptdata)throw o;return e.open("POST",t,!0),r.call(this.hls,e,t,i,s)})).then((i=>{e.readyState||e.open("POST",t,!0);return{xhr:e,licenseChallenge:i||s}})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:s}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise(((s,r)=>{const o=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${o}`);const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return r(new Error("invalid state"));if(4===a.readyState)if(200===a.status){this._requestLicenseFailureCount=0;let t=a.response;this.log(`License received ${t instanceof ArrayBuffer?t.byteLength:t}`);const i=this.config.licenseResponseCallback;if(i)try{t=i.call(this.hls,a,o,e)}catch(e){this.error(e)}s(t)}else{const n=i.errorRetry,l=n?n.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||a.status>=400&&a.status<500)r(new Vy({type:Pc.KEY_SYSTEM_ERROR,details:Ic.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:o,data:void 0,code:a.status,text:a.statusText}},`License Request XHR failed (${o}). Status: ${a.status} (${a.statusText})`));else{const i=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${i} attempts left`),this.requestLicense(e,t).then(s,r)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then((({xhr:t,licenseChallenge:i})=>{e.keySystem==iu.PLAYREADY&&(i=this.unpackPlayReadyKeyMessage(t,i)),t.send(i)}))}))}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},sp.clearKeyUriToKeyIdMap();const i=t.length;$y.CDMCleanupPromise=Promise.all(t.map((e=>this.removeSession(e))).concat(null==e?void 0:e.setMediaKeys(null).catch((e=>{this.log(`Could not clear media keys: ${e}`)})))).then((()=>{i&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)})).catch((e=>{this.log(`Could not close sessions and clear media keys: ${e}`)}))}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(t&&this.config.emeEnabled&&!this.keyFormatPromise){const e=t.reduce(((e,t)=>(-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e)),[]);this.log(`Selecting key-system from session-keys ${e.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(e)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const s=this.mediaKeySessions.indexOf(e);return s>-1&&this.mediaKeySessions.splice(s,1),t.remove().catch((e=>{this.log(`Could not remove session: ${e}`)})).then((()=>t.close())).catch((e=>{this.log(`Could not close session: ${e}`)}))}}}$y.CDMCleanupPromise=void 0;class Vy extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}var Hy,Jy,qy;!function(e){e.MANIFEST="m",e.AUDIO="a",e.VIDEO="v",e.MUXED="av",e.INIT="i",e.CAPTION="c",e.TIMED_TEXT="tt",e.KEY="k",e.OTHER="o"}(Hy||(Hy={})),function(e){e.DASH="d",e.HLS="h",e.SMOOTH="s",e.OTHER="o"}(Jy||(Jy={})),function(e){e.OBJECT="CMCD-Object",e.REQUEST="CMCD-Request",e.SESSION="CMCD-Session",e.STATUS="CMCD-Status"}(qy||(qy={}));const Ky={[qy.OBJECT]:["br","d","ot","tb"],[qy.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[qy.SESSION]:["cid","pr","sf","sid","st","v"],[qy.STATUS]:["bs","rtp"]};class Yy{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map((e=>e instanceof Yy?e:new Yy(e)))),this.value=e,this.params=t}}class Qy{constructor(e){this.description=void 0,this.description=e}}function Xy(e,t,i,s){return new Error(`failed to ${e} "${r=t,Array.isArray(r)?JSON.stringify(r):r instanceof Map?"Map{}":r instanceof Set?"Set{}":"object"==typeof r?JSON.stringify(r):String(r)}" as ${i}`,{cause:s});var r}const Zy="Bare Item";const eA=/[\x00-\x1f\x7f]+/;function tA(e,t,i){return Xy("serialize",e,t,i)}function iA(e){if(!1===ArrayBuffer.isView(e))throw tA(e,"Byte Sequence");return`:${t=e,btoa(String.fromCharCode(...t))}:`;var t}function sA(e){if(function(e){return e<-999999999999999||99999999999999912)throw tA(e,"Decimal");const i=t.toString();return i.includes(".")?i:`${i}.0`}function aA(e){const t=(i=e).description||i.toString().slice(7,-1);var i;if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t))throw tA(t,"Token");return t}function nA(e){switch(typeof e){case"number":if(!Cc(e))throw tA(e,Zy);return Number.isInteger(e)?sA(e):oA(e);case"string":return function(e){if(eA.test(e))throw tA(e,"String");return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}(e);case"symbol":return aA(e);case"boolean":return function(e){if("boolean"!=typeof e)throw tA(e,"Boolean");return e?"?1":"?0"}(e);case"object":if(e instanceof Date)return function(e){return`@${sA(e.getTime()/1e3)}`}(e);if(e instanceof Uint8Array)return iA(e);if(e instanceof Qy)return aA(e);default:throw tA(e,Zy)}}function lA(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw tA(e,"Key");return e}function dA(e){return null==e?"":Object.entries(e).map((([e,t])=>!0===t?`;${lA(e)}`:`;${lA(e)}=${nA(t)}`)).join("")}function hA(e){return e instanceof Yy?`${nA(e.value)}${dA(e.params)}`:nA(e)}function cA(e,t={whitespace:!0}){if("object"!=typeof e)throw tA(e,"Dict");const i=e instanceof Map?e.entries():Object.entries(e),s=null!=t&&t.whitespace?" ":"";return Array.from(i).map((([e,t])=>{t instanceof Yy==!1&&(t=new Yy(t));let i=lA(e);var s;return!0===t.value?i+=dA(t.params):(i+="=",Array.isArray(t.value)?i+=`(${(s=t).value.map(hA).join(" ")})${dA(s.params)}`:i+=hA(t)),i})).join(`,${s}`)}const uA=e=>Math.round(e),pA=e=>100*uA(e/100),fA={br:uA,d:uA,bl:pA,dl:pA,mtp:pA,nor:(e,t)=>(null!=t&&t.baseUrl&&(e=function(e,t){const i=new URL(e),s=new URL(t);if(i.origin!==s.origin)return e;const r=i.pathname.split("/").slice(1),o=s.pathname.split("/").slice(1,-1);for(;r[0]===o[0];)r.shift(),o.shift();for(;o.length;)o.shift(),r.unshift("..");return r.join("/")}(e,t.baseUrl)),encodeURIComponent(e)),rtp:pA,tb:uA};function mA(e,t){const i={};if(null==e||"object"!=typeof e)return i;const s=Object.keys(e).sort(),r=Lc({},fA,null==t?void 0:t.formatters),o=null==t?void 0:t.filter;return s.forEach((s=>{if(null!=o&&o(s))return;let a=e[s];const n=r[s];n&&(a=n(a,t)),"v"===s&&1===a||"pr"==s&&1===a||(e=>"number"==typeof e?Cc(e):null!=e&&""!==e&&!1!==e)(a)&&((e=>"ot"===e||"sf"===e||"st"===e)(s)&&"string"==typeof a&&(a=new Qy(a)),i[s]=a)})),i}function gA(e,t={}){return e?function(e,t){return cA(e,t)}(mA(e,t),Lc({whitespace:!1},t)):""}function yA(e,t,i){return Lc(e,function(e,t={}){if(!e)return{};const i=Object.entries(e),s=Object.entries(Ky).concat(Object.entries((null==t?void 0:t.customHeaderMap)||{})),r=i.reduce(((e,t)=>{var i;const[r,o]=t,a=(null==(i=s.find((e=>e[1].includes(r))))?void 0:i[0])||qy.REQUEST;return null!=e[a]||(e[a]={}),e[a][r]=o,e}),{});return Object.entries(r).reduce(((e,[i,s])=>(e[i]=gA(s,t),e)),{})}(t,i))}const AA=/CMCD=[^&#]+/;function bA(e,t,i){const s=function(e,t={}){if(!e)return"";const i=gA(e,t);return`CMCD=${encodeURIComponent(i)}`}(t,i);if(!s)return e;if(AA.test(e))return e.replace(AA,s);const r=e.includes("?")?"&":"?";return`${e}${r}${s}`}function vA(e,t,i,s){e&&Object.keys(t).forEach((r=>{const o=e.filter((e=>e.groupId===r)).map((e=>{const o=Lc({},e);return o.details=void 0,o.attrs=new Gc(o.attrs),o.url=o.attrs.URI=_A(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",i),o.groupId=o.attrs["GROUP-ID"]=t[r],o.attrs["PATHWAY-ID"]=s,o}));e.push(...o)}))}function _A(e,t,i,s){const{HOST:r,PARAMS:o,[i]:a}=s;let n;t&&(n=null==a?void 0:a[t],n&&(e=n));const l=new self.URL(e);return r&&!n&&(l.host=r),o&&Object.keys(o).sort().forEach((e=>{e&&l.searchParams.set(e,o[e])})),l.href}const wA=/^age:\s*[\d.]+\s*$/im;class SA{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new $c,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then((()=>{if(this.loader===i&&!this.stats.aborted)return r(i,t.url)})).catch((e=>{if(this.loader===i&&!this.stats.aborted)return i.open("GET",t.url,!0),r(i,t.url)})).then((()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)})).catch((e=>{this.callbacks.onError({code:i.status,text:e.message},t,i,s)})):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const s=t.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:o}=i.loadPolicy;if(s)for(const t in s)e.setRequestHeader(t,s[t]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=r&&Cc(r)?r:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const s=t.readyState,r=this.config;if(!i.aborted&&s>=2&&(0===i.loading.first&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),4===s)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const s=t.status,o="text"!==t.responseType;if(s>=200&&s<300&&(o&&t.response||null!==t.responseText)){i.loading.end=Math.max(self.performance.now(),i.loading.first);const r=o?t.response:t.responseText,a="arraybuffer"===t.responseType?r.byteLength:r.length;if(i.loaded=i.total=a,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first),!this.callbacks)return;const n=this.callbacks.onProgress;if(n&&n(i,e,r,t),!this.callbacks)return;const l={url:t.responseURL,data:r,code:s};this.callbacks.onSuccess(l,i,e,t)}else{const o=r.loadPolicy.errorRetry;kf(o,i.retry,!1,{url:e.url,data:void 0,code:s})?this.retry(o):(Oc.error(`${s} while loading ${e.url}`),this.callbacks.onError({code:s,text:t.statusText},e,t,i))}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry;if(kf(e,this.stats.retry,!0))this.retry(e);else{var t;Oc.warn(`timeout while loading ${null==(t=this.context)?void 0:t.url}`);const e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=Ef(e,i.retry),i.retry++,Oc.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${null==t?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&wA.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const EA=/(\d+)-(\d+)\/(\d+)/;class TA{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||kA,this.controller=new self.AbortController,this.stats=new $c}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();const r=function(e,t){const i={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(Lc({},e.headers))};e.rangeEnd&&i.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1));return i}(e,this.controller.signal),o=i.onProgress,a="arraybuffer"===e.responseType,n=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:d}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),t.timeout=l&&Cc(l)?l:d,this.requestTimeout=self.setTimeout((()=>{this.abortInternal(),i.onTimeout(s,e,this.response)}),t.timeout),self.fetch(this.request).then((r=>{this.response=this.loader=r;const n=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=d,this.requestTimeout=self.setTimeout((()=>{this.abortInternal(),i.onTimeout(s,e,this.response)}),d-(n-s.loading.start)),!r.ok){const{status:e,statusText:t}=r;throw new LA(t||"fetch, bad network response",e,r)}return s.loading.first=n,s.total=function(e){const t=e.get("Content-Range");if(t){const e=function(e){const t=EA.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}(t);if(Cc(e))return e}const i=e.get("Content-Length");if(i)return parseInt(i)}(r.headers)||s.total,o&&Cc(t.highWaterMark)?this.loadProgressively(r,s,e,t.highWaterMark,o):a?r.arrayBuffer():"json"===e.responseType?r.json():r.text()})).then((r=>{const a=this.response;if(!a)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);const l=r[n];l&&(s.loaded=s.total=l);const d={url:a.url,data:r,code:a.status};o&&!Cc(t.highWaterMark)&&o(s,e,r,a),i.onSuccess(d,s,e,a)})).catch((t=>{if(self.clearTimeout(this.requestTimeout),s.aborted)return;const r=t&&t.code||0,o=t?t.message:null;i.onError({code:r,text:o},e,t?t.details:null,s)}))}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,s=0,r){const o=new Mm,a=e.body.getReader(),n=()=>a.read().then((a=>{if(a.done)return o.dataLength&&r(t,i,o.flush(),e),Promise.resolve(new ArrayBuffer(0));const l=a.value,d=l.length;return t.loaded+=d,d=s&&r(t,i,o.flush(),e)):r(t,i,l,e),n()})).catch((()=>Promise.reject()));return n()}}function kA(e,t){return new self.Request(e.url,t)}class LA extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const CA=/\s/,xA={newCue(e,t,i,s){const r=[];let o,a,n,l,d;const h=self.VTTCue||self.TextTrackCue;for(let u=0;u=16?l--:l++;const s=wy(d.trim()),p=Ly(t,i,s);null!=e&&null!=(c=e.cues)&&c.getCueById(p)||(a=new h(t,i,s),a.id=p,a.line=u+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*l/32)),r.push(a))}return e&&r.length&&(r.sort(((e,t)=>"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line)),r.forEach((t=>Vp(e,t)))),r}},DA=Ec(Ec({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:SA,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:e,partCurrent:t,hls:i}=this,{autoLevelEnabled:s,media:r}=i;if(!e||!r)return;const o=performance.now(),a=t?t.stats:e.stats,n=t?t.duration:e.duration,l=o-a.loading.start,d=i.minAutoLevel;if(a.aborted||a.loaded&&a.loaded===a.total||e.level<=d)return this.clearTimer(),void(this._nextAutoLevel=-1);if(!s||r.paused||!r.playbackRate||!r.readyState)return;const h=i.mainForwardBufferInfo;if(null===h)return;const c=this.bwEstimator.getEstimateTTFB(),u=Math.abs(r.playbackRate);if(l<=Math.max(c,n/(2*u)*1e3))return;const p=h.len/u,f=a.loading.first?a.loading.first-a.loading.start:-1,m=a.loaded&&f>-1,g=this.getBwEstimate(),y=i.levels,A=y[e.level],b=a.total||Math.max(a.loaded,Math.round(n*A.averageBitrate/8));let v=m?l-f:l;v<1&&m&&(v=Math.min(l,8*a.loaded/g));const _=m?1e3*a.loaded/v:0,w=_?(b-a.loaded)/_:8*b/g+c/1e3;if(w<=p)return;const S=_?8*_:g;let E,T=Number.POSITIVE_INFINITY;for(E=e.level-1;E>d;E--){const e=y[E].maxBitrate;if(T=this.getTimeToLoadFrag(c/1e3,S,n*e,!y[E].details),T=w)return;if(T>10*n)return;i.nextLoadLevel=i.nextAutoLevel=E,m?this.bwEstimator.sample(l-Math.min(c,f),a.loaded):this.bwEstimator.sampleTTFB(l);const k=y[E].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>k&&this.resetEstimator(k),this.clearTimer(),Oc.warn(`[abr] Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} is loading too slowly;\n Time to underbuffer: ${p.toFixed(3)} s\n Estimated load time for current fragment: ${w.toFixed(3)} s\n Estimated load time for down switch fragment: ${T.toFixed(3)} s\n TTFB estimate: ${0|f} ms\n Current BW estimate: ${Cc(g)?0|g:"Unknown"} bps\n New BW estimate: ${0|this.getBwEstimate()} bps\n Switching to level ${E} @ ${0|k} bps`),i.trigger(Rc.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:a})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(Oc.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new jf(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Rc.FRAG_LOADING,this.onFragLoading,this),e.on(Rc.FRAG_LOADED,this.onFragLoaded,this),e.on(Rc.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Rc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Rc.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Rc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Rc.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(Rc.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Rc.FRAG_LOADING,this.onFragLoading,this),e.off(Rc.FRAG_LOADED,this.onFragLoaded,this),e.off(Rc.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Rc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Rc.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Rc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Rc.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(Rc.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){var s;if(!i.bitrateTest)this.fragCurrent=i,this.partCurrent=null!=(s=t.part)?s:null;this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case Ic.BUFFER_ADD_CODEC_ERROR:case Ic.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case Ic.FRAG_LOAD_TIMEOUT:{const e=t.frag,{fragCurrent:i,partCurrent:s}=this;if(e&&i&&e.sn===i.sn&&e.level===i.level){const t=performance.now(),i=s?s.stats:e.stats,r=t-i.loading.start,o=i.loading.first?i.loading.first-i.loading.start:-1;if(i.loaded&&o>-1){const e=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(r-Math.min(e,o),i.loaded)}else this.bwEstimator.sampleTTFB(r)}break}}}getTimeToLoadFrag(e,t,i,s){return e+i/t+(s?this.lastLevelLoadSec:0)}onLevelLoaded(e,t){const i=this.hls.config,{loading:s}=t.stats,r=s.end-s.start;Cc(r)&&(this.lastLevelLoadSec=r/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:i}){const s=i?i.stats:t.stats;if(t.type===Op&&this.bwEstimator.sampleTTFB(s.loading.first-s.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const e=i?i.duration:t.duration,r=this.hls.levels[t.level],o=(r.loaded?r.loaded.bytes:0)+s.loaded,a=(r.loaded?r.loaded.duration:0)+e;r.loaded={bytes:o,duration:a},r.realBitrate=Math.round(8*o/a)}if(t.bitrateTest){const e={stats:s,frag:t,part:i,id:t.type};this.onFragBuffered(Rc.FRAG_BUFFERED,e),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:s}=t,r=null!=s&&s.stats.loaded?s.stats:i.stats;if(r.aborted)return;if(this.ignoreFragment(i))return;const o=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,r.loaded),r.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Op||"initSegment"===e.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),s=this.hls.config.maxStarvationDelay,r=this.findBestLevel(i,t,e,0,s,1,1);if(r>-1)return r;const o=this.hls.firstLevel,a=Math.min(Math.max(o,t),e);return Oc.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${o} clamped to ${a}`),a}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(!(-1===e||t&&i&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return e;const s=t&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){const t=this.hls.levels;if(t.length>Math.max(e,s)&&t[e].loadError<=t[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this,{maxAutoLevel:s,config:r,minAutoLevel:o}=i,a=t?t.duration:e?e.duration:0,n=this.getBwEstimate(),l=this.getStarvationDelay();let d=r.abrBandWidthFactor,h=r.abrBandWidthUpFactor;if(l){const e=this.findBestLevel(n,o,s,l,0,d,h);if(e>=0)return e}let c=a?Math.min(a,r.maxStarvationDelay):r.maxStarvationDelay;if(!l){const e=this.bitrateTestDelay;if(e){c=(a?Math.min(a,r.maxLoadingDelay):r.maxLoadingDelay)-e,Oc.info(`[abr] bitrate test took ${Math.round(1e3*e)}ms, set first fragment max fetchDuration to ${Math.round(1e3*c)} ms`),d=h=1}}const u=this.findBestLevel(n,o,s,l,c,d,h);if(Oc.info(`[abr] ${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${u}`),u>-1)return u;const p=i.levels[o],f=i.levels[i.loadLevel];return(null==p?void 0:p.bitrate)<(null==f?void 0:f.bitrate)?o:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,s=e.mainForwardBufferInfo;return(s?s.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,s,r,o,a){var n;const l=s+r,d=this.lastLoadedFragLevel,h=-1===d?this.hls.firstLevel:d,{fragCurrent:c,partCurrent:u}=this,{levels:p,allAudioTracks:f,loadLevel:m,config:g}=this.hls;if(1===p.length)return 0;const y=p[h],A=!(null==y||null==(n=y.details)||!n.live),b=-1===m||-1===d;let v,_="SDR",w=(null==y?void 0:y.frameRate)||0;const{audioPreference:S,videoPreference:E}=g,T=this.audioTracksByGroup||(this.audioTracksByGroup=function(e){return e.reduce(((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const s=t.channels||"2";return i.channels[s]=(i.channels[s]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}(f));if(b){if(-1!==this.firstSelection)return this.firstSelection;const s=this.codecTiers||(this.codecTiers=function(e,t,i,s){return e.slice(i,s+1).reduce(((e,i)=>{if(!i.codecSet)return e;const s=i.audioGroups;let r=e[i.codecSet];r||(e[i.codecSet]=r={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!s,fragmentError:0}),r.minBitrate=Math.min(r.minBitrate,i.bitrate);const o=Math.min(i.height,i.width);return r.minHeight=Math.min(r.minHeight,o),r.minFramerate=Math.min(r.minFramerate,i.frameRate),r.maxScore=Math.max(r.maxScore,i.score),r.fragmentError+=i.fragmentError,r.videoRanges[i.videoRange]=(r.videoRanges[i.videoRange]||0)+1,s&&s.forEach((e=>{if(!e)return;const i=t.groups[e];i&&(r.hasDefaultAudio=r.hasDefaultAudio||t.hasDefaultAudio?i.hasDefault:i.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(i.channels).forEach((e=>{r.channels[e]=(r.channels[e]||0)+i.channels[e]})))})),e}),{})}(p,T,t,i)),r=function(e,t,i,s,r){const o=Object.keys(e),a=null==s?void 0:s.channels,n=null==s?void 0:s.audioCodec,l=a&&2===parseInt(a);let d=!0,h=!1,c=1/0,u=1/0,p=1/0,f=0,m=[];const{preferHDR:g,allowedVideoRanges:y}=Vf(t,r);for(let t=o.length;t--;){const i=e[o[t]];d=i.channels[2]>0,c=Math.min(c,i.minHeight),u=Math.min(u,i.minFramerate),p=Math.min(p,i.minBitrate);const s=y.filter((e=>i.videoRanges[e]>0));s.length>0&&(h=!0,m=s)}c=Cc(c)?c:0,u=Cc(u)?u:0;const A=Math.max(1080,c),b=Math.max(30,u);p=Cc(p)?p:i,i=Math.max(p,i),h||(t=void 0,m=[]);const v=o.reduce(((t,s)=>{const r=e[s];if(s===t)return t;if(r.minBitrate>i)return Hf(s,`min bitrate of ${r.minBitrate} > current estimate of ${i}`),t;if(!r.hasDefaultAudio)return Hf(s,"no renditions with default or auto-select sound found"),t;if(n&&s.indexOf(n.substring(0,4))%5!=0)return Hf(s,`audio codec preference "${n}" not found`),t;if(a&&!l){if(!r.channels[a])return Hf(s,`no renditions with ${a} channel sound found (channels options: ${Object.keys(r.channels)})`),t}else if((!n||l)&&d&&0===r.channels[2])return Hf(s,"no renditions with stereo sound found"),t;return r.minHeight>A?(Hf(s,`min resolution of ${r.minHeight} > maximum of ${A}`),t):r.minFramerate>b?(Hf(s,`min framerate of ${r.minFramerate} > maximum of ${b}`),t):m.some((e=>r.videoRanges[e]>0))?r.maxScore=gp(t)||r.fragmentError>e[t].fragmentError)?t:(f=r.maxScore,s):(Hf(s,`no variants with VIDEO-RANGE of ${JSON.stringify(m)} found`),t)}),void 0);return{codecSet:v,videoRanges:m,preferHDR:g,minFramerate:u,minBitrate:p}}(s,_,e,S,E),{codecSet:o,videoRanges:a,minFramerate:n,minBitrate:l,preferHDR:d}=r;v=o,_=d?a[a.length-1]:a[0],w=n,e=Math.max(e,l),Oc.log(`[abr] picked start tier ${JSON.stringify(r)}`)}else v=null==y?void 0:y.codecSet,_=null==y?void 0:y.videoRange;const k=u?u.duration:c?c.duration:0,L=this.bwEstimator.getEstimateTTFB()/1e3,C=[];for(let n=i;n>=t;n--){var x;const t=p[n],c=n>h;if(!t)continue;if(g.useMediaCapabilities&&!t.supportedResult&&!t.supportedPromise){const i=navigator.mediaCapabilities;"function"==typeof(null==i?void 0:i.decodingInfo)&&zf(t,T,_,w,e,S)?(t.supportedPromise=$f(t,T,i),t.supportedPromise.then((e=>{if(!this.hls)return;t.supportedResult=e;const i=this.hls.levels,s=i.indexOf(t);e.error?Oc.warn(`[abr] MediaCapabilities decodingInfo error: "${e.error}" for level ${s} ${JSON.stringify(e)}`):e.supported||(Oc.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${s} ${JSON.stringify(e)}`),s>-1&&i.length>1&&(Oc.log(`[abr] Removing unsupported level ${s}`),this.hls.removeLevel(s)))}))):t.supportedResult=Gf}if(v&&t.codecSet!==v||_&&t.videoRange!==_||c&&w>t.frameRate||!c&&w>0&&w=2*k&&0===r?p[n].averageBitrate:p[n].maxBitrate,P=this.getTimeToLoadFrag(L,D,R*E,void 0===f);if(D>=R&&(n===d||0===t.loadError&&0===t.fragmentError)&&(P<=L||!Cc(P)||A&&!this.bitrateTestDelay||P${n} adjustedbw(${Math.round(D)})-bitrate=${Math.round(D-R)} ttfb:${L.toFixed(1)} avgDuration:${E.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${P.toFixed(1)} firstSelection:${b} codecSet:${v} videoRange:${_} hls.loadLevel:${m}`)),b&&(this.firstSelection=n),n}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls,s=Math.min(Math.max(e,i),t);this._nextAutoLevel!==s&&(this.nextAutoLevelKey="",this._nextAutoLevel=s)}},bufferController:class{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=e=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=e=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:e,mediaSource:t}=this;this.log("Media source opened"),e&&(e.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(Rc.MEDIA_ATTACHED,{media:e,mediaSource:t})),t&&t.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:e,_objectUrl:t}=this;e!==t&&Oc.error(`Media element src was set while attaching MediaSource (${t} > ${e})`)},this.hls=e;const t="[buffer-controller]";var i;this.appendSource=(i=hp(e.config.preferManagedMediaSource),"undefined"!=typeof self&&i===self.ManagedMediaSource),this.log=Oc.log.bind(Oc,t),this.warn=Oc.warn.bind(Oc,t),this.error=Oc.error.bind(Oc,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(Rc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Rc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Rc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Rc.BUFFER_RESET,this.onBufferReset,this),e.on(Rc.BUFFER_APPENDING,this.onBufferAppending,this),e.on(Rc.BUFFER_CODECS,this.onBufferCodecs,this),e.on(Rc.BUFFER_EOS,this.onBufferEos,this),e.on(Rc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Rc.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(Rc.FRAG_PARSED,this.onFragParsed,this),e.on(Rc.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(Rc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Rc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Rc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Rc.BUFFER_RESET,this.onBufferReset,this),e.off(Rc.BUFFER_APPENDING,this.onBufferAppending,this),e.off(Rc.BUFFER_CODECS,this.onBufferCodecs,this),e.off(Rc.BUFFER_EOS,this.onBufferEos,this),e.off(Rc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Rc.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(Rc.FRAG_PARSED,this.onFragParsed,this),e.off(Rc.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new Vg(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const i=this.media=t.media,s=hp(this.appendSource);if(i&&s){var r;const e=this.mediaSource=new s;this.log(`created media source: ${null==(r=e.constructor)?void 0:r.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming));const t=this._objectUrl=self.URL.createObjectURL(e);if(this.appendSource)try{i.removeAttribute("src");const s=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||s&&e instanceof s,Jg(i),function(e,t){const i=self.document.createElement("source");i.type="video/mp4",i.src=t,e.appendChild(i)}(i,t),i.load()}catch(e){i.src=t}else i.src=t;i.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:i}=this;if(t){if(this.log("media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){this.warn(`onMediaDetaching: ${e.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),this.mediaSrc===i?(e.removeAttribute("src"),this.appendSource&&Jg(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(Rc.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach((e=>{this.resetBuffer(e)})),this._initSourceBuffer()}resetBuffer(e){const t=this.sourceBuffer[e];try{var i;if(t)this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,null!=(i=this.mediaSource)&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}catch(t){this.warn(`onBufferReset ${e}`,t)}}onBufferCodecs(e,t){const i=this.getSourceBufferTypes().length,s=Object.keys(t);if(s.forEach((e=>{if(i){const i=this.tracks[e];if(i&&"function"==typeof i.buffer.changeType){var s;const{id:r,codec:o,levelCodec:a,container:n,metadata:l}=t[e],d=vp(i.codec,i.levelCodec),h=null==d?void 0:d.replace(Hg,"$1");let c=vp(o,a);const u=null==(s=c)?void 0:s.replace(Hg,"$1");if(c&&h!==u){"audio"===e.slice(0,5)&&(c=bp(c,this.appendSource));const t=`${n};codecs=${c}`;this.appendChangeType(e,t),this.log(`switching codec ${d} to ${c}`),this.tracks[e]={buffer:i.buffer,codec:o,container:n,levelCodec:a,metadata:l,id:r}}}}else this.pendingTracks[e]=t[e]})),i)return;const r=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==r&&(this.log(`${r} bufferCodec event(s) expected ${s.join(",")}`),this.bufferCodecEventsExpected=r),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:i}=this,s={execute:()=>{const s=this.sourceBuffer[e];s&&(this.log(`changing ${e} sourceBuffer type to ${t}`),s.changeType(t)),i.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:t=>{this.warn(`Failed to change ${e} SourceBuffer type`,t)}};i.append(s,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:i,operationQueue:s,tracks:r}=this,{data:o,type:a,frag:n,part:l,chunkMeta:d}=t,h=d.buffering[a],c=self.performance.now();h.start=c;const u=n.stats.buffering,p=l?l.stats.buffering:null;0===u.start&&(u.start=c),p&&0===p.start&&(p.start=c);const f=r.audio;let m=!1;"audio"===a&&"audio/mpeg"===(null==f?void 0:f.container)&&(m=!this.lastMpegAudioChunk||1===d.id||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const g=n.start,y={execute:()=>{if(h.executeStart=self.performance.now(),m){const e=this.sourceBuffer[a];if(e){const t=g-e.timestampOffset;Math.abs(t)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${g} (delta: ${t}) sn: ${n.sn})`),e.timestampOffset=g)}}this.appendExecutor(o,a)},onStart:()=>{},onComplete:()=>{const e=self.performance.now();h.executeEnd=h.end=e,0===u.first&&(u.first=e),p&&0===p.first&&(p.first=e);const{sourceBuffer:t}=this,i={};for(const e in t)i[e]=om.getBuffered(t[e]);this.appendErrors[a]=0,"audio"===a||"video"===a?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(Rc.BUFFER_APPENDED,{type:a,frag:n,part:l,chunkMeta:d,parent:n.type,timeRanges:i})},onError:e=>{const t={type:Pc.MEDIA_ERROR,parent:n.type,details:Ic.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:n,part:l,chunkMeta:d,error:e,err:e,fatal:!1};if(e.code===DOMException.QUOTA_EXCEEDED_ERR)t.details=Ic.BUFFER_FULL_ERROR;else{const e=++this.appendErrors[a];t.details=Ic.BUFFER_APPEND_ERROR,this.warn(`Failed ${e}/${i.config.appendErrorMaxRetry} times to append segment in "${a}" sourceBuffer`),e>=i.config.appendErrorMaxRetry&&(t.fatal=!0)}i.trigger(Rc.ERROR,t)}};s.append(y,a,!!this.pendingTracks[a])}onBufferFlushing(e,t){const{operationQueue:i}=this,s=e=>({execute:this.removeExecutor.bind(this,e,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(Rc.BUFFER_FLUSHED,{type:e})},onError:t=>{this.warn(`Failed to remove from ${e} SourceBuffer`,t)}});t.type?i.append(s(t.type),t.type):this.getSourceBufferTypes().forEach((e=>{i.append(s(e),e)}))}onFragParsed(e,t){const{frag:i,part:s}=t,r=[],o=s?s.elementaryStreams:i.elementaryStreams;o[Jc]?r.push("audiovideo"):(o[Vc]&&r.push("audio"),o[Hc]&&r.push("video"));0===r.length&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers((()=>{const e=self.performance.now();i.stats.buffering.end=e,s&&(s.stats.buffering.end=e);const t=s?s.stats:i.stats;this.hls.trigger(Rc.FRAG_BUFFERED,{frag:i,part:s,stats:t,id:i.type})}),r)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce(((e,i)=>{const s=this.sourceBuffer[i];return!s||t.type&&t.type!==i||(s.ending=!0,s.ended||(s.ended=!0,this.log(`${i} sourceBuffer now EOS`))),e&&!(s&&!s.ended)}),!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers((()=>{this.getSourceBufferTypes().forEach((e=>{const t=this.sourceBuffer[e];t&&(t.ending=!1)}));const{mediaSource:e}=this;e&&"open"===e.readyState?(this.log("Calling mediaSource.endOfStream()"),e.endOfStream()):e&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${e.readyState}`)})))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||null===t)return;if(!this.getSourceBufferTypes().length)return;const s=e.config,r=i.currentTime,o=t.levelTargetDuration,a=t.live&&null!==s.liveBackBufferLength?s.liveBackBufferLength:s.backBufferLength;if(Cc(a)&&a>0){const e=Math.max(a,o),t=Math.floor(r/o)*o-e;this.flushBackBuffer(r,o,t)}if(Cc(s.frontBufferFlushThreshold)&&s.frontBufferFlushThreshold>0){const e=Math.max(s.maxBufferLength,s.frontBufferFlushThreshold),t=Math.max(e,o),i=Math.floor(r/o)*o+t;this.flushFrontBuffer(r,o,i)}}flushBackBuffer(e,t,i){const{details:s,sourceBuffer:r}=this;this.getSourceBufferTypes().forEach((o=>{const a=r[o];if(a){const r=om.getBuffered(a);if(r.length>0&&i>r.start(0)){if(this.hls.trigger(Rc.BACK_BUFFER_REACHED,{bufferEnd:i}),null!=s&&s.live)this.hls.trigger(Rc.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(a.ended&&r.end(r.length-1)-e<2*t)return void this.log(`Cannot flush ${o} back buffer while SourceBuffer is in ended state`);this.hls.trigger(Rc.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:o})}}}))}flushFrontBuffer(e,t,i){const{sourceBuffer:s}=this;this.getSourceBufferTypes().forEach((r=>{const o=s[r];if(o){const s=om.getBuffered(o),a=s.length;if(a<2)return;const n=s.start(a-1),l=s.end(a-1);if(i>n||e>=n&&e<=l)return;if(o.ended&&e-l<2*t)return void this.log(`Cannot flush ${r} front buffer while SourceBuffer is in ended state`);this.hls.trigger(Rc.BUFFER_FLUSHING,{startOffset:n,endOffset:1/0,type:r})}}))}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||"open"!==this.mediaSource.readyState)return;const{details:e,hls:t,media:i,mediaSource:s}=this,r=e.fragments[0].start+e.totalduration,o=i.duration,a=Cc(s.duration)?s.duration:0;e.live&&t.config.liveDurationInfinity?(s.duration=1/0,this.updateSeekableRange(e)):(r>a&&r>o||!Cc(o))&&(this.log(`Updating Media Source duration to ${r.toFixed(3)}`),s.duration=r)}updateSeekableRange(e){const t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&null!=t&&t.setLiveSeekableRange){const s=Math.max(0,i[0].start),r=Math.max(s,s+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${s}-${r}.`),t.setLiveSeekableRange(s,r)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:i}=this,s=Object.keys(i).length;if(s&&(!e||2===s||"audiovideo"in i)){this.createSourceBuffers(i),this.pendingTracks={};const e=this.getSourceBufferTypes();if(e.length)this.hls.trigger(Rc.BUFFER_CREATED,{tracks:this.tracks}),e.forEach((e=>{t.executeNext(e)}));else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(Rc.ERROR,{type:Pc.MEDIA_ERROR,details:Ic.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(const r in e)if(!t[r]){var s;const o=e[r];if(!o)throw Error(`source buffer exists for track ${r}, however track does not`);let a=-1===(null==(s=o.levelCodec)?void 0:s.indexOf(","))?o.levelCodec:o.codec;a&&"audio"===r.slice(0,5)&&(a=bp(a,this.appendSource));const n=`${o.container};codecs=${a}`;this.log(`creating sourceBuffer(${n})`);try{const e=t[r]=i.addSourceBuffer(n),s=r;this.addBufferListener(s,"updatestart",this._onSBUpdateStart),this.addBufferListener(s,"updateend",this._onSBUpdateEnd),this.addBufferListener(s,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(s,"bufferedchange",((e,t)=>{const i=t.removedRanges;null!=i&&i.length&&this.hls.trigger(Rc.BUFFER_FLUSHED,{type:r})})),this.tracks[r]={buffer:e,codec:a,container:o.container,levelCodec:o.levelCodec,metadata:o.metadata,id:o.id}}catch(e){this.error(`error while trying to add sourceBuffer: ${e.message}`),this.hls.trigger(Rc.ERROR,{type:Pc.MEDIA_ERROR,details:Ic.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:r,mimeType:n})}}}get mediaSrc(){var e;const t=(null==(e=this.media)?void 0:e.firstChild)||this.media;return null==t?void 0:t.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if("closed"===(null==(t=this.mediaSource)?void 0:t.readyState))return void this.resetBuffer(e);const{operationQueue:i}=this;i.current(e).onComplete(),i.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var i;const s=new Error(`${e} SourceBuffer error. MediaSource readyState: ${null==(i=this.mediaSource)?void 0:i.readyState}`);this.error(`${s}`,t),this.hls.trigger(Rc.ERROR,{type:Pc.MEDIA_ERROR,details:Ic.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:s,fatal:!1});const r=this.operationQueue.current(e);r&&r.onError(s)}removeExecutor(e,t,i){const{media:s,mediaSource:r,operationQueue:o,sourceBuffer:a}=this,n=a[e];if(!s||!r||!n)return this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),void o.shiftAndExecuteNext(e);const l=Cc(s.duration)?s.duration:1/0,d=Cc(r.duration)?r.duration:1/0,h=Math.max(0,t),c=Math.min(i,l,d);c>h&&(!n.ending||n.ended)?(n.ended=!1,this.log(`Removing [${h},${c}] from the ${e} SourceBuffer`),n.remove(h,c)):o.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.sourceBuffer[t];if(i)i.ended=!1,i.appendBuffer(e);else if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);const{operationQueue:i}=this,s=t.map((e=>i.appendBlocker(e)));Promise.all(s).then((()=>{e(),t.forEach((e=>{const t=this.sourceBuffer[e];null!=t&&t.updating||i.shiftAndExecuteNext(e)}))}))}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,i){const s=this.sourceBuffer[e];if(!s)return;const r=i.bind(this,e);this.listeners[e].push({event:t,listener:r}),s.addEventListener(t,r)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach((e=>{t.removeEventListener(e.event,e.listener)}))}},capLevelController:Wy,errorController:class{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=Oc.log.bind(Oc,"[info]:"),this.warn=Oc.warn.bind(Oc,"[warning]:"),this.error=Oc.error.bind(Oc,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(Rc.ERROR,this.onError,this),e.on(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Rc.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(Rc.ERROR,this.onError,this),e.off(Rc.ERROR,this.onErrorOut,this),e.off(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Rc.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(null==e?void 0:e.type)===Op?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var i,s;if(t.fatal)return;const r=this.hls,o=t.context;switch(t.details){case Ic.FRAG_LOAD_ERROR:case Ic.FRAG_LOAD_TIMEOUT:case Ic.KEY_LOAD_ERROR:case Ic.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case Ic.FRAG_PARSING_ERROR:if(null!=(i=t.frag)&&i.gap)return void(t.errorAction={action:Rf,flags:Mf});case Ic.FRAG_GAP:case Ic.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=Pf);case Ic.LEVEL_EMPTY_ERROR:case Ic.LEVEL_PARSING_ERROR:{var a,n;const e=t.parent===Op?t.level:r.loadLevel;t.details===Ic.LEVEL_EMPTY_ERROR&&null!=(a=t.context)&&null!=(n=a.levelDetails)&&n.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,e):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e))}return;case Ic.LEVEL_LOAD_ERROR:case Ic.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==o?void 0:o.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level)));case Ic.AUDIO_TRACK_LOAD_ERROR:case Ic.AUDIO_TRACK_LOAD_TIMEOUT:case Ic.SUBTITLE_LOAD_ERROR:case Ic.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){const e=r.levels[r.loadLevel];if(e&&(o.type===Fp&&e.hasAudioGroup(o.groupId)||o.type===Up&&e.hasSubtitleGroup(o.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=Pf,void(t.errorAction.flags=Ff)}return;case Ic.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const e=r.levels[r.loadLevel],i=null==e?void 0:e.attrs["HDCP-LEVEL"];i?t.errorAction={action:Pf,flags:Uf,hdcpLevel:i}:this.keySystemError(t)}return;case Ic.BUFFER_ADD_CODEC_ERROR:case Ic.REMUX_ALLOC_ERROR:case Ic.BUFFER_APPEND_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,null!=(s=t.level)?s:r.loadLevel));case Ic.INTERNAL_EXCEPTION:case Ic.BUFFER_APPENDING_ERROR:case Ic.BUFFER_FULL_ERROR:case Ic.LEVEL_SWITCH_ERROR:case Ic.BUFFER_STALLED_ERROR:case Ic.BUFFER_SEEK_OVER_HOLE:case Ic.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:Rf,flags:Mf})}t.type===Pc.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const i=Sf(this.hls.config.playlistLoadPolicy,e),s=this.playlistError++;if(kf(i,s,wf(e),e.response))return{action:Bf,flags:Mf,retryConfig:i,retryCount:s};const r=this.getLevelSwitchAction(e,t);return i&&(r.retryConfig=i,r.retryCount=s),r}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),s=t.levels[i],{fragLoadPolicy:r,keyLoadPolicy:o}=t.config,a=Sf(e.details.startsWith("key")?o:r,e),n=t.levels.reduce(((e,t)=>e+t.fragmentError),0);if(s){e.details!==Ic.FRAG_GAP&&s.fragmentError++;if(kf(a,n,wf(e),e.response))return{action:Bf,flags:Mf,retryConfig:a,retryCount:n}}const l=this.getLevelSwitchAction(e,i);return a&&(l.retryConfig=a,l.retryCount=n),l}getLevelSwitchAction(e,t){const i=this.hls;null==t&&(t=i.loadLevel);const s=this.hls.levels[t];if(s){var r,o;const t=e.details;s.loadError++,t===Ic.BUFFER_APPEND_ERROR&&s.fragmentError++;let l=-1;const{levels:d,loadLevel:h,minAutoLevel:c,maxAutoLevel:u}=i;i.autoLevelEnabled||(i.loadLevel=-1);const p=null==(r=e.frag)?void 0:r.type,f=(p===Np&&t===Ic.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(t===Ic.BUFFER_ADD_CODEC_ERROR||t===Ic.BUFFER_APPEND_ERROR))&&d.some((({audioCodec:e})=>s.audioCodec!==e)),m="video"===e.sourceBufferName&&(t===Ic.BUFFER_ADD_CODEC_ERROR||t===Ic.BUFFER_APPEND_ERROR)&&d.some((({codecSet:e,audioCodec:t})=>s.codecSet!==e&&s.audioCodec===t)),{type:g,groupId:y}=null!=(o=e.context)?o:{};for(let i=d.length;i--;){const r=(i+h)%d.length;if(r!==h&&r>=c&&r<=u&&0===d[r].loadError){var a,n;const i=d[r];if(t===Ic.FRAG_GAP&&p===Op&&e.frag){const t=d[r].details;if(t){const i=Cf(e.frag,t.fragments,e.frag.start);if(null!=i&&i.gap)continue}}else{if(g===Fp&&i.hasAudioGroup(y)||g===Up&&i.hasSubtitleGroup(y))continue;if(p===Np&&null!=(a=s.audioGroups)&&a.some((e=>i.hasAudioGroup(e)))||p===jp&&null!=(n=s.subtitleGroups)&&n.some((e=>i.hasSubtitleGroup(e)))||f&&s.audioCodec===i.audioCodec||!f&&s.audioCodec!==i.audioCodec||m&&s.codecSet===i.codecSet)continue}l=r;break}}if(l>-1&&i.loadLevel!==l)return e.levelRetry=!0,this.playlistError=0,{action:Pf,flags:Mf,nextAutoLevel:l}}return{action:Pf,flags:Ff}}onErrorOut(e,t){var i;switch(null==(i=t.errorAction)?void 0:i.action){case Rf:break;case Pf:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===Ic.FRAG_GAP?/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError()):t.fatal=!0}t.fatal&&this.hls.stopLoad()}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:s,hdcpLevel:r,nextAutoLevel:o}=i;switch(s){case Mf:this.switchLevel(e,o);break;case Uf:r&&(t.maxHdcpLevel=of[of.indexOf(r)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`)}i.resolved||this.switchLevel(e,o)}switchLevel(e,t){void 0!==t&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}},fpsController:class{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(Rc.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(Rc.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const e=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=e,e&&"function"==typeof e.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,i){const s=performance.now();if(t){if(this.lastTime){const e=s-this.lastTime,r=i-this.lastDroppedFrames,o=t-this.lastDecodedFrames,a=1e3*r/e,n=this.hls;if(n.trigger(Rc.FPS_DROP,{currentDropped:r,currentDecoded:o,totalDroppedFrames:i}),a>0&&r>n.config.fpsDroppedMonitoringThreshold*o){let e=n.currentLevel;Oc.warn("drop FPS ratio greater than max allowed value for currentLevel: "+e),e>0&&(-1===n.autoLevelCapping||n.autoLevelCapping>=e)&&(e-=1,n.trigger(Rc.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:n.currentLevel}),n.autoLevelCapping=e,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}},stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:cu,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:xA,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:class extends Bm{constructor(e,t,i){super(e,t,i,"[subtitle-stream-controller]",jp),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(Rc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Rc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Rc.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Rc.ERROR,this.onError,this),e.on(Rc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(Rc.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(Rc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(Rc.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(Rc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(Rc.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(Rc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Rc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Rc.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Rc.ERROR,this.onError,this),e.off(Rc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(Rc.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(Rc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(Rc.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(Rc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(Rc.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=Sm,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:s}=t;if(this.fragPrevious=i,this.state=Sm,!s)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let o;const a=i.start;for(let e=0;e=r[e].start&&a<=r[e].end){o=r[e];break}const n=i.start+i.duration;o?o.end=n:(o={start:a,end:n},r.push(o)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null)}onBufferFlushing(e,t){const{startOffset:i,endOffset:s}=t;if(0===i&&s!==Number.POSITIVE_INFINITY){const e=s-1;if(e<=0)return;t.endOffsetSubtitles=Math.max(0,e),this.tracksBuffered.forEach((t=>{for(let i=0;inew uf(e))):(this.tracksBuffered=[],this.levels=t.map((e=>{const t=new uf(e);return this.tracksBuffered[t.id]=[],t})),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,jp),this.fragPrevious=null,this.mediaBuffer=null)}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,null==(i=this.levels)||!i.length||-1===this.currentTrackId)return void this.clearInterval();const s=this.levels[this.currentTrackId];null!=s&&s.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,s&&this.setInterval(500)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:s,levels:r}=this,{details:o,id:a}=t;if(!r)return void this.warn(`Subtitle tracks were reset while loading level ${a}`);const n=r[a];if(a>=r.length||!n)return;this.log(`Subtitle track ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""},duration:${o.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(o.live||null!=(i=n.details)&&i.live){const e=this.mainDetails;if(o.deltaUpdateFailed||!e)return;const t=e.fragments[0];var d;if(n.details)l=this.alignPlaylists(o,n.details,null==(d=this.levelLastLoaded)?void 0:d.details),0===l&&t&&(l=t.start,Af(o,l));else o.hasProgramDateTime&&e.hasProgramDateTime?(cm(o,e),l=o.fragments[0].start):t&&(l=t.start,Af(o,l))}if(n.details=o,this.levelLastLoaded=n,a===s&&(this.startFragRequested||!this.mainDetails&&o.live||this.setStartPosition(this.mainDetails||o,l),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===Sm)){Cf(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),n.details=void 0)}}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,s=t.decryptdata,r=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&null!=s&&s.key&&s.iv&&"AES-128"===s.method){const e=performance.now();this.decrypter.decrypt(new Uint8Array(i),s.key.buffer,s.iv.buffer).catch((e=>{throw r.trigger(Rc.ERROR,{type:Pc.MEDIA_ERROR,details:Ic.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e})).then((i=>{const s=performance.now();r.trigger(Rc.FRAG_DECRYPTED,{frag:t,payload:i,stats:{tstart:e,tdecrypt:s}})})).catch((e=>{this.warn(`${e.name}: ${e.message}`),this.state=Sm}))}}doTick(){if(this.media){if(this.state===Sm){const{currentTrackId:e,levels:t}=this,i=null==t?void 0:t[e];if(!i||!t.length||!i.details)return;const{config:s}=this,r=this.getLoadPosition(),o=om.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,s.maxBufferHole),{end:a,len:n}=o,l=this.getFwdBufferInfo(this.media,Op),d=i.details;if(n>this.getMaxBufferLength(null==l?void 0:l.len)+d.levelTargetDuration)return;const h=d.fragments,c=h.length,u=d.edge;let p=null;const f=this.fragPrevious;if(au-e?0:e;p=Cf(f,h,Math.max(h[0].start,a),t),!p&&f&&f.startthis.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let e=null;const t=qp(this.media.textTracks);for(let i=0;i-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(Rc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Rc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Rc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Rc.LEVEL_LOADING,this.onLevelLoading,this),e.on(Rc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Rc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(Rc.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(Rc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Rc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Rc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Rc.LEVEL_LOADING,this.onLevelLoading,this),e.off(Rc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Rc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(Rc.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);qp(this.media.textTracks).forEach((e=>{Hp(e)})),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:s,details:r}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==s)return void this.warn(`Subtitle track with id:${i} and group:${s} not found in active group ${null==o?void 0:o.groupId}`);const a=o.details;o.details=t.details,this.log(`Subtitle track ${i} "${o.name}" lang:${o.lang} group:${s} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,s=this.groupIds;let r=this.currentTrack;if(!i||(null==s?void 0:s.length)!==(null==i?void 0:i.length)||null!=i&&i.some((e=>-1===(null==s?void 0:s.indexOf(e))))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter((e=>!i||-1!==i.indexOf(e.groupId)));if(e.length)this.selectDefaultTrack&&!e.some((e=>e.default))&&(this.selectDefaultTrack=!1),e.forEach(((e,t)=>{e.id=t}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.subtitlePreference;if(!r&&t){this.selectDefaultTrack=!1;const i=Jf(t,e);if(i>-1)r=e[i];else{const e=Jf(t,this.tracks);r=this.tracks[e]}}let s=this.findTrackId(r);-1===s&&r&&(s=this.findTrackId(null));const o={subtitleTracks:e};this.log(`Updating subtitle tracks, ${e.length} track(s) found in "${null==i?void 0:i.join(",")}" group-id`),this.hls.trigger(Rc.SUBTITLE_TRACKS_UPDATED,o),-1!==s&&-1===this.trackId&&this.setSubtitleTrack(s)}else this.shouldReloadPlaylist(r)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let s=0;s-1){const e=this.tracksInGroup[s];return this.setSubtitleTrack(s),e}if(i)return null;{const i=Jf(e,t);if(i>-1)return t[i]}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const i=t.id,s=t.groupId;let r=t.url;if(e)try{r=e.addDirectives(r)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}this.log(`Loading subtitle playlist for id ${i}`),this.hls.trigger(Rc.SUBTITLE_TRACK_LOADING,{url:r,id:i,groupId:s,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=qp(e.textTracks),i=this.currentTrack;let s;if(i&&(s=t.filter((e=>zg(i,e)))[0],s||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach((e=>{"disabled"!==e.mode&&e!==s&&(e.mode="disabled")})),s){const e=this.subtitleDisplay?"showing":"hidden";s.mode!==e&&(s.mode=e)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media)return void(this.queuedDefaultTrack=e);if(e<-1||e>=t.length||!Cc(e))return void this.warn(`Invalid subtitle track id: ${e}`);this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,s=t[e]||null;if(this.trackId=e,this.currentTrack=s,this.toggleTrackModes(),!s)return void this.hls.trigger(Rc.SUBTITLE_TRACK_SWITCH,{id:e});const r=!!s.details&&!s.details.live;if(e===this.trackId&&s===i&&r)return;this.log(`Switching to subtitle-track ${e}`+(s?` "${s.name}" lang:${s.lang} group:${s.groupId}`:""));const{id:o,groupId:a="",name:n,type:l,url:d}=s;this.hls.trigger(Rc.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:n,type:l,url:d});const h=this.switchParams(s.url,null==i?void 0:i.details,s.details);this.loadPlaylist(h)}},timelineController:class{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(Rc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(Rc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Rc.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Rc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(Rc.FRAG_LOADING,this.onFragLoading,this),e.on(Rc.FRAG_LOADED,this.onFragLoaded,this),e.on(Rc.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(Rc.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(Rc.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(Rc.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(Rc.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(Rc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Rc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Rc.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Rc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(Rc.FRAG_LOADING,this.onFragLoading,this),e.off(Rc.FRAG_LOADED,this.onFragLoaded,this),e.off(Rc.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(Rc.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(Rc.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(Rc.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(Rc.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const e=new py(this,"textTrack1"),t=new py(this,"textTrack2"),i=new py(this,"textTrack3"),s=new py(this,"textTrack4");this.cea608Parser1=new hy(1,e,t),this.cea608Parser2=new hy(3,i,s)}}addCues(e,t,i,s,r){let o=!1;for(let e=r.length;e--;){const s=r[e],h=(a=s[0],n=s[1],l=t,d=i,Math.min(n,d)-Math.max(a,l));if(h>=0&&(s[0]=Math.min(s[0],t),s[1]=Math.max(s[1],i),o=!0,h/(i-t)>.5))return}var a,n,l,d;if(o||r.push([t,i]),this.config.renderTextTracksNatively){const r=this.captionsTracks[e];this.Cues.newCue(r,t,i,s)}else{const r=this.Cues.newCue(null,t,i,s);this.hls.trigger(Rc.CUES_PARSED,{type:"captions",cues:r,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:s,timescale:r}){const{unparsedVttFrags:o}=this;"main"===i&&(this.initPTS[t.cc]={baseTime:s,timescale:r}),o.length&&(this.unparsedVttFrags=[],o.forEach((e=>{this.onFragLoaded(Rc.FRAG_LOADED,e)})))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let s=0;s{Hp(e[t]),delete e[t]})),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let e=0;ee.textCodec===xy));if(this.config.enableWebVTT||s&&this.config.enableIMSC1){if(Gg(this.tracks,i))return void(this.tracks=i);if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const e=this.media,t=e?qp(e.textTracks):null;if(this.tracks.forEach(((e,i)=>{let s;if(t){let i=null;for(let s=0;snull!==e)).map((e=>e.label));e.length&&Oc.warn(`Media element contains unused subtitle tracks: ${e.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const e=this.tracks.map((e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e})));this.hls.trigger(Rc.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach((e=>{const t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;const i=`textTrack${t[1]}`,s=this.captionsProperties[i];s&&(s.label=e.name,e.lang&&(s.languageCode=e.lang),s.media=e)}))}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return null==t?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===Op){var i,s;const{cea608Parser1:e,cea608Parser2:r,lastSn:o}=this,{cc:a,sn:n}=t.frag,l=null!=(i=null==(s=t.part)?void 0:s.index)?i:-1;e&&r&&(n!==o+1||n===o&&l!==this.lastPartIndex+1||a!==this.lastCc)&&(e.reset(),r.reset()),this.lastCc=a,this.lastSn=n,this.lastPartIndex=l}}onFragLoaded(e,t){const{frag:i,payload:s}=t;if(i.type===jp)if(s.byteLength){const e=i.decryptdata,r="stats"in t;if(null==e||!e.encrypted||r){const e=this.tracks[i.level],r=this.vttCCs;r[i.cc]||(r[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),e&&e.textCodec===xy?this._parseIMSC1(i,s):this._parseVTTs(t)}}else this.hls.trigger(Rc.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;Iy(t,this.initPTS[e.cc],(t=>{this._appendCues(t,e.level),i.trigger(Rc.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(t=>{Oc.log(`Failed to parse IMSC1: ${t}`),i.trigger(Rc.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})}))}_parseVTTs(e){var t;const{frag:i,payload:s}=e,{initPTS:r,unparsedVttFrags:o}=this,a=r.length-1;if(!r[i.cc]&&-1===a)return void o.push(e);const n=this.hls;Cy(null!=(t=i.initSegment)&&t.data?Yu(i.initSegment.data,new Uint8Array(s)):s,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,(e=>{this._appendCues(e,i.level),n.trigger(Rc.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})}),(t=>{const r="Missing initPTS for VTT MPEGTS"===t.message;r?o.push(e):this._fallbackToIMSC1(i,s),Oc.log(`Failed to parse VTT cue: ${t}`),r&&a>i.cc||n.trigger(Rc.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:t})}))}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Iy(t,this.initPTS[e.cc],(()=>{i.textCodec=xy,this._parseIMSC1(e,t)}),(()=>{i.textCodec="wvtt"}))}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||"disabled"===i.mode)return;e.forEach((e=>Vp(i,e)))}else{const s=this.tracks[t];if(!s)return;const r=s.default?"default":"subtitles"+t;i.trigger(Rc.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===jp&&this.onFragLoaded(Rc.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:s}=this;if(!this.enabled||!i||!s)return;const{frag:r,samples:o}=t;if(r.type!==Op||"NONE"!==this.closedCaptionsForLevel(r))for(let e=0;eJp(e[s],t,i)))}if(this.config.renderTextTracksNatively&&0===t&&void 0!==s){const{textTracks:e}=this;Object.keys(e).forEach((i=>Jp(e[i],t,s)))}}}extractCea608Data(e){const t=[[],[]],i=31&e[0];let s=2;for(let r=0;r0&&-1===e?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=Sm):(this.loadedmetadata=!1,this.state=Lm),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case Sm:this.doTickIdle();break;case Lm:{var e;const{levels:t,trackId:i}=this,s=null==t||null==(e=t[i])?void 0:e.details;if(s){if(this.waitForCdnTuneIn(s))break;this.state=Pm}break}case km:{var t;const e=performance.now(),i=this.retryDate;if(!i||e>=i||null!=(t=this.media)&&t.seeking){const{levels:e,trackId:t}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==e?void 0:e[t])||null),this.state=Sm}break}case Pm:{const e=this.waitingData;if(e){const{frag:t,part:i,cache:s,complete:r}=e;if(void 0!==this.initPTS[t.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=Tm;const e={frag:t,part:i,payload:s.flush(),networkDetails:null};this._handleFragmentLoadProgress(e),r&&super._handleFragmentLoadComplete(e)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${t.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const e=this.getLoadPosition(),i=om.bufferInfo(this.mediaBuffer,e,this.config.maxBufferHole);xf(i.end,this.config.maxFragLookUpTolerance,t)<0&&(this.log(`Waiting fragment cc (${t.cc}) @ ${t.start} cancelled because another fragment at ${i.end} is needed`),this.clearWaitingFragment())}}else this.state=Sm}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=Sm)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:i,trackId:s}=this,r=e.config;if(!i&&(this.startFragRequested||!r.startFragPrefetch)||null==t||!t[s])return;const o=t[s],a=o.details;if(!a||a.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(a))return void(this.state=Lm);const n=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&n&&(this.bufferFlushed=!1,this.afterBufferFlushed(n,Vc,Np));const l=this.getFwdBufferInfo(n,Np);if(null===l)return;const{bufferedTrack:d,switchingTrack:h}=this;if(!h&&this._streamEnded(l,a))return e.trigger(Rc.BUFFER_EOS,{type:"audio"}),void(this.state=Dm);const c=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Op),u=l.len,p=this.getMaxBufferLength(null==c?void 0:c.len),f=a.fragments,m=f[0].start;let g=this.flushing?this.getLoadPosition():l.end;if(h&&i){const e=this.getLoadPosition();d&&!Wg(h.attrs,d.attrs)&&(g=e),a.PTSKnown&&em||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=m+.05)}if(u>=p&&!h&&gc.end+a.targetduration;if(b||(null==c||!c.len)&&l.len){const e=this.getAppendedFrag(y.start,Op);if(null===e)return;if(A||(A=!!e.gap||!!b&&0===c.len),b&&!A||A&&l.nextStart&&l.nextStartnew uf(e)))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:s}=this;s&&(s.abortRequests(),this.removeUnbufferedFrags(s.start)),this.resetLoadingState(),i?this.setInterval(100):this.resetTransmuxer(),i?(this.switchingTrack=t,this.state=Sm,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=wm),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,null!==this.cachedTrackLoadedData&&(this.hls.trigger(Rc.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var i;if(null==this.mainDetails)return void(this.cachedTrackLoadedData=t);const{levels:s}=this,{details:r,id:o}=t;if(!s)return void this.warn(`Audio tracks were reset while loading level ${o}`);this.log(`Audio track ${o} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const a=s[o];let n=0;if(r.live||null!=(i=a.details)&&i.live){this.checkLiveUpdate(r);const e=this.mainDetails;if(r.deltaUpdateFailed||!e)return;var l;if(!a.details&&r.hasProgramDateTime&&e.hasProgramDateTime)cm(r,e),n=r.fragments[0].start;else n=this.alignPlaylists(r,a.details,null==(l=this.levelLastLoaded)?void 0:l.details)}a.details=r,this.levelLastLoaded=a,this.startFragRequested||!this.mainDetails&&r.live||this.setStartPosition(this.mainDetails||r,n),this.state!==Lm||this.waitForCdnTuneIn(r)||(this.state=Sm),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:s,payload:r}=e,{config:o,trackId:a,levels:n}=this;if(!n)return void this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);const l=n[a];if(!l)return void this.warn("Audio track is undefined on fragment load progress");const d=l.details;if(!d)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(i.start);const h=o.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let c=this.transmuxer;c||(c=this.transmuxer=new jg(this.hls,Np,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const u=this.initPTS[i.cc],p=null==(t=i.initSegment)?void 0:t.data;if(void 0!==u){const e=!1,t=s?s.index:-1,o=-1!==t,a=new am(i.level,i.sn,i.stats.chunkCount,r.byteLength,t,o);c.push(r,p,h,"",i,s,d.totalduration,e,a,u)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${d.startSN} ,${d.endSN}],track ${a}`);const{cache:e}=this.waitingData=this.waitingData||{frag:i,part:s,cache:new Mm,complete:!1};e.push(new Uint8Array(r)),this.waitingVideoCC=this.videoTrackCC,this.state=Pm}}_handleFragmentLoadComplete(e){this.waitingData?this.waitingData.complete=!0:super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:i,part:s}=t;if(i.type===Np)if(this.fragContextChanged(i))this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);else{if("initSegment"!==i.sn){this.fragPrevious=i;const e=this.switchingTrack;e&&(this.bufferedTrack=e,this.switchingTrack=null,this.hls.trigger(Rc.AUDIO_TRACK_SWITCHED,Ec({},e)))}this.fragBufferedComplete(i,s)}else if(!this.loadedmetadata&&i.type===Op){const e=this.videoBuffer||this.media;if(e){om.getBuffered(e).length&&(this.loadedmetadata=!0)}}}onError(e,t){var i;if(t.fatal)this.state=Rm;else switch(t.details){case Ic.FRAG_GAP:case Ic.FRAG_PARSING_ERROR:case Ic.FRAG_DECRYPT_ERROR:case Ic.FRAG_LOAD_ERROR:case Ic.FRAG_LOAD_TIMEOUT:case Ic.KEY_LOAD_ERROR:case Ic.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Np,t);break;case Ic.AUDIO_TRACK_LOAD_ERROR:case Ic.AUDIO_TRACK_LOAD_TIMEOUT:case Ic.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Lm||(null==(i=t.context)?void 0:i.type)!==Fp||(this.state=Sm);break;case Ic.BUFFER_APPEND_ERROR:case Ic.BUFFER_FULL_ERROR:if(!t.parent||"audio"!==t.parent)return;if(t.details===Ic.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case Ic.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onBufferFlushing(e,{type:t}){t!==Hc&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Hc){this.flushing=!1,this.bufferFlushed=!0,this.state===Dm&&(this.state=Sm);const e=this.mediaBuffer||this.media;e&&(this.afterBufferFlushed(e,t,Np),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:s}=this,{remuxResult:r,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a)return void this.resetWhenMissingContext(o);const{frag:n,part:l,level:d}=a,{details:h}=d,{audio:c,text:u,id3:p,initSegment:f}=r;if(!this.fragContextChanged(n)&&h){if(this.state=Cm,this.switchingTrack&&c&&this.completeAudioSwitch(this.switchingTrack),null!=f&&f.tracks){const e=n.initSegment||n;this._bufferInitSegment(d,f.tracks,e,o),s.trigger(Rc.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:f.tracks})}if(c){const{startPTS:e,endPTS:t,startDTS:i,endDTS:s}=c;l&&(l.elementaryStreams[Vc]={startPTS:e,endPTS:t,startDTS:i,endDTS:s}),n.setElementaryStreamInfo(Vc,e,t,i,s),this.bufferFragmentData(c,n,l,o)}if(null!=p&&null!=(t=p.samples)&&t.length){const e=Lc({id:i,frag:n,details:h},p);s.trigger(Rc.FRAG_PARSING_METADATA,e)}if(u){const e=Lc({id:i,frag:n,details:h},u);s.trigger(Rc.FRAG_PARSING_USERDATA,e)}}else this.fragmentTracker.removeFragment(n)}_bufferInitSegment(e,t,i,s){if(this.state!==Cm)return;t.video&&delete t.video;const r=t.audio;if(!r)return;r.id="audio";const o=e.audioCodec;this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${o}/${r.codec}]`),o&&1===o.split(",").length&&(r.levelCodec=o),this.hls.trigger(Rc.BUFFER_CODECS,t);const a=r.initSegment;if(null!=a&&a.byteLength){const e={type:"audio",frag:i,part:null,chunkMeta:s,parent:i.type,data:a};this.hls.trigger(Rc.BUFFER_APPENDING,e)}this.tickImmediate()}loadFragment(e,t,i){const s=this.fragmentTracker.getState(e);var r;if(this.fragCurrent=e,this.switchingTrack||s===Qf||s===Zf)if("initSegment"===e.sn)this._loadInitSegment(e,t);else if(null!=(r=t.details)&&r.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=Pm;const i=this.mainDetails;i&&i.fragments[0].start!==t.details.fragments[0].start&&cm(t.details,i)}else this.startFragRequested=!0,super.loadFragment(e,t,i);else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:i}=this,s=null==i?void 0:i.attrs,r=e.attrs;t&&s&&(s.CHANNELS!==r.CHANNELS||i.name!==e.name||i.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(Rc.AUDIO_TRACK_SWITCHED,Ec({},e))}},audioTrackController:class extends Of{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Rc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Rc.LEVEL_LOADING,this.onLevelLoading,this),e.on(Rc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Rc.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(Rc.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Rc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Rc.LEVEL_LOADING,this.onLevelLoading,this),e.off(Rc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Rc.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(Rc.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:s,details:r}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==s)return void this.warn(`Audio track with id:${i} and group:${s} not found in active group ${null==o?void 0:o.groupId}`);const a=o.details;o.details=t.details,this.log(`Audio track ${i} "${o.name}" lang:${o.lang} group:${s} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,s=this.groupIds;let r=this.currentTrack;if(!i||(null==s?void 0:s.length)!==(null==i?void 0:i.length)||null!=i&&i.some((e=>-1===(null==s?void 0:s.indexOf(e))))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter((e=>!i||-1!==i.indexOf(e.groupId)));if(e.length)this.selectDefaultTrack&&!e.some((e=>e.default))&&(this.selectDefaultTrack=!1),e.forEach(((e,t)=>{e.id=t}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.audioPreference;if(!r&&t){const i=Jf(t,e,Kf);if(i>-1)r=e[i];else{const e=Jf(t,this.tracks);r=this.tracks[e]}}let s=this.findTrackId(r);-1===s&&r&&(s=this.findTrackId(null));const a={audioTracks:e};this.log(`Updating audio tracks, ${e.length} track(s) found in group(s): ${null==i?void 0:i.join(",")}`),this.hls.trigger(Rc.AUDIO_TRACKS_UPDATED,a);const n=this.trackId;if(-1!==s&&-1===n)this.setAudioTrack(s);else if(e.length&&-1===n){var o;const t=new Error(`No audio track selected for current audio group-ID(s): ${null==(o=this.groupIds)?void 0:o.join(",")} track count: ${e.length}`);this.warn(t.message),this.hls.trigger(Rc.ERROR,{type:Pc.MEDIA_ERROR,details:Ic.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:t})}}else this.shouldReloadPlaylist(r)&&this.setAudioTrack(this.trackId)}onError(e,t){!t.fatal&&t.context&&(t.context.type!==Fp||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||(this.requestScheduled=-1,this.checkRetry(t)))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const s=this.currentTrack;if(s&&qf(e,s,Kf))return s;const r=Jf(e,this.tracksInGroup,Kf);if(r>-1){const e=this.tracksInGroup[r];return this.setAudioTrack(r),e}if(s){let s=t.loadLevel;-1===s&&(s=t.firstAutoLevel);const r=function(e,t,i,s,r){const o=t[s],a=t.reduce(((e,t,i)=>{const s=t.uri;return(e[s]||(e[s]=[])).push(i),e}),{})[o.uri];a.length>1&&(s=Math.max.apply(Math,a));const n=o.videoRange,l=o.frameRate,d=o.codecSet.substring(0,4),h=Yf(t,s,(t=>{if(t.videoRange!==n||t.frameRate!==l||t.codecSet.substring(0,4)!==d)return!1;const s=t.audioGroups,o=i.filter((e=>!s||-1!==s.indexOf(e.groupId)));return Jf(e,o,r)>-1}));return h>-1?h:Yf(t,s,(t=>{const s=t.audioGroups,o=i.filter((e=>!s||-1!==s.indexOf(e.groupId)));return Jf(e,o,r)>-1}))}(e,t.levels,i,s,Kf);if(-1===r)return null;t.nextLoadLevel=r}if(e.channels||e.audioCodec){const t=Jf(e,i);if(t>-1)return i[t]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length)return void this.warn(`Invalid audio track id: ${e}`);this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,s=t[e],r=s.details&&!s.details.live;if(e===this.trackId&&s===i&&r)return;if(this.log(`Switching to audio-track ${e} "${s.name}" lang:${s.lang} group:${s.groupId} channels:${s.channels}`),this.trackId=e,this.currentTrack=s,this.hls.trigger(Rc.AUDIO_TRACK_SWITCHING,Ec({},s)),r)return;const o=this.switchParams(s.url,null==i?void 0:i.details,s.details);this.loadPlaylist(o)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=e=>{try{this.apply(e,{ot:Hy.MANIFEST,su:!this.initialized})}catch(e){Oc.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=e=>{try{const t=e.frag,i=this.hls.levels[t.level],s=this.getObjectType(t),r={d:1e3*t.duration,ot:s};s!==Hy.VIDEO&&s!==Hy.AUDIO&&s!=Hy.MUXED||(r.br=i.bitrate/1e3,r.tb=this.getTopBandwidth(s)/1e3,r.bl=this.getBufferLength(s)),this.apply(e,r)}catch(e){Oc.warn("Could not generate segment CMCD data.",e)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;null!=i&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||function(){try{return crypto.randomUUID()}catch(e){try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){let t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?i:3&i|8).toString(16)}))}}}(),this.cid=i.contentId,this.useHeaders=!0===i.useHeaders,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(Rc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Rc.MEDIA_DETACHED,this.onMediaDetached,this),e.on(Rc.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(Rc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Rc.MEDIA_DETACHED,this.onMediaDetached,this),e.off(Rc.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,s;this.audioBuffer=null==(i=t.tracks.audio)?void 0:i.buffer,this.videoBuffer=null==(s=t.tracks.video)?void 0:s.buffer}createData(){var e;return{v:1,sf:Jy.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){Lc(t,this.createData());const i=t.ot===Hy.INIT||t.ot===Hy.VIDEO||t.ot===Hy.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering);const{includeKeys:s}=this;s&&(t=Object.keys(t).reduce(((e,i)=>(s.includes(i)&&(e[i]=t[i]),e)),{})),this.useHeaders?(e.headers||(e.headers={}),yA(e.headers,t)):e.url=bA(e.url,t)}getObjectType(e){const{type:t}=e;return"subtitle"===t?Hy.TIMED_TEXT:"initSegment"===e.sn?Hy.INIT:"audio"===t?Hy.AUDIO:"main"===t?this.hls.audioTracks.length?Hy.VIDEO:Hy.MUXED:void 0}getTopBandwidth(e){let t,i=0;const s=this.hls;if(e===Hy.AUDIO)t=s.audioTracks;else{const e=s.maxAutoLevel,i=e>-1?e+1:s.levels.length;t=s.levels.slice(0,i)}for(const e of t)e.bitrate>i&&(i=e.bitrate);return i>0?i:NaN}getBufferLength(e){const t=this.hls.media,i=e===Hy.AUDIO?this.audioBuffer:this.videoBuffer;if(!i||!t)return NaN;return 1e3*om.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,s){t(e),this.loader.load(e,i,s)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,s){t(e),this.loader.load(e,i,s)}}}},contentSteeringController:class{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=Oc.log.bind(Oc,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Rc.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Rc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Rc.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Rc.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Rc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Rc.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter((t=>t!==e)))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;null!==i&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((null==i?void 0:i.action)===Pf&&i.flags===Ff){const e=this.levels;let s=this.pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:i,pathwayId:s,type:o}=t.context;i&&e?r=this.getPathwayForGroupId(i,o,r):s&&(r=s)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!s&&e&&(s=e.reduce(((e,t)=>(-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e)),[])),s&&s.length>1&&(this.updatePathwayPriority(s),i.resolved=this.pathwayId!==r),i.resolved||Oc.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${e?e.length:e} priorities: ${JSON.stringify(s)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return null===this.levels?[]:this.levels.filter((t=>e===t.pathwayId))}updatePathwayPriority(e){let t;this.pathwayPriority=e;const i=this.penalizedPathways,s=performance.now();Object.keys(i).forEach((e=>{s-i[e]>3e5&&delete i[e]}));for(let s=0;s0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,_f(t),this.hls.trigger(Rc.LEVELS_UPDATED,{levels:t});const e=this.hls.levels[o];a&&e&&this.levels&&(e.attrs["STABLE-VARIANT-ID"]!==a.attrs["STABLE-VARIANT-ID"]&&e.bitrate!==a.bitrate&&this.log(`Unstable Pathways change from bitrate ${a.bitrate} to ${e.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,i){const s=this.getLevelsForPathway(i).concat(this.levels||[]);for(let i=0;i{const{ID:r,"BASE-ID":o,"URI-REPLACEMENT":a}=e;if(t.some((e=>e.pathwayId===r)))return;const n=this.getLevelsForPathway(o).map((e=>{const t=new Gc(e.attrs);t["PATHWAY-ID"]=r;const o=t.AUDIO&&`${t.AUDIO}_clone_${r}`,n=t.SUBTITLES&&`${t.SUBTITLES}_clone_${r}`;o&&(i[t.AUDIO]=o,t.AUDIO=o),n&&(s[t.SUBTITLES]=n,t.SUBTITLES=n);const l=_A(e.uri,t["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",a),d=new uf({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:l,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(let t=1;t{this.log(`Loaded steering manifest: "${s}"`);const o=e.data;if(1!==o.VERSION)return void this.log(`Steering VERSION ${o.VERSION} not supported!`);this.updated=performance.now(),this.timeToLoad=o.TTL;const{"RELOAD-URI":a,"PATHWAY-CLONES":n,"PATHWAY-PRIORITY":l}=o;if(a)try{this.uri=new self.URL(a,s).href}catch(e){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest RELOAD-URI: ${a}`)}this.scheduleRefresh(this.uri||i.url),n&&this.clonePathways(n);const d={steeringManifest:o,url:s.toString()};this.hls.trigger(Rc.STEERING_MANIFEST_LOADED,d),l&&this.updatePathwayPriority(l)},onError:(e,t,i,s)=>{if(this.log(`Error loading steering manifest: ${e.code} ${e.text} (${t.url})`),this.stopLoad(),410===e.code)return this.enabled=!1,void this.log(`Steering manifest ${t.url} no longer available`);let r=1e3*this.timeToLoad;if(429!==e.code)this.scheduleRefresh(this.uri||t.url,r);else{const e=this.loader;if("function"==typeof(null==e?void 0:e.getResponseHeader)){const t=e.getResponseHeader("Retry-After");t&&(r=1e3*parseFloat(t))}this.log(`Steering manifest ${t.url} rate limited`)}},onTimeout:(e,t,i)=>{this.log(`Timeout loading steering manifest (${t.url})`),this.scheduleRefresh(this.uri||t.url)}};this.log(`Requesting steering manifest: ${s}`),this.loader.load(r,n,l)}scheduleRefresh(e,t=1e3*this.timeToLoad){this.clearTimeout(),this.reloadTimer=self.setTimeout((()=>{var t;const i=null==(t=this.hls)?void 0:t.media;!i||i.ended?this.scheduleRefresh(e,1e3*this.timeToLoad):this.loadSteeringManifest(e)}),t)}}});function RA(e){return e&&"object"==typeof e?Array.isArray(e)?e.map(RA):Object.keys(e).reduce(((t,i)=>(t[i]=RA(e[i]),t)),{}):e}function PA(e){const t=e.loader;if(t!==TA&&t!==SA)Oc.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1;else{(function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1})()&&(e.loader=TA,e.progressive=!0,e.enableSoftwareAES=!0,Oc.log("[config]: Progressive streaming enabled, using FetchLoader"))}}let IA;class BA extends Of{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Rc.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(Rc.LEVEL_LOADED,this.onLevelLoaded,this),e.on(Rc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(Rc.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Rc.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(Rc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Rc.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Rc.LEVEL_LOADED,this.onLevelLoaded,this),e.off(Rc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(Rc.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Rc.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach((e=>{e.loadError=0,e.fragmentError=0})),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,s=[],r={},o={};let a=!1,n=!1,l=!1;t.levels.forEach((e=>{var t,d;const h=e.attrs;let{audioCodec:c,videoCodec:u}=e;-1!==(null==(t=c)?void 0:t.indexOf("mp4a.40.34"))&&(IA||(IA=/chrome|firefox/i.test(navigator.userAgent)),IA&&(e.audioCodec=c=void 0)),c&&(e.audioCodec=c=bp(c,i)),0===(null==(d=u)?void 0:d.indexOf("avc1"))&&(u=e.videoCodec=function(e){const t=e.split(",");for(let e=0;e2){let s=i.shift()+".";s+=parseInt(i.shift()).toString(16),s+=("000"+parseInt(i.shift()).toString(16)).slice(-4),t[e]=s}}return t.join(",")}(u));const{width:p,height:f,unknownCodecs:m}=e;if(a||(a=!(!p||!f)),n||(n=!!u),l||(l=!!c),null!=m&&m.length||c&&!up(c,"audio",i)||u&&!up(u,"video",i))return;const{CODECS:g,"FRAME-RATE":y,"HDCP-LEVEL":A,"PATHWAY-ID":b,RESOLUTION:v,"VIDEO-RANGE":_}=h,w=`${`${b||"."}-`}${e.bitrate}-${v}-${y}-${g}-${_}-${A}`;if(r[w])if(r[w].uri===e.url||e.attrs["PATHWAY-ID"])r[w].addGroupId("audio",h.AUDIO),r[w].addGroupId("text",h.SUBTITLES);else{const t=o[w]+=1;e.attrs["PATHWAY-ID"]=new Array(t+1).join(".");const i=new uf(e);r[w]=i,s.push(i)}else{const t=new uf(e);r[w]=t,o[w]=1,s.push(t)}})),this.filterAndSortMediaOptions(s,t,a,n,l)}filterAndSortMediaOptions(e,t,i,s,r){let o=[],a=[],n=e;if((i||s)&&r&&(n=n.filter((({videoCodec:e,videoRange:t,width:i,height:s})=>{return(!!e||!(!i||!s))&&(!!(r=t)&&af.indexOf(r)>-1);var r}))),0===n.length)return void Promise.resolve().then((()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const e=new Error("no level with compatible codecs found in manifest");this.hls.trigger(Rc.ERROR,{type:Pc.MEDIA_ERROR,details:Ic.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:e,reason:e.message})}}));if(t.audioTracks){const{preferManagedMediaSource:e}=this.hls.config;o=t.audioTracks.filter((t=>!t.audioCodec||up(t.audioCodec,"audio",e))),MA(o)}t.subtitles&&(a=t.subtitles,MA(a));const l=n.slice(0);n.sort(((e,t)=>{if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return af.indexOf(e.videoRange)-af.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){const i=mp(e.videoCodec),s=mp(t.videoCodec);if(i!==s)return s-i}if(e.uri===t.uri&&e.codecSet!==t.codecSet){const i=gp(e.codecSet),s=gp(t.codecSet);if(i!==s)return s-i}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0}));let d=l[0];if(this.steering&&(n=this.steering.filterParsedLevels(n),n.length!==l.length))for(let e=0;ei&&i===DA.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=e)}break}const c=r&&!s,u={levels:n,audioTracks:o,subtitleTracks:a,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:s,altAudio:!c&&o.some((e=>!!e.url))};this.hls.trigger(Rc.MANIFEST_PARSED,u),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return 0===this._levels.length?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(0===t.length)return;if(e<0||e>=t.length){const i=new Error("invalid level idx"),s=e<0;if(this.hls.trigger(Rc.ERROR,{type:Pc.OTHER_ERROR,details:Ic.LEVEL_SWITCH_ERROR,level:e,fatal:s,error:i,reason:i.message}),s)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,s=this.currentLevel,r=s?s.attrs["PATHWAY-ID"]:void 0,o=t[e],a=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,i===e&&o.details&&s&&r===a)return;this.log(`Switching to level ${e} (${o.height?o.height+"p ":""}${o.videoRange?o.videoRange+" ":""}${o.codecSet?o.codecSet+" ":""}@${o.bitrate})${a?" with Pathway "+a:""} from level ${i}${r?" with Pathway "+r:""}`);const n={level:e,attrs:o.attrs,details:o.details,bitrate:o.bitrate,averageBitrate:o.averageBitrate,maxBitrate:o.maxBitrate,realBitrate:o.realBitrate,width:o.width,height:o.height,codecSet:o.codecSet,audioCodec:o.audioCodec,videoCodec:o.videoCodec,audioGroups:o.audioGroups,subtitleGroups:o.subtitleGroups,loaded:o.loaded,loadError:o.loadError,fragmentError:o.fragmentError,name:o.name,id:o.id,uri:o.uri,url:o.url,urlId:0,audioGroupIds:o.audioGroupIds,textGroupIds:o.textGroupIds};this.hls.trigger(Rc.LEVEL_SWITCHING,n);const l=o.details;if(!l||l.live){const e=this.switchParams(o.uri,null==s?void 0:s.details,l);this.loadPlaylist(e)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(void 0===this._startLevel){const e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){!t.fatal&&t.context&&t.context.type===Mp&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(void 0!==t&&t.type===Op){const e=t.elementaryStreams;if(!Object.keys(e).some((t=>!!e[t])))return;const i=this._levels[t.level];null!=i&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var i;const{level:s,details:r}=t,o=this._levels[s];var a;if(!o)return this.warn(`Invalid level index ${s}`),void(null!=(a=t.deliveryDirectives)&&a.skip&&(r.deltaUpdateFailed=!0));s===this.currentLevelIndex?(0===o.fragmentError&&(o.loadError=0),this.playlistLoaded(s,t,o.details)):null!=(i=t.deliveryDirectives)&&i.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){let s=i.uri;if(e)try{s=e.addDirectives(s)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}const r=i.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${void 0!==(null==e?void 0:e.msn)?" at sn "+e.msn+" part "+e.part:""} with${r?" Pathway "+r:""} ${s}`),this.clearTimer(),this.hls.trigger(Rc.LEVEL_LOADING,{url:s,level:t,pathwayId:i.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const i=this._levels.filter(((t,i)=>i!==e||(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach((e=>e.level=-1))),!1)));_f(i),this._levels=i,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(Rc.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(Rc.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function MA(e){const t={};e.forEach((e=>{const i=e.groupId||"";e.id=t[i]=t[i]||0,t[i]++}))}class FA{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyUriToKeyInfo){const s=this.keyUriToKeyInfo[i].loader;if(s){var t;if(e&&e!==(null==(t=s.context)?void 0:t.frag.type))return;s.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=Ic.KEY_LOAD_ERROR,i,s,r){return new gm({type:Pc.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:i,networkDetails:s})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:s}=e;for(let e=0;e{r.setKeyFormat(e)}));break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then((t=>this.loadInternal(e,t))):this.loadInternal(e)}loadInternal(e,t){var i,s;t&&e.setKeyFormat(t);const r=e.decryptdata;if(!r){const i=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,Ic.KEY_LOAD_ERROR,i))}const o=r.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,Ic.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));let a=this.keyUriToKeyInfo[o];if(null!=(i=a)&&i.decryptdata.key)return r.key=a.decryptdata.key,Promise.resolve({frag:e,keyInfo:a});var n;if(null!=(s=a)&&s.keyLoadPromise)switch(null==(n=a.mediaKeySessionContext)?void 0:n.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return a.keyLoadPromise.then((t=>(r.key=t.keyInfo.decryptdata.key,{frag:e,keyInfo:a})))}switch(a=this.keyUriToKeyInfo[o]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===r.keyFormat?this.loadKeyHTTP(a,e):this.loadKeyEME(a,e);case"AES-128":return this.loadKeyHTTP(a,e);default:return Promise.reject(this.createKeyLoadError(e,Ic.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const t=this.emeController.loadKey(i);if(t)return(e.keyLoadPromise=t.then((t=>(e.mediaKeySessionContext=t,i)))).catch((t=>{throw e.keyLoadPromise=null,t}))}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,s=new(0,i.loader)(i);return t.keyLoader=e.loader=s,e.keyLoadPromise=new Promise(((r,o)=>{const a={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},n=i.keyLoadPolicy.default,l={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(e,t,i,s)=>{const{frag:a,keyInfo:n,url:l}=i;if(!a.decryptdata||n!==this.keyUriToKeyInfo[l])return o(this.createKeyLoadError(a,Ic.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),s));n.decryptdata.key=a.decryptdata.key=new Uint8Array(e.data),a.keyLoader=null,n.loader=null,r({frag:a,keyInfo:n})},onError:(e,i,s,r)=>{this.resetLoader(i),o(this.createKeyLoadError(t,Ic.KEY_LOAD_ERROR,new Error(`HTTP Error ${e.code} loading key ${e.text}`),s,Ec({url:a.url,data:void 0},e)))},onTimeout:(e,i,s)=>{this.resetLoader(i),o(this.createKeyLoadError(t,Ic.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),s))},onAbort:(e,i,s)=>{this.resetLoader(i),o(this.createKeyLoadError(t,Ic.INTERNAL_ABORTED,new Error("key loading aborted"),s))}};s.load(a,l,d)}))}resetLoader(e){const{frag:t,keyInfo:i,url:s}=e,r=i.loader;t.keyLoader===r&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[s],r&&r.destroy()}}function UA(){return self.SourceBuffer||self.WebKitSourceBuffer}function OA(){if(!hp())return!1;const e=UA();return!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove}class NA{constructor(e,t,i,s){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=s}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:i,media:s,stalled:r}=this;if(null===s)return;const{currentTime:o,seeking:a}=s,n=this.seeking&&!a,l=!this.seeking&&a;if(this.seeking=a,o!==e){if(this.moved=!0,a||(this.nudgeRetry=0),null!==r){if(this.stallReported){const e=self.performance.now()-r;Oc.warn(`playback not stuck anymore @${o}, after ${Math.round(e)}ms`),this.stallReported=!1}this.stalled=null}return}if(l||n)return void(this.stalled=null);if(s.paused&&!a||s.ended||0===s.playbackRate||!om.getBuffered(s).length)return void(this.nudgeRetry=0);const d=om.bufferInfo(s,o,0),h=d.nextStart||0;if(a){const e=d.len>2,i=!h||t&&t.start<=o||h-o>2&&!this.fragmentTracker.getPartialFragment(o);if(e||i)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var c;if(!(d.len>0)&&!h)return;const e=Math.max(h,d.start||0)-o,t=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,i=(null==t||null==(c=t.details)?void 0:c.live)?2*t.details.targetduration:2,r=this.fragmentTracker.getPartialFragment(o);if(e>0&&(e<=i||r))return void(s.paused||this._trySkipBufferHole(r))}const u=self.performance.now();if(null===r)return void(this.stalled=u);const p=u-r;if(!a&&p>=250&&(this._reportStall(d),!this.media))return;const f=om.bufferInfo(s,o,i.maxBufferHole);this._tryFixBufferStall(f,p)}_tryFixBufferStall(e,t){const{config:i,fragmentTracker:s,media:r}=this;if(null===r)return;const o=r.currentTime,a=s.getPartialFragment(o);if(a){if(this._trySkipBufferHole(a)||!this.media)return}(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-o1e3*i.highBufferWatchdogPeriod&&(Oc.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:i,stallReported:s}=this;if(!s&&i){this.stallReported=!0;const s=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${JSON.stringify(e)})`);Oc.warn(s.message),t.trigger(Rc.ERROR,{type:Pc.MEDIA_ERROR,details:Ic.BUFFER_STALLED_ERROR,fatal:!1,error:s,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:i,media:s}=this;if(null===s)return 0;const r=s.currentTime,o=om.bufferInfo(s,r,0),a=r0&&o.len<1&&s.readyState<3,d=a-r;if(d>0&&(n||l)){if(d>t.maxBufferHole){const{fragmentTracker:t}=this;let i=!1;if(0===r){const e=t.getAppendedFrag(0,Op);e&&a1?(e=0,this.bitrateTest=!0):e=i.firstAutoLevel),i.nextLoadLevel=e,this.level=i.loadLevel,this.loadedmetadata=!1}t>0&&-1===e&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=Sm,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=wm}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Im:{const{levels:e,level:t}=this,i=null==e?void 0:e[t],s=null==i?void 0:i.details;if(s&&(!s.live||this.levelLastLoaded===i)){if(this.waitForCdnTuneIn(s))break;this.state=Sm;break}if(this.hls.nextLoadLevel!==this.level){this.state=Sm;break}break}case km:{var e;const t=self.performance.now(),i=this.retryDate;if(!i||t>=i||null!=(e=this.media)&&e.seeking){const{levels:e,level:t}=this,i=null==e?void 0:e[t];this.resetStartWhenNotLoaded(i||null),this.state=Sm}}}this.state===Sm&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:s}=this;if(null===t||!s&&(this.startFragRequested||!e.config.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;const r=e.nextLoadLevel;if(null==i||!i[r])return;const o=i[r],a=this.getMainFwdBufferInfo();if(null===a)return;const n=this.getLevelDetails();if(n&&this._streamEnded(a,n)){const e={};return this.altAudio&&(e.type="video"),this.hls.trigger(Rc.BUFFER_EOS,e),void(this.state=Dm)}e.loadLevel!==r&&-1===e.manualLevel&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;const l=o.details;if(!l||this.state===Im||l.live&&this.levelLastLoaded!==o)return this.level=r,void(this.state=Im);const d=a.len,h=this.getMaxBufferLength(o.maxBitrate);if(d>=h)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const c=this.backtrackFragment?this.backtrackFragment.start:a.end;let u=this.getNextFragment(c,l);if(this.couldBacktrack&&!this.fragPrevious&&u&&"initSegment"!==u.sn&&this.fragmentTracker.getState(u)!==em){var p;const e=(null!=(p=this.backtrackFragment)?p:u).sn-l.startSN,t=l.fragments[e-1];t&&u.cc===t.cc&&(u=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(u&&this.isLoopLoading(u,c)){if(!u.gap){const e=this.audioOnly&&!this.altAudio?Vc:Hc,t=(e===Hc?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,Op)}u=this.getNextFragmentLoopLoading(u,l,a,Op,h)}u&&(!u.initSegment||u.initSegment.data||this.bitrateTest||(u=u.initSegment),this.loadFragment(u,o,c))}loadFragment(e,t,i){const s=this.fragmentTracker.getState(e);this.fragCurrent=e,s===Qf||s===Zf?"initSegment"===e.sn?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,i)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Op)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(null!=t&&t.readyState){let i;const s=this.getAppendedFrag(t.currentTime);s&&s.start>1&&this.flushMainBuffer(0,s.start-1);const r=this.getLevelDetails();if(null!=r&&r.live){const e=this.getMainFwdBufferInfo();if(!e||e.len<2*r.targetduration)return}if(!t.paused&&e){const t=e[this.hls.nextLoadLevel],s=this.fragLastKbps;i=s&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*s)+1:0}else i=0;const o=this.getBufferedFrag(t.currentTime+i);if(o){const e=this.followingBufferedFrag(o);if(e){this.abortCurrentFrag();const t=e.maxStartPTS?e.maxStartPTS:e.start,i=e.duration,s=Math.max(o.end,t+Math.min(Math.max(i-this.config.maxFragLookUpTolerance,i*(this.couldBacktrack?.5:.125)),i*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(s,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case Em:case Tm:case km:case Cm:case xm:this.state=Sm}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new NA(this.config,i,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;Cc(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const i=this.getMainFwdBufferInfo();null!==i&&0!==i.len?this.tick():this.warn(`Main forward buffer length on "seeked" event ${i?i.len:"empty"})`)}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(Rc.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let i=!1,s=!1;t.levels.forEach((e=>{const t=e.audioCodec;t&&(i=i||-1!==t.indexOf("mp4a.40.2"),s=s||-1!==t.indexOf("mp4a.40.5"))})),this.audioCodecSwitch=i&&s&&!function(){var e;const t=UA();return"function"==typeof(null==t||null==(e=t.prototype)?void 0:e.changeType)}(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==Sm)return;const s=i[t.level];(!s.details||s.details.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(s.details))&&(this.state=Im)}onLevelLoaded(e,t){var i;const{levels:s}=this,r=t.level,o=t.details,a=o.totalduration;if(!s)return void this.warn(`Levels were reset while loading level ${r}`);this.log(`Level ${r} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${a}`);const n=s[r],l=this.fragCurrent;!l||this.state!==Tm&&this.state!==km||l.level!==t.level&&l.loader&&this.abortCurrentFrag();let d=0;if(o.live||null!=(i=n.details)&&i.live){var h;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;d=this.alignPlaylists(o,n.details,null==(h=this.levelLastLoaded)?void 0:h.details)}if(n.details=o,this.levelLastLoaded=n,this.hls.trigger(Rc.LEVEL_UPDATED,{details:o,level:r}),this.state===Im){if(this.waitForCdnTuneIn(o))return;this.state=Sm}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,d),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:s,payload:r}=e,{levels:o}=this;if(!o)return void this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);const a=o[i.level],n=a.details;if(!n)return this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),void this.fragmentTracker.removeFragment(i);const l=a.videoCodec,d=n.PTSKnown||!n.live,h=null==(t=i.initSegment)?void 0:t.data,c=this._getAudioCodec(a),u=this.transmuxer=this.transmuxer||new jg(this.hls,Op,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=s?s.index:-1,f=-1!==p,m=new am(i.level,i.sn,i.stats.chunkCount,r.byteLength,p,f),g=this.initPTS[i.cc];u.push(r,h,c,l,i,s,n.totalduration,d,m,g)}onAudioTrackSwitching(e,t){const i=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const e=this.fragCurrent;e&&(this.log("Switching to main audio track, cancel main fragment load"),e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const e=this.hls;i&&(e.trigger(Rc.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),e.trigger(Rc.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=t.id,s=!!this.hls.audioTracks[i].url;if(s){const e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=e)}this.altAudio=s,this.tick()}onBufferCreated(e,t){const i=t.tracks;let s,r,o=!1;for(const e in i){const t=i[e];if("main"===t.id){if(r=e,s=t,"video"===e){const t=i[e];t&&(this.videoBuffer=t.buffer)}}else o=!0}o&&s?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:s}=t;if(i&&i.type!==Op)return;if(this.fragContextChanged(i))return this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),void(this.state===xm&&(this.state=Sm));const r=s?s.stats:i.stats;this.fragLastKbps=Math.round(8*r.total/(r.buffering.end-r.loading.first)),"initSegment"!==i.sn&&(this.fragPrevious=i),this.fragBufferedComplete(i,s)}onError(e,t){var i;if(t.fatal)this.state=Rm;else switch(t.details){case Ic.FRAG_GAP:case Ic.FRAG_PARSING_ERROR:case Ic.FRAG_DECRYPT_ERROR:case Ic.FRAG_LOAD_ERROR:case Ic.FRAG_LOAD_TIMEOUT:case Ic.KEY_LOAD_ERROR:case Ic.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Op,t);break;case Ic.LEVEL_LOAD_ERROR:case Ic.LEVEL_LOAD_TIMEOUT:case Ic.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Im||(null==(i=t.context)?void 0:i.type)!==Mp||(this.state=Sm);break;case Ic.BUFFER_APPEND_ERROR:case Ic.BUFFER_FULL_ERROR:if(!t.parent||"main"!==t.parent)return;if(t.details===Ic.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case Ic.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}checkBuffer(){const{media:e,gapController:t}=this;if(e&&t&&e.readyState){if(this.loadedmetadata||!om.getBuffered(e).length){const e=this.state!==Sm?this.fragCurrent:null;t.poll(this.lastCurrentTime,e)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=Sm,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Vc||this.audioOnly&&!this.altAudio){const e=(t===Hc?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(e,t,Op),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t0&&(r{const{hls:s}=this;if(!i||this.fragContextChanged(e))return;t.fragmentError=0,this.state=Sm,this.startFragRequested=!1,this.bitrateTest=!1;const r=e.stats;r.parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),s.trigger(Rc.FRAG_LOADED,i),e.bitrateTest=!1}))}_handleTransmuxComplete(e){var t;const i="main",{hls:s}=this,{remuxResult:r,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a)return void this.resetWhenMissingContext(o);const{frag:n,part:l,level:d}=a,{video:h,text:c,id3:u,initSegment:p}=r,{details:f}=d,m=this.altAudio?void 0:r.audio;if(this.fragContextChanged(n))this.fragmentTracker.removeFragment(n);else{if(this.state=Cm,p){if(null!=p&&p.tracks){const e=n.initSegment||n;this._bufferInitSegment(d,p.tracks,e,o),s.trigger(Rc.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:p.tracks})}const e=p.initPTS,t=p.timescale;Cc(e)&&(this.initPTS[n.cc]={baseTime:e,timescale:t},s.trigger(Rc.INIT_PTS_FOUND,{frag:n,id:i,initPTS:e,timescale:t}))}if(h&&f&&"initSegment"!==n.sn){const e=f.fragments[n.sn-1-f.startSN],t=n.sn===f.startSN,i=!e||n.cc>e.cc;if(!1!==r.independent){const{startPTS:e,endPTS:s,startDTS:r,endDTS:a}=h;if(l)l.elementaryStreams[h.type]={startPTS:e,endPTS:s,startDTS:r,endDTS:a};else if(h.firstKeyFrame&&h.independent&&1===o.id&&!i&&(this.couldBacktrack=!0),h.dropped&&h.independent){const r=this.getMainFwdBufferInfo(),o=(r?r.end:this.getLoadPosition())+this.config.maxBufferHole,l=h.firstKeyFramePTS?h.firstKeyFramePTS:e;if(!t&&o2&&(n.gap=!0);n.setElementaryStreamInfo(h.type,e,s,r,a),this.backtrackFragment&&(this.backtrackFragment=n),this.bufferFragmentData(h,n,l,o,t||i)}else{if(!t&&!i)return void this.backtrack(n);n.gap=!0}}if(m){const{startPTS:e,endPTS:t,startDTS:i,endDTS:s}=m;l&&(l.elementaryStreams[Vc]={startPTS:e,endPTS:t,startDTS:i,endDTS:s}),n.setElementaryStreamInfo(Vc,e,t,i,s),this.bufferFragmentData(m,n,l,o)}if(f&&null!=u&&null!=(t=u.samples)&&t.length){const e={id:i,frag:n,details:f,samples:u.samples};s.trigger(Rc.FRAG_PARSING_METADATA,e)}if(f&&c){const e={id:i,frag:n,details:f,samples:c.samples};s.trigger(Rc.FRAG_PARSING_USERDATA,e)}}}_bufferInitSegment(e,t,i,s){if(this.state!==Cm)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:r,video:o,audiovideo:a}=t;if(r){let t=e.audioCodec;const i=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){t&&(t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");const e=r.metadata;e&&"channelCount"in e&&1!==(e.channelCount||1)&&-1===i.indexOf("firefox")&&(t="mp4a.40.5")}t&&-1!==t.indexOf("mp4a.40.5")&&-1!==i.indexOf("android")&&"audio/mpeg"!==r.container&&(t="mp4a.40.2",this.log(`Android: force audio codec to ${t}`)),e.audioCodec&&e.audioCodec!==t&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${t}"`),r.levelCodec=t,r.id="main",this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${t||""}/${e.audioCodec||""}/${r.codec}]`)}o&&(o.levelCodec=e.videoCodec,o.id="main",this.log(`Init video buffer, container:${o.container}, codecs[level/parsed]=[${e.videoCodec||""}/${o.codec}]`)),a&&this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${e.codecs}/${a.codec}]`),this.hls.trigger(Rc.BUFFER_CODECS,t),Object.keys(t).forEach((e=>{const r=t[e].initSegment;null!=r&&r.byteLength&&this.hls.trigger(Rc.BUFFER_APPENDING,{type:e,data:r,frag:i,part:null,chunkMeta:s,parent:i.type})})),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,Op)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=Sm}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&!1===e.seeking){const i=e.currentTime;if(om.isBuffered(e,i)?t=this.getAppendedFrag(i):om.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const e=this.fragPlaying,i=t.level;e&&t.sn===e.sn&&e.level===i||(this.fragPlaying=t,this.hls.trigger(Rc.FRAG_CHANGED,{frag:t}),e&&e.level===i||this.hls.trigger(Rc.LEVEL_SWITCHED,{level:i}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,i=this.currentFrag;if(i&&Cc(t)&&Cc(i.programDateTime)){const e=i.programDateTime+1e3*(t-i.start);return new Date(e)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class GA{static get version(){return"1.5.13"}static isMSESupported(){return OA()}static isSupported(){return function(){if(!OA())return!1;const e=hp();return"function"==typeof(null==e?void 0:e.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some((t=>e.isTypeSupported(fp(t,"video"))))||["mp4a.40.2","fLaC"].some((t=>e.isTypeSupported(fp(t,"audio")))))}()}static getMediaSource(){return hp()}static get Events(){return Rc}static get ErrorTypes(){return Pc}static get ErrorDetails(){return Ic}static get DefaultConfig(){return GA.defaultConfig?GA.defaultConfig:DA}static set DefaultConfig(e){GA.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new Ng,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,function(e,t){if("object"==typeof console&&!0===e||"object"==typeof e){Uc(e,"debug","log","info","warn","error");try{Fc.log(`Debug logs enabled for "${t}" in hls.js version 1.5.13`)}catch(e){Fc=Mc}}else Fc=Mc}(e.debug||!1,"Hls instance");const t=this.config=function(e,t){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=RA(e),s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach((e=>{const r=`${"level"===e?"playlist":e}LoadPolicy`,o=void 0===t[r],a=[];s.forEach((s=>{const n=`${e}Loading${s}`,l=t[n];if(void 0!==l&&o){a.push(n);const e=i[r].default;switch(t[r]={default:e},s){case"TimeOut":e.maxLoadTimeMs=l,e.maxTimeToFirstByteMs=l;break;case"MaxRetry":e.errorRetry.maxNumRetry=l,e.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":e.errorRetry.retryDelayMs=l,e.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":e.errorRetry.maxRetryDelayMs=l,e.timeoutRetry.maxRetryDelayMs=l}}})),a.length&&Oc.warn(`hls.js config: "${a.join('", "')}" setting(s) are deprecated, use "${r}": ${JSON.stringify(t[r])}`)})),Ec(Ec({},i),t)}(GA.DefaultConfig,e);this.userConfig=e,t.progressive&&PA(t);const{abrController:i,bufferController:s,capLevelController:r,errorController:o,fpsController:a}=t,n=new o(this),l=this.abrController=new i(this),d=this.bufferController=new s(this),h=this.capLevelController=new r(this),c=new a(this),u=new zp(this),p=new sf(this),f=t.contentSteeringController,m=f?new f(this):null,g=this.levelController=new BA(this,m),y=new tm(this),A=new FA(this.config),b=this.streamController=new jA(this,y,A);h.setStreamController(b),c.setStreamController(b);const v=[u,g,b];m&&v.splice(1,0,m),this.networkControllers=v;const _=[l,d,h,c,p,y];this.audioTrackController=this.createController(t.audioTrackController,v);const w=t.audioStreamController;w&&v.push(new w(this,y,A)),this.subtitleTrackController=this.createController(t.subtitleTrackController,v);const S=t.subtitleStreamController;S&&v.push(new S(this,y,A)),this.createController(t.timelineController,_),A.emeController=this.emeController=this.createController(t.emeController,_),this.cmcdController=this.createController(t.cmcdController,_),this.latencyController=this.createController(rf,_),this.coreComponents=_,v.push(n);const E=n.onErrorOut;"function"==typeof E&&this.on(Rc.ERROR,E,n)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,s){this._emitter.off(e,t,i,s)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(Oc.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),!this.triggeringException){this.triggeringException=!0;const i=e===Rc.ERROR;this.trigger(Rc.ERROR,{type:Pc.OTHER_ERROR,details:Ic.INTERNAL_EXCEPTION,fatal:i,event:e,error:t}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){Oc.log("destroy"),this.trigger(Rc.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach((e=>e.destroy())),this.networkControllers.length=0,this.coreComponents.forEach((e=>e.destroy())),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){Oc.log("attachMedia"),this._media=e,this.trigger(Rc.MEDIA_ATTACHING,{media:e})}detachMedia(){Oc.log("detachMedia"),this.trigger(Rc.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,i=this.url,s=this.url=wc.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,Oc.log(`loadSource:${s}`),t&&i&&(i!==s||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(Rc.MANIFEST_LOADING,{url:e})}startLoad(e=-1){Oc.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach((t=>{t.startLoad(e)}))}stopLoad(){Oc.log("stopLoad"),this.started=!1,this.networkControllers.forEach((e=>{e.stopLoad()}))}resumeBuffering(){this.started&&this.networkControllers.forEach((e=>{"fragmentLoader"in e&&e.startLoad(-1)}))}pauseBuffering(){this.networkControllers.forEach((e=>{"fragmentLoader"in e&&e.stopLoad()}))}swapAudioCodec(){Oc.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){Oc.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){Oc.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){Oc.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){Oc.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){Oc.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return-1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){Oc.log(`set startLevel:${e}`),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(Oc.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){(function(e){return of.indexOf(e)>-1})(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return-1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let s=0;s=t)return s;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let s;if(s=-1===t&&null!=e&&e.length?e.length-1:t,i)for(let t=s;t--;){const s=e[t].attrs["HDCP-LEVEL"];if(s&&s<=i)return t}return s}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return null==(t=this.audioTrackController)?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return null==(t=this.subtitleTrackController)||t.setSubtitleOption(e),null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return!!e&&e.subtitleDisplay}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}GA.defaultConfig=void 0;class WA extends o{constructor(e){super(),this.player=e,this.TAG_NAME="HlsDecoder",e._opt,this.canVideoPlay=!1,this.$videoElement=null,this.canvasRenderInterval=null,this.bandwidthEstimateInterval=null,this.fpsInterval=null,this.hlsFps=0,this.hlsPrevFrams=0,this.isInitInfo=!1,this.eventsDestroy=[],this.supportVideoFrameCallbackHandle=null,this.player.isHlsCanVideoPlay()?(this.$videoElement=this.player.video.$videoElement,this.canVideoPlay=!0):GA.isSupported()?(this.$videoElement=this.player.video.$videoElement,this.hls=new GA({}),this._initHls(),this._bindEvents()):this.player.debugError(this.TAG_NAME,"init hls error ,not support "),this.player.debugLog(this.TAG_NAME,"init")}destroy(){return new Promise(((e,t)=>{if(this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.hls&&(this.hls.destroy(),this.hls=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this.isInitInfo=!1,this._stopCanvasRender(),this._stopBandwidthEstimateInterval(),this._stopFpsInterval(),this.player._opt.useCanvasRender&&this.$videoElement){this.$videoElement.pause&&(this.$videoElement.pause(),this.$videoElement.muted=!0),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"));try{this.$videoElement.load()}catch(e){}}this.$videoElement=null,this.hlsFps=0,this.player.debugLog(this.TAG_NAME,"destroy"),setTimeout((()=>{e()}),0)}))}checkHlsBufferedDelay(){const e=this.$videoElement;let t=0;const i=e.buffered,s=i.length?i.end(i.length-1):0;return t=s-e.currentTime,t<0&&(this.player.debugWarn(this.TAG_NAME,`checkHlsBufferedDelay ${t} < 0, and buffered is ${s} ,currentTime is ${e.currentTime} , try to seek ${e.currentTime} to ${s}`),e.currentTime=s,t=0),t}getFps(){return this.hlsFps}_startCanvasRender(){ka()?this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)):(this._stopCanvasRender(),this.canvasRenderInterval=setInterval((()=>{this.player.video.render({$video:this.$videoElement,ts:parseInt(1e3*this.$videoElement.currentTime,10)||0})}),40))}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())return void this.player.debugLog(this.TAG_NAME,"videoFrameCallback() player is destroyed");const i=parseInt(1e3*Math.max(t.mediaTime,this.$videoElement.currentTime),10)||0;this.player.video.render({$video:this.$videoElement,ts:i}),this.player.handleRender(),this.player.updateStats({dts:i}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}_startBandwidthEstimateInterval(){this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((()=>{let e=0;this.hls.bandwidthEstimate&&(e=this.hls.bandwidthEstimate),this.player.emit(at.kBps,(e/1024/8/10).toFixed(2))}),1e3)}_stopBandwidthEstimateInterval(){this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}_startFpsInterval(){this._stopCanvasRender(),this.fpsInterval=setInterval((()=>{if(this.$videoElement)if(ea(this.$videoElement.getVideoPlaybackQuality)){const e=this.$videoElement.getVideoPlaybackQuality();this.hlsFps=e.totalVideoFrames-this.hlsPrevFrams,this.hlsPrevFrams=e.totalVideoFrames}else{const e=this.$videoElement.webkitDecodedFrameCount||0;this.hlsFps=e-this.hlsPrevFrams,this.hlsPrevFrams=e}}),1e3)}_stopFpsInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_initHls(){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.$videoElement.muted=!0,vo()&&(this.$videoElement.style.position="absolute"),this.initVideoEvents()),this.hls.attachMedia(this.$videoElement)}_bindEvents(){const e=this.player,{proxy:t}=this.player.events;this.hls;const i=this.$videoElement,s=ka(),r=t(i,es,(t=>{if(this.hls){const i=parseInt(t.timeStamp,10);this.player._opt.useCanvasRender&&Aa(s)&&e.updateStats({ts:i,dts:i})}}));this.eventsDestroy.push(r),this._startBandwidthEstimateInterval(),this._startFpsInterval(),this.hls.on(GA.Events.ERROR,((e,t)=>{if(t.fatal)switch(t.type){case GA.ErrorTypes.NETWORK_ERROR:this.player.debugWarn(this.TAG_NAME,"fatal network error encountered, try to recover"),this.hls.startLoad();break;case GA.ErrorTypes.MEDIA_ERROR:this.player.debugWarn(this.TAG_NAME,"fatal media error encountered, try to recover"),this.hls.recoverMediaError()}})),this.hls.on(GA.Events.MEDIA_ATTACHING,(()=>{})),this.hls.on(GA.Events.MEDIA_ATTACHED,(()=>{})),this.hls.on(GA.Events.MEDIA_DETACHING,(()=>{})),this.hls.on(GA.Events.MEDIA_DETACHED,(()=>{})),this.hls.on(GA.Events.BUFFER_RESET,(()=>{})),this.hls.on(GA.Events.BUFFER_CODECS,(()=>{})),this.hls.on(GA.Events.BUFFER_CREATED,(()=>{})),this.hls.on(GA.Events.BUFFER_APPENDING,((e,t)=>{this.player.debugLog(this.TAG_NAME,"BUFFER_APPENDING",t.type)})),this.hls.on(GA.Events.BUFFER_APPENDED,(()=>{})),this.hls.on(GA.Events.BUFFER_EOS,(()=>{})),this.hls.on(GA.Events.BUFFER_FLUSHING,(()=>{})),this.hls.on(GA.Events.BUFFER_FLUSHED,(()=>{})),this.hls.on(GA.Events.MANIFEST_LOADING,(()=>{this.player.debugLog(this.TAG_NAME,"MANIFEST_LOADING 开始加载playlist m3u8资源")})),this.hls.on(GA.Events.MANIFEST_LOADED,((e,t)=>{this.player.debugLog(this.TAG_NAME,"MANIFEST_LOADED playlist m3u8文件加载完成",t.url)})),this.hls.on(GA.Events.MANIFEST_PARSED,(()=>{this.player.debugLog(this.TAG_NAME,"MANIFEST_PARSED playlist m3u8解析完成"),e._times.demuxStart||(e._times.demuxStart=oo())})),this.hls.on(GA.Events.LEVEL_LOADING,(()=>{})),this.hls.on(GA.Events.LEVEL_LOADED,((e,t)=>{})),this.hls.on(GA.Events.FRAG_LOADING,(()=>{})),this.hls.on(GA.Events.FRAG_LOADED,((t,i)=>{e._times.decodeStart||(e._times.decodeStart=oo())})),this.hls.on(GA.Events.BUFFER_APPENDING,(()=>{e._times.videoStart||(e._times.videoStart=oo(),e.handlePlayToRenderTimes())})),this.hls.on(GA.Events.FRAG_DECRYPTED,(()=>{})),this.hls.on(GA.Events.KEY_LOADING,(()=>{})),this.hls.on(GA.Events.KEY_LOADING,(()=>{})),this.hls.on(GA.Events.FPS_DROP,(e=>{})),this.hls.on(GA.Events.FPS_DROP_LEVEL_CAPPING,(e=>{})),this.hls.on(GA.Events.FRAG_PARSING_INIT_SEGMENT,((e,t)=>{this.player.debugLog(this.TAG_NAME,"FRAG_PARSING_INIT_SEGMENT",t);const i=!!(t&&t.tracks&&t.tracks.audio),s=!!(t&&t.tracks&&t.tracks.video);if(i&&t.tracks.audio){let e=t.tracks.audio;const i=e.metadata&&e.metadata.channelCount?e.metadata.channelCount:0,s=e.codec;this.player.audio&&this.player.audio.updateAudioInfo({encType:s,channels:i,sampleRate:44100})}if(s&&t.tracks.video){let e=t.tracks.video;const i={encTypeCode:-1!==e.codec.indexOf("avc")?At:bt};e.metadata&&(i.width=e.metadata.width,i.height=e.metadata.height),this.player.video&&this.player.video.updateVideoInfo(i)}}))}initVideoPlay(e){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.initVideoEvents()),this.$videoElement.autoplay=!0,this.$videoElement.muted=!0,this.$videoElement.src=e}_initRenderSize(){this.isInitInfo||(this.player.video.updateVideoInfo({width:this.$videoElement.videoWidth,height:this.$videoElement.videoHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0)}initVideoEvents(){const{proxy:e}=this.player.events,t=e(this.$videoElement,Xi,(()=>{this.player.debugLog(this.TAG_NAME,"video canplay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video play"),this._startCanvasRender(),this._initRenderSize()})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video play error ",e)}))})),i=e(this.$videoElement,Zi,(()=>{this.player.debugLog(this.TAG_NAME,"video waiting")})),s=e(this.$videoElement,es,(e=>{const t=parseInt(e.timeStamp,10);this.player.handleRender(),this.player.updateStats({ts:t}),this.$videoElement.paused&&(this.player.debugWarn(this.TAG_NAME,"video is paused and next try to replay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video is paused and replay success")})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video is paused and replay error ",e)})))})),r=e(this.$videoElement,ts,(()=>{this.player.debugLog(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate)}));this.eventsDestroy.push(t,i,s,r)}loadSource(e){return new Promise(((t,i)=>{this.canVideoPlay?(this.initVideoPlay(e),t()):this.hls.on(GA.Events.MEDIA_ATTACHED,(()=>{this.hls.loadSource(e),t()}))}))}}const zA=2097152,$A="fetch",VA="xhr",HA="arraybuffer",JA="text",qA="json",KA="real_time_speed",YA=Object.prototype.toString;function QA(e){if("[object Object]"!==YA.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function XA(e){if(!e||null===e[0]||void 0===e[0]||0===e[0]&&(null===e[1]||void 0===e[1]))return;let t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}function ZA(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function eb(e,t){if(!e)return;if(!t)return e;let i;const s=Object.keys(t).map((e=>{if(i=t[e],null!=i)return Array.isArray(i)?e+="[]":i=[i],i.map((t=>{var i;return i=t,"[object Date]"===YA.call(i)?t=t.toISOString():function(e){return null!==e&&"object"==typeof e}(t)&&(t=JSON.stringify(t)),`${ZA(e)}=${ZA(t)}`})).join("&")})).filter(Boolean).join("&");if(s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}function tb(e,t,i,s,r,o,a,n,l,d,h){r=null!=r?parseFloat(r):null,s=parseInt(s||"0",10),Number.isNaN(s)&&(s=0);return{data:e,done:t,option:{range:l,vid:d,index:n,contentLength:s,age:r,startTime:o,firstByteTime:a,endTime:Date.now(),priOptions:h},response:i}}function ib(e,t){return Math.round(8*e*1e3/t/1024)}class sb extends Error{constructor(e,t,i,s){super(s),ph(this,"retryCount",0),ph(this,"isTimeout",!1),ph(this,"loaderType",$A),ph(this,"startTime",0),ph(this,"endTime",0),ph(this,"options",{}),this.url=e,this.request=t,this.response=i}}class rb extends o{constructor(e){super(),ph(this,"_abortController",null),ph(this,"_timeoutTimer",null),ph(this,"_reader",null),ph(this,"_response",null),ph(this,"_aborted",!1),ph(this,"_index",-1),ph(this,"_range",null),ph(this,"_receivedLength",0),ph(this,"_running",!1),ph(this,"_logger",null),ph(this,"_vid",""),ph(this,"_onProcessMinLen",0),ph(this,"_onCancel",null),ph(this,"_priOptions",null),ph(this,"TAG_NAME","FetchLoader"),this.player=e}load(e){var t;let{url:i,vid:s,timeout:r,responseType:o,onProgress:a,index:n,onTimeout:l,onCancel:d,range:h,transformResponse:c,request:u,params:p,logger:f,method:m,headers:g,body:y,mode:A,credentials:b,cache:v,redirect:_,referrer:w,referrerPolicy:S,onProcessMinLen:E,priOptions:T}=e;this._aborted=!1,this._onProcessMinLen=E,this._onCancel=d,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=n,this._range=h||[0,0],this._vid=s||i,this._priOptions=T||{};const k={method:m,headers:g,body:y,mode:A,credentials:b,cache:v,redirect:_,referrer:w,referrerPolicy:S,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal};let L=!1;clearTimeout(this._timeoutTimer),i=eb(i,p);const C=XA(h);C&&(g=u?u.headers:k.headers=k.headers||(Headers?new Headers:{}),Headers&&g instanceof Headers?g.append("Range",C):g.Range=C),r&&(this._timeoutTimer=setTimeout((()=>{if(L=!0,this.cancel(),l){const e=new sb(i,k,null,"timeout");e.isTimeout=!0,l(e,{index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions})}}),r));const x=Date.now();return(Mo(n)||Mo(h))&&this.player.debugLog(this.TAG_NAME,"[fetch load start], index,",n,",range,",h),new Promise(((e,t)=>{fetch(u||i,u?void 0:k).then((async s=>{if(clearTimeout(this._timeoutTimer),this._response=s,this._aborted||!this._running)return;if(c&&(s=c(s,i)||s),!s.ok)throw new sb(i,k,s,"bad network response");const r=Date.now();let l;if(o===JA)l=await s.text(),this._running=!1;else if(o===qA)l=await s.json(),this._running=!1;else{if(a)return this.resolve=e,this.reject=t,void this._loadChunk(s,a,x,r);{l=await s.arrayBuffer(),l=new Uint8Array(l),this._running=!1;const e=Date.now()-x,t=ib(l.byteLength,e);this.emit(KA,{speed:t,len:l.byteLength,time:e,vid:this._vid,index:this._index,range:this._range,priOptions:this._priOptions})}}(Mo(n)||Mo(h))&&this.player.debugLog(this.TAG_NAME,"[fetch load end], index,",n,",range,",h),e(tb(l,!0,s,s.headers.get("Content-Length"),s.headers.get("age"),x,r,n,h,this._vid,this._priOptions))})).catch((e=>{var s;clearTimeout(this._timeoutTimer),this._running=!1,this._aborted&&!L||((e=e instanceof sb?e:new sb(i,k,null,null===(s=e)||void 0===s?void 0:s.message)).startTime=x,e.endTime=Date.now(),e.isTimeout=L,e.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},t(e))}))}))}async cancel(){if(!this._aborted){if(this._aborted=!0,this._running=!1,this._response){try{this._reader&&await this._reader.cancel()}catch(e){}this._response=this._reader=null}if(this._abortController){try{this._abortController.abort()}catch(e){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions})}}_loadChunk(e,t,i,s){if(!e.body||!e.body.getReader){this._running=!1;const t=new sb(e.url,"",e,"onProgress of bad response.body.getReader");return t.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(t)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(zA),this._writeIdx=0);const r=this._reader=e.body.getReader();let o,a,n;const l=async()=>{var d;a=Date.now();try{o=await r.read(),n=Date.now()}catch(e){return n=Date.now(),void(this._aborted||(this._running=!1,e.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this.reject(e)))}const h=(null===(d=this._range)||void 0===d?void 0:d.length)>0?this._range[0]:0,c=h+this._receivedLength;if(this._aborted)return this._running=!1,void t(void 0,!1,{range:[c,c],vid:this._vid,index:this._index,startTime:a,endTime:n,st:i,firstByteTime:s,priOptions:this._priOptions},e);const u=o.value?o.value.byteLength:0;let p;if(this._receivedLength+=u,this.player.debugLog(this.TAG_NAME,"【fetchLoader,onProgress call】,task,",this._range,", start,",c,", end,",h+this._receivedLength,", done,",o.done),this._onProcessMinLen>0){if(this._writeIdx+u>=this._onProcessMinLen||o.done)p=new Uint8Array(this._writeIdx+u),p.set(this._cache.slice(0,this._writeIdx),0),u>0&&p.set(o.value,this._writeIdx),this._writeIdx=0,this.player.debugLog(this.TAG_NAME,"【fetchLoader,onProgress enough】,done,",o.done,",len,",p.byteLength,", writeIdx,",this._writeIdx);else if(u>0&&this._writeIdx+u0){const e=new Uint8Array(this._writeIdx+u+2048);this.player.debugLog(this.TAG_NAME,"【fetchLoader,onProgress extra start】,size,",this._writeIdx+u+2048,", datalen,",u,", writeIdx,",this._writeIdx),e.set(this._cache.slice(0,this._writeIdx),0),u>0&&e.set(o.value,this._writeIdx),this._writeIdx+=u,delete this._cache,this._cache=e,this.player.debugLog(this.TAG_NAME,"【fetchLoader,onProgress extra end】,len,",u,", writeIdx,",this._writeIdx)}}else p=o.value;if((p&&p.byteLength>0||o.done)&&t(p,o.done,{range:[this._range[0]+this._receivedLength-(p?p.byteLength:0),this._range[0]+this._receivedLength],vid:this._vid,index:this._index,startTime:a,endTime:n,st:i,firstByteTime:s,priOptions:this._priOptions},e),o.done){const t=Date.now()-i,r=ib(this._receivedLength,t);this.emit(KA,{speed:r,len:this._receivedLength,time:t,vid:this._vid,index:this._index,range:this._range,priOptions:this._priOptions}),this._running=!1,this.player.debugLog(this.TAG_NAME,"[fetchLoader onProgress end],task,",this._range,",done,",o.done),this.resolve(tb(o,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),i,s,this._index,this._range,this._vid,this._priOptions))}else l()};l()}get receiveLen(){return this._receivedLength}get running(){return this._running}set running(e){this._running=e}static isSupported(){return!("undefined"==typeof fetch)}}class ob{constructor(e,t,i){ph(this,"TAG_NAME","Task"),this.promise=function(){let e,t;const i=new Promise(((i,s)=>{e=i,t=s}));return i.used=!1,i.resolve=function(){return i.used=!0,e(...arguments)},i.reject=function(){return i.used=!0,t(...arguments)},i}(),this.alive=!!t.onProgress,this._loaderType=e,this.player=i,this._loader=e===$A&&window.fetch?new rb(i):new ab(i),this._config=t,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=t.retryCheckFunc}exec(){const{retry:e,retryDelay:t,onRetryError:i,transformError:s,...r}=this._config,o=async()=>{try{const e=await this._loader.load(r);this.promise.resolve(e)}catch(a){if(this._loader.running=!1,this.player.debugLog(this.TAG_NAME,"[task request catch err]",a),this._canceled)return;a.loaderType=this._loaderType,a.retryCount=this._retryCount;let n=a;s&&(n=s(n)||n),i&&this._retryCount>0&&i(n,this._retryCount,{index:r.index,vid:r.vid,range:r.range,priOptions:r.priOptions}),this._retryCount++;let l=!0;if(this._retryCheckFunc&&(l=this._retryCheckFunc(a)),l&&this._retryCount<=e)return clearTimeout(this._retryTimer),this.player.debugLog(this.TAG_NAME,"[task request setTimeout],retry",this._retryCount,",retry range,",r.range),void(this._retryTimer=setTimeout(o,t));this.promise.reject(n)}};return o(),this.promise}async cancel(){return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,this._loader.cancel()}get running(){return this._loader&&this._loader.running}get loader(){return this._loader}}class ab extends o{constructor(e){super(),ph(this,"_xhr",null),ph(this,"_aborted",!1),ph(this,"_timeoutTimer",null),ph(this,"_range",null),ph(this,"_receivedLength",0),ph(this,"_url",null),ph(this,"_onProgress",null),ph(this,"_index",-1),ph(this,"_headers",null),ph(this,"_currentChunkSizeKB",384),ph(this,"_timeout",null),ph(this,"_xhr",null),ph(this,"_withCredentials",null),ph(this,"_startTime",-1),ph(this,"_loadCompleteResolve",null),ph(this,"_loadCompleteReject",null),ph(this,"_runing",!1),ph(this,"_logger",!1),ph(this,"_vid",""),ph(this,"_responseType",void 0),ph(this,"_credentials",void 0),ph(this,"_method",void 0),ph(this,"_transformResponse",void 0),ph(this,"_firstRtt",void 0),ph(this,"_onCancel",null),ph(this,"_priOptions",null),ph(this,"TAG_NAME","XhrLoader"),this.player=e}load(e){clearTimeout(this._timeoutTimer),this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this.player.debugLog(this.TAG_NAME,"【xhrLoader task】, range",this._range),this._url=eb(e.url,e.params);const t=Date.now();return new Promise(((e,t)=>{this._loadCompleteResolve=e,this._loadCompleteReject=t,this._startLoad()})).catch((e=>{if(clearTimeout(this._timeoutTimer),this._runing=!1,!this._aborted)throw(e=e instanceof sb?e:new sb(this._url,this._request)).startTime=t,e.endTime=Date.now(),e.options={index:this._index,vid:this._vid,priOptions:this._priOptions},e}))}_startLoad(){let e=null;if(this._responseType===HA&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;const t=1024*this._currentChunkSizeKB,i=this._range[0]+this._receivedLength;let s=this._range[1];t],tast :",this._range,", SubRange, ",e)}else e=this._range,this.player.debugLog(this.TAG_NAME,"[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}_internalOpen(e){try{this._startTime=Date.now();const t=this._xhr=new XMLHttpRequest;t.open(this._method||"GET",this._url,!0),t.responseType=this._responseType,this._timeout&&(t.timeout=this._timeout),t.withCredentials=this._withCredentials,t.onload=this._onLoad.bind(this),t.onreadystatechange=this._onReadyStatechange.bind(this),t.onerror=e=>{var t,i,s;this._running=!1;const r=new sb(this._url,this._request,null==e||null===(t=e.currentTarget)||void 0===t?void 0:t.response,"xhr.onerror.status:"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.status)+",statusText,"+(null==e||null===(s=e.currentTarget)||void 0===s?void 0:s.statusText));r.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(r)},t.ontimeout=e=>{this.cancel();const t=new sb(this._url,this._request,{status:408},"timeout");this._onTimeout&&(t.isTimeout=!0,this._onTimeout(t,{index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions})),t.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)};const i=this._headers||{},s=XA(e);s&&(i.Range=s),i&&Object.keys(i).forEach((e=>{t.setRequestHeader(e,i[e])})),this.player.debugLog(this.TAG_NAME,"[xhr.send->] tast,",this._range,",load sub range, ",e),t.send(this._body)}catch(t){t.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}}_onReadyStatechange(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}_onLoad(e){var t;const i=e.target.status;if(i<200||i>299){const t=new sb(this._url,null,{...e.target.response,status:i},"bad response,status:"+i);return t.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}let s,r=null,o=!1;const a=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===HA){var n;const t=new Uint8Array(e.target.response);if(s=a+this._receivedLength,t&&t.byteLength>0){this._receivedLength+=t.byteLength;const e=Date.now()-this._startTime,i=ib(this._receivedLength,e);this.emit(KA,{speed:i,len:this._receivedLength,time:e,vid:this._vid,index:this._index,range:[s,a+this._receivedLength],priOptions:this._priOptions})}r=t,o=!((null===(n=this._range)||void 0===n?void 0:n.length)>1&&this._range[1]&&this._receivedLength], tast :",this._range,", start",s,"end ",a+this._receivedLength,",dataLen,",t?t.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",o)}else o=!0,r=e.target.response;let l={ok:i>=200&&i<300,status:i,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(l=this._transformResponse(l,this._url)||l),this._onProgress&&this._onProgress(r,o,{index:this._index,vid:this._vid,range:[s,a+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},l),o?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(tb(this._onProgress?null:r,o,l,l.headers["content-length"],l.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}cancel(){if(!this._aborted)return this._aborted=!0,this._runing=!1,super.removeAllListeners(),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}static isSupported(){return"undefined"!=typeof XMLHttpRequest}get receiveLen(){return this._receivedLength}get running(){return this._running}set running(e){this._running=e}_getHeaders(e){const t=e.getAllResponseHeaders().trim().split("\r\n"),i={};for(const e of t){const t=e.split(": ");i[t[0].toLowerCase()]=t.slice(1).join(": ")}return i}}class nb extends o{constructor(e,t){super(),ph(this,"type",$A),ph(this,"_queue",[]),ph(this,"_alive",[]),ph(this,"_currentTask",null),ph(this,"_config",void 0),this.player=t,this._config=function(e){return{loaderType:$A,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:JA,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0,...e}}(e),this._config.loaderType!==VA&&rb.isSupported()||(this.type=VA)}destroy(){this._queue=[],this._alive=[],this._currentTask=null}isFetch(){return this.type===$A}static isFetchSupport(){return rb.isSupported()}load(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?t=e:t.url=e||t.url||this._config.url,t=Object.assign({},this._config,t),t.params&&(t.params=Object.assign({},t.params)),t.headers&&QA(t.headers)&&(t.headers=Object.assign({},t.headers)),t.body&&QA(t.body)&&(t.body=Object.assign({},t.body)),t.transformRequest&&(t=t.transformRequest(t)||t);const i=new ob(this.type,t,this.player);return i.loader.on(KA,(e=>{this.emit(KA,e)})),this._queue.push(i),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),i.promise}async cancel(){const e=this._queue.map((e=>e.cancel())).concat(this._alive.map((e=>e.cancel())));this._currentTask&&e.push(this._currentTask.cancel()),this._queue=[],this._alive=[],await Promise.all(e),await function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((t=>setTimeout(t,e)))}()}_processTask(){if(this._currentTask=this._queue.shift(),!this._currentTask)return;this._currentTask.alive&&this._alive.push(this._currentTask);const e=this._currentTask.exec().catch((e=>{}));e&&"function"==typeof e.finally&&e.finally((()=>{var e,t;null!==(e=this._currentTask)&&void 0!==e&&e.alive&&(null===(t=this._alive)||void 0===t?void 0:t.length)>0&&(this._alive=this._alive.filter((e=>e&&e!==this._currentTask))),this._processTask()}))}}const lb="network",db="network_timeout",hb="other",cb="manifest",ub="hls",pb="demux";class fb extends Error{constructor(e,t,i,s,r){super(r||(null==i?void 0:i.message)),this.errorType=e===db?lb:e,this.originError=i,this.ext=s,this.errorMessage=this.message}static create(e,t,i,s,r){return e instanceof fb?e:(e instanceof Error&&(i=e,e=""),e||(e=hb),new fb(e,t,i,s,r))}static network(e){var t;return new fb(null!=e&&e.isTimeout?db:lb,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(t=e.response)||void 0===t?void 0:t.status})}}const mb=/^#(EXT[^:]*)(?::(.*))?$/,gb=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g,yb=/^(?:[a-zA-Z0-9+\-.]+:)?\/\//,Ab=/^((?:[a-zA-Z0-9+\-.]+:)?\/\/[^/?#]*)?([^?#]*\/)?/;function bb(e){const t=e.match(mb);if(t&&t[1])return[t[1].replace("EXT-X-",""),t[2]]}function vb(e){const t={};let i=gb.exec(e);for(;i;)t[i[1]]=i[2]||i[3],i=gb.exec(e);return t}function _b(e,t){if(!t||!e||yb.test(e))return e;const i=Ab.exec(t);return i?"/"===e[0]?i[1]+e:i[1]+i[2]+e:e}const wb={audio:[/^mp4a/,/^vorbis$/,/^opus$/,/^flac$/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]};function Sb(e,t){const i=wb[e];if(i&&t&&t.length)for(let e=0;e>8*(15-t)&255}}}class Bb{static parse(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if(!e.includes("#EXTM3U"))throw new Error("Invalid m3u8 file");const i=function(e){return e.split(/[\r\n]/).map((e=>e.trim())).filter(Boolean)}(e);return Bb.isMediaPlaylist(e)?function(e,t){const i=new Rb;i.url=t;let s,r=new Pb,o=null,a=null,n=0,l=0,d=0,h=0,c=!1;for(;(s=e[h++])&&!c;){if("#"!==s[0]){r.sn=l,r.cc=d,r.url=_b(s,t),a&&(r.key=a.clone(l)),o&&(r.initSegment=o),i.segments.push(r),r=new Pb,l++;continue}const e=bb(s);if(!e)continue;const[h,u]=e;switch(h){case"VERSION":i.version=parseInt(u);break;case"PLAYLIST-TYPE":i.type=null==u?void 0:u.toUpperCase();break;case"TARGETDURATION":i.targetDuration=parseFloat(u);break;case"ENDLIST":{const e=i.segments[i.segments.length-1];e&&(e.isLast=!0),i.live=!1,c=!0}break;case"MEDIA-SEQUENCE":l=i.startSN=parseInt(u);break;case"DISCONTINUITY-SEQUENCE":d=i.startCC=parseInt(u);break;case"DISCONTINUITY":d++;break;case"BYTERANGE":r.setByteRange(u,i.segments[i.segments.length-1]);break;case"EXTINF":{const[e,t]=u.split(",");r.start=n,r.duration=parseFloat(e),n+=r.duration,r.title=t}break;case"KEY":{const e=vb(u);if("NONE"===e.METHOD){a=null;break}if("AES-128"!==e.METHOD)throw new Error(`encrypt ${e.METHOD}/${e.KEYFORMAT} is not supported`);if(a=new Ib,a.method=e.METHOD,a.url=/^blob:/.test(e.URI)?e.URI:_b(e.URI,t),a.keyFormat=e.KEYFORMAT||"identity",a.keyFormatVersions=e.KEYFORMATVERSIONS,e.IV){let t=e.IV.slice(2);t=(1&t.length?"0":"")+t,a.iv=new Uint8Array(t.length/2);for(let e=0,i=t.length/2;e{e.id=t})),o.length&&(o.forEach(((e,t)=>{e.id=t})),i.streams.forEach((e=>{e.audioGroup&&(e.audioStreams=o.filter((t=>t.group===e.audioGroup)))}))),a.length&&(a.forEach(((e,t)=>{e.id=t})),i.streams.forEach((e=>{e.subtitleGroup&&(e.subtitleStreams=a.filter((t=>t.group===e.subtitleGroup)))}))),i}(i,t)}static isMediaPlaylist(e){return e.includes("#EXTINF:")||e.includes("#EXT-X-TARGETDURATION:")}}class Mb{constructor(e){ph(this,"_onLoaderRetry",((e,t)=>{this.hls.emit(Us,{error:fb.network(e),retryTime:t})})),this.hls=e,this.player=e.player,this.TAG_NAME="HlsManifestLoader",this._timer=null;const{retryCount:t,retryDelay:i,loadTimeout:s,fetchOptions:r}=this.hls.config;this._loader=new nb({...r,responseType:"text",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._audioLoader=new nb({...r,responseType:"text",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._subtitleLoader=new nb({...r,responseType:"text",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player)}async destroy(){await this.stopPoll(),this._audioLoader&&(this._audioLoader.destroy(),this._audioLoader=null),this._subtitleLoader&&(this._subtitleLoader.destroy(),this._subtitleLoader=null),this._loader&&(this._loader.destroy(),this._loader=null)}async load(e,t,i){this.player.debugLog(this.TAG_NAME,"load()",e,t,i);const s=[this._loader.load(e)];let r,o,a,n,l,d;t&&s.push(this._audioLoader.load(t)),i&&s.push(this._subtitleLoader.load(i));try{const[e,i,n]=await Promise.all(s);if(!e)return[];r=e.data,t?(o=null==i?void 0:i.data,a=null==n?void 0:n.data):a=null==i?void 0:i.data}catch(e){throw fb.network(e)}try{var h;if(n=Bb.parse(r,e),!1===(null===(h=n)||void 0===h?void 0:h.live)&&n.segments&&!n.segments.length)throw new Error("empty segments list");o&&(l=Bb.parse(o,t)),a&&(d=Bb.parse(a,i))}catch(e){throw new fb(cb,ub,e)}return n&&(n.isMaster?this.hls.emit(Rs,{playlist:n}):this.hls.emit(Ps,{playlist:n})),[n,l,d]}poll(e,t,i,s,r,o){clearTimeout(this._timer),o=o||3e3;let a=this.hls.config.pollRetryCount;const n=async()=>{clearTimeout(this._timer);try{const r=await this.load(e,t,i);if(!r[0])return;a=this.hls.config.pollRetryCount,s(r[0],r[1],r[2])}catch(e){a--,a<=0&&r(e)}this._timer=setTimeout(n,o)};this._timer=setTimeout(n,o)}stopPoll(){return clearTimeout(this._timer),this.cancel()}cancel(){return Promise.all([this._loader.cancel(),this._audioLoader.cancel()])}}class Fb{constructor(){ph(this,"_chunkSpeeds",[]),ph(this,"_speeds",[])}addRecord(e,t){e&&t&&(this._speeds.push(8e3*e/t),this._speeds=this._speeds.slice(-3))}addChunkRecord(e,t){e&&t&&(this._chunkSpeeds.push(8e3*e/t),this._chunkSpeeds=this._chunkSpeeds.slice(-100))}getAvgSpeed(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds.reduce(((e,t)=>e+t))/this._speeds.length:this._chunkSpeeds.reduce(((e,t)=>e+t))/this._chunkSpeeds.length:0}getLatestSpeed(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds[this._speeds.length-1]:this._chunkSpeeds[this._chunkSpeeds.length-1]:0}reset(){this._chunkSpeeds=[],this._speeds=[]}}class Ub{constructor(e){ph(this,"_emitOnLoaded",((e,t)=>{const{data:i,response:s,option:r}=e,{firstByteTime:o,startTime:a,endTime:n,contentLength:l}=r||{},d=n-a;this._bandwidthService.addRecord(l||i.byteLength,d),this.hls.emit(Ns,{time:d,byteLength:l,url:t}),this.hls.emit(js,{url:t,elapsed:d||0}),this.hls.emit(Fs,{url:t,responseUrl:s.url,elapsed:o-a}),this.hls.emit(Gs,{headers:s.headers})})),ph(this,"_onLoaderRetry",((e,t)=>{this.hls.emit(Us,{error:fb.network(e),retryTime:t})})),this.hls=e,this.player=e.player,this._bandwidthService=new Fb;const{retryCount:t,retryDelay:i,loadTimeout:s,fetchOptions:r}=this.hls.config;this._segmentLoader=new nb({...r,responseType:"arraybuffer",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._audioSegmentLoader=new nb({...r,responseType:"arraybuffer",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._keyLoader=new nb({...r,responseType:"arraybuffer",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player)}destroy(){this.reset(),this._keyLoader&&(this._keyLoader.destroy(),this._keyLoader=null),this._audioSegmentLoader&&(this._audioSegmentLoader.destroy(),this._audioSegmentLoader=null),this._segmentLoader&&(this._segmentLoader.destroy(),this._segmentLoader=null)}speedInfo(){return{speed:this._bandwidthService.getLatestSpeed(),avgSpeed:this._bandwidthService.getAvgSpeed()}}resetBandwidth(){this._bandwidthService.reset()}load(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:i;const r=[];return e&&(r[0]=this.loadVideoSegment(e,i)),t&&(r[1]=this.loadAudioSegment(t,s)),Promise.all(r)}loadVideoSegment(e,t){return this._loadSegment(this._segmentLoader,e,t)}loadAudioSegment(e,t){return this._loadSegment(this._audioSegmentLoader,e,t)}async _loadSegment(e,t,i){var s;let r,o,a,n,l;const d=[];if(this.hls.emit(Os,{url:t.url}),d[0]=e.load(t.url),i&&t.initSegment){var h;const i=t.initSegment.url;r=this._mapCache[i],r||(this.hls.emit(Os,{url:i}),d[1]=e.load(i).then((e=>{if(e){Object.keys(this._mapCache)>30&&(this._mapCache={}),r=this._mapCache[i]=e.data,this._emitOnLoaded(e,i)}})));const s=null===(h=t.initSegment.key)||void 0===h?void 0:h.url;s&&(l=t.initSegment.key.iv,n=this._keyCache[s],n||(this.hls.emit(Os,{url:s}),d[2]=this._keyLoader.load(s).then((e=>{e&&(n=this._keyCache[s]=e.data,this._emitOnLoaded(e,s))}))))}const c=null===(s=t.key)||void 0===s?void 0:s.url;c&&(a=t.key.iv,o=this._keyCache[c],o||(this.hls.emit(Os,{url:c}),d[3]=this._keyLoader.load(c).then((e=>{e&&(o=this._keyCache[c]=e.data,this._emitOnLoaded(e,c))}))));const[u]=await Promise.all(d);if(!u)return;const p=u.data;return this._emitOnLoaded(u,t.url),{data:p,map:r,key:o,mapKey:n,keyIv:a,mapKeyIv:l}}reset(){this.error=null,this._mapCache={},this._keyCache={},this._bandwidthService.reset()}async cancel(){await Promise.all([this._keyLoader.cancel(),this._segmentLoader.cancel(),this._audioSegmentLoader.cancel()])}}class Ob{constructor(e,t,i){this.live=void 0,this.id=0,this.bitrate=0,this.width=0,this.height=0,this.name="",this.url="",this.audioCodec="",this.videoCodec="",this.textCodec="",this.startCC=0,this.endCC=0,this.startSN=0,this.endSN=-1,this.totalDuration=0,this.targetDuration=0,this.snDiff=null,this.segments=[],this.audioStreams=[],this.subtitleStreams=[],this.closedCaptions=[],this.currentAudioStream=null,this.currentSubtitleStream=null,this.TAG_NAME="HlsStream",this.update(e,t,i)}get lastSegment(){return this.segments.length?this.segments[this.segments.length-1]:null}get segmentDuration(){var e;return this.targetDuration||(null===(e=this.segments[0])||void 0===e?void 0:e.duration)||0}get liveEdge(){return this.endTime}get endTime(){var e;return(null===(e=this.lastSegment)||void 0===e?void 0:e.end)||0}get currentSubtitleEndSn(){var e;return(null===(e=this.currentSubtitleStream)||void 0===e?void 0:e.endSN)||0}clearOldSegment(e,t){return this._clearSegments(e,t)}getAudioSegment(e){if(!e||!this.currentAudioStream)return;const t=e.sn-this.snDiff;return this.currentAudioStream.segments.find((e=>e.sn===t))}update(e,t){this.url=e.url,Array.isArray(e.segments)?(null!==this.live&&void 0!==this.live||(this.live=e.live),this._updateSegments(e,this),this.startCC=e.startCC,this.endCC=e.endCC,this.startSN=e.startSN,this.endSN=e.endSN||-1,this.totalDuration=e.totalDuration,this.targetDuration=e.targetDuration,this.live=e.live,t&&this.currentAudioStream&&Array.isArray(t.segments)&&(this._updateSegments(t,this.currentAudioStream),(null===this.snDiff||void 0===this.snDiff)&&e.segments.length&&t.segments.length&&(this.snDiff=e.segments[0].sn-t.segments[0].sn))):(this.id=e.id,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.name=e.name,this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.textCodec=e.textCodec,this.audioStreams=e.audioStreams,this.subtitleStreams=e.subtitleStreams,!this.currentAudioStream&&this.audioStreams.length&&(this.currentAudioStream=this.audioStreams.find((e=>e.default))||this.audioStreams[0]),!this.currentSubtitleStream&&this.subtitleStreams.length&&(this.currentSubtitleStream=this.subtitleStreams.find((e=>e.default))||this.subtitleStreams[0]))}updateSubtitle(e){if(!(e&&this.currentSubtitleStream&&Array.isArray(e.segments)))return;const t=this._updateSegments(e,this.currentSubtitleStream),i=this.currentSubtitleStream.segments;return i.length>100&&(this.currentSubtitleStream.segments=i.slice(100)),t?t.map((e=>({sn:e.sn,url:e.url,duration:e.duration,start:e.start,end:e.end,lang:this.currentSubtitleStream.lang}))):void 0}switchSubtitle(e){const t=this.subtitleStreams.find((t=>t.lang===e)),i=this.currentSubtitleStream;t&&(this.currentSubtitleStream=t,i.segments=[])}_clearSegments(e,t){let i=0;const s=this.segments;for(let t=0,r=s.length;t=e){i=t;break}return i>t&&(i=t),i&&(this.segments=this.segments.slice(i),this.currentAudioStream&&(this.currentAudioStream.segments=this.currentAudioStream.segments.slice(i))),t-i}_updateSegments(e,t){const i=t.segments;if(this.live){const s=i[i.length-1],r=(null==s?void 0:s.sn)||-1;if(re.sn===r)),a=o<0?e.segments:e.segments.slice(o+1);if(i.length&&a.length){let e=s.end;a.forEach((t=>{t.start=e,e=t.end}));const t=(null==s?void 0:s.cc)||-1;t>a[0].cc&&a.forEach((e=>e.cc+=t))}return t.endSN=e.endSN,t.segments=i.concat(a),a}}else t.segments=e.segments}}class Nb{constructor(e){this.hls=e,this.player=e.player,this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1,this.TAG_NAME="HlsPlaylist"}destroy(){this.reset()}get lastSegment(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.lastSegment}get currentSegment(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer]}get nextSegment(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer+1]}get currentSegments(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.segments}get currentSubtitleEndSn(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.currentSubtitleEndSn}get liveEdge(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.liveEdge}get totalDuration(){var e;return(null===(e=this.currentStream)||void 0===e?void 0:e.totalDuration)||0}get seekRange(){const e=this.currentSegments;if(e&&e.length)return[e[0].start,e[e.length-1].end]}get isEmpty(){var e;return!(null!==(e=this.currentSegments)&&void 0!==e&&e.length)}get isLive(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.live}get hasSubtitle(){var e;return!(null===(e=this.currentStream)||void 0===e||!e.currentSubtitleStream)}getAudioSegment(e){var t;return null===(t=this.currentStream)||void 0===t?void 0:t.getAudioSegment(e)}moveSegmentPointer(e){var t;null==e&&(e=this._segmentPointer+1),this._segmentPointer=ao(e,-1,null===(t=this.currentSegments)||void 0===t?void 0:t.length),this.player.debugLog(this.TAG_NAME,`moveSegmentPointer() and param pos is ${e} and clamp result is ${this._segmentPointer}`)}reset(){this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1}getSegmentByIndex(e){var t;return null===(t=this.currentSegments)||void 0===t?void 0:t[e]}setNextSegmentByIndex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._segmentPointer=e-1,this.player.debugLog(this.TAG_NAME,"setNextSegmentByIndex()",e,this._segmentPointer)}findSegmentIndexByTime(e){const t=this.currentSegments;if(t){for(let i,s=0,r=t.length;s=i.start&&ee.url)).forEach(((e,t)=>{this.streams[t]?this.streams[t].update(e):this.streams[t]=new Ob(e)})),this.currentStream=this.streams[0];else if(Array.isArray(e.segments)){const s=this.currentStream;if(s){s.update(e,t,i);const r=s.updateSubtitle(i);r&&this.hls.emit(Ds,{list:r})}else this.reset(),this.currentStream=this.streams[0]=new Ob(e,t,i)}this.currentStream&&this.hls.isLive&&!this.dvrWindow&&(this.dvrWindow=this.currentSegments.reduce(((e,t)=>e+=t.duration),0))}switchSubtitle(e){var t;null===(t=this.currentStream)||void 0===t||t.switchSubtitle(e)}clearOldSegment(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;const t=this.currentStream;if(!this.dvrWindow||!t)return;const i=t.endTime-this.dvrWindow;if(i<=0)return void this.player.debugLog(this.TAG_NAME,`clearOldSegment() stream.endTime:${t.endTime}, this.dvrWindow:${this.dvrWindow} startTime <= 0`);const s=t.segments;if(s.length<=e)return void this.player.debugLog(this.TAG_NAME,`clearOldSegment() segments.length:${s.length} <= maxPlaylistSize:${e}`);const r=this._segmentPointer;this._segmentPointer=t.clearOldSegment(i,r),this.player.debugLog(this.TAG_NAME,"clearOldSegment() update _segmentPointer:",r,this._segmentPointer),this.player.debugLog(this.TAG_NAME,"currentSegments",this.currentSegments)}checkSegmentTrackChange(e,t){const i=this.findSegmentIndexByTime(e),s=this.getSegmentByIndex(i);if(!s)return;if(!s.hasAudio&&!s.hasVideo)return;if(2!==t&&s.hasAudio&&s.hasVideo)return s;if(s.end-e>.3)return;const r=this.getSegmentByIndex(i+1);return r&&(r.hasAudio||r.hasVideo)&&(r.hasAudio!==s.hasAudio||r.hasVideo!==s.hasVideo)?r:void 0}}class jb{constructor(e,t){this.hls=e,this.player=t;const i=window.crypto||window.msCrypto;this.subtle=i&&(i.subtle||i.webkitSubtle),this.externalDecryptor=null}decrypt(e,t){if(!e&&!t)return;const i=[];return e&&(i[0]=this._decryptSegment(e)),t&&(i[1]=this._decryptSegment(t)),Promise.all(i)}async _decryptSegment(e){let t=e.data;return e.key&&(t=await this._decryptData(e.data,e.key,e.keyIv)),e.map?Sh(e.map,t):t}async _decryptData(e,t,i){if(this.externalDecryptor)return await this.externalDecryptor.decrypt(e,t,i);if(this.subtle){const s=await this.subtle.importKey("raw",t,{name:"AES-CBC"},!1,["encrypt","decrypt"]),r=await this.subtle.decrypt({name:"AES-CBC",iv:i},s,e);return new Uint8Array(r)}e=kd(e),t=kd(t),i=kd(i);return function(e){const{words:t}=e,{sigBytes:i}=e,s=new Uint8Array(i);for(let e=0;e>>2]>>>24-e%4*8&255;return s}(Ed.AES.decrypt({ciphertext:e},t,{iv:i,mode:Ed.mode.CBC}))}}class Gb extends ih{constructor(e){super(e),this.player=e,this._pmtId=-1,this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[],this._gopId=0,this._videoPid=-1,this._audioPid=-1,this._codecType=At,this._audioCodecType=wt,this._vps=null,this._sps=null,this._pps=null,this.TAG_NAME="HlsTsLoader",this.videoTrack=Gb.initVideoTrack(),this.audioTrack=Gb.initAudioTrack(),this._baseDts=-1,this._baseDtsInited=!1,this._basefps=25,this._tempSampleTsList=[],this._hasAudio=!1,this._hasVideo=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=!1,this._videoTimestampBreak=!1,this._lastAudioExceptionGapDot=0,this._lastAudioExceptionOverlapDot=0,this._lastAudioExceptionLargeGapDot=0,this._isSendAACSeqHeader=!1,this.workerClearTimeout=null,this.workerUrl=null,this.loopWorker=null,this.tempSampleListInfo={},this._isUseWorker()&&this._initLoopWorker(),this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.workerUrl&&(URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.loopWorker&&(this.loopWorker.postMessage({cmd:"destroy"}),this.loopWorker.terminate(),this.loopWorker=null),this.videoTrack=null,this.audioTrack=null,this.tempSampleListInfo={},this._baseDts=-1,this._baseDtsInited=!1,this._basefps=25,this._hasCalcFps=!1,this._tempSampleTsList=[],this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=!1,this._videoTimestampBreak=!1,this._lastAudioExceptionGapDot=0,this._lastAudioExceptionOverlapDot=0,this._lastAudioExceptionLargeGapDot=0,this._isSendAACSeqHeader=!1,this.player.debugLog(this.TAG_NAME,"destroy")}static initVideoTrack(){return{samples:[]}}static initAudioTrack(){return{samples:[]}}static probe(e){return!!e.length&&(71===e[0]&&71===e[188]&&71===e[376])}_parsePES(e){const t=e[8];if(null==t||e.lengthe.length-6)return;let r,o;const a=e[7];return 192&a&&(r=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&a?(o=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,r-o>54e5&&(r=o)):o=r),{data:e.subarray(9+t),pts:r,dts:o,originalPts:r,originalDts:o}}_demux(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t&&(this._pmtId=-1,this.videoTrack=Gb.initVideoTrack(),this.audioTrack=Gb.initAudioTrack()),!i||t?(this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[]):(this.videoTrack.samples=[],this.audioTrack.samples=[],this._remainingPacketData&&(e=Sh(this._remainingPacketData,e),this._remainingPacketData=null));let s=e.length;const r=s%188;r&&(this._remainingPacketData=e.subarray(s-r),s-=r);for(let t=0;t>4>1){if(r=t+5+e[t+4],r===t+188)continue}else r=t+4;switch(s){case 0:i&&(r+=e[r]+1),this._pmtId=(31&e[r+10])<<8|e[r+11];break;case this._pmtId:{i&&(r+=e[r]+1);const t=r+3+((15&e[r+1])<<8|e[r+2])-4;for(r+=12+((15&e[r+10])<<8|e[r+11]);r=t)return[];const r=[];for(;s{const t=s?e[0]>>>1&63:31&e[0];switch(t){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!s&&5!==t||s&&5===t)break;r.isIFrame=!0,this._gopId++;break;case 6:case 39:case 40:if(!s&&6!==t||s&&6===t)break;const o=function(e,t){const i=e.length;let s=t?2:1,r=0,o=0,a="";for(;255===e[s];)r+=255,s++;for(r+=e[s++];255===e[s];)o+=255,s++;if(o+=e[s++],5===r&&i>s+16)for(let t=0;t<16;t++)a+=e[s].toString(16),s++;return{payload:e.subarray(s),type:r,size:o,uuid:a}}(function(e){const t=e.byteLength,i=[];let s=1;for(;s=i)return;const r=s,o=[],a=(60&e[s+2])>>>2,n=Mr[a];if(!n)throw new Error(`Invalid sampling index: ${a}`);const l=1+((192&e[s+2])>>>6),d=(1&e[s+2])<<2|(192&e[s+3])>>>6;let h,c,u=0;const p=Wr(n);for(;s+7>5,i-s=i?void 0:e.subarray(s),frames:o,samplingFrequencyIndex:a,sampleRate:n,objectType:l,channelCount:d,originCodec:`mp4a.40.${l}`}}(e.data,e.originalPts);if(t){if(this.audioTrack.codec=t.codec,this.audioTrack.sampleRate=t.sampleRate,this.audioTrack.channelCount=t.channelCount,!this._isSendAACSeqHeader){const e=Or({profile:t.objectType,sampleRate:t.samplingFrequencyIndex,channel:t.channelCount});this._isSendAACSeqHeader=!0,this.player.debugLog(this.TAG_NAME,"aac seq header",`profile: ${t.objectType}, sampleRate:${t.sampleRate},sampleRateIndex: ${t.samplingFrequencyIndex}, channel: ${t.channelCount}`),this._doDecodeByHls(e,Ue,0,!1,0)}if(this._isSendAACSeqHeader){const e=[];t.frames.forEach((t=>{const i=t.pts,s=new Uint8Array(t.data.length+2);s.set([175,1],0),s.set(t.data,2);const r={type:Ue,pts:i,dts:i,payload:s};e.push(r)})),this.audioTrack.samples=this.audioTrack.samples.concat(e)}else this.player.debugWarn(this.TAG_NAME,"aac seq header not send")}else this.player.debugWarn(this.TAG_NAME,"aac parseADTS error")}this._audioPesData=[]}else e&&"startPrefixError"===e.code&&(this._audioPesData=[])}_fix(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e=Math.round(9e4*e);const s=this.videoTrack,r=this.audioTrack,o=s.samples,a=r.samples;if(!o.length&&!a.length)return;const n=o[0],l=a[0];let d=0;if(o.length&&a.length&&(d=n.dts-l.pts),this._baseDtsInited||this._calculateBaseDts(),t&&(this._calculateBaseDts(),this._baseDts-=e),!i){this._videoNextDts=d>0?e+d:e,this._audioNextPts=d>0?e:e-d;const t=n?n.dts-this._baseDts-this._videoNextDts:0,i=l?l.pts-this._baseDts-this._audioNextPts:0;Math.abs(t||i)>Ar&&(this._calculateBaseDts(this.audioTrack,this.videoTrack),this._baseDts-=e)}this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(r),this._fixVideo(s);let h=s.samples.concat(r.samples);h=h.map((e=>(e.dts=Math.round(e.dts/90),e.pts=Math.round(e.pts/90),e.cts=e.pts-e.dts,e))).sort(((e,t)=>e.dts-t.dts)),h.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,this._isUseWorker()?this.loopWorker.postMessage({...e,payload:t,cmd:"sample"},[t.buffer]):e.type===Oe?this._doDecodeVideo({...e,payload:t}):e.type===Ue&&this._doDecodeAudio({...e,payload:t})})),Aa(this._hasCalcFps)&&this._isUseWorker()&&(this._hasCalcFps=this._calcDecodeFps(h))}_calculateBaseDts(){const e=this.audioTrack,t=this.videoTrack,i=e.samples,s=t.samples;if(!i.length&&!s.length)return!1;let r=1/0,o=1/0;i.length&&(e.baseDts=r=i[0].pts),s.length&&(t.baseDts=o=s[0].dts),this._baseDts=Math.min(r,o);const a=o-r;return Number.isFinite(a)&&Math.abs(a)>45e3&&this.player.debugWarn(this.TAG_NAME,`large av first frame gap,\n video pts: ${o},\n audio pts: ${r},\n base dts: ${this._baseDts},\n detect is: ${a}`),this._baseDtsInited=!0,!0}_resetBaseDtsWhenStreamBreaked(){if(this._baseDtsInited&&this._videoTimestampBreak&&this._audioTimestampBreak){if(!this._calculateBaseDts(this.audioTrack,this.videoTrack))return;this._baseDts-=Math.min(this._audioNextPts,this._videoNextDts),this._audioLastSample=null,this._videoLastSample=null,this._videoTimestampBreak=!1,this._audioTimestampBreak=!1}}_fixAudio(e){const t=e.samples;t.length&&(t.forEach((e=>{e.pts-=this._baseDts,e.dts=e.pts})),this._doFixAudioInternal(e,t,9e4))}_fixVideo(e){const t=e.samples;if(!t.length)return;if(t.forEach((e=>{e.dts-=this._baseDts,e.pts-=this._baseDts})),void 0===this._videoNextDts){const e=t[0];this._videoNextDts=e.dts}const i=t.length;let s=0;const r=t[0],o=t[1],a=this._videoNextDts-r.dts;let n;Math.abs(a)>45e3&&(r.dts+=a,r.pts+=a,this.player.debugWarn(this.TAG_NAME,`large video gap between chunk,\n next dts is ${this._videoNextDts},\n first dts is ${r.dts},\n next dts is ${o&&o.dts},\n duration is ${a}`),o&&Math.abs(o.dts-r.dts)>Ar&&(this._videoTimestampBreak=!0,t.forEach(((e,t)=>{0!==t&&(e.dts+=a,e.pts+=a)}))));const l=e.samples[0],d=e.samples[i-1];n=1===i?9e3:Math.floor((d.dts-l.dts)/(i-1));for(let r=0;rAr||s<0){this._videoTimestampBreak=!0,s=this._audioTimestampBreak?n:Math.max(s,2700);const i=this._audioNextPts||0;a&&a.dts>i&&(s=n),this.player.debugWarn(this.TAG_NAME,`large video gap between frames,\n time is ${o/e.timescale},\n dts is ${o},\n origin dts is ${t[r].originalDts},\n next dts is ${this._videoNextDts},\n sample Duration is ${s} ,\n ref Sample DurationInt is ${n}`)}t[r].duration=s,this._videoNextDts+=s}}_doFixAudioInternal(e,t,i){e.sampleDuration||(e.sampleDuration=Wr(e.timescale,i));const s=e.sampleDuration;if(void 0===this._audioNextPts){const e=t[0];this._audioNextPts=e.pts}for(let i=0;i=3*s&&a<=gr&&!vo()){Gr(e.codec,e.channelCount)||t[0].data.subarray();const n=Math.floor(a/s);Math.abs(o.pts-this._lastAudioExceptionGapDot)>yr&&(this._lastAudioExceptionGapDot=o.pts),this.player.debugWarn(this.TAG_NAME,`audio gap detected,\n pts is ${t.pts},\n originPts is ${t.originalPts},\n count is ${n},\n nextPts is ${r},\n ref sample duration is ${s}`);for(let e=0;e=-9e4?(Math.abs(o.pts-this._lastAudioExceptionOverlapDot)>yr&&(this._lastAudioExceptionOverlapDot=o.pts,this.player.debugWarn(this.TAG_NAME,`audio overlap detected,\n pts is ${o.pts},\n originPts is ${o.originalPts},\n nextPts is ${r},\n ref sample duration is ${s}`)),t.splice(i,1),i--):(Math.abs(a)>=gr&&(this._audioTimestampBreak=!0,Math.abs(o.pts-this._lastAudioExceptionLargeGapDot)>yr&&(this._lastAudioExceptionLargeGapDot=o.pts,this.player.debugWarn(this.TAG_NAME,`large audio gap detected,\n time is ${o.pts/1e3}\n pts is ${o.pts},\n originPts is ${o.originalPts},\n nextPts is ${r},\n sample duration is ${a}\n ref sample duration is ${s}`))),o.dts=o.pts=r,this._audioNextPts+=s)}}_calcDecodeFps(e){const t=e.map((e=>({ts:e.dts||e.pts,type:e.type})));this._tempSampleTsList=this._tempSampleTsList.concat(t);const i=da(this._tempSampleTsList,Oe);if(i)this._tempSampleTsList=[],this.player.debugLog(this.TAG_NAME,`_calcDecodeFps() video fps is ${i}, update base fps is ${this._basefps}`),this._basefps=i,this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps});else if(this.player.debugLog(this.TAG_NAME,"_calcDecodeFps() streamVideoFps is null"),this._tempSampleTsList.length>200)return this.player.debugLog(this.TAG_NAME,`_calcDecodeFps() _tempSampleTsList is more than 200, clear and use base fps update ${this._basefps}`),this._tempSampleTsList=[],this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps}),!0;return null!==i}_isUseWorker(){return!this.player.isUseMSE()}_initLoopWorker(){this.player.debugLog(this.TAG_NAME,"_initLoopWorker()");const e=Ta(function(){const e=1,t=2;let i=new class{constructor(){this.baseFps=0,this.fpsInterval=null,this.preLoopTimestamp=null,this.startBpsTime=null,this.allSampleList=[]}destroy(){this._clearInterval(),this.baseFps=0,this.allSampleList=[],this.preLoopTimestamp=null,this.startBpsTime=null}updateBaseFps(e){this.baseFps=e,this._clearInterval(),this._startInterval()}pushSample(e){delete e.cmd,this.allSampleList.push(e)}_startInterval(){const e=Math.ceil(1e3/this.baseFps);this.fpsInterval=setInterval((()=>{let t=(new Date).getTime();this.preLoopTimestamp||(this.preLoopTimestamp=t),this.startBpsTime||(this.startBpsTime=t);const i=t-this.preLoopTimestamp;if(i>2*e&&console.warn(`JbPro:[TsLoader LoopWorker] loop interval is ${i}ms, more than ${e} * 2ms`),this._loop(),this.preLoopTimestamp=(new Date).getTime(),this.startBpsTime){t-this.startBpsTime>=1e3&&(this._calcSampleList(),this.startBpsTime=t)}}),e)}_clearInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_calcSampleList(){const i={buferredDuration:0,allListLength:this.allSampleList.length,audioListLength:0,videoListLength:0};this.allSampleList.forEach((s=>{s.type===t?(i.videoListLength++,s.duration&&(i.buferredDuration+=Math.round(s.duration/90))):s.type===e&&i.audioListLength++})),postMessage({cmd:"sampleListInfo",...i})}_loop(){let i=null;if(this.allSampleList.length)if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]);let t=this.allSampleList[0];for(;t&&t.type===e;)i=this.allSampleList.shift(),postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),t=this.allSampleList[0]}else if(i.type===e){postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]);let s=this.allSampleList[0];for(;s;){if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]),s=null;break}i.type===e&&(postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),s=this.allSampleList[0])}}}};self.onmessage=e=>{const t=e.data;switch(t.cmd){case"updateBaseFps":i.updateBaseFps(t.baseFps);break;case"sample":i.pushSample(t);break;case"destroy":i.destroy(),i=null}}}.toString()),t=new Blob([e],{type:"text/javascript"}),i=URL.createObjectURL(t);let s=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((()=>{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),ie),s.onmessage=e=>{const t=e.data;switch(t.cmd){case"decodeVideo":this._doDecodeVideo(t);break;case"decodeAudio":this._doDecodeAudio(t);break;case"sampleListInfo":this.tempSampleListInfo=t}},this.loopWorker=s}_postMessageToLoopWorker(e,t){this._isUseWorker()&&(this.loopWorker?this.loopWorker.postMessage({cmd:e,...t}):this.player.debugWarn(this.TAG_NAME,"loop worker is not init, can not post message"))}_doDecodeAudio(e){const t=new Uint8Array(e.payload);this.player.updateStats({abps:t.byteLength});let i=this.cryptoPayloadAudio(t);this._doDecodeByHls(i,Ue,e.dts,!1,0)}_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?Xn(t,e.isIFrame):On(t,e.isIFrame),this.player.updateStats({dts:e.dts,vbps:i.byteLength});const s=e.pts-e.dts;let r=this.cryptoPayload(i,e.isIFrame);this._doDecodeByHls(r,Oe,e.dts,e.isIFrame,s)}getBuferredDuration(){return this.tempSampleListInfo.buferredDuration||0}getSampleListLength(){return this.tempSampleListInfo.allListLength||0}getSampleAudioListLength(){return this.tempSampleListInfo.audioListLength||0}getSampleVideoListLength(){return this.tempSampleListInfo.videoListLength||0}getInputByteLength(){return this._remainingPacketData&&this._remainingPacketData.byteLength||0}}function Wb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function zb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function $b(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=Math.pow(2,32);return zb(e,t)*i+zb(e,t+4)}const Vb="aac",Hb="g7110a",Jb="g7110m",qb="avc",Kb="hevc";class Yb{static getFrameDuration(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}static getRateIndexByRate(e){return Yb.FREQ.indexOf(e)}}function Qb(e,t,i,s,r,o){const a=[],n=null==r?void 0:r.entries,l=t.entries,d=s.entries,h=i.entrySizes,c=null==o?void 0:o.entries;let u,p,f;c&&(u={},c.forEach((e=>{u[e-1]=!0}))),n&&(p=[],n.forEach((e=>{let{count:t,offset:i}=e;for(let e=0;e{let{count:t,delta:s}=e;for(let e=0;e=w&&(b++,w=l[b+1]?l[b+1].firstChunk-1:1/0),_+=l[b].samplesPerChunk)})),a}function Xb(e,t){return e.dataReferenceIndex=Wb(t,6),e.width=Wb(t,24),e.height=Wb(t,26),e.horizresolution=zb(t,28),e.vertresolution=zb(t,32),e.frameCount=Wb(t,40),e.depth=Wb(t,74),78}function Zb(e,t){return e.dataReferenceIndex=Wb(t,6),e.channelCount=Wb(t,16),e.sampleSize=Wb(t,18),e.sampleRate=zb(t,24)/65536,28}function ev(e,t,i){if(!e)return;if(e.size!==e.data.length)throw new Error(`box ${e.type} size !== data.length`);const s={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(s.version=e.data[e.headerSize],s.flags=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}(e.data,e.headerSize+1),s.headerSize+=4),i(s,e.data.subarray(s.headerSize),s.start+s.headerSize),s}ph(Yb,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);const tv=function(e,t,i){const s=String(i),r=t>>0;let o=Math.ceil(r/s.length);const a=[],n=String(e);for(;o--;)a.push(s);return a.join("").substring(0,r-n.length)+n},iv=function(){const e=[];for(var t=arguments.length,i=new Array(t),s=0;s{e.push(tv(Number(t).toString(16),2,0))})),e[0]};class sv{static probe(e){return!!sv.findBox(e,["ftyp"])}static findBox(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=[];if(!e)return s;let r=0,o="",a=0;for(;e.length>7;){if(r=zb(e),o=String.fromCharCode.apply(null,e.subarray(4,8)),a=8,1===r?(r=$b(e,8),a+=8):r||(r=e.length),!t[0]||o===t[0]){const n=e.subarray(0,r);if(!(t.length<2))return sv.findBox(n.subarray(a),t.slice(1),i+a);s.push({start:i,size:r,headerSize:a,type:o,data:n})}i+=r,e=e.subarray(r)}return s}static tfhd(e){return ev(e,!0,((e,t)=>{e.trackId=zb(t);let i=4;const s=1&e.flags,r=2&e.flags,o=8&e.flags,a=16&e.flags,n=32&e.flags;s&&(i+=4,e.baseDataOffset=zb(t,i),i+=4),r&&(e.sampleDescriptionIndex=zb(t,i),i+=4),o&&(e.defaultSampleDuration=zb(t,i),i+=4),a&&(e.defaultSampleSize=zb(t,i),i+=4),n&&(e.defaultSampleFlags=zb(t,i))}))}static sidx(e){return ev(e,!0,((e,t)=>{let i=0;e.reference_ID=zb(t,i),i+=4,e.timescale=zb(t,i),i+=4,0===e.version?(e.earliest_presentation_time=zb(t,i),i+=4,e.first_offset=zb(t,i),i+=4):(e.earliest_presentation_time=$b(t,i),i+=8,e.first_offset=$b(t,i),i+=8),i+=2,e.references=[];const s=Wb(t,i);i+=2;for(let r=0;r>31&1,s.referenced_size=2147483647&r,s.subsegment_duration=zb(t,i),i+=4,r=zb(t,i),i+=4,s.starts_with_SAP=r>>31&1,s.SAP_type=r>>28&7,s.SAP_delta_time=268435455&r}}))}static moov(e){return ev(e,!1,((e,t,i)=>{e.mvhd=sv.mvhd(sv.findBox(t,["mvhd"],i)[0]),e.trak=sv.findBox(t,["trak"],i).map((e=>sv.trak(e))),e.pssh=sv.pssh(sv.findBox(t,["pssh"],i)[0])}))}static mvhd(e){return ev(e,!0,((e,t)=>{let i=0;1===e.version?(e.timescale=zb(t,16),e.duration=$b(t,20),i+=28):(e.timescale=zb(t,8),e.duration=zb(t,12),i+=16),e.nextTrackId=zb(t,i+76)}))}static trak(e){return ev(e,!1,((e,t,i)=>{e.tkhd=sv.tkhd(sv.findBox(t,["tkhd"],i)[0]),e.mdia=sv.mdia(sv.findBox(t,["mdia"],i)[0])}))}static tkhd(e){return ev(e,!0,((e,t)=>{let i=0;1===e.version?(e.trackId=zb(t,16),e.duration=$b(t,24),i+=32):(e.trackId=zb(t,8),e.duration=zb(t,16),i+=20),e.width=zb(t,i+52),e.height=zb(t,i+56)}))}static mdia(e){return ev(e,!1,((e,t,i)=>{e.mdhd=sv.mdhd(sv.findBox(t,["mdhd"],i)[0]),e.hdlr=sv.hdlr(sv.findBox(t,["hdlr"],i)[0]),e.minf=sv.minf(sv.findBox(t,["minf"],i)[0])}))}static mdhd(e){return ev(e,!0,((e,t)=>{let i=0;1===e.version?(e.timescale=zb(t,16),e.duration=$b(t,20),i+=28):(e.timescale=zb(t,8),e.duration=zb(t,12),i+=16);const s=Wb(t,i);e.language=String.fromCharCode(96+(s>>10&31),96+(s>>5&31),96+(31&s))}))}static hdlr(e){return ev(e,!0,((e,t)=>{0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}static minf(e){return ev(e,!1,((e,t,i)=>{e.vmhd=sv.vmhd(sv.findBox(t,["vmhd"],i)[0]),e.smhd=sv.smhd(sv.findBox(t,["smhd"],i)[0]),e.stbl=sv.stbl(sv.findBox(t,["stbl"],i)[0])}))}static vmhd(e){return ev(e,!0,((e,t)=>{e.graphicsmode=Wb(t),e.opcolor=[Wb(t,2),Wb(t,4),Wb(t,6)]}))}static smhd(e){return ev(e,!0,((e,t)=>{e.balance=Wb(t)}))}static stbl(e){return ev(e,!1,((e,t,i)=>{var s,r,o;e.stsd=sv.stsd(sv.findBox(t,["stsd"],i)[0]),e.stts=sv.stts(sv.findBox(t,["stts"],i)[0]),e.ctts=sv.ctts(sv.findBox(t,["ctts"],i)[0]),e.stsc=sv.stsc(sv.findBox(t,["stsc"],i)[0]),e.stsz=sv.stsz(sv.findBox(t,["stsz"],i)[0]),e.stco=sv.stco(sv.findBox(t,["stco"],i)[0]),e.stco||(e.co64=sv.co64(sv.findBox(t,["co64"],i)[0]),e.stco=e.co64);const a=null===(s=e.stsd.entries[0])||void 0===s||null===(r=s.sinf)||void 0===r||null===(o=r.schi)||void 0===o?void 0:o.tenc.default_IV_size;e.stss=sv.stss(sv.findBox(t,["stss"],i)[0]),e.senc=sv.senc(sv.findBox(t,["senc"],i)[0],a)}))}static senc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return ev(e,!0,((e,i)=>{let s=0;const r=zb(i,s);s+=4,e.samples=[];for(let o=0;o{const i=[],s=[];let r=0;for(let e=0;e<16;e++)s.push(iv(t[r+e]));if(r+=16,e.version>0){const e=zb(t,r);r+=4;for(let s=0;s<(""+e).length;s++)for(let e=0;e<16;e++){const e=t[r];r+=1,i.push(iv(e))}}const o=zb(t,r);e.data_size=o,r+=4,e.kid=i,e.system_id=s,e.buffer=t}))}static stsd(e){return ev(e,!0,((e,t,i)=>{e.entryCount=zb(t),e.entries=sv.findBox(t.subarray(4),[],i+4).map((e=>{switch(e.type){case"avc1":case"avc2":case"avc3":case"avc4":return sv.avc1(e);case"hvc1":case"hev1":return sv.hvc1(e);case"mp4a":return sv.mp4a(e);case"alaw":case"ulaw":return sv.alaw(e);case"enca":return ev(e,!1,((e,t,i)=>{e.channelCount=Wb(t,16),e.samplesize=Wb(t,18),e.sampleRate=zb(t,24)/65536,t=t.subarray(28),e.sinf=sv.sinf(sv.findBox(t,["sinf"],i)[0]),e.esds=sv.esds(sv.findBox(t,["esds"],i)[0])}));case"encv":return ev(e,!1,((e,t,i)=>{e.width=Wb(t,24),e.height=Wb(t,26),e.horizresolution=zb(t,28),e.vertresolution=zb(t,32),t=t.subarray(78),e.sinf=sv.sinf(sv.findBox(t,["sinf"],i)[0]),e.avcC=sv.avcC(sv.findBox(t,["avcC"],i)[0]),e.hvcC=sv.hvcC(sv.findBox(t,["hvcC"],i)[0]),e.pasp=sv.pasp(sv.findBox(t,["pasp"],i)[0])}))}})).filter(Boolean)}))}static tenc(e){return ev(e,!1,((e,t)=>{let i=6;e.default_IsEncrypted=t[i],i+=1,e.default_IV_size=t[i],i+=1,e.default_KID=[];for(let s=0;s<16;s++)e.default_KID.push(iv(t[i])),i+=1}))}static schi(e){return ev(e,!1,((e,t,i)=>{e.tenc=sv.tenc(sv.findBox(t,["tenc"],i)[0])}))}static sinf(e){return ev(e,!1,((e,t,i)=>{e.schi=sv.schi(sv.findBox(t,["schi"],i)[0]),e.frma=sv.frma(sv.findBox(t,["frma"],i)[0])}))}static frma(e){return ev(e,!1,((e,t)=>{e.data_format="";for(let i=0;i<4;i++)e.data_format+=String.fromCharCode(t[i])}))}static avc1(e){return ev(e,!1,((e,t,i)=>{const s=Xb(e,t),r=t.subarray(s);i+=s,e.avcC=sv.avcC(sv.findBox(r,["avcC"],i)[0]),e.pasp=sv.pasp(sv.findBox(r,["pasp"],i)[0])}))}static avcC(e){return ev(e,!1,((e,t)=>{e.configurationVersion=t[0],e.AVCProfileIndication=t[1],e.profileCompatibility=t[2],e.AVCLevelIndication=t[3],e.codec=function(e){let t,i="avc1.";for(let s=0;s<3;s++)t=e[s].toString(16),t.length<2&&(t=`0${t}`),i+=t;return i}([t[1],t[2],t[3]]),e.lengthSizeMinusOne=3&t[4],e.spsLength=31&t[5],e.sps=[];let i=6;for(let s=0;s{const s=Xb(e,t),r=t.subarray(s);i+=s,e.hvcC=sv.hvcC(sv.findBox(r,["hvcC"],i)[0]),e.pasp=sv.pasp(sv.findBox(r,["pasp"],i)[0])}))}static hvcC(e){return ev(e,!1,((t,i)=>{t.data=e.data,t.codec="hev1.1.6.L93.B0",t.configurationVersion=i[0];const s=i[1];t.generalProfileSpace=s>>6,t.generalTierFlag=(32&s)>>5,t.generalProfileIdc=31&s,t.generalProfileCompatibility=zb(i,2),t.generalConstraintIndicatorFlags=i.subarray(6,12),t.generalLevelIdc=i[12],t.avgFrameRate=Wb(i,19),t.numOfArrays=i[22],t.vps=[],t.sps=[],t.pps=[];let r=23,o=0,a=0,n=0;for(let e=0;e{e.hSpacing=zb(t),e.vSpacing=zb(t,4)}))}static mp4a(e){return ev(e,!1,((e,t,i)=>{const s=Zb(e,t);e.esds=sv.esds(sv.findBox(t.subarray(s),["esds"],i+s)[0])}))}static esds(e){return ev(e,!0,((e,t)=>{e.codec="mp4a.";let i=0,s=0,r=0,o=0;for(;t.length;){for(i=0,o=t[i],s=t[i+1],i+=2;128&s;)r=(127&s)<<7,s=t[i],i+=1;if(r+=127&s,3===o)t=t.subarray(i+3);else{if(4!==o){if(5===o){const s=e.config=t.subarray(i,i+r);let o=(248&s[0])>>3;return 31===o&&s.length>=2&&(o=32+((7&s[0])<<3)+((224&s[1])>>5)),e.objectType=o,e.codec+=o.toString(16),void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}return void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}e.codec+=(t[i].toString(16)+".").padStart(3,"0"),t=t.subarray(i+13)}}}))}static alaw(e){return ev(e,!1,((e,t)=>{Zb(e,t)}))}static stts(e){return ev(e,!0,((e,t)=>{const i=zb(t),s=[];let r=4;for(let e=0;e{const i=zb(t),s=[];let r=4;if(1===e.version)for(let e=0;e{const i=zb(t),s=[];let r=4;for(let e=0;e{const i=zb(t),s=zb(t,4),r=[];if(!i){let e=8;for(let i=0;i{const i=zb(t),s=[];let r=4;for(let e=0;e{const i=zb(t),s=[];let r=4;for(let e=0;e{const i=zb(t),s=[];let r=4;for(let e=0;e{e.mfhd=sv.mfhd(sv.findBox(t,["mfhd"],i)[0]),e.traf=sv.findBox(t,["traf"],i).map((e=>sv.traf(e)))}))}static mfhd(e){return ev(e,!0,((e,t)=>{e.sequenceNumber=zb(t)}))}static traf(e){return ev(e,!1,((e,t,i)=>{e.tfhd=sv.tfhd(sv.findBox(t,["tfhd"],i)[0]),e.tfdt=sv.tfdt(sv.findBox(t,["tfdt"],i)[0]),e.trun=sv.trun(sv.findBox(t,["trun"],i)[0])}))}static trun(e){return ev(e,!0,((e,t)=>{const{version:i,flags:s}=e,r=t.length,o=e.sampleCount=zb(t);let a=4;if(r>a&&1&s&&(e.dataOffset=-(1+~zb(t,a)),a+=4),r>a&&4&s&&(e.firstSampleFlags=zb(t,a),a+=4),e.samples=[],r>a){let r;for(let n=0;n{1===e.version?e.baseMediaDecodeTime=$b(t):e.baseMediaDecodeTime=zb(t)}))}static probe(e){return!!sv.findBox(e,["ftyp"])}static parseSampleFlags(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}}static moovToTrack(e,t,i){var s,r;const o=e.trak;if(!o||!o.length)return;const a=o.find((e=>{var t,i;return"vide"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)})),n=o.find((e=>{var t,i;return"soun"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)}));if(a&&t){var l,d,h,c,u,p,f;const i=t,s=null===(l=a.tkhd)||void 0===l?void 0:l.trackId;null!=s&&(i.id=a.tkhd.trackId),i.tkhdDuration=a.tkhd.duration,i.mvhdDurtion=e.mvhd.duration,i.mvhdTimecale=e.mvhd.timescale,i.timescale=i.formatTimescale=a.mdia.mdhd.timescale,i.duration=a.mdia.mdhd.duration||i.mvhdDurtion/i.mvhdTimecale*i.timescale;const r=a.mdia.minf.stbl.stsd.entries[0];if(i.width=r.width,i.height=r.height,r.pasp&&(i.sarRatio=[r.pasp.hSpacing,r.pasp.vSpacing]),r.hvcC)i.codecType=Kb,i.codec=r.hvcC.codec,i.vps=r.hvcC.vps,i.sps=r.hvcC.sps,i.pps=r.hvcC.pps,i.hvcC=r.hvcC.data;else{if(!r.avcC)throw new Error("unknown video stsd entry");i.codecType=qb,i.codec=r.avcC.codec,i.sps=r.avcC.sps,i.pps=r.avcC.pps}var m,g,y,A,b,v,_,w;if(i.present=!0,i.ext={},i.ext.stss=null===(d=a.mdia)||void 0===d||null===(h=d.minf)||void 0===h||null===(c=h.stbl)||void 0===c?void 0:c.stss,i.ext.ctts=null===(u=a.mdia)||void 0===u||null===(p=u.minf)||void 0===p||null===(f=p.stbl)||void 0===f?void 0:f.ctts,r&&"encv"===r.type)i.isVideoEncryption=!0,r.default_KID=null===(m=r.sinf)||void 0===m||null===(g=m.schi)||void 0===g?void 0:g.tenc.default_KID,r.default_IsEncrypted=null===(y=r.sinf)||void 0===y||null===(A=y.schi)||void 0===A?void 0:A.tenc.default_IsEncrypted,r.default_IV_size=null===(b=r.sinf)||void 0===b||null===(v=b.schi)||void 0===v?void 0:v.tenc.default_IV_size,i.videoSenc=a.mdia.minf.stbl.senc&&a.mdia.minf.stbl.senc.samples,r.data_format=null===(_=r.sinf)||void 0===_||null===(w=_.frma)||void 0===w?void 0:w.data_format,i.useEME=e.useEME,i.kidValue=e.kidValue,i.pssh=e.pssh,i.encv=r}if(n&&i){var S,E,T,k,L,C,x,D,R;const t=i,o=null===(S=n.tkhd)||void 0===S?void 0:S.trackId;null!=o&&(t.id=n.tkhd.trackId),t.tkhdDuration=n.tkhd.duration,t.mvhdDurtion=e.mvhd.duration,t.mvhdTimecale=e.mvhd.timescale,t.timescale=t.formatTimescale=n.mdia.mdhd.timescale,t.duration=n.mdia.mdhd.duration||t.mvhdDurtion/t.mvhdTimecale*t.timescale;const a=n.mdia.minf.stbl.stsd.entries[0];switch(t.sampleSize=a.sampleSize,t.sampleRate=a.sampleRate,t.channelCount=a.channelCount,t.present=!0,a.type){case"alaw":t.codecType=t.codec=Hb,t.sampleRate=8e3;break;case"ulaw":t.codecType=t.codec=Jb,t.sampleRate=8e3;break;default:t.codecType=Vb,t.sampleDuration=Yb.getFrameDuration(t.sampleRate,t.timescale),t.sampleRateIndex=Yb.getRateIndexByRate(t.sampleRate),t.objectType=(null===(s=a.esds)||void 0===s?void 0:s.objectType)||2,a.esds&&(t.config=Array.from(a.esds.config)),t.codec=(null===(r=a.esds)||void 0===r?void 0:r.codec)||"mp4a.40.2"}var P,I,B,M,F,U,O,N;if(t.sampleDuration=Yb.getFrameDuration(t.sampleRate,t.timescale),t.objectType=(null===(E=a.esds)||void 0===E?void 0:E.objectType)||2,a.esds&&(a.esds.config?t.config=Array.from(a.esds.config):console.warn("esds config is null")),t.codec=(null===(T=a.esds)||void 0===T?void 0:T.codec)||"mp4a.40.2",t.sampleRateIndex=Yb.getRateIndexByRate(t.sampleRate),t.ext={},t.ext.stss=null===(k=n.mdia)||void 0===k||null===(L=k.minf)||void 0===L||null===(C=L.stbl)||void 0===C?void 0:C.stss,t.ext.ctts=null===(x=n.mdia)||void 0===x||null===(D=x.minf)||void 0===D||null===(R=D.stbl)||void 0===R?void 0:R.ctts,t.present=!0,a&&"enca"===a.type)t.isAudioEncryption=!0,a.data_format=null===(P=a.sinf)||void 0===P||null===(I=P.frma)||void 0===I?void 0:I.data_format,a.default_KID=null===(B=a.sinf)||void 0===B||null===(M=B.schi)||void 0===M?void 0:M.tenc.default_KID,a.default_IsEncrypted=null===(F=a.sinf)||void 0===F||null===(U=F.schi)||void 0===U?void 0:U.tenc.default_IsEncrypted,a.default_IV_size=null===(O=a.sinf)||void 0===O||null===(N=O.schi)||void 0===N?void 0:N.tenc.default_IV_size,t.audioSenc=n.mdia.minf.stbl.senc&&n.mdia.minf.stbl.senc.samples,t.useEME=e.useEME,t.kidValue=e.kidValue,t.enca=a}if(i&&(i.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!i&&i.isAudioEncryption),null!=t&&t.encv||null!=i&&i.enca){var j,G;const e=null==t||null===(j=t.encv)||void 0===j?void 0:j.default_KID,s=null==i||null===(G=i.enca)||void 0===G?void 0:G.default_KID,r=e||s?(e||s).join(""):null;t&&(t.kid=r),i&&(i.kid=r)}return t&&(t.flags=3841),i&&(i.flags=1793),{videoTrack:t,audioTrack:i}}static evaluateDefaultDuration(e,t,i){var s;const r=null==t||null===(s=t.samples)||void 0===s?void 0:s.length;if(!r)return 1024;return 1024*r/t.timescale*e.timescale/i}static moofToSamples(e,t,i){const s={};return e.mfhd&&(t&&(t.sequenceNumber=e.mfhd.sequenceNumber),i&&(i.sequenceNumber=e.mfhd.sequenceNumber)),e.traf.forEach((e=>{let{tfhd:r,tfdt:o,trun:a}=e;if(!r||!a)return;o&&(t&&t.id===r.trackId&&(t.baseMediaDecodeTime=o.baseMediaDecodeTime),i&&i.id===r.trackId&&(i.baseMediaDecodeTime=o.baseMediaDecodeTime));const n=r.defaultSampleSize||0,l=r.defaultSampleDuration||sv.evaluateDefaultDuration(t,i,a.samples.length||a.sampleCount);let d=a.dataOffset||0,h=0,c=-1;if(!a.samples.length&&a.sampleCount){s[r.trackId]=[];for(let e=0;e((e={offset:d,dts:h,pts:h+(e.cts||0),duration:e.duration||l,size:e.size||n,gopId:c,keyframe:0===t||null!==e.flags&&void 0!==e.flags&&(65536&e.flags)>>>0!=65536}).keyframe&&(c++,e.gopId=c),h+=e.duration,d+=e.size,e)))})),s}static moovToSamples(e){const t=e.trak;if(!t||!t.length)return;const i=t.find((e=>{var t,i;return"vide"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)})),s=t.find((e=>{var t,i;return"soun"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)}));if(!i&&!s)return;let r,o;if(i){var a,n;const e=null===(a=i.mdia)||void 0===a||null===(n=a.minf)||void 0===n?void 0:n.stbl;if(!e)return;const{stts:t,stsc:s,stsz:o,stco:l,stss:d,ctts:h}=e;if(!(t&&s&&o&&l&&d))return;r=Qb(t,s,o,l,h,d)}if(s){var l,d,h;const e=null===(l=s.mdia)||void 0===l||null===(d=l.minf)||void 0===d?void 0:d.stbl;if(!e)return;const t=null===(h=s.mdia.mdhd)||void 0===h?void 0:h.timescale,{stts:i,stsc:r,stsz:a,stco:n}=e;if(!(t&&i&&r&&a&&n))return;o=Qb(i,r,a,n)}return{videoSamples:r,audioSamples:o}}}class rv extends ih{constructor(e){super(e),this.player=e,this.TAG_NAME="HlsFmp4Loader",this.tempSampleListInfo={},this.isInitVideo=!1,this.isInitAudio=!1,this.videoTrack={id:1,samples:[],sps:[],pps:[],vps:[],codec:""},this.audioTrack={id:2,samples:[],sampleRate:0,channelCount:0,codec:"",codecType:""},this.workerClearTimeout=null,this.workerUrl=null,this.loopWorker=null,this._hasCalcFps=!1,this._tempSampleTsList=[],this._basefps=25,this._isUseWorker()&&this._initLoopWorker(),e.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.workerUrl&&(URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.loopWorker&&(this.loopWorker.postMessage({cmd:"destroy"}),this.loopWorker.terminate(),this.loopWorker=null),this._hasCalcFps=!1,this._tempSampleTsList=[],this.videoTrack=null,this.audioTrack=null,this.isInitVideo=!1,this.isInitAudio=!1,this._basefps=25,this.player.debugLog(this.TAG_NAME,"destroy")}demux(e,t){let i=this.audioTrack,s=this.videoTrack;if(this.checkInitAudio(),this.checkInitVideo(),i.samples=[],s.samples=[],t){if(this.player.updateStats({abps:t.byteLength}),Aa(this.isInitAudio)){const e=sv.findBox(t,["moov"])[0];if(!e)return void this.player.debugError(this.TAG_NAME,"cannot found moov box");sv.moovToTrack(sv.moov(e),null,i),this.checkInitAudio()&&(this.player.debugLog(this.TAG_NAME,"audioData audio init success"),this._sendAccADTSHeader(i))}const e=sv.findBox(t,["moof"])[0];if(e){const s=sv.moofToSamples(sv.moof(e),null,i)[i.id],r=i.baseMediaDecodeTime;if(s){const o=e.start;s.map((e=>{e.offset+=o;const s=t.subarray(e.offset,e.offset+e.size),a=e.dts+r,n=new Uint8Array(s.length+2);n.set([175,1],0),n.set(s,2),i.samples.push({type:Ue,pts:a,dts:a,payload:n,duration:e.duration,size:n.byteLength})}))}}}if(e){if(this.player.updateStats({vbps:e.byteLength}),Aa(this.isInitVideo)&&Aa(this.isInitAudio)){const t=sv.findBox(e,["moov"])[0];if(!t)throw new Error("cannot found moov box");if(sv.moovToTrack(sv.moov(t),s,i),Aa(this.isInitAudio)&&this.checkInitAudio()&&(this.player.debugLog(this.TAG_NAME,"videoData audio init success",i),this._sendAccADTSHeader(i)),this.checkInitVideo()){this.player.debugLog(this.TAG_NAME,"video init success");let e=null;s.codecType===ss?s.sps.length&&s.vps.length&&s.pps.length&&(e=Qn({sps:s.sps[0],pps:s.pps[0],vps:s.vps[0]})):s.sps.length&&s.pps.length&&(e=Un({sps:s.sps[0],pps:s.pps[0]})),e&&(this.player.debugLog(this.TAG_NAME,"seqHeader"),this._doDecodeByHls(e,Oe,0,!0,0))}}const t=sv.findBox(e,["moof"])[0];if(t){const r=sv.moofToSamples(sv.moof(t),s,i),o=s.baseMediaDecodeTime,a=i.baseMediaDecodeTime,n=t.start;Object.keys(r).forEach((t=>{s.id==t?r[t].map((t=>{t.offset+=n;const i={type:Oe,pts:(t.pts||t.dts)+o,dts:t.dts+o,units:[],payload:null,isIFrame:!1};i.duration=t.duration,i.gopId=t.gopId,t.keyframe&&(i.isIFrame=!0);const r=e.subarray(t.offset,t.offset+t.size);i.payload=r,s.samples.push(i)})):i.id==t&&r[t].map((t=>{t.offset+=n;const s=e.subarray(t.offset,t.offset+t.size),r=t.dts+a,o=new Uint8Array(s.length+2);o.set([175,1],0),o.set(s,2),i.samples.push({type:Ue,pts:r,dts:r,payload:o,duration:t.duration,size:o.byteLength})}))}))}}const r=s.samples.concat(i.samples);r.sort(((e,t)=>e.dts-t.dts)),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,this._isUseWorker()?this.loopWorker.postMessage({...e,payload:t,cmd:"sample"},[t.buffer]):e.type===Oe?this._doDecodeVideo({...e,payload:t}):e.type===Ue&&this._doDecodeAudio({...e,payload:t})})),Aa(this._hasCalcFps)&&this._isUseWorker()&&(this._hasCalcFps=this._calcDecodeFps(r))}checkInitAudio(){return this.isInitAudio=!!(this.audioTrack.sampleRate&&this.audioTrack.channelCount&&this.audioTrack.codec&&"aac"===this.audioTrack.codecType),this.isInitAudio}checkInitVideo(){return this.isInitVideo=!!(this.videoTrack.pps.length&&this.videoTrack.sps.length&&this.videoTrack.codec),this.isInitVideo}_sendAccADTSHeader(e){const t=Or({profile:e.objectType,sampleRate:e.sampleRateIndex,channel:e.channelCount});this._doDecodeByHls(t,Ue,0,!0,0)}_calcDecodeFps(e){const t=e.map((e=>({ts:e.dts||e.pts,type:e.type})));this._tempSampleTsList=this._tempSampleTsList.concat(t);const i=da(this._tempSampleTsList,Oe);if(i)this._tempSampleTsList=[],this.player.debugLog(this.TAG_NAME,`_calcDecodeFps() video fps is ${i}, update base fps is ${this._basefps}`),this._basefps=i,this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps});else if(this.player.debugLog(this.TAG_NAME,"_calcDecodeFps() streamVideoFps is null"),this._tempSampleTsList.length>200)return this.player.debugLog(this.TAG_NAME,`_calcDecodeFps() _tempSampleTsList is more than 200, clear and use base fps update ${this._basefps}`),this._tempSampleTsList=[],this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps}),!0;return null!==i}_isUseWorker(){return!this.player.isUseMSE()}_initLoopWorker(){this.player.debugLog(this.TAG_NAME,"_initLoopWorker()");const e=Ta(function(){const e=1,t=2;let i=new class{constructor(){this.baseFps=0,this.fpsInterval=null,this.preLoopTimestamp=null,this.startBpsTime=null,this.allSampleList=[]}destroy(){this._clearInterval(),this.baseFps=0,this.allSampleList=[],this.preLoopTimestamp=null,this.startBpsTime=null}updateBaseFps(e){this.baseFps=e,this._clearInterval(),this._startInterval()}pushSample(e){delete e.cmd,this.allSampleList.push(e)}_startInterval(){const e=Math.ceil(1e3/this.baseFps);this.fpsInterval=setInterval((()=>{let t=(new Date).getTime();this.preLoopTimestamp||(this.preLoopTimestamp=t),this.startBpsTime||(this.startBpsTime=t);const i=t-this.preLoopTimestamp;if(i>2*e&&console.warn(`JbPro:[HlsFmp4Loader LoopWorker] loop interval is ${i}ms, more than ${e} * 2ms`),this._loop(),this.preLoopTimestamp=(new Date).getTime(),this.startBpsTime){t-this.startBpsTime>=1e3&&(this._calcSampleList(),this.startBpsTime=t)}}),e)}_clearInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_calcSampleList(){const i={buferredDuration:0,allListLength:this.allSampleList.length,audioListLength:0,videoListLength:0};this.allSampleList.forEach((s=>{s.type===t?(i.videoListLength++,s.duration&&(i.buferredDuration+=s.duration)):s.type===e&&i.audioListLength++})),postMessage({cmd:"sampleListInfo",...i})}_loop(){let i=null;if(this.allSampleList.length)if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]);let t=this.allSampleList[0];for(;t&&t.type===e;)i=this.allSampleList.shift(),postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),t=this.allSampleList[0]}else if(i.type===e){postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]);let s=this.allSampleList[0];for(;s;){if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]),s=null;break}i.type===e&&(postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),s=this.allSampleList[0])}}}};self.onmessage=e=>{const t=e.data;switch(t.cmd){case"updateBaseFps":i.updateBaseFps(t.baseFps);break;case"sample":i.pushSample(t);break;case"destroy":i.destroy(),i=null}}}.toString()),t=new Blob([e],{type:"text/javascript"}),i=URL.createObjectURL(t);let s=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((()=>{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),ie),s.onmessage=e=>{const t=e.data;switch(t.cmd){case"decodeVideo":this._doDecodeVideo(t);break;case"decodeAudio":this._doDecodeAudio(t);break;case"sampleListInfo":this.tempSampleListInfo=t}},this.loopWorker=s}_postMessageToLoopWorker(e,t){this._isUseWorker()&&(this.loopWorker?this.loopWorker.postMessage({cmd:e,...t}):this.player.debugWarn(this.TAG_NAME,"loop worker is not init, can not post message"))}_doDecodeAudio(e){const t=new Uint8Array(e.payload);this.player.updateStats({abps:t.byteLength}),this.cryptoPayloadAudio(t),this._doDecodeByHls(t,Ue,e.dts,!1,0)}_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?Xn(t,e.isIFrame):On(t,e.isIFrame),this.player.updateStats({dts:e.dts,vbps:i.byteLength});const s=e.pts-e.dts;let r=this.cryptoPayload(i,e.isIFrame);this._doDecodeByHls(r,Oe,e.dts,e.isIFrame,s)}getBuferredDuration(){return this.tempSampleListInfo.buferredDuration||0}getSampleListLength(){return this.tempSampleListInfo.allListLength||0}getSampleAudioListLength(){return this.tempSampleListInfo.audioListLength||0}getSampleVideoListLength(){return this.tempSampleListInfo.videoListLength||0}}class ov{constructor(e,t){this.hls=e,this.player=this.hls.player,this.isMP4=t,this._initSegmentId="",this.TAG_NAME="HlsTransmuxer",this._demuxer=t?new rv(this.hls.player):new Gb(this.hls.player),this.player.debugLog(this.TAG_NAME,`init and isMP4 is ${t}`)}destroy(){this._demuxer&&(this._demuxer.destroy(),this._demuxer=null)}transmux(e,t,i,s,r,o){this.player.debugLog(this.TAG_NAME,`transmux videoChunk:${e&&e.byteLength}, audioChunk:${t&&t.byteLength}, discontinuity:${i}, contiguous:${s}, startTime:${r}, needInit:${o}`);const a=this._demuxer;try{this.isMP4?a.demux(e,t):a.demuxAndFix(Sh(e,t),i,s,r)}catch(e){throw new fb(pb,ub,e)}}}class av{constructor(e){this.hls=e,this.player=e.player,this._decryptor=new jb(this.hls,this.player),this._transmuxer=null,this._mse=null,this._softVideo=null,this._sourceCreated=!1,this._needInitSegment=!0,this._directAppend=!1,this.TAG_NAME="HlsBufferService"}async destroy(){this._softVideo=null,this._transmuxer&&(this._transmuxer.destroy(),this._transmuxer=null)}get baseDts(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t._baseDts}get nbSb(){return 0}async updateDuration(e){this.player.debugLog(this.TAG_NAME,"updateDuration()",e)}getBuferredDuration(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getBuferredDuration()}getBufferedSegments(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleListLength()}getBufferedAudioSegments(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleAudioListLength()}getBufferedVideoSegments(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleVideoListLength()}createSource(e,t,i,s){if(this._sourceCreated)return;const r=e||t;r&&(Gb.probe(r)?this._transmuxer||(this._transmuxer=new ov(this.hls,!1)):sv.probe(r)?this._transmuxer||(this._transmuxer=new ov(this.hls,!0)):this.player.debugError(this.TAG_NAME,"createSource error: chunk is not ts"))}async appendBuffer(e,t,i,s,r,o,a){if(null!=i&&i.length||null!=s&&s.length)return this._needInitSegment,this._transmuxer.transmux(i,s,r,o,a,this._needInitSegment||r),!0}async clearAllBuffer(){this.player.debugLog(this.TAG_NAME,"clearAllBuffer")}decryptBuffer(e,t){return this._decryptor.decrypt(e,t)}async reset(){this._transmuxer=null,this._needInitSegment=!0,this._directAppend=!1}async endOfStream(){this._softVideo&&this._softVideo.endOfStream()}async setLiveSeekableRange(e,t){}seamlessSwitch(){this._needInitSegment=!0}}class nv{constructor(e){this.emitter=e,this._seiSet=new Set,e.on(Ws,(e=>{e&&this._seiSet.add(e)}))}throw(e){if(null==e||!this._seiSet.size)return;const t=e-.2,i=e+.2,s=[];this._seiSet.forEach((e=>{e.time>=t&&e.time<=i&&s.push(e)})),s.forEach((e=>{this._seiSet.delete(e),this.emitter.emit(zs,e)}))}reset(){this._seiSet.clear()}}class lv{constructor(e){this._timescale=e,this.encodeType="",this.audioCodec="",this.videoCodec="",this.domain="",this.fps=0,this.bitrate=0,this.width=0,this.height=0,this.samplerate=0,this.channelCount=0,this.gop=0,this._bitsAccumulateSize=0,this._bitsAccumulateDuration=0}getStats(){return{encodeType:this.encodeType,audioCodec:this.audioCodec,videoCodec:this.videoCodec,domain:this.domain,fps:this.fps,bitrate:this.bitrate,width:this.width,height:this.height,samplerate:this.samplerate,channelCount:this.channelCount,gop:this.gop}}setEncodeType(e){this.encodeType=e}setFpsFromScriptData(e){var t;let{data:i}=e;const s=null==i||null===(t=i.onMetaData)||void 0===t?void 0:t.framerate;s&&s>0&&s<100&&(this.fps=s)}setVideoMeta(e){if(this.width=e.width,this.height=e.height,this.videoCodec=e.codec,this.encodeType=e.codecType,e.fpsNum&&e.fpsDen){const t=e.fpsNum/e.fpsDen;t>0&&t<100&&(this.fps=t)}}setAudioMeta(e){this.audioCodec=e.codec,this.samplerate=e.sampleRate,this.channelCount=e.channelCount}setDomain(e){this.domain=e.split("/").slice(2,3)[0]}updateBitrate(e){if((!this.fps||this.fps>=100)&&e.length){const t=e.reduce(((e,t)=>e+t.duration),0)/e.length;this.fps=Math.round(this._timescale/t)}e.forEach((e=>{1===e.gopId&&this.gop++,this._bitsAccumulateDuration+=e.duration/(this._timescale/1e3),this._bitsAccumulateSize+=e.units.reduce(((e,t)=>e+t.length),0),this._bitsAccumulateDuration>=1e3&&(this.bitrate=8*this._bitsAccumulateSize,this._bitsAccumulateDuration=0,this._bitsAccumulateSize=0)}))}}class dv{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;ph(this,"_core",null),ph(this,"_samples",[]),this._core=e,this._timescale=t,this._stats=new lv(t),this._bindEvents()}getStats(){var e,t,i,s,r,o,a;const{currentTime:n=0,decodeFps:l=0}=(null===(e=this._core)||void 0===e?void 0:e.media)||{};return{...this._stats.getStats(),downloadSpeed:(null===(t=this._core)||void 0===t||null===(i=t.speedInfo)||void 0===i?void 0:i.call(t).speed)||0,avgSpeed:(null===(s=this._core)||void 0===s||null===(r=s.speedInfo)||void 0===r?void 0:r.call(s).avgSpeed)||0,currentTime:n,bufferEnd:(null===(o=this._core)||void 0===o||null===(a=o.bufferInfo())||void 0===a?void 0:a.remaining)||0,decodeFps:l}}_bindEvents(){this._core.on(Is,(e=>this._stats.updateBitrate(e.samples))),this._core.on(Bs,(e=>{this._stats.setFpsFromScriptData(e)})),this._core.on(Ms,(e=>{"video"===e.type?this._stats.setVideoMeta(e.track):this._stats.setAudioMeta(e.track)})),this._core.on(Fs,(e=>{this._stats.setDomain(e.responseUrl)}))}reset(){this._samples=[],this._stats=new lv(this._timescale)}}class hv extends o{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),ph(this,"_loadSegment",(async()=>{if(this._segmentProcessing)return void this.player.debugWarn("_loadSegment()","_segmentProcessing is ture and return");if(!this._playlist)return void this.player.debugWarn("_loadSegment()","this._playlist is null and return");const e=this._playlist.currentSegment,t=this._playlist.nextSegment;if(this.player.debugLog(this.TAG_NAME,"_loadSegment()","curSeg",e&&e.url,"nextSeg",t&&t.url),t)return this._loadSegmentDirect();this.player.debugLog(this.TAG_NAME,"nextSeg is null and return")})),this.player=e,this.config=null,this._manifestLoader=null,this._segmentLoader=null,this._playlist=null,this._bufferService=null,this._seiService=null,this._stats=null,this._prevSegSn=null,this._prevSegCc=null,this._tickTimer=null,this._tickInterval=500,this._segmentProcessing=!1,this._reloadOnPlay=!1,this._switchUrlOpts=null,this._disconnectTimer=null,this.TAG_NAME="Hls256",this.canVideoPlay=!1,this.$videoElement=null,this.config=t=function(e){return{isLive:!0,maxPlaylistSize:50,retryCount:3,retryDelay:1e3,pollRetryCount:2,loadTimeout:1e4,preloadTime:30,softDecode:!1,bufferBehind:10,maxJumpDistance:3,startTime:0,targetLatency:10,maxLatency:20,allowedStreamTrackChange:!0,...e}}(t),this._manifestLoader=new Mb(this),this._segmentLoader=new Ub(this),this._playlist=new Nb(this),this._bufferService=new av(this),this._seiService=new nv(this),this._stats=new dv(this,9e4),this.player.debugLog(this.TAG_NAME,"init")}async destroy(){this.player.debugLog(this.TAG_NAME,"destroy()"),this._playlist.reset(),this._segmentLoader.reset(),this._seiService.reset(),await Promise.all([this._clear(),this._bufferService.destroy()]),this._manifestLoader&&(await this._manifestLoader.destroy(),this._manifestLoader=null),this._segmentLoader&&(this._segmentLoader.destroy(),this._segmentLoader=null),this._playlist&&(this._playlist.destroy(),this._playlist=null),this.player.debugLog(this.TAG_NAME,"destroy end")}_startTick(){this._stopTick(),this._tickTimer=setTimeout((()=>{this._tick()}),this._tickInterval)}_stopTick(){this._tickTimer&&clearTimeout(this._tickTimer),this._tickTimer=null}_tick(){this.player.isDestroyedOrClosed()?this.player.debugLog(this.TAG_NAME,"_tick() player is destroyed"):(this._startTick(),this._loadSegment())}get isLive(){return this._playlist.isLive}get streams(){return this._playlist.streams}get currentStream(){return this._playlist.currentStream}get hasSubtitle(){return this._playlist.hasSubtitle}get baseDts(){var e;return null===(e=this._bufferService)||void 0===e?void 0:e.baseDts}speedInfo(){return this._segmentLoader.speedInfo()}resetBandwidth(){this._segmentLoader.resetBandwidth()}getStats(){return this._stats.getStats()}async loadSource(e){return await this._reset(),await this._loadData(e),this._startTick(),!0}async _loadData(e){try{e&&(e=e.trim())}catch(e){}if(!e)throw this._emitError(new fb(hb,hb,null,null,"m3u8 url is missing"));const t=await this._loadM3U8(e),{currentStream:i}=this._playlist;if(this._urlSwitching){var s,r;if(0===i.bitrate&&null!==(s=this._switchUrlOpts)&&void 0!==s&&s.bitrate)i.bitrate=null===(r=this._switchUrlOpts)||void 0===r?void 0:r.bitrate;const e=this._getSeamlessSwitchPoint();this.config.startTime=e;const t=this._playlist.findSegmentIndexByTime(e),o=this._playlist.getSegmentByIndex(t+1);if(o){const e=o.start;this.player.debugWarn(this.TAG_NAME,`clear buffer from ${e}`)}}t&&(this.isLive?(this.player.debugLog(this.TAG_NAME,"is live"),this._bufferService.setLiveSeekableRange(0,4294967295),this.config.targetLatency{let[t,i,a]=e;t?(this._playlist.upsertPlaylist(t,i,a),this.isLive&&this._pollM3U8(s,r,o)):this.player.debugWarn(this.TAG_NAME,"_refreshM3U8() mediaPlaylist is empty")})).catch((e=>{throw this._emitError(fb.create(e))}))}_pollM3U8(e,t,i){var s;let r=this._playlist.isEmpty;this._manifestLoader.poll(e,t,i,((e,t,i)=>{this._playlist.upsertPlaylist(e,t,i),this._playlist.clearOldSegment(),e&&r&&!this._playlist.isEmpty&&this._loadSegment(),r&&(r=this._playlist.isEmpty)}),(e=>{this._emitError(fb.create(e))}),1e3*((null===(s=this._playlist.lastSegment)||void 0===s?void 0:s.duration)||0))}async _loadSegmentDirect(){const e=this._playlist.nextSegment;if(!e)return void this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect() !seg");let t=!1,i=null;try{this._segmentProcessing=!0,t=await this._reqAndBufferSegment(e,this._playlist.getAudioSegment(e))}catch(e){i=e}finally{this._segmentProcessing=!1}return i?this._emitError(fb.create(i)):(t?(this._urlSwitching&&(this._urlSwitching=!1,this.emit(Vs,{url:this.config.url})),this._playlist.moveSegmentPointer(),this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect()","seg.isLast",e.isLast),e.isLast?(this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect()","seg.isLast"),this._end()):(this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect()","and next _loadSegment()"),this._loadSegment())):this.player.debugLog(this.TAG_NAME,"_loadSegmentDirect() not appended"),t)}async _reqAndBufferSegment(e,t){this.player.debugLog(this.TAG_NAME,"video seg",e&&e.url,"audio seg",t&&t.url);const i=e?e.cc:t.cc,s=this._prevSegCc!==i;let r=[];try{r=await this._segmentLoader.load(e,t,s)}catch(e){throw e.fatal=!1,this._segmentLoader.error=e,e}if(!r[0])return;const o=await this._bufferService.decryptBuffer(...r);if(!o)return void this.player.debugLog(this.TAG_NAME,"decryptBuffer return null");const a=e?e.sn:t.sn,n=e?e.start:t.start,l=this._playlist.currentStream;return this._bufferService.createSource(o[0],o[1],null==l?void 0:l.videoCodec,null==l?void 0:l.audioCodec),await this._bufferService.appendBuffer(e,t,o[0],o[1],s,this._prevSegSn===a-1,n),this._prevSegCc=i,this._prevSegSn=a,!0}async _clear(){this.player.debugLog(this.TAG_NAME,"_clear()"),clearTimeout(this._disconnectTimer),this._stopTick(),await Promise.all([this._segmentLoader.cancel(),this._manifestLoader.stopPoll()]),this._segmentProcessing=!1}async _reset(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.player.debugLog(this.TAG_NAME,"_reset()"),this._reloadOnPlay=!1,this._prevSegSn=null,this._prevSegCc=null,this._switchUrlOpts=null,this._playlist.reset(),this._segmentLoader.reset(),this._seiService.reset(),this._stats.reset(),await this._clear(),this._bufferService.reset(e)}_end(){this.player.debugLog(this.TAG_NAME,"_end()"),this._clear()}_emitError(e){var t;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;!1===(null===(t=e.originError)||void 0===t?void 0:t.fatal)?console.warn(e):(console.table(e),console.error(e),console.error(null===(s=this.media)||void 0===s?void 0:s.error),this._stopTick(),this._urlSwitching&&(this._urlSwitching=!1,this.emit($s,e)),i&&this._end(),this._seiService.reset(),this.emit(qs,e));return e}_getSeamlessSwitchPoint(){const{media:e}=this;let t=e.currentTime;if(!e.paused){var i;const s=this._playlist.findSegmentIndexByTime(e.currentTime),r=this._playlist.getSegmentByIndex(s),o=null===(i=this._stats)||void 0===i?void 0:i.getStats().downloadSpeed;if(o&&r){t+=r.duration*this._playlist.currentStream.bitrate/o+1}else t+=5}return t}getDemuxBuferredDuration(){return this._bufferService.getBuferredDuration()||0}getDemuxBufferedListLength(){return this._bufferService.getBufferedSegments()||0}getDemuxAudioBufferedListLength(){return this._bufferService.getBufferedAudioSegments()||0}getDemuxVideoBufferedListLength(){return this._bufferService.getBufferedVideoSegments()||0}}class cv extends o{constructor(e){super(),ph(this,"TAG_NAME","Hls256Decoder"),this.player=e,this.$videoElement=this.player.video.$videoElement,this.hls=null,this.eventsDestroy=[],this.bandwidthEstimateInterval=null,this.hls=new hv(e),this._bindEvents()}async destroy(){return this._stopBandwidthEstimateInterval(),this.hls&&(await this.hls.destroy(),this.hls=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this.$videoElement=null,this.player.debugLog(this.TAG_NAME,"destroy"),!0}_bindEvents(){this.hls.on(qs,(e=>{this.player.emitError(dt.hlsError,e)})),this._startBandwidthEstimateInterval()}_startBandwidthEstimateInterval(){this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((()=>{const e=this.hls.speedInfo();this.player.emit(at.kBps,(e.avgSpeed/1024/8).toFixed(2)),this.hls.resetBandwidth()}),1e3)}_stopBandwidthEstimateInterval(){this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}async loadSource(e){return this.url=e,await this.hls.loadSource(e),!0}checkHlsBufferedDelay(){let e=0;return this.hls&&(e=this.hls.getDemuxBuferredDuration()),e}getDemuxBufferedListLength(){let e=0;return this.hls&&(e=this.hls.getDemuxBufferedListLength()),e}getDemuxAudioBufferedListLength(){let e=0;return this.hls&&(e=this.hls.getDemuxAudioBufferedListLength()),e}getDemuxVideoBufferedListLength(){let e=0;return this.hls&&(e=this.hls.getDemuxVideoBufferedListLength()),e}}class uv extends o{constructor(e,t){if(super(),this.player=e,this.player.$container.classList.add("jb-pro-container-playback"),this._showPrecision=null,this._startTime=null,this._playStartTime=null,this._playingTimestamp=null,this._fps=parseInt(t.fps,10)||e._opt.playbackFps,this._isUseFpsRender=!!ya(t.isUseFpsRender),this._rate=1,this._audioTimestamp=0,this._videoTimestamp=0,this.controlType=t.controlType||X.normal,t.controlType&&-1===[X.normal,X.simple].indexOf(t.controlType)&&(this.player.debugWarn("Playback","constructor()","controlType is not in [normal,simple]",t.controlType),this.controlType=X.normal),this._currentLocalTimestamp=0,this._localOneFrameTimestamp=t.localOneFrameTimestamp||40,this._localCalculateTimeInterval=null,this._isUseLocalCalculateTime=!!ya(t.isUseLocalCalculateTime),this._isPlaybackPauseClearCache=!Aa(t.isPlaybackPauseClearCache),this._isCacheBeforeDecodeForFpsRender=!!ya(t.isCacheBeforeDecodeForFpsRender),this._startfpsTime=null,this._startFpsTimestamp=null,this._checkStatsInterval=null,this._playbackTs=0,this._renderFps=0,this._isUseLocalCalculateTime?this._startLocalCalculateTime():this._listen(),this.playbackList=[],this._playbackListStartTimestamp=null,this._totalDuration=0,t.controlType===X.normal)this.initPlaybackList(t.playList,t.showPrecision,t.startTime);else if(t.controlType===X.simple){t.duration&&(this._totalDuration=1e3*t.duration);let e=t.startTime||0;e>this.totalDuration&&(e=this.totalDuration),this.setStartTime(e)}this.player.on(at.playbackPause,(e=>{e?this.pause():this.resume()}));const i={fps:this._fps,isUseFpsRender:this._isUseFpsRender,localOneFrameTimestamp:this._localOneFrameTimestamp,isUseLocalCalculateTime:this._isUseLocalCalculateTime,uiUsePlaybackPause:t.uiUsePlaybackPause,showControl:t.showControl};try{e.debugLog("Playback","init",JSON.stringify(i))}catch(t){e.debugLog("Playback","init",i)}}destroy(){this._startTime=null,this._showPrecision=null,this._playStartTime=null,this._playingTimestamp=null,this._totalDuration=0,this._audioTimestamp=0,this._videoTimestamp=0,this._fps=null,this._isUseFpsRender=!1,this._rate=1,this.playbackList=[],this._playbackListStartTimestamp=null,this._localCalculateTimeInterval=null,this._currentLocalTimestamp=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._renderFps=0,this._playbackTs=0,this._stopLocalCalculateTime(),this.clearStatsInterval(),this.player.$container&&this.player.$container.classList.remove("jb-pro-container-playback"),this.off(),this.player.debugLog("Playback","destroy")}_listen(){this.player.on(at.stats,(e=>{const t=e.ts;this._playStartTime||(this._playStartTime=t-1e3);let i=t-this._playStartTime;this.setPlayingTimestamp(i)}))}pause(){this.clearStatsInterval()}resume(){this.startCheckStatsInterval()}updateStats(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._startFpsTimestamp||(this._startFpsTimestamp=oo()),Mo(e.ts)&&(this.player.updateStats({fps:!0,ts:e.ts}),this._playbackTs=e.ts,this._startfpsTime||(this._startfpsTime=e.ts),this._renderFps+=1);const t=oo(),i=t-this._startFpsTimestamp;if(i<1e3)return;let s=null;this._startfpsTime&&(s=this._playbackTs-this._startfpsTime),this.player.emit(at.playbackStats,{fps:this._renderFps,rate:this.rate,start:this._startfpsTime,end:this._playbackTs,timestamp:i,dataTimestamp:s,audioBufferSize:this.player.audio?this.player.audio.bufferSize:0,videoBufferSize:this.player.video?this.player.video.bufferSize:0,ts:this._playbackTs}),this._renderFps=0,this._startfpsTime=this._playbackTs,this._startFpsTimestamp=t}updateLocalOneFrameTimestamp(e){this._localOneFrameTimestamp=e}_startLocalCalculateTime(){this._stopLocalCalculateTime(),this._localCalculateTimeInterval=setInterval((()=>{const e=this._currentLocalTimestamp;this._playStartTime||(this._playStartTime=e-1e3);let t=e-this._playStartTime;this.setPlayingTimestamp(t)}),1e3)}startCheckStatsInterval(){this.clearStatsInterval(),this._checkStatsInterval=setInterval((()=>{this.updateStats()}),1e3)}_stopLocalCalculateTime(){this._localCalculateTimeInterval&&(clearInterval(this._localCalculateTimeInterval),this._localCalculateTimeInterval=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}increaseLocalTimestamp(){this._isUseLocalCalculateTime&&(this._currentLocalTimestamp+=this._localOneFrameTimestamp)}initPlaybackList(e,t,i){this.playbackList=e||[];let s=0;if(this.playbackList.forEach(((e,t)=>{10===Ho(e.start)?(e.startTimestamp=1e3*e.start,e.startTime=_o(e.startTimestamp)):(e.startTimestamp=e.start,e.startTime=_o(e.startTimestamp)),10===Ho(e.end)?(e.endTimestamp=1e3*e.end,e.endTime=_o(e.endTimestamp)):(e.endTimestamp=e.end,e.endTime=_o(e.endTimestamp)),e.duration=e.end-e.start,s+=e.duration})),this._totalDuration=s,this.player.debugLog("Playback",this.playbackList),this.playbackList.length>0){const e=this.playbackList[0].startTimestamp;this._playbackListStartTimestamp=e;let t=e;i&&(10===Ho(i)&&(i*=1e3),this._isTimeInPlaybackList(i)&&(t=i)),this.setStartTime(t)}const r=t||Ei;this.setShowPrecision(r)}get totalDuration(){return(this._totalDuration||0)/1e3}get startTime(){return this._startTime||0}setStartTime(e){this._startTime=e,this._playingTimestamp=e,this._playStartTime=null}setRate(e){this._rate=e,this.player.emit(at.playbackRateChange,e)}get fps(){return this._fps}get rate(){return this._rate}get isUseFpsRender(){return this._isUseFpsRender}get isUseLocalCalculateTime(){return this._isUseLocalCalculateTime}get showPrecision(){return this._showPrecision}get is60Min(){return this.showPrecision===Ei}get is30Min(){return this.showPrecision===Ti}get is10Min(){return this.showPrecision===ki}get is5Min(){return this.showPrecision===Li}get is1Min(){return this.showPrecision===Li}get isPlaybackPauseClearCache(){return this._isPlaybackPauseClearCache}get isCacheBeforeDecodeForFpsRender(){return this._isCacheBeforeDecodeForFpsRender}setShowPrecision(e){xi.includes(e)||(this.player.debugWarn("Playback","setShowPrecision()","type is not in PLAYBACK_CONTROL_TIME_PRECISION_ARRAY",e),e=Ei),this._showPrecision&&this._showPrecision===e||(this._showPrecision=e,this.player.emit(at.playbackPrecision,this._showPrecision,this.playbackList),this.player.emit(at.playbackShowPrecisionChange,this._showPrecision))}setPlayingTimestamp(e){let t;if(this.controlType===X.normal){t=this.startTime+e,this._playingTimestamp=t,this.player.emit(at.playbackTime,t);const i=new Date(t);this.player.emit(at.playbackTimestamp,{ts:t,hour:i.getHours(),min:i.getMinutes(),second:i.getSeconds()})}else this.controlType===X.simple&&(t=this.startTime+Math.round(e/1e3),t>this.totalDuration&&(this.player.debugLog("Playback","setPlayingTimestamp()",`timestamp ${t} > this.totalDuration ${this.totalDuration}`),t=this.totalDuration),this._playingTimestamp=t,this.player.emit(at.playbackTime,t),this.player.emit(at.playbackTimestamp,{ts:t}))}get playingTimestamp(){return this._playingTimestamp}narrowPrecision(){const e=xi.indexOf(this.showPrecision)-1;if(e>=0){const t=xi[e];this.setShowPrecision(t)}}expandPrecision(){const e=xi.indexOf(this.showPrecision)+1;if(e<=xi.length-1){const t=xi[e];this.setShowPrecision(t)}}seek(e){if(this.player.debugLog("Playback","seek()",e),this.controlType===X.normal){if("true"===e.hasRecord){let t=e.time;"min"===e.type&&(t=60*e.time);let i=function(e){let t={};e>-1&&(t={hour:Math.floor(e/60/60)%60,min:Math.floor(e/60)%60,second:e%60});return t}(t);if(this._playbackListStartTimestamp){const e=new Date(this._playbackListStartTimestamp).setHours(i.hour,i.min,i.second,0);i.timestamp=e;const t=this._findMoreInfoByTimestamp(e);i&&t.more&&(i.more=t.more)}this.player.emit(at.playbackSeek,i)}}else if(this.controlType===X.simple){let t=e.time;this.player.emit(at.playbackSeek,{ts:t})}}currentTimeScroll(){this.player.emit(at.playbackTimeScroll)}_findMoreInfoByTimestamp(e){let t=null;return this.playbackList.forEach(((i,s)=>{i.startTimestamp<=e&&i.endTimestamp>=e&&(t=i)})),t}_isTimeInPlaybackList(e){let t=!1;return this.playbackList.forEach(((i,s)=>{i.startTimestamp<=e&&i.endTimestamp>=e&&(t=!0)})),t}getControlType(){return this.controlType}isControlTypeNormal(){return this.controlType===X.normal}isControlTypeSimple(){return this.controlType===X.simple}isPlaybackPauseNotClearCacheAndCacheBeforeDecode(){return Aa(this.isPlaybackPauseClearCache)&&this.isCacheBeforeDecodeForFpsRender}isPlaybackPauseNotClearCacheAndCacheBeforeDecodeAndUseFpsRender(){return this.isPlaybackPauseNotClearCacheAndCacheBeforeDecode()&&this.isUseFpsRender}}class pv extends o{constructor(e){super(),this.player=e,this.TAG_NAME="zoom",this.bindEvents=[],this.isDragging=!1,this.isGesturing=!1,this.currentZoom=1,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,this.prevGestureScale=null,this.prevGestureTouches=[],this._isZooming=!1,this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.player,this.player.on(at.zooming,this._handleZooming.bind(this)),e.debugLog("zoom","init")}destroy(){this._unbindEvents(),this.bindEvents=[],this.isDragging=!1,this.currentZoom=1,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.off(),this.player.debugLog("zoom","destroy")}_handleZooming(e){if(e){this.player.$container.classList.add("jb-pro-zoom-control"),this._bindEvents();const e=this.player.video.$videoElement.style.transform;let t=this.player.video.$videoElement.offsetLeft,i=this.player.video.$videoElement.offsetTop;t=parseFloat(t),i=parseFloat(i),t&&(this.videoPosition.left=t),i&&(this.videoPosition.top=i),this.prevVideoElementStyleTransform=e;let s=e.match(/scale\([0-9., ]*\)/g);if(s&&s[0]){let e=s[0].replace("scale(","").replace(")","");this.prevVideoElementStyleScale=e.split(",")}this._isZooming=!0}else{this.player.$container.classList.remove("jb-pro-zoom-control"),this._unbindEvents(),this._resetVideoPosition(),this.player.$container.style.cursor="auto";let e=this.prevVideoElementStyleTransform;this.player.video.$videoElement.style.transform=e,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,fo()&&this.player._opt.useWebFullScreen&&this.player.resize(),this._isZooming=!1}}_bindEvents(){const{events:{proxy:e}}=this.player,t=xa(),i=e(this.player.$container,t.move,this.handleMouseMove.bind(this)),s=e(this.player.$container,t.down,this.handleMouseDown.bind(this)),r=e(window,t.up,this.handleMouseUp.bind(this));if(this.bindEvents.push(i,s,r),fo()&&this.player._opt.zoomSupportGestureInMobile)if(go()){this.handleGestureChangeThrottle=To(this.handleGestureChangeForAndroid.bind(this),100);const t=e(this.player.$container,"touchstart",this.handleGestureStartForAndroid.bind(this)),i=e(this.player.$container,"touchmove",this.handleGestureChangeThrottle.bind(this)),s=e(this.player.$container,"touchend",this.handleGestureEndForAndroid.bind(this));this.bindEvents.push(t,i,s)}else{this.handleGestureChangeThrottle=To(this.handleGestureChange.bind(this),100);const t=e(this.player.$container,"gesturestart",this.handleGestureStart.bind(this)),i=e(this.player.$container,"gesturechange",this.handleGestureChangeThrottle.bind(this)),s=e(this.player.$container,"gestureend",this.handleGestureEnd.bind(this));this.bindEvents.push(t,i,s)}}_unbindEvents(){this.bindEvents.forEach((e=>{e&&e()}))}handleMouseMove(e){if(e.stopPropagation(),this.isDragging&&this.player.zooming){e.preventDefault();const{posX:t,posY:i}=ta(e),s=this.tempPosition.x-t,r=this.tempPosition.y-i;this.videoPosition.left=this.videoPosition.left-s,this.videoPosition.top=this.videoPosition.top-r,this.tempPosition.x=t,this.tempPosition.y=i,this.updateVideoPosition()}}handleMouseDown(e){e.stopPropagation();const t=Xo(e);if(this.player.zooming&&(t.matches("video")||t.matches("canvas"))){e.preventDefault();const{posX:t,posY:i}=ta(e);this.player.$container.style.cursor="grabbing",this.tempPosition.x=t,this.tempPosition.y=i,this.isDragging=!0,this.player.debugLog("zoom","handleMouseDown is dragging true")}}handleMouseUp(e){e.stopPropagation(),this.isDragging&&this.player.zooming&&(e.preventDefault(),this.tempPosition={x:0,y:0},this.isDragging=!1,this.player.$container.style.cursor="grab",this.player.debugLog("zoom","handleMouseUp is dragging false"))}handleGestureStart(e){e.stopPropagation(),this.player.zooming&&(null===this.prevGestureScale&&(this.prevGestureScale=e.scale),this.isGesturing=!0)}handleGestureStartForAndroid(e){e.stopPropagation(),this.player.zooming&&e.touches.length>=2&&(this.isGesturing=!0,this.prevGestureTouches=e.touches)}handleGestureChangeForAndroid(e){if(e.stopPropagation(),e.preventDefault(),this.player.zooming&&this.isGesturing&&e.touches.length>=2){const s=e.touches,r=t(s[0],s[1])/t(this.prevGestureTouches[0],this.prevGestureTouches[1]);i(s[0],s[1]),i(this.prevGestureTouches[0],this.prevGestureTouches[1]),null===this.prevGestureScale&&(this.prevGestureScale=r);const o=r-this.prevGestureScale,a=this.player._opt.zoomSupportGestureInMobileSpeed;o>0?this.expandPrecision(a):o<0&&this.narrowPrecision(a)}function t(e,t){var i=t.pageX-e.pageX,s=t.pageY-e.pageY;return Math.sqrt(i*i+s*s)}function i(e,t){var i=e.pageX-t.pageX,s=e.pageY-t.pageY;return 180*Math.atan2(s,i)/Math.PI}}handleGestureEndForAndroid(e){e.stopPropagation(),this.player.zooming&&(this.prevGestureScale=null,this.isGesturing=!1,this.prevGestureTouches=[])}handleGestureChange(e){if(e.stopPropagation(),this.player.zooming&&this.isGesturing&&null!==this.prevGestureScale){const t=e.scale,i=t-this.prevGestureScale,s=this.player._opt.zoomSupportGestureInMobileSpeed;i>0?this.expandPrecision(s):i<0&&this.narrowPrecision(s),this.prevGestureScale=t}}handleGestureEnd(e){e.stopPropagation(),this.player.zooming&&(this.prevGestureScale=null,this.isGesturing=!1)}updateVideoPosition(){const e=this.player.video.$videoElement;e.style.left=this.videoPosition.left+"px",e.style.top=this.videoPosition.top+"px"}_resetVideoPosition(){this.player.resize(),this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.currentZoom=1,this.isDragging=!1}narrowPrecision(e){this.currentZoom<=1||(this.currentZoom-=1,this.updateVideoElementScale(e))}expandPrecision(e){this.currentZoom>=this.player._opt.zoomMaxScale||(this.currentZoom+=1,this.updateVideoElementScale(e))}updateCurrentZoom(e,t){e<1||e>this.player._opt.zoomMaxScale||(this.currentZoom=e,this.updateVideoElementScale(t))}updatePrevVideoElementStyleScale(e){this.prevVideoElementStyleScale=e}updateVideoElementScale(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5;const t=this.player.video.$videoElement;let i=t.style.transform,s=1,r=1;if(this.prevVideoElementStyleScale){const e=this.prevVideoElementStyleScale[0];void 0!==e&&(s=e,r=e);const t=this.prevVideoElementStyleScale[1];void 0!==t&&(r=t)}r=So(r),s=So(s);const o=e*s*(this.currentZoom-1)+s,a=e*r*(this.currentZoom-1)+r;let n;n=-1===i.indexOf("scale(")?i+` scale(${o},${a})`:i.replace(/scale\([0-9., ]*\)/,`scale(${o},${a})`),this.player.debugLog("zoom",`updateVideoElementScale end is X: ${s} -> ${o}, Y: ${r} -> ${a} style is ${n}`),t.style.transform=n}isZooming(){return this._isZooming}}class fv extends o{constructor(e){super(),this.player=e,this.faceDetector=null,this.objectDetector=null,this.imageDetector=null,this.occlusionDetector=null,this.initFaceDetector(),this.initObjectDetector(),this.initImageDetector(),this.initOcclusionDetector();let t="init";this.faceDetector&&(t+=" and use faceDetector"),this.objectDetector&&(t+=" and use objectDetector"),this.imageDetector&&(t+=" and use imageDetector"),this.occlusionDetector&&(t+=" and use occlusionDetector"),this.player.debugLog("AiLoader",t)}destroy(){this.off(),this.faceDetector&&(this.faceDetector.destroy(),this.faceDetector=null),this.objectDetector&&(this.objectDetector.destroy(),this.objectDetector=null),this.imageDetector&&(this.imageDetector.destroy(),this.imageDetector=null),this.occlusionDetector&&(this.occlusionDetector.destroy(),this.occlusionDetector=null),this.player.debugLog("AiLoader","destroy")}initFaceDetector(){if(this.player._opt.useFaceDetector&&window.JessibucaProFaceDetector){const e=new JessibucaProFaceDetector({detectWidth:this.player._opt.aiFaceDetectWidth,showRect:!1,debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debugLog("AiLoader","init face detector success"),this.faceDetector=e,this.faceDetector.on("jessibuca-pro-face-detector-info",(e=>{if(this.player.emit(at.aiFaceDetectorInfo,e),this.player._opt.aiFaceDetectShowRect){const t=this.player._opt.aiFaceDetectRectConfig||{},i=(e.list||[]).map((e=>(e.type="rect",e.color=t.borderColor||"#0000FF",e.lineWidth=t.borderWidth||2,e)));this.player.video&&this.player.video.addAiContentToCanvas(i)}}))}))}}initObjectDetector(){if(this.player._opt.useObjectDetector&&window.JessibucaProObjectDetector){const e=new JessibucaProObjectDetector({detectWidth:this.player._opt.aiObjectDetectWidth,showRect:!1,debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debugLog("AiLoader","init object detector success"),this.objectDetector=e,this.objectDetector.on("jessibuca-pro-object-detector-info",(e=>{if(this.player.emit(at.aiObjectDetectorInfo,e),this.player._opt.aiObjectDetectShowRect){const t=[],i=this.player._opt.aiObjectDetectRectConfig||{};(e.list||[]).forEach((e=>{const s={type:"rect",color:i.borderColor||"#0000FF",lineWidth:i.borderWidth||2,x:e.rect.x,y:e.rect.y,width:e.rect.width,height:e.rect.height},r={type:"text",color:i.color||"#000",fontSize:i.fontSize||14,text:e.zh,x:e.rect.x,y:e.rect.y-25};t.push(s,r)})),this.player.video&&this.player.video.addAiContentToCanvas(t)}}))}))}}initImageDetector(){if(this.player._opt.useImageDetector&&window.JessibucaProImageDetector){const e=new JessibucaProImageDetector({debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debugLog("AiLoader","init image detector success"),this.imageDetector=e}))}}initOcclusionDetector(){if(this.player._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector){const e=new JessibucaProOcclusionDetector({debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debugLog("AiLoader","init occlusion detector success"),this.occlusionDetector=e}))}}updateFaceDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.faceDetector&&this.faceDetector.updateConfig(e)}updateObjectDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.objectDetector&&this.objectDetector.updateConfig(e)}updateImageDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.imageDetector&&this.imageDetector.updateConfig(e)}updateOcclusionDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.occlusionDetector&&this.occlusionDetector.updateConfig(e)}}class mv extends o{constructor(e){super(),this.player=e,this.LOG_NAME="Contextmenu",this.menuList=[],this.$contextmenus=e.control.$contextmenus,fo()?this.player.debugWarn(this.LOG_NAME,"not support mobile"):this.init(),e.debugLog(this.LOG_NAME,"init")}destroy(){this.menuList=[],this.player.debugLog(this.LOG_NAME,"destroy")}get isShow(){return e=this.player.$container,t="jb-pro-contextmenus-show",e.classList.contains(t);var e,t}show(){nc(this.player.$container,"jb-pro-contextmenus-show")}hide(){var e,t;e=this.player.$container,t="jb-pro-contextmenus-show",e.classList.remove(t)}init(){const{events:{proxy:e},debug:t}=this.player;this.player._opt.contextmenuBtns.length>0&&this.player._opt.contextmenuBtns.forEach((e=>{this.addMenuItem(e)})),e(this.player.$container,"contextmenu",(e=>{e.preventDefault(),this.show();const t=e.clientX,i=e.clientY,{height:s,width:r,left:o,top:a}=this.player.$container.getBoundingClientRect(),{height:n,width:l}=this.$contextmenus.getBoundingClientRect();let d=t-o,h=i-a;t+l>o+r&&(d=r-l),i+n>a+s&&(h=s-n),no(this.$contextmenus,{left:`${d}px`,top:`${h}px`})})),e(this.player.$container,"click",(e=>{hc(e,this.$contextmenus)||this.hide()})),this.player.on(at.blur,(()=>{this.hide()}))}_validateMenuItem(e){let t=!0;return e.content||(this.player.debugWarn(this.LOG_NAME,"content is required"),t=!1),t}addMenuItem(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=pa(Es);if(e=Object.assign({},t,e),!this._validateMenuItem(e))return;const{events:{proxy:i},debug:s}=this.player,r=Eo(),o=`\n
\n ${e.content}\n
\n `,a=Array.from(this.$contextmenus.children)[e.index];a?a.insertAdjacentHTML("beforebegin",o):lc(this.$contextmenus,o);const n=this.$contextmenus.querySelector(`.jb-pro-contextmenu-${r}`);e.click&&i(n,"click",(t=>{t.preventDefault(),e.click.call(this.player,this,t),this.hide()})),this.menuList.push({uuid:r,$menuItem:n})}}class gv extends o{constructor(e){super(),this.player=e,this.TAG_NAME="CommonWebrtc",this.rtcPeerConnection=null,this.videoStream=null,this.isDisconnected=!1,this.isH264=this.player.isWebrtcH264(),this.eventsDestroy=[],this.supportVideoFrameCallbackHandle=null,this.isInitInfo=!1,this.$videoElement=this.player.video.$videoElement,this.bandwidthEstimateInterval=null,this.rtcPeerTrackVideoReceiver=null,this.rtcPeerTrackAudioReceiver=null,this.prevWebrtcVideoStats={},this.prevWebrtcAudioStats={},this.currentWebrtcStats={},this.player._opt.webrtcUseCanvasRender&&this.isH264&&(this.$videoElement=document.createElement("video"),vo()&&(this.$videoElement.style.position="absolute"),this._initVideoEvents()),this.$videoElement.muted=!0,this._initRtcPeerConnection()}destroy(){if(this.isDisconnected=!1,this.isInitInfo=!1,this.prevWebrtcVideoStats={},this.currentWebrtcStats={},this.rtcPeerTrackVideoReceiver=null,this.rtcPeerTrackAudioReceiver=null,this._stopBandwidthEstimateInterval(),this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this.isH264&&(this.videoStream&&(this.videoStream.getTracks().forEach((e=>e.stop())),this.videoStream=null),this.$videoElement))if(this.player._opt.webrtcUseCanvasRender){this.$videoElement.pause&&(this.$videoElement.pause(),this.$videoElement.muted=!0),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"));try{this.$videoElement.load()}catch(e){}}else this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject"));this.$videoElement=null,this.rtcPeerConnection&&(this.rtcPeerConnection.onicecandidate=to,this.rtcPeerConnection.ontrack=to,this.rtcPeerConnection.onconnectionstatechange=to,this.rtcPeerConnection.ondatachannel=to,this.rtcPeerConnection.close(),this.rtcPeerConnection=null)}_initVideoEvents(){const{proxy:e}=this.player.events,t=e(this.$videoElement,Xi,(()=>{this.player.debugLog(this.TAG_NAME,"video canplay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video play"),this._startCanvasRender(),this._initRenderSize()})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video play error ",e)}))})),i=e(this.$videoElement,Zi,(()=>{this.player.debugLog(this.TAG_NAME,"video waiting")})),s=e(this.$videoElement,es,(e=>{const t=parseInt(e.timeStamp,10);this.player.handleRender(),this.player.updateStats({ts:t}),this.$videoElement.paused&&(this.player.debugWarn(this.TAG_NAME,"video is paused and next try to replay"),this.$videoElement.play().then((()=>{this.player.debugLog(this.TAG_NAME,"video is paused and replay success")})).catch((e=>{this.player.debugWarn(this.TAG_NAME,"video is paused and replay error ",e)})))})),r=e(this.$videoElement,ts,(()=>{this.player.debugLog(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate)}));this.eventsDestroy.push(t,i,s,r)}_initRtcPeerConnection(){const e=new RTCPeerConnection,t=this.player;e.addTransceiver("video",{direction:"recvonly"}),e.addTransceiver("audio",{direction:"recvonly"}),e.onsignalingstatechange=e=>{this.player.debugLog(this.TAG_NAME,"onsignalingstatechange[本地端的信号状态]",e)},e.onicegatheringstatechange=t=>{this.player.debugLog(this.TAG_NAME,"onicegatheringstatechange[ICE收集状态]",t,e.iceGatheringState)},e.onnegotiationneeded=e=>{this.player.debugLog(this.TAG_NAME,"onnegotiationneeded[通信环境发生变化]",e)},e.oniceconnectionstatechange=i=>{this.player.debugLog(this.TAG_NAME,"oniceconnectionstatechange",e.iceConnectionState);const s=e.iceConnectionState;switch(this.player.emit(at.webrtcOnIceConnectionStateChange,s),this.isDisconnected="disconnected"===s,e.iceConnectionState){case"new":case"checking":case"closed":case"connected":case"completed":break;case"failed":t.emit(at.webrtcFailed);break;case"disconnected":t.emit(at.webrtcDisconnect);break;case"closed":t.emit(at.webrtcClosed)}},e.onicecandidate=e=>{this.player.debugLog(this.TAG_NAME,"onicecandidate",e),e.candidate&&this.player.debugLog(this.TAG_NAME,"Remote ICE candidate: ",e.candidate.candidate)},e.ontrack=t=>{if(this.player.debugLog(this.TAG_NAME,"ontrack",t),"video"===t.track.kind){this.player.debugLog(this.TAG_NAME,"ontrack video"),this.rtcPeerTrackVideoReceiver=e.getReceivers().find((function(e){return e.track===t.track})),this.rtcPeerTrackVideoReceiver&&this._startBandwidthEstimateInterval();let i=t.streams[0];this.$videoElement.autoplay=!0,this.$videoElement.srcObject=i,this.videoStream=i}else"audio"===t.track.kind&&(this.player.debugLog(this.TAG_NAME,"ontrack audio"),this.rtcPeerTrackAudioReceiver=e.getReceivers().find((function(e){return e.track===t.track})),this.rtcPeerTrackAudioReceiver&&this._startBandwidthEstimateInterval())},e.onicecandidateerror=e=>{this.player.debugLog(this.TAG_NAME,"onicecandidateerror[candidate错误]",e),this.player.emitError(dt.webrtcIceCandidateError,e)},e.onconnectionstatechange=i=>{switch(this.player.debugLog(this.TAG_NAME,"onconnectionstatechange[所有ICE 状态总览]",i),this.player.emit(at.webrtcOnConnectionStateChange,e.connectionState),e.connectionState){case"new":case"connecting":case"connected":case"disconnected":break;case"failed":this.isDisconnected&&t.emit(at.webrtcFailed)}},this.rtcPeerConnection=e}_startBandwidthEstimateInterval(){this.player.debugLog(this.TAG_NAME,"_startBandwidthEstimateInterval"),this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((()=>{this.rtcPeerTrackVideoReceiver&&this.rtcPeerTrackVideoReceiver.getStats().then((e=>{let t={},i=0;e.forEach((e=>{if(e)switch(e.type){case cr:("succeeded"===e.state||e.bytesReceived)&&(this.currentWebrtcStats.timestamp=e.timestamp,this.currentWebrtcStats.rtt=e.currentRoundTripTime||-1,this.currentWebrtcStats.bytesReceived=e.bytesReceived||0,this.currentWebrtcStats.bytesSent=e.bytesSent||0);break;case fr:this.currentWebrtcStats.remoteCandidate=e||{};break;case pr:this.currentWebrtcStats.localCandidate=e||{};break;case ur:this.currentWebrtcStats.lastTimeStamp=e.timestamp;const s=((e.timestamp||0)-(this.prevWebrtcVideoStats.timestamp||0))/1e3,r=Number(e.bytesReceived||0)-Number(this.prevWebrtcVideoStats.bytesReceived||0),o=Math.floor(r/s);i+=o,t.vbps=o,this.prevWebrtcVideoStats=e;break;case mr:e.frameWidth&&e.frameHeight&&(this.currentWebrtcStats.frameWidth=e.frameWidth||0,this.currentWebrtcStats.frameHeight=e.frameHeight||0)}})),this.rtcPeerTrackAudioReceiver?this.rtcPeerTrackAudioReceiver.getStats().then((e=>{e.forEach((e=>{if(e&&e.type===ur){this.currentWebrtcStats.lastTimeStamp=e.timestamp;const s=((e.timestamp||0)-(this.prevWebrtcAudioStats.timestamp||0))/1e3,r=Number(e.bytesReceived||0)-Number(this.prevWebrtcAudioStats.bytesReceived||0),o=Math.floor(r/s);i+=o,t.abps=o,this.prevWebrtcAudioStats=e}})),this.player.updateStats(t),this.player.emit(at.kBps,(i/1024).toFixed(2))})):(this.player.updateStats(t),this.player.emit(at.kBps,(i/1024).toFixed(2)))}))}),1e3)}_stopBandwidthEstimateInterval(){this.player.debugLog(this.TAG_NAME,"_stopBandwidthEstimateInterval"),this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}_startCanvasRender(){ka()?this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)):(this._stopCanvasRender(),this.canvasRenderInterval=setInterval((()=>{this.player.video.render({$video:this.$videoElement,ts:0})}),40))}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player.isDestroyedOrClosed()?this.player.debugLog(this.TAG_NAME,"videoFrameCallback() player is destroyed"):(this.player.video.render({$video:this.$videoElement,ts:t.mediaTime||0}),this.player.updateStats({dts:t.mediaTime||0}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)))}_initRenderSize(){this.isInitInfo||(this.player.video.updateVideoInfo({width:this.$videoElement.videoWidth,height:this.$videoElement.videoHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0)}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}isVideoPlaying(){return this.$videoElement&&Aa(this.$videoElement.paused)&&Aa(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}getVideoBufferTimeRange(){const e=this.$videoElement;let t=null;if(e){const i=e.buffered,s=i.length?i.start(0):0,r=i.length?i.end(i.length-1):0;t={start:s,end:r,diff:r-s}}return t}}class yv extends gv{constructor(e){super(e),this.TAG_NAME="WebrtcForSRSDecoder",this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy")}loadSource(e){return new Promise(((t,i)=>{const s=this.rtcPeerConnection;s.createOffer().then((r=>{s.setLocalDescription(r),this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:t})}(e,r.sdp).then((e=>{this.player.debugLog(this.TAG_NAME,`getWebRtcRemoteSdp response and code is ${e.code}`);const r=e;if(r&&0!==r.code)return this.player.debugError(this.TAG_NAME,`response json code ${r.code}`),i(r.msg);r?s.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:r})).then((()=>{t()})).catch((e=>{this.player&&this.player.debugError(this.TAG_NAME,"loadSource setRemoteDescription error",e.toString(),e),i(e)})):(this.player.debugError(this.TAG_NAME,"response sdp is null"),i("response sdp is null"))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e.toString(),e),i(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e.toString(),e),i(e)}))}))}}class Av extends gv{constructor(e){super(e),this.TAG_NAME="WebrtcForOthersDecoder",this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy")}loadSource(e){return new Promise(((t,i)=>{const s=this.rtcPeerConnection;s.createOffer().then((r=>{s.setLocalDescription(r),this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:t})}(e,r.sdp).then((e=>{this.player.debugLog(this.TAG_NAME,`getWebRtcRemoteSdp response and code is ${e.code}`),e.text().then((e=>{this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp response");try{let t=JSON.parse(e);this.player.debugLog(this.TAG_NAME,"this is json sdp response"),0!=t.code&&(this.player.debugError(this.TAG_NAME,`response json code ${t.code}`),i(new Error(`response sdp json code: ${t.code}`))),e=t.sdp}catch(e){this.player.debugLog(this.TAG_NAME,"this is raw sdp response")}e?s.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})).then((()=>{t()})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource setRemoteDescription error",e.toString(),e),i(e)})):(this.player.debugError(this.TAG_NAME,"loadSource sdp is null"),i("sdp is null"))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource response.text() error",e.toString(),e),i(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e.toString(),e),i(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e.toString(),e),i(e)}))}))}}class bv extends gv{constructor(e){super(e),this.rtcPeerConnectionDataChannel=null,this.player.isWebrtcH265()&&(this.streamRate=co((t=>{e.emit(at.kBps,(t/1024).toFixed(2))}))),this.TAG_NAME="WebrtcForM7SDecoder",this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.stopStreamRateInterval(),this.rtcPeerConnectionDataChannel&&(this.rtcPeerConnectionDataChannel.onopen=to,this.rtcPeerConnectionDataChannel.onclose=to,this.rtcPeerConnectionDataChannel.onmessage=to,this.rtcPeerConnectionDataChannel.close(),this.rtcPeerConnectionDataChannel=null),this.player.debugLog(this.TAG_NAME,"destroy")}_initRtcPeerConnection(){const e=new RTCPeerConnection,t=this.player;e.addTransceiver("video",{direction:"recvonly"}),e.addTransceiver("audio",{direction:"recvonly"}),e.onsignalingstatechange=e=>{this.player.debugLog(this.TAG_NAME,"onsignalingstatechange[本地端的信号状态]",e)},e.onicegatheringstatechange=t=>{this.player.debugLog(this.TAG_NAME,"onicegatheringstatechange[ICE收集状态]",t,e.iceGatheringState)},e.onnegotiationneeded=e=>{this.player.debugLog(this.TAG_NAME,"onnegotiationneeded[通信环境发生变化]",e)},e.oniceconnectionstatechange=i=>{this.player.debugLog(this.TAG_NAME,"oniceconnectionstatechange",e.iceConnectionState);const s=e.iceConnectionState;switch(this.player.emit(at.webrtcOnIceConnectionStateChange,s),this.isDisconnected="disconnected"===s,e.iceConnectionState){case"new":case"checking":case"closed":case"connected":case"completed":break;case"failed":t.emit(at.webrtcFailed);break;case"disconnected":t.emit(at.webrtcDisconnect);break;case"closed":t.emit(at.webrtcClosed)}},e.onicecandidate=e=>{this.player.debugLog(this.TAG_NAME,"onicecandidate",e),e.candidate&&this.player.debugLog(this.TAG_NAME,"Remote ICE candidate: ",e.candidate.candidate)},e.ontrack=i=>{this.player.debugLog(this.TAG_NAME,"ontrack",i);const s=t.video.$videoElement;if(t.isWebrtcH264())if("video"===i.track.kind){this.player.debugLog(this.TAG_NAME,"ontrack video"),this.rtcPeerTrackVideoReceiver=e.getReceivers().find((function(e){return e.track===i.track})),this.rtcPeerTrackVideoReceiver&&this._startBandwidthEstimateInterval();let t=i.streams[0];s.autoplay=!0,s.srcObject=t,this.videoStream=t}else"audio"===i.track.kind&&(this.player.debugLog(this.TAG_NAME,"ontrack audio"),this.rtcPeerTrackAudioReceiver=e.getReceivers().find((function(e){return e.track===i.track})),this.rtcPeerTrackAudioReceiver&&this._startBandwidthEstimateInterval())},e.onicecandidateerror=e=>{this.player.debugLog(this.TAG_NAME,"onicecandidateerror[candidate错误]",e),this.player.emitError(dt.webrtcIceCandidateError,e)},e.onconnectionstatechange=i=>{switch(this.player.debugLog(this.TAG_NAME,"onconnectionstatechange[所有ICE 状态总览]",i),this.player.emit(at.webrtcOnConnectionStateChange,e.connectionState),e.connectionState){case"new":case"connecting":case"connected":case"disconnected":break;case"failed":this.isDisconnected&&t.emit(at.webrtcFailed)}},e.ondatachannel=e=>{const t=e.channel;this.player.debugLog(this.TAG_NAME,"ondatachannel"),t.onopen=()=>{this.player.debugLog(this.TAG_NAME,"ondatachannel and onopen")},t.onmessage=e=>{const t=e.data;if(this.player.isWebrtcH264())return this.player.debugWarn(this.TAG_NAME,"ondatachannel is H265 but decode is h264 so emit webrtcStreamH265 "),void this.player.emit(at.webrtcStreamH265);this.player.isDestroyedOrClosed()?this.player.debugWarn(this.TAG_NAME,"ondatachannel and player is destroyed"):(this.streamRate&&this.streamRate(t.byteLength),this.player.demux&&this.player.demux.dispatch(t))},t.onclose=()=>{this.player.debugWarn(this.TAG_NAME,"ondatachannel and onclose")},this.rtcPeerConnectionDataChannel=t};e.createDataChannel("signal").onmessage=e=>{this.player.debugLog(this.TAG_NAME,"signalChannel,onmessage",e);JSON.parse(e.data).type},this.rtcPeerConnection=e}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}loadSource(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{const r=this.rtcPeerConnection;r.createOffer().then((o=>{r.setLocalDescription(o),this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t,i){let s={"Content-Type":"application/sdp"};return i.username&&i.password&&(s.Authorization="Basic "+btoa(i.username+":"+i.password)),fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:s,body:t})}(e,o.sdp,t).then((e=>{e.text().then((e=>{this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp response"),e?r.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})).then((()=>{this.player.isWebrtcH265()&&this.startStreamRateInterval(),i()})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource setRemoteDescription error",e.toString(),e),s(e)})):(this.player.debugError(this.TAG_NAME,"loadSource sdp is null"),s("sdp is null"))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource response.text() error",e.toString(),e),s(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e.toString(),e),s(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e.toString(),e),s(e)}))}))}}class vv extends gv{constructor(e){super(e),this.TAG_NAME="WebrtcForZLMDecoder",this.player.debugLog(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debugLog(this.TAG_NAME,"destroy")}loadSource(e){return new Promise(((t,i)=>{const s=this.rtcPeerConnection;s.createOffer().then((r=>{s.setLocalDescription(r),this.player.debugLog(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return Il({url:e,type:"POST",data:t,contentType:"text/plain;charset=utf-8",processData:!1,dataType:"json"})}(e,r.sdp).then((e=>{this.player.debugLog(this.TAG_NAME,`getWebRtcRemoteSdp response and code is ${e.code}`);const r=e;if(r&&0!==r.code)return this.player.debugError(this.TAG_NAME,`response json code ${r.code}`),i(r.msg);r&&r.sdp?s.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:r.sdp})).then((()=>{t()})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource setRemoteDescription error",e.toString(),e),i(e)})):(this.player.debugError(this.TAG_NAME,"response sdp is null"),i("sdp is null"))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e.toString(),e),i(e)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e.toString(),e),i(e)}))}))}}class _v extends o{constructor(e){if(super(),this.TAG_NAME="AliyunRtc",this.player=e,!window.AliRTS)throw new Error("AliyunRtc is not defined");this.aliyunRtc=window.AliRTS.createClient(),this.aliyunRtcRemoteStream=null,this.$videoElement=this.player.video.$videoElement,this.listenEvents(),this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.aliyunRtc&&(this.aliyunRtcRemoteStream&&(this.aliyunRtcRemoteStream=null),this.aliyunRtc.unsubscribe(),this.aliyunRtc=null),this.$videoElement=null,this.off(),this.player.debugLog(this.TAG_NAME,"destroy")}listenEvents(){this.aliyunRtc.on("onError",(e=>{this.player.debugLog(this.TAG_NAME,`onError and code is ${e.errorCode} and message: ${e.message}`),10400!==e.errorCode&&(this.player.debugError(this.TAG_NAME,`onError and code is ${e.errorCode} and message: ${e.message}`),this.player.emitError(dt.aliyunRtcError,e))})),this.aliyunRtc.on("reconnect",(e=>{this.player.debugLog(this.TAG_NAME,"reconnect",e)}));const e="canplay",t="waiting",i="playing",s="media";this.aliyunRtc.on("onPlayEvent",(r=>{if(r.event===e)this.player.debugLog(this.TAG_NAME,"onPlayEvent and canplay");else if(r.event===t)this.player.debugLog(this.TAG_NAME,"onPlayEvent and playing - > waiting");else if(r.event===i)this.player.debugLog(this.TAG_NAME,"onPlayEvent and waiting -> playing");else if(r.event===s){const e=r.data;let t={},i=0;if(e.audio){const s=Math.floor(e.audio.bytesReceivedPerSecond);i+=s,t.abps=s}if(e.video){const s=Math.floor(e.video.bytesReceivedPerSecond);i+=s,t.vbps=s}this.player.updateStats(t),this.player.emit(at.kBps,(i/1024).toFixed(2))}}))}loadSource(e){return new Promise(((t,i)=>{this.aliyunRtc.isSupport({isReceiveVideo:!0}).then((()=>{this.aliyunRtc.subscribe(e,{}).then((e=>{this.aliyunRtcRemoteStream=e,e.play(this.$videoElement),t()})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource and subscribe is not success: ",e.message),i(e.message)}))})).catch((e=>{this.player.debugError(this.TAG_NAME,"loadSource and is not support: ",e.message),i(e.message)}))}))}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}isVideoPlaying(){return this.$videoElement&&Aa(this.$videoElement.paused)&&Aa(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}getVideoBufferTimeRange(){const e=this.$videoElement;let t=null;if(e){const i=e.buffered,s=i.length?i.start(0):0,r=i.length?i.end(i.length-1):0;t={start:s,end:r,diff:r-s}}return t}}class wv{constructor(e){this.player=e,this.TAG_NAME="PressureObserverCpu",this.observer=null,this.latestCpuInfo=null,this.currentLevel=-1,this.observeCpuSuccess=!1,this._init(),this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.observer&&(this.observeCpuSuccess&&this.observer.disconnect(),this.observer=null),this.latestCpuInfo=null,this.currentLevel=-1,this.player.debugLog(this.TAG_NAME,"destroy")}getCurrentCpuState(){return this.currentLevel}_init(){Aa(La())?this.player.debugLog(this.TAG_NAME,"not support PressureObserver"):(this.observer=new PressureObserver((e=>{const t=(e||[]).find((e=>"cpu"===e.source));if(t){switch(this.latestCpuInfo=t,t.state){case"nominal":this.currentLevel=0;break;case"fair":this.currentLevel=1;break;case"serious":this.currentLevel=2;break;case"critical":this.currentLevel=3;break;default:this.currentLevel=-1}this.player.emit(at.pressureObserverCpu,this.currentLevel)}})),this.observer&&this.observer.observe("cpu",{sampleInterval:1e3}).then((()=>{this.observeCpuSuccess=!0,this.player.debugLog(this.TAG_NAME,"observe cpu success")})).catch((()=>{this.observeCpuSuccess=!1,this.player.debugLog(this.TAG_NAME,"observe cpu fail")})))}}class Sv extends za{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e),this.TAG_NAME="DynamicWatermark",this.isPauseAnimation=!1,this.isStopAnimation=!1,this.rafID=null,this.speed=t.speed||.2,this.isDynamic=!0,this.shadowRootDynamicDom=null,this.isGhost=!0===t.isGhost,this.ghostConfig={on:t.on||5,off:t.off||5},this.waterMarkWillRemove=!1,this.waterMarkWillAdd=!1,this.player.once(at.start,(()=>{const e=Aa(po)?decodeURIComponent("JessibucaPro%20%E4%BD%93%E9%AA%8C"):t.content;let i=this.player.getVideoInfo();i||(i={width:200,height:200}),this.update({text:{content:e,fontSize:t.fontSize||18,color:t.color||"white"},left:i.width*Math.random(),top:i.height*Math.random(),opacity:t.opacity||.15}),this.startAnimation()})),this.player.debugLog(this.TAG_NAME,"int")}destroy(){super.destroy(),this.shadowRootDynamicDom=null,this.stopAnimation(),this.rafID&&(cancelAnimationFrame(this.rafID),this.rafID=null)}startAnimation(){if(!this.rafID){let e=1,t=1,i=Math.random(),s={width:0,height:0};const r=()=>{try{if(Aa(this.isPauseAnimation)&&this.shadowRootDynamicDom&&this.shadowRootInnerDom){const o=this.shadowRootInnerDom,a=this.shadowRootDynamicDom,n=o.getBoundingClientRect(),l=a.getBoundingClientRect();if(l.width&&l.height&&(s.width=l.width,s.height=l.height),!this.shadowRootInnerDom.contains(this.shadowRootDynamicDom))return this.isGhost?Aa(this.waterMarkWillAdd)&&(this.waterMarkWillAdd=!0,setTimeout((()=>{this._addDom(n,s),this.waterMarkWillAdd=!1}),1e3*this.ghostConfig.off)):this._addDom(n,s),void(0!==this.speed&&requestAnimationFrame(r));const d=Math.min(1,0===this.speed?0:this.speed?this.speed:.2);let h=l.left-n.left,c=l.top-n.top;h+=d*t*i,c+=d*e*(1-i),h+s.width>n.width?(t=-1,i=Math.random()):h<0&&(t=1,i=Math.random()),c+s.height>n.height?(e=-1,i=Math.random()):c<0&&(e=1,i=Math.random()),h=Math.min(n.width-s.width,h),c=Math.min(n.height-s.height,c);const u=h/n.width*100,p=c/n.height*100;this.shadowRootDynamicDom.style.left=`${u}%`,this.shadowRootDynamicDom.style.top=`${p}%`,Aa(this.waterMarkWillRemove)&&this.isGhost&&(this.waterMarkWillRemove=!0,setTimeout((()=>{this._removeDom(),this.waterMarkWillRemove=!1}),1e3*this.ghostConfig.on))}}catch(e){}if(this.isStopAnimation)return this.isStopAnimation=!1,cancelAnimationFrame(this.rafID),void(this.rafID=null);0!==this.speed&&requestAnimationFrame(r)};this.rafID=requestAnimationFrame(r)}}_addDom(e,t){if(this.shadowRootInnerDom&&this.shadowRootDynamicDom){this.shadowRootInnerDom.appendChild(this.shadowRootDynamicDom);let i=e.width*Math.random(),s=e.height*Math.random();i=Math.min(e.width-2*t.width,i),s=Math.min(e.height-2*t.height,s),this.shadowRootDynamicDom.style.left=`${i}px`,this.shadowRootDynamicDom.style.top=`${s}px`}}resumeAnimation(){this.isPauseAnimation=!1}pauseAnimation(){this.isPauseAnimation=!0}stopAnimation(){this.isStopAnimation=!0}}class Ev extends o{constructor(e){super(),this.player=e,this.TAG_NAME="DrawRectangle",this.drawingRectangle=!1,this.isDragging=!1,this.bindEvents=[],this.$rectBox=null,this._resetPoint(),this.player.on(at.drawingRect,this._handleDrawingRect.bind(this)),this.player.debugLog(this.TAG_NAME,"init")}destroy(){this._unbindEvents(),this.drawingRectangle=!1,this.isDragging=!1,this._removeRectBox(),this.off(),this.player.debugLog(this.TAG_NAME,"destroy")}_resetPoint(){this.startPagePoint={x:0,y:0},this.startPoint={x:0,y:0},this.endPoint={x:0,y:0}}_handleDrawingRect(e){this.drawingRectangle=e,e?this._bindEvents():(this._unbindEvents(),this._removeRectBox())}_bindEvents(){const{events:{proxy:e}}=this.player,t=e(this.player.$container,"mousemove",this.handleMouseMove.bind(this)),i=e(this.player.$container,"mousedown",this.handleMouseDown.bind(this)),s=e(window,"mouseup",this.handleMouseUp.bind(this));this.bindEvents.push(t,i,s)}_unbindEvents(){this.bindEvents.forEach((e=>{e&&e()})),this.bindEvents=[]}_removeRectBox(){if(this.$rectBox){if(!cc(this.$rectBox)){const e=this.player.$container.querySelector(".jb-pro-drawing-rect-box");e&&this.player.$container&&this.player.$container.removeChild(e)}this.$rectBox=null}}handleMouseDown(e){if(e.stopPropagation(),!this.drawingRectangle)return;this._removeRectBox();const t=e.offsetX,i=e.offsetY;this.startPoint.x=t,this.startPoint.y=i,this.startPagePoint.x=e.pageX-this.player.$container.offsetLeft,this.startPagePoint.y=e.pageY-this.player.$container.offsetTop,this.$rectBox=document.createElement("div"),this.$rectBox.classList.add("jb-pro-drawing-rect-box"),this.$rectBox.style.border=`${this.player._opt.drawingRectLineWidth}px solid ${this.player._opt.drawingRectColor}`,this.$rectBox.style.position="absolute",this.$rectBox.style.left=`${this.startPoint.x}px`,this.$rectBox.style.top=`${this.startPoint.y}px`,this.player.$container.appendChild(this.$rectBox),this.isDragging=!0}handleMouseMove(e){if(e.stopPropagation(),!this.isDragging)return;if(!this.drawingRectangle)return;if(!this.$rectBox)return;const t=this.player.$container,i=this.player.getControlHeight(),s=e.pageX-t.offsetLeft,r=e.pageY-t.offsetTop;if(sn&&(o=n,this.endPoint.x=this.startPoint.x+o),a>l&&(a=l,this.endPoint.y=this.startPoint.y+a),this.$rectBox.style.width=`${o}px`,this.$rectBox.style.height=`${a}px`}handleMouseUp(e){if(e.stopPropagation(),this.drawingRectangle&&this.isDragging){e.preventDefault(),this.isDragging=!1,this.player._opt.drawingRectEndRemoveDom&&this._removeRectBox();const t={startPoint:this.startPoint,endPoint:this.endPoint,width:Math.abs(this.endPoint.x-this.startPoint.x),height:Math.abs(this.endPoint.y-this.startPoint.y)};this.player._opt.isResize,this.player.emit(at.drawingRectInfo,t),this._resetPoint()}}}class Tv extends o{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this._opt={},this.TAG_NAME="Player",this.$container=e;const i=ma();if(this._opt=Object.assign({},i,t),this.debug=new Dr(this),this.debugLog(this.TAG_NAME,"init and version is",uo),this._opt.forceNoOffscreen=!0,this._canPlayAppleMpegurl=!1,(vo()||bo())&&(this._canPlayAppleMpegurl=ia(),this.debugLog(this.TAG_NAME,"isIOS or isSafari and canPlayAppleMpegurl",this._canPlayAppleMpegurl)),ya(Ir.isEnabled)&&ya(this._opt.useWebFullScreen)&&(this.debugLog(this.TAG_NAME,"screenfull.isEnabled is true and _opt.useWebFullScreen is true , set _opt.useWebFullScreen false"),this._opt.useWebFullScreen=!1),Aa(Ir.isEnabled)&&Aa(this._opt.useWebFullScreen)&&(this.debugLog(this.TAG_NAME,"screenfull.isEnabled is false and _opt.useWebFullScreen is false , set _opt.useWebFullScreen true"),this._opt.useWebFullScreen=!0),wa()&&(this.debugLog(this.TAG_NAME,"isIphone and set _opt.videoRenderSupportScale false"),this._opt.videoRenderSupportScale=!1,Yo()&&ya(this._opt.isHls)&&Aa(this._opt.supportHls265)&&(this.debugLog(this.TAG_NAME,"isIphone and is in wechat and is hls so set supportHls265 true"),this._opt.supportHls265=!0)),Aa(this._opt.playFailedAndReplay)&&(this.debugLog(this.TAG_NAME,"_opt.playFailedAndReplay is false and set others replay params false"),this._opt.webglAlignmentErrorReplay=!1,this._opt.webglContextLostErrorReplay=!1,this._opt.autoWasm=!1,this._opt.mseDecodeErrorReplay=!1,this._opt.mediaSourceTsIsMaxDiffReplay=!1,this._opt.wcsDecodeErrorReplay=!1,this._opt.wasmDecodeErrorReplay=!1,this._opt.simdDecodeErrorReplay=!1,this._opt.videoElementPlayingFailedReplay=!1,this._opt.networkDelayTimeoutReplay=!1,this._opt.widthOrHeightChangeReplay=!1,this._opt.simdH264DecodeVideoWidthIsTooLargeReplay=!1,this._opt.mediaSourceUseCanvasRenderPlayFailedReplay=!1,this._opt.heartTimeoutReplay=!1,this._opt.loadingTimeoutReplay=!1,this._opt.websocket1006ErrorReplay=!1,this._opt.streamErrorReplay=!1,this._opt.streamEndReplay=!1,this._opt.mseWaitVideoCanplayAutoWasm=!1),this._opt.hiddenControl&&(this.debugLog(this.TAG_NAME,"_opt.hiddenControl is true and set others show btn to false"),Object.keys(this._opt.operateBtns).forEach((e=>{this._opt.operateBtns[e]&&-1===(""+e).indexOf("Fn")&&(this._opt.operateBtns[e]=!1)})),this._opt.showBandwidth=!1,this._opt.extendOperateBtns=[],this._opt.controlHtml="",this.isPlayback()&&(this._opt.playbackConfig.showControl=!1)),this._opt.watermarkConfig={image:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAS4AAABgCAYAAACjZZ/rAAAK4mlDQ1BJQ0MgUHJvZmlsZQAASImVlwdUU1kagO976SEhkIQISAm9SW8BpIQeivQqKiEJJJQQE4KCDZXBERwVRESwDOCoiIKjIyBjQSxYUWzYB2RQUNbBgg2VfcASZmbP7p7937nvfufPf/9yz705/wOAHMKVSDJhFQCyxDnSyABvZnxCIhP3DOAAA9CBA7Dm8mQSdnh4CEBkev6rvL8LoIn5luWEr3///b8KlS+Q8QCAkhBO4ct4WQi3I2OEJ5HmAIA6jOgNluRIJvg2wnQpkiDCgxOcNsVfJjhlktEqkzbRkT4IGwKAJ3G50jQASDaInpnLS0P8kMIRthHzRWKECxD24Am5fISRuGBOVlb2BA8jbIrYSwAg0xFmpfzJZ9pf/Kco/HO5aQqeqmtS8L4imSSTm/d/bs3/lqxM+XQMY2SQhNLASGRWR/bvXkZ2sILFKfPCplnEn7SfZKE8MGaaeTKfxGnmc32DFWsz54VMc6rIn6Pwk8OJnmaBzC9qmqXZkYpYqVIf9jRzpTNx5RkxCr1QwFH4zxdGx01zrih23jTLMqK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QsBwCQlyWazKpsCAgCAhxSR8QBAQByyEgxGW5JpMKCwKCgBCX9AFBQBCwHAJCXJZrMqmwICAICHFJHxAEBAHLISDEZbkmkwoLAoKAEJf0AUFAELAcAkJclmsyqbAgIAgIcUkfEAQEAcshIMRluSaTCgsCgoAQl/QBQUAQsBwCQlyWazKpsCAgCAhxSR8QBAQByyEgxGW5JpMKCwKCgBCX9AFBQBCwHAJCXJZrMqmwICAICHFJHxAEBAHLISDEZbkmkwoLAoKAEJf0AUFAELAcAkJclmsyqbAgIAgIcUkfEAQEAcshIMRluSaTCgsCgsD/AFt/MVAlcetCAAAAAElFTkSuQmCC",width:75,height:24},opacity:.1,right:10,top:10},this._opt.forceNoOffscreen||("undefined"==typeof OffscreenCanvas?(this._opt.forceNoOffscreen=!0,this._opt.useOffscreen=!1):this._opt.useOffscreen=!0),this._opt.isMpeg4&&(this.debugLog(this.TAG_NAME,"isMpeg4 is true, so set _opt.useWasm true and others params false"),this._opt.useWCS=!1,this._opt.useMSE=!1,this._opt.isNakedFlow=!1,this._opt.useSIMD=!1,this._opt.isFmp4=!1,this._opt.useWasm=!0),this.isPlayback()&&(ya(this._opt.useMSE)&&ya(this._opt.mseDecoderUseWorker)&&this.debugLog(this.TAG_NAME,"isPlayback and mseDecoderUseWorker is true, so set mseDecoderUseWorker false"),this._opt.mseDecoderUseWorker=!1,ya(this._opt.useWCS)&&ya(this._opt.wcsDecodeAudio)&&this.debugLog(this.TAG_NAME,"isPlayback and wcsDecodeAudio is true, so set wcsDecodeAudio false"),this._opt.wcsDecodeAudio=!1),this._opt.poster&&(this._opt.background=this._opt.poster),Aa(this._opt.muted)&&(this._opt.isNotMute=!0),this._opt.mseDecoderUseWorker&&(this._opt.mseDecoderUseWorker=!!(xr.Worker&&xr.MediaSource&&"canConstructInDedicatedWorker"in xr.MediaSource&&!0===xr.MediaSource.canConstructInDedicatedWorker),Aa(this._opt.mseDecoderUseWorker)&&this.debugLog(this.TAG_NAME,"mseDecoderUseWorker is true but not support so set _opt.mseDecoderUseWorker = false")),(this.isOldHls()||this.isWebrtcH264()||this.isAliyunRtc())&&(this.debugLog(this.TAG_NAME,"isOldHls or isWebrtcH264 or isAliyunRtc is true, so set some params false and set _opt.recordType = webm"),this._opt.useWCS=!1,this._opt.useMSE=!1,this._opt.isNakedFlow=!1,this._opt.useSIMD=!1,this._opt.isFmp4=!1,this._opt.useWasm=!1,this._opt.recordType=E),this._opt.isNakedFlow&&(this.debugLog(this.TAG_NAME,"isNakedFlow is true, so set _opt.mseDecodeAudio false"),this._opt.mseDecodeAudio=!1),yo()&&(this.debugLog(this.TAG_NAME,"isFirefox is true, so set _opt.mseDecodeAudio false"),this._opt.mseDecodeAudio=!1),!this.isOldHls()&&!this.isWebrtcH264()){if(this._opt.useWCS){const e="VideoDecoder"in window,t=xo();this._opt.useWCS=e,this._opt.useWCS&&this._opt.isH265&&(this._opt.useWCS=t),this._opt.useWCS||this.debugWarn(this.TAG_NAME,`\n useWCS is true,\n and supportWCS is ${e}, supportHevcWCS is ${t} , _opt.isH265 is ${this._opt.isH265}\n so set useWCS false`),this._opt.useWCS&&(this._opt.wcsDecodeAudio&&(this._opt.wcsDecodeAudio="AudioDecoder"in window,this._opt.wcsDecodeAudio||this.debugWarn(this.TAG_NAME,"wcsDecodeAudio is true, but not support so set wcsDecodeAudio false")),this._opt.useOffscreen?this._opt.wcsUseVideoRender=!1:this._opt.wcsUseVideoRender&&(this._opt.wcsUseVideoRender=Do()&&Ro(),this._opt.wcsUseVideoRender||this.debugWarn(this.TAG_NAME,"wcsUseVideoRender is true, but not support so set wcsUseVideoRender false")))}if(this._opt.useMSE){const e=function(){let e=!1;return"MediaSource"in xr&&(e=!0),e}()||function(){let e=!1;return!("MediaSource"in xr)&&"ManagedMediaSource"in xr&&(e=!0),e}(),t=Co()||function(){let e=!1;return!("MediaSource"in xr)&&"ManagedMediaSource"in xr&&xr.ManagedMediaSource&&(xr.ManagedMediaSource.isTypeSupported(pi)||xr.ManagedMediaSource.isTypeSupported(fi)||xr.ManagedMediaSource.isTypeSupported(mi)||xr.ManagedMediaSource.isTypeSupported(gi)||xr.ManagedMediaSource.isTypeSupported(yi))&&(e=!0),e}();this._opt.useMSE=e,this._opt.useMSE&&this._opt.isH265&&(this._opt.useMSE=t),this._opt.useMSE||this.debugWarn(this.TAG_NAME,`\n useMSE is true,\n and supportMSE is ${e}, supportHevcMSE is ${t} , _opt.isH265 is ${this._opt.isH265}\n so set useMSE false`)}}if(Aa(this._opt.useMSE)&&(this._opt.mseDecodeAudio=!1),Aa(this._opt.useWCS)&&(this._opt.wcsDecodeAudio=!1),this._opt.useMSE?(this._opt.useWCS&&this.debugWarn(this.TAG_NAME,"useMSE is true and useWCS is true then useWCS set true->false"),this._opt.forceNoOffscreen||this.debugWarn(this.TAG_NAME,"useMSE is true and forceNoOffscreen is false then forceNoOffscreen set false->true"),this._opt.useWCS=!1,this._opt.forceNoOffscreen=!0):this._opt.useWCS,this._opt.isWebrtc&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"isWebrtc is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this._opt.isHls&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"isHls is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this._opt.isAliyunRtc&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"isAliyunRtc is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this.isStreamWebTransport()&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"is stream use webTransport is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this._opt.wcsDecodeAudio&&this._opt.demuxUseWorker&&(this.debugWarn(this.TAG_NAME,"is wcsDecodeAudio true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),Aa(this._opt.demuxUseWorker)&&(this._opt.mseDecoderUseWorker=!1),this.isPlayback()&&(this._opt.mseDecoderUseWorker=!1),this._opt.useMThreading&&(this._opt.useMThreading="undefined"!=typeof SharedArrayBuffer,this._opt.useMThreading||this.debugWarn(this.TAG_NAME,"useMThreading is true, but not support so set useMThreading false")),this._opt.useSIMD||-1!==this._opt.decoder.indexOf("-simd")){const e=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),t=wa();this._opt.useSIMD=e&&Aa(t),this._opt.useSIMD||this.debugWarn(this.TAG_NAME,`useSIMD is true, but not support(isSupportSimd is ${e} ,isIphone is ${t}) so set useSIMD false`)}var s;if(this._opt.useSIMD?-1===this._opt.decoder.indexOf("-simd")?this._opt.useMThreading?this._opt.decoder=this._opt.decoder.replace("decoder-pro.js","decoder-pro-simd-mt.js"):this._opt.decoder=this._opt.decoder.replace("decoder-pro.js","decoder-pro-simd.js"):this._opt.useMThreading&&(this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-simd-mt.js")):-1!==this._opt.decoder.indexOf("-simd")?this._opt.useMThreading?this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-mt.js"):this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro.js"):this._opt.useMThreading&&(this._opt.decoder=this._opt.decoder.replace("decoder-pro.js","decoder-pro-mt.js")),-1!==this._opt.decoder.indexOf("-simd")?this._opt.useMThreading?(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-hard-not-wasm.js")):(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-hard-not-wasm.js")):this._opt.useMThreading?(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-hard-not-wasm.js")):(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro.js","decoder-pro-hard-not-wasm.js")),Aa(this._opt.hasAudio)&&(this._opt.operateBtns.audio=!1),Aa(this._opt.hasVideo)&&(this._opt.operateBtns.fullscreen=!1,this._opt.operateBtns.screenshot=!1,this._opt.operateBtns.record=!1,this._opt.operateBtns.ptz=!1,this._opt.operateBtns.quality=!1,this._opt.operateBtns.zoom=!1),this._opt.qualityConfig&&0===this._opt.qualityConfig.length&&this._opt.operateBtns.quality&&(this._opt.operateBtns.quality=!1,this.debugWarn(this.TAG_NAME,"_opt.qualityConfig is empty, so set operateBtns.quality false")),ya(this._opt.useWebGPU)&&(this._opt.useWebGPU=function(){let e=!1;return"gpu"in navigator&&(e=!0),e}(),Aa(this._opt.useWebGPU)&&this.debugWarn(this.TAG_NAME,"useWebGPU is true, but not support so set useWebGPU false")),this._opt.hasControl=this._hasControl(),this._loading=!1,this._playing=!1,this._playbackPause=!1,this._hasLoaded=!1,this._zooming=!1,this._drawingRect=!1,this._destroyed=!1,this._destroyLock=!1,this._closed=!1,this._checkHeartTimeout=null,this._checkLoadingTimeout=null,this._checkStatsInterval=null,this._checkVisibleHiddenTimeout=null,this._startBpsTime=null,this._isPlayingBeforePageHidden=!1,this._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,currentPts:0,pTs:0,dts:0,mseVideoBufferDelayTime:0,isDropping:!1},this._tempTsList=[],this._allStatsData={},this._faceDetectActive=!1,this._objectDetectActive=!1,this._occlusionDetectActive=!1,this._imageDetectActive=!1,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this._videoTimestamp=0,this._audioTimestamp=0,this._latestAudioTimestamp=0,this._videoIframeIntervalTs=0,this._streamQuality=this._opt.defaultStreamQuality||"",!this._streamQuality&&this._opt.qualityConfig.length>0&&(this._streamQuality=this._opt.qualityConfig[0]||""),this._visibility=!0,this._lastestVisibilityChangeTimestamp=null,this._tempWorkerStats=null,this._historyFpsList=[],this._historyVideoDiffList=[],this._tempStreamList=[],this._tempInnerPlayBgobj=null,this._flvMetaData=null,this._flvMetaDataFps=null,this._serverInfo=null,this._mseWorkerData={},Aa(this._opt.useMSE)&&Aa(this._opt.useWCS)&&!this.isWebrtcH264()&&!this.isOldHls()&&(this._opt.useWasm=!0),(this.isOldHls()||this.isWebrtcH264())&&(this._opt.hasVideo=!0,this._opt.hasAudio=!0),this._opt.hasVideo||(this._opt.useMSE=!1,this._opt.useWCS=!1),this._opt.useWasm&&(this._opt.useOffscreen?this._opt.wasmUseVideoRender=!1:this._opt.wasmUseVideoRender&&(this._opt.wasmUseVideoRender=wo()&&Do()&&Ro(),this._opt.wasmUseVideoRender||this.debugWarn(this.TAG_NAME,"use wasm video render, but not support so set wasmUseVideoRender false"),this._opt.wasmUseVideoRender&&this._opt.wasmPlayAudioUseVideoRender&&(this._opt.wasmPlayAudioUseVideoRender="AudioData"in window,this._opt.wasmPlayAudioUseVideoRender||this.debugWarn(this.TAG_NAME,"use wasm video render play audio, but not support so set wasmPlayAudioUseVideoRender false"))),this._opt.useSIMD?this.debugLog(this.TAG_NAME,"use simd wasm"):this.debugLog(this.TAG_NAME,"use wasm")),this._opt.useWasm&&(this._opt.useFaceDetector&&window.JessibucaProFaceDetector||this._opt.useObjectDetector&&window.JessibucaProObjectDetector||this._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector||this._opt.useImageDetector&&window.JessibucaProImageDetector)?(this.ai=new fv(this),this._opt.useFaceDetector&&window.JessibucaProFaceDetector||(this._opt.operateBtns.aiFace=!1),this._opt.useObjectDetector&&window.JessibucaProObjectDetector||(this._opt.operateBtns.aiObject=!1),this._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector||(this._opt.operateBtns.aiOcclusion=!1),this._opt.useImageDetector&&this._opt.aiImageDetectActive&&window.JessibucaProImageDetector&&(this.imageDetectActive=!0)):(this._opt.operateBtns.aiObject=!1,this._opt.operateBtns.aiFace=!1,this._opt.operateBtns.aiOcclusion=!1),this._opt.useFaceDetector&&(this._opt.useWasm&&window.JessibucaProFaceDetector||this.debugWarn(this.TAG_NAME,`use face detector, useWasm is ${this._opt.useWasm} and window.JbProFaceDetector is null`)),this._opt.useObjectDetector&&(this._opt.useWasm&&window.JessibucaProObjectDetector||this.debugWarn(this.TAG_NAME,`use object detector, useWasm is ${this._opt.useWasm} and window.JbProObjectDetector is null`)),this._opt.useOcclusionDetector&&(this._opt.useWasm&&window.JessibucaProOcclusionDetector||this.debugWarn(this.TAG_NAME,`use occlusion detector, useWasm is ${this._opt.useWasm} and window.JessibucaProOcclusionDetector is null`)),this._opt.useImageDetector&&(this._opt.useWasm&&window.JessibucaProImageDetector||this.debugWarn(this.TAG_NAME,`use image detector, useWasm is ${this._opt.useWasm} and window.JessibucaProImageDetector is null`)),this._opt.videoRenderType&&(this.debugLog(this.TAG_NAME,`videoRenderType is ${this._opt.videoRenderType}`),this._opt.videoRenderType===J?(this._opt.useVideoRender=!0,this._opt.useCanvasRender=!1):this._opt.videoRenderType===H&&(this._opt.useVideoRender=!1,this._opt.useCanvasRender=!0)),this._opt.useVideoRender&&(this._opt.useWasm&&!this._opt.useOffscreen?(this._opt.wasmUseVideoRender=wo()&&Do()&&Ro(),this._opt.wasmUseVideoRender||this.debugWarn(this.TAG_NAME,"use wasm video render, but not support so set wasmUseVideoRender false")):this._opt.useWCS&&!this._opt.useOffscreen&&(this._opt.wcsUseVideoRender=Do()&&Ro(),this._opt.wcsUseVideoRender||this.debugWarn(this.TAG_NAME,"use wcs video render, but not support so set wcsUseVideoRender false"))),this._opt.useCanvasRender&&(this._opt.useMSE&&Aa(this._opt.mseDecoderUseWorker)&&(this._opt.mseUseCanvasRender=!0),this._opt.useWasm&&(this._opt.wasmUseVideoRender=!1),this._opt.useWCS&&(this._opt.wcsUseVideoRender=!1),this.isOldHls()&&!vo()&&(this._opt.hlsUseCanvasRender=!0),this.isWebrtcH264()&&(this._opt.webrtcUseCanvasRender=!0)),this._opt.useVideoRender=!1,this._opt.useCanvasRender=!1,this._opt.useWasm?this._opt.wasmUseVideoRender?this._opt.useVideoRender=!0:this._opt.useCanvasRender=!0:this._opt.useWCS?this._opt.wcsUseVideoRender?this._opt.useVideoRender=!0:this._opt.useCanvasRender=!0:this._opt.useMSE?this._opt.mseUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0:this.isOldHls()?this._opt.hlsUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0:this.isWebrtcH264()&&(this._opt.webrtcUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0),this._opt.useCanvasRender&&this.useVideoPlayAudio()&&(this.debugLog(this.TAG_NAME,"useCanvasRender is true and useVideoPlayAudio() return true, so set wcsDecodeAudio false"),this._opt.wcsDecodeAudio=!1,this._opt.wasmPlayAudioUseVideoRender=!1),s=this,Object.defineProperty(s,"rect",{get:()=>{let e={};return s.$container&&(e=s.$container.getBoundingClientRect(),e.width=Math.max(e.width,s.$container.clientWidth),e.height=Math.max(e.height,s.$container.clientHeight)),e}}),["bottom","height","left","right","top","width"].forEach((e=>{Object.defineProperty(s,e,{get:()=>s.rect[e]||0})})),this.events=new Da(this),this._opt.hasVideo&&(this.video=new rn(this),this.recorder=new fl(this)),this.isOldHls()?(this.hlsDecoder=new WA(this),this.loaded=!0):this.isWebrtcH264()?(this._opt.isWebrtcForZLM?this.webrtc=new vv(this):this._opt.isWebrtcForSRS?this.webrtc=new yv(this):this._opt.isWebrtcForOthers?this.webrtc=new Av(this):this.webrtc=new bv(this),this.loaded=!0):this.isAliyunRtc()?(this.aliyunRtcDecoder=new _v(this),this.loaded=!0):(this.isUseHls265()&&(this.hlsDecoder=new cv(this)),this.isWebrtcH265()&&(this.webrtc=new bv(this)),Aa(sa(this._opt))?this.decoderWorker=new vl(this):this.loaded=!0),this._opt.hasAudio&&(this.audio=new Sn(this)),this.stream=null,this.demux=null,this._lastVolume=null,this._isMute=null,this._isInZoom=!1,this._playingStartTimestamp=null,this.isMSEVideoDecoderInitializationFailedNotSupportHevc=!1,this.isMSEAudioDecoderError=!1,this.isMSEPlaybackRateChangePause=!1,this.isMSECurrentMoreThanBufferedPause=!1,this.isPlayFailedAndPaused=!1,this._seiList=[],this._opt.useWCS&&(this.webcodecsDecoder=new Yh(this),!this._opt.hasAudio&&Aa(this._opt.demuxUseWorker)&&(this.loaded=!0)),this._opt.useMSE&&Aa(this._opt.mseDecoderUseWorker)&&(this.mseDecoder=new yc(this),!this._opt.hasAudio&&Aa(this._opt.demuxUseWorker)&&(this.loaded=!0)),this.control=new fc(this),this._opt.contextmenuBtns.length>0&&Aa(this._opt.disableContextmenu)&&mo()?this.contextmenu=new mv(this):ya(this._opt.disableContextmenu)&&this._opt.contextmenuBtns.length>0&&mo()&&this.debugWarn(this.TAG_NAME,"disableContextmenu is true, but contextmenuBtns is not empty, so Contextmenu can not be created,please check"),this.isPlayback()&&(this.playback=new uv(this,this._opt.playbackConfig)),this._opt.operateBtns.zoom&&(this.zoom=new pv(this)),/(iphone|ipad|ipod|ios|android)/i.test(window.navigator.userAgent.toLowerCase())&&Aa(this._opt.supportLockScreenPlayAudio&&bo())&&(this.keepScreenOn=new bc(this)),(e=>{try{const t=t=>{Xo(t)===e.$container&&(e.emit(nt.fullscreen,e.fullscreen),e.fullscreen?e._opt.useMSE&&e.resize():e.resize())};Ir.on("change",t),e.events.destroys.push((()=>{Ir.off("change",t)}))}catch(e){}if(e.on(at.decoderWorkerInit,(()=>{e.debugLog("player","listen decoderWorkerInit and set loaded true"),e.loaded=!0})),e.on(at.play,(()=>{e.loading=!1})),e.on(at.fullscreen,(t=>{if(t)try{Ir.request(e.$container).then((()=>{})).catch((t=>{e.debugError("player","fullscreen request error",t,t.toString()),e.emitError(dt.fullscreenError,t.toString()),fo()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}))}catch(t){fo()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}else try{Ir.exit().then((()=>{e.webFullscreen&&(e.webFullscreen=!1)})).catch((t=>{e.debugError("player","fullscreen exit error",t,t.toString()),e.emitError(dt.fullscreenError,t.toString()),e.webFullscreen&&(e.webFullscreen=!1)}))}catch(t){e.webFullscreen&&(e.webFullscreen=!1)}})),fo()&&e.on(at.webFullscreen,(t=>{t?e.$container.classList.add("jb-pro-fullscreen-web"):e.$container.classList.remove("jb-pro-fullscreen-web"),e.emit(nt.fullscreen,e.fullscreen)})),e.on(at.resize,(()=>{e.resize()})),e._opt.debug){const t=[at.timeUpdate,at.currentPts,at.videoSEI,at.videoSEISyncPts,at.performance,at.videoSmooth],i=[at.stats,at.playbackStats,at.playbackTimestamp,at.flvMetaData,at.playToRenderTimes,at.audioInfo,at.videoInfo];Object.keys(at).forEach((s=>{e.on(at[s],(function(r){if(!t.includes(s)){i.includes(s)&&(r=JSON.stringify(r));for(var o=arguments.length,a=new Array(o>1?o-1:0),n=1;n{e.on(dt[t],(function(){for(var i=arguments.length,s=new Array(i),r=0;r{this.updateOption({rotate:e?270:0}),this.resize()}),10)}get webFullscreen(){return this.$container.classList.contains("jb-pro-fullscreen-web")}set loaded(e){this._hasLoaded=e}get loaded(){return this._hasLoaded||this.isOldHls()||this.isWebrtcH264()||this._opt.useMSE&&Aa(this._opt.hasAudio)&&Aa(this._opt.demuxUseWorker)||this._opt.useWCS&&!this._opt.hasAudio&&Aa(this._opt.demuxUseWorker)}set playing(e){this.isClosed()&&e?this.debugLog(this.TAG_NAME,"player is closed, so can not play"):(e&&ya(this.loading)&&(this.loading=!1),this.playing!==e&&(this._playing=e,this.emit(at.playing,e),this.emit(at.volumechange,this.volume),e?this.emit(at.play):this.emit(at.pause)))}get playing(){return this._playing}get volume(){return this.audio&&this.audio.volume||0}set volume(e){e!==this.volume&&(this.audio?(this.audio.setVolume(e),this._lastVolume=this.volume,this._isMute=0===this.volume):this.debugWarn(this.TAG_NAME,"set volume error, audio is null"))}get lastVolume(){return this._lastVolume}set loading(e){this.loading!==e&&(this._loading=e,this.emit(at.loading,this._loading))}get loading(){return this._loading}set zooming(e){this.isDestroyedOrClosed()||this.zooming!==e&&(this.zoom||(this.zoom=new pv(this)),this._zooming=e,this.emit(at.zooming,this.zooming))}get zooming(){return this._zooming}set drawingRect(e){this.isDestroyedOrClosed()||this.drawingRect!==e&&(this.drawRectangle||(this.drawRectangle=new Ev(this)),this._drawingRect=e,this.emit(at.drawingRect,this.drawingRect))}get drawingRect(){return this._drawingRect}set recording(e){e?this.playing&&!this.recording&&(this.recorder&&this.recorder.startRecord(),this.isDemuxInWorker()&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!0})):this.recording&&(this.isDemuxInWorker()&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder&&this.recorder.stopRecordAndSave().then((()=>{})).catch((e=>{})))}get recording(){return!!this.recorder&&this.recorder.isRecording}set audioTimestamp(e){null!==e&&(this._audioTimestamp=e)}get audioTimestamp(){return this._audioTimestamp}set latestAudioTimestamp(e){null!==e&&(this._latestAudioTimestamp=e)}get latestAudioTimestamp(){return this._latestAudioTimestamp}get videoTimestamp(){return this._stats.currentPts||this._stats.ts}set streamQuality(e){this.streamQuality!==e&&(this._streamQuality=e,this.emit(at.streamQualityChange,e))}get streamQuality(){return this._streamQuality}get isDebug(){return ya(this._opt.debug)}get scaleType(){const e=this._opt,t=e.isResize,i=e.isFullResize;let s=Zt;return Aa(i)&&Aa(t)?s=Zt:Aa(i)&&ya(t)?s=ei:ya(i)&&ya(t)&&(s=ti),s}set visibility(e){this._visibility!==e&&(this._visibility=e,this.emit(at.visibilityChange,e),this._lastestVisibilityChangeTimestamp=oo(),e?this.clearVisibilityHiddenTimeout():this.startVisibilityHiddenTimeout())}get visibility(){return this._visibility}set playbackPause(e){this._playbackPause!==e&&(this._playbackPause=e,this.emit(at.playbackPause,e),this.emit(at.playbackPauseOrResume,e))}get playbackPause(){return this.isPlayback()&&this._playbackPause}set videoIframeIntervalTs(e){this._videoIframeIntervalTs=e}get videoIframeIntervalTs(){return this._videoIframeIntervalTs}set faceDetectActive(e){this._faceDetectActive!==e&&(this._faceDetectActive=e,this.emit(at.faceDetectActive,e))}get faceDetectActive(){return this._faceDetectActive}set objectDetectActive(e){this._objectDetectActive!==e&&(this._objectDetectActive=e,this.emit(at.objectDetectActive,e))}get objectDetectActive(){return this._objectDetectActive}set occlusionDetectActive(e){this._occlusionDetectActive!==e&&(this._occlusionDetectActive=e,this.emit(at.occlusionDetectActive,e))}get occlusionDetectActive(){return this._occlusionDetectActive}set imageDetectActive(e){this._imageDetectActive!==e&&(this._imageDetectActive=e)}get imageDetectActive(){return this._imageDetectActive}get isUseWorkerDemuxAndDecode(){return this.stream&&this.stream.getStreamType()===A}isDestroyed(){return this._destroyed}isDestroying(){return this._destroyed&&this._destroyLock}isClosed(){return this._closed}isDestroyedOrClosed(){return this.isDestroyed()||this.isClosed()}isLoading(){return this.loading}isPlaying(){let e=!1;return this._opt.playType===v?e=this.playing:this._opt.playType===w&&(e=Aa(this.playbackPause)&&this.playing),e}updateOption(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._opt=Object.assign({},this._opt,e),ya(t)&&this.decoderWorker&&Object.keys(e).forEach((t=>{this.decoderWorker.updateWorkConfig({key:t,value:e[t]})}))}init(){return new Promise(((e,t)=>{this.video||this._opt.hasVideo&&(this.video=new rn(this)),this.audio||this._opt.hasAudio&&(this.audio=new Sn(this)),this.stream||(this.stream=new Pn(this)),this.isOldHls()?(this.hlsDecoder||(this.hlsDecoder=new WA(this),this.loaded=!0),e()):this.isWebrtcH264()?(this.webrtc||(this._opt.isWebrtcForZLM?this.webrtc=new vv(this):this._opt.isWebrtcForSRS?this.webrtc=new yv(this):this._opt.isWebrtcForOthers?this.webrtc=new Av(this):this.webrtc=new bv(this),this.loaded=!0),e()):this.isAliyunRtc()?(this.aliyunRtcDecoder||(this.aliyunRtcDecoder=new _v(this),this.loaded=!0),e()):(this.demux||this._opt.hasVideo&&!this.isUseWorkerDemuxAndDecode&&(this.demux=new Wh(this)),this._opt.useWCS&&(this.webcodecsDecoder||(this.webcodecsDecoder=new Yh(this))),this._opt.useMSE&&Aa(this._opt.mseDecoderUseWorker)&&(this.mseDecoder||(this.mseDecoder=new yc(this))),this.isUseHls265()&&(this.hlsDecoder||(this.hlsDecoder=new cv(this))),this.isWebrtcH265()&&(this.webrtc||(this.webrtc=new bv(this))),this.decoderWorker?this.loaded?e():this.once(at.decoderWorkerInit,(()=>{this.isDestroyedOrClosed()?(this.debugError(this.TAG_NAME,"init() failed and player is destroyed"),t("init() failed and player is destroyed")):(this.loaded=!0,e())})):Aa(sa(this._opt))?(this.decoderWorker=new vl(this),this.once(at.decoderWorkerInit,(()=>{this.isDestroyedOrClosed()?(this.debugError(this.TAG_NAME,"init() failed and player is destroyed"),t("init() failed and player is destroyed")):(this.loaded=!0,e())}))):e())}))}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(!e&&!this._opt.url)return s("url is empty");this._closed=!1,this.loading=!0,this.playing=!1,this._times.playInitStart=oo(),e||(e=this._opt.url),this._opt.url=e,this.control&&this._opt.loadingBackground&&this.control.initLoadingBackground(),this.init().then((()=>{this.debugLog(this.TAG_NAME,"play() init and next fetch stream"),this._times.playStart=oo(),this._opt.isNotMute&&this.mute(!1),this.enableWakeLock(),this.checkLoadingTimeout(),this.stream?(this.stream.once(dt.fetchError,(e=>{this.emitError(dt.fetchError,e)})),this.stream.once(dt.websocketError,(e=>{this.emitError(dt.websocketError,e)})),this.stream.once(at.streamEnd,(e=>{this.emit(at.streamEnd,e)})),this.stream.once(dt.hlsError,(e=>{this.emitError(dt.hlsError,e)})),this.stream.once(dt.webrtcError,(e=>{this.emitError(dt.webrtcError,e)})),this.stream.once(at.streamSuccess,(()=>{i(),this._times.streamResponse=oo(),this.video&&this.video.play(),this.checkStatsInterval(),this.isPlayback()&&this.playback&&this.playback.startCheckStatsInterval();{const e=Number("1")||1;setTimeout((()=>{this.destroy(),console.error("Jb pro 体验结束,请刷新页面再次体验(wasm内部会暂停解码)"),alert("Jb pro 体验结束,请刷新页面再次体验,如需要购买商业授权,可以联系微信:bosswancheng"),window.location.reload()}),60*e*60*1e3)}})),this.stream.fetchStream(e,t)):(this.debugWarn(this.TAG_NAME,`play() this.stream is null and is isDestroyedOrClosed is ${this.isDestroyedOrClosed()}`),s("this.stream is null"))})).catch((e=>{s(e)}))}))}playForControl(){return new Promise(((e,t)=>{this.debugLog(this.TAG_NAME,`playForControl() and pauseAndNextPlayUseLastFrameShow is ${this._opt.pauseAndNextPlayUseLastFrameShow}`),this._opt.pauseAndNextPlayUseLastFrameShow&&this._tempInnerPlayBgobj&&this._tempInnerPlayBgobj.loadingBackground&&this.updateOption({loadingBackground:this._tempInnerPlayBgobj.loadingBackground,loadingBackgroundWidth:this._tempInnerPlayBgobj.loadingBackgroundWidth,loadingBackgroundHeight:this._tempInnerPlayBgobj.loadingBackgroundHeight}),this.play().then((t=>{e(t)})).catch((e=>{t(e)}))}))}close(){return new Promise(((e,t)=>{this._close().then((()=>{this.video&&this.video.clearView(),e()})).catch((e=>{t(e)}))}))}resumeAudioAfterPause(){this.lastVolume&&Aa(this._isMute)&&(this.volume=this.lastVolume)}async _close(){this._closed=!0,this.video&&(this.video.resetInit(),this.video.pause(!0)),this.loading=!1,this.recording=!1,this.zooming=!1,this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.isPlayback()&&this.playback&&this.playback.clearStatsInterval(),this.releaseWakeLock(),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.decoderWorker&&(await this.decoderWorker.destroy(),this.decoderWorker=null),this.stream&&(await this.stream.destroy(),this.stream=null),this.demux&&(this.demux.destroy(),this.demux=null),this.webcodecsDecoder&&(await this.webcodecsDecoder.destroy(),this.webcodecsDecoder=null),this.mseDecoder&&(this.mseDecoder.destroy(),this.mseDecoder=null),this.hlsDecoder&&(await this.hlsDecoder.destroy(),this.hlsDecoder=null),this.webrtc&&(this.webrtc.destroy(),this.webrtc=null),this.aliyunRtcDecoder&&(this.aliyunRtcDecoder.destroy(),this.aliyunRtcDecoder=null),this.audio&&(await this.audio.destroy(),this.audio=null),this.playing=!1}pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(((t,i)=>{e?this.close().then((()=>{t()})).catch((e=>{i(e)})):this._close().then((()=>{t()})).catch((e=>{i(e)}))}))}pauseForControl(){return new Promise(((e,t)=>{if(this.debugLog(this.TAG_NAME,"_pauseInner()"),this._opt.pauseAndNextPlayUseLastFrameShow&&this.video){const e=this.video.screenshot("","png",.92,"base64");if(e){const t=this.getVideoInfo();t?(this.debugLog(this.TAG_NAME,`pauseForControl() and loadingBackground width is ${t.width} and height is ${t.height}`),this._tempInnerPlayBgobj={loadingBackground:e,loadingBackgroundWidth:t.width,loadingBackgroundHeight:t.height}):this.debugWarn(this.TAG_NAME,"pauseForControl() and videoInfo is null")}else this.debugWarn(this.TAG_NAME,"pauseForControl() and loadingBackground is null")}this.pause().then((t=>{e(t)})).catch((e=>{t(e)}))}))}isAudioMute(){let e=!0;return this.audio&&(e=this.audio.isMute),e}isAudioNotMute(){return!this.isAudioMute()}mute(e){this.audio&&this.audio.mute(e)}resize(){this.video&&this.video.resize()}startRecord(e,t){this.recording||(this.recorder.setFileName(e,t),this.recording=!0)}cancelRecord(){return new Promise(((e,t)=>{this.recorder||t("recorder is null"),this.recording&&(this._opt.useWasm&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder.cancelRecord().then((()=>{e()})).catch((e=>{t(e)})))}))}stopRecordAndSave(e,t){return new Promise(((i,s)=>{this.recorder||s("recorder is null"),this.recording?(this._opt.useWasm&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder.stopRecordAndSave(e,t).then((e=>{i(e)})).catch((e=>{s(e)}))):s("recorder is not recording")}))}_hasControl(){let e=!1,t=!1;return Object.keys(this._opt.operateBtns).forEach((e=>{this._opt.operateBtns[e]&&-1===(""+e).indexOf("Fn")&&(t=!0)})),(this._opt.showBandwidth||t)&&(e=!0),this._opt.extendOperateBtns&&this._opt.extendOperateBtns.length>0&&(e=!0),this.isPlayback()&&this._opt.playbackConfig.showControl&&(e=!0),this._opt.controlHtml&&(e=!0),e}useWasmDecode(){return Aa(this._opt.useMSE)&&Aa(this._opt.useWCS)}canVideoTrackWritter(){const e=this._opt;return!this.isOldHls()&&!this.isWebrtcH264()&&Aa(e.useMSE)&&!this.isAliyunRtc()&&(e.useWCS&&Aa(e.useOffscreen)&&e.wcsUseVideoRender||this.useWasmDecode())}checkHeartTimeout$2(){if(Aa(this.playbackPause)&&this.playing){if(this.isDestroyedOrClosed())return void this.debugWarn(this.TAG_NAME,"checkHeartTimeout$2 but player is destroyed");if(Aa(this.isHistoryFpsListAllZero()))return void this.debugWarn(this.TAG_NAME,"checkHeartTimeout$2 but fps is not all zero");if(0!==this._stats.fps)return void this.debugWarn(this.TAG_NAME,`checkHeartTimeout$2 but fps is ${this._stats.fps}`);const e=this._historyFpsList.join(",");this.debugWarn(this.TAG_NAME,`checkHeartTimeout$2 and\n pause and emit delayTimeout event and\n current vbps is ${this._stats.vbps} and\n current fps is ${this._stats.fps} and\n history FpsList is ${e} and\n current visibility is ${this.visibility} and`),this.emit(at.timeout,at.delayTimeout),this.emit(at.delayTimeout)}else this.debugLog(this.TAG_NAME,`checkHeartTimeout$2 playbackPause is ${this.playbackPause}, playing is ${this.playing}`)}checkStatsInterval(){this._checkStatsInterval=setInterval((()=>{this.updateStats()}),1e3)}checkLoadingTimeout(){this._checkLoadingTimeout=setTimeout((()=>{this.playing?this.debugWarn(this.TAG_NAME,`checkLoadingTimeout but loading is ${this.loading} and playing is ${this.playing}`):this.isDestroyedOrClosed()?this.debugWarn(this.TAG_NAME,"checkLoadingTimeout but player is destroyed"):(this.debugWarn(this.TAG_NAME,"checkLoadingTimeout and pause and emit loadingTimeout event"),this.emit(at.timeout,at.loadingTimeout),this.emit(at.loadingTimeout))}),1e3*this._opt.loadingTimeout)}clearCheckLoadingTimeout(){this._checkLoadingTimeout&&(this.debugLog(this.TAG_NAME,"clearCheckLoadingTimeout"),clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}handleRender(){this.isDestroyedOrClosed()?this.debugWarn(this.TAG_NAME,"handleRender but player is destroyed"):(this.loading&&(this.clearCheckLoadingTimeout(),this.loading=!1,this.emit(at.start)),this.playing||(this.playing=!0))}updateStats(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.isDestroyedOrClosed())return void this.debugLog(this.TAG_NAME,"updateStats but player is closed or destroyed");if(this._startBpsTime||(this._startBpsTime=oo()),Mo(e.ts)){const t=parseInt(e.ts,10);this._stats.ts=t,this._tempTsList.push(t),null===this._playingStartTimestamp&&t>0&&(this._playingStartTimestamp=t)}Mo(e.dts)&&(this._stats.dts=parseInt(e.dts,10)),Mo(e.mseTs)&&(this._stats.mseTs=e.mseTs),Mo(e.buf)&&(this._stats.buf=e.buf),Mo(e.netBuf)&&(this._stats.netBuf=e.netBuf),Mo(e.currentPts)&&(this._stats.currentPts=e.currentPts),e.fps&&(this._stats.fps+=1),e.dfps&&(this._stats.dfps+=1),e.abps&&(this._stats.abps+=e.abps),e.vbps&&(this._stats.vbps+=e.vbps),e.workerStats&&(this._tempWorkerStats=e.workerStats),e.isDropping&&(this._stats.isDropping=e.isDropping),e.mseVideoBufferDelayTime&&(this._stats.mseVideoBufferDelayTime=parseInt(1e3*e.mseVideoBufferDelayTime,10));const t=oo();if(t-this._startBpsTime<1e3)return;null!==this._playingStartTimestamp&&this._stats.fps>0&&(this._stats.pTs+=1);let i=0,s=0,r=0,o=0,a=0;this._opt.useMSE&&(this.mseDecoder?(i=this.mseDecoder.checkSourceBufferDelay(),i=parseInt(1e3*i,10),s=this.mseDecoder.checkSourceBufferStore(),s=s.toFixed(2),o=this.mseDecoder.getDecodePlaybackRate(),a=this.mseDecoder.getPendingSegmentsLength()):this.isMseDecoderUseWorker()&&(i=this.video.checkSourceBufferDelay(),i=parseInt(1e3*i,10),s=this.video.checkSourceBufferStore(),s=s.toFixed(2),o=this.video.getDecodePlaybackRate())),this._opt.useWCS&&this.webcodecsDecoder&&(r=this.webcodecsDecoder.getDecodeDiffTimes()),this.isOldHls()&&this.hlsDecoder&&(i=this.hlsDecoder.checkHlsBufferedDelay(),i=parseInt(1e3*i,10));let n=0,l=0,d=0;this.isUseHls265()&&this.hlsDecoder&&(i=this.hlsDecoder.checkHlsBufferedDelay(),i=i.toFixed(2),n=this.hlsDecoder.getDemuxBufferedListLength(),d=this.hlsDecoder.getDemuxVideoBufferedListLength(),l=this.hlsDecoder.getDemuxAudioBufferedListLength());let h=0,c=0,u=0,p=!1,f=0,m=0;this._opt.useWasm||this._opt.demuxUseWorker?this._tempWorkerStats&&(c=this._tempWorkerStats.demuxBufferDelay,u=this._tempWorkerStats.audioDemuxBufferDelay,h=this._tempWorkerStats.streamBufferByteLength,this._stats.netBuf=this._tempWorkerStats.netBuf,f=this._tempWorkerStats.pushLatestDelay,p=this._tempWorkerStats.isStreamTsMoreThanLocal,this._stats.buf=this._tempWorkerStats.latestDelay,m=this._tempWorkerStats.wasmDecodeDelay):this.demux&&(h=this.demux.getInputByteLength(),f=this.demux.getPushLatestDelay(),p=this.demux.getIsStreamTsMoreThanLocal(),this.demux.bufferList&&(c=this.demux.bufferList.length));let g=0,y=0;this.audio&&this.audio.bufferList&&(g=this.audio.bufferList.length,y=parseInt(g*this.audio.oneBufferDuration,10));let A=0,b=0;if(this.isPlayback()&&this.video){this._opt.playbackConfig.isUseFpsRender&&(A=this.video.bufferList&&this.video.bufferList.length||0);let e=this.video.getStreamFps();const t=e>0?1e3/e:0;b=parseInt(t*A+t*c,10)}let v=0;this.videoTimestamp>0&&(v=this._stats.dts-this.videoTimestamp);const _=v+this._stats.netBuf;this.isOldHls()&&(this._stats.fps=this.hlsDecoder.getFps()),this._stats.fps>this._stats.maxFps&&(this._stats.maxFps=this._stats.fps);let w=this.getVideoCurrentTime();const S=this._stats.videoCurrentTime;let E=-1;S&&w&&(E=So((w-S).toFixed(2)),w=w.toFixed(2));let T=0;this.audioTimestamp>0&&(T=this.audioTimestamp-this.getRenderCurrentPts()),this._allStatsData=Object.assign(this._stats,{audioBuffer:g,audioBufferDelayTs:y,audioTs:this.audioTimestamp,latestAudioTs:this.latestAudioTimestamp,playbackVideoBuffer:A,playbackVideoWaitingBuffer:0,playbackAudioWaitingBuffer:0,playbackCacheDataDuration:b,demuxBuffer:c,pushLatestDelay:f,audioDemuxBuffer:u,streamBuffer:h,mseDelay:i,mseStore:s,mseDecodeDiffTimes:r,mseDecodePlaybackRate:o,msePendingBuffer:a,wcsDecodeDiffTimes:r,wasmDecodeDelay:m,hlsDelay:i,hlsDemuxLength:n,hlsDemuxAudioLength:l,hlsDemuxVideoLength:d,delayTs:v,totalDelayTs:_,isStreamTsMoreThanLocal:p,videoCurrentTime:w,videoCurrentTimeDiff:E,audioSyncVideo:T});let L=null,C=null,x="";if(this.isPlayer()&&this._opt.hasVideo&&this.playing){L=function(e,t){let i=3;const s=t||25;return e<=s*(1/4)?i=0:e<=.5*s?i=1:e<=s*(3/4)&&(i=2),i}(this._stats.fps,this._flvMetaDataFps),this._allStatsData.performance=L;const e=this.checkVideoSmooth(this._allStatsData);x=e.reason,C=e.result,this._allStatsData.videoSmooth=C}this.emit(at.stats,this._allStatsData),this._allStatsData.streamBuffer>this._opt.flvDemuxBufferSizeMaxLarge&&this.getDemuxType()===k&&this.emit(dt.flvDemuxBufferSizeTooLarge,this._allStatsData.streamBuffer),this._opt.hasVideo?(this.updateHistoryFpsList(this._stats.fps,this._allStatsData.videoCurrentTimeDiff),Mo(L)&&this.emit(at.performance,L),Mo(C)&&this.emit(at.videoSmooth,C,x)):this._opt.hasAudio&&this.updateHistoryFpsList(this._stats.abps,0),this.isPlaybackUseMSE()&&this.isPlaying()&&0===this._allStatsData.videoCurrentTimeDiff&&(this.debugWarn(this.TAG_NAME,`updateStats and videoCurrentTimeDiff is 0 and\n videoCurrentTime is ${this._allStatsData.videoCurrentTime}\n and next update video currentTime`),this.mseDecoder.updateVideoCurrentTimeByBufferStart()),this._stats.fps=0,this._stats.dfps=0,this._stats.abps=0,this._stats.vbps=0,this._tempTsList=[],this._stats.isDropping=!1,this._startBpsTime=t}resetStats(){this._startBpsTime=null,this._playingStartTimestamp=null,this._historyFpsList=[],this._historyVideoDiffList=[],this._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,currentPts:0,pTs:0,dts:0,mseVideoBufferDelayTime:0,isDropping:!1},this._allStatsData={},this._tempTsList=[]}checkVideoSmooth(e){let t=!0,i="";if(this._opt.videoBuffer,this._opt.videoBufferDelay,this.isWebrtcH264()||this.isOldHls())return{result:t,reason:i};if(0===e.vbps&&Aa(this._opt.isHls)&&(i="vbpsIsZero",this.debugLog(this.TAG_NAME,`checkVideoSmooth false because ${i}`),t=!1),t&&e.isDropping&&(i="isDroppingIsTrue",this.debugLog(this.TAG_NAME,`checkVideoSmooth false because ${i}`),t=!1),t&&this.visibility&&this._historyFpsList.length>=this._opt.heartTimeout){const s=function(e){const t=Math.max(...e),i=Math.min(...e);return e.filter((e=>e!==t&&e!==i))}(this._historyFpsList),r=s.reduce(((e,t)=>e+t),0)/s.length,o=.83*r;e.fps=1.5||e.videoCurrentTimeDiff<=.5)&&-1!==e.videoCurrentTimeDiff){if(i="videoCurrentTimeDiffIsNotNormal",this.debugLog(this.TAG_NAME,`checkVideoSmooth false because videoCurrentTimeDiff is ${e.videoCurrentTimeDiff}`),0===Number(e.videoCurrentTimeDiff)){const e=this.isVideoPlaying(),t=this.getVideoCurrentTime(),i=this.getVideoBufferTimeRange();let s=-1,r=-1;i&&(s=i.start,r=i.end),this.debugLog(this.TAG_NAME,`checkVideoSmooth and videoCurrentTimeDiff is 0 so check\n videoCurrentTime is ${t} and isPlaying is ${e}\n bufferStartTime is ${s} and bufferEndTime is ${r}`)}t=!1}return{result:t,reason:i}}enableWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.enable()}releaseWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.disable()}clearBufferDelay(){this._opt.useWasm?this.decoderWorker&&this.decoderWorker.clearWorkBuffer(!0):this.demux&&this.demux.clearBuffer(!0)}doDestroy(){this.emit(at.beforeDestroy)}handlePlayToRenderTimes(){if(this.isDestroyedOrClosed())return void this.debugLog(this.TAG_NAME,"handlePlayToRenderTimes but player is closed or destroyed");const e=this.getPlayToRenderTimes();this.emit(at.playToRenderTimes,e)}getPlayToRenderTimes(){const e=this._times;return e.playTimestamp=e.playStart-e.playInitStart,e.streamTimestamp=e.streamStart-e.playStart,e.streamResponseTimestamp=e.streamResponse-e.streamStart>0?e.streamResponse-e.streamStart:0,e.demuxTimestamp=e.demuxStart-e.streamResponse>0?e.demuxStart-e.streamResponse:0,e.decodeTimestamp=e.decodeStart-e.demuxStart>0?e.decodeStart-e.demuxStart:0,e.videoTimestamp=e.videoStart-e.decodeStart,e.allTimestamp=e.videoStart-e.playInitStart,e}getOption(){return this._opt}getPlayType(){return this._opt.playType}isPlayer(){return this._opt.playType===v}isPlayback(){return this._opt.playType===w}isDemuxSetCodecInit(){let e=!0,t=this._opt;return t.useWCS&&!t.useOffscreen?e=!!this.webcodecsDecoder&&this.webcodecsDecoder.hasInit:t.useMSE&&(e=!!this.mseDecoder&&this.mseDecoder.hasInit),e}isDemuxDecodeFirstIIframeInit(){let e=!0,t=this._opt;return t.useWCS&&!t.useOffscreen?e=!!this.webcodecsDecoder&&this.webcodecsDecoder.isDecodeFirstIIframe:t.useMSE&&(e=!!this.mseDecoder&&this.mseDecoder.isDecodeFirstIIframe),e}isAudioPlaybackRateSpeed(){let e=!1;return this.audio&&(e=this.audio.isPlaybackRateSpeed()),e}getPlayingTimestamp(){return this._stats.pTs}getRecordingType(){let e=null;return this.recorder&&(e=this.recorder.getType()),e}getRecordingByteLength(){let e=0;return this.recording&&(e=this.recorder.getToTalByteLength()),e}getRecordingDuration(){let e=0;return this.recording&&(e=this.recorder.getTotalDuration()),e}getDecodeType(){let e="";const t=this.getOption();return this.isWebrtcH264()?z:this.isAliyunRtc()?V:this.isOldHls()?$:(t.useMSE&&(e+=U+" ",t.mseDecoderUseWorker&&(e+="worker")),t.useWCS&&(e+=O+" "),t.useWasm&&(e+=j+" ",t.useSIMD&&(e+=G+" "),t.useMThreading&&(e+=W+" ")),t.useOffscreen&&(e+=N+" "),e)}getDemuxType(){return this._opt.demuxType}getRenderType(){let e="";return this.video&&(e=this.video.getType()),e}getCanvasRenderType(){let e="";return this.video&&(e=this.video.getCanvasType()),e}getAudioEngineType(){let e="";return this.audio&&(e=this.audio.getEngineType()),e}getStreamType(){let e="";return this.stream&&(e=this.stream.getStreamType()),e}isStreamTypeNotWorker(){return-1===this.getStreamType().indexOf(A)}getAllStatsData(){return this._allStatsData}isFlvDemux(){return this._opt.demuxType===k}isM7SDemux(){return this._opt.demuxType===L}isNakedFlowDemux(){return this._opt.demuxType===R}isMpeg4Demux(){return this._opt.demuxType===I}isTsDemux(){return this._opt.demuxType===M}isFmp4Demux(){return this._opt.demuxType===P}togglePerformancePanel(e){this.updateOption({showPerformance:e}),this.emit(at.togglePerformancePanel,e)}setScaleMode(e){let t={isFullResize:!1,isResize:!1,aspectRatio:"default"};switch(e=Number(e)){case Zt:t.isFullResize=!1,t.isResize=!1;break;case ei:t.isFullResize=!1,t.isResize=!0;break;case ti:t.isFullResize=!0,t.isResize=!0}this.updateOption(t),this.resize(),this.emit(at.viewResizeChange,e)}startVisibilityHiddenTimeout(){this.clearVisibilityHiddenTimeout(),this._opt.pageVisibilityHiddenTimeout>0&&(this.visibilityHiddenTimeout=setTimeout((()=>{this.emit(at.visibilityHiddenTimeout)}),1e3*this._opt.pageVisibilityHiddenTimeout))}clearVisibilityHiddenTimeout(){this._checkVisibleHiddenTimeout&&(clearTimeout(this._checkVisibleHiddenTimeout),this._checkVisibleHiddenTimeout=null)}faceDetect(e){this.faceDetectActive=e,Aa(e)&&this.video&&this.video.addAiContentToCanvas([])}objectDetect(e){this.objectDetectActive=e,Aa(e)&&this.video&&this.video.addAiContentToCanvas([])}occlusionDetect(e){this.occlusionDetectActive=e}downloadNakedFlowFile(){this.demux&&this.demux.downloadNakedFlowFile&&this.demux.downloadNakedFlowFile()}downloadFmp4File(){this.demux&&this.demux.downloadFmp4File&&this.demux.downloadFmp4File()}downloadMpeg4File(){const e=new Blob([this._tempStreamList]);try{const t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".mpeg4",t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadMpeg4File",e)}}hasCacheOnGopBuffer(){const e=this.videoIframeIntervalTs,t=this._allStatsData.demuxBuffer,i=this._allStatsData.maxFps;let s=!1;if(e&&t&&i){s=1e3/i*t>e}return s}addContentToCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.video&&this.video.addContentToCanvas(e)}addContentToContainer(){}sendWebsocketMessage(e){const t=this.getStreamType();t===m||t===A+" "+m?this.stream.sendMessage(e):this.debugWarn(this.TAG_NAME,`sendWebsocketMessage: stream type is not websocket, current stream type is ${this.getStreamType()}`)}checkIsInRender(){const e=this._stats;return e.vbps>0&&e.fps>0}setControlHtml(e){this.control&&this.control.$controlHtml&&(this.control.$controlHtml.innerHTML=e)}clearControlHtml(){this.control&&this.control.$controlHtml&&(this.control.$controlHtml.innerHTML="")}toggleControlHtml(e){this.control&&this.control.toggleControlHtml(e)}getControlHtmlIsShow(){return!!this.control&&this.control.getControlHtmlIsShow()}getControlHtml(){return this.control?this.control.getControlHtml():null}setExtendHtml(e){this.control&&(this.control.$extendDom?this.control.updateExtendDom(e):this.control.addExtendDom({html:e,showBeforePlay:!0}))}clearExtendHtml(){this.control&&this.control.removeExtendDom()}toggleExtendHtml(e){this.control&&this.control.toggleExtendDom(e)}getExtendHtmlIsShow(){return!!this.control&&this.control.getExtendDomIsShow()}getExtendHtml(){return this.control?this.control.getExtendDom():null}updateWatermark(e){this.singleWatermark||(this.singleWatermark=new za(this)),this.singleWatermark&&this.singleWatermark.update(e)}removeWatermark(){this.singleWatermark&&this.singleWatermark.remove()}getVideoInfo(){let e=null;return this.video&&(e=this.video.getVideoInfo()),e}getAudioInfo(){let e=null;return this.audio&&(e=this.audio.getAudioInfo()),e}getVideoPlaybackQuality(){let e=null;return this.video&&(e=this.video.getPlaybackQuality()),e}emitError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.emit(at.error,e,t),this.emit(e,t)}updateHistoryFpsList(e,t){this.playbackPause||Aa(this.visibility)||(this._historyFpsList.length>this._opt.heartTimeout&&(this._historyFpsList.shift(),this._historyVideoDiffList.shift()),this._historyFpsList.push(e),this._historyVideoDiffList.push(t),this.isHistoryFpsListAllZero()&&this.checkHeartTimeout$2())}isHistoryFpsListAllZero(){let e=!0;if(this._historyFpsList.length0){e=!1;break}if(e)for(let t=0;t0){e=!1;break}return e}isUseHls265(){return ya(this._opt.isHls)&&ya(this._opt.supportHls265)}isHls(){return ya(this._opt.isHls)}isOldHls(){return ya(this._opt.isHls)&&Aa(this._opt.supportHls265)}isWebrtcNotH265(){return ya(this._opt.isWebrtc)&&Aa(this._opt.isWebrtcH265)}isWebrtcH264(){return ya(this._opt.isWebrtc)&&Aa(this._opt.isWebrtcH265)}isWebrtcH265(){return ya(this._opt.isWebrtc)&&ya(this._opt.isWebrtcH265)}isAliyunRtc(){return ya(this._opt.isAliyunRtc)}isUseHls265UseMse(){return this.isUseHls265()&&this.isUseMSE()}isStreamWebTransport(){return this.getStreamType()===y}isPlaybackCacheBeforeDecodeForFpsRender(){return this.isPlayback()&&ya(this._opt.playbackConfig.isCacheBeforeDecodeForFpsRender)&&ya(this._opt.useWCS)}isPlaybackPauseNotClearCacheAndCacheBeforeDecodeAndUseFpsRender(){return this.isPlayback()&&Aa(this._opt.playbackConfig.isPlaybackPauseClearCache)&&ya(this._opt.playbackConfig.isCacheBeforeDecodeForFpsRender)}isPlaybackUseWCS(){return this.isPlayback()&&ya(this._opt.useWCS)}isPlaybackUseMSE(){return this.isPlayback()&&ya(this._opt.useMSE)}isPlaybackUseWASM(){return this.isPlayback()&&ya(this._opt.useWasm)}isPlayUseMSE(){return this.isPlayer()&&ya(this._opt.useMSE)}isMSEDecodeAudio(){return this._opt.useMSE&&this._opt.mseDecodeAudio}isWCSDecodeAudio(){this._opt.useWCS&&this._opt.wcsDecodeAudio}isInWebFullscreen(){return this._opt.useWebFullScreen&&fo()&&this.fullscreen}getPlaybackRate(){let e=1;return ya(this.isPlayback())&&this.playback&&(e=this.playback.rate),e}isPlaybackOnlyDecodeIFrame(){return ya(this.isPlayback())&&this.getPlaybackRate()>=this._opt.playbackForwardMaxRateDecodeIFrame&&!this.isMSEDecodeAudio()}pushTempStream(e){const t=new Uint8Array(e);this._tempStreamList.push(t)}updateLoadingText(e){this.loading&&this.control&&this.control.updateLoadingText(e)}getVideoCurrentTime(){let e=0;return this.video&&(this._opt.useMSE?this.mseDecoder?e=this.mseDecoder.getVideoCurrentTime():this.isMseDecoderUseWorker()&&(e=this.video.getVideoCurrentTime()):this.isWebrtcH264()&&this.webrtc?e=this.webrtc.getVideoCurrentTime():this.isAliyunRtc()&&this.aliyunRtcDecoder&&(e=this.aliyunRtcDecoder.getVideoCurrentTime())),e}getVideoBufferTimeRange(){let e=null;return this.video&&(this._opt.useMSE?this.mseDecoder?e=this.mseDecoder.getVideoBufferTimeRange():this.isMseDecoderUseWorker()&&(e=this.video.getVideoBufferTimeRange()):this.isWebrtcH264()&&this.webrtc?e=this.webrtc.getVideoBufferTimeRange():this.isAliyunRtc()&&this.aliyunRtcDecoder&&(e=this.aliyunRtcDecoder.getVideoBufferTimeRange())),e}isVideoPlaying(){let e=!0;return this.video&&(this._opt.useMSE?this.mseDecoder?e=this.mseDecoder.isVideoPlaying():this.isMseDecoderUseWorker()&&(e=this.video.isVideoPlaying()):this.isWebrtcH264()&&this.webrtc?e=this.webrtc.isVideoPlaying():this.isAliyunRtc()&&this.aliyunRtcDecoder&&(e=this.aliyunRtcDecoder.isVideoPlaying())),e}addMemoryLog(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s0){const e=t/1e3;this._flvMetaDataFps=e}}Bo(e.hasAudio)&&Aa(e.hasAudio)&&(this.debugLog("updateMetaData","hasAudio",e.hasAudio,"and update _opt.hasAudio"),this._opt.hasAudio=e.hasAudio),Bo(e.hasVideo)&&Aa(e.hasVideo)&&(this.debugLog("updateMetaData","hasVideo",e.hasVideo,"and update _opt.hasVideo"),this._opt.hasVideo=e.hasVideo),e.server&&(this._serverInfo=(e.server+"").substring(0,10)),e.MetaDataCreator&&(this._serverInfo=e.MetaDataCreator)}this.emit(at.flvMetaData,e)}getMetaData(){return this._flvMetaData}getExtendBtnList(){return this.control.getExtendBtnList().map((e=>({name:e.name,$container:e.$iconContainer,$btn:e.$iconWrap,$activeBtn:e.$activeIconWrap})))}getCpuLevel(){let e=null;return this.pressureObserverCpu&&(e=this.pressureObserverCpu.getCurrentCpuState()),e}isRecordTypeFlv(){return this.recorder&&this._opt.recordType===T}isRecordTypeMp4(){return this.recorder&&this._opt.recordType===S}isRecordTypeWebm(){return this.recorder&&this._opt.recordType===E}isDemuxInWorker(){return this._opt.useWasm||this._opt.demuxUseWorker}isUseMSE(){return ya(this._opt.useMSE)}isUseWCS(){return ya(this._opt.useWCS)}isUseWASM(){return ya(this._opt.useWasm)}isMseDecoderUseWorker(){return this.isUseMSE()&&ya(this._opt.mseDecoderUseWorker)}getAudioSyncVideoDiff(){return this.audioTimestamp-this.getRenderCurrentPts()}getCurrentVideoAndAudio(){return{video:this.getRenderCurrentPts(),audio:this.audioTimestamp}}getMseVideoBufferDelayTime(){let e=0;return this._opt.useMSE&&this.mseDecoder&&(this.mseDecoder?e=this.mseDecoder.getVideoBufferDelayTime():this.isMseDecoderUseWorker()&&(e=this.video.getVideoBufferDelayTime()),e=parseInt(1e3*e,10)),e}updateCurrentPts(e){this.updateStats({currentPts:e}),this.emit(at.currentPts,e),this.emitVideSeiSyncPts(e)}emitVideoSei(e){this.emit(at.videoSEI,e),this._seiList.push(e)}emitVideSeiSyncPts(e){if(0===this._seiList.length||Aa(this._opt.isEmitSEI))return;const t=1e3*this._opt.videoSEISyncPtsDiff,i=e-t,s=e+t,r=[];this._seiList.forEach((t=>{t.ts>=i&&t.ts<=s&&(t.pts=e,r.push(t))})),r.forEach((e=>{this.emit(at.videoSEISyncPts,e)})),this._seiList=this._seiList.filter((e=>e.ts>s))}getRenderCurrentPts(){let e=0;return e=this._stats.currentPts?this._stats.currentPts:this.videoTimestamp-this.getMseVideoBufferDelayTime(),e}openSyncAudioAndVideo(){return this._opt.syncAudioAndVideo&&this._opt.hasVideo}showTipsMessageByCode(e){if(this.control){const t=this._opt.showMessageConfig[e]||"未知异常";this.control.showTipsMessage(t,e)}}showTipsMessageByContent(e){this.control&&e&&this.control.showTipsMessage(e)}hideTipsMessage(){this.control&&this.control.hideTipsMessage()}decoderCheckFirstIFrame(){ya(this._opt.checkFirstIFrame)&&(this.mseDecoder?this.mseDecoder.isDecodeFirstIIframe=!1:this.webcodecsDecoder&&(this.webcodecsDecoder.isDecodeFirstIIframe=!1))}isHlsCanVideoPlay(){return this._canPlayAppleMpegurl&&this.isOldHls()}setPtzPosition(e){this.control&&this.control.updatePtzPosition(e)}setRotate(e){this.updateOption({rotate:e}),this.resize()}setPlayFailedAndPaused(){this.isPlayFailedAndPaused=!0}getMseMineType(){let e={};return this.mseDecoder&&(e=this.mseDecoder.getMimeType()),e}getMaxDelayTs(){return this._opt.videoBuffer+this._opt.videoBufferDelay}isMseVideoStateInited(){return!this.video||this.video.getReadyStateInited()}showPlayBtn(){this.control&&this.control.showPlayBtn()}toggleControlExtendBtn(e,t){this.control&&this.control.toggleExtendBtn(e,t)}getControlExtendBtnActive(e){let t=!1;return this.control&&(t=this.control.getExtendBtnActive(e)),t}useVideoPlayAudio(){return this._opt.hasAudio&&(this._opt.useWCS&&this._opt.wcsDecodeAudio||this._opt.useWasm&&this._opt.wasmPlayAudioUseVideoRender)}isControlBarShow(){const e=this._opt.hasControl,t=this._opt.controlAutoHide;let i=e&&!t;return i&&this.control&&(i=this.control.getBarIsShow()),i}getControlBarShow(){let e=!1;return this.control&&(e=this.control.getBarIsShow()),e}toggleControlBar(e){this.control&&(this.control.toggleBar(e),this.resize())}debugLog(e){if(this._opt.debug&&this.debug){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s1?t-1:0),s=1;s1?t-1:0),s=1;s1&&0===e[e.length-1]&&0===e[e.length-2]}}class kv{constructor(e){this.player=e,this.globalSetting=null;const t=Eo();this.defaultSettings={watermark_id:`JbPro_${t}`,watermark_prefix:`JbPro_mask_${t}`,watermark_txt:"JbPro 测试水印",watermark_x:0,watermark_y:0,watermark_rows:0,watermark_cols:0,watermark_x_space:0,watermark_y_space:0,watermark_font:"微软雅黑",watermark_color:"black",watermark_fontsize:"18px",watermark_alpha:.15,watermark_width:150,watermark_height:100,watermark_angle:15,watermark_parent_width:0,watermark_parent_height:0,watermark_parent_node:null},this.load({text:decodeURIComponent("JessibucaPro%20%E4%BD%93%E9%AA%8C"),color:"white"}),this.player.debugLog("Watermark","int")}destroy(){this._removeMark(),this.globalSetting=null,this.defaultSettings=null,this.player.debugLog("Watermark","destroy")}remove(){}load(e){this.globalSetting=e,this._loadMark(e)}resize(){this.player.debugLog("Watermark","resize()"),this.globalSetting&&this._loadMark(this.globalSetting)}_loadMark(){let e=this.defaultSettings;if(1===arguments.length&&"object"==typeof arguments[0]){var t=arguments[0]||{};for(let i in t)t[i]&&e[i]&&t[i]===e[i]||(t[i]||0===t[i])&&(e[i]=t[i])}var i=document.getElementById(e.watermark_id);i&&i.parentNode&&i.parentNode.removeChild(i);var s="string"==typeof e.watermark_parent_node?document.getElementById(e.watermark_parent_node):e.watermark_parent_node,r=s||document.body;const o=r.getBoundingClientRect();var a=Math.max(r.scrollWidth,r.clientWidth,o.width),n=Math.max(r.scrollHeight,r.clientHeight,o.height),l=arguments[0]||{},d=r;(l.watermark_parent_width||l.watermark_parent_height)&&d&&(e.watermark_x=e.watermark_x+0,e.watermark_y=e.watermark_y+0);var h=document.getElementById(e.watermark_id),c=null;if(h)h.shadowRoot&&(c=h.shadowRoot);else{(h=document.createElement("div")).id=e.watermark_id,h.setAttribute("style","pointer-events: none !important; display: block !important"),c="function"==typeof h.attachShadow?h.attachShadow({mode:"open"}):h;var u=r.children,p=Math.floor(Math.random()*(u.length-1))+1;u[p]?r.insertBefore(h,u[p]):r.appendChild(h)}e.watermark_cols=parseInt((a-e.watermark_x)/(e.watermark_width+e.watermark_x_space));var f,m=parseInt((a-e.watermark_x-e.watermark_width*e.watermark_cols)/e.watermark_cols);e.watermark_x_space=m?e.watermark_x_space:m,e.watermark_rows=parseInt((n-e.watermark_y)/(e.watermark_height+e.watermark_y_space));var g,y,A,b=parseInt((n-e.watermark_y-e.watermark_height*e.watermark_rows)/e.watermark_rows);e.watermark_y_space=b?e.watermark_y_space:b,s?(f=e.watermark_x+e.watermark_width*e.watermark_cols+e.watermark_x_space*(e.watermark_cols-1),g=e.watermark_y+e.watermark_height*e.watermark_rows+e.watermark_y_space*(e.watermark_rows-1)):(f=0+e.watermark_x+e.watermark_width*e.watermark_cols+e.watermark_x_space*(e.watermark_cols-1),g=0+e.watermark_y+e.watermark_height*e.watermark_rows+e.watermark_y_space*(e.watermark_rows-1));for(var v=0;v\n \n \n ${m.watermark_txt}\n \n \n ${m.watermark_txt}\n \n \n \n \n `,_=window.btoa(unescape(encodeURIComponent(v)));var w=document.createElement("div");w.style.position="absolute",w.style.left="0px",w.style.top="0px",w.style.overflow="hidden",w.style.zIndex="9999999",w.style.width=a+"px",w.style.height=n+"px",w.style.display="block",w.style["-ms-user-select"]="none",w.style.backgroundImage=`url(data:image/svg+xml;base64,${_})`,c.appendChild(w)}_removeMark(){const e=this.defaultSettings;var t=document.getElementById(e.watermark_id);if(t){var i=t.parentNode;i&&i.removeChild(t)}}_calcTextSize(){const{watermark_txt:e,watermark_font:t,watermark_fontsize:i}=this.globalSetting,s=document.createElement("span");s.innerHTML=e,s.setAttribute("style",`font-family: ${t}; font-size: ${i}px; visibility: hidden; display: inline-block`),document.querySelector("body").appendChild(s);const r={width:s.offsetWidth,height:s.offsetHeight};return s.remove(),r}}const Cv="right",xv="left",Dv="up",Rv="down",Pv="leftUp",Iv="leftDown",Bv="rightUp",Mv="rightDown",Fv="zoomExpand",Uv="zoomNarrow",Ov="apertureFar",Nv="apertureNear",jv="focusFar",Gv="focusNear",Wv="setPos",zv="calPos",$v="delPos",Vv="wiperOpen",Hv="wiperClose",Jv="cruiseStart",qv={stop:0,fiStop:0,right:1,left:2,up:8,down:4,leftUp:10,leftDown:6,rightUp:9,rightDown:5,zoomExpand:16,zoomNarrow:32,apertureFar:72,apertureNear:68,focusFar:66,focusNear:65,setPos:129,calPos:130,delPos:131,wiperOpen:140,wiperClose:141,setCruise:132,decCruise:133,cruiseStart:136,cruiseStop:0},Kv=[25,50,75,100,125,150,175,200,225,250],Yv=[1,2,3,4,5,6,7,8,9,16],Qv=[16,48,80,112,144,160,176,192,208,224];function Xv(e){const{type:t,speed:i=5,index:s=0}=e,r=function(e){return Kv[(e=e||5)-1]||Kv[4]}(i);let o,a,n,l;if(o=qv[t],!o)return"";switch(t){case Dv:case Rv:case Ov:case Nv:n=r;break;case Cv:case xv:case jv:case Gv:a=r;break;case Pv:case Iv:case Bv:case Mv:a=r,n=r;break;case Fv:case Uv:l=function(e){return Qv[(e=e||5)-1]||Qv[4]}(i);break;case zv:case $v:case Wv:n=Zv(s);break;case Hv:case Vv:a=1;break;case Jv:a=Zv(s)}return function(e,t,i,s){let r=[];r[0]=165,r[1]=15,r[2]=1,r[3]=0,r[4]=0,r[5]=0,r[6]=0,e&&(r[3]=e);t&&(r[4]=t);i&&(r[5]=i);s&&(r[6]=s);return r[7]=(r[0]+r[1]+r[2]+r[3]+r[4]+r[5]+r[6])%256,function(e){let t="";for(let i=0;it)){for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i===t?s[r]=t_(e[r]):"object"==typeof e[r]?s[r]=i_(e[r],t,i+1):s[r]=e[r]);return s}}function s_(){return(new Date).toLocaleString()}class r_{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player=e,this.TAG_NAME="MemoryLogger",this.logMaxSize=(null==t?void 0:t.logMaxSize)||204800,this.logSize=0,this.logTextArray=[],this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.clear(),this.player.debugLog(this.TAG_NAME,"destroy")}clear(){this.logSize=0,this.logTextArray=[]}logCache(){let e="";try{for(var t=arguments.length,i=new Array(t),s=0;si_(e)));e="[JbPro] "+s_()+JSON.stringify(r)}catch(e){return}if(this.logSize+=e.length,this.logTextArray.push(e),this.logSize>this.logMaxSize){const e=this.logTextArray.shift();this.logSize-=e.length}}getLog(){return this.logTextArray.join("\n")}getLogBlob(){const e=this.getLog();return new Blob([e],{type:"text/plain"})}download(){const e=this.getLog();this.clear();const t=new Blob([e],{type:"text/plain"});Ya(t,"JbPro-"+s_()+".log")}}class o_ extends o{constructor(e){super(),this.player=e,this.TAG_NAME="Network",this.online=this.isOnline(),this.prevOnline=this.online,this.interval=null,this._initListener(),this.player.debugLog(this.TAG_NAME,"init")}destroy(){this.off(),this._stopCheck(),window.removeEventListener("online",this._updateOnlineStatus),window.removeEventListener("offline",this._updateOfflineStatus),this.player.debugLog(this.TAG_NAME,"destroy")}_initListener(){window.addEventListener("online",this._updateOnlineStatus.bind(this)),window.addEventListener("offline",this._updateOfflineStatus.bind(this))}_stopCheck(){this.interval&&(clearInterval(this.interval),this.interval=null)}_startCheck(){this.interval=setInterval((()=>{this.isOnline()!==this.prevOnline&&(this.isOnline()?this._updateOnlineStatus():this._updateOfflineStatus())}),1e3)}_updateOnlineStatus(){this.prevOnline=this.online,this.online=!0,this.logStatus(),this.emit("online")}_updateOfflineStatus(){this.prevOnline=this.online,this.online=!1,this.logStatus(),this.emit("offline")}logStatus(){const e=this.prevOnline?"online":"offline",t=this.online?"online":"offline";this.player.debugLog(this.TAG_NAME,`prevOnline: ${this.prevOnline}, online: ${this.online}, status: ${e} -> ${t}`)}isOnline(){return void 0===navigator.onLine||navigator.onLine}isOffline(){return!this.isOnline()}}class a_ extends o{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this._opt={},this.TAG_NAME="JbPro",this.$container=null,Object.keys(e).forEach((t=>{if(void 0===e[t])throw new Error(`JbPro option "${t}" can not be undefined`)})),this.originalOptions=e;const t=fa();let i=Object.assign({},t,e);i.url="",i.isMulti&&(i.debugUuid=ua()),this.debug=new Dr(this);let s=e.container;if("string"==typeof e.container&&(s=document.querySelector(e.container)),!s)throw this.debugError("JbPro","JbPro need container option and now container is",e.container),new Error("JbPro need container option");if(Aa(i.isLive)){const e=document.createElement("video");return e.muted=!0,e.setAttribute("controlsList","nodownload"),e.disablePictureInPicture="disablePictureInPicture",e.style.position="absolute",e.style.top=0,e.style.left=0,e.style.height="100%",e.style.width="100%",s.appendChild(e),this.$videoElement=e,this.$container=s,void(this._opt=i)}if(i.decoder&&Aa(-1!==i.decoder.indexOf("decoder-pro.js")||-1!==i.decoder.indexOf("decoder-pro-simd.js")))throw this.debugError("JbPro",`JbPro decoder ${i.decoder} must be decoder-pro.js or decoder-pro-simd.js`),new Error(`JbPro decoder ${i.decoder} must be decoder-pro.js or decoder-pro-simd.js`);if("CANVAS"===s.nodeName||"VIDEO"===s.nodeName)throw this.debugError("JbPro",`JbPro container type can not be ${s.nodeName} type`),new Error(`JbPro container type can not be ${s.nodeName} type`);if(i.videoBuffer>=i.heartTimeout)throw this.debugError("JbPro",`JbPro videoBuffer ${i.videoBuffer}s must be less than heartTimeout ${i.heartTimeout}s`),new Error(`JbPro videoBuffer ${i.videoBuffer}s must be less than heartTimeout ${i.heartTimeout}s`);if(this._checkHasCreated(s))throw this.debugError("JbPro","JbPro container has been created and can not be created again",s),new Error("JbPro container has been created and can not be created again",s);if(!s.classList)throw this.debugError(this.TAG_NAME,"JbPro container is invalid, must be a DOM Element",s),new Error("JbPro container is invalid, must be a DOM Element",s);if(s.classList.add("jb-pro-container"),ba(s,te,Eo()),delete i.container,Mo(i.videoBuffer)&&(i.videoBuffer=1e3*Number(i.videoBuffer)),Mo(i.videoBufferDelay)&&(i.videoBufferDelay=1e3*Number(i.videoBufferDelay)),Mo(i.networkDelay)&&(i.networkDelay=1e3*Number(i.networkDelay)),Mo(i.aiFaceDetectInterval)&&(i.aiFaceDetectInterval=1e3*Number(i.aiFaceDetectInterval)),Mo(i.aiObjectDetectInterval)&&(i.aiObjectDetectInterval=1e3*Number(i.aiObjectDetectInterval)),Mo(i.timeout)&&(Io(i.loadingTimeout)&&(i.loadingTimeout=i.timeout),Io(i.heartTimeout)&&(i.heartTimeout=i.timeout)),Mo(i.autoWasm)&&(Io(i.decoderErrorAutoWasm)&&(i.decoderErrorAutoWasm=i.autoWasm),Io(i.hardDecodingNotSupportAutoWasm)&&(i.hardDecodingNotSupportAutoWasm=i.autoWasm),Io(i.mseWaitVideoCanplayAutoWasm)&&(i.mseWaitVideoCanplayAutoWasm=i.autoWasm)),Mo(i.aiFaceDetectLevel)&&Io(i.aiFaceDetectWidth)){const e=Ks[i.aiFaceDetectLevel];e&&(i.aiFaceDetectWidth=e)}if(Mo(i.aiObjectDetectLevel)&&Io(i.aiObjectDetectWidth)){const e=Ys[i.aiObjectDetectLevel];e&&(i.aiObjectDetectWidth=e)}ya(i.isCrypto)&&(i.isM7sCrypto=!0),this._opt=i,this.debugLog("JbPro","init"),i.videoBuffer>1e4&&this.debugWarn(this.TAG_NAME,`videoBuffer ${i.videoBuffer/1e3}s is too long, will black screen for ${i.videoBuffer/1e3}s , it is recommended to set it to less than 10s`),this._destroyed=!1,this._destroyLock=!1,this.$container=s,this._tempPlayBgObj={},this._tempVideoLastIframeInfo={},this._tempPlayerIsMute=!0,this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this._streamErrorReplayTimes=0,this._streamEndReplayTimes=0,this._websocket1006ErrorReplayTimes=0,this.events=new Da(this),this._opt.isUseNewFullscreenWatermark?this.watermark=new Lv(this):this.watermark=new kv(this),this.memoryLogger=new r_(this),this.network=new o_(this),this._websocket1006ErrorRetryLog=[],this._mseDecodeErrorRetryLog=[],this._wcsDecodeErrorRetryLog=[],this._isNetworkOfflinePaused=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this.widthOrHeightChangeReplayDelayTimeout=null,this.streamErrorReplayDelayTimeout=null,this.streamEndReplayDelayTimeout=null,this.playbackPauseTimeout=null,this.playbackResumeTimeout=null,this.initDecoderWorkerTimeout=null,this.$loadingBgImage=null,this.$loadingBg=null,this._initOnLock(),this._initPlayer(s,i),this._initWatermark(),this._initNetwork(),this.debugLog("JbPro",'init success and version is "8-16-2024"'),console.log('JbPro Version is "8-16-2024" '+(Aa(po)?"and is Trial Version[试用版本]":""))}destroy(){return new Promise(((e,t)=>{if(this.debugLog("JbPro","destroy()"),this._destroyLock)return t("JbPro is destroying");this._destroyLock=!0,this._destroyed=!0,this.off(),this._removeTimeout(),this._clearInitDecoderWorkerTimeout(),this._initOnLock(),this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")),this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$container&&this.$container.removeChild(this.$videoElement),this.$videoElement=null),this._removeLoadingBackgroundForIOS(),this.player?this.player.destroy().then((()=>{this.player=null,this._destroy(),this._destroyLock=!1,e()})).catch((e=>{this._destroyLock=!1,t(e)})):(this._destroy(),this._destroyLock=!1,e())}))}_removeTimeout(){this.widthOrHeightChangeReplayDelayTimeout&&(clearTimeout(this.widthOrHeightChangeReplayDelayTimeout),this.widthOrHeightChangeReplayDelayTimeout=null),this.streamErrorReplayDelayTimeout&&(clearTimeout(this.streamErrorReplayDelayTimeout),this.streamErrorReplayDelayTimeout=null),this.streamEndReplayDelayTimeout&&(clearTimeout(this.streamEndReplayDelayTimeout),this.streamEndReplayDelayTimeout=null),this.playbackPauseTimeout&&(clearTimeout(this.playbackPauseTimeout),this.playbackPauseTimeout=null),this.playbackResumeTimeout&&(clearTimeout(this.playbackResumeTimeout),this.playbackResumeTimeout=null)}_destroy(){var e,t;this.events&&(this.events.destroy(),this.events=null),this.watermark&&(this.watermark.destroy(),this.watermark=null),this.network&&(this.network.destroy(),this.network=null),this.memoryLogger&&(this.memoryLogger.destroy(),this.memoryLogger=null),this.$container&&(this.$container.classList.remove("jb-pro-container"),this.$container.classList.remove("jb-pro-fullscreen-web"),e=this.$container,t=te,e&&(e.dataset?delete e.dataset[t]:e.removeAttribute("data-"+t)),this.$container=null),this._tempPlayBgObj=null,this._tempVideoLastIframeInfo=null,this._isNetworkOfflinePaused=!1,this._playerOnLock=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this._tempPlayerIsMute=!0,this._resetReplayTimes(),this.debugLog("JbPro","destroy end"),this._opt={},this.debug=null}_resetReplayTimes(){this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this._streamErrorReplayTimes=0,this._streamEndReplayTimes=0,this._websocket1006ErrorReplayTimes=0,this._websocket1006ErrorRetryLog=[],this._mseDecodeErrorRetryLog=[],this._wcsDecodeErrorRetryLog=[]}_getOriginalOpt(){const e=fa();return Object.assign({},e,this.originalOptions)}_initPlayer(e,t){this.player=new Tv(e,t),this._bindEvents()}_resetPlayer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(((t,i)=>{try{this.debugLog(this.TAG_NAME,"_resetPlayer()",JSON.stringify(e))}catch(t){this.debugLog(this.TAG_NAME,"_resetPlayer()",e)}const s=()=>{this._opt.url="",this._opt.playOptions={},this._opt=Object.assign(this._opt,e),this._initPlayer(this.$container,this._opt)};this.player?this.player.destroy().then((()=>{this.player=null,s(),this.debugLog(this.TAG_NAME,"_resetPlayer() end"),t()})).catch((e=>{this.debugError(this.TAG_NAME,"_resetPlayer() error",e),i(e)})):(s(),this.debugLog(this.TAG_NAME,"_resetPlayer() end"),t())}))}_bindEvents(){var e=this;Object.keys(nt).forEach((t=>{this.player.on(nt[t],(function(){for(var i=arguments.length,s=new Array(i),r=0;r{this.player&&this.player.showTipsMessageByCode(e)})),this.player.once(at.beforeDestroy,(()=>{this.emit(at.close),this.destroy().then((()=>{})).catch((e=>{}))})),this.player.on(at.resize,(()=>{this.watermark&&this.watermark.resize()})),this.player.on(at.fullscreen,(()=>{this.watermark&&this.watermark.resize()})),this.player.on(at.videoInfo,(()=>{this.player&&(this.player.singleWatermark&&this.player.singleWatermark.resize(),this.player.ghostWatermark&&this.player.ghostWatermark.resize(),this.player.dynamicWatermark&&this.player.dynamicWatermark.resize())})),this.player.on(at.memoryLog,(function(){e.memoryLogger.logCache(...arguments)})),this.player.on(at.downloadMemoryLog,(()=>{this.downloadMemoryLog()}))}_initWatermark(){if(this._opt.fullscreenWatermarkConfig.text=decodeURIComponent("JessibucaPro%20%E4%BD%93%E9%AA%8C"),this._opt.fullscreenWatermarkConfig.color="white",qo(this._opt.fullscreenWatermarkConfig)){const e=Uo(this.$container,this._opt.fullscreenWatermarkConfig);if(!e.watermark_txt)return void this.debugWarn("JbPro","fullscreenWatermarkConfig text is empty");this.watermark.load(e)}}_initNetwork(){this.network.on(at.online,(()=>{if(this.emit(at.networkState,at.online),this.isDestroyed())this.debugLog(this.TAG_NAME,"network online and JbPro is destroyed");else if(this.debugLog(this.TAG_NAME,"network online"),this._isNetworkOfflinePaused&&this._isNetworkOfflinePausedAndNextPlayConfig&&this._isNetworkOfflinePausedAndNextPlayConfig.url){const e=this._isNetworkOfflinePausedAndNextPlayConfig.url,t=this._isNetworkOfflinePausedAndNextPlayConfig.playOptions;this._streamErrorReplayTimes++;const i=this._isNetworkOfflinePausedAndNextPlayConfig.type||"unknown";this._isNetworkOfflinePaused=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this.debugLog(this.TAG_NAME,`${i} and network online and _streamErrorReplayTimes is ${this._streamErrorReplayTimes} and reset player and play`),this.play(e,t).then((()=>{this.debugLog(this.TAG_NAME,`${i} and network online and play success`)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.fetchError,{},e),this.debugError(this.TAG_NAME,`${i} and network online and play error`,e.toString(),e)}))}})),this.network.on(at.offline,(()=>{this.emit(at.networkState,at.offline),this.debugLog(this.TAG_NAME,"network offline")}))}_checkHasCreated(e){if(!e)return!1;return!!va(e,te)}_initOnLock(){this.webglAlignmentErrorOnLock=!1,this.webglContextLostErrorOnLock=!1,this.mediaSourceH265NotSupportOnLock=!1,this.mediaSourceFullOnLock=!1,this.mediaSourceAppendBufferErrorOnLock=!1,this.mseSourceBufferErrorOnLock=!1,this.mediaSourceBufferedIsZeroErrorOnLock=!1,this.mseAddSourceBufferErrorOnLock=!1,this.mediaSourceDecoderConfigurationErrorOnLock=!1,this.mediaSourceTsIsMaxDiffOnLock=!1,this.mseWidthOrHeightChangeOnLock=!1,this.mediaSourceAudioG711NotSupportOnLock=!1,this.mediaSourceAudioInitTimeoutOnLock=!1,this.mediaSourceAudioNoDataTimeoutOnLock=!1,this.mseWorkerAddSourceBufferErrorOnLock=!1,this.mediaSourceUseCanvasRenderPlayFailedOnLock=!1,this.webcodecsH265NotSupportOnLock=!1,this.webcodecsUnsupportedConfigurationErrorOnLock=!1,this.webcodecsDecodeConfigureErrorOnLock=!1,this.webcodecsDecodeErrorOnLock=!1,this.wcsWidthOrHeightChangeOnLock=!1,this.webcodecsAudioNoDataTimeoutOnLock=!1,this.webcodecsAudioInitTimeoutOnLock=!1,this.simdDecodeErrorOnLock=!1,this.wasmWidthOrHeightChangeOnLock=!1,this.wasmUseVideoRenderErrorOnLock=!1,this.videoElementPlayingFailedOnLock=!1,this.simdH264DecodeVideoWidthIsTooLargeOnLock=!1,this.networkDelayTimeoutOnLock=!1,this.flvDemuxBufferSizeTooLargeOnLock=!1,this.fetchErrorOnLock=!1,this.streamEndOnLock=!1,this.websocketErrorOnLock=!1,this.webrtcErrorOnLock=!1,this.hlsErrorOnLock=!1,this.aliyunRtcErrorOnLock=!1,this.decoderWorkerInitErrorOnLock=!1,this.decoderWorkerWasmErrorOnLock=!1,this.videoElementPlayingFailedForWebrtcOnLock=!1,this.videoInfoErrorOnLock=!1,this.webrtcStreamH265OnLock=!1,this.mseWaitVideoCanplayTimeoutOnLock=!1}isDestroyed(){return this._destroyed}getOption(){return this.player?this.player.getOption():{}}setDebug(e){this.debugLog("JbPro",`setDebug() ${e}`),this._opt.debug=!!e,this.player?this.player.updateOption({debug:!!e},!0):this.debugWarn("JbPro","player is not init")}getIsDebug(){let e=!1;return this.player&&(e=this.player._opt.debug),e}mute(){this.debugLog("JbPro","mute()"),this.player&&this.player.mute(!0)}cancelMute(){this.debugLog("JbPro","cancelMute() and is mute is ",this.isMute()),this.player&&this.player.isAudioMute()&&this.player.mute(!1)}setVolume(e){this.debugLog("JbPro",`setVolume() ${e}`),this.player&&(this.player.volume=e)}getVolume(){let e=null;return this.player&&(e=this.player.volume,e=parseFloat(e).toFixed(2)),e}audioResume(){this.debugLog("JbPro","audioResume() and call cancelMute()"),this.cancelMute()}setTimeout(e){this.debugLog("JbPro",`setTimeout() ${e}`),e=Number(e),isNaN(e)?this.debugWarn("JbPro",`setTimeout error: ${e} is not a number`):(this._opt.timeout=e,this._opt.loadingTimeout=e,this._opt.heartTimeout=e,this.player&&this.player.updateOption({timeout:e,loadingTimeout:e,heartTimeout:e}))}setScaleMode(e){this.debugLog("JbPro",`setScaleMode() ${e}`),this.player?this.player.setScaleMode(e):this.debugWarn("JbPro","setScaleMode() player is null")}pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(((t,i)=>{this.debugLog("JbPro",`pause() ${e}`),this.isDestroyed()&&i("JbPro is destroyed"),(this._opt.pauseAndNextPlayUseLastFrameShow||this._opt.replayUseLastFrameShow)&&(this._tempPlayBgObj=this._getVideoLastIframeInfo()),this._tempPlayerIsMute=this.isMute(),this._pause(e).then((e=>{t(e)})).catch((e=>{i(e)}))}))}_pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(((t,i)=>{if(this.debugLog("JbPro",`_pause() ${e}`),this.isDestroyed())return i("JbPro is destroyed");this._resetReplayTimes(),this.player?this.player.pause(e).then((e=>{t(e)})).catch((e=>{i(e)})):i("player is null")}))}close(){return new Promise(((e,t)=>{if(this.isDestroyed())return t("JbPro is destroyed");this.debugLog("JbPro","close() and inner destroy()"),this.destroy().then((()=>{e()})).catch((e=>{t(e)}))}))}clearView(){this.debugLog("JbPro","clearView()"),this.player&&this.player.video?this.getRenderType()===H?this.player.video.clearView():this.debugWarn("JbPro","clearView","render type is video, not support clearView, please use canvas render type"):this.debugWarn("JbPro","clearView","player is null")}play(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(this.isDestroyed())return s("JbPro is destroyed");try{this.debugLog("JbPro",`play() ${e}`,JSON.stringify(t))}catch(i){this.debugLog("JbPro",`play() ${e}`,t)}if(!e&&!this._opt.url)return this.emit(at.error,dt.playError),void s("url is null and this._opt.url is null");if(e&&(e=(""+e).trim(),-1===e.indexOf("http:")&&-1===e.indexOf("https:")&&-1===e.indexOf("webrtc:")&&-1===e.indexOf("ws:")&&-1===e.indexOf("wss:")&&-1===e.indexOf("wt:")&&-1===e.indexOf("artc:")))return s(`url ${e} must be "http:" or "https:" or "webrtc:" or "ws:" or "wss:" or "wt:" or "artc:" protocol`);if(Aa(this._opt.isLive))return this.$videoElement.controls="controls",this.$videoElement.muted=!1,this.$videoElement.src=e,this.$videoElement.play(),void i(this.$videoElement);if(this._opt.isM7sCrypto){let r=t.cryptoKey||this._opt.playOptions.cryptoKey,o=t.cryptoIV||this._opt.playOptions.cryptoIV;if(this._opt.m7sCryptoKey&&(!r||!o)){const e=this._opt.m7sCryptoKey.split(".");r=ha(e[0]),o=ha(e[1])}if(!r||!o){const r=e||this._opt.url;return void this._cryptoPlay(r).then((r=>{let{cryptoIV:o,cryptoKey:a}=r;this._opt.playOptions.cryptoKey=a,this._opt.playOptions.cryptoIV=o,t.cryptoIV=o,t.cryptoKey=a,this._playBefore(e,t).then((()=>{i()})).catch((e=>{s(e)}))})).catch((e=>{s(e)}))}this._opt.playOptions.cryptoKey=r,this._opt.playOptions.cryptoIV=o,t.cryptoIV=o,t.cryptoKey=r}else if(this._opt.isXorCrypto){let e=t.cryptoKey||this._opt.playOptions.cryptoKey,i=t.cryptoIV||this._opt.playOptions.cryptoIV;if(this._opt.xorCryptoKey&&(!e||!i)){const t=this._opt.xorCryptoKey.split(".");e=ha(t[0]),i=ha(t[1])}e&&i&&(this._opt.playOptions.cryptoKey=e,this._opt.playOptions.cryptoIV=i,t.cryptoIV=i,t.cryptoKey=e)}else if(this._opt.isSm4Crypto){let e=t.cryptoKey||this._opt.playOptions.cryptoKey,i=t.cryptoIV||this._opt.playOptions.cryptoIV;if(this._opt.sm4CryptoKey&&(!e||!i)){const t=this._opt.sm4CryptoKey.split(".");2===t.length&&(e=dl(t[0]),i=dl(t[1]))}e&&i&&(this._opt.playOptions.cryptoKey=e,this._opt.playOptions.cryptoIV=i,t.cryptoIV=i,t.cryptoKey=e)}this._playBefore(e,t).then((()=>{i()})).catch((e=>{s(e)}))}))}_playBefore(e,t){return new Promise(((i,s)=>{if(this.player)if(e)if(this._opt.url)if(e===this._opt.url)if(this.player.playing)this.debugLog("JbPro","_playBefore","playing and resolve()"),i();else{this.debugLog("JbPro","_playBefore","this._opt.url === url and pause -> play and destroy play");let e=this._getOriginalOpt();(this._opt.pauseAndNextPlayUseLastFrameShow||this._opt.replayUseLastFrameShow)&&this._tempPlayBgObj&&this._tempPlayBgObj.loadingBackground&&(e=Object.assign(e,this._tempPlayBgObj)),Aa(this._tempPlayerIsMute)&&(e.isNotMute=!0,this._tempPlayerIsMute=!0);const t=this._opt.url,r=this._opt.playOptions;this._resetPlayer(e).then((()=>{this._play(t,r).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore this.player.play error",e),this.emit(at.crashLog,this.getCrashLog("this.player.play 1",e)),s(e)}))})).catch((e=>{this.debugError("JbPro","_resetPlayer error",e),s(e)}))}else{this.debugLog("JbPro","_playBefore",`\n this._url.url is ${this._opt.url}\n and new url is ${e}\n and destroy and play new url`);const r=this._getOriginalOpt();this._resetPlayer(r).then((()=>{this._play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(at.crashLog,this.getCrashLog("this.player.play 2",e)),s(e)}))})).catch((e=>{this.debugError("JbPro","_resetPlayer error",e)}))}else this._play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(at.crashLog,this.getCrashLog("this.player.play 3",e)),s(e)}));else{let e=this._getOriginalOpt();(this._opt.pauseAndNextPlayUseLastFrameShow||this._opt.replayUseLastFrameShow)&&this._tempPlayBgObj&&this._tempPlayBgObj.loadingBackground&&(e=Object.assign(e,this._tempPlayBgObj)),Aa(this._tempPlayerIsMute)&&(e.isNotMute=!0,this._tempPlayerIsMute=!0);const t=this._opt.url,r=this._opt.playOptions;this._resetPlayer(e).then((()=>{this._play(t,r).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(at.crashLog,this.getCrashLog("this.player.play 4",e)),s(e)}))})).catch((e=>{this.debugError("JbPro","_resetPlayer error",e)}))}else e?this._play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(at.crashLog,this.getCrashLog("this.player.play 5",e)),s(e)})):this._play(this._opt.url,this._opt.playOptions).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_playBefore _play error",e),this.emit(at.crashLog,this.getCrashLog("this.player.play 6",e)),s(e)}))}))}_cryptoPlay(e){return new Promise(((t,i)=>{const s=function(e){const t=(e||document.location.toString()).split("//"),i=t[1].indexOf("/");let s=t[1].substring(i);return-1!=s.indexOf("?")&&(s=s.split("?")[0]),s}(e);let r=this._opt.cryptoKeyUrl,o="";const a=ca(e);if(r){if(o=r,this._opt.isM7sCrypto&&-1===o.indexOf("/crypto/?stream=")){const e=ca(r);o=e.origin+ee+`?stream=${s}`}}else r=a.origin+ee,o=r+`?stream=${s}`;var n;this.player.debugLog("JbPro",`_cryptoPlay() cryptoKeyUrl: ${o} and opt.cryptoKeyUrl: ${this._opt.cryptoKeyUrl}`),(n=o,new Promise(((e,t)=>{Il.get(n).then((t=>{e(t)})).catch((e=>{t(e)}))}))).then((e=>{if(e){const s=e.split("."),r=ha(s[0]),o=ha(s[1]);o&&r?t({cryptoIV:o,cryptoKey:r}):i("get cryptoIV or cryptoKey error")}else i(`cryptoKeyUrl: getM7SCryptoStreamKey ${o} res is null`)})).catch((e=>{i(e)}))}))}playback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(this.isDestroyed())return s("JbPro is destroyed");try{this.debugLog("JbPro",`playback() ${e}, options: `,JSON.stringify(t))}catch(i){this.debugLog("JbPro",`playback() ${e}, options: `,t)}if(Aa(this._opt.isLive))return s(`this._opt.isLive is ${this._opt.isLive}, can not playback`);const r=ma(),o=Object.assign({},r.playbackConfig,this._opt.playbackConfig,t);Aa(o.isUseFpsRender)&&o.isCacheBeforeDecodeForFpsRender&&(o.isCacheBeforeDecodeForFpsRender=!1,this.debugWarn("JbPro","playbackConfig.isUseFpsRender is false, isCacheBeforeDecodeForFpsRender can not be ture, isCacheBeforeDecodeForFpsRender is set to false")),0===o.rateConfig.length&&o.showRateBtn&&(o.showRateBtn=!1,this.debugWarn("JbPro","playbackConfig.rateConfig.length is 0, showRateBtn can not be ture, showRateBtn is set to false")),o.controlType,X.simple,this._resetPlayer({videoBuffer:0,playbackConfig:o,playType:w,openWebglAlignment:!0,useMSE:o.useMSE,useWCS:o.useWCS,useSIMD:!0}).then((()=>{this.play(e,t).then((()=>{i()})).catch((e=>{s(e)}))})).catch((e=>{s(e)}))}))}playbackPause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.isDestroyed()?Promise.reject("JbPro is destroyed"):(this.debugLog("JbPro",`playbackPause() ${e}`),this._opt.playType===v?Promise.reject("playType is player, can not call playbackPause method"):new Promise(((t,i)=>{if(!this.player)return i("player is null");ya(e)?this._pause().then((()=>{t()})).catch((e=>{i(e)})):(this.player.playbackPause=!0,this.player.recording=!1,this.player.zooming=!1,this.playbackPauseTimeout=setTimeout((()=>{this.playbackPauseTimeout=null,t()}),100))})))}playbackResume(){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):(this.debugLog("JbPro","playbackResume()"),this._opt.playType===v?Promise.reject("playType is player, can not call playbackResume method"):new Promise(((e,t)=>{if(!this.player)return t("player is null");this.player.playbackPause=!1,this.playbackResumeTimeout=setTimeout((()=>{this.playbackResumeTimeout=null,e()}),100)})))}forward(e){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):(this.debugLog("JbPro",`forward() ${e}`),Aa(this._opt.isLive)||this._opt.playType===v?(this.debugLog("JbPro",`forward() and this._opt.isLive is ${this._opt.isLive} and this._opt.playType is ${this._opt.playType}`),Promise.reject("forward() method only just for playback type")):Lo(Number(e))?new Promise(((t,i)=>{this.player?(e=ao(Number(e),.1,32),this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"playbackRate",value:e}),this.player.playback.setRate(e),this.player.video&&this.player.video.setRate(e),this.player.audio&&this.player.audio.setRate(e),(this.player.isPlaybackUseWCS()||this.player.isPlaybackUseMSE())&&(this.player.demux&&Aa(this.player.isPlaybackPauseNotClearCacheAndCacheBeforeDecodeAndUseFpsRender())&&this.player.demux.dropBuffer$2(),this.player.isPlaybackCacheBeforeDecodeForFpsRender()&&this.player.demux.initPlaybackCacheLoop()),t()):i("player is not playing")})):Promise.reject(`forward() params "rate": ${e} must be number type`))}playbackForward(e){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):new Promise(((t,i)=>{this.forward(e).then((()=>{t()})).catch((e=>{i(e)}))}))}normal(){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):new Promise(((e,t)=>{this.forward(1).then((()=>{e()})).catch((e=>{t(e)}))}))}playbackNormal(){return this.isDestroyed()?Promise.reject("JbPro is destroyed"):new Promise(((e,t)=>{this.normal().then((()=>{e()})).catch((e=>{t(e)}))}))}updatePlaybackForwardMaxRateDecodeIFrame(e){this.isDestroyed()||(this.debugLog("JbPro",`updatePlaybackForwardMaxRateDecodeIFrame() ${e}`),e=Number(e),e=ao(e=parseInt(e,10),1,8),this._opt.playbackForwardMaxRateDecodeIFrame=e,this.player?this.player.updateOption({playbackForwardMaxRateDecodeIFrame:e},!0):this.debugWarn("JbPro","updatePlaybackForwardMaxRateDecodeIFrame() player is null"))}setPlaybackStartTime(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setPlaybackStartTime() ${e}`);const t=Ho(e);this.player?this.player.isPlayback()?t<10&&0!==e&&this.player.playback.isControlTypeNormal()?this.debugWarn("JbPro",`setPlaybackStartTime() control type is normal and timestamp: ${e} is not valid`):this.player.playback.isControlTypeSimple()&&e>this.player.playback.totalDuration?this.debugWarn("JbPro",`setPlaybackStartTime() control type is simple and timestamp: ${e} is more than ${this.player.playback.totalDuration}`):this.player.playing&&(this.player.playback.isControlTypeNormal()&&10===t&&(e*=1e3),this.player.playback.setStartTime(e),this.playbackClearCacheBuffer()):this.debugWarn("JbPro","setPlaybackStartTime() playType is not playback"):this.debugWarn("JbPro","setPlaybackStartTime() player is null")}setPlaybackShowPrecision(e){this.isDestroyed()||(this.debugLog("JbPro",`setPlaybackShowPrecision() ${e}`),this.player?this.player.isPlayback()?this.player.playback.isControlTypeNormal()?this.player.playback.setShowPrecision(e):this.debugWarn("JbPro","control type is not normal , not support!"):this.debugWarn("JbPro","playType is not playback"):this.debugWarn("JbPro","player is null"))}playbackCurrentTimeScroll(){this.isDestroyed()||(this.debugLog("JbPro","playbackCurrentTimeScroll()"),this.player?this.player.isPlayback()?this.player.playback.isControlTypeNormal()?this.player.playback.currentTimeScroll():this.debugWarn("JbPro","control type is not normal , not support!"):this.debugWarn("JbPro","playType is not playback"):this.debugWarn("JbPro","player is null"))}playbackClearCacheBuffer(){this.isDestroyed()||(this.debugLog("JbPro","playbackClearCacheBuffer()"),this.player?this.player.isPlayback()?(this.player.video&&this.player.video.clear(),this.player.audio&&this.player.audio.clear(),this.clearBufferDelay()):this.debugWarn("JbPro","playType is not playback"):this.debugWarn("JbPro","player is null"))}getPlaybackCurrentRate(){return this.player?this.player.isPlayback()?this.player.getPlaybackRate():(this.debugWarn("JbPro","playType is not playback"),1):(this.debugWarn("JbPro","player is null"),1)}updatePlaybackLocalOneFrameTimestamp(e){this.isDestroyed()||(this.debugLog("JbPro",`updatePlaybackLocalOneFrameTimestamp() ${e}`),this.player?this.player.isPlayback()?this.player.playback.updateLocalOneFrameTimestamp(e):this.debugWarn("JbPro","playType is not playback"):this.debugWarn("JbPro","player is null"))}setStreamQuality(e){if(this.isDestroyed())return;if(this.debugLog("JbPro",`setStreamQuality() ${e}`),!this.player)return void this.debugWarn("JbPro","player is null");if(!this.player._opt.operateBtns.quality)return void this.debugWarn("JbPro","player._opt.operateBtns.quality is false");(this.player._opt.qualityConfig||[]).includes(e)?this.player.streamQuality=e:this.debugWarn("JbPro",`quality: ${e} is not in qualityList`)}_play(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(!this.player)return s("player is null");let r=!1;this._opt.url&&this._opt.url!==e&&(r=!0),this._opt.url=e,this._opt.playOptions=t;const o=e.split("?")[0],p=o.startsWith("http://")||o.startsWith("https://"),f=o.startsWith("webrtc://"),m=o.startsWith("artc://"),g=o.startsWith("wt://"),y=o.startsWith("ws://")||o.startsWith("wss://"),A=p||y,b=p&&o.endsWith(".m3u8"),v=A&&o.endsWith(".flv"),_=A&&(o.endsWith(".fmp4")||o.endsWith(".mp4")),w=A&&o.endsWith(".mpeg4"),S=A&&(o.endsWith(".h264")||o.endsWith(".h265")),E=A&&o.endsWith(".ts");let T=this._opt.isWebrtcForZLM||!1,F=this._opt.isWebrtcForSRS||!1,U=this._opt.isWebrtcForOthers||!1;f&&(-1!==e.indexOf("/index/api/webrtc")?(T=!0,F=!1,U=!1):-1!==e.indexOf("/rtc/v1/play/")&&(F=!0,T=!1,U=!1));let O=null,N=null;if(v&&Aa(this._opt.isFlv)&&this._resetDemuxType("isFlv"),_&&Aa(this._opt.isFmp4)&&this._resetDemuxType("isFmp4"),w&&Aa(this._opt.isMpeg4)&&this._resetDemuxType("isMpeg4"),S&&Aa(this._opt.isNakedFlow)&&this._resetDemuxType("isNakedFlow"),E&&Aa(this._opt.isTs)&&this._resetDemuxType("isTs"),p?O=b?l:n:g?O=h:f?O=d:m?O=c:y&&(O=a),this._opt.isNakedFlow?N=R:this._opt.isFmp4?N=P:this._opt.isMpeg4?N=I:this._opt.isFlv?N=k:this._opt.isTs?N=M:b?N=C:f?N=x:m?N=B:g?N=D:y&&(N=L),!O||!N)return this._opt.playFailedAndPausedShowMessage&&this.showErrorMessageTips("url is not support"),s(`play url ${e} is invalid, protocol is ${u[O]}, demuxType is ${N}`);this.debugLog("JbPro",`play url ${e} protocol is ${u[O]}, demuxType is ${N}`);const j=()=>{this.player.on(dt.webglAlignmentError,this._handleWebglAlignmentError.bind(this)),this.player.on(dt.webglContextLostError,this._handleWebglContextLostError.bind(this)),this.player.on(dt.mediaSourceH265NotSupport,this._handleMediaSourceH265NotSupport.bind(this)),this.player.on(dt.mseWaitVideoCanplayTimeout,this._handleMseWaitVideoCanplayTimeout.bind(this)),this.player.on(dt.mediaSourceFull,this._handleMediaSourceFull.bind(this)),this.player.on(dt.mediaSourceAppendBufferError,this._handleMediaSourceAppendBufferError.bind(this)),this.player.on(dt.mseSourceBufferError,this._handleMseSourceBufferError.bind(this)),this.player.on(dt.mediaSourceBufferedIsZeroError,this._handleMediaSourceBufferedIsZeroError.bind(this)),this.player.on(dt.mseAddSourceBufferError,this._handleMseAddSourceBufferError.bind(this)),this.player.on(dt.mediaSourceDecoderConfigurationError,this._handleMediaSourceDecoderConfigurationError.bind(this)),this.player.on(dt.mediaSourceTsIsMaxDiff,this._handleMediaSourceTsIsMaxDiff.bind(this)),this.player.on(dt.mseWidthOrHeightChange,this._handleMseWidthOrHeightChange.bind(this)),this.player.on(dt.mediaSourceAudioG711NotSupport,this._handleMediaSourceAudioG711NotSupport.bind(this)),this.player.on(dt.mediaSourceAudioInitTimeout,this._handleMediaSourceAudioInitTimeout.bind(this)),this.player.once(dt.mediaSourceAudioNoDataTimeout,this._handleMediaSourceAudioNoDataTimeout.bind(this)),this.player.on(dt.mseWorkerAddSourceBufferError,this._handleMseWorkerAddSourceBufferError.bind(this)),this.player.on(dt.mediaSourceUseCanvasRenderPlayFailed,this._handleMediaSourceUseCanvasRenderPlayFailed.bind(this)),this.player.on(dt.webcodecsH265NotSupport,this._handleWebcodecsH265NotSupport.bind(this)),this.player.on(dt.webcodecsUnsupportedConfigurationError,this._handleWebcodecsUnsupportedConfigurationError.bind(this)),this.player.on(dt.webcodecsDecodeConfigureError,this._handleWebcodecsDecodeConfigureError.bind(this)),this.player.on(dt.webcodecsDecodeError,this._handleWebcodecsDecodeError.bind(this)),this.player.on(dt.wcsWidthOrHeightChange,this._handleWcsWidthOrHeightChange.bind(this)),this.player.on(dt.webcodecsAudioNoDataTimeout,this._handleWebcodecsAudioNoDataTimeout.bind(this)),this.player.on(dt.webcodecsAudioInitTimeout,this._handleWebcodecsAudioInitTimeout.bind(this)),this.player.on(dt.simdDecodeError,this._handleSimdDecodeError.bind(this)),this.player.on(dt.wasmWidthOrHeightChange,this._handleWasmWidthOrHeightChange.bind(this)),this.player.on(dt.wasmUseVideoRenderError,this._handleWasmUseVideoRenderError.bind(this)),this.player.on(dt.videoElementPlayingFailed,this._handleVideoElementPlayingFailed.bind(this)),this.player.on(dt.simdH264DecodeVideoWidthIsTooLarge,this._handleSimdH264DecodeVideoWidthIsTooLarge.bind(this)),this.player.on(at.networkDelayTimeout,this._handleNetworkDelayTimeout.bind(this)),this.player.on(at.flvDemuxBufferSizeTooLarge,this._handleFlvDemuxBufferSizeTooLarge.bind(this)),this.player.on(dt.fetchError,this._handleFetchError.bind(this)),this.player.on(at.streamEnd,this._handleStreamEnd.bind(this)),this.player.on(dt.websocketError,this._handleWebsocketError.bind(this)),this.player.on(dt.webrtcError,this._handleWebrtcError.bind(this)),this.player.on(dt.hlsError,this._handleHlsError.bind(this)),this.player.on(dt.aliyunRtcError,this._handleAliyunRtcError.bind(this)),this.player.on(dt.decoderWorkerInitError,this._handleDecoderWorkerInitError.bind(this)),this.player.on(dt.decoderWorkerWasmError,this._handleDecoderWorkerWasmError.bind(this)),this.player.on(dt.videoElementPlayingFailedForWebrtc,this._handleVideoElementPlayingFailedForWebrtc.bind(this)),this.player.on(dt.videoInfoError,this._handleVideoInfoError.bind(this)),this.player.on(at.webrtcStreamH265,this._handleWebrtcStreamH265.bind(this)),this.player.on(at.delayTimeout,this._handleDelayTimeout.bind(this)),this.player.on(at.loadingTimeout,this._handleLoadingTimeout.bind(this)),this._hasLoaded()?(this.debugLog(this.TAG_NAME,"_playNext and _hasLoaded() is true"),this.player.play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","_hasLoaded() and play error",e),this.emit(at.crashLog,this.getCrashLog("_hasLoaded() and play error",e)),this.player&&this.player.pause().then((()=>{s(e)})).catch((e=>{s(e),this.debugError("JbPro","_hasLoaded() and play error and next pause error",e)}))}))):(this.debugLog(this.TAG_NAME,"_playNext and waiting decoderWorkerInit callback"),this._checkInitDecoderWorkerTimeout(),this.player.once(at.decoderWorkerInit,(()=>{this._clearInitDecoderWorkerTimeout(),this.isDestroyed()?this.debugLog("JbPro","decoderWorkerInit but player is destroyed"):(this.debugLog(this.TAG_NAME,"_playNext and decoderWorkerInit callback and next play"),this.player.play(e,t).then((()=>{i()})).catch((e=>{this.debugError("JbPro","decoderWorkerInit and play error",e),this.emit(at.crashLog,this.getCrashLog("decoderWorkerInit and play error",e)),this.player&&this.player.pause().then((()=>{s(e)})).catch((e=>{s(e),this.debugError("JbPro","decoderWorkerInit and play error and next pause error",e)}))})))})))},G=this.player.getOption(),W=b&&Aa(this._opt.supportHls265),z=f&&Aa(this._opt.isWebrtcH265),$=b&&!!ia(),V=b&&G.demuxUseWorker;if(W||z||m||r||w||$||V)this.debugLog("JbPro",`need reset player and\n isOldHls is ${W} and isOldWebrtc is ${z} and\n isAliyunRtc is ${m} and\n needResetPlayer(url change) is ${r} and\n isMpeg4 is ${w} and\n isHlsCanVideoPlay is ${$} and\n isHlsButDemuxUseWorker is ${V}`),this._resetPlayer({protocol:O,demuxType:N,isHls:b,isWebrtc:f,isWebrtcForZLM:T,isWebrtcForSRS:F,isWebrtcForOthers:U,isAliyunRtc:m,cryptoKey:t.cryptoKey||"",cryptoIV:t.cryptoIV||"",url:e,playOptions:t}).then((()=>{j()})).catch((e=>{s("reset player error")}));else{const e={protocol:O,demuxType:N,isHls:b,isWebrtc:f,isAliyunRtc:m,isFlv:this._opt.isFlv,isFmp4:this._opt.isFmp4,isMpeg4:this._opt.isMpeg4,isNakedFlow:this._opt.isNakedFlow,isTs:this._opt.isTs,cryptoKey:t.cryptoKey||"",cryptoIV:t.cryptoIV||""};this._opt.isNakedFlow&&(e.mseDecodeAudio=!1,e.wcsDecodeAudio=!1),this.player.updateOption(e),j()}}))}_resetDemuxType(e){this._opt.isFlv=!1,this._opt.isFmp4=!1,this._opt.isMpeg4=!1,this._opt.isNakedFlow=!1,this._opt.isHls=!1,this._opt.isWebrtc=!1,this._opt.isWebrtcForZLM=!1,this._opt.isWebrtcForSRS=!1,this._opt.isWebrtcForOthers=!1,this._opt.isAliyunRtc=!1,this._opt.isTs=!1,e&&(this._opt[e]=!0),"isFmp4"!==e&&(this._opt.isFmp4Private=!1)}resize(){this.isDestroyed()||(this.debugLog("JbPro","resize()"),this.player&&this.player.resize())}setBufferTime(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setBufferTime() ${e}`),(e=Number(e))>10&&this.debugWarn("JbPro",`setBufferTime() buffer time is ${e} second, is too large, video will show blank screen until cache ${e} second buffer data`);const t=1e3*e;this._opt.videoBuffer=t,this.player?this.player.updateOption({videoBuffer:t},!0):this.debugWarn("JbPro","setBufferTime() player is null")}setBufferDelayTime(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setBufferDelayTime() ${e}`),(e=Number(e))<.2&&this.debugWarn("JbPro",`setBufferDelayTime() buffer time delay is ${e} second, is too small`);const t=1e3*(e=ao(e,.2,100));this._opt.videoBufferDelay=t,this.player?this.player.updateOption({videoBufferDelay:t},!0):this.debugWarn("JbPro","setBufferDelayTime() player is null")}setRotate(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setRotate() ${e}`),e=parseInt(e,10);this._opt.rotate!==e&&-1!==[0,90,180,270].indexOf(e)?(this._opt.rotate=e,this.player?this.player.setRotate(e):this.debugWarn("JbPro","setRotate() player is null")):this.debugWarn("JbPro",`setRotate() rotate is ${e} and this._opt.rotate is ${this._opt.rotate}`)}setMirrorRotate(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setMirrorRotate() ${e}`);e||(e="none"),this._opt.mirrorRotate!==e&&-1!==["none","level","vertical"].indexOf(e)?(this._opt.mirrorRotate=e,this.player?(this.player.updateOption({mirrorRotate:e}),this.resize()):this.debugWarn("JbPro","setMirrorRotate() player is null")):this.debugWarn("JbPro",`setMirrorRotate() mirrorRotate is ${e} and this._opt.mirrorRotate is ${this._opt.mirrorRotate}`)}setAspectRatio(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setAspectRatio() ${e}`);e||(e="default"),this._opt.aspectRatio!==e&&-1!==["default","4:3","16:9"].indexOf(e)?(this._opt.aspectRatio=e,this.player?(this.player.updateOption({aspectRatio:e}),this.resize()):this.debugWarn("JbPro","setAspectRatio() player is null")):this.debugWarn("JbPro",`setAspectRatio() aspectRatio is ${e} and this._opt.aspectRatio is ${this._opt.mirrorRotate}`)}hasLoaded(){return!0}_hasLoaded(){return this.player&&this.player.loaded||!1}setKeepScreenOn(){this.isDestroyed()||(this.debugLog("JbPro","setKeepScreenOn()"),this._opt.keepScreenOn=!0,this.player?this.player.updateOption({keepScreenOn:!0}):this.debugWarn("JbPro","setKeepScreenOn() player is not ready"))}setFullscreen(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setFullscreen() ${e}`);const t=!!e;this.player?this.player.fullscreen!==t?this.player.fullscreen=t:this.debugWarn("JbPro",`setFullscreen() fullscreen is ${t} and this.player.fullscreen is ${this.player.fullscreen}`):this.debugWarn("JbPro","setFullscreen() player is not ready")}setWebFullscreen(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setWebFullscreen() ${e}`);const t=!!e;this.player?this.player.webFullscreen=t:this.debugWarn("JbPro","setWebFullscreen() player is not ready")}screenshot(e,t,i,s){if(!this.isDestroyed())return this.debugLog("JbPro",`screenshot() ${e} ${t} ${i} ${s}`),this.player&&this.player.video?this.player.video.screenshot(e,t,i,s):(this.debugWarn("JbPro","screenshot() player is not ready"),null)}screenshotWatermark(e){return new Promise(((t,i)=>{if(this.isDestroyed())return i("player is destroyed");this.debugLog("JbPro","screenshotWatermark()",e),this.player&&this.player.video?this.player.video.screenshotWatermark(e).then((e=>{t(e)})).catch((e=>{i(e)})):(this.debugWarn("JbPro","screenshotWatermark() player is not ready"),i("player is not ready"))}))}screenshotCopyrightWatermark(e){return new Promise(((t,i)=>{if(this.isDestroyed())return i("player is destroyed");this.debugLog("JbPro","screenshotCopyrightWatermark()",e),this.player&&this.player.video?this.player.video.screenshotCopyrightWatermark(e).then((e=>{t(e)})).catch((e=>{i(e)})):(this.debugWarn("JbPro","screenshotCopyrightWatermark() player is not ready"),i("player is not ready"))}))}startRecord(e,t){return new Promise(((i,s)=>this.isDestroyed()?s("player is destroyed"):(this.debugLog("JbPro",`startRecord() ${e} ${t}`),this.player?void(this.player.playing?(this.player.startRecord(e,t),i()):(this.debugWarn("JbPro","startRecord() player is not playing"),s("not playing"))):(this.debugWarn("JbPro","startRecord() player is not ready"),s("player is not ready")))))}stopRecordAndSave(e,t){return new Promise(((i,s)=>{if(this.isDestroyed())return s("player is destroyed");this.debugLog("JbPro",`stopRecordAndSave() ${e} ${t}`),this.player&&this.player.recording?this.player.stopRecordAndSave(e,t).then((e=>{i(e)})).catch((e=>{s(e)})):s("not recording")}))}cancelRecord(){return new Promise(((e,t)=>this.isDestroyed()?t("player is destroyed"):(this.debugLog("JbPro","cancelRecord()"),this.player?void this.player.cancelRecord().then((()=>{e()})).catch((e=>{t(e)})):(this.debugWarn("JbPro","cancelRecord() player is not ready"),t("player is not ready")))))}isPlaying(){let e=!1;return this.player&&(e=this.player.isPlaying()),e}isLoading(){return!!this.player&&this.player.loading}isPause(){let e=!1;return this._opt.playType===v?e=!this.isPlaying()&&!this.isLoading():this._opt.playType===w&&this.player&&(e=this.player.playbackPause),e}isPaused(){return this.isPause()}isPlaybackPause(){let e=!1;return this._opt.playType===w&&this.player&&(e=this.player.playbackPause),e}isMute(){let e=!0;return this.player&&(e=this.player.isAudioMute()),e}isRecording(){return this.player&&this.player.recorder&&this.player.recorder.recording||!1}isFullscreen(){let e=!1;return this.player&&(e=this.player.fullscreen),e}isWebFullscreen(){let e=!1;return this.player&&(e=this.player.webFullscreen),e}clearBufferDelay(){this.isDestroyed()||(this.debugLog("JbPro","clearBufferDelay()"),this.player?this.player.clearBufferDelay():this.debugWarn("JbPro","clearBufferDelay() player is not init"))}setNetworkDelayTime(e){if(this.isDestroyed())return;this.debugLog("JbPro",`setNetworkDelayTime() ${e}`),(e=Number(e))<1&&this.debugWarn("JbPro",`setNetworkDelayTime() network delay is ${e} second, is too small`);const t=1e3*(e=ao(e,1,100));this._opt.networkDelay=t,this.player?this.player.updateOption({networkDelay:t},!0):this.debugWarn("JbPro","setNetworkDelayTime() player is null")}getDecodeType(){let e="";return this.player&&(e=this.player.getDecodeType()),e}getRenderType(){let e="";return this.player&&(e=this.player.getRenderType()),e}getAudioEngineType(){let e="";return this.player&&(e=this.player.getAudioEngineType()),e}getPlayingTimestamp(){let e=0;return this.player&&(e=this.player.getPlayingTimestamp()),e}getStatus(){let e=ys;return this.player&&(e=this.player.loading?fs:this.player.playing?ms:gs),e}getPlayType(){return this.player?this.player._opt.playType:v}togglePerformancePanel(e){if(this.isDestroyed())return;this.debugLog("JbPro",`togglePerformancePanel() ${e}`);const t=this.player._opt.showPerformance;let i=!t;Bo(e)&&(i=e),i!==t?this.player?this.player.togglePerformancePanel(i):this.debugWarn("JbPro","togglePerformancePanel() failed, this.player is not init"):this.debugWarn("JbPro",`togglePerformancePanel() failed, showPerformance is prev: ${t} === now: ${i}`)}openZoom(){if(!this.isDestroyed())if(this.debugLog("JbPro","openZoom()"),this.player){if(this.player.isDestroyedOrClosed())return void this.debugWarn("JbPro","openZoom() failed, this.player is destroyed or paused");this.player.zooming=!0}else this.debugWarn("JbPro","openZoom() failed, this.player is not init")}closeZoom(){if(!this.isDestroyed())if(this.debugLog("JbPro","closeZoom()"),this.player){if(this.player.isDestroyedOrClosed())return void this.debugWarn("JbPro","openZoom() failed, this.player is destroyed or paused");this.player.zooming=!1}else this.debugWarn("JbPro","closeZoom() failed, this.player is not init")}isZoomOpen(){let e=!1;return this.player&&(e=this.player.zooming),e}toggleZoom(e){this.isDestroyed()||(this.debugLog("JbPro",`toggleZoom() ${e}`),Bo(e)||(e=!this.isZoomOpen()),ya(e)?this.openZoom():Aa(!1)&&this.closeZoom())}expandZoom(){this.isDestroyed()||(this.debugLog("JbPro","expandZoom()"),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.expandPrecision():this.debugWarn("JbPro","expandZoom() failed, zoom is not open or not init"))}narrowZoom(){this.isDestroyed()||(this.debugLog("JbPro","narrowZoom()"),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.narrowPrecision():this.debugWarn("JbPro","narrowZoom failed, zoom is not open or not init"))}updateCurrentZoom(e){this.isDestroyed()||(this.debugLog("JbPro","updateCurrentZoom()",e),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.updateCurrentZoom(e):this.debugWarn("JbPro","narrowZoom failed, zoom is not open or not init"))}getCurrentZoomIndex(){if(this.isDestroyed())return;let e=1;return this.player&&this.player.zoom&&(e=this.player.zoom.currentZoom),e}setNakedFlowFps(e){return new Promise(((t,i)=>{if(this.isDestroyed())return i("player is destroyed");if(this.debugLog("JbPro","setNakedFlowFps()",e),Io(e))return i("setNakedFlowFps() fps is empty");let s=Number(e);s=ao(s,1,100),this._opt.nakedFlowFps=s,this.player?this.player.updateOption({nakedFlowFps:s}):this.debugWarn("JbPro","setNakedFlowFps() player is null"),t()}))}getCrashLog(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!this.player)return;const i=this.player.getAllStatsData(),s=this.player;let r={url:this._opt.url,playType:s.isPlayback()?"playback":"live",demuxType:s.getDemuxType(),decoderType:s.getDecodeType(),renderType:s.getRenderType(),videoInfo:{encType:"",width:"",height:""},audioInfo:{encType:"",sampleRate:"",channels:""},audioEngine:s.getAudioEngineType(),allTimes:i.pTs,timestamp:oo(),type:e,error:la(t)||e};if(s.video){const e=s.video.videoInfo||{};r.videoInfo={encType:e.encType||"",width:e.width||"",height:e.height||""}}if(s.audio){const e=s.audio.audioInfo||{};r.audioInfo={encType:e.encType||"",sampleRate:e.sampleRate||"",channels:e.channels||""}}return r}updateDebugLevel(e){this.isDestroyed()||(this.debugLog("JbPro","updateDebugLevel()",e),e===q||e===K?e!==this.player._opt.debugLevel?(this._opt.debugLevel=e,this.player?this.player.updateOption({debugLevel:e},!0):this.debugWarn("JbPro","updateDebugLevel() player is null")):this.debugWarn("JbPro",`updateDebugLevel() level is same, level: ${e}`):this.debugWarn("JbPro",`updateDebugLevel() level is not valid, level: ${e}`))}updateWatermark(e){this.isDestroyed()||(this.debugLog("JbPro","updateWatermark()",e),this.player?this.player.updateWatermark(e):this.debugWarn("JbPro","updateWatermark() player is not init"))}removeWatermark(){this.isDestroyed()||(this.debugLog("JbPro","removeWatermark()"),this.player?this.player.removeWatermark():this.debugWarn("JbPro","removeWatermark() player is not init"))}updateFullscreenWatermark(e){if(!this.isDestroyed())if(this.debugLog("JbPro","updateFullscreenWatermark()",e),qo(e)){this._opt.fullscreenWatermarkConfig=e;const t=Uo(this.$container,e);if(!t.watermark_txt)return void this.debugWarn("JbPro","fullscreenWatermarkConfig text is empty");this.watermark.load(t)}else this.debugWarn("JbPro",`updateFullscreenWatermark() config is not valid, config: ${e}`)}removeFullscreenWatermark(){this.isDestroyed()||(this.debugLog("JbPro","removeFullscreenWatermark()"),this.watermark?this.watermark.remove():this.debugWarn("JbPro","removeFullscreenWatermark() watermark is not init"))}faceDetectOpen(){this.isDestroyed()||(this.debugLog("JbPro","faceDetectOpen()"),this.player?this.player.faceDetect(!0):this.debugWarn("JbPro","faceDetectOpen() player is not init"))}faceDetectClose(){this.isDestroyed()||(this.debugLog("JbPro","faceDetectClose()"),this.player?this.player.faceDetect(!1):this.debugWarn("JbPro","faceDetectClose() player is not init"))}objectDetectOpen(){this.isDestroyed()||(this.debugLog("JbPro","objectDetectOpen()"),this.player?this.player.objectDetect(!0):this.debugWarn("JbPro","objectDetectOpen() player is not init"))}objectDetectClose(){this.isDestroyed()||(this.debugLog("JbPro","objectDetectClose()"),this.player?this.player.objectDetect(!1):this.debugWarn("JbPro","objectDetectClose() player is not init"))}sendWebsocketMessage(e){this.isDestroyed()||(this.debugLog("JbPro","sendWebsocketMessage()",e),this.player?this.player.sendWebsocketMessage(e):this.debugWarn("JbPro","sendWebsocketMessage() player is not init"))}addContentToCanvas(e){this.isDestroyed()||(this.debugLog("JbPro","addContentToCanvas()"),this.player?this.player.addContentToCanvas(e):this.debugWarn("JbPro","addContentToCanvas() player is not init"))}clearContentToCanvas(){this.isDestroyed()||(this.debugLog("JbPro","clearContentToCanvas()"),this.player?this.player.addContentToCanvas([]):this.debugWarn("JbPro","clearContentToCanvas() player is not init"))}addContentToContainer(e){this.isDestroyed()||(this.debugLog("JbPro","addContentToContainer()"),this.player?this.player.addContentToContainer(e):this.debugWarn("JbPro","addContentToContainer() player is not init"))}clearContentToContainer(){this.isDestroyed()||(this.debugLog("JbPro","clearContentToContainer()"),this.player?this.player.addContentToContainer([]):this.debugWarn("JbPro","clearContentToContainer() player is not init"))}setControlHtml(e){this.isDestroyed()||(this.debugLog("JbPro","setControlHtml()",e),this.player?this.player.setControlHtml(e):this.debugWarn("JbPro","setControlHtml() player is not init"))}clearControlHtml(){this.isDestroyed()||(this.debugLog("JbPro","clearControlHtml()"),this.player?this.player.clearControlHtml():this.debugWarn("JbPro","clearControlHtml() player is not init"))}toggleControlHtml(e){this.isDestroyed()||(this.debugLog("JbPro",`toggleControlHtml() ${e}`),this.player?this.player.toggleControlHtml(e):this.debugWarn("JbPro","toggleControlHtml() player is not init"))}getControlHtmlIsShow(){return!!this.player&&this.player.getControlHtmlIsShow()}getControlHtml(){return this.player?this.player.getControlHtml():null}setExtendHtml(e){this.isDestroyed()||(this.debugLog("JbPro","setExtendHtml()",e),this.player?this.player.setExtendHtml(e):this.debugWarn("JbPro","setExtendHtml() player is not init"))}clearExtendHtml(){this.isDestroyed()||(this.debugLog("JbPro","clearExtendHtml()"),this.player?this.player.clearExtendHtml():this.debugWarn("JbPro","clearExtendHtml() player is not init"))}toggleExtendHtml(e){this.isDestroyed()||(this.debugLog("JbPro",`toggleExtendHtml() ${e}`),this.player?this.player.toggleExtendHtml(e):this.debugWarn("JbPro","toggleExtendHtml() player is not init"))}getExtendHtmlIsShow(){return!!this.player&&this.player.getExtendHtmlIsShow()}getExtendHtml(){return this.player?this.player.getExtendHtml():null}getVideoInfo(){let e=null;return this.player&&(e=this.player.getVideoInfo()),e}getAudioInfo(){let e=null;return this.player&&(e=this.player.getAudioInfo()),e}setSm4CryptoKey(e){if(this.isDestroyed())return;this.debugLog("JbPro","setSm4CryptoKey()",e);const t=(e=""+e).split(".");if(32!==e.length&&2!==t.length)return void this.debugWarn("JbPro",`setSm4CryptoKey() key is invalid and length is ${e.length} !== 32`);if(2===t.length&&(32!==t[0].length||32!==t[1].length))return void this.debugWarn("JbPro",`setSm4CryptoKey() key is invalid and key length is ${t[0].length} !== 32 or iv length ${t[1].length} !== 32`);this._opt.sm4CryptoKey=e;let i=2===t.length;if(i&&(this._opt.playOptions.cryptoKey=dl(t[0]),this._opt.playOptions.cryptoIV=dl(t[1])),this.player){const t={sm4CryptoKey:e};i&&(t.cryptoKey=this._opt.playOptions.cryptoKey,t.cryptoIV=this._opt.playOptions.cryptoIV),this.player.updateOption(t,!0)}else this.debugWarn("JbPro","setSm4CryptoKey() player is null")}setM7sCryptoKey(e){this.isDestroyed()||(this.debugLog("JbPro","setM7sCryptoKey()",e),e=""+e,this._opt.m7sCryptoKey=e,this.player?this.player.updateOption({m7sCryptoKey:e},!0):this.debugWarn("JbPro","setM7sCryptoKey() player is null"))}setXorCryptoKey(e){this.isDestroyed()||(this.debugLog("JbPro","setXorCryptoKey()",e),e=""+e,this._opt.xorCryptoKey=e,this.player?this.player.updateOption({xorCryptoKey:e},!0):this.debugWarn("JbPro","setXorCryptoKey() player is null"))}updateLoadingText(e){this.isDestroyed()||(this.debugLog("JbPro","updateLoadingText()",e),this.player?this.player.updateLoadingText(e):this.debugWarn("JbPro","updateLoadingText() player is null"))}updateIsEmitSEI(e){this.isDestroyed()||(this.debugLog("JbPro","updateIsEmitSEI()",e),this._opt.isEmitSEI=e,this.player?this.player.updateOption({isEmitSEI:e},!0):this.debugWarn("JbPro","updateIsEmitSEI() player is null"))}getPTZCmd(e,t){return this.debugLog("JbPro","getPTZCmd()",e),e?this.player?Xv({type:e,index:0,speed:t}):(this.debugWarn("JbPro","getPTZCmd() player is null"),null):(this.debugWarn("JbPro","getPTZCmd() ptz is null"),null)}downloadTempNakedFlowFile(){return new Promise(((e,t)=>{this.player?(this.player.downloadNakedFlowFile(),e()):t("player is not init")}))}downloadTempFmp4File(){return new Promise(((e,t)=>{if(this.isDestroyed())return t("player is destroyed");this.player?(this.player.downloadFmp4File(),e()):t("player is not init")}))}downloadTempMpeg4File(){return new Promise(((e,t)=>{if(this.isDestroyed())return t("player is destroyed");this.player?(this.player.downloadMpeg4File(),e()):t("player is not init")}))}downloadMemoryLog(){this.isDestroyed()||this.memoryLogger&&this.memoryLogger.download()}_getVideoLastIframeInfo(){const e=this.getVideoInfo()||{},t={loadingBackground:this.screenshot("","png",.92,"base64"),loadingBackgroundWidth:e.width||0,loadingBackgroundHeight:e.height||0};return t.loadingBackground&&t.loadingBackgroundWidth&&t.loadingBackgroundHeight&&(this._tempVideoLastIframeInfo=t),this._tempVideoLastIframeInfo||{}}getExtendBtnList(){this.debugLog("JbPro","getExtendBtnList()");let e=[];return this.player?e=this.player.getExtendBtnList():this.debugWarn("JbPro","getExtendBtnList() player is null"),e}getFlvMetaData(){this.debugLog("JbPro","getFlvMetaData()");let e=null;return this.player?e=this.player.getMetaData():this.debugWarn("JbPro","getFlvMetaData() player is null"),e}updateAiFaceDetectInterval(e){if(this.isDestroyed())return;this.debugLog("JbPro","updateAiFaceDetectInterval()",e);const t=1e3*(e=Number(e));this._opt.aiFaceDetectInterval=t,this.player?this.player.updateOption({aiFaceDetectInterval:t}):this.debugWarn("JbPro","updateAiFaceDetectInterval() player is null")}updateAiFaceDetectLevel(e){if(this.isDestroyed())return;if(this.debugLog("JbPro","updateAiFaceDetectLevel()",e),!Ks[e])return void this.debugWarn("JbPro",`'updateAiFaceDetectLevel() level ${e} is invalid'`);const t=Ks[e];this._opt.aiFaceDetectWidth=t,this.player?(this.player.updateOption({aiFaceDetectWidth:t}),this.player.ai&&this.player.ai.updateFaceDetectorConfig({detectWidth:t})):this.debugWarn("JbPro","updateAiFaceDetectLevel() player is null")}updateAiObjectDetectInterval(e){if(this.isDestroyed())return;this.debugLog("JbPro","updateAiObjectDetectInterval()",e);const t=1e3*(e=Number(e));this._opt.aiObjectDetectInterval=t,this.player?this.player.updateOption({aiObjectDetectInterval:t}):this.debugWarn("JbPro","updateAiObjectDetectInterval() player is null")}updateAiObjectDetectLevel(e){if(this.isDestroyed())return;if(this.debugLog("JbPro","updateAiObjectDetectLevel()",e),!Ys[e])return void this.debugWarn("JbPro",`'updateAiObjectDetectLevel() level ${e} is invalid'`);const t=Ys[e];this._opt.aiObjectDetectWidth=t,this.player?(this.player.updateOption({aiObjectDetectWidth:t}),this.player.ai&&this.player.ai.updateObjectDetectorConfig({detectWidth:t})):this.debugWarn("JbPro","updateAiObjectDetectLevel() player is null")}setCryptoKeyUrl(e){this.isDestroyed()||(this.debugLog("JbPro","setCryptoKeyUrl()",e),e&&(this._opt.cryptoKeyUrl=e))}showErrorMessageTips(e){this.isDestroyed()||(this.debugLog("JbPro","showErrorMessageTips()",e),e&&(this.player?this.player.showTipsMessageByContent(e):this.debugWarn("JbPro","showErrorMessageTips() player is null")))}setPtzPosition(e){this.debugLog("JbPro","setPtzPosition()",e),e&&!Jo(e)&&(this.player?this.player.setPtzPosition(e):this.debugWarn("JbPro","setPtzPosition() player is null"))}hideErrorMessageTips(){this.isDestroyed()||(this.debugLog("JbPro","hideErrorMessageTips()"),this.player?this.player.hideTipsMessage():this.debugWarn("JbPro","hideErrorMessageTips() player is null"))}getContainerRect(){return this._getContainerRect()}proxy(e,t,i,s){return this.events.proxy(e,t,i,s)}getUrl(){return this._opt.url}toggleControlExtendBtn(e,t){this.isDestroyed()||(this.debugLog(this.TAG_NAME,`toggleControlExtendBtn() ${e} ${t}`),this.player?this.player.toggleControlExtendBtn(e,t):this.debugWarn(this.TAG_NAME,"toggleControlExtendBtn() player is null"))}getControlExtendBtnActive(e){if(this.isDestroyed())return;this.debugLog(this.TAG_NAME,`getControlExtendBtnActive() ${e}`);let t=!1;return this.player?t=this.player.getControlExtendBtnActive(e):this.debugWarn(this.TAG_NAME,"getControlExtendBtnActive() player is null"),t}toggleControlBar(e){this.isDestroyed()||(this.debugLog(this.TAG_NAME,`toggleControlBar() ${e}`),this.player?this.player.toggleControlBar(e):this.debugWarn(this.TAG_NAME,"toggleControlBar() player is null"))}getControlBarShow(){if(this.isDestroyed())return!1;this.debugLog(this.TAG_NAME,"getControlBarShow()");let e=!1;return this.player?e=this.player.getControlBarShow():this.debugWarn(this.TAG_NAME,"getControlBarShow() player is null"),e}static getCopyrightWatermarkHash(e){return No(e)}static extractScreenshotCopyrightWatermark(e){return function(e){for(var t=e,i=0,s=0,r=0;r<32;r++)s|=(1&t[i])<=5){const s=i[0],r=i[i.length-1],o=r-s;o<=1e4&&(this.debugWarn(this.TAG_NAME,`retry type is ${e}, and retry length is ${i.length}, and start is ${s} and end is ${r} and diff is ${o}`),t=!1)}return t}_initLoadingBackgroundForIOS(e){(bo()||vo())&&e.loadingBackground&&e.loadingBackgroundWidth&&e.loadingBackgroundHeight&&(this.debugLog(this.TAG_NAME,"_initLoadingBackgroundForIOS"),this._initLoadingBg(),"default"===this.player._opt.aspectRatio||fo()?this._doInitLoadingBackground(e):this._doInitLoadingBackgroundForRatio(e))}_doInitLoadingBackground(e){const t=this._getContainerRect();let i=t.height;const s=this.player._opt;if(this.player.isControlBarShow()){i-=s.playType===w?Xt:Qt}let r=t.width,o=i;const a=s.rotate;270!==a&&90!==a||(r=i,o=t.width),this.$loadingBgImage.width=r,this.$loadingBgImage.height=o,this.$loadingBgImage.src=e.loadingBackground;let n=(t.width-r)/2,l=(i-o)/2,d="contain";s.isResize||(d="fill"),s.isFullResize&&(d="none");let h="";"none"===s.mirrorRotate&&a&&(h+=" rotate("+a+"deg)"),"level"===s.mirrorRotate?h+=" rotateY(180deg)":"vertical"===s.mirrorRotate&&(h+=" rotateX(180deg)"),this._opt.videoRenderSupportScale&&(this.$loadingBgImage.style.objectFit=d),this.$loadingBgImage.style.transform=h,this.$loadingBgImage.style.padding="0",this.$loadingBgImage.style.left=n+"px",this.$loadingBgImage.style.top=l+"px",this.$loadingBgImage.complete?nc(this.$loadingBg,"show"):this.$loadingBgImage.onload=()=>{nc(this.$loadingBg,"show"),this.$loadingBgImage.onload=null}}_doInitLoadingBackgroundForRatio(e){const t=this.player._opt.aspectRatio.split(":").map(Number),i=this._getContainerRect();let s=i.width,r=i.height;const o=this.player._opt;let a=0;this.player.isControlBarShow()&&(a=o.playType===w?Xt:Qt,r-=a);const n=e.loadingBackgroundWidth,l=e.loadingBackgroundHeight,d=n/l,h=t[0]/t[1];if(this.$loadingBgImage.src=e.loadingBackground,d>h){const e=h*l/n;this.$loadingBgImage.style.width=100*e+"%",this.$loadingBgImage.style.height=`calc(100% - ${a}px)`,this.$loadingBgImage.style.padding=`0 ${(s-s*e)/2}px`}else{const e=n/h/l;this.$loadingBgImage.style.width="100%",this.$loadingBgImage.style.height=`calc(${100*e}% - ${a}px)`,this.$loadingBgImage.style.padding=(r-r*e)/2+"px 0"}this.$loadingBgImage.complete?nc(this.$loadingBg,"show"):this.$loadingBgImage.onload=()=>{nc(this.$loadingBg,"show"),this.$loadingBgImage.onload=null}}_initLoadingBg(){if(!this.$loadingBg){const e=document.createElement("div"),t=document.createElement("img");e.className="jb-pro-loading-bg-for-ios",this.$loadingBg=e,this.$loadingBgImage=t,e.appendChild(t),this.$container.appendChild(e)}}_removeLoadingBackgroundForIOS(){if(this.$loadingBg){this.debugLog(this.TAG_NAME,"_removeLoadingBackgroundForIOS()");if(!cc(this.$loadingBg)){const e=this.$container.querySelector(".jb-pro-loading-bg-for-ios");e&&this.$container&&this.$container.removeChild(e)}this.$loadingBg=null,this.$loadingBgImage=null}}_getContainerRect(){let e={};return this.$container&&(e=this.$container.getBoundingClientRect(),e.width=Math.max(e.width,this.$container.clientWidth),e.height=Math.max(e.height,this.$container.clientHeight)),e}_isNeedNetworkDisconnectReplay(){return this._opt.networkDisconnectReplay&&this.network.isOffline()}_handleWebglAlignmentError(e){if(this.isDestroyed())this.debugLog("JbPro","webglAlignmentError but player is destroyed");else if(this.webglAlignmentErrorOnLock)this.debugLog("JbPro","webglAlignmentErrorOnLock is true");else if(this.emit(at.crashLog,this.getCrashLog(dt.webglAlignmentError,e)),this.webglAlignmentErrorOnLock=!0,this.player&&this.player._opt.webglAlignmentErrorReplay){this.debugLog("JbPro","webglAlignmentError");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({openWebglAlignment:!0}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webglAlignmentError and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.webglAlignmentError,{},e),this.debugError("JbPro","webglAlignmentError and play error",t)})).finally((()=>{this.webglAlignmentErrorOnLock=!1}))})).catch((e=>{this.webglAlignmentErrorOnLock=!1,this.debugError("JbPro","webglAlignmentError and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.webglAlignmentError,{},e),this.debugLog("JbPro","webglAlignmentError and webglAlignmentErrorReplay is false")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.webglAlignmentError,{},e),this.debugError("JbPro","webglAlignmentError and pause error",t)})).finally((()=>{this.webglAlignmentErrorOnLock=!1}))}}_handleWebglContextLostError(e){if(this.isDestroyed())return void this.debugLog("JbPro","webglContextLostError but player is destroyed");if(this.webglContextLostErrorOnLock)return void this.debugLog("JbPro","webglContextLostErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.webglContextLostError,e));const t=this._getVideoLastIframeInfo();if(this.webglContextLostErrorOnLock=!0,this.player&&this.player._opt.webglContextLostErrorReplay){this.debugLog("JbPro","webglContextLostError");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","webglContextLostError and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.webglContextLostError,t,e),this.debugError("JbPro","webglContextLostError and play error",i)})).finally((()=>{this.webglContextLostErrorOnLock=!1}))})).catch((i=>{this.webglContextLostErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.webglContextLostError,t,e),this.debugError("JbPro","webglContextLostError and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.webglContextLostError,t,e),this.debugLog("JbPro","webglContextLostError and webglContextLostErrorReplay is false")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.webglContextLostError,t,e),this.debugError("JbPro","webglAlignmentError and pause error",i)})).finally((()=>{this.webglContextLostErrorOnLock=!1}))}}_handleMediaSourceH265NotSupport(e){if(this.isDestroyed())this.debugLog("JbPro","mediaSourceH265NotSupport but player is destroyed");else if(this.mediaSourceH265NotSupportOnLock)this.debugLog("JbPro","mediaSourceH265NotSupportOnLock is true");else if(this.emit(at.crashLog,this.getCrashLog(dt.mediaSourceH265NotSupport,e)),this.mediaSourceH265NotSupportOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.mediaSourceH265NotSupport,e),this.debugError("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play error",t)})).finally((()=>{this.mediaSourceH265NotSupportOnLock=!1}))})).catch((t=>{this.mediaSourceH265NotSupportOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceH265NotSupport,{},e),this.debugError("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.mediaSourceH265NotSupport,{},e),this.debugLog("JbPro","mediaSourceH265NotSupport and autoWasm is false")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.mediaSourceH265NotSupport,{},e),this.debugError("JbPro","mediaSourceH265NotSupport and pause error",t)})).finally((()=>{this.mediaSourceH265NotSupportOnLock=!1}))}}_handleMseWaitVideoCanplayTimeout(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","mseWaitVideoCanplayTimeout but player is destroyed");else if(this.mseWaitVideoCanplayTimeoutOnLock)this.debugLog("JbPro","mseWaitVideoCanplayTimeoutOnLock is true");else if(this.emit(at.crashLog,this.getCrashLog(dt.mseWaitVideoCanplayTimeout,e)),this.mseWaitVideoCanplayTimeoutOnLock=!0,this.player&&this.player._opt.mseWaitVideoCanplayAutoWasm){this.debugLog("JbPro","mseWaitVideoCanplayTimeout auto wasm [mse-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","mseWaitVideoCanplayTimeout auto wasm [mse-> wasm] reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.mseWaitVideoCanplayTimeout,e),this.debugError("JbPro","mseWaitVideoCanplayTimeout auto wasm [mse-> wasm] reset player and play error",t)})).finally((()=>{this.mseWaitVideoCanplayTimeoutOnLock=!1}))})).catch((t=>{this.mseWaitVideoCanplayTimeoutOnLock=!1,this.emit(at.playFailedAndPaused,dt.mseWaitVideoCanplayTimeout,{},e),this.debugError("JbPro","mseWaitVideoCanplayTimeout auto wasm [mse-> wasm] _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.mseWaitVideoCanplayTimeout,{},e),this.debugLog("JbPro","mseWaitVideoCanplayTimeout and autoWasm is false")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.mediaSourceH265NotSupport,{},e),this.debugError("JbPro","mediaSourceH265NotSupport and pause error",t)})).finally((()=>{this.mseWaitVideoCanplayTimeoutOnLock=!1}))}}_handleMediaSourceFull(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceFull but player is destroyed"));if(this.mediaSourceFullOnLock)return void this.debugLog("JbPro","mediaSourceFullOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.mediaSourceFull,e));const t=this._getVideoLastIframeInfo();if(this.mediaSourceFullOnLock=!0,this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},o=this.player._opt.decoderErrorAutoWasm,a=!0;o?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(vr)?this._mseDecodeErrorRetryLog.push(oo()):(o=!0,a=!1,r={useMSE:!1,useWCS:!1}),this.debugLog("JbPro",`mediaSourceFull and auto wasm ${Aa(a)?" and is not meaningful Retry":""} [mse-> ${o?"wasm":"mse"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mediaSourceFull and reset player and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mediaSourceFull,t,e),this.debugError("JbPro","mediaSourceFull and reset player and play error",i)})).finally((()=>{this.mediaSourceFullOnLock=!1}))})).catch((i=>{this.mediaSourceFullOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceFull,t,e),this.debugError("JbPro","mediaSourceFull and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.mediaSourceFull,t,e),this.debugLog("JbPro","mediaSourceFull and autoWasm is false")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mediaSourceFull,t,e),this.debugError("JbPro","mediaSourceFull and pause error",i)})).finally((()=>{this.mediaSourceFullOnLock=!1}))}}_handleMediaSourceAppendBufferError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceAppendBufferError but player is destroyed"));if(this.mediaSourceAppendBufferErrorOnLock)return void this.debugLog("JbPro","mediaSourceAppendBufferErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.mediaSourceAppendBufferError,e));const t=this._getVideoLastIframeInfo();if(this.mediaSourceAppendBufferErrorOnLock=!0,this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},o=this.player._opt.decoderErrorAutoWasm,a=!0;o?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(vr)?this._mseDecodeErrorRetryLog.push(oo()):(o=!0,a=!1,r={useMSE:!1,useWCS:!1}),this.player.isMSEAudioDecoderError&&(this.player.debugLog("JbPro","mediaSourceAppendBufferError and isMSEAudioDecoderError is true so set mseDecodeAudio = false"),r.mseDecodeAudio=!1),this.debugLog("JbPro",`mediaSourceAppendBufferError and auto wasm ${Aa(a)?" and is not meaningful Retry":""} [mse-> ${o?"wasm":"mse"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mediaSourceAppendBufferError and reset player and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAppendBufferError,t,e),this.debugError("JbPro","mediaSourceAppendBufferError and reset player and play error",i)})).finally((()=>{this.mediaSourceAppendBufferErrorOnLock=!1}))})).catch((i=>{this.mediaSourceAppendBufferErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceAppendBufferError,t,e),this.debugError("JbPro","mediaSourceAppendBufferError and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAppendBufferError,t,e),this.debugLog("JbPro","mediaSourceAppendBufferError and autoWasm is false")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAppendBufferError,t,e),this.debugError("JbPro","mediaSourceAppendBufferError and pause error",i)})).finally((()=>{this.mediaSourceAppendBufferErrorOnLock=!1}))}}_handleMseSourceBufferError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mseSourceBufferError but player is destroyed"));if(this.mseSourceBufferErrorOnLock)return void this.debugLog("JbPro","mseSourceBufferErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.mseSourceBufferError,e));const t=this._getVideoLastIframeInfo();if(this.mseSourceBufferErrorOnLock=!0,this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={};if(this.player._opt.mseDecoderUseWorker)r={mseDecoderUseWorker:!1},this.debugLog("JbPro","mseSourceBufferError auto wasm [mse worker -> mse] reset player and play");else{let e=this.player._opt.decoderErrorAutoWasm,t=!0;e?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(vr)?this._mseDecodeErrorRetryLog.push(oo()):(e=!0,t=!1,r={useMSE:!1,useWCS:!1}),this.player.isMSEVideoDecoderInitializationFailedNotSupportHevc&&(this.debugLog("JbPro","mseSourceBufferError and isMSEVideoDecoderInitializationFailedNotSupportHevc is true so auto wasm"),r={useMSE:!1,useWCS:!1}),this.debugLog("JbPro",`mseSourceBufferError auto wasm ${Aa(t)?" and is not meaningful Retry":""} [mse-> ${e?"wasm":"mse"}] reset player and play`)}this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mseSourceBufferError reset player and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mseSourceBufferError,t,e),this.debugError("JbPro","mseSourceBufferError reset player and play error",i)})).finally((()=>{this.mseSourceBufferErrorOnLock=!1}))})).catch((i=>{this.mseSourceBufferErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.mseSourceBufferError,t,e),this.debugError("JbPro","mseSourceBufferError _resetPlayer and play error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.mseSourceBufferError,t,e),this.debugLog("JbPro","mseSourceBufferError and autoWasm is false")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mseSourceBufferError,t,e),this.debugError("JbPro","mseSourceBufferError and pause error:",i)})).finally((()=>{this.mseSourceBufferErrorOnLock=!1}))}}_handleMediaSourceBufferedIsZeroError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceBufferedIsZeroError but player is destroyed"));if(this.mediaSourceBufferedIsZeroErrorOnLock)return void this.debugLog("JbPro","mediaSourceBufferedIsZeroErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.mediaSourceBufferedIsZeroError,e));const t=this._getVideoLastIframeInfo();if(this.mediaSourceBufferedIsZeroErrorOnLock=!0,this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},o=this.player._opt.decoderErrorAutoWasm,a=!0;o?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(vr)?this._mseDecodeErrorRetryLog.push(oo()):(o=!0,a=!1,r={useMSE:!1,useWCS:!1}),this.debugLog("JbPro",`mediaSourceBufferedIsZeroError auto wasm ${Aa(a)?" and is not meaningful Retry":""} [mse-> ${o?"wasm":"mse"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mediaSourceBufferedIsZeroError reset player and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mediaSourceBufferedIsZeroError,t,e),this.debugError("JbPro","mediaSourceBufferedIsZeroError reset player and play error",i)})).finally((()=>{this.mediaSourceBufferedIsZeroErrorOnLock=!1}))})).catch((i=>{this.mediaSourceBufferedIsZeroErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceBufferedIsZeroError,t,e),this.debugError("JbPro","mediaSourceBufferedIsZeroError _resetPlayer and play error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.mediaSourceBufferedIsZeroError,t,e),this.debugLog("JbPro","mediaSourceBufferedIsZeroError and autoWasm is false")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mediaSourceBufferedIsZeroError,t,e),this.debugError("JbPro","mediaSourceBufferedIsZeroError and pause error:",i)})).finally((()=>{this.mediaSourceBufferedIsZeroErrorOnLock=!1}))}}_handleMseAddSourceBufferError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mseAddSourceBufferError but player is destroyed"));if(this.mseAddSourceBufferErrorOnLock)return void this.debugLog("JbPro","mseAddSourceBufferErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.mseAddSourceBufferError,e));const t=this._getVideoLastIframeInfo();if(this.mseAddSourceBufferErrorOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={useMSE:!1,useWCS:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mseAddSourceBufferError,t,e),this.debugError("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play error",i)})).finally((()=>{this.mseAddSourceBufferErrorOnLock=!1}))})).catch((i=>{this.mseAddSourceBufferErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.mseAddSourceBufferError,t,e),this.debugError("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] _resetPlayer and play error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.mseAddSourceBufferError,t,e),this.debugLog("JbPro","mseAddSourceBufferError and autoWasm is false")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mseAddSourceBufferError,t,e),this.debugError("JbPro","mseAddSourceBufferError and pause error",i)})).finally((()=>{this.mseAddSourceBufferErrorOnLock=!1}))}}_handleMediaSourceDecoderConfigurationError(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","mediaSourceDecoderConfigurationError but player is destroyed");else if(this.mediaSourceDecoderConfigurationErrorOnLock)this.debugLog("JbPro","mediaSourceDecoderConfigurationErrorOnLock is true");else if(this.emit(at.crashLog,this.getCrashLog(dt.mediaSourceDecoderConfigurationError,e)),this.mediaSourceDecoderConfigurationErrorOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;let s={useMSE:!1,useWCS:!1};this._resetPlayer(s).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.mediaSourceDecoderConfigurationError,e),this.debugError("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play error",t)})).finally((()=>{this.mediaSourceDecoderConfigurationErrorOnLock=!1}))})).catch((t=>{this.mediaSourceDecoderConfigurationErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceDecoderConfigurationError,e),this.debugError("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.mediaSourceDecoderConfigurationError,e),this.debugLog("JbPro","mediaSourceDecoderConfigurationError and autoWasm is false")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.mediaSourceDecoderConfigurationError,e),this.debugError("JbPro","mediaSourceDecoderConfigurationError and pause error",t)})).finally((()=>{this.mediaSourceDecoderConfigurationErrorOnLock=!1}))}}_handleMediaSourceTsIsMaxDiff(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceTsIsMaxDiff but player is destroyed"));if(this.mediaSourceTsIsMaxDiffOnLock)return void this.debugLog("JbPro","mediaSourceTsIsMaxDiffOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.mediaSourceTsIsMaxDiff,e));const t=this._getVideoLastIframeInfo();if(this.mediaSourceTsIsMaxDiffOnLock=!0,this.player&&this.player._opt.mediaSourceTsIsMaxDiffReplay){this.debugLog("JbPro","mediaSourceTsIsMaxDiff reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","mediaSourceTsIsMaxDiff replay success")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mediaSourceTsIsMaxDiff,t,e),this.debugError("JbPro","mediaSourceTsIsMaxDiff replay error",i)})).finally((()=>{this.mediaSourceTsIsMaxDiffOnLock=!1}))})).catch((i=>{this.mediaSourceTsIsMaxDiffOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceTsIsMaxDiff,t,e),this.debugError("JbPro","mediaSourceTsIsMaxDiff _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.mediaSourceTsIsMaxDiff,t,e),this.debugLog("JbPro","mediaSourceTsIsMaxDiff and replay is false")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.mediaSourceTsIsMaxDiff,t,e),this.debugError("JbPro","mediaSourceTsIsMaxDiff and pause error",i)})).finally((()=>{this.mediaSourceTsIsMaxDiffOnLock=!1}))}}_handleMseWidthOrHeightChange(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mseWidthOrHeightChange but player is destroyed"));if(this.mseWidthOrHeightChangeOnLock)return void this.debugLog("JbPro","mseWidthOrHeightChangeOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.mseWidthOrHeightChange,t));const i=this._getVideoLastIframeInfo();if(this.mseWidthOrHeightChangeOnLock=!0,this.player&&this.player._opt.widthOrHeightChangeReplay){this.debugLog("JbPro","mseWidthOrHeightChange and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.player._opt.widthOrHeightChangeReplayDelayTime>0?this.widthOrHeightChangeReplayDelayTimeout=setTimeout((()=>{this.widthOrHeightChangeReplayDelayTimeout=null,this.isDestroyed()?this.debug&&this.debugLog("JbPro","mseWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):this.play(e,s).then((()=>{this.debugLog("JbPro","mseWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.mseWidthOrHeightChangeOnLock=!1}))}),1e3*this.player._opt.widthOrHeightChangeReplayDelayTime):this.play(e,s).then((()=>{this.debugLog("JbPro","mseWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.mseWidthOrHeightChangeOnLock=!1}))})).catch((e=>{this.mseWidthOrHeightChangeOnLock=!1,this.emit(at.playFailedAndPaused,dt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(at.playFailedAndPaused,dt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange and _resetPlayer error",e)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mseWidthOrHeightChange,i,t),this.debugError("JbPro","mseWidthOrHeightChange error and pause error",e)})).finally((()=>{this.mseWidthOrHeightChangeOnLock=!1}))}}_handleMediaSourceAudioG711NotSupport(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceAudioG711NotSupport but player is destroyed"));if(this.mediaSourceAudioG711NotSupportOnLock)return void this.debugLog("JbPro","mediaSourceAudioG711NotSupportOnLock is true");const i=this._getVideoLastIframeInfo();if(this.mediaSourceAudioG711NotSupportOnLock=!0,this.player&&this.player._opt.mediaSourceAudioG711NotSupportReplay){this.debugLog("JbPro","mediaSourceAudioG711NotSupport and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","mediaSourceAudioG711NotSupport and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAudioG711NotSupport,i,t),this.debugError("JbPro","mediaSourceAudioG711NotSupport and reset player and play error",e)})).finally((()=>{this.mediaSourceAudioG711NotSupportOnLock=!1}))})).catch((e=>{this.mediaSourceAudioG711NotSupportOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceAudioG711NotSupport,i,t),this.debugError("JbPro","mediaSourceAudioG711NotSupport and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAudioG711NotSupport,i,t),this.debugError("JbPro","mediaSourceAudioG711NotSupport and _resetPlayer error",e)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAudioG711NotSupport,i,t),this.debugError("JbPro","mediaSourceAudioG711NotSupport error and pause error",e)})).finally((()=>{this.mediaSourceAudioG711NotSupportOnLock=!1}))}}_handleMediaSourceAudioInitTimeout(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceAudioInitTimeout but player is destroyed"));if(this.mediaSourceAudioInitTimeoutOnLock)return void this.debugLog("JbPro","mediaSourceAudioInitTimeoutOnLock is true");const i=this._getVideoLastIframeInfo();if(this.mediaSourceAudioInitTimeoutOnLock=!0,this.player&&this.player._opt.mediaSourceAudioInitTimeoutReplay){this.debugLog("JbPro","mediaSourceAudioInitTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","mediaSourceAudioInitTimeout and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAudioInitTimeout,i,t),this.debugError("JbPro","mediaSourceAudioInitTimeout and reset player and play error",e)})).finally((()=>{this.mediaSourceAudioInitTimeoutOnLock=!1}))})).catch((e=>{this.mediaSourceAudioInitTimeoutOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceAudioInitTimeout,i,t),this.debugError("JbPro","mediaSourceAudioInitTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAudioInitTimeout,i),this.debugError("JbPro","mediaSourceAudioInitTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAudioInitTimeout,i),this.debugError("JbPro","mediaSourceAudioInitTimeout error and pause error",e)})).finally((()=>{this.mediaSourceAudioInitTimeoutOnLock=!1}))}}_handleMediaSourceAudioNoDataTimeout(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mediaSourceAudioNoDataTimeout but player is destroyed"));if(this.mediaSourceAudioNoDataTimeoutOnLock)return void this.debugLog("JbPro","mediaSourceAudioNoDataTimeoutOnLock is true");const i=this._getVideoLastIframeInfo();if(this.mediaSourceAudioNoDataTimeoutOnLock=!0,this.player&&this.player._opt.mediaSourceAudioNoDataTimeoutReplay){this.debugLog("JbPro","mediaSourceAudioNoDataTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","mediaSourceAudioNoDataTimeout and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAudioNoDataTimeout,i,t),this.debugError("JbPro","mediaSourceAudioNoDataTimeout and reset player and play error",e)})).finally((()=>{this.mediaSourceAudioNoDataTimeoutOnLock=!1}))})).catch((e=>{this.mediaSourceAudioNoDataTimeoutOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceAudioNoDataTimeout,i,t),this.debugError("JbPro","mediaSourceAudioNoDataTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAudioNoDataTimeout,i),this.debugError("JbPro","mediaSourceAudioNoDataTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mediaSourceAudioNoDataTimeout,i),this.debugError("JbPro","mediaSourceAudioNoDataTimeout error and pause error",e)})).finally((()=>{this.mediaSourceAudioNoDataTimeoutOnLock=!1}))}}_handleMseWorkerAddSourceBufferError(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","mseWorkerAddSourceBufferError but player is destroyed"));if(this.mseWorkerAddSourceBufferErrorOnLock)return void this.debugLog("JbPro","mseWorkerAddSourceBufferErrorOnLock is true");const i=this._getVideoLastIframeInfo();if(this.mseWorkerAddSourceBufferErrorOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","mseWorkerAddSourceBufferError and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecoderUseWorker:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","mseWorkerAddSourceBufferError and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mseWorkerAddSourceBufferError,i,t),this.debugError("JbPro","mseWorkerAddSourceBufferError and reset player and play error",e)})).finally((()=>{this.mseWorkerAddSourceBufferErrorOnLock=!1}))})).catch((e=>{this.mseWorkerAddSourceBufferErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.mseWorkerAddSourceBufferError,i,t),this.debugError("JbPro","mseWorkerAddSourceBufferError and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.mseWorkerAddSourceBufferError,i),this.debugError("JbPro","mseWorkerAddSourceBufferError and _resetPlayer error",e)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.mseWorkerAddSourceBufferError,i),this.debugError("JbPro","mseWorkerAddSourceBufferError error and pause error",e)})).finally((()=>{this.mseWorkerAddSourceBufferErrorOnLock=!1}))}}_handleMediaSourceUseCanvasRenderPlayFailed(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","mediaSourceUseCanvasRenderPlayFailed but player is destroyed");else if(this.mediaSourceUseCanvasRenderPlayFailedOnLock)this.debugLog("JbPro","mediaSourceUseCanvasRenderPlayFailedOnLock is true");else if(this.emit(at.crashLog,this.getCrashLog(dt.mediaSourceUseCanvasRenderPlayFailed,e)),this.mediaSourceUseCanvasRenderPlayFailedOnLock=!0,this.player&&this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplay&&this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType){this.debugLog("JbPro",`mediaSourceUseCanvasRenderPlayFailed relayType is ${this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType} and reset player and play`);const t=this._opt.url,i=this._opt.playOptions;let s={};const r=this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType;r===H?s={useMSE:!1,useWCS:!1}:r===J&&(s={useVideoRender:!0,useCanvasRender:!1}),this._resetPlayer(s).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","mediaSourceUseCanvasRenderPlayFailed and reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.mediaSourceUseCanvasRenderPlayFailed,e),this.debugError("JbPro","mediaSourceUseCanvasRenderPlayFailed and reset player and play error",t)})).finally((()=>{this.mediaSourceUseCanvasRenderPlayFailedOnLock=!1}))})).catch((t=>{this.mediaSourceUseCanvasRenderPlayFailedOnLock=!1,this.emit(at.playFailedAndPaused,dt.mediaSourceUseCanvasRenderPlayFailed,e),this.debugError("JbPro","mediaSourceUseCanvasRenderPlayFailed auto and _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.debugLog("JbPro","mediaSourceUseCanvasRenderPlayFailed and pause player success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.mediaSourceUseCanvasRenderPlayFailed,e),this.debugError("JbPro","mediaSourceUseCanvasRenderPlayFailed and pause",t)})).finally((()=>{this.mediaSourceUseCanvasRenderPlayFailedOnLock=!1}))}}_handleWebcodecsH265NotSupport(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","webcodecsH265NotSupport but player is destroyed");else if(this.webcodecsH265NotSupportOnLock)this.debugLog("JbPro","webcodecsH265NotSupportOnLock is true");else if(this.emit(at.crashLog,this.getCrashLog(dt.webcodecsH265NotSupport,e)),this.webcodecsH265NotSupportOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.webcodecsH265NotSupport,e),this.debugError("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play error",t)})).finally((()=>{this.webcodecsH265NotSupportOnLock=!1}))})).catch((e=>{this.webcodecsH265NotSupportOnLock=!1,this.debugError("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] _resetPlayer and play error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.webcodecsH265NotSupport,e),this.debugLog("JbPro","webcodecsH265NotSupport and autoWasm is false")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.webcodecsH265NotSupport,e),this.debugError("JbPro","webcodecsH265NotSupport and pause error",t)})).finally((()=>{this.webcodecsH265NotSupportOnLock=!1}))}}_handleWebcodecsUnsupportedConfigurationError(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","webcodecsUnsupportedConfigurationError but player is destroyed");else if(this.webcodecsUnsupportedConfigurationErrorOnLock)this.debugLog("JbPro","webcodecsUnsupportedConfigurationErrorOnLock is true");else if(this.emit(at.crashLog,this.getCrashLog(dt.webcodecsUnsupportedConfigurationError,e)),this.webcodecsUnsupportedConfigurationErrorOnLock=!0,this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.webcodecsUnsupportedConfigurationError,e),this.debugError("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play error",t)})).finally((()=>{this.webcodecsUnsupportedConfigurationErrorOnLock=!1}))})).catch((t=>{this.webcodecsUnsupportedConfigurationErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.webcodecsUnsupportedConfigurationError,e),this.debugError("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.webcodecsUnsupportedConfigurationError,e),this.debugLog("JbPro","webcodecsUnsupportedConfigurationError and autoWasm is false")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.webcodecsUnsupportedConfigurationError,e),this.debugError("JbPro","webcodecsUnsupportedConfigurationError and pause error",t)})).finally((()=>{this.webcodecsUnsupportedConfigurationErrorOnLock=!1}))}}_handleWebcodecsDecodeConfigureError(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","webcodecsDecodeConfigureError but player is destroyed");else if(this.webcodecsDecodeConfigureErrorOnLock)this.debugLog("JbPro","webcodecsDecodeConfigureErrorOnLock is true");else if(this.emit(at.crashLog,this.getCrashLog(dt.webcodecsDecodeConfigureError,e)),this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debugLog("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.webcodecsDecodeConfigureError,e),this.debugError("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play error",t)})).finally((()=>{this.webcodecsDecodeConfigureErrorOnLock=!1}))})).catch((t=>{this.webcodecsDecodeConfigureErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.webcodecsDecodeConfigureError,e),this.debugError("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.webcodecsDecodeConfigureError,e),this.debugLog("JbPro","webcodecsDecodeConfigureError and autoWasm is false")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.webcodecsDecodeConfigureError,e),this.debugError("JbPro","webcodecsDecodeConfigureError and pause error",t)})).finally((()=>{this.webcodecsDecodeConfigureErrorOnLock=!1}))}}_handleWebcodecsDecodeError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webcodecsDecodeError but player is destroyed"));if(this.webcodecsDecodeErrorOnLock)return void this.debugLog("JbPro","webcodecsDecodeErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.webcodecsDecodeError,e));const t=this._getVideoLastIframeInfo();if(this.webcodecsDecodeErrorOnLock=!0,this.player&&this.player._opt.wcsDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},o=this.player._opt.decoderErrorAutoWasm,a=!0;o?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(_r)?this._wcsDecodeErrorRetryLog.push(oo()):(o=!0,a=!1,r={useMSE:!1,useWCS:!1}),this.debugLog("JbPro",`webcodecs decode error autoWasm ${Aa(a)?" and is not meaningful Retry":""} [wcs-> ${o?"wasm":"wcs"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","webcodecs decode error reset player and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.webcodecsDecodeError,t,e),this.debugError("JbPro","webcodecs decode error reset player and play error",i)})).finally((()=>{this.webcodecsDecodeErrorOnLock=!1}))})).catch((()=>{this.webcodecsDecodeErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.webcodecsDecodeError,t,e),this.debugError("JbPro","webcodecs decode error _resetPlayer error")}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.webcodecsDecodeError,t,e),this.debugLog("JbPro","webcodecs decode error and autoWasm is false")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.webcodecsDecodeError,t,e),this.debugError("JbPro","webcodecs decode error and pause error",i)})).finally((()=>{this.webcodecsDecodeErrorOnLock=!1}))}}_handleWcsWidthOrHeightChange(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","wcsWidthOrHeightChange but player is destroyed"));if(this.wcsWidthOrHeightChangeOnLock)return void this.debugLog("JbPro","wcsWidthOrHeightChangeOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.wcsWidthOrHeightChange,t));const i=this._getVideoLastIframeInfo();if(this.wcsWidthOrHeightChangeOnLock=!0,this.player&&this.player._opt.widthOrHeightChangeReplay){this.debugLog("JbPro","wcsWidthOrHeightChange and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._opt.widthOrHeightChangeReplayDelayTime>0?this.widthOrHeightChangeReplayDelayTimeout=setTimeout((()=>{this.widthOrHeightChangeReplayDelayTimeout=null,this.isDestroyed()?this.debug&&this.debugLog("JbPro","wcsWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):this.play(e,s).then((()=>{this.debugLog("JbPro","wcsWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.wcsWidthOrHeightChangeOnLock=!1}))}),1e3*this._opt.widthOrHeightChangeReplayDelayTime):this.play(e,s).then((()=>{this.debugLog("JbPro","wcsWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.wcsWidthOrHeightChangeOnLock=!1}))})).catch((e=>{this.wcsWidthOrHeightChangeOnLock=!1,this.emit(at.playFailedAndPaused,dt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(at.playFailedAndPaused,dt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange and _resetPlayer error",e)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.wcsWidthOrHeightChange,i,t),this.debugError("JbPro","wcsWidthOrHeightChange error and pause error",e)})).finally((()=>{this.wcsWidthOrHeightChangeOnLock=!1}))}}_handleWebcodecsAudioNoDataTimeout(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webcodecsAudioNoDataTimeout but player is destroyed"));if(this.webcodecsAudioNoDataTimeoutOnLock)return void this.debugLog("JbPro","webcodecsAudioNoDataTimeoutOnLock is true");const i=this._getVideoLastIframeInfo();if(this.webcodecsAudioNoDataTimeoutOnLock=!0,this.player&&this.player._opt.webcodecsAudioNoDataTimeoutReplay){this.debugLog("JbPro","webcodecsAudioNoDataTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={wcsDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","webcodecsAudioNoDataTimeout and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.webcodecsAudioNoDataTimeout,i,t),this.debugError("JbPro","webcodecsAudioNoDataTimeout and reset player and play error",e)})).finally((()=>{this.webcodecsAudioNoDataTimeoutOnLock=!1}))})).catch((e=>{this.webcodecsAudioNoDataTimeoutOnLock=!1,this.emit(at.playFailedAndPaused,dt.webcodecsAudioNoDataTimeout,i,t),this.debugError("JbPro","webcodecsAudioNoDataTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.webcodecsAudioNoDataTimeout,i),this.debugError("JbPro","webcodecsAudioNoDataTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.webcodecsAudioNoDataTimeout,i),this.debugError("JbPro","webcodecsAudioNoDataTimeout error and pause error",e)})).finally((()=>{this.webcodecsAudioNoDataTimeoutOnLock=!1}))}}_handleWebcodecsAudioInitTimeout(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webcodecsAudioInitTimeout but player is destroyed"));if(this.webcodecsAudioInitTimeoutOnLock)return void this.debugLog("JbPro","webcodecsAudioInitTimeoutOnLock is true");const i=this._getVideoLastIframeInfo();if(this.webcodecsAudioInitTimeoutOnLock=!0,this.player&&this.player._opt.webcodecsAudioInitTimeoutReplay){this.debugLog("JbPro","webcodecsAudioInitTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={wcsDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debugLog("JbPro","webcodecsAudioInitTimeout and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.webcodecsAudioInitTimeout,i,t),this.debugError("JbPro","webcodecsAudioInitTimeout and reset player and play error",e)})).finally((()=>{this.webcodecsAudioInitTimeoutOnLock=!1}))})).catch((e=>{this.webcodecsAudioInitTimeoutOnLock=!1,this.emit(at.playFailedAndPaused,dt.webcodecsAudioInitTimeout,i,t),this.debugError("JbPro","webcodecsAudioInitTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.webcodecsAudioInitTimeout,i),this.debugError("JbPro","webcodecsAudioInitTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.webcodecsAudioInitTimeout,i),this.debugError("JbPro","webcodecsAudioInitTimeout error and pause error",e)})).finally((()=>{this.webcodecsAudioInitTimeoutOnLock=!1}))}}_handleSimdDecodeError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","simdDecodeError but player is destroyed"));if(this.simdDecodeErrorOnLock)return void this.debugLog("JbPro","simdDecodeErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.simdDecodeError,e));const t=this._getVideoLastIframeInfo();if(this.simdDecodeErrorOnLock=!0,this.player&&this.player._opt.simdDecodeErrorReplay){this.debugLog("JbPro",`simdDecodeError error simdDecodeErrorReplayType is ${this.player._opt.simdDecodeErrorReplayType} and reset player and play`);const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.simdDecodeErrorReplayType===j&&(r={useSIMD:!1}),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","simdDecodeError and reset player and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.simdDecodeError,t,e),this.debugError("JbPro","simdDecodeError and reset player and play error",i)})).finally((()=>{this.simdDecodeErrorOnLock=!1}))})).catch((i=>{this.simdDecodeErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.simdDecodeError,t,e),this.debugError("JbPro","simdDecodeError and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.simdDecodeError,t,e),this.debugError("JbPro","simdDecodeError and simdDecodeErrorReplay is false")})).catch((i=>{this.emit(at.playFailedAndPaused,dt.simdDecodeError,t,e),this.debugError("JbPro","simdDecodeError error and pause error",i)})).finally((()=>{this.simdDecodeErrorOnLock=!1}))}}_handleWasmWidthOrHeightChange(t){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","wasmWidthOrHeightChange but player is destroyed"));if(this.wasmWidthOrHeightChangeOnLock)return void this.debugLog("JbPro","wasmWidthOrHeightChangeOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.wasmWidthOrHeightChange,t));const i=this._getVideoLastIframeInfo();if(this.wasmWidthOrHeightChangeOnLock=!0,this.player&&this.player._opt.widthOrHeightChangeReplay){this.debugLog("JbPro","wasmWidthOrHeightChange and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._opt.widthOrHeightChangeReplayDelayTime>0?this.widthOrHeightChangeReplayDelayTimeout=setTimeout((()=>{this.widthOrHeightChangeReplayDelayTimeout=null,this.isDestroyed()?this.debug&&this.debugLog("JbPro","wasmWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):this.play(e,s).then((()=>{this.debugLog("JbPro","wasmWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.wasmWidthOrHeightChange,i,t),this.debugError("JbPro","wasmWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.wasmWidthOrHeightChangeOnLock=!1}))}),1e3*this._opt.widthOrHeightChangeReplayDelayTime):this.play(e,s).then((()=>{this.debugLog("JbPro","wasmWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(at.playFailedAndPaused,dt.wasmWidthOrHeightChange,i,t),this.debugError("JbPro","wasmWidthOrHeightChange and reset player and play error",e)})).finally((()=>{this.wasmWidthOrHeightChangeOnLock=!1}))})).catch((e=>{this.wasmWidthOrHeightChangeOnLock=!1,this.emit(at.playFailedAndPaused,dt.wasmWidthOrHeightChange,i,t),this.debugError("JbPro","wasmWidthOrHeightChange and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(at.playFailedAndPaused,dt.wasmWidthOrHeightChange,i,t),this.debugError("JbPro","wasmWidthOrHeightChange and _resetPlayer error",e)})).catch((e=>{this.emit(at.playFailedAndPaused,dt.wasmWidthOrHeightChange,i),this.debugError("JbPro","wasmWidthOrHeightChange error and pause error",e)})).finally((()=>{this.wasmWidthOrHeightChangeOnLock=!1}))}}_handleWasmUseVideoRenderError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","wasmUseVideoRenderError but player is destroyed"));if(this.wasmUseVideoRenderErrorOnLock)return void this.debugLog("JbPro","wasmUseVideoRenderErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.wasmUseVideoRenderError,e)),this.debugLog("JbPro","wasmUseVideoRenderError and reset player and play");const t=this._opt.url,i=this._opt.playOptions;this.wasmUseVideoRenderErrorOnLock=!0,this._resetPlayer({useVideoRender:!1,useCanvasRender:!0}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","wasmUseVideoRenderError and reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.wasmUseVideoRenderError,{},e),this.debugError("JbPro","wasmUseVideoRenderError and reset player and play error",t)})).finally((()=>{this.wasmUseVideoRenderErrorOnLock=!1}))})).catch((t=>{this.wasmUseVideoRenderErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.wasmUseVideoRenderError,{},e),this.debugError("JbPro","wasmUseVideoRenderError and _resetPlayer error",t)}))}_handleVideoElementPlayingFailed(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","videoElementPlayingFailed but player is destroyed"));if(this.videoElementPlayingFailedOnLock)return void this.debugLog("JbPro","videoElementPlayingFailedOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.videoElementPlayingFailed,e));const t=this._getVideoLastIframeInfo();if(this.videoElementPlayingFailedOnLock=!0,this.player&&this.player._opt.videoElementPlayingFailedReplay){this.debugLog("JbPro",`videoElementPlayingFailed and useMSE is ${this._opt.useMSE} and reset player and play`);const i=this._opt.url,s=this._opt.playOptions;let r={useMSE:!1,useVideoRender:!1,useCanvasRender:!0};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","videoElementPlayingFailed and reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.videoElementPlayingFailed,{},e),this.debugError("JbPro","videoElementPlayingFailed and reset player and play error",t)})).finally((()=>{this.videoElementPlayingFailedOnLock=!1}))})).catch((t=>{this.videoElementPlayingFailedOnLock=!1,this.emit(at.playFailedAndPaused,dt.videoElementPlayingFailed,{},e),this.debugError("JbPro","videoElementPlayingFailed and _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.videoElementPlayingFailed,{},e),this.debugError("JbPro","videoElementPlayingFailed and videoElementPlayingFailedReplay is false")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.videoElementPlayingFailed,{},e),this.debugError("JbPro","videoElementPlayingFailed and _pause error",t)})).finally((()=>{this.videoElementPlayingFailedOnLock=!1}))}}_handleSimdH264DecodeVideoWidthIsTooLarge(e){if(this.isDestroyed())this.debug&&this.debugLog("JbPro","simdH264DecodeVideoWidthIsTooLarge but player is destroyed");else if(this.simdH264DecodeVideoWidthIsTooLargeOnLock)this.debugLog("JbPro","simdH264DecodeVideoWidthIsTooLargeOnLock is true");else if(this.emit(at.crashLog,this.getCrashLog(dt.simdH264DecodeVideoWidthIsTooLarge,e)),this.simdH264DecodeVideoWidthIsTooLargeOnLock=!0,this.player&&this.player._opt.simdH264DecodeVideoWidthIsTooLargeReplay){this.debugLog("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useSIMD:!1}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debugError("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play error",t)})).finally((()=>{this.simdH264DecodeVideoWidthIsTooLargeOnLock=!1}))})).catch((t=>{this.simdH264DecodeVideoWidthIsTooLargeOnLock=!1,this.emit(at.playFailedAndPaused,dt.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debugError("JbPro","simdH264DecodeVideoWidthIsTooLarge and _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debugError("JbPro","simdH264DecodeVideoWidthIsTooLarge and simdDecodeErrorReplay is false")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debugError("JbPro","simdH264DecodeVideoWidthIsTooLarge and pause error",t)})).finally((()=>{this.simdH264DecodeVideoWidthIsTooLargeOnLock=!1}))}}_handleNetworkDelayTimeout(e){if(this.player._opt.networkDelayTimeoutReplay){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","networkDelayTimeout but player is destroyed"));if(this.networkDelayTimeoutOnLock)return void this.debugLog("JbPro","networkDelayTimeoutOnLock is true");this.emit(at.crashLog,this.getCrashLog(at.networkDelayTimeout,e));const t=this._getVideoLastIframeInfo();this.debugLog("JbPro","network delay time out and reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player&&this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this.networkDelayTimeoutOnLock=!0,this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog("JbPro","wasm decode error and reset player and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,at.networkDelayTimeout,t,e),this.debugError("JbPro","wasm decode error and reset player and play error",i)})).finally((()=>{this.networkDelayTimeoutOnLock=!1}))})).catch((()=>{this.networkDelayTimeoutOnLock=!1,this.emit(at.playFailedAndPaused,at.networkDelayTimeout,t,e),this.debugError("JbPro","wasm decode error and _resetPlayer error")}))}}_handleFlvDemuxBufferSizeTooLarge(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","flvDemuxBufferSizeTooLarge but player is destroyed"));if(this.flvDemuxBufferSizeTooLargeOnLock)return void this.debugLog("JbPro","flvDemuxBufferSizeTooLargeOnLock is true");const t=this._getVideoLastIframeInfo();if(this.flvDemuxBufferSizeTooLargeOnLock=!0,this.player._opt.flvDemuxBufferSizeTooLargeReplay){this.emit(at.crashLog,this.getCrashLog(at.flvDemuxBufferSizeTooLarge,e)),this.debugLog("JbPro","flv Demux Buffer Size Too Large and flvDemuxBufferSizeTooLargeReplay = true and reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player&&this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debugLog(this.TAG_NAME,"flv Demux Buffer Size Too Large and reset player and play success")})).catch((i=>{this.emit(at.playFailedAndPaused,at.flvDemuxBufferSizeTooLarge,t,e),this.debugError(this.TAG_NAME,"flv Demux Buffer Size Too Large and reset player and play error",i)})).finally((()=>{this.flvDemuxBufferSizeTooLargeOnLock=!1}))})).catch((()=>{this.flvDemuxBufferSizeTooLargeOnLock=!1,this.emit(at.playFailedAndPaused,at.flvDemuxBufferSizeTooLarge,t,e),this.debugError(this.TAG_NAME,"flv Demux Buffer Size Too Large and _resetPlayer error")}))}else if(this._opt.flvDemuxBufferSizeTooLargeEmitFailed){this.debugLog(this.TAG_NAME,"flv Demux Buffer Size Too Large and flvDemuxBufferSizeTooLargeEmitFailed = true and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.flvDemuxBufferSizeTooLarge,t,e)})).catch((i=>{this.emit(at.playFailedAndPaused,dt.flvDemuxBufferSizeTooLarge,t,e),this.debugError(this.TAG_NAME,"flv Demux Buffer Size Too Large",i)})).finally((()=>{this.flvDemuxBufferSizeTooLargeOnLock=!1}))}}_handleFetchError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","fetchError but player is destroyed"));if(this.fetchErrorOnLock)return void this.debugLog("JbPro","fetchErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.fetchError,e));const t=this._getVideoLastIframeInfo(),i=this._isNeedNetworkDisconnectReplay();if(this.fetchErrorOnLock=!0,this.player._opt.streamErrorReplay||i){i?this.debugLog("JbPro","fetch error and network is disconnect and reset player and play"):this.debugLog("JbPro",`fetch error and streamErrorReplay is true and _streamErrorReplayTimes is ${this._streamErrorReplayTimes}, streamErrorReplayDelayTime is ${this._opt.streamErrorReplayDelayTime}, next replay`);let s={};this.player._opt.replayUseLastFrameShow&&(s=Object.assign({},s,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(s.isNotMute=!0);const r=this._opt.playOptions,o=this._opt.url,a=i?1:this._opt.streamErrorReplayDelayTime;this._resetPlayer(s).then((()=>{this.streamErrorReplayDelayTimeout=setTimeout((()=>{if(this.streamErrorReplayDelayTimeout=null,this.isDestroyed())this.debug&&this.debugLog("JbPro","fetch error and _resetPlayer but player is destroyed and return");else{if(this._isNeedNetworkDisconnectReplay())return this.debugLog("JbPro","fetch error and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:o,options:r,type:dt.fetchError});this._streamErrorReplayTimes++,this.play(o,r).then((()=>{this.debugLog("JbPro","fetch error and reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.fetchError,{},e),this.debugError("JbPro","fetch error and reset player and play error",t)})).finally((()=>{this.fetchErrorOnLock=!1}))}}),1e3*a)})).catch((t=>{this.fetchErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.fetchError,{},e),this.debugError("JbPro","fetch error and _resetPlayer error",t)}))}else{this.debugLog("JbPro","fetch error and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.fetchError,t,e)})).catch((i=>{this.emit(at.playFailedAndPaused,dt.fetchError,t,e),this.debugError("JbPro","fetch error and pause",i)})).finally((()=>{this.fetchErrorOnLock=!1}))}}_handleStreamEnd(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","streamEnd but player is destroyed and return"));if(this.streamEndOnLock)return void this.debugLog("JbPro","streamEndOnLock is true");this.emit(at.crashLog,this.getCrashLog(at.streamEnd,e));const t=this._getVideoLastIframeInfo(),i=""+e=="1006"&&this.player._opt.websocket1006ErrorReplay,s=!!i&&this._checkIsMeaningfulRetry(br),r=i&&s,o=this.player._opt.streamEndReplay,a=this._isNeedNetworkDisconnectReplay();if(this.streamEndOnLock=!0,r||o||a){a?this.debugLog("JbPro","streamEnd and network is disconnect and reset player and play"):r?this.debugLog("JbPro",`streamEnd and websocket1006ErrorReplay is true and error is 1006 and _websocket1006ErrorReplayTimes is ${this._websocket1006ErrorReplayTimes} , delay ${this._opt.websocket1006ErrorReplayDelayTime}s reset player and play`):this.debugLog("JbPro",`streamEnd and isStreamEndReplay is true and and _streamEndReplayTimes is ${this._streamEndReplayTimes} , delay ${this._opt.streamEndReplayDelayTime}s reset player and play`);const s=this._opt.playOptions,o=this._opt.url;i&&this._websocket1006ErrorRetryLog.push(oo());let n={};this.player._opt.replayUseLastFrameShow&&(n=Object.assign({},n,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(n.isNotMute=!0);let l=r?this._opt.websocket1006ErrorReplayDelayTime:this._opt.streamEndReplayDelayTime;a&&(l=1),this._initLoadingBackgroundForIOS(t),this._resetPlayer(n).then((()=>{this.streamEndReplayDelayTimeout=setTimeout((()=>{if(this.streamEndReplayDelayTimeout=null,this._removeLoadingBackgroundForIOS(),this.isDestroyed())a?this.debug&&this.debugLog("JbPro","streamEnd and network is disconnect and _resetPlayer() but player is destroyed and return"):r?this.debug&&this.debugLog("JbPro","streamEnd and 1006 error and _resetPlayer() but player is destroyed and return"):this.debug&&this.debugLog("JbPro","streamEnd and _resetPlayer() but player is destroyed and return");else{if(this._isNeedNetworkDisconnectReplay())return r?this.debugLog("JbPro","streamEnd and 1006 error network is offline and wait network online to play , so return"):this.debugLog("JbPro","streamEnd and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:o,options:s,type:r?dt.websocket1006Error:dt.streamEnd});r?this._websocket1006ErrorReplayTimes++:this._streamEndReplayTimes++,this.play(o,s).then((()=>{r?this.debugLog("JbPro","streamEnd and 1006 error and reset player and play success"):this.debugLog("JbPro","streamEnd and reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.streamEnd,{},e),r?this.debugError("JbPro","streamEnd and 1006 error and reset player and play error",t):this.debugError("JbPro","streamEnd and reset player and play error",t)})).finally((()=>{this.streamEndOnLock=!1}))}}),1e3*l)})).catch((t=>{this.streamEndOnLock=!1,this.emit(at.playFailedAndPaused,dt.streamEnd,{},e),r?this.debugError("JbPro","streamEnd and 1006 and _resetPlayer error",t):this.debugError("JbPro","streamEnd and _resetPlayer error",t)}))}else{i?this.debugLog("JbPro","streamEnd pause player "+(Aa(s)?"and is not meaningful retry":"")):this.debugLog("JbPro","streamEnd pause player");const r=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(r).then((()=>{this.emit(at.playFailedAndPaused,at.streamEnd,t,e)})).catch((i=>{this.emit(at.playFailedAndPaused,at.streamEnd,t,e),this.debugError("JbPro","streamEnd pause",i)})).finally((()=>{this.streamEndOnLock=!1}))}}_handleWebsocketError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","websocketError but player is destroyed"));if(this.websocketErrorOnLock)return void this.debugLog("JbPro","websocketErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.websocketError,e));const t=this._getVideoLastIframeInfo(),i=this._isNeedNetworkDisconnectReplay();if(this.websocketErrorOnLock=!0,this.player._opt.streamErrorReplay||i){i?this.debugLog("JbPro","websocketError error and network is disconnect and reset player and play"):this.debugLog("JbPro",`websocketError error and streamErrorReplay is true and _streamErrorReplayTimes is ${this._streamErrorReplayTimes} and streamErrorReplayDelayTime is ${this._opt.streamErrorReplayDelayTime}, next replay`);let s={};this.player._opt.replayUseLastFrameShow&&(s=Object.assign({},s,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(s.isNotMute=!0);const r=this._opt.playOptions,o=this._opt.url,a=i?1:this._opt.streamErrorReplayDelayTime;this._resetPlayer(s).then((()=>{this.streamErrorReplayDelayTimeout=setTimeout((()=>{if(this.streamErrorReplayDelayTimeout=null,this.isDestroyed())i?this.debug&&this.debugLog("JbPro","websocketError error and network is disconnect and _resetPlayer() but player is destroyed and return"):this.debug&&this.debugLog("JbPro","websocketError error and _resetPlayer() but player is destroyed and return");else{if(this._isNeedNetworkDisconnectReplay())return this.debugLog("JbPro","websocketError error and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:o,options:r,type:dt.websocketError});this._streamErrorReplayTimes++,this.play(o,r).then((()=>{this.debugLog("JbPro","websocketError error and reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,dt.fetchError,{},e),this.debugError("JbPro","websocketError error and reset player and play error",t)})).finally((()=>{this.websocketErrorOnLock=!1}))}}),1e3*a)})).catch((t=>{this.websocketErrorOnLock=!1,this.emit(at.playFailedAndPaused,dt.fetchError,{},e),this.debugError("JbPro","websocketError error and _resetPlayer error",t)}))}else{this.debugLog("JbPro","websocketError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.websocketError,t,e)})).catch((i=>{this.emit(at.playFailedAndPaused,dt.websocketError,t,e),this.debugError("JbPro","websocketError and pause",i)})).finally((()=>{this.websocketErrorOnLock=!1}))}}_handleWebrtcError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webrtcError but player is destroyed"));if(this.webrtcErrorOnLock)return void this.debugLog("JbPro","webrtcErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.webrtcError,e));const t=this._getVideoLastIframeInfo();if(this._isNeedNetworkDisconnectReplay()){this.debugLog("JbPro","webrtcError error and network is offline and wait network online to play , so _resetPlayer and wait play");const i=this._opt.playOptions,s=this._opt.url;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._isNetworkOfflinePaused=!0,this._isNetworkOfflinePausedAndNextPlayConfig={url:s,options:i,type:dt.webrtcError}})).catch((()=>{this.emit(at.playFailedAndPaused,dt.webrtcError,t,e),this.debugError("JbPro","webrtcError and _resetPlayer error")})).finally((()=>{this.webrtcErrorOnLock=!1}))}else{this.debugLog("JbPro","webrtcError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.webrtcErrorOnLock=!0,this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.webrtcError,t,e)})).catch((i=>{this.emit(at.playFailedAndPaused,dt.webrtcError,t,e),this.debugError("JbPro","webrtcError and pause",i)})).finally((()=>{this.webrtcErrorOnLock=!1}))}}_handleHlsError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","hlsError but player is destroyed"));if(this.hlsErrorOnLock)return void this.debugLog("JbPro","hlsErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.hlsError,e));const t=this._getVideoLastIframeInfo();if(this._isNeedNetworkDisconnectReplay()){this.debugLog("JbPro","hlsError error and network is offline and wait network online to play , so _resetPlayer and wait play");const i=this._opt.playOptions,s=this._opt.url;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),Aa(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._isNetworkOfflinePaused=!0,this._isNetworkOfflinePausedAndNextPlayConfig={url:s,options:i,type:dt.hlsError}})).catch((()=>{this.emit(at.playFailedAndPaused,dt.hlsError,t,e),this.debugError("JbPro","hlsError and _resetPlayer error")})).finally((()=>{this.hlsErrorOnLock=!1}))}else{this.debugLog("JbPro","hlsError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.hlsErrorOnLock=!0,this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.hlsError,t,e)})).catch((i=>{this.emit(at.playFailedAndPaused,dt.hlsError,t,e),this.debugError("JbPro","hlsError and pause",i)})).finally((()=>{this.hlsErrorOnLock=!1}))}}_handleAliyunRtcError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","aliyunRtcError but player is destroyed"));if(this.aliyunRtcErrorOnLock)return void this.debugLog("JbPro","aliyunRtcErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.aliyunRtcError,e));const t=this._getVideoLastIframeInfo();this.debugLog("JbPro","aliyunRtcError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.aliyunRtcErrorOnLock=!0,this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.aliyunRtcError,t,e)})).catch((i=>{this.emit(at.playFailedAndPaused,dt.aliyunRtcError,t,e),this.debugError("JbPro","aliyunRtcError and pause",i)})).finally((()=>{this.aliyunRtcErrorOnLock=!1}))}_handleDecoderWorkerInitError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","decoderWorkerInitError but player is destroyed"));if(this.decoderWorkerInitErrorOnLock)return void this.debugLog("JbPro","decoderWorkerInitErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.decoderWorkerInitError,e));const t=this._getVideoLastIframeInfo();this.debugLog("JbPro","decoderWorkerInitError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.decoderWorkerInitErrorOnLock=!0,this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.decoderWorkerInitError,t,e)})).catch((i=>{this.emit(at.playFailedAndPaused,dt.decoderWorkerInitError,t,e),this.debugError("JbPro","decoderWorkerInitError and pause",i)})).finally((()=>{this.decoderWorkerInitErrorOnLock=!1}))}_handleDecoderWorkerWasmError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","decoderWorkerWasmError but player is destroyed"));if(this.decoderWorkerWasmErrorOnLock)return void this.debugLog("JbPro","decoderWorkerWasmErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.decoderWorkerWasmError,e)),this.debugLog("JbPro","decoderWorkerWasmError and pause player");const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.decoderWorkerWasmErrorOnLock=!0,this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.decoderWorkerWasmError,{},e)})).catch((t=>{this.emit(at.playFailedAndPaused,dt.decoderWorkerWasmError,{},e),this.debugError("JbPro","decoderWorkerWasmError and pause",t)})).finally((()=>{this.decoderWorkerWasmErrorOnLock=!1}))}_handleVideoElementPlayingFailedForWebrtc(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","videoElementPlayingFailedForWebrtc but player is destroyed"));if(this.videoElementPlayingFailedForWebrtcOnLock)return void this.debugLog("JbPro","videoElementPlayingFailedForWebrtcOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.videoElementPlayingFailedForWebrtc,e)),this.debugLog("JbPro","videoElementPlayingFailedForWebrtc and pause player");const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.videoElementPlayingFailedForWebrtcOnLock=!0,this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.videoElementPlayingFailedForWebrtc,{},e)})).catch((t=>{this.emit(at.playFailedAndPaused,dt.videoElementPlayingFailedForWebrtc,{},e),this.debugError("JbPro","videoElementPlayingFailedForWebrtc and pause",t)})).finally((()=>{this.videoElementPlayingFailedForWebrtcOnLock=!1}))}_handleVideoInfoError(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","videoInfoError but player is destroyed"));if(this.videoInfoErrorOnLock)return void this.debugLog("JbPro","videoInfoErrorOnLock is true");this.emit(at.crashLog,this.getCrashLog(dt.videoInfoError,e)),this.debugLog("JbPro","videoInfoError and pause player");const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this.videoInfoErrorOnLock=!0,this._pause(t).then((()=>{this.emit(at.playFailedAndPaused,dt.videoInfoError,{},e)})).catch((t=>{this.emit(at.playFailedAndPaused,dt.videoInfoError,{},e),this.debugError("JbPro","videoInfoError and pause",t)})).finally((()=>{this.videoInfoErrorOnLock=!1}))}_handleWebrtcStreamH265(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","webrtcStreamH265 but player is destroyed"));if(this.webrtcStreamH265OnLock)return void this.debugLog("JbPro","webrtcStreamH265OnLock is true");this.debugLog("JbPro","webrtcStreamH265 and reset player and play");const t=this._opt.url,i=this._opt.playOptions;this.webrtcStreamH265OnLock=!0,this._resetPlayer({isWebrtcH265:!0}).then((()=>{this.play(t,i).then((()=>{this.debugLog("JbPro","webrtcStreamH265 and reset player and play success")})).catch((t=>{this.emit(at.playFailedAndPaused,at.webrtcStreamH265,{},e),this.debugError("JbPro","webrtcStreamH265 and reset player and play error",t)})).finally((()=>{this.webrtcStreamH265OnLock=!1}))})).catch((()=>{this.webrtcStreamH265OnLock=!1,this.emit(at.playFailedAndPaused,at.webrtcStreamH265,{},e),this.debugError("JbPro","webrtcStreamH265 and _resetPlayer error")}))}_handleDelayTimeout(e){if(this.isDestroyed())return void(this.debug&&this.debugWarn("JbPro","delay timeout replay but player is destroyed"));this.emit(at.crashLog,this.getCrashLog(at.delayTimeout,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.heartTimeoutReplay&&(this._heartTimeoutReplayTimes{if(this._isNeedNetworkDisconnectReplay())return this.debugLog("JbPro","delayTimeout and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:i,options:s,type:at.delayTimeout});this.play(i,s).then((()=>{})).catch((i=>{this.emit(at.playFailedAndPaused,at.delayTimeout,t,e),this.debugError("JbPro","delay timeout replay error",i)}))})).catch((i=>{this.emit(at.playFailedAndPaused,at.delayTimeout,t,e),this.debugError("JbPro","delay timeout _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,at.delayTimeout,t,e),this.player&&(this.emit(at.delayTimeoutRetryEnd),this.emit(at.playFailedAndPaused,at.delayTimeoutRetryEnd)),this.debugWarn("JbPro",`delayTimeoutRetryEnd and\n opt.heartTimeout is ${this.player&&this.player._opt.heartTimeout} and\n opt.heartTimeoutReplay is ${this.player&&this.player._opt.heartTimeoutReplay} and\n opt.heartTimeoutReplayTimes is ${this.player&&this.player._opt.heartTimeoutReplayTimes},and\n local._heartTimeoutReplayTimes is ${this._heartTimeoutReplayTimes}`)})).catch((i=>{this.emit(at.playFailedAndPaused,at.delayTimeout,t,e),this.debugError("JbPro","delay timeout and pause error",i)}))}}_handleLoadingTimeout(e){if(this.isDestroyed())return void(this.debug&&this.debugLog("JbPro","loading timeout but player is destroyed"));this.emit(at.crashLog,this.getCrashLog(at.loadingTimeout,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.loadingTimeoutReplay&&(this._loadingTimeoutReplayTimes{if(this._isNeedNetworkDisconnectReplay())return this.debugLog("JbPro","loadingTimeout and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:i,options:s,type:at.loadingTimeout});this.play(i,s).then((()=>{})).catch((i=>{this.emit(at.playFailedAndPaused,at.loadingTimeout,t,e),this.debugError("JbPro","loading timeout replay error",i)}))})).catch((i=>{this.emit(at.playFailedAndPaused,at.loadingTimeout,t,e),this.debugError("JbPro","loading timeout _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,at.loadingTimeout,t,e),this.player&&(this.emit(at.loadingTimeoutRetryEnd),this.emit(at.playFailedAndPaused,at.loadingTimeoutRetryEnd,t,e),this._opt.loadingTimeoutRetryEndShowPlayBtn&&this.player.showPlayBtn()),this.debugLog("JbPro",`loadingTimeoutRetryEnd and\n opt.loadingTimeout is ${this.player&&this.player._opt.loadingTimeout} and\n opt.loadingTimeoutReplay is ${this.player&&this.player._opt.loadingTimeoutReplay} and\n local._loadingTimeoutReplayTimes time is ${this._loadingTimeoutReplayTimes} and\n opt.loadingTimeoutReplayTimes is ${this.player&&this.player._opt.loadingTimeoutReplayTimes}`)})).catch((i=>{this.emit(at.playFailedAndPaused,at.loadingTimeout,t,e),this.debugError("JbPro","loading timeout and pause error",i)}))}}_handleInitDecoderWorkerTimeout(e){if(this.isDestroyed())return void this.debugLog("JbPro","InitDecoderWorkerTimeout but player is destroyed");this.emit(at.crashLog,this.getCrashLog(dt.initDecoderWorkerTimeout,e)),this.debugLog("JbPro","InitDecoderWorkerTimeout and pause player");const t=this._getVideoLastIframeInfo(),i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(at.playFailedAndPaused,dt.initDecoderWorkerTimeout,t,e)})).catch((i=>{this.emit(at.playFailedAndPaused,dt.initDecoderWorkerTimeout,t,e),this.debugError("JbPro","videoInfoError and pause",i)}))}_checkInitDecoderWorkerTimeout(){this._clearInitDecoderWorkerTimeout(),this.initDecoderWorkerTimeout=setTimeout((()=>{this._handleInitDecoderWorkerTimeout(dt.initDecoderWorkerTimeout)}),1e3*this._opt.initDecoderWorkerTimeout)}_clearInitDecoderWorkerTimeout(){this.initDecoderWorkerTimeout&&(clearTimeout(this.initDecoderWorkerTimeout),this.initDecoderWorkerTimeout=null)}debugLog(e){if(this._opt.debug&&this.debug){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s1?t-1:0),s=1;s1?t-1:0),s=1;s0&&void 0!==arguments[0]?arguments[0]:{};super(),this._opt={},Object.keys(e).forEach((t=>{if(void 0===e[t])throw new Error(`jb-pro-multi option "${t}" can not be undefined`)}));const t=pa(Ts);this._opt=Object.assign({},t,e),this.LOG_TAG="jbProMulti";let i=e.container;if("string"==typeof e.container&&(i=document.querySelector(e.container)),!i)throw new Error("Jb-pro-multi need container option");if("CANVAS"===i.nodeName||"VIDEO"===i.nodeName)throw new Error(`Jb-pro-multi container type can not be ${i.nodeName} type`);i.classList.add("jb-pro-multi-container"),delete this._opt.container,this.maxWindowSize=this._opt.maxSplit*this._opt.maxSplit,this.currentWindowIndex=-1,this.currentWindowUuid=null,this.specialLayoutType=null,this.startDragWindowItem=null,this.checkRectInterval=null,this.windowList=[],this.$container=i,this.debug=new Dr(this),this.events=new Da(this),this._opt.split||(this._opt.split=1),ya(this._opt.draggable)?this._initWindows$2():this._initWindows(),this._innerArrangeWindow(this._opt.split,!0),this._initEvents(),this._handleWindowSelect(0),this._listenFullscreenChange()}destroy(){return new Promise(((e,t)=>{if(this.debugLog(this.LOG_TAG,"destroy()"),this.off(),this.events&&(this.events.destroy(),this.events=null),this.checkRectInterval&&(clearInterval(this.checkRectInterval),this.checkRectInterval=null),this.specialLayoutType=null,this.startDragWindowItem=null,this.currentWindowUuid=null,this.currentWindowIndex=-1,this.$container&&(this.$container.classList.remove("jb-pro-multi-container"),this.$container=null),this.windowList){const i=[];this.windowList.forEach((e=>{e.$playerContainerEvents.forEach((e=>{e()})),e.player&&i.push(e.player.destroy())})),Promise.all(i).then((()=>{this.windowList.forEach((e=>{e.player=null})),this.windowList=[],e()})).catch((e=>{t(e)}))}else e();this.debugLog(this.LOG_TAG,"destroy")}))}_createPlayer(e){var t=this;const i=this._findWindowItemIndex(e),s=e.uuid,r=this._opt;r.supportDblclickContainerFullscreen&&(r.supportDblclickFullscreen=!1);const o=new a_({...r,isMulti:!0,multiIndex:i,multiUuid:s,container:e.$player});return Object.keys(nt).forEach((e=>{o.on(nt[e],(function(){for(var i=arguments.length,s=new Array(i),r=0;r{this.emit(at.close,i),e.player=null})),o}_initWindows(){let e="";for(let t=0;t\n
\n
\n \n `;const t=`
${e}
`;this.$container.innerHTML=t;const i=this.$container.querySelectorAll(".jb-pro-multi-player");for(let e=0;e\n
\n
\n \n `;const i=`
\n ${e}\n
`;this.$container.innerHTML=i,this.$multiContainer=this.$container.querySelector(".jb-pro-multi-player-container-v2");const s=this.$container.querySelectorAll(".jb-pro-multi-player");for(let e=0;e{const s=t.$playerContainer,r=e(s,"click",(e=>{e.preventDefault();const t=va(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerClickDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);if(this.emit(ks.selected,i,e),this.getSelectedWindowUuid()===t){if(this._getWindowItem(t).isContainerFullscreen)return}1!==this._opt.split&&this._handleWindowSelect(i)})),o=e(s,"dblclick",(e=>{e.preventDefault();const t=va(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"dblclickDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);this.emit(ks.dblSelected,i,e),this._opt.supportDblclickContainerFullscreen&&1!==this._opt.split&&this._handleWindowContainerFullscreen(i)})),a=e(s,"mouseup",(e=>{const t=va(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerMouseupDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);this.emit(ks.mouseup,i,e)})),n=e(s,"mouseover",(e=>{const t=va(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerMouseoverDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);this.emit(ks.mouseover,i,e)})),l=e(s,"mouseout",(e=>{const t=va(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerMouseoutDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);this.emit(ks.mouseout,i,e)})),d=e(s,"mousedown",(e=>{const t=va(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerMousedownDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);this.emit(ks.mousedown,i,e)})),h=e(s,"dragover",(e=>{e.preventDefault()})),c=e(s,"dragenter",(e=>{const t=va(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerDragEnterDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);this._getWindowItem(t),this.emit(ks.dragenter,i,e,{uuid:t})})),u=e(s,"dragleave",(e=>{const t=va(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerDragLeaveDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);this._getWindowItem(t),this.emit(ks.dragleave,i,e,{uuid:t})})),p=e(s,"drop",(e=>{e.preventDefault();const t=va(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerDropDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t),r={};if(this._opt.draggable&&this.startDragWindowItem){const e=this.startDragWindowItem.$playerContainer,i=this.startDragWindowItem.player,o=this.startDragWindowItem.uuid,a=e.style.order;e.style.order=s.style.order,e.setAttribute("order",e.style.order),s.style.order=a,s.setAttribute("order",a);const n=this.getWindowItem(t);this.debugLog(this.LOG_TAG,`player Drop ${a} -> ${e.style.order}`),this._sortWindows(),r.fromUuid=o,r.toUuid=t,r.fromOrderIndex=So(a),r.toOrderIndex=So(e.style.order),i&&i._updateMultiIndex(So(e.style.order)),n.player&&n.player._updateMultiIndex(So(a))}this.emit(ks.drop,i,e,r)}));if(t.$playerContainerEvents=[r,a,n,l,d,o,h,c,u,p],this._opt.draggable){const i=e(s,"dragstart",(e=>{const t=va(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerDragStartDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);this._handleWindowSelect(i),this.startDragWindowItem=this._getWindowItem(i),this.emit(ks.dragstart,i,e,{uuid:t})}));t.$playerContainerEvents.push(i)}if(this._opt.supportMousemoveEvent){const i=e(s,"mousemove",(e=>{const t=va(s,"uuid");if(!t)return void this.debugError(this.LOG_TAG,"playerMousemoveDestroy() data-uuid is not exist");const i=this._findWindowItemIndexByUuid(t);this.emit(ks.mousemove,i,e)}));t.$playerContainerEvents.push(i)}}))}_getContainerRect(){const e=this.$container.getBoundingClientRect();return{width:parseInt(e.width),height:parseInt(e.height)}}_updateWindows(){const e=this._getContainerRect(),t=e.width,i=e.height,s=this._opt.split,r=t%s,o=i%s,a=(t-r-2*s)/s,n=(i-o-2*s)/s,l=(t-r)/s,d=(i-o)/s;let h=this._getCurrentMaxSplit();for(let e=0;e=Math.pow(s,2)?o:0),f=l+(e%s==s-1?r:0),m=d+(e+s>=Math.pow(s,2)?o:0);i.style.width=f+"px",i.style.height=m+"px",i.style.display="block",c.style.width=u+"px",c.style.height=p+"px",c.style.display="block",h.style.width=u+"px",h.style.height=p+"px",h.style.display="block",t.player&&t.player.resize()}if(this.specialLayoutType){const e=this.windowList[0],t=e.$playerContainer,i=e.$player,s=e.$playerBorder,r=t.style.width.replace("px",""),o=t.style.height.replace("px",""),a=i.style.width.replace("px",""),n=i.style.height.replace("px","");let l,d,c,u;this.specialLayoutType===Ls?(l=2*r,d=2*o,c=2*a+2,u=2*n+2):this.specialLayoutType===Cs&&(l=3*r,d=3*o,c=3*a+4,u=3*n+4),t.style.width=l+"px",t.style.height=d+"px",i.style.width=c+"px",i.style.height=u+"px",s.style.width=c+"px",s.style.height=u+"px",e.player&&e.player.resize(),h=this._getSpecialMaxSplit()}for(let e=h;e{0===t&&no(e.$playerContainer,"display","block"),e.$playerContainer.setAttribute("fullscreen","0"),e.$playerContainer.style.fullscreen="0",e.$playerContainer.draggable=this._opt.split>1}))}_sortWindows(){const e=[];for(let t=0;t1&&(this.windowList.forEach((e=>{t.$playerBorder.style.display="block",e.$playerBorder.style.border=`1px solid ${this._opt.style.border}`})),this._opt.showSelectedBorder&&(t.$playerBorder.style.border=`1px solid ${this._opt.style.borderSelect}`))):this.debugWarn(this.LOG_TAG,`_handleWindowSelect() ${e} is not exist`),1===this._opt.split&&(t.$playerBorder.style.display="none")}_handleWindowContainerFullscreen(e,t){const i=this._getWindowItem(e);if(i){if(Bo(t)&&t===i.isContainerFullscreen)return;if(this._opt.draggable){if(i.isContainerFullscreen){if(i.$playerContainer.setAttribute("fullscreen","0"),i.$playerContainer.style.fullscreen="0",this.specialLayoutType){no(this.windowList[0].$playerContainer,"display","block")}}else if(i.$playerContainer.setAttribute("fullscreen","1"),i.$playerContainer.style.fullscreen="1",this.specialLayoutType){if(0!==this._findWindowItemIndexByUuid(i.uuid)){no(this.windowList[0].$playerContainer,"display","none")}}}else if(i.isContainerFullscreen)i.$playerContainer.style.position="relative",i.$playerContainer.style.left="auto",i.$playerContainer.style.top="auto",i.$playerContainer.style.zIndex="auto",i.$playerContainer.style.width=i.prevInfo.playerContainerWidth,i.$playerContainer.style.height=i.prevInfo.playerContainerHeight,i.$player.style.width=i.prevInfo.playerWidth,i.$player.style.height=i.prevInfo.playerHeight,this.getSelectedWindowUuid()===i.uuid&&(i.$playerBorder.style.display="block");else{const e=this._getContainerRect(),t=e.width,s=e.height;i.prevInfo={playerContainerWidth:i.$playerContainer.style.width,playerContainerHeight:i.$playerContainer.style.height,playerWidth:i.$player.style.width,playerHeight:i.$player.style.height},i.$playerContainer.style.position="absolute",i.$playerContainer.style.top="0",i.$playerContainer.style.left="0",i.$playerContainer.style.zIndex="10",i.$playerContainer.style.width=t+"px",i.$playerContainer.style.height=s+"px",i.$player.style.width=t+"px",i.$player.style.height=s+"px",i.$playerBorder.style.display="none"}i.isContainerFullscreen=!i.isContainerFullscreen,i.player&&i.player.resize()}else this.debugWarn(this.LOG_TAG,`handleWindowContainerFullscreen() ${e} is not exist`)}_handleFullscreenResize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=this._getContainerRect(),i=0;this.checkRectInterval=setInterval((()=>{const s=Ir.isFullscreen,r=this._getContainerRect(),o={width:screen.width,height:screen.height};this.debugLog(this.LOG_TAG,`isInFullscreen ${s} , checkRectInterval times : ${i} nowRect:${JSON.stringify(r)}, prevRect:${JSON.stringify(t)} ,window screen rect:${JSON.stringify(o)}`);const a=r.width===t.width&&r.height===t.height,n=!s||o.width-r.width<10&&o.height-r.height<10;if(a&&n||i>=e)return this.checkRectInterval&&(clearInterval(this.checkRectInterval),this.checkRectInterval=null),void this.resize();t=r,i++}),1e3)}_listenFullscreenChange(){try{const e=e=>{Xo(e)===this.$container&&(this.emit(ks.multiFullscreen,Ir.isFullscreen),Ir.isFullscreen||-1!==window.navigator.userAgent.indexOf("Edg")?this._handleFullscreenResize():this.resize())};Ir.on("change",e),this.events.destroys.push((()=>{Ir.off("change",e)}))}catch(e){}}play(e,t,i){return new Promise(((s,r)=>{(Lo(t)||Ko(t))&&(i=t,t={});const o=this._getWindowItem(i);if(o)if(o.player)o.player.play(e,t).then((()=>{s()})).catch((e=>{r(e)}));else{const i=this._createPlayer(o);o.player=i,i.play(e,t).then((()=>{s()})).catch((e=>{r(e)}))}else r(`play() windowIndex ${i} is not exist`)}))}getOption(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getOption():(this.debugWarn(this.LOG_TAG,`getOption() windowIndex ${e} is not exist`),{})}setDebug(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setDebug(e):this.debugWarn(this.LOG_TAG,`setDebug() windowIndex ${t} is not exist`)}mute(e){const t=this._getWindowItem(e);t&&t.player?t.player.mute():this.debugWarn(this.LOG_TAG,`mute() windowIndex ${e} is not exist`)}cancelMute(e){const t=this._getWindowItem(e);t&&t.player?t.player.cancelMute():this.debugWarn(this.LOG_TAG,`cancelMute() windowIndex ${e} is not exist`)}setVolume(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setVolume(e):this.debugWarn(this.LOG_TAG,`setVolume() windowIndex ${t} is not exist`)}audioResume(e){const t=this._getWindowItem(e);t&&t.player?t.player.audioResume():this.debugWarn(this.LOG_TAG,`audioResume() windowIndex ${e} is not exist`)}setTimeout(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setTimeout(e):this.debugWarn(this.LOG_TAG,`setTimeout() windowIndex ${t} is not exist`)}setScaleMode(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setScaleMode(e):this.debugWarn(this.LOG_TAG,`setScaleMode() windowIndex ${t} is not exist`)}pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{const r=this._getWindowItem(t);r&&r.player?r.player.pause(e).then((()=>{i()})).catch((e=>{s(e)})):s(`pause() windowIndex ${t} is not exist`)}))}close(e){return new Promise(((t,i)=>{const s=this._getWindowItem(e);s&&s.player?s.player.close().then((()=>{t()})).catch((e=>{i(e)})):i(`close() windowIndex ${e} is not exist`)}))}clearView(e){const t=this._getWindowItem(e);t&&t.player?t.player.clearView():this.debugWarn(this.LOG_TAG,`clearView() windowIndex ${e} is not exist`)}setStreamQuality(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setStreamQuality(e):this.debugWarn(this.LOG_TAG,`setStreamQuality() windowIndex ${t} is not exist`)}resize(){this._opt.draggable?this._updateWindows$2():this._updateWindows()}setBufferTime(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setBufferTime(e):this.debugWarn(this.LOG_TAG,`setBufferTime() windowIndex ${t} is not exist`)}setBufferDelayTime(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setBufferDelayTime(e):this.debugWarn(this.LOG_TAG,`setBufferDelayTime() windowIndex ${t} is not exist`)}setRotate(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setRotate(e):this.debugWarn(this.LOG_TAG,`setRotate() windowIndex ${t} is not exist`)}setMirrorRotate(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setMirrorRotate(e):this.debugWarn(this.LOG_TAG,`setMirrorRotate() windowIndex ${t} is not exist`)}updateIsEmitSEI(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.updateIsEmitSEI(e):this.debugWarn(this.LOG_TAG,`updateIsEmitSEI() windowIndex ${t} is not exist`)}setAspectRatio(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setAspectRatio(e):this.debugWarn(this.LOG_TAG,`setAspectRatio() windowIndex ${t} is not exist`)}hasLoaded(e){const t=this._getWindowItem(e);return!(!t||!t.player)&&t.player.hasLoaded()}setKeepScreenOn(e){const t=this._getWindowItem(e);t&&t.player?t.player.setKeepScreenOn():this.debugWarn(this.LOG_TAG,`setKeepScreenOn() windowIndex ${e} is not exist`)}setFullscreen(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setFullscreen(e):this.debugWarn(this.LOG_TAG,`setFullscreen() windowIndex ${t} is not exist`)}screenshot(e,t){const i=this._getWindowItem(t);return i&&i.player?i.player.screenshot(e.filename,e.format,e.quality,e.type):null}screenshotWatermark(e,t){const i=this._getWindowItem(t);return i&&i.player?i.player.screenshotWatermark(e):null}startRecord(e,t,i){return new Promise(((s,r)=>{const o=this._getWindowItem(i);o&&o.player?o.player.startRecord(e,t).then((()=>{s()})).catch((e=>{r(e)})):(this.debugWarn(this.LOG_TAG,`startRecord() windowIndex ${i} is not exist`),r(`windowIndex ${i} is not exist`))}))}stopRecordAndSave(e,t,i){return new Promise(((s,r)=>{const o=this._getWindowItem(i);o&&o.player?o.player.stopRecordAndSave(e,t).then((e=>{s(e)})).catch((e=>{r(e)})):(this.debugWarn(this.LOG_TAG,`stopRecordAndSave() windowIndex ${i} is not exist`),r(`windowIndex ${i} is not exist`))}))}isPlaying(e){const t=this._getWindowItem(e);return t&&t.player?t.player.isPlaying():(this.debugWarn(this.LOG_TAG,`isPlaying() windowIndex ${e} is not exist`),!1)}isLoading(e){const t=this._getWindowItem(e);return t&&t.player?t.player.isLoading():(this.debugWarn(this.LOG_TAG,`isLoading() windowIndex ${e} is not exist`),!1)}isPaused(e){const t=this._getWindowItem(e);return t&&t.player?t.player.isPaused():(this.debugWarn(this.LOG_TAG,`windowIndex ${e} is not exist`),!1)}isMute(e){const t=this._getWindowItem(e);return t&&t.player?t.player.isMute():(this.debugWarn(this.LOG_TAG,`isMute() windowIndex ${e} is not exist`),!1)}isRecording(e){const t=this._getWindowItem(e);return t&&t.player?t.player.isRecording():(this.debugWarn(this.LOG_TAG,`isRecording() windowIndex ${e} is not exist`),!1)}clearBufferDelay(e){const t=this._getWindowItem(e);t&&t.player?t.player.clearBufferDelay():this.debugWarn(this.LOG_TAG,`clearBufferDelay() windowIndex ${e} is not exist`)}setNetworkDelayTime(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setNetworkDelayTime(e):this.debugWarn(this.LOG_TAG,`setNetworkDelayTime() windowIndex ${t} is not exist`)}getDecodeType(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getDecodeType():(this.debugWarn(this.LOG_TAG,`getDecodeType() windowIndex ${e} is not exist`),null)}getRenderType(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getRenderType():(this.debugWarn(this.LOG_TAG,`windowIndex ${e} is not exist`),null)}getAudioEngineType(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getAudioEngineType():(this.debugWarn(this.LOG_TAG,`windowIndex ${e} is not exist`),null)}getPlayingTimestamp(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getPlayingTimestamp():(this.debugWarn(this.LOG_TAG,`windowIndex ${e} is not exist`),null)}getStatus(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getStatus():(this.debugWarn(this.LOG_TAG,`getStatus() windowIndex ${e} is not exist`),null)}getPlayType(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getPlayType():(this.debugWarn(this.LOG_TAG,`getPlayType() windowIndex ${e} is not exist`),null)}togglePerformancePanel(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.togglePerformancePanel(e):this.debugWarn(this.LOG_TAG,`togglePerformancePanel() windowIndex ${t} is not exist`)}openZoom(e){const t=this._getWindowItem(e);t&&t.player?t.player.openZoom():this.debugWarn(this.LOG_TAG,`openZoom() windowIndex ${e} is not exist`)}closeZoom(e){const t=this._getWindowItem(e);t&&t.player?t.player.closeZoom():this.debugWarn(this.LOG_TAG,`closeZoom() windowIndex ${e} is not exist`)}isZoomOpen(e){const t=this._getWindowItem(e);return t&&t.player?t.player.isZoomOpen():(this.debugWarn(this.LOG_TAG,`isZoomOpen() windowIndex ${e} is not exist`),!1)}expandZoom(e){const t=this._getWindowItem(e);t&&t.player?t.player.expandZoom():this.debugWarn(this.LOG_TAG,`expandZoom() windowIndex ${e} is not exist`)}narrowZoom(e){const t=this._getWindowItem(e);t&&t.player?t.player.narrowZoom():this.debugWarn(this.LOG_TAG,`narrowZoom() windowIndex ${e} is not exist`)}getCurrentZoomIndex(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getCurrentZoomIndex():(this.debugWarn(this.LOG_TAG,`getCurrentZoomIndex() windowIndex ${e} is not exist`),0)}setNakedFlowFps(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setNakedFlowFps(e):this.debugWarn(this.LOG_TAG,`setNakedFlowFps() windowIndex ${t} is not exist`)}updateDebugLevel(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.updateDebugLevel(e):this.debugWarn(this.LOG_TAG,`updateDebugLevel() windowIndex ${t} is not exist`)}updateWatermark(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.updateWatermark(e):this.debugWarn(this.LOG_TAG,`updateWatermark() windowIndex ${t} is not exist`)}removeWatermark(e){const t=this._getWindowItem(e);t&&t.player?t.player.removeWatermark():this.debugWarn(this.LOG_TAG,`removeWatermark() windowIndex ${e} is not exist`)}updateFullscreenWatermark(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.updateFullscreenWatermark(e):this.debugWarn(this.LOG_TAG,`updateFullscreenWatermark() windowIndex ${t} is not exist`)}removeFullscreenWatermark(e){const t=this._getWindowItem(e);t&&t.player?t.player.removeFullscreenWatermark():this.debugWarn(this.LOG_TAG,`removeFullscreenWatermark() windowIndex ${e} is not exist`)}faceDetectOpen(e){const t=this._getWindowItem(e);t&&t.player?t.player.faceDetectOpen():this.debugWarn(this.LOG_TAG,`faceDetectOpen() windowIndex ${e} is not exist`)}faceDetectClose(e){const t=this._getWindowItem(e);t&&t.player?t.player.faceDetectClose():this.debugWarn(this.LOG_TAG,`faceDetectClose() windowIndex ${e} is not exist`)}objectDetectOpen(e){const t=this._getWindowItem(e);t&&t.player?t.player.objectDetectOpen():this.debugWarn(this.LOG_TAG,`objectDetectOpen() windowIndex ${e} is not exist`)}objectDetectClose(e){const t=this._getWindowItem(e);t&&t.player?t.player.objectDetectClose():this.debugWarn(this.LOG_TAG,`objectDetectClose() windowIndex ${e} is not exist`)}sendWebsocketMessage(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.sendWebsocketMessage(e):this.debugWarn(this.LOG_TAG,`sendWebsocketMessage() windowIndex ${t} is not exist`)}addContentToCanvas(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.addContentToCanvas(e):this.debugWarn(this.LOG_TAG,`addContentToCanvas() windowIndex ${t} is not exist`)}clearContentToCanvas(e){const t=this._getWindowItem(e);t&&t.player?t.player.clearContentToCanvas():this.debugWarn(this.LOG_TAG,`clearContentToCanvas() windowIndex ${e} is not exist`)}setControlHtml(e,t){const i=this._getWindowItem(t);i&&i.player?i.player.setControlHtml(e):this.debugWarn(this.LOG_TAG,`setControlHtml() windowIndex ${t} is not exist`)}clearControlHtml(e){const t=this._getWindowItem(e);t&&t.player?t.player.clearControlHtml():this.debugWarn(this.LOG_TAG,`clearControlHtml() windowIndex ${e} is not exist`)}getFlvMetaData(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getFlvMetaData():(this.debugWarn(this.LOG_TAG,`getFlvMetaData() windowIndex ${e} is not exist`),null)}getExtendBtnList(e){const t=this._getWindowItem(e);return t&&t.player?t.player.getExtendBtnList():(this.debugWarn(this.LOG_TAG,`getExtendBtnList() windowIndex ${e} is not exist`),null)}updateAiFaceDetectInterval(e,t){const i=this._getWindowItem(t);if(!i||!i.player)return this.debugWarn(this.LOG_TAG,`updateAiFaceDetectInterval() windowIndex ${t} is not exist`),null;i.player.updateAiFaceDetectInterval(e)}updateAiFaceDetectLevel(e,t){const i=this._getWindowItem(t);if(!i||!i.player)return this.debugWarn(this.LOG_TAG,`updateAiFaceDetectLevel() windowIndex ${t} is not exist`),null;i.player.updateAiFaceDetectLevel(e)}updateAiObjectDetectInterval(e,t){const i=this._getWindowItem(t);if(!i||!i.player)return this.debugWarn(this.LOG_TAG,`updateAiObjectDetectInterval() windowIndex ${t} is not exist`),null;i.player.updateAiObjectDetectInterval(e)}updateAiObjectDetectLevel(e,t){const i=this._getWindowItem(t);if(!i||!i.player)return this.debugWarn(this.LOG_TAG,`updateAiObjectDetectLevel() windowIndex ${t} is not exist`),null;i.player.updateAiObjectDetectLevel(e)}setCryptoKeyUrl(e,t){const i=this._getWindowItem(t);if(!i||!i.player)return this.debugWarn(this.LOG_TAG,`setCryptoKeyUrl() windowIndex ${t} is not exist`),null;i.player.setCryptoKeyUrl(e)}showErrorMessageTips(e,t){const i=this._getWindowItem(t);if(!i||!i.player)return this.debugWarn(this.LOG_TAG,`showErrorMessageTips() windowIndex ${t} is not exist`),null;i.player.showErrorMessageTips(e)}hideErrorMessageTips(e){const t=this._getWindowItem(e);if(!t||!t.player)return this.debugWarn(this.LOG_TAG,`hideErrorMessageTips() windowIndex ${e} is not exist`),null;t.player.hideErrorMessageTips()}destroySingle(e){return new Promise(((t,i)=>{const s=this._getWindowItem(e);s?s.player&&s.player.destroy().then((()=>{s.player=null,t()})).catch((e=>{i(e)})):(i("windowIndex is not exist"),this.debugWarn(this.LOG_TAG,`destroySingle() windowIndex ${e} is not exist`))}))}initSingle(e){return new Promise(((t,i)=>{const s=this._getWindowItem(e);if(s)if(s.player)s.player.destroy().then((()=>{s.player=null;const e=this._createPlayer(s);s.player=e,t()})).catch((e=>{i(e)}));else{const e=this._createPlayer(s);s.player=e,t()}else i("windowIndex is not exist"),this.debugWarn(this.LOG_TAG,`destroySingle() windowIndex ${e} is not exist`)}))}setFullscreenMulti(e){return new Promise(((t,i)=>{if(this.debugLog(this.LOG_TAG,"setFullscreenMulti",e),e)try{Ir.request(this.$container).then((()=>{t()})).catch((e=>{this.debugError(this.LOG_TAG,"fullscreen request inner error",e),i(e)}))}catch(e){this.debugError(this.LOG_TAG,"fullscreen request error",e),i(e)}else try{Ir.exit().then((()=>{t()})).catch((e=>{this.debugError(this.LOG_TAG,"fullscreen exit inner error",e),i(e)}))}catch(e){this.debugError(this.LOG_TAG,"fullscreen exit error",e),i(e)}}))}toggleSingleWindowContainerFullscreen(e,t){this.debugLog(this.LOG_TAG,"setSingleWindowContainerFullscreen",t);const i=this._getWindowItem(t);this.windowList.forEach((e=>{e.uuid!==i.uuid&&this._handleWindowContainerFullscreen(e.uuid,!1)})),this._handleWindowContainerFullscreen(i.uuid,e)}selectWindow(e){this.debugLog(this.LOG_TAG,"selectWindow",e),this._handleWindowSelect(e)}arrangeWindow(e){this.debugLog(this.LOG_TAG,"arrangeWindow",e),this._innerArrangeWindow(e)}_innerArrangeWindow(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return void this.debugWarn(this.LOG_TAG,`arrangeWindow() split ${e} is not valid`);if([Ls,Cs].includes(e))this._arrangeSpecialWindow(e);else{if(this._opt.split===e&&null===this.specialLayoutType&&Aa(t))return void this.debugWarn(this.LOG_TAG,`arrangeWindow() split ${e} is not changed`);this.specialLayoutType=null,this._arrangeWindow(e)}}_arrangeWindow(e){(e=So(e))<1||!Lo(e)?this.debugWarn(this.LOG_TAG,`arrangeWindow() split ${e} is not valid`):(e>this._opt.maxSplit&&(e=this._opt.maxSplit),this._opt.split=e,this.currentWindowIndex=0,this._opt.draggable?this._updateWindows$2():this._updateWindows(),this._handleWindowSelect(this.currentWindowIndex))}_arrangeSpecialWindow(e){this._opt.maxSplit<=3&&e===Cs||this._opt.maxSplit<=2&&e===Ls?this.debugWarn(this.LOG_TAG,`_arrangeSpecialWindow() type ${e} is not valid because maxSplit is ${this._opt.maxSplit}`):this.specialLayoutType&&this.specialLayoutType===e?this.debugWarn(this.LOG_TAG,`_arrangeSpecialWindow() type ${e} is not changed`):(this.specialLayoutType=e,e===Ls?this._arrangeWindow(3):e===Cs?this._arrangeWindow(4):this.debugWarn(this.LOG_TAG,`_arrangeSpecialWindow() type ${e} is not valid`))}getCurrentSplit(){return this.specialLayoutType?this.specialLayoutType:this._opt.split}_getCurrentMaxSplit(){if(this.specialLayoutType){let e=0;return this.specialLayoutType===Ls?e=9:this.specialLayoutType===Cs&&(e=16),e}return this._opt.split*this._opt.split}_getCurrentMaxSplitV2(){return this.specialLayoutType?this._getSpecialMaxSplit():this._opt.split*this._opt.split}_getSpecialMaxSplit(){let e=0;return this.specialLayoutType===Ls?e=6:this.specialLayoutType===Cs&&(e=8),e}getSelectedWindowIndex(){return this.currentWindowIndex}getSelectedWindowUuid(){return this.currentWindowUuid}getWindowItem(e){let t=this._getWindowItem(e),i=this._findWindowItemIndexByUuid(t.uuid),s=null;return t&&(s={index:i,$player:t.$player,$playerContainer:t.$playerContainer,player:t.player,uuid:t.uuid}),s}getNextWindowItem(e){this.debugLog(this.LOG_TAG,"getNextWindowItem",e);let t=null,i=this._getWindowItem(e);if(i){const e=this._getWindowUuidList()||[],s=e.findIndex((e=>e===i.uuid));if(se===i.uuid));if(s>0){const i=s-1,r=this._findWindowItemByUuid(e[i]);if(r){t={index:this._findWindowItemIndexByUuid(r.uuid),$player:r.$player,$playerContainer:r.$playerContainer,player:r.player,uuid:r.uuid}}}}return t}getWindowUuidList(){return this._getWindowUuidList()||[]}isWindowItemHasInitPlayer(e){let t=!1,i=this._getWindowItem(e);return i&&i.player&&(t=!0),t}_getWindowItem(e){let t=null;const i=Ko(e)&&16===e.length;return t=i||!Lo(e)?this._findWindowItemByUuid(i?e:this.currentWindowUuid):this.windowList[e]||this.windowList[this.currentWindowIndex],t}_getWindowUuidList(){return this.windowList.filter(((e,t)=>te.uuid))}_findWindowItemIndex(e){return e&&e.uuid?this._findWindowItemIndexByUuid(e.uuid):null}_findWindowItemIndexByUuid(e){return this.windowList.findIndex((t=>t.uuid===e))}_findWindowItemByUuid(e){return this.windowList.find((t=>t.uuid===e))}debugLog(e){if(this._opt.debug&&this.debug){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s1?t-1:0),s=1;s1?t-1:0),s=1;s1?i-1:0),o=1;o1?i-1:0),o=1;o1?t-1:0),r=1;r3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,i,r)));e.addEventListener(t,i,r);const o=()=>e.removeEventListener(t,i,r);return this.destroys.push(o),o}destroy(){this.master.debug&&this.master.debug.log("Events","destroy"),this.destroys.forEach((e=>e()))}}var fe=t((function(e){!function(){var t="undefined"!=typeof window&&void 0!==window.document?window.document:{},i=e.exports,r=function(){for(var e,i=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],r=0,o=i.length,s={};r0&&void 0!==arguments[0]?arguments[0]:"";const t=e.split(","),i=atob(t[1]),r=t[0].replace("data:","").replace(";base64","");let o=i.length,s=new Uint8Array(o);for(;o--;)s[o]=i.charCodeAt(o);return new File([s],"file",{type:r})}function ve(){return(new Date).getTime()}function we(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}function Se(e,t,i){if(e)return"object"==typeof t&&Object.keys(t).forEach((i=>{Se(e,i,t[i])})),e.style[t]=i,e}function Ee(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return 0;const r=getComputedStyle(e,null).getPropertyValue(t);return i?parseFloat(r):r}function Be(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function Ce(e){let t=0,i=Be();return r=>{t+=r;const o=Be(),s=o-i;s>=1e3&&(e(t/s*1e3),i=o,t=0)}}function Re(){return/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase())}function ke(e){if(null==e||""===e||0===parseInt(e)||isNaN(parseInt(e)))return"0KB/s";let t=parseFloat(e);return t=t.toFixed(2),t+"KB/s"}function Te(e){return null==e}function Ie(e){return!0===e||!1===e}function xe(e){return!Te(e)}function De(e){var t;if(e>-1){var i=Math.floor(e/3600),r=Math.floor(e/60)%60,o=e%60;t=i<10?"0"+i+":":i+":",r<10&&(t+="0"),t+=r+":",(o=Math.round(o))<10&&(t+="0"),t+=o.toFixed(0)}return t}function je(e){const t=e||window.event;return t.target||t.srcElement}function Le(e){let t=!1;return e&&e.parentNode&&(e.parentNode.removeChild(e),t=!0),t}function Fe(e,t){let i=[];i[0]=t?28:44,i[1]=1,i[2]=0,i[3]=0,i[4]=0;const r=new Uint8Array(i.length+e.byteLength);return r.set(i,0),r.set(e,i.length),r}function Oe(e){return!0!==e&&"true"!==e}fe.isEnabled,(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();class Ve{on(e,t,i){const r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:i}),this}once(e,t,i){const r=this;function o(){r.off(e,o);for(var s=arguments.length,a=new Array(s),n=0;n1?i-1:0),o=1;o{delete i[e]})),void delete this.e;const r=i[e],o=[];if(r&&t)for(let e=0,i=r.length;e=200&&t.status<=299}function Je(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(i){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var Pe=Ue.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),Ge="object"!=typeof window||window!==Ue?function(){}:"download"in HTMLAnchorElement.prototype&&!Pe?function(e,t,i){var r=Ue.URL||Ue.webkitURL,o=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",o.download=t,o.rel="noopener","string"==typeof e?(o.href=e,o.origin!==location.origin?We(o.href)?Qe(e,t,i):Je(o,o.target="_blank"):Je(o)):(o.href=r.createObjectURL(e),setTimeout((function(){r.revokeObjectURL(o.href)}),4e4),setTimeout((function(){Je(o)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download","string"==typeof e)if(We(e))Qe(e,t,i);else{var r=document.createElement("a");r.href=e,r.target="_blank",setTimeout((function(){Je(r)}))}else navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e}(e,i),t)}:function(e,t,i,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof e)return Qe(e,t,i);var o="application/octet-stream"===e.type,s=/constructor/i.test(Ue.HTMLElement)||Ue.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent);if((a||o&&s||Pe)&&"undefined"!=typeof FileReader){var n=new FileReader;n.onloadend=function(){var e=n.result;e=a?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=e:location=e,r=null},n.readAsDataURL(e)}else{var A=Ue.URL||Ue.webkitURL,d=A.createObjectURL(e);r?r.location=d:location.href=d,r=null,setTimeout((function(){A.revokeObjectURL(d)}),4e4)}};class Ne extends Me{constructor(e){super(),this.player=e;const t=document.createElement("canvas");t.style.position="absolute",t.style.top=0,t.style.left=0,this.$videoElement=t,e.$container.appendChild(this.$videoElement),this.context2D=null,this.contextGl=null,this.contextGlRender=null,this.contextGlDestroy=null,this.bitmaprenderer=null,this.renderType=null,this.videoInfo={width:"",height:"",encType:""},this._initCanvasRender(),this.player.debug.log("CanvasVideo","init")}async destroy(){super.destroy(),this.contextGl&&(this.contextGl=null),this.context2D&&(this.context2D=null),this.contextGlRender&&(this.contextGlDestroy&&this.contextGlDestroy(),this.contextGlDestroy=null,this.contextGlRender=null),this.bitmaprenderer&&(this.bitmaprenderer=null),this.renderType=null,this.player.debug.log("CanvasVideoLoader","destroy")}_initContextGl(){if(this.contextGl=function(e){let t=null;const i=["webgl","experimental-webgl","moz-webgl","webkit-3d"];let r=0;for(;!t&&r{var i=["attribute vec4 vertexPos;","attribute vec4 texturePos;","varying vec2 textureCoord;","void main()","{","gl_Position = vertexPos;","textureCoord = texturePos.xy;","}"].join("\n"),r=["precision highp float;","varying highp vec2 textureCoord;","uniform sampler2D ySampler;","uniform sampler2D uSampler;","uniform sampler2D vSampler;","const mat4 YUV2RGB = mat4","(","1.1643828125, 0, 1.59602734375, -.87078515625,","1.1643828125, -.39176171875, -.81296875, .52959375,","1.1643828125, 2.017234375, 0, -1.081390625,","0, 0, 0, 1",");","void main(void) {","highp float y = texture2D(ySampler, textureCoord).r;","highp float u = texture2D(uSampler, textureCoord).r;","highp float v = texture2D(vSampler, textureCoord).r;","gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;","}"].join("\n");t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);var o=e.createShader(e.VERTEX_SHADER);e.shaderSource(o,i),e.compileShader(o),e.getShaderParameter(o,e.COMPILE_STATUS)||console.log("Vertex shader failed to compile: "+e.getShaderInfoLog(o));var s=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(s,r),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS)||console.log("Fragment shader failed to compile: "+e.getShaderInfoLog(s));var a=e.createProgram();e.attachShader(a,o),e.attachShader(a,s),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS)||console.log("Program failed to compile: "+e.getProgramInfoLog(a)),e.useProgram(a);var n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var A=e.getAttribLocation(a,"vertexPos");e.enableVertexAttribArray(A),e.vertexAttribPointer(A,2,e.FLOAT,!1,0,0);var d=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,d),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var c=e.getAttribLocation(a,"texturePos");function l(t,i){var r=e.createTexture();return e.bindTexture(e.TEXTURE_2D,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),e.uniform1i(e.getUniformLocation(a,t),i),r}e.enableVertexAttribArray(c),e.vertexAttribPointer(c,2,e.FLOAT,!1,0,0);var u=l("ySampler",0),h=l("uSampler",1),p=l("vSampler",2);return{render:function(t,i,r,o,s){e.viewport(0,0,t,i),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,u),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,t,i,0,e.LUMINANCE,e.UNSIGNED_BYTE,r),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,h),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,t/2,i/2,0,e.LUMINANCE,e.UNSIGNED_BYTE,o),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,p),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,t/2,i/2,0,e.LUMINANCE,e.UNSIGNED_BYTE,s),e.drawArrays(e.TRIANGLE_STRIP,0,4)},destroy:function(){try{e.deleteProgram(a),e.deleteBuffer(n),e.deleteBuffer(d),e.deleteTexture(u),e.deleteTexture(h),e.deleteTexture(p)}catch(e){}}}})(this.contextGl,this.player._opt.openWebglAlignment);this.contextGlRender=e.render,this.contextGlDestroy=e.destroy}else this.player.debug.error("CanvasVideoLoader","init webgl fail")}_initContext2D(){this.context2D=this.$videoElement.getContext("2d")}_initCanvasRender(){this.player._opt.useWCS&&!this._supportOffscreen()?(this.renderType=Y,this._initContext2D()):this._supportOffscreen()?(this.renderType=q,this._bindOffscreen()):(this.renderType=X,this._initContextGl())}_supportOffscreen(){return"function"==typeof this.$videoElement.transferControlToOffscreen&&this.player._opt.useOffscreen}_bindOffscreen(){this.bitmaprenderer=this.$videoElement.getContext("bitmaprenderer")}initCanvasViewSize(){this.$videoElement.width=this.videoInfo.width,this.$videoElement.height=this.videoInfo.height,this.resize()}render(e){switch(this.player.videoTimestamp=e.ts,this.renderType){case q:this.bitmaprenderer.transferFromImageBitmap(e.buffer);break;case X:this.contextGlRender(this.$videoElement.width,this.$videoElement.height,e.output[0],e.output[1],e.output[2]);break;case Y:this.context2D.drawImage(e.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height),(t=e.videoFrame).close?t.close():t.destroy&&t.destroy()}var t}screenshot(e,t,i,r){e=e||ve(),r=r||Q.download;const o={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"};let s=.92;!o[t]&&Q[t]&&(r=t,t="png",i=void 0),"string"==typeof i&&(r=i,i=void 0),void 0!==i&&(s=Number(i));const a=this.$videoElement.toDataURL(o[t]||o.png,s);if(r===Q.base64)return a;{const t=ye(a);if(r===Q.blob)return t;r===Q.download&&Ge(t,e)}}clearView(){switch(this.renderType){case q:(function(e,t){const i=document.createElement("canvas");return i.width=e,i.height=t,window.createImageBitmap(i,0,0,e,t)})(this.$videoElement.width,this.$videoElement.height).then((e=>{this.bitmaprenderer.transferFromImageBitmap(e)}));break;case X:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case Y:this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height)}}resize(){this.player.debug.log("canvasVideo","resize");const e=this.player._opt;let t=this.player.width,i=this.player.height;this.player.isControlBarShow()&&(Re()&&this.player.fullscreen&&e.useWebFullScreen?t-=G:i-=G);let r=this.$videoElement.width,o=this.$videoElement.height;const s=e.rotate;let a=(t-r)/2,n=(i-o)/2;270!==s&&90!==s||(r=this.$videoElement.height,o=this.$videoElement.width);const A=t/r,d=i/o;let c=A>d?d:A;e.isResize||A!==d&&(c=A+","+d),e.isFullResize&&(c=A>d?A:d);let l="scale("+c+")";s&&(l+=" rotate("+s+"deg)"),this.$videoElement.style.transform=l,this.$videoElement.style.left=a+"px",this.$videoElement.style.top=n+"px"}}class He extends Me{constructor(e){super(),this.player=e;const t=document.createElement("video"),i=document.createElement("canvas");t.muted=!0,t.disablePictureInPicture=!0,function(){const e=window.navigator.userAgent.toLowerCase();return/android/i.test(e)}()&&(t.poster="noposter"),t.style.position="absolute",t.style.top=0,t.style.left=0,this._delayPlay=!1,e.$container.appendChild(t),this.videoInfo={width:"",height:"",encType:""};const r=this.player._opt;r.useWCS&&r.wcsUseVideoRender&&(this.trackGenerator=new MediaStreamTrackGenerator({kind:"video"}),t.srcObject=new MediaStream([this.trackGenerator]),this.vwriter=this.trackGenerator.writable.getWriter()),this.$videoElement=t,this.$canvasElement=i,this.canvasContext=i.getContext("2d"),this.fixChromeVideoFlashBug(),this.resize();const{proxy:o}=this.player.events;o(this.$videoElement,"canplay",(()=>{this.player.debug.log("Video","canplay"),this._delayPlay&&(this.player.debug.log("Video","canplay and _delayPlay is true and next play()"),this._play())})),o(this.$videoElement,"waiting",(()=>{this.player.debug.log("Video","waiting")})),o(this.$videoElement,"timeupdate",(e=>{const t=parseInt(e.timeStamp,10);this.player.emit(j.timeUpdate,t),!this.isPlaying()&&this.init&&(this.player.debug.log("Video","timeupdate and this.isPlaying is false and retry play"),this.$videoElement.play())})),this.player.debug.log("Video","init")}async destroy(){super.destroy(),this.$canvasElement=null,this.canvasContext=null,this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.src="",this.$videoElement.removeAttribute("src"),this.$videoElement=null),this.trackGenerator&&(this.trackGenerator.stop(),this.trackGenerator=null),this.vwriter&&(await this.vwriter.close(),this.vwriter=null),this.player.debug.log("Video","destroy")}fixChromeVideoFlashBug(){const e=function(){const e=navigator.userAgent.toLowerCase(),t={},i={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:e.indexOf("chrome")>-1&&e.indexOf("safari")>-1,Firefox:e.indexOf("firefox")>-1,Opera:e.indexOf("opera")>-1,Safari:e.indexOf("safari")>-1&&-1==e.indexOf("chrome"),Edge:e.indexOf("edge")>-1,QQBrowser:/qqbrowser/.test(e),WeixinBrowser:/MicroMessenger/i.test(e)};for(let r in i)if(i[r]){let i="";if("IE"===r)i=e.match(/(msie\s|trident.*rv:)([\w.]+)/)[2];else if("Chrome"===r){for(let e in navigator.mimeTypes)"application/360softmgrplugin"===navigator.mimeTypes[e].type&&(r="360");i=e.match(/chrome\/([\d.]+)/)[1]}else"Firefox"===r?i=e.match(/firefox\/([\d.]+)/)[1]:"Opera"===r?i=e.match(/opera\/([\d.]+)/)[1]:"Safari"===r?i=e.match(/version\/([\d.]+)/)[1]:"Edge"===r?i=e.match(/edge\/([\d.]+)/)[1]:"QQBrowser"===r&&(i=e.match(/qqbrowser\/([\d.]+)/)[1]);t.type=r,t.version=parseInt(i)}return t}().type.toLowerCase();if("chrome"===e||"edge"===e){const e=this.player.$container;e.style.backdropFilter="blur(0px)",e.style.translateZ="0"}}play(){if(this.$videoElement){const e=this._getVideoReadyState();if(this.player.debug.log("Video",`play and readyState: ${e}`),0===e)return this.player.debug.warn("Video","readyState is 0 and set _delayPlay to true"),void(this._delayPlay=!0);this._play()}}_getVideoReadyState(){let e=0;return this.$videoElement&&(e=this.$videoElement.readyState),e}_play(){this.$videoElement&&this.$videoElement.play().then((()=>{this._delayPlay=!1,this.player.debug.log("Video","_play success"),setTimeout((()=>{this.isPlaying()||(this.player.debug.warn("Video","play failed and retry play"),this._play())}),100)})).catch((e=>{this.player.debug.error("Video","_play error",e)}))}pause(e){e?this.$videoElement&&this.$videoElement.pause():setTimeout((()=>{this.$videoElement&&this.$videoElement.pause()}),100)}clearView(){}screenshot(e,t,i,r){e=e||ve(),r=r||Q.download;const o={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"};let s=.92;!o[t]&&Q[t]&&(r=t,t="png",i=void 0),"string"==typeof i&&(r=i,i=void 0),void 0!==i&&(s=Number(i));const a=this.$videoElement;let n=this.$canvasElement;n.width=a.videoWidth,n.height=a.videoHeight,this.canvasContext.drawImage(a,0,0,n.width,n.height);const A=n.toDataURL(o[t]||o.png,s);if(this.canvasContext.clearRect(0,0,n.width,n.height),n.width=0,n.height=0,r===Q.base64)return A;{const t=ye(A);if(r===Q.blob)return t;r===Q.download&&Ge(t,e)}}initCanvasViewSize(){this.resize()}render(e){this.vwriter&&this.vwriter.write(e.videoFrame)}resize(){let e=this.player.width,t=this.player.height;const i=this.player._opt,r=i.rotate;this.player.isControlBarShow()&&(Re()&&this.player.fullscreen&&i.useWebFullScreen?e-=G:t-=G),this.$videoElement.width=e,this.$videoElement.height=t,270!==r&&90!==r||(this.$videoElement.width=t,this.$videoElement.height=e);let o=(e-this.$videoElement.width)/2,s=(t-this.$videoElement.height)/2,a="contain";i.isResize||(a="fill"),i.isFullResize&&(a="none"),this.$videoElement.style.objectFit=a,this.$videoElement.style.transform="rotate("+r+"deg)",this.$videoElement.style.left=o+"px",this.$videoElement.style.top=s+"px"}isPlaying(){return this.$videoElement&&!this.$videoElement.paused}}class ze{constructor(e){return new(ze.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.useMSE||e.useWCS&&!e.useOffscreen&&e.wcsUseVideoRender?He:Ne}}class Ye extends Ve{constructor(e){super(),this.bufferList=[],this.player=e,this.scriptNode=null,this.hasInitScriptNode=!1,this.audioContextChannel=null,this.audioContext=new(window.AudioContext||window.webkitAudioContext),this.gainNode=this.audioContext.createGain();const t=this.audioContext.createBufferSource();t.buffer=this.audioContext.createBuffer(1,1,22050),t.connect(this.audioContext.destination),t.noteOn?t.noteOn(0):t.start(0),this.audioBufferSourceNode=t,this.mediaStreamAudioDestinationNode=this.audioContext.createMediaStreamDestination(),this.audioEnabled(!0),this.gainNode.gain.value=0,this._prevVolume=null,this.playing=!1,this.audioSyncVideoOption={diff:null},this.audioInfo={encType:"",channels:"",sampleRate:""},this.init=!1,this.hasAudio=!1,this.on(j.videoSyncAudio,(e=>{this.audioSyncVideoOption=e})),this.player.debug.log("AudioContext","init")}resetInit(){this.init=!1,this.audioInfo={encType:"",channels:"",sampleRate:""}}async destroy(){this.closeAudio(),this.resetInit(),this.audioContext&&(await this.audioContext.close(),this.audioContext=null),this.gainNode=null,this.hasAudio=!1,this.playing=!1,this.scriptNode&&(this.scriptNode.onaudioprocess=be,this.scriptNode=null),this.audioBufferSourceNode=null,this.mediaStreamAudioDestinationNode=null,this.hasInitScriptNode=!1,this.audioSyncVideoOption={diff:null},this._prevVolume=null,this.off(),this.player.debug.log("AudioContext","destroy")}updateAudioInfo(e){e.encTypeCode&&(this.audioInfo.encType=P[e.encTypeCode],this.audioInfo.encTypeCode=e.encTypeCode),e.channels&&(this.audioInfo.channels=e.channels),e.sampleRate&&(this.audioInfo.sampleRate=e.sampleRate),this.audioInfo.sampleRate&&this.audioInfo.channels&&this.audioInfo.encType&&!this.init&&(this.player.emit(j.audioInfo,this.audioInfo),this.init=!0)}get isPlaying(){return this.playing}get isMute(){return 0===this.gainNode.gain.value}get volume(){return this.gainNode.gain.value}get bufferSize(){return this.bufferList.length}initScriptNode(){if(this.playing=!0,this.hasInitScriptNode)return;const e=this.audioInfo.channels,t=this.audioContext.createScriptProcessor(1024,0,e);t.onaudioprocess=t=>{const i=t.outputBuffer;if(this.bufferList.length&&this.playing){if(!this.player._opt.useWCS&&!this.player._opt.useMSE&&this.player._opt.wasmDecodeAudioSyncVideo){if(this.audioSyncVideoOption.diff>ie)return void this.player.debug.warn("AudioContext",`audioSyncVideoOption more than diff :${this.audioSyncVideoOption.diff}, waiting`);if(this.audioSyncVideoOption.diff<-1e3){this.player.debug.warn("AudioContext",`audioSyncVideoOption less than diff :${this.audioSyncVideoOption.diff}, dropping`);let e=this.bufferList.shift();for(;e.ts-this.player.videoTimestamp<-1e3&&this.bufferList.length>0;)e=this.bufferList.shift();if(0===this.bufferList.length)return}}if(0===this.bufferList.length)return;const t=this.bufferList.shift();t&&t.ts&&(this.player.audioTimestamp=t.ts);for(let r=0;r0?this.player.emit(j.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(j.mute,!0),this.gainNode.gain.value=e,this.gainNode.gain.setValueAtTime(e,this.audioContext.currentTime),this.player.emit(j.volumechange,this.player.volume),this.player.emit(j.volume,this.player.volume),this._prevVolume=e)}closeAudio(){this.hasInitScriptNode&&(this.scriptNode&&this.scriptNode.disconnect(this.gainNode),this.gainNode&&this.gainNode.disconnect(this.audioContext.destination),this.gainNode&&this.gainNode.disconnect(this.mediaStreamAudioDestinationNode)),this.clear()}audioEnabled(e){e?"suspended"===this.audioContext.state&&this.audioContext.resume():"running"===this.audioContext.state&&this.audioContext.suspend()}isStateRunning(){return"running"===this.audioContext.state}isStateSuspended(){return"suspended"===this.audioContext.state}clear(){this.bufferList=[]}play(e,t){this.isMute||(this.hasAudio=!0,this.bufferList.push({buffer:e,ts:t}),this.bufferList.length>20&&(this.player.debug.warn("AudioContext",`bufferList is large: ${this.bufferList.length}`),this.bufferList.length>50&&this.bufferList.shift()))}pause(){this.audioSyncVideoOption={diff:null},this.playing=!1,this.clear()}resume(){this.playing=!0}}class Xe{constructor(e){return new(Xe.getLoaderFactory())(e)}static getLoaderFactory(){return Ye}}class qe extends Ve{constructor(e){super(),this.player=e,this.playing=!1,this.abortController=new AbortController,this.streamRate=Ce((t=>{e.emit(j.kBps,(t/1024).toFixed(2))})),e.debug.log("FetchStream","init")}async destroy(){this.abort(),this.off(),this.streamRate=null,this.player.debug.log("FetchStream","destroy")}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{demux:i}=this.player;this.player.debug.log("FetchStream","fetchStream",e,JSON.stringify(t)),this.player._times.streamStart=ve();const r=Object.assign({signal:this.abortController.signal},{headers:t.headers||{}});fetch(e,r).then((e=>{const t=e.body.getReader();this.emit(j.streamSuccess);const r=()=>{t.read().then((e=>{let{done:t,value:o}=e;t?i.close():(this.streamRate&&this.streamRate(o.byteLength),i.dispatch(o),r())})).catch((e=>{i.close();const t=e.toString();-1===t.indexOf(Ae)&&-1===t.indexOf(de)&&e.name!==ce&&(this.abort(),this.emit(F.fetchError,e),this.player.emit(j.error,F.fetchError))}))};r()})).catch((e=>{"AbortError"!==e.name&&(i.close(),this.abort(),this.emit(F.fetchError,e),this.player.emit(j.error,F.fetchError))}))}abort(){this.abortController&&(this.abortController.abort(),this.abortController=null)}}class Ze extends Ve{constructor(e){super(),this.player=e,this.socket=null,this.socketStatus=O,this.wsUrl=null,this.streamRate=Ce((t=>{e.emit(j.kBps,(t/1024).toFixed(2))})),e.debug.log("WebsocketLoader","init")}async destroy(){this.socket&&(this.socket.close(1e3,"Client disconnecting"),this.socket=null),this.socketStatus=O,this.streamRate=null,this.wsUrl=null,this.off(),this.player.debug.log("websocketLoader","destroy")}_createWebSocket(){const e=this.player,{debug:t,events:{proxy:i},demux:r}=e;this.socket=new WebSocket(this.wsUrl),this.socket.binaryType="arraybuffer",i(this.socket,"open",(()=>{this.emit(j.streamSuccess),t.log("websocketLoader","socket open"),this.socketStatus=V})),i(this.socket,"message",(e=>{this.streamRate&&this.streamRate(e.data.byteLength),this._handleMessage(e.data)})),i(this.socket,"close",(()=>{t.log("websocketLoader","socket close"),this.emit(j.streamEnd),this.socketStatus=M})),i(this.socket,"error",(e=>{t.log("websocketLoader","socket error"),this.emit(F.websocketError,e),this.player.emit(j.error,F.websocketError),this.socketStatus=U,r.close(),t.log("websocketLoader","socket error:",e)}))}_handleMessage(e){const{demux:t}=this.player;t?t.dispatch(e):this.player.debug.warn("websocketLoader","websocket handle message demux is null")}fetchStream(e,t){this.player._times.streamStart=ve(),this.wsUrl=e,this._createWebSocket()}}class Ke{constructor(e){return new(Ke.getLoaderFactory(e._opt.protocol))(e)}static getLoaderFactory(e){return e===a?qe:e===s?Ze:void 0}}var _e=t((function(t){function i(e,t){if(!e)throw"First parameter is required.";t=new r(e,t=t||{type:"video"});var s=this;function a(i){i&&(t.initCallback=function(){i(),i=t.initCallback=null});var r=new o(e,t);(h=new r(e,t)).record(),u("recording"),t.disableLogs||console.log("Initialized recorderType:",h.constructor.name,"for output-type:",t.type)}function n(e){if(e=e||function(){},h){if("paused"===s.state)return s.resumeRecording(),void setTimeout((function(){n(e)}),1);"recording"===s.state||t.disableLogs||console.warn('Recording state should be: "recording", however current state is: ',s.state),t.disableLogs||console.log("Stopped recording "+t.type+" stream."),"gif"!==t.type?h.stop(i):(h.stop(),i()),u("stopped")}else m();function i(i){if(h){Object.keys(h).forEach((function(e){"function"!=typeof h[e]&&(s[e]=h[e])}));var r=h.blob;if(!r){if(!i)throw"Recording failed.";h.blob=r=i}if(r&&!t.disableLogs&&console.log(r.type,"->",b(r.size)),e){var o;try{o=l.createObjectURL(r)}catch(e){}"function"==typeof e.call?e.call(s,o):e(o)}t.autoWriteToDisk&&d((function(e){var i={};i[t.type+"Blob"]=e,x.Store(i)}))}else"function"==typeof e.call?e.call(s,""):e("")}}function A(e){postMessage((new FileReaderSync).readAsDataURL(e))}function d(e,i){if(!e)throw"Pass a callback function over getDataURL.";var r=i?i.blob:(h||{}).blob;if(!r)return t.disableLogs||console.warn("Blob encoder did not finish its job yet."),void setTimeout((function(){d(e,i)}),1e3);if("undefined"==typeof Worker||navigator.mozGetUserMedia){var o=new FileReader;o.readAsDataURL(r),o.onload=function(t){e(t.target.result)}}else{var s=function(e){try{var t=l.createObjectURL(new Blob([e.toString(),"this.onmessage = function (eee) {"+e.name+"(eee.data);}"],{type:"application/javascript"})),i=new Worker(t);return l.revokeObjectURL(t),i}catch(e){}}(A);s.onmessage=function(t){e(t.data)},s.postMessage(r)}}function c(e){e=e||0,"paused"!==s.state?"stopped"!==s.state&&(e>=s.recordingDuration?n(s.onRecordingStopped):(e+=1e3,setTimeout((function(){c(e)}),1e3))):setTimeout((function(){c(e)}),1e3)}function u(e){s&&(s.state=e,"function"==typeof s.onStateChanged.call?s.onStateChanged.call(s,e):s.onStateChanged(e))}var h,p='It seems that recorder is destroyed or "startRecording" is not invoked for '+t.type+" recorder.";function m(){!0!==t.disableLogs&&console.warn(p)}var g={startRecording:function(i){return t.disableLogs||console.log("RecordRTC version: ",s.version),i&&(t=new r(e,i)),t.disableLogs||console.log("started recording "+t.type+" stream."),h?(h.clearRecordedData(),h.record(),u("recording"),s.recordingDuration&&c(),s):(a((function(){s.recordingDuration&&c()})),s)},stopRecording:n,pauseRecording:function(){h?"recording"===s.state?(u("paused"),h.pause(),t.disableLogs||console.log("Paused recording.")):t.disableLogs||console.warn("Unable to pause the recording. Recording state: ",s.state):m()},resumeRecording:function(){h?"paused"===s.state?(u("recording"),h.resume(),t.disableLogs||console.log("Resumed recording.")):t.disableLogs||console.warn("Unable to resume the recording. Recording state: ",s.state):m()},initRecorder:a,setRecordingDuration:function(e,t){if(void 0===e)throw"recordingDuration is required.";if("number"!=typeof e)throw"recordingDuration must be a number.";return s.recordingDuration=e,s.onRecordingStopped=t||function(){},{onRecordingStopped:function(e){s.onRecordingStopped=e}}},clearRecordedData:function(){h?(h.clearRecordedData(),t.disableLogs||console.log("Cleared old recorded data.")):m()},getBlob:function(){if(h)return h.blob;m()},getDataURL:d,toURL:function(){if(h)return l.createObjectURL(h.blob);m()},getInternalRecorder:function(){return h},save:function(e){h?y(h.blob,e):m()},getFromDisk:function(e){h?i.getFromDisk(t.type,e):m()},setAdvertisementArray:function(e){t.advertisement=[];for(var i=e.length,r=0;r-1&&"netscape"in window&&/ rv:/.test(navigator.userAgent),m=!h&&!u&&!!navigator.webkitGetUserMedia||v()||-1!==navigator.userAgent.toLowerCase().indexOf("chrome/"),g=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);g&&!m&&-1!==navigator.userAgent.indexOf("CriOS")&&(g=!1,m=!0);var f=window.MediaStream;function b(e){if(0===e)return"0 Bytes";var t=parseInt(Math.floor(Math.log(e)/Math.log(1e3)),10);return(e/Math.pow(1e3,t)).toPrecision(3)+" "+["Bytes","KB","MB","GB","TB"][t]}function y(e,t){if(!e)throw"Blob object is required.";if(!e.type)try{e.type="video/webm"}catch(e){}var i=(e.type||"video/webm").split("/")[1];if(-1!==i.indexOf(";")&&(i=i.split(";")[0]),t&&-1!==t.indexOf(".")){var r=t.split(".");t=r[0],i=r[1]}var o=(t||Math.round(9999999999*Math.random())+888888888)+"."+i;if(void 0!==navigator.msSaveOrOpenBlob)return navigator.msSaveOrOpenBlob(e,o);if(void 0!==navigator.msSaveBlob)return navigator.msSaveBlob(e,o);var s=document.createElement("a");s.href=l.createObjectURL(e),s.download=o,s.style="display:none;opacity:0;color:transparent;",(document.body||document.documentElement).appendChild(s),"function"==typeof s.click?s.click():(s.target="_blank",s.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}))),l.revokeObjectURL(s.href)}function v(){return"undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type||(!("undefined"==typeof process||"object"!=typeof process.versions||!process.versions.electron)||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}function w(e,t){return e&&e.getTracks?e.getTracks().filter((function(e){return e.kind===(t||"audio")})):[]}function S(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}void 0===f&&"undefined"!=typeof webkitMediaStream&&(f=webkitMediaStream),void 0!==f&&void 0===f.prototype.stop&&(f.prototype.stop=function(){this.getTracks().forEach((function(e){e.stop()}))}),i.invokeSaveAsDialog=y,i.getTracks=w,i.getSeekableBlob=function(e,t){if("undefined"==typeof EBML)throw new Error("Please link: https://www.webrtc-experiment.com/EBML.js");var i=new EBML.Reader,r=new EBML.Decoder,o=EBML.tools,s=new FileReader;s.onload=function(e){r.decode(this.result).forEach((function(e){i.read(e)})),i.stop();var s=o.makeMetadataSeekable(i.metadatas,i.duration,i.cues),a=this.result.slice(i.metadataSize),n=new Blob([s,a],{type:"video/webm"});t(n)},s.readAsArrayBuffer(e)},i.bytesToSize=b,i.isElectron=v;var E={};function B(){if(p||g||u)return!0;var e,t,i=navigator.userAgent,r=""+parseFloat(navigator.appVersion),o=parseInt(navigator.appVersion,10);return(m||h)&&(e=i.indexOf("Chrome"),r=i.substring(e+7)),-1!==(t=r.indexOf(";"))&&(r=r.substring(0,t)),-1!==(t=r.indexOf(" "))&&(r=r.substring(0,t)),o=parseInt(""+r,10),isNaN(o)&&(r=""+parseFloat(navigator.appVersion),o=parseInt(navigator.appVersion,10)),o>=49}function C(e,t){var i=this;if(void 0===e)throw'First argument "MediaStream" is required.';if("undefined"==typeof MediaRecorder)throw"Your browser does not support the Media Recorder API. Please try other modules e.g. WhammyRecorder or StereoAudioRecorder.";if("audio"===(t=t||{mimeType:"video/webm"}).type){var r;if(w(e,"video").length&&w(e,"audio").length)navigator.mozGetUserMedia?(r=new f).addTrack(w(e,"audio")[0]):r=new f(w(e,"audio")),e=r;t.mimeType&&-1!==t.mimeType.toString().toLowerCase().indexOf("audio")||(t.mimeType=m?"audio/webm":"audio/ogg"),t.mimeType&&"audio/ogg"!==t.mimeType.toString().toLowerCase()&&navigator.mozGetUserMedia&&(t.mimeType="audio/ogg")}var o,s=[];function a(){i.timestamps.push((new Date).getTime()),"function"==typeof t.onTimeStamp&&t.onTimeStamp(i.timestamps[i.timestamps.length-1],i.timestamps)}function n(e){return o&&o.mimeType?o.mimeType:e.mimeType||"video/webm"}function A(){s=[],o=null,i.timestamps=[]}this.getArrayOfBlobs=function(){return s},this.record=function(){i.blob=null,i.clearRecordedData(),i.timestamps=[],d=[],s=[];var r=t;t.disableLogs||console.log("Passing following config over MediaRecorder API.",r),o&&(o=null),m&&!B()&&(r="video/vp8"),"function"==typeof MediaRecorder.isTypeSupported&&r.mimeType&&(MediaRecorder.isTypeSupported(r.mimeType)||(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",r.mimeType),r.mimeType="audio"===t.type?"audio/webm":"video/webm"));try{o=new MediaRecorder(e,r),t.mimeType=r.mimeType}catch(t){o=new MediaRecorder(e)}r.mimeType&&!MediaRecorder.isTypeSupported&&"canRecordMimeType"in o&&!1===o.canRecordMimeType(r.mimeType)&&(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",r.mimeType)),o.ondataavailable=function(e){if(e.data&&d.push("ondataavailable: "+b(e.data.size)),"number"!=typeof t.timeSlice)!e.data||!e.data.size||e.data.size<100||i.blob?i.recordingCallback&&(i.recordingCallback(new Blob([],{type:n(r)})),i.recordingCallback=null):(i.blob=t.getNativeBlob?e.data:new Blob([e.data],{type:n(r)}),i.recordingCallback&&(i.recordingCallback(i.blob),i.recordingCallback=null));else if(e.data&&e.data.size&&(s.push(e.data),a(),"function"==typeof t.ondataavailable)){var o=t.getNativeBlob?e.data:new Blob([e.data],{type:n(r)});t.ondataavailable(o)}},o.onstart=function(){d.push("started")},o.onpause=function(){d.push("paused")},o.onresume=function(){d.push("resumed")},o.onstop=function(){d.push("stopped")},o.onerror=function(e){e&&(e.name||(e.name="UnknownError"),d.push("error: "+e),t.disableLogs||(-1!==e.name.toString().toLowerCase().indexOf("invalidstate")?console.error("The MediaRecorder is not in a state in which the proposed operation is allowed to be executed.",e):-1!==e.name.toString().toLowerCase().indexOf("notsupported")?console.error("MIME type (",r.mimeType,") is not supported.",e):-1!==e.name.toString().toLowerCase().indexOf("security")?console.error("MediaRecorder security error",e):"OutOfMemory"===e.name?console.error("The UA has exhaused the available memory. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"IllegalStreamModification"===e.name?console.error("A modification to the stream has occurred that makes it impossible to continue recording. An example would be the addition of a Track while recording is occurring. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"OtherRecordingError"===e.name?console.error("Used for an fatal error other than those listed above. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"GenericError"===e.name?console.error("The UA cannot provide the codec or recording option that has been requested.",e):console.error("MediaRecorder Error",e)),function(e){if(!i.manuallyStopped&&o&&"inactive"===o.state)return delete t.timeslice,void o.start(6e5);setTimeout(void 0,1e3)}(),"inactive"!==o.state&&"stopped"!==o.state&&o.stop())},"number"==typeof t.timeSlice?(a(),o.start(t.timeSlice)):o.start(36e5),t.initCallback&&t.initCallback()},this.timestamps=[],this.stop=function(e){e=e||function(){},i.manuallyStopped=!0,o&&(this.recordingCallback=e,"recording"===o.state&&o.stop(),"number"==typeof t.timeSlice&&setTimeout((function(){i.blob=new Blob(s,{type:n(t)}),i.recordingCallback(i.blob)}),100))},this.pause=function(){o&&"recording"===o.state&&o.pause()},this.resume=function(){o&&"paused"===o.state&&o.resume()},this.clearRecordedData=function(){o&&"recording"===o.state&&i.stop(A),A()},this.getInternalRecorder=function(){return o},this.blob=null,this.getState=function(){return o&&o.state||"inactive"};var d=[];this.getAllStates=function(){return d},void 0===t.checkForInactiveTracks&&(t.checkForInactiveTracks=!1);i=this;!function r(){if(o&&!1!==t.checkForInactiveTracks)return!1===function(){if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}()?(t.disableLogs||console.log("MediaStream seems stopped."),void i.stop()):void setTimeout(r,1e3)}(),this.name="MediaStreamRecorder",this.toString=function(){return this.name}}function R(e,t){if(!w(e,"audio").length)throw"Your stream has no audio tracks.";var r,o=this,s=[],a=[],n=!1,A=0,d=2,c=(t=t||{}).desiredSampRate;function u(){if(!1===t.checkForInactiveTracks)return!0;if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}function h(e,t){function i(e,t){var i,r=e.numberOfAudioChannels,o=e.leftBuffers.slice(0),s=e.rightBuffers.slice(0),a=e.sampleRate,n=e.internalInterleavedLength,A=e.desiredSampRate;function d(e,t,i){var r=Math.round(e.length*(t/i)),o=[],s=Number((e.length-1)/(r-1));o[0]=e[0];for(var a=1;a96e3)&&(t.disableLogs||console.log("sample-rate must be under range 22050 and 96000.")),t.disableLogs||t.desiredSampRate&&console.log("Desired sample-rate: "+t.desiredSampRate);var y=!1;function v(){s=[],a=[],A=0,E=!1,n=!1,y=!1,p=null,o.leftchannel=s,o.rightchannel=a,o.numberOfAudioChannels=d,o.desiredSampRate=c,o.sampleRate=b,o.recordingLength=A,B={left:[],right:[],recordingLength:0}}function S(){r&&(r.onaudioprocess=null,r.disconnect(),r=null),m&&(m.disconnect(),m=null),v()}this.pause=function(){y=!0},this.resume=function(){if(!1===u())throw"Please make sure MediaStream is active.";if(!n)return t.disableLogs||console.log("Seems recording has been restarted."),void this.record();y=!1},this.clearRecordedData=function(){t.checkForInactiveTracks=!1,n&&this.stop(S),S()},this.name="StereoAudioRecorder",this.toString=function(){return this.name};var E=!1;r.onaudioprocess=function(e){if(!y)if(!1===u()&&(t.disableLogs||console.log("MediaStream seems stopped."),r.disconnect(),n=!1),n){E||(E=!0,t.onAudioProcessStarted&&t.onAudioProcessStarted(),t.initCallback&&t.initCallback());var i=e.inputBuffer.getChannelData(0),c=new Float32Array(i);if(s.push(c),2===d){var l=e.inputBuffer.getChannelData(1),h=new Float32Array(l);a.push(h)}A+=f,o.recordingLength=A,void 0!==t.timeSlice&&(B.recordingLength+=f,B.left.push(c),2===d&&B.right.push(h))}else m&&(m.disconnect(),m=null)},p.createMediaStreamDestination?r.connect(p.createMediaStreamDestination()):r.connect(p.destination),this.leftchannel=s,this.rightchannel=a,this.numberOfAudioChannels=d,this.desiredSampRate=c,this.sampleRate=b,o.recordingLength=A;var B={left:[],right:[],recordingLength:0};function C(){n&&"function"==typeof t.ondataavailable&&void 0!==t.timeSlice&&(B.left.length?(h({desiredSampRate:c,sampleRate:b,numberOfAudioChannels:d,internalInterleavedLength:B.recordingLength,leftBuffers:B.left,rightBuffers:1===d?[]:B.right},(function(e,i){var r=new Blob([i],{type:"audio/wav"});t.ondataavailable(r),setTimeout(C,t.timeSlice)})),B={left:[],right:[],recordingLength:0}):setTimeout(C,t.timeSlice))}}function k(e,t){if("undefined"==typeof html2canvas)throw"Please link: https://www.webrtc-experiment.com/screenshot.js";(t=t||{}).frameInterval||(t.frameInterval=10);var i=!1;["captureStream","mozCaptureStream","webkitCaptureStream"].forEach((function(e){e in document.createElement("canvas")&&(i=!0)}));var r,o,s,a=!(!window.webkitRTCPeerConnection&&!window.webkitGetUserMedia||!window.chrome),n=50,A=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);if(a&&A&&A[2]&&(n=parseInt(A[2],10)),a&&n<52&&(i=!1),t.useWhammyRecorder&&(i=!1),i)if(t.disableLogs||console.log("Your browser supports both MediRecorder API and canvas.captureStream!"),e instanceof HTMLCanvasElement)r=e;else{if(!(e instanceof CanvasRenderingContext2D))throw"Please pass either HTMLCanvasElement or CanvasRenderingContext2D.";r=e.canvas}else navigator.mozGetUserMedia&&(t.disableLogs||console.error("Canvas recording is NOT supported in Firefox."));this.record=function(){if(s=!0,i&&!t.useWhammyRecorder){var e;"captureStream"in r?e=r.captureStream(25):"mozCaptureStream"in r?e=r.mozCaptureStream(25):"webkitCaptureStream"in r&&(e=r.webkitCaptureStream(25));try{var a=new f;a.addTrack(w(e,"video")[0]),e=a}catch(e){}if(!e)throw"captureStream API are NOT available.";(o=new C(e,{mimeType:t.mimeType||"video/webm"})).record()}else h.frames=[],u=(new Date).getTime(),l();t.initCallback&&t.initCallback()},this.getWebPImages=function(i){if("canvas"===e.nodeName.toLowerCase()){var r=h.frames.length;h.frames.forEach((function(e,i){var o=r-i;t.disableLogs||console.log(o+"/"+r+" frames remaining"),t.onEncodingCallback&&t.onEncodingCallback(o,r);var s=e.image.toDataURL("image/webp",1);h.frames[i].image=s})),t.disableLogs||console.log("Generating WebM"),i()}else i()},this.stop=function(e){s=!1;var r=this;i&&o?o.stop(e):this.getWebPImages((function(){h.compile((function(i){t.disableLogs||console.log("Recording finished!"),r.blob=i,r.blob.forEach&&(r.blob=new Blob([],{type:"video/webm"})),e&&e(r.blob),h.frames=[]}))}))};var d=!1;function c(){h.frames=[],s=!1,d=!1}function l(){if(d)return u=(new Date).getTime(),setTimeout(l,500);if("canvas"===e.nodeName.toLowerCase()){var i=(new Date).getTime()-u;return u=(new Date).getTime(),h.frames.push({image:(r=document.createElement("canvas"),o=r.getContext("2d"),r.width=e.width,r.height=e.height,o.drawImage(e,0,0),r),duration:i}),void(s&&setTimeout(l,t.frameInterval))}var r,o;html2canvas(e,{grabMouse:void 0===t.showMousePointer||t.showMousePointer,onrendered:function(e){var i=(new Date).getTime()-u;if(!i)return setTimeout(l,t.frameInterval);u=(new Date).getTime(),h.frames.push({image:e.toDataURL("image/webp",1),duration:i}),s&&setTimeout(l,t.frameInterval)}})}this.pause=function(){d=!0,o instanceof C&&o.pause()},this.resume=function(){d=!1,o instanceof C?o.resume():s||this.record()},this.clearRecordedData=function(){s&&this.stop(c),c()},this.name="CanvasRecorder",this.toString=function(){return this.name};var u=(new Date).getTime(),h=new I.Video(100)}function T(e,t){function i(e){e=void 0!==e?e:10;var t=(new Date).getTime()-A;return t?s?(A=(new Date).getTime(),setTimeout(i,100)):(A=(new Date).getTime(),n.paused&&n.play(),l.drawImage(n,0,0,c.width,c.height),d.frames.push({duration:t,image:c.toDataURL("image/webp")}),void(o||setTimeout(i,e,e))):setTimeout(i,e,e)}function r(e,t,i,r,o){var s=document.createElement("canvas");s.width=c.width,s.height=c.height;var a,n,A,d=s.getContext("2d"),l=[],u=-1===t,h=t&&t>0&&t<=e.length?t:e.length,p=0,m=0,g=0,f=Math.sqrt(Math.pow(255,2)+Math.pow(255,2)+Math.pow(255,2)),b=i&&i>=0&&i<=1?i:0,y=r&&r>=0&&r<=1?r:0,v=!1;n=-1,A=(a={length:h,functionToLoop:function(t,i){var r,o,s,a=function(){!v&&s-r<=s*y||(u&&(v=!0),l.push(e[i])),t()};if(v)a();else{var n=new Image;n.onload=function(){d.drawImage(n,0,0,c.width,c.height);var e=d.getImageData(0,0,c.width,c.height);r=0,o=e.data.length,s=e.data.length/4;for(var t=0;t127)throw"TrackNumber > 127 not supported";return[128|e.trackNum,e.timecode>>8,255&e.timecode,t].map((function(e){return String.fromCharCode(e)})).join("")+e.frame}({discardable:0,frame:e.data.slice(4),invisible:0,keyframe:1,lacing:0,trackNum:1,timecode:Math.round(t)});return t+=e.duration,{data:i,id:163}})))}function i(e){for(var t=[];e>0;)t.push(255&e),e>>=8;return new Uint8Array(t.reverse())}function r(e){var t=[];e=(e.length%8?new Array(9-e.length%8).join("0"):"")+e;for(var i=0;i1?2*s[0].width:s[0].width;var n=1;3!==e&&4!==e||(n=2),5!==e&&6!==e||(n=3),7!==e&&8!==e||(n=4),9!==e&&10!==e||(n=5),o.height=s[0].height*n}else o.width=a.width||360,o.height=a.height||240;t&&t instanceof HTMLVideoElement&&u(t),s.forEach((function(e,t){u(e,t)})),setTimeout(l,a.frameInterval)}}function u(e,t){if(!r){var i=0,o=0,a=e.width,n=e.height;1===t&&(i=e.width),2===t&&(o=e.height),3===t&&(i=e.width,o=e.height),4===t&&(o=2*e.height),5===t&&(i=e.width,o=2*e.height),6===t&&(o=3*e.height),7===t&&(i=e.width,o=3*e.height),void 0!==e.stream.left&&(i=e.stream.left),void 0!==e.stream.top&&(o=e.stream.top),void 0!==e.stream.width&&(a=e.stream.width),void 0!==e.stream.height&&(n=e.stream.height),s.drawImage(e,i,o,a,n),"function"==typeof e.stream.onRender&&e.stream.onRender(s,i,o,a,n,t)}}function h(e){var i=document.createElement("video");return function(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}(e,i),i.className=t,i.muted=!0,i.volume=0,i.width=e.width||a.width||360,i.height=e.height||a.height||240,i.play(),i}function p(t){i=[],(t=t||e).forEach((function(e){if(e.getTracks().filter((function(e){return"video"===e.kind})).length){var t=h(e);t.stream=e,i.push(t)}}))}void 0!==n?c.AudioContext=n:"undefined"!=typeof webkitAudioContext&&(c.AudioContext=webkitAudioContext),this.startDrawingFrames=function(){l()},this.appendStreams=function(t){if(!t)throw"First parameter is required.";t instanceof Array||(t=[t]),t.forEach((function(t){var r=new d;if(t.getTracks().filter((function(e){return"video"===e.kind})).length){var o=h(t);o.stream=t,i.push(o),r.addTrack(t.getTracks().filter((function(e){return"video"===e.kind}))[0])}if(t.getTracks().filter((function(e){return"audio"===e.kind})).length){var s=a.audioContext.createMediaStreamSource(t);a.audioDestination=a.audioContext.createMediaStreamDestination(),s.connect(a.audioDestination),r.addTrack(a.audioDestination.stream.getTracks().filter((function(e){return"audio"===e.kind}))[0])}e.push(r)}))},this.releaseStreams=function(){i=[],r=!0,a.gainNode&&(a.gainNode.disconnect(),a.gainNode=null),a.audioSources.length&&(a.audioSources.forEach((function(e){e.disconnect()})),a.audioSources=[]),a.audioDestination&&(a.audioDestination.disconnect(),a.audioDestination=null),a.audioContext&&a.audioContext.close(),a.audioContext=null,s.clearRect(0,0,o.width,o.height),o.stream&&(o.stream.stop(),o.stream=null)},this.resetVideoStreams=function(e){!e||e instanceof Array||(e=[e]),p(e)},this.name="MultiStreamsMixer",this.toString=function(){return this.name},this.getMixedStream=function(){r=!1;var t=function(){var e;p(),"captureStream"in o?e=o.captureStream():"mozCaptureStream"in o?e=o.mozCaptureStream():a.disableLogs||console.error("Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features");var t=new d;return e.getTracks().filter((function(e){return"video"===e.kind})).forEach((function(e){t.addTrack(e)})),o.stream=t,t}(),i=function(){c.AudioContextConstructor||(c.AudioContextConstructor=new c.AudioContext);a.audioContext=c.AudioContextConstructor,a.audioSources=[],!0===a.useGainNode&&(a.gainNode=a.audioContext.createGain(),a.gainNode.connect(a.audioContext.destination),a.gainNode.gain.value=0);var t=0;if(e.forEach((function(e){if(e.getTracks().filter((function(e){return"audio"===e.kind})).length){t++;var i=a.audioContext.createMediaStreamSource(e);!0===a.useGainNode&&i.connect(a.gainNode),a.audioSources.push(i)}})),!t)return;return a.audioDestination=a.audioContext.createMediaStreamDestination(),a.audioSources.forEach((function(e){e.connect(a.audioDestination)})),a.audioDestination.stream}();return i&&i.getTracks().filter((function(e){return"audio"===e.kind})).forEach((function(e){t.addTrack(e)})),e.forEach((function(e){e.fullcanvas})),t}}function L(e,t){e=e||[];var i,r,o=this;(t=t||{elementClass:"multi-streams-mixer",mimeType:"video/webm",video:{width:360,height:240}}).frameInterval||(t.frameInterval=10),t.video||(t.video={}),t.video.width||(t.video.width=360),t.video.height||(t.video.height=240),this.record=function(){var o;i=new j(e,t.elementClass||"multi-streams-mixer"),(o=[],e.forEach((function(e){w(e,"video").forEach((function(e){o.push(e)}))})),o).length&&(i.frameInterval=t.frameInterval||10,i.width=t.video.width||360,i.height=t.video.height||240,i.startDrawingFrames()),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()),(r=new C(i.getMixedStream(),t)).record()},this.stop=function(e){r&&r.stop((function(t){o.blob=t,e(t),o.clearRecordedData()}))},this.pause=function(){r&&r.pause()},this.resume=function(){r&&r.resume()},this.clearRecordedData=function(){r&&(r.clearRecordedData(),r=null),i&&(i.releaseStreams(),i=null)},this.addStreams=function(o){if(!o)throw"First parameter is required.";o instanceof Array||(o=[o]),e.concat(o),r&&i&&(i.appendStreams(o),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()))},this.resetVideoStreams=function(e){i&&(!e||e instanceof Array||(e=[e]),i.resetVideoStreams(e))},this.getMixer=function(){return i},this.name="MultiStreamRecorder",this.toString=function(){return this.name}}function F(e,t){var i,r,o;function s(){return new ReadableStream({start:function(r){var o=document.createElement("canvas"),s=document.createElement("video"),a=!0;s.srcObject=e,s.muted=!0,s.height=t.height,s.width=t.width,s.volume=0,s.onplaying=function(){o.width=t.width,o.height=t.height;var e=o.getContext("2d"),n=1e3/t.frameRate,A=setInterval((function(){if(i&&(clearInterval(A),r.close()),a&&(a=!1,t.onVideoProcessStarted&&t.onVideoProcessStarted()),e.drawImage(s,0,0),"closed"!==r._controlledReadableStream.state)try{r.enqueue(e.getImageData(0,0,t.width,t.height))}catch(e){}}),n)},s.play()}})}function a(e,A){if(!t.workerPath&&!A)return i=!1,void fetch("https://unpkg.com/webm-wasm@latest/dist/webm-worker.js").then((function(t){t.arrayBuffer().then((function(t){a(e,t)}))}));if(!t.workerPath&&A instanceof ArrayBuffer){var d=new Blob([A],{type:"text/javascript"});t.workerPath=l.createObjectURL(d)}t.workerPath||console.error("workerPath parameter is missing."),(r=new Worker(t.workerPath)).postMessage(t.webAssemblyPath||"https://unpkg.com/webm-wasm@latest/dist/webm-wasm.wasm"),r.addEventListener("message",(function(e){"READY"===e.data?(r.postMessage({width:t.width,height:t.height,bitrate:t.bitrate||1200,timebaseDen:t.frameRate||30,realtime:t.realtime}),s().pipeTo(new WritableStream({write:function(e){i?console.error("Got image, but recorder is finished!"):r.postMessage(e.data.buffer,[e.data.buffer])}}))):e.data&&(o||n.push(e.data))}))}"undefined"!=typeof ReadableStream&&"undefined"!=typeof WritableStream||console.error("Following polyfill is strongly recommended: https://unpkg.com/@mattiasbuelens/web-streams-polyfill/dist/polyfill.min.js"),(t=t||{}).width=t.width||640,t.height=t.height||480,t.frameRate=t.frameRate||30,t.bitrate=t.bitrate||1200,t.realtime=t.realtime||!0,this.record=function(){n=[],o=!1,this.blob=null,a(e),"function"==typeof t.initCallback&&t.initCallback()},this.pause=function(){o=!0},this.resume=function(){o=!1};var n=[];this.stop=function(e){i=!0;var t=this;!function(e){r?(r.addEventListener("message",(function(t){null===t.data&&(r.terminate(),r=null,e&&e())})),r.postMessage(null)):e&&e()}((function(){t.blob=new Blob(n,{type:"video/webm"}),e(t.blob)}))},this.name="WebAssemblyRecorder",this.toString=function(){return this.name},this.clearRecordedData=function(){n=[],o=!1,this.blob=null},this.blob=null}i.DiskStorage=x,i.GifRecorder=D,i.MultiStreamRecorder=L,i.RecordRTCPromisesHandler=function(e,t){if(!this)throw'Use "new RecordRTCPromisesHandler()"';if(void 0===e)throw'First argument "MediaStream" is required.';var r=this;r.recordRTC=new i(e,t),this.startRecording=function(){return new Promise((function(e,t){try{r.recordRTC.startRecording(),e()}catch(e){t(e)}}))},this.stopRecording=function(){return new Promise((function(e,t){try{r.recordRTC.stopRecording((function(i){r.blob=r.recordRTC.getBlob(),r.blob&&r.blob.size?e(i):t("Empty blob.",r.blob)}))}catch(e){t(e)}}))},this.pauseRecording=function(){return new Promise((function(e,t){try{r.recordRTC.pauseRecording(),e()}catch(e){t(e)}}))},this.resumeRecording=function(){return new Promise((function(e,t){try{r.recordRTC.resumeRecording(),e()}catch(e){t(e)}}))},this.getDataURL=function(e){return new Promise((function(e,t){try{r.recordRTC.getDataURL((function(t){e(t)}))}catch(e){t(e)}}))},this.getBlob=function(){return new Promise((function(e,t){try{e(r.recordRTC.getBlob())}catch(e){t(e)}}))},this.getInternalRecorder=function(){return new Promise((function(e,t){try{e(r.recordRTC.getInternalRecorder())}catch(e){t(e)}}))},this.reset=function(){return new Promise((function(e,t){try{e(r.recordRTC.reset())}catch(e){t(e)}}))},this.destroy=function(){return new Promise((function(e,t){try{e(r.recordRTC.destroy())}catch(e){t(e)}}))},this.getState=function(){return new Promise((function(e,t){try{e(r.recordRTC.getState())}catch(e){t(e)}}))},this.blob=null,this.version="5.6.2"},i.WebAssemblyRecorder=F}));class $e extends Ve{constructor(e){super(),this.player=e,this.fileName="",this.fileType=e._opt.recordType||c,this.isRecording=!1,this.recordingTimestamp=0,this.recordingInterval=null,e.debug.log("Recorder","init")}destroy(){this._reset(),this.player.debug.log("Recorder","destroy")}setFileName(e,t){this.fileName=e,d!==t&&c!==t||(this.fileType=t)}get recording(){return this.isRecording}get recordTime(){return this.recordingTimestamp}startRecord(){const e=this.player.debug,t={type:"video",mimeType:"video/webm;codecs=h264",onTimeStamp:t=>{e.log("Recorder","record timestamp :"+t)},disableLogs:!this.player._opt.debug};try{const e=this.player.video.$videoElement.captureStream(25);if(this.player.audio&&this.player.audio.mediaStreamAudioDestinationNode&&this.player.audio.mediaStreamAudioDestinationNode.stream&&!this.player.audio.isStateSuspended()&&this.player.audio.hasAudio&&this.player._opt.hasAudio){const t=this.player.audio.mediaStreamAudioDestinationNode.stream;if(t.getAudioTracks().length>0){const i=t.getAudioTracks()[0];i&&i.enabled&&e.addTrack(i)}}this.recorder=_e(e,t)}catch(t){e.error("Recorder","startRecord error",t),this.emit(j.recordCreateError)}this.recorder&&(this.isRecording=!0,this.player.emit(j.recording,!0),this.recorder.startRecording(),e.log("Recorder","start recording"),this.player.emit(j.recordStart),this.recordingInterval=window.setInterval((()=>{this.recordingTimestamp+=1,this.player.emit(j.recordingTimestamp,this.recordingTimestamp)}),1e3))}stopRecordAndSave(){this.recorder&&this.isRecording&&this.recorder.stopRecording((()=>{this.player.debug.log("Recorder","stop recording"),this.player.emit(j.recordEnd);const e=(this.fileName||ve())+"."+(this.fileType||c);Ge(this.recorder.getBlob(),e),this._reset(),this.player.emit(j.recording,!1)}))}_reset(){this.isRecording=!1,this.recordingTimestamp=0,this.recorder&&(this.recorder.destroy(),this.recorder=null),this.fileName=null,this.recordingInterval&&clearInterval(this.recordingInterval),this.recordingInterval=null}}class et{constructor(e){return new(et.getLoaderFactory())(e)}static getLoaderFactory(){return $e}}class tt{constructor(e){this.player=e,this.decoderWorker=new Worker(e._opt.decoder),this._initDecoderWorker(),e.debug.log("decoderWorker","init")}async destroy(){this.decoderWorker.postMessage({cmd:x}),this.decoderWorker.terminate(),this.decoderWorker=null,this.player.debug.log("decoderWorker","destroy")}_initDecoderWorker(){const{debug:e,events:{proxy:t}}=this.player;this.decoderWorker.onmessage=t=>{const i=t.data;switch(i.cmd){case p:e.log("decoderWorker","onmessage:",p),this.player.loaded||this.player.emit(j.load),this.player.emit(j.decoderWorkerInit),this._initWork();break;case v:e.log("decoderWorker","onmessage:",v,i.code),this.player._times.decodeStart||(this.player._times.decodeStart=ve()),this.player.video.updateVideoInfo({encTypeCode:i.code});break;case y:e.log("decoderWorker","onmessage:",y,i.code),this.player.audio&&this.player.audio.updateAudioInfo({encTypeCode:i.code});break;case m:if(e.log("decoderWorker","onmessage:",m,`width:${i.w},height:${i.h}`),this.player.video.updateVideoInfo({width:i.w,height:i.h}),!this.player._opt.openWebglAlignment&&i.w/2%4!=0)return void this.player.emit(F.webglAlignmentError);this.player.video.initCanvasViewSize();break;case b:e.log("decoderWorker","onmessage:",b,`channels:${i.channels},sampleRate:${i.sampleRate}`),this.player.audio&&(this.player.audio.updateAudioInfo(i),this.player.audio.initScriptNode(i));break;case g:this.player.handleRender(),this.player.video.render(i),this.player.emit(j.timeUpdate,i.ts),this.player.updateStats({fps:!0,ts:i.ts,buf:i.delay}),this.player._times.videoStart||(this.player._times.videoStart=ve(),this.player.handlePlayToRenderTimes());break;case f:this.player.playing&&this.player.audio&&this.player.audio.play(i.buffer,i.ts);break;case w:i.message&&-1!==i.message.indexOf(S)&&this.player.emitError(F.wasmDecodeError);break;default:this.player[i.cmd]&&this.player[i.cmd](i)}}}_initWork(){const e={debug:this.player._opt.debug,useOffscreen:this.player._opt.useOffscreen,useWCS:this.player._opt.useWCS,videoBuffer:this.player._opt.videoBuffer,videoBufferDelay:this.player._opt.videoBufferDelay,openWebglAlignment:this.player._opt.openWebglAlignment};this.decoderWorker.postMessage({cmd:k,opt:JSON.stringify(e),sampleRate:this.player.audio&&this.player.audio.audioContext.sampleRate||0})}decodeVideo(e,t,i){const r={type:B,ts:Math.max(t,0),isIFrame:i};this.decoderWorker.postMessage({cmd:T,buffer:e,options:r},[e.buffer])}decodeAudio(e,t){this.player._opt.useWCS||this.player._opt.useMSE?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t)}_decodeAudio(e,t){const i={type:E,ts:Math.max(t,0)};this.decoderWorker.postMessage({cmd:T,buffer:e,options:i},[e.buffer])}_decodeAudioNoDelay(e,t){this.decoderWorker.postMessage({cmd:I,buffer:e,ts:Math.max(t,0)},[e.buffer])}updateWorkConfig(e){this.decoderWorker.postMessage({cmd:D,key:e.key,value:e.value})}}class it extends Ve{constructor(e){super(),this.player=e,this.stopId=null,this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.bufferList=[],this.dropping=!1,this.initInterval()}destroy(){this.stopId&&(clearInterval(this.stopId),this.stopId=null),this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.bufferList=[],this.dropping=!1,this.off(),this.player.debug.log("CommonDemux","destroy")}getDelay(e){if(!e)return-1;if(this.firstTimestamp){if(e){const t=Date.now()-this.startTimestamp,i=e-this.firstTimestamp;this.delay=t>=i?t-i:i-t}}else this.firstTimestamp=e,this.startTimestamp=Date.now(),this.delay=-1;return this.delay}resetDelay(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1}initInterval(){this.player.debug.log("common dumex","init Interval");let e=()=>{let e;const t=this.player._opt.videoBuffer,i=this.player._opt.videoBufferDelay;if(this.player._opt.useMSE&&this.player.mseDecoder&&this.player.mseDecoder.getSourceBufferUpdating())this.player.debug.warn("CommonDemux",`_loop getSourceBufferUpdating is true and bufferList length is ${this.bufferList.length}`);else if(this.bufferList.length)if(this.dropping){for(e=this.bufferList.shift(),e.type===E&&0===e.payload[1]&&this._doDecoderDecode(e);!e.isIFrame&&this.bufferList.length;)e=this.bufferList.shift(),e.type===E&&0===e.payload[1]&&this._doDecoderDecode(e);e.isIFrame&&this.getDelay(e.ts)<=Math.min(t,200)&&(this.dropping=!1,this._doDecoderDecode(e))}else e=this.bufferList[0],-1===this.getDelay(e.ts)?(this.bufferList.shift(),this._doDecoderDecode(e)):this.delay>t+i?(this.resetDelay(),this.dropping=!0):(e=this.bufferList[0],this.getDelay(e.ts)>t&&(this.bufferList.shift(),this._doDecoderDecode(e)))};e(),this.stopId=setInterval(e,10)}_doDecode(e,t,i,r,o){const s=this.player;let a={ts:i,cts:o,type:t,isIFrame:!1};s._opt.useWCS&&!s._opt.useOffscreen||s._opt.useMSE?(t===B&&(a.isIFrame=r),this.pushBuffer(e,a)):t===B?s.decoderWorker&&s.decoderWorker.decodeVideo(e,i,r):t===E&&s._opt.hasAudio&&s.decoderWorker&&s.decoderWorker.decodeAudio(e,i)}_doDecoderDecode(e){const t=this.player,{webcodecsDecoder:i,mseDecoder:r}=t;e.type===E?t._opt.hasAudio&&t.decoderWorker&&t.decoderWorker.decodeAudio(e.payload,e.ts):e.type===B&&(t._opt.useWCS&&!t._opt.useOffscreen?i.decodeVideo(e.payload,e.ts,e.isIFrame):t._opt.useMSE&&r.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts))}pushBuffer(e,t){t.type===E?this.bufferList.push({ts:t.ts,payload:e,type:E}):t.type===B&&this.bufferList.push({ts:t.ts,cts:t.cts,payload:e,type:B,isIFrame:t.isIFrame})}close(){}_decodeEnhancedH265Video(e,t){const i=e[0],r=48&i,o=15&i,s=e.slice(1,5),a=new ArrayBuffer(4),n=new Uint32Array(a),A="a"==String.fromCharCode(s[0]);if(o===le){if(r===pe){const t=e.slice(5);if(!A){const e=new Uint8Array(5+t.length);e.set([28,0,0,0,0],0),e.set(t,5),this._doDecode(e,B,0,!0,0)}}}else if(o===ue){let i=e,o=0;const s=r===pe;if(!A){n[0]=e[4],n[1]=e[3],n[2]=e[2],n[3]=0,o=n[0];i=Fe(e.slice(8),s),this._doDecode(i,B,t,s,o)}}else if(o===he){const i=r===pe;let o=Fe(e.slice(5),i);this._doDecode(o,B,t,i,0)}}_isEnhancedH265Header(e){return 128==(128&e)}}class rt extends it{constructor(e){super(e),this.input=this._inputFlv(),this.flvDemux=this.dispatchFlvData(this.input),e.debug.log("FlvDemux","init")}destroy(){super.destroy(),this.input=null,this.flvDemux=null,this.player.debug.log("FlvDemux","destroy")}dispatch(e){this.flvDemux(e)}*_inputFlv(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),i=new Uint32Array(e),r=this.player;for(;;){t[3]=0;const e=yield 15,o=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const s=i[0];t[0]=e[10],t[1]=e[9],t[2]=e[8];let a=i[0];16777215===a&&(t[3]=e[11],a=i[0]);const n=yield s;switch(o){case C:r._opt.hasAudio&&(r.updateStats({abps:n.byteLength}),n.byteLength>0&&this._doDecode(n,E,a));break;case R:if(r._times.demuxStart||(r._times.demuxStart=ve()),r._opt.hasVideo){r.updateStats({vbps:n.byteLength});const e=n[0];if(this._isEnhancedH265Header(e))this._decodeEnhancedH265Video(n,a);else{const e=n[0]>>4==1;if(n.byteLength>0){i[0]=n[4],i[1]=n[3],i[2]=n[2],i[3]=0;let t=i[0];this._doDecode(n,B,a,e,t)}}}}}}dispatchFlvData(e){let t=e.next(),i=null;return r=>{let o=new Uint8Array(r);if(i){let e=new Uint8Array(i.length+o.length);e.set(i),e.set(o,i.length),o=e,i=null}for(;o.length>=t.value;){let i=o.slice(t.value);t=e.next(o.slice(0,t.value)),o=i}o.length>0&&(i=o)}}close(){this.input&&this.input.return(null)}}class ot extends it{constructor(e){super(e),e.debug.log("M7sDemux","init")}destroy(){super.destroy(),this.player.debug.log("M7sDemux","destroy"),this.player=null}dispatch(e){const t=this.player,i=new DataView(e),r=i.getUint8(0),o=i.getUint32(1,!1),s=new ArrayBuffer(4),a=new Uint32Array(s);switch(r){case E:if(t._opt.hasAudio){const i=new Uint8Array(e,5);t.updateStats({abps:i.byteLength}),i.byteLength>0&&this._doDecode(i,r,o)}break;case B:if(t._opt.hasVideo)if(t._times.demuxStart||(t._times.demuxStart=ve()),i.byteLength>5){const s=new Uint8Array(e,5),n=s[0];if(this._isEnhancedH265Header(n))this._decodeEnhancedH265Video(s,o);else{const e=i.getUint8(5)>>4==1;t.updateStats({vbps:s.byteLength}),a[0]=s[4],a[1]=s[3],a[2]=s[2],a[3]=0;let n=a[0];this._doDecode(s,r,o,e,n)}}else this.player.debug.warn("M7sDemux","dispatch","dv byteLength is",i.byteLength)}}}class st{constructor(e){return new(st.getLoaderFactory(e._opt.demuxType))(e)}static getLoaderFactory(e){return e===A?ot:e===n?rt:void 0}}class at{constructor(e){this.TAG="ExpGolomb",this._buffer=e,this._buffer_index=0,this._total_bytes=e.byteLength,this._total_bits=8*e.byteLength,this._current_word=0,this._current_word_bits_left=0}destroy(){this._buffer=null}_fillCurrentWord(){let e=this._total_bytes-this._buffer_index,t=Math.min(4,e),i=new Uint8Array(4);i.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(i.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t}readBits(e){if(e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let i=e-this._current_word_bits_left;this._fillCurrentWord();let r=Math.min(i,this._current_word_bits_left),o=this._current_word>>>32-r;return this._current_word<<=r,this._current_word_bits_left-=r,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}class nt{static _ebsp2rbsp(e){let t=e,i=t.byteLength,r=new Uint8Array(i),o=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(r[o]=t[e],o++);return new Uint8Array(r.buffer,0,o)}static parseSPS(e){let t=nt._ebsp2rbsp(e),i=new at(t);i.readByte();let r=i.readByte();i.readByte();let o=i.readByte();i.readUEG();let s=nt.getProfileString(r),a=nt.getLevelString(o),n=1,A=420,d=[0,420,422,444],c=8;if((100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r||138===r||144===r)&&(n=i.readUEG(),3===n&&i.readBits(1),n<=3&&(A=d[n]),c=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool())){let e=3!==n?8:12;for(let t=0;t0&&e<16?(v=t[e-1],w=r[e-1]):255===e&&(v=i.readByte()<<8|i.readByte(),w=i.readByte()<<8|i.readByte())}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool()&&i.readBits(24)),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool()){let e=i.readBits(32),t=i.readBits(32);E=i.readBool(),B=t,C=2*e,S=B/C}}let R=1;1===v&&1===w||(R=v/w);let k=0,T=0;if(0===n)k=1,T=2-m;else{k=3===n?1:2,T=(1===n?2:1)*(2-m)}let I=16*(h+1),x=16*(p+1)*(2-m);I-=(g+f)*k,x-=(b+y)*T;let D=Math.ceil(I*R);return i.destroy(),i=null,{profile_string:s,level_string:a,bit_depth:c,ref_frames:u,chroma_format:A,chroma_format_string:nt.getChromaFormatString(A),frame_rate:{fixed:E,fps:S,fps_den:C,fps_num:B},sar_ratio:{width:v,height:w},codec_size:{width:I,height:x},present_size:{width:D,height:x}}}static _skipScalingList(e,t){let i=8,r=8,o=0;for(let s=0;s ${t.codecWidth}, height ${i.height}-> ${t.codecHeight}`),void this.player.emit(F.webcodecsWidthOrHeightChange)}if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){const r=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:i?Z:K});this.player.emit(j.timeUpdate,t);try{if(this.isDecodeStateClosed())return void this.player.debug.warn("Webcodecs","VideoDecoder isDecodeStateClosed true");this.decoder.decode(r)}catch(e){this.player.debug.error("Webcodecs","VideoDecoder",e),(-1!==e.toString().indexOf(ae)||-1!==e.toString().indexOf(ne))&&this.player.emitError(F.webcodecsDecodeError)}}else this.player.debug.warn("Webcodecs","VideoDecoder isDecodeFirstIIframe false")}else if(i&&0===e[1]){const t=15&e[0];if(this.player.video.updateVideoInfo({encTypeCode:t}),t===J)return void this.emit(F.webcodecsH265NotSupport);this.player._times.decodeStart||(this.player._times.decodeStart=ve());const i=function(e){let t=e.subarray(1,4),i="avc1.";for(let e=0;e<3;e++){let r=t[e].toString(16);r.length<2&&(r="0"+r),i+=r}return{codec:i,description:e}}(e.slice(5));this.player.debug.log("Webcodecs","VideoDecoder configure",i);try{this.decoder.configure(i)}catch(e){return this.player.debug.error("Webcodecs","VideoDecoder configure",e),void this.player.emit(F.webcodecsConfigureError)}this.hasInit=!0}}isDecodeStateClosed(){return"closed"===this.decoder.state}}const ct={play:"播放",pause:"暂停",audio:"",mute:"",screenshot:"截图",loading:"加载",fullscreen:"全屏",fullscreenExit:"退出全屏",record:"录制",recordStop:"停止录制"};var lt=Object.keys(ct).reduce(((e,t)=>(e[t]=`\n \n ${ct[t]?`${ct[t]}`:""}\n`,e)),{}),ut=(e,t)=>{const{events:{proxy:i}}=e,r=document.createElement("object");r.setAttribute("aria-hidden","true"),r.setAttribute("tabindex",-1),r.type="text/html",r.data="about:blank",Se(r,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"});let o=e.width,s=e.height;i(r,"load",(()=>{i(r.contentDocument.defaultView,"resize",(()=>{e.width===o&&e.height===s||(o=e.width,s=e.height,e.emit(j.resize),n())}))})),e.$container.appendChild(r),e.on(j.destroy,(()=>{e.$container.removeChild(r)})),e.on(j.volumechange,(()=>{!function(e){if(0===e)Se(t.$volumeOn,"display","none"),Se(t.$volumeOff,"display","flex"),Se(t.$volumeHandle,"top","48px");else if(t.$volumeHandle&&t.$volumePanel){const i=Ee(t.$volumePanel,"height")||60,r=Ee(t.$volumeHandle,"height"),o=i-(i-r)*e-r;Se(t.$volumeHandle,"top",`${o}px`),Se(t.$volumeOn,"display","flex"),Se(t.$volumeOff,"display","none")}t.$volumePanelText&&(t.$volumePanelText.innerHTML=parseInt(100*e))}(e.volume)})),e.on(j.loading,(e=>{Se(t.$loading,"display",e?"flex":"none"),Se(t.$poster,"display","none"),e&&Se(t.$playBig,"display","none")}));const a=i=>{let r=Ie(i)?i:e.fullscreen;Se(t.$fullscreenExit,"display",r?"flex":"none"),Se(t.$fullscreen,"display",r?"none":"flex")},n=()=>{Re()&&t.$controls&&e._opt.useWebFullScreen&&setTimeout((()=>{if(e.fullscreen){let i=e.height/2-e.width+19,r=e.height/2-19;t.$controls.style.transform=`translateX(${-i}px) translateY(-${r}px) rotate(-90deg)`}else t.$controls.style.transform="translateX(0) translateY(0) rotate(0)"}),10)};try{fe.on("change",a),e.events.destroys.push((()=>{fe.off("change",a)}))}catch(e){}e.on(j.webFullscreen,(e=>{a(e),n()})),e.on(j.recording,(()=>{Se(t.$record,"display",e.recording?"none":"flex"),Se(t.$recordStop,"display",e.recording?"flex":"none"),Se(t.$recording,"display",e.recording?"flex":"none"),!e.recording&&t.$recordingTime&&(t.$recordingTime.innerHTML=De(0))})),e.on(j.recordingTimestamp,(e=>{t.$recordingTime&&(t.$recordingTime.innerHTML=De(e))})),e.on(j.playing,(e=>{Se(t.$play,"display",e?"none":"flex"),Se(t.$playBig,"display",e?"none":"block"),Se(t.$pause,"display",e?"flex":"none"),Se(t.$screenshot,"display",e?"flex":"none"),Se(t.$record,"display",e?"flex":"none"),Se(t.$qualityMenu,"display",e?"flex":"none"),Se(t.$volume,"display",e?"flex":"none"),a(),e||t.$speed&&(t.$speed.innerHTML=ke(""))})),e.on(j.kBps,(e=>{const i=ke(e);t.$speed&&(t.$speed.innerHTML=i)}))};function ht(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}ht('@keyframes rotation{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes magentaPulse{0%{background-color:#630030;-webkit-box-shadow:0 0 9px #333}50%{background-color:#a9014b;-webkit-box-shadow:0 0 18px #a9014b}to{background-color:#630030;-webkit-box-shadow:0 0 9px #333}}.jessibuca-container .jessibuca-icon{cursor:pointer;width:16px;height:16px}.jessibuca-container .jessibuca-poster{position:absolute;z-index:10;left:0;top:0;right:0;bottom:0;height:100%;width:100%;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jessibuca-container .jessibuca-play-big{position:absolute;display:none;height:100%;width:100%;background:rgba(0,0,0,.4)}.jessibuca-container .jessibuca-play-big:after{cursor:pointer;content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;width:48px;height:48px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACgklEQVRoQ+3ZPYsTQRjA8eeZZCFlWttAwCIkZOaZJt8hlvkeHrlccuAFT6wEG0FQOeQQLCIWih6chQgKgkkKIyqKCVYip54IWmiQkTmyYhFvd3Zn3yDb7szu/7cv7GaDkPEFM94PK0DSZ9DzDAyHw7uI2HRDlVJX5/N5r9FoHCYdr/fvCRiNRmpJ6AEidoUQ15NG+AH8BgD2n9AHANAmohdJQfwAfgGA4xF4bjabnW21Whob62ILoKNfAsAGEd2PU2ATcNSNiDf0/cE5/xAHxDpgEf0NADaJ6HLUiKgAbvcjpdSGlPJZVJCoAUfdSqkLxWLxTLlc/mkbEgtgET1TSnWklLdtIuIEuN23crlcp16vv7cBSQKgu38AwBYRXQyLSArg3hsjRDxNRE+CQhIF/BN9qVAobFYqle+mkLQAdLd+8K0T0U0TRJoAbvc9fVkJId75gaQRoLv1C2STiPTb7rFLWgE6+g0RncwyYEJEtawCvjDGmpzzp5kD6NfxfD7frtVqB17xen2a7oG3ALBm+oMoFQBEPD+dTvtBfpImDXjIGFvjnD/3c7ksG5MU4HDxWeZa0HB3XhKAXcdxOn5vUi9gnIDXSqm2lHLPK8pkfVyAbSLqm4T5HRs1YB8RO0KIid8g03FRAT4rpbpSyh3TINPxUQB2GGM9zvkn05gg420CJovLZT9ISNA5tgB9ItoOGhFmnh/AcZ/X9xhj65zzV2Eiwsz1A1j2B8dHAOgS0W6YnduY6wkYj8d3lFKn/j66Ea84jtOrVqtfbQSE3YYnYDAY5Eql0hYAnNDv6kKIx2F3anO+J8DmzqLY1goQxVE12ebqDJgcrSjGrs5AFEfVZJt/AF0m+jHzUTtnAAAAAElFTkSuQmCC");background-repeat:no-repeat;background-position:50%}.jessibuca-container .jessibuca-play-big:hover:after{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACEElEQVRoQ+2ZXStEQRjH/3/yIXwDdz7J+i7kvdisXCk3SiFJW27kglBcSFFKbqwQSa4krykuKB09Naf2Yndn5jgzc06d53Znd36/mWfeniVyHsw5PwqB0DOonYEoijYBlOpAFwCMkHwLDS/9mwhEDUCfAAyTXA4tYSLwC6CtCegegH6S56FETAR+AHRoACcBTJAUWa+RloBAXwAYIrnt0yBNgZi7qtbHgw8RFwLC/QFglOScawlXAjH3gUqrE1cirgVi7mkAYyS/0xbxJSDcdwAGSa6nKeFTIOZeUyL3aYiEEBDuLwDjJGf+KxFKIOY+BdBL8iipSGiBmHtWbbuftiJZERBuOfgGSK7aSGRJIObeUml1ayKSRQHhlgtkiaTcdltGVgUE+ppkV54FaiS78yrwqlLoOI8Cch2XV548W7WRpTVwA6DP9kGUFYEpAOUkT9LQAvtq1M+0udKkQSgBqSlJWWYxKXj8vRACK+o6bbRIdYI+Ba7U7rKjg7L53JdAhWTZBsy0rWuBXZUuNVMg23auBF7UIl2yBbJt70JAoKV6/WwLk6R9mgKSJlJ1kLTxFmkJyCla8UZd15GJQKvyumyJ8gy8DAEvfZoINPqD41EtUjmUgoaJwAaAnjrKebVI34OSq85NBNqlCAWgE0CV5GEWwI3vQlmCbcSinYFCwPEIFDPgeIC1P1/MgHaIHDf4Aydx2TF7wnKeAAAAAElFTkSuQmCC")}.jessibuca-container .jessibuca-recording{display:none;position:absolute;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:95px;height:20px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jessibuca-container .jessibuca-recording .jessibuca-recording-red-point{width:8px;height:8px;background:#ff1f1f;border-radius:50%;animation:magentaPulse 1s linear infinite}.jessibuca-container .jessibuca-recording .jessibuca-recording-time{font-size:14px;font-weight:500;color:#ddd}.jessibuca-container .jessibuca-recording .jessibuca-icon-recordStop{width:16px;height:16px;cursor:pointer}.jessibuca-container .jessibuca-loading{display:none;flex-direction:column;justify-content:center;align-items:center;position:absolute;z-index:20;left:0;top:0;right:0;bottom:0;width:100%;height:100%;pointer-events:none}.jessibuca-container .jessibuca-loading-text{line-height:20px;font-size:13px;color:#fff;margin-top:10px}.jessibuca-container .jessibuca-controls{background-color:#161616;box-sizing:border-box;display:flex;flex-direction:column;justify-content:flex-end;position:absolute;z-index:40;left:0;right:0;bottom:0;height:38px;width:100%;padding-left:13px;padding-right:13px;font-size:14px;color:#fff;opacity:0;visibility:hidden;-webkit-user-select:none;user-select:none}.jessibuca-container .jessibuca-controls .jessibuca-controls-item{position:relative;display:flex;justify-content:center;padding:0 8px}.jessibuca-container .jessibuca-controls .jessibuca-controls-item:hover .icon-title-tips{visibility:visible;opacity:1}.jessibuca-container .jessibuca-controls .jessibuca-fullscreen,.jessibuca-container .jessibuca-controls .jessibuca-fullscreen-exit,.jessibuca-container .jessibuca-controls .jessibuca-icon-audio,.jessibuca-container .jessibuca-controls .jessibuca-microphone-close,.jessibuca-container .jessibuca-controls .jessibuca-pause,.jessibuca-container .jessibuca-controls .jessibuca-play,.jessibuca-container .jessibuca-controls .jessibuca-record,.jessibuca-container .jessibuca-controls .jessibuca-record-stop,.jessibuca-container .jessibuca-controls .jessibuca-screenshot{display:none}.jessibuca-container .jessibuca-controls .jessibuca-icon-audio,.jessibuca-container .jessibuca-controls .jessibuca-icon-mute{z-index:1}.jessibuca-container .jessibuca-controls .jessibuca-controls-bottom{display:flex;justify-content:space-between;height:100%}.jessibuca-container .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-left,.jessibuca-container .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-right{display:flex;align-items:center}.jessibuca-container.jessibuca-controls-show .jessibuca-controls{opacity:1;visibility:visible}.jessibuca-container.jessibuca-controls-show-auto-hide .jessibuca-controls{opacity:.8;visibility:visible;display:none}.jessibuca-container.jessibuca-hide-cursor *{cursor:none!important}.jessibuca-container .jessibuca-icon-loading{width:50px;height:50px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAHHklEQVRoQ91bfYwdVRX/nTvbPuuqlEQM0q4IRYMSP0KkaNTEEAokNUEDFr9iEIOiuCC2++4dl+Tti9nOmbfWFgryESPhH7V+IIpG8SN+Fr8qqKgQEKoUkQREwXTLs8495mze1tf35s2bfTu7ndf758y55/x+c879OvcMYYnbxMTEy4IgOImIxkRkrYisNsasUrPe+wNE9C8ielRE9iVJsndmZubBpYRES6E8DMNXeu83ENHrAJwO4OUARvrY+i+ABwDcLSJ7jDF3RlF0f9H4CiNcrVZPCIJgk4hcCOCNBQH9EYBveO93NRqNx4rQuWjCExMT64IguEJE3kdEq4sA1alDRDTsb02SZOfMzMxDi7ExMGFr7THGGCciVwKYG5PL0HTMb69UKtNTU1Ozg9gbiLC1diMRXQ/gxEGMFtDnQRHZHMfxHQvVtWDCzrkdANSredvfRWQ3Ee0F8DCAJwDs994nQRCM6qxNROu892uI6A0ATs2rWER2xHF8VV55lctN2Dl3LICvA3hzDgMPENFXROT2SqVyb71efzZHnzkRnRNGRkY2isj5AM7K0e/HAN7OzP/MIZuP8OTk5FiSJDpjnpylVER+YIzZEUXRN/MY7ydTrVbXE9FlRPT+LFkiesh7f1Ycx4/009nXw9balxDRLwC8OEPZ/SLi4jjWCCi8WWtfA2CKiN6WofzxIAhePz09/dfMj5P1slqtPj8IgntEZF0vORH51Ozs7NU7d+5sFs60Q2EYhpeKyDUZq8LDInJ6HMdP98KS6WHn3E8BvKlHZx2X72Xmry410Xb91trTiOjLAF7Rw+5uZu6FufcYds7pl7wiTSkRPSUi5zHzr5eT7LytWq32gmaz+a0MZ1zDzB9LxZ72sFqtbjDGfLcHmWeI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OnQ2gV3q2FBfig37wnjUevVI/auhIlzwMSnYOe1bnPkUtWrXznuUualkM2b6EtWzJGKMlBaf0MrScZUuLJduXsAq07l1/DuCEDIP3iUi4VIVpRRCd19G3Ek8FtfTQe//DrAI1lSu69LBIogsirMK1Wm11s9n8GoC35AByH4DbvPe3r1q16g8LKS7NoXtRIrk83G4ha/bugURL93cD+Mt8+TAR6YT3j0ql8rtBC70HZb1gwmooDMO3eu+vJaKTBjXc6rfPe39ho9H41SL15O4+EOFWiGv5n2sViz83t8VuwWW9pRyY8Dxu59zJIqJVAhcP+JPHI8y8bL8SLJrwPHH9jYeI3kFEF+Ssmp/rqjN7HMe6lV2WVhjhdrRhGJ7a+lFrPYDXAtB667Q/X5723p+tNwLLwrbf1rIIEBryxpgTkyQZA6DlFccS0fMA6G84d6RVvBZht5eO/wEB1Kvsoc6vtAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;animation:rotation 1s linear infinite}.jessibuca-container .jessibuca-icon-screenshot{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAE5UlEQVRoQ+1YW2sdVRT+1s7JxbsoVkEUrIIX0ouz15zYNA+N1RdtQfCltlUfvLbqL/BCwZ8grbHtizQqPojgBSr0JkiMmT2nxgapqBURtPVCq7HxJCeZJVPmxDlzZubMmXOSEsnAvOy917fXt9e39tp7E5b4R0vcfywTuNgRbBgBx3HuJqLVzPzmYjprjHkcwAlmLqXNm4XAISLaSESPaq2HF4OE67rbRGRYRA7btn1fbgLGmKsA/Azg0gBkGzO/vZAkHMd5hIiqc5wHcCMz/5k0Z2oExsfHV1QqldPAf8lORNu11m8tBAljzFYAYWxRSl1vWdZvuQj4RsYYF4AVBlgIOVVlE55HRIxt23ZuCfmGjuOsJ6LPoiAistW27XfaEYmIbOYhPc9bXywWR1oiEJDYQkR1zrYjEjGyqfqbKd8a7kJVtLgQ+30i8pht2wfyRKIdmJkJBPkQTbILfudJ7CTZNBvVpgg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r5qiSiJ96oclymBOR3bZtP9+M89WxxpjdAHY2sN3DzM8ljWl4I3Nd9x7/OE1ENcdpETnmH3e11n41zv0l4J8RkU+J6AAz+xtF4teQQG7PFslwmcAiLfSyhC72Qv9/I/Avns2OT7QJskoAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-screenshot:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAED0lEQVRoQ+2ZycsdRRTFf2ejqHFAMQqiYBTUoElUHLNx3GgCgpuYRF2o0UT9CxwQ/BMkMSbZSKLiQgQHUDCJgjiAxiEiESdEcJbEedgcKaj3UV+/6q7u/jovPPkK3qbr1ql76p5bt6qemPKmKfefeQKHOoLFCNg+H1gi6fFJOmv7VmCvpD1N87Yh8ApwNXCzpB2TIGF7DRDm2inpmt4EbB8LfAMcGUHWSHryYJKwfRMwmuMP4BRJv9TN2RgB2wuB72BWsq+V9MTBIGF7NZBiGzhJ0o+9CIRBtt8FLqgADC6nRDbpVO9Iuqi3hCKB5cDrGZDVkp4aIhIV2aSQyyW9MScCkcQqIOfsnCORkc3I31b5VtyFRmg1IQ7dt0ja3icSQ2C2JhAjUU2ykd+dE7tBNp2i2olAJJFuc+nCt564QTadF6IzgUhiVGiqyinKaQjZpJP2ItBXTkPJZhACXeU0pGwGI9BWTkPLZlACBTldG4o5EA6E1dY66edcyNrs8Q36zg1vVaTazNs7iXPgDVJJzYs7VRvHRzaDEohyugJ4CTi84sg/wHWSdnVxsGQ7aQLXS9pZcqpL/6AEplpCU5HE8YpJ9YrXUKQ6baN1+HPaRm1fBqwFQnKGK2ZoPwCvAo8Ai4FnMpPMHMwapHUj8DFwbw3+Dklv9iZgexOwvktSRduxU2VDlErwmyXV+lCbxLbDdndlCT3TX3vV7JgnKfRuSVflfMkSsL0ZuDMz4E/gL+CETN+/wCpJzzaRtn0D8DRwWMbu1/gCcnSm7zFJd1W/jxGwvQx4r2IYnlbuA14GAomQFw8B6YtBKFSnNj2BxEJ3IvB1pdB9CjwQ8yqYhcg/DJxZ8WOZpA/SbzkC24DbEqOfgPMkBRKzmu23gEuSj1sk5SI3Y2J7C3BHMuZz4FxJf6fgto8APgIWJd+3SUrHjr9O294HnJUMWi8pSGqs2V4CvJ88fH0i6eyChKr4KyS9WIO/Ang+6RvDz0XgABCeFEdtkaQv65yy/QVweuwPY0+T9FuNQ8cAXwHHxf7wdHiypN9r7BfEl8GjYv9+SceXJLQ/mSDYTh2Baog3SHq0pYT2STqno4RWSnqhBn8l8FzSN4bfJol/jkn8bXUS228DFyfft0paVyCwFbg9sQkSDEkctueZZju8iO+tJPEYfo7A0piYKd73wP3xnB+20cvjNnphxdmlkj4sEMjhfwY8COyOY0fb6Bkl/K6FLKxS+M1KpDhJY8mvrG5doRwlf66QZfGbjhLh4pEt35kV3iUp/IvTunU8qtTil/7gaHOY2yjpntaez9b5RmBDYewmSXfX2RRvZLYvbThOh+NuqMa9Ww1+yLnXgO2SwkZR24oEens2oYHzBCa00PMSOtQL/f+NwH+Hg8hAnbrYgQAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-play{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACgklEQVRoQ+3ZPYsTQRjA8eeZZCFlWttAwCIkZOaZJt8hlvkeHrlccuAFT6wEG0FQOeQQLCIWih6chQgKgkkKIyqKCVYip54IWmiQkTmyYhFvd3Zn3yDb7szu/7cv7GaDkPEFM94PK0DSZ9DzDAyHw7uI2HRDlVJX5/N5r9FoHCYdr/fvCRiNRmpJ6AEidoUQ15NG+AH8BgD2n9AHANAmohdJQfwAfgGA4xF4bjabnW21Whob62ILoKNfAsAGEd2PU2ATcNSNiDf0/cE5/xAHxDpgEf0NADaJ6HLUiKgAbvcjpdSGlPJZVJCoAUfdSqkLxWLxTLlc/mkbEgtgET1TSnWklLdtIuIEuN23crlcp16vv7cBSQKgu38AwBYRXQyLSArg3hsjRDxNRE+CQhIF/BN9qVAobFYqle+mkLQAdLd+8K0T0U0TRJoAbvc9fVkJId75gaQRoLv1C2STiPTb7rFLWgE6+g0RncwyYEJEtawCvjDGmpzzp5kD6NfxfD7frtVqB17xen2a7oG3ALBm+oMoFQBEPD+dTvtBfpImDXjIGFvjnD/3c7ksG5MU4HDxWeZa0HB3XhKAXcdxOn5vUi9gnIDXSqm2lHLPK8pkfVyAbSLqm4T5HRs1YB8RO0KIid8g03FRAT4rpbpSyh3TINPxUQB2GGM9zvkn05gg420CJovLZT9ISNA5tgB9ItoOGhFmnh/AcZ/X9xhj65zzV2Eiwsz1A1j2B8dHAOgS0W6YnduY6wkYj8d3lFKn/j66Ea84jtOrVqtfbQSE3YYnYDAY5Eql0hYAnNDv6kKIx2F3anO+J8DmzqLY1goQxVE12ebqDJgcrSjGrs5AFEfVZJt/AF0m+jHzUTtnAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-play:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACEElEQVRoQ+2ZXStEQRjH/3/yIXwDdz7J+i7kvdisXCk3SiFJW27kglBcSFFKbqwQSa4krykuKB09Naf2Yndn5jgzc06d53Znd36/mWfeniVyHsw5PwqB0DOonYEoijYBlOpAFwCMkHwLDS/9mwhEDUCfAAyTXA4tYSLwC6CtCegegH6S56FETAR+AHRoACcBTJAUWa+RloBAXwAYIrnt0yBNgZi7qtbHgw8RFwLC/QFglOScawlXAjH3gUqrE1cirgVi7mkAYyS/0xbxJSDcdwAGSa6nKeFTIOZeUyL3aYiEEBDuLwDjJGf+KxFKIOY+BdBL8iipSGiBmHtWbbuftiJZERBuOfgGSK7aSGRJIObeUml1ayKSRQHhlgtkiaTcdltGVgUE+ppkV54FaiS78yrwqlLoOI8Cch2XV548W7WRpTVwA6DP9kGUFYEpAOUkT9LQAvtq1M+0udKkQSgBqSlJWWYxKXj8vRACK+o6bbRIdYI+Ba7U7rKjg7L53JdAhWTZBsy0rWuBXZUuNVMg23auBF7UIl2yBbJt70JAoKV6/WwLk6R9mgKSJlJ1kLTxFmkJyCla8UZd15GJQKvyumyJ8gy8DAEvfZoINPqD41EtUjmUgoaJwAaAnjrKebVI34OSq85NBNqlCAWgE0CV5GEWwI3vQlmCbcSinYFCwPEIFDPgeIC1P1/MgHaIHDf4Aydx2TF7wnKeAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-pause{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAABA0lEQVRoQ+1YwQqCUBAcfWXXsLr2AXWTPXno8yVB8AP6Aa3oHI+kCDqYaawJljSe133uzO44bx0M/HEG/v1gAd9mkAyQgY4I/F8LJUlyrQFtD2AtIkcNoFEU+Z7n7QD4DfFHEVlocrVmgAUAIAOl3mILPcDgEFcUhyrUKMGUUcroc3NQRimj9XJBGaWMvvPydKN0o6/9QTdKN6rZANxj6EbpRulGuZnjYqs8BbyR8Ub2Izeys+u6yyAIDpo/ehzHM2NMDsA0xFsRmWhyfTIDWSXxCEBmrd2EYXjSHJqm6bQoii2AOYBL5Z0xgFxEVppcrQvQJO0zhgX0iXbdWWSADHRE4AZQ731AhEUeNwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-pause:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAA7klEQVRoQ+2YSwrCQBBEX6HiVvxsPYDewfN7By/gD9ciQkvERQwJdBSiYs0mEDo96aruombEjy/9+P/jAj7NoBkwA28i8H8tFBFRA9oeWEo6ZgCNiDGwAYpn3TpKmmVytWbABQBmoNRbbqEHGB7iiuJYhRol2DJqGX1uDsuoZdRmLuNZSzGWUcuoZdRHSp/IylNgK2ErYSthK3FHwLcSvpXIjoLt9Jfa6TMwl3TIMBkRE2AH9BriL5KGmVyvWIltJXEfKN6tJJ0ym0bECFgDU+Ba+WZQFCdpkcnVuoBM0i5jXECXaNftZQbMwJsI3AAPN3dAQflHegAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-record{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAC+UlEQVRoQ+1ZS2sTURT+zlDJYE3XSq219QHVuEjnJDT+Bff9Abqw2voAEfGxqygUqWhVFHGl/yMLu9BwByxk5SNI66ML6U7axjhHbmhgWiftncxoOiV3FcI53z3f/e65594zhIQPSnj86BBot4IdBToKRFyBnbeFlFIScVEiuYvIWC6Xe2YK8pcC7SYA4CMzH4mDQBXAqilQBDsLQLfPf9FxnF4i8kwwmypARI+Wl5dvmIBEsUmlUkNE9NaHsVCpVAZGR0d/m+A2JSAid3K53E0TkCg2pVKpz7KseR/GfKVSGYxMAMA0M1+JEpyJb6lUOm5ZVnkrAsVisaunp+esiByr1Wp3R0ZGvmifzZK4XQQWHMc52MgBpdQuAOcAXABwuB400ZTjONdaIjA7O5u2bVsnWU1EujzP+5nP5xdMVjvIJkCBD8x8VCm1G8AYgAkAAxt8Z5j5YmgCSqlTAJ4D2OcD/AXgATNfbYVEAIFPIvKKiE4D6GuCea8xX6gtpJT6DmBvECgRFRzHeROWRAABE4iWCbwHEFhkPM/L5vP5dyaz+23+KwHXdR3P854S0YG1ILSCuthNMfNM2OC1/RYENLY+ygcBnPfht6ZAA6BYLNr6dyqVokKhsGpaNQ2TWJstreXaE2aed133sojcj41AKyvdzCdAgSXLsk4MDw9/a/i4rntbRPxFNZoC/5jAV2be759DKTUJ4FZSFFi0bbs/k8noy2R9dAjEuWU2YgXkQOK3kD6BMsysi2Z9JC2Jdcw/ALzwPO+xvmcl7Rj177JVEbkO4BARjSflFDJJuW1dBxJPoCIiL4noDIB1BS0pW6j+oJmbm+uuVqvjRKQfLr0bZHnIzJf0f6HeAybahrUJqAPruhLlcnnPysqKfpXp11n/Gv62zoHAroS+AafT6QkiGrIsazKbzX7eVIHEt1US39gCkOzWYthkjNE+tuZujDGZQ8XRXn8N4KT5lLFZ6uaYPt+nwyDuvC80YdhvB9uOAu1WoaNAR4GIK/AHvdr+QAexB7EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-record:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACfUlEQVRoQ+2ZSYsUQRCFvycK4nJXXEbHBdwO4kn/gv9CD467ICIutxEFkREdFUU86T/xojcPntyQcT2INw+uISFVkD1Wd2dWlU7nUHlqisiX+fJFZGREi8yHMt8/HYG5VrBToFOg4QnMPxcyM2t4KE2nT0i6EwvylwIjQOCFpE1tEPgGfI0FamC3AFgazP8IrJL0KwZzkAI3gLMxIA1ttgCPA4w3wHpJP2NwBxG4KOlcDEgTGzNbA8wEGP57vA0CU5JONtlczFwz2wY8HUbAzBYCB4CtwCVJb33OIAXmioC70LoyBsxsEXAQOApsLIhelnS6FgEzW+5BBvwA/FS+SPJFa40KBZ5L2mxmS4AJ4IjHxCzwaUnHkgmY2V7gLrAyAPwOXJN0qg6DCgIvgQfAPsDjo2pcKddLciEz+wCs6AO6W9KjVBIVBGIgahN4BvRLMjslPYlZPbT53wR2AbeBtcUmXEFPdh5U06mbd/shBBzbr/Jx4FCAX0+BEsDMFocEYrNmFcE+BD4XsXZL0oyZnQCutkagzkn3m1NBwDe/Q9L74MAuFEqUn5op8I8JvJO0elacTALnc1HAH3Njkvwx+WeYWUegTa/pwaqIgexdyIN4uyRPmqULZRXEvulPwD3gpr+zcrtGQxfzRHYG2AAczuUWiom3kc4D2RN4BdwH9gM9CS0XFyoLGu9UuN974eIFVDiuSzruH5LqgRhtU20q8kBPV8LMlhVVmVdnYwX+SMdAZVeieAF7eeltmElJr4cpkH1bJfvGVvatxdR4bMu+teZuWxtKxWncXn8I7EldtQV7vz79fp9KwZp//9CksB8F206BuVahU6BToOEJ/Ab7+KdABdTt8AAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-recordStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAGDElEQVRoQ82ZaahVVRTHf//moKKggQawcmg0olGl0awvRoMVBRGFlQ1YQZIZqRVKmJmFgVk59EFQykYjgmajbJ7n2WiAbKKCBq0Vfznndd723Lvvve/5bMH9cvfaa63/2WuvaYteoIjYHDgEOAAYDOwIbA/4f9PvwHfAt8DbwGvAS5L8f49Ine6OCO89CTgFOBrYqU1Z3wBPAUskPdDm3i72jgBExCXAWGBQp4qTfR8CMyXd0a68tgBExEjgBmCfdhW1yP8eMFHS/S3y0xKAiNgQmA2MaUHwB8DnwNfAbwX/FsDOwG7Ani3I8ElcLOnvHG8WQET0Ax4C9msi7BHgbuAFSXaHhhQRewBDgZOBE5qwvuV1SSuayWsKICIcVZ4Atq4R8mdxKnMkfZT7UnXrEeE7dD7gO7VpDc/PwAhJrzaS3xBAROzrUFcJhVUZjhrjJX3cieHpnogYUNytUTXy/gAOlvROna5aABHhGG5f3qZmk33ztt4wvAbIBcCcBicxSNLKdK0RgNeB/RPmVcBxkp5eF8aXMiPiKODRGpd6XZJduhutBSAipgNX1Bg/tJkv9iao4u4tBzZJ5N4oaXz1v24AImIvwLE4peGSnDX7jCLC2f3JGoV7S3q//D8F8DJwULJpgiQnrz6niLgSmJYofkXSwWsBiIgRwGPNmPscARARDqGp7zu0Orz/l4kjYhlweGLk4Ebhq8oXEc6wGwH/tAhyA2C1JGfsphQRTqBvJkzLJB3ZBaBIKGkGXSqpWab013FWvacooXO21K07256WS4QRsRQ4PhHgsPrxmjsQEZOB6xKGIZJebGZVRDwOHNOJ5ZU9j0s6NqPnUJcpCc9kSVNKAA5ZQyoMn0gamDMsIj4rCrQca7P1zyT1zwmIiE+AKt9yScNUFGuuZaox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ZZPDXKfa1nqs/4QUXSG21bXdnQYwBV5RHhy2rXcmh0E+5GxOTGyCWwp34fSCovd09sX7P3X2uzPXCoLsVMAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-recordStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAHn0lEQVRoQ81ZbYxcVRl+nnvu7ErSEmtqDdKwO3e2LWJLSEuFNiofFv9AUIpfiSFqCzt31lITGgEjHxKIKVirqXbnzpZSf5BAoHwIhpiAgDVSwBaU1rZLd+7skiIJKCWVpOzOPfc1d3dn986dO3Nn9kvuz3ve87zPc857znnPe4gZ+BZvlzPMed4XDG2sBGWFAGcRXET6ZwTwIsZpgbxL4B0ID/nKf8370Hz1xE08PV33nDKACDOO/roQ15K4TASfbQWLxL9E8AKJvcWs+WQrfcO2UxKQcfSNAn8TwKVTdVzdT/oJbi/aZl+reC0JsArelRDeC8jnW3XUnL0cofC2Ys58ojl7oDkBj4hKv697CXQnA8sxCEsE3hbKh4E9hfMEOBuUNMBzkzAE6Ct9SvXgW9RJtokC0r+VDqb8pyByfgOwZ0g84mv1cqmH/Y2cpntlmUG9BgauEcHVdW3JN6RsXF3axKFGeA0FdBVGVvpi/AnAJ2NAhkHpBU3H7eabSSMV1271yVL63g0C3gigPcbmA/r+umJP28F6+HUFZPLDy4XqVQCjW2HkexJQN7s2j0+FeLRPZqd0idL3Algfg/cRRa8u5toPx/mKFZDJyyKhPgZgQU0nssfNqvxMEK8RktdZoThxM2G0qaUDG/hetC1WgOXo1wG5IGJcNkS+OpBLvTgb5CuYXfnypT75x2hICfh6yVYrEwWknfJ9BH8cJU/fX9MoFmdS1Pja2w+gLYwrkF+U7NTN4X9VM9CxUz6nlD5So5JyeTGbemEmSSZhZQrly0T4fNROa3Xe0A95tPK/SoDleH8DcGF1J97q2ipYYHP+WY6+BZCtEccHXNtcXSPA6iuvg89nGxnPuQIAlqMPAhKJ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R98mkLurycgR107N0ntAUuiUj0bL8YxERU1p0Sp4gxB0VEETj7lZ8xuzMcr1MGNytCBehtys2Vkd5hGE8bJeXDl7t2ub18+FiEze2yVEjS+D/qqBbNtrDQUEjWNvYLIjSlaA36sR9e2BzRyeDSHBocph/TCBmkOU4OairX4T9Vv3fcByyr8G+KMaosSAaNlQ6kn9ZSZFWIXyFyH8XbjyUMEXkR2lXKqWS2R11/CxHO9+ABtjiQryMNRWN8u3piOka5cs9rX+KQA7Fod4wM2a8RySBIyGU768TcgtdUieJrEbvjxczKX+2oqQ8REPrrLfAzAvri8h24p2Klrqj+wvTXhNO95GjqXcqp45KUcF3CfAAaEcN+H/25e2/wb2BkfmezAWUrgEgtWEfDnhtVJD0O3mzAeS6CW+UlYArMLwCoj6JYCGZcCIw8pij3vAq8dtH6g3udn2Q0nkg/amBVTA0gXveopsaea9txkCkzZynOC2Vl/rWxYwMSN5b8PoAifWtkY0Yi14CcT9rm0Gd/OWvykLqHjq7Bu5QIm6QkQuAbG85hSPUiKGIDhM8s+a+tnB7ra/t8w61GHaAsLOl+2W+WVdPpfaWCzBE63BM0fbfTlF4KQo/0RKpY71b+To4p6J73/tXyc1fevA3AAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-fullscreen{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAHTElEQVRoQ+1Zb4xcVRX/nZl5u2/LrrO0EFKoBYpVaRu3u/e+3WlDZJdIRLQhNLIiEggxqURIjGmqTTAmWiRpjH4wghq+KIQYupYQEvEDmEVdyu7OfbPbzQaEYqtSwTb4Z3aV7s6b9445mzvm7XRm3oy7oanZ82ny5txzz++ec8+/S7jIiS5y/bEG4EJbcJkFpqenryqXy6cbKBUB+AeANIBuAG8AuAzAn06ePOkNDw+H9dZOTU11h2H4EwB7ALwL4FIA7wFw7O9aSxkAE9H9SqnHazGc50LGGFFQlGuW/pbNZq/aunXrYtIC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UePXrKTg9MAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-fullscreen:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAFvklEQVRoQ+2ZaaiVVRSGn9fS0iabCNO0eSaosAmplKJRxMiygSQCixQipBKMoDRBon5EI/0pQ8JuRQTVj4omo+FH04/muVum2GCDWVYr3ss+8t3vfud8+3guXi6cBYc7nD2sd6+11/BuMcxFw1x/ugCG2oL9LBAR44HeFkr9B/wMbAOMBT4B9gC+BiZL+rfZ3Ijw+PuB6cA6YFdgAzAy/V41NQB/rpL0QNWAAS4UEVbQm+XKj8B4SX/VTYiIicC9wMnAjnXjC9/fKemaWgARsSfwEbBbxeDPgAOBL4AdgF2AD4ETJP2dq0xEHArcA4yGvjv4D/Br2vOo9P/ycosl3ZQD4IDkFiMqBl8LPASMkfRdREwFVknalKt8Y1xETJDUGxFea0NE2CX9aWbF+ZLuzgEwBlgPbNtEqYuAlZLsl4MmEWGL/t5iwQWS7sgB4Iv1TcE//yyZ1Ke9AOiR9MNgIGihvAOCrWJZKGlZDoCjgTdTZLDy1wGLS1HCkehF4DxJ9t0tlhbKXwbcAByRFp8taWUOgN2B94G9AZ/A9sD5wIPAdqUFngAuBTZuiUu1UH4O8DjwVQrR3nZuVhiNCEcFT3S4swX2k7QmImYDs3zqJRCOzfOBTe2AaKW8pOUR4cPy/tbH9+0cSc/mWMATfkp5wAtMlLQuAXNo7QEcfYqyBLjZFssBUad8IVI5bDsqWs7OAuCREeHselCaeLgkx/o+iQi71lPAsSUQyyQtrLsM6SB8h8oyxydf2Meu/CrgnGGZJcluNUDKpYRN9zEwCVgLjJPUb8OIODiBOKSw2lhJDr8tJSIc5ZzE7JIN6ad8OijrNQ9w8nJynSrppRwAjXhs5e0+lYklIo4DHgP2AUa1k8wiwjnmGeB0YIDyBSv4MB2yHQnPkvRGDgAjfxs4vq48iIhpwCuSXAq0JRHh6H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oFkKbTbwCO+UI0HcB9J/LdeY0xs0R02IGYYObRrWqiFQCfEZEtSHsfmGZm+4qxbbM/hQD8BeBNa0hEM2EYnmgLgP3lFARBT1dXly4vL//b29tbzQNIU+llAHeJaLFSqRzJes5vegR8xGbZLCwsHKzVav8z8/0sm0ID+MDvAfh4qZk2exFopnd9vv0ELrXBQO7fD10AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-fullscreenExit:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAC/ElEQVRoQ+2Zy49NQRCHvx+ReK6IlZ34E7CUiCAR4xEbTLCyQRATYswwb2IQZDYWgojHZpCQECts+ResiQwLj0RClNSkb9Lu3HtPz7mZc8+V6eXt6tP1VVV3VdcVbT7U5vozC9BqD/7/HjCzlZLet9rS9fbP9ICZvQPWSfqRAmFmS4ClMHm+JiR9S1mXVyYFwIBXwEZJv7I2MrPjQH8A6JN0OWtNM/OpAL7HS0mbsjYzswGgN8gNS+rJWtPM/HQAfJ9nkrY22tDMTgMjQaZH0nAzCmatTQE4ClyNPvQU2CbJQ2vKKB2Aa2hmR4DrkbbPgQ5Jv6sJSgkQILqA0dgTkjraBiBAxPHtPz2UtDuGKK0HKkqamd8qg5HS9yXtjebLdYjrHNRqiAeS9gQvnQGGSnML1bvGzOwc0BfN35PUaWYHgRulBwjW9ju+O4JwqM/AWFsABIgLwKkIYgJY1jYAAeJQuGIXVIVcKTKxh8WfBin9J+AVpx/eFWUEqFkyNACKp0rhgWYArkg6kQibSyylmPOklQdibijBX+fSLHFRJkDid+qKmdlaYENOI0zeEcBNSZ9qbVIEQHWuyGOTNZLetgrAz8ClPFpHa1ZL8rf5lFGEB2oBfAxQi4D5DeDmAP7mGJPka0oD4LnDr9imH/xFe8AP4vLIjBclxWXItCOtaIBjwOKo3HaFRyWdnLbmYUHhAJKumdkt4ECk9JCkSitmWixFAwxKOjt5uZvdBvZH2vZLit8XSSBFA/yjpJndAfY1A9FSgOCJu0BnBNErqfIkzfRCywECxCNgR6Rtt6TzmdqHBmyKXG4ZM4sTWc04NzNPWE+AuG3ZlZInSuGBinXMbBzYGVkrE6JUACGcHgPbUyGKAIj7REmZ18y897o5ghiQ5E/bltRChwE/kF7Xj0jyLkbDYWbzgBfA+iA4LmlXqwD8LydvszjAF0lfswBCKC0E3gBeP22p186f8RBKUbaejJmtAr5L+lBPptQAKfCzAClWmkmZWQ/MpHVTvv0X9iFAQGQyevIAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-audio{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACrUlEQVRoQ+2ZPYgTURCAZzbBXJnCeL2Cnb87b9MEtPBUrrMQFAtrtT5/ClGs9LBWWz0RtbBUFCF4oJDsbO68wsLA2YqQSmLlvpEHu7IuMdlLcus+yUKKhJfZ+ebnvZl5CJY/aLn+MAP41x7M1QPMfFtr/crzvHfTAs8FoNPp1LTWzwHgqIg0lFLvrQHwfX8BER8DwC6jNCIecF13wwoA3/dvIuKNpLJa60Oe560XGoCZd4rICiKeTCtaeABmPg4AJmRqg6xcaABmvg4At4aFRyEBhoVM4UMoCplHADCfJTEL5YEsIVNID5iQAYCHALCYxeq5b6PMfF5EBAAEESthGK7W6/XPRpFWq7W3VCqtZg2ZcT3g+/6i4zjzIlLSWn/yPO/DIGMNLCWY2Sj/+xGRK0qpZfNDEASnROTFVi0fr8+aA8z8Ld6KEfGt67oLYwMAwEUium8EREn7OgeAjwCwPyo/nrque3YSgAtE9GDaAM1mc65arc4Zuf1+P2w0Gt9jJZl5DQAORt+fENG5wgEw8zUAMB/zbBBRwyqAIAjuiMjlSOlNItpjFUCqWl0josMzgChR/9hGAWBbknjmAdPhDdqa0gfZzAMJKyVP4v8hhJYRcSni+0JEu63ahZj5anyQici6UuqIVQDdbrfS6/UqRulyufyTiH5sF8AlIro37VpoWEHIzGZ2tM+sEZFnSqkzk9RCS0R01wjIsZz+mug53hDRia0AnI4bGgDYISItz/M2jYC8Gpp2u30MEWuO4zha665Sqp0ZYFStX/iWchRAItFGzoHSsrJ2ZFl1mHg6bfVYJeGJv85CC++BpIJZ5kSFC6G0ha0e7mYJqcJ7IOkRay84UhD2XjHFIFZf8iW9YcYoYRi+tO6aNeupOs66iU/icV46zf/MAKZpzXFk/QL+JG1PUPhRiQAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-audio:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACSElEQVRoQ+2Zu4sUQRCHf5+C+gf4yBXMfMYHGvjCzEBQDIzV+HwEohipGKupD0QNDE8UEwUFTe68wEDhTMVUMFJ+0tArzbjs9u3Ojt0wBR0M9MzUV1XdXVWNKhcq1189wP/2YKcesH1d0nPgdVvgnQDY3iTpqaT9kuaAt9UA2D4o6aGkzVHpXcByFQC2r0q60lB2D7BUNIDtjZIeSDoyRNGyAWwfiiET4n6YlAtg+7Kka2PCozyAMSHT5CkLIIbMfUlbMhdmOQCZIVOeB2LI3JN0NNPq6bTZe8D2aUmOY72kN8DnoIXt7eF5FSEzkQdsB+OEsFwr6RPwbpixhqYStoPyqVwAbkaAY5KeTWD5wStZHrD9XdJgK34FhBP9H8kFOAvciQBhn3/RAcBHSTvjfx4DJ6cBOAPcbRvA9gZJYQT5DfwYKGl7UdLu+PwIOFUiwCVJYQRZBuZqA7gh6XxUegXYVhtAmq0uAnt7gLhQm9vorBZx74Hcc6D3QLKH/z2JGyVnlYs4pCfzEe4rsLW2XehicpAtAftqAwiZbhhBfgE/ZwVwDrjddi40KiG0HXpHO+KcJ8CJaXKheeBWBOgqnf6W1BwvgcOrATieFDTrJL0HViJAVwXNgVgPrJH0BfiQDTDKtREiNK7KLSnHASQLLacP1PxcVkWWq8PU3emq2yqJJ0b1Qsv2QKpdZp+orBBqmrfq5m5mSJXtgUZI1XnB0YCo94opCal6L/ka3ghtlIXqrllzT9VJ5k19Ek/y0zbf6QHatOYk3/oDujC8QMWgjf4AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-mute{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAKYklEQVRoQ+1Z+3NV1Rld397nXJIbIGBARTQgohGNQZJLEtFSMmpfan10aJ1OZzqd/jOd/g3t9AetD2KLCiigNFUgj/tIQoh1SqBRwVqNYgp53XvP2V9nped0Lpebl/LQmZ4ZZpjkZJ+99voe61tb8C1/5Fu+f/wfwPVm8DIG+vv7H1bVWufcp9baUefcWCqVKi5lo11dXV5NTc06EblPRNoAtABYqapD1tq9zrmelpaWaRHRpaxb6d3LAGSz2d+IyAbn3FljTG+xWEy3t7efW+yHuru7q621t3med7+qPgigGcCdAPIAuowxzyUSiaONjY2Fxa4533uVABwEsA3ARQDHAez1fb9769atn823kKrKyZMnVxUKhdtFJKWq3wWQAnAzgBoAH6vqQWvtH8nAUlmd69uXAcjlci+q6sMA1gL4BMB+Vd2fSCR6K4HYs2eP3bRp0zJjDN/f7Jzjphk2PPkN0YcDACOqekhVO5PJZPZqMvBLAI8BeATAagBnARwRkT97ntdXDmJ4eHj59PT0emPMVufcA9y8iNwBoA6AjQCEAE5dEwDpdPo2EXlQRJ4G8B0A6yImDqjqvnImstnsOlVtFZHvA9gJ4C4AfhnlLAJnABxW1T3V1dWZq8aAqppMJrM+AvE4gB8CuKGUCd/3jzU1NX3JuB8cHNwchuGjBKyq7QCWV4jXawcg/ng6nb7ZWrtTVX8C4CEAtxCEiLzBZAzD8ERNTc1YoVBY6ZxjtXkyYoDvxaETL3ftAfDLvb29t1prufnHohBZQxCqmmVJVNVjQRB8VF1dXeece0hVfxAlcD1wSZe/dgCy2Wy97/sz1topAIWpqambRKTDGPOsqu4AUAvgPICMiBxU1SMzMzMfJJPJG1SVYB+P6n8pE6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xH+czWbpJqwPw/DeyMjaDoD/Z7MqrVIEMOvMOef2VLofKGMidsU5Qx+iig2CoGf58uXjjY2NE6UsfC0AXIgh1dDQQEeOecEEZ25QL3HKihveggCYY319fbdUYIJ9gobYc6p6prW1lU32f8/XBhCvxAGF10uqui262GNusGpRhvDhnM24fkFE0nMZW2TC8zzmAjs/c4ylukdVOa29H88SVySEyhMqm81yBKSpu4VMiMgOVaX0YCOcva4yxjw/3x0ZmcjlcrxnI5Ps+mtUdYTgwzD8sLwqXTEGSqtUfX09PR/aKIxldvAGOt0A3nHOvRwEwfEdO3ZMz1UbR0ZGlp0/f/4WEam31vL+4by19hQ7dPnNzhUHEG9qYGBgVRAEd0UNj2YYWThjjHmrUChk2tvbKfDmfHjX7Pt+te/7nAnYUKcqhd1VA8Dkrq+vXxcxQdnAewbOAb1BEAwtBCAq16azs3N2j5TalSTFVQMw3+leyd996wH8BxA4v3x6wGifAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-mute:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAHsUlEQVRoQ+2Z969VVRCFv7H33nvvvfcSe2+xxJgY4z9j/Bs0/mABFQXBhl1sgNjQSCyoiL2BDaxs873MJsfDuZd7gfeQxJ3cvAfv3HP22rNmzZo5wRq+Yg3fP/8DWN0RXCYCpZSzgM2Br4GPgW8j4s9hNlpKWQfYETgUOB44GtgMmA1MBF4BFkdEGea+Xdd2AbgF2B2YD0wHZkbEZ4M+qJSyIbArcARwMnAUsC/wO/AscCfwQkT8Meg9+13XBeBx4EjgZ+ClPLGXI+KbfjcqpXivLYA9gWOA0/PnDsDGwOeA977bCAwb1V7P7gIwDpBG2wJfAg/nZ3oXiFLK2sD6ef0+uWlp48kbSddfwAfAVOB+YNZoRuBG4CLgbGDLpNLTwIPAjDaIUsomwM7A4cCJyfm9ga0Bwbn+Bt4fKwDyV+5eAZyayWgkHgGmmBdN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cNQL/TXZV/W+MB/AMANfVPjBGemwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-text{font-size:14px;width:30px}.jessibuca-container .jessibuca-speed{font-size:14px;color:#fff}.jessibuca-container .jessibuca-quality-menu-list{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px}.jessibuca-container .jessibuca-quality-menu-list.jessibuca-quality-menu-shown{visibility:visible;opacity:1}.jessibuca-container .icon-title-tips{pointer-events:none;position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:rgba(0,0,0,.5);border-radius:4px}.jessibuca-container .icon-title{display:inline-block;padding:5px 10px;font-size:12px;white-space:nowrap;color:#fff}.jessibuca-container .jessibuca-quality-menu{padding:8px 0}.jessibuca-container .jessibuca-quality-menu-item{display:block;height:25px;margin:0;padding:0 10px;cursor:pointer;font-size:14px;text-align:center;width:50px;color:hsla(0,0%,100%,.5);transition:color .3s,background-color .3s}.jessibuca-container .jessibuca-quality-menu-item:hover{background-color:hsla(0,0%,100%,.2)}.jessibuca-container .jessibuca-quality-menu-item:focus{outline:none}.jessibuca-container .jessibuca-quality-menu-item.jessibuca-quality-menu-item-active{color:#2298fc}.jessibuca-container .jessibuca-volume-panel-wrap{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%) translateY(22%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;height:120px;width:50px;overflow:hidden}.jessibuca-container .jessibuca-volume-panel-wrap.jessibuca-volume-panel-wrap-show{visibility:visible;opacity:1}.jessibuca-container .jessibuca-volume-panel{cursor:pointer;position:absolute;top:21px;height:60px;width:50px;overflow:hidden}.jessibuca-container .jessibuca-volume-panel-text{position:absolute;left:0;top:0;width:50px;height:20px;line-height:20px;text-align:center;color:#fff;font-size:12px}.jessibuca-container .jessibuca-volume-panel-handle{position:absolute;top:48px;left:50%;width:12px;height:12px;border-radius:12px;margin-left:-6px;background:#fff}.jessibuca-container .jessibuca-volume-panel-handle:before{bottom:-54px;background:#fff}.jessibuca-container .jessibuca-volume-panel-handle:after{bottom:6px;background:hsla(0,0%,100%,.2)}.jessibuca-container .jessibuca-volume-panel-handle:after,.jessibuca-container .jessibuca-volume-panel-handle:before{content:"";position:absolute;display:block;left:50%;width:3px;margin-left:-1px;height:60px}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-controls{width:100vh}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-play-big:after{transform:translate(-50%,-50%) rotate(270deg)}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-loading{flex-direction:row}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-loading-text{transform:rotate(270deg)}');class pt{constructor(e){var t;this.player=e,((e,t)=>{e._opt.hasControl&&e._opt.controlAutoHide?e.$container.classList.add("jessibuca-controls-show-auto-hide"):e.$container.classList.add("jessibuca-controls-show");const i=e._opt,r=i.operateBtns;e.$container.insertAdjacentHTML("beforeend",`\n ${i.background?`
`:""}\n
\n ${lt.loading}\n ${i.loadingText?`
${i.loadingText}
`:""}\n
\n ${i.hasControl&&r.play?'
':""}\n ${i.hasControl?`\n
\n
\n
00:00:01
\n
${lt.recordStop}
\n
\n `:""}\n ${i.hasControl?`\n
\n
\n
\n ${i.showBandwidth?'
':""}\n
\n
\n ${r.audio?`\n
\n ${lt.audio}\n ${lt.mute}\n
\n
\n
\n
\n
\n
\n
\n `:""}\n ${r.play?`
${lt.play}
${lt.pause}
`:""}\n ${r.screenshot?`
${lt.screenshot}
`:""}\n ${r.record?`
${lt.record}
${lt.recordStop}
`:""}\n ${r.fullscreen?`
${lt.fullscreen}
${lt.fullscreenExit}
`:""}\n
\n
\n
\n `:""}\n\n `),Object.defineProperty(t,"$poster",{value:e.$container.querySelector(".jessibuca-poster")}),Object.defineProperty(t,"$loading",{value:e.$container.querySelector(".jessibuca-loading")}),Object.defineProperty(t,"$play",{value:e.$container.querySelector(".jessibuca-play")}),Object.defineProperty(t,"$playBig",{value:e.$container.querySelector(".jessibuca-play-big")}),Object.defineProperty(t,"$recording",{value:e.$container.querySelector(".jessibuca-recording")}),Object.defineProperty(t,"$recordingTime",{value:e.$container.querySelector(".jessibuca-recording-time")}),Object.defineProperty(t,"$recordingStop",{value:e.$container.querySelector(".jessibuca-recording-stop")}),Object.defineProperty(t,"$pause",{value:e.$container.querySelector(".jessibuca-pause")}),Object.defineProperty(t,"$controls",{value:e.$container.querySelector(".jessibuca-controls")}),Object.defineProperty(t,"$fullscreen",{value:e.$container.querySelector(".jessibuca-fullscreen")}),Object.defineProperty(t,"$fullscreen",{value:e.$container.querySelector(".jessibuca-fullscreen")}),Object.defineProperty(t,"$volume",{value:e.$container.querySelector(".jessibuca-volume")}),Object.defineProperty(t,"$volumePanelWrap",{value:e.$container.querySelector(".jessibuca-volume-panel-wrap")}),Object.defineProperty(t,"$volumePanelText",{value:e.$container.querySelector(".jessibuca-volume-panel-text")}),Object.defineProperty(t,"$volumePanel",{value:e.$container.querySelector(".jessibuca-volume-panel")}),Object.defineProperty(t,"$volumeHandle",{value:e.$container.querySelector(".jessibuca-volume-panel-handle")}),Object.defineProperty(t,"$volumeOn",{value:e.$container.querySelector(".jessibuca-icon-audio")}),Object.defineProperty(t,"$volumeOff",{value:e.$container.querySelector(".jessibuca-icon-mute")}),Object.defineProperty(t,"$fullscreen",{value:e.$container.querySelector(".jessibuca-fullscreen")}),Object.defineProperty(t,"$fullscreenExit",{value:e.$container.querySelector(".jessibuca-fullscreen-exit")}),Object.defineProperty(t,"$record",{value:e.$container.querySelector(".jessibuca-record")}),Object.defineProperty(t,"$recordStop",{value:e.$container.querySelector(".jessibuca-record-stop")}),Object.defineProperty(t,"$screenshot",{value:e.$container.querySelector(".jessibuca-screenshot")}),Object.defineProperty(t,"$speed",{value:e.$container.querySelector(".jessibuca-speed")})})(e,this),t=this,Object.defineProperty(t,"controlsRect",{get:()=>t.$controls.getBoundingClientRect()}),ut(e,this),((e,t)=>{const{events:{proxy:i},debug:r}=e;function o(e){const{bottom:i,height:r}=t.$volumePanel.getBoundingClientRect(),{height:o}=t.$volumeHandle.getBoundingClientRect();return we(i-e.y-o/2,0,r-o/2)/(r-o)}if(i(window,["click","contextmenu"],(i=>{i.composedPath().indexOf(e.$container)>-1?t.isFocus=!0:t.isFocus=!1})),i(window,"orientationchange",(()=>{setTimeout((()=>{e.resize()}),300)})),i(t.$controls,"click",(e=>{e.stopPropagation()})),i(t.$pause,"click",(t=>{e.pause()})),i(t.$play,"click",(t=>{e.play(),e.resumeAudioAfterPause()})),i(t.$playBig,"click",(t=>{e.play(),e.resumeAudioAfterPause()})),i(t.$volume,"mouseover",(()=>{t.$volumePanelWrap.classList.add("jessibuca-volume-panel-wrap-show")})),i(t.$volume,"mouseout",(()=>{t.$volumePanelWrap.classList.remove("jessibuca-volume-panel-wrap-show")})),i(t.$volumeOn,"click",(i=>{i.stopPropagation(),Se(t.$volumeOn,"display","none"),Se(t.$volumeOff,"display","block");const r=e.volume;e.volume=0,e._lastVolume=r})),i(t.$volumeOff,"click",(i=>{i.stopPropagation(),Se(t.$volumeOn,"display","block"),Se(t.$volumeOff,"display","none"),e.volume=e.lastVolume||.5})),i(t.$screenshot,"click",(t=>{t.stopPropagation(),e.video.screenshot()})),i(t.$volumePanel,"click",(t=>{t.stopPropagation(),e.volume=o(t)})),i(t.$volumeHandle,"mousedown",(()=>{t.isVolumeDroging=!0})),i(t.$volumeHandle,"mousemove",(i=>{t.isVolumeDroging&&(e.volume=o(i))})),i(document,"mouseup",(()=>{t.isVolumeDroging&&(t.isVolumeDroging=!1)})),i(t.$record,"click",(t=>{t.stopPropagation(),e.recording=!0})),i(t.$recordStop,"click",(t=>{t.stopPropagation(),e.recording=!1})),i(t.$recordingStop,"click",(t=>{t.stopPropagation(),e.recording=!1})),i(t.$fullscreen,"click",(t=>{t.stopPropagation(),e.fullscreen=!0})),i(t.$fullscreenExit,"click",(t=>{t.stopPropagation(),e.fullscreen=!1})),e._opt.hasControl&&e._opt.controlAutoHide){i(e.$container,"mouseover",(()=>{e.fullscreen||(Se(t.$controls,"display","block"),o())})),i(e.$container,"mousemove",(()=>{e.$container&&t.$controls&&(e.fullscreen,"none"===t.$controls.style.display&&(Se(t.$controls,"display","block"),o()))})),i(e.$container,"mouseout",(()=>{s(),Se(t.$controls,"display","none")}));let r=null;const o=()=>{s(),r=setTimeout((()=>{Se(t.$controls,"display","none")}),5e3)},s=()=>{r&&(clearTimeout(r),r=null)}}})(e,this),e._opt.hotKey&&((e,t)=>{const{events:{proxy:i}}=e,r={};function o(e,t){r[e]?r[e].push(t):r[e]=[t]}o(re,(()=>{e.fullscreen&&(e.fullscreen=!1)})),o(oe,(()=>{e.volume+=.05})),o(se,(()=>{e.volume-=.05})),i(window,"keydown",(e=>{if(t.isFocus){const t=document.activeElement.tagName.toUpperCase(),i=document.activeElement.getAttribute("contenteditable");if("INPUT"!==t&&"TEXTAREA"!==t&&""!==i&&"true"!==i){const t=r[e.keyCode];t&&(e.preventDefault(),t.forEach((e=>e())))}}}))})(e,this),this.player.debug.log("Control","init")}destroy(){if(this.$poster){if(!Le(this.$poster)){const e=this.player.$container.querySelector(".jessibuca-poster");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$loading){if(!Le(this.$loading)){const e=this.player.$container.querySelector(".jessibuca-loading");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$controls){if(!Le(this.$controls)){const e=this.player.$container.querySelector(".jessibuca-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$recording){if(!Le(this.$recording)){const e=this.player.$container.querySelector(".jessibuca-recording");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$playBig){if(!Le(this.$playBig)){const e=this.player.$container.querySelector(".jessibuca-play-big");e&&this.player.$container&&this.player.$container.removeChild(e)}}this.player.$container&&(this.player.$container.classList.remove("jessibuca-controls-show-auto-hide"),this.player.$container.classList.remove("jessibuca-controls-show")),this.player.debug.log("control","destroy")}autoSize(){const e=this.player;e.$container.style.padding="0 0";const t=e.width,i=e.height,r=t/i,o=e.video.$videoElement.width/e.video.$videoElement.height;if(r>o){const r=(t-i*o)/2;e.$container.style.padding=`0 ${r}px`}else{const r=(i-t/o)/2;e.$container.style.padding=`${r}px 0`}}toggleBar(e){this.$controls&&(Ie(e)||(e="none"===Ee(this.$controls,"display",!1)),Se(this.$controls,"display",e?"flex":"none"))}getBarIsShow(){let e=!1;return this.$controls&&(e="none"!==Ee(this.$controls,"display",!1)),e}}ht(".jessibuca-container{position:relative;display:block;width:100%;height:100%;overflow:hidden}.jessibuca-container.jessibuca-fullscreen-web{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;width:100vw!important;height:100vh!important;background:#000}");class mt{static init(){mt.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};for(let e in mt.types)mt.types.hasOwnProperty(e)&&(mt.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=mt.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,r=Array.prototype.slice.call(arguments,1),o=r.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let s=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return mt.box(mt.types.trak,mt.tkhd(e),mt.mdia(e))}static tkhd(e){let t=e.id,i=e.duration,r=e.presentWidth,o=e.presentHeight;return mt.box(mt.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>>8&255,255&r,0,0,o>>>8&255,255&o,0,0]))}static mdia(e){return mt.box(mt.types.mdia,mt.mdhd(e),mt.hdlr(e),mt.minf(e))}static mdhd(e){let t=e.timescale,i=e.duration;return mt.box(mt.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?mt.constants.HDLR_AUDIO:mt.constants.HDLR_VIDEO,mt.box(mt.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?mt.box(mt.types.smhd,mt.constants.SMHD):mt.box(mt.types.vmhd,mt.constants.VMHD),mt.box(mt.types.minf,t,mt.dinf(),mt.stbl(e))}static dinf(){return mt.box(mt.types.dinf,mt.box(mt.types.dref,mt.constants.DREF))}static stbl(e){return mt.box(mt.types.stbl,mt.stsd(e),mt.box(mt.types.stts,mt.constants.STTS),mt.box(mt.types.stsc,mt.constants.STSC),mt.box(mt.types.stsz,mt.constants.STSZ),mt.box(mt.types.stco,mt.constants.STCO))}static stsd(e){return"audio"===e.type?mt.box(mt.types.stsd,mt.constants.STSD_PREFIX,mt.mp4a(e)):"avc"===e.videoType?mt.box(mt.types.stsd,mt.constants.STSD_PREFIX,mt.avc1(e)):mt.box(mt.types.stsd,mt.constants.STSD_PREFIX,mt.hvc1(e))}static mp4a(e){let t=e.channelCount,i=e.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return mt.box(mt.types.mp4a,r,mt.esds(e))}static esds(e){let t=e.config||[],i=t.length,r=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return mt.box(mt.types.esds,r)}static avc1(e){let t=e.avcc;const i=e.codecWidth,r=e.codecHeight;let o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,r>>>8&255,255&r,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return mt.box(mt.types.avc1,o,mt.box(mt.types.avcC,t))}static hvc1(e){let t=e.avcc;const i=e.codecWidth,r=e.codecHeight;let o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,r>>>8&255,255&r,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return mt.box(mt.types.hvc1,o,mt.box(mt.types.hvcC,t))}static mvex(e){return mt.box(mt.types.mvex,mt.trex(e))}static trex(e){let t=e.id,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return mt.box(mt.types.trex,i)}static moof(e,t){return mt.box(mt.types.moof,mt.mfhd(e.sequenceNumber),mt.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return mt.box(mt.types.mfhd,t)}static traf(e,t){let i=e.id,r=mt.box(mt.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),o=mt.box(mt.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),s=mt.sdtp(e),a=mt.trun(e,s.byteLength+16+16+8+16+8+8);return mt.box(mt.types.traf,r,o,a,s)}static sdtp(e){let t=new Uint8Array(5),i=e.flags;return t[4]=i.isLeading<<6|i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy,mt.box(mt.types.sdtp,t)}static trun(e,t){let i=new Uint8Array(28);t+=36,i.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let r=e.duration,o=e.size,s=e.flags,a=e.cts;return i.set([r>>>24&255,r>>>16&255,r>>>8&255,255&r,o>>>24&255,o>>>16&255,o>>>8&255,255&o,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12),mt.box(mt.types.trun,i)}static mdat(e){return mt.box(mt.types.mdat,e)}}mt.init();class gt extends Ve{constructor(e){super(),this.player=e,this.isAvc=!0,this.mediaSource=new window.MediaSource,this.sourceBuffer=null,this.hasInit=!1,this.isInitInfo=!1,this.cacheTrack={},this.timeInit=!1,this.sequenceNumber=0,this.mediaSourceOpen=!1,this.dropping=!1,this.firstRenderTime=null,this.mediaSourceAppendBufferError=!1,this.mediaSourceAppendBufferFull=!1,this.isDecodeFirstIIframe=!1,this.player.video.$videoElement.src=window.URL.createObjectURL(this.mediaSource);const{debug:t,events:{proxy:i}}=e;i(this.mediaSource,"sourceopen",(()=>{this.mediaSourceOpen=!0,this.player.emit(j.mseSourceOpen)})),i(this.mediaSource,"sourceclose",(()=>{this.player.emit(j.mseSourceClose)})),e.debug.log("MediaSource","init")}destroy(){this.stop(),this.mediaSource=null,this.mediaSourceOpen=!1,this.sourceBuffer=null,this.hasInit=!1,this.isInitInfo=!1,this.sequenceNumber=0,this.cacheTrack=null,this.timeInit=!1,this.mediaSourceAppendBufferError=!1,this.mediaSourceAppendBufferFull=!1,this.isDecodeFirstIIframe=!1,this.off(),this.player.debug.log("MediaSource","destroy")}get state(){return this.mediaSource&&this.mediaSource.readyState}get isStateOpen(){return this.state===ee}get isStateClosed(){return this.state===te}get isStateEnded(){return this.state===$}get duration(){return this.mediaSource&&this.mediaSource.duration}set duration(e){this.mediaSource.duration=e}decodeVideo(e,t,i,r){const o=this.player;if(o)if(this.hasInit){if(i&&0===e[1]){let t=At(e.slice(5));const i=this.player.video.videoInfo;i&&i.width&&i.height&&t&&t.codecWidth&&t.codecHeight&&(t.codecWidth!==i.width||t.codecHeight!==i.height)&&(this.player.debug.warn("MediaSource",`width or height is update, width ${i.width}-> ${t.codecWidth}, height ${i.height}-> ${t.codecHeight}`),this.isInitInfo=!1,this.player.video.init=!1)}if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){null===this.firstRenderTime&&(this.firstRenderTime=t);const o=t-this.firstRenderTime;this._decodeVideo(e,o,i,r)}else this.player.debug.warn("MediaSource","decodeVideo isDecodeFirstIIframe false")}else if(i&&0===e[1]){const r=15&e[0];if(o.video.updateVideoInfo({encTypeCode:r}),r===J)return void this.emit(F.mediaSourceH265NotSupport);o._times.decodeStart||(o._times.decodeStart=ve()),this._decodeConfigurationRecord(e,t,i,r),this.hasInit=!0}}_decodeConfigurationRecord(e,t,i,r){let o=e.slice(5),s={};s=At(o);const a={id:1,type:"video",timescale:1e3,duration:0,avcc:o,codecWidth:s.codecWidth,codecHeight:s.codecHeight,videoType:s.videoType},n=mt.generateInitSegment(a);this.isAvc=!0,this.appendBuffer(n.buffer),this.sequenceNumber=0,this.cacheTrack=null,this.timeInit=!1}_decodeVideo(e,t,i,r){const o=this.player;let s=e.slice(5),a=s.byteLength;const n=o.video.$videoElement,A=o._opt.videoBufferDelay;if(n.buffered.length>1&&(this.removeBuffer(n.buffered.start(0),n.buffered.end(0)),this.timeInit=!1),this.dropping&&t-this.cacheTrack.dts>A)this.dropping=!1,this.cacheTrack={};else if(this.cacheTrack&&t>=this.cacheTrack.dts){let e=8+this.cacheTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(mt.types.mdat,4),i.set(this.cacheTrack.data,8),this.cacheTrack.duration=t-this.cacheTrack.dts;let r=mt.moof(this.cacheTrack,this.cacheTrack.dts),s=new Uint8Array(r.byteLength+i.byteLength);s.set(r,0),s.set(i,r.byteLength),this.appendBuffer(s.buffer),o.handleRender(),o.updateStats({fps:!0,ts:t,buf:o.demux&&o.demux.delay||0}),o._times.videoStart||(o._times.videoStart=ve(),o.handlePlayToRenderTimes())}else o.debug.log("MediaSource","timeInit set false , cacheTrack = {}"),this.timeInit=!1,this.cacheTrack={};this.cacheTrack||(this.cacheTrack={}),this.cacheTrack.id=1,this.cacheTrack.sequenceNumber=++this.sequenceNumber,this.cacheTrack.size=a,this.cacheTrack.dts=t,this.cacheTrack.cts=r,this.cacheTrack.isKeyframe=i,this.cacheTrack.data=s,this.cacheTrack.flags={isLeading:0,dependsOn:i?2:1,isDependedOn:i?1:0,hasRedundancy:0,isNonSync:i?0:1},this.timeInit||1!==n.buffered.length||(o.debug.log("MediaSource","timeInit set true"),this.timeInit=!0,n.currentTime=n.buffered.end(0)),!this.isInitInfo&&n.videoWidth>0&&n.videoHeight>0&&(o.debug.log("MediaSource",`updateVideoInfo: ${n.videoWidth},${n.videoHeight}`),o.video.updateVideoInfo({width:n.videoWidth,height:n.videoHeight}),o.video.initCanvasViewSize(),this.isInitInfo=!0)}appendBuffer(e){const{debug:t,events:{proxy:i}}=this.player;if(null===this.sourceBuffer&&(this.sourceBuffer=this.mediaSource.addSourceBuffer(_),i(this.sourceBuffer,"error",(e=>{t.error("MediaSource","sourceBuffer error",e),this.player.emit(j.mseSourceBufferError,e)}))),this.mediaSourceAppendBufferError)t.error("MediaSource","this.mediaSourceAppendBufferError is true");else if(this.mediaSourceAppendBufferFull)t.error("MediaSource","this.mediaSourceAppendBufferFull is true");else if(!1===this.sourceBuffer.updating&&this.isStateOpen)try{this.sourceBuffer.appendBuffer(e)}catch(e){t.warn("MediaSource","this.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.emit(F.mediaSourceFull)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.emit(F.mediaSourceAppendBufferError)):(t.error("MediaSource","appendBuffer error",e),this.player.emit(j.mseSourceBufferError,e))}else this.isStateClosed?this.player.emitError(F.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed"):this.isStateEnded?this.player.emitError(F.mseSourceBufferError,"mediaSource is closed"):!0===this.sourceBuffer.updating&&this.player.emit(j.mseSourceBufferBusy)}stop(){this.abortSourceBuffer(),this.removeSourceBuffer(),this.endOfStream()}dropSourceBuffer(e){const t=this.player.video.$videoElement;this.dropping=e,t.buffered.length>0&&t.buffered.end(0)-t.currentTime>1&&(this.player.debug.warn("MediaSource","dropSourceBuffer",`$video.buffered.end(0) is ${t.buffered.end(0)} - $video.currentTime ${t.currentTime}`),t.currentTime=t.buffered.end(0))}removeBuffer(e,t){if(this.isStateOpen&&!1===this.sourceBuffer.updating)try{this.sourceBuffer.remove(e,t)}catch(e){this.player.debug.warn("MediaSource","removeBuffer() error",e)}else this.player.debug.warn("MediaSource","removeBuffer() this.isStateOpen is",this.isStateOpen,"this.sourceBuffer.updating",this.sourceBuffer.updating)}endOfStream(){const e=this.player.video&&this.player.video.$videoElement;if(this.isStateOpen&&e&&e.readyState>=1)try{this.mediaSource.endOfStream()}catch(e){this.player.debug.warn("MediaSource","endOfStream() error",e)}}abortSourceBuffer(){this.isStateOpen&&this.sourceBuffer&&(this.sourceBuffer.abort(),this.sourceBuffer=null)}removeSourceBuffer(){if(!this.isStateClosed&&this.mediaSource&&this.sourceBuffer)try{this.mediaSource.removeSourceBuffer(this.sourceBuffer)}catch(e){this.player.debug.warn("MediaSource","removeSourceBuffer() error",e)}}getSourceBufferUpdating(){return this.sourceBuffer&&this.sourceBuffer.updating}}const ft=()=>"undefined"!=typeof navigator&&parseFloat((""+(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))<10&&!window.MSStream,bt=()=>"wakeLock"in navigator;class yt{constructor(e){if(this.player=e,this.enabled=!1,bt()){this._wakeLock=null;const e=()=>{null!==this._wakeLock&&"visible"===document.visibilityState&&this.enable()};document.addEventListener("visibilitychange",e),document.addEventListener("fullscreenchange",e)}else ft()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep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FhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxh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IBJIAOo4WCATqADqOZgQFDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggFPgA6jhYIBZIAOo5mBAWsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAXqADqOFggGPgA6jmYEBkwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIBpIAOo4WCAbqADqOZgQG7ADECAAEQEAAYABhYL/QACIBDmAYAAKOFggHPgA6jmYEB4wAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIB5IAOo4WCAfqADqOZgQILADECAAEQEAAYABhYL/QACIBDmAYAAKOFggIPgA6jhYICJIAOo5mBAjMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAjqADqOFggJPgA6jmYECWwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYICZIAOo4WCAnqADqOZgQKDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggKPgA6jhYICpIAOo5mBAqsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCArqADqOFggLPgA6jmIEC0wARAgABEBAUYABhYL/QACIBDmAYAKOFggLkgA6jhYIC+oAOo5mBAvsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAw+ADqOZgQMjADECAAEQEAAYABhYL/QACIBDmAYAAKOFggMkgA6jhYIDOoAOo5mBA0sAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA0+ADqOFggNkgA6jmYEDcwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIDeoAOo4WCA4+ADqOZgQObADECAAEQEAAYABhYL/QACIBDmAYAAKOFggOkgA6jhYIDuoAOo5mBA8MAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA8+ADqOFggPkgA6jhYID+oAOo4WCBA+ADhxTu2sBAAAAAAAAEbuPs4EDt4r3gQHxghEr8IEK"),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI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AAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"),this.noSleepVideo.addEventListener("loadedmetadata",(()=>{this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",(()=>{this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())}))})))}_addSourceToVideo(e,t,i){var r=document.createElement("source");r.src=i,r.type=`video/${t}`,e.appendChild(r)}get isEnabled(){return this.enabled}enable(){const e=this.player.debug;if(bt())return navigator.wakeLock.request("screen").then((t=>{this._wakeLock=t,this.enabled=!0,e.log("wakeLock","Wake Lock active."),this._wakeLock.addEventListener("release",(()=>{e.log("wakeLock","Wake Lock released.")}))})).catch((t=>{throw this.enabled=!1,e.error("wakeLock",`${t.name}, ${t.message}`),t}));if(ft())return this.disable(),this.noSleepTimer=window.setInterval((()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))}),15e3),this.enabled=!0,Promise.resolve();return this.noSleepVideo.play().then((e=>(this.enabled=!0,e))).catch((e=>{throw this.enabled=!1,e}))}disable(){const e=this.player.debug;bt()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):ft()?this.noSleepTimer&&(e.warn("wakeLock","NoSleep now disabled for older iOS devices."),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}class vt extends Ve{constructor(e,t){var i;super(),this.$container=e,this._opt=Object.assign({},h,t),this.debug=new me(this),this.debug.log("Player","init"),this._opt.forceNoOffscreen=!0,(Re()||/ipad|android(?!.*mobile)|tablet|kindle|silk/i.test(window.navigator.userAgent.toLowerCase()))&&(this.debug.log("Player","isMobile and set _opt.controlAutoHide false"),this._opt.controlAutoHide=!1),fe.isEnabled&&this._opt.useWebFullScreen&&(this.debug.log("Player","screenfull.isEnabled is true and _opt.useWebFullScreen is true , set _opt.useWebFullScreen false"),this._opt.useWebFullScreen=!1),Oe(fe.isEnabled)&&Oe(this._opt.useWebFullScreen)&&(this.debug.log("Player","screenfull.isEnabled is false and _opt.useWebFullScreen is false , set _opt.useWebFullScreen true"),this._opt.useWebFullScreen=!0),this._opt.useWCS&&(this._opt.useWCS="VideoEncoder"in window),this._opt.useMSE&&(this._opt.useMSE=window.MediaSource&&window.MediaSource.isTypeSupported(_)),this._opt.wcsUseVideoRender&&(this._opt.wcsUseVideoRender=window.MediaStreamTrackGenerator&&"function"==typeof window.MediaStreamTrackGenerator),this._opt.useMSE&&(this._opt.useWCS&&this.debug.log("Player","useWCS set true->false"),this._opt.forceNoOffscreen||this.debug.log("Player","forceNoOffscreen set false->true"),this._opt.useWCS=!1,this._opt.forceNoOffscreen=!0),this._opt.forceNoOffscreen||("undefined"==typeof OffscreenCanvas?(this._opt.forceNoOffscreen=!0,this._opt.useOffscreen=!1):this._opt.useOffscreen=!0),this._opt.hasAudio||(this._opt.operateBtns.audio=!1),this._opt.hasControl=this._hasControl(),this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._checkHeartTimeout=null,this._checkLoadingTimeout=null,this._checkStatsInterval=null,this._startBpsTime=null,this._isPlayingBeforePageHidden=!1,this._stats={buf:0,fps:0,abps:0,vbps:0,ts:0},this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this._videoTimestamp=0,this._audioTimestamp=0,i=this,Object.defineProperty(i,"rect",{get:()=>{const e=i.$container.getBoundingClientRect();return e.width=Math.max(e.width,i.$container.clientWidth),e.height=Math.max(e.height,i.$container.clientHeight),e}}),["bottom","height","left","right","top","width"].forEach((e=>{Object.defineProperty(i,e,{get:()=>i.rect[e]})})),this.events=new ge(this),this.video=new ze(this),this._opt.hasAudio&&(this.audio=new Xe(this)),this.recorder=new et(this),this._onlyMseOrWcsVideo()?this.loaded=!0:this.decoderWorker=new tt(this),this.stream=null,this.demux=null,this._lastVolume=null,this._opt.useWCS&&(this.webcodecsDecoder=new dt(this),this.loaded=!0),this._opt.useMSE&&(this.mseDecoder=new gt(this),this.loaded=!0),this.control=new pt(this),Re()&&(this.keepScreenOn=new yt(this)),(e=>{try{const t=t=>{je(t)===e.$container&&(e.emit(L.fullscreen,e.fullscreen),e.fullscreen?e._opt.useMSE&&e.resize():e.resize())};fe.on("change",t),e.events.destroys.push((()=>{fe.off("change",t)}))}catch(e){}if(e.on(j.decoderWorkerInit,(()=>{e.debug.log("player","has loaded"),e.loaded=!0})),e.on(j.play,(()=>{e.loading=!1})),e.on(j.fullscreen,(t=>{if(t)try{fe.request(e.$container).then((()=>{})).catch((t=>{Re()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}))}catch(t){Re()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}else try{fe.exit().then((()=>{e.webFullscreen&&(e.webFullscreen=!1)})).catch((()=>{e.webFullscreen=!1}))}catch(t){e.webFullscreen=!1}})),Re()&&e.on(j.webFullscreen,(t=>{t?e.$container.classList.add("jessibuca-fullscreen-web"):e.$container.classList.remove("jessibuca-fullscreen-web"),e.emit(L.fullscreen,e.fullscreen)})),e.on(j.resize,(()=>{e.video&&e.video.resize()})),e._opt.debug){const t=[j.timeUpdate],i=[j.stats,j.playToRenderTimes,j.audioInfo,j.videoInfo];Object.keys(j).forEach((r=>{e.on(j[r],(o=>{t.includes(r)||(i.includes(r)&&(o=JSON.stringify(o)),e.debug.log("player events",j[r],o))}))})),Object.keys(F).forEach((t=>{e.on(F[t],(i=>{e.debug.log("player event error",F[t],i)}))}))}})(this),(e=>{const{_opt:t,debug:i,events:{proxy:r}}=e;t.supportDblclickFullscreen&&r(e.$container,"dblclick",(t=>{const i=je(t).nodeName.toLowerCase();"canvas"!==i&&"video"!==i||(e.fullscreen=!e.fullscreen)})),r(document,"visibilitychange",(()=>{t.hiddenAutoPause&&(i.log("visibilitychange",document.visibilityState,e._isPlayingBeforePageHidden),"visible"===document.visibilityState?e._isPlayingBeforePageHidden&&e.play():(e._isPlayingBeforePageHidden=e.playing,e.playing&&e.pause()))})),r(window,"fullscreenchange",(()=>{null!==e.keepScreenOn&&"visible"===document.visibilityState&&e.enableWakeLock()}))})(this),this.debug.log("Player","init and version is",u),this._opt.useWCS&&this.debug.log("Player","use WCS"),this._opt.useMSE&&this.debug.log("Player","use MSE"),this._opt.useOffscreen&&this.debug.log("Player","use offscreen");try{this.debug.log("Player options",JSON.stringify(this._opt))}catch(e){}}async destroy(){this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._lastVolume=null,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.decoderWorker&&(await this.decoderWorker.destroy(),this.decoderWorker=null),this.video&&(this.video.destroy(),this.video=null),this.audio&&(this.audio.destroy(),this.audio=null),this.stream&&(await this.stream.destroy(),this.stream=null),this.recorder&&(this.recorder.destroy(),this.recorder=null),this.control&&(this.control.destroy(),this.control=null),this.webcodecsDecoder&&(this.webcodecsDecoder.destroy(),this.webcodecsDecoder=null),this.mseDecoder&&(this.mseDecoder.destroy(),this.mseDecoder=null),this.demux&&(this.demux.destroy(),this.demux=null),this.events&&(this.events.destroy(),this.events=null),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.releaseWakeLock(),this.keepScreenOn=null,this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this.emit("destroy"),this.off(),this.debug.log("play","destroy end")}set fullscreen(e){Re()&&this._opt.useWebFullScreen?(this.emit(j.webFullscreen,e),setTimeout((()=>{this.updateOption({rotate:e?270:0}),this.resize()}),10)):this.emit(j.fullscreen,e)}get fullscreen(){return fe.isFullscreen||this.webFullscreen}set webFullscreen(e){this.emit(j.webFullscreen,e)}get webFullscreen(){return this.$container.classList.contains("jessibuca-fullscreen-web")}set loaded(e){this._hasLoaded=e}get loaded(){return this._hasLoaded}set playing(e){e&&(this.loading=!1),this.playing!==e&&(this._playing=e,this.emit(j.playing,e),this.emit(j.volumechange,this.volume),e?this.emit(j.play):this.emit(j.pause))}get playing(){return this._playing}get volume(){return this.audio&&this.audio.volume||0}set volume(e){e!==this.volume&&(this.audio&&this.audio.setVolume(e),this._lastVolume=e)}get lastVolume(){return this._lastVolume}set loading(e){this.loading!==e&&(this._loading=e,this.emit(j.loading,this._loading))}get loading(){return this._loading}set recording(e){e?this.playing&&this.recorder&&this.recorder.startRecord():this.recorder&&this.recorder.stopRecordAndSave()}get recording(){return!!this.recorder&&this.recorder.recording}set audioTimestamp(e){null!==e&&(this._audioTimestamp=e)}get audioTimestamp(){return this._audioTimestamp}set videoTimestamp(e){null!==e&&(this._videoTimestamp=e,this._opt.useWCS||this._opt.useMSE||this.audioTimestamp&&this.videoTimestamp&&this.audio&&this.audio.emit(j.videoSyncAudio,{audioTimestamp:this.audioTimestamp,videoTimestamp:this.videoTimestamp,diff:this.audioTimestamp-this.videoTimestamp}))}get videoTimestamp(){return this._videoTimestamp}get isDebug(){return!0===this._opt.debug}updateOption(e){this._opt=Object.assign({},this._opt,e)}init(){return new Promise(((e,t)=>{this.stream||(this.stream=new Ke(this)),this.audio||this._opt.hasAudio&&(this.audio=new Xe(this)),this.demux||(this.demux=new st(this)),this._opt.useWCS&&(this.webcodecsDecoder||(this.webcodecsDecoder=new dt(this))),this._opt.useMSE&&(this.mseDecoder||(this.mseDecoder=new gt(this))),this.decoderWorker||this._onlyMseOrWcsVideo()?e():(this.decoderWorker=new tt(this),this.debug.log("Player","waiting decoderWorker init"),this.once(j.decoderWorkerInit,(()=>{this.debug.log("Player","decoderWorker init success"),e()})))}))}play(e,t){return new Promise(((i,r)=>{if(!e&&!this._opt.url)return r();this.loading=!0,this.playing=!1,this._times.playInitStart=ve(),e||(e=this._opt.url),this._opt.url=e,this.clearCheckHeartTimeout(),this.init().then((()=>{this._times.playStart=ve(),this._opt.isNotMute&&this.mute(!1),this.webcodecsDecoder&&this.webcodecsDecoder.once(F.webcodecsH265NotSupport,(()=>{this.emit(F.webcodecsH265NotSupport),this._opt.autoWasm||this.emit(j.error,F.webcodecsH265NotSupport)})),this.mseDecoder&&(this.mseDecoder.once(F.mediaSourceH265NotSupport,(()=>{this.emit(F.mediaSourceH265NotSupport),this._opt.autoWasm||this.emit(j.error,F.mediaSourceH265NotSupport)})),this.mseDecoder.once(F.mediaSourceFull,(()=>{this.emitError(F.mediaSourceFull)})),this.mseDecoder.once(F.mediaSourceAppendBufferError,(()=>{this.emitError(F.mediaSourceAppendBufferError)})),this.mseDecoder.once(F.mediaSourceBufferListLarge,(()=>{this.emitError(F.mediaSourceBufferListLarge)})),this.mseDecoder.once(F.mediaSourceAppendBufferEndTimeout,(()=>{this.emitError(F.mediaSourceAppendBufferEndTimeout)}))),this.enableWakeLock(),this.stream.fetchStream(e,t),this.checkLoadingTimeout(),this.stream.once(F.fetchError,(e=>{this.emitError(F.fetchError,e)})),this.stream.once(F.websocketError,(e=>{this.emitError(F.websocketError,e)})),this.stream.once(j.streamEnd,(e=>{this.emitError(j.streamEnd,e)})),this.stream.once(j.streamSuccess,(()=>{i(),this._times.streamResponse=ve(),this.video.play(),this.checkStatsInterval()}))})).catch((e=>{r(e)}))}))}close(){return new Promise(((e,t)=>{this._close().then((()=>{this.video&&this.video.clearView(),e()}))}))}resumeAudioAfterPause(){this.lastVolume&&(this.volume=this.lastVolume)}_close(){return new Promise(((e,t)=>{this.stream&&(this.stream.destroy(),this.stream=null),this.demux&&(this.demux.destroy(),this.demux=null),this.decoderWorker&&(this.decoderWorker.destroy(),this.decoderWorker=null),this.webcodecsDecoder&&(this.webcodecsDecoder.destroy(),this.webcodecsDecoder=null),this.mseDecoder&&(this.mseDecoder.destroy(),this.mseDecoder=null),this.audio&&(this.audio.destroy(),this.audio=null),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.playing=!1,this.loading=!1,this.recording=!1,this.video&&(this.video.resetInit(),this.video.pause(!0)),this.releaseWakeLock(),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},setTimeout((()=>{e()}),0)}))}pause(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?this.close():this._close()}mute(e){this.audio&&this.audio.mute(e)}resize(){this.video.resize()}startRecord(e,t){this.recording||(this.recorder.setFileName(e,t),this.recording=!0)}stopRecordAndSave(){this.recording&&(this.recording=!1)}_hasControl(){let e=!1,t=!1;return Object.keys(this._opt.operateBtns).forEach((e=>{this._opt.operateBtns[e]&&(t=!0)})),(this._opt.showBandwidth||this._opt.text||t)&&(e=!0),e}_onlyMseOrWcsVideo(){return!1===this._opt.hasAudio&&(this._opt.useMSE||this._opt.useWCS&&!this._opt.useOffscreen)}checkHeart(){this.clearCheckHeartTimeout(),this.checkHeartTimeout()}checkHeartTimeout(){this._checkHeartTimeout=setTimeout((()=>{if(this.playing){if(0!==this._stats.fps)return;this.pause().then((()=>{this.emit(j.timeout,j.delayTimeout),this.emit(j.delayTimeout)}))}}),1e3*this._opt.heartTimeout)}checkStatsInterval(){this._checkStatsInterval=setInterval((()=>{this.updateStats()}),1e3)}clearCheckHeartTimeout(){this._checkHeartTimeout&&(clearTimeout(this._checkHeartTimeout),this._checkHeartTimeout=null)}checkLoadingTimeout(){this._checkLoadingTimeout=setTimeout((()=>{this.playing||this.pause().then((()=>{this.emit(j.timeout,j.loadingTimeout),this.emit(j.loadingTimeout)}))}),1e3*this._opt.loadingTimeout)}clearCheckLoadingTimeout(){this._checkLoadingTimeout&&(clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}handleRender(){this.loading&&(this.emit(j.start),this.loading=!1,this.clearCheckLoadingTimeout()),this.playing||(this.playing=!0),this.checkHeart()}updateStats(e){e=e||{},this._startBpsTime||(this._startBpsTime=ve()),xe(e.ts)&&(this._stats.ts=e.ts),xe(e.buf)&&(this._stats.buf=e.buf),e.fps&&(this._stats.fps+=1),e.abps&&(this._stats.abps+=e.abps),e.vbps&&(this._stats.vbps+=e.vbps);const t=ve();t-this._startBpsTime<1e3||(this.emit(j.stats,this._stats),this.emit(j.performance,function(e){let t=0;return e>=24?t=2:e>=15&&(t=1),t}(this._stats.fps)),this._stats.fps=0,this._stats.abps=0,this._stats.vbps=0,this._startBpsTime=t)}resetStats(){this._startBpsTime=null,this._stats={buf:0,fps:0,abps:0,vbps:0,ts:0}}enableWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.enable()}releaseWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.disable()}handlePlayToRenderTimes(){const e=this._times;e.playTimestamp=e.playStart-e.playInitStart,e.streamTimestamp=e.streamStart-e.playStart,e.streamResponseTimestamp=e.streamResponse-e.streamStart,e.demuxTimestamp=e.demuxStart-e.streamResponse,e.decodeTimestamp=e.decodeStart-e.demuxStart,e.videoTimestamp=e.videoStart-e.decodeStart,e.allTimestamp=e.videoStart-e.playInitStart,this.emit(j.playToRenderTimes,e)}getOption(){return this._opt}emitError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.emit(j.error,e,t),this.emit(e,t)}isControlBarShow(){const e=this._opt.hasControl,t=this._opt.controlAutoHide;let i=e&&!t;return i&&this.control&&(i=this.control.getBarIsShow()),i}getControlBarShow(){let e=!1;return this.control&&(e=this.control.getBarIsShow()),e}toggleControlBar(e){this.control&&(this.control.toggleBar(e),this.resize())}}class wt extends Ve{constructor(e){super();let t=e,i=e.container;if("string"==typeof e.container&&(i=document.querySelector(e.container)),!i)throw new Error("Jessibuca need container option");if("CANVAS"===i.nodeName||"VIDEO"===i.nodeName)throw new Error(`Jessibuca container type can not be ${i.nodeName} type`);if(t.videoBuffer>=t.heartTimeout)throw new Error(`Jessibuca videoBuffer ${t.videoBuffer}s must be less than heartTimeout ${t.heartTimeout}s`);if(this._checkHasCreated(i))throw new Error("Jessibuca container has been created and can not be created again",i);if(t.videoBuffer>10&&console.warn("Jessibuca",`videoBuffer ${t.videoBuffer}s is too long, will black screen for ${t.videoBuffer}s , it is recommended to set it to less than 10s`),!i.classList)throw new Error("Jessibuca container option must be DOM Element");var r,o,s;i.classList.add("jessibuca-container"),r=i,o=l,s="xxxxxxxxxxxx4xxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),r&&(r.dataset?r.dataset[o]=s:r.setAttribute("data-"+o,s)),delete t.container,t.forceNoOffscreen=!0,Re()&&(t.controlAutoHide=!1),xe(t.videoBuffer)&&(t.videoBuffer=1e3*Number(t.videoBuffer)),xe(t.timeout)&&(Te(t.loadingTimeout)&&(t.loadingTimeout=t.timeout),Te(t.heartTimeout)&&(t.heartTimeout=t.timeout)),this._opt=t,this.$container=i,this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this.initDecoderWorkerTimeout=null,this._destroyed=!1,this.events=new ge(this),this.debug=new me(this),this._initPlayer(i,t),console.log('Jessibuca version: "3.2.6"')}async destroy(){var e,t;this._destroyed=!0,this.off(),this._clearInitDecoderWorkerTimeout(),this.player&&(await this.player.destroy(),this.player=null),this.events&&(this.events.destroy(),this.events=null),this.$container&&(this.$container.classList.remove("jessibuca-container"),this.$container.classList.remove("jessibuca-fullscreen-web"),e=this.$container,t=l,e&&(e.dataset?delete e.dataset[t]:e.removeAttribute("data-"+t)),this.$container=null),this._opt={},this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0}_initPlayer(e,t){this.player=new vt(e,t);try{this.debug.log("jessibuca","_initPlayer",JSON.stringify(this.player.getOption()))}catch(e){}this._bindEvents()}_resetPlayer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.player.destroy(),this.player=null,this._opt=Object.assign(this._opt,e),this._opt.url="",this._initPlayer(this.$container,this._opt)}_bindEvents(){Object.keys(L).forEach((e=>{this.player.on(L[e],(t=>{this.emit(e,t)}))}))}isDestroyed(){return this._destroyed}setDebug(e){this.player.updateOption({debug:!!e})}mute(){this.player.mute(!0)}cancelMute(){this.player.mute(!1)}setVolume(e){this.player.volume=e}audioResume(){this.player.audio&&this.player.audio.audioEnabled(!0)}setTimeout(e){e=Number(e),this.player.updateOption({timeout:e,loadingTimeout:e,heartTimeout:e})}setScaleMode(e){let t={isFullResize:!1,isResize:!1};switch(e=Number(e)){case N:t.isFullResize=!1,t.isResize=!1;break;case H:t.isFullResize=!1,t.isResize=!0;break;case z:t.isFullResize=!0,t.isResize=!0}this.player.updateOption(t),this.resize()}pause(){return new Promise(((e,t)=>{this.player?this.player.pause().then((()=>{e()})).catch((e=>{t(e)})):t("player is null")}))}async close(){return await this.destroy(),!0}clearView(){this.player.video.clearView()}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,r)=>{if(!this.isDestroyed())return e||this._opt.url?void(e?this._opt.url?e===this._opt.url?this.player.playing?i():(this.clearView(),this.player.play(this._opt.url,this._opt.playOptions).then((()=>{i(),this.player.resumeAudioAfterPause()})).catch((e=>{this.debug.warn("jessibuca","pause -> play and play error",e),this.player.pause().then((()=>{r(e)}))}))):this.player.pause().then((()=>{this.clearView(),this._play(e,t).then((()=>{i()})).catch((e=>{this.debug.warn("jessibuca","this._play error",e),r(e)}))})).catch((e=>{this.debug.warn("jessibuca","this._opt.url is null and pause error",e),r(e)})):this._play(e,t).then((()=>{i()})).catch((e=>{this.debug.warn("jessibuca","this._play error",e),r(e)})):this.player.play(this._opt.url,this._opt.playOptions).then((()=>{i(),this.player.resumeAudioAfterPause()})).catch((e=>{this.debug.warn("jessibuca","url is null and play error",e),this.player.pause().then((()=>{r(e)}))}))):(this.emit(j.error,F.playError),void r("play url is empty"));r("Jessibuca is destroyed")}))}_play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,r)=>{this._opt.url=e,this._opt.playOptions=t;const o=0===e.indexOf("http"),d=o?a:s,c=o||-1!==e.indexOf(".flv")||this._opt.isFlv?n:A;this.player.updateOption({protocol:d,demuxType:c}),this.player.once(F.webglAlignmentError,(()=>{this.pause().then((()=>{this.debug.log("Jessibuca","webglAlignmentError"),this._resetPlayer({openWebglAlignment:!0}),this.play(e,t).then((()=>{this.debug.log("Jessibuca","webglAlignmentError and play success")})).catch((()=>{this.debug.log("Jessibuca","webglAlignmentError and play error")}))}))})),this.player.once(F.mediaSourceH265NotSupport,(()=>{this.pause().then((()=>{this.player._opt.autoWasm?(this.debug.log("Jessibuca","auto wasm [mse-> wasm] reset player and play"),this._resetPlayer({useMSE:!1}),this.play(e,t).then((()=>{this.debug.log("Jessibuca","auto wasm [mse-> wasm] reset player and play success")})).catch((()=>{this.debug.log("Jessibuca","auto wasm [mse-> wasm] reset player and play error")}))):this.debug.log("Jessibuca","media source h265 not support and paused")}))})),this.player.once(F.mediaSourceFull,(()=>{this.pause().then((()=>{this.debug.log("Jessibuca","media source full"),this._resetPlayer(),this.play(e,t).then((()=>{this.debug.log("Jessibuca","media source full and reset player and play success")})).catch((()=>{this.debug.warn("Jessibuca","media source full and reset player and play error")}))}))})),this.player.once(F.mediaSourceAppendBufferError,(()=>{this.pause().then((()=>{this.debug.log("Jessibuca","media source append buffer error"),this._resetPlayer(),this.play(e,t).then((()=>{this.debug.log("Jessibuca","media source append buffer error and reset player and play success")})).catch((()=>{this.debug.warn("Jessibuca","media source append buffer error and reset player and play error")}))}))})),this.player.once(F.mediaSourceBufferListLarge,(()=>{this.pause().then((()=>{this.debug.log("Jessibuca","media source buffer list large"),this._resetPlayer(),this.play(e,t).then((()=>{this.debug.log("Jessibuca","media source buffer list large and reset player and play success")})).catch((()=>{this.debug.warn("Jessibuca","media source buffer list large and reset player and play error")}))}))})),this.player.once(F.mediaSourceAppendBufferEndTimeout,(()=>{this.pause().then((()=>{this.debug.log("Jessibuca","media source append buffer end timeout"),this._resetPlayer(),this.play(e,t).then((()=>{this.debug.log("Jessibuca","media source append buffer end timeout and reset player and play success")})).catch((()=>{this.debug.warn("Jessibuca","media source append buffer end timeout and reset player and play error")}))}))})),this.player.once(F.mseSourceBufferError,(()=>{this.pause().then((()=>{this.player._opt.autoWasm?(this.debug.log("Jessibuca","auto wasm [mse-> wasm] reset player and play"),this._resetPlayer({useMSE:!1}),this.play(e,t).then((()=>{this.debug.log("Jessibuca","auto wasm [mse-> wasm] reset player and play success")})).catch((()=>{this.debug.warn("Jessibuca","auto wasm [mse-> wasm] reset player and play error")}))):this.debug.log("Jessibuca","mse source buffer error and paused")}))})),this.player.once(F.webcodecsH265NotSupport,(()=>{this.pause().then((()=>{this.player._opt.autoWasm?(this.debug.log("Jessibuca","auto wasm [wcs-> wasm] reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e,t).then((()=>{this.debug.log("Jessibuca","auto wasm [wcs-> wasm] reset player and play success")})).catch((()=>{this.debug.warn("Jessibuca","auto wasm [wcs-> wasm] reset player and play error")}))):this.debug.log("Jessibuca","webcodecs h265 not support and paused")}))})),this.player.once(F.webcodecsWidthOrHeightChange,(()=>{this.pause().then((()=>{this.debug.log("Jessibuca","webcodecs Width Or Height Change reset player and play"),this._resetPlayer({useWCS:!0}),this.play(e,t).then((()=>{this.debug.log("Jessibuca","webcodecs Width Or Height Change reset player and play success")})).catch((()=>{this.debug.warn("Jessibuca","webcodecs Width Or Height Change reset player and play error")}))}))})),this.player.once(F.webcodecsDecodeError,(()=>{this.pause().then((()=>{this.player._opt.autoWasm?(this.debug.log("Jessibuca","webcodecs decode error reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e,t).then((()=>{this.debug.log("Jessibuca","webcodecs decode error reset player and play success")})).catch((()=>{this.debug.warn("Jessibuca","webcodecs decode error reset player and play error")}))):this.debug.log("Jessibuca","webcodecs decode error and paused")}))})),this.player.once(F.webcodecsConfigureError,(()=>{this.pause().then((()=>{this.player._opt.autoWasm?(this.debug.log("Jessibuca","webcodecs Configure error reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e,t).then((()=>{this.debug.log("Jessibuca","webcodecs Configure error reset player and play success")})).catch((()=>{this.debug.warn("Jessibuca","webcodecs Configure error reset player and play error")}))):this.debug.log("Jessibuca","webcodecs Configure error and paused")}))})),this.player.once(F.wasmDecodeError,(()=>{this.player._opt.wasmDecodeErrorReplay?this.pause().then((()=>{this.debug.log("Jessibuca","wasm decode error and reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e,t).then((()=>{this.debug.log("Jessibuca","wasm decode error and reset player and play success")})).catch((e=>{this.debug.warn("Jessibuca","wasm decode error and reset player and play error")}))})):this.pause().then((()=>{this.debug.log("Jessibuca","wasm decode error and paused")})).catch((e=>{this.debug.warn("Jessibuca","wasm decode error and paused error",e)}))})),this.player.once(F.fetchError,(()=>{this.pause().then((()=>{this.debug.log("Jessibuca","fetch error and pause play")})).catch((e=>{this.debug.warn("Jessibuca","fetch error and pause play error",e)}))})),this.player.once(F.websocketError,(()=>{this.pause().then((()=>{this.debug.log("Jessibuca","websocket Error and pause play")})).catch((e=>{this.debug.warn("Jessibuca","websocket Error and pause play error",e)}))})),this.player.once(j.streamEnd,(()=>{this.pause().then((()=>{this.debug.log("Jessibuca","stream End and pause play")})).catch((e=>{this.debug.warn("Jessibuca","stream End and pause play error",e)}))})),this.player.on(j.delayTimeout,(()=>{this.player._opt.heartTimeoutReplay&&(this._heartTimeoutReplayTimes{this._heartTimeoutReplayTimes=0})).catch((()=>{})))})),this.player.on(j.loadingTimeout,(()=>{this.player._opt.loadingTimeoutReplay&&(this._loadingTimeoutReplayTimes{this._loadingTimeoutReplayTimes=0})).catch((()=>{})))})),this.hasLoaded()?this.player.play(e,t).then((()=>{i()})).catch((e=>{this.debug.warn("Jessibuca","hasLoaded and play error",e),this.player&&this.player.pause().then((()=>{r(e)}))})):(this.debug.log("Jessibuca","_play ant waiting decoderWorkerInit"),this._checkInitDecoderWorkerTimeout(),this.player.once(j.decoderWorkerInit,(()=>{this._clearInitDecoderWorkerTimeout(),this.isDestroyed()||(this.debug.log("Jessibuca","_play decoderWorkerInit success and play"),this.player.play(e,t).then((()=>{i()})).catch((e=>{this.debug.warn("Jessibuca","decoderWorkerInit and play error",e),this.player&&this.player.pause().then((()=>{r(e)}))})))})))}))}resize(){this.player.resize()}setBufferTime(e){e=Number(e),this.player.updateOption({videoBuffer:1e3*e}),this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"videoBuffer",value:1e3*e})}setRotate(e){e=parseInt(e,10);this._opt.rotate!==e&&-1!==[0,90,180,270].indexOf(e)&&(this.player.updateOption({rotate:e}),this.resize())}hasLoaded(){return this.player.loaded}setKeepScreenOn(){this.player.updateOption({keepScreenOn:!0})}setFullscreen(e){const t=!!e;this.player.fullscreen!==t&&(this.player.fullscreen=t)}screenshot(e,t,i,r){return this.player.video?this.player.video.screenshot(e,t,i,r):""}startRecord(e,t){return new Promise(((i,r)=>{this.player.playing?(this.player.startRecord(e,t),i()):r()}))}stopRecordAndSave(){this.player.recording&&this.player.stopRecordAndSave()}isPlaying(){return!!this.player&&this.player.playing}isMute(){return!this.player.audio||this.player.audio.isMute}isRecording(){return this.player.recorder.recording}_checkHasCreated(e){if(!e)return!1;const t=function(e,t){return e?e.dataset?e.dataset[t]:e.getAttribute("data-"+t):""}(e,l);return!!t}toggleControlBar(e){this.isDestroyed()||this.player&&this.player.toggleControlBar(e)}getControlBarShow(){if(this.isDestroyed())return!1;let e=!1;return this.player&&(e=this.player.getControlBarShow()),e}_clearInitDecoderWorkerTimeout(){this.initDecoderWorkerTimeout&&(clearTimeout(this.initDecoderWorkerTimeout),this.initDecoderWorkerTimeout=null)}_checkInitDecoderWorkerTimeout(){this._clearInitDecoderWorkerTimeout(),this.initDecoderWorkerTimeout=setTimeout((()=>{this._handleInitDecoderWorkerTimeout()}),1e3*this._opt.initDecoderWorkerTimeout)}_handleInitDecoderWorkerTimeout(){this.pause().then((()=>{this.debug.log("Jessibuca","init decoder worker timeout and pause play")})).catch((e=>{this.debug.warn("Jessibuca","init decoder worker timeout and pause play error",e)}))}}return o(wt,"ERROR",F),o(wt,"TIMEOUT",{loadingTimeout:j.loadingTimeout,delayTimeout:j.delayTimeout}),window.Jessibuca=wt,wt})); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).jessibuca=t()}(this,(function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t){return e(t={exports:{}},t.exports),t.exports}var i,r=t((function(e){e.exports=function(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e},e.exports.__esModule=!0,e.exports.default=e.exports})),o=(i=r)&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i;const s=0,a=1,n="flv",A="m7s",d="mp4",c="webm",l="jessibuca",u='"3.2.8"',h={videoBuffer:1e3,videoBufferDelay:1e3,isResize:!0,isFullResize:!1,isFlv:!1,debug:!1,hotKey:!1,loadingTimeout:10,heartTimeout:5,timeout:10,loadingTimeoutReplay:!0,heartTimeoutReplay:!0,loadingTimeoutReplayTimes:3,heartTimeoutReplayTimes:3,supportDblclickFullscreen:!1,showBandwidth:!1,keepScreenOn:!1,isNotMute:!1,hasAudio:!0,hasVideo:!0,operateBtns:{fullscreen:!1,screenshot:!1,play:!1,audio:!1,record:!1},controlAutoHide:!1,hasControl:!1,loadingText:"",background:"",decoder:"decoder.js",url:"",rotate:0,forceNoOffscreen:!0,hiddenAutoPause:!1,protocol:a,demuxType:n,useWCS:!1,wcsUseVideoRender:!1,useMSE:!1,useOffscreen:!1,autoWasm:!0,wasmDecodeErrorReplay:!0,openWebglAlignment:!1,wasmDecodeAudioSyncVideo:!1,recordType:c,useWebFullScreen:!1,initDecoderWorkerTimeout:10},p="init",m="initVideo",g="render",f="playAudio",b="initAudio",y="audioCode",v="videoCode",w="wasmError",S="Invalid NAL unit size",E=1,B=2,C=8,R=9,k="init",T="decode",I="audioDecode",x="close",D="updateConfig",j={fullscreen:"fullscreen$2",webFullscreen:"webFullscreen",decoderWorkerInit:"decoderWorkerInit",play:"play",playing:"playing",pause:"pause",mute:"mute",load:"load",loading:"loading",videoInfo:"videoInfo",timeUpdate:"timeUpdate",audioInfo:"audioInfo",log:"log",error:"error",kBps:"kBps",timeout:"timeout",delayTimeout:"delayTimeout",loadingTimeout:"loadingTimeout",stats:"stats",performance:"performance",record:"record",recording:"recording",recordingTimestamp:"recordingTimestamp",recordStart:"recordStart",recordEnd:"recordEnd",recordCreateError:"recordCreateError",buffer:"buffer",videoFrame:"videoFrame",start:"start",metadata:"metadata",resize:"resize",streamEnd:"streamEnd",streamSuccess:"streamSuccess",streamMessage:"streamMessage",streamError:"streamError",volumechange:"volumechange",volume:"volume",destroy:"destroy",mseSourceOpen:"mseSourceOpen",mseSourceClose:"mseSourceClose",mseSourceBufferError:"mseSourceBufferError",mseSourceBufferBusy:"mseSourceBufferBusy",mseSourceBufferFull:"mseSourceBufferFull",videoWaiting:"videoWaiting",videoTimeUpdate:"videoTimeUpdate",videoSyncAudio:"videoSyncAudio",playToRenderTimes:"playToRenderTimes"},L={load:j.load,timeUpdate:j.timeUpdate,videoInfo:j.videoInfo,audioInfo:j.audioInfo,error:j.error,kBps:j.kBps,log:j.log,start:j.start,timeout:j.timeout,loadingTimeout:j.loadingTimeout,delayTimeout:j.delayTimeout,fullscreen:"fullscreen",webFullscreen:j.webFullscreen,play:j.play,pause:j.pause,mute:j.mute,stats:j.stats,volumechange:j.volumechange,performance:j.performance,recordingTimestamp:j.recordingTimestamp,recordStart:j.recordStart,recordEnd:j.recordEnd,playToRenderTimes:j.playToRenderTimes,volume:j.volume},F={playError:"playIsNotPauseOrUrlIsNull",fetchError:"fetchError",websocketError:"websocketError",webcodecsH265NotSupport:"webcodecsH265NotSupport",webcodecsConfigureError:"webcodecsConfigureError",webcodecsDecodeError:"webcodecsDecodeError",webcodecsWidthOrHeightChange:"webcodecsWidthOrHeightChange",mediaSourceH265NotSupport:"mediaSourceH265NotSupport",mediaSourceFull:j.mseSourceBufferFull,mseSourceBufferError:j.mseSourceBufferError,mediaSourceAppendBufferError:"mediaSourceAppendBufferError",mediaSourceBufferListLarge:"mediaSourceBufferListLarge",mediaSourceAppendBufferEndTimeout:"mediaSourceAppendBufferEndTimeout",wasmDecodeError:"wasmDecodeError",webglAlignmentError:"webglAlignmentError"},V="notConnect",O="open",M="close",U="error",Q={download:"download",base64:"base64",blob:"blob"},W={7:"H264(AVC)",12:"H265(HEVC)"},J=12,P={10:"AAC",7:"ALAW",8:"MULAW"},G=38,N=0,H=1,z=2,Y="webcodecs",X="webgl",q="offscreen",Z="key",K="delta",_='video/mp4; codecs="avc1.64002A"',$="ended",ee="open",te="closed",ie=1e3,re=27,oe=38,se=40,ae="A key frame is required after configure() or flush()",ne="Cannot call 'decode' on a closed codec",Ae="The user aborted a request",de="AbortError",ce="AbortError",le=0,ue=1,he=3,pe=16;class me{constructor(e){this.log=function(t){if(e._opt&&e._opt.debug){for(var i=arguments.length,r=new Array(i>1?i-1:0),o=1;o1?i-1:0),o=1;o1?t-1:0),r=1;r3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,i,r)));e.addEventListener(t,i,r);const o=()=>e.removeEventListener(t,i,r);return this.destroys.push(o),o}destroy(){this.master.debug&&this.master.debug.log("Events","destroy"),this.destroys.forEach((e=>e()))}}var fe=t((function(e){!function(){var t="undefined"!=typeof window&&void 0!==window.document?window.document:{},i=e.exports,r=function(){for(var e,i=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],r=0,o=i.length,s={};r0&&void 0!==arguments[0]?arguments[0]:"";const t=e.split(","),i=atob(t[1]),r=t[0].replace("data:","").replace(";base64","");let o=i.length,s=new Uint8Array(o);for(;o--;)s[o]=i.charCodeAt(o);return new File([s],"file",{type:r})}function ve(){return(new Date).getTime()}function we(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}function Se(e,t,i){if(e)return"object"==typeof t&&Object.keys(t).forEach((i=>{Se(e,i,t[i])})),e.style[t]=i,e}function Ee(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return 0;const r=getComputedStyle(e,null).getPropertyValue(t);return i?parseFloat(r):r}function Be(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function Ce(e){let t=0,i=Be();return r=>{t+=r;const o=Be(),s=o-i;s>=1e3&&(e(t/s*1e3),i=o,t=0)}}function Re(){return/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase())}function ke(e){if(null==e||""===e||0===parseInt(e)||isNaN(parseInt(e)))return"0KB/s";let t=parseFloat(e);return t=t.toFixed(2),t+"KB/s"}function Te(e){return null==e}function Ie(e){return!0===e||!1===e}function xe(e){return!Te(e)}function De(e){var t;if(e>-1){var i=Math.floor(e/3600),r=Math.floor(e/60)%60,o=e%60;t=i<10?"0"+i+":":i+":",r<10&&(t+="0"),t+=r+":",(o=Math.round(o))<10&&(t+="0"),t+=o.toFixed(0)}return t}function je(e){const t=e||window.event;return t.target||t.srcElement}function Le(e){let t=!1;return e&&e.parentNode&&(e.parentNode.removeChild(e),t=!0),t}function Fe(e,t){let i=[];i[0]=t?28:44,i[1]=1,i[2]=0,i[3]=0,i[4]=0;const r=new Uint8Array(i.length+e.byteLength);return r.set(i,0),r.set(e,i.length),r}function Ve(e){return!0!==e&&"true"!==e}fe.isEnabled,(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();class Oe{on(e,t,i){const r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:i}),this}once(e,t,i){const r=this;function o(){r.off(e,o);for(var s=arguments.length,a=new Array(s),n=0;n1?i-1:0),o=1;o{delete i[e]})),void delete this.e;const r=i[e],o=[];if(r&&t)for(let e=0,i=r.length;e=200&&t.status<=299}function Je(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(i){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var Pe=Ue.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),Ge="object"!=typeof window||window!==Ue?function(){}:"download"in HTMLAnchorElement.prototype&&!Pe?function(e,t,i){var r=Ue.URL||Ue.webkitURL,o=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",o.download=t,o.rel="noopener","string"==typeof e?(o.href=e,o.origin!==location.origin?We(o.href)?Qe(e,t,i):Je(o,o.target="_blank"):Je(o)):(o.href=r.createObjectURL(e),setTimeout((function(){r.revokeObjectURL(o.href)}),4e4),setTimeout((function(){Je(o)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download","string"==typeof e)if(We(e))Qe(e,t,i);else{var r=document.createElement("a");r.href=e,r.target="_blank",setTimeout((function(){Je(r)}))}else navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e}(e,i),t)}:function(e,t,i,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof e)return Qe(e,t,i);var o="application/octet-stream"===e.type,s=/constructor/i.test(Ue.HTMLElement)||Ue.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent);if((a||o&&s||Pe)&&"undefined"!=typeof FileReader){var n=new FileReader;n.onloadend=function(){var e=n.result;e=a?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=e:location=e,r=null},n.readAsDataURL(e)}else{var A=Ue.URL||Ue.webkitURL,d=A.createObjectURL(e);r?r.location=d:location.href=d,r=null,setTimeout((function(){A.revokeObjectURL(d)}),4e4)}};class Ne extends Me{constructor(e){super(),this.player=e;const t=document.createElement("canvas");t.style.position="absolute",t.style.top=0,t.style.left=0,this.$videoElement=t,e.$container.appendChild(this.$videoElement),this.context2D=null,this.contextGl=null,this.contextGlRender=null,this.contextGlDestroy=null,this.bitmaprenderer=null,this.renderType=null,this.videoInfo={width:"",height:"",encType:""},this._initCanvasRender(),this.player.debug.log("CanvasVideo","init")}async destroy(){super.destroy(),this.contextGl&&(this.contextGl=null),this.context2D&&(this.context2D=null),this.contextGlRender&&(this.contextGlDestroy&&this.contextGlDestroy(),this.contextGlDestroy=null,this.contextGlRender=null),this.bitmaprenderer&&(this.bitmaprenderer=null),this.renderType=null,this.player.debug.log("CanvasVideoLoader","destroy")}_initContextGl(){if(this.contextGl=function(e){let t=null;const i=["webgl","experimental-webgl","moz-webgl","webkit-3d"];let r=0;for(;!t&&r{var i=["attribute vec4 vertexPos;","attribute vec4 texturePos;","varying vec2 textureCoord;","void main()","{","gl_Position = vertexPos;","textureCoord = texturePos.xy;","}"].join("\n"),r=["precision highp float;","varying highp vec2 textureCoord;","uniform sampler2D ySampler;","uniform sampler2D uSampler;","uniform sampler2D vSampler;","const mat4 YUV2RGB = mat4","(","1.1643828125, 0, 1.59602734375, -.87078515625,","1.1643828125, -.39176171875, -.81296875, .52959375,","1.1643828125, 2.017234375, 0, -1.081390625,","0, 0, 0, 1",");","void main(void) {","highp float y = texture2D(ySampler, textureCoord).r;","highp float u = texture2D(uSampler, textureCoord).r;","highp float v = texture2D(vSampler, textureCoord).r;","gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;","}"].join("\n");t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);var o=e.createShader(e.VERTEX_SHADER);e.shaderSource(o,i),e.compileShader(o),e.getShaderParameter(o,e.COMPILE_STATUS)||console.log("Vertex shader failed to compile: "+e.getShaderInfoLog(o));var s=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(s,r),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS)||console.log("Fragment shader failed to compile: "+e.getShaderInfoLog(s));var a=e.createProgram();e.attachShader(a,o),e.attachShader(a,s),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS)||console.log("Program failed to compile: "+e.getProgramInfoLog(a)),e.useProgram(a);var n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var A=e.getAttribLocation(a,"vertexPos");e.enableVertexAttribArray(A),e.vertexAttribPointer(A,2,e.FLOAT,!1,0,0);var d=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,d),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var c=e.getAttribLocation(a,"texturePos");function l(t,i){var r=e.createTexture();return e.bindTexture(e.TEXTURE_2D,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),e.uniform1i(e.getUniformLocation(a,t),i),r}e.enableVertexAttribArray(c),e.vertexAttribPointer(c,2,e.FLOAT,!1,0,0);var u=l("ySampler",0),h=l("uSampler",1),p=l("vSampler",2);return{render:function(t,i,r,o,s){e.viewport(0,0,t,i),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,u),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,t,i,0,e.LUMINANCE,e.UNSIGNED_BYTE,r),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,h),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,t/2,i/2,0,e.LUMINANCE,e.UNSIGNED_BYTE,o),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,p),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,t/2,i/2,0,e.LUMINANCE,e.UNSIGNED_BYTE,s),e.drawArrays(e.TRIANGLE_STRIP,0,4)},destroy:function(){try{e.deleteProgram(a),e.deleteBuffer(n),e.deleteBuffer(d),e.deleteTexture(u),e.deleteTexture(h),e.deleteTexture(p)}catch(e){}}}})(this.contextGl,this.player._opt.openWebglAlignment);this.contextGlRender=e.render,this.contextGlDestroy=e.destroy}else this.player.debug.error("CanvasVideoLoader","init webgl fail")}_initContext2D(){this.context2D=this.$videoElement.getContext("2d")}_initCanvasRender(){this.player._opt.useWCS&&!this._supportOffscreen()?(this.renderType=Y,this._initContext2D()):this._supportOffscreen()?(this.renderType=q,this._bindOffscreen()):(this.renderType=X,this._initContextGl())}_supportOffscreen(){return"function"==typeof this.$videoElement.transferControlToOffscreen&&this.player._opt.useOffscreen}_bindOffscreen(){this.bitmaprenderer=this.$videoElement.getContext("bitmaprenderer")}initCanvasViewSize(){this.$videoElement.width=this.videoInfo.width,this.$videoElement.height=this.videoInfo.height,this.resize()}render(e){switch(this.player.videoTimestamp=e.ts,this.renderType){case q:this.bitmaprenderer.transferFromImageBitmap(e.buffer);break;case X:this.contextGlRender(this.$videoElement.width,this.$videoElement.height,e.output[0],e.output[1],e.output[2]);break;case Y:this.context2D.drawImage(e.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height),(t=e.videoFrame).close?t.close():t.destroy&&t.destroy()}var t}screenshot(e,t,i,r){e=e||ve(),r=r||Q.download;const o={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"};let s=.92;!o[t]&&Q[t]&&(r=t,t="png",i=void 0),"string"==typeof i&&(r=i,i=void 0),void 0!==i&&(s=Number(i));const a=this.$videoElement.toDataURL(o[t]||o.png,s);if(r===Q.base64)return a;{const t=ye(a);if(r===Q.blob)return t;r===Q.download&&Ge(t,e)}}clearView(){switch(this.renderType){case q:(function(e,t){const i=document.createElement("canvas");return i.width=e,i.height=t,window.createImageBitmap(i,0,0,e,t)})(this.$videoElement.width,this.$videoElement.height).then((e=>{this.bitmaprenderer.transferFromImageBitmap(e)}));break;case X:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case Y:this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height)}}resize(){this.player.debug.log("canvasVideo","resize");const e=this.player._opt;let t=this.player.width,i=this.player.height;this.player.isControlBarShow()&&(Re()&&this.player.fullscreen&&e.useWebFullScreen?t-=G:i-=G);let r=this.$videoElement.width,o=this.$videoElement.height;const s=e.rotate;let a=(t-r)/2,n=(i-o)/2;270!==s&&90!==s||(r=this.$videoElement.height,o=this.$videoElement.width);const A=t/r,d=i/o;let c=A>d?d:A;e.isResize||A!==d&&(c=A+","+d),e.isFullResize&&(c=A>d?A:d);let l="scale("+c+")";s&&(l+=" rotate("+s+"deg)"),this.$videoElement.style.transform=l,this.$videoElement.style.left=a+"px",this.$videoElement.style.top=n+"px"}}class He extends Me{constructor(e){super(),this.player=e;const t=document.createElement("video"),i=document.createElement("canvas");t.muted=!0,t.disablePictureInPicture=!0,function(){const e=window.navigator.userAgent.toLowerCase();return/android/i.test(e)}()&&(t.poster="noposter"),t.style.position="absolute",t.style.top=0,t.style.left=0,this._delayPlay=!1,e.$container.appendChild(t),this.videoInfo={width:"",height:"",encType:""};const r=this.player._opt;r.useWCS&&r.wcsUseVideoRender&&(this.trackGenerator=new MediaStreamTrackGenerator({kind:"video"}),t.srcObject=new MediaStream([this.trackGenerator]),this.vwriter=this.trackGenerator.writable.getWriter()),this.$videoElement=t,this.$canvasElement=i,this.canvasContext=i.getContext("2d"),this.fixChromeVideoFlashBug(),this.resize();const{proxy:o}=this.player.events;o(this.$videoElement,"canplay",(()=>{this.player.debug.log("Video","canplay"),this._delayPlay&&(this.player.debug.log("Video","canplay and _delayPlay is true and next play()"),this._play())})),o(this.$videoElement,"waiting",(()=>{this.player.debug.log("Video","waiting")})),o(this.$videoElement,"timeupdate",(e=>{const t=parseInt(e.timeStamp,10);this.player.emit(j.timeUpdate,t),!this.isPlaying()&&this.init&&(this.player.debug.log("Video","timeupdate and this.isPlaying is false and retry play"),this.$videoElement.play())})),this.player.debug.log("Video","init")}async destroy(){super.destroy(),this.$canvasElement=null,this.canvasContext=null,this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.src="",this.$videoElement.removeAttribute("src"),this.$videoElement=null),this.trackGenerator&&(this.trackGenerator.stop(),this.trackGenerator=null),this.vwriter&&(await this.vwriter.close(),this.vwriter=null),this.player.debug.log("Video","destroy")}fixChromeVideoFlashBug(){const e=function(){const e=navigator.userAgent.toLowerCase(),t={},i={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:e.indexOf("chrome")>-1&&e.indexOf("safari")>-1,Firefox:e.indexOf("firefox")>-1,Opera:e.indexOf("opera")>-1,Safari:e.indexOf("safari")>-1&&-1==e.indexOf("chrome"),Edge:e.indexOf("edge")>-1,QQBrowser:/qqbrowser/.test(e),WeixinBrowser:/MicroMessenger/i.test(e)};for(let r in i)if(i[r]){let i="";if("IE"===r)i=e.match(/(msie\s|trident.*rv:)([\w.]+)/)[2];else if("Chrome"===r){for(let e in navigator.mimeTypes)"application/360softmgrplugin"===navigator.mimeTypes[e].type&&(r="360");i=e.match(/chrome\/([\d.]+)/)[1]}else"Firefox"===r?i=e.match(/firefox\/([\d.]+)/)[1]:"Opera"===r?i=e.match(/opera\/([\d.]+)/)[1]:"Safari"===r?i=e.match(/version\/([\d.]+)/)[1]:"Edge"===r?i=e.match(/edge\/([\d.]+)/)[1]:"QQBrowser"===r&&(i=e.match(/qqbrowser\/([\d.]+)/)[1]);t.type=r,t.version=parseInt(i)}return t}().type.toLowerCase();if("chrome"===e||"edge"===e){const e=this.player.$container;e.style.backdropFilter="blur(0px)",e.style.translateZ="0"}}play(){if(this.$videoElement){const e=this._getVideoReadyState();if(this.player.debug.log("Video",`play and readyState: ${e}`),0===e)return this.player.debug.warn("Video","readyState is 0 and set _delayPlay to true"),void(this._delayPlay=!0);this._play()}}_getVideoReadyState(){let e=0;return this.$videoElement&&(e=this.$videoElement.readyState),e}_play(){this.$videoElement&&this.$videoElement.play().then((()=>{this._delayPlay=!1,this.player.debug.log("Video","_play success"),setTimeout((()=>{this.isPlaying()||(this.player.debug.warn("Video","play failed and retry play"),this._play())}),100)})).catch((e=>{this.player.debug.error("Video","_play error",e)}))}pause(e){e?this.$videoElement&&this.$videoElement.pause():setTimeout((()=>{this.$videoElement&&this.$videoElement.pause()}),100)}clearView(){}screenshot(e,t,i,r){e=e||ve(),r=r||Q.download;const o={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"};let s=.92;!o[t]&&Q[t]&&(r=t,t="png",i=void 0),"string"==typeof i&&(r=i,i=void 0),void 0!==i&&(s=Number(i));const a=this.$videoElement;let n=this.$canvasElement;n.width=a.videoWidth,n.height=a.videoHeight,this.canvasContext.drawImage(a,0,0,n.width,n.height);const A=n.toDataURL(o[t]||o.png,s);if(this.canvasContext.clearRect(0,0,n.width,n.height),n.width=0,n.height=0,r===Q.base64)return A;{const t=ye(A);if(r===Q.blob)return t;r===Q.download&&Ge(t,e)}}initCanvasViewSize(){this.resize()}render(e){this.vwriter&&(this.vwriter.write(e.videoFrame),e.videoFrame.close())}resize(){let e=this.player.width,t=this.player.height;const i=this.player._opt,r=i.rotate;this.player.isControlBarShow()&&(Re()&&this.player.fullscreen&&i.useWebFullScreen?e-=G:t-=G),this.$videoElement.width=e,this.$videoElement.height=t,270!==r&&90!==r||(this.$videoElement.width=t,this.$videoElement.height=e);let o=(e-this.$videoElement.width)/2,s=(t-this.$videoElement.height)/2,a="contain";i.isResize||(a="fill"),i.isFullResize&&(a="none"),this.$videoElement.style.objectFit=a,this.$videoElement.style.transform="rotate("+r+"deg)",this.$videoElement.style.left=o+"px",this.$videoElement.style.top=s+"px"}isPlaying(){return this.$videoElement&&!this.$videoElement.paused}}class ze{constructor(e){return new(ze.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.useMSE||e.useWCS&&!e.useOffscreen&&e.wcsUseVideoRender?He:Ne}}class Ye extends Oe{constructor(e){super(),this.bufferList=[],this.player=e,this.scriptNode=null,this.hasInitScriptNode=!1,this.audioContextChannel=null,this.audioContext=new(window.AudioContext||window.webkitAudioContext),this.gainNode=this.audioContext.createGain();const t=this.audioContext.createBufferSource();t.buffer=this.audioContext.createBuffer(1,1,22050),t.connect(this.audioContext.destination),t.noteOn?t.noteOn(0):t.start(0),this.audioBufferSourceNode=t,this.mediaStreamAudioDestinationNode=this.audioContext.createMediaStreamDestination(),this.audioEnabled(!0),this.gainNode.gain.value=0,this._prevVolume=null,this.playing=!1,this.audioSyncVideoOption={diff:null},this.audioInfo={encType:"",channels:"",sampleRate:""},this.init=!1,this.hasAudio=!1,this.on(j.videoSyncAudio,(e=>{this.audioSyncVideoOption=e})),this.player.debug.log("AudioContext","init")}resetInit(){this.init=!1,this.audioInfo={encType:"",channels:"",sampleRate:""}}async destroy(){this.closeAudio(),this.resetInit(),this.audioContext&&(await this.audioContext.close(),this.audioContext=null),this.gainNode=null,this.hasAudio=!1,this.playing=!1,this.scriptNode&&(this.scriptNode.onaudioprocess=be,this.scriptNode=null),this.audioBufferSourceNode=null,this.mediaStreamAudioDestinationNode=null,this.hasInitScriptNode=!1,this.audioSyncVideoOption={diff:null},this._prevVolume=null,this.off(),this.player.debug.log("AudioContext","destroy")}updateAudioInfo(e){e.encTypeCode&&(this.audioInfo.encType=P[e.encTypeCode],this.audioInfo.encTypeCode=e.encTypeCode),e.channels&&(this.audioInfo.channels=e.channels),e.sampleRate&&(this.audioInfo.sampleRate=e.sampleRate),this.audioInfo.sampleRate&&this.audioInfo.channels&&this.audioInfo.encType&&!this.init&&(this.player.emit(j.audioInfo,this.audioInfo),this.init=!0)}get isPlaying(){return this.playing}get isMute(){return 0===this.gainNode.gain.value}get volume(){return this.gainNode.gain.value}get bufferSize(){return this.bufferList.length}initScriptNode(){if(this.playing=!0,this.hasInitScriptNode)return;const e=this.audioInfo.channels,t=this.audioContext.createScriptProcessor(1024,0,e);t.onaudioprocess=t=>{const i=t.outputBuffer;if(this.bufferList.length&&this.playing){if(!this.player._opt.useWCS&&!this.player._opt.useMSE&&this.player._opt.wasmDecodeAudioSyncVideo){if(this.audioSyncVideoOption.diff>ie)return void this.player.debug.warn("AudioContext",`audioSyncVideoOption more than diff :${this.audioSyncVideoOption.diff}, waiting`);if(this.audioSyncVideoOption.diff<-1e3){this.player.debug.warn("AudioContext",`audioSyncVideoOption less than diff :${this.audioSyncVideoOption.diff}, dropping`);let e=this.bufferList.shift();for(;e.ts-this.player.videoTimestamp<-1e3&&this.bufferList.length>0;)e=this.bufferList.shift();if(0===this.bufferList.length)return}}if(0===this.bufferList.length)return;const t=this.bufferList.shift();t&&t.ts&&(this.player.audioTimestamp=t.ts);for(let r=0;r0?this.player.emit(j.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(j.mute,!0),this.gainNode.gain.value=e,this.gainNode.gain.setValueAtTime(e,this.audioContext.currentTime),this.player.emit(j.volumechange,this.player.volume),this.player.emit(j.volume,this.player.volume),this._prevVolume=e)}closeAudio(){this.hasInitScriptNode&&(this.scriptNode&&this.scriptNode.disconnect(this.gainNode),this.gainNode&&this.gainNode.disconnect(this.audioContext.destination),this.gainNode&&this.gainNode.disconnect(this.mediaStreamAudioDestinationNode)),this.clear()}audioEnabled(e){e?"suspended"===this.audioContext.state&&this.audioContext.resume():"running"===this.audioContext.state&&this.audioContext.suspend()}isStateRunning(){return"running"===this.audioContext.state}isStateSuspended(){return"suspended"===this.audioContext.state}clear(){this.bufferList=[]}play(e,t){this.isMute||(this.hasAudio=!0,this.bufferList.push({buffer:e,ts:t}),this.bufferList.length>20&&(this.player.debug.warn("AudioContext",`bufferList is large: ${this.bufferList.length}`),this.bufferList.length>50&&this.bufferList.shift()))}pause(){this.audioSyncVideoOption={diff:null},this.playing=!1,this.clear()}resume(){this.playing=!0}getLastVolume(){return this._prevVolume}}class Xe{constructor(e){return new(Xe.getLoaderFactory())(e)}static getLoaderFactory(){return Ye}}class qe extends Oe{constructor(e){super(),this.player=e,this.playing=!1,this.abortController=new AbortController,this.streamRate=Ce((t=>{e.emit(j.kBps,(t/1024).toFixed(2))})),e.debug.log("FetchStream","init")}async destroy(){this.abort(),this.off(),this.streamRate=null,this.player.debug.log("FetchStream","destroy")}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{demux:i}=this.player;this.player.debug.log("FetchStream","fetchStream",e,JSON.stringify(t)),this.player._times.streamStart=ve();const r=Object.assign({signal:this.abortController.signal},{headers:t.headers||{}});fetch(e,r).then((e=>{const t=e.body.getReader();this.emit(j.streamSuccess);const r=()=>{t.read().then((e=>{let{done:t,value:o}=e;t?i.close():(this.streamRate&&this.streamRate(o.byteLength),i.dispatch(o),r())})).catch((e=>{i.close();const t=e.toString();-1===t.indexOf(Ae)&&-1===t.indexOf(de)&&e.name!==ce&&(this.abort(),this.emit(F.fetchError,e),this.player.emit(j.error,F.fetchError))}))};r()})).catch((e=>{"AbortError"!==e.name&&(i.close(),this.abort(),this.emit(F.fetchError,e),this.player.emit(j.error,F.fetchError))}))}abort(){this.abortController&&(this.abortController.abort(),this.abortController=null)}}class Ze extends Oe{constructor(e){super(),this.player=e,this.socket=null,this.socketStatus=V,this.wsUrl=null,this.streamRate=Ce((t=>{e.emit(j.kBps,(t/1024).toFixed(2))})),e.debug.log("WebsocketLoader","init")}async destroy(){this.socket&&(this.socket.close(1e3,"Client disconnecting"),this.socket=null),this.socketStatus=V,this.streamRate=null,this.wsUrl=null,this.off(),this.player.debug.log("websocketLoader","destroy")}_createWebSocket(){const e=this.player,{debug:t,events:{proxy:i},demux:r}=e;this.socket=new WebSocket(this.wsUrl),this.socket.binaryType="arraybuffer",i(this.socket,"open",(()=>{this.emit(j.streamSuccess),t.log("websocketLoader","socket open"),this.socketStatus=O})),i(this.socket,"message",(e=>{this.streamRate&&this.streamRate(e.data.byteLength),this._handleMessage(e.data)})),i(this.socket,"close",(()=>{t.log("websocketLoader","socket close"),this.emit(j.streamEnd),this.socketStatus=M})),i(this.socket,"error",(e=>{t.log("websocketLoader","socket error"),this.emit(F.websocketError,e),this.player.emit(j.error,F.websocketError),this.socketStatus=U,r.close(),t.log("websocketLoader","socket error:",e)}))}_handleMessage(e){const{demux:t}=this.player;t?t.dispatch(e):this.player.debug.warn("websocketLoader","websocket handle message demux is null")}fetchStream(e,t){this.player._times.streamStart=ve(),this.wsUrl=e,this._createWebSocket()}}class Ke{constructor(e){return new(Ke.getLoaderFactory(e._opt.protocol))(e)}static getLoaderFactory(e){return e===a?qe:e===s?Ze:void 0}}var _e=t((function(t){function i(e,t){if(!e)throw"First parameter is required.";t=new r(e,t=t||{type:"video"});var s=this;function a(i){i&&(t.initCallback=function(){i(),i=t.initCallback=null});var r=new o(e,t);(h=new r(e,t)).record(),u("recording"),t.disableLogs||console.log("Initialized recorderType:",h.constructor.name,"for output-type:",t.type)}function n(e){if(e=e||function(){},h){if("paused"===s.state)return s.resumeRecording(),void setTimeout((function(){n(e)}),1);"recording"===s.state||t.disableLogs||console.warn('Recording state should be: "recording", however current state is: ',s.state),t.disableLogs||console.log("Stopped recording "+t.type+" stream."),"gif"!==t.type?h.stop(i):(h.stop(),i()),u("stopped")}else m();function i(i){if(h){Object.keys(h).forEach((function(e){"function"!=typeof h[e]&&(s[e]=h[e])}));var r=h.blob;if(!r){if(!i)throw"Recording failed.";h.blob=r=i}if(r&&!t.disableLogs&&console.log(r.type,"->",b(r.size)),e){var o;try{o=l.createObjectURL(r)}catch(e){}"function"==typeof e.call?e.call(s,o):e(o)}t.autoWriteToDisk&&d((function(e){var i={};i[t.type+"Blob"]=e,x.Store(i)}))}else"function"==typeof e.call?e.call(s,""):e("")}}function A(e){postMessage((new FileReaderSync).readAsDataURL(e))}function d(e,i){if(!e)throw"Pass a callback function over getDataURL.";var r=i?i.blob:(h||{}).blob;if(!r)return t.disableLogs||console.warn("Blob encoder did not finish its job yet."),void setTimeout((function(){d(e,i)}),1e3);if("undefined"==typeof Worker||navigator.mozGetUserMedia){var o=new FileReader;o.readAsDataURL(r),o.onload=function(t){e(t.target.result)}}else{var s=function(e){try{var t=l.createObjectURL(new Blob([e.toString(),"this.onmessage = function (eee) {"+e.name+"(eee.data);}"],{type:"application/javascript"})),i=new Worker(t);return l.revokeObjectURL(t),i}catch(e){}}(A);s.onmessage=function(t){e(t.data)},s.postMessage(r)}}function c(e){e=e||0,"paused"!==s.state?"stopped"!==s.state&&(e>=s.recordingDuration?n(s.onRecordingStopped):(e+=1e3,setTimeout((function(){c(e)}),1e3))):setTimeout((function(){c(e)}),1e3)}function u(e){s&&(s.state=e,"function"==typeof s.onStateChanged.call?s.onStateChanged.call(s,e):s.onStateChanged(e))}var h,p='It seems that recorder is destroyed or "startRecording" is not invoked for '+t.type+" recorder.";function m(){!0!==t.disableLogs&&console.warn(p)}var g={startRecording:function(i){return t.disableLogs||console.log("RecordRTC version: ",s.version),i&&(t=new r(e,i)),t.disableLogs||console.log("started recording "+t.type+" stream."),h?(h.clearRecordedData(),h.record(),u("recording"),s.recordingDuration&&c(),s):(a((function(){s.recordingDuration&&c()})),s)},stopRecording:n,pauseRecording:function(){h?"recording"===s.state?(u("paused"),h.pause(),t.disableLogs||console.log("Paused recording.")):t.disableLogs||console.warn("Unable to pause the recording. Recording state: ",s.state):m()},resumeRecording:function(){h?"paused"===s.state?(u("recording"),h.resume(),t.disableLogs||console.log("Resumed recording.")):t.disableLogs||console.warn("Unable to resume the recording. Recording state: ",s.state):m()},initRecorder:a,setRecordingDuration:function(e,t){if(void 0===e)throw"recordingDuration is required.";if("number"!=typeof e)throw"recordingDuration must be a number.";return s.recordingDuration=e,s.onRecordingStopped=t||function(){},{onRecordingStopped:function(e){s.onRecordingStopped=e}}},clearRecordedData:function(){h?(h.clearRecordedData(),t.disableLogs||console.log("Cleared old recorded data.")):m()},getBlob:function(){if(h)return h.blob;m()},getDataURL:d,toURL:function(){if(h)return l.createObjectURL(h.blob);m()},getInternalRecorder:function(){return h},save:function(e){h?y(h.blob,e):m()},getFromDisk:function(e){h?i.getFromDisk(t.type,e):m()},setAdvertisementArray:function(e){t.advertisement=[];for(var i=e.length,r=0;r-1&&"netscape"in window&&/ rv:/.test(navigator.userAgent),m=!h&&!u&&!!navigator.webkitGetUserMedia||v()||-1!==navigator.userAgent.toLowerCase().indexOf("chrome/"),g=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);g&&!m&&-1!==navigator.userAgent.indexOf("CriOS")&&(g=!1,m=!0);var f=window.MediaStream;function b(e){if(0===e)return"0 Bytes";var t=parseInt(Math.floor(Math.log(e)/Math.log(1e3)),10);return(e/Math.pow(1e3,t)).toPrecision(3)+" "+["Bytes","KB","MB","GB","TB"][t]}function y(e,t){if(!e)throw"Blob object is required.";if(!e.type)try{e.type="video/webm"}catch(e){}var i=(e.type||"video/webm").split("/")[1];if(-1!==i.indexOf(";")&&(i=i.split(";")[0]),t&&-1!==t.indexOf(".")){var r=t.split(".");t=r[0],i=r[1]}var o=(t||Math.round(9999999999*Math.random())+888888888)+"."+i;if(void 0!==navigator.msSaveOrOpenBlob)return navigator.msSaveOrOpenBlob(e,o);if(void 0!==navigator.msSaveBlob)return navigator.msSaveBlob(e,o);var s=document.createElement("a");s.href=l.createObjectURL(e),s.download=o,s.style="display:none;opacity:0;color:transparent;",(document.body||document.documentElement).appendChild(s),"function"==typeof s.click?s.click():(s.target="_blank",s.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}))),l.revokeObjectURL(s.href)}function v(){return"undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type||(!("undefined"==typeof process||"object"!=typeof process.versions||!process.versions.electron)||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}function w(e,t){return e&&e.getTracks?e.getTracks().filter((function(e){return e.kind===(t||"audio")})):[]}function S(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}void 0===f&&"undefined"!=typeof webkitMediaStream&&(f=webkitMediaStream),void 0!==f&&void 0===f.prototype.stop&&(f.prototype.stop=function(){this.getTracks().forEach((function(e){e.stop()}))}),i.invokeSaveAsDialog=y,i.getTracks=w,i.getSeekableBlob=function(e,t){if("undefined"==typeof EBML)throw new Error("Please link: https://www.webrtc-experiment.com/EBML.js");var i=new EBML.Reader,r=new EBML.Decoder,o=EBML.tools,s=new FileReader;s.onload=function(e){r.decode(this.result).forEach((function(e){i.read(e)})),i.stop();var s=o.makeMetadataSeekable(i.metadatas,i.duration,i.cues),a=this.result.slice(i.metadataSize),n=new Blob([s,a],{type:"video/webm"});t(n)},s.readAsArrayBuffer(e)},i.bytesToSize=b,i.isElectron=v;var E={};function B(){if(p||g||u)return!0;var e,t,i=navigator.userAgent,r=""+parseFloat(navigator.appVersion),o=parseInt(navigator.appVersion,10);return(m||h)&&(e=i.indexOf("Chrome"),r=i.substring(e+7)),-1!==(t=r.indexOf(";"))&&(r=r.substring(0,t)),-1!==(t=r.indexOf(" "))&&(r=r.substring(0,t)),o=parseInt(""+r,10),isNaN(o)&&(r=""+parseFloat(navigator.appVersion),o=parseInt(navigator.appVersion,10)),o>=49}function C(e,t){var i=this;if(void 0===e)throw'First argument "MediaStream" is required.';if("undefined"==typeof MediaRecorder)throw"Your browser does not support the Media Recorder API. Please try other modules e.g. WhammyRecorder or StereoAudioRecorder.";if("audio"===(t=t||{mimeType:"video/webm"}).type){var r;if(w(e,"video").length&&w(e,"audio").length)navigator.mozGetUserMedia?(r=new f).addTrack(w(e,"audio")[0]):r=new f(w(e,"audio")),e=r;t.mimeType&&-1!==t.mimeType.toString().toLowerCase().indexOf("audio")||(t.mimeType=m?"audio/webm":"audio/ogg"),t.mimeType&&"audio/ogg"!==t.mimeType.toString().toLowerCase()&&navigator.mozGetUserMedia&&(t.mimeType="audio/ogg")}var o,s=[];function a(){i.timestamps.push((new Date).getTime()),"function"==typeof t.onTimeStamp&&t.onTimeStamp(i.timestamps[i.timestamps.length-1],i.timestamps)}function n(e){return o&&o.mimeType?o.mimeType:e.mimeType||"video/webm"}function A(){s=[],o=null,i.timestamps=[]}this.getArrayOfBlobs=function(){return s},this.record=function(){i.blob=null,i.clearRecordedData(),i.timestamps=[],d=[],s=[];var r=t;t.disableLogs||console.log("Passing following config over MediaRecorder API.",r),o&&(o=null),m&&!B()&&(r="video/vp8"),"function"==typeof MediaRecorder.isTypeSupported&&r.mimeType&&(MediaRecorder.isTypeSupported(r.mimeType)||(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",r.mimeType),r.mimeType="audio"===t.type?"audio/webm":"video/webm"));try{o=new MediaRecorder(e,r),t.mimeType=r.mimeType}catch(t){o=new MediaRecorder(e)}r.mimeType&&!MediaRecorder.isTypeSupported&&"canRecordMimeType"in o&&!1===o.canRecordMimeType(r.mimeType)&&(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",r.mimeType)),o.ondataavailable=function(e){if(e.data&&d.push("ondataavailable: "+b(e.data.size)),"number"!=typeof t.timeSlice)!e.data||!e.data.size||e.data.size<100||i.blob?i.recordingCallback&&(i.recordingCallback(new Blob([],{type:n(r)})),i.recordingCallback=null):(i.blob=t.getNativeBlob?e.data:new Blob([e.data],{type:n(r)}),i.recordingCallback&&(i.recordingCallback(i.blob),i.recordingCallback=null));else if(e.data&&e.data.size&&(s.push(e.data),a(),"function"==typeof t.ondataavailable)){var o=t.getNativeBlob?e.data:new Blob([e.data],{type:n(r)});t.ondataavailable(o)}},o.onstart=function(){d.push("started")},o.onpause=function(){d.push("paused")},o.onresume=function(){d.push("resumed")},o.onstop=function(){d.push("stopped")},o.onerror=function(e){e&&(e.name||(e.name="UnknownError"),d.push("error: "+e),t.disableLogs||(-1!==e.name.toString().toLowerCase().indexOf("invalidstate")?console.error("The MediaRecorder is not in a state in which the proposed operation is allowed to be executed.",e):-1!==e.name.toString().toLowerCase().indexOf("notsupported")?console.error("MIME type (",r.mimeType,") is not supported.",e):-1!==e.name.toString().toLowerCase().indexOf("security")?console.error("MediaRecorder security error",e):"OutOfMemory"===e.name?console.error("The UA has exhaused the available memory. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"IllegalStreamModification"===e.name?console.error("A modification to the stream has occurred that makes it impossible to continue recording. An example would be the addition of a Track while recording is occurring. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"OtherRecordingError"===e.name?console.error("Used for an fatal error other than those listed above. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"GenericError"===e.name?console.error("The UA cannot provide the codec or recording option that has been requested.",e):console.error("MediaRecorder Error",e)),function(e){if(!i.manuallyStopped&&o&&"inactive"===o.state)return delete t.timeslice,void o.start(6e5);setTimeout(void 0,1e3)}(),"inactive"!==o.state&&"stopped"!==o.state&&o.stop())},"number"==typeof t.timeSlice?(a(),o.start(t.timeSlice)):o.start(36e5),t.initCallback&&t.initCallback()},this.timestamps=[],this.stop=function(e){e=e||function(){},i.manuallyStopped=!0,o&&(this.recordingCallback=e,"recording"===o.state&&o.stop(),"number"==typeof t.timeSlice&&setTimeout((function(){i.blob=new Blob(s,{type:n(t)}),i.recordingCallback(i.blob)}),100))},this.pause=function(){o&&"recording"===o.state&&o.pause()},this.resume=function(){o&&"paused"===o.state&&o.resume()},this.clearRecordedData=function(){o&&"recording"===o.state&&i.stop(A),A()},this.getInternalRecorder=function(){return o},this.blob=null,this.getState=function(){return o&&o.state||"inactive"};var d=[];this.getAllStates=function(){return d},void 0===t.checkForInactiveTracks&&(t.checkForInactiveTracks=!1);i=this;!function r(){if(o&&!1!==t.checkForInactiveTracks)return!1===function(){if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}()?(t.disableLogs||console.log("MediaStream seems stopped."),void i.stop()):void setTimeout(r,1e3)}(),this.name="MediaStreamRecorder",this.toString=function(){return this.name}}function R(e,t){if(!w(e,"audio").length)throw"Your stream has no audio tracks.";var r,o=this,s=[],a=[],n=!1,A=0,d=2,c=(t=t||{}).desiredSampRate;function u(){if(!1===t.checkForInactiveTracks)return!0;if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}function h(e,t){function i(e,t){var i,r=e.numberOfAudioChannels,o=e.leftBuffers.slice(0),s=e.rightBuffers.slice(0),a=e.sampleRate,n=e.internalInterleavedLength,A=e.desiredSampRate;function d(e,t,i){var r=Math.round(e.length*(t/i)),o=[],s=Number((e.length-1)/(r-1));o[0]=e[0];for(var a=1;a96e3)&&(t.disableLogs||console.log("sample-rate must be under range 22050 and 96000.")),t.disableLogs||t.desiredSampRate&&console.log("Desired sample-rate: "+t.desiredSampRate);var y=!1;function v(){s=[],a=[],A=0,E=!1,n=!1,y=!1,p=null,o.leftchannel=s,o.rightchannel=a,o.numberOfAudioChannels=d,o.desiredSampRate=c,o.sampleRate=b,o.recordingLength=A,B={left:[],right:[],recordingLength:0}}function S(){r&&(r.onaudioprocess=null,r.disconnect(),r=null),m&&(m.disconnect(),m=null),v()}this.pause=function(){y=!0},this.resume=function(){if(!1===u())throw"Please make sure MediaStream is active.";if(!n)return t.disableLogs||console.log("Seems recording has been restarted."),void this.record();y=!1},this.clearRecordedData=function(){t.checkForInactiveTracks=!1,n&&this.stop(S),S()},this.name="StereoAudioRecorder",this.toString=function(){return this.name};var E=!1;r.onaudioprocess=function(e){if(!y)if(!1===u()&&(t.disableLogs||console.log("MediaStream seems stopped."),r.disconnect(),n=!1),n){E||(E=!0,t.onAudioProcessStarted&&t.onAudioProcessStarted(),t.initCallback&&t.initCallback());var i=e.inputBuffer.getChannelData(0),c=new Float32Array(i);if(s.push(c),2===d){var l=e.inputBuffer.getChannelData(1),h=new Float32Array(l);a.push(h)}A+=f,o.recordingLength=A,void 0!==t.timeSlice&&(B.recordingLength+=f,B.left.push(c),2===d&&B.right.push(h))}else m&&(m.disconnect(),m=null)},p.createMediaStreamDestination?r.connect(p.createMediaStreamDestination()):r.connect(p.destination),this.leftchannel=s,this.rightchannel=a,this.numberOfAudioChannels=d,this.desiredSampRate=c,this.sampleRate=b,o.recordingLength=A;var B={left:[],right:[],recordingLength:0};function C(){n&&"function"==typeof t.ondataavailable&&void 0!==t.timeSlice&&(B.left.length?(h({desiredSampRate:c,sampleRate:b,numberOfAudioChannels:d,internalInterleavedLength:B.recordingLength,leftBuffers:B.left,rightBuffers:1===d?[]:B.right},(function(e,i){var r=new Blob([i],{type:"audio/wav"});t.ondataavailable(r),setTimeout(C,t.timeSlice)})),B={left:[],right:[],recordingLength:0}):setTimeout(C,t.timeSlice))}}function k(e,t){if("undefined"==typeof html2canvas)throw"Please link: https://www.webrtc-experiment.com/screenshot.js";(t=t||{}).frameInterval||(t.frameInterval=10);var i=!1;["captureStream","mozCaptureStream","webkitCaptureStream"].forEach((function(e){e in document.createElement("canvas")&&(i=!0)}));var r,o,s,a=!(!window.webkitRTCPeerConnection&&!window.webkitGetUserMedia||!window.chrome),n=50,A=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);if(a&&A&&A[2]&&(n=parseInt(A[2],10)),a&&n<52&&(i=!1),t.useWhammyRecorder&&(i=!1),i)if(t.disableLogs||console.log("Your browser supports both MediRecorder API and canvas.captureStream!"),e instanceof HTMLCanvasElement)r=e;else{if(!(e instanceof CanvasRenderingContext2D))throw"Please pass either HTMLCanvasElement or CanvasRenderingContext2D.";r=e.canvas}else navigator.mozGetUserMedia&&(t.disableLogs||console.error("Canvas recording is NOT supported in Firefox."));this.record=function(){if(s=!0,i&&!t.useWhammyRecorder){var e;"captureStream"in r?e=r.captureStream(25):"mozCaptureStream"in r?e=r.mozCaptureStream(25):"webkitCaptureStream"in r&&(e=r.webkitCaptureStream(25));try{var a=new f;a.addTrack(w(e,"video")[0]),e=a}catch(e){}if(!e)throw"captureStream API are NOT available.";(o=new C(e,{mimeType:t.mimeType||"video/webm"})).record()}else h.frames=[],u=(new Date).getTime(),l();t.initCallback&&t.initCallback()},this.getWebPImages=function(i){if("canvas"===e.nodeName.toLowerCase()){var r=h.frames.length;h.frames.forEach((function(e,i){var o=r-i;t.disableLogs||console.log(o+"/"+r+" frames remaining"),t.onEncodingCallback&&t.onEncodingCallback(o,r);var s=e.image.toDataURL("image/webp",1);h.frames[i].image=s})),t.disableLogs||console.log("Generating WebM"),i()}else i()},this.stop=function(e){s=!1;var r=this;i&&o?o.stop(e):this.getWebPImages((function(){h.compile((function(i){t.disableLogs||console.log("Recording finished!"),r.blob=i,r.blob.forEach&&(r.blob=new Blob([],{type:"video/webm"})),e&&e(r.blob),h.frames=[]}))}))};var d=!1;function c(){h.frames=[],s=!1,d=!1}function l(){if(d)return u=(new Date).getTime(),setTimeout(l,500);if("canvas"===e.nodeName.toLowerCase()){var i=(new Date).getTime()-u;return u=(new Date).getTime(),h.frames.push({image:(r=document.createElement("canvas"),o=r.getContext("2d"),r.width=e.width,r.height=e.height,o.drawImage(e,0,0),r),duration:i}),void(s&&setTimeout(l,t.frameInterval))}var r,o;html2canvas(e,{grabMouse:void 0===t.showMousePointer||t.showMousePointer,onrendered:function(e){var i=(new Date).getTime()-u;if(!i)return setTimeout(l,t.frameInterval);u=(new Date).getTime(),h.frames.push({image:e.toDataURL("image/webp",1),duration:i}),s&&setTimeout(l,t.frameInterval)}})}this.pause=function(){d=!0,o instanceof C&&o.pause()},this.resume=function(){d=!1,o instanceof C?o.resume():s||this.record()},this.clearRecordedData=function(){s&&this.stop(c),c()},this.name="CanvasRecorder",this.toString=function(){return this.name};var u=(new Date).getTime(),h=new I.Video(100)}function T(e,t){function i(e){e=void 0!==e?e:10;var t=(new Date).getTime()-A;return t?s?(A=(new Date).getTime(),setTimeout(i,100)):(A=(new Date).getTime(),n.paused&&n.play(),l.drawImage(n,0,0,c.width,c.height),d.frames.push({duration:t,image:c.toDataURL("image/webp")}),void(o||setTimeout(i,e,e))):setTimeout(i,e,e)}function r(e,t,i,r,o){var s=document.createElement("canvas");s.width=c.width,s.height=c.height;var a,n,A,d=s.getContext("2d"),l=[],u=-1===t,h=t&&t>0&&t<=e.length?t:e.length,p=0,m=0,g=0,f=Math.sqrt(Math.pow(255,2)+Math.pow(255,2)+Math.pow(255,2)),b=i&&i>=0&&i<=1?i:0,y=r&&r>=0&&r<=1?r:0,v=!1;n=-1,A=(a={length:h,functionToLoop:function(t,i){var r,o,s,a=function(){!v&&s-r<=s*y||(u&&(v=!0),l.push(e[i])),t()};if(v)a();else{var n=new Image;n.onload=function(){d.drawImage(n,0,0,c.width,c.height);var e=d.getImageData(0,0,c.width,c.height);r=0,o=e.data.length,s=e.data.length/4;for(var t=0;t127)throw"TrackNumber > 127 not supported";return[128|e.trackNum,e.timecode>>8,255&e.timecode,t].map((function(e){return String.fromCharCode(e)})).join("")+e.frame}({discardable:0,frame:e.data.slice(4),invisible:0,keyframe:1,lacing:0,trackNum:1,timecode:Math.round(t)});return t+=e.duration,{data:i,id:163}})))}function i(e){for(var t=[];e>0;)t.push(255&e),e>>=8;return new Uint8Array(t.reverse())}function r(e){var t=[];e=(e.length%8?new Array(9-e.length%8).join("0"):"")+e;for(var i=0;i1?2*s[0].width:s[0].width;var n=1;3!==e&&4!==e||(n=2),5!==e&&6!==e||(n=3),7!==e&&8!==e||(n=4),9!==e&&10!==e||(n=5),o.height=s[0].height*n}else o.width=a.width||360,o.height=a.height||240;t&&t instanceof HTMLVideoElement&&u(t),s.forEach((function(e,t){u(e,t)})),setTimeout(l,a.frameInterval)}}function u(e,t){if(!r){var i=0,o=0,a=e.width,n=e.height;1===t&&(i=e.width),2===t&&(o=e.height),3===t&&(i=e.width,o=e.height),4===t&&(o=2*e.height),5===t&&(i=e.width,o=2*e.height),6===t&&(o=3*e.height),7===t&&(i=e.width,o=3*e.height),void 0!==e.stream.left&&(i=e.stream.left),void 0!==e.stream.top&&(o=e.stream.top),void 0!==e.stream.width&&(a=e.stream.width),void 0!==e.stream.height&&(n=e.stream.height),s.drawImage(e,i,o,a,n),"function"==typeof e.stream.onRender&&e.stream.onRender(s,i,o,a,n,t)}}function h(e){var i=document.createElement("video");return function(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}(e,i),i.className=t,i.muted=!0,i.volume=0,i.width=e.width||a.width||360,i.height=e.height||a.height||240,i.play(),i}function p(t){i=[],(t=t||e).forEach((function(e){if(e.getTracks().filter((function(e){return"video"===e.kind})).length){var t=h(e);t.stream=e,i.push(t)}}))}void 0!==n?c.AudioContext=n:"undefined"!=typeof webkitAudioContext&&(c.AudioContext=webkitAudioContext),this.startDrawingFrames=function(){l()},this.appendStreams=function(t){if(!t)throw"First parameter is required.";t instanceof Array||(t=[t]),t.forEach((function(t){var r=new d;if(t.getTracks().filter((function(e){return"video"===e.kind})).length){var o=h(t);o.stream=t,i.push(o),r.addTrack(t.getTracks().filter((function(e){return"video"===e.kind}))[0])}if(t.getTracks().filter((function(e){return"audio"===e.kind})).length){var s=a.audioContext.createMediaStreamSource(t);a.audioDestination=a.audioContext.createMediaStreamDestination(),s.connect(a.audioDestination),r.addTrack(a.audioDestination.stream.getTracks().filter((function(e){return"audio"===e.kind}))[0])}e.push(r)}))},this.releaseStreams=function(){i=[],r=!0,a.gainNode&&(a.gainNode.disconnect(),a.gainNode=null),a.audioSources.length&&(a.audioSources.forEach((function(e){e.disconnect()})),a.audioSources=[]),a.audioDestination&&(a.audioDestination.disconnect(),a.audioDestination=null),a.audioContext&&a.audioContext.close(),a.audioContext=null,s.clearRect(0,0,o.width,o.height),o.stream&&(o.stream.stop(),o.stream=null)},this.resetVideoStreams=function(e){!e||e instanceof Array||(e=[e]),p(e)},this.name="MultiStreamsMixer",this.toString=function(){return this.name},this.getMixedStream=function(){r=!1;var t=function(){var e;p(),"captureStream"in o?e=o.captureStream():"mozCaptureStream"in o?e=o.mozCaptureStream():a.disableLogs||console.error("Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features");var t=new d;return e.getTracks().filter((function(e){return"video"===e.kind})).forEach((function(e){t.addTrack(e)})),o.stream=t,t}(),i=function(){c.AudioContextConstructor||(c.AudioContextConstructor=new c.AudioContext);a.audioContext=c.AudioContextConstructor,a.audioSources=[],!0===a.useGainNode&&(a.gainNode=a.audioContext.createGain(),a.gainNode.connect(a.audioContext.destination),a.gainNode.gain.value=0);var t=0;if(e.forEach((function(e){if(e.getTracks().filter((function(e){return"audio"===e.kind})).length){t++;var i=a.audioContext.createMediaStreamSource(e);!0===a.useGainNode&&i.connect(a.gainNode),a.audioSources.push(i)}})),!t)return;return a.audioDestination=a.audioContext.createMediaStreamDestination(),a.audioSources.forEach((function(e){e.connect(a.audioDestination)})),a.audioDestination.stream}();return i&&i.getTracks().filter((function(e){return"audio"===e.kind})).forEach((function(e){t.addTrack(e)})),e.forEach((function(e){e.fullcanvas})),t}}function L(e,t){e=e||[];var i,r,o=this;(t=t||{elementClass:"multi-streams-mixer",mimeType:"video/webm",video:{width:360,height:240}}).frameInterval||(t.frameInterval=10),t.video||(t.video={}),t.video.width||(t.video.width=360),t.video.height||(t.video.height=240),this.record=function(){var o;i=new j(e,t.elementClass||"multi-streams-mixer"),(o=[],e.forEach((function(e){w(e,"video").forEach((function(e){o.push(e)}))})),o).length&&(i.frameInterval=t.frameInterval||10,i.width=t.video.width||360,i.height=t.video.height||240,i.startDrawingFrames()),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()),(r=new C(i.getMixedStream(),t)).record()},this.stop=function(e){r&&r.stop((function(t){o.blob=t,e(t),o.clearRecordedData()}))},this.pause=function(){r&&r.pause()},this.resume=function(){r&&r.resume()},this.clearRecordedData=function(){r&&(r.clearRecordedData(),r=null),i&&(i.releaseStreams(),i=null)},this.addStreams=function(o){if(!o)throw"First parameter is required.";o instanceof Array||(o=[o]),e.concat(o),r&&i&&(i.appendStreams(o),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()))},this.resetVideoStreams=function(e){i&&(!e||e instanceof Array||(e=[e]),i.resetVideoStreams(e))},this.getMixer=function(){return i},this.name="MultiStreamRecorder",this.toString=function(){return this.name}}function F(e,t){var i,r,o;function s(){return new ReadableStream({start:function(r){var o=document.createElement("canvas"),s=document.createElement("video"),a=!0;s.srcObject=e,s.muted=!0,s.height=t.height,s.width=t.width,s.volume=0,s.onplaying=function(){o.width=t.width,o.height=t.height;var e=o.getContext("2d"),n=1e3/t.frameRate,A=setInterval((function(){if(i&&(clearInterval(A),r.close()),a&&(a=!1,t.onVideoProcessStarted&&t.onVideoProcessStarted()),e.drawImage(s,0,0),"closed"!==r._controlledReadableStream.state)try{r.enqueue(e.getImageData(0,0,t.width,t.height))}catch(e){}}),n)},s.play()}})}function a(e,A){if(!t.workerPath&&!A)return i=!1,void fetch("https://unpkg.com/webm-wasm@latest/dist/webm-worker.js").then((function(t){t.arrayBuffer().then((function(t){a(e,t)}))}));if(!t.workerPath&&A instanceof ArrayBuffer){var d=new Blob([A],{type:"text/javascript"});t.workerPath=l.createObjectURL(d)}t.workerPath||console.error("workerPath parameter is missing."),(r=new Worker(t.workerPath)).postMessage(t.webAssemblyPath||"https://unpkg.com/webm-wasm@latest/dist/webm-wasm.wasm"),r.addEventListener("message",(function(e){"READY"===e.data?(r.postMessage({width:t.width,height:t.height,bitrate:t.bitrate||1200,timebaseDen:t.frameRate||30,realtime:t.realtime}),s().pipeTo(new WritableStream({write:function(e){i?console.error("Got image, but recorder is finished!"):r.postMessage(e.data.buffer,[e.data.buffer])}}))):e.data&&(o||n.push(e.data))}))}"undefined"!=typeof ReadableStream&&"undefined"!=typeof WritableStream||console.error("Following polyfill is strongly recommended: https://unpkg.com/@mattiasbuelens/web-streams-polyfill/dist/polyfill.min.js"),(t=t||{}).width=t.width||640,t.height=t.height||480,t.frameRate=t.frameRate||30,t.bitrate=t.bitrate||1200,t.realtime=t.realtime||!0,this.record=function(){n=[],o=!1,this.blob=null,a(e),"function"==typeof t.initCallback&&t.initCallback()},this.pause=function(){o=!0},this.resume=function(){o=!1};var n=[];this.stop=function(e){i=!0;var t=this;!function(e){r?(r.addEventListener("message",(function(t){null===t.data&&(r.terminate(),r=null,e&&e())})),r.postMessage(null)):e&&e()}((function(){t.blob=new Blob(n,{type:"video/webm"}),e(t.blob)}))},this.name="WebAssemblyRecorder",this.toString=function(){return this.name},this.clearRecordedData=function(){n=[],o=!1,this.blob=null},this.blob=null}i.DiskStorage=x,i.GifRecorder=D,i.MultiStreamRecorder=L,i.RecordRTCPromisesHandler=function(e,t){if(!this)throw'Use "new RecordRTCPromisesHandler()"';if(void 0===e)throw'First argument "MediaStream" is required.';var r=this;r.recordRTC=new i(e,t),this.startRecording=function(){return new Promise((function(e,t){try{r.recordRTC.startRecording(),e()}catch(e){t(e)}}))},this.stopRecording=function(){return new Promise((function(e,t){try{r.recordRTC.stopRecording((function(i){r.blob=r.recordRTC.getBlob(),r.blob&&r.blob.size?e(i):t("Empty blob.",r.blob)}))}catch(e){t(e)}}))},this.pauseRecording=function(){return new Promise((function(e,t){try{r.recordRTC.pauseRecording(),e()}catch(e){t(e)}}))},this.resumeRecording=function(){return new Promise((function(e,t){try{r.recordRTC.resumeRecording(),e()}catch(e){t(e)}}))},this.getDataURL=function(e){return new Promise((function(e,t){try{r.recordRTC.getDataURL((function(t){e(t)}))}catch(e){t(e)}}))},this.getBlob=function(){return new Promise((function(e,t){try{e(r.recordRTC.getBlob())}catch(e){t(e)}}))},this.getInternalRecorder=function(){return new Promise((function(e,t){try{e(r.recordRTC.getInternalRecorder())}catch(e){t(e)}}))},this.reset=function(){return new Promise((function(e,t){try{e(r.recordRTC.reset())}catch(e){t(e)}}))},this.destroy=function(){return new Promise((function(e,t){try{e(r.recordRTC.destroy())}catch(e){t(e)}}))},this.getState=function(){return new Promise((function(e,t){try{e(r.recordRTC.getState())}catch(e){t(e)}}))},this.blob=null,this.version="5.6.2"},i.WebAssemblyRecorder=F}));class $e extends Oe{constructor(e){super(),this.player=e,this.fileName="",this.fileType=e._opt.recordType||c,this.isRecording=!1,this.recordingTimestamp=0,this.recordingInterval=null,e.debug.log("Recorder","init")}destroy(){this._reset(),this.player.debug.log("Recorder","destroy")}setFileName(e,t){this.fileName=e,d!==t&&c!==t||(this.fileType=t)}get recording(){return this.isRecording}get recordTime(){return this.recordingTimestamp}startRecord(){const e=this.player.debug,t={type:"video",mimeType:"video/webm;codecs=h264",onTimeStamp:t=>{e.log("Recorder","record timestamp :"+t)},disableLogs:!this.player._opt.debug};try{const e=this.player.video.$videoElement.captureStream(25);if(this.player.audio&&this.player.audio.mediaStreamAudioDestinationNode&&this.player.audio.mediaStreamAudioDestinationNode.stream&&!this.player.audio.isStateSuspended()&&this.player.audio.hasAudio&&this.player._opt.hasAudio){const t=this.player.audio.mediaStreamAudioDestinationNode.stream;if(t.getAudioTracks().length>0){const i=t.getAudioTracks()[0];i&&i.enabled&&e.addTrack(i)}}this.recorder=_e(e,t)}catch(t){e.error("Recorder","startRecord error",t),this.emit(j.recordCreateError)}this.recorder&&(this.isRecording=!0,this.player.emit(j.recording,!0),this.recorder.startRecording(),e.log("Recorder","start recording"),this.player.emit(j.recordStart),this.recordingInterval=window.setInterval((()=>{this.recordingTimestamp+=1,this.player.emit(j.recordingTimestamp,this.recordingTimestamp)}),1e3))}stopRecordAndSave(){this.recorder&&this.isRecording&&this.recorder.stopRecording((()=>{this.player.debug.log("Recorder","stop recording"),this.player.emit(j.recordEnd);const e=(this.fileName||ve())+"."+(this.fileType||c);Ge(this.recorder.getBlob(),e),this._reset(),this.player.emit(j.recording,!1)}))}_reset(){this.isRecording=!1,this.recordingTimestamp=0,this.recorder&&(this.recorder.destroy(),this.recorder=null),this.fileName=null,this.recordingInterval&&clearInterval(this.recordingInterval),this.recordingInterval=null}}class et{constructor(e){return new(et.getLoaderFactory())(e)}static getLoaderFactory(){return $e}}class tt{constructor(e){this.player=e,this.decoderWorker=new Worker(e._opt.decoder),this._initDecoderWorker(),e.debug.log("decoderWorker","init")}async destroy(){this.decoderWorker.postMessage({cmd:x}),this.decoderWorker.terminate(),this.decoderWorker=null,this.player.debug.log("decoderWorker","destroy")}_initDecoderWorker(){const{debug:e,events:{proxy:t}}=this.player;this.decoderWorker.onmessage=t=>{const i=t.data;switch(i.cmd){case p:e.log("decoderWorker","onmessage:",p),this.player.loaded||this.player.emit(j.load),this.player.emit(j.decoderWorkerInit),this._initWork();break;case v:e.log("decoderWorker","onmessage:",v,i.code),this.player._times.decodeStart||(this.player._times.decodeStart=ve()),this.player.video.updateVideoInfo({encTypeCode:i.code});break;case y:e.log("decoderWorker","onmessage:",y,i.code),this.player.audio&&this.player.audio.updateAudioInfo({encTypeCode:i.code});break;case m:if(e.log("decoderWorker","onmessage:",m,`width:${i.w},height:${i.h}`),this.player.video.updateVideoInfo({width:i.w,height:i.h}),!this.player._opt.openWebglAlignment&&i.w/2%4!=0)return void this.player.emit(F.webglAlignmentError);this.player.video.initCanvasViewSize();break;case b:e.log("decoderWorker","onmessage:",b,`channels:${i.channels},sampleRate:${i.sampleRate}`),this.player.audio&&(this.player.audio.updateAudioInfo(i),this.player.audio.initScriptNode(i));break;case g:this.player.handleRender(),this.player.video.render(i),this.player.emit(j.timeUpdate,i.ts),this.player.updateStats({fps:!0,ts:i.ts,buf:i.delay}),this.player._times.videoStart||(this.player._times.videoStart=ve(),this.player.handlePlayToRenderTimes());break;case f:this.player.playing&&this.player.audio&&this.player.audio.play(i.buffer,i.ts);break;case w:i.message&&-1!==i.message.indexOf(S)&&this.player.emitError(F.wasmDecodeError);break;default:this.player[i.cmd]&&this.player[i.cmd](i)}}}_initWork(){const e={debug:this.player._opt.debug,useOffscreen:this.player._opt.useOffscreen,useWCS:this.player._opt.useWCS,videoBuffer:this.player._opt.videoBuffer,videoBufferDelay:this.player._opt.videoBufferDelay,openWebglAlignment:this.player._opt.openWebglAlignment};this.decoderWorker.postMessage({cmd:k,opt:JSON.stringify(e),sampleRate:this.player.audio&&this.player.audio.audioContext.sampleRate||0})}decodeVideo(e,t,i){const r={type:B,ts:Math.max(t,0),isIFrame:i};this.decoderWorker.postMessage({cmd:T,buffer:e,options:r},[e.buffer])}decodeAudio(e,t){this.player._opt.useWCS||this.player._opt.useMSE?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t)}_decodeAudio(e,t){const i={type:E,ts:Math.max(t,0)};this.decoderWorker.postMessage({cmd:T,buffer:e,options:i},[e.buffer])}_decodeAudioNoDelay(e,t){this.decoderWorker.postMessage({cmd:I,buffer:e,ts:Math.max(t,0)},[e.buffer])}updateWorkConfig(e){this.decoderWorker.postMessage({cmd:D,key:e.key,value:e.value})}}class it extends Oe{constructor(e){super(),this.player=e,this.stopId=null,this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.bufferList=[],this.dropping=!1,this.initInterval()}destroy(){this.stopId&&(clearInterval(this.stopId),this.stopId=null),this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.bufferList=[],this.dropping=!1,this.off(),this.player.debug.log("CommonDemux","destroy")}getDelay(e){if(!e)return-1;if(this.firstTimestamp){if(e){const t=Date.now()-this.startTimestamp,i=e-this.firstTimestamp;this.delay=t>=i?t-i:i-t}}else this.firstTimestamp=e,this.startTimestamp=Date.now(),this.delay=-1;return this.delay}resetDelay(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1}initInterval(){this.player.debug.log("common dumex","init Interval");let e=()=>{let e;const t=this.player._opt.videoBuffer,i=this.player._opt.videoBufferDelay;if(this.player._opt.useMSE&&this.player.mseDecoder&&this.player.mseDecoder.getSourceBufferUpdating())this.player.debug.warn("CommonDemux",`_loop getSourceBufferUpdating is true and bufferList length is ${this.bufferList.length}`);else if(this.bufferList.length)if(this.dropping){for(e=this.bufferList.shift(),e.type===E&&0===e.payload[1]&&this._doDecoderDecode(e);!e.isIFrame&&this.bufferList.length;)e=this.bufferList.shift(),e.type===E&&0===e.payload[1]&&this._doDecoderDecode(e);e.isIFrame&&this.getDelay(e.ts)<=Math.min(t,200)&&(this.dropping=!1,this._doDecoderDecode(e))}else e=this.bufferList[0],-1===this.getDelay(e.ts)?(this.bufferList.shift(),this._doDecoderDecode(e)):this.delay>t+i?(this.resetDelay(),this.dropping=!0):(e=this.bufferList[0],this.getDelay(e.ts)>t&&(this.bufferList.shift(),this._doDecoderDecode(e)))};e(),this.stopId=setInterval(e,10)}_doDecode(e,t,i,r,o){const s=this.player;let a={ts:i,cts:o,type:t,isIFrame:!1};s._opt.useWCS&&!s._opt.useOffscreen||s._opt.useMSE?(t===B&&(a.isIFrame=r),this.pushBuffer(e,a)):t===B?s.decoderWorker&&s.decoderWorker.decodeVideo(e,i,r):t===E&&s._opt.hasAudio&&s.decoderWorker&&s.decoderWorker.decodeAudio(e,i)}_doDecoderDecode(e){const t=this.player,{webcodecsDecoder:i,mseDecoder:r}=t;e.type===E?t._opt.hasAudio&&t.decoderWorker&&t.decoderWorker.decodeAudio(e.payload,e.ts):e.type===B&&(t._opt.useWCS&&!t._opt.useOffscreen?i.decodeVideo(e.payload,e.ts,e.isIFrame):t._opt.useMSE&&r.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts))}pushBuffer(e,t){t.type===E?this.bufferList.push({ts:t.ts,payload:e,type:E}):t.type===B&&this.bufferList.push({ts:t.ts,cts:t.cts,payload:e,type:B,isIFrame:t.isIFrame})}close(){}_decodeEnhancedH265Video(e,t){const i=e[0],r=48&i,o=15&i,s=e.slice(1,5),a=new ArrayBuffer(4),n=new Uint32Array(a),A="a"==String.fromCharCode(s[0]);if(o===le){if(r===pe){const t=e.slice(5);if(!A){const e=new Uint8Array(5+t.length);e.set([28,0,0,0,0],0),e.set(t,5),this._doDecode(e,B,0,!0,0)}}}else if(o===ue){let i=e,o=0;const s=r===pe;if(!A){n[0]=e[4],n[1]=e[3],n[2]=e[2],n[3]=0,o=n[0];i=Fe(e.slice(8),s),this._doDecode(i,B,t,s,o)}}else if(o===he){const i=r===pe;let o=Fe(e.slice(5),i);this._doDecode(o,B,t,i,0)}}_isEnhancedH265Header(e){return 128==(128&e)}}class rt extends it{constructor(e){super(e),this.input=this._inputFlv(),this.flvDemux=this.dispatchFlvData(this.input),e.debug.log("FlvDemux","init")}destroy(){super.destroy(),this.input=null,this.flvDemux=null,this.player.debug.log("FlvDemux","destroy")}dispatch(e){this.flvDemux(e)}*_inputFlv(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),i=new Uint32Array(e),r=this.player;for(;;){t[3]=0;const e=yield 15,o=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const s=i[0];t[0]=e[10],t[1]=e[9],t[2]=e[8];let a=i[0];16777215===a&&(t[3]=e[11],a=i[0]);const n=yield s;switch(o){case C:r._opt.hasAudio&&(r.updateStats({abps:n.byteLength}),n.byteLength>0&&this._doDecode(n,E,a));break;case R:if(r._times.demuxStart||(r._times.demuxStart=ve()),r._opt.hasVideo){r.updateStats({vbps:n.byteLength});const e=n[0];if(this._isEnhancedH265Header(e))this._decodeEnhancedH265Video(n,a);else{const e=n[0]>>4==1;if(n.byteLength>0){i[0]=n[4],i[1]=n[3],i[2]=n[2],i[3]=0;let t=i[0];this._doDecode(n,B,a,e,t)}}}}}}dispatchFlvData(e){let t=e.next(),i=null;return r=>{let o=new Uint8Array(r);if(i){let e=new Uint8Array(i.length+o.length);e.set(i),e.set(o,i.length),o=e,i=null}for(;o.length>=t.value;){let i=o.slice(t.value);t=e.next(o.slice(0,t.value)),o=i}o.length>0&&(i=o)}}close(){this.input&&this.input.return(null)}}class ot extends it{constructor(e){super(e),e.debug.log("M7sDemux","init")}destroy(){super.destroy(),this.player.debug.log("M7sDemux","destroy"),this.player=null}dispatch(e){const t=this.player,i=new DataView(e),r=i.getUint8(0),o=i.getUint32(1,!1),s=new ArrayBuffer(4),a=new Uint32Array(s);switch(r){case E:if(t._opt.hasAudio){const i=new Uint8Array(e,5);t.updateStats({abps:i.byteLength}),i.byteLength>0&&this._doDecode(i,r,o)}break;case B:if(t._opt.hasVideo)if(t._times.demuxStart||(t._times.demuxStart=ve()),i.byteLength>5){const s=new Uint8Array(e,5),n=s[0];if(this._isEnhancedH265Header(n))this._decodeEnhancedH265Video(s,o);else{const e=i.getUint8(5)>>4==1;t.updateStats({vbps:s.byteLength}),a[0]=s[4],a[1]=s[3],a[2]=s[2],a[3]=0;let n=a[0];this._doDecode(s,r,o,e,n)}}else this.player.debug.warn("M7sDemux","dispatch","dv byteLength is",i.byteLength)}}}class st{constructor(e){return new(st.getLoaderFactory(e._opt.demuxType))(e)}static getLoaderFactory(e){return e===A?ot:e===n?rt:void 0}}class at{constructor(e){this.TAG="ExpGolomb",this._buffer=e,this._buffer_index=0,this._total_bytes=e.byteLength,this._total_bits=8*e.byteLength,this._current_word=0,this._current_word_bits_left=0}destroy(){this._buffer=null}_fillCurrentWord(){let e=this._total_bytes-this._buffer_index,t=Math.min(4,e),i=new Uint8Array(4);i.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(i.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t}readBits(e){if(e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let i=e-this._current_word_bits_left;this._fillCurrentWord();let r=Math.min(i,this._current_word_bits_left),o=this._current_word>>>32-r;return this._current_word<<=r,this._current_word_bits_left-=r,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}class nt{static _ebsp2rbsp(e){let t=e,i=t.byteLength,r=new Uint8Array(i),o=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(r[o]=t[e],o++);return new Uint8Array(r.buffer,0,o)}static parseSPS(e){let t=nt._ebsp2rbsp(e),i=new at(t);i.readByte();let r=i.readByte();i.readByte();let o=i.readByte();i.readUEG();let s=nt.getProfileString(r),a=nt.getLevelString(o),n=1,A=420,d=[0,420,422,444],c=8;if((100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r||138===r||144===r)&&(n=i.readUEG(),3===n&&i.readBits(1),n<=3&&(A=d[n]),c=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool())){let e=3!==n?8:12;for(let t=0;t0&&e<16?(v=t[e-1],w=r[e-1]):255===e&&(v=i.readByte()<<8|i.readByte(),w=i.readByte()<<8|i.readByte())}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool()&&i.readBits(24)),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool()){let e=i.readBits(32),t=i.readBits(32);E=i.readBool(),B=t,C=2*e,S=B/C}}let R=1;1===v&&1===w||(R=v/w);let k=0,T=0;if(0===n)k=1,T=2-m;else{k=3===n?1:2,T=(1===n?2:1)*(2-m)}let I=16*(h+1),x=16*(p+1)*(2-m);I-=(g+f)*k,x-=(b+y)*T;let D=Math.ceil(I*R);return i.destroy(),i=null,{profile_string:s,level_string:a,bit_depth:c,ref_frames:u,chroma_format:A,chroma_format_string:nt.getChromaFormatString(A),frame_rate:{fixed:E,fps:S,fps_den:C,fps_num:B},sar_ratio:{width:v,height:w},codec_size:{width:I,height:x},present_size:{width:D,height:x}}}static _skipScalingList(e,t){let i=8,r=8,o=0;for(let s=0;s ${t.codecWidth}, height ${i.height}-> ${t.codecHeight}`),void this.player.emit(F.webcodecsWidthOrHeightChange)}if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){const r=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:i?Z:K});this.player.emit(j.timeUpdate,t);try{if(this.isDecodeStateClosed())return void this.player.debug.warn("Webcodecs","VideoDecoder isDecodeStateClosed true");this.decoder.decode(r)}catch(e){this.player.debug.error("Webcodecs","VideoDecoder",e),(-1!==e.toString().indexOf(ae)||-1!==e.toString().indexOf(ne))&&this.player.emitError(F.webcodecsDecodeError)}}else this.player.debug.warn("Webcodecs","VideoDecoder isDecodeFirstIIframe false")}else if(i&&0===e[1]){const t=15&e[0];if(this.player.video.updateVideoInfo({encTypeCode:t}),t===J)return void this.emit(F.webcodecsH265NotSupport);this.player._times.decodeStart||(this.player._times.decodeStart=ve());const i=function(e){let t=e.subarray(1,4),i="avc1.";for(let e=0;e<3;e++){let r=t[e].toString(16);r.length<2&&(r="0"+r),i+=r}return{codec:i,description:e}}(e.slice(5));this.player.debug.log("Webcodecs","VideoDecoder configure",i);try{this.decoder.configure(i)}catch(e){return this.player.debug.error("Webcodecs","VideoDecoder configure",e),void this.player.emit(F.webcodecsConfigureError)}this.hasInit=!0}}isDecodeStateClosed(){return"closed"===this.decoder.state}}const ct={play:"播放",pause:"暂停",audio:"",mute:"",screenshot:"截图",loading:"加载",fullscreen:"全屏",fullscreenExit:"退出全屏",record:"录制",recordStop:"停止录制"};var lt=Object.keys(ct).reduce(((e,t)=>(e[t]=`\n \n ${ct[t]?`${ct[t]}`:""}\n`,e)),{}),ut=(e,t)=>{const{events:{proxy:i}}=e,r=document.createElement("object");r.setAttribute("aria-hidden","true"),r.setAttribute("tabindex",-1),r.type="text/html",r.data="about:blank",Se(r,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"});let o=e.width,s=e.height;i(r,"load",(()=>{i(r.contentDocument.defaultView,"resize",(()=>{e.width===o&&e.height===s||(o=e.width,s=e.height,e.emit(j.resize),n())}))})),e.$container.appendChild(r),e.on(j.destroy,(()=>{e.$container.removeChild(r)})),e.on(j.volumechange,(()=>{!function(e){if(0===e)Se(t.$volumeOn,"display","none"),Se(t.$volumeOff,"display","flex"),Se(t.$volumeHandle,"top","48px");else if(t.$volumeHandle&&t.$volumePanel){const i=Ee(t.$volumePanel,"height")||60,r=Ee(t.$volumeHandle,"height"),o=i-(i-r)*e-r;Se(t.$volumeHandle,"top",`${o}px`),Se(t.$volumeOn,"display","flex"),Se(t.$volumeOff,"display","none")}t.$volumePanelText&&(t.$volumePanelText.innerHTML=parseInt(100*e))}(e.volume)})),e.on(j.loading,(e=>{Se(t.$loading,"display",e?"flex":"none"),Se(t.$poster,"display","none"),e&&Se(t.$playBig,"display","none")}));const a=i=>{let r=Ie(i)?i:e.fullscreen;Se(t.$fullscreenExit,"display",r?"flex":"none"),Se(t.$fullscreen,"display",r?"none":"flex")},n=()=>{Re()&&t.$controls&&e._opt.useWebFullScreen&&setTimeout((()=>{if(e.fullscreen){let i=e.height/2-e.width+19,r=e.height/2-19;t.$controls.style.transform=`translateX(${-i}px) translateY(-${r}px) rotate(-90deg)`}else t.$controls.style.transform="translateX(0) translateY(0) rotate(0)"}),10)};try{fe.on("change",a),e.events.destroys.push((()=>{fe.off("change",a)}))}catch(e){}e.on(j.webFullscreen,(e=>{a(e),n()})),e.on(j.recording,(()=>{Se(t.$record,"display",e.recording?"none":"flex"),Se(t.$recordStop,"display",e.recording?"flex":"none"),Se(t.$recording,"display",e.recording?"flex":"none"),!e.recording&&t.$recordingTime&&(t.$recordingTime.innerHTML=De(0))})),e.on(j.recordingTimestamp,(e=>{t.$recordingTime&&(t.$recordingTime.innerHTML=De(e))})),e.on(j.playing,(e=>{Se(t.$play,"display",e?"none":"flex"),Se(t.$playBig,"display",e?"none":"block"),Se(t.$pause,"display",e?"flex":"none"),Se(t.$screenshot,"display",e?"flex":"none"),Se(t.$record,"display",e?"flex":"none"),Se(t.$qualityMenu,"display",e?"flex":"none"),Se(t.$volume,"display",e?"flex":"none"),a(),e||t.$speed&&(t.$speed.innerHTML=ke(""))})),e.on(j.kBps,(e=>{const i=ke(e);t.$speed&&(t.$speed.innerHTML=i)}))};function ht(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}ht('@keyframes rotation{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes magentaPulse{0%{background-color:#630030;-webkit-box-shadow:0 0 9px #333}50%{background-color:#a9014b;-webkit-box-shadow:0 0 18px #a9014b}to{background-color:#630030;-webkit-box-shadow:0 0 9px #333}}.jessibuca-container .jessibuca-icon{cursor:pointer;width:16px;height:16px}.jessibuca-container .jessibuca-poster{position:absolute;z-index:10;left:0;top:0;right:0;bottom:0;height:100%;width:100%;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jessibuca-container .jessibuca-play-big{position:absolute;display:none;height:100%;width:100%;background:rgba(0,0,0,.4)}.jessibuca-container .jessibuca-play-big:after{cursor:pointer;content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;width:48px;height:48px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACgklEQVRoQ+3ZPYsTQRjA8eeZZCFlWttAwCIkZOaZJt8hlvkeHrlccuAFT6wEG0FQOeQQLCIWih6chQgKgkkKIyqKCVYip54IWmiQkTmyYhFvd3Zn3yDb7szu/7cv7GaDkPEFM94PK0DSZ9DzDAyHw7uI2HRDlVJX5/N5r9FoHCYdr/fvCRiNRmpJ6AEidoUQ15NG+AH8BgD2n9AHANAmohdJQfwAfgGA4xF4bjabnW21Whob62ILoKNfAsAGEd2PU2ATcNSNiDf0/cE5/xAHxDpgEf0NADaJ6HLUiKgAbvcjpdSGlPJZVJCoAUfdSqkLxWLxTLlc/mkbEgtgET1TSnWklLdtIuIEuN23crlcp16vv7cBSQKgu38AwBYRXQyLSArg3hsjRDxNRE+CQhIF/BN9qVAobFYqle+mkLQAdLd+8K0T0U0TRJoAbvc9fVkJId75gaQRoLv1C2STiPTb7rFLWgE6+g0RncwyYEJEtawCvjDGmpzzp5kD6NfxfD7frtVqB17xen2a7oG3ALBm+oMoFQBEPD+dTvtBfpImDXjIGFvjnD/3c7ksG5MU4HDxWeZa0HB3XhKAXcdxOn5vUi9gnIDXSqm2lHLPK8pkfVyAbSLqm4T5HRs1YB8RO0KIid8g03FRAT4rpbpSyh3TINPxUQB2GGM9zvkn05gg420CJovLZT9ISNA5tgB9ItoOGhFmnh/AcZ/X9xhj65zzV2Eiwsz1A1j2B8dHAOgS0W6YnduY6wkYj8d3lFKn/j66Ea84jtOrVqtfbQSE3YYnYDAY5Eql0hYAnNDv6kKIx2F3anO+J8DmzqLY1goQxVE12ebqDJgcrSjGrs5AFEfVZJt/AF0m+jHzUTtnAAAAAElFTkSuQmCC");background-repeat:no-repeat;background-position:50%}.jessibuca-container .jessibuca-play-big:hover:after{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACEElEQVRoQ+2ZXStEQRjH/3/yIXwDdz7J+i7kvdisXCk3SiFJW27kglBcSFFKbqwQSa4krykuKB09Naf2Yndn5jgzc06d53Znd36/mWfeniVyHsw5PwqB0DOonYEoijYBlOpAFwCMkHwLDS/9mwhEDUCfAAyTXA4tYSLwC6CtCegegH6S56FETAR+AHRoACcBTJAUWa+RloBAXwAYIrnt0yBNgZi7qtbHgw8RFwLC/QFglOScawlXAjH3gUqrE1cirgVi7mkAYyS/0xbxJSDcdwAGSa6nKeFTIOZeUyL3aYiEEBDuLwDjJGf+KxFKIOY+BdBL8iipSGiBmHtWbbuftiJZERBuOfgGSK7aSGRJIObeUml1ayKSRQHhlgtkiaTcdltGVgUE+ppkV54FaiS78yrwqlLoOI8Cch2XV548W7WRpTVwA6DP9kGUFYEpAOUkT9LQAvtq1M+0udKkQSgBqSlJWWYxKXj8vRACK+o6bbRIdYI+Ba7U7rKjg7L53JdAhWTZBsy0rWuBXZUuNVMg23auBF7UIl2yBbJt70JAoKV6/WwLk6R9mgKSJlJ1kLTxFmkJyCla8UZd15GJQKvyumyJ8gy8DAEvfZoINPqD41EtUjmUgoaJwAaAnjrKebVI34OSq85NBNqlCAWgE0CV5GEWwI3vQlmCbcSinYFCwPEIFDPgeIC1P1/MgHaIHDf4Aydx2TF7wnKeAAAAAElFTkSuQmCC")}.jessibuca-container .jessibuca-recording{display:none;position:absolute;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:95px;height:20px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jessibuca-container .jessibuca-recording .jessibuca-recording-red-point{width:8px;height:8px;background:#ff1f1f;border-radius:50%;animation:magentaPulse 1s linear infinite}.jessibuca-container .jessibuca-recording .jessibuca-recording-time{font-size:14px;font-weight:500;color:#ddd}.jessibuca-container .jessibuca-recording .jessibuca-icon-recordStop{width:16px;height:16px;cursor:pointer}.jessibuca-container .jessibuca-loading{display:none;flex-direction:column;justify-content:center;align-items:center;position:absolute;z-index:20;left:0;top:0;right:0;bottom:0;width:100%;height:100%;pointer-events:none}.jessibuca-container .jessibuca-loading-text{line-height:20px;font-size:13px;color:#fff;margin-top:10px}.jessibuca-container .jessibuca-controls{background-color:#161616;box-sizing:border-box;display:flex;flex-direction:column;justify-content:flex-end;position:absolute;z-index:40;left:0;right:0;bottom:0;height:38px;width:100%;padding-left:13px;padding-right:13px;font-size:14px;color:#fff;opacity:0;visibility:hidden;-webkit-user-select:none;user-select:none}.jessibuca-container .jessibuca-controls .jessibuca-controls-item{position:relative;display:flex;justify-content:center;padding:0 8px}.jessibuca-container .jessibuca-controls .jessibuca-controls-item:hover .icon-title-tips{visibility:visible;opacity:1}.jessibuca-container .jessibuca-controls .jessibuca-fullscreen,.jessibuca-container .jessibuca-controls .jessibuca-fullscreen-exit,.jessibuca-container .jessibuca-controls .jessibuca-icon-audio,.jessibuca-container .jessibuca-controls .jessibuca-microphone-close,.jessibuca-container .jessibuca-controls .jessibuca-pause,.jessibuca-container .jessibuca-controls .jessibuca-play,.jessibuca-container .jessibuca-controls .jessibuca-record,.jessibuca-container .jessibuca-controls .jessibuca-record-stop,.jessibuca-container .jessibuca-controls .jessibuca-screenshot{display:none}.jessibuca-container .jessibuca-controls .jessibuca-icon-audio,.jessibuca-container .jessibuca-controls .jessibuca-icon-mute{z-index:1}.jessibuca-container .jessibuca-controls .jessibuca-controls-bottom{display:flex;justify-content:space-between;height:100%}.jessibuca-container .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-left,.jessibuca-container .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-right{display:flex;align-items:center}.jessibuca-container.jessibuca-controls-show .jessibuca-controls{opacity:1;visibility:visible}.jessibuca-container.jessibuca-controls-show-auto-hide .jessibuca-controls{opacity:.8;visibility:visible;display:none}.jessibuca-container.jessibuca-hide-cursor *{cursor:none!important}.jessibuca-container .jessibuca-icon-loading{width:50px;height:50px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAHHklEQVRoQ91bfYwdVRX/nTvbPuuqlEQM0q4IRYMSP0KkaNTEEAokNUEDFr9iEIOiuCC2++4dl+Tti9nOmbfWFgryESPhH7V+IIpG8SN+Fr8qqKgQEKoUkQREwXTLs8495mze1tf35s2bfTu7ndf758y55/x+c879OvcMYYnbxMTEy4IgOImIxkRkrYisNsasUrPe+wNE9C8ielRE9iVJsndmZubBpYRES6E8DMNXeu83ENHrAJwO4OUARvrY+i+ABwDcLSJ7jDF3RlF0f9H4CiNcrVZPCIJgk4hcCOCNBQH9EYBveO93NRqNx4rQuWjCExMT64IguEJE3kdEq4sA1alDRDTsb02SZOfMzMxDi7ExMGFr7THGGCciVwKYG5PL0HTMb69UKtNTU1Ozg9gbiLC1diMRXQ/gxEGMFtDnQRHZHMfxHQvVtWDCzrkdANSredvfRWQ3Ee0F8DCAJwDs994nQRCM6qxNROu892uI6A0ATs2rWER2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ljfpkCdLt6WF2vIdDZPsDMnys9uxSA1tpXEdHvU1599qgknHHqu/moDOlWNkTTyu2rTGKMOfeonLQ0lFunv08AOBPAXu/9jkajsafnsgTgVma+eBjHcBbmrI3HXcxc1D1vab5b1tbyQKVSOb5erz9TGrQFAMk8POhWLI7jOwuwUxoV/Y6Hn2Hmy0uDtgAgc4RbZQt/Ttl7PrVy5crj6vW6L8BWKVS057TuAqAX0p3t3cz8hVKgLQDEIcLW2suJ6LoUnX9i5tMKsFUKFYcIZ6VpAWxiZr2xG/p2WCI+4yDxeKVSWXM0jOXDCE9OTq5JkuTRNDcS0U1RFKWdqobK612XaWEYflJEru7BYuhDu4tw66ShxSFpd0laD7meme8ZKre2gU0teXDOnQ2gV3q2FBfig37wnjUevVI/auhIlzwMSnYOe1bnPkUtWrXznuUualkM2b6EtWzJGKMlBaf0MrScZUuLJduXsAq07l1/DuCEDIP3iUi4VIVpRRCd19G3Ek8FtfTQe//DrAI1lSu69LBIogsirMK1Wm11s9n8GoC35AByH4DbvPe3r1q16g8LKS7NoXtRIrk83G4ha/bugURL93cD+Mt8+TAR6YT3j0ql8rtBC70HZb1gwmooDMO3eu+vJaKTBjXc6rfPe39ho9H41SL15O4+EOFWiGv5n2sViz83t8VuwWW9pRyY8Dxu59zJIqJVAhcP+JPHI8y8bL8SLJrwPHH9jYeI3kFEF+Ssmp/rqjN7HMe6lV2WVhjhdrRhGJ7a+lFrPYDXAtB667Q/X5723p+tNwLLwrbf1rIIEBryxpgTkyQZA6DlFccS0fMA6G84d6RVvBZht5eO/wEB1Kvsoc6vtAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;animation:rotation 1s linear infinite}.jessibuca-container .jessibuca-icon-screenshot{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAE5UlEQVRoQ+1YW2sdVRT+1s7JxbsoVkEUrIIX0ouz15zYNA+N1RdtQfCltlUfvLbqL/BCwZ8grbHtizQqPojgB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SUQ+DPXV4dclsTHmHAD/SfHCNzc3t7Kvr++HJKeMMacA3BL0nyuXyzcPDAxMxo0fHR29slAo/Ajg6qD/fE9Pzw29vb1/x42fmJi4vFwu+5G/LOg/y8zXNJLQ2dAES5JANMQ7mfn1jBI6ycx3NiMhItqstf4oAX+ziHwQ6qvDj5NQNIn/ALCKmX+JSeIvABRD7fuY+ekGBPYBeDI05tTMzExvf3+/vz2Hk91/ET8RSeI6/DoCpVJpjed5fmKGvzMAXpqdnT3oed5Ud3d3v4jsAqBr9Ei0Rmv9VRqBBPzvROQVETnq2xJRdRu9tRF+bCVOKWT+Kvl/TSIFk6SW/LAjKfjV5K8rZABi8dOOEv7FI7Z8x6zwEWbemLbyMfJr5qiSiJ96oclymBOR3bZtP9+M89WxxpjdAHY2sN3DzM8ljWl4I3Nd9x7/OE1ENcdpETnmH3e11n41zv0l4J8RkU+J6AAz+xtF4teQQG7PFslwmcAiLfSyhC72Qv9/I/Avns2OT7QJskoAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-screenshot:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAED0lEQVRoQ+2ZycsdRRTFf2ejqHFAMQqiYBTUoElUHLNx3GgCgpuYRF2o0UT9CxwQ/BMkMSbZSKLiQgQHUDCJgjiAxiEiESdEcJbEedgcKaj3UV+/6q7u/jovPPkK3qbr1ql76p5bt6qemPKmKfefeQKHOoLFCNg+H1gi6fFJOmv7VmCvpD1N87Yh8ApwNXCzpB2TIGF7DRDm2inpmt4EbB8LfAMcGUHWSHryYJKwfRMwmuMP4BRJv9TN2RgB2wuB72BWsq+V9MTBIGF7NZBiGzhJ0o+9CIRBtt8FLqgADC6nRDbpVO9Iuqi3hCKB5cDrGZDVkp4aIhIV2aSQyyW9MScCkcQqIOfsnCORkc3I31b5VtyFRmg1IQ7dt0ja3icSQ2C2JhAjUU2ykd+dE7tBNp2i2olAJJFuc+nCt564QTadF6IzgUhiVGiqyinKaQjZpJP2ItBXTkPJZhACXeU0pGwGI9BWTkPLZlACBTldG4o5EA6E1dY66edcyNrs8Q36zg1vVaTazNs7iXPgDVJJzYs7VRvHRzaDEohyugJ4CTi84sg/wHWSdnVxsGQ7aQLXS9pZcqpL/6AEplpCU5HE8YpJ9YrXUKQ6baN1+HPaRm1fBqwFQnKGK2ZoPwCvAo8Ai4FnMpPMHMwapHUj8DFwbw3+Dklv9iZgexOwvktSRduxU2VDlErwmyXV+lCbxLbDdndlCT3TX3vV7JgnKfRuSVflfMkSsL0ZuDMz4E/gL+CETN+/wCpJzzaRtn0D8DRwWMbu1/gCcnSm7zFJd1W/jxGwvQx4r2IYnlbuA14GAomQFw8B6YtBKFSnNj2BxEJ3IvB1pdB9CjwQ8yqYhcg/DJxZ8WOZpA/SbzkC24DbEqOfgPMkBRKzmu23gEuSj1sk5SI3Y2J7C3BHMuZz4FxJf6fgto8APgIWJd+3SUrHjr9O294HnJUMWi8pSGqs2V4CvJ88fH0i6eyChKr4KyS9WIO/Ang+6RvDz0XgABCeFEdtkaQv65yy/QVweuwPY0+T9FuNQ8cAXwHHxf7wdHiypN9r7BfEl8GjYv9+SceXJLQ/mSDYTh2Baog3SHq0pYT2STqno4RWSnqhBn8l8FzSN4bfJol/jkn8bXUS228DFyfft0paVyCwFbg9sQkSDEkctueZZju8iO+tJPEYfo7A0piYKd73wP3xnB+20cvjNnphxdmlkj4sEMjhfwY8COyOY0fb6Bkl/K6FLKxS+M1KpDhJY8mvrG5doRwlf66QZfGbjhLh4pEt35kV3iUp/IvTunU8qtTil/7gaHOY2yjpntaez9b5RmBDYewmSXfX2RRvZLYvbThOh+NuqMa9Ww1+yLnXgO2SwkZR24oEens2oYHzBCa00PMSOtQL/f+NwH+Hg8hAnbrYgQAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-play{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACgklEQVRoQ+3ZPYsTQRjA8eeZZCFlWttAwCIkZOaZJt8hlvkeHrlccuAFT6wEG0FQOeQQLCIWih6chQgKgkkKIyqKCVYip54IWmiQkTmyYhFvd3Zn3yDb7szu/7cv7GaDkPEFM94PK0DSZ9DzDAyHw7uI2HRDlVJX5/N5r9FoHCYdr/fvCRiNRmpJ6AEidoUQ15NG+AH8BgD2n9AHANAmohdJQfwAfgGA4xF4bjabnW21Whob62ILoKNfAsAGEd2PU2ATcNSNiDf0/cE5/xAHxDpgEf0NADaJ6HLUiKgAbvcjpdSGlPJZVJCoAUfdSqkLxWLxTLlc/mkbEgtgET1TSnWklLdtIuIEuN23crlcp16vv7cBSQKgu38AwBYRXQyLSArg3hsjRDxNRE+CQhIF/BN9qVAobFYqle+mkLQAdLd+8K0T0U0TRJoAbvc9fVkJId75gaQRoLv1C2STiPTb7rFLWgE6+g0RncwyYEJEtawCvjDGmpzzp5kD6NfxfD7frtVqB17xen2a7oG3ALBm+oMoFQBEPD+dTvtBfpImDXjIGFvjnD/3c7ksG5MU4HDxWeZa0HB3XhKAXcdxOn5vUi9gnIDXSqm2lHLPK8pkfVyAbSLqm4T5HRs1YB8RO0KIid8g03FRAT4rpbpSyh3TINPxUQB2GGM9zvkn05gg420CJovLZT9ISNA5tgB9ItoOGhFmnh/AcZ/X9xhj65zzV2Eiwsz1A1j2B8dHAOgS0W6YnduY6wkYj8d3lFKn/j66Ea84jtOrVqtfbQSE3YYnYDAY5Eql0hYAnNDv6kKIx2F3anO+J8DmzqLY1goQxVE12ebqDJgcrSjGrs5AFEfVZJt/AF0m+jHzUTtnAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-play:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACEElEQVRoQ+2ZXStEQRjH/3/yIXwDdz7J+i7kvdisXCk3SiFJW27kglBcSFFKbqwQSa4krykuKB09Naf2Yndn5jgzc06d53Znd36/mWfeniVyHsw5PwqB0DOonYEoijYBlOpAFwCMkHwLDS/9mwhEDUCfAAyTXA4tYSLwC6CtCegegH6S56FETAR+AHRoACcBTJAUWa+RloBAXwAYIrnt0yBNgZi7qtbHgw8RFwLC/QFglOScawlXAjH3gUqrE1cirgVi7mkAYyS/0xbxJSDcdwAGSa6nKeFTIOZeUyL3aYiEEBDuLwDjJGf+KxFKIOY+BdBL8iipSGiBmHtWbbuftiJZERBuOfgGSK7aSGRJIObeUml1ayKSRQHhlgtkiaTcdltGVgUE+ppkV54FaiS78yrwqlLoOI8Cch2XV548W7WRpTVwA6DP9kGUFYEpAOUkT9LQAvtq1M+0udKkQSgBqSlJWWYxKXj8vRACK+o6bbRIdYI+Ba7U7rKjg7L53JdAhWTZBsy0rWuBXZUuNVMg23auBF7UIl2yBbJt70JAoKV6/WwLk6R9mgKSJlJ1kLTxFmkJyCla8UZd15GJQKvyumyJ8gy8DAEvfZoINPqD41EtUjmUgoaJwAaAnjrKebVI34OSq85NBNqlCAWgE0CV5GEWwI3vQlmCbcSinYFCwPEIFDPgeIC1P1/MgHaIHDf4Aydx2TF7wnKeAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-pause{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAABA0lEQVRoQ+1YwQqCUBAcfWXXsLr2AXWTPXno8yVB8AP6Aa3oHI+kCDqYaawJljSe133uzO44bx0M/HEG/v1gAd9mkAyQgY4I/F8LJUlyrQFtD2AtIkcNoFEU+Z7n7QD4DfFHEVlocrVmgAUAIAOl3mILPcDgEFcUhyrUKMGUUcroc3NQRimj9XJBGaWMvvPydKN0o6/9QTdKN6rZANxj6EbpRulGuZnjYqs8BbyR8Ub2Izeys+u6yyAIDpo/ehzHM2NMDsA0xFsRmWhyfTIDWSXxCEBmrd2EYXjSHJqm6bQoii2AOYBL5Z0xgFxEVppcrQvQJO0zhgX0iXbdWWSADHRE4AZQ731AhEUeNwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-pause:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAA7klEQVRoQ+2YSwrCQBBEX6HiVvxsPYDewfN7By/gD9ciQkvERQwJdBSiYs0mEDo96aruombEjy/9+P/jAj7NoBkwA28i8H8tFBFRA9oeWEo6ZgCNiDGwAYpn3TpKmmVytWbABQBmoNRbbqEHGB7iiuJYhRol2DJqGX1uDsuoZdRmLuNZSzGWUcuoZdRHSp/IylNgK2ErYSthK3FHwLcSvpXIjoLt9Jfa6TMwl3TIMBkRE2AH9BriL5KGmVyvWIltJXEfKN6tJJ0ym0bECFgDU+Ba+WZQFCdpkcnVuoBM0i5jXECXaNftZQbMwJsI3AAPN3dAQflHegAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-record{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAC+UlEQVRoQ+1ZS2sTURT+zlDJYE3XSq219QHVuEjnJDT+Bff9Abqw2voAEfGxqygUqWhVFHGl/yMLu9BwByxk5SNI66ML6U7axjhHbmhgWiftncxoOiV3FcI53z3f/e65594zhIQPSnj86BBot4IdBToKRFyBnbeFlFIScVEiuYvIWC6Xe2YK8pcC7SYA4CMzH4mDQBXAqilQBDsLQLfPf9FxnF4i8kwwmypARI+Wl5dvmIBEsUmlUkNE9NaHsVCpVAZGR0d/m+A2JSAid3K53E0TkCg2pVKpz7KseR/GfKVSGYxMAMA0M1+JEpyJb6lUOm5ZVnkrAsVisaunp+esiByr1Wp3R0ZGvmifzZK4XQQWHMc52MgBpdQuAOcAXABwuB400ZTjONdaIjA7O5u2bVsnWU1EujzP+5nP5xdMVjvIJkCBD8x8VCm1G8AYgAkAAxt8Z5j5YmgCSqlTAJ4D2OcD/AXgATNfbYVEAIFPIvKKiE4D6GuCea8xX6gtpJT6DmBvECgRFRzHeROWRAABE4iWCbwHEFhkPM/L5vP5dyaz+23+KwHXdR3P854S0YG1ILSCuthNMfNM2OC1/RYENLY+ygcBnPfht6ZAA6BYLNr6dyqVokKhsGpaNQ2TWJstreXaE2aed133sojcj41AKyvdzCdAgSXLsk4MDw9/a/i4rntbRPxFNZoC/5jAV2be759DKTUJ4FZSFFi0bbs/k8noy2R9dAjEuWU2YgXkQOK3kD6BMsysi2Z9JC2Jdcw/ALzwPO+xvmcl7Rj177JVEbkO4BARjSflFDJJuW1dBxJPoCIiL4noDIB1BS0pW6j+oJmbm+uuVqvjRKQfLr0bZHnIzJf0f6HeAybahrUJqAPruhLlcnnPysqKfpXp11n/Gv62zoHAroS+AafT6QkiGrIsazKbzX7eVIHEt1US39gCkOzWYthkjNE+tuZujDGZQ8XRXn8N4KT5lLFZ6uaYPt+nwyDuvC80YdhvB9uOAu1WoaNAR4GIK/AHvdr+QAexB7EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-record:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACfUlEQVRoQ+2ZSYsUQRCFvycK4nJXXEbHBdwO4kn/gv9CD467ICIutxEFkREdFUU86T/xojcPntyQcT2INw+uISFVkD1Wd2dWlU7nUHlqisiX+fJFZGREi8yHMt8/HYG5VrBToFOg4QnMPxcyM2t4KE2nT0i6EwvylwIjQOCFpE1tEPgGfI0FamC3AFgazP8IrJL0KwZzkAI3gLMxIA1ttgCPA4w3wHpJP2NwBxG4KOlcDEgTGzNbA8wEGP57vA0CU5JONtlczFwz2wY8HUbAzBYCB4CtwCVJb33OIAXmioC70LoyBsxsEXAQOApsLIhelnS6FgEzW+5BBvwA/FS+SPJFa40KBZ5L2mxmS4AJ4IjHxCzwaUnHkgmY2V7gLrAyAPwOXJN0qg6DCgIvgQfAPsDjo2pcKddLciEz+wCs6AO6W9KjVBIVBGIgahN4BvRLMjslPYlZPbT53wR2AbeBtcUmXEFPdh5U06mbd/shBBzbr/Jx4FCAX0+BEsDMFocEYrNmFcE+BD4XsXZL0oyZnQCutkagzkn3m1NBwDe/Q9L74MAuFEqUn5op8I8JvJO0elacTALnc1HAH3Njkvwx+WeYWUegTa/pwaqIgexdyIN4uyRPmqULZRXEvulPwD3gpr+zcrtGQxfzRHYG2AAczuUWiom3kc4D2RN4BdwH9gM9CS0XFyoLGu9UuN974eIFVDiuSzruH5LqgRhtU20q8kBPV8LMlhVVmVdnYwX+SMdAZVeieAF7eeltmElJr4cpkH1bJfvGVvatxdR4bMu+teZuWxtKxWncXn8I7EldtQV7vz79fp9KwZp//9CksB8F206BuVahU6BToOEJ/Ab7+KdABdTt8AAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-recordStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAGDElEQVRoQ82ZaahVVRTHf//moKKggQawcmg0olGl0awvRoMVBRGFlQ1YQZIZqRVKmJmFgVk59EFQykYjgmajbJ7n2WiAbKKCBq0Vfznndd723Lvvve/5bMH9cvfaa63/2WuvaYteoIjYHDgEOAAYDOwIbA/4f9PvwHfAt8DbwGvAS5L8f49Ine6OCO89CTgFOBrYqU1Z3wBPAUskPdDm3i72jgBExCXAWGBQp4qTfR8CMyXd0a68tgBExEjgBmCfdhW1yP8eMFHS/S3y0xKAiNgQmA2MaUHwB8DnwNfAbwX/FsDOwG7Ani3I8ElcLOnvHG8WQET0Ax4C9msi7BHgbuAFSXaHhhQRewBDgZOBE5qwvuV1SSuayWsKICIcVZ4Atq4R8mdxKnMkfZT7UnXrEeE7dD7gO7VpDc/PwAhJrzaS3xBAROzrUFcJhVUZjhrjJX3cieHpnogYUNytUTXy/gAOlvROna5aABHhGG5f3qZmk33ztt4wvAbIBcCcBicxSNLKdK0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kvuCLqoD4BlM3Th7nqTzOrSnrW0RcSdQp+tASX4gbAzAK8Ub2KwarQ8Cp0vy20CvU5FUFwN1SfRSSbemSpu9D9wCXFZjpacDoyU925sIIuIw4K5k8lCqmCWpzpbmb2QRMRc4t4GhfiOYJunLngCJiF2Aq4ELG8iZL6mRDflHvohwpnXGrSM/VM8DFkt6rh0gxRd3K3s24BBeRzMkpaP+bnzZR77iTvgLuOR29mxEDnmer7rk9dPT98CvBbNreGdSD8s8WT4i81rpjD5G0vzcR2kJQAHCs5ubgKZjwERhednrHvAa2eaPMFaSm6UstQyglBQRDm92qWwJnNXencGnZpdp67W+bQAVIKOLCz6sTUNTdjdTcyW5N2+bOgZQAeLHQLuV5/UeM6ZZPDXKfa1nqs/4QUXSG21bXdnQYwBV5RHhy2rXcmh0E+5GxOTGyCWwp34fSCovd09sX7P3X2uzPXCoLsVMAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-recordStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAHn0lEQVRoQ81ZbYxcVRl+nnvu7ErSEmtqDdKwO3e2LWJLSEuFNiofFv9AUIpfiSFqCzt31lITGgEjHxKIKVirqXbnzpZSf5BAoHwIhpiAgDVSwBaU1rZLd+7skiIJKCWVpOzOPfc1d3dn986dO3Nn9kvuz3ve87zPc857znnPe4gZ+BZvlzPMed4XDG2sBGWFAGcRXET6ZwTwIsZpgbxL4B0ID/nKf8370Hz1xE08PV33nDKACDOO/roQ15K4TASfbQWLxL9E8AKJvcWs+WQrfcO2UxKQcfSNAn8TwKVTdVzdT/oJbi/aZl+reC0JsArelRDeC8jnW3XUnL0cofC2Ys58ojl7oDkBj4hKv697CXQnA8sxCEsE3hbKh4E9hfMEOBuUNMBzkzAE6Ct9SvXgW9RJtokC0r+VDqb8pyByfgOwZ0g84mv1cqmH/Y2cpntlmUG9BgauEcHVdW3JN6RsXF3axKFGeA0F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-container .jessibuca-icon-fullscreen{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAHTElEQVRoQ+1Zb4xcVRX/nZl5u2/LrrO0EFKoBYpVaRu3u/e+3WlDZJdIRLQhNLIiEggxqURIjGmqTTAmWiRpjH4wghq+KIQYupYQEvEDmEVdyu7OfbPbzQaEYqtSwTb4Z3aV7s6b9445mzvm7XRm3oy7oanZ82ny5txzz++ec8+/S7jIiS5y/bEG4EJbcJkFpqenryqXy6cbKBUB+AeANIBuAG8AuAzAn06ePOkNDw+H9dZOTU11h2H4EwB7ALwL4FIA7wFw7O9aSxkAE9H9SqnHazGc50LGGFFQlGuW/pbNZq/aunXrYtICY8xmAD8C8HEAnUn8sf9/oLX+SiKAQqFweRRFvwewvgbzmwA+BOAkgEsAZAG85rpubseOHaVmlTHGfBTAYwA6gKU7WCaiOWaWPT9mv1eLO6S1/mYiAGPMddYtUtXMRPRVx3F+FkXRup07d/7FGDMEYExrHTSrfIVvfHx8Uy6XO22MWae1fu/IkSPpbdu2pRcWFmpakYgeVEo92gyAdQCKADI1HZL581rrp4lIfHPV6Pjx45cEQfCvBgL3a62/nwhgZmbm0lKp9OeYf56rMqmc9v4oikb6+/v/uhoIGigvAUGChdBBrfXhRAD5fL6XiCZsZDhHRAeY+VBVlIiYeTQMw725XG5uJSDqKc/M9xDR1wFsF/lEdKdS6ulEABMTExvS6fQMgCsBhPPz825nZ+dnieinANrjApj5mSAI7t61a9fC/+JSDZS/t62t7WgQBH+0IVoA7GsqjDIz+b4vCyXcnSuXy9fmcrkz+Xz+TgB3ENHeqlN43HXdB7dv3x60AqKR8p7nPXHixIn2YrEo7itRipn5057n/SrRAhbA320eEAGbtdbvyvfJycn16XR6BIBEnzg9PD8//63BwcGwGRBJylcEG2MkbEtUFAS3NgVAmI0xkl23Wt/bppR6rSK0UChcGUXRcwBUFYjDWuuDSffBHpBk82XEzPfKyVc+Wlf+HQDJGQLgDs/zjiZawJrudQ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l0OgzDVCqVkvGhuO8yYuZHPM97KBGA7/vXM/O0TBpqMMvo+x17waWGkhLgMrGK1vrJpCRWkRcrD+STvCvIXiJLhgNdddzoAa21vCmcR8uKOWPMRgBSPrRSpcpY8T6l1FNJ0UfeBTKZjNyxlqg60cUXL1PUupBsIO9XMkqX96v4mFvcS0Z+Mg86TUTtzCxvCh1E9BmllPxXk+zrzxQRzTBzJxG5zCzuIjJ32DG+WCOuk1hFqoKlfNSMBWSU5zDzFnEPInqLmSWpbZANARzRWr8jQHt6ev4tAuX34uLi+iiKiknjdskzlepzdna2s729PSgWi24YhuszmYxn99sYRdHSGx0RnUmlUqf7+vqO1zuYVlylJbO/X8xrAN6vk15zoQt90v+3FvgPXUePXrKTg9MAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-fullscreen:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAFvklEQVRoQ+2ZaaiVVRSGn9fS0iabCNO0eSaosAmplKJRxMiygSQCixQipBKMoDRBon5EI/0pQ8JuRQTVj4omo+FH04/muVum2GCDWVYr3ss+8t3vfud8+3guXi6cBYc7nD2sd6+11/BuMcxFw1x/ugCG2oL9LBAR44HeFkr9B/wMbAOMBT4B9gC+BiZL+rfZ3Ijw+PuB6cA6YFdgAzAy/V41NQB/rpL0QNWAAS4UEVbQm+XKj8B4SX/VTYiIicC9wMnAjnXjC9/fKemaWgARsSfwEbBbxeDPgAOBL4AdgF2AD4ETJP2dq0xEHArcA4yGvjv4D/Br2vOo9P/ycosl3ZQD4IDkFiMqBl8LPASMkfRdREwFVknalKt8Y1xETJDUGxFea0NE2CX9aWbF+ZLuzgEwBlgPbNtEqYuAlZLsl4MmEWGL/t5iwQWS7sgB4Iv1TcE//yyZ1Ke9AOiR9MNgIGihvAOCrWJZKGlZDoCjgTdTZLDy1wGLS1HCkehF4DxJ9t0tlhbKXwbcAByRFp8taWUOgN2B94G9AZ/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t5KrmgO1JUwf2n3LslTSohwAjs/vmmmoGGyGYnW64Da9SwBfdlOBLieyGOtCeeAt/K7gvbyWyQEnuiqZJ8l0zAAph9FxgMuHdqpUx23XTivqoo/fBdIdqxta/r5foit+WQZgF/IlNgFlxfx+VaS57V5O8eaD/Jbmu2Lqw+H3XEn+rlLS6887iTz285ILOruL1zwyrWFrFHWyVXwv+/JRjgVM5Vnp/ZN7GIyTmgsvb/iopNVObJL+8IIpyfnOrK+j2yNidKP6jAiD8CF5Xc+fnA7PXtB4o3Od1SvpvWYH046rtGv2rTK+C2CrHHOLTboW6FqgwxP4Hz4mJ0+J869tAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-fullscreenExit{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAADd0lEQVRoQ+2Zz2sdVRTHv+fJBDW6anDVXen6wZszYxYBiYgtFGst3VSDunKjpS0GpUlqfjVpsVVs6aaL0or4YxMVFCJZ2ZLdPUP+gq5bQnTxtNAkfTnlhnnlkmQy9yV9780rudt77tzv5/y4v4bQ4Y06XD/2ANodwec/AiJygJnvtdvTWfPnRkBEJAiCN8rl8kMfiPn5+Ve7u7v3rays0Orq6lJfX99/PuN2auMDoAD+BvA2M6/mTWSMOUtE48D6AjHGzN/kjdlNvy+AnWOOmQ/lTSYiEwDOWzsimgrDcCRvzG76GwGw8/zJzO9sN6GInAMwbW1UdSSKoqndCMwb6wNwGsB39Q+p6h/M/C4R2dTa1AoHYBWKyCkA1+pqiWi2Wq0e7e/vf7yRoJAAKcQggMtuJKIoOtoxACnE0/xOi/SXMAxPuhCFjUBdpIjYVWXSEf0TM3/g9BeriDMKdSPEz8z8vrU1xgwT0YXCrEJZy1iSJKOqOub0/8jMA0mSfKKqNwoPkHp7ioiGHIhRIvpHVa93BEBa2JcAfOlALAHo6RgAKzRJkk9V1S6xL7kpV4idOM31taxaIKJHqmpPnMMA9hcOQES2PDJkAT1XAAC+ZebPfWB3auNzmLObVsNRUNUXVHUujuM7OxXnMy4XwOcj29mIyOuq+lapVGrYCelKpkEQ3CyXy4tbzdN0AGPMxr2iYZ+sra3FcRybtgCIiK2BKw2rdgaUSqWoUqlIkQAepFDdAF7cBq5ERI9rtdr1OI7tmE2t6SmUEYFHAEaexYW/1QC2EF+ru5GIvg7D0D2GNJxprQY4o6qv1I/b6SpzOYqiLxpWng5oOQAzXxWRWwA+dkRfYOb1p5hGW6sBJpn5KytSRG4D+KguWFXHoyhy7xdeLC0F2ChSRL4H8OFuINoKYIUbY34gogHH3eeZef1K6tPaDpCm068A3nMEDzHzxY4BUNWSiPxORO6z5aDPPlGICNQ9bYyZIaLjjudzIQoFkKbTbwCO+UI0HcB9J/LdeY0xs0R02IGYYObRrWqiFQCfEZEtSHsfmGZm+4qxbbM/hQD8BeBNa0hEM2EYnmgLgP3lFARBT1dXly4vL//b29tbzQNIU+llAHeJaLFSqRzJes5vegR8xGbZLCwsHKzVav8z8/0sm0ID+MDvAfh4qZk2exFopnd9vv0ELrXBQO7fD10AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-fullscreenExit:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAC/ElEQVRoQ+2Zy49NQRCHvx+ReK6IlZ34E7CUiCAR4xEbTLCyQRATYswwb2IQZDYWgojHZpCQECts+ResiQwLj0RClNSkb9Lu3HtPz7mZc8+V6eXt6tP1VVV3VdcVbT7U5vozC9BqD/7/HjCzlZLet9rS9fbP9ICZvQPWSfqRAmFmS4ClMHm+JiR9S1mXVyYFwIBXwEZJv7I2MrPjQH8A6JN0OWtNM/OpAL7HS0mbsjYzswGgN8gNS+rJWtPM/HQAfJ9nkrY22tDMTgMjQaZH0nAzCmatTQE4ClyNPvQU2CbJQ2vKKB2Aa2hmR4DrkbbPgQ5Jv6sJSgkQILqA0dgTkjraBiBAxPHtPz2UtDuGKK0HKkqamd8qg5HS9yXtjebLdYjrHNRqiAeS9gQvnQGGSnML1bvGzOwc0BfN35PUaWYHgRulBwjW9ju+O4JwqM/AWFsABIgLwKkIYgJY1jYAAeJQuGIXVIVcKTKxh8WfBin9J+AVpx/eFWUEqFkyNACKp0rhgWYArkg6kQibSyylmPOklQdibijBX+fSLHFRJkDid+qKmdlaYENOI0zeEcBNSZ9qbVIEQHWuyGOTNZLetgrAz8ClPFpHa1ZL8rf5lFGEB2oBfAxQi4D5DeDmAP7mGJPka0oD4LnDr9imH/xFe8AP4vLIjBclxWXItCOtaIBjwOKo3HaFRyWdnLbmYUHhAJKumdkt4ECk9JCkSitmWixFAwxKOjt5uZvdBvZH2vZLit8XSSBFA/yjpJndAfY1A9FSgOCJu0BnBNErqfIkzfRCywECxCNgR6Rtt6TzmdqHBmyKXG4ZM4sTWc04NzNPWE+AuG3ZlZInSuGBinXMbBzYGVkrE6JUACGcHgPbUyGKAIj7REmZ18y897o5ghiQ5E/bltRChwE/kF7Xj0jyLkbDYWbzgBfA+iA4LmlXqwD8LydvszjAF0lfswBCKC0E3gBeP22p186f8RBKUbaejJmtAr5L+lBPptQAKfCzAClWmkmZWQ/MpHVTvv0X9iFAQGQyevIAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-audio{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACrUlEQVRoQ+2ZPYgTURCAZzbBXJnCeL2Cnb87b9MEtPBUrrMQFAtrtT5/ClGs9LBWWz0RtbBUFCF4oJDsbO68wsLA2YqQSmLlvpEHu7IuMdlLcus+yUKKhJfZ+ebnvZl5CJY/aLn+MAP41x7M1QPMfFtr/crzvHfTAs8FoNPp1LTWzwHgqIg0lFLvrQHwfX8BER8DwC6jNCIecF13wwoA3/dvIuKNpLJa60Oe560XGoCZd4rICiKeTCtaeABmPg4AJmRqg6xcaABmvg4At4aFRyEBhoVM4UMoCplHADCfJTEL5YEsIVNID5iQAYCHALCYxeq5b6PMfF5EBAAEESthGK7W6/XPRpFWq7W3VCqtZg2ZcT3g+/6i4zjzIlLSWn/yPO/DIGMNLCWY2Sj/+xGRK0qpZfNDEASnROTFVi0fr8+aA8z8Ld6KEfGt67oLYwMAwEUium8EREn7OgeAjwCwPyo/nrque3YSgAtE9GDaAM1mc65arc4Zuf1+P2w0Gt9jJZl5DQAORt+fENG5wgEw8zUAMB/zbBBRwyqAIAjuiMjlSOlNItpjFUCqWl0josMzgChR/9hGAWBbknjmAdPhDdqa0gfZzAMJKyVP4v8hhJYRcSni+0JEu63ahZj5anyQici6UuqIVQDdbrfS6/UqRulyufyTiH5sF8AlIro37VpoWEHIzGZ2tM+sEZFnSqkzk9RCS0R01wjIsZz+mug53hDRia0AnI4bGgDYISItz/M2jYC8Gpp2u30MEWuO4zha665Sqp0ZYFStX/iWchRAItFGzoHSsrJ2ZFl1mHg6bfVYJeGJv85CC++BpIJZ5kSFC6G0ha0e7mYJqcJ7IOkRay84UhD2XjHFIFZf8iW9YcYoYRi+tO6aNeupOs66iU/icV46zf/MAKZpzXFk/QL+JG1PUPhRiQAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-audio:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACSElEQVRoQ+2Zu4sUQRCHf5+C+gf4yBXMfMYHGvjCzEBQDIzV+HwEohipGKupD0QNDE8UEwUFTe68wEDhTMVUMFJ+0tArzbjs9u3Ojt0wBR0M9MzUV1XdXVWNKhcq1189wP/2YKcesH1d0nPgdVvgnQDY3iTpqaT9kuaAt9UA2D4o6aGkzVHpXcByFQC2r0q60lB2D7BUNIDtjZIeSDoyRNGyAWwfiiET4n6YlAtg+7Kka2PCozyAMSHT5CkLIIbMfUlbMhdmOQCZIVOeB2LI3JN0NNPq6bTZe8D2aUmOY72kN8DnoIXt7eF5FSEzkQdsB+OEsFwr6RPwbpixhqYStoPyqVwAbkaAY5KeTWD5wStZHrD9XdJgK34FhBP9H8kFOAvciQBhn3/RAcBHSTvjfx4DJ6cBOAPcbRvA9gZJYQT5DfwYKGl7UdLu+PwIOFUiwCVJYQRZBuZqA7gh6XxUegXYVhtAmq0uAnt7gLhQm9vorBZx74Hcc6D3QLKH/z2JGyVnlYs4pCfzEe4rsLW2XehicpAtAftqAwiZbhhBfgE/ZwVwDrjddi40KiG0HXpHO+KcJ8CJaXKheeBWBOgqnf6W1BwvgcOrATieFDTrJL0HViJAVwXNgVgPrJH0BfiQDTDKtREiNK7KLSnHASQLLacP1PxcVkWWq8PU3emq2yqJJ0b1Qsv2QKpdZp+orBBqmrfq5m5mSJXtgUZI1XnB0YCo94opCal6L/ka3ghtlIXqrllzT9VJ5k19Ek/y0zbf6QHatOYk3/oDujC8QMWgjf4AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-mute{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAKYklEQVRoQ+1Z+3NV1Rld397nXJIbIGBARTQgohGNQZJLEtFSMmpfan10aJ1OZzqd/jOd/g3t9AetD2KLCiigNFUgj/tIQoh1SqBRwVqNYgp53XvP2V9nped0Lpebl/LQmZ4ZZpjkZJ+99voe61tb8C1/5Fu+f/wfwPVm8DIG+vv7H1bVWufcp9baUefcWCqVKi5lo11dXV5NTc06EblPRNoAtABYqapD1tq9zrmelpaWaRHRpaxb6d3LAGSz2d+IyAbn3FljTG+xWEy3t7efW+yHuru7q621t3med7+qPgigGcCdAPIAuowxzyUSiaONjY2Fxa4533uVABwEsA3ARQDHAez1fb9769atn823kKrKyZMnVxUKhdtFJKWq3wWQAnAzgBoAH6vqQWvtH8nAUlmd69uXAcjlci+q6sMA1gL4BMB+Vd2fSCR6K4HYs2eP3bRp0zJjDN/f7Jzjphk2PPkN0YcDACOqekhVO5PJZPZqMvBLAI8BeAT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hzZxiG7SLCmZdT2UYArNOLeWjkciamOfaqqn5ijGmKGOXAE7sdbxtj9pY6gP8di+d2sS+rQl1dXVVr1651Y2NjrqOjg9UDXKSnp2d1IpHgpptVdbuI0DKnilwVzbzzAZm1VTgTR0NSfxAEN/i+z1mA1S2eCRgqByImepubm8cWOp1F39Awod57771ksVjkgH+3qpIpzrtbANy0QGLPAqC85ogYy2P6Tr7vP6iqnDViB5DNjjlBWdHb1tbGPjHns2gA8QpUkhs3blxrjOHGyQJ1zD2RhcIGV2nNS4ytVCrVIyKzJTM2zyIvlt4qq9MsE5W82HIkSwYQh1Qul1sJoF5EtkbOA9mgLGbFKl/3EgATExN9peHZ19e3ng5gpH8uYWIuVzwG8pUAxH+czWbpJqwPw/DeyMjaDoD/Z7MqrVIEMOvMOef2VLofKGMidsU5Qx+iig2CoGf58uXjjY2NE6UsfC0AXIgh1dDQQEeOecEEZ25QL3HKihveggCYY319fbdUYIJ9gobYc6p6prW1lU32f8/XBhCvxAGF10uqui262GNusGpRhvDhnM24fkFE0nMZW2TC8zzmAjs/c4ylukdVOa29H88SVySEyhMqm81yBKSpu4VMiMgOVaX0YCOcva4yxjw/3x0ZmcjlcrxnI5Ps+mtUdYTgwzD8sLwqXTEGSqtUfX09PR/aKIxldvAGOt0A3nHOvRwEwfEdO3ZMz1UbR0ZGlp0/f/4WEam31vL+4by19hQ7dPnNzhUHEG9qYGBgVRAEd0UNj2YYWThjjHmrUChk2tvbKfDmfHjX7Pt+te/7nAnYUKcqhd1VA8Dkrq+vXxcxQdnAewbOAb1BEAwtBCAq16azs3N2j5TalSTFVQMw3+leyd996wH8BxA4v3x6wGifAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-mute:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAHsUlEQVRoQ+2Z969VVRCFv7H33nvvvfcSe2+xxJgY4z9j/Bs0/mABFQXBhl1sgNjQ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XqqSnUo1o5E51S8AlkhAI1oSBsfrm6b4OaGvyuDTZUSQHMyt8z7gVYk6lTc4uaoRoXSTiyMiF+aUVgpABkNtdpCZ16Y4OaGUbHLqnkxCABzzHFkOxLSyeT31dTciLCOLF0rDaARDVVKVXJq4Rsac0PV0ke57LOVUe207906B1sZCXPBnDDHlGpP325tTu0lVgmF2glVSlGlPEUT3Eg4DFbvBVdfVzl56PmOLNXOg/D7RtQa4YxW8PPaqrTKItBSKR8qCLksJWzgLWbaaOvASxFhgexcpRQrsAehSCgWTsOdj/7YfrOzygE0gFjgfN0kDaSVUbAaa6N9xaTB67nyXbP0UQxUrEVdtBtNACa3Rc9ISCOLne5Tdzt7eQBSIEzsukedwTIvxkcNQL/TXZV/W+MB/AMANfVPjBGemwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-text{font-size:14px;width:30px}.jessibuca-container .jessibuca-speed{font-size:14px;color:#fff}.jessibuca-container .jessibuca-quality-menu-list{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px}.jessibuca-container .jessibuca-quality-menu-list.jessibuca-quality-menu-shown{visibility:visible;opacity:1}.jessibuca-container .icon-title-tips{pointer-events:none;position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:rgba(0,0,0,.5);border-radius:4px}.jessibuca-container .icon-title{display:inline-block;padding:5px 10px;font-size:12px;white-space:nowrap;color:#fff}.jessibuca-container .jessibuca-quality-menu{padding:8px 0}.jessibuca-container .jessibuca-quality-menu-item{display:block;height:25px;margin:0;padding:0 10px;cursor:pointer;font-size:14px;text-align:center;width:50px;color:hsla(0,0%,100%,.5);transition:color .3s,background-color .3s}.jessibuca-container .jessibuca-quality-menu-item:hover{background-color:hsla(0,0%,100%,.2)}.jessibuca-container .jessibuca-quality-menu-item:focus{outline:none}.jessibuca-container .jessibuca-quality-menu-item.jessibuca-quality-menu-item-active{color:#2298fc}.jessibuca-container .jessibuca-volume-panel-wrap{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%) translateY(22%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;height:120px;width:50px;overflow:hidden}.jessibuca-container .jessibuca-volume-panel-wrap.jessibuca-volume-panel-wrap-show{visibility:visible;opacity:1}.jessibuca-container .jessibuca-volume-panel{cursor:pointer;position:absolute;top:21px;height:60px;width:50px;overflow:hidden}.jessibuca-container .jessibuca-volume-panel-text{position:absolute;left:0;top:0;width:50px;height:20px;line-height:20px;text-align:center;color:#fff;font-size:12px}.jessibuca-container .jessibuca-volume-panel-handle{position:absolute;top:48px;left:50%;width:12px;height:12px;border-radius:12px;margin-left:-6px;background:#fff}.jessibuca-container .jessibuca-volume-panel-handle:before{bottom:-54px;background:#fff}.jessibuca-container .jessibuca-volume-panel-handle:after{bottom:6px;background:hsla(0,0%,100%,.2)}.jessibuca-container .jessibuca-volume-panel-handle:after,.jessibuca-container .jessibuca-volume-panel-handle:before{content:"";position:absolute;display:block;left:50%;width:3px;margin-left:-1px;height:60px}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-controls{width:100vh}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-play-big:after{transform:translate(-50%,-50%) rotate(270deg)}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-loading{flex-direction:row}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-loading-text{transform:rotate(270deg)}');class pt{constructor(e){var t;this.player=e,((e,t)=>{e._opt.hasControl&&e._opt.controlAutoHide?e.$container.classList.add("jessibuca-controls-show-auto-hide"):e.$container.classList.add("jessibuca-controls-show");const i=e._opt,r=i.operateBtns;e.$container.insertAdjacentHTML("beforeend",`\n ${i.background?`
`:""}\n
\n ${lt.loading}\n ${i.loadingText?`
${i.loadingText}
`:""}\n
\n ${i.hasControl&&r.play?'
':""}\n ${i.hasControl?`\n
\n
\n
00:00:01
\n
${lt.recordStop}
\n
\n `:""}\n ${i.hasControl?`\n
\n
\n
\n ${i.showBandwidth?'
':""}\n
\n
\n ${r.audio?`\n
\n ${lt.audio}\n ${lt.mute}\n
\n
\n
\n
\n
\n
\n
\n `:""}\n ${r.play?`
${lt.play}
${lt.pause}
`:""}\n ${r.screenshot?`
${lt.screenshot}
`:""}\n ${r.record?`
${lt.record}
${lt.recordStop}
`:""}\n ${r.fullscreen?`
${lt.fullscreen}
${lt.fullscreenExit}
`:""}\n
\n
\n
\n `:""}\n\n `),Object.defineProperty(t,"$poster",{value:e.$container.querySelector(".jessibuca-poster")}),Object.defineProperty(t,"$loading",{value:e.$container.querySelector(".jessibuca-loading")}),Object.defineProperty(t,"$play",{value:e.$container.querySelector(".jessibuca-play")}),Object.defineProperty(t,"$playBig",{value:e.$container.querySelector(".jessibuca-play-big")}),Object.defineProperty(t,"$recording",{value:e.$container.querySelector(".jessibuca-recording")}),Object.defineProperty(t,"$recordingTime",{value:e.$container.querySelector(".jessibuca-recording-time")}),Object.defineProperty(t,"$recordingStop",{value:e.$container.querySelector(".jessibuca-recording-stop")}),Object.defineProperty(t,"$pause",{value:e.$container.querySelector(".jessibuca-pause")}),Object.defineProperty(t,"$controls",{value:e.$container.querySelector(".jessibuca-controls")}),Object.defineProperty(t,"$fullscreen",{value:e.$container.querySelector(".jessibuca-fullscreen")}),Object.defineProperty(t,"$fullscreen",{value:e.$container.querySelector(".jessibuca-fullscreen")}),Object.defineProperty(t,"$volume",{value:e.$container.querySelector(".jessibuca-volume")}),Object.defineProperty(t,"$volumePanelWrap",{value:e.$container.querySelector(".jessibuca-volume-panel-wrap")}),Object.defineProperty(t,"$volumePanelText",{value:e.$container.querySelector(".jessibuca-volume-panel-text")}),Object.defineProperty(t,"$volumePanel",{value:e.$container.querySelector(".jessibuca-volume-panel")}),Object.defineProperty(t,"$volumeHandle",{value:e.$container.querySelector(".jessibuca-volume-panel-handle")}),Object.defineProperty(t,"$volumeOn",{value:e.$container.querySelector(".jessibuca-icon-audio")}),Object.defineProperty(t,"$volumeOff",{value:e.$container.querySelector(".jessibuca-icon-mute")}),Object.defineProperty(t,"$fullscreen",{value:e.$container.querySelector(".jessibuca-fullscreen")}),Object.defineProperty(t,"$fullscreenExit",{value:e.$container.querySelector(".jessibuca-fullscreen-exit")}),Object.defineProperty(t,"$record",{value:e.$container.querySelector(".jessibuca-record")}),Object.defineProperty(t,"$recordStop",{value:e.$container.querySelector(".jessibuca-record-stop")}),Object.defineProperty(t,"$screenshot",{value:e.$container.querySelector(".jessibuca-screenshot")}),Object.defineProperty(t,"$speed",{value:e.$container.querySelector(".jessibuca-speed")})})(e,this),t=this,Object.defineProperty(t,"controlsRect",{get:()=>t.$controls.getBoundingClientRect()}),ut(e,this),((e,t)=>{const{events:{proxy:i},debug:r}=e;function o(e){const{bottom:i,height:r}=t.$volumePanel.getBoundingClientRect(),{height:o}=t.$volumeHandle.getBoundingClientRect();return we(i-e.y-o/2,0,r-o/2)/(r-o)}if(i(window,["click","contextmenu"],(i=>{i.composedPath().indexOf(e.$container)>-1?t.isFocus=!0:t.isFocus=!1})),i(window,"orientationchange",(()=>{setTimeout((()=>{e.resize()}),300)})),i(t.$controls,"click",(e=>{e.stopPropagation()})),i(t.$pause,"click",(t=>{e.pause()})),i(t.$play,"click",(t=>{e.play(),e.resumeAudioAfterPause()})),i(t.$playBig,"click",(t=>{e.play(),e.resumeAudioAfterPause()})),i(t.$volume,"mouseover",(()=>{t.$volumePanelWrap.classList.add("jessibuca-volume-panel-wrap-show")})),i(t.$volume,"mouseout",(()=>{t.$volumePanelWrap.classList.remove("jessibuca-volume-panel-wrap-show")})),i(t.$volumeOn,"click",(i=>{i.stopPropagation(),Se(t.$volumeOn,"display","none"),Se(t.$volumeOff,"display","block");const r=e.volume;e.volume=0,e._lastVolume=r})),i(t.$volumeOff,"click",(i=>{i.stopPropagation(),Se(t.$volumeOn,"display","block"),Se(t.$volumeOff,"display","none"),e.volume=e.lastVolume||.5})),i(t.$screenshot,"click",(t=>{t.stopPropagation(),e.video.screenshot()})),i(t.$volumePanel,"click",(t=>{t.stopPropagation(),e.volume=o(t)})),i(t.$volumeHandle,"mousedown",(()=>{t.isVolumeDroging=!0})),i(t.$volumeHandle,"mousemove",(i=>{t.isVolumeDroging&&(e.volume=o(i))})),i(document,"mouseup",(()=>{t.isVolumeDroging&&(t.isVolumeDroging=!1)})),i(t.$record,"click",(t=>{t.stopPropagation(),e.recording=!0})),i(t.$recordStop,"click",(t=>{t.stopPropagation(),e.recording=!1})),i(t.$recordingStop,"click",(t=>{t.stopPropagation(),e.recording=!1})),i(t.$fullscreen,"click",(t=>{t.stopPropagation(),e.fullscreen=!0})),i(t.$fullscreenExit,"click",(t=>{t.stopPropagation(),e.fullscreen=!1})),e._opt.hasControl&&e._opt.controlAutoHide){i(e.$container,"mouseover",(()=>{e.fullscreen||(Se(t.$controls,"display","block"),o())})),i(e.$container,"mousemove",(()=>{e.$container&&t.$controls&&(e.fullscreen,"none"===t.$controls.style.display&&(Se(t.$controls,"display","block"),o()))})),i(e.$container,"mouseout",(()=>{s(),Se(t.$controls,"display","none")}));let r=null;const o=()=>{s(),r=setTimeout((()=>{Se(t.$controls,"display","none")}),5e3)},s=()=>{r&&(clearTimeout(r),r=null)}}})(e,this),e._opt.hotKey&&((e,t)=>{const{events:{proxy:i}}=e,r={};function o(e,t){r[e]?r[e].push(t):r[e]=[t]}o(re,(()=>{e.fullscreen&&(e.fullscreen=!1)})),o(oe,(()=>{e.volume+=.05})),o(se,(()=>{e.volume-=.05})),i(window,"keydown",(e=>{if(t.isFocus){const t=document.activeElement.tagName.toUpperCase(),i=document.activeElement.getAttribute("contenteditable");if("INPUT"!==t&&"TEXTAREA"!==t&&""!==i&&"true"!==i){const t=r[e.keyCode];t&&(e.preventDefault(),t.forEach((e=>e())))}}}))})(e,this),this.player.debug.log("Control","init")}destroy(){if(this.$poster){if(!Le(this.$poster)){const e=this.player.$container.querySelector(".jessibuca-poster");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$loading){if(!Le(this.$loading)){const e=this.player.$container.querySelector(".jessibuca-loading");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$controls){if(!Le(this.$controls)){const e=this.player.$container.querySelector(".jessibuca-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$recording){if(!Le(this.$recording)){const e=this.player.$container.querySelector(".jessibuca-recording");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$playBig){if(!Le(this.$playBig)){const e=this.player.$container.querySelector(".jessibuca-play-big");e&&this.player.$container&&this.player.$container.removeChild(e)}}this.player.$container&&(this.player.$container.classList.remove("jessibuca-controls-show-auto-hide"),this.player.$container.classList.remove("jessibuca-controls-show")),this.player.debug.log("control","destroy")}autoSize(){const e=this.player;e.$container.style.padding="0 0";const t=e.width,i=e.height,r=t/i,o=e.video.$videoElement.width/e.video.$videoElement.height;if(r>o){const r=(t-i*o)/2;e.$container.style.padding=`0 ${r}px`}else{const r=(i-t/o)/2;e.$container.style.padding=`${r}px 0`}}toggleBar(e){this.$controls&&(Ie(e)||(e="none"===Ee(this.$controls,"display",!1)),Se(this.$controls,"display",e?"flex":"none"))}getBarIsShow(){let e=!1;return this.$controls&&(e="none"!==Ee(this.$controls,"display",!1)),e}}ht(".jessibuca-container{position:relative;display:block;width:100%;height:100%;overflow:hidden}.jessibuca-container.jessibuca-fullscreen-web{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;width:100vw!important;height:100vh!important;background:#000}");class mt{static init(){mt.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};for(let e in mt.types)mt.types.hasOwnProperty(e)&&(mt.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=mt.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,r=Array.prototype.slice.call(arguments,1),o=r.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let s=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(e){return mt.box(mt.types.trak,mt.tkhd(e),mt.mdia(e))}static tkhd(e){let t=e.id,i=e.duration,r=e.presentWidth,o=e.presentHeight;return mt.box(mt.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>>8&255,255&r,0,0,o>>>8&255,255&o,0,0]))}static mdia(e){return mt.box(mt.types.mdia,mt.mdhd(e),mt.hdlr(e),mt.minf(e))}static mdhd(e){let t=e.timescale,i=e.duration;return mt.box(mt.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?mt.constants.HDLR_AUDIO:mt.constants.HDLR_VIDEO,mt.box(mt.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?mt.box(mt.types.smhd,mt.constants.SMHD):mt.box(mt.types.vmhd,mt.constants.VMHD),mt.box(mt.types.minf,t,mt.dinf(),mt.stbl(e))}static dinf(){return mt.box(mt.types.dinf,mt.box(mt.types.dref,mt.constants.DREF))}static stbl(e){return mt.box(mt.types.stbl,mt.stsd(e),mt.box(mt.types.stts,mt.constants.STTS),mt.box(mt.types.stsc,mt.constants.STSC),mt.box(mt.types.stsz,mt.constants.STSZ),mt.box(mt.types.stco,mt.constants.STCO))}static stsd(e){return"audio"===e.type?mt.box(mt.types.stsd,mt.constants.STSD_PREFIX,mt.mp4a(e)):"avc"===e.videoType?mt.box(mt.types.stsd,mt.constants.STSD_PREFIX,mt.avc1(e)):mt.box(mt.types.stsd,mt.constants.STSD_PREFIX,mt.hvc1(e))}static mp4a(e){let t=e.channelCount,i=e.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return mt.box(mt.types.mp4a,r,mt.esds(e))}static esds(e){let t=e.config||[],i=t.length,r=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return mt.box(mt.types.esds,r)}static avc1(e){let t=e.avcc;const i=e.codecWidth,r=e.codecHeight;let o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,r>>>8&255,255&r,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return mt.box(mt.types.avc1,o,mt.box(mt.types.avcC,t))}static hvc1(e){let t=e.avcc;const i=e.codecWidth,r=e.codecHeight;let o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,r>>>8&255,255&r,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return mt.box(mt.types.hvc1,o,mt.box(mt.types.hvcC,t))}static mvex(e){return mt.box(mt.types.mvex,mt.trex(e))}static trex(e){let t=e.id,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return mt.box(mt.types.trex,i)}static moof(e,t){return mt.box(mt.types.moof,mt.mfhd(e.sequenceNumber),mt.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return mt.box(mt.types.mfhd,t)}static traf(e,t){let i=e.id,r=mt.box(mt.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),o=mt.box(mt.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),s=mt.sdtp(e),a=mt.trun(e,s.byteLength+16+16+8+16+8+8);return mt.box(mt.types.traf,r,o,a,s)}static sdtp(e){let t=new Uint8Array(5),i=e.flags;return t[4]=i.isLeading<<6|i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy,mt.box(mt.types.sdtp,t)}static trun(e,t){let i=new Uint8Array(28);t+=36,i.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let r=e.duration,o=e.size,s=e.flags,a=e.cts;return i.set([r>>>24&255,r>>>16&255,r>>>8&255,255&r,o>>>24&255,o>>>16&255,o>>>8&255,255&o,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12),mt.box(mt.types.trun,i)}static mdat(e){return mt.box(mt.types.mdat,e)}}mt.init();class gt extends Oe{constructor(e){super(),this.player=e,this.isAvc=!0,this.mediaSource=new window.MediaSource,this.sourceBuffer=null,this.hasInit=!1,this.isInitInfo=!1,this.cacheTrack={},this.timeInit=!1,this.sequenceNumber=0,this.mediaSourceOpen=!1,this.dropping=!1,this.firstRenderTime=null,this.mediaSourceAppendBufferError=!1,this.mediaSourceAppendBufferFull=!1,this.isDecodeFirstIIframe=!1,this.player.video.$videoElement.src=window.URL.createObjectURL(this.mediaSource);const{debug:t,events:{proxy:i}}=e;i(this.mediaSource,"sourceopen",(()=>{this.mediaSourceOpen=!0,this.player.emit(j.mseSourceOpen)})),i(this.mediaSource,"sourceclose",(()=>{this.player.emit(j.mseSourceClose)})),e.debug.log("MediaSource","init")}destroy(){this.stop(),this.mediaSource=null,this.mediaSourceOpen=!1,this.sourceBuffer=null,this.hasInit=!1,this.isInitInfo=!1,this.sequenceNumber=0,this.cacheTrack=null,this.timeInit=!1,this.mediaSourceAppendBufferError=!1,this.mediaSourceAppendBufferFull=!1,this.isDecodeFirstIIframe=!1,this.off(),this.player.debug.log("MediaSource","destroy")}get state(){return this.mediaSource&&this.mediaSource.readyState}get isStateOpen(){return this.state===ee}get isStateClosed(){return this.state===te}get isStateEnded(){return this.state===$}get duration(){return this.mediaSource&&this.mediaSource.duration}set duration(e){this.mediaSource.duration=e}decodeVideo(e,t,i,r){const o=this.player;if(o)if(this.hasInit){if(i&&0===e[1]){let t=At(e.slice(5));const i=this.player.video.videoInfo;i&&i.width&&i.height&&t&&t.codecWidth&&t.codecHeight&&(t.codecWidth!==i.width||t.codecHeight!==i.height)&&(this.player.debug.warn("MediaSource",`width or height is update, width ${i.width}-> ${t.codecWidth}, height ${i.height}-> ${t.codecHeight}`),this.isInitInfo=!1,this.player.video.init=!1)}if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){null===this.firstRenderTime&&(this.firstRenderTime=t);const o=t-this.firstRenderTime;this._decodeVideo(e,o,i,r)}else this.player.debug.warn("MediaSource","decodeVideo isDecodeFirstIIframe false")}else if(i&&0===e[1]){const r=15&e[0];if(o.video.updateVideoInfo({encTypeCode:r}),r===J)return void this.emit(F.mediaSourceH265NotSupport);o._times.decodeStart||(o._times.decodeStart=ve()),this._decodeConfigurationRecord(e,t,i,r),this.hasInit=!0}}_decodeConfigurationRecord(e,t,i,r){let o=e.slice(5),s={};s=At(o);const a={id:1,type:"video",timescale:1e3,duration:0,avcc:o,codecWidth:s.codecWidth,codecHeight:s.codecHeight,videoType:s.videoType},n=mt.generateInitSegment(a);this.isAvc=!0,this.appendBuffer(n.buffer),this.sequenceNumber=0,this.cacheTrack=null,this.timeInit=!1}_decodeVideo(e,t,i,r){const o=this.player;let s=e.slice(5),a=s.byteLength;const n=o.video.$videoElement,A=o._opt.videoBufferDelay;if(n.buffered.length>1&&(this.removeBuffer(n.buffered.start(0),n.buffered.end(0)),this.timeInit=!1),this.dropping&&t-this.cacheTrack.dts>A)this.dropping=!1,this.cacheTrack={};else if(this.cacheTrack&&t>=this.cacheTrack.dts){let e=8+this.cacheTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(mt.types.mdat,4),i.set(this.cacheTrack.data,8),this.cacheTrack.duration=t-this.cacheTrack.dts;let r=mt.moof(this.cacheTrack,this.cacheTrack.dts),s=new Uint8Array(r.byteLength+i.byteLength);s.set(r,0),s.set(i,r.byteLength),this.appendBuffer(s.buffer),o.handleRender(),o.updateStats({fps:!0,ts:t,buf:o.demux&&o.demux.delay||0}),o._times.videoStart||(o._times.videoStart=ve(),o.handlePlayToRenderTimes())}else o.debug.log("MediaSource","timeInit set false , cacheTrack = {}"),this.timeInit=!1,this.cacheTrack={};this.cacheTrack||(this.cacheTrack={}),this.cacheTrack.id=1,this.cacheTrack.sequenceNumber=++this.sequenceNumber,this.cacheTrack.size=a,this.cacheTrack.dts=t,this.cacheTrack.cts=r,this.cacheTrack.isKeyframe=i,this.cacheTrack.data=s,this.cacheTrack.flags={isLeading:0,dependsOn:i?2:1,isDependedOn:i?1:0,hasRedundancy:0,isNonSync:i?0:1},this.timeInit||1!==n.buffered.length||(o.debug.log("MediaSource","timeInit set true"),this.timeInit=!0,n.currentTime=n.buffered.end(0)),!this.isInitInfo&&n.videoWidth>0&&n.videoHeight>0&&(o.debug.log("MediaSource",`updateVideoInfo: ${n.videoWidth},${n.videoHeight}`),o.video.updateVideoInfo({width:n.videoWidth,height:n.videoHeight}),o.video.initCanvasViewSize(),this.isInitInfo=!0)}appendBuffer(e){const{debug:t,events:{proxy:i}}=this.player;if(null===this.sourceBuffer&&(this.sourceBuffer=this.mediaSource.addSourceBuffer(_),i(this.sourceBuffer,"error",(e=>{t.error("MediaSource","sourceBuffer error",e),this.player.emit(j.mseSourceBufferError,e)}))),this.mediaSourceAppendBufferError)t.error("MediaSource","this.mediaSourceAppendBufferError is true");else if(this.mediaSourceAppendBufferFull)t.error("MediaSource","this.mediaSourceAppendBufferFull is true");else if(!1===this.sourceBuffer.updating&&this.isStateOpen)try{this.sourceBuffer.appendBuffer(e)}catch(e){t.warn("MediaSource","this.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.emit(F.mediaSourceFull)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.emit(F.mediaSourceAppendBufferError)):(t.error("MediaSource","appendBuffer error",e),this.player.emit(j.mseSourceBufferError,e))}else this.isStateClosed?this.player.emitError(F.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed"):this.isStateEnded?this.player.emitError(F.mseSourceBufferError,"mediaSource is closed"):!0===this.sourceBuffer.updating&&this.player.emit(j.mseSourceBufferBusy)}stop(){this.abortSourceBuffer(),this.removeSourceBuffer(),this.endOfStream()}dropSourceBuffer(e){const t=this.player.video.$videoElement;this.dropping=e,t.buffered.length>0&&t.buffered.end(0)-t.currentTime>1&&(this.player.debug.warn("MediaSource","dropSourceBuffer",`$video.buffered.end(0) is ${t.buffered.end(0)} - $video.currentTime ${t.currentTime}`),t.currentTime=t.buffered.end(0))}removeBuffer(e,t){if(this.isStateOpen&&!1===this.sourceBuffer.updating)try{this.sourceBuffer.remove(e,t)}catch(e){this.player.debug.warn("MediaSource","removeBuffer() error",e)}else this.player.debug.warn("MediaSource","removeBuffer() this.isStateOpen is",this.isStateOpen,"this.sourceBuffer.updating",this.sourceBuffer.updating)}endOfStream(){const e=this.player.video&&this.player.video.$videoElement;if(this.isStateOpen&&e&&e.readyState>=1)try{this.mediaSource.endOfStream()}catch(e){this.player.debug.warn("MediaSource","endOfStream() error",e)}}abortSourceBuffer(){this.isStateOpen&&this.sourceBuffer&&(this.sourceBuffer.abort(),this.sourceBuffer=null)}removeSourceBuffer(){if(!this.isStateClosed&&this.mediaSource&&this.sourceBuffer)try{this.mediaSource.removeSourceBuffer(this.sourceBuffer)}catch(e){this.player.debug.warn("MediaSource","removeSourceBuffer() error",e)}}getSourceBufferUpdating(){return this.sourceBuffer&&this.sourceBuffer.updating}}const ft=()=>"undefined"!=typeof navigator&&parseFloat((""+(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))<10&&!window.MSStream,bt=()=>"wakeLock"in navigator;class yt{constructor(e){if(this.player=e,this.enabled=!1,bt()){this._wakeLock=null;const e=()=>{null!==this._wakeLock&&"visible"===document.visibilityState&&this.enable()};document.addEventListener("visibilitychange",e),document.addEventListener("fullscreenchange",e)}else ft()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohB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AAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABByccMMTb3jCDU7QKSp1IAAAAAAADADwAACQXAAREdHMYWRobHB0eHyAhIiMkAgAAAAAABcAfAAAJCVAREQ0cxgZGhscHR4fICEiIyQBAIAAAgAAAAAggAAEBAQAAAAAAAIAAAAEBB9DtnUBAAAAAAAEPueBAKOFggAAgACjzoEAA4BwBwCdASqwAJAAAEcIhYWIhYSIAgIABhwJ7kPfbJyHvtk5D32ych77ZOQ99snIe+2TkPfbJyHvtk5D32ych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AAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"),this.noSleepVideo.addEventListener("loadedmetadata",(()=>{this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",(()=>{this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())}))})))}_addSourceToVideo(e,t,i){var r=document.createElement("source");r.src=i,r.type=`video/${t}`,e.appendChild(r)}get isEnabled(){return this.enabled}enable(){const e=this.player.debug;if(bt())return navigator.wakeLock.request("screen").then((t=>{this._wakeLock=t,this.enabled=!0,e.log("wakeLock","Wake Lock active."),this._wakeLock.addEventListener("release",(()=>{e.log("wakeLock","Wake Lock released.")}))})).catch((t=>{throw this.enabled=!1,e.error("wakeLock",`${t.name}, ${t.message}`),t}));if(ft())return this.disable(),this.noSleepTimer=window.setInterval((()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))}),15e3),this.enabled=!0,Promise.resolve();return this.noSleepVideo.play().then((e=>(this.enabled=!0,e))).catch((e=>{throw this.enabled=!1,e}))}disable(){const e=this.player.debug;bt()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):ft()?this.noSleepTimer&&(e.warn("wakeLock","NoSleep now disabled for older iOS devices."),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}class vt extends Oe{constructor(e,t){var i;super(),this.$container=e,this._opt=Object.assign({},h,t),this.debug=new me(this),this.debug.log("Player","init"),this._opt.forceNoOffscreen=!0,(Re()||/ipad|android(?!.*mobile)|tablet|kindle|silk/i.test(window.navigator.userAgent.toLowerCase()))&&(this.debug.log("Player","isMobile and set _opt.controlAutoHide false"),this._opt.controlAutoHide=!1),fe.isEnabled&&this._opt.useWebFullScreen&&(this.debug.log("Player","screenfull.isEnabled is true and _opt.useWebFullScreen is true , set _opt.useWebFullScreen false"),this._opt.useWebFullScreen=!1),Ve(fe.isEnabled)&&Ve(this._opt.useWebFullScreen)&&(this.debug.log("Player","screenfull.isEnabled is false and _opt.useWebFullScreen is false , set _opt.useWebFullScreen true"),this._opt.useWebFullScreen=!0),this._opt.useWCS&&(this._opt.useWCS="VideoEncoder"in window),this._opt.useMSE&&(this._opt.useMSE=window.MediaSource&&window.MediaSource.isTypeSupported(_)),this._opt.wcsUseVideoRender&&(this._opt.wcsUseVideoRender=window.MediaStreamTrackGenerator&&"function"==typeof window.MediaStreamTrackGenerator),this._opt.useMSE&&(this._opt.useWCS&&this.debug.log("Player","useWCS set true->false"),this._opt.forceNoOffscreen||this.debug.log("Player","forceNoOffscreen set false->true"),this._opt.useWCS=!1,this._opt.forceNoOffscreen=!0),this._opt.forceNoOffscreen||("undefined"==typeof OffscreenCanvas?(this._opt.forceNoOffscreen=!0,this._opt.useOffscreen=!1):this._opt.useOffscreen=!0),this._opt.hasAudio||(this._opt.operateBtns.audio=!1),this._opt.hasControl=this._hasControl(),this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._checkHeartTimeout=null,this._checkLoadingTimeout=null,this._checkStatsInterval=null,this._startBpsTime=null,this._isPlayingBeforePageHidden=!1,this._stats={buf:0,fps:0,abps:0,vbps:0,ts:0},this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this._videoTimestamp=0,this._audioTimestamp=0,i=this,Object.defineProperty(i,"rect",{get:()=>{const e=i.$container.getBoundingClientRect();return e.width=Math.max(e.width,i.$container.clientWidth),e.height=Math.max(e.height,i.$container.clientHeight),e}}),["bottom","height","left","right","top","width"].forEach((e=>{Object.defineProperty(i,e,{get:()=>i.rect[e]})})),this.events=new ge(this),this.video=new ze(this),this._opt.hasAudio&&(this.audio=new Xe(this)),this.recorder=new et(this),this._onlyMseOrWcsVideo()?this.loaded=!0:this.decoderWorker=new tt(this),this.stream=null,this.demux=null,this._lastVolume=null,this._opt.useWCS&&(this.webcodecsDecoder=new dt(this),this.loaded=!0),this._opt.useMSE&&(this.mseDecoder=new gt(this),this.loaded=!0),this.control=new pt(this),Re()&&(this.keepScreenOn=new yt(this)),(e=>{try{const t=t=>{je(t)===e.$container&&(e.emit(L.fullscreen,e.fullscreen),e.fullscreen?e._opt.useMSE&&e.resize():e.resize())};fe.on("change",t),e.events.destroys.push((()=>{fe.off("change",t)}))}catch(e){}if(e.on(j.decoderWorkerInit,(()=>{e.debug.log("player","has loaded"),e.loaded=!0})),e.on(j.play,(()=>{e.loading=!1})),e.on(j.fullscreen,(t=>{if(t)try{fe.request(e.$container).then((()=>{})).catch((t=>{Re()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}))}catch(t){Re()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}else try{fe.exit().then((()=>{e.webFullscreen&&(e.webFullscreen=!1)})).catch((()=>{e.webFullscreen=!1}))}catch(t){e.webFullscreen=!1}})),Re()&&e.on(j.webFullscreen,(t=>{t?e.$container.classList.add("jessibuca-fullscreen-web"):e.$container.classList.remove("jessibuca-fullscreen-web"),e.emit(L.fullscreen,e.fullscreen)})),e.on(j.resize,(()=>{e.video&&e.video.resize()})),e._opt.debug){const t=[j.timeUpdate],i=[j.stats,j.playToRenderTimes,j.audioInfo,j.videoInfo];Object.keys(j).forEach((r=>{e.on(j[r],(o=>{t.includes(r)||(i.includes(r)&&(o=JSON.stringify(o)),e.debug.log("player events",j[r],o))}))})),Object.keys(F).forEach((t=>{e.on(F[t],(i=>{e.debug.log("player event error",F[t],i)}))}))}})(this),(e=>{const{_opt:t,debug:i,events:{proxy:r}}=e;t.supportDblclickFullscreen&&r(e.$container,"dblclick",(t=>{const i=je(t).nodeName.toLowerCase();"canvas"!==i&&"video"!==i||(e.fullscreen=!e.fullscreen)})),r(document,"visibilitychange",(()=>{t.hiddenAutoPause&&(i.log("visibilitychange",document.visibilityState,e._isPlayingBeforePageHidden),"visible"===document.visibilityState?e._isPlayingBeforePageHidden&&e.play():(e._isPlayingBeforePageHidden=e.playing,e.playing&&e.pause()))})),r(window,"fullscreenchange",(()=>{null!==e.keepScreenOn&&"visible"===document.visibilityState&&e.enableWakeLock()}))})(this),this.debug.log("Player","init and version is",u),this._opt.useWCS&&this.debug.log("Player","use WCS"),this._opt.useMSE&&this.debug.log("Player","use MSE"),this._opt.useOffscreen&&this.debug.log("Player","use offscreen");try{this.debug.log("Player options",JSON.stringify(this._opt))}catch(e){}}async destroy(){this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._lastVolume=null,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.decoderWorker&&(await this.decoderWorker.destroy(),this.decoderWorker=null),this.video&&(this.video.destroy(),this.video=null),this.audio&&(this.audio.destroy(),this.audio=null),this.stream&&(await this.stream.destroy(),this.stream=null),this.recorder&&(this.recorder.destroy(),this.recorder=null),this.control&&(this.control.destroy(),this.control=null),this.webcodecsDecoder&&(this.webcodecsDecoder.destroy(),this.webcodecsDecoder=null),this.mseDecoder&&(this.mseDecoder.destroy(),this.mseDecoder=null),this.demux&&(this.demux.destroy(),this.demux=null),this.events&&(this.events.destroy(),this.events=null),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.releaseWakeLock(),this.keepScreenOn=null,this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this.emit("destroy"),this.off(),this.debug.log("play","destroy end")}set fullscreen(e){Re()&&this._opt.useWebFullScreen?(this.emit(j.webFullscreen,e),setTimeout((()=>{this.updateOption({rotate:e?270:0}),this.resize()}),10)):this.emit(j.fullscreen,e)}get fullscreen(){return fe.isFullscreen||this.webFullscreen}set webFullscreen(e){this.emit(j.webFullscreen,e)}get webFullscreen(){return this.$container.classList.contains("jessibuca-fullscreen-web")}set loaded(e){this._hasLoaded=e}get loaded(){return this._hasLoaded}set playing(e){e&&(this.loading=!1),this.playing!==e&&(this._playing=e,this.emit(j.playing,e),this.emit(j.volumechange,this.volume),e?this.emit(j.play):this.emit(j.pause))}get playing(){return this._playing}get volume(){return this.audio&&this.audio.volume||0}set volume(e){e!==this.volume&&(this.audio&&this.audio.setVolume(e),this._lastVolume=e)}get lastVolume(){return this._lastVolume}set loading(e){this.loading!==e&&(this._loading=e,this.emit(j.loading,this._loading))}get loading(){return this._loading}set recording(e){e?this.playing&&this.recorder&&this.recorder.startRecord():this.recorder&&this.recorder.stopRecordAndSave()}get recording(){return!!this.recorder&&this.recorder.recording}set audioTimestamp(e){null!==e&&(this._audioTimestamp=e)}get audioTimestamp(){return this._audioTimestamp}set videoTimestamp(e){null!==e&&(this._videoTimestamp=e,this._opt.useWCS||this._opt.useMSE||this.audioTimestamp&&this.videoTimestamp&&this.audio&&this.audio.emit(j.videoSyncAudio,{audioTimestamp:this.audioTimestamp,videoTimestamp:this.videoTimestamp,diff:this.audioTimestamp-this.videoTimestamp}))}get videoTimestamp(){return this._videoTimestamp}get isDebug(){return!0===this._opt.debug}updateOption(e){this._opt=Object.assign({},this._opt,e)}init(){return new Promise(((e,t)=>{this.stream||(this.stream=new Ke(this)),this.audio||this._opt.hasAudio&&(this.audio=new Xe(this)),this.demux||(this.demux=new st(this)),this._opt.useWCS&&(this.webcodecsDecoder||(this.webcodecsDecoder=new dt(this))),this._opt.useMSE&&(this.mseDecoder||(this.mseDecoder=new gt(this))),this.decoderWorker||this._onlyMseOrWcsVideo()?e():(this.decoderWorker=new tt(this),this.debug.log("Player","waiting decoderWorker init"),this.once(j.decoderWorkerInit,(()=>{this.debug.log("Player","decoderWorker init success"),e()})))}))}play(e,t){return new Promise(((i,r)=>{if(!e&&!this._opt.url)return r();this.loading=!0,this.playing=!1,this._times.playInitStart=ve(),e||(e=this._opt.url),this._opt.url=e,this.clearCheckHeartTimeout(),this.init().then((()=>{this._times.playStart=ve(),this._opt.isNotMute&&this.mute(!1),this.webcodecsDecoder&&this.webcodecsDecoder.once(F.webcodecsH265NotSupport,(()=>{this.emit(F.webcodecsH265NotSupport),this._opt.autoWasm||this.emit(j.error,F.webcodecsH265NotSupport)})),this.mseDecoder&&(this.mseDecoder.once(F.mediaSourceH265NotSupport,(()=>{this.emit(F.mediaSourceH265NotSupport),this._opt.autoWasm||this.emit(j.error,F.mediaSourceH265NotSupport)})),this.mseDecoder.once(F.mediaSourceFull,(()=>{this.emitError(F.mediaSourceFull)})),this.mseDecoder.once(F.mediaSourceAppendBufferError,(()=>{this.emitError(F.mediaSourceAppendBufferError)})),this.mseDecoder.once(F.mediaSourceBufferListLarge,(()=>{this.emitError(F.mediaSourceBufferListLarge)})),this.mseDecoder.once(F.mediaSourceAppendBufferEndTimeout,(()=>{this.emitError(F.mediaSourceAppendBufferEndTimeout)}))),this.enableWakeLock(),this.stream.fetchStream(e,t),this.checkLoadingTimeout(),this.stream.once(F.fetchError,(e=>{this.emitError(F.fetchError,e)})),this.stream.once(F.websocketError,(e=>{this.emitError(F.websocketError,e)})),this.stream.once(j.streamEnd,(e=>{this.emitError(j.streamEnd,e)})),this.stream.once(j.streamSuccess,(()=>{i(),this._times.streamResponse=ve(),this.video.play(),this.checkStatsInterval()}))})).catch((e=>{r(e)}))}))}close(){return new Promise(((e,t)=>{this._close().then((()=>{this.video&&this.video.clearView(),e()}))}))}resumeAudioAfterPause(){this.lastVolume&&(this.volume=this.lastVolume)}_close(){return new Promise(((e,t)=>{this.stream&&(this.stream.destroy(),this.stream=null),this.demux&&(this.demux.destroy(),this.demux=null),this.decoderWorker&&(this.decoderWorker.destroy(),this.decoderWorker=null),this.webcodecsDecoder&&(this.webcodecsDecoder.destroy(),this.webcodecsDecoder=null),this.mseDecoder&&(this.mseDecoder.destroy(),this.mseDecoder=null),this.audio&&(this.audio.destroy(),this.audio=null),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.playing=!1,this.loading=!1,this.recording=!1,this.video&&(this.video.resetInit(),this.video.pause(!0)),this.releaseWakeLock(),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},setTimeout((()=>{e()}),0)}))}pause(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?this.close():this._close()}mute(e){if(this.audio){const t=this.audio.getLastVolume();this.audio.mute(e),this._lastVolume=e?0:t||.5}}resize(){this.video.resize()}startRecord(e,t){this.recording||(this.recorder.setFileName(e,t),this.recording=!0)}stopRecordAndSave(){this.recording&&(this.recording=!1)}_hasControl(){let e=!1,t=!1;return Object.keys(this._opt.operateBtns).forEach((e=>{this._opt.operateBtns[e]&&(t=!0)})),(this._opt.showBandwidth||this._opt.text||t)&&(e=!0),e}_onlyMseOrWcsVideo(){return!1===this._opt.hasAudio&&(this._opt.useMSE||this._opt.useWCS&&!this._opt.useOffscreen)}checkHeart(){this.clearCheckHeartTimeout(),this.checkHeartTimeout()}checkHeartTimeout(){this._checkHeartTimeout=setTimeout((()=>{if(this.playing){if(0!==this._stats.fps)return;this.pause().then((()=>{this.emit(j.timeout,j.delayTimeout),this.emit(j.delayTimeout)}))}}),1e3*this._opt.heartTimeout)}checkStatsInterval(){this._checkStatsInterval=setInterval((()=>{this.updateStats()}),1e3)}clearCheckHeartTimeout(){this._checkHeartTimeout&&(clearTimeout(this._checkHeartTimeout),this._checkHeartTimeout=null)}checkLoadingTimeout(){this._checkLoadingTimeout=setTimeout((()=>{this.playing||this.pause().then((()=>{this.emit(j.timeout,j.loadingTimeout),this.emit(j.loadingTimeout)}))}),1e3*this._opt.loadingTimeout)}clearCheckLoadingTimeout(){this._checkLoadingTimeout&&(clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}handleRender(){this.loading&&(this.emit(j.start),this.loading=!1,this.clearCheckLoadingTimeout()),this.playing||(this.playing=!0),this.checkHeart()}updateStats(e){e=e||{},this._startBpsTime||(this._startBpsTime=ve()),xe(e.ts)&&(this._stats.ts=e.ts),xe(e.buf)&&(this._stats.buf=e.buf),e.fps&&(this._stats.fps+=1),e.abps&&(this._stats.abps+=e.abps),e.vbps&&(this._stats.vbps+=e.vbps);const t=ve();t-this._startBpsTime<1e3||(this.emit(j.stats,this._stats),this.emit(j.performance,function(e){let t=0;return e>=24?t=2:e>=15&&(t=1),t}(this._stats.fps)),this._stats.fps=0,this._stats.abps=0,this._stats.vbps=0,this._startBpsTime=t)}resetStats(){this._startBpsTime=null,this._stats={buf:0,fps:0,abps:0,vbps:0,ts:0}}enableWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.enable()}releaseWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.disable()}handlePlayToRenderTimes(){const e=this._times;e.playTimestamp=e.playStart-e.playInitStart,e.streamTimestamp=e.streamStart-e.playStart,e.streamResponseTimestamp=e.streamResponse-e.streamStart,e.demuxTimestamp=e.demuxStart-e.streamResponse,e.decodeTimestamp=e.decodeStart-e.demuxStart,e.videoTimestamp=e.videoStart-e.decodeStart,e.allTimestamp=e.videoStart-e.playInitStart,this.emit(j.playToRenderTimes,e)}getOption(){return this._opt}emitError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.emit(j.error,e,t),this.emit(e,t)}isControlBarShow(){const e=this._opt.hasControl,t=this._opt.controlAutoHide;let i=e&&!t;return i&&this.control&&(i=this.control.getBarIsShow()),i}getControlBarShow(){let e=!1;return this.control&&(e=this.control.getBarIsShow()),e}toggleControlBar(e){this.control&&(this.control.toggleBar(e),this.resize())}}class wt extends Oe{constructor(e){super();let t=e,i=e.container;if("string"==typeof e.container&&(i=document.querySelector(e.container)),!i)throw new Error("Jessibuca need container option");if("CANVAS"===i.nodeName||"VIDEO"===i.nodeName)throw new Error(`Jessibuca container type can not be ${i.nodeName} type`);if(t.videoBuffer>=t.heartTimeout)throw new Error(`Jessibuca videoBuffer ${t.videoBuffer}s must be less than heartTimeout ${t.heartTimeout}s`);if(this._checkHasCreated(i))throw new Error("Jessibuca container has been created and can not be created again",i);if(t.videoBuffer>10&&console.warn("Jessibuca",`videoBuffer ${t.videoBuffer}s is too long, will black screen for ${t.videoBuffer}s , it is recommended to set it to less than 10s`),!i.classList)throw new Error("Jessibuca container option must be DOM Element");var r,o,s;i.classList.add("jessibuca-container"),r=i,o=l,s="xxxxxxxxxxxx4xxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),r&&(r.dataset?r.dataset[o]=s:r.setAttribute("data-"+o,s)),delete t.container,t.forceNoOffscreen=!0,Re()&&(t.controlAutoHide=!1),xe(t.videoBuffer)&&(t.videoBuffer=1e3*Number(t.videoBuffer)),xe(t.timeout)&&(Te(t.loadingTimeout)&&(t.loadingTimeout=t.timeout),Te(t.heartTimeout)&&(t.heartTimeout=t.timeout)),this._opt=t,this.$container=i,this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this.initDecoderWorkerTimeout=null,this._destroyed=!1,this.events=new ge(this),this.debug=new me(this),this._initPlayer(i,t),console.log('Jessibuca version: "3.2.8"')}async destroy(){var e,t;this._destroyed=!0,this.off(),this._clearInitDecoderWorkerTimeout(),this.player&&(await this.player.destroy(),this.player=null),this.events&&(this.events.destroy(),this.events=null),this.$container&&(this.$container.classList.remove("jessibuca-container"),this.$container.classList.remove("jessibuca-fullscreen-web"),e=this.$container,t=l,e&&(e.dataset?delete e.dataset[t]:e.removeAttribute("data-"+t)),this.$container=null),this._opt={},this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0}_initPlayer(e,t){this.player=new vt(e,t);try{this.debug.log("jessibuca","_initPlayer",JSON.stringify(this.player.getOption()))}catch(e){}this._bindEvents()}_resetPlayer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.player.destroy(),this.player=null,this._opt=Object.assign(this._opt,e),this._opt.url="",this._initPlayer(this.$container,this._opt)}_bindEvents(){Object.keys(L).forEach((e=>{this.player.on(L[e],(t=>{this.emit(e,t)}))}))}isDestroyed(){return this._destroyed}setDebug(e){this.player.updateOption({debug:!!e})}mute(){this.player.mute(!0)}cancelMute(){this.player.mute(!1)}setVolume(e){this.player.volume=e}audioResume(){this.player.audio&&this.player.audio.audioEnabled(!0)}setTimeout(e){e=Number(e),this.player.updateOption({timeout:e,loadingTimeout:e,heartTimeout:e})}setScaleMode(e){let t={isFullResize:!1,isResize:!1};switch(e=Number(e)){case N:t.isFullResize=!1,t.isResize=!1;break;case H:t.isFullResize=!1,t.isResize=!0;break;case z:t.isFullResize=!0,t.isResize=!0}this.player.updateOption(t),this.resize()}pause(){return new Promise(((e,t)=>{this.player?this.player.pause().then((()=>{e()})).catch((e=>{t(e)})):t("player is null")}))}async close(){return await this.destroy(),!0}clearView(){this.player.video.clearView()}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,r)=>{if(!this.isDestroyed())return e||this._opt.url?void(e?this._opt.url?e===this._opt.url?this.player.playing?i():(this.clearView(),this.player.play(this._opt.url,this._opt.playOptions).then((()=>{i(),this.player.resumeAudioAfterPause()})).catch((e=>{this.debug.warn("jessibuca","pause -> play and play error",e),this.player.pause().then((()=>{r(e)}))}))):this.player.pause().then((()=>{this.clearView(),this._play(e,t).then((()=>{i()})).catch((e=>{this.debug.warn("jessibuca","this._play error",e),r(e)}))})).catch((e=>{this.debug.warn("jessibuca","this._opt.url is null and pause error",e),r(e)})):this._play(e,t).then((()=>{i()})).catch((e=>{this.debug.warn("jessibuca","this._play error",e),r(e)})):this.player.play(this._opt.url,this._opt.playOptions).then((()=>{i(),this.player.resumeAudioAfterPause()})).catch((e=>{this.debug.warn("jessibuca","url is null and play error",e),this.player.pause().then((()=>{r(e)}))}))):(this.emit(j.error,F.playError),void r("play url is empty"));r("Jessibuca is destroyed")}))}_play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,r)=>{this._opt.url=e,this._opt.playOptions=t;const o=0===e.indexOf("http"),d=o?a:s,c=o||-1!==e.indexOf(".flv")||this._opt.isFlv?n:A;this.player.updateOption({protocol:d,demuxType:c}),this.player.once(F.webglAlignmentError,(()=>{this.pause().then((()=>{this.debug.log("Jessibuca","webglAlignmentError"),this._resetPlayer({openWebglAlignment:!0}),this.play(e,t).then((()=>{this.debug.log("Jessibuca","webglAlignmentError and play success")})).catch((()=>{this.debug.log("Jessibuca","webglAlignmentError and play error")}))}))})),this.player.once(F.mediaSourceH265NotSupport,(()=>{this.pause().then((()=>{this.player._opt.autoWasm?(this.debug.log("Jessibuca","auto wasm [mse-> wasm] reset player and play"),this._resetPlayer({useMSE:!1}),this.play(e,t).then((()=>{this.debug.log("Jessibuca","auto wasm [mse-> wasm] reset player and play success")})).catch((()=>{this.debug.log("Jessibuca","auto wasm [mse-> wasm] reset player and play error")}))):this.debug.log("Jessibuca","media source h265 not support and paused")}))})),this.player.once(F.mediaSourceFull,(()=>{this.pause().then((()=>{this.debug.log("Jessibuca","media source full"),this._resetPlayer(),this.play(e,t).then((()=>{this.debug.log("Jessibuca","media source full and reset player and play success")})).catch((()=>{this.debug.warn("Jessibuca","media source full and reset player and play error")}))}))})),this.player.once(F.mediaSourceAppendBufferError,(()=>{this.pause().then((()=>{this.debug.log("Jessibuca","media source append buffer error"),this._resetPlayer(),this.play(e,t).then((()=>{this.debug.log("Jessibuca","media source append buffer error and reset player and play success")})).catch((()=>{this.debug.warn("Jessibuca","media source append buffer error and reset player and play error")}))}))})),this.player.once(F.mediaSourceBufferListLarge,(()=>{this.pause().then((()=>{this.debug.log("Jessibuca","media source buffer list large"),this._resetPlayer(),this.play(e,t).then((()=>{this.debug.log("Jessibuca","media source buffer list large and reset player and play success")})).catch((()=>{this.debug.warn("Jessibuca","media source buffer list large and reset player and play error")}))}))})),this.player.once(F.mediaSourceAppendBufferEndTimeout,(()=>{this.pause().then((()=>{this.debug.log("Jessibuca","media source append buffer end timeout"),this._resetPlayer(),this.play(e,t).then((()=>{this.debug.log("Jessibuca","media source append buffer end timeout and reset player and play success")})).catch((()=>{this.debug.warn("Jessibuca","media source append buffer end timeout and reset player and play error")}))}))})),this.player.once(F.mseSourceBufferError,(()=>{this.pause().then((()=>{this.player._opt.autoWasm?(this.debug.log("Jessibuca","auto wasm [mse-> wasm] reset player and play"),this._resetPlayer({useMSE:!1}),this.play(e,t).then((()=>{this.debug.log("Jessibuca","auto wasm [mse-> wasm] reset player and play success")})).catch((()=>{this.debug.warn("Jessibuca","auto wasm [mse-> wasm] reset player and play error")}))):this.debug.log("Jessibuca","mse source buffer error and paused")}))})),this.player.once(F.webcodecsH265NotSupport,(()=>{this.pause().then((()=>{this.player._opt.autoWasm?(this.debug.log("Jessibuca","auto wasm [wcs-> wasm] reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e,t).then((()=>{this.debug.log("Jessibuca","auto wasm [wcs-> wasm] reset player and play success")})).catch((()=>{this.debug.warn("Jessibuca","auto wasm [wcs-> wasm] reset player and play error")}))):this.debug.log("Jessibuca","webcodecs h265 not support and paused")}))})),this.player.once(F.webcodecsWidthOrHeightChange,(()=>{this.pause().then((()=>{this.debug.log("Jessibuca","webcodecs Width Or Height Change reset player and play"),this._resetPlayer({useWCS:!0}),this.play(e,t).then((()=>{this.debug.log("Jessibuca","webcodecs Width Or Height Change reset player and play success")})).catch((()=>{this.debug.warn("Jessibuca","webcodecs Width Or Height Change reset player and play error")}))}))})),this.player.once(F.webcodecsDecodeError,(()=>{this.pause().then((()=>{this.player._opt.autoWasm?(this.debug.log("Jessibuca","webcodecs decode error reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e,t).then((()=>{this.debug.log("Jessibuca","webcodecs decode error reset player and play success")})).catch((()=>{this.debug.warn("Jessibuca","webcodecs decode error reset player and play error")}))):this.debug.log("Jessibuca","webcodecs decode error and paused")}))})),this.player.once(F.webcodecsConfigureError,(()=>{this.pause().then((()=>{this.player._opt.autoWasm?(this.debug.log("Jessibuca","webcodecs Configure error reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e,t).then((()=>{this.debug.log("Jessibuca","webcodecs Configure error reset player and play success")})).catch((()=>{this.debug.warn("Jessibuca","webcodecs Configure error reset player and play error")}))):this.debug.log("Jessibuca","webcodecs Configure error and paused")}))})),this.player.once(F.wasmDecodeError,(()=>{this.player._opt.wasmDecodeErrorReplay?this.pause().then((()=>{this.debug.log("Jessibuca","wasm decode error and reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e,t).then((()=>{this.debug.log("Jessibuca","wasm decode error and reset player and play success")})).catch((e=>{this.debug.warn("Jessibuca","wasm decode error and reset player and play error")}))})):this.pause().then((()=>{this.debug.log("Jessibuca","wasm decode error and paused")})).catch((e=>{this.debug.warn("Jessibuca","wasm decode error and paused error",e)}))})),this.player.once(F.fetchError,(()=>{this.pause().then((()=>{this.debug.log("Jessibuca","fetch error and pause play")})).catch((e=>{this.debug.warn("Jessibuca","fetch error and pause play error",e)}))})),this.player.once(F.websocketError,(()=>{this.pause().then((()=>{this.debug.log("Jessibuca","websocket Error and pause play")})).catch((e=>{this.debug.warn("Jessibuca","websocket Error and pause play error",e)}))})),this.player.once(j.streamEnd,(()=>{this.pause().then((()=>{this.debug.log("Jessibuca","stream End and pause play")})).catch((e=>{this.debug.warn("Jessibuca","stream End and pause play error",e)}))})),this.player.on(j.delayTimeout,(()=>{this.player._opt.heartTimeoutReplay&&(this._heartTimeoutReplayTimes{this._heartTimeoutReplayTimes=0})).catch((()=>{})))})),this.player.on(j.loadingTimeout,(()=>{this.player._opt.loadingTimeoutReplay&&(this._loadingTimeoutReplayTimes{this._loadingTimeoutReplayTimes=0})).catch((()=>{})))})),this.hasLoaded()?this.player.play(e,t).then((()=>{i()})).catch((e=>{this.debug.warn("Jessibuca","hasLoaded and play error",e),this.player&&this.player.pause().then((()=>{r(e)}))})):(this.debug.log("Jessibuca","_play ant waiting decoderWorkerInit"),this._checkInitDecoderWorkerTimeout(),this.player.once(j.decoderWorkerInit,(()=>{this._clearInitDecoderWorkerTimeout(),this.isDestroyed()||(this.debug.log("Jessibuca","_play decoderWorkerInit success and play"),this.player.play(e,t).then((()=>{i()})).catch((e=>{this.debug.warn("Jessibuca","decoderWorkerInit and play error",e),this.player&&this.player.pause().then((()=>{r(e)}))})))})))}))}resize(){this.player.resize()}setBufferTime(e){e=Number(e),this.player.updateOption({videoBuffer:1e3*e}),this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"videoBuffer",value:1e3*e})}setRotate(e){e=parseInt(e,10);this._opt.rotate!==e&&-1!==[0,90,180,270].indexOf(e)&&(this.player.updateOption({rotate:e}),this.resize())}hasLoaded(){return this.player.loaded}setKeepScreenOn(){this.player.updateOption({keepScreenOn:!0})}setFullscreen(e){const t=!!e;this.player.fullscreen!==t&&(this.player.fullscreen=t)}screenshot(e,t,i,r){return this.player.video?this.player.video.screenshot(e,t,i,r):""}startRecord(e,t){return new Promise(((i,r)=>{this.player.playing?(this.player.startRecord(e,t),i()):r()}))}stopRecordAndSave(){this.player.recording&&this.player.stopRecordAndSave()}isPlaying(){return!!this.player&&this.player.playing}isMute(){return!this.player.audio||this.player.audio.isMute}isRecording(){return this.player.recorder.recording}_checkHasCreated(e){if(!e)return!1;const t=function(e,t){return e?e.dataset?e.dataset[t]:e.getAttribute("data-"+t):""}(e,l);return!!t}toggleControlBar(e){this.isDestroyed()||this.player&&this.player.toggleControlBar(e)}getControlBarShow(){if(this.isDestroyed())return!1;let e=!1;return this.player&&(e=this.player.getControlBarShow()),e}_clearInitDecoderWorkerTimeout(){this.initDecoderWorkerTimeout&&(clearTimeout(this.initDecoderWorkerTimeout),this.initDecoderWorkerTimeout=null)}_checkInitDecoderWorkerTimeout(){this._clearInitDecoderWorkerTimeout(),this.initDecoderWorkerTimeout=setTimeout((()=>{this._handleInitDecoderWorkerTimeout()}),1e3*this._opt.initDecoderWorkerTimeout)}_handleInitDecoderWorkerTimeout(){this.pause().then((()=>{this.debug.log("Jessibuca","init decoder worker timeout and pause play")})).catch((e=>{this.debug.warn("Jessibuca","init decoder worker timeout and pause play error",e)}))}}return o(wt,"ERROR",F),o(wt,"TIMEOUT",{loadingTimeout:j.loadingTimeout,delayTimeout:j.delayTimeout}),window.Jessibuca=wt,wt})); diff --git a/package.json b/package.json index dcca72bf..8e5fd90f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jessibuca", - "version": "3.2.6", + "version": "3.2.8", "scripts": { "build": "npx cross-env NODE_ENV=production rollup -c", "build:wasm": "python wasm/make.py --wasm && npm run build && npm run build:demo", diff --git a/src/audio/audioContextLoader.js b/src/audio/audioContextLoader.js index 762c5fa3..38192ae8 100644 --- a/src/audio/audioContextLoader.js +++ b/src/audio/audioContextLoader.js @@ -75,7 +75,7 @@ export default class AudioContextLoader extends Emitter { async destroy() { this.closeAudio(); this.resetInit(); - if(this.audioContext){ + if (this.audioContext) { await this.audioContext.close(); this.audioContext = null; } @@ -318,5 +318,7 @@ export default class AudioContextLoader extends Emitter { this.playing = true; } - + getLastVolume() { + return this._prevVolume; + } } diff --git a/src/constant/index.js b/src/constant/index.js index de7863fa..11d0766c 100644 --- a/src/constant/index.js +++ b/src/constant/index.js @@ -64,7 +64,7 @@ export const DEFAULT_PLAYER_OPTIONS = { protocol: PLAYER_PLAY_PROTOCOL.fetch, demuxType: DEMUX_TYPE.flv, // demux type useWCS: false, // - wcsUseVideoRender: true,// 默认设置为true + wcsUseVideoRender: false,// 默认设置为true useMSE: false, // useOffscreen: false, // autoWasm: true, // 自动降级到 wasm 模式 diff --git a/src/player/index.js b/src/player/index.js index e650de67..b0b82095 100644 --- a/src/player/index.js +++ b/src/player/index.js @@ -1,4 +1,4 @@ -import {DEFAULT_PLAYER_OPTIONS, EVENTS, EVENTS_ERROR, JESSIBUCA_EVENTS,VERSION} from "../constant"; +import {DEFAULT_PLAYER_OPTIONS, EVENTS, EVENTS_ERROR, JESSIBUCA_EVENTS, VERSION} from "../constant"; import Debug from "../utils/debug"; import Events from "../utils/events"; import property from './property'; @@ -7,7 +7,7 @@ import { fpsStatus, initPlayTimes, isEmpty, isFalse, - isFullScreen, isMobile,isPad, + isFullScreen, isMobile, isPad, isNotEmpty, now, supportMediaStreamTrack, supportMSE, @@ -168,7 +168,7 @@ export default class Player extends Emitter { events(this); observer(this); - this.debug.log('Player', 'init and version is',VERSION); + this.debug.log('Player', 'init and version is', VERSION); if (this._opt.useWCS) { this.debug.log('Player', 'use WCS') @@ -657,7 +657,15 @@ export default class Player extends Emitter { * @param flag */ mute(flag) { - this.audio && this.audio.mute(flag) + if (this.audio) { + const prev = this.audio.getLastVolume(); + this.audio.mute(flag) + if (flag) { + this._lastVolume = 0; + } else { + this._lastVolume = prev || 0.5; + } + } } /** @@ -888,7 +896,7 @@ export default class Player extends Emitter { return result; } - getControlBarShow(){ + getControlBarShow() { let result = false; if (this.control) { result = this.control.getBarIsShow(); diff --git a/src/video/index.js b/src/video/index.js index e609381c..070a7516 100644 --- a/src/video/index.js +++ b/src/video/index.js @@ -8,7 +8,8 @@ export default class Video { } static getLoaderFactory(opt) { - if (opt.useMSE || (opt.useWCS && !opt.useOffscreen && opt.wcsUseVideoRender)) { + if (opt.useMSE || + (opt.useWCS && !opt.useOffscreen && opt.wcsUseVideoRender)) { return VideoLoader; } else { return CanvasVideoLoader; diff --git a/src/video/videoLoader.js b/src/video/videoLoader.js index 158ac179..ad70ba7b 100644 --- a/src/video/videoLoader.js +++ b/src/video/videoLoader.js @@ -207,6 +207,8 @@ export default class VideoLoader extends CommonLoader { render(msg) { if (this.vwriter) { this.vwriter.write(msg.videoFrame); + // release memory + msg.videoFrame.close(); } }